You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud/apps/user_status/js/user-status-menu.js

165 lines
581 KiB
JavaScript

!function(e){function t(t){for(var n,r,s=t[0],o=t[1],i=0,u=[];i<s.length;i++)r=s[i],Object.prototype.hasOwnProperty.call(a,r)&&a[r]&&u.push(a[r][0]),a[r]=0;for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n]);for(l&&l(t);u.length;)u.shift()()}var n={},a={1:0};function r(t){if(n[t])return n[t].exports;var a=n[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.e=function(e){var t=[],n=a[e];if(0!==n)if(n)t.push(n[2]);else{var s=new Promise((function(t,r){n=a[e]=[t,r]}));t.push(n[2]=s);var o,i=document.createElement("script");i.charset="utf-8",i.timeout=120,r.nc&&i.setAttribute("nonce",r.nc),i.src=function(e){return r.p+""+({2:"user-status-modal",3:"vendors-user-status-modal"}[e]||e)+".js?v="+{2:"6d4f0e58fea58eb5d227",3:"1ec8fe20438b0cbe63d7"}[e]}(e);var l=new Error;o=function(t){i.onerror=i.onload=null,clearTimeout(u);var n=a[e];if(0!==n){if(n){var r=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+r+": "+s+")",l.name="ChunkLoadError",l.type=r,l.request=s,n[1](l)}a[e]=void 0}};var u=setTimeout((function(){o({type:"timeout",target:i})}),12e4);i.onerror=i.onload=o,document.head.appendChild(i)}return Promise.all(t)},r.m=e,r.c=n,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/js/",r.oe=function(e){throw console.error(e),e};var s=window.webpackJsonpUserStatus=window.webpackJsonpUserStatus||[],o=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var l=o;r(r.s=586)}([function(e,t,n){(function(e){e.exports=function(){"use strict";var t,a;function r(){return t.apply(null,arguments)}function s(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function o(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function i(e){return void 0===e}function l(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){var n,a=[];for(n=0;n<e.length;++n)a.push(t(e[n],n));return a}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function m(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function p(e,t,n,a){return Yt(e,t,n,a,!0).utc()}function _(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function f(e){if(null==e._isValid){var t=_(e),n=a.call(t.parsedDateParts,(function(e){return null!=e})),r=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(r=r&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return r;e._isValid=r}return e._isValid}function h(e){var t=p(NaN);return null!=e?m(_(t),e):_(t).userInvalidated=!0,t}a=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,a=0;a<n;a++)if(a in t&&e.call(this,t[a],a,t))return!0;return!1};var y=r.momentProperties=[];function g(e,t){var n,a,r;if(i(t._isAMomentObject)||(e._isAMomentObject=t._isAMomen
/*!
* Vue.js v2.6.12
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
var a=Object.freeze({});function r(e){return null==e}function s(e){return null!=e}function o(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function l(e){return null!==e&&"object"==typeof e}var u=Object.prototype.toString;function d(e){return"[object Object]"===u.call(e)}function c(e){return"[object RegExp]"===u.call(e)}function m(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function p(e){return s(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function _(e){return null==e?"":Array.isArray(e)||d(e)&&e.toString===u?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function h(e,t){for(var n=Object.create(null),a=e.split(","),r=0;r<a.length;r++)n[a[r]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}h("slot,component",!0);var y=h("key,ref,slot,slot-scope,is");function g(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}var M=Object.prototype.hasOwnProperty;function L(e,t){return M.call(e,t)}function v(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var T=/-(\w)/g,w=v((function(e){return e.replace(T,(function(e,t){return t?t.toUpperCase():""}))})),Y=v((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),k=/\B([A-Z])/g,x=v((function(e){return e.replace(k,"-$1").toLowerCase()}));var b=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var a=arguments.length;return a?a>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function D(e,t){t=t||0;for(var n=e.length-t,a=new Array(n);n--;)a[n]=e[n+t];return a}function S(e,t){for(var n in t)e[n]=t[n];return e}function j(e){for(var t={},n=0;n<e.length;n++)e[n]&&S(t,e[n]);return t}function F(e,t,n){}var O=function(e,t,n){return!1},H=function(e){return e};function E(e,t){if(e===t)return!0;var n=l(e),a=l(t);if(!n||!a)return!n&&!a&&String(e)===String(t);try{var r=Array.isArray(e),s=Array.isArray(t);if(r&&s)return e.length===t.length&&e.every((function(e,n){return E(e,t[n])}));if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(r||s)return!1;var o=Object.keys(e),i=Object.keys(t);return o.length===i.length&&o.every((function(n){return E(e[n],t[n])}))}catch(e){return!1}}function A(e,t){for(var n=0;n<e.length;n++)if(E(e[n],t))return n;return-1}function P(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}var C=["component","directive","filter"],N=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],I={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:O,isReservedAttr:O,isUnknownElement:O,getTagNamespace:F,parsePlatformTagName:H,mustUseProp:O,async:!0,_lifecycleHooks:N},R=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function U(e,t,n,a){Object.defineProperty(e,t,{value:n,enumerable:!!a,writable:!0,configurable:!0})}var W=new RegExp("[^"+R.source+".$_\\d]");var z,$="__proto__"in{},J="undefined"!=typeof window,G="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,B=G&&WXEnvironment.platform.toLowerCase(),V=J&&window.navigator.userAgent.toLowerCase(),K=V&&/msie|trident/.test(V),q=V&&V.indexOf("msie 9.0")>0,Z=V&&V.indexOf("edge/")>0,X=(V&&V.indexOf("android"),V&&/iphone|ipad|ipod|ios/.test(V)||"ios"===B),Q=(V&&/chrome\/\d+/.test(V),V&&/phantomjs/.test(V),V&&V.match(/firefox\/(\d+)/)),ee={}.watch,te=!1;if(J)try{var ne={};Object.defineProperty(ne,"passive",{get:function(){te=!0}}),window.addEventListener("test-passive",null,ne)}catch(e){}var ae=function(){return void 0===z&&(z=!J&&!G&&void 0!==e&&(e.process&&"server"===e.process.env.VUE_ENV)),z},re=J&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function se(e){return"function"==t
/*!
* vuex v3.6.2
* (c) 2021 Evan You
* @license MIT
*/
function(e){if(Number(e.version.split(".")[0])>=2)e.mixin({beforeCreate:n});else{var t=e.prototype._init;e.prototype._init=function(e){void 0===e&&(e={}),e.init=e.init?[n].concat(e.init):n,t.call(this,e)}}function n(){var e=this.$options;e.store?this.$store="function"==typeof e.store?e.store():e.store:e.parent&&e.parent.$store&&(this.$store=e.parent.$store)}}(d=e)}m.state.get=function(){return this._vm._data.$$state},m.state.set=function(e){0},c.prototype.commit=function(e,t,n){var a=this,r=g(e,t,n),s=r.type,o=r.payload,i=(r.options,{type:s,payload:o}),l=this._mutations[s];l&&(this._withCommit((function(){l.forEach((function(e){e(o)}))})),this._subscribers.slice().forEach((function(e){return e(i,a.state)})))},c.prototype.dispatch=function(e,t){var n=this,a=g(e,t),r=a.type,s=a.payload,o={type:r,payload:s},i=this._actions[r];if(i){try{this._actionSubscribers.slice().filter((function(e){return e.before})).forEach((function(e){return e.before(o,n.state)}))}catch(e){0}var l=i.length>1?Promise.all(i.map((function(e){return e(s)}))):i[0](s);return new Promise((function(e,t){l.then((function(t){try{n._actionSubscribers.filter((function(e){return e.after})).forEach((function(e){return e.after(o,n.state)}))}catch(e){0}e(t)}),(function(e){try{n._actionSubscribers.filter((function(e){return e.error})).forEach((function(t){return t.error(o,n.state,e)}))}catch(e){0}t(e)}))}))}},c.prototype.subscribe=function(e,t){return p(e,this._subscribers,t)},c.prototype.subscribeAction=function(e,t){return p("function"==typeof e?{before:e}:e,this._actionSubscribers,t)},c.prototype.watch=function(e,t,n){var a=this;return this._watcherVM.$watch((function(){return e(a.state,a.getters)}),t,n)},c.prototype.replaceState=function(e){var t=this;this._withCommit((function(){t._vm._data.$$state=e}))},c.prototype.registerModule=function(e,t,n){void 0===n&&(n={}),"string"==typeof e&&(e=[e]),this._modules.register(e,t),h(this,this.state,e,this._modules.get(e),n.preserveState),f(this,this.state)},c.prototype.unregisterModule=function(e){var t=this;"string"==typeof e&&(e=[e]),this._modules.unregister(e),this._withCommit((function(){var n=y(t.state,e.slice(0,-1));d.delete(n,e[e.length-1])})),_(this)},c.prototype.hasModule=function(e){return"string"==typeof e&&(e=[e]),this._modules.isRegistered(e)},c.prototype.hotUpdate=function(e){this._modules.update(e),_(this,!0)},c.prototype._withCommit=function(e){var t=this._committing;this._committing=!0,e(),this._committing=t},Object.defineProperties(c.prototype,m);var L=k((function(e,t){var n={};return Y(t).forEach((function(t){var a=t.key,r=t.val;n[a]=function(){var t=this.$store.state,n=this.$store.getters;if(e){var a=x(this.$store,"mapState",e);if(!a)return;t=a.context.state,n=a.context.getters}return"function"==typeof r?r.call(this,t,n):t[r]},n[a].vuex=!0})),n})),v=k((function(e,t){var n={};return Y(t).forEach((function(t){var a=t.key,r=t.val;n[a]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var a=this.$store.commit;if(e){var s=x(this.$store,"mapMutations",e);if(!s)return;a=s.context.commit}return"function"==typeof r?r.apply(this,[a].concat(t)):a.apply(this.$store,[r].concat(t))}})),n})),T=k((function(e,t){var n={};return Y(t).forEach((function(t){var a=t.key,r=t.val;r=e+r,n[a]=function(){if(!e||x(this.$store,"mapGetters",e))return this.$store.getters[r]},n[a].vuex=!0})),n})),w=k((function(e,t){var n={};return Y(t).forEach((function(t){var a=t.key,r=t.val;n[a]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var a=this.$store.dispatch;if(e){var s=x(this.$store,"mapActions",e);if(!s)return;a=s.context.dispatch}return"function"==typeof r?r.apply(this,[a].concat(t)):a.apply(this.$store,[r].concat(t))}})),n}));function Y(e){return function(e){return Array.isArray(e)||o(e)}(e)?Array.isArray(e)?e.map((function(e){return{key:e,val:e}})):Object.keys(e).map((function(t){return{key:t,val:e[t]}})):[]}function k(e){return function(t,n){return"string"!=typeof t?(n=t,t=""):"/"!==t.charAt(t.length-1)&&(t+="/"),e(t,n)}}function x(e,t,n){return e._modulesNamespaceMap[n]}function b(e,t,n){var a=n?
/**
* @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/t.a={computed:{...Object(a.b)({statusType:e=>e.userStatus.status,statusIsUserDefined:e=>e.userStatus.statusIsUserDefined,customIcon:e=>e.userStatus.icon,customMessage:e=>e.userStatus.message}),visibleMessage(){if(this.customIcon&&this.customMessage)return"".concat(this.customIcon," ").concat(this.customMessage);if(this.customMessage)return this.customMessage;if(this.statusIsUserDefined)switch(this.statusType){case"online":return this.$t("user_status","Online");case"away":return this.$t("user_status","Away");case"dnd":return this.$t("user_status","Do not disturb");case"invisible":return this.$t("user_status","Invisible");case"offline":return this.$t("user_status","Offline")}return this.$t("user_status","Set status")},statusIcon(){switch(this.statusType){case"online":return"icon-user-status-online";case"away":return"icon-user-status-away";case"dnd":return"icon-user-status-dnd";case"invisible":case"offline":return"icon-user-status-invisible"}return""}},methods:{async changeStatus(e){try{await this.$store.dispatch("setStatus",{statusType:e})}catch(e){Object(r.a)(this.$t("user_status","There was an error saving the new status")),console.debug(e)}}}}},function(e,t,n){"use strict";(function(e,a){n.d(t,"a",(function(){return is})),function(){const t={TRANSLATIONS:[{locale:"ar",json:{charset:"utf-8",headers:{"Last-Translator":"S1 SYSTEMS | BP <info@s1.sa>, 2020","Language-Team":"Arabic (https://www.transifex.com/nextcloud/teams/64236/ar/)","Content-Type":"text/plain; charset=UTF-8",Language:"ar","Plural-Forms":"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;"},translations:{"":{"":{msgid:"",comments:{translator:"\nTranslators:\nS1 SYSTEMS | BP <info@s1.sa>, 2020\n"},msgstr:["Last-Translator: S1 SYSTEMS | BP <info@s1.sa>, 2020\nLanguage-Team: Arabic (https://www.transifex.com/nextcloud/teams/64236/ar/)\nContent-Type: text/plain; charset=UTF-8\nLanguage: ar\nPlural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"]},Undo:{msgid:"Undo",comments:{reference:"lib/toast.ts:191"},msgstr:["تراجع"]}}}}},{locale:"ast",json:{charset:"utf-8",headers:{"Last-Translator":"enolp <enolp@softastur.org>, 2020","Language-Team":"Asturian (https://www.transifex.com/nextcloud/teams/64236/ast/)","Content-Type":"text/plain; charset=UTF-8",Language:"ast","Plural-Forms":"nplurals=2; plural=(n != 1);"},translations:{"":{"":{msgid:"",comments:{translator:"\nTranslators:\nenolp <enolp@softastur.org>, 2020\n"},msgstr:["Last-Translator: enolp <enolp@softastur.org>, 2020\nLanguage-Team: Asturian (https://www.transifex.com/nextcloud/teams/64236/ast/)\nContent-Type: text/plain; charset=UTF-8\nLanguage: ast\nPlural-Forms: nplurals=2; plural=(n != 1);\n"]},Undo:{msgid:"Undo",comments:{reference:"lib/toast.ts:187"},msgstr:["Desfacer"]}}}}},{locale:"br",json:{charset:"utf-8",headers:{"Last-Translator":"Kervoas-Le Nabat Ewen <ewenkervoas@free.fr>, 2020","Language-Team":"Breton (https://www.transifex.com/nextcloud/teams/64236/br/)","Content-Type":"text/plain; charset=UTF-8",Language:"br","Plural-Forms":"nplurals=5; plural=((n%10 == 1) && (n%100 != 11) && (n%100 !=71) && (n%100 !=91) ? 0 :(n%10 == 2) && (n%100 != 12) && (n%100 !=72) && (n%100 !=92) ? 1 :(n%10 ==3 || n%10==4 || n%10==9) && (n%100 < 10 || n% 100 > 19) && (n%100 < 70 || n%100 > 79) && (n%100 < 90 || n%100 > 99) ? 2 :(n != 0 && n % 1000000 == 0) ? 3 : 4);"},translations:{"":{"":{msgid:"",comments:{translator:"\nTranslators:\nKervoas-Le Nabat Ewen <ewenkervoas@free.fr>, 2020\n"},msgstr:["Last-Translator: Kervoas-Le Nabat Ewen <ewenkervoas@free.fr>, 2020\nLanguage-Team: Breton (https://www.transifex.com/nextcloud/teams/64236/br/)\nContent-Type: text/plain; charset=UTF-8\nLanguage: br\nPlural-Forms: nplurals=5; plural=((n%10 == 1) && (n%100 != 11) && (n%100 !=71) && (n%100 !=91) ? 0 :(n%10 == 2) && (n%100 != 12) && (n%100 !=72) && (n%100 !=92) ? 1 :(n%10 ==3 || n%10==4 || n%10==9) && (n%100 < 10 || n% 100 > 19) && (n%100 < 70 || n%100 > 79) && (n%100 < 90 || n%100 > 99)
/**
* @copyright Copyright (c) 2020 Georg Ehrke
*
* @author Georg Ehrke <oc.list@georgehrke.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
const a=()=>new Date},,,function(e,t){function n(e,t,n){var a,r,s,o,i;function l(){var u=Date.now()-o;u<t&&u>=0?a=setTimeout(l,t-u):(a=null,n||(i=e.apply(s,r),s=r=null))}null==t&&(t=100);var u=function(){s=this,r=arguments,o=Date.now();var u=n&&!a;return a||(a=setTimeout(l,t)),u&&(i=e.apply(s,r),s=r=null),i};return u.clear=function(){a&&(clearTimeout(a),a=null)},u.flush=function(){a&&(i=e.apply(s,r),s=r=null,clearTimeout(a),a=null)},u}n.debounce=n,e.exports=n},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,n,a){"use strict";a.r(n);var r=a(16),s=a(18),o=a(424),i=a.n(o),l=a(24),u=a.n(l),d=a(20);var c={name:"UserStatus",components:{SetStatusModal:()=>Promise.all([a.e(3),a.e(2)]).then(a.bind(null,605))},mixins:[a(419).a],props:{inline:{type:Boolean,default:!1}},data:()=>({isModalOpen:!1,heartbeatInterval:null,setAwayTimeout:null,mouseMoveListener:null,isAway:!1}),computed:{displayName:()=>Object(s.getCurrentUser)().displayName},mounted(){this.$store.dispatch("loadStatusFromInitialState"),OC.config.session_keepalive&&(this.heartbeatInterval=setInterval(this._backgroundHeartbeat.bind(this),3e5),this.setAwayTimeout=()=>{this.isAway=!0},this.mouseMoveListener=i()(()=>{const e=this.isAway;this.isAway=!1,clearTimeout(this.setAwayTimeout),setTimeout(this.setAwayTimeout,12e4),e&&this._backgroundHeartbeat()},2e3,!0),window.addEventListener("mousemove",this.mouseMoveListener,{capture:!0,passive:!0}),this._backgroundHeartbeat())},beforeDestroy(){window.removeEventListener("mouseMove",this.mouseMoveListener),clearInterval(this.heartbeatInterval)},methods:{openModal(){this.isModalOpen=!0},closeModal(){this.isModalOpen=!1},async _backgroundHeartbeat(){try{await(async e=>{const t=Object(d.generateUrl)("/apps/user_status/heartbeat");await u.a.put(t,{status:e?"away":"online"})})(this.isAway)}catch(e){return void console.debug("Failed sending heartbeat, got: "+e.response.status)}await this.$store.dispatch("reFetchStatusFromServer")}}},m=a(97),p=a.n(m),_=a(352),f={insert:"head",singleton:!1},h=(p()(_.a,f),_.a.locals,a(100)),y=Object(h.a)(c,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("li",[n("div",{staticClass:"user-status-menu-item"},[e.inline?e._e():n("span",{staticClass:"user-status-menu-item__header",attrs:{title:e.displayName}},[e._v("\n\t\t\t"+e._s(e.displayName)+"\n\t\t")]),e._v(" "),n(e.inline?"button":"a",{tag:"toggle",staticClass:"user-status-menu-item__toggle",class:{"user-status-menu-item__toggle--inline":e.inline},attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.openModal(t)}}},[n("span",{staticClass:"user-status-menu-item__toggle-icon",class:e.statusIcon}),e._v("\n\t\t\t"+e._s(e.visibleMessage)+"\n\t\t")])],1),e._v(" "),e.isModalOpen?n("SetStatusModal",{on:{close:e.closeModal}}):e._e()],1)}),[],!1,null,"30c75648",null).exports,g=a(258);var M={state:{predefinedStatuses:[]},mutations:{addPredefinedStatus(e,t){e.predefinedStatuses.push(t)}},getters:{},actions:{async loadAllPredefinedStatuses({state:e,commit:t}){if(e.predefinedStatuses.length>0)return;const n=await(async()=>{const e=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"/predefined_statuses?format=json";return(await u.a.get(e)).data.ocs.data})();for(const e of n)t("addPredefinedStatus",e)}}};
/**
* @copyright Copyright (c) 2020 Georg Ehrke
*
* @author Georg Ehrke <oc.list@georgehrke.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/var L=a(91),v=a(421),T=a(92),w=a.n(T);
/**
* @copyright Copyright (c) 2020 Georg Ehrke
*
* @author Georg Ehrke <oc.list@georgehrke.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
const Y=e=>{if(null===e)return null;const t=Object(v.a)();if("period"===e.type)return t.setSeconds(t.getSeconds()+e.time),Math.floor(t.getTime()/1e3);if("end-of"===e.type)switch(e.time){case"day":case"week":return Number(w()(t).endOf(e.time).format("X"))}return"_time"===e.type?e.time:null};var k=a(42);
/**
* @copyright Copyright (c) 2020 Georg Ehrke
*
* @author Georg Ehrke <oc.list@georgehrke.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/var x={state:{status:null,statusIsUserDefined:null,message:null,icon:null,clearAt:null,messageIsPredefined:null,messageId:null},mutations:{setStatus(e,{statusType:t}){e.status=t,e.statusIsUserDefined=!0},setPredefinedMessage(e,{messageId:t,clearAt:n,message:a,icon:r}){e.messageId=t,e.messageIsPredefined=!0,e.message=a,e.icon=r,e.clearAt=n},setCustomMessage(e,{message:t,icon:n,clearAt:a}){e.messageId=null,e.messageIsPredefined=!1,e.message=t,e.icon=n,e.clearAt=a},clearMessage(e){e.messageId=null,e.messageIsPredefined=!1,e.message=null,e.icon=null,e.clearAt=null},loadStatusFromServer(e,{status:t,statusIsUserDefined:n,message:a,icon:r,clearAt:s,messageIsPredefined:o,messageId:i}){e.status=t,e.statusIsUserDefined=n,e.message=a,e.icon=r,e.clearAt=s,e.messageIsPredefined=o,e.messageId=i}},getters:{},actions:{async setStatus({commit:e,state:t},{statusType:n}){var a;await(async e=>{const t=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status/status";await u.a.put(t,{statusType:e})})(n),e("setStatus",{statusType:n}),Object(k.emit)("user_status:status.updated",{status:t.status,message:t.message,icon:t.icon,clearAt:t.clearAt,userId:null===(a=Object(s.getCurrentUser)())||void 0===a?void 0:a.uid})},async setPredefinedMessage({commit:e,rootState:t,state:n},{messageId:a,clearAt:r}){var o;const i=Y(r);await(async(e,t=null)=>{const n=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status/message/predefined?format=json";await u.a.put(n,{messageId:e,clearAt:t})})(a,i);const l=t.predefinedStatuses.predefinedStatuses.find(e=>e.id===a),{message:c,icon:m}=l;e("setPredefinedMessage",{messageId:a,clearAt:i,message:c,icon:m}),Object(k.emit)("user_status:status.updated",{status:n.status,message:n.message,icon:n.icon,clearAt:n.clearAt,userId:null===(o=Object(s.getCurrentUser)())||void 0===o?void 0:o.uid})},async setCustomMessage({commit:e,state:t},{message:n,icon:a,clearAt:r}){var o;const i=Y(r);await(async(e,t=null,n=null)=>{const a=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status/message/custom?format=json";await u.a.put(a,{message:e,statusIcon:t,clearAt:n})})(n,a,i),e("setCustomMessage",{message:n,icon:a,clearAt:i}),Object(k.emit)("user_status:status.updated",{status:t.status,message:t.message,icon:t.icon,clearAt:t.clearAt,userId:null===(o=Object(s.getCurrentUser)())||void 0===o?void 0:o.uid})},async clearMessage({commit:e,state:t}){var n;await(async()=>{const e=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status/message?format=json";await u.a.delete(e)})(),e("clearMessage"),Object(k.emit)("user_status:status.updated",{status:t.status,message:t.message,icon:t.icon,clearAt:t.clearAt,userId:null===(n=Object(s.getCurrentUser)())||void 0===n?void 0:n.uid})},async reFetchStatusFromServer({commit:e}){e("loadStatusFromServer",await(async()=>{const e=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status";return(await u.a.get(e)).data.ocs.data})())},loadStatusFromInitialState({commit:e}){e("loadStatusFromServer",Object(L.loadState)("user_status","status"))}}};
/**
* @copyright Copyright (c) 2020 Georg Ehrke
*
* @author Georg Ehrke <oc.list@georgehrke.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/r.default.use(g.a);var b=new g.a.Store({modules:{predefinedStatuses:M,userStatus:x},strict:!0});
/**
* @copyright Copyright (c) 2020 Georg Ehrke
*
* @author Georg Ehrke <oc.list@georgehrke.com>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/a.nc=btoa(Object(s.getRequestToken)()),a.p=OC.linkTo("user_status","js/"),r.default.prototype.t=t,r.default.prototype.$t=t;n.default=new r.default({el:'li[data-id="user_status-menuitem"]',name:"UserStatusRoot",render:e=>e(y),store:b});document.addEventListener("DOMContentLoaded",(function(){OCA.Dashboard&&OCA.Dashboard.registerStatus("status",e=>new(r.default.extend(y))({propsData:{inline:!0},store:b}).$mount(e))}))}]);
//# sourceMappingURL=user-status-menu.js.map?v=a8f40e79b6b611411a3f