import{t as n,V as a}from"./preload-helper-DadE4qT2.chunk.mjs";import{N as l}from"./NcActionButton-DykQxmXJ-KVA0ETt1.chunk.mjs";import{i as c,y as r,x as d,l as s,C as i}from"./index-Dgdobvu3.chunk.mjs";import{N as f}from"./NcEmptyContent-D03x2I6w.chunk.mjs";import{g as u,f as h,A as p,k as m,S as F,a as v,n as g}from"./icons-CFZwNZD8.chunk.mjs";import{F as _}from"./FaceMergeForm-BHfOqGG8.chunk.mjs";import{F as w}from"./FileComponent-A6f_Dtn9.chunk.mjs";import{F as C,a as y}from"./FilesSelectionMixin-1nnlfofj.chunk.mjs";import{F as S}from"./FaceCover-y62LmE3b.chunk.mjs";import{F as k}from"./FetchFilesMixin-BGmLOce1.chunk.mjs";import"./index-BCevi9E9.chunk.mjs";import"./createElementId-DhjFt1I9-B2HCdIOx.chunk.mjs";import"./NcCheckboxRadioSwitch-DAPHFb0L-ou8aC9jF.chunk.mjs";import"./useModelMigration-EhAWvqDD-Zhby4giX.chunk.mjs";import"./fileFetcher-CFJaIlCO.chunk.mjs";import"./AbortControllerMixin-Bb5X6Yae.chunk.mjs";import"./PhotoSearch-3PnBhHOR.chunk.mjs";const M={name:"UnassignedFaces",components:{Star:v,StarOutline:F,DownloadOutline:m,AlertCircleOutline:p,ArrowLeft:h,FaceMergeForm:_,FilesListViewer:y,FileComponent:w,NcLoadingIcon:d,NcEmptyContent:f,NcActions:r,NcActionButton:l,NcDialog:c,AccountSwitchOutline:u},directives:{focus(t){a.nextTick(()=>t.focus())}},mixins:[S,k,C],data(){return{showMoveModal:!1,loadingCount:0,appContent:document.getElementById("app-content-vue")}},computed:{files(){return this.$store.state.files.files},unassignedFiles(){return this.$store.state.faces.unassignedFiles},faceFileIds(){return this.unassignedFiles||[]},shouldFavoriteSelection(){return this.selectedFileIds.some(t=>this.$store.state.files.files[t].attributes.favorite===0)}},mounted(){this.fetchUnassignedFaces()},methods:{openViewer(t){window.OCA.Viewer.open({fileInfo:i(this.files[t]),list:this.faceFileIds.map(e=>i(this.files[e]))})},async handleMove(t,e){try{this.loadingCount++,await this.$store.dispatch("moveFilesToFace",{oldFace:null,faceName:t,fileIdsToMove:e}),this.showMoveModal=!1}catch(o){s.error("Failed to move selection",{error:o})}finally{this.loadingCount--}},async favoriteSelection(){try{this.loadingCount++,await this.$store.dispatch("toggleFavoriteForFiles",{fileIds:this.selectedFileIds,favoriteState:!0})}catch(t){s.error("Failed to favorite selection",{error:t})}finally{this.loadingCount--}},async unFavoriteSelection(){try{this.loadingCount++,await this.$store.dispatch("toggleFavoriteForFiles",{fileIds:this.selectedFileIds,favoriteState:!1})}catch(t){s.error("Failed to unfavorite selection",{error:t})}finally{this.loadingCount--}},async downloadSelection(){try{this.loadingCount++,await this.$store.dispatch("downloadFiles",this.selectedFileIds)}catch(t){s.error("Faile to download selection",{error:t})}finally{this.loadingCount--}},t:n}};var A=function(){var t=this,e=t._self._c;return t.errorFetchingFiles?e("NcEmptyContent",{scopedSlots:t._u([{key:"icon",fn:function(){return[e("AlertCircleOutline")]},proxy:!0}],null,!1,2159780319)},[t._v(" "+t._s(t.t("photos","An error occurred"))+" ")]):e("div",{staticClass:"face"},[e("div",{staticClass:"face__header"},[e("div",{staticClass:"face__header__left"},[e("NcActions",[e("NcActionButton",{on:{click:function(o){return t.$router.push("/faces/")}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("ArrowLeft")]},proxy:!0}])},[t._v(t._s(t.t("photos","Back"))+" ")])],1),e("div",{staticClass:"face__header__title"},[e("h2",{staticClass:"face-name"},[t._v(" "+t._s(t.t("photos","Unassigned faces"))+" ")])]),t.loadingCount>0||t.loadingFaces?e("NcLoadingIcon"):t._e()],1),e("div",{staticClass:"face__header__actions"},[e("NcActions",{attrs:{"force-menu":!0}},[t.selectedFileIds.length?[e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Download selected files")},on:{click:t.downloadSelection}},[e("DownloadOutline",{attrs:{slot:"icon"},slot:"icon"}),t._v(" "+t._s(t.t("photos","Download selected photos"))+" ")],1),t.shouldFavoriteSelection?e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Mark selection as favorite")},on:{click:t.favoriteSelection}},[e("StarOutline",{attrs:{slot:"icon"},slot:"icon"}),t._v(" "+t._s(t.t("photos","Favorite"))+" ")],1):e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Remove selection from favorites")},on:{click:t.unFavoriteSelection}},[e("Star",{attrs:{slot:"icon"},slot:"icon"}),t._v(" "+t._s(t.t("photos","Remove from favorites"))+" ")],1),e("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(o){t.showMoveModal=!0}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("AccountSwitchOutline")]},proxy:!0}],null,!1,1476410576)},[t._v(" "+t._s(t.n("photos","Move photo to a different person","Move photos to a different person",t.selectedFileIds.length))+" ")])]:t._e()],2)],1)]),e("FilesListViewer",{staticClass:"face__photos",attrs:{"container-element":t.appContent,"file-ids":t.faceFileIds,loading:t.loadingFiles||t.loadingFaces},scopedSlots:t._u([{key:"default",fn:function({file:o}){return e("FileComponent",{attrs:{file:t.files[o.id],"allow-selection":!0,selected:t.selection[o.id]===!0},on:{click:t.openViewer,"select-toggled":t.onFileSelectToggle}})}}])}),t.showMoveModal?e("NcDialog",{attrs:{name:t.t("photos","Move to different person"),"close-on-click-outside":"",size:"normal"},on:{closing:function(o){t.showMoveModal=!1}}},[e("FaceMergeForm",{attrs:{"first-face":"-1"},on:{select:function(o){return t.handleMove(o,t.selectedFileIds)}}})],1):t._e()],1)},N=[],I=g(M,A,N,!1,null,"48c90f2c");const J=I.exports;export{J as default}; //# sourceMappingURL=UnassignedFaces-DI8NVoO-.chunk.mjs.map