import{e as d,ax as ne,d as Z,i as q,x as ue,M as qe,aq as ie,ae as j,aj as P,aw as ee,aJ as le,ad as Ne,a8 as Ie,j as ce,aD as ln,ac as cn,a0 as Ge,aE as We,af as un,aO as sn,aP as dn,ap as fn,a3 as vn,ab as Le,aC as pn,aB as mn,aM as Ae,ag as me,aL as gn,aN as hn,ar as ge,ai as wn,ay as bn}from"./index-864e73c5.js";import{k as yn,h as In,u as Fn,_ as Xe,T as Pn}from"./isSymbol-cbbd997a.js";import{i as Fe}from"./_plugin-vue_export-helper-a65526b0.js";import{p as On}from"./pickAttrs-bb0043f0.js";import{b as Cn}from"./index-391eda35.js";import{B as Ee}from"./index-69195e76.js";import{E as Rn}from"./index-7c172d43.js";import{P as Dn}from"./index-041723b0.js";import{e as Sn}from"./index-e8adaad2.js";import{u as Tn}from"./useState-85b22590.js";import{a as Un}from"./FormItemContext-37273d98.js";var xn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};const kn=xn;function Be(t){for(var e=1;e0&&(c.percent=c.loaded/c.total*100),t.onProgress(c)});var n=new FormData;t.data&&Object.keys(t.data).forEach(function(a){var c=t.data[a];if(Array.isArray(c)){c.forEach(function(f){n.append("".concat(a,"[]"),f)});return}n.append(a,c)}),t.file instanceof Blob?n.append(t.filename,t.file,t.file.name):n.append(t.filename,t.file),e.onerror=function(c){t.onError(c)},e.onload=function(){return e.status<200||e.status>=300?t.onError(An(t,e),Me(e)):t.onSuccess(Me(e),e)},e.open(t.method,t.action,!0),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);var r=t.headers||{};return r["X-Requested-With"]!==null&&e.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(r).forEach(function(a){r[a]!==null&&e.setRequestHeader(a,r[a])}),e.send(n),{abort:function(){e.abort()}}}var Bn=+new Date,Mn=0;function he(){return"vc-upload-".concat(Bn,"-").concat(++Mn)}const we=function(t,e){if(t&&e){var n=Array.isArray(e)?e:e.split(","),r=t.name||"",a=t.type||"",c=a.replace(/\/.*$/,"");return n.some(function(f){var h=f.trim();if(/^\*(\/\*)?$/.test(f))return!0;if(h.charAt(0)==="."){var D=r.toLowerCase(),C=h.toLowerCase(),L=[C];return(C===".jpg"||C===".jpeg")&&(L=[".jpg",".jpeg"]),L.some(function(B){return D.endsWith(B)})}return/\/\*$/.test(h)?c===h.replace(/\/.*$/,""):!!(a===h||/^\w+$/.test(h))})}return!0};function $n(t,e){var n=t.createReader(),r=[];function a(){n.readEntries(function(c){var f=Array.prototype.slice.apply(c);r=r.concat(f);var h=!f.length;h?e(r):a()})}a()}var zn=function(e,n,r){var a=function c(f,h){f.path=h||"",f.isFile?f.file(function(D){r(D)&&(f.fullPath&&!D.webkitRelativePath&&(Object.defineProperties(D,{webkitRelativePath:{writable:!0}}),D.webkitRelativePath=f.fullPath.replace(/^\//,""),Object.defineProperties(D,{webkitRelativePath:{writable:!1}})),n([D]))}):f.isDirectory&&$n(f,function(D){D.forEach(function(C){c(C,"".concat(h).concat(f.name,"/"))})})};e.forEach(function(c){a(c.webkitGetAsEntry())})};const Hn=zn;var Je=function(){return{capture:[Boolean,String],multipart:{type:Boolean,default:void 0},name:String,disabled:{type:Boolean,default:void 0},componentTag:String,action:[String,Function],method:String,directory:{type:Boolean,default:void 0},data:[Object,Function],headers:Object,accept:String,multiple:{type:Boolean,default:void 0},onBatchStart:Function,onReject:Function,onStart:Function,onError:Function,onSuccess:Function,onProgress:Function,beforeUpload:Function,customRequest:Function,withCredentials:{type:Boolean,default:void 0},openFileDialogOnClick:{type:Boolean,default:void 0},prefixCls:String,id:String,onMouseenter:Function,onMouseleave:Function,onClick:Function}};function _n(t,e,n,r){for(var a=-1,c=t==null?0:t.length;++a0&&arguments[0]!==void 0?arguments[0]:"",n=e.split("/"),r=n[n.length-1],a=r.split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(a)||[""])[0]},Ze=function(e){return e.indexOf("image/")===0},ht=function(e){if(e.type&&!e.thumbUrl)return Ze(e.type);var n=e.thumbUrl||e.url||"",r=gt(n);return/^data:image\//.test(n)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(r)?!0:!(/^data:/.test(n)||r)},X=200;function wt(t){return new Promise(function(e){if(!t.type||!Ze(t.type)){e("");return}var n=document.createElement("canvas");n.width=X,n.height=X,n.style.cssText="position: fixed; left: 0; top: 0; width: ".concat(X,"px; height: ").concat(X,"px; z-index: 9999; display: none;"),document.body.appendChild(n);var r=n.getContext("2d"),a=new Image;a.onload=function(){var c=a.width,f=a.height,h=X,D=X,C=0,L=0;c>f?(D=f*(X/c),L=-(D-h)/2):(h=c*(X/f),C=-(h-D)/2),r.drawImage(a,C,L,h,D);var B=n.toDataURL();document.body.removeChild(n),e(B)},a.src=window.URL.createObjectURL(t)})}var bt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"};const yt=bt;function Ve(t){for(var e=1;e"u"||typeof window>"u"||!window.FileReader||!window.File||!(k.originFileObj instanceof File||k.originFileObj instanceof Blob)||k.thumbUrl!==void 0||(k.thumbUrl="",e.previewFile&&e.previewFile(k.originFileObj).then(function(T){k.thumbUrl=T||"",f.update()}))})});var h=function(T,y){if(e.onPreview)return y==null||y.preventDefault(),e.onPreview(T)},D=function(T){typeof e.onDownload=="function"?e.onDownload(T):T.url&&window.open(T.url)},C=function(T){var y;(y=e.onRemove)===null||y===void 0||y.call(e,T)},L=function(T){var y=T.file,m=e.iconRender||r.iconRender;if(m)return m({file:y,listType:e.listType});var g=y.status==="uploading",s=e.isImageUrl&&e.isImageUrl(y)?d(ut,null,null):d(vt,null,null),O=g?d(Le,null,null):d(ot,null,null);return e.listType==="picture"?O=g?d(Le,null,null):s:e.listType==="picture-card"&&(O=g?e.locale.uploading:s),O},B=function(T){var y=T.customIcon,m=T.callback,g=T.prefixCls,s=T.title,O={type:"text",size:"small",title:s,onClick:function(){m()},class:"".concat(g,"-list-item-card-actions-btn")};return pn(y)?d(Ee,O,{icon:function(){return y}}):d(Ee,O,{default:function(){return[d("span",null,[y])]}})};a({handlePreview:h,handleDownload:D});var S=Ie("upload",e),A=S.prefixCls,M=S.direction,i=ce(function(){var k;return k={},j(k,"".concat(A.value,"-list"),!0),j(k,"".concat(A.value,"-list-").concat(e.listType),!0),j(k,"".concat(A.value,"-list-rtl"),M.value==="rtl"),k}),_=ce(function(){return P(P(P({},Sn("".concat(A.value,"-").concat(e.listType==="picture-card"?"animate-inline":"animate"))),sn("".concat(A.value,"-").concat(e.listType==="picture-card"?"animate-inline":"animate"))),{},{class:i.value,appear:c.value})});return function(){var k=e.listType,T=e.locale,y=e.isImageUrl,m=e.items,g=m===void 0?[]:m,s=e.showPreviewIcon,O=e.showRemoveIcon,I=e.showDownloadIcon,U=e.removeIcon,$=e.previewIcon,E=e.downloadIcon,x=e.progress,l=e.appendAction,u=e.itemRender,v=e.appendActionVisible,p=l==null?void 0:l();return d(dn,P(P({},_.value),{},{tag:"div"}),{default:function(){return[g.map(function(b){var F=b.uid;return d(Ot,{key:F,locale:T,prefixCls:A.value,file:b,items:g,progress:x,listType:k,isImgUrl:y,showPreviewIcon:s,showRemoveIcon:O,showDownloadIcon:I,onPreview:h,onDownload:D,onClose:C,removeIcon:U,previewIcon:$,downloadIcon:E,itemRender:u},P(P({},r),{},{iconRender:L,actionIconRender:B}))}),l?Ge(d(Ct,{key:"__ant_upload_appendAction"},{default:function(){return p}}),[[We,!!v]]):null]}})}}});var Dt=["class","style"],K="__LIST_IGNORE_".concat(Date.now(),"__");const ae=Z({compatConfig:{MODE:3},name:"AUpload",inheritAttrs:!1,props:Fe(Ye(),{type:"select",multiple:!1,action:"",data:{},accept:"",showUploadList:!0,listType:"text",disabled:!1,supportServerRender:!0}),setup:function(e,n){var r=n.slots,a=n.attrs,c=n.expose,f=Un(),h=Tn(e.defaultFileList||[],{value:mn(e,"fileList"),postState:function(l){var u=Date.now();return(l??[]).map(function(v,p){return!v.uid&&!Object.isFrozen(v)&&(v.uid="__AUTO__".concat(u,"_").concat(p,"__")),v})}}),D=Ae(h,2),C=D[0],L=D[1],B=q("drop"),S=q();ue(function(){me(e.fileList!==void 0||a.value===void 0,"Upload","`value` is not a valid prop, do you mean `fileList`?"),me(e.transformFile===void 0,"Upload","`transformFile` is deprecated. Please use `beforeUpload` directly."),me(e.remove===void 0,"Upload","`remove` props is deprecated. Please use `remove` event.")});var A=function(l,u,v){var p,o,b=ee(u);e.maxCount===1?b=b.slice(-1):e.maxCount&&(b=b.slice(0,e.maxCount)),L(b);var F={file:l,fileList:b};v&&(F.event=v),(p=e["onUpdate:fileList"])===null||p===void 0||p.call(e,F.fileList),(o=e.onChange)===null||o===void 0||o.call(e,F),f.onFieldChange()},M=function(){var x=Xe(le.mark(function l(u,v){var p,o,b,F;return le.wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(p=e.beforeUpload,o=e.transformFile,b=u,!p){w.next=13;break}return w.next=5,p(u,v);case 5:if(F=w.sent,F!==!1){w.next=8;break}return w.abrupt("return",!1);case 8:if(delete u[K],F!==K){w.next=12;break}return Object.defineProperty(u,K,{value:!0,configurable:!0}),w.abrupt("return",!1);case 12:Ne(F)==="object"&&F&&(b=F);case 13:if(!o){w.next=17;break}return w.next=16,o(b);case 16:b=w.sent;case 17:return w.abrupt("return",b);case 18:case"end":return w.stop()}},l)}));return function(u,v){return x.apply(this,arguments)}}(),i=function(l){var u=l.filter(function(o){return!o.file[K]});if(u.length){var v=u.map(function(o){return te(o.file)}),p=ee(C.value);v.forEach(function(o){p=re(o,p)}),v.forEach(function(o,b){var F=o;if(u[b].parsedFile)o.status="uploading";else{var R=o.originFileObj,w;try{w=new File([R],R.name,{type:R.type})}catch{w=new Blob([R],{type:R.type}),w.name=R.name,w.lastModifiedDate=new Date,w.lastModified=new Date().getTime()}w.uid=o.uid,F=w}A(F,p)})}},_=function(l,u,v){try{typeof l=="string"&&(l=JSON.parse(l))}catch{}if(ye(u,C.value)){var p=te(u);p.status="done",p.percent=100,p.response=l,p.xhr=v;var o=re(p,C.value);A(p,o)}},k=function(l,u){if(ye(u,C.value)){var v=te(u);v.status="uploading",v.percent=l.percent;var p=re(v,C.value);A(v,p,l)}},T=function(l,u,v){if(ye(v,C.value)){var p=te(v);p.error=l,p.response=u,p.status="error";var o=re(p,C.value);A(p,o)}},y=function(l){var u,v=e.onRemove||e.remove;Promise.resolve(typeof v=="function"?v(l):v).then(function(p){if(p!==!1){var o=mt(l,C.value);if(o){var b,F;u=P(P({},l),{},{status:"removed"}),(b=C.value)===null||b===void 0||b.forEach(function(R){var w=u.uid!==void 0?"uid":"name";R[w]===u[w]&&!Object.isFrozen(R)&&(R.status="removed")}),(F=S.value)===null||F===void 0||F.abort(u),A(u,o)}}})},m=function(l){if(B.value=l.type,l.type==="drop"){var u;(u=e.onDrop)===null||u===void 0||u.call(e,l)}};c({onBatchStart:i,onSuccess:_,onProgress:k,onError:T,fileList:C,upload:S});var g=Ie("upload",e),s=g.prefixCls,O=g.direction,I=gn("Upload",hn.Upload,ce(function(){return e.locale})),U=Ae(I,1),$=U[0],E=function(l,u){var v=e.removeIcon,p=e.previewIcon,o=e.downloadIcon,b=e.previewFile,F=e.onPreview,R=e.onDownload,w=e.disabled,N=e.isImageUrl,Q=e.progress,H=e.itemRender,G=e.iconRender,z=e.showUploadList,J=typeof z=="boolean"?{}:z,Y=J.showDownloadIcon,se=J.showPreviewIcon,de=J.showRemoveIcon;return z?d(Rt,{listType:e.listType,items:C.value,previewFile:b,onPreview:F,onDownload:R,onRemove:y,showRemoveIcon:!w&&de,showPreviewIcon:se,showDownloadIcon:Y,removeIcon:v,previewIcon:p,downloadIcon:o,iconRender:G,locale:$.value,isImageUrl:N,progress:Q,itemRender:H,appendActionVisible:u,appendAction:l},P({},r)):l==null?void 0:l()};return function(){var x,l,u,v=e.listType,p=e.disabled,o=e.type;a.class,a.style;var b=ie(a,Dt),F=P(P(P({onBatchStart:i,onError:T,onProgress:k,onSuccess:_},b),e),{},{id:(x=e.id)!==null&&x!==void 0?x:f.id.value,prefixCls:s.value,beforeUpload:M,onChange:void 0});if(delete F.remove,(!r.default||p)&&delete F.id,o==="drag"){var R,w,N=ge(s.value,(R={},j(R,"".concat(s.value,"-drag"),!0),j(R,"".concat(s.value,"-drag-uploading"),C.value.some(function(z){return z.status==="uploading"})),j(R,"".concat(s.value,"-drag-hover"),B.value==="dragover"),j(R,"".concat(s.value,"-disabled"),p),j(R,"".concat(s.value,"-rtl"),O.value==="rtl"),R),a.class);return d("span",null,[d("div",{class:N,onDrop:m,onDragover:m,onDragleave:m,style:a.style},[d($e,P(P({},F),{},{ref:S,class:"".concat(s.value,"-btn")}),P({default:function(){return[d("div",{class:"".concat(s.value,"-drag-container")},[(w=r.default)===null||w===void 0?void 0:w.call(r)])]}},r))]),E()])}var Q=ge(s.value,(l={},j(l,"".concat(s.value,"-select"),!0),j(l,"".concat(s.value,"-select-").concat(v),!0),j(l,"".concat(s.value,"-disabled"),p),j(l,"".concat(s.value,"-rtl"),O.value==="rtl"),l)),H=wn((u=r.default)===null||u===void 0?void 0:u.call(r)),G=function(J){return d("div",{class:Q,style:J},[d($e,P(P({},F),{},{ref:S}),r)])};return v==="picture-card"?d("span",{class:ge("".concat(s.value,"-picture-card-wrapper"),a.class)},[E(G,!!(H&&H.length))]):d("span",{class:a.class},[G(H&&H.length?void 0:{display:"none"}),E()])}}});var St=["height"],Tt=["style"];const oe=Z({compatConfig:{MODE:3},name:"AUploadDragger",inheritAttrs:!1,props:Ye(),setup:function(e,n){var r=n.slots,a=n.attrs;return function(){var c=e.height,f=ie(e,St),h=a.style,D=ie(a,Tt),C=P(P(P({},f),D),{},{type:"drag",style:P(P({},h),{},{height:typeof c=="number"?"".concat(c,"px"):c})});return d(ae,C,r)}}});var Ht=oe;const _t=bn(ae,{Dragger:oe,LIST_IGNORE:K,install:function(e){return e.component(ae.name,ae),e.component(oe.name,oe),e}});export{Ln as D,_t as U,Ht as a};