Spaces:
Sleeping
Sleeping
| import{T as it,G as Xe,U as Je,F as Ze,_ as ue,E as Ye,K as lt,c as _,b as F,R as Me,d as w,r as i,aj as st,ak as Se,z as Qe,A as Ue,i as X,a as Pe,C as je,e as et,ap as ct,L as _e,V as ut,W as dt,Z as pt,t as He}from"./umi-a12c8253.js";import{p as ft,E as vt,T as mt,k as ht,b as gt,u as wt}from"./TextArea-ec8ab387.js";import{B as qe}from"./button-f56a19a0.js";import{c as We,i as Ke}from"./_setToString-ca5ad23e.js";import{D as yt}from"./DeleteOutlined-e5d1e611.js";import{D as bt}from"./DownloadOutlined-b3f9ad21.js";import{P as It}from"./progress-81ce73da.js";function Ct(t,e){var a="cannot ".concat(t.method," ").concat(t.action," ").concat(e.status,"'"),n=new Error(a);return n.status=e.status,n.method=t.method,n.url=t.action,n}function Ge(t){var e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch{return e}}function Et(t){var e=new XMLHttpRequest;t.onProgress&&e.upload&&(e.upload.onprogress=function(l){l.total>0&&(l.percent=l.loaded/l.total*100),t.onProgress(l)});var a=new FormData;t.data&&Object.keys(t.data).forEach(function(o){var l=t.data[o];if(Array.isArray(l)){l.forEach(function(s){a.append("".concat(o,"[]"),s)});return}a.append(o,l)}),t.file instanceof Blob?a.append(t.filename,t.file,t.file.name):a.append(t.filename,t.file),e.onerror=function(l){t.onError(l)},e.onload=function(){return e.status<200||e.status>=300?t.onError(Ct(t,e),Ge(e)):t.onSuccess(Ge(e),e)},e.open(t.method,t.action,!0),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);var n=t.headers||{};return n["X-Requested-With"]!==null&&e.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(n).forEach(function(o){n[o]!==null&&e.setRequestHeader(o,n[o])}),e.send(a),{abort:function(){e.abort()}}}var Rt=+new Date,Ft=0;function $e(){return"rc-upload-".concat(Rt,"-").concat(++Ft)}const Ne=function(t,e){if(t&&e){var a=Array.isArray(e)?e:e.split(","),n=t.name||"",o=t.type||"",l=o.replace(/\/.*$/,"");return a.some(function(s){var r=s.trim();if(/^\*(\/\*)?$/.test(s))return!0;if(r.charAt(0)==="."){var d=n.toLowerCase(),c=r.toLowerCase(),u=[c];return(c===".jpg"||c===".jpeg")&&(u=[".jpg",".jpeg"]),u.some(function(h){return d.endsWith(h)})}return/\/\*$/.test(r)?l===r.replace(/\/.*$/,""):o===r?!0:/^\w+$/.test(r)?(it(!1,"Upload takes an invalidate 'accept' type '".concat(r,"'.Skip for check.")),!0):!1})}return!0};function Pt(t,e){var a=t.createReader(),n=[];function o(){a.readEntries(function(l){var s=Array.prototype.slice.apply(l);n=n.concat(s);var r=!s.length;r?e(n):o()})}o()}var Ut=function(e,a,n){var o=function l(s,r){s&&(s.path=r||"",s.isFile?s.file(function(d){n(d)&&(s.fullPath&&!d.webkitRelativePath&&(Object.defineProperties(d,{webkitRelativePath:{writable:!0}}),d.webkitRelativePath=s.fullPath.replace(/^\//,""),Object.defineProperties(d,{webkitRelativePath:{writable:!1}})),a([d]))}):s.isDirectory&&Pt(s,function(d){d.forEach(function(c){l(c,"".concat(r).concat(s.name,"/"))})}))};e.forEach(function(l){o(l.webkitGetAsEntry())})},kt=["component","prefixCls","className","disabled","id","style","multiple","accept","capture","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"],Dt=function(t){Xe(a,t);var e=Je(a);function a(){var n;Ze(this,a);for(var o=arguments.length,l=new Array(o),s=0;s<o;s++)l[s]=arguments[s];return n=e.call.apply(e,[this].concat(l)),n.state={uid:$e()},n.reqs={},n.fileInput=void 0,n._isMounted=void 0,n.onChange=function(r){var d=n.props,c=d.accept,u=d.directory,h=r.target.files,m=ue(h).filter(function(y){return!u||Ne(y,c)});n.uploadFiles(m),n.reset()},n.onClick=function(r){var d=n.fileInput;if(d){var c=r.target,u=n.props.onClick;if(c&&c.tagName==="BUTTON"){var h=d.parentNode;h.focus(),c.blur()}d.click(),u&&u(r)}},n.onKeyDown=function(r){r.key==="Enter"&&n.onClick(r)},n.onFileDrop=function(r){var d=n.props.multiple;if(r.preventDefault(),r.type!=="dragover")if(n.props.directory)Ut(Array.prototype.slice.call(r.dataTransfer.items),n.uploadFiles,function(u){return Ne(u,n.props.accept)});else{var c=ue(r.dataTransfer.files).filter(function(u){return Ne(u,n.props.accept)});d===!1&&(c=c.slice(0,1)),n.uploadFiles(c)}},n.uploadFiles=function(r){var d=ue(r),c=d.map(function(u){return u.uid=$e(),n.processFile(u,d)});Promise.all(c).then(function(u){var h=n.props.onBatchStart;h==null||h(u.map(function(m){var y=m.origin,O=m.parsedFile;return{file:y,parsedFile:O}})),u.filter(function(m){return m.parsedFile!==null}).forEach(function(m){n.post(m)})})},n.processFile=function(){var r=st(Se().mark(function d(c,u){var h,m,y,O,S,L,U,T,$;return Se().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(h=n.props.beforeUpload,m=c,!h){p.next=14;break}return p.prev=3,p.next=6,h(c,u);case 6:m=p.sent,p.next=12;break;case 9:p.prev=9,p.t0=p.catch(3),m=!1;case 12:if(m!==!1){p.next=14;break}return p.abrupt("return",{origin:c,parsedFile:null,action:null,data:null});case 14:if(y=n.props.action,typeof y!="function"){p.next=21;break}return p.next=18,y(c);case 18:O=p.sent,p.next=22;break;case 21:O=y;case 22:if(S=n.props.data,typeof S!="function"){p.next=29;break}return p.next=26,S(c);case 26:L=p.sent,p.next=30;break;case 29:L=S;case 30:return U=(Qe(m)==="object"||typeof m=="string")&&m?m:c,U instanceof File?T=U:T=new File([U],c.name,{type:c.type}),$=T,$.uid=c.uid,p.abrupt("return",{origin:c,data:L,parsedFile:$,action:O});case 35:case"end":return p.stop()}},d,null,[[3,9]])}));return function(d,c){return r.apply(this,arguments)}}(),n.saveFileInput=function(r){n.fileInput=r},n}return Ye(a,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"post",value:function(o){var l=this,s=o.data,r=o.origin,d=o.action,c=o.parsedFile;if(this._isMounted){var u=this.props,h=u.onStart,m=u.customRequest,y=u.name,O=u.headers,S=u.withCredentials,L=u.method,U=r.uid,T=m||Et,$={action:d,filename:y,data:s,file:c,headers:O,withCredentials:S,method:L||"post",onProgress:function(p){var x=l.props.onProgress;x==null||x(p,c)},onSuccess:function(p,x){var N=l.props.onSuccess;N==null||N(p,c,x),delete l.reqs[U]},onError:function(p,x){var N=l.props.onError;N==null||N(p,x,c),delete l.reqs[U]}};h(r),this.reqs[U]=T($)}}},{key:"reset",value:function(){this.setState({uid:$e()})}},{key:"abort",value:function(o){var l=this.reqs;if(o){var s=o.uid?o.uid:o;l[s]&&l[s].abort&&l[s].abort(),delete l[s]}else Object.keys(l).forEach(function(r){l[r]&&l[r].abort&&l[r].abort(),delete l[r]})}},{key:"render",value:function(){var o=this.props,l=o.component,s=o.prefixCls,r=o.className,d=o.disabled,c=o.id,u=o.style,h=o.multiple,m=o.accept,y=o.capture,O=o.children,S=o.directory,L=o.openFileDialogOnClick,U=o.onMouseEnter,T=o.onMouseLeave,$=lt(o,kt),M=_(F(F(F({},s,!0),"".concat(s,"-disabled"),d),r,r)),p=S?{directory:"directory",webkitdirectory:"webkitdirectory"}:{},x=d?{}:{onClick:L?this.onClick:function(){},onKeyDown:L?this.onKeyDown:function(){},onMouseEnter:U,onMouseLeave:T,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Me.createElement(l,w({},x,{className:M,role:"button",style:u}),Me.createElement("input",w({},ft($,{aria:!0,data:!0}),{id:c,disabled:d,type:"file",ref:this.saveFileInput,onClick:function(H){return H.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:m},p,{multiple:h,onChange:this.onChange},y!=null?{capture:y}:{})),O)}}]),a}(i.Component);function Oe(){}var Ae=function(t){Xe(a,t);var e=Je(a);function a(){var n;Ze(this,a);for(var o=arguments.length,l=new Array(o),s=0;s<o;s++)l[s]=arguments[s];return n=e.call.apply(e,[this].concat(l)),n.uploader=void 0,n.saveUploader=function(r){n.uploader=r},n}return Ye(a,[{key:"abort",value:function(o){this.uploader.abort(o)}},{key:"render",value:function(){return Me.createElement(Dt,w({},this.props,{ref:this.saveUploader}))}}]),a}(i.Component);Ae.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:Oe,onError:Oe,onSuccess:Oe,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var St={icon:function(e,a){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M534 352V136H232v752h560V394H576a42 42 0 01-42-42z",fill:a}},{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z",fill:e}}]}},name:"file",theme:"twotone"};const Lt=St;var xt=function(e,a){return i.createElement(Ue,X(X({},e),{},{ref:a,icon:Lt}))},$t=i.forwardRef(xt);const Nt=$t;var Ot={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"};const Tt=Ot;var Mt=function(e,a){return i.createElement(Ue,X(X({},e),{},{ref:a,icon:Tt}))},At=i.forwardRef(Mt);const jt=At;var zt={icon:function(e,a){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z",fill:e}},{tag:"path",attrs:{d:"M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z",fill:a}},{tag:"path",attrs:{d:"M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z",fill:a}},{tag:"path",attrs:{d:"M276 368a28 28 0 1056 0 28 28 0 10-56 0z",fill:a}},{tag:"path",attrs:{d:"M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z",fill:e}}]}},name:"picture",theme:"twotone"};const Bt=zt;var Vt=function(e,a){return i.createElement(Ue,X(X({},e),{},{ref:a,icon:Bt}))},_t=i.forwardRef(Vt);const Ht=_t;function ke(t){return w(w({},t),{lastModified:t.lastModified,lastModifiedDate:t.lastModifiedDate,name:t.name,size:t.size,type:t.type,uid:t.uid,percent:0,originFileObj:t})}function De(t,e){var a=ue(e),n=a.findIndex(function(o){var l=o.uid;return l===t.uid});return n===-1?a.push(t):a[n]=t,a}function Te(t,e){var a=t.uid!==void 0?"uid":"name";return e.filter(function(n){return n[a]===t[a]})[0]}function qt(t,e){var a=t.uid!==void 0?"uid":"name",n=e.filter(function(o){return o[a]!==t[a]});return n.length===e.length?null:n}var Wt=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=e.split("/"),n=a[a.length-1],o=n.split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(o)||[""])[0]},tt=function(e){return e.indexOf("image/")===0},Kt=function(e){if(e.type&&!e.thumbUrl)return tt(e.type);var a=e.thumbUrl||e.url||"",n=Wt(a);return/^data:image\//.test(a)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(n)?!0:!(/^data:/.test(a)||n)},oe=200;function Gt(t){return new Promise(function(e){if(!t.type||!tt(t.type)){e("");return}var a=document.createElement("canvas");a.width=oe,a.height=oe,a.style.cssText="position: fixed; left: 0; top: 0; width: ".concat(oe,"px; height: ").concat(oe,"px; z-index: 9999; display: none;"),document.body.appendChild(a);var n=a.getContext("2d"),o=new Image;if(o.onload=function(){var r=o.width,d=o.height,c=oe,u=oe,h=0,m=0;r>d?(u=d*(oe/r),m=-(u-c)/2):(c=r*(oe/d),h=-(c-u)/2),n.drawImage(o,h,m,c,u);var y=a.toDataURL();document.body.removeChild(a),window.URL.revokeObjectURL(o.src),e(y)},o.crossOrigin="anonymous",t.type.startsWith("image/svg+xml")){var l=new FileReader;l.onload=function(){l.result&&(o.src=l.result)},l.readAsDataURL(t)}else if(t.type.startsWith("image/gif")){var s=new FileReader;s.onload=function(){s.result&&e(s.result)},s.readAsDataURL(t)}else o.src=window.URL.createObjectURL(t)})}var Xt=i.forwardRef(function(t,e){var a=t.prefixCls,n=t.className,o=t.style,l=t.locale,s=t.listType,r=t.file,d=t.items,c=t.progress,u=t.iconRender,h=t.actionIconRender,m=t.itemRender,y=t.isImgUrl,O=t.showPreviewIcon,S=t.showRemoveIcon,L=t.showDownloadIcon,U=t.previewIcon,T=t.removeIcon,$=t.downloadIcon,M=t.onPreview,p=t.onDownload,x=t.onClose,N,H,Q=r.status,de=i.useState(Q),ee=Pe(de,2),A=ee[0],pe=ee[1];i.useEffect(function(){Q!=="removed"&&pe(Q)},[Q]);var fe=i.useState(!1),ve=Pe(fe,2),me=ve[0],Ce=ve[1],te=i.useRef(null);i.useEffect(function(){return te.current=setTimeout(function(){Ce(!0)},300),function(){te.current&&clearTimeout(te.current)}},[]);var he="".concat(a,"-span"),ne=u(r),ie=i.createElement("div",{className:"".concat(a,"-text-icon")},ne);if(s==="picture"||s==="picture-card")if(A==="uploading"||!r.thumbUrl&&!r.url){var ge=_(F(F({},"".concat(a,"-list-item-thumbnail"),!0),"".concat(a,"-list-item-file"),A!=="uploading"));ie=i.createElement("div",{className:ge},ne)}else{var q=y!=null&&y(r)?i.createElement("img",{src:r.thumbUrl||r.url,alt:r.name,className:"".concat(a,"-list-item-image"),crossOrigin:r.crossOrigin}):ne,Ee=_(F(F({},"".concat(a,"-list-item-thumbnail"),!0),"".concat(a,"-list-item-file"),y&&!y(r)));ie=i.createElement("a",{className:Ee,onClick:function(I){return M(r,I)},href:r.url||r.thumbUrl,target:"_blank",rel:"noopener noreferrer"},q)}var we=_(F(F(F({},"".concat(a,"-list-item"),!0),"".concat(a,"-list-item-").concat(A),!0),"".concat(a,"-list-item-list-type-").concat(s),!0)),k=typeof r.linkProps=="string"?JSON.parse(r.linkProps):r.linkProps,le=S?h((typeof T=="function"?T(r):T)||i.createElement(yt,null),function(){return x(r)},a,l.removeFile):null,ye=L&&A==="done"?h((typeof $=="function"?$(r):$)||i.createElement(bt,null),function(){return p(r)},a,l.downloadFile):null,se=s!=="picture-card"&&i.createElement("span",{key:"download-delete",className:_("".concat(a,"-list-item-card-actions"),{picture:s==="picture"})},ye,le),G=_("".concat(a,"-list-item-name")),Re=r.url?[i.createElement("a",w({key:"view",target:"_blank",rel:"noopener noreferrer",className:G,title:r.name},k,{href:r.url,onClick:function(I){return M(r,I)}}),r.name),se]:[i.createElement("span",{key:"view",className:G,onClick:function(I){return M(r,I)},title:r.name},r.name),se],re={pointerEvents:"none",opacity:.5},J=O?i.createElement("a",{href:r.url||r.thumbUrl,target:"_blank",rel:"noopener noreferrer",style:r.url||r.thumbUrl?void 0:re,onClick:function(I){return M(r,I)},title:l.previewFile},typeof U=="function"?U(r):U||i.createElement(vt,null)):null,ae=s==="picture-card"&&A!=="uploading"&&i.createElement("span",{className:"".concat(a,"-list-item-actions")},J,A==="done"&&ye,le),b;r.response&&typeof r.response=="string"?b=r.response:b=((N=r.error)===null||N===void 0?void 0:N.statusText)||((H=r.error)===null||H===void 0?void 0:H.message)||l.uploadError;var g=i.createElement("span",{className:he},ie,Re),D=i.useContext(je),j=D.getPrefixCls,W=j(),Z=i.createElement("div",{className:we},i.createElement("div",{className:"".concat(a,"-list-item-info")},g),ae,me&&i.createElement(et,{motionName:"".concat(W,"-fade"),visible:A==="uploading",motionDeadline:2e3},function(K){var I=K.className,ce="percent"in r?i.createElement(It,w({},c,{type:"line",percent:r.percent})):null;return i.createElement("div",{className:_("".concat(a,"-list-item-progress"),I)},ce)})),be=_("".concat(a,"-list-").concat(s,"-container"),n),Ie=A==="error"?i.createElement(mt,{title:b,getPopupContainer:function(I){return I.parentNode}},Z):Z;return i.createElement("div",{className:be,style:o,ref:e},m?m(Ie,r,d,{download:p.bind(null,r),preview:M.bind(null,r),remove:x.bind(null,r)}):Ie)});const Jt=Xt;var Le=w({},ht);delete Le.onAppearEnd;delete Le.onEnterEnd;delete Le.onLeaveEnd;var Zt=function(e,a){var n=e.listType,o=n===void 0?"text":n,l=e.previewFile,s=l===void 0?Gt:l,r=e.onPreview,d=e.onDownload,c=e.onRemove,u=e.locale,h=e.iconRender,m=e.isImageUrl,y=m===void 0?Kt:m,O=e.prefixCls,S=e.items,L=S===void 0?[]:S,U=e.showPreviewIcon,T=U===void 0?!0:U,$=e.showRemoveIcon,M=$===void 0?!0:$,p=e.showDownloadIcon,x=p===void 0?!1:p,N=e.removeIcon,H=e.previewIcon,Q=e.downloadIcon,de=e.progress,ee=de===void 0?{strokeWidth:2,showInfo:!1}:de,A=e.appendAction,pe=e.appendActionVisible,fe=pe===void 0?!0:pe,ve=e.itemRender,me=e.disabled,Ce=gt(),te=i.useState(!1),he=Pe(te,2),ne=he[0],ie=he[1];i.useEffect(function(){o!=="picture"&&o!=="picture-card"||(L||[]).forEach(function(b){typeof document>"u"||typeof window>"u"||!window.FileReader||!window.File||!(b.originFileObj instanceof File||b.originFileObj instanceof Blob)||b.thumbUrl!==void 0||(b.thumbUrl="",s&&s(b.originFileObj).then(function(g){b.thumbUrl=g||"",Ce()}))})},[o,L,s]),i.useEffect(function(){ie(!0)},[]);var ge=function(g,D){if(r)return D==null||D.preventDefault(),r(g)},q=function(g){typeof d=="function"?d(g):g.url&&window.open(g.url)},Ee=function(g){c==null||c(g)},we=function(g){if(h)return h(g,o);var D=g.status==="uploading",j=y&&y(g)?i.createElement(Ht,null):i.createElement(Nt,null),W=D?i.createElement(_e,null):i.createElement(jt,null);return o==="picture"?W=D?i.createElement(_e,null):j:o==="picture-card"&&(W=D?u.uploading:j),W},k=function(g,D,j,W){var Z={type:"text",size:"small",title:W,disabled:me,onClick:function(K){D(),Ke(g)&&g.props.onClick&&g.props.onClick(K)},className:"".concat(j,"-list-item-card-actions-btn")};if(Ke(g)){var be=We(g,w(w({},g.props),{onClick:function(){}}));return i.createElement(qe,w({},Z,{icon:be}))}return i.createElement(qe,w({},Z),i.createElement("span",null,g))};i.useImperativeHandle(a,function(){return{handlePreview:ge,handleDownload:q}});var le=i.useContext(je),ye=le.getPrefixCls,se=le.direction,G=ye("upload",O),Re=_(F(F(F({},"".concat(G,"-list"),!0),"".concat(G,"-list-").concat(o),!0),"".concat(G,"-list-rtl"),se==="rtl")),re=ue(L.map(function(b){return{key:b.uid,file:b}})),J=o==="picture-card"?"animate-inline":"animate",ae={motionDeadline:2e3,motionName:"".concat(G,"-").concat(J),keys:re,motionAppear:ne};return o!=="picture-card"&&(ae=w(w({},Le),ae)),i.createElement("div",{className:Re},i.createElement(ct,w({},ae,{component:!1}),function(b){var g=b.key,D=b.file,j=b.className,W=b.style;return i.createElement(Jt,{key:g,locale:u,prefixCls:G,className:j,style:W,file:D,items:L,progress:ee,listType:o,isImgUrl:y,showPreviewIcon:T,showRemoveIcon:M,showDownloadIcon:x,removeIcon:N,previewIcon:H,downloadIcon:Q,iconRender:we,actionIconRender:k,itemRender:ve,onPreview:ge,onDownload:q,onClose:Ee})}),A&&i.createElement(et,w({},ae,{visible:fe,forceRender:!0}),function(b){var g=b.className,D=b.style;return We(A,function(j){return{className:_(j.className,g),style:w(w(w({},D),{pointerEvents:g?"none":void 0}),j.style)}})}))},Yt=i.forwardRef(Zt);const Qt=Yt;var en=globalThis&&globalThis.__awaiter||function(t,e,a,n){function o(l){return l instanceof a?l:new a(function(s){s(l)})}return new(a||(a=Promise))(function(l,s){function r(u){try{c(n.next(u))}catch(h){s(h)}}function d(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?l(u.value):o(u.value).then(r,d)}c((n=n.apply(t,e||[])).next())})},Fe="__LIST_IGNORE_".concat(Date.now(),"__"),tn=function(e,a){var n=e.fileList,o=e.defaultFileList,l=e.onRemove,s=e.showUploadList,r=s===void 0?!0:s,d=e.listType,c=d===void 0?"text":d,u=e.onPreview,h=e.onDownload,m=e.onChange,y=e.onDrop,O=e.previewFile,S=e.disabled,L=e.locale,U=e.iconRender,T=e.isImageUrl,$=e.progress,M=e.prefixCls,p=e.className,x=e.type,N=x===void 0?"select":x,H=e.children,Q=e.style,de=e.itemRender,ee=e.maxCount,A=e.data,pe=A===void 0?{}:A,fe=e.multiple,ve=fe===void 0?!1:fe,me=e.action,Ce=me===void 0?"":me,te=e.accept,he=te===void 0?"":te,ne=e.supportServerRender,ie=ne===void 0?!0:ne,ge=i.useContext(ut),q=S??ge,Ee=wt(o||[],{value:n,postState:function(v){return v??[]}}),we=Pe(Ee,2),k=we[0],le=we[1],ye=i.useState("drop"),se=Pe(ye,2),G=se[0],Re=se[1],re=i.useRef(null);i.useMemo(function(){var z=Date.now();(n||[]).forEach(function(v,E){!v.uid&&!Object.isFrozen(v)&&(v.uid="__AUTO__".concat(z,"_").concat(E,"__"))})},[n]);var J=function(v,E,P){var f=ue(E);ee===1?f=f.slice(-1):ee&&(f=f.slice(0,ee)),He.flushSync(function(){le(f)});var C={file:v,fileList:f};P&&(C.event=P),He.flushSync(function(){m==null||m(C)})},ae=function(v,E){return en(void 0,void 0,void 0,Se().mark(function P(){var f,C,B,V;return Se().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(f=e.beforeUpload,C=e.transformFile,B=v,!f){R.next=13;break}return R.next=5,f(v,E);case 5:if(V=R.sent,V!==!1){R.next=8;break}return R.abrupt("return",!1);case 8:if(delete v[Fe],V!==Fe){R.next=12;break}return Object.defineProperty(v,Fe,{value:!0,configurable:!0}),R.abrupt("return",!1);case 12:Qe(V)==="object"&&V&&(B=V);case 13:if(!C){R.next=17;break}return R.next=16,C(B);case 16:B=R.sent;case 17:return R.abrupt("return",B);case 18:case"end":return R.stop()}},P)}))},b=function(v){var E=v.filter(function(C){return!C.file[Fe]});if(E.length){var P=E.map(function(C){return ke(C.file)}),f=ue(k);P.forEach(function(C){f=De(C,f)}),P.forEach(function(C,B){var V=C;if(E[B].parsedFile)C.status="uploading";else{var Y=C.originFileObj,R;try{R=new File([Y],Y.name,{type:Y.type})}catch{R=new Blob([Y],{type:Y.type}),R.name=Y.name,R.lastModifiedDate=new Date,R.lastModified=new Date().getTime()}R.uid=C.uid,V=R}J(V,f)})}},g=function(v,E,P){try{typeof v=="string"&&(v=JSON.parse(v))}catch{}if(Te(E,k)){var f=ke(E);f.status="done",f.percent=100,f.response=v,f.xhr=P;var C=De(f,k);J(f,C)}},D=function(v,E){if(Te(E,k)){var P=ke(E);P.status="uploading",P.percent=v.percent;var f=De(P,k);J(P,f,v)}},j=function(v,E,P){if(Te(P,k)){var f=ke(P);f.error=v,f.response=E,f.status="error";var C=De(f,k);J(f,C)}},W=function(v){var E;Promise.resolve(typeof l=="function"?l(v):l).then(function(P){var f;if(P!==!1){var C=qt(v,k);C&&(E=w(w({},v),{status:"removed"}),k==null||k.forEach(function(B){var V=E.uid!==void 0?"uid":"name";B[V]===E[V]&&!Object.isFrozen(B)&&(B.status="removed")}),(f=re.current)===null||f===void 0||f.abort(E),J(E,C))}})},Z=function(v){Re(v.type),v.type==="drop"&&(y==null||y(v))};i.useImperativeHandle(a,function(){return{onBatchStart:b,onSuccess:g,onProgress:D,onError:j,fileList:k,upload:re.current}});var be=i.useContext(je),Ie=be.getPrefixCls,K=be.direction,I=Ie("upload",M),ce=w(w({onBatchStart:b,onError:j,onProgress:D,onSuccess:g},e),{data:pe,multiple:ve,action:Ce,accept:he,supportServerRender:ie,prefixCls:I,disabled:q,beforeUpload:ae,onChange:void 0});delete ce.className,delete ce.style,(!H||q)&&delete ce.id;var xe=function(v,E){return r?i.createElement(dt,{componentName:"Upload",defaultLocale:pt.Upload},function(P){var f=typeof r=="boolean"?{}:r,C=f.showRemoveIcon,B=f.showPreviewIcon,V=f.showDownloadIcon,Y=f.removeIcon,R=f.previewIcon,Ve=f.downloadIcon;return i.createElement(Qt,{prefixCls:I,listType:c,items:k,previewFile:O,onPreview:u,onDownload:h,onRemove:W,showRemoveIcon:!q&&C,showPreviewIcon:B,showDownloadIcon:V,removeIcon:Y,previewIcon:R,downloadIcon:Ve,iconRender:U,locale:w(w({},P),L),isImageUrl:T,progress:$,appendAction:v,appendActionVisible:E,itemRender:de,disabled:q})}):v};if(N==="drag"){var rt=_(I,F(F(F(F(F({},"".concat(I,"-drag"),!0),"".concat(I,"-drag-uploading"),k.some(function(z){return z.status==="uploading"})),"".concat(I,"-drag-hover"),G==="dragover"),"".concat(I,"-disabled"),q),"".concat(I,"-rtl"),K==="rtl"),p);return i.createElement("span",null,i.createElement("div",{className:rt,onDrop:Z,onDragOver:Z,onDragLeave:Z,style:Q},i.createElement(Ae,w({},ce,{ref:re,className:"".concat(I,"-btn")}),i.createElement("div",{className:"".concat(I,"-drag-container")},H))),xe())}var at=_(I,F(F(F(F({},"".concat(I,"-select"),!0),"".concat(I,"-select-").concat(c),!0),"".concat(I,"-disabled"),q),"".concat(I,"-rtl"),K==="rtl")),ot=function(v){return i.createElement("div",{className:at,style:v},i.createElement(Ae,w({},ce,{ref:re})))},Be=ot(H?void 0:{display:"none"});return c==="picture-card"?i.createElement("span",{className:_("".concat(I,"-picture-card-wrapper"),p)},xe(Be,!!H)):i.createElement("span",{className:p},Be,xe())},nn=i.forwardRef(tn);const nt=nn;var rn=globalThis&&globalThis.__rest||function(t,e){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(a[n[o]]=t[n[o]]);return a},an=i.forwardRef(function(t,e){var a=t.style,n=t.height,o=rn(t,["style","height"]);return i.createElement(nt,w({ref:e},o,{type:"drag",style:w(w({},a),{height:n})}))});const on=an;var ze=nt;ze.Dragger=on;ze.LIST_IGNORE=Fe;const Cn=ze;var ln={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"};const sn=ln;var cn=function(e,a){return i.createElement(Ue,X(X({},e),{},{ref:a,icon:sn}))},un=i.forwardRef(cn);const En=un;var dn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 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:"upload",theme:"outlined"};const pn=dn;var fn=function(e,a){return i.createElement(Ue,X(X({},e),{},{ref:a,icon:pn}))},vn=i.forwardRef(fn);const Rn=vn;export{En as I,Cn as U,Rn as a}; | |