(()=>{"use strict";var e,t,s,n={4114:(e,t,s)=>{s.d(t,{u:()=>i});var n=s(65899);const i=()=>(window._nc_files_pinia||(window._nc_files_pinia=(0,n.Ey)()),window._nc_files_pinia)},4735:(e,t,s)=>{s.d(t,{L:()=>i,P:()=>a});var n=s(81222);function i(){return 0!==(0,n.C)("files","storageStats",{quota:-1}).quota}function a(){const{default_view:e}=(0,n.C)("files","config",{default_view:"files"});return"personal"!==e||i()?e:"files"}},9165:(e,t,s)=>{s.d(t,{Brj:()=>d,HzW:()=>f,IyB:()=>n,NZC:()=>a,WBH:()=>c,ZL5:()=>u,bFE:()=>o,fEr:()=>r,jUz:()=>g,kHm:()=>m,kOJ:()=>l,u4v:()=>i});var n="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M6,10V7H4V10H1V12H4V15H6V12H9V10M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12Z",i="M7 11H9V13H7V11M21 5V19C21 20.11 20.11 21 19 21H5C3.89 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H6V1H8V3H16V1H18V3H19C20.11 3 21 3.9 21 5M5 7H19V5H5V7M19 19V9H5V19H19M15 13H17V11H15V13M11 13H13V11H11V13Z",a="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M16.2,16.2L11,13V7H12.5V12.2L17,14.9L16.2,16.2Z",o="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",r="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",l="M1,1V5H2V19H1V23H5V22H19V23H23V19H22V5H23V1H19V2H5V1M5,4H19V5H20V19H19V20H5V19H4V5H5M6,6V14H9V18H18V9H14V6M8,8H12V12H8M14,11H16V16H11V14H14",d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z",m="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",c="M9,2A7,7 0 0,1 16,9C16,10.5 15.5,12 14.61,13.19L15.41,14H16L22,20L20,22L14,16V15.41L13.19,14.61C12,15.5 10.5,16 9,16A7,7 0 0,1 2,9A7,7 0 0,1 9,2M11.12,5.46L9,7.59L6.88,5.46L5.46,6.88L7.59,9L5.46,11.12L6.88,12.54L9,10.41L11.12,12.54L12.54,11.12L10.41,9L12.54,6.88L11.12,5.46Z",g="M17,3A2,2 0 0,1 19,5V15A2,2 0 0,1 17,17H13V19H14A1,1 0 0,1 15,20H22V22H15A1,1 0 0,1 14,23H10A1,1 0 0,1 9,22H2V20H9A1,1 0 0,1 10,19H11V17H7C5.89,17 5,16.1 5,15V5A2,2 0 0,1 7,3H17Z",u="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z",f="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z"},9558:(e,t,s)=>{s.d(t,{A:()=>n});const n=(0,s(35947).YK)().setApp("files").detectUser().build()},11112:(e,t,s)=>{var n=s(35810),i=s(81222),a=s(49264),o=s(5655),r=s(3153),l=s(53334),d=s(21777),m=s(71225),c=s(85471),g=s(77764);const u=new n.VP({id:"files_trashbin--original-location",title:(0,l.t)("files_trashbin","Original location"),render(e){const t=h(e),s=document.createElement("span");return s.title=t,s.textContent=t,s},sort(e,t){const s=h(e),n=h(t);return s.localeCompare(n,[(0,l.Z0)(),(0,l.lO)()],{numeric:!0,usage:"sort"})}}),f=new n.VP({id:"files_trashbin--deleted-by",title:(0,l.t)("files_trashbin","Deleted by"),render(e){const{userId:t,displayName:s,label:n}=w(e);if(n){const e=document.createElement("span");return e.textContent=n,e}return new(c.Ay.extend(g.A))({propsData:{size:32,user:t??void 0,displayName:s??t}}).$mount().$el},sort(e,t){const s=w(e),n=s.label??s.displayName??s.userId,i=w(t),a=i.label??i.displayName??i.userId;return n.localeCompare(a,[(0,l.Z0)(),(0,l.lO)()],{numeric:!0,usage:"sort"})}}),p=new n.VP({id:"files_trashbin--deleted",title:(0,l.t)("files_trashbin","Deleted"),render(e){const t=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3,s=document.createElement("span");if(t){const e=Intl.DateTimeFormat([(0,l.lO)()],{dateStyle:"long",timeStyle:"short"}),n=new Date(1e3*t);return s.title=e.format(n),s.textContent=(0,l.fw)(n,{ignoreSeconds:(0,l.t)("files","few seconds ago")}),s}return s.textContent=(0,l.t)("files_trashbin","A long time ago"),s},sort(e,t){const s=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3;return(t.attributes?.["trashbin-deletion-time"]||(t?.mtime?.getTime()??0)/1e3)-s}});function h(e){const t=v(e.attributes?.["trashbin-original-location"]);if(!t)return(0,l.t)("files_trashbin","Unknown");const s=(0,m.pD)(t);return s===t?(0,l.t)("files_trashbin","All files"):s.replace(/^\//,"")}function w(e){const t=v(e.attributes?.["trashbin-deleted-by-id"]),s=v(e.attributes?.["trashbin-deleted-by-display-name"]);let n;const i=(0,d.HW)()?.uid;return t===i&&(n=(0,l.t)("files_trashbin","You")),t||s||(n=(0,l.t)("files_trashbin","Unknown")),{userId:t,displayName:s,label:n}}function v(e){return e?String(e):null}const b=`/trashbin/${(0,d.HW)()?.uid}/trash`,k=(0,n.H4)();var y=s(63814);const T=`\n\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t${(0,n.VX)()}\n\t\n`,x=e=>{const t=(0,n.Al)(e,b);return t.attributes.previewUrl=(0,y.Jv)("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:t.fileid}),t},C="trashbin";new n.Ss({id:C,name:(0,l.t)("files_trashbin","Deleted files"),caption:(0,l.t)("files_trashbin","List of files that have been deleted."),emptyTitle:(0,l.t)("files_trashbin","No deleted files"),emptyCaption:(0,l.t)("files_trashbin","Files and folders you have deleted will show up here"),icon:r,order:50,sticky:!0,defaultSortKey:"deleted",columns:[u,f,p],getContents:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";const t=(await k.getDirectoryContents(`${b}${e}`,{details:!0,data:T,includeSelf:!0})).data.map(x),[s]=t.splice(t.findIndex(t=>t.path===e),1);return{folder:s,contents:t}}});var S=s(61338),L=s(87485),U=s(65043),_=s(65899);const N=(0,i.C)("files","config",{crop_image_previews:!0,default_view:"files",grid_view:!1,show_files_extensions:!0,show_hidden:!1,show_mime_column:!0,sort_favorites_first:!0,sort_folders_first:!0,show_dialog_deletion:!1,show_dialog_file_extension:!0}),A=(0,_.nY)("userconfig",()=>{const e=(0,c.KR)({...N});return(0,S.B1)("files:config:updated",t=>{let{key:s,value:n}=t;return function(t,s){(0,c.hZ)(e.value,t,s)}(s,n)}),{userConfig:e,update:async function(e,t){null!==(0,d.HW)()&&await U.Ay.put((0,y.Jv)("/apps/files/api/v1/config/{key}",{key:e}),{value:t}),(0,S.Ic)("files:config:updated",{key:e,value:t})}}});var F=s(4114);const E=()=>!0===(0,L.F)()?.files?.undelete,P=e=>e.every(e=>!0===e.attributes["is-mount-root"]&&"shared"===e.attributes["mount-type"]),I=e=>e.every(e=>!0===e.attributes["is-mount-root"]&&"external"===e.attributes["mount-type"]),R=(e,t)=>P(e)?1===e.length?(0,l.t)("files","Leave this share"):(0,l.t)("files","Leave these shares"):I(e)?1===e.length?(0,l.t)("files","Disconnect storage"):(0,l.t)("files","Disconnect storages"):"trashbin"!==t.id&&E()?(e=>{if(1===e.length)return!1;const t=e.some(e=>P([e])),s=e.some(e=>!P([e]));return t&&s})(e)?(0,l.t)("files","Delete and unshare"):(e=>!e.some(e=>e.type!==n.pt.File))(e)?1===e.length?(0,l.t)("files","Delete file"):(0,l.t)("files","Delete files"):(e=>!e.some(e=>e.type!==n.pt.Folder))(e)?1===e.length?(0,l.t)("files","Delete folder"):(0,l.t)("files","Delete folders"):(0,l.t)("files","Delete"):(0,l.t)("files","Delete permanently"),O=()=>!1!==A((0,F.u)()).userConfig.show_dialog_deletion,z=async(e,t)=>{const s="trashbin"!==t.id&&E()?(0,l.n)("files","You are about to delete {count} item","You are about to delete {count} items",e.length,{count:e.length}):(0,l.n)("files","You are about to permanently delete {count} item","You are about to permanently delete {count} items",e.length,{count:e.length});return new Promise(n=>{window.OC.dialogs.confirmDestructive(s,(0,l.t)("files","Confirm deletion"),{type:window.OC.dialogs.YES_NO_BUTTONS,confirm:R(e,t),confirmClasses:"error",cancel:(0,l.t)("files","Cancel")},e=>{n(e)})})},B=async e=>{await U.Ay.delete(e.encodedSource),(0,S.Ic)("files:node:deleted",e)};var j=s(9558);const D=new a.A({concurrency:5}),V=new n.hY({id:"delete",displayName:R,iconSvgInline:e=>P(e)?o:I(e)?'':r,enabled:(e,t)=>(t.id!==C||!1!==(0,i.C)("files_trashbin","config",{allow_delete:!0}).allow_delete)&&(e.length>0&&e.map(e=>e.permissions).every(e=>0!==(e&n.aX.DELETE))),async exec(e,t){try{let s=!0;const n=((new Error).stack||"").toLocaleLowerCase().includes("keydown");return(O()||n)&&(s=await z([e],t)),!1===s?null:(await B(e),!0)}catch(t){return j.A.error("Error while deleting a file",{error:t,source:e.source,node:e}),!1}},async execBatch(e,t){let s=!0;if((O()||e.length>=5&&!P(e)&&!I(e))&&(s=await z(e,t)),!1===s)return Promise.all(e.map(()=>null));const n=e.map(e=>new Promise(t=>{D.add(async()=>{try{await B(e),t(!0)}catch(s){j.A.error("Error while deleting a file",{error:s,source:e.source,node:e}),t(!1)}})}));return Promise.all(n)},destructive:!0,order:100});var M=s(85168);function H(e){if(0===(e.permissions&n.aX.READ))return!1;if(!0===e.attributes["hide-download"]||"true"===e.attributes["hide-download"])return!1;if(e.attributes["share-attributes"]){const t=JSON.parse(e.attributes["share-attributes"]||"[]").find(e=>{let{scope:t,key:s}=e;return"permissions"===t&&"download"===s});if(void 0!==t)return!0===t.value}return!0}var W=s(45238),Y=s(89761);async function $(e,t){await U.Ay.head(e);const s=document.createElement("a");s.download=t??"",s.href=e,s.click()}function q(e,t){const s=e.split("/").filter(Boolean),n=t.split("/").filter(Boolean);let i="";for(const[e,a]of s.entries()){if(e>=t.length)break;if(a!==n[e])break;i=`${i}${""===i?"":"/"}${a}`}return i}async function G(e){let t;if(1===e.length){if(e[0].type===n.pt.File)return void await $(e[0].encodedSource,e[0].displayname);t=new URL(e[0].encodedSource),t.searchParams.append("accept","zip")}else{t=new URL(e[0].encodedSource);let s=t.pathname;for(const t of e.slice(1))s=q(s,new URL(t.encodedSource).pathname);t.pathname=s;const n=e.map(e=>decodeURIComponent(e.encodedSource.slice(t.href.length+1)));t.searchParams.append("accept","zip"),t.searchParams.append("files",JSON.stringify(n))}"/"!==t.pathname.at(-1)&&(t.pathname=`${t.pathname}/`),await $(t.href)}const K=new n.hY({id:"download",default:n.m9.DEFAULT,displayName:()=>(0,l.t)("files","Download"),iconSvgInline:()=>'',enabled:(e,t)=>0!==e.length&&!e.some(e=>!e.isDavResource)&&!(e.length>1&&"trashbin"===t.id)&&e.every(H),async exec(e){try{await G([e])}catch(t){(0,M.Qg)((0,l.t)("files","The requested file is not available.")),(0,S.Ic)("files:node:deleted",e)}return null},async execBatch(e,t,s){try{await G(e)}catch(e){(0,M.Qg)((0,l.t)("files","The requested files are not available."));const n=function(e,t){const s=(0,Y._)((0,F.u)()),n=(0,W.B)((0,F.u)());if(!e?.id)return null;if("/"===t)return s.getRoot(e.id)||null;const i=n.getPath(e.id,t);return s.getNode(i)||null}(t,s);(0,S.Ic)("files:node:updated",n)}return new Array(e.length).fill(null)},order:30});var X=s(82680);const J=new n.hY({id:"edit-locally",displayName:()=>(0,l.Tl)("files","Open locally"),iconSvgInline:()=>'',enabled:e=>1===e.length&&!(0,X.f)()&&0!==(e[0].permissions&n.aX.UPDATE),exec:async e=>(await async function(e){await Z(e);const t=await async function(){let e=!1;const t=(new M.ik).setName((0,l.Tl)("files","Open file locally")).setText((0,l.Tl)("files","The file should now open on your device. If it doesn't, please check that you have the desktop app installed.")).setButtons([{label:(0,l.Tl)("files","Retry and close"),type:"secondary",callback:()=>{e="local"}},{label:(0,l.Tl)("files","Open online"),icon:'',type:"primary",callback:()=>{e="online"}}]).build();return await t.show(),e}();"local"===t?await Z(e):"online"===t&&window.OCA.Viewer.open({path:e})}(e.path),null),order:25});async function Z(e){const t=(0,y.KT)("apps/files/api/v1")+"/openlocaleditor?format=json";try{const s=await U.Ay.post(t,{path:e}),n=(0,d.HW)()?.uid;let i=`nc://open/${n}@`+window.location.host+(0,m.O0)(e);i+="?token="+s.data.ocs.data.token,window.open(i,"_self")}catch(e){(0,M.Qg)((0,l.Tl)("files","Failed to redirect to client"))}}var Q=s(63006),ee=s(11459);const te=new a.A({concurrency:5}),se=e=>e.some(e=>1!==e.attributes.favorite),ne=async(e,t,s)=>{try{const n=(0,y.Jv)("/apps/files/api/v1/files")+(0,m.O0)(e.path);return await U.Ay.post(n,{tags:s?[window.OC.TAG_FAVORITE]:[]}),"favorites"!==t.id||s||"/"!==e.dirname||(0,S.Ic)("files:node:deleted",e),c.Ay.set(e.attributes,"favorite",s?1:0),s?(0,S.Ic)("files:favorites:added",e):(0,S.Ic)("files:favorites:removed",e),!0}catch(t){const n=s?"adding a file to favourites":"removing a file from favourites";return j.A.error("Error while "+n,{error:t,source:e.source,node:e}),!1}},ie=new n.hY({id:"favorite",displayName:e=>se(e)?(0,l.Tl)("files","Add to favorites"):(0,l.Tl)("files","Remove from favorites"),iconSvgInline:e=>se(e)?Q:ee,enabled:e=>!(0,X.f)()&&e.every(e=>e.root?.startsWith?.("/files"))&&e.every(e=>e.permissions!==n.aX.NONE),async exec(e,t){const s=se([e]);return await ne(e,t,s)},async execBatch(e,t){const s=se(e),n=e.map(e=>new Promise(n=>{te.add(async()=>{try{await ne(e,t,s),n(!0)}catch(t){j.A.error("Error while adding file to favorite",{error:t,source:e.source,node:e}),n(!1)}})}));return Promise.all(n)},order:-50});var ae=s(90231),oe=s(43627),re=s(21363);const le='',de=(0,i.C)("files_sharing","sharePermissions",n.aX.NONE);let me;var ce;!function(e){e.MOVE="Move",e.COPY="Copy",e.MOVE_OR_COPY="move-or-copy"}(ce||(ce={}));const ge=e=>{const t=e.reduce((e,t)=>Math.min(e,t.permissions),n.aX.ALL);return Boolean(t&n.aX.DELETE)},ue=e=>!!(e=>e.every(e=>!JSON.parse(e.attributes?.["share-attributes"]??"[]").some(e=>"permissions"===e.scope&&!1===e.value&&"download"===e.key)))(e)&&!e.some(e=>e.permissions===n.aX.NONE)&&(!(0,X.f)()||Boolean(de&n.aX.CREATE));var fe=s(16954);const pe=e=>ge(e)?ue(e)?ce.MOVE_OR_COPY:ce.MOVE:ce.COPY,he=async function(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!t)return;if(t.type!==n.pt.Folder)throw new Error((0,l.Tl)("files","Destination is not a folder"));if(s===ce.MOVE&&e.dirname===t.path)throw new Error((0,l.Tl)("files","This file/folder is already in that directory"));if(`${t.path}/`.startsWith(`${e.path}/`))throw new Error((0,l.Tl)("files","You cannot move a file/folder onto itself or into a subfolder of itself"));c.Ay.set(e,"status",n.zI.LOADING);const o=function(e,t,s){const n=e===ce.MOVE?(0,l.Tl)("files",'Moving "{source}" to "{destination}" …',{source:t,destination:s}):(0,l.Tl)("files",'Copying "{source}" to "{destination}" …',{source:t,destination:s});let i;return i=(0,M.cf)(` ${n}`,{isHTML:!0,timeout:M.DH,onRemove:()=>{i?.hideToast(),i=void 0}}),()=>i&&i.hideToast()}(s,e.basename,t.path),r=(me||(me=new a.A({concurrency:5})),me);return await r.add(async()=>{const a=e=>1===e?(0,l.Tl)("files","(copy)"):(0,l.Tl)("files","(copy %n)",void 0,e);try{const o=(0,n.H4)(),r=(0,oe.join)(n.lJ,e.path),l=(0,oe.join)(n.lJ,t.path);if(s===ce.COPY){let s=e.basename;if(!i){const t=await o.getDirectoryContents(l);s=(0,n.E6)(e.basename,t.map(e=>e.basename),{suffix:a,ignoreFileExtension:e.type===n.pt.Folder})}if(await o.copyFile(r,(0,oe.join)(l,s)),e.dirname===t.path){const{data:e}=await o.stat((0,oe.join)(l,s),{details:!0,data:(0,n.VL)()});(0,S.Ic)("files:node:created",(0,n.Al)(e))}}else{if(!i){const s=await(0,fe.hE)(t.path);if((0,ae.h)([e],s.contents))try{const{selected:n,renamed:i}=await(0,ae.o)(t.path,[e],s.contents);if(!n.length&&!i.length)return}catch(e){return}}try{await o.moveFile(r,(0,oe.join)(l,e.basename))}catch(e){const t=new DOMParser,s=await(e.response?.text()),n=t.parseFromString(s??"","text/xml").querySelector("message")?.textContent;throw n&&(0,M.Qg)(n),e}(0,S.Ic)("files:node:deleted",e)}}catch(e){if((0,U.F0)(e)){if(412===e.response?.status)throw new Error((0,l.Tl)("files","A file or folder with that name already exists in this folder"));if(423===e.response?.status)throw new Error((0,l.Tl)("files","The files are locked"));if(404===e.response?.status)throw new Error((0,l.Tl)("files","The file does not exist anymore"));if(e.message)throw new Error(e.message)}throw j.A.debug(e),new Error}finally{c.Ay.set(e,"status",""),o()}})};async function we(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",s=arguments.length>2?arguments[2]:void 0;const{resolve:i,reject:a,promise:o}=Promise.withResolvers(),r=s.map(e=>e.fileid).filter(Boolean),d=(0,M.a1)((0,l.Tl)("files","Choose destination")).allowDirectories(!0).setFilter(e=>!r.includes(e.fileid)).setMimeTypeFilter([]).setMultiSelect(!1).startAt(t).setButtonFactory((t,a)=>{const o=[],r=(0,oe.basename)(a),d=s.map(e=>e.dirname),m=s.map(e=>e.path);return e!==ce.COPY&&e!==ce.MOVE_OR_COPY||o.push({label:r?(0,l.Tl)("files","Copy to {target}",{target:r},void 0,{escape:!1,sanitize:!1}):(0,l.Tl)("files","Copy"),type:"primary",icon:re,disabled:t.some(e=>0===(e.permissions&n.aX.CREATE)),async callback(e){i({destination:e[0],action:ce.COPY})}}),d.includes(a)||m.includes(a)||t.some(e=>0===(e.permissions&n.aX.CREATE))||e!==ce.MOVE&&e!==ce.MOVE_OR_COPY||o.push({label:r?(0,l.Tl)("files","Move to {target}",{target:r},void 0,{escape:!1,sanitize:!1}):(0,l.Tl)("files","Move"),type:e===ce.MOVE?"primary":"secondary",icon:le,async callback(e){i({destination:e[0],action:ce.MOVE})}}),o}).build();return d.pick().catch(e=>{j.A.debug(e),e instanceof M.vT?i(!1):a(new Error((0,l.Tl)("files","Move or copy operation failed")))}),o}const ve=new n.hY({id:"move-copy",displayName(e){switch(pe(e)){case ce.MOVE:return(0,l.Tl)("files","Move");case ce.COPY:return(0,l.Tl)("files","Copy");case ce.MOVE_OR_COPY:return(0,l.Tl)("files","Move or copy")}},iconSvgInline:()=>le,enabled:(e,t)=>"public-file-share"!==t.id&&!!e.every(e=>e.root?.startsWith("/files/"))&&e.length>0&&(ge(e)||ue(e)),async exec(e,t,s){const n=pe([e]);let i;try{i=await we(n,s,[e])}catch(e){return j.A.error(e),!1}if(!1===i)return null;try{return await he(e,i.destination,i.action),!0}catch(e){return!!(e instanceof Error&&e.message)&&((0,M.Qg)(e.message),null)}},async execBatch(e,t,s){const n=pe(e),i=await we(n,s,e);if(!1===i)return e.map(()=>null);const a=e.map(async e=>{try{return await he(e,i.destination,i.action),!0}catch(t){return j.A.error(`Failed to ${i.action} node`,{node:e,error:t}),!1}});return await Promise.all(a)},order:15}),be='',ke=new n.hY({id:"open-folder",displayName(e){const t=e[0].displayname;return(0,l.Tl)("files","Open folder {displayName}",{displayName:t})},iconSvgInline:()=>be,enabled(e){if(1!==e.length)return!1;const t=e[0];return!!t.isDavRessource&&t.type===n.pt.Folder&&0!==(t.permissions&n.aX.READ)},exec:async(e,t)=>!(!e||e.type!==n.pt.Folder)&&(window.OCP.Files.Router.goToRoute(null,{view:t.id,fileid:String(e.fileid)},{dir:e.path}),null),default:n.m9.HIDDEN,order:-100});var ye=s(53775);const Te=new n.hY({id:"open-in-files",displayName:()=>(0,l.t)("files","Open in Files"),iconSvgInline:()=>"",enabled:(e,t)=>"recent"===t.id||t.id===ye.w,async exec(e){let t=e.dirname;return e.type===n.pt.Folder&&(t=t+"/"+e.basename),window.OCP.Files.Router.goToRoute(null,{view:"files",fileid:String(e.fileid)},{dir:t,openfile:"true"}),null},order:-1e3,default:n.m9.HIDDEN});var xe=s(38225);const Ce=new n.hY({id:"rename",displayName:()=>(0,l.Tl)("files","Rename"),iconSvgInline:()=>xe,enabled:(e,t)=>{if(0===e.length)return!1;if("public-file-share"===t.id)return!1;const s=e[0],i=(0,Y._)((0,F.u)()),a="/"===s.dirname?i.getRoot(t.id):i.getNode((0,oe.dirname)(s.source)),o=a?.permissions||n.aX.NONE;return Boolean(s.permissions&n.aX.DELETE)&&Boolean(o&n.aX.CREATE)},exec:async e=>((0,S.Ic)("files:node:rename",e),null),order:10});var Se=s(61780);const Le=new n.hY({id:"details",displayName:()=>(0,l.Tl)("files","Details"),iconSvgInline:()=>Se,enabled:e=>!(0,X.f)()&&1===e.length&&!!e[0]&&!!window?.OCA?.Files?.Sidebar&&((e[0].root?.startsWith("/files/")&&e[0].permissions!==n.aX.NONE)??!1),async exec(e,t,s){try{return window.OCA.Files.Sidebar.file===e.path?(j.A.debug("Sidebar already open for this file",{node:e}),null):(window.OCA.Files.Sidebar.setActiveTab("sharing"),await window.OCA.Files.Sidebar.open(e.path),window.OCP?.Files?.Router?.goToRoute(null,{view:t.id,fileid:String(e.fileid)},{...window.OCP.Files.Router.query,dir:s,opendetails:"true"},!0),null)}catch(e){return j.A.error("Error while opening sidebar",{error:e}),!1}},order:-50}),Ue=new n.hY({id:"view-in-folder",displayName:()=>(0,l.t)("files","View in folder"),iconSvgInline:()=>le,enabled(e,t){if((0,X.f)())return!1;if("files"===t.id)return!1;if(1!==e.length)return!1;const s=e[0];return!!s.isDavRessource&&!!s.root?.startsWith("/files")&&s.permissions!==n.aX.NONE&&s.type===n.pt.File},exec:async e=>!(!e||e.type!==n.pt.File)&&(window.OCP.Files.Router.goToRoute(null,{view:"files",fileid:String(e.fileid)},{dir:e.dirname}),null),order:80});class _e extends n.L3{constructor(){var e,t,s;super("files:hidden",0),e=this,s=void 0,(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t="showHidden"))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,this.showHidden=(0,i.C)("files","config",{show_hidden:!1}).show_hidden,(0,S.B1)("files:config:updated",e=>{let{key:t,value:s}=e;"show_hidden"===t&&(this.showHidden=Boolean(s),this.filterUpdated())})}filter(e){return this.showHidden?e:e.filter(e=>!0!==e.attributes.hidden&&!e.basename.startsWith("."))}}var Ne=s(9165),Ae=s(57505),Fe=s(6695),Ee=s(24764),Pe=s(15502);const Ie=(0,c.pM)({__name:"FileListFilter",props:{isActive:{type:Boolean},filterName:null},emits:["reset-filter"],setup:e=>({__sfc:!0,t:l.t,NcActions:Ee.A,NcActionButton:Ae.A,NcActionSeparator:Pe.A})});var Re=s(85072),Oe=s.n(Re),ze=s(97825),Be=s.n(ze),je=s(77659),De=s.n(je),Ve=s(55056),Me=s.n(Ve),He=s(10540),We=s.n(He),Ye=s(41113),$e=s.n(Ye),qe=s(30610),Ge={};Ge.styleTagTransform=$e(),Ge.setAttributes=Me(),Ge.insert=De().bind(null,"head"),Ge.domAPI=Be(),Ge.insertStyleElement=We(),Oe()(qe.A,Ge),qe.A&&qe.A.locals&&qe.A.locals;var Ke=s(14486);const Xe=(0,Ke.A)(Ie,function(){var e=this,t=e._self._c,s=e._self._setupProxy;return t(s.NcActions,{attrs:{"force-menu":"",type:e.isActive?"secondary":"tertiary","menu-name":e.filterName},scopedSlots:e._u([{key:"icon",fn:function(){return[e._t("icon")]},proxy:!0}],null,!0)},[e._v(" "),e._t("default"),e._v(" "),e.isActive?[t(s.NcActionSeparator),e._v(" "),t(s.NcActionButton,{staticClass:"files-list-filter__clear-button",attrs:{"close-after-click":""},on:{click:function(t){return e.$emit("reset-filter")}}},[e._v("\n\t\t\t"+e._s(s.t("files","Clear filter"))+"\n\t\t")])]:e._e()],2)},[],!1,null,"21c6ff6c",null).exports,Je=(0,c.pM)({name:"FileListFilterType",components:{FileListFilter:Xe,NcActionButton:Ae.A,NcIconSvgWrapper:Fe.A},props:{presets:{type:Array,default:()=>[]},typePresets:{type:Array,required:!0}},setup:()=>({mdiFileOutline:Ne.bFE,t:l.Tl}),data:()=>({selectedOptions:[]}),computed:{isActive(){return this.selectedOptions.length>0}},watch:{presets(){this.selectedOptions=this.presets??[]},selectedOptions(e,t){0===this.selectedOptions.length?0!==t.length&&this.$emit("update:presets"):this.$emit("update:presets",this.selectedOptions)}},mounted(){this.selectedOptions=this.presets??[]},methods:{resetFilter(){this.selectedOptions=[]},toggleOption(e){const t=this.selectedOptions.indexOf(e);-1!==t?this.selectedOptions.splice(t,1):this.selectedOptions.push(e)}}});var Ze=s(73470),Qe={};Qe.styleTagTransform=$e(),Qe.setAttributes=Me(),Qe.insert=De().bind(null,"head"),Qe.domAPI=Be(),Qe.insertStyleElement=We(),Oe()(Ze.A,Qe),Ze.A&&Ze.A.locals&&Ze.A.locals;const et=(0,Ke.A)(Je,function(){var e=this,t=e._self._c;return e._self._setupProxy,t("FileListFilter",{staticClass:"file-list-filter-type",attrs:{"is-active":e.isActive,"filter-name":e.t("files","Type")},on:{"reset-filter":e.resetFilter},scopedSlots:e._u([{key:"icon",fn:function(){return[t("NcIconSvgWrapper",{attrs:{path:e.mdiFileOutline}})]},proxy:!0}])},[e._v(" "),e._l(e.typePresets,function(s){return t("NcActionButton",{key:s.id,attrs:{type:"checkbox","model-value":e.selectedOptions.includes(s)},on:{click:function(t){return e.toggleOption(s)}},scopedSlots:e._u([{key:"icon",fn:function(){return[t("NcIconSvgWrapper",{attrs:{svg:s.icon}})]},proxy:!0}],null,!0)},[e._v("\n\t\t"+e._s(s.label)+"\n\t")])})],2)},[],!1,null,null,null).exports;function tt(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const st=(e,t)=>e.replace("[{id:"document",label:(0,l.t)("files","Documents"),icon:st('',"#49abea"),mime:["x-office/document"]},{id:"spreadsheet",label:(0,l.t)("files","Spreadsheets"),icon:st('',"#9abd4e"),mime:["x-office/spreadsheet"]},{id:"presentation",label:(0,l.t)("files","Presentations"),icon:st('',"#f0965f"),mime:["x-office/presentation"]},{id:"pdf",label:(0,l.t)("files","PDFs"),icon:st('',"#dc5047"),mime:["application/pdf"]},{id:"folder",label:(0,l.t)("files","Folders"),icon:st(be,window.getComputedStyle(document.body).getPropertyValue("--color-primary-element")),mime:["httpd/unix-directory"]},{id:"audio",label:(0,l.t)("files","Audio"),icon:'',mime:["audio"]},{id:"image",label:(0,l.t)("files","Images"),icon:'',mime:["image"]},{id:"video",label:(0,l.t)("files","Videos"),icon:'',mime:["video"]}])()),this.currentInstance&&(this.currentInstance.$destroy(),delete this.currentInstance);const t=c.Ay.extend(et);this.currentInstance=new t({propsData:{presets:this.currentPresets,typePresets:this.allPresets},el:e}).$on("update:presets",this.setPresets.bind(this)).$mount()}filter(e){if(!this.currentPresets||0===this.currentPresets.length)return e;const t=this.currentPresets.reduce((e,t)=>[...e,...t.mime],[]);return e.filter(e=>{if(!e.mime)return!1;const s=e.mime.toLowerCase();return!!t.includes(s)||!!t.includes(window.OC.MimeTypeList.aliases[s])||!!t.includes(s.split("/")[0])})}reset(){this.setPresets()}setPresets(e){this.currentPresets=e??[],void 0!==this.currentInstance&&(this.currentInstance.$props.presets=e),this.filterUpdated();const t=[];if(e&&e.length>0)for(const s of e)t.push({icon:s.icon,text:s.label,onclick:()=>this.removeFilterPreset(s.id)});else this.currentInstance?.resetFilter();this.updateChips(t)}removeFilterPreset(e){const t=this.currentPresets.filter(t=>{let{id:s}=t;return s!==e});this.setPresets(t)}}const it=(0,c.pM)({components:{FileListFilter:Xe,NcActionButton:Ae.A,NcIconSvgWrapper:Fe.A},props:{timePresets:{type:Array,required:!0}},setup:()=>({mdiCalendarRangeOutline:Ne.u4v}),data:()=>({selectedOption:null,timeRangeEnd:null,timeRangeStart:null}),computed:{isActive(){return null!==this.selectedOption},currentPreset(){return this.timePresets.find(e=>{let{id:t}=e;return t===this.selectedOption})??null}},watch:{selectedOption(){if(null===this.selectedOption)this.$emit("update:preset");else{const e=this.currentPreset;this.$emit("update:preset",e)}}},methods:{t:l.Tl,resetFilter(){this.selectedOption=null,this.timeRangeEnd=null,this.timeRangeStart=null}}});var at=s(31891),ot={};ot.styleTagTransform=$e(),ot.setAttributes=Me(),ot.insert=De().bind(null,"head"),ot.domAPI=Be(),ot.insertStyleElement=We(),Oe()(at.A,ot),at.A&&at.A.locals&&at.A.locals;const rt=(0,Ke.A)(it,function(){var e=this,t=e._self._c;return e._self._setupProxy,t("FileListFilter",{attrs:{"is-active":e.isActive,"filter-name":e.t("files","Modified")},on:{"reset-filter":e.resetFilter},scopedSlots:e._u([{key:"icon",fn:function(){return[t("NcIconSvgWrapper",{attrs:{path:e.mdiCalendarRangeOutline}})]},proxy:!0}])},[e._v(" "),e._l(e.timePresets,function(s){return t("NcActionButton",{key:s.id,attrs:{type:"radio","close-after-click":"","model-value":e.selectedOption,value:s.id},on:{"update:modelValue":function(t){e.selectedOption=t},"update:model-value":function(t){e.selectedOption=t}}},[e._v("\n\t\t"+e._s(s.label)+"\n\t")])})],2)},[],!1,null,"35fd0c81",null).exports;function lt(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const dt=()=>(new Date).setHours(0,0,0,0),mt=[{id:"today",label:(0,l.t)("files","Today"),filter:e=>e>dt()},{id:"last-7",label:(0,l.t)("files","Last 7 days"),filter:e=>e>dt()-6048e5},{id:"last-30",label:(0,l.t)("files","Last 30 days"),filter:e=>e>dt()-2592e6},{id:"this-year",label:(0,l.t)("files","This year ({year})",{year:(new Date).getFullYear()}),filter:e=>e>new Date(dt()).setMonth(0,1)},{id:"last-year",label:(0,l.t)("files","Last year ({year})",{year:(new Date).getFullYear()-1}),filter:e=>e>new Date(dt()).setFullYear((new Date).getFullYear()-1,0,1)&&evoid 0===e.mtime||this.currentPreset.filter(e.mtime.getTime())):e}reset(){this.setPreset()}setPreset(e){this.currentPreset=e,this.filterUpdated();const t=[];e?t.push({icon:'',text:e.label,onclick:()=>this.setPreset()}):this.currentInstance?.resetFilter(),this.updateChips(t)}}var gt=s(21376),ut=s(94219),ft=s(82182),pt=s(3226);const ht=(0,c.pM)({__name:"NewNodeDialog",props:{defaultName:{type:String,default:(0,l.t)("files","New folder")},otherNames:{type:Array,default:()=>[]},open:{type:Boolean,default:!0},name:{type:String,default:(0,l.t)("files","Create new folder")},label:{type:String,default:(0,l.t)("files","Folder name")}},emits:["close"],setup(e,t){let{emit:s}=t;const i=e,a=(0,c.KR)(i.defaultName),o=(0,c.KR)(),r=(0,c.KR)(),d=(0,c.KR)(""),m=(0,c.EW)(()=>a.value.trim().startsWith("."));function g(){(0,c.dY)(()=>{const e=o.value?.$el.querySelector("input");if(!i.open||!e)return;const t=a.value.length-(0,oe.extname)(a.value).length;e.focus(),e.setSelectionRange(0,t)})}return(0,c.wB)(()=>[i.defaultName,i.otherNames],()=>{a.value=(0,n.E6)(i.defaultName,i.otherNames).trim()}),(0,c.nT)(()=>{i.otherNames.includes(a.value.trim())?d.value=(0,l.t)("files","This name is already in use."):d.value=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(""===e.trim())return(0,l.t)("files","Filename must not be empty.");try{return(0,n.KT)(e),""}catch(e){if(!(e instanceof n.di))throw e;switch(e.reason){case n.nF.Character:return(0,l.t)("files",'"{char}" is not allowed inside a filename.',{char:e.segment},void 0,{escape:t});case n.nF.ReservedName:return(0,l.t)("files",'"{segment}" is a reserved name and not allowed for filenames.',{segment:e.segment},void 0,{escape:!1});case n.nF.Extension:return e.segment.match(/\.[a-z]/i)?(0,l.t)("files",'"{extension}" is not an allowed filetype.',{extension:e.segment},void 0,{escape:!1}):(0,l.t)("files",'Filenames must not end with "{extension}".',{extension:e.segment},void 0,{escape:!1});default:return(0,l.t)("files","Invalid filename.")}}}(a.value.trim());const e=o.value?.$el.querySelector("input");e&&(e.setCustomValidity(d.value),e.reportValidity())}),(0,c.wB)(()=>i.open,()=>{(0,c.dY)(()=>{g()})}),(0,c.sV)(()=>{a.value=(0,n.E6)(a.value,i.otherNames).trim(),(0,c.dY)(()=>g())}),{__sfc:!0,props:i,emit:s,localDefaultName:a,nameInput:o,formElement:r,validity:d,isHiddenFileName:m,focusInput:g,submit:function(){r.value?.requestSubmit()},t:l.t,NcButton:gt.A,NcDialog:ut.A,NcTextField:ft.A,NcNoteCard:pt.A}}});var wt=s(96102),vt={};vt.styleTagTransform=$e(),vt.setAttributes=Me(),vt.insert=De().bind(null,"head"),vt.domAPI=Be(),vt.insertStyleElement=We(),Oe()(wt.A,vt),wt.A&&wt.A.locals&&wt.A.locals;const bt=(0,Ke.A)(ht,function(){var e=this,t=e._self._c,s=e._self._setupProxy;return t(s.NcDialog,{attrs:{"data-cy-files-new-node-dialog":"",name:e.name,open:e.open,"close-on-click-outside":"","out-transition":""},on:{"update:open":function(e){return s.emit("close",null)}},scopedSlots:e._u([{key:"actions",fn:function(){return[t(s.NcButton,{attrs:{"data-cy-files-new-node-dialog-submit":"",type:"primary",disabled:""!==s.validity},on:{click:s.submit}},[e._v("\n\t\t\t"+e._s(s.t("files","Create"))+"\n\t\t")])]},proxy:!0}])},[e._v(" "),t("form",{ref:"formElement",staticClass:"new-node-dialog__form",on:{submit:function(e){return e.preventDefault(),s.emit("close",s.localDefaultName)}}},[t(s.NcTextField,{ref:"nameInput",attrs:{"data-cy-files-new-node-dialog-input":"",error:""!==s.validity,"helper-text":s.validity,label:e.label,value:s.localDefaultName},on:{"update:value":function(e){s.localDefaultName=e}}}),e._v(" "),s.isHiddenFileName?t(s.NcNoteCard,{attrs:{type:"warning",text:s.t("files","Files starting with a dot are hidden by default")}}):e._e()],1)])},[],!1,null,"04462327",null).exports;function kt(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=t.map(e=>e.basename);return new Promise(t=>{(0,M.Ss)(bt,{...s,defaultName:e,otherNames:n},e=>{t(e)})})}const yt={id:"newFolder",displayName:(0,l.Tl)("files","New folder"),enabled:e=>Boolean(e.permissions&n.aX.CREATE)&&Boolean(e.permissions&n.aX.READ),iconSvgInline:''.replace(/viewBox/gi,'style="color: var(--color-primary-element)" viewBox'),order:0,async handler(e,t){const s=await kt((0,l.Tl)("files","New folder"),t);if(null!==s)try{const{fileid:t,source:i}=await(async(e,t)=>{const s=e.source+"/"+t,n=e.encodedSource+"/"+encodeURIComponent(t),i=await(0,U.Ay)({method:"MKCOL",url:n,headers:{Overwrite:"F"}});return{fileid:parseInt(i.headers["oc-fileid"]),source:s}})(e,s.trim()),a=new n.vd({source:i,id:t,mtime:new Date,owner:e.owner,permissions:n.aX.ALL,root:e?.root||"/files/"+(0,d.HW)()?.uid,attributes:{"mount-type":e.attributes?.["mount-type"],"owner-id":e.attributes?.["owner-id"],"owner-display-name":e.attributes?.["owner-display-name"]}});(0,S.Ic)("files:node:created",a),(0,M.Te)((0,l.Tl)("files",'Created new folder "{name}"',{name:(0,oe.basename)(i)})),j.A.debug("Created new folder",{folder:a,source:i}),window.OCP.Files.Router.goToRoute(null,{view:"files",fileid:String(t)},{dir:e.path})}catch(e){j.A.error("Creating new folder failed",{error:e}),(0,M.Qg)("Creating new folder failed")}}},Tt=(0,i.C)("files","templates_enabled",!0);let xt=(0,i.C)("files","templates_path",!1);j.A.debug("Templates folder enabled",{templatesEnabled:Tt}),j.A.debug("Initial templates folder",{templatesPath:xt});const Ct={id:"template-picker",displayName:(0,l.Tl)("files","Create templates folder"),iconSvgInline:'',order:30,enabled:e=>!(!Tt||xt)&&e.owner===(0,d.HW)()?.uid&&0!==(e.permissions&n.aX.CREATE),async handler(e,t){const s=await kt((0,l.Tl)("files","Templates"),t,{name:(0,l.Tl)("files","New template folder")});null!==s&&(async function(e,t){const s=(0,oe.join)(e.path,t);try{j.A.debug("Initializing the templates directory",{templatePath:s});const{data:e}=await U.Ay.post((0,y.KT)("apps/files/api/v1/templates/path"),{templatePath:s,copySystemTemplates:!0});window.OCP.Files.Router.goToRoute(null,{view:"files",fileid:void 0},{dir:s}),j.A.info("Created new templates folder",{...e.ocs.data}),xt=e.ocs.data.templates_path}catch(e){j.A.error("Unable to initialize the templates directory"),(0,M.Qg)((0,l.Tl)("files","Unable to initialize the templates directory"))}}(e,s),(0,n.gj)("template-picker"))}},St=(0,c.$V)(()=>Promise.all([s.e(4208),s.e(6916)]).then(s.bind(s,6916)));let Lt=null;const Ut=async e=>{if(null===Lt){const t=document.createElement("div");t.id="template-picker",document.body.appendChild(t),Lt=new c.Ay({render:t=>t(St,{ref:"picker",props:{parent:e}}),methods:{open(){this.$refs.picker.open(...arguments)}},el:t})}return Lt};var _t=s(77815),Nt=s(43690),At=s(56908),Ft=s(36117);const Et=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";return"/"!==e?(0,fe.hE)(e):new Ft.CancelablePromise((e,t,s)=>{const i=(0,n.Q$)(At.S).catch(t).then(s=>{s?e({contents:s,folder:new n.vd({id:0,source:`${n.PY}${n.lJ}`,root:n.lJ,owner:(0,d.HW)()?.uid||null,permissions:n.aX.READ})}):t()});s(()=>i.cancel())})},Pt=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new n.Ss({id:It(e.path),name:e.displayname,icon:Nt,order:t,params:{dir:e.path,fileid:String(e.fileid),view:"favorites"},parent:"favorites",columns:[],getContents:Et})},It=function(e){return`favorite-${function(e){let t=0;for(let s=0;s>>0}(e)}`},Rt=Math.round(Date.now()/1e3-1209600),Ot=e=>(0,n.Al)(e,n.lJ,(0,y.$_)()),zt=(0,d.HW)()?.uid,Bt=function(e){const t=e.attributes["mount-type"];return zt===e.owner&&!["group","shared"].includes(t)},jt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";return(0,fe.hE)(e).then(e=>(e.contents=e.contents.filter(Bt),e))};var Dt=s(4735);const Vt="personal";var Mt=s(25682);const Ht="folders",Wt=`${n.PY}/files/${(0,d.HW)()?.uid}`,Yt=Intl.Collator([(0,l.Z0)(),(0,l.lO)()],{numeric:!0,usage:"sort"}),$t=(e,t)=>Yt.compare(e.displayName??e.basename,t.displayName??t.basename),qt=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const n=e.toSorted($t);for(const{id:e,basename:i,displayName:a,children:o}of n){const n=(0,m.HS)(t,i),r=`${Wt}${n}`,l={source:r,encodedSource:Kt(r),path:n,fileid:e,basename:i};a&&(l.displayName=a),s.push(l),o.length>0&&qt(o,n,s)}return s},Gt=e=>(0,fe.hE)(e),Kt=e=>{const{origin:t}=new URL(e);return t+(0,m.O0)(e.slice(t.length))},Xt=e=>{const t=(0,m.pD)(e);return t===Wt?Ht:Kt(t)},Jt=(0,i.C)("files","config",{folder_tree:!0}).folder_tree;let Zt=(0,i.C)("files","config",{show_hidden:!1}).show_hidden;const Qt=(0,n.bh)(),es=new a.A({concurrency:5,intervalCap:5,interval:200}),ts=new a.A({concurrency:5,intervalCap:5,interval:200}),ss=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";await es.add(async()=>{const t=await async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const{data:s}=await U.Ay.get((0,y.KT)("/apps/files/api/v1/folder-tree"),{params:new URLSearchParams({path:e,depth:String(t)})});return qt(s,e)}(e),s=t.map(e=>ts.add(()=>is(e)));await Promise.allSettled(s)})},ns=e=>async t=>{t.loading||t.loaded||(t.loading=!0,await ss(e.path),t.loading=!1,t.loaded=!0,(0,S.Ic)("files:navigation:updated"),(0,S.Ic)("files:folder-tree:expanded"))},is=e=>{const t=Qt.views.find(t=>t.id===e.encodedSource);t&&Qt.remove(t.id),!Zt&&e.basename.startsWith(".")||Qt.register(new n.Ss({id:e.encodedSource,parent:Xt(e.source),name:e.displayName??e.displayname??e.basename,icon:Nt,getContents:Gt,loadChildViews:ns(e),params:{view:Ht,fileid:String(e.fileid),dir:e.path}}))},as=e=>{e.type===n.pt.Folder&&is(e)},os=e=>{e.type===n.pt.Folder&&(e=>{const t=e.encodedSource;Qt.remove(t)})(e)},rs=e=>{let{node:t,oldSource:s}=e;if(t.type!==n.pt.Folder)return;var i;i=s,Qt.remove(i),is(t);const a=t.source.replace(Wt,""),o=s.replace(Wt,""),r=Qt.views.filter(e=>!!e.params?.dir&&!(0,m.ys)(e.params.dir,o)&&e.params.dir.startsWith(o));for(const e of r)e.parent=Xt(t.source),e.params.dir=e.params.dir.replace(o,a)},ls=async e=>{let{key:t,value:s}=e;"show_hidden"===t&&(Zt=s,await ss(),(0,S.Ic)("files:folder-tree:initialized"))},ds=new a.A({concurrency:5}),ms=function(e,t){return U.Ay.post((0,y.KT)("/apps/files/api/v1/convert"),{fileId:e,targetMimeType:t})},cs="convert";var gs=s(82736);class us extends n.L3{constructor(){var e,t,s;super("files:filename",5),e=this,s="",(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t="searchQuery"))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,(0,S.B1)("files:search:updated",e=>{let{query:t,scope:s}=e;"filter"===s&&this.updateQuery(t)})}filter(e){const t=this.searchQuery.toLocaleLowerCase().split(" ").filter(Boolean);return e.filter(e=>{const s=e.displayname.toLocaleLowerCase();return t.every(e=>s.includes(e))})}reset(){this.updateQuery("")}updateQuery(e){if((e=(e||"").trim())!==this.searchQuery){this.searchQuery=e,this.filterUpdated();const t=[];if(""!==e)t.push({text:e,onclick:()=>{this.updateQuery("")}});else{const e=(0,gs.j)((0,F.u)());"filter"===e.scope&&(e.query="")}this.updateChips(t)}}}const fs=(0,c.pM)({__name:"FileListFilterToSearch",setup(e,t){let{expose:s}=t;const n=(0,c.KR)(!1);function i(){n.value=!1}function a(){n.value=!0}return s({hideButton:i,showButton:a}),{__sfc:!0,isVisible:n,hideButton:i,showButton:a,onClick:function(){(0,gs.j)((0,F.u)()).scope="globally"},t:l.t,NcButton:gt.A}}}),ps=(0,Ke.A)(fs,function(){var e=this,t=e._self._c,s=e._self._setupProxy;return t(s.NcButton,{directives:[{name:"show",rawName:"v-show",value:s.isVisible,expression:"isVisible"}],on:{click:s.onClick}},[e._v("\n\t"+e._s(s.t("files","Search everywhere"))+"\n")])},[],!1,null,null,null).exports;class hs extends n.L3{constructor(){var e,t,s;super("files:filter-to-search",999),e=this,s=void 0,(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t="currentInstance"))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,(0,S.B1)("files:search:updated",e=>{let{query:t,scope:s}=e;t&&"filter"===s?this.currentInstance?.showButton():this.currentInstance?.hideButton()})}mount(e){this.currentInstance&&this.currentInstance.$destroy();const t=c.Ay.extend(ps);this.currentInstance=(new t).$mount(e)}filter(e){return e}}(()=>{const e=((0,L.F)()?.files?.file_conversions??[]).map(e=>{let{to:t,from:s,displayName:i}=e;return new n.hY({id:`convert-${s}-${t}`,displayName:()=>(0,l.t)("files","Save as {displayName}",{displayName:i}),iconSvgInline:()=>{return e=t,``;var e},enabled:e=>e.every(e=>s===e.mime),exec:async e=>(async function(e,t){const s=(0,M.Cs)((0,l.t)("files","Converting file …"));try{const s=await ds.add(()=>ms(e,t));(0,M.Te)((0,l.t)("files","File successfully converted"));const n=await(0,At.t)(s.data.ocs.data.path);(0,S.Ic)("files:node:created",n);const i=s.data.ocs.data.fileId;window.OCP.Files.Router.goToRoute(null,{...window.OCP.Files.Router.params,fileid:i.toString()},window.OCP.Files.Router.query)}catch(s){if((0,U.F0)(s)&&s.response?.data?.ocs?.meta?.message)return void(0,M.Qg)((0,l.t)("files","Failed to convert file: {message}",{message:s.response.data.ocs.meta.message}));j.A.error("Failed to convert file",{fileId:e,targetMimeType:t,error:s}),(0,M.Qg)((0,l.t)("files","Failed to convert file"))}finally{s.hideToast()}}(e.fileid,t),null),execBatch:async e=>(async function(e,t){const s=e.map(e=>ds.add(()=>ms(e,t))),n=(0,M.Cs)((0,l.t)("files","Converting files …"));try{const n=await Promise.allSettled(s),i=n.filter(e=>"rejected"===e.status);if(i.length>0){const s=i.map(e=>e.reason?.response?.data?.ocs?.meta?.message);return j.A.error("Failed to convert files",{fileIds:e,targetMimeType:t,messages:s}),1===new Set(s).size&&"string"==typeof s[0]?void(0,M.Qg)((0,l.t)("files","Failed to convert files: {message}",{message:s[0]})):i.length===e.length?void(0,M.Qg)((0,l.t)("files","All files failed to be converted")):1===i.length&&s[0]?void(0,M.Qg)((0,l.t)("files","One file could not be converted: {message}",{message:s[0]})):((0,M.Qg)((0,l.n)("files","One file could not be converted","%n files could not be converted",i.length)),void(0,M.Te)((0,l.n)("files","One file successfully converted","%n files successfully converted",e.length-i.length)))}(0,M.Te)((0,l.t)("files","Files successfully converted"));const a=window.OCP.Files.Router.query.dir,o=n.filter(e=>"fulfilled"===e.status).map(e=>e.value.data.ocs.data.path).filter(e=>e.startsWith(a));j.A.debug("Files to fetch",{newPaths:o}),(await Promise.all(o.map(e=>(0,At.t)(e)))).forEach(e=>(0,S.Ic)("files:node:created",e));const r=n[0].value.data.ocs.data.fileId;window.OCP.Files.Router.goToRoute(null,{...window.OCP.Files.Router.params,fileid:r.toString()},window.OCP.Files.Router.query)}catch(s){(0,M.Qg)((0,l.t)("files","Failed to convert files")),j.A.error("Failed to convert files",{fileIds:e,targetMimeType:t,error:s})}finally{n.hideToast()}}(e.map(e=>e.fileid).filter(Boolean),t),Array(e.length).fill(null)),parent:cs})});(0,n.Gg)(new n.hY({id:cs,displayName:()=>(0,l.t)("files","Save as …"),iconSvgInline:()=>'',enabled:(t,s)=>e.some(e=>e.enabled(t,s)),exec:async()=>null,order:25})),e.forEach(n.Gg)})(),(0,n.Gg)(V),(0,n.Gg)(K),(0,n.Gg)(J),(0,n.Gg)(ie),(0,n.Gg)(ve),(0,n.Gg)(ke),(0,n.Gg)(Te),(0,n.Gg)(Ce),(0,n.Gg)(Le),(0,n.Gg)(Ue),(0,n.zj)(yt),(0,n.zj)(Ct),function(){let e;e=(0,X.f)()?(0,i.C)("files_sharing","templates",[]):(0,i.C)("files","templates",[]),e.forEach((e,t)=>{(0,n.zj)({id:`template-new-${e.app}-${t}`,displayName:e.label,iconClass:e.iconClass||"icon-file",iconSvgInline:e.iconSvgInline,enabled:e=>0!==(e.permissions&n.aX.CREATE),order:11,async handler(t,s){const n=Ut(t),i=await kt(`${e.label}${e.extension}`,s,{label:(0,l.Tl)("files","Filename"),name:e.label});null!==i&&(await n).open(i.trim(),e)}})})}(),!1===(0,X.f)()&&((async()=>{const e=(0,n.bh)();e.register(new n.Ss({id:"favorites",name:(0,l.t)("files","Favorites"),caption:(0,l.t)("files","List of favorite files and folders."),emptyTitle:(0,l.t)("files","No favorites yet"),emptyCaption:(0,l.t)("files","Files and folders you mark as favorite will show up here"),icon:Q,order:15,columns:[],getContents:Et}));const t=(await(0,_t.Q$)(At.S)).filter(e=>e.type===n.pt.Folder),s=t.map((e,t)=>Pt(e,t));j.A.debug("Generating favorites view",{favoriteFolders:t}),s.forEach(t=>e.register(t)),(0,S.B1)("files:favorites:added",e=>{e.type===n.pt.Folder&&(null!==e.path&&e.root?.startsWith("/files")?a(e):j.A.error("Favorite folder is not within user files root",{node:e}))}),(0,S.B1)("files:favorites:removed",e=>{e.type===n.pt.Folder&&(null!==e.path&&e.root?.startsWith("/files")?o(e.path):j.A.error("Favorite folder is not within user files root",{node:e}))}),(0,S.B1)("files:node:renamed",e=>{e.type===n.pt.Folder&&1===e.attributes.favorite&&r(e)});const i=function(){t.sort((e,t)=>e.basename.localeCompare(t.basename,[(0,l.Z0)(),(0,l.lO)()],{ignorePunctuation:!0,numeric:!0,usage:"sort"})),t.forEach((e,t)=>{const n=s.find(t=>t.id===It(e.path));n&&(n.order=t)})},a=function(n){const a=Pt(n);t.find(e=>e.path===n.path)||(t.push(n),s.push(a),i(),e.register(a))},o=function(n){const a=It(n),o=t.findIndex(e=>e.path===n);-1!==o&&(t.splice(o,1),s.splice(o,1),e.remove(a),i())},r=function(e){const s=t.find(t=>t.fileid===e.fileid);void 0!==s&&(o(s.path),a(e))};i()})(),(0,Mt.g)(),(0,Dt.L)()&&(0,n.bh)().register(new n.Ss({id:Vt,name:(0,l.t)("files","Personal files"),caption:(0,l.t)("files","List of your files and folders that are not shared."),emptyTitle:(0,l.t)("files","No personal files found"),emptyCaption:(0,l.t)("files","Files that are not shared will show up here."),icon:'',order:(0,Dt.P)()===Vt?0:5,getContents:jt})),(0,n.bh)().register(new n.Ss({id:"recent",name:(0,l.Tl)("files","Recent"),caption:(0,l.Tl)("files","List of recently modified files and folders."),emptyTitle:(0,l.Tl)("files","No recently modified files"),emptyCaption:(0,l.Tl)("files","Files and folders you recently modified will show up here."),icon:'',order:10,defaultSortKey:"mtime",getContents:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";const t=A((0,F.u)()),s=s=>"/"!==e||t.userConfig.show_hidden||!s.dirname.split("/").some(e=>e.startsWith(".")),i=new AbortController;return new Ft.CancelablePromise(async(e,t,a)=>{a(()=>i.abort()),e((async()=>{const e=(await At.S.search("/",{signal:i.signal,details:!0,data:(0,n.R3)(Rt)})).data.results.map(Ot).filter(s);return{folder:new n.vd({id:0,source:`${n.PY}${n.lJ}`,root:n.lJ,owner:(0,d.HW)()?.uid||null,permissions:n.aX.READ}),contents:e}})())})}})),(0,ye.d)(),(async()=>{Jt&&(Qt.register(new n.Ss({id:Ht,name:(0,l.Tl)("files","Folder tree"),caption:(0,l.Tl)("files","List of your files and folders."),icon:re,order:50,getContents:Gt})),await ss(),(0,S.B1)("files:node:created",as),(0,S.B1)("files:node:deleted",os),(0,S.B1)("files:node:moved",rs),(0,S.B1)("files:config:updated",ls),(0,S.Ic)("files:folder-tree:initialized"))})()),(0,n.cZ)(new _e),(0,n.cZ)(new nt),(0,n.cZ)(new ct),(0,n.cZ)(new us),(0,n.cZ)(new hs),"serviceWorker"in navigator?window.addEventListener("load",async()=>{try{const e=(0,y.Jv)("/apps/files/preview-service-worker.js",{},{noRewrite:!0});let t=(0,y.aU)();""===t&&(t="/");const s=await navigator.serviceWorker.register(e,{scope:t});j.A.debug("SW registered: ",{registration:s})}catch(e){j.A.error("SW registration failed: ",{error:e})}}):j.A.debug("Service Worker is not enabled on this browser."),(0,n.Yc)("nc:hidden",{nc:"http://nextcloud.org/ns"}),(0,n.Yc)("nc:is-mount-root",{nc:"http://nextcloud.org/ns"}),(0,n.Yc)("nc:metadata-blurhash",{nc:"http://nextcloud.org/ns"}),(0,n.Yc)("nc:metadata-files-live-photo",{nc:"http://nextcloud.org/ns"})},16954:(e,t,s)=>{s.d(t,{hE:()=>u});var n=s(77815),i=s(36117),a=s(43627),o=s(56908),r=s(21976),l=s(4114),d=s(89761),m=s(82736),c=s(9558);const g=e=>(0,n.pO)(e);function u(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";const t=new AbortController,s=(0,m.j)((0,l.u)());return s.query.length>=3?new i.CancelablePromise((i,m,c)=>{c(()=>t.abort()),async function(e,t,s){let i=(0,d._)((0,l.u)()).getDirectoryByPath("files",e);if(!i){const t=(0,a.join)(n.VA,e),s=await o.S.stat(t,{details:!0});i=g(s.data)}return{folder:i,contents:await(0,r.E)(t,{dir:e,signal:s})}}(e,s.query,t.signal).then(i).catch(m)}):function(e){e=(0,a.join)(n.VA,e);const t=new AbortController,s=(0,n.aN)();return new i.CancelablePromise(async(n,i,a)=>{a(()=>t.abort());try{const i=await o.S.getDirectoryContents(e,{details:!0,data:s,includeSelf:!0,signal:t.signal}),a=i.data[0],r=i.data.slice(1);if(a.filename!==e&&`${a.filename}/`!==e)throw c.A.debug(`Exepected "${e}" but got filename "${a.filename}" instead.`),new Error("Root node does not match requested path");n({folder:g(a),contents:r.map(e=>{try{return g(e)}catch(t){return c.A.error(`Invalid node detected '${e.basename}'`,{error:t}),null}}).filter(Boolean)})}catch(e){i(e)}})}(e)}},21976:(e,t,s)=>{s.d(t,{E:()=>l});var n=s(21777),i=s(77815),a=s(63814),o=s(56908),r=s(9558);async function l(e,t){let{dir:s,signal:l}=t;const d=(0,n.HW)();if(!d)return[];if((e=e.trim()).length<3)return[];s&&!s.startsWith("/")&&(s=`/${s}`),r.A.debug("Searching for nodes",{query:e,dir:s});const{data:m}=await o.S.search("/",{details:!0,signal:l,data:`\n\n\t \n\t\t \n\t\t\t \n\t\t\t ${(0,i.VX)()}\n\t\t\t \n\t\t \n\t\t \n\t\t\t \n\t\t\t\t /files/${d.uid}${s||""}\n\t\t\t\t infinity\n\t\t\t \n\t\t \n\t\t \n\t\t\t \n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t \n\t\t\t\t %${e.replace("%","")}%\n\t\t\t \n\t\t \n\t\t \n\t\n`});return l?.aborted?[]:m.results.map(e=>(0,i.pO)(e,i.VA,(0,a.$_)()))}},25682:(e,t,s)=>{s.d(t,{g:()=>c,w:()=>m});var n=s(61338),i=s(35810),a=s(53334),o=s(16954),r=s(49542),l=s(4735),d=s(43690);const m="files";function c(){let e="";const t=(0,i.bh)();t.register(new i.Ss({id:m,name:(0,a.t)("files","All files"),caption:(0,a.t)("files","List of your files and folders."),icon:d,order:(0,l.P)()===m?0:5,getContents:o.hE})),(0,n.B1)("files:search:updated",s=>{let{scope:i,query:a}=s;if("globally"===i)return;if(t.active?.id!==m)return;if(e.length<3&&a.length<3)return;const o=(0,r.F)();o.activeFolder&&(e=a,(0,n.Ic)("files:node:updated",o.activeFolder))})}},30610:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(71354),i=s.n(n),a=s(76314),o=s.n(a)()(i());o.push([e.id,"\n.files-list-filter__clear-button[data-v-21c6ff6c] .action-button__text {\n\tcolor: var(--color-text-error, var(--color-error-text));\n}\n[data-v-21c6ff6c] .button-vue {\n\tfont-weight: normal !important;\n*[data-v-21c6ff6c] {\n\t\tfont-weight: normal !important;\n}\n}\n","",{version:3,sources:["webpack://./apps/files/src/components/FileListFilter/FileListFilter.vue"],names:[],mappings:";AAyCA;CACA,uDAAA;AACA;AAEA;CACA,8BAAA;AAEA;EACA,8BAAA;AACA;AACA",sourcesContent:["\x3c!--\n - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t{{ t('files', 'Clear filter') }}\n\t\t\t\n\t\t\n\t\n\n\n