You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/web/dist/assets/Upload.efe3adfd.js

383 lines
41 KiB

import{br as q,h as t,n as $,l as f,o as C,d as A,s as R,bd as E,N as j,bs as re,bt as ie,bu as ne,bv as oe,u as ae,q as G,bw as be,v as J,y as le,e as ye,i as W,be as Y,L as we,bx as se,r as M,aK as xe,bl as Ce,J as V,by as Re,ax as ke,w as Be,bm as Pe,m as I,bz as Q,at as $e,bA as Le,f as Te,t as D,g as Se,A as ze,bB as De,aa as _e,R as Ie,aF as Oe,k as ee}from"./index.f480f018.js";var Fe=q("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"}))))),je=q("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;"}))),Ue=q("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"}))))),Ae=q("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"}))))),Ne=q("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;"}))),Ee=$([f("progress",{display:"inline-block"},[f("progress-icon",`
color: var(--n-icon-color);
transition: color .3s var(--n-bezier);
`),C("line",`
width: 100%;
display: block;
`,[f("progress-content",`
display: flex;
align-items: center;
`,[f("progress-graph",{flex:1})]),f("progress-custom-content",{marginLeft:"14px"}),f("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"},[f("progress-custom-content",`
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
`),f("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;
`),f("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;
`,[f("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);
`)]),f("progress-content",{position:"relative"}),f("progress-graph",{position:"relative"},[f("progress-graph-circle",[$("svg",{verticalAlign:"bottom"}),f("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})]),f("progress-graph-circle-rail",`
transition: stroke .3s var(--n-bezier);
overflow: hidden;
stroke: var(--n-rail-color);
`)]),f("progress-graph-line",[C("indicator-inside",[f("progress-graph-line-rail",`
height: 16px;
line-height: 16px;
border-radius: 10px;
`,[f("progress-graph-line-fill",`
height: inherit;
border-radius: 10px;
`),f("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;
`,[f("progress-graph-line-rail",`
flex: 1;
transition: background-color .3s var(--n-bezier);
`),f("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);
`)]),f("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);
`,[f("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",[$("&::after",`
content: "";
background-image: var(--n-line-bg-processing);
animation: progress-processing-animation 2s var(--n-bezier) infinite;
`)])])])])])]),$("@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;
}
`)]);const He={success:t(re,null),error:t(ie,null),warning:t(ne,null),info:t(oe,null)};var Me=A({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:n}){const i=R(()=>E(e.height)),r=R(()=>e.railBorderRadius!==void 0?E(e.railBorderRadius):e.height!==void 0?E(e.height,{c:.5}):""),l=R(()=>e.fillBorderRadius!==void 0?E(e.fillBorderRadius):e.railBorderRadius!==void 0?E(e.railBorderRadius):e.height!==void 0?E(e.height,{c:.5}):"");return()=>{const{indicatorPlacement:o,railColor:c,railStyle:g,percentage:s,unit:d,indicatorTextColor:a,status:u,showIndicator:b,fillColor:h,processing:k,clsPrefix:y}=e;return t("div",{class:`${y}-progress-content`,role:"none"},t("div",{class:`${y}-progress-graph`,"aria-hidden":!0},t("div",{class:[`${y}-progress-graph-line`,{[`${y}-progress-graph-line--indicator-${o}`]:!0}]},t("div",{class:`${y}-progress-graph-line-rail`,style:[{backgroundColor:c,height:i.value,borderRadius:r.value},g]},t("div",{class:[`${y}-progress-graph-line-fill`,k&&`${y}-progress-graph-line-fill--processing`],style:{maxWidth:`${e.percentage}%`,backgroundColor:h,height:i.value,lineHeight:i.value,borderRadius:l.value}},o==="inside"?t("div",{class:`${y}-progress-graph-line-indicator`},s,d):null)))),b&&o==="outside"?t("div",null,n.default?t("div",{class:`${y}-progress-custom-content`,style:{color:a},role:"none"},n.default()):u==="default"?t("div",{role:"none",class:`${y}-progress-icon ${y}-progress-icon--as-text`,style:{color:a}},s,d):t("div",{class:`${y}-progress-icon`,"aria-hidden":!0},t(j,{clsPrefix:y},{default:()=>He[u]}))):null)}}});const qe={success:t(re,null),error:t(ie,null),warning:t(ne,null),info:t(oe,null)};var We=A({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:n}){function i(r,l,o){const{gapDegree:c,viewBoxWidth:g}=e,s=50,d=0,a=s,u=0,b=2*s,h=`M 55,55 m ${d},${a}
a ${s},${s} 0 1 1 ${u},${-b}
a ${s},${s} 0 1 1 ${-u},${b}`,k=Math.PI*2*s,y={stroke:o,strokeDasharray:`${r/100*(k-c)}px ${g*8}px`,strokeDashoffset:`-${c/2+Math.PI/3.6*l}px`};return{pathString:h,pathStyle:y}}return()=>{const{fillColor:r,railColor:l,strokeWidth:o,offsetDegree:c,status:g,percentage:s,showIndicator:d,indicatorTextColor:a,unit:u,gapOffsetDegree:b,clsPrefix:h}=e,{pathString:k,pathStyle:y}=i(100,0,l),{pathString:B,pathStyle:w}=i(s,c,r);return t("div",{class:`${h}-progress-content`,role:"none"},t("div",{class:`${h}-progress-graph`,"aria-hidden":!0},t("div",{class:`${h}-progress-graph-circle`,style:{transform:b?`rotate(${b}deg)`:void 0}},t("svg",{viewBox:"0 0 110 110"},t("g",null,t("path",{class:`${h}-progress-graph-circle-rail`,d:k,"stroke-width":o,"stroke-linecap":"round",fill:"none",style:y})),t("g",null,t("path",{class:[`${h}-progress-graph-circle-fill`,s===0&&`${h}-progress-graph-circle-fill--empty`],d:B,"stroke-width":o,"stroke-linecap":"round",fill:"none",style:w}))))),d?t("div",null,n.default?t("div",{class:`${h}-progress-custom-content`,role:"none"},n.default()):g!=="default"?t("div",{class:`${h}-progress-icon`,"aria-hidden":!0},t(j,{clsPrefix:h},{default:()=>qe[g]})):t("div",{class:`${h}-progress-text`,style:{color:a},role:"none"},t("span",{class:`${h}-progress-text__percentage`},s),t("span",{class:`${h}-progress-text__unit`},u))):null)}}});function te(e,n,i=100){return`m ${i/2} ${i/2-e} a ${e} ${e} 0 1 1 0 ${2*e} a ${e} ${e} 0 1 1 0 -${2*e}`}var Xe=A({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:n}){const i=R(()=>e.percentage.map((l,o)=>`${Math.PI*l/100*(e.viewBoxWidth/2-e.strokeWidth/2*(1+2*o)-e.circleGap*o)*2}, ${e.viewBoxWidth*8}`));return()=>{const{viewBoxWidth:r,strokeWidth:l,circleGap:o,showIndicator:c,fillColor:g,railColor:s,railStyle:d,percentage:a,clsPrefix:u}=e;return t("div",{class:`${u}-progress-content`,role:"none"},t("div",{class:`${u}-progress-graph`,"aria-hidden":!0},t("div",{class:`${u}-progress-graph-circle`},t("svg",{viewBox:`0 0 ${r} ${r}`},a.map((b,h)=>t("g",{key:h},t("path",{class:`${u}-progress-graph-circle-rail`,d:te(r/2-l/2*(1+2*h)-o*h,l,r),"stroke-width":l,"stroke-linecap":"round",fill:"none",style:[{strokeDashoffset:0,stroke:s[h]},d[h]]}),t("path",{class:[`${u}-progress-graph-circle-fill`,b===0&&`${u}-progress-graph-circle-fill--empty`],d:te(r/2-l/2*(1+2*h)-o*h,l,r),"stroke-width":l,"stroke-linecap":"round",fill:"none",style:{strokeDasharray:i.value[h],strokeDashoffset:0,stroke:g[h]}})))))),c&&n.default?t("div",null,t("div",{class:`${u}-progress-text`},n.default())):null)}}});const Ve=Object.assign(Object.assign({},G.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});var Ge=A({name:"Progress",props:Ve,setup(e){const n=R(()=>e.indicatorPlacement||e.indicatorPosition),i=R(()=>{if(e.gapDegree||e.gapDegree===0)return e.gapDegree;if(e.type==="dashboard")return 75}),{mergedClsPrefixRef:r,inlineThemeDisabled:l}=ae(e),o=G("Progress","-progress",Ee,be,e,r),c=R(()=>{const{status:s}=e,{common:{cubicBezierEaseInOut:d},self:{fontSize:a,fontSizeCircle:u,railColor:b,railHeight:h,iconSizeCircle:k,iconSizeLine:y,textColorCircle:B,textColorLineInner:w,textColorLineOuter:x,lineBgProcessing:O,fontWeightCircle:p,[J("iconColor",s)]:v,[J("fillColor",s)]:T}}=o.value;return{"--n-bezier":d,"--n-fill-color":T,"--n-font-size":a,"--n-font-size-circle":u,"--n-font-weight-circle":p,"--n-icon-color":v,"--n-icon-size-circle":k,"--n-icon-size-line":y,"--n-line-bg-processing":O,"--n-rail-color":b,"--n-rail-height":h,"--n-text-color-circle":B,"--n-text-color-line-inner":w,"--n-text-color-line-outer":x}}),g=l?le("progress",R(()=>e.status[0]),c,e):void 0;return{mergedClsPrefix:r,mergedIndicatorPlacement:n,gapDeg:i,cssVars:l?void 0:c,themeClass:g==null?void 0:g.themeClass,onRender:g==null?void 0:g.onRender}},render(){const{type:e,cssVars:n,indicatorTextColor:i,showIndicator:r,status:l,railColor:o,railStyle:c,color:g,percentage:s,viewBoxWidth:d,strokeWidth:a,mergedIndicatorPlacement:u,unit:b,borderRadius:h,fillBorderRadius:k,height:y,processing:B,circleGap:w,mergedClsPrefix:x,gapDeg:O,gapOffsetDegree:p,themeClass:v,$slots:T,onRender:m}=this;return m==null||m(),t("div",{class:[v,`${x}-progress`,`${x}-progress--${e}`,`${x}-progress--${l}`],style:n,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,role:e==="circle"||e==="line"||e==="dashboard"?"progressbar":"none"},e==="circle"||e==="dashboard"?t(We,{clsPrefix:x,status:l,showIndicator:r,indicatorTextColor:i,railColor:o,fillColor:g,railStyle:c,offsetDegree:this.offsetDegree,percentage:s,viewBoxWidth:d,strokeWidth:a,gapDegree:O===void 0?e==="dashboard"?75:0:O,gapOffsetDegree:p,unit:b},T):e==="line"?t(Me,{clsPrefix:x,status:l,showIndicator:r,indicatorTextColor:i,railColor:o,fillColor:g,railStyle:c,percentage:s,processing:B,indicatorPlacement:u,unit:b,fillBorderRadius:k,railBorderRadius:h,height:y},T):e==="multiple-circle"?t(Xe,{clsPrefix:x,strokeWidth:a,railColor:o,fillColor:g,railStyle:c,viewBoxWidth:d,percentage:s,showIndicator:r,circleGap:w},T):null)}});const H=ye("n-upload"),de="__UPLOAD_DRAGGER__";var Ye=A({name:"UploadDragger",[de]:!0,setup(e,{slots:n}){const i=W(H,null);return i||Y("upload-dragger","`n-upload-dragger` must be placed inside `n-upload`."),()=>{const{mergedClsPrefixRef:{value:r},mergedDisabledRef:{value:l}}=i;return t("div",{class:[`${r}-upload-dragger`,l&&`${r}-upload-dragger--disabled`]},n)}}}),Ke=globalThis&&globalThis.__awaiter||function(e,n,i,r){function l(o){return o instanceof i?o:new i(function(c){c(o)})}return new(i||(i=Promise))(function(o,c){function g(a){try{d(r.next(a))}catch(u){c(u)}}function s(a){try{d(r.throw(a))}catch(u){c(u)}}function d(a){a.done?o(a.value):l(a.value).then(g,s)}d((r=r.apply(e,n||[])).next())})};const ce=e=>e.includes("image/"),Ze=(e="")=>{const n=e.split("/"),r=n[n.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(r)||[""])[0]},Je=e=>{if(e.type)return ce(e.type);const n=e.thumbnailUrl||e.url||"",i=Ze(n);return/^data:image\//.test(n)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(i)?!0:!(/^data:/.test(n)||i)};function Qe(e){return Ke(this,void 0,void 0,function*(){return yield new Promise(n=>{if(!e.type||!ce(e.type)){n("");return}const i=new Image;i.src=window.URL.createObjectURL(e),i.onload=()=>{const{width:r,height:l}=i,o=document.createElement("canvas"),c=o.getContext("2d");o.width=r,o.height=l,o.style.cssText=`position: fixed; left: 0; top: 0; width: ${r}px; height: ${l}px; z-index: 9999; display: none;`,document.body.appendChild(o),c==null||c.drawImage(i,0,0,r,l);const g=o.toDataURL();document.body.removeChild(o),n(g)}})})}const et=typeof document!="undefined"&&typeof window!="undefined"&&window.FileReader&&window.File;var ue=A({name:"UploadTrigger",props:{abstract:Boolean},setup(e,{slots:n}){const i=W(H,null);i||Y("upload-trigger","`n-upload-trigger` must be placed inside `n-upload`.");const{mergedClsPrefixRef:r,mergedDisabledRef:l,maxReachedRef:o,listTypeRef:c,dragOverRef:g,openOpenFileDialog:s,draggerInsideRef:d,handleFileAddition:a}=i,u=R(()=>c.value==="image-card");function b(){l.value||o.value||s()}function h(w){w.preventDefault(),g.value=!0}function k(w){w.preventDefault(),g.value=!0}function y(w){w.preventDefault(),g.value=!1}function B(w){if(w.preventDefault(),!d.value||l.value||o.value)return;const x=w.dataTransfer,O=x==null?void 0:x.files;O&&a(O),g.value=!1}return()=>{var w;const{value:x}=r;return e.abstract?(w=n.default)===null||w===void 0?void 0:w.call(n,{handleClick:b,handleDrop:B,handleDragOver:h,handleDragEnter:k,handleDragLeave:y}):t("div",{class:[`${x}-upload-trigger`,(l.value||o.value)&&`${x}-upload-trigger--disabled`,u.value&&`${x}-upload-trigger--image-card`],onClick:b,onDrop:B,onDragover:h,onDragenter:k,onDragleave:y},u.value?t(Ye,null,{default:n.default||(()=>t(j,{clsPrefix:x},{default:()=>t(we,null)}))}):n)}}}),tt=A({name:"UploadProgress",props:{show:Boolean,percentage:{type:Number,required:!0},status:{type:String,required:!0}},setup(){return{mergedTheme:W(H).mergedThemeRef}},render(){return t(se,null,{default:()=>this.show?t(Ge,{type:"line",showIndicator:!1,percentage:this.percentage,status:this.status,height:2,theme:this.mergedTheme.peers.Progress,themeOverrides:this.mergedTheme.peerOverrides.Progress}):null})}});const rt=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"}))),it=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 nt=globalThis&&globalThis.__awaiter||function(e,n,i,r){function l(o){return o instanceof i?o:new i(function(c){c(o)})}return new(i||(i=Promise))(function(o,c){function g(a){try{d(r.next(a))}catch(u){c(u)}}function s(a){try{d(r.throw(a))}catch(u){c(u)}}function d(a){a.done?o(a.value):l(a.value).then(g,s)}d((r=r.apply(e,n||[])).next())})},ot=A({name:"UploadFile",props:{clsPrefix:{type:String,required:!0},file:{type:Object,required:!0},listType:{type:String,required:!0}},setup(e){const n=W(H),i=M(null),r=M(""),l=R(()=>{const{file:p}=e;return p.status==="finished"?"success":p.status==="error"?"error":"info"}),o=R(()=>{const{file:p}=e;if(p.status==="error")return"error"}),c=R(()=>{const{file:p}=e;return p.status==="uploading"}),g=R(()=>{if(!n.showCancelButtonRef.value)return!1;const{file:p}=e;return["uploading","pending","error"].includes(p.status)}),s=R(()=>{if(!n.showRemoveButtonRef.value)return!1;const{file:p}=e;return["finished"].includes(p.status)}),d=R(()=>{if(!n.showDownloadButtonRef.value)return!1;const{file:p}=e;return["finished"].includes(p.status)}),a=R(()=>{if(!n.showRetryButtonRef.value)return!1;const{file:p}=e;return["error"].includes(p.status)}),u=R(()=>{if(!n.showPreviewButtonRef.value)return!1;const{file:{status:p,url:v},listType:T}=e;return["finished"].includes(p)&&(v||r.value)&&T==="image-card"});function b(){n.submit(e.file.id)}function h(p){p.preventDefault();const{file:v}=e;["finished","pending","error"].includes(v.status)?y(v):["uploading"].includes(v.status)?w(v):Be("upload","The button clicked type is unknown.")}function k(p){p.preventDefault(),B(e.file)}function y(p){const{XhrMap:v,doChange:T,onRemoveRef:{value:m},mergedFileListRef:{value:P}}=n;Promise.resolve(m?m({file:Object.assign({},p),fileList:P}):!0).then(S=>{if(S===!1)return;const _=Object.assign({},p,{status:"removed"});v.delete(p.id),T(_,void 0,{remove:!0})})}function B(p){const{onDownloadRef:{value:v}}=n;Promise.resolve(v?v(Object.assign({},p)):!0).then(T=>{})}function w(p){const{XhrMap:v}=n,T=v.get(p.id);T==null||T.abort(),y(Object.assign({},p))}function x(){const{onPreviewRef:{value:p}}=n;if(p)p(e.file);else if(e.listType==="image-card"){const{value:v}=i;if(!v)return;v.click()}}const O=()=>nt(this,void 0,void 0,function*(){const{listType:p}=e;p!=="image"&&p!=="image-card"||!et||!(e.file.file instanceof File)||(r.value=yield n.getFileThumbnailUrl(e.file))});return xe(()=>{O()}),{mergedTheme:n.mergedThemeRef,progressStatus:l,buttonType:o,showProgress:c,disabled:n.mergedDisabledRef,showCancelButton:g,showRemoveButton:s,showDownloadButton:d,showRetryButton:a,showPreviewButton:u,thumbnailUrl:r,imageRef:i,handleRemoveOrCancelClick:h,handleDownloadClick:k,handleRetryClick:b,handlePreviewClick:x}},render(){const{clsPrefix:e,mergedTheme:n,listType:i,file:r}=this;let l;const o=i==="image";o||i==="image-card"?l=Je(r)?(r.url||this.thumbnailUrl)&&r.status!=="error"?t("a",{rel:"noopener noreferer",target:"_blank",href:r.url||void 0,class:`${e}-upload-file-info__thumbnail`,onClick:this.handlePreviewClick},i==="image-card"?t(Ce,{src:this.thumbnailUrl||r.thumbnailUrl||r.url||void 0,previewSrc:r.url||void 0,alt:r.name,ref:"imageRef"}):t("img",{src:this.thumbnailUrl||r.thumbnailUrl||r.url||void 0,alt:r.name})):t("span",{class:`${e}-upload-file-info__thumbnail`},t(j,{clsPrefix:e},{default:()=>rt})):t("span",{class:`${e}-upload-file-info__thumbnail`},t(j,{clsPrefix:e},{default:()=>it})):l=t("span",{class:`${e}-upload-file-info__thumbnail`},t(j,{clsPrefix:e},{default:()=>t(Fe,null)}));const g=t(tt,{show:this.showProgress,percentage:r.percentage||0,status:this.progressStatus}),s=i==="text"||i==="image";return t("div",{class:[`${e}-upload-file`,`${e}-upload-file--${this.progressStatus}-status`,r.url&&r.status!=="error"&&i!=="image-card"&&`${e}-upload-file--with-url`,`${e}-upload-file--${i}-type`]},t("div",{class:`${e}-upload-file-info`},l,t("div",{class:`${e}-upload-file-info__name`},s&&(r.url&&r.status!=="error"?t("a",{rel:"noopener noreferer",target:"_blank",href:r.url||void 0,onClick:this.handlePreviewClick},r.name):t("span",{onClick:this.handlePreviewClick},r.name)),o&&g),t("div",{class:[`${e}-upload-file-info__action`,`${e}-upload-file-info__action--${i}-type`]},this.showPreviewButton?t(V,{key:"preview",text:!0,type:this.buttonType,onClick:this.handlePreviewClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Re,null)})}):null,(this.showRemoveButton||this.showCancelButton)&&!this.disabled&&t(V,{key:"cancelOrTrash",theme:n.peers.Button,themeOverrides:n.peerOverrides.Button,text:!0,type:this.buttonType,onClick:this.handleRemoveOrCancelClick},{icon:()=>t(ke,null,{default:()=>this.showRemoveButton?t(j,{clsPrefix:e,key:"trash"},{default:()=>t(je,null)}):t(j,{clsPrefix:e,key:"cancel"},{default:()=>t(Ae,null)})})}),this.showRetryButton&&!this.disabled&&t(V,{key:"retry",text:!0,type:this.buttonType,onClick:this.handleRetryClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Ne,null)})}),this.showDownloadButton?t(V,{key:"download",text:!0,type:this.buttonType,onClick:this.handleDownloadClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Ue,null)})}):null)),!o&&g)}}),at=A({name:"UploadFileList",setup(e,{slots:n}){const i=W(H,null);i||Y("upload-file-list","`n-upload-file-list` must be placed inside `n-upload`.");const{abstractRef:r,mergedClsPrefixRef:l,listTypeRef:o,mergedFileListRef:c,fileListStyleRef:g,cssVarsRef:s,themeClassRef:d,maxReachedRef:a,showTriggerRef:u,imageGroupPropsRef:b}=i,h=R(()=>o.value==="image-card"),k=()=>c.value.map(B=>t(ot,{clsPrefix:l.value,key:B.id,file:B,listType:o.value})),y=()=>h.value?t(Pe,Object.assign({},b.value),{default:k}):t(se,{group:!0},{default:k});return()=>{const{value:B}=l,{value:w}=r;return t("div",{class:[`${B}-upload-file-list`,h.value&&`${B}-upload-file-list--grid`,w?d==null?void 0:d.value:void 0],style:[w&&s?s.value:"",g.value]},y(),u.value&&!a.value&&h.value&&t(ue,null,n))}}}),lt=$([f("upload","width: 100%;",[C("dragger-inside",[I("trigger",`
display: block;
`)]),C("drag-over",[f("upload-dragger",`
border: var(--n-dragger-border-hover);
`)])]),f("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);
`,[$("&:hover",`
border: var(--n-dragger-border-hover);
`),C("disabled",`
opacity: var(--n-item-disabled-opacity);
cursor: not-allowed;
`)]),f("upload-trigger",`
display: inline-block;
box-sizing: border-box;
opacity: 1;
transition: opacity .3s var(--n-bezier);
`,[$("+",[f("upload-file-list","margin-top: 8px;")]),C("disabled",`
opacity: var(--n-item-disabled-opacity);
cursor: not-allowed;
`),C("image-card",`
width: 96px;
height: 96px;
`,[f("base-icon",`
font-size: 24px;
`),f("upload-dragger",`
padding: 0;
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
`)])]),f("upload-file-list",`
line-height: var(--n-line-height);
opacity: 1;
transition: opacity .3s var(--n-bezier);
`,[C("disabled",`
opacity: var(--n-item-disabled-opacity);
cursor: not-allowed;
`,[f("upload-file","cursor: not-allowed;")]),C("grid",`
display: grid;
grid-template-columns: repeat(auto-fill, 96px);
grid-gap: 8px;
margin-top: 0;
`),f("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);
`,[Q(),f("progress",[Q({foldPadding:!0})]),$("&:hover",`
background-color: var(--n-item-color-hover);
`,[f("upload-file-info",[I("action",`
opacity: 1;
`)])]),C("image-type",`
border-radius: var(--n-border-radius);
text-decoration: underline;
text-decoration-color: #0000;
`,[f("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;
`,[f("progress",`
padding: 2px 0;
margin-bottom: 0;
`),I("name",`
padding: 0 8px;
`),I("thumbnail",`
width: 32px;
height: 32px;
font-size: 28px;
display: flex;
justify-content: center;
align-items: center;
`,[$("img",`
width: 100%;
`)])])]),C("text-type",[f("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);
`,[f("progress",`
position: absolute;
left: 8px;
bottom: 8px;
right: 8px;
width: unset;
`),f("upload-file-info",`
padding: 0;
width: 100%;
height: 100%;
`,[I("thumbnail",`
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 36px;
`,[$("img",`
width: 100%;
`)])]),$("&::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: "";
`),$("&:hover",[$("&::before","opacity: 1;"),f("upload-file-info",[I("thumbnail","opacity: .12;")])])]),C("error-status",[$("&:hover",`
background-color: var(--n-item-color-hover-error);
`),f("upload-file-info",[I("name","color: var(--n-item-text-color-error);"),I("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;
`,[f("upload-file-info",[I("name",`
color: var(--n-item-text-color-success);
text-decoration-color: var(--n-item-text-color-success);
`,[$("a",`
text-decoration: underline;
`)])])]),f("upload-file-info",`
position: relative;
padding-top: 6px;
padding-bottom: 6px;
display: flex;
flex-wrap: nowrap;
`,[I("thumbnail",`
font-size: 18px;
opacity: 1;
transition: opacity .2s var(--n-bezier);
color: var(--n-item-icon-color);
`,[f("base-icon",`
margin-right: 2px;
vertical-align: middle;
transition: color .3s var(--n-bezier);
`)]),I("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;
`,[f("button",[$("&:not(:last-child)",{marginRight:"4px"}),f("base-icon",[$("svg",[$e()])])]),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;
`)]),I("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);
`,[$("a",`
color: inherit;
text-decoration: underline;
`)])])])]),f("upload-file-input",`
display: block;
width: 0;
height: 0;
opacity: 0;
`)]),Z=globalThis&&globalThis.__awaiter||function(e,n,i,r){function l(o){return o instanceof i?o:new i(function(c){c(o)})}return new(i||(i=Promise))(function(o,c){function g(a){try{d(r.next(a))}catch(u){c(u)}}function s(a){try{d(r.throw(a))}catch(u){c(u)}}function d(a){a.done?o(a.value):l(a.value).then(g,s)}d((r=r.apply(e,n||[])).next())})};function st(e,n,i){const{doChange:r,XhrMap:l}=e;let o=0;function c(s){var d;let a=Object.assign({},n,{status:"error",percentage:o});l.delete(n.id),a=((d=e.onError)===null||d===void 0?void 0:d.call(e,{file:a,event:s}))||a,r(a,s)}function g(s){var d;if(i.status<200||i.status>=300){c(s);return}let a=Object.assign({},n,{status:"finished",percentage:o,file:null});l.delete(n.id),a=((d=e.onFinish)===null||d===void 0?void 0:d.call(e,{file:a,event:s}))||a,r(a,s)}return{handleXHRLoad:g,handleXHRError:c,handleXHRAbort(s){const d=Object.assign({},n,{status:"removed",file:null,percentage:o});l.delete(n.id),r(d,s)},handleXHRProgress(s){const d=Object.assign({},n,{status:"uploading"});if(s.lengthComputable){const a=Math.ceil(s.loaded/s.total*100);d.percentage=a,o=a}r(d,s)}}}function dt(e){const{inst:n,file:i,data:r,headers:l,withCredentials:o,action:c,customRequest:g}=e,{doChange:s}=e.inst;let d=0;g({file:i,data:r,headers:l,withCredentials:o,action:c,onProgress(a){const u=Object.assign({},i,{status:"uploading"}),b=a.percent;u.percentage=b,d=b,s(u)},onFinish(){var a;let u=Object.assign({},i,{status:"finished",percentage:d,file:null});u=((a=n.onFinish)===null||a===void 0?void 0:a.call(n,{file:u}))||u,s(u)},onError(){var a;let u=Object.assign({},i,{status:"error",percentage:d});u=((a=n.onError)===null||a===void 0?void 0:a.call(n,{file:u}))||u,s(u)}})}function ct(e,n,i){const r=st(e,n,i);i.onabort=r.handleXHRAbort,i.onerror=r.handleXHRError,i.onload=r.handleXHRLoad,i.upload&&(i.upload.onprogress=r.handleXHRProgress)}function ge(e,n){return typeof e=="function"?e({file:n}):e||{}}function ut(e,n,i){const r=ge(n,i);!r||Object.keys(r).forEach(l=>{e.setRequestHeader(l,r[l])})}function gt(e,n,i){const r=ge(n,i);!r||Object.keys(r).forEach(l=>{e.append(l,r[l])})}function ft(e,n,i,{method:r,action:l,withCredentials:o,headers:c,data:g}){const s=new XMLHttpRequest;e.XhrMap.set(i.id,s),s.withCredentials=o;const d=new FormData;if(gt(d,g,i),d.append(n,i.file),ct(e,i,s),l!==void 0){s.open(r.toUpperCase(),l),ut(s,c,i),s.send(d);const a=Object.assign({},i,{status:"uploading"});e.doChange(a)}}const pt=Object.assign(Object.assign({},G.props),{name:{type:String,default:"file"},accept:String,action:String,customRequest:Function,method:{type:String,default:"POST"},multiple:Boolean,showFileList:{type:Boolean,default:!0},data:[Object,Function],headers:[Object,Function],withCredentials:Boolean,disabled:{type:Boolean,default:void 0},onChange:Function,onRemove:Function,onFinish:Function,onError:Function,onBeforeUpload: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,createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object});var mt=A({name:"Upload",props:pt,setup(e){e.abstract&&e.listType==="image-card"&&Y("upload","when the list-type is image-card, abstract is not supported.");const{mergedClsPrefixRef:n,inlineThemeDisabled:i}=ae(e),r=G("Upload","-upload",lt,Le,e,n),l=Te(e),o=R(()=>{const{max:m}=e;return m!==void 0?b.value.length>=m:!1}),c=M(e.defaultFileList),g=D(e,"fileList"),s=M(null),d={value:!1},a=M(!1),u=new Map,b=Se(g,c);function h(){var m;(m=s.value)===null||m===void 0||m.click()}function k(m){const P=m.target;B(P.files,m),P.value=""}function y(m){const{"onUpdate:fileList":P,onUpdateFileList:S}=e;P&&ee(P,m),S&&ee(S,m),c.value=m}function B(m,P){if(!m||m.length===0)return;const{onBeforeUpload:S}=e;let _=e.multiple?Array.from(m):[m[0]];const{max:U}=e;U&&(_=_.slice(0,U-b.value.length)),Promise.all(_.map(L=>Z(this,void 0,void 0,function*(){const z={id:Ie(),name:L.name,status:"pending",percentage:0,file:L,url:null,type:L.type,thumbnailUrl:null};return!S||(yield S({file:z,fileList:b.value}))!==!1?z:null}))).then(L=>Z(this,void 0,void 0,function*(){let z=Promise.resolve();return L.forEach(F=>{z=z.then(Oe).then(()=>{F&&x(F,P,{append:!0})})}),yield z})).then(()=>{e.defaultUpload&&w()})}function w(m){const{method:P,action:S,withCredentials:_,headers:U,data:L,name:z}=e,F=m!==void 0?b.value.filter(N=>N.id===m):b.value,K=m!==void 0;F.forEach(N=>{const{status:X}=N;(X==="pending"||X==="error"&&K)&&(e.customRequest?dt({inst:{doChange:x,XhrMap:u,onFinish:e.onFinish,onError:e.onError},file:N,action:S,withCredentials:_,headers:U,data:L,customRequest:e.customRequest}):ft({doChange:x,XhrMap:u,onFinish:e.onFinish,onError:e.onError},z,N,{method:P,action:S,withCredentials:_,headers:U,data:L}))})}const x=(m,P,S={append:!1,remove:!1})=>{const{append:_,remove:U}=S,L=Array.from(b.value),z=L.findIndex(F=>F.id===m.id);if(_||U||~z){_?L.push(m):U?L.splice(z,1):L.splice(z,1,m);const{onChange:F}=e;F&&F({file:m,fileList:L,event:P}),y(L)}};function O(m){return Z(this,void 0,void 0,function*(){const{createThumbnailUrl:P}=e;return P?yield P(m.file):yield Qe(m.file)})}const p=R(()=>{const{common:{cubicBezierEaseInOut:m},self:{draggerColor:P,draggerBorder:S,draggerBorderHover:_,itemColorHover:U,itemColorHoverError:L,itemTextColorError:z,itemTextColorSuccess:F,itemTextColor:K,itemIconColor:N,itemDisabledOpacity:X,lineHeight:fe,borderRadius:pe,fontSize:he,itemBorderImageCardError:me,itemBorderImageCard:ve}}=r.value;return{"--n-bezier":m,"--n-border-radius":pe,"--n-dragger-border":S,"--n-dragger-border-hover":_,"--n-dragger-color":P,"--n-font-size":he,"--n-item-color-hover":U,"--n-item-color-hover-error":L,"--n-item-disabled-opacity":X,"--n-item-icon-color":N,"--n-item-text-color":K,"--n-item-text-color-error":z,"--n-item-text-color-success":F,"--n-line-height":fe,"--n-item-border-image-card-error":me,"--n-item-border-image-card":ve}}),v=i?le("upload",void 0,p,e):void 0;ze(H,{mergedClsPrefixRef:n,mergedThemeRef:r,showCancelButtonRef:D(e,"showCancelButton"),showDownloadButtonRef:D(e,"showDownloadButton"),showRemoveButtonRef:D(e,"showRemoveButton"),showRetryButtonRef:D(e,"showRetryButton"),onRemoveRef:D(e,"onRemove"),onDownloadRef:D(e,"onDownload"),mergedFileListRef:b,XhrMap:u,submit:w,doChange:x,showPreviewButtonRef:D(e,"showPreviewButton"),onPreviewRef:D(e,"onPreview"),getFileThumbnailUrl:O,listTypeRef:D(e,"listType"),dragOverRef:a,openOpenFileDialog:h,draggerInsideRef:d,handleFileAddition:B,mergedDisabledRef:l.mergedDisabledRef,maxReachedRef:o,fileListStyleRef:D(e,"fileListStyle"),abstractRef:D(e,"abstract"),cssVarsRef:i?void 0:p,themeClassRef:v==null?void 0:v.themeClass,onRender:v==null?void 0:v.onRender,showTriggerRef:D(e,"showTrigger"),imageGroupPropsRef:D(e,"imageGroupProps")});const T={clear:()=>{c.value=[]},submit:w,openOpenFileDialog:h};return Object.assign({mergedClsPrefix:n,draggerInsideRef:d,inputElRef:s,mergedTheme:r,dragOver:a,handleFileInputChange:k,cssVars:i?void 0:p,themeClass:v==null?void 0:v.themeClass,onRender:v==null?void 0:v.onRender},T)},render(){var e,n;const{draggerInsideRef:i,mergedClsPrefix:r,$slots:l,onRender:o}=this;if(l.default&&!this.abstract){const g=l.default()[0];!((e=g==null?void 0:g.type)===null||e===void 0)&&e[de]&&(i.value=!0)}const c=t("input",Object.assign({},this.inputProps,{ref:"inputElRef",type:"file",class:`${r}-upload-file-input`,accept:this.accept,multiple:this.multiple,onChange:this.handleFileInputChange}));return this.abstract?t(_e,null,(n=l.default)===null||n===void 0?void 0:n.call(l),t(De,{to:"body"},c)):(o==null||o(),t("div",{class:[`${r}-upload`,i.value&&`${r}-upload--dragger-inside`,this.dragOver&&`${r}-upload--drag-over`,this.themeClass],style:this.cssVars},c,this.showTrigger&&this.listType!=="image-card"&&t(ue,null,l),this.showFileList&&t(at,null,l)))}});export{ue as _,Ge as a,at as b,mt as c};