import{t as s}from"./preload-helper-DadE4qT2.chunk.mjs";import{S as i}from"./index-x9vhq81Z.chunk.mjs";import{j as n,y as r,z as m,v as c,A as u}from"./index-Dgdobvu3.chunk.mjs";import{N as d}from"./NcActionButton-DykQxmXJ-KVA0ETt1.chunk.mjs";import{N as h}from"./index-DdKmqUaK-CZdPFXPx.chunk.mjs";import{N as b}from"./NcEmptyContent-D03x2I6w.chunk.mjs";import{N as p}from"./NcUserBubble-VLY4hn5K-C859Jy5x.chunk.mjs";import{d as f,D as N,e as A,P as F,M as g,n as C}from"./icons-CFZwNZD8.chunk.mjs";import{C as _}from"./CollectionContent-BxIYqcaH.chunk.mjs";import{H as v}from"./HeaderNavigation-DLWOytuO.chunk.mjs";import{P as y}from"./PhotosPicker-BqDrlTqO.chunk.mjs";import{F as k}from"./FetchCollectionContentMixin-NK9nekKH.chunk.mjs";import{F as P}from"./FetchFilesMixin-BGmLOce1.chunk.mjs";import"./index-BCevi9E9.chunk.mjs";import"./NcProgressBar-D7zYeXBH-uJjZguS5.chunk.mjs";import"./index-V4SUT3Zk.chunk.mjs";import"./useHotKey-DFSRx3Nk.chunk.mjs";import"./createElementId-DhjFt1I9-B2HCdIOx.chunk.mjs";import"./video-eu9Y2O-I.chunk.mjs";import"./NcAvatar-D5nljVEA-Mn39wJHK.chunk.mjs";import"./FileComponent-A6f_Dtn9.chunk.mjs";import"./NcCheckboxRadioSwitch-DAPHFb0L-ou8aC9jF.chunk.mjs";import"./useModelMigration-EhAWvqDD-Zhby4giX.chunk.mjs";import"./FilesSelectionMixin-1nnlfofj.chunk.mjs";import"./fileFetcher-CFJaIlCO.chunk.mjs";import"./NcSelect-DTniMiUS-DT0HbKa6.chunk.mjs";import"./FilesByMonthMixin-BLjMI05j.chunk.mjs";import"./collectionFetcher-D94WC1TK.chunk.mjs";import"./AbortControllerMixin-Bb5X6Yae.chunk.mjs";import"./PhotoSearch-3PnBhHOR.chunk.mjs";const S={name:"SharedAlbumContent",components:{MapMarkerOutline:g,Plus:F,Close:A,DeleteOutline:N,ImagePlusOutline:f,NcEmptyContent:b,NcActions:r,NcActionButton:d,NcActionSeparator:h,NcButton:n,NcUserBubble:p,CollectionContent:_,PhotosPicker:y,HeaderNavigation:v},mixins:[k,P],props:{albumName:{type:String,default:"/"}},setup(){return{isMobile:u()}},data(){return{showAddPhotosModal:!1,loadingCount:0,loadingAddFilesToAlbum:!1,collaboratorTypes:i}},computed:{files(){return this.$store.state.files.files},album(){return this.$store.getters.getSharedAlbum(this.albumName)},albumFileIds(){return this.$store.getters.getSharedAlbumFiles(this.albumName)},albumOriginalName(){return this.albumName.replace(new RegExp(`\\(${this.album?.attributes.collaborators[0].id}\\)$`),"")},albumFileName(){return this.$store.getters.getSharedAlbumName(this.albumName)},removableSelectedFiles(){return(this.$refs.collectionContent?.selectedFileIds).map(t=>this.$store.state.files.files[t]).filter(t=>t.attributes["photos-album-file-origin"]!=="filters").map(t=>t.fileid.toString())}},async mounted(){this.fetchAlbum(),this.fetchAlbumContent()},methods:{async fetchAlbum(){await this.fetchCollection(this.albumFileName,c)},async fetchAlbumContent(){await this.fetchCollectionFiles(this.albumFileName,m)},async handleFilesPicked(t){this.showAddPhotosModal=!1,await this.$store.dispatch("addFilesToCollection",{collectionFileName:this.album.root+this.album.path,fileIdsToAdd:t}),await this.fetchAlbumContent()},async handleRemoveFilesFromAlbum(t){this.$refs.collectionContent?.onUncheckFiles(t),await this.$store.dispatch("removeFilesFromCollection",{collectionFileName:this.album.root+this.album.path,fileIdsToRemove:t})},async handleDeleteAlbum(){await this.$store.dispatch("deleteCollection",{collectionFileName:this.album.root+this.album.path})&&this.$router.push("/sharedalbums")},t:s}};var w=function(){var t=this,o=t._self._c;return o("div",[o("CollectionContent",{ref:"collectionContent",attrs:{collection:t.album,"collection-file-ids":t.albumFileIds,loading:t.loadingCollection||t.loadingCollectionFiles,error:t.errorFetchingCollection||t.errorFetchingCollectionFiles},scopedSlots:t._u([{key:"header",fn:function({selectedFileIds:e,resetSelection:l}){return o("HeaderNavigation",{key:"navigation",attrs:{loading:t.loadingCollectionFiles,params:{albumName:t.albumName},path:"/"+t.albumName,title:t.albumOriginalName},on:{refresh:t.fetchAlbumContent}},[t.album!==void 0&&t.album.attributes.location!==""?o("div",{staticClass:"album__location",attrs:{slot:"subtitle"},slot:"subtitle"},[o("MapMarkerOutline"),t._v(t._s(t.album.attributes.location)+" ⸱ "+t._s(t.t("photos","Shared by"))+"  "),o("NcUserBubble",{attrs:{"display-name":t.album.attributes.collaborators[0].label,user:t.album.attributes.collaborators[0].id}})],1):t._e(),o("template",{slot:"default"},[e.length>0?o("NcButton",{attrs:{"aria-label":t.t("photos","Unselect all")},on:{click:l},scopedSlots:t._u([{key:"icon",fn:function(){return[o("Close")]},proxy:!0}],null,!0)},[t._v(" "+t._s(t.t("photos","Unselect all"))+" ")]):t._e()],1),t.album!==void 0?o("template",{slot:"right"},[t.album.attributes.nbItems!==0?o("NcButton",{attrs:{variant:"secondary","aria-label":t.t("photos","Add photos to this album")},on:{click:function(a){t.showAddPhotosModal=!0}}},[o("Plus",{attrs:{slot:"icon"},slot:"icon"}),t._v(" "+t._s(t.t("photos","Add"))+" ")],1):t._e(),o("NcActions",{attrs:{"force-menu":!0,"aria-label":t.t("photos","Open actions menu")}},[t.album.attributes.collaborators[0].type===t.collaboratorTypes.User?o("NcActionButton",{attrs:{"close-after-click":!0},on:{click:t.handleDeleteAlbum}},[t._v(" "+t._s(t.t("photos","Delete album"))+" "),o("DeleteOutline",{attrs:{slot:"icon"},slot:"icon"})],1):t._e(),e.length>0?[o("NcActionSeparator"),t.removableSelectedFiles.length!==0?o("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(a){return t.handleRemoveFilesFromAlbum(t.removableSelectedFiles)}}},[t._v(" "+t._s(t.t("photos","Remove selection from album"))+" "),o("Close",{attrs:{slot:"icon"},slot:"icon"})],1):t._e()]:t._e()],2)],1):t._e()],2)}}],null,!1,3980949)},[t.album!==void 0&&t.album.attributes.nbItems===0&&!(t.loadingCollectionFiles||t.loadingCollection)?o("NcEmptyContent",{staticClass:"album__empty",attrs:{slot:"empty-content",name:t.t("photos","This album does not have any photos or videos yet!")},slot:"empty-content"},[o("ImagePlusOutline",{attrs:{slot:"icon"},slot:"icon"}),o("NcButton",{staticClass:"album__empty__button",attrs:{slot:"action",variant:"primary","aria-label":t.t("photos","Add photos to this album")},on:{click:function(e){t.showAddPhotosModal=!0}},slot:"action"},[o("Plus",{attrs:{slot:"icon"},slot:"icon"}),t._v(" "+t._s(t.t("photos","Add"))+" ")],1)],1):t._e()],1),t.album!==void 0?o("PhotosPicker",{attrs:{open:t.showAddPhotosModal,name:t.t("photos","Add photos to {albumName}",{albumName:t.albumOriginalName}),destination:t.album.basename,"blacklist-ids":t.albumFileIds,loading:t.loadingAddFilesToAlbum},on:{"update:open":function(e){t.showAddPhotosModal=e},"files-picked":t.handleFilesPicked}}):t._e()],1)},$=[],M=C(S,w,$,!1,null,"52a1b252");const nt=M.exports;export{nt as default}; //# sourceMappingURL=SharedAlbumContent-Cott4oI9.chunk.mjs.map