index.596585c1.js 51 KB

1234567
  1. import{d as M,b as m,v as st,F as U,m as W,L as V,u as rt,I as Y,w as ot,x as at,y as nt,B as ht,f as lt,P as ct,z as k,A as R,G as D,H as O,J as T,K as j,M as pt,N as P,o as F,T as ut,O as ft,U as dt}from"./vendor.14dbc21a.js";/* empty css *//* empty css */import{C as gt}from"./index.022a3a6b.js";/* empty css */import{r as q}from"./main.abf8ca27.js";var L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAilJREFUSEu1lc9rE1EQx7+zMTSFFCUWom1sF5Q0mDTqKbb2kpsX8aTUS29tse1FelLRg4IHL0XBv8ESD6JevAViNNZfYMRmRaE/QKFNqG02JJtsuk/eKwlJzOaHNnt8b+Yzs/OdmUcw+bxvQg4wY5wk6TyAUwQ4uSkDNgB8ZobxEiQtfh29vFUPQbWHcjhs6+lO3WAGu0YEu1lgEYQhQxItqLnee6vBoFZpWwX2xB7LVhx4BjB/I+DfdxTXUbyojFxZLd2VwXtQSxRAf3vQsvVPHbtjJbgAi9+3pZbaz7Q2BYqrWm+Al0WAh98+uQPGbv1jptVuRHe/nL10m7j6BKw1E6rVoFxQBgyS9/XijCRJj1p1rLQ7bT+MzUIOvwrZKnfDMGbJFws9J+BCu+Bx53Fcl89gaWcTU0qkyp0BLzh4jYCBdsATR9yYH/RDM3Yx9y2K9+lkLXidhmMh3thdteD5AT9cNjtu/niHrFEsX0/2eTB3zCfOZpUoPqmpejnlTcEP3KMIOvrxMZ3EjBJFjoNcXky7TkItFnBVeYV4pu4080B501J0SxY8HDqHwEEnPqSTWM78xkSfG9t6HtOJCBLZbdPqMWC9oXhdZMHC0AjGDh0VkC1dw+RyBN9zOw0lEeI1azcrSbh/IgCf3YGpRAQrmtpUZ9FurQ4IH1HWFLm38cSAdGykO7qEONwTeypboe/v2iyVriOLvgSXV8K2no19fpoqRf/fx/QP4JsHStReaXAAAAAASUVORK5CYII=",oe=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:L}),z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAS1JREFUSEu11aFKREEUxvHfFIPJYrEJCoJFBINr0qTBZvEJBEG7wWTwAQTBJ7DYDJo0qUEQiyAoCAaLxWSwjBy5V9Z1l1127504853/zJw555ukw8g5j2IdK5jEUCH9whPOcJxSem+HSK2TOedh7BbQezzgo0U3gmnMBBx7KaXPZs0fcM55Aid4wQ1ypxsV8xE/j3GspZSeS/0vuICe4xRvXYCty2NYxXIJ/wEX17/GZR/QcpOAL6IRaSnB+5hCwAcZDTymlHZS8fq3OOwhp902jYNuYi7A21jCVbeoHtcXcBHgqMe7NiXVI+efLEpxNsBRIkf9UjrEbQT4FQcVg7dqBdeWitoer7ZyC3usvkEKr6i+pWs1oQIeXlytbZbNUYvRN8Gr/5qa23rQz/Qb9Z6P6bQiKtgAAAAASUVORK5CYII=",ae=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:z}),mt={"col-field-group":"_col-field-group_1vk7j_1"},ne=M({name:"ColFieldGroup",render(){return m("div",{class:mt["col-field-group"]},[this.$slots.default&&this.$slots.default()])}});const vt="_subjects_1ijt0_1",wt="_title_1ijt0_4",yt="_topBg_1ijt0_43",Ct="_checkbox_1ijt0_51",bt="_name_1ijt0_56";var I={subjects:vt,title:wt,"btn-group":"_btn-group_1ijt0_19","subject-list":"_subject-list_1ijt0_26","subject-item":"_subject-item_1ijt0_31",topBg:yt,checkbox:Ct,name:bt};function J(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!ot(t)}var he=M({name:"SubjectList",props:{onChoice:{type:Function,default:t=>{}},choiceSubjectIds:{type:Array,default:[]},subjectList:{type:Array,default:[]},max:{type:Number,default:5},selectType:{type:String,default:"Checkbox"}},data(){return{checkBox:[],checkboxRefs:[],radio:null}},async mounted(){this.checkBox=this.choiceSubjectIds},methods:{onSelect(t){this.selectType==="Checkbox"?this.checkboxRefs[t].toggle():this.selectType==="Radio"&&(this.radio=t)}},render(){let t,e;return m("div",{class:I.subjects},[this.subjectList.length?this.selectType==="Checkbox"?m(st,{modelValue:this.checkBox,"onUpdate:modelValue":i=>this.checkBox=i,max:this.max},J(t=this.subjectList.map(i=>i.subjects&&i.subjects.length>0?m(U,null,[m("div",{class:I.title},[i.name]),m("div",{class:I["subject-list"]},[i.subjects&&i.subjects.map(s=>m("div",{class:I["subject-item"],onClick:()=>this.onSelect(s.id)},[m(W,{src:s.img,width:"100%",height:"100%",fit:"cover"},{loading:()=>m(V,{type:"spinner",size:20},null)}),m("div",{class:I.topBg},[m(rt,{name:s.id,class:I.checkbox,ref:r=>this.checkboxRefs[s.id]=r},{icon:r=>m(Y,{name:r.checked?L:z,size:"22"},null)}),m("p",{class:I.name},[s.name])])]))])]):null))?t:{default:()=>[t]}):m(at,{modelValue:this.radio,"onUpdate:modelValue":i=>this.radio=i},J(e=this.subjectList.map(i=>i.subjects&&i.subjects.length>0?m(U,null,[m("div",{class:I.title},[i.name]),m("div",{class:I["subject-list"]},[i.subjects&&i.subjects.map(s=>m("div",{class:I["subject-item"],onClick:()=>this.onSelect(s.id)},[m(W,{src:s.img,width:"100%",height:"100%",fit:"cover"},{loading:()=>m(V,{type:"spinner",size:20},null)}),m("div",{class:I.topBg},[m(nt,{name:s.id,class:I.checkbox},{icon:r=>m(Y,{name:r.checked?L:z,size:"22"},null)}),m("p",{class:I.name},[s.name])])]))])]):null))?e:{default:()=>[e]}):m(gt,{tips:"\u6682\u65E0\u58F0\u90E8\u6570\u636E",btnStatus:!1},null),m("div",{class:I["btn-group"]},[m(ht,{round:!0,block:!0,type:"primary",onClick:()=>this.onChoice(this.selectType==="Checkbox"?this.checkBox:this.radio)},{default:()=>[lt("\u786E\u5B9A")]})])])}}),Q={},xt=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Z="%[a-f0-9]{2}",G=new RegExp(Z,"gi"),K=new RegExp("("+Z+")+","gi");function $(t,e){try{return decodeURIComponent(t.join(""))}catch{}if(t.length===1)return t;e=e||1;var i=t.slice(0,e),s=t.slice(e);return Array.prototype.concat.call([],$(i),$(s))}function At(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(G),i=1;i<e.length;i++)t=$(e,i).join(""),e=t.match(G);return t}}function St(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},i=K.exec(t);i;){try{e[i[0]]=decodeURIComponent(i[0])}catch{var s=At(i[0]);s!==i[0]&&(e[i[0]]=s)}i=K.exec(t)}e["%C2"]="\uFFFD";for(var r=Object.keys(e),o=0;o<r.length;o++){var a=r[o];t=t.replace(new RegExp(a,"g"),e[a])}return t}var Ot=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return St(t)}},It=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const i=t.indexOf(e);return i===-1?[t]:[t.slice(0,i),t.slice(i+e.length)]},Et=function(t,e){for(var i={},s=Object.keys(t),r=Array.isArray(e),o=0;o<s.length;o++){var a=s[o],u=t[a];(r?e.indexOf(a)!==-1:e(a,u,t))&&(i[a]=u)}return i};(function(t){const e=xt,i=Ot,s=It,r=Et,o=n=>n==null,a=Symbol("encodeFragmentIdentifier");function u(n){switch(n.arrayFormat){case"index":return h=>(p,c)=>{const f=p.length;return c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?p:c===null?[...p,[l(h,n),"[",f,"]"].join("")]:[...p,[l(h,n),"[",l(f,n),"]=",l(c,n)].join("")]};case"bracket":return h=>(p,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?p:c===null?[...p,[l(h,n),"[]"].join("")]:[...p,[l(h,n),"[]=",l(c,n)].join("")];case"colon-list-separator":return h=>(p,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?p:c===null?[...p,[l(h,n),":list="].join("")]:[...p,[l(h,n),":list=",l(c,n)].join("")];case"comma":case"separator":case"bracket-separator":{const h=n.arrayFormat==="bracket-separator"?"[]=":"=";return p=>(c,f)=>f===void 0||n.skipNull&&f===null||n.skipEmptyString&&f===""?c:(f=f===null?"":f,c.length===0?[[l(p,n),h,l(f,n)].join("")]:[[c,l(f,n)].join(n.arrayFormatSeparator)])}default:return h=>(p,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?p:c===null?[...p,l(h,n)]:[...p,[l(h,n),"=",l(c,n)].join("")]}}function d(n){let h;switch(n.arrayFormat){case"index":return(p,c,f)=>{if(h=/\[(\d*)\]$/.exec(p),p=p.replace(/\[\d*\]$/,""),!h){f[p]=c;return}f[p]===void 0&&(f[p]={}),f[p][h[1]]=c};case"bracket":return(p,c,f)=>{if(h=/(\[\])$/.exec(p),p=p.replace(/\[\]$/,""),!h){f[p]=c;return}if(f[p]===void 0){f[p]=[c];return}f[p]=[].concat(f[p],c)};case"colon-list-separator":return(p,c,f)=>{if(h=/(:list)$/.exec(p),p=p.replace(/:list$/,""),!h){f[p]=c;return}if(f[p]===void 0){f[p]=[c];return}f[p]=[].concat(f[p],c)};case"comma":case"separator":return(p,c,f)=>{const C=typeof c=="string"&&c.includes(n.arrayFormatSeparator),w=typeof c=="string"&&!C&&g(c,n).includes(n.arrayFormatSeparator);c=w?g(c,n):c;const E=C||w?c.split(n.arrayFormatSeparator).map(it=>g(it,n)):c===null?c:g(c,n);f[p]=E};case"bracket-separator":return(p,c,f)=>{const C=/(\[\])$/.test(p);if(p=p.replace(/\[\]$/,""),!C){f[p]=c&&g(c,n);return}const w=c===null?[]:c.split(n.arrayFormatSeparator).map(E=>g(E,n));if(f[p]===void 0){f[p]=w;return}f[p]=[].concat(f[p],w)};default:return(p,c,f)=>{if(f[p]===void 0){f[p]=c;return}f[p]=[].concat(f[p],c)}}}function v(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function l(n,h){return h.encode?h.strict?e(n):encodeURIComponent(n):n}function g(n,h){return h.decode?i(n):n}function y(n){return Array.isArray(n)?n.sort():typeof n=="object"?y(Object.keys(n)).sort((h,p)=>Number(h)-Number(p)).map(h=>n[h]):n}function H(n){const h=n.indexOf("#");return h!==-1&&(n=n.slice(0,h)),n}function x(n){let h="";const p=n.indexOf("#");return p!==-1&&(h=n.slice(p)),h}function b(n){n=H(n);const h=n.indexOf("?");return h===-1?"":n.slice(h+1)}function A(n,h){return h.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):h.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function S(n,h){h=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},h),v(h.arrayFormatSeparator);const p=d(h),c=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return c;for(const f of n.split("&")){if(f==="")continue;let[C,w]=s(h.decode?f.replace(/\+/g," "):f,"=");w=w===void 0?null:["comma","separator","bracket-separator"].includes(h.arrayFormat)?w:g(w,h),p(g(C,h),w,c)}for(const f of Object.keys(c)){const C=c[f];if(typeof C=="object"&&C!==null)for(const w of Object.keys(C))C[w]=A(C[w],h);else c[f]=A(C,h)}return h.sort===!1?c:(h.sort===!0?Object.keys(c).sort():Object.keys(c).sort(h.sort)).reduce((f,C)=>{const w=c[C];return Boolean(w)&&typeof w=="object"&&!Array.isArray(w)?f[C]=y(w):f[C]=w,f},Object.create(null))}t.extract=b,t.parse=S,t.stringify=(n,h)=>{if(!n)return"";h=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},h),v(h.arrayFormatSeparator);const p=w=>h.skipNull&&o(n[w])||h.skipEmptyString&&n[w]==="",c=u(h),f={};for(const w of Object.keys(n))p(w)||(f[w]=n[w]);const C=Object.keys(f);return h.sort!==!1&&C.sort(h.sort),C.map(w=>{const E=n[w];return E===void 0?"":E===null?l(w,h):Array.isArray(E)?E.length===0&&h.arrayFormat==="bracket-separator"?l(w,h)+"[]":E.reduce(c(w),[]).join("&"):l(w,h)+"="+l(E,h)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,h)=>{h=Object.assign({decode:!0},h);const[p,c]=s(n,"#");return Object.assign({url:p.split("?")[0]||"",query:S(b(n),h)},h&&h.parseFragmentIdentifier&&c?{fragmentIdentifier:g(c,h)}:{})},t.stringifyUrl=(n,h)=>{h=Object.assign({encode:!0,strict:!0,[a]:!0},h);const p=H(n.url).split("?")[0]||"",c=t.extract(n.url),f=t.parse(c,{sort:!1}),C=Object.assign(f,n.query);let w=t.stringify(C,h);w&&(w=`?${w}`);let E=x(n.url);return n.fragmentIdentifier&&(E=`#${h[a]?l(n.fragmentIdentifier,h):n.fragmentIdentifier}`),`${p}${w}${E}`},t.pick=(n,h,p)=>{p=Object.assign({parseFragmentIdentifier:!0,[a]:!1},p);const{url:c,query:f,fragmentIdentifier:C}=t.parseUrl(n,p);return t.stringifyUrl({url:c,query:r(f,h),fragmentIdentifier:C},p)},t.exclude=(n,h,p)=>{const c=Array.isArray(h)?f=>!h.includes(f):(f,C)=>!h(f,C);return t.pick(n,c,p)}})(Q);var _=Q,le=M({name:"col-popup",props:{modelValue:{type:Boolean,default:!1}},data(){return{popupShow:!1}},watch:{modelValue(t){this.hashState()}},mounted(){window.addEventListener("hashchange",this.onHash,!1)},unmounted(){window.removeEventListener("hashchange",this.onHash,!1)},methods:{onHash(){this.$emit("update:modelValue",!1)},onPopupClose(t){this.$emit("update:modelValue",t),this.hashState()},hashState(){if(this.modelValue){const t=window.location.hash.slice(1).split("?"),e=_.parse(t[1]);let i=0;for(let o in e)i++;const s=window.location.href,r=i>0?"&cPop="+ +new Date:"?cPop="+ +new Date;history.pushState("","",`${s}${r}`)}else{const t=window.location.hash.slice(1).split("?");_.parse(t[1]).cPop&&window.history.go(-1)}this.$refs.protocolPopup&&(this.$refs.protocolPopup.scrollTop=0)}},render(){return m(ct,{ref:"protocolPopup",show:this.modelValue,transitionAppear:!0,position:"bottom",style:{height:"100%"}},{default:()=>[this.$slots.default&&this.$slots.default()]})}});const Bt="_uploader_jyku5_1",Ht="_uploaderText_jyku5_52",Xt="_uploadImg_jyku5_57";var X={"uploader-section":"_uploader-section_jyku5_1","img-close":"_img-close_jyku5_9","col-uploader":"_col-uploader_jyku5_24",uploader:Bt,uploaderText:Ht,uploadImg:Xt};const tt={};tt.getData=t=>new Promise((e,i)=>{let s={};Mt(t).then(r=>{s.arrayBuffer=r,s.orientation=Tt(r),e(s)}).catch(r=>{i(r)})});function Mt(t){let e=null;return new Promise((i,s)=>{if(t.src)if(/^data\:/i.test(t.src))e=Wt(t.src),i(e);else if(/^blob\:/i.test(t.src)){var r=new FileReader;r.onload=function(a){e=a.target.result,i(e)},Yt(t.src,function(a){r.readAsArrayBuffer(a)})}else{var o=new XMLHttpRequest;o.onload=function(){if(this.status==200||this.status===0)e=o.response,i(e);else throw"Could not load image";o=null},o.open("GET",t.src,!0),o.responseType="arraybuffer",o.send(null)}else s("img error")})}function Yt(t,e){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="blob",i.onload=function(s){(this.status==200||this.status===0)&&e(this.response)},i.send()}function Wt(t){t=t.replace(/^data\:([^\;]+)\;base64,/gmi,"");for(var e=atob(t),i=e.length,s=new ArrayBuffer(i),r=new Uint8Array(s),o=0;o<i;o++)r[o]=e.charCodeAt(o);return s}function kt(t,e,i){var s="",r;for(r=e,i+=e;r<i;r++)s+=String.fromCharCode(t.getUint8(r));return s}function Tt(t){var e=new DataView(t),i=e.byteLength,s,r,o,a,u,d,v,l,g,y;if(e.getUint8(0)===255&&e.getUint8(1)===216)for(g=2;g<i;){if(e.getUint8(g)===255&&e.getUint8(g+1)===225){v=g;break}g++}if(v&&(r=v+4,o=v+10,kt(e,r,4)==="Exif"&&(d=e.getUint16(o),u=d===18761,(u||d===19789)&&e.getUint16(o+2,u)===42&&(a=e.getUint32(o+4,u),a>=8&&(l=o+a)))),l){for(i=e.getUint16(l,u),y=0;y<i;y++)if(g=l+y*12+2,e.getUint16(g,u)===274){g+=8,s=e.getUint16(g,u);break}}return s}var Ft=(t,e)=>{const i=t.__vccOpts||t;for(const[s,r]of e)i[s]=r;return i};const jt=M({data:function(){return{w:0,h:0,scale:1,x:0,y:0,loading:!0,trueWidth:0,trueHeight:0,move:!0,moveX:0,moveY:0,crop:!1,cropping:!1,cropW:0,cropH:0,cropOldW:0,cropOldH:0,canChangeX:!1,canChangeY:!1,changeCropTypeX:1,changeCropTypeY:1,cropX:0,cropY:0,cropChangeX:0,cropChangeY:0,cropOffsertX:0,cropOffsertY:0,support:"",touches:[],touchNow:!1,rotate:0,isIos:!1,orientation:0,imgs:"",coe:.2,scaling:!1,scalingSet:"",coeStatus:"",isCanShow:!0}},props:{img:{type:[String,Blob,null,File],default:""},outputSize:{type:Number,default:1},outputType:{type:String,default:"jpeg"},info:{type:Boolean,default:!0},canScale:{type:Boolean,default:!0},autoCrop:{type:Boolean,default:!1},autoCropWidth:{type:[Number,String],default:0},autoCropHeight:{type:[Number,String],default:0},fixed:{type:Boolean,default:!1},fixedNumber:{type:Array,default:()=>[1,1]},fixedBox:{type:Boolean,default:!1},full:{type:Boolean,default:!1},canMove:{type:Boolean,default:!0},canMoveBox:{type:Boolean,default:!0},original:{type:Boolean,default:!1},centerBox:{type:Boolean,default:!1},high:{type:Boolean,default:!0},infoTrue:{type:Boolean,default:!1},maxImgSize:{type:[Number,String],default:2e3},enlarge:{type:[Number,String],default:1},preW:{type:[Number,String],default:0},mode:{type:String,default:"contain"},limitMinSize:{type:[Number,Array,String],default:()=>10}},computed:{cropInfo(){let t={};if(t.top=this.cropOffsertY>21?"-21px":"0px",t.width=this.cropW>0?this.cropW:0,t.height=this.cropH>0?this.cropH:0,this.infoTrue){let e=1;this.high&&!this.full&&(e=window.devicePixelRatio),this.enlarge!==1&!this.full&&(e=Math.abs(Number(this.enlarge))),t.width=t.width*e,t.height=t.height*e,this.full&&(t.width=t.width/this.scale,t.height=t.height/this.scale)}return t.width=t.width.toFixed(0),t.height=t.height.toFixed(0),t},isIE(){return!!window.ActiveXObject||"ActiveXObject"in window},passive(){return this.isIE?null:{passive:!1}}},watch:{img(){this.checkedImg()},imgs(t){t!==""&&this.reload()},cropW(){this.showPreview()},cropH(){this.showPreview()},cropOffsertX(){this.showPreview()},cropOffsertY(){this.showPreview()},scale(t,e){this.showPreview()},x(){this.showPreview()},y(){this.showPreview()},autoCrop(t){t&&this.goAutoCrop()},autoCropWidth(){this.autoCrop&&this.goAutoCrop()},autoCropHeight(){this.autoCrop&&this.goAutoCrop()},mode(){this.checkedImg()},rotate(){this.showPreview(),this.autoCrop?this.goAutoCrop(this.cropW,this.cropH):(this.cropW>0||this.cropH>0)&&this.goAutoCrop(this.cropW,this.cropH)}},methods:{getVersion(t){var e=navigator.userAgent.split(" "),i="";let s=0;const r=new RegExp(t,"i");for(var o=0;o<e.length;o++)r.test(e[o])&&(i=e[o]);return i?s=i.split("/")[1].split("."):s=["0","0","0"],s},checkOrientationImage(t,e,i,s){if(this.getVersion("chrome")[0]>=81)e=-1;else if(this.getVersion("safari")[0]>=605){const a=this.getVersion("version");a[0]>13&&a[1]>1&&(e=-1)}else{const a=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(a){let u=a[1];u=u.split("_"),(u[0]>13||u[0]>=13&&u[1]>=4)&&(e=-1)}}let r=document.createElement("canvas"),o=r.getContext("2d");switch(o.save(),e){case 2:r.width=i,r.height=s,o.translate(i,0),o.scale(-1,1);break;case 3:r.width=i,r.height=s,o.translate(i/2,s/2),o.rotate(180*Math.PI/180),o.translate(-i/2,-s/2);break;case 4:r.width=i,r.height=s,o.translate(0,s),o.scale(1,-1);break;case 5:r.height=i,r.width=s,o.rotate(.5*Math.PI),o.scale(1,-1);break;case 6:r.width=s,r.height=i,o.translate(s/2,i/2),o.rotate(90*Math.PI/180),o.translate(-i/2,-s/2);break;case 7:r.height=i,r.width=s,o.rotate(.5*Math.PI),o.translate(i,-s),o.scale(-1,1);break;case 8:r.height=i,r.width=s,o.translate(s/2,i/2),o.rotate(-90*Math.PI/180),o.translate(-i/2,-s/2);break;default:r.width=i,r.height=s}o.drawImage(t,0,0,i,s),o.restore(),r.toBlob(a=>{let u=URL.createObjectURL(a);URL.revokeObjectURL(this.imgs),this.imgs=u},"image/"+this.outputType,1)},checkedImg(){if(this.img===null||this.img===""){this.imgs="",this.clearCrop();return}this.loading=!0,this.scale=1,this.rotate=0,this.clearCrop();let t=new Image;if(t.onload=()=>{if(this.img==="")return this.$emit("img-load","error"),!1;let i=t.width,s=t.height;tt.getData(t).then(r=>{this.orientation=r.orientation||1;let o=Number(this.maxImgSize);if(!this.orientation&&i<o&s<o){this.imgs=this.img;return}i>o&&(s=s/i*o,i=o),s>o&&(i=i/s*o,s=o),this.checkOrientationImage(t,this.orientation,i,s)})},t.onerror=()=>{this.$emit("img-load","error")},this.img.substr(0,4)!=="data"&&(t.crossOrigin=""),this.isIE){var e=new XMLHttpRequest;e.onload=function(){var i=URL.createObjectURL(this.response);t.src=i},e.open("GET",this.img,!0),e.responseType="blob",e.send()}else t.src=this.img},startMove(t){if(t.preventDefault(),this.move&&!this.crop){if(!this.canMove)return!1;this.moveX=("clientX"in t?t.clientX:t.touches[0].clientX)-this.x,this.moveY=("clientY"in t?t.clientY:t.touches[0].clientY)-this.y,t.touches?(window.addEventListener("touchmove",this.moveImg),window.addEventListener("touchend",this.leaveImg),t.touches.length==2&&(this.touches=t.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale))):(window.addEventListener("mousemove",this.moveImg),window.addEventListener("mouseup",this.leaveImg)),this.$emit("imgMoving",{moving:!0,axis:this.getImgAxis()}),this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})}else this.cropping=!0,window.addEventListener("mousemove",this.createCrop),window.addEventListener("mouseup",this.endCrop),window.addEventListener("touchmove",this.createCrop),window.addEventListener("touchend",this.endCrop),this.cropOffsertX=t.offsetX?t.offsetX:t.touches[0].pageX-this.$refs.cropper.offsetLeft,this.cropOffsertY=t.offsetY?t.offsetY:t.touches[0].pageY-this.$refs.cropper.offsetTop,this.cropX="clientX"in t?t.clientX:t.touches[0].clientX,this.cropY="clientY"in t?t.clientY:t.touches[0].clientY,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.cropW=0,this.cropH=0},touchScale(t){t.preventDefault();let e=this.scale;var i={x:this.touches[0].clientX,y:this.touches[0].clientY},s={x:t.touches[0].clientX,y:t.touches[0].clientY},r={x:this.touches[1].clientX,y:this.touches[1].clientY},o={x:t.touches[1].clientX,y:t.touches[1].clientY},a=Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2)),u=Math.sqrt(Math.pow(s.x-o.x,2)+Math.pow(s.y-o.y,2)),d=u-a,v=1;v=v/this.trueWidth>v/this.trueHeight?v/this.trueHeight:v/this.trueWidth,v=v>.1?.1:v;var l=v*d;if(!this.touchNow){if(this.touchNow=!0,d>0?e+=Math.abs(l):d<0&&e>Math.abs(l)&&(e-=Math.abs(l)),this.touches=t.touches,setTimeout(()=>{this.touchNow=!1},8),!this.checkoutImgAxis(this.x,this.y,e))return!1;this.scale=e}},cancelTouchScale(t){window.removeEventListener("touchmove",this.touchScale)},moveImg(t){if(t.preventDefault(),t.touches&&t.touches.length===2)return this.touches=t.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale),window.removeEventListener("touchmove",this.moveImg),!1;let e="clientX"in t?t.clientX:t.touches[0].clientX,i="clientY"in t?t.clientY:t.touches[0].clientY,s,r;s=e-this.moveX,r=i-this.moveY,this.$nextTick(()=>{if(this.centerBox){let o=this.getImgAxis(s,r,this.scale),a=this.getCropAxis(),u=this.trueHeight*this.scale,d=this.trueWidth*this.scale,v,l,g,y;switch(this.rotate){case 1:case-1:case 3:case-3:v=this.cropOffsertX-this.trueWidth*(1-this.scale)/2+(u-d)/2,l=this.cropOffsertY-this.trueHeight*(1-this.scale)/2+(d-u)/2,g=v-u+this.cropW,y=l-d+this.cropH;break;default:v=this.cropOffsertX-this.trueWidth*(1-this.scale)/2,l=this.cropOffsertY-this.trueHeight*(1-this.scale)/2,g=v-d+this.cropW,y=l-u+this.cropH;break}o.x1>=a.x1&&(s=v),o.y1>=a.y1&&(r=l),o.x2<=a.x2&&(s=g),o.y2<=a.y2&&(r=y)}this.x=s,this.y=r,this.$emit("imgMoving",{moving:!0,axis:this.getImgAxis()}),this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})})},leaveImg(t){window.removeEventListener("mousemove",this.moveImg),window.removeEventListener("touchmove",this.moveImg),window.removeEventListener("mouseup",this.leaveImg),window.removeEventListener("touchend",this.leaveImg),this.$emit("imgMoving",{moving:!1,axis:this.getImgAxis()}),this.$emit("img-moving",{moving:!1,axis:this.getImgAxis()})},scaleImg(){this.canScale&&window.addEventListener(this.support,this.changeSize,this.passive)},cancelScale(){this.canScale&&window.removeEventListener(this.support,this.changeSize)},changeSize(t){t.preventDefault();let e=this.scale;var i=t.deltaY||t.wheelDelta,s=navigator.userAgent.indexOf("Firefox");i=s>0?i*30:i,this.isIE&&(i=-i);var r=this.coe;r=r/this.trueWidth>r/this.trueHeight?r/this.trueHeight:r/this.trueWidth;var o=r*i;o<0?e+=Math.abs(o):e>Math.abs(o)&&(e-=Math.abs(o));let a=o<0?"add":"reduce";if(a!==this.coeStatus&&(this.coeStatus=a,this.coe=.2),this.scaling||(this.scalingSet=setTimeout(()=>{this.scaling=!1,this.coe=this.coe+=.01},50)),this.scaling=!0,!this.checkoutImgAxis(this.x,this.y,e))return!1;this.scale=e},changeScale(t){let e=this.scale;t=t||1;var i=20;if(i=i/this.trueWidth>i/this.trueHeight?i/this.trueHeight:i/this.trueWidth,t=t*i,t>0?e+=Math.abs(t):e>Math.abs(t)&&(e-=Math.abs(t)),!this.checkoutImgAxis(this.x,this.y,e))return!1;this.scale=e},createCrop(t){t.preventDefault();var e="clientX"in t?t.clientX:t.touches?t.touches[0].clientX:0,i="clientY"in t?t.clientY:t.touches?t.touches[0].clientY:0;this.$nextTick(()=>{var s=e-this.cropX,r=i-this.cropY;if(s>0?(this.cropW=s+this.cropChangeX>this.w?this.w-this.cropChangeX:s,this.cropOffsertX=this.cropChangeX):(this.cropW=this.w-this.cropChangeX+Math.abs(s)>this.w?this.cropChangeX:Math.abs(s),this.cropOffsertX=this.cropChangeX+s>0?this.cropChangeX+s:0),!this.fixed)r>0?(this.cropH=r+this.cropChangeY>this.h?this.h-this.cropChangeY:r,this.cropOffsertY=this.cropChangeY):(this.cropH=this.h-this.cropChangeY+Math.abs(r)>this.h?this.cropChangeY:Math.abs(r),this.cropOffsertY=this.cropChangeY+r>0?this.cropChangeY+r:0);else{var o=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];o+this.cropOffsertY>this.h?(this.cropH=this.h-this.cropOffsertY,this.cropW=this.cropH/this.fixedNumber[1]*this.fixedNumber[0],s>0?this.cropOffsertX=this.cropChangeX:this.cropOffsertX=this.cropChangeX-this.cropW):this.cropH=o,this.cropOffsertY=this.cropOffsertY}})},changeCropSize(t,e,i,s,r){t.preventDefault(),window.addEventListener("mousemove",this.changeCropNow),window.addEventListener("mouseup",this.changeCropEnd),window.addEventListener("touchmove",this.changeCropNow),window.addEventListener("touchend",this.changeCropEnd),this.canChangeX=e,this.canChangeY=i,this.changeCropTypeX=s,this.changeCropTypeY=r,this.cropX="clientX"in t?t.clientX:t.touches[0].clientX,this.cropY="clientY"in t?t.clientY:t.touches[0].clientY,this.cropOldW=this.cropW,this.cropOldH=this.cropH,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.fixed&&this.canChangeX&&this.canChangeY&&(this.canChangeY=0),this.$emit("change-crop-size",{width:this.cropW,height:this.cropH})},changeCropNow(t){t.preventDefault();var e="clientX"in t?t.clientX:t.touches?t.touches[0].clientX:0,i="clientY"in t?t.clientY:t.touches?t.touches[0].clientY:0;let s=this.w,r=this.h,o=0,a=0;if(this.centerBox){let u=this.getImgAxis(),d=u.x2,v=u.y2;o=u.x1>0?u.x1:0,a=u.y1>0?u.y1:0,s>d&&(s=d),r>v&&(r=v)}this.$nextTick(()=>{var u=e-this.cropX,d=i-this.cropY;if(this.canChangeX&&(this.changeCropTypeX===1?this.cropOldW-u>0?(this.cropW=s-this.cropChangeX-u<=s-o?this.cropOldW-u:this.cropOldW+this.cropChangeX-o,this.cropOffsertX=s-this.cropChangeX-u<=s-o?this.cropChangeX+u:o):(this.cropW=Math.abs(u)+this.cropChangeX<=s?Math.abs(u)-this.cropOldW:s-this.cropOldW-this.cropChangeX,this.cropOffsertX=this.cropChangeX+this.cropOldW):this.changeCropTypeX===2&&(this.cropOldW+u>0?(this.cropW=this.cropOldW+u+this.cropOffsertX<=s?this.cropOldW+u:s-this.cropOffsertX,this.cropOffsertX=this.cropChangeX):(this.cropW=s-this.cropChangeX+Math.abs(u+this.cropOldW)<=s-o?Math.abs(u+this.cropOldW):this.cropChangeX-o,this.cropOffsertX=s-this.cropChangeX+Math.abs(u+this.cropOldW)<=s-o?this.cropChangeX-Math.abs(u+this.cropOldW):o))),this.canChangeY&&(this.changeCropTypeY===1?this.cropOldH-d>0?(this.cropH=r-this.cropChangeY-d<=r-a?this.cropOldH-d:this.cropOldH+this.cropChangeY-a,this.cropOffsertY=r-this.cropChangeY-d<=r-a?this.cropChangeY+d:a):(this.cropH=Math.abs(d)+this.cropChangeY<=r?Math.abs(d)-this.cropOldH:r-this.cropOldH-this.cropChangeY,this.cropOffsertY=this.cropChangeY+this.cropOldH):this.changeCropTypeY===2&&(this.cropOldH+d>0?(this.cropH=this.cropOldH+d+this.cropOffsertY<=r?this.cropOldH+d:r-this.cropOffsertY,this.cropOffsertY=this.cropChangeY):(this.cropH=r-this.cropChangeY+Math.abs(d+this.cropOldH)<=r-a?Math.abs(d+this.cropOldH):this.cropChangeY-a,this.cropOffsertY=r-this.cropChangeY+Math.abs(d+this.cropOldH)<=r-a?this.cropChangeY-Math.abs(d+this.cropOldH):a))),this.canChangeX&&this.fixed){var v=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];v+this.cropOffsertY>r?(this.cropH=r-this.cropOffsertY,this.cropW=this.cropH/this.fixedNumber[1]*this.fixedNumber[0]):this.cropH=v}if(this.canChangeY&&this.fixed){var l=this.cropH/this.fixedNumber[1]*this.fixedNumber[0];l+this.cropOffsertX>s?(this.cropW=s-this.cropOffsertX,this.cropH=this.cropW/this.fixedNumber[0]*this.fixedNumber[1]):this.cropW=l}})},checkCropLimitSize(){let{cropW:t,cropH:e,limitMinSize:i}=this,s=new Array;return Array.isArray[i]?s=i:s=[i,i],t=parseFloat(s[0]),e=parseFloat(s[1]),[t,e]},changeCropEnd(t){window.removeEventListener("mousemove",this.changeCropNow),window.removeEventListener("mouseup",this.changeCropEnd),window.removeEventListener("touchmove",this.changeCropNow),window.removeEventListener("touchend",this.changeCropEnd)},endCrop(){this.cropW===0&&this.cropH===0&&(this.cropping=!1),window.removeEventListener("mousemove",this.createCrop),window.removeEventListener("mouseup",this.endCrop),window.removeEventListener("touchmove",this.createCrop),window.removeEventListener("touchend",this.endCrop)},startCrop(){this.crop=!0},stopCrop(){this.crop=!1},clearCrop(){this.cropping=!1,this.cropW=0,this.cropH=0},cropMove(t){if(t.preventDefault(),!this.canMoveBox)return this.crop=!1,this.startMove(t),!1;if(t.touches&&t.touches.length===2)return this.crop=!1,this.startMove(t),this.leaveCrop(),!1;window.addEventListener("mousemove",this.moveCrop),window.addEventListener("mouseup",this.leaveCrop),window.addEventListener("touchmove",this.moveCrop),window.addEventListener("touchend",this.leaveCrop);let e="clientX"in t?t.clientX:t.touches[0].clientX,i="clientY"in t?t.clientY:t.touches[0].clientY,s,r;s=e-this.cropOffsertX,r=i-this.cropOffsertY,this.cropX=s,this.cropY=r,this.$emit("cropMoving",{moving:!0,axis:this.getCropAxis()}),this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})},moveCrop(t,e){let i=0,s=0;t&&(t.preventDefault(),i="clientX"in t?t.clientX:t.touches[0].clientX,s="clientY"in t?t.clientY:t.touches[0].clientY),this.$nextTick(()=>{let r,o,a=i-this.cropX,u=s-this.cropY;if(e&&(a=this.cropOffsertX,u=this.cropOffsertY),a<=0?r=0:a+this.cropW>this.w?r=this.w-this.cropW:r=a,u<=0?o=0:u+this.cropH>this.h?o=this.h-this.cropH:o=u,this.centerBox){let d=this.getImgAxis();r<=d.x1&&(r=d.x1),r+this.cropW>d.x2&&(r=d.x2-this.cropW),o<=d.y1&&(o=d.y1),o+this.cropH>d.y2&&(o=d.y2-this.cropH)}this.cropOffsertX=r,this.cropOffsertY=o,this.$emit("cropMoving",{moving:!0,axis:this.getCropAxis()}),this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})})},getImgAxis(t,e,i){t=t||this.x,e=e||this.y,i=i||this.scale;let s={x1:0,x2:0,y1:0,y2:0},r=this.trueWidth*i,o=this.trueHeight*i;switch(this.rotate){case 0:s.x1=t+this.trueWidth*(1-i)/2,s.x2=s.x1+this.trueWidth*i,s.y1=e+this.trueHeight*(1-i)/2,s.y2=s.y1+this.trueHeight*i;break;case 1:case-1:case 3:case-3:s.x1=t+this.trueWidth*(1-i)/2+(r-o)/2,s.x2=s.x1+this.trueHeight*i,s.y1=e+this.trueHeight*(1-i)/2+(o-r)/2,s.y2=s.y1+this.trueWidth*i;break;default:s.x1=t+this.trueWidth*(1-i)/2,s.x2=s.x1+this.trueWidth*i,s.y1=e+this.trueHeight*(1-i)/2,s.y2=s.y1+this.trueHeight*i;break}return s},getCropAxis(){let t={x1:0,x2:0,y1:0,y2:0};return t.x1=this.cropOffsertX,t.x2=t.x1+this.cropW,t.y1=this.cropOffsertY,t.y2=t.y1+this.cropH,t},leaveCrop(t){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.$emit("cropMoving",{moving:!1,axis:this.getCropAxis()}),this.$emit("crop-moving",{moving:!1,axis:this.getCropAxis()})},getCropChecked(t){let e=document.createElement("canvas"),i=new Image,s=this.rotate,r=this.trueWidth,o=this.trueHeight,a=this.cropOffsertX,u=this.cropOffsertY;i.onload=()=>{if(this.cropW!==0){let l=e.getContext("2d"),g=1;this.high&!this.full&&(g=window.devicePixelRatio),this.enlarge!==1&!this.full&&(g=Math.abs(Number(this.enlarge)));let y=this.cropW*g,H=this.cropH*g,x=r*this.scale*g,b=o*this.scale*g,A=(this.x-a+this.trueWidth*(1-this.scale)/2)*g,S=(this.y-u+this.trueHeight*(1-this.scale)/2)*g;switch(v(y,H),l.save(),s){case 0:this.full?(v(y/this.scale,H/this.scale),l.drawImage(i,A/this.scale,S/this.scale,x/this.scale,b/this.scale)):l.drawImage(i,A,S,x,b);break;case 1:case-3:this.full?(v(y/this.scale,H/this.scale),A=A/this.scale+(x/this.scale-b/this.scale)/2,S=S/this.scale+(b/this.scale-x/this.scale)/2,l.rotate(s*90*Math.PI/180),l.drawImage(i,S,-A-b/this.scale,x/this.scale,b/this.scale)):(A=A+(x-b)/2,S=S+(b-x)/2,l.rotate(s*90*Math.PI/180),l.drawImage(i,S,-A-b,x,b));break;case 2:case-2:this.full?(v(y/this.scale,H/this.scale),l.rotate(s*90*Math.PI/180),A=A/this.scale,S=S/this.scale,l.drawImage(i,-A-x/this.scale,-S-b/this.scale,x/this.scale,b/this.scale)):(l.rotate(s*90*Math.PI/180),l.drawImage(i,-A-x,-S-b,x,b));break;case 3:case-1:this.full?(v(y/this.scale,H/this.scale),A=A/this.scale+(x/this.scale-b/this.scale)/2,S=S/this.scale+(b/this.scale-x/this.scale)/2,l.rotate(s*90*Math.PI/180),l.drawImage(i,-S-x/this.scale,A,x/this.scale,b/this.scale)):(A=A+(x-b)/2,S=S+(b-x)/2,l.rotate(s*90*Math.PI/180),l.drawImage(i,-S-x,A,x,b));break;default:this.full?(v(y/this.scale,H/this.scale),l.drawImage(i,A/this.scale,S/this.scale,x/this.scale,b/this.scale)):l.drawImage(i,A,S,x,b)}l.restore()}else{let l=r*this.scale,g=o*this.scale,y=e.getContext("2d");switch(y.save(),s){case 0:v(l,g),y.drawImage(i,0,0,l,g);break;case 1:case-3:v(g,l),y.rotate(s*90*Math.PI/180),y.drawImage(i,0,-g,l,g);break;case 2:case-2:v(l,g),y.rotate(s*90*Math.PI/180),y.drawImage(i,-l,-g,l,g);break;case 3:case-1:v(g,l),y.rotate(s*90*Math.PI/180),y.drawImage(i,-l,0,l,g);break;default:v(l,g),y.drawImage(i,0,0,l,g)}y.restore()}t(e)};var d=this.img.substr(0,4);d!=="data"&&(i.crossOrigin="Anonymous"),i.src=this.imgs;function v(l,g){e.width=Math.round(l),e.height=Math.round(g)}},getCropData(t){this.getCropChecked(e=>{t(e.toDataURL("image/"+this.outputType,this.outputSize))})},getCropBlob(t){this.getCropChecked(e=>{e.toBlob(i=>t(i),"image/"+this.outputType,this.outputSize)})},showPreview(){if(this.isCanShow)this.isCanShow=!1,setTimeout(()=>{this.isCanShow=!0},16);else return!1;let t=this.cropW,e=this.cropH,i=this.scale;var s={};s.div={width:`${t}px`,height:`${e}px`};let r=(this.x-this.cropOffsertX)/i,o=(this.y-this.cropOffsertY)/i,a=0;s.w=t,s.h=e,s.url=this.imgs,s.img={width:`${this.trueWidth}px`,height:`${this.trueHeight}px`,transform:`scale(${i})translate3d(${r}px, ${o}px, ${a}px)rotateZ(${this.rotate*90}deg)`},s.html=`
  2. <div class="show-preview" style="width: ${s.w}px; height: ${s.h}px,; overflow: hidden">
  3. <div style="width: ${t}px; height: ${e}px">
  4. <img src=${s.url} style="width: ${this.trueWidth}px; height: ${this.trueHeight}px; transform:
  5. scale(${i})translate3d(${r}px, ${o}px, ${a}px)rotateZ(${this.rotate*90}deg)">
  6. </div>
  7. </div>`,this.$emit("realTime",s),this.$emit("real-time",s)},reload(){let t=new Image;t.onload=()=>{this.w=parseFloat(window.getComputedStyle(this.$refs.cropper).width),this.h=parseFloat(window.getComputedStyle(this.$refs.cropper).height),this.trueWidth=t.width,this.trueHeight=t.height,this.original?this.scale=1:this.scale=this.checkedMode(),this.$nextTick(()=>{this.x=-(this.trueWidth-this.trueWidth*this.scale)/2+(this.w-this.trueWidth*this.scale)/2,this.y=-(this.trueHeight-this.trueHeight*this.scale)/2+(this.h-this.trueHeight*this.scale)/2,this.loading=!1,this.autoCrop&&this.goAutoCrop(),this.$emit("img-load","success"),this.$emit("imgLoad","success"),setTimeout(()=>{this.showPreview()},20)})},t.onerror=()=>{this.$emit("imgLoad","error"),this.$emit("img-load","error")},t.src=this.imgs},checkedMode(){let t=1,e=this.trueWidth,i=this.trueHeight;const s=this.mode.split(" ");switch(s[0]){case"contain":this.trueWidth>this.w&&(t=this.w/this.trueWidth),this.trueHeight*t>this.h&&(t=this.h/this.trueHeight);break;case"cover":e=this.w,t=e/this.trueWidth,i=i*t,i<this.h&&(i=this.h,t=i/this.trueHeight);break;default:try{let r=s[0];if(r.search("px")!==-1){r=r.replace("px",""),e=parseFloat(r);const o=e/this.trueWidth;let a=1,u=s[1];u.search("px")!==-1&&(u=u.replace("px",""),i=parseFloat(u),a=i/this.trueHeight),t=Math.min(o,a)}if(r.search("%")!==-1&&(r=r.replace("%",""),e=parseFloat(r)/100*this.w,t=e/this.trueWidth),s.length===2&&r==="auto"){let o=s[1];o.search("px")!==-1&&(o=o.replace("px",""),i=parseFloat(o),t=i/this.trueHeight),o.search("%")!==-1&&(o=o.replace("%",""),i=parseFloat(o)/100*this.h,t=i/this.trueHeight)}}catch{t=1}}return t},goAutoCrop(t,e){if(this.imgs===""||this.imgs===null)return;this.clearCrop(),this.cropping=!0;let i=this.w,s=this.h;if(this.centerBox){const a=Math.abs(this.rotate)%2>0;let u=(a?this.trueHeight:this.trueWidth)*this.scale,d=(a?this.trueWidth:this.trueHeight)*this.scale;i=u<i?u:i,s=d<s?d:s}var r=t||parseFloat(this.autoCropWidth),o=e||parseFloat(this.autoCropHeight);(r===0||o===0)&&(r=i*.8,o=s*.8),r=r>i?i:r,o=o>s?s:o,this.fixed&&(o=r/this.fixedNumber[0]*this.fixedNumber[1]),o>this.h&&(o=this.h,r=o/this.fixedNumber[1]*this.fixedNumber[0]),this.changeCrop(r,o)},changeCrop(t,e){if(this.centerBox){let i=this.getImgAxis();t>i.x2-i.x1&&(t=i.x2-i.x1,e=t/this.fixedNumber[0]*this.fixedNumber[1]),e>i.y2-i.y1&&(e=i.y2-i.y1,t=e/this.fixedNumber[1]*this.fixedNumber[0])}this.cropW=t,this.cropH=e,this.checkCropLimitSize(),this.$nextTick(()=>{this.cropOffsertX=(this.w-this.cropW)/2,this.cropOffsertY=(this.h-this.cropH)/2,this.centerBox&&this.moveCrop(null,!0)})},refresh(){this.img,this.imgs="",this.scale=1,this.crop=!1,this.rotate=0,this.w=0,this.h=0,this.trueWidth=0,this.trueHeight=0,this.clearCrop(),this.$nextTick(()=>{this.checkedImg()})},rotateLeft(){this.rotate=this.rotate<=-3?0:this.rotate-1},rotateRight(){this.rotate=this.rotate>=3?0:this.rotate+1},rotateClear(){this.rotate=0},checkoutImgAxis(t,e,i){t=t||this.x,e=e||this.y,i=i||this.scale;let s=!0;if(this.centerBox){let r=this.getImgAxis(t,e,i),o=this.getCropAxis();r.x1>=o.x1&&(s=!1),r.x2<=o.x2&&(s=!1),r.y1>=o.y1&&(s=!1),r.y2<=o.y2&&(s=!1)}return s}},mounted(){this.support="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll";let t=this;var e=navigator.userAgent;this.isIOS=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(i,s,r){for(var o=atob(this.toDataURL(s,r).split(",")[1]),a=o.length,u=new Uint8Array(a),d=0;d<a;d++)u[d]=o.charCodeAt(d);i(new Blob([u],{type:t.type||"image/png"}))}}),this.showPreview(),this.checkedImg()},destroyed(){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.cancelScale()}}),Lt={key:0,class:"cropper-box"},zt=["src"],$t={class:"cropper-view-box"},Nt=["src"],Ut={key:1};function Vt(t,e,i,s,r,o){return F(),k("div",{class:"vue-cropper",ref:"cropper",onMouseover:e[28]||(e[28]=(...a)=>t.scaleImg&&t.scaleImg(...a)),onMouseout:e[29]||(e[29]=(...a)=>t.cancelScale&&t.cancelScale(...a))},[t.imgs?(F(),k("div",Lt,[R(O("div",{class:"cropper-box-canvas",style:T({width:t.trueWidth+"px",height:t.trueHeight+"px",transform:"scale("+t.scale+","+t.scale+") translate3d("+t.x/t.scale+"px,"+t.y/t.scale+"px,0)rotateZ("+t.rotate*90+"deg)"})},[O("img",{src:t.imgs,alt:"cropper-img",ref:"cropperImg"},null,8,zt)],4),[[D,!t.loading]])])):j("",!0),O("div",{class:pt(["cropper-drag-box",{"cropper-move":t.move&&!t.crop,"cropper-crop":t.crop,"cropper-modal":t.cropping}]),onMousedown:e[0]||(e[0]=(...a)=>t.startMove&&t.startMove(...a)),onTouchstart:e[1]||(e[1]=(...a)=>t.startMove&&t.startMove(...a))},null,34),R(O("div",{class:"cropper-crop-box",style:T({width:t.cropW+"px",height:t.cropH+"px",transform:"translate3d("+t.cropOffsertX+"px,"+t.cropOffsertY+"px,0)"})},[O("span",$t,[O("img",{style:T({width:t.trueWidth+"px",height:t.trueHeight+"px",transform:"scale("+t.scale+","+t.scale+") translate3d("+(t.x-t.cropOffsertX)/t.scale+"px,"+(t.y-t.cropOffsertY)/t.scale+"px,0)rotateZ("+t.rotate*90+"deg)"}),src:t.imgs,alt:"cropper-img"},null,12,Nt)]),O("span",{class:"cropper-face cropper-move",onMousedown:e[2]||(e[2]=(...a)=>t.cropMove&&t.cropMove(...a)),onTouchstart:e[3]||(e[3]=(...a)=>t.cropMove&&t.cropMove(...a))},null,32),t.info?(F(),k("span",{key:0,class:"crop-info",style:T({top:t.cropInfo.top})},P(t.cropInfo.width)+" \xD7 "+P(t.cropInfo.height),5)):j("",!0),t.fixedBox?j("",!0):(F(),k("span",Ut,[O("span",{class:"crop-line line-w",onMousedown:e[4]||(e[4]=a=>t.changeCropSize(a,!1,!0,0,1)),onTouchstart:e[5]||(e[5]=a=>t.changeCropSize(a,!1,!0,0,1))},null,32),O("span",{class:"crop-line line-a",onMousedown:e[6]||(e[6]=a=>t.changeCropSize(a,!0,!1,1,0)),onTouchstart:e[7]||(e[7]=a=>t.changeCropSize(a,!0,!1,1,0))},null,32),O("span",{class:"crop-line line-s",onMousedown:e[8]||(e[8]=a=>t.changeCropSize(a,!1,!0,0,2)),onTouchstart:e[9]||(e[9]=a=>t.changeCropSize(a,!1,!0,0,2))},null,32),O("span",{class:"crop-line line-d",onMousedown:e[10]||(e[10]=a=>t.changeCropSize(a,!0,!1,2,0)),onTouchstart:e[11]||(e[11]=a=>t.changeCropSize(a,!0,!1,2,0))},null,32),O("span",{class:"crop-point point1",onMousedown:e[12]||(e[12]=a=>t.changeCropSize(a,!0,!0,1,1)),onTouchstart:e[13]||(e[13]=a=>t.changeCropSize(a,!0,!0,1,1))},null,32),O("span",{class:"crop-point point2",onMousedown:e[14]||(e[14]=a=>t.changeCropSize(a,!1,!0,0,1)),onTouchstart:e[15]||(e[15]=a=>t.changeCropSize(a,!1,!0,0,1))},null,32),O("span",{class:"crop-point point3",onMousedown:e[16]||(e[16]=a=>t.changeCropSize(a,!0,!0,2,1)),onTouchstart:e[17]||(e[17]=a=>t.changeCropSize(a,!0,!0,2,1))},null,32),O("span",{class:"crop-point point4",onMousedown:e[18]||(e[18]=a=>t.changeCropSize(a,!0,!1,1,0)),onTouchstart:e[19]||(e[19]=a=>t.changeCropSize(a,!0,!1,1,0))},null,32),O("span",{class:"crop-point point5",onMousedown:e[20]||(e[20]=a=>t.changeCropSize(a,!0,!1,2,0)),onTouchstart:e[21]||(e[21]=a=>t.changeCropSize(a,!0,!1,2,0))},null,32),O("span",{class:"crop-point point6",onMousedown:e[22]||(e[22]=a=>t.changeCropSize(a,!0,!0,1,2)),onTouchstart:e[23]||(e[23]=a=>t.changeCropSize(a,!0,!0,1,2))},null,32),O("span",{class:"crop-point point7",onMousedown:e[24]||(e[24]=a=>t.changeCropSize(a,!1,!0,0,2)),onTouchstart:e[25]||(e[25]=a=>t.changeCropSize(a,!1,!0,0,2))},null,32),O("span",{class:"crop-point point8",onMousedown:e[26]||(e[26]=a=>t.changeCropSize(a,!0,!0,2,2)),onTouchstart:e[27]||(e[27]=a=>t.changeCropSize(a,!0,!0,2,2))},null,32)]))],4),[[D,t.cropping]])],544)}var N=Ft(jt,[["render",Vt],["__scopeId","data-v-be5e5ddc"]]);typeof window!="undefined"&&window.Vue&&window.Vue.createApp({}).component("VueCropper",N);const Rt="_upbtn_4fh9z_1",Dt="_uploadWarper_4fh9z_5",Pt="_bg_4fh9z_12",qt="_btn_4fh9z_21",Jt="_btn1_4fh9z_33",Qt="_img_4fh9z_44",Zt="_btndiv_4fh9z_53",Gt="_wrapper_4fh9z_64";var B={upbtn:Rt,uploadWarper:Dt,bg:Pt,btn:qt,btn1:Jt,img:Qt,btndiv:Zt,wrapper:Gt},Kt=M({name:"col-cropper",components:{VueCropper:N},props:{hideInput:{type:Boolean,default:!1},option:{type:Object},onCancelTailor:{type:Function,default:()=>{}},getBase64Data:{type:Function,default:()=>{}},getBlob:{type:Function,default:()=>{}},getFile:{type:Function,default:()=>{}},imgOriginF:{type:Function,default:()=>{}}},data(){return{img:"",config:{ceilbutton:!1,outputSize:1,outputType:"png",info:!1,canScale:!0,autoCrop:!1,autoCropWidth:0,autoCropHeight:0,fixed:!0,fixedNumber:[1,1],full:!1,fixedBox:!0,canMove:!0,canMoveBox:!1,original:!1,centerBox:!0,high:!0,infoTrue:!1,maxImgSize:2e3,enlarge:1,mode:"100%",cancelButtonText:"\u53D6\u6D88",confirmButtonText:"\u786E\u5B9A",cancelButtonBackgroundColor:"#606266",confirmButtonBackgroundColor:"#ed594c",cancelButtonTextColor:"#ffffff",confirmButtonTextColor:"#ffffff"}}},mounted(){this.config=Object.assign(this.config,this.option)},methods:{addSlide(){if(document.getElementById("vertical")==null){let t=document.getElementsByClassName("cropper-crop-box")[0],e=document.createElement("div");e.id="vertical",e.style.width="1px",e.style.height="100%",e.style.top="0px",e.style.left="33%",e.style.position="absolute",e.style.backgroundColor="#fff",e.style.zIndex="522",e.style.opacity="0.5";let i=document.createElement("div");i.style.width="1px",i.style.height="100%",i.style.top="0px",i.style.right="33%",i.style.position="absolute",i.style.backgroundColor="#fff",i.style.zIndex="522",i.style.opacity="0.5";let s=document.createElement("div");s.style.width="100%",s.style.height="1px",s.style.top="33%",s.style.left="0px",s.style.position="absolute",s.style.backgroundColor="#fff",s.style.zIndex="522",s.style.opacity="0.5";let r=document.createElement("div");r.style.width="100%",r.style.height="1px",r.style.bottom="33%",r.style.left="0px",r.style.position="absolute",r.style.backgroundColor="#fff",r.style.zIndex="522",r.style.opacity="0.5";let o=document.createElement("div");o.style.width="30px",o.style.height="4px",o.style.top="-4px",o.style.left="-4px",o.style.position="absolute",o.style.backgroundColor="#fff",o.style.zIndex="522",o.style.opacity="1";let a=document.createElement("div");a.style.width="4px",a.style.height="30px",a.style.top="-4px",a.style.left="-4px",a.style.position="absolute",a.style.backgroundColor="#fff",a.style.zIndex="522",a.style.opacity="1";let u=document.createElement("div");u.style.width="30px",u.style.height="4px",u.style.top="-4px",u.style.right="-4px",u.style.position="absolute",u.style.backgroundColor="#fff",u.style.zIndex="522",u.style.opacity="1";let d=document.createElement("div");d.style.width="4px",d.style.height="30px",d.style.top="-4px",d.style.right="-4px",d.style.position="absolute",d.style.backgroundColor="#fff",d.style.zIndex="522",d.style.opacity="1";let v=document.createElement("div");v.style.width="30px",v.style.height="4px",v.style.bottom="-4px",v.style.left="-4px",v.style.position="absolute",v.style.backgroundColor="#fff",v.style.zIndex="522",v.style.opacity="1";let l=document.createElement("div");l.style.width="4px",l.style.height="30px",l.style.bottom="-4px",l.style.left="-4px",l.style.position="absolute",l.style.backgroundColor="#fff",l.style.zIndex="522",l.style.opacity="1";let g=document.createElement("div");g.style.width="30px",g.style.height="4px",g.style.bottom="-4px",g.style.right="-4px",g.style.position="absolute",g.style.backgroundColor="#fff",g.style.zIndex="522",g.style.opacity="1";let y=document.createElement("div");y.style.width="4px",y.style.height="30px",y.style.bottom="-4px",y.style.right="-4px",y.style.position="absolute",y.style.backgroundColor="#fff",y.style.zIndex="522",y.style.opacity="1",t.appendChild(e),t.appendChild(i),t.appendChild(s),t.appendChild(r),t.appendChild(o),t.appendChild(a),t.appendChild(u),t.appendChild(d),t.appendChild(v),t.appendChild(l),t.appendChild(g),t.appendChild(y)}},onLoadImg(t){return new Promise(function(e,i){let s=new FileReader;s.readAsDataURL(t),s.onload=r=>{e(r.target.result)}})},loadFile(t){if(t instanceof File)this.onLoadImg(t).then(e=>{this.img=e,setTimeout(()=>{this.config.autoCrop=!0,this.addSlide()},10)});else throw new Error("Arguments file is not File")},loadBase64(t){if(typeof t!="string")throw new Error("Arguments base64 is not string");const e=t.split(",");if(!/^data:image\/(.*?);base64$/.test(e[0]))throw new Error("Arguments base64 MIME is not image/*");if(!/^[\/]?([\da-zA-Z]+[\/+]+)*[\da-zA-Z]+([+=]{1,2}|[\/])?$/.test(e[1]))throw new Error("Not standard base64");this.img=t,setTimeout(()=>{this.config.autoCrop=!0,this.addSlide()},10)},rotating(t){this.$refs.cropper.rotateRight()},canceltailor(){this.img="",this.onCancelTailor()},tailoring(){this.$refs.cropper.getCropData(t=>{this.getBase64Data(t),this.getBlob(t),this.img="",this.config.autoCrop=!1}),this.$refs.cropper.getCropBlob(t=>{this.getBase64Data(t),this.getBlob(t);const e={jpeg:"jpg",png:"png",webp:"webp"}[this.config.outputType],i=new Date().getTime(),s=new File([t],`${i}.${e}`,{type:`image/${this.config.outputType}`});this.getFile(s),this.img="",this.config.autoCrop=!1})},async upPhoto(t){let e=t.target.files[0];this.$refs.headInput.value=null,e!=null&&(this.imgOriginF(e),this.img=await this.onLoadImg(e),this.config.autoCrop=!0,setTimeout(()=>{this.addSlide()},20))},onCropMoving(t){},onImgMoving(t){}},render(){return m("div",{class:[B.upbtn,B.uploadWarper]},[this.hideInput,this.hideInput?null:m("input",{style:"opacity: 0;",class:B.upbtn,type:"file",accept:"image/*",onChange:this.upPhoto,ref:"headInput"},null),this.img!=""?m("div",{class:B.bg},[this.config.ceilbutton?m("div",{class:B.btndiv},[m("div",{class:B.btn,onClick:this.canceltailor,style:{backgroundColor:this.config.cancelButtonBackgroundColor,color:this.config.cancelButtonTextColor}},[this.config.cancelButtonText]),m("div",{class:B.img,onClick:this.rotating},null),m("div",{class:B.btn,onClick:this.tailoring,style:{backgroundColor:this.config.confirmButtonBackgroundColor,color:this.config.confirmButtonTextColor}},[this.config.confirmButtonText])]):null,m("div",{class:B.wrapper},[m(N,{ref:"cropper",img:this.img,outputSize:this.config.outputSize,outputType:this.config.outputType,info:this.config.info,canScale:this.config.canScale,autoCrop:this.config.autoCrop,autoCropWidth:this.config.autoCropWidth,autoCropHeight:this.config.autoCropHeight,fixedBox:this.config.fixedBox,fixed:this.config.fixed,fixedNumber:this.config.fixedNumber,full:this.config.full,canMove:this.config.canMove,canMoveBox:this.config.canMoveBox,original:this.config.original,centerBox:this.config.centerBox,high:this.config.high,infoTrue:this.config.infoTrue,maxImgSize:this.config.maxImgSize,enlarge:this.config.enlarge,mode:this.config.mode,onCropMoving:this.onCropMoving,onImgMoving:this.onImgMoving},null)]),this.config.ceilbutton?null:m("div",{class:B.btndiv},[m("div",{class:B.btn,onClick:this.canceltailor,style:{backgroundColor:this.config.cancelButtonBackgroundColor,color:this.config.cancelButtonTextColor}},[this.config.cancelButtonText]),m("div",{class:B.img,onClick:this.rotating},null),m("div",{class:B.btn,onClick:this.tailoring,style:{backgroundColor:this.config.confirmButtonBackgroundColor,color:this.config.confirmButtonTextColor}},[this.config.confirmButtonText])])]):null])}}),et="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAcCAYAAAAAwr0iAAAAAXNSR0IArs4c6QAABCZJREFUSEu1ll1oXEUUx/9nbjbsRkRFq4l2d+/M3WhwFaukRUpFoT4oluJDG/EDQYr4poK2IOqLbf2IIOJjlWgJgopWiiCCloAifgTFaKOG7L1z65YQIrQS2+wm2TtHJtxdwtps7rpxnu5lzvnPb87HzBD+5xGG4b4oil4XQnw+Pj6+d2hoKFq9JLVav1wuX7O8vHwYQJGIWtpaHWZeYOZ3PM8bqesGQfA7gOvi/5uUUj8nAmBmobWeAHBDu0ESQjzkuu671i8IAg3Atd9dXV3bcrnceCIA3/d3ENFX7SzOzD4RHSei76WU73cEEIbhsDFmfxsAJ4hoFxH1GWM21f2I6GNmvtr+E9EjzPxrPLcopfylkdcwDLcbY+4AcFFs8DCAzUkBmHkrgGuJaBSASOJn4WhsbKzLdd2jzPxAEqe1bNLp9KZKpTJsd9mGznkKguBZAIfacFrLdCiKoknHcUaI6Mq6ETPbKKbi/xkiWow7ZlkIMUxaa5+ZVZsAzMwREXWtyvVsFEV7CoXC16u11u2CIAjswZAkZ5b8CDOPVqvViWKxuKS17jXG7CSipwFsISILdpqIzhljtOd59zQDzM3N/TQ4OLjcAA+CgBPs3h4m9yqlpi5ky8w2ks8AOFjfDBH9JqW8vhkgm81OENFSYgC7IyHEVinlbJw7USqVtqRSqUtrtdrJQqEwVxfTWh9g5ldiu9Oe52V93/+OiLYBMETkLSwszBeLxTOJARzH2Z3P5z+xDrZVoyg6SkSFWMDWwZu1Wu3J/v7+leIKguAbALfab2PMDmY+K4SwKfpCCHHMGHO/53lvJwU4qZS60Rr7vt9PRD8AuLg5DUQ0IqXcFwPsBnA8PnhmmfnxdDo9VqlUXCJ6GcC3SqnnEgEw82ue5z0VCx8B8Oga9WKEEAXXdfXMzEzP4uLiPDM7a9geTgxARE9IKd+wQlrrH5n55hYFu1cp9WEMa+vlqo4BABxQSr0ai34J4La1AIjobinlZ7HtXwAu2QiAUaWUvRNscdlCWoG5wDjT09OT6+3tPV8qlbJCiD9aRCp5CgCcXVpayg8MDPyttU4DOMHM25vEawAeVEp9EKeq0YobEQGr8aJSyt4XKJfLmVqttp+Z9zDzZUQ04TjOS/l8fuX4nZqauiKVStlD6/KNioC9w22vD7mue6yFKGz1V6vVTwHc3soOQFspqGtFzHywu7t7OJvNVpoXmJ6evsVxnLcAtOqSutt/Aqg72/ayrTYhhLAP0M3MvBPAnQkvNKvzL4Ckt+E6kU08fUgp9Xzd2j5ITgHIJXbv0JCIHpNS2lN1ZVAYhi8YYxpEHeqv5z6fyWQKfX19fzYAJicnuzOZzEcAdq3n3eH8OSHEfa7r2k5pjMarWGt9l30VE1H9Vdzheg13w8ynUqnUe7lcbqZZ9B/GxP8H1HlPxgAAAABJRU5ErkJggg==",ce=M({name:"col-upload",props:{modelValue:String,tips:{type:String,default:"\u70B9\u51FB\u4E0A\u4F20"},deletable:{type:Boolean,default:!0},cropper:{type:Boolean,default:!1},options:{type:Object,default:{}},onUploadChange:{type:Function,default:t=>{}}},methods:{beforeRead(t){return t.size/1024/1024<5?!0:(ut("\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 5MB"),!1)},beforeDelete(t,e){return!0},async afterRead(t,e){try{t.status="uploading",t.message="\u4E0A\u4F20\u4E2D...";let i=new FormData;i.append("file",t.file);let s=await q.post("/api-teacher/uploadFile",{data:i});this.$emit("update:modelValue",s.data.url),this.onUploadChange(s.data.url)}catch{}},onClose(t){this.$emit("update:modelValue",null),this.onUploadChange(),t.stopPropagation()},async getFile(t){try{let e=new FormData;e.append("file",t);let i=await q.post("/api-teacher/uploadFile",{data:e});this.$emit("update:modelValue",i.data.url),this.onUploadChange(i.data.url)}catch{}}},render(){return ft(()=>this.modelValue),m("div",{class:X["uploader-section"]},[this.modelValue&&this.deletable?m(Y,{name:"cross",onClick:this.onClose,class:X["img-close"]},null):null,this.cropper?m("div",{class:X["col-uploader"]},[this.modelValue?m(W,{fit:"cover",position:"center",class:X.uploadImg,src:this.modelValue},null):m("div",{class:X.uploader},[m(Y,{name:et,size:"32"},null),m("p",{class:X.uploaderText},[this.tips])]),m(Kt,{option:this.options,getFile:this.getFile},null)]):m(dt,{afterRead:this.afterRead,beforeRead:this.beforeRead,beforeDelete:this.beforeDelete},{default:()=>this.modelValue?m(W,{fit:"cover",position:"center",class:X.uploadImg,src:this.modelValue},null):m("div",{class:X.uploader},[m(Y,{name:et,size:"32"},null),m("p",{class:X.uploaderText},[this.tips])])})])}});export{ne as C,he as S,oe as _,ae as a,le as b,ce as c};