import{bs as Ye,bt as ee,k as t,d as X,S as Ge,$ as le,be as Oe,a6 as Ot,a2 as Tt,bu as zt,U,T as v,b3 as Me,aO as Bt,Y as It,ab as N,f as V,a9 as $t,L as Dt,ah as xe,bv as fe,h as Ke,aU as re,C as O,W as ue,a1 as Te,b4 as Mt,b8 as _t,E as _e,b7 as Ut,aR as ye,F as ke,aj as H,G as Et,x as jt,bm as At,bw as Pe,aZ as ze,bh as Ft,g as Ue,aW as Le,Z as I,a4 as ie,aN as Je,aK as Qe,aL as et,aM as tt,bx as Nt,a5 as Ee,ba as ve,ai as Ht,aC as rt,ad as Wt,m as ge,by as Vt,bz as Zt,bA as Xt,aG as je,V as Q,bB as qt,bC as Yt,aa as Gt,ac as Kt,bD as Jt,D as Qt,al as Ae}from"./index-e497b666.js";import{A as er}from"./Add-f2559956.js";import{N as tr}from"./RadioGroup-6edab0a1.js";function rr(e,o,r,n){var i=-1,d=e==null?0:e.length;for(n&&d&&(r=e[++i]);++i{var o;const{root:r=null}=e;return{hash:`${e.rootMargin||"0px 0px 0px 0px"}-${Array.isArray(e.threshold)?e.threshold.join(","):(o=e.threshold)!==null&&o!==void 0?o:"0"}`,options:Object.assign(Object.assign({},e),{root:(typeof r=="string"?document.querySelector(r):r)||document.documentElement})}},Ce=new WeakMap,Re=new WeakMap,Se=new WeakMap,ao=(e,o,r)=>{if(!e)return()=>{};const n=io(o),{root:i}=n.options;let d;const u=Ce.get(i);u?d=u:(d=new Map,Ce.set(i,d));let c,s;d.has(n.hash)?(s=d.get(n.hash),s[1].has(e)||(c=s[0],s[1].add(e),c.observe(e))):(c=new IntersectionObserver(f=>{f.forEach(x=>{if(x.isIntersecting){const g=Re.get(x.target),R=Se.get(x.target);g&&g(),R&&(R.value=!0)}})},n.options),c.observe(e),s=[c,new Set([e])],d.set(n.hash,s));let a=!1;const l=()=>{a||(Re.delete(e),Se.delete(e),a=!0,s[1].has(e)&&(s[0].unobserve(e),s[1].delete(e)),s[1].size<=0&&d.delete(n.hash),d.size||Ce.delete(i))};return Re.set(e,l),Se.set(e,r),l},Be=Object.assign(Object.assign({},le.props),{showToolbar:{type:Boolean,default:!0},showToolbarTooltip:Boolean}),vt=Oe("n-image");function lo(){return{toolbarIconColor:"rgba(255, 255, 255, .9)",toolbarColor:"rgba(0, 0, 0, .35)",toolbarBoxShadow:"none",toolbarBorderRadius:"24px"}}const so=Ot({name:"Image",common:Tt,peers:{Tooltip:zt},self:lo}),uo=t("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("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"})),co=t("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("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"})),fo=t("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("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"})),go=U([U("body >",[v("image-container","position: fixed;")]),v("image-preview-container",` position: fixed; left: 0; right: 0; top: 0; bottom: 0; display: flex; `),v("image-preview-overlay",` z-index: -1; position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: rgba(0, 0, 0, .3); `,[Me()]),v("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; `,[v("base-icon",` padding: 0 8px; font-size: 28px; cursor: pointer; `),Me()]),v("image-preview-wrapper",` position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; pointer-events: none; `,[Bt()]),v("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); `),v("image",` display: inline-flex; max-height: 100%; max-width: 100%; `,[It("preview-disabled",` cursor: pointer; `),U("img",` border-radius: inherit; `)])]),he=32,mt=X({name:"ImagePreview",props:Object.assign(Object.assign({},Be),{onNext:Function,onPrev:Function,clsPrefix:{type:String,required:!0}}),setup(e){const o=le("Image","-image",go,so,e,N(e,"clsPrefix"));let r=null;const n=V(null),i=V(null),d=V(void 0),u=V(!1),c=V(!1),{localeRef:s}=$t("Image");function a(){const{value:h}=i;if(!r||!h)return;const{style:w}=h,p=r.getBoundingClientRect(),z=p.left+p.width/2,B=p.top+p.height/2;w.transformOrigin=`${z}px ${B}px`}function l(h){var w,p;switch(h.key){case" ":h.preventDefault();break;case"ArrowLeft":(w=e.onPrev)===null||w===void 0||w.call(e);break;case"ArrowRight":(p=e.onNext)===null||p===void 0||p.call(e);break;case"Escape":Ie();break}}Dt(u,h=>{h?xe("keydown",document,l):fe("keydown",document,l)}),Ke(()=>{fe("keydown",document,l)});let f=0,x=0,g=0,R=0,y=0,L=0,E=0,$=0,S=!1;function D(h){const{clientX:w,clientY:p}=h;g=w-f,R=p-x,At(q)}function b(h){const{mouseUpClientX:w,mouseUpClientY:p,mouseDownClientX:z,mouseDownClientY:B}=h,Z=z-w,K=B-p,J=`vertical${K>0?"Top":"Bottom"}`,te=`horizontal${Z>0?"Left":"Right"}`;return{moveVerticalDirection:J,moveHorizontalDirection:te,deltaHorizontal:Z,deltaVertical:K}}function C(h){const{value:w}=n;if(!w)return{offsetX:0,offsetY:0};const p=w.getBoundingClientRect(),{moveVerticalDirection:z,moveHorizontalDirection:B,deltaHorizontal:Z,deltaVertical:K}=h||{};let J=0,te=0;return p.width<=window.innerWidth?J=0:p.left>0?J=(p.width-window.innerWidth)/2:p.right0?te=(p.height-window.innerHeight)/2:p.bottom.5){const h=P;W-=1,P=Math.max(.5,Math.pow(T,W));const w=h-P;q(!1);const p=C();P+=w,q(!1),P-=w,g=p.offsetX,R=p.offsetY,q()}}function q(h=!0){var w;const{value:p}=n;if(!p)return;const{style:z}=p,B=jt((w=j==null?void 0:j.previewedImgPropsRef.value)===null||w===void 0?void 0:w.style);let Z="";if(typeof B=="string")Z=B+";";else for(const J in B)Z+=`${Xr(J)}: ${B[J]};`;const K=`transform-origin: center; transform: translateX(${g}px) translateY(${R}px) rotate(${A}deg) scale(${P});`;S?z.cssText=Z+"cursor: grabbing; transition: none;"+K:z.cssText=Z+"cursor: grab;"+K+(h?"":"transition: none;"),h||p.offsetHeight}function Ie(){u.value=!u.value,c.value=!0}function kt(){P=ce(),W=Math.ceil(Math.log(P)/Math.log(T)),g=0,R=0,q()}const Pt={setPreviewSrc:h=>{d.value=h},setThumbnailEl:h=>{r=h},toggleShow:Ie};function Lt(h,w){if(e.showToolbarTooltip){const{value:p}=o;return t(tr,{to:!1,theme:p.peers.Tooltip,themeOverrides:p.peerOverrides.Tooltip,keepAliveOnHover:!1},{default:()=>s.value[w],trigger:()=>h})}else return h}const $e=O(()=>{const{common:{cubicBezierEaseInOut:h},self:{toolbarIconColor:w,toolbarBorderRadius:p,toolbarBoxShadow:z,toolbarColor:B}}=o.value;return{"--n-bezier":h,"--n-toolbar-icon-color":w,"--n-toolbar-color":B,"--n-toolbar-border-radius":p,"--n-toolbar-box-shadow":z}}),{inlineThemeDisabled:De}=ue(),ne=De?Te("image-preview",void 0,$e,e):void 0;return Object.assign({previewRef:n,previewWrapperRef:i,previewSrc:d,show:u,appear:Mt(),displayed:c,previewedImgProps:j==null?void 0:j.previewedImgPropsRef,handleWheel(h){h.preventDefault()},handlePreviewMousedown:m,handlePreviewDblclick:M,syncTransformOrigin:a,handleAfterLeave:()=>{_(),A=0,c.value=!1},handleDragStart:h=>{var w,p;(p=(w=j==null?void 0:j.previewedImgPropsRef.value)===null||w===void 0?void 0:w.onDragstart)===null||p===void 0||p.call(w,h),h.preventDefault()},zoomIn:be,zoomOut:we,rotateCounterclockwise:G,rotateClockwise:oe,handleSwitchPrev:F,handleSwitchNext:Y,withTooltip:Lt,resizeToOrignalImageSize:kt,cssVars:De?void 0:$e,themeClass:ne==null?void 0:ne.themeClass,onRender:ne==null?void 0:ne.onRender},Pt)},render(){var e,o;const{clsPrefix:r}=this;return t(ke,null,(o=(e=this.$slots).default)===null||o===void 0?void 0:o.call(e),t(_t,{show:this.show},{default:()=>{var n;return this.show||this.displayed?((n=this.onRender)===null||n===void 0||n.call(this),_e(t("div",{class:[`${r}-image-preview-container`,this.themeClass],style:this.cssVars,onWheel:this.handleWheel},t(ye,{name:"fade-in-transition",appear:this.appear},{default:()=>this.show?t("div",{class:`${r}-image-preview-overlay`,onClick:this.toggleShow}):null}),this.showToolbar?t(ye,{name:"fade-in-transition",appear:this.appear},{default:()=>{if(!this.show)return null;const{withTooltip:i}=this;return t("div",{class:`${r}-image-preview-toolbar`},this.onPrev?t(ke,null,i(t(H,{clsPrefix:r,onClick:this.handleSwitchPrev},{default:()=>uo}),"tipPrevious"),i(t(H,{clsPrefix:r,onClick:this.handleSwitchNext},{default:()=>co}),"tipNext")):null,i(t(H,{clsPrefix:r,onClick:this.rotateCounterclockwise},{default:()=>t(eo,null)}),"tipCounterclockwise"),i(t(H,{clsPrefix:r,onClick:this.rotateClockwise},{default:()=>t(Qr,null)}),"tipClockwise"),i(t(H,{clsPrefix:r,onClick:this.resizeToOrignalImageSize},{default:()=>t(oo,null)}),"tipOriginalSize"),i(t(H,{clsPrefix:r,onClick:this.zoomOut},{default:()=>t(ro,null)}),"tipZoomOut"),i(t(H,{clsPrefix:r,onClick:this.zoomIn},{default:()=>t(to,null)}),"tipZoomIn"),i(t(H,{clsPrefix:r,onClick:this.toggleShow},{default:()=>fo}),"tipClose"))}}):null,t(ye,{name:"fade-in-scale-up-transition",onAfterLeave:this.handleAfterLeave,appear:this.appear,onEnter:this.syncTransformOrigin,onBeforeLeave:this.syncTransformOrigin},{default:()=>{const{previewedImgProps:i={}}=this;return _e(t("div",{class:`${r}-image-preview-wrapper`,ref:"previewWrapperRef"},t("img",Object.assign({},i,{draggable:!1,onMousedown:this.handlePreviewMousedown,onDblclick:this.handlePreviewDblclick,class:[`${r}-image-preview`,i.class],key:this.previewSrc,src:this.previewSrc,ref:"previewRef",onDragstart:this.handleDragStart}))),[[Et,this.show]])}})),[[Ut,{enabled:this.show}]])):null}}))}}),bt=Oe("n-image-group"),ho=Be,po=X({name:"ImageGroup",props:ho,setup(e){let o;const{mergedClsPrefixRef:r}=ue(e),n=`c${Pe()}`,i=Ft(),d=s=>{var a;o=s,(a=c.value)===null||a===void 0||a.setPreviewSrc(s)};function u(s){if(!(i!=null&&i.proxy))return;const l=i.proxy.$el.parentElement.querySelectorAll(`[data-group-id=${n}]:not([data-error=true])`);if(!l.length)return;const f=Array.from(l).findIndex(x=>x.dataset.previewSrc===o);~f?d(l[(f+s+l.length)%l.length].dataset.previewSrc):d(l[0].dataset.previewSrc)}ze(bt,{mergedClsPrefixRef:r,setPreviewSrc:d,setThumbnailEl:s=>{var a;(a=c.value)===null||a===void 0||a.setThumbnailEl(s)},toggleShow:()=>{var s;(s=c.value)===null||s===void 0||s.toggleShow()},groupId:n});const c=V(null);return{mergedClsPrefix:r,previewInstRef:c,next:()=>{u(1)},prev:()=>{u(-1)}}},render(){return t(mt,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:this.mergedClsPrefix,ref:"previewInstRef",onPrev:this.prev,onNext:this.next,showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip},this.$slots)}}),vo=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},Be),mo=X({name:"Image",props:vo,inheritAttrs:!1,setup(e){const o=V(null),r=V(!1),n=V(null),i=re(bt,null),{mergedClsPrefixRef:d}=i||ue(e),u={click:()=>{if(e.previewDisabled||r.value)return;const a=e.previewSrc||e.src;if(i){i.setPreviewSrc(a),i.setThumbnailEl(o.value),i.toggleShow();return}const{value:l}=n;l&&(l.setPreviewSrc(a),l.setThumbnailEl(o.value),l.toggleShow())}},c=V(!e.lazy);Ue(()=>{var a;(a=o.value)===null||a===void 0||a.setAttribute("data-group-id",(i==null?void 0:i.groupId)||"")}),Ue(()=>{if(e.lazy&&e.intersectionObserverOptions){let a;const l=Le(()=>{a==null||a(),a=void 0,a=ao(o.value,e.intersectionObserverOptions,c)});Ke(()=>{l(),a==null||a()})}}),Le(()=>{var a;e.src,(a=e.imgProps)===null||a===void 0||a.src,r.value=!1});const s=V(!1);return ze(vt,{previewedImgPropsRef:N(e,"previewedImgProps")}),Object.assign({mergedClsPrefix:d,groupId:i==null?void 0:i.groupId,previewInstRef:n,imageRef:o,showError:r,shouldStartLoading:c,loaded:s,mergedOnClick:a=>{var l,f;u.click(),(f=(l=e.imgProps)===null||l===void 0?void 0:l.onClick)===null||f===void 0||f.call(l,a)},mergedOnError:a=>{if(!c.value)return;r.value=!0;const{onError:l,imgProps:{onError:f}={}}=e;l==null||l(a),f==null||f(a)},mergedOnLoad:a=>{const{onLoad:l,imgProps:{onLoad:f}={}}=e;l==null||l(a),f==null||f(a),s.value=!0}},u)},render(){var e,o;const{mergedClsPrefix:r,imgProps:n={},loaded:i,$attrs:d,lazy:u}=this,c=(o=(e=this.$slots).placeholder)===null||o===void 0?void 0:o.call(e),s=this.src||n.src,a=t("img",Object.assign(Object.assign({},n),{ref:"imageRef",width:this.width||n.width,height:this.height||n.height,src:this.showError?this.fallbackSrc:u&&this.intersectionObserverOptions?this.shouldStartLoading?s:void 0:s,alt:this.alt||n.alt,"aria-label":this.alt||n.alt,onClick:this.mergedOnClick,onError:this.mergedOnError,onLoad:this.mergedOnLoad,loading:no&&u&&!this.intersectionObserverOptions?"lazy":"eager",style:[n.style||"",c&&!i?{height:"0",width:"0",visibility:"hidden"}:"",{objectFit:this.objectFit}],"data-error":this.showError,"data-preview-src":this.previewSrc||this.src}));return t("div",Object.assign({},d,{role:"none",class:[d.class,`${r}-image`,(this.previewDisabled||this.showError)&&`${r}-image--preview-disabled`]}),this.groupId?a:t(mt,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:r,ref:"previewInstRef",showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip},{default:()=>a}),!i&&c)}}),bo=U([v("progress",{display:"inline-block"},[v("progress-icon",` color: var(--n-icon-color); transition: color .3s var(--n-bezier); `),I("line",` width: 100%; display: block; `,[v("progress-content",` display: flex; align-items: center; `,[v("progress-graph",{flex:1})]),v("progress-custom-content",{marginLeft:"14px"}),v("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); `,[I("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); `)])]),I("circle, dashboard",{width:"120px"},[v("progress-custom-content",` position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); display: flex; align-items: center; justify-content: center; `),v("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; `),v("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); `)]),I("multiple-circle",` width: 200px; color: inherit; `,[v("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); `)]),v("progress-content",{position:"relative"}),v("progress-graph",{position:"relative"},[v("progress-graph-circle",[U("svg",{verticalAlign:"bottom"}),v("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); `,[I("empty",{opacity:0})]),v("progress-graph-circle-rail",` transition: stroke .3s var(--n-bezier); overflow: hidden; stroke: var(--n-rail-color); `)]),v("progress-graph-line",[I("indicator-inside",[v("progress-graph-line-rail",` height: 16px; line-height: 16px; border-radius: 10px; `,[v("progress-graph-line-fill",` height: inherit; border-radius: 10px; `),v("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); `)])]),I("indicator-inside-label",` height: 16px; display: flex; align-items: center; `,[v("progress-graph-line-rail",` flex: 1; transition: background-color .3s var(--n-bezier); `),v("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); `)]),v("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); `,[v("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); `,[I("processing",[U("&::after",` content: ""; background-image: var(--n-line-bg-processing); animation: progress-processing-animation 2s var(--n-bezier) infinite; `)])])])])])]),U("@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; } `)]),wo={success:t(Je,null),error:t(Qe,null),warning:t(et,null),info:t(tt,null)},xo=X({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:o}){const r=O(()=>ie(e.height)),n=O(()=>e.railBorderRadius!==void 0?ie(e.railBorderRadius):e.height!==void 0?ie(e.height,{c:.5}):""),i=O(()=>e.fillBorderRadius!==void 0?ie(e.fillBorderRadius):e.railBorderRadius!==void 0?ie(e.railBorderRadius):e.height!==void 0?ie(e.height,{c:.5}):"");return()=>{const{indicatorPlacement:d,railColor:u,railStyle:c,percentage:s,unit:a,indicatorTextColor:l,status:f,showIndicator:x,fillColor:g,processing:R,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-${d}`]:!0}]},t("div",{class:`${y}-progress-graph-line-rail`,style:[{backgroundColor:u,height:r.value,borderRadius:n.value},c]},t("div",{class:[`${y}-progress-graph-line-fill`,R&&`${y}-progress-graph-line-fill--processing`],style:{maxWidth:`${e.percentage}%`,backgroundColor:g,height:r.value,lineHeight:r.value,borderRadius:i.value}},d==="inside"?t("div",{class:`${y}-progress-graph-line-indicator`,style:{color:l}},s,a):null)))),x&&d==="outside"?t("div",null,o.default?t("div",{class:`${y}-progress-custom-content`,style:{color:l},role:"none"},o.default()):f==="default"?t("div",{role:"none",class:`${y}-progress-icon ${y}-progress-icon--as-text`,style:{color:l}},s,a):t("div",{class:`${y}-progress-icon`,"aria-hidden":!0},t(H,{clsPrefix:y},{default:()=>wo[f]}))):null)}}}),yo={success:t(Je,null),error:t(Qe,null),warning:t(et,null),info:t(tt,null)},Co=X({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:o}){function r(n,i,d){const{gapDegree:u,viewBoxWidth:c,strokeWidth:s}=e,a=50,l=0,f=a,x=0,g=2*a,R=50+s/2,y=`M ${R},${R} m ${l},${f} a ${a},${a} 0 1 1 ${x},${-g} a ${a},${a} 0 1 1 ${-x},${g}`,L=Math.PI*2*a,E={stroke:d,strokeDasharray:`${n/100*(L-u)}px ${c*8}px`,strokeDashoffset:`-${u/2}px`,transformOrigin:i?"center":void 0,transform:i?`rotate(${i}deg)`:void 0};return{pathString:y,pathStyle:E}}return()=>{const{fillColor:n,railColor:i,strokeWidth:d,offsetDegree:u,status:c,percentage:s,showIndicator:a,indicatorTextColor:l,unit:f,gapOffsetDegree:x,clsPrefix:g}=e,{pathString:R,pathStyle:y}=r(100,0,i),{pathString:L,pathStyle:E}=r(s,u,n),$=100+d;return t("div",{class:`${g}-progress-content`,role:"none"},t("div",{class:`${g}-progress-graph`,"aria-hidden":!0},t("div",{class:`${g}-progress-graph-circle`,style:{transform:x?`rotate(${x}deg)`:void 0}},t("svg",{viewBox:`0 0 ${$} ${$}`},t("g",null,t("path",{class:`${g}-progress-graph-circle-rail`,d:R,"stroke-width":d,"stroke-linecap":"round",fill:"none",style:y})),t("g",null,t("path",{class:[`${g}-progress-graph-circle-fill`,s===0&&`${g}-progress-graph-circle-fill--empty`],d:L,"stroke-width":d,"stroke-linecap":"round",fill:"none",style:E}))))),a?t("div",null,o.default?t("div",{class:`${g}-progress-custom-content`,role:"none"},o.default()):c!=="default"?t("div",{class:`${g}-progress-icon`,"aria-hidden":!0},t(H,{clsPrefix:g},{default:()=>yo[c]})):t("div",{class:`${g}-progress-text`,style:{color:l},role:"none"},t("span",{class:`${g}-progress-text__percentage`},s),t("span",{class:`${g}-progress-text__unit`},f))):null)}}});function Ve(e,o,r=100){return`m ${r/2} ${r/2-e} a ${e} ${e} 0 1 1 0 ${2*e} a ${e} ${e} 0 1 1 0 -${2*e}`}const Ro=X({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:o}){const r=O(()=>e.percentage.map((i,d)=>`${Math.PI*i/100*(e.viewBoxWidth/2-e.strokeWidth/2*(1+2*d)-e.circleGap*d)*2}, ${e.viewBoxWidth*8}`));return()=>{const{viewBoxWidth:n,strokeWidth:i,circleGap:d,showIndicator:u,fillColor:c,railColor:s,railStyle:a,percentage:l,clsPrefix:f}=e;return t("div",{class:`${f}-progress-content`,role:"none"},t("div",{class:`${f}-progress-graph`,"aria-hidden":!0},t("div",{class:`${f}-progress-graph-circle`},t("svg",{viewBox:`0 0 ${n} ${n}`},l.map((x,g)=>t("g",{key:g},t("path",{class:`${f}-progress-graph-circle-rail`,d:Ve(n/2-i/2*(1+2*g)-d*g,i,n),"stroke-width":i,"stroke-linecap":"round",fill:"none",style:[{strokeDashoffset:0,stroke:s[g]},a[g]]}),t("path",{class:[`${f}-progress-graph-circle-fill`,x===0&&`${f}-progress-graph-circle-fill--empty`],d:Ve(n/2-i/2*(1+2*g)-d*g,i,n),"stroke-width":i,"stroke-linecap":"round",fill:"none",style:{strokeDasharray:r.value[g],strokeDashoffset:0,stroke:c[g]}})))))),u&&o.default?t("div",null,t("div",{class:`${f}-progress-text`},o.default())):null)}}}),So=Object.assign(Object.assign({},le.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}),ko=X({name:"Progress",props:So,setup(e){const o=O(()=>e.indicatorPlacement||e.indicatorPosition),r=O(()=>{if(e.gapDegree||e.gapDegree===0)return e.gapDegree;if(e.type==="dashboard")return 75}),{mergedClsPrefixRef:n,inlineThemeDisabled:i}=ue(e),d=le("Progress","-progress",bo,Nt,e,n),u=O(()=>{const{status:s}=e,{common:{cubicBezierEaseInOut:a},self:{fontSize:l,fontSizeCircle:f,railColor:x,railHeight:g,iconSizeCircle:R,iconSizeLine:y,textColorCircle:L,textColorLineInner:E,textColorLineOuter:$,lineBgProcessing:S,fontWeightCircle:D,[Ee("iconColor",s)]:b,[Ee("fillColor",s)]:C}}=d.value;return{"--n-bezier":a,"--n-fill-color":C,"--n-font-size":l,"--n-font-size-circle":f,"--n-font-weight-circle":D,"--n-icon-color":b,"--n-icon-size-circle":R,"--n-icon-size-line":y,"--n-line-bg-processing":S,"--n-rail-color":x,"--n-rail-height":g,"--n-text-color-circle":L,"--n-text-color-line-inner":E,"--n-text-color-line-outer":$}}),c=i?Te("progress",O(()=>e.status[0]),u,e):void 0;return{mergedClsPrefix:n,mergedIndicatorPlacement:o,gapDeg:r,cssVars:i?void 0:u,themeClass:c==null?void 0:c.themeClass,onRender:c==null?void 0:c.onRender}},render(){const{type:e,cssVars:o,indicatorTextColor:r,showIndicator:n,status:i,railColor:d,railStyle:u,color:c,percentage:s,viewBoxWidth:a,strokeWidth:l,mergedIndicatorPlacement:f,unit:x,borderRadius:g,fillBorderRadius:R,height:y,processing:L,circleGap:E,mergedClsPrefix:$,gapDeg:S,gapOffsetDegree:D,themeClass:b,$slots:C,onRender:k}=this;return k==null||k(),t("div",{class:[b,`${$}-progress`,`${$}-progress--${e}`,`${$}-progress--${i}`],style:o,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,role:e==="circle"||e==="line"||e==="dashboard"?"progressbar":"none"},e==="circle"||e==="dashboard"?t(Co,{clsPrefix:$,status:i,showIndicator:n,indicatorTextColor:r,railColor:d,fillColor:c,railStyle:u,offsetDegree:this.offsetDegree,percentage:s,viewBoxWidth:a,strokeWidth:l,gapDegree:S===void 0?e==="dashboard"?75:0:S,gapOffsetDegree:D,unit:x},C):e==="line"?t(xo,{clsPrefix:$,status:i,showIndicator:n,indicatorTextColor:r,railColor:d,fillColor:c,railStyle:u,percentage:s,processing:L,indicatorPlacement:f,unit:x,fillBorderRadius:R,railBorderRadius:g,height:y},C):e==="multiple-circle"?t(Ro,{clsPrefix:$,strokeWidth:l,railColor:d,fillColor:c,railStyle:u,viewBoxWidth:a,percentage:s,showIndicator:n,circleGap:E},C):null)}}),se=Oe("n-upload"),wt="__UPLOAD_DRAGGER__",Po=X({name:"UploadDragger",[wt]:!0,setup(e,{slots:o}){const r=re(se,null);return r||ve("upload-dragger","`n-upload-dragger` must be placed inside `n-upload`."),()=>{const{mergedClsPrefixRef:{value:n},mergedDisabledRef:{value:i},maxReachedRef:{value:d}}=r;return t("div",{class:[`${n}-upload-dragger`,(i||d)&&`${n}-upload-dragger--disabled`]},o)}}});var xt=globalThis&&globalThis.__awaiter||function(e,o,r,n){function i(d){return d instanceof r?d:new r(function(u){u(d)})}return new(r||(r=Promise))(function(d,u){function c(l){try{a(n.next(l))}catch(f){u(f)}}function s(l){try{a(n.throw(l))}catch(f){u(f)}}function a(l){l.done?d(l.value):i(l.value).then(c,s)}a((n=n.apply(e,o||[])).next())})};const yt=e=>e.includes("image/"),Ze=(e="")=>{const o=e.split("/"),n=o[o.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(n)||[""])[0]},Xe=/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i,Ct=e=>{if(e.type)return yt(e.type);const o=Ze(e.name||"");if(Xe.test(o))return!0;const r=e.thumbnailUrl||e.url||"",n=Ze(r);return!!(/^data:image\//.test(r)||Xe.test(n))};function Lo(e){return xt(this,void 0,void 0,function*(){return yield new Promise(o=>{if(!e.type||!yt(e.type)){o("");return}o(window.URL.createObjectURL(e))})})}const Oo=Ge&&window.FileReader&&window.File;function To(e){return e.isDirectory}function zo(e){return e.isFile}function Bo(e,o){return xt(this,void 0,void 0,function*(){const r=[];let n,i=0;function d(){i++}function u(){i--,i||n(r)}function c(s){s.forEach(a=>{if(a){if(d(),o&&To(a)){const l=a.createReader();d(),l.readEntries(f=>{c(f),u()},()=>{u()})}else zo(a)&&(d(),a.file(l=>{r.push({file:l,entry:a,source:"dnd"}),u()},()=>{u()}));u()}})}return yield new Promise(s=>{n=s,c(e)}),r})}function de(e){const{id:o,name:r,percentage:n,status:i,url:d,file:u,thumbnailUrl:c,type:s,fullPath:a,batchId:l}=e;return{id:o,name:r,percentage:n??null,status:i,url:d??null,file:u??null,thumbnailUrl:c??null,type:s??null,fullPath:a??null,batchId:l??null}}function Io(e,o,r){return e=e.toLowerCase(),o=o.toLocaleLowerCase(),r=r.toLocaleLowerCase(),r.split(",").map(i=>i.trim()).filter(Boolean).some(i=>{if(i.startsWith(".")){if(e.endsWith(i))return!0}else if(i.includes("/")){const[d,u]=o.split("/"),[c,s]=i.split("/");if((c==="*"||d&&c&&c===d)&&(s==="*"||u&&s&&s===u))return!0}else return!0;return!1})}const $o=(e,o)=>{if(!e)return;const r=document.createElement("a");r.href=e,o!==void 0&&(r.download=o),document.body.appendChild(r),r.click(),document.body.removeChild(r)},Rt=X({name:"UploadTrigger",props:{abstract:Boolean},setup(e,{slots:o}){const r=re(se,null);r||ve("upload-trigger","`n-upload-trigger` must be placed inside `n-upload`.");const{mergedClsPrefixRef:n,mergedDisabledRef:i,maxReachedRef:d,listTypeRef:u,dragOverRef:c,openOpenFileDialog:s,draggerInsideRef:a,handleFileAddition:l,mergedDirectoryDndRef:f,triggerStyleRef:x}=r,g=O(()=>u.value==="image-card");function R(){i.value||d.value||s()}function y(S){S.preventDefault(),c.value=!0}function L(S){S.preventDefault(),c.value=!0}function E(S){S.preventDefault(),c.value=!1}function $(S){var D;if(S.preventDefault(),!a.value||i.value||d.value){c.value=!1;return}const b=(D=S.dataTransfer)===null||D===void 0?void 0:D.items;b!=null&&b.length?Bo(Array.from(b).map(C=>C.webkitGetAsEntry()),f.value).then(C=>{l(C)}).finally(()=>{c.value=!1}):c.value=!1}return()=>{var S;const{value:D}=n;return e.abstract?(S=o.default)===null||S===void 0?void 0:S.call(o,{handleClick:R,handleDrop:$,handleDragOver:y,handleDragEnter:L,handleDragLeave:E}):t("div",{class:[`${D}-upload-trigger`,(i.value||d.value)&&`${D}-upload-trigger--disabled`,g.value&&`${D}-upload-trigger--image-card`],style:x.value,onClick:R,onDrop:$,onDragover:y,onDragenter:L,onDragleave:E},g.value?t(Po,null,{default:()=>Ht(o.default,()=>[t(H,{clsPrefix:D},{default:()=>t(er,null)})])}):o)}}}),Do=X({name:"UploadProgress",props:{show:Boolean,percentage:{type:Number,required:!0},status:{type:String,required:!0}},setup(){return{mergedTheme:re(se).mergedThemeRef}},render(){return t(rt,null,{default:()=>this.show?t(ko,{type:"line",showIndicator:!1,percentage:this.percentage,status:this.status,height:2,theme:this.mergedTheme.peers.Progress,themeOverrides:this.mergedTheme.peerOverrides.Progress}):null})}}),Mo=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"}))),_o=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 Uo=globalThis&&globalThis.__awaiter||function(e,o,r,n){function i(d){return d instanceof r?d:new r(function(u){u(d)})}return new(r||(r=Promise))(function(d,u){function c(l){try{a(n.next(l))}catch(f){u(f)}}function s(l){try{a(n.throw(l))}catch(f){u(f)}}function a(l){l.done?d(l.value):i(l.value).then(c,s)}a((n=n.apply(e,o||[])).next())})};const pe={paddingMedium:"0 3px",heightMedium:"24px",iconSizeMedium:"18px"},Eo=X({name:"UploadFile",props:{clsPrefix:{type:String,required:!0},file:{type:Object,required:!0},listType:{type:String,required:!0}},setup(e){const o=re(se),r=V(null),n=V(""),i=O(()=>{const{file:b}=e;return b.status==="finished"?"success":b.status==="error"?"error":"info"}),d=O(()=>{const{file:b}=e;if(b.status==="error")return"error"}),u=O(()=>{const{file:b}=e;return b.status==="uploading"}),c=O(()=>{if(!o.showCancelButtonRef.value)return!1;const{file:b}=e;return["uploading","pending","error"].includes(b.status)}),s=O(()=>{if(!o.showRemoveButtonRef.value)return!1;const{file:b}=e;return["finished"].includes(b.status)}),a=O(()=>{if(!o.showDownloadButtonRef.value)return!1;const{file:b}=e;return["finished"].includes(b.status)}),l=O(()=>{if(!o.showRetryButtonRef.value)return!1;const{file:b}=e;return["error"].includes(b.status)}),f=Wt(()=>n.value||e.file.thumbnailUrl||e.file.url),x=O(()=>{if(!o.showPreviewButtonRef.value)return!1;const{file:{status:b},listType:C}=e;return["finished"].includes(b)&&f.value&&C==="image-card"});function g(){o.submit(e.file.id)}function R(b){b.preventDefault();const{file:C}=e;["finished","pending","error"].includes(C.status)?L(C):["uploading"].includes(C.status)?$(C):Xt("upload","The button clicked type is unknown.")}function y(b){b.preventDefault(),E(e.file)}function L(b){const{xhrMap:C,doChange:k,onRemoveRef:{value:j},mergedFileListRef:{value:m}}=o;Promise.resolve(j?j({file:Object.assign({},b),fileList:m}):!0).then(M=>{if(M===!1)return;const T=Object.assign({},b,{status:"removed"});C.delete(b.id),k(T,void 0,{remove:!0})})}function E(b){const{onDownloadRef:{value:C}}=o;Promise.resolve(C?C(Object.assign({},b)):!0).then(k=>{k!==!1&&$o(b.url,b.name)})}function $(b){const{xhrMap:C}=o,k=C.get(b.id);k==null||k.abort(),L(Object.assign({},b))}function S(){const{onPreviewRef:{value:b}}=o;if(b)b(e.file);else if(e.listType==="image-card"){const{value:C}=r;if(!C)return;C.click()}}const D=()=>Uo(this,void 0,void 0,function*(){const{listType:b}=e;b!=="image"&&b!=="image-card"||o.shouldUseThumbnailUrlRef.value(e.file)&&(n.value=yield o.getFileThumbnailUrlResolver(e.file))});return Le(()=>{D()}),{mergedTheme:o.mergedThemeRef,progressStatus:i,buttonType:d,showProgress:u,disabled:o.mergedDisabledRef,showCancelButton:c,showRemoveButton:s,showDownloadButton:a,showRetryButton:l,showPreviewButton:x,mergedThumbnailUrl:f,shouldUseThumbnailUrl:o.shouldUseThumbnailUrlRef,renderIcon:o.renderIconRef,imageRef:r,handleRemoveOrCancelClick:R,handleDownloadClick:y,handleRetryClick:g,handlePreviewClick:S}},render(){const{clsPrefix:e,mergedTheme:o,listType:r,file:n,renderIcon:i}=this;let d;const u=r==="image";u||r==="image-card"?d=!this.shouldUseThumbnailUrl(n)||!this.mergedThumbnailUrl?t("span",{class:`${e}-upload-file-info__thumbnail`},i?i(n):Ct(n)?t(H,{clsPrefix:e},{default:()=>Mo}):t(H,{clsPrefix:e},{default:()=>_o})):t("a",{rel:"noopener noreferer",target:"_blank",href:n.url||void 0,class:`${e}-upload-file-info__thumbnail`,onClick:this.handlePreviewClick},r==="image-card"?t(mo,{src:this.mergedThumbnailUrl||void 0,previewSrc:n.url||void 0,alt:n.name,ref:"imageRef"}):t("img",{src:this.mergedThumbnailUrl||void 0,alt:n.name})):d=t("span",{class:`${e}-upload-file-info__thumbnail`},i?i(n):t(H,{clsPrefix:e},{default:()=>t(qr,null)}));const s=t(Do,{show:this.showProgress,percentage:n.percentage||0,status:this.progressStatus}),a=r==="text"||r==="image";return t("div",{class:[`${e}-upload-file`,`${e}-upload-file--${this.progressStatus}-status`,n.url&&n.status!=="error"&&r!=="image-card"&&`${e}-upload-file--with-url`,`${e}-upload-file--${r}-type`]},t("div",{class:`${e}-upload-file-info`},d,t("div",{class:`${e}-upload-file-info__name`},a&&(n.url&&n.status!=="error"?t("a",{rel:"noopener noreferer",target:"_blank",href:n.url||void 0,onClick:this.handlePreviewClick},n.name):t("span",{onClick:this.handlePreviewClick},n.name)),u&&s),t("div",{class:[`${e}-upload-file-info__action`,`${e}-upload-file-info__action--${r}-type`]},this.showPreviewButton?t(ge,{key:"preview",quaternary:!0,type:this.buttonType,onClick:this.handlePreviewClick,theme:o.peers.Button,themeOverrides:o.peerOverrides.Button,builtinThemeOverrides:pe},{icon:()=>t(H,{clsPrefix:e},{default:()=>t(Vt,null)})}):null,(this.showRemoveButton||this.showCancelButton)&&!this.disabled&&t(ge,{key:"cancelOrTrash",theme:o.peers.Button,themeOverrides:o.peerOverrides.Button,quaternary:!0,builtinThemeOverrides:pe,type:this.buttonType,onClick:this.handleRemoveOrCancelClick},{icon:()=>t(Zt,null,{default:()=>this.showRemoveButton?t(H,{clsPrefix:e,key:"trash"},{default:()=>t(Yr,null)}):t(H,{clsPrefix:e,key:"cancel"},{default:()=>t(Kr,null)})})}),this.showRetryButton&&!this.disabled&&t(ge,{key:"retry",quaternary:!0,type:this.buttonType,onClick:this.handleRetryClick,theme:o.peers.Button,themeOverrides:o.peerOverrides.Button,builtinThemeOverrides:pe},{icon:()=>t(H,{clsPrefix:e},{default:()=>t(Jr,null)})}),this.showDownloadButton?t(ge,{key:"download",quaternary:!0,type:this.buttonType,onClick:this.handleDownloadClick,theme:o.peers.Button,themeOverrides:o.peerOverrides.Button,builtinThemeOverrides:pe},{icon:()=>t(H,{clsPrefix:e},{default:()=>t(Gr,null)})}):null)),!u&&s)}}),jo=X({name:"UploadFileList",setup(e,{slots:o}){const r=re(se,null);r||ve("upload-file-list","`n-upload-file-list` must be placed inside `n-upload`.");const{abstractRef:n,mergedClsPrefixRef:i,listTypeRef:d,mergedFileListRef:u,fileListStyleRef:c,cssVarsRef:s,themeClassRef:a,maxReachedRef:l,showTriggerRef:f,imageGroupPropsRef:x}=r,g=O(()=>d.value==="image-card"),R=()=>u.value.map(L=>t(Eo,{clsPrefix:i.value,key:L.id,file:L,listType:d.value})),y=()=>g.value?t(po,Object.assign({},x.value),{default:R}):t(rt,{group:!0},{default:R});return()=>{const{value:L}=i,{value:E}=n;return t("div",{class:[`${L}-upload-file-list`,g.value&&`${L}-upload-file-list--grid`,E?a==null?void 0:a.value:void 0],style:[E&&s?s.value:"",c.value]},y(),f.value&&!l.value&&g.value&&t(Rt,null,o))}}}),Ao=U([v("upload","width: 100%;",[I("dragger-inside",[v("upload-trigger",` display: block; `)]),I("drag-over",[v("upload-dragger",` border: var(--n-dragger-border-hover); `)])]),v("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); `),I("disabled",` cursor: not-allowed; `)]),v("upload-trigger",` display: inline-block; box-sizing: border-box; opacity: 1; transition: opacity .3s var(--n-bezier); `,[U("+",[v("upload-file-list","margin-top: 8px;")]),I("disabled",` opacity: var(--n-item-disabled-opacity); cursor: not-allowed; `),I("image-card",` width: 96px; height: 96px; `,[v("base-icon",` font-size: 24px; `),v("upload-dragger",` padding: 0; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; `)])]),v("upload-file-list",` line-height: var(--n-line-height); opacity: 1; transition: opacity .3s var(--n-bezier); `,[U("a, img","outline: none;"),I("disabled",` opacity: var(--n-item-disabled-opacity); cursor: not-allowed; `,[v("upload-file","cursor: not-allowed;")]),I("grid",` display: grid; grid-template-columns: repeat(auto-fill, 96px); grid-gap: 8px; margin-top: 0; `),v("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); `,[je(),v("progress",[je({foldPadding:!0})]),U("&:hover",` background-color: var(--n-item-color-hover); `,[v("upload-file-info",[Q("action",` opacity: 1; `)])]),I("image-type",` border-radius: var(--n-border-radius); text-decoration: underline; text-decoration-color: #0000; `,[v("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; `,[v("progress",` padding: 2px 0; margin-bottom: 0; `),Q("name",` padding: 0 8px; `),Q("thumbnail",` width: 32px; height: 32px; font-size: 28px; display: flex; justify-content: center; align-items: center; `,[U("img",` width: 100%; `)])])]),I("text-type",[v("progress",` box-sizing: border-box; padding-bottom: 6px; margin-bottom: 6px; `)]),I("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; `,[v("progress",` position: absolute; left: 8px; bottom: 8px; right: 8px; width: unset; `),v("upload-file-info",` padding: 0; width: 100%; height: 100%; `,[Q("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;"),v("upload-file-info",[Q("thumbnail","opacity: .12;")])])]),I("error-status",[U("&:hover",` background-color: var(--n-item-color-hover-error); `),v("upload-file-info",[Q("name","color: var(--n-item-text-color-error);"),Q("thumbnail","color: var(--n-item-text-color-error);")]),I("image-card-type",` border: var(--n-item-border-image-card-error); `)]),I("with-url",` cursor: pointer; `,[v("upload-file-info",[Q("name",` color: var(--n-item-text-color-success); text-decoration-color: var(--n-item-text-color-success); `,[U("a",` text-decoration: underline; `)])])]),v("upload-file-info",` position: relative; padding-top: 6px; padding-bottom: 6px; display: flex; flex-wrap: nowrap; `,[Q("thumbnail",` font-size: 18px; opacity: 1; transition: opacity .2s var(--n-bezier); color: var(--n-item-icon-color); `,[v("base-icon",` margin-right: 2px; vertical-align: middle; transition: color .3s var(--n-bezier); `)]),Q("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; `,[v("button",[U("&:not(:last-child)",{marginRight:"4px"}),v("base-icon",[U("svg",[qt()])])]),I("image-type",` position: relative; max-width: 80px; width: auto; `),I("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; `)]),Q("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; `)])])])]),v("upload-file-input",` display: block; width: 0; height: 0; opacity: 0; `)]);var qe=globalThis&&globalThis.__awaiter||function(e,o,r,n){function i(d){return d instanceof r?d:new r(function(u){u(d)})}return new(r||(r=Promise))(function(d,u){function c(l){try{a(n.next(l))}catch(f){u(f)}}function s(l){try{a(n.throw(l))}catch(f){u(f)}}function a(l){l.done?d(l.value):i(l.value).then(c,s)}a((n=n.apply(e,o||[])).next())})};function Fo(e,o,r){const{doChange:n,xhrMap:i}=e;let d=0;function u(s){var a;let l=Object.assign({},o,{status:"error",percentage:d});i.delete(o.id),l=de(((a=e.onError)===null||a===void 0?void 0:a.call(e,{file:l,event:s}))||l),n(l,s)}function c(s){var a;if(e.isErrorState){if(e.isErrorState(r)){u(s);return}}else if(r.status<200||r.status>=300){u(s);return}let l=Object.assign({},o,{status:"finished",percentage:d});i.delete(o.id),l=de(((a=e.onFinish)===null||a===void 0?void 0:a.call(e,{file:l,event:s}))||l),n(l,s)}return{handleXHRLoad:c,handleXHRError:u,handleXHRAbort(s){const a=Object.assign({},o,{status:"removed",file:null,percentage:d});i.delete(o.id),n(a,s)},handleXHRProgress(s){const a=Object.assign({},o,{status:"uploading"});if(s.lengthComputable){const l=Math.ceil(s.loaded/s.total*100);a.percentage=l,d=l}n(a,s)}}}function No(e){const{inst:o,file:r,data:n,headers:i,withCredentials:d,action:u,customRequest:c}=e,{doChange:s}=e.inst;let a=0;c({file:r,data:n,headers:i,withCredentials:d,action:u,onProgress(l){const f=Object.assign({},r,{status:"uploading"}),x=l.percent;f.percentage=x,a=x,s(f)},onFinish(){var l;let f=Object.assign({},r,{status:"finished",percentage:a});f=de(((l=o.onFinish)===null||l===void 0?void 0:l.call(o,{file:f}))||f),s(f)},onError(){var l;let f=Object.assign({},r,{status:"error",percentage:a});f=de(((l=o.onError)===null||l===void 0?void 0:l.call(o,{file:f}))||f),s(f)}})}function Ho(e,o,r){const n=Fo(e,o,r);r.onabort=n.handleXHRAbort,r.onerror=n.handleXHRError,r.onload=n.handleXHRLoad,r.upload&&(r.upload.onprogress=n.handleXHRProgress)}function St(e,o){return typeof e=="function"?e({file:o}):e||{}}function Wo(e,o,r){const n=St(o,r);n&&Object.keys(n).forEach(i=>{e.setRequestHeader(i,n[i])})}function Vo(e,o,r){const n=St(o,r);n&&Object.keys(n).forEach(i=>{e.append(i,n[i])})}function Zo(e,o,r,{method:n,action:i,withCredentials:d,responseType:u,headers:c,data:s}){const a=new XMLHttpRequest;a.responseType=u,e.xhrMap.set(r.id,a),a.withCredentials=d;const l=new FormData;if(Vo(l,s,r),l.append(o,r.file),Ho(e,r,a),i!==void 0){a.open(n.toUpperCase(),i),Wo(a,c,r),a.send(l);const f=Object.assign({},r,{status:"uploading"});e.doChange(f)}}const Xo=Object.assign(Object.assign({},le.props),{name:{type:String,default:"file"},accept:String,action:String,customRequest:Function,directory:Boolean,directoryDnd:{type:Boolean,default:void 0},method:{type:String,default:"POST"},multiple:Boolean,showFileList:{type:Boolean,default:!0},data:[Object,Function],headers:[Object,Function],withCredentials:Boolean,responseType:{type:String,default:""},disabled:{type:Boolean,default:void 0},onChange:Function,onRemove:Function,onFinish:Function,onError:Function,onBeforeUpload:Function,isErrorState:Function,onDownload:Function,defaultUpload:{type:Boolean,default:!0},fileList:Array,"onUpdate:fileList":[Function,Array],onUpdateFileList:[Function,Array],fileListStyle:[String,Object],defaultFileList:{type:Array,default:()=>[]},showCancelButton:{type:Boolean,default:!0},showRemoveButton:{type:Boolean,default:!0},showDownloadButton:Boolean,showRetryButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},listType:{type:String,default:"text"},onPreview:Function,shouldUseThumbnailUrl:{type:Function,default:e=>Oo?Ct(e):!1},createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object,triggerStyle:[String,Object],renderIcon:Object}),Ko=X({name:"Upload",props:Xo,setup(e){e.abstract&&e.listType==="image-card"&&ve("upload","when the list-type is image-card, abstract is not supported.");const{mergedClsPrefixRef:o,inlineThemeDisabled:r}=ue(e),n=le("Upload","-upload",Ao,Yt,e,o),i=Gt(e),d=O(()=>{const{max:m}=e;return m!==void 0?g.value.length>=m:!1}),u=V(e.defaultFileList),c=N(e,"fileList"),s=V(null),a={value:!1},l=V(!1),f=new Map,x=Kt(c,u),g=O(()=>x.value.map(de));function R(){var m;(m=s.value)===null||m===void 0||m.click()}function y(m){const M=m.target;$(M.files?Array.from(M.files).map(T=>({file:T,entry:null,source:"input"})):null,m),M.value=""}function L(m){const{"onUpdate:fileList":M,onUpdateFileList:T}=e;M&&Ae(M,m),T&&Ae(T,m),u.value=m}const E=O(()=>e.multiple||e.directory);function $(m,M){if(!m||m.length===0)return;const{onBeforeUpload:T}=e;m=E.value?m:[m[0]];const{max:W,accept:P}=e;m=m.filter(({file:_,source:F})=>F==="dnd"&&(P!=null&&P.trim())?Io(_.name,_.type,P):!0),W&&(m=m.slice(0,W-g.value.length));const A=Pe();Promise.all(m.map(({file:_,entry:F})=>qe(this,void 0,void 0,function*(){var Y;const G={id:Pe(),batchId:A,name:_.name,status:"pending",percentage:0,file:_,url:null,type:_.type,thumbnailUrl:null,fullPath:(Y=F==null?void 0:F.fullPath)!==null&&Y!==void 0?Y:`/${_.webkitRelativePath||_.name}`};return!T||(yield T({file:G,fileList:g.value}))!==!1?G:null}))).then(_=>qe(this,void 0,void 0,function*(){let F=Promise.resolve();_.forEach(Y=>{F=F.then(Qt).then(()=>{Y&&D(Y,M,{append:!0})})}),yield F})).then(()=>{e.defaultUpload&&S()})}function S(m){const{method:M,action:T,withCredentials:W,headers:P,data:A,name:_}=e,F=m!==void 0?g.value.filter(G=>G.id===m):g.value,Y=m!==void 0;F.forEach(G=>{const{status:oe}=G;(oe==="pending"||oe==="error"&&Y)&&(e.customRequest?No({inst:{doChange:D,xhrMap:f,onFinish:e.onFinish,onError:e.onError},file:G,action:T,withCredentials:W,headers:P,data:A,customRequest:e.customRequest}):Zo({doChange:D,xhrMap:f,onFinish:e.onFinish,onError:e.onError,isErrorState:e.isErrorState},_,G,{method:M,action:T,withCredentials:W,responseType:e.responseType,headers:P,data:A}))})}const D=(m,M,T={append:!1,remove:!1})=>{const{append:W,remove:P}=T,A=Array.from(g.value),_=A.findIndex(F=>F.id===m.id);if(W||P||~_){W?A.push(m):P?A.splice(_,1):A.splice(_,1,m);const{onChange:F}=e;F&&F({file:m,fileList:A,event:M}),L(A)}};function b(m){var M;if(m.thumbnailUrl)return m.thumbnailUrl;const{createThumbnailUrl:T}=e;return T?(M=T(m.file,m))!==null&&M!==void 0?M:m.url||"":m.url?m.url:m.file?Lo(m.file):""}const C=O(()=>{const{common:{cubicBezierEaseInOut:m},self:{draggerColor:M,draggerBorder:T,draggerBorderHover:W,itemColorHover:P,itemColorHoverError:A,itemTextColorError:_,itemTextColorSuccess:F,itemTextColor:Y,itemIconColor:G,itemDisabledOpacity:oe,lineHeight:me,borderRadius:ce,fontSize:be,itemBorderImageCardError:we,itemBorderImageCard:q}}=n.value;return{"--n-bezier":m,"--n-border-radius":ce,"--n-dragger-border":T,"--n-dragger-border-hover":W,"--n-dragger-color":M,"--n-font-size":be,"--n-item-color-hover":P,"--n-item-color-hover-error":A,"--n-item-disabled-opacity":oe,"--n-item-icon-color":G,"--n-item-text-color":Y,"--n-item-text-color-error":_,"--n-item-text-color-success":F,"--n-line-height":me,"--n-item-border-image-card-error":we,"--n-item-border-image-card":q}}),k=r?Te("upload",void 0,C,e):void 0;ze(se,{mergedClsPrefixRef:o,mergedThemeRef:n,showCancelButtonRef:N(e,"showCancelButton"),showDownloadButtonRef:N(e,"showDownloadButton"),showRemoveButtonRef:N(e,"showRemoveButton"),showRetryButtonRef:N(e,"showRetryButton"),onRemoveRef:N(e,"onRemove"),onDownloadRef:N(e,"onDownload"),mergedFileListRef:g,triggerStyleRef:N(e,"triggerStyle"),shouldUseThumbnailUrlRef:N(e,"shouldUseThumbnailUrl"),renderIconRef:N(e,"renderIcon"),xhrMap:f,submit:S,doChange:D,showPreviewButtonRef:N(e,"showPreviewButton"),onPreviewRef:N(e,"onPreview"),getFileThumbnailUrlResolver:b,listTypeRef:N(e,"listType"),dragOverRef:l,openOpenFileDialog:R,draggerInsideRef:a,handleFileAddition:$,mergedDisabledRef:i.mergedDisabledRef,maxReachedRef:d,fileListStyleRef:N(e,"fileListStyle"),abstractRef:N(e,"abstract"),acceptRef:N(e,"accept"),cssVarsRef:r?void 0:C,themeClassRef:k==null?void 0:k.themeClass,onRender:k==null?void 0:k.onRender,showTriggerRef:N(e,"showTrigger"),imageGroupPropsRef:N(e,"imageGroupProps"),mergedDirectoryDndRef:O(()=>{var m;return(m=e.directoryDnd)!==null&&m!==void 0?m:e.directory})});const j={clear:()=>{u.value=[]},submit:S,openOpenFileDialog:R};return Object.assign({mergedClsPrefix:o,draggerInsideRef:a,inputElRef:s,mergedTheme:n,dragOver:l,mergedMultiple:E,cssVars:r?void 0:C,themeClass:k==null?void 0:k.themeClass,onRender:k==null?void 0:k.onRender,handleFileInputChange:y},j)},render(){var e,o;const{draggerInsideRef:r,mergedClsPrefix:n,$slots:i,directory:d,onRender:u}=this;if(i.default&&!this.abstract){const s=i.default()[0];!((e=s==null?void 0:s.type)===null||e===void 0)&&e[wt]&&(r.value=!0)}const c=t("input",Object.assign({},this.inputProps,{ref:"inputElRef",type:"file",class:`${n}-upload-file-input`,accept:this.accept,multiple:this.mergedMultiple,onChange:this.handleFileInputChange,webkitdirectory:d||void 0,directory:d||void 0}));return this.abstract?t(ke,null,(o=i.default)===null||o===void 0?void 0:o.call(i),t(Jt,{to:"body"},c)):(u==null||u(),t("div",{class:[`${n}-upload`,r.value&&`${n}-upload--dragger-inside`,this.dragOver&&`${n}-upload--drag-over`,this.themeClass],style:this.cssVars},c,this.showTrigger&&this.listType!=="image-card"&&t(Rt,null,i),this.showFileList&&t(jo,null,i)))}});export{mo as _,Ko as a,ko as b};