@8wave/ai-elements 0.125.0-beta.26 → 0.125.0-beta.28
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-CFGqa-tX.js → PkChatbotFilePreview-CqxtVySb.js} +100 -59
- package/dist/_chunks/PkChatbotFilePreview-CqxtVySb.js.map +1 -0
- package/dist/_chunks/{PkFilePreview-BPsD2P7s.js → PkFilePreview-DiLMoL-6.js} +32 -32
- package/dist/_chunks/{PkFilePreview-BPsD2P7s.js.map → PkFilePreview-DiLMoL-6.js.map} +1 -1
- package/dist/_chunks/{PkFilePreviewDialog-BW-Rubk2.js → PkFilePreviewDialog-CHBtxpoB.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-BW-Rubk2.js.map → PkFilePreviewDialog-CHBtxpoB.js.map} +1 -1
- package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js +555 -0
- package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js.map +1 -0
- package/dist/_chunks/{PkSelectionActions-DkETXtSL.js → PkSelectionActions-DFyvcEyl.js} +2 -2
- package/dist/_chunks/{PkSelectionActions-DkETXtSL.js.map → PkSelectionActions-DFyvcEyl.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-CqLpNWQv.js → PkStreamingMarkdown-0hE_Cx4W.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-CqLpNWQv.js.map → PkStreamingMarkdown-0hE_Cx4W.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-iE4ZokYD.js → PkToolChatFile-DtQ9xY4w.js} +3 -3
- package/dist/_chunks/{PkToolChatFile-iE4ZokYD.js.map → PkToolChatFile-DtQ9xY4w.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-lTHNZodf.js → PkToolShareDocument-BvHklbzb.js} +2 -2
- package/dist/_chunks/{PkToolShareDocument-lTHNZodf.js.map → PkToolShareDocument-BvHklbzb.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-BNQrM5fY.js → PkToolShowArtifact-BdkKU6P1.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-BNQrM5fY.js.map → PkToolShowArtifact-BdkKU6P1.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-CvQoLumn.js → PkToolShowContactForm-BmM2MbOK.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-CvQoLumn.js.map → PkToolShowContactForm-BmM2MbOK.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-DcPccCEU.js → PkToolShowForm-CoFlgA-I.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-DcPccCEU.js.map → PkToolShowForm-CoFlgA-I.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-B3VpJBVE.js → PkToolShowSources-DDBlLBt6.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-B3VpJBVE.js.map → PkToolShowSources-DDBlLBt6.js.map} +1 -1
- package/dist/_chunks/{utils-BZuri2jT.js → utils-ChmRkK0t.js} +12 -5
- package/dist/_chunks/utils-ChmRkK0t.js.map +1 -0
- package/dist/ai-elements.es.js +3197 -3115
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotFilePreview.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- 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-DyzEuNED.js → PkChatbot-BjJzskl7.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-DyzEuNED.js.map → PkChatbot-BjJzskl7.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-COya3H3C.js → PkChatbotEmptyState-CZC2gP3I.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-COya3H3C.js.map → PkChatbotEmptyState-CZC2gP3I.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFilePreview-BsvT6orx.js → PkChatbotFilePreview-j_8sDZUE.js} +112 -71
- package/dist-vue/_chunks/PkChatbotFilePreview-j_8sDZUE.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotInput-BmTdIJZ9.js +509 -0
- package/dist-vue/_chunks/PkChatbotInput-BmTdIJZ9.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotMessages-b2lupEv9.js +1049 -0
- package/dist-vue/_chunks/{PkChatbotMessages-BISaZu4z.js.map → PkChatbotMessages-b2lupEv9.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-cuYclK_2.js → PkChatbotStepPayload-D4w1XlF2.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-cuYclK_2.js.map → PkChatbotStepPayload-D4w1XlF2.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-Yd8cUQJP.js → PkChatbotStepToolDetail-DFTcjzoX.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-Yd8cUQJP.js.map → PkChatbotStepToolDetail-DFTcjzoX.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-_Aqft0em.js → PkChatbotSteps-D3zLulMo.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-_Aqft0em.js.map → PkChatbotSteps-D3zLulMo.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-CIfotKyM.js → PkChatbotViewChat-DawyiUjq.js} +323 -345
- package/dist-vue/_chunks/PkChatbotViewChat-DawyiUjq.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-DjhiHp8-.js → PkChatbotViewConversations-Bs246dtL.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-DjhiHp8-.js.map → PkChatbotViewConversations-Bs246dtL.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-C4oGN4Xj.js → PkChatbotViewFiles-uzZ5H4Fd.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-C4oGN4Xj.js.map → PkChatbotViewFiles-uzZ5H4Fd.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-NfTamy9j.js → PkChatbotViewProfile-BhIvfT_n.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-NfTamy9j.js.map → PkChatbotViewProfile-BhIvfT_n.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-DEKgCMkr.js → PkFilePreview-DfD48QQ_.js} +48 -48
- package/dist-vue/_chunks/{PkFilePreview-DEKgCMkr.js.map → PkFilePreview-DfD48QQ_.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-0qrzDWID.js → PkFilePreviewDialog-DFCBpQf3.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-0qrzDWID.js.map → PkFilePreviewDialog-DFCBpQf3.js.map} +1 -1
- package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js +550 -0
- package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js.map +1 -0
- package/dist-vue/_chunks/{PkStreamingMarkdown-2FN4WMQD.js → PkStreamingMarkdown-ChMbSviw.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-2FN4WMQD.js.map → PkStreamingMarkdown-ChMbSviw.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-DAT1tv52.js → PkToolChatFile-DQtABEaI.js} +3 -3
- package/dist-vue/_chunks/{PkToolChatFile-DAT1tv52.js.map → PkToolChatFile-DQtABEaI.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShareDocument-Qb2Lu5vh.js → PkToolShareDocument-cMUqik6v.js} +2 -2
- package/dist-vue/_chunks/{PkToolShareDocument-Qb2Lu5vh.js.map → PkToolShareDocument-cMUqik6v.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-Bskomw05.js → PkToolShowArtifact-w6SxjLPW.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-Bskomw05.js.map → PkToolShowArtifact-w6SxjLPW.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-iQrlqv7j.js → PkToolShowContactForm-BQ7bBTQU.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-iQrlqv7j.js.map → PkToolShowContactForm-BQ7bBTQU.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-C-43uUoh.js → PkToolShowDiagram-D-yQgdOL.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-C-43uUoh.js.map → PkToolShowDiagram-D-yQgdOL.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-CKXpqQxy.js → PkToolShowForm-CF00JLpa.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowForm-CKXpqQxy.js.map → PkToolShowForm-CF00JLpa.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-DLTn6JmU.js → PkToolShowImageGallery-ZJMWOWHq.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-DLTn6JmU.js.map → PkToolShowImageGallery-ZJMWOWHq.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-hhSBAQVC.js → PkToolShowProductList-CeKI9H36.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-hhSBAQVC.js.map → PkToolShowProductList-CeKI9H36.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-BMo_i8sv.js → PkToolShowSources-CXZqanmw.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-BMo_i8sv.js.map → PkToolShowSources-CXZqanmw.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-DJhsbDuX.js → PkToolShowVideo-BCs-i6xQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-DJhsbDuX.js.map → PkToolShowVideo-BCs-i6xQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-BAv66f5H.js → PkToolShowWebPages-Bixa0CjQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-BAv66f5H.js.map → PkToolShowWebPages-Bixa0CjQ.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-BZ1n3Hyx.js → useChatbotStore-BIjCGX0B.js} +858 -835
- package/dist-vue/_chunks/useChatbotStore-BIjCGX0B.js.map +1 -0
- package/dist-vue/_chunks/{utils-RwaXl9-x.js → utils-CaYEz-0A.js} +11 -4
- package/dist-vue/_chunks/utils-CaYEz-0A.js.map +1 -0
- package/dist-vue/composables.js +56 -4
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +49 -49
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +56 -0
- package/dist-vue/packages/components/src/chat/PkChatbotFilePreview.d.ts +14 -0
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +17 -3
- package/dist-vue/packages/components/src/chat/PkImageEditor.d.ts +37 -0
- package/dist-vue/packages/components/src/chat/PkImageEditorDialog.d.ts +19 -0
- package/dist-vue/packages/components/src/chat/imageEdits.d.ts +106 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +7 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +7 -1
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkChatbotFilePreview-CFGqa-tX.js.map +0 -1
- package/dist/_chunks/utils-BZuri2jT.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotFilePreview-BsvT6orx.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js +0 -478
- package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-BISaZu4z.js +0 -1049
- package/dist-vue/_chunks/PkChatbotViewChat-CIfotKyM.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-BZ1n3Hyx.js.map +0 -1
- package/dist-vue/_chunks/utils-RwaXl9-x.js.map +0 -1
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { s as e } from "./Media-DylqhvaF.js";
|
|
2
|
+
import { t } from "./VvButtonLocalized-C-vx25u4.js";
|
|
3
|
+
import { t as n } from "./PkStreamingMarkdown-ChMbSviw.js";
|
|
4
|
+
import { O as r } from "./utils-CaYEz-0A.js";
|
|
5
|
+
import { t as i } from "./PkChatbotFilePreview-j_8sDZUE.js";
|
|
6
|
+
import { VvDropdown as a, VvDropdownAction as o, VvIcon as s } from "@volverjs/ui-vue/components";
|
|
7
|
+
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineAsyncComponent as g, defineComponent as _, mergeModels as v, mergeProps as ee, nextTick as y, normalizeClass as b, normalizeProps as te, onBeforeUnmount as ne, onMounted as re, openBlock as x, ref as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E, useId as ie, useModel as D, useTemplateRef as O, watch as k, withCtx as A, withKeys as ae, withModifiers as oe } from "vue";
|
|
8
|
+
import { useI18n as se } from "vue-i18n";
|
|
9
|
+
import { useResizeObserver as ce } from "@vueuse/core";
|
|
10
|
+
// ../../node_modules/.pnpm/autosize@6.0.1/node_modules/autosize/dist/autosize.esm.js
|
|
11
|
+
var j = /* @__PURE__ */ new Map();
|
|
12
|
+
function le(e) {
|
|
13
|
+
var t = j.get(e);
|
|
14
|
+
t && t.destroy();
|
|
15
|
+
}
|
|
16
|
+
function M(e) {
|
|
17
|
+
var t = j.get(e);
|
|
18
|
+
t && t.update();
|
|
19
|
+
}
|
|
20
|
+
var N = null;
|
|
21
|
+
typeof window > "u" ? ((N = function(e) {
|
|
22
|
+
return e;
|
|
23
|
+
}).destroy = function(e) {
|
|
24
|
+
return e;
|
|
25
|
+
}, N.update = function(e) {
|
|
26
|
+
return e;
|
|
27
|
+
}) : ((N = function(e, t) {
|
|
28
|
+
return e && Array.prototype.forEach.call(e.length ? e : [e], function(e) {
|
|
29
|
+
return function(e) {
|
|
30
|
+
if (e && e.nodeName && e.nodeName === "TEXTAREA" && !j.has(e)) {
|
|
31
|
+
var t, n = null, r = window.getComputedStyle(e), i = (t = e.value, function() {
|
|
32
|
+
o({
|
|
33
|
+
testForHeightReduction: t === "" || !e.value.startsWith(t),
|
|
34
|
+
restoreTextAlign: null
|
|
35
|
+
}), t = e.value;
|
|
36
|
+
}), a = function(t) {
|
|
37
|
+
e.removeEventListener("autosize:destroy", a), e.removeEventListener("autosize:update", s), e.removeEventListener("input", i), window.removeEventListener("resize", s), Object.keys(t).forEach(function(n) {
|
|
38
|
+
return e.style[n] = t[n];
|
|
39
|
+
}), j.delete(e);
|
|
40
|
+
}.bind(e, {
|
|
41
|
+
height: e.style.height,
|
|
42
|
+
resize: e.style.resize,
|
|
43
|
+
textAlign: e.style.textAlign,
|
|
44
|
+
overflowY: e.style.overflowY,
|
|
45
|
+
overflowX: e.style.overflowX,
|
|
46
|
+
wordWrap: e.style.wordWrap
|
|
47
|
+
});
|
|
48
|
+
e.addEventListener("autosize:destroy", a), e.addEventListener("autosize:update", s), e.addEventListener("input", i), window.addEventListener("resize", s), e.style.overflowX = "hidden", e.style.wordWrap = "break-word", j.set(e, {
|
|
49
|
+
destroy: a,
|
|
50
|
+
update: s
|
|
51
|
+
}), s();
|
|
52
|
+
}
|
|
53
|
+
function o(t) {
|
|
54
|
+
var i, a, s = t.restoreTextAlign, c = s === void 0 ? null : s, l = t.testForHeightReduction, u = l === void 0 || l, d = r.overflowY;
|
|
55
|
+
if (e.scrollHeight !== 0 && (r.resize === "vertical" ? e.style.resize = "none" : r.resize === "both" && (e.style.resize = "horizontal"), u && (i = function(e) {
|
|
56
|
+
for (var t = []; e && e.parentNode && e.parentNode instanceof Element;) e.parentNode.scrollTop && t.push([e.parentNode, e.parentNode.scrollTop]), e = e.parentNode;
|
|
57
|
+
return function() {
|
|
58
|
+
return t.forEach(function(e) {
|
|
59
|
+
var t = e[0], n = e[1];
|
|
60
|
+
t.style.scrollBehavior = "auto", t.scrollTop = n, t.style.scrollBehavior = null;
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
}(e), e.style.height = ""), a = r.boxSizing === "content-box" ? e.scrollHeight - (parseFloat(r.paddingTop) + parseFloat(r.paddingBottom)) : e.scrollHeight + parseFloat(r.borderTopWidth) + parseFloat(r.borderBottomWidth), r.maxHeight !== "none" && a > parseFloat(r.maxHeight) ? (r.overflowY === "hidden" && (e.style.overflow = "scroll"), a = parseFloat(r.maxHeight)) : r.overflowY !== "hidden" && (e.style.overflow = "hidden"), e.style.height = a + "px", c && (e.style.textAlign = c), i && i(), n !== a && (e.dispatchEvent(new Event("autosize:resized", { bubbles: !0 })), n = a), d !== r.overflow && !c)) {
|
|
64
|
+
var f = r.textAlign;
|
|
65
|
+
r.overflow === "hidden" && (e.style.textAlign = f === "start" ? "end" : "start"), o({
|
|
66
|
+
restoreTextAlign: f,
|
|
67
|
+
testForHeightReduction: !0
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function s() {
|
|
72
|
+
o({
|
|
73
|
+
testForHeightReduction: !0,
|
|
74
|
+
restoreTextAlign: null
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}(e);
|
|
78
|
+
}), e;
|
|
79
|
+
}).destroy = function(e) {
|
|
80
|
+
return e && Array.prototype.forEach.call(e.length ? e : [e], le), e;
|
|
81
|
+
}, N.update = function(e) {
|
|
82
|
+
return e && Array.prototype.forEach.call(e.length ? e : [e], M), e;
|
|
83
|
+
});
|
|
84
|
+
var P = N, F = ["type"], I = {
|
|
85
|
+
key: 0,
|
|
86
|
+
class: "pk-chat-button__label"
|
|
87
|
+
}, L = /* @__PURE__ */ _({
|
|
88
|
+
__name: "PkChatButton",
|
|
89
|
+
props: {
|
|
90
|
+
icon: {},
|
|
91
|
+
label: { default: void 0 },
|
|
92
|
+
type: { default: "button" },
|
|
93
|
+
modifiers: { default: void 0 }
|
|
94
|
+
},
|
|
95
|
+
setup(e) {
|
|
96
|
+
return (t, n) => {
|
|
97
|
+
let r = s;
|
|
98
|
+
return x(), f("button", {
|
|
99
|
+
class: b(["pk-chat-button", [e.modifiers ? `pk-chat-button--${e.modifiers}` : void 0, { "pk-chat-button--labelled": e.label }]]),
|
|
100
|
+
type: e.type
|
|
101
|
+
}, [h(r, {
|
|
102
|
+
name: e.icon,
|
|
103
|
+
class: "pk-chat-button__icon"
|
|
104
|
+
}, null, 8, ["name"]), e.label ? (x(), f("span", I, T(e.label), 1)) : d("", !0)], 10, F);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}), ue = { class: "pk-chatbot-input" }, de = {
|
|
108
|
+
key: 0,
|
|
109
|
+
class: "pk-chatbot-input__notice",
|
|
110
|
+
role: "status"
|
|
111
|
+
}, fe = {
|
|
112
|
+
key: 2,
|
|
113
|
+
class: "pk-chatbot-input__notice-text"
|
|
114
|
+
}, pe = ["title"], me = {
|
|
115
|
+
key: 1,
|
|
116
|
+
class: "pk-chatbot-input__pointer"
|
|
117
|
+
}, he = { class: "pk-chatbot-input__pointer-label" }, ge = {
|
|
118
|
+
key: 2,
|
|
119
|
+
class: "pk-chatbot-input__attachments"
|
|
120
|
+
}, _e = { class: "pk-chatbot-input__fieldset" }, ve = [
|
|
121
|
+
"title",
|
|
122
|
+
"disabled",
|
|
123
|
+
"onClick"
|
|
124
|
+
], ye = ["accept"], be = ["accept"], xe = { class: "pk-chatbot-input__content" }, Se = [
|
|
125
|
+
"value",
|
|
126
|
+
"aria-label",
|
|
127
|
+
"aria-describedby",
|
|
128
|
+
"aria-invalid",
|
|
129
|
+
"placeholder"
|
|
130
|
+
], Ce = ["id"], we = { class: "opacity-60" }, R = /* @__PURE__ */ _({
|
|
131
|
+
__name: "PkChatbotInput",
|
|
132
|
+
props: /*@__PURE__*/ v({
|
|
133
|
+
placeholder: {},
|
|
134
|
+
dismissableNotice: {},
|
|
135
|
+
pageNotice: {},
|
|
136
|
+
status: {},
|
|
137
|
+
maxMessageLength: {},
|
|
138
|
+
fileUpload: {},
|
|
139
|
+
attachmentLimitReached: { type: Boolean },
|
|
140
|
+
attachmentNotice: {},
|
|
141
|
+
voiceEnabled: { type: Boolean },
|
|
142
|
+
queueEnabled: { type: Boolean },
|
|
143
|
+
answerNotices: {},
|
|
144
|
+
pointerAvailable: { type: Boolean },
|
|
145
|
+
pointing: { type: Boolean },
|
|
146
|
+
pointer: {},
|
|
147
|
+
automaticConfirmations: { type: Boolean },
|
|
148
|
+
editableImages: { type: Boolean },
|
|
149
|
+
retryableAttachments: { type: Boolean }
|
|
150
|
+
}, {
|
|
151
|
+
modelValue: { default: void 0 },
|
|
152
|
+
modelModifiers: {},
|
|
153
|
+
pendingAttachments: { default: () => [] },
|
|
154
|
+
pendingAttachmentsModifiers: {}
|
|
155
|
+
}),
|
|
156
|
+
emits: /*@__PURE__*/ v([
|
|
157
|
+
"submit",
|
|
158
|
+
"stop-generation",
|
|
159
|
+
"file-select",
|
|
160
|
+
"remove-attachment",
|
|
161
|
+
"replace-attachment",
|
|
162
|
+
"retry-attachment",
|
|
163
|
+
"dismiss-attachment-notice",
|
|
164
|
+
"dismiss-page-notice",
|
|
165
|
+
"open-answer-notice",
|
|
166
|
+
"dismiss-answer-notice",
|
|
167
|
+
"voice-start",
|
|
168
|
+
"point",
|
|
169
|
+
"remove-pointer",
|
|
170
|
+
"manual-confirmations"
|
|
171
|
+
], ["update:modelValue", "update:pendingAttachments"]),
|
|
172
|
+
setup(_, { expose: v, emit: j }) {
|
|
173
|
+
let le = g(() => import("./PkImageEditorDialog-BLUyILVi.js")), M = D(_, "modelValue"), N = D(_, "pendingAttachments"), F = j, I = _, { t: R } = se({ useScope: "global" }), z = O("textareaEl"), B = O("fileInputEl"), V = O("cameraInputEl"), H = O("formEl"), U = S(M.value ?? ""), W = null, G = () => {
|
|
174
|
+
W !== null && (clearTimeout(W), W = null);
|
|
175
|
+
}, Te = () => {
|
|
176
|
+
G(), M.value = U.value;
|
|
177
|
+
}, Ee = () => {
|
|
178
|
+
G(), W = setTimeout(() => {
|
|
179
|
+
M.value = U.value, W = null;
|
|
180
|
+
}, 300);
|
|
181
|
+
}, De = () => {
|
|
182
|
+
U.value = z.value?.value ?? "", Ee();
|
|
183
|
+
};
|
|
184
|
+
k(M, (e) => {
|
|
185
|
+
e !== U.value && (U.value = e ?? "", y(() => {
|
|
186
|
+
z.value && P.update(z.value);
|
|
187
|
+
}));
|
|
188
|
+
});
|
|
189
|
+
let K = l(() => I.status === "streaming"), q = l(() => I.status === "submitted"), J = l(() => K.value || q.value), Oe = ie(), ke = l(() => U.value.length), Y = l(() => I.maxMessageLength !== void 0 && ke.value > I.maxMessageLength), Ae = l(() => N.value.some((e) => e.state === "uploading")), je = l(() => N.value.some((e) => e.state === "error")), X = l(() => J.value && !I.queueEnabled || Ae.value || je.value || Y.value ? !1 : U.value.trim().length > 0), Me = l(() => J.value && X.value), Ne = "capture" in document.createElement("input"), Pe = l(() => {
|
|
190
|
+
let t = I.fileUpload?.allowedMimeTypes ?? [];
|
|
191
|
+
return [...t, ...e(t)].join(",");
|
|
192
|
+
}), Fe = l(() => (I.fileUpload?.allowedMimeTypes ?? []).filter((e) => e.startsWith("image/")).join(",")), Z = l(() => Ne && Fe.value.length > 0), Ie = () => {
|
|
193
|
+
B.value?.click();
|
|
194
|
+
}, Le = () => {
|
|
195
|
+
V.value?.click();
|
|
196
|
+
}, Re = (e) => {
|
|
197
|
+
for (let t of e) F("file-select", t);
|
|
198
|
+
}, ze = (e) => {
|
|
199
|
+
let t = e.target;
|
|
200
|
+
Re(Array.from(t.files ?? [])), t.value = "";
|
|
201
|
+
}, Be = (e) => {
|
|
202
|
+
let t = N.value.find((t) => t.id === e);
|
|
203
|
+
t && (URL.revokeObjectURL(t.localUrl), N.value = N.value.filter((t) => t.id !== e), F("remove-attachment", t));
|
|
204
|
+
}, Q = S(), $ = l(() => N.value.find((e) => e.id === Q.value)), Ve = (e) => !!I.editableImages && e.state !== "uploading" && r(e.file.type), He = async (e) => {
|
|
205
|
+
let t = $.value;
|
|
206
|
+
Q.value = void 0, t && (F("replace-attachment", t, e), await y(), z.value?.focus());
|
|
207
|
+
}, Ue = S(!0), We = () => {
|
|
208
|
+
Ue.value = !1;
|
|
209
|
+
}, Ge = l(() => {
|
|
210
|
+
if (I.attachmentNotice) return [{
|
|
211
|
+
id: "limit",
|
|
212
|
+
icon: "ri:information-line",
|
|
213
|
+
text: I.attachmentNotice,
|
|
214
|
+
dismiss: () => F("dismiss-attachment-notice")
|
|
215
|
+
}];
|
|
216
|
+
let e = [];
|
|
217
|
+
je.value && e.push({
|
|
218
|
+
id: "upload-failed",
|
|
219
|
+
icon: "ri:error-warning-line",
|
|
220
|
+
text: R("message.attachmentUploadFailed")
|
|
221
|
+
});
|
|
222
|
+
for (let t of I.answerNotices ?? []) e.push({
|
|
223
|
+
id: `answer-${t.id}`,
|
|
224
|
+
icon: "ri:chat-check-line",
|
|
225
|
+
text: t.text,
|
|
226
|
+
open: () => F("open-answer-notice", t.id),
|
|
227
|
+
dismiss: () => F("dismiss-answer-notice", t.id)
|
|
228
|
+
});
|
|
229
|
+
return I.pageNotice && e.push({
|
|
230
|
+
id: "page",
|
|
231
|
+
icon: "ri:pages-line",
|
|
232
|
+
text: I.pageNotice,
|
|
233
|
+
dismiss: () => F("dismiss-page-notice")
|
|
234
|
+
}), I.dismissableNotice && Ue.value && e.push({
|
|
235
|
+
id: "dismissable",
|
|
236
|
+
markdown: I.dismissableNotice,
|
|
237
|
+
dismiss: We
|
|
238
|
+
}), e;
|
|
239
|
+
}), Ke = () => {
|
|
240
|
+
H.value?.querySelector("button:focus-visible") && z.value?.focus();
|
|
241
|
+
}, qe = () => {
|
|
242
|
+
Ke(), F("stop-generation");
|
|
243
|
+
}, Je = () => {
|
|
244
|
+
X.value && (Ke(), Te(), F("submit"), U.value = "", M.value = "", y(() => {
|
|
245
|
+
z.value && (z.value.value = "", P.update(z.value));
|
|
246
|
+
}));
|
|
247
|
+
}, Ye = (e) => {
|
|
248
|
+
e.shiftKey || e.isComposing || e.keyCode === 229 || (e.preventDefault(), Je());
|
|
249
|
+
};
|
|
250
|
+
re(() => {
|
|
251
|
+
z.value && P(z.value);
|
|
252
|
+
});
|
|
253
|
+
let Xe = 0;
|
|
254
|
+
return ce(z, ([e]) => {
|
|
255
|
+
let t = e?.contentRect.width ?? 0;
|
|
256
|
+
z.value && t !== Xe && (Xe = t, P.update(z.value));
|
|
257
|
+
}), k(() => I.placeholder, async () => {
|
|
258
|
+
await y(), z.value && P.update(z.value);
|
|
259
|
+
}), ne(() => {
|
|
260
|
+
G(), z.value && P.destroy(z.value);
|
|
261
|
+
for (let e of N.value) URL.revokeObjectURL(e.localUrl);
|
|
262
|
+
}), v({ focus: () => z.value?.focus() }), (e, r) => {
|
|
263
|
+
let l = s, g = t, v = o, y = a;
|
|
264
|
+
return x(), f("div", ue, [
|
|
265
|
+
Ge.value.length ? (x(), f("div", de, [(x(!0), f(c, null, C(Ge.value, (e) => (x(), f("div", {
|
|
266
|
+
key: e.id,
|
|
267
|
+
class: "pk-chatbot-input__notice-item"
|
|
268
|
+
}, [
|
|
269
|
+
e.icon ? (x(), u(l, {
|
|
270
|
+
key: 0,
|
|
271
|
+
name: e.icon,
|
|
272
|
+
class: "pk-chatbot-input__notice-icon"
|
|
273
|
+
}, null, 8, ["name"])) : d("", !0),
|
|
274
|
+
e.markdown ? (x(), u(n, {
|
|
275
|
+
key: 1,
|
|
276
|
+
markdown: e.markdown,
|
|
277
|
+
class: "wysiwyg pk-chatbot-input__notice-text"
|
|
278
|
+
}, null, 8, ["markdown"])) : (x(), f("span", fe, T(e.text), 1)),
|
|
279
|
+
e.open ? (x(), u(g, {
|
|
280
|
+
key: 3,
|
|
281
|
+
label: E(R)("action.open"),
|
|
282
|
+
modifiers: "link",
|
|
283
|
+
class: "pk-chatbot-input__notice-action",
|
|
284
|
+
onClick: (t) => e.open()
|
|
285
|
+
}, null, 8, ["label", "onClick"])) : d("", !0),
|
|
286
|
+
e.dismiss ? (x(), u(g, {
|
|
287
|
+
key: 4,
|
|
288
|
+
title: E(R)("action.close"),
|
|
289
|
+
modifiers: "action-quiet",
|
|
290
|
+
icon: "ri:close-line",
|
|
291
|
+
class: "w-18 h-18",
|
|
292
|
+
onClick: (t) => e.dismiss()
|
|
293
|
+
}, null, 8, ["title", "onClick"])) : d("", !0)
|
|
294
|
+
]))), 128))])) : d("", !0),
|
|
295
|
+
p("form", {
|
|
296
|
+
ref_key: "formEl",
|
|
297
|
+
ref: H,
|
|
298
|
+
class: "pk-chatbot-input__form",
|
|
299
|
+
onSubmit: oe(Je, ["prevent"])
|
|
300
|
+
}, [
|
|
301
|
+
_.automaticConfirmations ? (x(), f("button", {
|
|
302
|
+
key: 0,
|
|
303
|
+
type: "button",
|
|
304
|
+
class: "pk-chatbot-input__mode",
|
|
305
|
+
title: E(R)("action.manualConfirmations"),
|
|
306
|
+
onClick: r[0] ||= (e) => F("manual-confirmations")
|
|
307
|
+
}, [
|
|
308
|
+
h(l, {
|
|
309
|
+
name: "ri:flashlight-line",
|
|
310
|
+
class: "pk-chatbot-input__pointer-icon"
|
|
311
|
+
}),
|
|
312
|
+
m(" " + T(E(R)("label.automaticConfirmations")) + " ", 1),
|
|
313
|
+
h(l, {
|
|
314
|
+
name: "ri:close-line",
|
|
315
|
+
class: "pk-chatbot-input__pointer-icon"
|
|
316
|
+
})
|
|
317
|
+
], 8, pe)) : d("", !0),
|
|
318
|
+
_.pointer ? (x(), f("div", me, [
|
|
319
|
+
h(l, {
|
|
320
|
+
name: _.pointer.kind === "text" ? "ri:double-quotes-l" : "ri:focus-3-line",
|
|
321
|
+
class: "pk-chatbot-input__pointer-icon"
|
|
322
|
+
}, null, 8, ["name"]),
|
|
323
|
+
p("span", he, T(_.pointer.kind === "text" ? `«${_.pointer.label}»` : _.pointer.label), 1),
|
|
324
|
+
h(g, {
|
|
325
|
+
title: E(R)("pagePointer.remove"),
|
|
326
|
+
modifiers: "action-quiet",
|
|
327
|
+
icon: "ri:close-line",
|
|
328
|
+
class: "w-18 h-18",
|
|
329
|
+
onClick: r[1] ||= (e) => F("remove-pointer")
|
|
330
|
+
}, null, 8, ["title"])
|
|
331
|
+
])) : d("", !0),
|
|
332
|
+
N.value.length ? (x(), f("div", ge, [(x(!0), f(c, null, C(N.value, (e) => (x(), u(i, {
|
|
333
|
+
key: e.id,
|
|
334
|
+
"media-type": e.mediaSource?.mimeType ?? e.file.type,
|
|
335
|
+
url: e.localUrl,
|
|
336
|
+
filename: e.file.name,
|
|
337
|
+
size: e.file.size,
|
|
338
|
+
loading: e.state === "uploading",
|
|
339
|
+
error: e.state === "error" ? e.error : void 0,
|
|
340
|
+
removable: e.state !== "uploading",
|
|
341
|
+
editable: Ve(e),
|
|
342
|
+
retryable: _.retryableAttachments && e.state === "error",
|
|
343
|
+
compact: "",
|
|
344
|
+
onRemove: (t) => Be(e.id),
|
|
345
|
+
onEdit: (t) => Q.value = e.id,
|
|
346
|
+
onRetry: (t) => F("retry-attachment", e)
|
|
347
|
+
}, null, 8, [
|
|
348
|
+
"media-type",
|
|
349
|
+
"url",
|
|
350
|
+
"filename",
|
|
351
|
+
"size",
|
|
352
|
+
"loading",
|
|
353
|
+
"error",
|
|
354
|
+
"removable",
|
|
355
|
+
"editable",
|
|
356
|
+
"retryable",
|
|
357
|
+
"onRemove",
|
|
358
|
+
"onEdit",
|
|
359
|
+
"onRetry"
|
|
360
|
+
]))), 128))])) : d("", !0),
|
|
361
|
+
p("div", _e, [
|
|
362
|
+
w(e.$slots, "prepend"),
|
|
363
|
+
_.fileUpload && _.fileUpload.enabled && (Z.value || e.$slots["additional-actions"]) ? (x(), u(y, te(ee({ key: 0 }, {
|
|
364
|
+
placement: "top-start",
|
|
365
|
+
modifiers: "menu",
|
|
366
|
+
flip: !0,
|
|
367
|
+
offset: 3
|
|
368
|
+
})), {
|
|
369
|
+
default: A(({ init: e, toggle: t, aria: n }) => [p("button", ee({ ref: (t) => e(t) }, n, {
|
|
370
|
+
class: "pk-chat-button",
|
|
371
|
+
type: "button",
|
|
372
|
+
title: E(R)("action.attachFile"),
|
|
373
|
+
disabled: J.value,
|
|
374
|
+
onClick: t
|
|
375
|
+
}), [h(l, {
|
|
376
|
+
name: "ri:add-line",
|
|
377
|
+
class: "pk-chat-button__icon"
|
|
378
|
+
})], 16, ve)]),
|
|
379
|
+
items: A(() => [
|
|
380
|
+
Z.value ? (x(), u(v, {
|
|
381
|
+
key: 0,
|
|
382
|
+
disabled: J.value || _.attachmentLimitReached,
|
|
383
|
+
onClick: Le
|
|
384
|
+
}, {
|
|
385
|
+
default: A(() => [h(l, {
|
|
386
|
+
name: "ri:camera-line",
|
|
387
|
+
class: "pk-chatbot-input__dropdown-icon"
|
|
388
|
+
}), m(" " + T(E(R)("action.takePhoto")), 1)]),
|
|
389
|
+
_: 1
|
|
390
|
+
}, 8, ["disabled"])) : d("", !0),
|
|
391
|
+
h(v, {
|
|
392
|
+
disabled: J.value || _.attachmentLimitReached,
|
|
393
|
+
onClick: Ie
|
|
394
|
+
}, {
|
|
395
|
+
default: A(() => [h(l, {
|
|
396
|
+
name: "ri:attachment-line",
|
|
397
|
+
class: "pk-chatbot-input__dropdown-icon"
|
|
398
|
+
}), m(" " + T(E(R)("action.attachFile")), 1)]),
|
|
399
|
+
_: 1
|
|
400
|
+
}, 8, ["disabled"]),
|
|
401
|
+
w(e.$slots, "additional-actions")
|
|
402
|
+
]),
|
|
403
|
+
_: 3
|
|
404
|
+
}, 16)) : _.fileUpload && _.fileUpload.enabled ? (x(), u(L, {
|
|
405
|
+
key: 1,
|
|
406
|
+
icon: "ri:add-line",
|
|
407
|
+
title: E(R)("action.attachFile"),
|
|
408
|
+
disabled: J.value || _.attachmentLimitReached,
|
|
409
|
+
onClick: Ie
|
|
410
|
+
}, null, 8, ["title", "disabled"])) : d("", !0),
|
|
411
|
+
_.fileUpload && _.fileUpload.enabled ? (x(), f("input", {
|
|
412
|
+
key: 2,
|
|
413
|
+
ref_key: "fileInputEl",
|
|
414
|
+
ref: B,
|
|
415
|
+
type: "file",
|
|
416
|
+
hidden: "",
|
|
417
|
+
multiple: "",
|
|
418
|
+
accept: Pe.value,
|
|
419
|
+
onChange: ze
|
|
420
|
+
}, null, 40, ye)) : d("", !0),
|
|
421
|
+
_.fileUpload && _.fileUpload.enabled && Z.value ? (x(), f("input", {
|
|
422
|
+
key: 3,
|
|
423
|
+
ref_key: "cameraInputEl",
|
|
424
|
+
ref: V,
|
|
425
|
+
type: "file",
|
|
426
|
+
capture: "environment",
|
|
427
|
+
hidden: "",
|
|
428
|
+
accept: Fe.value,
|
|
429
|
+
onChange: ze
|
|
430
|
+
}, null, 40, be)) : d("", !0),
|
|
431
|
+
_.pointerAvailable ? (x(), u(L, {
|
|
432
|
+
key: 4,
|
|
433
|
+
icon: "ri:focus-3-line",
|
|
434
|
+
title: E(R)("pagePointer.start"),
|
|
435
|
+
"aria-pressed": _.pointing,
|
|
436
|
+
disabled: J.value,
|
|
437
|
+
onClick: r[2] ||= (e) => F("point")
|
|
438
|
+
}, null, 8, [
|
|
439
|
+
"title",
|
|
440
|
+
"aria-pressed",
|
|
441
|
+
"disabled"
|
|
442
|
+
])) : d("", !0),
|
|
443
|
+
p("div", xe, [p("textarea", {
|
|
444
|
+
ref_key: "textareaEl",
|
|
445
|
+
ref: z,
|
|
446
|
+
value: U.value,
|
|
447
|
+
class: "pk-chatbot-input__textarea",
|
|
448
|
+
name: "message",
|
|
449
|
+
rows: "1",
|
|
450
|
+
enterkeyhint: "send",
|
|
451
|
+
"aria-label": E(R)("label.message"),
|
|
452
|
+
"aria-describedby": _.maxMessageLength ? E(Oe) : void 0,
|
|
453
|
+
"aria-invalid": Y.value || void 0,
|
|
454
|
+
placeholder: _.placeholder,
|
|
455
|
+
onInput: De,
|
|
456
|
+
onKeydown: ae(Ye, ["enter"])
|
|
457
|
+
}, null, 40, Se)]),
|
|
458
|
+
_.maxMessageLength ? (x(), f("div", {
|
|
459
|
+
key: 5,
|
|
460
|
+
id: E(Oe),
|
|
461
|
+
class: b(["pk-chatbot-input__counter", { "pk-chatbot-input__counter--over": Y.value }])
|
|
462
|
+
}, [m(T(e.$n(ke.value, "integer")) + "/", 1), p("span", we, T(e.$n(_.maxMessageLength, "integer")), 1)], 10, Ce)) : d("", !0),
|
|
463
|
+
_.voiceEnabled && !K.value ? (x(), u(L, {
|
|
464
|
+
key: 6,
|
|
465
|
+
icon: "ri:mic-line",
|
|
466
|
+
title: E(R)("action.talk"),
|
|
467
|
+
disabled: J.value,
|
|
468
|
+
onClick: r[3] ||= (e) => F("voice-start")
|
|
469
|
+
}, null, 8, ["title", "disabled"])) : d("", !0),
|
|
470
|
+
K.value ? (x(), u(L, {
|
|
471
|
+
key: 7,
|
|
472
|
+
icon: "ri:stop-fill",
|
|
473
|
+
modifiers: Me.value ? void 0 : "primary",
|
|
474
|
+
title: E(R)("action.stop"),
|
|
475
|
+
onClick: qe
|
|
476
|
+
}, null, 8, ["modifiers", "title"])) : d("", !0),
|
|
477
|
+
Me.value ? (x(), u(L, {
|
|
478
|
+
key: 8,
|
|
479
|
+
type: "submit",
|
|
480
|
+
modifiers: "primary",
|
|
481
|
+
icon: "ri:arrow-up-line",
|
|
482
|
+
title: E(R)("action.queueMessage")
|
|
483
|
+
}, null, 8, ["title"])) : K.value ? d("", !0) : (x(), u(L, {
|
|
484
|
+
key: 9,
|
|
485
|
+
type: "submit",
|
|
486
|
+
modifiers: "primary",
|
|
487
|
+
icon: q.value ? "loading-loop" : "ri:arrow-up-line",
|
|
488
|
+
title: E(R)("action.submit"),
|
|
489
|
+
disabled: !X.value
|
|
490
|
+
}, null, 8, [
|
|
491
|
+
"icon",
|
|
492
|
+
"title",
|
|
493
|
+
"disabled"
|
|
494
|
+
]))
|
|
495
|
+
])
|
|
496
|
+
], 544),
|
|
497
|
+
$.value ? (x(), u(E(le), {
|
|
498
|
+
key: 1,
|
|
499
|
+
file: $.value.file,
|
|
500
|
+
onApply: He,
|
|
501
|
+
onClose: r[4] ||= (e) => Q.value = void 0
|
|
502
|
+
}, null, 8, ["file"])) : d("", !0)
|
|
503
|
+
]);
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
export { L as n, R as t };
|
|
508
|
+
|
|
509
|
+
//# sourceMappingURL=PkChatbotInput-BmTdIJZ9.js.map
|