(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["cropperjs"]=e():t["cropperjs"]=e()})("undefined"!==typeof self?self:this,(function(){return function(){var t={9662:function(t,e,i){var n=i(614),r=i(6330),a=TypeError;t.exports=function(t){if(n(t))return t;throw a(r(t)+" is not a function")}},9670:function(t,e,i){var n=i(111),r=String,a=TypeError;t.exports=function(t){if(n(t))return t;throw a(r(t)+" is not an object")}},1318:function(t,e,i){var n=i(5656),r=i(1400),a=i(6244),o=function(t){return function(e,i,o){var s,h=n(e),c=a(h),p=r(o,c);if(t&&i!=i){while(c>p)if(s=h[p++],s!=s)return!0}else for(;c>p;p++)if((t||p in h)&&h[p]===i)return t||p||0;return!t&&-1}};t.exports={includes:o(!0),indexOf:o(!1)}},3658:function(t,e,i){"use strict";var n=i(9781),r=i(3157),a=TypeError,o=Object.getOwnPropertyDescriptor,s=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=s?function(t,e){if(r(t)&&!o(t,"length").writable)throw a("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4326:function(t,e,i){var n=i(1702),r=n({}.toString),a=n("".slice);t.exports=function(t){return a(r(t),8,-1)}},9920:function(t,e,i){var n=i(2597),r=i(3887),a=i(1236),o=i(3070);t.exports=function(t,e,i){for(var s=r(e),h=o.f,c=a.f,p=0;pi)throw e("Maximum allowed index exceeded");return t}},8113:function(t){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:function(t,e,i){var n,r,a=i(7854),o=i(8113),s=a.process,h=a.Deno,c=s&&s.versions||h&&h.version,p=c&&c.v8;p&&(n=p.split("."),r=n[0]>0&&n[0]<4?1:+(n[0]+n[1])),!r&&o&&(n=o.match(/Edge\/(\d+)/),(!n||n[1]>=74)&&(n=o.match(/Chrome\/(\d+)/),n&&(r=+n[1]))),t.exports=r},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,e,i){var n=i(7854),r=i(1236).f,a=i(8880),o=i(8052),s=i(3072),h=i(9920),c=i(4705);t.exports=function(t,e){var i,p,u,l,d,f,m=t.target,g=t.global,v=t.stat;if(p=g?n:v?n[m]||s(m,{}):(n[m]||{}).prototype,p)for(u in e){if(d=e[u],t.dontCallGetSet?(f=r(p,u),l=f&&f.value):l=p[u],i=c(g?u:m+(v?".":"#")+u,t.forced),!i&&void 0!==l){if(typeof d==typeof l)continue;h(d,l)}(t.sham||l&&l.sham)&&a(d,"sham",!0),o(p,u,d,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},4374:function(t,e,i){var n=i(7293);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},6916:function(t,e,i){var n=i(4374),r=Function.prototype.call;t.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},6530:function(t,e,i){var n=i(9781),r=i(2597),a=Function.prototype,o=n&&Object.getOwnPropertyDescriptor,s=r(a,"name"),h=s&&"something"===function(){}.name,c=s&&(!n||n&&o(a,"name").configurable);t.exports={EXISTS:s,PROPER:h,CONFIGURABLE:c}},1702:function(t,e,i){var n=i(4374),r=Function.prototype,a=r.call,o=n&&r.bind.bind(a,a);t.exports=n?o:function(t){return function(){return a.apply(t,arguments)}}},5005:function(t,e,i){var n=i(7854),r=i(614),a=function(t){return r(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?a(n[t]):n[t]&&n[t][e]}},8173:function(t,e,i){var n=i(9662),r=i(8554);t.exports=function(t,e){var i=t[e];return r(i)?void 0:n(i)}},7854:function(t,e,i){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof i.g&&i.g)||function(){return this}()||Function("return this")()},2597:function(t,e,i){var n=i(1702),r=i(7908),a=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return a(r(t),e)}},3501:function(t){t.exports={}},4664:function(t,e,i){var n=i(9781),r=i(7293),a=i(317);t.exports=!n&&!r((function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,e,i){var n=i(1702),r=i(7293),a=i(4326),o=Object,s=n("".split);t.exports=r((function(){return!o("z").propertyIsEnumerable(0)}))?function(t){return"String"==a(t)?s(t,""):o(t)}:o},2788:function(t,e,i){var n=i(1702),r=i(614),a=i(5465),o=n(Function.toString);r(a.inspectSource)||(a.inspectSource=function(t){return o(t)}),t.exports=a.inspectSource},9909:function(t,e,i){var n,r,a,o=i(4811),s=i(7854),h=i(111),c=i(8880),p=i(2597),u=i(5465),l=i(6200),d=i(3501),f="Object already initialized",m=s.TypeError,g=s.WeakMap,v=function(t){return a(t)?r(t):n(t,{})},y=function(t){return function(e){var i;if(!h(e)||(i=r(e)).type!==t)throw m("Incompatible receiver, "+t+" required");return i}};if(o||u.state){var b=u.state||(u.state=new g);b.get=b.get,b.has=b.has,b.set=b.set,n=function(t,e){if(b.has(t))throw m(f);return e.facade=t,b.set(t,e),e},r=function(t){return b.get(t)||{}},a=function(t){return b.has(t)}}else{var w=l("state");d[w]=!0,n=function(t,e){if(p(t,w))throw m(f);return e.facade=t,c(t,w,e),e},r=function(t){return p(t,w)?t[w]:{}},a=function(t){return p(t,w)}}t.exports={set:n,get:r,has:a,enforce:v,getterFor:y}},3157:function(t,e,i){var n=i(4326);t.exports=Array.isArray||function(t){return"Array"==n(t)}},614:function(t,e,i){var n=i(4154),r=n.all;t.exports=n.IS_HTMLDDA?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},4705:function(t,e,i){var n=i(7293),r=i(614),a=/#|\.prototype\./,o=function(t,e){var i=h[s(t)];return i==p||i!=c&&(r(e)?n(e):!!e)},s=o.normalize=function(t){return String(t).replace(a,".").toLowerCase()},h=o.data={},c=o.NATIVE="N",p=o.POLYFILL="P";t.exports=o},8554:function(t){t.exports=function(t){return null===t||void 0===t}},111:function(t,e,i){var n=i(614),r=i(4154),a=r.all;t.exports=r.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:n(t)||t===a}:function(t){return"object"==typeof t?null!==t:n(t)}},1913:function(t){t.exports=!1},2190:function(t,e,i){var n=i(5005),r=i(614),a=i(7976),o=i(3307),s=Object;t.exports=o?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return r(e)&&a(e.prototype,s(t))}},6244:function(t,e,i){var n=i(7466);t.exports=function(t){return n(t.length)}},6339:function(t,e,i){var n=i(1702),r=i(7293),a=i(614),o=i(2597),s=i(9781),h=i(6530).CONFIGURABLE,c=i(2788),p=i(9909),u=p.enforce,l=p.get,d=String,f=Object.defineProperty,m=n("".slice),g=n("".replace),v=n([].join),y=s&&!r((function(){return 8!==f((function(){}),"length",{value:8}).length})),b=String(String).split("String"),w=t.exports=function(t,e,i){"Symbol("===m(d(e),0,7)&&(e="["+g(d(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!o(t,"name")||h&&t.name!==e)&&(s?f(t,"name",{value:e,configurable:!0}):t.name=e),y&&i&&o(i,"arity")&&t.length!==i.arity&&f(t,"length",{value:i.arity});try{i&&o(i,"constructor")&&i.constructor?s&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(r){}var n=u(t);return o(n,"source")||(n.source=v(b,"string"==typeof e?e:"")),t};Function.prototype.toString=w((function(){return a(this)&&l(this).source||c(this)}),"toString")},4758:function(t){var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?i:e)(n)}},3070:function(t,e,i){var n=i(9781),r=i(4664),a=i(3353),o=i(9670),s=i(4948),h=TypeError,c=Object.defineProperty,p=Object.getOwnPropertyDescriptor,u="enumerable",l="configurable",d="writable";e.f=n?a?function(t,e,i){if(o(t),e=s(e),o(i),"function"===typeof t&&"prototype"===e&&"value"in i&&d in i&&!i[d]){var n=p(t,e);n&&n[d]&&(t[e]=i.value,i={configurable:l in i?i[l]:n[l],enumerable:u in i?i[u]:n[u],writable:!1})}return c(t,e,i)}:c:function(t,e,i){if(o(t),e=s(e),o(i),r)try{return c(t,e,i)}catch(n){}if("get"in i||"set"in i)throw h("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},1236:function(t,e,i){var n=i(9781),r=i(6916),a=i(5296),o=i(9114),s=i(5656),h=i(4948),c=i(2597),p=i(4664),u=Object.getOwnPropertyDescriptor;e.f=n?u:function(t,e){if(t=s(t),e=h(e),p)try{return u(t,e)}catch(i){}if(c(t,e))return o(!r(a.f,t,e),t[e])}},8006:function(t,e,i){var n=i(6324),r=i(748),a=r.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,a)}},5181:function(t,e){e.f=Object.getOwnPropertySymbols},7976:function(t,e,i){var n=i(1702);t.exports=n({}.isPrototypeOf)},6324:function(t,e,i){var n=i(1702),r=i(2597),a=i(5656),o=i(1318).indexOf,s=i(3501),h=n([].push);t.exports=function(t,e){var i,n=a(t),c=0,p=[];for(i in n)!r(s,i)&&r(n,i)&&h(p,i);while(e.length>c)r(n,i=e[c++])&&(~o(p,i)||h(p,i));return p}},5296:function(t,e){"use strict";var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);e.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},2140:function(t,e,i){var n=i(6916),r=i(614),a=i(111),o=TypeError;t.exports=function(t,e){var i,s;if("string"===e&&r(i=t.toString)&&!a(s=n(i,t)))return s;if(r(i=t.valueOf)&&!a(s=n(i,t)))return s;if("string"!==e&&r(i=t.toString)&&!a(s=n(i,t)))return s;throw o("Can't convert object to primitive value")}},3887:function(t,e,i){var n=i(5005),r=i(1702),a=i(8006),o=i(5181),s=i(9670),h=r([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=a.f(s(t)),i=o.f;return i?h(e,i(t)):e}},4488:function(t,e,i){var n=i(8554),r=TypeError;t.exports=function(t){if(n(t))throw r("Can't call method on "+t);return t}},6200:function(t,e,i){var n=i(2309),r=i(9711),a=n("keys");t.exports=function(t){return a[t]||(a[t]=r(t))}},5465:function(t,e,i){var n=i(7854),r=i(3072),a="__core-js_shared__",o=n[a]||r(a,{});t.exports=o},2309:function(t,e,i){var n=i(1913),r=i(5465);(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.29.1",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},6293:function(t,e,i){var n=i(7392),r=i(7293);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},1400:function(t,e,i){var n=i(9303),r=Math.max,a=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):a(i,e)}},5656:function(t,e,i){var n=i(8361),r=i(4488);t.exports=function(t){return n(r(t))}},9303:function(t,e,i){var n=i(4758);t.exports=function(t){var e=+t;return e!==e||0===e?0:n(e)}},7466:function(t,e,i){var n=i(9303),r=Math.min;t.exports=function(t){return t>0?r(n(t),9007199254740991):0}},7908:function(t,e,i){var n=i(4488),r=Object;t.exports=function(t){return r(n(t))}},7593:function(t,e,i){var n=i(6916),r=i(111),a=i(2190),o=i(8173),s=i(2140),h=i(5112),c=TypeError,p=h("toPrimitive");t.exports=function(t,e){if(!r(t)||a(t))return t;var i,h=o(t,p);if(h){if(void 0===e&&(e="default"),i=n(h,t,e),!r(i)||a(i))return i;throw c("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},4948:function(t,e,i){var n=i(7593),r=i(2190);t.exports=function(t){var e=n(t,"string");return r(e)?e:e+""}},6330:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(i){return"Object"}}},9711:function(t,e,i){var n=i(1702),r=0,a=Math.random(),o=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+o(++r+a,36)}},3307:function(t,e,i){var n=i(6293);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:function(t,e,i){var n=i(9781),r=i(7293);t.exports=n&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4811:function(t,e,i){var n=i(7854),r=i(614),a=n.WeakMap;t.exports=r(a)&&/native code/.test(String(a))},5112:function(t,e,i){var n=i(7854),r=i(2309),a=i(2597),o=i(9711),s=i(6293),h=i(3307),c=n.Symbol,p=r("wks"),u=h?c["for"]||c:c&&c.withoutSetter||o;t.exports=function(t){return a(p,t)||(p[t]=s&&a(c,t)?c[t]:u("Symbol."+t)),p[t]}},7658:function(t,e,i){"use strict";var n=i(2109),r=i(7908),a=i(6244),o=i(3658),s=i(7207),h=i(7293),c=h((function(){return 4294967297!==[].push.call({length:4294967296},1)})),p=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},u=c||!p();n({target:"Array",proto:!0,arity:1,forced:u},{push:function(t){var e=r(this),i=a(e),n=arguments.length;s(i+n);for(var h=0;ht.length)&&(e=t.length);for(var i=0,n=new Array(e);i
',ft=Number.isNaN||g.isNaN;function mt(t){return"number"===typeof t&&!ft(t)}var gt=function(t){return t>0&&t<1/0};function vt(t){return"undefined"===typeof t}function yt(t){return"object"===i(t)&&null!==t}var bt=Object.prototype.hasOwnProperty;function wt(t){if(!yt(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&bt.call(i,"isPrototypeOf")}catch(n){return!1}}function xt(t){return"function"===typeof t}var Mt=Array.prototype.slice;function Ct(t){return Array.from?Array.from(t):Mt.call(t)}function Dt(t,e){return t&&xt(e)&&(Array.isArray(t)||mt(t.length)?Ct(t).forEach((function(i,n){e.call(t,i,n,t)})):yt(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Ot=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n0&&i.forEach((function(e){yt(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},Bt=/\.\d*(?:0|9){12}\d*$/;function St(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return Bt.test(t)?Math.round(t*e)/e:t}var Tt=/^width|height|left|top|marginLeft|marginTop$/;function jt(t,e){var i=t.style;Dt(e,(function(t,e){Tt.test(e)&&mt(t)&&(t="".concat(t,"px")),i[e]=t}))}function kt(t,e){return t.classList?t.classList.contains(e):t.className.indexOf(e)>-1}function Et(t,e){if(e)if(mt(t.length))Dt(t,(function(t){Et(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function Nt(t,e){e&&(mt(t.length)?Dt(t,(function(t){Nt(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function Wt(t,e,i){e&&(mt(t.length)?Dt(t,(function(t){Wt(t,e,i)})):i?Et(t,e):Nt(t,e))}var Lt=/([a-z\d])([A-Z])/g;function Ht(t){return t.replace(Lt,"$1-$2").toLowerCase()}function zt(t,e){return yt(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Ht(e)))}function Pt(t,e,i){yt(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Ht(e)),i)}function Rt(t,e){if(yt(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(Ht(e)))}var At=/\s\s*/,Yt=function(){var t=!1;if(m){var e=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});g.addEventListener("test",i,n),g.removeEventListener("test",i,n)}return t}();function Xt(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i;e.trim().split(At).forEach((function(e){if(!Yt){var a=t.listeners;a&&a[e]&&a[e][i]&&(r=a[e][i],delete a[e][i],0===Object.keys(a[e]).length&&delete a[e],0===Object.keys(a).length&&delete t.listeners)}t.removeEventListener(e,r,n)}))}function It(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i;e.trim().split(At).forEach((function(e){if(n.once&&!Yt){var a=t.listeners,o=void 0===a?{}:a;r=function(){delete o[e][i],t.removeEventListener(e,r,n);for(var a=arguments.length,s=new Array(a),h=0;hMath.abs(n)&&(n=c)}))})),n}function Qt(t,i){var n=t.pageX,r=t.pageY,a={endX:n,endY:r};return i?a:e({startX:n,startY:r},a)}function Vt(t){var e=0,i=0,n=0;return Dt(t,(function(t){var r=t.startX,a=t.startY;e+=r,i+=a,n+=1})),e/=n,i/=n,{pageX:e,pageY:i}}function Jt(t){var e=t.aspectRatio,i=t.height,n=t.width,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",a=gt(n),o=gt(i);if(a&&o){var s=i*e;"contain"===r&&s>n||"cover"===r&&s90?{width:h,height:s}:{width:s,height:h}}function ee(t,e,i,n){var r=e.aspectRatio,a=e.naturalWidth,o=e.naturalHeight,h=e.rotate,c=void 0===h?0:h,p=e.scaleX,u=void 0===p?1:p,l=e.scaleY,d=void 0===l?1:l,f=i.aspectRatio,m=i.naturalWidth,g=i.naturalHeight,v=n.fillColor,y=void 0===v?"transparent":v,b=n.imageSmoothingEnabled,w=void 0===b||b,x=n.imageSmoothingQuality,M=void 0===x?"low":x,C=n.maxWidth,D=void 0===C?1/0:C,O=n.maxHeight,B=void 0===O?1/0:O,S=n.minWidth,T=void 0===S?0:S,j=n.minHeight,k=void 0===j?0:j,E=document.createElement("canvas"),N=E.getContext("2d"),W=Jt({aspectRatio:f,width:D,height:B}),L=Jt({aspectRatio:f,width:T,height:k},"cover"),H=Math.min(W.width,Math.max(L.width,m)),z=Math.min(W.height,Math.max(L.height,g)),P=Jt({aspectRatio:r,width:D,height:B}),R=Jt({aspectRatio:r,width:T,height:k},"cover"),A=Math.min(P.width,Math.max(R.width,a)),Y=Math.min(P.height,Math.max(R.height,o)),X=[-A/2,-Y/2,A,Y];return E.width=St(H),E.height=St(z),N.fillStyle=y,N.fillRect(0,0,H,z),N.save(),N.translate(H/2,z/2),N.rotate(c*Math.PI/180),N.scale(u,d),N.imageSmoothingEnabled=w,N.imageSmoothingQuality=M,N.drawImage.apply(N,[t].concat(s(X.map((function(t){return Math.floor(St(t))}))))),N.restore(),E}var ie=String.fromCharCode;function ne(t,e,i){var n="";i+=e;for(var r=e;r0)i.push(ie.apply(null,Ct(r.subarray(0,n)))),r=r.subarray(n);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}function se(t){var e,i=new DataView(t);try{var n,r,a;if(255===i.getUint8(0)&&216===i.getUint8(1)){var o=i.byteLength,s=2;while(s+1=8&&(a=c+u)}}}if(a){var l,d,f=i.getUint16(a,n);for(d=0;d=0?r:pt),height:Math.max(i.offsetHeight,a>=0?a:ut)};this.containerData=o,jt(n,{width:o.width,height:o.height}),Et(t,L),Nt(n,L)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,n=Math.abs(e.rotate)%180===90,r=n?e.naturalHeight:e.naturalWidth,a=n?e.naturalWidth:e.naturalHeight,o=r/a,s=t.width,h=t.height;t.height*o>t.width?3===i?s=t.height*o:h=t.width/o:3===i?h=t.width/o:s=t.height*o;var c={aspectRatio:o,naturalWidth:r,naturalHeight:a,width:s,height:h};this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),c.width=Math.min(Math.max(c.width,c.minWidth),c.maxWidth),c.height=Math.min(Math.max(c.height,c.minHeight),c.maxHeight),c.left=(t.width-c.width)/2,c.top=(t.height-c.height)/2,c.oldLeft=c.left,c.oldTop=c.top,this.initialCanvasData=Ot({},c)},limitCanvas:function(t,e){var i=this.options,n=this.containerData,r=this.canvasData,a=this.cropBoxData,o=i.viewMode,s=r.aspectRatio,h=this.cropped&&a;if(t){var c=Number(i.minCanvasWidth)||0,p=Number(i.minCanvasHeight)||0;o>1?(c=Math.max(c,n.width),p=Math.max(p,n.height),3===o&&(p*s>c?c=p*s:p=c/s)):o>0&&(c?c=Math.max(c,h?a.width:0):p?p=Math.max(p,h?a.height:0):h&&(c=a.width,p=a.height,p*s>c?c=p*s:p=c/s));var u=Jt({aspectRatio:s,width:c,height:p});c=u.width,p=u.height,r.minWidth=c,r.minHeight=p,r.maxWidth=1/0,r.maxHeight=1/0}if(e)if(o>(h?0:1)){var l=n.width-r.width,d=n.height-r.height;r.minLeft=Math.min(0,l),r.minTop=Math.min(0,d),r.maxLeft=Math.max(0,l),r.maxTop=Math.max(0,d),h&&this.limited&&(r.minLeft=Math.min(a.left,a.left+(a.width-r.width)),r.minTop=Math.min(a.top,a.top+(a.height-r.height)),r.maxLeft=a.left,r.maxTop=a.top,2===o&&(r.width>=n.width&&(r.minLeft=Math.min(0,l),r.maxLeft=Math.max(0,l)),r.height>=n.height&&(r.minTop=Math.min(0,d),r.maxTop=Math.max(0,d))))}else r.minLeft=-r.width,r.minTop=-r.height,r.maxLeft=n.width,r.maxTop=n.height},renderCanvas:function(t,e){var i=this.canvasData,n=this.imageData;if(e){var r=te({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),a=r.width,o=r.height,s=i.width*(a/i.naturalWidth),h=i.height*(o/i.naturalHeight);i.left-=(s-i.width)/2,i.top-=(h-i.height)/2,i.width=s,i.height=h,i.aspectRatio=a/o,i.naturalWidth=a,i.naturalHeight=o,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.widthi.maxHeight||i.heighte.width?r.height=r.width/i:r.width=r.height*i),this.cropBoxData=r,this.limitCropBox(!0,!0),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),r.width=Math.max(r.minWidth,r.width*n),r.height=Math.max(r.minHeight,r.height*n),r.left=e.left+(e.width-r.width)/2,r.top=e.top+(e.height-r.height)/2,r.oldLeft=r.left,r.oldTop=r.top,this.initialCropBoxData=Ot({},r)},limitCropBox:function(t,e){var i=this.options,n=this.containerData,r=this.canvasData,a=this.cropBoxData,o=this.limited,s=i.aspectRatio;if(t){var h=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,p=o?Math.min(n.width,r.width,r.width+r.left,n.width-r.left):n.width,u=o?Math.min(n.height,r.height,r.height+r.top,n.height-r.top):n.height;h=Math.min(h,n.width),c=Math.min(c,n.height),s&&(h&&c?c*s>h?c=h/s:h=c*s:h?c=h/s:c&&(h=c*s),u*s>p?u=p/s:p=u*s),a.minWidth=Math.min(h,p),a.minHeight=Math.min(c,u),a.maxWidth=p,a.maxHeight=u}e&&(o?(a.minLeft=Math.max(0,r.left),a.minTop=Math.max(0,r.top),a.maxLeft=Math.min(n.width,r.left+r.width)-a.width,a.maxTop=Math.min(n.height,r.top+r.height)-a.height):(a.minLeft=0,a.minTop=0,a.maxLeft=n.width-a.width,a.maxTop=n.height-a.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.widthi.maxHeight||i.height=e.width&&i.height>=e.height?M:w),jt(this.cropBox,Ot({width:i.width,height:i.height},Gt({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Ut(this.element,_,this.getData())}},pe={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,n=e?this.crossOriginUrl:this.url,r=t.alt||"The image to preview",a=document.createElement("img");if(e&&(a.crossOrigin=e),a.src=n,a.alt=r,this.viewBox.appendChild(a),this.viewBoxImage=a,i){var o=i;"string"===typeof i?o=t.ownerDocument.querySelectorAll(i):i.querySelector&&(o=[i]),this.previews=o,Dt(o,(function(t){var i=document.createElement("img");Pt(t,Y,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=n,i.alt=r,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){Dt(this.previews,(function(t){var e=zt(t,Y);jt(t,{width:e.width,height:e.height}),t.innerHTML=e.html,Rt(t,Y)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,n=i.width,r=i.height,a=t.width,o=t.height,s=i.left-e.left-t.left,h=i.top-e.top-t.top;this.cropped&&!this.disabled&&(jt(this.viewBoxImage,Ot({width:a,height:o},Gt(Ot({translateX:-s,translateY:-h},t)))),Dt(this.previews,(function(e){var i=zt(e,Y),c=i.width,p=i.height,u=c,l=p,d=1;n&&(d=c/n,l=r*d),r&&l>p&&(d=p/r,u=n*d,l=p),jt(e,{width:u,height:l}),jt(e.getElementsByTagName("img")[0],Ot({width:a*d,height:o*d},Gt(Ot({translateX:-s*d,translateY:-h*d},t))))})))}},ue={bind:function(){var t=this.element,e=this.options,i=this.cropper;xt(e.cropstart)&&It(t,F,e.cropstart),xt(e.cropmove)&&It(t,$,e.cropmove),xt(e.cropend)&&It(t,q,e.cropend),xt(e.crop)&&It(t,_,e.crop),xt(e.zoom)&&It(t,rt,e.zoom),It(i,V,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&It(i,nt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&It(i,Z,this.onDblclick=this.dblclick.bind(this)),It(t.ownerDocument,J,this.onCropMove=this.cropMove.bind(this)),It(t.ownerDocument,tt,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&It(window,it,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;xt(e.cropstart)&&Xt(t,F,e.cropstart),xt(e.cropmove)&&Xt(t,$,e.cropmove),xt(e.cropend)&&Xt(t,q,e.cropend),xt(e.crop)&&Xt(t,_,e.crop),xt(e.zoom)&&Xt(t,rt,e.zoom),Xt(i,V,this.onCropStart),e.zoomable&&e.zoomOnWheel&&Xt(i,nt,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Xt(i,Z,this.onDblclick),Xt(t.ownerDocument,J,this.onCropMove),Xt(t.ownerDocument,tt,this.onCropEnd),e.responsive&&Xt(window,it,this.onResize)}},le={resize:function(){if(!this.disabled){var t,e,i=this.options,n=this.container,r=this.containerData,a=n.offsetWidth/r.width,o=n.offsetHeight/r.height,s=Math.abs(a-1)>Math.abs(o-1)?a:o;if(1!==s)i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(Dt(t,(function(e,i){t[i]=e*s}))),this.setCropBoxData(Dt(e,(function(t,i){e[i]=t*s}))))}},dblclick:function(){this.disabled||this.options.dragMode===U||this.setDragMode(kt(this.dragBox,N)?I:X)},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?n=t.deltaY>0?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=t.detail>0?1:-1),this.zoom(-n*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(mt(e)&&1!==e||mt(i)&&0!==i||t.ctrlKey))){var n,r=this.options,a=this.pointers;t.changedTouches?Dt(t.changedTouches,(function(t){a[t.identifier]=Qt(t)})):a[t.pointerId||0]=Qt(t),n=Object.keys(a).length>1&&r.zoomable&&r.zoomOnTouch?C:zt(t.target,A),ot.test(n)&&!1!==Ut(this.element,F,{originalEvent:t,action:n})&&(t.preventDefault(),this.action=n,this.cropping=!1,n===x&&(this.cropping=!0,Et(this.dragBox,P)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==Ut(this.element,$,{originalEvent:t,action:e})&&(t.changedTouches?Dt(t.changedTouches,(function(t){Ot(i[t.identifier]||{},Qt(t,!0))})):Ot(i[t.pointerId||0]||{},Qt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Dt(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Wt(this.dragBox,P,this.cropped&&this.options.modal)),Ut(this.element,q,{originalEvent:t,action:e}))}}},de={change:function(t){var e,i=this.options,n=this.canvasData,r=this.containerData,a=this.cropBoxData,o=this.pointers,s=this.action,h=i.aspectRatio,c=a.left,p=a.top,u=a.width,l=a.height,d=c+u,f=p+l,m=0,g=0,v=r.width,y=r.height,b=!0;!h&&t.shiftKey&&(h=u&&l?u/l:1),this.limited&&(m=a.minLeft,g=a.minTop,v=m+Math.min(r.width,n.width,n.left+n.width),y=g+Math.min(r.height,n.height,n.top+n.height));var N=o[Object.keys(o)[0]],W={x:N.endX-N.startX,y:N.endY-N.startY},H=function(t){switch(t){case D:d+W.x>v&&(W.x=v-d);break;case O:c+W.xy&&(W.y=y-f);break}};switch(s){case w:c+=W.x,p+=W.y;break;case D:if(W.x>=0&&(d>=v||h&&(p<=g||f>=y))){b=!1;break}H(D),u+=W.x,u<0&&(s=O,u=-u,c-=u),h&&(l=u/h,p+=(a.height-l)/2);break;case S:if(W.y<=0&&(p<=g||h&&(c<=m||d>=v))){b=!1;break}H(S),l-=W.y,p+=W.y,l<0&&(s=B,l=-l,p-=l),h&&(u=l*h,c+=(a.width-u)/2);break;case O:if(W.x<=0&&(c<=m||h&&(p<=g||f>=y))){b=!1;break}H(O),u-=W.x,c+=W.x,u<0&&(s=D,u=-u,c-=u),h&&(l=u/h,p+=(a.height-l)/2);break;case B:if(W.y>=0&&(f>=y||h&&(c<=m||d>=v))){b=!1;break}H(B),l+=W.y,l<0&&(s=S,l=-l,p-=l),h&&(u=l*h,c+=(a.width-u)/2);break;case T:if(h){if(W.y<=0&&(p<=g||d>=v)){b=!1;break}H(S),l-=W.y,p+=W.y,u=l*h}else H(S),H(D),W.x>=0?dg&&(l-=W.y,p+=W.y):(l-=W.y,p+=W.y);u<0&&l<0?(s=E,l=-l,u=-u,p-=l,c-=u):u<0?(s=j,u=-u,c-=u):l<0&&(s=k,l=-l,p-=l);break;case j:if(h){if(W.y<=0&&(p<=g||c<=m)){b=!1;break}H(S),l-=W.y,p+=W.y,u=l*h,c+=a.width-u}else H(S),H(O),W.x<=0?c>m?(u-=W.x,c+=W.x):W.y<=0&&p<=g&&(b=!1):(u-=W.x,c+=W.x),W.y<=0?p>g&&(l-=W.y,p+=W.y):(l-=W.y,p+=W.y);u<0&&l<0?(s=k,l=-l,u=-u,p-=l,c-=u):u<0?(s=T,u=-u,c-=u):l<0&&(s=E,l=-l,p-=l);break;case E:if(h){if(W.x<=0&&(c<=m||f>=y)){b=!1;break}H(O),u-=W.x,c+=W.x,l=u/h}else H(B),H(O),W.x<=0?c>m?(u-=W.x,c+=W.x):W.y>=0&&f>=y&&(b=!1):(u-=W.x,c+=W.x),W.y>=0?f=0&&(d>=v||f>=y)){b=!1;break}H(D),u+=W.x,l=u/h}else H(B),H(D),W.x>=0?d=0&&f>=y&&(b=!1):u+=W.x,W.y>=0?f0?s=W.y>0?k:T:W.x<0&&(c-=u,s=W.y>0?E:j),W.y<0&&(p-=l),this.cropped||(Nt(this.cropBox,L),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}b&&(a.width=u,a.height=l,a.left=c,a.top=p,this.action=s,this.renderCropBox()),Dt(o,(function(t){t.startX=t.endX,t.startY=t.endY}))}},fe={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Et(this.dragBox,P),Nt(this.cropBox,L),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Ot({},this.initialImageData),this.canvasData=Ot({},this.initialCanvasData),this.cropBoxData=Ot({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Ot(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Nt(this.dragBox,P),Et(this.cropBox,L)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,Dt(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Nt(this.cropper,W)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Et(this.cropper,W)),this},destroy:function(){var t=this.element;return t[b]?(t[b]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=i.left,r=i.top;return this.moveTo(vt(t)?t:n+Number(t),vt(e)?e:r+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(mt(t)&&(i.left=t,n=!0),mt(e)&&(i.top=e,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=Number(t),t=t<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var n=this.options,r=this.canvasData,a=r.width,o=r.height,s=r.naturalWidth,h=r.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&n.zoomable){var c=s*t,p=h*t;if(!1===Ut(this.element,rt,{ratio:t,oldRatio:a/s,originalEvent:i}))return this;if(i){var u=this.pointers,l=_t(this.cropper),d=u&&Object.keys(u).length?Vt(u):{pageX:i.pageX,pageY:i.pageY};r.left-=(c-a)*((d.pageX-l.left-r.left)/a),r.top-=(p-o)*((d.pageY-l.top-r.top)/o)}else wt(e)&&mt(e.x)&&mt(e.y)?(r.left-=(c-a)*((e.x-r.left)/a),r.top-=(p-o)*((e.y-r.top)/o)):(r.left-=(c-a)/2,r.top-=(p-o)/2);r.width=c,r.height=p,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),mt(t)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,mt(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(mt(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(mt(t)&&(i.scaleX=t,n=!0),mt(e)&&(i.scaleY=e,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,n=this.imageData,r=this.canvasData,a=this.cropBoxData;if(this.ready&&this.cropped){t={x:a.left-r.left,y:a.top-r.top,width:a.width,height:a.height};var o=n.width/n.naturalWidth;if(Dt(t,(function(e,i){t[i]=e/o})),e){var s=Math.round(t.y+t.height),h=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=h-t.x,t.height=s-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=n.rotate||0),i.scalable&&(t.scaleX=n.scaleX||1,t.scaleY=n.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,n=this.canvasData,r={};if(this.ready&&!this.disabled&&wt(t)){var a=!1;e.rotatable&&mt(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,a=!0),e.scalable&&(mt(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,a=!0),mt(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,a=!0)),a&&this.renderCanvas(!0,!0);var o=i.width/i.naturalWidth;mt(t.x)&&(r.left=t.x*o+n.left),mt(t.y)&&(r.top=t.y*o+n.top),mt(t.width)&&(r.width=t.width*o),mt(t.height)&&(r.height=t.height*o),this.setCropBoxData(r)}return this},getContainerData:function(){return this.ready?Ot({},this.containerData):{}},getImageData:function(){return this.sized?Ot({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Dt(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&wt(t)&&(mt(t.left)&&(e.left=t.left),mt(t.top)&&(e.top=t.top),mt(t.width)?(e.width=t.width,e.height=t.width/i):mt(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,i,n=this.cropBoxData,r=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&wt(t)&&(mt(t.left)&&(n.left=t.left),mt(t.top)&&(n.top=t.top),mt(t.width)&&t.width!==n.width&&(e=!0,n.width=t.width),mt(t.height)&&t.height!==n.height&&(i=!0,n.height=t.height),r&&(e?n.height=n.width/r:i&&(n.width=n.height*r)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=ee(this.image,this.imageData,e,t);if(!this.cropped)return i;var n=this.getData(t.rounded),r=n.x,a=n.y,o=n.width,h=n.height,c=i.width/Math.floor(e.naturalWidth);1!==c&&(r*=c,a*=c,o*=c,h*=c);var p=o/h,u=Jt({aspectRatio:p,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),l=Jt({aspectRatio:p,width:t.minWidth||0,height:t.minHeight||0},"cover"),d=Jt({aspectRatio:p,width:t.width||(1!==c?i.width:o),height:t.height||(1!==c?i.height:h)}),f=d.width,m=d.height;f=Math.min(u.width,Math.max(l.width,f)),m=Math.min(u.height,Math.max(l.height,m));var g=document.createElement("canvas"),v=g.getContext("2d");g.width=St(f),g.height=St(m),v.fillStyle=t.fillColor||"transparent",v.fillRect(0,0,f,m);var y=t.imageSmoothingEnabled,b=void 0===y||y,w=t.imageSmoothingQuality;v.imageSmoothingEnabled=b,w&&(v.imageSmoothingQuality=w);var x,M,C,D,O,B,S=i.width,T=i.height,j=r,k=a;j<=-o||j>S?(j=0,x=0,C=0,O=0):j<=0?(C=-j,j=0,x=Math.min(S,o+j),O=x):j<=S&&(C=0,x=Math.min(o,S-j),O=x),x<=0||k<=-h||k>T?(k=0,M=0,D=0,B=0):k<=0?(D=-k,k=0,M=Math.min(T,h+k),B=M):k<=T&&(D=0,M=Math.min(h,T-k),B=M);var E=[j,k,x,M];if(O>0&&B>0){var N=f/o;E.push(C*N,D*N,O*N,B*N)}return v.drawImage.apply(v,[i].concat(s(E.map((function(t){return Math.floor(St(t))}))))),g},setAspectRatio:function(t){var e=this.options;return this.disabled||vt(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var r=t===X,a=e.movable&&t===I;t=r||a?t:U,e.dragMode=t,Pt(i,A,t),Wt(i,N,r),Wt(i,R,a),e.cropBoxMovable||(Pt(n,A,t),Wt(n,N,r),Wt(n,R,a))}return this}},me=g.Cropper,ge=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n(this,t),!e||!ct.test(e.tagName))throw new Error("The first argument is required and must be an or element.");this.element=e,this.options=Ot({},lt,wt(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return a(t,[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e[b]){if(e[b]=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,n=this.options;if(n.rotatable||n.scalable||(n.checkOrientation=!1),n.checkOrientation&&window.ArrayBuffer)if(st.test(t))ht.test(t)?this.read(ae(t)):this.clone();else{var r=new XMLHttpRequest,a=this.clone.bind(this);this.reloading=!0,this.xhr=r,r.onabort=a,r.onerror=a,r.ontimeout=a,r.onprogress=function(){r.getResponseHeader("content-type")!==at&&r.abort()},r.onload=function(){e.read(r.response)},r.onloadend=function(){e.reloading=!1,e.xhr=null},n.checkCrossOrigin&&Ft(t)&&i.crossOrigin&&(t=Zt(t)),r.open("GET",t,!0),r.responseType="arraybuffer",r.withCredentials="use-credentials"===i.crossOrigin,r.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,n=se(t),r=0,a=1,o=1;if(n>1){this.url=oe(t,at);var s=he(n);r=s.rotate,a=s.scaleX,o=s.scaleY}e.rotatable&&(i.rotate=r),e.scalable&&(i.scaleX=a,i.scaleY=o),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,n=e;this.options.checkCrossOrigin&&Ft(e)&&(i||(i="anonymous"),n=Zt(e)),this.crossOrigin=i,this.crossOriginUrl=n;var r=document.createElement("img");i&&(r.crossOrigin=i),r.src=n||e,r.alt=t.alt||"The image to crop",this.image=r,r.onload=this.start.bind(this),r.onerror=this.stop.bind(this),Et(r,H),t.parentNode.insertBefore(r,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=g.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(g.navigator.userAgent),n=function(e,i){Ot(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Ot({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var r=document.createElement("img"),a=document.body||document.documentElement;this.sizingImage=r,r.onload=function(){n(r.width,r.height),i||a.removeChild(r)},r.src=e.src,i||(r.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",a.appendChild(r))}else n(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,i=this.image,n=t.parentNode,r=document.createElement("div");r.innerHTML=dt;var a=r.querySelector(".".concat(b,"-container")),o=a.querySelector(".".concat(b,"-canvas")),s=a.querySelector(".".concat(b,"-drag-box")),h=a.querySelector(".".concat(b,"-crop-box")),c=h.querySelector(".".concat(b,"-face"));this.container=n,this.cropper=a,this.canvas=o,this.dragBox=s,this.cropBox=h,this.viewBox=a.querySelector(".".concat(b,"-view-box")),this.face=c,o.appendChild(i),Et(t,L),n.insertBefore(a,t.nextSibling),Nt(i,H),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,Et(h,L),e.guides||Et(h.getElementsByClassName("".concat(b,"-dashed")),L),e.center||Et(h.getElementsByClassName("".concat(b,"-center")),L),e.background&&Et(a,"".concat(b,"-bg")),e.highlight||Et(c,z),e.cropBoxMovable&&(Et(c,R),Pt(c,A,w)),e.cropBoxResizable||(Et(h.getElementsByClassName("".concat(b,"-line")),L),Et(h.getElementsByClassName("".concat(b,"-point")),L)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),xt(e.ready)&&It(t,et,e.ready,{once:!0}),Ut(t,et)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var t=this.cropper.parentNode;t&&t.removeChild(this.cropper),Nt(this.element,L)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=me,t}},{key:"setDefaults",value:function(t){Ot(lt,wt(t)&&t)}}]),t}();return Ot(ge.prototype,ce,pe,ue,le,de,fe),ge}))}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var a=e[n]={exports:{}};return t[n].call(a.exports,a,a.exports,i),a.exports}!function(){i.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return i.d(e,{a:e}),e}}(),function(){i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){i.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){i.p=""}();var n={};return function(){"use strict";if("undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(i.p=e[1])}i(7658);var n=i(3129),r=i.n(n);const a="undefined"===typeof window?[String,Array]:[String,Array,Element,NodeList];var o={render(t){const e=this.crossorigin||void 0;return t("div",{style:this.containerStyle},[t("img",{ref:"img",attrs:{src:this.src,alt:this.alt||"image",crossorigin:e},style:[{"max-width":"100%"},this.imgStyle]})])},props:{containerStyle:Object,src:{type:String,default:""},alt:String,imgStyle:Object,viewMode:Number,dragMode:String,initialAspectRatio:Number,aspectRatio:Number,value:Object,preview:a,responsive:{type:Boolean,default:!0},restore:{type:Boolean,default:!0},checkCrossOrigin:{type:Boolean,default:!0},checkOrientation:{type:Boolean,default:!0},crossorigin:{type:String},modal:{type:Boolean,default:!0},guides:{type:Boolean,default:!0},center:{type:Boolean,default:!0},highlight:{type:Boolean,default:!0},background:{type:Boolean,default:!0},autoCrop:{type:Boolean,default:!0},autoCropArea:Number,movable:{type:Boolean,default:!0},rotatable:{type:Boolean,default:!0},scalable:{type:Boolean,default:!0},zoomable:{type:Boolean,default:!1},zoomOnTouch:{type:Boolean,default:!1},zoomOnWheel:{type:Boolean,default:!1},wheelZoomRatio:Number,cropBoxMovable:{type:Boolean,default:!0},cropBoxResizable:{type:Boolean,default:!0},toggleDragModeOnDblclick:{type:Boolean,default:!0},minCanvasWidth:Number,minCanvasHeight:Number,minCropBoxWidth:Number,minCropBoxHeight:Number,minContainerWidth:Number,minContainerHeight:Number},mounted(){const{containerStyle:t,value:e,src:i,alt:n,imgStyle:a,...o}=this.$props,s={};for(const r in o)void 0!==this[r]&&(s[r]=this[r]);s.cropend=t=>{this.$emit("input",this.getData())},s.zoom=t=>{this.$emit("input",this.getData())},s.data=e,this.cropper=new(r())(this.$refs.img,s)},methods:{reset(){return this.cropper.reset()},clear(){return this.cropper.clear()},initCrop(){return this.cropper.crop()},replace(t,e=!1){return this.cropper.replace(t,e)},enable(){return this.cropper.enable()},disable(){return this.cropper.disable()},destroy(){return this.cropper.destroy()},move(t,e){return this.cropper.move(t,e)},moveTo(t,e=t){return this.cropper.moveTo(t,e)},relativeZoom(t,e){return this.cropper.zoom(t,e)},zoomTo(t,e){return this.cropper.zoomTo(t,e)},rotate(t){return this.cropper.rotate(t)},rotateTo(t){return this.cropper.rotateTo(t)},scaleX(t){return this.cropper.scaleX(t)},scaleY(t){return this.cropper.scaleY(t)},scale(t,e=t){return this.cropper.scale(t,e)},getData(t=!1){return this.cropper.getData(t)},setData(t){return this.cropper.setData(t)},getContainerData(){return this.cropper.getContainerData()},getImageData(){return this.cropper.getImageData()},getCanvasData(){return this.cropper.getCanvasData()},setCanvasData(t){return this.cropper.setCanvasData(t)},getCropBoxData(){return this.cropper.getCropBoxData()},setCropBoxData(t){return this.cropper.setCropBoxData(t)},getCroppedCanvas(t={}){return this.cropper.getCroppedCanvas(t)},setAspectRatio(t){return this.cropper.setAspectRatio(t)},setDragMode(t){return this.cropper.setDragMode(t)}}};(window.__goplaidVueComponentRegisters=window.__goplaidVueComponentRegisters||[]).push((t=>{t.component("vue-cropper",o)}))}(),n=n["default"],n}()}));