@orchidui/core 1.39.0 → 1.41.0
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.
- package/dist/DataDisplay/CustomerCard/OcCustomerCard.js +1 -1
- package/dist/DataDisplay/FloatContent/OcFloatContent.js +1 -1
- package/dist/DataDisplay/InfoCard/OcInfoCard.js +1 -1
- package/dist/DataDisplay/ListDetail/OcListDetail.js +1 -1
- package/dist/DataDisplay/ListItem/OcListItem.js +1 -1
- package/dist/DataDisplay/NewTable/OcNewTable.js +1 -1
- package/dist/DataDisplay/OnboardingListItem/OcOnboardingListItem.js +1 -1
- package/dist/DataDisplay/Overview/OcOverview.js +1 -1
- package/dist/DataDisplay/Pagination/OcPagination.js +1 -1
- package/dist/DataDisplay/Table/OcTable.js +1 -1
- package/dist/DataDisplay/TransferSummary/OcTransferSummary.js +1 -1
- package/dist/DataTable/utils/filterUtils.js +16 -16
- package/dist/Disclosure/Accordion/OcAccordion.js +1 -1
- package/dist/Disclosure/OnboardingAccordion/OnboardingAccordion.js +1 -1
- package/dist/Disclosure/Steps/OcSteps.js +1 -1
- package/dist/Disclosure/Tabs/Tabs.js +1 -1
- package/dist/Disclosure/Variants/OcVariants.js +1 -1
- package/dist/Elements/AdditionalContent/OcAdditionalContent.js +1 -1
- package/dist/Elements/AuthenticationOption/AuthenticationOption.js +1 -1
- package/dist/Elements/Box/OcBox.js +1 -1
- package/dist/Elements/EmptyPage/OcEmptyPage.js +1 -1
- package/dist/Elements/FeatureOverviewCard/OcFeatureOverviewCard.js +1 -1
- package/dist/Elements/Header/OcHeader.js +1 -1
- package/dist/Elements/PageTitle/OcPageTitle.js +1 -1
- package/dist/Elements/SandboxBanner/OcSandboxBanner.js +1 -1
- package/dist/Elements/Sidebar/OcSidebar.js +2 -2
- package/dist/Elements/SubSidebar/OcSubSidebar.js +1 -1
- package/dist/Elements/TopBanner/OcTopBanner.js +1 -1
- package/dist/Elements/VerificationOption/OcVerificationOption.js +1 -1
- package/dist/Feedback/Banner/OcBanner.js +1 -1
- package/dist/Feedback/Chip/OcChip.js +1 -1
- package/dist/Feedback/ShareIcon/OcShareIcon.js +1 -1
- package/dist/Feedback/Snackbar/OcSnackbar.js +1 -1
- package/dist/Form/BaseInput/OcBaseInput.js +1 -1
- package/dist/Form/Button/OcButton.js +1 -1
- package/dist/Form/Calendar/OcCalendar.js +2 -2
- package/dist/Form/CardInput/OcCardInput.js +1 -1
- package/dist/Form/Checkbox/OcCheckbox.js +1 -1
- package/dist/Form/CheckboxesGroup/OcCheckboxesGroup.js +1 -1
- package/dist/Form/Criteria/OcCriteria.js +1 -1
- package/dist/Form/Cropper/OcCropper.js +1 -1
- package/dist/Form/DatePicker/OcDatePicker.js +1 -1
- package/dist/Form/EmojiPicker/OcEmojiPicker.js +1 -1
- package/dist/Form/Input/OcInput.js +1 -1
- package/dist/Form/LinkInput/OcLinkInput.js +1 -1
- package/dist/Form/MultipleUploadFile/OcMultipleUploadFile.js +1 -1
- package/dist/Form/NumberInput/OcNumberInput.js +1 -1
- package/dist/Form/PhoneInput/OcPhoneInput.js +1 -1
- package/dist/Form/Radio/OcRadio.js +1 -1
- package/dist/Form/RadioGroup/OcRadioGroup.js +1 -1
- package/dist/Form/RangeInput/OcRangeInput.js +1 -1
- package/dist/Form/SectionItem/OcSectionItem.js +1 -1
- package/dist/Form/Select/OcSelect.js +1 -1
- package/dist/Form/SelectOptions/OcSelectOptions.js +1 -1
- package/dist/Form/SingleFileUpload/OcSingleFileUpload.js +1 -1
- package/dist/Form/Slider/OcSlider.js +1 -1
- package/dist/Form/TextArea/OcTextArea.js +1 -1
- package/dist/Form/index.js +1 -1
- package/dist/FormBuilder/OcFormBuilder.js +1 -1
- package/dist/{OcAccountSetupProgress-CAsTFLzD.js → OcAccountSetupProgress-BGk3Vvbq.js} +1 -1
- package/dist/OcComplexCalendar-CQ1P3lYK.js +5863 -0
- package/dist/{OcComplexDatePicker-CST3cyMh.js → OcComplexDatePicker-m_8Uf5Of.js} +2 -2
- package/dist/OcCropper-Bu91R5Et.js +1644 -0
- package/dist/{OcDataTable-D1Lmh1Lj.js → OcDataTable-Biq6U1Dl.js} +3 -3
- package/dist/{OcDraggable-DRsp4j4e.js → OcDraggable-C-RjArcr.js} +7 -7
- package/dist/{OcDraggableList-CwGfz1m1.js → OcDraggableList-lr-sYgCF.js} +1 -1
- package/dist/{OcEmojiPicker-B5v0dgDQ.js → OcEmojiPicker-oCBcfwyU.js} +1 -1
- package/dist/{OcFilterForm-BfRaaBNx.js → OcFilterForm-CfX0YXPm.js} +1 -1
- package/dist/{OcFilterSearch-eV23JjoR.js → OcFilterSearch-DK-0OYgr.js} +1 -1
- package/dist/{OcFilterSearchFor-FKrmN6gd.js → OcFilterSearchFor-uDEPTHYM.js} +1 -1
- package/dist/{OcModalCropper-BG0rGXgt.js → OcModalCropper-kYvlF6dF.js} +2 -2
- package/dist/OcPopper-DAh56I2b.js +1002 -0
- package/dist/{OcTimePicker-C_OHCpVq.js → OcTimePicker-X6dFf9sD.js} +10 -10
- package/dist/Overlay/ConfirmationModal/OcConfirmationModal.js +1 -1
- package/dist/Overlay/CopyTooltip/OcCopyTooltip.js +1 -1
- package/dist/Overlay/Dropdown/OcDropdown.js +1 -1
- package/dist/Overlay/Modal/OcModal.js +1 -1
- package/dist/Overlay/Popper/OcPopper.js +1 -1
- package/dist/Overlay/SupportMenu/OcSupportMenu.js +1 -1
- package/dist/Overlay/Tooltip/OcTooltip.js +1 -1
- package/dist/Overlay/Whitelist/OcWhiteList.js +1 -1
- package/dist/{SubPlanCard-DKX_tiqc.js → SubPlanCard-CbbBLUQE.js} +1 -1
- package/dist/{ThumbnailSection-B7Vmk_YO.js → ThumbnailSection-Bm1GLPM1.js} +1 -1
- package/dist/{ThumbnailTheme-B645KTkE.js → ThumbnailTheme-DJE4H-1K.js} +1 -1
- package/dist/core.css +1 -1
- package/dist/dayjs.min-7xVZzECu.js +287 -0
- package/dist/index-DRTRbrS-.js +12893 -0
- package/dist/index.js +2 -2
- package/dist/vue-draggable-next.esm-bundler-QQ8zx__3.js +1559 -0
- package/package.json +12 -1
- package/dist/OcComplexCalendar-BKht-iKa.js +0 -101
- package/dist/OcCropper-DMvRM32l.js +0 -270
- package/dist/OcPopper-BSfMaOoF.js +0 -101
- package/dist/index-Bl4-MlMa.js +0 -11301
|
@@ -0,0 +1,1644 @@
|
|
|
1
|
+
import { createBlock as z, openBlock as g, renderSlot as K, resolveComponent as V, createVNode as x, withCtx as B, Fragment as Mt, renderList as Yt, resolveDynamicComponent as mt, withDirectives as ie, vShow as ne, mergeProps as oe, createCommentVNode as L, withModifiers as Re, ref as X, computed as Ae, watch as Ft, nextTick as xe, createElementBlock as nt, createElementVNode as G, unref as W } from "vue";
|
|
2
|
+
import { B as ot, d as vt, C as bt, h as Me, aF as Se } from "./index-DRTRbrS-.js";
|
|
3
|
+
import { _ as Vt } from "./OcIcon-BedshzZm.js";
|
|
4
|
+
function Nt(t, e) {
|
|
5
|
+
var i = Object.keys(t);
|
|
6
|
+
if (Object.getOwnPropertySymbols) {
|
|
7
|
+
var o = Object.getOwnPropertySymbols(t);
|
|
8
|
+
e && (o = o.filter((function(s) {
|
|
9
|
+
return Object.getOwnPropertyDescriptor(t, s).enumerable;
|
|
10
|
+
}))), i.push.apply(i, o);
|
|
11
|
+
}
|
|
12
|
+
return i;
|
|
13
|
+
}
|
|
14
|
+
function w(t) {
|
|
15
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
16
|
+
var i = arguments[e] != null ? arguments[e] : {};
|
|
17
|
+
e % 2 ? Nt(Object(i), !0).forEach((function(o) {
|
|
18
|
+
H(t, o, i[o]);
|
|
19
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : Nt(Object(i)).forEach((function(o) {
|
|
20
|
+
Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(i, o));
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
function H(t, e, i) {
|
|
26
|
+
return e in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
|
|
27
|
+
}
|
|
28
|
+
function Ee(t, e) {
|
|
29
|
+
if (t == null) return {};
|
|
30
|
+
var i, o, s = (function(a, h) {
|
|
31
|
+
if (a == null) return {};
|
|
32
|
+
var r, l, c = {}, u = Object.keys(a);
|
|
33
|
+
for (l = 0; l < u.length; l++) r = u[l], h.indexOf(r) >= 0 || (c[r] = a[r]);
|
|
34
|
+
return c;
|
|
35
|
+
})(t, e);
|
|
36
|
+
if (Object.getOwnPropertySymbols) {
|
|
37
|
+
var n = Object.getOwnPropertySymbols(t);
|
|
38
|
+
for (o = 0; o < n.length; o++) i = n[o], e.indexOf(i) >= 0 || Object.prototype.propertyIsEnumerable.call(t, i) && (s[i] = t[i]);
|
|
39
|
+
}
|
|
40
|
+
return s;
|
|
41
|
+
}
|
|
42
|
+
function Q(t) {
|
|
43
|
+
return (function(e) {
|
|
44
|
+
if (Array.isArray(e)) return wt(e);
|
|
45
|
+
})(t) || (function(e) {
|
|
46
|
+
if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null) return Array.from(e);
|
|
47
|
+
})(t) || (function(e, i) {
|
|
48
|
+
if (e) {
|
|
49
|
+
if (typeof e == "string") return wt(e, i);
|
|
50
|
+
var o = Object.prototype.toString.call(e).slice(8, -1);
|
|
51
|
+
if (o === "Object" && e.constructor && (o = e.constructor.name), o === "Map" || o === "Set") return Array.from(e);
|
|
52
|
+
if (o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) return wt(e, i);
|
|
53
|
+
}
|
|
54
|
+
})(t) || (function() {
|
|
55
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
56
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
57
|
+
})();
|
|
58
|
+
}
|
|
59
|
+
function wt(t, e) {
|
|
60
|
+
(e == null || e > t.length) && (e = t.length);
|
|
61
|
+
for (var i = 0, o = new Array(e); i < e; i++) o[i] = t[i];
|
|
62
|
+
return o;
|
|
63
|
+
}
|
|
64
|
+
var qt, Ce, at, M = (qt = function(t) {
|
|
65
|
+
/*!
|
|
66
|
+
Copyright (c) 2018 Jed Watson.
|
|
67
|
+
Licensed under the MIT License (MIT), see
|
|
68
|
+
http://jedwatson.github.io/classnames
|
|
69
|
+
*/
|
|
70
|
+
(function() {
|
|
71
|
+
var e = {}.hasOwnProperty;
|
|
72
|
+
function i() {
|
|
73
|
+
for (var o = [], s = 0; s < arguments.length; s++) {
|
|
74
|
+
var n = arguments[s];
|
|
75
|
+
if (n) {
|
|
76
|
+
var a = typeof n;
|
|
77
|
+
if (a === "string" || a === "number") o.push(n);
|
|
78
|
+
else if (Array.isArray(n)) {
|
|
79
|
+
if (n.length) {
|
|
80
|
+
var h = i.apply(null, n);
|
|
81
|
+
h && o.push(h);
|
|
82
|
+
}
|
|
83
|
+
} else if (a === "object") if (n.toString === Object.prototype.toString) for (var r in n) e.call(n, r) && n[r] && o.push(r);
|
|
84
|
+
else o.push(n.toString());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return o.join(" ");
|
|
88
|
+
}
|
|
89
|
+
t.exports ? (i.default = i, t.exports = i) : window.classNames = i;
|
|
90
|
+
})();
|
|
91
|
+
}, qt(at = { path: Ce, exports: {}, require: function(t, e) {
|
|
92
|
+
return (function() {
|
|
93
|
+
throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
|
|
94
|
+
})(e == null && at.path);
|
|
95
|
+
} }, at.exports), at.exports), $ = function(t) {
|
|
96
|
+
return function(e, i) {
|
|
97
|
+
if (!e) return t;
|
|
98
|
+
var o;
|
|
99
|
+
typeof e == "string" ? o = e : i = e;
|
|
100
|
+
var s = t;
|
|
101
|
+
return o && (s += "__" + o), s + (i ? Object.keys(i).reduce((function(n, a) {
|
|
102
|
+
var h = i[a];
|
|
103
|
+
return h && (n += " " + (typeof h == "boolean" ? s + "--" + a : s + "--" + a + "_" + h)), n;
|
|
104
|
+
}), "") : "");
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
function St(t, e, i) {
|
|
108
|
+
var o, s, n, a, h;
|
|
109
|
+
function r() {
|
|
110
|
+
var c = Date.now() - a;
|
|
111
|
+
c < e && c >= 0 ? o = setTimeout(r, e - c) : (o = null, i || (h = t.apply(n, s), n = s = null));
|
|
112
|
+
}
|
|
113
|
+
e == null && (e = 100);
|
|
114
|
+
var l = function() {
|
|
115
|
+
n = this, s = arguments, a = Date.now();
|
|
116
|
+
var c = i && !o;
|
|
117
|
+
return o || (o = setTimeout(r, e)), c && (h = t.apply(n, s), n = s = null), h;
|
|
118
|
+
};
|
|
119
|
+
return l.clear = function() {
|
|
120
|
+
o && (clearTimeout(o), o = null);
|
|
121
|
+
}, l.flush = function() {
|
|
122
|
+
o && (h = t.apply(n, s), n = s = null, clearTimeout(o), o = null);
|
|
123
|
+
}, l;
|
|
124
|
+
}
|
|
125
|
+
St.debounce = St;
|
|
126
|
+
var Et = St, f = function() {
|
|
127
|
+
return f = Object.assign || function(t) {
|
|
128
|
+
for (var e, i = 1, o = arguments.length; i < o; i++) for (var s in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
|
|
129
|
+
return t;
|
|
130
|
+
}, f.apply(this, arguments);
|
|
131
|
+
};
|
|
132
|
+
/*! *****************************************************************************
|
|
133
|
+
Copyright (c) Microsoft Corporation.
|
|
134
|
+
|
|
135
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
136
|
+
purpose with or without fee is hereby granted.
|
|
137
|
+
|
|
138
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
139
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
140
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
141
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
142
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
143
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
144
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
145
|
+
***************************************************************************** */
|
|
146
|
+
function se(t, e) {
|
|
147
|
+
var i, o;
|
|
148
|
+
return t && e ? (i = "" + t + e[0].toUpperCase() + e.slice(1), o = t + "-" + e) : (i = t || e, o = t || e), { name: i, classname: o };
|
|
149
|
+
}
|
|
150
|
+
function re(t) {
|
|
151
|
+
return /^blob:/.test(t);
|
|
152
|
+
}
|
|
153
|
+
function Zt(t) {
|
|
154
|
+
return re(t) || (function(e) {
|
|
155
|
+
return /^data:/.test(e);
|
|
156
|
+
})(t);
|
|
157
|
+
}
|
|
158
|
+
function _(t) {
|
|
159
|
+
return !!(t && t.constructor && t.call && t.apply);
|
|
160
|
+
}
|
|
161
|
+
function S(t) {
|
|
162
|
+
return t === void 0;
|
|
163
|
+
}
|
|
164
|
+
function dt(t) {
|
|
165
|
+
return typeof t == "object" && t !== null;
|
|
166
|
+
}
|
|
167
|
+
function Ct(t, e, i) {
|
|
168
|
+
var o = {};
|
|
169
|
+
return dt(t) ? (Object.keys(e).forEach((function(s) {
|
|
170
|
+
S(t[s]) ? o[s] = e[s] : dt(e[s]) ? dt(t[s]) ? o[s] = Ct(t[s], e[s], i[s]) : o[s] = t[s] ? e[s] : i[s] : e[s] === !0 || e[s] === !1 ? o[s] = !!t[s] : o[s] = t[s];
|
|
171
|
+
})), o) : t ? e : i;
|
|
172
|
+
}
|
|
173
|
+
function ht(t) {
|
|
174
|
+
var e = Number(t);
|
|
175
|
+
return Number.isNaN(e) ? t : e;
|
|
176
|
+
}
|
|
177
|
+
function Gt(t) {
|
|
178
|
+
return typeof (t == "number" || /* @__PURE__ */ (function(e) {
|
|
179
|
+
return typeof e == "object" && e !== null;
|
|
180
|
+
})(t) && toString.call(t) == "[object Number]") && !ae(t);
|
|
181
|
+
}
|
|
182
|
+
function ae(t) {
|
|
183
|
+
return t != t;
|
|
184
|
+
}
|
|
185
|
+
function he(t, e) {
|
|
186
|
+
return Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2));
|
|
187
|
+
}
|
|
188
|
+
var st = function(t, e) {
|
|
189
|
+
t === void 0 && (t = {}), e === void 0 && (e = {}), this.type = "manipulateImage", this.move = t, this.scale = e;
|
|
190
|
+
}, Te = function(t, e) {
|
|
191
|
+
e === void 0 && (e = {}), this.type = "resize", this.directions = t, this.params = e;
|
|
192
|
+
}, Dt = function(t) {
|
|
193
|
+
this.type = "move", this.directions = t;
|
|
194
|
+
}, We = (function() {
|
|
195
|
+
function t(e, i, o, s, n) {
|
|
196
|
+
this.type = "drag", this.nativeEvent = e, this.position = o, this.previousPosition = s, this.element = i, this.anchor = n;
|
|
197
|
+
}
|
|
198
|
+
return t.prototype.shift = function() {
|
|
199
|
+
var e = this, i = e.element, o = e.anchor, s = e.position;
|
|
200
|
+
if (i) {
|
|
201
|
+
var n = i.getBoundingClientRect(), a = n.left, h = n.top;
|
|
202
|
+
return { left: s.left - a - o.left, top: s.top - h - o.top };
|
|
203
|
+
}
|
|
204
|
+
return { left: 0, top: 0 };
|
|
205
|
+
}, t;
|
|
206
|
+
})(), Lt = { name: "DraggableElement", props: { classname: { type: String } }, beforeMount: function() {
|
|
207
|
+
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 });
|
|
208
|
+
}, beforeUnmount: function() {
|
|
209
|
+
window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
|
|
210
|
+
}, mounted: function() {
|
|
211
|
+
if (!this.$refs.draggable) throw new Error('You should add ref "draggable" to your root element to use draggable mixin');
|
|
212
|
+
this.touches = [], this.hovered = !1;
|
|
213
|
+
}, methods: { onMouseOver: function() {
|
|
214
|
+
this.hovered || (this.hovered = !0, this.$emit("enter"));
|
|
215
|
+
}, onMouseLeave: function() {
|
|
216
|
+
this.hovered && !this.touches.length && (this.hovered = !1, this.$emit("leave"));
|
|
217
|
+
}, onTouchStart: function(t) {
|
|
218
|
+
t.cancelable && !this.disabled && t.touches.length === 1 && (this.touches = Q(t.touches), this.hovered || (this.$emit("enter"), this.hovered = !0), t.touches.length && this.initAnchor(this.touches.reduce((function(e, i) {
|
|
219
|
+
return { clientX: e.clientX + i.clientX / t.touches.length, clientY: e.clientY + i.clientY / t.touches.length };
|
|
220
|
+
}), { clientX: 0, clientY: 0 })), t.preventDefault && t.preventDefault(), t.stopPropagation());
|
|
221
|
+
}, onTouchEnd: function() {
|
|
222
|
+
this.processEnd();
|
|
223
|
+
}, onTouchMove: function(t) {
|
|
224
|
+
this.touches.length && (this.processMove(t, t.touches), t.preventDefault && t.preventDefault(), t.stopPropagation && t.stopPropagation());
|
|
225
|
+
}, onMouseDown: function(t) {
|
|
226
|
+
if (!this.disabled) {
|
|
227
|
+
var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
|
|
228
|
+
this.touches = [e], this.initAnchor(e), t.stopPropagation();
|
|
229
|
+
}
|
|
230
|
+
}, onMouseMove: function(t) {
|
|
231
|
+
this.touches.length && (this.processMove(t, [{ fake: !0, clientX: t.clientX, clientY: t.clientY }]), t.preventDefault && t.preventDefault());
|
|
232
|
+
}, onMouseUp: function() {
|
|
233
|
+
this.processEnd();
|
|
234
|
+
}, initAnchor: function(t) {
|
|
235
|
+
var e = this.$refs.draggable.getBoundingClientRect(), i = e.left, o = e.right, s = e.bottom, n = e.top;
|
|
236
|
+
this.anchor = { left: t.clientX - i, top: t.clientY - n, bottom: s - t.clientY, right: o - t.clientX };
|
|
237
|
+
}, processMove: function(t, e) {
|
|
238
|
+
var i = Q(e);
|
|
239
|
+
if (this.touches.length) {
|
|
240
|
+
if (this.touches.length === 1 && i.length === 1) {
|
|
241
|
+
var o = this.$refs.draggable;
|
|
242
|
+
this.$emit("drag", new We(t, o, { left: i[0].clientX, top: i[0].clientY }, { left: this.touches[0].clientX, top: this.touches[0].clientY }, this.anchor));
|
|
243
|
+
}
|
|
244
|
+
this.touches = i;
|
|
245
|
+
}
|
|
246
|
+
}, processEnd: function() {
|
|
247
|
+
this.touches.length && this.$emit("drag-end"), this.hovered && (this.$emit("leave"), this.hovered = !1), this.touches = [];
|
|
248
|
+
} }, emits: ["drag", "drag-end", "leave", "enter"] };
|
|
249
|
+
Lt.render = function(t, e, i, o, s, n) {
|
|
250
|
+
return g(), z("div", { ref: "draggable", class: i.classname, onTouchstart: e[1] || (e[1] = function() {
|
|
251
|
+
return n.onTouchStart && n.onTouchStart.apply(n, arguments);
|
|
252
|
+
}), onMousedown: e[2] || (e[2] = function() {
|
|
253
|
+
return n.onMouseDown && n.onMouseDown.apply(n, arguments);
|
|
254
|
+
}), onMouseover: e[3] || (e[3] = function() {
|
|
255
|
+
return n.onMouseOver && n.onMouseOver.apply(n, arguments);
|
|
256
|
+
}), onMouseleave: e[4] || (e[4] = function() {
|
|
257
|
+
return n.onMouseLeave && n.onMouseLeave.apply(n, arguments);
|
|
258
|
+
}) }, [K(t.$slots, "default")], 34);
|
|
259
|
+
};
|
|
260
|
+
var yt = $("vue-handler-wrapper"), le = { name: "HandlerWrapper", components: { DraggableElement: Lt }, props: { horizontalPosition: { type: String }, verticalPosition: { type: String }, disabled: { type: Boolean, default: !1 } }, computed: { classes: function() {
|
|
261
|
+
var t;
|
|
262
|
+
if (this.horizontalPosition || this.verticalPosition) {
|
|
263
|
+
var e, i = se(this.horizontalPosition, this.verticalPosition);
|
|
264
|
+
t = yt((H(e = {}, i.classname, !0), H(e, "disabled", this.disabled), e));
|
|
265
|
+
} else t = yt({ disabled: this.disabled });
|
|
266
|
+
return { root: t, draggable: yt("draggable") };
|
|
267
|
+
} }, emits: ["leave", "enter", "drag", "drag-end"] };
|
|
268
|
+
le.render = function(t, e, i, o, s, n) {
|
|
269
|
+
var a = V("DraggableElement");
|
|
270
|
+
return g(), z("div", { class: n.classes.root }, [x(a, { class: n.classes.draggable, onDrag: e[1] || (e[1] = function(h) {
|
|
271
|
+
return t.$emit("drag", h);
|
|
272
|
+
}), onDragEnd: e[2] || (e[2] = function(h) {
|
|
273
|
+
return t.$emit("drag-end");
|
|
274
|
+
}), onLeave: e[3] || (e[3] = function(h) {
|
|
275
|
+
return t.$emit("leave");
|
|
276
|
+
}), onEnter: e[4] || (e[4] = function(h) {
|
|
277
|
+
return t.$emit("enter");
|
|
278
|
+
}) }, { default: B((function() {
|
|
279
|
+
return [K(t.$slots, "default")];
|
|
280
|
+
})), _: 3 }, 8, ["class"])], 2);
|
|
281
|
+
};
|
|
282
|
+
var Oe = $("vue-line-wrapper"), ce = { name: "LineWrapper", components: { DraggableElement: Lt }, props: { position: { type: String, required: !0 }, disabled: { type: Boolean, default: !1 } }, computed: { classname: function() {
|
|
283
|
+
var t;
|
|
284
|
+
return Oe((H(t = {}, this.position, !0), H(t, "disabled", this.disabled), t));
|
|
285
|
+
} }, emits: ["leave", "enter", "drag", "drag-end"] };
|
|
286
|
+
ce.render = function(t, e, i, o, s, n) {
|
|
287
|
+
var a = V("DraggableElement");
|
|
288
|
+
return g(), z(a, { class: n.classname, onDrag: e[1] || (e[1] = function(h) {
|
|
289
|
+
return t.$emit("drag", h);
|
|
290
|
+
}), onDragEnd: e[2] || (e[2] = function(h) {
|
|
291
|
+
return t.$emit("drag-end");
|
|
292
|
+
}), onLeave: e[3] || (e[3] = function(h) {
|
|
293
|
+
return t.$emit("leave");
|
|
294
|
+
}), onEnter: e[4] || (e[4] = function(h) {
|
|
295
|
+
return t.$emit("enter");
|
|
296
|
+
}) }, { default: B((function() {
|
|
297
|
+
return [K(t.$slots, "default")];
|
|
298
|
+
})), _: 3 }, 8, ["class"]);
|
|
299
|
+
};
|
|
300
|
+
var j = ["left", "right", "top", "bottom"], De = ["left", "right"], Le = ["top", "bottom"], He = ["left", "top"], Ie = ["fill-area", "fit-area", "stencil", "none"], Qt = { left: 0, top: 0, width: 0, height: 0 };
|
|
301
|
+
function Kt(t, e, i) {
|
|
302
|
+
return !(i = i || ["width", "height", "left", "top"]).some((function(o) {
|
|
303
|
+
return t[o] !== e[o];
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
function U(t) {
|
|
307
|
+
return { left: t.left, top: t.top, right: t.left + t.width, bottom: t.top + t.height };
|
|
308
|
+
}
|
|
309
|
+
function tt(t, e) {
|
|
310
|
+
return { left: t.left - e.left, top: t.top - e.top };
|
|
311
|
+
}
|
|
312
|
+
function E(t) {
|
|
313
|
+
return { left: t.left + t.width / 2, top: t.top + t.height / 2 };
|
|
314
|
+
}
|
|
315
|
+
function rt(t, e) {
|
|
316
|
+
var i = { left: 0, top: 0, right: 0, bottom: 0 };
|
|
317
|
+
return j.forEach((function(o) {
|
|
318
|
+
var s = e[o], n = U(t)[o];
|
|
319
|
+
i[o] = s !== void 0 && n !== void 0 ? o === "left" || o === "top" ? Math.max(0, s - n) : Math.max(0, n - s) : 0;
|
|
320
|
+
})), i;
|
|
321
|
+
}
|
|
322
|
+
function P(t, e) {
|
|
323
|
+
return { left: t.left - e.left, top: t.top - e.top, width: t.width + e.left + e.right, height: t.height + e.top + e.bottom };
|
|
324
|
+
}
|
|
325
|
+
function ft(t) {
|
|
326
|
+
return { left: -t.left, top: -t.top };
|
|
327
|
+
}
|
|
328
|
+
function D(t, e) {
|
|
329
|
+
return f(f({}, t), { left: t.left + e.left, top: t.top + e.top });
|
|
330
|
+
}
|
|
331
|
+
function I(t, e, i, o) {
|
|
332
|
+
if (e !== 1) {
|
|
333
|
+
if (i) {
|
|
334
|
+
var s = E(t);
|
|
335
|
+
return { width: t.width * e, height: t.height * e, left: t.left + t.width * (1 - e) / 2 + (i.left - s.left) * (1 - e), top: t.top + t.height * (1 - e) / 2 + (i.top - s.top) * (1 - e) };
|
|
336
|
+
}
|
|
337
|
+
return { width: t.width * e, height: t.height * e, left: t.left + t.width * (1 - e) / 2, top: t.top + t.height * (1 - e) / 2 };
|
|
338
|
+
}
|
|
339
|
+
return t;
|
|
340
|
+
}
|
|
341
|
+
function y(t) {
|
|
342
|
+
return t.width / t.height;
|
|
343
|
+
}
|
|
344
|
+
function et(t, e) {
|
|
345
|
+
return Math.min(e.right !== void 0 && e.left !== void 0 ? (e.right - e.left) / t.width : 1 / 0, e.bottom !== void 0 && e.top !== void 0 ? (e.bottom - e.top) / t.height : 1 / 0);
|
|
346
|
+
}
|
|
347
|
+
function it(t, e) {
|
|
348
|
+
var i = { left: 0, top: 0 }, o = rt(t, e);
|
|
349
|
+
return o.left && o.left > 0 ? i.left = o.left : o.right && o.right > 0 && (i.left = -o.right), o.top && o.top > 0 ? i.top = o.top : o.bottom && o.bottom > 0 && (i.top = -o.bottom), i;
|
|
350
|
+
}
|
|
351
|
+
function zt(t, e) {
|
|
352
|
+
var i;
|
|
353
|
+
return e.minimum && t < e.minimum ? i = e.minimum : e.maximum && t > e.maximum && (i = e.maximum), i;
|
|
354
|
+
}
|
|
355
|
+
function ue(t, e) {
|
|
356
|
+
var i = y(t), o = y(e);
|
|
357
|
+
return e.width < 1 / 0 && e.height < 1 / 0 ? i > o ? { width: e.width, height: e.width / i } : { width: e.height * i, height: e.height } : e.width < 1 / 0 ? { width: e.width, height: e.width / i } : e.height < 1 / 0 ? { width: e.height * i, height: e.height } : t;
|
|
358
|
+
}
|
|
359
|
+
function de(t, e) {
|
|
360
|
+
var i = e * Math.PI / 180;
|
|
361
|
+
return { width: Math.abs(t.width * Math.cos(i)) + Math.abs(t.height * Math.sin(i)), height: Math.abs(t.width * Math.sin(i)) + Math.abs(t.height * Math.cos(i)) };
|
|
362
|
+
}
|
|
363
|
+
function q(t, e) {
|
|
364
|
+
var i = e * Math.PI / 180;
|
|
365
|
+
return { left: t.left * Math.cos(i) - t.top * Math.sin(i), top: t.left * Math.sin(i) + t.top * Math.cos(i) };
|
|
366
|
+
}
|
|
367
|
+
function pt(t, e) {
|
|
368
|
+
var i = rt(C(t, e), e);
|
|
369
|
+
return i.left + i.right + i.top + i.bottom ? i.left + i.right > i.top + i.bottom ? Math.min((t.width + i.left + i.right) / t.width, et(t, e)) : Math.min((t.height + i.top + i.bottom) / t.height, et(t, e)) : 1;
|
|
370
|
+
}
|
|
371
|
+
function C(t, e, i) {
|
|
372
|
+
i === void 0 && (i = !1);
|
|
373
|
+
var o = it(t, e);
|
|
374
|
+
return D(t, i ? ft(o) : o);
|
|
375
|
+
}
|
|
376
|
+
function Tt(t) {
|
|
377
|
+
return { width: t.right !== void 0 && t.left !== void 0 ? t.right - t.left : 1 / 0, height: t.bottom !== void 0 && t.top !== void 0 ? t.bottom - t.top : 1 / 0 };
|
|
378
|
+
}
|
|
379
|
+
function $e(t, e) {
|
|
380
|
+
return f(f({}, t), { minWidth: Math.min(e.width, t.minWidth), minHeight: Math.min(e.height, t.minHeight), maxWidth: Math.min(e.width, t.maxWidth), maxHeight: Math.min(e.height, t.maxHeight) });
|
|
381
|
+
}
|
|
382
|
+
function me(t, e, i) {
|
|
383
|
+
i === void 0 && (i = !0);
|
|
384
|
+
var o = {};
|
|
385
|
+
return j.forEach((function(s) {
|
|
386
|
+
var n = t[s], a = e[s];
|
|
387
|
+
n !== void 0 && a !== void 0 ? o[s] = s === "left" || s === "top" ? i ? Math.max(n, a) : Math.min(n, a) : i ? Math.min(n, a) : Math.max(n, a) : a !== void 0 ? o[s] = a : n !== void 0 && (o[s] = n);
|
|
388
|
+
})), o;
|
|
389
|
+
}
|
|
390
|
+
function gt(t, e) {
|
|
391
|
+
return me(t, e, !0);
|
|
392
|
+
}
|
|
393
|
+
function Jt(t) {
|
|
394
|
+
var e = t.size, i = t.aspectRatio, o = t.ignoreMinimum, s = t.sizeRestrictions;
|
|
395
|
+
return !!((e.correctRatio || y(e) >= i.minimum && y(e) <= i.maximum) && e.height <= s.maxHeight && e.width <= s.maxWidth && e.width && e.height && (o || e.height >= s.minHeight && e.width >= s.minWidth));
|
|
396
|
+
}
|
|
397
|
+
function _t(t, e) {
|
|
398
|
+
return Math.pow(t.width - e.width, 2) + Math.pow(t.height - e.height, 2);
|
|
399
|
+
}
|
|
400
|
+
function F(t) {
|
|
401
|
+
var e = t.width, i = t.height, o = t.sizeRestrictions, s = { minimum: t.aspectRatio && t.aspectRatio.minimum || 0, maximum: t.aspectRatio && t.aspectRatio.maximum || 1 / 0 }, n = { width: Math.max(o.minWidth, Math.min(o.maxWidth, e)), height: Math.max(o.minHeight, Math.min(o.maxHeight, i)) };
|
|
402
|
+
function a(l, c) {
|
|
403
|
+
return c === void 0 && (c = !1), l.reduce((function(u, d) {
|
|
404
|
+
return Jt({ size: d, aspectRatio: s, sizeRestrictions: o, ignoreMinimum: c }) && (!u || _t(d, { width: e, height: i }) < _t(u, { width: e, height: i })) ? d : u;
|
|
405
|
+
}), null);
|
|
406
|
+
}
|
|
407
|
+
var h = [];
|
|
408
|
+
s && [s.minimum, s.maximum].forEach((function(l) {
|
|
409
|
+
l && h.push({ width: n.width, height: n.width / l, correctRatio: !0 }, { width: n.height * l, height: n.height, correctRatio: !0 });
|
|
410
|
+
})), Jt({ size: n, aspectRatio: s, sizeRestrictions: o }) && h.push(n);
|
|
411
|
+
var r = a(h) || a(h, !0);
|
|
412
|
+
return r && { width: r.width, height: r.height };
|
|
413
|
+
}
|
|
414
|
+
function Wt(t) {
|
|
415
|
+
var e = t.event, i = t.coordinates, o = t.positionRestrictions, s = o === void 0 ? {} : o, n = D(i, e.directions);
|
|
416
|
+
return D(n, it(n, s));
|
|
417
|
+
}
|
|
418
|
+
function ke(t) {
|
|
419
|
+
var e = t.coordinates, i = t.transform, o = t.imageSize, s = t.sizeRestrictions, n = t.positionRestrictions, a = t.aspectRatio, h = t.visibleArea, r = function(c, u) {
|
|
420
|
+
return Wt({ coordinates: c, positionRestrictions: n, event: new Dt({ left: u.left - c.left, top: u.top - c.top }) });
|
|
421
|
+
}, l = f({}, e);
|
|
422
|
+
return (Array.isArray(i) ? i : [i]).forEach((function(c) {
|
|
423
|
+
var u = {};
|
|
424
|
+
S((u = typeof c == "function" ? c({ coordinates: l, imageSize: o, visibleArea: h }) : c).width) && S(u.height) || (l = (function(d, m) {
|
|
425
|
+
var v = f(f(f({}, d), F({ width: m.width, height: m.height, sizeRestrictions: s, aspectRatio: a })), { left: 0, top: 0 });
|
|
426
|
+
return r(v, { left: d.left, top: d.top });
|
|
427
|
+
})(l, f(f({}, l), u))), S(u.left) && S(u.top) || (l = r(l, f(f({}, l), u)));
|
|
428
|
+
})), l;
|
|
429
|
+
}
|
|
430
|
+
function Pe(t) {
|
|
431
|
+
t.event;
|
|
432
|
+
var e = t.getAreaRestrictions, i = t.boundaries, o = t.coordinates, s = t.visibleArea;
|
|
433
|
+
t.aspectRatio;
|
|
434
|
+
var n = t.stencilSize, a = t.sizeRestrictions, h = t.positionRestrictions;
|
|
435
|
+
t.stencilReference;
|
|
436
|
+
var r, l, c, u = f({}, o), d = f({}, s), m = f({}, n);
|
|
437
|
+
r = y(m), l = y(u), c === void 0 && (c = 1e-3), (r === 0 || l === 0 ? Math.abs(l - r) < c : Math.abs(l / r) < 1 + c && Math.abs(l / r) > 1 - c) || (u = f(f({}, u), F({ sizeRestrictions: a, width: u.width, height: u.height, aspectRatio: { minimum: y(m), maximum: y(m) } })));
|
|
438
|
+
var v = pt(d = I(d, u.width * i.width / (d.width * m.width)), e({ visibleArea: d, type: "resize" }));
|
|
439
|
+
return v !== 1 && (d = I(d, v), u = I(u, v)), d = C(d = D(d, tt(E(u), E(d))), e({ visibleArea: d, type: "move" })), { coordinates: u = C(u, gt(U(d), h)), visibleArea: d };
|
|
440
|
+
}
|
|
441
|
+
function je(t) {
|
|
442
|
+
var e = t.event, i = t.getAreaRestrictions, o = t.boundaries, s = t.coordinates, n = t.visibleArea;
|
|
443
|
+
t.aspectRatio, t.stencilSize, t.sizeRestrictions;
|
|
444
|
+
var a = t.positionRestrictions;
|
|
445
|
+
t.stencilReference;
|
|
446
|
+
var h = f({}, s), r = f({}, n);
|
|
447
|
+
if (s && n && e.type !== "manipulateImage") {
|
|
448
|
+
var l = { width: 0, height: 0 };
|
|
449
|
+
r.width, o.width, y(o) > y(h) ? (l.height = 0.8 * o.height, l.width = l.height * y(h)) : (l.width = 0.8 * o.width, l.height = l.width * y(h));
|
|
450
|
+
var c = pt(r = I(r, h.width * o.width / (r.width * l.width)), i({ visibleArea: r, type: "resize" }));
|
|
451
|
+
r = I(r, c), c !== 1 && (l.height /= c, l.width /= c), r = C(r = D(r, tt(E(h), E(r))), i({ visibleArea: r, type: "move" })), h = C(h, gt(U(r), a));
|
|
452
|
+
}
|
|
453
|
+
return { coordinates: h, visibleArea: r };
|
|
454
|
+
}
|
|
455
|
+
function Be(t) {
|
|
456
|
+
var e = t.event, i = t.coordinates, o = t.visibleArea, s = t.getAreaRestrictions, n = f({}, o), a = f({}, i);
|
|
457
|
+
if (e.type === "setCoordinates") {
|
|
458
|
+
var h = Math.max(0, a.width - n.width), r = Math.max(0, a.height - n.height);
|
|
459
|
+
h > r ? n = I(n, Math.min(a.width / n.width, et(n, s({ visibleArea: n, type: "resize" })))) : r > h && (n = I(n, Math.min(a.height / n.height, et(n, s({ visibleArea: n, type: "resize" }))))), n = C(n = D(n, ft(it(a, U(n)))), s({ visibleArea: n, type: "move" }));
|
|
460
|
+
}
|
|
461
|
+
return { visibleArea: n, coordinates: a };
|
|
462
|
+
}
|
|
463
|
+
function Ue(t) {
|
|
464
|
+
var e = t.imageSize, i = t.visibleArea, o = t.coordinates, s = i || e;
|
|
465
|
+
return { left: (i ? i.left : 0) + s.width / 2 - o.width / 2, top: (i ? i.top : 0) + s.height / 2 - o.height / 2 };
|
|
466
|
+
}
|
|
467
|
+
function Xe(t) {
|
|
468
|
+
var e = t.imageSize, i = t.visibleArea, o = t.aspectRatio, s = t.sizeRestrictions, n = i || e, a = Math.min(o.maximum || 1 / 0, Math.max(o.minimum || 0, y(n))), h = n.width < n.height ? { width: 0.8 * n.width, height: 0.8 * n.width / a } : { height: 0.8 * n.height, width: 0.8 * n.height * a };
|
|
469
|
+
return F(f(f({}, h), { aspectRatio: o, sizeRestrictions: s }));
|
|
470
|
+
}
|
|
471
|
+
function Ye(t) {
|
|
472
|
+
var e, i, o = t.imageSize, s = t.visibleArea, n = t.boundaries, a = t.aspectRatio, h = t.sizeRestrictions, r = t.stencilSize, l = s || o;
|
|
473
|
+
return y(l) > y(n) ? i = (e = r.height * l.height / n.height) * y(r) : e = (i = r.width * l.width / n.width) / y(r), F({ width: i, height: e, aspectRatio: a, sizeRestrictions: h });
|
|
474
|
+
}
|
|
475
|
+
function Fe(t) {
|
|
476
|
+
var e = t.getAreaRestrictions, i = t.coordinates, o = t.imageSize, s = y(t.boundaries);
|
|
477
|
+
if (i) {
|
|
478
|
+
var n = { height: Math.max(i.height, o.height), width: Math.max(i.width, o.width) }, a = ue({ width: y(n) > s ? n.width : n.height * s, height: y(n) > s ? n.width / s : n.height }, Tt(e())), h = { left: i.left + i.width / 2 - a.width / 2, top: i.top + i.height / 2 - a.height / 2, width: a.width, height: a.height }, r = rt(i, U(f({ left: 0, top: 0 }, o))), l = {};
|
|
479
|
+
return !r.left && !r.right && h.width <= o.width && (l.left = 0, l.right = o.width), !r.top && !r.bottom && h.height <= o.height && (l.top = 0, l.bottom = o.height), C(h, l);
|
|
480
|
+
}
|
|
481
|
+
var c = y(o);
|
|
482
|
+
return a = { height: c > s ? o.height : o.width / s, width: c > s ? o.height * s : o.width }, { left: o.width / 2 - a.width / 2, top: o.height / 2 - a.height / 2, width: a.width, height: a.height };
|
|
483
|
+
}
|
|
484
|
+
function lt(t, e) {
|
|
485
|
+
return me(t, U(e));
|
|
486
|
+
}
|
|
487
|
+
function Ve(t) {
|
|
488
|
+
var e = t.event, i = t.coordinates, o = t.visibleArea, s = t.sizeRestrictions, n = t.getAreaRestrictions, a = t.positionRestrictions, h = t.adjustStencil, r = e.scale, l = e.move, c = f({}, o), u = f({}, i), d = 1, m = 1, v = r.factor && Math.abs(r.factor - 1) > 1e-3;
|
|
489
|
+
c = D(c, { left: l.left || 0, top: l.top || 0 });
|
|
490
|
+
var b = { stencil: { minimum: Math.max(s.minWidth ? s.minWidth / u.width : 0, s.minHeight ? s.minHeight / u.height : 0), maximum: Math.min(s.maxWidth ? s.maxWidth / u.width : 1 / 0, s.maxHeight ? s.maxHeight / u.height : 1 / 0, et(u, a)) }, area: { maximum: et(c, n({ visibleArea: c, type: "resize" })) } };
|
|
491
|
+
r.factor && v && (r.factor < 1 ? (m = Math.max(r.factor, b.stencil.minimum)) > 1 && (m = 1) : r.factor > 1 && (m = Math.min(r.factor, Math.min(b.area.maximum, b.stencil.maximum))) < 1 && (m = 1)), m && (c = I(c, m, r.center));
|
|
492
|
+
var O = i.left - o.left, T = o.width + o.left - (i.width + i.left), k = i.top - o.top, Z = o.height + o.top - (i.height + i.top);
|
|
493
|
+
return c = C(c = D(c, it(c, { left: a.left !== void 0 ? a.left - O * m : void 0, top: a.top !== void 0 ? a.top - k * m : void 0, bottom: a.bottom !== void 0 ? a.bottom + Z * m : void 0, right: a.right !== void 0 ? a.right + T * m : void 0 })), n({ visibleArea: c, type: "move" })), u.width = u.width * m, u.height = u.height * m, u.left = c.left + O * m, u.top = c.top + k * m, u = C(u, gt(U(c), a)), r.factor && v && h && (r.factor > 1 ? d = Math.min(b.area.maximum, r.factor) / m : r.factor < 1 && (d = Math.max(u.height / c.height, u.width / c.width, r.factor / m)), d !== 1 && (c = D(c = C(c = I(c, d, r.factor > 1 ? r.center : E(u)), n({ visibleArea: c, type: "move" })), ft(it(u, U(c)))))), { coordinates: u, visibleArea: c };
|
|
494
|
+
}
|
|
495
|
+
function Ne(t) {
|
|
496
|
+
var e = t.aspectRatio, i = t.getAreaRestrictions, o = t.coordinates, s = t.visibleArea, n = t.sizeRestrictions, a = t.positionRestrictions, h = t.imageSize, r = t.previousImageSize, l = t.angle, c = f({}, o), u = f({}, s), d = q(E(f({ left: 0, top: 0 }, r)), l);
|
|
497
|
+
return (c = f(f({}, F({ sizeRestrictions: n, aspectRatio: e, width: c.width, height: c.height })), q(E(c), l))).left -= d.left - h.width / 2 + c.width / 2, c.top -= d.top - h.height / 2 + c.height / 2, u = I(u, pt(u, i({ visibleArea: u, type: "resize" }))), { coordinates: c = C(c, a), visibleArea: u = C(u = D(u, tt(E(c), E(o))), i({ visibleArea: u, type: "move" })) };
|
|
498
|
+
}
|
|
499
|
+
function qe(t) {
|
|
500
|
+
var e = t.flip, i = t.previousFlip, o = t.rotate, s = t.getAreaRestrictions, n = t.coordinates, a = t.visibleArea, h = t.imageSize, r = f({}, n), l = f({}, a), c = i.horizontal !== e.horizontal, u = i.vertical !== e.vertical;
|
|
501
|
+
if (c || u) {
|
|
502
|
+
var d = q({ left: h.width / 2, top: h.height / 2 }, -o), m = q(E(r), -o), v = q({ left: c ? d.left - (m.left - d.left) : m.left, top: u ? d.top - (m.top - d.top) : m.top }, o);
|
|
503
|
+
r = D(r, tt(v, E(r))), m = q(E(l), -o), l = C(l = D(l, tt(v = q({ left: c ? d.left - (m.left - d.left) : m.left, top: u ? d.top - (m.top - d.top) : m.top }, o), E(l))), s({ visibleArea: l, type: "move" }));
|
|
504
|
+
}
|
|
505
|
+
return { coordinates: r, visibleArea: l };
|
|
506
|
+
}
|
|
507
|
+
function te(t) {
|
|
508
|
+
var e = t.directions, i = t.coordinates, o = t.positionRestrictions, s = o === void 0 ? {} : o, n = t.sizeRestrictions, a = t.preserveRatio, h = t.compensate, r = f({}, e), l = P(i, r).width, c = P(i, r).height;
|
|
509
|
+
l < 0 && (r.left < 0 && r.right < 0 ? (r.left = -(i.width - n.minWidth) / (r.left / r.right), r.right = -(i.width - n.minWidth) / (r.right / r.left)) : r.left < 0 ? r.left = -(i.width - n.minWidth) : r.right < 0 && (r.right = -(i.width - n.minWidth))), c < 0 && (r.top < 0 && r.bottom < 0 ? (r.top = -(i.height - n.minHeight) / (r.top / r.bottom), r.bottom = -(i.height - n.minHeight) / (r.bottom / r.top)) : r.top < 0 ? r.top = -(i.height - n.minHeight) : r.bottom < 0 && (r.bottom = -(i.height - n.minHeight)));
|
|
510
|
+
var u = rt(P(i, r), s);
|
|
511
|
+
h && (u.left && u.left > 0 && u.right === 0 ? (r.right += u.left, r.left -= u.left) : u.right && u.right > 0 && u.left === 0 && (r.left += u.right, r.right -= u.right), u.top && u.top > 0 && u.bottom === 0 ? (r.bottom += u.top, r.top -= u.top) : u.bottom && u.bottom > 0 && u.top === 0 && (r.top += u.bottom, r.bottom -= u.bottom), u = rt(P(i, r), s));
|
|
512
|
+
var d = { width: 1 / 0, height: 1 / 0, left: 1 / 0, right: 1 / 0, top: 1 / 0, bottom: 1 / 0 };
|
|
513
|
+
if (j.forEach((function(b) {
|
|
514
|
+
var O = u[b];
|
|
515
|
+
O && r[b] && (d[b] = Math.max(0, 1 - O / r[b]));
|
|
516
|
+
})), a) {
|
|
517
|
+
var m = Math.min.apply(null, j.map((function(b) {
|
|
518
|
+
return d[b];
|
|
519
|
+
})));
|
|
520
|
+
m !== 1 / 0 && j.forEach((function(b) {
|
|
521
|
+
r[b] *= m;
|
|
522
|
+
}));
|
|
523
|
+
} else j.forEach((function(b) {
|
|
524
|
+
d[b] !== 1 / 0 && (r[b] *= d[b]);
|
|
525
|
+
}));
|
|
526
|
+
if (l = P(i, r).width, c = P(i, r).height, r.right + r.left && (l > n.maxWidth ? d.width = (n.maxWidth - i.width) / (r.right + r.left) : l < n.minWidth && (d.width = (n.minWidth - i.width) / (r.right + r.left))), r.bottom + r.top && (c > n.maxHeight ? d.height = (n.maxHeight - i.height) / (r.bottom + r.top) : c < n.minHeight && (d.height = (n.minHeight - i.height) / (r.bottom + r.top))), a) {
|
|
527
|
+
var v = Math.min(d.width, d.height);
|
|
528
|
+
v !== 1 / 0 && j.forEach((function(b) {
|
|
529
|
+
r[b] *= v;
|
|
530
|
+
}));
|
|
531
|
+
} else d.width !== 1 / 0 && De.forEach((function(b) {
|
|
532
|
+
r[b] *= d.width;
|
|
533
|
+
})), d.height !== 1 / 0 && Le.forEach((function(b) {
|
|
534
|
+
r[b] *= d.height;
|
|
535
|
+
}));
|
|
536
|
+
return r;
|
|
537
|
+
}
|
|
538
|
+
function ct(t, e, i) {
|
|
539
|
+
return e == 0 && i == 0 ? t / 2 : e == 0 ? 0 : i == 0 ? t : t * Math.abs(e / (e + i));
|
|
540
|
+
}
|
|
541
|
+
var Ze = $("vue-simple-handler"), Ge = $("vue-simple-handler-wrapper"), Ht = { name: "SimpleHandler", components: { HandlerWrapper: le }, props: { defaultClass: { type: String }, hoverClass: { type: String }, wrapperClass: { type: String }, horizontalPosition: { type: String }, verticalPosition: { type: String }, disabled: { type: Boolean, default: !1 } }, data: function() {
|
|
542
|
+
return { hover: !1 };
|
|
543
|
+
}, computed: { classes: function() {
|
|
544
|
+
var t, e = (H(t = {}, this.horizontalPosition, !!this.horizontalPosition), H(t, this.verticalPosition, !!this.verticalPosition), H(t, "".concat(this.horizontalPosition, "-").concat(this.verticalPosition), !!(this.verticalPosition && this.horizontalPosition)), H(t, "hover", this.hover), t);
|
|
545
|
+
return { default: M(Ze(e), this.defaultClass, this.hover && this.hoverClass), wrapper: M(Ge(e), this.wrapperClass) };
|
|
546
|
+
} }, methods: { onDrag: function(t) {
|
|
547
|
+
this.$emit("drag", t);
|
|
548
|
+
}, onEnter: function() {
|
|
549
|
+
this.hover = !0;
|
|
550
|
+
}, onLeave: function() {
|
|
551
|
+
this.hover = !1;
|
|
552
|
+
}, onDragEnd: function() {
|
|
553
|
+
this.$emit("drag-end");
|
|
554
|
+
} }, emits: ["drag", "drag-end"] };
|
|
555
|
+
Ht.render = function(t, e, i, o, s, n) {
|
|
556
|
+
var a = V("HandlerWrapper");
|
|
557
|
+
return g(), z(a, { class: n.classes.wrapper, "vertical-position": i.verticalPosition, "horizontal-position": i.horizontalPosition, disabled: i.disabled, onDrag: n.onDrag, onDragEnd: n.onDragEnd, onEnter: n.onEnter, onLeave: n.onLeave }, { default: B((function() {
|
|
558
|
+
return [x("div", { class: n.classes.default }, null, 2)];
|
|
559
|
+
})), _: 1 }, 8, ["class", "vertical-position", "horizontal-position", "disabled", "onDrag", "onDragEnd", "onEnter", "onLeave"]);
|
|
560
|
+
};
|
|
561
|
+
var Qe = $("vue-simple-line"), Ke = $("vue-simple-line-wrapper"), It = { name: "SimpleLine", components: { LineWrapper: ce }, props: { defaultClass: { type: String }, hoverClass: { type: String }, wrapperClass: { type: String }, position: { type: String }, disabled: { type: Boolean, default: !1 } }, data: function() {
|
|
562
|
+
return { hover: !1 };
|
|
563
|
+
}, computed: { classes: function() {
|
|
564
|
+
return { root: M(Qe(H({}, this.position, !0)), this.defaultClass, this.hover && this.hoverClass), wrapper: M(Ke(H({}, this.position, !0)), this.wrapperClass) };
|
|
565
|
+
} }, methods: { onDrag: function(t) {
|
|
566
|
+
this.$emit("drag", t);
|
|
567
|
+
}, onEnter: function() {
|
|
568
|
+
this.hover = !0;
|
|
569
|
+
}, onLeave: function() {
|
|
570
|
+
this.hover = !1;
|
|
571
|
+
}, onDragEnd: function() {
|
|
572
|
+
this.$emit("drag-end");
|
|
573
|
+
} }, emits: ["drag", "drag-end"] };
|
|
574
|
+
It.render = function(t, e, i, o, s, n) {
|
|
575
|
+
var a = V("LineWrapper");
|
|
576
|
+
return g(), z(a, { class: n.classes.wrapper, position: i.position, disabled: i.disabled, onDrag: n.onDrag, onDragEnd: n.onDragEnd, onEnter: n.onEnter, onLeave: n.onLeave }, { default: B((function() {
|
|
577
|
+
return [x("div", { class: n.classes.root }, null, 2)];
|
|
578
|
+
})), _: 1 }, 8, ["class", "position", "disabled", "onDrag", "onDragEnd", "onEnter", "onLeave"]);
|
|
579
|
+
};
|
|
580
|
+
var Rt = $("vue-bounding-box"), Je = ["east", "west", null], _e = ["south", "north", null], fe = { name: "BoundingBox", props: { width: { type: Number }, height: { type: Number }, transitions: { type: Object }, handlers: { type: Object, default: function() {
|
|
581
|
+
return { eastNorth: !0, north: !0, westNorth: !0, west: !0, westSouth: !0, south: !0, eastSouth: !0, east: !0 };
|
|
582
|
+
} }, handlersComponent: { type: [Object, String], default: function() {
|
|
583
|
+
return Ht;
|
|
584
|
+
} }, handlersClasses: { type: Object, default: function() {
|
|
585
|
+
return {};
|
|
586
|
+
} }, handlersWrappersClasses: { type: Object, default: function() {
|
|
587
|
+
return {};
|
|
588
|
+
} }, lines: { type: Object, default: function() {
|
|
589
|
+
return { west: !0, north: !0, east: !0, south: !0 };
|
|
590
|
+
} }, linesComponent: { type: [Object, String], default: function() {
|
|
591
|
+
return It;
|
|
592
|
+
} }, linesClasses: { type: Object, default: function() {
|
|
593
|
+
return {};
|
|
594
|
+
} }, linesWrappersClasses: { type: Object, default: function() {
|
|
595
|
+
return {};
|
|
596
|
+
} }, resizable: { type: Boolean, default: !0 } }, data: function() {
|
|
597
|
+
var t = [];
|
|
598
|
+
return Je.forEach((function(e) {
|
|
599
|
+
_e.forEach((function(i) {
|
|
600
|
+
if (e !== i) {
|
|
601
|
+
var o = se(e, i), s = o.name, n = o.classname;
|
|
602
|
+
t.push({ name: s, classname: n, verticalDirection: i, horizontalDirection: e });
|
|
603
|
+
}
|
|
604
|
+
}));
|
|
605
|
+
})), { points: t };
|
|
606
|
+
}, computed: { style: function() {
|
|
607
|
+
var t = {};
|
|
608
|
+
return this.width && this.height && (t.width = "".concat(this.width, "px"), t.height = "".concat(this.height, "px"), this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction))), t;
|
|
609
|
+
}, classes: function() {
|
|
610
|
+
var t = this.handlersClasses, e = this.handlersWrappersClasses, i = this.linesClasses, o = this.linesWrappersClasses;
|
|
611
|
+
return { root: Rt(), handlers: t, handlersWrappers: e, lines: i, linesWrappers: o };
|
|
612
|
+
}, lineNodes: function() {
|
|
613
|
+
var t = this, e = [];
|
|
614
|
+
return this.points.forEach((function(i) {
|
|
615
|
+
i.horizontalDirection && i.verticalDirection || !t.lines[i.name] || e.push({ name: i.name, component: t.linesComponent, class: M(t.classes.lines.default, t.classes.lines[i.name], !t.resizable && t.classes.lines.disabled), wrapperClass: M(t.classes.linesWrappers.default, t.classes.linesWrappers[i.name], !t.resizable && t.classes.linesWrappers.disabled), hoverClass: t.classes.lines.hover, verticalDirection: i.verticalDirection, horizontalDirection: i.horizontalDirection, disabled: !t.resizable });
|
|
616
|
+
})), e;
|
|
617
|
+
}, handlerNodes: function() {
|
|
618
|
+
var t = this, e = [], i = this.width, o = this.height;
|
|
619
|
+
return this.points.forEach((function(s) {
|
|
620
|
+
if (t.handlers[s.name]) {
|
|
621
|
+
var n = { name: s.name, component: t.handlersComponent, class: M(t.classes.handlers.default, t.classes.handlers[s.name]), wrapperClass: M(t.classes.handlersWrappers.default, t.classes.handlersWrappers[s.name]), hoverClass: t.classes.handlers.hover, verticalDirection: s.verticalDirection, horizontalDirection: s.horizontalDirection, disabled: !t.resizable };
|
|
622
|
+
if (i && o) {
|
|
623
|
+
var a = s.horizontalDirection, h = s.verticalDirection, r = a === "east" ? i : a === "west" ? 0 : i / 2, l = h === "south" ? o : h === "north" ? 0 : o / 2;
|
|
624
|
+
n.wrapperClass = Rt("handler"), n.wrapperStyle = { transform: "translate(".concat(r, "px, ").concat(l, "px)") }, t.transitions && t.transitions.enabled && (n.wrapperStyle.transition = "".concat(t.transitions.time, "ms ").concat(t.transitions.timingFunction));
|
|
625
|
+
} else n.wrapperClass = Rt("handler", H({}, s.classname, !0));
|
|
626
|
+
e.push(n);
|
|
627
|
+
}
|
|
628
|
+
})), e;
|
|
629
|
+
} }, beforeMount: function() {
|
|
630
|
+
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 });
|
|
631
|
+
}, beforeUnmount: function() {
|
|
632
|
+
window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
|
|
633
|
+
}, mounted: function() {
|
|
634
|
+
this.touches = [];
|
|
635
|
+
}, methods: { onEnd: function() {
|
|
636
|
+
this.$emit("resize-end");
|
|
637
|
+
}, onHandlerDrag: function(t, e, i) {
|
|
638
|
+
var o, s = t.shift(), n = s.left, a = s.top, h = { left: 0, right: 0, top: 0, bottom: 0 };
|
|
639
|
+
e === "west" ? h.left -= n : e === "east" && (h.right += n), i === "north" ? h.top -= a : i === "south" && (h.bottom += a), !i && e ? o = "width" : i && !e && (o = "height"), this.resizable && this.$emit("resize", new Te(h, { allowedDirections: { left: e === "west" || !e, right: e === "east" || !e, bottom: i === "south" || !i, top: i === "north" || !i }, preserveAspectRatio: t.nativeEvent && t.nativeEvent.shiftKey, respectDirection: o }));
|
|
640
|
+
} }, emits: ["resize", "resize-end"] };
|
|
641
|
+
fe.render = function(t, e, i, o, s, n) {
|
|
642
|
+
return g(), z("div", { ref: "box", class: n.classes.root, style: n.style }, [K(t.$slots, "default"), x("div", null, [(g(!0), z(Mt, null, Yt(n.lineNodes, (function(a) {
|
|
643
|
+
return g(), z(mt(a.component), { key: a.name, "default-class": a.class, "hover-class": a.hoverClass, "wrapper-class": a.wrapperClass, position: a.name, disabled: a.disabled, onDrag: function(h) {
|
|
644
|
+
return n.onHandlerDrag(h, a.horizontalDirection, a.verticalDirection);
|
|
645
|
+
}, onDragEnd: e[1] || (e[1] = function(h) {
|
|
646
|
+
return n.onEnd();
|
|
647
|
+
}) }, null, 8, ["default-class", "hover-class", "wrapper-class", "position", "disabled", "onDrag"]);
|
|
648
|
+
})), 128))]), (g(!0), z(Mt, null, Yt(n.handlerNodes, (function(a) {
|
|
649
|
+
return g(), z("div", { key: a.name, style: a.wrapperStyle, class: a.wrapperClass }, [(g(), z(mt(a.component), { "default-class": a.class, "hover-class": a.hoverClass, "wrapper-class": a.wrapperClass, "horizontal-position": a.horizontalDirection, "vertical-position": a.verticalDirection, disabled: a.disabled, onDrag: function(h) {
|
|
650
|
+
return n.onHandlerDrag(h, a.horizontalDirection, a.verticalDirection);
|
|
651
|
+
}, onDragEnd: e[2] || (e[2] = function(h) {
|
|
652
|
+
return n.onEnd();
|
|
653
|
+
}) }, null, 8, ["default-class", "hover-class", "wrapper-class", "horizontal-position", "vertical-position", "disabled", "onDrag"]))], 6);
|
|
654
|
+
})), 128))], 6);
|
|
655
|
+
};
|
|
656
|
+
var ti = $("vue-draggable-area"), pe = { name: "DraggableArea", props: { movable: { type: Boolean, default: !0 }, activationDistance: { type: Number, default: 20 } }, computed: { classnames: function() {
|
|
657
|
+
return { default: ti() };
|
|
658
|
+
} }, beforeMount: function() {
|
|
659
|
+
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 });
|
|
660
|
+
}, beforeUnmount: function() {
|
|
661
|
+
window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
|
|
662
|
+
}, mounted: function() {
|
|
663
|
+
this.touches = [], this.touchStarted = !1;
|
|
664
|
+
}, methods: { onTouchStart: function(t) {
|
|
665
|
+
if (t.cancelable) {
|
|
666
|
+
var e = this.movable && t.touches.length === 1;
|
|
667
|
+
e && (this.touches = Q(t.touches)), (this.touchStarted || e) && (t.preventDefault(), t.stopPropagation());
|
|
668
|
+
}
|
|
669
|
+
}, onTouchEnd: function() {
|
|
670
|
+
this.touchStarted = !1, this.processEnd();
|
|
671
|
+
}, onTouchMove: function(t) {
|
|
672
|
+
this.touches.length >= 1 && (this.touchStarted ? (this.processMove(t, t.touches), t.preventDefault(), t.stopPropagation()) : he({ x: this.touches[0].clientX, y: this.touches[0].clientY }, { x: t.touches[0].clientX, y: t.touches[0].clientY }) > this.activationDistance && (this.initAnchor({ clientX: t.touches[0].clientX, clientY: t.touches[0].clientY }), this.touchStarted = !0));
|
|
673
|
+
}, onMouseDown: function(t) {
|
|
674
|
+
if (this.movable && t.button === 0) {
|
|
675
|
+
var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
|
|
676
|
+
this.touches = [e], this.initAnchor(e), t.stopPropagation();
|
|
677
|
+
}
|
|
678
|
+
}, onMouseMove: function(t) {
|
|
679
|
+
this.touches.length && (this.processMove(t, [{ fake: !0, clientX: t.clientX, clientY: t.clientY }]), t.preventDefault && t.cancelable && t.preventDefault(), t.stopPropagation());
|
|
680
|
+
}, onMouseUp: function() {
|
|
681
|
+
this.processEnd();
|
|
682
|
+
}, initAnchor: function(t) {
|
|
683
|
+
var e = this.$refs.container.getBoundingClientRect(), i = e.left, o = e.top;
|
|
684
|
+
this.anchor = { x: t.clientX - i, y: t.clientY - o };
|
|
685
|
+
}, processMove: function(t, e) {
|
|
686
|
+
var i = Q(e);
|
|
687
|
+
if (this.touches.length) {
|
|
688
|
+
var o = this.$refs.container.getBoundingClientRect(), s = o.left, n = o.top;
|
|
689
|
+
this.touches.length === 1 && i.length === 1 && this.$emit("move", new Dt({ left: i[0].clientX - (s + this.anchor.x), top: i[0].clientY - (n + this.anchor.y) }));
|
|
690
|
+
}
|
|
691
|
+
}, processEnd: function() {
|
|
692
|
+
this.touches.length && this.$emit("move-end"), this.touches = [];
|
|
693
|
+
} }, emits: ["move", "move-end"] };
|
|
694
|
+
pe.render = function(t, e, i, o, s, n) {
|
|
695
|
+
return g(), z("div", { ref: "container", onTouchstart: e[1] || (e[1] = function() {
|
|
696
|
+
return n.onTouchStart && n.onTouchStart.apply(n, arguments);
|
|
697
|
+
}), onMousedown: e[2] || (e[2] = function() {
|
|
698
|
+
return n.onMouseDown && n.onMouseDown.apply(n, arguments);
|
|
699
|
+
}) }, [K(t.$slots, "default")], 544);
|
|
700
|
+
};
|
|
701
|
+
function At(t) {
|
|
702
|
+
var e, i;
|
|
703
|
+
return { rotate: t.rotate || 0, flip: { horizontal: ((e = t == null ? void 0 : t.flip) === null || e === void 0 ? void 0 : e.horizontal) || !1, vertical: ((i = t == null ? void 0 : t.flip) === null || i === void 0 ? void 0 : i.vertical) || !1 } };
|
|
704
|
+
}
|
|
705
|
+
function ei(t) {
|
|
706
|
+
return new Promise((function(e, i) {
|
|
707
|
+
try {
|
|
708
|
+
if (t) if (/^data:/i.test(t)) e((function(r) {
|
|
709
|
+
r = r.replace(/^data:([^;]+);base64,/gim, "");
|
|
710
|
+
for (var l = atob(r), c = l.length, u = new ArrayBuffer(c), d = new Uint8Array(u), m = 0; m < c; m++) d[m] = l.charCodeAt(m);
|
|
711
|
+
return u;
|
|
712
|
+
})(t));
|
|
713
|
+
else if (/^blob:/i.test(t)) {
|
|
714
|
+
var o = new FileReader();
|
|
715
|
+
o.onload = function(r) {
|
|
716
|
+
e(r.target.result);
|
|
717
|
+
}, n = t, a = function(r) {
|
|
718
|
+
o.readAsArrayBuffer(r);
|
|
719
|
+
}, (h = new XMLHttpRequest()).open("GET", n, !0), h.responseType = "blob", h.onload = function() {
|
|
720
|
+
this.status != 200 && this.status !== 0 || a(this.response);
|
|
721
|
+
}, h.send();
|
|
722
|
+
} else {
|
|
723
|
+
var s = new XMLHttpRequest();
|
|
724
|
+
s.onreadystatechange = function() {
|
|
725
|
+
s.readyState === 4 && (s.status === 200 || s.status === 0 ? e(s.response) : i("Warning: could not load an image to parse its orientation"), s = null);
|
|
726
|
+
}, s.onprogress = function() {
|
|
727
|
+
s.getResponseHeader("content-type") !== "image/jpeg" && s.abort();
|
|
728
|
+
}, s.withCredentials = !1, s.open("GET", t, !0), s.responseType = "arraybuffer", s.send(null);
|
|
729
|
+
}
|
|
730
|
+
else i("Error: the image is empty");
|
|
731
|
+
} catch (r) {
|
|
732
|
+
i(r);
|
|
733
|
+
}
|
|
734
|
+
var n, a, h;
|
|
735
|
+
}));
|
|
736
|
+
}
|
|
737
|
+
function ge(t) {
|
|
738
|
+
var e = t.rotate, i = t.flip, o = t.scaleX, s = t.scaleY, n = "";
|
|
739
|
+
return n += " rotate(" + e + "deg) ", n += " scaleX(" + o * (i.horizontal ? -1 : 1) + ") ", n += " scaleY(" + s * (i.vertical ? -1 : 1) + ") ";
|
|
740
|
+
}
|
|
741
|
+
function ii(t) {
|
|
742
|
+
try {
|
|
743
|
+
var e, i = new DataView(t), o = void 0, s = void 0, n = void 0, a = void 0;
|
|
744
|
+
if (i.getUint8(0) === 255 && i.getUint8(1) === 216) for (var h = i.byteLength, r = 2; r + 1 < h; ) {
|
|
745
|
+
if (i.getUint8(r) === 255 && i.getUint8(r + 1) === 225) {
|
|
746
|
+
n = r;
|
|
747
|
+
break;
|
|
748
|
+
}
|
|
749
|
+
r++;
|
|
750
|
+
}
|
|
751
|
+
if (n && (o = n + 10, (function(m, v, b) {
|
|
752
|
+
var O, T = "";
|
|
753
|
+
for (O = v, b += v; O < b; O++) T += String.fromCharCode(m.getUint8(O));
|
|
754
|
+
return T;
|
|
755
|
+
})(i, n + 4, 4) === "Exif")) {
|
|
756
|
+
var l = i.getUint16(o);
|
|
757
|
+
if (((s = l === 18761) || l === 19789) && i.getUint16(o + 2, s) === 42) {
|
|
758
|
+
var c = i.getUint32(o + 4, s);
|
|
759
|
+
c >= 8 && (a = o + c);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
if (a) {
|
|
763
|
+
for (var u = i.getUint16(a, s), d = 0; d < u; d++)
|
|
764
|
+
if (r = a + 12 * d + 2, i.getUint16(r, s) === 274) {
|
|
765
|
+
r += 8, e = i.getUint16(r, s), i.setUint16(r, 1, s);
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
return e;
|
|
770
|
+
} catch {
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function ee(t, e) {
|
|
775
|
+
var i = e.getBoundingClientRect(), o = i.left, s = i.top, n = { left: 0, top: 0 }, a = 0;
|
|
776
|
+
return t.forEach((function(h) {
|
|
777
|
+
n.left += (h.clientX - o) / t.length, n.top += (h.clientY - s) / t.length;
|
|
778
|
+
})), t.forEach((function(h) {
|
|
779
|
+
a += he({ x: n.left, y: n.top }, { x: h.clientX - o, y: h.clientY - s });
|
|
780
|
+
})), { centerMass: n, spread: a, count: t.length };
|
|
781
|
+
}
|
|
782
|
+
var ve = { props: { touchMove: { type: Boolean, required: !0 }, mouseMove: { type: Boolean, required: !0 }, touchResize: { type: Boolean, required: !0 }, wheelResize: { type: [Boolean, Object], required: !0 }, eventsFilter: { type: Function, required: !1 } }, beforeMount: function() {
|
|
783
|
+
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 });
|
|
784
|
+
}, beforeUnmount: function() {
|
|
785
|
+
window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd);
|
|
786
|
+
}, created: function() {
|
|
787
|
+
this.transforming = !1, this.debouncedProcessEnd = Et(this.processEnd), this.touches = [];
|
|
788
|
+
}, methods: { processMove: function(t, e) {
|
|
789
|
+
if (this.touches.length) {
|
|
790
|
+
if (this.touches.length === 1 && e.length === 1) this.$emit("move", new st({ left: this.touches[0].clientX - e[0].clientX, top: this.touches[0].clientY - e[0].clientY }));
|
|
791
|
+
else if (this.touches.length > 1 && this.touchResize) {
|
|
792
|
+
var i = ee(e, this.$refs.container), o = this.oldGeometricProperties;
|
|
793
|
+
o.count === i.count && o.count > 1 && this.$emit("resize", new st({ left: o.centerMass.left - i.centerMass.left, top: o.centerMass.top - i.centerMass.top }, { factor: o.spread / i.spread, center: i.centerMass })), this.oldGeometricProperties = i;
|
|
794
|
+
}
|
|
795
|
+
this.touches = e;
|
|
796
|
+
}
|
|
797
|
+
}, processEnd: function() {
|
|
798
|
+
this.transforming && (this.transforming = !1, this.$emit("transform-end"));
|
|
799
|
+
}, processStart: function() {
|
|
800
|
+
this.transforming = !0, this.debouncedProcessEnd.clear();
|
|
801
|
+
}, processEvent: function(t) {
|
|
802
|
+
return this.eventsFilter ? this.eventsFilter(t, this.transforming) !== !1 : (t.preventDefault(), t.stopPropagation(), !0);
|
|
803
|
+
}, onTouchStart: function(t) {
|
|
804
|
+
if (t.cancelable && (this.touchMove || this.touchResize && t.touches.length > 1) && this.processEvent(t)) {
|
|
805
|
+
var e = this.$refs.container, i = e.getBoundingClientRect(), o = i.left, s = i.top, n = i.bottom, a = i.right;
|
|
806
|
+
this.touches = Q(t.touches).filter((function(h) {
|
|
807
|
+
return h.clientX > o && h.clientX < a && h.clientY > s && h.clientY < n;
|
|
808
|
+
})), this.oldGeometricProperties = ee(this.touches, e);
|
|
809
|
+
}
|
|
810
|
+
}, onTouchEnd: function(t) {
|
|
811
|
+
t.touches.length === 0 && (this.touches = [], this.processEnd());
|
|
812
|
+
}, onTouchMove: function(t) {
|
|
813
|
+
var e = this;
|
|
814
|
+
if (this.touches.length) {
|
|
815
|
+
var i = Q(t.touches).filter((function(o) {
|
|
816
|
+
return !o.identifier || e.touches.find((function(s) {
|
|
817
|
+
return s.identifier === o.identifier;
|
|
818
|
+
}));
|
|
819
|
+
}));
|
|
820
|
+
this.processEvent(t) && (this.processMove(t, i), this.processStart());
|
|
821
|
+
}
|
|
822
|
+
}, onMouseDown: function(t) {
|
|
823
|
+
if (this.mouseMove && "buttons" in t && t.buttons === 1 && this.processEvent(t)) {
|
|
824
|
+
var e = { fake: !0, clientX: t.clientX, clientY: t.clientY };
|
|
825
|
+
this.touches = [e], this.processStart();
|
|
826
|
+
}
|
|
827
|
+
}, onMouseMove: function(t) {
|
|
828
|
+
this.touches.length && this.processEvent(t) && this.processMove(t, [{ clientX: t.clientX, clientY: t.clientY }]);
|
|
829
|
+
}, onMouseUp: function() {
|
|
830
|
+
this.touches = [], this.processEnd();
|
|
831
|
+
}, onWheel: function(t) {
|
|
832
|
+
if (this.wheelResize && this.processEvent(t)) {
|
|
833
|
+
var e = this.$refs.container.getBoundingClientRect(), i = e.left, o = e.top, s = 1 + this.wheelResize.ratio * (a = t.deltaY || t.detail || t.wheelDelta, (h = +a) == 0 || ae(h) ? h : h > 0 ? 1 : -1), n = { left: t.clientX - i, top: t.clientY - o };
|
|
834
|
+
this.$emit("resize", new st({}, { factor: s, center: n })), this.touches.length || this.debouncedProcessEnd();
|
|
835
|
+
}
|
|
836
|
+
var a, h;
|
|
837
|
+
} }, emits: ["resize", "move", "transform-end"] };
|
|
838
|
+
ve.render = function(t, e, i, o, s, n) {
|
|
839
|
+
return g(), z("div", { ref: "container", onTouchstart: e[1] || (e[1] = function() {
|
|
840
|
+
return n.onTouchStart && n.onTouchStart.apply(n, arguments);
|
|
841
|
+
}), onMousedown: e[2] || (e[2] = function() {
|
|
842
|
+
return n.onMouseDown && n.onMouseDown.apply(n, arguments);
|
|
843
|
+
}), onWheel: e[3] || (e[3] = function() {
|
|
844
|
+
return n.onWheel && n.onWheel.apply(n, arguments);
|
|
845
|
+
}) }, [K(t.$slots, "default")], 544);
|
|
846
|
+
};
|
|
847
|
+
var Ot = { components: { TransformableImage: ve }, props: { touchMove: { type: Boolean, required: !0 }, mouseMove: { type: Boolean, required: !0 }, touchResize: { type: Boolean, required: !0 }, wheelResize: { type: [Boolean, Object], required: !0 } }, emits: ["resize", "move"] };
|
|
848
|
+
Ot.render = function(t, e, i, o, s, n) {
|
|
849
|
+
var a = V("transformable-image");
|
|
850
|
+
return g(), z(a, { "touch-move": i.touchMove, "touch-resize": i.touchResize, "mouse-move": i.mouseMove, "wheel-resize": i.wheelResize, onMove: e[1] || (e[1] = function(h) {
|
|
851
|
+
return t.$emit("move", h);
|
|
852
|
+
}), onResize: e[2] || (e[2] = function(h) {
|
|
853
|
+
return t.$emit("resize", h);
|
|
854
|
+
}) }, { default: B((function() {
|
|
855
|
+
return [K(t.$slots, "default")];
|
|
856
|
+
})), _: 3 }, 8, ["touch-move", "touch-resize", "mouse-move", "wheel-resize"]);
|
|
857
|
+
};
|
|
858
|
+
var ut = $("vue-preview"), be = { props: { coordinates: { type: Object }, transitions: { type: Object }, image: { type: Object, default: function() {
|
|
859
|
+
return {};
|
|
860
|
+
} }, imageClass: { type: String }, width: { type: Number }, height: { type: Number }, fill: { type: Boolean } }, data: function() {
|
|
861
|
+
return { calculatedImageSize: { width: 0, height: 0 }, calculatedSize: { width: 0, height: 0 } };
|
|
862
|
+
}, computed: { classes: function() {
|
|
863
|
+
return { root: ut({ fill: this.fill }), wrapper: ut("wrapper"), imageWrapper: ut("image-wrapper"), image: M(ut("image"), this.imageClass) };
|
|
864
|
+
}, style: function() {
|
|
865
|
+
if (this.fill) return {};
|
|
866
|
+
var t = {};
|
|
867
|
+
return this.width && (t.width = "".concat(this.size.width, "px")), this.height && (t.height = "".concat(this.size.height, "px")), this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), t;
|
|
868
|
+
}, wrapperStyle: function() {
|
|
869
|
+
var t = { width: "".concat(this.size.width, "px"), height: "".concat(this.size.height, "px"), left: "calc(50% - ".concat(this.size.width / 2, "px)"), top: "calc(50% - ".concat(this.size.height / 2, "px)") };
|
|
870
|
+
return this.transitions && this.transitions.enabled && (t.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), t;
|
|
871
|
+
}, imageStyle: function() {
|
|
872
|
+
if (this.coordinates && this.image) {
|
|
873
|
+
var t = this.coordinates.width / this.size.width, e = w(w({ rotate: 0, flip: { horizontal: !1, vertical: !1 } }, this.image.transforms), {}, { scaleX: 1 / t, scaleY: 1 / t }), i = this.imageSize.width, o = this.imageSize.height, s = de({ width: i, height: o }, e.rotate), n = { width: "".concat(i, "px"), height: "".concat(o, "px"), left: "0px", top: "0px" }, a = { rotate: { left: (i - s.width) * e.scaleX / 2, top: (o - s.height) * e.scaleY / 2 }, scale: { left: (1 - e.scaleX) * i / 2, top: (1 - e.scaleY) * o / 2 } };
|
|
874
|
+
return n.transform = `translate(
|
|
875
|
+
`.concat(-this.coordinates.left / t - a.rotate.left - a.scale.left, "px,").concat(-this.coordinates.top / t - a.rotate.top - a.scale.top, "px) ") + ge(e), this.transitions && this.transitions.enabled && (n.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), n;
|
|
876
|
+
}
|
|
877
|
+
return {};
|
|
878
|
+
}, size: function() {
|
|
879
|
+
return { width: this.width || this.calculatedSize.width, height: this.height || this.calculatedSize.height };
|
|
880
|
+
}, imageSize: function() {
|
|
881
|
+
return { width: this.image.width || this.calculatedImageSize.width, height: this.image.height || this.calculatedImageSize.height };
|
|
882
|
+
} }, watch: { image: function(t) {
|
|
883
|
+
(t.width || t.height) && this.onChangeImage();
|
|
884
|
+
} }, mounted: function() {
|
|
885
|
+
var t = this;
|
|
886
|
+
this.onChangeImage(), this.$refs.image.addEventListener("load", (function() {
|
|
887
|
+
t.refreshImage();
|
|
888
|
+
})), window.addEventListener("resize", this.refresh), window.addEventListener("orientationchange", this.refresh);
|
|
889
|
+
}, unmounted: function() {
|
|
890
|
+
window.removeEventListener("resize", this.refresh), window.removeEventListener("orientationchange", this.refresh);
|
|
891
|
+
}, methods: { refreshImage: function() {
|
|
892
|
+
var t = this.$refs.image;
|
|
893
|
+
this.calculatedImageSize.height = t.naturalHeight, this.calculatedImageSize.width = t.naturalWidth;
|
|
894
|
+
}, refresh: function() {
|
|
895
|
+
var t = this.$refs.root;
|
|
896
|
+
this.width || (this.calculatedSize.width = t.clientWidth), this.height || (this.calculatedSize.height = t.clientHeight);
|
|
897
|
+
}, onChangeImage: function() {
|
|
898
|
+
var t = this.$refs.image;
|
|
899
|
+
t && t.complete && this.refreshImage(), this.refresh();
|
|
900
|
+
} } };
|
|
901
|
+
be.render = function(t, e, i, o, s, n) {
|
|
902
|
+
return g(), z("div", { ref: "root", class: n.classes.root, style: n.style }, [x("div", { ref: "wrapper", class: n.classes.wrapper, style: n.wrapperStyle }, [ie(x("img", { ref: "image", src: i.image && i.image.src, class: n.classes.image, style: n.imageStyle }, null, 14, ["src"]), [[ne, i.image && i.image.src]])], 6)], 6);
|
|
903
|
+
};
|
|
904
|
+
var we = { components: { Preview: be }, inheritAttrs: !1 };
|
|
905
|
+
we.render = function(t, e, i, o, s, n) {
|
|
906
|
+
var a = V("preview");
|
|
907
|
+
return g(), z(a, oe(t.$attrs, { fill: !0 }), null, 16);
|
|
908
|
+
};
|
|
909
|
+
var xt = $("vue-rectangle-stencil"), ye = { name: "RectangleStencil", components: { StencilPreview: we, BoundingBox: fe, DraggableArea: pe }, props: { image: { type: Object }, coordinates: { type: Object }, stencilCoordinates: { type: Object }, handlers: { type: Object }, handlersComponent: { type: [Object, String], default: function() {
|
|
910
|
+
return Ht;
|
|
911
|
+
} }, lines: { type: Object }, linesComponent: { type: [Object, String], default: function() {
|
|
912
|
+
return It;
|
|
913
|
+
} }, aspectRatio: { type: [Number, String] }, minAspectRatio: { type: [Number, String] }, maxAspectRatio: { type: [Number, String] }, movable: { type: Boolean, default: !0 }, resizable: { type: Boolean, default: !0 }, transitions: { type: Object }, movingClass: { type: String }, resizingClass: { type: String }, previewClass: { type: String }, boundingBoxClass: { type: String }, linesClasses: { type: Object, default: function() {
|
|
914
|
+
return {};
|
|
915
|
+
} }, linesWrappersClasses: { type: Object, default: function() {
|
|
916
|
+
return {};
|
|
917
|
+
} }, handlersClasses: { type: Object, default: function() {
|
|
918
|
+
return {};
|
|
919
|
+
} }, handlersWrappersClasses: { type: Object, default: function() {
|
|
920
|
+
return {};
|
|
921
|
+
} } }, data: function() {
|
|
922
|
+
return { moving: !1, resizing: !1 };
|
|
923
|
+
}, computed: { classes: function() {
|
|
924
|
+
return { stencil: M(xt({ movable: this.movable, moving: this.moving, resizing: this.resizing }), this.moving && this.movingClass, this.resizing && this.resizingClass), preview: M(xt("preview"), this.previewClass), boundingBox: M(xt("bounding-box"), this.boundingBoxClass) };
|
|
925
|
+
}, style: function() {
|
|
926
|
+
var t = this.stencilCoordinates, e = t.height, i = t.width, o = t.left, s = t.top, n = { width: "".concat(i, "px"), height: "".concat(e, "px"), transform: "translate(".concat(o, "px, ").concat(s, "px)") };
|
|
927
|
+
return this.transitions && this.transitions.enabled && (n.transition = "".concat(this.transitions.time, "ms ").concat(this.transitions.timingFunction)), n;
|
|
928
|
+
} }, methods: { onMove: function(t) {
|
|
929
|
+
this.$emit("move", t), this.moving = !0;
|
|
930
|
+
}, onMoveEnd: function() {
|
|
931
|
+
this.$emit("move-end"), this.moving = !1;
|
|
932
|
+
}, onResize: function(t) {
|
|
933
|
+
this.$emit("resize", t), this.resizing = !0;
|
|
934
|
+
}, onResizeEnd: function() {
|
|
935
|
+
this.$emit("resize-end"), this.resizing = !1;
|
|
936
|
+
}, aspectRatios: function() {
|
|
937
|
+
return { minimum: this.aspectRatio || this.minAspectRatio, maximum: this.aspectRatio || this.maxAspectRatio };
|
|
938
|
+
} }, emits: ["resize", "resize-end", "move", "move-end"] };
|
|
939
|
+
ye.render = function(t, e, i, o, s, n) {
|
|
940
|
+
var a = V("stencil-preview"), h = V("draggable-area"), r = V("bounding-box");
|
|
941
|
+
return g(), z("div", { class: n.classes.stencil, style: n.style }, [x(r, { width: i.stencilCoordinates.width, height: i.stencilCoordinates.height, transitions: i.transitions, class: n.classes.boundingBox, handlers: i.handlers, "handlers-component": i.handlersComponent, "handlers-classes": i.handlersClasses, "handlers-wrappers-classes": i.handlersWrappersClasses, lines: i.lines, "lines-component": i.linesComponent, "lines-classes": i.linesClasses, "lines-wrappers-classes": i.linesWrappersClasses, resizable: i.resizable, onResize: n.onResize, onResizeEnd: n.onResizeEnd }, { default: B((function() {
|
|
942
|
+
return [x(h, { movable: i.movable, onMove: n.onMove, onMoveEnd: n.onMoveEnd }, { default: B((function() {
|
|
943
|
+
return [x(a, { image: i.image, coordinates: i.coordinates, width: i.stencilCoordinates.width, height: i.stencilCoordinates.height, class: n.classes.preview, transitions: i.transitions }, null, 8, ["image", "coordinates", "width", "height", "class", "transitions"])];
|
|
944
|
+
})), _: 1 }, 8, ["movable", "onMove", "onMoveEnd"])];
|
|
945
|
+
})), _: 1 }, 8, ["width", "height", "transitions", "class", "handlers", "handlers-component", "handlers-classes", "handlers-wrappers-classes", "lines", "lines-component", "lines-classes", "lines-wrappers-classes", "resizable", "onResize", "onResizeEnd"])], 6);
|
|
946
|
+
};
|
|
947
|
+
var ni = ["transitions"], Y = $("vue-advanced-cropper"), ze = { name: "Cropper", components: { BackgroundWrapper: Ot }, props: { src: { type: String, default: null }, stencilComponent: { type: [Object, String], default: function() {
|
|
948
|
+
return ye;
|
|
949
|
+
} }, backgroundWrapperComponent: { type: [Object, String], default: function() {
|
|
950
|
+
return Ot;
|
|
951
|
+
} }, stencilProps: { type: Object, default: function() {
|
|
952
|
+
return {};
|
|
953
|
+
} }, autoZoom: { type: Boolean, default: !1 }, imageClass: { type: String }, boundariesClass: { type: String }, backgroundClass: { type: String }, foregroundClass: { type: String }, minWidth: { type: [Number, String] }, minHeight: { type: [Number, String] }, maxWidth: { type: [Number, String] }, maxHeight: { type: [Number, String] }, debounce: { type: [Boolean, Number], default: 500 }, transitions: { type: Boolean, default: !0 }, checkOrientation: { type: Boolean, default: !0 }, canvas: { type: [Object, Boolean], default: !0 }, crossOrigin: { type: [Boolean, String], default: void 0 }, transitionTime: { type: Number, default: 300 }, imageRestriction: { type: String, default: "fit-area", validator: function(t) {
|
|
954
|
+
return Ie.indexOf(t) !== -1;
|
|
955
|
+
} }, roundResult: { type: Boolean, default: !0 }, defaultSize: { type: [Function, Object] }, defaultPosition: { type: [Function, Object] }, defaultVisibleArea: { type: [Function, Object] }, defaultTransforms: { type: [Function, Object] }, defaultBoundaries: { type: [Function, String], validator: function(t) {
|
|
956
|
+
return !(typeof t == "string" && t !== "fill" && t !== "fit");
|
|
957
|
+
} }, priority: { type: String, default: "coordinates" }, stencilSize: { type: [Object, Function] }, resizeImage: { type: [Boolean, Object], default: !0 }, moveImage: { type: [Boolean, Object], default: !0 }, autoZoomAlgorithm: { type: Function }, resizeAlgorithm: { type: Function, default: function(t) {
|
|
958
|
+
var e = t.event, i = t.coordinates, o = t.aspectRatio, s = t.positionRestrictions, n = t.sizeRestrictions, a = f(f({}, i), { right: i.left + i.width, bottom: i.top + i.height }), h = e.params || {}, r = f({}, e.directions), l = h.allowedDirections || { left: !0, right: !0, bottom: !0, top: !0 };
|
|
959
|
+
n.widthFrozen && (r.left = 0, r.right = 0), n.heightFrozen && (r.top = 0, r.bottom = 0), j.forEach((function(N) {
|
|
960
|
+
l[N] || (r[N] = 0);
|
|
961
|
+
}));
|
|
962
|
+
var c = P(a, r = te({ coordinates: a, directions: r, sizeRestrictions: n, positionRestrictions: s })).width, u = P(a, r).height, d = h.preserveRatio ? y(a) : zt(c / u, o);
|
|
963
|
+
if (d) {
|
|
964
|
+
var m = h.respectDirection;
|
|
965
|
+
if (m || (m = a.width >= a.height || d === 1 ? "width" : "height"), m === "width") {
|
|
966
|
+
var v = c / d - a.height;
|
|
967
|
+
if (l.top && l.bottom) {
|
|
968
|
+
var b = r.top, O = r.bottom;
|
|
969
|
+
r.bottom = ct(v, O, b), r.top = ct(v, b, O);
|
|
970
|
+
} else l.bottom ? r.bottom = v : l.top ? r.top = v : l.right ? r.right = 0 : l.left && (r.left = 0);
|
|
971
|
+
} else if (m === "height") {
|
|
972
|
+
var T = a.width - u * d;
|
|
973
|
+
if (l.left && l.right) {
|
|
974
|
+
var k = r.left, Z = r.right;
|
|
975
|
+
r.left = -ct(T, k, Z), r.right = -ct(T, Z, k);
|
|
976
|
+
} else l.left ? r.left = -T : l.right ? r.right = -T : l.top ? r.top = 0 : l.bottom && (r.bottom = 0);
|
|
977
|
+
}
|
|
978
|
+
r = te({ directions: r, coordinates: a, sizeRestrictions: n, positionRestrictions: s, preserveRatio: !0, compensate: h.compensate });
|
|
979
|
+
}
|
|
980
|
+
return c = P(a, r).width, u = P(a, r).height, (d = h.preserveRatio ? y(a) : zt(c / u, o)) && Math.abs(d - c / u) > 1e-3 && j.forEach((function(N) {
|
|
981
|
+
l[N] || (r[N] = 0);
|
|
982
|
+
})), Wt({ event: new Dt({ left: -r.left, top: -r.top }), coordinates: { width: i.width + r.right + r.left, height: i.height + r.top + r.bottom, left: i.left, top: i.top }, positionRestrictions: s });
|
|
983
|
+
} }, moveAlgorithm: { type: Function, default: Wt }, initStretcher: { type: Function, default: function(t) {
|
|
984
|
+
var e = t.stretcher, i = t.imageSize, o = y(i);
|
|
985
|
+
e.style.width = i.width + "px", e.style.height = e.clientWidth / o + "px", e.style.width = e.clientWidth + "px";
|
|
986
|
+
} }, fitCoordinates: { type: Function, default: function(t) {
|
|
987
|
+
var e = t.visibleArea, i = t.coordinates, o = t.aspectRatio, s = t.sizeRestrictions, n = t.positionRestrictions, a = f(f({}, i), F({ width: i.width, height: i.height, aspectRatio: o, sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minHeight: Math.min(e.height, s.minHeight), minWidth: Math.min(e.width, s.minWidth) } }));
|
|
988
|
+
return a = C(a = D(a, tt(E(i), E(a))), gt(U(e), n));
|
|
989
|
+
} }, fitVisibleArea: { type: Function, default: function(t) {
|
|
990
|
+
var e = t.visibleArea, i = t.boundaries, o = t.getAreaRestrictions, s = t.coordinates, n = f({}, e);
|
|
991
|
+
n.height = n.width / y(i), n.top += (e.height - n.height) / 2, (s.height - n.height > 0 || s.width - n.width > 0) && (n = I(n, Math.max(s.height / n.height, s.width / n.width)));
|
|
992
|
+
var a = ft(it(s, U(n = I(n, pt(n, o({ visibleArea: n, type: "resize" }))))));
|
|
993
|
+
return n.width < s.width && (a.left = 0), n.height < s.height && (a.top = 0), n = C(n = D(n, a), o({ visibleArea: n, type: "move" }));
|
|
994
|
+
} }, areaRestrictionsAlgorithm: { type: Function, default: function(t) {
|
|
995
|
+
var e = t.visibleArea, i = t.boundaries, o = t.imageSize, s = t.imageRestriction, n = t.type, a = {};
|
|
996
|
+
return s === "fill-area" ? a = { left: 0, top: 0, right: o.width, bottom: o.height } : s === "fit-area" && (y(i) > y(o) ? (a = { top: 0, bottom: o.height }, e && n === "move" && (e.width > o.width ? (a.left = -(e.width - o.width) / 2, a.right = o.width - a.left) : (a.left = 0, a.right = o.width))) : (a = { left: 0, right: o.width }, e && n === "move" && (e.height > o.height ? (a.top = -(e.height - o.height) / 2, a.bottom = o.height - a.top) : (a.top = 0, a.bottom = o.height)))), a;
|
|
997
|
+
} }, sizeRestrictionsAlgorithm: { type: Function, default: function(t) {
|
|
998
|
+
return { minWidth: t.minWidth, minHeight: t.minHeight, maxWidth: t.maxWidth, maxHeight: t.maxHeight };
|
|
999
|
+
} }, positionRestrictionsAlgorithm: { type: Function, default: function(t) {
|
|
1000
|
+
var e = t.imageSize, i = {};
|
|
1001
|
+
return t.imageRestriction !== "none" && (i = { left: 0, top: 0, right: e.width, bottom: e.height }), i;
|
|
1002
|
+
} } }, data: function() {
|
|
1003
|
+
return { transitionsActive: !1, imageLoaded: !1, imageAttributes: { width: null, height: null, crossOrigin: null, src: null }, defaultImageTransforms: { rotate: 0, flip: { horizontal: !1, vertical: !1 } }, appliedImageTransforms: { rotate: 0, flip: { horizontal: !1, vertical: !1 } }, boundaries: { width: 0, height: 0 }, visibleArea: null, coordinates: w({}, Qt) };
|
|
1004
|
+
}, computed: { image: function() {
|
|
1005
|
+
return { src: this.imageAttributes.src, width: this.imageAttributes.width, height: this.imageAttributes.height, transforms: this.imageTransforms };
|
|
1006
|
+
}, imageTransforms: function() {
|
|
1007
|
+
return { rotate: this.appliedImageTransforms.rotate, flip: { horizontal: this.appliedImageTransforms.flip.horizontal, vertical: this.appliedImageTransforms.flip.vertical }, translateX: this.visibleArea ? this.visibleArea.left / this.coefficient : 0, translateY: this.visibleArea ? this.visibleArea.top / this.coefficient : 0, scaleX: 1 / this.coefficient, scaleY: 1 / this.coefficient };
|
|
1008
|
+
}, imageSize: function() {
|
|
1009
|
+
var t = (function(e) {
|
|
1010
|
+
return e * Math.PI / 180;
|
|
1011
|
+
})(this.imageTransforms.rotate);
|
|
1012
|
+
return { width: Math.abs(this.imageAttributes.width * Math.cos(t)) + Math.abs(this.imageAttributes.height * Math.sin(t)), height: Math.abs(this.imageAttributes.width * Math.sin(t)) + Math.abs(this.imageAttributes.height * Math.cos(t)) };
|
|
1013
|
+
}, initialized: function() {
|
|
1014
|
+
return !!(this.visibleArea && this.imageLoaded);
|
|
1015
|
+
}, settings: function() {
|
|
1016
|
+
var t = Ct(this.resizeImage, { touch: !0, wheel: { ratio: 0.1 }, adjustStencil: !0 }, { touch: !1, wheel: !1, adjustStencil: !1 });
|
|
1017
|
+
return { moveImage: Ct(this.moveImage, { touch: !0, mouse: !0 }, { touch: !1, mouse: !1 }), resizeImage: t };
|
|
1018
|
+
}, coefficient: function() {
|
|
1019
|
+
return this.visibleArea ? this.visibleArea.width / this.boundaries.width : 0;
|
|
1020
|
+
}, areaRestrictions: function() {
|
|
1021
|
+
return this.imageLoaded ? this.areaRestrictionsAlgorithm({ imageSize: this.imageSize, imageRestriction: this.imageRestriction, boundaries: this.boundaries }) : {};
|
|
1022
|
+
}, transitionsOptions: function() {
|
|
1023
|
+
return { enabled: this.transitionsActive, timingFunction: "ease-in-out", time: 350 };
|
|
1024
|
+
}, sizeRestrictions: function() {
|
|
1025
|
+
if (this.boundaries.width && this.boundaries.height && this.imageSize.width && this.imageSize.height) {
|
|
1026
|
+
var t = this.sizeRestrictionsAlgorithm({ imageSize: this.imageSize, minWidth: S(this.minWidth) ? 0 : ht(this.minWidth), minHeight: S(this.minHeight) ? 0 : ht(this.minHeight), maxWidth: S(this.maxWidth) ? 1 / 0 : ht(this.maxWidth), maxHeight: S(this.maxHeight) ? 1 / 0 : ht(this.maxHeight) });
|
|
1027
|
+
if (t = (function(o) {
|
|
1028
|
+
var s = o.areaRestrictions, n = o.sizeRestrictions, a = o.boundaries, h = o.positionRestrictions, r = f(f({}, n), { minWidth: n.minWidth !== void 0 ? n.minWidth : 0, minHeight: n.minHeight !== void 0 ? n.minHeight : 0, maxWidth: n.maxWidth !== void 0 ? n.maxWidth : 1 / 0, maxHeight: n.maxHeight !== void 0 ? n.maxHeight : 1 / 0 });
|
|
1029
|
+
h.left !== void 0 && h.right !== void 0 && (r.maxWidth = Math.min(r.maxWidth, h.right - h.left)), h.bottom !== void 0 && h.top !== void 0 && (r.maxHeight = Math.min(r.maxHeight, h.bottom - h.top));
|
|
1030
|
+
var l = Tt(s), c = ue(a, l);
|
|
1031
|
+
return l.width < 1 / 0 && (!r.maxWidth || r.maxWidth > c.width) && (r.maxWidth = Math.min(r.maxWidth, c.width)), l.height < 1 / 0 && (!r.maxHeight || r.maxHeight > c.height) && (r.maxHeight = Math.min(r.maxHeight, c.height)), r.minWidth > r.maxWidth && (r.minWidth = r.maxWidth, r.widthFrozen = !0), r.minHeight > r.maxHeight && (r.minHeight = r.maxHeight, r.heightFrozen = !0), r;
|
|
1032
|
+
})({ sizeRestrictions: t, areaRestrictions: this.getAreaRestrictions({ visibleArea: this.visibleArea, type: "resize" }), imageSize: this.imageSize, boundaries: this.boundaries, positionRestrictions: this.positionRestrictions, imageRestriction: this.imageRestriction, visibleArea: this.visibleArea, stencilSize: this.getStencilSize() }), this.visibleArea && this.stencilSize) {
|
|
1033
|
+
var e = this.getStencilSize(), i = Tt(this.getAreaRestrictions({ visibleArea: this.visibleArea, type: "resize" }));
|
|
1034
|
+
t.maxWidth = Math.min(t.maxWidth, i.width * e.width / this.boundaries.width), t.maxHeight = Math.min(t.maxHeight, i.height * e.height / this.boundaries.height), t.maxWidth < t.minWidth && (t.minWidth = t.maxWidth), t.maxHeight < t.minHeight && (t.minHeight = t.maxHeight);
|
|
1035
|
+
}
|
|
1036
|
+
return t;
|
|
1037
|
+
}
|
|
1038
|
+
return { minWidth: 0, minHeight: 0, maxWidth: 0, maxHeight: 0 };
|
|
1039
|
+
}, positionRestrictions: function() {
|
|
1040
|
+
return this.positionRestrictionsAlgorithm({ imageSize: this.imageSize, imageRestriction: this.imageRestriction });
|
|
1041
|
+
}, classes: function() {
|
|
1042
|
+
return { cropper: Y(), image: M(Y("image"), this.imageClass), stencil: Y("stencil"), boundaries: M(Y("boundaries"), this.boundariesClass), stretcher: M(Y("stretcher")), background: M(Y("background"), this.backgroundClass), foreground: M(Y("foreground"), this.foregroundClass), imageWrapper: M(Y("image-wrapper")), cropperWrapper: M(Y("cropper-wrapper")) };
|
|
1043
|
+
}, stencilCoordinates: function() {
|
|
1044
|
+
if (this.initialized) {
|
|
1045
|
+
var t = this.coordinates, e = t.width, i = t.height, o = t.left, s = t.top;
|
|
1046
|
+
return { width: e / this.coefficient, height: i / this.coefficient, left: (o - this.visibleArea.left) / this.coefficient, top: (s - this.visibleArea.top) / this.coefficient };
|
|
1047
|
+
}
|
|
1048
|
+
return this.defaultCoordinates();
|
|
1049
|
+
}, boundariesStyle: function() {
|
|
1050
|
+
var t = { width: this.boundaries.width ? "".concat(Math.round(this.boundaries.width), "px") : "auto", height: this.boundaries.height ? "".concat(Math.round(this.boundaries.height), "px") : "auto", transition: "opacity ".concat(this.transitionTime, "ms"), pointerEvents: this.imageLoaded ? "all" : "none" };
|
|
1051
|
+
return this.imageLoaded || (t.opacity = "0"), t;
|
|
1052
|
+
}, imageStyle: function() {
|
|
1053
|
+
var t = this.imageAttributes.width > this.imageAttributes.height ? { width: Math.min(1024, this.imageAttributes.width), height: Math.min(1024, this.imageAttributes.width) / (this.imageAttributes.width / this.imageAttributes.height) } : { height: Math.min(1024, this.imageAttributes.height), width: Math.min(1024, this.imageAttributes.height) * (this.imageAttributes.width / this.imageAttributes.height) }, e = { left: (t.width - this.imageSize.width) / (2 * this.coefficient), top: (t.height - this.imageSize.height) / (2 * this.coefficient) }, i = { left: (1 - 1 / this.coefficient) * t.width / 2, top: (1 - 1 / this.coefficient) * t.height / 2 }, o = w(w({}, this.imageTransforms), {}, { scaleX: this.imageTransforms.scaleX * (this.imageAttributes.width / t.width), scaleY: this.imageTransforms.scaleY * (this.imageAttributes.height / t.height) }), s = { width: "".concat(t.width, "px"), height: "".concat(t.height, "px"), left: "0px", top: "0px", transform: "translate(".concat(-e.left - i.left - this.imageTransforms.translateX, "px, ").concat(-e.top - i.top - this.imageTransforms.translateY, "px)") + ge(o) };
|
|
1054
|
+
return this.transitionsOptions.enabled && (s.transition = "".concat(this.transitionsOptions.time, "ms ").concat(this.transitionsOptions.timingFunction)), s;
|
|
1055
|
+
} }, watch: { src: function() {
|
|
1056
|
+
this.onChangeImage();
|
|
1057
|
+
}, stencilComponent: function() {
|
|
1058
|
+
var t = this;
|
|
1059
|
+
this.$nextTick((function() {
|
|
1060
|
+
t.resetCoordinates(), t.runAutoZoom("setCoordinates"), t.onChange();
|
|
1061
|
+
}));
|
|
1062
|
+
}, minWidth: function() {
|
|
1063
|
+
this.onPropsChange();
|
|
1064
|
+
}, maxWidth: function() {
|
|
1065
|
+
this.onPropsChange();
|
|
1066
|
+
}, minHeight: function() {
|
|
1067
|
+
this.onPropsChange();
|
|
1068
|
+
}, maxHeight: function() {
|
|
1069
|
+
this.onPropsChange();
|
|
1070
|
+
}, imageRestriction: function() {
|
|
1071
|
+
this.reset();
|
|
1072
|
+
}, stencilProps: function(t, e) {
|
|
1073
|
+
["aspectRatio", "minAspectRatio", "maxAspectRatio"].find((function(i) {
|
|
1074
|
+
return t[i] !== e[i];
|
|
1075
|
+
})) && this.$nextTick(this.onPropsChange);
|
|
1076
|
+
} }, created: function() {
|
|
1077
|
+
this.debouncedUpdate = Et(this.update, this.debounce), this.debouncedDisableTransitions = Et(this.disableTransitions, this.transitionsOptions.time), this.awaiting = !1;
|
|
1078
|
+
}, mounted: function() {
|
|
1079
|
+
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);
|
|
1080
|
+
}, unmounted: function() {
|
|
1081
|
+
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();
|
|
1082
|
+
}, methods: { getResult: function() {
|
|
1083
|
+
var t = this.initialized ? this.prepareResult(w({}, this.coordinates)) : this.defaultCoordinates(), e = { rotate: this.imageTransforms.rotate % 360, flip: w({}, this.imageTransforms.flip) };
|
|
1084
|
+
if (this.src && this.imageLoaded) {
|
|
1085
|
+
var i = this;
|
|
1086
|
+
return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? w({}, this.visibleArea) : null, imageTransforms: e, get canvas() {
|
|
1087
|
+
return i.canvas ? i.getCanvas() : void 0;
|
|
1088
|
+
} };
|
|
1089
|
+
}
|
|
1090
|
+
return { image: this.image, coordinates: t, visibleArea: this.visibleArea ? w({}, this.visibleArea) : null, canvas: void 0, imageTransforms: e };
|
|
1091
|
+
}, zoom: function(t, e) {
|
|
1092
|
+
var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
|
|
1093
|
+
this.onManipulateImage(new st({}, { factor: 1 / t, center: e }), { normalize: !1, transitions: s });
|
|
1094
|
+
}, move: function(t, e) {
|
|
1095
|
+
var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
|
|
1096
|
+
this.onManipulateImage(new st({ left: t || 0, top: e || 0 }), { normalize: !1, transitions: s });
|
|
1097
|
+
}, setCoordinates: function(t) {
|
|
1098
|
+
var e = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = i.autoZoom, s = o === void 0 || o, n = i.transitions, a = n === void 0 || n;
|
|
1099
|
+
this.$nextTick((function() {
|
|
1100
|
+
e.imageLoaded ? (e.transitionsActive || (a && e.enableTransitions(), e.coordinates = e.applyTransform(t), s && e.runAutoZoom("setCoordinates"), a && e.debouncedDisableTransitions()), e.onChange()) : e.delayedTransforms = t;
|
|
1101
|
+
}));
|
|
1102
|
+
}, refresh: function() {
|
|
1103
|
+
var t = this, e = this.$refs.image;
|
|
1104
|
+
if (this.src && e) return this.initialized ? this.updateVisibleArea().then((function() {
|
|
1105
|
+
t.onChange();
|
|
1106
|
+
})) : this.resetVisibleArea().then((function() {
|
|
1107
|
+
t.onChange();
|
|
1108
|
+
}));
|
|
1109
|
+
}, reset: function() {
|
|
1110
|
+
var t = this;
|
|
1111
|
+
return this.resetVisibleArea().then((function() {
|
|
1112
|
+
t.onChange(!1);
|
|
1113
|
+
}));
|
|
1114
|
+
}, awaitRender: function(t) {
|
|
1115
|
+
var e = this;
|
|
1116
|
+
this.awaiting || (this.awaiting = !0, this.$nextTick((function() {
|
|
1117
|
+
t(), e.awaiting = !1;
|
|
1118
|
+
})));
|
|
1119
|
+
}, prepareResult: function(t) {
|
|
1120
|
+
return this.roundResult ? (function(e) {
|
|
1121
|
+
var i = e.coordinates, o = e.sizeRestrictions, s = e.positionRestrictions, n = { width: Math.round(i.width), height: Math.round(i.height), left: Math.round(i.left), top: Math.round(i.top) };
|
|
1122
|
+
return n.width > o.maxWidth ? n.width = Math.floor(i.width) : n.width < o.minWidth && (n.width = Math.ceil(i.width)), n.height > o.maxHeight ? n.height = Math.floor(i.height) : n.height < o.minHeight && (n.height = Math.ceil(i.height)), C(n, s);
|
|
1123
|
+
})(w(w({}, this.getPublicProperties()), {}, { positionRestrictions: lt(this.positionRestrictions, this.visibleArea), coordinates: t })) : t;
|
|
1124
|
+
}, processAutoZoom: function(t, e, i, o) {
|
|
1125
|
+
var s = this.autoZoomAlgorithm;
|
|
1126
|
+
s || (s = this.stencilSize ? Pe : this.autoZoom ? je : Be);
|
|
1127
|
+
var n = s({ event: { type: t, params: o }, visibleArea: e, coordinates: i, boundaries: this.boundaries, aspectRatio: this.getAspectRatio(), positionRestrictions: this.positionRestrictions, getAreaRestrictions: this.getAreaRestrictions, sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize() });
|
|
1128
|
+
return w(w({}, n), {}, { changed: !Kt(n.visibleArea, e) || !Kt(n.coordinates, i) });
|
|
1129
|
+
}, runAutoZoom: function(t) {
|
|
1130
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, o = i !== void 0 && i, s = Ee(e, ni), n = this.processAutoZoom(t, this.visibleArea, this.coordinates, s), a = n.visibleArea, h = n.coordinates, r = n.changed;
|
|
1131
|
+
o && r && this.enableTransitions(), this.visibleArea = a, this.coordinates = h, o && r && this.debouncedDisableTransitions();
|
|
1132
|
+
}, normalizeEvent: function(t) {
|
|
1133
|
+
return (function(e) {
|
|
1134
|
+
var i = e.event, o = e.visibleArea, s = e.coefficient;
|
|
1135
|
+
if (i.type === "manipulateImage") return f(f({}, i), { move: { left: i.move && i.move.left ? s * i.move.left : 0, top: i.move && i.move.top ? s * i.move.top : 0 }, scale: { factor: i.scale && i.scale.factor ? i.scale.factor : 1, center: i.scale && i.scale.center ? { left: i.scale.center.left * s + o.left, top: i.scale.center.top * s + o.top } : null } });
|
|
1136
|
+
if (i.type === "resize") {
|
|
1137
|
+
var n = f(f({}, i), { directions: f({}, i.directions) });
|
|
1138
|
+
return j.forEach((function(h) {
|
|
1139
|
+
n.directions[h] *= s;
|
|
1140
|
+
})), n;
|
|
1141
|
+
}
|
|
1142
|
+
if (i.type === "move") {
|
|
1143
|
+
var a = f(f({}, i), { directions: f({}, i.directions) });
|
|
1144
|
+
return He.forEach((function(h) {
|
|
1145
|
+
a.directions[h] *= s;
|
|
1146
|
+
})), a;
|
|
1147
|
+
}
|
|
1148
|
+
return i;
|
|
1149
|
+
})(w(w({}, this.getPublicProperties()), {}, { event: t }));
|
|
1150
|
+
}, getCanvas: function() {
|
|
1151
|
+
if (this.$refs.canvas) {
|
|
1152
|
+
var t = this.$refs.canvas, e = this.$refs.image, i = this.imageTransforms.rotate !== 0 || this.imageTransforms.flip.horizontal || this.imageTransforms.flip.vertical ? (function(h, r, l) {
|
|
1153
|
+
var c = l.rotate, u = l.flip, d = { width: r.naturalWidth, height: r.naturalHeight }, m = de(d, c), v = h.getContext("2d");
|
|
1154
|
+
h.height = m.height, h.width = m.width, v.save();
|
|
1155
|
+
var b = q(E(f({ left: 0, top: 0 }, d)), c);
|
|
1156
|
+
return v.translate(-(b.left - m.width / 2), -(b.top - m.height / 2)), v.rotate(c * Math.PI / 180), v.translate(u.horizontal ? d.width : 0, u.vertical ? d.height : 0), v.scale(u.horizontal ? -1 : 1, u.vertical ? -1 : 1), v.drawImage(r, 0, 0, d.width, d.height), v.restore(), h;
|
|
1157
|
+
})(this.$refs.sourceCanvas, e, this.imageTransforms) : e, o = w({ minWidth: 0, minHeight: 0, maxWidth: 1 / 0, maxHeight: 1 / 0, maxArea: this.maxCanvasSize, imageSmoothingEnabled: !0, imageSmoothingQuality: "high", fillColor: "transparent" }, this.canvas), s = function(h) {
|
|
1158
|
+
return h.find((function(r) {
|
|
1159
|
+
return l = r, !Number.isNaN(parseFloat(l)) && isFinite(l);
|
|
1160
|
+
var l;
|
|
1161
|
+
}));
|
|
1162
|
+
}, n = F({ sizeRestrictions: { minWidth: s([o.width, o.minWidth]) || 0, minHeight: s([o.height, o.minHeight]) || 0, maxWidth: s([o.width, o.maxWidth]) || 1 / 0, maxHeight: s([o.height, o.maxHeight]) || 1 / 0 }, width: this.coordinates.width, height: this.coordinates.height, aspectRatio: { minimum: this.coordinates.width / this.coordinates.height, maximum: this.coordinates.width / this.coordinates.height } });
|
|
1163
|
+
if (o.maxArea && n.width * n.height > o.maxArea) {
|
|
1164
|
+
var a = Math.sqrt(o.maxArea / (n.width * n.height));
|
|
1165
|
+
n = { width: Math.round(a * n.width), height: Math.round(a * n.height) };
|
|
1166
|
+
}
|
|
1167
|
+
return (function(h, r, l, c, u) {
|
|
1168
|
+
h.width = c ? c.width : l.width, h.height = c ? c.height : l.height;
|
|
1169
|
+
var d = h.getContext("2d");
|
|
1170
|
+
d.clearRect(0, 0, h.width, h.height), u && (u.imageSmoothingEnabled && (d.imageSmoothingEnabled = u.imageSmoothingEnabled), u.imageSmoothingQuality && (d.imageSmoothingQuality = u.imageSmoothingQuality), u.fillColor && (d.fillStyle = u.fillColor, d.fillRect(0, 0, h.width, h.height), d.save()));
|
|
1171
|
+
var m = l.left < 0 ? -l.left : 0, v = l.top < 0 ? -l.top : 0;
|
|
1172
|
+
d.drawImage(r, l.left + m, l.top + v, l.width, l.height, m * (h.width / l.width), v * (h.height / l.height), h.width, h.height);
|
|
1173
|
+
})(t, i, this.coordinates, n, o), t;
|
|
1174
|
+
}
|
|
1175
|
+
}, update: function() {
|
|
1176
|
+
this.$emit("change", this.getResult());
|
|
1177
|
+
}, applyTransform: function(t) {
|
|
1178
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = this.visibleArea && e ? $e(this.sizeRestrictions, this.visibleArea) : this.sizeRestrictions, o = this.visibleArea && e ? lt(this.positionRestrictions, this.visibleArea) : this.positionRestrictions;
|
|
1179
|
+
return ke({ transform: t, coordinates: this.coordinates, imageSize: this.imageSize, sizeRestrictions: i, positionRestrictions: o, aspectRatio: this.getAspectRatio(), visibleArea: this.visibleArea });
|
|
1180
|
+
}, resetCoordinates: function() {
|
|
1181
|
+
var t = this;
|
|
1182
|
+
if (this.$refs.image) {
|
|
1183
|
+
this.$refs.cropper, this.$refs.image;
|
|
1184
|
+
var e = this.defaultSize;
|
|
1185
|
+
e || (e = this.stencilSize ? Ye : Xe);
|
|
1186
|
+
var i = this.sizeRestrictions;
|
|
1187
|
+
i.minWidth, i.minHeight, i.maxWidth, i.maxHeight;
|
|
1188
|
+
var o = _(e) ? e({ boundaries: this.boundaries, imageSize: this.imageSize, aspectRatio: this.getAspectRatio(), sizeRestrictions: this.sizeRestrictions, stencilSize: this.getStencilSize(), visibleArea: this.visibleArea }) : e, s = this.defaultPosition || Ue, n = [o, function(a) {
|
|
1189
|
+
var h = a.coordinates;
|
|
1190
|
+
return w({}, _(s) ? s({ coordinates: h, imageSize: t.imageSize, visibleArea: t.visibleArea }) : t.defaultPosition);
|
|
1191
|
+
}];
|
|
1192
|
+
this.delayedTransforms && n.push.apply(n, Q(Array.isArray(this.delayedTransforms) ? this.delayedTransforms : [this.delayedTransforms])), this.coordinates = this.applyTransform(n, !0), this.delayedTransforms = null;
|
|
1193
|
+
}
|
|
1194
|
+
}, clearImage: function() {
|
|
1195
|
+
var t = this;
|
|
1196
|
+
this.imageLoaded = !1, setTimeout((function() {
|
|
1197
|
+
var e = t.$refs.stretcher;
|
|
1198
|
+
e && (e.style.height = "auto", e.style.width = "auto"), t.coordinates = t.defaultCoordinates(), t.boundaries = { width: 0, height: 0 };
|
|
1199
|
+
}), this.transitionTime);
|
|
1200
|
+
}, enableTransitions: function() {
|
|
1201
|
+
this.transitions && (this.transitionsActive = !0);
|
|
1202
|
+
}, disableTransitions: function() {
|
|
1203
|
+
this.transitionsActive = !1;
|
|
1204
|
+
}, updateBoundaries: function() {
|
|
1205
|
+
var t = this, e = this.$refs.stretcher, i = this.$refs.cropper;
|
|
1206
|
+
return this.initStretcher({ cropper: i, stretcher: e, imageSize: this.imageSize }), this.$nextTick().then((function() {
|
|
1207
|
+
var o = { cropper: i, imageSize: t.imageSize };
|
|
1208
|
+
if (_(t.defaultBoundaries) ? t.boundaries = t.defaultBoundaries(o) : t.defaultBoundaries === "fit" ? t.boundaries = (function(s) {
|
|
1209
|
+
var n = s.cropper, a = s.imageSize, h = n.clientHeight, r = n.clientWidth, l = h, c = a.width * h / a.height;
|
|
1210
|
+
return c > r && (c = r, l = a.height * r / a.width), { width: c, height: l };
|
|
1211
|
+
})(o) : t.boundaries = (function(s) {
|
|
1212
|
+
var n = s.cropper;
|
|
1213
|
+
return { width: n.clientWidth, height: n.clientHeight };
|
|
1214
|
+
})(o), !t.boundaries.width || !t.boundaries.height) throw new Error("It's impossible to fit the cropper in the current container");
|
|
1215
|
+
}));
|
|
1216
|
+
}, resetVisibleArea: function() {
|
|
1217
|
+
var t = this;
|
|
1218
|
+
return this.appliedImageTransforms = w(w({}, this.defaultImageTransforms), {}, { flip: w({}, this.defaultImageTransforms.flip) }), this.updateBoundaries().then((function() {
|
|
1219
|
+
t.priority !== "visible-area" && (t.visibleArea = null, t.resetCoordinates());
|
|
1220
|
+
var e, i, o, s, n, a, h = t.defaultVisibleArea || Fe;
|
|
1221
|
+
t.visibleArea = _(h) ? h({ imageSize: t.imageSize, boundaries: t.boundaries, coordinates: t.priority !== "visible-area" ? t.coordinates : null, getAreaRestrictions: t.getAreaRestrictions, stencilSize: t.getStencilSize() }) : t.defaultVisibleArea, t.visibleArea = (e = { visibleArea: t.visibleArea, boundaries: t.boundaries, getAreaRestrictions: t.getAreaRestrictions }, i = e.visibleArea, o = e.boundaries, s = e.getAreaRestrictions, n = f({}, i), a = y(o), n.width / n.height !== a && (n.height = n.width / a), C(n, s({ visibleArea: n, type: "move" }))), t.priority === "visible-area" ? t.resetCoordinates() : t.coordinates = t.fitCoordinates({ visibleArea: t.visibleArea, coordinates: t.coordinates, aspectRatio: t.getAspectRatio(), positionRestrictions: t.positionRestrictions, sizeRestrictions: t.sizeRestrictions }), t.runAutoZoom("resetVisibleArea");
|
|
1222
|
+
})).catch((function() {
|
|
1223
|
+
t.visibleArea = null;
|
|
1224
|
+
}));
|
|
1225
|
+
}, updateVisibleArea: function() {
|
|
1226
|
+
var t = this;
|
|
1227
|
+
return this.updateBoundaries().then((function() {
|
|
1228
|
+
t.visibleArea = t.fitVisibleArea({ imageSize: t.imageSize, boundaries: t.boundaries, visibleArea: t.visibleArea, coordinates: t.coordinates, getAreaRestrictions: t.getAreaRestrictions }), t.coordinates = t.fitCoordinates({ visibleArea: t.visibleArea, coordinates: t.coordinates, aspectRatio: t.getAspectRatio(), positionRestrictions: t.positionRestrictions, sizeRestrictions: t.sizeRestrictions }), t.runAutoZoom("updateVisibleArea");
|
|
1229
|
+
})).catch((function() {
|
|
1230
|
+
t.visibleArea = null;
|
|
1231
|
+
}));
|
|
1232
|
+
}, onChange: function() {
|
|
1233
|
+
var t = !(arguments.length > 0 && arguments[0] !== void 0) || arguments[0];
|
|
1234
|
+
t && this.debounce ? this.debouncedUpdate() : this.update();
|
|
1235
|
+
}, onChangeImage: function() {
|
|
1236
|
+
var t, e = this;
|
|
1237
|
+
if (this.imageLoaded = !1, this.delayedTransforms = null, this.src) {
|
|
1238
|
+
if ((function(s) {
|
|
1239
|
+
if (Zt(s)) return !1;
|
|
1240
|
+
var n = window.location, a = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(s) || [], h = { protocol: a[1] || "", host: a[2] || "", port: a[3] || "" }, r = function(l) {
|
|
1241
|
+
return l.port || ((l.protocol || n.protocol) === "http" ? 80 : 433);
|
|
1242
|
+
};
|
|
1243
|
+
return !(!h.protocol && !h.host && !h.port || h.protocol && h.protocol == n.protocol && h.host && h.host == n.host && h.host && r(h) == r(n));
|
|
1244
|
+
})(this.src)) {
|
|
1245
|
+
var i = S(this.crossOrigin) ? this.canvas : this.crossOrigin;
|
|
1246
|
+
i === !0 && (i = "anonymous"), this.imageAttributes.crossOrigin = i || null;
|
|
1247
|
+
}
|
|
1248
|
+
if (this.checkOrientation) {
|
|
1249
|
+
var o = (t = this.src, new Promise((function(s) {
|
|
1250
|
+
ei(t).then((function(n) {
|
|
1251
|
+
var a = ii(n);
|
|
1252
|
+
s(n ? { source: t, arrayBuffer: n, orientation: a } : { source: t, arrayBuffer: null, orientation: null });
|
|
1253
|
+
})).catch((function(n) {
|
|
1254
|
+
console.warn(n), s({ source: t, arrayBuffer: null, orientation: null });
|
|
1255
|
+
}));
|
|
1256
|
+
})));
|
|
1257
|
+
setTimeout((function() {
|
|
1258
|
+
o.then(e.onParseImage);
|
|
1259
|
+
}), this.transitionTime);
|
|
1260
|
+
} else setTimeout((function() {
|
|
1261
|
+
e.onParseImage({ source: e.src });
|
|
1262
|
+
}), this.transitionTime);
|
|
1263
|
+
} else this.clearImage();
|
|
1264
|
+
}, onFailLoadImage: function() {
|
|
1265
|
+
this.imageAttributes.src && (this.clearImage(), this.$emit("error"));
|
|
1266
|
+
}, onSuccessLoadImage: function() {
|
|
1267
|
+
var t = this, e = this.$refs.image;
|
|
1268
|
+
e && !this.imageLoaded && (this.imageAttributes.height = e.naturalHeight, this.imageAttributes.width = e.naturalWidth, this.imageLoaded = !0, this.resetVisibleArea().then((function() {
|
|
1269
|
+
t.$emit("ready"), t.onChange(!1);
|
|
1270
|
+
})));
|
|
1271
|
+
}, onParseImage: function(t) {
|
|
1272
|
+
var e = this, i = t.source, o = t.arrayBuffer, s = t.orientation;
|
|
1273
|
+
this.imageAttributes.revoke && this.imageAttributes.src && URL.revokeObjectURL(this.imageAttributes.src), this.imageAttributes.revoke = !1, o && s && s > 1 ? re(i) || !Zt(i) ? (this.imageAttributes.src = URL.createObjectURL(new Blob([o])), this.imageAttributes.revoke = !0) : this.imageAttributes.src = (function(n) {
|
|
1274
|
+
for (var a = [], h = new Uint8Array(n); h.length > 0; ) {
|
|
1275
|
+
var r = h.subarray(0, 8192);
|
|
1276
|
+
a.push(String.fromCharCode.apply(null, Array.from ? Array.from(r) : r.slice())), h = h.subarray(8192);
|
|
1277
|
+
}
|
|
1278
|
+
return "data:image/jpeg;base64," + btoa(a.join(""));
|
|
1279
|
+
})(o) : this.imageAttributes.src = i, _(this.defaultTransforms) ? this.appliedImageTransforms = At(this.defaultTransforms()) : dt(this.defaultTransforms) ? this.appliedImageTransforms = At(this.defaultTransforms) : this.appliedImageTransforms = (function(n) {
|
|
1280
|
+
var a = At({});
|
|
1281
|
+
if (n) switch (n) {
|
|
1282
|
+
case 2:
|
|
1283
|
+
a.flip.horizontal = !0;
|
|
1284
|
+
break;
|
|
1285
|
+
case 3:
|
|
1286
|
+
a.rotate = -180;
|
|
1287
|
+
break;
|
|
1288
|
+
case 4:
|
|
1289
|
+
a.flip.vertical = !0;
|
|
1290
|
+
break;
|
|
1291
|
+
case 5:
|
|
1292
|
+
a.rotate = 90, a.flip.vertical = !0;
|
|
1293
|
+
break;
|
|
1294
|
+
case 6:
|
|
1295
|
+
a.rotate = 90;
|
|
1296
|
+
break;
|
|
1297
|
+
case 7:
|
|
1298
|
+
a.rotate = 90, a.flip.horizontal = !0;
|
|
1299
|
+
break;
|
|
1300
|
+
case 8:
|
|
1301
|
+
a.rotate = -90;
|
|
1302
|
+
}
|
|
1303
|
+
return a;
|
|
1304
|
+
})(s), this.defaultImageTransforms = w(w({}, this.appliedImageTransforms), {}, { flip: w({}, this.appliedImageTransforms.flip) }), this.$nextTick((function() {
|
|
1305
|
+
var n = e.$refs.image;
|
|
1306
|
+
n && n.complete && ((function(a) {
|
|
1307
|
+
return !!a.naturalWidth;
|
|
1308
|
+
})(n) ? e.onSuccessLoadImage() : e.onFailLoadImage());
|
|
1309
|
+
}));
|
|
1310
|
+
}, onResizeEnd: function() {
|
|
1311
|
+
this.runAutoZoom("resize", { transitions: !0 });
|
|
1312
|
+
}, onMoveEnd: function() {
|
|
1313
|
+
this.runAutoZoom("move", { transitions: !0 });
|
|
1314
|
+
}, onMove: function(t) {
|
|
1315
|
+
var e = this;
|
|
1316
|
+
this.transitionsOptions.enabled || this.awaitRender((function() {
|
|
1317
|
+
e.coordinates = e.moveAlgorithm(w(w({}, e.getPublicProperties()), {}, { positionRestrictions: lt(e.positionRestrictions, e.visibleArea), coordinates: e.coordinates, event: e.normalizeEvent(t) })), e.onChange();
|
|
1318
|
+
}));
|
|
1319
|
+
}, onResize: function(t) {
|
|
1320
|
+
var e = this;
|
|
1321
|
+
this.transitionsOptions.enabled || this.stencilSize && !this.autoZoom || this.awaitRender((function() {
|
|
1322
|
+
var i = e.sizeRestrictions, o = Math.min(e.coordinates.width, e.coordinates.height, 20 * e.coefficient);
|
|
1323
|
+
e.coordinates = e.resizeAlgorithm(w(w({}, e.getPublicProperties()), {}, { positionRestrictions: lt(e.positionRestrictions, e.visibleArea), sizeRestrictions: { maxWidth: Math.min(i.maxWidth, e.visibleArea.width), maxHeight: Math.min(i.maxHeight, e.visibleArea.height), minWidth: Math.max(i.minWidth, o), minHeight: Math.max(i.minHeight, o) }, event: e.normalizeEvent(t) })), e.onChange(), e.ticking = !1;
|
|
1324
|
+
}));
|
|
1325
|
+
}, onManipulateImage: function(t) {
|
|
1326
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1327
|
+
if (!this.transitionsOptions.enabled) {
|
|
1328
|
+
var i = e.transitions, o = i !== void 0 && i, s = e.normalize, n = s === void 0 || s;
|
|
1329
|
+
o && this.enableTransitions();
|
|
1330
|
+
var a = Ve(w(w({}, this.getPublicProperties()), {}, { event: n ? this.normalizeEvent(t) : t, getAreaRestrictions: this.getAreaRestrictions, imageRestriction: this.imageRestriction, adjustStencil: !this.stencilSize && this.settings.resizeImage.adjustStencil })), h = a.visibleArea, r = a.coordinates;
|
|
1331
|
+
this.visibleArea = h, this.coordinates = r, this.runAutoZoom("manipulateImage"), this.onChange(), o && this.debouncedDisableTransitions();
|
|
1332
|
+
}
|
|
1333
|
+
}, onPropsChange: function() {
|
|
1334
|
+
this.coordinates = this.applyTransform(this.coordinates, !0), this.onChange(!1);
|
|
1335
|
+
}, getAreaRestrictions: function() {
|
|
1336
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = t.visibleArea, i = t.type, o = i === void 0 ? "move" : i;
|
|
1337
|
+
return this.areaRestrictionsAlgorithm({ boundaries: this.boundaries, imageSize: this.imageSize, imageRestriction: this.imageRestriction, visibleArea: e, type: o });
|
|
1338
|
+
}, getAspectRatio: function(t) {
|
|
1339
|
+
var e, i, o = this.stencilProps, s = o.aspectRatio, n = o.minAspectRatio, a = o.maxAspectRatio;
|
|
1340
|
+
if (this.$refs.stencil && this.$refs.stencil.aspectRatios) {
|
|
1341
|
+
var h = this.$refs.stencil.aspectRatios();
|
|
1342
|
+
e = h.minimum, i = h.maximum;
|
|
1343
|
+
}
|
|
1344
|
+
if (S(e) && (e = S(s) ? n : s), S(i) && (i = S(s) ? a : s), !t && (S(e) || S(i))) {
|
|
1345
|
+
var r = this.getStencilSize(), l = r ? y(r) : null;
|
|
1346
|
+
S(e) && (e = Gt(l) ? l : void 0), S(i) && (i = Gt(l) ? l : void 0);
|
|
1347
|
+
}
|
|
1348
|
+
return { minimum: e, maximum: i };
|
|
1349
|
+
}, getStencilSize: function() {
|
|
1350
|
+
if (this.stencilSize) return t = { currentStencilSize: { width: this.stencilCoordinates.width, height: this.stencilCoordinates.height }, stencilSize: this.stencilSize, boundaries: this.boundaries, coefficient: this.coefficient, coordinates: this.coordinates, aspectRatio: this.getAspectRatio(!0) }, e = t.boundaries, i = t.stencilSize, o = t.aspectRatio, zt(y(s = _(i) ? i({ boundaries: e, aspectRatio: o }) : i), o) && (s = F({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: s.width, height: s.height, aspectRatio: { minimum: o.minimum, maximum: o.maximum } })), (s.width > e.width || s.height > e.height) && (s = F({ sizeRestrictions: { maxWidth: e.width, maxHeight: e.height, minWidth: 0, minHeight: 0 }, width: s.width, height: s.height, aspectRatio: { minimum: y(s), maximum: y(s) } })), s;
|
|
1351
|
+
var t, e, i, o, s;
|
|
1352
|
+
}, getPublicProperties: function() {
|
|
1353
|
+
return { coefficient: this.coefficient, visibleArea: this.visibleArea, coordinates: this.coordinates, boundaries: this.boundaries, sizeRestrictions: this.sizeRestrictions, positionRestrictions: this.positionRestrictions, aspectRatio: this.getAspectRatio(), imageRestriction: this.imageRestriction };
|
|
1354
|
+
}, defaultCoordinates: function() {
|
|
1355
|
+
return w({}, Qt);
|
|
1356
|
+
}, flip: function(t, e) {
|
|
1357
|
+
var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = i.transitions, s = o === void 0 || o;
|
|
1358
|
+
if (!this.transitionsActive) {
|
|
1359
|
+
s && this.enableTransitions();
|
|
1360
|
+
var n = w({}, this.imageTransforms.flip), a = qe({ flip: { horizontal: t ? !n.horizontal : n.horizontal, vertical: e ? !n.vertical : n.vertical }, previousFlip: n, rotate: this.imageTransforms.rotate, visibleArea: this.visibleArea, coordinates: this.coordinates, imageSize: this.imageSize, positionRestrictions: this.positionRestrictions, sizeRestrictions: this.sizeRestrictions, getAreaRestrictions: this.getAreaRestrictions, aspectRatio: this.getAspectRatio() }), h = a.visibleArea, r = a.coordinates;
|
|
1361
|
+
t && (this.appliedImageTransforms.flip.horizontal = !this.appliedImageTransforms.flip.horizontal), e && (this.appliedImageTransforms.flip.vertical = !this.appliedImageTransforms.flip.vertical), this.visibleArea = h, this.coordinates = r, this.onChange(), s && this.debouncedDisableTransitions();
|
|
1362
|
+
}
|
|
1363
|
+
}, rotate: function(t) {
|
|
1364
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = e.transitions, o = i === void 0 || i;
|
|
1365
|
+
if (!this.transitionsActive) {
|
|
1366
|
+
o && this.enableTransitions();
|
|
1367
|
+
var s = w({}, this.imageSize);
|
|
1368
|
+
this.appliedImageTransforms.rotate += t;
|
|
1369
|
+
var n = Ne({ visibleArea: this.visibleArea, coordinates: this.coordinates, previousImageSize: s, imageSize: this.imageSize, angle: t, positionRestrictions: this.positionRestrictions, sizeRestrictions: this.sizeRestrictions, getAreaRestrictions: this.getAreaRestrictions, aspectRatio: this.getAspectRatio() }), a = n.visibleArea, h = n.coordinates, r = this.processAutoZoom("rotateImage", a, h);
|
|
1370
|
+
a = r.visibleArea, h = r.coordinates, this.visibleArea = a, this.coordinates = h, this.onChange(), o && this.debouncedDisableTransitions();
|
|
1371
|
+
}
|
|
1372
|
+
} }, emits: ["change", "error", "ready"] }, oi = { key: 0, ref: "canvas", style: { display: "none" } }, si = { key: 1, ref: "sourceCanvas", style: { display: "none" } };
|
|
1373
|
+
ze.render = function(t, e, i, o, s, n) {
|
|
1374
|
+
return g(), z("div", { ref: "cropper", class: n.classes.cropper }, [x("div", { ref: "stretcher", class: n.classes.stretcher }, null, 2), x("div", { class: n.classes.boundaries, style: n.boundariesStyle }, [(g(), z(mt(i.backgroundWrapperComponent), { class: n.classes.cropperWrapper, "wheel-resize": n.settings.resizeImage.wheel, "touch-resize": n.settings.resizeImage.touch, "touch-move": n.settings.moveImage.touch, "mouse-move": n.settings.moveImage.mouse, onMove: n.onManipulateImage, onResize: n.onManipulateImage }, { default: B((function() {
|
|
1375
|
+
return [x("div", { class: n.classes.background, style: n.boundariesStyle }, null, 6), x("div", { class: n.classes.imageWrapper }, [x("img", { ref: "image", crossorigin: s.imageAttributes.crossOrigin, src: s.imageAttributes.src, class: n.classes.image, style: n.imageStyle, onMousedown: e[1] || (e[1] = Re((function() {
|
|
1376
|
+
}), ["prevent"])) }, null, 46, ["crossorigin", "src"])], 2), x("div", { class: n.classes.foreground, style: n.boundariesStyle }, null, 6), ie((g(), z(mt(i.stencilComponent), oe({ ref: "stencil", image: n.image, coordinates: s.coordinates, "stencil-coordinates": n.stencilCoordinates, transitions: n.transitionsOptions }, i.stencilProps, { onResize: n.onResize, onResizeEnd: n.onResizeEnd, onMove: n.onMove, onMoveEnd: n.onMoveEnd }), null, 16, ["image", "coordinates", "stencil-coordinates", "transitions", "onResize", "onResizeEnd", "onMove", "onMoveEnd"])), [[ne, s.imageLoaded]]), i.canvas ? (g(), z("canvas", oi, null, 512)) : L("", !0), i.canvas ? (g(), z("canvas", si, null, 512)) : L("", !0)];
|
|
1377
|
+
})), _: 1 }, 8, ["class", "wheel-resize", "touch-resize", "touch-move", "mouse-move", "onMove", "onResize"]))], 6)], 2);
|
|
1378
|
+
};
|
|
1379
|
+
const ri = { class: "flex flex-col gap-y-5 relative" }, ai = ["src"], hi = {
|
|
1380
|
+
key: 2,
|
|
1381
|
+
class: "absolute top-0 bottom-0 right-0 left-0 flex items-center justify-center h-[300px]"
|
|
1382
|
+
}, li = { class: "flex gap-x-1 justify-center relative" }, ci = { class: "grid grid-cols-2 gap-4" }, ui = {
|
|
1383
|
+
key: 1,
|
|
1384
|
+
class: "flex items-center gap-x-2 justify-normal"
|
|
1385
|
+
}, di = { class: "w-auto" }, gi = {
|
|
1386
|
+
__name: "OcCropper",
|
|
1387
|
+
props: {
|
|
1388
|
+
inputOptions: Array,
|
|
1389
|
+
inputOptionValues: Object,
|
|
1390
|
+
img: String,
|
|
1391
|
+
maxSize: [String, Number],
|
|
1392
|
+
isReplaceImage: {
|
|
1393
|
+
type: Boolean,
|
|
1394
|
+
default: !0
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
emits: ["changeImage", "update:input-options"],
|
|
1398
|
+
setup(t, { emit: e }) {
|
|
1399
|
+
const i = t, o = e, s = X(), n = X(), a = X(""), h = X(), r = X(!1), l = X(i.inputOptionValues ?? {}), c = Ae(() => {
|
|
1400
|
+
var R;
|
|
1401
|
+
return !((R = s.value) != null && R.initialized);
|
|
1402
|
+
});
|
|
1403
|
+
Ft(
|
|
1404
|
+
() => i.inputOptionValues,
|
|
1405
|
+
() => {
|
|
1406
|
+
l.value = i.inputOptionValues;
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
deep: !0
|
|
1410
|
+
}
|
|
1411
|
+
), Ft(
|
|
1412
|
+
() => i.img,
|
|
1413
|
+
(R) => {
|
|
1414
|
+
R && xe(() => {
|
|
1415
|
+
try {
|
|
1416
|
+
const p = new URL(R);
|
|
1417
|
+
p.protocol === "http:" || p.protocol === "https:" ? a.value = `${R}?${Date.now()}` : a.value = R;
|
|
1418
|
+
} catch {
|
|
1419
|
+
a.value = R;
|
|
1420
|
+
}
|
|
1421
|
+
});
|
|
1422
|
+
},
|
|
1423
|
+
{ immediate: !0 }
|
|
1424
|
+
);
|
|
1425
|
+
const u = () => {
|
|
1426
|
+
if (a.value && r.value) {
|
|
1427
|
+
const { canvas: R } = s.value.getResult(), p = !(s.value.image.width === R.width && s.value.image.height === R.height && !s.value.imageTransforms.rotate);
|
|
1428
|
+
o("changeImage", {
|
|
1429
|
+
url: R.toDataURL(),
|
|
1430
|
+
cropper: {
|
|
1431
|
+
isChanged: p,
|
|
1432
|
+
file: h.value
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
r.value = !0;
|
|
1437
|
+
}, d = (R) => {
|
|
1438
|
+
var p;
|
|
1439
|
+
return (p = s.value) == null ? void 0 : p.rotate(R);
|
|
1440
|
+
}, m = (R) => {
|
|
1441
|
+
var p;
|
|
1442
|
+
return (p = s.value) == null ? void 0 : p.zoom(R);
|
|
1443
|
+
}, v = () => {
|
|
1444
|
+
n.value.click();
|
|
1445
|
+
}, b = (R) => {
|
|
1446
|
+
if (R.target.files[0] / (1024 * 1024) > +i.maxSize)
|
|
1447
|
+
return R.preventDefault(), !1;
|
|
1448
|
+
h.value = R.target.files[0], a.value = URL.createObjectURL(R.target.files[0]);
|
|
1449
|
+
}, O = ({ imageSize: R, visibleArea: p }) => ({
|
|
1450
|
+
width: (p || R).width,
|
|
1451
|
+
height: (p || R).height
|
|
1452
|
+
}), T = (R, p) => {
|
|
1453
|
+
let J = l.value;
|
|
1454
|
+
J[R] = p, o("update:input-options", J);
|
|
1455
|
+
}, k = X(!!l.value.caption), Z = X(!!l.value.lightbox), N = X(!!l.value.new_tab);
|
|
1456
|
+
return (R, p) => {
|
|
1457
|
+
var J, $t, kt, Pt, jt, Bt, Ut, Xt;
|
|
1458
|
+
return g(), nt("div", ri, [
|
|
1459
|
+
G("input", {
|
|
1460
|
+
id: "cropper-file-input",
|
|
1461
|
+
ref_key: "fileUploadEl",
|
|
1462
|
+
ref: n,
|
|
1463
|
+
accept: "image/*",
|
|
1464
|
+
type: "file",
|
|
1465
|
+
class: "hidden",
|
|
1466
|
+
onChange: b
|
|
1467
|
+
}, null, 544),
|
|
1468
|
+
a.value ? (g(), z(W(ze), {
|
|
1469
|
+
key: 0,
|
|
1470
|
+
ref_key: "cropper",
|
|
1471
|
+
ref: s,
|
|
1472
|
+
class: "w-full h-[300px]",
|
|
1473
|
+
src: a.value,
|
|
1474
|
+
"resize-image": { wheel: !1 },
|
|
1475
|
+
"background-class": "cropper-background",
|
|
1476
|
+
"default-size": O,
|
|
1477
|
+
onChange: u
|
|
1478
|
+
}, null, 8, ["src"])) : (g(), nt("img", {
|
|
1479
|
+
key: 1,
|
|
1480
|
+
class: "w-full",
|
|
1481
|
+
src: t.img
|
|
1482
|
+
}, null, 8, ai)),
|
|
1483
|
+
c.value ? (g(), nt("div", hi, [
|
|
1484
|
+
x(W(Vt), {
|
|
1485
|
+
name: "no-image",
|
|
1486
|
+
width: 100,
|
|
1487
|
+
height: 100
|
|
1488
|
+
})
|
|
1489
|
+
])) : L("", !0),
|
|
1490
|
+
G("div", li, [
|
|
1491
|
+
a.value ? (g(), nt(Mt, { key: 0 }, [
|
|
1492
|
+
x(W(ot), {
|
|
1493
|
+
variant: "secondary",
|
|
1494
|
+
size: "small",
|
|
1495
|
+
"left-icon": "backward",
|
|
1496
|
+
"is-disabled": c.value,
|
|
1497
|
+
onClick: p[0] || (p[0] = (A) => d(-90))
|
|
1498
|
+
}, null, 8, ["is-disabled"]),
|
|
1499
|
+
x(W(ot), {
|
|
1500
|
+
variant: "secondary",
|
|
1501
|
+
size: "small",
|
|
1502
|
+
"left-icon": "zoom-out",
|
|
1503
|
+
"is-disabled": c.value,
|
|
1504
|
+
onClick: p[1] || (p[1] = (A) => m(0.8))
|
|
1505
|
+
}, null, 8, ["is-disabled"]),
|
|
1506
|
+
x(W(ot), {
|
|
1507
|
+
variant: "secondary",
|
|
1508
|
+
size: "small",
|
|
1509
|
+
"left-icon": "zoom-in",
|
|
1510
|
+
"is-disabled": c.value,
|
|
1511
|
+
onClick: p[2] || (p[2] = (A) => m(1.2))
|
|
1512
|
+
}, null, 8, ["is-disabled"]),
|
|
1513
|
+
x(W(ot), {
|
|
1514
|
+
variant: "secondary",
|
|
1515
|
+
size: "small",
|
|
1516
|
+
"left-icon": "forward",
|
|
1517
|
+
"is-disabled": c.value,
|
|
1518
|
+
onClick: p[3] || (p[3] = (A) => d(90))
|
|
1519
|
+
}, null, 8, ["is-disabled"])
|
|
1520
|
+
], 64)) : L("", !0),
|
|
1521
|
+
t.isReplaceImage ? (g(), z(W(ot), {
|
|
1522
|
+
key: 1,
|
|
1523
|
+
class: "absolute right-0",
|
|
1524
|
+
variant: "secondary",
|
|
1525
|
+
size: "small",
|
|
1526
|
+
label: "Replace image",
|
|
1527
|
+
"left-icon": "refresh",
|
|
1528
|
+
onClick: v
|
|
1529
|
+
})) : L("", !0)
|
|
1530
|
+
]),
|
|
1531
|
+
G("div", ci, [
|
|
1532
|
+
(J = t.inputOptions) != null && J.includes("description") ? (g(), z(W(vt), {
|
|
1533
|
+
key: 0,
|
|
1534
|
+
modelValue: l.value.description,
|
|
1535
|
+
"onUpdate:modelValue": [
|
|
1536
|
+
p[4] || (p[4] = (A) => l.value.description = A),
|
|
1537
|
+
p[5] || (p[5] = (A) => T("description", A))
|
|
1538
|
+
],
|
|
1539
|
+
label: "Describe Image",
|
|
1540
|
+
placeholder: ""
|
|
1541
|
+
}, null, 8, ["modelValue"])) : L("", !0),
|
|
1542
|
+
($t = t.inputOptions) != null && $t.includes("link") ? (g(), z(W(vt), {
|
|
1543
|
+
key: 1,
|
|
1544
|
+
modelValue: l.value.link,
|
|
1545
|
+
"onUpdate:modelValue": [
|
|
1546
|
+
p[6] || (p[6] = (A) => l.value.link = A),
|
|
1547
|
+
p[7] || (p[7] = (A) => T("link", A))
|
|
1548
|
+
],
|
|
1549
|
+
placeholder: "https://hitpayapp.com",
|
|
1550
|
+
label: "Link to"
|
|
1551
|
+
}, null, 8, ["modelValue"])) : L("", !0),
|
|
1552
|
+
G("div", null, [
|
|
1553
|
+
(kt = t.inputOptions) != null && kt.includes("caption") ? (g(), z(W(bt), {
|
|
1554
|
+
key: 0,
|
|
1555
|
+
modelValue: k.value,
|
|
1556
|
+
"onUpdate:modelValue": p[8] || (p[8] = (A) => k.value = A),
|
|
1557
|
+
label: "Caption",
|
|
1558
|
+
class: "mb-4"
|
|
1559
|
+
}, null, 8, ["modelValue"])) : L("", !0),
|
|
1560
|
+
(Pt = t.inputOptions) != null && Pt.includes("caption") && k.value ? (g(), z(W(vt), {
|
|
1561
|
+
key: 1,
|
|
1562
|
+
modelValue: l.value.caption,
|
|
1563
|
+
"onUpdate:modelValue": [
|
|
1564
|
+
p[9] || (p[9] = (A) => l.value.caption = A),
|
|
1565
|
+
p[10] || (p[10] = (A) => T("caption", A))
|
|
1566
|
+
],
|
|
1567
|
+
class: "mb-4",
|
|
1568
|
+
placeholder: ""
|
|
1569
|
+
}, null, 8, ["modelValue"])) : L("", !0),
|
|
1570
|
+
(jt = t.inputOptions) != null && jt.includes("caption") && k.value ? (g(), z(W(Me), {
|
|
1571
|
+
key: 2,
|
|
1572
|
+
"model-value": l.value.caption_variant,
|
|
1573
|
+
"group-name": "caption_variant",
|
|
1574
|
+
alignment: "horizontal",
|
|
1575
|
+
radio: [
|
|
1576
|
+
{
|
|
1577
|
+
value: "hover",
|
|
1578
|
+
label: "Show on hover"
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
value: "bottom",
|
|
1582
|
+
label: "Show on bottom"
|
|
1583
|
+
}
|
|
1584
|
+
],
|
|
1585
|
+
label: "Caption position",
|
|
1586
|
+
"onUpdate:modelValue": p[11] || (p[11] = (A) => T("caption_variant", A))
|
|
1587
|
+
}, null, 8, ["model-value"])) : L("", !0)
|
|
1588
|
+
]),
|
|
1589
|
+
G("div", null, [
|
|
1590
|
+
(Bt = t.inputOptions) != null && Bt.includes("new_tab") ? (g(), z(W(bt), {
|
|
1591
|
+
key: 0,
|
|
1592
|
+
modelValue: N.value,
|
|
1593
|
+
"onUpdate:modelValue": [
|
|
1594
|
+
p[12] || (p[12] = (A) => N.value = A),
|
|
1595
|
+
p[13] || (p[13] = (A) => T("new_tab", A))
|
|
1596
|
+
],
|
|
1597
|
+
label: "Open link in a new tab",
|
|
1598
|
+
class: "mb-4"
|
|
1599
|
+
}, null, 8, ["modelValue"])) : L("", !0),
|
|
1600
|
+
(Ut = t.inputOptions) != null && Ut.includes("lightbox") ? (g(), nt("div", ui, [
|
|
1601
|
+
G("div", di, [
|
|
1602
|
+
(Xt = t.inputOptions) != null && Xt.includes("lightbox") ? (g(), z(W(bt), {
|
|
1603
|
+
key: 0,
|
|
1604
|
+
modelValue: Z.value,
|
|
1605
|
+
"onUpdate:modelValue": [
|
|
1606
|
+
p[14] || (p[14] = (A) => Z.value = A),
|
|
1607
|
+
p[15] || (p[15] = (A) => T("lightbox", A))
|
|
1608
|
+
],
|
|
1609
|
+
label: "Enable lightbox"
|
|
1610
|
+
}, null, 8, ["modelValue"])) : L("", !0)
|
|
1611
|
+
]),
|
|
1612
|
+
x(W(Se), {
|
|
1613
|
+
key: "lightbox-cropper-tooltip",
|
|
1614
|
+
trigger: "hover",
|
|
1615
|
+
"is-popover": "",
|
|
1616
|
+
"popper-options": { strategy: "fixed" },
|
|
1617
|
+
position: "bottom",
|
|
1618
|
+
distance: 10,
|
|
1619
|
+
skidding: 0,
|
|
1620
|
+
"popper-class": "bg-oc-bg-light min-w-[125px]"
|
|
1621
|
+
}, {
|
|
1622
|
+
popper: B(() => [...p[16] || (p[16] = [
|
|
1623
|
+
G("div", { class: "text-oc-text-400 text-sm px-3 py-2 font-medium text-center" }, " Show lightbox when click the image ", -1)
|
|
1624
|
+
])]),
|
|
1625
|
+
default: B(() => [
|
|
1626
|
+
x(W(Vt), {
|
|
1627
|
+
name: "question-mark",
|
|
1628
|
+
width: "16",
|
|
1629
|
+
height: "16",
|
|
1630
|
+
class: "text-oc-accent-1-500"
|
|
1631
|
+
})
|
|
1632
|
+
]),
|
|
1633
|
+
_: 1
|
|
1634
|
+
})
|
|
1635
|
+
])) : L("", !0)
|
|
1636
|
+
])
|
|
1637
|
+
])
|
|
1638
|
+
]);
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
export {
|
|
1643
|
+
gi as default
|
|
1644
|
+
};
|