@8wave/ai-elements 0.125.0-beta.21 → 0.125.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{PkFilePreview-BzNLupQS.js → PkFilePreview-CyWTOCZC.js} +504 -462
- package/dist/_chunks/PkFilePreview-CyWTOCZC.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-BfZFgdOi.js → PkFilePreviewDialog-CUHwFDmH.js} +5 -2
- package/dist/_chunks/PkFilePreviewDialog-CUHwFDmH.js.map +1 -0
- package/dist/_chunks/{PkSelectionActions-CUymhwsG.js → PkSelectionActions-DDyt_ksY.js} +99 -26
- package/dist/_chunks/PkSelectionActions-DDyt_ksY.js.map +1 -0
- package/dist/ai-elements.es.js +2643 -2631
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-BVZgvanv.js → PkChatbot-D0uPiMhj.js} +2 -2
- package/dist-vue/_chunks/{PkChatbot-BVZgvanv.js.map → PkChatbot-D0uPiMhj.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-C1uzFQCJ.js → PkChatbotViewChat-Ckl03UkZ.js} +526 -443
- package/dist-vue/_chunks/PkChatbotViewChat-Ckl03UkZ.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreview-C2VOU99H.js → PkFilePreview-B26pY-C2.js} +522 -479
- package/dist-vue/_chunks/PkFilePreview-B26pY-C2.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-C6QQMntW.js → PkFilePreviewDialog-Dy5jmAom.js} +5 -2
- package/dist-vue/_chunks/PkFilePreviewDialog-Dy5jmAom.js.map +1 -0
- package/dist-vue/index.js +4 -4
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/packages/components/src/chat/PkFilePreview.d.ts +6 -0
- package/dist-vue/packages/components/src/chat/PkFilePreviewDialog.d.ts +3 -0
- package/dist-vue/packages/components/src/chat/PkSpreadsheetPreview.d.ts +5 -0
- package/dist-vue/packages/components/src/chat/PkWordPreview.d.ts +5 -0
- package/dist-vue/packages/components/src/chat/PkWordPreviewBlock.d.ts +3 -1
- package/dist-vue/packages/components/src/chat/previewChanges.d.ts +33 -0
- package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +8 -2
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-BzNLupQS.js.map +0 -1
- package/dist/_chunks/PkFilePreviewDialog-BfZFgdOi.js.map +0 -1
- package/dist/_chunks/PkSelectionActions-CUymhwsG.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-C1uzFQCJ.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-C2VOU99H.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreviewDialog-C6QQMntW.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { J as e, N as t, S as n, _ as r, k as i, tt as a, w as o, z as s } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
|
|
2
2
|
import { d as c } from "./index.es-D-aOuzzp.js";
|
|
3
3
|
import { t as l } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
4
|
-
import { t as u } from "./PkFilePreview-
|
|
4
|
+
import { t as u } from "./PkFilePreview-CyWTOCZC.js";
|
|
5
5
|
// ../../packages/components/src/chat/PkFilePreviewDialog.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
i();
|
|
7
7
|
// ../../packages/components/src/chat/PkFilePreviewDialog.vue
|
|
@@ -11,6 +11,7 @@ var d = /*#__PURE__*/ l(/* @__PURE__ */ o({
|
|
|
11
11
|
target: { type: Object },
|
|
12
12
|
downloadUrl: { type: String },
|
|
13
13
|
preview: { type: null },
|
|
14
|
+
changes: { type: Object },
|
|
14
15
|
loading: { type: Boolean },
|
|
15
16
|
error: { type: Boolean },
|
|
16
17
|
fullscreen: { type: Boolean },
|
|
@@ -69,6 +70,7 @@ var d = /*#__PURE__*/ l(/* @__PURE__ */ o({
|
|
|
69
70
|
versions: t.versions,
|
|
70
71
|
"download-url": t.downloadUrl,
|
|
71
72
|
preview: t.preview,
|
|
73
|
+
changes: t.changes,
|
|
72
74
|
loading: t.loading,
|
|
73
75
|
error: t.error,
|
|
74
76
|
restorable: t.restorable,
|
|
@@ -92,6 +94,7 @@ var d = /*#__PURE__*/ l(/* @__PURE__ */ o({
|
|
|
92
94
|
"versions",
|
|
93
95
|
"download-url",
|
|
94
96
|
"preview",
|
|
97
|
+
"changes",
|
|
95
98
|
"loading",
|
|
96
99
|
"error",
|
|
97
100
|
"restorable",
|
|
@@ -107,4 +110,4 @@ var d = /*#__PURE__*/ l(/* @__PURE__ */ o({
|
|
|
107
110
|
}), [["styles", [".pk-file-preview-dialog:not(.vv-dialog--fullscreen)>article{width:min(90rem,94dvw);height:92dvh}.pk-file-preview-dialog.vv-dialog--fullscreen>article{max-height:none}.pk-file-preview-dialog .vv-dialog__content{flex-direction:column;flex:1;min-height:0;padding:0;display:flex}"]]]);
|
|
108
111
|
export { d as default };
|
|
109
112
|
|
|
110
|
-
//# sourceMappingURL=PkFilePreviewDialog-
|
|
113
|
+
//# sourceMappingURL=PkFilePreviewDialog-CUHwFDmH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkFilePreviewDialog-CUHwFDmH.js","names":["_useModel","__unplugin_components_0","_openBlock","_createBlock","_withCtx","_createVNode","PkFilePreview","_sfc_main","_style_0","useModel","mergeModels","createVNode","createBlock","init_runtime_core_esm_bundler","withCtx","defineComponent","openBlock","nu","_plugin_vue_export_helper_default","PkFilePreview_default","PkFilePreviewDialog_default","\"mode\"","\"modeModifiers\"","\"sheet\"","\"sheetModifiers\"","\"zoom\"","\"zoomModifiers\"","\"fit\"","\"fitModifiers\"","__emit","emit","mode","__props","sheet","zoom","fit","_component_VvDialog","_cache","$event","text","pointer","action"],"sources":["../../../../packages/components/src/chat/PkFilePreviewDialog.vue","../../../../packages/components/src/chat/PkFilePreviewDialog.vue","../../../../packages/components/src/chat/PkFilePreviewDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import type {\n ChatFilePreview,\n FilePointer,\n SelectionGroupCapability,\n } from 'models'\n import PkFilePreview from './PkFilePreview.vue'\n import type { ChatFilePreviewChanges } from './previewChanges'\n import type { ChatFilePreviewTarget, WordPreviewMode } from './utils'\n\n /**\n * The viewer of a file stored in a chat in a dialog over the page: the\n * chat's when it has no room for the panel beside it or the reader\n * expands it, the chat log's always. Open while it is mounted: `close`\n * asks the host to drop it. The viewer draws its own head, with the file\n * and the close button, so the dialog has no title and takes its name.\n */\n defineProps<{\n target: ChatFilePreviewTarget\n /** The authenticated download URL of the same version. */\n downloadUrl: string\n preview?: ChatFilePreview\n /** What the version changed from the one shown before, for a moment. */\n changes?: ChatFilePreviewChanges\n loading?: boolean\n error?: boolean\n /** Covers the screen, for a phone. */\n fullscreen?: boolean\n /** The versions of the file in the conversation, from 1. */\n versions?: number[]\n /** The shown version can be written again as the newest one. */\n restorable?: boolean\n /** Offers to go back to the panel beside the chat. */\n resize?: 'shrink'\n /** The selection bar's actions for this format: absent in the chat logs. */\n selectionActions?: SelectionGroupCapability\n }>()\n\n const emit = defineEmits<{\n close: []\n version: [version: number]\n restore: []\n resize: []\n selectionSend: [\n text: string,\n pointer: FilePointer,\n action: { id: string; size: number },\n ]\n }>()\n\n // How the file is shown, kept by the host across panel and dialog\n const mode = defineModel<WordPreviewMode>('mode')\n const sheet = defineModel<number>('sheet')\n const zoom = defineModel<number>('zoom')\n // A boolean prop left out is false, not the viewer's default: the chat\n // logs keep no zoom, and their pages opened at 100% instead of fitted\n const fit = defineModel<boolean>('fit', { default: true })\n</script>\n\n<template>\n <VvDialog\n :model-value=\"true\"\n :aria-label=\"target.filename\"\n :modifiers=\"fullscreen ? 'fullscreen' : undefined\"\n class=\"pk-file-preview-dialog\"\n @update:model-value=\"!$event && emit('close')\">\n <PkFilePreview\n v-model:mode=\"mode\"\n v-model:sheet=\"sheet\"\n v-model:zoom=\"zoom\"\n v-model:fit=\"fit\"\n :kind=\"target.kind\"\n :filename=\"target.filename\"\n :version=\"target.version\"\n :versions\n :download-url\n :preview\n :changes\n :loading\n :error\n :restorable\n :resize\n :file-id=\"target.fileId\"\n :stored-file-name=\"target.storedFileName\"\n :selection-actions\n @version=\"emit('version', $event)\"\n @restore=\"emit('restore')\"\n @resize=\"emit('resize')\"\n @selection-send=\"\n (text, pointer, action) =>\n emit('selectionSend', text, pointer, action)\n \"\n @close=\"emit('close')\" />\n </VvDialog>\n</template>\n\n<style lang=\"scss\">\n // Almost the whole window, room for a page of Word and a grid of Excel;\n // the viewer scrolls in its own box, so the content does not pad it.\n .pk-file-preview-dialog {\n &:not(.vv-dialog--fullscreen) > article {\n width: min(90rem, 94dvw);\n height: 92dvh;\n }\n\n // The library writes `max-height: auto`, which is no value: the\n // wrapper kept its 90dvh and the phone saw the chat around it\n &.vv-dialog--fullscreen > article {\n max-height: none;\n }\n\n .vv-dialog__content {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n padding: 0;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import type {\n ChatFilePreview,\n FilePointer,\n SelectionGroupCapability,\n } from 'models'\n import PkFilePreview from './PkFilePreview.vue'\n import type { ChatFilePreviewChanges } from './previewChanges'\n import type { ChatFilePreviewTarget, WordPreviewMode } from './utils'\n\n /**\n * The viewer of a file stored in a chat in a dialog over the page: the\n * chat's when it has no room for the panel beside it or the reader\n * expands it, the chat log's always. Open while it is mounted: `close`\n * asks the host to drop it. The viewer draws its own head, with the file\n * and the close button, so the dialog has no title and takes its name.\n */\n defineProps<{\n target: ChatFilePreviewTarget\n /** The authenticated download URL of the same version. */\n downloadUrl: string\n preview?: ChatFilePreview\n /** What the version changed from the one shown before, for a moment. */\n changes?: ChatFilePreviewChanges\n loading?: boolean\n error?: boolean\n /** Covers the screen, for a phone. */\n fullscreen?: boolean\n /** The versions of the file in the conversation, from 1. */\n versions?: number[]\n /** The shown version can be written again as the newest one. */\n restorable?: boolean\n /** Offers to go back to the panel beside the chat. */\n resize?: 'shrink'\n /** The selection bar's actions for this format: absent in the chat logs. */\n selectionActions?: SelectionGroupCapability\n }>()\n\n const emit = defineEmits<{\n close: []\n version: [version: number]\n restore: []\n resize: []\n selectionSend: [\n text: string,\n pointer: FilePointer,\n action: { id: string; size: number },\n ]\n }>()\n\n // How the file is shown, kept by the host across panel and dialog\n const mode = defineModel<WordPreviewMode>('mode')\n const sheet = defineModel<number>('sheet')\n const zoom = defineModel<number>('zoom')\n // A boolean prop left out is false, not the viewer's default: the chat\n // logs keep no zoom, and their pages opened at 100% instead of fitted\n const fit = defineModel<boolean>('fit', { default: true })\n</script>\n\n<template>\n <VvDialog\n :model-value=\"true\"\n :aria-label=\"target.filename\"\n :modifiers=\"fullscreen ? 'fullscreen' : undefined\"\n class=\"pk-file-preview-dialog\"\n @update:model-value=\"!$event && emit('close')\">\n <PkFilePreview\n v-model:mode=\"mode\"\n v-model:sheet=\"sheet\"\n v-model:zoom=\"zoom\"\n v-model:fit=\"fit\"\n :kind=\"target.kind\"\n :filename=\"target.filename\"\n :version=\"target.version\"\n :versions\n :download-url\n :preview\n :changes\n :loading\n :error\n :restorable\n :resize\n :file-id=\"target.fileId\"\n :stored-file-name=\"target.storedFileName\"\n :selection-actions\n @version=\"emit('version', $event)\"\n @restore=\"emit('restore')\"\n @resize=\"emit('resize')\"\n @selection-send=\"\n (text, pointer, action) =>\n emit('selectionSend', text, pointer, action)\n \"\n @close=\"emit('close')\" />\n </VvDialog>\n</template>\n\n<style lang=\"scss\">\n // Almost the whole window, room for a page of Word and a grid of Excel;\n // the viewer scrolls in its own box, so the content does not pad it.\n .pk-file-preview-dialog {\n &:not(.vv-dialog--fullscreen) > article {\n width: min(90rem, 94dvw);\n height: 92dvh;\n }\n\n // The library writes `max-height: auto`, which is no value: the\n // wrapper kept its 90dvh and the phone saw the chat around it\n &.vv-dialog--fullscreen > article {\n max-height: none;\n }\n\n .vv-dialog__content {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n padding: 0;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import type {\n ChatFilePreview,\n FilePointer,\n SelectionGroupCapability,\n } from 'models'\n import PkFilePreview from './PkFilePreview.vue'\n import type { ChatFilePreviewChanges } from './previewChanges'\n import type { ChatFilePreviewTarget, WordPreviewMode } from './utils'\n\n /**\n * The viewer of a file stored in a chat in a dialog over the page: the\n * chat's when it has no room for the panel beside it or the reader\n * expands it, the chat log's always. Open while it is mounted: `close`\n * asks the host to drop it. The viewer draws its own head, with the file\n * and the close button, so the dialog has no title and takes its name.\n */\n defineProps<{\n target: ChatFilePreviewTarget\n /** The authenticated download URL of the same version. */\n downloadUrl: string\n preview?: ChatFilePreview\n /** What the version changed from the one shown before, for a moment. */\n changes?: ChatFilePreviewChanges\n loading?: boolean\n error?: boolean\n /** Covers the screen, for a phone. */\n fullscreen?: boolean\n /** The versions of the file in the conversation, from 1. */\n versions?: number[]\n /** The shown version can be written again as the newest one. */\n restorable?: boolean\n /** Offers to go back to the panel beside the chat. */\n resize?: 'shrink'\n /** The selection bar's actions for this format: absent in the chat logs. */\n selectionActions?: SelectionGroupCapability\n }>()\n\n const emit = defineEmits<{\n close: []\n version: [version: number]\n restore: []\n resize: []\n selectionSend: [\n text: string,\n pointer: FilePointer,\n action: { id: string; size: number },\n ]\n }>()\n\n // How the file is shown, kept by the host across panel and dialog\n const mode = defineModel<WordPreviewMode>('mode')\n const sheet = defineModel<number>('sheet')\n const zoom = defineModel<number>('zoom')\n // A boolean prop left out is false, not the viewer's default: the chat\n // logs keep no zoom, and their pages opened at 100% instead of fitted\n const fit = defineModel<boolean>('fit', { default: true })\n</script>\n\n<template>\n <VvDialog\n :model-value=\"true\"\n :aria-label=\"target.filename\"\n :modifiers=\"fullscreen ? 'fullscreen' : undefined\"\n class=\"pk-file-preview-dialog\"\n @update:model-value=\"!$event && emit('close')\">\n <PkFilePreview\n v-model:mode=\"mode\"\n v-model:sheet=\"sheet\"\n v-model:zoom=\"zoom\"\n v-model:fit=\"fit\"\n :kind=\"target.kind\"\n :filename=\"target.filename\"\n :version=\"target.version\"\n :versions\n :download-url\n :preview\n :changes\n :loading\n :error\n :restorable\n :resize\n :file-id=\"target.fileId\"\n :stored-file-name=\"target.storedFileName\"\n :selection-actions\n @version=\"emit('version', $event)\"\n @restore=\"emit('restore')\"\n @resize=\"emit('resize')\"\n @selection-send=\"\n (text, pointer, action) =>\n emit('selectionSend', text, pointer, action)\n \"\n @close=\"emit('close')\" />\n </VvDialog>\n</template>\n\n<style lang=\"scss\">\n // Almost the whole window, room for a page of Word and a grid of Excel;\n // the viewer scrolls in its own box, so the content does not pad it.\n .pk-file-preview-dialog {\n &:not(.vv-dialog--fullscreen) > article {\n width: min(90rem, 94dvw);\n height: 92dvh;\n }\n\n // The library writes `max-height: auto`, which is no value: the\n // wrapper kept its 90dvh and the phone saw the chat around it\n &.vv-dialog--fullscreen > article {\n max-height: none;\n }\n\n .vv-dialog__content {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n padding: 0;\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCI,IAAM8B,IAAOD,GAaPE,IAAO/B,EAA4BgC,GAAC,MAAM,GAC1CC,IAAQjC,EAAmBgC,GAAC,OAAO,GACnCE,IAAOlC,EAAmBgC,GAAC,MAAM,GAGjCG,IAAMnC,EAAoBgC,GAAC,KAAwB;;;GAIzD,OAAA9B,EAAA,GAAAC,EAiCWiC,GAAA;IAhCN,eAAa;IACb,cAAYJ,EAAA,OAAO;IACnB,WAAWA,EAAA,aAAU,eAAkB,KAAA;IACxC,OAAM;IACL,uBAAkB,AAAAK,EAAA,QAAA,MAAA,CAAGC,KAAUR,EAAI,OAAA;;IACpC,SAAA1B,QA0B6B,CA1B7BC,EA0B6BC,GAAA;KAzBjB,MAAMyB,EAAA;KAAA,iBAAA,AAAAM,EAAA,QAAA,MAAA,EAAI,QAAAC;KACV,OAAOL,EAAA;KAAA,kBAAA,AAAAI,EAAA,QAAA,MAAA,EAAK,QAAAC;KACZ,MAAMJ,EAAA;KAAA,iBAAA,AAAAG,EAAA,QAAA,MAAA,EAAI,QAAAC;KACV,KAAKH,EAAA;KAAA,gBAAA,AAAAE,EAAA,QAAA,MAAA,EAAG,QAAAC;KACf,MAAMN,EAAA,OAAO;KACb,UAAUA,EAAA,OAAO;KACjB,SAASA,EAAA,OAAO;KAChB,UAAAA,EAAA;KACA,gBAAAA,EAAA;KACA,SAAAA,EAAA;KACA,SAAAA,EAAA;KACA,SAAAA,EAAA;KACA,OAAAA,EAAA;KACA,YAAAA,EAAA;KACA,QAAAA,EAAA;KACA,WAASA,EAAA,OAAO;KAChB,oBAAkBA,EAAA,OAAO;KACzB,qBAAAA,EAAA;KACA,WAAO,AAAAK,EAAA,QAAA,MAAEP,EAAI,WAAYQ,CAAM;KAC/B,WAAO,AAAAD,EAAA,QAAA,MAAEP,EAAI,SAAA;KACb,UAAM,AAAAO,EAAA,QAAA,MAAEP,EAAI,QAAA;KACZ,iBAAc,AAAAO,EAAA,QAAoB,GAAM,GAAS,MAA+BP,EAAI,iBAAkBS,GAAMC,GAASC,CAAM;KAI3H,SAAK,AAAAJ,EAAA,QAAA,MAAEP,EAAI,OAAA"}
|
|
@@ -52,12 +52,85 @@ function N({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2 })
|
|
|
52
52
|
clear: o
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
+
// ../../packages/components/src/chat/previewChanges.ts
|
|
56
|
+
var P = 1e6, F = (e, t) => {
|
|
57
|
+
let n = 0;
|
|
58
|
+
for (; n < e.length && n < t.length && e[n] === t[n];) n += 1;
|
|
59
|
+
let r = 0;
|
|
60
|
+
for (; r < e.length - n && r < t.length - n && e[e.length - 1 - r] === t[t.length - 1 - r];) r += 1;
|
|
61
|
+
let i = e.length - n - r, a = t.length - n - r, o = /* @__PURE__ */ new Map(), s = (e, t, n, r) => {
|
|
62
|
+
for (let i = n; i < r; i++) {
|
|
63
|
+
let r = e + (i - n);
|
|
64
|
+
o.set(i, r < t ? r : void 0);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
if (!a) return o;
|
|
68
|
+
if (!i || i * a > P) return s(n, n + i, n, n + a), o;
|
|
69
|
+
let c = new Uint32Array((i + 1) * (a + 1));
|
|
70
|
+
for (let r = i - 1; r >= 0; r--) for (let i = a - 1; i >= 0; i--) c[r * (a + 1) + i] = e[n + r] === t[n + i] ? c[(r + 1) * (a + 1) + i + 1] + 1 : Math.max(c[(r + 1) * (a + 1) + i], c[r * (a + 1) + i + 1]);
|
|
71
|
+
let l = 0, u = 0, d = 0, f = 0;
|
|
72
|
+
for (; l < i && u < a;) e[n + l] === t[n + u] ? (s(n + d, n + l, n + f, n + u), l += 1, u += 1, d = l, f = u) : c[(l + 1) * (a + 1) + u] >= c[l * (a + 1) + u + 1] ? l += 1 : u += 1;
|
|
73
|
+
return s(n + d, n + i, n + f, n + a), o;
|
|
74
|
+
}, I = (e, t) => e === "id" || e === "ids" ? void 0 : t, L = (e) => JSON.stringify(e, I), R = (e, t) => {
|
|
75
|
+
let n = (e) => e.flatMap((e) => e.ids ?? []);
|
|
76
|
+
return t?.kind === "table" ? [...F(t.rows.map(L), e.rows.map(L))].flatMap(([r, i]) => {
|
|
77
|
+
let a = i === void 0 ? void 0 : t.rows[i];
|
|
78
|
+
return n(e.rows[r].filter((e, t) => !a?.[t] || L(a[t]) !== L(e)));
|
|
79
|
+
}) : n(e.rows.flat());
|
|
80
|
+
}, z = (e, t) => {
|
|
81
|
+
let n = /* @__PURE__ */ new Set(), r = F(e.blocks.map(L), t.blocks.map(L));
|
|
82
|
+
for (let [i, a] of r) {
|
|
83
|
+
let r = t.blocks[i];
|
|
84
|
+
if (r.kind === "table") {
|
|
85
|
+
let t = a === void 0 ? void 0 : e.blocks[a];
|
|
86
|
+
for (let e of R(r, t)) n.add(e);
|
|
87
|
+
} else r.id && n.add(r.id);
|
|
88
|
+
}
|
|
89
|
+
return n;
|
|
90
|
+
}, B = (e, t) => {
|
|
91
|
+
let n = /* @__PURE__ */ new Map();
|
|
92
|
+
for (let r of t.rows) for (let t of r.cells) n.set(`${r.row}:${t.col}`, JSON.stringify({
|
|
93
|
+
...t,
|
|
94
|
+
style: t.style === void 0 ? void 0 : e.styles[t.style],
|
|
95
|
+
numFmt: t.numFmt === void 0 ? void 0 : e.numberFormats?.[t.numFmt]
|
|
96
|
+
}));
|
|
97
|
+
return n;
|
|
98
|
+
}, V = (e, t) => {
|
|
99
|
+
let n = /* @__PURE__ */ new Map();
|
|
100
|
+
for (let r of t.sheets) {
|
|
101
|
+
let i = e.sheets.find((e) => e.name === r.name), a = B(t, r), o = i ? B(e, i) : /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
102
|
+
for (let [e, t] of a) o.get(e) !== t && s.add(e);
|
|
103
|
+
for (let e of o.keys()) a.has(e) || s.add(e);
|
|
104
|
+
s.size && n.set(r.name, s);
|
|
105
|
+
}
|
|
106
|
+
return n;
|
|
107
|
+
}, H = (e, t) => {
|
|
108
|
+
if (e.kind === "word" && t.kind === "word") {
|
|
109
|
+
let n = z(e, t);
|
|
110
|
+
return n.size ? {
|
|
111
|
+
kind: "word",
|
|
112
|
+
paragraphs: n
|
|
113
|
+
} : void 0;
|
|
114
|
+
}
|
|
115
|
+
if (e.kind === "spreadsheet" && t.kind === "spreadsheet") {
|
|
116
|
+
let n = V(e, t);
|
|
117
|
+
return n.size ? {
|
|
118
|
+
kind: "spreadsheet",
|
|
119
|
+
cells: n
|
|
120
|
+
} : void 0;
|
|
121
|
+
}
|
|
122
|
+
}, U = (e, t) => {
|
|
123
|
+
let n = e?.querySelector(t);
|
|
124
|
+
if (!e || !n) return !1;
|
|
125
|
+
let r = e.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
126
|
+
return (i.top < r.top || i.bottom > r.bottom) && (e.scrollTop += i.top - r.top - (r.height - i.height) / 2), (i.left < r.left || i.right > r.right) && (e.scrollLeft += i.left - r.left - (r.width - i.width) / 2), !0;
|
|
127
|
+
};
|
|
55
128
|
// ../../packages/components/src/chat/PkSelectionActions.vue?vue&type=script&setup=true&lang.ts
|
|
56
129
|
m(), y(), _(), a();
|
|
57
|
-
var
|
|
130
|
+
var W = ["onKeydown"], G = ["placeholder", "aria-label"], K = ["disabled"], q = ["aria-label"], J = { class: "pk-selection-actions__text" }, Y = {
|
|
58
131
|
key: 0,
|
|
59
132
|
class: "pk-selection-actions__text"
|
|
60
|
-
},
|
|
133
|
+
}, X = ["onClick"], Z = /*#__PURE__*/ A(/* @__PURE__ */ C({
|
|
61
134
|
__name: "PkSelectionActions",
|
|
62
135
|
props: /*@__PURE__*/ r({
|
|
63
136
|
actions: { type: Array },
|
|
@@ -88,20 +161,20 @@ var P = ["onKeydown"], F = ["placeholder", "aria-label"], I = ["disabled"], L =
|
|
|
88
161
|
height: j.value
|
|
89
162
|
},
|
|
90
163
|
touch: m.touch
|
|
91
|
-
})), N = f(),
|
|
164
|
+
})), N = f(), P = f(""), F = async (e, n) => {
|
|
92
165
|
N.value = {
|
|
93
166
|
id: e,
|
|
94
167
|
placeholder: n
|
|
95
|
-
},
|
|
96
|
-
},
|
|
168
|
+
}, P.value = "", v.value = !0, await t(), C.value?.focus();
|
|
169
|
+
}, I = () => {
|
|
97
170
|
N.value = void 0, v.value = !1;
|
|
98
|
-
},
|
|
99
|
-
e.asks ?
|
|
100
|
-
},
|
|
101
|
-
let e =
|
|
102
|
-
e && N.value && (N.value.id ? _("action", N.value.id, e) : _("ask", e),
|
|
103
|
-
},
|
|
104
|
-
N.value ?
|
|
171
|
+
}, L = (e) => {
|
|
172
|
+
e.asks ? F(e.id, e.asks) : _("action", e.id);
|
|
173
|
+
}, R = () => {
|
|
174
|
+
let e = P.value.trim();
|
|
175
|
+
e && N.value && (N.value.id ? _("action", N.value.id, e) : _("ask", e), I());
|
|
176
|
+
}, z = () => {
|
|
177
|
+
N.value ? I() : _("close");
|
|
105
178
|
};
|
|
106
179
|
return (t, n) => (E(), T("div", {
|
|
107
180
|
class: e(["pk-selection-actions", {
|
|
@@ -112,57 +185,57 @@ var P = ["onKeydown"], F = ["placeholder", "aria-label"], I = ["disabled"], L =
|
|
|
112
185
|
top: `${M.value.top}px`,
|
|
113
186
|
left: `${M.value.left}px`
|
|
114
187
|
}),
|
|
115
|
-
onKeydown: b(l(
|
|
188
|
+
onKeydown: b(l(z, ["stop"]), ["esc"])
|
|
116
189
|
}, [N.value ? (E(), T("form", {
|
|
117
190
|
key: 0,
|
|
118
191
|
ref_key: "barEl",
|
|
119
192
|
ref: S,
|
|
120
193
|
class: "pk-selection-actions__bar pk-selection-actions__bar--field",
|
|
121
|
-
onSubmit: l(
|
|
194
|
+
onSubmit: l(R, ["prevent"])
|
|
122
195
|
}, [g(d("input", {
|
|
123
196
|
ref_key: "inputEl",
|
|
124
197
|
ref: C,
|
|
125
|
-
"onUpdate:modelValue": n[0] ||= (e) =>
|
|
198
|
+
"onUpdate:modelValue": n[0] ||= (e) => P.value = e,
|
|
126
199
|
class: "pk-selection-actions__input",
|
|
127
200
|
type: "text",
|
|
128
201
|
maxlength: "500",
|
|
129
202
|
placeholder: N.value.placeholder,
|
|
130
203
|
"aria-label": N.value.placeholder
|
|
131
|
-
}, null, 8,
|
|
204
|
+
}, null, 8, G), [[c, P.value]]), d("button", {
|
|
132
205
|
type: "submit",
|
|
133
206
|
class: "pk-selection-actions__button pk-selection-actions__button--send",
|
|
134
|
-
disabled: !
|
|
135
|
-
}, h(w(y)("action.send")), 9,
|
|
207
|
+
disabled: !P.value.trim()
|
|
208
|
+
}, h(w(y)("action.send")), 9, K)], 544)) : (E(), T("div", {
|
|
136
209
|
key: 1,
|
|
137
210
|
ref_key: "barEl",
|
|
138
211
|
ref: S,
|
|
139
212
|
class: "pk-selection-actions__bar",
|
|
140
213
|
role: "toolbar",
|
|
141
214
|
"aria-label": w(y)("selectionActions.label")
|
|
142
|
-
}, [r.note ? (E(), T(u, { key: 0 }, [d("span",
|
|
215
|
+
}, [r.note ? (E(), T(u, { key: 0 }, [d("span", J, h(r.note), 1), r.noteAction ? (E(), T("button", {
|
|
143
216
|
key: 0,
|
|
144
217
|
type: "button",
|
|
145
218
|
class: "pk-selection-actions__button",
|
|
146
219
|
onMousedown: n[1] ||= l(() => {}, ["prevent"]),
|
|
147
220
|
onClick: n[2] ||= (e) => _("note")
|
|
148
221
|
}, h(r.noteAction), 33)) : x("", !0)], 64)) : (E(), T(u, { key: 1 }, [
|
|
149
|
-
r.hint ? (E(), T("span",
|
|
222
|
+
r.hint ? (E(), T("span", Y, h(r.hint), 1)) : x("", !0),
|
|
150
223
|
(E(!0), T(u, null, o(r.actions, (e) => (E(), T("button", {
|
|
151
224
|
key: e.id,
|
|
152
225
|
type: "button",
|
|
153
226
|
class: "pk-selection-actions__button",
|
|
154
227
|
onMousedown: n[3] ||= l(() => {}, ["prevent"]),
|
|
155
|
-
onClick: (t) =>
|
|
156
|
-
}, h(e.label), 41,
|
|
228
|
+
onClick: (t) => L(e)
|
|
229
|
+
}, h(e.label), 41, X))), 128)),
|
|
157
230
|
d("button", {
|
|
158
231
|
type: "button",
|
|
159
232
|
class: "pk-selection-actions__button",
|
|
160
233
|
onMousedown: n[4] ||= l(() => {}, ["prevent"]),
|
|
161
|
-
onClick: n[5] ||= (e) =>
|
|
234
|
+
onClick: n[5] ||= (e) => F(void 0, w(y)("selectionActions.askPlaceholder"))
|
|
162
235
|
}, h(w(y)("selectionActions.ask")), 33)
|
|
163
|
-
], 64))], 8,
|
|
236
|
+
], 64))], 8, q))], 46, W));
|
|
164
237
|
}
|
|
165
238
|
}), [["styles", [".pk-selection-actions{z-index:10;max-width:min(32rem, 100% - var(--spacing-16));position:absolute}.pk-selection-actions--fixed{z-index:2147483647;position:fixed}.pk-selection-actions--asking{width:min(var(--spacing-384), 100% - var(--spacing-16))}.pk-selection-actions__bar{align-items:center;gap:var(--spacing-4);width:max-content;max-width:100%;padding:var(--spacing-4);border-radius:var(--rounded-lg);background-color:var(--color-word-1);color:var(--color-surface);font-family:var(--font-sans);font-size:var(--text-14);font-weight:var(--font-medium);box-shadow:var(--shadow-lg);flex-wrap:wrap;display:flex}.pk-selection-actions__bar--field{flex-wrap:nowrap;width:100%}.pk-selection-actions__text{padding:0 var(--spacing-8);opacity:.75;font-size:var(--text-12);font-weight:var(--font-normal)}.pk-selection-actions__button{border-radius:var(--rounded);padding:var(--spacing-6) var(--spacing-10);color:inherit;font:inherit;cursor:pointer;background-color:#0000;border:0;flex-shrink:0}.pk-selection-actions__button:hover{background-color:color-mix(in srgb, var(--color-surface) 16%, transparent)}.pk-selection-actions__button:focus-visible{outline:var(--spacing-2) solid var(--color-surface);outline-offset:calc(-1 * var(--spacing-2))}.pk-selection-actions__button--send{background-color:var(--color-surface);color:var(--color-word-1)}.pk-selection-actions__button--send:hover{background-color:var(--color-surface)}.pk-selection-actions__button--send:disabled{opacity:.5;cursor:default}.pk-selection-actions__input{border-radius:var(--rounded);min-width:0;padding:var(--spacing-6) var(--spacing-8);background-color:color-mix(in srgb, var(--color-surface) 12%, transparent);color:inherit;font:inherit;font-weight:var(--font-normal);border:0;flex:1}.pk-selection-actions__input::placeholder{color:inherit;opacity:.6}.pk-selection-actions__input:focus-visible{outline:var(--spacing-2) solid var(--color-surface);outline-offset:calc(-1 * var(--spacing-2))}"]]]);
|
|
166
|
-
export { N as n,
|
|
239
|
+
export { N as i, H as n, U as r, Z as t };
|
|
167
240
|
|
|
168
|
-
//# sourceMappingURL=PkSelectionActions-
|
|
241
|
+
//# sourceMappingURL=PkSelectionActions-DDyt_ksY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkSelectionActions-DDyt_ksY.js","names":["settled","_useModel","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_withKeys","_withModifiers","_withDirectives","_createElementVNode","_vModelText","_toDisplayString","_unref","_Fragment","_createCommentVNode","_renderList","_sfc_main","_style_0","normalizeClass","nextTick","useModel","mergeModels","normalizeStyle","init_shared_esm_bundler","renderList","useTemplateRef","withModifiers","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","withDirectives","init_reactivity_esm_bundler","onScopeDispose","init_runtime_dom_esm_bundler","withKeys","createCommentVNode","shallowRef","defineComponent","unref","createElementBlock","openBlock","useI18n","selectionBarPosition","useElementSize","_plugin_vue_export_helper_default","FINE_POINTER","rangeIn","selection","root","shadow","ranges","first","range","own","useSettledSelection","timer","clear","read","node","enabled","minChars","box","onChange","delay","MAX_ALIGNED_PAIRS","unmatchedItems","start","before","after","end","n","m","out","gap","j","j0","j1","i","i0","i1","lengths","withoutIds","key","value","contentOf","changedCellIds","idsOf","cells","c","was","old","cell","wordChanges","paragraphs","blocks","b","block","id","cellContents","sheet","preview","spreadsheetChanges","s","now","changed","at","content","chatFilePreviewChanges","revealFirstChange","el","scroller","selector","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","PkSelectionActions_default","\"asking\"","\"askingModifiers\"","__emit","props","__props","emit","asking","$t","barEl","inputEl","position","width","height","field","text","openField","closeField","run","action","submit","onEscape","_cache","$event","vModelText"],"sources":["../../../../packages/composable/src/useSettledSelection.ts","../../../../packages/components/src/chat/previewChanges.ts","../../../../packages/components/src/chat/PkSelectionActions.vue","../../../../packages/components/src/chat/PkSelectionActions.vue","../../../../packages/components/src/chat/PkSelectionActions.vue"],"sourcesContent":["import { onScopeDispose, shallowRef, type ShallowRef } from 'vue'\n\n/** A selection that stayed still: its range and where it is on screen. */\nexport interface SettledSelection {\n range: Range\n /** The box of its first line: a bar goes above the start of a selection. */\n start: DOMRect\n /** The box of the whole selection. */\n box: DOMRect\n}\n\nexport interface UseSettledSelectionOptions {\n /** Where the range is read: the document, or the shadow root the selection is in. */\n root: () => Document | ShadowRoot | null | undefined\n /** Held off while false: the page while the user points, under a modal, during a turn. */\n enabled?: () => boolean\n /** How long the selection stays still before it counts, in ms. */\n delay?: number\n /** The shortest text that counts. */\n minChars?: number\n}\n\n/** A pointer that hovers: on a touch screen the system has its own menu on a selection. */\nconst FINE_POINTER = '(hover: hover) and (pointer: fine)'\n\ntype ComposedSelection = Selection & {\n getComposedRanges?: (\n ...args: [{ shadowRoots: ShadowRoot[] }] | ShadowRoot[]\n ) => StaticRange[]\n}\n\n/**\n * The first range of the selection, read inside `root`, as a copy: the\n * selection's own range is live, and Chrome collapses it as soon as the\n * focus moves into the bar's field. In a shadow root the document's\n * selection stops at its host: the composed range reads past it (Chrome 137,\n * Safari 17, Firefox 142; Safari took the roots as arguments before the\n * options object), and Chromium's own selection of the root is the fallback.\n * Without either nothing is read, and no bar appears.\n */\nfunction rangeIn(root: Document | ShadowRoot): Range | undefined {\n const selection = document.getSelection() as ComposedSelection | null\n if (!selection || selection.rangeCount === 0) {\n return undefined\n }\n if (root.nodeType === Node.DOCUMENT_NODE) {\n return selection.getRangeAt(0).cloneRange()\n }\n const shadow = root as ShadowRoot\n if (selection.getComposedRanges) {\n let ranges: StaticRange[]\n try {\n ranges = selection.getComposedRanges({ shadowRoots: [shadow] })\n } catch {\n ranges = selection.getComposedRanges(shadow)\n }\n const [first] = ranges\n if (!first) {\n return undefined\n }\n const range = document.createRange()\n range.setStart(first.startContainer, first.startOffset)\n range.setEnd(first.endContainer, first.endOffset)\n return range\n }\n const own = (\n shadow as ShadowRoot & { getSelection?: () => Selection | null }\n ).getSelection?.()\n return own && own.rangeCount > 0\n ? own.getRangeAt(0).cloneRange()\n : undefined\n}\n\n/**\n * The selection once it stays still (spec `selection-actions.md`, \"Cosa è\n * comune\"): what the bar of actions appears on, on the page that embeds the\n * widget and in the chat's file viewer. `selectionchange` fires on the\n * document wherever the selection is, so the document is always listened to\n * and `root` only says where the range is read. Nothing on a touch screen.\n * Undefined while the selection moves, is collapsed or shorter than\n * `minChars`; each reader then checks that the range is its own.\n */\nexport function useSettledSelection({\n root,\n enabled = () => true,\n delay = 150,\n minChars = 2,\n}: UseSettledSelectionOptions) {\n const selection = shallowRef<SettledSelection | undefined>()\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const clear = () => {\n clearTimeout(timer)\n selection.value = undefined\n }\n\n const read = (): SettledSelection | undefined => {\n const node = root()\n if (!node || !enabled()) {\n return undefined\n }\n const range = rangeIn(node)\n if (\n !range ||\n range.collapsed ||\n range.toString().trim().length < minChars\n ) {\n return undefined\n }\n const box = range.getBoundingClientRect()\n return { range, start: range.getClientRects()[0] ?? box, box }\n }\n\n const onChange = () => {\n clear()\n timer = setTimeout(() => {\n selection.value = read()\n }, delay)\n }\n\n const finePointer =\n typeof document !== 'undefined' &&\n typeof matchMedia === 'function' &&\n matchMedia(FINE_POINTER).matches\n if (finePointer) {\n document.addEventListener('selectionchange', onChange)\n onScopeDispose(() => {\n clearTimeout(timer)\n document.removeEventListener('selectionchange', onChange)\n })\n }\n\n // Not `readonly()`: its deep proxy around a Range breaks the Range's methods\n const settled: Readonly<ShallowRef<SettledSelection | undefined>> =\n selection\n return { selection: settled, clear }\n}\n","import type {\n ChatFilePreview,\n SpreadsheetPreview,\n SpreadsheetPreviewSheet,\n WordPreview,\n WordPreviewBlock,\n WordPreviewCell,\n} from 'models'\n\n/**\n * What a version of a file changed from the one the viewer showed before it\n * (spec `chat-file-selection-edit.md`): the paragraphs of a Word document by\n * their ids in the new version, or the cells of each sheet, by its name, as\n * `row:col`. The viewer marks them for a moment when it follows an edit.\n */\nexport type ChatFilePreviewChanges =\n | { kind: 'word'; paragraphs: ReadonlySet<string> }\n | {\n kind: 'spreadsheet'\n cells: ReadonlyMap<string, ReadonlySet<string>>\n }\n\n/**\n * Past this many pairs the middle of the two lists is not aligned: all of\n * the new one there counts as changed. A thousand paragraphs each side.\n */\nconst MAX_ALIGNED_PAIRS = 1_000_000\n\n/**\n * The items of `after` that `before` does not hold in the same order, each\n * with the item of `before` it took the place of, if any: the one at the\n * same distance from the start of the stretch both lists differ in. The\n * common start and end are skipped, the middle is aligned by its longest\n * common subsequence.\n */\nexport const unmatchedItems = (\n before: readonly string[],\n after: readonly string[],\n): Map<number, number | undefined> => {\n let start = 0\n while (\n start < before.length &&\n start < after.length &&\n before[start] === after[start]\n ) {\n start += 1\n }\n let end = 0\n while (\n end < before.length - start &&\n end < after.length - start &&\n before[before.length - 1 - end] === after[after.length - 1 - end]\n ) {\n end += 1\n }\n const n = before.length - start - end\n const m = after.length - start - end\n const out = new Map<number, number | undefined>()\n // Each stretch between two kept items: its new items stand for its old\n // ones in order\n const gap = (i0: number, i1: number, j0: number, j1: number) => {\n for (let j = j0; j < j1; j++) {\n const i = i0 + (j - j0)\n out.set(j, i < i1 ? i : undefined)\n }\n }\n if (!m) {\n return out\n }\n if (!n || n * m > MAX_ALIGNED_PAIRS) {\n gap(start, start + n, start, start + m)\n return out\n }\n // lengths[i * (m + 1) + j]: the longest common subsequence of the old\n // middle from i and the new one from j\n const lengths = new Uint32Array((n + 1) * (m + 1))\n for (let i = n - 1; i >= 0; i--) {\n for (let j = m - 1; j >= 0; j--) {\n lengths[i * (m + 1) + j] =\n before[start + i] === after[start + j]\n ? lengths[(i + 1) * (m + 1) + j + 1] + 1\n : Math.max(\n lengths[(i + 1) * (m + 1) + j],\n lengths[i * (m + 1) + j + 1],\n )\n }\n }\n let i = 0\n let j = 0\n let i0 = 0\n let j0 = 0\n while (i < n && j < m) {\n if (before[start + i] === after[start + j]) {\n gap(start + i0, start + i, start + j0, start + j)\n i += 1\n j += 1\n i0 = i\n j0 = j\n } else if (\n lengths[(i + 1) * (m + 1) + j] >= lengths[i * (m + 1) + j + 1]\n ) {\n i += 1\n } else {\n j += 1\n }\n }\n gap(start + i0, start + n, start + j0, start + m)\n return out\n}\n\n/** A paragraph's id moves when one is added before it: it is not its content. */\nconst withoutIds = (key: string, value: unknown) =>\n key === 'id' || key === 'ids' ? undefined : value\n\nconst contentOf = (value: unknown) => JSON.stringify(value, withoutIds)\n\n/** The ids of a table's cells that differ from the table it took the place of. */\nconst changedCellIds = (\n after: WordPreviewBlock & { kind: 'table' },\n before: WordPreviewBlock | undefined,\n): string[] => {\n const idsOf = (cells: WordPreviewCell[]) =>\n cells.flatMap((c) => c.ids ?? [])\n if (before?.kind !== 'table') {\n return idsOf(after.rows.flat())\n }\n const rows = unmatchedItems(\n before.rows.map(contentOf),\n after.rows.map(contentOf),\n )\n return [...rows].flatMap(([r, was]) => {\n const old = was === undefined ? undefined : before.rows[was]\n return idsOf(\n after.rows[r].filter(\n (cell, c) => !old?.[c] || contentOf(old[c]) !== contentOf(cell),\n ),\n )\n })\n}\n\nconst wordChanges = (before: WordPreview, after: WordPreview) => {\n const paragraphs = new Set<string>()\n const blocks = unmatchedItems(\n before.blocks.map(contentOf),\n after.blocks.map(contentOf),\n )\n for (const [b, was] of blocks) {\n const block = after.blocks[b]\n if (block.kind === 'table') {\n const old = was === undefined ? undefined : before.blocks[was]\n for (const id of changedCellIds(block, old)) {\n paragraphs.add(id)\n }\n } else if (block.id) {\n paragraphs.add(block.id)\n }\n }\n return paragraphs\n}\n\n/**\n * A cell as it shows: its look and number format by what they are, as each\n * version numbers its own lists of them.\n */\nconst cellContents = (\n preview: SpreadsheetPreview,\n sheet: SpreadsheetPreviewSheet,\n) => {\n const out = new Map<string, string>()\n for (const r of sheet.rows) {\n for (const cell of r.cells) {\n out.set(\n `${r.row}:${cell.col}`,\n JSON.stringify({\n ...cell,\n style:\n cell.style === undefined\n ? undefined\n : preview.styles[cell.style],\n numFmt:\n cell.numFmt === undefined\n ? undefined\n : preview.numberFormats?.[cell.numFmt],\n }),\n )\n }\n }\n return out\n}\n\nconst spreadsheetChanges = (\n before: SpreadsheetPreview,\n after: SpreadsheetPreview,\n) => {\n const cells = new Map<string, ReadonlySet<string>>()\n for (const sheet of after.sheets) {\n const old = before.sheets.find((s) => s.name === sheet.name)\n const now = cellContents(after, sheet)\n const was = old ? cellContents(before, old) : new Map<string, string>()\n const changed = new Set<string>()\n for (const [at, content] of now) {\n if (was.get(at) !== content) {\n changed.add(at)\n }\n }\n // A cell emptied is gone from the new version's list\n for (const at of was.keys()) {\n if (!now.has(at)) {\n changed.add(at)\n }\n }\n if (changed.size) {\n cells.set(sheet.name, changed)\n }\n }\n return cells\n}\n\n/**\n * What `after` changed from `before`, two versions of the same file: none\n * when nothing the viewer draws differs, or the two are not of one format.\n */\nexport const chatFilePreviewChanges = (\n before: ChatFilePreview,\n after: ChatFilePreview,\n): ChatFilePreviewChanges | undefined => {\n if (before.kind === 'word' && after.kind === 'word') {\n const paragraphs = wordChanges(before, after)\n return paragraphs.size ? { kind: 'word', paragraphs } : undefined\n }\n if (before.kind === 'spreadsheet' && after.kind === 'spreadsheet') {\n const cells = spreadsheetChanges(before, after)\n return cells.size ? { kind: 'spreadsheet', cells } : undefined\n }\n return undefined\n}\n\n/**\n * Brings the first marked change into the middle of the viewer's own scroll\n * box, when it is not in sight already. Not `scrollIntoView`: it would scroll\n * the page around the viewer too. False while there is none drawn yet.\n */\nexport const revealFirstChange = (\n scroller: HTMLElement | null | undefined,\n selector: string,\n): boolean => {\n const el = scroller?.querySelector(selector)\n if (!scroller || !el) {\n return false\n }\n const box = scroller.getBoundingClientRect()\n const at = el.getBoundingClientRect()\n if (at.top < box.top || at.bottom > box.bottom) {\n scroller.scrollTop += at.top - box.top - (box.height - at.height) / 2\n }\n if (at.left < box.left || at.right > box.right) {\n scroller.scrollLeft += at.left - box.left - (box.width - at.width) / 2\n }\n return true\n}\n","<script setup lang=\"ts\">\n import { computed, nextTick, ref, useTemplateRef } from 'vue'\n import { useElementSize } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import { selectionBarPosition } from './utils'\n\n /**\n * The bar of actions on a selection (spec `selection-actions.md`, \"Cosa\n * è comune\"), on the page that embeds the widget and in the chat's file\n * viewer: the agent's actions, then \"Ask…\", which turns the bar into a\n * field. An action may ask for a word first (`asks`: \"Translate\" asks the\n * language). It sits above the start of the selection, below it without\n * room there (`selectionBarPosition`). Its buttons take no focus on a\n * click, so the selection stays and Cmd+C still copies it; the keyboard\n * reaches them with Tab.\n */\n\n export type SelectionBarAction = {\n id: string\n label: string\n /** The placeholder of a field the action opens before it is sent. */\n asks?: string\n }\n\n const props = defineProps<{\n actions: SelectionBarAction[]\n /** The selection, in the coordinates of the box the bar is positioned in. */\n anchor: {\n start: { top: number; left: number }\n bottom: number\n bounds: { top: number; left: number; width: number; height: number }\n }\n /** `fixed` over the page, `absolute` inside the file viewer. */\n strategy?: 'fixed' | 'absolute'\n /** A line before the actions: why some are missing. */\n hint?: string\n /** In place of the actions: why there are none, with `noteAction` to act on it. */\n note?: string\n noteAction?: string\n /** On a touch screen the bar goes below, away from the system's menu. */\n touch?: boolean\n }>()\n\n const emit = defineEmits<{\n action: [id: string, value?: string]\n ask: [text: string]\n note: []\n close: []\n }>()\n\n /** The field is open: the selection may move into it, and the bar stays. */\n const asking = defineModel<boolean>('asking', { default: false })\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const barEl = useTemplateRef<HTMLElement>('barEl')\n const inputEl = useTemplateRef<HTMLInputElement>('inputEl')\n const { width, height } = useElementSize(barEl, undefined, {\n box: 'border-box',\n })\n const position = computed(() =>\n selectionBarPosition({\n ...props.anchor,\n bar: { width: width.value, height: height.value },\n touch: props.touch,\n }),\n )\n\n /** The action whose field is open, or \"Ask…\" (no id). */\n const field = ref<{ id?: string; placeholder: string }>()\n const text = ref('')\n\n const openField = async (id: string | undefined, placeholder: string) => {\n field.value = { id, placeholder }\n text.value = ''\n asking.value = true\n await nextTick()\n inputEl.value?.focus()\n }\n const closeField = () => {\n field.value = undefined\n asking.value = false\n }\n\n const run = (action: SelectionBarAction) => {\n if (action.asks) {\n void openField(action.id, action.asks)\n } else {\n emit('action', action.id)\n }\n }\n\n const submit = () => {\n const value = text.value.trim()\n if (!value || !field.value) {\n return\n }\n if (field.value.id) {\n emit('action', field.value.id, value)\n } else {\n emit('ask', value)\n }\n closeField()\n }\n\n const onEscape = () => {\n if (field.value) {\n closeField()\n } else {\n emit('close')\n }\n }\n</script>\n\n<template>\n <div\n class=\"pk-selection-actions\"\n :class=\"{\n 'pk-selection-actions--fixed': strategy === 'fixed',\n 'pk-selection-actions--asking': !!field,\n }\"\n :style=\"{\n top: `${position.top}px`,\n left: `${position.left}px`,\n }\"\n @keydown.esc.stop=\"onEscape\">\n <form\n v-if=\"field\"\n ref=\"barEl\"\n class=\"pk-selection-actions__bar pk-selection-actions__bar--field\"\n @submit.prevent=\"submit\">\n <input\n ref=\"inputEl\"\n v-model=\"text\"\n class=\"pk-selection-actions__input\"\n type=\"text\"\n maxlength=\"500\"\n :placeholder=\"field.placeholder\"\n :aria-label=\"field.placeholder\" />\n <button\n type=\"submit\"\n class=\"pk-selection-actions__button pk-selection-actions__button--send\"\n :disabled=\"!text.trim()\">\n {{ $t('action.send') }}\n </button>\n </form>\n <div\n v-else\n ref=\"barEl\"\n class=\"pk-selection-actions__bar\"\n role=\"toolbar\"\n :aria-label=\"$t('selectionActions.label')\">\n <template v-if=\"note\">\n <span class=\"pk-selection-actions__text\">{{ note }}</span>\n <button\n v-if=\"noteAction\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"emit('note')\">\n {{ noteAction }}\n </button>\n </template>\n <template v-else>\n <span v-if=\"hint\" class=\"pk-selection-actions__text\">\n {{ hint }}\n </span>\n <button\n v-for=\"action in actions\"\n :key=\"action.id\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"run(action)\">\n {{ action.label }}\n </button>\n <button\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"\n openField(\n undefined,\n $t('selectionActions.askPlaceholder'),\n )\n \">\n {{ $t('selectionActions.ask') }}\n </button>\n </template>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-selection-actions {\n position: absolute;\n z-index: 10;\n\n // The widths go here: a box placed absolutely takes its width from\n // its content, so a percentage inside it measured the content, and\n // the field shrank to a few words. Here 100% is the box it is in.\n max-width: min(32rem, calc(100% - var(--spacing-16)));\n\n &--fixed {\n position: fixed;\n\n // Above the site's own layers, as the page pointer's bar\n z-index: 2147483647;\n }\n\n &--asking {\n width: min(var(--spacing-384), calc(100% - var(--spacing-16)));\n }\n\n // As the page pointer's bar: the theme's colors swapped, readable over\n // any page and any document\n &__bar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-4);\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-4);\n border-radius: var(--rounded-lg);\n background-color: var(--color-word-1);\n color: var(--color-surface);\n font-family: var(--font-sans);\n font-size: var(--text-14);\n font-weight: var(--font-medium);\n box-shadow: var(--shadow-lg);\n\n &--field {\n flex-wrap: nowrap;\n width: 100%;\n }\n }\n\n &__text {\n padding: 0 var(--spacing-8);\n opacity: 0.75;\n font-size: var(--text-12);\n font-weight: var(--font-normal);\n }\n\n &__button {\n flex-shrink: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-10);\n background-color: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-surface) 16%,\n transparent\n );\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-surface);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n\n &--send {\n background-color: var(--color-surface);\n color: var(--color-word-1);\n\n &:hover {\n background-color: var(--color-surface);\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: default;\n }\n }\n }\n\n &__input {\n flex: 1;\n min-width: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-8);\n background-color: color-mix(\n in srgb,\n var(--color-surface) 12%,\n transparent\n );\n color: inherit;\n font: inherit;\n font-weight: var(--font-normal);\n\n &::placeholder {\n color: inherit;\n opacity: 0.6;\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-surface);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, nextTick, ref, useTemplateRef } from 'vue'\n import { useElementSize } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import { selectionBarPosition } from './utils'\n\n /**\n * The bar of actions on a selection (spec `selection-actions.md`, \"Cosa\n * è comune\"), on the page that embeds the widget and in the chat's file\n * viewer: the agent's actions, then \"Ask…\", which turns the bar into a\n * field. An action may ask for a word first (`asks`: \"Translate\" asks the\n * language). It sits above the start of the selection, below it without\n * room there (`selectionBarPosition`). Its buttons take no focus on a\n * click, so the selection stays and Cmd+C still copies it; the keyboard\n * reaches them with Tab.\n */\n\n export type SelectionBarAction = {\n id: string\n label: string\n /** The placeholder of a field the action opens before it is sent. */\n asks?: string\n }\n\n const props = defineProps<{\n actions: SelectionBarAction[]\n /** The selection, in the coordinates of the box the bar is positioned in. */\n anchor: {\n start: { top: number; left: number }\n bottom: number\n bounds: { top: number; left: number; width: number; height: number }\n }\n /** `fixed` over the page, `absolute` inside the file viewer. */\n strategy?: 'fixed' | 'absolute'\n /** A line before the actions: why some are missing. */\n hint?: string\n /** In place of the actions: why there are none, with `noteAction` to act on it. */\n note?: string\n noteAction?: string\n /** On a touch screen the bar goes below, away from the system's menu. */\n touch?: boolean\n }>()\n\n const emit = defineEmits<{\n action: [id: string, value?: string]\n ask: [text: string]\n note: []\n close: []\n }>()\n\n /** The field is open: the selection may move into it, and the bar stays. */\n const asking = defineModel<boolean>('asking', { default: false })\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const barEl = useTemplateRef<HTMLElement>('barEl')\n const inputEl = useTemplateRef<HTMLInputElement>('inputEl')\n const { width, height } = useElementSize(barEl, undefined, {\n box: 'border-box',\n })\n const position = computed(() =>\n selectionBarPosition({\n ...props.anchor,\n bar: { width: width.value, height: height.value },\n touch: props.touch,\n }),\n )\n\n /** The action whose field is open, or \"Ask…\" (no id). */\n const field = ref<{ id?: string; placeholder: string }>()\n const text = ref('')\n\n const openField = async (id: string | undefined, placeholder: string) => {\n field.value = { id, placeholder }\n text.value = ''\n asking.value = true\n await nextTick()\n inputEl.value?.focus()\n }\n const closeField = () => {\n field.value = undefined\n asking.value = false\n }\n\n const run = (action: SelectionBarAction) => {\n if (action.asks) {\n void openField(action.id, action.asks)\n } else {\n emit('action', action.id)\n }\n }\n\n const submit = () => {\n const value = text.value.trim()\n if (!value || !field.value) {\n return\n }\n if (field.value.id) {\n emit('action', field.value.id, value)\n } else {\n emit('ask', value)\n }\n closeField()\n }\n\n const onEscape = () => {\n if (field.value) {\n closeField()\n } else {\n emit('close')\n }\n }\n</script>\n\n<template>\n <div\n class=\"pk-selection-actions\"\n :class=\"{\n 'pk-selection-actions--fixed': strategy === 'fixed',\n 'pk-selection-actions--asking': !!field,\n }\"\n :style=\"{\n top: `${position.top}px`,\n left: `${position.left}px`,\n }\"\n @keydown.esc.stop=\"onEscape\">\n <form\n v-if=\"field\"\n ref=\"barEl\"\n class=\"pk-selection-actions__bar pk-selection-actions__bar--field\"\n @submit.prevent=\"submit\">\n <input\n ref=\"inputEl\"\n v-model=\"text\"\n class=\"pk-selection-actions__input\"\n type=\"text\"\n maxlength=\"500\"\n :placeholder=\"field.placeholder\"\n :aria-label=\"field.placeholder\" />\n <button\n type=\"submit\"\n class=\"pk-selection-actions__button pk-selection-actions__button--send\"\n :disabled=\"!text.trim()\">\n {{ $t('action.send') }}\n </button>\n </form>\n <div\n v-else\n ref=\"barEl\"\n class=\"pk-selection-actions__bar\"\n role=\"toolbar\"\n :aria-label=\"$t('selectionActions.label')\">\n <template v-if=\"note\">\n <span class=\"pk-selection-actions__text\">{{ note }}</span>\n <button\n v-if=\"noteAction\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"emit('note')\">\n {{ noteAction }}\n </button>\n </template>\n <template v-else>\n <span v-if=\"hint\" class=\"pk-selection-actions__text\">\n {{ hint }}\n </span>\n <button\n v-for=\"action in actions\"\n :key=\"action.id\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"run(action)\">\n {{ action.label }}\n </button>\n <button\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"\n openField(\n undefined,\n $t('selectionActions.askPlaceholder'),\n )\n \">\n {{ $t('selectionActions.ask') }}\n </button>\n </template>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-selection-actions {\n position: absolute;\n z-index: 10;\n\n // The widths go here: a box placed absolutely takes its width from\n // its content, so a percentage inside it measured the content, and\n // the field shrank to a few words. Here 100% is the box it is in.\n max-width: min(32rem, calc(100% - var(--spacing-16)));\n\n &--fixed {\n position: fixed;\n\n // Above the site's own layers, as the page pointer's bar\n z-index: 2147483647;\n }\n\n &--asking {\n width: min(var(--spacing-384), calc(100% - var(--spacing-16)));\n }\n\n // As the page pointer's bar: the theme's colors swapped, readable over\n // any page and any document\n &__bar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-4);\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-4);\n border-radius: var(--rounded-lg);\n background-color: var(--color-word-1);\n color: var(--color-surface);\n font-family: var(--font-sans);\n font-size: var(--text-14);\n font-weight: var(--font-medium);\n box-shadow: var(--shadow-lg);\n\n &--field {\n flex-wrap: nowrap;\n width: 100%;\n }\n }\n\n &__text {\n padding: 0 var(--spacing-8);\n opacity: 0.75;\n font-size: var(--text-12);\n font-weight: var(--font-normal);\n }\n\n &__button {\n flex-shrink: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-10);\n background-color: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-surface) 16%,\n transparent\n );\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-surface);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n\n &--send {\n background-color: var(--color-surface);\n color: var(--color-word-1);\n\n &:hover {\n background-color: var(--color-surface);\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: default;\n }\n }\n }\n\n &__input {\n flex: 1;\n min-width: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-8);\n background-color: color-mix(\n in srgb,\n var(--color-surface) 12%,\n transparent\n );\n color: inherit;\n font: inherit;\n font-weight: var(--font-normal);\n\n &::placeholder {\n color: inherit;\n opacity: 0.6;\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-surface);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, nextTick, ref, useTemplateRef } from 'vue'\n import { useElementSize } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import { selectionBarPosition } from './utils'\n\n /**\n * The bar of actions on a selection (spec `selection-actions.md`, \"Cosa\n * è comune\"), on the page that embeds the widget and in the chat's file\n * viewer: the agent's actions, then \"Ask…\", which turns the bar into a\n * field. An action may ask for a word first (`asks`: \"Translate\" asks the\n * language). It sits above the start of the selection, below it without\n * room there (`selectionBarPosition`). Its buttons take no focus on a\n * click, so the selection stays and Cmd+C still copies it; the keyboard\n * reaches them with Tab.\n */\n\n export type SelectionBarAction = {\n id: string\n label: string\n /** The placeholder of a field the action opens before it is sent. */\n asks?: string\n }\n\n const props = defineProps<{\n actions: SelectionBarAction[]\n /** The selection, in the coordinates of the box the bar is positioned in. */\n anchor: {\n start: { top: number; left: number }\n bottom: number\n bounds: { top: number; left: number; width: number; height: number }\n }\n /** `fixed` over the page, `absolute` inside the file viewer. */\n strategy?: 'fixed' | 'absolute'\n /** A line before the actions: why some are missing. */\n hint?: string\n /** In place of the actions: why there are none, with `noteAction` to act on it. */\n note?: string\n noteAction?: string\n /** On a touch screen the bar goes below, away from the system's menu. */\n touch?: boolean\n }>()\n\n const emit = defineEmits<{\n action: [id: string, value?: string]\n ask: [text: string]\n note: []\n close: []\n }>()\n\n /** The field is open: the selection may move into it, and the bar stays. */\n const asking = defineModel<boolean>('asking', { default: false })\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const barEl = useTemplateRef<HTMLElement>('barEl')\n const inputEl = useTemplateRef<HTMLInputElement>('inputEl')\n const { width, height } = useElementSize(barEl, undefined, {\n box: 'border-box',\n })\n const position = computed(() =>\n selectionBarPosition({\n ...props.anchor,\n bar: { width: width.value, height: height.value },\n touch: props.touch,\n }),\n )\n\n /** The action whose field is open, or \"Ask…\" (no id). */\n const field = ref<{ id?: string; placeholder: string }>()\n const text = ref('')\n\n const openField = async (id: string | undefined, placeholder: string) => {\n field.value = { id, placeholder }\n text.value = ''\n asking.value = true\n await nextTick()\n inputEl.value?.focus()\n }\n const closeField = () => {\n field.value = undefined\n asking.value = false\n }\n\n const run = (action: SelectionBarAction) => {\n if (action.asks) {\n void openField(action.id, action.asks)\n } else {\n emit('action', action.id)\n }\n }\n\n const submit = () => {\n const value = text.value.trim()\n if (!value || !field.value) {\n return\n }\n if (field.value.id) {\n emit('action', field.value.id, value)\n } else {\n emit('ask', value)\n }\n closeField()\n }\n\n const onEscape = () => {\n if (field.value) {\n closeField()\n } else {\n emit('close')\n }\n }\n</script>\n\n<template>\n <div\n class=\"pk-selection-actions\"\n :class=\"{\n 'pk-selection-actions--fixed': strategy === 'fixed',\n 'pk-selection-actions--asking': !!field,\n }\"\n :style=\"{\n top: `${position.top}px`,\n left: `${position.left}px`,\n }\"\n @keydown.esc.stop=\"onEscape\">\n <form\n v-if=\"field\"\n ref=\"barEl\"\n class=\"pk-selection-actions__bar pk-selection-actions__bar--field\"\n @submit.prevent=\"submit\">\n <input\n ref=\"inputEl\"\n v-model=\"text\"\n class=\"pk-selection-actions__input\"\n type=\"text\"\n maxlength=\"500\"\n :placeholder=\"field.placeholder\"\n :aria-label=\"field.placeholder\" />\n <button\n type=\"submit\"\n class=\"pk-selection-actions__button pk-selection-actions__button--send\"\n :disabled=\"!text.trim()\">\n {{ $t('action.send') }}\n </button>\n </form>\n <div\n v-else\n ref=\"barEl\"\n class=\"pk-selection-actions__bar\"\n role=\"toolbar\"\n :aria-label=\"$t('selectionActions.label')\">\n <template v-if=\"note\">\n <span class=\"pk-selection-actions__text\">{{ note }}</span>\n <button\n v-if=\"noteAction\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"emit('note')\">\n {{ noteAction }}\n </button>\n </template>\n <template v-else>\n <span v-if=\"hint\" class=\"pk-selection-actions__text\">\n {{ hint }}\n </span>\n <button\n v-for=\"action in actions\"\n :key=\"action.id\"\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"run(action)\">\n {{ action.label }}\n </button>\n <button\n type=\"button\"\n class=\"pk-selection-actions__button\"\n @mousedown.prevent\n @click=\"\n openField(\n undefined,\n $t('selectionActions.askPlaceholder'),\n )\n \">\n {{ $t('selectionActions.ask') }}\n </button>\n </template>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-selection-actions {\n position: absolute;\n z-index: 10;\n\n // The widths go here: a box placed absolutely takes its width from\n // its content, so a percentage inside it measured the content, and\n // the field shrank to a few words. Here 100% is the box it is in.\n max-width: min(32rem, calc(100% - var(--spacing-16)));\n\n &--fixed {\n position: fixed;\n\n // Above the site's own layers, as the page pointer's bar\n z-index: 2147483647;\n }\n\n &--asking {\n width: min(var(--spacing-384), calc(100% - var(--spacing-16)));\n }\n\n // As the page pointer's bar: the theme's colors swapped, readable over\n // any page and any document\n &__bar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-4);\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-4);\n border-radius: var(--rounded-lg);\n background-color: var(--color-word-1);\n color: var(--color-surface);\n font-family: var(--font-sans);\n font-size: var(--text-14);\n font-weight: var(--font-medium);\n box-shadow: var(--shadow-lg);\n\n &--field {\n flex-wrap: nowrap;\n width: 100%;\n }\n }\n\n &__text {\n padding: 0 var(--spacing-8);\n opacity: 0.75;\n font-size: var(--text-12);\n font-weight: var(--font-normal);\n }\n\n &__button {\n flex-shrink: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-10);\n background-color: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-surface) 16%,\n transparent\n );\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-surface);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n\n &--send {\n background-color: var(--color-surface);\n color: var(--color-word-1);\n\n &:hover {\n background-color: var(--color-surface);\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: default;\n }\n }\n }\n\n &__input {\n flex: 1;\n min-width: 0;\n border: 0;\n border-radius: var(--rounded);\n padding: var(--spacing-6) var(--spacing-8);\n background-color: color-mix(\n in srgb,\n var(--color-surface) 12%,\n transparent\n );\n color: inherit;\n font: inherit;\n font-weight: var(--font-normal);\n\n &::placeholder {\n color: inherit;\n opacity: 0.6;\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--color-surface);\n outline-offset: calc(-1 * var(--spacing-2));\n }\n }\n }\n</style>\n"],"mappings":";;;;;;;AAuBA,IAAMgD,IAAe;AAiBrB,SAASC,EAAQ,GAAgD;CAC7D,IAAMC,IAAY,SAAS,aAAa;CACxC,IAAI,CAACA,KAAaA,EAAU,eAAe,GACvC;CAEJ,IAAIC,EAAK,aAAa,KAAK,eACvB,OAAOD,EAAU,WAAW,CAAC,CAAC,CAAC,WAAW;CAE9C,IAAME,IAASD;CACf,IAAID,EAAU,mBAAmB;EAC7B,IAAIG;EACJ,IAAI;GACA,IAASH,EAAU,kBAAkB,EAAE,aAAa,CAACE,CAAM,EAAE,CAAC;EAClE,QAAQ;GACJ,IAASF,EAAU,kBAAkBE,CAAM;EAC/C;EACA,IAAM,CAACE,KAASD;EAChB,IAAI,CAACC,GACD;EAEJ,IAAMC,IAAQ,SAA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