/*! For license information please see user_status-menu.js.LICENSE.txt */ !function(){var e,n,r,s={43593:function(e,n,r){"use strict";var s=r(20144),a=r(45994),o=r(78595),i=r(79753),u=r(79954),c=r(20296),l=r.n(c),d=r(4820);function m(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}var f=function(){var t,e=(t=regeneratorRuntime.mark((function t(e){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(0,i.generateOcsUrl)("apps/user_status/api/v1/heartbeat?format=json"),t.next=3,d.default.put(n,{status:e?"away":"online"});case 3:return r=t.sent,t.abrupt("return",r.data.ocs.data);case 5:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){m(a,r,s,o,i,"next",t)}function i(t){m(a,r,s,o,i,"throw",t)}o(void 0)}))});return function(t){return e.apply(this,arguments)}}(),p=r(84387),v=r(25108);function h(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}var g=(0,u.j)("user_status","profileEnabled",!1).profileEnabled,A={name:"UserStatus",components:{SetStatusModal:function(){return Promise.all([r.e(7874),r.e(8299)]).then(r.bind(r,38165))}},mixins:[p.Z],props:{inline:{type:Boolean,default:!1}},data:function(){return{displayName:(0,a.ts)().displayName,heartbeatInterval:null,isAway:!1,isModalOpen:!1,loadingProfilePage:!1,mouseMoveListener:null,profileEnabled:g,setAwayTimeout:null}},computed:{elementTag:function(){return this.inline?"div":"li"},profilePageLink:function(){return this.profileEnabled?(0,i.generateUrl)("/u/{userId}",{userId:(0,a.ts)().uid}):null}},mounted:function(){var t=this;(0,o.Ld)("settings:display-name:updated",this.handleDisplayNameUpdate),(0,o.Ld)("settings:profile-enabled:updated",this.handleProfileEnabledUpdate),this.$store.dispatch("loadStatusFromInitialState"),OC.config.session_keepalive&&(this.heartbeatInterval=setInterval(this._backgroundHeartbeat.bind(this),3e5),this.setAwayTimeout=function(){t.isAway=!0},this.mouseMoveListener=l()((function(){var e=t.isAway;t.isAway=!1,clearTimeout(t.setAwayTimeout),setTimeout(t.setAwayTimeout,12e4),e&&t._backgroundHeartbeat()}),2e3,!0),window.addEventListener("mousemove",this.mouseMoveListener,{capture:!0,passive:!0}),this._backgroundHeartbeat()),(0,o.Ld)("user_status:status.updated",this.handleUserStatusUpdated)},beforeDestroy:function(){(0,o.r1)("settings:display-name:updated",this.handleDisplayNameUpdate),(0,o.r1)("settings:profile-enabled:updated",this.handleProfileEnabledUpdate),window.removeEventListener("mouseMove",this.mouseMoveListener),clearInterval(this.heartbeatInterval),(0,o.r1)("user_status:status.updated",this.handleUserStatusUpdated)},methods:{handleDisplayNameUpdate:function(t){this.displayName=t},handleProfileEnabledUpdate:function(t){this.profileEnabled=t},loadProfilePage:function(){this.profileEnabled&&(this.loadingProfilePage=!0)},openModal:function(){this.isModalOpen=!0},closeModal:function(){this.isModalOpen=!1},_backgroundHeartbeat:function(){var t,e=this;return(t=regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,f(e.isAway);case 3:if(null==(n=t.sent)||!n.userId){t.next=8;break}e.$store.dispatch("setStatusFromHeartbeat",n),t.next=10;break;case 8:return t.next=10,e.$store.dispatch("reFetchStatusFromServer");case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),v.debug("Failed sending heartbeat, got: "+(null===(r=t.t0.response)||void 0===r?void 0:r.status));case 15:case"end":return t.stop()}}),t,null,[[0,12]])})),function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){h(a,r,s,o,i,"next",t)}function i(t){h(a,r,s,o,i,"throw",t)}o(void 0)}))})()},handleUserStatusUpdated:function(t){OC.getCurrentUser().uid===t.userId&&this.$store.dispatch("setStatusFromObject",{status:t.status,icon:t.icon,message:t.message})}}},b=A,j=r(93379),y=r.n(j),w=r(7795),C=r.n(w),x=r(90569),_=r.n(x),k=r(3565),S=r.n(k),P=r(19216),O=r.n(P),I=r(44589),D=r.n(I),E=r(97548),M={};M.styleTagTransform=D(),M.setAttributes=S(),M.insert=_().bind(null,"head"),M.domAPI=C(),M.insertStyleElement=O(),y()(E.Z,M),E.Z&&E.Z.locals&&E.Z.locals;var U=(0,r(51900).Z)(b,(function(){var t=this,e=t._self._c;return e(t.elementTag,{tag:"component"},[e("div",{staticClass:"user-status-menu-item"},[t.inline?t._e():e("a",{staticClass:"user-status-menu-item__header",attrs:{href:t.profilePageLink},on:{click:function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey?null:t.loadProfilePage.apply(null,arguments)}}},[e("div",{staticClass:"user-status-menu-item__header-content"},[e("div",{staticClass:"user-status-menu-item__header-content-displayname"},[t._v(t._s(t.displayName))]),t._v(" "),t.loadingProfilePage?e("div",{staticClass:"icon-loading-small"}):e("div",{staticClass:"user-status-menu-item__header-content-placeholder"})]),t._v(" "),t.profileEnabled?e("div",[t._v("\n\t\t\t\t"+t._s(t.t("user_status","View profile"))+"\n\t\t\t")]):t._e()]),t._v(" "),e(t.inline?"button":"a",{tag:"toggle",staticClass:"user-status-menu-item__toggle",class:{"user-status-menu-item__toggle--inline":t.inline},attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.openModal.apply(null,arguments)}}},[e("span",{staticClass:"user-status-menu-item__toggle-icon",class:t.statusIcon}),t._v("\n\t\t\t"+t._s(t.visibleMessage)+"\n\t\t")])],1),t._v(" "),t.isModalOpen?e("SetStatusModal",{on:{close:t.closeModal}}):t._e()],1)}),[],!1,null,"2b6b0ebc",null),R=U.exports,T=r(20629);function z(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}var B=function(){var t,e=(t=regeneratorRuntime.mark((function t(){var e,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=(0,i.generateOcsUrl)("apps/user_status/api/v1/predefined_statuses?format=json"),t.next=3,d.default.get(e);case 3:return n=t.sent,t.abrupt("return",n.data.ocs.data);case 5:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){z(a,r,s,o,i,"next",t)}function i(t){z(a,r,s,o,i,"throw",t)}o(void 0)}))});return function(){return e.apply(this,arguments)}}();function F(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return L(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0)){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,B();case 5:s=e.sent,a=F(s);try{for(a.s();!(o=a.n()).done;)i=o.value,r("addPredefinedStatus",i)}catch(t){a.e(t)}finally{a.f()}case 8:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,s){var a=e.apply(t,n);function o(t){$(a,r,s,o,i,"next",t)}function i(t){$(a,r,s,o,i,"throw",t)}o(void 0)}))})();var e}},Z={state:{predefinedStatuses:[]},mutations:{addPredefinedStatus:function(t,e){t.predefinedStatuses.push(e)}},getters:{},actions:N};function q(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function H(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){q(a,r,s,o,i,"next",t)}function i(t){q(a,r,s,o,i,"throw",t)}o(void 0)}))}}var K=function(){var t=H(regeneratorRuntime.mark((function t(){var e,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=(0,i.generateOcsUrl)("apps/user_status/api/v1/user_status"),t.next=3,d.default.get(e);case 3:return n=t.sent,t.abrupt("return",n.data.ocs.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),G=function(){var t=H(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(0,i.generateOcsUrl)("apps/user_status/api/v1/user_status/status"),t.next=3,d.default.put(n,{statusType:e});case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Q=function(){var t=H(regeneratorRuntime.mark((function t(e){var n,r,s=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:null,r=(0,i.generateOcsUrl)("apps/user_status/api/v1/user_status/message/predefined?format=json"),t.next=4,d.default.put(r,{messageId:e,clearAt:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),W=function(){var t=H(regeneratorRuntime.mark((function t(e){var n,r,s,a=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:null,r=a.length>2&&void 0!==a[2]?a[2]:null,s=(0,i.generateOcsUrl)("apps/user_status/api/v1/user_status/message/custom?format=json"),t.next=5,d.default.put(s,{message:e,statusIcon:n,clearAt:r});case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),J=function(){var t=H(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=(0,i.generateOcsUrl)("apps/user_status/api/v1/user_status/message?format=json"),t.next=3,d.default.delete(e);case 3:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),V=r(64039),X=r(80351),Y=r.n(X),tt=function(t){if(null===t)return null;var e=(0,V.n)();if("period"===t.type)return e.setSeconds(e.getSeconds()+t.time),Math.floor(e.getTime()/1e3);if("end-of"===t.type)switch(t.time){case"day":case"week":return Number(Y()(e).endOf(t.time).format("X"))}return"_time"===t.type?t.time:null};function et(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function nt(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){et(a,r,s,o,i,"next",t)}function i(t){et(a,r,s,o,i,"throw",t)}o(void 0)}))}}var rt={state:{status:null,statusIsUserDefined:null,message:null,icon:null,clearAt:null,messageIsPredefined:null,messageId:null},mutations:{setStatus:function(t,e){var n=e.statusType;t.status=n,t.statusIsUserDefined=!0},setPredefinedMessage:function(t,e){var n=e.messageId,r=e.clearAt,s=e.message,a=e.icon;t.messageId=n,t.messageIsPredefined=!0,t.message=s,t.icon=a,t.clearAt=r},setCustomMessage:function(t,e){var n=e.message,r=e.icon,s=e.clearAt;t.messageId=null,t.messageIsPredefined=!1,t.message=n,t.icon=r,t.clearAt=s},clearMessage:function(t){t.messageId=null,t.messageIsPredefined=!1,t.message=null,t.icon=null,t.clearAt=null},loadStatusFromServer:function(t,e){var n=e.status,r=e.statusIsUserDefined,s=e.message,a=e.icon,o=e.clearAt,i=e.messageIsPredefined,u=e.messageId;t.status=n,t.message=s,t.icon=a,void 0!==r&&(t.statusIsUserDefined=r),void 0!==o&&(t.clearAt=o),void 0!==i&&(t.messageIsPredefined=i),void 0!==u&&(t.messageId=u)}},getters:{},actions:{setStatus:function(t,e){return nt(regeneratorRuntime.mark((function n(){var r,s,i,u;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=t.commit,i=t.state,u=e.statusType,n.next=4,G(u);case 4:s("setStatus",{statusType:u}),(0,o.j8)("user_status:status.updated",{status:i.status,message:i.message,icon:i.icon,clearAt:i.clearAt,userId:null===(r=(0,a.ts)())||void 0===r?void 0:r.uid});case 6:case"end":return n.stop()}}),n)})))()},setStatusFromObject:function(t,e){return nt(regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=t.commit,t.state,r("loadStatusFromServer",e);case 2:case"end":return n.stop()}}),n)})))()},setPredefinedMessage:function(t,e){return nt(regeneratorRuntime.mark((function n(){var r,s,i,u,c,l,d,m,f,p;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=t.commit,i=t.rootState,u=t.state,c=e.messageId,l=e.clearAt,d=tt(l),n.next=5,Q(c,d);case 5:m=i.predefinedStatuses.predefinedStatuses.find((function(t){return t.id===c})),f=m.message,p=m.icon,s("setPredefinedMessage",{messageId:c,clearAt:d,message:f,icon:p}),(0,o.j8)("user_status:status.updated",{status:u.status,message:u.message,icon:u.icon,clearAt:u.clearAt,userId:null===(r=(0,a.ts)())||void 0===r?void 0:r.uid});case 9:case"end":return n.stop()}}),n)})))()},setCustomMessage:function(t,e){return nt(regeneratorRuntime.mark((function n(){var r,s,i,u,c,l,d;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=t.commit,i=t.state,u=e.message,c=e.icon,l=e.clearAt,d=tt(l),n.next=5,W(u,c,d);case 5:s("setCustomMessage",{message:u,icon:c,clearAt:d}),(0,o.j8)("user_status:status.updated",{status:i.status,message:i.message,icon:i.icon,clearAt:i.clearAt,userId:null===(r=(0,a.ts)())||void 0===r?void 0:r.uid});case 7:case"end":return n.stop()}}),n)})))()},clearMessage:function(t){return nt(regeneratorRuntime.mark((function e(){var n,r,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.commit,s=t.state,e.next=3,J();case 3:r("clearMessage"),(0,o.j8)("user_status:status.updated",{status:s.status,message:s.message,icon:s.icon,clearAt:s.clearAt,userId:null===(n=(0,a.ts)())||void 0===n?void 0:n.uid});case 5:case"end":return e.stop()}}),e)})))()},reFetchStatusFromServer:function(t){return nt(regeneratorRuntime.mark((function e(){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commit,e.next=3,K();case 3:r=e.sent,n("loadStatusFromServer",r);case 5:case"end":return e.stop()}}),e)})))()},setStatusFromHeartbeat:function(t,e){return nt(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:(0,t.commit)("loadStatusFromServer",e);case 2:case"end":return n.stop()}}),n)})))()},loadStatusFromInitialState:function(t){(0,t.commit)("loadStatusFromServer",(0,u.j)("user_status","status"))}}};s.ZP.use(T.ZP);var st=new T.yh({modules:{predefinedStatuses:Z,userStatus:rt},strict:!0});r.nc=btoa((0,a.IH)()),s.ZP.prototype.t=t,s.ZP.prototype.$t=t;var at=function(){var t=document.getElementById("user_status-menu-entry");new s.ZP({el:t,render:function(t){return t(R)},store:st})};document.getElementById("user_status-menu-entry")?at():(0,o.Ld)("core:user-menu:mounted",at),document.addEventListener("DOMContentLoaded",(function(){OCA.Dashboard&&OCA.Dashboard.registerStatus("status",(function(t){return new(s.ZP.extend(R))({propsData:{inline:!0},store:st}).$mount(t)}))}))},84387:function(t,e,n){"use strict";var r=n(20629),s=n(64024),a=n(25108);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t){for(var e=1;e