import{d as i,t as s,y as n,z as r}from"./dav-D-0Zsvk_.chunk.mjs";import{x as l,v as c}from"./index-VDTWCae_.chunk.mjs";import{N as a}from"./NcEmptyContent-DEGDbAVb.chunk.mjs";import{I as d,A as m,n as p}from"./icons-D6kGtfXC.chunk.mjs";import{F as u}from"./FileComponent-Cj4I5Fin.chunk.mjs";import{F as f,a as h}from"./FilesSelectionMixin-BmUiWId5.chunk.mjs";const C=i({name:"CollectionContent",components:{AlertCircleOutline:m,ImageMultipleOutline:d,NcEmptyContent:a,FilesListViewer:h,FileComponent:u},mixins:[f],props:{collection:{type:Object,default:()=>{}},collectionFileIds:{type:Array,required:!0},loading:{type:Boolean,default:!1},allowSelection:{type:Boolean,default:!0},error:{type:[Error,Number],default:null}},setup(){return{isMobile:c()}},data(){return{appContent:document.getElementById("app-content-vue")}},computed:{files(){return this.$store.getters.files},sortedCollectionFileIds(){return this.collectionFileIds.toSorted((e,t)=>this.files[e].attributes.timestamp<this.files[t].attributes.timestamp?-1:1)}},mounted(){r("files:node:deleted",this.handleFileDeleted)},destroyed(){n("files:node:deleted",this.handleFileDeleted)},methods:{openViewer(e){window.OCA.Viewer.open({fileInfo:l(this.files[e]),list:this.sortedCollectionFileIds.map(t=>l(this.files[t]))})},handleFileDeleted({fileid:e}){this.$store.commit("removeFilesFromCollection",{collectionFileName:this.collection.root+this.collection.path,fileIdsToRemove:[e?.toString()]})},t:s}});var F=function(){var e=this,t=e._self._c;return e._self._setupProxy,e.collection===void 0&&!e.loading||e.error===404?t("NcEmptyContent",{staticClass:"empty-content-with-illustration",attrs:{name:e.t("photos","This collection does not exist")}},[t("ImageMultipleOutline",{attrs:{slot:"icon"},slot:"icon"})],1):e.error?t("NcEmptyContent",{attrs:{name:e.t("photos","An error occurred")}},[t("AlertCircleOutline",{attrs:{slot:"icon"},slot:"icon"})],1):t("div",{staticClass:"collection"},[e._t("header",null,{selectedFileIds:e.selectedFileIds,resetSelection:e.resetSelection}),e.sortedCollectionFileIds.length===0&&!e.loading?e._t("empty-content"):e._e(),e.collection!==void 0&&e.sortedCollectionFileIds.length>0?t("FilesListViewer",{staticClass:"collection__media",attrs:{"container-element":e.appContent,"file-ids":e.sortedCollectionFileIds,"base-height":e.isMobile?120:200,loading:e.loading},scopedSlots:e._u([{key:"default",fn:function({file:o}){return t("FileComponent",{attrs:{file:e.files[o.id],"allow-selection":e.allowSelection,selected:e.selection[o.id]===!0},on:{click:e.openViewer,"select-toggled":e.onFileSelectToggle}})}}],null,!1,2202403043)}):e._e()],2)},g=[],y=p(C,F,g,!1,null,"aecef337");const x=y.exports;export{x as C};
//# sourceMappingURL=CollectionContent-DKZl05u2.chunk.mjs.map
