photos/js/photos-node_modules_vue-mat...

3 lines
10 KiB
JavaScript

/*! For license information please see photos-node_modules_vue-material-design-icons_AccountBoxMultipleOutline_vue-src_components_FaceCover_vue.js.LICENSE.txt */
"use strict";(self.webpackChunkphotos=self.webpackChunkphotos||[]).push([["node_modules_vue-material-design-icons_AccountBoxMultipleOutline_vue-src_components_FaceCover_vue"],{46116:(t,e,a)=>{a.d(e,{Z:()=>i});const i={name:"FaceCoverMixin",computed:{...(0,a(20629).Se)(["faces","facesFiles","files"])},methods:{getFaceCover(t){const e=t=>Math.max(0,-1*(t.x-.5*t.width))+Math.max(0,-1*(t.y-.5*t.height))+Math.max(0,-1*(1-(t.x+t.width)-.5*t.width))+Math.max(0,-1*(1-(t.y+t.height)-.5*t.height));return(this.facesFiles[t]||[]).slice(0,25).map((t=>this.files[t])).sort(((e,a)=>a.faceDetections.find((e=>e.title===t)).width-e.faceDetections.find((e=>e.title===t)).width)).sort(((t,e)=>t.faceDetections.length-e.faceDetections.length)).sort(((a,i)=>e(a.faceDetections.find((e=>e.title===t)))-e(i.faceDetections.find((e=>e.title===t)))))[0]},getCoverStyle(t){const e=this.getFaceCover(t);if(!e)return{};const a=e.faceDetections.find((e=>e.title===t)),i=Math.max(1,1/a.width*.4),n=100*(a.x+a.width/2),s=100*(a.y+a.height/2);return{width:"100%",transform:"translate(calc( var(--photos-face-width)/2 - ".concat(n,"% ), calc( var(--photos-face-width)/2 - ").concat(s,"% )) scale(").concat(i,")"),transformOrigin:"".concat(n,"% ").concat(s,"%")}}}}},99751:(e,a,i)=>{i.d(a,{Z:()=>p});var n=i(20629),s=i(82880),o=i(45994),c=i(81067),r=i(59537),l=i(2161),d=i(94236),A=i(69363),h=i(86492),f=i.n(h);const p={name:"FetchFacesMixin",data:()=>({errorFetchingFaces:null,loadingFaces:!1,errorFetchingFiles:null,loadingFiles:!1}),mixins:[A.Z],async beforeMount(){this.fetchFaces()},computed:{...(0,n.Se)(["faces"])},methods:{...(0,n.nv)(["appendFiles"]),async fetchFaces(){if(!this.loadingFaces&&!Object.keys(this.faces).length)try{var e;this.loadingFaces=!0,this.errorFetchingFaces=null;const{data:t}=await c.ZP.getDirectoryContents("/recognize/".concat(null===(e=(0,o.ts)())||void 0===e?void 0:e.uid,"/faces/"),{data:l.Z,details:!0,signal:this.abortController.signal});this.$store.dispatch("addFaces",{faces:t}),r.Z.debug("[FetchFacesMixin] Fetched ".concat(t.length," new faces: "),t)}catch(e){e.response&&e.response.status&&(404===e.response.status?this.errorFetchingFaces=404:this.errorFetchingFaces=e),r.Z.error(t("photos","Failed to fetch faces list."),{error:e}),(0,s.x2)(t("photos","Failed to fetch faces list."))}finally{this.loadingFaces=!1}},async fetchFaceContent(t,e){if(!this.loadingFiles&&(e||!this.facesFiles[t]||!this.facesFiles[t].length))try{var a;this.errorFetchingFiles=null,this.loadingFiles=!0;let{data:e}=await c.ZP.getDirectoryContents("/recognize/".concat(null===(a=(0,o.ts)())||void 0===a?void 0:a.uid,"/faces/").concat(t),{data:l.Z,details:!0,signal:this.abortController.signal});e=e.map((t=>(0,d.AX)(t))).map((t=>({...t,filename:f().decode(t.realpath).replace("/".concat((0,o.ts)().uid,"/files"),"/files/".concat((0,o.ts)().uid))}))).map((t=>({...t,faceDetections:JSON.parse(f().decode(t.faceDetections))})));const i=e.map((t=>""+t.fileid));this.appendFiles(e),e.length>0&&await this.$store.commit("addFilesToFace",{faceName:t,fileIdsToAdd:i}),r.Z.debug("[FetchFacesMixin] Fetched ".concat(i.length," new files: "),i)}catch(t){t.response&&t.response.status&&(404===t.response.status?this.errorFetchingFiles=404:this.errorFetchingFiles=t),r.Z.error("Error fetching face files",{error:t})}finally{this.loadingFiles=!1}}}}},79532:(t,e,a)=>{a.d(e,{Z:()=>c});var i=a(87537),n=a.n(i),s=a(23645),o=a.n(s)()(n());o.push([t.id,".face-cover[data-v-53f3a852]{display:flex;flex-direction:column;padding:10px;border-radius:var(--border-radius-large)}.face-cover__crop-container[data-v-53f3a852]{overflow:hidden;width:128px;height:128px;border-radius:128px;position:relative;background:var(--color-background-darker);--photos-face-width: 128px}@media only screen and (max-width: 1020px){.face-cover__crop-container[data-v-53f3a852]{width:95px;height:95px;--photos-face-width: 95px}}.face-cover[data-v-53f3a852]:hover,.face-cover[data-v-53f3a852]:focus{background:var(--color-background-hover)}.face-cover__details[data-v-53f3a852]{display:flex;flex-direction:column;width:128px;margin-top:4px;text-align:center}@media only screen and (max-width: 1020px){.face-cover__details[data-v-53f3a852]{width:95px}}.face-cover__details__first-line[data-v-53f3a852]{display:flex;height:2em;overflow:hidden;text-overflow:ellipsis}.face-cover__details__second-line[data-v-53f3a852]{margin-top:6px;color:var(--color-text-maxcontrast)}.face-cover__details__name[data-v-53f3a852]{flex-grow:1;margin:0}.face-cover--small *[data-v-53f3a852]{font-size:15px !important}.face-cover--small .face-cover__details[data-v-53f3a852]{width:60px !important}.face-cover--small .face-cover__crop-container[data-v-53f3a852]{width:60px !important;height:60px !important;--photos-face-width: 60px !important}","",{version:3,sources:["webpack://./src/components/FaceCover.vue"],names:[],mappings:"AAEA,6BACC,YAAA,CACA,qBAAA,CACA,YAAA,CACA,wCAAA,CAEA,6CACC,eAAA,CACA,WAAA,CACA,YAAA,CACA,mBAAA,CACA,iBAAA,CACA,yCAAA,CACA,0BAAA,CAEA,2CATD,6CAUE,UAAA,CACA,WAAA,CACA,yBAAA,CAAA,CAIF,sEACC,wCAAA,CAGD,sCACC,YAAA,CACA,qBAAA,CACA,WAAA,CACA,cAAA,CACA,iBAAA,CAEA,2CAPD,sCAQE,UAAA,CAAA,CAGD,kDACC,YAAA,CACA,UAAA,CACA,eAAA,CACA,sBAAA,CAGD,mDACC,cAAA,CACA,mCAAA,CAGD,4CACC,WAAA,CACA,QAAA,CAMF,sCACC,yBAAA,CAED,yDACC,qBAAA,CAED,gEACC,qBAAA,CACA,sBAAA,CACA,oCAAA",sourcesContent:['$sizes: ("400": ("count": 3, "marginTop": 66, "marginW": 8), "700": ("count": 4, "marginTop": 66, "marginW": 8), "1024": ("count": 5, "marginTop": 66, "marginW": 44), "1280": ("count": 4, "marginTop": 66, "marginW": 44), "1440": ("count": 5, "marginTop": 88, "marginW": 66), "1600": ("count": 6, "marginTop": 88, "marginW": 66), "2048": ("count": 7, "marginTop": 88, "marginW": 66), "2560": ("count": 8, "marginTop": 88, "marginW": 88), "3440": ("count": 9, "marginTop": 88, "marginW": 88), "max": ("count": 10, "marginTop": 88, "marginW": 88));\n\n.face-cover {\n\tdisplay: flex;\n\tflex-direction: column;\n\tpadding: 10px;\n\tborder-radius: var(--border-radius-large);\n\n\t&__crop-container {\n\t\toverflow: hidden;\n\t\twidth: 128px;\n\t\theight: 128px;\n\t\tborder-radius: 128px;\n\t\tposition: relative;\n\t\tbackground: var(--color-background-darker);\n\t\t--photos-face-width: 128px;\n\n\t\t@media only screen and (max-width: 1020px) {\n\t\t\twidth: 95px;\n\t\t\theight: 95px;\n\t\t\t--photos-face-width: 95px;\n\t\t}\n\t}\n\n\t&:hover, &:focus {\n\t\tbackground: var(--color-background-hover);\n\t}\n\n\t&__details {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\twidth: 128px;\n\t\tmargin-top: 4px;\n\t\ttext-align: center;\n\n\t\t@media only screen and (max-width: 1020px) {\n\t\t\twidth: 95px;\n\t\t}\n\n\t\t&__first-line {\n\t\t\tdisplay: flex;\n\t\t\theight: 2em;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\n\t\t&__second-line {\n\t\t\tmargin-top: 6px;\n\t\t\tcolor: var(--color-text-maxcontrast);\n\t\t}\n\n\t\t&__name {\n\t\t\tflex-grow: 1;\n\t\t\tmargin: 0;\n\t\t}\n\t}\n}\n\n.face-cover--small {\n\t* {\n\t\tfont-size: 15px !important;\n\t}\n\t.face-cover__details {\n\t\twidth: 60px !important;\n\t}\n\t.face-cover__crop-container {\n\t\twidth: 60px !important;\n\t\theight: 60px !important;\n\t\t--photos-face-width: 60px !important;\n\t}\n}\n'],sourceRoot:""}]);const c=o},35936:(t,e,a)=>{a.d(e,{Z:()=>n});const i={name:"AccountBoxMultipleOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};const n=(0,a(51900).Z)(i,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon account-box-multiple-outline-icon",attrs:{"aria-hidden":!t.title,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M4 6H2V20C2 21.11 2.9 22 4 22H18V20H4V6M18.5 14.25C18.5 12.75 15.5 12 14 12S9.5 12.75 9.5 14.25V15H18.5M14 10.25C15.24 10.25 16.25 9.24 16.25 8S15.24 5.75 14 5.75 11.75 6.76 11.75 8 12.76 10.25 14 10.25M20 2H8C6.9 2 6 2.9 6 4V16C6 17.11 6.9 18 8 18H20C21.11 18 22 17.11 22 16V4C22 2.89 21.1 2 20 2M20 16H8V4H20V16Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports},89289:(t,e,a)=>{a.d(e,{Z:()=>F});var i=a(20629),n=a(79753),s=a(99751),o=a(46116);const c={name:"FaceCover",mixins:[s.Z,o.Z],props:{baseName:{type:String,required:!0},small:{type:Boolean,default:!1}},data:()=>({observer:null}),computed:{...(0,i.Se)(["files","faces","facesFiles"]),face(){return this.faces[this.baseName]},coverUrl(){return this.cover?(0,n.generateUrl)("/apps/photos/api/v1/preview/".concat(this.cover.fileid,"?x=",512,"&y=",512)):""},cover(){return this.getFaceCover(this.face.basename)},coverDimensions(){return this.cover?this.getCoverStyle(this.face.basename):{}}},async mounted(){this.waitForVisible(this.$el,(t=>{this.facesFiles[this.face.basename]||this.fetchFiles()}))},beforeDestroy(){this.observer.disconnect()},methods:{async fetchFiles(){await this.fetchFaceContent(this.face.basename)},waitForVisible(t,e){this.observer=new IntersectionObserver(((t,a)=>{t.forEach((t=>{t.intersectionRatio>0&&(e(),a.disconnect())}))})),this.observer.observe(t)}}};var r=a(93379),l=a.n(r),d=a(7795),A=a.n(d),h=a(90569),f=a.n(h),p=a(3565),m=a.n(p),C=a(19216),v=a.n(C),g=a(44589),u=a.n(g),x=a(79532),_={};_.styleTagTransform=u(),_.setAttributes=m(),_.insert=f().bind(null,"head"),_.domAPI=A(),_.insertStyleElement=v();l()(x.Z,_);x.Z&&x.Z.locals&&x.Z.locals;const F=(0,a(51900).Z)(c,(function(){var t=this,e=t._self._c;return e("div",{class:["face-cover",t.small&&"face-cover--small"],on:{click:function(e){return t.$emit("click")}}},[e("div",{staticClass:"face-cover__crop-container"},[e("img",{ref:"image",staticClass:"face-cover__image",style:t.coverDimensions,attrs:{src:t.coverUrl}})]),t._v(" "),e("div",{staticClass:"face-cover__details"},[t.baseName.match(/^[0-9]+$/)?t._e():e("div",{staticClass:"face-cover__details__first-line"},[e("h2",{staticClass:"face-cover__details__name"},[t._v("\n\t\t\t\t"+t._s(t.baseName)+"\n\t\t\t")])]),t._v(" "),t.facesFiles[t.baseName]&&!t.small?e("div",{staticClass:"face-cover__details__second-line"},[t._v("\n\t\t\t"+t._s(t.n("photos","%n photos","%n photos",t.facesFiles[t.baseName].length))+"\n\t\t")]):t._e()])])}),[],!1,null,"53f3a852",null).exports}}]);
//# sourceMappingURL=photos-node_modules_vue-material-design-icons_AccountBoxMultipleOutline_vue-src_components_FaceCover_vue.js.map?v=3922c1d69134b2c47302