text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-62594417","chunk-76eebcce"],{4604:function(t,e,i){},a0f2:function(t,e,i){},a670:function(t,e,i){"use strict";i.r(e);var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"cropper-wrapper"},[i("div",{staticClass:"img-box"},[i("img",{staticClass:"cropper-image",attrs:{id:t.imgId,alt:""}})]),i("div",{staticClass:"right-con"},[t.preview?i("div",{staticClass:"preview-box",attrs:{id:t.previewId}}):t._e(),i("div",{staticClass:"button-box"},[t._t("default",[i("Upload",{attrs:{action:"image/upload","before-upload":t.beforeUpload}},[i("Button",{staticStyle:{width:"150px"},attrs:{type:"primary"}},[t._v("上传图片")])],1)]),i("div",{directives:[{name:"show",rawName:"v-show",value:t.insideSrc,expression:"insideSrc"}]},[i("Button",{attrs:{type:"primary"},on:{click:t.rotate}},[i("Icon",{attrs:{type:"md-refresh",size:18}})],1),i("Button",{attrs:{type:"primary"},on:{click:t.shrink}},[i("Icon",{attrs:{type:"md-remove",size:18}})],1),i("Button",{attrs:{type:"primary"},on:{click:t.magnify}},[i("Icon",{attrs:{type:"md-add",size:18}})],1),i("Button",{attrs:{type:"primary"},on:{click:function(e){return t.scale("X")}}},[i("Icon",{attrs:{custom:"iconfont icon-shuipingfanzhuan",size:18}})],1),i("Button",{attrs:{type:"primary"},on:{click:function(e){return t.scale("Y")}}},[i("Icon",{attrs:{custom:"iconfont icon-chuizhifanzhuan",size:18}})],1),i("Button",{attrs:{type:"primary"},on:{click:function(e){return t.move(0,-t.moveStep)}}},[i("Icon",{attrs:{type:"md-arrow-round-up",size:18}})],1),i("Button",{attrs:{type:"primary"},on:{click:function(e){return t.move(-t.moveStep,0)}}},[i("Icon",{attrs:{type:"md-arrow-round-back",size:18}})],1),i("Button",{attrs:{type:"primary"},on:{click:function(e){return t.move(0,t.moveStep)}}},[i("Icon",{attrs:{type:"md-arrow-round-down",size:18}})],1),i("Button",{attrs:{type:"primary"},on:{click:function(e){return t.move(t.moveStep,0)}}},[i("Icon",{attrs:{type:"md-arrow-round-forward",size:18}})],1),i("Button",{staticStyle:{width:"150px","margin-top":"10px"},attrs:{type:"primary"},on:{click:t.crop}},[t._v(t._s(t.cropButtonText))])],1)],2)])])},n=[],o=(i("a481"),i("c5f6"),i("bab4")),r=i.n(o),h=(i("a0f2"),i("4604"),{name:"Cropper",props:{src:{type:String,default:""},preview:{type:Boolean,default:!0},moveStep:{type:Number,default:4},cropButtonText:{type:String,default:"裁剪"}},data:function(){return{cropper:null,insideSrc:""}},computed:{imgId:function(){return"cropper".concat(this._uid)},previewId:function(){return"cropper_preview".concat(this._uid)}},watch:{src:function(t){this.replace(t)},insideSrc:function(t){this.replace(t)}},methods:{beforeUpload:function(t){var e=this,i=new FileReader;return i.readAsDataURL(t),i.onload=function(t){e.insideSrc=t.srcElement.result},!1},replace:function(t){this.cropper.replace(t),this.insideSrc=t},rotate:function(){this.cropper.rotate(90)},shrink:function(){this.cropper.zoom(-.1)},magnify:function(){this.cropper.zoom(.1)},scale:function(t){this.cropper["scale".concat(t)](-this.cropper.getData()["scale".concat(t)])},move:function(){var t;(t=this.cropper).move.apply(t,arguments)},crop:function(){var t=this;this.cropper.getCroppedCanvas().toBlob(function(e){t.$emit("on-crop",e)})}},mounted:function(){var t=this;this.$nextTick(function(){var e=document.getElementById(t.imgId);t.cropper=new r.a(e,{preview:"#".concat(t.previewId),checkCrossOrigin:!0})})}}),s=h,c=i("2877"),d=Object(c["a"])(s,a,n,!1,null,null,null);e["default"]=d.exports},bab4:function(t,e,i){
  /*!
   * 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(e,i){t.exports=i()})(0,function(){"use strict";function t(e){return t="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function a(t,e,a){return e&&i(t.prototype,e),a&&i(t,a),t}function n(t){return o(t)||r(t)||h()}function o(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}function r(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var s="undefined"!==typeof window,c=s?window:{},d=!!s&&"ontouchstart"in c.document.documentElement,l=!!s&&"PointerEvent"in c,p="cropper",u="all",m="crop",g="move",f="zoom",v="e",w="w",b="s",y="n",x="ne",M="nw",C="se",D="sw",k="".concat(p,"-crop"),B="".concat(p,"-disabled"),T="".concat(p,"-hidden"),E="".concat(p,"-hide"),z="".concat(p,"-invisible"),N="".concat(p,"-modal"),W="".concat(p,"-move"),H="".concat(p,"Action"),L="".concat(p,"Preview"),O="crop",S="move",Y="none",R="crop",X="cropend",I="cropmove",A="cropstart",U="dblclick",j=d?"touchstart":"mousedown",q=d?"touchmove":"mousemove",P=d?"touchend touchcancel":"mouseup",_=l?"pointerdown":j,$=l?"pointermove":q,Q=l?"pointerup pointercancel":P,Z="ready",J="resize",K="wheel",F="zoom",G="image/jpeg",V=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,tt=/^data:image\/jpeg;base64,/,et=/^img|canvas$/i,it=200,at=100,nt={viewMode:0,dragMode:O,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},ot='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',rt=Number.isNaN||c.isNaN;function ht(t){return"number"===typeof t&&!rt(t)}var st=function(t){return t>0&&t<1/0};function ct(t){return"undefined"===typeof t}function dt(e){return"object"===t(e)&&null!==e}var lt=Object.prototype.hasOwnProperty;function pt(t){if(!dt(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&lt.call(i,"isPrototypeOf")}catch(a){return!1}}function ut(t){return"function"===typeof t}var mt=Array.prototype.slice;function gt(t){return Array.from?Array.from(t):mt.call(t)}function ft(t,e){return t&&ut(e)&&(Array.isArray(t)||ht(t.length)?gt(t).forEach(function(i,a){e.call(t,i,a,t)}):dt(t)&&Object.keys(t).forEach(function(i){e.call(t,t[i],i,t)})),t}var vt=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),a=1;a<e;a++)i[a-1]=arguments[a];return dt(t)&&i.length>0&&i.forEach(function(e){dt(e)&&Object.keys(e).forEach(function(i){t[i]=e[i]})}),t},wt=/\.\d*(?:0|9){12}\d*$/;function bt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return wt.test(t)?Math.round(t*e)/e:t}var yt=/^width|height|left|top|marginLeft|marginTop$/;function xt(t,e){var i=t.style;ft(e,function(t,e){yt.test(e)&&ht(t)&&(t="".concat(t,"px")),i[e]=t})}function Mt(t,e){return t.classList?t.classList.contains(e):t.className.indexOf(e)>-1}function Ct(t,e){if(e)if(ht(t.length))ft(t,function(t){Ct(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 Dt(t,e){e&&(ht(t.length)?ft(t,function(t){Dt(t,e)}):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function kt(t,e,i){e&&(ht(t.length)?ft(t,function(t){kt(t,e,i)}):i?Ct(t,e):Dt(t,e))}var Bt=/([a-z\d])([A-Z])/g;function Tt(t){return t.replace(Bt,"$1-$2").toLowerCase()}function Et(t,e){return dt(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Tt(e)))}function zt(t,e,i){dt(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Tt(e)),i)}function Nt(t,e){if(dt(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(Tt(e)))}var Wt=/\s\s*/,Ht=function(){var t=!1;if(s){var e=!1,i=function(){},a=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});c.addEventListener("test",i,a),c.removeEventListener("test",i,a)}return t}();function Lt(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=i;e.trim().split(Wt).forEach(function(e){if(!Ht){var o=t.listeners;o&&o[e]&&o[e][i]&&(n=o[e][i],delete o[e][i],0===Object.keys(o[e]).length&&delete o[e],0===Object.keys(o).length&&delete t.listeners)}t.removeEventListener(e,n,a)})}function Ot(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=i;e.trim().split(Wt).forEach(function(e){if(a.once&&!Ht){var o=t.listeners,r=void 0===o?{}:o;n=function(){delete r[e][i],t.removeEventListener(e,n,a);for(var o=arguments.length,h=new Array(o),s=0;s<o;s++)h[s]=arguments[s];i.apply(t,h)},r[e]||(r[e]={}),r[e][i]&&t.removeEventListener(e,r[e][i],a),r[e][i]=n,t.listeners=r}t.addEventListener(e,n,a)})}function St(t,e,i){var a;return ut(Event)&&ut(CustomEvent)?a=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(a=document.createEvent("CustomEvent"),a.initCustomEvent(e,!0,!0,i)),t.dispatchEvent(a)}function Yt(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var Rt=c.location,Xt=/^(\w+:)\/\/([^:\/?#]*):?(\d*)/i;function It(t){var e=t.match(Xt);return null!==e&&(e[1]!==Rt.protocol||e[2]!==Rt.hostname||e[3]!==Rt.port)}function At(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function Ut(t){var e=t.rotate,i=t.scaleX,a=t.scaleY,n=t.translateX,o=t.translateY,r=[];ht(n)&&0!==n&&r.push("translateX(".concat(n,"px)")),ht(o)&&0!==o&&r.push("translateY(".concat(o,"px)")),ht(e)&&0!==e&&r.push("rotate(".concat(e,"deg)")),ht(i)&&1!==i&&r.push("scaleX(".concat(i,")")),ht(a)&&1!==a&&r.push("scaleY(".concat(a,")"));var h=r.length?r.join(" "):"none";return{WebkitTransform:h,msTransform:h,transform:h}}function jt(t){var e=vt({},t),i=[];return ft(t,function(t,a){delete e[a],ft(e,function(e){var a=Math.abs(t.startX-e.startX),n=Math.abs(t.startY-e.startY),o=Math.abs(t.endX-e.endX),r=Math.abs(t.endY-e.endY),h=Math.sqrt(a*a+n*n),s=Math.sqrt(o*o+r*r),c=(s-h)/h;i.push(c)})}),i.sort(function(t,e){return Math.abs(t)<Math.abs(e)}),i[0]}function qt(t,e){var i=t.pageX,a=t.pageY,n={endX:i,endY:a};return e?n:vt({startX:i,startY:a},n)}function Pt(t){var e=0,i=0,a=0;return ft(t,function(t){var n=t.startX,o=t.startY;e+=n,i+=o,a+=1}),e/=a,i/=a,{pageX:e,pageY:i}}function _t(t){var e=t.aspectRatio,i=t.height,a=t.width,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",o=st(a),r=st(i);if(o&&r){var h=i*e;"contain"===n&&h>a||"cover"===n&&h<a?i=a/e:a=i*e}else o?i=a/e:r&&(a=i*e);return{width:a,height:i}}function $t(t){var e=t.width,i=t.height,a=t.degree;if(a=Math.abs(a)%180,90===a)return{width:i,height:e};var n=a%90*Math.PI/180,o=Math.sin(n),r=Math.cos(n),h=e*r+i*o,s=e*o+i*r;return a>90?{width:s,height:h}:{width:h,height:s}}function Qt(t,e,i,a){var o=e.aspectRatio,r=e.naturalWidth,h=e.naturalHeight,s=e.rotate,c=void 0===s?0:s,d=e.scaleX,l=void 0===d?1:d,p=e.scaleY,u=void 0===p?1:p,m=i.aspectRatio,g=i.naturalWidth,f=i.naturalHeight,v=a.fillColor,w=void 0===v?"transparent":v,b=a.imageSmoothingEnabled,y=void 0===b||b,x=a.imageSmoothingQuality,M=void 0===x?"low":x,C=a.maxWidth,D=void 0===C?1/0:C,k=a.maxHeight,B=void 0===k?1/0:k,T=a.minWidth,E=void 0===T?0:T,z=a.minHeight,N=void 0===z?0:z,W=document.createElement("canvas"),H=W.getContext("2d"),L=_t({aspectRatio:m,width:D,height:B}),O=_t({aspectRatio:m,width:E,height:N},"cover"),S=Math.min(L.width,Math.max(O.width,g)),Y=Math.min(L.height,Math.max(O.height,f)),R=_t({aspectRatio:o,width:D,height:B}),X=_t({aspectRatio:o,width:E,height:N},"cover"),I=Math.min(R.width,Math.max(X.width,r)),A=Math.min(R.height,Math.max(X.height,h)),U=[-I/2,-A/2,I,A];return W.width=bt(S),W.height=bt(Y),H.fillStyle=w,H.fillRect(0,0,S,Y),H.save(),H.translate(S/2,Y/2),H.rotate(c*Math.PI/180),H.scale(l,u),H.imageSmoothingEnabled=y,H.imageSmoothingQuality=M,H.drawImage.apply(H,[t].concat(n(U.map(function(t){return Math.floor(bt(t))})))),H.restore(),W}var Zt=String.fromCharCode;function Jt(t,e,i){var a="";i+=e;for(var n=e;n<i;n+=1)a+=Zt(t.getUint8(n));return a}var Kt=/^data:.*,/;function Ft(t){var e=t.replace(Kt,""),i=atob(e),a=new ArrayBuffer(i.length),n=new Uint8Array(a);return ft(n,function(t,e){n[e]=i.charCodeAt(e)}),a}function Gt(t,e){var i=[],a=8192,n=new Uint8Array(t);while(n.length>0)i.push(Zt.apply(null,gt(n.subarray(0,a)))),n=n.subarray(a);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}function Vt(t){var e,i=new DataView(t);try{var a,n,o;if(255===i.getUint8(0)&&216===i.getUint8(1)){var r=i.byteLength,h=2;while(h+1<r){if(255===i.getUint8(h)&&225===i.getUint8(h+1)){n=h;break}h+=1}}if(n){var s=n+4,c=n+10;if("Exif"===Jt(i,s,4)){var d=i.getUint16(c);if(a=18761===d,(a||19789===d)&&42===i.getUint16(c+2,a)){var l=i.getUint32(c+4,a);l>=8&&(o=c+l)}}}if(o){var p,u,m=i.getUint16(o,a);for(u=0;u<m;u+=1)if(p=o+12*u+2,274===i.getUint16(p,a)){p+=8,e=i.getUint16(p,a),i.setUint16(p,1,a);break}}}catch(g){e=1}return e}function te(t){var e=0,i=1,a=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:a=-1;break;case 5:e=90,a=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90;break;default:}return{rotate:e,scaleX:i,scaleY:a}}var ee={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,a=this.cropper;Ct(a,T),Dt(t,T);var n={width:Math.max(i.offsetWidth,Number(e.minContainerWidth)||200),height:Math.max(i.offsetHeight,Number(e.minContainerHeight)||100)};this.containerData=n,xt(a,{width:n.width,height:n.height}),Ct(t,T),Dt(a,T)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,a=Math.abs(e.rotate)%180===90,n=a?e.naturalHeight:e.naturalWidth,o=a?e.naturalWidth:e.naturalHeight,r=n/o,h=t.width,s=t.height;t.height*r>t.width?3===i?h=t.height*r:s=t.width/r:3===i?s=t.width/r:h=t.height*r;var c={aspectRatio:r,naturalWidth:n,naturalHeight:o,width:h,height:s};c.left=(t.width-h)/2,c.top=(t.height-s)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),this.initialImageData=vt({},e),this.initialCanvasData=vt({},c)},limitCanvas:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=i.viewMode,h=n.aspectRatio,s=this.cropped&&o;if(t){var c=Number(i.minCanvasWidth)||0,d=Number(i.minCanvasHeight)||0;r>1?(c=Math.max(c,a.width),d=Math.max(d,a.height),3===r&&(d*h>c?c=d*h:d=c/h)):r>0&&(c?c=Math.max(c,s?o.width:0):d?d=Math.max(d,s?o.height:0):s&&(c=o.width,d=o.height,d*h>c?c=d*h:d=c/h));var l=_t({aspectRatio:h,width:c,height:d});c=l.width,d=l.height,n.minWidth=c,n.minHeight=d,n.maxWidth=1/0,n.maxHeight=1/0}if(e)if(r>(s?0:1)){var p=a.width-n.width,u=a.height-n.height;n.minLeft=Math.min(0,p),n.minTop=Math.min(0,u),n.maxLeft=Math.max(0,p),n.maxTop=Math.max(0,u),s&&this.limited&&(n.minLeft=Math.min(o.left,o.left+(o.width-n.width)),n.minTop=Math.min(o.top,o.top+(o.height-n.height)),n.maxLeft=o.left,n.maxTop=o.top,2===r&&(n.width>=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,u),n.maxTop=Math.max(0,u))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,e){var i=this.canvasData,a=this.imageData;if(e){var n=$t({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),o=n.width,r=n.height,h=i.width*(o/i.naturalWidth),s=i.height*(r/i.naturalHeight);i.left-=(h-i.width)/2,i.top-=(s-i.height)/2,i.width=h,i.height=s,i.aspectRatio=o/r,i.naturalWidth=o,i.naturalHeight=r,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,xt(this.canvas,vt({width:i.width,height:i.height},Ut({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,a=i.naturalWidth*(e.width/e.naturalWidth),n=i.naturalHeight*(e.height/e.naturalHeight);vt(i,{width:a,height:n,left:(e.width-a)/2,top:(e.height-n)/2}),xt(this.image,vt({width:i.width,height:i.height},Ut(vt({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,a=Number(t.autoCropArea)||.8,n={width:e.width,height:e.height};i&&(e.height*i>e.width?n.height=n.width/i:n.width=n.height*i),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=e.left+(e.width-n.width)/2,n.top=e.top+(e.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=vt({},n)},limitCropBox:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=this.limited,h=i.aspectRatio;if(t){var s=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,d=r?Math.min(a.width,n.width,n.width+n.left,a.width-n.left):a.width,l=r?Math.min(a.height,n.height,n.height+n.top,a.height-n.top):a.height;s=Math.min(s,a.width),c=Math.min(c,a.height),h&&(s&&c?c*h>s?c=s/h:s=c*h:s?c=s/h:c&&(s=c*h),l*h>d?l=d/h:d=l*h),o.minWidth=Math.min(s,d),o.minHeight=Math.min(c,l),o.maxWidth=d,o.maxHeight=l}e&&(r?(o.minLeft=Math.max(0,n.left),o.minTop=Math.max(0,n.top),o.maxLeft=Math.min(a.width,n.left+n.width)-o.width,o.maxTop=Math.min(a.height,n.top+n.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=a.width-o.width,o.maxTop=a.height-o.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&zt(this.face,H,i.width>=e.width&&i.height>=e.height?g:u),xt(this.cropBox,vt({width:i.width,height:i.height},Ut({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),St(this.element,R,this.getData())}},ie={initPreview:function(){var t=this.crossOrigin,e=this.options.preview,i=t?this.crossOriginUrl:this.url,a=document.createElement("img");if(t&&(a.crossOrigin=t),a.src=i,this.viewBox.appendChild(a),this.viewBoxImage=a,e){var n=e;"string"===typeof e?n=this.element.ownerDocument.querySelectorAll(e):e.querySelector&&(n=[e]),this.previews=n,ft(n,function(e){var a=document.createElement("img");zt(e,L,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(a.crossOrigin=t),a.src=i,a.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(a)})}},resetPreview:function(){ft(this.previews,function(t){var e=Et(t,L);xt(t,{width:e.width,height:e.height}),t.innerHTML=e.html,Nt(t,L)})},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,a=i.width,n=i.height,o=t.width,r=t.height,h=i.left-e.left-t.left,s=i.top-e.top-t.top;this.cropped&&!this.disabled&&(xt(this.viewBoxImage,vt({width:o,height:r},Ut(vt({translateX:-h,translateY:-s},t)))),ft(this.previews,function(e){var i=Et(e,L),c=i.width,d=i.height,l=c,p=d,u=1;a&&(u=c/a,p=n*u),n&&p>d&&(u=d/n,l=a*u,p=d),xt(e,{width:l,height:p}),xt(e.getElementsByTagName("img")[0],vt({width:o*u,height:r*u},Ut(vt({translateX:-h*u,translateY:-s*u},t))))}))}},ae={bind:function(){var t=this.element,e=this.options,i=this.cropper;ut(e.cropstart)&&Ot(t,A,e.cropstart),ut(e.cropmove)&&Ot(t,I,e.cropmove),ut(e.cropend)&&Ot(t,X,e.cropend),ut(e.crop)&&Ot(t,R,e.crop),ut(e.zoom)&&Ot(t,F,e.zoom),Ot(i,_,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&Ot(i,K,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Ot(i,U,this.onDblclick=this.dblclick.bind(this)),Ot(t.ownerDocument,$,this.onCropMove=this.cropMove.bind(this)),Ot(t.ownerDocument,Q,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&Ot(window,J,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;ut(e.cropstart)&&Lt(t,A,e.cropstart),ut(e.cropmove)&&Lt(t,I,e.cropmove),ut(e.cropend)&&Lt(t,X,e.cropend),ut(e.crop)&&Lt(t,R,e.crop),ut(e.zoom)&&Lt(t,F,e.zoom),Lt(i,_,this.onCropStart),e.zoomable&&e.zoomOnWheel&&Lt(i,K,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Lt(i,U,this.onDblclick),Lt(t.ownerDocument,$,this.onCropMove),Lt(t.ownerDocument,Q,this.onCropEnd),e.responsive&&Lt(window,J,this.onResize)}},ne={resize:function(){var t=this.options,e=this.container,i=this.containerData,a=Number(t.minContainerWidth)||it,n=Number(t.minContainerHeight)||at;if(!(this.disabled||i.width<=a||i.height<=n)){var o,r,h=e.offsetWidth/i.width;if(1!==h||e.offsetHeight!==i.height)t.restore&&(o=this.getCanvasData(),r=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(ft(o,function(t,e){o[e]=t*h})),this.setCropBoxData(ft(r,function(t,e){r[e]=t*h})))}},dblclick:function(){this.disabled||this.options.dragMode===Y||this.setDragMode(Mt(this.dragBox,k)?S:O)},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout(function(){e.wheeling=!1},50),t.deltaY?a=t.deltaY>0?1:-1:t.wheelDelta?a=-t.wheelDelta/120:t.detail&&(a=t.detail>0?1:-1),this.zoom(-a*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||ht(e)&&1!==e||ht(i)&&0!==i||t.ctrlKey)){var a,n=this.options,o=this.pointers;t.changedTouches?ft(t.changedTouches,function(t){o[t.identifier]=qt(t)}):o[t.pointerId||0]=qt(t),a=Object.keys(o).length>1&&n.zoomable&&n.zoomOnTouch?f:Et(t.target,H),V.test(a)&&!1!==St(this.element,A,{originalEvent:t,action:a})&&(t.preventDefault(),this.action=a,this.cropping=!1,a===m&&(this.cropping=!0,Ct(this.dragBox,N)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==St(this.element,I,{originalEvent:t,action:e})&&(t.changedTouches?ft(t.changedTouches,function(t){vt(i[t.identifier]||{},qt(t,!0))}):vt(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?ft(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,kt(this.dragBox,N,this.cropped&&this.options.modal)),St(this.element,X,{originalEvent:t,action:e}))}}},oe={change:function(t){var e,i=this.options,a=this.canvasData,n=this.containerData,o=this.cropBoxData,r=this.pointers,h=this.action,s=i.aspectRatio,c=o.left,d=o.top,l=o.width,p=o.height,k=c+l,B=d+p,E=0,z=0,N=n.width,W=n.height,H=!0;!s&&t.shiftKey&&(s=l&&p?l/p:1),this.limited&&(E=o.minLeft,z=o.minTop,N=E+Math.min(n.width,a.width,a.left+a.width),W=z+Math.min(n.height,a.height,a.top+a.height));var L=r[Object.keys(r)[0]],O={x:L.endX-L.startX,y:L.endY-L.startY},S=function(t){switch(t){case v:k+O.x>N&&(O.x=N-k);break;case w:c+O.x<E&&(O.x=E-c);break;case y:d+O.y<z&&(O.y=z-d);break;case b:B+O.y>W&&(O.y=W-B);break;default:}};switch(h){case u:c+=O.x,d+=O.y;break;case v:if(O.x>=0&&(k>=N||s&&(d<=z||B>=W))){H=!1;break}S(v),l+=O.x,l<0&&(h=w,l=-l,c-=l),s&&(p=l/s,d+=(o.height-p)/2);break;case y:if(O.y<=0&&(d<=z||s&&(c<=E||k>=N))){H=!1;break}S(y),p-=O.y,d+=O.y,p<0&&(h=b,p=-p,d-=p),s&&(l=p*s,c+=(o.width-l)/2);break;case w:if(O.x<=0&&(c<=E||s&&(d<=z||B>=W))){H=!1;break}S(w),l-=O.x,c+=O.x,l<0&&(h=v,l=-l,c-=l),s&&(p=l/s,d+=(o.height-p)/2);break;case b:if(O.y>=0&&(B>=W||s&&(c<=E||k>=N))){H=!1;break}S(b),p+=O.y,p<0&&(h=y,p=-p,d-=p),s&&(l=p*s,c+=(o.width-l)/2);break;case x:if(s){if(O.y<=0&&(d<=z||k>=N)){H=!1;break}S(y),p-=O.y,d+=O.y,l=p*s}else S(y),S(v),O.x>=0?k<N?l+=O.x:O.y<=0&&d<=z&&(H=!1):l+=O.x,O.y<=0?d>z&&(p-=O.y,d+=O.y):(p-=O.y,d+=O.y);l<0&&p<0?(h=D,p=-p,l=-l,d-=p,c-=l):l<0?(h=M,l=-l,c-=l):p<0&&(h=C,p=-p,d-=p);break;case M:if(s){if(O.y<=0&&(d<=z||c<=E)){H=!1;break}S(y),p-=O.y,d+=O.y,l=p*s,c+=o.width-l}else S(y),S(w),O.x<=0?c>E?(l-=O.x,c+=O.x):O.y<=0&&d<=z&&(H=!1):(l-=O.x,c+=O.x),O.y<=0?d>z&&(p-=O.y,d+=O.y):(p-=O.y,d+=O.y);l<0&&p<0?(h=C,p=-p,l=-l,d-=p,c-=l):l<0?(h=x,l=-l,c-=l):p<0&&(h=D,p=-p,d-=p);break;case D:if(s){if(O.x<=0&&(c<=E||B>=W)){H=!1;break}S(w),l-=O.x,c+=O.x,p=l/s}else S(b),S(w),O.x<=0?c>E?(l-=O.x,c+=O.x):O.y>=0&&B>=W&&(H=!1):(l-=O.x,c+=O.x),O.y>=0?B<W&&(p+=O.y):p+=O.y;l<0&&p<0?(h=x,p=-p,l=-l,d-=p,c-=l):l<0?(h=C,l=-l,c-=l):p<0&&(h=M,p=-p,d-=p);break;case C:if(s){if(O.x>=0&&(k>=N||B>=W)){H=!1;break}S(v),l+=O.x,p=l/s}else S(b),S(v),O.x>=0?k<N?l+=O.x:O.y>=0&&B>=W&&(H=!1):l+=O.x,O.y>=0?B<W&&(p+=O.y):p+=O.y;l<0&&p<0?(h=M,p=-p,l=-l,d-=p,c-=l):l<0?(h=D,l=-l,c-=l):p<0&&(h=x,p=-p,d-=p);break;case g:this.move(O.x,O.y),H=!1;break;case f:this.zoom(jt(r),t),H=!1;break;case m:if(!O.x||!O.y){H=!1;break}e=Yt(this.cropper),c=L.startX-e.left,d=L.startY-e.top,l=o.minWidth,p=o.minHeight,O.x>0?h=O.y>0?C:x:O.x<0&&(c-=l,h=O.y>0?D:M),O.y<0&&(d-=p),this.cropped||(Dt(this.cropBox,T),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break;default:}H&&(o.width=l,o.height=p,o.left=c,o.top=d,this.action=h,this.renderCropBox()),ft(r,function(t){t.startX=t.endX,t.startY=t.endY})}},re={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Ct(this.dragBox,N),Dt(this.cropBox,T),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=vt({},this.initialImageData),this.canvasData=vt({},this.initialCanvasData),this.cropBoxData=vt({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(vt(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Dt(this.dragBox,N),Ct(this.cropBox,T)),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,ft(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,Dt(this.cropper,B)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Ct(this.cropper,B)),this},destroy:function(){var t=this.element;return t[p]?(t[p]=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,a=i.left,n=i.top;return this.moveTo(ct(t)?t:a+Number(t),ct(e)?e:n+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(ht(t)&&(i.left=t,a=!0),ht(e)&&(i.top=e,a=!0),a&&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 a=this.options,n=this.canvasData,o=n.width,r=n.height,h=n.naturalWidth,s=n.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&a.zoomable){var c=h*t,d=s*t;if(!1===St(this.element,F,{ratio:t,oldRatio:o/h,originalEvent:i}))return this;if(i){var l=this.pointers,p=Yt(this.cropper),u=l&&Object.keys(l).length?Pt(l):{pageX:i.pageX,pageY:i.pageY};n.left-=(c-o)*((u.pageX-p.left-n.left)/o),n.top-=(d-r)*((u.pageY-p.top-n.top)/r)}else pt(e)&&ht(e.x)&&ht(e.y)?(n.left-=(c-o)*((e.x-n.left)/o),n.top-=(d-r)*((e.y-n.top)/r)):(n.left-=(c-o)/2,n.top-=(d-r)/2);n.width=c,n.height=d,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),ht(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,ht(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(ht(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(ht(t)&&(i.scaleX=t,a=!0),ht(e)&&(i.scaleY=e,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,a=this.imageData,n=this.canvasData,o=this.cropBoxData;if(this.ready&&this.cropped){t={x:o.left-n.left,y:o.top-n.top,width:o.width,height:o.height};var r=a.width/a.naturalWidth;if(ft(t,function(e,i){t[i]=e/r}),e){var h=Math.round(t.y+t.height),s=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=s-t.x,t.height=h-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=a.rotate||0),i.scalable&&(t.scaleX=a.scaleX||1,t.scaleY=a.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,a=this.canvasData,n={};if(this.ready&&!this.disabled&&pt(t)){var o=!1;e.rotatable&&ht(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),e.scalable&&(ht(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),ht(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var r=i.width/i.naturalWidth;ht(t.x)&&(n.left=t.x*r+a.left),ht(t.y)&&(n.top=t.y*r+a.top),ht(t.width)&&(n.width=t.width*r),ht(t.height)&&(n.height=t.height*r),this.setCropBoxData(n)}return this},getContainerData:function(){return this.ready?vt({},this.containerData):{}},getImageData:function(){return this.sized?vt({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&ft(["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&&pt(t)&&(ht(t.left)&&(e.left=t.left),ht(t.top)&&(e.top=t.top),ht(t.width)?(e.width=t.width,e.height=t.width/i):ht(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,a=this.cropBoxData,n=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&pt(t)&&(ht(t.left)&&(a.left=t.left),ht(t.top)&&(a.top=t.top),ht(t.width)&&t.width!==a.width&&(e=!0,a.width=t.width),ht(t.height)&&t.height!==a.height&&(i=!0,a.height=t.height),n&&(e?a.height=a.width/n:i&&(a.width=a.height*n)),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=Qt(this.image,this.imageData,e,t);if(!this.cropped)return i;var a=this.getData(),o=a.x,r=a.y,h=a.width,s=a.height,c=i.width/Math.floor(e.naturalWidth);1!==c&&(o*=c,r*=c,h*=c,s*=c);var d=h/s,l=_t({aspectRatio:d,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),p=_t({aspectRatio:d,width:t.minWidth||0,height:t.minHeight||0},"cover"),u=_t({aspectRatio:d,width:t.width||(1!==c?i.width:h),height:t.height||(1!==c?i.height:s)}),m=u.width,g=u.height;m=Math.min(l.width,Math.max(p.width,m)),g=Math.min(l.height,Math.max(p.height,g));var f=document.createElement("canvas"),v=f.getContext("2d");f.width=bt(m),f.height=bt(g),v.fillStyle=t.fillColor||"transparent",v.fillRect(0,0,m,g);var w=t.imageSmoothingEnabled,b=void 0===w||w,y=t.imageSmoothingQuality;v.imageSmoothingEnabled=b,y&&(v.imageSmoothingQuality=y);var x,M,C,D,k,B,T=i.width,E=i.height,z=o,N=r;z<=-h||z>T?(z=0,x=0,C=0,k=0):z<=0?(C=-z,z=0,x=Math.min(T,h+z),k=x):z<=T&&(C=0,x=Math.min(h,T-z),k=x),x<=0||N<=-s||N>E?(N=0,M=0,D=0,B=0):N<=0?(D=-N,N=0,M=Math.min(E,s+N),B=M):N<=E&&(D=0,M=Math.min(s,E-N),B=M);var W=[z,N,x,M];if(k>0&&B>0){var H=m/h;W.push(C*H,D*H,k*H,B*H)}return v.drawImage.apply(v,[i].concat(n(W.map(function(t){return Math.floor(bt(t))})))),f},setAspectRatio:function(t){var e=this.options;return this.disabled||ct(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,a=this.face;if(this.ready&&!this.disabled){var n=t===O,o=e.movable&&t===S;t=n||o?t:Y,e.dragMode=t,zt(i,H,t),kt(i,k,n),kt(i,W,o),e.cropBoxMovable||(zt(a,H,t),kt(a,k,n),kt(a,W,o))}return this}},he=c.Cropper,se=function(){function t(i){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e(this,t),!i||!et.test(i.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=i,this.options=vt({},nt,pt(a)&&a),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[p]){if(e[p]=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,a=this.options;if(a.rotatable||a.scalable||(a.checkOrientation=!1),a.checkOrientation&&window.ArrayBuffer)if(tt.test(t))this.read(Ft(t));else{var n=new XMLHttpRequest,o=this.clone.bind(this);this.reloading=!0,this.xhr=n,n.onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){n.getResponseHeader("content-type")!==G&&n.abort()},n.onload=function(){e.read(n.response)},n.onloadend=function(){e.reloading=!1,e.xhr=null},a.checkCrossOrigin&&It(t)&&i.crossOrigin&&(t=At(t)),n.open("GET",t),n.responseType="arraybuffer",n.withCredentials="use-credentials"===i.crossOrigin,n.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,a=Vt(t),n=0,o=1,r=1;if(a>1){this.url=Gt(t,G);var h=te(a);n=h.rotate,o=h.scaleX,r=h.scaleY}e.rotatable&&(i.rotate=n),e.scalable&&(i.scaleX=o,i.scaleY=r),this.clone()}},{key:"clone",value:function(){var t,e,i=this.element,a=this.url;this.options.checkCrossOrigin&&It(a)&&(t=i.crossOrigin,t?e=a:(t="anonymous",e=At(a))),this.crossOrigin=t,this.crossOriginUrl=e;var n=document.createElement("img");t&&(n.crossOrigin=t),n.src=e||a,this.image=n,n.onload=this.start.bind(this),n.onerror=this.stop.bind(this),Ct(n,E),i.parentNode.insertBefore(n,i.nextSibling)}},{key:"start",value:function(){var t=this,e=this.isImg?this.element:this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=c.navigator&&/^(?:.(?!chrome|android))*safari/i.test(c.navigator.userAgent),a=function(e,i){vt(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var n=document.createElement("img"),o=document.body||document.documentElement;this.sizingImage=n,n.onload=function(){a(n.width,n.height),i||o.removeChild(n)},n.src=e.src,i||(n.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;",o.appendChild(n))}else a(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,a=t.parentNode,n=document.createElement("div");n.innerHTML=ot;var o=n.querySelector(".".concat(p,"-container")),r=o.querySelector(".".concat(p,"-canvas")),h=o.querySelector(".".concat(p,"-drag-box")),s=o.querySelector(".".concat(p,"-crop-box")),c=s.querySelector(".".concat(p,"-face"));this.container=a,this.cropper=o,this.canvas=r,this.dragBox=h,this.cropBox=s,this.viewBox=o.querySelector(".".concat(p,"-view-box")),this.face=c,r.appendChild(i),Ct(t,T),a.insertBefore(o,t.nextSibling),this.isImg||Dt(i,E),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,Ct(s,T),e.guides||Ct(s.getElementsByClassName("".concat(p,"-dashed")),T),e.center||Ct(s.getElementsByClassName("".concat(p,"-center")),T),e.background&&Ct(o,"".concat(p,"-bg")),e.highlight||Ct(c,z),e.cropBoxMovable&&(Ct(c,W),zt(c,H,u)),e.cropBoxResizable||(Ct(s.getElementsByClassName("".concat(p,"-line")),T),Ct(s.getElementsByClassName("".concat(p,"-point")),T)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),ut(e.ready)&&Ot(t,Z,e.ready,{once:!0}),St(t,Z)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),Dt(this.element,T))}},{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=he,t}},{key:"setDefaults",value:function(t){vt(nt,pt(t)&&t)}}]),t}();return vt(se.prototype,ee,ie,ae,ne,oe,re),se})}}]);