import{cs as V,h as t,b as L,c as h,e as C,d as M,y as R,ba as q,N as j,ct as de,cu as ce,an as ue,cv as fe,u as ge,x as Q,cw as Te,z as te,A as he,n as $e,q as G,b8 as ee,aU as Se,L as Le,M as De,cx as pe,r as W,v as ze,bJ as _e,bA as Fe,K as Z,cy as Ie,cz as Oe,b1 as Ue,bB as je,cA as re,f as U,cB as Ne,cC as Ee,o as Ae,t as F,s as Me,p as qe,cD as He,ab as We,R as ne,V as Xe,w as ie}from"./index-c17d3913.js";const Ve=V("attach",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M3.25735931,8.70710678 L7.85355339,4.1109127 C8.82986412,3.13460197 10.4127766,3.13460197 11.3890873,4.1109127 C12.365398,5.08722343 12.365398,6.67013588 11.3890873,7.64644661 L6.08578644,12.9497475 C5.69526215,13.3402718 5.06209717,13.3402718 4.67157288,12.9497475 C4.28104858,12.5592232 4.28104858,11.9260582 4.67157288,11.5355339 L9.97487373,6.23223305 C10.1701359,6.0369709 10.1701359,5.72038841 9.97487373,5.52512627 C9.77961159,5.32986412 9.4630291,5.32986412 9.26776695,5.52512627 L3.96446609,10.8284271 C3.18341751,11.6094757 3.18341751,12.8758057 3.96446609,13.6568542 C4.74551468,14.4379028 6.01184464,14.4379028 6.79289322,13.6568542 L12.0961941,8.35355339 C13.4630291,6.98671837 13.4630291,4.77064094 12.0961941,3.40380592 C10.7293591,2.0369709 8.51328163,2.0369709 7.14644661,3.40380592 L2.55025253,8 C2.35499039,8.19526215 2.35499039,8.51184464 2.55025253,8.70710678 C2.74551468,8.90236893 3.06209717,8.90236893 3.25735931,8.70710678 Z"}))))),Ge=V("trash",t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t("path",{d:"M432,144,403.33,419.74A32,32,0,0,1,371.55,448H140.46a32,32,0,0,1-31.78-28.26L80,144",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("rect",{x:"32",y:"64",width:"448",height:"80",rx:"16",ry:"16",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("line",{x1:"312",y1:"240",x2:"200",y2:"352",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("line",{x1:"312",y1:"352",x2:"200",y2:"240",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),Ye=V("download",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M3.5,13 L12.5,13 C12.7761424,13 13,13.2238576 13,13.5 C13,13.7454599 12.8231248,13.9496084 12.5898756,13.9919443 L12.5,14 L3.5,14 C3.22385763,14 3,13.7761424 3,13.5 C3,13.2545401 3.17687516,13.0503916 3.41012437,13.0080557 L3.5,13 L12.5,13 L3.5,13 Z M7.91012437,1.00805567 L8,1 C8.24545989,1 8.44960837,1.17687516 8.49194433,1.41012437 L8.5,1.5 L8.5,10.292 L11.1819805,7.6109127 C11.3555469,7.43734635 11.6249713,7.4180612 11.8198394,7.55305725 L11.8890873,7.6109127 C12.0626536,7.78447906 12.0819388,8.05390346 11.9469427,8.2487716 L11.8890873,8.31801948 L8.35355339,11.8535534 C8.17998704,12.0271197 7.91056264,12.0464049 7.7156945,11.9114088 L7.64644661,11.8535534 L4.1109127,8.31801948 C3.91565056,8.12275734 3.91565056,7.80617485 4.1109127,7.6109127 C4.28447906,7.43734635 4.55390346,7.4180612 4.7487716,7.55305725 L4.81801948,7.6109127 L7.5,10.292 L7.5,1.5 C7.5,1.25454011 7.67687516,1.05039163 7.91012437,1.00805567 L8,1 L7.91012437,1.00805567 Z"}))))),Ke=V("cancel",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M2.58859116,2.7156945 L2.64644661,2.64644661 C2.82001296,2.47288026 3.08943736,2.45359511 3.2843055,2.58859116 L3.35355339,2.64644661 L8,7.293 L12.6464466,2.64644661 C12.8417088,2.45118446 13.1582912,2.45118446 13.3535534,2.64644661 C13.5488155,2.84170876 13.5488155,3.15829124 13.3535534,3.35355339 L8.707,8 L13.3535534,12.6464466 C13.5271197,12.820013 13.5464049,13.0894374 13.4114088,13.2843055 L13.3535534,13.3535534 C13.179987,13.5271197 12.9105626,13.5464049 12.7156945,13.4114088 L12.6464466,13.3535534 L8,8.707 L3.35355339,13.3535534 C3.15829124,13.5488155 2.84170876,13.5488155 2.64644661,13.3535534 C2.45118446,13.1582912 2.45118446,12.8417088 2.64644661,12.6464466 L7.293,8 L2.64644661,3.35355339 C2.47288026,3.17998704 2.45359511,2.91056264 2.58859116,2.7156945 L2.64644661,2.64644661 L2.58859116,2.7156945 Z"}))))),Ze=V("retry",t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t("path",{d:"M320,146s24.36-12-64-12A160,160,0,1,0,416,294",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-miterlimit: 10; stroke-width: 32px;"}),t("polyline",{points:"256 58 336 138 256 218",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),Je=L([h("progress",{display:"inline-block"},[h("progress-icon",` color: var(--n-icon-color); transition: color .3s var(--n-bezier); `),C("line",` width: 100%; display: block; `,[h("progress-content",` display: flex; align-items: center; `,[h("progress-graph",{flex:1})]),h("progress-custom-content",{marginLeft:"14px"}),h("progress-icon",` width: 30px; padding-left: 14px; height: var(--n-icon-size-line); line-height: var(--n-icon-size-line); font-size: var(--n-icon-size-line); `,[C("as-text",` color: var(--n-text-color-line-outer); text-align: center; width: 40px; font-size: var(--n-font-size); padding-left: 4px; transition: color .3s var(--n-bezier); `)])]),C("circle, dashboard",{width:"120px"},[h("progress-custom-content",` position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); display: flex; align-items: center; justify-content: center; `),h("progress-text",` position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); display: flex; align-items: center; color: inherit; font-size: var(--n-font-size-circle); color: var(--n-text-color-circle); font-weight: var(--n-font-weight-circle); transition: color .3s var(--n-bezier); white-space: nowrap; `),h("progress-icon",` position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); display: flex; align-items: center; color: var(--n-icon-color); font-size: var(--n-icon-size-circle); `)]),C("multiple-circle",` width: 200px; color: inherit; `,[h("progress-text",` font-weight: var(--n-font-weight-circle); color: var(--n-text-color-circle); position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); display: flex; align-items: center; justify-content: center; transition: color .3s var(--n-bezier); `)]),h("progress-content",{position:"relative"}),h("progress-graph",{position:"relative"},[h("progress-graph-circle",[L("svg",{verticalAlign:"bottom"}),h("progress-graph-circle-fill",` stroke: var(--n-fill-color); transition: opacity .3s var(--n-bezier), stroke .3s var(--n-bezier), stroke-dasharray .3s var(--n-bezier); `,[C("empty",{opacity:0})]),h("progress-graph-circle-rail",` transition: stroke .3s var(--n-bezier); overflow: hidden; stroke: var(--n-rail-color); `)]),h("progress-graph-line",[C("indicator-inside",[h("progress-graph-line-rail",` height: 16px; line-height: 16px; border-radius: 10px; `,[h("progress-graph-line-fill",` height: inherit; border-radius: 10px; `),h("progress-graph-line-indicator",` background: #0000; white-space: nowrap; text-align: right; margin-left: 14px; margin-right: 14px; height: inherit; font-size: 12px; color: var(--n-text-color-line-inner); transition: color .3s var(--n-bezier); `)])]),C("indicator-inside-label",` height: 16px; display: flex; align-items: center; `,[h("progress-graph-line-rail",` flex: 1; transition: background-color .3s var(--n-bezier); `),h("progress-graph-line-indicator",` background: var(--n-fill-color); font-size: 12px; transform: translateZ(0); display: flex; vertical-align: middle; height: 16px; line-height: 16px; padding: 0 10px; border-radius: 10px; position: absolute; white-space: nowrap; color: var(--n-text-color-line-inner); transition: right .2s var(--n-bezier), color .3s var(--n-bezier), background-color .3s var(--n-bezier); `)]),h("progress-graph-line-rail",` position: relative; overflow: hidden; height: var(--n-rail-height); border-radius: 5px; background-color: var(--n-rail-color); transition: background-color .3s var(--n-bezier); `,[h("progress-graph-line-fill",` background: var(--n-fill-color); position: relative; border-radius: 5px; height: inherit; width: 100%; max-width: 0%; transition: background-color .3s var(--n-bezier), max-width .2s var(--n-bezier); `,[C("processing",[L("&::after",` content: ""; background-image: var(--n-line-bg-processing); animation: progress-processing-animation 2s var(--n-bezier) infinite; `)])])])])])]),L("@keyframes progress-processing-animation",` 0% { position: absolute; left: 0; top: 0; bottom: 0; right: 100%; opacity: 1; } 66% { position: absolute; left: 0; top: 0; bottom: 0; right: 0; opacity: 0; } 100% { position: absolute; left: 0; top: 0; bottom: 0; right: 0; opacity: 0; } `)]),Qe={success:t(de,null),error:t(ce,null),warning:t(ue,null),info:t(fe,null)},et=M({name:"ProgressLine",props:{clsPrefix:{type:String,required:!0},percentage:{type:Number,default:0},railColor:String,railStyle:[String,Object],fillColor:String,status:{type:String,required:!0},indicatorPlacement:{type:String,required:!0},indicatorTextColor:String,unit:{type:String,default:"%"},processing:{type:Boolean,required:!0},showIndicator:{type:Boolean,required:!0},height:[String,Number],railBorderRadius:[String,Number],fillBorderRadius:[String,Number]},setup(e,{slots:i}){const r=R(()=>q(e.height)),n=R(()=>e.railBorderRadius!==void 0?q(e.railBorderRadius):e.height!==void 0?q(e.height,{c:.5}):""),o=R(()=>e.fillBorderRadius!==void 0?q(e.fillBorderRadius):e.railBorderRadius!==void 0?q(e.railBorderRadius):e.height!==void 0?q(e.height,{c:.5}):"");return()=>{const{indicatorPlacement:s,railColor:c,railStyle:u,percentage:d,unit:a,indicatorTextColor:l,status:f,showIndicator:y,fillColor:p,processing:k,clsPrefix:v}=e;return t("div",{class:`${v}-progress-content`,role:"none"},t("div",{class:`${v}-progress-graph`,"aria-hidden":!0},t("div",{class:[`${v}-progress-graph-line`,{[`${v}-progress-graph-line--indicator-${s}`]:!0}]},t("div",{class:`${v}-progress-graph-line-rail`,style:[{backgroundColor:c,height:r.value,borderRadius:n.value},u]},t("div",{class:[`${v}-progress-graph-line-fill`,k&&`${v}-progress-graph-line-fill--processing`],style:{maxWidth:`${e.percentage}%`,backgroundColor:p,height:r.value,lineHeight:r.value,borderRadius:o.value}},s==="inside"?t("div",{class:`${v}-progress-graph-line-indicator`,style:{color:l}},d,a):null)))),y&&s==="outside"?t("div",null,i.default?t("div",{class:`${v}-progress-custom-content`,style:{color:l},role:"none"},i.default()):f==="default"?t("div",{role:"none",class:`${v}-progress-icon ${v}-progress-icon--as-text`,style:{color:l}},d,a):t("div",{class:`${v}-progress-icon`,"aria-hidden":!0},t(j,{clsPrefix:v},{default:()=>Qe[f]}))):null)}}}),tt={success:t(de,null),error:t(ce,null),warning:t(ue,null),info:t(fe,null)},rt=M({name:"ProgressCircle",props:{clsPrefix:{type:String,required:!0},status:{type:String,required:!0},strokeWidth:{type:Number,required:!0},fillColor:String,railColor:String,railStyle:[String,Object],percentage:{type:Number,default:0},offsetDegree:{type:Number,default:0},showIndicator:{type:Boolean,required:!0},indicatorTextColor:String,unit:String,viewBoxWidth:{type:Number,required:!0},gapDegree:{type:Number,required:!0},gapOffsetDegree:{type:Number,default:0}},setup(e,{slots:i}){function r(n,o,s){const{gapDegree:c,viewBoxWidth:u,strokeWidth:d}=e,a=50,l=0,f=a,y=0,p=2*a,k=50+d/2,v=`M ${k},${k} m ${l},${f} a ${a},${a} 0 1 1 ${y},${-p} a ${a},${a} 0 1 1 ${-y},${p}`,B=Math.PI*2*a,D={stroke:s,strokeDasharray:`${n/100*(B-c)}px ${u*8}px`,strokeDashoffset:`-${c/2}px`,transformOrigin:o?"center":void 0,transform:o?`rotate(${o}deg)`:void 0};return{pathString:v,pathStyle:D}}return()=>{const{fillColor:n,railColor:o,strokeWidth:s,offsetDegree:c,status:u,percentage:d,showIndicator:a,indicatorTextColor:l,unit:f,gapOffsetDegree:y,clsPrefix:p}=e,{pathString:k,pathStyle:v}=r(100,0,o),{pathString:B,pathStyle:D}=r(d,c,n),T=100+s;return t("div",{class:`${p}-progress-content`,role:"none"},t("div",{class:`${p}-progress-graph`,"aria-hidden":!0},t("div",{class:`${p}-progress-graph-circle`,style:{transform:y?`rotate(${y}deg)`:void 0}},t("svg",{viewBox:`0 0 ${T} ${T}`},t("g",null,t("path",{class:`${p}-progress-graph-circle-rail`,d:k,"stroke-width":s,"stroke-linecap":"round",fill:"none",style:v})),t("g",null,t("path",{class:[`${p}-progress-graph-circle-fill`,d===0&&`${p}-progress-graph-circle-fill--empty`],d:B,"stroke-width":s,"stroke-linecap":"round",fill:"none",style:D}))))),a?t("div",null,i.default?t("div",{class:`${p}-progress-custom-content`,role:"none"},i.default()):u!=="default"?t("div",{class:`${p}-progress-icon`,"aria-hidden":!0},t(j,{clsPrefix:p},{default:()=>tt[u]})):t("div",{class:`${p}-progress-text`,style:{color:l},role:"none"},t("span",{class:`${p}-progress-text__percentage`},d),t("span",{class:`${p}-progress-text__unit`},f))):null)}}});function oe(e,i,r=100){return`m ${r/2} ${r/2-e} a ${e} ${e} 0 1 1 0 ${2*e} a ${e} ${e} 0 1 1 0 -${2*e}`}const nt=M({name:"ProgressMultipleCircle",props:{clsPrefix:{type:String,required:!0},viewBoxWidth:{type:Number,required:!0},percentage:{type:Array,default:[0]},strokeWidth:{type:Number,required:!0},circleGap:{type:Number,required:!0},showIndicator:{type:Boolean,required:!0},fillColor:{type:Array,default:()=>[]},railColor:{type:Array,default:()=>[]},railStyle:{type:Array,default:()=>[]}},setup(e,{slots:i}){const r=R(()=>e.percentage.map((o,s)=>`${Math.PI*o/100*(e.viewBoxWidth/2-e.strokeWidth/2*(1+2*s)-e.circleGap*s)*2}, ${e.viewBoxWidth*8}`));return()=>{const{viewBoxWidth:n,strokeWidth:o,circleGap:s,showIndicator:c,fillColor:u,railColor:d,railStyle:a,percentage:l,clsPrefix:f}=e;return t("div",{class:`${f}-progress-content`,role:"none"},t("div",{class:`${f}-progress-graph`,"aria-hidden":!0},t("div",{class:`${f}-progress-graph-circle`},t("svg",{viewBox:`0 0 ${n} ${n}`},l.map((y,p)=>t("g",{key:p},t("path",{class:`${f}-progress-graph-circle-rail`,d:oe(n/2-o/2*(1+2*p)-s*p,o,n),"stroke-width":o,"stroke-linecap":"round",fill:"none",style:[{strokeDashoffset:0,stroke:d[p]},a[p]]}),t("path",{class:[`${f}-progress-graph-circle-fill`,y===0&&`${f}-progress-graph-circle-fill--empty`],d:oe(n/2-o/2*(1+2*p)-s*p,o,n),"stroke-width":o,"stroke-linecap":"round",fill:"none",style:{strokeDasharray:r.value[p],strokeDashoffset:0,stroke:u[p]}})))))),c&&i.default?t("div",null,t("div",{class:`${f}-progress-text`},i.default())):null)}}}),it=Object.assign(Object.assign({},Q.props),{processing:Boolean,type:{type:String,default:"line"},gapDegree:Number,gapOffsetDegree:Number,status:{type:String,default:"default"},railColor:[String,Array],railStyle:[String,Array],color:[String,Array],viewBoxWidth:{type:Number,default:100},strokeWidth:{type:Number,default:7},percentage:[Number,Array],unit:{type:String,default:"%"},showIndicator:{type:Boolean,default:!0},indicatorPosition:{type:String,default:"outside"},indicatorPlacement:{type:String,default:"outside"},indicatorTextColor:String,circleGap:{type:Number,default:1},height:Number,borderRadius:[String,Number],fillBorderRadius:[String,Number],offsetDegree:Number}),ot=M({name:"Progress",props:it,setup(e){const i=R(()=>e.indicatorPlacement||e.indicatorPosition),r=R(()=>{if(e.gapDegree||e.gapDegree===0)return e.gapDegree;if(e.type==="dashboard")return 75}),{mergedClsPrefixRef:n,inlineThemeDisabled:o}=ge(e),s=Q("Progress","-progress",Je,Te,e,n),c=R(()=>{const{status:d}=e,{common:{cubicBezierEaseInOut:a},self:{fontSize:l,fontSizeCircle:f,railColor:y,railHeight:p,iconSizeCircle:k,iconSizeLine:v,textColorCircle:B,textColorLineInner:D,textColorLineOuter:T,lineBgProcessing:x,fontWeightCircle:$,[te("iconColor",d)]:m,[te("fillColor",d)]:b}}=s.value;return{"--n-bezier":a,"--n-fill-color":b,"--n-font-size":l,"--n-font-size-circle":f,"--n-font-weight-circle":$,"--n-icon-color":m,"--n-icon-size-circle":k,"--n-icon-size-line":v,"--n-line-bg-processing":x,"--n-rail-color":y,"--n-rail-height":p,"--n-text-color-circle":B,"--n-text-color-line-inner":D,"--n-text-color-line-outer":T}}),u=o?he("progress",R(()=>e.status[0]),c,e):void 0;return{mergedClsPrefix:n,mergedIndicatorPlacement:i,gapDeg:r,cssVars:o?void 0:c,themeClass:u==null?void 0:u.themeClass,onRender:u==null?void 0:u.onRender}},render(){const{type:e,cssVars:i,indicatorTextColor:r,showIndicator:n,status:o,railColor:s,railStyle:c,color:u,percentage:d,viewBoxWidth:a,strokeWidth:l,mergedIndicatorPlacement:f,unit:y,borderRadius:p,fillBorderRadius:k,height:v,processing:B,circleGap:D,mergedClsPrefix:T,gapDeg:x,gapOffsetDegree:$,themeClass:m,$slots:b,onRender:w}=this;return w==null||w(),t("div",{class:[m,`${T}-progress`,`${T}-progress--${e}`,`${T}-progress--${o}`],style:i,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":d,role:e==="circle"||e==="line"||e==="dashboard"?"progressbar":"none"},e==="circle"||e==="dashboard"?t(rt,{clsPrefix:T,status:o,showIndicator:n,indicatorTextColor:r,railColor:s,fillColor:u,railStyle:c,offsetDegree:this.offsetDegree,percentage:d,viewBoxWidth:a,strokeWidth:l,gapDegree:x===void 0?e==="dashboard"?75:0:x,gapOffsetDegree:$,unit:y},b):e==="line"?t(et,{clsPrefix:T,status:o,showIndicator:n,indicatorTextColor:r,railColor:s,fillColor:u,railStyle:c,percentage:d,processing:B,indicatorPlacement:f,unit:y,fillBorderRadius:k,railBorderRadius:p,height:v},b):e==="multiple-circle"?t(nt,{clsPrefix:T,strokeWidth:l,railColor:s,fillColor:u,railStyle:c,viewBoxWidth:a,percentage:d,showIndicator:n,circleGap:D},b):null)}}),H=$e("n-upload"),me="__UPLOAD_DRAGGER__",lt=M({name:"UploadDragger",[me]:!0,setup(e,{slots:i}){const r=G(H,null);return r||ee("upload-dragger","`n-upload-dragger` must be placed inside `n-upload`."),()=>{const{mergedClsPrefixRef:{value:n},mergedDisabledRef:{value:o},maxReachedRef:{value:s}}=r;return t("div",{class:[`${n}-upload-dragger`,(o||s)&&`${n}-upload-dragger--disabled`]},i)}}});var ve=globalThis&&globalThis.__awaiter||function(e,i,r,n){function o(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function u(l){try{a(n.next(l))}catch(f){c(f)}}function d(l){try{a(n.throw(l))}catch(f){c(f)}}function a(l){l.done?s(l.value):o(l.value).then(u,d)}a((n=n.apply(e,i||[])).next())})};const be=e=>e.includes("image/"),le=(e="")=>{const i=e.split("/"),n=i[i.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(n)||[""])[0]},ae=/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i,ye=e=>{if(e.type)return be(e.type);const i=le(e.name||"");if(ae.test(i))return!0;const r=e.thumbnailUrl||e.url||"",n=le(r);return!!(/^data:image\//.test(r)||ae.test(n))};function at(e){return ve(this,void 0,void 0,function*(){return yield new Promise(i=>{if(!e.type||!be(e.type)){i("");return}i(window.URL.createObjectURL(e))})})}const st=Se&&window.FileReader&&window.File;function dt(e){return e.isDirectory}function ct(e){return e.isFile}function ut(e,i){return ve(this,void 0,void 0,function*(){const r=[];let n,o=0;function s(){o++}function c(){o--,o||n(r)}function u(d){d.forEach(a=>{if(a){if(s(),i&&dt(a)){const l=a.createReader();s(),l.readEntries(f=>{u(f),c()},()=>{c()})}else ct(a)&&(s(),a.file(l=>{r.push({file:l,entry:a,source:"dnd"}),c()},()=>{c()}));c()}})}return yield new Promise(d=>{n=d,u(e)}),r})}function X(e){const{id:i,name:r,percentage:n,status:o,url:s,file:c,thumbnailUrl:u,type:d,fullPath:a,batchId:l}=e;return{id:i,name:r,percentage:n??null,status:o,url:s??null,file:c??null,thumbnailUrl:u??null,type:d??null,fullPath:a??null,batchId:l??null}}function ft(e,i,r){return e=e.toLowerCase(),i=i.toLocaleLowerCase(),r=r.toLocaleLowerCase(),r.split(",").map(o=>o.trim()).filter(Boolean).some(o=>{if(o.startsWith(".")){if(e.endsWith(o))return!0}else if(o.includes("/")){const[s,c]=i.split("/"),[u,d]=o.split("/");if((u==="*"||s&&u&&u===s)&&(d==="*"||c&&d&&d===c))return!0}else return!0;return!1})}const gt=(e,i)=>{if(!e)return;const r=document.createElement("a");r.href=e,i!==void 0&&(r.download=i),document.body.appendChild(r),r.click(),document.body.removeChild(r)},we=M({name:"UploadTrigger",props:{abstract:Boolean},setup(e,{slots:i}){const r=G(H,null);r||ee("upload-trigger","`n-upload-trigger` must be placed inside `n-upload`.");const{mergedClsPrefixRef:n,mergedDisabledRef:o,maxReachedRef:s,listTypeRef:c,dragOverRef:u,openOpenFileDialog:d,draggerInsideRef:a,handleFileAddition:l,mergedDirectoryDndRef:f,triggerStyleRef:y}=r,p=R(()=>c.value==="image-card");function k(){o.value||s.value||d()}function v(x){x.preventDefault(),u.value=!0}function B(x){x.preventDefault(),u.value=!0}function D(x){x.preventDefault(),u.value=!1}function T(x){var $;if(x.preventDefault(),!a.value||o.value||s.value){u.value=!1;return}const m=($=x.dataTransfer)===null||$===void 0?void 0:$.items;m!=null&&m.length?ut(Array.from(m).map(b=>b.webkitGetAsEntry()),f.value).then(b=>{l(b)}).finally(()=>{u.value=!1}):u.value=!1}return()=>{var x;const{value:$}=n;return e.abstract?(x=i.default)===null||x===void 0?void 0:x.call(i,{handleClick:k,handleDrop:T,handleDragOver:v,handleDragEnter:B,handleDragLeave:D}):t("div",{class:[`${$}-upload-trigger`,(o.value||s.value)&&`${$}-upload-trigger--disabled`,p.value&&`${$}-upload-trigger--image-card`],style:y.value,onClick:k,onDrop:T,onDragover:v,onDragenter:B,onDragleave:D},p.value?t(lt,null,{default:()=>Le(i.default,()=>[t(j,{clsPrefix:$},{default:()=>t(De,null)})])}):i)}}}),ht=M({name:"UploadProgress",props:{show:Boolean,percentage:{type:Number,required:!0},status:{type:String,required:!0}},setup(){return{mergedTheme:G(H).mergedThemeRef}},render(){return t(pe,null,{default:()=>this.show?t(ot,{type:"line",showIndicator:!1,percentage:this.percentage,status:this.status,height:2,theme:this.mergedTheme.peers.Progress,themeOverrides:this.mergedTheme.peerOverrides.Progress}):null})}}),pt=t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},t("g",{fill:"none"},t("path",{d:"M21.75 3A3.25 3.25 0 0 1 25 6.25v15.5A3.25 3.25 0 0 1 21.75 25H6.25A3.25 3.25 0 0 1 3 21.75V6.25A3.25 3.25 0 0 1 6.25 3h15.5zm.583 20.4l-7.807-7.68a.75.75 0 0 0-.968-.07l-.084.07l-7.808 7.68c.183.065.38.1.584.1h15.5c.204 0 .4-.035.583-.1l-7.807-7.68l7.807 7.68zM21.75 4.5H6.25A1.75 1.75 0 0 0 4.5 6.25v15.5c0 .208.036.408.103.593l7.82-7.692a2.25 2.25 0 0 1 3.026-.117l.129.117l7.82 7.692c.066-.185.102-.385.102-.593V6.25a1.75 1.75 0 0 0-1.75-1.75zm-3.25 3a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5zm0 1.5a1 1 0 1 0 0 2a1 1 0 0 0 0-2z",fill:"currentColor"}))),mt=t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},t("g",{fill:"none"},t("path",{d:"M6.4 2A2.4 2.4 0 0 0 4 4.4v19.2A2.4 2.4 0 0 0 6.4 26h15.2a2.4 2.4 0 0 0 2.4-2.4V11.578c0-.729-.29-1.428-.805-1.944l-6.931-6.931A2.4 2.4 0 0 0 14.567 2H6.4zm-.9 2.4a.9.9 0 0 1 .9-.9H14V10a2 2 0 0 0 2 2h6.5v11.6a.9.9 0 0 1-.9.9H6.4a.9.9 0 0 1-.9-.9V4.4zm16.44 6.1H16a.5.5 0 0 1-.5-.5V4.06l6.44 6.44z",fill:"currentColor"})));var vt=globalThis&&globalThis.__awaiter||function(e,i,r,n){function o(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function u(l){try{a(n.next(l))}catch(f){c(f)}}function d(l){try{a(n.throw(l))}catch(f){c(f)}}function a(l){l.done?s(l.value):o(l.value).then(u,d)}a((n=n.apply(e,i||[])).next())})};const J={paddingMedium:"0 3px",heightMedium:"24px",iconSizeMedium:"18px"},bt=M({name:"UploadFile",props:{clsPrefix:{type:String,required:!0},file:{type:Object,required:!0},listType:{type:String,required:!0}},setup(e){const i=G(H),r=W(null),n=W(""),o=R(()=>{const{file:m}=e;return m.status==="finished"?"success":m.status==="error"?"error":"info"}),s=R(()=>{const{file:m}=e;if(m.status==="error")return"error"}),c=R(()=>{const{file:m}=e;return m.status==="uploading"}),u=R(()=>{if(!i.showCancelButtonRef.value)return!1;const{file:m}=e;return["uploading","pending","error"].includes(m.status)}),d=R(()=>{if(!i.showRemoveButtonRef.value)return!1;const{file:m}=e;return["finished"].includes(m.status)}),a=R(()=>{if(!i.showDownloadButtonRef.value)return!1;const{file:m}=e;return["finished"].includes(m.status)}),l=R(()=>{if(!i.showRetryButtonRef.value)return!1;const{file:m}=e;return["error"].includes(m.status)}),f=ze(()=>n.value||e.file.thumbnailUrl||e.file.url),y=R(()=>{if(!i.showPreviewButtonRef.value)return!1;const{file:{status:m},listType:b}=e;return["finished"].includes(m)&&f.value&&b==="image-card"});function p(){i.submit(e.file.id)}function k(m){m.preventDefault();const{file:b}=e;["finished","pending","error"].includes(b.status)?B(b):["uploading"].includes(b.status)?T(b):Ue("upload","The button clicked type is unknown.")}function v(m){m.preventDefault(),D(e.file)}function B(m){const{xhrMap:b,doChange:w,onRemoveRef:{value:Y},mergedFileListRef:{value:g}}=i;Promise.resolve(Y?Y({file:Object.assign({},m),fileList:g}):!0).then(P=>{if(P===!1)return;const S=Object.assign({},m,{status:"removed"});b.delete(m.id),w(S,void 0,{remove:!0})})}function D(m){const{onDownloadRef:{value:b}}=i;Promise.resolve(b?b(Object.assign({},m)):!0).then(w=>{w!==!1&>(m.url,m.name)})}function T(m){const{xhrMap:b}=i,w=b.get(m.id);w==null||w.abort(),B(Object.assign({},m))}function x(){const{onPreviewRef:{value:m}}=i;if(m)m(e.file);else if(e.listType==="image-card"){const{value:b}=r;if(!b)return;b.click()}}const $=()=>vt(this,void 0,void 0,function*(){const{listType:m}=e;m!=="image"&&m!=="image-card"||i.shouldUseThumbnailUrlRef.value(e.file)&&(n.value=yield i.getFileThumbnailUrlResolver(e.file))});return _e(()=>{$()}),{mergedTheme:i.mergedThemeRef,progressStatus:o,buttonType:s,showProgress:c,disabled:i.mergedDisabledRef,showCancelButton:u,showRemoveButton:d,showDownloadButton:a,showRetryButton:l,showPreviewButton:y,mergedThumbnailUrl:f,shouldUseThumbnailUrl:i.shouldUseThumbnailUrlRef,renderIcon:i.renderIconRef,imageRef:r,handleRemoveOrCancelClick:k,handleDownloadClick:v,handleRetryClick:p,handlePreviewClick:x}},render(){const{clsPrefix:e,mergedTheme:i,listType:r,file:n,renderIcon:o}=this;let s;const c=r==="image";c||r==="image-card"?s=!this.shouldUseThumbnailUrl(n)||!this.mergedThumbnailUrl?t("span",{class:`${e}-upload-file-info__thumbnail`},o?o(n):ye(n)?t(j,{clsPrefix:e},{default:()=>pt}):t(j,{clsPrefix:e},{default:()=>mt})):t("a",{rel:"noopener noreferer",target:"_blank",href:n.url||void 0,class:`${e}-upload-file-info__thumbnail`,onClick:this.handlePreviewClick},r==="image-card"?t(Fe,{src:this.mergedThumbnailUrl||void 0,previewSrc:n.url||void 0,alt:n.name,ref:"imageRef"}):t("img",{src:this.mergedThumbnailUrl||void 0,alt:n.name})):s=t("span",{class:`${e}-upload-file-info__thumbnail`},o?o(n):t(j,{clsPrefix:e},{default:()=>t(Ve,null)}));const d=t(ht,{show:this.showProgress,percentage:n.percentage||0,status:this.progressStatus}),a=r==="text"||r==="image";return t("div",{class:[`${e}-upload-file`,`${e}-upload-file--${this.progressStatus}-status`,n.url&&n.status!=="error"&&r!=="image-card"&&`${e}-upload-file--with-url`,`${e}-upload-file--${r}-type`]},t("div",{class:`${e}-upload-file-info`},s,t("div",{class:`${e}-upload-file-info__name`},a&&(n.url&&n.status!=="error"?t("a",{rel:"noopener noreferer",target:"_blank",href:n.url||void 0,onClick:this.handlePreviewClick},n.name):t("span",{onClick:this.handlePreviewClick},n.name)),c&&d),t("div",{class:[`${e}-upload-file-info__action`,`${e}-upload-file-info__action--${r}-type`]},this.showPreviewButton?t(Z,{key:"preview",quaternary:!0,type:this.buttonType,onClick:this.handlePreviewClick,theme:i.peers.Button,themeOverrides:i.peerOverrides.Button,builtinThemeOverrides:J},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Ie,null)})}):null,(this.showRemoveButton||this.showCancelButton)&&!this.disabled&&t(Z,{key:"cancelOrTrash",theme:i.peers.Button,themeOverrides:i.peerOverrides.Button,quaternary:!0,builtinThemeOverrides:J,type:this.buttonType,onClick:this.handleRemoveOrCancelClick},{icon:()=>t(Oe,null,{default:()=>this.showRemoveButton?t(j,{clsPrefix:e,key:"trash"},{default:()=>t(Ge,null)}):t(j,{clsPrefix:e,key:"cancel"},{default:()=>t(Ke,null)})})}),this.showRetryButton&&!this.disabled&&t(Z,{key:"retry",quaternary:!0,type:this.buttonType,onClick:this.handleRetryClick,theme:i.peers.Button,themeOverrides:i.peerOverrides.Button,builtinThemeOverrides:J},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Ze,null)})}),this.showDownloadButton?t(Z,{key:"download",quaternary:!0,type:this.buttonType,onClick:this.handleDownloadClick,theme:i.peers.Button,themeOverrides:i.peerOverrides.Button,builtinThemeOverrides:J},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Ye,null)})}):null)),!c&&d)}}),yt=M({name:"UploadFileList",setup(e,{slots:i}){const r=G(H,null);r||ee("upload-file-list","`n-upload-file-list` must be placed inside `n-upload`.");const{abstractRef:n,mergedClsPrefixRef:o,listTypeRef:s,mergedFileListRef:c,fileListStyleRef:u,cssVarsRef:d,themeClassRef:a,maxReachedRef:l,showTriggerRef:f,imageGroupPropsRef:y}=r,p=R(()=>s.value==="image-card"),k=()=>c.value.map(B=>t(bt,{clsPrefix:o.value,key:B.id,file:B,listType:s.value})),v=()=>p.value?t(je,Object.assign({},y.value),{default:k}):t(pe,{group:!0},{default:k});return()=>{const{value:B}=o,{value:D}=n;return t("div",{class:[`${B}-upload-file-list`,p.value&&`${B}-upload-file-list--grid`,D?a==null?void 0:a.value:void 0],style:[D&&d?d.value:"",u.value]},v(),f.value&&!l.value&&p.value&&t(we,null,i))}}}),wt=L([h("upload","width: 100%;",[C("dragger-inside",[h("upload-trigger",` display: block; `)]),C("drag-over",[h("upload-dragger",` border: var(--n-dragger-border-hover); `)])]),h("upload-dragger",` cursor: pointer; box-sizing: border-box; width: 100%; text-align: center; border-radius: var(--n-border-radius); padding: 24px; opacity: 1; transition: opacity .3s var(--n-bezier), border-color .3s var(--n-bezier), background-color .3s var(--n-bezier); background-color: var(--n-dragger-color); border: var(--n-dragger-border); `,[L("&:hover",` border: var(--n-dragger-border-hover); `),C("disabled",` cursor: not-allowed; `)]),h("upload-trigger",` display: inline-block; box-sizing: border-box; opacity: 1; transition: opacity .3s var(--n-bezier); `,[L("+",[h("upload-file-list","margin-top: 8px;")]),C("disabled",` opacity: var(--n-item-disabled-opacity); cursor: not-allowed; `),C("image-card",` width: 96px; height: 96px; `,[h("base-icon",` font-size: 24px; `),h("upload-dragger",` padding: 0; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; `)])]),h("upload-file-list",` line-height: var(--n-line-height); opacity: 1; transition: opacity .3s var(--n-bezier); `,[L("a, img","outline: none;"),C("disabled",` opacity: var(--n-item-disabled-opacity); cursor: not-allowed; `,[h("upload-file","cursor: not-allowed;")]),C("grid",` display: grid; grid-template-columns: repeat(auto-fill, 96px); grid-gap: 8px; margin-top: 0; `),h("upload-file",` display: block; box-sizing: border-box; cursor: default; padding: 0px 12px 0 6px; transition: background-color .3s var(--n-bezier); border-radius: var(--n-border-radius); `,[re(),h("progress",[re({foldPadding:!0})]),L("&:hover",` background-color: var(--n-item-color-hover); `,[h("upload-file-info",[U("action",` opacity: 1; `)])]),C("image-type",` border-radius: var(--n-border-radius); text-decoration: underline; text-decoration-color: #0000; `,[h("upload-file-info",` padding-top: 0px; padding-bottom: 0px; width: 100%; height: 100%; display: flex; justify-content: space-between; align-items: center; padding: 6px 0; `,[h("progress",` padding: 2px 0; margin-bottom: 0; `),U("name",` padding: 0 8px; `),U("thumbnail",` width: 32px; height: 32px; font-size: 28px; display: flex; justify-content: center; align-items: center; `,[L("img",` width: 100%; `)])])]),C("text-type",[h("progress",` box-sizing: border-box; padding-bottom: 6px; margin-bottom: 6px; `)]),C("image-card-type",` position: relative; width: 96px; height: 96px; border: var(--n-item-border-image-card); border-radius: var(--n-border-radius); padding: 0; display: flex; align-items: center; justify-content: center; transition: border-color .3s var(--n-bezier), background-color .3s var(--n-bezier); border-radius: var(--n-border-radius); overflow: hidden; `,[h("progress",` position: absolute; left: 8px; bottom: 8px; right: 8px; width: unset; `),h("upload-file-info",` padding: 0; width: 100%; height: 100%; `,[U("thumbnail",` width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 36px; `,[L("img",` width: 100%; `)])]),L("&::before",` position: absolute; z-index: 1; left: 0; right: 0; top: 0; bottom: 0; border-radius: inherit; opacity: 0; transition: opacity .2s var(--n-bezier); content: ""; `),L("&:hover",[L("&::before","opacity: 1;"),h("upload-file-info",[U("thumbnail","opacity: .12;")])])]),C("error-status",[L("&:hover",` background-color: var(--n-item-color-hover-error); `),h("upload-file-info",[U("name","color: var(--n-item-text-color-error);"),U("thumbnail","color: var(--n-item-text-color-error);")]),C("image-card-type",` border: var(--n-item-border-image-card-error); `)]),C("with-url",` cursor: pointer; `,[h("upload-file-info",[U("name",` color: var(--n-item-text-color-success); text-decoration-color: var(--n-item-text-color-success); `,[L("a",` text-decoration: underline; `)])])]),h("upload-file-info",` position: relative; padding-top: 6px; padding-bottom: 6px; display: flex; flex-wrap: nowrap; `,[U("thumbnail",` font-size: 18px; opacity: 1; transition: opacity .2s var(--n-bezier); color: var(--n-item-icon-color); `,[h("base-icon",` margin-right: 2px; vertical-align: middle; transition: color .3s var(--n-bezier); `)]),U("action",` padding-top: inherit; padding-bottom: inherit; position: absolute; right: 0; top: 0; bottom: 0; width: 80px; display: flex; align-items: center; transition: opacity .2s var(--n-bezier); justify-content: flex-end; opacity: 0; `,[h("button",[L("&:not(:last-child)",{marginRight:"4px"}),h("base-icon",[L("svg",[Ne()])])]),C("image-type",` position: relative; max-width: 80px; width: auto; `),C("image-card-type",` z-index: 2; position: absolute; width: 100%; height: 100%; left: 0; right: 0; bottom: 0; top: 0; display: flex; justify-content: center; align-items: center; `)]),U("name",` color: var(--n-item-text-color); flex: 1; display: flex; justify-content: center; text-overflow: ellipsis; overflow: hidden; flex-direction: column; text-decoration-color: #0000; font-size: var(--n-font-size); transition: color .3s var(--n-bezier), text-decoration-color .3s var(--n-bezier); `,[L("a",` color: inherit; text-decoration: underline; `)])])])]),h("upload-file-input",` display: block; width: 0; height: 0; opacity: 0; `)]);var se=globalThis&&globalThis.__awaiter||function(e,i,r,n){function o(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function u(l){try{a(n.next(l))}catch(f){c(f)}}function d(l){try{a(n.throw(l))}catch(f){c(f)}}function a(l){l.done?s(l.value):o(l.value).then(u,d)}a((n=n.apply(e,i||[])).next())})};function xt(e,i,r){const{doChange:n,xhrMap:o}=e;let s=0;function c(d){var a;let l=Object.assign({},i,{status:"error",percentage:s});o.delete(i.id),l=X(((a=e.onError)===null||a===void 0?void 0:a.call(e,{file:l,event:d}))||l),n(l,d)}function u(d){var a;if(e.isErrorState){if(e.isErrorState(r)){c(d);return}}else if(r.status<200||r.status>=300){c(d);return}let l=Object.assign({},i,{status:"finished",percentage:s});o.delete(i.id),l=X(((a=e.onFinish)===null||a===void 0?void 0:a.call(e,{file:l,event:d}))||l),n(l,d)}return{handleXHRLoad:u,handleXHRError:c,handleXHRAbort(d){const a=Object.assign({},i,{status:"removed",file:null,percentage:s});o.delete(i.id),n(a,d)},handleXHRProgress(d){const a=Object.assign({},i,{status:"uploading"});if(d.lengthComputable){const l=Math.ceil(d.loaded/d.total*100);a.percentage=l,s=l}n(a,d)}}}function Ct(e){const{inst:i,file:r,data:n,headers:o,withCredentials:s,action:c,customRequest:u}=e,{doChange:d}=e.inst;let a=0;u({file:r,data:n,headers:o,withCredentials:s,action:c,onProgress(l){const f=Object.assign({},r,{status:"uploading"}),y=l.percent;f.percentage=y,a=y,d(f)},onFinish(){var l;let f=Object.assign({},r,{status:"finished",percentage:a});f=X(((l=i.onFinish)===null||l===void 0?void 0:l.call(i,{file:f}))||f),d(f)},onError(){var l;let f=Object.assign({},r,{status:"error",percentage:a});f=X(((l=i.onError)===null||l===void 0?void 0:l.call(i,{file:f}))||f),d(f)}})}function Rt(e,i,r){const n=xt(e,i,r);r.onabort=n.handleXHRAbort,r.onerror=n.handleXHRError,r.onload=n.handleXHRLoad,r.upload&&(r.upload.onprogress=n.handleXHRProgress)}function xe(e,i){return typeof e=="function"?e({file:i}):e||{}}function kt(e,i,r){const n=xe(i,r);n&&Object.keys(n).forEach(o=>{e.setRequestHeader(o,n[o])})}function Bt(e,i,r){const n=xe(i,r);n&&Object.keys(n).forEach(o=>{e.append(o,n[o])})}function Pt(e,i,r,{method:n,action:o,withCredentials:s,responseType:c,headers:u,data:d}){const a=new XMLHttpRequest;a.responseType=c,e.xhrMap.set(r.id,a),a.withCredentials=s;const l=new FormData;if(Bt(l,d,r),l.append(i,r.file),Rt(e,r,a),o!==void 0){a.open(n.toUpperCase(),o),kt(a,u,r),a.send(l);const f=Object.assign({},r,{status:"uploading"});e.doChange(f)}}const Tt=Object.assign(Object.assign({},Q.props),{name:{type:String,default:"file"},accept:String,action:String,customRequest:Function,directory:Boolean,directoryDnd:{type:Boolean,default:void 0},method:{type:String,default:"POST"},multiple:Boolean,showFileList:{type:Boolean,default:!0},data:[Object,Function],headers:[Object,Function],withCredentials:Boolean,responseType:{type:String,default:""},disabled:{type:Boolean,default:void 0},onChange:Function,onRemove:Function,onFinish:Function,onError:Function,onBeforeUpload:Function,isErrorState:Function,onDownload:Function,defaultUpload:{type:Boolean,default:!0},fileList:Array,"onUpdate:fileList":[Function,Array],onUpdateFileList:[Function,Array],fileListStyle:[String,Object],defaultFileList:{type:Array,default:()=>[]},showCancelButton:{type:Boolean,default:!0},showRemoveButton:{type:Boolean,default:!0},showDownloadButton:Boolean,showRetryButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},listType:{type:String,default:"text"},onPreview:Function,shouldUseThumbnailUrl:{type:Function,default:e=>st?ye(e):!1},createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object,triggerStyle:[String,Object],renderIcon:Object}),St=M({name:"Upload",props:Tt,setup(e){e.abstract&&e.listType==="image-card"&&ee("upload","when the list-type is image-card, abstract is not supported.");const{mergedClsPrefixRef:i,inlineThemeDisabled:r}=ge(e),n=Q("Upload","-upload",wt,Ee,e,i),o=Ae(e),s=R(()=>{const{max:g}=e;return g!==void 0?p.value.length>=g:!1}),c=W(e.defaultFileList),u=F(e,"fileList"),d=W(null),a={value:!1},l=W(!1),f=new Map,y=Me(u,c),p=R(()=>y.value.map(X));function k(){var g;(g=d.value)===null||g===void 0||g.click()}function v(g){const P=g.target;T(P.files?Array.from(P.files).map(S=>({file:S,entry:null,source:"input"})):null,g),P.value=""}function B(g){const{"onUpdate:fileList":P,onUpdateFileList:S}=e;P&&ie(P,g),S&&ie(S,g),c.value=g}const D=R(()=>e.multiple||e.directory);function T(g,P){if(!g||g.length===0)return;const{onBeforeUpload:S}=e;g=D.value?g:[g[0]];const{max:N,accept:O}=e;g=g.filter(({file:z,source:_})=>_==="dnd"&&(O!=null&&O.trim())?ft(z.name,z.type,O):!0),N&&(g=g.slice(0,N-p.value.length));const I=ne();Promise.all(g.map(({file:z,entry:_})=>se(this,void 0,void 0,function*(){var E;const A={id:ne(),batchId:I,name:z.name,status:"pending",percentage:0,file:z,url:null,type:z.type,thumbnailUrl:null,fullPath:(E=_==null?void 0:_.fullPath)!==null&&E!==void 0?E:`/${z.webkitRelativePath||z.name}`};return!S||(yield S({file:A,fileList:p.value}))!==!1?A:null}))).then(z=>se(this,void 0,void 0,function*(){let _=Promise.resolve();return z.forEach(E=>{_=_.then(Xe).then(()=>{E&&$(E,P,{append:!0})})}),yield _})).then(()=>{e.defaultUpload&&x()})}function x(g){const{method:P,action:S,withCredentials:N,headers:O,data:I,name:z}=e,_=g!==void 0?p.value.filter(A=>A.id===g):p.value,E=g!==void 0;_.forEach(A=>{const{status:K}=A;(K==="pending"||K==="error"&&E)&&(e.customRequest?Ct({inst:{doChange:$,xhrMap:f,onFinish:e.onFinish,onError:e.onError},file:A,action:S,withCredentials:N,headers:O,data:I,customRequest:e.customRequest}):Pt({doChange:$,xhrMap:f,onFinish:e.onFinish,onError:e.onError,isErrorState:e.isErrorState},z,A,{method:P,action:S,withCredentials:N,responseType:e.responseType,headers:O,data:I}))})}const $=(g,P,S={append:!1,remove:!1})=>{const{append:N,remove:O}=S,I=Array.from(p.value),z=I.findIndex(_=>_.id===g.id);if(N||O||~z){N?I.push(g):O?I.splice(z,1):I.splice(z,1,g);const{onChange:_}=e;_&&_({file:g,fileList:I,event:P}),B(I)}};function m(g){var P;if(g.thumbnailUrl)return g.thumbnailUrl;const{createThumbnailUrl:S}=e;return S?(P=S(g.file,g))!==null&&P!==void 0?P:g.url||"":g.url?g.url:g.file?at(g.file):""}const b=R(()=>{const{common:{cubicBezierEaseInOut:g},self:{draggerColor:P,draggerBorder:S,draggerBorderHover:N,itemColorHover:O,itemColorHoverError:I,itemTextColorError:z,itemTextColorSuccess:_,itemTextColor:E,itemIconColor:A,itemDisabledOpacity:K,lineHeight:Ce,borderRadius:Re,fontSize:ke,itemBorderImageCardError:Be,itemBorderImageCard:Pe}}=n.value;return{"--n-bezier":g,"--n-border-radius":Re,"--n-dragger-border":S,"--n-dragger-border-hover":N,"--n-dragger-color":P,"--n-font-size":ke,"--n-item-color-hover":O,"--n-item-color-hover-error":I,"--n-item-disabled-opacity":K,"--n-item-icon-color":A,"--n-item-text-color":E,"--n-item-text-color-error":z,"--n-item-text-color-success":_,"--n-line-height":Ce,"--n-item-border-image-card-error":Be,"--n-item-border-image-card":Pe}}),w=r?he("upload",void 0,b,e):void 0;qe(H,{mergedClsPrefixRef:i,mergedThemeRef:n,showCancelButtonRef:F(e,"showCancelButton"),showDownloadButtonRef:F(e,"showDownloadButton"),showRemoveButtonRef:F(e,"showRemoveButton"),showRetryButtonRef:F(e,"showRetryButton"),onRemoveRef:F(e,"onRemove"),onDownloadRef:F(e,"onDownload"),mergedFileListRef:p,triggerStyleRef:F(e,"triggerStyle"),shouldUseThumbnailUrlRef:F(e,"shouldUseThumbnailUrl"),renderIconRef:F(e,"renderIcon"),xhrMap:f,submit:x,doChange:$,showPreviewButtonRef:F(e,"showPreviewButton"),onPreviewRef:F(e,"onPreview"),getFileThumbnailUrlResolver:m,listTypeRef:F(e,"listType"),dragOverRef:l,openOpenFileDialog:k,draggerInsideRef:a,handleFileAddition:T,mergedDisabledRef:o.mergedDisabledRef,maxReachedRef:s,fileListStyleRef:F(e,"fileListStyle"),abstractRef:F(e,"abstract"),acceptRef:F(e,"accept"),cssVarsRef:r?void 0:b,themeClassRef:w==null?void 0:w.themeClass,onRender:w==null?void 0:w.onRender,showTriggerRef:F(e,"showTrigger"),imageGroupPropsRef:F(e,"imageGroupProps"),mergedDirectoryDndRef:R(()=>{var g;return(g=e.directoryDnd)!==null&&g!==void 0?g:e.directory})});const Y={clear:()=>{c.value=[]},submit:x,openOpenFileDialog:k};return Object.assign({mergedClsPrefix:i,draggerInsideRef:a,inputElRef:d,mergedTheme:n,dragOver:l,mergedMultiple:D,cssVars:r?void 0:b,themeClass:w==null?void 0:w.themeClass,onRender:w==null?void 0:w.onRender,handleFileInputChange:v},Y)},render(){var e,i;const{draggerInsideRef:r,mergedClsPrefix:n,$slots:o,directory:s,onRender:c}=this;if(o.default&&!this.abstract){const d=o.default()[0];!((e=d==null?void 0:d.type)===null||e===void 0)&&e[me]&&(r.value=!0)}const u=t("input",Object.assign({},this.inputProps,{ref:"inputElRef",type:"file",class:`${n}-upload-file-input`,accept:this.accept,multiple:this.mergedMultiple,onChange:this.handleFileInputChange,webkitdirectory:s||void 0,directory:s||void 0}));return this.abstract?t(We,null,(i=o.default)===null||i===void 0?void 0:i.call(o),t(He,{to:"body"},u)):(c==null||c(),t("div",{class:[`${n}-upload`,r.value&&`${n}-upload--dragger-inside`,this.dragOver&&`${n}-upload--drag-over`,this.themeClass],style:this.cssVars},u,this.showTrigger&&this.listType!=="image-card"&&t(we,null,o),this.showFileList&&t(yt,null,o)))}});export{we as _,ot as a,yt as b,St as c};