
admin.assets.download-rDh6m1OR.js Maven / Gradle / Ivy
The newest version!
import{dA as Je,cd as te,al as n,d as Q,dB as Qe,b4 as ve,by as Pe,aW as Pt,aX as Et,dC as Bt,bj as U,b0 as b,dD as Ae,bU as Dt,bH as Ut,b5 as S,r as $,b2 as Mt,q as zt,dE as ye,dF as ue,bs as et,bz as ne,a as j,b1 as pe,b7 as tt,bK as At,b8 as M,dG as Ft,c0 as Fe,dH as jt,O as Re,a3 as he,dq as $t,v as Nt,a8 as Vt,cu as Ht,cK as Se,dI as Zt,bJ as Ee,i as je,co as Ie,cf as me,cm as Wt,b9 as Xt,cx as ot,bA as Yt,B as le,dJ as Gt,dK as qt,cq as Kt,bk as V,dm as $e,bp as J,dL as Jt,dM as Qt,b3 as eo,b6 as to,T as oo,bb as Ne,ap as no,o as Be,b as nt,e as rt,c as ro,w as Te,f as Ve,g as io,t as ao,h as lo,$ as ge,aM as so,dN as uo,K as He}from"./index-D2gfy4BV.js";import{_ as co}from"./Progress-C54cQ0Ku.js";import{i as it}from"./Grid-DUVCwFN_.js";function fo(e,t,o,r){for(var l=-1,i=e==null?0:e.length;++l{var t;const{root:o=null}=e;return{hash:`${e.rootMargin||"0px 0px 0px 0px"}-${Array.isArray(e.threshold)?e.threshold.join(","):(t=e.threshold)!==null&&t!==void 0?t:"0"}`,options:Object.assign(Object.assign({},e),{root:(typeof o=="string"?document.querySelector(o):o)||document.documentElement})}},_e=new WeakMap,Oe=new WeakMap,Le=new WeakMap,gn=(e,t,o)=>{if(!e)return()=>{};const r=hn(t),{root:l}=r.options;let i;const u=_e.get(l);u?i=u:(i=new Map,_e.set(l,i));let c,d;i.has(r.hash)?(d=i.get(r.hash),d[1].has(e)||(c=d[0],d[1].add(e),c.observe(e))):(c=new IntersectionObserver(f=>{f.forEach(C=>{if(C.isIntersecting){const w=Oe.get(C.target),x=Le.get(C.target);w&&w(),x&&(x.value=!0)}})},r.options),c.observe(e),d=[c,new Set([e])],i.set(r.hash,d));let a=!1;const s=()=>{a||(Oe.delete(e),Le.delete(e),a=!0,d[1].has(e)&&(d[0].unobserve(e),d[1].delete(e)),d[1].size<=0&&i.delete(r.hash),i.size||_e.delete(l))};return Oe.set(e,s),Le.set(e,o),s},De=Object.assign(Object.assign({},ve.props),{onPreviewPrev:Function,onPreviewNext:Function,showToolbar:{type:Boolean,default:!0},showToolbarTooltip:Boolean,renderToolbar:Function}),xt=Pe("n-image");function vn(){return{toolbarIconColor:"rgba(255, 255, 255, .9)",toolbarColor:"rgba(0, 0, 0, .35)",toolbarBoxShadow:"none",toolbarBorderRadius:"24px"}}const pn=Pt({name:"Image",common:Et,peers:{Tooltip:Bt},self:vn}),mn=n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M6 5C5.75454 5 5.55039 5.17688 5.50806 5.41012L5.5 5.5V14.5C5.5 14.7761 5.72386 15 6 15C6.24546 15 6.44961 14.8231 6.49194 14.5899L6.5 14.5V5.5C6.5 5.22386 6.27614 5 6 5ZM13.8536 5.14645C13.68 4.97288 13.4106 4.9536 13.2157 5.08859L13.1464 5.14645L8.64645 9.64645C8.47288 9.82001 8.4536 10.0894 8.58859 10.2843L8.64645 10.3536L13.1464 14.8536C13.3417 15.0488 13.6583 15.0488 13.8536 14.8536C14.0271 14.68 14.0464 14.4106 13.9114 14.2157L13.8536 14.1464L9.70711 10L13.8536 5.85355C14.0488 5.65829 14.0488 5.34171 13.8536 5.14645Z",fill:"currentColor"})),wn=n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M13.5 5C13.7455 5 13.9496 5.17688 13.9919 5.41012L14 5.5V14.5C14 14.7761 13.7761 15 13.5 15C13.2545 15 13.0504 14.8231 13.0081 14.5899L13 14.5V5.5C13 5.22386 13.2239 5 13.5 5ZM5.64645 5.14645C5.82001 4.97288 6.08944 4.9536 6.28431 5.08859L6.35355 5.14645L10.8536 9.64645C11.0271 9.82001 11.0464 10.0894 10.9114 10.2843L10.8536 10.3536L6.35355 14.8536C6.15829 15.0488 5.84171 15.0488 5.64645 14.8536C5.47288 14.68 5.4536 14.4106 5.58859 14.2157L5.64645 14.1464L9.79289 10L5.64645 5.85355C5.45118 5.65829 5.45118 5.34171 5.64645 5.14645Z",fill:"currentColor"})),bn=n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M4.089 4.216l.057-.07a.5.5 0 0 1 .638-.057l.07.057L10 9.293l5.146-5.147a.5.5 0 0 1 .638-.057l.07.057a.5.5 0 0 1 .057.638l-.057.07L10.707 10l5.147 5.146a.5.5 0 0 1 .057.638l-.057.07a.5.5 0 0 1-.638.057l-.07-.057L10 10.707l-5.146 5.147a.5.5 0 0 1-.638.057l-.07-.057a.5.5 0 0 1-.057-.638l.057-.07L9.293 10L4.146 4.854a.5.5 0 0 1-.057-.638l.057-.07l-.057.07z",fill:"currentColor"})),xn=U([U("body >",[b("image-container","position: fixed;")]),b("image-preview-container",`
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
`),b("image-preview-overlay",`
z-index: -1;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(0, 0, 0, .3);
`,[Ae()]),b("image-preview-toolbar",`
z-index: 1;
position: absolute;
left: 50%;
transform: translateX(-50%);
border-radius: var(--n-toolbar-border-radius);
height: 48px;
bottom: 40px;
padding: 0 12px;
background: var(--n-toolbar-color);
box-shadow: var(--n-toolbar-box-shadow);
color: var(--n-toolbar-icon-color);
transition: color .3s var(--n-bezier);
display: flex;
align-items: center;
`,[b("base-icon",`
padding: 0 8px;
font-size: 28px;
cursor: pointer;
`),Ae()]),b("image-preview-wrapper",`
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
pointer-events: none;
`,[Dt()]),b("image-preview",`
user-select: none;
-webkit-user-select: none;
pointer-events: all;
margin: auto;
max-height: calc(100vh - 32px);
max-width: calc(100vw - 32px);
transition: transform .3s var(--n-bezier);
`),b("image",`
display: inline-flex;
max-height: 100%;
max-width: 100%;
`,[Ut("preview-disabled",`
cursor: pointer;
`),U("img",`
border-radius: inherit;
`)])]),ce=32,Ct=Q({name:"ImagePreview",props:Object.assign(Object.assign({},De),{onNext:Function,onPrev:Function,clsPrefix:{type:String,required:!0}}),setup(e){const t=ve("Image","-image",xn,pn,e,S(e,"clsPrefix"));let o=null;const r=$(null),l=$(null),i=$(void 0),u=$(!1),c=$(!1),{localeRef:d}=Mt("Image");function a(){const{value:h}=l;if(!o||!h)return;const{style:m}=h,g=o.getBoundingClientRect(),O=g.left+g.width/2,L=g.top+g.height/2;m.transformOrigin=`${O}px ${L}px`}function s(h){var m,g;switch(h.key){case" ":h.preventDefault();break;case"ArrowLeft":(m=e.onPrev)===null||m===void 0||m.call(e);break;case"ArrowRight":(g=e.onNext)===null||g===void 0||g.call(e);break;case"Escape":Ue();break}}zt(u,h=>{h?ye("keydown",document,s):ue("keydown",document,s)}),et(()=>{ue("keydown",document,s)});let f=0,C=0,w=0,x=0,A=0,Z=0,F=0,N=0,X=!1;function I(h){const{clientX:m,clientY:g}=h;w=m-f,x=g-C,Ht(q)}function p(h){const{mouseUpClientX:m,mouseUpClientY:g,mouseDownClientX:O,mouseDownClientY:L}=h,H=O-m,G=L-g,K=`vertical${G>0?"Top":"Bottom"}`,oe=`horizontal${H>0?"Left":"Right"}`;return{moveVerticalDirection:K,moveHorizontalDirection:oe,deltaHorizontal:H,deltaVertical:G}}function y(h){const{value:m}=r;if(!m)return{offsetX:0,offsetY:0};const g=m.getBoundingClientRect(),{moveVerticalDirection:O,moveHorizontalDirection:L,deltaHorizontal:H,deltaVertical:G}=h||{};let K=0,oe=0;return g.width<=window.innerWidth?K=0:g.left>0?K=(g.width-window.innerWidth)/2:g.right0?oe=(g.height-window.innerHeight)/2:g.bottom.5){const h=T;z-=1,T=Math.max(.5,Math.pow(_,z));const m=h-T;q(!1);const g=y();T+=m,q(!1),T-=m,w=g.offsetX,x=g.offsetY,q()}}function Ce(){const h=i.value;h&&it(h,void 0)}function q(h=!0){var m;const{value:g}=r;if(!g)return;const{style:O}=g,L=Nt((m=E==null?void 0:E.previewedImgPropsRef.value)===null||m===void 0?void 0:m.style);let H="";if(typeof L=="string")H=L+";";else for(const K in L)H+=`${tn(K)}: ${L[K]};`;const G=`transform-origin: center; transform: translateX(${w}px) translateY(${x}px) rotate(${B}deg) scale(${T});`;X?O.cssText=H+"cursor: grabbing; transition: none;"+G:O.cssText=H+"cursor: grab;"+G+(h?"":"transition: none;"),h||g.offsetHeight}function Ue(){u.value=!u.value,c.value=!0}function St(){T=de(),z=Math.ceil(Math.log(T)/Math.log(_)),w=0,x=0,q()}const It={setPreviewSrc:h=>{i.value=h},setThumbnailEl:h=>{o=h},toggleShow:Ue};function kt(h,m){if(e.showToolbarTooltip){const{value:g}=t;return n(Vt,{to:!1,theme:g.peers.Tooltip,themeOverrides:g.peerOverrides.Tooltip,keepAliveOnHover:!1},{default:()=>d.value[m],trigger:()=>h})}else return h}const Me=j(()=>{const{common:{cubicBezierEaseInOut:h},self:{toolbarIconColor:m,toolbarBorderRadius:g,toolbarBoxShadow:O,toolbarColor:L}}=t.value;return{"--n-bezier":h,"--n-toolbar-icon-color":m,"--n-toolbar-color":L,"--n-toolbar-border-radius":g,"--n-toolbar-box-shadow":O}}),{inlineThemeDisabled:ze}=pe(),re=ze?tt("image-preview",void 0,Me,e):void 0;return Object.assign({previewRef:r,previewWrapperRef:l,previewSrc:i,show:u,appear:At(),displayed:c,previewedImgProps:E==null?void 0:E.previewedImgPropsRef,handleWheel(h){h.preventDefault()},handlePreviewMousedown:v,handlePreviewDblclick:k,syncTransformOrigin:a,handleAfterLeave:()=>{D(),B=0,c.value=!1},handleDragStart:h=>{var m,g;(g=(m=E==null?void 0:E.previewedImgPropsRef.value)===null||m===void 0?void 0:m.onDragstart)===null||g===void 0||g.call(m,h),h.preventDefault()},zoomIn:be,zoomOut:xe,handleDownloadClick:Ce,rotateCounterclockwise:W,rotateClockwise:ee,handleSwitchPrev:P,handleSwitchNext:Y,withTooltip:kt,resizeToOrignalImageSize:St,cssVars:ze?void 0:Me,themeClass:re==null?void 0:re.themeClass,onRender:re==null?void 0:re.onRender},It)},render(){var e,t;const{clsPrefix:o,renderToolbar:r,withTooltip:l}=this,i=l(n(M,{clsPrefix:o,onClick:this.handleSwitchPrev},{default:()=>mn}),"tipPrevious"),u=l(n(M,{clsPrefix:o,onClick:this.handleSwitchNext},{default:()=>wn}),"tipNext"),c=l(n(M,{clsPrefix:o,onClick:this.rotateCounterclockwise},{default:()=>n(sn,null)}),"tipCounterclockwise"),d=l(n(M,{clsPrefix:o,onClick:this.rotateClockwise},{default:()=>n(ln,null)}),"tipClockwise"),a=l(n(M,{clsPrefix:o,onClick:this.resizeToOrignalImageSize},{default:()=>n(cn,null)}),"tipOriginalSize"),s=l(n(M,{clsPrefix:o,onClick:this.zoomOut},{default:()=>n(un,null)}),"tipZoomOut"),f=l(n(M,{clsPrefix:o,onClick:this.handleDownloadClick},{default:()=>n(bt,null)}),"tipDownload"),C=l(n(M,{clsPrefix:o,onClick:this.toggleShow},{default:()=>bn}),"tipClose"),w=l(n(M,{clsPrefix:o,onClick:this.zoomIn},{default:()=>n(dn,null)}),"tipZoomIn");return n(he,null,(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e),n(Ft,{show:this.show},{default:()=>{var x;return this.show||this.displayed?((x=this.onRender)===null||x===void 0||x.call(this),Fe(n("div",{class:[`${o}-image-preview-container`,this.themeClass],style:this.cssVars,onWheel:this.handleWheel},n(Re,{name:"fade-in-transition",appear:this.appear},{default:()=>this.show?n("div",{class:`${o}-image-preview-overlay`,onClick:this.toggleShow}):null}),this.showToolbar?n(Re,{name:"fade-in-transition",appear:this.appear},{default:()=>this.show?n("div",{class:`${o}-image-preview-toolbar`},r?r({nodes:{prev:i,next:u,rotateCounterclockwise:c,rotateClockwise:d,resizeToOriginalSize:a,zoomOut:s,zoomIn:w,download:f,close:C}}):n(he,null,this.onPrev?n(he,null,i,u):null,c,d,a,s,w,f,C)):null}):null,n(Re,{name:"fade-in-scale-up-transition",onAfterLeave:this.handleAfterLeave,appear:this.appear,onEnter:this.syncTransformOrigin,onBeforeLeave:this.syncTransformOrigin},{default:()=>{const{previewedImgProps:A={}}=this;return Fe(n("div",{class:`${o}-image-preview-wrapper`,ref:"previewWrapperRef"},n("img",Object.assign({},A,{draggable:!1,onMousedown:this.handlePreviewMousedown,onDblclick:this.handlePreviewDblclick,class:[`${o}-image-preview`,A.class],key:this.previewSrc,src:this.previewSrc,ref:"previewRef",onDragstart:this.handleDragStart}))),[[$t,this.show]])}})),[[jt,{enabled:this.show}]])):null}}))}}),yt=Pe("n-image-group"),Cn=De,yn=Q({name:"ImageGroup",props:Cn,setup(e){let t;const{mergedClsPrefixRef:o}=pe(e),r=`c${Se()}`,l=Zt(),i=d=>{var a;t=d,(a=c.value)===null||a===void 0||a.setPreviewSrc(d)};function u(d){var a,s;if(!(l!=null&&l.proxy))return;const C=l.proxy.$el.parentElement.querySelectorAll(`[data-group-id=${r}]:not([data-error=true])`);if(!C.length)return;const w=Array.from(C).findIndex(x=>x.dataset.previewSrc===t);~w?i(C[(w+d+C.length)%C.length].dataset.previewSrc):i(C[0].dataset.previewSrc),d===1?(a=e.onPreviewNext)===null||a===void 0||a.call(e):(s=e.onPreviewPrev)===null||s===void 0||s.call(e)}Ee(yt,{mergedClsPrefixRef:o,setPreviewSrc:i,setThumbnailEl:d=>{var a;(a=c.value)===null||a===void 0||a.setThumbnailEl(d)},toggleShow:()=>{var d;(d=c.value)===null||d===void 0||d.toggleShow()},groupId:r,renderToolbarRef:S(e,"renderToolbar")});const c=$(null);return{mergedClsPrefix:o,previewInstRef:c,next:()=>{u(1)},prev:()=>{u(-1)}}},render(){return n(Ct,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:this.mergedClsPrefix,ref:"previewInstRef",onPrev:this.prev,onNext:this.next,showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip,renderToolbar:this.renderToolbar},this.$slots)}}),Rn=Object.assign({alt:String,height:[String,Number],imgProps:Object,previewedImgProps:Object,lazy:Boolean,intersectionObserverOptions:Object,objectFit:{type:String,default:"fill"},previewSrc:String,fallbackSrc:String,width:[String,Number],src:String,previewDisabled:Boolean,loadDescription:String,onError:Function,onLoad:Function},De),Tn=Q({name:"Image",props:Rn,inheritAttrs:!1,setup(e){const t=$(null),o=$(!1),r=$(null),l=ne(yt,null),{mergedClsPrefixRef:i}=l||pe(e),u={click:()=>{if(e.previewDisabled||o.value)return;const a=e.previewSrc||e.src;if(l){l.setPreviewSrc(a),l.setThumbnailEl(t.value),l.toggleShow();return}const{value:s}=r;s&&(s.setPreviewSrc(a),s.setThumbnailEl(t.value),s.toggleShow())}},c=$(!e.lazy);je(()=>{var a;(a=t.value)===null||a===void 0||a.setAttribute("data-group-id",(l==null?void 0:l.groupId)||"")}),je(()=>{if(e.lazy&&e.intersectionObserverOptions){let a;const s=Ie(()=>{a==null||a(),a=void 0,a=gn(t.value,e.intersectionObserverOptions,c)});et(()=>{s(),a==null||a()})}}),Ie(()=>{var a;e.src||((a=e.imgProps)===null||a===void 0||a.src),o.value=!1});const d=$(!1);return Ee(xt,{previewedImgPropsRef:S(e,"previewedImgProps")}),Object.assign({mergedClsPrefix:i,groupId:l==null?void 0:l.groupId,previewInstRef:r,imageRef:t,showError:o,shouldStartLoading:c,loaded:d,mergedOnClick:a=>{var s,f;u.click(),(f=(s=e.imgProps)===null||s===void 0?void 0:s.onClick)===null||f===void 0||f.call(s,a)},mergedOnError:a=>{if(!c.value)return;o.value=!0;const{onError:s,imgProps:{onError:f}={}}=e;s==null||s(a),f==null||f(a)},mergedOnLoad:a=>{const{onLoad:s,imgProps:{onLoad:f}={}}=e;s==null||s(a),f==null||f(a),d.value=!0}},u)},render(){var e,t;const{mergedClsPrefix:o,imgProps:r={},loaded:l,$attrs:i,lazy:u}=this,c=(t=(e=this.$slots).placeholder)===null||t===void 0?void 0:t.call(e),d=this.src||r.src,a=n("img",Object.assign(Object.assign({},r),{ref:"imageRef",width:this.width||r.width,height:this.height||r.height,src:this.showError?this.fallbackSrc:u&&this.intersectionObserverOptions?this.shouldStartLoading?d:void 0:d,alt:this.alt||r.alt,"aria-label":this.alt||r.alt,onClick:this.mergedOnClick,onError:this.mergedOnError,onLoad:this.mergedOnLoad,loading:fn&&u&&!this.intersectionObserverOptions?"lazy":"eager",style:[r.style||"",c&&!l?{height:"0",width:"0",visibility:"hidden"}:"",{objectFit:this.objectFit}],"data-error":this.showError,"data-preview-src":this.previewSrc||this.src}));return n("div",Object.assign({},i,{role:"none",class:[i.class,`${o}-image`,(this.previewDisabled||this.showError)&&`${o}-image--preview-disabled`]}),this.groupId?a:n(Ct,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:o,ref:"previewInstRef",showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip,renderToolbar:this.renderToolbar},{default:()=>a,toolbar:()=>{var s,f;return(f=(s=this.$slots).toolbar)===null||f===void 0?void 0:f.call(s)}}),!l&&c)}}),ae=Pe("n-upload"),Rt="__UPLOAD_DRAGGER__",_n=Q({name:"UploadDragger",[Rt]:!0,setup(e,{slots:t}){const o=ne(ae,null);return o||me("upload-dragger","`n-upload-dragger` must be placed inside `n-upload`."),()=>{const{mergedClsPrefixRef:{value:r},mergedDisabledRef:{value:l},maxReachedRef:{value:i}}=o;return n("div",{class:[`${r}-upload-dragger`,(l||i)&&`${r}-upload-dragger--disabled`]},t)}}});var ke=function(e,t,o,r){function l(i){return i instanceof o?i:new o(function(u){u(i)})}return new(o||(o=Promise))(function(i,u){function c(s){try{a(r.next(s))}catch(f){u(f)}}function d(s){try{a(r.throw(s))}catch(f){u(f)}}function a(s){s.done?i(s.value):l(s.value).then(c,d)}a((r=r.apply(e,t||[])).next())})};const Tt=e=>e.includes("image/"),Ge=(e="")=>{const t=e.split("/"),r=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(r)||[""])[0]},qe=/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i,_t=e=>{if(e.type)return Tt(e.type);const t=Ge(e.name||"");if(qe.test(t))return!0;const o=e.thumbnailUrl||e.url||"",r=Ge(o);return!!(/^data:image\//.test(o)||qe.test(r))};function On(e){return ke(this,void 0,void 0,function*(){return yield new Promise(t=>{if(!e.type||!Tt(e.type)){t("");return}t(window.URL.createObjectURL(e))})})}const Ln=Qe&&window.FileReader&&window.File;function Sn(e){return e.isDirectory}function In(e){return e.isFile}function kn(e,t){return ke(this,void 0,void 0,function*(){const o=[];function r(l){return ke(this,void 0,void 0,function*(){for(const i of l)if(i){if(t&&Sn(i)){const u=i.createReader();try{const c=yield new Promise((d,a)=>{u.readEntries(d,a)});yield r(c)}catch{}}else if(In(i))try{const u=yield new Promise((c,d)=>{i.file(c,d)});o.push({file:u,entry:i,source:"dnd"})}catch{}}})}return yield r(e),o})}function se(e){const{id:t,name:o,percentage:r,status:l,url:i,file:u,thumbnailUrl:c,type:d,fullPath:a,batchId:s}=e;return{id:t,name:o,percentage:r??null,status:l,url:i??null,file:u??null,thumbnailUrl:c??null,type:d??null,fullPath:a??null,batchId:s??null}}function Pn(e,t,o){return e=e.toLowerCase(),t=t.toLocaleLowerCase(),o=o.toLocaleLowerCase(),o.split(",").map(l=>l.trim()).filter(Boolean).some(l=>{if(l.startsWith(".")){if(e.endsWith(l))return!0}else if(l.includes("/")){const[i,u]=t.split("/"),[c,d]=l.split("/");if((c==="*"||i&&c&&c===i)&&(d==="*"||u&&d&&d===u))return!0}else return!0;return!1})}const Ot=Q({name:"UploadTrigger",props:{abstract:Boolean},setup(e,{slots:t}){const o=ne(ae,null);o||me("upload-trigger","`n-upload-trigger` must be placed inside `n-upload`.");const{mergedClsPrefixRef:r,mergedDisabledRef:l,maxReachedRef:i,listTypeRef:u,dragOverRef:c,openOpenFileDialog:d,draggerInsideRef:a,handleFileAddition:s,mergedDirectoryDndRef:f,triggerClassRef:C,triggerStyleRef:w}=o,x=j(()=>u.value==="image-card");function A(){l.value||i.value||d()}function Z(I){I.preventDefault(),c.value=!0}function F(I){I.preventDefault(),c.value=!0}function N(I){I.preventDefault(),c.value=!1}function X(I){var p;if(I.preventDefault(),!a.value||l.value||i.value){c.value=!1;return}const y=(p=I.dataTransfer)===null||p===void 0?void 0:p.items;y!=null&&y.length?kn(Array.from(y).map(R=>R.webkitGetAsEntry()),f.value).then(R=>{s(R)}).finally(()=>{c.value=!1}):c.value=!1}return()=>{var I;const{value:p}=r;return e.abstract?(I=t.default)===null||I===void 0?void 0:I.call(t,{handleClick:A,handleDrop:X,handleDragOver:Z,handleDragEnter:F,handleDragLeave:N}):n("div",{class:[`${p}-upload-trigger`,(l.value||i.value)&&`${p}-upload-trigger--disabled`,x.value&&`${p}-upload-trigger--image-card`,C.value],style:w.value,onClick:A,onDrop:X,onDragover:Z,onDragenter:F,onDragleave:N},x.value?n(_n,null,{default:()=>Wt(t.default,()=>[n(M,{clsPrefix:p},{default:()=>n(Xt,null)})])}):t)}}}),En=Q({name:"UploadProgress",props:{show:Boolean,percentage:{type:Number,required:!0},status:{type:String,required:!0}},setup(){return{mergedTheme:ne(ae).mergedThemeRef}},render(){return n(ot,null,{default:()=>this.show?n(co,{type:"line",showIndicator:!1,percentage:this.percentage,status:this.status,height:2,theme:this.mergedTheme.peers.Progress,themeOverrides:this.mergedTheme.peerOverrides.Progress}):null})}}),Bn=n("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},n("g",{fill:"none"},n("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"}))),Dn=n("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},n("g",{fill:"none"},n("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 Un=function(e,t,o,r){function l(i){return i instanceof o?i:new o(function(u){u(i)})}return new(o||(o=Promise))(function(i,u){function c(s){try{a(r.next(s))}catch(f){u(f)}}function d(s){try{a(r.throw(s))}catch(f){u(f)}}function a(s){s.done?i(s.value):l(s.value).then(c,d)}a((r=r.apply(e,t||[])).next())})};const fe={paddingMedium:"0 3px",heightMedium:"24px",iconSizeMedium:"18px"},Mn=Q({name:"UploadFile",props:{clsPrefix:{type:String,required:!0},file:{type:Object,required:!0},listType:{type:String,required:!0},index:{type:Number,required:!0}},setup(e){const t=ne(ae),o=$(null),r=$(""),l=j(()=>{const{file:p}=e;return p.status==="finished"?"success":p.status==="error"?"error":"info"}),i=j(()=>{const{file:p}=e;if(p.status==="error")return"error"}),u=j(()=>{const{file:p}=e;return p.status==="uploading"}),c=j(()=>{if(!t.showCancelButtonRef.value)return!1;const{file:p}=e;return["uploading","pending","error"].includes(p.status)}),d=j(()=>{if(!t.showRemoveButtonRef.value)return!1;const{file:p}=e;return["finished"].includes(p.status)}),a=j(()=>{if(!t.showDownloadButtonRef.value)return!1;const{file:p}=e;return["finished"].includes(p.status)}),s=j(()=>{if(!t.showRetryButtonRef.value)return!1;const{file:p}=e;return["error"].includes(p.status)}),f=Yt(()=>r.value||e.file.thumbnailUrl||e.file.url),C=j(()=>{if(!t.showPreviewButtonRef.value)return!1;const{file:{status:p},listType:y}=e;return["finished"].includes(p)&&f.value&&y==="image-card"});function w(){t.submit(e.file.id)}function x(p){p.preventDefault();const{file:y}=e;["finished","pending","error"].includes(y.status)?Z(y):["uploading"].includes(y.status)?N(y):Kt("upload","The button clicked type is unknown.")}function A(p){p.preventDefault(),F(e.file)}function Z(p){const{xhrMap:y,doChange:R,onRemoveRef:{value:E},mergedFileListRef:{value:v}}=t;Promise.resolve(E?E({file:Object.assign({},p),fileList:v,index:e.index}):!0).then(k=>{if(k===!1)return;const _=Object.assign({},p,{status:"removed"});y.delete(p.id),R(_,void 0,{remove:!0})})}function F(p){const{onDownloadRef:{value:y}}=t;Promise.resolve(y?y(Object.assign({},p)):!0).then(R=>{R!==!1&&it(p.url,p.name)})}function N(p){const{xhrMap:y}=t,R=y.get(p.id);R==null||R.abort(),Z(Object.assign({},p))}function X(){const{onPreviewRef:{value:p}}=t;if(p)p(e.file);else if(e.listType==="image-card"){const{value:y}=o;if(!y)return;y.click()}}const I=()=>Un(this,void 0,void 0,function*(){const{listType:p}=e;p!=="image"&&p!=="image-card"||t.shouldUseThumbnailUrlRef.value(e.file)&&(r.value=yield t.getFileThumbnailUrlResolver(e.file))});return Ie(()=>{I()}),{mergedTheme:t.mergedThemeRef,progressStatus:l,buttonType:i,showProgress:u,disabled:t.mergedDisabledRef,showCancelButton:c,showRemoveButton:d,showDownloadButton:a,showRetryButton:s,showPreviewButton:C,mergedThumbnailUrl:f,shouldUseThumbnailUrl:t.shouldUseThumbnailUrlRef,renderIcon:t.renderIconRef,imageRef:o,handleRemoveOrCancelClick:x,handleDownloadClick:A,handleRetryClick:w,handlePreviewClick:X}},render(){const{clsPrefix:e,mergedTheme:t,listType:o,file:r,renderIcon:l}=this;let i;const u=o==="image";u||o==="image-card"?i=!this.shouldUseThumbnailUrl(r)||!this.mergedThumbnailUrl?n("span",{class:`${e}-upload-file-info__thumbnail`},l?l(r):_t(r)?n(M,{clsPrefix:e},{default:()=>Bn}):n(M,{clsPrefix:e},{default:()=>Dn})):n("a",{rel:"noopener noreferer",target:"_blank",href:r.url||void 0,class:`${e}-upload-file-info__thumbnail`,onClick:this.handlePreviewClick},o==="image-card"?n(Tn,{src:this.mergedThumbnailUrl||void 0,previewSrc:r.url||void 0,alt:r.name,ref:"imageRef"}):n("img",{src:this.mergedThumbnailUrl||void 0,alt:r.name})):i=n("span",{class:`${e}-upload-file-info__thumbnail`},l?l(r):n(M,{clsPrefix:e},{default:()=>n(on,null)}));const d=n(En,{show:this.showProgress,percentage:r.percentage||0,status:this.progressStatus}),a=o==="text"||o==="image";return n("div",{class:[`${e}-upload-file`,`${e}-upload-file--${this.progressStatus}-status`,r.url&&r.status!=="error"&&o!=="image-card"&&`${e}-upload-file--with-url`,`${e}-upload-file--${o}-type`]},n("div",{class:`${e}-upload-file-info`},i,n("div",{class:`${e}-upload-file-info__name`},a&&(r.url&&r.status!=="error"?n("a",{rel:"noopener noreferer",target:"_blank",href:r.url||void 0,onClick:this.handlePreviewClick},r.name):n("span",{onClick:this.handlePreviewClick},r.name)),u&&d),n("div",{class:[`${e}-upload-file-info__action`,`${e}-upload-file-info__action--${o}-type`]},this.showPreviewButton?n(le,{key:"preview",quaternary:!0,type:this.buttonType,onClick:this.handlePreviewClick,theme:t.peers.Button,themeOverrides:t.peerOverrides.Button,builtinThemeOverrides:fe},{icon:()=>n(M,{clsPrefix:e},{default:()=>n(Gt,null)})}):null,(this.showRemoveButton||this.showCancelButton)&&!this.disabled&&n(le,{key:"cancelOrTrash",theme:t.peers.Button,themeOverrides:t.peerOverrides.Button,quaternary:!0,builtinThemeOverrides:fe,type:this.buttonType,onClick:this.handleRemoveOrCancelClick},{icon:()=>n(qt,null,{default:()=>this.showRemoveButton?n(M,{clsPrefix:e,key:"trash"},{default:()=>n(nn,null)}):n(M,{clsPrefix:e,key:"cancel"},{default:()=>n(rn,null)})})}),this.showRetryButton&&!this.disabled&&n(le,{key:"retry",quaternary:!0,type:this.buttonType,onClick:this.handleRetryClick,theme:t.peers.Button,themeOverrides:t.peerOverrides.Button,builtinThemeOverrides:fe},{icon:()=>n(M,{clsPrefix:e},{default:()=>n(an,null)})}),this.showDownloadButton?n(le,{key:"download",quaternary:!0,type:this.buttonType,onClick:this.handleDownloadClick,theme:t.peers.Button,themeOverrides:t.peerOverrides.Button,builtinThemeOverrides:fe},{icon:()=>n(M,{clsPrefix:e},{default:()=>n(bt,null)})}):null)),!u&&d)}}),zn=Q({name:"UploadFileList",setup(e,{slots:t}){const o=ne(ae,null);o||me("upload-file-list","`n-upload-file-list` must be placed inside `n-upload`.");const{abstractRef:r,mergedClsPrefixRef:l,listTypeRef:i,mergedFileListRef:u,fileListClassRef:c,fileListStyleRef:d,cssVarsRef:a,themeClassRef:s,maxReachedRef:f,showTriggerRef:C,imageGroupPropsRef:w}=o,x=j(()=>i.value==="image-card"),A=()=>u.value.map((F,N)=>n(Mn,{clsPrefix:l.value,key:F.id,file:F,index:N,listType:i.value})),Z=()=>x.value?n(yn,Object.assign({},w.value),{default:A}):n(ot,{group:!0},{default:A});return()=>{const{value:F}=l,{value:N}=r;return n("div",{class:[`${F}-upload-file-list`,x.value&&`${F}-upload-file-list--grid`,N?s==null?void 0:s.value:void 0,c.value],style:[N&&a?a.value:"",d.value]},Z(),C.value&&!f.value&&x.value&&n(Ot,null,t))}}}),An=U([b("upload","width: 100%;",[V("dragger-inside",[b("upload-trigger",`
display: block;
`)]),V("drag-over",[b("upload-dragger",`
border: var(--n-dragger-border-hover);
`)])]),b("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);
`,[U("&:hover",`
border: var(--n-dragger-border-hover);
`),V("disabled",`
cursor: not-allowed;
`)]),b("upload-trigger",`
display: inline-block;
box-sizing: border-box;
opacity: 1;
transition: opacity .3s var(--n-bezier);
`,[U("+",[b("upload-file-list","margin-top: 8px;")]),V("disabled",`
opacity: var(--n-item-disabled-opacity);
cursor: not-allowed;
`),V("image-card",`
width: 96px;
height: 96px;
`,[b("base-icon",`
font-size: 24px;
`),b("upload-dragger",`
padding: 0;
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
`)])]),b("upload-file-list",`
line-height: var(--n-line-height);
opacity: 1;
transition: opacity .3s var(--n-bezier);
`,[U("a, img","outline: none;"),V("disabled",`
opacity: var(--n-item-disabled-opacity);
cursor: not-allowed;
`,[b("upload-file","cursor: not-allowed;")]),V("grid",`
display: grid;
grid-template-columns: repeat(auto-fill, 96px);
grid-gap: 8px;
margin-top: 0;
`),b("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);
`,[$e(),b("progress",[$e({foldPadding:!0})]),U("&:hover",`
background-color: var(--n-item-color-hover);
`,[b("upload-file-info",[J("action",`
opacity: 1;
`)])]),V("image-type",`
border-radius: var(--n-border-radius);
text-decoration: underline;
text-decoration-color: #0000;
`,[b("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;
`,[b("progress",`
padding: 2px 0;
margin-bottom: 0;
`),J("name",`
padding: 0 8px;
`),J("thumbnail",`
width: 32px;
height: 32px;
font-size: 28px;
display: flex;
justify-content: center;
align-items: center;
`,[U("img",`
width: 100%;
`)])])]),V("text-type",[b("progress",`
box-sizing: border-box;
padding-bottom: 6px;
margin-bottom: 6px;
`)]),V("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;
`,[b("progress",`
position: absolute;
left: 8px;
bottom: 8px;
right: 8px;
width: unset;
`),b("upload-file-info",`
padding: 0;
width: 100%;
height: 100%;
`,[J("thumbnail",`
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 36px;
`,[U("img",`
width: 100%;
`)])]),U("&::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: "";
`),U("&:hover",[U("&::before","opacity: 1;"),b("upload-file-info",[J("thumbnail","opacity: .12;")])])]),V("error-status",[U("&:hover",`
background-color: var(--n-item-color-hover-error);
`),b("upload-file-info",[J("name","color: var(--n-item-text-color-error);"),J("thumbnail","color: var(--n-item-text-color-error);")]),V("image-card-type",`
border: var(--n-item-border-image-card-error);
`)]),V("with-url",`
cursor: pointer;
`,[b("upload-file-info",[J("name",`
color: var(--n-item-text-color-success);
text-decoration-color: var(--n-item-text-color-success);
`,[U("a",`
text-decoration: underline;
`)])])]),b("upload-file-info",`
position: relative;
padding-top: 6px;
padding-bottom: 6px;
display: flex;
flex-wrap: nowrap;
`,[J("thumbnail",`
font-size: 18px;
opacity: 1;
transition: opacity .2s var(--n-bezier);
color: var(--n-item-icon-color);
`,[b("base-icon",`
margin-right: 2px;
vertical-align: middle;
transition: color .3s var(--n-bezier);
`)]),J("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;
`,[b("button",[U("&:not(:last-child)",{marginRight:"4px"}),b("base-icon",[U("svg",[Jt()])])]),V("image-type",`
position: relative;
max-width: 80px;
width: auto;
`),V("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;
`)]),J("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);
`,[U("a",`
color: inherit;
text-decoration: underline;
`)])])])]),b("upload-file-input",`
display: none;
width: 0;
height: 0;
opacity: 0;
`)]);var Ke=function(e,t,o,r){function l(i){return i instanceof o?i:new o(function(u){u(i)})}return new(o||(o=Promise))(function(i,u){function c(s){try{a(r.next(s))}catch(f){u(f)}}function d(s){try{a(r.throw(s))}catch(f){u(f)}}function a(s){s.done?i(s.value):l(s.value).then(c,d)}a((r=r.apply(e,t||[])).next())})};function Fn(e,t,o){const{doChange:r,xhrMap:l}=e;let i=0;function u(d){var a;let s=Object.assign({},t,{status:"error",percentage:i});l.delete(t.id),s=se(((a=e.onError)===null||a===void 0?void 0:a.call(e,{file:s,event:d}))||s),r(s,d)}function c(d){var a;if(e.isErrorState){if(e.isErrorState(o)){u(d);return}}else if(o.status<200||o.status>=300){u(d);return}let s=Object.assign({},t,{status:"finished",percentage:i});l.delete(t.id),s=se(((a=e.onFinish)===null||a===void 0?void 0:a.call(e,{file:s,event:d}))||s),r(s,d)}return{handleXHRLoad:c,handleXHRError:u,handleXHRAbort(d){const a=Object.assign({},t,{status:"removed",file:null,percentage:i});l.delete(t.id),r(a,d)},handleXHRProgress(d){const a=Object.assign({},t,{status:"uploading"});if(d.lengthComputable){const s=Math.ceil(d.loaded/d.total*100);a.percentage=s,i=s}r(a,d)}}}function jn(e){const{inst:t,file:o,data:r,headers:l,withCredentials:i,action:u,customRequest:c}=e,{doChange:d}=e.inst;let a=0;c({file:o,data:r,headers:l,withCredentials:i,action:u,onProgress(s){const f=Object.assign({},o,{status:"uploading"}),C=s.percent;f.percentage=C,a=C,d(f)},onFinish(){var s;let f=Object.assign({},o,{status:"finished",percentage:a});f=se(((s=t.onFinish)===null||s===void 0?void 0:s.call(t,{file:f}))||f),d(f)},onError(){var s;let f=Object.assign({},o,{status:"error",percentage:a});f=se(((s=t.onError)===null||s===void 0?void 0:s.call(t,{file:f}))||f),d(f)}})}function $n(e,t,o){const r=Fn(e,t,o);o.onabort=r.handleXHRAbort,o.onerror=r.handleXHRError,o.onload=r.handleXHRLoad,o.upload&&(o.upload.onprogress=r.handleXHRProgress)}function Lt(e,t){return typeof e=="function"?e({file:t}):e||{}}function Nn(e,t,o){const r=Lt(t,o);r&&Object.keys(r).forEach(l=>{e.setRequestHeader(l,r[l])})}function Vn(e,t,o){const r=Lt(t,o);r&&Object.keys(r).forEach(l=>{e.append(l,r[l])})}function Hn(e,t,o,{method:r,action:l,withCredentials:i,responseType:u,headers:c,data:d}){const a=new XMLHttpRequest;a.responseType=u,e.xhrMap.set(o.id,a),a.withCredentials=i;const s=new FormData;if(Vn(s,d,o),o.file!==null&&s.append(t,o.file),$n(e,o,a),l!==void 0){a.open(r.toUpperCase(),l),Nn(a,c,o),a.send(s);const f=Object.assign({},o,{status:"uploading"});e.doChange(f)}}const Zn=Object.assign(Object.assign({},ve.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],fileListClass:String,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=>Ln?_t(e):!1},createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object,triggerClass:String,triggerStyle:[String,Object],renderIcon:Function}),Wn=Q({name:"Upload",props:Zn,setup(e){e.abstract&&e.listType==="image-card"&&me("upload","when the list-type is image-card, abstract is not supported.");const{mergedClsPrefixRef:t,inlineThemeDisabled:o}=pe(e),r=ve("Upload","-upload",An,Qt,e,t),l=eo(e),i=j(()=>{const{max:v}=e;return v!==void 0?w.value.length>=v:!1}),u=$(e.defaultFileList),c=S(e,"fileList"),d=$(null),a={value:!1},s=$(!1),f=new Map,C=to(c,u),w=j(()=>C.value.map(se));function x(){var v;(v=d.value)===null||v===void 0||v.click()}function A(v){const k=v.target;N(k.files?Array.from(k.files).map(_=>({file:_,entry:null,source:"input"})):null,v),k.value=""}function Z(v){const{"onUpdate:fileList":k,onUpdateFileList:_}=e;k&&Ne(k,v),_&&Ne(_,v),u.value=v}const F=j(()=>e.multiple||e.directory);function N(v,k){if(!v||v.length===0)return;const{onBeforeUpload:_}=e;v=F.value?v:[v[0]];const{max:z,accept:T}=e;v=v.filter(({file:D,source:P})=>P==="dnd"&&(T!=null&&T.trim())?Pn(D.name,D.type,T):!0),z&&(v=v.slice(0,z-w.value.length));const B=Se();Promise.all(v.map(D=>Ke(this,[D],void 0,function*({file:P,entry:Y}){var W;const ee={id:Se(),batchId:B,name:P.name,status:"pending",percentage:0,file:P,url:null,type:P.type,thumbnailUrl:null,fullPath:(W=Y==null?void 0:Y.fullPath)!==null&&W!==void 0?W:`/${P.webkitRelativePath||P.name}`};return!_||(yield _({file:ee,fileList:w.value}))!==!1?ee:null}))).then(D=>Ke(this,void 0,void 0,function*(){let P=Promise.resolve();D.forEach(Y=>{P=P.then(no).then(()=>{Y&&I(Y,k,{append:!0})})}),yield P})).then(()=>{e.defaultUpload&&X()})}function X(v){const{method:k,action:_,withCredentials:z,headers:T,data:B,name:D}=e,P=v!==void 0?w.value.filter(W=>W.id===v):w.value,Y=v!==void 0;P.forEach(W=>{const{status:ee}=W;(ee==="pending"||ee==="error"&&Y)&&(e.customRequest?jn({inst:{doChange:I,xhrMap:f,onFinish:e.onFinish,onError:e.onError},file:W,action:_,withCredentials:z,headers:T,data:B,customRequest:e.customRequest}):Hn({doChange:I,xhrMap:f,onFinish:e.onFinish,onError:e.onError,isErrorState:e.isErrorState},D,W,{method:k,action:_,withCredentials:z,responseType:e.responseType,headers:T,data:B}))})}const I=(v,k,_={append:!1,remove:!1})=>{const{append:z,remove:T}=_,B=Array.from(w.value),D=B.findIndex(P=>P.id===v.id);if(z||T||~D){z?B.push(v):T?B.splice(D,1):B.splice(D,1,v);const{onChange:P}=e;P&&P({file:v,fileList:B,event:k}),Z(B)}};function p(v){var k;if(v.thumbnailUrl)return v.thumbnailUrl;const{createThumbnailUrl:_}=e;return _?(k=_(v.file,v))!==null&&k!==void 0?k:v.url||"":v.url?v.url:v.file?On(v.file):""}const y=j(()=>{const{common:{cubicBezierEaseInOut:v},self:{draggerColor:k,draggerBorder:_,draggerBorderHover:z,itemColorHover:T,itemColorHoverError:B,itemTextColorError:D,itemTextColorSuccess:P,itemTextColor:Y,itemIconColor:W,itemDisabledOpacity:ee,lineHeight:we,borderRadius:de,fontSize:be,itemBorderImageCardError:xe,itemBorderImageCard:Ce}}=r.value;return{"--n-bezier":v,"--n-border-radius":de,"--n-dragger-border":_,"--n-dragger-border-hover":z,"--n-dragger-color":k,"--n-font-size":be,"--n-item-color-hover":T,"--n-item-color-hover-error":B,"--n-item-disabled-opacity":ee,"--n-item-icon-color":W,"--n-item-text-color":Y,"--n-item-text-color-error":D,"--n-item-text-color-success":P,"--n-line-height":we,"--n-item-border-image-card-error":xe,"--n-item-border-image-card":Ce}}),R=o?tt("upload",void 0,y,e):void 0;Ee(ae,{mergedClsPrefixRef:t,mergedThemeRef:r,showCancelButtonRef:S(e,"showCancelButton"),showDownloadButtonRef:S(e,"showDownloadButton"),showRemoveButtonRef:S(e,"showRemoveButton"),showRetryButtonRef:S(e,"showRetryButton"),onRemoveRef:S(e,"onRemove"),onDownloadRef:S(e,"onDownload"),mergedFileListRef:w,triggerClassRef:S(e,"triggerClass"),triggerStyleRef:S(e,"triggerStyle"),shouldUseThumbnailUrlRef:S(e,"shouldUseThumbnailUrl"),renderIconRef:S(e,"renderIcon"),xhrMap:f,submit:X,doChange:I,showPreviewButtonRef:S(e,"showPreviewButton"),onPreviewRef:S(e,"onPreview"),getFileThumbnailUrlResolver:p,listTypeRef:S(e,"listType"),dragOverRef:s,openOpenFileDialog:x,draggerInsideRef:a,handleFileAddition:N,mergedDisabledRef:l.mergedDisabledRef,maxReachedRef:i,fileListClassRef:S(e,"fileListClass"),fileListStyleRef:S(e,"fileListStyle"),abstractRef:S(e,"abstract"),acceptRef:S(e,"accept"),cssVarsRef:o?void 0:y,themeClassRef:R==null?void 0:R.themeClass,onRender:R==null?void 0:R.onRender,showTriggerRef:S(e,"showTrigger"),imageGroupPropsRef:S(e,"imageGroupProps"),mergedDirectoryDndRef:j(()=>{var v;return(v=e.directoryDnd)!==null&&v!==void 0?v:e.directory})});const E={clear:()=>{u.value=[]},submit:X,openOpenFileDialog:x};return Object.assign({mergedClsPrefix:t,draggerInsideRef:a,inputElRef:d,mergedTheme:r,dragOver:s,mergedMultiple:F,cssVars:o?void 0:y,themeClass:R==null?void 0:R.themeClass,onRender:R==null?void 0:R.onRender,handleFileInputChange:A},E)},render(){var e,t;const{draggerInsideRef:o,mergedClsPrefix:r,$slots:l,directory:i,onRender:u}=this;if(l.default&&!this.abstract){const d=l.default()[0];!((e=d==null?void 0:d.type)===null||e===void 0)&&e[Rt]&&(o.value=!0)}const c=n("input",Object.assign({},this.inputProps,{ref:"inputElRef",type:"file",class:`${r}-upload-file-input`,accept:this.accept,multiple:this.mergedMultiple,onChange:this.handleFileInputChange,webkitdirectory:i||void 0,directory:i||void 0}));return this.abstract?n(he,null,(t=l.default)===null||t===void 0?void 0:t.call(l),n(oo,{to:"body"},c)):(u==null||u(),n("div",{class:[`${r}-upload`,o.value&&`${r}-upload--dragger-inside`,this.dragOver&&`${r}-upload--drag-over`,this.themeClass],style:this.cssVars},c,this.showTrigger&&this.listType!=="image-card"&&n(Ot,null,l),this.showFileList&&n(zn,null,l)))}}),Xn={class:"inline-block",viewBox:"0 0 16 16",width:"1em",height:"1em"},Yn=rt("path",{fill:"currentColor","fill-rule":"evenodd",d:"M11.78 5.841a.75.75 0 0 1-1.06 0l-1.97-1.97v7.379a.75.75 0 0 1-1.5 0V3.871l-1.97 1.97a.75.75 0 0 1-1.06-1.06l3.25-3.25L8 1l.53.53l3.25 3.25a.75.75 0 0 1 0 1.061M2.5 9.75a.75.75 0 0 0-1.5 0V13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9.75a.75.75 0 0 0-1.5 0V13a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5z","clip-rule":"evenodd"},null,-1),Gn=[Yn];function qn(e,t){return Be(),nt("svg",Xn,[...Gn])}const dr={name:"pajamas-export",render:qn},Kn={class:"inline-block",viewBox:"0 0 16 16",width:"1em",height:"1em"},Jn=rt("path",{fill:"currentColor","fill-rule":"evenodd",d:"M11.78 7.159a.75.75 0 0 0-1.06 0l-1.97 1.97V1.75a.75.75 0 0 0-1.5 0v7.379l-1.97-1.97a.75.75 0 0 0-1.06 1.06l3.25 3.25L8 12l.53-.53l3.25-3.25a.75.75 0 0 0 0-1.061M2.5 9.75a.75.75 0 1 0-1.5 0V13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9.75a.75.75 0 0 0-1.5 0V13a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5z","clip-rule":"evenodd"},null,-1),Qn=[Jn];function er(e,t){return Be(),nt("svg",Kn,[...Qn])}const tr={name:"pajamas-import",render:er},ur=Q({name:"FileUpload",__name:"file-upload",props:{accept:{},action:{}},emits:["refresh"],setup(e,{emit:t}){const o=t,r=i=>{var u,c;return((u=i.file.file)==null?void 0:u.type)!=="application/json"?((c=window.$message)==null||c.error(ge("common.checkUploadType")),!1):!0},l=({file:i,data:u,headers:c,withCredentials:d,action:a,onFinish:s,onError:f,onProgress:C})=>{const w=new FormData;u&&Object.keys(u).forEach(x=>{w.append(x,u[x])}),w.append("file",i.file),so({url:a,method:"post",data:w,withCredentials:d,headers:c,onUploadProgress:({progress:x})=>{C({percent:Math.ceil(x)})}}).then(()=>{s(),o("refresh")}).catch(()=>f())};return(i,u)=>{const c=tr,d=le,a=Wn;return Be(),ro(a,{action:i.action,accept:i.accept,"custom-request":l,"show-file-list":!1,onBeforeUpload:r},{default:Te(()=>[Ve(d,{size:"small",ghost:"",type:"primary"},{icon:Te(()=>[Ve(c,{class:"text-icon"})]),default:Te(()=>[io(" "+ao(lo(ge)("common.import")),1)]),_:1})]),_:1},8,["action","accept"])}}});var or={VITE_APP_TITLE:"Snail Job",VITE_APP_DESC:"A flexible, reliable, and fast platform for distributed task retry and distributed task scheduling.",VITE_APP_VERSION:"1.1.1",VITE_APP_DEFAULT_TOKEN:"SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj",VITE_ICON_PREFIX:"icon",VITE_ICON_LOCAL_PREFIX:"icon-local",VITE_AUTH_ROUTE_MODE:"static",VITE_ROUTE_HOME:"home",VITE_MENU_ICON:"mdi:menu",VITE_HTTP_PROXY:"Y",VITE_ROUTER_HISTORY_MODE:"hash",VITE_SERVICE_SUCCESS_CODE:"1",VITE_SERVICE_LOGOUT_CODES:"8888,8889",VITE_SERVICE_MODAL_LOGOUT_CODES:"5001",VITE_SERVICE_EXPIRED_TOKEN_CODES:"9999,9998",VITE_STATIC_SUPER_ROLE:"R_ADMIN",VITE_SOURCE_MAP:"N",VITE_STORAGE_PREFIX:"",VITE_ICONIFY_URL:"/snail-job/iconify",VITE_UPDATE_NOTIFY:"N",VITE_LOGIN_CODE:"N",VITE_BASE_URL:"/snail-job",VITE_SERVICE_BASE_URL:"/snail-job",BASE_URL:"/snail-job",MODE:"prod",DEV:!1,PROD:!0,SSR:!1};const{baseURL:nr}=uo(or);function rr(e,t,o=!0){var r,l;try{let i=t;o&&(i=`${t}-${new Date().getTime()}.json`),ir(e,i)}catch{(r=window.$message)==null||r.error(ge("common.downloadFail"))}finally{(l=window.$loading)==null||l.endLoading()}}function ir(e,t){const o=[e],r=new Blob(o,{type:"application/octet-stream"}),l=window.URL.createObjectURL(r),i=document.createElement("a");i.style.display="none",i.href=l,i.setAttribute("download",t),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(l)}const cr=(e,t,o)=>{var i;(i=window.$loading)==null||i.startLoading();const r=He.get("token"),l=He.get("namespaceId");fetch(`${nr}${e}?t=${new Date().getTime()}`,{method:"post",body:JSON.stringify(t),headers:{"SNAIL-JOB-AUTH":r,"SNAIL-JOB-NAMESPACE-ID":l,"Content-Type":"application/json;charset=utf-8;"}}).then(async u=>u.blob()).then(u=>rr(u,o)).catch(()=>{var u;return(u=window.$message)==null?void 0:u.error(ge("common.downloadFail"))}).finally(()=>{var u;return(u=window.$loading)==null?void 0:u.endLoading()})};export{ur as _,dr as a,cr as d};
© 2015 - 2025 Weber Informatics LLC | Privacy Policy