vant/static/js/async/6030.34f2dfb7.js
2024-04-20 08:49:23 +00:00

2 lines
22 KiB
JavaScript

/*! For license information please see 6030.34f2dfb7.js.LICENSE.txt */
(self.webpackChunk=self.webpackChunk||[]).push([["6030"],{98156:function(e,a,l){"use strict";l.r(a);var t=l("59824");l("4342");let i=t.Z;a.default=i},59824:function(e,a,l){"use strict";l("31564"),l("8649"),l("70629");var t=l("80681"),i=l("11848"),r=l("57122"),o=l("37187"),n=l("99497"),u=l("54369"),s=l("24647"),d=l("13118"),v={class:"preview-cover van-ellipsis"};a.Z=(0,t.aZ)({__name:"index",setup(e){var a=(0,u.q)({"zh-CN":{status:"\u4E0A\u4F20\u72B6\u6001",failed:"\u4E0A\u4F20\u5931\u8D25",upload:"\u4E0A\u4F20\u6587\u4EF6",preview:"\u6587\u4EF6\u9884\u89C8",maxSize:"\u9650\u5236\u4E0A\u4F20\u5927\u5C0F",disabled:"\u7981\u7528\u6587\u4EF6\u4E0A\u4F20",maxCount:"\u9650\u5236\u4E0A\u4F20\u6570\u91CF",uploading:"\u4E0A\u4F20\u4E2D...",imageName:"\u56FE\u7247\u540D\u79F0",beforeRead:"\u4E0A\u4F20\u524D\u7F6E\u5904\u7406",overSizeTip:"\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 500kb",invalidType:"\u8BF7\u4E0A\u4F20 jpg \u683C\u5F0F\u56FE\u7247",customUpload:"\u81EA\u5B9A\u4E49\u4E0A\u4F20\u6837\u5F0F",previewSize:"\u81EA\u5B9A\u4E49\u9884\u89C8\u5927\u5C0F",previewCover:"\u81EA\u5B9A\u4E49\u9884\u89C8\u6837\u5F0F",deleteMessage:"\u5220\u9664\u524D\u7F6E\u5904\u7406",customPreviewImage:"\u81EA\u5B9A\u4E49\u5355\u4E2A\u56FE\u7247\u9884\u89C8",reupload:"\u5F00\u542F\u8986\u76D6\u4E0A\u4F20"},"en-US":{status:"Upload Status",failed:"Failed",upload:"Upload File",preview:"Preview File",maxSize:"Max Size",disabled:"Disable Uploader",maxCount:"Max Count",uploading:"Uploading...",imageName:"Image Name",beforeRead:"Before Read",overSizeTip:"File size cannot exceed 500kb",invalidType:"Please upload an image in jpg format",customUpload:"Custom Upload Area",previewSize:"Preview Size",previewCover:"Preview Cover",deleteMessage:"Before Delete",customPreviewImage:"Custom single preview image",reupload:"Enable Reupload"}}),l=(0,i.iH)([{url:(0,s.RQ)("leaf.jpeg")},{url:(0,s.RQ)("tree.jpeg")}]),c=(0,i.iH)([{url:(0,s.RQ)("sand.jpeg")}]),p=(0,i.iH)([]),m=(0,i.iH)([{url:(0,s.RQ)("sand.jpeg")}]),f=(0,i.iH)([{url:(0,s.RQ)("sand.jpeg"),deletable:!0,beforeDelete:()=>{(0,d.CF)(a("deleteMessage"))}},{url:(0,s.RQ)("tree.jpeg"),imageFit:"contain"}]),g=(0,i.iH)([{url:(0,s.RQ)("leaf.jpeg"),status:"uploading",message:a("uploading")},{url:(0,s.RQ)("tree.jpeg"),status:"failed",message:a("failed")}]),w=(0,i.iH)([{url:(0,s.RQ)("leaf.jpeg"),file:{name:a("imageName")}}]),h=(0,i.iH)([{url:(0,s.RQ)("leaf.jpeg")}]),S=e=>!!Array.isArray(e)||"image/jpeg"===e.type||((0,d.CF)(a("invalidType")),!1),b=(e,a)=>{console.log(e,a)},P=e=>{e.status="uploading",e.message=a("uploading"),setTimeout(()=>{e.status="failed",e.message=a("failed")},1e3)},y=e=>{Array.isArray(e)?e.forEach(P):P(e)},U=(e,l)=>{console.log(e,l),(0,d.CF)(a("overSizeTip"))},W=(0,i.iH)([{url:(0,s.RQ)("leaf.jpeg")}]);return(e,u)=>{var s=(0,t.up)("demo-block");return(0,t.wg)(),(0,t.iD)(t.HY,null,[(0,t.Wm)(s,{title:(0,i.SU)(a)("basicUsage")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{"after-read":b})]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("preview")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=e=>l.value=e),multiple:"",accept:"*"},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("status")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:g.value,"onUpdate:modelValue":u[1]||(u[1]=e=>g.value=e),"after-read":y},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("maxCount")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:c.value,"onUpdate:modelValue":u[2]||(u[2]=e=>c.value=e),multiple:"","max-count":2},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("maxSize")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:m.value,"onUpdate:modelValue":u[3]||(u[3]=e=>m.value=e),multiple:"","max-size":512e3,onOversize:U},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("customUpload")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),null,{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(n.ZP),{type:"primary",icon:"plus"},{default:(0,t.w5)(()=>[(0,t.Uk)((0,r.zw)((0,i.SU)(a)("upload")),1)]),_:1})]),_:1})]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("previewCover")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:w.value,"onUpdate:modelValue":u[4]||(u[4]=e=>w.value=e)},{"preview-cover":(0,t.w5)(e=>{var{file:a}=e;return[(0,t._)("div",v,(0,r.zw)(a.name),1)]}),_:1},8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("previewSize")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:h.value,"onUpdate:modelValue":u[5]||(u[5]=e=>h.value=e),"preview-size":"60"},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("beforeRead")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:p.value,"onUpdate:modelValue":u[6]||(u[6]=e=>p.value=e),"before-read":S},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("disabled")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{"after-read":b,disabled:""})]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("customPreviewImage")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:f.value,"onUpdate:modelValue":u[7]||(u[7]=e=>f.value=e),multiple:"",accept:"*",deletable:!1},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(s,{title:(0,i.SU)(a)("reupload")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,i.SU)(o.ZP),{modelValue:W.value,"onUpdate:modelValue":u[8]||(u[8]=e=>W.value=e),reupload:"","max-count":"2"},null,8,["modelValue"])]),_:1},8,["title"])],64)}}})},99497:function(e,a,l){"use strict";l.d(a,{zx:function(){return r}});var t=l("63112"),i=l("14314"),r=(0,t.n)(i.Z);a.ZP=r},6149:function(e,a,l){"use strict";l.d(a,{BC:function(){return r},g2:function(){return i},yj:function(){return o}}),l("56115"),l("59644");var t=l("80681"),i={to:[String,Object],url:String,replace:Boolean};function r(e){var{to:a,url:l,replace:t,$router:i}=e;a&&i?i[t?"replace":"push"](a):l&&(t?location.replace(l):location.href=l)}function o(){var e=(0,t.FN)().proxy;return()=>r(e)}},95786:function(e,a,l){"use strict";l.d(a,{gb:function(){return r}});var t=l("63112"),i=l("2309"),r=(0,t.n)(i.Z);a.ZP=r},32823:function(e,a,l){"use strict";l.d(a,{j:function(){return r}});var t=l("63112"),i=l("89408"),r=(0,t.n)(i.Z);a.Z=r},59973:function(e,a,l){"use strict";l.d(a,{oF:function(){return r}});var t=l("63112"),i=l("87373"),r=(0,t.n)(i.ZP);a.ZP=r},37187:function(e,a,l){"use strict";var t=l("63112"),i=l("61973"),r=(0,t.n)(i.Z);a.ZP=r},2735:function(e,a,l){"use strict";l.d(a,{CO:function(){return p},O2:function(){return u},PH:function(){return o},Rz:function(){return d},t:function(){return n},u2:function(){return r},zf:function(){return s}}),l("82116"),l("17989"),l("40944"),l("63773"),l("97687"),l("70629"),l("31564"),l("8649"),l("61557"),l("59644");var t=l("62568"),i=l("12308"),[r,o,n]=(0,t.do)("uploader");function u(e,a){return new Promise(l=>{if("file"===a){l();return}var t=new FileReader;t.onload=e=>{l(e.target.result)},"dataUrl"===a?t.readAsDataURL(e):"text"===a&&t.readAsText(e)})}function s(e,a){return(0,i.qo)(e).some(e=>{if(e.file)return(0,i.mf)(a)?a(e.file):e.file.size>+a;return!1})}function d(e,a){var l=[],t=[];return e.forEach(e=>{s(e,a)?t.push(e):l.push(e)}),{valid:l,invalid:t}}var v=/\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i,c=e=>v.test(e);function p(e){return!!e.isImage||(e.file&&e.file.type?0===e.file.type.indexOf("image"):e.url?c(e.url):"string"==typeof e.content&&0===e.content.indexOf("data:image"))}},14314:function(e,a,l){"use strict";l("82116"),l("17989"),l("24660");var t=l("80681"),i=l("62568"),r=l("12308"),o=l("78335"),n=l("82210"),u=l("8051"),s=l("6149"),d=l("96528"),v=l("95786"),[c,p]=(0,i.do)("button"),m=(0,r.l7)({},s.g2,{tag:(0,o.SQ)("button"),text:String,icon:String,type:(0,o.SQ)("default"),size:(0,o.SQ)("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:(0,o.SQ)("button"),loadingSize:o.Or,loadingText:String,loadingType:String,iconPosition:(0,o.SQ)("left")});a.Z=(0,t.aZ)({name:c,props:m,emits:["click"],setup(e,a){var{emit:l,slots:i}=a,r=(0,s.yj)(),o=()=>i.loading?i.loading():(0,t.Wm)(v.gb,{size:e.loadingSize,type:e.loadingType,class:p("loading")},null),c=()=>e.loading?o():i.icon?(0,t.Wm)("div",{class:p("icon")},[i.icon()]):e.icon?(0,t.Wm)(d.JO,{name:e.icon,class:p("icon"),classPrefix:e.iconPrefix},null):void 0,m=()=>{var a;if(a=e.loading?e.loadingText:i.default?i.default():e.text)return(0,t.Wm)("span",{class:p("text")},[a])},f=()=>{var{color:a,plain:l}=e;if(a){var t={color:l?a:"white"};return!l&&(t.background=a),a.includes("gradient")?t.border=0:t.borderColor=a,t}},g=a=>{e.loading?(0,n.PF)(a):!e.disabled&&(l("click",a),r())};return()=>{var{tag:a,type:l,size:i,block:r,round:o,plain:n,square:s,loading:d,disabled:v,hairline:w,nativeType:h,iconPosition:S}=e,b=[p([l,i,{plain:n,block:r,round:o,square:s,loading:d,disabled:v,hairline:w}]),{[u._K]:w}];return(0,t.Wm)(a,{type:h,class:b,style:f(),disabled:v,onClick:g},{default:()=>[(0,t.Wm)("div",{class:p("content")},["left"===S&&c(),m(),"right"===S&&c()])]})}}})},2309:function(e,a,l){"use strict";l("82116"),l("17989"),l("66786"),l("14529");var t=l("80681"),i=l("62568"),r=l("78335"),o=l("12308"),n=l("20358"),[u,s]=(0,i.do)("loading"),d=Array(12).fill(null).map((e,a)=>(0,t.Wm)("i",{class:s("line",String(a+1))},null)),v=(0,t.Wm)("svg",{class:s("circular"),viewBox:"25 25 50 50"},[(0,t.Wm)("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),c={size:r.Or,type:(0,r.SQ)("circular"),color:String,vertical:Boolean,textSize:r.Or,textColor:String};a.Z=(0,t.aZ)({name:u,props:c,setup(e,a){var{slots:l}=a,i=(0,t.Fl)(()=>(0,o.l7)({color:e.color},(0,n.Xn)(e.size))),r=()=>{var a="spinner"===e.type?d:v;return(0,t.Wm)("span",{class:s("spinner",e.type),style:i.value},[l.icon?l.icon():a])},u=()=>{if(l.default){var a;return(0,t.Wm)("span",{class:s("text"),style:{fontSize:(0,n.Nn)(e.textSize),color:null!==(a=e.textColor)&&void 0!==a?a:e.color}},[l.default()])}};return()=>{var{type:a,vertical:l}=e;return(0,t.Wm)("div",{class:s([a,{vertical:l}]),"aria-live":"polite","aria-busy":!0},[r(),u()])}}})},89408:function(e,a,l){"use strict";l("82116"),l("17989");var t=l("80681"),i=l("11848"),r=l("62568"),o=l("87373"),n=l("22300"),u=l("10023"),[s,d]=(0,r.do)("swipe-item");a.Z=(0,t.aZ)({name:s,setup(e,a){var l,{slots:r}=a,s=(0,i.qj)({offset:0,inited:!1,mounted:!1}),{parent:v,index:c}=(0,n.NB)(o.PG);if(v){var p=(0,t.Fl)(()=>{var e={},{vertical:a}=v.props;return v.size.value&&(e[a?"height":"width"]="".concat(v.size.value,"px")),s.offset&&(e.transform="translate".concat(a?"Y":"X","(").concat(s.offset,"px)")),e}),m=(0,t.Fl)(()=>{var{loop:e,lazyRender:a}=v.props;if(!a||l)return!0;if(!s.mounted)return!1;var t=v.activeIndicator.value,i=v.count.value-1;return l=c.value===t||c.value===(0===t&&e?i:t-1)||c.value===(t===i&&e?0:t+1)});return(0,t.bv)(()=>{(0,t.Y3)(()=>{s.mounted=!0})}),(0,u.F)({setOffset:e=>{s.offset=e}}),()=>{var e;return(0,t.Wm)("div",{class:d(),style:p.value},[m.value?null===(e=r.default)||void 0===e?void 0:e.call(r):null])}}}})},87373:function(e,a,l){"use strict";l.d(a,{PG:function(){return g}}),l("82116"),l("17989"),l("86795"),l("31564"),l("8649"),l("70629"),l("66786"),l("14529");var t=l("80681"),i=l("11848"),r=l("62568"),o=l("78335"),n=l("20358"),u=l("82210"),s=l("22300"),d=l("29609"),v=l("10023"),c=l("65170"),[p,m]=(0,r.do)("swipe"),f={loop:o.J5,width:o.Or,height:o.Or,vertical:Boolean,autoplay:(0,o.SI)(0),duration:(0,o.SI)(500),touchable:o.J5,lazyRender:Boolean,initialSwipe:(0,o.SI)(0),indicatorColor:String,showIndicators:o.J5,stopPropagation:o.J5},g=Symbol(p);a.ZP=(0,t.aZ)({name:p,props:f,emits:["change","dragStart","dragEnd"],setup(e,a){var l,r,{emit:o,slots:p}=a,f=(0,i.iH)(),w=(0,i.iH)(),h=(0,i.qj)({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),S=!1,b=(0,d.o)(),{children:P,linkChildren:y}=(0,s.$E)(g),U=(0,t.Fl)(()=>P.length),W=(0,t.Fl)(()=>h[e.vertical?"height":"width"]),x=(0,t.Fl)(()=>e.vertical?b.deltaY.value:b.deltaX.value),z=(0,t.Fl)(()=>h.rect?(e.vertical?h.rect.height:h.rect.width)-W.value*U.value:0),C=(0,t.Fl)(()=>W.value?Math.ceil(Math.abs(z.value)/W.value):U.value),V=(0,t.Fl)(()=>U.value*W.value),Z=(0,t.Fl)(()=>(h.active+U.value)%U.value),F=(0,t.Fl)(()=>{var a=e.vertical?"vertical":"horizontal";return b.direction.value===a}),R=(0,t.Fl)(()=>{var a={transitionDuration:"".concat(h.swiping?0:e.duration,"ms"),transform:"translate".concat(e.vertical?"Y":"X","(").concat(+h.offset.toFixed(2),"px)")};if(W.value){var l=e.vertical?"height":"width",t=e.vertical?"width":"height";a[l]="".concat(V.value,"px"),a[t]=e[t]?"".concat(e[t],"px"):""}return a}),j=a=>{var{active:l}=h;if(a)return e.loop?(0,n.uZ)(l+a,-1,U.value):(0,n.uZ)(l+a,0,C.value);return l},H=function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=a*W.value;!e.loop&&(t=Math.min(t,-z.value));var i=l-t;return!e.loop&&(i=(0,n.uZ)(i,z.value,0)),i},O=a=>{var{pace:l=0,offset:t=0,emitChange:i}=a;if(!(U.value<=1)){var{active:r}=h,n=j(l),u=H(n,t);if(e.loop){if(P[0]&&u!==z.value){var s=u<z.value;P[0].setOffset(s?V.value:0)}if(P[U.value-1]&&0!==u){var d=u>0;P[U.value-1].setOffset(d?-V.value:0)}}h.active=n,h.offset=u,i&&n!==r&&o("change",Z.value)}},k=()=>{h.swiping=!0,h.active<=-1?O({pace:U.value}):h.active>=U.value&&O({pace:-U.value})},B=()=>{k(),b.reset(),(0,s.d1)(()=>{h.swiping=!1,O({pace:1,emitChange:!0})})},T=()=>clearTimeout(l),I=()=>{T(),+e.autoplay>0&&U.value>1&&(l=setTimeout(()=>{B(),I()},+e.autoplay))},Q=function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:+e.initialSwipe;if(f.value){var l=()=>{if(!(0,u.xj)(f)){var l,t,i={width:f.value.offsetWidth,height:f.value.offsetHeight};h.rect=i,h.width=+(null!==(l=e.width)&&void 0!==l?l:i.width),h.height=+(null!==(t=e.height)&&void 0!==t?t:i.height)}U.value&&-1===(a=Math.min(U.value-1,a))&&(a=U.value-1),h.active=a,h.swiping=!0,h.offset=H(a),P.forEach(e=>{e.setOffset(0)}),I()};(0,u.xj)(f)?(0,t.Y3)().then(l):l()}},A=()=>Q(h.active),_=a=>{e.touchable&&!(a.touches.length>1)&&(b.start(a),S=!1,r=Date.now(),T(),k())},J=()=>{if(e.touchable&&h.swiping){var a=Date.now()-r;if((Math.abs(x.value/a)>.25||Math.abs(x.value)>W.value/2)&&F.value){var l=e.vertical?b.offsetY.value:b.offsetX.value,t=0;O({pace:t=e.loop?l>0?x.value>0?-1:1:0:-Math[x.value>0?"ceil":"floor"](x.value/W.value),emitChange:!0})}else x.value&&O({pace:0});S=!1,h.swiping=!1,o("dragEnd",{index:Z.value}),I()}},M=(a,l)=>{var i=l===Z.value,r=i?{backgroundColor:e.indicatorColor}:void 0;return(0,t.Wm)("i",{style:r,class:m("indicator",{active:i})},null)},Y=()=>p.indicator?p.indicator({active:Z.value,total:U.value}):e.showIndicators&&U.value>1?(0,t.Wm)("div",{class:m("indicators",{vertical:e.vertical})},[Array(U.value).fill("").map(M)]):void 0;return(0,v.F)({prev:()=>{k(),b.reset(),(0,s.d1)(()=>{h.swiping=!1,O({pace:-1,emitChange:!0})})},next:B,state:h,resize:A,swipeTo:function(a){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};k(),b.reset(),(0,s.d1)(()=>{var t;t=e.loop&&a===U.value?0===h.active?0:a:a%U.value,l.immediate?(0,s.d1)(()=>{h.swiping=!1}):h.swiping=!1,O({pace:t-h.active,emitChange:!0})})}}),y({size:W,props:e,count:U,activeIndicator:Z}),(0,t.YP)(()=>e.initialSwipe,e=>Q(+e)),(0,t.YP)(U,()=>Q(h.active)),(0,t.YP)(()=>e.autoplay,I),(0,t.YP)([u.bn,u.uK,()=>e.width,()=>e.height],A),(0,t.YP)((0,s.d9)(),e=>{"visible"===e?I():T()}),(0,t.bv)(Q),(0,t.dl)(()=>Q(h.active)),(0,c.h)(()=>Q(h.active)),(0,t.se)(T),(0,t.Jd)(T),(0,s.OR)("touchmove",a=>{e.touchable&&h.swiping&&(b.move(a),F.value&&!(!e.loop&&(0===h.active&&x.value>0||h.active===U.value-1&&x.value<0))&&((0,u.PF)(a,e.stopPropagation),O({offset:x.value}),!S&&(o("dragStart",{index:Z.value}),S=!0)))},{target:w}),()=>{var a;return(0,t.Wm)("div",{ref:f,class:m()},[(0,t.Wm)("div",{ref:w,style:R.value,class:m("track",{vertical:e.vertical}),onTouchstartPassive:_,onTouchend:J,onTouchcancel:J},[null===(a=p.default)||void 0===a?void 0:a.call(p)]),Y()])}}})},61973:function(e,a,l){"use strict";l("82116"),l("17989"),l("40944"),l("66786"),l("14529"),l("61322"),l("30480"),l("95128"),l("31042"),l("13466"),l("96245"),l("37232"),l("70629"),l("61557"),l("31564"),l("8649");var t=l("80681"),i=l("39594"),r=l("11848"),o=l("78335"),n=l("12308"),u=l("20358"),s=l("2735"),d=l("22300"),v=l("10023"),c=l("96528"),p=l("62475"),m=l("63901"),f={name:(0,o.SI)(""),accept:(0,o.SQ)("image/*"),capture:String,multiple:Boolean,disabled:Boolean,readonly:Boolean,lazyLoad:Boolean,maxCount:(0,o.SI)(1/0),imageFit:(0,o.SQ)("cover"),resultType:(0,o.SQ)("dataUrl"),uploadIcon:(0,o.SQ)("photograph"),uploadText:String,deletable:o.J5,reupload:Boolean,afterRead:Function,showUpload:o.J5,modelValue:(0,o.Ce)(),beforeRead:Function,beforeDelete:Function,previewSize:[Number,String,Array],previewImage:o.J5,previewOptions:Object,previewFullImage:o.J5,maxSize:{type:[Number,String,Function],default:1/0}};a.Z=(0,t.aZ)({name:s.u2,props:f,emits:["delete","oversize","clickUpload","closePreview","clickPreview","clickReupload","update:modelValue"],setup(e,a){var l,{emit:o,slots:f}=a,g=(0,r.iH)(),w=[],h=(0,r.iH)(-1),S=(0,r.iH)(!1),b=function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.modelValue.length;return{name:e.name,index:a}},P=()=>{g.value&&(g.value.value="")},y=a=>{if(P(),(0,s.zf)(a,e.maxSize)){if(Array.isArray(a)){var l=(0,s.Rz)(a,e.maxSize);if(a=l.valid,o("oversize",l.invalid,b()),!a.length)return}else{o("oversize",a,b());return}}if(a=(0,r.qj)(a),h.value>-1){var t=[...e.modelValue];t.splice(h.value,1,a),o("update:modelValue",t),h.value=-1}else o("update:modelValue",[...e.modelValue,...(0,n.qo)(a)]);e.afterRead&&e.afterRead(a,b())},U=a=>{var{maxCount:l,modelValue:t,resultType:i}=e;if(Array.isArray(a)){var r=+l-t.length;a.length>r&&(a=a.slice(0,r)),Promise.all(a.map(e=>(0,s.O2)(e,i))).then(e=>{y(a.map((a,l)=>{var t={file:a,status:"",message:"",objectUrl:URL.createObjectURL(a)};return e[l]&&(t.content=e[l]),t}))})}else(0,s.O2)(a,i).then(e=>{var l={file:a,status:"",message:"",objectUrl:URL.createObjectURL(a)};e&&(l.content=e),y(l)})},W=a=>{var{files:l}=a.target;if(!e.disabled&&l&&l.length){var t=1===l.length?l[0]:[].slice.call(l);if(e.beforeRead){var i=e.beforeRead(t,b());if(!i){P();return}if((0,n.tI)(i)){i.then(e=>{e?U(e):U(t)}).catch(P);return}}U(t)}},x=()=>o("closePreview"),z=a=>{if(e.previewFullImage){var t=e.modelValue.filter(s.CO),i=t.map(e=>(e.objectUrl&&!e.url&&"failed"!==e.status&&(e.url=e.objectUrl,w.push(e.url)),e.url)).filter(Boolean);l=(0,p.V)((0,n.l7)({images:i,startPosition:t.indexOf(a),onClose:x},e.previewOptions))}},C=(a,l)=>{var t=e.modelValue.slice(0);t.splice(l,1),o("update:modelValue",t),o("delete",a,b(l))},V=e=>{S.value=!0,h.value=e,(0,t.Y3)(()=>O())},Z=()=>{!S.value&&(h.value=-1),S.value=!1},F=(a,l)=>{var i=["imageFit","deletable","reupload","previewSize","beforeDelete"],r=(0,n.l7)((0,n.ei)(e,i),(0,n.ei)(a,i,!0));return(0,t.Wm)(m.Z,(0,t.dG)({item:a,index:l,onClick:()=>o(e.reupload?"clickReupload":"clickPreview",a,b(l)),onDelete:()=>C(a,l),onPreview:()=>z(a),onReupload:()=>V(l)},(0,n.ei)(e,["name","lazyLoad"]),r),(0,n.ei)(f,["preview-cover","preview-delete"]))},R=()=>{if(e.previewImage)return e.modelValue.map(F)},j=e=>o("clickUpload",e),H=()=>{if(!(e.modelValue.length>=+e.maxCount)||e.reupload){var a=e.modelValue.length>=+e.maxCount&&e.reupload,l=e.readonly?null:(0,t.Wm)("input",{ref:g,type:"file",class:(0,s.PH)("input"),accept:e.accept,capture:e.capture,multiple:e.multiple&&-1===h.value,disabled:e.disabled,onChange:W,onClick:Z},null);return f.default?(0,t.wy)((0,t.Wm)("div",{class:(0,s.PH)("input-wrapper"),onClick:j},[f.default(),l]),[[i.F8,!a]]):(0,t.wy)((0,t.Wm)("div",{class:(0,s.PH)("upload",{readonly:e.readonly}),style:(0,u.Xn)(e.previewSize),onClick:j},[(0,t.Wm)(c.JO,{name:e.uploadIcon,class:(0,s.PH)("upload-icon")},null),e.uploadText&&(0,t.Wm)("span",{class:(0,s.PH)("upload-text")},[e.uploadText]),l]),[[i.F8,e.showUpload&&!a]])}},O=()=>{g.value&&!e.disabled&&g.value.click()};return(0,t.Jd)(()=>{w.forEach(e=>URL.revokeObjectURL(e))}),(0,v.F)({chooseFile:O,closeImagePreview:()=>{l&&l.close()}}),(0,d.aM)(()=>e.modelValue),()=>(0,t.Wm)("div",{class:(0,s.PH)()},[(0,t.Wm)("div",{class:(0,s.PH)("wrapper",{disabled:e.disabled})},[R(),H()])])}})},63901:function(e,a,l){"use strict";var t=l("80681"),i=l("2735"),r=l("78335"),o=l("12308"),n=l("55987"),u=l("20358"),s=l("96528"),d=l("7197"),v=l("95786");a.Z=(0,t.aZ)({props:{name:r.Or,item:(0,r.ir)(Object),index:Number,imageFit:String,lazyLoad:Boolean,deletable:Boolean,reupload:Boolean,previewSize:[Number,String,Array],beforeDelete:Function},emits:["delete","preview","reupload"],setup(e,a){var{emit:l,slots:r}=a,c=()=>{var{status:a,message:l}=e.item;if("uploading"===a||"failed"===a){var r="failed"===a?(0,t.Wm)(s.JO,{name:"close",class:(0,i.PH)("mask-icon")},null):(0,t.Wm)(v.gb,{class:(0,i.PH)("loading")},null),n=(0,o.Xq)(l)&&""!==l;return(0,t.Wm)("div",{class:(0,i.PH)("mask")},[r,n&&(0,t.Wm)("div",{class:(0,i.PH)("mask-message")},[l])])}},p=a=>{var{name:t,item:i,index:r,beforeDelete:o}=e;a.stopPropagation(),(0,n.I)(o,{args:[i,{name:t,index:r}],done:()=>l("delete")})},m=()=>l("preview"),f=()=>l("reupload"),g=()=>{if(e.deletable&&"uploading"!==e.item.status){var a=r["preview-delete"];return(0,t.Wm)("div",{role:"button",class:(0,i.PH)("preview-delete",{shadow:!a}),tabindex:0,"aria-label":(0,i.t)("delete"),onClick:p},[a?a():(0,t.Wm)(s.JO,{name:"cross",class:(0,i.PH)("preview-delete-icon")},null)])}},w=()=>{if(r["preview-cover"]){var{index:a,item:l}=e;return(0,t.Wm)("div",{class:(0,i.PH)("preview-cover")},[r["preview-cover"]((0,o.l7)({index:a},l))])}},h=()=>{var{item:a,lazyLoad:l,imageFit:r,previewSize:o,reupload:n}=e;return(0,i.CO)(a)?(0,t.Wm)(d.Ee,{fit:r,src:a.objectUrl||a.content||a.url,class:(0,i.PH)("preview-image"),width:Array.isArray(o)?o[0]:o,height:Array.isArray(o)?o[1]:o,lazyLoad:l,onClick:n?f:m},{default:w}):(0,t.Wm)("div",{class:(0,i.PH)("file"),style:(0,u.Xn)(e.previewSize)},[(0,t.Wm)(s.JO,{class:(0,i.PH)("file-icon"),name:"description"},null),(0,t.Wm)("div",{class:[(0,i.PH)("file-name"),"van-ellipsis"]},[a.file?a.file.name:a.url]),w()])};return()=>(0,t.Wm)("div",{class:(0,i.PH)("preview")},[h(),c(),g()])}})},4342:function(e,a,l){"use strict";l.r(e.exports={})},85821:function(e,a,l){"use strict";l.r(e.exports={})}}]);