nextcloud-server/dist/files-sidebar.js

2 lines
32 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

(()=>{var e,i,s,a={9165:(e,t,i)=>{"use strict";i.d(t,{$5:()=>m,Brj:()=>c,DvY:()=>o,HzW:()=>g,IyB:()=>s,K5o:()=>a,NZC:()=>n,ZL5:()=>h,dF:()=>f,fEr:()=>l,hyP:()=>r,jUz:()=>p,kHm:()=>u,kOJ:()=>d});var s="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",a="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",n="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",r="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",o="M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6Z",l="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",d="M1,1V5H2V19H1V23H5V22H19V23H23V19H22V5H23V1H19V2H5V1M5,4H19V5H20V19H19V20H5V19H4V5H5M6,6V14H9V18H18V9H14V6M8,8H12V12H8M14,11H16V16H11V14H14",c="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",u="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",p="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",h="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="M12,15.39L8.24,17.66L9.23,13.38L5.91,10.5L10.29,10.13L12,6.09L13.71,10.13L18.09,10.5L14.77,13.38L15.76,17.66M22,9.24L14.81,8.63L12,2L9.19,8.63L2,9.24L7.45,13.97L5.82,21L12,17.27L18.18,21L16.54,13.97L22,9.24Z",g="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",m="M6.5 10C7.3 10 8 9.3 8 8.5S7.3 7 6.5 7 5 7.7 5 8.5 5.7 10 6.5 10M9 6L16 13L11 18L4 11V6H9M9 4H4C2.9 4 2 4.9 2 6V11C2 11.6 2.2 12.1 2.6 12.4L9.6 19.4C9.9 19.8 10.4 20 11 20S12.1 19.8 12.4 19.4L17.4 14.4C17.8 14 18 13.5 18 13C18 12.4 17.8 11.9 17.4 11.6L10.4 4.6C10.1 4.2 9.6 4 9 4M13.5 5.7L14.5 4.7L21.4 11.6C21.8 12 22 12.5 22 13S21.8 14.1 21.4 14.4L16 19.8L15 18.8L20.7 13L13.5 5.7Z"},11034:(e,i,s)=>{"use strict";var a=s(53334),n=s(85471),r=s(9165),o=s(21777),l=s(19051),d=s(87485),c=s(85168),u=s(61338),p=s(35810),h=s(71225),f=s(63814),g=s(40715),m=s(74692),b=s.n(m),y=s(57505),A=s(59839),v=s(4604),w=s(42507),_=s(6695),C=s(77764),T=s(81222),S=s(88289),I=s(5212),L=s(1822);const x=(0,L.c)();async function F(e){const t=(0,L.l)(),i=await x.stat(`${(0,L.g)()}${e}`,{details:!0,data:t});return(0,L.r)(i.data)}var O=s(35947);const H=(0,O.YK)().setApp("systemtags").detectUser().build();s(47176);var E=s(71654);const V={userVisible:!0,userAssignable:!0,canAssign:!0};function M(e){return e.map(({props:e})=>Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,E.A)(e),"displayName"===(0,E.A)(e)?String(t):t])))}function N(e){if("name"in e&&!("displayName"in e))return{...e};const t={...e};return t.name=t.displayName,delete t.displayName,t}var k=s(60669);const D=(0,f.dC)("dav"),P=(0,k.UU)(D);function B(e){P.setHeaders({"X-Requested-With":"XMLHttpRequest",requesttoken:e??""})}(0,o.zo)(B),B((0,o.do)());const $='<?xml version="1.0"?>\n<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">\n\t<d:prop>\n\t\t<oc:id />\n\t\t<oc:display-name />\n\t\t<oc:user-visible />\n\t\t<oc:user-assignable />\n\t\t<oc:can-assign />\n\t\t<d:getetag />\n\t\t<nc:color />\n\t</d:prop>\n</d:propfind>';async function U(e){const t="/systemtags-relations/files/"+e;try{const{data:e}=await P.getDirectoryContents(t,{data:$,details:!0,glob:"/systemtags-relations/files/*/*"});return M(e)}catch(e){throw H.error((0,a.t)("systemtags","Failed to load tags for file"),{error:e}),new Error((0,a.t)("systemtags","Failed to load tags for file"))}}async function j(e,t){const i="/systemtags-relations/files/"+t+"/"+e.id,s=N(e);try{await P.customRequest(i,{method:"PUT",data:s})}catch(e){throw H.error((0,a.t)("systemtags","Failed to set tag for file"),{error:e}),new Error((0,a.t)("systemtags","Failed to set tag for file"))}}const R=n.Ay.extend({name:"SystemTags",components:{NcLoadingIcon:S.A,NcSelectTags:I.A},props:{fileId:{type:Number,required:!0},disabled:{type:Boolean,default:!1}},data:()=>({sortedTags:[],selectedTags:[],loadingTags:!1,loading:!1}),watch:{fileId:{immediate:!0,async handler(){this.loadingTags=!0;try{this.selectedTags=await U(this.fileId)}catch(e){(0,c.Qg)((0,a.t)("systemtags","Failed to load selected tags")),H.error("Failed to load selected tags",{error:e})}this.loadingTags=!1}}},async created(){try{const e=await async function(){try{const{data:e}=await P.getDirectoryContents("/systemtags",{data:$,details:!0,glob:"/systemtags/*"});return M(e)}catch(e){throw H.error((0,a.t)("systemtags","Failed to load tags"),{error:e}),new Error((0,a.t)("systemtags","Failed to load tags"))}}(),t=await async function(){const e=(0,f.Jv)("/apps/systemtags/lastused");try{const{data:t}=await l.Ay.get(e);return t.map(Number)}catch(e){throw H.error((0,a.t)("systemtags","Failed to load last used tags"),{error:e}),new Error((0,a.t)("systemtags","Failed to load last used tags"))}}(),i=[],s=[];for(const a of e)t.includes(a.id)?i.push(a):s.push(a);const n=(e,i)=>t.indexOf(e.id)-t.indexOf(i.id);i.sort(n),this.sortedTags=[...i,...s]}catch(e){(0,c.Qg)((0,a.t)("systemtags","Failed to load tags")),H.error("Failed to load tags",{error:e})}},mounted(){(0,u.B1)("systemtags:node:updated",this.onTagUpdated)},methods:{t:a.t,createOption(e){for(const t of this.sortedTags){const{displayName:i,...s}=t;if(i===e&&Object.entries(s).every(([e,t])=>V[e]===t))return t}return{...V,displayName:e}},handleInput(e){this.selectedTags=e.filter(e=>Boolean(e.id))},async handleSelect(e){const t=e[e.length-1];if(!t.id)return;const i=t;this.loading=!0;try{await j(i,this.fileId);const e=(e,t)=>e.id===i.id?-1:t.id===i.id?1:0;this.sortedTags.sort(e)}catch(e){(0,c.Qg)((0,a.t)("systemtags","Failed to select tag")),H.error("Failed to select tag",{error:e})}this.loading=!1,this.updateAndDispatchNodeTagsEvent(this.fileId)},async handleCreate(e){this.loading=!0;try{const t=await async function(e,t){const i=N(e),s=await async function(e){const t=N(e);try{const{headers:i}=await P.customRequest("/systemtags",{method:"POST",data:t}),s=i.get("content-location");if(s)return(0,u.Ic)("systemtags:tag:created",e),function(e){const t=e.indexOf("?");t>0&&(e=e.substring(0,t));const i=e.split("/");let s;do{s=i[i.length-1],i.pop()}while(!s&&i.length>0);return Number(s)}(s);throw H.error((0,a.t)("systemtags",'Missing "Content-Location" header')),new Error((0,a.t)("systemtags",'Missing "Content-Location" header'))}catch(e){if(409===e?.response?.status)throw H.error((0,a.t)("systemtags","A tag with the same name already exists"),{error:e}),new Error((0,a.t)("systemtags","A tag with the same name already exists"));throw H.error((0,a.t)("systemtags","Failed to create tag"),{error:e}),new Error((0,a.t)("systemtags","Failed to create tag"))}}(i),n={...i,id:s};return await j(n,t),n.id}(e,this.fileId),i={...e,id:t};this.sortedTags.unshift(i),this.selectedTags.push(i)}catch(e){const t=!0===(0,T.C)("settings","restrictSystemTagsCreationToAdmin",!1);if(H.error("Failed to create tag",{error:e}),t)return void(0,c.Qg)((0,a.t)("systemtags","System admin disabled tag creation. You can only use existing ones."));(0,c.Qg)((0,a.t)("systemtags","Failed to create tag"))}this.loading=!1,this.updateAndDispatchNodeTagsEvent(this.fileId)},async handleDeselect(e){this.loading=!0;try{await async function(e,t){const i="/systemtags-relations/files/"+t+"/"+e.id;try{await P.deleteFile(i)}catch(e){throw H.error((0,a.t)("systemtags","Failed to delete tag for file"),{error:e}),new Error((0,a.t)("systemtags","Failed to delete tag for file"))}}(e,this.fileId)}catch(e){(0,c.Qg)((0,a.t)("systemtags","Failed to delete tag")),H.error("Failed to delete tag",{error:e})}this.loading=!1,this.updateAndDispatchNodeTagsEvent(this.fileId)},async onTagUpdated(e){if(e.fileid===this.fileId){this.loadingTags=!0;try{this.selectedTags=await U(this.fileId)}catch(e){(0,c.Qg)((0,a.t)("systemtags","Failed to load selected tags")),H.error("Failed to load selected tags",{error:e})}this.loadingTags=!1}},async updateAndDispatchNodeTagsEvent(e){const t=window.OCA?.Files?.Sidebar?.file||"";try{const e=await F(t);e&&(0,u.Ic)("systemtags:node:updated",e)}catch(t){H.error("Failed to fetch node for system tags update",{error:t,fileId:e})}}}});var z=s(85072),q=s.n(z),Z=s(97825),W=s.n(Z),Y=s(77659),Q=s.n(Y),J=s(55056),K=s.n(J),G=s(10540),X=s.n(G),ee=s(41113),te=s.n(ee),ie=s(30870),se={};se.styleTagTransform=te(),se.setAttributes=K(),se.insert=Q().bind(null,"head"),se.domAPI=W(),se.insertStyleElement=X(),q()(ie.A,se),ie.A&&ie.A.locals&&ie.A.locals;var ae=s(14486);const ne=(0,ae.A)(R,function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticClass:"system-tags"},[e.loadingTags?t("NcLoadingIcon",{attrs:{name:e.t("systemtags","Loading collaborative tags …"),size:32}}):e._e(),e._v(" "),t("NcSelectTags",{directives:[{name:"show",rawName:"v-show",value:!e.loadingTags,expression:"!loadingTags"}],staticClass:"system-tags__select",attrs:{"input-label":e.t("systemtags","Search or create collaborative tags"),placeholder:e.t("systemtags","Collaborative tags …"),options:e.sortedTags,"model-value":e.selectedTags,"create-option":e.createOption,disabled:e.disabled,taggable:!0,passthru:!0,"fetch-tags":!1,loading:e.loading},on:{input:e.handleInput,"option:selected":e.handleSelect,"option:created":e.handleCreate,"option:deselected":e.handleDeselect},scopedSlots:e._u([{key:"no-options",fn:function(){return[e._v("\n\t\t\t"+e._s(e.t("systemtags","No tags to select, type to create a new tag"))+"\n\t\t")]},proxy:!0}])})],1)},[],!1,null,"44cd705a",null).exports,re={name:"LegacyView",props:{component:{type:Object,required:!0},fileInfo:{type:Object,required:!0}},watch:{fileInfo(e){this.setFileInfo(e)}},mounted(){this.component.$el.replaceAll(this.$el),this.setFileInfo(this.fileInfo)},methods:{setFileInfo(e){this.component.setFileInfo(e)}}},oe=(0,ae.A)(re,function(){return(0,this._self._c)("div")},[],!1,null,null,null).exports,le={name:"SidebarTab",components:{NcAppSidebarTab:s(60258).A,NcEmptyContent:w.A},props:{fileInfo:{type:Object,required:!0},id:{type:String,required:!0},name:{type:String,required:!0},icon:{type:String,default:""},onMount:{type:Function,required:!0},onUpdate:{type:Function,required:!0},onDestroy:{type:Function,required:!0},onScrollBottomReached:{type:Function,default:()=>{}}},data:()=>({loading:!0}),computed:{activeTab(){return this.$parent.activeTab}},watch:{async fileInfo(e,t){e.id!==t.id&&(this.loading=!0,await this.onUpdate(this.fileInfo),this.loading=!1)}},async mounted(){this.loading=!0,await this.onMount(this.$refs.mount,this.fileInfo,this.$refs.tab),this.loading=!1},async beforeDestroy(){await this.onDestroy()}},de=(0,ae.A)(le,function(){var e=this,t=e._self._c;return t("NcAppSidebarTab",{ref:"tab",attrs:{id:e.id,name:e.name,icon:e.icon},on:{bottomReached:e.onScrollBottomReached},scopedSlots:e._u([{key:"icon",fn:function(){return[e._t("icon")]},proxy:!0}],null,!0)},[e._v(" "),e.loading?t("NcEmptyContent",{attrs:{icon:"icon-loading"}}):e._e(),e._v(" "),t("div",{ref:"mount"})],1)},[],!1,null,null,null).exports,ce=(0,O.YK)().setApp("files").detectUser().build(),ue=(0,n.pM)({name:"FilesSidebar",components:{LegacyView:oe,NcActionButton:y.A,NcAppSidebar:A.N,NcDateTime:v.A,NcEmptyContent:w.A,NcIconSvgWrapper:_.A,SidebarTab:de,SystemTags:ne,NcUserBubble:C.A},setup:()=>({currentUser:(0,o.HW)(),mdiStar:r.ZL5,mdiStarOutline:r.dF,mdiTagMultipleOutline:r.$5}),data:()=>({Sidebar:OCA.Files.Sidebar.state,showTags:!1,showTagsDefault:!0,error:null,loading:!0,fileInfo:null,node:null,isFullScreen:!1,hasLowHeight:!1}),computed:{file(){return this.Sidebar.file},tabs(){return this.Sidebar.tabs},views(){return this.Sidebar.views},davPath(){return`${p.PY}${p.lJ}${(0,h.O0)(this.file)}`},activeTab(){return this.Sidebar.activeTab},size(){return(0,p.v7)(this.fileInfo?.size)},background(){return this.getPreviewIfAny(this.fileInfo)},appSidebar(){return this.fileInfo?{"data-mimetype":this.fileInfo.mimetype,active:this.activeTab,background:this.background,class:{"app-sidebar--has-preview":this.fileInfo.hasPreview&&!this.isFullScreen,"app-sidebar--full":this.isFullScreen},compact:this.hasLowHeight||!this.fileInfo.hasPreview||this.isFullScreen,loading:this.loading,name:this.node?.displayname??this.fileInfo.name,title:this.node?.displayname??this.fileInfo.name}:this.error?{key:"error",subname:"",name:"",class:{"app-sidebar--full":this.isFullScreen}}:{loading:this.loading,subname:"",name:"",class:{"app-sidebar--full":this.isFullScreen}}},defaultAction(){return this.fileInfo&&OCA.Files&&OCA.Files.App&&OCA.Files.App.fileList&&OCA.Files.App.fileList.fileActions&&OCA.Files.App.fileList.fileActions.getDefaultFileAction&&OCA.Files.App.fileList.fileActions.getDefaultFileAction(this.fileInfo.mimetype,this.fileInfo.type,OC.PERMISSION_READ)},defaultActionListener(){return this.defaultAction?"figure-click":null},isSystemTagsEnabled:()=>!0===(0,d.F)()?.systemtags?.enabled,ownerId(){return this.node?.attributes?.["owner-id"]??this.currentUser.uid},currentUserIsOwner(){return this.ownerId===this.currentUser.uid},nodeOwnerLabel(){let e=this.node?.attributes?.["owner-display-name"];return this.currentUserIsOwner&&(e=`${e} (${t("files","You")})`),e},sharedMultipleTimes:()=>Array.isArray(node.attributes?.["share-types"])&&node.attributes?.["share-types"].length>1?t("files","Shared multiple times with different people"):null},created(){(0,u.B1)("files:node:deleted",this.onNodeDeleted),window.addEventListener("resize",this.handleWindowResize),this.handleWindowResize()},beforeDestroy(){(0,u.al)("file:node:deleted",this.onNodeDeleted),window.removeEventListener("resize",this.handleWindowResize)},methods:{canDisplay(e){return e.enabled(this.fileInfo)},resetData(){this.error=null,this.fileInfo=null,this.$nextTick(()=>{this.$refs.tabs&&this.$refs.tabs.updateTabs()})},getPreviewIfAny(e){if(e?.hasPreview&&!this.isFullScreen){const t=e?.etag||"";return(0,f.Jv)(`/core/preview?fileId=${e.id}&x=${screen.width}&y=${screen.height}&a=true&v=${t.slice(0,6)}`)}return this.getIconUrl(e)},getIconUrl(e){const t=e?.mimetype||"application/octet-stream";return"httpd/unix-directory"===t?"shared"===e.mountType||"shared-root"===e.mountType?OC.MimeType.getIconUrl("dir-shared"):"external-root"===e.mountType?OC.MimeType.getIconUrl("dir-external"):void 0!==e.mountType&&""!==e.mountType?OC.MimeType.getIconUrl("dir-"+e.mountType):e.shareTypes&&(e.shareTypes.indexOf(g.I.Link)>-1||e.shareTypes.indexOf(g.I.Email)>-1)?OC.MimeType.getIconUrl("dir-public"):e.shareTypes&&e.shareTypes.length>0?OC.MimeType.getIconUrl("dir-shared"):OC.MimeType.getIconUrl("dir"):OC.MimeType.getIconUrl(t)},setActiveTab(e){OCA.Files.Sidebar.setActiveTab(e),this.tabs.forEach(t=>{try{t.setIsActive(e===t.id)}catch(e){ce.error("Error while setting tab active state",{error:e,id:t.id,tab:t})}})},async toggleStarred(e){try{await(0,l.Ay)({method:"PROPPATCH",url:this.davPath,data:`<?xml version="1.0"?>\n\t\t\t\t\t\t<d:propertyupdate xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">\n\t\t\t\t\t\t${e?"<d:set>":"<d:remove>"}\n\t\t\t\t\t\t\t<d:prop>\n\t\t\t\t\t\t\t\t<oc:favorite>1</oc:favorite>\n\t\t\t\t\t\t\t</d:prop>\n\t\t\t\t\t\t${e?"</d:set>":"</d:remove>"}\n\t\t\t\t\t\t</d:propertyupdate>`});const t="dir"===this.fileInfo.type,i=new(t?p.vd:p.ZH)({fileid:this.fileInfo.id,source:`${p.PY}${p.lJ}${this.file}`,root:p.lJ,mime:t?void 0:this.fileInfo.mimetype,attributes:{favorite:1}});(0,u.Ic)(e?"files:favorites:added":"files:favorites:removed",i),this.fileInfo.isFavourited=e}catch(e){(0,c.Qg)(t("files","Unable to change the favorite state of the file")),ce.error("Unable to change favorite state",{error:e})}},onDefaultAction(){this.defaultAction&&this.defaultAction.action(this.fileInfo.name,{fileInfo:this.fileInfo,dir:this.fileInfo.dir,fileList:OCA.Files.App.fileList,$file:b()("body")})},toggleTags(){this.showTags=!this.showTags,this.setShowTagsDefault(this.showTags)},async open(e){if(!e||""===e.trim())throw new Error(`Invalid path '${e}'`);const i=!!this.Sidebar.file;this.Sidebar.file=e,this.error=null,this.loading=!0;try{this.node=await F(this.file),this.fileInfo=function(e){const t={id:e.fileid,path:e.dirname,name:e.basename,mtime:e.mtime?.getTime(),etag:e.attributes.etag,size:e.size,hasPreview:e.attributes.hasPreview,isEncrypted:1===e.attributes.isEncrypted,isFavourited:1===e.attributes.favorite,mimetype:e.mime,permissions:e.permissions,mountType:e.attributes["mount-type"],sharePermissions:e.attributes["share-permissions"],shareAttributes:JSON.parse(e.attributes["share-attributes"]||"[]"),type:"file"===e.type?"file":"dir",attributes:e.attributes},i=new OC.Files.FileInfo(t);return i.get=e=>i[e],i.isDirectory=()=>"httpd/unix-directory"===i.mimetype,i.canEdit=()=>Boolean(i.permissions&OC.PERMISSION_UPDATE),i.node=e,i}(this.node),this.fileInfo.dir=this.file.split("/").slice(0,-1).join("/"),this.views.forEach(e=>{e.setFileInfo(this.fileInfo)}),await this.$nextTick(),this.setActiveTab(this.Sidebar.activeTab||this.tabs[0].id),this.loading=!1,await this.$nextTick(),i&&this.$refs.sidebar&&this.$refs.sidebar.focusActiveTabContent()}catch(e){throw this.loading=!1,this.error=t("files","Error while loading the file data"),ce.error("Error while loading the file data",{error:e}),new Error(e)}},close(){this.Sidebar.file="",this.showTags=!1,this.resetData()},onNodeDeleted(e){this.fileInfo&&e&&this.fileInfo.id===e.fileid&&this.close()},setFullScreenMode(e){this.isFullScreen=e;const t=document.querySelector("#content")||document.querySelector("#content-vue");e?t?.classList.add("with-sidebar--full"):t?.classList.remove("with-sidebar--full")},setShowTagsDefault(e){this.showTagsDefault=e},handleOpening(){(0,u.Ic)("files:sidebar:opening")},handleOpened(){(0,u.Ic)("files:sidebar:opened")},handleClosing(){(0,u.Ic)("files:sidebar:closing")},handleClosed(){(0,u.Ic)("files:sidebar:closed")},handleWindowResize(){this.hasLowHeight=document.documentElement.clientHeight<1024}}});var pe=s(99491),he={};he.styleTagTransform=te(),he.setAttributes=K(),he.insert=Q().bind(null,"head"),he.domAPI=W(),he.insertStyleElement=X(),q()(pe.A,he),pe.A&&pe.A.locals&&pe.A.locals;const fe=(0,ae.A)(ue,function(){var e=this,t=e._self._c;return e._self._setupProxy,e.file?t("NcAppSidebar",e._b({ref:"sidebar",attrs:{"data-cy-sidebar":"","force-menu":!0},on:e._d({close:e.close,"update:active":e.setActiveTab,opening:e.handleOpening,opened:e.handleOpened,closing:e.handleClosing,closed:e.handleClosed},[e.defaultActionListener,function(t){return t.stopPropagation(),t.preventDefault(),e.onDefaultAction.apply(null,arguments)}]),scopedSlots:e._u([e.fileInfo?{key:"subname",fn:function(){return[t("div",{staticClass:"sidebar__subname"},[e.fileInfo.isFavourited?t("NcIconSvgWrapper",{attrs:{path:e.mdiStar,name:e.t("files","Favorite"),inline:""}}):e._e(),e._v(" "),t("span",[e._v(e._s(e.size))]),e._v(" "),t("span",{staticClass:"sidebar__subname-separator"},[e._v("•")]),e._v(" "),t("NcDateTime",{attrs:{timestamp:e.fileInfo.mtime}}),e._v(" "),t("span",{staticClass:"sidebar__subname-separator"},[e._v("•")]),e._v(" "),t("span",[e._v(e._s(e.t("files","Owner")))]),e._v(" "),t("NcUserBubble",{attrs:{user:e.ownerId,"display-name":e.nodeOwnerLabel}})],1)]},proxy:!0}:null,e.fileInfo?{key:"description",fn:function(){return[t("div",{staticClass:"sidebar__description"},[e.isSystemTagsEnabled&&e.showTagsDefault?t("SystemTags",{directives:[{name:"show",rawName:"v-show",value:e.showTags,expression:"showTags"}],attrs:{disabled:!e.fileInfo?.canEdit(),"file-id":e.fileInfo.id}}):e._e(),e._v(" "),e._l(e.views,function(i){return t("LegacyView",{key:i.cid,attrs:{component:i,"file-info":e.fileInfo}})})],2)]},proxy:!0}:null,e.fileInfo?{key:"secondary-actions",fn:function(){return[t("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(t){return e.toggleStarred(!e.fileInfo.isFavourited)}},scopedSlots:e._u([{key:"icon",fn:function(){return[t("NcIconSvgWrapper",{attrs:{path:e.fileInfo.isFavourited?e.mdiStar:e.mdiStarOutline}})]},proxy:!0}],null,!1,3284594953)},[e._v("\n\t\t\t"+e._s(e.fileInfo.isFavourited?e.t("files","Remove from favorites"):e.t("files","Add to favorites"))+"\n\t\t")]),e._v(" "),e.isSystemTagsEnabled?t("NcActionButton",{attrs:{"close-after-click":!0},on:{click:e.toggleTags},scopedSlots:e._u([{key:"icon",fn:function(){return[t("NcIconSvgWrapper",{attrs:{path:e.mdiTagMultipleOutline}})]},proxy:!0}],null,!1,1170852183)},[e._v("\n\t\t\t"+e._s(e.t("files","Tags"))+"\n\t\t")]):e._e()]},proxy:!0}:null],null,!0)},"NcAppSidebar",e.appSidebar,!1),[e._v(" "),e._v(" "),e._v(" "),e.error?t("NcEmptyContent",{attrs:{icon:"icon-error"}},[e._v("\n\t\t"+e._s(e.error)+"\n\t")]):e.fileInfo?e._l(e.tabs,function(i){return[i.enabled(e.fileInfo)?t("SidebarTab",{directives:[{name:"show",rawName:"v-show",value:!e.loading,expression:"!loading"}],key:i.id,attrs:{id:i.id,name:i.name,icon:i.icon,"on-mount":i.mount,"on-update":i.update,"on-destroy":i.destroy,"on-scroll-bottom-reached":i.scrollBottomReached,"file-info":e.fileInfo},scopedSlots:e._u([void 0!==i.iconSvg?{key:"icon",fn:function(){return[t("span",{staticClass:"svg-icon",domProps:{innerHTML:e._s(i.iconSvg)}})]},proxy:!0}:null],null,!0)}):e._e()]}):e._e()],2):e._e()},[],!1,null,"3a227b62",null).exports;var ge=s(99418);function me(e,t,i){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 i=t.call(e,"string");if("object"!=typeof i)return i;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:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}n.Ay.prototype.t=a.Tl,window.OCA.Files||(window.OCA.Files={}),Object.assign(window.OCA.Files,{Sidebar:new class{constructor(){(function(e,t,i){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;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:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i})(this,"_state",void 0),this._state={},this._state.tabs=[],this._state.views=[],this._state.file="",this._state.activeTab="",ce.debug("OCA.Files.Sidebar initialized")}get state(){return this._state}registerTab(e){return this._state.tabs.findIndex(t=>t.id===e.id)>-1?(ce.error(`An tab with the same id ${e.id} already exists`,{tab:e}),!1):(this._state.tabs.push(e),!0)}registerSecondaryView(e){return this._state.views.findIndex(t=>t.id===e.id)>-1?(ce.error("A similar view already exists",{view:e}),!1):(this._state.views.push(e),!0)}get file(){return this._state.file}setActiveTab(e){this._state.activeTab=e}}}),Object.assign(window.OCA.Files.Sidebar,{Tab:class{constructor({id:e,name:t,icon:i,iconSvg:s,mount:a,setIsActive:n,update:r,destroy:o,enabled:l,scrollBottomReached:d}={}){if(me(this,"_id",void 0),me(this,"_name",void 0),me(this,"_icon",void 0),me(this,"_iconSvgSanitized",void 0),me(this,"_mount",void 0),me(this,"_setIsActive",void 0),me(this,"_update",void 0),me(this,"_destroy",void 0),me(this,"_enabled",void 0),me(this,"_scrollBottomReached",void 0),void 0===l&&(l=()=>!0),void 0===d&&(d=()=>{}),"string"!=typeof e||""===e.trim())throw new Error("The id argument is not a valid string");if("string"!=typeof t||""===t.trim())throw new Error("The name argument is not a valid string");if(("string"!=typeof i||""===i.trim())&&"string"!=typeof s)throw new Error("Missing valid string for icon or iconSvg argument");if("function"!=typeof a)throw new Error("The mount argument should be a function");if(void 0!==n&&"function"!=typeof n)throw new Error("The setIsActive argument should be a function");if("function"!=typeof r)throw new Error("The update argument should be a function");if("function"!=typeof o)throw new Error("The destroy argument should be a function");if("function"!=typeof l)throw new Error("The enabled argument should be a function");if("function"!=typeof d)throw new Error("The scrollBottomReached argument should be a function");this._id=e,this._name=t,this._icon=i,this._mount=a,this._setIsActive=n,this._update=r,this._destroy=o,this._enabled=l,this._scrollBottomReached=d,"string"==typeof s&&(this._iconSvgSanitized=ge.A.sanitize(s))}get id(){return this._id}get name(){return this._name}get icon(){return this._icon}get iconSvg(){return this._iconSvgSanitized}get mount(){return this._mount}get setIsActive(){return this._setIsActive||(()=>{})}get update(){return this._update}get destroy(){return this._destroy}get enabled(){return this._enabled}get scrollBottomReached(){return this._scrollBottomReached}}}),window.addEventListener("DOMContentLoaded",function(){const e=document.querySelector("body > .content")||document.querySelector("body > #content");let t;if(e){if(!document.getElementById("app-sidebar")){const t=document.createElement("div");t.id="app-sidebar",e.appendChild(t)}t=e.__vue__}const i=new(n.Ay.extend(fe))({name:"SidebarRoot",parent:t}).$mount("#app-sidebar");window.OCA.Files.Sidebar.open=i.open,window.OCA.Files.Sidebar.close=i.close,window.OCA.Files.Sidebar.setFullScreenMode=i.setFullScreenMode,window.OCA.Files.Sidebar.setShowTagsDefault=i.setShowTagsDefault})},15340:()=>{},30870:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var s=i(71354),a=i.n(s),n=i(76314),r=i.n(n)()(a());r.push([e.id,".system-tags[data-v-44cd705a]{display:flex;flex-direction:column}.system-tags__select[data-v-44cd705a]{width:100%}.system-tags__select[data-v-44cd705a] .vs__deselect{padding:0}","",{version:3,sources:["webpack://./apps/systemtags/src/components/SystemTags.vue"],names:[],mappings:"AACA,8BACC,YAAA,CACA,qBAAA,CAGA,sCACC,UAAA,CAEC,oDACC,SAAA",sourcesContent:["\n.system-tags {\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t// Fix issue with AppSidebar styles overwriting NcSelect styles\n\t&__select {\n\t\twidth: 100%;\n\t\t:deep {\n\t\t\t.vs__deselect {\n\t\t\t\tpadding: 0;\n\t\t\t}\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const o=r},42634:()=>{},47790:()=>{},51069:()=>{},59169:()=>{},63779:()=>{},64688:()=>{},66089:()=>{},73776:()=>{},77199:()=>{},77965:()=>{},78982:()=>{},79368:()=>{},79838:()=>{},86833:()=>{},99491:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var s=i(71354),a=i.n(s),n=i(76314),r=i.n(n)()(a());r.push([e.id,'.app-sidebar--has-preview[data-v-3a227b62] .app-sidebar-header__figure{background-size:cover}.app-sidebar--has-preview[data-v-3a227b62][data-mimetype="text/plain"] .app-sidebar-header__figure,.app-sidebar--has-preview[data-v-3a227b62][data-mimetype="text/markdown"] .app-sidebar-header__figure{background-size:contain}.app-sidebar--full[data-v-3a227b62]{position:fixed !important;z-index:2025 !important;top:0 !important;height:100% !important}.app-sidebar[data-v-3a227b62] .app-sidebar-header__description{margin:0 16px 4px 16px !important}.app-sidebar .svg-icon[data-v-3a227b62] svg{width:20px;height:20px;fill:currentColor}.sidebar__subname[data-v-3a227b62]{display:flex;align-items:center;gap:0 8px}.sidebar__subname-separator[data-v-3a227b62]{display:inline-block;font-weight:bold !important}.sidebar__subname .user-bubble__wrapper[data-v-3a227b62]{display:inline-flex}.sidebar__description[data-v-3a227b62]{display:flex;flex-direction:column;width:100%;gap:8px 0}',"",{version:3,sources:["webpack://./apps/files/src/views/FilesSidebar.vue"],names:[],mappings:"AAGE,uEACC,qBAAA,CAKA,yMACC,uBAAA,CAKH,oCACC,yBAAA,CACA,uBAAA,CACA,gBAAA,CACA,sBAAA,CAIA,+DACC,iCAAA,CAKD,4CACC,UAAA,CACA,WAAA,CACA,iBAAA,CAKH,mCACE,YAAA,CACA,kBAAA,CACA,SAAA,CAEA,6CACE,oBAAA,CACA,2BAAA,CAGF,yDACD,mBAAA,CAID,uCACE,YAAA,CACA,qBAAA,CACA,UAAA,CACA,SAAA",sourcesContent:['\n.app-sidebar {\n\t&--has-preview:deep {\n\t\t.app-sidebar-header__figure {\n\t\t\tbackground-size: cover;\n\t\t}\n\n\t\t&[data-mimetype="text/plain"],\n\t\t&[data-mimetype="text/markdown"] {\n\t\t\t.app-sidebar-header__figure {\n\t\t\t\tbackground-size: contain;\n\t\t\t}\n\t\t}\n\t}\n\n\t&--full {\n\t\tposition: fixed !important;\n\t\tz-index: 2025 !important;\n\t\ttop: 0 !important;\n\t\theight: 100% !important;\n\t}\n\n\t:deep {\n\t\t.app-sidebar-header__description {\n\t\t\tmargin: 0 16px 4px 16px !important;\n\t\t}\n\t}\n\n\t.svg-icon {\n\t\t:deep(svg) {\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t\tfill: currentColor;\n\t\t}\n\t}\n}\n\n.sidebar__subname {\n display: flex;\n align-items: center;\n gap: 0 8px;\n\n &-separator {\n display: inline-block;\n font-weight: bold !important;\n }\n\n .user-bubble__wrapper {\n\tdisplay: inline-flex;\n }\n}\n\n.sidebar__description {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\twidth: 100%;\n\t\tgap: 8px 0;\n\t}\n'],sourceRoot:""}]);const o=r}},n={};function r(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={id:e,loaded:!1,exports:{}};return a[e].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.m=a,e=[],r.O=(t,i,s,a)=>{if(!i){var n=1/0;for(c=0;c<e.length;c++){for(var[i,s,a]=e[c],o=!0,l=0;l<i.length;l++)(!1&a||n>=a)&&Object.keys(r.O).every(e=>r.O[e](i[l]))?i.splice(l--,1):(o=!1,a<n&&(n=a));if(o){e.splice(c--,1);var d=s();void 0!==d&&(t=d)}}return t}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[i,s,a]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,i)=>(r.f[i](e,t),t),[])),r.u=e=>e+"-"+e+".js?v="+{594:"2c86902dfae9a5006399",620:"8f7783b39d802f10e22b",2391:"908fc68e4bc9b878c937",2880:"fdf99dc4a6f328ebe498",4325:"67df7ab13a8e8d214551",5862:"d020c05f13d21afee82a",7145:"7889fe0b0ebc57e3d5f1",8339:"6cdca71a6b3b2d7bef33"}[e],r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i={},s="nextcloud-ui-legacy:",r.l=(e,t,a,n)=>{if(i[e])i[e].push(t);else{var o,l;if(void 0!==a)for(var d=document.getElementsByTagName("script"),c=0;c<d.length;c++){var u=d[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==s+a){o=u;break}}o||(l=!0,(o=document.createElement("script")).charset="utf-8",r.nc&&o.setAttribute("nonce",r.nc),o.setAttribute("data-webpack",s+a),o.src=e),i[e]=[t];var p=(t,s)=>{o.onerror=o.onload=null,clearTimeout(h);var a=i[e];if(delete i[e],o.parentNode&&o.parentNode.removeChild(o),a&&a.forEach(e=>e(s)),t)return t(s)},h=setTimeout(p.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=p.bind(null,o.onerror),o.onload=p.bind(null,o.onload),l&&document.head.appendChild(o)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r.j=4763,(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var t=globalThis.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var i=t.getElementsByTagName("script");if(i.length)for(var s=i.length-1;s>-1&&(!e||!/^http(s?):/.test(e));)e=i[s--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e={4763:0,9165:0};r.f.j=(t,i)=>{var s=r.o(e,t)?e[t]:void 0;if(0!==s)if(s)i.push(s[2]);else{var a=new Promise((i,a)=>s=e[t]=[i,a]);i.push(s[2]=a);var n=r.p+r.u(t),o=new Error;r.l(n,i=>{if(r.o(e,t)&&(0!==(s=e[t])&&(e[t]=void 0),s)){var a=i&&("load"===i.type?"missing":i.type),n=i&&i.target&&i.target.src;o.message="Loading chunk "+t+" failed.\n("+a+": "+n+")",o.name="ChunkLoadError",o.type=a,o.request=n,s[1](o)}},"chunk-"+t,t)}},r.O.j=t=>0===e[t];var t=(t,i)=>{var s,a,[n,o,l]=i,d=0;if(n.some(t=>0!==e[t])){for(s in o)r.o(o,s)&&(r.m[s]=o[s]);if(l)var c=l(r)}for(t&&t(i);d<n.length;d++)a=n[d],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.O(c)},i=globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})(),r.nc=void 0;var o=r.O(void 0,[4208],()=>r(11034));o=r.O(o)})();
//# sourceMappingURL=files-sidebar.js.map?v=31770412852b25ddd5c4