/*!
* Cropper.js v1.6.1
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2023-09-17T03:40:53.332Z
*/
!function (t, e) { "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).Cropper = e() }(this, (function () {
"use strict"; function t(t, e) { var i = Object.keys(t); if (Object.getOwnPropertySymbols) { var a = Object.getOwnPropertySymbols(t); e && (a = a.filter((function (e) { return Object.getOwnPropertyDescriptor(t, e).enumerable }))), i.push.apply(i, a) } return i } function e(e) { for (var i = 1; i < arguments.length; i++) { var a = null != arguments[i] ? arguments[i] : {}; i % 2 ? t(Object(a), !0).forEach((function (t) { r(e, t, a[t]) })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(a)) : t(Object(a)).forEach((function (t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(a, t)) })) } return e } function i(t) { return i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, i(t) } function a(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } function n(t, e) { for (var i = 0; i < e.length; i++) { var a = e[i]; a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(t, o(a.key), a) } } function o(t) { var e = function (t, e) { if ("object" != i(t) || !t) return t; var a = t[Symbol.toPrimitive]; if (void 0 !== a) { var n = a.call(t, e || "default"); if ("object" != i(n)) return n; throw new TypeError("@@toPrimitive must return a primitive value.") } return ("string" === e ? String : Number)(t) }(t, "string"); return "symbol" == i(e) ? e : String(e) } function r(t, e, i) { return (e = o(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t } function s(t) { return c(t) || h(t) || l(t) || d() } function c(t) { if (Array.isArray(t)) return u(t) } function h(t) { if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t) } function l(t, e) { if (t) { if ("string" == typeof t) return u(t, e); var i = Object.prototype.toString.call(t).slice(8, -1); return "Object" === i && t.constructor && (i = t.constructor.name), "Map" === i || "Set" === i ? Array.from(t) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? u(t, e) : void 0 } } function u(t, e) { (null == e || e > t.length) && (e = t.length); for (var i = 0, a = new Array(e); i < e; i++)a[i] = t[i]; return a } function d() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") } var p = "undefined" != typeof window && void 0 !== window.document, f = p ? window : ({}), m = !!p && "ontouchstart" in f.document.documentElement, g = !!p && "PointerEvent" in f, v = "cropper", w = "all", b = "crop", y = "move", x = "zoom", M = "e", $ = "w", C = "s", D = "n", k = "ne", B = "nw", E = "se", O = "sw", T = "".concat(v, "-crop"), W = "".concat(v, "-disabled"), H = "".concat(v, "-hidden"), z = "".concat(v, "-hide"), L = "".concat(v, "-invisible"), Y = "".concat(v, "-modal"), X = "".concat(v, "-move"), R = "".concat(v, "-action"), S = "".concat(v, "-preview"), A = "".concat(v, "-bg"), I = "".concat(v, "-wrap"), j = "".concat(v, "-mask"), U = "".concat(v, "-canvas"), N = "".concat(v, "-drag-box"), P = "".concat(v, "-crop-box"), q = "".concat(v, "-dashed"), K = "".concat(v, "-line"), Z = "".concat(v, "-point"), F = "".concat(v, "-face"), G = "".concat(v, "-view-box"), Q = "low", V = "medium", J = "high", _ = "cropstart", tt = "cropmove", et = "cropend", it = "crop", at = "zoom", nt = "ready", ot = "error", rt = "dblclick", st = "pointerdown", ct = "pointermove", ht = "pointerup l", lt = "pointercancel", ut = "touchstart", dt = "touchmove", pt = "touchend touchcancel", ft = "mousedown", mt = "mousemove", gt = "mouseup", vt = "wheel", wt = "resize", bt = "image", yt = "canvas", xt = "timeline", Mt = "contain", $t = "cover", Ct = "none", Dt = "n", kt = "w", Bt = "s", Et = "e", Ot = "nw", Tt = "sw", Wt = "ne", Ht = "se", zt = { translate: 1, rotate: 1, scaleX: 1, scaleY: 1, skewX: 1, skewY: 1 }, Lt = { aspectRatio: NaN, autoCrop: !0, autoCropArea: .8, autoCropUtilityClass: null, background: !0, checkCrossOrigin: !0, checkOrientation: !0, cropBoxMovable: !0, cropBoxResizable: !0, data: null, dragMode: b, guides: !0, highlight: !0, initialAspectRatio: NaN, minCanvasHeight: 0, minCanvasWidth: 0, minContainerHeight: 200, minContainerWidth: 100, minCropBoxHeight: 0, minCropBoxWidth: 0, modal: !0, movable: !0, preview: "", responsive: !0, restore: !0, rotatable: !0, scalable: !0, toggleDragModeOnDblclick: !0, viewMode: 0, wheelZoomRatio: .1, zoomOnTouch: !0, zoomOnWheel: !0, zoomable: !0, crop: null, cropend: null, cropmove: null, cropstart: null, ready: null, zoom: null }, Yt = Number.isNaN || f.isNaN; function Xt(t) { return "number" == typeof t && !Yt(t) } function Rt(t) { return void 0 === t } function St(t) { return "object" === i(t) && null !== t } var At = Object.prototype.hasOwnProperty; function It(t) { if (!St(t)) return !1; try { var e = t.constructor, i = e.prototype; return e && i && At.call(i, "isPrototypeOf") } catch (t) { return !1 } } function jt(t) { return "function" == typeof t } function Ut(t) { return Array.isArray(t) } function Nt(t) { return "string" == typeof t } function Pt(t) { return "boolean" == typeof t } function qt(t) { return t.getElementsByTagName } function Kt(t) { return t.getContext } function Zt(t) { return t instanceof HTMLImageElement } function Ft(t) { return t instanceof HTMLCanvasElement } function Gt(t) { return t instanceof HTMLVideoElement } function Qt(t) { var e = t.trim(), i = e.replace(/\s+/g, " "); if (i !== e) { for (var a = i.length, n = e.length, o = 0; o < n; o++) { var r = e.charCodeAt(o); if (32 === r) { if (32 !== e.charCodeAt(o - 1) && 32 !== e.charCodeAt(o + 1)) { var s = e.indexOf(i); s > 0 && o > s && (a += o - s - 1) } } else 32 !== r && (a -= 1) } i = e.length > a ? e.substr(0, a) : e } return i } function Vt(t) { return t.length > 0 && t[t.length - 1].trim().length > 0 } function Jt(t) { return void 0 !== t } function _t(t) { var e = new Error(t); return e.code = "JS_ERROR", e } function te(t) { return t.replace(/[-_]+(.)?/g, (function (t, e) { return e ? e.toUpperCase() : "" })) } function ee(t, e) { return t.style[e] || t.currentStyle && t.currentStyle[e] } function ie(t, e) { if (t.style) { var i = t.style[e]; if (Jt(i)) return i; var a = te(e); return a !== e ? ie(t, a) : void 0 } return ee(t, e) } function ae(t, e) { if (t.style) { var i = t.style[e]; if (Jt(i)) return i } return ee(t, e) } function ne(t, e, i) { i = Jt(i) ? i : 1; (t = Math.abs(t)) >= 100 ? i = 2 : t >= 10 && (i = 1); return e = e || "0", ((t = String(t)).length < i ? e.repeat(i - t.length) : "") + t } function oe(t, e, i) { var a = "Event" === e.substr(-5), n = new CustomEvent(e, { detail: i, bubbles: !0, cancelable: !0 }); return t.dispatchEvent(n) } function re(t) { var e = t.target; return e || (e = t.srcElement || document), 3 === e.nodeType && (e = e.parentNode), e } function se(t) { var e = t.originalEvent || t; if (e.touches && e.touches.length) { var i = e.touches[0]; return { pageX: i.pageX, pageY: i.pageY, clientX: i.clientX, clientY: i.clientY } } return { pageX: e.pageX, pageY: e.pageY, clientX: e.clientX, clientY: e.clientY } } function ce(t, e, i) { var a = t.getBoundingClientRect(), n = se(e); return { x: n.clientX - a.left - (i ? 0 : window.pageXOffset), y: n.clientY - a.top - (i ? 0 : window.pageYOffset) } } function he(t) { return /^(?:img|canvas|video)$/i.test(t.tagName) } function le(t) { return "img" === t.tagName.toLowerCase() } function ue(t) { return "canvas" === t.tagName.toLowerCase() } function de(t) { return "video" === t.tagName.toLowerCase() } function pe(t) { return t.naturalWidth || t.width } function fe(t) { return t.naturalHeight || t.height } function me(t, e) { if (t.style) { var i = t.style[e]; if (void 0 !== i) return i } return t.currentStyle && t.currentStyle[e] } function ge(t, e) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null; return (t = t || new Image).onload = function () { e.call(i, this) }, t.src = "string" == typeof t ? t : URL.createObjectURL(t), t } function ve(t, e) { return t.toDataURL(e) } function we(t, e) { return t.toBlob ? new Promise((function (i) { t.toBlob(i, e) })) : Promise.resolve(ve(t, e)) } function be(t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, a = document.createElement("canvas"), n = a.getContext("2d"); if (a.width = t.naturalWidth, a.height = t.naturalHeight, n.save(), e === Mt) if (a.width > i) a.width = i, a.height = a.width / t.naturalWidth * t.naturalHeight; else if (a.height > i) a.height = i, a.width = a.height / t.naturalHeight * t.naturalWidth; else { if (!(e === $t)) return; if (a.width < i) a.width = i, a.height = a.width / t.naturalWidth * t.naturalHeight; else if (a.height < i) a.height = i, a.width = a.height / t.naturalHeight * t.naturalWidth } return n.drawImage(t, 0, 0, a.width, a.height), n.restore(), a } function ye(t) { var e = t.split(","), i = e[0].match(/:(.*?);/)[1], a = atob(e[1]), n = a.length, o = new Uint8Array(n); for (; n--;)o[n] = a.charCodeAt(n); return new Blob([o], { type: i }) } function xe(t, e, i) { var a = document.createElement("a"); a.href = t, a.download = e, i && (a.target = "_blank"), document.body.appendChild(a), a.click(), document.body.removeChild(a) } function Me(t, e) { return e ? Math.round(t / e) * e : t } function $e(t, e, i, a) { var n = Math.abs(t), o = Math.abs(e), r = Math.abs(i), s = Math.abs(a); return n >= r && t > 0 && e > 0 || n >= s && t < 0 && e > 0 || o >= r && e > 0 && t > 0 || o >= s && e < 0 && t > 0 ? Math.atan2(Math.abs(t - i), Math.abs(e - a)) * (180 / Math.PI) : 0 } function Ce(t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, i = document.createElement("span"), a = document.createElement("span"); i.style.cssText = "height:0;width:0;outline:0;border:0;padding:0;margin:0;box-sizing:content-box;", a.style.cssText = i.style.cssText, i.textContent = t, a.textContent = "s", document.body.appendChild(i), document.body.appendChild(a); var n = i.offsetWidth, o = a.offsetWidth; return document.body.removeChild(i), document.body.removeChild(a), n > o ? n : 0 } return function () {
function t(e) { var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; a(this, t), this.element = e, this.options = Object.assign({}, Lt, St(i) && i), this.isLoaded = !1, this.isImg = !1, this.isCanvas = !1, this.completed = !1, this.image = null, this.canvas = null, this.dragBox = null, this.cropBox = null, this.viewBox = null, this.pointers = {}, this.init() } return n(t, [{ key: "init", value: function () { var t = this.element, e = t.tagName.toLowerCase(), i = this.options; if (!t || !he(t)) throw new Error("The first argument is required and must be an
or