import{t as i}from"./preload-helper-DadE4qT2.chunk.mjs";import{q as s,x as n,i as r,j as c,y as m,l as u,z as d,v as h,A as b}from"./index-Dgdobvu3.chunk.mjs";import{N as p}from"./NcActionButton-DykQxmXJ-KVA0ETt1.chunk.mjs";import{N as f}from"./index-DdKmqUaK-CZdPFXPx.chunk.mjs";import{N as C}from"./NcEmptyContent-D03x2I6w.chunk.mjs";import{b as A,P as g,c as F,M as N,d as _,D as v,e as y,n as w}from"./icons-CFZwNZD8.chunk.mjs";import{A as k}from"./ActionFavorite-7rTcVpSr.chunk.mjs";import{C as S,A as M}from"./AlbumForm-RjiiBLP7.chunk.mjs";import{C as P}from"./CollectionContent-BxIYqcaH.chunk.mjs";import{H as $}from"./HeaderNavigation-DLWOytuO.chunk.mjs";import{P as E}from"./PhotosPicker-BqDrlTqO.chunk.mjs";import{F as I}from"./FetchCollectionContentMixin-NK9nekKH.chunk.mjs";import{F as O}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"./NcTextField-CfZknuqx-CsSvGxmN.chunk.mjs";import"./useModelMigration-EhAWvqDD-Zhby4giX.chunk.mjs";import"./PhotosFiltersInput-B33sPvuK.chunk.mjs";import"./NcSelect-DTniMiUS-DT0HbKa6.chunk.mjs";import"./NcAvatar-D5nljVEA-Mn39wJHK.chunk.mjs";import"./NcDateTimePicker-BJgTfZNh.chunk.mjs";import"./useFormatDateTime-Dj6f4vk0.chunk.mjs";import"./NcDateTime-enXYuwj8-Db78ZihF.chunk.mjs";import"./collectionFetcher-D94WC1TK.chunk.mjs";import"./video-eu9Y2O-I.chunk.mjs";import"./index-x9vhq81Z.chunk.mjs";import"./NcSelectUsers-RyUVUaWQ-CTrr_2Z8.chunk.mjs";import"./FileComponent-A6f_Dtn9.chunk.mjs";import"./NcCheckboxRadioSwitch-DAPHFb0L-ou8aC9jF.chunk.mjs";import"./FilesSelectionMixin-1nnlfofj.chunk.mjs";import"./fileFetcher-CFJaIlCO.chunk.mjs";import"./FilesByMonthMixin-BLjMI05j.chunk.mjs";import"./AbortControllerMixin-Bb5X6Yae.chunk.mjs";import"./PhotoSearch-3PnBhHOR.chunk.mjs";const B={name:"AlbumContent",components:{ActionFavorite:k,AlbumForm:M,Close:y,CollaboratorsSelectionForm:S,CollectionContent:P,DeleteOutline:v,PhotosPicker:E,HeaderNavigation:$,ImagePlusOutline:_,MapMarkerOutline:N,NcActionButton:p,NcActions:m,NcActionSeparator:f,NcButton:c,NcDialog:r,NcEmptyContent:C,NcLoadingIcon:n,NcModal:s,PencilOutline:F,Plus:g,ShareVariantOutline:A},mixins:[I,O],props:{albumName:{type:String,default:"/"}},setup(){return{isMobile:b()}},data(){return{showAddPhotosModal:!1,showManageCollaboratorView:!1,showEditAlbumForm:!1,loadingAddCollaborators:!1}},computed:{album(){return this.$store.getters.getAlbum(this.albumName)},albumFileIds(){return this.$store.getters.getAlbumFiles(this.albumName)},sharingEnabled(){return OC.Share!==void 0},albumFileName(){return this.$store.getters.getAlbumName(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,h)},async fetchAlbumContent(){await this.fetchCollectionFiles(this.albumFileName,d)},async handleAlbumUpdate({album:t,changes:o}){this.showEditAlbumForm=!1,o.includes("name")&&await this.$router.push(`/albums/${t.basename}`),o.includes("filters")&&this.fetchAlbumContent()},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("/albums")},async handleSetCollaborators(t){try{this.loadingAddCollaborators=!0,this.showManageCollaboratorView=!1,await this.$store.dispatch("updateCollection",{collectionFileName:this.album?.root+this.album?.path,properties:{collaborators:t}})}catch(o){u.error("Error while setting album collaborators",{error:o})}finally{this.loadingAddCollaborators=!1}},async handleFiltersChange(t){await this.$store.dispatch("updateCollection",{collectionFileName:this.album?.root+this.album?.path,properties:{filters:t}}),this.fetchAlbumContent()},t:i}};var D=function(){var t=this,o=t._self._c;return o("div",{staticClass:"album-container"},[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:a}){return o("HeaderNavigation",{key:"navigation",attrs:{loading:t.loadingCollectionFiles,params:{albumName:t.albumName},path:"/"+t.albumName,title:t.albumName},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)+" ")],1):t._e(),o("template",{slot:"default"},[e.length>0?o("NcButton",{attrs:{"aria-label":t.t("photos","Unselect all")},on:{click:a},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"},[o("NcButton",{on:{click:function(l){t.showAddPhotosModal=!0}},scopedSlots:t._u([{key:"icon",fn:function(){return[o("Plus",{attrs:{size:20}})]},proxy:!0}],null,!0)},[t._v(" "+t._s(t.t("photos","Add photos to this album"))+" ")]),t.sharingEnabled?o("NcButton",{attrs:{variant:"tertiary","aria-label":t.t("photos","Manage collaborators for this album")},on:{click:function(l){t.showManageCollaboratorView=!0}}},[o("ShareVariantOutline",{attrs:{slot:"icon"},slot:"icon"})],1):t._e(),o("NcActions",{attrs:{"aria-label":t.t("photos","Open actions menu")}},[o("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Edit album details")},on:{click:function(l){t.showEditAlbumForm=!0}}},[t._v(" "+t._s(t.t("photos","Edit album details"))+" "),o("PencilOutline",{attrs:{slot:"icon"},slot:"icon"})],1),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),e.length>0?[o("NcActionSeparator"),o("ActionFavorite",{attrs:{"selected-file-ids":e}}),t.removableSelectedFiles.length!==0?o("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(l){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)}}])},[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,"blacklist-ids":t.albumFileIds,destination:t.album.basename,name:t.t("photos","Add photos to {albumName}",{albumName:t.albumName},void 0,{escape:!1,sanitize:!1})},on:{"update:open":function(e){t.showAddPhotosModal=e},"files-picked":t.handleFilesPicked}}):t._e(),t.showManageCollaboratorView&&t.album!==void 0?o("NcModal",{attrs:{name:t.t("photos","Manage collaborators")},on:{close:function(e){t.showManageCollaboratorView=!1}}},[o("CollaboratorsSelectionForm",{attrs:{"album-name":t.album.basename,collaborators:t.album.attributes.collaborators},scopedSlots:t._u([{key:"default",fn:function({collaborators:e}){return[o("NcButton",{attrs:{"aria-label":t.t("photos","Save collaborators for this album."),variant:"primary",disabled:t.loadingAddCollaborators},on:{click:function(a){return t.handleSetCollaborators(e)}},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loadingAddCollaborators?o("NcLoadingIcon"):t._e()]},proxy:!0}],null,!0)},[t._v(" "+t._s(t.t("photos","Save"))+" ")])]}}],null,!1,2061546483)})],1):t._e(),t.showEditAlbumForm?o("NcDialog",{attrs:{name:t.t("photos","Edit album details"),"close-on-click-outside":"",size:"normal"},on:{closing:function(e){t.showEditAlbumForm=!1}}},[o("AlbumForm",{attrs:{album:t.album},on:{done:e=>t.handleAlbumUpdate(e)}})],1):t._e()],1)},x=[],V=w(B,D,x,!1,null,"abfcb917");const Nt=V.exports;export{Nt as default}; //# sourceMappingURL=AlbumContent-AqatWZjx.chunk.mjs.map