=8&&(i=l+u)}}}if(i){var f,d,p=r.getUint16(i,n);for(d=0;d=0?o:le),height:Math.max(r.offsetHeight,i>=0?i:ce)};this.containerData=a,je(n,{width:a.width,height:a.height}),Ne(e,A),Pe(n,A)},initCanvas:function(){var e=this.containerData,t=this.imageData,r=this.options.viewMode,n=Math.abs(t.rotate)%180==90,o=n?t.naturalHeight:t.naturalWidth,i=n?t.naturalWidth:t.naturalHeight,a=o/i,s=e.width,l=e.height;e.height*a>e.width?3===r?s=e.height*a:l=e.width/a:3===r?l=e.width/a:s=e.height*a;var c={aspectRatio:a,naturalWidth:o,naturalHeight:i,width:s,height:l};this.canvasData=c,this.limited=1===r||2===r,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=(e.width-c.width)/2,c.top=(e.height-c.height)/2,c.oldLeft=c.left,c.oldTop=c.top,this.initialCanvasData=Ee({},c)},limitCanvas:function(e,t){var r=this.options,n=this.containerData,o=this.canvasData,i=this.cropBoxData,a=r.viewMode,s=o.aspectRatio,l=this.cropped&&i;if(e){var c=Number(r.minCanvasWidth)||0,u=Number(r.minCanvasHeight)||0;a>1?(c=Math.max(c,n.width),u=Math.max(u,n.height),3===a&&(u*s>c?c=u*s:u=c/s)):a>0&&(c?c=Math.max(c,l?i.width:0):u?u=Math.max(u,l?i.height:0):l&&(c=i.width,(u=i.height)*s>c?c=u*s:u=c/s));var f=Ke({aspectRatio:s,width:c,height:u});c=f.width,u=f.height,o.minWidth=c,o.minHeight=u,o.maxWidth=1/0,o.maxHeight=1/0}if(t)if(a>(l?0:1)){var d=n.width-o.width,p=n.height-o.height;o.minLeft=Math.min(0,d),o.minTop=Math.min(0,p),o.maxLeft=Math.max(0,d),o.maxTop=Math.max(0,p),l&&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>=n.width&&(o.minLeft=Math.min(0,d),o.maxLeft=Math.max(0,d)),o.height>=n.height&&(o.minTop=Math.min(0,p),o.maxTop=Math.max(0,p))))}else o.minLeft=-o.width,o.minTop=-o.height,o.maxLeft=n.width,o.maxTop=n.height},renderCanvas:function(e,t){var r=this.canvasData,n=this.imageData;if(t){var o=Je({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),i=o.width,a=o.height,s=r.width*(i/r.naturalWidth),l=r.height*(a/r.naturalHeight);r.left-=(s-r.width)/2,r.top-=(l-r.height)/2,r.width=s,r.height=l,r.aspectRatio=i/a,r.naturalWidth=i,r.naturalHeight=a,this.limitCanvas(!0,!1)}(r.width>r.maxWidth||r.widthr.maxHeight||r.heightt.width?o.height=o.width/r:o.width=o.height*r),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*n),o.height=Math.max(o.minHeight,o.height*n),o.left=t.left+(t.width-o.width)/2,o.top=t.top+(t.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBoxData=Ee({},o)},limitCropBox:function(e,t){var r=this.options,n=this.containerData,o=this.canvasData,i=this.cropBoxData,a=this.limited,s=r.aspectRatio;if(e){var l=Number(r.minCropBoxWidth)||0,c=Number(r.minCropBoxHeight)||0,u=a?Math.min(n.width,o.width,o.width+o.left,n.width-o.left):n.width,f=a?Math.min(n.height,o.height,o.height+o.top,n.height-o.top):n.height;l=Math.min(l,n.width),c=Math.min(c,n.height),s&&(l&&c?c*s>l?c=l/s:l=c*s:l?c=l/s:c&&(l=c*s),f*s>u?f=u/s:u=f*s),i.minWidth=Math.min(l,u),i.minHeight=Math.min(c,f),i.maxWidth=u,i.maxHeight=f}t&&(a?(i.minLeft=Math.max(0,o.left),i.minTop=Math.max(0,o.top),i.maxLeft=Math.min(n.width,o.left+o.width)-i.width,i.maxTop=Math.min(n.height,o.top+o.height)-i.height):(i.minLeft=0,i.minTop=0,i.maxLeft=n.width-i.width,i.maxTop=n.height-i.height))},renderCropBox:function(){var e=this.options,t=this.containerData,r=this.cropBoxData;(r.width>r.maxWidth||r.widthr.maxHeight||r.height=t.width&&r.height>=t.height?w:y),je(this.cropBox,Ee({width:r.width,height:r.height},Ge({translateX:r.left,translateY:r.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ze(this.element,U,this.getData())}},lt={initPreview:function(){var e=this.element,t=this.crossOrigin,r=this.options.preview,n=t?this.crossOriginUrl:this.url,o=e.alt||"The image to preview",i=document.createElement("img");if(t&&(i.crossOrigin=t),i.src=n,i.alt=o,this.viewBox.appendChild(i),this.viewBoxImage=i,r){var a=r;"string"==typeof r?a=e.ownerDocument.querySelectorAll(r):r.querySelector&&(a=[r]),this.previews=a,ke(a,(function(e){var r=document.createElement("img");Te(e,I,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(r.crossOrigin=t),r.src=n,r.alt=o,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(){ke(this.previews,(function(e){var t=Be(e,I);je(e,{width:t.width,height:t.height}),e.innerHTML=t.html,Fe(e,I)}))},preview:function(){var e=this.imageData,t=this.canvasData,r=this.cropBoxData,n=r.width,o=r.height,i=e.width,a=e.height,s=r.left-t.left-e.left,l=r.top-t.top-e.top;this.cropped&&!this.disabled&&(je(this.viewBoxImage,Ee({width:i,height:a},Ge(Ee({translateX:-s,translateY:-l},e)))),ke(this.previews,(function(t){var r=Be(t,I),c=r.width,u=r.height,f=c,d=u,p=1;n&&(d=o*(p=c/n)),o&&d>u&&(f=n*(p=u/o),d=u),je(t,{width:f,height:d}),je(t.getElementsByTagName("img")[0],Ee({width:i*p,height:a*p},Ge(Ee({translateX:-s*p,translateY:-l*p},e))))})))}},ct={bind:function(){var e=this.element,t=this.options,r=this.cropper;be(t.cropstart)&&Re(e,$,t.cropstart),be(t.cropmove)&&Re(e,q,t.cropmove),be(t.cropend)&&Re(e,H,t.cropend),be(t.crop)&&Re(e,U,t.crop),be(t.zoom)&&Re(e,re,t.zoom),Re(r,Q,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&Re(r,te,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&Re(r,W,this.onDblclick=this.dblclick.bind(this)),Re(e.ownerDocument,K,this.onCropMove=this.cropMove.bind(this)),Re(e.ownerDocument,J,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&Re(window,ee,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,r=this.cropper;be(t.cropstart)&&Le(e,$,t.cropstart),be(t.cropmove)&&Le(e,q,t.cropmove),be(t.cropend)&&Le(e,H,t.cropend),be(t.crop)&&Le(e,U,t.crop),be(t.zoom)&&Le(e,re,t.zoom),Le(r,Q,this.onCropStart),t.zoomable&&t.zoomOnWheel&&Le(r,te,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&Le(r,W,this.onDblclick),Le(e.ownerDocument,K,this.onCropMove),Le(e.ownerDocument,J,this.onCropEnd),t.responsive&&Le(window,ee,this.onResize)}},ut={resize:function(){if(!this.disabled){var e,t,r=this.options,n=this.container,o=this.containerData,i=n.offsetWidth/o.width,a=n.offsetHeight/o.height,s=Math.abs(i-1)>Math.abs(a-1)?i:a;1!==s&&(r.restore&&(e=this.getCanvasData(),t=this.getCropBoxData()),this.render(),r.restore&&(this.setCanvasData(ke(e,(function(t,r){e[r]=t*s}))),this.setCropBoxData(ke(t,(function(e,r){t[r]=e*s})))))}},dblclick:function(){this.disabled||this.options.dragMode===z||this.setDragMode(Ce(this.dragBox,P)?R:L)},wheel:function(e){var t=this,r=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(e.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){t.wheeling=!1}),50),e.deltaY?n=e.deltaY>0?1:-1:e.wheelDelta?n=-e.wheelDelta/120:e.detail&&(n=e.detail>0?1:-1),this.zoom(-n*r,e)))},cropStart:function(e){var t=e.buttons,r=e.button;if(!(this.disabled||("mousedown"===e.type||"pointerdown"===e.type&&"mouse"===e.pointerType)&&(pe(t)&&1!==t||pe(r)&&0!==r||e.ctrlKey))){var n,o=this.options,i=this.pointers;e.changedTouches?ke(e.changedTouches,(function(e){i[e.identifier]=Ye(e)})):i[e.pointerId||0]=Ye(e),n=Object.keys(i).length>1&&o.zoomable&&o.zoomOnTouch?x:Be(e.target,V),oe.test(n)&&!1!==ze(this.element,$,{originalEvent:e,action:n})&&(e.preventDefault(),this.action=n,this.cropping=!1,n===b&&(this.cropping=!0,Ne(this.dragBox,T)))}},cropMove:function(e){var t=this.action;if(!this.disabled&&t){var r=this.pointers;e.preventDefault(),!1!==ze(this.element,q,{originalEvent:e,action:t})&&(e.changedTouches?ke(e.changedTouches,(function(e){Ee(r[e.identifier]||{},Ye(e,!0))})):Ee(r[e.pointerId||0]||{},Ye(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,r=this.pointers;e.changedTouches?ke(e.changedTouches,(function(e){delete r[e.identifier]})):delete r[e.pointerId||0],t&&(e.preventDefault(),Object.keys(r).length||(this.action=""),this.cropping&&(this.cropping=!1,De(this.dragBox,T,this.cropped&&this.options.modal)),ze(this.element,H,{originalEvent:e,action:t}))}}},ft={change:function(e){var t,r=this.options,n=this.canvasData,o=this.containerData,i=this.cropBoxData,a=this.pointers,s=this.action,l=r.aspectRatio,c=i.left,u=i.top,f=i.width,d=i.height,p=c+f,h=u+d,v=0,m=0,g=o.width,P=o.height,D=!0;!l&&e.shiftKey&&(l=f&&d?f/d:1),this.limited&&(v=i.minLeft,m=i.minTop,g=v+Math.min(o.width,n.width,n.left+n.width),P=m+Math.min(o.height,n.height,n.top+n.height));var M=a[Object.keys(a)[0]],B={x:M.endX-M.startX,y:M.endY-M.startY},T=function(e){switch(e){case k:p+B.x>g&&(B.x=g-p);break;case E:c+B.xP&&(B.y=P-h)}};switch(s){case y:c+=B.x,u+=B.y;break;case k:if(B.x>=0&&(p>=g||l&&(u<=m||h>=P))){D=!1;break}T(k),(f+=B.x)<0&&(s=E,c-=f=-f),l&&(d=f/l,u+=(i.height-d)/2);break;case _:if(B.y<=0&&(u<=m||l&&(c<=v||p>=g))){D=!1;break}T(_),d-=B.y,u+=B.y,d<0&&(s=S,u-=d=-d),l&&(f=d*l,c+=(i.width-f)/2);break;case E:if(B.x<=0&&(c<=v||l&&(u<=m||h>=P))){D=!1;break}T(E),f-=B.x,c+=B.x,f<0&&(s=k,c-=f=-f),l&&(d=f/l,u+=(i.height-d)/2);break;case S:if(B.y>=0&&(h>=P||l&&(c<=v||p>=g))){D=!1;break}T(S),(d+=B.y)<0&&(s=_,u-=d=-d),l&&(f=d*l,c+=(i.width-f)/2);break;case O:if(l){if(B.y<=0&&(u<=m||p>=g)){D=!1;break}T(_),d-=B.y,u+=B.y,f=d*l}else T(_),T(k),B.x>=0?pm&&(d-=B.y,u+=B.y):(d-=B.y,u+=B.y);f<0&&d<0?(s=N,u-=d=-d,c-=f=-f):f<0?(s=j,c-=f=-f):d<0&&(s=C,u-=d=-d);break;case j:if(l){if(B.y<=0&&(u<=m||c<=v)){D=!1;break}T(_),d-=B.y,u+=B.y,f=d*l,c+=i.width-f}else T(_),T(E),B.x<=0?c>v?(f-=B.x,c+=B.x):B.y<=0&&u<=m&&(D=!1):(f-=B.x,c+=B.x),B.y<=0?u>m&&(d-=B.y,u+=B.y):(d-=B.y,u+=B.y);f<0&&d<0?(s=C,u-=d=-d,c-=f=-f):f<0?(s=O,c-=f=-f):d<0&&(s=N,u-=d=-d);break;case N:if(l){if(B.x<=0&&(c<=v||h>=P)){D=!1;break}T(E),f-=B.x,c+=B.x,d=f/l}else T(S),T(E),B.x<=0?c>v?(f-=B.x,c+=B.x):B.y>=0&&h>=P&&(D=!1):(f-=B.x,c+=B.x),B.y>=0?h=0&&(p>=g||h>=P)){D=!1;break}T(k),d=(f+=B.x)/l}else T(S),T(k),B.x>=0?p=0&&h>=P&&(D=!1):f+=B.x,B.y>=0?h0?s=B.y>0?C:O:B.x<0&&(c-=f,s=B.y>0?N:j),B.y<0&&(u-=d),this.cropped||(Pe(this.cropBox,A),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}D&&(i.width=f,i.height=d,i.left=c,i.top=u,this.action=s,this.renderCropBox()),ke(a,(function(e){e.startX=e.endX,e.startY=e.endY}))}},dt={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Ne(this.dragBox,T),Pe(this.cropBox,A),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Ee({},this.initialImageData),this.canvasData=Ee({},this.initialCanvasData),this.cropBoxData=Ee({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Ee(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Pe(this.dragBox,T),Ne(this.cropBox,A)),this},replace:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,ke(this.previews,(function(t){t.getElementsByTagName("img")[0].src=e})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Pe(this.cropper,D)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Ne(this.cropper,D)),this},destroy:function(){var e=this.element;return e[g]?(e[g]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.canvasData,n=r.left,o=r.top;return this.moveTo(ve(e)?e:n+Number(e),ve(t)?t:o+Number(t))},moveTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.canvasData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(pe(e)&&(r.left=e,n=!0),pe(t)&&(r.top=t,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(e,t){var r=this.canvasData;return e=(e=Number(e))<0?1/(1-e):1+e,this.zoomTo(r.width*e/r.naturalWidth,null,t)},zoomTo:function(e,t,r){var n=this.options,o=this.canvasData,i=o.width,a=o.height,s=o.naturalWidth,l=o.naturalHeight;if((e=Number(e))>=0&&this.ready&&!this.disabled&&n.zoomable){var c=s*e,u=l*e;if(!1===ze(this.element,re,{ratio:e,oldRatio:i/s,originalEvent:r}))return this;if(r){var f=this.pointers,d=Ue(this.cropper),p=f&&Object.keys(f).length?Qe(f):{pageX:r.pageX,pageY:r.pageY};o.left-=(c-i)*((p.pageX-d.left-o.left)/i),o.top-=(u-a)*((p.pageY-d.top-o.top)/a)}else ye(t)&&pe(t.x)&&pe(t.y)?(o.left-=(c-i)*((t.x-o.left)/i),o.top-=(u-a)*((t.y-o.top)/a)):(o.left-=(c-i)/2,o.top-=(u-a)/2);o.width=c,o.height=u,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return pe(e=Number(e))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,pe(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(pe(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.imageData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(pe(e)&&(r.scaleX=e,n=!0),pe(t)&&(r.scaleY=t,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.options,n=this.imageData,o=this.canvasData,i=this.cropBoxData;if(this.ready&&this.cropped){e={x:i.left-o.left,y:i.top-o.top,width:i.width,height:i.height};var a=n.width/n.naturalWidth;if(ke(e,(function(t,r){e[r]=t/a})),t){var s=Math.round(e.y+e.height),l=Math.round(e.x+e.width);e.x=Math.round(e.x),e.y=Math.round(e.y),e.width=l-e.x,e.height=s-e.y}}else e={x:0,y:0,width:0,height:0};return r.rotatable&&(e.rotate=n.rotate||0),r.scalable&&(e.scaleX=n.scaleX||1,e.scaleY=n.scaleY||1),e},setData:function(e){var t=this.options,r=this.imageData,n=this.canvasData,o={};if(this.ready&&!this.disabled&&ye(e)){var i=!1;t.rotatable&&pe(e.rotate)&&e.rotate!==r.rotate&&(r.rotate=e.rotate,i=!0),t.scalable&&(pe(e.scaleX)&&e.scaleX!==r.scaleX&&(r.scaleX=e.scaleX,i=!0),pe(e.scaleY)&&e.scaleY!==r.scaleY&&(r.scaleY=e.scaleY,i=!0)),i&&this.renderCanvas(!0,!0);var a=r.width/r.naturalWidth;pe(e.x)&&(o.left=e.x*a+n.left),pe(e.y)&&(o.top=e.y*a+n.top),pe(e.width)&&(o.width=e.width*a),pe(e.height)&&(o.height=e.height*a),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?Ee({},this.containerData):{}},getImageData:function(){return this.sized?Ee({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&ke(["left","top","width","height","naturalWidth","naturalHeight"],(function(r){t[r]=e[r]})),t},setCanvasData:function(e){var t=this.canvasData,r=t.aspectRatio;return this.ready&&!this.disabled&&ye(e)&&(pe(e.left)&&(t.left=e.left),pe(e.top)&&(t.top=e.top),pe(e.width)?(t.width=e.width,t.height=e.width/r):pe(e.height)&&(t.height=e.height,t.width=e.height*r),this.renderCanvas(!0)),this},getCropBoxData:function(){var e,t=this.cropBoxData;return this.ready&&this.cropped&&(e={left:t.left,top:t.top,width:t.width,height:t.height}),e||{}},setCropBoxData:function(e){var t,r,n=this.cropBoxData,o=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&ye(e)&&(pe(e.left)&&(n.left=e.left),pe(e.top)&&(n.top=e.top),pe(e.width)&&e.width!==n.width&&(t=!0,n.width=e.width),pe(e.height)&&e.height!==n.height&&(r=!0,n.height=e.height),o&&(t?n.height=n.width/o:r&&(n.width=n.height*o)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,r=Ze(this.image,this.imageData,t,e);if(!this.cropped)return r;var n=this.getData(),o=n.x,i=n.y,a=n.width,l=n.height,c=r.width/Math.floor(t.naturalWidth);1!==c&&(o*=c,i*=c,a*=c,l*=c);var u=a/l,f=Ke({aspectRatio:u,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),d=Ke({aspectRatio:u,width:e.minWidth||0,height:e.minHeight||0},"cover"),p=Ke({aspectRatio:u,width:e.width||(1!==c?r.width:a),height:e.height||(1!==c?r.height:l)}),h=p.width,v=p.height;h=Math.min(f.width,Math.max(d.width,h)),v=Math.min(f.height,Math.max(d.height,v));var m=document.createElement("canvas"),g=m.getContext("2d");m.width=_e(h),m.height=_e(v),g.fillStyle=e.fillColor||"transparent",g.fillRect(0,0,h,v);var y=e.imageSmoothingEnabled,b=void 0===y||y,w=e.imageSmoothingQuality;g.imageSmoothingEnabled=b,w&&(g.imageSmoothingQuality=w);var x,k,E,S,_,O,j=r.width,C=r.height,N=o,P=i;N<=-a||N>j?(N=0,x=0,E=0,_=0):N<=0?(E=-N,N=0,_=x=Math.min(j,a+N)):N<=j&&(E=0,_=x=Math.min(a,j-N)),x<=0||P<=-l||P>C?(P=0,k=0,S=0,O=0):P<=0?(S=-P,P=0,O=k=Math.min(C,l+P)):P<=C&&(S=0,O=k=Math.min(l,C-P));var D=[N,P,x,k];if(_>0&&O>0){var A=h/a;D.push(E*A,S*A,_*A,O*A)}return g.drawImage.apply(g,[r].concat(s(D.map((function(e){return Math.floor(_e(e))}))))),m},setAspectRatio:function(e){var t=this.options;return this.disabled||ve(e)||(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,r=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var o=e===L,i=t.movable&&e===R;e=o||i?e:z,t.dragMode=e,Te(r,V,e),De(r,P,o),De(r,F,i),t.cropBoxMovable||(Te(n,V,e),De(n,P,o),De(n,F,i))}return this}},pt=h.Cropper,ht=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n(this,e),!t||!se.test(t.tagName))throw new Error("The first argument is required and must be an
or