@8wave/ai-elements 0.125.0-beta.6 → 0.125.0-beta.8

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 (30) hide show
  1. package/dist/_chunks/Agent-DZhK49jg.js.map +1 -1
  2. package/dist/_chunks/PkToolShowCalendarEvent-DWtTo28t.js +148 -0
  3. package/dist/_chunks/PkToolShowCalendarEvent-DWtTo28t.js.map +1 -0
  4. package/dist/_chunks/{PkToolShowQrCode-e6DxEcWY.js → PkToolShowQrCode-DGMhVUbp.js} +28 -22
  5. package/dist/_chunks/PkToolShowQrCode-DGMhVUbp.js.map +1 -0
  6. package/dist/ai-elements.es.js +2 -2
  7. package/dist-vue/PkChatbot.js +1 -1
  8. package/dist-vue/PkChatbotMessages.js +1 -1
  9. package/dist-vue/PkChatbotViewChat.js +1 -1
  10. package/dist-vue/_chunks/Agent-BtXBSGy6.js.map +1 -1
  11. package/dist-vue/_chunks/{PkChatbot-Qrk8yEM0.js → PkChatbot-CLOfTLQy.js} +2 -2
  12. package/dist-vue/_chunks/{PkChatbot-Qrk8yEM0.js.map → PkChatbot-CLOfTLQy.js.map} +1 -1
  13. package/dist-vue/_chunks/{PkChatbotMessages-DAwGWRtd.js → PkChatbotMessages-BxkCGmqV.js} +3 -3
  14. package/dist-vue/_chunks/{PkChatbotMessages-DAwGWRtd.js.map → PkChatbotMessages-BxkCGmqV.js.map} +1 -1
  15. package/dist-vue/_chunks/{PkChatbotViewChat-CMFc4eLD.js → PkChatbotViewChat-BwXOt2WW.js} +2 -2
  16. package/dist-vue/_chunks/{PkChatbotViewChat-CMFc4eLD.js.map → PkChatbotViewChat-BwXOt2WW.js.map} +1 -1
  17. package/dist-vue/_chunks/PkToolShowCalendarEvent-CAejFLQI.js +148 -0
  18. package/dist-vue/_chunks/PkToolShowCalendarEvent-CAejFLQI.js.map +1 -0
  19. package/dist-vue/_chunks/PkToolShowQrCode-96KzD1rX.js +78 -0
  20. package/dist-vue/_chunks/PkToolShowQrCode-96KzD1rX.js.map +1 -0
  21. package/dist-vue/index.js +5 -5
  22. package/dist-vue/packages/models/src/schema/Agent.d.ts +9 -0
  23. package/package.json +1 -1
  24. package/dist/_chunks/PkToolShowCalendarEvent-mVY2FS24.js +0 -148
  25. package/dist/_chunks/PkToolShowCalendarEvent-mVY2FS24.js.map +0 -1
  26. package/dist/_chunks/PkToolShowQrCode-e6DxEcWY.js.map +0 -1
  27. package/dist-vue/_chunks/PkToolShowCalendarEvent-BsAOYLjp.js +0 -148
  28. package/dist-vue/_chunks/PkToolShowCalendarEvent-BsAOYLjp.js.map +0 -1
  29. package/dist-vue/_chunks/PkToolShowQrCode-skWaARYV.js +0 -72
  30. package/dist-vue/_chunks/PkToolShowQrCode-skWaARYV.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkToolShowQrCode-e6DxEcWY.js","names":["$t","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_withCtx","_unref","_createCommentVNode","_sfc_main","onMounted","createVNode","init_shared_esm_bundler","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","withCtx","createCommentVNode","defineComponent","unref","createElementBlock","openBlock","useClipboard","au","Ce","VvButtonLocalized","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","PkToolShowQrCode_default","props","__props","toolPart","svgContent","qrContainerRef","content","QRCode","downloadQr","svgEl","svgData","svgBlob","svgUrl","canvas","ctx","img","a","_component_VvIcon","_component_VvButton","_component_VvButtonGroup","_ctx","copied","_cache","copy"],"sources":["../../../../packages/components/src/chat/PkToolShowQrCode.vue","../../../../packages/components/src/chat/PkToolShowQrCode.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, onMounted } from 'vue'\n import { useClipboard } from '@vueuse/core'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n content: string\n label?: string\n }\n }\n return part\n })\n\n const svgContent = ref('')\n const qrContainerRef = ref<HTMLElement>()\n\n onMounted(async () => {\n const content = toolPart.value.input?.content\n if (!content) {\n return\n }\n const { default: QRCode } = await import('qrcode')\n svgContent.value = await QRCode.toString(content, { type: 'svg' })\n })\n\n const downloadQr = async () => {\n const svgEl = qrContainerRef.value?.querySelector('svg')\n if (!svgEl) {\n return\n }\n const svgData = new XMLSerializer().serializeToString(svgEl)\n const svgBlob = new Blob([svgData], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const svgUrl = URL.createObjectURL(svgBlob)\n\n const canvas = document.createElement('canvas')\n canvas.width = 512\n canvas.height = 512\n const ctx = canvas.getContext('2d')\n const img = new Image()\n img.onload = () => {\n ctx?.drawImage(img, 0, 0, 512, 512)\n URL.revokeObjectURL(svgUrl)\n const a = document.createElement('a')\n a.href = canvas.toDataURL('image/png')\n a.download = 'qrcode.png'\n a.click()\n }\n img.src = svgUrl\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:qr-code-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.qrCode') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copy(toolPart?.input?.content ?? '')\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadQr\" />\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex flex-col items-center\">\n <div ref=\"qrContainerRef\" class=\"w-144 h-144\" v-html=\"svgContent\" />\n <p\n v-if=\"toolPart.input.label\"\n class=\"text-12 text-word-3 text-center\">\n {{ toolPart.input.label }}\n </p>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, onMounted } from 'vue'\n import { useClipboard } from '@vueuse/core'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n content: string\n label?: string\n }\n }\n return part\n })\n\n const svgContent = ref('')\n const qrContainerRef = ref<HTMLElement>()\n\n onMounted(async () => {\n const content = toolPart.value.input?.content\n if (!content) {\n return\n }\n const { default: QRCode } = await import('qrcode')\n svgContent.value = await QRCode.toString(content, { type: 'svg' })\n })\n\n const downloadQr = async () => {\n const svgEl = qrContainerRef.value?.querySelector('svg')\n if (!svgEl) {\n return\n }\n const svgData = new XMLSerializer().serializeToString(svgEl)\n const svgBlob = new Blob([svgData], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const svgUrl = URL.createObjectURL(svgBlob)\n\n const canvas = document.createElement('canvas')\n canvas.width = 512\n canvas.height = 512\n const ctx = canvas.getContext('2d')\n const img = new Image()\n img.onload = () => {\n ctx?.drawImage(img, 0, 0, 512, 512)\n URL.revokeObjectURL(svgUrl)\n const a = document.createElement('a')\n a.href = canvas.toDataURL('image/png')\n a.download = 'qrcode.png'\n a.click()\n }\n img.src = svgUrl\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:qr-code-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.qrCode') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copy(toolPart?.input?.content ?? '')\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadQr\" />\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex flex-col items-center\">\n <div ref=\"qrContainerRef\" class=\"w-144 h-144\" v-html=\"svgContent\" />\n <p\n v-if=\"toolPart.input.label\"\n class=\"text-12 text-word-3 text-center\">\n {{ toolPart.input.label }}\n </p>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAII,IAAMuC,IAAQC,GAIR,EAAE,SAAM,cAAWZ,EAAa,GAEhCa,IAAWvB,QACAqB,EAAM,IAOtB,GAEKG,IAAazB,EAAI,EAAE,GACnB0B,IAAiB1B,EAAiB;EAExC,EAAU,YAAY;GAClB,IAAM2B,IAAUH,EAAS,MAAM,OAAO;GACtC,IAAI,CAACG,GACD;GAEJ,IAAM,EAAE,SAASC,MAAW,MAAM,OAAO;GACzC,EAAW,QAAQ,MAAMA,EAAO,SAASD,GAAS,EAAE,MAAM,MAAM,CAAC;EACrE,CAAC;EAED,IAAME,IAAa,YAAY;GAC3B,IAAMC,IAAQJ,EAAe,OAAO,cAAc,KAAK;GACvD,IAAI,CAACI,GACD;GAEJ,IAAMC,IAAU,IAAI,cAAc,CAAC,CAAC,kBAAkBD,CAAK,GACrDE,IAAU,IAAI,KAAK,CAACD,CAAO,GAAG,EAChC,MAAM,8BACV,CAAC,GACKE,IAAS,IAAI,gBAAgBD,CAAO,GAEpCE,IAAS,SAAS,cAAc,QAAQ;GAE9C,AADA,EAAO,QAAQ,KACf,EAAO,SAAS;GAChB,IAAMC,IAAMD,EAAO,WAAW,IAAI,GAC5BE,IAAM,IAAI,MAAM;GAStB,AARA,EAAI,eAAe;IAEf,AADAD,GAAK,UAAUC,GAAK,GAAG,GAAG,KAAK,GAAG,GAClC,IAAI,gBAAgBH,CAAM;IAC1B,IAAMI,IAAI,SAAS,cAAc,GAAG;IAGpC,AAFA,EAAE,OAAOH,EAAO,UAAU,WAAW,GACrC,EAAE,WAAW,cACbG,EAAE,MAAM;GACZ,GACA,EAAI,MAAMJ;EACd;;;GAKU,OAAAT,EAAA,OAAU,SADpBrC,EAAA,GAAAC,EA4BM,OA5BN2B,GA4BM,CAzBF1B,EAgBM,OAhBN2B,GAgBM;IAdF1B,EAAiDgD,GAAA;KAAzC,MAAK;KAAkB,OAAM;;IACrCjD,EAA2D,UAA3D4B,GAA2D1B,EAA9BR,EAAAA,GAAE,cAAA,CAAA,GAAA,CAAA;IAC/BO,EAWgBkD,GAAA;KAXD,WAAU;KAAU,OAAM;;KACrC,SAAAhD,QAIoD,CAJpDF,EAIoDiD,GAAA;MAHhD,WAAU;MACT,MAAM9C,EAAAiD,CAAA,IAAM,kBAAA;MACZ,OAAOjD,EAAAiD,CAAA,IAAS3D,EAAAA,GAAE,eAAA,IAAoBA,EAAAA,GAAE,aAAA;MACxC,SAAK,AAAA4D,EAAA,QAAA,MAAElD,EAAAmD,CAAA,CAAI,CAACpB,EAAA,OAAU,OAAO,WAAO,EAAA;K,gCACzClC,EAI0BiD,GAAA;MAHtB,WAAU;MACV,MAAK;MACJ,OAAOxD,EAAAA,GAAE,iBAAA;MACT,SAAO8C;;;;G,IAGpBxC,EAOM,OAPN6B,GAOM,CANF7B,EAAoE,OAAA;IAA3D,SAAA;IAAJ,KAAIqC;IAAiB,OAAM;IAAc,WAAQD,EAAA;G,gBAE5CD,EAAA,MAAS,MAAM,SADzBrC,EAAA,GAAAC,EAII,KAJJgC,GAII7B,EADGiC,EAAA,MAAS,MAAM,KAAK,GAAA,CAAA,K"}
@@ -1,148 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
- import { t } from "./VvButtonLocalized-C-vx25u4.js";
3
- import "./src-nb8MU1sh.js";
4
- import { n } from "./url-validation-CJV9pp4v.js";
5
- import { VvButtonGroup as r, VvDropdown as i, VvDropdownAction as a, VvIcon as o } from "@volverjs/ui-vue/components";
6
- import { computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, guardReactiveProps as m, normalizeProps as h, openBlock as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
7
- import { useI18n as b } from "vue-i18n";
8
- import { useClipboard as x } from "@vueuse/core";
9
- // ../../packages/components/src/chat/PkToolShowCalendarEvent.vue?vue&type=script&setup=true&lang.ts
10
- var S = {
11
- key: 0,
12
- class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-surface"
13
- }, C = { class: "px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8" }, w = { class: "font-bold" }, T = { class: "p-sm flex gap-sm items-start" }, E = { class: "shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center" }, D = { class: "bg-brand px-8 py-2 text-brand-contrast text-10 font-bold uppercase tracking-wide" }, O = { class: "bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none" }, k = { class: "flex flex-col gap-4 min-w-0" }, A = { class: "font-semibold text-word-1 text-14" }, j = { class: "flex items-center gap-8 text-12 text-word-3" }, M = ["datetime"], N = {
14
- key: 0,
15
- class: "flex items-center gap-8 text-12 text-word-3"
16
- }, P = [
17
- "href",
18
- "target",
19
- "rel"
20
- ], F = { key: 1 }, I = {
21
- key: 1,
22
- class: "flex items-start gap-8 text-12 text-word-3"
23
- }, L = /*@__PURE__*/ p({
24
- __name: "PkToolShowCalendarEvent",
25
- props: { part: {} },
26
- setup(e) {
27
- let p = e, { copy: L, copied: R } = x(), { d: z } = b(), B = s(() => p.part), V = s(() => {
28
- let e = B.value.input;
29
- if (!e) return "";
30
- let { startDate: t, endDate: n, allDay: r } = e, i = new Date(t), a = new Date(n), o = t.slice(0, 10), s = n.slice(0, 10);
31
- return r ? o === s ? z(i, "date-medium") : `${z(i, "date-medium")} - ${z(a, "date-medium")}` : o === s ? `${z(i, "date-time-medium")} - ${z(a, "time")}` : `${z(i, "date-time-medium")} - ${z(a, "date-time-medium")}`;
32
- }), H = s(() => B.value.input ? new Date(B.value.input.startDate) : null), U = s(() => H.value?.getDate().toString() ?? ""), W = s(() => H.value ? z(H.value, "month-short") : ""), G = (e) => e.replace(/[-:]/g, "").replace(/\.\d{3}$/, ""), K = (e) => e.replace(/\\/g, "\\\\").replace(/;/g, "\\;").replace(/,/g, "\\,").replace(/\n/g, "\\n"), q = () => {
33
- let e = B.value.input;
34
- if (!e) return;
35
- let { title: t, startDate: n, endDate: r, location: i, additionalInfo: a } = e, o = [
36
- "BEGIN:VCALENDAR",
37
- "VERSION:2.0",
38
- "PRODID:-//8wave//8bot//EN",
39
- "BEGIN:VEVENT",
40
- `DTSTART:${G(n)}`,
41
- `DTEND:${G(r)}`,
42
- `SUMMARY:${K(t)}`,
43
- i ? `LOCATION:${K(i)}` : "",
44
- a ? `DESCRIPTION:${K(a)}` : "",
45
- `DTSTAMP:${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "")}`,
46
- `UID:${crypto.randomUUID()}@8bot.ai`,
47
- "END:VEVENT",
48
- "END:VCALENDAR"
49
- ].filter(Boolean).join("\r\n"), s = new Blob([o], { type: "text/calendar;charset=utf-8" }), c = URL.createObjectURL(s), l = document.createElement("a");
50
- l.href = c, l.download = `${t.replace(/[^a-zA-Z0-9\s-]/g, "")}.ics`, l.click(), URL.revokeObjectURL(c);
51
- }, J = () => {
52
- let e = B.value.input;
53
- if (!e) return;
54
- let { title: t, startDate: n, endDate: r, location: i, additionalInfo: a } = e, o = G(n), s = G(r), c = new URLSearchParams({
55
- action: "TEMPLATE",
56
- text: t,
57
- dates: `${o}/${s}`
58
- });
59
- i && c.set("location", i), a && c.set("details", a), window.open(`https://calendar.google.com/calendar/render?${c.toString()}`, "_blank");
60
- }, Y = () => {
61
- let e = B.value.input;
62
- if (!e) return;
63
- let { title: t, startDate: n, endDate: r, location: i, additionalInfo: a } = e, o = new URLSearchParams({
64
- subject: t,
65
- startdt: n,
66
- enddt: r
67
- });
68
- i && o.set("location", i), a && o.set("body", a), window.open(`https://outlook.office.com/calendar/0/action/compose?${o.toString()}`, "_blank");
69
- }, X = () => {
70
- let e = B.value.input;
71
- if (!e) return;
72
- let t = [e.title, V.value];
73
- e.location && t.push(e.location), e.additionalInfo && t.push(e.additionalInfo), L(t.join("\n"));
74
- };
75
- return (e, s) => {
76
- let p = o, b = t, x = a, L = i, z = r;
77
- return B.value?.input ? (g(), l("div", S, [u("div", C, [
78
- f(p, {
79
- name: "ri:calendar-event-line",
80
- class: "text-16"
81
- }),
82
- u("strong", w, _(e.$t("label.calendarEvent")), 1),
83
- f(z, {
84
- modifiers: "compact",
85
- class: "ml-auto shrink-0"
86
- }, {
87
- default: y(() => [f(b, {
88
- modifiers: "action-quiet-small",
89
- icon: v(R) ? "ri:check-line" : "ri:file-copy-line",
90
- label: v(R) ? e.$t("action.copied") : e.$t("action.copy"),
91
- onClick: X
92
- }, null, 8, ["icon", "label"]), f(L, h(m({
93
- placement: "bottom-end",
94
- modifiers: "menu",
95
- flip: !0,
96
- offset: 3,
97
- strategy: "fixed"
98
- })), {
99
- items: y(() => [
100
- f(x, { onClick: J }, {
101
- default: y(() => [f(p, { name: "ri:google-line" }), s[0] ||= d(" Google Calendar ", -1)]),
102
- _: 1
103
- }),
104
- f(x, { onClick: Y }, {
105
- default: y(() => [f(p, { name: "ri:microsoft-line" }), s[1] ||= d(" Outlook ", -1)]),
106
- _: 1
107
- }),
108
- f(x, { onClick: q }, {
109
- default: y(() => [f(p, { name: "ri:download-line" }), d(" " + _(e.$t("action.downloadIcs")), 1)]),
110
- _: 1
111
- })
112
- ]),
113
- default: y(() => [f(b, {
114
- icon: "ri:calendar-line",
115
- modifiers: "action-quiet-small",
116
- label: e.$t("action.addToCalendar")
117
- }, null, 8, ["label"])]),
118
- _: 1
119
- }, 16)]),
120
- _: 1
121
- })
122
- ]), u("div", T, [u("div", E, [u("div", D, _(W.value), 1), u("div", O, _(U.value), 1)]), u("div", k, [
123
- u("p", A, _(B.value.input.title), 1),
124
- u("div", j, [f(p, {
125
- name: "ri:time-line",
126
- class: "text-14 shrink-0"
127
- }), u("time", { datetime: B.value.input.startDate }, _(V.value), 9, M)]),
128
- B.value.input.location ? (g(), l("div", N, [f(p, {
129
- name: "ri:map-pin-line",
130
- class: "text-14 shrink-0"
131
- }), B.value.input.location.startsWith("http") ? (g(), l("a", {
132
- key: 0,
133
- href: B.value.input.location,
134
- target: v(n)(B.value.input.location) ? void 0 : "_blank",
135
- rel: v(n)(B.value.input.location) ? void 0 : "noopener noreferrer",
136
- class: "underline truncate"
137
- }, _(B.value.input.location), 9, P)) : (g(), l("span", F, _(B.value.input.location), 1))])) : c("", !0),
138
- B.value.input.additionalInfo ? (g(), l("div", I, [f(p, {
139
- name: "ri:sticky-note-line",
140
- class: "text-14 shrink-0 mt-1"
141
- }), u("span", null, _(B.value.input.additionalInfo), 1)])) : c("", !0)
142
- ])])])) : c("", !0);
143
- };
144
- }
145
- }), R = /* @__PURE__ */ e({ default: () => z }), z = L;
146
- export { R as n, z as t };
147
-
148
- //# sourceMappingURL=PkToolShowCalendarEvent-BsAOYLjp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkToolShowCalendarEvent-BsAOYLjp.js","names":["$t","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","__unplugin_components_4","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_withCtx","_unref","_normalizeProps","_guardReactiveProps","_createTextVNode","_createCommentVNode","_sfc_main","__exportAll","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","PkToolShowCalendarEvent_vue_vue_type_script_setup_true_lang_default","props","__props","useClipboard","useI18n","toolPart","computed","dateDisplay","input","start","startDate","end","endDate","startDay","endDay","allDay","d","calendarStart","calendarDay","calendarMonth","toIcsDateTime","iso","escapeIcs","str","generateIcs","ics","title","location","additionalInfo","blob","url","a","openGoogleCalendar","params","openOutlook","copyEvent","lines","copy","_component_VvIcon","VvIcon","_component_VvButton","VvButtonLocalized","_component_VvDropdownAction","VvDropdownAction","_component_VvDropdown","VvDropdown","_component_VvButtonGroup","VvButtonGroup","openBlock","createElementBlock","createElementVNode","createVNode","toDisplayString","_ctx","withCtx","unref","copied","normalizeProps","guardReactiveProps","_cache","createTextVNode","isSameSite","createCommentVNode","PkToolShowCalendarEvent_exports","PkToolShowCalendarEvent_default"],"sources":["../../../../packages/components/src/chat/PkToolShowCalendarEvent.vue","../../../../packages/components/src/chat/PkToolShowCalendarEvent.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useClipboard } from '@vueuse/core'\n import { isSameSite } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n const { d } = useI18n()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n startDate: string\n endDate: string\n location?: string\n additionalInfo?: string\n allDay?: boolean\n }\n }\n return part\n })\n\n const dateDisplay = computed(() => {\n const input = toolPart.value.input\n if (!input) {\n return ''\n }\n const { startDate, endDate, allDay } = input\n const start = new Date(startDate)\n const end = new Date(endDate)\n const startDay = startDate.slice(0, 10)\n const endDay = endDate.slice(0, 10)\n if (allDay) {\n if (startDay === endDay) {\n return d(start, 'date-medium')\n }\n return `${d(start, 'date-medium')} - ${d(end, 'date-medium')}`\n }\n if (startDay === endDay) {\n return `${d(start, 'date-time-medium')} - ${d(end, 'time')}`\n }\n return `${d(start, 'date-time-medium')} - ${d(end, 'date-time-medium')}`\n })\n\n const calendarStart = computed(() =>\n toolPart.value.input ? new Date(toolPart.value.input.startDate) : null,\n )\n\n const calendarDay = computed(\n () => calendarStart.value?.getDate().toString() ?? '',\n )\n\n const calendarMonth = computed(() =>\n calendarStart.value ? d(calendarStart.value, 'month-short') : '',\n )\n\n // Floating time: remove dashes/colons without converting to UTC\n const toIcsDateTime = (iso: string) =>\n iso.replace(/[-:]/g, '').replace(/\\.\\d{3}$/, '')\n\n const escapeIcs = (str: string) =>\n str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/;/g, '\\\\;')\n .replace(/,/g, '\\\\,')\n .replace(/\\n/g, '\\\\n')\n\n const generateIcs = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const ics = [\n 'BEGIN:VCALENDAR',\n 'VERSION:2.0',\n 'PRODID:-//8wave//8bot//EN',\n 'BEGIN:VEVENT',\n `DTSTART:${toIcsDateTime(startDate)}`,\n `DTEND:${toIcsDateTime(endDate)}`,\n `SUMMARY:${escapeIcs(title)}`,\n location ? `LOCATION:${escapeIcs(location)}` : '',\n additionalInfo ? `DESCRIPTION:${escapeIcs(additionalInfo)}` : '',\n `DTSTAMP:${new Date()\n .toISOString()\n .replace(/[-:]/g, '')\n .replace(/\\.\\d{3}/, '')}`,\n `UID:${crypto.randomUUID()}@8bot.ai`,\n 'END:VEVENT',\n 'END:VCALENDAR',\n ]\n .filter(Boolean)\n .join('\\r\\n')\n\n const blob = new Blob([ics], { type: 'text/calendar;charset=utf-8' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = `${title.replace(/[^a-zA-Z0-9\\s-]/g, '')}.ics`\n a.click()\n URL.revokeObjectURL(url)\n }\n\n const openGoogleCalendar = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const start = toIcsDateTime(startDate)\n const end = toIcsDateTime(endDate)\n const params = new URLSearchParams({\n action: 'TEMPLATE',\n text: title,\n dates: `${start}/${end}`,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('details', additionalInfo)\n }\n window.open(\n `https://calendar.google.com/calendar/render?${params.toString()}`,\n '_blank',\n )\n }\n\n const openOutlook = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const params = new URLSearchParams({\n subject: title,\n startdt: startDate,\n enddt: endDate,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('body', additionalInfo)\n }\n window.open(\n `https://outlook.office.com/calendar/0/action/compose?${params.toString()}`,\n '_blank',\n )\n }\n\n const copyEvent = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const lines = [input.title, dateDisplay.value]\n if (input.location) {\n lines.push(input.location)\n }\n if (input.additionalInfo) {\n lines.push(input.additionalInfo)\n }\n copy(lines.join('\\n'))\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:calendar-event-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.calendarEvent') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyEvent\" />\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:calendar-line\"\n modifiers=\"action-quiet-small\"\n :label=\"$t('action.addToCalendar')\" />\n <template #items>\n <VvDropdownAction @click=\"openGoogleCalendar\">\n <VvIcon name=\"ri:google-line\" />\n Google Calendar\n </VvDropdownAction>\n <VvDropdownAction @click=\"openOutlook\">\n <VvIcon name=\"ri:microsoft-line\" />\n Outlook\n </VvDropdownAction>\n <VvDropdownAction @click=\"generateIcs\">\n <VvIcon name=\"ri:download-line\" />\n {{ $t('action.downloadIcs') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex gap-sm items-start\">\n <div\n class=\"shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center\">\n <div\n class=\"bg-brand px-8 py-2 text-brand-contrast text-10 font-bold uppercase tracking-wide\">\n {{ calendarMonth }}\n </div>\n <div\n class=\"bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none\">\n {{ calendarDay }}\n </div>\n </div>\n <div class=\"flex flex-col gap-4 min-w-0\">\n <p class=\"font-semibold text-word-1 text-14\">\n {{ toolPart.input.title }}\n </p>\n <div class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:time-line\" class=\"text-14 shrink-0\" />\n <time :datetime=\"toolPart.input.startDate\">{{\n dateDisplay\n }}</time>\n </div>\n <div\n v-if=\"toolPart.input.location\"\n class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-14 shrink-0\" />\n <a\n v-if=\"toolPart.input.location.startsWith('http')\"\n :href=\"toolPart.input.location\"\n :target=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : '_blank'\n \"\n :rel=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : 'noopener noreferrer'\n \"\n class=\"underline truncate\">\n {{ toolPart.input.location }}\n </a>\n <span v-else>{{ toolPart.input.location }}</span>\n </div>\n <div\n v-if=\"toolPart.input.additionalInfo\"\n class=\"flex items-start gap-8 text-12 text-word-3\">\n <VvIcon\n name=\"ri:sticky-note-line\"\n class=\"text-14 shrink-0 mt-1\" />\n <span>{{ toolPart.input.additionalInfo }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useClipboard } from '@vueuse/core'\n import { isSameSite } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n const { d } = useI18n()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n startDate: string\n endDate: string\n location?: string\n additionalInfo?: string\n allDay?: boolean\n }\n }\n return part\n })\n\n const dateDisplay = computed(() => {\n const input = toolPart.value.input\n if (!input) {\n return ''\n }\n const { startDate, endDate, allDay } = input\n const start = new Date(startDate)\n const end = new Date(endDate)\n const startDay = startDate.slice(0, 10)\n const endDay = endDate.slice(0, 10)\n if (allDay) {\n if (startDay === endDay) {\n return d(start, 'date-medium')\n }\n return `${d(start, 'date-medium')} - ${d(end, 'date-medium')}`\n }\n if (startDay === endDay) {\n return `${d(start, 'date-time-medium')} - ${d(end, 'time')}`\n }\n return `${d(start, 'date-time-medium')} - ${d(end, 'date-time-medium')}`\n })\n\n const calendarStart = computed(() =>\n toolPart.value.input ? new Date(toolPart.value.input.startDate) : null,\n )\n\n const calendarDay = computed(\n () => calendarStart.value?.getDate().toString() ?? '',\n )\n\n const calendarMonth = computed(() =>\n calendarStart.value ? d(calendarStart.value, 'month-short') : '',\n )\n\n // Floating time: remove dashes/colons without converting to UTC\n const toIcsDateTime = (iso: string) =>\n iso.replace(/[-:]/g, '').replace(/\\.\\d{3}$/, '')\n\n const escapeIcs = (str: string) =>\n str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/;/g, '\\\\;')\n .replace(/,/g, '\\\\,')\n .replace(/\\n/g, '\\\\n')\n\n const generateIcs = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const ics = [\n 'BEGIN:VCALENDAR',\n 'VERSION:2.0',\n 'PRODID:-//8wave//8bot//EN',\n 'BEGIN:VEVENT',\n `DTSTART:${toIcsDateTime(startDate)}`,\n `DTEND:${toIcsDateTime(endDate)}`,\n `SUMMARY:${escapeIcs(title)}`,\n location ? `LOCATION:${escapeIcs(location)}` : '',\n additionalInfo ? `DESCRIPTION:${escapeIcs(additionalInfo)}` : '',\n `DTSTAMP:${new Date()\n .toISOString()\n .replace(/[-:]/g, '')\n .replace(/\\.\\d{3}/, '')}`,\n `UID:${crypto.randomUUID()}@8bot.ai`,\n 'END:VEVENT',\n 'END:VCALENDAR',\n ]\n .filter(Boolean)\n .join('\\r\\n')\n\n const blob = new Blob([ics], { type: 'text/calendar;charset=utf-8' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = `${title.replace(/[^a-zA-Z0-9\\s-]/g, '')}.ics`\n a.click()\n URL.revokeObjectURL(url)\n }\n\n const openGoogleCalendar = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const start = toIcsDateTime(startDate)\n const end = toIcsDateTime(endDate)\n const params = new URLSearchParams({\n action: 'TEMPLATE',\n text: title,\n dates: `${start}/${end}`,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('details', additionalInfo)\n }\n window.open(\n `https://calendar.google.com/calendar/render?${params.toString()}`,\n '_blank',\n )\n }\n\n const openOutlook = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const { title, startDate, endDate, location, additionalInfo } = input\n const params = new URLSearchParams({\n subject: title,\n startdt: startDate,\n enddt: endDate,\n })\n if (location) {\n params.set('location', location)\n }\n if (additionalInfo) {\n params.set('body', additionalInfo)\n }\n window.open(\n `https://outlook.office.com/calendar/0/action/compose?${params.toString()}`,\n '_blank',\n )\n }\n\n const copyEvent = () => {\n const input = toolPart.value.input\n if (!input) {\n return\n }\n const lines = [input.title, dateDisplay.value]\n if (input.location) {\n lines.push(input.location)\n }\n if (input.additionalInfo) {\n lines.push(input.additionalInfo)\n }\n copy(lines.join('\\n'))\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:calendar-event-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.calendarEvent') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copyEvent\" />\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:calendar-line\"\n modifiers=\"action-quiet-small\"\n :label=\"$t('action.addToCalendar')\" />\n <template #items>\n <VvDropdownAction @click=\"openGoogleCalendar\">\n <VvIcon name=\"ri:google-line\" />\n Google Calendar\n </VvDropdownAction>\n <VvDropdownAction @click=\"openOutlook\">\n <VvIcon name=\"ri:microsoft-line\" />\n Outlook\n </VvDropdownAction>\n <VvDropdownAction @click=\"generateIcs\">\n <VvIcon name=\"ri:download-line\" />\n {{ $t('action.downloadIcs') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex gap-sm items-start\">\n <div\n class=\"shrink-0 w-44 rounded-xl overflow-hidden border border-surface-3 text-center\">\n <div\n class=\"bg-brand px-8 py-2 text-brand-contrast text-10 font-bold uppercase tracking-wide\">\n {{ calendarMonth }}\n </div>\n <div\n class=\"bg-surface-1 py-4 text-word-1 text-24 font-bold leading-none\">\n {{ calendarDay }}\n </div>\n </div>\n <div class=\"flex flex-col gap-4 min-w-0\">\n <p class=\"font-semibold text-word-1 text-14\">\n {{ toolPart.input.title }}\n </p>\n <div class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:time-line\" class=\"text-14 shrink-0\" />\n <time :datetime=\"toolPart.input.startDate\">{{\n dateDisplay\n }}</time>\n </div>\n <div\n v-if=\"toolPart.input.location\"\n class=\"flex items-center gap-8 text-12 text-word-3\">\n <VvIcon name=\"ri:map-pin-line\" class=\"text-14 shrink-0\" />\n <a\n v-if=\"toolPart.input.location.startsWith('http')\"\n :href=\"toolPart.input.location\"\n :target=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : '_blank'\n \"\n :rel=\"\n isSameSite(toolPart.input.location)\n ? undefined\n : 'noopener noreferrer'\n \"\n class=\"underline truncate\">\n {{ toolPart.input.location }}\n </a>\n <span v-else>{{ toolPart.input.location }}</span>\n </div>\n <div\n v-if=\"toolPart.input.additionalInfo\"\n class=\"flex items-start gap-8 text-12 text-word-3\">\n <VvIcon\n name=\"ri:sticky-note-line\"\n class=\"text-14 shrink-0 mt-1\" />\n <span>{{ toolPart.input.additionalInfo }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAMI,IAAMmC,IAAQC,GAIR,EAAE,SAAM,cAAWC,EAAa,GAChC,EAAE,SAAMC,EAAQ,GAEhBC,IAAWC,QACAL,EAAM,IAWtB,GAEKM,IAAcD,QAAe;GAC/B,IAAME,IAAQH,EAAS,MAAM;GAC7B,IAAI,CAACG,GACD,OAAO;GAEX,IAAM,EAAE,cAAW,YAAS,cAAWA,GACjCC,IAAQ,IAAI,KAAKC,CAAS,GAC1BC,IAAM,IAAI,KAAKC,CAAO,GACtBC,IAAWH,EAAU,MAAM,GAAG,EAAE,GAChCI,IAASF,EAAQ,MAAM,GAAG,EAAE;GAUlC,OATIG,IACIF,MAAaC,IACNE,EAAEP,GAAO,aAAa,IAE1B,GAAGO,EAAEP,GAAO,aAAa,EAAE,KAAKO,EAAEL,GAAK,aAAa,MAE3DE,MAAaC,IACN,GAAGE,EAAEP,GAAO,kBAAkB,EAAE,KAAKO,EAAEL,GAAK,MAAM,MAEtD,GAAGK,EAAEP,GAAO,kBAAkB,EAAE,KAAKO,EAAEL,GAAK,kBAAkB;EACzE,CAAC,GAEKM,IAAgBX,QAClBD,EAAS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tB5C,EAwCM,OAxCNkB,GAwCM;IAvCFlB,EAEI,KAFJmB,GAEIjB,EADG6B,EAAA,MAAS,MAAM,KAAK,GAAA,CAAA;IAE3B/B,EAKM,OALNoB,GAKM,CAJFnB,EAAuD+D,GAAA;KAA/C,MAAK;KAAe,OAAM;I,IAClChE,EAES,QAAA,EAFF,UAAU+B,EAAA,MAAS,MAAM,UAC5B,GAAA7B,EAAA+B,EAAA,KAAW,GAAA,GAAAZ,CAAA,C;IAITU,EAAA,MAAS,MAAM,YADzBjC,EAAA,GAAAC,EAqBM,OArBNuB,GAqBM,CAlBFrB,EAA0D+D,GAAA;KAAlD,MAAK;KAAkB,OAAM;I,IAE3BjC,EAAA,MAAS,MAAM,SAAS,WAAU,MAAA,KAD5CjC,EAAA,GAAAC,EAeI,KAAA;;KAbC,MAAMgC,EAAA,MAAS,MAAM;KACrB,QAAqC3B,EAAAmF,CAAA,CAAU,CAACxD,EAAA,MAAS,MAAM,QAAQ,IAAoC,KAAA,I;KAK3G,KAAkC3B,EAAAmF,CAAA,CAAU,CAACxD,EAAA,MAAS,MAAM,QAAQ,IAAoC,KAAA,I;KAKzG,OAAM;IACH,GAAA7B,EAAA6B,EAAA,MAAS,MAAM,QAAQ,GAAA,GAAAR,CAAA,MAE9BzB,EAAA,GAAAC,EAAiD,QAAAyB,GAAAtB,EAAjC6B,EAAA,MAAS,MAAM,QAAQ,GAAA,CAAA,E;IAGjCA,EAAA,MAAS,MAAM,kBADzBjC,EAAA,GAAAC,EAOM,OAPN0B,GAOM,CAJFxB,EAEoC+D,GAAA;KADhC,MAAK;KACL,OAAM;I,IACVhE,EAAgD,QAAA,MAAAE,EAAvC6B,EAAA,MAAS,MAAM,cAAc,GAAA,CAAA,C"}
@@ -1,72 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
- import { t } from "./VvButtonLocalized-C-vx25u4.js";
3
- import { VvButtonGroup as n, VvIcon as r } from "@volverjs/ui-vue/components";
4
- import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, onMounted as u, openBlock as d, ref as f, toDisplayString as p, unref as m, withCtx as h } from "vue";
5
- import { useClipboard as g } from "@vueuse/core";
6
- // ../../packages/components/src/chat/PkToolShowQrCode.vue?vue&type=script&setup=true&lang.ts
7
- var _ = {
8
- key: 0,
9
- class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-surface"
10
- }, v = { class: "px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8" }, y = { class: "font-bold" }, b = { class: "p-sm flex flex-col items-center" }, x = ["innerHTML"], S = {
11
- key: 0,
12
- class: "text-12 text-word-3 text-center"
13
- }, C = /*@__PURE__*/ l({
14
- __name: "PkToolShowQrCode",
15
- props: { part: {} },
16
- setup(e) {
17
- let l = e, { copy: C, copied: w } = g(), T = i(() => l.part), E = f(""), D = f();
18
- u(async () => {
19
- let e = T.value.input?.content;
20
- if (!e) return;
21
- let { default: t } = await import("qrcode");
22
- E.value = await t.toString(e, { type: "svg" });
23
- });
24
- let O = async () => {
25
- let e = D.value?.querySelector("svg");
26
- if (!e) return;
27
- let t = new XMLSerializer().serializeToString(e), n = new Blob([t], { type: "image/svg+xml;charset=utf-8" }), r = URL.createObjectURL(n), i = document.createElement("canvas");
28
- i.width = 512, i.height = 512;
29
- let a = i.getContext("2d"), o = new Image();
30
- o.onload = () => {
31
- a?.drawImage(o, 0, 0, 512, 512), URL.revokeObjectURL(r);
32
- let e = document.createElement("a");
33
- e.href = i.toDataURL("image/png"), e.download = "qrcode.png", e.click();
34
- }, o.src = r;
35
- };
36
- return (e, i) => {
37
- let l = r, u = t, f = n;
38
- return T.value?.input ? (d(), o("div", _, [s("div", v, [
39
- c(l, {
40
- name: "ri:qr-code-line",
41
- class: "text-16"
42
- }),
43
- s("strong", y, p(e.$t("label.qrCode")), 1),
44
- c(f, {
45
- modifiers: "compact",
46
- class: "ml-auto shrink-0"
47
- }, {
48
- default: h(() => [c(u, {
49
- modifiers: "action-quiet-small",
50
- icon: m(w) ? "ri:check-line" : "ri:file-copy-line",
51
- label: m(w) ? e.$t("action.copied") : e.$t("action.copy"),
52
- onClick: i[0] ||= (e) => m(C)(T.value?.input?.content ?? "")
53
- }, null, 8, ["icon", "label"]), c(u, {
54
- modifiers: "action-quiet-small",
55
- icon: "ri:download-line",
56
- label: e.$t("action.download"),
57
- onClick: O
58
- }, null, 8, ["label"])]),
59
- _: 1
60
- })
61
- ]), s("div", b, [s("div", {
62
- ref_key: "qrContainerRef",
63
- ref: D,
64
- class: "w-144 h-144",
65
- innerHTML: E.value
66
- }, null, 8, x), T.value.input.label ? (d(), o("p", S, p(T.value.input.label), 1)) : a("", !0)])])) : a("", !0);
67
- };
68
- }
69
- }), w = /* @__PURE__ */ e({ default: () => T }), T = C;
70
- export { w as n, T as t };
71
-
72
- //# sourceMappingURL=PkToolShowQrCode-skWaARYV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkToolShowQrCode-skWaARYV.js","names":["$t","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_withCtx","_unref","_createCommentVNode","_sfc_main","__exportAll","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","PkToolShowQrCode_vue_vue_type_script_setup_true_lang_default","props","__props","useClipboard","toolPart","computed","svgContent","ref","qrContainerRef","content","QRCode","downloadQr","svgEl","svgData","svgBlob","svgUrl","canvas","ctx","img","a","_component_VvIcon","VvIcon","_component_VvButton","VvButtonLocalized","_component_VvButtonGroup","VvButtonGroup","openBlock","createElementBlock","createElementVNode","createVNode","toDisplayString","_ctx","withCtx","unref","copied","_cache","copy","createCommentVNode","PkToolShowQrCode_exports","PkToolShowQrCode_default"],"sources":["../../../../packages/components/src/chat/PkToolShowQrCode.vue","../../../../packages/components/src/chat/PkToolShowQrCode.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, onMounted } from 'vue'\n import { useClipboard } from '@vueuse/core'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n content: string\n label?: string\n }\n }\n return part\n })\n\n const svgContent = ref('')\n const qrContainerRef = ref<HTMLElement>()\n\n onMounted(async () => {\n const content = toolPart.value.input?.content\n if (!content) {\n return\n }\n const { default: QRCode } = await import('qrcode')\n svgContent.value = await QRCode.toString(content, { type: 'svg' })\n })\n\n const downloadQr = async () => {\n const svgEl = qrContainerRef.value?.querySelector('svg')\n if (!svgEl) {\n return\n }\n const svgData = new XMLSerializer().serializeToString(svgEl)\n const svgBlob = new Blob([svgData], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const svgUrl = URL.createObjectURL(svgBlob)\n\n const canvas = document.createElement('canvas')\n canvas.width = 512\n canvas.height = 512\n const ctx = canvas.getContext('2d')\n const img = new Image()\n img.onload = () => {\n ctx?.drawImage(img, 0, 0, 512, 512)\n URL.revokeObjectURL(svgUrl)\n const a = document.createElement('a')\n a.href = canvas.toDataURL('image/png')\n a.download = 'qrcode.png'\n a.click()\n }\n img.src = svgUrl\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:qr-code-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.qrCode') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copy(toolPart?.input?.content ?? '')\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadQr\" />\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex flex-col items-center\">\n <div ref=\"qrContainerRef\" class=\"w-144 h-144\" v-html=\"svgContent\" />\n <p\n v-if=\"toolPart.input.label\"\n class=\"text-12 text-word-3 text-center\">\n {{ toolPart.input.label }}\n </p>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, onMounted } from 'vue'\n import { useClipboard } from '@vueuse/core'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { copy, copied } = useClipboard()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n content: string\n label?: string\n }\n }\n return part\n })\n\n const svgContent = ref('')\n const qrContainerRef = ref<HTMLElement>()\n\n onMounted(async () => {\n const content = toolPart.value.input?.content\n if (!content) {\n return\n }\n const { default: QRCode } = await import('qrcode')\n svgContent.value = await QRCode.toString(content, { type: 'svg' })\n })\n\n const downloadQr = async () => {\n const svgEl = qrContainerRef.value?.querySelector('svg')\n if (!svgEl) {\n return\n }\n const svgData = new XMLSerializer().serializeToString(svgEl)\n const svgBlob = new Blob([svgData], {\n type: 'image/svg+xml;charset=utf-8',\n })\n const svgUrl = URL.createObjectURL(svgBlob)\n\n const canvas = document.createElement('canvas')\n canvas.width = 512\n canvas.height = 512\n const ctx = canvas.getContext('2d')\n const img = new Image()\n img.onload = () => {\n ctx?.drawImage(img, 0, 0, 512, 512)\n URL.revokeObjectURL(svgUrl)\n const a = document.createElement('a')\n a.href = canvas.toDataURL('image/png')\n a.download = 'qrcode.png'\n a.click()\n }\n img.src = svgUrl\n }\n</script>\n\n<template>\n <div\n v-if=\"toolPart?.input\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon name=\"ri:qr-code-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.qrCode') }}</strong>\n <VvButtonGroup modifiers=\"compact\" class=\"ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n @click=\"copy(toolPart?.input?.content ?? '')\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n @click=\"downloadQr\" />\n </VvButtonGroup>\n </div>\n <div class=\"p-sm flex flex-col items-center\">\n <div ref=\"qrContainerRef\" class=\"w-144 h-144\" v-html=\"svgContent\" />\n <p\n v-if=\"toolPart.input.label\"\n class=\"text-12 text-word-3 text-center\">\n {{ toolPart.input.label }}\n </p>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAII,IAAMqB,IAAQC,GAIR,EAAE,SAAM,cAAWC,EAAa,GAEhCC,IAAWC,QACAJ,EAAM,IAOtB,GAEKK,IAAaC,EAAI,EAAE,GACnBC,IAAiBD,EAAiB;EAExC,EAAU,YAAY;GAClB,IAAME,IAAUL,EAAS,MAAM,OAAO;GACtC,IAAI,CAACK,GACD;GAEJ,IAAM,EAAE,SAASC,MAAW,MAAM,OAAO;GACzC,EAAW,QAAQ,MAAMA,EAAO,SAASD,GAAS,EAAE,MAAM,MAAM,CAAC;EACrE,CAAC;EAED,IAAME,IAAa,YAAY;GAC3B,IAAMC,IAAQJ,EAAe,OAAO,cAAc,KAAK;GACvD,IAAI,CAACI,GACD;GAEJ,IAAMC,IAAU,IAAI,cAAc,CAAC,CAAC,kBAAkBD,CAAK,GACrDE,IAAU,IAAI,KAAK,CAACD,CAAO,GAAG,EAChC,MAAM,8BACV,CAAC,GACKE,IAAS,IAAI,gBAAgBD,CAAO,GAEpCE,IAAS,SAAS,cAAc,QAAQ;GAE9C,AADA,EAAO,QAAQ,KACf,EAAO,SAAS;GAChB,IAAMC,IAAMD,EAAO,WAAW,IAAI,GAC5BE,IAAM,IAAI,MAAM;GAStB,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