@8wave/ai-elements 0.123.0-beta.16 → 0.123.0-beta.18

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 (95) hide show
  1. package/dist/_chunks/PkFilePreview-DXmgMwwu.js +1143 -0
  2. package/dist/_chunks/PkFilePreview-DXmgMwwu.js.map +1 -0
  3. package/dist/_chunks/{PkFilePreviewDialog-nibxELSF.js → PkFilePreviewDialog-Bzt534GA.js} +2 -2
  4. package/dist/_chunks/{PkFilePreviewDialog-nibxELSF.js.map → PkFilePreviewDialog-Bzt534GA.js.map} +1 -1
  5. package/dist/_chunks/{PkStreamingMarkdown-C6cFkf82.js → PkStreamingMarkdown-PQ3X83Fq.js} +2 -2
  6. package/dist/_chunks/{PkStreamingMarkdown-C6cFkf82.js.map → PkStreamingMarkdown-PQ3X83Fq.js.map} +1 -1
  7. package/dist/_chunks/{PkToolChatFile-5t_1vL81.js → PkToolChatFile-CYxqugvO.js} +2 -2
  8. package/dist/_chunks/{PkToolChatFile-5t_1vL81.js.map → PkToolChatFile-CYxqugvO.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShowArtifact-DV78g_yD.js → PkToolShowArtifact-BIpD-GkV.js} +2 -2
  10. package/dist/_chunks/{PkToolShowArtifact-DV78g_yD.js.map → PkToolShowArtifact-BIpD-GkV.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowContactForm-Bnjy0g50.js → PkToolShowContactForm-2_YDqjeM.js} +2 -2
  12. package/dist/_chunks/{PkToolShowContactForm-Bnjy0g50.js.map → PkToolShowContactForm-2_YDqjeM.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowForm-CT5_ln9b.js → PkToolShowForm-Bu4igmQL.js} +5 -5
  14. package/dist/_chunks/{PkToolShowForm-CT5_ln9b.js.map → PkToolShowForm-Bu4igmQL.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowSources-DhZ5I_J-.js → PkToolShowSources-DKtdU_Bq.js} +2 -2
  16. package/dist/_chunks/{PkToolShowSources-DhZ5I_J-.js.map → PkToolShowSources-DKtdU_Bq.js.map} +1 -1
  17. package/dist/_chunks/{utils-B5VcWm3g.js → utils-Bz1Gb3iO.js} +114 -77
  18. package/dist/_chunks/utils-Bz1Gb3iO.js.map +1 -0
  19. package/dist/ai-elements.es.js +252 -252
  20. package/dist/ai-elements.es.js.map +1 -1
  21. package/dist-vue/PkChatbot.js +1 -1
  22. package/dist-vue/PkChatbotEmptyState.js +1 -1
  23. package/dist-vue/PkChatbotInput.js +1 -1
  24. package/dist-vue/PkChatbotMessages.js +1 -1
  25. package/dist-vue/PkChatbotStepPayload.js +1 -1
  26. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  27. package/dist-vue/PkChatbotSteps.js +1 -1
  28. package/dist-vue/PkChatbotViewChat.js +1 -1
  29. package/dist-vue/PkChatbotViewConversations.js +1 -1
  30. package/dist-vue/_chunks/{PkChatbot-tq-fJUij.js → PkChatbot-MEYD0XUR.js} +5 -5
  31. package/dist-vue/_chunks/{PkChatbot-tq-fJUij.js.map → PkChatbot-MEYD0XUR.js.map} +1 -1
  32. package/dist-vue/_chunks/{PkChatbotEmptyState-Dp0_UPJm.js → PkChatbotEmptyState-qKpfIuvI.js} +2 -2
  33. package/dist-vue/_chunks/{PkChatbotEmptyState-Dp0_UPJm.js.map → PkChatbotEmptyState-qKpfIuvI.js.map} +1 -1
  34. package/dist-vue/_chunks/{PkChatbotInput-B_kPnNNB.js → PkChatbotInput-DSH5IrO6.js} +2 -2
  35. package/dist-vue/_chunks/{PkChatbotInput-B_kPnNNB.js.map → PkChatbotInput-DSH5IrO6.js.map} +1 -1
  36. package/dist-vue/_chunks/{PkChatbotMessages-BTZOic9V.js → PkChatbotMessages-BcHNPZUB.js} +327 -327
  37. package/dist-vue/_chunks/{PkChatbotMessages-BTZOic9V.js.map → PkChatbotMessages-BcHNPZUB.js.map} +1 -1
  38. package/dist-vue/_chunks/{PkChatbotStepPayload-CoGCHBhJ.js → PkChatbotStepPayload-BT-Xg18D.js} +2 -2
  39. package/dist-vue/_chunks/{PkChatbotStepPayload-CoGCHBhJ.js.map → PkChatbotStepPayload-BT-Xg18D.js.map} +1 -1
  40. package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJtIZBF0.js → PkChatbotStepToolDetail-Cs322RDk.js} +16 -16
  41. package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJtIZBF0.js.map → PkChatbotStepToolDetail-Cs322RDk.js.map} +1 -1
  42. package/dist-vue/_chunks/{PkChatbotSteps-CEJNclG4.js → PkChatbotSteps-Dd62GEXJ.js} +23 -23
  43. package/dist-vue/_chunks/{PkChatbotSteps-CEJNclG4.js.map → PkChatbotSteps-Dd62GEXJ.js.map} +1 -1
  44. package/dist-vue/_chunks/{PkChatbotViewChat-CnEOSH32.js → PkChatbotViewChat-CfpGWukX.js} +9 -9
  45. package/dist-vue/_chunks/{PkChatbotViewChat-CnEOSH32.js.map → PkChatbotViewChat-CfpGWukX.js.map} +1 -1
  46. package/dist-vue/_chunks/{PkChatbotViewConversations-D7j5P1RO.js → PkChatbotViewConversations-JCrQIoGf.js} +2 -2
  47. package/dist-vue/_chunks/{PkChatbotViewConversations-D7j5P1RO.js.map → PkChatbotViewConversations-JCrQIoGf.js.map} +1 -1
  48. package/dist-vue/_chunks/PkFilePreview-CFqcO3vY.js +1126 -0
  49. package/dist-vue/_chunks/PkFilePreview-CFqcO3vY.js.map +1 -0
  50. package/dist-vue/_chunks/{PkFilePreviewDialog-Cic7gmVR.js → PkFilePreviewDialog-DeNnbXWq.js} +2 -2
  51. package/dist-vue/_chunks/{PkFilePreviewDialog-Cic7gmVR.js.map → PkFilePreviewDialog-DeNnbXWq.js.map} +1 -1
  52. package/dist-vue/_chunks/{PkStreamingMarkdown-CYlCIfA0.js → PkStreamingMarkdown-QDsT-4jC.js} +2 -2
  53. package/dist-vue/_chunks/{PkStreamingMarkdown-CYlCIfA0.js.map → PkStreamingMarkdown-QDsT-4jC.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkToolChatFile-B_PeJef8.js → PkToolChatFile-UZeUytvT.js} +2 -2
  55. package/dist-vue/_chunks/{PkToolChatFile-B_PeJef8.js.map → PkToolChatFile-UZeUytvT.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkToolShowArtifact-Bh-jIo0V.js → PkToolShowArtifact-ldnH-U3h.js} +2 -2
  57. package/dist-vue/_chunks/{PkToolShowArtifact-Bh-jIo0V.js.map → PkToolShowArtifact-ldnH-U3h.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkToolShowContactForm-BjfRuNuj.js → PkToolShowContactForm-4hISKYqb.js} +2 -2
  59. package/dist-vue/_chunks/{PkToolShowContactForm-BjfRuNuj.js.map → PkToolShowContactForm-4hISKYqb.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkToolShowDiagram-_NnrFDGT.js → PkToolShowDiagram-uHFCQ0FJ.js} +2 -2
  61. package/dist-vue/_chunks/{PkToolShowDiagram-_NnrFDGT.js.map → PkToolShowDiagram-uHFCQ0FJ.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkToolShowForm-AqEY4_do.js → PkToolShowForm-DiUz5_Ct.js} +5 -5
  63. package/dist-vue/_chunks/{PkToolShowForm-AqEY4_do.js.map → PkToolShowForm-DiUz5_Ct.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkToolShowImageGallery-DM5AJNZ3.js → PkToolShowImageGallery-CEzeXupr.js} +2 -2
  65. package/dist-vue/_chunks/{PkToolShowImageGallery-DM5AJNZ3.js.map → PkToolShowImageGallery-CEzeXupr.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkToolShowProductList-CAV8be9a.js → PkToolShowProductList-h4Dqvk1V.js} +2 -2
  67. package/dist-vue/_chunks/{PkToolShowProductList-CAV8be9a.js.map → PkToolShowProductList-h4Dqvk1V.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkToolShowSources-CriswKr_.js → PkToolShowSources-BJd4zYAY.js} +2 -2
  69. package/dist-vue/_chunks/{PkToolShowSources-CriswKr_.js.map → PkToolShowSources-BJd4zYAY.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkToolShowVideo-FSWM5MOl.js → PkToolShowVideo-DgkpZriW.js} +2 -2
  71. package/dist-vue/_chunks/{PkToolShowVideo-FSWM5MOl.js.map → PkToolShowVideo-DgkpZriW.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolShowWebPages-CPhm2ba3.js → PkToolShowWebPages-DQr3SEGC.js} +2 -2
  73. package/dist-vue/_chunks/{PkToolShowWebPages-CPhm2ba3.js.map → PkToolShowWebPages-DQr3SEGC.js.map} +1 -1
  74. package/dist-vue/_chunks/{utils-BgvjC1Pu.js → utils-DmBnucJs.js} +129 -92
  75. package/dist-vue/_chunks/utils-DmBnucJs.js.map +1 -0
  76. package/dist-vue/composables.js +1 -1
  77. package/dist-vue/composables.js.map +1 -1
  78. package/dist-vue/index.js +32 -32
  79. package/dist-vue/index.js.map +1 -1
  80. package/dist-vue/packages/components/src/chat/PkWordPreview.d.ts +3 -1
  81. package/dist-vue/packages/components/src/chat/PkWordPreviewBlock.d.ts +9 -3
  82. package/dist-vue/packages/components/src/chat/PkWordPreviewPart.d.ts +20 -0
  83. package/dist-vue/packages/components/src/chat/PkWordPreviewRuns.d.ts +12 -3
  84. package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +420 -0
  85. package/dist-vue/packages/components/src/chat/utils.d.ts +49 -1
  86. package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +339 -0
  87. package/dist-vue/packages/models/src/schema/WordPreview.d.ts +571 -0
  88. package/dist-vue/style.css +1 -1
  89. package/package.json +1 -1
  90. package/dist/_chunks/PkFilePreview-Bcdfci6i.js +0 -948
  91. package/dist/_chunks/PkFilePreview-Bcdfci6i.js.map +0 -1
  92. package/dist/_chunks/utils-B5VcWm3g.js.map +0 -1
  93. package/dist-vue/_chunks/PkFilePreview-BKwnNsyV.js +0 -934
  94. package/dist-vue/_chunks/PkFilePreview-BKwnNsyV.js.map +0 -1
  95. package/dist-vue/_chunks/utils-BgvjC1Pu.js.map +0 -1
@@ -1,10 +1,11 @@
1
1
  import { D as e, S as t, et as n, j as r, n as i, z as a } from "./Agent-D3US-D1x.js";
2
2
  import "./src-nb8MU1sh.js";
3
3
  import { c as o, i as s, l as c, u as l } from "./message-DuibQyHy.js";
4
+ import "vue";
4
5
  // ../../packages/utils/src/text.ts
5
- var u = (e) => e.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), d = (e) => e ? e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[-_]+/g, " ") : "", f = (e) => e ? u(e).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^a-zA-Z0-9]+/g, "-").toLowerCase() : "", p = (e) => e ? u(e).replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").toLowerCase() : "", m = (e) => e ? e.charAt(0).toUpperCase() + e.slice(1) : "";
6
+ var u = (e) => e.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), d = (e) => e ? e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[-_]+/g, " ") : "", f = (e) => e ? u(e).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^a-zA-Z0-9]+/g, "-").toLowerCase() : "", ee = (e) => e ? u(e).replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").toLowerCase() : "", p = (e) => e ? e.charAt(0).toUpperCase() + e.slice(1) : "";
6
7
  // ../../packages/components/src/chat/utils.ts
7
- function h(e) {
8
+ function m(e) {
8
9
  let t = [];
9
10
  for (let n of e) {
10
11
  if (!c(n)) {
@@ -19,31 +20,31 @@ function h(e) {
19
20
  }
20
21
  return t;
21
22
  }
22
- var g = (e) => l(e) && a(s(e));
23
- function _(e) {
23
+ var h = (e) => l(e) && a(s(e));
24
+ function te(e) {
24
25
  let t = /* @__PURE__ */ new Map();
25
- for (let [n, r] of e.entries()) g(r) && r.state !== "output-error" && !T(r) && t.set(r.type, n);
26
- return e.filter((e, n) => !(g(e) && e.state === "output-error" && (t.get(e.type) ?? -1) > n));
26
+ for (let [n, r] of e.entries()) h(r) && r.state !== "output-error" && !x(r) && t.set(r.type, n);
27
+ return e.filter((e, n) => !(h(e) && e.state === "output-error" && (t.get(e.type) ?? -1) > n));
27
28
  }
28
- var v = /* @__PURE__ */ new Set([
29
+ var g = /* @__PURE__ */ new Set([
29
30
  "tool-editSpreadsheet",
30
31
  "tool-shareDocument",
31
32
  "tool-editWordDocument",
32
33
  "tool-createSpreadsheet",
33
34
  "tool-createWordDocument"
34
35
  ]);
35
- function y(e) {
36
- let t = e.filter((e) => v.has(e.type));
37
- return t.length > 0 ? [...e.filter((e) => !v.has(e.type)), ...t] : e;
36
+ function _(e) {
37
+ let t = e.filter((e) => g.has(e.type));
38
+ return t.length > 0 ? [...e.filter((e) => !g.has(e.type)), ...t] : e;
38
39
  }
39
- function b(e, t) {
40
+ function v(e, t) {
40
41
  let n = e.toolCallId;
41
- return v.has(e.type) && n ? `file-${n}` : t;
42
+ return g.has(e.type) && n ? `file-${n}` : t;
42
43
  }
43
- function x(e) {
44
+ function y(e) {
44
45
  return n(e) ? e : void 0;
45
46
  }
46
- var S = {
47
+ var ne = {
47
48
  page_snapshot: {
48
49
  icon: "ri:pages-line",
49
50
  label: "messagePart.pageTool.snapshot"
@@ -88,21 +89,21 @@ var S = {
88
89
  icon: "ri:links-line",
89
90
  label: "messagePart.pageTool.navigate"
90
91
  }
91
- }, ee = Symbol("hostStepTitles"), te = {
92
+ }, re = Symbol("hostStepTitles"), ie = {
92
93
  icon: "ri:survey-line",
93
94
  label: "messagePart.pageTool.form"
94
- }, C = (e) => e.toolMetadata?.provider === "page" ? S[e.toolName] ?? (e.toolName.startsWith("form_") ? te : void 0) : void 0;
95
- function w(e) {
96
- return x(e)?.toolMetadata?.readOnly === !1;
95
+ }, b = (e) => e.toolMetadata?.provider === "page" ? ne[e.toolName] ?? (e.toolName.startsWith("form_") ? ie : void 0) : void 0;
96
+ function ae(e) {
97
+ return y(e)?.toolMetadata?.readOnly === !1;
97
98
  }
98
- function T(e) {
99
+ function x(e) {
99
100
  return e && "state" in e ? e.state === "streaming" || e.state === "input-streaming" : !1;
100
101
  }
101
- var E = 4e3, D = /^[ \t]*(?:(?:[-*+]|\d{1,9}[.)])[ \t]+|>[ \t]?)*(`{3,}|~{3,})(.*)$/gm;
102
- function O(e, t) {
102
+ var S = 4e3, C = /^[ \t]*(?:(?:[-*+]|\d{1,9}[.)])[ \t]+|>[ \t]?)*(`{3,}|~{3,})(.*)$/gm;
103
+ function w(e, t) {
103
104
  if (e.length <= t) return e;
104
105
  let n = e.length - t, r = n + t / 2, i = (e, t) => e !== -1 && e < r ? e + t : void 0, a = i(e.indexOf("\n\n", n), 2) ?? i(e.indexOf("\n", n), 1) ?? n, o;
105
- for (let t of e.matchAll(D)) {
106
+ for (let t of e.matchAll(C)) {
106
107
  if (t.index >= a) break;
107
108
  let [, e, n] = t;
108
109
  if (o) e[0] === o[0] && e.length >= o.length && !n.trim() && (o = void 0);
@@ -113,40 +114,40 @@ function O(e, t) {
113
114
  }
114
115
  return `…\n\n${o ? `${o}\n` : ""}${e.slice(a)}`;
115
116
  }
116
- var k = /* @__PURE__ */ new Set([
117
+ var T = /* @__PURE__ */ new Set([
117
118
  "approval-requested",
118
119
  "approval-responded",
119
120
  "output-denied"
120
121
  ]);
121
- function A(e) {
122
- return l(e) ? k.has(e.state) ? !0 : e.approval != null : !1;
122
+ function E(e) {
123
+ return l(e) ? T.has(e.state) ? !0 : e.approval != null : !1;
123
124
  }
124
- var j = "requestConfirm";
125
- function M(e) {
125
+ var D = "requestConfirm";
126
+ function O(e) {
126
127
  return l(e) && e.type === "tool-requestConfirm";
127
128
  }
128
- function N(e) {
129
- return A(e) || M(e);
129
+ function k(e) {
130
+ return E(e) || O(e);
130
131
  }
131
- function P(e) {
132
+ function A(e) {
132
133
  if (l(e)) return e.approval?.id;
133
134
  }
134
- function F(e) {
135
+ function j(e) {
135
136
  if (e && "state" in e) return e.state;
136
137
  }
137
- function I(e) {
138
+ function M(e) {
138
139
  return e ? ["streaming"].includes(e) : !1;
139
140
  }
140
- function L(e = "000000") {
141
+ function N(e = "000000") {
141
142
  let t = e.replace("#", "");
142
143
  t.length === 3 && (t = t.split("").map((e) => e + e).join(""));
143
144
  let n = parseInt(t.substring(0, 2), 16) / 255, r = parseInt(t.substring(2, 4), 16) / 255, i = parseInt(t.substring(4, 6), 16) / 255, a = (e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
144
145
  return .2126 * a(n) + .7152 * a(r) + .0722 * a(i) > .179 ? "black" : "white";
145
146
  }
146
- function R(e, t) {
147
- return e === "white" || e === "black" ? e : L(t);
147
+ function P(e, t) {
148
+ return e === "white" || e === "black" ? e : N(t);
148
149
  }
149
- function z(e, t) {
150
+ function F(e, t) {
150
151
  if (e) return {
151
152
  "--chatbot-main-color": e,
152
153
  "--chatbot-contrast-color": t,
@@ -155,10 +156,10 @@ function z(e, t) {
155
156
  "--input-focus-color": "var(--color-brand-graphic)"
156
157
  };
157
158
  }
158
- function B(e, t) {
159
+ function I(e, t) {
159
160
  if (!(t === void 0 || t < 50)) return e(t / 1e3, "seconds");
160
161
  }
161
- function V(e) {
162
+ function L(e) {
162
163
  if (e !== void 0) {
163
164
  if (typeof e == "string") return e.trim() || void 0;
164
165
  try {
@@ -169,10 +170,10 @@ function V(e) {
169
170
  }
170
171
  }
171
172
  }
172
- function H(e) {
173
- return V(e) !== void 0;
173
+ function R(e) {
174
+ return L(e) !== void 0;
174
175
  }
175
- function ne(e, t) {
176
+ function z(e, t) {
176
177
  let n = e?.input;
177
178
  if (typeof t == "string") {
178
179
  let e = n?.question ?? n?.steps?.[0]?.question;
@@ -184,14 +185,14 @@ function ne(e, t) {
184
185
  return i ? `${i} ${n}` : n;
185
186
  }).join(". ");
186
187
  }
187
- function U(e) {
188
+ function B(e) {
188
189
  return e?.options ? e.options.map((e) => ({
189
190
  label: e.label,
190
191
  value: e.label,
191
192
  description: e.description
192
193
  })) : [];
193
194
  }
194
- function W(e, t) {
195
+ function V(e, t) {
195
196
  let n = {};
196
197
  if (t == null) return n;
197
198
  if (typeof t == "string") return e.length === 1 && (n[0] = t), n;
@@ -207,7 +208,7 @@ function W(e, t) {
207
208
  for (let [e, n] of Object.entries(t)) n !== void 0 && r(e, n);
208
209
  return n;
209
210
  }
210
- var G = r.map((e) => `tool-${e}`), K = /* @__PURE__ */ new Set([
211
+ var H = r.map((e) => `tool-${e}`), U = /* @__PURE__ */ new Set([
211
212
  "tool-searchInKnowledgeBase",
212
213
  "tool-retrieveRevisedAnswers",
213
214
  "tool-expandChunkContext",
@@ -216,63 +217,63 @@ var G = r.map((e) => `tool-${e}`), K = /* @__PURE__ */ new Set([
216
217
  "tool-geocode",
217
218
  "tool-recallUserMemory",
218
219
  "tool-saveUserMemory",
219
- ...G
220
+ ...H
220
221
  ]);
221
- function q(e) {
222
- return l(e) && K.has(e.type);
222
+ function W(e) {
223
+ return l(e) && U.has(e.type);
223
224
  }
224
- var J = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Y = (e, ...t) => {
225
+ var G = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, K = (e, ...t) => {
225
226
  for (let n of t) {
226
227
  let t = e?.[n];
227
228
  if (typeof t == "string" && t.trim()) return t;
228
229
  }
229
230
  };
230
- function X(e) {
231
+ function q(e) {
231
232
  if (!l(e)) return;
232
- let t = J("input" in e ? e.input : void 0), n = J("output" in e ? e.output : void 0);
233
- if (e.type === "tool-searchInKnowledgeBase" || G.includes(e.type)) {
233
+ let t = G("input" in e ? e.input : void 0), n = G("output" in e ? e.output : void 0);
234
+ if (e.type === "tool-searchInKnowledgeBase" || H.includes(e.type)) {
234
235
  let e = t?.queries;
235
236
  if (Array.isArray(e)) {
236
237
  let t = e.filter((e) => typeof e == "string" && !!e.trim());
237
238
  return t.length ? t.join(" · ") : void 0;
238
239
  }
239
- return Y(t, "query", "objective");
240
+ return K(t, "query", "objective");
240
241
  }
241
- if (e.type === "tool-retrieveRevisedAnswers") return Y(t, "query");
242
- if (e.type === "tool-getWeather") return Y(n, "location") ?? Y(t, "locationName");
243
- if (e.type === "tool-geocode") return Y(t, "locationName");
244
- if (e.type === "tool-expandChunkContext") return Y(n, "documentName");
245
- if (e.type === "tool-readDocumentFile" || e.type === "tool-readChatAttachment" || e.type === "tool-sendChatFile" || e.type === "tool-shareDocument") return Y(n, "name");
242
+ if (e.type === "tool-retrieveRevisedAnswers") return K(t, "query");
243
+ if (e.type === "tool-getWeather") return K(n, "location") ?? K(t, "locationName");
244
+ if (e.type === "tool-geocode") return K(t, "locationName");
245
+ if (e.type === "tool-expandChunkContext") return K(n, "documentName");
246
+ if (e.type === "tool-readDocumentFile" || e.type === "tool-readChatAttachment" || e.type === "tool-sendChatFile" || e.type === "tool-shareDocument") return K(n, "name");
246
247
  if (e.type === "tool-readSpreadsheet") {
247
- let e = Y(t, "sheet"), n = Y(t, "range");
248
+ let e = K(t, "sheet"), n = K(t, "range");
248
249
  return e && n ? `${e}!${n}` : e;
249
250
  }
250
- if (e.type === "tool-editSpreadsheet") return Y(n, "filename");
251
- if (e.type === "tool-readWordDocument") return Y(t, "search") ?? Y(t, "from");
252
- if (e.type === "tool-editWordDocument") return Y(n, "filename");
253
- if (e.type === "tool-createSpreadsheet" || e.type === "tool-createWordDocument") return Y(n, "filename") ?? Y(t, "filename");
254
- if (e.type === "tool-querySpreadsheet") return Y(n, "file");
255
- if (e.type === "tool-recallUserMemory") return Y(t, "query");
256
- if (e.type === "tool-saveUserMemory") return Y(t, "content", "query");
251
+ if (e.type === "tool-editSpreadsheet") return K(n, "filename");
252
+ if (e.type === "tool-readWordDocument") return K(t, "search") ?? K(t, "from");
253
+ if (e.type === "tool-editWordDocument") return K(n, "filename");
254
+ if (e.type === "tool-createSpreadsheet" || e.type === "tool-createWordDocument") return K(n, "filename") ?? K(t, "filename");
255
+ if (e.type === "tool-querySpreadsheet") return K(n, "file");
256
+ if (e.type === "tool-recallUserMemory") return K(t, "query");
257
+ if (e.type === "tool-saveUserMemory") return K(t, "content", "query");
257
258
  }
258
- function Z(e) {
259
- let t = x(e);
260
- if (t) return C(t)?.icon ?? "ri:apps-line";
261
- if (l(e)) return e.type.includes("tool-subagent") ? "ri:robot-2-line" : e.type === "tool-runWorker" ? "ri:flow-chart" : e.type === "tool-scheduleWakeup" ? "ri:alarm-line" : e.type === "tool-fetchTeamsChannelHistory" ? "ri:chat-history-line" : e.type === "tool-readEarlierMessages" ? "ri:history-line" : e.type === "tool-readChatAttachment" ? "ri:attachment-line" : e.type === "tool-sendChatFile" ? "ri:send-plane-line" : e.type === "tool-enableTools" ? "ri:toggle-line" : e.type.includes("tool-mcp") ? "mcp" : e.type === "tool-retrieveRevisedAnswers" ? "ri:file-edit-line" : e.type === "tool-searchInKnowledgeBase" ? "ri:search-line" : e.type === "tool-expandChunkContext" ? "ri:file-search-line" : e.type === "tool-readDocumentFile" ? "ri:file-text-line" : e.type === "tool-readSpreadsheet" ? "ri:table-line" : e.type === "tool-editSpreadsheet" || e.type === "tool-createSpreadsheet" ? "ri:file-excel-2-line" : e.type === "tool-shareDocument" ? "ri:file-download-line" : e.type === "tool-readWordDocument" ? "ri:file-text-line" : e.type === "tool-editWordDocument" || e.type === "tool-createWordDocument" ? "ri:file-word-2-line" : e.type === "tool-querySpreadsheet" ? "ri:database-2-line" : e.type === "tool-geocode" ? "ri:map-2-line" : e.type === "tool-getWeather" ? "ri:sun-cloudy-line" : e.type === "tool-recallUserMemory" ? "ri:brain-line" : e.type === "tool-saveUserMemory" ? "ri:save-3-line" : e.type === "tool-showWeather" ? "ri:sun-line" : e.type === "tool-showDiagram" ? "ri:flow-chart" : e.type === "tool-showSources" ? "ri:book-2-line" : e.type === "tool-showForm" ? "ri:survey-line" : e.type === "tool-showMultipleChoice" ? "ri:checkbox-multiple-line" : e.type === "tool-showArtifact" ? "ri:file-code-line" : e.type === "tool-showEmail" ? "ri:mail-line" : e.type === "tool-showMessage" ? "ri:chat-1-line" : e.type === "tool-showWebPages" ? "ri:pages-line" : e.type === "tool-showProductList" ? "ri:shopping-bag-line" : e.type === "tool-showContactForm" ? "ri:send-plane-2-line" : e.type === "tool-showCalendarEvent" ? "ri:calendar-event-line" : e.type === "tool-showComparison" ? "ri:scales-line" : e.type === "tool-showLocation" ? "ri:map-pin-line" : e.type === "tool-showQrCode" ? "ri:qr-code-line" : e.type === "tool-showImageGallery" ? "ri:image-line" : e.type === "tool-showVideo" ? "ri:film-line" : e.type === "tool-showSuggestedReply" ? "ri:corner-down-right-line" : e.type === "tool-requestGeolocation" ? "ri:map-pin-user-line" : e.type === "tool-disconnectOAuthConnection" ? "ri:link-unlink" : e.type === "tool-requestAccountLink" ? "ri:link" : e.type === "tool-unlinkAccount" ? "ri:link-unlink" : G.includes(e.type) ? "ri:global-line" : "ri:tools-line";
259
+ function J(e) {
260
+ let t = y(e);
261
+ if (t) return b(t)?.icon ?? "ri:apps-line";
262
+ if (l(e)) return e.type.includes("tool-subagent") ? "ri:robot-2-line" : e.type === "tool-runWorker" ? "ri:flow-chart" : e.type === "tool-scheduleWakeup" ? "ri:alarm-line" : e.type === "tool-fetchTeamsChannelHistory" ? "ri:chat-history-line" : e.type === "tool-readEarlierMessages" ? "ri:history-line" : e.type === "tool-readChatAttachment" ? "ri:attachment-line" : e.type === "tool-sendChatFile" ? "ri:send-plane-line" : e.type === "tool-enableTools" ? "ri:toggle-line" : e.type.includes("tool-mcp") ? "mcp" : e.type === "tool-retrieveRevisedAnswers" ? "ri:file-edit-line" : e.type === "tool-searchInKnowledgeBase" ? "ri:search-line" : e.type === "tool-expandChunkContext" ? "ri:file-search-line" : e.type === "tool-readDocumentFile" ? "ri:file-text-line" : e.type === "tool-readSpreadsheet" ? "ri:table-line" : e.type === "tool-editSpreadsheet" || e.type === "tool-createSpreadsheet" ? "ri:file-excel-2-line" : e.type === "tool-shareDocument" ? "ri:file-download-line" : e.type === "tool-readWordDocument" ? "ri:file-text-line" : e.type === "tool-editWordDocument" || e.type === "tool-createWordDocument" ? "ri:file-word-2-line" : e.type === "tool-querySpreadsheet" ? "ri:database-2-line" : e.type === "tool-geocode" ? "ri:map-2-line" : e.type === "tool-getWeather" ? "ri:sun-cloudy-line" : e.type === "tool-recallUserMemory" ? "ri:brain-line" : e.type === "tool-saveUserMemory" ? "ri:save-3-line" : e.type === "tool-showWeather" ? "ri:sun-line" : e.type === "tool-showDiagram" ? "ri:flow-chart" : e.type === "tool-showSources" ? "ri:book-2-line" : e.type === "tool-showForm" ? "ri:survey-line" : e.type === "tool-showMultipleChoice" ? "ri:checkbox-multiple-line" : e.type === "tool-showArtifact" ? "ri:file-code-line" : e.type === "tool-showEmail" ? "ri:mail-line" : e.type === "tool-showMessage" ? "ri:chat-1-line" : e.type === "tool-showWebPages" ? "ri:pages-line" : e.type === "tool-showProductList" ? "ri:shopping-bag-line" : e.type === "tool-showContactForm" ? "ri:send-plane-2-line" : e.type === "tool-showCalendarEvent" ? "ri:calendar-event-line" : e.type === "tool-showComparison" ? "ri:scales-line" : e.type === "tool-showLocation" ? "ri:map-pin-line" : e.type === "tool-showQrCode" ? "ri:qr-code-line" : e.type === "tool-showImageGallery" ? "ri:image-line" : e.type === "tool-showVideo" ? "ri:film-line" : e.type === "tool-showSuggestedReply" ? "ri:corner-down-right-line" : e.type === "tool-requestGeolocation" ? "ri:map-pin-user-line" : e.type === "tool-disconnectOAuthConnection" ? "ri:link-unlink" : e.type === "tool-requestAccountLink" ? "ri:link" : e.type === "tool-unlinkAccount" ? "ri:link-unlink" : H.includes(e.type) ? "ri:global-line" : "ri:tools-line";
262
263
  if (o(e)) return "ri:lightbulb-line";
263
264
  if (c(e)) return "ri:double-quotes-r";
264
265
  }
265
- var re = [
266
+ var oe = [
266
267
  i,
267
268
  t,
268
269
  e
269
270
  ];
270
- function Q(e, { t, te: n }) {
271
+ function Y(e, { t, te: n }) {
271
272
  if (n(`agent.tool.${e}`)) return t(`agent.tool.${e}`);
272
- let r = re.find((t) => e.startsWith(t));
273
- return m(d(r ? e.slice(r.length) : e).trim().toLowerCase());
273
+ let r = oe.find((t) => e.startsWith(t));
274
+ return p(d(r ? e.slice(r.length) : e).trim().toLowerCase());
274
275
  }
275
- var ie = {
276
+ var se = {
276
277
  custom: (e) => e("messagePart.type.custom"),
277
278
  data: (e) => e("messagePart.type.data"),
278
279
  file: (e) => e("messagePart.type.file"),
@@ -282,13 +283,13 @@ var ie = {
282
283
  "step-start": (e) => e("messagePart.type.stepStart"),
283
284
  text: (e) => e("messagePart.type.text")
284
285
  };
285
- function ae(e, t) {
286
- if (l(e)) return Q(s(e), t);
287
- if (e.type === "dynamic-tool") return Q(e.toolName, t);
288
- let n = ie[e.type.startsWith("data-") ? "data" : e.type];
289
- return n ? n(t.t) : m(d(e.type));
286
+ function ce(e, t) {
287
+ if (l(e)) return Y(s(e), t);
288
+ if (e.type === "dynamic-tool") return Y(e.toolName, t);
289
+ let n = se[e.type.startsWith("data-") ? "data" : e.type];
290
+ return n ? n(t.t) : p(d(e.type));
290
291
  }
291
- var oe = {
292
+ var le = {
292
293
  alibaba: "Alibaba Cloud",
293
294
  anthropic: "Anthropic",
294
295
  azure: "Microsoft Azure",
@@ -310,10 +311,10 @@ var oe = {
310
311
  xai: "xAI",
311
312
  zai: "Z.ai"
312
313
  };
313
- function se(e) {
314
- return oe[e.toLowerCase()] ?? m(d(e));
314
+ function ue(e) {
315
+ return le[e.toLowerCase()] ?? p(d(e));
315
316
  }
316
- function ce(e, t) {
317
+ function de(e, t) {
317
318
  if (!e) return e;
318
319
  let n = {
319
320
  Intent: t("conversationSummary.intent"),
@@ -323,17 +324,17 @@ function ce(e, t) {
323
324
  };
324
325
  return e.replace(/\*\*(Intent|Topics covered|Key facts|Open questions)(:?)\*\*/g, (e, t, r) => `**${n[t]}${r}**`);
325
326
  }
326
- function le(e, t, n) {
327
- let r = x(t);
327
+ function fe(e, t, n) {
328
+ let r = y(t);
328
329
  if (r) {
329
330
  let t = r.toolCallId ? n?.[r.toolCallId] : void 0;
330
331
  if (t) return t;
331
- let i = C(r);
332
+ let i = b(r);
332
333
  return i ? e(i.label) : r.title || r.toolName;
333
334
  }
334
- return l(t) ? t.type.includes("tool-subagent") ? e("messagePart.runSubagent") : t.type === "tool-runWorker" ? e("messagePart.runWorker") : t.type === "tool-scheduleWakeup" ? e("messagePart.scheduleWakeup") : t.type === "tool-fetchTeamsChannelHistory" ? e("messagePart.fetchTeamsChannelHistory") : t.type === "tool-readEarlierMessages" ? e("messagePart.readEarlierMessages") : t.type === "tool-readChatAttachment" ? e("messagePart.readChatAttachment") : t.type === "tool-sendChatFile" ? e("messagePart.sendChatFile") : t.type === "tool-enableTools" ? e("messagePart.enableTools") : t.type === "tool-retrieveRevisedAnswers" ? e("messagePart.revisedAnswers") : t.type === "tool-searchInKnowledgeBase" ? e("messagePart.searchingDocuments") : t.type === "tool-expandChunkContext" ? e("messagePart.expandChunkContext") : t.type === "tool-readDocumentFile" ? e("messagePart.readDocumentFile") : t.type === "tool-readSpreadsheet" ? e("messagePart.readSpreadsheet") : t.type === "tool-editSpreadsheet" ? e("messagePart.editSpreadsheet") : t.type === "tool-shareDocument" ? e("messagePart.shareDocument") : t.type === "tool-readWordDocument" ? e("messagePart.readWordDocument") : t.type === "tool-editWordDocument" ? e("messagePart.editWordDocument") : t.type === "tool-createSpreadsheet" ? e("messagePart.createSpreadsheet") : t.type === "tool-createWordDocument" ? e("messagePart.createWordDocument") : t.type === "tool-querySpreadsheet" ? e("messagePart.querySpreadsheet") : t.type === "tool-geocode" ? e("messagePart.geocode") : t.type === "tool-getWeather" ? e("messagePart.getWeather") : t.type === "tool-recallUserMemory" ? e("messagePart.recallUserMemory") : t.type === "tool-saveUserMemory" ? e("messagePart.saveUserMemory") : t.type === "tool-showWeather" ? e("messagePart.showWeather") : t.type === "tool-showForm" ? e("messagePart.showForm") : t.type === "tool-showDiagram" ? e("messagePart.showDiagram") : t.type === "tool-showSources" ? e("messagePart.showSources") : t.type === "tool-showMultipleChoice" ? e("messagePart.showMultipleChoice") : t.type === "tool-showArtifact" ? e("messagePart.showArtifact") : t.type === "tool-showEmail" ? e("messagePart.showEmail") : t.type === "tool-showMessage" ? e("messagePart.showMessage") : t.type === "tool-showWebPages" ? e("messagePart.showWebPages") : t.type === "tool-showProducts" ? e("messagePart.showProducts") : t.type === "tool-showContactForm" ? e("messagePart.showContactForm") : t.type === "tool-showCalendarEvent" ? e("messagePart.showCalendarEvent") : t.type === "tool-showComparison" ? e("messagePart.showComparison") : t.type === "tool-showLocation" ? e("messagePart.showLocation") : t.type === "tool-showQrCode" ? e("messagePart.showQrCode") : t.type === "tool-showImageGallery" ? e("messagePart.showImageGallery") : t.type === "tool-showVideo" ? e("messagePart.showVideo") : t.type === "tool-showSuggestedReply" ? e("messagePart.showSuggestedReply") : t.type === "tool-requestGeolocation" ? e("messagePart.requestGeolocation") : t.type === "tool-disconnectOAuthConnection" ? e("messagePart.disconnectOAuthConnection") : t.type === "tool-requestAccountLink" ? e("messagePart.requestAccountLink") : t.type === "tool-unlinkAccount" ? e("messagePart.unlinkAccount") : G.includes(t.type) ? e("messagePart.webSearch") : e("messagePart.tool") : o(t) ? e("messagePart.reasoning") : e("messagePart.streaming");
335
+ return l(t) ? t.type.includes("tool-subagent") ? e("messagePart.runSubagent") : t.type === "tool-runWorker" ? e("messagePart.runWorker") : t.type === "tool-scheduleWakeup" ? e("messagePart.scheduleWakeup") : t.type === "tool-fetchTeamsChannelHistory" ? e("messagePart.fetchTeamsChannelHistory") : t.type === "tool-readEarlierMessages" ? e("messagePart.readEarlierMessages") : t.type === "tool-readChatAttachment" ? e("messagePart.readChatAttachment") : t.type === "tool-sendChatFile" ? e("messagePart.sendChatFile") : t.type === "tool-enableTools" ? e("messagePart.enableTools") : t.type === "tool-retrieveRevisedAnswers" ? e("messagePart.revisedAnswers") : t.type === "tool-searchInKnowledgeBase" ? e("messagePart.searchingDocuments") : t.type === "tool-expandChunkContext" ? e("messagePart.expandChunkContext") : t.type === "tool-readDocumentFile" ? e("messagePart.readDocumentFile") : t.type === "tool-readSpreadsheet" ? e("messagePart.readSpreadsheet") : t.type === "tool-editSpreadsheet" ? e("messagePart.editSpreadsheet") : t.type === "tool-shareDocument" ? e("messagePart.shareDocument") : t.type === "tool-readWordDocument" ? e("messagePart.readWordDocument") : t.type === "tool-editWordDocument" ? e("messagePart.editWordDocument") : t.type === "tool-createSpreadsheet" ? e("messagePart.createSpreadsheet") : t.type === "tool-createWordDocument" ? e("messagePart.createWordDocument") : t.type === "tool-querySpreadsheet" ? e("messagePart.querySpreadsheet") : t.type === "tool-geocode" ? e("messagePart.geocode") : t.type === "tool-getWeather" ? e("messagePart.getWeather") : t.type === "tool-recallUserMemory" ? e("messagePart.recallUserMemory") : t.type === "tool-saveUserMemory" ? e("messagePart.saveUserMemory") : t.type === "tool-showWeather" ? e("messagePart.showWeather") : t.type === "tool-showForm" ? e("messagePart.showForm") : t.type === "tool-showDiagram" ? e("messagePart.showDiagram") : t.type === "tool-showSources" ? e("messagePart.showSources") : t.type === "tool-showMultipleChoice" ? e("messagePart.showMultipleChoice") : t.type === "tool-showArtifact" ? e("messagePart.showArtifact") : t.type === "tool-showEmail" ? e("messagePart.showEmail") : t.type === "tool-showMessage" ? e("messagePart.showMessage") : t.type === "tool-showWebPages" ? e("messagePart.showWebPages") : t.type === "tool-showProducts" ? e("messagePart.showProducts") : t.type === "tool-showContactForm" ? e("messagePart.showContactForm") : t.type === "tool-showCalendarEvent" ? e("messagePart.showCalendarEvent") : t.type === "tool-showComparison" ? e("messagePart.showComparison") : t.type === "tool-showLocation" ? e("messagePart.showLocation") : t.type === "tool-showQrCode" ? e("messagePart.showQrCode") : t.type === "tool-showImageGallery" ? e("messagePart.showImageGallery") : t.type === "tool-showVideo" ? e("messagePart.showVideo") : t.type === "tool-showSuggestedReply" ? e("messagePart.showSuggestedReply") : t.type === "tool-requestGeolocation" ? e("messagePart.requestGeolocation") : t.type === "tool-disconnectOAuthConnection" ? e("messagePart.disconnectOAuthConnection") : t.type === "tool-requestAccountLink" ? e("messagePart.requestAccountLink") : t.type === "tool-unlinkAccount" ? e("messagePart.unlinkAccount") : H.includes(t.type) ? e("messagePart.webSearch") : e("messagePart.tool") : o(t) ? e("messagePart.reasoning") : e("messagePart.streaming");
335
336
  }
336
- var $ = {
337
+ var pe = {
337
338
  calibri: "Calibri, Carlito, \"Segoe UI\", Arial, sans-serif",
338
339
  "calibri light": "\"Calibri Light\", Calibri, Carlito, \"Segoe UI\", sans-serif",
339
340
  aptos: "Aptos, Calibri, Carlito, \"Segoe UI\", Arial, sans-serif",
@@ -347,7 +348,7 @@ var $ = {
347
348
  georgia: "Georgia, serif",
348
349
  verdana: "Verdana, \"DejaVu Sans\", sans-serif",
349
350
  tahoma: "Tahoma, Verdana, sans-serif"
350
- }, ue = {
351
+ }, me = {
351
352
  calibri: 1.22,
352
353
  "calibri light": 1.22,
353
354
  cambria: 1.17,
@@ -358,7 +359,43 @@ var $ = {
358
359
  georgia: 1.14,
359
360
  verdana: 1.22,
360
361
  tahoma: 1.21
361
- }, de = (e) => ue[e.toLowerCase()] ?? 1.17, fe = (e) => $[e.toLowerCase()] ?? `"${e.replace(/"/g, "")}", ${/roman|garamond|cambria|georgia|serif|book|times/i.test(e) ? "Georgia, serif" : "Calibri, Carlito, \"Segoe UI\", Arial, sans-serif"}`, pe = (e, t) => t ? e.replace(RegExp(` \\(v${t}\\)(\\.\\w+)$`), "$1") : e;
362
- export { y as A, p as B, N as C, M as D, T as E, fe as F, de as I, m as L, R as M, V as N, ce as O, Q as P, d as R, q as S, I as T, ae as _, z as a, X as b, b as c, U as d, B as f, F as g, Z as h, G as i, se as j, h as k, ne as l, O as m, ee as n, pe as o, x as p, E as r, _ as s, j as t, W as u, P as v, w, H as x, le as y, f as z };
362
+ }, he = (e) => me[e.toLowerCase()] ?? 1.17, ge = (e) => pe[e.toLowerCase()] ?? `"${e.replace(/"/g, "")}", ${/roman|garamond|cambria|georgia|serif|book|times/i.test(e) ? "Georgia, serif" : "Calibri, Carlito, \"Segoe UI\", Arial, sans-serif"}`, X = Symbol("wordPreviewImages"), _e = (e, t) => {
363
+ let n = e?.[t];
364
+ return n?.startsWith("data:image/webp;base64,") ? n : void 0;
365
+ }, ve = (e, t) => {
366
+ let n = e.anchor;
367
+ return {
368
+ left: `${n.xFrom === "page" ? n.x : t.margins.left + n.x}pt`,
369
+ top: `${n.yFrom === "page" ? n.y : t.margins.top + n.y}pt`,
370
+ width: `${e.width}pt`,
371
+ height: `${e.height}pt`,
372
+ zIndex: n.wrap === "behind" ? -1 : 1
373
+ };
374
+ }, Z = (e) => {
375
+ let t = e.anchor;
376
+ return t ? t.wrap === "around" ? "around" : t.wrap === "block" ? "block" : t.yFrom === "paragraph" ? "paragraph" : "page" : "inline";
377
+ }, Q = (e, t) => e.filter((e) => t === "accepted" ? e.change !== "deleted" : t !== "original" || e.change !== "inserted"), $ = (e) => e.some((e) => e.image || e.text.trim()), ye = (e, t) => {
378
+ let n = [], r = !1, i, a = (e, t, a, o, s) => {
379
+ let c = s ?? i;
380
+ n.push({
381
+ key: e,
382
+ block: t,
383
+ ...a === void 0 ? {} : { row: a },
384
+ breakBefore: o || r,
385
+ ...c === void 0 ? {} : { section: c }
386
+ }), r = !1, i = void 0;
387
+ }, o = (e, t) => {
388
+ r ||= e && t !== void 0, i = t ?? i;
389
+ };
390
+ return e.forEach((e, n) => {
391
+ if (e.kind === "table") {
392
+ let r = !!e.pageBreakBefore, i = e.section;
393
+ e.rows.forEach((e, o) => {
394
+ (!e.some((e) => e.runs.length) || e.some((e) => $(Q(e.runs, t)))) && (a(`${n}:${o}`, n, o, r, i), r = !1, i = void 0);
395
+ }), o(r, i);
396
+ } else !e.runs.length || $(Q(e.runs, t)) ? a(`${n}`, n, void 0, !!e.style?.pageBreakBefore, e.section) : o(!!e.style?.pageBreakBefore, e.section);
397
+ }), n;
398
+ }, be = (e, t) => e.flatMap((e) => e.kind === "table" ? [] : Q(e.runs, t).flatMap((e) => e.picture && Z(e.picture) === "page" ? [e.picture] : [])), xe = (e, t) => t ? e.replace(RegExp(` \\(v${t}\\)(\\.\\w+)$`), "$1") : e;
399
+ export { m as A, ve as B, W as C, x as D, M as E, Y as F, d as G, Z as H, ye as I, f as K, ge as L, ue as M, P as N, O, L as P, Q as R, R as S, ae as T, _e as U, be as V, p as W, j as _, X as a, fe as b, te as c, V as d, B as f, J as g, w as h, H as i, _ as j, de as k, v as l, y as m, re as n, F as o, I as p, ee as q, S as r, xe as s, D as t, z as u, ce as v, k as w, q as x, A as y, he as z };
363
400
 
364
- //# sourceMappingURL=utils-BgvjC1Pu.js.map
401
+ //# sourceMappingURL=utils-DmBnucJs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-DmBnucJs.js","names":["SUBAGENT_TOOL_PREFIX","MCP_TOOL_PREFIX","isHostToolPart","WEB_SEARCH_TOOL_KEYS","API_TOOL_PREFIX","isPresentationTool","isReasoningPart","getToolPartName","isTextPart","isToolPart","removeAccents","str","fromAnyCase","toKebabCase","toSnakeCase","capitalizeFirstLetter","mergeConsecutiveTextParts","merged","part","parts","prev","isWidgetPart","dropCorrectedWidgetErrors","lastDrawn","index","isStreamingPart","FILE_OUTPUT_PARTS","moveFileOutputsLast","files","feedPartKey","toolCallId","getHostCallPart","PAGE_TOOL_STEPS","HOST_STEP_TITLES","FORM_TOOL_STEP","pageToolStep","host","isHostActionPart","LIVE_REASONING_TAIL_LENGTH","FENCE_LINE","getMarkdownTail","markdown","maxLength","from","limit","boundary","length","cut","openFence","match","marker","rest","TOOL_APPROVAL_STATES","isToolApprovalPart","CONFIRM_TOOL_NAME","isToolConfirmPart","isConfirmationCardPart","getToolApprovalId","getPartState","isLoadingState","state","getContrast","hex","hexcolor","char","r","g","b","linearize","c","resolveContrastColor","textColor","mainColor","agentThemeStyle","contrastColor","formatDuration","ms","$n","stringifyPayload","value","json","hasPayload","formAnswerAsSpoken","input","answer","question","questionById","step","said","id","formStepOptions","option","formAnswerSlots","slots","output","steps","assign","list","WEB_SEARCH_TOOL_TYPES","key","RICH_DETAIL_TOOL_TYPES","hasRichToolDetail","asRecord","pickString","keys","record","getToolPartSummary","queries","valid","query","sheet","range","getPartIcon","TOOL_KEY_PREFIXES","toolLabel","te","name","prefix","p","PART_TYPE_LABELS","t","getPartTypeLabel","translator","label","PROVIDER_NAMES","providerLabel","slug","localizeSummaryLabels","summary","labels","colon","getToolPartLabel","live","hostStepTitles","page","$t","WORD_FONT_STACKS","WORD_LINE_FACTORS","wordLineFactor","font","wordFontStack","WORD_PREVIEW_IMAGES","wordPictureSrc","src","images","ref","wordPageAnchorCss","anchor","picture","wordPicturePlacement","wordKeptRuns","runs","mode","hasWordText","wordFlowItems","out","breakPending","sectionPending","push","opens","section","row","breakBefore","skip","blocks","block","breaks","cell","cells","wordPageAnchors","run","chatFileName","version","filename"],"sources":["../../../../packages/utils/src/text.ts","../../../../packages/components/src/chat/utils.ts"],"sourcesContent":["export const removeAccents = (str: string) =>\n str.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')\n\nexport const toCamelCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/[^a-zA-Z0-9]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\n .replace(/^(.)/, (match) => match.toLowerCase()) as unknown as T\n}\n\nexport const fromCamelCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str.replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n}\n\nexport const fromAnyCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/[-_]+/g, ' ')\n}\n\nexport const toPascalCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/[^a-zA-Z0-9]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\n .replace(/^(.)/, (match) => match.toUpperCase()) as unknown as T\n}\n\nexport const toKebabCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/[^a-zA-Z0-9]+/g, '-')\n .toLowerCase() as unknown as T\n}\n\nexport const fromKebabCase = (str?: string): string => {\n if (!str) {\n return ''\n }\n return str.replace(/-/g, ' ')\n}\n\nexport const toSnakeCase = <T extends string>(str?: string): T => {\n if (!str) {\n return '' as unknown as T\n }\n return removeAccents(str)\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/[^a-zA-Z0-9]+/g, '_')\n .toLowerCase() as unknown as T\n}\n\nexport const capitalizeFirstLetter = (str?: string) => {\n if (!str) {\n return ''\n }\n return str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport const lowercaseFirstLetter = (str?: string) => {\n if (!str) {\n return ''\n }\n return str.charAt(0).toLowerCase() + str.slice(1)\n}\n","import type { UIMessage } from 'ai'\nimport type { CSSProperties, InjectionKey, Ref } from 'vue'\nimport {\n API_TOOL_PREFIX,\n MCP_TOOL_PREFIX,\n SUBAGENT_TOOL_PREFIX,\n WEB_SEARCH_TOOL_KEYS,\n isHostToolPart,\n isPresentationTool,\n type WordPreviewBlock,\n type WordPreviewPage,\n type WordPreviewPicture,\n type WordPreviewRun,\n} from 'models'\nimport {\n isTextPart,\n isFilePart,\n isToolPart,\n isReasoningPart,\n hasPartText,\n hasTextPart,\n getTextPart,\n getMessageText,\n getToolPartName,\n capitalizeFirstLetter,\n fromAnyCase,\n} from 'utils'\n\nexport {\n isTextPart,\n isFilePart,\n isToolPart,\n isReasoningPart,\n hasPartText,\n hasTextPart,\n getTextPart,\n getMessageText,\n}\n\n/**\n * Merges consecutive text parts into a single text part.\n * Claude (and other models) often produce multiple text parts during streaming\n * that should logically be a single block of text.\n */\nexport function mergeConsecutiveTextParts(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const merged: UIMessage['parts'] = []\n for (const part of parts) {\n if (!isTextPart(part)) {\n merged.push(part)\n continue\n }\n const prev = merged[merged.length - 1]\n if (prev && isTextPart(prev)) {\n merged[merged.length - 1] = { ...prev, text: prev.text + part.text }\n } else {\n merged.push(part)\n }\n }\n return merged\n}\n\nconst isWidgetPart = (\n part: UIMessage['parts'][number],\n): part is Extract<UIMessage['parts'][number], { type: `tool-${string}` }> =>\n isToolPart(part) && isPresentationTool(getToolPartName(part))\n\n/**\n * Drops a widget call refused for its arguments when a later call of the same\n * widget in the message was drawn: the turn corrected it (the backend's\n * `correctableInputRefusals`), and the refusal would sit next to the working\n * widget, `showForm` drawing its render error above the form. A refusal with\n * nothing drawn after it stays. Only the feed reads this: the steps timeline\n * keeps every call, the refused one included.\n */\nexport function dropCorrectedWidgetErrors(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const lastDrawn = new Map<string, number>()\n for (const [index, part] of parts.entries()) {\n if (\n isWidgetPart(part) &&\n part.state !== 'output-error' &&\n !isStreamingPart(part)\n ) {\n lastDrawn.set(part.type, index)\n }\n }\n return parts.filter(\n (part, index) =>\n !(\n isWidgetPart(part) &&\n part.state === 'output-error' &&\n (lastDrawn.get(part.type) ?? -1) > index\n ),\n )\n}\n\n/**\n * Tool calls whose output is a file for the user to download. The feed draws\n * them after the answer, where the reader arrives, wherever in the message the\n * model made the call: a version written before a long answer sat above it,\n * out of sight.\n */\nconst FILE_OUTPUT_PARTS: ReadonlySet<string> = new Set([\n 'tool-editSpreadsheet',\n 'tool-shareDocument',\n 'tool-editWordDocument',\n 'tool-createSpreadsheet',\n 'tool-createWordDocument',\n])\n\n/** The parts with the file outputs moved last, in their own order. */\nexport function moveFileOutputsLast(\n parts: UIMessage['parts'],\n): UIMessage['parts'] {\n const files = parts.filter((part) => FILE_OUTPUT_PARTS.has(part.type))\n return files.length > 0\n ? [\n ...parts.filter((part) => !FILE_OUTPUT_PARTS.has(part.type)),\n ...files,\n ]\n : parts\n}\n\n/**\n * The key of a part in the feed. Its position, except for a file output: that\n * one is always last, so its position moves as the answer grows, and keyed by\n * it the card would be redrawn at every new part.\n */\nexport function feedPartKey(\n part: UIMessage['parts'][number],\n index: number,\n): string | number {\n const toolCallId = (part as { toolCallId?: string }).toolCallId\n return FILE_OUTPUT_PARTS.has(part.type) && toolCallId\n ? `file-${toolCallId}`\n : index\n}\n\n/** A call the embedding page runs, as the backend stamped it (spec `host-tools.md`). */\ninterface HostCallPart {\n toolCallId?: string\n toolName: string\n title?: string\n state?: string\n errorText?: string\n toolMetadata?: { readOnly?: boolean; provider?: 'app' | 'page' }\n}\n\nexport function getHostCallPart(\n part: UIMessage['parts'][number] | null | undefined,\n): HostCallPart | undefined {\n return isHostToolPart(part) ? (part as unknown as HostCallPart) : undefined\n}\n\n/**\n * The page tools of the widget (spec `page-tools.md`): defined by the backend,\n * so their step is ours to name, in the user's language. A tool the app\n * registered is named by its own `title`.\n */\nconst PAGE_TOOL_STEPS: Record<string, { icon: string; label: string }> = {\n page_snapshot: {\n icon: 'ri:pages-line',\n label: 'messagePart.pageTool.snapshot',\n },\n page_read: {\n icon: 'ri:file-text-line',\n label: 'messagePart.pageTool.read',\n },\n page_click: { icon: 'ri:cursor-line', label: 'messagePart.pageTool.click' },\n page_fill: { icon: 'ri:edit-line', label: 'messagePart.pageTool.fill' },\n page_scroll: {\n icon: 'ri:arrow-up-down-line',\n label: 'messagePart.pageTool.scroll',\n },\n page_find: { icon: 'ri:search-line', label: 'messagePart.pageTool.find' },\n page_wait: { icon: 'ri:time-line', label: 'messagePart.pageTool.wait' },\n page_hover: {\n icon: 'ri:cursor-line',\n label: 'messagePart.pageTool.hover',\n },\n page_press: {\n icon: 'ri:keyboard-line',\n label: 'messagePart.pageTool.press',\n },\n page_back: {\n icon: 'ri:arrow-go-back-line',\n label: 'messagePart.pageTool.back',\n },\n page_navigate: {\n icon: 'ri:links-line',\n label: 'messagePart.pageTool.navigate',\n },\n}\n\n/**\n * The titles the widget gave this page's steps, by call, naming what each\n * acts on (spec `page-tools-improvements.md`, M8): provided by the chat view\n * from its store, read by the views that list the steps.\n */\nexport const HOST_STEP_TITLES: InjectionKey<Ref<Record<string, string>>> =\n Symbol('hostStepTitles')\n\n/** A form the site annotated for agents: its tool is named `form_<toolname>`. */\nconst FORM_TOOL_STEP = {\n icon: 'ri:survey-line',\n label: 'messagePart.pageTool.form',\n}\n\nconst pageToolStep = (host: HostCallPart) =>\n host.toolMetadata?.provider === 'page'\n ? (PAGE_TOOL_STEPS[host.toolName] ??\n (host.toolName.startsWith('form_') ? FORM_TOOL_STEP : undefined))\n : undefined\n\n/**\n * A host call that changes something in the app or on the page: the feed\n * shows it even without the steps timeline, because what it did stays done.\n */\nexport function isHostActionPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return getHostCallPart(part)?.toolMetadata?.readOnly === false\n}\n\nexport function isStreamingPart(\n part: UIMessage['parts'][number] | null | undefined,\n): part is Extract<UIMessage['parts'][number], { streaming?: boolean }> {\n if (!part) {\n return false\n }\n if ('state' in part) {\n return part.state === 'streaming' || part.state === 'input-streaming'\n }\n return false\n}\n\n/**\n * How much of a reasoning still being written its live box renders. The box is\n * a few lines tall and follows the bottom, while the reasoning of one turn runs\n * to tens of kilobytes: chat `st0Eg8iG0zUX0HQN` wrote 92KB, and parsing all of\n * it at every delta froze the tab. Four thousand characters leave a few screens\n * to scroll back through, and a finished step renders all of it.\n */\nexport const LIVE_REASONING_TAIL_LENGTH = 4000\n\n// A fence opener or closer, also inside a list item or a quote, whose markers\n// and indentation are skipped. The rest of the line tells them apart: a\n// closing fence carries no info string.\nconst FENCE_LINE =\n /^[ \\t]*(?:(?:[-*+]|\\d{1,9}[.)])[ \\t]+|>[ \\t]?)*(`{3,}|~{3,})(.*)$/gm\n\n/**\n * The end of a markdown text, at most `maxLength` characters long, cut on a\n * blank line (a line break when there is none) so it does not open on half a\n * paragraph. A table or a formula can still be cut in two. An ellipsis marks\n * the cut. A cut inside a fenced code block reopens the fence, or the rest of\n * the text would render as code and the code as prose.\n */\nexport function getMarkdownTail(markdown: string, maxLength: number): string {\n if (markdown.length <= maxLength) {\n return markdown\n }\n const from = markdown.length - maxLength\n // The boundary is looked for in the first half of the window only: the one\n // blank line of the window can be the last thing written, and cutting there\n // would leave nothing to render.\n const limit = from + maxLength / 2\n const boundary = (index: number, length: number) =>\n index !== -1 && index < limit ? index + length : undefined\n const cut =\n boundary(markdown.indexOf('\\n\\n', from), 2) ??\n boundary(markdown.indexOf('\\n', from), 1) ??\n from\n let openFence: string | undefined\n for (const match of markdown.matchAll(FENCE_LINE)) {\n if (match.index >= cut) {\n break\n }\n const [, marker, rest] = match\n if (!openFence) {\n // A backtick in a backtick fence's info string makes it inline\n // code, not a fence.\n if (marker[0] === '`' && rest.includes('`')) {\n continue\n }\n openFence = marker\n } else if (\n marker[0] === openFence[0] &&\n marker.length >= openFence.length &&\n !rest.trim()\n ) {\n openFence = undefined\n }\n }\n const reopen = openFence ? `${openFence}\\n` : ''\n return `…\\n\\n${reopen}${markdown.slice(cut)}`\n}\n\n/**\n * States a tool part goes through when it needs the user's approval. They are\n * rendered by `PkToolApprovalCard` whatever the tool is, so the decision (and\n * its outcome) stays visible in the transcript.\n */\nconst TOOL_APPROVAL_STATES = new Set([\n 'approval-requested',\n 'approval-responded',\n 'output-denied',\n])\n\nexport function isToolApprovalPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n if (!isToolPart(part)) {\n return false\n }\n if (TOOL_APPROVAL_STATES.has(part.state)) {\n return true\n }\n // An executed (or errored) call that went through the gate keeps its\n // verdict in `approval`: the card stays in the transcript, so the user's\n // decision remains visible in the chat and in the log viewers (parity\n // with requestConfirm, whose 'confirmed' output is persisted).\n return (part as { approval?: unknown }).approval != null\n}\n\n/**\n * The client-side tool the model uses to have an action it described approved.\n * It predates the SDK's approval gate and keeps its own round-trip (it resolves\n * through `addToolOutput`), but it asks the user the very same question, so it\n * shares `PkToolApprovalCard` instead of having a card of its own.\n */\nexport const CONFIRM_TOOL_NAME = 'requestConfirm'\n\nexport function isToolConfirmPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return isToolPart(part) && part.type === `tool-${CONFIRM_TOOL_NAME}`\n}\n\n/** True for any part the confirmation card is responsible for. */\nexport function isConfirmationCardPart(\n part: UIMessage['parts'][number] | null | undefined,\n): boolean {\n return isToolApprovalPart(part) || isToolConfirmPart(part)\n}\n\n/** The id of the pending approval request on a tool part, if any. */\nexport function getToolApprovalId(\n part: UIMessage['parts'][number] | null | undefined,\n): string | undefined {\n if (!isToolPart(part)) {\n return undefined\n }\n return (part as { approval?: { id?: string } }).approval?.id\n}\n\nexport function getPartState(\n part: UIMessage['parts'][number] | null | undefined,\n): string | undefined {\n if (!part) {\n return undefined\n }\n if ('state' in part) {\n return part.state\n }\n return undefined\n}\n\nexport function isLoadingState(state?: string): boolean {\n if (!state) {\n return false\n }\n return ['streaming'].includes(state)\n}\n\nexport function getContrast(hexcolor: string = '000000'): 'black' | 'white' {\n let hex = hexcolor.replace('#', '')\n\n // Expand 3-character hex to 6-character (e.g., #ccc -> #cccccc)\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('')\n }\n\n // WCAG relative luminance\n const r = parseInt(hex.substring(0, 2), 16) / 255\n const g = parseInt(hex.substring(2, 4), 16) / 255\n const b = parseInt(hex.substring(4, 6), 16) / 255\n\n const linearize = (c: number) =>\n c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4\n\n const luminance =\n 0.2126 * linearize(r) + 0.7152 * linearize(g) + 0.0722 * linearize(b)\n\n return luminance > 0.179 ? 'black' : 'white'\n}\n\n/**\n * True for a hex color with almost no hue: black, white and the grays between.\n * Anything else, a color the function cannot read included, counts as colored.\n */\nexport function isAchromaticColor(hexcolor: string | undefined): boolean {\n let hex = hexcolor?.trim().replace('#', '') ?? ''\n if (/^[0-9a-f]{3}$/i.test(hex)) {\n hex = hex\n .split('')\n .map((char) => char + char)\n .join('')\n }\n if (!/^[0-9a-f]{6}$/i.test(hex)) {\n return false\n }\n const channels = [0, 2, 4].map((at) =>\n parseInt(hex.substring(at, at + 2), 16),\n )\n return Math.max(...channels) - Math.min(...channels) < 32\n}\n\n/**\n * Resolves the contrast color based on the user's `textColor` preference.\n * Falls back to WCAG auto-detection via `getContrast` when set to `'auto'` or `undefined`.\n */\nexport function resolveContrastColor(\n textColor: 'auto' | 'white' | 'black' | undefined,\n mainColor: string | undefined,\n): 'black' | 'white' {\n if (textColor === 'white' || textColor === 'black') {\n return textColor\n }\n return getContrast(mainColor)\n}\n\n/**\n * The style of a chat root (PkChatbot, the widget's shell): the agent's color\n * as the brand. Volver derives every role of the brand (graphic, readable,\n * contrast, tinted surface) on any element with `.theme`, which both roots\n * carry, so the focus ring, the primary buttons, the links and the checkboxes\n * take the agent's color with the contrast each theme needs, instead of the\n * platform's purple. The fields' focus takes the brand's graphic role in both\n * themes, since the dark theme's accent is the platform's too.\n */\nexport function agentThemeStyle(\n mainColor: string | undefined,\n contrastColor: 'black' | 'white',\n): Record<string, string> | undefined {\n if (!mainColor) {\n return undefined\n }\n return {\n '--chatbot-main-color': mainColor,\n '--chatbot-contrast-color': contrastColor,\n '--color-brand': mainColor,\n '--color-brand-contrast': contrastColor,\n '--input-focus-color': 'var(--color-brand-graphic)',\n }\n}\n\n/**\n * Formats a duration in milliseconds using the i18n `seconds` number format\n * (e.g. \"12,4 secondi\" / \"12.4 seconds\"). Returns undefined for durations\n * that would render as \"0 seconds\" (less than 0.05s).\n */\nexport function formatDuration(\n $n: (value: number, format: string) => string,\n ms?: number,\n): string | undefined {\n if (ms === undefined || ms < 50) {\n return undefined\n }\n return $n(ms / 1000, 'seconds')\n}\n\n/**\n * Stringifies a tool payload for the raw fallback view. Returns undefined for\n * empty values so the caller can skip rendering the block entirely.\n */\nexport function stringifyPayload(value: unknown): string | undefined {\n if (value === undefined) {\n return undefined\n }\n if (typeof value === 'string') {\n return value.trim() || undefined\n }\n try {\n const json = JSON.stringify(value, null, 2)\n return json === '{}' || json === '[]' ? undefined : json\n } catch {\n return undefined\n }\n}\n\n/**\n * True when a tool payload carries something worth rendering, so a caller can\n * skip the block without stringifying the value twice.\n */\nexport function hasPayload(value: unknown): boolean {\n return stringifyPayload(value) !== undefined\n}\n\n/**\n * Turns the answers of a form into the sentence the caller would have said.\n *\n * On a call the tool loop is over by the time the form is on screen, so the\n * answers go back to the agent as a user message (see `sendUserMessage` in\n * `useVoiceSession`). Each answer is paired with its question, because that is\n * how a person would say it and because the agent hears it with no widget\n * attached.\n */\nexport function formAnswerAsSpoken(\n part: unknown,\n answer: string | { answers: { id: string; value: unknown }[] },\n): string {\n const input = (\n part as {\n input?: {\n steps?: { id: string; question?: string }[]\n question?: string\n }\n }\n )?.input\n\n if (typeof answer === 'string') {\n const question = input?.question ?? input?.steps?.[0]?.question\n return question ? `${question} ${answer}` : answer\n }\n\n const questionById = new Map(\n (input?.steps ?? []).map((step) => [step.id, step.question]),\n )\n const lines = answer.answers\n .filter(\n ({ value }) =>\n value !== null &&\n value !== '' &&\n !(Array.isArray(value) && !value.length),\n )\n .map(({ id, value }) => {\n const said = Array.isArray(value) ? value.join(', ') : String(value)\n const question = questionById.get(id)\n return question ? `${question} ${said}` : said\n })\n\n return lines.join('. ')\n}\n\n/**\n * The choices of a form step, as the radio and checkbox editors take them.\n *\n * The `value` is the LABEL and not the position, because it is what travels\n * back to the model as the answer: it reads the words it wrote, not an index.\n * Nothing here caps the list, and nothing should: the number of options an\n * agent configures is advice to the model, so a step can legitimately carry\n * more (see `showForm.tool.ts`).\n */\nexport function formStepOptions(\n step: { options?: { label: string; description?: string }[] } | undefined,\n): { label: string; value: string; description?: string }[] {\n if (!step?.options) {\n return []\n }\n return step.options.map((option) => ({\n label: option.label,\n value: option.label,\n description: option.description,\n }))\n}\n\n/**\n * Spreads the answers a form comes back with onto one slot PER STEP.\n *\n * A form's answers travel paired with step ids, and the tool schema does not\n * enforce that those ids are unique: a `.refine()` there would refuse the whole\n * form over a duplicate, which is the failure the schema was just cured of (see\n * the gotchas entry \"A configurable cap does not belong in an inputSchema\").\n * So the duplicate has to be survivable here. Keyed by id, two steps sharing\n * one collapsed onto a single answer: the second question showed the first\n * one's reply, and submitting sent that reply twice. Keyed by position, each\n * step keeps its own.\n *\n * A duplicated id restores the same incoming value to every step claiming it,\n * which is as much as the payload allows: the ids are all it says.\n */\nexport function formAnswerSlots(\n steps: { id: string }[],\n output: unknown,\n): Record<number, unknown> {\n const slots: Record<number, unknown> = {}\n if (output === undefined || output === null) {\n return slots\n }\n // A legacy single-choice answer is the plain string, and it can only\n // belong to a single-step form.\n if (typeof output === 'string') {\n if (steps.length === 1) {\n slots[0] = output\n }\n return slots\n }\n const assign = (id: string, value: unknown) => {\n steps.forEach((step, index) => {\n if (step.id === id) {\n slots[index] = value\n }\n })\n }\n const list = (output as { answers?: unknown }).answers\n if (Array.isArray(list)) {\n for (const answer of list as { id?: unknown; value?: unknown }[]) {\n if (typeof answer?.id === 'string') {\n assign(answer.id, answer.value)\n }\n }\n return slots\n }\n // Forms answered on a platform channel (the Teams modal) come back as a\n // flat record keyed by step id.\n for (const [id, value] of Object.entries(\n output as Record<string, unknown>,\n )) {\n if (value !== undefined) {\n assign(id, value)\n }\n }\n return slots\n}\n\n// Web search tool part types, gateway and provider-native\nexport const WEB_SEARCH_TOOL_TYPES: string[] = WEB_SEARCH_TOOL_KEYS.map(\n (key) => `tool-${key}`,\n)\n\n// Tool part types with a dedicated rich rendering in PkChatbotStepToolDetail\nconst RICH_DETAIL_TOOL_TYPES = new Set([\n 'tool-searchInKnowledgeBase',\n 'tool-retrieveRevisedAnswers',\n 'tool-expandChunkContext',\n 'tool-readDocumentFile',\n 'tool-getWeather',\n 'tool-geocode',\n 'tool-recallUserMemory',\n 'tool-saveUserMemory',\n ...WEB_SEARCH_TOOL_TYPES,\n])\n\nexport function hasRichToolDetail(\n part?: UIMessage['parts'][number] | null,\n): boolean {\n return isToolPart(part) && RICH_DETAIL_TOOL_TYPES.has(part.type)\n}\n\nconst asRecord = (value: unknown): Record<string, unknown> | undefined =>\n value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined\n\nconst pickString = (\n record: Record<string, unknown> | undefined,\n ...keys: string[]\n): string | undefined => {\n for (const key of keys) {\n const value = record?.[key]\n if (typeof value === 'string' && value.trim()) {\n return value\n }\n }\n return undefined\n}\n\n/**\n * Returns a short inline summary for a tool part (search queries, location,\n * document name, ...) to be shown next to the step label without expanding\n * the step body.\n */\nexport function getToolPartSummary(\n part?: UIMessage['parts'][number] | null,\n): string | undefined {\n if (!isToolPart(part)) {\n return undefined\n }\n const input = asRecord('input' in part ? part.input : undefined)\n const output = asRecord('output' in part ? part.output : undefined)\n if (\n part.type === 'tool-searchInKnowledgeBase' ||\n WEB_SEARCH_TOOL_TYPES.includes(part.type)\n ) {\n const queries = input?.queries\n if (Array.isArray(queries)) {\n const valid = queries.filter(\n (query): query is string =>\n typeof query === 'string' && Boolean(query.trim()),\n )\n return valid.length ? valid.join(' · ') : undefined\n }\n return pickString(input, 'query', 'objective')\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return pickString(input, 'query')\n }\n if (part.type === 'tool-getWeather') {\n return (\n pickString(output, 'location') ?? pickString(input, 'locationName')\n )\n }\n if (part.type === 'tool-geocode') {\n return pickString(input, 'locationName')\n }\n if (part.type === 'tool-expandChunkContext') {\n return pickString(output, 'documentName')\n }\n if (\n part.type === 'tool-readDocumentFile' ||\n part.type === 'tool-readChatAttachment' ||\n part.type === 'tool-sendChatFile' ||\n part.type === 'tool-shareDocument'\n ) {\n return pickString(output, 'name')\n }\n if (part.type === 'tool-readSpreadsheet') {\n const sheet = pickString(input, 'sheet')\n const range = pickString(input, 'range')\n return sheet && range ? `${sheet}!${range}` : sheet\n }\n if (part.type === 'tool-editSpreadsheet') {\n return pickString(output, 'filename')\n }\n if (part.type === 'tool-readWordDocument') {\n return pickString(input, 'search') ?? pickString(input, 'from')\n }\n if (part.type === 'tool-editWordDocument') {\n return pickString(output, 'filename')\n }\n if (\n part.type === 'tool-createSpreadsheet' ||\n part.type === 'tool-createWordDocument'\n ) {\n // The name the file got, or while the call runs the one asked for.\n return pickString(output, 'filename') ?? pickString(input, 'filename')\n }\n if (part.type === 'tool-querySpreadsheet') {\n // The file when the step asked for the schema; a query has no name.\n return pickString(output, 'file')\n }\n if (part.type === 'tool-recallUserMemory') {\n return pickString(input, 'query')\n }\n if (part.type === 'tool-saveUserMemory') {\n return pickString(input, 'content', 'query')\n }\n return undefined\n}\n\n// Get part icon\nexport function getPartIcon(\n part?: UIMessage['parts'][number] | null,\n): string | undefined {\n const host = getHostCallPart(part)\n if (host) {\n return pageToolStep(host)?.icon ?? 'ri:apps-line'\n }\n if (isToolPart(part)) {\n if (part.type.includes('tool-subagent')) {\n return 'ri:robot-2-line'\n }\n if (part.type === 'tool-runWorker') {\n return 'ri:flow-chart'\n }\n if (part.type === 'tool-scheduleWakeup') {\n return 'ri:alarm-line'\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return 'ri:chat-history-line'\n }\n if (part.type === 'tool-readEarlierMessages') {\n return 'ri:history-line'\n }\n if (part.type === 'tool-readChatAttachment') {\n return 'ri:attachment-line'\n }\n if (part.type === 'tool-sendChatFile') {\n return 'ri:send-plane-line'\n }\n if (part.type === 'tool-enableTools') {\n return 'ri:toggle-line'\n }\n if (part.type.includes('tool-mcp')) {\n return 'mcp'\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return 'ri:file-edit-line'\n }\n if (part.type === 'tool-searchInKnowledgeBase') {\n return 'ri:search-line'\n }\n if (part.type === 'tool-expandChunkContext') {\n return 'ri:file-search-line'\n }\n if (part.type === 'tool-readDocumentFile') {\n return 'ri:file-text-line'\n }\n if (part.type === 'tool-readSpreadsheet') {\n return 'ri:table-line'\n }\n if (\n part.type === 'tool-editSpreadsheet' ||\n part.type === 'tool-createSpreadsheet'\n ) {\n return 'ri:file-excel-2-line'\n }\n if (part.type === 'tool-shareDocument') {\n return 'ri:file-download-line'\n }\n if (part.type === 'tool-readWordDocument') {\n return 'ri:file-text-line'\n }\n if (\n part.type === 'tool-editWordDocument' ||\n part.type === 'tool-createWordDocument'\n ) {\n return 'ri:file-word-2-line'\n }\n if (part.type === 'tool-querySpreadsheet') {\n return 'ri:database-2-line'\n }\n if (part.type === 'tool-geocode') {\n return 'ri:map-2-line'\n }\n if (part.type === 'tool-getWeather') {\n return 'ri:sun-cloudy-line'\n }\n if (part.type === 'tool-recallUserMemory') {\n return 'ri:brain-line'\n }\n if (part.type === 'tool-saveUserMemory') {\n return 'ri:save-3-line'\n }\n if (part.type === 'tool-showWeather') {\n return 'ri:sun-line'\n }\n if (part.type === 'tool-showDiagram') {\n return 'ri:flow-chart'\n }\n if (part.type === 'tool-showSources') {\n return 'ri:book-2-line'\n }\n if (part.type === 'tool-showForm') {\n return 'ri:survey-line'\n }\n if (part.type === 'tool-showMultipleChoice') {\n return 'ri:checkbox-multiple-line'\n }\n if (part.type === 'tool-showArtifact') {\n return 'ri:file-code-line'\n }\n if (part.type === 'tool-showEmail') {\n return 'ri:mail-line'\n }\n if (part.type === 'tool-showMessage') {\n return 'ri:chat-1-line'\n }\n if (part.type === 'tool-showWebPages') {\n return 'ri:pages-line'\n }\n if (part.type === 'tool-showProductList') {\n return 'ri:shopping-bag-line'\n }\n if (part.type === 'tool-showContactForm') {\n return 'ri:send-plane-2-line'\n }\n if (part.type === 'tool-showCalendarEvent') {\n return 'ri:calendar-event-line'\n }\n if (part.type === 'tool-showComparison') {\n return 'ri:scales-line'\n }\n if (part.type === 'tool-showLocation') {\n return 'ri:map-pin-line'\n }\n if (part.type === 'tool-showQrCode') {\n return 'ri:qr-code-line'\n }\n if (part.type === 'tool-showImageGallery') {\n return 'ri:image-line'\n }\n if (part.type === 'tool-showVideo') {\n return 'ri:film-line'\n }\n if (part.type === 'tool-showSuggestedReply') {\n return 'ri:corner-down-right-line'\n }\n if (part.type === 'tool-requestGeolocation') {\n return 'ri:map-pin-user-line'\n }\n if (part.type === 'tool-disconnectOAuthConnection') {\n return 'ri:link-unlink'\n }\n if (part.type === 'tool-requestAccountLink') {\n return 'ri:link'\n }\n if (part.type === 'tool-unlinkAccount') {\n return 'ri:link-unlink'\n }\n if (WEB_SEARCH_TOOL_TYPES.includes(part.type)) {\n return 'ri:global-line'\n }\n return 'ri:tools-line'\n }\n if (isReasoningPart(part)) {\n return 'ri:lightbulb-line'\n }\n if (isTextPart(part)) {\n return 'ri:double-quotes-r'\n }\n return undefined\n}\n\n/** What `toolLabel` and `getPartTypeLabel` need from vue-i18n. */\nexport interface LabelTranslator {\n t: (key: string) => string\n te: (key: string) => boolean\n}\n\nconst TOOL_KEY_PREFIXES = [\n API_TOOL_PREFIX,\n MCP_TOOL_PREFIX,\n SUBAGENT_TOOL_PREFIX,\n] as const\n\n/**\n * The name a person reads for a tool of the turn: the translated label of a\n * built-in tool, otherwise the name the agent configured, without its\n * tool-set prefix and in words (`api-festivita_nazionali` reads \"Festivita\n * nazionali\"). Never the raw key, and never an i18n key with no translation,\n * which vue-i18n would print as the key itself.\n */\nexport function toolLabel(name: string, { t, te }: LabelTranslator): string {\n if (te(`agent.tool.${name}`)) {\n return t(`agent.tool.${name}`)\n }\n const prefix = TOOL_KEY_PREFIXES.find((p) => name.startsWith(p))\n const bare = prefix ? name.slice(prefix.length) : name\n return capitalizeFirstLetter(fromAnyCase(bare).trim().toLowerCase())\n}\n\n/**\n * The kinds of message part a person can meet, each with its label. Written\n * as literal keys so the widget's library build, which keeps only the keys it\n * finds written out (apps/web-component/vite-plugins/chatLocales.ts), ships\n * them too.\n */\nconst PART_TYPE_LABELS: Record<string, (t: LabelTranslator['t']) => string> = {\n custom: (t) => t('messagePart.type.custom'),\n data: (t) => t('messagePart.type.data'),\n file: (t) => t('messagePart.type.file'),\n reasoning: (t) => t('messagePart.type.reasoning'),\n 'source-document': (t) => t('messagePart.type.sourceDocument'),\n 'source-url': (t) => t('messagePart.type.sourceUrl'),\n 'step-start': (t) => t('messagePart.type.stepStart'),\n text: (t) => t('messagePart.type.text'),\n}\n\n/**\n * The label of a message part in the message details: the tool for a tool\n * call, the translated kind otherwise (text, reasoning, provider data...),\n * and the kind in words for one the catalog does not know yet.\n */\nexport function getPartTypeLabel(\n part: UIMessage['parts'][number],\n translator: LabelTranslator,\n): string {\n if (isToolPart(part)) {\n return toolLabel(getToolPartName(part), translator)\n }\n if (part.type === 'dynamic-tool') {\n return toolLabel(part.toolName, translator)\n }\n const kind = part.type.startsWith('data-') ? 'data' : part.type\n const label = PART_TYPE_LABELS[kind]\n return label\n ? label(translator.t)\n : capitalizeFirstLetter(fromAnyCase(part.type))\n}\n\n/**\n * The commercial name of a provider the gateway routed a turn through, from\n * its slug (`anthropic`, `bedrock`): proper nouns, so no translation. A slug\n * not listed here shows with a capital, never as the bare id.\n */\nconst PROVIDER_NAMES: Record<string, string> = {\n alibaba: 'Alibaba Cloud',\n anthropic: 'Anthropic',\n azure: 'Microsoft Azure',\n baseten: 'Baseten',\n bedrock: 'Amazon Bedrock',\n cerebras: 'Cerebras',\n cohere: 'Cohere',\n deepinfra: 'DeepInfra',\n deepseek: 'DeepSeek',\n fireworks: 'Fireworks AI',\n google: 'Google',\n groq: 'Groq',\n mistral: 'Mistral AI',\n moonshotai: 'Moonshot AI',\n openai: 'OpenAI',\n perplexity: 'Perplexity',\n togetherai: 'Together AI',\n vertex: 'Google Vertex AI',\n xai: 'xAI',\n zai: 'Z.ai',\n}\n\n/** The name of a provider slug, see `PROVIDER_NAMES`. */\nexport function providerLabel(slug: string): string {\n return (\n PROVIDER_NAMES[slug.toLowerCase()] ??\n capitalizeFirstLetter(fromAnyCase(slug))\n )\n}\n\n/**\n * The conversation summary in the reader's language. The analysis asks the\n * model for four bold labels (`SUMMARY_FORMAT` in\n * apps/backend/src/prompts/analysis.prompt.ts) and the model copies them in\n * English whatever the conversation's language, so every stored summary\n * holds them: they are translated where a summary is read. An empty summary\n * comes back as it is, so a `??` fallback after it still works.\n */\nexport function localizeSummaryLabels<T extends string | null | undefined>(\n summary: T,\n t: (key: string) => string,\n): T {\n if (!summary) {\n return summary\n }\n const labels: Record<string, string> = {\n Intent: t('conversationSummary.intent'),\n 'Topics covered': t('conversationSummary.topicsCovered'),\n 'Key facts': t('conversationSummary.keyFacts'),\n 'Open questions': t('conversationSummary.openQuestions'),\n }\n return summary.replace(\n /\\*\\*(Intent|Topics covered|Key facts|Open questions)(:?)\\*\\*/g,\n (_, label: string, colon: string) => `**${labels[label]}${colon}**`,\n ) as T\n}\n\n// Get part label\nexport function getToolPartLabel(\n $t: (key: string) => string,\n part?: UIMessage['parts'][number] | null,\n /** The live titles of the page's steps, by call: they win when present. */\n hostStepTitles?: Record<string, string>,\n): string | undefined {\n const host = getHostCallPart(part)\n if (host) {\n const live = host.toolCallId\n ? hostStepTitles?.[host.toolCallId]\n : undefined\n if (live) {\n return live\n }\n const page = pageToolStep(host)\n return page ? $t(page.label) : host.title || host.toolName\n }\n if (isToolPart(part)) {\n if (part.type.includes('tool-subagent')) {\n return $t(`messagePart.runSubagent`)\n }\n if (part.type === 'tool-runWorker') {\n return $t(`messagePart.runWorker`)\n }\n if (part.type === 'tool-scheduleWakeup') {\n return $t(`messagePart.scheduleWakeup`)\n }\n if (part.type === 'tool-fetchTeamsChannelHistory') {\n return $t(`messagePart.fetchTeamsChannelHistory`)\n }\n if (part.type === 'tool-readEarlierMessages') {\n return $t(`messagePart.readEarlierMessages`)\n }\n if (part.type === 'tool-readChatAttachment') {\n return $t(`messagePart.readChatAttachment`)\n }\n if (part.type === 'tool-sendChatFile') {\n return $t(`messagePart.sendChatFile`)\n }\n if (part.type === 'tool-enableTools') {\n return $t(`messagePart.enableTools`)\n }\n if (part.type === 'tool-retrieveRevisedAnswers') {\n return $t(`messagePart.revisedAnswers`)\n }\n if (part.type === 'tool-searchInKnowledgeBase') {\n return $t(`messagePart.searchingDocuments`)\n }\n if (part.type === 'tool-expandChunkContext') {\n return $t(`messagePart.expandChunkContext`)\n }\n if (part.type === 'tool-readDocumentFile') {\n return $t(`messagePart.readDocumentFile`)\n }\n if (part.type === 'tool-readSpreadsheet') {\n return $t(`messagePart.readSpreadsheet`)\n }\n if (part.type === 'tool-editSpreadsheet') {\n return $t(`messagePart.editSpreadsheet`)\n }\n if (part.type === 'tool-shareDocument') {\n return $t(`messagePart.shareDocument`)\n }\n if (part.type === 'tool-readWordDocument') {\n return $t(`messagePart.readWordDocument`)\n }\n if (part.type === 'tool-editWordDocument') {\n return $t(`messagePart.editWordDocument`)\n }\n if (part.type === 'tool-createSpreadsheet') {\n return $t(`messagePart.createSpreadsheet`)\n }\n if (part.type === 'tool-createWordDocument') {\n return $t(`messagePart.createWordDocument`)\n }\n if (part.type === 'tool-querySpreadsheet') {\n return $t(`messagePart.querySpreadsheet`)\n }\n if (part.type === 'tool-geocode') {\n return $t(`messagePart.geocode`)\n }\n if (part.type === 'tool-getWeather') {\n return $t(`messagePart.getWeather`)\n }\n if (part.type === 'tool-recallUserMemory') {\n return $t(`messagePart.recallUserMemory`)\n }\n if (part.type === 'tool-saveUserMemory') {\n return $t(`messagePart.saveUserMemory`)\n }\n if (part.type === 'tool-showWeather') {\n return $t(`messagePart.showWeather`)\n }\n if (part.type === 'tool-showForm') {\n return $t(`messagePart.showForm`)\n }\n if (part.type === 'tool-showDiagram') {\n return $t(`messagePart.showDiagram`)\n }\n if (part.type === 'tool-showSources') {\n return $t(`messagePart.showSources`)\n }\n if (part.type === 'tool-showMultipleChoice') {\n return $t(`messagePart.showMultipleChoice`)\n }\n if (part.type === 'tool-showArtifact') {\n return $t(`messagePart.showArtifact`)\n }\n if (part.type === 'tool-showEmail') {\n return $t(`messagePart.showEmail`)\n }\n if (part.type === 'tool-showMessage') {\n return $t(`messagePart.showMessage`)\n }\n if (part.type === 'tool-showWebPages') {\n return $t(`messagePart.showWebPages`)\n }\n if (part.type === 'tool-showProducts') {\n return $t(`messagePart.showProducts`)\n }\n if (part.type === 'tool-showContactForm') {\n return $t(`messagePart.showContactForm`)\n }\n if (part.type === 'tool-showCalendarEvent') {\n return $t(`messagePart.showCalendarEvent`)\n }\n if (part.type === 'tool-showComparison') {\n return $t(`messagePart.showComparison`)\n }\n if (part.type === 'tool-showLocation') {\n return $t(`messagePart.showLocation`)\n }\n if (part.type === 'tool-showQrCode') {\n return $t(`messagePart.showQrCode`)\n }\n if (part.type === 'tool-showImageGallery') {\n return $t(`messagePart.showImageGallery`)\n }\n if (part.type === 'tool-showVideo') {\n return $t(`messagePart.showVideo`)\n }\n if (part.type === 'tool-showSuggestedReply') {\n return $t(`messagePart.showSuggestedReply`)\n }\n if (part.type === 'tool-requestGeolocation') {\n return $t(`messagePart.requestGeolocation`)\n }\n if (part.type === 'tool-disconnectOAuthConnection') {\n return $t(`messagePart.disconnectOAuthConnection`)\n }\n if (part.type === 'tool-requestAccountLink') {\n return $t(`messagePart.requestAccountLink`)\n }\n if (part.type === 'tool-unlinkAccount') {\n return $t(`messagePart.unlinkAccount`)\n }\n if (WEB_SEARCH_TOOL_TYPES.includes(part.type)) {\n return $t(`messagePart.webSearch`)\n }\n return $t(`messagePart.tool`)\n }\n if (isReasoningPart(part)) {\n return $t(`messagePart.reasoning`)\n }\n return $t(`messagePart.streaming`)\n}\n\n/** The version of a file stored in the chat that a preview opens. */\nexport type ChatFilePreviewTarget = {\n kind: 'word' | 'spreadsheet'\n storedFileName: string\n /** The name of the file, not of its version. */\n filename: string\n version?: number\n /** The file all its versions belong to, as the agent names it. */\n fileId?: string\n}\n\n/**\n * How the viewer draws a Word document's tracked changes: marked as Word\n * marks them, as if accepted, or as before them.\n */\nexport type WordPreviewMode = 'markup' | 'accepted' | 'original'\n\n/**\n * The fonts that stand in for Office's where the reader's system lacks them:\n * the metric-compatible ones of Linux and Chrome OS first, so the lines break\n * where Word breaks them, then the closest common ones.\n */\nconst WORD_FONT_STACKS: Record<string, string> = {\n calibri: 'Calibri, Carlito, \"Segoe UI\", Arial, sans-serif',\n 'calibri light':\n '\"Calibri Light\", Calibri, Carlito, \"Segoe UI\", sans-serif',\n aptos: 'Aptos, Calibri, Carlito, \"Segoe UI\", Arial, sans-serif',\n 'aptos display': '\"Aptos Display\", Aptos, Calibri, Carlito, sans-serif',\n cambria: 'Cambria, Caladea, Georgia, serif',\n 'times new roman':\n '\"Times New Roman\", Tinos, \"Liberation Serif\", Times, serif',\n arial: 'Arial, Arimo, \"Liberation Sans\", Helvetica, sans-serif',\n helvetica: 'Helvetica, Arial, Arimo, sans-serif',\n 'courier new': '\"Courier New\", Cousine, \"Liberation Mono\", monospace',\n garamond: 'Garamond, \"EB Garamond\", Georgia, serif',\n georgia: 'Georgia, serif',\n verdana: 'Verdana, \"DejaVu Sans\", sans-serif',\n tahoma: 'Tahoma, Verdana, sans-serif',\n}\n\n/**\n * Word's single line as a multiple of the font size, from the font's ascent,\n * descent and line gap: the lines keep the height of the document's font\n * where another font stands in for it.\n */\nconst WORD_LINE_FACTORS: Record<string, number> = {\n calibri: 1.22,\n 'calibri light': 1.22,\n cambria: 1.17,\n 'times new roman': 1.15,\n arial: 1.15,\n helvetica: 1.15,\n 'courier new': 1.13,\n georgia: 1.14,\n verdana: 1.22,\n tahoma: 1.21,\n}\n\n/** Word's single line for a font a Word document names. */\nexport const wordLineFactor = (font: string): number =>\n WORD_LINE_FACTORS[font.toLowerCase()] ?? 1.17\n\n/** The CSS font stack for a font a Word document names. */\nexport const wordFontStack = (font: string): string =>\n WORD_FONT_STACKS[font.toLowerCase()] ??\n `\"${font.replace(/\"/g, '')}\", ${\n /roman|garamond|cambria|georgia|serif|book|times/i.test(font)\n ? 'Georgia, serif'\n : 'Calibri, Carlito, \"Segoe UI\", Arial, sans-serif'\n }`\n\n/**\n * The images of the Word document in the viewer, by reference, which its\n * runs draw (`PkWordPreview` provides them).\n */\nexport const WORD_PREVIEW_IMAGES: InjectionKey<\n Ref<Record<string, string> | undefined>\n> = Symbol('wordPreviewImages')\n\n/**\n * The image a run draws, only a WebP the server wrote: anything else in the\n * map is not drawn.\n */\nexport const wordPictureSrc = (\n images: Record<string, string> | undefined,\n ref: string,\n): string | undefined => {\n const src = images?.[ref]\n return src?.startsWith('data:image/webp;base64,') ? src : undefined\n}\n\n/** The numbers the page number fields of a page show. */\nexport type WordPageNumbers = {\n page: number\n pages: number\n sectionPages: number\n}\n\n/**\n * Where an image Word positions on the page sits on it: from the page's top\n * left corner, in points, under the text or over it.\n */\nexport const wordPageAnchorCss = (\n picture: WordPreviewPicture,\n page: WordPreviewPage,\n): CSSProperties => {\n const anchor = picture.anchor!\n return {\n left: `${anchor.xFrom === 'page' ? anchor.x : page.margins.left + anchor.x}pt`,\n top: `${anchor.yFrom === 'page' ? anchor.y : page.margins.top + anchor.y}pt`,\n width: `${picture.width}pt`,\n height: `${picture.height}pt`,\n zIndex: anchor.wrap === 'behind' ? -1 : 1,\n }\n}\n\n/**\n * How an image of a run is placed: in the text, beside the text of its\n * paragraph, on a line of its own, from its paragraph, or on the page,\n * which the page draws.\n */\nexport const wordPicturePlacement = (\n picture: WordPreviewPicture,\n): 'inline' | 'around' | 'block' | 'paragraph' | 'page' => {\n const anchor = picture.anchor\n return !anchor\n ? 'inline'\n : anchor.wrap === 'around'\n ? 'around'\n : anchor.wrap === 'block'\n ? 'block'\n : anchor.yFrom === 'paragraph'\n ? 'paragraph'\n : 'page'\n}\n\n/** The runs a mode keeps: a deletion is gone once accepted. */\nexport const wordKeptRuns = (\n runs: WordPreviewRun[],\n mode: WordPreviewMode,\n): WordPreviewRun[] =>\n runs.filter((r) =>\n mode === 'accepted'\n ? r.change !== 'deleted'\n : mode === 'original'\n ? r.change !== 'inserted'\n : true,\n )\n\nconst hasWordText = (runs: WordPreviewRun[]) =>\n runs.some((r) => r.image || r.text.trim())\n\n/** A piece of a Word document's flow: a paragraph or a table row. */\nexport type WordFlowItem = {\n key: string\n block: number\n row?: number\n breakBefore: boolean\n /** The section it opens. */\n section?: number\n}\n\n/**\n * The pieces of `blocks` in order, as the pages hold them. A paragraph or a\n * table row a mode empties is gone (a row inserted, as the original); one\n * empty in the document stays, a blank line as in Word. A section a gone\n * piece opened, with its page break, passes to the next one.\n */\nexport const wordFlowItems = (\n blocks: WordPreviewBlock[],\n mode: WordPreviewMode,\n): WordFlowItem[] => {\n const out: WordFlowItem[] = []\n let breakPending = false\n let sectionPending: number | undefined\n const push = (\n key: string,\n block: number,\n row: number | undefined,\n breakBefore: boolean,\n section: number | undefined,\n ) => {\n const opens = section ?? sectionPending\n out.push({\n key,\n block,\n ...(row !== undefined ? { row } : {}),\n breakBefore: breakBefore || breakPending,\n ...(opens !== undefined ? { section: opens } : {}),\n })\n breakPending = false\n sectionPending = undefined\n }\n // A gone piece's own page break goes with it; a section's start stays\n const skip = (breakBefore: boolean, section: number | undefined) => {\n breakPending ||= breakBefore && section !== undefined\n sectionPending = section ?? sectionPending\n }\n blocks.forEach((block, b) => {\n if (block.kind === 'table') {\n // The table's break and section go with its first row shown\n let breaks = !!block.pageBreakBefore\n let opens = block.section\n block.rows.forEach((cells, r) => {\n const filled = cells.some((cell) => cell.runs.length)\n if (\n filled &&\n !cells.some((cell) =>\n hasWordText(wordKeptRuns(cell.runs, mode)),\n )\n ) {\n return\n }\n push(`${b}:${r}`, b, r, breaks, opens)\n breaks = false\n opens = undefined\n })\n skip(breaks, opens)\n } else if (\n !block.runs.length ||\n hasWordText(wordKeptRuns(block.runs, mode))\n ) {\n push(\n `${b}`,\n b,\n undefined,\n !!block.style?.pageBreakBefore,\n block.section,\n )\n } else {\n skip(!!block.style?.pageBreakBefore, block.section)\n }\n })\n return out\n}\n\n/** The images Word positions on the page among the paragraphs of `blocks`. */\nexport const wordPageAnchors = (\n blocks: WordPreviewBlock[],\n mode: WordPreviewMode,\n): WordPreviewPicture[] =>\n blocks.flatMap((block) =>\n block.kind === 'table'\n ? []\n : wordKeptRuns(block.runs, mode).flatMap((run) =>\n run.picture && wordPicturePlacement(run.picture) === 'page'\n ? [run.picture]\n : [],\n ),\n )\n\n/** An earlier version of a file of the chat, for the agent to restore. */\nexport type ChatFileRestoreTarget = {\n /** The id the agent names the file with: the stored name of version 1. */\n fileId: string\n version: number\n filename: string\n}\n\n/**\n * The name of a file, not of its version: `listino (v2).xlsx` is version 2\n * of `listino.xlsx`.\n */\nexport const chatFileName = (filename: string, version?: number): string =>\n version\n ? filename.replace(new RegExp(` \\\\(v${version}\\\\)(\\\\.\\\\w+)$`), '$1')\n : filename\n"],"mappings":";;;;;AAAA,IAAaU,KAAiB,MAC1BC,EAAI,UAAU,KAAK,CAAC,CAAC,QAAQ,oBAAoB,EAAE,GAkB1CC,KAAe,MACnBD,IAGEA,EACF,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,UAAU,GAAG,IALf,IAiBFE,KAAiC,MACrCF,IAGED,EAAcC,CAAG,CAAC,CACpB,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,kBAAkB,GAAG,CAAC,CAC9B,YAAY,IALN,IAeFG,MAAiC,MACrCH,IAGED,EAAcC,CAAG,CAAC,CACpB,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,kBAAkB,GAAG,CAAC,CAC9B,YAAY,IALN,IAQFI,KAAyB,MAC7BJ,IAGEA,EAAI,OAAO,CAAC,CAAC,CAAC,YAAY,IAAIA,EAAI,MAAM,CAAC,IAFrC;;ACvBf,SAAgBK,EACZ,GACkB;CAClB,IAAMC,IAA6B,CAAC;CACpC,KAAK,IAAMC,KAAQC,GAAO;EACtB,IAAI,CAACX,EAAWU,CAAI,GAAG;GACnB,EAAO,KAAKA,CAAI;GAChB;EACJ;EACA,IAAME,IAAOH,EAAOA,EAAO,SAAS;EACpC,AAAIG,KAAQZ,EAAWY,CAA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,GACrC,IAAS,IACT,IAAQ,KAAA;GACZ,CAAC,GACDI,EAAKG,GAAQP,CAAK;EACtB,OAAO,AACH,CAACM,EAAM,KAAK,UACZZ,EAAYH,EAAae,EAAM,MAAMb,CAAI,CAAC,IAE1CM,EACI,GAAG3F,KACHA,GACA,KAAA,GACA,CAAC,CAACkG,EAAM,OAAO,iBACfA,EAAM,OACV,IAEAF,EAAK,CAAC,CAACE,EAAM,OAAO,iBAAiBA,EAAM,OAAO;CAE1D,CAAC,GACMV;AACX,GAGac,MACT,GACA,MAEAL,EAAO,SAAS,MACZC,EAAM,SAAS,UACT,CAAC,IACDf,EAAae,EAAM,MAAMb,CAAI,CAAC,CAAC,SAAS,MACpCkB,EAAI,WAAWrB,EAAqBqB,EAAI,OAAO,MAAM,SAC/C,CAACA,EAAI,OAAO,IACZ,CAAC,CACX,CACV,GAcSC,MAAgB,GAAkB,MAC3CC,IACMC,EAAS,QAAY,OAAO,QAAQD,EAAQ,cAAc,GAAG,IAAI,IACjEC"}
@@ -2,7 +2,7 @@ import { g as e, h as t } from "./_chunks/Agent-D3US-D1x.js";
2
2
  import { t as n } from "./_chunks/createChatbotApiClient-CFKeOgEA.js";
3
3
  import { n as r } from "./_chunks/useChatbotStore--6ws3cew.js";
4
4
  import { n as i } from "./_chunks/src-nb8MU1sh.js";
5
- import { M as a, a as o } from "./_chunks/utils-BgvjC1Pu.js";
5
+ import { N as a, o } from "./_chunks/utils-DmBnucJs.js";
6
6
  import { t as s } from "./_chunks/useLocalizedString-Dmn92nix.js";
7
7
  import { computed as c, getCurrentInstance as l, getCurrentScope as u, onBeforeUnmount as d, onMounted as f, onScopeDispose as p, ref as m, toValue as h, watch as g } from "vue";
8
8
  import { createI18n as _ } from "vue-i18n";