import{dt as et,cf as te,aj as n,d as Q,du as tt,a$ as Dt,dv as Mt,b4 as Ft,bI as _e,bb as ve,bp as D,b5 as b,dw as Ee,c2 as Et,bJ as jt,b6 as M,a3 as he,dx as $t,c8 as je,dy as At,U as ye,dz as Ht,bc as k,r as A,b9 as Nt,q as Vt,dA as Re,dB as ue,cz as ot,bK as ne,a as $,b8 as pe,be as nt,bU as Zt,v as Wt,a7 as Xt,cB as qt,dC as Se,bT as Be,dD as Yt,cp as rt,i as $e,cu as Pe,bq as N,dE as Ae,bv as K,dF as Gt,cq as me,cF as it,dG as He,B as le,dH as Jt,dI as Kt,bO as Qt,cw as eo,b7 as to,T as oo,dJ as no,ba as ro,bd as io,an as ao,bf as Ne,aR as at,b as lt,o as ze,e as st,c as lo,w as Le,f as Ve,g as so,t as uo,h as co,$ as ge,aP as fo,K as Ze,dK as ho}from"./index-mUIrqFZO.js";import{_ as go}from"./Progress-BXAFNvSO.js";import{i as dt}from"./Grid-BaTVMcBE.js";function vo(e,t,o,r){for(var l=-1,i=e==null?0:e.length;++ln("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},n("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},n("g",{fill:"currentColor","fill-rule":"nonzero"},n("path",{d:"M3.25735931,8.70710678 L7.85355339,4.1109127 C8.82986412,3.13460197 10.4127766,3.13460197 11.3890873,4.1109127 C12.365398,5.08722343 12.365398,6.67013588 11.3890873,7.64644661 L6.08578644,12.9497475 C5.69526215,13.3402718 5.06209717,13.3402718 4.67157288,12.9497475 C4.28104858,12.5592232 4.28104858,11.9260582 4.67157288,11.5355339 L9.97487373,6.23223305 C10.1701359,6.0369709 10.1701359,5.72038841 9.97487373,5.52512627 C9.77961159,5.32986412 9.4630291,5.32986412 9.26776695,5.52512627 L3.96446609,10.8284271 C3.18341751,11.6094757 3.18341751,12.8758057 3.96446609,13.6568542 C4.74551468,14.4379028 6.01184464,14.4379028 6.79289322,13.6568542 L12.0961941,8.35355339 C13.4630291,6.98671837 13.4630291,4.77064094 12.0961941,3.40380592 C10.7293591,2.0369709 8.51328163,2.0369709 7.14644661,3.40380592 L2.55025253,8 C2.35499039,8.19526215 2.35499039,8.51184464 2.55025253,8.70710678 C2.74551468,8.90236893 3.06209717,8.90236893 3.25735931,8.70710678 Z"}))))),ln=te("cancel",()=>n("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},n("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},n("g",{fill:"currentColor","fill-rule":"nonzero"},n("path",{d:"M2.58859116,2.7156945 L2.64644661,2.64644661 C2.82001296,2.47288026 3.08943736,2.45359511 3.2843055,2.58859116 L3.35355339,2.64644661 L8,7.293 L12.6464466,2.64644661 C12.8417088,2.45118446 13.1582912,2.45118446 13.3535534,2.64644661 C13.5488155,2.84170876 13.5488155,3.15829124 13.3535534,3.35355339 L8.707,8 L13.3535534,12.6464466 C13.5271197,12.820013 13.5464049,13.0894374 13.4114088,13.2843055 L13.3535534,13.3535534 C13.179987,13.5271197 12.9105626,13.5464049 12.7156945,13.4114088 L12.6464466,13.3535534 L8,8.707 L3.35355339,13.3535534 C3.15829124,13.5488155 2.84170876,13.5488155 2.64644661,13.3535534 C2.45118446,13.1582912 2.45118446,12.8417088 2.64644661,12.6464466 L7.293,8 L2.64644661,3.35355339 C2.47288026,3.17998704 2.45359511,2.91056264 2.58859116,2.7156945 L2.64644661,2.64644661 L2.58859116,2.7156945 Z"}))))),Rt=te("download",()=>n("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},n("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},n("g",{fill:"currentColor","fill-rule":"nonzero"},n("path",{d:"M3.5,13 L12.5,13 C12.7761424,13 13,13.2238576 13,13.5 C13,13.7454599 12.8231248,13.9496084 12.5898756,13.9919443 L12.5,14 L3.5,14 C3.22385763,14 3,13.7761424 3,13.5 C3,13.2545401 3.17687516,13.0503916 3.41012437,13.0080557 L3.5,13 L12.5,13 L3.5,13 Z M7.91012437,1.00805567 L8,1 C8.24545989,1 8.44960837,1.17687516 8.49194433,1.41012437 L8.5,1.5 L8.5,10.292 L11.1819805,7.6109127 C11.3555469,7.43734635 11.6249713,7.4180612 11.8198394,7.55305725 L11.8890873,7.6109127 C12.0626536,7.78447906 12.0819388,8.05390346 11.9469427,8.2487716 L11.8890873,8.31801948 L8.35355339,11.8535534 C8.17998704,12.0271197 7.91056264,12.0464049 7.7156945,11.9114088 L7.64644661,11.8535534 L4.1109127,8.31801948 C3.91565056,8.12275734 3.91565056,7.80617485 4.1109127,7.6109127 C4.28447906,7.43734635 4.55390346,7.4180612 4.7487716,7.55305725 L4.81801948,7.6109127 L7.5,10.292 L7.5,1.5 C7.5,1.25454011 7.67687516,1.05039163 7.91012437,1.00805567 L8,1 L7.91012437,1.00805567 Z"}))))),sn=Q({name:"ResizeSmall",render(){return n("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},n("g",{fill:"none"},n("path",{d:"M5.5 4A1.5 1.5 0 0 0 4 5.5v1a.5.5 0 0 1-1 0v-1A2.5 2.5 0 0 1 5.5 3h1a.5.5 0 0 1 0 1h-1zM16 5.5A1.5 1.5 0 0 0 14.5 4h-1a.5.5 0 0 1 0-1h1A2.5 2.5 0 0 1 17 5.5v1a.5.5 0 0 1-1 0v-1zm0 9a1.5 1.5 0 0 1-1.5 1.5h-1a.5.5 0 0 0 0 1h1a2.5 2.5 0 0 0 2.5-2.5v-1a.5.5 0 0 0-1 0v1zm-12 0A1.5 1.5 0 0 0 5.5 16h1.25a.5.5 0 0 1 0 1H5.5A2.5 2.5 0 0 1 3 14.5v-1.25a.5.5 0 0 1 1 0v1.25zM8.5 7A1.5 1.5 0 0 0 7 8.5v3A1.5 1.5 0 0 0 8.5 13h3a1.5 1.5 0 0 0 1.5-1.5v-3A1.5 1.5 0 0 0 11.5 7h-3zM8 8.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-3z",fill:"currentColor"})))}}),dn=te("retry",()=>n("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},n("path",{d:"M320,146s24.36-12-64-12A160,160,0,1,0,416,294",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-miterlimit: 10; stroke-width: 32px;"}),n("polyline",{points:"256 58 336 138 256 218",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),un=te("rotateClockwise",()=>n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 12.7916 15.3658 15.2026 13 16.3265V14.5C13 14.2239 12.7761 14 12.5 14C12.2239 14 12 14.2239 12 14.5V17.5C12 17.7761 12.2239 18 12.5 18H15.5C15.7761 18 16 17.7761 16 17.5C16 17.2239 15.7761 17 15.5 17H13.8758C16.3346 15.6357 18 13.0128 18 10C18 5.58172 14.4183 2 10 2C5.58172 2 2 5.58172 2 10C2 10.2761 2.22386 10.5 2.5 10.5C2.77614 10.5 3 10.2761 3 10Z",fill:"currentColor"}),n("path",{d:"M10 12C11.1046 12 12 11.1046 12 10C12 8.89543 11.1046 8 10 8C8.89543 8 8 8.89543 8 10C8 11.1046 8.89543 12 10 12ZM10 11C9.44772 11 9 10.5523 9 10C9 9.44772 9.44772 9 10 9C10.5523 9 11 9.44772 11 10C11 10.5523 10.5523 11 10 11Z",fill:"currentColor"}))),cn=te("rotateClockwise",()=>n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M17 10C17 6.13401 13.866 3 10 3C6.13401 3 3 6.13401 3 10C3 12.7916 4.63419 15.2026 7 16.3265V14.5C7 14.2239 7.22386 14 7.5 14C7.77614 14 8 14.2239 8 14.5V17.5C8 17.7761 7.77614 18 7.5 18H4.5C4.22386 18 4 17.7761 4 17.5C4 17.2239 4.22386 17 4.5 17H6.12422C3.66539 15.6357 2 13.0128 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10C18 10.2761 17.7761 10.5 17.5 10.5C17.2239 10.5 17 10.2761 17 10Z",fill:"currentColor"}),n("path",{d:"M10 12C8.89543 12 8 11.1046 8 10C8 8.89543 8.89543 8 10 8C11.1046 8 12 8.89543 12 10C12 11.1046 11.1046 12 10 12ZM10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}))),fn=te("trash",()=>n("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},n("path",{d:"M432,144,403.33,419.74A32,32,0,0,1,371.55,448H140.46a32,32,0,0,1-31.78-28.26L80,144",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),n("rect",{x:"32",y:"64",width:"448",height:"80",rx:"16",ry:"16",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),n("line",{x1:"312",y1:"240",x2:"200",y2:"352",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),n("line",{x1:"312",y1:"352",x2:"200",y2:"240",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),hn=te("zoomIn",()=>n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5Z",fill:"currentColor"}),n("path",{d:"M8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z",fill:"currentColor"}))),gn=te("zoomOut",()=>n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11Z",fill:"currentColor"}),n("path",{d:"M14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z",fill:"currentColor"}))),vn=tt&&"loading"in document.createElement("img");function pn(e={}){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})}}const Te=new WeakMap,Oe=new WeakMap,ke=new WeakMap,mn=(e,t,o)=>{if(!e)return()=>{};const r=pn(t),{root:l}=r.options;let i;const u=Te.get(l);u?i=u:(i=new Map,Te.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(h=>{h.forEach(w=>{if(w.isIntersecting){const R=Oe.get(w.target),x=ke.get(w.target);R&&R(),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),ke.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||Te.delete(l))};return Oe.set(e,s),ke.set(e,o),s};function wn(){return{toolbarIconColor:"rgba(255, 255, 255, .9)",toolbarColor:"rgba(0, 0, 0, .35)",toolbarBoxShadow:"none",toolbarBorderRadius:"24px"}}const bn=Dt({name:"Image",common:Ft,peers:{Tooltip:Mt},self:wn});function xn(){return 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"}))}function Cn(){return 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"}))}function yn(){return 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"}))}const Ue=Object.assign(Object.assign({},ve.props),{onPreviewPrev:Function,onPreviewNext:Function,showToolbar:{type:Boolean,default:!0},showToolbarTooltip:Boolean,renderToolbar:Function}),Lt=_e("n-image"),Rn=D([D("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); `,[Ee()]),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; `),Ee()]),b("image-preview-wrapper",` position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; pointer-events: none; `,[Et()]),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%; `,[jt("preview-disabled",` cursor: pointer; `),D("img",` border-radius: inherit; `)])]),ce=32,Tt=Q({name:"ImagePreview",props:Object.assign(Object.assign({},Ue),{onNext:Function,onPrev:Function,clsPrefix:{type:String,required:!0}}),setup(e){const t=ve("Image","-image",Rn,bn,e,k(e,"clsPrefix"));let o=null;const r=A(null),l=A(null),i=A(void 0),u=A(!1),c=A(!1),{localeRef:d}=Nt("Image");function a(){const{value:f}=l;if(!o||!f)return;const{style:m}=f,g=o.getBoundingClientRect(),S=g.left+g.width/2,P=g.top+g.height/2;m.transformOrigin=`${S}px ${P}px`}function s(f){var m,g;switch(f.key){case" ":f.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":De();break}}Vt(u,f=>{f?Re("keydown",document,s):ue("keydown",document,s)}),ot(()=>{ue("keydown",document,s)});let h=0,w=0,R=0,x=0,E=0,Z=0,j=0,F=0,Y=!1;function _(f){const{clientX:m,clientY:g}=f;R=m-h,x=g-w,qt(G)}function p(f){const{mouseUpClientX:m,mouseUpClientY:g,mouseDownClientX:S,mouseDownClientY:P}=f,V=S-m,q=P-g,J=`vertical${q>0?"Top":"Bottom"}`,oe=`horizontal${V>0?"Left":"Right"}`;return{moveVerticalDirection:J,moveHorizontalDirection:oe,deltaHorizontal:V,deltaVertical:q}}function y(f){const{value:m}=r;if(!m)return{offsetX:0,offsetY:0};const g=m.getBoundingClientRect(),{moveVerticalDirection:S,moveHorizontalDirection:P,deltaHorizontal:V,deltaVertical:q}=f||{};let J=0,oe=0;return g.width<=window.innerWidth?J=0:g.left>0?J=(g.width-window.innerWidth)/2:g.right0?oe=(g.height-window.innerHeight)/2:g.bottom.5){const f=T;L-=1,T=Math.max(.5,Math.pow(O,L));const m=f-T;G(!1);const g=y();T+=m,G(!1),T-=m,R=g.offsetX,x=g.offsetY,G()}}function Ce(){const f=i.value;f&&dt(f,void 0)}function G(f=!0){var m;const{value:g}=r;if(!g)return;const{style:S}=g,P=Wt((m=B==null?void 0:B.previewedImgPropsRef.value)===null||m===void 0?void 0:m.style);let V="";if(typeof P=="string")V=`${P};`;else for(const J in P)V+=`${rn(J)}: ${P[J]};`;const q=`transform-origin: center; transform: translateX(${R}px) translateY(${x}px) rotate(${z}deg) scale(${T});`;Y?S.cssText=`${V}cursor: grabbing; transition: none;${q}`:S.cssText=`${V}cursor: grab;${q}${f?"":"transition: none;"}`,f||g.offsetHeight}function De(){u.value=!u.value,c.value=!0}function Bt(){T=de(),L=Math.ceil(Math.log(T)/Math.log(O)),R=0,x=0,G()}const zt={setPreviewSrc:f=>{i.value=f},setThumbnailEl:f=>{o=f},toggleShow:De};function Ut(f,m){if(e.showToolbarTooltip){const{value:g}=t;return n(Xt,{to:!1,theme:g.peers.Tooltip,themeOverrides:g.peerOverrides.Tooltip,keepAliveOnHover:!1},{default:()=>d.value[m],trigger:()=>f})}else return f}const Me=$(()=>{const{common:{cubicBezierEaseInOut:f},self:{toolbarIconColor:m,toolbarBorderRadius:g,toolbarBoxShadow:S,toolbarColor:P}}=t.value;return{"--n-bezier":f,"--n-toolbar-icon-color":m,"--n-toolbar-color":P,"--n-toolbar-border-radius":g,"--n-toolbar-box-shadow":S}}),{inlineThemeDisabled:Fe}=pe(),re=Fe?nt("image-preview",void 0,Me,e):void 0;return Object.assign({previewRef:r,previewWrapperRef:l,previewSrc:i,show:u,appear:Zt(),displayed:c,previewedImgProps:B==null?void 0:B.previewedImgPropsRef,handleWheel(f){f.preventDefault()},handlePreviewMousedown:v,handlePreviewDblclick:H,syncTransformOrigin:a,handleAfterLeave:()=>{U(),z=0,c.value=!1},handleDragStart:f=>{var m,g;(g=(m=B==null?void 0:B.previewedImgPropsRef.value)===null||m===void 0?void 0:m.onDragstart)===null||g===void 0||g.call(m,f),f.preventDefault()},zoomIn:be,zoomOut:xe,handleDownloadClick:Ce,rotateCounterclockwise:W,rotateClockwise:ee,handleSwitchPrev:I,handleSwitchNext:X,withTooltip:Ut,resizeToOrignalImageSize:Bt,cssVars:Fe?void 0:Me,themeClass:re==null?void 0:re.themeClass,onRender:re==null?void 0:re.onRender},zt)},render(){var e,t;const{clsPrefix:o,renderToolbar:r,withTooltip:l}=this,i=l(n(M,{clsPrefix:o,onClick:this.handleSwitchPrev},{default:xn}),"tipPrevious"),u=l(n(M,{clsPrefix:o,onClick:this.handleSwitchNext},{default:Cn}),"tipNext"),c=l(n(M,{clsPrefix:o,onClick:this.rotateCounterclockwise},{default:()=>n(cn,null)}),"tipCounterclockwise"),d=l(n(M,{clsPrefix:o,onClick:this.rotateClockwise},{default:()=>n(un,null)}),"tipClockwise"),a=l(n(M,{clsPrefix:o,onClick:this.resizeToOrignalImageSize},{default:()=>n(sn,null)}),"tipOriginalSize"),s=l(n(M,{clsPrefix:o,onClick:this.zoomOut},{default:()=>n(gn,null)}),"tipZoomOut"),h=l(n(M,{clsPrefix:o,onClick:this.handleDownloadClick},{default:()=>n(Rt,null)}),"tipDownload"),w=l(n(M,{clsPrefix:o,onClick:this.toggleShow},{default:yn}),"tipClose"),R=l(n(M,{clsPrefix:o,onClick:this.zoomIn},{default:()=>n(hn,null)}),"tipZoomIn");return n(he,null,(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e),n($t,{show:this.show},{default:()=>{var x;return this.show||this.displayed?((x=this.onRender)===null||x===void 0||x.call(this),je(n("div",{class:[`${o}-image-preview-container`,this.themeClass],style:this.cssVars,onWheel:this.handleWheel},n(ye,{name:"fade-in-transition",appear:this.appear},{default:()=>this.show?n("div",{class:`${o}-image-preview-overlay`,onClick:this.toggleShow}):null}),this.showToolbar?n(ye,{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:R,download:h,close:w}}):n(he,null,this.onPrev?n(he,null,i,u):null,c,d,a,s,R,h,w)):null}):null,n(ye,{name:"fade-in-scale-up-transition",onAfterLeave:this.handleAfterLeave,appear:this.appear,onEnter:this.syncTransformOrigin,onBeforeLeave:this.syncTransformOrigin},{default:()=>{const{previewedImgProps:E={}}=this;return je(n("div",{class:`${o}-image-preview-wrapper`,ref:"previewWrapperRef"},n("img",Object.assign({},E,{draggable:!1,onMousedown:this.handlePreviewMousedown,onDblclick:this.handlePreviewDblclick,class:[`${o}-image-preview`,E.class],key:this.previewSrc,src:this.previewSrc,ref:"previewRef",onDragstart:this.handleDragStart}))),[[Ht,this.show]])}})),[[At,{enabled:this.show}]])):null}}))}}),Ot=_e("n-image-group"),Ln=Ue,Tn=Q({name:"ImageGroup",props:Ln,setup(e){let t;const{mergedClsPrefixRef:o}=pe(e),r=`c${Se()}`,l=Yt(),i=A(null),u=d=>{var a;t=d,(a=i.value)===null||a===void 0||a.setPreviewSrc(d)};function c(d){var a,s;if(!(l!=null&&l.proxy))return;const w=l.proxy.$el.parentElement.querySelectorAll(`[data-group-id=${r}]:not([data-error=true])`);if(!w.length)return;const R=Array.from(w).findIndex(x=>x.dataset.previewSrc===t);~R?u(w[(R+d+w.length)%w.length].dataset.previewSrc):u(w[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)}return Be(Ot,{mergedClsPrefixRef:o,setPreviewSrc:u,setThumbnailEl:d=>{var a;(a=i.value)===null||a===void 0||a.setThumbnailEl(d)},toggleShow:()=>{var d;(d=i.value)===null||d===void 0||d.toggleShow()},groupId:r,renderToolbarRef:k(e,"renderToolbar")}),{mergedClsPrefix:o,previewInstRef:i,next:()=>{c(1)},prev:()=>{c(-1)}}},render(){return n(Tt,{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)}}),On=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},Ue),kn=Q({name:"Image",props:On,slots:Object,inheritAttrs:!1,setup(e){const t=A(null),o=A(!1),r=A(null),l=ne(Ot,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=A(!e.lazy);$e(()=>{var a;(a=t.value)===null||a===void 0||a.setAttribute("data-group-id",(l==null?void 0:l.groupId)||"")}),$e(()=>{if(e.lazy&&e.intersectionObserverOptions){let a;const s=Pe(()=>{a==null||a(),a=void 0,a=mn(t.value,e.intersectionObserverOptions,c)});ot(()=>{s(),a==null||a()})}}),Pe(()=>{var a;e.src||((a=e.imgProps)===null||a===void 0||a.src),o.value=!1});const d=A(!1);return Be(Lt,{previewedImgPropsRef:k(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,h;u.click(),(h=(s=e.imgProps)===null||s===void 0?void 0:s.onClick)===null||h===void 0||h.call(s,a)},mergedOnError:a=>{if(!c.value)return;o.value=!0;const{onError:s,imgProps:{onError:h}={}}=e;s==null||s(a),h==null||h(a)},mergedOnLoad:a=>{const{onLoad:s,imgProps:{onLoad:h}={}}=e;s==null||s(a),h==null||h(a),d.value=!0}},u)},render(){var e,t;const{mergedClsPrefix:o,imgProps:r={},loaded:l,$attrs:i,lazy:u}=this,c=rt(this.$slots.error,()=>[]),d=(t=(e=this.$slots).placeholder)===null||t===void 0?void 0:t.call(e),a=this.src||r.src,s=this.showError&&c.length?c: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?a:void 0:a,alt:this.alt||r.alt,"aria-label":this.alt||r.alt,onClick:this.mergedOnClick,onError:this.mergedOnError,onLoad:this.mergedOnLoad,loading:vn&&u&&!this.intersectionObserverOptions?"lazy":"eager",style:[r.style||"",d&&!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?s:n(Tt,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:o,ref:"previewInstRef",showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip,renderToolbar:this.renderToolbar},{default:()=>s}),!l&&d)}}),ae=_e("n-upload"),Sn=D([b("upload","width: 100%;",[N("dragger-inside",[b("upload-trigger",` display: block; `)]),N("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); `,[D("&:hover",` border: var(--n-dragger-border-hover); `),N("disabled",` cursor: not-allowed; `)]),b("upload-trigger",` display: inline-block; box-sizing: border-box; opacity: 1; transition: opacity .3s var(--n-bezier); `,[D("+",[b("upload-file-list","margin-top: 8px;")]),N("disabled",` opacity: var(--n-item-disabled-opacity); cursor: not-allowed; `),N("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); `,[D("a, img","outline: none;"),N("disabled",` opacity: var(--n-item-disabled-opacity); cursor: not-allowed; `,[b("upload-file","cursor: not-allowed;")]),N("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); `,[Ae(),b("progress",[Ae({foldPadding:!0})]),D("&:hover",` background-color: var(--n-item-color-hover); `,[b("upload-file-info",[K("action",` opacity: 1; `)])]),N("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; `),K("name",` padding: 0 8px; `),K("thumbnail",` width: 32px; height: 32px; font-size: 28px; display: flex; justify-content: center; align-items: center; `,[D("img",` width: 100%; `)])])]),N("text-type",[b("progress",` box-sizing: border-box; padding-bottom: 6px; margin-bottom: 6px; `)]),N("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%; `,[K("thumbnail",` width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 36px; `,[D("img",` width: 100%; `)])]),D("&::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: ""; `),D("&:hover",[D("&::before","opacity: 1;"),b("upload-file-info",[K("thumbnail","opacity: .12;")])])]),N("error-status",[D("&:hover",` background-color: var(--n-item-color-hover-error); `),b("upload-file-info",[K("name","color: var(--n-item-text-color-error);"),K("thumbnail","color: var(--n-item-text-color-error);")]),N("image-card-type",` border: var(--n-item-border-image-card-error); `)]),N("with-url",` cursor: pointer; `,[b("upload-file-info",[K("name",` color: var(--n-item-text-color-success); text-decoration-color: var(--n-item-text-color-success); `,[D("a",` text-decoration: underline; `)])])]),b("upload-file-info",` position: relative; padding-top: 6px; padding-bottom: 6px; display: flex; flex-wrap: nowrap; `,[K("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); `)]),K("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",[D("&:not(:last-child)",{marginRight:"4px"}),b("base-icon",[D("svg",[Gt()])])]),N("image-type",` position: relative; max-width: 80px; width: auto; `),N("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; `)]),K("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); `,[D("a",` color: inherit; text-decoration: underline; `)])])])]),b("upload-file-input",` display: none; width: 0; height: 0; opacity: 0; `)]),kt="__UPLOAD_DRAGGER__",Pn=Q({name:"UploadDragger",[kt]:!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)}}}),In=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"}))),_n=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"}))),Bn=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(it,null,{default:()=>this.show?n(go,{type:"line",showIndicator:!1,percentage:this.percentage,status:this.status,height:2,theme:this.mergedTheme.peers.Progress,themeOverrides:this.mergedTheme.peerOverrides.Progress}):null})}});var Ie=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(h){u(h)}}function d(s){try{a(r.throw(s))}catch(h){u(h)}}function a(s){s.done?i(s.value):l(s.value).then(c,d)}a((r=r.apply(e,t||[])).next())})};function St(e){return e.includes("image/")}function Ge(e=""){const t=e.split("/"),r=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(r)||[""])[0]}const Je=/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i,Pt=e=>{if(e.type)return St(e.type);const t=Ge(e.name||"");if(Je.test(t))return!0;const o=e.thumbnailUrl||e.url||"",r=Ge(o);return!!(/^data:image\//.test(o)||Je.test(r))};function zn(e){return Ie(this,void 0,void 0,function*(){return yield new Promise(t=>{if(!e.type||!St(e.type)){t("");return}t(window.URL.createObjectURL(e))})})}const Un=tt&&window.FileReader&&window.File;function Dn(e){return e.isDirectory}function Mn(e){return e.isFile}function Fn(e,t){return Ie(this,void 0,void 0,function*(){const o=[];function r(l){return Ie(this,void 0,void 0,function*(){for(const i of l)if(i){if(t&&Dn(i)){const u=i.createReader();let c=[],d;try{do d=yield new Promise((a,s)=>{u.readEntries(a,s)}),c=c.concat(d);while(d.length>0)}catch(a){He("upload","error happens when handling directory upload",a)}yield r(c)}else if(Mn(i))try{const u=yield new Promise((c,d)=>{i.file(c,d)});o.push({file:u,entry:i,source:"dnd"})}catch(u){He("upload","error happens when handling file upload",u)}}})}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 En(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})}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(h){u(h)}}function d(s){try{a(r.throw(s))}catch(h){u(h)}}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"},jn=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=A(null),r=A(""),l=$(()=>{const{file:p}=e;return p.status==="finished"?"success":p.status==="error"?"error":"info"}),i=$(()=>{const{file:p}=e;if(p.status==="error")return"error"}),u=$(()=>{const{file:p}=e;return p.status==="uploading"}),c=$(()=>{if(!t.showCancelButtonRef.value)return!1;const{file:p}=e;return["uploading","pending","error"].includes(p.status)}),d=$(()=>{if(!t.showRemoveButtonRef.value)return!1;const{file:p}=e;return["finished"].includes(p.status)}),a=$(()=>{if(!t.showDownloadButtonRef.value)return!1;const{file:p}=e;return["finished"].includes(p.status)}),s=$(()=>{if(!t.showRetryButtonRef.value)return!1;const{file:p}=e;return["error"].includes(p.status)}),h=Qt(()=>r.value||e.file.thumbnailUrl||e.file.url),w=$(()=>{if(!t.showPreviewButtonRef.value)return!1;const{file:{status:p},listType:y}=e;return["finished"].includes(p)&&h.value&&y==="image-card"});function R(){return Ke(this,void 0,void 0,function*(){const p=t.onRetryRef.value;p&&(yield p({file:e.file}))===!1||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)?F(y):eo("upload","The button clicked type is unknown.")}function E(p){p.preventDefault(),j(e.file)}function Z(p){const{xhrMap:y,doChange:C,onRemoveRef:{value:B},mergedFileListRef:{value:v}}=t;Promise.resolve(B?B({file:Object.assign({},p),fileList:v,index:e.index}):!0).then(O=>{if(O===!1)return;const L=Object.assign({},p,{status:"removed"});y.delete(p.id),C(L,void 0,{remove:!0})})}function j(p){const{onDownloadRef:{value:y}}=t;Promise.resolve(y?y(Object.assign({},p)):!0).then(C=>{C!==!1&&dt(p.url,p.name)})}function F(p){const{xhrMap:y}=t,C=y.get(p.id);C==null||C.abort(),Z(Object.assign({},p))}function Y(p){const{onPreviewRef:{value:y}}=t;if(y)y(e.file,{event:p});else if(e.listType==="image-card"){const{value:C}=o;if(!C)return;C.click()}}const _=()=>Ke(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 Pe(()=>{_()}),{mergedTheme:t.mergedThemeRef,progressStatus:l,buttonType:i,showProgress:u,disabled:t.mergedDisabledRef,showCancelButton:c,showRemoveButton:d,showDownloadButton:a,showRetryButton:s,showPreviewButton:w,mergedThumbnailUrl:h,shouldUseThumbnailUrl:t.shouldUseThumbnailUrlRef,renderIcon:t.renderIconRef,imageRef:o,handleRemoveOrCancelClick:x,handleDownloadClick:E,handleRetryClick:R,handlePreviewClick:Y}},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):Pt(r)?n(M,{clsPrefix:e},{default:In}):n(M,{clsPrefix:e},{default:_n})):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(kn,{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(an,null)}));const d=n(Bn,{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(Jt,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(Kt,null,{default:()=>this.showRemoveButton?n(M,{clsPrefix:e,key:"trash"},{default:()=>n(fn,null)}):n(M,{clsPrefix:e,key:"cancel"},{default:()=>n(ln,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(dn,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(Rt,null)})}):null)),!u&&d)}}),It=Q({name:"UploadTrigger",props:{abstract:Boolean},slots:Object,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:h,triggerClassRef:w,triggerStyleRef:R}=o,x=$(()=>u.value==="image-card");function E(){l.value||i.value||d()}function Z(_){_.preventDefault(),c.value=!0}function j(_){_.preventDefault(),c.value=!0}function F(_){_.preventDefault(),c.value=!1}function Y(_){var p;if(_.preventDefault(),!a.value||l.value||i.value){c.value=!1;return}const y=(p=_.dataTransfer)===null||p===void 0?void 0:p.items;y!=null&&y.length?Fn(Array.from(y).map(C=>C.webkitGetAsEntry()),h.value).then(C=>{s(C)}).finally(()=>{c.value=!1}):c.value=!1}return()=>{var _;const{value:p}=r;return e.abstract?(_=t.default)===null||_===void 0?void 0:_.call(t,{handleClick:E,handleDrop:Y,handleDragOver:Z,handleDragEnter:j,handleDragLeave:F}):n("div",{class:[`${p}-upload-trigger`,(l.value||i.value)&&`${p}-upload-trigger--disabled`,x.value&&`${p}-upload-trigger--image-card`,w.value],style:R.value,onClick:E,onDrop:Y,onDragover:Z,onDragenter:j,onDragleave:F},x.value?n(Pn,null,{default:()=>rt(t.default,()=>[n(M,{clsPrefix:p},{default:()=>n(to,null)})])}):t)}}}),$n=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:h,showTriggerRef:w,imageGroupPropsRef:R}=o,x=$(()=>i.value==="image-card"),E=()=>u.value.map((j,F)=>n(jn,{clsPrefix:l.value,key:j.id,file:j,index:F,listType:i.value})),Z=()=>x.value?n(Tn,Object.assign({},R.value),{default:E}):n(it,{group:!0},{default:E});return()=>{const{value:j}=l,{value:F}=r;return n("div",{class:[`${j}-upload-file-list`,x.value&&`${j}-upload-file-list--grid`,F?s==null?void 0:s.value:void 0,c.value],style:[F&&a?a.value:"",d.value]},Z(),w.value&&!h.value&&x.value&&n(It,null,t))}}});var Qe=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(h){u(h)}}function d(s){try{a(r.throw(s))}catch(h){u(h)}}function a(s){s.done?i(s.value):l(s.value).then(c,d)}a((r=r.apply(e,t||[])).next())})};function An(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 Hn(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 h=Object.assign({},o,{status:"uploading"}),w=s.percent;h.percentage=w,a=w,d(h)},onFinish(){var s;let h=Object.assign({},o,{status:"finished",percentage:a});h=se(((s=t.onFinish)===null||s===void 0?void 0:s.call(t,{file:h}))||h),d(h)},onError(){var s;let h=Object.assign({},o,{status:"error",percentage:a});h=se(((s=t.onError)===null||s===void 0?void 0:s.call(t,{file:h}))||h),d(h)}})}function Nn(e,t,o){const r=An(e,t,o);o.onabort=r.handleXHRAbort,o.onerror=r.handleXHRError,o.onload=r.handleXHRLoad,o.upload&&(o.upload.onprogress=r.handleXHRProgress)}function _t(e,t){return typeof e=="function"?e({file:t}):e||{}}function Vn(e,t,o){const r=_t(t,o);r&&Object.keys(r).forEach(l=>{e.setRequestHeader(l,r[l])})}function Zn(e,t,o){const r=_t(t,o);r&&Object.keys(r).forEach(l=>{e.append(l,r[l])})}function Wn(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(Zn(s,d,o),o.file!==null&&s.append(t,o.file),Nn(e,o,a),l!==void 0){a.open(r.toUpperCase(),l),Vn(a,c,o),a.send(s);const h=Object.assign({},o,{status:"uploading"});e.doChange(h)}}const Xn=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,onRetry: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=>Un?Pt(e):!1},createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object,triggerClass:String,triggerStyle:[String,Object],renderIcon:Function}),qn=Q({name:"Upload",props:Xn,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",Sn,no,e,t),l=ro(e),i=A(e.defaultFileList),u=k(e,"fileList"),c=A(null),d={value:!1},a=A(!1),s=new Map,h=io(u,i),w=$(()=>h.value.map(se)),R=$(()=>{const{max:v}=e;return v!==void 0?w.value.length>=v:!1});function x(){var v;(v=c.value)===null||v===void 0||v.click()}function E(v){const O=v.target;Y(O.files?Array.from(O.files).map(L=>({file:L,entry:null,source:"input"})):null,v),O.value=""}function Z(v){const{"onUpdate:fileList":O,onUpdateFileList:L}=e;O&&Ne(O,v),L&&Ne(L,v),i.value=v}const j=$(()=>e.multiple||e.directory),F=(v,O,L={append:!1,remove:!1})=>{const{append:T,remove:z}=L,H=Array.from(w.value),U=H.findIndex(I=>I.id===v.id);if(T||z||~U){T?H.push(v):z?H.splice(U,1):H.splice(U,1,v);const{onChange:I}=e;I&&I({file:v,fileList:H,event:O}),Z(H)}};function Y(v,O){if(!v||v.length===0)return;const{onBeforeUpload:L}=e;v=j.value?v:[v[0]];const{max:T,accept:z}=e;v=v.filter(({file:U,source:I})=>I==="dnd"&&(z!=null&&z.trim())?En(U.name,U.type,z):!0),T&&(v=v.slice(0,T-w.value.length));const H=Se();Promise.all(v.map(U=>Qe(this,[U],void 0,function*({file:I,entry:X}){var W;const ee={id:Se(),batchId:H,name:I.name,status:"pending",percentage:0,file:I,url:null,type:I.type,thumbnailUrl:null,fullPath:(W=X==null?void 0:X.fullPath)!==null&&W!==void 0?W:`/${I.webkitRelativePath||I.name}`};return!L||(yield L({file:ee,fileList:w.value}))!==!1?ee:null}))).then(U=>Qe(this,void 0,void 0,function*(){let I=Promise.resolve();U.forEach(X=>{I=I.then(ao).then(()=>{X&&F(X,O,{append:!0})})}),yield I})).then(()=>{e.defaultUpload&&_()})}function _(v){const{method:O,action:L,withCredentials:T,headers:z,data:H,name:U}=e,I=v!==void 0?w.value.filter(W=>W.id===v):w.value,X=v!==void 0;I.forEach(W=>{const{status:ee}=W;(ee==="pending"||ee==="error"&&X)&&(e.customRequest?Hn({inst:{doChange:F,xhrMap:s,onFinish:e.onFinish,onError:e.onError},file:W,action:L,withCredentials:T,headers:z,data:H,customRequest:e.customRequest}):Wn({doChange:F,xhrMap:s,onFinish:e.onFinish,onError:e.onError,isErrorState:e.isErrorState},U,W,{method:O,action:L,withCredentials:T,responseType:e.responseType,headers:z,data:H}))})}function p(v){var O;if(v.thumbnailUrl)return v.thumbnailUrl;const{createThumbnailUrl:L}=e;return L?(O=L(v.file,v))!==null&&O!==void 0?O:v.url||"":v.url?v.url:v.file?zn(v.file):""}const y=$(()=>{const{common:{cubicBezierEaseInOut:v},self:{draggerColor:O,draggerBorder:L,draggerBorderHover:T,itemColorHover:z,itemColorHoverError:H,itemTextColorError:U,itemTextColorSuccess:I,itemTextColor:X,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":L,"--n-dragger-border-hover":T,"--n-dragger-color":O,"--n-font-size":be,"--n-item-color-hover":z,"--n-item-color-hover-error":H,"--n-item-disabled-opacity":ee,"--n-item-icon-color":W,"--n-item-text-color":X,"--n-item-text-color-error":U,"--n-item-text-color-success":I,"--n-line-height":we,"--n-item-border-image-card-error":xe,"--n-item-border-image-card":Ce}}),C=o?nt("upload",void 0,y,e):void 0;Be(ae,{mergedClsPrefixRef:t,mergedThemeRef:r,showCancelButtonRef:k(e,"showCancelButton"),showDownloadButtonRef:k(e,"showDownloadButton"),showRemoveButtonRef:k(e,"showRemoveButton"),showRetryButtonRef:k(e,"showRetryButton"),onRemoveRef:k(e,"onRemove"),onDownloadRef:k(e,"onDownload"),mergedFileListRef:w,triggerClassRef:k(e,"triggerClass"),triggerStyleRef:k(e,"triggerStyle"),shouldUseThumbnailUrlRef:k(e,"shouldUseThumbnailUrl"),renderIconRef:k(e,"renderIcon"),xhrMap:s,submit:_,doChange:F,showPreviewButtonRef:k(e,"showPreviewButton"),onPreviewRef:k(e,"onPreview"),getFileThumbnailUrlResolver:p,listTypeRef:k(e,"listType"),dragOverRef:a,openOpenFileDialog:x,draggerInsideRef:d,handleFileAddition:Y,mergedDisabledRef:l.mergedDisabledRef,maxReachedRef:R,fileListClassRef:k(e,"fileListClass"),fileListStyleRef:k(e,"fileListStyle"),abstractRef:k(e,"abstract"),acceptRef:k(e,"accept"),cssVarsRef:o?void 0:y,themeClassRef:C==null?void 0:C.themeClass,onRender:C==null?void 0:C.onRender,showTriggerRef:k(e,"showTrigger"),imageGroupPropsRef:k(e,"imageGroupProps"),mergedDirectoryDndRef:$(()=>{var v;return(v=e.directoryDnd)!==null&&v!==void 0?v:e.directory}),onRetryRef:k(e,"onRetry")});const B={clear:()=>{i.value=[]},submit:_,openOpenFileDialog:x};return Object.assign({mergedClsPrefix:t,draggerInsideRef:d,inputElRef:c,mergedTheme:r,dragOver:a,mergedMultiple:j,cssVars:o?void 0:y,themeClass:C==null?void 0:C.themeClass,onRender:C==null?void 0:C.onRender,handleFileInputChange:E},B)},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[kt]&&(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(It,null,l),this.showFileList&&n($n,null,l)))}}),Yn={class:"inline-block",viewBox:"0 0 16 16",width:"1em",height:"1em"};function Gn(e,t){return ze(),lt("svg",Yn,t[0]||(t[0]=[st("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)]))}const sr=at({name:"pajamas-export",render:Gn}),Jn={class:"inline-block",viewBox:"0 0 16 16",width:"1em",height:"1em"};function Kn(e,t){return ze(),lt("svg",Jn,t[0]||(t[0]=[st("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)]))}const Qn=at({name:"pajamas-import",render:Kn}),dr=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:h,onProgress:w})=>{const R=new FormData;u&&Object.keys(u).forEach(x=>{R.append(x,u[x])}),R.append("file",i.file),fo({url:a,method:"post",data:R,withCredentials:d,headers:c,onUploadProgress:({progress:x})=>{w({percent:Math.ceil(x)})}}).then(()=>{s(),o("refresh")}).catch(()=>h())};return(i,u)=>{const c=Qn,d=le,a=qn;return ze(),lo(a,{action:i.action,accept:i.accept,"custom-request":l,"show-file-list":!1,onBeforeUpload:r},{default:Le(()=>[Ve(d,{size:"small",ghost:"",type:"primary"},{icon:Le(()=>[Ve(c,{class:"text-icon"})]),default:Le(()=>[so(" "+uo(co(ge)("common.import")),1)]),_:1})]),_:1},8,["action","accept"])}}}),er={VITE_SERVICE_BASE_URL:"/snail-job"},tr=!1,{baseURL:or}=ho(er,tr);function nr(e,t,o=!0){var r,l;try{let i=t;o&&(i=`${t}-${new Date().getTime()}.json`),rr(e,i)}catch{(r=window.$message)==null||r.error(ge("common.downloadFail"))}finally{(l=window.$loading)==null||l.endLoading()}}function rr(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 ur=(e,t,o)=>{var i;(i=window.$loading)==null||i.startLoading();const r=Ze.get("token"),l=Ze.get("namespaceId");fetch(`${or}${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=>nr(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{dr as _,sr as a,ur as d};