@8wave/ai-elements 0.125.0-beta.39 → 0.125.0-beta.40

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