import{dm as ge,aW as _,m as l,C as $,Q as we,D as me,bS as et,bY as tt,bZ as ot,dn as nt,L as W,J as k,cd as ie,aO as it,O as rt,U as pe,f as I,E as at,aa as F,ad as A,aD as xe,G as be,H as lt,P as Y,a4 as st,ba as ut,ch as ct,be as re,cg as dt,aQ as V,F as ae,ac as P,bf as ft,dp as ht,az as vt,aN as gt,ai as wt,a0 as Ce,Y as mt,e as le,Z as se,dq as pt,dr as xt}from"./index.0b7ff98e.js";import{u as bt}from"./Suffix.f7c5b709.js";function Ct(e,a,t,c){var r=-1,f=e==null?0:e.length;for(c&&f&&(t=e[++r]);++re.includes("image/"),he=(e="")=>{const a=e.split("/"),c=a[a.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(c)||[""])[0]},ve=/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i,To=e=>{if(e.type)return _e(e.type);const a=he(e.name||"");if(ve.test(a))return!0;const t=e.thumbnailUrl||e.url||"",c=he(t);return!!(/^data:image\//.test(t)||ve.test(c))};function Do(e){return He(this,void 0,void 0,function*(){return yield new Promise(a=>{if(!e.type||!_e(e.type)){a("");return}a(window.URL.createObjectURL(e))})})}const Ao=et&&window.FileReader&&window.File;function xo(e){return e.isDirectory}function bo(e){return e.isFile}function Ho(e,a){return He(this,void 0,void 0,function*(){const t=[];let c,r=0;function f(){r++}function h(){r--,r||c(t)}function v(d){d.forEach(n=>{if(!!n){if(f(),a&&xo(n)){const u=n.createReader();f(),u.readEntries(m=>{v(m),h()},()=>{h()})}else bo(n)&&(f(),n.file(u=>{t.push({file:u,entry:n,source:"dnd"}),h()},()=>{h()}));h()}})}return yield new Promise(d=>{c=d,v(e)}),t})}function _o(e){const{id:a,name:t,percentage:c,status:r,url:f,file:h,thumbnailUrl:v,type:d,fullPath:n,batchId:u}=e;return{id:a,name:t,percentage:c!=null?c:null,status:r,url:f!=null?f:null,file:h!=null?h:null,thumbnailUrl:v!=null?v:null,type:d!=null?d:null,fullPath:n!=null?n:null,batchId:u!=null?u:null}}function $o(e,a,t){return e=e.toLowerCase(),a=a.toLocaleLowerCase(),t=t.toLocaleLowerCase(),t.split(",").map(r=>r.trim()).filter(Boolean).some(r=>{if(r.startsWith(".")){if(e.endsWith(r))return!0}else if(r.includes("/")){const[f,h]=a.split("/"),[v,d]=r.split("/");if((v==="*"||f&&v&&v===f)&&(d==="*"||h&&d&&d===h))return!0}else return!0;return!1})}const Co=(e,a)=>{if(!e)return;const t=document.createElement("a");t.href=e,a!==void 0&&(t.download=a),document.body.appendChild(t),t.click(),document.body.removeChild(t)};function So(){return{toolbarIconColor:"rgba(255, 255, 255, .9)",toolbarColor:"rgba(0, 0, 0, .35)",toolbarBoxShadow:"none",toolbarBorderRadius:"24px"}}const Oo=tt({name:"Image",common:ot,peers:{Tooltip:nt},self:So}),Io=l("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l("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"})),Lo=l("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l("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"})),Ro=l("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l("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"})),yo=l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 1024 1024"},l("path",{fill:"currentColor",d:"M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}));var Po=W([W("body >",[k("image-container","position: fixed;")]),k("image-preview-container",` position: fixed; left: 0; right: 0; top: 0; bottom: 0; display: flex; `),k("image-preview-overlay",` z-index: -1; position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: rgba(0, 0, 0, .3); `,[ie()]),k("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; `,[k("base-icon",` padding: 0 8px; font-size: 28px; cursor: pointer; `),ie()]),k("image-preview-wrapper",` position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; pointer-events: none; `,[it()]),k("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); `),k("image",` display: inline-flex; max-height: 100%; max-width: 100%; `,[rt("preview-disabled",` cursor: pointer; `),W("img",` border-radius: inherit; `)])]);const H=32;var $e=$({name:"ImagePreview",props:Object.assign(Object.assign({},X),{onNext:Function,onPrev:Function,clsPrefix:{type:String,required:!0}}),setup(e){const a=we("Image","-image",Po,Oo,e,pe(e,"clsPrefix"));let t=null;const c=I(null),r=I(null),f=I(void 0),h=I(!1),v=I(!1),{localeRef:d}=bt("Image");function n(){const{value:o}=r;if(!t||!o)return;const{style:s}=o,i=t.getBoundingClientRect(),g=i.left+i.width/2,w=i.top+i.height/2;s.transformOrigin=`${g}px ${w}px`}function u(o){var s,i;switch(o.key){case" ":o.preventDefault();break;case"ArrowLeft":(s=e.onPrev)===null||s===void 0||s.call(e);break;case"ArrowRight":(i=e.onNext)===null||i===void 0||i.call(e);break;case"Escape":te();break}}at(h,o=>{o?F("keydown",document,u):A("keydown",document,u)}),xe(()=>{A("keydown",document,u)});let m=0,R=0,L=0,y=0,Z=0,N=0,G=0,q=0,U=!1;function J(o){const{clientX:s,clientY:i}=o;L=s-m,y=i-R,gt(S)}function Ne(o){const{mouseUpClientX:s,mouseUpClientY:i,mouseDownClientX:g,mouseDownClientY:w}=o,b=g-s,C=w-i,O=`vertical${C>0?"Top":"Bottom"}`,M=`horizontal${b>0?"Left":"Right"}`;return{moveVerticalDirection:O,moveHorizontalDirection:M,deltaHorizontal:b,deltaVertical:C}}function K(o){const{value:s}=c;if(!s)return{offsetX:0,offsetY:0};const i=s.getBoundingClientRect(),{moveVerticalDirection:g,moveHorizontalDirection:w,deltaHorizontal:b,deltaVertical:C}=o||{};let O=0,M=0;return i.width<=window.innerWidth?O=0:i.left>0?O=(i.width-window.innerWidth)/2:i.right0?M=(i.height-window.innerHeight)/2:i.bottom.5){const o=x;z-=1,x=Math.max(.5,Math.pow(j,z));const s=o-x;S(!1);const i=K();x+=s,S(!1),x-=s,L=i.offsetX,y=i.offsetY,S()}}function qe(){const o=f.value;o&&Co(o,void 0)}function S(o=!0){var s;const{value:i}=c;if(!i)return;const{style:g}=i,w=ht((s=p==null?void 0:p.previewedImgPropsRef.value)===null||s===void 0?void 0:s.style);let b="";if(typeof w=="string")b=w+";";else for(const O in w)b+=`${ho(O)}: ${w[O]};`;const C=`transform-origin: center; transform: translateX(${L}px) translateY(${y}px) rotate(${E}deg) scale(${x});`;U?g.cssText=b+"cursor: grabbing; transition: none;"+C:g.cssText=b+"cursor: grab;"+C+(o?"":"transition: none;"),o||i.offsetHeight}function te(){h.value=!h.value,v.value=!0}function Je(){x=ee(),z=Math.ceil(Math.log(x)/Math.log(j)),L=0,y=0,S()}const Ke={setPreviewSrc:o=>{f.value=o},setThumbnailEl:o=>{t=o},toggleShow:te};function Qe(o,s){if(e.showToolbarTooltip){const{value:i}=a;return l(vt,{to:!1,theme:i.peers.Tooltip,themeOverrides:i.peerOverrides.Tooltip,keepAliveOnHover:!1},{default:()=>d.value[s],trigger:()=>o})}else return o}const oe=lt(()=>{const{common:{cubicBezierEaseInOut:o},self:{toolbarIconColor:s,toolbarBorderRadius:i,toolbarBoxShadow:g,toolbarColor:w}}=a.value;return{"--n-bezier":o,"--n-toolbar-icon-color":s,"--n-toolbar-color":w,"--n-toolbar-border-radius":i,"--n-toolbar-box-shadow":g}}),{inlineThemeDisabled:ne}=Y(),T=ne?st("image-preview",void 0,oe,e):void 0;return Object.assign({previewRef:c,previewWrapperRef:r,previewSrc:f,show:h,appear:ut(),displayed:v,previewedImgProps:p==null?void 0:p.previewedImgPropsRef,handleWheel(o){o.preventDefault()},handlePreviewMousedown:Ue,handlePreviewDblclick:je,syncTransformOrigin:n,handleAfterLeave:()=>{B(),E=0,v.value=!1},handleDragStart:o=>{var s,i;(i=(s=p==null?void 0:p.previewedImgPropsRef.value)===null||s===void 0?void 0:s.onDragstart)===null||i===void 0||i.call(s,o),o.preventDefault()},zoomIn:Xe,zoomOut:Ge,handleDownloadClick:qe,rotateCounterclockwise:Fe,rotateClockwise:Ve,handleSwitchPrev:Be,handleSwitchNext:We,withTooltip:Qe,resizeToOrignalImageSize:Je,cssVars:ne?void 0:oe,themeClass:T==null?void 0:T.themeClass,onRender:T==null?void 0:T.onRender},Ke)},render(){var e,a;const{clsPrefix:t}=this;return l(ae,null,(a=(e=this.$slots).default)===null||a===void 0?void 0:a.call(e),l(ct,{show:this.show},{default:()=>{var c;return this.show||this.displayed?((c=this.onRender)===null||c===void 0||c.call(this),re(l("div",{class:[`${t}-image-preview-container`,this.themeClass],style:this.cssVars,onWheel:this.handleWheel},l(V,{name:"fade-in-transition",appear:this.appear},{default:()=>this.show?l("div",{class:`${t}-image-preview-overlay`,onClick:this.toggleShow}):null}),this.showToolbar?l(V,{name:"fade-in-transition",appear:this.appear},{default:()=>{if(!this.show)return null;const{withTooltip:r}=this;return l("div",{class:`${t}-image-preview-toolbar`},this.onPrev?l(ae,null,r(l(P,{clsPrefix:t,onClick:this.handleSwitchPrev},{default:()=>Io}),"tipPrevious"),r(l(P,{clsPrefix:t,onClick:this.handleSwitchNext},{default:()=>Lo}),"tipNext")):null,r(l(P,{clsPrefix:t,onClick:this.rotateCounterclockwise},{default:()=>l(go,null)}),"tipCounterclockwise"),r(l(P,{clsPrefix:t,onClick:this.rotateClockwise},{default:()=>l(vo,null)}),"tipClockwise"),r(l(P,{clsPrefix:t,onClick:this.resizeToOrignalImageSize},{default:()=>l(po,null)}),"tipOriginalSize"),r(l(P,{clsPrefix:t,onClick:this.zoomOut},{default:()=>l(mo,null)}),"tipZoomOut"),r(l(P,{clsPrefix:t,onClick:this.zoomIn},{default:()=>l(wo,null)}),"tipZoomIn"),r(l(P,{clsPrefix:t,onClick:this.handleDownloadClick},{default:()=>yo}),"tipDownload"),r(l(P,{clsPrefix:t,onClick:this.toggleShow},{default:()=>Ro}),"tipClose"))}}):null,l(V,{name:"fade-in-scale-up-transition",onAfterLeave:this.handleAfterLeave,appear:this.appear,onEnter:this.syncTransformOrigin,onBeforeLeave:this.syncTransformOrigin},{default:()=>{const{previewedImgProps:r={}}=this;return re(l("div",{class:`${t}-image-preview-wrapper`,ref:"previewWrapperRef"},l("img",Object.assign({},r,{draggable:!1,onMousedown:this.handlePreviewMousedown,onDblclick:this.handlePreviewDblclick,class:[`${t}-image-preview`,r.class],key:this.previewSrc,src:this.previewSrc,ref:"previewRef",onDragstart:this.handleDragStart}))),[[ft,this.show]])}})),[[dt,{enabled:this.show}]])):null}}))}});const Ze=me("n-image-group"),Mo=X;var Zo=$({name:"ImageGroup",props:Mo,setup(e){let a;const{mergedClsPrefixRef:t}=Y(e),c=`c${wt()}`,r=mt(),f=d=>{var n;a=d,(n=v.value)===null||n===void 0||n.setPreviewSrc(d)};function h(d){var n,u;if(!(r!=null&&r.proxy))return;const R=r.proxy.$el.parentElement.querySelectorAll(`[data-group-id=${c}]:not([data-error=true])`);if(!R.length)return;const L=Array.from(R).findIndex(y=>y.dataset.previewSrc===a);~L?f(R[(L+d+R.length)%R.length].dataset.previewSrc):f(R[0].dataset.previewSrc),d===1?(n=e.onPreviewNext)===null||n===void 0||n.call(e):(u=e.onPreviewPrev)===null||u===void 0||u.call(e)}Ce(Ze,{mergedClsPrefixRef:t,setPreviewSrc:f,setThumbnailEl:d=>{var n;(n=v.value)===null||n===void 0||n.setThumbnailEl(d)},toggleShow:()=>{var d;(d=v.value)===null||d===void 0||d.toggleShow()},groupId:c});const v=I(null);return{mergedClsPrefix:t,previewInstRef:v,next:()=>{h(1)},prev:()=>{h(-1)}}},render(){return l($e,{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)}});const ko=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},X);var No=$({name:"Image",props:ko,inheritAttrs:!1,setup(e){const a=I(null),t=I(!1),c=I(null),r=be(Ze,null),{mergedClsPrefixRef:f}=r||Y(e),h={click:()=>{if(e.previewDisabled||t.value)return;const n=e.previewSrc||e.src;if(r){r.setPreviewSrc(n),r.setThumbnailEl(a.value),r.toggleShow();return}const{value:u}=c;!u||(u.setPreviewSrc(n),u.setThumbnailEl(a.value),u.toggleShow())}},v=I(!e.lazy);le(()=>{var n;(n=a.value)===null||n===void 0||n.setAttribute("data-group-id",(r==null?void 0:r.groupId)||"")}),le(()=>{if(e.lazy&&e.intersectionObserverOptions){let n;const u=se(()=>{n==null||n(),n=void 0,n=pt(a.value,e.intersectionObserverOptions,v)});xe(()=>{u(),n==null||n()})}}),se(()=>{var n;e.src,(n=e.imgProps)===null||n===void 0||n.src,t.value=!1});const d=I(!1);return Ce(Ae,{previewedImgPropsRef:pe(e,"previewedImgProps")}),Object.assign({mergedClsPrefix:f,groupId:r==null?void 0:r.groupId,previewInstRef:c,imageRef:a,showError:t,shouldStartLoading:v,loaded:d,mergedOnClick:n=>{var u,m;h.click(),(m=(u=e.imgProps)===null||u===void 0?void 0:u.onClick)===null||m===void 0||m.call(u,n)},mergedOnError:n=>{if(!v.value)return;t.value=!0;const{onError:u,imgProps:{onError:m}={}}=e;u==null||u(n),m==null||m(n)},mergedOnLoad:n=>{const{onLoad:u,imgProps:{onLoad:m}={}}=e;u==null||u(n),m==null||m(n),d.value=!0}},h)},render(){var e,a;const{mergedClsPrefix:t,imgProps:c={},loaded:r,$attrs:f,lazy:h}=this,v=(a=(e=this.$slots).placeholder)===null||a===void 0?void 0:a.call(e),d=this.src||c.src,n=l("img",Object.assign(Object.assign({},c),{ref:"imageRef",width:this.width||c.width,height:this.height||c.height,src:this.showError?this.fallbackSrc:h&&this.intersectionObserverOptions?this.shouldStartLoading?d:void 0:d,alt:this.alt||c.alt,"aria-label":this.alt||c.alt,onClick:this.mergedOnClick,onError:this.mergedOnError,onLoad:this.mergedOnLoad,loading:xt&&h&&!this.intersectionObserverOptions?"lazy":"eager",style:[c.style||"",v&&!r?{height:"0",width:"0",visibility:"hidden"}:"",{objectFit:this.objectFit}],"data-error":this.showError,"data-preview-src":this.previewSrc||this.src}));return l("div",Object.assign({},f,{role:"none",class:[f.class,`${t}-image`,(this.previewDisabled||this.showError)&&`${t}-image--preview-disabled`]}),this.groupId?n:l($e,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:t,ref:"previewInstRef",showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip},{default:()=>n}),!r&&v)}});export{No as N,Zo as a,Do as b,_o as c,Co as d,Ao as e,Ho as g,To as i,$o as m};