@cling-se/widget 0.17.0 → 1.0.0-beta.2

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 (232) hide show
  1. package/dist/AddClientCallout-e8d19R3f.js +101 -0
  2. package/dist/AnswerModal-BGvB8IVV.js +3291 -0
  3. package/dist/AttachmentItem-CkHbAm4l.js +171 -0
  4. package/dist/BaseUpload-BiJBcWRu.js +2472 -0
  5. package/dist/BlockMedia-CW5wgipC.js +103 -0
  6. package/dist/CCallout-Cy2eeIYd.js +104 -0
  7. package/dist/{CCurrencyDropdown-C2rXt2cJ.js → CCurrencyDropdown-DE_3CTjm.js} +91 -53
  8. package/dist/CDropdownItem-Dmq5gYzA.js +751 -0
  9. package/dist/CFormField.vue_vue_type_script_setup_true_lang-D_U9coAY.js +292 -0
  10. package/dist/{CPhoneFormat-C8VPsiK6.js → CPhoneFormat-BS2nP9kc.js} +13 -21
  11. package/dist/CPhoneInput-Bf6329PO.js +207 -0
  12. package/dist/CPriceInput-d1yjuMQr.js +140 -0
  13. package/dist/CSelect-DgnT07Hk.js +98 -0
  14. package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-Ckl--dyv.js +51 -0
  15. package/dist/ClientAutocomplete-9JzGcO9O.js +532 -0
  16. package/dist/ClientModal-BzWQtWSZ.js +1181 -0
  17. package/dist/ColorPicker-BvoFN8nu.js +1408 -0
  18. package/dist/CompanyModal-Bp4V_az9.js +250 -0
  19. package/dist/ContentWrapper-CuH6xKmo.js +265 -0
  20. package/dist/CoverBlockSettings-BA5L0Zee.js +861 -0
  21. package/dist/DocAnswer-BcNA_KEg.js +33 -0
  22. package/dist/DocDetails-CStEwWnU.js +448 -0
  23. package/dist/DocForm-BOoILf5E.js +6748 -0
  24. package/dist/DocFormSend-CQIf-HJY.js +171 -0
  25. package/dist/DocLinks-BRX5QzNe.js +36 -0
  26. package/dist/DocModalBase-D72yWj-x.js +29 -0
  27. package/dist/DocPrint-BI1LXUPE.js +399 -0
  28. package/dist/DocReceipt-DaZ4V76p.js +341 -0
  29. package/dist/DocSendReminder-DKGZlo7s.js +181 -0
  30. package/dist/DocTextEditor-Dm-cTZpA.js +19413 -0
  31. package/dist/DocTimeline-DCwofzuk.js +537 -0
  32. package/dist/DocumentClient-vJdxCB53.js +90 -0
  33. package/dist/DocumentLayout-CKSi42ev.js +1368 -0
  34. package/dist/DocumentLogotype-DbQlvQ-y.js +162 -0
  35. package/dist/DocumentVoided-CRX2WxWO.js +33 -0
  36. package/dist/EmbedInput-B-oeC4Wy.js +157 -0
  37. package/dist/EmbedSettings-B9Yka2yB.js +103 -0
  38. package/dist/ErrorCallout-B_ygH33E.js +34 -0
  39. package/dist/FilePreviewModal-Bf3ELTow.js +202 -0
  40. package/dist/Flag-BwTgCNHO.js +41 -0
  41. package/dist/HeaderSettings-DvC7nlyY.js +720 -0
  42. package/dist/ImageSelectModal-D3sP3lhR.js +119 -0
  43. package/dist/ImageUploadWrapper-RWNa-yIq.js +1585 -0
  44. package/dist/Index-0_3ULrWX.js +126 -0
  45. package/dist/Index-4NPe0sfX.js +629 -0
  46. package/dist/Index-B1uA0FF6.js +4 -0
  47. package/dist/Index-BBkCYm2q.js +201 -0
  48. package/dist/{Index-LzN6dktq.js → Index-BBwvo7S9.js} +10 -18
  49. package/dist/Index-BEMlsYwJ.js +68 -0
  50. package/dist/Index-BRBhJ6kz.js +21 -0
  51. package/dist/{Index-BPUYpfLJ.js → Index-BTFmHjUt.js} +47 -60
  52. package/dist/Index-BcUNnxLC.js +1098 -0
  53. package/dist/Index-Bo6ExBUL.js +93 -0
  54. package/dist/Index-BvMPCgdH.js +102 -0
  55. package/dist/Index-Bx5TOI9k.js +74 -0
  56. package/dist/Index-C7GZS8EI.js +16 -0
  57. package/dist/Index-CNWhm07R.js +25 -0
  58. package/dist/{Index-BUK-1yVR.js → Index-CQpznMKV.js} +9 -17
  59. package/dist/Index-CRzsnIij.js +159 -0
  60. package/dist/Index-CeSG1C41.js +140 -0
  61. package/dist/Index-CjfjdZj5.js +52 -0
  62. package/dist/Index-CskKmZpd.js +363 -0
  63. package/dist/Index-D5qwbCo1.js +28 -0
  64. package/dist/Index-D8Ae1Txt.js +228 -0
  65. package/dist/Index-DE8aenDB.js +3452 -0
  66. package/dist/Index-DI5EB5Rt.js +39 -0
  67. package/dist/Index-DaV57YPP.js +163 -0
  68. package/dist/Index-DbwkmoyM.js +38 -0
  69. package/dist/Index-Df9skok6.js +70 -0
  70. package/dist/{Index-BHJGfHm9.js → Index-DfLLA0ij.js} +313 -206
  71. package/dist/Index-Dw1CO5F9.js +76 -0
  72. package/dist/Index-PZXyOoVb.js +87 -0
  73. package/dist/{Index-BioOegOO.js → Index-ZUnH-BHj.js} +10 -18
  74. package/dist/Index-cjKGSiDi.js +136 -0
  75. package/dist/Index-m-goRuKD.js +49 -0
  76. package/dist/Index-rGeWbLcB.js +47 -0
  77. package/dist/Index-vrljNp6G.js +28 -0
  78. package/dist/Index.vue_vue_type_script_lang-aeVuChGF.js +671 -0
  79. package/dist/InputToggleRow-v6qAWPg6.js +99 -0
  80. package/dist/ManualPopover-BONBJIUA.js +57 -0
  81. package/dist/MediaWrapper-CXb2UGd9.js +18 -0
  82. package/dist/{NotBindingText-CM3FN0A6.js → NotBindingText-BqESO13N.js} +13 -17
  83. package/dist/PackageGroup-AIysVmyh.js +1058 -0
  84. package/dist/PdfTerms-BlhHdTu3.js +34 -0
  85. package/dist/PdfViewer-DwZ1rwlN.js +392 -0
  86. package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D6NNUTz0.js +17 -0
  87. package/dist/PriceHeader-C4XhnoA3.js +488 -0
  88. package/dist/SearchApi-B7lXgUY6.js +137 -0
  89. package/dist/SendForm-BcD0xSvB.js +7031 -0
  90. package/dist/Setup-C2qaYDei.js +47 -0
  91. package/dist/{SmartList-DhhjSWLO.js → SmartList-DqG7Q5t7.js} +16 -24
  92. package/dist/Sortable.vue_vue_type_script_setup_true_lang-CzMbr8AX.js +1303 -0
  93. package/dist/{TermsSettings-BEQwmkFH.js → TermsSettings-BOCONyM4.js} +169 -56
  94. package/dist/ThemeColorRow-sjGdMzGN.js +108 -0
  95. package/dist/ToggleBinding-7oq_oXPt.js +44 -0
  96. package/dist/UploadModal-C_X2NjVY.js +134 -0
  97. package/dist/VideoPlayerInput-BsUcmpl4.js +135 -0
  98. package/dist/VideoPlayerSettings-BXMmxaZQ.js +78 -0
  99. package/dist/VideoSelectModal-CW0OweCw.js +217 -0
  100. package/dist/{anime.es-BrPTThYb.js → anime.es-gdcpA-eY.js} +1 -2
  101. package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
  102. package/dist/{debounce-D0hKNU85.js → debounce-DNl99Gyo.js} +10 -10
  103. package/dist/dom-CkTGWrfu.js +69 -0
  104. package/dist/{focusDrawerMixin-C_aTLmK0.js → focusDrawerMixin-BwcErMDY.js} +1 -1
  105. package/dist/{formDrawerState-Da4mcbab.js → formDrawerState-DaurePnd.js} +2 -2
  106. package/dist/helpers-CPW--XIz.js +44 -0
  107. package/dist/index-BjiGCJPI.js +149 -0
  108. package/dist/index-CFNv6OvX.js +188 -0
  109. package/dist/index-Cx71On5Z.js +508 -0
  110. package/dist/index-DKMxIBz_.js +270 -0
  111. package/dist/index-DKf5SGLD.js +125 -0
  112. package/dist/index-E32WgUp9.js +3525 -0
  113. package/dist/index-kp-GC5I0.js +513 -0
  114. package/dist/index.es.js +2 -5
  115. package/dist/index.umd.js +285 -1485
  116. package/dist/{main-BgzLHIoo.js → main-Cb-nyil1.js} +41414 -42507
  117. package/dist/mapFormMixin-D3BihYWW.js +1544 -0
  118. package/dist/omit--YYr41Xp.js +31 -0
  119. package/dist/{publicSenderState-DB4BHByV.js → publicSenderState-CdRW_Wwp.js} +4 -4
  120. package/dist/splitpanes-D-ThFkeR.js +342 -0
  121. package/dist/style.css +1 -4
  122. package/dist/template-BvaNnq-g.js +1493 -0
  123. package/dist/{throttle-DT2UVOqm.js → throttle-D-bUGaVh.js} +2 -2
  124. package/dist/tippy.esm-BmKNqohP.js +1994 -0
  125. package/dist/useTermsModal-Dhf6_eYb.js +87 -0
  126. package/dist/{utils-nos8CB1L.js → utils-CBPcYdLv.js} +8 -11
  127. package/dist/validation-DOcUOoMe.js +40 -0
  128. package/package.json +18 -21
  129. package/dist/AddClientCallout-BJzBdba1.js +0 -48
  130. package/dist/AnswerModal-frHq1g4s.js +0 -3874
  131. package/dist/AttachmentItem-BaN0OrEV.js +0 -85
  132. package/dist/BaseDatePicker-B-AfdrSb.js +0 -3187
  133. package/dist/BaseUpload-CY3lTcte.js +0 -1977
  134. package/dist/BlockMedia-Bb5wQIDg.js +0 -76
  135. package/dist/CCallout-5quI6yyk.js +0 -58
  136. package/dist/CDropdownItem-CaoSQX6X.js +0 -640
  137. package/dist/CFormField-Dd2Y71JG.js +0 -240
  138. package/dist/CPhoneInput-BU1t6eo_.js +0 -138
  139. package/dist/CPriceInput-pv2aIVkH.js +0 -116
  140. package/dist/CSelect-CrM45B7V.js +0 -91
  141. package/dist/CSkeleton-BkvONMqL.js +0 -55
  142. package/dist/ClientAutocomplete-BRXIKQSk.js +0 -438
  143. package/dist/ClientModal-CvHAptV2.js +0 -666
  144. package/dist/ColorPicker-RgoXRrud.js +0 -2879
  145. package/dist/CompanyModal-OL4bD9Gk.js +0 -147
  146. package/dist/ContentWrapper-8HduCnR4.js +0 -190
  147. package/dist/CoverBlockSettings-DUv8AcdX.js +0 -659
  148. package/dist/DocAnswer-DiyFfpT2.js +0 -36
  149. package/dist/DocDetails-BxNRfBnK.js +0 -263
  150. package/dist/DocForm-MGp-o0pu.js +0 -5017
  151. package/dist/DocFormSend-q_QuVCqh.js +0 -146
  152. package/dist/DocLinks-DGDdp30U.js +0 -38
  153. package/dist/DocModalBase-qG4RqwBn.js +0 -28
  154. package/dist/DocPrint-Cln3kt0g.js +0 -240
  155. package/dist/DocReceipt-nbsJ-ukZ.js +0 -217
  156. package/dist/DocSendReminder-B3qdqduf.js +0 -140
  157. package/dist/DocTextEditor-CQDnjnRY.js +0 -17193
  158. package/dist/DocTimeline-CgKHoDcG.js +0 -485
  159. package/dist/DocumentClient-UZlnIlz5.js +0 -136
  160. package/dist/DocumentLayout-Dvr4zgyF.js +0 -4880
  161. package/dist/DocumentLogotype-mAVgMRHr.js +0 -92
  162. package/dist/DocumentVoided-BXYNrf_6.js +0 -25
  163. package/dist/EmbedInput-YRUrw3c6.js +0 -117
  164. package/dist/EmbedSettings-DvRreF7H.js +0 -74
  165. package/dist/ErrorCallout-DVknpLVY.js +0 -27
  166. package/dist/FilePreviewModal-DC56FaGy.js +0 -81
  167. package/dist/Flag-D5iZLESg.js +0 -46
  168. package/dist/HeaderSettings-DXZnZL7A.js +0 -440
  169. package/dist/ImageSelectModal-Bu4_xZga.js +0 -86
  170. package/dist/ImageUploadWrapper-CtZhkAm1.js +0 -1604
  171. package/dist/Index-B1dJO6Bk.js +0 -54
  172. package/dist/Index-B3pz1coY.js +0 -150
  173. package/dist/Index-BHgW8EHW.js +0 -2446
  174. package/dist/Index-BNucs2O-.js +0 -154
  175. package/dist/Index-BW-EtZ1z.js +0 -55
  176. package/dist/Index-BjKACpun.js +0 -66
  177. package/dist/Index-C94BL4uU.js +0 -294
  178. package/dist/Index-CB57haU8.js +0 -58
  179. package/dist/Index-CP17iXT6.js +0 -25
  180. package/dist/Index-CUSbvjoD.js +0 -62
  181. package/dist/Index-CVnD6jo5.js +0 -25
  182. package/dist/Index-Ci5zdPeT.js +0 -28
  183. package/dist/Index-CikqSMjb.js +0 -41
  184. package/dist/Index-CxO4tJ3U.js +0 -26
  185. package/dist/Index-D4J4BpHd.js +0 -230
  186. package/dist/Index-DAQQQlut.js +0 -754
  187. package/dist/Index-DNxSR72J.js +0 -73
  188. package/dist/Index-DPuKRwmu.js +0 -41
  189. package/dist/Index-DSy8QG8T.js +0 -32
  190. package/dist/Index-DX6_D-J-.js +0 -77
  191. package/dist/Index-Dk0KaIKg.js +0 -643
  192. package/dist/Index-Hkzoh9QR.js +0 -24
  193. package/dist/Index-KsHJxWAa.js +0 -94
  194. package/dist/Index-TtItTuv6.js +0 -33
  195. package/dist/Index-YAD39Qvg.js +0 -146
  196. package/dist/Index-eh909lAz.js +0 -107
  197. package/dist/Index-otowKI_C.js +0 -56
  198. package/dist/Index-t_oVV8Rc.js +0 -84
  199. package/dist/Index-vG96oEXZ.js +0 -144
  200. package/dist/InputToggleRow-CcqJDguN.js +0 -57
  201. package/dist/ManualPopover-BE2IN-XU.js +0 -60
  202. package/dist/MediaWrapper-lnGUFiyc.js +0 -23
  203. package/dist/PackageGroup-BsmxOMLW.js +0 -704
  204. package/dist/PdfTerms-BgYwZoAZ.js +0 -31
  205. package/dist/PdfViewer-C0lDpjte.js +0 -383
  206. package/dist/PlainHtml-5YwYVj1v.js +0 -27
  207. package/dist/PriceHeader-CxqhpGS-.js +0 -338
  208. package/dist/SearchApi-BndaIbri.js +0 -161
  209. package/dist/SendForm-D7U9fG-5.js +0 -1023
  210. package/dist/Setup-CmAK2_ZT.js +0 -50
  211. package/dist/ThemeColorRow-BlnhzebY.js +0 -69
  212. package/dist/ToggleBinding-t_58JFya.js +0 -42
  213. package/dist/UploadModal-T-WpYNsN.js +0 -95
  214. package/dist/VideoPlayerInput-DKHKjMgX.js +0 -97
  215. package/dist/VideoPlayerSettings-DDMlUvSt.js +0 -61
  216. package/dist/VideoSelectModal-B9bbP0dd.js +0 -104
  217. package/dist/answerDocumentMixin-DXI_E5Kx.js +0 -51
  218. package/dist/dom-CWsqMElk.js +0 -71
  219. package/dist/formValidationMixin-WZ2lGndu.js +0 -49
  220. package/dist/index-B2l57ilt.js +0 -102
  221. package/dist/index-COKDjmM2.js +0 -167
  222. package/dist/index-HtKGcIng.js +0 -2700
  223. package/dist/index-LQ7NztTt.js +0 -81
  224. package/dist/index-fx5gR8fM.js +0 -351
  225. package/dist/index-zXXJrTvv.js +0 -492
  226. package/dist/mapFormMixin-CQgSN7dv.js +0 -3028
  227. package/dist/omit-ScS7B6c5.js +0 -31
  228. package/dist/simplebar.min-B0cB_p8g.js +0 -71
  229. package/dist/splitpanes-BHUVsCZF.js +0 -382
  230. package/dist/tippy.esm-CR89mtdY.js +0 -1805
  231. package/dist/vuedraggable.umd-CkXXkt1b.js +0 -3161
  232. package/dist/vuex.esm-DKGl8mcw.js +0 -467
@@ -0,0 +1,1585 @@
1
+ import re from "./BaseUpload-BiJBcWRu.js";
2
+ import { o as w, c as y, S as B, b as T, e as A, w as $, F as Et, k as Ct, aq as nt, E as Bt, G as Ut, Z as ot, ao as At, f as pt, _ as kt, d as Ft, s as gt, B as ae, v as he, aA as ce } from "./main-Cb-nyil1.js";
3
+ function Tt(t, e) {
4
+ var i = Object.keys(t);
5
+ if (Object.getOwnPropertySymbols) {
6
+ var o = Object.getOwnPropertySymbols(t);
7
+ e && (o = o.filter(function(s) {
8
+ return Object.getOwnPropertyDescriptor(t, s).enumerable;
9
+ })), i.push.apply(i, o);
10
+ }
11
+ return i;
12
+ }
13
+ function v(t) {
14
+ for (var e = 1; e < arguments.length; e++) {
15
+ var i = arguments[e] != null ? arguments[e] : {};
16
+ e % 2 ? Tt(Object(i), !0).forEach(function(o) {
17
+ C(t, o, i[o]);
18
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : Tt(Object(i)).forEach(function(o) {
19
+ Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(i, o));
20
+ });
21
+ }
22
+ return t;
23
+ }
24
+ function C(t, e, i) {
25
+ return e in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
26
+ }
27
+ function le(t, e) {
28
+ if (t == null) return {};
29
+ var i, o, s = function(a, h) {
30
+ if (a == null) return {};
31
+ var r, c, l = {}, u = Object.keys(a);
32
+ for (c = 0; c < u.length; c++) r = u[c], h.indexOf(r) >= 0 || (l[r] = a[r]);
33
+ return l;
34
+ }(t, e);
35
+ if (Object.getOwnPropertySymbols) {
36
+ var n = Object.getOwnPropertySymbols(t);
37
+ for (o = 0; o < n.length; o++) i = n[o], e.indexOf(i) >= 0 || Object.prototype.propertyIsEnumerable.call(t, i) && (s[i] = t[i]);
38
+ }
39
+ return s;
40
+ }
41
+ function k(t) {
42
+ return function(e) {
43
+ if (Array.isArray(e)) return ht(e);
44
+ }(t) || function(e) {
45
+ if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null) return Array.from(e);
46
+ }(t) || function(e, i) {
47
+ if (e) {
48
+ if (typeof e == "string") return ht(e, i);
49
+ var o = Object.prototype.toString.call(e).slice(8, -1);
50
+ if (o === "Object" && e.constructor && (o = e.constructor.name), o === "Map" || o === "Set") return Array.from(e);
51
+ if (o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) return ht(e, i);
52
+ }
53
+ }(t) || function() {
54
+ throw new TypeError(`Invalid attempt to spread non-iterable instance.
55
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
56
+ }();
57
+ }
58
+ function ht(t, e) {
59
+ (e == null || e > t.length) && (e = t.length);
60
+ for (var i = 0, o = new Array(e); i < e; i++) o[i] = t[i];
61
+ return o;
62
+ }
63
+ var Wt, ue, Q, z = (Wt = function(t) {
64
+ /*!
65
+ Copyright (c) 2018 Jed Watson.
66
+ Licensed under the MIT License (MIT), see
67
+ http://jedwatson.github.io/classnames
68
+ */
69
+ (function() {
70
+ var e = {}.hasOwnProperty;
71
+ function i() {
72
+ for (var o = [], s = 0; s < arguments.length; s++) {
73
+ var n = arguments[s];
74
+ if (n) {
75
+ var a = typeof n;
76
+ if (a === "string" || a === "number") o.push(n);
77
+ else if (Array.isArray(n)) {
78
+ if (n.length) {
79
+ var h = i.apply(null, n);
80
+ h && o.push(h);
81
+ }
82
+ } else if (a === "object") if (n.toString === Object.prototype.toString) for (var r in n) e.call(n, r) && n[r] && o.push(r);
83
+ else o.push(n.toString());
84
+ }
85
+ }
86
+ return o.join(" ");
87
+ }
88
+ t.exports ? (i.default = i, t.exports = i) : window.classNames = i;
89
+ })();
90
+ }, Wt(Q = { path: ue, exports: {}, require: function(t, e) {
91
+ return function() {
92
+ throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
93
+ }(e == null && Q.path);
94
+ } }, Q.exports), Q.exports), O = function(t) {
95
+ return function(e, i) {
96
+ if (!e) return t;
97
+ var o;
98
+ typeof e == "string" ? o = e : i = e;
99
+ var s = t;
100
+ return o && (s += "__" + o), s + (i ? Object.keys(i).reduce(function(n, a) {
101
+ var h = i[a];
102
+ return h && (n += " " + (typeof h == "boolean" ? s + "--" + a : s + "--" + a + "_" + h)), n;
103
+ }, "") : "");
104
+ };
105
+ };
106
+ function ft(t, e, i) {
107
+ var o, s, n, a, h;
108
+ function r() {
109
+ var l = Date.now() - a;
110
+ l < e && l >= 0 ? o = setTimeout(r, e - l) : (o = null, i || (h = t.apply(n, s), n = s = null));
111
+ }
112
+ e == null && (e = 100);
113
+ var c = function() {
114
+ n = this, s = arguments, a = Date.now();
115
+ var l = i && !o;
116
+ return o || (o = setTimeout(r, e)), l && (h = t.apply(n, s), n = s = null), h;
117
+ };
118
+ return c.clear = function() {
119
+ o && (clearTimeout(o), o = null);
120
+ }, c.flush = function() {
121
+ o && (h = t.apply(n, s), n = s = null, clearTimeout(o), o = null);
122
+ }, c;
123
+ }
124
+ ft.debounce = ft;
125
+ var vt = ft, p = function() {
126
+ return p = Object.assign || function(t) {
127
+ for (var e, i = 1, o = arguments.length; i < o; i++) for (var s in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
128
+ return t;
129
+ }, p.apply(this, arguments);
130
+ };
131
+ /*! *****************************************************************************
132
+ Copyright (c) Microsoft Corporation.
133
+
134
+ Permission to use, copy, modify, and/or distribute this software for any
135
+ purpose with or without fee is hereby granted.
136
+
137
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
138
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
139
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
140
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
141
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
142
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
143
+ PERFORMANCE OF THIS SOFTWARE.
144
+ ***************************************************************************** */
145
+ function Xt(t, e) {
146
+ var i, o;
147
+ return t && e ? (i = "" + t + e[0].toUpperCase() + e.slice(1), o = t + "-" + e) : (i = t || e, o = t || e), { name: i, classname: o };
148
+ }
149
+ function Yt(t) {
150
+ return /^blob:/.test(t);
151
+ }
152
+ function Ot(t) {
153
+ return Yt(t) || function(e) {
154
+ return /^data:/.test(e);
155
+ }(t);
156
+ }
157
+ function F(t) {
158
+ return !!(t && t.constructor && t.call && t.apply);
159
+ }
160
+ function R(t) {
161
+ return t === void 0;
162
+ }
163
+ function it(t) {
164
+ return typeof t == "object" && t !== null;
165
+ }
166
+ function bt(t, e, i) {
167
+ var o = {};
168
+ return it(t) ? (Object.keys(e).forEach(function(s) {
169
+ R(t[s]) ? o[s] = e[s] : it(e[s]) ? it(t[s]) ? o[s] = bt(t[s], e[s], i[s]) : o[s] = t[s] ? e[s] : i[s] : e[s] === !0 || e[s] === !1 ? o[s] = !!t[s] : o[s] = t[s];
170
+ }), o) : t ? e : i;
171
+ }
172
+ function K(t) {
173
+ var e = Number(t);
174
+ return Number.isNaN(e) ? t : e;
175
+ }
176
+ function Dt(t) {
177
+ return typeof (t == "number" || /* @__PURE__ */ function(e) {
178
+ return typeof e == "object" && e !== null;
179
+ }(t) && toString.call(t) == "[object Number]") && !Nt(t);
180
+ }
181
+ function Nt(t) {
182
+ return t != t;
183
+ }
184
+ function _t(t, e) {
185
+ return Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2));
186
+ }
187
+ var q = function(t, e) {
188
+ t === void 0 && (t = {}), e === void 0 && (e = {}), this.type = "manipulateImage", this.move = t, this.scale = e;
189
+ }, de = function(t, e) {
190
+ e === void 0 && (e = {}), this.type = "resize", this.directions = t, this.params = e;
191
+ }, Rt = function(t) {
192
+ this.type = "move", this.directions = t;
193
+ }, me = function() {
194
+ function t(e, i, o, s, n) {
195
+ this.type = "drag", this.nativeEvent = e, this.position = o, this.previousPosition = s, this.element = i, this.anchor = n;
196
+ }
197
+ return t.prototype.shift = function() {
198
+ var e = this, i = e.element, o = e.anchor, s = e.position;
199
+ if (i) {
200
+ var n = i.getBoundingClientRect(), a = n.left, h = n.top;
201
+ return { left: s.left - a - o.left, top: s.top - h - o.top };
202
+ }
203
+ return { left: 0, top: 0 };
204
+ }, t;
205
+ }(), Mt = { name: "DraggableElement", props: { classname: { type: String } }, beforeMount: function() {
206
+ window.addEventListener("mouseup", this.onMouseUp, { passive: !1 }), window.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), window.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), window.addEventListener("touchend", this.onTouchEnd, { passive: !1 });
207
+ }, beforeUnmount: function() {
208
+ window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
209
+ }, mounted: function() {
210
+ if (!this.$refs.draggable) throw new Error('You should add ref "draggable" to your root element to use draggable mixin');
211
+ this.touches = [], this.hovered = !1;
212
+ }, methods: { onMouseOver: function() {
213
+ this.hovered || (this.hovered = !0, this.$emit("enter"));
214
+ }, onMouseLeave: function() {
215
+ this.hovered && !this.touches.length && (this.hovered = !1, this.$emit("leave"));
216
+ }, onTouchStart: function(t) {
217
+ t.cancelable && !this.disabled && t.touches.length === 1 && (this.touches = k(t.touches), this.hovered || (this.$emit("enter"), this.hovered = !0), t.touches.length && this.initAnchor(this.touches.reduce(function(e, i) {
218
+ return { clientX: e.clientX + i.clientX / t.touches.length, clientY: e.clientY + i.clientY / t.touches.length };
219
+ }, { clientX: 0, clientY: 0 })), t.preventDefault && t.preventDefault(), t.stopPropagation());
220
+ }, onTouchEnd: function() {
221
+ this.processEnd();
222
+ }, onTouchMove: function(t) {
223
+ this.touches.length && (this.processMove(t, t.touches), t.preventDefault && t.preventDefault(), t.stopPropagation && t.stopPropagation());
224
+ }, onMouseDown: function(t) {
225
+ if (!this.disabled) {
226
+ var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
227
+ this.touches = [e], this.initAnchor(e), t.stopPropagation();
228
+ }
229
+ }, onMouseMove: function(t) {
230
+ this.touches.length && (this.processMove(t, [{ fake: !0, clientX: t.clientX, clientY: t.clientY }]), t.preventDefault && t.preventDefault());
231
+ }, onMouseUp: function() {
232
+ this.processEnd();
233
+ }, initAnchor: function(t) {
234
+ var e = this.$refs.draggable.getBoundingClientRect(), i = e.left, o = e.right, s = e.bottom, n = e.top;
235
+ this.anchor = { left: t.clientX - i, top: t.clientY - n, bottom: s - t.clientY, right: o - t.clientX };
236
+ }, processMove: function(t, e) {
237
+ var i = k(e);
238
+ if (this.touches.length) {
239
+ if (this.touches.length === 1 && i.length === 1) {
240
+ var o = this.$refs.draggable;
241
+ this.$emit("drag", new me(t, o, { left: i[0].clientX, top: i[0].clientY }, { left: this.touches[0].clientX, top: this.touches[0].clientY }, this.anchor));
242
+ }
243
+ this.touches = i;
244
+ }
245
+ }, processEnd: function() {
246
+ this.touches.length && this.$emit("drag-end"), this.hovered && (this.$emit("leave"), this.hovered = !1), this.touches = [];
247
+ } }, emits: ["drag", "drag-end", "leave", "enter"] };
248
+ Mt.render = function(t, e, i, o, s, n) {
249
+ return w(), y("div", { ref: "draggable", class: i.classname, onTouchstart: e[1] || (e[1] = function() {
250
+ return n.onTouchStart && n.onTouchStart.apply(n, arguments);
251
+ }), onMousedown: e[2] || (e[2] = function() {
252
+ return n.onMouseDown && n.onMouseDown.apply(n, arguments);
253
+ }), onMouseover: e[3] || (e[3] = function() {
254
+ return n.onMouseOver && n.onMouseOver.apply(n, arguments);
255
+ }), onMouseleave: e[4] || (e[4] = function() {
256
+ return n.onMouseLeave && n.onMouseLeave.apply(n, arguments);
257
+ }) }, [B(t.$slots, "default")], 34);
258
+ };
259
+ var ct = O("vue-handler-wrapper"), Vt = { name: "HandlerWrapper", components: { DraggableElement: Mt }, props: { horizontalPosition: { type: String }, verticalPosition: { type: String }, disabled: { type: Boolean, default: !1 } }, computed: { classes: function() {
260
+ var t;
261
+ if (this.horizontalPosition || this.verticalPosition) {
262
+ var e, i = Xt(this.horizontalPosition, this.verticalPosition);
263
+ t = ct((C(e = {}, i.classname, !0), C(e, "disabled", this.disabled), e));
264
+ } else t = ct({ disabled: this.disabled });
265
+ return { root: t, draggable: ct("draggable") };
266
+ } }, emits: ["leave", "enter", "drag", "drag-end"] };
267
+ Vt.render = function(t, e, i, o, s, n) {
268
+ var a = T("DraggableElement");
269
+ return w(), y("div", { class: n.classes.root }, [A(a, { class: n.classes.draggable, onDrag: e[1] || (e[1] = function(h) {
270
+ return t.$emit("drag", h);
271
+ }), onDragEnd: e[2] || (e[2] = function(h) {
272
+ return t.$emit("drag-end");
273
+ }), onLeave: e[3] || (e[3] = function(h) {
274
+ return t.$emit("leave");
275
+ }), onEnter: e[4] || (e[4] = function(h) {
276
+ return t.$emit("enter");
277
+ }) }, { default: $(function() {
278
+ return [B(t.$slots, "default")];
279
+ }), _: 3 }, 8, ["class"])], 2);
280
+ };
281
+ var pe = O("vue-line-wrapper"), qt = { name: "LineWrapper", components: { DraggableElement: Mt }, props: { position: { type: String, required: !0 }, disabled: { type: Boolean, default: !1 } }, computed: { classname: function() {
282
+ var t;
283
+ return pe((C(t = {}, this.position, !0), C(t, "disabled", this.disabled), t));
284
+ } }, emits: ["leave", "enter", "drag", "drag-end"] };
285
+ qt.render = function(t, e, i, o, s, n) {
286
+ var a = T("DraggableElement");
287
+ return w(), y(a, { class: n.classname, onDrag: e[1] || (e[1] = function(h) {
288
+ return t.$emit("drag", h);
289
+ }), onDragEnd: e[2] || (e[2] = function(h) {
290
+ return t.$emit("drag-end");
291
+ }), onLeave: e[3] || (e[3] = function(h) {
292
+ return t.$emit("leave");
293
+ }), onEnter: e[4] || (e[4] = function(h) {
294
+ return t.$emit("enter");
295
+ }) }, { default: $(function() {
296
+ return [B(t.$slots, "default")];
297
+ }), _: 3 }, 8, ["class"]);
298
+ };
299
+ var I = ["left", "right", "top", "bottom"], ge = ["left", "right"], fe = ["top", "bottom"], ve = ["left", "top"], be = ["fill-area", "fit-area", "stencil", "none"], It = { left: 0, top: 0, width: 0, height: 0 };
300
+ function $t(t, e, i) {
301
+ return !(i = i || ["width", "height", "left", "top"]).some(function(o) {
302
+ return t[o] !== e[o];
303
+ });
304
+ }
305
+ function H(t) {
306
+ return { left: t.left, top: t.top, right: t.left + t.width, bottom: t.top + t.height };
307
+ }
308
+ function X(t, e) {
309
+ return { left: t.left - e.left, top: t.top - e.top };
310
+ }
311
+ function M(t) {
312
+ return { left: t.left + t.width / 2, top: t.top + t.height / 2 };
313
+ }
314
+ function Z(t, e) {
315
+ var i = { left: 0, top: 0, right: 0, bottom: 0 };
316
+ return I.forEach(function(o) {
317
+ var s = e[o], n = H(t)[o];
318
+ i[o] = s !== void 0 && n !== void 0 ? o === "left" || o === "top" ? Math.max(0, s - n) : Math.max(0, n - s) : 0;
319
+ }), i;
320
+ }
321
+ function D(t, e) {
322
+ return { left: t.left - e.left, top: t.top - e.top, width: t.width + e.left + e.right, height: t.height + e.top + e.bottom };
323
+ }
324
+ function st(t) {
325
+ return { left: -t.left, top: -t.top };
326
+ }
327
+ function x(t, e) {
328
+ return p(p({}, t), { left: t.left + e.left, top: t.top + e.top });
329
+ }
330
+ function W(t, e, i, o) {
331
+ if (e !== 1) {
332
+ if (i) {
333
+ var s = M(t);
334
+ return { width: t.width * e, height: t.height * e, left: t.left + t.width * (1 - e) / 2 + (i.left - s.left) * (1 - e), top: t.top + t.height * (1 - e) / 2 + (i.top - s.top) * (1 - e) };
335
+ }
336
+ return { width: t.width * e, height: t.height * e, left: t.left + t.width * (1 - e) / 2, top: t.top + t.height * (1 - e) / 2 };
337
+ }
338
+ return t;
339
+ }
340
+ function b(t) {
341
+ return t.width / t.height;
342
+ }
343
+ function Y(t, e) {
344
+ return Math.min(e.right !== void 0 && e.left !== void 0 ? (e.right - e.left) / t.width : 1 / 0, e.bottom !== void 0 && e.top !== void 0 ? (e.bottom - e.top) / t.height : 1 / 0);
345
+ }
346
+ function N(t, e) {
347
+ var i = { left: 0, top: 0 }, o = Z(t, e);
348
+ return o.left && o.left > 0 ? i.left = o.left : o.right && o.right > 0 && (i.left = -o.right), o.top && o.top > 0 ? i.top = o.top : o.bottom && o.bottom > 0 && (i.top = -o.bottom), i;
349
+ }
350
+ function lt(t, e) {
351
+ var i;
352
+ return e.minimum && t < e.minimum ? i = e.minimum : e.maximum && t > e.maximum && (i = e.maximum), i;
353
+ }
354
+ function Zt(t, e) {
355
+ var i = b(t), o = b(e);
356
+ return e.width < 1 / 0 && e.height < 1 / 0 ? i > o ? { width: e.width, height: e.width / i } : { width: e.height * i, height: e.height } : e.width < 1 / 0 ? { width: e.width, height: e.width / i } : e.height < 1 / 0 ? { width: e.height * i, height: e.height } : t;
357
+ }
358
+ function Gt(t, e) {
359
+ var i = e * Math.PI / 180;
360
+ return { width: Math.abs(t.width * Math.cos(i)) + Math.abs(t.height * Math.sin(i)), height: Math.abs(t.width * Math.sin(i)) + Math.abs(t.height * Math.cos(i)) };
361
+ }
362
+ function U(t, e) {
363
+ var i = e * Math.PI / 180;
364
+ return { left: t.left * Math.cos(i) - t.top * Math.sin(i), top: t.left * Math.sin(i) + t.top * Math.cos(i) };
365
+ }
366
+ function rt(t, e) {
367
+ var i = Z(S(t, e), e);
368
+ return i.left + i.right + i.top + i.bottom ? i.left + i.right > i.top + i.bottom ? Math.min((t.width + i.left + i.right) / t.width, Y(t, e)) : Math.min((t.height + i.top + i.bottom) / t.height, Y(t, e)) : 1;
369
+ }
370
+ function S(t, e, i) {
371
+ i === void 0 && (i = !1);
372
+ var o = N(t, e);
373
+ return x(t, i ? st(o) : o);
374
+ }
375
+ function wt(t) {
376
+ return { width: t.right !== void 0 && t.left !== void 0 ? t.right - t.left : 1 / 0, height: t.bottom !== void 0 && t.top !== void 0 ? t.bottom - t.top : 1 / 0 };
377
+ }
378
+ function we(t, e) {
379
+ return p(p({}, t), { minWidth: Math.min(e.width, t.minWidth), minHeight: Math.min(e.height, t.minHeight), maxWidth: Math.min(e.width, t.maxWidth), maxHeight: Math.min(e.height, t.maxHeight) });
380
+ }
381
+ function Qt(t, e, i) {
382
+ i === void 0 && (i = !0);
383
+ var o = {};
384
+ return I.forEach(function(s) {
385
+ var n = t[s], a = e[s];
386
+ n !== void 0 && a !== void 0 ? o[s] = s === "left" || s === "top" ? i ? Math.max(n, a) : Math.min(n, a) : i ? Math.min(n, a) : Math.max(n, a) : a !== void 0 ? o[s] = a : n !== void 0 && (o[s] = n);
387
+ }), o;
388
+ }
389
+ function at(t, e) {
390
+ return Qt(t, e, !0);
391
+ }
392
+ function Ht(t) {
393
+ var e = t.size, i = t.aspectRatio, o = t.ignoreMinimum, s = t.sizeRestrictions;
394
+ return !!((e.correctRatio || b(e) >= i.minimum && b(e) <= i.maximum) && e.height <= s.maxHeight && e.width <= s.maxWidth && e.width && e.height && (o || e.height >= s.minHeight && e.width >= s.minWidth));
395
+ }
396
+ function Lt(t, e) {
397
+ return Math.pow(t.width - e.width, 2) + Math.pow(t.height - e.height, 2);
398
+ }
399
+ function P(t) {
400
+ var e = t.width, i = t.height, o = t.sizeRestrictions, s = { minimum: t.aspectRatio && t.aspectRatio.minimum || 0, maximum: t.aspectRatio && t.aspectRatio.maximum || 1 / 0 }, n = { width: Math.max(o.minWidth, Math.min(o.maxWidth, e)), height: Math.max(o.minHeight, Math.min(o.maxHeight, i)) };
401
+ function a(c, l) {
402
+ return l === void 0 && (l = !1), c.reduce(function(u, d) {
403
+ return Ht({ size: d, aspectRatio: s, sizeRestrictions: o, ignoreMinimum: l }) && (!u || Lt(d, { width: e, height: i }) < Lt(u, { width: e, height: i })) ? d : u;
404
+ }, null);
405
+ }
406
+ var h = [];
407
+ s && [s.minimum, s.maximum].forEach(function(c) {
408
+ c && h.push({ width: n.width, height: n.width / c, correctRatio: !0 }, { width: n.height * c, height: n.height, correctRatio: !0 });
409
+ }), Ht({ size: n, aspectRatio: s, sizeRestrictions: o }) && h.push(n);
410
+ var r = a(h) || a(h, !0);
411
+ return r && { width: r.width, height: r.height };
412
+ }
413
+ function yt(t) {
414
+ var e = t.event, i = t.coordinates, o = t.positionRestrictions, s = o === void 0 ? {} : o, n = x(i, e.directions);
415
+ return x(n, N(n, s));
416
+ }
417
+ function ye(t) {
418
+ var e = t.coordinates, i = t.transform, o = t.imageSize, s = t.sizeRestrictions, n = t.positionRestrictions, a = t.aspectRatio, h = t.visibleArea, r = function(l, u) {
419
+ return yt({ coordinates: l, positionRestrictions: n, event: new Rt({ left: u.left - l.left, top: u.top - l.top }) });
420
+ }, c = p({}, e);
421
+ return (Array.isArray(i) ? i : [i]).forEach(function(l) {
422
+ var u = {};
423
+ R((u = typeof l == "function" ? l({ coordinates: c, imageSize: o, visibleArea: h }) : l).width) && R(u.height) || (c = function(d, m) {
424
+ var g = p(p(p({}, d), P({ width: m.width, height: m.height, sizeRestrictions: s, aspectRatio: a })), { left: 0, top: 0 });
425
+ return r(g, { left: d.left, top: d.top });
426
+ }(c, p(p({}, c), u))), R(u.left) && R(u.top) || (c = r(c, p(p({}, c), u)));
427
+ }), c;
428
+ }
429
+ function ze(t) {
430
+ t.event;
431
+ var e = t.getAreaRestrictions, i = t.boundaries, o = t.coordinates, s = t.visibleArea;
432
+ t.aspectRatio;
433
+ var n = t.stencilSize, a = t.sizeRestrictions, h = t.positionRestrictions;
434
+ t.stencilReference;
435
+ var r, c, l, u = p({}, o), d = p({}, s), m = p({}, n);
436
+ r = b(m), c = b(u), l === void 0 && (l = 1e-3), (r === 0 || c === 0 ? Math.abs(c - r) < l : Math.abs(c / r) < 1 + l && Math.abs(c / r) > 1 - l) || (u = p(p({}, u), P({ sizeRestrictions: a, width: u.width, height: u.height, aspectRatio: { minimum: b(m), maximum: b(m) } })));
437
+ var g = rt(d = W(d, u.width * i.width / (d.width * m.width)), e({ visibleArea: d, type: "resize" }));
438
+ return g !== 1 && (d = W(d, g), u = W(u, g)), d = S(d = x(d, X(M(u), M(d))), e({ visibleArea: d, type: "move" })), { coordinates: u = S(u, at(H(d), h)), visibleArea: d };
439
+ }
440
+ function Ae(t) {
441
+ var e = t.event, i = t.getAreaRestrictions, o = t.boundaries, s = t.coordinates, n = t.visibleArea;
442
+ t.aspectRatio, t.stencilSize, t.sizeRestrictions;
443
+ var a = t.positionRestrictions;
444
+ t.stencilReference;
445
+ var h = p({}, s), r = p({}, n);
446
+ if (s && n && e.type !== "manipulateImage") {
447
+ var c = { width: 0, height: 0 };
448
+ r.width, o.width, b(o) > b(h) ? (c.height = 0.8 * o.height, c.width = c.height * b(h)) : (c.width = 0.8 * o.width, c.height = c.width * b(h));
449
+ var l = rt(r = W(r, h.width * o.width / (r.width * c.width)), i({ visibleArea: r, type: "resize" }));
450
+ r = W(r, l), l !== 1 && (c.height /= l, c.width /= l), r = S(r = x(r, X(M(h), M(r))), i({ visibleArea: r, type: "move" })), h = S(h, at(H(r), a));
451
+ }
452
+ return { coordinates: h, visibleArea: r };
453
+ }
454
+ function Re(t) {
455
+ var e = t.event, i = t.coordinates, o = t.visibleArea, s = t.getAreaRestrictions, n = p({}, o), a = p({}, i);
456
+ if (e.type === "setCoordinates") {
457
+ var h = Math.max(0, a.width - n.width), r = Math.max(0, a.height - n.height);
458
+ h > r ? n = W(n, Math.min(a.width / n.width, Y(n, s({ visibleArea: n, type: "resize" })))) : r > h && (n = W(n, Math.min(a.height / n.height, Y(n, s({ visibleArea: n, type: "resize" }))))), n = S(n = x(n, st(N(a, H(n)))), s({ visibleArea: n, type: "move" }));
459
+ }
460
+ return { visibleArea: n, coordinates: a };
461
+ }
462
+ function Me(t) {
463
+ var e = t.imageSize, i = t.visibleArea, o = t.coordinates, s = i || e;
464
+ return { left: (i ? i.left : 0) + s.width / 2 - o.width / 2, top: (i ? i.top : 0) + s.height / 2 - o.height / 2 };
465
+ }
466
+ function Se(t) {
467
+ var e = t.imageSize, i = t.visibleArea, o = t.aspectRatio, s = t.sizeRestrictions, n = i || e, a = Math.min(o.maximum || 1 / 0, Math.max(o.minimum || 0, b(n))), h = n.width < n.height ? { width: 0.8 * n.width, height: 0.8 * n.width / a } : { height: 0.8 * n.height, width: 0.8 * n.height * a };
468
+ return P(p(p({}, h), { aspectRatio: o, sizeRestrictions: s }));
469
+ }
470
+ function xe(t) {
471
+ var e, i, o = t.imageSize, s = t.visibleArea, n = t.boundaries, a = t.aspectRatio, h = t.sizeRestrictions, r = t.stencilSize, c = s || o;
472
+ return b(c) > b(n) ? i = (e = r.height * c.height / n.height) * b(r) : e = (i = r.width * c.width / n.width) / b(r), P({ width: i, height: e, aspectRatio: a, sizeRestrictions: h });
473
+ }
474
+ function Ee(t) {
475
+ var e = t.getAreaRestrictions, i = t.coordinates, o = t.imageSize, s = b(t.boundaries);
476
+ if (i) {
477
+ var n = { height: Math.max(i.height, o.height), width: Math.max(i.width, o.width) }, a = Zt({ width: b(n) > s ? n.width : n.height * s, height: b(n) > s ? n.width / s : n.height }, wt(e())), h = { left: i.left + i.width / 2 - a.width / 2, top: i.top + i.height / 2 - a.height / 2, width: a.width, height: a.height }, r = Z(i, H(p({ left: 0, top: 0 }, o))), c = {};
478
+ return !r.left && !r.right && h.width <= o.width && (c.left = 0, c.right = o.width), !r.top && !r.bottom && h.height <= o.height && (c.top = 0, c.bottom = o.height), S(h, c);
479
+ }
480
+ var l = b(o);
481
+ return a = { height: l > s ? o.height : o.width / s, width: l > s ? o.height * s : o.width }, { left: o.width / 2 - a.width / 2, top: o.height / 2 - a.height / 2, width: a.width, height: a.height };
482
+ }
483
+ function J(t, e) {
484
+ return Qt(t, H(e));
485
+ }
486
+ function Ce(t) {
487
+ var e = t.event, i = t.coordinates, o = t.visibleArea, s = t.sizeRestrictions, n = t.getAreaRestrictions, a = t.positionRestrictions, h = t.adjustStencil, r = e.scale, c = e.move, l = p({}, o), u = p({}, i), d = 1, m = 1, g = r.factor && Math.abs(r.factor - 1) > 1e-3;
488
+ l = x(l, { left: c.left || 0, top: c.top || 0 });
489
+ var f = { stencil: { minimum: Math.max(s.minWidth ? s.minWidth / u.width : 0, s.minHeight ? s.minHeight / u.height : 0), maximum: Math.min(s.maxWidth ? s.maxWidth / u.width : 1 / 0, s.maxHeight ? s.maxHeight / u.height : 1 / 0, Y(u, a)) }, area: { maximum: Y(l, n({ visibleArea: l, type: "resize" })) } };
490
+ r.factor && g && (r.factor < 1 ? (m = Math.max(r.factor, f.stencil.minimum)) > 1 && (m = 1) : r.factor > 1 && (m = Math.min(r.factor, Math.min(f.area.maximum, f.stencil.maximum))) < 1 && (m = 1)), m && (l = W(l, m, r.center));
491
+ var E = i.left - o.left, L = o.width + o.left - (i.width + i.left), _ = i.top - o.top, G = o.height + o.top - (i.height + i.top);
492
+ return l = S(l = x(l, N(l, { left: a.left !== void 0 ? a.left - E * m : void 0, top: a.top !== void 0 ? a.top - _ * m : void 0, bottom: a.bottom !== void 0 ? a.bottom + G * m : void 0, right: a.right !== void 0 ? a.right + L * m : void 0 })), n({ visibleArea: l, type: "move" })), u.width = u.width * m, u.height = u.height * m, u.left = l.left + E * m, u.top = l.top + _ * m, u = S(u, at(H(l), a)), r.factor && g && h && (r.factor > 1 ? d = Math.min(f.area.maximum, r.factor) / m : r.factor < 1 && (d = Math.max(u.height / l.height, u.width / l.width, r.factor / m)), d !== 1 && (l = x(l = S(l = W(l, d, r.factor > 1 ? r.center : M(u)), n({ visibleArea: l, type: "move" })), st(N(u, H(l)))))), { coordinates: u, visibleArea: l };
493
+ }
494
+ function Te(t) {
495
+ var e = t.aspectRatio, i = t.getAreaRestrictions, o = t.coordinates, s = t.visibleArea, n = t.sizeRestrictions, a = t.positionRestrictions, h = t.imageSize, r = t.previousImageSize, c = t.angle, l = p({}, o), u = p({}, s), d = U(M(p({ left: 0, top: 0 }, r)), c);
496
+ return (l = p(p({}, P({ sizeRestrictions: n, aspectRatio: e, width: l.width, height: l.height })), U(M(l), c))).left -= d.left - h.width / 2 + l.width / 2, l.top -= d.top - h.height / 2 + l.height / 2, u = W(u, rt(u, i({ visibleArea: u, type: "resize" }))), { coordinates: l = S(l, a), visibleArea: u = S(u = x(u, X(M(l), M(o))), i({ visibleArea: u, type: "move" })) };
497
+ }
498
+ function We(t) {
499
+ var e = t.flip, i = t.previousFlip, o = t.rotate, s = t.getAreaRestrictions, n = t.coordinates, a = t.visibleArea, h = t.imageSize, r = p({}, n), c = p({}, a), l = i.horizontal !== e.horizontal, u = i.vertical !== e.vertical;
500
+ if (l || u) {
501
+ var d = U({ left: h.width / 2, top: h.height / 2 }, -o), m = U(M(r), -o), g = U({ left: l ? d.left - (m.left - d.left) : m.left, top: u ? d.top - (m.top - d.top) : m.top }, o);
502
+ r = x(r, X(g, M(r))), m = U(M(c), -o), c = S(c = x(c, X(g = U({ left: l ? d.left - (m.left - d.left) : m.left, top: u ? d.top - (m.top - d.top) : m.top }, o), M(c))), s({ visibleArea: c, type: "move" }));
503
+ }
504
+ return { coordinates: r, visibleArea: c };
505
+ }
506
+ function jt(t) {
507
+ var e = t.directions, i = t.coordinates, o = t.positionRestrictions, s = o === void 0 ? {} : o, n = t.sizeRestrictions, a = t.preserveRatio, h = t.compensate, r = p({}, e), c = D(i, r).width, l = D(i, r).height;
508
+ c < 0 && (r.left < 0 && r.right < 0 ? (r.left = -(i.width - n.minWidth) / (r.left / r.right), r.right = -(i.width - n.minWidth) / (r.right / r.left)) : r.left < 0 ? r.left = -(i.width - n.minWidth) : r.right < 0 && (r.right = -(i.width - n.minWidth))), l < 0 && (r.top < 0 && r.bottom < 0 ? (r.top = -(i.height - n.minHeight) / (r.top / r.bottom), r.bottom = -(i.height - n.minHeight) / (r.bottom / r.top)) : r.top < 0 ? r.top = -(i.height - n.minHeight) : r.bottom < 0 && (r.bottom = -(i.height - n.minHeight)));
509
+ var u = Z(D(i, r), s);
510
+ h && (u.left && u.left > 0 && u.right === 0 ? (r.right += u.left, r.left -= u.left) : u.right && u.right > 0 && u.left === 0 && (r.left += u.right, r.right -= u.right), u.top && u.top > 0 && u.bottom === 0 ? (r.bottom += u.top, r.top -= u.top) : u.bottom && u.bottom > 0 && u.top === 0 && (r.top += u.bottom, r.bottom -= u.bottom), u = Z(D(i, r), s));
511
+ var d = { width: 1 / 0, height: 1 / 0, left: 1 / 0, right: 1 / 0, top: 1 / 0, bottom: 1 / 0 };
512
+ if (I.forEach(function(f) {
513
+ var E = u[f];
514
+ E && r[f] && (d[f] = Math.max(0, 1 - E / r[f]));
515
+ }), a) {
516
+ var m = Math.min.apply(null, I.map(function(f) {
517
+ return d[f];
518
+ }));
519
+ m !== 1 / 0 && I.forEach(function(f) {
520
+ r[f] *= m;
521
+ });
522
+ } else I.forEach(function(f) {
523
+ d[f] !== 1 / 0 && (r[f] *= d[f]);
524
+ });
525
+ if (c = D(i, r).width, l = D(i, r).height, r.right + r.left && (c > n.maxWidth ? d.width = (n.maxWidth - i.width) / (r.right + r.left) : c < n.minWidth && (d.width = (n.minWidth - i.width) / (r.right + r.left))), r.bottom + r.top && (l > n.maxHeight ? d.height = (n.maxHeight - i.height) / (r.bottom + r.top) : l < n.minHeight && (d.height = (n.minHeight - i.height) / (r.bottom + r.top))), a) {
526
+ var g = Math.min(d.width, d.height);
527
+ g !== 1 / 0 && I.forEach(function(f) {
528
+ r[f] *= g;
529
+ });
530
+ } else d.width !== 1 / 0 && ge.forEach(function(f) {
531
+ r[f] *= d.width;
532
+ }), d.height !== 1 / 0 && fe.forEach(function(f) {
533
+ r[f] *= d.height;
534
+ });
535
+ return r;
536
+ }
537
+ function tt(t, e, i) {
538
+ return e == 0 && i == 0 ? t / 2 : e == 0 ? 0 : i == 0 ? t : t * Math.abs(e / (e + i));
539
+ }
540
+ var Oe = O("vue-simple-handler"), De = O("vue-simple-handler-wrapper"), St = { name: "SimpleHandler", components: { HandlerWrapper: Vt }, props: { defaultClass: { type: String }, hoverClass: { type: String }, wrapperClass: { type: String }, horizontalPosition: { type: String }, verticalPosition: { type: String }, disabled: { type: Boolean, default: !1 } }, data: function() {
541
+ return { hover: !1 };
542
+ }, computed: { classes: function() {
543
+ var t, e = (C(t = {}, this.horizontalPosition, !!this.horizontalPosition), C(t, this.verticalPosition, !!this.verticalPosition), C(t, "".concat(this.horizontalPosition, "-").concat(this.verticalPosition), !!(this.verticalPosition && this.horizontalPosition)), C(t, "hover", this.hover), t);
544
+ return { default: z(Oe(e), this.defaultClass, this.hover && this.hoverClass), wrapper: z(De(e), this.wrapperClass) };
545
+ } }, methods: { onDrag: function(t) {
546
+ this.$emit("drag", t);
547
+ }, onEnter: function() {
548
+ this.hover = !0;
549
+ }, onLeave: function() {
550
+ this.hover = !1;
551
+ }, onDragEnd: function() {
552
+ this.$emit("drag-end");
553
+ } }, emits: ["drag", "drag-end"] };
554
+ St.render = function(t, e, i, o, s, n) {
555
+ var a = T("HandlerWrapper");
556
+ return w(), y(a, { class: n.classes.wrapper, "vertical-position": i.verticalPosition, "horizontal-position": i.horizontalPosition, disabled: i.disabled, onDrag: n.onDrag, onDragEnd: n.onDragEnd, onEnter: n.onEnter, onLeave: n.onLeave }, { default: $(function() {
557
+ return [A("div", { class: n.classes.default }, null, 2)];
558
+ }), _: 1 }, 8, ["class", "vertical-position", "horizontal-position", "disabled", "onDrag", "onDragEnd", "onEnter", "onLeave"]);
559
+ };
560
+ var Ie = O("vue-simple-line"), $e = O("vue-simple-line-wrapper"), xt = { name: "SimpleLine", components: { LineWrapper: qt }, props: { defaultClass: { type: String }, hoverClass: { type: String }, wrapperClass: { type: String }, position: { type: String }, disabled: { type: Boolean, default: !1 } }, data: function() {
561
+ return { hover: !1 };
562
+ }, computed: { classes: function() {
563
+ return { root: z(Ie(C({}, this.position, !0)), this.defaultClass, this.hover && this.hoverClass), wrapper: z($e(C({}, this.position, !0)), this.wrapperClass) };
564
+ } }, methods: { onDrag: function(t) {
565
+ this.$emit("drag", t);
566
+ }, onEnter: function() {
567
+ this.hover = !0;
568
+ }, onLeave: function() {
569
+ this.hover = !1;
570
+ }, onDragEnd: function() {
571
+ this.$emit("drag-end");
572
+ } }, emits: ["drag", "drag-end"] };
573
+ xt.render = function(t, e, i, o, s, n) {
574
+ var a = T("LineWrapper");
575
+ return w(), y(a, { class: n.classes.wrapper, position: i.position, disabled: i.disabled, onDrag: n.onDrag, onDragEnd: n.onDragEnd, onEnter: n.onEnter, onLeave: n.onLeave }, { default: $(function() {
576
+ return [A("div", { class: n.classes.root }, null, 2)];
577
+ }), _: 1 }, 8, ["class", "position", "disabled", "onDrag", "onDragEnd", "onEnter", "onLeave"]);
578
+ };
579
+ var ut = O("vue-bounding-box"), He = ["east", "west", null], Le = ["south", "north", null], Kt = { name: "BoundingBox", props: { width: { type: Number }, height: { type: Number }, transitions: { type: Object }, handlers: { type: Object, default: function() {
580
+ return { eastNorth: !0, north: !0, westNorth: !0, west: !0, westSouth: !0, south: !0, eastSouth: !0, east: !0 };
581
+ } }, handlersComponent: { type: [Object, String], default: function() {
582
+ return St;
583
+ } }, handlersClasses: { type: Object, default: function() {
584
+ return {};
585
+ } }, handlersWrappersClasses: { type: Object, default: function() {
586
+ return {};
587
+ } }, lines: { type: Object, default: function() {
588
+ return { west: !0, north: !0, east: !0, south: !0 };
589
+ } }, linesComponent: { type: [Object, String], default: function() {
590
+ return xt;
591
+ } }, linesClasses: { type: Object, default: function() {
592
+ return {};
593
+ } }, linesWrappersClasses: { type: Object, default: function() {
594
+ return {};
595
+ } }, resizable: { type: Boolean, default: !0 } }, data: function() {
596
+ var t = [];
597
+ return He.forEach(function(e) {
598
+ Le.forEach(function(i) {
599
+ if (e !== i) {
600
+ var o = Xt(e, i), s = o.name, n = o.classname;
601
+ t.push({ name: s, classname: n, verticalDirection: i, horizontalDirection: e });
602
+ }
603
+ });
604
+ }), { points: t };
605
+ }, computed: { style: function() {
606
+ var t = {};
607
+ return this.width && this.height && (t.width = "".concat(this.width, "px"), t.height = "".concat(this.height, "px"), this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction))), t;
608
+ }, classes: function() {
609
+ var t = this.handlersClasses, e = this.handlersWrappersClasses, i = this.linesClasses, o = this.linesWrappersClasses;
610
+ return { root: ut(), handlers: t, handlersWrappers: e, lines: i, linesWrappers: o };
611
+ }, lineNodes: function() {
612
+ var t = this, e = [];
613
+ return this.points.forEach(function(i) {
614
+ i.horizontalDirection && i.verticalDirection || !t.lines[i.name] || e.push({ name: i.name, component: t.linesComponent, class: z(t.classes.lines.default, t.classes.lines[i.name], !t.resizable && t.classes.lines.disabled), wrapperClass: z(t.classes.linesWrappers.default, t.classes.linesWrappers[i.name], !t.resizable && t.classes.linesWrappers.disabled), hoverClass: t.classes.lines.hover, verticalDirection: i.verticalDirection, horizontalDirection: i.horizontalDirection, disabled: !t.resizable });
615
+ }), e;
616
+ }, handlerNodes: function() {
617
+ var t = this, e = [], i = this.width, o = this.height;
618
+ return this.points.forEach(function(s) {
619
+ if (t.handlers[s.name]) {
620
+ var n = { name: s.name, component: t.handlersComponent, class: z(t.classes.handlers.default, t.classes.handlers[s.name]), wrapperClass: z(t.classes.handlersWrappers.default, t.classes.handlersWrappers[s.name]), hoverClass: t.classes.handlers.hover, verticalDirection: s.verticalDirection, horizontalDirection: s.horizontalDirection, disabled: !t.resizable };
621
+ if (i && o) {
622
+ var a = s.horizontalDirection, h = s.verticalDirection, r = a === "east" ? i : a === "west" ? 0 : i / 2, c = h === "south" ? o : h === "north" ? 0 : o / 2;
623
+ n.wrapperClass = ut("handler"), n.wrapperStyle = { transform: "translate(".concat(r, "px, ").concat(c, "px)") }, t.transitions && t.transitions.enabled && (n.wrapperStyle.transition = "".concat(t.transitions.time, "ms ").concat(t.transitions.timingFunction));
624
+ } else n.wrapperClass = ut("handler", C({}, s.classname, !0));
625
+ e.push(n);
626
+ }
627
+ }), e;
628
+ } }, beforeMount: function() {
629
+ window.addEventListener("mouseup", this.onMouseUp, { passive: !1 }), window.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), window.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), window.addEventListener("touchend", this.onTouchEnd, { passive: !1 });
630
+ }, beforeUnmount: function() {
631
+ window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
632
+ }, mounted: function() {
633
+ this.touches = [];
634
+ }, methods: { onEnd: function() {
635
+ this.$emit("resize-end");
636
+ }, onHandlerDrag: function(t, e, i) {
637
+ var o, s = t.shift(), n = s.left, a = s.top, h = { left: 0, right: 0, top: 0, bottom: 0 };
638
+ e === "west" ? h.left -= n : e === "east" && (h.right += n), i === "north" ? h.top -= a : i === "south" && (h.bottom += a), !i && e ? o = "width" : i && !e && (o = "height"), this.resizable && this.$emit("resize", new de(h, { allowedDirections: { left: e === "west" || !e, right: e === "east" || !e, bottom: i === "south" || !i, top: i === "north" || !i }, preserveAspectRatio: t.nativeEvent && t.nativeEvent.shiftKey, respectDirection: o }));
639
+ } }, emits: ["resize", "resize-end"] };
640
+ Kt.render = function(t, e, i, o, s, n) {
641
+ return w(), y("div", { ref: "box", class: n.classes.root, style: n.style }, [B(t.$slots, "default"), A("div", null, [(w(!0), y(Et, null, Ct(n.lineNodes, function(a) {
642
+ return w(), y(nt(a.component), { key: a.name, "default-class": a.class, "hover-class": a.hoverClass, "wrapper-class": a.wrapperClass, position: a.name, disabled: a.disabled, onDrag: function(h) {
643
+ return n.onHandlerDrag(h, a.horizontalDirection, a.verticalDirection);
644
+ }, onDragEnd: e[1] || (e[1] = function(h) {
645
+ return n.onEnd();
646
+ }) }, null, 8, ["default-class", "hover-class", "wrapper-class", "position", "disabled", "onDrag"]);
647
+ }), 128))]), (w(!0), y(Et, null, Ct(n.handlerNodes, function(a) {
648
+ return w(), y("div", { key: a.name, style: a.wrapperStyle, class: a.wrapperClass }, [(w(), y(nt(a.component), { "default-class": a.class, "hover-class": a.hoverClass, "wrapper-class": a.wrapperClass, "horizontal-position": a.horizontalDirection, "vertical-position": a.verticalDirection, disabled: a.disabled, onDrag: function(h) {
649
+ return n.onHandlerDrag(h, a.horizontalDirection, a.verticalDirection);
650
+ }, onDragEnd: e[2] || (e[2] = function(h) {
651
+ return n.onEnd();
652
+ }) }, null, 8, ["default-class", "hover-class", "wrapper-class", "horizontal-position", "vertical-position", "disabled", "onDrag"]))], 6);
653
+ }), 128))], 6);
654
+ };
655
+ var je = O("vue-draggable-area"), Jt = { name: "DraggableArea", props: { movable: { type: Boolean, default: !0 }, activationDistance: { type: Number, default: 20 } }, computed: { classnames: function() {
656
+ return { default: je() };
657
+ } }, beforeMount: function() {
658
+ window.addEventListener("mouseup", this.onMouseUp, { passive: !1 }), window.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), window.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), window.addEventListener("touchend", this.onTouchEnd, { passive: !1 });
659
+ }, beforeUnmount: function() {
660
+ window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
661
+ }, mounted: function() {
662
+ this.touches = [], this.touchStarted = !1;
663
+ }, methods: { onTouchStart: function(t) {
664
+ if (t.cancelable) {
665
+ var e = this.movable && t.touches.length === 1;
666
+ e && (this.touches = k(t.touches)), (this.touchStarted || e) && (t.preventDefault(), t.stopPropagation());
667
+ }
668
+ }, onTouchEnd: function() {
669
+ this.touchStarted = !1, this.processEnd();
670
+ }, onTouchMove: function(t) {
671
+ this.touches.length >= 1 && (this.touchStarted ? (this.processMove(t, t.touches), t.preventDefault(), t.stopPropagation()) : _t({ x: this.touches[0].clientX, y: this.touches[0].clientY }, { x: t.touches[0].clientX, y: t.touches[0].clientY }) > this.activationDistance && (this.initAnchor({ clientX: t.touches[0].clientX, clientY: t.touches[0].clientY }), this.touchStarted = !0));
672
+ }, onMouseDown: function(t) {
673
+ if (this.movable && t.button === 0) {
674
+ var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
675
+ this.touches = [e], this.initAnchor(e), t.stopPropagation();
676
+ }
677
+ }, onMouseMove: function(t) {
678
+ this.touches.length && (this.processMove(t, [{ fake: !0, clientX: t.clientX, clientY: t.clientY }]), t.preventDefault && t.cancelable && t.preventDefault(), t.stopPropagation());
679
+ }, onMouseUp: function() {
680
+ this.processEnd();
681
+ }, initAnchor: function(t) {
682
+ var e = this.$refs.container.getBoundingClientRect(), i = e.left, o = e.top;
683
+ this.anchor = { x: t.clientX - i, y: t.clientY - o };
684
+ }, processMove: function(t, e) {
685
+ var i = k(e);
686
+ if (this.touches.length) {
687
+ var o = this.$refs.container.getBoundingClientRect(), s = o.left, n = o.top;
688
+ this.touches.length === 1 && i.length === 1 && this.$emit("move", new Rt({ left: i[0].clientX - (s + this.anchor.x), top: i[0].clientY - (n + this.anchor.y) }));
689
+ }
690
+ }, processEnd: function() {
691
+ this.touches.length && this.$emit("move-end"), this.touches = [];
692
+ } }, emits: ["move", "move-end"] };
693
+ Jt.render = function(t, e, i, o, s, n) {
694
+ return w(), y("div", { ref: "container", onTouchstart: e[1] || (e[1] = function() {
695
+ return n.onTouchStart && n.onTouchStart.apply(n, arguments);
696
+ }), onMousedown: e[2] || (e[2] = function() {
697
+ return n.onMouseDown && n.onMouseDown.apply(n, arguments);
698
+ }) }, [B(t.$slots, "default")], 544);
699
+ };
700
+ function dt(t) {
701
+ var e, i;
702
+ return { rotate: t.rotate || 0, flip: { horizontal: ((e = t == null ? void 0 : t.flip) === null || e === void 0 ? void 0 : e.horizontal) || !1, vertical: ((i = t == null ? void 0 : t.flip) === null || i === void 0 ? void 0 : i.vertical) || !1 } };
703
+ }
704
+ function Pe(t) {
705
+ return new Promise(function(e, i) {
706
+ try {
707
+ if (t) if (/^data:/i.test(t)) e(function(r) {
708
+ r = r.replace(/^data:([^;]+);base64,/gim, "");
709
+ for (var c = atob(r), l = c.length, u = new ArrayBuffer(l), d = new Uint8Array(u), m = 0; m < l; m++) d[m] = c.charCodeAt(m);
710
+ return u;
711
+ }(t));
712
+ else if (/^blob:/i.test(t)) {
713
+ var o = new FileReader();
714
+ o.onload = function(r) {
715
+ e(r.target.result);
716
+ }, n = t, a = function(r) {
717
+ o.readAsArrayBuffer(r);
718
+ }, (h = new XMLHttpRequest()).open("GET", n, !0), h.responseType = "blob", h.onload = function() {
719
+ this.status != 200 && this.status !== 0 || a(this.response);
720
+ }, h.send();
721
+ } else {
722
+ var s = new XMLHttpRequest();
723
+ s.onreadystatechange = function() {
724
+ s.readyState === 4 && (s.status === 200 || s.status === 0 ? e(s.response) : i("Warning: could not load an image to parse its orientation"), s = null);
725
+ }, s.onprogress = function() {
726
+ s.getResponseHeader("content-type") !== "image/jpeg" && s.abort();
727
+ }, s.withCredentials = !1, s.open("GET", t, !0), s.responseType = "arraybuffer", s.send(null);
728
+ }
729
+ else i("Error: the image is empty");
730
+ } catch (r) {
731
+ i(r);
732
+ }
733
+ var n, a, h;
734
+ });
735
+ }
736
+ function te(t) {
737
+ var e = t.rotate, i = t.flip, o = t.scaleX, s = t.scaleY, n = "";
738
+ return n += " rotate(" + e + "deg) ", n += " scaleX(" + o * (i.horizontal ? -1 : 1) + ") ", n += " scaleY(" + s * (i.vertical ? -1 : 1) + ") ";
739
+ }
740
+ function Be(t) {
741
+ try {
742
+ var e, i = new DataView(t), o = void 0, s = void 0, n = void 0, a = void 0;
743
+ if (i.getUint8(0) === 255 && i.getUint8(1) === 216) for (var h = i.byteLength, r = 2; r + 1 < h; ) {
744
+ if (i.getUint8(r) === 255 && i.getUint8(r + 1) === 225) {
745
+ n = r;
746
+ break;
747
+ }
748
+ r++;
749
+ }
750
+ if (n && (o = n + 10, function(m, g, f) {
751
+ var E, L = "";
752
+ for (E = g, f += g; E < f; E++) L += String.fromCharCode(m.getUint8(E));
753
+ return L;
754
+ }(i, n + 4, 4) === "Exif")) {
755
+ var c = i.getUint16(o);
756
+ if (((s = c === 18761) || c === 19789) && i.getUint16(o + 2, s) === 42) {
757
+ var l = i.getUint32(o + 4, s);
758
+ l >= 8 && (a = o + l);
759
+ }
760
+ }
761
+ if (a) {
762
+ for (var u = i.getUint16(a, s), d = 0; d < u; d++)
763
+ if (r = a + 12 * d + 2, i.getUint16(r, s) === 274) {
764
+ r += 8, e = i.getUint16(r, s), i.setUint16(r, 1, s);
765
+ break;
766
+ }
767
+ }
768
+ return e;
769
+ } catch {
770
+ return null;
771
+ }
772
+ }
773
+ function Pt(t, e) {
774
+ var i = e.getBoundingClientRect(), o = i.left, s = i.top, n = { left: 0, top: 0 }, a = 0;
775
+ return t.forEach(function(h) {
776
+ n.left += (h.clientX - o) / t.length, n.top += (h.clientY - s) / t.length;
777
+ }), t.forEach(function(h) {
778
+ a += _t({ x: n.left, y: n.top }, { x: h.clientX - o, y: h.clientY - s });
779
+ }), { centerMass: n, spread: a, count: t.length };
780
+ }
781
+ var ee = { props: { touchMove: { type: Boolean, required: !0 }, mouseMove: { type: Boolean, required: !0 }, touchResize: { type: Boolean, required: !0 }, wheelResize: { type: [Boolean, Object], required: !0 }, eventsFilter: { type: Function, required: !1 } }, beforeMount: function() {
782
+ window.addEventListener("mouseup", this.onMouseUp, { passive: !1 }), window.addEventListener("mousemove", this.onMouseMove, { passive: !1 }), window.addEventListener("touchmove", this.onTouchMove, { passive: !1 }), window.addEventListener("touchend", this.onTouchEnd, { passive: !1 });
783
+ }, beforeUnmount: function() {
784
+ window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
785
+ }, created: function() {
786
+ this.transforming = !1, this.debouncedProcessEnd = vt(this.processEnd), this.touches = [];
787
+ }, methods: { processMove: function(t, e) {
788
+ if (this.touches.length) {
789
+ if (this.touches.length === 1 && e.length === 1) this.$emit("move", new q({ left: this.touches[0].clientX - e[0].clientX, top: this.touches[0].clientY - e[0].clientY }));
790
+ else if (this.touches.length > 1 && this.touchResize) {
791
+ var i = Pt(e, this.$refs.container), o = this.oldGeometricProperties;
792
+ o.count === i.count && o.count > 1 && this.$emit("resize", new q({ left: o.centerMass.left - i.centerMass.left, top: o.centerMass.top - i.centerMass.top }, { factor: o.spread / i.spread, center: i.centerMass })), this.oldGeometricProperties = i;
793
+ }
794
+ this.touches = e;
795
+ }
796
+ }, processEnd: function() {
797
+ this.transforming && (this.transforming = !1, this.$emit("transform-end"));
798
+ }, processStart: function() {
799
+ this.transforming = !0, this.debouncedProcessEnd.clear();
800
+ }, processEvent: function(t) {
801
+ return this.eventsFilter ? this.eventsFilter(t, this.transforming) !== !1 : (t.preventDefault(), t.stopPropagation(), !0);
802
+ }, onTouchStart: function(t) {
803
+ if (t.cancelable && (this.touchMove || this.touchResize && t.touches.length > 1) && this.processEvent(t)) {
804
+ var e = this.$refs.container, i = e.getBoundingClientRect(), o = i.left, s = i.top, n = i.bottom, a = i.right;
805
+ this.touches = k(t.touches).filter(function(h) {
806
+ return h.clientX > o && h.clientX < a && h.clientY > s && h.clientY < n;
807
+ }), this.oldGeometricProperties = Pt(this.touches, e);
808
+ }
809
+ }, onTouchEnd: function(t) {
810
+ t.touches.length === 0 && (this.touches = [], this.processEnd());
811
+ }, onTouchMove: function(t) {
812
+ var e = this;
813
+ if (this.touches.length) {
814
+ var i = k(t.touches).filter(function(o) {
815
+ return !o.identifier || e.touches.find(function(s) {
816
+ return s.identifier === o.identifier;
817
+ });
818
+ });
819
+ this.processEvent(t) && (this.processMove(t, i), this.processStart());
820
+ }
821
+ }, onMouseDown: function(t) {
822
+ if (this.mouseMove && "buttons" in t && t.buttons === 1 && this.processEvent(t)) {
823
+ var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
824
+ this.touches = [e], this.processStart();
825
+ }
826
+ }, onMouseMove: function(t) {
827
+ this.touches.length && this.processEvent(t) && this.processMove(t, [{ clientX: t.clientX, clientY: t.clientY }]);
828
+ }, onMouseUp: function() {
829
+ this.touches = [], this.processEnd();
830
+ }, onWheel: function(t) {
831
+ if (this.wheelResize && this.processEvent(t)) {
832
+ var e = this.$refs.container.getBoundingClientRect(), i = e.left, o = e.top, s = 1 + this.wheelResize.ratio * (a = t.deltaY || t.detail || t.wheelDelta, (h = +a) == 0 || Nt(h) ? h : h > 0 ? 1 : -1), n = { left: t.clientX - i, top: t.clientY - o };
833
+ this.$emit("resize", new q({}, { factor: s, center: n })), this.touches.length || this.debouncedProcessEnd();
834
+ }
835
+ var a, h;
836
+ } }, emits: ["resize", "move", "transform-end"] };
837
+ ee.render = function(t, e, i, o, s, n) {
838
+ return w(), y("div", { ref: "container", onTouchstart: e[1] || (e[1] = function() {
839
+ return n.onTouchStart && n.onTouchStart.apply(n, arguments);
840
+ }), onMousedown: e[2] || (e[2] = function() {
841
+ return n.onMouseDown && n.onMouseDown.apply(n, arguments);
842
+ }), onWheel: e[3] || (e[3] = function() {
843
+ return n.onWheel && n.onWheel.apply(n, arguments);
844
+ }) }, [B(t.$slots, "default")], 544);
845
+ };
846
+ var zt = { components: { TransformableImage: ee }, props: { touchMove: { type: Boolean, required: !0 }, mouseMove: { type: Boolean, required: !0 }, touchResize: { type: Boolean, required: !0 }, wheelResize: { type: [Boolean, Object], required: !0 } }, emits: ["resize", "move"] };
847
+ zt.render = function(t, e, i, o, s, n) {
848
+ var a = T("transformable-image");
849
+ return w(), y(a, { "touch-move": i.touchMove, "touch-resize": i.touchResize, "mouse-move": i.mouseMove, "wheel-resize": i.wheelResize, onMove: e[1] || (e[1] = function(h) {
850
+ return t.$emit("move", h);
851
+ }), onResize: e[2] || (e[2] = function(h) {
852
+ return t.$emit("resize", h);
853
+ }) }, { default: $(function() {
854
+ return [B(t.$slots, "default")];
855
+ }), _: 3 }, 8, ["touch-move", "touch-resize", "mouse-move", "wheel-resize"]);
856
+ };
857
+ var et = O("vue-preview"), ie = { props: { coordinates: { type: Object }, transitions: { type: Object }, image: { type: Object, default: function() {
858
+ return {};
859
+ } }, imageClass: { type: String }, width: { type: Number }, height: { type: Number }, fill: { type: Boolean } }, data: function() {
860
+ return { calculatedImageSize: { width: 0, height: 0 }, calculatedSize: { width: 0, height: 0 } };
861
+ }, computed: { classes: function() {
862
+ return { root: et({ fill: this.fill }), wrapper: et("wrapper"), imageWrapper: et("image-wrapper"), image: z(et("image"), this.imageClass) };
863
+ }, style: function() {
864
+ if (this.fill) return {};
865
+ var t = {};
866
+ return this.width && (t.width = "".concat(this.size.width, "px")), this.height && (t.height = "".concat(this.size.height, "px")), this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), t;
867
+ }, wrapperStyle: function() {
868
+ var t = { width: "".concat(this.size.width, "px"), height: "".concat(this.size.height, "px"), left: "calc(50% - ".concat(this.size.width / 2, "px)"), top: "calc(50% - ".concat(this.size.height / 2, "px)") };
869
+ return this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), t;
870
+ }, imageStyle: function() {
871
+ if (this.coordinates && this.image) {
872
+ var t = this.coordinates.width / this.size.width, e = v(v({ rotate: 0, flip: { horizontal: !1, vertical: !1 } }, this.image.transforms), {}, { scaleX: 1 / t, scaleY: 1 / t }), i = this.imageSize.width, o = this.imageSize.height, s = Gt({ width: i, height: o }, e.rotate), n = { width: "".concat(i, "px"), height: "".concat(o, "px"), left: "0px", top: "0px" }, a = { rotate: { left: (i - s.width) * e.scaleX / 2, top: (o - s.height) * e.scaleY / 2 }, scale: { left: (1 - e.scaleX) * i / 2, top: (1 - e.scaleY) * o / 2 } };
873
+ return n.transform = `translate(
874
+ `.concat(-this.coordinates.left / t - a.rotate.left - a.scale.left, "px,").concat(-this.coordinates.top / t - a.rotate.top - a.scale.top, "px) ") + te(e), this.transitions && this.transitions.enabled && (n.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), n;
875
+ }
876
+ return {};
877
+ }, size: function() {
878
+ return { width: this.width || this.calculatedSize.width, height: this.height || this.calculatedSize.height };
879
+ }, imageSize: function() {
880
+ return { width: this.image.width || this.calculatedImageSize.width, height: this.image.height || this.calculatedImageSize.height };
881
+ } }, watch: { image: function(t) {
882
+ (t.width || t.height) && this.onChangeImage();
883
+ } }, mounted: function() {
884
+ var t = this;
885
+ this.onChangeImage(), this.$refs.image.addEventListener("load", function() {
886
+ t.refreshImage();
887
+ }), window.addEventListener("resize", this.refresh), window.addEventListener("orientationchange", this.refresh);
888
+ }, unmounted: function() {
889
+ window.removeEventListener("resize", this.refresh), window.removeEventListener("orientationchange", this.refresh);
890
+ }, methods: { refreshImage: function() {
891
+ var t = this.$refs.image;
892
+ this.calculatedImageSize.height = t.naturalHeight, this.calculatedImageSize.width = t.naturalWidth;
893
+ }, refresh: function() {
894
+ var t = this.$refs.root;
895
+ this.width || (this.calculatedSize.width = t.clientWidth), this.height || (this.calculatedSize.height = t.clientHeight);
896
+ }, onChangeImage: function() {
897
+ var t = this.$refs.image;
898
+ t && t.complete && this.refreshImage(), this.refresh();
899
+ } } };
900
+ ie.render = function(t, e, i, o, s, n) {
901
+ return w(), y("div", { ref: "root", class: n.classes.root, style: n.style }, [A("div", { ref: "wrapper", class: n.classes.wrapper, style: n.wrapperStyle }, [Bt(A("img", { ref: "image", src: i.image && i.image.src, class: n.classes.image, style: n.imageStyle }, null, 14, ["src"]), [[Ut, i.image && i.image.src]])], 6)], 6);
902
+ };
903
+ var ne = { components: { Preview: ie }, inheritAttrs: !1 };
904
+ ne.render = function(t, e, i, o, s, n) {
905
+ var a = T("preview");
906
+ return w(), y(a, ot(t.$attrs, { fill: !0 }), null, 16);
907
+ };
908
+ var mt = O("vue-rectangle-stencil"), oe = { name: "RectangleStencil", components: { StencilPreview: ne, BoundingBox: Kt, DraggableArea: Jt }, props: { image: { type: Object }, coordinates: { type: Object }, stencilCoordinates: { type: Object }, handlers: { type: Object }, handlersComponent: { type: [Object, String], default: function() {
909
+ return St;
910
+ } }, lines: { type: Object }, linesComponent: { type: [Object, String], default: function() {
911
+ return xt;
912
+ } }, aspectRatio: { type: [Number, String] }, minAspectRatio: { type: [Number, String] }, maxAspectRatio: { type: [Number, String] }, movable: { type: Boolean, default: !0 }, resizable: { type: Boolean, default: !0 }, transitions: { type: Object }, movingClass: { type: String }, resizingClass: { type: String }, previewClass: { type: String }, boundingBoxClass: { type: String }, linesClasses: { type: Object, default: function() {
913
+ return {};
914
+ } }, linesWrappersClasses: { type: Object, default: function() {
915
+ return {};
916
+ } }, handlersClasses: { type: Object, default: function() {
917
+ return {};
918
+ } }, handlersWrappersClasses: { type: Object, default: function() {
919
+ return {};
920
+ } } }, data: function() {
921
+ return { moving: !1, resizing: !1 };
922
+ }, computed: { classes: function() {
923
+ return { stencil: z(mt({ movable: this.movable, moving: this.moving, resizing: this.resizing }), this.moving && this.movingClass, this.resizing && this.resizingClass), preview: z(mt("preview"), this.previewClass), boundingBox: z(mt("bounding-box"), this.boundingBoxClass) };
924
+ }, style: function() {
925
+ var t = this.stencilCoordinates, e = t.height, i = t.width, o = t.left, s = t.top, n = { width: "".concat(i, "px"), height: "".concat(e, "px"), transform: "translate(".concat(o, "px, ").concat(s, "px)") };
926
+ return this.transitions && this.transitions.enabled && (n.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), n;
927
+ } }, methods: { onMove: function(t) {
928
+ this.$emit("move", t), this.moving = !0;
929
+ }, onMoveEnd: function() {
930
+ this.$emit("move-end"), this.moving = !1;
931
+ }, onResize: function(t) {
932
+ this.$emit("resize", t), this.resizing = !0;
933
+ }, onResizeEnd: function() {
934
+ this.$emit("resize-end"), this.resizing = !1;
935
+ }, aspectRatios: function() {
936
+ return { minimum: this.aspectRatio || this.minAspectRatio, maximum: this.aspectRatio || this.maxAspectRatio };
937
+ } }, emits: ["resize", "resize-end", "move", "move-end"] };
938
+ oe.render = function(t, e, i, o, s, n) {
939
+ var a = T("stencil-preview"), h = T("draggable-area"), r = T("bounding-box");
940
+ return w(), y("div", { class: n.classes.stencil, style: n.style }, [A(r, { width: i.stencilCoordinates.width, height: i.stencilCoordinates.height, transitions: i.transitions, class: n.classes.boundingBox, handlers: i.handlers, "handlers-component": i.handlersComponent, "handlers-classes": i.handlersClasses, "handlers-wrappers-classes": i.handlersWrappersClasses, lines: i.lines, "lines-component": i.linesComponent, "lines-classes": i.linesClasses, "lines-wrappers-classes": i.linesWrappersClasses, resizable: i.resizable, onResize: n.onResize, onResizeEnd: n.onResizeEnd }, { default: $(function() {
941
+ return [A(h, { movable: i.movable, onMove: n.onMove, onMoveEnd: n.onMoveEnd }, { default: $(function() {
942
+ return [A(a, { image: i.image, coordinates: i.coordinates, width: i.stencilCoordinates.width, height: i.stencilCoordinates.height, class: n.classes.preview, transitions: i.transitions }, null, 8, ["image", "coordinates", "width", "height", "class", "transitions"])];
943
+ }), _: 1 }, 8, ["movable", "onMove", "onMoveEnd"])];
944
+ }), _: 1 }, 8, ["width", "height", "transitions", "class", "handlers", "handlers-component", "handlers-classes", "handlers-wrappers-classes", "lines", "lines-component", "lines-classes", "lines-wrappers-classes", "resizable", "onResize", "onResizeEnd"])], 6);
945
+ };
946
+ var Ue = ["transitions"], j = O("vue-advanced-cropper"), se = { name: "Cropper", components: { BackgroundWrapper: zt }, props: { src: { type: String, default: null }, stencilComponent: { type: [Object, String], default: function() {
947
+ return oe;
948
+ } }, backgroundWrapperComponent: { type: [Object, String], default: function() {
949
+ return zt;
950
+ } }, stencilProps: { type: Object, default: function() {
951
+ return {};
952
+ } }, autoZoom: { type: Boolean, default: !1 }, imageClass: { type: String }, boundariesClass: { type: String }, backgroundClass: { type: String }, foregroundClass: { type: String }, minWidth: { type: [Number, String] }, minHeight: { type: [Number, String] }, maxWidth: { type: [Number, String] }, maxHeight: { type: [Number, String] }, debounce: { type: [Boolean, Number], default: 500 }, transitions: { type: Boolean, default: !0 }, checkOrientation: { type: Boolean, default: !0 }, canvas: { type: [Object, Boolean], default: !0 }, crossOrigin: { type: [Boolean, String], default: void 0 }, transitionTime: { type: Number, default: 300 }, imageRestriction: { type: String, default: "fit-area", validator: function(t) {
953
+ return be.indexOf(t) !== -1;
954
+ } }, roundResult: { type: Boolean, default: !0 }, defaultSize: { type: [Function, Object] }, defaultPosition: { type: [Function, Object] }, defaultVisibleArea: { type: [Function, Object] }, defaultTransforms: { type: [Function, Object] }, defaultBoundaries: { type: [Function, String], validator: function(t) {
955
+ return !(typeof t == "string" && t !== "fill" && t !== "fit");
956
+ } }, priority: { type: String, default: "coordinates" }, stencilSize: { type: [Object, Function] }, resizeImage: { type: [Boolean, Object], default: !0 }, moveImage: { type: [Boolean, Object], default: !0 }, autoZoomAlgorithm: { type: Function }, resizeAlgorithm: { type: Function, default: function(t) {
957
+ var e = t.event, i = t.coordinates, o = t.aspectRatio, s = t.positionRestrictions, n = t.sizeRestrictions, a = p(p({}, i), { right: i.left + i.width, bottom: i.top + i.height }), h = e.params || {}, r = p({}, e.directions), c = h.allowedDirections || { left: !0, right: !0, bottom: !0, top: !0 };
958
+ n.widthFrozen && (r.left = 0, r.right = 0), n.heightFrozen && (r.top = 0, r.bottom = 0), I.forEach(function(V) {
959
+ c[V] || (r[V] = 0);
960
+ });
961
+ var l = D(a, r = jt({ coordinates: a, directions: r, sizeRestrictions: n, positionRestrictions: s })).width, u = D(a, r).height, d = h.preserveRatio ? b(a) : lt(l / u, o);
962
+ if (d) {
963
+ var m = h.respectDirection;
964
+ if (m || (m = a.width >= a.height || d === 1 ? "width" : "height"), m === "width") {
965
+ var g = l / d - a.height;
966
+ if (c.top && c.bottom) {
967
+ var f = r.top, E = r.bottom;
968
+ r.bottom = tt(g, E, f), r.top = tt(g, f, E);
969
+ } else c.bottom ? r.bottom = g : c.top ? r.top = g : c.right ? r.right = 0 : c.left && (r.left = 0);
970
+ } else if (m === "height") {
971
+ var L = a.width - u * d;
972
+ if (c.left && c.right) {
973
+ var _ = r.left, G = r.right;
974
+ r.left = -tt(L, _, G), r.right = -tt(L, G, _);
975
+ } else c.left ? r.left = -L : c.right ? r.right = -L : c.top ? r.top = 0 : c.bottom && (r.bottom = 0);
976
+ }
977
+ r = jt({ directions: r, coordinates: a, sizeRestrictions: n, positionRestrictions: s, preserveRatio: !0, compensate: h.compensate });
978
+ }
979
+ return l = D(a, r).width, u = D(a, r).height, (d = h.preserveRatio ? b(a) : lt(l / u, o)) && Math.abs(d - l / u) > 1e-3 && I.forEach(function(V) {
980
+ c[V] || (r[V] = 0);
981
+ }), yt({ event: new Rt({ left: -r.left, top: -r.top }), coordinates: { width: i.width + r.right + r.left, height: i.height + r.top + r.bottom, left: i.left, top: i.top }, positionRestrictions: s });
982
+ } }, moveAlgorithm: { type: Function, default: yt }, initStretcher: { type: Function, default: function(t) {
983
+ var e = t.stretcher, i = t.imageSize, o = b(i);
984
+ e.style.width = i.width + "px", e.style.height = e.clientWidth / o + "px", e.style.width = e.clientWidth + "px";
985
+ } }, fitCoordinates: { type: Function, default: function(t) {
986
+ var e = t.visibleArea, i = t.coordinates, o = t.aspectRatio, s = t.sizeRestrictions, n = t.positionRestrictions, a = p(p({}, i), P({ width: i.width, height: i.height, aspectRatio: o, sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minHeight: Math.min(e.height, s.minHeight), minWidth: Math.min(e.width, s.minWidth) } }));
987
+ return a = S(a = x(a, X(M(i), M(a))), at(H(e), n));
988
+ } }, fitVisibleArea: { type: Function, default: function(t) {
989
+ var e = t.visibleArea, i = t.boundaries, o = t.getAreaRestrictions, s = t.coordinates, n = p({}, e);
990
+ n.height = n.width / b(i), n.top += (e.height - n.height) / 2, (s.height - n.height > 0 || s.width - n.width > 0) && (n = W(n, Math.max(s.height / n.height, s.width / n.width)));
991
+ var a = st(N(s, H(n = W(n, rt(n, o({ visibleArea: n, type: "resize" }))))));
992
+ return n.width < s.width && (a.left = 0), n.height < s.height && (a.top = 0), n = S(n = x(n, a), o({ visibleArea: n, type: "move" }));
993
+ } }, areaRestrictionsAlgorithm: { type: Function, default: function(t) {
994
+ var e = t.visibleArea, i = t.boundaries, o = t.imageSize, s = t.imageRestriction, n = t.type, a = {};
995
+ return s === "fill-area" ? a = { left: 0, top: 0, right: o.width, bottom: o.height } : s === "fit-area" && (b(i) > b(o) ? (a = { top: 0, bottom: o.height }, e && n === "move" && (e.width > o.width ? (a.left = -(e.width - o.width) / 2, a.right = o.width - a.left) : (a.left = 0, a.right = o.width))) : (a = { left: 0, right: o.width }, e && n === "move" && (e.height > o.height ? (a.top = -(e.height - o.height) / 2, a.bottom = o.height - a.top) : (a.top = 0, a.bottom = o.height)))), a;
996
+ } }, sizeRestrictionsAlgorithm: { type: Function, default: function(t) {
997
+ return { minWidth: t.minWidth, minHeight: t.minHeight, maxWidth: t.maxWidth, maxHeight: t.maxHeight };
998
+ } }, positionRestrictionsAlgorithm: { type: Function, default: function(t) {
999
+ var e = t.imageSize, i = {};
1000
+ return t.imageRestriction !== "none" && (i = { left: 0, top: 0, right: e.width, bottom: e.height }), i;
1001
+ } } }, data: function() {
1002
+ return { transitionsActive: !1, imageLoaded: !1, imageAttributes: { width: null, height: null, crossOrigin: null, src: null }, defaultImageTransforms: { rotate: 0, flip: { horizontal: !1, vertical: !1 } }, appliedImageTransforms: { rotate: 0, flip: { horizontal: !1, vertical: !1 } }, boundaries: { width: 0, height: 0 }, visibleArea: null, coordinates: v({}, It) };
1003
+ }, computed: { image: function() {
1004
+ return { src: this.imageAttributes.src, width: this.imageAttributes.width, height: this.imageAttributes.height, transforms: this.imageTransforms };
1005
+ }, imageTransforms: function() {
1006
+ return { rotate: this.appliedImageTransforms.rotate, flip: { horizontal: this.appliedImageTransforms.flip.horizontal, vertical: this.appliedImageTransforms.flip.vertical }, translateX: this.visibleArea ? this.visibleArea.left / this.coefficient : 0, translateY: this.visibleArea ? this.visibleArea.top / this.coefficient : 0, scaleX: 1 / this.coefficient, scaleY: 1 / this.coefficient };
1007
+ }, imageSize: function() {
1008
+ var t = function(e) {
1009
+ return e * Math.PI / 180;
1010
+ }(this.imageTransforms.rotate);
1011
+ return { width: Math.abs(this.imageAttributes.width * Math.cos(t)) + Math.abs(this.imageAttributes.height * Math.sin(t)), height: Math.abs(this.imageAttributes.width * Math.sin(t)) + Math.abs(this.imageAttributes.height * Math.cos(t)) };
1012
+ }, initialized: function() {
1013
+ return !!(this.visibleArea && this.imageLoaded);
1014
+ }, settings: function() {
1015
+ var t = bt(this.resizeImage, { touch: !0, wheel: { ratio: 0.1 }, adjustStencil: !0 }, { touch: !1, wheel: !1, adjustStencil: !1 });
1016
+ return { moveImage: bt(this.moveImage, { touch: !0, mouse: !0 }, { touch: !1, mouse: !1 }), resizeImage: t };
1017
+ }, coefficient: function() {
1018
+ return this.visibleArea ? this.visibleArea.width / this.boundaries.width : 0;
1019
+ }, areaRestrictions: function() {
1020
+ return this.imageLoaded ? this.areaRestrictionsAlgorithm({ imageSize: this.imageSize, imageRestriction: this.imageRestriction, boundaries: this.boundaries }) : {};
1021
+ }, transitionsOptions: function() {
1022
+ return { enabled: this.transitionsActive, timingFunction: "ease-in-out", time: 350 };
1023
+ }, sizeRestrictions: function() {
1024
+ if (this.boundaries.width && this.boundaries.height && this.imageSize.width && this.imageSize.height) {
1025
+ var t = this.sizeRestrictionsAlgorithm({ imageSize: this.imageSize, minWidth: R(this.minWidth) ? 0 : K(this.minWidth), minHeight: R(this.minHeight) ? 0 : K(this.minHeight), maxWidth: R(this.maxWidth) ? 1 / 0 : K(this.maxWidth), maxHeight: R(this.maxHeight) ? 1 / 0 : K(this.maxHeight) });
1026
+ if (t = function(o) {
1027
+ var s = o.areaRestrictions, n = o.sizeRestrictions, a = o.boundaries, h = o.positionRestrictions, r = p(p({}, n), { minWidth: n.minWidth !== void 0 ? n.minWidth : 0, minHeight: n.minHeight !== void 0 ? n.minHeight : 0, maxWidth: n.maxWidth !== void 0 ? n.maxWidth : 1 / 0, maxHeight: n.maxHeight !== void 0 ? n.maxHeight : 1 / 0 });
1028
+ h.left !== void 0 && h.right !== void 0 && (r.maxWidth = Math.min(r.maxWidth, h.right - h.left)), h.bottom !== void 0 && h.top !== void 0 && (r.maxHeight = Math.min(r.maxHeight, h.bottom - h.top));
1029
+ var c = wt(s), l = Zt(a, c);
1030
+ return c.width < 1 / 0 && (!r.maxWidth || r.maxWidth > l.width) && (r.maxWidth = Math.min(r.maxWidth, l.width)), c.height < 1 / 0 && (!r.maxHeight || r.maxHeight > l.height) && (r.maxHeight = Math.min(r.maxHeight, l.height)), r.minWidth > r.maxWidth && (r.minWidth = r.maxWidth, r.widthFrozen = !0), r.minHeight > r.maxHeight && (r.minHeight = r.maxHeight, r.heightFrozen = !0), r;
1031
+ }({ sizeRestrictions: t, areaRestrictions: this.getAreaRestrictions({ visibleArea: this.visibleArea, type: "resize" }), imageSize: this.imageSize, boundaries: this.boundaries, positionRestrictions: this.positionRestrictions, imageRestriction: this.imageRestriction, visibleArea: this.visibleArea, stencilSize: this.getStencilSize() }), this.visibleArea && this.stencilSize) {
1032
+ var e = this.getStencilSize(), i = wt(this.getAreaRestrictions({ visibleArea: this.visibleArea, type: "resize" }));
1033
+ t.maxWidth = Math.min(t.maxWidth, i.width * e.width / this.boundaries.width), t.maxHeight = Math.min(t.maxHeight, i.height * e.height / this.boundaries.height), t.maxWidth < t.minWidth && (t.minWidth = t.maxWidth), t.maxHeight < t.minHeight && (t.minHeight = t.maxHeight);
1034
+ }
1035
+ return t;
1036
+ }
1037
+ return { minWidth: 0, minHeight: 0, maxWidth: 0, maxHeight: 0 };
1038
+ }, positionRestrictions: function() {
1039
+ return this.positionRestrictionsAlgorithm({ imageSize: this.imageSize, imageRestriction: this.imageRestriction });
1040
+ }, classes: function() {
1041
+ return { cropper: j(), image: z(j("image"), this.imageClass), stencil: j("stencil"), boundaries: z(j("boundaries"), this.boundariesClass), stretcher: z(j("stretcher")), background: z(j("background"), this.backgroundClass), foreground: z(j("foreground"), this.foregroundClass), imageWrapper: z(j("image-wrapper")), cropperWrapper: z(j("cropper-wrapper")) };
1042
+ }, stencilCoordinates: function() {
1043
+ if (this.initialized) {
1044
+ var t = this.coordinates, e = t.width, i = t.height, o = t.left, s = t.top;
1045
+ return { width: e / this.coefficient, height: i / this.coefficient, left: (o - this.visibleArea.left) / this.coefficient, top: (s - this.visibleArea.top) / this.coefficient };
1046
+ }
1047
+ return this.defaultCoordinates();
1048
+ }, boundariesStyle: function() {
1049
+ var t = { width: this.boundaries.width ? "".concat(Math.round(this.boundaries.width), "px") : "auto", height: this.boundaries.height ? "".concat(Math.round(this.boundaries.height), "px") : "auto", transition: "opacity ".concat(this.transitionTime, "ms"), pointerEvents: this.imageLoaded ? "all" : "none" };
1050
+ return this.imageLoaded || (t.opacity = "0"), t;
1051
+ }, imageStyle: function() {
1052
+ var t = this.imageAttributes.width > this.imageAttributes.height ? { width: Math.min(1024, this.imageAttributes.width), height: Math.min(1024, this.imageAttributes.width) / (this.imageAttributes.width / this.imageAttributes.height) } : { height: Math.min(1024, this.imageAttributes.height), width: Math.min(1024, this.imageAttributes.height) * (this.imageAttributes.width / this.imageAttributes.height) }, e = { left: (t.width - this.imageSize.width) / (2 * this.coefficient), top: (t.height - this.imageSize.height) / (2 * this.coefficient) }, i = { left: (1 - 1 / this.coefficient) * t.width / 2, top: (1 - 1 / this.coefficient) * t.height / 2 }, o = v(v({}, this.imageTransforms), {}, { scaleX: this.imageTransforms.scaleX * (this.imageAttributes.width / t.width), scaleY: this.imageTransforms.scaleY * (this.imageAttributes.height / t.height) }), s = { width: "".concat(t.width, "px"), height: "".concat(t.height, "px"), left: "0px", top: "0px", transform: "translate(".concat(-e.left - i.left - this.imageTransforms.translateX, "px, ").concat(-e.top - i.top - this.imageTransforms.translateY, "px)") + te(o) };
1053
+ return this.transitionsOptions.enabled && (s.transition = "".concat(this.transitionsOptions.time, "ms ").concat(this.transitionsOptions.timingFunction)), s;
1054
+ } }, watch: { src: function() {
1055
+ this.onChangeImage();
1056
+ }, stencilComponent: function() {
1057
+ var t = this;
1058
+ this.$nextTick(function() {
1059
+ t.resetCoordinates(), t.runAutoZoom("setCoordinates"), t.onChange();
1060
+ });
1061
+ }, minWidth: function() {
1062
+ this.onPropsChange();
1063
+ }, maxWidth: function() {
1064
+ this.onPropsChange();
1065
+ }, minHeight: function() {
1066
+ this.onPropsChange();
1067
+ }, maxHeight: function() {
1068
+ this.onPropsChange();
1069
+ }, imageRestriction: function() {
1070
+ this.reset();
1071
+ }, stencilProps: function(t, e) {
1072
+ ["aspectRatio", "minAspectRatio", "maxAspectRatio"].find(function(i) {
1073
+ return t[i] !== e[i];
1074
+ }) && this.$nextTick(this.onPropsChange);
1075
+ } }, created: function() {
1076
+ this.debouncedUpdate = vt(this.update, this.debounce), this.debouncedDisableTransitions = vt(this.disableTransitions, this.transitionsOptions.time), this.awaiting = !1;
1077
+ }, mounted: function() {
1078
+ this.$refs.image.addEventListener("load", this.onSuccessLoadImage), this.$refs.image.addEventListener("error", this.onFailLoadImage), this.onChangeImage(), window.addEventListener("resize", this.refresh), window.addEventListener("orientationchange", this.refresh);
1079
+ }, unmounted: function() {
1080
+ window.removeEventListener("resize", this.refresh), window.removeEventListener("orientationchange", this.refresh), this.imageAttributes.revoke && this.imageAttributes.src && URL.revokeObjectURL(this.imageAttributes.src), this.debouncedUpdate.clear(), this.debouncedDisableTransitions.clear();
1081
+ }, methods: { getResult: function() {
1082
+ var t = this.initialized ? this.prepareResult(v({}, this.coordinates)) : this.defaultCoordinates(), e = { rotate: this.imageTransforms.rotate % 360, flip: v({}, this.imageTransforms.flip) };
1083
+ if (this.src && this.imageLoaded) {
1084
+ var i = this;
1085
+ return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? v({}, this.visibleArea) : null, imageTransforms: e, get canvas() {
1086
+ return i.canvas ? i.getCanvas() : void 0;
1087
+ } };
1088
+ }
1089
+ return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? v({}, this.visibleArea) : null, canvas: void 0, imageTransforms: e };
1090
+ }, zoom: function(t, e) {
1091
+ var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
1092
+ this.onManipulateImage(new q({}, { factor: 1 / t, center: e }), { normalize: !1, transitions: s });
1093
+ }, move: function(t, e) {
1094
+ var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
1095
+ this.onManipulateImage(new q({ left: t || 0, top: e || 0 }), { normalize: !1, transitions: s });
1096
+ }, setCoordinates: function(t) {
1097
+ var e = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = i.autoZoom, s = o === void 0 || o, n = i.transitions, a = n === void 0 || n;
1098
+ this.$nextTick(function() {
1099
+ e.imageLoaded ? (e.transitionsActive || (a && e.enableTransitions(), e.coordinates = e.applyTransform(t), s && e.runAutoZoom("setCoordinates"), a && e.debouncedDisableTransitions()), e.onChange()) : e.delayedTransforms = t;
1100
+ });
1101
+ }, refresh: function() {
1102
+ var t = this, e = this.$refs.image;
1103
+ if (this.src && e) return this.initialized ? this.updateVisibleArea().then(function() {
1104
+ t.onChange();
1105
+ }) : this.resetVisibleArea().then(function() {
1106
+ t.onChange();
1107
+ });
1108
+ }, reset: function() {
1109
+ var t = this;
1110
+ return this.resetVisibleArea().then(function() {
1111
+ t.onChange(!1);
1112
+ });
1113
+ }, awaitRender: function(t) {
1114
+ var e = this;
1115
+ this.awaiting || (this.awaiting = !0, this.$nextTick(function() {
1116
+ t(), e.awaiting = !1;
1117
+ }));
1118
+ }, prepareResult: function(t) {
1119
+ return this.roundResult ? function(e) {
1120
+ var i = e.coordinates, o = e.sizeRestrictions, s = e.positionRestrictions, n = { width: Math.round(i.width), height: Math.round(i.height), left: Math.round(i.left), top: Math.round(i.top) };
1121
+ return n.width > o.maxWidth ? n.width = Math.floor(i.width) : n.width < o.minWidth && (n.width = Math.ceil(i.width)), n.height > o.maxHeight ? n.height = Math.floor(i.height) : n.height < o.minHeight && (n.height = Math.ceil(i.height)), S(n, s);
1122
+ }(v(v({}, this.getPublicProperties()), {}, { positionRestrictions: J(this.positionRestrictions, this.visibleArea), coordinates: t })) : t;
1123
+ }, processAutoZoom: function(t, e, i, o) {
1124
+ var s = this.autoZoomAlgorithm;
1125
+ s || (s = this.stencilSize ? ze : this.autoZoom ? Ae : Re);
1126
+ var n = s({ event: { type: t, params: o }, visibleArea: e, coordinates: i, boundaries: this.boundaries, aspectRatio: this.getAspectRatio(), positionRestrictions: this.positionRestrictions, getAreaRestrictions: this.getAreaRestrictions, sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize() });
1127
+ return v(v({}, n), {}, { changed: !$t(n.visibleArea, e) || !$t(n.coordinates, i) });
1128
+ }, runAutoZoom: function(t) {
1129
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, o = i !== void 0 && i, s = le(e, Ue), n = this.processAutoZoom(t, this.visibleArea, this.coordinates, s), a = n.visibleArea, h = n.coordinates, r = n.changed;
1130
+ o && r && this.enableTransitions(), this.visibleArea = a, this.coordinates = h, o && r && this.debouncedDisableTransitions();
1131
+ }, normalizeEvent: function(t) {
1132
+ return function(e) {
1133
+ var i = e.event, o = e.visibleArea, s = e.coefficient;
1134
+ if (i.type === "manipulateImage") return p(p({}, i), { move: { left: i.move && i.move.left ? s * i.move.left : 0, top: i.move && i.move.top ? s * i.move.top : 0 }, scale: { factor: i.scale && i.scale.factor ? i.scale.factor : 1, center: i.scale && i.scale.center ? { left: i.scale.center.left * s + o.left, top: i.scale.center.top * s + o.top } : null } });
1135
+ if (i.type === "resize") {
1136
+ var n = p(p({}, i), { directions: p({}, i.directions) });
1137
+ return I.forEach(function(h) {
1138
+ n.directions[h] *= s;
1139
+ }), n;
1140
+ }
1141
+ if (i.type === "move") {
1142
+ var a = p(p({}, i), { directions: p({}, i.directions) });
1143
+ return ve.forEach(function(h) {
1144
+ a.directions[h] *= s;
1145
+ }), a;
1146
+ }
1147
+ return i;
1148
+ }(v(v({}, this.getPublicProperties()), {}, { event: t }));
1149
+ }, getCanvas: function() {
1150
+ if (this.$refs.canvas) {
1151
+ var t = this.$refs.canvas, e = this.$refs.image, i = this.imageTransforms.rotate !== 0 || this.imageTransforms.flip.horizontal || this.imageTransforms.flip.vertical ? function(h, r, c) {
1152
+ var l = c.rotate, u = c.flip, d = { width: r.naturalWidth, height: r.naturalHeight }, m = Gt(d, l), g = h.getContext("2d");
1153
+ h.height = m.height, h.width = m.width, g.save();
1154
+ var f = U(M(p({ left: 0, top: 0 }, d)), l);
1155
+ return g.translate(-(f.left - m.width / 2), -(f.top - m.height / 2)), g.rotate(l * Math.PI / 180), g.translate(u.horizontal ? d.width : 0, u.vertical ? d.height : 0), g.scale(u.horizontal ? -1 : 1, u.vertical ? -1 : 1), g.drawImage(r, 0, 0, d.width, d.height), g.restore(), h;
1156
+ }(this.$refs.sourceCanvas, e, this.imageTransforms) : e, o = v({ minWidth: 0, minHeight: 0, maxWidth: 1 / 0, maxHeight: 1 / 0, maxArea: this.maxCanvasSize, imageSmoothingEnabled: !0, imageSmoothingQuality: "high", fillColor: "transparent" }, this.canvas), s = function(h) {
1157
+ return h.find(function(r) {
1158
+ return c = r, !Number.isNaN(parseFloat(c)) && isFinite(c);
1159
+ var c;
1160
+ });
1161
+ }, n = P({ sizeRestrictions: { minWidth: s([o.width, o.minWidth]) || 0, minHeight: s([o.height, o.minHeight]) || 0, maxWidth: s([o.width, o.maxWidth]) || 1 / 0, maxHeight: s([o.height, o.maxHeight]) || 1 / 0 }, width: this.coordinates.width, height: this.coordinates.height, aspectRatio: { minimum: this.coordinates.width / this.coordinates.height, maximum: this.coordinates.width / this.coordinates.height } });
1162
+ if (o.maxArea && n.width * n.height > o.maxArea) {
1163
+ var a = Math.sqrt(o.maxArea / (n.width * n.height));
1164
+ n = { width: Math.round(a * n.width), height: Math.round(a * n.height) };
1165
+ }
1166
+ return function(h, r, c, l, u) {
1167
+ h.width = l ? l.width : c.width, h.height = l ? l.height : c.height;
1168
+ var d = h.getContext("2d");
1169
+ d.clearRect(0, 0, h.width, h.height), u && (u.imageSmoothingEnabled && (d.imageSmoothingEnabled = u.imageSmoothingEnabled), u.imageSmoothingQuality && (d.imageSmoothingQuality = u.imageSmoothingQuality), u.fillColor && (d.fillStyle = u.fillColor, d.fillRect(0, 0, h.width, h.height), d.save()));
1170
+ var m = c.left < 0 ? -c.left : 0, g = c.top < 0 ? -c.top : 0;
1171
+ d.drawImage(r, c.left + m, c.top + g, c.width, c.height, m * (h.width / c.width), g * (h.height / c.height), h.width, h.height);
1172
+ }(t, i, this.coordinates, n, o), t;
1173
+ }
1174
+ }, update: function() {
1175
+ this.$emit("change", this.getResult());
1176
+ }, applyTransform: function(t) {
1177
+ var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = this.visibleArea && e ? we(this.sizeRestrictions, this.visibleArea) : this.sizeRestrictions, o = this.visibleArea && e ? J(this.positionRestrictions, this.visibleArea) : this.positionRestrictions;
1178
+ return ye({ transform: t, coordinates: this.coordinates, imageSize: this.imageSize, sizeRestrictions: i, positionRestrictions: o, aspectRatio: this.getAspectRatio(), visibleArea: this.visibleArea });
1179
+ }, resetCoordinates: function() {
1180
+ var t = this;
1181
+ if (this.$refs.image) {
1182
+ this.$refs.cropper, this.$refs.image;
1183
+ var e = this.defaultSize;
1184
+ e || (e = this.stencilSize ? xe : Se);
1185
+ var i = this.sizeRestrictions;
1186
+ i.minWidth, i.minHeight, i.maxWidth, i.maxHeight;
1187
+ var o = F(e) ? e({ boundaries: this.boundaries, imageSize: this.imageSize, aspectRatio: this.getAspectRatio(), sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize(), visibleArea: this.visibleArea }) : e, s = this.defaultPosition || Me, n = [o, function(a) {
1188
+ var h = a.coordinates;
1189
+ return v({}, F(s) ? s({ coordinates: h, imageSize: t.imageSize, visibleArea: t.visibleArea }) : t.defaultPosition);
1190
+ }];
1191
+ this.delayedTransforms && n.push.apply(n, k(Array.isArray(this.delayedTransforms) ? this.delayedTransforms : [this.delayedTransforms])), this.coordinates = this.applyTransform(n, !0), this.delayedTransforms = null;
1192
+ }
1193
+ }, clearImage: function() {
1194
+ var t = this;
1195
+ this.imageLoaded = !1, setTimeout(function() {
1196
+ var e = t.$refs.stretcher;
1197
+ e && (e.style.height = "auto", e.style.width = "auto"), t.coordinates = t.defaultCoordinates(), t.boundaries = { width: 0, height: 0 };
1198
+ }, this.transitionTime);
1199
+ }, enableTransitions: function() {
1200
+ this.transitions && (this.transitionsActive = !0);
1201
+ }, disableTransitions: function() {
1202
+ this.transitionsActive = !1;
1203
+ }, updateBoundaries: function() {
1204
+ var t = this, e = this.$refs.stretcher, i = this.$refs.cropper;
1205
+ return this.initStretcher({ cropper: i, stretcher: e, imageSize: this.imageSize }), this.$nextTick().then(function() {
1206
+ var o = { cropper: i, imageSize: t.imageSize };
1207
+ if (F(t.defaultBoundaries) ? t.boundaries = t.defaultBoundaries(o) : t.defaultBoundaries === "fit" ? t.boundaries = function(s) {
1208
+ var n = s.cropper, a = s.imageSize, h = n.clientHeight, r = n.clientWidth, c = h, l = a.width * h / a.height;
1209
+ return l > r && (l = r, c = a.height * r / a.width), { width: l, height: c };
1210
+ }(o) : t.boundaries = function(s) {
1211
+ var n = s.cropper;
1212
+ return { width: n.clientWidth, height: n.clientHeight };
1213
+ }(o), !t.boundaries.width || !t.boundaries.height) throw new Error("It's impossible to fit the cropper in the current container");
1214
+ });
1215
+ }, resetVisibleArea: function() {
1216
+ var t = this;
1217
+ return this.appliedImageTransforms = v(v({}, this.defaultImageTransforms), {}, { flip: v({}, this.defaultImageTransforms.flip) }), this.updateBoundaries().then(function() {
1218
+ t.priority !== "visible-area" && (t.visibleArea = null, t.resetCoordinates());
1219
+ var e, i, o, s, n, a, h = t.defaultVisibleArea || Ee;
1220
+ t.visibleArea = F(h) ? h({ imageSize: t.imageSize, boundaries: t.boundaries, coordinates: t.priority !== "visible-area" ? t.coordinates : null, getAreaRestrictions: t.getAreaRestrictions, stencilSize: t.getStencilSize() }) : t.defaultVisibleArea, t.visibleArea = (e = { visibleArea: t.visibleArea, boundaries: t.boundaries, getAreaRestrictions: t.getAreaRestrictions }, i = e.visibleArea, o = e.boundaries, s = e.getAreaRestrictions, n = p({}, i), a = b(o), n.width / n.height !== a && (n.height = n.width / a), S(n, s({ visibleArea: n, type: "move" }))), t.priority === "visible-area" ? t.resetCoordinates() : t.coordinates = t.fitCoordinates({ visibleArea: t.visibleArea, coordinates: t.coordinates, aspectRatio: t.getAspectRatio(), positionRestrictions: t.positionRestrictions, sizeRestrictions: t.sizeRestrictions }), t.runAutoZoom("resetVisibleArea");
1221
+ }).catch(function() {
1222
+ t.visibleArea = null;
1223
+ });
1224
+ }, updateVisibleArea: function() {
1225
+ var t = this;
1226
+ return this.updateBoundaries().then(function() {
1227
+ t.visibleArea = t.fitVisibleArea({ imageSize: t.imageSize, boundaries: t.boundaries, visibleArea: t.visibleArea, coordinates: t.coordinates, getAreaRestrictions: t.getAreaRestrictions }), t.coordinates = t.fitCoordinates({ visibleArea: t.visibleArea, coordinates: t.coordinates, aspectRatio: t.getAspectRatio(), positionRestrictions: t.positionRestrictions, sizeRestrictions: t.sizeRestrictions }), t.runAutoZoom("updateVisibleArea");
1228
+ }).catch(function() {
1229
+ t.visibleArea = null;
1230
+ });
1231
+ }, onChange: function() {
1232
+ var t = !(arguments.length > 0 && arguments[0] !== void 0) || arguments[0];
1233
+ t && this.debounce ? this.debouncedUpdate() : this.update();
1234
+ }, onChangeImage: function() {
1235
+ var t, e = this;
1236
+ if (this.imageLoaded = !1, this.delayedTransforms = null, this.src) {
1237
+ if (function(s) {
1238
+ if (Ot(s)) return !1;
1239
+ var n = window.location, a = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(s) || [], h = { protocol: a[1] || "", host: a[2] || "", port: a[3] || "" }, r = function(c) {
1240
+ return c.port || ((c.protocol || n.protocol) === "http" ? 80 : 433);
1241
+ };
1242
+ return !(!h.protocol && !h.host && !h.port || h.protocol && h.protocol == n.protocol && h.host && h.host == n.host && h.host && r(h) == r(n));
1243
+ }(this.src)) {
1244
+ var i = R(this.crossOrigin) ? this.canvas : this.crossOrigin;
1245
+ i === !0 && (i = "anonymous"), this.imageAttributes.crossOrigin = i || null;
1246
+ }
1247
+ if (this.checkOrientation) {
1248
+ var o = (t = this.src, new Promise(function(s) {
1249
+ Pe(t).then(function(n) {
1250
+ var a = Be(n);
1251
+ s(n ? { source: t, arrayBuffer: n, orientation: a } : { source: t, arrayBuffer: null, orientation: null });
1252
+ }).catch(function(n) {
1253
+ console.warn(n), s({ source: t, arrayBuffer: null, orientation: null });
1254
+ });
1255
+ }));
1256
+ setTimeout(function() {
1257
+ o.then(e.onParseImage);
1258
+ }, this.transitionTime);
1259
+ } else setTimeout(function() {
1260
+ e.onParseImage({ source: e.src });
1261
+ }, this.transitionTime);
1262
+ } else this.clearImage();
1263
+ }, onFailLoadImage: function() {
1264
+ this.imageAttributes.src && (this.clearImage(), this.$emit("error"));
1265
+ }, onSuccessLoadImage: function() {
1266
+ var t = this, e = this.$refs.image;
1267
+ e && !this.imageLoaded && (this.imageAttributes.height = e.naturalHeight, this.imageAttributes.width = e.naturalWidth, this.imageLoaded = !0, this.resetVisibleArea().then(function() {
1268
+ t.$emit("ready"), t.onChange(!1);
1269
+ }));
1270
+ }, onParseImage: function(t) {
1271
+ var e = this, i = t.source, o = t.arrayBuffer, s = t.orientation;
1272
+ this.imageAttributes.revoke && this.imageAttributes.src && URL.revokeObjectURL(this.imageAttributes.src), this.imageAttributes.revoke = !1, o && s && s > 1 ? Yt(i) || !Ot(i) ? (this.imageAttributes.src = URL.createObjectURL(new Blob([o])), this.imageAttributes.revoke = !0) : this.imageAttributes.src = function(n) {
1273
+ for (var a = [], h = new Uint8Array(n); h.length > 0; ) {
1274
+ var r = h.subarray(0, 8192);
1275
+ a.push(String.fromCharCode.apply(null, Array.from ? Array.from(r) : r.slice())), h = h.subarray(8192);
1276
+ }
1277
+ return "data:image/jpeg;base64," + btoa(a.join(""));
1278
+ }(o) : this.imageAttributes.src = i, F(this.defaultTransforms) ? this.appliedImageTransforms = dt(this.defaultTransforms()) : it(this.defaultTransforms) ? this.appliedImageTransforms = dt(this.defaultTransforms) : this.appliedImageTransforms = function(n) {
1279
+ var a = dt({});
1280
+ if (n) switch (n) {
1281
+ case 2:
1282
+ a.flip.horizontal = !0;
1283
+ break;
1284
+ case 3:
1285
+ a.rotate = -180;
1286
+ break;
1287
+ case 4:
1288
+ a.flip.vertical = !0;
1289
+ break;
1290
+ case 5:
1291
+ a.rotate = 90, a.flip.vertical = !0;
1292
+ break;
1293
+ case 6:
1294
+ a.rotate = 90;
1295
+ break;
1296
+ case 7:
1297
+ a.rotate = 90, a.flip.horizontal = !0;
1298
+ break;
1299
+ case 8:
1300
+ a.rotate = -90;
1301
+ }
1302
+ return a;
1303
+ }(s), this.defaultImageTransforms = v(v({}, this.appliedImageTransforms), {}, { flip: v({}, this.appliedImageTransforms.flip) }), this.$nextTick(function() {
1304
+ var n = e.$refs.image;
1305
+ n && n.complete && (function(a) {
1306
+ return !!a.naturalWidth;
1307
+ }(n) ? e.onSuccessLoadImage() : e.onFailLoadImage());
1308
+ });
1309
+ }, onResizeEnd: function() {
1310
+ this.runAutoZoom("resize", { transitions: !0 });
1311
+ }, onMoveEnd: function() {
1312
+ this.runAutoZoom("move", { transitions: !0 });
1313
+ }, onMove: function(t) {
1314
+ var e = this;
1315
+ this.transitionsOptions.enabled || this.awaitRender(function() {
1316
+ e.coordinates = e.moveAlgorithm(v(v({}, e.getPublicProperties()), {}, { positionRestrictions: J(e.positionRestrictions, e.visibleArea), coordinates: e.coordinates, event: e.normalizeEvent(t) })), e.onChange();
1317
+ });
1318
+ }, onResize: function(t) {
1319
+ var e = this;
1320
+ this.transitionsOptions.enabled || this.stencilSize && !this.autoZoom || this.awaitRender(function() {
1321
+ var i = e.sizeRestrictions, o = Math.min(e.coordinates.width, e.coordinates.height, 20 * e.coefficient);
1322
+ e.coordinates = e.resizeAlgorithm(v(v({}, e.getPublicProperties()), {}, { positionRestrictions: J(e.positionRestrictions, e.visibleArea), sizeRestrictions: { maxWidth: Math.min(i.maxWidth, e.visibleArea.width), maxHeight: Math.min(i.maxHeight, e.visibleArea.height), minWidth: Math.max(i.minWidth, o), minHeight: Math.max(i.minHeight, o) }, event: e.normalizeEvent(t) })), e.onChange(), e.ticking = !1;
1323
+ });
1324
+ }, onManipulateImage: function(t) {
1325
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1326
+ if (!this.transitionsOptions.enabled) {
1327
+ var i = e.transitions, o = i !== void 0 && i, s = e.normalize, n = s === void 0 || s;
1328
+ o && this.enableTransitions();
1329
+ var a = Ce(v(v({}, this.getPublicProperties()), {}, { event: n ? this.normalizeEvent(t) : t, getAreaRestrictions: this.getAreaRestrictions, imageRestriction: this.imageRestriction, adjustStencil: !this.stencilSize && this.settings.resizeImage.adjustStencil })), h = a.visibleArea, r = a.coordinates;
1330
+ this.visibleArea = h, this.coordinates = r, this.runAutoZoom("manipulateImage"), this.onChange(), o && this.debouncedDisableTransitions();
1331
+ }
1332
+ }, onPropsChange: function() {
1333
+ this.coordinates = this.applyTransform(this.coordinates, !0), this.onChange(!1);
1334
+ }, getAreaRestrictions: function() {
1335
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = t.visibleArea, i = t.type, o = i === void 0 ? "move" : i;
1336
+ return this.areaRestrictionsAlgorithm({ boundaries: this.boundaries, imageSize: this.imageSize, imageRestriction: this.imageRestriction, visibleArea: e, type: o });
1337
+ }, getAspectRatio: function(t) {
1338
+ var e, i, o = this.stencilProps, s = o.aspectRatio, n = o.minAspectRatio, a = o.maxAspectRatio;
1339
+ if (this.$refs.stencil && this.$refs.stencil.aspectRatios) {
1340
+ var h = this.$refs.stencil.aspectRatios();
1341
+ e = h.minimum, i = h.maximum;
1342
+ }
1343
+ if (R(e) && (e = R(s) ? n : s), R(i) && (i = R(s) ? a : s), !t && (R(e) || R(i))) {
1344
+ var r = this.getStencilSize(), c = r ? b(r) : null;
1345
+ R(e) && (e = Dt(c) ? c : void 0), R(i) && (i = Dt(c) ? c : void 0);
1346
+ }
1347
+ return { minimum: e, maximum: i };
1348
+ }, getStencilSize: function() {
1349
+ if (this.stencilSize) return t = { currentStencilSize: { width: this.stencilCoordinates.width, height: this.stencilCoordinates.height }, stencilSize: this.stencilSize, boundaries: this.boundaries, coefficient: this.coefficient, coordinates: this.coordinates, aspectRatio: this.getAspectRatio(!0) }, e = t.boundaries, i = t.stencilSize, o = t.aspectRatio, lt(b(s = F(i) ? i({ boundaries: e, aspectRatio: o }) : i), o) && (s = P({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: s.width, height: s.height, aspectRatio: { minimum: o.minimum, maximum: o.maximum } })), (s.width > e.width || s.height > e.height) && (s = P({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: s.width, height: s.height, aspectRatio: { minimum: b(s), maximum: b(s) } })), s;
1350
+ var t, e, i, o, s;
1351
+ }, getPublicProperties: function() {
1352
+ return { coefficient: this.coefficient, visibleArea: this.visibleArea, coordinates: this.coordinates, boundaries: this.boundaries, sizeRestrictions: this.sizeRestrictions, positionRestrictions: this.positionRestrictions, aspectRatio: this.getAspectRatio(), imageRestriction: this.imageRestriction };
1353
+ }, defaultCoordinates: function() {
1354
+ return v({}, It);
1355
+ }, flip: function(t, e) {
1356
+ var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
1357
+ if (!this.transitionsActive) {
1358
+ s && this.enableTransitions();
1359
+ var n = v({}, this.imageTransforms.flip), a = We({ flip: { horizontal: t ? !n.horizontal : n.horizontal, vertical: e ? !n.vertical : n.vertical }, previousFlip: n, rotate: this.imageTransforms.rotate, visibleArea: this.visibleArea, coordinates: this.coordinates, imageSize: this.imageSize, positionRestrictions: this.positionRestrictions, sizeRestrictions: this.sizeRestrictions, getAreaRestrictions: this.getAreaRestrictions, aspectRatio: this.getAspectRatio() }), h = a.visibleArea, r = a.coordinates;
1360
+ t && (this.appliedImageTransforms.flip.horizontal = !this.appliedImageTransforms.flip.horizontal), e && (this.appliedImageTransforms.flip.vertical = !this.appliedImageTransforms.flip.vertical), this.visibleArea = h, this.coordinates = r, this.onChange(), s && this.debouncedDisableTransitions();
1361
+ }
1362
+ }, rotate: function(t) {
1363
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, o = i === void 0 || i;
1364
+ if (!this.transitionsActive) {
1365
+ o && this.enableTransitions();
1366
+ var s = v({}, this.imageSize);
1367
+ this.appliedImageTransforms.rotate += t;
1368
+ var n = Te({ visibleArea: this.visibleArea, coordinates: this.coordinates, previousImageSize: s, imageSize: this.imageSize, angle: t, positionRestrictions: this.positionRestrictions, sizeRestrictions: this.sizeRestrictions, getAreaRestrictions: this.getAreaRestrictions, aspectRatio: this.getAspectRatio() }), a = n.visibleArea, h = n.coordinates, r = this.processAutoZoom("rotateImage", a, h);
1369
+ a = r.visibleArea, h = r.coordinates, this.visibleArea = a, this.coordinates = h, this.onChange(), o && this.debouncedDisableTransitions();
1370
+ }
1371
+ } }, emits: ["change", "error", "ready"] }, ke = { key: 0, ref: "canvas", style: { display: "none" } }, Fe = { key: 1, ref: "sourceCanvas", style: { display: "none" } };
1372
+ se.render = function(t, e, i, o, s, n) {
1373
+ return w(), y("div", { ref: "cropper", class: n.classes.cropper }, [A("div", { ref: "stretcher", class: n.classes.stretcher }, null, 2), A("div", { class: n.classes.boundaries, style: n.boundariesStyle }, [(w(), y(nt(i.backgroundWrapperComponent), { class: n.classes.cropperWrapper, "wheel-resize": n.settings.resizeImage.wheel, "touch-resize": n.settings.resizeImage.touch, "touch-move": n.settings.moveImage.touch, "mouse-move": n.settings.moveImage.mouse, onMove: n.onManipulateImage, onResize: n.onManipulateImage }, { default: $(function() {
1374
+ return [A("div", { class: n.classes.background, style: n.boundariesStyle }, null, 6), A("div", { class: n.classes.imageWrapper }, [A("img", { ref: "image", crossorigin: s.imageAttributes.crossOrigin, src: s.imageAttributes.src, class: n.classes.image, style: n.imageStyle, onMousedown: e[1] || (e[1] = At(function() {
1375
+ }, ["prevent"])) }, null, 46, ["crossorigin", "src"])], 2), A("div", { class: n.classes.foreground, style: n.boundariesStyle }, null, 6), Bt((w(), y(nt(i.stencilComponent), ot({ ref: "stencil", image: n.image, coordinates: s.coordinates, "stencil-coordinates": n.stencilCoordinates, transitions: n.transitionsOptions }, i.stencilProps, { onResize: n.onResize, onResizeEnd: n.onResizeEnd, onMove: n.onMove, onMoveEnd: n.onMoveEnd }), null, 16, ["image", "coordinates", "stencil-coordinates", "transitions", "onResize", "onResizeEnd", "onMove", "onMoveEnd"])), [[Ut, s.imageLoaded]]), i.canvas ? (w(), y("canvas", ke, null, 512)) : pt("", !0), i.canvas ? (w(), y("canvas", Fe, null, 512)) : pt("", !0)];
1376
+ }), _: 1 }, 8, ["class", "wheel-resize", "touch-resize", "touch-move", "mouse-move", "onMove", "onResize"]))], 6)], 2);
1377
+ };
1378
+ const Xe = {
1379
+ name: "ImageUploadModal",
1380
+ components: {
1381
+ Cropper: se
1382
+ },
1383
+ emits: ["close"],
1384
+ props: {
1385
+ imageData: {
1386
+ type: String,
1387
+ required: !0
1388
+ },
1389
+ onImageUpload: {
1390
+ type: Function,
1391
+ required: !0
1392
+ },
1393
+ fileName: {
1394
+ type: String,
1395
+ default: "filename.png"
1396
+ },
1397
+ cropperOptions: {
1398
+ type: Object,
1399
+ default: () => ({})
1400
+ }
1401
+ },
1402
+ data() {
1403
+ return {
1404
+ currentTarget: null
1405
+ };
1406
+ },
1407
+ methods: {
1408
+ onSave() {
1409
+ const { canvas: t } = this.$refs.cropper.getResult();
1410
+ t && t.toBlob((e) => {
1411
+ const i = new File([e], this.fileName, { type: e.type });
1412
+ return this.onImageUpload(i).then(() => {
1413
+ this.$emit("close");
1414
+ });
1415
+ });
1416
+ }
1417
+ }
1418
+ }, Ye = { class: "flex min-h-0 max-w-[calc(100%_-_4_*_var(--rem))] flex-auto items-center justify-center pt-8" }, Ne = { class: "shrink-0 flex-grow py-8" };
1419
+ function _e(t, e, i, o, s, n) {
1420
+ const a = T("CButton"), h = T("Cropper");
1421
+ return w(), Ft("div", {
1422
+ class: "fixed inset-0 flex h-full w-full flex-col items-center justify-center gap-8 bg-black/80",
1423
+ onMousedown: e[1] || (e[1] = (r) => s.currentTarget = r.target),
1424
+ onMouseup: e[2] || (e[2] = At((r) => s.currentTarget === r.target ? t.$emit("close") : null, ["self"]))
1425
+ }, [
1426
+ A(a, {
1427
+ circle: "",
1428
+ icon: "x",
1429
+ type: "text",
1430
+ class: "absolute right-2 top-2 z-50 border-transparent bg-black/50 text-white/90",
1431
+ onClick: e[0] || (e[0] = (r) => t.$emit("close"))
1432
+ }),
1433
+ gt("div", Ye, [
1434
+ A(h, ot(i.cropperOptions, {
1435
+ ref: "cropper",
1436
+ src: i.imageData,
1437
+ class: "h-full w-full"
1438
+ }), null, 16, ["src"])
1439
+ ]),
1440
+ gt("div", Ne, [
1441
+ A(a, {
1442
+ type: "secondary",
1443
+ class: "w-36",
1444
+ onClick: n.onSave
1445
+ }, {
1446
+ default: $(() => [
1447
+ ae(he(t.$t("_common:save")), 1)
1448
+ ]),
1449
+ _: 1
1450
+ }, 8, ["onClick"])
1451
+ ])
1452
+ ], 32);
1453
+ }
1454
+ const Ve = /* @__PURE__ */ kt(Xe, [["render", _e]]), qe = {
1455
+ i18nOptions: {
1456
+ namespaces: "imageUploadWrapper",
1457
+ messages: {
1458
+ en: {
1459
+ warningMessageValidFormats: "Invalid file format. Valid file formats are"
1460
+ },
1461
+ sv: {
1462
+ warningMessageValidFormats: "Filformatet är fel. Giltiga format är"
1463
+ }
1464
+ }
1465
+ },
1466
+ name: "ImageUploadWrapper",
1467
+ components: {
1468
+ BaseUpload: re
1469
+ },
1470
+ emits: ["upload"],
1471
+ props: {
1472
+ onImageUpload: {
1473
+ type: Function,
1474
+ required: !0
1475
+ },
1476
+ cropperOptions: {
1477
+ type: Object,
1478
+ default: () => ({})
1479
+ },
1480
+ uploadOptions: {
1481
+ type: Object,
1482
+ default: () => ({})
1483
+ }
1484
+ },
1485
+ data() {
1486
+ return {
1487
+ newFiles: [],
1488
+ isModalOpen: !1,
1489
+ isUpdatingImage: !1,
1490
+ default: {
1491
+ multiple: !1,
1492
+ drop: !0,
1493
+ accept: "image/png, image/jpg, image/bmp, image/gif, image/jpeg, image/tiff, image/webp"
1494
+ }
1495
+ };
1496
+ },
1497
+ computed: {
1498
+ mergedUploadOptions() {
1499
+ return { ...this.default, ...this.uploadOptions };
1500
+ },
1501
+ progress() {
1502
+ return this.newFiles.length ? parseInt(this.newFiles[this.newFiles.length - 1].progress, 10) : 0;
1503
+ }
1504
+ },
1505
+ methods: {
1506
+ onClick() {
1507
+ this.$refs.upload && this.$refs.upload.$el.querySelector("input[type='file']").click();
1508
+ },
1509
+ uploadImg(t) {
1510
+ if (this.isModalOpen && !this.isUpdatingImage) return;
1511
+ const { file: e } = t[t.length - 1];
1512
+ if (!this.mergedUploadOptions.accept.includes(e.type)) {
1513
+ ce(
1514
+ "warning",
1515
+ `${this.$t("warningMessageValidFormats")}: gif, jpeg, jpg, png, bmp`
1516
+ );
1517
+ return;
1518
+ }
1519
+ const i = new FileReader();
1520
+ i.onload = (o) => {
1521
+ let s;
1522
+ typeof o.target.result == "object" ? s = window.URL.createObjectURL(new Blob([o.target.result])) : s = o.target.result, this.show(s, e.name);
1523
+ }, i.readAsArrayBuffer(e);
1524
+ },
1525
+ show(t, e) {
1526
+ this.isModalOpen = !0, this.$modal.show(
1527
+ Ve,
1528
+ {
1529
+ cropperOptions: this.cropperOptions,
1530
+ imageData: t,
1531
+ onImageUpload: this.updateFile,
1532
+ fileName: e
1533
+ },
1534
+ {
1535
+ height: "100%",
1536
+ width: "100%",
1537
+ classes: ""
1538
+ },
1539
+ {
1540
+ "before-close": () => {
1541
+ this.isModalOpen = !1;
1542
+ }
1543
+ }
1544
+ );
1545
+ },
1546
+ async updateFile(t) {
1547
+ this.$emit("upload"), this.isUpdatingImage = !0;
1548
+ const e = this.$refs.upload.$refs.upload.files, i = e[e.length - 1], o = i;
1549
+ o.file = t;
1550
+ const s = await this.$refs.upload.compressFile(o.file);
1551
+ await this.$refs.upload.$refs.upload.update(i, {
1552
+ ...s,
1553
+ active: !0
1554
+ });
1555
+ }
1556
+ }
1557
+ };
1558
+ function Ze(t, e, i, o, s, n) {
1559
+ const a = T("BaseUpload");
1560
+ return w(), Ft("div", null, [
1561
+ A(a, ot(n.mergedUploadOptions, {
1562
+ ref: "upload",
1563
+ "model-value": s.newFiles,
1564
+ "onUpdate:modelValue": e[0] || (e[0] = (h) => s.isUpdatingImage ? null : n.uploadImg(h)),
1565
+ onUploadSuccess: e[1] || (e[1] = (h) => {
1566
+ s.isUpdatingImage = !1, i.onImageUpload(h);
1567
+ })
1568
+ }), {
1569
+ default: $(() => [
1570
+ t.$slots.image ? B(t.$slots, "image", { key: 0 }, void 0, !0) : pt("", !0)
1571
+ ]),
1572
+ _: 3
1573
+ }, 16, ["model-value"]),
1574
+ gt("div", {
1575
+ style: { cursor: "pointer" },
1576
+ onClick: e[2] || (e[2] = At((...h) => n.onClick && n.onClick(...h), ["stop", "prevent"]))
1577
+ }, [
1578
+ B(t.$slots, "default", { progress: n.progress }, void 0, !0)
1579
+ ])
1580
+ ]);
1581
+ }
1582
+ const Ke = /* @__PURE__ */ kt(qe, [["render", Ze], ["__scopeId", "data-v-714387c8"]]);
1583
+ export {
1584
+ Ke as default
1585
+ };