@8wave/ai-elements 0.112.0 → 0.114.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/_chunks/Agent-D3ODaN3E.js +566 -0
  2. package/dist/_chunks/Agent-D3ODaN3E.js.map +1 -0
  3. package/dist/_chunks/{PkStreamingMarkdown-CRlRDGYl.js → PkStreamingMarkdown-CYOm47PX.js} +1276 -453
  4. package/dist/_chunks/PkStreamingMarkdown-CYOm47PX.js.map +1 -0
  5. package/dist/_chunks/{PkToolRequestGeolocation-BbxYKt-9.js → PkToolRequestGeolocation-BY7nXImb.js} +2 -2
  6. package/dist/_chunks/{PkToolRequestGeolocation-BbxYKt-9.js.map → PkToolRequestGeolocation-BY7nXImb.js.map} +1 -1
  7. package/dist/_chunks/{PkToolRequestOAuthConnection-CTp2w60F.js → PkToolRequestOAuthConnection-DFOTALFt.js} +2 -2
  8. package/dist/_chunks/{PkToolRequestOAuthConnection-CTp2w60F.js.map → PkToolRequestOAuthConnection-DFOTALFt.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShowArtifact-CNnt82aH.js → PkToolShowArtifact-DzHRWoru.js} +2 -2
  10. package/dist/_chunks/{PkToolShowArtifact-CNnt82aH.js.map → PkToolShowArtifact-DzHRWoru.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowContactForm-D77gyjQG.js → PkToolShowContactForm-1J6_1AA2.js} +2 -2
  12. package/dist/_chunks/{PkToolShowContactForm-D77gyjQG.js.map → PkToolShowContactForm-1J6_1AA2.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowForm-DP4LLAk3.js → PkToolShowForm-DmQYj3v1.js} +5 -5
  14. package/dist/_chunks/{PkToolShowForm-DP4LLAk3.js.map → PkToolShowForm-DmQYj3v1.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowSources-Bwy0Ptmi.js → PkToolShowSources-BO8V5rlS.js} +3 -3
  16. package/dist/_chunks/{PkToolShowSources-Bwy0Ptmi.js.map → PkToolShowSources-BO8V5rlS.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowSuggestedReply-CFO8wV1b.js → PkToolShowSuggestedReply-CTWVG1Zk.js} +2 -2
  18. package/dist/_chunks/{PkToolShowSuggestedReply-CFO8wV1b.js.map → PkToolShowSuggestedReply-CTWVG1Zk.js.map} +1 -1
  19. package/dist/_chunks/{markdown-BRD-hDrH.js → markdown-JpLFzufn.js} +7 -7
  20. package/dist/_chunks/{markdown-BRD-hDrH.js.map → markdown-JpLFzufn.js.map} +1 -1
  21. package/dist/_chunks/url-validation-uLMZ5-AU.js.map +1 -1
  22. package/dist/ai-elements.es.js +2773 -2733
  23. package/dist/ai-elements.es.js.map +1 -1
  24. package/dist-vue/PkChatbot.js +1 -1
  25. package/dist-vue/PkChatbotEmptyState.js +1 -1
  26. package/dist-vue/PkChatbotInput.js +1 -1
  27. package/dist-vue/PkChatbotMessages.js +1 -1
  28. package/dist-vue/PkChatbotStepPayload.js +1 -1
  29. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  30. package/dist-vue/PkChatbotSteps.js +1 -1
  31. package/dist-vue/PkChatbotViewChat.js +1 -1
  32. package/dist-vue/PkChatbotViewConversations.js +1 -1
  33. package/dist-vue/PkChatbotViewFiles.js +1 -1
  34. package/dist-vue/PkChatbotViewProfile.js +1 -1
  35. package/dist-vue/_chunks/Media-_HfFLHGD.js.map +1 -1
  36. package/dist-vue/_chunks/{PkChatbot-C11EVHnI.js → PkChatbot-DZP40EZP.js} +8 -8
  37. package/dist-vue/_chunks/{PkChatbot-C11EVHnI.js.map → PkChatbot-DZP40EZP.js.map} +1 -1
  38. package/dist-vue/_chunks/{PkChatbotEmptyState-CacY4o02.js → PkChatbotEmptyState-DycCrfwz.js} +2 -2
  39. package/dist-vue/_chunks/{PkChatbotEmptyState-CacY4o02.js.map → PkChatbotEmptyState-DycCrfwz.js.map} +1 -1
  40. package/dist-vue/_chunks/{PkChatbotInput-Dkz3SNAk.js → PkChatbotInput-BCuqLdkT.js} +2 -2
  41. package/dist-vue/_chunks/{PkChatbotInput-Dkz3SNAk.js.map → PkChatbotInput-BCuqLdkT.js.map} +1 -1
  42. package/dist-vue/_chunks/PkChatbotMessages-PjKRDNYJ.js +776 -0
  43. package/dist-vue/_chunks/PkChatbotMessages-PjKRDNYJ.js.map +1 -0
  44. package/dist-vue/_chunks/{PkChatbotStepPayload-DU0W-eUp.js → PkChatbotStepPayload-CI98RiNv.js} +2 -2
  45. package/dist-vue/_chunks/{PkChatbotStepPayload-DU0W-eUp.js.map → PkChatbotStepPayload-CI98RiNv.js.map} +1 -1
  46. package/dist-vue/_chunks/{PkChatbotStepToolDetail-etlBryOg.js → PkChatbotStepToolDetail-B8zXJOdI.js} +3 -3
  47. package/dist-vue/_chunks/{PkChatbotStepToolDetail-etlBryOg.js.map → PkChatbotStepToolDetail-B8zXJOdI.js.map} +1 -1
  48. package/dist-vue/_chunks/PkChatbotSteps-CL27pMFS.js +190 -0
  49. package/dist-vue/_chunks/{PkChatbotSteps-jW07Q-4x.js.map → PkChatbotSteps-CL27pMFS.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkChatbotViewChat-DJnjuhjt.js → PkChatbotViewChat-BZVcDXzL.js} +7 -7
  51. package/dist-vue/_chunks/{PkChatbotViewChat-DJnjuhjt.js.map → PkChatbotViewChat-BZVcDXzL.js.map} +1 -1
  52. package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js → PkChatbotViewConversations-Cx-mLdUE.js} +2 -2
  53. package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js.map → PkChatbotViewConversations-Cx-mLdUE.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js → PkChatbotViewFiles-DLIa-xG8.js} +2 -2
  55. package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js.map → PkChatbotViewFiles-DLIa-xG8.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js → PkChatbotViewProfile-DEc9apXY.js} +2 -2
  57. package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js.map → PkChatbotViewProfile-DEc9apXY.js.map} +1 -1
  58. package/dist-vue/_chunks/PkStreamingMarkdown-B2iju0WK.js +3245 -0
  59. package/dist-vue/_chunks/PkStreamingMarkdown-B2iju0WK.js.map +1 -0
  60. package/dist-vue/_chunks/{PkToolShowArtifact-BnwU7CV2.js → PkToolShowArtifact-C0J71YF6.js} +2 -2
  61. package/dist-vue/_chunks/{PkToolShowArtifact-BnwU7CV2.js.map → PkToolShowArtifact-C0J71YF6.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkToolShowContactForm-_x_dbiHn.js → PkToolShowContactForm-De3Od9mC.js} +2 -2
  63. package/dist-vue/_chunks/{PkToolShowContactForm-_x_dbiHn.js.map → PkToolShowContactForm-De3Od9mC.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkToolShowDiagram-RtkI_sKL.js → PkToolShowDiagram-DmY_hhAS.js} +2 -2
  65. package/dist-vue/_chunks/{PkToolShowDiagram-RtkI_sKL.js.map → PkToolShowDiagram-DmY_hhAS.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkToolShowEmail-CRQjoJr1.js → PkToolShowEmail-D_Z15wCS.js} +2 -2
  67. package/dist-vue/_chunks/{PkToolShowEmail-CRQjoJr1.js.map → PkToolShowEmail-D_Z15wCS.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkToolShowForm-IPAkJIXh.js → PkToolShowForm-DUGysIxj.js} +3 -3
  69. package/dist-vue/_chunks/{PkToolShowForm-IPAkJIXh.js.map → PkToolShowForm-DUGysIxj.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkToolShowMessage-joTzAg9N.js → PkToolShowMessage-e5_EI5mV.js} +2 -2
  71. package/dist-vue/_chunks/{PkToolShowMessage-joTzAg9N.js.map → PkToolShowMessage-e5_EI5mV.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolShowProductList-tOYjd2bq.js → PkToolShowProductList-B3X7Svyc.js} +2 -2
  73. package/dist-vue/_chunks/{PkToolShowProductList-tOYjd2bq.js.map → PkToolShowProductList-B3X7Svyc.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolShowSources-gI947JOm.js → PkToolShowSources-BUjBSGc5.js} +3 -3
  75. package/dist-vue/_chunks/{PkToolShowSources-gI947JOm.js.map → PkToolShowSources-BUjBSGc5.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowWebPages-D3Xy4iUs.js → PkToolShowWebPages-DEih8h5k.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowWebPages-D3Xy4iUs.js.map → PkToolShowWebPages-DEih8h5k.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkUrl-BgMBemSz.js → PkUrl-3NH9t-WA.js} +2 -2
  79. package/dist-vue/_chunks/{PkUrl-BgMBemSz.js.map → PkUrl-3NH9t-WA.js.map} +1 -1
  80. package/dist-vue/_chunks/{createChatbotApiClient-CaVLm5W9.js → createChatbotApiClient-DohvHshj.js} +115 -108
  81. package/dist-vue/_chunks/createChatbotApiClient-DohvHshj.js.map +1 -0
  82. package/dist-vue/_chunks/url-validation-uLMZ5-AU.js.map +1 -1
  83. package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js → useChatbotStore-_10Jaf4z.js} +2 -2
  84. package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js.map → useChatbotStore-_10Jaf4z.js.map} +1 -1
  85. package/dist-vue/_chunks/utils-BL4Ppr2R.js +184 -0
  86. package/dist-vue/_chunks/utils-BL4Ppr2R.js.map +1 -0
  87. package/dist-vue/api.js +1 -1
  88. package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +1 -3
  89. package/dist-vue/composables.js +136 -95
  90. package/dist-vue/composables.js.map +1 -1
  91. package/dist-vue/index.js +3203 -3107
  92. package/dist-vue/index.js.map +1 -1
  93. package/dist-vue/locales.js +16 -0
  94. package/dist-vue/packages/auth/src/social-redirect-plugin.d.ts +18 -12
  95. package/dist-vue/packages/components/src/chat/PkTurnEvaluation.d.ts +8 -0
  96. package/dist-vue/packages/components/src/chat/markdownHtml.d.ts +20 -0
  97. package/dist-vue/packages/components/src/chat/utils.d.ts +9 -0
  98. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +60 -0
  99. package/dist-vue/packages/models/src/schema/AgentApiTool.d.ts +70 -0
  100. package/dist-vue/packages/models/src/schema/Chat.d.ts +42 -0
  101. package/dist-vue/packages/models/src/schema/Lead.d.ts +13 -0
  102. package/dist-vue/packages/models/src/schema/Media.d.ts +0 -1
  103. package/dist-vue/packages/models/src/schema/ModelProvider.d.ts +1 -1
  104. package/dist-vue/style.css +1 -1
  105. package/package.json +2 -1
  106. package/dist/_chunks/Agent-DTLrWpzX.js +0 -460
  107. package/dist/_chunks/Agent-DTLrWpzX.js.map +0 -1
  108. package/dist/_chunks/Media-Cft7Pwrh.js +0 -108
  109. package/dist/_chunks/Media-Cft7Pwrh.js.map +0 -1
  110. package/dist/_chunks/PkStreamingMarkdown-CRlRDGYl.js.map +0 -1
  111. package/dist-vue/_chunks/PkChatbotMessages-BD-vUak6.js +0 -776
  112. package/dist-vue/_chunks/PkChatbotMessages-BD-vUak6.js.map +0 -1
  113. package/dist-vue/_chunks/PkChatbotSteps-jW07Q-4x.js +0 -190
  114. package/dist-vue/_chunks/PkStreamingMarkdown-BoEpwaYQ.js +0 -2430
  115. package/dist-vue/_chunks/PkStreamingMarkdown-BoEpwaYQ.js.map +0 -1
  116. package/dist-vue/_chunks/createChatbotApiClient-CaVLm5W9.js.map +0 -1
  117. package/dist-vue/_chunks/utils-h4C7rRcu.js +0 -177
  118. package/dist-vue/_chunks/utils-h4C7rRcu.js.map +0 -1
@@ -0,0 +1,776 @@
1
+ import { k as e } from "./Agent-BNlmK-uJ.js";
2
+ import { t } from "./PkStreamingMarkdown-B2iju0WK.js";
3
+ import "./src-DT8FLE4_.js";
4
+ import { a as n, c as r, o as i, r as a, s as o, t as s } from "./message-RohfrdWS.js";
5
+ import { t as c } from "./PkChatbotError-CuX9C_b9.js";
6
+ import { t as l } from "./PkRelativeTime--1cIphlA.js";
7
+ import { S as u, _ as d, b as f, c as p, d as m, f as h, i as g, n as ee, p as _, t as v, u as y, x as te, y as ne } from "./utils-BL4Ppr2R.js";
8
+ import { t as re } from "./PkChatbotFilePreview-CwiVQDF2.js";
9
+ import { t as ie } from "./PkChatbotFeedbackForm-4XWLHOkB.js";
10
+ import { t as ae } from "./PkChatbotMessageFeedback-BYmrVaCE.js";
11
+ import { n as b, t as oe } from "./PkChatbotSteps-CL27pMFS.js";
12
+ import { t as x } from "./PkChatbotOutlineRail-np4g6vsz.js";
13
+ import { VvButton as se, VvButtonGroup as ce, VvIcon as le } from "@volverjs/ui-vue/components";
14
+ import { Fragment as S, Transition as C, computed as w, createBlock as T, createCommentVNode as E, createElementBlock as D, createElementVNode as O, createTextVNode as ue, createVNode as k, defineAsyncComponent as A, defineComponent as j, mergeProps as de, nextTick as M, normalizeClass as N, normalizeStyle as P, onBeforeUnmount as F, onMounted as fe, openBlock as I, ref as L, renderList as pe, renderSlot as me, resolveDynamicComponent as he, toDisplayString as R, unref as z, useSlots as ge, useTemplateRef as _e, watch as B, withCtx as V, withModifiers as H } from "vue";
15
+ import { useI18n as ve } from "vue-i18n";
16
+ //#region ../../packages/utils/src/text.ts
17
+ var U = (e) => e.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), ye = (e) => e ? e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[-_]+/g, " ") : "", be = (e) => e ? U(e).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^a-zA-Z0-9]+/g, "-").toLowerCase() : "", xe = (e) => e ? U(e).replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").toLowerCase() : "", Se = (e) => e ? e.charAt(0).toUpperCase() + e.slice(1) : "", Ce = {
18
+ requestOAuthConnection: A(() => import("./PkToolRequestOAuthConnection-BorR5NmZ.js")),
19
+ showArtifact: A(() => import("./PkToolShowArtifact-C0J71YF6.js").then((e) => e.n)),
20
+ showCalendarEvent: A(() => import("./PkToolShowCalendarEvent-BsBdsbV0.js").then((e) => e.n)),
21
+ showComparison: A(() => import("./PkToolShowComparison-BLn4pkno.js").then((e) => e.n)),
22
+ showContactForm: A(() => import("./PkToolShowContactForm-De3Od9mC.js").then((e) => e.n)),
23
+ showDiagram: A(() => import("./PkToolShowDiagram-DmY_hhAS.js")),
24
+ showEmail: A(() => import("./PkToolShowEmail-D_Z15wCS.js").then((e) => e.n)),
25
+ showImageGallery: A(() => import("./PkToolShowImageGallery-DudQzBx4.js").then((e) => e.n)),
26
+ showLocation: A(() => import("./PkToolShowLocation-Bv6sLN5P.js").then((e) => e.n)),
27
+ showMessage: A(() => import("./PkToolShowMessage-e5_EI5mV.js").then((e) => e.n)),
28
+ showForm: A(() => import("./PkToolShowForm-DUGysIxj.js").then((e) => e.n)),
29
+ showMultipleChoice: A(() => import("./PkToolShowForm-DUGysIxj.js").then((e) => e.n)),
30
+ showProductList: A(() => import("./PkToolShowProductList-B3X7Svyc.js").then((e) => e.n)),
31
+ showQrCode: A(() => import("./PkToolShowQrCode-DEAvfLFu.js").then((e) => e.n)),
32
+ showSources: A(() => import("./PkToolShowSources-BUjBSGc5.js").then((e) => e.n)),
33
+ showSuggestedReply: A(() => import("./PkToolShowSuggestedReply-DA4NEjHB.js").then((e) => e.n)),
34
+ showVideo: A(() => import("./PkToolShowVideo-BZOTu2Qe.js")),
35
+ showWeather: A(() => import("./PkToolShowWeather-Bzqalzh8.js")),
36
+ showWebPages: A(() => import("./PkToolShowWebPages-DEih8h5k.js").then((e) => e.n))
37
+ }, W = {
38
+ key: 0,
39
+ class: "text-12 text-word-3 m-0 mb-xs"
40
+ }, G = /* @__PURE__ */ j({
41
+ __name: "PkToolApprovalPreviewMessage",
42
+ props: { input: {} },
43
+ setup(e) {
44
+ let t = e, n = w(() => {
45
+ let e = t.input;
46
+ return typeof e?.message == "string" ? e.message : "";
47
+ });
48
+ return (e, t) => n.value ? (I(), D("p", W, R(n.value), 1)) : E("", !0);
49
+ }
50
+ }), we = { [v]: G }, Te = {
51
+ key: 0,
52
+ class: "text-12 text-word-3 m-0 mb-xs"
53
+ }, Ee = /* @__PURE__ */ j({
54
+ __name: "PkToolApprovalCard",
55
+ props: {
56
+ part: {},
57
+ actionable: { type: Boolean },
58
+ callVerdict: { type: Boolean }
59
+ },
60
+ emits: ["respond"],
61
+ setup(t, { emit: n }) {
62
+ let r = t, i = n, { t: o } = ve({ useScope: "global" }), s = w(() => r.part), c = w(() => a(r.part)), l = w(() => c.value === v), u = w(() => l.value ? (s.value.state === "input-available" || e(s.value.output)) && r.callVerdict === void 0 : s.value.state === "approval-requested"), d = w(() => u.value && r.actionable === !0), f = w(() => u.value && r.actionable !== !0), p = w(() => l.value ? s.value.output === "confirmed" || r.callVerdict === !0 : s.value.approval?.approved === !0), m = w(() => l.value ? s.value.output === "cancelled" || r.callVerdict === !1 : s.value.approval?.approved === !1 || s.value.state === "output-denied"), h = w(() => we[c.value]), g = w(() => {
63
+ if (f.value) return {
64
+ icon: "ri:time-line",
65
+ message: o("toolApproval.expired")
66
+ };
67
+ if (p.value) return {
68
+ icon: "ri:check-line",
69
+ message: o(l.value ? "toolApproval.confirmed" : "toolApproval.approved")
70
+ };
71
+ if (m.value) return {
72
+ icon: "ri:close-line",
73
+ message: o(l.value ? "toolApproval.cancelled" : "toolApproval.denied")
74
+ };
75
+ }), ee = w(() => !!g.value && !h.value);
76
+ return (e, n) => {
77
+ let r = se, a = ce, c = le;
78
+ return I(), D("div", { class: N(["w-full overflow-hidden transition-all duration-300", { "bg-surface p-sm rounded-xl border border-surface-3": !ee.value }]) }, [
79
+ k(C, null, {
80
+ default: V(() => [!l.value && u.value ? (I(), D("p", Te, R(z(o)("toolApproval.prompt")), 1)) : E("", !0)]),
81
+ _: 1
82
+ }),
83
+ h.value ? (I(), T(he(h.value), {
84
+ key: 0,
85
+ part: t.part,
86
+ input: s.value.input
87
+ }, null, 8, ["part", "input"])) : E("", !0),
88
+ k(C, { mode: "out-in" }, {
89
+ default: V(() => [g.value ? (I(), D("p", {
90
+ key: 1,
91
+ class: N(["flex items-center gap-4 text-12 text-word-3 m-0", { "mt-xs": h.value }])
92
+ }, [k(c, {
93
+ name: g.value.icon,
94
+ class: "shrink-0"
95
+ }, null, 8, ["name"]), ue(" " + R(g.value.message), 1)], 2)) : (I(), T(a, { key: 0 }, {
96
+ default: V(() => [k(r, {
97
+ modifiers: "primary-small",
98
+ disabled: !d.value,
99
+ icon: "ri:check-line",
100
+ label: z(o)("action.proceed"),
101
+ onClick: n[0] ||= H((e) => i("respond", !0), ["stop"])
102
+ }, null, 8, ["disabled", "label"]), k(r, {
103
+ modifiers: "action-quiet-small",
104
+ disabled: !d.value,
105
+ icon: "ri:close-line",
106
+ label: z(o)("action.cancel"),
107
+ onClick: n[1] ||= H((e) => i("respond", !1), ["stop"])
108
+ }, null, 8, ["disabled", "label"])]),
109
+ _: 1
110
+ }))]),
111
+ _: 1
112
+ })
113
+ ], 2);
114
+ };
115
+ }
116
+ }), De = 30, Oe = 500;
117
+ function ke(e) {
118
+ let { scrollEl: t, status: n, messagesLength: r, lastMessageRole: i, contentEl: a, beforeNewMessageScroll: o, onScrollUp: s, onScrollDown: c } = e, l = L(!1), u = L(!0), d = !1, f = null, p = null, m = null, h = null, g = 0, ee = (e = "smooth") => {
119
+ if (!t.value || l.value) {
120
+ d = !1;
121
+ return;
122
+ }
123
+ d = !0, t.value.scrollTo({
124
+ top: t.value.scrollHeight,
125
+ behavior: e
126
+ }), setTimeout(() => {
127
+ d = !1;
128
+ }, e === "instant" ? 0 : Oe);
129
+ }, _ = (e) => {
130
+ e.deltaY < 0 && (l.value = !0);
131
+ }, v = 0, y = (e) => {
132
+ v = e.touches[0]?.clientY ?? 0;
133
+ }, te = (e) => {
134
+ let t = e.touches[0]?.clientY ?? 0;
135
+ t > v && (l.value = !0), v = t;
136
+ }, ne = () => {
137
+ if (!t.value) return;
138
+ let { scrollTop: e, scrollHeight: n, clientHeight: r } = t.value;
139
+ if (u.value = n - r - e < De, d) {
140
+ g = e;
141
+ return;
142
+ }
143
+ e < g && s?.(), e > g && (u.value && (l.value = !1), c?.()), g = e;
144
+ }, re = () => {
145
+ if (d || l.value || !t.value) return;
146
+ let e = t.value, n = e.scrollHeight - e.clientHeight;
147
+ n <= e.scrollTop || (u.value = !0, d = !0, e.scrollTop = n, requestAnimationFrame(() => {
148
+ d = !1;
149
+ }));
150
+ }, ie = () => {
151
+ !f && t.value && (f = new MutationObserver(re), f.observe(t.value, {
152
+ childList: !0,
153
+ subtree: !0,
154
+ characterData: !0
155
+ }));
156
+ }, ae = () => {
157
+ f?.disconnect(), f = null;
158
+ };
159
+ B(n, (e, t) => {
160
+ if (e === "streaming" || e === "submitted") {
161
+ ie();
162
+ return;
163
+ }
164
+ (e !== "ready" || t !== "streaming") && ae();
165
+ }), B(r, async () => {
166
+ if (r() && i() !== "assistant") {
167
+ x(), l.value = !1, d = !0;
168
+ try {
169
+ await M(), await o?.(), await M();
170
+ } finally {
171
+ ee();
172
+ }
173
+ }
174
+ });
175
+ let b = null, oe = () => {
176
+ t.value && (t.value.scrollHeight <= t.value.clientHeight || (t.value.scrollTop = t.value.scrollHeight, b && clearTimeout(b), b = setTimeout(x, 300)));
177
+ }, x = () => {
178
+ p?.disconnect(), p = null, m?.disconnect(), m = null, b &&= (clearTimeout(b), null);
179
+ };
180
+ return fe(() => {
181
+ if (!t.value) return;
182
+ t.value.addEventListener("wheel", _, { passive: !0 }), t.value.addEventListener("touchstart", y, { passive: !0 }), t.value.addEventListener("touchmove", te, { passive: !0 });
183
+ let e = n() === "submitted" || n() === "streaming";
184
+ e ? ie() : (p = new ResizeObserver(oe), p.observe(t.value), m = new MutationObserver(oe), m.observe(t.value, {
185
+ childList: !0,
186
+ subtree: !0
187
+ }));
188
+ let r = a?.() ?? t.value.firstElementChild;
189
+ r && (h = new ResizeObserver(re), h.observe(r)), e || oe();
190
+ }), F(() => {
191
+ t.value?.removeEventListener("wheel", _), t.value?.removeEventListener("touchstart", y), t.value?.removeEventListener("touchmove", te), h?.disconnect(), h = null, ae(), x();
192
+ }), {
193
+ handleScroll: ne,
194
+ scrollToBottom: ee,
195
+ userScrolledUp: l,
196
+ isAtBottom: u
197
+ };
198
+ }
199
+ //#endregion
200
+ //#region ../../packages/components/src/chat/PkChatbotMessages.vue?vue&type=script&setup=true&lang.ts
201
+ var Ae = ["aria-busy"], je = {
202
+ key: 0,
203
+ class: "pk-chatbot-messages__outline"
204
+ }, Me = {
205
+ key: 0,
206
+ class: "pk-chatbot-divider"
207
+ }, Ne = { class: "pk-chatbot-divider__label" }, Pe = { class: "pk-chatbot-message__text" }, Fe = ["title"], Ie = {
208
+ key: 0,
209
+ class: "pk-chatbot-message__reaction-emoji"
210
+ }, Le = {
211
+ key: 0,
212
+ class: "pk-chatbot-message__loading-info"
213
+ }, Re = { class: "flex gap-8 items-center" }, ze = { class: "font-mono rounded text-12" }, Be = { class: "flex gap-8 items-center" }, Ve = {
214
+ key: 0,
215
+ class: "pk-chatbot-message__footer"
216
+ }, He = {
217
+ key: 0,
218
+ class: "pk-chatbot-message__hover-meta"
219
+ }, Ue = ["datetime", "title"], We = { class: "truncate" }, Ge = {
220
+ key: 0,
221
+ class: "flex items-center gap-4 min-w-0"
222
+ }, Ke = { class: "truncate" }, qe = {
223
+ key: 1,
224
+ class: "flex items-center gap-4 text-12 text-word-3"
225
+ }, Je = { class: "truncate" }, Ye = ["datetime"], Xe = { class: "truncate" }, Ze = {
226
+ key: 3,
227
+ class: "flex items-center gap-4 text-12 text-word-3"
228
+ }, Qe = { class: "pk-chatbot-message__loading-info" }, $e = { class: "flex gap-8 items-center" }, et = { class: "text-12" }, tt = ["title", "aria-label"], nt = /* @__PURE__ */ j({
229
+ __name: "PkChatbotMessages",
230
+ props: {
231
+ status: {},
232
+ messages: {},
233
+ error: {},
234
+ actions: {},
235
+ mainColor: {},
236
+ textColor: {},
237
+ revisedAnswers: {},
238
+ messageFeedbacks: {},
239
+ readonlyFeedback: { type: Boolean },
240
+ disableHeightAdjustment: { type: Boolean },
241
+ showMessageDateTime: { type: Boolean },
242
+ showMessageTokensCount: { type: Boolean },
243
+ showAllMessageParts: { type: Boolean },
244
+ interactive: { type: Boolean },
245
+ showExtendedSteps: { type: Boolean },
246
+ awaitingSpokenAnswer: { type: Boolean },
247
+ confirmVerdictsOnCall: {},
248
+ isDark: { type: Boolean },
249
+ showScrollToBottom: { type: Boolean },
250
+ feedbackMessageId: {},
251
+ feedbackLoading: { type: Boolean },
252
+ feedbackSubmitted: { type: Boolean },
253
+ feedbackError: {}
254
+ },
255
+ emits: [
256
+ "show-info",
257
+ "regenerate",
258
+ "revise",
259
+ "upvote",
260
+ "downvote",
261
+ "feedback",
262
+ "feedback-submit",
263
+ "feedback-close",
264
+ "scroll-up",
265
+ "scroll-down",
266
+ "auto-retry",
267
+ "reset-chat",
268
+ "approval-respond",
269
+ "confirm-respond"
270
+ ],
271
+ setup(e, { emit: v }) {
272
+ let A = e, j = v, { t: F, d: U, n: ye } = ve({ useScope: "global" }), xe = ge(), Se = (e, t) => {
273
+ if (f(e)) {
274
+ let n = e.toolCallId;
275
+ n && j("confirm-respond", {
276
+ toolCallId: n,
277
+ confirmed: t
278
+ });
279
+ return;
280
+ }
281
+ let n = h(e);
282
+ n && j("approval-respond", {
283
+ id: n,
284
+ approved: t
285
+ });
286
+ }, W = _e("scrollEl"), G = _e("wrapperEl"), we = w(() => u(A.textColor, A.mainColor)), { handleScroll: Te, scrollToBottom: De, userScrolledUp: Oe, isAtBottom: nt } = ke({
287
+ scrollEl: W,
288
+ status: () => A.status,
289
+ messagesLength: () => A.messages?.length,
290
+ lastMessageRole: () => A.messages?.[A.messages.length - 1]?.role,
291
+ contentEl: () => G.value,
292
+ beforeNewMessageScroll: () => ut(),
293
+ onScrollUp: () => j("scroll-up"),
294
+ onScrollDown: () => j("scroll-down")
295
+ }), rt = () => {
296
+ Oe.value = !1, De();
297
+ }, K = w(() => (A.messages ?? []).filter((e) => e.role === "user").map((e) => ({
298
+ id: e.id,
299
+ preview: e.parts.find(o)?.text.trim().slice(0, 120) || "…"
300
+ }))), it = L(), at = () => W.value?.querySelectorAll(".pk-chatbot-message--user") ?? [], ot = () => {
301
+ let e = W.value;
302
+ if (!e || !A.showScrollToBottom) return;
303
+ let t = e.getBoundingClientRect().top + e.clientHeight / 2, n = K.value[0]?.id;
304
+ at().forEach((e, r) => {
305
+ e.getBoundingClientRect().top <= t && (n = K.value[r]?.id);
306
+ }), it.value = n;
307
+ };
308
+ B(K, async () => {
309
+ await M(), ot();
310
+ });
311
+ let st = () => {
312
+ Te(), ot();
313
+ }, ct = (e) => {
314
+ let t = W.value, n = K.value.findIndex((t) => t.id === e), r = at()[n];
315
+ t && r && (Oe.value = !0, t.scrollTo({
316
+ top: t.scrollTop + r.getBoundingClientRect().top - t.getBoundingClientRect().top - Number.parseFloat(getComputedStyle(t).paddingTop),
317
+ behavior: "smooth"
318
+ }));
319
+ }, q = L(0), lt = L(!1), ut = async () => {
320
+ let e = A.messages;
321
+ if (!e?.length || A.disableHeightAdjustment || e[e.length - 1].role !== "user" && A.status !== "submitted" && A.status !== "streaming" || (lt.value = !1, await M(), !W.value)) return;
322
+ let { paddingTop: t, paddingBottom: n } = getComputedStyle(W.value), r = W.value.clientHeight - Number.parseFloat(t) - Number.parseFloat(n), i = G.value && Number.parseFloat(getComputedStyle(G.value).rowGap) || 0, a = at(), o = r - (a[a.length - 1]?.clientHeight ?? 0) - i;
323
+ r > 0 && (q.value = Math.max(o, 0)), await M();
324
+ };
325
+ B(() => [A.messages?.length, A.messages?.[A.messages.length - 1]?.id], () => ut()), fe(() => {
326
+ (A.status === "submitted" || A.status === "streaming" || A.awaitingSpokenAnswer) && ut();
327
+ }), B(() => A.status, (e) => {
328
+ (e === "ready" || e === "error") && (lt.value = !0, q.value = 0);
329
+ });
330
+ let J = (e) => A.revisedAnswers?.some((t) => t.messageId === e), Y = (e) => A.messageFeedbacks?.find((t) => t.messageId === e), dt = (e, t) => !A.readonlyFeedback && kt(e, t), ft = (e) => A.readonlyFeedback ? Y(e) : void 0, pt = (e) => ft(e)?.vote, mt = (e) => {
331
+ let t = ft(e);
332
+ if (t?.vote) return;
333
+ let n = t?.metadata?.reactionEmoji;
334
+ return typeof n == "string" && /\p{Extended_Pictographic}/u.test(n) ? n : void 0;
335
+ }, ht = (e) => !!(pt(e) || mt(e)), gt = (e) => {
336
+ if (mt(e)) return "pk-chatbot-message__reaction--neutral";
337
+ let t = pt(e);
338
+ return t === "upvote" ? "pk-chatbot-message__reaction--positive" : t === "downvote" ? "pk-chatbot-message__reaction--negative" : "pk-chatbot-message__reaction--neutral";
339
+ }, _t = (e) => {
340
+ let t = pt(e);
341
+ return F(t === "upvote" ? "hint.userFeedbackPositive" : t === "downvote" ? "hint.userFeedbackNegative" : "hint.userFeedbackReaction");
342
+ }, vt = (e) => {
343
+ let t = xt(e);
344
+ for (let e = t.length - 1; e >= 0; --e) if (o(t[e])) return e;
345
+ return -1;
346
+ }, yt = w(() => A.messages?.[A.messages.length - 1]), X = w(() => {
347
+ let e = yt.value;
348
+ return e ? e.parts[e.parts.length - 1] : null;
349
+ }), bt = w(() => {
350
+ let e = /* @__PURE__ */ new Map();
351
+ for (let t of A.messages ?? []) t.role === "assistant" && e.set(t.id, g(te(t.parts)));
352
+ return e;
353
+ }), xt = (e) => bt.value.get(e.id) ?? e.parts, Z = w(() => A.status === "submitted" || A.status === "streaming"), St = w(() => A.status === "error"), Ct = w(() => A.awaitingSpokenAnswer === !0 && !Z.value), wt = w(() => Ct.value && yt.value?.role === "user" && !St.value), Tt = w(() => {
354
+ let e = X.value;
355
+ return _(F, e);
356
+ }), Et = w(() => {
357
+ let e = X.value;
358
+ return y(e);
359
+ }), Dt = (e) => A.messages?.findIndex((t) => t.id === e), Q = (e) => e === void 0 || !A.messages ? !1 : e === A.messages.length - 1, Ot = (e) => Q(e) && A.status === "ready" && !!A.actions?.includes("regenerate"), kt = (e, t) => (!Q(t) || A.status === "ready") && !!A.actions?.includes(e), At = (e) => {
360
+ let t = e.parts[e.parts.length - 1];
361
+ return o(t);
362
+ }, jt = (e) => e.parts.some((e) => i(e) || r(e)), Mt = (e) => !!A.showExtendedSteps && $(e) && jt(e), $ = (e) => e.role === "assistant", Nt = (e) => e.role === "user", Pt = (e) => A.messages?.slice(0, e).reverse().find((e) => $(e)), Ft = (e) => A.messages?.slice(e + 1).find((e) => $(e)), It = (e) => {
363
+ let t = Pt(e)?.metadata?.createdAt, n = Ft(e)?.metadata?.createdAt;
364
+ if (!t || !n) return;
365
+ let r = new Date(t), i = new Date(n);
366
+ return r.toDateString() === i.toDateString() ? void 0 : i;
367
+ }, Lt = (e, t) => t === 0 || e.role !== "assistant" ? !1 : !!(A.actions?.length || A.showMessageDateTime && e.metadata?.createdAt !== void 0 || e.metadata?.completedAt !== void 0 || A.showMessageTokensCount && e.metadata?.totalTokens !== void 0), Rt = (e) => {
368
+ let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
369
+ return U(t, n ? "time" : "date-time");
370
+ }, zt = (e) => {
371
+ let { createdAt: t, completedAt: n } = e.metadata ?? {};
372
+ if (t && n) return p(ye, n - t);
373
+ }, Bt = _e("feedbackMessageEl");
374
+ return B(() => A.feedbackMessageId, async () => {
375
+ if (await M(), !A.feedbackMessageId) return;
376
+ let e = Bt.value?.[0]?.$el;
377
+ if (e) {
378
+ if (Q(Dt(A.feedbackMessageId))) {
379
+ De();
380
+ return;
381
+ }
382
+ e.scrollIntoView({
383
+ behavior: "smooth",
384
+ block: "center"
385
+ });
386
+ }
387
+ }), (i, u) => {
388
+ let p = le, h = se, g = ce;
389
+ return I(), D("div", {
390
+ ref_key: "scrollEl",
391
+ ref: W,
392
+ class: N(["pk-chatbot-messages", { "pk-chatbot-messages--settling": lt.value }]),
393
+ role: "log",
394
+ "aria-live": "polite",
395
+ "aria-relevant": "additions text",
396
+ "aria-busy": Z.value,
397
+ style: P({
398
+ "--chatbot-main-color": e.mainColor,
399
+ "--chatbot-contrast-color": we.value
400
+ }),
401
+ onScroll: st
402
+ }, [
403
+ e.showScrollToBottom && K.value.length > 1 ? (I(), D("div", je, [k(x, {
404
+ items: K.value,
405
+ "active-id": it.value,
406
+ onSelect: ct
407
+ }, null, 8, ["items", "active-id"])])) : E("", !0),
408
+ O("div", {
409
+ ref_key: "wrapperEl",
410
+ ref: G,
411
+ class: "pk-chatbot-messages__wrapper"
412
+ }, [
413
+ (I(!0), D(S, null, pe(e.messages, (c, _) => (I(), D(S, { key: c.id }, [Nt(c) && It(_) ? (I(), D("div", Me, [O("span", Ne, R(z(U)(It(_), "short")), 1)])) : E("", !0), c.parts.length || Q(_) && Z.value && $(c) ? (I(), D("div", {
414
+ key: 1,
415
+ class: N(["pk-chatbot-message", [`pk-chatbot-message--${c.role}`, { "pk-chatbot-message--loading": Z.value && Q(_) && $(c) }]]),
416
+ style: P({ minHeight: Q(_) && $(c) && !St.value ? `${q.value}px` : void 0 })
417
+ }, [
418
+ k(C, {
419
+ appear: "",
420
+ name: "pk-chatbot-part"
421
+ }, {
422
+ default: V(() => [Mt(c) ? (I(), T(oe, {
423
+ key: 0,
424
+ message: c,
425
+ "is-streaming": Z.value && Q(_),
426
+ "is-dark": e.isDark
427
+ }, null, 8, [
428
+ "message",
429
+ "is-streaming",
430
+ "is-dark"
431
+ ])) : E("", !0)]),
432
+ _: 2
433
+ }, 1024),
434
+ (I(!0), D(S, null, pe(xt(c), (l, u) => (I(), D(S, { key: u }, [z(o)(l) && l.text.trim() ? (I(), T(C, {
435
+ key: 0,
436
+ appear: "",
437
+ name: "pk-chatbot-part"
438
+ }, {
439
+ default: V(() => [O("div", Pe, [me(i.$slots, "text", de({ ref_for: !0 }, {
440
+ message: c,
441
+ part: l,
442
+ index: _,
443
+ isLoading: Z.value
444
+ }), () => [$(c) ? (I(), T(t, {
445
+ key: 0,
446
+ class: "wysiwyg",
447
+ markdown: l.text,
448
+ "is-dark": e.isDark,
449
+ loading: Q(_) && e.status === "streaming"
450
+ }, null, 8, [
451
+ "markdown",
452
+ "is-dark",
453
+ "loading"
454
+ ])) : (I(), D(S, { key: 1 }, [ue(R(l.text), 1)], 64))]), ht(c.id) && !Y(c.id)?.comment && u === vt(c) ? (I(), D("span", {
455
+ key: 0,
456
+ class: N(["pk-chatbot-message__reaction", gt(c.id)]),
457
+ title: _t(c.id)
458
+ }, [mt(c.id) ? (I(), D("span", Ie, R(mt(c.id)), 1)) : (I(), T(p, {
459
+ key: 1,
460
+ name: pt(c.id) === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-up-fill"
461
+ }, null, 8, ["name"]))], 10, Fe)) : E("", !0)])]),
462
+ _: 2
463
+ }, 1024)) : z(n)(l) ? (I(), T(C, {
464
+ key: 1,
465
+ appear: "",
466
+ name: "pk-chatbot-part"
467
+ }, {
468
+ default: V(() => [k(re, {
469
+ "media-type": l.mediaType,
470
+ url: l.url,
471
+ filename: l.filename,
472
+ size: z(s)(l)?.bytesCount
473
+ }, null, 8, [
474
+ "media-type",
475
+ "url",
476
+ "filename",
477
+ "size"
478
+ ])]),
479
+ _: 2
480
+ }, 1024)) : z(d)(l) && !z(ne)(l) ? (I(), T(C, {
481
+ key: 2,
482
+ appear: "",
483
+ name: "pk-chatbot-part"
484
+ }, {
485
+ default: V(() => [(I(), T(Ee, {
486
+ key: `approval-${u}`,
487
+ part: l,
488
+ actionable: e.interactive === !0 && (z(f)(l) || Q(_)),
489
+ "call-verdict": e.confirmVerdictsOnCall?.get(l.toolCallId ?? ""),
490
+ onRespond: (e) => Se(l, e)
491
+ }, null, 8, [
492
+ "part",
493
+ "actionable",
494
+ "call-verdict",
495
+ "onRespond"
496
+ ]))]),
497
+ _: 2
498
+ }, 1024)) : z(r)(l) && !z(ne)(l) && (z(Ce)[z(a)(l)] || z(xe)[l.type] || e.showAllMessageParts) ? (I(), T(C, {
499
+ key: 3,
500
+ appear: "",
501
+ name: "pk-chatbot-part"
502
+ }, {
503
+ default: V(() => [!z(xe)[l.type] && z(Ce)[z(a)(l)] ? (I(), T(he(z(Ce)[z(a)(l)]), {
504
+ key: `component-${u}-${z(m)(l)}`,
505
+ part: l
506
+ }, null, 8, ["part"])) : me(i.$slots, l.type, de({ ref_for: !0 }, {
507
+ message: c,
508
+ part: l,
509
+ index: _,
510
+ isLoading: Z.value
511
+ }), () => [e.showAllMessageParts ? (I(), D("div", Le, [O("div", Re, [z(y)(l) ? (I(), T(p, {
512
+ key: 0,
513
+ name: z(y)(l),
514
+ class: "shrink-0"
515
+ }, null, 8, ["name"])) : E("", !0), O("code", ze, R(z(be)(l.type)), 1)])])) : E("", !0)], void 0, 1)]),
516
+ _: 2
517
+ }, 1024)) : E("", !0), k(C, { mode: "out-in" }, {
518
+ default: V(() => [u === vt(c) && e.readonlyFeedback && Y(c.id)?.comment ? (I(), T(ae, {
519
+ key: 0,
520
+ feedback: Y(c.id)
521
+ }, null, 8, ["feedback"])) : E("", !0)]),
522
+ _: 2
523
+ }, 1024)], 64))), 128)),
524
+ k(C, {
525
+ name: "fade-in",
526
+ mode: "out-in"
527
+ }, {
528
+ default: V(() => [Z.value && Q(_) && !At(c) && $(c) && !Mt(c) ? (I(), D("div", {
529
+ key: `loading-info-${c.id}`,
530
+ class: "pk-chatbot-message__loading-info"
531
+ }, [O("div", Be, [
532
+ k(p, {
533
+ name: "loading-loop",
534
+ class: "shrink-0"
535
+ }),
536
+ k(C, { mode: "out-in" }, {
537
+ default: V(() => [Et.value ? (I(), T(p, {
538
+ key: Et.value,
539
+ class: "shrink-0",
540
+ name: Et.value
541
+ }, null, 8, ["name"])) : E("", !0)]),
542
+ _: 1
543
+ }),
544
+ k(C, { mode: "out-in" }, {
545
+ default: V(() => [Tt.value ? (I(), D("span", {
546
+ key: Tt.value,
547
+ class: "text-12"
548
+ }, R(Tt.value), 1)) : E("", !0)]),
549
+ _: 1
550
+ })
551
+ ]), k(C, {
552
+ name: "fade-in",
553
+ mode: "out-in"
554
+ }, {
555
+ default: V(() => [X.value && "text" in X.value && X.value.text.trim() ? (I(), T(b, {
556
+ key: 0,
557
+ markdown: X.value.text,
558
+ "is-dark": e.isDark,
559
+ "tail-length": z(ee),
560
+ "inner-class": "wysiwyg",
561
+ class: "border border-surface-3 rounded-md p-4 mt-8 bg-surface-1 max-h-64 text-12 w-full"
562
+ }, null, 8, [
563
+ "markdown",
564
+ "is-dark",
565
+ "tail-length"
566
+ ])) : E("", !0)]),
567
+ _: 1
568
+ })])) : E("", !0)]),
569
+ _: 2
570
+ }, 1024),
571
+ k(C, { mode: "out-in" }, {
572
+ default: V(() => [Lt(c, _) ? (I(), D("div", Ve, [
573
+ k(g, {
574
+ modifiers: "compact",
575
+ class: "mr-auto shrink-0"
576
+ }, {
577
+ default: V(() => [
578
+ k(C, { mode: "out-in" }, {
579
+ default: V(() => [Ot(_) ? (I(), T(h, {
580
+ key: 0,
581
+ icon: "ri:reset-right-line",
582
+ modifiers: "action-quiet-small",
583
+ title: z(F)("action.regenerate"),
584
+ "aria-label": z(F)("action.regenerate"),
585
+ onClick: u[0] ||= H((e) => i.$emit("regenerate"), ["stop"])
586
+ }, null, 8, ["title", "aria-label"])) : E("", !0)]),
587
+ _: 2
588
+ }, 1024),
589
+ k(C, { mode: "out-in" }, {
590
+ default: V(() => [kt("show-info", _) ? (I(), T(h, {
591
+ key: 0,
592
+ icon: "ri:information-line",
593
+ title: z(F)("action.getMoreInfo"),
594
+ "aria-label": z(F)("action.getMoreInfo"),
595
+ modifiers: "action-quiet-small",
596
+ onClick: H((e) => i.$emit("show-info", c), ["stop"])
597
+ }, null, 8, [
598
+ "title",
599
+ "aria-label",
600
+ "onClick"
601
+ ])) : E("", !0)]),
602
+ _: 2
603
+ }, 1024),
604
+ k(C, { mode: "out-in" }, {
605
+ default: V(() => [kt("revise", _) ? (I(), T(h, {
606
+ key: 0,
607
+ icon: J(c.id) ? "ri:file-edit-fill" : "ri:file-edit-line",
608
+ title: J(c.id) ? z(F)("action.editRevise") : z(F)("action.createRevise"),
609
+ "aria-label": J(c.id) ? z(F)("action.editRevise") : z(F)("action.createRevise"),
610
+ modifiers: "action-quiet-small",
611
+ class: N({ "text-brand": J(c.id) }),
612
+ onClick: H((e) => i.$emit("revise", c), ["stop"])
613
+ }, null, 8, [
614
+ "icon",
615
+ "title",
616
+ "aria-label",
617
+ "class",
618
+ "onClick"
619
+ ])) : E("", !0)]),
620
+ _: 2
621
+ }, 1024),
622
+ k(C, { mode: "out-in" }, {
623
+ default: V(() => [dt("upvote", _) ? (I(), T(h, {
624
+ key: 0,
625
+ icon: Y(c.id)?.vote === "upvote" ? "ri:thumb-up-fill" : "ri:thumb-up-line",
626
+ title: z(F)("action.upvote"),
627
+ "aria-label": z(F)("action.upvote"),
628
+ modifiers: "action-quiet-small",
629
+ onClick: H((e) => i.$emit("upvote", c), ["stop"])
630
+ }, null, 8, [
631
+ "icon",
632
+ "title",
633
+ "aria-label",
634
+ "onClick"
635
+ ])) : E("", !0)]),
636
+ _: 2
637
+ }, 1024),
638
+ k(C, { mode: "out-in" }, {
639
+ default: V(() => [dt("downvote", _) ? (I(), T(h, {
640
+ key: 0,
641
+ icon: Y(c.id)?.vote === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-down-line",
642
+ title: z(F)("action.downvote"),
643
+ "aria-label": z(F)("action.downvote"),
644
+ modifiers: "action-quiet-small",
645
+ onClick: H((e) => i.$emit("downvote", c), ["stop"])
646
+ }, null, 8, [
647
+ "icon",
648
+ "title",
649
+ "aria-label",
650
+ "onClick"
651
+ ])) : E("", !0)]),
652
+ _: 2
653
+ }, 1024),
654
+ k(C, { mode: "out-in" }, {
655
+ default: V(() => [dt("feedback", _) ? (I(), T(h, {
656
+ key: 0,
657
+ icon: Y(c.id)?.comment ? "ri:feedback-fill" : "ri:feedback-line",
658
+ title: z(F)("action.feedback"),
659
+ "aria-label": z(F)("action.feedback"),
660
+ modifiers: "action-quiet-small",
661
+ onClick: H((e) => i.$emit("feedback", c), ["stop"])
662
+ }, null, 8, [
663
+ "icon",
664
+ "title",
665
+ "aria-label",
666
+ "onClick"
667
+ ])) : E("", !0)]),
668
+ _: 2
669
+ }, 1024)
670
+ ]),
671
+ _: 2
672
+ }, 1024),
673
+ !e.showMessageDateTime && c.metadata?.createdAt && c.metadata?.completedAt ? (I(), D("div", He, [O("time", {
674
+ datetime: new Date(c.metadata.createdAt).toISOString(),
675
+ title: z(U)(new Date(c.metadata.createdAt), "date-time"),
676
+ class: "flex items-center gap-4 min-w-0"
677
+ }, [k(p, {
678
+ name: "ri:time-line",
679
+ class: "shrink-0"
680
+ }), O("span", We, R(Rt(c.metadata.createdAt)), 1)], 8, Ue), zt(c) ? (I(), D("span", Ge, [k(p, {
681
+ name: "ri:hourglass-line",
682
+ class: "shrink-0"
683
+ }), O("span", Ke, R(zt(c)), 1)])) : E("", !0)])) : E("", !0),
684
+ e.showMessageTokensCount && c.metadata?.totalTokens ? (I(), D("span", qe, [k(p, {
685
+ name: "ri:ai-generate-2-line",
686
+ class: "shrink-0"
687
+ }), O("span", Je, R(z(ye)(c.metadata.totalTokens, "integer")) + " " + R(z(F)("label.tokens")), 1)])) : E("", !0),
688
+ e.showMessageDateTime && c.metadata?.createdAt ? (I(), D("time", {
689
+ key: 2,
690
+ datetime: new Date(c.metadata?.createdAt).toISOString(),
691
+ class: "flex items-center gap-4 text-12 text-word-3"
692
+ }, [k(p, {
693
+ name: "ri:time-line",
694
+ class: "shrink-0"
695
+ }), O("span", Xe, R(z(U)(new Date(c.metadata?.createdAt), "date-time")), 1)], 8, Ye)) : E("", !0),
696
+ e.showMessageDateTime && c?.metadata?.completedAt && c?.metadata?.createdAt ? (I(), D("div", Ze, [k(p, {
697
+ name: "ri:hourglass-line",
698
+ class: "shrink-0"
699
+ }), k(l, {
700
+ class: "truncate",
701
+ date: c.metadata?.createdAt,
702
+ "end-date": c.metadata?.completedAt
703
+ }, null, 8, ["date", "end-date"])])) : E("", !0)
704
+ ])) : E("", !0)]),
705
+ _: 2
706
+ }, 1024),
707
+ k(C, { mode: "out-in" }, {
708
+ default: V(() => [c.id === e.feedbackMessageId ? (I(), T(ie, {
709
+ key: 0,
710
+ ref_for: !0,
711
+ ref_key: "feedbackMessageEl",
712
+ ref: Bt,
713
+ loading: e.feedbackLoading,
714
+ submitted: e.feedbackSubmitted,
715
+ error: e.feedbackError,
716
+ onSubmit: u[1] ||= (e) => i.$emit("feedback-submit", e),
717
+ onClose: u[2] ||= (e) => i.$emit("feedback-close")
718
+ }, null, 8, [
719
+ "loading",
720
+ "submitted",
721
+ "error"
722
+ ])) : E("", !0)]),
723
+ _: 2
724
+ }, 1024)
725
+ ], 6)) : E("", !0)], 64))), 128)),
726
+ k(C, {
727
+ appear: "",
728
+ name: "pk-chatbot-part"
729
+ }, {
730
+ default: V(() => [Ct.value ? (I(), D("div", {
731
+ key: 0,
732
+ class: "pk-chatbot-message pk-chatbot-message--assistant pk-chatbot-message--loading",
733
+ style: P({ minHeight: wt.value ? `${q.value}px` : void 0 })
734
+ }, [O("div", Qe, [O("div", $e, [k(p, {
735
+ name: "loading-loop",
736
+ class: "shrink-0"
737
+ }), O("span", et, R(z(F)("label.answeringOnTheCall")), 1)])])], 4)) : E("", !0)]),
738
+ _: 1
739
+ }),
740
+ k(C, {
741
+ appear: "",
742
+ name: "pk-chatbot-part"
743
+ }, {
744
+ default: V(() => [St.value ? (I(), T(c, {
745
+ key: 0,
746
+ error: e.error,
747
+ onRetry: u[3] ||= (e) => i.$emit("auto-retry"),
748
+ onReset: u[4] ||= (e) => i.$emit("reset-chat")
749
+ }, null, 8, ["error"])) : E("", !0)]),
750
+ _: 1
751
+ }),
752
+ yt.value?.role === "user" && !wt.value || St.value ? (I(), D("div", {
753
+ key: 0,
754
+ class: "pk-chatbot-messages__spacer",
755
+ style: P({ minHeight: `${q.value}px` })
756
+ }, null, 4)) : E("", !0)
757
+ ], 512),
758
+ k(C, { name: "pk-chatbot-messages-fab" }, {
759
+ default: V(() => [e.showScrollToBottom && (z(Oe) || !z(nt)) ? (I(), D("button", {
760
+ key: 0,
761
+ type: "button",
762
+ class: "pk-chatbot-messages__scroll-to-bottom",
763
+ title: z(F)("action.scrollToBottom"),
764
+ "aria-label": z(F)("action.scrollToBottom"),
765
+ onClick: rt
766
+ }, [k(p, { name: "ri:arrow-down-line" })], 8, tt)) : E("", !0)]),
767
+ _: 1
768
+ })
769
+ ], 46, Ae);
770
+ };
771
+ }
772
+ });
773
+ //#endregion
774
+ export { xe as a, be as i, Se as n, ye as r, nt as t };
775
+
776
+ //# sourceMappingURL=PkChatbotMessages-PjKRDNYJ.js.map