;(function(){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e2){throw _e2;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e3){didErr=true;err=_e3;},f:function f(){try{if(!normalCompletion&&it.return!=null)it.return();}finally{if(didErr)throw err;}}};}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);ispan{display:block;color:#212121;font-size:16px;padding-bottom:15px}._operation_cslsh_44{font-size:24px;display:flex;align-items:center;margin-top:20px}._operation_cslsh_44>i{margin-left:12px;cursor:pointer}._operation_cslsh_44 ._icon-rate_cslsh_54{display:inline-block;width:20px;height:20px;background:url(./images/icon_rate.png) no-repeat center;background-size:contain}._vue-cropper_cslsh_61{border-radius:5px;overflow:hidden}:deep(._el-dialog_cslsh_65){margin-bottom:10vh}:deep(._el-dialog_cslsh_65) ._el-dialog__header_cslsh_68{background:#fff;padding:15px 20px}:deep(._el-dialog_cslsh_65) ._el-dialog__header_cslsh_68 ._el-dialog__title_cslsh_72{color:#212121}:deep(._el-dialog_cslsh_65) ._el-dialog__header_cslsh_68 ._el-dialog__headerbtn_cslsh_75 ._el-dialog__close_cslsh_75{color:#212121}:deep(._el-dialog_cslsh_65) ._el-dialog__body_cslsh_78{padding-top:0}.vue-cropper[data-v-be5e5ddc]{position:relative;width:100%;height:100%;box-sizing:border-box;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;direction:ltr;touch-action:none;text-align:left;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-box[data-v-be5e5ddc],.cropper-box-canvas[data-v-be5e5ddc],.cropper-drag-box[data-v-be5e5ddc],.cropper-crop-box[data-v-be5e5ddc],.cropper-face[data-v-be5e5ddc]{position:absolute;top:0;right:0;bottom:0;left:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.cropper-box-canvas img[data-v-be5e5ddc]{position:relative;text-align:left;-webkit-user-select:none;-moz-user-select:none;user-select:none;transform:none;max-width:none;max-height:none}.cropper-box[data-v-be5e5ddc]{overflow:hidden}.cropper-move[data-v-be5e5ddc]{cursor:move}.cropper-crop[data-v-be5e5ddc]{cursor:crosshair}.cropper-modal[data-v-be5e5ddc]{background:rgba(0,0,0,.5)}.cropper-view-box[data-v-be5e5ddc]{display:block;overflow:hidden;width:100%;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);-webkit-user-select:none;-moz-user-select:none;user-select:none}.cropper-view-box img[data-v-be5e5ddc]{-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;max-width:none;max-height:none}.cropper-face[data-v-be5e5ddc]{top:0;left:0;background-color:#fff;opacity:.1}.crop-info[data-v-be5e5ddc]{position:absolute;left:0px;min-width:65px;text-align:center;color:#fff;line-height:20px;background-color:rgba(0,0,0,.8);font-size:12px}.crop-line[data-v-be5e5ddc]{position:absolute;display:block;width:100%;height:100%;opacity:.1}.line-w[data-v-be5e5ddc]{top:-3px;left:0;height:5px;cursor:n-resize}.line-a[data-v-be5e5ddc]{top:0;left:-3px;width:5px;cursor:w-resize}.line-s[data-v-be5e5ddc]{bottom:-3px;left:0;height:5px;cursor:s-resize}.line-d[data-v-be5e5ddc]{top:0;right:-3px;width:5px;cursor:e-resize}.crop-point[data-v-be5e5ddc]{position:absolute;width:8px;height:8px;opacity:.75;background-color:#39f;border-radius:100%}.point1[data-v-be5e5ddc]{top:-4px;left:-4px;cursor:nw-resize}.point2[data-v-be5e5ddc]{top:-5px;left:50%;margin-left:-3px;cursor:n-resize}.point3[data-v-be5e5ddc]{top:-4px;right:-4px;cursor:ne-resize}.point4[data-v-be5e5ddc]{top:50%;left:-4px;margin-top:-3px;cursor:w-resize}.point5[data-v-be5e5ddc]{top:50%;right:-4px;margin-top:-3px;cursor:e-resize}.point6[data-v-be5e5ddc]{bottom:-5px;left:-4px;cursor:sw-resize}.point7[data-v-be5e5ddc]{bottom:-5px;left:50%;margin-left:-3px;cursor:s-resize}.point8[data-v-be5e5ddc]{bottom:-5px;right:-4px;cursor:se-resize}@media screen and (max-width: 500px){.crop-point[data-v-be5e5ddc]{position:absolute;width:20px;height:20px;opacity:.45;background-color:#39f;border-radius:100%}.point1[data-v-be5e5ddc]{top:-10px;left:-10px}.point2[data-v-be5e5ddc],.point4[data-v-be5e5ddc],.point5[data-v-be5e5ddc],.point7[data-v-be5e5ddc]{display:none}.point3[data-v-be5e5ddc]{top:-10px;right:-10px}.point4[data-v-be5e5ddc]{top:0;left:0}.point6[data-v-be5e5ddc]{bottom:-10px;left:-10px}.point8[data-v-be5e5ddc]{bottom:-10px;right:-10px}}\n";document.head.appendChild(__vite_style__);System.register(['./icon_upload-legacy.e1b38fd3.js','./vendor-legacy.586833b0.js','./index-legacy.93a7afb7.js'],function(exports){'use strict';var iconUpload,defineComponent,createElementBlock,withDirectives,vShow,createBaseVNode,normalizeStyle,createCommentVNode,normalizeClass,toDisplayString,openBlock,request$1,ElMessage,createVNode,ElDialog,ElRow,ElCol,ElIcon,circle_plus_default,remove_default,createTextVNode,ElImage,ElButton,ElUpload,request;return{setters:[function(module){iconUpload=module.i;},function(module){defineComponent=module.d;createElementBlock=module.av;withDirectives=module.ar;vShow=module.as;createBaseVNode=module.aw;normalizeStyle=module.ax;createCommentVNode=module.ay;normalizeClass=module.az;toDisplayString=module.aA;openBlock=module.aB;request$1=module.aC;ElMessage=module.E;createVNode=module.c;ElDialog=module.K;ElRow=module.q;ElCol=module.v;ElIcon=module.l;circle_plus_default=module.aD;remove_default=module.aE;createTextVNode=module.a;ElImage=module.x;ElButton=module.k;ElUpload=module.ac;},function(module){request=module.r;}],execute:function execute(){var uploadSection="_uploadSection_cslsh_1";var uploadClass="_uploadClass_cslsh_11";var previewImg="_previewImg_cslsh_34";var operation="_operation_cslsh_44";var styles={uploadSection:uploadSection,uploadClass:uploadClass,"avatar-upload-preview_range":"_avatar-upload-preview_range_cslsh_19","avatar-upload-preview":"_avatar-upload-preview_cslsh_19",previewImg:previewImg,operation:operation,"icon-rate":"_icon-rate_cslsh_54","vue-cropper":"_vue-cropper_cslsh_61","el-dialog":"_el-dialog_cslsh_65","el-dialog__header":"_el-dialog__header_cslsh_68","el-dialog__title":"_el-dialog__title_cslsh_72","el-dialog__headerbtn":"_el-dialog__headerbtn_cslsh_75","el-dialog__close":"_el-dialog__close_cslsh_75","el-dialog__body":"_el-dialog__body_cslsh_78"};var Exif={};Exif.getData=function(img){return new Promise(function(reslove,reject){var obj={};getImageData(img).then(function(data){obj.arrayBuffer=data;obj.orientation=getOrientation(data);reslove(obj);}).catch(function(error){reject(error);});});};function getImageData(img){var data=null;return new Promise(function(reslove,reject){if(img.src){if(/^data\:/i.test(img.src)){data=base64ToArrayBuffer(img.src);reslove(data);}else if(/^blob\:/i.test(img.src)){var fileReader=new FileReader();fileReader.onload=function(e){data=e.target.result;reslove(data);};objectURLToBlob(img.src,function(blob){fileReader.readAsArrayBuffer(blob);});}else{var http=new XMLHttpRequest();http.onload=function(){if(this.status==200||this.status===0){data=http.response;reslove(data);}else{throw"Could not load image";}http=null;};http.open("GET",img.src,true);http.responseType="arraybuffer";http.send(null);}}else{reject("img error");}});}function objectURLToBlob(url,callback){var http=new XMLHttpRequest();http.open("GET",url,true);http.responseType="blob";http.onload=function(e){if(this.status==200||this.status===0){callback(this.response);}};http.send();}function base64ToArrayBuffer(base64){base64=base64.replace(/^data\:([^\;]+)\;base64,/gmi,"");var binary=atob(base64);var len=binary.length;var buffer=new ArrayBuffer(len);var view=new Uint8Array(buffer);for(var i=0;i=8){ifdStart=tiffOffset+firstIFDOffset;}}}}}if(ifdStart){length=dataView.getUint16(ifdStart,littleEndian);for(i=0;i21?"-21px":"0px";obj.width=this.cropW>0?this.cropW:0;obj.height=this.cropH>0?this.cropH:0;if(this.infoTrue){var dpr=1;if(this.high&&!this.full){dpr=window.devicePixelRatio;}if(this.enlarge!==1&!this.full){dpr=Math.abs(Number(this.enlarge));}obj.width=obj.width*dpr;obj.height=obj.height*dpr;if(this.full){obj.width=obj.width/this.scale;obj.height=obj.height/this.scale;}}obj.width=obj.width.toFixed(0);obj.height=obj.height.toFixed(0);return obj;},isIE:function isIE(){var isIE=!!window.ActiveXObject||"ActiveXObject"in window;return isIE;},passive:function passive(){return this.isIE?null:{passive:false};}},watch:{img:function img(){this.checkedImg();},imgs:function imgs(val){if(val===""){return;}this.reload();},cropW:function cropW(){this.showPreview();},cropH:function cropH(){this.showPreview();},cropOffsertX:function cropOffsertX(){this.showPreview();},cropOffsertY:function cropOffsertY(){this.showPreview();},scale:function scale(val,oldVal){this.showPreview();},x:function x(){this.showPreview();},y:function y(){this.showPreview();},autoCrop:function autoCrop(val){if(val){this.goAutoCrop();}},autoCropWidth:function autoCropWidth(){if(this.autoCrop){this.goAutoCrop();}},autoCropHeight:function autoCropHeight(){if(this.autoCrop){this.goAutoCrop();}},mode:function mode(){this.checkedImg();},rotate:function rotate(){this.showPreview();if(this.autoCrop){this.goAutoCrop(this.cropW,this.cropH);}else{if(this.cropW>0||this.cropH>0){this.goAutoCrop(this.cropW,this.cropH);}}}},methods:{getVersion:function getVersion(name){var arr=navigator.userAgent.split(" ");var chromeVersion="";var result=0;var reg=new RegExp(name,"i");for(var i=0;i=81){orientation=-1;}else{if(this.getVersion("safari")[0]>=605){var safariVersion=this.getVersion("version");if(safariVersion[0]>13&&safariVersion[1]>1){orientation=-1;}}else{var isIos=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(isIos){var version=isIos[1];version=version.split("_");if(version[0]>13||version[0]>=13&&version[1]>=4){orientation=-1;}}}}var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");ctx.save();switch(orientation){case 2:canvas.width=width;canvas.height=height;ctx.translate(width,0);ctx.scale(-1,1);break;case 3:canvas.width=width;canvas.height=height;ctx.translate(width/2,height/2);ctx.rotate(180*Math.PI/180);ctx.translate(-width/2,-height/2);break;case 4:canvas.width=width;canvas.height=height;ctx.translate(0,height);ctx.scale(1,-1);break;case 5:canvas.height=width;canvas.width=height;ctx.rotate(0.5*Math.PI);ctx.scale(1,-1);break;case 6:canvas.width=height;canvas.height=width;ctx.translate(height/2,width/2);ctx.rotate(90*Math.PI/180);ctx.translate(-width/2,-height/2);break;case 7:canvas.height=width;canvas.width=height;ctx.rotate(0.5*Math.PI);ctx.translate(width,-height);ctx.scale(-1,1);break;case 8:canvas.height=width;canvas.width=height;ctx.translate(height/2,width/2);ctx.rotate(-90*Math.PI/180);ctx.translate(-width/2,-height/2);break;default:canvas.width=width;canvas.height=height;}ctx.drawImage(img,0,0,width,height);ctx.restore();canvas.toBlob(function(blob){var data=URL.createObjectURL(blob);URL.revokeObjectURL(_this.imgs);_this.imgs=data;},"image/"+this.outputType,1);},checkedImg:function checkedImg(){var _this2=this;if(this.img===null||this.img===""){this.imgs="";this.clearCrop();return;}this.loading=true;this.scale=1;this.rotate=0;this.clearCrop();var img=new Image();img.onload=function(){if(_this2.img===""){_this2.$emit("img-load","error");return false;}var width=img.width;var height=img.height;Exif.getData(img).then(function(data){_this2.orientation=data.orientation||1;var max=Number(_this2.maxImgSize);if(!_this2.orientation&&widthmax){height=height/width*max;width=max;}if(height>max){width=width/height*max;height=max;}_this2.checkOrientationImage(img,_this2.orientation,width,height);});};img.onerror=function(){_this2.$emit("img-load","error");};if(this.img.substr(0,4)!=="data"){img.crossOrigin="";}if(this.isIE){var xhr=new XMLHttpRequest();xhr.onload=function(){var url=URL.createObjectURL(this.response);img.src=url;};xhr.open("GET",this.img,true);xhr.responseType="blob";xhr.send();}else{img.src=this.img;}},startMove:function startMove(e){e.preventDefault();if(this.move&&!this.crop){if(!this.canMove){return false;}this.moveX=("clientX"in e?e.clientX:e.touches[0].clientX)-this.x;this.moveY=("clientY"in e?e.clientY:e.touches[0].clientY)-this.y;if(e.touches){window.addEventListener("touchmove",this.moveImg);window.addEventListener("touchend",this.leaveImg);if(e.touches.length==2){this.touches=e.touches;window.addEventListener("touchmove",this.touchScale);window.addEventListener("touchend",this.cancelTouchScale);}}else{window.addEventListener("mousemove",this.moveImg);window.addEventListener("mouseup",this.leaveImg);}this.$emit("imgMoving",{moving:true,axis:this.getImgAxis()});this.$emit("img-moving",{moving:true,axis:this.getImgAxis()});}else{this.cropping=true;window.addEventListener("mousemove",this.createCrop);window.addEventListener("mouseup",this.endCrop);window.addEventListener("touchmove",this.createCrop);window.addEventListener("touchend",this.endCrop);this.cropOffsertX=e.offsetX?e.offsetX:e.touches[0].pageX-this.$refs.cropper.offsetLeft;this.cropOffsertY=e.offsetY?e.offsetY:e.touches[0].pageY-this.$refs.cropper.offsetTop;this.cropX="clientX"in e?e.clientX:e.touches[0].clientX;this.cropY="clientY"in e?e.clientY:e.touches[0].clientY;this.cropChangeX=this.cropOffsertX;this.cropChangeY=this.cropOffsertY;this.cropW=0;this.cropH=0;}},touchScale:function touchScale(e){var _this3=this;e.preventDefault();var scale=this.scale;var oldTouch1={x:this.touches[0].clientX,y:this.touches[0].clientY};var newTouch1={x:e.touches[0].clientX,y:e.touches[0].clientY};var oldTouch2={x:this.touches[1].clientX,y:this.touches[1].clientY};var newTouch2={x:e.touches[1].clientX,y:e.touches[1].clientY};var oldL=Math.sqrt(Math.pow(oldTouch1.x-oldTouch2.x,2)+Math.pow(oldTouch1.y-oldTouch2.y,2));var newL=Math.sqrt(Math.pow(newTouch1.x-newTouch2.x,2)+Math.pow(newTouch1.y-newTouch2.y,2));var cha=newL-oldL;var coe=1;coe=coe/this.trueWidth>coe/this.trueHeight?coe/this.trueHeight:coe/this.trueWidth;coe=coe>0.1?0.1:coe;var num=coe*cha;if(!this.touchNow){this.touchNow=true;if(cha>0){scale+=Math.abs(num);}else if(cha<0){scale>Math.abs(num)?scale-=Math.abs(num):scale;}this.touches=e.touches;setTimeout(function(){_this3.touchNow=false;},8);if(!this.checkoutImgAxis(this.x,this.y,scale)){return false;}this.scale=scale;}},cancelTouchScale:function cancelTouchScale(e){window.removeEventListener("touchmove",this.touchScale);},moveImg:function moveImg(e){var _this4=this;e.preventDefault();if(e.touches&&e.touches.length===2){this.touches=e.touches;window.addEventListener("touchmove",this.touchScale);window.addEventListener("touchend",this.cancelTouchScale);window.removeEventListener("touchmove",this.moveImg);return false;}var nowX="clientX"in e?e.clientX:e.touches[0].clientX;var nowY="clientY"in e?e.clientY:e.touches[0].clientY;var changeX,changeY;changeX=nowX-this.moveX;changeY=nowY-this.moveY;this.$nextTick(function(){if(_this4.centerBox){var axis=_this4.getImgAxis(changeX,changeY,_this4.scale);var cropAxis=_this4.getCropAxis();var imgW=_this4.trueHeight*_this4.scale;var imgH=_this4.trueWidth*_this4.scale;var maxLeft,maxTop,maxRight,maxBottom;switch(_this4.rotate){case 1:case-1:case 3:case-3:maxLeft=_this4.cropOffsertX-_this4.trueWidth*(1-_this4.scale)/2+(imgW-imgH)/2;maxTop=_this4.cropOffsertY-_this4.trueHeight*(1-_this4.scale)/2+(imgH-imgW)/2;maxRight=maxLeft-imgW+_this4.cropW;maxBottom=maxTop-imgH+_this4.cropH;break;default:maxLeft=_this4.cropOffsertX-_this4.trueWidth*(1-_this4.scale)/2;maxTop=_this4.cropOffsertY-_this4.trueHeight*(1-_this4.scale)/2;maxRight=maxLeft-imgH+_this4.cropW;maxBottom=maxTop-imgW+_this4.cropH;break;}if(axis.x1>=cropAxis.x1){changeX=maxLeft;}if(axis.y1>=cropAxis.y1){changeY=maxTop;}if(axis.x2<=cropAxis.x2){changeX=maxRight;}if(axis.y2<=cropAxis.y2){changeY=maxBottom;}}_this4.x=changeX;_this4.y=changeY;_this4.$emit("imgMoving",{moving:true,axis:_this4.getImgAxis()});_this4.$emit("img-moving",{moving:true,axis:_this4.getImgAxis()});});},leaveImg:function leaveImg(e){window.removeEventListener("mousemove",this.moveImg);window.removeEventListener("touchmove",this.moveImg);window.removeEventListener("mouseup",this.leaveImg);window.removeEventListener("touchend",this.leaveImg);this.$emit("imgMoving",{moving:false,axis:this.getImgAxis()});this.$emit("img-moving",{moving:false,axis:this.getImgAxis()});},scaleImg:function scaleImg(){if(this.canScale){window.addEventListener(this.support,this.changeSize,this.passive);}},cancelScale:function cancelScale(){if(this.canScale){window.removeEventListener(this.support,this.changeSize);}},changeSize:function changeSize(e){var _this5=this;e.preventDefault();var scale=this.scale;var change=e.deltaY||e.wheelDelta;var isFirefox=navigator.userAgent.indexOf("Firefox");change=isFirefox>0?change*30:change;if(this.isIE){change=-change;}var coe=this.coe;coe=coe/this.trueWidth>coe/this.trueHeight?coe/this.trueHeight:coe/this.trueWidth;var num=coe*change;num<0?scale+=Math.abs(num):scale>Math.abs(num)?scale-=Math.abs(num):scale;var status=num<0?"add":"reduce";if(status!==this.coeStatus){this.coeStatus=status;this.coe=0.2;}if(!this.scaling){this.scalingSet=setTimeout(function(){_this5.scaling=false;_this5.coe=_this5.coe+=0.01;},50);}this.scaling=true;if(!this.checkoutImgAxis(this.x,this.y,scale)){return false;}this.scale=scale;},changeScale:function changeScale(num){var scale=this.scale;num=num||1;var coe=20;coe=coe/this.trueWidth>coe/this.trueHeight?coe/this.trueHeight:coe/this.trueWidth;num=num*coe;num>0?scale+=Math.abs(num):scale>Math.abs(num)?scale-=Math.abs(num):scale;if(!this.checkoutImgAxis(this.x,this.y,scale)){return false;}this.scale=scale;},createCrop:function createCrop(e){var _this6=this;e.preventDefault();var nowX="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0;var nowY="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;this.$nextTick(function(){var fw=nowX-_this6.cropX;var fh=nowY-_this6.cropY;if(fw>0){_this6.cropW=fw+_this6.cropChangeX>_this6.w?_this6.w-_this6.cropChangeX:fw;_this6.cropOffsertX=_this6.cropChangeX;}else{_this6.cropW=_this6.w-_this6.cropChangeX+Math.abs(fw)>_this6.w?_this6.cropChangeX:Math.abs(fw);_this6.cropOffsertX=_this6.cropChangeX+fw>0?_this6.cropChangeX+fw:0;}if(!_this6.fixed){if(fh>0){_this6.cropH=fh+_this6.cropChangeY>_this6.h?_this6.h-_this6.cropChangeY:fh;_this6.cropOffsertY=_this6.cropChangeY;}else{_this6.cropH=_this6.h-_this6.cropChangeY+Math.abs(fh)>_this6.h?_this6.cropChangeY:Math.abs(fh);_this6.cropOffsertY=_this6.cropChangeY+fh>0?_this6.cropChangeY+fh:0;}}else{var fixedHeight=_this6.cropW/_this6.fixedNumber[0]*_this6.fixedNumber[1];if(fixedHeight+_this6.cropOffsertY>_this6.h){_this6.cropH=_this6.h-_this6.cropOffsertY;_this6.cropW=_this6.cropH/_this6.fixedNumber[1]*_this6.fixedNumber[0];if(fw>0){_this6.cropOffsertX=_this6.cropChangeX;}else{_this6.cropOffsertX=_this6.cropChangeX-_this6.cropW;}}else{_this6.cropH=fixedHeight;}_this6.cropOffsertY=_this6.cropOffsertY;}});},changeCropSize:function changeCropSize(e,w,h,typeW,typeH){e.preventDefault();window.addEventListener("mousemove",this.changeCropNow);window.addEventListener("mouseup",this.changeCropEnd);window.addEventListener("touchmove",this.changeCropNow);window.addEventListener("touchend",this.changeCropEnd);this.canChangeX=w;this.canChangeY=h;this.changeCropTypeX=typeW;this.changeCropTypeY=typeH;this.cropX="clientX"in e?e.clientX:e.touches[0].clientX;this.cropY="clientY"in e?e.clientY:e.touches[0].clientY;this.cropOldW=this.cropW;this.cropOldH=this.cropH;this.cropChangeX=this.cropOffsertX;this.cropChangeY=this.cropOffsertY;if(this.fixed){if(this.canChangeX&&this.canChangeY){this.canChangeY=0;}}this.$emit("change-crop-size",{width:this.cropW,height:this.cropH});},changeCropNow:function changeCropNow(e){var _this7=this;e.preventDefault();var nowX="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0;var nowY="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;var wrapperW=this.w;var wrapperH=this.h;var minX=0;var minY=0;if(this.centerBox){var axis=this.getImgAxis();var imgW=axis.x2;var imgH=axis.y2;minX=axis.x1>0?axis.x1:0;minY=axis.y1>0?axis.y1:0;if(wrapperW>imgW){wrapperW=imgW;}if(wrapperH>imgH){wrapperH=imgH;}}this.$nextTick(function(){var fw=nowX-_this7.cropX;var fh=nowY-_this7.cropY;if(_this7.canChangeX){if(_this7.changeCropTypeX===1){if(_this7.cropOldW-fw>0){_this7.cropW=wrapperW-_this7.cropChangeX-fw<=wrapperW-minX?_this7.cropOldW-fw:_this7.cropOldW+_this7.cropChangeX-minX;_this7.cropOffsertX=wrapperW-_this7.cropChangeX-fw<=wrapperW-minX?_this7.cropChangeX+fw:minX;}else{_this7.cropW=Math.abs(fw)+_this7.cropChangeX<=wrapperW?Math.abs(fw)-_this7.cropOldW:wrapperW-_this7.cropOldW-_this7.cropChangeX;_this7.cropOffsertX=_this7.cropChangeX+_this7.cropOldW;}}else if(_this7.changeCropTypeX===2){if(_this7.cropOldW+fw>0){_this7.cropW=_this7.cropOldW+fw+_this7.cropOffsertX<=wrapperW?_this7.cropOldW+fw:wrapperW-_this7.cropOffsertX;_this7.cropOffsertX=_this7.cropChangeX;}else{_this7.cropW=wrapperW-_this7.cropChangeX+Math.abs(fw+_this7.cropOldW)<=wrapperW-minX?Math.abs(fw+_this7.cropOldW):_this7.cropChangeX-minX;_this7.cropOffsertX=wrapperW-_this7.cropChangeX+Math.abs(fw+_this7.cropOldW)<=wrapperW-minX?_this7.cropChangeX-Math.abs(fw+_this7.cropOldW):minX;}}}if(_this7.canChangeY){if(_this7.changeCropTypeY===1){if(_this7.cropOldH-fh>0){_this7.cropH=wrapperH-_this7.cropChangeY-fh<=wrapperH-minY?_this7.cropOldH-fh:_this7.cropOldH+_this7.cropChangeY-minY;_this7.cropOffsertY=wrapperH-_this7.cropChangeY-fh<=wrapperH-minY?_this7.cropChangeY+fh:minY;}else{_this7.cropH=Math.abs(fh)+_this7.cropChangeY<=wrapperH?Math.abs(fh)-_this7.cropOldH:wrapperH-_this7.cropOldH-_this7.cropChangeY;_this7.cropOffsertY=_this7.cropChangeY+_this7.cropOldH;}}else if(_this7.changeCropTypeY===2){if(_this7.cropOldH+fh>0){_this7.cropH=_this7.cropOldH+fh+_this7.cropOffsertY<=wrapperH?_this7.cropOldH+fh:wrapperH-_this7.cropOffsertY;_this7.cropOffsertY=_this7.cropChangeY;}else{_this7.cropH=wrapperH-_this7.cropChangeY+Math.abs(fh+_this7.cropOldH)<=wrapperH-minY?Math.abs(fh+_this7.cropOldH):_this7.cropChangeY-minY;_this7.cropOffsertY=wrapperH-_this7.cropChangeY+Math.abs(fh+_this7.cropOldH)<=wrapperH-minY?_this7.cropChangeY-Math.abs(fh+_this7.cropOldH):minY;}}}if(_this7.canChangeX&&_this7.fixed){var fixedHeight=_this7.cropW/_this7.fixedNumber[0]*_this7.fixedNumber[1];if(fixedHeight+_this7.cropOffsertY>wrapperH){_this7.cropH=wrapperH-_this7.cropOffsertY;_this7.cropW=_this7.cropH/_this7.fixedNumber[1]*_this7.fixedNumber[0];}else{_this7.cropH=fixedHeight;}}if(_this7.canChangeY&&_this7.fixed){var fixedWidth=_this7.cropH/_this7.fixedNumber[1]*_this7.fixedNumber[0];if(fixedWidth+_this7.cropOffsertX>wrapperW){_this7.cropW=wrapperW-_this7.cropOffsertX;_this7.cropH=_this7.cropW/_this7.fixedNumber[0]*_this7.fixedNumber[1];}else{_this7.cropW=fixedWidth;}}});},checkCropLimitSize:function checkCropLimitSize(){var cropW=this.cropW,cropH=this.cropH,limitMinSize=this.limitMinSize;var limitMinNum=new Array();if(!Array.isArray[limitMinSize]){limitMinNum=[limitMinSize,limitMinSize];}else{limitMinNum=limitMinSize;}cropW=parseFloat(limitMinNum[0]);cropH=parseFloat(limitMinNum[1]);return[cropW,cropH];},changeCropEnd:function changeCropEnd(e){window.removeEventListener("mousemove",this.changeCropNow);window.removeEventListener("mouseup",this.changeCropEnd);window.removeEventListener("touchmove",this.changeCropNow);window.removeEventListener("touchend",this.changeCropEnd);},endCrop:function endCrop(){if(this.cropW===0&&this.cropH===0){this.cropping=false;}window.removeEventListener("mousemove",this.createCrop);window.removeEventListener("mouseup",this.endCrop);window.removeEventListener("touchmove",this.createCrop);window.removeEventListener("touchend",this.endCrop);},startCrop:function startCrop(){this.crop=true;},stopCrop:function stopCrop(){this.crop=false;},clearCrop:function clearCrop(){this.cropping=false;this.cropW=0;this.cropH=0;},cropMove:function cropMove(e){e.preventDefault();if(!this.canMoveBox){this.crop=false;this.startMove(e);return false;}if(e.touches&&e.touches.length===2){this.crop=false;this.startMove(e);this.leaveCrop();return false;}window.addEventListener("mousemove",this.moveCrop);window.addEventListener("mouseup",this.leaveCrop);window.addEventListener("touchmove",this.moveCrop);window.addEventListener("touchend",this.leaveCrop);var x="clientX"in e?e.clientX:e.touches[0].clientX;var y="clientY"in e?e.clientY:e.touches[0].clientY;var newX,newY;newX=x-this.cropOffsertX;newY=y-this.cropOffsertY;this.cropX=newX;this.cropY=newY;this.$emit("cropMoving",{moving:true,axis:this.getCropAxis()});this.$emit("crop-moving",{moving:true,axis:this.getCropAxis()});},moveCrop:function moveCrop(e,isMove){var _this8=this;var nowX=0;var nowY=0;if(e){e.preventDefault();nowX="clientX"in e?e.clientX:e.touches[0].clientX;nowY="clientY"in e?e.clientY:e.touches[0].clientY;}this.$nextTick(function(){var cx,cy;var fw=nowX-_this8.cropX;var fh=nowY-_this8.cropY;if(isMove){fw=_this8.cropOffsertX;fh=_this8.cropOffsertY;}if(fw<=0){cx=0;}else if(fw+_this8.cropW>_this8.w){cx=_this8.w-_this8.cropW;}else{cx=fw;}if(fh<=0){cy=0;}else if(fh+_this8.cropH>_this8.h){cy=_this8.h-_this8.cropH;}else{cy=fh;}if(_this8.centerBox){var axis=_this8.getImgAxis();if(cx<=axis.x1){cx=axis.x1;}if(cx+_this8.cropW>axis.x2){cx=axis.x2-_this8.cropW;}if(cy<=axis.y1){cy=axis.y1;}if(cy+_this8.cropH>axis.y2){cy=axis.y2-_this8.cropH;}}_this8.cropOffsertX=cx;_this8.cropOffsertY=cy;_this8.$emit("cropMoving",{moving:true,axis:_this8.getCropAxis()});_this8.$emit("crop-moving",{moving:true,axis:_this8.getCropAxis()});});},getImgAxis:function getImgAxis(x,y,scale){x=x||this.x;y=y||this.y;scale=scale||this.scale;var obj={x1:0,x2:0,y1:0,y2:0};var imgW=this.trueWidth*scale;var imgH=this.trueHeight*scale;switch(this.rotate){case 0:obj.x1=x+this.trueWidth*(1-scale)/2;obj.x2=obj.x1+this.trueWidth*scale;obj.y1=y+this.trueHeight*(1-scale)/2;obj.y2=obj.y1+this.trueHeight*scale;break;case 1:case-1:case 3:case-3:obj.x1=x+this.trueWidth*(1-scale)/2+(imgW-imgH)/2;obj.x2=obj.x1+this.trueHeight*scale;obj.y1=y+this.trueHeight*(1-scale)/2+(imgH-imgW)/2;obj.y2=obj.y1+this.trueWidth*scale;break;default:obj.x1=x+this.trueWidth*(1-scale)/2;obj.x2=obj.x1+this.trueWidth*scale;obj.y1=y+this.trueHeight*(1-scale)/2;obj.y2=obj.y1+this.trueHeight*scale;break;}return obj;},getCropAxis:function getCropAxis(){var obj={x1:0,x2:0,y1:0,y2:0};obj.x1=this.cropOffsertX;obj.x2=obj.x1+this.cropW;obj.y1=this.cropOffsertY;obj.y2=obj.y1+this.cropH;return obj;},leaveCrop:function leaveCrop(e){window.removeEventListener("mousemove",this.moveCrop);window.removeEventListener("mouseup",this.leaveCrop);window.removeEventListener("touchmove",this.moveCrop);window.removeEventListener("touchend",this.leaveCrop);this.$emit("cropMoving",{moving:false,axis:this.getCropAxis()});this.$emit("crop-moving",{moving:false,axis:this.getCropAxis()});},getCropChecked:function getCropChecked(cb){var _this9=this;var canvas=document.createElement("canvas");var img=new Image();var rotate=this.rotate;var trueWidth=this.trueWidth;var trueHeight=this.trueHeight;var cropOffsertX=this.cropOffsertX;var cropOffsertY=this.cropOffsertY;img.onload=function(){if(_this9.cropW!==0){var ctx=canvas.getContext("2d");var dpr=1;if(_this9.high&!_this9.full){dpr=window.devicePixelRatio;}if(_this9.enlarge!==1&!_this9.full){dpr=Math.abs(Number(_this9.enlarge));}var width=_this9.cropW*dpr;var height=_this9.cropH*dpr;var imgW=trueWidth*_this9.scale*dpr;var imgH=trueHeight*_this9.scale*dpr;var dx=(_this9.x-cropOffsertX+_this9.trueWidth*(1-_this9.scale)/2)*dpr;var dy=(_this9.y-cropOffsertY+_this9.trueHeight*(1-_this9.scale)/2)*dpr;setCanvasSize(width,height);ctx.save();switch(rotate){case 0:if(!_this9.full){ctx.drawImage(img,dx,dy,imgW,imgH);}else{setCanvasSize(width/_this9.scale,height/_this9.scale);ctx.drawImage(img,dx/_this9.scale,dy/_this9.scale,imgW/_this9.scale,imgH/_this9.scale);}break;case 1:case-3:if(!_this9.full){dx=dx+(imgW-imgH)/2;dy=dy+(imgH-imgW)/2;ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,dy,-dx-imgH,imgW,imgH);}else{setCanvasSize(width/_this9.scale,height/_this9.scale);dx=dx/_this9.scale+(imgW/_this9.scale-imgH/_this9.scale)/2;dy=dy/_this9.scale+(imgH/_this9.scale-imgW/_this9.scale)/2;ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,dy,-dx-imgH/_this9.scale,imgW/_this9.scale,imgH/_this9.scale);}break;case 2:case-2:if(!_this9.full){ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,-dx-imgW,-dy-imgH,imgW,imgH);}else{setCanvasSize(width/_this9.scale,height/_this9.scale);ctx.rotate(rotate*90*Math.PI/180);dx=dx/_this9.scale;dy=dy/_this9.scale;ctx.drawImage(img,-dx-imgW/_this9.scale,-dy-imgH/_this9.scale,imgW/_this9.scale,imgH/_this9.scale);}break;case 3:case-1:if(!_this9.full){dx=dx+(imgW-imgH)/2;dy=dy+(imgH-imgW)/2;ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,-dy-imgW,dx,imgW,imgH);}else{setCanvasSize(width/_this9.scale,height/_this9.scale);dx=dx/_this9.scale+(imgW/_this9.scale-imgH/_this9.scale)/2;dy=dy/_this9.scale+(imgH/_this9.scale-imgW/_this9.scale)/2;ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,-dy-imgW/_this9.scale,dx,imgW/_this9.scale,imgH/_this9.scale);}break;default:if(!_this9.full){ctx.drawImage(img,dx,dy,imgW,imgH);}else{setCanvasSize(width/_this9.scale,height/_this9.scale);ctx.drawImage(img,dx/_this9.scale,dy/_this9.scale,imgW/_this9.scale,imgH/_this9.scale);}}ctx.restore();}else{var _width=trueWidth*_this9.scale;var _height=trueHeight*_this9.scale;var _ctx2=canvas.getContext("2d");_ctx2.save();switch(rotate){case 0:setCanvasSize(_width,_height);_ctx2.drawImage(img,0,0,_width,_height);break;case 1:case-3:setCanvasSize(_height,_width);_ctx2.rotate(rotate*90*Math.PI/180);_ctx2.drawImage(img,0,-_height,_width,_height);break;case 2:case-2:setCanvasSize(_width,_height);_ctx2.rotate(rotate*90*Math.PI/180);_ctx2.drawImage(img,-_width,-_height,_width,_height);break;case 3:case-1:setCanvasSize(_height,_width);_ctx2.rotate(rotate*90*Math.PI/180);_ctx2.drawImage(img,-_width,0,_width,_height);break;default:setCanvasSize(_width,_height);_ctx2.drawImage(img,0,0,_width,_height);}_ctx2.restore();}cb(canvas);};var s=this.img.substr(0,4);if(s!=="data"){img.crossOrigin="Anonymous";}img.src=this.imgs;function setCanvasSize(width,height){canvas.width=Math.round(width);canvas.height=Math.round(height);}},getCropData:function getCropData(cb){var _this10=this;this.getCropChecked(function(data){cb(data.toDataURL("image/"+_this10.outputType,_this10.outputSize));});},getCropBlob:function getCropBlob(cb){var _this11=this;this.getCropChecked(function(data){data.toBlob(function(blob){return cb(blob);},"image/"+_this11.outputType,_this11.outputSize);});},showPreview:function showPreview(){var _this12=this;if(this.isCanShow){this.isCanShow=false;setTimeout(function(){_this12.isCanShow=true;},16);}else{return false;}var w=this.cropW;var h=this.cropH;var scale=this.scale;var obj={};obj.div={width:"".concat(w,"px"),height:"".concat(h,"px")};var transformX=(this.x-this.cropOffsertX)/scale;var transformY=(this.y-this.cropOffsertY)/scale;var transformZ=0;obj.w=w;obj.h=h;obj.url=this.imgs;obj.img={width:"".concat(this.trueWidth,"px"),height:"".concat(this.trueHeight,"px"),transform:"scale(".concat(scale,")translate3d(").concat(transformX,"px, ").concat(transformY,"px, ").concat(transformZ,"px)rotateZ(").concat(this.rotate*90,"deg)")};obj.html="\n
\n
\n \n
\n
");this.$emit("realTime",obj);this.$emit("real-time",obj);},reload:function reload(){var _this13=this;var img=new Image();img.onload=function(){_this13.w=parseFloat(window.getComputedStyle(_this13.$refs.cropper).width);_this13.h=parseFloat(window.getComputedStyle(_this13.$refs.cropper).height);_this13.trueWidth=img.width;_this13.trueHeight=img.height;if(!_this13.original){_this13.scale=_this13.checkedMode();}else{_this13.scale=1;}_this13.$nextTick(function(){_this13.x=-(_this13.trueWidth-_this13.trueWidth*_this13.scale)/2+(_this13.w-_this13.trueWidth*_this13.scale)/2;_this13.y=-(_this13.trueHeight-_this13.trueHeight*_this13.scale)/2+(_this13.h-_this13.trueHeight*_this13.scale)/2;_this13.loading=false;if(_this13.autoCrop){_this13.goAutoCrop();}_this13.$emit("img-load","success");_this13.$emit("imgLoad","success");setTimeout(function(){_this13.showPreview();},20);});};img.onerror=function(){_this13.$emit("imgLoad","error");_this13.$emit("img-load","error");};img.src=this.imgs;},checkedMode:function checkedMode(){var scale=1;var imgW=this.trueWidth;var imgH=this.trueHeight;var arr=this.mode.split(" ");switch(arr[0]){case"contain":if(this.trueWidth>this.w){scale=this.w/this.trueWidth;}if(this.trueHeight*scale>this.h){scale=this.h/this.trueHeight;}break;case"cover":imgW=this.w;scale=imgW/this.trueWidth;imgH=imgH*scale;if(imgH0;var imgW=(switchWH?this.trueHeight:this.trueWidth)*this.scale;var imgH=(switchWH?this.trueWidth:this.trueHeight)*this.scale;maxWidth=imgWmaxWidth?maxWidth:w;h=h>maxHeight?maxHeight:h;if(this.fixed){h=w/this.fixedNumber[0]*this.fixedNumber[1];}if(h>this.h){h=this.h;w=h/this.fixedNumber[1]*this.fixedNumber[0];}this.changeCrop(w,h);},changeCrop:function changeCrop(w,h){var _this14=this;if(this.centerBox){var axis=this.getImgAxis();if(w>axis.x2-axis.x1){w=axis.x2-axis.x1;h=w/this.fixedNumber[0]*this.fixedNumber[1];}if(h>axis.y2-axis.y1){h=axis.y2-axis.y1;w=h/this.fixedNumber[1]*this.fixedNumber[0];}}this.cropW=w;this.cropH=h;this.checkCropLimitSize();this.$nextTick(function(){_this14.cropOffsertX=(_this14.w-_this14.cropW)/2;_this14.cropOffsertY=(_this14.h-_this14.cropH)/2;if(_this14.centerBox){_this14.moveCrop(null,true);}});},refresh:function refresh(){var _this15=this;this.img;this.imgs="";this.scale=1;this.crop=false;this.rotate=0;this.w=0;this.h=0;this.trueWidth=0;this.trueHeight=0;this.clearCrop();this.$nextTick(function(){_this15.checkedImg();});},rotateLeft:function rotateLeft(){this.rotate=this.rotate<=-3?0:this.rotate-1;},rotateRight:function rotateRight(){this.rotate=this.rotate>=3?0:this.rotate+1;},rotateClear:function rotateClear(){this.rotate=0;},checkoutImgAxis:function checkoutImgAxis(x,y,scale){x=x||this.x;y=y||this.y;scale=scale||this.scale;var canGo=true;if(this.centerBox){var axis=this.getImgAxis(x,y,scale);var cropAxis=this.getCropAxis();if(axis.x1>=cropAxis.x1){canGo=false;}if(axis.x2<=cropAxis.x2){canGo=false;}if(axis.y1>=cropAxis.y1){canGo=false;}if(axis.y2<=cropAxis.y2){canGo=false;}}return canGo;}},mounted:function mounted(){this.support="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll";var that=this;var u=navigator.userAgent;this.isIOS=!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);if(!HTMLCanvasElement.prototype.toBlob){Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function value(callback,type,quality){var binStr=atob(this.toDataURL(type,quality).split(",")[1]),len=binStr.length,arr=new Uint8Array(len);for(var i=0;i