import{t as i}from"./vue.runtime.esm-Ct3_M7aQ.chunk.mjs";import{u as s}from"./video-rmrjCz0n.chunk.mjs";import{N as n}from"./NcActionButton-CuVNJJtW-78GF8FR5.chunk.mjs";import{m as r,f as c,N as m,s as u,l as d,w as h,q as b}from"./index-BMeBqg0T.chunk.mjs";import{N as p}from"./index-DdKmqUaK-BlSvvbCn.chunk.mjs";import{N as f}from"./NcDialog-CKgpZOiy-Yt0iPUKp.chunk.mjs";import{N as C}from"./NcEmptyContent-C3BLUUdi.chunk.mjs";import{g as A,P as g,v as N,M as F,w as _,D as v,x as y,n as w}from"./icons-VGG7keIQ.chunk.mjs";import{A as k}from"./ActionFavorite-bRkKTDIn.chunk.mjs";import{C as S,A as M}from"./AlbumForm-B5HQDBP6.chunk.mjs";import{C as P}from"./CollectionContent-DjRoRvK_.chunk.mjs";import{H as $}from"./HeaderNavigation-Drss-bOM.chunk.mjs";import{P as E}from"./PhotosPicker-Co0d4oE2.chunk.mjs";import{F as I}from"./FetchCollectionContentMixin-BXizDLoQ.chunk.mjs";import{F as O}from"./FetchFilesMixin-Dh0XuSuT.chunk.mjs";import"./preload-helper-Dh9HmuEY.chunk.mjs";import"./index-XmYygNaN.chunk.mjs";import"./index-_ghYQSTa.chunk.mjs";import"./useHotKey-CXYH7Vg8.chunk.mjs";import"./NcProgressBar-DegJ2JjE-FoyaEkrc.chunk.mjs";import"./index-VV9wNENq.chunk.mjs";import"./dialog-DMSB8C_5.chunk.mjs";import"./NcTextField-o_8gWurX-D9H3ZKW0.chunk.mjs";import"./useModelMigration-EhAWvqDD-wVDp4GUR.chunk.mjs";import"./PhotosFiltersInput-V84ZfLNi.chunk.mjs";import"./NcSelect-CjUzohn5-BzxyFHzp.chunk.mjs";import"./NcAvatar-YSp2ORHc-k3rtAvRh.chunk.mjs";import"./NcDateTimePicker-CijBajMH.chunk.mjs";import"./NcDateTime-DshRFtUU-DhtBMvqa.chunk.mjs";import"./collectionFetcher-Bc_5r3B7.chunk.mjs";import"./index-x9vhq81Z.chunk.mjs";import"./FileComponent-Z0cvFFM3.chunk.mjs";import"./NcCheckboxRadioSwitch-VeztTzpz-CXqdOpK4.chunk.mjs";import"./FilesSelectionMixin-JLsUiKnU.chunk.mjs";import"./fileFetcher-EOUUgMjG.chunk.mjs";import"./NcNoteCard-B0DAcORy.chunk.mjs";import"./FilesByMonthMixin-BmZxTSkI.chunk.mjs";import"./AbortControllerMixin-KqbYNBDv.chunk.mjs";import"./PhotoSearch-DdDD9daK.chunk.mjs";const B={name:"AlbumContent",components:{ActionFavorite:k,AlbumForm:M,Close:y,CollaboratorsSelectionForm:S,CollectionContent:P,DeleteOutline:v,PhotosPicker:E,HeaderNavigation:$,ImagePlusOutline:_,MapMarkerOutline:F,NcActionButton:n,NcActions:u,NcActionSeparator:p,NcButton:m,NcDialog:f,NcEmptyContent:C,NcLoadingIcon:c,NcModal:r,PencilOutline:N,Plus:g,ShareVariantOutline:A},mixins:[I,O],props:{albumName:{type:String,default:"/"}},setup(){return{isMobile:s()}},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,b)},async fetchAlbumContent(){await this.fetchCollectionFiles(this.albumFileName,h)},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){d.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:{type:"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",type:"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."),type:"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,4241097308)})],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,"237a94d7");const vt=V.exports;export{vt as default}; //# sourceMappingURL=AlbumContent-Cz6sddgl.chunk.mjs.map