//>>built
/*
 Cropper.js v1.5.1
 https://fengyuanchen.github.io/cropperjs

 Copyright 2015-present Chen Fengyuan
 Released under the MIT license

 Date: 2019-03-10T09:55:53.729Z
*/
!function(fa,W){"object"==typeof exports&&"undefined"!=typeof module?module.exports=W():"function"==typeof define&&define.amd?define(W):(fa=fa||self).Cropper=W()}(this,function(){function fa(a){return(fa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(c){return typeof c}:function(c){return c&&"function"==typeof Symbol&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c})(a)}function W(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=
!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}function Ia(a){if(!(a=function(c){if(Array.isArray(c)){for(var b=0,d=Array(c.length);b<c.length;b++)d[b]=c[b];return d}}(a)||function(c){if(Symbol.iterator in Object(c)||"[object Arguments]"===Object.prototype.toString.call(c))return Array.from(c)}(a)))throw new TypeError("Invalid attempt to spread non-iterable instance");return a}function r(a){return"number"==typeof a&&!Xa(a)}function T(a){return"object"===fa(a)&&null!==a}function X(a){if(!T(a))return!1;
try{var c=a.constructor,b=c.prototype;return c&&b&&Ya.call(b,"isPrototypeOf")}catch(d){return!1}}function D(a){return"function"==typeof a}function Ja(a){return Array.from?Array.from(a):Za.call(a)}function x(a,c){return a&&D(c)&&(Array.isArray(a)||r(a.length)?Ja(a).forEach(function(b,d){c.call(a,b,d,a)}):T(a)&&Object.keys(a).forEach(function(b){c.call(a,a[b],b,a)})),a}function Y(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1E11;return $a.test(a)?Math.round(a*c)/c:a}function P(a,
c){var b=a.style;x(c,function(d,e){ab.test(e)&&r(d)&&(d="".concat(d,"px"));b[e]=d})}function z(a,c){if(c)if(r(a.length))x(a,function(d){z(d,c)});else if(a.classList)a.classList.add(c);else{var b=a.className.trim();b?0>b.indexOf(c)&&(a.className="".concat(b," ").concat(c)):a.className=c}}function K(a,c){c&&(r(a.length)?x(a,function(b){K(b,c)}):a.classList?a.classList.remove(c):0<=a.className.indexOf(c)&&(a.className=a.className.replace(c,"")))}function Z(a,c,b){c&&(r(a.length)?x(a,function(d){Z(d,
c,b)}):b?z(a,c):K(a,c))}function va(a){return a.replace(bb,"$1-$2").toLowerCase()}function wa(a,c){return T(a[c])?a[c]:a.dataset?a.dataset[c]:a.getAttribute("data-".concat(va(c)))}function ha(a,c,b){T(b)?a[c]=b:a.dataset?a.dataset[c]=b:a.setAttribute("data-".concat(va(c)),b)}function I(a,c,b){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},e=b;c.trim().split(Ka).forEach(function(f){if(!La){var h=a.listeners;h&&h[f]&&h[f][b]&&(e=h[f][b],delete h[f][b],0===Object.keys(h[f]).length&&
delete h[f],0===Object.keys(h).length&&delete a.listeners)}a.removeEventListener(f,e,d)})}function G(a,c,b){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},e=b;c.trim().split(Ka).forEach(function(f){if(d.once&&!La){var h=a.listeners,g=void 0===h?{}:h;e=function(){delete g[f][b];a.removeEventListener(f,e,d);for(var m=arguments.length,l=Array(m),k=0;k<m;k++)l[k]=arguments[k];b.apply(a,l)};g[f]||(g[f]={});g[f][b]&&a.removeEventListener(f,g[f][b],d);g[f][b]=e;a.listeners=g}a.addEventListener(f,
e,d)})}function aa(a,c,b){var d;return D(Event)&&D(CustomEvent)?d=new CustomEvent(c,{detail:b,bubbles:!0,cancelable:!0}):(d=document.createEvent("CustomEvent")).initCustomEvent(c,!0,!0,b),a.dispatchEvent(d)}function Ma(a){a=a.getBoundingClientRect();return{left:a.left+(window.pageXOffset-document.documentElement.clientLeft),top:a.top+(window.pageYOffset-document.documentElement.clientTop)}}function Na(a){a=a.match(cb);return null!==a&&(a[1]!==xa.protocol||a[2]!==xa.hostname||a[3]!==xa.port)}function Oa(a){var c=
"timestamp\x3d".concat((new Date).getTime());return a+(-1===a.indexOf("?")?"?":"\x26")+c}function ia(a){var c=a.rotate,b=a.scaleX,d=a.scaleY,e=a.translateX;a=a.translateY;var f=[];r(e)&&0!==e&&f.push("translateX(".concat(e,"px)"));r(a)&&0!==a&&f.push("translateY(".concat(a,"px)"));r(c)&&0!==c&&f.push("rotate(".concat(c,"deg)"));r(b)&&1!==b&&f.push("scaleX(".concat(b,")"));r(d)&&1!==d&&f.push("scaleY(".concat(d,")"));c=f.length?f.join(" "):"none";return{WebkitTransform:c,msTransform:c,transform:c}}
function na(a,c){var b=a.pageX;a=a.pageY;var d={endX:b,endY:a};return c?d:v({startX:b,startY:a},d)}function Q(a){var c=a.aspectRatio,b=a.height,d=a.width,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"contain",f=0<d&&d<1/0,h=0<b&&b<1/0;f&&h?(f=b*c,"contain"===e&&d<f||"cover"===e&&f<d?b=d/c:d=b*c):f?b=d/c:h&&(d=b*c);return{width:d,height:b}}function db(a){a=new DataView(a);try{var c,b;if(255===a.getUint8(0)&&216===a.getUint8(1))for(var d=a.byteLength,e=2;e+1<d;){if(255===a.getUint8(e)&&
225===a.getUint8(e+1)){var f=e;break}e+=1}if(f){d=f+10;var h=f+4;f=4;e="";for(f+=h;h<f;h+=1)e+=Pa(a.getUint8(h));if("Exif"===e){var g=a.getUint16(d);if(((c=18761===g)||19789===g)&&42===a.getUint16(d+2,c)){var m=a.getUint32(d+4,c);8<=m&&(b=d+m)}}}if(b){var l,k,n=a.getUint16(b,c);for(k=0;k<n;k+=1)if(l=b+12*k+2,274===a.getUint16(l,c)){l+=8;var t=a.getUint16(l,c);a.setUint16(l,1,c);break}}}catch(u){t=1}return t}var oa="undefined"!=typeof window,L=oa?window:{},ba=!!oa&&"ontouchstart"in L.document.documentElement,
ya=!!oa&&"PointerEvent"in L,pa="".concat("cropper","-crop"),Qa="".concat("cropper","-disabled"),E="".concat("cropper","-hidden"),Ra="".concat("cropper","-hide"),eb="".concat("cropper","-invisible"),qa="".concat("cropper","-modal"),za="".concat("cropper","-move"),ja="".concat("cropper","Action"),M="".concat("cropper","Preview"),Sa=ya?"pointerdown":ba?"touchstart":"mousedown",Ta=ya?"pointermove":ba?"touchmove":"mousemove",Ua=ya?"pointerup pointercancel":ba?"touchend touchcancel":"mouseup",fb=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,
gb=/^data:image\/jpeg;base64,/,hb=/^img|canvas$/i,Va={viewMode:0,dragMode:"crop",initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,
minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Xa=Number.isNaN||L.isNaN,Ya=Object.prototype.hasOwnProperty,Za=Array.prototype.slice,v=Object.assign||function(a){for(var c=arguments.length,b=Array(1<c?c-1:0),d=1;d<c;d++)b[d-1]=arguments[d];return T(a)&&0<b.length&&b.forEach(function(e){T(e)&&Object.keys(e).forEach(function(f){a[f]=e[f]})}),a},$a=/\.\d*(?:0|9){12}\d*$/,ab=/^width|height|left|top|marginLeft|marginTop$/,
bb=/([a-z\d])([A-Z])/g,Ka=/\s\s*/,La=function(){var a=!1;if(oa){var c=!1,b=function(){},d=Object.defineProperty({},"once",{get:function(){return a=!0,c},set:function(e){c=e}});L.addEventListener("test",b,d);L.removeEventListener("test",b,d)}return a}(),xa=L.location,cb=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i,Pa=String.fromCharCode,ib=/^data:.*,/,jb=L.Cropper;ba=function(){function a(d){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");
if(!d||!hb.test(d.tagName))throw Error("The first argument is required and must be an \x3cimg\x3e or \x3ccanvas\x3e element.");this.element=d;this.options=v({},Va,X(e)&&e);this.disabled=this.cropped=!1;this.pointers={};this.sizing=this.sized=this.replaced=this.reloading=this.ready=!1;this.init()}var c,b;return b=[{key:"noConflict",value:function(){return window.Cropper=jb,a}},{key:"setDefaults",value:function(d){v(Va,X(d)&&d)}}],c=[{key:"init",value:function(){var d,e=this.element,f=e.tagName.toLowerCase();
if(!e.cropper){if(e.cropper=this,"img"===f){if(this.isImg=!0,d=e.getAttribute("src")||"",!(this.originalUrl=d))return;d=e.src}else"canvas"===f&&window.HTMLCanvasElement&&(d=e.toDataURL());this.load(d)}}},{key:"load",value:function(d){var e=this;if(d){this.url=d;this.imageData={};var f=this.element,h=this.options;if(h.rotatable||h.scalable||(h.checkOrientation=!1),h.checkOrientation&&window.ArrayBuffer)if(gb.test(d))this.read((g=d.replace(ib,""),m=atob(g),l=new ArrayBuffer(m.length),x(k=new Uint8Array(l),
function(t,u){k[u]=m.charCodeAt(u)}),l));else{var g,m,l,k,n=new XMLHttpRequest;g=this.clone.bind(this);this.reloading=!0;(this.xhr=n).onabort=g;n.onerror=g;n.ontimeout=g;n.onprogress=function(){"image/jpeg"!==n.getResponseHeader("content-type")&&n.abort()};n.onload=function(){e.read(n.response)};n.onloadend=function(){e.reloading=!1;e.xhr=null};h.checkCrossOrigin&&Na(d)&&f.crossOrigin&&(d=Oa(d));n.open("GET",d);n.responseType="arraybuffer";n.withCredentials="use-credentials"===f.crossOrigin;n.send()}else this.clone()}}},
{key:"read",value:function(d){var e=this.options,f=this.imageData,h=db(d),g=0,m=1,l=1;1<h&&(this.url=function(k,n){var t=[];for(k=new Uint8Array(k);0<k.length;)t.push(Pa.apply(null,Ja(k.subarray(0,8192)))),k=k.subarray(8192);return"data:".concat(n,";base64,").concat(btoa(t.join("")))}(d,"image/jpeg"),d=function(k){var n=0,t=1,u=1;switch(k){case 2:t=-1;break;case 3:n=-180;break;case 4:u=-1;break;case 5:n=90;u=-1;break;case 6:n=90;break;case 7:n=90;t=-1;break;case 8:n=-90}return{rotate:n,scaleX:t,scaleY:u}}(h),
g=d.rotate,m=d.scaleX,l=d.scaleY);e.rotatable&&(f.rotate=g);e.scalable&&(f.scaleX=m,f.scaleY=l);this.clone()}},{key:"clone",value:function(){var d,e,f=this.element,h=this.url;this.options.checkCrossOrigin&&Na(h)&&(e=(d=f.crossOrigin)?h:(d="anonymous",Oa(h)));this.crossOrigin=d;this.crossOriginUrl=e;var g=document.createElement("img");d&&(g.crossOrigin=d);g.src=e||h;(this.image=g).onload=this.start.bind(this);g.onerror=this.stop.bind(this);z(g,Ra);f.parentNode.insertBefore(g,f.nextSibling)}},{key:"start",
value:function(){var d=this,e=this.isImg?this.element:this.image;e.onload=null;e.onerror=null;this.sizing=!0;var f=L.navigator&&/^(?:.(?!chrome|android))*safari/i.test(L.navigator.userAgent),h=function(l,k){v(d.imageData,{naturalWidth:l,naturalHeight:k,aspectRatio:l/k});d.sizing=!1;d.sized=!0;d.build()};if(!e.naturalWidth||f){var g=document.createElement("img"),m=document.body||document.documentElement;(this.sizingImage=g).onload=function(){h(g.width,g.height);f||m.removeChild(g)};g.src=e.src;f||
(g.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;",m.appendChild(g))}else h(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var d=this.image;d.onload=null;d.onerror=null;d.parentNode.removeChild(d);this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var d=this.element,e=this.options,f=this.image,h=d.parentNode,g=document.createElement("div");g.innerHTML=
'\x3cdiv class\x3d"cropper-container" touch-action\x3d"none"\x3e\x3cdiv class\x3d"cropper-wrap-box"\x3e\x3cdiv class\x3d"cropper-canvas"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"cropper-drag-box"\x3e\x3c/div\x3e\x3cdiv class\x3d"cropper-crop-box"\x3e\x3cspan class\x3d"cropper-view-box"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-dashed dashed-h"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-dashed dashed-v"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-center"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-face"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-line line-e" data-cropper-action\x3d"e"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-line line-n" data-cropper-action\x3d"n"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-line line-w" data-cropper-action\x3d"w"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-line line-s" data-cropper-action\x3d"s"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-point point-e" data-cropper-action\x3d"e"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-point point-n" data-cropper-action\x3d"n"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-point point-w" data-cropper-action\x3d"w"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-point point-s" data-cropper-action\x3d"s"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-point point-ne" data-cropper-action\x3d"ne"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-point point-nw" data-cropper-action\x3d"nw"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-point point-sw" data-cropper-action\x3d"sw"\x3e\x3c/span\x3e\x3cspan class\x3d"cropper-point point-se" data-cropper-action\x3d"se"\x3e\x3c/span\x3e\x3c/div\x3e\x3c/div\x3e';
g=g.querySelector(".".concat("cropper","-container"));var m=g.querySelector(".".concat("cropper","-canvas")),l=g.querySelector(".".concat("cropper","-drag-box")),k=g.querySelector(".".concat("cropper","-crop-box")),n=k.querySelector(".".concat("cropper","-face"));this.container=h;this.cropper=g;this.canvas=m;this.dragBox=l;this.cropBox=k;this.viewBox=g.querySelector(".".concat("cropper","-view-box"));this.face=n;m.appendChild(f);z(d,E);h.insertBefore(g,d.nextSibling);this.isImg||K(f,Ra);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;z(k,E);e.guides||z(k.getElementsByClassName("".concat("cropper","-dashed")),E);e.center||z(k.getElementsByClassName("".concat("cropper","-center")),E);e.background&&z(g,"".concat("cropper","-bg"));e.highlight||z(n,eb);e.cropBoxMovable&&(z(n,za),ha(n,ja,"all"));e.cropBoxResizable||(z(k.getElementsByClassName("".concat("cropper",
"-line")),E),z(k.getElementsByClassName("".concat("cropper","-point")),E));this.render();this.ready=!0;this.setDragMode(e.dragMode);e.autoCrop&&this.crop();this.setData(e.data);D(e.ready)&&G(d,"ready",e.ready,{once:!0});aa(d,"ready")}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),K(this.element,E))}},{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()}}],W(a.prototype,c),b&&W(a,b),a}();return v(ba.prototype,{render:function(){this.initContainer();this.initCanvas();this.initCropBox();this.renderCanvas();this.cropped&&this.renderCropBox()},initContainer:function(){var a=this.element,c=this.options,b=this.container,d=this.cropper;z(d,E);K(a,E);c={width:Math.max(b.offsetWidth,Number(c.minContainerWidth)||200),
height:Math.max(b.offsetHeight,Number(c.minContainerHeight)||100)};P(d,{width:(this.containerData=c).width,height:c.height});z(a,E);K(d,E)},initCanvas:function(){var a=this.containerData,c=this.imageData,b=this.options.viewMode,d=90==Math.abs(c.rotate)%180,e=d?c.naturalHeight:c.naturalWidth,f=d?c.naturalWidth:c.naturalHeight,h=e/f;d=a.width;var g=a.height;a.height*h>a.width?3===b?d=a.height*h:g=a.width/h:3===b?g=a.width/h:d=a.height*h;e={aspectRatio:h,naturalWidth:e,naturalHeight:f,width:d,height:g};
e.left=(a.width-d)/2;e.top=(a.height-g)/2;e.oldLeft=e.left;e.oldTop=e.top;this.canvasData=e;this.limited=1===b||2===b;this.limitCanvas(!0,!0);this.initialImageData=v({},c);this.initialCanvasData=v({},e)},limitCanvas:function(a,c){var b=this.options,d=this.containerData,e=this.canvasData,f=this.cropBoxData,h=b.viewMode,g=e.aspectRatio,m=this.cropped&&f;a&&(a=Number(b.minCanvasWidth)||0,b=Number(b.minCanvasHeight)||0,1<h?(a=Math.max(a,d.width),b=Math.max(b,d.height),3===h&&(a<b*g?a=b*g:b=a/g)):0<h&&
(a?a=Math.max(a,m?f.width:0):b?b=Math.max(b,m?f.height:0):m&&((a=f.width)<(b=f.height)*g?a=b*g:b=a/g)),g=Q({aspectRatio:g,width:a,height:b}),a=g.width,b=g.height,e.minWidth=a,e.minHeight=b,e.maxWidth=1/0,e.maxHeight=1/0);c&&((m?0:1)<h?(c=d.width-e.width,g=d.height-e.height,e.minLeft=Math.min(0,c),e.minTop=Math.min(0,g),e.maxLeft=Math.max(0,c),e.maxTop=Math.max(0,g),m&&this.limited&&(e.minLeft=Math.min(f.left,f.left+(f.width-e.width)),e.minTop=Math.min(f.top,f.top+(f.height-e.height)),e.maxLeft=f.left,
e.maxTop=f.top,2===h&&(e.width>=d.width&&(e.minLeft=Math.min(0,c),e.maxLeft=Math.max(0,c)),e.height>=d.height&&(e.minTop=Math.min(0,g),e.maxTop=Math.max(0,g))))):(e.minLeft=-e.width,e.minTop=-e.height,e.maxLeft=d.width,e.maxTop=d.height))},renderCanvas:function(a,c){var b=this.canvasData,d=this.imageData;if(c){c=d.naturalWidth*Math.abs(d.scaleX||1);var e=d.naturalHeight*Math.abs(d.scaleY||1);d=d.rotate||0;if(90==(d=Math.abs(d)%180))e={width:e,height:c};else{var f=d%90*Math.PI/180,h=Math.sin(f),g=
Math.cos(f);f=c*g+e*h;c=c*h+e*g;e=90<d?{width:c,height:f}:{width:f,height:c}}c=e.width;e=e.height;d=c/b.naturalWidth*b.width;h=e/b.naturalHeight*b.height;b.left-=(d-b.width)/2;b.top-=(h-b.height)/2;b.width=d;b.height=h;b.aspectRatio=c/e;b.naturalWidth=c;b.naturalHeight=e;this.limitCanvas(!0,!1)}(b.width>b.maxWidth||b.width<b.minWidth)&&(b.left=b.oldLeft);(b.height>b.maxHeight||b.height<b.minHeight)&&(b.top=b.oldTop);b.width=Math.min(Math.max(b.width,b.minWidth),b.maxWidth);b.height=Math.min(Math.max(b.height,
b.minHeight),b.maxHeight);this.limitCanvas(!1,!0);b.left=Math.min(Math.max(b.left,b.minLeft),b.maxLeft);b.top=Math.min(Math.max(b.top,b.minTop),b.maxTop);b.oldLeft=b.left;b.oldTop=b.top;P(this.canvas,v({width:b.width,height:b.height},ia({translateX:b.left,translateY:b.top})));this.renderImage(a);this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(a){var c=this.canvasData,b=this.imageData,d=c.width/c.naturalWidth*b.naturalWidth,e=c.height/c.naturalHeight*b.naturalHeight;v(b,
{width:d,height:e,left:(c.width-d)/2,top:(c.height-e)/2});P(this.image,v({width:b.width,height:b.height},ia(v({translateX:b.left,translateY:b.top},b))));a&&this.output()},initCropBox:function(){var a=this.options,c=this.canvasData,b=a.aspectRatio||a.initialAspectRatio;a=Number(a.autoCropArea)||.8;var d={width:c.width,height:c.height};b&&(c.height*b>c.width?d.height=d.width/b:d.width=d.height*b);this.cropBoxData=d;this.limitCropBox(!0,!0);d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth);d.height=
Math.min(Math.max(d.height,d.minHeight),d.maxHeight);d.width=Math.max(d.minWidth,d.width*a);d.height=Math.max(d.minHeight,d.height*a);d.left=c.left+(c.width-d.width)/2;d.top=c.top+(c.height-d.height)/2;d.oldLeft=d.left;d.oldTop=d.top;this.initialCropBoxData=v({},d)},limitCropBox:function(a,c){var b=this.options,d=this.containerData,e=this.canvasData,f=this.cropBoxData,h=this.limited,g=b.aspectRatio;if(a){a=Number(b.minCropBoxWidth)||0;b=Number(b.minCropBoxHeight)||0;var m=h?Math.min(d.width,e.width,
e.width+e.left,d.width-e.left):d.width,l=h?Math.min(d.height,e.height,e.height+e.top,d.height-e.top):d.height;a=Math.min(a,d.width);b=Math.min(b,d.height);g&&(a&&b?a<b*g?b=a/g:a=b*g:a?b=a/g:b&&(a=b*g),m<l*g?l=m/g:m=l*g);f.minWidth=Math.min(a,m);f.minHeight=Math.min(b,l);f.maxWidth=m;f.maxHeight=l}c&&(f.maxTop=h?(f.minLeft=Math.max(0,e.left),f.minTop=Math.max(0,e.top),f.maxLeft=Math.min(d.width,e.left+e.width)-f.width,Math.min(d.height,e.top+e.height)-f.height):(f.minLeft=0,f.minTop=0,f.maxLeft=d.width-
f.width,d.height-f.height))},renderCropBox:function(){var a=this.options,c=this.containerData,b=this.cropBoxData;(b.width>b.maxWidth||b.width<b.minWidth)&&(b.left=b.oldLeft);(b.height>b.maxHeight||b.height<b.minHeight)&&(b.top=b.oldTop);b.width=Math.min(Math.max(b.width,b.minWidth),b.maxWidth);b.height=Math.min(Math.max(b.height,b.minHeight),b.maxHeight);this.limitCropBox(!1,!0);b.left=Math.min(Math.max(b.left,b.minLeft),b.maxLeft);b.top=Math.min(Math.max(b.top,b.minTop),b.maxTop);b.oldLeft=b.left;
b.oldTop=b.top;a.movable&&a.cropBoxMovable&&ha(this.face,ja,b.width>=c.width&&b.height>=c.height?"move":"all");P(this.cropBox,v({width:b.width,height:b.height},ia({translateX:b.left,translateY:b.top})));this.cropped&&this.limited&&this.limitCanvas(!0,!0);this.disabled||this.output()},output:function(){this.preview();aa(this.element,"crop",this.getData())}},{initPreview:function(){var a=this.crossOrigin,c=this.options.preview,b=a?this.crossOriginUrl:this.url,d=document.createElement("img");if(a&&(d.crossOrigin=
a),d.src=b,this.viewBox.appendChild(d),this.viewBoxImage=d,c)d=c,"string"==typeof c?d=this.element.ownerDocument.querySelectorAll(c):c.querySelector&&(d=[c]),x(this.previews=d,function(e){var f=document.createElement("img");ha(e,M,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML});a&&(f.crossOrigin=a);f.src=b;f.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;"';
e.innerHTML="";e.appendChild(f)})},resetPreview:function(){x(this.previews,function(a){var c=wa(a,M);P(a,{width:c.width,height:c.height});a.innerHTML=c.html;if(T(a[M]))try{delete a[M]}catch(b){a[M]=void 0}else if(a.dataset)try{delete a.dataset[M]}catch(b){a.dataset[M]=void 0}else a.removeAttribute("data-".concat(va(M)))})},preview:function(){var a=this.imageData,c=this.canvasData,b=this.cropBoxData,d=b.width,e=b.height,f=a.width,h=a.height,g=b.left-c.left-a.left,m=b.top-c.top-a.top;this.cropped&&
!this.disabled&&(P(this.viewBoxImage,v({width:f,height:h},ia(v({translateX:-g,translateY:-m},a)))),x(this.previews,function(l){var k=wa(l,M),n=k.width;k=k.height;var t=n,u=k,w=1;d&&(u=e*(w=n/d));e&&k<u&&(t=d*(w=k/e),u=k);P(l,{width:t,height:u});P(l.getElementsByTagName("img")[0],v({width:f*w,height:h*w},ia(v({translateX:-g*w,translateY:-m*w},a))))}))}},{bind:function(){var a=this.element,c=this.options,b=this.cropper;D(c.cropstart)&&G(a,"cropstart",c.cropstart);D(c.cropmove)&&G(a,"cropmove",c.cropmove);
D(c.cropend)&&G(a,"cropend",c.cropend);D(c.crop)&&G(a,"crop",c.crop);D(c.zoom)&&G(a,"zoom",c.zoom);G(b,Sa,this.onCropStart=this.cropStart.bind(this));c.zoomable&&c.zoomOnWheel&&G(b,"wheel",this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0});c.toggleDragModeOnDblclick&&G(b,"dblclick",this.onDblclick=this.dblclick.bind(this));G(a.ownerDocument,Ta,this.onCropMove=this.cropMove.bind(this));G(a.ownerDocument,Ua,this.onCropEnd=this.cropEnd.bind(this));c.responsive&&G(window,"resize",this.onResize=
this.resize.bind(this))},unbind:function(){var a=this.element,c=this.options,b=this.cropper;D(c.cropstart)&&I(a,"cropstart",c.cropstart);D(c.cropmove)&&I(a,"cropmove",c.cropmove);D(c.cropend)&&I(a,"cropend",c.cropend);D(c.crop)&&I(a,"crop",c.crop);D(c.zoom)&&I(a,"zoom",c.zoom);I(b,Sa,this.onCropStart);c.zoomable&&c.zoomOnWheel&&I(b,"wheel",this.onWheel,{passive:!1,capture:!0});c.toggleDragModeOnDblclick&&I(b,"dblclick",this.onDblclick);I(a.ownerDocument,Ta,this.onCropMove);I(a.ownerDocument,Ua,this.onCropEnd);
c.responsive&&I(window,"resize",this.onResize)}},{resize:function(){var a=this.options,c=this.container,b=this.containerData,d=Number(a.minContainerWidth)||200,e=Number(a.minContainerHeight)||100;if(!(this.disabled||b.width<=d||b.height<=e)){var f,h,g=c.offsetWidth/b.width;if(1!==g||c.offsetHeight!==b.height)a.restore&&(f=this.getCanvasData(),h=this.getCropBoxData()),this.render(),a.restore&&(this.setCanvasData(x(f,function(m,l){f[l]=m*g})),this.setCropBoxData(x(h,function(m,l){h[l]=m*g})))}},dblclick:function(){var a;
this.disabled||"none"===this.options.dragMode||this.setDragMode((a=this.dragBox,(a.classList?a.classList.contains(pa):-1<a.className.indexOf(pa))?"move":"crop"))},wheel:function(a){var c=this,b=Number(this.options.wheelZoomRatio)||.1,d=1;this.disabled||(a.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout(function(){c.wheeling=!1},50),a.deltaY?d=0<a.deltaY?1:-1:a.wheelDelta?d=-a.wheelDelta/120:a.detail&&(d=0<a.detail?1:-1),this.zoom(-d*b,a)))},cropStart:function(a){var c=a.buttons,b=a.button;
if(!(this.disabled||r(c)&&1!==c||r(b)&&0!==b||a.ctrlKey)){c=this.options;var d=this.pointers;a.changedTouches?x(a.changedTouches,function(e){d[e.identifier]=na(e)}):d[a.pointerId||0]=na(a);c=1<Object.keys(d).length&&c.zoomable&&c.zoomOnTouch?"zoom":wa(a.target,ja);fb.test(c)&&!1!==aa(this.element,"cropstart",{originalEvent:a,action:c})&&(a.preventDefault(),this.action=c,this.cropping=!1,"crop"===c&&(this.cropping=!0,z(this.dragBox,qa)))}},cropMove:function(a){var c=this.action;if(!this.disabled&&
c){var b=this.pointers;a.preventDefault();!1!==aa(this.element,"cropmove",{originalEvent:a,action:c})&&(a.changedTouches?x(a.changedTouches,function(d){v(b[d.identifier]||{},na(d,!0))}):v(b[a.pointerId||0]||{},na(a,!0)),this.change(a))}},cropEnd:function(a){if(!this.disabled){var c=this.action,b=this.pointers;a.changedTouches?x(a.changedTouches,function(d){delete b[d.identifier]}):delete b[a.pointerId||0];c&&(a.preventDefault(),Object.keys(b).length||(this.action=""),this.cropping&&(this.cropping=
!1,Z(this.dragBox,qa,this.cropped&&this.options.modal)),aa(this.element,"cropend",{originalEvent:a,action:c}))}}},{change:function(a){var c=this.canvasData,b=this.containerData,d=this.cropBoxData,e=this.pointers,f=this.action,h=this.options.aspectRatio,g=d.left,m=d.top,l=d.width,k=d.height,n=g+l,t=m+k,u=0,w=0,F=b.width,C=b.height,y=!0;!h&&a.shiftKey&&(h=l&&k?l/k:1);this.limited&&(u=d.minLeft,w=d.minTop,F=u+Math.min(b.width,c.width,c.left+c.width),C=w+Math.min(b.height,c.height,c.top+c.height));var ca,
R;c=e[Object.keys(e)[0]];var q=c.endX-c.startX,p=c.endY-c.startY;b=function(B){switch(B){case "e":n+q>F&&(q=F-n);break;case "w":g+q<u&&(q=u-g);break;case "n":m+p<w&&(p=w-m);break;case "s":t+p>C&&(p=C-t)}};switch(f){case "all":g+=q;m+=p;break;case "e":if(0<=q&&(F<=n||h&&(m<=w||C<=t))){y=!1;break}b("e");0>(l+=q)&&(f="w",g-=l=-l);h&&(k=l/h,m+=(d.height-k)/2);break;case "n":if(0>=p&&(m<=w||h&&(g<=u||F<=n))){y=!1;break}b("n");k-=p;m+=p;0>k&&(f="s",m-=k=-k);h&&(l=k*h,g+=(d.width-l)/2);break;case "w":if(0>=
q&&(g<=u||h&&(m<=w||C<=t))){y=!1;break}b("w");l-=q;g+=q;0>l&&(f="e",g-=l=-l);h&&(k=l/h,m+=(d.height-k)/2);break;case "s":if(0<=p&&(C<=t||h&&(g<=u||F<=n))){y=!1;break}b("s");0>(k+=p)&&(f="n",m-=k=-k);h&&(l=k*h,g+=(d.width-l)/2);break;case "ne":if(h){if(0>=p&&(m<=w||F<=n)){y=!1;break}b("n");k-=p;m+=p;l=k*h}else b("n"),b("e"),0<=q?n<F?l+=q:0>=p&&m<=w&&(y=!1):l+=q,0>=p?w<m&&(k-=p,m+=p):(k-=p,m+=p);0>l&&0>k?(f="sw",m-=k=-k,g-=l=-l):0>l?(f="nw",g-=l=-l):0>k&&(f="se",m-=k=-k);break;case "nw":if(h){if(0>=
p&&(m<=w||g<=u)){y=!1;break}b("n");k-=p;m+=p;l=k*h;g+=d.width-l}else b("n"),b("w"),0>=q?u<g?(l-=q,g+=q):0>=p&&m<=w&&(y=!1):(l-=q,g+=q),0>=p?w<m&&(k-=p,m+=p):(k-=p,m+=p);0>l&&0>k?(f="se",m-=k=-k,g-=l=-l):0>l?(f="ne",g-=l=-l):0>k&&(f="sw",m-=k=-k);break;case "sw":if(h){if(0>=q&&(g<=u||C<=t)){y=!1;break}b("w");l-=q;g+=q;k=l/h}else b("s"),b("w"),0>=q?u<g?(l-=q,g+=q):0<=p&&C<=t&&(y=!1):(l-=q,g+=q),0<=p?t<C&&(k+=p):k+=p;0>l&&0>k?(f="ne",m-=k=-k,g-=l=-l):0>l?(f="se",g-=l=-l):0>k&&(f="nw",m-=k=-k);break;
case "se":if(h){if(0<=q&&(F<=n||C<=t)){y=!1;break}b("e");k=(l+=q)/h}else b("s"),b("e"),0<=q?n<F?l+=q:0<=p&&C<=t&&(y=!1):l+=q,0<=p?t<C&&(k+=p):k+=p;0>l&&0>k?(f="nw",m-=k=-k,g-=l=-l):0>l?(f="sw",g-=l=-l):0>k&&(f="ne",m-=k=-k);break;case "move":this.move(q,p);y=!1;break;case "zoom":this.zoom((ca=v({},e),R=[],x(e,function(B,U){delete ca[U];x(ca,function(J){var N=Math.abs(B.startX-J.startX),da=Math.abs(B.startY-J.startY),ea=Math.abs(B.endX-J.endX);J=Math.abs(B.endY-J.endY);N=Math.sqrt(N*N+da*da);R.push((Math.sqrt(ea*
ea+J*J)-N)/N)})}),R.sort(function(B,U){return Math.abs(B)<Math.abs(U)}),R[0]),a);y=!1;break;case "crop":q&&p?(a=Ma(this.cropper),g=c.startX-a.left,m=c.startY-a.top,l=d.minWidth,k=d.minHeight,0<q?f=0<p?"se":"ne":0>q&&(g-=l,f=0<p?"sw":"nw"),0>p&&(m-=k),this.cropped||(K(this.cropBox,E),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))):y=!1}y&&(d.width=l,d.height=k,d.left=g,d.top=m,this.action=f,this.renderCropBox());x(e,function(B){B.startX=B.endX;B.startY=B.endY})}},{crop:function(){return!this.ready||
this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&z(this.dragBox,qa),K(this.cropBox,E),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=v({},this.initialImageData),this.canvasData=v({},this.initialCanvasData),this.cropBoxData=v({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(v(this.cropBoxData,
{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),K(this.dragBox,qa),z(this.cropBox,E)),this},replace:function(a){var c=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&a&&(this.isImg&&(this.element.src=a),c?(this.url=a,this.image.src=a,this.ready&&(this.viewBoxImage.src=a,x(this.previews,function(b){b.getElementsByTagName("img")[0].src=a}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),
this.load(a))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,K(this.cropper,Qa)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,z(this.cropper,Qa)),this},destroy:function(){var a=this.element;return a.cropper&&(a.cropper=void 0,this.isImg&&this.replaced&&(a.src=this.originalUrl),this.uncreate()),this},move:function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:a,b=this.canvasData,d=b.left;b=b.top;return this.moveTo(void 0===
a?a:d+Number(a),void 0===c?c:b+Number(c))},moveTo:function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:a,b=this.canvasData,d=!1;return a=Number(a),c=Number(c),this.ready&&!this.disabled&&this.options.movable&&(r(a)&&(b.left=a,d=!0),r(c)&&(b.top=c,d=!0),d&&this.renderCanvas(!0)),this},zoom:function(a,c){var b=this.canvasData;return a=0>(a=Number(a))?1/(1-a):1+a,this.zoomTo(b.width*a/b.naturalWidth,null,c)},zoomTo:function(a,c,b){var d,e,f,h=this.options,g=this.canvasData,m=g.width,
l=g.height,k=g.naturalWidth,n=g.naturalHeight;if(0<=(a=Number(a))&&this.ready&&!this.disabled&&h.zoomable){h=k*a;n*=a;if(!1===aa(this.element,"zoom",{ratio:a,oldRatio:m/k,originalEvent:b}))return this;b?(c=this.pointers,a=Ma(this.cropper),b=c&&Object.keys(c).length?(f=e=d=0,x(c,function(t){var u=t.startY;d+=t.startX;e+=u;f+=1}),{pageX:d/=f,pageY:e/=f}):{pageX:b.pageX,pageY:b.pageY},g.left-=(b.pageX-a.left-g.left)/m*(h-m),g.top-=(b.pageY-a.top-g.top)/l*(n-l)):X(c)&&r(c.x)&&r(c.y)?(g.left-=(c.x-g.left)/
m*(h-m),g.top-=(c.y-g.top)/l*(n-l)):(g.left-=(h-m)/2,g.top-=(n-l)/2);g.width=h;g.height=n;this.renderCanvas(!0)}return this},rotate:function(a){return this.rotateTo((this.imageData.rotate||0)+Number(a))},rotateTo:function(a){return r(a=Number(a))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=a%360,this.renderCanvas(!0,!0)),this},scaleX:function(a){var c=this.imageData.scaleY;return this.scale(a,r(c)?c:1)},scaleY:function(a){var c=this.imageData.scaleX;return this.scale(r(c)?
c:1,a)},scale:function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:a,b=this.imageData,d=!1;return a=Number(a),c=Number(c),this.ready&&!this.disabled&&this.options.scalable&&(r(a)&&(b.scaleX=a,d=!0),r(c)&&(b.scaleY=c,d=!0),d&&this.renderCanvas(!0,!0)),this},getData:function(){var a=0<arguments.length&&void 0!==arguments[0]&&arguments[0],c=this.options,b=this.imageData,d=this.canvasData,e=this.cropBoxData;if(this.ready&&this.cropped){var f={x:e.left-d.left,y:e.top-d.top,width:e.width,
height:e.height};var h=b.width/b.naturalWidth;if(x(f,function(g,m){f[m]=g/h}),a)a=Math.round(f.y+f.height),d=Math.round(f.x+f.width),f.x=Math.round(f.x),f.y=Math.round(f.y),f.width=d-f.x,f.height=a-f.y}else f={x:0,y:0,width:0,height:0};return c.rotatable&&(f.rotate=b.rotate||0),c.scalable&&(f.scaleX=b.scaleX||1,f.scaleY=b.scaleY||1),f},setData:function(a){var c=this.options,b=this.imageData,d=this.canvasData,e={};if(this.ready&&!this.disabled&&X(a)){var f=!1;c.rotatable&&r(a.rotate)&&a.rotate!==b.rotate&&
(b.rotate=a.rotate,f=!0);c.scalable&&(r(a.scaleX)&&a.scaleX!==b.scaleX&&(b.scaleX=a.scaleX,f=!0),r(a.scaleY)&&a.scaleY!==b.scaleY&&(b.scaleY=a.scaleY,f=!0));f&&this.renderCanvas(!0,!0);c=b.width/b.naturalWidth;r(a.x)&&(e.left=a.x*c+d.left);r(a.y)&&(e.top=a.y*c+d.top);r(a.width)&&(e.width=a.width*c);r(a.height)&&(e.height=a.height*c);this.setCropBoxData(e)}return this},getContainerData:function(){return this.ready?v({},this.containerData):{}},getImageData:function(){return this.sized?v({},this.imageData):
{}},getCanvasData:function(){var a=this.canvasData,c={};return this.ready&&x("left top width height naturalWidth naturalHeight".split(" "),function(b){c[b]=a[b]}),c},setCanvasData:function(a){var c=this.canvasData,b=c.aspectRatio;return this.ready&&!this.disabled&&X(a)&&(r(a.left)&&(c.left=a.left),r(a.top)&&(c.top=a.top),r(a.width)?(c.width=a.width,c.height=a.width/b):r(a.height)&&(c.height=a.height,c.width=a.height*b),this.renderCanvas(!0)),this},getCropBoxData:function(){var a,c=this.cropBoxData;
return this.ready&&this.cropped&&(a={left:c.left,top:c.top,width:c.width,height:c.height}),a||{}},setCropBoxData:function(a){var c,b,d=this.cropBoxData,e=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&X(a)&&(r(a.left)&&(d.left=a.left),r(a.top)&&(d.top=a.top),r(a.width)&&a.width!==d.width&&(c=!0,d.width=a.width),r(a.height)&&a.height!==d.height&&(b=!0,d.height=a.height),e&&(c?d.height=d.width/e:b&&(d.width=d.height*e)),this.renderCropBox()),this},getCroppedCanvas:function(){var a=
0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var c,b,d,e,f,h,g,m,l,k,n,t,u,w,F,C,y,ca,R,q,p,B,U,J,N,da,ea,Aa,ka,H,Ba,Ca,ra,sa,Da,Ea,Fa,Ga,Wa,A=this.canvasData,V=(c=this.image,b=this.imageData,d=b.aspectRatio,e=b.naturalWidth,f=b.naturalHeight,h=b.rotate,g=void 0===h?0:h,m=b.scaleX,l=void 0===m?1:m,k=b.scaleY,n=void 0===k?1:k,t=A.aspectRatio,u=A.naturalWidth,w=A.naturalHeight,F=a.fillColor,C=void 0===F?"transparent":F,y=a.imageSmoothingEnabled,
ca=void 0===y||y,R=a.imageSmoothingQuality,q=void 0===R?"low":R,p=a.maxWidth,B=void 0===p?1/0:p,U=a.maxHeight,J=void 0===U?1/0:U,N=a.minWidth,da=void 0===N?0:N,ea=a.minHeight,Aa=void 0===ea?0:ea,ka=document.createElement("canvas"),H=ka.getContext("2d"),Ba=Q({aspectRatio:t,width:B,height:J}),Ca=Q({aspectRatio:t,width:da,height:Aa},"cover"),ra=Math.min(Ba.width,Math.max(Ca.width,u)),sa=Math.min(Ba.height,Math.max(Ca.height,w)),Da=Q({aspectRatio:d,width:B,height:J}),Ea=Q({aspectRatio:d,width:da,height:Aa},
"cover"),Fa=Math.min(Da.width,Math.max(Ea.width,e)),Ga=Math.min(Da.height,Math.max(Ea.height,f)),Wa=[-Fa/2,-Ga/2,Fa,Ga],ka.width=Y(ra),ka.height=Y(sa),H.fillStyle=C,H.fillRect(0,0,ra,sa),H.save(),H.translate(ra/2,sa/2),H.rotate(g*Math.PI/180),H.scale(l,n),H.imageSmoothingEnabled=ca,H.imageSmoothingQuality=q,H.drawImage.apply(H,[c].concat(Ia(Wa.map(function(Ha){return Math.floor(Y(Ha))})))),H.restore(),ka);if(!this.cropped)return V;d=this.getData();e=d.x;b=d.y;c=d.width;d=d.height;A=V.width/Math.floor(A.naturalWidth);
1!==A&&(e*=A,b*=A,c*=A,d*=A);g=c/d;f=Q({aspectRatio:g,width:a.maxWidth||1/0,height:a.maxHeight||1/0});h=Q({aspectRatio:g,width:a.minWidth||0,height:a.minHeight||0},"cover");g=Q({aspectRatio:g,width:a.width||(1!==A?V.width:c),height:a.height||(1!==A?V.height:d)});A=g.width;g=g.height;A=Math.min(f.width,Math.max(h.width,A));g=Math.min(f.height,Math.max(h.height,g));f=document.createElement("canvas");h=f.getContext("2d");f.width=Y(A);f.height=Y(g);h.fillStyle=a.fillColor||"transparent";h.fillRect(0,
0,A,g);g=a.imageSmoothingEnabled;a=a.imageSmoothingQuality;h.imageSmoothingEnabled=void 0===g||g;a&&(h.imageSmoothingQuality=a);var S,O,ta,ua,la,ma;a=V.width;g=V.height;e<=-c||a<e?la=ta=S=e=0:0>=e?(ta=-e,e=0,la=S=Math.min(a,c+e)):e<=a&&(ta=0,la=S=Math.min(c,a-e));0>=S||b<=-d||g<b?ma=ua=O=b=0:0>=b?(ua=-b,b=0,ma=O=Math.min(g,d+b)):b<=g&&(ua=0,ma=O=Math.min(d,g-b));S=[e,b,S,O];0<la&&0<ma&&(O=A/c,S.push(ta*O,ua*O,la*O,ma*O));return h.drawImage.apply(h,[V].concat(Ia(S.map(function(Ha){return Math.floor(Y(Ha))})))),
f},setAspectRatio:function(a){var c=this.options;return this.disabled||void 0===a||(c.aspectRatio=Math.max(0,a)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(a){var c=this.options,b=this.dragBox,d=this.face;if(this.ready&&!this.disabled){var e="crop"===a,f=c.movable&&"move"===a;a=e||f?a:"none";c.dragMode=a;ha(b,ja,a);Z(b,pa,e);Z(b,za,f);c.cropBoxMovable||(ha(d,ja,a),Z(d,pa,e),Z(d,za,f))}return this}}),ba});