nextcloud/apps/user_status/js/user-status-menu.js

216 lines
589 KiB
JavaScript
Raw Normal View History

!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:"4bc45b2e43f5bccb3c40",3:"9b1994f8cdba5d948552"}[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=458)}([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 v(e,t){return M.call(e,t)}function L(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var T=/-(\w)/g,w=L((function(e){return e.replace(T,(function(e,t){return t?t.toUpperCase():""}))})),Y=L((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),k=/\B([A-Z])/g,x=L((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 O(e,t,n){}var F=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:F,isReservedAttr:F,isUnknownElement:F,getTagNamespace:O,parsePlatformTagName:H,mustUseProp:F,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(),q=V&&/msie|trident/.test(V),K=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 v=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})),L=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:i(i({},Object(a.b)({statusType:function(e){return e.userStatus.status},statusIsUserDefined:function(e){return e.userStatus.statusIsUserDefined},customIcon:function(e){return e.userStatus.icon},customMessage:function(e){return e.userStatus.message}})),{},{visibleMessage:function(){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:function(){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:{changeStatus:function(e){var t,n=this;return(t=regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n.$store.dispatch("setStatus",{statusType:e});case 3:t.next=9;break;case 5:t.prev=5,t.t0=t.catch(0),Object(r.a)(n.$t("user_status","There was an error saving the new status")),console.debug(t.t0);case 9:case"end":return t.stop()}}),t,null,[[0,5]])})),function(){var e=this,n=arguments;return new Promise((function(a,r){var o=t.apply(e,n);function i(e){s(o,a,r,i,l,"next",e)}function l(e){s(o,a,r,i,l,"throw",e)}i(void 0)}))})()}}}},function(e,t,n){"use strict";(function(e,a){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return Xr})),function(){var 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
/*!
* Toastify js 1.9.3
* https://github.com/apvarun/toastify-js
* @license MIT licensed
*
* Copyright (C) 2018 Varun A P
*/
!function(t,n){e.exports?e.exports=n():t.Toastify=n()}(s,(function(e){var t=function e(t){return new e.lib.init(t)};function n(e,t){return t.offset[e]?isNaN(t.offset[e])?t.offset[e]:t.offset[e]+"px":"0px"}function a(e,t){return!(!e||"string"!=typeof t)&&!!(e.className&&e.className.trim().split(/\s+/gi).indexOf(t)>-1)}return t.lib=t.prototype={toastify:"1.9.3",constructor:t,init:function(e){return e||(e={}),this.options={},this.toastElement=null,this.options.text=e.text||"Hi there!",this.options.node=e.node,this.options.duration=0===e.duration?0:e.duration||3e3,this.options.selector=e.selector,this.options.callback=e.callback||function(){},this.options.destination=e.destination,this.options.newWindow=e.newWindow||!1,this.options.close=e.close||!1,this.options.gravity="bottom"===e.gravity?"toastify-bottom":"toastify-top",this.options.positionLeft=e.positionLeft||!1,this.options.position=e.position||"",this.options.backgroundColor=e.backgroundColor,this.options.avatar=e.avatar||"",this.options.className=e.className||"",this.options.stopOnFocus=void 0===e.stopOnFocus||e.stopOnFocus,this.options.onClick=e.onClick,this.options.offset=e.offset||{x:0,y:0},this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var e=document.createElement("div");if(e.className="toastify on "+this.options.className,this.options.position?e.className+=" toastify-"+this.options.position:!0===this.options.positionLeft?(e.className+=" toastify-left",console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")):e.className+=" toastify-right",e.className+=" "+this.options.gravity,this.options.backgroundColor&&(e.style.background=this.options.backgroundColor),this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)e.appendChild(this.options.node);else if(e.innerHTML=this.options.text,""!==this.options.avatar){var t=document.createElement("img");t.src=this.options.avatar,t.className="toastify-avatar","left"==this.options.position||!0===this.options.positionLeft?e.appendChild(t):e.insertAdjacentElement("afterbegin",t)}if(!0===this.options.close){var a=document.createElement("span");a.innerHTML="&#10006;",a.className="toast-close",a.addEventListener("click",function(e){e.stopPropagation(),this.removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)}.bind(this));var r=window.innerWidth>0?window.innerWidth:screen.width;("left"==this.options.position||!0===this.options.positionLeft)&&r>360?e.insertAdjacentElement("afterbegin",a):e.appendChild(a)}if(this.options.stopOnFocus&&this.options.duration>0){var s=this;e.addEventListener("mouseover",(function(t){window.clearTimeout(e.timeOutValue)})),e.addEventListener("mouseleave",(function(){e.timeOutValue=window.setTimeout((function(){s.removeElement(e)}),s.options.duration)}))}if(void 0!==this.options.destination&&e.addEventListener("click",function(e){e.stopPropagation(),!0===this.options.newWindow?window.open(this.options.destination,"_blank"):window.location=this.options.destination}.bind(this)),"function"==typeof this.options.onClick&&void 0===this.options.destination&&e.addEventListener("click",function(e){e.stopPropagation(),this.options.onClick()}.bind(this)),"object"===za(this.options.offset)){var o=n("x",this.options),i=n("y",this.options),l="left"==this.options.position?o:"-"+o,u="toastify-top"==this.options.gravity?i:"-"+i;e.style.transform="translate("+l+","+u+")"}return e},showToast:function(){var e;if(this.toastElement=this.buildToast(),!(e=void 0===this.options.selector?document.body:document.getElementById(this.options.selector)))throw"Root element is not defined";return e.insertBefore(this.toastElement,e.firstChild),t.reposition(),this.options.duration>0&&(this.toastElement.timeOutValue=window.setTimeout(function(){this.removeElement(this.toastElement)}.bind(this),this.options.duration)),this},hideToast:function(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this.removeElement(this.toastElement)},removeElement:function(e){e.className=e.className.replace("
/**
* @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 a=function(){return 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(15),s=a(16),o=a(402),i=a.n(o),l=a(23),u=a.n(l),d=a(18);function c(e,t,n,a,r,s,o){try{var i=e[s](o),l=i.value}catch(e){return void n(e)}i.done?t(l):Promise.resolve(l).then(a,r)}
/**
* @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 m=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(d.generateUrl)("/apps/user_status/heartbeat"),e.next=3,u.a.put(n,{status:t?"away":"online"});case 3:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(a,r){var s=e.apply(t,n);function o(e){c(s,a,r,o,i,"next",e)}function i(e){c(s,a,r,o,i,"throw",e)}o(void 0)}))});return function(e){return t.apply(this,arguments)}}();function p(e,t,n,a,r,s,o){try{var i=e[s](o),l=i.value}catch(e){return void n(e)}i.done?t(l):Promise.resolve(l).then(a,r)}var _={name:"UserStatus",components:{SetStatusModal:function(){return Promise.all([a.e(3),a.e(2)]).then(a.bind(null,480))}},mixins:[a(394).a],props:{inline:{type:Boolean,default:!1}},data:function(){return{isModalOpen:!1,heartbeatInterval:null,setAwayTimeout:null,mouseMoveListener:null,isAway:!1}},computed:{displayName:function(){return Object(s.getCurrentUser)().displayName}},mounted:function(){var e=this;this.$store.dispatch("loadStatusFromInitialState"),OC.config.session_keepalive&&(this.heartbeatInterval=setInterval(this._backgroundHeartbeat.bind(this),3e5),this.setAwayTimeout=function(){e.isAway=!0},this.mouseMoveListener=i()((function(){var t=e.isAway;e.isAway=!1,clearTimeout(e.setAwayTimeout),setTimeout(e.setAwayTimeout,12e4),t&&e._backgroundHeartbeat()}),2e3,!0),window.addEventListener("mousemove",this.mouseMoveListener,{capture:!0,passive:!0}),this._backgroundHeartbeat())},beforeDestroy:function(){window.removeEventListener("mouseMove",this.mouseMoveListener),clearInterval(this.heartbeatInterval)},methods:{openModal:function(){this.isModalOpen=!0},closeModal:function(){this.isModalOpen=!1},_backgroundHeartbeat:function(){var e,t=this;return(e=regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m(t.isAway);case 3:e.next=9;break;case 5:return e.prev=5,e.t0=e.catch(0),console.debug("Failed sending heartbeat, got: "+e.t0.response.status),e.abrupt("return");case 9:return e.next=11,t.$store.dispatch("reFetchStatusFromServer");case 11:case"end":return e.stop()}}),e,null,[[0,5]])})),function(){var t=this,n=arguments;return new Promise((function(a,r){var s=e.apply(t,n);function o(e){p(s,a,r,o,i,"next",e)}function i(e){p(s,a,r,o,i,"throw",e)}o(void 0)}))})()}}},f=a(89),h=a.n(f),y=a(338),g={insert:"head",singleton:!1},M=(h()(y.a,g),y.a.locals,a(92)),v=Object(M.a)(_,(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,L=a(251);function T(e,t,n,a,r,s,o){try{var i=e[s](o),l=i.value}catch(e){return void n(e)}i.done?t(l):Promise.resolve(l).then(a,r)}
/**
* @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 w=function(){var e,t=(e=regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"/predefined_statuses?format=json",e.next=3,u.a.get(t);case 3:return n=e.sent,e.abrupt("return",n.data.ocs.data);case 5:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(a,r){var s=e.apply(t,n);function o(e){T(s,a,r,o,i,"next",e)}function i(e){T(s,a,r,o,i,"throw",e)}o(void 0)}))});return function(){return t.apply(this,arguments)}}();function Y(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,r=function(){};return{s:r,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:r}}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 s,o=!0,i=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw s}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function x(e,t,n,a,r,s,o){try{var i=e[s](o),l=i.value}catch(e){return void n(e)}i.done?t(l):Promise.resolve(l).then(a,r)}
/**
* @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 b={state:{predefinedStatuses:[]},mutations:{addPredefinedStatus:function(e,t){e.predefinedStatuses.push(t)}},getters:{},actions:{loadAllPredefinedStatuses:function(e){return(t=regeneratorRuntime.mark((function t(){var n,a,r,s,o,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.state,a=e.commit,!(n.predefinedStatuses.length>0)){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,w();case 5:r=t.sent,s=Y(r);try{for(s.s();!(o=s.n()).done;)i=o.value,a("addPredefinedStatus",i)}catch(e){s.e(e)}finally{s.f()}case 8:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(a,r){var s=t.apply(e,n);function o(e){x(s,a,r,o,i,"next",e)}function i(e){x(s,a,r,o,i,"throw",e)}o(void 0)}))})();var t}}};function D(e,t,n,a,r,s,o){try{var i=e[s](o),l=i.value}catch(e){return void n(e)}i.done?t(l):Promise.resolve(l).then(a,r)}function S(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var s=e.apply(t,n);function o(e){D(s,a,r,o,i,"next",e)}function i(e){D(s,a,r,o,i,"throw",e)}o(void 0)}))}}
/**
* @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 j=function(){var e=S(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status",e.next=3,u.a.get(t);case 3:return n=e.sent,e.abrupt("return",n.data.ocs.data);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),O=function(){var e=S(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status/status",e.next=3,u.a.put(n,{statusType:t});case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),F=function(){var e=S(regeneratorRuntime.mark((function e(t){var n,a,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:null,a=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status/message/predefined?format=json",e.next=4,u.a.put(a,{messageId:t,clearAt:n});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),H=function(){var e=S(regeneratorRuntime.mark((function e(t){var n,a,r,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:null,a=s.length>2&&void 0!==s[2]?s[2]:null,r=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status/message/custom?format=json",e.next=5,u.a.put(r,{message:t,statusIcon:n,clearAt:a});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),E=function(){var e=S(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Object(d.generateOcsUrl)("apps/user_status/api/v1",2)+"user_status/message?format=json",e.next=3,u.a.delete(t);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),A=a(85),P=a(396),C=a(86),N=a.n(C),I=function(e){if(null===e)return null;var t=Object(P.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(N()(t).endOf(e.time).format("X"))}return"_time"===e.type?e.time:null},R=a(39);function U(e,t,n,a,r,s,o){try{var i=e[s](o),l=i.value}catch(e){return void n(e)}i.done?t(l):Promise.resolve(l).then(a,r)}function W(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var s=e.apply(t,n);function o(e){U(s,a,r,o,i,"next",e)}function i(e){U(s,a,r,o,i,"throw",e)}o(void 0)}))}}
/**
* @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 z={state:{status:null,statusIsUserDefined:null,message:null,icon:null,clearAt:null,messageIsPredefined:null,messageId:null},mutations:{setStatus:function(e,t){var n=t.statusType;e.status=n,e.statusIsUserDefined=!0},setPredefinedMessage:function(e,t){var n=t.messageId,a=t.clearAt,r=t.message,s=t.icon;e.messageId=n,e.messageIsPredefined=!0,e.message=r,e.icon=s,e.clearAt=a},setCustomMessage:function(e,t){var n=t.message,a=t.icon,r=t.clearAt;e.messageId=null,e.messageIsPredefined=!1,e.message=n,e.icon=a,e.clearAt=r},clearMessage:function(e){e.messageId=null,e.messageIsPredefined=!1,e.message=null,e.icon=null,e.clearAt=null},loadStatusFromServer:function(e,t){var n=t.status,a=t.statusIsUserDefined,r=t.message,s=t.icon,o=t.clearAt,i=t.messageIsPredefined,l=t.messageId;e.status=n,e.statusIsUserDefined=a,e.message=r,e.icon=s,e.clearAt=o,e.messageIsPredefined=i,e.messageId=l}},getters:{},actions:{setStatus:function(e,t){return W(regeneratorRuntime.mark((function n(){var a,r,o,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.commit,o=e.state,i=t.statusType,n.next=4,O(i);case 4:r("setStatus",{statusType:i}),Object(R.emit)("user_status:status.updated",{status:o.status,message:o.message,icon:o.icon,clearAt:o.clearAt,userId:null===(a=Object(s.getCurrentUser)())||void 0===a?void 0:a.uid});case 6:case"end":return n.stop()}}),n)})))()},setPredefinedMessage:function(e,t){return W(regeneratorRuntime.mark((function n(){var a,r,o,i,l,u,d,c,m,p;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.commit,o=e.rootState,i=e.state,l=t.messageId,u=t.clearAt,d=I(u),n.next=5,F(l,d);case 5:c=o.predefinedStatuses.predefinedStatuses.find((function(e){return e.id===l})),m=c.message,p=c.icon,r("setPredefinedMessage",{messageId:l,clearAt:d,message:m,icon:p}),Object(R.emit)("user_status:status.updated",{status:i.status,message:i.message,icon:i.icon,clearAt:i.clearAt,userId:null===(a=Object(s.getCurrentUser)())||void 0===a?void 0:a.uid});case 9:case"end":return n.stop()}}),n)})))()},setCustomMessage:function(e,t){return W(regeneratorRuntime.mark((function n(){var a,r,o,i,l,u,d;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.commit,o=e.state,i=t.message,l=t.icon,u=t.clearAt,d=I(u),n.next=5,H(i,l,d);case 5:r("setCustomMessage",{message:i,icon:l,clearAt:d}),Object(R.emit)("user_status:status.updated",{status:o.status,message:o.message,icon:o.icon,clearAt:o.clearAt,userId:null===(a=Object(s.getCurrentUser)())||void 0===a?void 0:a.uid});case 7:case"end":return n.stop()}}),n)})))()},clearMessage:function(e){return W(regeneratorRuntime.mark((function t(){var n,a,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.commit,r=e.state,t.next=3,E();case 3:a("clearMessage"),Object(R.emit)("user_status:status.updated",{status:r.status,message:r.message,icon:r.icon,clearAt:r.clearAt,userId:null===(n=Object(s.getCurrentUser)())||void 0===n?void 0:n.uid});case 5:case"end":return t.stop()}}),t)})))()},reFetchStatusFromServer:function(e){return W(regeneratorRuntime.mark((function t(){var n,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.commit,t.next=3,j();case 3:a=t.sent,n("loadStatusFromServer",a);case 5:case"end":return t.stop()}}),t)})))()},loadStatusFromInitialState:function(e){(0,e.commit)("loadStatusFromServer",Object(A.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(L.a);var $=new L.a.Store({modules:{predefinedStatuses:b,userStatus:z},strict:!0});
/**
* @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/>.
*
*/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:function(e){return e(v)},store:$});document.addEventListener("DOMContentLoaded",(function(){OCA.Dashboard&&OCA.Dashboard.registerStatus("status",(function(e){return new(r.default.extend(v))({propsData:{inline:!0},store:$}).$mount(e)}))}))}]);
//# sourceMappingURL=user-status-menu.js.map?v=7b5a6230bf1156c077c4