import{a as i,t as a}from"./dav-D-0Zsvk_.chunk.mjs";import{x as o,l as n,v as r}from"./index-VDTWCae_.chunk.mjs";import{N as l,b as c}from"./NcActions-JnumflF4-wQHpCaHI.chunk.mjs";import{N as h}from"./NcEmptyContent-DEGDbAVb.chunk.mjs";import{N as p}from"./NcLoadingIcon-Ctb4dpAr.chunk.mjs";import{e as g,n as d}from"./icons-D6kGtfXC.chunk.mjs";import{F as f}from"./FileComponent-Cj4I5Fin.chunk.mjs";import{F as m,a as u}from"./FilesSelectionMixin-BmUiWId5.chunk.mjs";import{A as C}from"./AbortControllerMixin-C4cpCLeS.chunk.mjs";import"./video-B2Zidy_E.chunk.mjs";import"./index-CxUc7fso.chunk.mjs";import"./GenRandomId-F5ebeBB_-DI-yuh7g.chunk.mjs";import"./NcCheckboxRadioSwitch-Ddl_QlRN-Cj43obgd.chunk.mjs";import"./NcIconToggleSwitch-DCTeQGv5-FeLJtWqi.chunk.mjs";import"./useModelMigration-EhAWvqDD-DCXJrerl.chunk.mjs";import"./fileFetcher-DkTW0h4J.chunk.mjs";const w={name:"TagContent",components:{FileComponent:f,FilesListViewer:u,NcEmptyContent:h,NcActions:c,NcActionButton:l,NcLoadingIcon:p,ArrowLeft:g},mixins:[m,C],props:{path:{type:String,default:""}},setup(){return{isMobile:r()}},data(){return{error:null,loading:!1,appContent:document.getElementById("app-content-vue")}},computed:{files(){return this.$store.state.files.files},tags(){return this.$store.state.systemtags.tags},tagId(){return this.$store.getters.tagId(this.path)},tag(){return this.tags[this.tagId]},fileIds(){return this.$store.state.systemtags.tagsFiles[this.tagId]},isEmpty(){return this.fileIds.length===0}},watch:{async path(){this.fetchContent()}},async beforeMount(){this.fetchContent()},methods:{async fetchContent(){window.OCA.Viewer.close(),this.loading=!0,this.error=null;try{this.tags[this.tagId]||await this.$store.dispatch("fetchAllTags",{signal:this.abortController.signal}),this.tag&&!this.fileIds&&await this.$store.dispatch("fetchTagFiles",{id:this.tagId,signal:this.abortController.signal})}catch(t){n.error("Failed to fetch tags",{error:t}),this.error=!0}finally{this.loading=!1}},openViewer(t){window.OCA.Viewer.open({fileInfo:o(this.files[t]),list:this.fileIds.map(s=>o(this.files[s]))})},t:a,n:i}};var y=function(){var t=this,s=t._self._c;return t.error?s("NcEmptyContent",{attrs:{name:t.t("photos","An error occurred")}}):t.loading?s("NcLoadingIcon",{staticClass:"loader"}):s("div",[s("div",{staticClass:"photos-navigation"},[s("NcActions",{staticClass:"photos-navigation__back"},[s("NcActionButton",{on:{click:function(e){return t.$router.push({name:"tags"})}},scopedSlots:t._u([{key:"icon",fn:function(){return[s("ArrowLeft")]},proxy:!0}])},[t._v(" "+t._s(t.t("photos","Back to tags overview"))+" ")])],1),s("h2",{staticClass:"photos-navigation__title"},[t._v(" "+t._s(t.path)+" ")])],1),s("div",{staticClass:"heading-subline"},[t._v(" "+t._s(t.n("photos","%n photo","%n photos",t.fileIds.length))+" ")]),t.isEmpty?s("NcEmptyContent",{attrs:{name:t.t("photos","No photos with this tag yet")}}):t._e(),s("FilesListViewer",{staticClass:"tag__photos",attrs:{"container-element":t.appContent,"file-ids":t.fileIds,"base-height":t.isMobile?120:200,loading:t.loading},scopedSlots:t._u([{key:"default",fn:function({file:e}){return s("FileComponent",{attrs:{file:t.files[e.id],"allow-selection":!0,selected:t.selection[e.id]===!0},on:{click:t.openViewer,"select-toggled":t.onFileSelectToggle}})}}])})],1)},_=[],v=d(w,y,_,!1,null,"a6eb2bbc");const j=v.exports;export{j as default};
//# sourceMappingURL=TagContent-RlsDAnot.chunk.mjs.map
