Files
nextcloud-server-mirror/dist/FilesList-cV7mwles.chunk.mjs
2026-10-27 09:33:38 +00:00

5 lines
102 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/DialogConfirmFileExtension-StSaqk8C.chunk.mjs'),window.OC.filePath('', '', 'dist/sr-D7qLtxtL.chunk.mjs'),window.OC.filePath('', '', 'dist/nl-mGwpypBg.chunk.mjs'),window.OC.filePath('', '', 'dist/PencilOutline-BR0l7G4K.chunk.mjs'),window.OC.filePath('', '', 'dist/zh-TW-BiAqRd9G.chunk.mjs'),window.OC.filePath('', '', 'dist/fa-C4gSzJ4e.chunk.mjs'),window.OC.filePath('', '', 'dist/te-RIb03IRu.chunk.mjs'),window.OC.filePath('', '', 'dist/common-sr-3plNpBrB.chunk.css'),window.OC.filePath('', '', 'dist/NcCheckboxRadioSwitch-CEATWE9W.chunk.mjs'),window.OC.filePath('', '', 'dist/de-B1io8Jaw.chunk.mjs'),window.OC.filePath('', '', 'dist/common-de-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/ro-D53n9Q_a.chunk.mjs'),window.OC.filePath('', '', 'dist/common-ro-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/_l10n-DOS6IYK4.chunk.mjs'),window.OC.filePath('', '', 'dist/MapMarkerOutline-K4T_-mXQ.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcCheckboxRadioSwitch-BAaFbykd.chunk.css'),window.OC.filePath('', '', 'dist/sl-DKKCQ2JF.chunk.mjs'),window.OC.filePath('', '', 'dist/sv-CdUgJRmq.chunk.mjs'),window.OC.filePath('', '', 'dist/vi-B_M7SG5J.chunk.mjs'),window.OC.filePath('', '', 'dist/NcActions-B1iID7Uy.chunk.mjs'),window.OC.filePath('', '', 'dist/TrayArrowDown-CSoX9T4M.chunk.mjs'),window.OC.filePath('', '', 'dist/ko-DLpOya8T.chunk.mjs'),window.OC.filePath('', '', 'dist/lt-C1YkRaIQ.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcActions-gjr8Ik98.chunk.css'),window.OC.filePath('', '', 'dist/common-vi-BgifNljJ.chunk.css'),window.OC.filePath('', '', 'dist/common-sl-B7Bbzm8f.chunk.css'),window.OC.filePath('', '', 'dist/DialogConfirmFileHidden-B8t2wxN3.chunk.mjs'),window.OC.filePath('', '', 'dist/mediaPreloader-C5NbROsO.chunk.mjs'),window.OC.filePath('', '', 'dist/dav-c-nV9k8_.chunk.mjs'),window.OC.filePath('', '', 'dist/uk-Bd3ow9ss.chunk.mjs'),window.OC.filePath('', '', 'dist/Folder-DGRyib13.chunk.mjs'),window.OC.filePath('', '', 'dist/logger-Dw0u1G2B.chunk.mjs'),window.OC.filePath('', '', 'dist/index-CEIDYnDm.chunk.mjs'),window.OC.filePath('', '', 'dist/index-Cl4k2i82.chunk.mjs'),window.OC.filePath('', '', 'dist/common-DialogConfirmFileHidden-D2N3kGNe.chunk.css'),window.OC.filePath('', '', 'dist/files-DialogConfirmFileExtension-Cu5npdtk.chunk.css')])))=>i.map(i=>d[i]);
import{o as ei,a as ge,s as gt,b as L,e as be}from"./index-DDSZxH3w.chunk.mjs";import{e as G,s as Z,u as ce}from"./lt-C1YkRaIQ.chunk.mjs";import{j as ti,g as vt,l as Ve,t as ii,D as yt,u as Xe,V as si,q as Je,w as ni,N as xe,s as oi}from"./index-CEIDYnDm.chunk.mjs";import{g as wt,U as Le,N as ri}from"./NcUploadPicker-ZhAtxQJ4.chunk.mjs";import{i as bt,c as I,_ as _t,a as ai,l as li}from"./zh-TW-BiAqRd9G.chunk.mjs";import{t as h,a as fe}from"./fa-C4gSzJ4e.chunk.mjs";import{j as te,d as ci,m as de,e as ve,h as St,r as di}from"./ko-DLpOya8T.chunk.mjs";import{S as Me}from"./index-IzJWnt_S.chunk.mjs";import{a as oe,F as Ft}from"./Folder-DGRyib13.chunk.mjs";import{N as _e}from"./NcActionButton-Bd6GDmeV.chunk.mjs";import{c as Ze,a as $e}from"./NcActions-B1iID7Uy.chunk.mjs";import{N as ui}from"./NcAppContent-CaSsLLGa.chunk.mjs";import{aP as hi,U as fi,V as pi,aj as mi,N as j,at as gi,az as vi,R as yi,T as re}from"./sr-D7qLtxtL.chunk.mjs";import{N as wi}from"./NcEmptyContent-DxDaqKyz.chunk.mjs";import{N as z}from"./de-B1io8Jaw.chunk.mjs";import{N as Se}from"./ro-D53n9Q_a.chunk.mjs";import{s as Ct,_ as At,I as bi}from"./sl-DKKCQ2JF.chunk.mjs";import{H as _i,b as kt,T as et,N as tt,K as it,F as Si,c as Ie,d as st,P as Fi,e as Ci,I as Ai,V as ki,L as Ni}from"./FileMultiple-D2aGUMdA.chunk.mjs";import{N as xi,a as Ii}from"./information-outline-CArXH5QX.chunk.mjs";import{y as Di,a5 as Nt,i as k,v as O,U as X,e as D,D as Te,j as v,o as r,k as y,w,f as m,H as x,I as V,m as se,J as Re,q as b,s as $,t as C,h as F,r as H,n as A,l as xt,R as Fe,S as Oe,p as S,u as N,L as ie,ac as ze,ae as Be,A as qe,d as It,am as Li,P as Mi,a7 as Ei,ax as ue,a as Vi,ap as Dt,g as ye,a3 as $i,Y as Ti,a8 as K,z as Ri,X as Oi}from"./PencilOutline-BR0l7G4K.chunk.mjs";import{u as zi,e as Bi,a as ae,b as Ue,c as Lt,d as qi}from"./files-main.mjs";import{g as Ee,n as Ui,e as Mt,f as Pi,M as nt,H as Hi,j as Ki,c as ot,i as ji,h as Wi}from"./hashUtils-DULfpN1-.chunk.mjs";import{l as u}from"./logger-Dw0u1G2B.chunk.mjs";import{i as rt,f as Gi,g as Qi,c as Yi,r as Xi}from"./dav-c-nV9k8_.chunk.mjs";import{b as R,c as ne,e as Et,a as le,h as Ji,u as Zi,d as es}from"./DialogConfirmFileHidden-B8t2wxN3.chunk.mjs";import{P as Q,N as U,F as T,b as Vt,a as ts,d as is}from"./uk-Bd3ow9ss.chunk.mjs";import{D as ss}from"./TrayArrowDown-CSoX9T4M.chunk.mjs";import{u as B}from"./vi-B_M7SG5J.chunk.mjs";import{N as $t,S as ns}from"./star-BL5uicI9.chunk.mjs";import{N as Tt}from"./NcCheckboxRadioSwitch-CEATWE9W.chunk.mjs";import{a as os,N as rs}from"./NcAvatar-B7bqpkKH.chunk.mjs";import{_ as as,L as at,M as ls,a as cs}from"./MenuUp-jhq5Rs5O.chunk.mjs";import{c as ds,i as us}from"./mediaPreloader-C5NbROsO.chunk.mjs";import{F as hs}from"./File-uTnQtDbv.chunk.mjs";import{b as fs,u as ps}from"./setup-CEUVPWn8.chunk.mjs";import{N as ms}from"./NcChip-Vw7ofLoz.chunk.mjs";import{p as gs}from"./index-Cl4k2i82.chunk.mjs";import{P as vs}from"./index-AGe6WBZm.chunk.mjs";import{c as ys}from"./index-CyG9Na7y.chunk.mjs";import"./nl-mGwpypBg.chunk.mjs";import"./ja-CMHj6q78.chunk.mjs";import"./te-RIb03IRu.chunk.mjs";import"./index-Cthtu8CL.chunk.mjs";import"./NcProgressBar-BuGLdvDE.chunk.mjs";import"./sv-CdUgJRmq.chunk.mjs";import"./_l10n-DOS6IYK4.chunk.mjs";import"./MapMarkerOutline-K4T_-mXQ.chunk.mjs";import"./NcActionLink-Dqun3dus.chunk.mjs";import"./NcActionRouter-cBVJFGkm.chunk.mjs";import"./NcContent-CQUMzUur.chunk.mjs";import"./NcTextArea-CmN4qAmc.chunk.mjs";import"./index-BK_Pu2kQ.chunk.mjs";import"./NcInputField-Tq-JEdJ1.chunk.mjs";import"./CogOutline-6Ov8bXsX.chunk.mjs";import"./NcHotkeyList-DKROJbs3.chunk.mjs";import"./NcKbd-CazSn_M_.chunk.mjs";import"./NcFormBox-C_hDVD56.chunk.mjs";import"./NcRichText-Ch7kzoGx.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./colors-S56FYHEy.chunk.mjs";import"./NcUserStatusIcon-Be0C11i7.chunk.mjs";import"./NcActionText-CnRiiHlp.chunk.mjs";import"./history-BU3vztED.chunk.mjs";import"./NcActionCheckbox-CBj0iegT.chunk.mjs";import"./NcActionInput-C47huJ1S.chunk.mjs";import"./NcDateTimePickerNative--BsdFQkM.chunk.mjs";import"./NcPasswordField-DmWsd6BB.chunk.mjs";import"./handlerEvents-BTEIUErK.chunk.mjs";import"./index-BcVz-16Y.chunk.mjs";import"./statusOptionsService-D2usejk_.chunk.mjs";import"./NcDashboardWidget-BScIKU2f.chunk.mjs";import"./zh-TW-0PckaX7a.chunk.mjs";import"./NcEmojiPicker-Eaf0m_Jx.chunk.mjs";import"./emoji-lyvAZNdk.chunk.mjs";import"./LoginFlowDone-BW8dqahd.chunk.mjs";import"./folder-multiple-outline-_TAycpmw.chunk.mjs";import"./NcProfileHoverCard-D2fofa0e.chunk.mjs";import"./index-mLKBeNrp.chunk.mjs";import"./index-Cef2gMDo.chunk.mjs";import"./NcSelectTags-B7q-1pve.chunk.mjs";import"./NcSettingsSection-D9ixm13f.chunk.mjs";let he;const Y=O(0),ws=k(()=>Y.value>=1024),bs=k(()=>Y.value>=512&&Y.value<1024),_s=k(()=>Y.value<512),lt=new ResizeObserver(([e])=>{if(!e)return;const t=e.contentBoxSize?.[0];t?Y.value=t.inlineSize:Y.value=e.contentRect.width});function ct(){const e=document.querySelector("#app-content-vue")??document.body;e!==he&&(he&&lt.unobserve(he),lt.observe(e),he=e)}function q(){return Di(ct),ct(),{width:Nt(Y),isWide:ws,isMedium:bs,isNarrow:_s}}class ee extends File{_contents;constructor(t,i=[]){super([],t,{type:"httpd/unix-directory"}),this._contents=i}set contents(t){this._contents=t}get contents(){return this._contents}get size(){return this._computeDirectorySize(this)}get lastModified(){return this._contents.length===0?Date.now():this._computeDirectoryMtime(this)}_computeDirectoryMtime(t){return t.contents.reduce((i,s)=>s.lastModified>i?s.lastModified:i,0)}_computeDirectorySize(t){return t.contents.reduce((i,s)=>i+s.size,0)}}async function Rt(e,t=""){for(const[i,s]of e.contents.entries()){const n=s instanceof ee;let o=s;if(Ee(o.name,!1,n)!==""){const a=e.contents.filter(d=>d!==o).map(d=>d.name),c=await Ui(o.name,a,{name:h("files",'Invalid name for "{path}"',{path:te(t,o.name)},{escape:!1}),label:n?h("files","Folder name"):h("files","Filename"),submitLabel:h("files","Rename"),isFolder:n});if(c===null)return u.debug("Upload cancelled while renaming an invalid entry",{path:t,name:o.name}),!1;const l=ti(c.trim(),a);o=n?new ee(l,o.contents):new File([o],l,{type:o.type,lastModified:o.lastModified}),e.contents.splice(i,1,o)}if(o instanceof ee&&!await Rt(o,te(t,o.name)))return!1}return!0}async function Ot(e){if(e.isFile)return new Promise((n,o)=>{e.file(n,o)});u.debug("Handling recursive file tree",{entry:e.name});const t=e,i=await Ss(t),s=(await Promise.all(i.map(Ot))).flat();return new ee(t.name,s)}function Ss(e){const t=e.createReader();return new Promise((i,s)=>{const n=[],o=()=>{t.readEntries(a=>{a.length?(n.push(...a),o()):i(n)},a=>{s(a)})};o()})}async function Fs(e,t){const i=t?.source??te(Gi,rt),s=t?.root??rt,n=Qi(i);if(!await n.exists(e)){u.debug("Directory does not exist, creating it",{path:e,davUrl:i}),await n.createDirectory(e,{recursive:!0});const o=await n.stat(e,{details:!0,data:Yi()});G("files:node:created",Xi(o.data,s,i))}}async function zt(e,t,i){try{const s=e.filter(a=>i.find(c=>c.basename===(a instanceof File?a.name:a.basename))).filter(Boolean),n=e.filter(a=>!s.includes(a)),o=await ei(t.path,s,i);return u.debug("Conflict resolution",{uploads:n,conflictResults:o}),o===null||o.selected.length===0&&o.renamed.length===0&&n.length===0?(ge(h("files","Conflicts resolution skipped")),u.info("User skipped the conflict resolution"),[]):[...n,...o.selected,...o.renamed]}catch(s){u.warn("User cancelled the upload",{error:s}),gt(h("files","Upload cancelled"))}return[]}async function Pe(e){const t=e.filter(n=>n.kind!=="file"?(u.debug("Skipping dropped item",{kind:n.kind,type:n.type}),!1):!0).map(n=>n?.getAsEntry?.()??n?.webkitGetAsEntry?.()??n);let i=!1;const s=new ee("root");for(const n of t){if(n instanceof DataTransferItem){u.warn("Could not get FilesystemEntry of item, falling back to file");const o=n.getAsFile();if(o===null){u.warn("Could not process DataTransferItem",{type:n.type,kind:n.kind}),L(h("files","One of the dropped files could not be processed"));continue}if(o.type==="httpd/unix-directory"||!o.type&&o.size===0){i||(u.warn("Browser does not support Filesystem API. Directories will not be uploaded"),gt(h("files","Your browser does not support the Filesystem API. Directories will not be uploaded")),i=!0);continue}s.contents.push(o);continue}try{s.contents.push(await Ot(n))}catch(o){u.error("Error while traversing file tree",{error:o})}}return s}async function He(e,t,i){if(!await Rt(e))return ge(h("files","Upload cancelled, drop the files again to retry")),[];const s=wt();if(Mt(e.contents,i).length!==0){if(e.contents=await zt(e.contents,t,i),e.contents.length===0)return[]}else if(e.contents.length===0)return u.info("No files to upload",{root:e}),ge(h("files","No files to upload")),[];u.debug(`Uploading files to ${t.path}`,{root:e,contents:e.contents});const n=[];let o=!1;const a=async(d,_)=>{for(const f of d.contents){const p=te(_,f.name);if(f instanceof ee){try{u.debug("Processing directory",{relativePath:p,destination:t}),await Fs(p,t),await a(f,p)}catch(g){o=!0,L(h("files","Unable to create the directory {directory}",{directory:f.name})),u.error("Unable to create the directory",{error:g,relativePath:p,directory:f})}continue}u.debug("Uploading file to "+te(t.path,p),{file:f}),n.push(s.upload(p,f))}};s.pause();const c=s.destination;s.destination=t;try{await a(e,"/")}finally{s.destination=c,s.start()}const l=(await Promise.allSettled(n)).filter(d=>d.status==="rejected");return l.length>0&&(u.error("Error while uploading files",{errors:l}),L(h("files","Some files could not be uploaded"))),l.length>0||o?[]:(u.debug("Files uploaded successfully"),be(h("files","Files uploaded successfully")),Promise.all(n))}async function Bt(e,t,i,s=!1){if(Mt(e,i).length!==0&&(e=await zt(e,t,i)),e.length===0){u.info("No files to process",{nodes:e}),ge(h("files","No files to process"));return}try{await Array.fromAsync(Pi(e,t,s?nt.COPY:nt.MOVE)),u.debug("Files copy/move successful"),be(s?h("files","Files copied successfully"):h("files","Files moved successfully"))}catch(n){u.error("Error while processing dropped files",{error:n}),n instanceof Hi?L(n.message):L(s?h("files","Some files could not be copied"):h("files","Some files could not be moved"))}}const Ke=X("dragging",{state:()=>({dragging:[]}),actions:{set(e=[]){this.dragging=e},reset(){this.dragging=[]}}}),J=X("selection",{state:()=>({selected:[],lastSelection:[],lastSelectedIndex:null}),actions:{set(e=[]){this.selected=[...new Set(e)]},setLastIndex(e=null){this.lastSelection=e?this.selected:[],this.lastSelectedIndex=e},reset(){this.selected=[],this.lastSelection=[],this.lastSelectedIndex=null}}});let dt;function qt(...e){return dt=wt(),X("uploader",{state:()=>({queue:dt.queue})})(...e)}const Cs=D({name:"BreadCrumbs",components:{NcActionButton:_e,NcBreadcrumbs:Ii,NcBreadcrumb:xi,NcIconSvgWrapper:z},props:{path:{type:String,default:"/"}},emits:["reload"],setup(){const e=R(),t=ne(),i=Et(),s=Ke(),n=J(),o=qt(),{isNarrow:a}=q(),c=zi(),l=O(!1);Te(()=>e.activeFolder,()=>{l.value=!1});const d=ci()?.files_sharing!==void 0,_=bt(),f=k(()=>d&&!_&&e.activeFolder&&(e.activeFolder.permissions&Q.SHARE)!==0);return{activeStore:e,draggingStore:s,filesStore:t,pathsStore:i,selectionStore:n,uploaderStore:o,canShare:f,isMenuOpen:l,isNarrow:a,views:c,openSharingSidebar:p,mdiAccountPlus:mi,mdiChevronDown:pi,mdiChevronUp:fi,mdiReload:hi};function p(){vt().open(e.activeFolder,"sharing")}},computed:{dirs(){const e=t=>i=>t+=`${i}/`;return["/",...this.path.split("/").filter(Boolean).map(e("/")).map(t=>t.replace(/^(.+)\/$/,"$1"))]},sections(){return this.dirs.map((e,t)=>{const i=this.getFileSourceFromPath(e),s=i?this.getNodeFromSource(i):void 0;return{dir:e,exact:!0,name:this.getDirDisplayName(e),to:this.getTo(e,s),disableDrop:t===this.dirs.length-1}})},isUploadInProgress(){return this.uploaderStore.queue.length!==0},wrapUploadProgressBar(){return this.isUploadInProgress&&this.isNarrow},viewIcon(){return this.activeStore.activeView?.icon??_i},selectedFiles(){return this.selectionStore.selected},draggingFiles(){return this.draggingStore.dragging}},methods:{getNodeFromSource(e){return this.filesStore.getNode(e)},getFileSourceFromPath(e){return(this.activeStore.activeView&&this.pathsStore.getPath(this.activeStore.activeView.id,e))??null},getDirDisplayName(e){if(e==="/")return this.activeStore.activeView?.name||h("files","Home");const t=this.getFileSourceFromPath(e);return(t?this.getNodeFromSource(t):void 0)?.displayname||oe.basename(e)},getTo(e,t){if(e==="/")return{...this.$route,params:{view:this.activeStore.activeView?.id},query:{}};if(t===void 0){const i=this.views.find(s=>s.params?.dir===e);return{...this.$route,params:{fileid:i?.params?.fileid??""},query:{dir:e}}}return{...this.$route,params:{fileid:String(t.fileid)},query:{dir:t.path}}},onDragOver(e,t){if(e.dataTransfer){if(t===this.dirs[this.dirs.length-1]){e.dataTransfer.dropEffect="none";return}e.ctrlKey?e.dataTransfer.dropEffect="copy":e.dataTransfer.dropEffect="move"}},async onDrop(e,t){if(!this.draggingFiles&&!e.dataTransfer?.items?.length)return;e.preventDefault();const i=this.draggingFiles,s=[...e.dataTransfer?.items||[]],n=await Pe(s),o=new AbortController,a=await this.activeStore.activeView?.getContents(t,{signal:o.signal}),c=a?.folder;if(!c){L(this.t("files","Target folder does not exist any more"));return}const l=(c.permissions&Q.CREATE)!==0,d=e.ctrlKey;if(!l||e.button!==0)return;if(u.debug("Dropped",{event:e,folder:c,selection:i,fileTree:n}),n.contents.length>0){await He(n,c,a.contents);return}const _=i.map(f=>this.filesStore.getNode(f));await Bt(_,c,a.contents,d),i.some(f=>this.selectedFiles.includes(f))&&(u.debug("Dropped selection, resetting select store..."),this.selectionStore.reset())},titleForSection(e,t){if(t?.to?.query?.dir===this.$route.query.dir)return h("files","Reload current directory");if(e===0)return h("files",'Go to the "{dir}" directory',t)},ariaForSection(e){if(e?.to?.query?.dir===this.$route.query.dir)return h("files","Reload current directory")},t:h}});function As(e,t,i,s,n,o){const a=v("NcIconSvgWrapper"),c=v("NcActionButton"),l=v("NcBreadcrumb"),d=v("NcBreadcrumbs");return r(),y(d,{"data-cy-files-content-breadcrumbs":"","aria-label":e.t("files","Current directory path"),class:A(["files-list__breadcrumbs",{"files-list__breadcrumbs--with-progress":e.wrapUploadProgressBar}])},{actions:w(()=>[H(e.$slots,"actions",{},void 0,!0)]),default:w(()=>[(r(!0),m(x,null,V(e.sections,(_,f)=>(r(),y(l,se({key:_.dir},{ref_for:!0},_,{open:e.isMenuOpen,"onUpdate:open":t[1]||(t[1]=p=>e.isMenuOpen=p),dir:"auto",to:_.to,forceIconText:f===0&&!e.isNarrow,forceMenu:"",title:e.titleForSection(f,_),"aria-description":e.ariaForSection(_),onDragover:p=>e.onDragOver(p,_.dir),onDrop:p=>e.onDrop(p,_.dir)}),Re({_:2},[f===0?{name:"icon",fn:w(()=>[b(a,{size:20,svg:e.viewIcon},null,8,["svg"])]),key:"0"}:void 0,f===e.sections.length-1?{name:"menu-icon",fn:w(()=>[b(a,{path:e.isMenuOpen?e.mdiChevronUp:e.mdiChevronDown},null,8,["path"])]),key:"1"}:void 0,f===e.sections.length-1?{name:"default",fn:w(()=>[e.canShare?(r(),y(c,{key:0,closeAfterClick:"",onClick:e.openSharingSidebar},{icon:w(()=>[b(a,{path:e.mdiAccountPlus},null,8,["path"])]),default:w(()=>[$(" "+C(e.t("files","Share")),1)]),_:1},8,["onClick"])):F("",!0),b(c,{closeAfterClick:"",onClick:t[0]||(t[0]=p=>e.$emit("reload"))},{icon:w(()=>[b(a,{path:e.mdiReload},null,8,["path"])]),default:w(()=>[$(" "+C(e.t("files","Reload content")),1)]),_:1})]),key:"2"}:void 0]),1040,["open","to","forceIconText","title","aria-description","onDragover","onDrop"]))),128))]),_:3},8,["aria-label","class"])}const ks=I(Cs,[["render",As],["__scopeId","data-v-4ea058bd"]]),Ns=D({name:"DragAndDropNotice",components:{TrayArrowDownIcon:ss},props:{currentFolder:{type:Object,required:!0}},setup(){return{activeStore:R()}},data(){return{dragover:!1}},computed:{canUpload(){return this.currentFolder&&(this.currentFolder.permissions&Q.CREATE)!==0},isQuotaExceeded(){return this.currentFolder?.attributes?.["quota-available-bytes"]===0},cantUploadLabel(){return this.isQuotaExceeded?this.t("files","Your have used your space quota and cannot upload files anymore"):this.canUpload?null:this.t("files","You do not have permission to upload or create files here.")},resetDragOver(){return xt(()=>{this.dragover=!1},3e3)}},mounted(){const e=window.document.getElementById("app-content-vue");e.addEventListener("dragover",this.onDragOver),e.addEventListener("dragleave",this.onDragLeave),e.addEventListener("drop",this.onContentDrop)},beforeUnmount(){const e=window.document.getElementById("app-content-vue");e.removeEventListener("dragover",this.onDragOver),e.removeEventListener("dragleave",this.onDragLeave),e.removeEventListener("drop",this.onContentDrop)},methods:{onDragOver(e){e.preventDefault(),e.dataTransfer?.types.includes("Files")&&(this.dragover=!0,this.resetDragOver())},onDragLeave(e){e.currentTarget?.contains(e.relatedTarget??e.target)||this.dragover&&(this.dragover=!1,this.resetDragOver.clear())},onContentDrop(e){u.debug("Drag and drop cancelled, dropped on empty space",{event:e}),e.preventDefault(),this.dragover&&(this.dragover=!1,this.resetDragOver.clear())},async onDrop(e){if(this.cantUploadLabel){L(this.cantUploadLabel);return}if(this.$el.querySelector("tbody")?.contains(e.target))return;e.preventDefault(),e.stopPropagation();const t=Array.from(e.dataTransfer?.items||[]),i=await Pe(t),s=new AbortController,n=await this.activeStore.activeView?.getContents(this.currentFolder.path,{signal:s.signal}),o=n?.folder;if(!o){L(this.t("files","Target folder does not exist any more"));return}if(e.button)return;u.debug("Dropped",{event:e,folder:o,fileTree:i});const a=(await He(i,o,n.contents)).findLast(c=>c.status!==Le.FAILED&&!c.file.webkitRelativePath.includes("/")&&c.response?.headers?.["oc-fileid"]&&c.source.replace(o.source,"").split("/").length===2);if(a!==void 0){const c=String(a.response.headers["oc-fileid"]).split(/(oc|nc)/,2)[0];u.debug("Scrolling to last upload in current folder",{lastUpload:a}),this.$router.push({name:this.$route.name,params:{...this.$route.params,fileid:c},query:{dir:this.$route.query.dir}})}this.dragover=!1,this.resetDragOver.clear()},t:h}}),xs={class:"files-list__drag-drop-notice-wrapper"},Is={class:"files-list-drag-drop-notice__title"},Ds={key:1,class:"files-list-drag-drop-notice__title"};function Ls(e,t,i,s,n,o){const a=v("TrayArrowDownIcon");return Fe((r(),m("div",{"data-cy-files-drag-drop-area":"",class:"files-list__drag-drop-notice",onDrop:t[0]||(t[0]=(...c)=>e.onDrop&&e.onDrop(...c))},[S("div",xs,[e.canUpload&&!e.isQuotaExceeded?(r(),m(x,{key:0},[b(a,{size:48}),S("h3",Is,C(e.t("files","Drag and drop files here to upload")),1)],64)):(r(),m("h3",Ds,C(e.cantUploadLabel),1))])],544)),[[Oe,e.dragover]])}const Ms=I(Ns,[["render",Ls],["__scopeId","data-v-ea03858f"]]);function Es(e){return"tagName"in e}const je=X("filters",()=>{const e=O({}),t=O([]),i=k(()=>Object.values(e.value).flat()),s=k(()=>t.value.sort((f,p)=>f.order-p.order)),n=k(()=>s.value.filter(Es));function o(f){f.addEventListener("update:chips",l),f.addEventListener("update:filter",c),t.value.push(f),u.debug("New file list filter registered",{id:f.id})}function a(f){const p=t.value.findIndex(({id:g})=>g===f);if(p>-1){const[g]=t.value.splice(p,1);g.removeEventListener("update:chips",l),g.removeEventListener("update:filter",c),u.debug("Files list filter unregistered",{id:f})}}function c(){G("files:filters:changed")}function l(f){const p=f.target.id;e.value={...e.value,[p]:[...f.detail]},u.debug("File list filter chips updated",{filter:p,chips:f.detail})}return d(),{chips:e,filters:t,filtersWithUI:n,activeChips:i,sortedFilters:s};function d(){const f=Ve(),p=ii();f.addEventListener("register:listFilter",g=>{o(g.detail)}),f.addEventListener("unregister:listFilter",g=>{a(g.detail)});for(const g of p)o(g);Z("files:navigation:changed",_)}function _(){u.debug("Reset all file list filters - view changed");for(const f of t.value)f.reset!==void 0&&f.reset()}}),ut="file-list-filters-menu-trigger",Vs=D({__name:"FileListFilters",setup(e){const t=je(),i=k(()=>t.filtersWithUI),s=k(()=>t.activeChips.length>0),n=O(),{isWide:o}=q(),a=document.getElementById("app-content-vue");return(c,l)=>(r(),m("div",{class:A(c.$style.fileListFilters),"data-test-id":"files-list-filters"},[N(o)?(r(!0),m(x,{key:0},V(i.value,d=>(r(),y(N(Ze),{key:d.id,boundary:N(a)},{trigger:w(()=>[b(N(j),{variant:"tertiary"},{icon:w(()=>[b(N(z),{svg:d.iconSvgInline},null,8,["svg"])]),default:w(()=>[$(" "+C(d.displayName),1)]),_:2},1024)]),default:w(()=>[S("div",{class:A(c.$style.fileListFilters__popoverContainer)},[(r(),y(ie(d.tagName),{".filter":d},null,40,[".filter"]))],2)]),_:2},1032,["boundary"]))),128)):(r(),y(N(Ze),{key:1,boundary:N(a),popupRole:n.value?"dialog":"menu","onUpdate:shown":l[1]||(l[1]=d=>n.value=void 0)},{trigger:w(()=>[b(N(j),{id:ut,"aria-label":N(h)("files","Filters"),pressed:s.value,variant:"tertiary"},{icon:w(()=>[b(N(z),{path:N(vi)},null,8,["path"])]),_:1},8,["aria-label","pressed"])]),default:w(()=>[n.value?(r(),m("div",{key:0,class:A(c.$style.fileListFilters__popoverFilterView)},[b(N(j),{wide:"",variant:"tertiary",onClick:l[0]||(l[0]=d=>n.value=void 0)},{icon:w(()=>[b(N(z),{directional:"",path:N(gi)},null,8,["path"])]),default:w(()=>[$(" "+C(N(h)("files","Back to filters")),1)]),_:1}),(r(),y(ie(n.value.tagName),{".filter":n.value},null,40,[".filter"]))],2)):(r(),m("ul",{key:1,class:A(c.$style.fileListFilters__popoverContainer),"aria-labelledby":ut,role:"menu"},[(r(!0),m(x,null,V(i.value,d=>(r(),m("li",{key:d.id,role:"presentation"},[b(N(j),{role:"menuitem",alignment:"start",variant:"tertiary",wide:"",onClick:_=>n.value=d},{icon:w(()=>[b(N(z),{svg:d.iconSvgInline},null,8,["svg"])]),default:w(()=>[$(" "+C(d.displayName),1)]),_:2},1032,["onClick"])]))),128))],2))]),_:1},8,["boundary","popupRole"]))],2))}}),$s="_fileListFilters_qx5ok_2",Ts="_fileListFilters__popoverFilterView_qx5ok_11",Rs="_fileListFilters__popoverContainer_qx5ok_20",Os="_fileListFilters__filter_qx5ok_26",zs="_fileListFilters__active_qx5ok_37",Bs={fileListFilters:$s,fileListFilters__popoverFilterView:Ts,fileListFilters__popoverContainer:Rs,fileListFilters__filter:Os,fileListFilters__active:zs},qs={$style:Bs},Us=I(Vs,[["__cssModules",qs]]),Ps={name:"CustomElementRender",props:{source:{type:Object,required:!0},activeView:{type:Object,required:!0},activeFolder:{type:Object,required:!0},render:{type:Function,required:!0}},watch:{source(){this.updateRootElement()},currentView(){this.updateRootElement()}},mounted(){this.updateRootElement()},methods:{async updateRootElement(){const e=await this.render({nodes:[this.source],view:this.activeView,folder:this.activeFolder,contents:[]});e?this.$el.replaceChildren(e):this.$el.replaceChildren()}}};function Hs(e,t,i,s,n,o){return r(),m("span")}const Ut=I(Ps,[["render",Hs]]),W=44,Pt=14,Ks=W,js=W,Ws=W+Pt,Gs=200,ht={mime:W*3.5,size:W*2,mtime:W*2.5,custom:W*2.5},ft=["mime"],Qs=["size","mtime"],Ht=Symbol("fileListLayout"),we=O(0);function Ys(e){e>we.value&&(we.value=e)}function Xs(){we.value=0}function Js(){return Nt(we)}function Zs(e,t,i){const s={...t,columns:[...t.columns]},n=l=>l+2*Pt,o=[...ft,...Qs],a=()=>Ks+js+(s.inlineActions?i:0)+o.reduce((l,d)=>l+(s[d]?n(ht[d]):0),0)+s.columns.length*n(ht.custom),c=[()=>{s.inlineActions=!1},...ft.map(l=>()=>{s[l]=!1}),...t.columns.map(()=>()=>{s.columns.pop()})];for(const l of c){if(e-a()>=Gs)break;l()}return s}function Ce(){return ze(Ht,O({inlineActions:!0,mime:!1,size:!1,mtime:!1,columns:[]}))}const Kt=D({data(){return{openedSubmenu:null}},computed:{enabledSubmenuActions(){return this.enabledFileActions.reduce((e,t)=>(t.parent!==void 0&&(e[t.parent]||(e[t.parent]=[]),e[t.parent].push(t)),e),{})}},methods:{isValidMenu(e){return this.enabledSubmenuActions[e.id]?.length>0},async onBackToMenuClick(e){e&&(this.openedSubmenu=null,await this.$nextTick(),this.$nextTick(()=>{const t=this.$refs[`action-batch-${e.id}`]?.[0]||this.$refs[`action-${e.id}`]?.[0];t&&t.$el.querySelector("button")?.focus()}))}}}),en=D({name:"FileEntryActions",components:{ArrowLeftIcon:kt,CustomElementRender:Ut,NcActionButton:_e,NcActions:$e,NcActionSeparator:$t,NcIconSvgWrapper:z,NcLoadingIcon:Se},mixins:[Kt],props:{opened:{type:Boolean,default:!1},source:{type:Object,required:!0},gridMode:{type:Boolean,default:!1}},emits:["update:opened"],setup(){const e=R(),t=Ce(),i=ze("enabledFileActions",[]);return{activeStore:e,enabledFileActions:i,layout:t,t:h}},data(){return{resizeObserver:null}},computed:{isActive(){return this.activeStore.activeNode?.source===this.source.source},isLoading(){return this.source.status===U.LOADING},actionContext(){return{nodes:[this.source],view:this.activeStore.activeView,folder:this.activeStore.activeFolder,contents:[]}},inlineCapableActions(){return this.gridMode?[]:this.enabledFileActions.filter(e=>{try{return e?.inline?.(this.actionContext)===!0}catch(t){return u.error("Error while checking if action is inline",{action:e,error:t}),!1}})},enabledInlineActions(){return this.layout.inlineActions?this.inlineCapableActions:[]},enabledRenderActions(){return!this.layout.inlineActions||this.gridMode?[]:this.enabledFileActions.filter(e=>typeof e.renderInline=="function")},enabledMenuActions(){if(this.openedSubmenu)return this.enabledInlineActions;const e=[...this.enabledInlineActions,...this.enabledFileActions.filter(i=>i.default!==yt.HIDDEN&&typeof i.renderInline!="function")].filter((i,s,n)=>s===n.findIndex(o=>o.id===i.id)),t=e.filter(i=>!i.parent).map(i=>i.id);return e.filter(i=>!(i.parent&&t.includes(i.parent)))},renderedNonDestructiveActions(){return this.enabledMenuActions.filter(e=>!e.destructive)},renderedDestructiveActions(){return this.enabledMenuActions.filter(e=>e.destructive)},openedMenu:{get(){return this.opened},set(e){this.$emit("update:opened",e)}},getBoundariesElement(){return document.querySelector(".app-content > .files-list")}},watch:{openedMenu(){this.openedSubmenu=null},inlineCapableActions(){this.reportInlineActionsWidth()}},created(){B("Escape",this.onKeyDown,{stop:!0,prevent:!0}),B("a",this.onKeyDown,{stop:!0,prevent:!0})},mounted(){this.gridMode||(this.resizeObserver=new ResizeObserver(()=>this.reportInlineActionsWidth()),this.resizeObserver.observe(this.$el),this.reportInlineActionsWidth())},beforeUnmount(){this.resizeObserver?.disconnect()},methods:{reportInlineActionsWidth(){if(this.gridMode||!this.$el)return;const e=[...this.$el.querySelectorAll(":scope > .files-list__row-action--inline")].filter(t=>t.offsetWidth>0).reduce((t,i)=>t+i.offsetWidth+parseFloat(getComputedStyle(i).marginInlineEnd||"0"),0);Ys(this.inlineCapableActions.length*Ws+e)},actionDisplayName(e){try{if((this.gridMode||!this.layout.inlineActions&&e.inline)&&typeof e.title=="function"){const t=e.title(this.actionContext);if(t)return t}return e.displayName(this.actionContext)}catch(t){return u.error("Error while getting action display name",{action:e,error:t}),e.id}},isLoadingAction(e){return this.isActive?this.activeStore.activeAction?.id===e.id:!1},async onActionClick(e){if(this.enabledSubmenuActions[e.id]){this.openedSubmenu=e;return}this.activeStore.activeNode=this.source,await Bi(e,"menu")},onKeyDown(e){this.isActive&&(e.key==="Escape"&&this.openedMenu&&(this.openedMenu=!1),e.key==="a"&&!this.openedMenu&&(this.openedMenu=!0))},onMenuClose(){this.openedSubmenu=null},onMenuClosed(){this.openedMenu=!1}}}),tn={class:"files-list__row-actions","data-cy-files-list-row-actions":""};function sn(e,t,i,s,n,o){const a=v("CustomElementRender"),c=v("NcLoadingIcon"),l=v("NcIconSvgWrapper"),d=v("NcActionButton"),_=v("NcActionSeparator"),f=v("ArrowLeftIcon"),p=v("NcActions");return r(),m("td",tn,[(r(!0),m(x,null,V(e.enabledRenderActions,g=>(r(),y(a,{key:g.id,class:A(["files-list__row-action-"+g.id,"files-list__row-action--inline"]),activeFolder:e.activeStore.activeFolder,activeView:e.activeStore.activeView,render:g.renderInline,source:e.source},null,8,["class","activeFolder","activeView","render","source"]))),128)),b(p,{ref:"actionsMenu",boundariesElement:e.getBoundariesElement,container:e.getBoundariesElement,forceName:!0,variant:"tertiary",forceMenu:e.enabledInlineActions.length===0,inline:e.enabledInlineActions.length,open:e.openedMenu,onClose:e.onMenuClose,onClosed:e.onMenuClosed},{default:w(()=>[(r(!0),m(x,null,V(e.renderedNonDestructiveActions,(g,M)=>(r(),y(d,{key:g.id,ref_for:!0,ref:`action-${g.id}`,class:A(["files-list__row-action",{[`files-list__row-action-${g.id}`]:!0,"files-list__row-action--inline":M<e.enabledInlineActions.length,"files-list__row-action--menu":e.isValidMenu(g)}]),closeAfterClick:!e.isValidMenu(g),"data-cy-files-list-row-action":g.id,isMenu:e.isValidMenu(g),"aria-label":g.title?.(e.actionContext),title:g.title?.(e.actionContext),onClick:E=>e.onActionClick(g)},{icon:w(()=>[e.isLoadingAction(g)?(r(),y(c,{key:0})):(r(),y(l,{key:1,class:"files-list__row-action-icon",svg:g.iconSvgInline(e.actionContext)},null,8,["svg"]))]),default:w(()=>[$(" "+C(e.actionDisplayName(g)),1)]),_:2},1032,["class","closeAfterClick","data-cy-files-list-row-action","isMenu","aria-label","title","onClick"]))),128)),e.renderedDestructiveActions.length>0?(r(),m(x,{key:0},[b(_),(r(!0),m(x,null,V(e.renderedDestructiveActions,(g,M)=>(r(),y(d,{key:g.id,ref_for:!0,ref:`action-${g.id}`,class:A(["files-list__row-action files-list__row-action--destructive",{[`files-list__row-action-${g.id}`]:!0,"files-list__row-action--inline":M<e.enabledInlineActions.length,"files-list__row-action--menu":e.isValidMenu(g)}]),closeAfterClick:!e.isValidMenu(g),"data-cy-files-list-row-action":g.id,isMenu:e.isValidMenu(g),"aria-label":g.title?.(e.actionContext),title:g.title?.(e.actionContext),onClick:E=>e.onActionClick(g)},{icon:w(()=>[e.isLoadingAction(g)?(r(),y(c,{key:0})):(r(),y(l,{key:1,class:"files-list__row-action-icon",svg:g.iconSvgInline(e.actionContext)},null,8,["svg"]))]),default:w(()=>[$(" "+C(e.actionDisplayName(g)),1)]),_:2},1032,["class","closeAfterClick","data-cy-files-list-row-action","isMenu","aria-label","title","onClick"]))),128))],64)):F("",!0),e.openedSubmenu&&e.enabledSubmenuActions[e.openedSubmenu?.id]?(r(),m(x,{key:1},[b(d,{class:"files-list__row-action-back","data-cy-files-list-row-action":"menu-back",onClick:t[0]||(t[0]=g=>e.onBackToMenuClick(e.openedSubmenu))},{icon:w(()=>[b(f)]),default:w(()=>[$(" "+C(e.t("files","Back")),1)]),_:1}),b(_),(r(!0),m(x,null,V(e.enabledSubmenuActions[e.openedSubmenu?.id],g=>(r(),y(d,{key:g.id,class:A([`files-list__row-action-${g.id}`,"files-list__row-action--submenu"]),closeAfterClick:"","data-cy-files-list-row-action":g.id,"aria-label":g.title?.(e.actionContext),title:g.title?.(e.actionContext),onClick:M=>e.onActionClick(g)},{icon:w(()=>[e.isLoadingAction(g)?(r(),y(c,{key:0})):(r(),y(l,{key:1,svg:g.iconSvgInline(e.actionContext)},null,8,["svg"]))]),default:w(()=>[$(" "+C(e.actionDisplayName(g)),1)]),_:2},1032,["class","data-cy-files-list-row-action","aria-label","title","onClick"]))),128))],64)):F("",!0)]),_:1},8,["boundariesElement","container","forceMenu","inline","open","onClose","onClosed"])])}const jt=I(en,[["render",sn],["__scopeId","data-v-ecbfc9f5"]]);function nn(...e){const t=X("keyboard",{state:()=>({altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1}),actions:{onEvent(i){i||(i=window.event),this.altKey=!!i.altKey,this.ctrlKey=!!i.ctrlKey,this.metaKey=!!i.metaKey,this.shiftKey=!!i.shiftKey}}})(...e);return t._initialized||(window.addEventListener("keydown",t.onEvent),window.addEventListener("keyup",t.onEvent),window.addEventListener("mousemove",t.onEvent),t._initialized=!0),t}const on=D({name:"FileEntryCheckbox",components:{NcCheckboxRadioSwitch:Tt,NcLoadingIcon:Se},props:{fileid:{type:Number,required:!0},isLoading:{type:Boolean,default:!1},nodes:{type:Array,required:!0},source:{type:Object,required:!0}},setup(){const e=J(),t=nn();return{activeStore:R(),keyboardStore:t,selectionStore:e,t:h}},computed:{isActive(){return this.activeStore.activeNode?.source===this.source.source},selectedFiles(){return this.selectionStore.selected},isSelected(){return this.selectedFiles.includes(this.source.source)},index(){return this.nodes.findIndex(e=>e.source===this.source.source)},isFile(){return this.source.type===T.File},ariaLabel(){return this.isFile?h("files",'Toggle selection for file "{displayName}"',{displayName:this.source.basename}):h("files",'Toggle selection for folder "{displayName}"',{displayName:this.source.basename})},loadingLabel(){return this.isFile?h("files","File is loading"):h("files","Folder is loading")}},created(){B(" ",this.onToggleSelect,{stop:!0,prevent:!0,ctrl:!0}),B(" ",this.onToggleSelect,{stop:!0,prevent:!0,ctrl:!0,shift:!0})},methods:{onSelectionChange(e){const t=this.index,i=this.selectionStore.lastSelectedIndex;if(this.keyboardStore?.shiftKey&&i!==null){const n=this.selectedFiles.includes(this.source.source),o=Math.min(t,i),a=Math.max(i,t),c=this.selectionStore.lastSelection,l=this.nodes.map(_=>_.source).slice(o,a+1).filter(Boolean),d=[...c,...l].filter(_=>!n||_!==this.source.source);u.debug("Shift key pressed, selecting all files in between",{start:o,end:a,filesToSelect:l,isAlreadySelected:n}),this.selectionStore.set(d);return}const s=e?[...this.selectedFiles,this.source.source]:this.selectedFiles.filter(n=>n!==this.source.source);u.debug("Updating selection",{selection:s}),this.selectionStore.set(s),this.selectionStore.setLastIndex(t)},resetSelection(){this.selectionStore.reset()},onToggleSelect(){this.isActive&&(u.debug("Toggling selection for file",{source:this.source}),this.onSelectionChange(!this.isSelected))}}});function rn(e,t,i,s,n,o){const a=v("NcLoadingIcon"),c=v("NcCheckboxRadioSwitch");return r(),m("td",{class:"files-list__row-checkbox",onKeyup:t[0]||(t[0]=Be(qe((...l)=>e.resetSelection&&e.resetSelection(...l),["exact"]),["esc"]))},[e.isLoading?(r(),y(a,{key:0,name:e.loadingLabel},null,8,["name"])):(r(),y(c,{key:1,"aria-label":e.ariaLabel,modelValue:e.isSelected,"data-cy-files-list-row-checkbox":"","onUpdate:modelValue":e.onSelectionChange},null,8,["aria-label","modelValue","onUpdate:modelValue"]))],32)}const Wt=I(on,[["render",rn]]),We=X("renaming",()=>{const e=O(),t=O(""),i=O(!1);async function s(){if(e.value===void 0)throw new Error("No node is currently being renamed");const o=e.value.basename;let a=t.value.trim();if(a===o||i.value)return!1;i.value=!0;const c=le();let l=e.value;l.status=U.LOADING;try{if(c.userConfig.show_dialog_file_extension){const _=de(o),f=de(a);if(l.type===T.File&&_!==f&&!await an(_,f)&&(a=ve(a,f)+_,o===a)||!c.userConfig.show_hidden&&a.startsWith(".")&&!o.startsWith(".")&&!await ln(a))return!1}const d=l.encodedSource;return l.rename(a),u.debug("Moving file to",{destination:l.encodedSource,oldEncodedSource:d}),await ds({method:"MOVE",url:d,headers:{Destination:l.encodedSource,Overwrite:"F"}}),de(o)!==de(a)&&(l=await Ji(l.path)),G("files:node:updated",l),G("files:node:renamed",l),G("files:node:moved",{node:l,oldSource:`${St(l.source)}/${o}`}),e.value===l&&n(),!0}catch(d){if(u.error("Error while renaming file",{error:d}),l.rename(o),us(d)){if(d?.response?.status===404)throw new Error(h("files",'Could not rename "{oldName}", it does not exist any more',{oldName:o}),{cause:d});if(d?.response?.status===412)throw new Error(h("files",'The name "{newName}" is already used in the folder "{dir}". Please choose a different name.',{newName:a,dir:ve(e.value.dirname)}),{cause:d})}throw new Error(h("files",'Could not rename "{oldName}"',{oldName:o}),{cause:d})}finally{l.status=void 0,i.value=!1}}function n(){t.value="",e.value=void 0}return Z("files:node:rename",o=>{e.value=o,t.value=o.basename}),{$reset:n,newNodeName:t,rename:s,renamingNode:e}});async function an(e,t){return await Ct(It(()=>_t(()=>import("./DialogConfirmFileExtension-StSaqk8C.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]),import.meta.url)),{oldExtension:e,newExtension:t})}async function ln(e){return await Ct(It(()=>_t(()=>import("./DialogConfirmFileHidden-B8t2wxN3.chunk.mjs").then(t=>t.D),__vite__mapDeps([26,21,4,22,27,28,29,5,30,3,31,32,33,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,23,24,25,34]),import.meta.url)),{filename:e})}const cn=D({name:"FileEntryName",components:{NcTextField:as},directives:{onClickOutside:os},props:{basename:{type:String,required:!0},extension:{type:String,required:!0},source:{type:Object,required:!0}},setup(){const{isNarrow:e}=q(),t=We(),i=le(),{activeFolder:s,activeView:n}=R(),o=ze("defaultFileAction");return{activeFolder:s,activeView:n,defaultFileAction:o,isNarrow:e,renamingStore:t,userConfigStore:i}},computed:{isRenaming(){return this.renamingStore.renamingNode===this.source},isRenamingSmallScreen(){return this.isRenaming&&this.isNarrow},newName:{get(){return this.renamingStore.newNodeName},set(e){this.renamingStore.newNodeName=e}},renameLabel(){return{[T.File]:h("files","Filename"),[T.Folder]:h("files","Folder name")}[this.source.type]},linkTo(){if(this.source.status===U.FAILED)return{is:"span",params:{title:h("files","{displayName} (unavailable)",{displayName:this.source.displayname})}};if(this.defaultFileAction){const e=`${this.defaultFileAction.displayName({nodes:[this.source],view:this.activeView,folder:this.activeFolder,contents:[]})}: ${this.source.displayname}`;return{is:"button",params:{"aria-label":e,title:e,tabindex:"0"}}}return{is:"span"}}},watch:{isRenaming:{immediate:!0,handler(e){e&&this.startRenaming()}},newName(){const e=this.newName.trim?.()||"",t=this.$refs.renameInput?.$el.querySelector("input");if(!t)return;let i=Ee(e,!1,this.source.type===T.Folder);i===""&&this.checkIfNodeExists(e)&&(i=h("files","Another entry with the same name already exists.")),this.$nextTick(()=>{this.isRenaming&&(t.setCustomValidity(i),t.reportValidity())})}},methods:{checkIfNodeExists(e){return(this.activeFolder?._children||[]).some(t=>ve(t)===e)},startRenaming(){this.$nextTick(()=>{const e=this.$refs.renameInput?.$el.querySelector("input");if(!e){u.error("Could not find the rename input");return}e.focus();const t=this.source.basename.length-(this.source.extension??"").length;e.setSelectionRange(0,t),e.dispatchEvent(new Event("keyup"))})},stopRenaming(){this.isRenaming&&this.renamingStore.$reset()},async onRename(){const e=this.newName.trim?.()||"";if(!this.$refs.renameForm.checkValidity()){L(h("files","Invalid filename.")+" "+Ee(e));return}const t=this.source.basename;if(e===t){this.stopRenaming();return}try{await this.renamingStore.rename()&&this.$nextTick(()=>{this.$refs.basename?.focus()})}catch(i){u.error(i),L(i.message),this.startRenaming()}},t:h}}),dn=["aria-label"],un={class:"files-list__row-name-text",dir:"auto"},hn=["textContent"],fn=["textContent"];function pn(e,t,i,s,n,o){const a=v("NcTextField"),c=Li("on-click-outside");return e.isRenaming?Fe((r(),m("form",{key:0,ref:"renameForm","aria-label":e.t("files","Rename file"),class:"files-list__row-rename",onSubmit:t[1]||(t[1]=qe((...l)=>e.onRename&&e.onRename(...l),["prevent","stop"]))},[b(a,{ref:"renameInput",modelValue:e.newName,"onUpdate:modelValue":t[0]||(t[0]=l=>e.newName=l),label:e.renameLabel,autofocus:"",required:"",minlength:1,enterkeyhint:"done",onKeyup:Be(e.stopRenaming,["esc"])},null,8,["modelValue","label","onKeyup"])],40,dn)),[[c,e.onRename]]):(r(),y(ie(e.linkTo.is),se({key:1,ref:"basename",class:"files-list__row-name-link","data-cy-files-list-row-name-link":""},e.linkTo.params),{default:w(()=>[S("span",un,[S("span",{class:"files-list__row-name-",textContent:C(e.basename)},null,8,hn),e.userConfigStore.userConfig.show_files_extensions?(r(),m("span",{key:0,class:"files-list__row-name-ext",textContent:C(e.extension)},null,8,fn)):F("",!0)])]),_:1},16))}const Gt=I(cn,[["render",pn],["__scopeId","data-v-856e39fd"]]),mn={name:"CollectivesIcon",props:{title:{type:String,default:""},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},gn=["aria-hidden","aria-label"],vn=["fill","width","height"];function yn(e,t,i,s,n,o){return r(),m("span",se({"aria-hidden":!i.title,"aria-label":i.title,class:"material-design-icon collectives-icon",role:"img"},e.$attrs,{onClick:t[0]||(t[0]=a=>e.$emit("click",a))}),[(r(),m("svg",{fill:i.fillColor,class:"material-design-icon__svg",width:i.size,height:i.size,viewBox:"0 0 16 16"},[...t[1]||(t[1]=[Mi('<path d="M2.9,8.8c0-1.2,0.4-2.4,1.2-3.3L0.3,6c-0.2,0-0.3,0.3-0.1,0.4l2.7,2.6C2.9,9,2.9,8.9,2.9,8.8z"></path><path d="M8,3.7c0.7,0,1.3,0.1,1.9,0.4L8.2,0.6c-0.1-0.2-0.3-0.2-0.4,0L6.1,4C6.7,3.8,7.3,3.7,8,3.7z"></path><path d="M3.7,11.5L3,15.2c0,0.2,0.2,0.4,0.4,0.3l3.3-1.7C5.4,13.4,4.4,12.6,3.7,11.5z"></path><path d="M15.7,6l-3.7-0.5c0.7,0.9,1.2,2,1.2,3.3c0,0.1,0,0.2,0,0.3l2.7-2.6C15.9,6.3,15.9,6.1,15.7,6z"></path><path d="M12.3,11.5c-0.7,1.1-1.8,1.9-3,2.2l3.3,1.7c0.2,0.1,0.4-0.1,0.4-0.3L12.3,11.5z"></path><path d="M9.6,10.1c-0.4,0.5-1,0.8-1.6,0.8c-1.1,0-2-0.9-2.1-2C5.9,7.7,6.8,6.7,8,6.7c0.6,0,1.1,0.3,1.5,0.7 c0.1,0.1,0.1,0.1,0.2,0.1h1.4c0.2,0,0.4-0.2,0.3-0.5c-0.7-1.3-2.1-2.2-3.8-2.1C5.8,5,4.3,6.6,4.1,8.5C4,10.8,5.8,12.7,8,12.7 c1.6,0,2.9-0.9,3.5-2.3c0.1-0.2-0.1-0.4-0.3-0.4H9.9C9.8,10,9.7,10,9.6,10.1z"></path>',6)])],8,vn))],16,gn)}const pt=I(mn,[["render",yn]]),wn=D({name:"FavoriteIcon",components:{NcIconSvgWrapper:z},data(){return{StarSvg:ns}},async mounted(){await this.$nextTick(),this.$el.querySelector("svg")?.setAttribute?.("viewBox","-4 -4 30 30")},methods:{t:h}});function bn(e,t,i,s,n,o){const a=v("NcIconSvgWrapper");return r(),y(a,{class:"favorite-marker-icon",name:e.t("files","Favorite"),svg:e.StarSvg},null,8,["name","svg"])}const _n=I(wn,[["render",bn],["__scopeId","data-v-ac7891d3"]]),Sn=D({name:"RecentlyCreatedIcon",components:{NcIconSvgWrapper:z},setup(){return{mdiPlus:yi}},methods:{t:h}});function Fn(e,t,i,s,n,o){const a=v("NcIconSvgWrapper");return r(),y(a,{class:"recently-created-marker-icon",name:e.t("files","Recently created"),path:e.mdiPlus},null,8,["name","path"])}const Cn=I(Sn,[["render",Fn],["__scopeId","data-v-6f999497"]]),An=D({name:"FileEntryPreview",components:{AccountGroupIcon:st,AccountPlusIcon:Ie,CollectivesIcon:pt,FavoriteIcon:_n,FileIcon:hs,FolderIcon:Ft,FolderOpenIcon:Si,KeyIcon:it,LinkIcon:at,NetworkIcon:tt,TagIcon:et,RecentlyCreatedIcon:Cn},props:{source:{type:Object,required:!0},dragover:{type:Boolean,default:!1},gridMode:{type:Boolean,default:!1}},setup(e){const t=le(),i=fs(Ei(e,"source"),k(()=>({crop:t.userConfig.crop_image_previews===!0,size:e.gridMode?128:32})));return{userConfigStore:t,previewUrl:i}},data(){return{backgroundFailed:void 0,backgroundLoaded:!1}},computed:{isFavorite(){return this.source.attributes.favorite===1},isRecentlyCreated(){if(!this.source.crtime)return!1;const e=new Date;return e.setDate(e.getDate()-1),this.source.crtime>e},isRecentView(){return this.$route?.params?.view==="recent"},userConfig(){return this.userConfigStore.userConfig},fileOverlay(){return Ki(this.source)?Fi:null},folderOverlay(){if(this.source.type!==T.Folder)return null;if(this.source?.attributes?.["is-encrypted"]===1)return it;if(this.source?.attributes?.["is-tag"])return et;const e=Object.values(this.source?.attributes?.["share-types"]||{}).flat();if(e.some(t=>t===Me.Link||t===Me.Email))return at;if(e.length>0)return Ie;switch(this.source?.attributes?.["mount-type"]){case"external":case"external-session":return tt;case"group":return st;case"collective":return pt;case"shared":return Ie}return null},hasBlurhash(){return this.source.attributes["metadata-blurhash"]!==void 0}},mounted(){this.hasBlurhash&&this.$refs.canvas&&this.drawBlurhash()},methods:{reset(){this.backgroundFailed=void 0,this.backgroundLoaded=!1;const e=this.$refs.previewImg;e&&(e.src="")},onBackgroundLoad(){this.backgroundFailed=!1,this.backgroundLoaded=!0},onBackgroundError(e){e.target?.src!==""&&(this.backgroundFailed=!0,this.backgroundLoaded=!1)},drawBlurhash(){const e=this.$refs.canvas,t=e.width,i=e.height,s=di(this.source.attributes["metadata-blurhash"],t,i),n=e.getContext("2d");if(n===null){u.error("Cannot create context for blurhash canvas");return}const o=n.createImageData(t,i);o.data.set(s),n.putImageData(o,0,0)},t:h}}),kn={class:"files-list__row-icon"},Nn={key:1,class:"files-list__row-icon-preview-container"},xn={key:0,ref:"canvas",class:"files-list__row-icon-blurhash","aria-hidden":"true"},In=["src"],Dn={key:3,class:"files-list__row-icon-favorite"},Ln={key:4,class:"files-list__row-icon-recently-created"};function Mn(e,t,i,s,n,o){const a=v("FolderOpenIcon"),c=v("FolderIcon"),l=v("FileIcon"),d=v("FavoriteIcon"),_=v("RecentlyCreatedIcon");return r(),m("span",kn,[e.source.type==="folder"?(r(),m(x,{key:0},[t[0]||(ue(-1,!0),(t[0]=e.dragover?(r(),y(a,{key:0})):(r(),m(x,{key:1},[t[1]||(ue(-1,!0),(t[1]=b(c)).cacheIndex=1,ue(1),t[1]),e.folderOverlay?(r(),y(ie(e.folderOverlay),{key:0,class:"files-list__row-icon-overlay"})):F("",!0)],64))).cacheIndex=0,ue(1),t[0])],64)):e.previewUrl?(r(),m("span",Nn,[e.hasBlurhash&&(e.backgroundFailed===!0||!e.backgroundLoaded)?(r(),m("canvas",xn,null,512)):F("",!0),e.backgroundFailed!==!0?(r(),m("img",{key:e.source.fileid,ref:"previewImg",alt:"",class:A(["files-list__row-icon-preview",{"files-list__row-icon-preview--loaded":e.backgroundFailed===!1}]),loading:"lazy",src:e.previewUrl,onError:t[2]||(t[2]=(...f)=>e.onBackgroundError&&e.onBackgroundError(...f)),onLoad:t[3]||(t[3]=(...f)=>e.onBackgroundLoad&&e.onBackgroundLoad(...f))},null,42,In)):F("",!0)])):(r(),y(l,{key:2})),e.isFavorite?(r(),m("span",Dn,[b(d)])):e.isRecentView&&e.isRecentlyCreated?(r(),m("span",Ln,[b(_)])):F("",!0),e.fileOverlay?(r(),y(ie(e.fileOverlay),{key:5,class:"files-list__row-icon-overlay files-list__row-icon-overlay--file"})):F("",!0)])}const Qt=I(An,[["render",Mn]]),Ge=X("actionsmenu",{state:()=>({opened:null})});function Yt(e,t=0){const i=e.filter(o=>o.type===T.File).length,s=e.filter(o=>o.type===T.Folder).length,n=[];if(i>0||s===0){const o=fe("files","%n file","%n files",i);n.push(o)}if(s>0){const o=fe("files","%n folder","%n folders",s);n.push(o)}if(t>0){const o=fe("files","%n hidden","%n hidden",t);n.push(o)}return n.join(" · ")}const En=D({name:"DragAndDropPreview",components:{FileMultipleIcon:Ci,FolderIcon:Ft},emits:["loaded"],data(){return{nodes:[]}},computed:{isSingleNode(){return this.nodes.length===1},isSingleFolder(){return this.isSingleNode&&this.nodes[0].type===T.Folder},name(){return this.size?`${this.summary} – ${this.size}`:this.summary},size(){const e=this.nodes.reduce((i,s)=>i+s.size||0,0),t=parseInt(e,10)||0;return typeof t!="number"||t<0?null:re(t,!0)},summary(){if(this.isSingleNode){const e=this.nodes[0];return e.attributes?.displayname||e.basename}return Yt(this.nodes)}},methods:{update(e){this.nodes=e,this.$refs.previewImg.replaceChildren(),e.slice(0,3).forEach(t=>{const i=document.querySelector(`[data-cy-files-list-row-fileid="${t.fileid}"] .files-list__row-icon img`);i&&this.$refs.previewImg.appendChild(i.parentNode.cloneNode(!0))}),this.$nextTick(()=>{this.$emit("loaded",this.$el)})}}}),Vn={class:"files-list-drag-image"},$n={class:"files-list-drag-image__icon"},Tn={ref:"previewImg"},Rn={class:"files-list-drag-image__name"};function On(e,t,i,s,n,o){const a=v("FolderIcon"),c=v("FileMultipleIcon");return r(),m("div",Vn,[S("span",$n,[S("span",Tn,null,512),e.isSingleFolder?(r(),y(a,{key:0})):(r(),y(c,{key:1}))]),S("span",Rn,C(e.name),1)])}const zn=I(En,[["render",On]]);let De,mt;async function Bn(e){return new Promise(t=>{if(!De){const i=document.createElement("div");document.body.appendChild(i),De=Vi(zn,{onLoaded:s=>mt?.(s)}).mount(i)}mt=t,De.update(e)})}const Xt=D({props:{source:{type:[Vt,ts,is],required:!0},nodes:{type:Array,required:!0},isMtimeAvailable:{type:Boolean,default:!1},compact:{type:Boolean,default:!1}},provide(){return{defaultFileAction:k(()=>this.defaultFileAction),enabledFileActions:k(()=>this.enabledFileActions)}},data(){return{dragover:!1,gridMode:!1}},computed:{fileid(){return this.source.fileid??0},uniqueId(){return Wi(this.source.source)},isLoading(){return this.source.status===U.LOADING},displayName(){return this.source.displayname||this.source.basename},basename(){return this.extension===""?this.displayName:this.displayName.slice(0,0-this.extension.length)},extension(){return this.source.type===T.Folder?"":oe.extname(this.displayName)},draggingFiles(){return this.draggingStore.dragging},selectedFiles(){return this.selectionStore.selected},isSelected(){return this.selectedFiles.includes(this.source.source)},isRenaming(){return this.renamingStore.renamingNode===this.source},isRenamingSmallScreen(){return this.isRenaming&&this.isNarrow},isActive(){return String(this.fileid)===String(this.currentRouteFileId)},isFailedSource(){return this.source.status===U.FAILED},canDrag(){if(this.isRenaming||this.isFailedSource)return!1;const e=t=>(t?.permissions&Q.UPDATE)!==0;return this.selectedFiles.length>0?this.selectedFiles.map(t=>this.filesStore.getNode(t)).every(e):e(this.source)},canDrop(){return this.source.type!==T.Folder||this.isFailedSource||this.draggingFiles.includes(this.source.source)?!1:(this.source.permissions&Q.CREATE)!==0},openedMenu:{get(){return this.actionsMenuStore.opened===this.uniqueId.toString()},set(e){e===!1&&this.actionsMenuStore.opened!==this.uniqueId.toString()||(this.actionsMenuStore.opened=e?this.uniqueId.toString():null)}},mtime(){return this.source.mtime&&!isNaN(this.source.mtime.getDate())?this.source.mtime:this.source.crtime&&!isNaN(this.source.crtime.getDate())?this.source.crtime:null},mtimeOpacity(){if(!this.mtime)return{};const e=744*60*60*1e3,t=Date.now()-this.mtime.getTime();if(t<0)return{};const i=Math.max(0,e-t);return{color:`color-mix(in srgb, var(--color-main-text) ${Math.round(i*100/e)}%, var(--color-text-maxcontrast))`}},enabledFileActions(){return this.source.status===U.FAILED?[]:this.actions.filter(e=>{if(!e.enabled)return!0;try{return e.enabled({nodes:[this.source],view:this.activeView,folder:this.activeFolder,contents:this.nodes})}catch(t){return u.error("Error while checking action",{action:e,error:t}),!1}}).sort((e,t)=>(e.order||0)-(t.order||0))},defaultFileAction(){return this.enabledFileActions.find(e=>e.default!==void 0)}},watch:{source(e,t){e.source!==t.source&&this.resetState()},openedMenu(){if(this.actionsMenuStore.opened===null){u.debug("All actions menu closed, resetting right menu position...");const e=this.$el?.closest("main.app-content");e!==null&&(e.style.removeProperty("--mouse-pos-x"),e.style.removeProperty("--mouse-pos-y"))}}},beforeUnmount(){this.resetState()},methods:{resetState(){this.$refs?.preview?.reset?.(),this.openedMenu=!1},onRightClick(e){if(this.openedMenu||this.isFailedSource)return;if(this.gridMode){const i=this.$el?.closest("main.app-content");i.style.removeProperty("--mouse-pos-x"),i.style.removeProperty("--mouse-pos-y")}else{const i=this.$el?.closest("main.app-content"),s=i.getBoundingClientRect();u.debug("Setting actions menu position..."),i.style.setProperty("--mouse-pos-x",Math.max(0,e.clientX-s.left-200)+"px"),i.style.setProperty("--mouse-pos-y",Math.max(0,e.clientY-s.top)+"px")}const t=this.selectedFiles.length>1;this.actionsMenuStore.opened=this.isSelected&&t?"global":this.uniqueId.toString(),e.preventDefault(),e.stopPropagation()},execDefaultAction(e){if(this.isRenaming||e.button&2||e.button>4||this.isFailedSource)return;const t=e.ctrlKey||e.metaKey||e.button===1;if(t||!this.defaultFileAction){if(!ji(this.source))return;const i=bt()?this.source.encodedSource:ai("/f/{fileId}",{fileId:this.fileid});e.preventDefault(),e.stopPropagation(),window.open(i,t?"_blank":"_self");return}e.preventDefault(),e.stopPropagation(),this.defaultFileAction.exec({nodes:[this.source],folder:this.activeFolder,contents:this.nodes,view:this.activeView})},openDetailsIfAvailable(e){e.preventDefault(),e.stopPropagation(),ot?.enabled?.({nodes:[this.source],folder:this.activeFolder,contents:this.nodes,view:this.activeView})&&ot.exec({nodes:[this.source],folder:this.activeFolder,contents:this.nodes,view:this.activeView})},onDragOver(e){if(this.dragover=this.canDrop,!this.canDrop){e.dataTransfer.dropEffect="none";return}e.ctrlKey?e.dataTransfer.dropEffect="copy":e.dataTransfer.dropEffect="move"},onDragLeave(e){e.currentTarget?.contains(e.relatedTarget)||(this.dragover=!1)},async onDragStart(e){if(e.stopPropagation(),!this.canDrag||!this.fileid){e.preventDefault(),e.stopPropagation();return}u.debug("Drag started",{event:e}),e.dataTransfer?.clearData?.(),this.renamingStore.$reset(),this.selectedFiles.includes(this.source.source)?this.draggingStore.set(this.selectedFiles):this.draggingStore.set([this.source.source]);const t=this.draggingStore.dragging.map(s=>this.filesStore.getNode(s)),i=await Bn(t);e.dataTransfer?.setDragImage(i,-10,-10)},onDragEnd(){this.draggingStore.reset(),this.dragover=!1,u.debug("Drag ended")},async onDrop(e){if(!this.draggingFiles&&!e.dataTransfer?.items?.length||(e.preventDefault(),e.stopPropagation(),!this.canDrop||e.button))return;const t=this.draggingFiles,i=Array.from(e.dataTransfer?.items||[]);if(t.length===0&&i.some(c=>c.kind==="file")){const c=await Pe(i);if(this.source.type!==T.Folder){u.error("onDrop: external drop target is not a Folder",{source:this.source}),this.dragover=!1;return}const l=this.filesStore.getNodesByPath(this.activeView.id,this.source.path),d=l.length===0?(await this.activeView.getContents(this.source.path)).contents:l;u.debug("Start uploading dropped files",{target:this.source.path,fileTree:c}),await He(c,this.source,d),this.dragover=!1;return}const s=this.filesStore.getNodesByPath(this.activeView.id,this.source.path),n=s.length===0?(await this.activeView.getContents(this.source.path)).contents:s,o=e.ctrlKey;this.dragover=!1,u.debug("Dropped",{event:e,folder:this.source,selection:t});const a=t.map(c=>this.filesStore.getNode(c));await Bt(a,this.source,n,o),t.some(c=>this.selectedFiles.includes(c))&&(u.debug("Dropped selection, resetting select store..."),this.selectionStore.reset())},t:h}}),qn=D({name:"FileEntry",components:{CustomElementRender:Ut,FileEntryActions:jt,FileEntryCheckbox:Wt,FileEntryName:Gt,FileEntryPreview:Qt,NcDateTime:At},mixins:[Xt],props:{isMimeAvailable:{type:Boolean,default:!1},isSizeAvailable:{type:Boolean,default:!1}},setup(){const e=Ge(),t=Ke(),i=ne(),s=We(),n=J(),{isNarrow:o}=q(),a=Ce(),{fileId:c}=ae(),l=R(),{activeFolder:d,activeNode:_,activeView:f}=Dt(l);return{actions:Ue(),activeFolder:d,activeNode:_,activeView:f,currentRouteFileId:c,isNarrow:o,layout:a,activeStore:l,actionsMenuStore:e,draggingStore:t,filesStore:i,renamingStore:s,selectionStore:n}},computed:{rowListeners(){return{...this.isRenaming?{}:{dragstart:this.onDragStart,dragover:this.onDragOver},contextmenu:this.onRightClick,dragleave:this.onDragLeave,dragend:this.onDragEnd,drop:this.onDrop}},columns(){return this.compact?[]:this.layout.columns},mime(){if(this.source.type===T.Folder)return this.t("files","Folder");if(!this.source.mime||this.source.mime==="application/octet-stream")return h("files","Unknown file type");if(window.OC?.MimeTypeList?.names?.[this.source.mime])return window.OC.MimeTypeList.names[this.source.mime];const e=this.source.mime.split("/")[0],t=this.source?.extension?.toUpperCase().replace(/^\./,"")||"";return e==="image"?h("files","{ext} image",{ext:t}):e==="video"?h("files","{ext} video",{ext:t}):e==="audio"?h("files","{ext} audio",{ext:t}):e==="text"?h("files","{ext} text",{ext:t}):this.source.mime},size(){const e=this.source.size;return e===void 0||isNaN(e)||e<0?this.t("files","Pending"):re(e,!0)},sizeOpacity(){const e=this.source.size;return e===void 0||isNaN(e)||e<0?{}:{color:`color-mix(in srgb, var(--color-main-text) ${Math.round(Math.min(100,100*Math.pow(e/10485760,2)))}%, var(--color-text-maxcontrast))`}}},created(){B("Enter",this.triggerDefaultAction)},methods:{formatFileSize:re,triggerDefaultAction(e){this.isActive&&(e?.preventDefault(),e?.stopPropagation(),this.defaultFileAction?.exec({nodes:[this.source],folder:this.activeFolder,contents:this.nodes,view:this.activeView}))},adaptColumnRenderToCustomElementRender(e){return({nodes:t,view:i})=>e.render(t[0],i)}}}),Un=["data-cy-files-list-row-fileid","data-cy-files-list-row-name","draggable"],Pn={key:0,class:"files-list__row--failed"},Hn={class:"files-list__row-name","data-cy-files-list-row-name":""},Kn=["title"],jn={key:1},Wn=["data-cy-files-list-row-column-custom"];function Gn(e,t,i,s,n,o){const a=v("FileEntryCheckbox"),c=v("FileEntryPreview"),l=v("FileEntryName"),d=v("FileEntryActions"),_=v("NcDateTime"),f=v("CustomElementRender");return r(),m("tr",se({class:[{"files-list__row--dragover":e.dragover,"files-list__row--loading":e.isLoading,"files-list__row--active":e.isActive},"files-list__row"],"data-cy-files-list-row":"","data-cy-files-list-row-fileid":e.fileid,"data-cy-files-list-row-name":e.source.basename,draggable:e.canDrag},$i(e.rowListeners,!0)),[e.isFailedSource?(r(),m("span",Pn)):F("",!0),b(a,{fileid:e.fileid,isLoading:e.isLoading,nodes:e.nodes,source:e.source},null,8,["fileid","isLoading","nodes","source"]),S("td",Hn,[b(c,{ref:"preview",source:e.source,dragover:e.dragover,onAuxclick:e.execDefaultAction,onClick:e.execDefaultAction},null,8,["source","dragover","onAuxclick","onClick"]),b(l,{ref:"name",basename:e.basename,extension:e.extension,source:e.source,onAuxclick:e.execDefaultAction,onClick:e.execDefaultAction},null,8,["basename","extension","source","onAuxclick","onClick"])]),Fe(b(d,{ref:"actions",opened:e.openedMenu,"onUpdate:opened":t[0]||(t[0]=p=>e.openedMenu=p),class:A(`files-list__row-actions-${e.uniqueId}`),source:e.source},null,8,["opened","class","source"]),[[Oe,!e.isRenamingSmallScreen]]),e.isMimeAvailable?(r(),m("td",{key:1,title:e.mime,class:"files-list__row-mime","data-cy-files-list-row-mime":"",onClick:t[1]||(t[1]=(...p)=>e.openDetailsIfAvailable&&e.openDetailsIfAvailable(...p))},[S("span",null,C(e.mime),1)],8,Kn)):F("",!0),!e.compact&&e.isSizeAvailable?(r(),m("td",{key:2,style:ye(e.sizeOpacity),class:"files-list__row-size","data-cy-files-list-row-size":"",onClick:t[2]||(t[2]=(...p)=>e.openDetailsIfAvailable&&e.openDetailsIfAvailable(...p))},[S("span",null,C(e.size),1)],4)):F("",!0),!e.compact&&e.isMtimeAvailable?(r(),m("td",{key:3,style:ye(e.mtimeOpacity),class:"files-list__row-mtime","data-cy-files-list-row-mtime":"",onClick:t[3]||(t[3]=(...p)=>e.openDetailsIfAvailable&&e.openDetailsIfAvailable(...p))},[e.mtime?(r(),y(_,{key:0,ignoreSeconds:"",timestamp:e.mtime},null,8,["timestamp"])):(r(),m("span",jn,C(e.t("files","Unknown date")),1))],4)):F("",!0),(r(!0),m(x,null,V(e.columns,p=>(r(),m("td",{key:p.id,class:A([`files-list__row-${e.activeView.id}-${p.id}`,"files-list__row-column-custom"]),"data-cy-files-list-row-column-custom":p.id,onClick:t[4]||(t[4]=(...g)=>e.openDetailsIfAvailable&&e.openDetailsIfAvailable(...g))},[b(f,{activeFolder:e.activeFolder,activeView:e.activeView,render:e.adaptColumnRenderToCustomElementRender(p),source:e.source},null,8,["activeFolder","activeView","render","source"])],10,Wn))),128))],16,Un)}const Qn=I(qn,[["render",Gn]]),Yn=D({name:"FileEntryGrid",components:{FileEntryActions:jt,FileEntryCheckbox:Wt,FileEntryName:Gt,FileEntryPreview:Qt,NcDateTime:At},mixins:[Xt],inheritAttrs:!1,setup(){const e=Ge(),t=Ke(),i=ne(),s=We(),n=J(),{isNarrow:o}=q(),{fileId:a}=ae(),c=R(),{activeFolder:l,activeNode:d,activeView:_}=Dt(c);return{actions:Ue(),actionsMenuStore:e,activeFolder:l,activeNode:d,activeView:_,currentRouteFileId:a,draggingStore:t,isNarrow:o,filesStore:i,renamingStore:s,selectionStore:n}},data(){return{gridMode:!0}}}),Xn=["data-cy-files-list-row-fileid","data-cy-files-list-row-name","draggable"],Jn={key:0,class:"files-list__row--failed"},Zn={class:"files-list__row-name","data-cy-files-list-row-name":""};function eo(e,t,i,s,n,o){const a=v("FileEntryCheckbox"),c=v("FileEntryPreview"),l=v("FileEntryName"),d=v("NcDateTime"),_=v("FileEntryActions");return r(),m("tr",{class:A([{"files-list__row--active":e.isActive,"files-list__row--dragover":e.dragover,"files-list__row--loading":e.isLoading},"files-list__row"]),"data-cy-files-list-row":"","data-cy-files-list-row-fileid":e.fileid,"data-cy-files-list-row-name":e.source.basename,draggable:e.canDrag,onContextmenu:t[2]||(t[2]=(...f)=>e.onRightClick&&e.onRightClick(...f)),onDragover:t[3]||(t[3]=(...f)=>e.onDragOver&&e.onDragOver(...f)),onDragleave:t[4]||(t[4]=(...f)=>e.onDragLeave&&e.onDragLeave(...f)),onDragstart:t[5]||(t[5]=(...f)=>e.onDragStart&&e.onDragStart(...f)),onDragend:t[6]||(t[6]=(...f)=>e.onDragEnd&&e.onDragEnd(...f)),onDrop:t[7]||(t[7]=(...f)=>e.onDrop&&e.onDrop(...f))},[e.isFailedSource?(r(),m("span",Jn)):F("",!0),b(a,{fileid:e.fileid,isLoading:e.isLoading,nodes:e.nodes,source:e.source},null,8,["fileid","isLoading","nodes","source"]),S("td",Zn,[b(c,{ref:"preview",dragover:e.dragover,gridMode:!0,source:e.source,onAuxclick:e.execDefaultAction,onClick:e.execDefaultAction},null,8,["dragover","source","onAuxclick","onClick"]),b(l,{ref:"name",basename:e.basename,extension:e.extension,source:e.source,onAuxclick:e.execDefaultAction,onClick:e.execDefaultAction},null,8,["basename","extension","source","onAuxclick","onClick"])]),!e.compact&&e.isMtimeAvailable?(r(),m("td",{key:1,style:ye(e.mtimeOpacity),class:"files-list__row-mtime","data-cy-files-list-row-mtime":"",onClick:t[0]||(t[0]=(...f)=>e.openDetailsIfAvailable&&e.openDetailsIfAvailable(...f))},[e.mtime?(r(),y(d,{key:0,ignoreSeconds:"",timestamp:e.mtime},null,8,["timestamp"])):F("",!0)],4)):F("",!0),b(_,{ref:"actions",opened:e.openedMenu,"onUpdate:opened":t[1]||(t[1]=f=>e.openedMenu=f),class:A(`files-list__row-actions-${e.uniqueId}`),gridMode:!0,source:e.source},null,8,["opened","class","source"])],42,Xn)}const to=I(Yn,[["render",eo]]),io=["aria-label"],so=D({__name:"FileListFilterChips",setup(e){const t=je(),i=k(()=>t.activeChips);return(s,n)=>i.value.length>0?(r(),m("ul",{key:0,class:A(s.$style.fileListFilterChips),"aria-label":N(h)("files","Active filters")},[(r(!0),m(x,null,V(i.value,(o,a)=>(r(),m("li",{key:a},[b(N(ms),{"aria-label-close":N(h)("files","Remove filter"),iconSvg:o.icon,text:o.text,onClose:o.onclick},Re({_:2},[o.user?{name:"icon",fn:w(()=>[b(N(rs),{disableMenu:"",hideStatus:"",size:24,user:o.user},null,8,["user"])]),key:"0"}:void 0]),1032,["aria-label-close","iconSvg","text","onClose"])]))),128))],10,io)):F("",!0)}}),no="_fileListFilterChips_qelmm_2",oo={fileListFilterChips:no},ro={$style:oo},ao=I(so,[["__cssModules",ro]]),lo=D({__name:"FileListFilterToSearch",setup(e){const t=Zi(gs),i=k(()=>t.query.length>=3&&t.scope==="filter");function s(){t.scope="globally"}return(n,o)=>i.value?(r(),y(N(j),{key:0,size:"small",onClick:s},{default:w(()=>[$(C(N(h)("files","Search everywhere")),1)]),_:1})):F("",!0)}}),co={name:"FilesListHeader",props:{header:{type:Object,required:!0},currentFolder:{type:Object,required:!0},currentView:{type:Object,required:!0}},setup(){return{queue:new vs({concurrency:1})}},computed:{enabled(){return this.header.enabled?.(this.currentFolder,this.currentView)??!0}},watch:{enabled(e){e&&(u.debug(`Enabled ${this.header.id} FilesListHeader`,{header:this.header}),this.queueUpdate(this.currentFolder,this.currentView))},currentFolder(e){this.queueUpdate(e,this.currentView)},currentView(e){this.queueUpdate(this.currentFolder,e)}},mounted(){u.debug(`Mounted ${this.header.id} FilesListHeader`,{header:this.header});const e=()=>this.header.render(this.$refs.mount,this.currentFolder,this.currentView);this.queue.add(e).then(()=>{u.debug(`Rendered ${this.header.id} FilesListHeader`,{header:this.header})}).catch(t=>{u.error(`Error rendering ${this.header.id} FilesListHeader`,{header:this.header,error:t})})},unmounted(){u.debug(`Destroyed ${this.header.id} FilesListHeader`,{header:this.header})},methods:{queueUpdate(e,t){this.queue.add(()=>this.header.updated(e,t)).then(()=>{u.debug(`Updated ${this.header.id} FilesListHeader`,{header:this.header})}).catch(i=>{u.error(`Error updating ${this.header.id} FilesListHeader`,{header:this.header,error:i})})}}},uo={ref:"mount"};function ho(e,t,i,s,n,o){return Fe((r(),m("div",{class:A(`files-list__header-${i.header.id}`)},[S("span",uo,null,512)],2)),[[Oe,o.enabled]])}const fo=I(co,[["render",ho]]),po={class:"files-list__row-checkbox"},mo={class:"hidden-visually"},go={class:"files-list__row-name"},vo={key:0,class:"files-list__column files-list__row-mime"},yo={key:1,class:"files-list__column files-list__row-size"},wo={key:2,class:"files-list__column files-list__row-mtime"},bo=D({__name:"FilesListTableFooter",props:{currentView:{},isMimeAvailable:{type:Boolean},isMtimeAvailable:{type:Boolean},isSizeAvailable:{type:Boolean},nodes:{},summary:{}},setup(e){const t=e,i=R(),s=Ce(),n=k(()=>i.activeFolder),o=k(()=>s.value.columns),a=k(()=>n.value?.size?re(n.value.size,!0):re(t.nodes.reduce((l,d)=>l+(d.size??0),0),!0));function c(l){return{"files-list__row-column-custom":!0,[`files-list__row-${t.currentView.id}-${l.id}`]:!0}}return(l,d)=>(r(),m("tr",null,[S("th",po,[S("span",mo,C(N(h)("files","Total rows summary")),1)]),S("td",go,[d[0]||(d[0]=S("span",{class:"files-list__row-icon"},null,-1)),S("span",null,C(e.summary),1)]),d[1]||(d[1]=S("td",{class:"files-list__row-actions"},null,-1)),e.isMimeAvailable?(r(),m("td",vo)):F("",!0),e.isSizeAvailable?(r(),m("td",yo,[S("span",null,C(a.value),1)])):F("",!0),e.isMtimeAvailable?(r(),m("td",wo)):F("",!0),(r(!0),m(x,null,V(o.value,_=>(r(),m("th",{key:_.id,class:A(c(_))},[S("span",null,C(_.summary?.(e.nodes,e.currentView)),1)],2))),128))]))}}),_o=I(bo,[["__scopeId","data-v-a3740f2e"]]),So=D({name:"FilesListTableHeaderActions",components:{ArrowLeftIcon:kt,NcActions:$e,NcActionButton:_e,NcActionSeparator:$t,NcIconSvgWrapper:z,NcLoadingIcon:Se},mixins:[Kt],props:{currentView:{type:Object,required:!0},selectedNodes:{type:Array,default:()=>[]}},setup(){const{activeFolder:e}=R(),t=Ge(),i=ne(),s=J(),{isMedium:n,isNarrow:o}=q(),a=document.getElementById("app-content-vue"),c=k(()=>o.value?0:n.value?1:3);return{actions:Ue(),actionsMenuStore:t,activeFolder:e,filesStore:i,selectionStore:s,boundariesElement:a,inlineActions:c}},data(){return{loading:null}},computed:{enabledFileActions(){return this.actions.filter(e=>!e.renderInline).filter(e=>e.default!==yt.HIDDEN).filter(e=>e.execBatch||!e.parent).filter(e=>!e.enabled||e.enabled(this.actionContext)).sort((e,t)=>(e.order||0)-(t.order||0))},enabledInlineActions(){return this.enabledFileActions.filter(e=>e.parent===void 0).filter(e=>e.execBatch!==void 0).filter(e=>!this.isValidMenu(e)).slice(0,this.inlineActions)},enabledMenuActions(){if(this.openedSubmenu)return this.enabledInlineActions;const e=this.enabledFileActions.filter((s,n,o)=>n===o.findIndex(a=>a.id===s.id)),t=e.filter(s=>s.parent).filter(s=>s.execBatch).map(s=>s.parent),i=e.filter(s=>s.execBatch?!s.parent:t.includes(s.id)).filter(s=>!this.enabledInlineActions.includes(s));return[...this.enabledInlineActions,...i]},actionContext(){return{nodes:this.nodes,view:this.currentView,folder:this.activeFolder,contents:this.nodes}},nodes(){return this.selectedNodes.map(e=>this.getNode(e)).filter(Boolean)},areSomeNodesLoading(){return this.nodes.some(e=>e.status===U.LOADING)},openedMenu:{get(){return this.actionsMenuStore.opened==="global"},set(e){this.actionsMenuStore.opened=e?"global":null}}},methods:{getNode(e){return this.filesStore.getNode(e)},async onActionClick(e){if(this.enabledSubmenuActions[e.id]){this.openedSubmenu=e;return}let t=e.id;try{t=e.displayName(this.actionContext)}catch(s){u.error("Error while getting action display name",{action:e,error:s})}const i=this.selectedNodes;try{this.loading=e.id,this.nodes.forEach(n=>{n.status=U.LOADING});const s=await e.execBatch(this.actionContext);if(!s.some(n=>n!==null)){this.selectionStore.reset();return}if(s.some(n=>n===!1)){const n=i.filter((o,a)=>s[a]===!1);if(this.selectionStore.set(n),s.some(o=>o===null))return;L(this.t("files","{displayName}: failed on some elements",{displayName:t}));return}be(this.t("files","{displayName}: done",{displayName:t})),this.selectionStore.reset()}catch(s){u.error("Error while executing action",{action:e,e:s}),L(this.t("files","{displayName}: failed",{displayName:t}))}finally{this.loading=null,this.nodes.forEach(s=>{s.status=void 0})}},t:h}}),Fo={class:"files-list__column files-list__row-actions-batch","data-cy-files-list-selection-actions":""};function Co(e,t,i,s,n,o){const a=v("NcLoadingIcon"),c=v("NcIconSvgWrapper"),l=v("NcActionButton"),d=v("ArrowLeftIcon"),_=v("NcActionSeparator"),f=v("NcActions");return r(),m("div",Fo,[b(f,{ref:"actionsMenu",open:e.openedMenu,"onUpdate:open":t[1]||(t[1]=p=>e.openedMenu=p),container:"#app-content-vue",boundariesElement:e.boundariesElement,disabled:!!e.loading||e.areSomeNodesLoading,forceName:!0,inline:e.enabledInlineActions.length,menuName:e.enabledInlineActions.length<=1?e.t("files","Actions"):void 0,onClose:t[2]||(t[2]=p=>e.openedSubmenu=null)},{default:w(()=>[(r(!0),m(x,null,V(e.enabledMenuActions,p=>(r(),y(l,{key:p.id,ref_for:!0,ref:`action-batch-${p.id}`,class:A({[`files-list__row-actions-batch-${p.id}`]:!0,"files-list__row-actions-batch--menu":e.isValidMenu(p)}),closeAfterClick:!e.isValidMenu(p),"data-cy-files-list-selection-action":p.id,isMenu:e.isValidMenu(p),"aria-label":p.displayName(e.actionContext)+" "+e.t("files","(selected)"),title:p.title?.(e.actionContext),onClick:g=>e.onActionClick(p)},{icon:w(()=>[e.loading===p.id?(r(),y(a,{key:0,size:18})):(r(),y(c,{key:1,svg:p.iconSvgInline(e.actionContext)},null,8,["svg"]))]),default:w(()=>[$(" "+C(p.displayName(e.actionContext)),1)]),_:2},1032,["class","closeAfterClick","data-cy-files-list-selection-action","isMenu","aria-label","title","onClick"]))),128)),e.openedSubmenu&&e.enabledSubmenuActions[e.openedSubmenu?.id]?(r(),m(x,{key:0},[b(l,{class:"files-list__row-actions-batch-back","data-cy-files-list-selection-action":"menu-back",onClick:t[0]||(t[0]=p=>e.onBackToMenuClick(e.openedSubmenu))},{icon:w(()=>[b(d)]),default:w(()=>[$(" "+C(e.t("files","Back")),1)]),_:1}),b(_),(r(!0),m(x,null,V(e.enabledSubmenuActions[e.openedSubmenu?.id],p=>(r(),y(l,{key:p.id,class:A([`files-list__row-actions-batch-${p.id}`,"files-list__row-actions-batch--submenu"]),closeAfterClick:"","data-cy-files-list-selection-action":p.id,"aria-label":p.displayName(e.actionContext)+" "+e.t("files","(selected)"),title:p.title?.(e.actionContext),onClick:g=>e.onActionClick(p)},{icon:w(()=>[e.loading===p.id?(r(),y(a,{key:0,size:18})):(r(),y(c,{key:1,svg:p.iconSvgInline(e.actionContext)},null,8,["svg"]))]),default:w(()=>[$(" "+C(p.displayName(e.actionContext)),1)]),_:2},1032,["class","data-cy-files-list-selection-action","aria-label","title","onClick"]))),128))],64)):F("",!0)]),_:1},8,["open","boundariesElement","disabled","inline","menuName"])])}const Ao=I(So,[["render",Co],["__scopeId","data-v-15ebb763"]]);function Qe(){const e=R(),t=Lt(),i=k(()=>e.activeView&&(t.getConfig(e.activeView.id)?.sorting_mode||e.activeView?.defaultSortKey)||"basename"),s=k(()=>e.activeView?t.getConfig(e.activeView.id)?.sorting_direction!=="desc":!0);function n(o){if(i.value===o){t.toggleSortingDirection(e.activeView?.id);return}t.setSortingBy(o,e.activeView?.id)}return{toggleSortBy:n,sortingMode:i,isAscSorting:s}}const ko={class:"files-list__column-sort-button-text"},No=D({__name:"FilesListTableHeaderButton",props:{name:{},mode:{}},setup(e){const{sortingMode:t,isAscSorting:i,toggleSortBy:s}=Qe();return(n,o)=>(r(),y(N(j),{class:A(["files-list__column-sort-button",[{"files-list__column-sort-button--active":N(t)===e.mode,"files-list__column-sort-button--size":N(t)==="size"}]]),alignment:e.mode==="size"?"end":"start-reverse",variant:"tertiary",title:e.name,onClick:o[0]||(o[0]=a=>N(s)(e.mode))},{icon:w(()=>[N(t)!==e.mode||N(i)?(r(),y(ls,{key:0,class:"files-list__column-sort-button-icon"})):(r(),y(cs,{key:1,class:"files-list__column-sort-button-icon"}))]),default:w(()=>[S("span",ko,C(e.name),1)]),_:1},8,["class","alignment","title"]))}}),xo=I(No,[["__scopeId","data-v-1f8a7bc2"]]),Io=D({name:"FilesListTableHeader",components:{FilesListTableHeaderActions:Ao,FilesListTableHeaderButton:xo,NcCheckboxRadioSwitch:Tt},props:{currentView:{type:Object,required:!0},isMimeAvailable:{type:Boolean,default:!1},isMtimeAvailable:{type:Boolean,default:!1},isSizeAvailable:{type:Boolean,default:!1},nodes:{type:Array,required:!0}},setup(){const e=R(),t=ne(),i=J(),{directory:s}=ae(),n=Ce();return{activeStore:e,filesStore:t,selectionStore:i,directory:s,layout:n,...Qe()}},computed:{columns(){return this.layout.columns},dir(){return this.directory.replace(/^(.+)\/$/,"$1")},selectAllBind(){const e=h("files","Toggle selection for all files and folders");return{"aria-label":e,indeterminate:this.isSomeSelected,modelValue:this.isAllSelected,title:e}},selectedNodes(){return this.selectionStore.selected},isAllSelected(){return this.selectedNodes.length===this.nodes.length},isNoneSelected(){return this.selectedNodes.length===0},isSomeSelected(){return!this.isAllSelected&&!this.isNoneSelected}},created(){B("a",this.onToggleAll,{ctrl:!0,stop:!0,prevent:!0}),B("Escape",this.resetSelection,{stop:!0,prevent:!0})},methods:{ariaSortForMode(e){if(this.sortingMode===e)return this.isAscSorting?"ascending":"descending"},classForColumn(e){return{"files-list__column":!0,"files-list__column--sortable":!!e.sort,"files-list__row-column-custom":!0,[`files-list__row-${this.activeStore.activeView?.id}-${e.id}`]:!0,"hidden-visually":!this.isNoneSelected}},onToggleAll(e=!0){if(e){const t=this.nodes.map(i=>i.source).filter(Boolean);u.debug("Added all nodes to selection",{selection:t}),this.selectionStore.setLastIndex(null),this.selectionStore.set(t)}else u.debug("Cleared selection"),this.selectionStore.reset()},resetSelection(){this.isNoneSelected||this.selectionStore.reset()},n:fe,t:h}}),Do={class:"files-list__selected"},Lo=["aria-sort","inert"],Mo=["inert"],Eo={class:"hidden-visually"},Vo=["aria-sort","inert"],$o=["aria-sort","inert"],To=["aria-sort","inert"],Ro=["aria-sort","inert"],Oo={key:1};function zo(e,t,i,s,n,o){const a=v("NcCheckboxRadioSwitch"),c=v("FilesListTableHeaderActions"),l=v("FilesListTableHeaderButton");return r(),m("tr",{class:A(["files-list__row-head",{"files-list__row-head--selected":!e.isNoneSelected}])},[S("th",{class:"files-list__column files-list__row-checkbox",onKeyup:t[0]||(t[0]=Be(qe((...d)=>e.resetSelection&&e.resetSelection(...d),["exact"]),["esc"]))},[b(a,se(e.selectAllBind,{"data-cy-files-list-selection-checkbox":"","onUpdate:modelValue":e.onToggleAll}),null,16,["onUpdate:modelValue"]),e.isNoneSelected?F("",!0):(r(),m(x,{key:0},[S("span",Do,C(e.n("files","{count} selected","{count} selected",e.selectedNodes.length,{count:e.selectedNodes.length})),1),b(c,{currentView:e.currentView,selectedNodes:e.selectedNodes},null,8,["currentView","selectedNodes"])],64))],32),S("th",{class:A(["files-list__column files-list__row-name files-list__column--sortable",{"hidden-visually":!e.isNoneSelected}]),"aria-sort":e.ariaSortForMode("basename"),inert:!e.isNoneSelected},[t[1]||(t[1]=S("span",{class:"files-list__row-icon"},null,-1)),b(l,{name:e.t("files","Name"),mode:"basename"},null,8,["name"])],10,Lo),S("th",{class:A(["files-list__row-actions",{"hidden-visually":!e.isNoneSelected}]),inert:!e.isNoneSelected},[S("span",Eo,C(e.t("files","Actions")),1)],10,Mo),e.isMimeAvailable?(r(),m("th",{key:0,class:A(["files-list__column files-list__row-mime",{"files-list__column--sortable":e.isMimeAvailable,"hidden-visually":!e.isNoneSelected}]),"aria-sort":e.ariaSortForMode("mime"),inert:!e.isNoneSelected},[b(l,{name:e.t("files","File type"),mode:"mime"},null,8,["name"])],10,Vo)):F("",!0),e.isSizeAvailable?(r(),m("th",{key:1,class:A(["files-list__column files-list__row-size",{"files-list__column--sortable":e.isSizeAvailable,"hidden-visually":!e.isNoneSelected}]),"aria-sort":e.ariaSortForMode("size"),inert:!e.isNoneSelected},[b(l,{name:e.t("files","Size"),mode:"size"},null,8,["name"])],10,$o)):F("",!0),e.isMtimeAvailable?(r(),m("th",{key:2,class:A(["files-list__column files-list__row-mtime",{"files-list__column--sortable":e.isMtimeAvailable,"hidden-visually":!e.isNoneSelected}]),"aria-sort":e.ariaSortForMode("mtime"),inert:!e.isNoneSelected},[b(l,{name:e.t("files","Modified"),mode:"mtime"},null,8,["name"])],10,To)):F("",!0),(r(!0),m(x,null,V(e.columns,d=>(r(),m("th",{key:d.id,class:A(e.classForColumn(d)),"aria-sort":e.ariaSortForMode(d.id),inert:!e.isNoneSelected},[d.sort?(r(),y(l,{key:0,name:d.title,mode:d.id},null,8,["name","mode"])):(r(),m("span",Oo,C(d.title),1))],10,Ro))),128))],2)}const Bo=I(Io,[["render",zo],["__scopeId","data-v-863cef23"]]),qo=D({name:"VirtualList",props:{dataComponent:{type:[Object,Function],required:!0},dataKey:{type:String,required:!0},dataSources:{type:Array,required:!0},extraProps:{type:Object,default:()=>({})},scrollToIndex:{type:Number,default:0},gridMode:{type:Boolean,default:!1},caption:{type:String,default:""}},setup(){const{width:e}=q();return{fileListWidth:e}},data(){return{index:this.scrollToIndex,beforeHeight:0,footerHeight:0,headerHeight:0,tableHeight:0,resizeObserver:null}},computed:{isReady(){return this.tableHeight>0},bufferItems(){return this.gridMode?this.columnCount:3},itemHeight(){return this.gridMode?246:44},itemWidth(){return 198},visibleRows(){return Math.floor((this.tableHeight-this.headerHeight)/this.itemHeight)},rowCount(){return this.visibleRows+this.bufferItems/this.columnCount*2+1},columnCount(){return this.gridMode?Math.floor(this.fileListWidth/this.itemWidth):1},startIndex(){const e=this.index-this.index%this.columnCount;return Math.max(0,e-this.bufferItems)},shownItems(){return this.gridMode?this.rowCount*this.columnCount:this.rowCount},renderedItems(){if(!this.isReady)return[];const e=this.dataSources.slice(this.startIndex,this.startIndex+this.shownItems),t=e.filter(s=>Object.values(this.$_recycledPool).includes(s[this.dataKey])).map(s=>s[this.dataKey]),i=Object.keys(this.$_recycledPool).filter(s=>!t.includes(this.$_recycledPool[s]));return e.map(s=>{const n=Object.values(this.$_recycledPool).indexOf(s[this.dataKey]);if(n!==-1)return{key:Object.keys(this.$_recycledPool)[n],item:s};const o=i.pop()||Math.random().toString(36).substr(2);return this.$_recycledPool[o]=s[this.dataKey],{key:o,item:s}})},totalRowCount(){return Math.ceil(this.dataSources.length/this.columnCount)},tbodyStyle(){const e=Math.round(this.startIndex/this.columnCount),t=Math.max(0,this.totalRowCount-e-this.rowCount);return{paddingBlock:`${e*this.itemHeight}px ${t*this.itemHeight}px`,minHeight:`${this.totalRowCount*this.itemHeight}px`}}},watch:{scrollToIndex(e){this.scrollTo(e)},totalRowCount(){this.scrollToIndex&&this.scrollTo(this.scrollToIndex)},columnCount(e,t){if(t===0){u.debug("VirtualList: columnCount is 0, skipping scroll");return}this.scrollTo(this.index)}},mounted(){this.$_recycledPool={},this.resizeObserver=new ResizeObserver(xt(()=>{this.updateHeightVariables(),u.debug("VirtualList: resizeObserver updated"),this.onScroll()},100)),this.resizeObserver.observe(this.$el),this.resizeObserver.observe(this.$refs.before),this.resizeObserver.observe(this.$refs.filters),this.resizeObserver.observe(this.$refs.footer),this.$nextTick(()=>{this.updateHeightVariables(),this.scrollToIndex&&this.scrollTo(this.scrollToIndex)})},beforeUnmount(){this.resizeObserver&&this.resizeObserver.disconnect()},methods:{scrollTo(e){if(!this.$el||this.index===e)return;const t=this.index+this.visibleRows*this.columnCount-1;if(e>=this.index&&e<=t){u.debug("VirtualList: Skip scrolling, index already visible",{index:e});return}if(this.totalRowCount<this.visibleRows){u.debug("VirtualList: Skip scrolling, nothing to scroll",{index:e,totalRows:this.totalRowCount,visibleRows:this.visibleRows});return}const i=(this.totalRowCount-this.visibleRows)*this.columnCount+(this.columnCount-1);let s=this.indexToScrollPos(Math.min(e,i));this.index=e,e>=this.columnCount&&e<=i?(s-=this.itemHeight/2,this.index=e-this.columnCount):e>i&&(e<=i+this.columnCount?s+=this.footerHeight/2:s+=this.footerHeight),this.$nextTick(()=>{this.$el.scrollTop=s,u.debug(`VirtualList: scrolling to index ${e}`,{clampedIndex:i,scrollTop:s,columnCount:this.columnCount,total:this.totalRowCount,visibleRows:this.visibleRows,beforeHeight:this.beforeHeight})})},onScroll(){this._onScrollHandle??=requestAnimationFrame(()=>{this._onScrollHandle=null;const e=this.scrollPosToIndex(this.$el.scrollTop);e!==this.index&&(this.index=Math.max(0,Math.floor(e)),this.$emit("scroll"))})},scrollPosToIndex(e){const t=e-this.beforeHeight;return Math.max(0,Math.floor(t/this.itemHeight))*this.columnCount},indexToScrollPos(e){return Math.floor(e/this.columnCount)*this.itemHeight+this.beforeHeight},updateHeightVariables(){this.tableHeight=this.$el?.clientHeight??0,this.beforeHeight=this.$refs.before?.clientHeight??0,this.footerHeight=this.$refs.footer?.clientHeight??0;const e=this.$refs.thead?.clientHeight??0,t=this.$refs.filters?.clientHeight??0;this.headerHeight=e+t}}}),Uo={ref:"before",class:"files-list__before"},Po={ref:"filters",class:"files-list__filters"},Ho={key:0,class:"files-list__empty"},Ko=["aria-hidden","inert"],jo={key:0,class:"hidden-visually"},Wo={ref:"thead",class:"files-list__thead","data-cy-files-list-thead":""},Go={ref:"footer",class:"files-list__tfoot","data-cy-files-list-tfoot":""};function Qo(e,t,i,s,n,o){return r(),m("div",{class:A(["files-list",{"files-list--grid":e.gridMode}]),"data-cy-files-list":"",onScrollPassive:t[0]||(t[0]=(...a)=>e.onScroll&&e.onScroll(...a))},[S("div",Uo,[H(e.$slots,"before")],512),S("div",Po,[H(e.$slots,"filters")],512),e.dataSources.length===0?(r(),m("div",Ho,[H(e.$slots,"empty")])):F("",!0),S("table",{"aria-hidden":e.dataSources.length===0,inert:e.dataSources.length===0,class:A(["files-list__table",{"files-list__table--hidden":e.dataSources.length===0}])},[e.caption?(r(),m("caption",jo,C(e.caption),1)):F("",!0),S("thead",Wo,[H(e.$slots,"header")],512),S("tbody",{style:ye(e.tbodyStyle),class:"files-list__tbody","data-cy-files-list-tbody":""},[(r(!0),m(x,null,V(e.renderedItems,({key:a,item:c},l)=>(r(),y(ie(e.dataComponent),se({key:a,source:c,index:l},{ref_for:!0},e.extraProps),null,16,["source","index"]))),128))],4),S("tfoot",Go,[H(e.$slots,"footer")],512)],10,Ko)],34)}const Yo=I(qo,[["render",Qo]]),pe=O(),Xo=k(()=>[...pe.value??[]].sort((e,t)=>e.order-t.order));function Jo(){return pe.value||(pe.value=Xe(),Ve().addEventListener("register:listHeader",()=>{pe.value=Xe()})),Xo}const Zo=D({name:"FilesListVirtual",components:{FileListFilterChips:ao,FileListFilterToSearch:lo,FilesListHeader:fo,FilesListTableFooter:_o,FilesListTableHeader:Bo,VirtualList:Yo},props:{currentView:{type:si,required:!0},currentFolder:{type:Vt,required:!0},nodes:{type:Array,required:!0},summary:{type:String,required:!0}},setup(e){const t=vt(),i=R(),s=le(),{width:n,isNarrow:o,isWide:a}=q(),{fileId:c,openDetails:l,openFile:d}=ae(),_=k(()=>o.value?!1:e.nodes.some(E=>E.mtime!==void 0)),f=k(()=>o.value?!1:e.nodes.some(E=>E.size!==void 0)),p=Js();Te(()=>[e.currentFolder,e.currentView],Xs,{immediate:!0});const g=k(()=>Zs(n.value,{inlineActions:!0,mime:s.userConfig.show_mime_column&&a.value&&e.nodes.some(E=>E.mime!==void 0||E.mime!=="application/octet-stream"),size:f.value,mtime:_.value,columns:o.value?[]:e.currentView.columns??[]},p.value));Ti(Ht,g);const M=k(()=>g.value.mime);return{fileId:c,headers:Jo(),isSizeAvailable:f,isMtimeAvailable:_,isMimeAvailable:M,openDetails:l,openFile:d,sidebar:t,activeStore:i,userConfigStore:s,t:h}},data(){return{FileEntry:Qn,FileEntryGrid:to,scrollToIndex:0}},computed:{userConfig(){return this.userConfigStore.userConfig},cantUpload(){return this.currentFolder&&(this.currentFolder.permissions&Q.CREATE)===0},isQuotaExceeded(){return this.currentFolder?.attributes?.["quota-available-bytes"]===0},caption(){const e=h("files","List of files and folders."),t=this.currentView.caption||e,i=this.cantUpload?h("files","You do not have permission to upload or create files here."):null,s=this.isQuotaExceeded?h("files","You have used your space quota and cannot upload files anymore."):null,n=h("files","Column headers with buttons are sortable."),o=h("files","This list is not fully rendered for performance reasons. The files will be rendered as you navigate through the list.");return[t,i,s,n,o].filter(Boolean).join(`
`)},isEmpty(){return this.nodes.length===0}},watch:{isEmpty(){this.handleOpenQueries()},fileId(){this.handleOpenQueries()},openFile(){this.handleOpenQueries()},openDetails(){this.handleOpenQueries()}},created(){B("Escape",this.unselectFile,{stop:!0,prevent:!0}),B(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],this.onKeyDown,{stop:!0,prevent:!0})},mounted(){window.document.querySelector("main.app-content").addEventListener("dragover",this.onDragOver)},beforeUnmount(){window.document.querySelector("main.app-content").removeEventListener("dragover",this.onDragOver)},methods:{handleOpenQueries(){if(!(this.isEmpty||this.fileId===null)&&(u.debug("FilesListVirtual: checking for requested fileId, openFile or openDetails",{nodes:this.nodes,fileId:this.fileId,openFile:this.openFile,openDetails:this.openDetails}),this.openFile&&this.handleOpenFile(this.fileId),this.openDetails&&this.openSidebarForFile(this.fileId),this.fileId)){const e=this.nodes.find(t=>t.fileid===this.fileId);e&&(this.activeStore.activeNode=e,this.scrollToFile(this.fileId,!1))}},openSidebarForFile(e){const t=this.nodes.find(i=>i.fileid===e);t&&this.sidebar.available?(u.debug("Opening sidebar on file "+t.path,{node:t}),this.sidebar.open(t)):u.warn(`Failed to open sidebar on file ${e}, file isn't cached yet !`,{fileId:e,node:t})},scrollToFile(e,t=!0){if(e){if(e===this.currentFolder.fileid)return;const i=this.nodes.findIndex(s=>s.fileid===e);t&&i===-1&&e!==this.currentFolder.fileid&&L(h("files","File not found")),this.scrollToIndex=Math.max(0,i),u.debug("Scrolling to file "+e,{fileId:e,index:i})}},unselectFile(){({...this.$route.query},this.activeStore.activeNode=this.currentFolder)},async handleOpenFile(e){const t=this.nodes.find(i=>i.fileid===e);if(t!==void 0){if(t.type===T.File){const i=qi({nodes:[t],view:this.currentView,folder:this.currentFolder,contents:this.nodes}).value.find(s=>s.id!=="download"&&!!s.default);if(i)return u.debug("Opening file "+t.path,{node:t}),await i.exec({nodes:[t],view:this.currentView,folder:this.currentFolder,contents:this.nodes})}u.debug("Ignore `openfile` query and replacing with `opendetails` for "+t.path,{node:t}),window.OCP.Files.Router.goToRoute(null,window.OCP.Files.Router.params,{...this.$route.query,openfile:void 0,opendetails:""},!0)}},onDragOver(e){if(e.dataTransfer?.types.includes("Files"))return;e.preventDefault(),e.stopPropagation();const t=this.$refs.table.$el,i=t.getBoundingClientRect().top,s=i+t.getBoundingClientRect().height;if(e.clientY<i+100){t.scrollTop=t.scrollTop-25;return}e.clientY>s-50&&(t.scrollTop=t.scrollTop+25)},onKeyDown(e){if(this.isEmpty||e.key!=="ArrowUp"&&e.key!=="ArrowDown"&&(!this.userConfig.grid_view||e.key!=="ArrowLeft"&&e.key!=="ArrowRight"))return;if(!this.fileId||this.fileId===this.currentFolder.fileid){const i=e.key==="ArrowUp"||e.key==="ArrowLeft"?this.nodes.length-1:0;this.setActiveNode(this.nodes[i])}const t=this.nodes.findIndex(i=>i.fileid===this.fileId)??0;if(e.key==="ArrowUp"||e.key==="ArrowDown"){const i=this.$refs.table?.columnCount??1,s=e.key==="ArrowUp"?t-i:t+i;if(s<0||s>=this.nodes.length)return;const n=this.nodes[s];if(n&&n?.fileid){this.setActiveNode(n);return}}if(this.userConfig.grid_view&&(e.key==="ArrowLeft"||e.key==="ArrowRight")){const i=e.key==="ArrowLeft"?t-1:t+1;if(i<0||i>=this.nodes.length)return;const s=this.nodes[i];if(s&&s?.fileid){this.setActiveNode(s);return}}},async setActiveNode(e){u.debug("Navigating to file "+e.path,{node:e,fileid:e.fileid}),this.scrollToFile(e.fileid);const t={...this.$route.query};delete t.openfile,delete t.opendetails,await this.$router.replace({...this.$route,query:t}),this.activeStore.activeNode=e}}});function er(e,t,i,s,n,o){const a=v("FileListFilterToSearch"),c=v("FileListFilterChips"),l=v("FilesListHeader"),d=v("FilesListTableHeader"),_=v("FilesListTableFooter"),f=v("VirtualList");return r(),y(f,{ref:"table","data-component":e.userConfig.grid_view?e.FileEntryGrid:e.FileEntry,"data-key":"source","data-sources":e.nodes,gridMode:e.userConfig.grid_view,extraProps:{isMimeAvailable:e.isMimeAvailable,isMtimeAvailable:e.isMtimeAvailable,isSizeAvailable:e.isSizeAvailable,nodes:e.nodes},scrollToIndex:e.scrollToIndex,caption:e.caption},{filters:w(()=>[b(a),b(c)]),before:w(()=>[(r(!0),m(x,null,V(e.headers,p=>(r(),y(l,{key:p.id,currentFolder:e.currentFolder,currentView:e.currentView,header:p},null,8,["currentFolder","currentView","header"]))),128))]),header:w(()=>[b(d,{ref:"thead",currentView:e.currentView,isMimeAvailable:e.isMimeAvailable,isMtimeAvailable:e.isMtimeAvailable,isSizeAvailable:e.isSizeAvailable,nodes:e.nodes},null,8,["currentView","isMimeAvailable","isMtimeAvailable","isSizeAvailable","nodes"])]),empty:w(()=>[H(e.$slots,"empty",{},void 0,!0)]),footer:w(()=>[b(_,{currentView:e.currentView,isMimeAvailable:e.isMimeAvailable,isMtimeAvailable:e.isMtimeAvailable,isSizeAvailable:e.isSizeAvailable,nodes:e.nodes,summary:e.summary},null,8,["currentView","isMimeAvailable","isMtimeAvailable","isSizeAvailable","nodes","summary"])]),_:3},8,["data-component","data-sources","gridMode","extraProps","scrollToIndex","caption"])}const tr=I(Zo,[["render",er],["__scopeId","data-v-d00e37b9"]]),me=O(),ir=k(()=>[...me.value??[]].sort((e,t)=>e.order-t.order));function sr(){return me.value||(me.value=Je(),Ve().addEventListener("register:listAction",()=>{me.value=Je()})),ir}function nr(e,t,i){const s=sr();return k(()=>K(e)===void 0||K(i)===void 0?[]:s.value.filter(n=>n.enabled===void 0||n.enabled({folder:K(e),contents:K(t),view:K(i)})))}function or(e,t){return k(()=>{const i=K(e);if(i===void 0)return[];const s=ni(i),n=o=>({label:o.displayName,iconSvg:o.iconSvgInline??"",onClick:()=>o.handler(i,K(t))});return[{caption:h("files","Upload from device"),category:xe.UploadFromDevice},{caption:h("files","Create new"),category:xe.CreateNew},{caption:h("files","Other"),category:xe.Other}].map(({caption:o,category:a})=>({caption:o,actions:s.filter(c=>c.category===a).map(n)})).filter(({actions:o})=>o.length>0)})}function rr(e){return e instanceof Error&&"status"in e&&"response"in e}function ar(e){if(e instanceof Error){if(rr(e)){const t=e.status||e.response?.status||0;if([400,404,405].includes(t))return h("files","Folder not found");if(t===403)return h("files","This operation is forbidden");if(t===500)return h("files","This folder is unavailable, please try again later or contact the administration");if(t===503)return h("files","Storage is temporarily not available")}return e.name==="AbortError"?null:h("files","Unexpected error: {error}",{error:e.message})}return h("files","Unknown error")}const lr=D({name:"FilesList",components:{BreadCrumbs:ks,DragAndDropNotice:Ms,FileListFilters:Us,FilesListVirtual:tr,ListViewIcon:Ni,NcAppContent:ui,NcActions:$e,NcActionButton:_e,NcButton:j,NcEmptyContent:wi,NcIconSvgWrapper:z,NcLoadingIcon:Se,NcUploadPicker:ri,ViewGridIcon:ki,IconAlertCircleOutline:bi,IconReload:Ai},props:{isPublic:{type:Boolean,default:!1}},setup(){const e=ps(),t=R(),i=ne(),s=je(),n=Et(),o=J(),a=qt(),c=le(),l=Lt(),{isNarrow:d}=q(),{directory:_,fileId:f}=ae(),p=li("core","config",[])["enable_non-accessible_features"]??!0,g=k(()=>t.activeView),M=k(()=>t.activeFolder),E=k(()=>(M.value?._children??[]).map(i.getNode).filter(Boolean)),Ae=nr(M,E,g),ke=or(M,E),Ne=Te(M,()=>{M.value.fileid!==void 0&&M.value.fileid>0&&(Ri(async()=>G("files:list:initialized")),Ne())},{immediate:!0});return{currentFolder:M,currentView:g,dirContents:E,directory:_,enabledFileListActions:Ae,fileId:f,isNarrow:d,newFileMenuActions:ke,sidebar:e,activeStore:t,filesStore:i,filtersStore:s,pathsStore:n,selectionStore:o,uploaderStore:a,userConfigStore:c,viewConfigStore:l,...Qe(),enableGridView:p,ShareType:Me,t:h}},data(){return{initialized:!1,loading:!0,loadingAction:null,error:null,controller:new AbortController,promise:null,dirContentsFiltered:[]}},computed:{getContent(){const e=this.currentView;return async t=>{const i=oe.normalize(`${this.currentFolder?.path??""}/${t??""}`),s=this.filesStore.getNodesByPath(e.id,i);if(s.length>0)return s;const n=new AbortController;return(await e.getContents(i,{signal:n.signal})).contents}},userConfig(){return this.userConfigStore.userConfig},pageHeading(){const e=this.currentView?.name??h("files","Files");return this.currentFolder===void 0||this.directory==="/"?e:`${this.currentFolder.displayname} - ${e}`},dirContentsSorted(){if(!this.currentView)return[];const e=(this.currentView?.columns||[]).find(i=>i.id===this.sortingMode);if(e?.sort&&typeof e.sort=="function"){const i=[...this.dirContentsFiltered].sort(e.sort);return this.isAscSorting?i:i.reverse()}const t=oi(this.dirContentsFiltered,{sortFavoritesFirst:this.userConfig.sort_favorites_first,sortFoldersFirst:this.userConfig.sort_folders_first,sortingMode:this.sortingMode,sortingOrder:this.isAscSorting?"asc":"desc"});return this.currentView.id==="files"&&t.sort((i,s)=>{const n=oe.relative(i.source,this.currentFolder.source)==="..",o=oe.relative(s.source,this.currentFolder.source)==="..";return n&&o?0:n?-1:1}),t},isEmptyDir(){return this.dirContents.length===0},isRefreshing(){return this.currentFolder!==void 0&&!this.isEmptyDir&&this.loading},toPreviousDir(){const e=this.directory.split("/").slice(0,-1).join("/")||"/";return{...this.$route,query:{dir:e}}},gridViewButtonLabel(){return this.userConfig.grid_view?h("files","Switch to list view"):h("files","Switch to grid view")},canUpload(){return this.currentFolder&&(this.currentFolder.permissions&Q.CREATE)!==0},isQuotaExceeded(){return this.currentFolder?.attributes?.["quota-available-bytes"]===0},showCustomEmptyView(){return!this.loading&&this.isEmptyDir&&this.currentView?.emptyView!==void 0},summary(){const e=this.dirContents.length-this.dirContentsFiltered.length;return Yt(this.dirContentsFiltered,e)},debouncedFetchContent(){return ys(this.fetchContent,800,!0)}},watch:{showCustomEmptyView(e){e&&this.$nextTick(()=>{const t=this.$refs.customEmptyView;this.currentView.emptyView(t)})},currentView(e,t){e?.id!==t?.id&&(u.debug("View changed",{newView:e,oldView:t}),this.selectionStore.reset(),this.fetchContent())},directory(e,t){u.debug("Directory changed",{newDir:e,oldDir:t}),this.selectionStore.reset(),this.sidebar.close(),this.fetchContent();const i=this.$refs?.filesListVirtual;i?.$el&&(i.$el.scrollTop=0)},dirContents(e){u.debug("Directory contents changed",{view:this.currentView,folder:this.currentFolder,contents:e}),G("files:list:updated",{view:this.currentView,folder:this.currentFolder,contents:e}),this.filterDirContent()}},async mounted(){Z("files:node:updated",this.onUpdatedNode),Z("files:config:updated",this.fetchContent),Z("files:filters:changed",this.filterDirContent),Z("files:search:updated",this.onUpdateSearch),await this.fetchContent(),this.fileId&&!this.dirContents.find(e=>e.fileid?.toString()===this.fileId?.toString())&&this.currentFolder?.fileid?.toString()!==this.fileId.toString()&&L(h("files","The file could not be found"))},unmounted(){ce("files:node:updated",this.onUpdatedNode),ce("files:config:updated",this.fetchContent),ce("files:filters:changed",this.filterDirContent),ce("files:search:updated",this.onUpdateSearch)},methods:{onUpdateSearch({query:e,scope:t}){e&&t!=="filter"&&this.debouncedFetchContent()},async fetchContent(){this.loading=!0,this.error=null;const e=this.directory,t=this.currentView;if(!t){u.debug("The current view does not exists or is not ready.",{currentView:t}),window.addEventListener("DOMContentLoaded",()=>{this.currentView||(u.warn("No current view after DOMContentLoaded, redirecting to the default view"),window.OCP.Files.Router.goToRoute(null,{view:es()}))},{once:!0});return}u.debug("Fetching contents for directory",{dir:e,currentView:t}),this.promise&&(this.controller.abort(),u.debug("Cancelled previous ongoing fetch")),this.controller=new AbortController,this.promise=t.getContents(e,{signal:this.controller.signal});try{const{folder:i,contents:s}=await this.promise;u.debug("Fetched contents",{dir:e,folder:i,contents:s}),this.filesStore.updateNodes(s),i._children=s.map(n=>n.source),e==="/"?this.filesStore.setRoot({service:t.id,root:i}):i.fileid?(this.filesStore.updateNodes([i]),this.pathsStore.addPath({service:t.id,source:i.source,path:e})):u.fatal("Invalid root folder returned",{dir:e,folder:i,currentView:t}),s.filter(n=>n.type==="folder").forEach(n=>{this.pathsStore.addPath({service:t.id,source:n.source,path:te(e,n.basename)})}),this.activeStore.activeFolder=i}catch(i){u.error("Error while fetching content",{error:i}),this.error=ar(i)}finally{this.loading=!1}},onUploadFinished(e){if(e.status===Le.FAILED){u.error("Upload failed",{upload:e}),L(h("files",'Could not upload "{name}"',{name:ve(e.source)}));return}e.status===Le.FINISHED&&St(e.source)===this.currentFolder.source&&this.fetchContent()},onUpdatedNode(e){e?.fileid===this.currentFolder?.fileid&&this.fetchContent()},toggleGridView(){this.userConfigStore.update("grid_view",!this.userConfig.grid_view)},filterDirContent(){let e=this.dirContents;for(const t of this.filtersStore.sortedFilters)e=t.filter(e);this.dirContentsFiltered=e},actionDisplayName(e){let t=e.id;try{t=e.displayName(this.currentView)}catch(i){u.error("Error while getting action display name",{action:e,error:i})}return t},async execFileListAction(e){this.loadingAction=e.id;const t=this.actionDisplayName(e);try{const i=await e.exec({view:this.currentView,folder:this.currentFolder,contents:this.dirContents});if(i==null)return;if(i){be(h("files","{displayName}: done",{displayName:t}));return}L(h("files","{displayName}: failed",{displayName:t}))}catch(i){u.error("Error while executing action",{action:e,error:i}),L(h("files","{displayName}: failed",{displayName:t}))}finally{this.loadingAction=null}}}}),cr={key:2,class:"files-list__empty-view-wrapper"},dr={ref:"customEmptyView"};function ur(e,t,i,s,n,o){const a=v("NcUploadPicker"),c=v("BreadCrumbs"),l=v("NcLoadingIcon"),d=v("NcIconSvgWrapper"),_=v("NcActionButton"),f=v("NcActions"),p=v("FileListFilters"),g=v("ListViewIcon"),M=v("ViewGridIcon"),E=v("NcButton"),Ae=v("DragAndDropNotice"),ke=v("IconReload"),Ne=v("IconAlertCircleOutline"),Ye=v("NcEmptyContent"),Jt=v("FilesListVirtual"),Zt=v("NcAppContent");return r(),y(Zt,{pageHeading:e.pageHeading,"data-cy-files-content":""},{default:w(()=>[S("div",{class:A(["files-list__header",{"files-list__header--public":e.isPublic}])},[(r(),y(Oi,{disabled:!e.isNarrow,to:"body"},[e.canUpload&&!e.isQuotaExceeded&&e.currentFolder?(r(),y(a,{key:0,actions:e.newFileMenuActions,directory:"",iconOnly:e.isNarrow,class:A(["files-list__header-upload-button",{"files-list__header-upload-button--narrow":e.isNarrow}]),content:e.getContent,destination:e.currentFolder,multiple:"",variant:"primary","data-cy-upload-picker":"","onUpload:finished":e.onUploadFinished},null,8,["actions","iconOnly","class","content","destination","onUpload:finished"])):F("",!0)],8,["disabled"])),b(c,{path:e.directory,onReload:e.fetchContent},null,8,["path","onReload"]),e.isRefreshing?(r(),y(l,{key:0,class:"files-list__refresh-icon",name:e.t("files","File list is reloading")},null,8,["name"])):F("",!0),b(f,{class:"files-list__header-actions",inline:1,variant:"tertiary",forceName:""},{default:w(()=>[(r(!0),m(x,null,V(e.enabledFileListActions,P=>(r(),y(_,{key:P.id,disabled:!!e.loadingAction,"data-cy-files-list-action":P.id,closeAfterClick:"",onClick:hr=>e.execFileListAction(P)},{icon:w(()=>[e.loadingAction===P.id?(r(),y(l,{key:0,size:18})):P.iconSvgInline!==void 0&&e.currentView?(r(),y(d,{key:1,svg:P.iconSvgInline(e.currentView)},null,8,["svg"])):F("",!0)]),default:w(()=>[$(" "+C(e.actionDisplayName(P)),1)]),_:2},1032,["disabled","data-cy-files-list-action","onClick"]))),128))]),_:1}),b(p),e.enableGridView?(r(),y(E,{key:1,"aria-label":e.gridViewButtonLabel,title:e.gridViewButtonLabel,class:"files-list__header-grid-button",variant:"tertiary",onClick:e.toggleGridView},{icon:w(()=>[e.userConfig.grid_view?(r(),y(g,{key:0})):(r(),y(M,{key:1}))]),_:1},8,["aria-label","title","onClick"])):F("",!0)],2),!e.loading&&e.canUpload&&e.currentFolder?(r(),y(Ae,{key:0,currentFolder:e.currentFolder},null,8,["currentFolder"])):F("",!0),e.currentView?(r(),y(Jt,{key:2,ref:"filesListVirtual",currentFolder:e.currentFolder,currentView:e.currentView,nodes:e.dirContentsSorted,summary:e.summary},{empty:w(()=>[e.loading&&!e.isRefreshing?(r(),y(l,{key:0,class:"files-list__loading-icon",size:38,name:e.t("files","Loading current folder")},null,8,["name"])):e.error?(r(),y(Ye,{key:1,name:e.error,"data-cy-files-content-error":""},{action:w(()=>[b(E,{variant:"secondary",onClick:e.fetchContent},{icon:w(()=>[b(ke,{size:20})]),default:w(()=>[$(" "+C(e.t("files","Retry")),1)]),_:1},8,["onClick"])]),icon:w(()=>[b(Ne)]),_:1},8,["name"])):e.currentView?.emptyView?(r(),m("div",cr,[S("div",dr,null,512)])):(r(),y(Ye,{key:3,name:e.currentView?.emptyTitle||e.t("files","No files in here"),description:e.currentView?.emptyCaption||e.t("files","Upload some content or sync with your devices!"),"data-cy-files-content-empty":""},Re({icon:w(()=>[b(d,{svg:e.currentView?.icon},null,8,["svg"])]),_:2},[e.directory!=="/"?{name:"action",fn:w(()=>[e.canUpload&&!e.isQuotaExceeded?(r(),y(a,{key:0,actions:e.newFileMenuActions,directory:"",class:"files-list__header-upload-button",content:e.getContent,destination:e.currentFolder,multiple:"","data-cy-upload-picker":"","onUpload:finished":e.onUploadFinished},null,8,["actions","content","destination","onUpload:finished"])):(r(),y(E,{key:1,to:e.toPreviousDir,variant:"primary"},{default:w(()=>[$(C(e.t("files","Go back")),1)]),_:1},8,["to"]))]),key:"0"}:void 0]),1032,["name","description"]))]),_:1},8,["currentFolder","currentView","nodes","summary"])):(r(),y(l,{key:1,class:"files-list__loading-icon",size:38,name:e.t("files","Loading current folder")},null,8,["name"]))]),_:1},8,["pageHeading"])}const Ba=I(lr,[["render",ur],["__scopeId","data-v-e18d71b8"]]);export{Ba as default};
//# sourceMappingURL=FilesList-cV7mwles.chunk.mjs.map