"use strict";const e=require("../../../common/vendor.js"),r=require("../../index.js");require("../../url/index.js"),require("../../store/index.js"),require("../../store/app.js"),require("../../api/promotion/diy.js"),require("../../request/index.js"),require("../../config/index.js"),require("../../platform/index.js"),require("../../platform/provider/wechat/index.js"),require("../../platform/provider/wechat/miniProgram.js"),require("../../api/member/auth.js"),require("../../api/member/social.js"),require("../../api/member/user.js"),require("../../platform/provider/apple/index.js"),require("../../platform/share.js"),require("../../router/index.js"),require("../../hooks/useModal.js"),require("../../helper/index.js"),require("../../helper/test.js"),require("../../helper/digit.js"),require("../../api/member/signin.js"),require("../../helper/throttle.js"),require("../../platform/pay.js"),require("../../api/pay/order.js"),require("../../store/user.js"),require("../../store/cart.js"),require("../../api/trade/cart.js"),require("../../api/pay/wallet.js"),require("../../api/trade/order.js"),require("../../api/promotion/coupon.js"),require("../../store/sys.js"),require("../../store/modal.js"),require("../../config/zIndex.js");const i={name:"uploadImage",emits:["uploadFiles","choose","delFile"],props:{filesList:{type:[Array,String],default:()=>[]},disabled:{type:Boolean,default:!1},disablePreview:{type:Boolean,default:!1},limit:{type:[Number,String],default:9},imageStyles:{type:Object,default:()=>({width:"auto",height:"auto",border:{}})},delIcon:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1}},computed:{list(){return"string"==typeof this.filesList?this.filesList?[this.filesList]:[]:this.filesList},styles(){return Object.assign({width:"auto",height:"auto",border:{}},this.imageStyles)},boxStyle(){const{width:e="auto",height:r="auto"}=this.styles;let i={};"auto"===r?"auto"!==e?(i.height=this.value2px(e),i["padding-top"]=0):i.height=0:(i.height=this.value2px(r),i["padding-top"]=0),i.width="auto"===e?"auto"!==r?this.value2px(r):"33.3%":this.value2px(e);let t="";for(let s in i)t+=`${s}:${i[s]};`;return t},borderStyle(){let{border:e}=this.styles,r={};if("boolean"==typeof e)r.border=e?"1px #eee solid":"none";else{let i=e&&e.width||1;i=this.value2px(i);let t=e&&e.radius||3;t=this.value2px(t),r={"border-width":i,"border-style":e&&e.style||"solid","border-color":e&&e.color||"#eee","border-radius":t}}let i="";for(let t in r)i+=`${t}:${r[t]};`;return i}},methods:{getImageUrl:e=>"blob:http:"===e.substr(0,10)?e:r.sheep.$url.cdn(e),uploadFiles(e,r){this.$emit("uploadFiles",e)},choose(){this.$emit("choose")},delFile(e){this.$emit("delFile",e)},previewImage(r,i){let t=[];1===Number(this.limit)&&this.disablePreview&&!this.disabled&&this.$emit("choose"),this.disablePreview||(this.list.forEach((e=>{t.push(this.getImageUrl(e))})),e.index.previewImage({urls:t,current:i}))},value2px:e=>("number"==typeof e?e+="px":-1===e.indexOf("%")&&(e=-1!==e.indexOf("px")?e:e+"px"),e)}};const t=e._export_sfc(i,[["render",function(r,i,t,s,o,l){return e.e({a:e.f(l.list,((r,i,s)=>e.e({a:l.getImageUrl(r),b:e.o((e=>l.previewImage(r,i)),i)},t.delIcon&&!t.readonly?{c:e.o((e=>l.delFile(i)),i)}:{},{d:i}))),b:t.delIcon&&!t.readonly,c:e.s(l.borderStyle),d:e.s(l.boxStyle),e:l.list.length<t.limit&&!t.readonly},l.list.length<t.limit&&!t.readonly?{f:e.s(l.borderStyle),g:e.o(((...e)=>l.choose&&l.choose(...e))),h:e.s(l.boxStyle)}:{})}]]);wx.createComponent(t);
