@8wave/ai-elements 0.125.0-beta.31 → 0.125.0-beta.33

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 (103) hide show
  1. package/dist/_chunks/{PkChatbotFilePreview-CqxtVySb.js → PkChatbotFilePreview-DsRAk1js.js} +2 -2
  2. package/dist/_chunks/{PkChatbotFilePreview-CqxtVySb.js.map → PkChatbotFilePreview-DsRAk1js.js.map} +1 -1
  3. package/dist/_chunks/PkImageEditorDialog-BQwM06kT.js +939 -0
  4. package/dist/_chunks/PkImageEditorDialog-BQwM06kT.js.map +1 -0
  5. package/dist/_chunks/{PkStreamingMarkdown-BqDooeUU.js → PkStreamingMarkdown-CjL7l_3E.js} +2 -2
  6. package/dist/_chunks/{PkStreamingMarkdown-BqDooeUU.js.map → PkStreamingMarkdown-CjL7l_3E.js.map} +1 -1
  7. package/dist/_chunks/{PkToolChatFile-DpStX3wS.js → PkToolChatFile-weptM8iA.js} +2 -2
  8. package/dist/_chunks/{PkToolChatFile-DpStX3wS.js.map → PkToolChatFile-weptM8iA.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShareDocument-BvHklbzb.js → PkToolShareDocument-D5K3uJ2x.js} +2 -2
  10. package/dist/_chunks/{PkToolShareDocument-BvHklbzb.js.map → PkToolShareDocument-D5K3uJ2x.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowArtifact-YPwJLLlW.js → PkToolShowArtifact-Bm2zS5YS.js} +2 -2
  12. package/dist/_chunks/{PkToolShowArtifact-YPwJLLlW.js.map → PkToolShowArtifact-Bm2zS5YS.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowContactForm-CTc1mbA8.js → PkToolShowContactForm-BKJCv5To.js} +2 -2
  14. package/dist/_chunks/{PkToolShowContactForm-CTc1mbA8.js.map → PkToolShowContactForm-BKJCv5To.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowDiagram-COt1Z3q9.js → PkToolShowDiagram-jpaEAi2X.js} +2 -2
  16. package/dist/_chunks/{PkToolShowDiagram-COt1Z3q9.js.map → PkToolShowDiagram-jpaEAi2X.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowForm-DT5EyYVY.js → PkToolShowForm-DvAcJgDP.js} +2 -2
  18. package/dist/_chunks/{PkToolShowForm-DT5EyYVY.js.map → PkToolShowForm-DvAcJgDP.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowImageGallery-DKrCrrB5.js → PkToolShowImageGallery-D0htuXNL.js} +4 -4
  20. package/dist/_chunks/{PkToolShowImageGallery-DKrCrrB5.js.map → PkToolShowImageGallery-D0htuXNL.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowSources-CzSknPo6.js → PkToolShowSources-Cfj6iRGj.js} +2 -2
  22. package/dist/_chunks/{PkToolShowSources-CzSknPo6.js.map → PkToolShowSources-Cfj6iRGj.js.map} +1 -1
  23. package/dist/_chunks/{useLightbox-D2Zi-Fpe.js → useLightbox-C54BCSbU.js} +130 -89
  24. package/dist/_chunks/useLightbox-C54BCSbU.js.map +1 -0
  25. package/dist/ai-elements.es.js +2774 -2721
  26. package/dist/ai-elements.es.js.map +1 -1
  27. package/dist-vue/PkChatbot.js +1 -1
  28. package/dist-vue/PkChatbotEmptyState.js +1 -1
  29. package/dist-vue/PkChatbotFilePreview.js +1 -1
  30. package/dist-vue/PkChatbotInput.js +1 -1
  31. package/dist-vue/PkChatbotMessages.js +1 -1
  32. package/dist-vue/PkChatbotSteps.js +1 -1
  33. package/dist-vue/PkChatbotViewChat.js +1 -1
  34. package/dist-vue/_chunks/{PkChatbot-DLgPqMWd.js → PkChatbot-Bc2hlwFO.js} +3 -3
  35. package/dist-vue/_chunks/{PkChatbot-DLgPqMWd.js.map → PkChatbot-Bc2hlwFO.js.map} +1 -1
  36. package/dist-vue/_chunks/{PkChatbotEmptyState-DMPEj1Qa.js → PkChatbotEmptyState-NHarCaDm.js} +2 -2
  37. package/dist-vue/_chunks/{PkChatbotEmptyState-DMPEj1Qa.js.map → PkChatbotEmptyState-NHarCaDm.js.map} +1 -1
  38. package/dist-vue/_chunks/{PkChatbotFilePreview-j_8sDZUE.js → PkChatbotFilePreview-BIta8Yg-.js} +2 -2
  39. package/dist-vue/_chunks/{PkChatbotFilePreview-j_8sDZUE.js.map → PkChatbotFilePreview-BIta8Yg-.js.map} +1 -1
  40. package/dist-vue/_chunks/{PkChatbotInput-TamSYiA7.js → PkChatbotInput-BSzDRoDD.js} +192 -181
  41. package/dist-vue/_chunks/PkChatbotInput-BSzDRoDD.js.map +1 -0
  42. package/dist-vue/_chunks/{PkChatbotMessages-bPBOSAv7.js → PkChatbotMessages-DEMKZDCb.js} +17 -17
  43. package/dist-vue/_chunks/{PkChatbotMessages-bPBOSAv7.js.map → PkChatbotMessages-DEMKZDCb.js.map} +1 -1
  44. package/dist-vue/_chunks/{PkChatbotSteps-pibgqxus.js → PkChatbotSteps-DGQoYxJ9.js} +2 -2
  45. package/dist-vue/_chunks/{PkChatbotSteps-pibgqxus.js.map → PkChatbotSteps-DGQoYxJ9.js.map} +1 -1
  46. package/dist-vue/_chunks/{PkChatbotViewChat-y60IA9aQ.js → PkChatbotViewChat-aKi08vCz.js} +440 -431
  47. package/dist-vue/_chunks/PkChatbotViewChat-aKi08vCz.js.map +1 -0
  48. package/dist-vue/_chunks/{PkFilePreview-CPSYaOV7.js → PkFilePreview-D2HInDoA.js} +2 -2
  49. package/dist-vue/_chunks/{PkFilePreview-CPSYaOV7.js.map → PkFilePreview-D2HInDoA.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkFilePreviewDialog-D6zFO_H_.js → PkFilePreviewDialog-jxcUSzPx.js} +2 -2
  51. package/dist-vue/_chunks/{PkFilePreviewDialog-D6zFO_H_.js.map → PkFilePreviewDialog-jxcUSzPx.js.map} +1 -1
  52. package/dist-vue/_chunks/PkImageEditorDialog-Dn3HV_ny.js +934 -0
  53. package/dist-vue/_chunks/PkImageEditorDialog-Dn3HV_ny.js.map +1 -0
  54. package/dist-vue/_chunks/{PkStreamingMarkdown-B3VWOaWb.js → PkStreamingMarkdown-DdOv86Eb.js} +11 -11
  55. package/dist-vue/_chunks/{PkStreamingMarkdown-B3VWOaWb.js.map → PkStreamingMarkdown-DdOv86Eb.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkSvgViewer-BsdSOBpH.js → PkSvgViewer-vkd5Dluw.js} +2 -2
  57. package/dist-vue/_chunks/{PkSvgViewer-BsdSOBpH.js.map → PkSvgViewer-vkd5Dluw.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkToolChatFile-PXpiJLZ6.js → PkToolChatFile-8nx166iM.js} +2 -2
  59. package/dist-vue/_chunks/{PkToolChatFile-PXpiJLZ6.js.map → PkToolChatFile-8nx166iM.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkToolShareDocument-cMUqik6v.js → PkToolShareDocument-CspvFwRR.js} +2 -2
  61. package/dist-vue/_chunks/{PkToolShareDocument-cMUqik6v.js.map → PkToolShareDocument-CspvFwRR.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkToolShowArtifact-DouCz_dZ.js → PkToolShowArtifact-BppP_xSN.js} +2 -2
  63. package/dist-vue/_chunks/{PkToolShowArtifact-DouCz_dZ.js.map → PkToolShowArtifact-BppP_xSN.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkToolShowContactForm-BmiNlFfx.js → PkToolShowContactForm-Bm0icz24.js} +2 -2
  65. package/dist-vue/_chunks/{PkToolShowContactForm-BmiNlFfx.js.map → PkToolShowContactForm-Bm0icz24.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkToolShowDiagram-D6mYTDU-.js → PkToolShowDiagram-CgukB1Ss.js} +2 -2
  67. package/dist-vue/_chunks/{PkToolShowDiagram-D6mYTDU-.js.map → PkToolShowDiagram-CgukB1Ss.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkToolShowForm-CksTiimD.js → PkToolShowForm-CyyN7GQP.js} +2 -2
  69. package/dist-vue/_chunks/{PkToolShowForm-CksTiimD.js.map → PkToolShowForm-CyyN7GQP.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkToolShowImageGallery-B-lVY0xH.js → PkToolShowImageGallery-zQF_lsxI.js} +5 -5
  71. package/dist-vue/_chunks/{PkToolShowImageGallery-B-lVY0xH.js.map → PkToolShowImageGallery-zQF_lsxI.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolShowLocation-B8FE_Sqd.js → PkToolShowLocation-WdRqG8Wi.js} +2 -2
  73. package/dist-vue/_chunks/{PkToolShowLocation-B8FE_Sqd.js.map → PkToolShowLocation-WdRqG8Wi.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolShowProductList-Dcq3Kdse.js → PkToolShowProductList-DW_P0gC2.js} +2 -2
  75. package/dist-vue/_chunks/{PkToolShowProductList-Dcq3Kdse.js.map → PkToolShowProductList-DW_P0gC2.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowSources-DApWmwvk.js → PkToolShowSources-BugMybUx.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowSources-DApWmwvk.js.map → PkToolShowSources-BugMybUx.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkToolShowVideo-CjrYh9-q.js → PkToolShowVideo-BW7aRKs_.js} +2 -2
  79. package/dist-vue/_chunks/{PkToolShowVideo-CjrYh9-q.js.map → PkToolShowVideo-BW7aRKs_.js.map} +1 -1
  80. package/dist-vue/_chunks/{PkToolShowWebPages-DSIAizw-.js → PkToolShowWebPages-DxKimT-2.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowWebPages-DSIAizw-.js.map → PkToolShowWebPages-DxKimT-2.js.map} +1 -1
  82. package/dist-vue/_chunks/{useLightbox-FDyQrPWe.js → useLightbox-Ctl9zaMX.js} +132 -91
  83. package/dist-vue/_chunks/useLightbox-Ctl9zaMX.js.map +1 -0
  84. package/dist-vue/composables.js +36 -2
  85. package/dist-vue/composables.js.map +1 -1
  86. package/dist-vue/index.js +22 -22
  87. package/dist-vue/index.js.map +1 -1
  88. package/dist-vue/locales.js +34 -0
  89. package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +5 -0
  90. package/dist-vue/packages/components/src/chat/PkImageEditor.d.ts +11 -9
  91. package/dist-vue/packages/components/src/chat/PkImageEditorDialog.d.ts +12 -5
  92. package/dist-vue/packages/components/src/chat/imageEdits.d.ts +77 -1
  93. package/dist-vue/packages/components/src/composables/useLightbox.d.ts +26 -0
  94. package/dist-vue/style.css +1 -1
  95. package/package.json +1 -1
  96. package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js +0 -555
  97. package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js.map +0 -1
  98. package/dist/_chunks/useLightbox-D2Zi-Fpe.js.map +0 -1
  99. package/dist-vue/_chunks/PkChatbotInput-TamSYiA7.js.map +0 -1
  100. package/dist-vue/_chunks/PkChatbotViewChat-y60IA9aQ.js.map +0 -1
  101. package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js +0 -550
  102. package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js.map +0 -1
  103. package/dist-vue/_chunks/useLightbox-FDyQrPWe.js.map +0 -1
@@ -0,0 +1,934 @@
1
+ import { t as e } from "./PkEditorRadioButtons-Bw576DPQ.js";
2
+ import { t } from "./VvButtonLocalized-C-vx25u4.js";
3
+ import { VvAlert as n, VvButtonGroup as r, VvDialog as i, VvIcon as a } from "@volverjs/ui-vue/components";
4
+ import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as f, createVNode as p, defineComponent as m, mergeModels as h, nextTick as ee, normalizeClass as g, normalizeStyle as _, onBeforeUnmount as te, onMounted as ne, openBlock as v, ref as y, renderList as b, shallowRef as re, toDisplayString as x, unref as S, useId as C, useModel as w, useTemplateRef as T, vModelText as E, watch as D, withCtx as O, withDirectives as k, withKeys as ie, withModifiers as ae } from "vue";
5
+ import { useI18n as oe } from "vue-i18n";
6
+ import { useMediaQuery as A, useResizeObserver as se } from "@vueuse/core";
7
+ // ../../packages/components/src/chat/imageEdits.ts
8
+ var j = {
9
+ red: {
10
+ fill: "#ff3b30",
11
+ edge: "#ffffff"
12
+ },
13
+ yellow: {
14
+ fill: "#ffcc00",
15
+ edge: "#000000"
16
+ },
17
+ green: {
18
+ fill: "#34c759",
19
+ edge: "#000000"
20
+ },
21
+ blue: {
22
+ fill: "#007aff",
23
+ edge: "#ffffff"
24
+ },
25
+ white: {
26
+ fill: "#ffffff",
27
+ edge: "#000000"
28
+ },
29
+ black: {
30
+ fill: "#000000",
31
+ edge: "#ffffff"
32
+ }
33
+ }, ce = "system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", M = 16777216, le = .92, N = 12, P = 32, F = 3, I = 160, ue = 16, de = 28, fe = 12, pe = 1.2, me = 4, he = 2.2, ge = .6, _e = {
34
+ "image/jpeg": "jpg",
35
+ "image/png": "png",
36
+ "image/webp": "webp"
37
+ };
38
+ function L(e, t = M) {
39
+ let n = e.width * e.height;
40
+ if (n <= t) return {
41
+ width: e.width,
42
+ height: e.height
43
+ };
44
+ let r = Math.sqrt(t / n);
45
+ return {
46
+ width: Math.max(1, Math.floor(e.width * r)),
47
+ height: Math.max(1, Math.floor(e.height * r))
48
+ };
49
+ }
50
+ function ve(e, t) {
51
+ let { width: n, height: r } = e;
52
+ for (let e of t) e.kind === "rotate" ? [n, r] = [r, n] : e.kind === "crop" && ({width: n, height: r} = e.rect);
53
+ return {
54
+ width: n,
55
+ height: r
56
+ };
57
+ }
58
+ function R(e) {
59
+ return Math.max(N, Math.round(Math.min(e.width, e.height) / P));
60
+ }
61
+ function ye(e) {
62
+ return Math.max(F, Math.round(Math.min(e.width, e.height) / I));
63
+ }
64
+ function be(e) {
65
+ return Math.max(ue, Math.round(Math.min(e.width, e.height) / de));
66
+ }
67
+ function xe(e) {
68
+ return Math.max(1, Math.round(e / 3));
69
+ }
70
+ function Se(e, t, n) {
71
+ let r = [], i = "";
72
+ for (let a of e.split(/\s+/).filter(Boolean)) {
73
+ let e = i ? `${i} ${a}` : a;
74
+ if (n(e) <= t) {
75
+ i = e;
76
+ continue;
77
+ }
78
+ i && r.push(i);
79
+ let o = a;
80
+ for (; o.length > 1 && n(o) > t;) {
81
+ let e = o.length - 1;
82
+ for (; e > 1 && n(o.slice(0, e)) > t;) e--;
83
+ r.push(o.slice(0, e)), o = o.slice(e);
84
+ }
85
+ i = o;
86
+ }
87
+ return i && r.push(i), r;
88
+ }
89
+ function Ce(e, t, n) {
90
+ let r = t.x - e.x, i = t.y - e.y, a = Math.hypot(r, i);
91
+ if (!a) return {
92
+ lineEnd: t,
93
+ head: [
94
+ t,
95
+ t,
96
+ t
97
+ ]
98
+ };
99
+ let o = r / a, s = i / a, c = Math.min(n * me, a * ge), l = c * he / me, u = {
100
+ x: t.x - o * c,
101
+ y: t.y - s * c
102
+ };
103
+ return {
104
+ lineEnd: u,
105
+ head: [
106
+ {
107
+ x: t.x,
108
+ y: t.y
109
+ },
110
+ {
111
+ x: u.x - s * l,
112
+ y: u.y + o * l
113
+ },
114
+ {
115
+ x: u.x + s * l,
116
+ y: u.y - o * l
117
+ }
118
+ ]
119
+ };
120
+ }
121
+ function we(e, t, n, r) {
122
+ let i = J(e.x, 0, n.width), a = J(e.y, 0, n.height), o = t.x - i, s = t.y - a, c = o < 0 ? i : n.width - i, l = s < 0 ? a : n.height - a, u = Math.min(Math.abs(o), c), d = Math.min(Math.abs(s), l);
123
+ if (r) {
124
+ let e = Math.max(Math.abs(o), Math.abs(s) * r);
125
+ u = Math.min(e, c, l * r), d = u / r;
126
+ }
127
+ let f = Math.round(o < 0 ? i - u : i), p = Math.round(s < 0 ? a - d : a);
128
+ return {
129
+ x: f,
130
+ y: p,
131
+ width: Math.min(Math.round(u), n.width - f),
132
+ height: Math.min(Math.round(d), n.height - p)
133
+ };
134
+ }
135
+ function z(e, t, n, r) {
136
+ let i = (e, t) => e + 2 * r > t ? t : e + r;
137
+ for (let r = 0; r < n; r = i(r, n)) {
138
+ let a = i(r, n);
139
+ for (let n = 0; n < t; n = i(n, t)) {
140
+ let o = i(n, t), s = 0, c = 0, l = 0, u = 0;
141
+ for (let i = r; i < a; i++) for (let r = n; r < o; r++) {
142
+ let n = (i * t + r) * 4, a = e[n + 3];
143
+ s += e[n] * a, c += e[n + 1] * a, l += e[n + 2] * a, u += a;
144
+ }
145
+ let d = (a - r) * (o - n), f = u > 0 ? [
146
+ s / u,
147
+ c / u,
148
+ l / u,
149
+ u / d
150
+ ] : [
151
+ 0,
152
+ 0,
153
+ 0,
154
+ 0
155
+ ];
156
+ for (let i = r; i < a; i++) for (let r = n; r < o; r++) e.set(f, (i * t + r) * 4);
157
+ }
158
+ }
159
+ }
160
+ function B(e, t, n) {
161
+ let r = _e[n];
162
+ if (n === t || !r) return e;
163
+ let i = e.lastIndexOf(".");
164
+ return `${i > 0 ? e.slice(0, i) : e}.${r}`;
165
+ }
166
+ async function V(e) {
167
+ let t = await createImageBitmap(e, { imageOrientation: "from-image" });
168
+ try {
169
+ let e = {
170
+ width: t.width,
171
+ height: t.height
172
+ }, n = U(L(e)), r = W(n);
173
+ return r.imageSmoothingQuality = "high", r.drawImage(t, 0, 0, n.width, n.height), {
174
+ image: n,
175
+ original: e
176
+ };
177
+ } finally {
178
+ t.close();
179
+ }
180
+ }
181
+ function Te(e, t) {
182
+ let n = U(e);
183
+ W(n).drawImage(e, 0, 0);
184
+ for (let e of t) {
185
+ if (e.kind === "cover") {
186
+ K(n, e.rect, e.style);
187
+ continue;
188
+ }
189
+ if (e.kind !== "rotate" && e.kind !== "crop") {
190
+ Ee(W(n), e);
191
+ continue;
192
+ }
193
+ let t = e.kind === "rotate" ? G(n, e.turn) : Oe(n, e.rect);
194
+ H(n), n = t;
195
+ }
196
+ return n;
197
+ }
198
+ function Ee(e, t) {
199
+ let { fill: n, edge: r } = j[t.color];
200
+ if (e.save(), e.lineCap = "round", e.lineJoin = "round", t.kind === "text") {
201
+ let { at: i, size: a } = t;
202
+ e.font = `700 ${a}px ${ce}`, e.textBaseline = "top", e.lineWidth = Math.max(1, Math.round(a / fe)) * 2, e.strokeStyle = r, e.fillStyle = n;
203
+ let o = Se(t.text, t.maxWidth, (t) => e.measureText(t).width), s = (e) => i.y + a * (e * pe + .19999999999999996 / 2);
204
+ o.forEach((t, n) => e.strokeText(t, i.x, s(n))), o.forEach((t, n) => e.fillText(t, i.x, s(n))), e.restore();
205
+ return;
206
+ }
207
+ let i = xe(t.width);
208
+ for (let [a, o] of [[r, i * 2], [n, 0]]) if (e.strokeStyle = a, e.fillStyle = a, e.lineWidth = t.width + o, t.kind === "rect") {
209
+ let { x: n, y: r, width: i, height: a } = t.rect;
210
+ e.strokeRect(n, r, i, a);
211
+ } else if (t.kind === "path") q(e, t.points), e.stroke();
212
+ else {
213
+ let { lineEnd: n, head: r } = Ce(t.from, t.to, t.width);
214
+ e.beginPath(), e.moveTo(t.from.x, t.from.y), e.lineTo(n.x, n.y), e.stroke(), e.beginPath(), e.moveTo(r[0].x, r[0].y), e.lineTo(r[1].x, r[1].y), e.lineTo(r[2].x, r[2].y), e.closePath(), e.fill(), o && (e.lineWidth = o, e.stroke());
215
+ }
216
+ e.restore();
217
+ }
218
+ function De(e, t) {
219
+ return new Promise((n, r) => {
220
+ e.toBlob((e) => e ? n(e) : r(/* @__PURE__ */ Error("The image could not be written")), t, le);
221
+ });
222
+ }
223
+ function H(e) {
224
+ e.width = 0, e.height = 0;
225
+ }
226
+ function U(e) {
227
+ let t = document.createElement("canvas");
228
+ return t.width = e.width, t.height = e.height, t;
229
+ }
230
+ function W(e) {
231
+ let t = e.getContext("2d");
232
+ if (!t) throw Error("No 2D canvas in this browser");
233
+ return t;
234
+ }
235
+ function G(e, t) {
236
+ let n = U({
237
+ width: e.height,
238
+ height: e.width
239
+ }), r = W(n);
240
+ return r.save(), r.translate(n.width / 2, n.height / 2), r.rotate(t * Math.PI / 2), r.drawImage(e, -e.width / 2, -e.height / 2), r.restore(), n;
241
+ }
242
+ function Oe(e, t) {
243
+ let n = U(t);
244
+ return W(n).drawImage(e, t.x, t.y, t.width, t.height, 0, 0, t.width, t.height), n;
245
+ }
246
+ function K(e, t, n) {
247
+ let r = W(e);
248
+ if (n === "solid") {
249
+ r.fillStyle = "#000000", r.fillRect(t.x, t.y, t.width, t.height);
250
+ return;
251
+ }
252
+ let i = r.getImageData(t.x, t.y, t.width, t.height);
253
+ z(i.data, t.width, t.height, R(e)), r.putImageData(i, t.x, t.y);
254
+ }
255
+ function q(e, t) {
256
+ let [n, ...r] = t, i = r[r.length - 1];
257
+ if (e.beginPath(), !n) return;
258
+ e.moveTo(n.x, n.y);
259
+ for (let t = 0; t < r.length - 1; t++) {
260
+ let n = r[t], i = r[t + 1];
261
+ e.quadraticCurveTo(n.x, n.y, (n.x + i.x) / 2, (n.y + i.y) / 2);
262
+ }
263
+ let a = i ?? n;
264
+ e.lineTo(a.x, a.y);
265
+ }
266
+ function ke(e, t) {
267
+ return {
268
+ x: J(e.x, 0, t.width),
269
+ y: J(e.y, 0, t.height)
270
+ };
271
+ }
272
+ function J(e, t, n) {
273
+ return Math.min(n, Math.max(t, e));
274
+ }
275
+ // ../../packages/components/src/chat/PkImageEditor.vue?vue&type=script&setup=true&lang.ts
276
+ var Ae = { class: "pk-image-editor" }, je = { class: "pk-image-editor__toolbar" }, Me = ["title"], Ne = { class: "pk-image-editor__tool-label" }, Pe = { class: "pk-image-editor__options" }, Fe = ["id"], Ie = { class: "pk-image-editor__hint" }, Le = { class: "pk-image-editor__hint" }, Re = ["id"], ze = ["title"], Be = { class: "u-visually-hidden" }, Ve = { class: "pk-image-editor__hint" }, He = ["aria-label"], Ue = 6, We = 2, Ge = 200, Y = /* @__PURE__ */ m({
277
+ __name: "PkImageEditor",
278
+ props: /*@__PURE__*/ h({
279
+ image: {},
280
+ initialTool: {}
281
+ }, {
282
+ edits: { required: !0 },
283
+ editsModifiers: {}
284
+ }),
285
+ emits: /*@__PURE__*/ h(["error"], ["update:edits"]),
286
+ setup(n, { expose: i, emit: c }) {
287
+ let m = n, h = c, A = w(n, "edits"), { t: M } = oe({ useScope: "global" }), le = {
288
+ free: void 0,
289
+ "1:1": 1,
290
+ "4:3": 4 / 3,
291
+ "16:9": 16 / 9
292
+ }, N = y(m.initialTool ?? "crop"), P = y("free"), F = y("solid"), I = y("red"), ue = s(() => [
293
+ {
294
+ value: "crop",
295
+ label: M("imageEditor.crop"),
296
+ icon: "ri:crop-line"
297
+ },
298
+ {
299
+ value: "cover",
300
+ label: M("imageEditor.cover"),
301
+ icon: "ri:eye-off-line"
302
+ },
303
+ {
304
+ value: "arrow",
305
+ label: M("imageEditor.arrow"),
306
+ icon: "ri:arrow-right-up-line"
307
+ },
308
+ {
309
+ value: "rect",
310
+ label: M("imageEditor.rect"),
311
+ icon: "ri:checkbox-blank-line"
312
+ },
313
+ {
314
+ value: "path",
315
+ label: M("imageEditor.path"),
316
+ icon: "ri:pencil-line"
317
+ },
318
+ {
319
+ value: "text",
320
+ label: M("imageEditor.text"),
321
+ icon: "ri:text"
322
+ }
323
+ ]), de = s(() => [
324
+ {
325
+ value: "free",
326
+ label: M("imageEditor.aspectFree")
327
+ },
328
+ {
329
+ value: "1:1",
330
+ label: "1:1"
331
+ },
332
+ {
333
+ value: "4:3",
334
+ label: "4:3"
335
+ },
336
+ {
337
+ value: "16:9",
338
+ label: "16:9"
339
+ }
340
+ ]), fe = s(() => [{
341
+ value: "solid",
342
+ label: M("imageEditor.coverSolid")
343
+ }, {
344
+ value: "pixelate",
345
+ label: M("imageEditor.coverPixelate")
346
+ }]), me = s(() => [
347
+ {
348
+ value: "red",
349
+ label: M("imageEditor.colorRed")
350
+ },
351
+ {
352
+ value: "yellow",
353
+ label: M("imageEditor.colorYellow")
354
+ },
355
+ {
356
+ value: "green",
357
+ label: M("imageEditor.colorGreen")
358
+ },
359
+ {
360
+ value: "blue",
361
+ label: M("imageEditor.colorBlue")
362
+ },
363
+ {
364
+ value: "white",
365
+ label: M("imageEditor.colorWhite")
366
+ },
367
+ {
368
+ value: "black",
369
+ label: M("imageEditor.colorBlack")
370
+ }
371
+ ]), he = s(() => {
372
+ switch (N.value) {
373
+ case "arrow": return M("imageEditor.arrowHint");
374
+ case "rect": return M("imageEditor.rectHint");
375
+ case "path": return M("imageEditor.pathHint");
376
+ default: return M("imageEditor.textHint");
377
+ }
378
+ }), ge = C(), _e = C(), L = y([]);
379
+ function R(e) {
380
+ A.value = [...A.value, e], L.value = [];
381
+ }
382
+ function xe() {
383
+ q.value = void 0;
384
+ let e = A.value[A.value.length - 1];
385
+ e && (A.value = A.value.slice(0, -1), L.value = [...L.value, e]);
386
+ }
387
+ function Se() {
388
+ q.value = void 0;
389
+ let e = L.value[L.value.length - 1];
390
+ e && (A.value = [...A.value, e], L.value = L.value.slice(0, -1));
391
+ }
392
+ function Ce(e) {
393
+ q.value = void 0, R({
394
+ kind: "rotate",
395
+ turn: e
396
+ });
397
+ }
398
+ let z = s(() => ve(m.image, A.value)), B = T("stageEl"), V;
399
+ function De() {
400
+ if (!B.value) return;
401
+ let e;
402
+ try {
403
+ e = Te(m.image, A.value);
404
+ } catch {
405
+ h("error");
406
+ return;
407
+ }
408
+ e.setAttribute("role", "img"), e.setAttribute("aria-label", M("imageEditor.canvasLabel")), B.value.replaceChildren(e), V && H(V), V = e;
409
+ }
410
+ ne(De), D([() => m.image, A], De, { flush: "post" }), te(() => {
411
+ V && H(V), Qe.value && H(Qe.value);
412
+ });
413
+ let U = T("areaEl"), W = y({
414
+ width: 0,
415
+ height: 0
416
+ });
417
+ se(U, ([e]) => {
418
+ e && (W.value = {
419
+ width: e.contentRect.width,
420
+ height: e.contentRect.height
421
+ });
422
+ });
423
+ let G = s(() => Math.min(1, W.value.width / z.value.width, W.value.height / z.value.height)), Oe = s(() => ({
424
+ width: `${Math.max(1, Math.floor(z.value.width * G.value))}px`,
425
+ height: `${Math.max(1, Math.floor(z.value.height * G.value))}px`
426
+ })), K = T("frameEl"), q = y(), J = y(), Y = re(), X;
427
+ function Ke(e) {
428
+ let t = K.value?.getBoundingClientRect();
429
+ return !t?.width || !t.height ? {
430
+ x: 0,
431
+ y: 0
432
+ } : ke({
433
+ x: (e.clientX - t.left) / t.width * z.value.width,
434
+ y: (e.clientY - t.top) / t.height * z.value.height
435
+ }, z.value);
436
+ }
437
+ function qe(e) {
438
+ if (e.button !== 0 || X !== void 0) return;
439
+ X = e.pointerId, K.value?.setPointerCapture(e.pointerId);
440
+ let t = Ke(e);
441
+ J.value = t, q.value = void 0, N.value === "path" && (Y.value = {
442
+ kind: "path",
443
+ points: [t],
444
+ color: I.value,
445
+ width: ye(z.value)
446
+ });
447
+ }
448
+ function Je(e) {
449
+ let t = J.value;
450
+ if (!t || e.pointerId !== X) return;
451
+ let n = Ke(e), r = ye(z.value);
452
+ switch (N.value) {
453
+ case "crop":
454
+ case "cover":
455
+ q.value = we(t, n, z.value, N.value === "crop" ? le[P.value] : void 0);
456
+ break;
457
+ case "rect":
458
+ Y.value = {
459
+ kind: "rect",
460
+ rect: we(t, n, z.value),
461
+ color: I.value,
462
+ width: r
463
+ };
464
+ break;
465
+ case "arrow":
466
+ Y.value = {
467
+ kind: "arrow",
468
+ from: t,
469
+ to: n,
470
+ color: I.value,
471
+ width: r
472
+ };
473
+ break;
474
+ case "path": {
475
+ let e = Y.value, t = e?.kind === "path" ? e.points[e.points.length - 1] : void 0;
476
+ e?.kind === "path" && t && dt(t, n) * G.value >= We && (Y.value = {
477
+ ...e,
478
+ points: [...e.points, n]
479
+ });
480
+ break;
481
+ }
482
+ }
483
+ }
484
+ function Ye(e) {
485
+ let t = J.value;
486
+ if (!t || e.pointerId !== X) return;
487
+ if (X = void 0, J.value = void 0, N.value === "crop" || N.value === "cover") {
488
+ let e = q.value;
489
+ if (!e || !Z(e.width) || !Z(e.height)) {
490
+ q.value = void 0;
491
+ return;
492
+ }
493
+ N.value === "cover" && (q.value = void 0, R({
494
+ kind: "cover",
495
+ rect: e,
496
+ style: F.value
497
+ }));
498
+ return;
499
+ }
500
+ if (N.value === "text") {
501
+ it(t);
502
+ return;
503
+ }
504
+ let n = Y.value;
505
+ Y.value = void 0, n && Ze(n) && R(n);
506
+ }
507
+ function Xe(e) {
508
+ e.pointerId === X && (X = void 0, J.value = void 0, q.value = void 0, Y.value = void 0);
509
+ }
510
+ function Z(e) {
511
+ return e * G.value >= Ue;
512
+ }
513
+ function Ze(e) {
514
+ switch (e.kind) {
515
+ case "arrow": return Z(dt(e.from, e.to));
516
+ case "rect": return Z(e.rect.width) && Z(e.rect.height);
517
+ case "path": return e.points.length > 1;
518
+ default: return !0;
519
+ }
520
+ }
521
+ let Qe = T("draftEl");
522
+ function $e() {
523
+ let e = Qe.value, t = K.value;
524
+ if (!e || !t) return;
525
+ let n = Y.value;
526
+ if (!n) {
527
+ H(e);
528
+ return;
529
+ }
530
+ let r = window.devicePixelRatio || 1;
531
+ e.width = Math.round(t.clientWidth * r), e.height = Math.round(t.clientHeight * r);
532
+ let i = e.getContext("2d");
533
+ if (!i) return;
534
+ let a = e.width / z.value.width;
535
+ i.setTransform(a, 0, 0, a, 0, 0), Ee(i, n);
536
+ }
537
+ D(Y, $e, { flush: "post" });
538
+ let et = s(() => N.value === "crop" && !J.value && !!q.value);
539
+ function tt() {
540
+ let e = q.value;
541
+ et.value && e && (q.value = void 0, (e.width !== z.value.width || e.height !== z.value.height) && R({
542
+ kind: "crop",
543
+ rect: e
544
+ }));
545
+ }
546
+ D(P, (e) => {
547
+ let t = q.value;
548
+ t && N.value === "crop" && (q.value = we(t, {
549
+ x: t.x + t.width,
550
+ y: t.y + t.height
551
+ }, z.value, le[e]));
552
+ });
553
+ let nt = s(() => {
554
+ let e = q.value;
555
+ if (e) return {
556
+ left: `${e.x / z.value.width * 100}%`,
557
+ top: `${e.y / z.value.height * 100}%`,
558
+ width: `${e.width / z.value.width * 100}%`,
559
+ height: `${e.height / z.value.height * 100}%`
560
+ };
561
+ }), Q = y(), rt = T("textEl");
562
+ async function it(e) {
563
+ $(), Q.value = {
564
+ at: e,
565
+ text: ""
566
+ }, await ee(), ct(), rt.value?.focus();
567
+ }
568
+ function $() {
569
+ let e = Q.value;
570
+ Q.value = void 0;
571
+ let t = e?.text.trim();
572
+ e && t && R({
573
+ kind: "text",
574
+ at: e.at,
575
+ text: t,
576
+ color: I.value,
577
+ size: be(z.value),
578
+ maxWidth: z.value.width - e.at.x
579
+ });
580
+ }
581
+ let at = (e) => e.isComposing || e.keyCode === 229;
582
+ function ot(e) {
583
+ at(e) || (e.preventDefault(), $());
584
+ }
585
+ function st(e) {
586
+ at(e) || (e.preventDefault(), Q.value = void 0);
587
+ }
588
+ function ct() {
589
+ let e = rt.value;
590
+ e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
591
+ }
592
+ let lt = s(() => !!Q.value?.text.trim()), ut = s(() => {
593
+ let e = Q.value;
594
+ if (!e) return;
595
+ let { fill: t, edge: n } = j[I.value];
596
+ return {
597
+ left: `${e.at.x / z.value.width * 100}%`,
598
+ top: `${e.at.y / z.value.height * 100}%`,
599
+ fontFamily: ce,
600
+ fontSize: `${be(z.value) * G.value}px`,
601
+ lineHeight: String(pe),
602
+ color: t,
603
+ "--pk-image-editor-text-edge": n
604
+ };
605
+ });
606
+ D(N, () => {
607
+ q.value = void 0, Y.value = void 0, $();
608
+ }), i({
609
+ pending: s(() => et.value || lt.value),
610
+ applyPending: () => {
611
+ tt(), $();
612
+ },
613
+ shownCanvas: () => V
614
+ });
615
+ function dt(e, t) {
616
+ return Math.hypot(t.x - e.x, t.y - e.y);
617
+ }
618
+ return (n, i) => {
619
+ let s = a, c = t, m = r;
620
+ return v(), u("div", Ae, [
621
+ d("div", je, [
622
+ p(e, {
623
+ modelValue: N.value,
624
+ "onUpdate:modelValue": i[0] ||= (e) => N.value = e,
625
+ name: "pk-image-editor-tool",
626
+ segmented: "",
627
+ class: "mb-0",
628
+ "aria-label": S(M)("imageEditor.tool"),
629
+ options: ue.value
630
+ }, f({ _: 2 }, [b(ue.value, (e) => ({
631
+ name: e.value,
632
+ fn: O(() => [d("span", {
633
+ class: "pk-image-editor__tool",
634
+ title: e.label
635
+ }, [p(s, {
636
+ name: e.icon,
637
+ class: "w-16 h-16"
638
+ }, null, 8, ["name"]), d("span", Ne, x(e.label), 1)], 8, Me)])
639
+ }))]), 1032, [
640
+ "modelValue",
641
+ "aria-label",
642
+ "options"
643
+ ]),
644
+ p(m, { modifiers: "compact" }, {
645
+ default: O(() => [p(c, {
646
+ modifiers: "action-quiet",
647
+ icon: "ri:anticlockwise-line",
648
+ title: S(M)("imageEditor.rotateLeft"),
649
+ "aria-label": S(M)("imageEditor.rotateLeft"),
650
+ onClick: i[1] ||= (e) => Ce(-1)
651
+ }, null, 8, ["title", "aria-label"]), p(c, {
652
+ modifiers: "action-quiet",
653
+ icon: "ri:clockwise-line",
654
+ title: S(M)("imageEditor.rotateRight"),
655
+ "aria-label": S(M)("imageEditor.rotateRight"),
656
+ onClick: i[2] ||= (e) => Ce(1)
657
+ }, null, 8, ["title", "aria-label"])]),
658
+ _: 1
659
+ }),
660
+ p(m, {
661
+ modifiers: "compact",
662
+ class: "ml-auto"
663
+ }, {
664
+ default: O(() => [p(c, {
665
+ modifiers: "action-quiet",
666
+ icon: "ri:arrow-go-back-line",
667
+ title: S(M)("imageEditor.undo"),
668
+ "aria-label": S(M)("imageEditor.undo"),
669
+ disabled: !A.value.length,
670
+ onClick: xe
671
+ }, null, 8, [
672
+ "title",
673
+ "aria-label",
674
+ "disabled"
675
+ ]), p(c, {
676
+ modifiers: "action-quiet",
677
+ icon: "ri:arrow-go-forward-line",
678
+ title: S(M)("imageEditor.redo"),
679
+ "aria-label": S(M)("imageEditor.redo"),
680
+ disabled: !L.value.length,
681
+ onClick: Se
682
+ }, null, 8, [
683
+ "title",
684
+ "aria-label",
685
+ "disabled"
686
+ ])]),
687
+ _: 1
688
+ })
689
+ ]),
690
+ d("div", Pe, [N.value === "crop" ? (v(), u(o, { key: 0 }, [
691
+ d("span", {
692
+ id: S(ge),
693
+ class: "pk-image-editor__label"
694
+ }, x(S(M)("imageEditor.aspect")), 9, Fe),
695
+ p(e, {
696
+ modelValue: P.value,
697
+ "onUpdate:modelValue": i[3] ||= (e) => P.value = e,
698
+ name: "pk-image-editor-aspect",
699
+ segmented: "",
700
+ class: "mb-0",
701
+ "aria-labelledby": S(ge),
702
+ options: de.value
703
+ }, null, 8, [
704
+ "modelValue",
705
+ "aria-labelledby",
706
+ "options"
707
+ ]),
708
+ d("span", Ie, x(S(M)("imageEditor.cropHint")), 1),
709
+ p(c, {
710
+ class: "ml-auto",
711
+ modifiers: "secondary",
712
+ label: S(M)("action.apply"),
713
+ disabled: !et.value,
714
+ onClick: tt
715
+ }, null, 8, ["label", "disabled"])
716
+ ], 64)) : N.value === "cover" ? (v(), u(o, { key: 1 }, [p(e, {
717
+ modelValue: F.value,
718
+ "onUpdate:modelValue": i[4] ||= (e) => F.value = e,
719
+ name: "pk-image-editor-cover",
720
+ segmented: "",
721
+ class: "mb-0",
722
+ "aria-label": S(M)("imageEditor.coverStyle"),
723
+ options: fe.value
724
+ }, null, 8, [
725
+ "modelValue",
726
+ "aria-label",
727
+ "options"
728
+ ]), d("span", Le, x(S(M)("imageEditor.coverHint")), 1)], 64)) : (v(), u(o, { key: 2 }, [
729
+ d("span", {
730
+ id: S(_e),
731
+ class: "pk-image-editor__label"
732
+ }, x(S(M)("imageEditor.color")), 9, Re),
733
+ p(e, {
734
+ modelValue: I.value,
735
+ "onUpdate:modelValue": i[5] ||= (e) => I.value = e,
736
+ name: "pk-image-editor-color",
737
+ segmented: "",
738
+ class: "mb-0",
739
+ "aria-labelledby": S(_e),
740
+ options: me.value
741
+ }, f({ _: 2 }, [b(me.value, (e) => ({
742
+ name: e.value,
743
+ fn: O(() => [d("span", {
744
+ class: "pk-image-editor__color",
745
+ title: e.label
746
+ }, [d("span", {
747
+ class: "pk-image-editor__swatch",
748
+ style: _({ backgroundColor: S(j)[e.value].fill })
749
+ }, null, 4), d("span", Be, x(e.label), 1)], 8, ze)])
750
+ }))]), 1032, [
751
+ "modelValue",
752
+ "aria-labelledby",
753
+ "options"
754
+ ]),
755
+ d("span", Ve, x(he.value), 1)
756
+ ], 64))]),
757
+ d("div", {
758
+ ref_key: "areaEl",
759
+ ref: U,
760
+ class: "pk-image-editor__area"
761
+ }, [d("div", {
762
+ ref_key: "frameEl",
763
+ ref: K,
764
+ class: g(["pk-image-editor__frame", { "pk-image-editor__frame--text": N.value === "text" }]),
765
+ style: _(Oe.value),
766
+ onPointerdown: qe,
767
+ onPointermove: Je,
768
+ onPointerup: Ye,
769
+ onPointercancel: Xe
770
+ }, [
771
+ d("div", {
772
+ ref_key: "stageEl",
773
+ ref: B,
774
+ class: "pk-image-editor__stage"
775
+ }, null, 512),
776
+ d("canvas", {
777
+ ref_key: "draftEl",
778
+ ref: Qe,
779
+ class: "pk-image-editor__draft",
780
+ width: "0",
781
+ height: "0",
782
+ "aria-hidden": "true"
783
+ }, null, 512),
784
+ q.value ? (v(), u("div", {
785
+ key: 0,
786
+ class: g(["pk-image-editor__selection", `pk-image-editor__selection--${N.value}`]),
787
+ style: _(nt.value)
788
+ }, null, 6)) : l("", !0),
789
+ Q.value ? k((v(), u("textarea", {
790
+ key: 1,
791
+ ref_key: "textEl",
792
+ ref: rt,
793
+ "onUpdate:modelValue": i[6] ||= (e) => Q.value.text = e,
794
+ class: "pk-image-editor__text",
795
+ rows: "1",
796
+ maxlength: Ge,
797
+ "aria-label": S(M)("imageEditor.textLabel"),
798
+ style: _(ut.value),
799
+ onPointerdown: i[7] ||= ae(() => {}, ["stop"]),
800
+ onInput: ct,
801
+ onKeydown: [ie(ot, ["enter"]), ie(st, ["esc"])],
802
+ onBlur: $
803
+ }, null, 44, He)), [[E, Q.value.text]]) : l("", !0)
804
+ ], 38)], 512)
805
+ ]);
806
+ };
807
+ }
808
+ }), X = ["aria-label"], Ke = {
809
+ key: 3,
810
+ class: "pk-image-editor-dialog__size"
811
+ }, qe = /* @__PURE__ */ m({
812
+ __name: "PkImageEditorDialog",
813
+ props: {
814
+ file: {},
815
+ initialTool: {}
816
+ },
817
+ emits: ["close", "apply"],
818
+ setup(e, { emit: o }) {
819
+ let d = e, f = o, { t: m } = oe({ useScope: "global" }), h = A("(max-width: 575.98px)"), g = re(), _ = re(), b = y(), C = y([]), w = y(!1), E = T("editorEl"), D = !1;
820
+ ne(async () => {
821
+ try {
822
+ let e = await d.file, t = await V(e);
823
+ if (D) {
824
+ H(t.image);
825
+ return;
826
+ }
827
+ g.value = e, _.value = t;
828
+ } catch {
829
+ b.value = "load";
830
+ }
831
+ }), te(() => {
832
+ D = !0, _.value && H(_.value.image);
833
+ });
834
+ let k = s(() => _.value && ve(_.value.image, C.value)), ie = s(() => !!_.value && _.value.image.width < _.value.original.width), ae = s(() => C.value.length > 0 || !!E.value?.pending);
835
+ async function se() {
836
+ let e = E.value, t = g.value;
837
+ if (e && t) {
838
+ if (e.applyPending(), !C.value.length) f("close");
839
+ else {
840
+ b.value = void 0, w.value = !0;
841
+ try {
842
+ await ee();
843
+ let n = e.shownCanvas();
844
+ if (b.value === "draw") return;
845
+ if (!n) throw Error("No image drawn");
846
+ let r = await De(n, t.type);
847
+ f("apply", new File([r], B(t.name, t.type, r.type), {
848
+ type: r.type,
849
+ lastModified: Date.now()
850
+ }));
851
+ } catch {
852
+ b.value = "export";
853
+ } finally {
854
+ w.value = !1;
855
+ }
856
+ }
857
+ }
858
+ }
859
+ let j = s(() => {
860
+ switch (b.value) {
861
+ case "export": return m("imageEditor.exportFailed");
862
+ case "draw": return m("imageEditor.drawFailed");
863
+ default: return m("imageEditor.loadFailed");
864
+ }
865
+ });
866
+ return (o, s) => {
867
+ let d = n, ee = a, g = t, te = r, ne = i;
868
+ return v(), c(ne, {
869
+ "model-value": !0,
870
+ title: S(m)("imageEditor.title"),
871
+ modifiers: S(h) ? "fullscreen" : void 0,
872
+ "keep-open": "",
873
+ class: "pk-image-editor-dialog",
874
+ "onUpdate:modelValue": s[3] ||= (e) => !e && f("close")
875
+ }, {
876
+ footer: O(() => [p(te, null, {
877
+ default: O(() => [p(g, {
878
+ modifiers: "secondary",
879
+ label: S(m)("action.cancel"),
880
+ onClick: s[2] ||= (e) => f("close")
881
+ }, null, 8, ["label"]), p(g, {
882
+ label: S(m)("imageEditor.use"),
883
+ loading: w.value,
884
+ disabled: w.value || !ae.value || b.value === "draw",
885
+ onClick: se
886
+ }, null, 8, [
887
+ "label",
888
+ "loading",
889
+ "disabled"
890
+ ])]),
891
+ _: 1
892
+ })]),
893
+ default: O(() => [
894
+ b.value ? (v(), c(d, {
895
+ key: 0,
896
+ modifiers: "danger",
897
+ class: "m-md",
898
+ content: j.value
899
+ }, null, 8, ["content"])) : l("", !0),
900
+ _.value && b.value !== "draw" ? (v(), c(Y, {
901
+ key: 1,
902
+ ref_key: "editorEl",
903
+ ref: E,
904
+ edits: C.value,
905
+ "onUpdate:edits": s[0] ||= (e) => C.value = e,
906
+ image: _.value.image,
907
+ "initial-tool": e.initialTool,
908
+ onError: s[1] ||= (e) => b.value = "draw"
909
+ }, null, 8, [
910
+ "edits",
911
+ "image",
912
+ "initial-tool"
913
+ ])) : b.value ? l("", !0) : (v(), u("div", {
914
+ key: 2,
915
+ class: "pk-image-editor-dialog__loading",
916
+ role: "status",
917
+ "aria-label": S(m)("imageEditor.loading")
918
+ }, [p(ee, { name: "loading-loop" })], 8, X)),
919
+ k.value ? (v(), u("p", Ke, x(ie.value ? S(m)("imageEditor.sizeScaledDown", {
920
+ width: k.value.width,
921
+ height: k.value.height
922
+ }) : S(m)("imageEditor.size", {
923
+ width: k.value.width,
924
+ height: k.value.height
925
+ })), 1)) : l("", !0)
926
+ ]),
927
+ _: 1
928
+ }, 8, ["title", "modifiers"]);
929
+ };
930
+ }
931
+ });
932
+ export { qe as default };
933
+
934
+ //# sourceMappingURL=PkImageEditorDialog-Dn3HV_ny.js.map