13 lines
9.8 KiB
JavaScript
13 lines
9.8 KiB
JavaScript
import{g as G,a as J,b as W,r as Y,C as V,d as Z,V as Q,F as X,e as ee,P as te,c as ae,f as se,h as ne,i as re,j as ie}from"./index-iLwAC0ok.chunk.mjs";import{j as L,k as le,m as A,n as o,p as oe,u as p,q as D,s as H,x as ue,y as de,z as ce,c as N,o as b,w,A as C,B as S,C as fe,b as me,h as he,D as z,E as pe,F as be,t as ve,G as v,i as ge,f as r,H as M,I as k,g as ye,U as we,e as F,J as R,K as _e,l as xe}from"./NcSettingsSection-DFav6ob5-DwBgvX10.chunk.mjs";import{r as K,a as Ae,i as E,b as Ce,c as Ie,n as Ve,N as ke,d as $e,f as He,g as Ne,s as O,e as Se,h as Ee}from"./check-JUc8IOXP.chunk.mjs";import"./TrashCanOutline-C-NZ7KHV.chunk.mjs";const Te='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-history" viewBox="0 0 24 24"><path d="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0 0,0 4,12H1L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3" /></svg>';function T(e){const t=A(K),a=A(Ae),s=o(()=>{const u=p(e.to);return t.resolve(u)}),n=o(()=>{const{matched:u}=s.value,{length:d}=u,h=u[d-1],c=a.matched;if(!h||!c.length)return-1;const i=c.findIndex(E.bind(null,h));if(i>-1)return i;const f=B(u[d-2]);return d>1&&B(h)===f&&c[c.length-1].path!==f?c.findIndex(E.bind(null,u[d-2])):i}),l=o(()=>n.value>-1&&ze(a.params,s.value.params)),m=o(()=>n.value>-1&&n.value===a.matched.length-1&&Ce(a.params,s.value.params));function g(u={}){if(De(u)){const d=t[p(e.replace)?"replace":"push"](p(e.to)).catch(Ve);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:s,href:o(()=>s.value.href),isActive:l,isExactActive:m,navigate:g}}function Be(e){return e.length===1?e[0]:e}const Ue=L({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:T,setup(e,{slots:t}){const a=le(T(e)),{options:s}=A(K),n=o(()=>({[U(e.activeClass,s.linkActiveClass,"router-link-active")]:a.isActive,[U(e.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:a.isExactActive}));return()=>{const l=t.default&&Be(t.default(a));return e.custom?l:oe("a",{"aria-current":a.isExactActive?e.ariaCurrentValue:null,href:a.href,onClick:a.navigate,class:n.value},l)}}}),Le=Ue;function De(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function ze(e,t){for(const a in t){const s=t[a],n=e[a];if(typeof s=="string"){if(s!==n)return!1}else if(!Ie(n)||n.length!==s.length||s.some((l,m)=>l!==n[m]))return!1}return!0}function B(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const U=(e,t,a)=>e??t??a,Me={};function Fe(e,t){return b(),z("div",null,[C(e.$slots,"trigger")])}const Re=D(Me,[["render",Fe]]),Ke={class:"user-bubble__name"},Oe={key:0,class:"user-bubble__secondary"},Pe=L({__name:"NcUserBubble",props:H({avatarImage:{default:void 0},user:{default:void 0},displayName:{default:void 0},showUserStatus:{type:Boolean},url:{default:void 0},to:{default:void 0},primary:{type:Boolean},size:{default:20},margin:{default:2}},{open:{type:Boolean},openModifiers:{}}),emits:H(["click"],["update:open"]),setup(e,{emit:t}){const a=ue(e,"open"),s=e,n=t,l=o(()=>{if(!s.avatarImage)return!1;try{return!!new URL(s.avatarImage)}catch{return!1}}),m=o(()=>!!s.avatarImage),g=o(()=>({marginInlineStart:`${s.margin}px`})),u=o(()=>{if(!s.url||s.url.trim()==="")return!1;try{return!!new URL(s.url,s.url?.startsWith?.("/")?window.location.href:void 0)}catch{return de("[NcUserBubble] Invalid URL passed",{url:s.url}),!1}}),d=o(()=>u.value?s.url:void 0),h=o(()=>u.value?"a":s.to?Le:"div"),c=o(()=>({height:`${s.size}px`,lineHeight:`${s.size}px`,borderRadius:`${s.size/2}px`}));return ce([()=>s.displayName,()=>s.user],()=>{!s.displayName&&s.user}),(i,f)=>(b(),N(S(i.$slots.default?p($e):Re),{shown:a.value,"onUpdate:shown":f[1]||(f[1]=y=>a.value=y),class:"user-bubble__wrapper",trigger:"hover focus"},{trigger:w(({attrs:y})=>[(b(),N(S(h.value),fe({class:["user-bubble__content",{"user-bubble__content--primary":i.primary}],style:c.value,to:i.to,href:d.value},y,{onClick:f[0]||(f[0]=q=>n("click",q))}),{default:w(()=>[me(p(ke),{url:m.value&&l.value?i.avatarImage:void 0,"icon-class":m.value&&!l.value?i.avatarImage:void 0,user:i.user,"display-name":i.displayName,size:i.size-i.margin*2,style:be(g.value),"disable-tooltip":!0,"disable-menu":!0,"hide-status":!i.showUserStatus,class:"user-bubble__avatar"},null,8,["url","icon-class","user","display-name","size","style","hide-status"]),he("span",Ke,ve(i.displayName||i.user),1),i.$slots.name?(b(),z("span",Oe,[C(i.$slots,"name",{},void 0,!0)])):pe("",!0)]),_:2},1040,["class","style","to","href"]))]),default:w(()=>[C(i.$slots,"default",{},void 0,!0)]),_:3},40,["shown"]))}}),je=D(Pe,[["__scopeId","data-v-37bde6b7"]]),qe='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-trash-can-outline" viewBox="0 0 24 24"><path d="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" /></svg>',P=`/trashbin/${v()?.uid}/trash`,Ge=G(),Je=`<?xml version="1.0"?>
|
|
<d:propfind ${J()}>
|
|
<d:prop>
|
|
<nc:trashbin-deletion-time />
|
|
<nc:trashbin-original-location />
|
|
<nc:trashbin-title />
|
|
<nc:trashbin-deleted-by-id />
|
|
<nc:trashbin-deleted-by-display-name />
|
|
${W()}
|
|
</d:prop>
|
|
</d:propfind>`;function We(e){const t=Y(e,P);return t.attributes.previewUrl=ge("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:t.fileid}),t}async function Ye(e="/"){const t=(await Ge.getDirectoryContents(`${P}${e}`,{details:!0,data:Je,includeSelf:!0})).data.map(We),[a]=t.splice(t.findIndex(s=>s.path===e),1);return{folder:a,contents:t}}const Ze=new V({id:"files_trashbin--original-location",title:r("files_trashbin","Original location"),render(e){const t=_(e),a=document.createElement("span");return a.title=t,a.textContent=t,a},sort(e,t){const a=_(e),s=_(t);return a.localeCompare(s,[M(),k()],{numeric:!0,usage:"sort"})}}),Qe=new V({id:"files_trashbin--deleted-by",title:r("files_trashbin","Deleted by"),render(e){const{userId:t,displayName:a,label:s}=x(e);if(s){const l=document.createElement("span");return l.textContent=s,l}const n=document.createElement("div");return ye(je,{size:32,user:t??void 0,displayName:a??t}).mount(n),n},sort(e,t){const a=x(e),s=a.label??a.displayName??a.userId,n=x(t),l=n.label??n.displayName??n.userId;return s.localeCompare(l,[M(),k()],{numeric:!0,usage:"sort"})}}),Xe=new V({id:"files_trashbin--deleted",title:r("files_trashbin","Deleted"),render(e){const t=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3,a=document.createElement("span");if(t){const s=Intl.DateTimeFormat([k()],{dateStyle:"long",timeStyle:"short"}),n=new Date(t*1e3);return a.title=s.format(n),a.textContent=He(n,{ignoreSeconds:r("files","few seconds ago")}),a}return a.textContent=r("files_trashbin","A long time ago"),a},sort(e,t){const a=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3;return(t.attributes?.["trashbin-deletion-time"]||(t?.mtime?.getTime()??0)/1e3)-a}});function _(e){const t=I(e.attributes?.["trashbin-original-location"]);if(!t)return r("files_trashbin","Unknown");const a=Z(t);return a===t?r("files_trashbin","All files"):a.replace(/^\//,"")}function x(e){const t=I(e.attributes?.["trashbin-deleted-by-id"]),a=I(e.attributes?.["trashbin-deleted-by-display-name"]);let s;const n=v()?.uid;return t===n&&(s=r("files_trashbin","You")),!t&&!a&&(s=r("files_trashbin","Unknown")),{userId:t,displayName:a,label:s}}function I(e){return e?String(e):null}const $="trashbin",et=new Q({id:$,name:r("files_trashbin","Deleted files"),caption:r("files_trashbin","List of files that have been deleted."),emptyTitle:r("files_trashbin","No deleted files"),emptyCaption:r("files_trashbin","Files and folders you have deleted will show up here"),icon:qe,order:50,sticky:!0,defaultSortKey:"deleted",columns:[Ze,Qe,Xe],getContents:Ye}),j=Ne().setApp("files_trashbin").detectUser().build(),tt=new X({id:"restore",displayName(){return r("files_trashbin","Restore")},iconSvgInline:()=>Te,enabled(e,t){return t.id!==$?!1:e.length>0&&e.map(a=>a.permissions).every(a=>!!(a&te.READ))},async exec(e){try{const t=we(ee(`dav/trashbin/${v().uid}/restore/${e.basename}`));return await F.request({method:"MOVE",url:e.encodedSource,headers:{destination:t}}),R("files:node:deleted",e),!0}catch(t){return _e(t)&&t.response?.status===507&&O(r("files_trashbin","Not enough free space to restore the file/folder")),j.error("Failed to restore node",{error:t,node:e}),!1}},async execBatch(e,t,a){return Promise.all(e.map(s=>this.exec(s,t,a)))},order:1,inline:()=>!0});async function at(){try{return await F.delete(`${ae}/trashbin/${v().uid}/trash`),Se(r("files_trashbin","All files have been permanently deleted")),!0}catch(e){return O(r("files_trashbin","Failed to empty deleted files")),j.error("Failed to empty deleted files",{error:e}),!1}}const st=new se({id:"empty-trash",displayName:()=>r("files_trashbin","Empty deleted files"),order:0,enabled(e,t,a){return e.id!==$||!xe("files_trashbin","config").allow_delete?!1:t.length>0&&a.path==="/"},async exec(e,t){return await new Promise(a=>{Ee(r("files_trashbin","Confirm permanent deletion")).setSeverity("warning").setText(r("files_trashbin","Are you sure you want to permanently delete all files and folders in the trash? This cannot be undone.")).setButtons([{label:r("files_trashbin","Cancel"),variant:"secondary",callback:()=>a(!1)},{label:r("files_trashbin","Empty deleted files"),variant:"error",callback:()=>a(!0)}]).build().show().then(()=>{a(!1)})})===!0&&await at()&&t.forEach(a=>R("files:node:deleted",a)),null}}),nt=ne();nt.register(et),re(st),ie(tt);
|
|
//# sourceMappingURL=files_trashbin-init.mjs.map
|