=8&&(i=u+f)}}}if(i){var l,h,p=n.getUint16(i,r);for(h=0;ht.width?3===n?s=t.height*a:u=t.width/a:3===n?u=t.width/a:s=t.height*a;var c={aspectRatio:a,naturalWidth:o,naturalHeight:i,width:s,height:u};c.left=(t.width-s)/2,c.top=(t.height-u)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===n||2===n,this.limitCanvas(!0,!0),this.initialImageData=P({},e),this.initialCanvasData=P({},c)},limitCanvas:function(t,e){var n=this.options,r=this.containerData,o=this.canvasData,i=this.cropBoxData,a=n.viewMode,s=o.aspectRatio,u=this.cropped&&i;if(t){var c=Number(n.minCanvasWidth)||0,f=Number(n.minCanvasHeight)||0;a>1?(c=Math.max(c,r.width),f=Math.max(f,r.height),3===a&&(f*s>c?c=f*s:f=c/s)):a>0&&(c?c=Math.max(c,u?i.width:0):f?f=Math.max(f,u?i.height:0):u&&(c=i.width,(f=i.height)*s>c?c=f*s:f=c/s));var l=ot({aspectRatio:s,width:c,height:f});c=l.width,f=l.height,o.minWidth=c,o.minHeight=f,o.maxWidth=1/0,o.maxHeight=1/0}if(e)if(a>(u?0:1)){var h=r.width-o.width,p=r.height-o.height;o.minLeft=Math.min(0,h),o.minTop=Math.min(0,p),o.maxLeft=Math.max(0,h),o.maxTop=Math.max(0,p),u&&this.limited&&(o.minLeft=Math.min(i.left,i.left+(i.width-o.width)),o.minTop=Math.min(i.top,i.top+(i.height-o.height)),o.maxLeft=i.left,o.maxTop=i.top,2===a&&(o.width>=r.width&&(o.minLeft=Math.min(0,h),o.maxLeft=Math.max(0,h)),o.height>=r.height&&(o.minTop=Math.min(0,p),o.maxTop=Math.max(0,p))))}else o.minLeft=-o.width,o.minTop=-o.height,o.maxLeft=r.width,o.maxTop=r.height},renderCanvas:function(t,e){var n=this.canvasData,r=this.imageData;if(e){var o=function(t){var e=t.width,n=t.height,r=t.degree;if(90==(r=Math.abs(r)%180))return{width:n,height:e};var o=r%90*Math.PI/180,i=Math.sin(o),a=Math.cos(o),s=e*a+n*i,u=e*i+n*a;return r>90?{width:u,height:s}:{width:s,height:u}}({width:r.naturalWidth*Math.abs(r.scaleX||1),height:r.naturalHeight*Math.abs(r.scaleY||1),degree:r.rotate||0}),i=o.width,a=o.height,s=n.width*(i/n.naturalWidth),u=n.height*(a/n.naturalHeight);n.left-=(s-n.width)/2,n.top-=(u-n.height)/2,n.width=s,n.height=u,n.aspectRatio=i/a,n.naturalWidth=i,n.naturalHeight=a,this.limitCanvas(!0,!1)}(n.width>n.maxWidth||n.widthn.maxHeight||n.heighte.width?o.height=o.width/n:o.width=o.height*n),this.cropBoxData=o,this.limitCropBox(!0,!0),o.width=Math.min(Math.max(o.width,o.minWidth),o.maxWidth),o.height=Math.min(Math.max(o.height,o.minHeight),o.maxHeight),o.width=Math.max(o.minWidth,o.width*r),o.height=Math.max(o.minHeight,o.height*r),o.left=e.left+(e.width-o.width)/2,o.top=e.top+(e.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBoxData=P({},o)},limitCropBox:function(t,e){var n=this.options,r=this.containerData,o=this.canvasData,i=this.cropBoxData,a=this.limited,s=n.aspectRatio;if(t){var u=Number(n.minCropBoxWidth)||0,c=Number(n.minCropBoxHeight)||0,f=a?Math.min(r.width,o.width,o.width+o.left,r.width-o.left):r.width,l=a?Math.min(r.height,o.height,o.height+o.top,r.height-o.top):r.height;u=Math.min(u,r.width),c=Math.min(c,r.height),s&&(u&&c?c*s>u?c=u/s:u=c*s:u?c=u/s:c&&(u=c*s),l*s>f?l=f/s:f=l*s),i.minWidth=Math.min(u,f),i.minHeight=Math.min(c,l),i.maxWidth=f,i.maxHeight=l}e&&(a?(i.minLeft=Math.max(0,o.left),i.minTop=Math.max(0,o.top),i.maxLeft=Math.min(r.width,o.left+o.width)-i.width,i.maxTop=Math.min(r.height,o.top+o.height)-i.height):(i.minLeft=0,i.minTop=0,i.maxLeft=r.width-i.width,i.maxTop=r.height-i.height))},renderCropBox:function(){var t=this.options,e=this.containerData,n=this.cropBoxData;(n.width>n.maxWidth||n.widthn.maxHeight||n.height=e.width&&n.height>=e.height?"move":"all"),R(this.cropBox,P({width:n.width,height:n.height},et({translateX:n.left,translateY:n.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),K(this.element,"crop",this.getData())}},ct={initPreview:function(){var t=this.crossOrigin,e=this.options.preview,n=t?this.crossOriginUrl:this.url,r=document.createElement("img");if(t&&(r.crossOrigin=t),r.src=n,this.viewBox.appendChild(r),this.viewBoxImage=r,e){var o=e;"string"==typeof e?o=this.element.ownerDocument.querySelectorAll(e):e.querySelector&&(o=[e]),this.previews=o,M(o,function(e){var r=document.createElement("img");W(e,m,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(r.crossOrigin=t),r.src=n,r.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(r)})}},resetPreview:function(){M(this.previews,function(t){var e=H(t,m);R(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(C(t[e]))try{delete t[e]}catch(n){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(n){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(U(e)))}(t,m)})},preview:function(){var t=this.imageData,e=this.canvasData,n=this.cropBoxData,r=n.width,o=n.height,i=t.width,a=t.height,s=n.left-e.left-t.left,u=n.top-e.top-t.top;this.cropped&&!this.disabled&&(R(this.viewBoxImage,P({width:i,height:a},et(P({translateX:-s,translateY:-u},t)))),M(this.previews,function(e){var n=H(e,m),c=n.width,f=n.height,l=c,h=f,p=1;r&&(h=o*(p=c/r)),o&&h>f&&(l=r*(p=f/o),h=f),R(e,{width:l,height:h}),R(e.getElementsByTagName("img")[0],P({width:i*p,height:a*p},et(P({translateX:-s*p,translateY:-u*p},t))))}))}},ft={bind:function(){var t=this.element,e=this.options,n=this.cropper;N(e.cropstart)&&X(t,"cropstart",e.cropstart),N(e.cropmove)&&X(t,"cropmove",e.cropmove),N(e.cropend)&&X(t,"cropend",e.cropend),N(e.crop)&&X(t,"crop",e.crop),N(e.zoom)&&X(t,"zoom",e.zoom),X(n,g,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&X(n,"wheel mousewheel DOMMouseScroll",this.onWheel=this.wheel.bind(this)),e.toggleDragModeOnDblclick&&X(n,"dblclick",this.onDblclick=this.dblclick.bind(this)),X(t.ownerDocument,y,this.onCropMove=this.cropMove.bind(this)),X(t.ownerDocument,b,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&X(window,"resize",this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,n=this.cropper;N(e.cropstart)&&V(t,"cropstart",e.cropstart),N(e.cropmove)&&V(t,"cropmove",e.cropmove),N(e.cropend)&&V(t,"cropend",e.cropend),N(e.crop)&&V(t,"crop",e.crop),N(e.zoom)&&V(t,"zoom",e.zoom),V(n,g,this.onCropStart),e.zoomable&&e.zoomOnWheel&&V(n,"wheel mousewheel DOMMouseScroll",this.onWheel),e.toggleDragModeOnDblclick&&V(n,"dblclick",this.onDblclick),V(t.ownerDocument,y,this.onCropMove),V(t.ownerDocument,b,this.onCropEnd),e.responsive&&V(window,"resize",this.onResize)}},lt={resize:function(){var t=this.options,e=this.container,n=this.containerData,r=Number(t.minContainerWidth)||200,o=Number(t.minContainerHeight)||100;if(!(this.disabled||n.width<=r||n.height<=o)){var i,a,s=e.offsetWidth/n.width;if(1!==s||e.offsetHeight!==n.height)t.restore&&(i=this.getCanvasData(),a=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(M(i,function(t,e){i[e]=t*s})),this.setCropBoxData(M(a,function(t,e){a[e]=t*s})))}},dblclick:function(){var t,e;this.disabled||"none"===this.options.dragMode||this.setDragMode((t=this.dragBox,e=u,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?"move":"crop"))},wheel:function(t){var e=this,n=Number(this.options.wheelZoomRatio)||.1,r=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout(function(){e.wheeling=!1},50),t.deltaY?r=t.deltaY>0?1:-1:t.wheelDelta?r=-t.wheelDelta/120:t.detail&&(r=t.detail>0?1:-1),this.zoom(-r*n,t)))},cropStart:function(t){if(!this.disabled){var e,n=this.options,r=this.pointers;t.changedTouches?M(t.changedTouches,function(t){r[t.identifier]=nt(t)}):r[t.pointerId||0]=nt(t),e=Object.keys(r).length>1&&n.zoomable&&n.zoomOnTouch?"zoom":H(t.target,v),w.test(e)&&!1!==K(this.element,"cropstart",{originalEvent:t,action:e})&&(t.preventDefault(),this.action=e,this.cropping=!1,"crop"===e&&(this.cropping=!0,D(this.dragBox,p)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var n=this.pointers;t.preventDefault(),!1!==K(this.element,"cropmove",{originalEvent:t,action:e})&&(t.changedTouches?M(t.changedTouches,function(t){P(n[t.identifier]||{},nt(t,!0))}):P(n[t.pointerId||0]||{},nt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,n=this.pointers;t.changedTouches?M(t.changedTouches,function(t){delete n[t.identifier]}):delete n[t.pointerId||0],e&&(t.preventDefault(),Object.keys(n).length||(this.action=""),this.cropping&&(this.cropping=!1,z(this.dragBox,p,this.cropped&&this.options.modal)),K(this.element,"cropend",{originalEvent:t,action:e}))}}},ht={change:function(t){var e,n=this.options,r=this.canvasData,o=this.containerData,i=this.cropBoxData,a=this.pointers,s=this.action,u=n.aspectRatio,c=i.left,l=i.top,h=i.width,p=i.height,d=c+h,v=l+p,m=0,g=0,y=o.width,b=o.height,w=!0;!u&&t.shiftKey&&(u=h&&p?h/p:1),this.limited&&(m=i.minLeft,g=i.minTop,y=m+Math.min(o.width,r.width,r.left+r.width),b=g+Math.min(o.height,r.height,r.top+r.height));var _=a[Object.keys(a)[0]],x={x:_.endX-_.startX,y:_.endY-_.startY},O=function(t){switch(t){case"e":d+x.x>y&&(x.x=y-d);break;case"w":c+x.xb&&(x.y=b-v)}};switch(s){case"all":c+=x.x,l+=x.y;break;case"e":if(x.x>=0&&(d>=y||u&&(l<=g||v>=b))){w=!1;break}O("e"),(h+=x.x)<0&&(s="w",c-=h=-h),u&&(p=h/u,l+=(i.height-p)/2);break;case"n":if(x.y<=0&&(l<=g||u&&(c<=m||d>=y))){w=!1;break}O("n"),p-=x.y,l+=x.y,p<0&&(s="s",l-=p=-p),u&&(h=p*u,c+=(i.width-h)/2);break;case"w":if(x.x<=0&&(c<=m||u&&(l<=g||v>=b))){w=!1;break}O("w"),h-=x.x,c+=x.x,h<0&&(s="e",c-=h=-h),u&&(p=h/u,l+=(i.height-p)/2);break;case"s":if(x.y>=0&&(v>=b||u&&(c<=m||d>=y))){w=!1;break}O("s"),(p+=x.y)<0&&(s="n",l-=p=-p),u&&(h=p*u,c+=(i.width-h)/2);break;case"ne":if(u){if(x.y<=0&&(l<=g||d>=y)){w=!1;break}O("n"),p-=x.y,l+=x.y,h=p*u}else O("n"),O("e"),x.x>=0?dg&&(p-=x.y,l+=x.y):(p-=x.y,l+=x.y);h<0&&p<0?(s="sw",l-=p=-p,c-=h=-h):h<0?(s="nw",c-=h=-h):p<0&&(s="se",l-=p=-p);break;case"nw":if(u){if(x.y<=0&&(l<=g||c<=m)){w=!1;break}O("n"),p-=x.y,l+=x.y,h=p*u,c+=i.width-h}else O("n"),O("w"),x.x<=0?c>m?(h-=x.x,c+=x.x):x.y<=0&&l<=g&&(w=!1):(h-=x.x,c+=x.x),x.y<=0?l>g&&(p-=x.y,l+=x.y):(p-=x.y,l+=x.y);h<0&&p<0?(s="se",l-=p=-p,c-=h=-h):h<0?(s="ne",c-=h=-h):p<0&&(s="sw",l-=p=-p);break;case"sw":if(u){if(x.x<=0&&(c<=m||v>=b)){w=!1;break}O("w"),h-=x.x,c+=x.x,p=h/u}else O("s"),O("w"),x.x<=0?c>m?(h-=x.x,c+=x.x):x.y>=0&&v>=b&&(w=!1):(h-=x.x,c+=x.x),x.y>=0?v=0&&(d>=y||v>=b)){w=!1;break}O("e"),p=(h+=x.x)/u}else O("s"),O("e"),x.x>=0?d=0&&v>=b&&(w=!1):h+=x.x,x.y>=0?v0?s=x.y>0?"se":"ne":x.x<0&&(c-=h,s=x.y>0?"sw":"nw"),x.y<0&&(l-=p),this.cropped||(B(this.cropBox,f),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}w&&(i.width=h,i.height=p,i.left=c,i.top=l,this.action=s,this.renderCropBox()),M(a,function(t){t.startX=t.endX,t.startY=t.endY})}},pt={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&D(this.dragBox,p),B(this.cropBox,f),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=P({},this.initialImageData),this.canvasData=P({},this.initialCanvasData),this.cropBoxData=P({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(P(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),B(this.dragBox,p),D(this.cropBox,f)),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,M(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,B(this.cropper,c)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,D(this.cropper,c)),this},destroy:function(){var t=this.element;return t.cropper?(t.cropper=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,n=this.canvasData,r=n.left,o=n.top;return this.moveTo(A(t)?t:r+Number(t),A(e)?e:o+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=this.canvasData,r=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(k(t)&&(n.left=t,r=!0),k(e)&&(n.top=e,r=!0),r&&this.renderCanvas(!0)),this},zoom:function(t,e){var n=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(n.width*t/n.naturalWidth,null,e)},zoomTo:function(t,e,n){var r=this.options,o=this.canvasData,i=o.width,a=o.height,s=o.naturalWidth,u=o.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&r.zoomable){var c=s*t,f=u*t;if(!1===K(this.element,"zoom",{ratio:t,oldRatio:i/s,originalEvent:n}))return this;if(n){var l=this.pointers,h=Z(this.cropper),p=l&&Object.keys(l).length?function(t){var e=0,n=0,r=0;return M(t,function(t){var o=t.startX,i=t.startY;e+=o,n+=i,r+=1}),{pageX:e/=r,pageY:n/=r}}(l):{pageX:n.pageX,pageY:n.pageY};o.left-=(c-i)*((p.pageX-h.left-o.left)/i),o.top-=(f-a)*((p.pageY-h.top-o.top)/a)}else T(e)&&k(e.x)&&k(e.y)?(o.left-=(c-i)*((e.x-o.left)/i),o.top-=(f-a)*((e.y-o.top)/a)):(o.left-=(c-i)/2,o.top-=(f-a)/2);o.width=c,o.height=f,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return k(t=Number(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,k(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(k(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=this.imageData,r=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(k(t)&&(n.scaleX=t,r=!0),k(e)&&(n.scaleY=e,r=!0),r&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.options,r=this.imageData,o=this.canvasData,i=this.cropBoxData;if(this.ready&&this.cropped){t={x:i.left-o.left,y:i.top-o.top,width:i.width,height:i.height};var a=r.width/r.naturalWidth;if(M(t,function(e,n){t[n]=e/a}),e){var s=Math.round(t.y+t.height),u=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=u-t.x,t.height=s-t.y}}else t={x:0,y:0,width:0,height:0};return n.rotatable&&(t.rotate=r.rotate||0),n.scalable&&(t.scaleX=r.scaleX||1,t.scaleY=r.scaleY||1),t},setData:function(t){var e=this.options,n=this.imageData,r=this.canvasData,o={};if(this.ready&&!this.disabled&&T(t)){var i=!1;e.rotatable&&k(t.rotate)&&t.rotate!==n.rotate&&(n.rotate=t.rotate,i=!0),e.scalable&&(k(t.scaleX)&&t.scaleX!==n.scaleX&&(n.scaleX=t.scaleX,i=!0),k(t.scaleY)&&t.scaleY!==n.scaleY&&(n.scaleY=t.scaleY,i=!0)),i&&this.renderCanvas(!0,!0);var a=n.width/n.naturalWidth;k(t.x)&&(o.left=t.x*a+r.left),k(t.y)&&(o.top=t.y*a+r.top),k(t.width)&&(o.width=t.width*a),k(t.height)&&(o.height=t.height*a),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?P({},this.containerData):{}},getImageData:function(){return this.sized?P({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&M(["left","top","width","height","naturalWidth","naturalHeight"],function(n){e[n]=t[n]}),e},setCanvasData:function(t){var e=this.canvasData,n=e.aspectRatio;return this.ready&&!this.disabled&&T(t)&&(k(t.left)&&(e.left=t.left),k(t.top)&&(e.top=t.top),k(t.width)?(e.width=t.width,e.height=t.width/n):k(t.height)&&(e.height=t.height,e.width=t.height*n),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,n,r=this.cropBoxData,o=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&T(t)&&(k(t.left)&&(r.left=t.left),k(t.top)&&(r.top=t.top),k(t.width)&&t.width!==r.width&&(e=!0,r.width=t.width),k(t.height)&&t.height!==r.height&&(n=!0,r.height=t.height),o&&(e?r.height=r.width/o:n&&(r.width=r.height*o)),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,n=function(t,e,n,r){var o=e.aspectRatio,a=e.naturalWidth,s=e.naturalHeight,u=e.rotate,c=void 0===u?0:u,f=e.scaleX,l=void 0===f?1:f,h=e.scaleY,p=void 0===h?1:h,d=n.aspectRatio,v=n.naturalWidth,m=n.naturalHeight,g=r.fillColor,y=void 0===g?"transparent":g,b=r.imageSmoothingEnabled,w=void 0===b||b,_=r.imageSmoothingQuality,x=void 0===_?"low":_,O=r.maxWidth,j=void 0===O?1/0:O,E=r.maxHeight,k=void 0===E?1/0:E,A=r.minWidth,C=void 0===A?0:A,S=r.minHeight,T=void 0===S?0:S,N=document.createElement("canvas"),M=N.getContext("2d"),P=ot({aspectRatio:d,width:j,height:k}),$=ot({aspectRatio:d,width:C,height:T},"cover"),L=Math.min(P.width,Math.max($.width,v)),R=Math.min(P.height,Math.max($.height,m)),D=ot({aspectRatio:o,width:j,height:k}),B=ot({aspectRatio:o,width:C,height:T},"cover"),z=Math.min(D.width,Math.max(B.width,a)),F=Math.min(D.height,Math.max(B.height,s)),U=[-z/2,-F/2,z,F];return N.width=I(L),N.height=I(R),M.fillStyle=y,M.fillRect(0,0,L,R),M.save(),M.translate(L/2,R/2),M.rotate(c*Math.PI/180),M.scale(l,p),M.imageSmoothingEnabled=w,M.imageSmoothingQuality=x,M.drawImage.apply(M,[t].concat(i(U.map(function(t){return Math.floor(I(t))})))),M.restore(),N}(this.image,this.imageData,e,t);if(!this.cropped)return n;var r=this.getData(),o=r.x,a=r.y,s=r.width,u=r.height,c=n.width/Math.floor(e.naturalWidth);1!==c&&(o*=c,a*=c,s*=c,u*=c);var f=s/u,l=ot({aspectRatio:f,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),h=ot({aspectRatio:f,width:t.minWidth||0,height:t.minHeight||0},"cover"),p=ot({aspectRatio:f,width:t.width||(1!==c?n.width:s),height:t.height||(1!==c?n.height:u)}),d=p.width,v=p.height;d=Math.min(l.width,Math.max(h.width,d)),v=Math.min(l.height,Math.max(h.height,v));var m=document.createElement("canvas"),g=m.getContext("2d");m.width=I(d),m.height=I(v),g.fillStyle=t.fillColor||"transparent",g.fillRect(0,0,d,v);var y=t.imageSmoothingEnabled,b=void 0===y||y,w=t.imageSmoothingQuality;g.imageSmoothingEnabled=b,w&&(g.imageSmoothingQuality=w);var _,x,O,j,E,k,A=n.width,C=n.height,S=o,T=a;S<=-s||S>A?(S=0,_=0,O=0,E=0):S<=0?(O=-S,S=0,E=_=Math.min(A,s+S)):S<=A&&(O=0,E=_=Math.min(s,A-S)),_<=0||T<=-u||T>C?(T=0,x=0,j=0,k=0):T<=0?(j=-T,T=0,k=x=Math.min(C,u+T)):T<=C&&(j=0,k=x=Math.min(u,C-T));var N=[S,T,_,x];if(E>0&&k>0){var M=d/s;N.push(O*M,j*M,E*M,k*M)}return g.drawImage.apply(g,[n].concat(i(N.map(function(t){return Math.floor(I(t))})))),m},setAspectRatio:function(t){var e=this.options;return this.disabled||A(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,n=this.dragBox,r=this.face;if(this.ready&&!this.disabled){var o="crop"===t,i=e.movable&&"move"===t;t=o||i?t:"none",e.dragMode=t,W(n,v,t),z(n,u,o),z(n,d,i),e.cropBoxMovable||(W(r,v,t),z(r,u,o),z(r,d,i))}return this}},dt=s.Cropper,vt=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e||!O.test(e.tagName))throw new Error("The first argument is required and must be an or