"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[1243,7230,3882],{37230:function(e,t){t["Z"]={id:1,testUrl:"http://192.168.1.5:10086",zIndex:2,setColor:(e,t,l)=>new Promise((i=>{var a=void 0==l?.min?5:l.min,o=void 0==l?.max?5:l.max,s=new Image;s.src=t;s.onload=()=>{const t=s.width,l=s.height,n=document.createElement("canvas");n.width=t,n.height=l;var r=n.getContext("2d");r.drawImage(s,0,0);var c=r.getImageData(0,0,t,l),d=[];for(let i=0;i<e.length;i++){var p=0;for(let t=0;t<c.data.length;t+=4){var u=c.data[t],g=c.data[t+1],m=c.data[t+2];c.data[t+3];u-a<e[i][0]&&u+o>e[i][0]&&g-a<e[i][1]&&g+o>e[i][1]&&m-a<e[i][2]&&m+o>e[i][2]&&p++}let n={rgb:e[i],ratio:parseInt(String((p/(t*l)*100).toFixed(6)))};d.push(n),s.remove()}i({width:t,height:l,ratio:d})}}))}},31243:function(e,t,l){l.r(t),l.d(t,{default:function(){return F}});var i=l(66252),a=l(49963),o=l(3577);const s=e=>((0,i.dD)("data-v-71672748"),e=e(),(0,i.Cn)(),e),n={class:"upload"},r={class:"successfullyUpload"},c={class:"img"},d={class:"upload_file_item_content"},p={class:"upload_file_item_content"},u=["src"],g={class:"color"},m=["onClick"],h=s((()=>(0,i._)("div",{class:"upload_tip_block"},[(0,i._)("i",{class:"fi fi-br-upload"})],-1)));function D(e,t,l,s,D,f){const v=(0,i.up)("a-spin"),w=(0,i.up)("a-upload");return(0,i.wg)(),(0,i.iD)("div",n,[(0,i.wy)((0,i._)("div",r,[(0,i._)("div",c,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.uploadList?.[e.selectDetail.id],(l=>((0,i.wg)(),(0,i.iD)("div",{class:"upload_file_item",key:l},[(0,i.wy)((0,i._)("div",d,[(0,i.Wm)(v,{indicator:e.indicator,tip:"Uploading..."},null,8,["indicator"])],512),[[a.F8,"done"!==l.status]]),(0,i.wy)((0,i._)("div",p,[(0,i._)("img",{src:l?.imgUrl,class:"upload_img"},null,8,u),(0,i._)("div",{class:"delete_file_block",onClick:t[0]||(t[0]=t=>e.colorDeleteFile(e.index))},(0,o.zw)(e.$t("DesignDetailAlter.Delete")),1)],512),[[a.F8,"done"===l.status]])])))),128))]),(0,i._)("div",g,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.colorList?.[e.selectDetail.id],(t=>((0,i.wg)(),(0,i.iD)("div",{key:t,onClick:l=>e.selectColor(t),style:(0,o.j5)({"background-color":t.hex})},null,12,m)))),128))])],512),[[a.F8,e.uploadList?.[e.selectDetail.id]?.length>=1]]),(0,i.wy)((0,i.Wm)(w,{capture:null,"list-type":"picture-card",customRequest:function(){},onChange:e.fileUploadChange,"before-upload":e.beforeUpload,action:null,accept:".jpg,.png,.jpeg,.bmp"},{default:(0,i.w5)((()=>[h])),_:1},8,["customRequest","onChange","before-upload"]),[[a.F8,!e.uploadList?.[e.selectDetail.id]||e.uploadList?.[e.selectDetail.id]?.length<1]])])}var f=l(2262),v=l(61446),w=l(4873),_=l(33907),C=l(37230),b=l(50320),L=l(8552),y=l(47332),U=(0,i.aZ)({components:{},emits:["selectUplpadColor"],setup(e,{emit:t}){const{t:l}=(0,L.QT)(),a=(0,_.oR)(),o=(0,f.qj)({selectDetail:(0,i.Fl)((()=>a.state.DesignDetailCopy.selectDetail)),uploadList:{},indicator:(0,i.h)(b.Z,{style:{fontSize:"2.4rem"},spin:!0}),colorList:{}}),s=e=>{let t=e.file,l=t.originFileObj;var i=new FileReader;i.onload=e=>{let l;l="object"===typeof e.target.result?window.URL.createObjectURL(new Blob([e.target.result])):e.target.result,t.imgUrl=l,t.status="done",o.uploadList[o.selectDetail.id]||(o.uploadList[o.selectDetail.id]=[]),o.uploadList[o.selectDetail.id].push(t),setTimeout((async()=>{const e=new Image;e.src=t.imgUrl,e.onload=async()=>{const l=new ColorThief;let i,a=[],s=l.getPalette(e,8),n={max:5,min:5};await C.Z.setColor(s,t.imgUrl,n).then((e=>{e&&(i=e.ratio)})),i.sort(((e,t)=>{var l=e.ratio,i=t.ratio;return i-l})),s=[],i.forEach((e=>{s.push(e.rgb)})),s=s.join("&"),s=s.split("&");let r=s[0].split(","),c=((0,y.s)(r),[]);new Set(s).forEach((e=>{c.push(e.split(","))})),c.forEach((e=>{let t=(0,y.s)(e);a.push({rgba:{r:e[0],g:e[1],b:e[2],a:1},hex:t})})),o.colorList[o.selectDetail.id]||(o.colorList[o.selectDetail.id]=[]),o.colorList[o.selectDetail.id]=a,e.remove()}}),100)},i.readAsDataURL(l)},n=e=>{const t="image/jpeg"===e.type||"image/png"===e.type||"image/jpg"===e.type||"image/bmp"===e.type;t||v.ZP.info(l("DesignDetailAlter.jsContent4"));const i=e.size/1024/1024<5;return i||v.ZP.info(l("DesignDetailAlter.jsContent5")),t&&i||w.Z.LIST_IGNORE},r=e=>{t("selectUplpadColor",e)},c=()=>{o.uploadList[o.selectDetail.id]=[],o.colorList[o.selectDetail.id]=[]};return{...(0,f.BK)(o),fileUploadChange:s,beforeUpload:n,colorDeleteFile:c,selectColor:r}},provide(){return{}}}),j=l(83744);const k=(0,j.Z)(U,[["render",D],["__scopeId","data-v-71672748"]]);var F=k}}]);