@templatical/media-library 0.39.0 → 0.39.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 (38) hide show
  1. package/README.md +2 -3
  2. package/dist/MediaEditModal-DltAfTVH.js +311 -0
  3. package/dist/{ca-CGf3MuE2.js → ca-B1Ig3u8O.js} +9 -0
  4. package/dist/cdn/chunks/MediaEditModal-CeKcr-C0.js +3528 -0
  5. package/dist/cdn/chunks/MediaEditModal-CeKcr-C0.js.map +1 -0
  6. package/dist/cdn/chunks/{ca-CGf3MuE2.js → ca-B1Ig3u8O.js} +10 -1
  7. package/dist/cdn/chunks/{ca-CGf3MuE2.js.map → ca-B1Ig3u8O.js.map} +1 -1
  8. package/dist/cdn/chunks/{de-D5ebAV5i.js → de-BNbyJubD.js} +10 -1
  9. package/dist/cdn/chunks/{de-D5ebAV5i.js.map → de-BNbyJubD.js.map} +1 -1
  10. package/dist/cdn/chunks/en-CQxhpwqd.js +101 -0
  11. package/dist/cdn/chunks/en-CQxhpwqd.js.map +1 -0
  12. package/dist/cdn/chunks/{es-BG--QNW0.js → es-B2EH-TdJ.js} +10 -1
  13. package/dist/cdn/chunks/{es-BG--QNW0.js.map → es-B2EH-TdJ.js.map} +1 -1
  14. package/dist/cdn/chunks/{fr-Mdi4AlCR.js → fr-9SWy_n9K.js} +10 -1
  15. package/dist/cdn/chunks/{fr-Mdi4AlCR.js.map → fr-9SWy_n9K.js.map} +1 -1
  16. package/dist/cdn/chunks/{icons-DJG-T8pC.js → icons-DWBJnZvW.js} +1132 -1032
  17. package/dist/cdn/chunks/icons-DWBJnZvW.js.map +1 -0
  18. package/dist/{nl-D-6hT8te.js → cdn/chunks/nl-DJasgSvI.js} +11 -0
  19. package/dist/cdn/chunks/{nl-D-6hT8te.js.map → nl-DJasgSvI.js.map} +1 -1
  20. package/dist/cdn/chunks/{pt-BR-DMfAgDWi.js → pt-BR-BtCfbqSj.js} +10 -1
  21. package/dist/cdn/chunks/{pt-BR-DMfAgDWi.js.map → pt-BR-BtCfbqSj.js.map} +1 -1
  22. package/dist/cdn/chunks/useFocusTrap-tWtljvAm.js +535 -0
  23. package/dist/cdn/chunks/useFocusTrap-tWtljvAm.js.map +1 -0
  24. package/dist/cdn/media-library.css +1 -1
  25. package/dist/cdn/media-library.js +1422 -5258
  26. package/dist/cdn/media-library.js.map +1 -1
  27. package/dist/{de-D5ebAV5i.js → de-BNbyJubD.js} +9 -0
  28. package/dist/en-CQxhpwqd.js +99 -0
  29. package/dist/{es-BG--QNW0.js → es-B2EH-TdJ.js} +9 -0
  30. package/dist/{fr-Mdi4AlCR.js → fr-9SWy_n9K.js} +9 -0
  31. package/dist/index.d.ts +9 -0
  32. package/dist/{cdn/chunks/nl-D-6hT8te.js → nl-DJasgSvI.js} +9 -2
  33. package/dist/{pt-BR-DMfAgDWi.js → pt-BR-BtCfbqSj.js} +9 -0
  34. package/dist/templatical-media-library.css +1 -1
  35. package/dist/templatical-media-library.js +1320 -1931
  36. package/dist/useFocusTrap-6eIRXtCA.js +111 -0
  37. package/package.json +9 -9
  38. package/dist/cdn/chunks/icons-DJG-T8pC.js.map +0 -1
@@ -0,0 +1,3528 @@
1
+ import { A as e, D as t, E as n, F as r, G as i, H as a, J as o, K as s, M as c, N as l, O as u, R as d, S as f, T as p, W as m, X as h, Z as g, ct as _, dt as v, j as y, k as b, lt as ee, nt as x, q as S, ut as te, w as ne, x as re, y as ie, z as ae } from "./icons-DWBJnZvW.js";
2
+ import { f as oe, h as se, l as ce, n as le, t as ue, u as de } from "./useFocusTrap-tWtljvAm.js";
3
+ //#region src/composables/useImageCrop.ts
4
+ var fe = {
5
+ free: void 0,
6
+ square: 1,
7
+ landscape43: 4 / 3,
8
+ landscape169: 16 / 9,
9
+ original: void 0
10
+ };
11
+ function pe(e) {
12
+ return e === "image/png" || e === "image/gif" ? {
13
+ mimeType: "image/png",
14
+ quality: 1
15
+ } : e === "image/webp" ? {
16
+ mimeType: "image/webp",
17
+ quality: .92
18
+ } : {
19
+ mimeType: "image/jpeg",
20
+ quality: .92
21
+ };
22
+ }
23
+ function me(e, t, n) {
24
+ let r = e.width, i = e.height;
25
+ if (!t && !n) return e;
26
+ let a = r, o = i;
27
+ if (t && r > t && (a = t, o = Math.round(t / r * i)), n && o > n) {
28
+ let e = n / o;
29
+ a = Math.round(a * e), o = n;
30
+ }
31
+ if (a === r && o === i) return e;
32
+ let s = document.createElement("canvas");
33
+ s.width = a, s.height = o;
34
+ let c = s.getContext("2d");
35
+ return c && (c.imageSmoothingEnabled = !0, c.imageSmoothingQuality = "high", c.drawImage(e, 0, 0, a, o)), s;
36
+ }
37
+ function he(e, t, n) {
38
+ return new Promise((r, i) => {
39
+ e.toBlob((e) => {
40
+ if (!e) {
41
+ i(/* @__PURE__ */ Error("Failed to create blob from canvas"));
42
+ return;
43
+ }
44
+ let a = n.mimeType.split("/")[1], o = `${t.replace(/\.[^.]+$/, "")}.${a}`;
45
+ r(new File([e], o, { type: n.mimeType }));
46
+ }, n.mimeType, n.quality);
47
+ });
48
+ }
49
+ function ge(e, t, n, r) {
50
+ let i = e, a = t;
51
+ if (n && i > n) {
52
+ let e = n / i;
53
+ i = n, a = Math.round(a * e);
54
+ }
55
+ if (r && a > r) {
56
+ let e = r / a;
57
+ a = r, i = Math.round(i * e);
58
+ }
59
+ return {
60
+ width: i,
61
+ height: a
62
+ };
63
+ }
64
+ //#endregion
65
+ //#region ../../node_modules/.pnpm/vue-advanced-cropper@2.8.9_vue@3.5.43_typescript@6.0.3_/node_modules/vue-advanced-cropper/dist/index.esm-bundler.js
66
+ function _e(e, t) {
67
+ var n = Object.keys(e);
68
+ if (Object.getOwnPropertySymbols) {
69
+ var r = Object.getOwnPropertySymbols(e);
70
+ t && (r = r.filter((function(t) {
71
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
72
+ }))), n.push.apply(n, r);
73
+ }
74
+ return n;
75
+ }
76
+ function C(e) {
77
+ for (var t = 1; t < arguments.length; t++) {
78
+ var n = arguments[t] == null ? {} : arguments[t];
79
+ t % 2 ? _e(Object(n), !0).forEach((function(t) {
80
+ w(e, t, n[t]);
81
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : _e(Object(n)).forEach((function(t) {
82
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
83
+ }));
84
+ }
85
+ return e;
86
+ }
87
+ function w(e, t, n) {
88
+ return t in e ? Object.defineProperty(e, t, {
89
+ value: n,
90
+ enumerable: !0,
91
+ configurable: !0,
92
+ writable: !0
93
+ }) : e[t] = n, e;
94
+ }
95
+ function T(e, t) {
96
+ if (e == null) return {};
97
+ var n, r, i = function(e, t) {
98
+ if (e == null) return {};
99
+ var n, r, i = {}, a = Object.keys(e);
100
+ for (r = 0; r < a.length; r++) n = a[r], t.indexOf(n) >= 0 || (i[n] = e[n]);
101
+ return i;
102
+ }(e, t);
103
+ if (Object.getOwnPropertySymbols) {
104
+ var a = Object.getOwnPropertySymbols(e);
105
+ for (r = 0; r < a.length; r++) n = a[r], t.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
106
+ }
107
+ return i;
108
+ }
109
+ function E(e) {
110
+ return function(e) {
111
+ if (Array.isArray(e)) return D(e);
112
+ }(e) || function(e) {
113
+ if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null) return Array.from(e);
114
+ }(e) || function(e, t) {
115
+ if (e) {
116
+ if (typeof e == "string") return D(e, t);
117
+ var n = Object.prototype.toString.call(e).slice(8, -1);
118
+ if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set") return Array.from(e);
119
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return D(e, t);
120
+ }
121
+ }(e) || function() {
122
+ throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
123
+ }();
124
+ }
125
+ function D(e, t) {
126
+ (t == null || t > e.length) && (t = e.length);
127
+ for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
128
+ return r;
129
+ }
130
+ var ve = function(e) {
131
+ (function() {
132
+ var t = {}.hasOwnProperty;
133
+ function n() {
134
+ for (var e = [], r = 0; r < arguments.length; r++) {
135
+ var i = arguments[r];
136
+ if (i) {
137
+ var a = typeof i;
138
+ if (a === "string" || a === "number") e.push(i);
139
+ else if (Array.isArray(i)) {
140
+ if (i.length) {
141
+ var o = n.apply(null, i);
142
+ o && e.push(o);
143
+ }
144
+ } else if (a === "object") {
145
+ if (i.toString === Object.prototype.toString) for (var s in i) t.call(i, s) && i[s] && e.push(s);
146
+ else e.push(i.toString());
147
+ }
148
+ }
149
+ }
150
+ return e.join(" ");
151
+ }
152
+ e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
153
+ })();
154
+ }, ye, O, k = (ve(O = {
155
+ path: ye,
156
+ exports: {},
157
+ require: function(e, t) {
158
+ return function() {
159
+ throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
160
+ }(t == null && O.path);
161
+ }
162
+ }, O.exports), O.exports), A = function(e) {
163
+ return function(t, n) {
164
+ if (!t) return e;
165
+ var r;
166
+ typeof t == "string" ? r = t : n = t;
167
+ var i = e;
168
+ return r && (i += "__" + r), i + (n ? Object.keys(n).reduce((function(e, t) {
169
+ var r = n[t];
170
+ return r && (e += " " + (typeof r == "boolean" ? i + "--" + t : i + "--" + t + "_" + r)), e;
171
+ }), "") : "");
172
+ };
173
+ };
174
+ function j(e, t, n) {
175
+ var r, i, a, o, s;
176
+ function c() {
177
+ var l = Date.now() - o;
178
+ l < t && l >= 0 ? r = setTimeout(c, t - l) : (r = null, n || (s = e.apply(a, i), a = i = null));
179
+ }
180
+ t ??= 100;
181
+ var l = function() {
182
+ a = this, i = arguments, o = Date.now();
183
+ var l = n && !r;
184
+ return r ||= setTimeout(c, t), l && (s = e.apply(a, i), a = i = null), s;
185
+ };
186
+ return l.clear = function() {
187
+ r &&= (clearTimeout(r), null);
188
+ }, l.flush = function() {
189
+ r &&= (s = e.apply(a, i), a = i = null, clearTimeout(r), null);
190
+ }, l;
191
+ }
192
+ j.debounce = j;
193
+ var M = j, N = function() {
194
+ return N = Object.assign || function(e) {
195
+ for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
196
+ return e;
197
+ }, N.apply(this, arguments);
198
+ };
199
+ function P(e, t) {
200
+ var n, r;
201
+ return e && t ? (n = "" + e + t[0].toUpperCase() + t.slice(1), r = e + "-" + t) : (n = e || t, r = e || t), {
202
+ name: n,
203
+ classname: r
204
+ };
205
+ }
206
+ function F(e) {
207
+ return /^blob:/.test(e);
208
+ }
209
+ function be(e) {
210
+ return F(e) || function(e) {
211
+ return /^data:/.test(e);
212
+ }(e);
213
+ }
214
+ function I(e) {
215
+ return !!(e && e.constructor && e.call && e.apply);
216
+ }
217
+ function L(e) {
218
+ return e === void 0;
219
+ }
220
+ function R(e) {
221
+ return typeof e == "object" && !!e;
222
+ }
223
+ function xe(e, t, n) {
224
+ var r = {};
225
+ return R(e) ? (Object.keys(t).forEach((function(i) {
226
+ r[i] = L(e[i]) ? t[i] : R(t[i]) ? R(e[i]) ? xe(e[i], t[i], n[i]) : e[i] ? t[i] : n[i] : !0 === t[i] || !1 === t[i] ? !!e[i] : e[i];
227
+ })), r) : e ? t : n;
228
+ }
229
+ function Se(e) {
230
+ var t = Number(e);
231
+ return Number.isNaN(t) ? e : t;
232
+ }
233
+ function Ce(e) {
234
+ return typeof (e == "number" || function(e) {
235
+ return typeof e == "object" && !!e;
236
+ }(e) && toString.call(e) == "[object Number]") && !we(e);
237
+ }
238
+ function we(e) {
239
+ return e != e;
240
+ }
241
+ function Te(e, t) {
242
+ return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
243
+ }
244
+ var z = function(e, t) {
245
+ e === void 0 && (e = {}), t === void 0 && (t = {}), this.type = "manipulateImage", this.move = e, this.scale = t;
246
+ }, Ee = function(e, t) {
247
+ t === void 0 && (t = {}), this.type = "resize", this.directions = e, this.params = t;
248
+ }, De = function(e) {
249
+ this.type = "move", this.directions = e;
250
+ }, Oe = function() {
251
+ function e(e, t, n, r, i) {
252
+ this.type = "drag", this.nativeEvent = e, this.position = n, this.previousPosition = r, this.element = t, this.anchor = i;
253
+ }
254
+ return e.prototype.shift = function() {
255
+ var e = this, t = e.element, n = e.anchor, r = e.position;
256
+ if (t) {
257
+ var i = t.getBoundingClientRect(), a = i.left, o = i.top;
258
+ return {
259
+ left: r.left - a - n.left,
260
+ top: r.top - o - n.top
261
+ };
262
+ }
263
+ return {
264
+ left: 0,
265
+ top: 0
266
+ };
267
+ }, e;
268
+ }(), ke = {
269
+ name: "DraggableElement",
270
+ props: { classname: { type: String } },
271
+ beforeMount: function() {
272
+ 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 });
273
+ },
274
+ beforeUnmount: function() {
275
+ window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
276
+ },
277
+ mounted: function() {
278
+ if (!this.$refs.draggable) throw Error("You should add ref \"draggable\" to your root element to use draggable mixin");
279
+ this.touches = [], this.hovered = !1;
280
+ },
281
+ methods: {
282
+ onMouseOver: function() {
283
+ this.hovered || (this.hovered = !0, this.$emit("enter"));
284
+ },
285
+ onMouseLeave: function() {
286
+ this.hovered && !this.touches.length && (this.hovered = !1, this.$emit("leave"));
287
+ },
288
+ onTouchStart: function(e) {
289
+ e.cancelable && !this.disabled && e.touches.length === 1 && (this.touches = E(e.touches), this.hovered ||= (this.$emit("enter"), !0), e.touches.length && this.initAnchor(this.touches.reduce((function(t, n) {
290
+ return {
291
+ clientX: t.clientX + n.clientX / e.touches.length,
292
+ clientY: t.clientY + n.clientY / e.touches.length
293
+ };
294
+ }), {
295
+ clientX: 0,
296
+ clientY: 0
297
+ })), e.preventDefault && e.preventDefault(), e.stopPropagation());
298
+ },
299
+ onTouchEnd: function() {
300
+ this.processEnd();
301
+ },
302
+ onTouchMove: function(e) {
303
+ this.touches.length && (this.processMove(e, e.touches), e.preventDefault && e.preventDefault(), e.stopPropagation && e.stopPropagation());
304
+ },
305
+ onMouseDown: function(e) {
306
+ if (!this.disabled) {
307
+ var t = {
308
+ fake: !0,
309
+ clientX: e.clientX,
310
+ clientY: e.clientY
311
+ };
312
+ this.touches = [t], this.initAnchor(t), e.stopPropagation();
313
+ }
314
+ },
315
+ onMouseMove: function(e) {
316
+ this.touches.length && (this.processMove(e, [{
317
+ fake: !0,
318
+ clientX: e.clientX,
319
+ clientY: e.clientY
320
+ }]), e.preventDefault && e.preventDefault());
321
+ },
322
+ onMouseUp: function() {
323
+ this.processEnd();
324
+ },
325
+ initAnchor: function(e) {
326
+ var t = this.$refs.draggable.getBoundingClientRect(), n = t.left, r = t.right, i = t.bottom, a = t.top;
327
+ this.anchor = {
328
+ left: e.clientX - n,
329
+ top: e.clientY - a,
330
+ bottom: i - e.clientY,
331
+ right: r - e.clientX
332
+ };
333
+ },
334
+ processMove: function(e, t) {
335
+ var n = E(t);
336
+ if (this.touches.length) {
337
+ if (this.touches.length === 1 && n.length === 1) {
338
+ var r = this.$refs.draggable;
339
+ this.$emit("drag", new Oe(e, r, {
340
+ left: n[0].clientX,
341
+ top: n[0].clientY
342
+ }, {
343
+ left: this.touches[0].clientX,
344
+ top: this.touches[0].clientY
345
+ }, this.anchor));
346
+ }
347
+ this.touches = n;
348
+ }
349
+ },
350
+ processEnd: function() {
351
+ this.touches.length && this.$emit("drag-end"), this.hovered &&= (this.$emit("leave"), !1), this.touches = [];
352
+ }
353
+ },
354
+ emits: [
355
+ "drag",
356
+ "drag-end",
357
+ "leave",
358
+ "enter"
359
+ ]
360
+ };
361
+ ke.render = function(e, t, n, r, o, s) {
362
+ return a(), b("div", {
363
+ ref: "draggable",
364
+ class: n.classname,
365
+ onTouchstart: t[1] ||= function() {
366
+ return s.onTouchStart && s.onTouchStart.apply(s, arguments);
367
+ },
368
+ onMousedown: t[2] ||= function() {
369
+ return s.onMouseDown && s.onMouseDown.apply(s, arguments);
370
+ },
371
+ onMouseover: t[3] ||= function() {
372
+ return s.onMouseOver && s.onMouseOver.apply(s, arguments);
373
+ },
374
+ onMouseleave: t[4] ||= function() {
375
+ return s.onMouseLeave && s.onMouseLeave.apply(s, arguments);
376
+ }
377
+ }, [i(e.$slots, "default")], 34);
378
+ };
379
+ var Ae = A("vue-handler-wrapper"), je = {
380
+ name: "HandlerWrapper",
381
+ components: { DraggableElement: ke },
382
+ props: {
383
+ horizontalPosition: { type: String },
384
+ verticalPosition: { type: String },
385
+ disabled: {
386
+ type: Boolean,
387
+ default: !1
388
+ }
389
+ },
390
+ computed: { classes: function() {
391
+ var e;
392
+ if (this.horizontalPosition || this.verticalPosition) {
393
+ var t, n = P(this.horizontalPosition, this.verticalPosition);
394
+ e = Ae((w(t = {}, n.classname, !0), w(t, "disabled", this.disabled), t));
395
+ } else e = Ae({ disabled: this.disabled });
396
+ return {
397
+ root: e,
398
+ draggable: Ae("draggable")
399
+ };
400
+ } },
401
+ emits: [
402
+ "leave",
403
+ "enter",
404
+ "drag",
405
+ "drag-end"
406
+ ]
407
+ };
408
+ je.render = function(e, t, n, r, o, c) {
409
+ var u = s("DraggableElement");
410
+ return a(), b("div", { class: c.classes.root }, [l(u, {
411
+ class: c.classes.draggable,
412
+ onDrag: t[1] ||= function(t) {
413
+ return e.$emit("drag", t);
414
+ },
415
+ onDragEnd: t[2] ||= function(t) {
416
+ return e.$emit("drag-end");
417
+ },
418
+ onLeave: t[3] ||= function(t) {
419
+ return e.$emit("leave");
420
+ },
421
+ onEnter: t[4] ||= function(t) {
422
+ return e.$emit("enter");
423
+ }
424
+ }, {
425
+ default: h((function() {
426
+ return [i(e.$slots, "default")];
427
+ })),
428
+ _: 3
429
+ }, 8, ["class"])], 2);
430
+ };
431
+ var Me = A("vue-line-wrapper"), Ne = {
432
+ name: "LineWrapper",
433
+ components: { DraggableElement: ke },
434
+ props: {
435
+ position: {
436
+ type: String,
437
+ required: !0
438
+ },
439
+ disabled: {
440
+ type: Boolean,
441
+ default: !1
442
+ }
443
+ },
444
+ computed: { classname: function() {
445
+ var e;
446
+ return Me((w(e = {}, this.position, !0), w(e, "disabled", this.disabled), e));
447
+ } },
448
+ emits: [
449
+ "leave",
450
+ "enter",
451
+ "drag",
452
+ "drag-end"
453
+ ]
454
+ };
455
+ Ne.render = function(e, t, n, r, o, c) {
456
+ var l = s("DraggableElement");
457
+ return a(), b(l, {
458
+ class: c.classname,
459
+ onDrag: t[1] ||= function(t) {
460
+ return e.$emit("drag", t);
461
+ },
462
+ onDragEnd: t[2] ||= function(t) {
463
+ return e.$emit("drag-end");
464
+ },
465
+ onLeave: t[3] ||= function(t) {
466
+ return e.$emit("leave");
467
+ },
468
+ onEnter: t[4] ||= function(t) {
469
+ return e.$emit("enter");
470
+ }
471
+ }, {
472
+ default: h((function() {
473
+ return [i(e.$slots, "default")];
474
+ })),
475
+ _: 3
476
+ }, 8, ["class"]);
477
+ };
478
+ var B = [
479
+ "left",
480
+ "right",
481
+ "top",
482
+ "bottom"
483
+ ], Pe = ["left", "right"], Fe = ["top", "bottom"], Ie = ["left", "top"], Le = [
484
+ "fill-area",
485
+ "fit-area",
486
+ "stencil",
487
+ "none"
488
+ ], Re = {
489
+ left: 0,
490
+ top: 0,
491
+ width: 0,
492
+ height: 0
493
+ };
494
+ function ze(e, t, n) {
495
+ return !(n ||= [
496
+ "width",
497
+ "height",
498
+ "left",
499
+ "top"
500
+ ]).some((function(n) {
501
+ return e[n] !== t[n];
502
+ }));
503
+ }
504
+ function V(e) {
505
+ return {
506
+ left: e.left,
507
+ top: e.top,
508
+ right: e.left + e.width,
509
+ bottom: e.top + e.height
510
+ };
511
+ }
512
+ function H(e, t) {
513
+ return {
514
+ left: e.left - t.left,
515
+ top: e.top - t.top
516
+ };
517
+ }
518
+ function U(e) {
519
+ return {
520
+ left: e.left + e.width / 2,
521
+ top: e.top + e.height / 2
522
+ };
523
+ }
524
+ function Be(e, t) {
525
+ var n = {
526
+ left: 0,
527
+ top: 0,
528
+ right: 0,
529
+ bottom: 0
530
+ };
531
+ return B.forEach((function(r) {
532
+ var i = t[r], a = V(e)[r];
533
+ n[r] = i !== void 0 && a !== void 0 ? r === "left" || r === "top" ? Math.max(0, i - a) : Math.max(0, a - i) : 0;
534
+ })), n;
535
+ }
536
+ function W(e, t) {
537
+ return {
538
+ left: e.left - t.left,
539
+ top: e.top - t.top,
540
+ width: e.width + t.left + t.right,
541
+ height: e.height + t.top + t.bottom
542
+ };
543
+ }
544
+ function Ve(e) {
545
+ return {
546
+ left: -e.left,
547
+ top: -e.top
548
+ };
549
+ }
550
+ function G(e, t) {
551
+ return N(N({}, e), {
552
+ left: e.left + t.left,
553
+ top: e.top + t.top
554
+ });
555
+ }
556
+ function K(e, t, n, r) {
557
+ if (t !== 1) {
558
+ if (n) {
559
+ var i = U(e);
560
+ return {
561
+ width: e.width * t,
562
+ height: e.height * t,
563
+ left: e.left + e.width * (1 - t) / 2 + (n.left - i.left) * (r || 1 - t),
564
+ top: e.top + e.height * (1 - t) / 2 + (n.top - i.top) * (r || 1 - t)
565
+ };
566
+ }
567
+ return {
568
+ width: e.width * t,
569
+ height: e.height * t,
570
+ left: e.left + e.width * (1 - t) / 2,
571
+ top: e.top + e.height * (1 - t) / 2
572
+ };
573
+ }
574
+ return e;
575
+ }
576
+ function q(e) {
577
+ return e.width / e.height;
578
+ }
579
+ function J(e, t) {
580
+ return Math.min(t.right !== void 0 && t.left !== void 0 ? (t.right - t.left) / e.width : 1 / 0, t.bottom !== void 0 && t.top !== void 0 ? (t.bottom - t.top) / e.height : 1 / 0);
581
+ }
582
+ function Y(e, t) {
583
+ var n = {
584
+ left: 0,
585
+ top: 0
586
+ }, r = Be(e, t);
587
+ return r.left && r.left > 0 ? n.left = r.left : r.right && r.right > 0 && (n.left = -r.right), r.top && r.top > 0 ? n.top = r.top : r.bottom && r.bottom > 0 && (n.top = -r.bottom), n;
588
+ }
589
+ function He(e, t) {
590
+ var n;
591
+ return t.minimum && e < t.minimum ? n = t.minimum : t.maximum && e > t.maximum && (n = t.maximum), n;
592
+ }
593
+ function Ue(e, t) {
594
+ var n = q(e), r = q(t);
595
+ return t.width < 1 / 0 && t.height < 1 / 0 ? n > r ? {
596
+ width: t.width,
597
+ height: t.width / n
598
+ } : {
599
+ width: t.height * n,
600
+ height: t.height
601
+ } : t.width < 1 / 0 ? {
602
+ width: t.width,
603
+ height: t.width / n
604
+ } : t.height < 1 / 0 ? {
605
+ width: t.height * n,
606
+ height: t.height
607
+ } : e;
608
+ }
609
+ function We(e, t) {
610
+ var n = t * Math.PI / 180;
611
+ return {
612
+ width: Math.abs(e.width * Math.cos(n)) + Math.abs(e.height * Math.sin(n)),
613
+ height: Math.abs(e.width * Math.sin(n)) + Math.abs(e.height * Math.cos(n))
614
+ };
615
+ }
616
+ function X(e, t) {
617
+ var n = t * Math.PI / 180;
618
+ return {
619
+ left: e.left * Math.cos(n) - e.top * Math.sin(n),
620
+ top: e.left * Math.sin(n) + e.top * Math.cos(n)
621
+ };
622
+ }
623
+ function Ge(e, t) {
624
+ var n = Be(Z(e, t), t);
625
+ return n.left + n.right + n.top + n.bottom ? n.left + n.right > n.top + n.bottom ? Math.min((e.width + n.left + n.right) / e.width, J(e, t)) : Math.min((e.height + n.top + n.bottom) / e.height, J(e, t)) : 1;
626
+ }
627
+ function Z(e, t, n) {
628
+ n === void 0 && (n = !1);
629
+ var r = Y(e, t);
630
+ return G(e, n ? Ve(r) : r);
631
+ }
632
+ function Ke(e) {
633
+ return {
634
+ width: e.right !== void 0 && e.left !== void 0 ? e.right - e.left : 1 / 0,
635
+ height: e.bottom !== void 0 && e.top !== void 0 ? e.bottom - e.top : 1 / 0
636
+ };
637
+ }
638
+ function qe(e, t) {
639
+ return N(N({}, e), {
640
+ minWidth: Math.min(t.width, e.minWidth),
641
+ minHeight: Math.min(t.height, e.minHeight),
642
+ maxWidth: Math.min(t.width, e.maxWidth),
643
+ maxHeight: Math.min(t.height, e.maxHeight)
644
+ });
645
+ }
646
+ function Je(e, t, n) {
647
+ n === void 0 && (n = !0);
648
+ var r = {};
649
+ return B.forEach((function(i) {
650
+ var a = e[i], o = t[i];
651
+ a !== void 0 && o !== void 0 ? r[i] = i === "left" || i === "top" ? n ? Math.max(a, o) : Math.min(a, o) : n ? Math.min(a, o) : Math.max(a, o) : o === void 0 ? a !== void 0 && (r[i] = a) : r[i] = o;
652
+ })), r;
653
+ }
654
+ function Ye(e, t) {
655
+ return Je(e, t, !0);
656
+ }
657
+ function Xe(e) {
658
+ var t = e.size, n = e.aspectRatio, r = e.ignoreMinimum, i = e.sizeRestrictions;
659
+ return !!((t.correctRatio || q(t) >= n.minimum && q(t) <= n.maximum) && t.height <= i.maxHeight && t.width <= i.maxWidth && t.width && t.height && (r || t.height >= i.minHeight && t.width >= i.minWidth));
660
+ }
661
+ function Ze(e, t) {
662
+ return (e.width - t.width) ** 2 + (e.height - t.height) ** 2;
663
+ }
664
+ function Q(e) {
665
+ var t = e.width, n = e.height, r = e.sizeRestrictions, i = {
666
+ minimum: e.aspectRatio && e.aspectRatio.minimum || 0,
667
+ maximum: e.aspectRatio && e.aspectRatio.maximum || 1 / 0
668
+ }, a = {
669
+ width: Math.max(r.minWidth, Math.min(r.maxWidth, t)),
670
+ height: Math.max(r.minHeight, Math.min(r.maxHeight, n))
671
+ };
672
+ function o(e, a) {
673
+ return a === void 0 && (a = !1), e.reduce((function(e, o) {
674
+ return Xe({
675
+ size: o,
676
+ aspectRatio: i,
677
+ sizeRestrictions: r,
678
+ ignoreMinimum: a
679
+ }) && (!e || Ze(o, {
680
+ width: t,
681
+ height: n
682
+ }) < Ze(e, {
683
+ width: t,
684
+ height: n
685
+ })) ? o : e;
686
+ }), null);
687
+ }
688
+ var s = [];
689
+ i && [i.minimum, i.maximum].forEach((function(e) {
690
+ e && s.push({
691
+ width: a.width,
692
+ height: a.width / e,
693
+ correctRatio: !0
694
+ }, {
695
+ width: a.height * e,
696
+ height: a.height,
697
+ correctRatio: !0
698
+ });
699
+ })), Xe({
700
+ size: a,
701
+ aspectRatio: i,
702
+ sizeRestrictions: r
703
+ }) && s.push(a);
704
+ var c = o(s) || o(s, !0);
705
+ return c && {
706
+ width: c.width,
707
+ height: c.height
708
+ };
709
+ }
710
+ function Qe(e) {
711
+ var t = e.event, n = e.coordinates, r = e.positionRestrictions, i = r === void 0 ? {} : r, a = G(n, t.directions);
712
+ return G(a, Y(a, i));
713
+ }
714
+ function $e(e) {
715
+ var t = e.coordinates, n = e.transform, r = e.imageSize, i = e.sizeRestrictions, a = e.positionRestrictions, o = e.aspectRatio, s = e.visibleArea, c = function(e, t) {
716
+ return Qe({
717
+ coordinates: e,
718
+ positionRestrictions: a,
719
+ event: new De({
720
+ left: t.left - e.left,
721
+ top: t.top - e.top
722
+ })
723
+ });
724
+ }, l = N({}, t);
725
+ return (Array.isArray(n) ? n : [n]).forEach((function(e) {
726
+ var t = {};
727
+ L((t = typeof e == "function" ? e({
728
+ coordinates: l,
729
+ imageSize: r,
730
+ visibleArea: s
731
+ }) : e).width) && L(t.height) || (l = function(e, t) {
732
+ return c(N(N(N({}, e), Q({
733
+ width: t.width,
734
+ height: t.height,
735
+ sizeRestrictions: i,
736
+ aspectRatio: o
737
+ })), {
738
+ left: 0,
739
+ top: 0
740
+ }), {
741
+ left: e.left,
742
+ top: e.top
743
+ });
744
+ }(l, N(N({}, l), t))), L(t.left) && L(t.top) || (l = c(l, N(N({}, l), t)));
745
+ })), l;
746
+ }
747
+ function et(e) {
748
+ var t = e.getAreaRestrictions, n = e.boundaries, r = e.coordinates, i = e.visibleArea, a = e.stencilSize, o = e.sizeRestrictions, s = e.positionRestrictions, c, l, u, d = N({}, r), f = N({}, i), p = N({}, a);
749
+ c = q(p), l = q(d), u === void 0 && (u = .001), (c === 0 || l === 0 ? Math.abs(l - c) < u : Math.abs(l / c) < 1 + u && Math.abs(l / c) > 1 - u) || (d = N(N({}, d), Q({
750
+ sizeRestrictions: o,
751
+ width: d.width,
752
+ height: d.height,
753
+ aspectRatio: {
754
+ minimum: q(p),
755
+ maximum: q(p)
756
+ }
757
+ })));
758
+ var m = Ge(f = K(f, d.width * n.width / (f.width * p.width)), t({
759
+ visibleArea: f,
760
+ type: "resize"
761
+ }));
762
+ return m !== 1 && (f = K(f, m), d = K(d, m)), f = Z(f = G(f, H(U(d), U(f))), t({
763
+ visibleArea: f,
764
+ type: "move"
765
+ })), {
766
+ coordinates: d = Z(d, Ye(V(f), s)),
767
+ visibleArea: f
768
+ };
769
+ }
770
+ function tt(e) {
771
+ var t = e.event, n = e.getAreaRestrictions, r = e.boundaries, i = e.coordinates, a = e.visibleArea, o = e.positionRestrictions, s = N({}, i), c = N({}, a);
772
+ if (i && a && t.type !== "manipulateImage") {
773
+ var l = {
774
+ width: 0,
775
+ height: 0
776
+ };
777
+ q(r) > q(s) ? (l.height = .8 * r.height, l.width = l.height * q(s)) : (l.width = .8 * r.width, l.height = l.width * q(s));
778
+ var u = Ge(c = K(c, s.width * r.width / (c.width * l.width)), n({
779
+ visibleArea: c,
780
+ type: "resize"
781
+ }));
782
+ c = K(c, u), u !== 1 && (l.height /= u, l.width /= u), c = Z(c = G(c, H(U(s), U(c))), n({
783
+ visibleArea: c,
784
+ type: "move"
785
+ })), s = Z(s, Ye(V(c), o));
786
+ }
787
+ return {
788
+ coordinates: s,
789
+ visibleArea: c
790
+ };
791
+ }
792
+ function nt(e) {
793
+ var t = e.event, n = e.coordinates, r = e.visibleArea, i = e.getAreaRestrictions, a = N({}, r), o = N({}, n);
794
+ if (t.type === "setCoordinates") {
795
+ var s = Math.max(0, o.width - a.width), c = Math.max(0, o.height - a.height);
796
+ s > c ? a = K(a, Math.min(o.width / a.width, J(a, i({
797
+ visibleArea: a,
798
+ type: "resize"
799
+ })))) : c > s && (a = K(a, Math.min(o.height / a.height, J(a, i({
800
+ visibleArea: a,
801
+ type: "resize"
802
+ }))))), a = Z(a = G(a, Ve(Y(o, V(a)))), i({
803
+ visibleArea: a,
804
+ type: "move"
805
+ }));
806
+ }
807
+ return {
808
+ visibleArea: a,
809
+ coordinates: o
810
+ };
811
+ }
812
+ function rt(e) {
813
+ var t = e.imageSize, n = e.visibleArea, r = e.coordinates, i = n || t;
814
+ return {
815
+ left: (n ? n.left : 0) + i.width / 2 - r.width / 2,
816
+ top: (n ? n.top : 0) + i.height / 2 - r.height / 2
817
+ };
818
+ }
819
+ function it(e) {
820
+ var t = e.imageSize, n = e.visibleArea, r = e.aspectRatio, i = e.sizeRestrictions, a = n || t, o = Math.min(r.maximum || 1 / 0, Math.max(r.minimum || 0, q(a))), s = a.width < a.height ? {
821
+ width: .8 * a.width,
822
+ height: .8 * a.width / o
823
+ } : {
824
+ height: .8 * a.height,
825
+ width: .8 * a.height * o
826
+ };
827
+ return Q(N(N({}, s), {
828
+ aspectRatio: r,
829
+ sizeRestrictions: i
830
+ }));
831
+ }
832
+ function at(e) {
833
+ var t, n, r = e.imageSize, i = e.visibleArea, a = e.boundaries, o = e.aspectRatio, s = e.sizeRestrictions, c = e.stencilSize, l = i || r;
834
+ return q(l) > q(a) ? n = (t = c.height * l.height / a.height) * q(c) : t = (n = c.width * l.width / a.width) / q(c), Q({
835
+ width: n,
836
+ height: t,
837
+ aspectRatio: o,
838
+ sizeRestrictions: s
839
+ });
840
+ }
841
+ function ot(e) {
842
+ var t = e.getAreaRestrictions, n = e.coordinates, r = e.imageSize, i = q(e.boundaries);
843
+ if (n) {
844
+ var a = {
845
+ height: Math.max(n.height, r.height),
846
+ width: Math.max(n.width, r.width)
847
+ }, o = Ue({
848
+ width: q(a) > i ? a.width : a.height * i,
849
+ height: q(a) > i ? a.width / i : a.height
850
+ }, Ke(t())), s = {
851
+ left: n.left + n.width / 2 - o.width / 2,
852
+ top: n.top + n.height / 2 - o.height / 2,
853
+ width: o.width,
854
+ height: o.height
855
+ }, c = Be(n, V(N({
856
+ left: 0,
857
+ top: 0
858
+ }, r))), l = {};
859
+ return !c.left && !c.right && s.width <= r.width && (l.left = 0, l.right = r.width), !c.top && !c.bottom && s.height <= r.height && (l.top = 0, l.bottom = r.height), Z(s, l);
860
+ }
861
+ var u = q(r);
862
+ return o = {
863
+ height: u > i ? r.height : r.width / i,
864
+ width: u > i ? r.height * i : r.width
865
+ }, {
866
+ left: r.width / 2 - o.width / 2,
867
+ top: r.height / 2 - o.height / 2,
868
+ width: o.width,
869
+ height: o.height
870
+ };
871
+ }
872
+ function st(e, t) {
873
+ return Je(e, V(t));
874
+ }
875
+ function ct(e) {
876
+ var t = e.event, n = e.coordinates, r = e.visibleArea, i = e.sizeRestrictions, a = e.getAreaRestrictions, o = e.positionRestrictions, s = e.adjustStencil, c = t.scale, l = t.move, u = N({}, r), d = N({}, n), f = 1, p = 1, m = c.factor && Math.abs(c.factor - 1) > .001;
877
+ u = G(u, {
878
+ left: l.left || 0,
879
+ top: l.top || 0
880
+ });
881
+ var h = {
882
+ stencil: {
883
+ minimum: Math.max(i.minWidth ? i.minWidth / d.width : 0, i.minHeight ? i.minHeight / d.height : 0),
884
+ maximum: Math.min(i.maxWidth ? i.maxWidth / d.width : 1 / 0, i.maxHeight ? i.maxHeight / d.height : 1 / 0, J(d, o))
885
+ },
886
+ area: { maximum: J(u, a({
887
+ visibleArea: u,
888
+ type: "resize"
889
+ })) }
890
+ };
891
+ c.factor && m && (c.factor < 1 ? (p = Math.max(c.factor, h.stencil.minimum)) > 1 && (p = 1) : c.factor > 1 && (p = Math.min(c.factor, Math.min(h.area.maximum, h.stencil.maximum))) < 1 && (p = 1)), p && (u = K(u, p, c.center));
892
+ var g = n.left - r.left, _ = r.width + r.left - (n.width + n.left), v = n.top - r.top, y = r.height + r.top - (n.height + n.top);
893
+ return u = Z(u = G(u, Y(u, {
894
+ left: o.left === void 0 ? void 0 : o.left - g * p,
895
+ top: o.top === void 0 ? void 0 : o.top - v * p,
896
+ bottom: o.bottom === void 0 ? void 0 : o.bottom + y * p,
897
+ right: o.right === void 0 ? void 0 : o.right + _ * p
898
+ })), a({
899
+ visibleArea: u,
900
+ type: "move"
901
+ })), d.width *= p, d.height *= p, d.left = u.left + g * p, d.top = u.top + v * p, d = Z(d, Ye(V(u), o)), c.factor && m && s && (c.factor > 1 ? f = Math.min(h.area.maximum, c.factor) / p : c.factor < 1 && (f = Math.max(d.height / u.height, d.width / u.width, c.factor / p)), f !== 1 && (u = G(u = Z(u = K(u, f, c.factor > 1 ? c.center : U(d)), a({
902
+ visibleArea: u,
903
+ type: "move"
904
+ })), Ve(Y(d, V(u)))))), {
905
+ coordinates: d,
906
+ visibleArea: u
907
+ };
908
+ }
909
+ function lt(e) {
910
+ var t = e.aspectRatio, n = e.getAreaRestrictions, r = e.coordinates, i = e.visibleArea, a = e.sizeRestrictions, o = e.positionRestrictions, s = e.imageSize, c = e.previousImageSize, l = e.angle, u = N({}, r), d = N({}, i), f = X(U(N({
911
+ left: 0,
912
+ top: 0
913
+ }, c)), l);
914
+ return (u = N(N({}, Q({
915
+ sizeRestrictions: a,
916
+ aspectRatio: t,
917
+ width: u.width,
918
+ height: u.height
919
+ })), X(U(u), l))).left -= f.left - s.width / 2 + u.width / 2, u.top -= f.top - s.height / 2 + u.height / 2, d = K(d, Ge(d, n({
920
+ visibleArea: d,
921
+ type: "resize"
922
+ }))), {
923
+ coordinates: u = Z(u, o),
924
+ visibleArea: d = Z(d = G(d, H(U(u), U(r))), n({
925
+ visibleArea: d,
926
+ type: "move"
927
+ }))
928
+ };
929
+ }
930
+ function ut(e) {
931
+ var t = e.flip, n = e.previousFlip, r = e.rotate, i = e.getAreaRestrictions, a = e.coordinates, o = e.visibleArea, s = e.imageSize, c = N({}, a), l = N({}, o), u = n.horizontal !== t.horizontal, d = n.vertical !== t.vertical;
932
+ if (u || d) {
933
+ var f = X({
934
+ left: s.width / 2,
935
+ top: s.height / 2
936
+ }, -r), p = X(U(c), -r), m = X({
937
+ left: u ? f.left - (p.left - f.left) : p.left,
938
+ top: d ? f.top - (p.top - f.top) : p.top
939
+ }, r);
940
+ c = G(c, H(m, U(c))), p = X(U(l), -r), l = Z(l = G(l, H(m = X({
941
+ left: u ? f.left - (p.left - f.left) : p.left,
942
+ top: d ? f.top - (p.top - f.top) : p.top
943
+ }, r), U(l))), i({
944
+ visibleArea: l,
945
+ type: "move"
946
+ }));
947
+ }
948
+ return {
949
+ coordinates: c,
950
+ visibleArea: l
951
+ };
952
+ }
953
+ function dt(e) {
954
+ var t = e.directions, n = e.coordinates, r = e.positionRestrictions, i = r === void 0 ? {} : r, a = e.sizeRestrictions, o = e.preserveRatio, s = e.compensate, c = N({}, t), l = W(n, c).width, u = W(n, c).height;
955
+ l < 0 && (c.left < 0 && c.right < 0 ? (c.left = -(n.width - a.minWidth) / (c.left / c.right), c.right = -(n.width - a.minWidth) / (c.right / c.left)) : c.left < 0 ? c.left = -(n.width - a.minWidth) : c.right < 0 && (c.right = -(n.width - a.minWidth))), u < 0 && (c.top < 0 && c.bottom < 0 ? (c.top = -(n.height - a.minHeight) / (c.top / c.bottom), c.bottom = -(n.height - a.minHeight) / (c.bottom / c.top)) : c.top < 0 ? c.top = -(n.height - a.minHeight) : c.bottom < 0 && (c.bottom = -(n.height - a.minHeight)));
956
+ var d = Be(W(n, c), i);
957
+ s && (d.left && d.left > 0 && d.right === 0 ? (c.right += d.left, c.left -= d.left) : d.right && d.right > 0 && d.left === 0 && (c.left += d.right, c.right -= d.right), d.top && d.top > 0 && d.bottom === 0 ? (c.bottom += d.top, c.top -= d.top) : d.bottom && d.bottom > 0 && d.top === 0 && (c.top += d.bottom, c.bottom -= d.bottom), d = Be(W(n, c), i));
958
+ var f = {
959
+ width: 1 / 0,
960
+ height: 1 / 0,
961
+ left: 1 / 0,
962
+ right: 1 / 0,
963
+ top: 1 / 0,
964
+ bottom: 1 / 0
965
+ };
966
+ if (B.forEach((function(e) {
967
+ var t = d[e];
968
+ t && c[e] && (f[e] = Math.max(0, 1 - t / c[e]));
969
+ })), o) {
970
+ var p = Math.min.apply(null, B.map((function(e) {
971
+ return f[e];
972
+ })));
973
+ p !== 1 / 0 && B.forEach((function(e) {
974
+ c[e] *= p;
975
+ }));
976
+ } else B.forEach((function(e) {
977
+ f[e] !== 1 / 0 && (c[e] *= f[e]);
978
+ }));
979
+ if (l = W(n, c).width, u = W(n, c).height, c.right + c.left && (l > a.maxWidth ? f.width = (a.maxWidth - n.width) / (c.right + c.left) : l < a.minWidth && (f.width = (a.minWidth - n.width) / (c.right + c.left))), c.bottom + c.top && (u > a.maxHeight ? f.height = (a.maxHeight - n.height) / (c.bottom + c.top) : u < a.minHeight && (f.height = (a.minHeight - n.height) / (c.bottom + c.top))), o) {
980
+ var m = Math.min(f.width, f.height);
981
+ m !== 1 / 0 && B.forEach((function(e) {
982
+ c[e] *= m;
983
+ }));
984
+ } else f.width !== 1 / 0 && Pe.forEach((function(e) {
985
+ c[e] *= f.width;
986
+ })), f.height !== 1 / 0 && Fe.forEach((function(e) {
987
+ c[e] *= f.height;
988
+ }));
989
+ return c;
990
+ }
991
+ function ft(e, t, n) {
992
+ return t == 0 && n == 0 ? e / 2 : t == 0 ? 0 : n == 0 ? e : e * Math.abs(t / (t + n));
993
+ }
994
+ var pt = A("vue-simple-handler"), mt = A("vue-simple-handler-wrapper"), ht = {
995
+ name: "SimpleHandler",
996
+ components: { HandlerWrapper: je },
997
+ props: {
998
+ defaultClass: { type: String },
999
+ hoverClass: { type: String },
1000
+ wrapperClass: { type: String },
1001
+ horizontalPosition: { type: String },
1002
+ verticalPosition: { type: String },
1003
+ disabled: {
1004
+ type: Boolean,
1005
+ default: !1
1006
+ }
1007
+ },
1008
+ data: function() {
1009
+ return { hover: !1 };
1010
+ },
1011
+ computed: { classes: function() {
1012
+ var e, t = (w(e = {}, this.horizontalPosition, !!this.horizontalPosition), w(e, this.verticalPosition, !!this.verticalPosition), w(e, `${this.horizontalPosition}-${this.verticalPosition}`, !!(this.verticalPosition && this.horizontalPosition)), w(e, "hover", this.hover), e);
1013
+ return {
1014
+ default: k(pt(t), this.defaultClass, this.hover && this.hoverClass),
1015
+ wrapper: k(mt(t), this.wrapperClass)
1016
+ };
1017
+ } },
1018
+ methods: {
1019
+ onDrag: function(e) {
1020
+ this.$emit("drag", e);
1021
+ },
1022
+ onEnter: function() {
1023
+ this.hover = !0;
1024
+ },
1025
+ onLeave: function() {
1026
+ this.hover = !1;
1027
+ },
1028
+ onDragEnd: function() {
1029
+ this.$emit("drag-end");
1030
+ }
1031
+ },
1032
+ emits: ["drag", "drag-end"]
1033
+ };
1034
+ ht.render = function(e, t, n, r, i, o) {
1035
+ var c = s("HandlerWrapper");
1036
+ return a(), b(c, {
1037
+ class: o.classes.wrapper,
1038
+ "vertical-position": n.verticalPosition,
1039
+ "horizontal-position": n.horizontalPosition,
1040
+ disabled: n.disabled,
1041
+ onDrag: o.onDrag,
1042
+ onDragEnd: o.onDragEnd,
1043
+ onEnter: o.onEnter,
1044
+ onLeave: o.onLeave
1045
+ }, {
1046
+ default: h((function() {
1047
+ return [l("div", { class: o.classes.default }, null, 2)];
1048
+ })),
1049
+ _: 1
1050
+ }, 8, [
1051
+ "class",
1052
+ "vertical-position",
1053
+ "horizontal-position",
1054
+ "disabled",
1055
+ "onDrag",
1056
+ "onDragEnd",
1057
+ "onEnter",
1058
+ "onLeave"
1059
+ ]);
1060
+ };
1061
+ var gt = A("vue-simple-line"), _t = A("vue-simple-line-wrapper"), vt = {
1062
+ name: "SimpleLine",
1063
+ components: { LineWrapper: Ne },
1064
+ props: {
1065
+ defaultClass: { type: String },
1066
+ hoverClass: { type: String },
1067
+ wrapperClass: { type: String },
1068
+ position: { type: String },
1069
+ disabled: {
1070
+ type: Boolean,
1071
+ default: !1
1072
+ }
1073
+ },
1074
+ data: function() {
1075
+ return { hover: !1 };
1076
+ },
1077
+ computed: { classes: function() {
1078
+ return {
1079
+ root: k(gt(w({}, this.position, !0)), this.defaultClass, this.hover && this.hoverClass),
1080
+ wrapper: k(_t(w({}, this.position, !0)), this.wrapperClass)
1081
+ };
1082
+ } },
1083
+ methods: {
1084
+ onDrag: function(e) {
1085
+ this.$emit("drag", e);
1086
+ },
1087
+ onEnter: function() {
1088
+ this.hover = !0;
1089
+ },
1090
+ onLeave: function() {
1091
+ this.hover = !1;
1092
+ },
1093
+ onDragEnd: function() {
1094
+ this.$emit("drag-end");
1095
+ }
1096
+ },
1097
+ emits: ["drag", "drag-end"]
1098
+ };
1099
+ vt.render = function(e, t, n, r, i, o) {
1100
+ var c = s("LineWrapper");
1101
+ return a(), b(c, {
1102
+ class: o.classes.wrapper,
1103
+ position: n.position,
1104
+ disabled: n.disabled,
1105
+ onDrag: o.onDrag,
1106
+ onDragEnd: o.onDragEnd,
1107
+ onEnter: o.onEnter,
1108
+ onLeave: o.onLeave
1109
+ }, {
1110
+ default: h((function() {
1111
+ return [l("div", { class: o.classes.root }, null, 2)];
1112
+ })),
1113
+ _: 1
1114
+ }, 8, [
1115
+ "class",
1116
+ "position",
1117
+ "disabled",
1118
+ "onDrag",
1119
+ "onDragEnd",
1120
+ "onEnter",
1121
+ "onLeave"
1122
+ ]);
1123
+ };
1124
+ var yt = A("vue-bounding-box"), bt = [
1125
+ "east",
1126
+ "west",
1127
+ null
1128
+ ], xt = [
1129
+ "south",
1130
+ "north",
1131
+ null
1132
+ ], St = {
1133
+ name: "BoundingBox",
1134
+ props: {
1135
+ width: { type: Number },
1136
+ height: { type: Number },
1137
+ transitions: { type: Object },
1138
+ handlers: {
1139
+ type: Object,
1140
+ default: function() {
1141
+ return {
1142
+ eastNorth: !0,
1143
+ north: !0,
1144
+ westNorth: !0,
1145
+ west: !0,
1146
+ westSouth: !0,
1147
+ south: !0,
1148
+ eastSouth: !0,
1149
+ east: !0
1150
+ };
1151
+ }
1152
+ },
1153
+ handlersComponent: {
1154
+ type: [Object, String],
1155
+ default: function() {
1156
+ return ht;
1157
+ }
1158
+ },
1159
+ handlersClasses: {
1160
+ type: Object,
1161
+ default: function() {
1162
+ return {};
1163
+ }
1164
+ },
1165
+ handlersWrappersClasses: {
1166
+ type: Object,
1167
+ default: function() {
1168
+ return {};
1169
+ }
1170
+ },
1171
+ lines: {
1172
+ type: Object,
1173
+ default: function() {
1174
+ return {
1175
+ west: !0,
1176
+ north: !0,
1177
+ east: !0,
1178
+ south: !0
1179
+ };
1180
+ }
1181
+ },
1182
+ linesComponent: {
1183
+ type: [Object, String],
1184
+ default: function() {
1185
+ return vt;
1186
+ }
1187
+ },
1188
+ linesClasses: {
1189
+ type: Object,
1190
+ default: function() {
1191
+ return {};
1192
+ }
1193
+ },
1194
+ linesWrappersClasses: {
1195
+ type: Object,
1196
+ default: function() {
1197
+ return {};
1198
+ }
1199
+ },
1200
+ resizable: {
1201
+ type: Boolean,
1202
+ default: !0
1203
+ }
1204
+ },
1205
+ data: function() {
1206
+ var e = [];
1207
+ return bt.forEach((function(t) {
1208
+ xt.forEach((function(n) {
1209
+ if (t !== n) {
1210
+ var r = P(t, n);
1211
+ e.push({
1212
+ name: r.name,
1213
+ classname: r.classname,
1214
+ verticalDirection: n,
1215
+ horizontalDirection: t
1216
+ });
1217
+ }
1218
+ }));
1219
+ })), { points: e };
1220
+ },
1221
+ computed: {
1222
+ style: function() {
1223
+ var e = {};
1224
+ return this.width && this.height && (e.width = `${this.width}px`, e.height = `${this.height}px`, this.transitions && this.transitions.enabled && (e.transition = `${this.transitions.time}ms ${this.transitions.timingFunction}`)), e;
1225
+ },
1226
+ classes: function() {
1227
+ var e = this.handlersClasses, t = this.handlersWrappersClasses, n = this.linesClasses, r = this.linesWrappersClasses;
1228
+ return {
1229
+ root: yt(),
1230
+ handlers: e,
1231
+ handlersWrappers: t,
1232
+ lines: n,
1233
+ linesWrappers: r
1234
+ };
1235
+ },
1236
+ lineNodes: function() {
1237
+ var e = this, t = [];
1238
+ return this.points.forEach((function(n) {
1239
+ n.horizontalDirection && n.verticalDirection || !e.lines[n.name] || t.push({
1240
+ name: n.name,
1241
+ component: e.linesComponent,
1242
+ class: k(e.classes.lines.default, e.classes.lines[n.name], !e.resizable && e.classes.lines.disabled),
1243
+ wrapperClass: k(e.classes.linesWrappers.default, e.classes.linesWrappers[n.name], !e.resizable && e.classes.linesWrappers.disabled),
1244
+ hoverClass: e.classes.lines.hover,
1245
+ verticalDirection: n.verticalDirection,
1246
+ horizontalDirection: n.horizontalDirection,
1247
+ disabled: !e.resizable
1248
+ });
1249
+ })), t;
1250
+ },
1251
+ handlerNodes: function() {
1252
+ var e = this, t = [], n = this.width, r = this.height;
1253
+ return this.points.forEach((function(i) {
1254
+ if (e.handlers[i.name]) {
1255
+ var a = {
1256
+ name: i.name,
1257
+ component: e.handlersComponent,
1258
+ class: k(e.classes.handlers.default, e.classes.handlers[i.name]),
1259
+ wrapperClass: k(e.classes.handlersWrappers.default, e.classes.handlersWrappers[i.name]),
1260
+ hoverClass: e.classes.handlers.hover,
1261
+ verticalDirection: i.verticalDirection,
1262
+ horizontalDirection: i.horizontalDirection,
1263
+ disabled: !e.resizable
1264
+ };
1265
+ if (n && r) {
1266
+ var o = i.horizontalDirection, s = i.verticalDirection, c = o === "east" ? n : o === "west" ? 0 : n / 2, l = s === "south" ? r : s === "north" ? 0 : r / 2;
1267
+ a.wrapperClass = yt("handler"), a.wrapperStyle = { transform: `translate(${c}px, ${l}px)` }, e.transitions && e.transitions.enabled && (a.wrapperStyle.transition = `${e.transitions.time}ms ${e.transitions.timingFunction}`);
1268
+ } else a.wrapperClass = yt("handler", w({}, i.classname, !0));
1269
+ t.push(a);
1270
+ }
1271
+ })), t;
1272
+ }
1273
+ },
1274
+ beforeMount: function() {
1275
+ 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 });
1276
+ },
1277
+ beforeUnmount: function() {
1278
+ window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
1279
+ },
1280
+ mounted: function() {
1281
+ this.touches = [];
1282
+ },
1283
+ methods: {
1284
+ onEnd: function() {
1285
+ this.$emit("resize-end");
1286
+ },
1287
+ onHandlerDrag: function(e, t, n) {
1288
+ var r, i = e.shift(), a = i.left, o = i.top, s = {
1289
+ left: 0,
1290
+ right: 0,
1291
+ top: 0,
1292
+ bottom: 0
1293
+ };
1294
+ t === "west" ? s.left -= a : t === "east" && (s.right += a), n === "north" ? s.top -= o : n === "south" && (s.bottom += o), !n && t ? r = "width" : n && !t && (r = "height"), this.resizable && this.$emit("resize", new Ee(s, {
1295
+ allowedDirections: {
1296
+ left: t === "west" || !t,
1297
+ right: t === "east" || !t,
1298
+ bottom: n === "south" || !n,
1299
+ top: n === "north" || !n
1300
+ },
1301
+ preserveAspectRatio: e.nativeEvent && e.nativeEvent.shiftKey,
1302
+ respectDirection: r
1303
+ }));
1304
+ }
1305
+ },
1306
+ emits: ["resize", "resize-end"]
1307
+ };
1308
+ St.render = function(e, t, n, r, o, s) {
1309
+ return a(), b("div", {
1310
+ ref: "box",
1311
+ class: s.classes.root,
1312
+ style: s.style
1313
+ }, [
1314
+ i(e.$slots, "default"),
1315
+ l("div", null, [(a(!0), b(p, null, m(s.lineNodes, (function(e) {
1316
+ return a(), b(S(e.component), {
1317
+ key: e.name,
1318
+ "default-class": e.class,
1319
+ "hover-class": e.hoverClass,
1320
+ "wrapper-class": e.wrapperClass,
1321
+ position: e.name,
1322
+ disabled: e.disabled,
1323
+ onDrag: function(t) {
1324
+ return s.onHandlerDrag(t, e.horizontalDirection, e.verticalDirection);
1325
+ },
1326
+ onDragEnd: t[1] ||= function(e) {
1327
+ return s.onEnd();
1328
+ }
1329
+ }, null, 8, [
1330
+ "default-class",
1331
+ "hover-class",
1332
+ "wrapper-class",
1333
+ "position",
1334
+ "disabled",
1335
+ "onDrag"
1336
+ ]);
1337
+ })), 128))]),
1338
+ (a(!0), b(p, null, m(s.handlerNodes, (function(e) {
1339
+ return a(), b("div", {
1340
+ key: e.name,
1341
+ style: e.wrapperStyle,
1342
+ class: e.wrapperClass
1343
+ }, [(a(), b(S(e.component), {
1344
+ "default-class": e.class,
1345
+ "hover-class": e.hoverClass,
1346
+ "wrapper-class": e.wrapperClass,
1347
+ "horizontal-position": e.horizontalDirection,
1348
+ "vertical-position": e.verticalDirection,
1349
+ disabled: e.disabled,
1350
+ onDrag: function(t) {
1351
+ return s.onHandlerDrag(t, e.horizontalDirection, e.verticalDirection);
1352
+ },
1353
+ onDragEnd: t[2] ||= function(e) {
1354
+ return s.onEnd();
1355
+ }
1356
+ }, null, 8, [
1357
+ "default-class",
1358
+ "hover-class",
1359
+ "wrapper-class",
1360
+ "horizontal-position",
1361
+ "vertical-position",
1362
+ "disabled",
1363
+ "onDrag"
1364
+ ]))], 6);
1365
+ })), 128))
1366
+ ], 6);
1367
+ };
1368
+ var Ct = A("vue-draggable-area"), wt = {
1369
+ name: "DraggableArea",
1370
+ props: {
1371
+ movable: {
1372
+ type: Boolean,
1373
+ default: !0
1374
+ },
1375
+ activationDistance: {
1376
+ type: Number,
1377
+ default: 20
1378
+ }
1379
+ },
1380
+ computed: { classnames: function() {
1381
+ return { default: Ct() };
1382
+ } },
1383
+ beforeMount: function() {
1384
+ 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 });
1385
+ },
1386
+ beforeUnmount: function() {
1387
+ window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
1388
+ },
1389
+ mounted: function() {
1390
+ this.touches = [], this.touchStarted = !1;
1391
+ },
1392
+ methods: {
1393
+ onTouchStart: function(e) {
1394
+ if (e.cancelable) {
1395
+ var t = this.movable && e.touches.length === 1;
1396
+ t && (this.touches = E(e.touches)), (this.touchStarted || t) && (e.preventDefault(), e.stopPropagation());
1397
+ }
1398
+ },
1399
+ onTouchEnd: function() {
1400
+ this.touchStarted = !1, this.processEnd();
1401
+ },
1402
+ onTouchMove: function(e) {
1403
+ this.touches.length >= 1 && (this.touchStarted ? (this.processMove(e, e.touches), e.preventDefault(), e.stopPropagation()) : Te({
1404
+ x: this.touches[0].clientX,
1405
+ y: this.touches[0].clientY
1406
+ }, {
1407
+ x: e.touches[0].clientX,
1408
+ y: e.touches[0].clientY
1409
+ }) > this.activationDistance && (this.initAnchor({
1410
+ clientX: e.touches[0].clientX,
1411
+ clientY: e.touches[0].clientY
1412
+ }), this.touchStarted = !0));
1413
+ },
1414
+ onMouseDown: function(e) {
1415
+ if (this.movable && e.button === 0) {
1416
+ var t = {
1417
+ fake: !0,
1418
+ clientX: e.clientX,
1419
+ clientY: e.clientY
1420
+ };
1421
+ this.touches = [t], this.initAnchor(t), e.stopPropagation();
1422
+ }
1423
+ },
1424
+ onMouseMove: function(e) {
1425
+ this.touches.length && (this.processMove(e, [{
1426
+ fake: !0,
1427
+ clientX: e.clientX,
1428
+ clientY: e.clientY
1429
+ }]), e.preventDefault && e.cancelable && e.preventDefault(), e.stopPropagation());
1430
+ },
1431
+ onMouseUp: function() {
1432
+ this.processEnd();
1433
+ },
1434
+ initAnchor: function(e) {
1435
+ var t = this.$refs.container.getBoundingClientRect(), n = t.left, r = t.top;
1436
+ this.anchor = {
1437
+ x: e.clientX - n,
1438
+ y: e.clientY - r
1439
+ };
1440
+ },
1441
+ processMove: function(e, t) {
1442
+ var n = E(t);
1443
+ if (this.touches.length) {
1444
+ var r = this.$refs.container.getBoundingClientRect(), i = r.left, a = r.top;
1445
+ this.touches.length === 1 && n.length === 1 && this.$emit("move", new De({
1446
+ left: n[0].clientX - (i + this.anchor.x),
1447
+ top: n[0].clientY - (a + this.anchor.y)
1448
+ }));
1449
+ }
1450
+ },
1451
+ processEnd: function() {
1452
+ this.touches.length && this.$emit("move-end"), this.touches = [];
1453
+ }
1454
+ },
1455
+ emits: ["move", "move-end"]
1456
+ };
1457
+ wt.render = function(e, t, n, r, o, s) {
1458
+ return a(), b("div", {
1459
+ ref: "container",
1460
+ onTouchstart: t[1] ||= function() {
1461
+ return s.onTouchStart && s.onTouchStart.apply(s, arguments);
1462
+ },
1463
+ onMousedown: t[2] ||= function() {
1464
+ return s.onMouseDown && s.onMouseDown.apply(s, arguments);
1465
+ }
1466
+ }, [i(e.$slots, "default")], 544);
1467
+ };
1468
+ function Tt(e) {
1469
+ return {
1470
+ rotate: e.rotate || 0,
1471
+ flip: {
1472
+ horizontal: e?.flip?.horizontal || !1,
1473
+ vertical: e?.flip?.vertical || !1
1474
+ }
1475
+ };
1476
+ }
1477
+ function Et(e) {
1478
+ return new Promise((function(t, n) {
1479
+ try {
1480
+ if (e) {
1481
+ if (/^data:/i.test(e)) t(function(e) {
1482
+ e = e.replace(/^data:([^;]+);base64,/gim, "");
1483
+ for (var t = atob(e), n = t.length, r = new ArrayBuffer(n), i = new Uint8Array(r), a = 0; a < n; a++) i[a] = t.charCodeAt(a);
1484
+ return r;
1485
+ }(e));
1486
+ else if (/^blob:/i.test(e)) {
1487
+ var r = new FileReader();
1488
+ r.onload = function(e) {
1489
+ t(e.target.result);
1490
+ }, a = e, o = function(e) {
1491
+ r.readAsArrayBuffer(e);
1492
+ }, (s = new XMLHttpRequest()).open("GET", a, !0), s.responseType = "blob", s.onload = function() {
1493
+ this.status != 200 && this.status !== 0 || o(this.response);
1494
+ }, s.send();
1495
+ } else {
1496
+ var i = new XMLHttpRequest();
1497
+ i.onreadystatechange = function() {
1498
+ i.readyState === 4 && (i.status === 200 || i.status === 0 ? t(i.response) : n("Warning: could not load an image to parse its orientation"), i = null);
1499
+ }, i.onprogress = function() {
1500
+ i.getResponseHeader("content-type") !== "image/jpeg" && i.abort();
1501
+ }, i.withCredentials = !1, i.open("GET", e, !0), i.responseType = "arraybuffer", i.send(null);
1502
+ }
1503
+ } else n("Error: the image is empty");
1504
+ } catch (e) {
1505
+ n(e);
1506
+ }
1507
+ var a, o, s;
1508
+ }));
1509
+ }
1510
+ function Dt(e) {
1511
+ var t = e.rotate, n = e.flip, r = e.scaleX, i = e.scaleY, a = "";
1512
+ return a += " rotate(" + t + "deg) ", a += " scaleX(" + r * (n.horizontal ? -1 : 1) + ") ", a += " scaleY(" + i * (n.vertical ? -1 : 1) + ") ";
1513
+ }
1514
+ function Ot(e) {
1515
+ try {
1516
+ var t, n = new DataView(e), r = void 0, i = void 0, a = void 0, o = void 0;
1517
+ if (n.getUint8(0) === 255 && n.getUint8(1) === 216) for (var s = n.byteLength, c = 2; c + 1 < s;) {
1518
+ if (n.getUint8(c) === 255 && n.getUint8(c + 1) === 225) {
1519
+ a = c;
1520
+ break;
1521
+ }
1522
+ c++;
1523
+ }
1524
+ if (a && (r = a + 10, function(e, t, n) {
1525
+ var r, i = "";
1526
+ for (r = t, n += t; r < n; r++) i += String.fromCharCode(e.getUint8(r));
1527
+ return i;
1528
+ }(n, a + 4, 4) === "Exif")) {
1529
+ var l = n.getUint16(r);
1530
+ if (((i = l === 18761) || l === 19789) && n.getUint16(r + 2, i) === 42) {
1531
+ var u = n.getUint32(r + 4, i);
1532
+ u >= 8 && (o = r + u);
1533
+ }
1534
+ }
1535
+ if (o) {
1536
+ for (var d = n.getUint16(o, i), f = 0; f < d; f++) if (c = o + 12 * f + 2, n.getUint16(c, i) === 274) {
1537
+ c += 8, t = n.getUint16(c, i), n.setUint16(c, 1, i);
1538
+ break;
1539
+ }
1540
+ }
1541
+ return t;
1542
+ } catch {
1543
+ return null;
1544
+ }
1545
+ }
1546
+ function kt(e, t) {
1547
+ var n = t.getBoundingClientRect(), r = n.left, i = n.top, a = {
1548
+ left: 0,
1549
+ top: 0
1550
+ }, o = 0;
1551
+ return e.forEach((function(t) {
1552
+ a.left += (t.clientX - r) / e.length, a.top += (t.clientY - i) / e.length;
1553
+ })), e.forEach((function(e) {
1554
+ o += Te({
1555
+ x: a.left,
1556
+ y: a.top
1557
+ }, {
1558
+ x: e.clientX - r,
1559
+ y: e.clientY - i
1560
+ });
1561
+ })), {
1562
+ centerMass: a,
1563
+ spread: o,
1564
+ count: e.length
1565
+ };
1566
+ }
1567
+ var At = {
1568
+ props: {
1569
+ touchMove: {
1570
+ type: Boolean,
1571
+ required: !0
1572
+ },
1573
+ mouseMove: {
1574
+ type: Boolean,
1575
+ required: !0
1576
+ },
1577
+ touchResize: {
1578
+ type: Boolean,
1579
+ required: !0
1580
+ },
1581
+ wheelResize: {
1582
+ type: [Boolean, Object],
1583
+ required: !0
1584
+ },
1585
+ eventsFilter: {
1586
+ type: Function,
1587
+ required: !1
1588
+ }
1589
+ },
1590
+ beforeMount: function() {
1591
+ 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 });
1592
+ },
1593
+ beforeUnmount: function() {
1594
+ window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
1595
+ },
1596
+ created: function() {
1597
+ this.transforming = !1, this.debouncedProcessEnd = M(this.processEnd), this.touches = [];
1598
+ },
1599
+ methods: {
1600
+ processMove: function(e, t) {
1601
+ if (this.touches.length) {
1602
+ if (this.touches.length === 1 && t.length === 1) this.$emit("move", new z({
1603
+ left: this.touches[0].clientX - t[0].clientX,
1604
+ top: this.touches[0].clientY - t[0].clientY
1605
+ }));
1606
+ else if (this.touches.length > 1 && this.touchResize) {
1607
+ var n = kt(t, this.$refs.container), r = this.oldGeometricProperties;
1608
+ r.count === n.count && r.count > 1 && this.$emit("resize", new z({
1609
+ left: r.centerMass.left - n.centerMass.left,
1610
+ top: r.centerMass.top - n.centerMass.top
1611
+ }, {
1612
+ factor: r.spread / n.spread,
1613
+ center: n.centerMass
1614
+ })), this.oldGeometricProperties = n;
1615
+ }
1616
+ this.touches = t;
1617
+ }
1618
+ },
1619
+ processEnd: function() {
1620
+ this.transforming && (this.transforming = !1, this.$emit("transform-end"));
1621
+ },
1622
+ processStart: function() {
1623
+ this.transforming = !0, this.debouncedProcessEnd.clear();
1624
+ },
1625
+ processEvent: function(e) {
1626
+ return this.eventsFilter ? !1 !== this.eventsFilter(e, this.transforming) : (e.preventDefault(), e.stopPropagation(), !0);
1627
+ },
1628
+ onTouchStart: function(e) {
1629
+ if (e.cancelable && (this.touchMove || this.touchResize && e.touches.length > 1) && this.processEvent(e)) {
1630
+ var t = this.$refs.container, n = t.getBoundingClientRect(), r = n.left, i = n.top, a = n.bottom, o = n.right;
1631
+ this.touches = E(e.touches).filter((function(e) {
1632
+ return e.clientX > r && e.clientX < o && e.clientY > i && e.clientY < a;
1633
+ })), this.oldGeometricProperties = kt(this.touches, t);
1634
+ }
1635
+ },
1636
+ onTouchEnd: function(e) {
1637
+ e.touches.length === 0 && (this.touches = [], this.processEnd());
1638
+ },
1639
+ onTouchMove: function(e) {
1640
+ var t = this;
1641
+ if (this.touches.length) {
1642
+ var n = E(e.touches).filter((function(e) {
1643
+ return !e.identifier || t.touches.find((function(t) {
1644
+ return t.identifier === e.identifier;
1645
+ }));
1646
+ }));
1647
+ this.processEvent(e) && (this.processMove(e, n), this.processStart());
1648
+ }
1649
+ },
1650
+ onMouseDown: function(e) {
1651
+ if (this.mouseMove && "buttons" in e && e.buttons === 1 && this.processEvent(e)) {
1652
+ var t = {
1653
+ fake: !0,
1654
+ clientX: e.clientX,
1655
+ clientY: e.clientY
1656
+ };
1657
+ this.touches = [t], this.processStart();
1658
+ }
1659
+ },
1660
+ onMouseMove: function(e) {
1661
+ this.touches.length && this.processEvent(e) && this.processMove(e, [{
1662
+ clientX: e.clientX,
1663
+ clientY: e.clientY
1664
+ }]);
1665
+ },
1666
+ onMouseUp: function() {
1667
+ this.touches = [], this.processEnd();
1668
+ },
1669
+ onWheel: function(e) {
1670
+ if (this.wheelResize && this.processEvent(e)) {
1671
+ var t = this.$refs.container.getBoundingClientRect(), n = t.left, r = t.top, i = 1 + this.wheelResize.ratio * (o = e.deltaY || e.detail || e.wheelDelta, (s = +o) == 0 || we(s) ? s : s > 0 ? 1 : -1), a = {
1672
+ left: e.clientX - n,
1673
+ top: e.clientY - r
1674
+ };
1675
+ this.$emit("resize", new z({}, {
1676
+ factor: i,
1677
+ center: a
1678
+ })), this.touches.length || this.debouncedProcessEnd();
1679
+ }
1680
+ var o, s;
1681
+ }
1682
+ },
1683
+ emits: [
1684
+ "resize",
1685
+ "move",
1686
+ "transform-end"
1687
+ ]
1688
+ };
1689
+ At.render = function(e, t, n, r, o, s) {
1690
+ return a(), b("div", {
1691
+ ref: "container",
1692
+ onTouchstart: t[1] ||= function() {
1693
+ return s.onTouchStart && s.onTouchStart.apply(s, arguments);
1694
+ },
1695
+ onMousedown: t[2] ||= function() {
1696
+ return s.onMouseDown && s.onMouseDown.apply(s, arguments);
1697
+ },
1698
+ onWheel: t[3] ||= function() {
1699
+ return s.onWheel && s.onWheel.apply(s, arguments);
1700
+ }
1701
+ }, [i(e.$slots, "default")], 544);
1702
+ };
1703
+ var jt = {
1704
+ components: { TransformableImage: At },
1705
+ props: {
1706
+ touchMove: {
1707
+ type: Boolean,
1708
+ required: !0
1709
+ },
1710
+ mouseMove: {
1711
+ type: Boolean,
1712
+ required: !0
1713
+ },
1714
+ touchResize: {
1715
+ type: Boolean,
1716
+ required: !0
1717
+ },
1718
+ wheelResize: {
1719
+ type: [Boolean, Object],
1720
+ required: !0
1721
+ }
1722
+ },
1723
+ emits: ["resize", "move"]
1724
+ };
1725
+ jt.render = function(e, t, n, r, o, c) {
1726
+ var l = s("transformable-image");
1727
+ return a(), b(l, {
1728
+ "touch-move": n.touchMove,
1729
+ "touch-resize": n.touchResize,
1730
+ "mouse-move": n.mouseMove,
1731
+ "wheel-resize": n.wheelResize,
1732
+ onMove: t[1] ||= function(t) {
1733
+ return e.$emit("move", t);
1734
+ },
1735
+ onResize: t[2] ||= function(t) {
1736
+ return e.$emit("resize", t);
1737
+ }
1738
+ }, {
1739
+ default: h((function() {
1740
+ return [i(e.$slots, "default")];
1741
+ })),
1742
+ _: 3
1743
+ }, 8, [
1744
+ "touch-move",
1745
+ "touch-resize",
1746
+ "mouse-move",
1747
+ "wheel-resize"
1748
+ ]);
1749
+ };
1750
+ var Mt = A("vue-preview"), Nt = {
1751
+ props: {
1752
+ coordinates: { type: Object },
1753
+ transitions: { type: Object },
1754
+ image: {
1755
+ type: Object,
1756
+ default: function() {
1757
+ return {};
1758
+ }
1759
+ },
1760
+ imageClass: { type: String },
1761
+ width: { type: Number },
1762
+ height: { type: Number },
1763
+ fill: { type: Boolean }
1764
+ },
1765
+ data: function() {
1766
+ return {
1767
+ calculatedImageSize: {
1768
+ width: 0,
1769
+ height: 0
1770
+ },
1771
+ calculatedSize: {
1772
+ width: 0,
1773
+ height: 0
1774
+ }
1775
+ };
1776
+ },
1777
+ computed: {
1778
+ classes: function() {
1779
+ return {
1780
+ root: Mt({ fill: this.fill }),
1781
+ wrapper: Mt("wrapper"),
1782
+ imageWrapper: Mt("image-wrapper"),
1783
+ image: k(Mt("image"), this.imageClass)
1784
+ };
1785
+ },
1786
+ style: function() {
1787
+ if (this.fill) return {};
1788
+ var e = {};
1789
+ return this.width && (e.width = `${this.size.width}px`), this.height && (e.height = `${this.size.height}px`), this.transitions && this.transitions.enabled && (e.transition = `${this.transitions.time}ms ${this.transitions.timingFunction}`), e;
1790
+ },
1791
+ wrapperStyle: function() {
1792
+ var e = {
1793
+ width: `${this.size.width}px`,
1794
+ height: `${this.size.height}px`,
1795
+ left: `calc(50% - ${this.size.width / 2}px)`,
1796
+ top: `calc(50% - ${this.size.height / 2}px)`
1797
+ };
1798
+ return this.transitions && this.transitions.enabled && (e.transition = `${this.transitions.time}ms ${this.transitions.timingFunction}`), e;
1799
+ },
1800
+ imageStyle: function() {
1801
+ if (this.coordinates && this.image) {
1802
+ var e = this.coordinates.width / this.size.width, t = C(C({
1803
+ rotate: 0,
1804
+ flip: {
1805
+ horizontal: !1,
1806
+ vertical: !1
1807
+ }
1808
+ }, this.image.transforms), {}, {
1809
+ scaleX: 1 / e,
1810
+ scaleY: 1 / e
1811
+ }), n = this.imageSize.width, r = this.imageSize.height, i = We({
1812
+ width: n,
1813
+ height: r
1814
+ }, t.rotate), a = {
1815
+ width: `${n}px`,
1816
+ height: `${r}px`,
1817
+ left: "0px",
1818
+ top: "0px"
1819
+ }, o = {
1820
+ rotate: {
1821
+ left: (n - i.width) * t.scaleX / 2,
1822
+ top: (r - i.height) * t.scaleY / 2
1823
+ },
1824
+ scale: {
1825
+ left: (1 - t.scaleX) * n / 2,
1826
+ top: (1 - t.scaleY) * r / 2
1827
+ }
1828
+ };
1829
+ return a.transform = `translate(
1830
+ ${-this.coordinates.left / e - o.rotate.left - o.scale.left}px,${-this.coordinates.top / e - o.rotate.top - o.scale.top}px) ` + Dt(t), this.transitions && this.transitions.enabled && (a.transition = `${this.transitions.time}ms ${this.transitions.timingFunction}`), a;
1831
+ }
1832
+ return {};
1833
+ },
1834
+ size: function() {
1835
+ return {
1836
+ width: this.width || this.calculatedSize.width,
1837
+ height: this.height || this.calculatedSize.height
1838
+ };
1839
+ },
1840
+ imageSize: function() {
1841
+ return {
1842
+ width: this.image.width || this.calculatedImageSize.width,
1843
+ height: this.image.height || this.calculatedImageSize.height
1844
+ };
1845
+ }
1846
+ },
1847
+ watch: { image: function(e) {
1848
+ (e.width || e.height) && this.onChangeImage();
1849
+ } },
1850
+ mounted: function() {
1851
+ var e = this;
1852
+ this.onChangeImage(), this.$refs.image.addEventListener("load", (function() {
1853
+ e.refreshImage();
1854
+ })), window.addEventListener("resize", this.refresh), window.addEventListener("orientationchange", this.refresh);
1855
+ },
1856
+ unmounted: function() {
1857
+ window.removeEventListener("resize", this.refresh), window.removeEventListener("orientationchange", this.refresh);
1858
+ },
1859
+ methods: {
1860
+ refreshImage: function() {
1861
+ var e = this.$refs.image;
1862
+ this.calculatedImageSize.height = e.naturalHeight, this.calculatedImageSize.width = e.naturalWidth;
1863
+ },
1864
+ refresh: function() {
1865
+ var e = this.$refs.root;
1866
+ this.width || (this.calculatedSize.width = e.clientWidth), this.height || (this.calculatedSize.height = e.clientHeight);
1867
+ },
1868
+ onChangeImage: function() {
1869
+ var e = this.$refs.image;
1870
+ e && e.complete && this.refreshImage(), this.refresh();
1871
+ }
1872
+ }
1873
+ };
1874
+ Nt.render = function(e, t, n, r, i, o) {
1875
+ return a(), b("div", {
1876
+ ref: "root",
1877
+ class: o.classes.root,
1878
+ style: o.style
1879
+ }, [l("div", {
1880
+ ref: "wrapper",
1881
+ class: o.classes.wrapper,
1882
+ style: o.wrapperStyle
1883
+ }, [g(l("img", {
1884
+ ref: "image",
1885
+ src: n.image && n.image.src,
1886
+ class: o.classes.image,
1887
+ style: o.imageStyle
1888
+ }, null, 14, ["src"]), [[f, n.image && n.image.src]])], 6)], 6);
1889
+ };
1890
+ var Pt = {
1891
+ components: { Preview: Nt },
1892
+ inheritAttrs: !1
1893
+ };
1894
+ Pt.render = function(e, t, n, r, i, o) {
1895
+ var c = s("preview");
1896
+ return a(), b(c, ae(e.$attrs, { fill: !0 }), null, 16);
1897
+ };
1898
+ var Ft = A("vue-rectangle-stencil"), It = {
1899
+ name: "RectangleStencil",
1900
+ components: {
1901
+ StencilPreview: Pt,
1902
+ BoundingBox: St,
1903
+ DraggableArea: wt
1904
+ },
1905
+ props: {
1906
+ image: { type: Object },
1907
+ coordinates: { type: Object },
1908
+ stencilCoordinates: { type: Object },
1909
+ handlers: { type: Object },
1910
+ handlersComponent: {
1911
+ type: [Object, String],
1912
+ default: function() {
1913
+ return ht;
1914
+ }
1915
+ },
1916
+ lines: { type: Object },
1917
+ linesComponent: {
1918
+ type: [Object, String],
1919
+ default: function() {
1920
+ return vt;
1921
+ }
1922
+ },
1923
+ aspectRatio: { type: [Number, String] },
1924
+ minAspectRatio: { type: [Number, String] },
1925
+ maxAspectRatio: { type: [Number, String] },
1926
+ movable: {
1927
+ type: Boolean,
1928
+ default: !0
1929
+ },
1930
+ resizable: {
1931
+ type: Boolean,
1932
+ default: !0
1933
+ },
1934
+ transitions: { type: Object },
1935
+ movingClass: { type: String },
1936
+ resizingClass: { type: String },
1937
+ previewClass: { type: String },
1938
+ boundingBoxClass: { type: String },
1939
+ linesClasses: {
1940
+ type: Object,
1941
+ default: function() {
1942
+ return {};
1943
+ }
1944
+ },
1945
+ linesWrappersClasses: {
1946
+ type: Object,
1947
+ default: function() {
1948
+ return {};
1949
+ }
1950
+ },
1951
+ handlersClasses: {
1952
+ type: Object,
1953
+ default: function() {
1954
+ return {};
1955
+ }
1956
+ },
1957
+ handlersWrappersClasses: {
1958
+ type: Object,
1959
+ default: function() {
1960
+ return {};
1961
+ }
1962
+ }
1963
+ },
1964
+ data: function() {
1965
+ return {
1966
+ moving: !1,
1967
+ resizing: !1
1968
+ };
1969
+ },
1970
+ computed: {
1971
+ classes: function() {
1972
+ return {
1973
+ stencil: k(Ft({
1974
+ movable: this.movable,
1975
+ moving: this.moving,
1976
+ resizing: this.resizing
1977
+ }), this.moving && this.movingClass, this.resizing && this.resizingClass),
1978
+ preview: k(Ft("preview"), this.previewClass),
1979
+ boundingBox: k(Ft("bounding-box"), this.boundingBoxClass)
1980
+ };
1981
+ },
1982
+ style: function() {
1983
+ var e = this.stencilCoordinates, t = e.height, n = e.width, r = e.left, i = e.top, a = {
1984
+ width: `${n}px`,
1985
+ height: `${t}px`,
1986
+ transform: `translate(${r}px, ${i}px)`
1987
+ };
1988
+ return this.transitions && this.transitions.enabled && (a.transition = `${this.transitions.time}ms ${this.transitions.timingFunction}`), a;
1989
+ }
1990
+ },
1991
+ methods: {
1992
+ onMove: function(e) {
1993
+ this.$emit("move", e), this.moving = !0;
1994
+ },
1995
+ onMoveEnd: function() {
1996
+ this.$emit("move-end"), this.moving = !1;
1997
+ },
1998
+ onResize: function(e) {
1999
+ this.$emit("resize", e), this.resizing = !0;
2000
+ },
2001
+ onResizeEnd: function() {
2002
+ this.$emit("resize-end"), this.resizing = !1;
2003
+ },
2004
+ aspectRatios: function() {
2005
+ return {
2006
+ minimum: this.aspectRatio || this.minAspectRatio,
2007
+ maximum: this.aspectRatio || this.maxAspectRatio
2008
+ };
2009
+ }
2010
+ },
2011
+ emits: [
2012
+ "resize",
2013
+ "resize-end",
2014
+ "move",
2015
+ "move-end"
2016
+ ]
2017
+ };
2018
+ It.render = function(e, t, n, r, i, o) {
2019
+ var c = s("stencil-preview"), u = s("draggable-area"), d = s("bounding-box");
2020
+ return a(), b("div", {
2021
+ class: o.classes.stencil,
2022
+ style: o.style
2023
+ }, [l(d, {
2024
+ width: n.stencilCoordinates.width,
2025
+ height: n.stencilCoordinates.height,
2026
+ transitions: n.transitions,
2027
+ class: o.classes.boundingBox,
2028
+ handlers: n.handlers,
2029
+ "handlers-component": n.handlersComponent,
2030
+ "handlers-classes": n.handlersClasses,
2031
+ "handlers-wrappers-classes": n.handlersWrappersClasses,
2032
+ lines: n.lines,
2033
+ "lines-component": n.linesComponent,
2034
+ "lines-classes": n.linesClasses,
2035
+ "lines-wrappers-classes": n.linesWrappersClasses,
2036
+ resizable: n.resizable,
2037
+ onResize: o.onResize,
2038
+ onResizeEnd: o.onResizeEnd
2039
+ }, {
2040
+ default: h((function() {
2041
+ return [l(u, {
2042
+ movable: n.movable,
2043
+ onMove: o.onMove,
2044
+ onMoveEnd: o.onMoveEnd
2045
+ }, {
2046
+ default: h((function() {
2047
+ return [l(c, {
2048
+ image: n.image,
2049
+ coordinates: n.coordinates,
2050
+ width: n.stencilCoordinates.width,
2051
+ height: n.stencilCoordinates.height,
2052
+ class: o.classes.preview,
2053
+ transitions: n.transitions
2054
+ }, null, 8, [
2055
+ "image",
2056
+ "coordinates",
2057
+ "width",
2058
+ "height",
2059
+ "class",
2060
+ "transitions"
2061
+ ])];
2062
+ })),
2063
+ _: 1
2064
+ }, 8, [
2065
+ "movable",
2066
+ "onMove",
2067
+ "onMoveEnd"
2068
+ ])];
2069
+ })),
2070
+ _: 1
2071
+ }, 8, [
2072
+ "width",
2073
+ "height",
2074
+ "transitions",
2075
+ "class",
2076
+ "handlers",
2077
+ "handlers-component",
2078
+ "handlers-classes",
2079
+ "handlers-wrappers-classes",
2080
+ "lines",
2081
+ "lines-component",
2082
+ "lines-classes",
2083
+ "lines-wrappers-classes",
2084
+ "resizable",
2085
+ "onResize",
2086
+ "onResizeEnd"
2087
+ ])], 6);
2088
+ };
2089
+ var Lt = ["transitions"], $ = A("vue-advanced-cropper"), Rt = {
2090
+ name: "Cropper",
2091
+ components: { BackgroundWrapper: jt },
2092
+ props: {
2093
+ src: {
2094
+ type: String,
2095
+ default: null
2096
+ },
2097
+ stencilComponent: {
2098
+ type: [Object, String],
2099
+ default: function() {
2100
+ return It;
2101
+ }
2102
+ },
2103
+ backgroundWrapperComponent: {
2104
+ type: [Object, String],
2105
+ default: function() {
2106
+ return jt;
2107
+ }
2108
+ },
2109
+ stencilProps: {
2110
+ type: Object,
2111
+ default: function() {
2112
+ return {};
2113
+ }
2114
+ },
2115
+ autoZoom: {
2116
+ type: Boolean,
2117
+ default: !1
2118
+ },
2119
+ imageClass: { type: String },
2120
+ boundariesClass: { type: String },
2121
+ backgroundClass: { type: String },
2122
+ foregroundClass: { type: String },
2123
+ minWidth: { type: [Number, String] },
2124
+ minHeight: { type: [Number, String] },
2125
+ maxWidth: { type: [Number, String] },
2126
+ maxHeight: { type: [Number, String] },
2127
+ debounce: {
2128
+ type: [Boolean, Number],
2129
+ default: 500
2130
+ },
2131
+ transitions: {
2132
+ type: Boolean,
2133
+ default: !0
2134
+ },
2135
+ checkOrientation: {
2136
+ type: Boolean,
2137
+ default: !0
2138
+ },
2139
+ canvas: {
2140
+ type: [Object, Boolean],
2141
+ default: !0
2142
+ },
2143
+ crossOrigin: {
2144
+ type: [Boolean, String],
2145
+ default: void 0
2146
+ },
2147
+ transitionTime: {
2148
+ type: Number,
2149
+ default: 300
2150
+ },
2151
+ imageRestriction: {
2152
+ type: String,
2153
+ default: "fit-area",
2154
+ validator: function(e) {
2155
+ return Le.indexOf(e) !== -1;
2156
+ }
2157
+ },
2158
+ roundResult: {
2159
+ type: Boolean,
2160
+ default: !0
2161
+ },
2162
+ defaultSize: { type: [Function, Object] },
2163
+ defaultPosition: { type: [Function, Object] },
2164
+ defaultVisibleArea: { type: [Function, Object] },
2165
+ defaultTransforms: { type: [Function, Object] },
2166
+ defaultBoundaries: {
2167
+ type: [Function, String],
2168
+ validator: function(e) {
2169
+ return typeof e != "string" || e === "fill" || e === "fit";
2170
+ }
2171
+ },
2172
+ priority: {
2173
+ type: String,
2174
+ default: "coordinates"
2175
+ },
2176
+ stencilSize: { type: [Object, Function] },
2177
+ resizeImage: {
2178
+ type: [Boolean, Object],
2179
+ default: !0
2180
+ },
2181
+ moveImage: {
2182
+ type: [Boolean, Object],
2183
+ default: !0
2184
+ },
2185
+ autoZoomAlgorithm: { type: Function },
2186
+ resizeAlgorithm: {
2187
+ type: Function,
2188
+ default: function(e) {
2189
+ var t = e.event, n = e.coordinates, r = e.aspectRatio, i = e.positionRestrictions, a = e.sizeRestrictions, o = N(N({}, n), {
2190
+ right: n.left + n.width,
2191
+ bottom: n.top + n.height
2192
+ }), s = t.params || {}, c = N({}, t.directions), l = s.allowedDirections || {
2193
+ left: !0,
2194
+ right: !0,
2195
+ bottom: !0,
2196
+ top: !0
2197
+ };
2198
+ a.widthFrozen && (c.left = 0, c.right = 0), a.heightFrozen && (c.top = 0, c.bottom = 0), B.forEach((function(e) {
2199
+ l[e] || (c[e] = 0);
2200
+ }));
2201
+ var u = W(o, c = dt({
2202
+ coordinates: o,
2203
+ directions: c,
2204
+ sizeRestrictions: a,
2205
+ positionRestrictions: i
2206
+ })).width, d = W(o, c).height, f = s.preserveRatio ? q(o) : He(u / d, r);
2207
+ if (f) {
2208
+ var p = s.respectDirection;
2209
+ if (p ||= o.width >= o.height || f === 1 ? "width" : "height", p === "width") {
2210
+ var m = u / f - o.height;
2211
+ if (l.top && l.bottom) {
2212
+ var h = c.top, g = c.bottom;
2213
+ c.bottom = ft(m, g, h), c.top = ft(m, h, g);
2214
+ } else l.bottom ? c.bottom = m : l.top ? c.top = m : l.right ? c.right = 0 : l.left && (c.left = 0);
2215
+ } else if (p === "height") {
2216
+ var _ = o.width - d * f;
2217
+ if (l.left && l.right) {
2218
+ var v = c.left, y = c.right;
2219
+ c.left = -ft(_, v, y), c.right = -ft(_, y, v);
2220
+ } else l.left ? c.left = -_ : l.right ? c.right = -_ : l.top ? c.top = 0 : l.bottom && (c.bottom = 0);
2221
+ }
2222
+ c = dt({
2223
+ directions: c,
2224
+ coordinates: o,
2225
+ sizeRestrictions: a,
2226
+ positionRestrictions: i,
2227
+ preserveRatio: !0,
2228
+ compensate: s.compensate
2229
+ });
2230
+ }
2231
+ return u = W(o, c).width, d = W(o, c).height, (f = s.preserveRatio ? q(o) : He(u / d, r)) && Math.abs(f - u / d) > .001 && B.forEach((function(e) {
2232
+ l[e] || (c[e] = 0);
2233
+ })), Qe({
2234
+ event: new De({
2235
+ left: -c.left,
2236
+ top: -c.top
2237
+ }),
2238
+ coordinates: {
2239
+ width: n.width + c.right + c.left,
2240
+ height: n.height + c.top + c.bottom,
2241
+ left: n.left,
2242
+ top: n.top
2243
+ },
2244
+ positionRestrictions: i
2245
+ });
2246
+ }
2247
+ },
2248
+ moveAlgorithm: {
2249
+ type: Function,
2250
+ default: Qe
2251
+ },
2252
+ initStretcher: {
2253
+ type: Function,
2254
+ default: function(e) {
2255
+ var t = e.stretcher, n = e.imageSize, r = q(n);
2256
+ t.style.width = n.width + "px", t.style.height = t.clientWidth / r + "px", t.style.width = t.clientWidth + "px";
2257
+ }
2258
+ },
2259
+ fitCoordinates: {
2260
+ type: Function,
2261
+ default: function(e) {
2262
+ var t = e.visibleArea, n = e.coordinates, r = e.aspectRatio, i = e.sizeRestrictions, a = e.positionRestrictions, o = N(N({}, n), Q({
2263
+ width: n.width,
2264
+ height: n.height,
2265
+ aspectRatio: r,
2266
+ sizeRestrictions: {
2267
+ maxWidth: t.width,
2268
+ maxHeight: t.height,
2269
+ minHeight: Math.min(t.height, i.minHeight),
2270
+ minWidth: Math.min(t.width, i.minWidth)
2271
+ }
2272
+ }));
2273
+ return o = Z(o = G(o, H(U(n), U(o))), Ye(V(t), a));
2274
+ }
2275
+ },
2276
+ fitVisibleArea: {
2277
+ type: Function,
2278
+ default: function(e) {
2279
+ var t = e.visibleArea, n = e.boundaries, r = e.getAreaRestrictions, i = e.coordinates, a = N({}, t);
2280
+ a.height = a.width / q(n), a.top += (t.height - a.height) / 2, (i.height - a.height > 0 || i.width - a.width > 0) && (a = K(a, Math.max(i.height / a.height, i.width / a.width)));
2281
+ var o = Ve(Y(i, V(a = K(a, Ge(a, r({
2282
+ visibleArea: a,
2283
+ type: "resize"
2284
+ }))))));
2285
+ return a.width < i.width && (o.left = 0), a.height < i.height && (o.top = 0), a = Z(a = G(a, o), r({
2286
+ visibleArea: a,
2287
+ type: "move"
2288
+ }));
2289
+ }
2290
+ },
2291
+ areaRestrictionsAlgorithm: {
2292
+ type: Function,
2293
+ default: function(e) {
2294
+ var t = e.visibleArea, n = e.boundaries, r = e.imageSize, i = e.imageRestriction, a = e.type, o = {};
2295
+ return i === "fill-area" ? o = {
2296
+ left: 0,
2297
+ top: 0,
2298
+ right: r.width,
2299
+ bottom: r.height
2300
+ } : i === "fit-area" && (q(n) > q(r) ? (o = {
2301
+ top: 0,
2302
+ bottom: r.height
2303
+ }, t && a === "move" && (t.width > r.width ? (o.left = -(t.width - r.width) / 2, o.right = r.width - o.left) : (o.left = 0, o.right = r.width))) : (o = {
2304
+ left: 0,
2305
+ right: r.width
2306
+ }, t && a === "move" && (t.height > r.height ? (o.top = -(t.height - r.height) / 2, o.bottom = r.height - o.top) : (o.top = 0, o.bottom = r.height)))), o;
2307
+ }
2308
+ },
2309
+ sizeRestrictionsAlgorithm: {
2310
+ type: Function,
2311
+ default: function(e) {
2312
+ return {
2313
+ minWidth: e.minWidth,
2314
+ minHeight: e.minHeight,
2315
+ maxWidth: e.maxWidth,
2316
+ maxHeight: e.maxHeight
2317
+ };
2318
+ }
2319
+ },
2320
+ positionRestrictionsAlgorithm: {
2321
+ type: Function,
2322
+ default: function(e) {
2323
+ var t = e.imageSize, n = {};
2324
+ return e.imageRestriction !== "none" && (n = {
2325
+ left: 0,
2326
+ top: 0,
2327
+ right: t.width,
2328
+ bottom: t.height
2329
+ }), n;
2330
+ }
2331
+ }
2332
+ },
2333
+ data: function() {
2334
+ return {
2335
+ transitionsActive: !1,
2336
+ imageLoaded: !1,
2337
+ imageAttributes: {
2338
+ width: null,
2339
+ height: null,
2340
+ crossOrigin: null,
2341
+ src: null
2342
+ },
2343
+ defaultImageTransforms: {
2344
+ rotate: 0,
2345
+ flip: {
2346
+ horizontal: !1,
2347
+ vertical: !1
2348
+ }
2349
+ },
2350
+ appliedImageTransforms: {
2351
+ rotate: 0,
2352
+ flip: {
2353
+ horizontal: !1,
2354
+ vertical: !1
2355
+ }
2356
+ },
2357
+ boundaries: {
2358
+ width: 0,
2359
+ height: 0
2360
+ },
2361
+ visibleArea: null,
2362
+ coordinates: C({}, Re)
2363
+ };
2364
+ },
2365
+ computed: {
2366
+ image: function() {
2367
+ return {
2368
+ src: this.imageAttributes.src,
2369
+ width: this.imageAttributes.width,
2370
+ height: this.imageAttributes.height,
2371
+ transforms: this.imageTransforms
2372
+ };
2373
+ },
2374
+ imageTransforms: function() {
2375
+ return {
2376
+ rotate: this.appliedImageTransforms.rotate,
2377
+ flip: {
2378
+ horizontal: this.appliedImageTransforms.flip.horizontal,
2379
+ vertical: this.appliedImageTransforms.flip.vertical
2380
+ },
2381
+ translateX: this.visibleArea ? this.visibleArea.left / this.coefficient : 0,
2382
+ translateY: this.visibleArea ? this.visibleArea.top / this.coefficient : 0,
2383
+ scaleX: 1 / this.coefficient,
2384
+ scaleY: 1 / this.coefficient
2385
+ };
2386
+ },
2387
+ imageSize: function() {
2388
+ var e = function(e) {
2389
+ return e * Math.PI / 180;
2390
+ }(this.imageTransforms.rotate);
2391
+ return {
2392
+ width: Math.abs(this.imageAttributes.width * Math.cos(e)) + Math.abs(this.imageAttributes.height * Math.sin(e)),
2393
+ height: Math.abs(this.imageAttributes.width * Math.sin(e)) + Math.abs(this.imageAttributes.height * Math.cos(e))
2394
+ };
2395
+ },
2396
+ initialized: function() {
2397
+ return !!(this.visibleArea && this.imageLoaded);
2398
+ },
2399
+ settings: function() {
2400
+ var e = xe(this.resizeImage, {
2401
+ touch: !0,
2402
+ wheel: { ratio: .1 },
2403
+ adjustStencil: !0
2404
+ }, {
2405
+ touch: !1,
2406
+ wheel: !1,
2407
+ adjustStencil: !1
2408
+ });
2409
+ return {
2410
+ moveImage: xe(this.moveImage, {
2411
+ touch: !0,
2412
+ mouse: !0
2413
+ }, {
2414
+ touch: !1,
2415
+ mouse: !1
2416
+ }),
2417
+ resizeImage: e
2418
+ };
2419
+ },
2420
+ coefficient: function() {
2421
+ return this.visibleArea ? this.visibleArea.width / this.boundaries.width : 0;
2422
+ },
2423
+ areaRestrictions: function() {
2424
+ return this.imageLoaded ? this.areaRestrictionsAlgorithm({
2425
+ imageSize: this.imageSize,
2426
+ imageRestriction: this.imageRestriction,
2427
+ boundaries: this.boundaries
2428
+ }) : {};
2429
+ },
2430
+ transitionsOptions: function() {
2431
+ return {
2432
+ enabled: this.transitionsActive,
2433
+ timingFunction: "ease-in-out",
2434
+ time: 350
2435
+ };
2436
+ },
2437
+ sizeRestrictions: function() {
2438
+ if (this.boundaries.width && this.boundaries.height && this.imageSize.width && this.imageSize.height) {
2439
+ var e = this.sizeRestrictionsAlgorithm({
2440
+ imageSize: this.imageSize,
2441
+ minWidth: L(this.minWidth) ? 0 : Se(this.minWidth),
2442
+ minHeight: L(this.minHeight) ? 0 : Se(this.minHeight),
2443
+ maxWidth: L(this.maxWidth) ? 1 / 0 : Se(this.maxWidth),
2444
+ maxHeight: L(this.maxHeight) ? 1 / 0 : Se(this.maxHeight)
2445
+ });
2446
+ if (e = function(e) {
2447
+ var t = e.areaRestrictions, n = e.sizeRestrictions, r = e.boundaries, i = e.positionRestrictions, a = N(N({}, n), {
2448
+ minWidth: n.minWidth === void 0 ? 0 : n.minWidth,
2449
+ minHeight: n.minHeight === void 0 ? 0 : n.minHeight,
2450
+ maxWidth: n.maxWidth === void 0 ? 1 / 0 : n.maxWidth,
2451
+ maxHeight: n.maxHeight === void 0 ? 1 / 0 : n.maxHeight
2452
+ });
2453
+ i.left !== void 0 && i.right !== void 0 && (a.maxWidth = Math.min(a.maxWidth, i.right - i.left)), i.bottom !== void 0 && i.top !== void 0 && (a.maxHeight = Math.min(a.maxHeight, i.bottom - i.top));
2454
+ var o = Ke(t), s = Ue(r, o);
2455
+ return o.width < 1 / 0 && (!a.maxWidth || a.maxWidth > s.width) && (a.maxWidth = Math.min(a.maxWidth, s.width)), o.height < 1 / 0 && (!a.maxHeight || a.maxHeight > s.height) && (a.maxHeight = Math.min(a.maxHeight, s.height)), a.minWidth > a.maxWidth && (a.minWidth = a.maxWidth, a.widthFrozen = !0), a.minHeight > a.maxHeight && (a.minHeight = a.maxHeight, a.heightFrozen = !0), a;
2456
+ }({
2457
+ sizeRestrictions: e,
2458
+ areaRestrictions: this.getAreaRestrictions({
2459
+ visibleArea: this.visibleArea,
2460
+ type: "resize"
2461
+ }),
2462
+ imageSize: this.imageSize,
2463
+ boundaries: this.boundaries,
2464
+ positionRestrictions: this.positionRestrictions,
2465
+ imageRestriction: this.imageRestriction,
2466
+ visibleArea: this.visibleArea,
2467
+ stencilSize: this.getStencilSize()
2468
+ }), this.visibleArea && this.stencilSize) {
2469
+ var t = this.getStencilSize(), n = Ke(this.getAreaRestrictions({
2470
+ visibleArea: this.visibleArea,
2471
+ type: "resize"
2472
+ }));
2473
+ e.maxWidth = Math.min(e.maxWidth, n.width * t.width / this.boundaries.width), e.maxHeight = Math.min(e.maxHeight, n.height * t.height / this.boundaries.height), e.maxWidth < e.minWidth && (e.minWidth = e.maxWidth), e.maxHeight < e.minHeight && (e.minHeight = e.maxHeight);
2474
+ }
2475
+ return e;
2476
+ }
2477
+ return {
2478
+ minWidth: 0,
2479
+ minHeight: 0,
2480
+ maxWidth: 0,
2481
+ maxHeight: 0
2482
+ };
2483
+ },
2484
+ positionRestrictions: function() {
2485
+ return this.positionRestrictionsAlgorithm({
2486
+ imageSize: this.imageSize,
2487
+ imageRestriction: this.imageRestriction
2488
+ });
2489
+ },
2490
+ classes: function() {
2491
+ return {
2492
+ cropper: $(),
2493
+ image: k($("image"), this.imageClass),
2494
+ stencil: $("stencil"),
2495
+ boundaries: k($("boundaries"), this.boundariesClass),
2496
+ stretcher: k($("stretcher")),
2497
+ background: k($("background"), this.backgroundClass),
2498
+ foreground: k($("foreground"), this.foregroundClass),
2499
+ imageWrapper: k($("image-wrapper")),
2500
+ cropperWrapper: k($("cropper-wrapper"))
2501
+ };
2502
+ },
2503
+ stencilCoordinates: function() {
2504
+ if (this.initialized) {
2505
+ var e = this.coordinates, t = e.width, n = e.height, r = e.left, i = e.top;
2506
+ return {
2507
+ width: t / this.coefficient,
2508
+ height: n / this.coefficient,
2509
+ left: (r - this.visibleArea.left) / this.coefficient,
2510
+ top: (i - this.visibleArea.top) / this.coefficient
2511
+ };
2512
+ }
2513
+ return this.defaultCoordinates();
2514
+ },
2515
+ boundariesStyle: function() {
2516
+ var e = {
2517
+ width: this.boundaries.width ? `${Math.round(this.boundaries.width)}px` : "auto",
2518
+ height: this.boundaries.height ? `${Math.round(this.boundaries.height)}px` : "auto",
2519
+ transition: `opacity ${this.transitionTime}ms`,
2520
+ pointerEvents: this.imageLoaded ? "all" : "none"
2521
+ };
2522
+ return this.imageLoaded || (e.opacity = "0"), e;
2523
+ },
2524
+ imageStyle: function() {
2525
+ var e = this.imageAttributes.width > this.imageAttributes.height ? {
2526
+ width: Math.min(1024, this.imageAttributes.width),
2527
+ height: Math.min(1024, this.imageAttributes.width) / (this.imageAttributes.width / this.imageAttributes.height)
2528
+ } : {
2529
+ height: Math.min(1024, this.imageAttributes.height),
2530
+ width: Math.min(1024, this.imageAttributes.height) * (this.imageAttributes.width / this.imageAttributes.height)
2531
+ }, t = {
2532
+ left: (e.width - this.imageSize.width) / (2 * this.coefficient),
2533
+ top: (e.height - this.imageSize.height) / (2 * this.coefficient)
2534
+ }, n = {
2535
+ left: (1 - 1 / this.coefficient) * e.width / 2,
2536
+ top: (1 - 1 / this.coefficient) * e.height / 2
2537
+ }, r = C(C({}, this.imageTransforms), {}, {
2538
+ scaleX: this.imageTransforms.scaleX * (this.imageAttributes.width / e.width),
2539
+ scaleY: this.imageTransforms.scaleY * (this.imageAttributes.height / e.height)
2540
+ }), i = {
2541
+ width: `${e.width}px`,
2542
+ height: `${e.height}px`,
2543
+ left: "0px",
2544
+ top: "0px",
2545
+ transform: `translate(${-t.left - n.left - this.imageTransforms.translateX}px, ${-t.top - n.top - this.imageTransforms.translateY}px)` + Dt(r)
2546
+ };
2547
+ return this.transitionsOptions.enabled && (i.transition = `${this.transitionsOptions.time}ms ${this.transitionsOptions.timingFunction}`), i;
2548
+ }
2549
+ },
2550
+ watch: {
2551
+ src: function() {
2552
+ this.onChangeImage();
2553
+ },
2554
+ stencilComponent: function() {
2555
+ var e = this;
2556
+ this.$nextTick((function() {
2557
+ e.resetCoordinates(), e.runAutoZoom("setCoordinates"), e.onChange();
2558
+ }));
2559
+ },
2560
+ minWidth: function() {
2561
+ this.onPropsChange();
2562
+ },
2563
+ maxWidth: function() {
2564
+ this.onPropsChange();
2565
+ },
2566
+ minHeight: function() {
2567
+ this.onPropsChange();
2568
+ },
2569
+ maxHeight: function() {
2570
+ this.onPropsChange();
2571
+ },
2572
+ imageRestriction: function() {
2573
+ this.reset();
2574
+ },
2575
+ stencilProps: function(e, t) {
2576
+ [
2577
+ "aspectRatio",
2578
+ "minAspectRatio",
2579
+ "maxAspectRatio"
2580
+ ].find((function(n) {
2581
+ return e[n] !== t[n];
2582
+ })) && this.$nextTick(this.onPropsChange);
2583
+ }
2584
+ },
2585
+ created: function() {
2586
+ this.debouncedUpdate = M(this.update, this.debounce), this.debouncedDisableTransitions = M(this.disableTransitions, this.transitionsOptions.time), this.awaiting = !1;
2587
+ },
2588
+ mounted: function() {
2589
+ 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);
2590
+ },
2591
+ unmounted: function() {
2592
+ 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();
2593
+ },
2594
+ methods: {
2595
+ getResult: function() {
2596
+ var e = this.initialized ? this.prepareResult(C({}, this.coordinates)) : this.defaultCoordinates(), t = {
2597
+ rotate: this.imageTransforms.rotate % 360,
2598
+ flip: C({}, this.imageTransforms.flip)
2599
+ };
2600
+ if (this.src && this.imageLoaded) {
2601
+ var n = this;
2602
+ return {
2603
+ image: this.image,
2604
+ coordinates: e,
2605
+ visibleArea: this.visibleArea ? C({}, this.visibleArea) : null,
2606
+ imageTransforms: t,
2607
+ get canvas() {
2608
+ return n.canvas ? n.getCanvas() : void 0;
2609
+ }
2610
+ };
2611
+ }
2612
+ return {
2613
+ image: this.image,
2614
+ coordinates: e,
2615
+ visibleArea: this.visibleArea ? C({}, this.visibleArea) : null,
2616
+ canvas: void 0,
2617
+ imageTransforms: t
2618
+ };
2619
+ },
2620
+ zoom: function(e, t) {
2621
+ var n = (arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}).transitions, r = n === void 0 || n;
2622
+ this.onManipulateImage(new z({}, {
2623
+ factor: 1 / e,
2624
+ center: t
2625
+ }), {
2626
+ normalize: !1,
2627
+ transitions: r
2628
+ });
2629
+ },
2630
+ move: function(e, t) {
2631
+ var n = (arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}).transitions, r = n === void 0 || n;
2632
+ this.onManipulateImage(new z({
2633
+ left: e || 0,
2634
+ top: t || 0
2635
+ }), {
2636
+ normalize: !1,
2637
+ transitions: r
2638
+ });
2639
+ },
2640
+ setCoordinates: function(e) {
2641
+ var t = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = n.autoZoom, i = r === void 0 || r, a = n.transitions, o = a === void 0 || a;
2642
+ this.$nextTick((function() {
2643
+ t.imageLoaded ? (t.transitionsActive || (o && t.enableTransitions(), t.coordinates = t.applyTransform(e), i && t.runAutoZoom("setCoordinates"), o && t.debouncedDisableTransitions()), t.onChange()) : t.delayedTransforms = e;
2644
+ }));
2645
+ },
2646
+ refresh: function() {
2647
+ var e = this, t = this.$refs.image;
2648
+ if (this.src && t) return this.initialized ? this.updateVisibleArea().then((function() {
2649
+ e.onChange();
2650
+ })) : this.resetVisibleArea().then((function() {
2651
+ e.onChange();
2652
+ }));
2653
+ },
2654
+ reset: function() {
2655
+ var e = this;
2656
+ return this.resetVisibleArea().then((function() {
2657
+ e.onChange(!1);
2658
+ }));
2659
+ },
2660
+ awaitRender: function(e) {
2661
+ var t = this;
2662
+ this.awaiting || (this.awaiting = !0, this.$nextTick((function() {
2663
+ e(), t.awaiting = !1;
2664
+ })));
2665
+ },
2666
+ prepareResult: function(e) {
2667
+ return this.roundResult ? function(e) {
2668
+ var t = e.coordinates, n = e.sizeRestrictions, r = e.positionRestrictions, i = {
2669
+ width: Math.round(t.width),
2670
+ height: Math.round(t.height),
2671
+ left: Math.round(t.left),
2672
+ top: Math.round(t.top)
2673
+ };
2674
+ return i.width > n.maxWidth ? i.width = Math.floor(t.width) : i.width < n.minWidth && (i.width = Math.ceil(t.width)), i.height > n.maxHeight ? i.height = Math.floor(t.height) : i.height < n.minHeight && (i.height = Math.ceil(t.height)), Z(i, r);
2675
+ }(C(C({}, this.getPublicProperties()), {}, {
2676
+ positionRestrictions: st(this.positionRestrictions, this.visibleArea),
2677
+ coordinates: e
2678
+ })) : e;
2679
+ },
2680
+ processAutoZoom: function(e, t, n, r) {
2681
+ var i = this.autoZoomAlgorithm;
2682
+ i ||= this.stencilSize ? et : this.autoZoom ? tt : nt;
2683
+ var a = i({
2684
+ event: {
2685
+ type: e,
2686
+ params: r
2687
+ },
2688
+ visibleArea: t,
2689
+ coordinates: n,
2690
+ boundaries: this.boundaries,
2691
+ aspectRatio: this.getAspectRatio(),
2692
+ positionRestrictions: this.positionRestrictions,
2693
+ getAreaRestrictions: this.getAreaRestrictions,
2694
+ sizeRestrictions: this.sizeRestrictions,
2695
+ stencilSize: this.getStencilSize()
2696
+ });
2697
+ return C(C({}, a), {}, { changed: !ze(a.visibleArea, t) || !ze(a.coordinates, n) });
2698
+ },
2699
+ runAutoZoom: function(e) {
2700
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = t.transitions, r = n !== void 0 && n, i = T(t, Lt), a = this.processAutoZoom(e, this.visibleArea, this.coordinates, i), o = a.visibleArea, s = a.coordinates, c = a.changed;
2701
+ r && c && this.enableTransitions(), this.visibleArea = o, this.coordinates = s, r && c && this.debouncedDisableTransitions();
2702
+ },
2703
+ normalizeEvent: function(e) {
2704
+ return function(e) {
2705
+ var t = e.event, n = e.visibleArea, r = e.coefficient;
2706
+ if (t.type === "manipulateImage") return N(N({}, t), {
2707
+ move: {
2708
+ left: t.move && t.move.left ? r * t.move.left : 0,
2709
+ top: t.move && t.move.top ? r * t.move.top : 0
2710
+ },
2711
+ scale: {
2712
+ factor: t.scale && t.scale.factor ? t.scale.factor : 1,
2713
+ center: t.scale && t.scale.center ? {
2714
+ left: t.scale.center.left * r + n.left,
2715
+ top: t.scale.center.top * r + n.top
2716
+ } : null
2717
+ }
2718
+ });
2719
+ if (t.type === "resize") {
2720
+ var i = N(N({}, t), { directions: N({}, t.directions) });
2721
+ return B.forEach((function(e) {
2722
+ i.directions[e] *= r;
2723
+ })), i;
2724
+ }
2725
+ if (t.type === "move") {
2726
+ var a = N(N({}, t), { directions: N({}, t.directions) });
2727
+ return Ie.forEach((function(e) {
2728
+ a.directions[e] *= r;
2729
+ })), a;
2730
+ }
2731
+ return t;
2732
+ }(C(C({}, this.getPublicProperties()), {}, { event: e }));
2733
+ },
2734
+ getCanvas: function() {
2735
+ if (this.$refs.canvas) {
2736
+ var e = this.$refs.canvas, t = this.$refs.image, n = this.imageTransforms.rotate !== 0 || this.imageTransforms.flip.horizontal || this.imageTransforms.flip.vertical ? function(e, t, n) {
2737
+ var r = n.rotate, i = n.flip, a = {
2738
+ width: t.naturalWidth,
2739
+ height: t.naturalHeight
2740
+ }, o = We(a, r), s = e.getContext("2d");
2741
+ e.height = o.height, e.width = o.width, s.save();
2742
+ var c = X(U(N({
2743
+ left: 0,
2744
+ top: 0
2745
+ }, a)), r);
2746
+ return s.translate(-(c.left - o.width / 2), -(c.top - o.height / 2)), s.rotate(r * Math.PI / 180), s.translate(i.horizontal ? a.width : 0, i.vertical ? a.height : 0), s.scale(i.horizontal ? -1 : 1, i.vertical ? -1 : 1), s.drawImage(t, 0, 0, a.width, a.height), s.restore(), e;
2747
+ }(this.$refs.sourceCanvas, t, this.imageTransforms) : t, r = C({
2748
+ minWidth: 0,
2749
+ minHeight: 0,
2750
+ maxWidth: 1 / 0,
2751
+ maxHeight: 1 / 0,
2752
+ maxArea: this.maxCanvasSize,
2753
+ imageSmoothingEnabled: !0,
2754
+ imageSmoothingQuality: "high",
2755
+ fillColor: "transparent"
2756
+ }, this.canvas), i = function(e) {
2757
+ return e.find((function(e) {
2758
+ return t = e, !Number.isNaN(parseFloat(t)) && isFinite(t);
2759
+ var t;
2760
+ }));
2761
+ }, a = Q({
2762
+ sizeRestrictions: {
2763
+ minWidth: i([r.width, r.minWidth]) || 0,
2764
+ minHeight: i([r.height, r.minHeight]) || 0,
2765
+ maxWidth: i([r.width, r.maxWidth]) || 1 / 0,
2766
+ maxHeight: i([r.height, r.maxHeight]) || 1 / 0
2767
+ },
2768
+ width: this.coordinates.width,
2769
+ height: this.coordinates.height,
2770
+ aspectRatio: {
2771
+ minimum: this.coordinates.width / this.coordinates.height,
2772
+ maximum: this.coordinates.width / this.coordinates.height
2773
+ }
2774
+ });
2775
+ if (r.maxArea && a.width * a.height > r.maxArea) {
2776
+ var o = Math.sqrt(r.maxArea / (a.width * a.height));
2777
+ a = {
2778
+ width: Math.round(o * a.width),
2779
+ height: Math.round(o * a.height)
2780
+ };
2781
+ }
2782
+ return function(e, t, n, r, i) {
2783
+ e.width = r ? r.width : n.width, e.height = r ? r.height : n.height;
2784
+ var a = e.getContext("2d");
2785
+ a.clearRect(0, 0, e.width, e.height), i && (i.imageSmoothingEnabled && (a.imageSmoothingEnabled = i.imageSmoothingEnabled), i.imageSmoothingQuality && (a.imageSmoothingQuality = i.imageSmoothingQuality), i.fillColor && (a.fillStyle = i.fillColor, a.fillRect(0, 0, e.width, e.height), a.save()));
2786
+ var o = n.left < 0 ? -n.left : 0, s = n.top < 0 ? -n.top : 0;
2787
+ a.drawImage(t, n.left + o, n.top + s, n.width, n.height, e.width / n.width * o, e.height / n.height * s, e.width, e.height);
2788
+ }(e, n, this.coordinates, a, r), e;
2789
+ }
2790
+ },
2791
+ update: function() {
2792
+ this.$emit("change", this.getResult());
2793
+ },
2794
+ applyTransform: function(e) {
2795
+ var t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], n = this.visibleArea && t ? qe(this.sizeRestrictions, this.visibleArea) : this.sizeRestrictions, r = this.visibleArea && t ? st(this.positionRestrictions, this.visibleArea) : this.positionRestrictions;
2796
+ return $e({
2797
+ transform: e,
2798
+ coordinates: this.coordinates,
2799
+ imageSize: this.imageSize,
2800
+ sizeRestrictions: n,
2801
+ positionRestrictions: r,
2802
+ aspectRatio: this.getAspectRatio(),
2803
+ visibleArea: this.visibleArea
2804
+ });
2805
+ },
2806
+ resetCoordinates: function() {
2807
+ var e = this;
2808
+ if (this.$refs.image) {
2809
+ this.$refs.cropper, this.$refs.image;
2810
+ var t = this.defaultSize;
2811
+ t ||= this.stencilSize ? at : it, this.sizeRestrictions;
2812
+ var n = I(t) ? t({
2813
+ boundaries: this.boundaries,
2814
+ imageSize: this.imageSize,
2815
+ aspectRatio: this.getAspectRatio(),
2816
+ sizeRestrictions: this.sizeRestrictions,
2817
+ stencilSize: this.getStencilSize(),
2818
+ visibleArea: this.visibleArea
2819
+ }) : t, r = this.defaultPosition || rt, i = [n, function(t) {
2820
+ var n = t.coordinates;
2821
+ return C({}, I(r) ? r({
2822
+ coordinates: n,
2823
+ imageSize: e.imageSize,
2824
+ visibleArea: e.visibleArea
2825
+ }) : e.defaultPosition);
2826
+ }];
2827
+ this.delayedTransforms && i.push.apply(i, E(Array.isArray(this.delayedTransforms) ? this.delayedTransforms : [this.delayedTransforms])), this.coordinates = this.applyTransform(i, !0), this.delayedTransforms = null;
2828
+ }
2829
+ },
2830
+ clearImage: function() {
2831
+ var e = this;
2832
+ this.imageLoaded = !1, setTimeout((function() {
2833
+ var t = e.$refs.stretcher;
2834
+ t && (t.style.height = "auto", t.style.width = "auto"), e.coordinates = e.defaultCoordinates(), e.boundaries = {
2835
+ width: 0,
2836
+ height: 0
2837
+ };
2838
+ }), this.transitionTime);
2839
+ },
2840
+ enableTransitions: function() {
2841
+ this.transitions && (this.transitionsActive = !0);
2842
+ },
2843
+ disableTransitions: function() {
2844
+ this.transitionsActive = !1;
2845
+ },
2846
+ updateBoundaries: function() {
2847
+ var e = this, t = this.$refs.stretcher, n = this.$refs.cropper;
2848
+ return this.initStretcher({
2849
+ cropper: n,
2850
+ stretcher: t,
2851
+ imageSize: this.imageSize
2852
+ }), this.$nextTick().then((function() {
2853
+ var t = {
2854
+ cropper: n,
2855
+ imageSize: e.imageSize
2856
+ };
2857
+ if (e.boundaries = I(e.defaultBoundaries) ? e.defaultBoundaries(t) : e.defaultBoundaries === "fit" ? function(e) {
2858
+ var t = e.cropper, n = e.imageSize, r = t.clientHeight, i = t.clientWidth, a = r, o = n.width * r / n.height;
2859
+ return o > i && (o = i, a = n.height * i / n.width), {
2860
+ width: o,
2861
+ height: a
2862
+ };
2863
+ }(t) : function(e) {
2864
+ var t = e.cropper;
2865
+ return {
2866
+ width: t.clientWidth,
2867
+ height: t.clientHeight
2868
+ };
2869
+ }(t), !e.boundaries.width || !e.boundaries.height) throw Error("It's impossible to fit the cropper in the current container");
2870
+ }));
2871
+ },
2872
+ resetVisibleArea: function() {
2873
+ var e = this;
2874
+ return this.appliedImageTransforms = C(C({}, this.defaultImageTransforms), {}, { flip: C({}, this.defaultImageTransforms.flip) }), this.updateBoundaries().then((function() {
2875
+ e.priority !== "visible-area" && (e.visibleArea = null, e.resetCoordinates());
2876
+ var t, n, r, i, a, o, s = e.defaultVisibleArea || ot;
2877
+ e.visibleArea = I(s) ? s({
2878
+ imageSize: e.imageSize,
2879
+ boundaries: e.boundaries,
2880
+ coordinates: e.priority === "visible-area" ? null : e.coordinates,
2881
+ getAreaRestrictions: e.getAreaRestrictions,
2882
+ stencilSize: e.getStencilSize()
2883
+ }) : e.defaultVisibleArea, e.visibleArea = (t = {
2884
+ visibleArea: e.visibleArea,
2885
+ boundaries: e.boundaries,
2886
+ getAreaRestrictions: e.getAreaRestrictions
2887
+ }, n = t.visibleArea, r = t.boundaries, i = t.getAreaRestrictions, a = N({}, n), o = q(r), a.width / a.height !== o && (a.height = a.width / o), Z(a, i({
2888
+ visibleArea: a,
2889
+ type: "move"
2890
+ }))), e.priority === "visible-area" ? e.resetCoordinates() : e.coordinates = e.fitCoordinates({
2891
+ visibleArea: e.visibleArea,
2892
+ coordinates: e.coordinates,
2893
+ aspectRatio: e.getAspectRatio(),
2894
+ positionRestrictions: e.positionRestrictions,
2895
+ sizeRestrictions: e.sizeRestrictions
2896
+ }), e.runAutoZoom("resetVisibleArea");
2897
+ })).catch((function() {
2898
+ e.visibleArea = null;
2899
+ }));
2900
+ },
2901
+ updateVisibleArea: function() {
2902
+ var e = this;
2903
+ return this.updateBoundaries().then((function() {
2904
+ e.visibleArea = e.fitVisibleArea({
2905
+ imageSize: e.imageSize,
2906
+ boundaries: e.boundaries,
2907
+ visibleArea: e.visibleArea,
2908
+ coordinates: e.coordinates,
2909
+ getAreaRestrictions: e.getAreaRestrictions
2910
+ }), e.coordinates = e.fitCoordinates({
2911
+ visibleArea: e.visibleArea,
2912
+ coordinates: e.coordinates,
2913
+ aspectRatio: e.getAspectRatio(),
2914
+ positionRestrictions: e.positionRestrictions,
2915
+ sizeRestrictions: e.sizeRestrictions
2916
+ }), e.runAutoZoom("updateVisibleArea");
2917
+ })).catch((function() {
2918
+ e.visibleArea = null;
2919
+ }));
2920
+ },
2921
+ onChange: function() {
2922
+ (!(arguments.length > 0 && arguments[0] !== void 0) || arguments[0]) && this.debounce ? this.debouncedUpdate() : this.update();
2923
+ },
2924
+ onChangeImage: function() {
2925
+ var e, t = this;
2926
+ if (this.imageLoaded = !1, this.delayedTransforms = null, this.src) {
2927
+ if (function(e) {
2928
+ if (be(e)) return !1;
2929
+ var t = window.location, n = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(e) || [], r = {
2930
+ protocol: n[1] || "",
2931
+ host: n[2] || "",
2932
+ port: n[3] || ""
2933
+ }, i = function(e) {
2934
+ return e.port || ((e.protocol || t.protocol) === "http" ? 80 : 433);
2935
+ };
2936
+ return !(!r.protocol && !r.host && !r.port || r.protocol && r.protocol == t.protocol && r.host && r.host == t.host && r.host && i(r) == i(t));
2937
+ }(this.src)) {
2938
+ var n = L(this.crossOrigin) ? this.canvas : this.crossOrigin;
2939
+ !0 === n && (n = "anonymous"), this.imageAttributes.crossOrigin = n || null;
2940
+ }
2941
+ if (this.checkOrientation) {
2942
+ var r = (e = this.src, new Promise((function(t) {
2943
+ Et(e).then((function(n) {
2944
+ var r = Ot(n);
2945
+ t(n ? {
2946
+ source: e,
2947
+ arrayBuffer: n,
2948
+ orientation: r
2949
+ } : {
2950
+ source: e,
2951
+ arrayBuffer: null,
2952
+ orientation: null
2953
+ });
2954
+ })).catch((function(n) {
2955
+ console.warn(n), t({
2956
+ source: e,
2957
+ arrayBuffer: null,
2958
+ orientation: null
2959
+ });
2960
+ }));
2961
+ })));
2962
+ setTimeout((function() {
2963
+ r.then(t.onParseImage);
2964
+ }), this.transitionTime);
2965
+ } else setTimeout((function() {
2966
+ t.onParseImage({ source: t.src });
2967
+ }), this.transitionTime);
2968
+ } else this.clearImage();
2969
+ },
2970
+ onFailLoadImage: function() {
2971
+ this.imageAttributes.src && (this.clearImage(), this.$emit("error"));
2972
+ },
2973
+ onSuccessLoadImage: function() {
2974
+ var e = this, t = this.$refs.image;
2975
+ t && !this.imageLoaded && (this.imageAttributes.height = t.naturalHeight, this.imageAttributes.width = t.naturalWidth, this.imageLoaded = !0, this.resetVisibleArea().then((function() {
2976
+ e.$emit("ready"), e.onChange(!1);
2977
+ })));
2978
+ },
2979
+ onParseImage: function(e) {
2980
+ var t = this, n = e.source, r = e.arrayBuffer, i = e.orientation;
2981
+ this.imageAttributes.revoke && this.imageAttributes.src && URL.revokeObjectURL(this.imageAttributes.src), this.imageAttributes.revoke = !1, r && i && i > 1 ? F(n) || !be(n) ? (this.imageAttributes.src = URL.createObjectURL(new Blob([r])), this.imageAttributes.revoke = !0) : this.imageAttributes.src = function(e) {
2982
+ for (var t = [], n = new Uint8Array(e); n.length > 0;) {
2983
+ var r = n.subarray(0, 8192);
2984
+ t.push(String.fromCharCode.apply(null, Array.from ? Array.from(r) : r.slice())), n = n.subarray(8192);
2985
+ }
2986
+ return "data:image/jpeg;base64," + btoa(t.join(""));
2987
+ }(r) : this.imageAttributes.src = n, this.appliedImageTransforms = I(this.defaultTransforms) ? Tt(this.defaultTransforms()) : R(this.defaultTransforms) ? Tt(this.defaultTransforms) : function(e) {
2988
+ var t = Tt({});
2989
+ if (e) switch (e) {
2990
+ case 2:
2991
+ t.flip.horizontal = !0;
2992
+ break;
2993
+ case 3:
2994
+ t.rotate = -180;
2995
+ break;
2996
+ case 4:
2997
+ t.flip.vertical = !0;
2998
+ break;
2999
+ case 5:
3000
+ t.rotate = 90, t.flip.vertical = !0;
3001
+ break;
3002
+ case 6:
3003
+ t.rotate = 90;
3004
+ break;
3005
+ case 7:
3006
+ t.rotate = 90, t.flip.horizontal = !0;
3007
+ break;
3008
+ case 8: t.rotate = -90;
3009
+ }
3010
+ return t;
3011
+ }(i), this.defaultImageTransforms = C(C({}, this.appliedImageTransforms), {}, { flip: C({}, this.appliedImageTransforms.flip) }), this.$nextTick((function() {
3012
+ var e = t.$refs.image;
3013
+ e && e.complete && (function(e) {
3014
+ return !!e.naturalWidth;
3015
+ }(e) ? t.onSuccessLoadImage() : t.onFailLoadImage());
3016
+ }));
3017
+ },
3018
+ onResizeEnd: function() {
3019
+ this.runAutoZoom("resize", { transitions: !0 });
3020
+ },
3021
+ onMoveEnd: function() {
3022
+ this.runAutoZoom("move", { transitions: !0 });
3023
+ },
3024
+ onMove: function(e) {
3025
+ var t = this;
3026
+ this.transitionsOptions.enabled || this.awaitRender((function() {
3027
+ t.coordinates = t.moveAlgorithm(C(C({}, t.getPublicProperties()), {}, {
3028
+ positionRestrictions: st(t.positionRestrictions, t.visibleArea),
3029
+ coordinates: t.coordinates,
3030
+ event: t.normalizeEvent(e)
3031
+ })), t.onChange();
3032
+ }));
3033
+ },
3034
+ onResize: function(e) {
3035
+ var t = this;
3036
+ this.transitionsOptions.enabled || this.stencilSize && !this.autoZoom || this.awaitRender((function() {
3037
+ var n = t.sizeRestrictions, r = Math.min(t.coordinates.width, t.coordinates.height, 20 * t.coefficient);
3038
+ t.coordinates = t.resizeAlgorithm(C(C({}, t.getPublicProperties()), {}, {
3039
+ positionRestrictions: st(t.positionRestrictions, t.visibleArea),
3040
+ sizeRestrictions: {
3041
+ maxWidth: Math.min(n.maxWidth, t.visibleArea.width),
3042
+ maxHeight: Math.min(n.maxHeight, t.visibleArea.height),
3043
+ minWidth: Math.max(n.minWidth, r),
3044
+ minHeight: Math.max(n.minHeight, r)
3045
+ },
3046
+ event: t.normalizeEvent(e)
3047
+ })), t.onChange(), t.ticking = !1;
3048
+ }));
3049
+ },
3050
+ onManipulateImage: function(e) {
3051
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3052
+ if (!this.transitionsOptions.enabled) {
3053
+ var n = t.transitions, r = n !== void 0 && n, i = t.normalize, a = i === void 0 || i;
3054
+ r && this.enableTransitions();
3055
+ var o = ct(C(C({}, this.getPublicProperties()), {}, {
3056
+ event: a ? this.normalizeEvent(e) : e,
3057
+ getAreaRestrictions: this.getAreaRestrictions,
3058
+ imageRestriction: this.imageRestriction,
3059
+ adjustStencil: !this.stencilSize && this.settings.resizeImage.adjustStencil
3060
+ })), s = o.visibleArea, c = o.coordinates;
3061
+ this.visibleArea = s, this.coordinates = c, this.runAutoZoom("manipulateImage"), this.onChange(), r && this.debouncedDisableTransitions();
3062
+ }
3063
+ },
3064
+ onPropsChange: function() {
3065
+ this.coordinates = this.applyTransform(this.coordinates, !0), this.onChange(!1);
3066
+ },
3067
+ getAreaRestrictions: function() {
3068
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = e.visibleArea, n = e.type, r = n === void 0 ? "move" : n;
3069
+ return this.areaRestrictionsAlgorithm({
3070
+ boundaries: this.boundaries,
3071
+ imageSize: this.imageSize,
3072
+ imageRestriction: this.imageRestriction,
3073
+ visibleArea: t,
3074
+ type: r
3075
+ });
3076
+ },
3077
+ getAspectRatio: function(e) {
3078
+ var t, n, r = this.stencilProps, i = r.aspectRatio, a = r.minAspectRatio, o = r.maxAspectRatio;
3079
+ if (this.$refs.stencil && this.$refs.stencil.aspectRatios) {
3080
+ var s = this.$refs.stencil.aspectRatios();
3081
+ t = s.minimum, n = s.maximum;
3082
+ }
3083
+ if (L(t) && (t = L(i) ? a : i), L(n) && (n = L(i) ? o : i), !e && (L(t) || L(n))) {
3084
+ var c = this.getStencilSize(), l = c ? q(c) : null;
3085
+ L(t) && (t = Ce(l) ? l : void 0), L(n) && (n = Ce(l) ? l : void 0);
3086
+ }
3087
+ return {
3088
+ minimum: t,
3089
+ maximum: n
3090
+ };
3091
+ },
3092
+ getStencilSize: function() {
3093
+ if (this.stencilSize) return e = {
3094
+ currentStencilSize: {
3095
+ width: this.stencilCoordinates.width,
3096
+ height: this.stencilCoordinates.height
3097
+ },
3098
+ stencilSize: this.stencilSize,
3099
+ boundaries: this.boundaries,
3100
+ coefficient: this.coefficient,
3101
+ coordinates: this.coordinates,
3102
+ aspectRatio: this.getAspectRatio(!0)
3103
+ }, t = e.boundaries, n = e.stencilSize, r = e.aspectRatio, He(q(i = I(n) ? n({
3104
+ boundaries: t,
3105
+ aspectRatio: r
3106
+ }) : n), r) && (i = Q({
3107
+ sizeRestrictions: {
3108
+ maxWidth: t.width,
3109
+ maxHeight: t.height,
3110
+ minWidth: 0,
3111
+ minHeight: 0
3112
+ },
3113
+ width: i.width,
3114
+ height: i.height,
3115
+ aspectRatio: {
3116
+ minimum: r.minimum,
3117
+ maximum: r.maximum
3118
+ }
3119
+ })), (i.width > t.width || i.height > t.height) && (i = Q({
3120
+ sizeRestrictions: {
3121
+ maxWidth: t.width,
3122
+ maxHeight: t.height,
3123
+ minWidth: 0,
3124
+ minHeight: 0
3125
+ },
3126
+ width: i.width,
3127
+ height: i.height,
3128
+ aspectRatio: {
3129
+ minimum: q(i),
3130
+ maximum: q(i)
3131
+ }
3132
+ })), i;
3133
+ var e, t, n, r, i;
3134
+ },
3135
+ getPublicProperties: function() {
3136
+ return {
3137
+ coefficient: this.coefficient,
3138
+ visibleArea: this.visibleArea,
3139
+ coordinates: this.coordinates,
3140
+ boundaries: this.boundaries,
3141
+ sizeRestrictions: this.sizeRestrictions,
3142
+ positionRestrictions: this.positionRestrictions,
3143
+ aspectRatio: this.getAspectRatio(),
3144
+ imageRestriction: this.imageRestriction
3145
+ };
3146
+ },
3147
+ defaultCoordinates: function() {
3148
+ return C({}, Re);
3149
+ },
3150
+ flip: function(e, t) {
3151
+ var n = (arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}).transitions, r = n === void 0 || n;
3152
+ if (!this.transitionsActive) {
3153
+ r && this.enableTransitions();
3154
+ var i = C({}, this.imageTransforms.flip), a = ut({
3155
+ flip: {
3156
+ horizontal: e ? !i.horizontal : i.horizontal,
3157
+ vertical: t ? !i.vertical : i.vertical
3158
+ },
3159
+ previousFlip: i,
3160
+ rotate: this.imageTransforms.rotate,
3161
+ visibleArea: this.visibleArea,
3162
+ coordinates: this.coordinates,
3163
+ imageSize: this.imageSize,
3164
+ positionRestrictions: this.positionRestrictions,
3165
+ sizeRestrictions: this.sizeRestrictions,
3166
+ getAreaRestrictions: this.getAreaRestrictions,
3167
+ aspectRatio: this.getAspectRatio()
3168
+ }), o = a.visibleArea, s = a.coordinates;
3169
+ e && (this.appliedImageTransforms.flip.horizontal = !this.appliedImageTransforms.flip.horizontal), t && (this.appliedImageTransforms.flip.vertical = !this.appliedImageTransforms.flip.vertical), this.visibleArea = o, this.coordinates = s, this.onChange(), r && this.debouncedDisableTransitions();
3170
+ }
3171
+ },
3172
+ rotate: function(e) {
3173
+ var t = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}).transitions, n = t === void 0 || t;
3174
+ if (!this.transitionsActive) {
3175
+ n && this.enableTransitions();
3176
+ var r = C({}, this.imageSize);
3177
+ this.appliedImageTransforms.rotate += e;
3178
+ var i = lt({
3179
+ visibleArea: this.visibleArea,
3180
+ coordinates: this.coordinates,
3181
+ previousImageSize: r,
3182
+ imageSize: this.imageSize,
3183
+ angle: e,
3184
+ positionRestrictions: this.positionRestrictions,
3185
+ sizeRestrictions: this.sizeRestrictions,
3186
+ getAreaRestrictions: this.getAreaRestrictions,
3187
+ aspectRatio: this.getAspectRatio()
3188
+ }), a = i.visibleArea, o = i.coordinates, s = this.processAutoZoom("rotateImage", a, o);
3189
+ a = s.visibleArea, o = s.coordinates, this.visibleArea = a, this.coordinates = o, this.onChange(), n && this.debouncedDisableTransitions();
3190
+ }
3191
+ }
3192
+ },
3193
+ emits: [
3194
+ "change",
3195
+ "error",
3196
+ "ready"
3197
+ ]
3198
+ }, zt = {
3199
+ key: 0,
3200
+ ref: "canvas",
3201
+ style: { display: "none" }
3202
+ }, Bt = {
3203
+ key: 1,
3204
+ ref: "sourceCanvas",
3205
+ style: { display: "none" }
3206
+ };
3207
+ Rt.render = function(t, n, r, i, o, s) {
3208
+ return a(), b("div", {
3209
+ ref: "cropper",
3210
+ class: s.classes.cropper
3211
+ }, [l("div", {
3212
+ ref: "stretcher",
3213
+ class: s.classes.stretcher
3214
+ }, null, 2), l("div", {
3215
+ class: s.classes.boundaries,
3216
+ style: s.boundariesStyle
3217
+ }, [(a(), b(S(r.backgroundWrapperComponent), {
3218
+ class: s.classes.cropperWrapper,
3219
+ "wheel-resize": s.settings.resizeImage.wheel,
3220
+ "touch-resize": s.settings.resizeImage.touch,
3221
+ "touch-move": s.settings.moveImage.touch,
3222
+ "mouse-move": s.settings.moveImage.mouse,
3223
+ onMove: s.onManipulateImage,
3224
+ onResize: s.onManipulateImage
3225
+ }, {
3226
+ default: h((function() {
3227
+ return [
3228
+ l("div", {
3229
+ class: s.classes.background,
3230
+ style: s.boundariesStyle
3231
+ }, null, 6),
3232
+ l("div", { class: s.classes.imageWrapper }, [l("img", {
3233
+ ref: "image",
3234
+ crossorigin: o.imageAttributes.crossOrigin,
3235
+ src: o.imageAttributes.src,
3236
+ class: s.classes.image,
3237
+ style: s.imageStyle,
3238
+ onMousedown: n[1] ||= ne((function() {}), ["prevent"])
3239
+ }, null, 46, ["crossorigin", "src"])], 2),
3240
+ l("div", {
3241
+ class: s.classes.foreground,
3242
+ style: s.boundariesStyle
3243
+ }, null, 6),
3244
+ g((a(), b(S(r.stencilComponent), ae({
3245
+ ref: "stencil",
3246
+ image: s.image,
3247
+ coordinates: o.coordinates,
3248
+ "stencil-coordinates": s.stencilCoordinates,
3249
+ transitions: s.transitionsOptions
3250
+ }, r.stencilProps, {
3251
+ onResize: s.onResize,
3252
+ onResizeEnd: s.onResizeEnd,
3253
+ onMove: s.onMove,
3254
+ onMoveEnd: s.onMoveEnd
3255
+ }), null, 16, [
3256
+ "image",
3257
+ "coordinates",
3258
+ "stencil-coordinates",
3259
+ "transitions",
3260
+ "onResize",
3261
+ "onResizeEnd",
3262
+ "onMove",
3263
+ "onMoveEnd"
3264
+ ])), [[f, o.imageLoaded]]),
3265
+ r.canvas ? (a(), b("canvas", zt, null, 512)) : e("", !0),
3266
+ r.canvas ? (a(), b("canvas", Bt, null, 512)) : e("", !0)
3267
+ ];
3268
+ })),
3269
+ _: 1
3270
+ }, 8, [
3271
+ "class",
3272
+ "wheel-resize",
3273
+ "touch-resize",
3274
+ "touch-move",
3275
+ "mouse-move",
3276
+ "onMove",
3277
+ "onResize"
3278
+ ]))], 6)], 2);
3279
+ };
3280
+ //#endregion
3281
+ //#region src/components/media/MediaEditModal.vue?vue&type=script&setup=true&lang.ts
3282
+ var Vt = ["data-tpl-theme"], Ht = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ut = {
3283
+ id: "tpl-media-edit-title",
3284
+ class: "tpl:text-sm tpl:font-semibold",
3285
+ style: { color: "var(--tpl-text)" }
3286
+ }, Wt = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto tpl:px-5" }, Gt = {
3287
+ key: 0,
3288
+ class: "tpl:mb-4"
3289
+ }, Kt = {
3290
+ class: "tpl:relative tpl:mb-3 tpl:overflow-hidden tpl:rounded-md tpl:border",
3291
+ style: {
3292
+ "border-color": "var(--tpl-border)",
3293
+ height: "300px",
3294
+ "background-color": "var(--tpl-bg)"
3295
+ }
3296
+ }, qt = { class: "tpl:space-y-3" }, Jt = {
3297
+ class: "tpl:mb-1.5 tpl:block tpl:text-xs tpl:font-medium",
3298
+ style: { color: "var(--tpl-text-muted)" }
3299
+ }, Yt = { class: "tpl:flex tpl:flex-wrap tpl:gap-1.5" }, Xt = ["onClick"], Zt = { class: "tpl:flex tpl:gap-3" }, Qt = { class: "tpl:flex-1" }, $t = {
3300
+ class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
3301
+ style: { color: "var(--tpl-text-muted)" }
3302
+ }, en = {
3303
+ class: "tpl:font-normal",
3304
+ style: { color: "var(--tpl-text-dim)" }
3305
+ }, tn = { class: "tpl:relative" }, nn = ["value", "placeholder"], rn = {
3306
+ class: "tpl:absolute tpl:top-1/2 tpl:right-2.5 tpl:-translate-y-1/2 tpl:text-xs",
3307
+ style: { color: "var(--tpl-text-dim)" }
3308
+ }, an = { class: "tpl:flex-1" }, on = {
3309
+ class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
3310
+ style: { color: "var(--tpl-text-muted)" }
3311
+ }, sn = {
3312
+ class: "tpl:font-normal",
3313
+ style: { color: "var(--tpl-text-dim)" }
3314
+ }, cn = { class: "tpl:relative" }, ln = ["value", "placeholder"], un = {
3315
+ class: "tpl:absolute tpl:top-1/2 tpl:right-2.5 tpl:-translate-y-1/2 tpl:text-xs",
3316
+ style: { color: "var(--tpl-text-dim)" }
3317
+ }, dn = {
3318
+ key: 0,
3319
+ class: "tpl:flex tpl:items-center tpl:gap-1 tpl:text-xs",
3320
+ style: { color: "var(--tpl-text-muted)" }
3321
+ }, fn = {
3322
+ class: "tpl:font-medium",
3323
+ style: { color: "var(--tpl-text)" }
3324
+ }, pn = { class: "tpl:mb-3" }, mn = {
3325
+ for: "tpl-media-filename",
3326
+ class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
3327
+ style: { color: "var(--tpl-text-muted)" }
3328
+ }, hn = ["autofocus"], gn = {
3329
+ key: 1,
3330
+ class: "tpl:mb-4"
3331
+ }, _n = {
3332
+ for: "tpl-media-alt",
3333
+ class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
3334
+ style: { color: "var(--tpl-text-muted)" }
3335
+ }, vn = ["placeholder"], yn = { class: "tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2 tpl:p-5 tpl:pt-4" }, bn = ["disabled"], xn = /*#__PURE__*/ le(/* @__PURE__ */ r({
3336
+ __name: "MediaEditModal",
3337
+ props: {
3338
+ visible: { type: Boolean },
3339
+ item: {}
3340
+ },
3341
+ emits: ["save", "close"],
3342
+ setup(r, { emit: i }) {
3343
+ let s = r, f = i, { t: S } = de(), ae = d(se, null), le = d(oe, x(null)), _e = S.mediaLibrary, { isImageMimeType: C } = ce(), w = x(""), T = x(""), E = x(null), D = x("free"), ve = x(void 0), ye = x(void 0), O = x(""), k = x(""), A = x(void 0), j = x(null), M = x(!1), N = x(!1), P = x(!1), F = t(() => s.item ? [
3344
+ "image/jpeg",
3345
+ "image/png",
3346
+ "image/webp",
3347
+ "image/gif"
3348
+ ].includes(s.item.mimeType ?? "") : !1), be = t(() => D.value === "original" ? A.value : fe[D.value]), I = t(() => j.value ? ge(j.value.width, j.value.height, ve.value, ye.value) : null);
3349
+ o(() => s.visible, (e) => {
3350
+ e && s.item && (w.value = s.item.filename ?? "", T.value = s.item.alt ?? "", D.value = "free", ve.value = void 0, ye.value = void 0, O.value = "", k.value = "", A.value = void 0, j.value = null, M.value = !1, P.value = !1, s.item.width && s.item.height && (A.value = s.item.width / s.item.height));
3351
+ });
3352
+ function L(e) {
3353
+ e.coordinates && (j.value = {
3354
+ width: Math.round(e.coordinates.width),
3355
+ height: Math.round(e.coordinates.height)
3356
+ }, P.value = !0);
3357
+ }
3358
+ function R() {
3359
+ M.value = !0, !A.value && s.item?.width && s.item?.height && (A.value = s.item.width / s.item.height);
3360
+ }
3361
+ function xe(e) {
3362
+ let t = e.target.value;
3363
+ O.value = t, ve.value = t && parseInt(t, 10) || void 0;
3364
+ }
3365
+ function Se(e) {
3366
+ let t = e.target.value;
3367
+ k.value = t, ye.value = t && parseInt(t, 10) || void 0;
3368
+ }
3369
+ async function Ce() {
3370
+ let e = w.value.trim();
3371
+ if (!e || !s.item || N.value) return;
3372
+ let t = C(s.item.mimeType ?? ""), n;
3373
+ if (F.value && E.value && P.value) {
3374
+ N.value = !0;
3375
+ try {
3376
+ let { canvas: e } = E.value.getResult();
3377
+ if (e) {
3378
+ let t = me(e, ve.value, ye.value), r = pe(s.item.mimeType ?? "");
3379
+ n = { file: await he(t, s.item.filename ?? "image", r) };
3380
+ }
3381
+ } catch {
3382
+ N.value = !1;
3383
+ return;
3384
+ }
3385
+ N.value = !1;
3386
+ }
3387
+ f("save", s.item.id, e, t ? T.value : void 0, n), f("close");
3388
+ }
3389
+ let we = x(null), Te = t(() => s.visible && s.item !== null);
3390
+ ue(we, Te);
3391
+ function z(e) {
3392
+ if (e.stopPropagation(), e.key === "Enter" && !N.value) {
3393
+ if (e.target?.closest("textarea, [contenteditable]")) return;
3394
+ e.preventDefault(), Ce();
3395
+ }
3396
+ e.key === "Escape" && f("close");
3397
+ }
3398
+ return (t, i) => (a(), b(n, { to: _(le) || "body" }, [l(ie, {
3399
+ "enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
3400
+ "enter-from-class": "tpl:opacity-0",
3401
+ "enter-to-class": "tpl:opacity-100",
3402
+ "leave-active-class": "tpl:transition tpl:ease-in tpl:duration-100",
3403
+ "leave-from-class": "tpl:opacity-100",
3404
+ "leave-to-class": "tpl:opacity-0"
3405
+ }, {
3406
+ default: h(() => [r.visible && r.item ? (a(), y("div", {
3407
+ key: 0,
3408
+ "data-tpl-theme": _(ae),
3409
+ class: ee([_(le) ? void 0 : "tpl", "tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4"]),
3410
+ style: { "background-color": "var(--tpl-overlay)" },
3411
+ onClick: i[3] ||= ne((e) => f("close"), ["self"]),
3412
+ onKeydown: z
3413
+ }, [u("div", {
3414
+ ref_key: "dialogRef",
3415
+ ref: we,
3416
+ role: "dialog",
3417
+ "aria-modal": "true",
3418
+ "aria-labelledby": "tpl-media-edit-title",
3419
+ class: ee(["tpl:flex tpl:max-h-[90%] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", F.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
3420
+ style: { "background-color": "var(--tpl-bg-elevated)" }
3421
+ }, [
3422
+ u("div", Ht, [u("h3", Ut, v(_(S).mediaLibrary.editFile), 1)]),
3423
+ u("div", Wt, [
3424
+ F.value ? (a(), y("div", Gt, [u("div", Kt, [l(_(Rt), {
3425
+ ref_key: "cropperRef",
3426
+ ref: E,
3427
+ src: r.item.url,
3428
+ "stencil-props": { aspectRatio: be.value },
3429
+ class: "tpl:h-full tpl:w-full",
3430
+ "background-class": "tpl-cropper-background",
3431
+ onChange: L,
3432
+ onReady: R
3433
+ }, null, 8, ["src", "stencil-props"])]), u("div", qt, [
3434
+ u("div", null, [u("label", Jt, v(_(S).mediaLibrary.cropAspectRatio), 1), u("div", Yt, [(a(), y(p, null, m([
3435
+ "free",
3436
+ "square",
3437
+ "landscape43",
3438
+ "landscape169",
3439
+ "original"
3440
+ ], (e) => u("button", {
3441
+ key: e,
3442
+ type: "button",
3443
+ class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
3444
+ style: te({
3445
+ borderColor: D.value === e ? "var(--tpl-primary)" : "var(--tpl-border)",
3446
+ backgroundColor: D.value === e ? "var(--tpl-primary-light)" : "var(--tpl-bg)",
3447
+ color: D.value === e ? "var(--tpl-primary)" : "var(--tpl-text)"
3448
+ }),
3449
+ onClick: (t) => D.value = e
3450
+ }, v(_(_e)[`crop${e.charAt(0).toUpperCase()}${e.slice(1)}`]), 13, Xt)), 64))])]),
3451
+ u("div", Zt, [u("div", Qt, [u("label", $t, [c(v(_(S).mediaLibrary.cropMaxWidth) + " ", 1), u("span", en, v(_(S).mediaLibrary.cropOptional), 1)]), u("div", tn, [u("input", {
3452
+ value: O.value,
3453
+ type: "number",
3454
+ min: "1",
3455
+ class: "tpl:w-full tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-8 tpl:pl-3 tpl:text-xs tpl:outline-none",
3456
+ style: {
3457
+ "border-color": "var(--tpl-border)",
3458
+ "background-color": "var(--tpl-bg)",
3459
+ color: "var(--tpl-text)"
3460
+ },
3461
+ placeholder: j.value?.width?.toString() || "",
3462
+ onInput: xe
3463
+ }, null, 40, nn), u("span", rn, v(_(S).mediaLibrary.cropPixels), 1)])]), u("div", an, [u("label", on, [c(v(_(S).mediaLibrary.cropMaxHeight) + " ", 1), u("span", sn, v(_(S).mediaLibrary.cropOptional), 1)]), u("div", cn, [u("input", {
3464
+ value: k.value,
3465
+ type: "number",
3466
+ min: "1",
3467
+ class: "tpl:w-full tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-8 tpl:pl-3 tpl:text-xs tpl:outline-none",
3468
+ style: {
3469
+ "border-color": "var(--tpl-border)",
3470
+ "background-color": "var(--tpl-bg)",
3471
+ color: "var(--tpl-text)"
3472
+ },
3473
+ placeholder: j.value?.height?.toString() || "",
3474
+ onInput: Se
3475
+ }, null, 40, ln), u("span", un, v(_(S).mediaLibrary.cropPixels), 1)])])]),
3476
+ I.value ? (a(), y("div", dn, [u("span", null, v(_(S).mediaLibrary.cropOutputSize) + ": ", 1), u("span", fn, v(I.value.width) + " x " + v(I.value.height) + " " + v(_(S).mediaLibrary.cropPixels), 1)])) : e("", !0)
3477
+ ])])) : e("", !0),
3478
+ u("div", pn, [u("label", mn, v(_(S).mediaLibrary.fileName), 1), g(u("input", {
3479
+ id: "tpl-media-filename",
3480
+ "onUpdate:modelValue": i[0] ||= (e) => w.value = e,
3481
+ type: "text",
3482
+ class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
3483
+ style: {
3484
+ "border-color": "var(--tpl-border)",
3485
+ "background-color": "var(--tpl-bg)",
3486
+ color: "var(--tpl-text)"
3487
+ },
3488
+ autofocus: !F.value
3489
+ }, null, 8, hn), [[re, w.value]])]),
3490
+ _(C)(r.item.mimeType ?? "") ? (a(), y("div", gn, [u("label", _n, v(_(S).mediaLibrary.altText), 1), g(u("input", {
3491
+ id: "tpl-media-alt",
3492
+ "onUpdate:modelValue": i[1] ||= (e) => T.value = e,
3493
+ type: "text",
3494
+ class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
3495
+ style: {
3496
+ "border-color": "var(--tpl-border)",
3497
+ "background-color": "var(--tpl-bg)",
3498
+ color: "var(--tpl-text)"
3499
+ },
3500
+ placeholder: _(S).mediaLibrary.altTextPlaceholder
3501
+ }, null, 8, vn), [[re, T.value]])])) : e("", !0)
3502
+ ]),
3503
+ u("div", yn, [u("button", {
3504
+ class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
3505
+ style: {
3506
+ "border-color": "var(--tpl-border)",
3507
+ color: "var(--tpl-text)",
3508
+ "background-color": "var(--tpl-bg)"
3509
+ },
3510
+ onClick: i[2] ||= (e) => f("close")
3511
+ }, v(_(S).mediaLibrary.cancel), 1), u("button", {
3512
+ class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150 tpl:hover:bg-[var(--tpl-primary-hover)] tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
3513
+ style: {
3514
+ "background-color": "var(--tpl-primary)",
3515
+ color: "var(--tpl-on-primary)"
3516
+ },
3517
+ disabled: N.value,
3518
+ onClick: Ce
3519
+ }, v(N.value ? _(S).mediaLibrary.saving : _(S).mediaLibrary.saveChanges), 9, bn)])
3520
+ ], 2)], 42, Vt)) : e("", !0)]),
3521
+ _: 1
3522
+ })], 8, ["to"]));
3523
+ }
3524
+ }), [["__scopeId", "data-v-6bdfafa4"]]);
3525
+ //#endregion
3526
+ export { xn as default };
3527
+
3528
+ //# sourceMappingURL=MediaEditModal-CeKcr-C0.js.map