Sfoglia il codice sorgente

[Refs #34] display starred messages
[Refs #34] star/unstar messages
[Refs #34] get pinned messages
[bugfix] invalidate message redraw only selected room
[bugfix] Slack stopped sending mpim members :(

B Thibault 8 anni fa
parent
commit
86b8099d0c

+ 6 - 1
cli/data.js

@@ -32,6 +32,10 @@ SimpleChatSystem.prototype.onRequest = function() { console.error("unimplemented
 SimpleChatSystem.prototype.sendMeMsg = function(chan, text) { console.error("unimplemented"); };
 SimpleChatSystem.prototype.sendMsg = function(chan, text, attachments) { console.error("unimplemented"); };
 SimpleChatSystem.prototype.removeMsg = function(chan, ts) { console.error("unimplemented"); };
+SimpleChatSystem.prototype.starMsg = function(chan, msgId) { console.error("unimplemented"); };
+SimpleChatSystem.prototype.unstarMsg = function(chan, msgId) { console.error("unimplemented"); };
+SimpleChatSystem.prototype.pinMsg = function(chan, msgId) { console.error("unimplemented"); };
+SimpleChatSystem.prototype.unpinMsg = function(chan, msgId) { console.error("unimplemented"); };
 SimpleChatSystem.prototype.editMsg = function(chan, ts, newText) { console.error("unimplemented"); };
 SimpleChatSystem.prototype.addReaction = function(chan, ts, reaction) { console.error("unimplemented"); };
 SimpleChatSystem.prototype.removeReaction = function(chan, ts, reaction) { console.error("unimplemented"); };
@@ -226,7 +230,8 @@ function markRoomAsRead(room) {
 function invalidateAllMessages() {
     for (var i in DATA.history)
         DATA.history[i].invalidateAllMessages();
-    onRoomUpdated();
+    if (SELECTED_ROOM)
+        onRoomUpdated();
 }
 
 DATA = new SlackWrapper();

+ 36 - 14
cli/dom.js

@@ -135,22 +135,44 @@ function createReactionDom(chanId, msgId, reaction, users) {
  * @param {UiMessage|UiMeMessage|UiNoticeMessage} msg
 **/
 function addHoverButtons(hover, msg) {
-    var hoverReply = document.createElement("li");
-    hoverReply.className = R.klass.msg.hover.reply;
-    hoverReply.style.backgroundImage = 'url("repl.svg")';
-    hover.appendChild(hoverReply);
+    var capacities = msg.context.getChatContext().capacities,
+        isMe = DATA.context.isMe(msg.userId);
+
+    if (capacities["replyToMsg"]) {
+        var hoverReply = document.createElement("li");
+        hoverReply.className = R.klass.msg.hover.reply;
+        hoverReply.style.backgroundImage = 'url("repl.svg")';
+        hover.appendChild(hoverReply);
+    }
 
-    var hoverReaction = document.createElement("li");
-    hoverReaction.className = R.klass.msg.hover.reaction;
-    hoverReaction.style.backgroundImage = 'url("smile.svg")';
-    hover.appendChild(hoverReaction);
+    if (capacities["reactMsg"]) {
+        var hoverReaction = document.createElement("li");
+        hoverReaction.className = R.klass.msg.hover.reaction;
+        hoverReaction.style.backgroundImage = 'url("smile.svg")';
+        hover.appendChild(hoverReaction);
+    }
 
-    if (DATA.context.isMe(msg.userId)) {
+    if (isMe && capacities["editMsg"] || capacities["editOtherMsg"]) {
         var hoverEdit = document.createElement("li");
         hoverEdit.className = R.klass.msg.hover.edit;
         hoverEdit.style.backgroundImage = 'url("edit.svg")';
         hover.appendChild(hoverEdit);
+    }
+
+    if (capacities["starMsg"]) {
+        hover.hoverStar = document.createElement("li")
+        hover.hoverStar.className = R.klass.msg.hover.star;
+        hover.appendChild(hover.hoverStar);
+    }
+
+    if (capacities["pinMsg"]) {
+        var hoverPin = document.createElement("li")
+        hoverPin.className = R.klass.msg.hover.pin;
+        hover.appendChild(hoverPin);
+        hoverPin.style.backgroundImage = 'url("pin.svg")';
+    }
 
+    if (isMe && capacities["removeMsg"] || capacities["moderate"]) {
         var hoverRemove = document.createElement("li")
         hoverRemove.className = R.klass.msg.hover.remove;
         hoverRemove.style.backgroundImage = 'url("remove.svg")';
@@ -168,8 +190,8 @@ function doCreateMessageDom(msg, skipAttachment) {
     var channelId = msg.channelId;
     var dom = document.createElement("div")
         ,msgBlock = document.createElement("div")
-        ,hoverReaction = document.createElement("li")
-        ,hover = document.createElement("ul");
+        ,hoverReaction = document.createElement("li");
+    dom.hover = document.createElement("ul");
 
     dom.attachments = document.createElement("ul");
     dom.reactions = document.createElement("ul");
@@ -183,8 +205,8 @@ function doCreateMessageDom(msg, skipAttachment) {
     dom.textDom.className = R.klass.msg.msg;
     dom.authorName.className = R.klass.msg.authorname;
 
-    addHoverButtons(hover, msg);
-    hover.className = R.klass.msg.hover.container;
+    addHoverButtons(dom.hover, msg);
+    dom.hover.className = R.klass.msg.hover.container;
 
     msgBlock.appendChild(dom.authorName);
     msgBlock.appendChild(dom.textDom);
@@ -200,7 +222,7 @@ function doCreateMessageDom(msg, skipAttachment) {
     dom.attachments.className = R.klass.msg.attachment.list;
     dom.reactions.className = R.klass.msg.reactions.container;
     dom.appendChild(msgBlock);
-    dom.appendChild(hover);
+    dom.appendChild(dom.hover);
     return dom;
 }
 

+ 11 - 5
cli/ui.js

@@ -157,11 +157,11 @@ function onNetworkStateUpdated(isNetworkWorking) {
 function onRoomSelected() {
     var name = SELECTED_ROOM.name || (SELECTED_ROOM.user ? SELECTED_ROOM.user.getName() : undefined);
     if (!name) {
+        console.error("No name provided for ", SELECTED_ROOM);
         /** @type {Array.<string>} */
         var members = [];
-        SELECTED_ROOM.users.forEach(function(i) {
-            members.push(i.getName());
-        });
+        for (var userId in SELECTED_ROOM.users)
+            members.push(SELECTED_ROOM.users[userId].getName());
         name = members.join(", ");
     }
     var roomLi = document.getElementById("room_" +SELECTED_ROOM.id);
@@ -433,9 +433,15 @@ function onMsgClicked(target, msg) {
             onEditingUpdated();
         }
     } else if (target.classList.contains(R.klass.msg.hover.star)) {
-        //FIXME
+        if (msg.starred)
+            unstarMsg(SELECTED_ROOM, msg);
+        else
+            starMsg(SELECTED_ROOM, msg);
     } else if (target.classList.contains(R.klass.msg.hover.pin)) {
-        //FIXME
+        if (msg.pinned)
+            unpinMsg(SELECTED_ROOM, msg);
+        else
+            pinMsg(SELECTED_ROOM, msg);
     } else if (target.classList.contains(R.klass.msg.hover.remove)) {
         //TODO prompt confirm
         if (REPLYING_TO) {

+ 6 - 0
cli/uiMessage.js

@@ -160,6 +160,11 @@ var AbstractUiMessage = (function() {
         _this.dom.attachments.appendChild(attachmentFrag);
     },
 
+    updateHover = function(_this, channelId) {
+        if (_this.dom.hover.hoverStar)
+            _this.dom.hover.hoverStar.style.backgroundImage = _this.starred ? 'url("star_full.png")' : 'url("star_empty.png")';
+    },
+
     updateCommon = function(_this, sender) {
         _this.dom.ts.innerHTML = locale.formatDate(_this.ts);
         _this.dom.textDom.innerHTML = _formatText(_this, _this.text);
@@ -208,6 +213,7 @@ var AbstractUiMessage = (function() {
             updateCommon(_this, sender);
             updateAttachments(_this, _this.channelId);
             updateReactions(_this, _this.channelId);
+            updateHover(_this, _this.channelId);
             if (_this.edited) {
                 _this.dom.edited.innerHTML = locale.edited(_this.edited);
                 _this.dom.classList.add(R.klass.msg.editedStatus);

+ 46 - 2
cli/workflow.js

@@ -357,7 +357,7 @@ function onTextEntered(input, skipCommand) {
 /**
  * @param {Room} chan
  * @param {string} text
- * @param {Message|null=} msg
+ * @param {Message} msg
 **/
 function editMsg(chan, text, msg) {
     var xhr = new XMLHttpRequest();
@@ -368,7 +368,7 @@ function editMsg(chan, text, msg) {
 
 /**
  * @param {Room} chan
- * @param {Message|null=} msg
+ * @param {Message} msg
 **/
 function removeMsg(chan, msg) {
     var xhr = new XMLHttpRequest();
@@ -377,6 +377,50 @@ function removeMsg(chan, msg) {
     xhr.send(null);
 }
 
+/**
+ * @param {Room} chan
+ * @param {Message} msg
+**/
+function pinMsg(chan, msg) {
+    var xhr = new XMLHttpRequest();
+    var url = 'api/pinMsg?room=' +chan.id +"&msgId=" +msg.id;
+    xhr.open('POST', url, true);
+    xhr.send(null);
+}
+
+/**
+ * @param {Room} chan
+ * @param {Message} msg
+**/
+function starMsg(chan, msg) {
+    var xhr = new XMLHttpRequest();
+    var url = 'api/starMsg?room=' +chan.id +"&msgId=" +msg.id;
+    xhr.open('POST', url, true);
+    xhr.send(null);
+}
+
+/**
+ * @param {Room} chan
+ * @param {Message} msg
+**/
+function unpinMsg(chan, msg) {
+    var xhr = new XMLHttpRequest();
+    var url = 'api/pinMsg?room=' +chan.id +"&msgId=" +msg.id;
+    xhr.open('DELETE', url, true);
+    xhr.send(null);
+}
+
+/**
+ * @param {Room} chan
+ * @param {Message} msg
+**/
+function unstarMsg(chan, msg) {
+    var xhr = new XMLHttpRequest();
+    var url = 'api/starMsg?room=' +chan.id +"&msgId=" +msg.id;
+    xhr.open('DELETE', url, true);
+    xhr.send(null);
+}
+
 /**
  * @param {Room} chan
  * @param {string} id

+ 105 - 101
srv/public/mimouchat.min.js

@@ -1,120 +1,124 @@
 "use strict";(function(){
-var q;function aa(a){this.id=a;this.version=0}aa.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);this.version=Math.max(this.version,b)};function ba(a){this.a=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.U=a.category}function ca(){this.a={};this.A=[];this.version=0}
-ca.prototype.update=function(a,b){a.emoji_use&&(this.a=JSON.parse(a.emoji_use));a.highlight_words?this.A=(a.highlight_words||"").split(",").filter(function(a){return""!==a.trim()}):a.highlights&&(this.A=a.highlights);this.version=Math.max(this.version,b)};function da(){this.a=null;this.l={};this.j={};this.self=null;this.b={version:0,data:{}};this.i={version:0,data:{}};this.u={};this.ca={};this.o=0}function fa(a,b){return b.pv?new t(b.id,a.j[b.user]):new v(b.id)}
+var p;function aa(a){this.id=a;this.version=0}aa.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);this.version=Math.max(this.version,b)};function ba(a){this.a=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.U=a.category}function ca(){this.a={};this.B=[];this.version=0}
+ca.prototype.update=function(a,b){a.emoji_use&&(this.a=JSON.parse(a.emoji_use));a.highlight_words?this.B=(a.highlight_words||"").split(",").filter(function(a){return""!==a.trim()}):a.highlights&&(this.B=a.highlights);this.version=Math.max(this.version,b)};function da(){this.a=null;this.l={};this.j={};this.self=null;this.b={version:0,data:{}};this.i={version:0,data:{}};this.u={};this.Y={};this.o=0}function fa(a,b){return b.pv?new t(b.id,a.j[b.user]):new v(b.id)}
 function ga(a,b,c){var d=d||"";b.team&&(a.a||(a.a=new aa(b.team.id)),a.a.update(b.team,c));if(b.users)for(var e=0,f=b.users.length;e<f;e++){var g=a.j[d+b.users[e].id];g||(g=a.j[d+b.users[e].id]=new ha(b.users[e].id));g.update(b.users[e],c)}if(b.channels)for(e=0,f=b.channels.length;e<f;e++)(g=a.l[d+b.channels[e].id])||(g=a.l[d+b.channels[e].id]=fa(a,b.channels[e])),g.update(b.channels[e],a,c,d);b.emojis&&(a.b.data=b.emojis,a.b.version=c);if(void 0!==b.commands){a.i.data={};for(e in b.commands)a.i.data[e]=
-new ba(b.commands[e]);a.i.version=c}b.self&&(a.self=a.j[d+b.self.id]||null,a.self.R||(a.self.R=new ca),b.self.prefs&&a.self.R.update(b.self.prefs,c));b.capacities&&(a.ca={},b.capacities.forEach(function(a){this.ca[a]=!0},a));a.o=Math.max(a.o,c)}"undefined"!==typeof module&&(module.H.rb=da,module.H.sb=aa,module.H.ub=ba);function v(a){this.id=a;this.G=!1;this.B=0;this.j={};this.version=0}
-v.prototype.update=function(a,b,c,d){d=d||"";void 0!==a.name&&(this.name=a.name);void 0!==a.is_archived&&(this.aa=a.is_archived);void 0!==a.is_member&&(this.M=a.is_member);void 0!==a.last_read&&(this.B=Math.max(parseFloat(a.last_read),this.B));void 0!==a.last_msg&&(this.P=parseFloat(a.last_msg));void 0!==a.is_private&&(this.b=a.is_private);this.G=!!a.is_starred;if(a.members&&(this.j={},a.members))for(var e=0,f=a.members.length;e<f;e++){var g=b.j[d+a.members[e]];this.j[g.id]=g;g.l[this.id]=this}a.topic&&
-(this.ia=a.topic.value,this.o=b.j[d+a.topic.creator],this.$=a.topic.last_set);a.purpose&&(this.fa=a.purpose.value,this.i=b.j[d+a.purpose.creator],this.Z=a.purpose.last_set);this.version=Math.max(this.version,c)};function ia(a,b){var c=ja;return{name:c.da(b,a.name),kb:c.da(b,Object.values(a.j),function(a){return a?a.getName():null}),ia:c.da(b,a.ia),fa:c.da(b,a.fa)}}function t(a,b){v.call(this,a);this.a=b;this.name=b.getName();this.b=!0;b.V=this}t.prototype=Object.create(v.prototype);
-t.prototype.constructor=t;"undefined"!==typeof module&&(module.H.Ab=v,module.H.zb=t);function x(a,b){this.J=a.user;this.username=a.username;this.id=a.id||a.ts;this.m=parseFloat(a.ts);this.text="";this.s=[];this.i=this.D=this.G=!1;this.C={};this.version=b;this.update(a,b)}function y(a,b){x.call(this,a,b)}function z(a,b){x.call(this,a,b)}
-x.prototype.update=function(a,b){if(a){if(this.text=a.text||"",a.attachments&&(this.s=a.attachments),this.G=!!a.is_starred,this.D=void 0===a.edited?!1:a.edited,this.i=!!a.removed,a.reactions){var c={};a.reactions.forEach(function(a){c[a.name]=[];a.users.forEach(function(b){c[a.name].push(b)})});this.C=c}}else this.i=!0;this.version=b};function B(a,b,c,d,e){this.id="string"===typeof a?a:a.id;this.a=[];this.b=c;this.ab=0;this.o=b;d&&ka(this,d,e)}
+new ba(b.commands[e]);a.i.version=c}b.self&&(a.self=a.j[d+b.self.id]||null,a.self.R||(a.self.R=new ca),b.self.prefs&&a.self.R.update(b.self.prefs,c));b.capacities&&(a.Y={},b.capacities.forEach(function(a){this.Y[a]=!0},a));a.o=Math.max(a.o,c)}"undefined"!==typeof module&&(module.H.tb=da,module.H.ub=aa,module.H.wb=ba);function v(a){this.id=a;this.A=!1;this.C=0;this.j={};this.version=0}
+v.prototype.update=function(a,b,c,d){d=d||"";void 0!==a.name&&(this.name=a.name);void 0!==a.is_archived&&(this.ca=a.is_archived);void 0!==a.is_member&&(this.M=a.is_member);void 0!==a.last_read&&(this.C=Math.max(parseFloat(a.last_read),this.C));void 0!==a.last_msg&&(this.P=parseFloat(a.last_msg));void 0!==a.is_private&&(this.b=a.is_private);this.A=!!a.is_starred;if(a.members&&(this.j={},a.members))for(var e=0,f=a.members.length;e<f;e++){var g=b.j[d+a.members[e]];this.j[g.id]=g;g.l[this.id]=this}a.topic&&
+(this.ka=a.topic.value,this.o=b.j[d+a.topic.creator],this.ba=a.topic.last_set);a.purpose&&(this.ha=a.purpose.value,this.i=b.j[d+a.purpose.creator],this.$=a.purpose.last_set);this.version=Math.max(this.version,c)};function ia(a,b){var c=ja;return{name:c.ea(b,a.name),mb:c.ea(b,Object.values(a.j),function(a){return a?a.getName():null}),ka:c.ea(b,a.ka),ha:c.ea(b,a.ha)}}function t(a,b){v.call(this,a);this.a=b;this.name=b.getName();this.b=!0;b.V=this}t.prototype=Object.create(v.prototype);
+t.prototype.constructor=t;"undefined"!==typeof module&&(module.H.Cb=v,module.H.Bb=t);function x(a,b){this.J=a.user;this.username=a.username;this.id=a.id||a.ts;this.m=parseFloat(a.ts);this.text="";this.s=[];this.A=a.is_starred||!1;this.i=this.F=!1;this.D={};this.version=b;this.update(a,b)}function y(a,b){x.call(this,a,b)}function z(a,b){x.call(this,a,b)}
+x.prototype.update=function(a,b){if(a){if(this.text=a.text||"",a.attachments&&(this.s=a.attachments),this.A=!!a.is_starred,this.F=void 0===a.edited?!1:a.edited,this.i=!!a.removed,a.reactions){var c={};a.reactions.forEach(function(a){c[a.name]=[];a.users.forEach(function(b){c[a.name].push(b)})});this.D=c}}else this.i=!0;this.version=b};function B(a,b,c,d,e){this.id="string"===typeof a?a:a.id;this.a=[];this.b=c;this.cb=0;this.o=b;d&&ka(this,d,e)}
 function ka(a,b,c){var d=0;b.forEach(function(a){d=Math.max(this.push(a,c),d)}.bind(a));la(a);return d}B.prototype.i=function(a,b){return!0===a.isMeMessage?new y(a,b):!0===a.isNotice?new z(a,b):new x(a,b)};
 B.prototype.push=function(a,b){for(var c,d=!1,e,f=0,g=this.a.length;f<g;f++)if(c=this.a[f],c.id===a.id){e=c.update(a,b);d=!0;break}d||(c=this.i(a,b),this.a.push(c),e=c.m);for(;this.a.length>this.o;)this.a.shift();if(this.b)for(a=0;a<this.a.length;a++)this.a[a].version<b-this.b&&this.a.splice(a--,1);return e||0};function ma(a){return a.a[a.a.length-1]}function na(a,b){for(var c=0,d=a.a.length;c<d;c++)if(a.a[c].id==b)return a.a[c];return null}function la(a){a.a.sort(function(a,c){return a.m-c.m})}
-y.prototype=Object.create(x.prototype);y.prototype.constructor=y;z.prototype=Object.create(x.prototype);z.prototype.constructor=z;"undefined"!==typeof module&&(module.H={wb:x,vb:y,yb:z,Bb:B});function ha(a){this.id=a;this.l={};this.V=this.R=null;this.version=0}
-ha.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.Ma=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.goal&&(this.gb=a.goal);void 0!==a.phone&&(this.mb=a.phone);void 0!==a.first_name&&(this.Oa=a.first_name);void 0!==a.last_name&&(this.Sa=a.last_name);void 0!==a.real_name&&(this.Za=a.real_name);void 0!==a.isPresent&&(this.ua=a.isPresent);a.isBot&&(this.ib=a.isBot);this.version=Math.max(this.version,b)};
-ha.prototype.getName=function(){return this.name||this.Za||this.Oa||this.Sa};"undefined"!==typeof module&&(module.H.tb=ha);function oa(){this.a=[]}oa.prototype.push=function(a){this.a.push(a)};function pa(a,b){for(var c=0,d=a.a.length;c<d;c++)if(b===qa(a.a[c]))return a.a[c];return null}function ra(a,b){for(var c=0,d=a.a.length;c<d;c++){var e=a.a[c],f;for(f in e.l)if(!0===b(e.l[f],f))return}}function sa(a){for(var b=E.context,c=0,d=b.a.length;c<d&&!0!==a(b.a[c]);c++);}function G(a,b){for(var c=0,d=a.a.length;c<d;c++)if(a.a[c].l[b])return a.a[c];return null}
-function ta(a){for(var b=E.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].l[a];if(e)return e}return null}function ua(a){for(var b=E.context,c=[],d=0,e=b.a.length;d<e;d++){var f=b.a[d].l,g;for(g in f)a&&!a(f[g],b.a[d],g)||c.push(g)}return c}function H(a){for(var b=E.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].j[a];if(e)return e}return null}"undefined"!==typeof module&&(module.H.xb=oa);var ja=function(){function a(b,c,d){if(Array.isArray(c)){for(var e=0,f=0,g=c.length;f<g;f++){var h=a(b,c[f],d);if(1===h)return 1;e=Math.max(h,e)}return e}return(c=d?d(c):c)&&void 0!==b&&null!==b?b.length?-1===c.indexOf(b)?0:b.length/c.length:1:0}return{da:a}}();"undefined"!==typeof module&&(module.H.Cb=ja);var I={},J,va=[];function wa(){if(!c){for(var a=0,b=navigator.languages.length;a<b;a++)if(I.hasOwnProperty(navigator.languages[a])){var c=navigator.languages[a];break}c||(c="en")}J=I[c];console.log("Loading language pack: "+c);if(J.c)for(var d in J.c)if(c=document.getElementById(d))c.textContent=J.c[d];va.forEach(function(a){a()})};I.fr={qb:"Utilisateur inconnu",pb:"Channel inconnu",Ua:"Nouveau message",message:"Message",Ta:"Reseau",Va:"(visible seulement par vous)",G:"Favoris",l:"Discutions",Ya:"Discutions priv\u00e9es",$a:"Partage sa position GPS",ok:"Ok",Na:"Annuler",L:function(a){"string"!==typeof a&&(a=parseFloat(a));var b=new Date,c=new Date;a=new Date(a);b.setHours(0,0,0,0);c.setTime(b.getTime());c.setDate(c.getDate()-1);return a.getTime()>b.getTime()?a.toLocaleTimeString():a.getTime()>c.getTime()?"hier, "+a.toLocaleTimeString():
-a.toLocaleString()},qa:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Annuler",neterror:"Impossible de se connecter au chat !",ctxMenuSettings:"Configuration",settingTitle:"Configuration","setting-menu-services":"Services","settings-services-title":"Services","setting-menu-display":"Affichage","settings-display-title":"Affichage","setting-menu-privacy":"Vie priv\u00e9e","settings-privacy-title":"Vie priv\u00e9e",settingCommit:"Appliquer","settings-serviceAddButton":"Ajouter un service","settings-serviceListEmpty":"Vous n'avez pas encore ajout\u00e9 de service. Ajouter un service pour continuer.",
-"settings-serviceAddConfirm":"Suivant"}};I.fr.D=function(a){return"(edit&eacute; "+I.fr.L(a)+")"};I.fr.xa=function(a,b){return"par "+a.getName()+" le "+I.fr.L(b)};I.en={qb:"Unknown member",pb:"Unknown channel",Ua:"New message",message:"Message",Ta:"Network",Va:"(only visible to you)",G:"Starred",l:"Channels",Ya:"Direct messages",$a:"Share your GPS location",ok:"Ok",Na:"Cancel",L:function(a){"string"!==typeof a&&(a=parseFloat(a));var b=new Date,c=new Date;a=new Date(a);b.setHours(0,0,0,0);c.setTime(b.getTime());c.setDate(c.getDate()-1);return a.getTime()>b.getTime()?a.toLocaleTimeString():a.getTime()>c.getTime()?"yesterday, "+a.toLocaleTimeString():a.toLocaleString()},
-qa:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Cancel",neterror:"Cannot connect to chat !",ctxMenuSettings:"Settings",settingTitle:"Settings","setting-menu-services":"Services","settings-services-title":"Services","setting-menu-display":"Display","settings-display-title":"Display","setting-menu-privacy":"Privacy","settings-privacy-title":"Privacy",settingCommit:"Apply","settings-serviceAddButton":"Add a service","settings-serviceListEmpty":"You don't have any service yet. Please add a service to continue.",
-"settings-serviceAddConfirm":"Next"}};I.en.D=function(a){return"(edited "+I.en.L(a)+")"};I.en.xa=function(a,b){return"by "+a.getName()+" on "+I.en.L(b)};var xa=function(){function a(a){this.text="";this.g=a}function b(b,c,d){this.X=c;this.f=null;this.h=[];this.a=d||"";this.la="<"===this.a;this.va="*"===this.a;this.ka="_"===this.a;this.ma="~"===this.a||"-"===this.a;this.i=">"===this.a||"&gt;"===this.a;this.M=":"===this.a;this.ya="`"===this.a;this.Ja="```"===this.a;this.za="\n"===this.a;this.ja=void 0!==d&&-1!==m.A.indexOf(d);this.g=b;this.na=null;this.b=this.za||this.ja?c+d.length-1:!1;this.ja&&(this.f=new a(this),this.h.push(this.f),this.f.text=d)}
+y.prototype=Object.create(x.prototype);y.prototype.constructor=y;z.prototype=Object.create(x.prototype);z.prototype.constructor=z;"undefined"!==typeof module&&(module.H={yb:x,xb:y,Ab:z,Db:B});function ha(a){this.id=a;this.l={};this.V=this.R=null;this.version=0}
+ha.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.Oa=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.goal&&(this.ib=a.goal);void 0!==a.phone&&(this.ob=a.phone);void 0!==a.first_name&&(this.Qa=a.first_name);void 0!==a.last_name&&(this.Ua=a.last_name);void 0!==a.real_name&&(this.ab=a.real_name);void 0!==a.isPresent&&(this.wa=a.isPresent);a.isBot&&(this.kb=a.isBot);this.version=Math.max(this.version,b)};
+ha.prototype.getName=function(){return this.name||this.ab||this.Qa||this.Ua};"undefined"!==typeof module&&(module.H.vb=ha);function oa(){this.a=[]}oa.prototype.push=function(a){this.a.push(a)};function pa(a,b){for(var c=0,d=a.a.length;c<d;c++)if(b===qa(a.a[c]))return a.a[c];return null}function ra(a,b){for(var c=0,d=a.a.length;c<d;c++){var e=a.a[c],f;for(f in e.l)if(!0===b(e.l[f],f))return}}function sa(a){for(var b=E.context,c=0,d=b.a.length;c<d&&!0!==a(b.a[c]);c++);}function G(a,b){for(var c=0,d=a.a.length;c<d;c++)if(a.a[c].l[b])return a.a[c];return null}
+function ta(a){for(var b=E.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].l[a];if(e)return e}return null}function ua(a){for(var b=E.context,c=[],d=0,e=b.a.length;d<e;d++){var f=b.a[d].l,g;for(g in f)a&&!a(f[g],b.a[d],g)||c.push(g)}return c}function H(a){for(var b=E.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].j[a];if(e)return e}return null}"undefined"!==typeof module&&(module.H.zb=oa);var ja=function(){function a(b,c,d){if(Array.isArray(c)){for(var e=0,f=0,g=c.length;f<g;f++){var h=a(b,c[f],d);if(1===h)return 1;e=Math.max(h,e)}return e}return(c=d?d(c):c)&&void 0!==b&&null!==b?b.length?-1===c.indexOf(b)?0:b.length/c.length:1:0}return{ea:a}}();"undefined"!==typeof module&&(module.H.Eb=ja);var I={},J,va=[];function wa(){if(!c){for(var a=0,b=navigator.languages.length;a<b;a++)if(I.hasOwnProperty(navigator.languages[a])){var c=navigator.languages[a];break}c||(c="en")}J=I[c];console.log("Loading language pack: "+c);if(J.c)for(var d in J.c)if(c=document.getElementById(d))c.textContent=J.c[d];va.forEach(function(a){a()})};I.fr={sb:"Utilisateur inconnu",rb:"Channel inconnu",Wa:"Nouveau message",message:"Message",Va:"Reseau",Xa:"(visible seulement par vous)",A:"Favoris",l:"Discutions",$a:"Discutions priv\u00e9es",bb:"Partage sa position GPS",ok:"Ok",Pa:"Annuler",L:function(a){"string"!==typeof a&&(a=parseFloat(a));var b=new Date,c=new Date;a=new Date(a);b.setHours(0,0,0,0);c.setTime(b.getTime());c.setDate(c.getDate()-1);return a.getTime()>b.getTime()?a.toLocaleTimeString():a.getTime()>c.getTime()?"hier, "+a.toLocaleTimeString():
+a.toLocaleString()},sa:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Annuler",neterror:"Impossible de se connecter au chat !",ctxMenuSettings:"Configuration",settingTitle:"Configuration","setting-menu-services":"Services","settings-services-title":"Services","setting-menu-display":"Affichage","settings-display-title":"Affichage","setting-menu-privacy":"Vie priv\u00e9e","settings-privacy-title":"Vie priv\u00e9e",settingCommit:"Appliquer","settings-serviceAddButton":"Ajouter un service","settings-serviceListEmpty":"Vous n'avez pas encore ajout\u00e9 de service. Ajouter un service pour continuer.",
+"settings-serviceAddConfirm":"Suivant"}};I.fr.F=function(a){return"(edit&eacute; "+I.fr.L(a)+")"};I.fr.za=function(a,b){return"par "+a.getName()+" le "+I.fr.L(b)};I.en={sb:"Unknown member",rb:"Unknown channel",Wa:"New message",message:"Message",Va:"Network",Xa:"(only visible to you)",A:"Starred",l:"Channels",$a:"Direct messages",bb:"Share your GPS location",ok:"Ok",Pa:"Cancel",L:function(a){"string"!==typeof a&&(a=parseFloat(a));var b=new Date,c=new Date;a=new Date(a);b.setHours(0,0,0,0);c.setTime(b.getTime());c.setDate(c.getDate()-1);return a.getTime()>b.getTime()?a.toLocaleTimeString():a.getTime()>c.getTime()?"yesterday, "+a.toLocaleTimeString():a.toLocaleString()},
+sa:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Cancel",neterror:"Cannot connect to chat !",ctxMenuSettings:"Settings",settingTitle:"Settings","setting-menu-services":"Services","settings-services-title":"Services","setting-menu-display":"Display","settings-display-title":"Display","setting-menu-privacy":"Privacy","settings-privacy-title":"Privacy",settingCommit:"Apply","settings-serviceAddButton":"Add a service","settings-serviceListEmpty":"You don't have any service yet. Please add a service to continue.",
+"settings-serviceAddConfirm":"Next"}};I.en.F=function(a){return"(edited "+I.en.L(a)+")"};I.en.za=function(a,b){return"by "+a.getName()+" on "+I.en.L(b)};var xa=function(){function a(a){this.text="";this.g=a}function b(b,c,d){this.X=c;this.f=null;this.h=[];this.a=d||"";this.na="<"===this.a;this.xa="*"===this.a;this.ma="_"===this.a;this.oa="~"===this.a||"-"===this.a;this.i=">"===this.a||"&gt;"===this.a;this.M=":"===this.a;this.Aa="`"===this.a;this.La="```"===this.a;this.Ba="\n"===this.a;this.la=void 0!==d&&-1!==m.B.indexOf(d);this.g=b;this.pa=null;this.b=this.Ba||this.la?c+d.length-1:!1;this.la&&(this.f=new a(this),this.h.push(this.f),this.f.text=d)}
 function c(a){return"A"<=a&&"Z">=a||"a"<=a&&"z">=a||"0"<=a&&"9">=a||-1!=="\u00e0\u00e8\u00ec\u00f2\u00f9\u00c0\u00c8\u00cc\u00d2\u00d9\u00e1\u00e9\u00ed\u00f3\u00fa\u00fd\u00c1\u00c9\u00cd\u00d3\u00da\u00dd\u00e2\u00ea\u00ee\u00f4\u00fb\u00c2\u00ca\u00ce\u00d4\u00db\u00e3\u00f1\u00f5\u00c3\u00d1\u00d5\u00e4\u00eb\u00ef\u00f6\u00fc\u00ff\u00c4\u00cb\u00cf\u00d6\u00dc\u0178\u00e7\u00c7\u00df\u00d8\u00f8\u00c5\u00e5\u00c6\u00e6\u0153".indexOf(a)}function d(a){a=a||n;for(var c=0,e=a.h.length;c<e;c++){var l=
-a.h[c];if(l instanceof b)if(l.b){if(l=d(l))return l}else return l}return null}function e(a,c){a.g instanceof b&&(a.g.h.splice(a.g.h.indexOf(a)+(c?1:0)),a.g.f=a.g.h[a.g.h.length-1],e(a.g,!0))}function f(a){return a}function g(a){return{link:a,text:a,Qa:!1}}var h,n,m={A:[],Y:f,ha:f,ea:g};b.prototype.Ba=function(){return this.va&&!!this.b||this.g instanceof b&&this.g.Ba()};b.prototype.Ea=function(){return this.ka&&!!this.b||this.g instanceof b&&this.g.Ea()};b.prototype.Fa=function(){return this.ma&&
-!!this.b||this.g instanceof b&&this.g.Fa()};b.prototype.sa=function(){return this.M&&!!this.b||this.g instanceof b&&this.g.sa()};b.prototype.Da=function(){return this.ja&&!!this.b||this.g instanceof b&&this.g.Da()};b.prototype.Ca=function(){return this.ya&&!!this.b||this.g instanceof b&&this.g.Ca()};b.prototype.$=function(){return this.Ja&&!!this.b||this.g instanceof b&&this.g.$()};b.prototype.Ga=function(){for(var a=0,c=this.h.length;a<c;a++)if(this.h[a]instanceof b&&(!this.h[a].b||this.h[a].Ga()))return!0;
-return!1};b.prototype.Ha=function(a){if("<"===this.a&&">"===h[a])return!0;var b=c(h[a-1]);if(!this.i&&h.substr(a,this.a.length)===this.a){if(!b&&(this.va||this.ka||this.ma))return!1;if(this.f&&this.Ga())return this.f.Ka();if(this.bb())return!0}return"\n"===h[a]&&this.i?!0:!1};b.prototype.bb=function(){for(var a=this;a;){for(var c=0,d=a.h.length;c<d;c++)if(a.h[c]instanceof b||a.h[c].text.length)return!0;a=a.na}return!1};b.prototype.Ka=function(){var a=new b(this.g,this.X,this.a);a.na=this;this.f&&
-this.f instanceof b&&(a.f=this.f.Ka(),a.h=[a.f]);return a};b.prototype.cb=function(a){return this.M&&(" "===h[a]||"\t"===h[a])||(this.M||this.la||this.va||this.ka||this.ma||this.ya)&&"\n"===h[a]?!1:!0};b.prototype.eb=function(b){if(this.ya||this.M||this.Ja||this.la)return null;if(!this.f||this.f.b||this.f instanceof a){var d=c(h[b-1]),e=c(h[b+1]);if("```"===h.substr(b,3))return"```";var f=n.ta();if(void 0===f||f){if("&gt;"===h.substr(b,4))return"&gt;";if(">"===h[b])return h[b]}if("`"===h[b]&&!d||
-"\n"===h[b]||!(-1===["*","~","-","_"].indexOf(h[b])||!e&&void 0!==h[b+1]&&-1==="*~-_<&".split("").indexOf(h[b+1])||d&&void 0!==h[b-1]&&-1==="*~-_<&".split("").indexOf(h[b-1]))||-1!==[":"].indexOf(h[b])&&e||-1!==["<"].indexOf(h[b]))return h[b];d=0;for(e=m.A.length;d<e;d++)if(f=m.A[d],h.substr(b,f.length)===f)return f}return null};a.prototype.ta=function(){if(""!==this.text.trim())return!1};b.prototype.ta=function(){for(var a=this.h.length-1;0<=a;a--){var b=this.h[a].ta();if(void 0!==b)return b}if(this.za||
-this.i)return!0};a.prototype.o=function(a){this.text+=h[a];return 1};b.prototype.o=function(c){var d=this.f&&!this.f.b&&this.f.Ha?this.f.Ha(c):null;if(d){var e=this.f.a.length;this.f.Aa(c);d instanceof b&&(this.f=d,this.h.push(d));return e}if(!this.f||this.f.b||this.f instanceof a||this.f.cb(c)){if(d=this.eb(c))return this.f=new b(this,c,d),this.h.push(this.f),this.f.a.length;if(!this.f||this.f.b)this.f=new a(this),this.h.push(this.f);return this.f.o(c)}d=this.f.X+1;n.Z(this.f.X);this.f=new a(this);
-this.f.o(d-1);this.h.pop();this.h.push(this.f);return d-c};b.prototype.Aa=function(a){for(var b=this;b;)b.b=a,b=b.na};b.prototype.Z=function(a){this.b&&this.b>=a&&(this.b=!1);this.h.forEach(function(c){c instanceof b&&c.Z(a)})};a.prototype.innerHTML=function(){if(this.g.sa()){for(var a=this.g;a&&!a.M;)a=a.g;if(a){var a=a.a+this.text+a.a,b=m.Y(a);return b?b:a}return(a=m.Y(this.text))?a:this.text}if(this.g.$()){if("undefined"!==typeof hljs)try{return a=this.text.match(/^\w+/),hljs.configure({useBR:!0,
-tabReplace:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"}),a&&hljs.getLanguage(a[0])?hljs.fixMarkup(hljs.highlight(a[0],this.text.substr(a[0].length)).value):hljs.fixMarkup(hljs.highlightAuto(this.text).value)}catch(p){console.error(p)}return this.text.replace(/\n/g,"<br/>")}return m.ha(this.text)};a.prototype.outerHTML=function(){var a="span",b=[],c="";if(this.g.$()){a="pre";b.push("codeblock");var d=this.innerHTML()}else this.g.Ca()?(b.push("code"),d=this.innerHTML()):(this.g.la&&(d=m.ea(this.text))?(a=
-"a",c=' href="'+d.link+'"',d.Qa||(c+=' target="_blank"'),d=m.ha(d.text)):d=this.innerHTML(),this.g.Ba()&&b.push("bold"),this.g.Ea()&&b.push("italic"),this.g.Fa()&&b.push("strike"),this.g.sa()&&b.push("emoji"),this.g.Da()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+"</"+a+">"};b.prototype.outerHTML=function(){var a="";this.i&&(a+='<span class="quote">');this.za&&(a+="<br/>");this.h.forEach(function(b){a+=b.outerHTML()});this.i&&(a+="</span>");return a};b.prototype.Ia=
-function(a){this.i&&!this.b&&this.Aa(a);this.h.forEach(function(c){c instanceof b&&c.Ia(a)})};return function(c,k){k||(k={});m.A=k.A||[];m.Y=k.Y||f;m.ha=k.ha||f;m.ea=k.ea||g;h=c;n=new b(this,0);k=0;c=h.length;do{for(;k<c;)k+=n.o(k);n.Ia(h.length);if(k=d()){e(k,!1);n.Z(k.X);var l=new a(k.g);l.o(k.X);k.g.h.push(l);k.g.f=l;k=k.X+1}else k=void 0}while(void 0!==k);return n.outerHTML()}}();"undefined"!==typeof module&&(module.H.w=xa);function ya(a,b){this.i=a;this.content=b;this.c=za(this);this.b=Aa(this);this.a=[];this.o=[]}
+a.h[c];if(l instanceof b)if(l.b){if(l=d(l))return l}else return l}return null}function e(a,c){a.g instanceof b&&(a.g.h.splice(a.g.h.indexOf(a)+(c?1:0)),a.g.f=a.g.h[a.g.h.length-1],e(a.g,!0))}function f(a){return a}function g(a){return{link:a,text:a,Sa:!1}}var h,n,m={B:[],Z:f,ja:f,ga:g};b.prototype.Da=function(){return this.xa&&!!this.b||this.g instanceof b&&this.g.Da()};b.prototype.Ga=function(){return this.ma&&!!this.b||this.g instanceof b&&this.g.Ga()};b.prototype.Ha=function(){return this.oa&&
+!!this.b||this.g instanceof b&&this.g.Ha()};b.prototype.ua=function(){return this.M&&!!this.b||this.g instanceof b&&this.g.ua()};b.prototype.Fa=function(){return this.la&&!!this.b||this.g instanceof b&&this.g.Fa()};b.prototype.Ea=function(){return this.Aa&&!!this.b||this.g instanceof b&&this.g.Ea()};b.prototype.ba=function(){return this.La&&!!this.b||this.g instanceof b&&this.g.ba()};b.prototype.Ia=function(){for(var a=0,c=this.h.length;a<c;a++)if(this.h[a]instanceof b&&(!this.h[a].b||this.h[a].Ia()))return!0;
+return!1};b.prototype.Ja=function(a){if("<"===this.a&&">"===h[a])return!0;var b=c(h[a-1]);if(!this.i&&h.substr(a,this.a.length)===this.a){if(!b&&(this.xa||this.ma||this.oa))return!1;if(this.f&&this.Ia())return this.f.Ma();if(this.eb())return!0}return"\n"===h[a]&&this.i?!0:!1};b.prototype.eb=function(){for(var a=this;a;){for(var c=0,d=a.h.length;c<d;c++)if(a.h[c]instanceof b||a.h[c].text.length)return!0;a=a.pa}return!1};b.prototype.Ma=function(){var a=new b(this.g,this.X,this.a);a.pa=this;this.f&&
+this.f instanceof b&&(a.f=this.f.Ma(),a.h=[a.f]);return a};b.prototype.fb=function(a){return this.M&&(" "===h[a]||"\t"===h[a])||(this.M||this.na||this.xa||this.ma||this.oa||this.Aa)&&"\n"===h[a]?!1:!0};b.prototype.gb=function(b){if(this.Aa||this.M||this.La||this.na)return null;if(!this.f||this.f.b||this.f instanceof a){var d=c(h[b-1]),e=c(h[b+1]);if("```"===h.substr(b,3))return"```";var f=n.va();if(void 0===f||f){if("&gt;"===h.substr(b,4))return"&gt;";if(">"===h[b])return h[b]}if("`"===h[b]&&!d||
+"\n"===h[b]||!(-1===["*","~","-","_"].indexOf(h[b])||!e&&void 0!==h[b+1]&&-1==="*~-_<&".split("").indexOf(h[b+1])||d&&void 0!==h[b-1]&&-1==="*~-_<&".split("").indexOf(h[b-1]))||-1!==[":"].indexOf(h[b])&&e||-1!==["<"].indexOf(h[b]))return h[b];d=0;for(e=m.B.length;d<e;d++)if(f=m.B[d],h.substr(b,f.length)===f)return f}return null};a.prototype.va=function(){if(""!==this.text.trim())return!1};b.prototype.va=function(){for(var a=this.h.length-1;0<=a;a--){var b=this.h[a].va();if(void 0!==b)return b}if(this.Ba||
+this.i)return!0};a.prototype.o=function(a){this.text+=h[a];return 1};b.prototype.o=function(c){var d=this.f&&!this.f.b&&this.f.Ja?this.f.Ja(c):null;if(d){var e=this.f.a.length;this.f.Ca(c);d instanceof b&&(this.f=d,this.h.push(d));return e}if(!this.f||this.f.b||this.f instanceof a||this.f.fb(c)){if(d=this.gb(c))return this.f=new b(this,c,d),this.h.push(this.f),this.f.a.length;if(!this.f||this.f.b)this.f=new a(this),this.h.push(this.f);return this.f.o(c)}d=this.f.X+1;n.$(this.f.X);this.f=new a(this);
+this.f.o(d-1);this.h.pop();this.h.push(this.f);return d-c};b.prototype.Ca=function(a){for(var b=this;b;)b.b=a,b=b.pa};b.prototype.$=function(a){this.b&&this.b>=a&&(this.b=!1);this.h.forEach(function(c){c instanceof b&&c.$(a)})};a.prototype.innerHTML=function(){if(this.g.ua()){for(var a=this.g;a&&!a.M;)a=a.g;if(a){var a=a.a+this.text+a.a,b=m.Z(a);return b?b:a}return(a=m.Z(this.text))?a:this.text}if(this.g.ba()){if("undefined"!==typeof hljs)try{return a=this.text.match(/^\w+/),hljs.configure({useBR:!0,
+tabReplace:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"}),a&&hljs.getLanguage(a[0])?hljs.fixMarkup(hljs.highlight(a[0],this.text.substr(a[0].length)).value):hljs.fixMarkup(hljs.highlightAuto(this.text).value)}catch(q){console.error(q)}return this.text.replace(/\n/g,"<br/>")}return m.ja(this.text)};a.prototype.outerHTML=function(){var a="span",b=[],c="";if(this.g.ba()){a="pre";b.push("codeblock");var d=this.innerHTML()}else this.g.Ea()?(b.push("code"),d=this.innerHTML()):(this.g.na&&(d=m.ga(this.text))?
+(a="a",c=' href="'+d.link+'"',d.Sa||(c+=' target="_blank"'),d=m.ja(d.text)):d=this.innerHTML(),this.g.Da()&&b.push("bold"),this.g.Ga()&&b.push("italic"),this.g.Ha()&&b.push("strike"),this.g.ua()&&b.push("emoji"),this.g.Fa()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+"</"+a+">"};b.prototype.outerHTML=function(){var a="";this.i&&(a+='<span class="quote">');this.Ba&&(a+="<br/>");this.h.forEach(function(b){a+=b.outerHTML()});this.i&&(a+="</span>");return a};b.prototype.Ka=
+function(a){this.i&&!this.b&&this.Ca(a);this.h.forEach(function(c){c instanceof b&&c.Ka(a)})};return function(c,k){k||(k={});m.B=k.B||[];m.Z=k.Z||f;m.ja=k.ja||f;m.ga=k.ga||g;h=c;n=new b(this,0);k=0;c=h.length;do{for(;k<c;)k+=n.o(k);n.Ka(h.length);if(k=d()){e(k,!1);n.$(k.X);var l=new a(k.g);l.o(k.X);k.g.h.push(l);k.g.f=l;k=k.X+1}else k=void 0}while(void 0!==k);return n.outerHTML()}}();"undefined"!==typeof module&&(module.H.w=xa);function ya(a,b){this.i=a;this.content=b;this.c=za(this);this.b=Aa(this);this.a=[];this.o=[]}
 function za(a){var b=document.createElement("div"),c=document.createElement("header"),d=document.createElement("span"),e=document.createElement("span"),f=document.createElement("div"),g=document.createElement("footer");b.a=document.createElement("span");b.b=document.createElement("span");d.textContent=a.i;"string"==typeof a.content?f.innerHTML=a.content:f.appendChild(a.content);c.className=Ba;d.className=Ca;e.className=Da;e.textContent="x";c.appendChild(d);c.appendChild(e);b.appendChild(c);f.className=
-Ea;b.appendChild(f);b.b.className=Fa;b.b.textContent=J.Na;b.b.addEventListener("click",function(){Ga(a,!1)});e.addEventListener("click",function(){Ga(a,!1)});b.a.addEventListener("click",function(){Ga(a,!0)});g.appendChild(b.b);b.a.className=Fa;b.a.textContent=J.ok;g.appendChild(b.a);g.className=Ha+" "+Ia;b.appendChild(g);b.className=Ja;return b}function Ga(a,b){(b?a.a:a.o).forEach(function(a){a()});a.close()}
-function Aa(a){var b=document.createElement("div");b.className=Ka;b.addEventListener("click",function(){Ga(this,!1)}.bind(a));return b}function La(a,b,c){a.c.a.textContent=b;a.c.b.textContent=c;return a}ya.prototype.ga=function(a){a=a||document.body;a.appendChild(this.b);a.appendChild(this.c);return this};ya.prototype.close=function(){this.c.remove();this.b.remove();return this};function Ma(a,b){a.a.push(b);return a};var Fa="button",Ha="button-container",Ja="dialog",Ka="dialog-overlay",Ba="dialog-title",Ca="dialog-title-label",Da="dialog-title-close",Ea="dialog-body",Ia="dialog-footer";var Na=[],Oa=0;
-function Pa(){var a=document.createDocumentFragment(),b=ua(function(a){return!a.aa&&!1!==a.M}),c=[],d=[],e=[],f=[],g={};b.sort(function(a,b){if(a[0]!==b[0])return a[0]-b[0];var c=G(E.context,a),d=G(E.context,b);a=c.l[a];b=d.l[b];return a.name===b.name?(g[a.id]=J.qa(c.a.name,a.name),g[b.id]=J.qa(d.a.name,b.name),c.a.name.localeCompare(d.a.name)):a.name.localeCompare(b.name)});b.forEach(function(a){a=ta(a);if(a instanceof t){var b;if(b=!a.a.Ma){var h=g[a.id];b=document.createElement("li");var l=document.createElement("a");
-b.id="room_"+a.id;l.href="#"+a.id;b.className="chat-context-room chat-ims presence-indicator";l.textContent=h||a.a.getName();b.appendChild(Qa());b.appendChild(l);a.a.ua||b.classList.add("presence-away");K===a&&b.classList.add("selected");a.P>a.B&&(b.classList.add("unread"),b.classList.add("unreadHi"));b=h=b}b&&(a.G?c.push(h):f.push(h))}else if(h=g[a.id],b=document.createElement("li"),l=document.createElement("a"),b.id="room_"+a.id,l.href="#"+a.id,a.b?(b.className="chat-context-room chat-group",b.dataset.count=
-Object.keys(a.j||{}).length):b.className="chat-context-room chat-channel",K===a&&b.classList.add("selected"),l.textContent=h||a.name,b.appendChild(Qa()),b.appendChild(l),a.P>a.B&&(b.classList.add("unread"),0<=L.indexOf(a)&&b.classList.add("unreadHi")),h=b)a.G?c.push(h):a.b?e.push(h):d.push(h)});c.length&&a.appendChild(Ra(J.G));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(Ra(J.l));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});f.length&&a.appendChild(Ra(J.Ya));
+Ea;b.appendChild(f);b.b.className=Fa;b.b.textContent=J.Pa;b.b.addEventListener("click",function(){Ga(a,!1)});e.addEventListener("click",function(){Ga(a,!1)});b.a.addEventListener("click",function(){Ga(a,!0)});g.appendChild(b.b);b.a.className=Fa;b.a.textContent=J.ok;g.appendChild(b.a);g.className=Ha+" "+Ia;b.appendChild(g);b.className=Ja;return b}function Ga(a,b){(b?a.a:a.o).forEach(function(a){a()});a.close()}
+function Aa(a){var b=document.createElement("div");b.className=Ka;b.addEventListener("click",function(){Ga(this,!1)}.bind(a));return b}function La(a,b,c){a.c.a.textContent=b;a.c.b.textContent=c;return a}ya.prototype.ia=function(a){a=a||document.body;a.appendChild(this.b);a.appendChild(this.c);return this};ya.prototype.close=function(){this.c.remove();this.b.remove();return this};function Ma(a,b){a.a.push(b);return a};var Fa="button",Ha="button-container",Ja="dialog",Ka="dialog-overlay",Ba="dialog-title",Ca="dialog-title-label",Da="dialog-title-close",Ea="dialog-body",Ia="dialog-footer";var Na=[],Oa=0;
+function Pa(){var a=document.createDocumentFragment(),b=ua(function(a){return!a.ca&&!1!==a.M}),c=[],d=[],e=[],f=[],g={};b.sort(function(a,b){if(a[0]!==b[0])return a[0]-b[0];var c=G(E.context,a),d=G(E.context,b);a=c.l[a];b=d.l[b];return a.name===b.name?(g[a.id]=J.sa(c.a.name,a.name),g[b.id]=J.sa(d.a.name,b.name),c.a.name.localeCompare(d.a.name)):a.name.localeCompare(b.name)});b.forEach(function(a){a=ta(a);if(a instanceof t){var b;if(b=!a.a.Oa){var h=g[a.id];b=document.createElement("li");var l=document.createElement("a");
+b.id="room_"+a.id;l.href="#"+a.id;b.className="chat-context-room chat-ims presence-indicator";l.textContent=h||a.a.getName();b.appendChild(Qa());b.appendChild(l);a.a.wa||b.classList.add("presence-away");K===a&&b.classList.add("selected");a.P>a.C&&(b.classList.add("unread"),b.classList.add("unreadHi"));b=h=b}b&&(a.A?c.push(h):f.push(h))}else if(h=g[a.id],b=document.createElement("li"),l=document.createElement("a"),b.id="room_"+a.id,l.href="#"+a.id,a.b?(b.className="chat-context-room chat-group",b.dataset.count=
+Object.keys(a.j||{}).length):b.className="chat-context-room chat-channel",K===a&&b.classList.add("selected"),l.textContent=h||a.name,b.appendChild(Qa()),b.appendChild(l),a.P>a.C&&(b.classList.add("unread"),0<=L.indexOf(a)&&b.classList.add("unreadHi")),h=b)a.A?c.push(h):a.b?e.push(h):d.push(h)});c.length&&a.appendChild(Ra(J.A));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(Ra(J.l));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});f.length&&a.appendChild(Ra(J.$a));
 f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);Sa.apply(document.getElementById("chanSearch"));Ta();P();Q&&Ua(Q.a.id,Q.j,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"})}
-function Va(){sa(function(a){var b=a.u,c;for(c in a.self.l)if(!a.self.l[c].aa){var d=document.getElementById("room_"+c);b[c]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing")}for(var e in a.j)(c=a.j[e].V)&&!c.aa&&(d=document.getElementById("room_"+c.id))&&(b[c.id]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing"))});Wa()}
+function Va(){sa(function(a){var b=a.u,c;for(c in a.self.l)if(!a.self.l[c].ca){var d=document.getElementById("room_"+c);b[c]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing")}for(var e in a.j)(c=a.j[e].V)&&!c.ca&&(d=document.getElementById("room_"+c.id))&&(b[c.id]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing"))});Wa()}
 function Wa(){var a;document.getElementById("whoistyping").textContent="";if(Q&&K&&(a=Q.u[K.id])){var b=document.createDocumentFragment(),c=!1,d;for(d in a)(a=H(d))?b.appendChild(Xa(a)):c=!0;c&&(E.b=0);document.getElementById("whoistyping").appendChild(b)}}function Ya(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");P()}
-function Za(){var a=K.name||(K.a?K.a.getName():void 0);if(!a){var b=[];K.j.forEach(function(a){b.push(a.getName())});a=b.join(", ")}document.getElementById("currentRoomTitle").textContent=a;R();S();document.getElementById("fileUploadContainer").classList.add("hidden");$a();T&&(T=null,U());V&&(V=null,U());P();Wa()}
+function Za(){var a=K.name||(K.a?K.a.getName():void 0);if(!a){console.error("No name provided for ",K);var a=[],b;for(b in K.j)a.push(K.j[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;R();S();document.getElementById("fileUploadContainer").classList.add("hidden");$a();T&&(T=null,U());V&&(V=null,U());P();Wa()}
 function U(){if(T){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){T=null;U()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(T.K())}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";S()}
 function ab(){if(V){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){V=null;ab()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(V.K());document.getElementById("msgInput").value=V.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";S()}
-window.toggleReaction=function(a,b,c){var d=E.a[a],e,f;(d=E.a[a])&&(e=na(d,b))&&(f=G(E.context,a))&&(e.C[c]&&-1!==e.C[c].indexOf(f.self.id)?(d=new XMLHttpRequest,d.open("DELETE","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c),!0),d.send(null)):bb(a,b,c))};
+window.toggleReaction=function(a,b,c){var d=E.a[a],e,f;(d=E.a[a])&&(e=na(d,b))&&(f=G(E.context,a))&&(e.D[c]&&-1!==e.D[c].indexOf(f.self.id)?(d=new XMLHttpRequest,d.open("DELETE","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c),!0),d.send(null)):bb(a,b,c))};
 function cb(a){a:{var b={};if(Q)for(var c=Q;!b[a];){if(c=c.b.data[a])if("alias:"==c.substr(0,6))b[a]=!0,a=c.substr(6);else{a=document.createElement("span");a.className="emoji-custom emoji";a.style.backgroundImage="url('"+c+"')";break a}break}}"string"===typeof a&&"makeEmoji"in window&&(a=window.makeEmoji(a));return"string"===typeof a?null:a}function db(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}
-function P(){var a=L.length,b="";if(W)b="!"+J.Ta+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",db(a,a);else{var c=0;ra(E.context,function(a){a.P>a.B&&c++});c&&(b="("+c+")");db(0,c)}!b.length&&K&&(b=K.name);document.title=b.length?b:"Mimouchat"}
-function eb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(Oa+3E4<a){var b=new Notification(J.Ua);Oa=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}
-function R(){var a=document.createDocumentFragment(),b=K.id,c=null,d=0,e=null,f;K.G?document.getElementById("chatSystemContainer").classList.add("starred"):document.getElementById("chatSystemContainer").classList.remove("starred");Na=[];E.a[b]&&E.a[b].a.forEach(function(b){if(b.i)b.W();else{var g=b.N(),n=!1;c&&c.J===b.J&&b.J?30>Math.abs(d-b.m)&&!(b instanceof y)?e.classList.add("chatmsg-same-ts"):d=b.m:(d=b.m,n=!0);(!c||c.m<=K.B)&&b.m>K.B?g.classList.add("chatmsg-first-unread"):g.classList.remove("chatmsg-first-unread");
-if(b instanceof y)e=c=null,d=0,a.appendChild(g),f=null;else{if(n||!f){var n=H(b.J),m=b.username,l=document.createElement("div"),k=document.createElement("div"),p=document.createElement("a"),u=document.createElement("img");l.ba=document.createElement("span");l.ba.className="chatmsg-author-img-wrapper";u.className="chatmsg-author-img";p.className="chatmsg-author-name";p.href="#"+n.id;n?(p.textContent=n.getName(),u.src="api/avatar?user="+n.id):(p.textContent=m||"?",u.src="");l.ba.appendChild(u);k.appendChild(l.ba);
-k.appendChild(p);k.className="chatmsg-author";l.className="chatmsg-authorGroup";l.appendChild(k);l.content=document.createElement("div");l.content.className="chatmsg-author-messages";l.appendChild(l.content);f=l;Na.push(f);a.appendChild(f)}c=b;e=g;f.content.appendChild(g)}}});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;fb();window.hasFocus&&$a()}
-function gb(a,b){if(a.classList.contains("chatmsg-hover-reply"))V&&(V=null,ab()),T!==b&&(T=b,U());else if(a.classList.contains("chatmsg-hover-reaction")){var c=K.id,d=b.id;hb.ga(document.body,Q,function(a){a&&bb(c,d,a)})}else a.classList.contains("chatmsg-hover-edit")?(T&&(T=null,U()),V!==b&&(V=b,ab())):a.classList.contains("chatmsg-hover-star")||a.classList.contains("chatmsg-hover-pin")||!a.classList.contains("chatmsg-hover-remove")||(T&&(T=null,U()),V&&(V=null,ab()),ib(b))}
-function jb(a){function b(a,b){for(b=b||a.target;b!==a.currentTarget&&b;){if(b.id&&b.classList.contains("chatmsg-item"))return b.id;b=b.parentElement}}for(var c=a.target;c!==a.currentTarget&&c&&!c.classList.contains("chatmsg-hover");){var d;if(c.parentElement&&c.classList.contains("chatmsg-attachment-actions-item")){var e=c.dataset.attachmentIndex,f=c.dataset.actionIndex;if((d=b(a,c))&&void 0!==e&&void 0!==f){d=d.substr(d.lastIndexOf("_")+1);(a=na(E.a[K.id],d))&&a.s[e]&&a.s[e].actions&&a.s[e].actions[f]&&
-kb(a,a.s[e],a.s[e].actions[f]);break}}if(c.parentElement&&c.parentElement.classList.contains("chatmsg-hover")){if(d=b(a,c))d=d.substr(d.lastIndexOf("_")+1),(a=na(E.a[K.id],d))&&gb(c,a);break}c=c.parentElement}}
-function kb(a,b,c){function d(){var d={actions:[c],attachment_id:b.id,callback_id:b.callback_id,channel_id:e,is_ephemeral:a instanceof z,message_ts:a.id},g=new XMLHttpRequest;g.open("POST","api/attachmentAction?serviceId="+a.J);g.send(JSON.stringify(d))}var e=K.id;c.confirm?Ma(La(new ya(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).ga():d()}function S(){document.getElementById("msgInput").focus()}
-function fb(){var a=document.getElementById("chatWindow").getBoundingClientRect().top;Na.forEach(function(b){var c=b.ba,d=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-d-d/2))+"px"})}
-document.addEventListener("DOMContentLoaded",function(){wa();lb();var a=document.getElementById("chanSearch");a.addEventListener("input",Sa);a.addEventListener("blur",Sa);document.getElementById("chatWindow").addEventListener("click",jb);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&Ta()});document.addEventListener("mouseover",function(a){for(a=a.target;a&&a!==this;){if("A"===a.nodeName){var b=a.href,c=b.indexOf("#");if(0<=c){b=b.substr(c+
-1);if(c=G(E.context,b)){X.Wa(c,c.l[b]).show(a);return}a:{for(var c=E.context,f=0,g=c.a.length;f<g;f++)if(c.a[f].j[b]){c=c.a[f];break a}c=null}if(c&&(b=c.j[b].V)){X.Wa(c,b).show(a);return}}break}a=a.parentElement}X.ra()});document.addEventListener("mouseleave",function(){X.ra()});document.getElementById("currentRoomStar").addEventListener("click",function(a){a.preventDefault();K&&(K.G?(a=new XMLHttpRequest,a.open("POST","api/unstarChannel?room="+K.id,!0)):(a=new XMLHttpRequest,a.open("POST","api/starChannel?room="+
-K.id,!0)),a.send(null));return!1});document.getElementById("fileUploadCancel").addEventListener("click",function(a){a.preventDefault();document.getElementById("fileUploadError").classList.add("hidden");document.getElementById("fileUploadContainer").classList.add("hidden");document.getElementById("fileUploadInput").value="";return!1});document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();mb.display()});document.getElementById("fileUploadForm").addEventListener("submit",
-function(a){a.preventDefault();a=document.getElementById("fileUploadInput");var b=a.value;b&&(b=b.substr(b.lastIndexOf("\\")+1),nb(b,a.files[0],function(a){var b=document.getElementById("fileUploadError");a?(b.textContent=a,b.classList.remove("hidden")):(b.classList.add("hidden"),document.getElementById("fileUploadInput").value="",document.getElementById("fileUploadContainer").classList.add("hidden"))}));return!1});document.getElementById("attachFile").addEventListener("click",function(a){a.preventDefault();
-K&&document.getElementById("fileUploadContainer").classList.remove("hidden");return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();a=document.getElementById("msgInput");K&&a.value&&ob(a.value)&&(a.value="",T&&(T=null,U()),V&&(V=null,U()),document.getElementById("slashList").textContent="");S();return!1});window.addEventListener("blur",function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;Oa=0;K&&$a();S()});document.getElementById("chatWindow").addEventListener("scroll",
-fb);var b=0;document.getElementById("msgInput").addEventListener("input",function(){if(K){var a=Date.now();b+3E3<a&&(Q.self.ua||K instanceof t)&&(pb(),b=a);var a=[],d=this.value;if("/"===this.value[0]){var e=d.indexOf(" "),f=-1!==e,e=-1===e?d.length:e,d=d.substr(0,e);if(f){var g=qb.Pa(d);g&&a.push(g)}else a=qb.fb(d);var g=Q?Q.i.data:{};for(n in g){var h=g[n];(!f&&h.name.substr(0,e)===d||f&&h.name===d)&&a.push(h)}}a.sort(function(a,b){return a.U.localeCompare(b.U)||a.name.localeCompare(b.name)});var n=
-document.getElementById("slashList");var e=document.createDocumentFragment();n.textContent="";f=0;for(d=a.length;f<d;f++){g=a[f];if(m!==g.U){var m=g.U;e.appendChild(rb(g.U))}e.appendChild(sb(g))}n.appendChild(e)}});window.hasFocus=!0;(function(){var a=document.getElementById("emojiButton");if("makeEmoji"in window){var b=window.makeEmoji("smile");b?a.innerHTML="<span class='emoji-small'>"+b.outerHTML+"</span>":a.style.backgroundImage='url("smile.svg")';(b=window.makeEmoji("paperclip"))?document.getElementById("attachFile").innerHTML=
-"<span class='emoji-small'>"+b.outerHTML+"</span>":document.getElementById("attachFile").style.backgroundImage='url("public/paperclip.svg")';a.addEventListener("click",function(){Q&&hb.ga(document.body,Q,function(a){a&&(document.getElementById("msgInput").value+=":"+a+":");S()})})}else a.classList.add("hidden")})();tb()});var mb=function(){function a(a){c&&(document.getElementById("settings").classList.remove("display-"+c),document.getElementById("setting-menu-"+c).classList.remove("selected"),document.getElementById("settings-serviceAddSection").classList.add("hidden"));document.getElementById("settings").classList.add("display-"+a);document.getElementById("setting-menu-"+a).classList.add("selected");c=a}var b=!1,c=null,d={S:"services",display:"display",Db:"privacy"};document.getElementById("settingMenuItems").addEventListener("click",
+function P(){var a=L.length,b="";if(W)b="!"+J.Va+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",db(a,a);else{var c=0;ra(E.context,function(a){a.P>a.C&&c++});c&&(b="("+c+")");db(0,c)}!b.length&&K&&(b=K.name);document.title=b.length?b:"Mimouchat"}
+function eb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(Oa+3E4<a){var b=new Notification(J.Wa);Oa=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}
+function R(){var a=document.createDocumentFragment(),b=K.id,c=null,d=0,e=null,f;K.A?document.getElementById("chatSystemContainer").classList.add("starred"):document.getElementById("chatSystemContainer").classList.remove("starred");Na=[];E.a[b]&&E.a[b].a.forEach(function(b){if(b.i)b.W();else{var g=b.N(),n=!1;c&&c.J===b.J&&b.J?30>Math.abs(d-b.m)&&!(b instanceof y)?e.classList.add("chatmsg-same-ts"):d=b.m:(d=b.m,n=!0);(!c||c.m<=K.C)&&b.m>K.C?g.classList.add("chatmsg-first-unread"):g.classList.remove("chatmsg-first-unread");
+if(b instanceof y)e=c=null,d=0,a.appendChild(g),f=null;else{if(n||!f){var n=H(b.J),m=b.username,l=document.createElement("div"),k=document.createElement("div"),q=document.createElement("a"),u=document.createElement("img");l.da=document.createElement("span");l.da.className="chatmsg-author-img-wrapper";u.className="chatmsg-author-img";q.className="chatmsg-author-name";q.href="#"+n.id;n?(q.textContent=n.getName(),u.src="api/avatar?user="+n.id):(q.textContent=m||"?",u.src="");l.da.appendChild(u);k.appendChild(l.da);
+k.appendChild(q);k.className="chatmsg-author";l.className="chatmsg-authorGroup";l.appendChild(k);l.content=document.createElement("div");l.content.className="chatmsg-author-messages";l.appendChild(l.content);f=l;Na.push(f);a.appendChild(f)}c=b;e=g;f.content.appendChild(g)}}});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;fb();window.hasFocus&&$a()}
+function gb(a,b){if(a.classList.contains("chatmsg-hover-reply"))V&&(V=null,ab()),T!==b&&(T=b,U());else if(a.classList.contains("chatmsg-hover-reaction")){var c=K.id,d=b.id;hb.ia(document.body,Q,function(a){a&&bb(c,d,a)})}else a.classList.contains("chatmsg-hover-edit")?(T&&(T=null,U()),V!==b&&(V=b,ab())):a.classList.contains("chatmsg-hover-star")?b.A?ib(b):jb(b):a.classList.contains("chatmsg-hover-pin")?b.pinned?kb(b):lb(b):a.classList.contains("chatmsg-hover-remove")&&(T&&(T=null,U()),V&&(V=null,
+ab()),mb(b))}
+function nb(a){function b(a,b){for(b=b||a.target;b!==a.currentTarget&&b;){if(b.id&&b.classList.contains("chatmsg-item"))return b.id;b=b.parentElement}}for(var c=a.target;c!==a.currentTarget&&c&&!c.classList.contains("chatmsg-hover");){var d;if(c.parentElement&&c.classList.contains("chatmsg-attachment-actions-item")){var e=c.dataset.attachmentIndex,f=c.dataset.actionIndex;if((d=b(a,c))&&void 0!==e&&void 0!==f){d=d.substr(d.lastIndexOf("_")+1);(a=na(E.a[K.id],d))&&a.s[e]&&a.s[e].actions&&a.s[e].actions[f]&&
+ob(a,a.s[e],a.s[e].actions[f]);break}}if(c.parentElement&&c.parentElement.classList.contains("chatmsg-hover")){if(d=b(a,c))d=d.substr(d.lastIndexOf("_")+1),(a=na(E.a[K.id],d))&&gb(c,a);break}c=c.parentElement}}
+function ob(a,b,c){function d(){var d={actions:[c],attachment_id:b.id,callback_id:b.callback_id,channel_id:e,is_ephemeral:a instanceof z,message_ts:a.id},g=new XMLHttpRequest;g.open("POST","api/attachmentAction?serviceId="+a.J);g.send(JSON.stringify(d))}var e=K.id;c.confirm?Ma(La(new ya(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).ia():d()}function S(){document.getElementById("msgInput").focus()}
+function fb(){var a=document.getElementById("chatWindow").getBoundingClientRect().top;Na.forEach(function(b){var c=b.da,d=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-d-d/2))+"px"})}
+document.addEventListener("DOMContentLoaded",function(){wa();pb();var a=document.getElementById("chanSearch");a.addEventListener("input",Sa);a.addEventListener("blur",Sa);document.getElementById("chatWindow").addEventListener("click",nb);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&Ta()});document.addEventListener("mouseover",function(a){for(a=a.target;a&&a!==this;){if("A"===a.nodeName){var b=a.href,c=b.indexOf("#");if(0<=c){b=b.substr(c+
+1);if(c=G(E.context,b)){X.Ya(c,c.l[b]).show(a);return}a:{for(var c=E.context,f=0,g=c.a.length;f<g;f++)if(c.a[f].j[b]){c=c.a[f];break a}c=null}if(c&&(b=c.j[b].V)){X.Ya(c,b).show(a);return}}break}a=a.parentElement}X.ta()});document.addEventListener("mouseleave",function(){X.ta()});document.getElementById("currentRoomStar").addEventListener("click",function(a){a.preventDefault();K&&(K.A?(a=new XMLHttpRequest,a.open("POST","api/unstarChannel?room="+K.id,!0)):(a=new XMLHttpRequest,a.open("POST","api/starChannel?room="+
+K.id,!0)),a.send(null));return!1});document.getElementById("fileUploadCancel").addEventListener("click",function(a){a.preventDefault();document.getElementById("fileUploadError").classList.add("hidden");document.getElementById("fileUploadContainer").classList.add("hidden");document.getElementById("fileUploadInput").value="";return!1});document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();qb.display()});document.getElementById("fileUploadForm").addEventListener("submit",
+function(a){a.preventDefault();a=document.getElementById("fileUploadInput");var b=a.value;b&&(b=b.substr(b.lastIndexOf("\\")+1),rb(b,a.files[0],function(a){var b=document.getElementById("fileUploadError");a?(b.textContent=a,b.classList.remove("hidden")):(b.classList.add("hidden"),document.getElementById("fileUploadInput").value="",document.getElementById("fileUploadContainer").classList.add("hidden"))}));return!1});document.getElementById("attachFile").addEventListener("click",function(a){a.preventDefault();
+K&&document.getElementById("fileUploadContainer").classList.remove("hidden");return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();a=document.getElementById("msgInput");K&&a.value&&sb(a.value)&&(a.value="",T&&(T=null,U()),V&&(V=null,U()),document.getElementById("slashList").textContent="");S();return!1});window.addEventListener("blur",function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;Oa=0;K&&$a();S()});document.getElementById("chatWindow").addEventListener("scroll",
+fb);var b=0;document.getElementById("msgInput").addEventListener("input",function(){if(K){var a=Date.now();b+3E3<a&&(Q.self.wa||K instanceof t)&&(tb(),b=a);var a=[],d=this.value;if("/"===this.value[0]){var e=d.indexOf(" "),f=-1!==e,e=-1===e?d.length:e,d=d.substr(0,e);if(f){var g=ub.Ra(d);g&&a.push(g)}else a=ub.hb(d);var g=Q?Q.i.data:{};for(n in g){var h=g[n];(!f&&h.name.substr(0,e)===d||f&&h.name===d)&&a.push(h)}}a.sort(function(a,b){return a.U.localeCompare(b.U)||a.name.localeCompare(b.name)});var n=
+document.getElementById("slashList");var e=document.createDocumentFragment();n.textContent="";f=0;for(d=a.length;f<d;f++){g=a[f];if(m!==g.U){var m=g.U;e.appendChild(vb(g.U))}e.appendChild(wb(g))}n.appendChild(e)}});window.hasFocus=!0;(function(){var a=document.getElementById("emojiButton");if("makeEmoji"in window){var b=window.makeEmoji("smile");b?a.innerHTML="<span class='emoji-small'>"+b.outerHTML+"</span>":a.style.backgroundImage='url("smile.svg")';(b=window.makeEmoji("paperclip"))?document.getElementById("attachFile").innerHTML=
+"<span class='emoji-small'>"+b.outerHTML+"</span>":document.getElementById("attachFile").style.backgroundImage='url("public/paperclip.svg")';a.addEventListener("click",function(){Q&&hb.ia(document.body,Q,function(a){a&&(document.getElementById("msgInput").value+=":"+a+":");S()})})}else a.classList.add("hidden")})();xb()});var qb=function(){function a(a){c&&(document.getElementById("settings").classList.remove("display-"+c),document.getElementById("setting-menu-"+c).classList.remove("selected"),document.getElementById("settings-serviceAddSection").classList.add("hidden"));document.getElementById("settings").classList.add("display-"+a);document.getElementById("setting-menu-"+a).classList.add("selected");c=a}var b=!1,c=null,d={S:"services",display:"display",Fb:"privacy"};document.getElementById("settingMenuItems").addEventListener("click",
 function(b){for(var c=b.target;b.currentTarget!==c&&c;c=c.parentNode)if(c.dataset&&c.dataset.target)for(var e in d)if(d[e]===c.dataset.target){a(d[e]);return}});document.getElementById("settings-serviceAddButton").addEventListener("click",function(a){a.preventDefault();document.getElementById("settings-serviceAddSection").classList.remove("hidden");return!1});document.getElementById("settings-serviceAddConfirm").addEventListener("click",function(a){a.preventDefault();document.location.href=document.getElementById("settings-serviceAddServiceList").value;
-return!1});return{display:function(c){b||(document.getElementById("settings").classList.remove("hidden"),b=!0);a(c||d.S);return this},ob:function(){return this},lb:d}}();function ub(a){if(void 0!==a.latitude&&void 0!==a.longitude&&-90<=a.latitude&&90>=a.latitude&&-180<=a.longitude&&180>=a.longitude){var b=0,c=function(a,b,c,d){return new Promise(function(e,f){var g=new Image;g.addEventListener("load",function(){d.O=g;e(d)});g.addEventListener("error",function(){console.warn("Error loading tile ",{zoom:a,x:b,y:c});f(g)});g.crossOrigin="anonymous";g.src="https://c.tile.openstreetmap.org/"+a+"/"+b+"/"+c+".png"})},d=document.createElement("canvas"),e=document.createElement("canvas");
-d.height=d.width=e.height=e.width=300;var f=d.getContext("2d"),g=e.getContext("2d"),h=function(a,b,c){a=a*Math.PI/180;b=b*Math.PI/180;c=c*Math.PI/180;return Math.abs(6371E3*Math.acos(Math.pow(Math.sin(a),2)+Math.pow(Math.cos(a),2)*Math.cos(c-b)))},n=function(a,d,e,k){g.fillStyle="#808080";g.fillRect(0,0,300,300);f.fillStyle="#808080";f.fillRect(0,0,300,300);var n=Math.pow(2,a),l=(e+180)/360*n,m=(1-Math.log(Math.tan(d*Math.PI/180)+1/Math.cos(d*Math.PI/180))/Math.PI)/2*n,p=Math.floor(l),F=Math.floor(m),
-ea=k?100*k/h(180/Math.PI*Math.atan(.5*(Math.exp(Math.PI-2*Math.PI*F/n)-Math.exp(-(Math.PI-2*Math.PI*F/n)))),p/n*360-180,(p+1)/n*360-180):0;d=b;for(e=0;3>e;e++)for(k=0;3>k;k++)c(a,p+e-1,F+k-1,{hb:e,jb:k,ab:d}).then(function(a){if(a.ab===b){g.drawImage(a.O,100*a.hb,100*a.jb,100,100);a=l-p;var c=m-F;a=100*a+100;c=100*c+100;f.putImageData(g.getImageData(0,0,300,300),0,0);void 0!==ea&&(f.beginPath(),f.arc(a,c,Math.max(ea,10),0,2*Math.PI,!1),f.lineWidth=2,f.fillStyle="rgba(244, 146, 66, 0.4)",f.strokeStyle=
-"rgba(244, 146, 66, 0.8)",f.stroke(),f.fill());if(void 0===ea||25<ea)f.strokeStyle="rgba(244, 146, 66, 1)",f.beginPath(),f.moveTo(a-5,c-5),f.lineTo(a+5,c+5),f.stroke(),f.moveTo(a+5,c-5),f.lineTo(a-5,c+5),f.stroke()}})},m,l=function(c){c=Math.max(4,Math.min(19,c));m!==c&&(b++,m=c,n(m,Number(a.latitude),Number(a.longitude),Number(a.accuracy)))};l(12);var e=document.createElement("div"),k=document.createElement("div"),p=document.createElement("button"),u=document.createElement("button");e.className=
-"OSM-wrapper";d.className="OSM-canvas";k.className="OSM-controls";u.className="OSM-controls-zoomMin";p.className="OSM-controls-zoomPlus";u.addEventListener("click",function(){l(m-1)});p.addEventListener("click",function(){l(m+1)});k.appendChild(u);k.appendChild(p);e.appendChild(d);e.appendChild(k);return e}};function Qa(){var a=document.createElement("span"),b=document.createElement("span"),c=document.createElement("span"),d=document.createElement("span");a.className="typing-container";b.className="typing-dot1";c.className="typing-dot2";d.className="typing-dot3";b.textContent=c.textContent=d.textContent=".";a.appendChild(b);a.appendChild(c);a.appendChild(d);return a}var Ra=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
-function vb(a){var b=a.b,c=document.createElement("div"),d=document.createElement("div"),e=document.createElement("ul");c.s=document.createElement("ul");c.C=document.createElement("ul");c.m=document.createElement("div");c.wa=document.createElement("div");c.pa=document.createElement("span");c.id=b+"_"+a.id;c.className="chatmsg-item";c.m.className="chatmsg-ts";c.wa.className="chatmsg-msg";c.pa.className="chatmsg-author-name";b=document.createElement("li");b.className="chatmsg-hover-reply";b.style.backgroundImage=
-'url("repl.svg")';e.appendChild(b);b=document.createElement("li");b.className="chatmsg-hover-reaction";b.style.backgroundImage='url("smile.svg")';e.appendChild(b);a:{for(var b=E.context,f=0,g=b.a.length;f<g;f++)if(b.a[f].self.id===a.J){a=!0;break a}a=!1}a&&(a=document.createElement("li"),a.className="chatmsg-hover-edit",a.style.backgroundImage='url("edit.svg")',e.appendChild(a),a=document.createElement("li"),a.className="chatmsg-hover-remove",a.style.backgroundImage='url("remove.svg")',e.appendChild(a));
-e.className="chatmsg-hover";d.appendChild(c.pa);d.appendChild(c.wa);d.appendChild(c.m);d.appendChild(c.s);c.D=document.createElement("div");c.D.className="chatmsg-edited";d.appendChild(c.D);d.appendChild(c.C);d.className="chatmsg-content";c.s.className="chatmsg-attachments";c.C.className="chatmsg-reactions";c.appendChild(d);c.appendChild(e);return c}function wb(a){var b={good:"#2fa44f",warning:"#de9e31",danger:"#d50200"};if(a){if("#"===a[0])return a;if(b[a])return b[a]}return"#e3e4e6"}
-function xb(a,b,c){var d=document.createElement("li"),e=document.createElement("div"),f=document.createElement("div"),g=document.createElement("a"),h=document.createElement("div"),n=document.createElement("img"),m=document.createElement("a"),l=document.createElement("div"),k=document.createElement("div"),p=document.createElement("div"),u=document.createElement("img"),w=document.createElement("div");d.className="chatmsg-attachment";e.style.borderColor=wb(b.color||"");e.className="chatmsg-attachment-block";
+return!1});return{display:function(c){b||(document.getElementById("settings").classList.remove("hidden"),b=!0);a(c||d.S);return this},qb:function(){return this},nb:d}}();function yb(a){if(void 0!==a.latitude&&void 0!==a.longitude&&-90<=a.latitude&&90>=a.latitude&&-180<=a.longitude&&180>=a.longitude){var b=0,c=function(a,b,c,d){return new Promise(function(e,f){var g=new Image;g.addEventListener("load",function(){d.O=g;e(d)});g.addEventListener("error",function(){console.warn("Error loading tile ",{zoom:a,x:b,y:c});f(g)});g.crossOrigin="anonymous";g.src="https://c.tile.openstreetmap.org/"+a+"/"+b+"/"+c+".png"})},d=document.createElement("canvas"),e=document.createElement("canvas");
+d.height=d.width=e.height=e.width=300;var f=d.getContext("2d"),g=e.getContext("2d"),h=function(a,b,c){a=a*Math.PI/180;b=b*Math.PI/180;c=c*Math.PI/180;return Math.abs(6371E3*Math.acos(Math.pow(Math.sin(a),2)+Math.pow(Math.cos(a),2)*Math.cos(c-b)))},n=function(a,d,e,k){g.fillStyle="#808080";g.fillRect(0,0,300,300);f.fillStyle="#808080";f.fillRect(0,0,300,300);var n=Math.pow(2,a),l=(e+180)/360*n,m=(1-Math.log(Math.tan(d*Math.PI/180)+1/Math.cos(d*Math.PI/180))/Math.PI)/2*n,q=Math.floor(l),F=Math.floor(m),
+ea=k?100*k/h(180/Math.PI*Math.atan(.5*(Math.exp(Math.PI-2*Math.PI*F/n)-Math.exp(-(Math.PI-2*Math.PI*F/n)))),q/n*360-180,(q+1)/n*360-180):0;d=b;for(e=0;3>e;e++)for(k=0;3>k;k++)c(a,q+e-1,F+k-1,{jb:e,lb:k,cb:d}).then(function(a){if(a.cb===b){g.drawImage(a.O,100*a.jb,100*a.lb,100,100);a=l-q;var c=m-F;a=100*a+100;c=100*c+100;f.putImageData(g.getImageData(0,0,300,300),0,0);void 0!==ea&&(f.beginPath(),f.arc(a,c,Math.max(ea,10),0,2*Math.PI,!1),f.lineWidth=2,f.fillStyle="rgba(244, 146, 66, 0.4)",f.strokeStyle=
+"rgba(244, 146, 66, 0.8)",f.stroke(),f.fill());if(void 0===ea||25<ea)f.strokeStyle="rgba(244, 146, 66, 1)",f.beginPath(),f.moveTo(a-5,c-5),f.lineTo(a+5,c+5),f.stroke(),f.moveTo(a+5,c-5),f.lineTo(a-5,c+5),f.stroke()}})},m,l=function(c){c=Math.max(4,Math.min(19,c));m!==c&&(b++,m=c,n(m,Number(a.latitude),Number(a.longitude),Number(a.accuracy)))};l(12);var e=document.createElement("div"),k=document.createElement("div"),q=document.createElement("button"),u=document.createElement("button");e.className=
+"OSM-wrapper";d.className="OSM-canvas";k.className="OSM-controls";u.className="OSM-controls-zoomMin";q.className="OSM-controls-zoomPlus";u.addEventListener("click",function(){l(m-1)});q.addEventListener("click",function(){l(m+1)});k.appendChild(u);k.appendChild(q);e.appendChild(d);e.appendChild(k);return e}};function Qa(){var a=document.createElement("span"),b=document.createElement("span"),c=document.createElement("span"),d=document.createElement("span");a.className="typing-container";b.className="typing-dot1";c.className="typing-dot2";d.className="typing-dot3";b.textContent=c.textContent=d.textContent=".";a.appendChild(b);a.appendChild(c);a.appendChild(d);return a}var Ra=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
+function zb(a){var b=a.b,c=document.createElement("div"),d=document.createElement("div");c.aa=document.createElement("ul");c.s=document.createElement("ul");c.D=document.createElement("ul");c.m=document.createElement("div");c.ya=document.createElement("div");c.ra=document.createElement("span");c.id=b+"_"+a.id;c.className="chatmsg-item";c.m.className="chatmsg-ts";c.ya.className="chatmsg-msg";c.ra.className="chatmsg-author-name";var b=c.aa,e=a.context.Y;a:{for(var f=E.context,g=0,h=f.a.length;g<h;g++)if(f.a[g].self.id===
+a.J){a=!0;break a}a=!1}e.replyToMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-reply",f.style.backgroundImage='url("repl.svg")',b.appendChild(f));e.reactMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-reaction",f.style.backgroundImage='url("smile.svg")',b.appendChild(f));if(a&&e.editMsg||e.editOtherMsg)f=document.createElement("li"),f.className="chatmsg-hover-edit",f.style.backgroundImage='url("edit.svg")',b.appendChild(f);e.starMsg&&(b.fa=document.createElement("li"),
+b.fa.className="chatmsg-hover-star",b.appendChild(b.fa));e.pinMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-pin",b.appendChild(f),f.style.backgroundImage='url("pin.svg")');if(a&&e.removeMsg||e.moderate)e=document.createElement("li"),e.className="chatmsg-hover-remove",e.style.backgroundImage='url("remove.svg")',b.appendChild(e);c.aa.className="chatmsg-hover";d.appendChild(c.ra);d.appendChild(c.ya);d.appendChild(c.m);d.appendChild(c.s);c.F=document.createElement("div");c.F.className=
+"chatmsg-edited";d.appendChild(c.F);d.appendChild(c.D);d.className="chatmsg-content";c.s.className="chatmsg-attachments";c.D.className="chatmsg-reactions";c.appendChild(d);c.appendChild(c.aa);return c}function Ab(a){var b={good:"#2fa44f",warning:"#de9e31",danger:"#d50200"};if(a){if("#"===a[0])return a;if(b[a])return b[a]}return"#e3e4e6"}
+function Bb(a,b,c){var d=document.createElement("li"),e=document.createElement("div"),f=document.createElement("div"),g=document.createElement("a"),h=document.createElement("div"),n=document.createElement("img"),m=document.createElement("a"),l=document.createElement("div"),k=document.createElement("div"),q=document.createElement("div"),u=document.createElement("img"),w=document.createElement("div");d.className="chatmsg-attachment";e.style.borderColor=Ab(b.color||"");e.className="chatmsg-attachment-block";
 f.className="chatmsg-attachment-pretext";b.pretext?f.innerHTML=a.w(b.pretext):f.classList.add("hidden");g.target="_blank";b.title?(g.innerHTML=a.w(b.title),b.title_link&&(g.href=b.title_link),g.className="chatmsg-attachment-title"):g.className="hidden chatmsg-attachment-title";m.target="_blank";h.className="chatmsg-author";b.author_name&&(m.innerHTML=a.w(b.author_name),m.href=b.author_link||"",m.className="chatmsg-author-name",n.className="chatmsg-author-img",b.author_icon&&(n.src=b.author_icon,h.appendChild(n)),
-h.appendChild(m));p.className="chatmsg-attachment-thumb";b.thumb_url?(n=document.createElement("img"),n.src=b.thumb_url,p.appendChild(n),e.classList.add("has-thumb"),b.video_html&&(p.dataset.video=b.video_html)):p.classList.add("hidden");l.className="chatmsg-attachment-content";n=a.w(b.text||"");k.className="chatmsg-attachment-text";n&&""!=n?k.innerHTML=n:k.classList.add("hidden");l.appendChild(p);l.appendChild(k);b.geo&&(k=ub(b.geo))&&l.appendChild(k);u.className="chatmsg-attachment-img";b.image_url?
-u.src=b.image_url:u.classList.add("hidden");w.className="chatmsg-attachment-footer";b.footer&&(k=document.createElement("span"),k.className="chatmsg-attachment-footer-text",k.innerHTML=a.w(b.footer),b.footer_icon&&(p=document.createElement("img"),p.src=b.footer_icon,p.className="chatmsg-attachment-footer-icon",w.appendChild(p)),w.appendChild(k));b.ts&&(k=document.createElement("span"),k.className="chatmsg-ts",k.innerHTML=J.L(b.ts),w.appendChild(k));e.appendChild(g);e.appendChild(h);e.appendChild(l);
+h.appendChild(m));q.className="chatmsg-attachment-thumb";b.thumb_url?(n=document.createElement("img"),n.src=b.thumb_url,q.appendChild(n),e.classList.add("has-thumb"),b.video_html&&(q.dataset.video=b.video_html)):q.classList.add("hidden");l.className="chatmsg-attachment-content";n=a.w(b.text||"");k.className="chatmsg-attachment-text";n&&""!=n?k.innerHTML=n:k.classList.add("hidden");l.appendChild(q);l.appendChild(k);b.geo&&(k=yb(b.geo))&&l.appendChild(k);u.className="chatmsg-attachment-img";b.image_url?
+u.src=b.image_url:u.classList.add("hidden");w.className="chatmsg-attachment-footer";b.footer&&(k=document.createElement("span"),k.className="chatmsg-attachment-footer-text",k.innerHTML=a.w(b.footer),b.footer_icon&&(q=document.createElement("img"),q.src=b.footer_icon,q.className="chatmsg-attachment-footer-icon",w.appendChild(q)),w.appendChild(k));b.ts&&(k=document.createElement("span"),k.className="chatmsg-ts",k.innerHTML=J.L(b.ts),w.appendChild(k));e.appendChild(g);e.appendChild(h);e.appendChild(l);
 e.appendChild(u);if(b.fields&&b.fields.length){var r=document.createElement("ul");e.appendChild(r);r.className="chatmsg-attachment-fields";b.fields.forEach(function(b){var c=b.title||"",d=b.value||"";b=!!b["short"];var e=document.createElement("li"),f=document.createElement("div"),g=document.createElement("div");e.className="field";b||e.classList.add("field-long");f.className="field-title";f.textContent=c;g.className="field-text";g.innerHTML=a.w(d);e.appendChild(f);e.appendChild(g);e&&r.appendChild(e)})}if(b.actions&&
-b.actions.length)for(g=document.createElement("ul"),g.className="chatmsg-attachment-actions "+Ha,e.appendChild(g),h=0,l=b.actions.length;h<l;h++)(u=b.actions[h])&&(u=yb(c,h,u))&&g.appendChild(u);e.appendChild(w);d.appendChild(f);d.appendChild(e);return d}
-function yb(a,b,c){var d=document.createElement("li"),e=wb(c.style);d.textContent=c.text;e!==wb()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="chatmsg-attachment-actions-item "+Fa;return d}function Xa(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(Qa());b.appendChild(c);return b}
-function rb(a){var b=document.createElement("lh");b.textContent=a;b.className="chat-command-header";return b}
-function sb(a){var b=document.createElement("li"),c=document.createElement("span"),d=document.createElement("span"),e=document.createElement("span");c.textContent=a.name;d.textContent=a.usage;e.textContent=a.a;b.appendChild(c);b.appendChild(d);b.appendChild(e);b.className="chat-command-item";c.className="chat-command-name";d.className="chat-command-usage";e.className="chat-command-desc";return b};var hb=function(){function a(a,b){for(a=a.target;a!==m&&a&&"LI"!==a.nodeName;)a=a.parentElement;a&&"LI"===a.nodeName&&a.id&&"emojibar-"===a.id.substr(0,9)?b(a.id.substr(9)):b(null)}function b(){r={};k.textContent="";window.emojiProviderHeader&&(k.appendChild(h(window.emojiProviderHeader)),p.textContent="",k.appendChild(p));k.appendChild(h("emojicustom.png"));k.appendChild(u)}function c(){if(!d())return!1;N&&N(null);return!0}function d(){return m.parentElement?(m.parentElement.removeChild(l),m.parentElement.removeChild(m),
-!0):!1}function e(a){var b=0;a=void 0===a?w.value:a;if(n()){var c=0,d=window.searchEmojis(a),e=f(d,O?O.self.R.a:[]),k;for(h in r)r[h].visible&&(r[h].visible=!1,p.removeChild(r[h].c));var h=0;for(k=e.length;h<k;h++){var l=e[h].name,m=r[l];if(!m){var m=r,F=l;var C=l;var l=window.makeEmoji(d[l]),N=document.createElement("span");N.appendChild(l);N.className="emoji-medium";C=g(C,N);m=m[F]=C}m.visible||(m.visible=!0,p.appendChild(m.c));c++}b+=c}h=b;c=0;for(D in A)A[D].visible&&(A[D].visible=!1,u.removeChild(A[D].c));
+b.actions.length)for(g=document.createElement("ul"),g.className="chatmsg-attachment-actions "+Ha,e.appendChild(g),h=0,l=b.actions.length;h<l;h++)(u=b.actions[h])&&(u=Cb(c,h,u))&&g.appendChild(u);e.appendChild(w);d.appendChild(f);d.appendChild(e);return d}
+function Cb(a,b,c){var d=document.createElement("li"),e=Ab(c.style);d.textContent=c.text;e!==Ab()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="chatmsg-attachment-actions-item "+Fa;return d}function Xa(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(Qa());b.appendChild(c);return b}
+function vb(a){var b=document.createElement("lh");b.textContent=a;b.className="chat-command-header";return b}
+function wb(a){var b=document.createElement("li"),c=document.createElement("span"),d=document.createElement("span"),e=document.createElement("span");c.textContent=a.name;d.textContent=a.usage;e.textContent=a.a;b.appendChild(c);b.appendChild(d);b.appendChild(e);b.className="chat-command-item";c.className="chat-command-name";d.className="chat-command-usage";e.className="chat-command-desc";return b};var hb=function(){function a(a,b){for(a=a.target;a!==m&&a&&"LI"!==a.nodeName;)a=a.parentElement;a&&"LI"===a.nodeName&&a.id&&"emojibar-"===a.id.substr(0,9)?b(a.id.substr(9)):b(null)}function b(){r={};k.textContent="";window.emojiProviderHeader&&(k.appendChild(h(window.emojiProviderHeader)),q.textContent="",k.appendChild(q));k.appendChild(h("emojicustom.png"));k.appendChild(u)}function c(){if(!d())return!1;N&&N(null);return!0}function d(){return m.parentElement?(m.parentElement.removeChild(l),m.parentElement.removeChild(m),
+!0):!1}function e(a){var b=0;a=void 0===a?w.value:a;if(n()){var c=0,d=window.searchEmojis(a),e=f(d,O?O.self.R.a:[]),k;for(h in r)r[h].visible&&(r[h].visible=!1,q.removeChild(r[h].c));var h=0;for(k=e.length;h<k;h++){var l=e[h].name,m=r[l];if(!m){var m=r,F=l;var C=l;var l=window.makeEmoji(d[l]),N=document.createElement("span");N.appendChild(l);N.className="emoji-medium";C=g(C,N);m=m[F]=C}m.visible||(m.visible=!0,q.appendChild(m.c));c++}b+=c}h=b;c=0;for(D in A)A[D].visible&&(A[D].visible=!1,u.removeChild(A[D].c));
 if(O){d=f(O.b.data,O?O.self.R.a:[]);var D=0;for(b=d.length;D<b;D++)F=d[D].name,""!==a&&F.substr(0,a.length)!==a||"alias:"===O.b.data[F].substr(0,6)||(e=A[F],e||(e=A,m=k=F,F=O.b.data[F],C=document.createElement("span"),l=document.createElement("span"),C.className="emoji emoji-custom",C.style.backgroundImage='url("'+F+'")',l.appendChild(C),l.className="emoji-medium",m=g(m,l),e=e[k]=m),e.visible||(e.visible=!0,u.appendChild(e.c)),c++);D=c}else D=0;return h+D}function f(a,b){var c=[],d;for(d in a){var e=
-{name:d,Xa:0,count:0};if(a[d].names)for(var f=0,g=a[d].names.length;f<g;f++)e.count+=b[a[d].names[f]]||0;c.push(e)}return c=c.sort(function(a,b){var c=b.count-a.count;return c?c:a.Xa-b.Xa})}function g(a,b){var c=document.createElement("li");c.appendChild(b);c.className="emojibar-list-item";c.id="emojibar-"+a;return{visible:!1,c:c}}function h(a){var b=document.createElement("img"),c=document.createElement("div");b.src=a;c.appendChild(b);c.className="emojibar-header";return c}function n(){return"searchEmojis"in
-window}var m=document.createElement("div"),l=document.createElement("div"),k=document.createElement("div"),p=document.createElement("ul"),u=document.createElement("ul"),w=document.createElement("input"),r={},A={},M=document.createElement("div"),C=document.createElement("span"),D=document.createElement("span"),N,O;l.addEventListener("click",function(a){var b=m.getBoundingClientRect();(a.screenY<b.top||a.screenY>b.bottom||a.screenX<b.left||a.screenX>b.right)&&c()});l.className="emojibar-overlay";m.className=
-"emojibar";k.className="emojibar-emojis";p.className=u.className="emojibar-list";w.className="emojibar-search";M.className="emojibar-detail";C.className="emojibar-detail-img";D.className="emojibar-detail-name";M.appendChild(C);M.appendChild(D);b();m.appendChild(k);m.appendChild(M);m.appendChild(w);w.addEventListener("keyup",function(){e()});m.addEventListener("mousemove",function(b){a(b,function(a){var b=a?r[a]||A[a]:null;b?(C.innerHTML=b.c.outerHTML,D.textContent=":"+a+":"):(C.textContent="",D.textContent=
-"")})});m.addEventListener("click",function(b){a(b,function(a){a&&d()&&N&&N(a)})});return{isSupported:n,ga:function(a,b,c){return n()?(O=b,N=c,a.appendChild(l),a.appendChild(m),w.value="",e(),w.focus(),!0):!1},search:e,close:c,reset:function(){b();e()}}}();var E,L=[];function zb(){da.call(this)}zb.prototype=Object.create(da.prototype);zb.prototype.constructor=zb;function qa(a){return a.a?a.a.id:null}function Ab(){this.b=0;this.context=new oa;this.a={}}
-Ab.prototype.update=function(a){var b=Date.now();a.v&&(this.b=a.v);if(a["static"])for(e in a["static"]){var c=pa(this.context,e);c||(c=new zb,this.context.push(c));ga(c,a["static"][e],b)}ra(this.context,function(a){a.P===a.B&&(a=L.indexOf(a),-1!==a&&L.splice(a,1))});if(a.live){for(e in a.live)(c=this.a[e])?ka(c,a.live[e],b):c=this.a[e]=new Y(e,250,a.live[e],b);for(var d in a.live){var e=G(this.context,d);(c=e.l[d])?(this.a[d].a.length&&(c.P=Math.max(c.P,ma(this.a[d]).m)),c.aa||(Bb(e,c,a.live[d]),
-K&&a.live[K.id]&&R())):E.b=0}}a["static"]&&Pa();var f=!1;a.typing&&this.context.a.forEach(function(c){var d=f,e=a.typing,g=!1;if(c.u)for(var l in c.u)e[l]||(delete c.u[l],g=!0);if(e)for(l in e)if(c.l[l]){c.u[l]||(c.u[l]={});for(var k in e[l])c.u[l][k]||(g=!0),c.u[l][k]=b}f=d|g},this);(a["static"]||f)&&Va();a.config&&(Cb=new Db(a.config),Eb()&&mb.ob(!1).display(mb.lb.S),Fb());if(Q&&K&&a["static"]&&a["static"][Q.a.id]&&a["static"][Q.a.id].channels&&a["static"][Q.a.id].channels)for(d=a["static"][Q.a.id].channels,
+{name:d,Za:0,count:0};if(a[d].names)for(var f=0,g=a[d].names.length;f<g;f++)e.count+=b[a[d].names[f]]||0;c.push(e)}return c=c.sort(function(a,b){var c=b.count-a.count;return c?c:a.Za-b.Za})}function g(a,b){var c=document.createElement("li");c.appendChild(b);c.className="emojibar-list-item";c.id="emojibar-"+a;return{visible:!1,c:c}}function h(a){var b=document.createElement("img"),c=document.createElement("div");b.src=a;c.appendChild(b);c.className="emojibar-header";return c}function n(){return"searchEmojis"in
+window}var m=document.createElement("div"),l=document.createElement("div"),k=document.createElement("div"),q=document.createElement("ul"),u=document.createElement("ul"),w=document.createElement("input"),r={},A={},M=document.createElement("div"),C=document.createElement("span"),D=document.createElement("span"),N,O;l.addEventListener("click",function(a){var b=m.getBoundingClientRect();(a.screenY<b.top||a.screenY>b.bottom||a.screenX<b.left||a.screenX>b.right)&&c()});l.className="emojibar-overlay";m.className=
+"emojibar";k.className="emojibar-emojis";q.className=u.className="emojibar-list";w.className="emojibar-search";M.className="emojibar-detail";C.className="emojibar-detail-img";D.className="emojibar-detail-name";M.appendChild(C);M.appendChild(D);b();m.appendChild(k);m.appendChild(M);m.appendChild(w);w.addEventListener("keyup",function(){e()});m.addEventListener("mousemove",function(b){a(b,function(a){var b=a?r[a]||A[a]:null;b?(C.innerHTML=b.c.outerHTML,D.textContent=":"+a+":"):(C.textContent="",D.textContent=
+"")})});m.addEventListener("click",function(b){a(b,function(a){a&&d()&&N&&N(a)})});return{isSupported:n,ia:function(a,b,c){return n()?(O=b,N=c,a.appendChild(l),a.appendChild(m),w.value="",e(),w.focus(),!0):!1},search:e,close:c,reset:function(){b();e()}}}();var E,L=[];function Db(){da.call(this)}Db.prototype=Object.create(da.prototype);Db.prototype.constructor=Db;function qa(a){return a.a?a.a.id:null}function Eb(){this.b=0;this.context=new oa;this.a={}}
+Eb.prototype.update=function(a){var b=Date.now();a.v&&(this.b=a.v);if(a["static"])for(e in a["static"]){var c=pa(this.context,e);c||(c=new Db,this.context.push(c));ga(c,a["static"][e],b)}ra(this.context,function(a){a.P===a.C&&(a=L.indexOf(a),-1!==a&&L.splice(a,1))});if(a.live){for(e in a.live)(c=this.a[e])?ka(c,a.live[e],b):c=this.a[e]=new Y(e,250,a.live[e],b);for(var d in a.live){var e=G(this.context,d);(c=e.l[d])?(this.a[d].a.length&&(c.P=Math.max(c.P,ma(this.a[d]).m)),c.ca||(Fb(e,c,a.live[d]),
+K&&a.live[K.id]&&R())):E.b=0}}a["static"]&&Pa();var f=!1;a.typing&&this.context.a.forEach(function(c){var d=f,e=a.typing,g=!1;if(c.u)for(var l in c.u)e[l]||(delete c.u[l],g=!0);if(e)for(l in e)if(c.l[l]){c.u[l]||(c.u[l]={});for(var k in e[l])c.u[l][k]||(g=!0),c.u[l][k]=b}f=d|g},this);(a["static"]||f)&&Va();a.config&&(Gb=new Hb(a.config),Ib()&&qb.qb(!1).display(qb.nb.S),Jb());if(Q&&K&&a["static"]&&a["static"][Q.a.id]&&a["static"][Q.a.id].channels&&a["static"][Q.a.id].channels)for(d=a["static"][Q.a.id].channels,
 e=0,c=d.length;e<c;e++)if(d[e].id===K.id){R();break}};setInterval(function(){var a=!1,b=Date.now();sa(function(c){var d=!1,e;for(e in c.u){var f=!0,g;for(g in c.u[e])c.u[e][g]+3E3<b?(delete c.u[e][g],d=!0):f=!1;f&&(delete c.u[e],d=!0)}d&&(a=!0)});a&&Va()},1E3);
-function Bb(a,b,c){if(b!==K||!window.hasFocus){var d=new RegExp("<@"+a.self.id),e=!1,f=!1,g=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.B)){f=!0;var h;if(!(h=b instanceof t)&&(h=c.text)&&!(h=c.text.match(d)))a:{h=a.self.R.A;for(var m=0,l=h.length;m<l;m++)if(-1!==c.text.indexOf(h[m])){h=!0;break a}h=!1}h&&(-1===L.indexOf(b)&&(g=!0,L.push(b)),e=!0)}});if(f){P();if(c=document.getElementById("room_"+b.id))c.classList.add("unread"),e&&c.classList.add("unreadHi");g&&!window.hasFocus&&eb()}}}
-function $a(){var a=K,b=L.indexOf(a);if(a.P>a.B){var c=E.a[a.id];if(c&&(c=c.a[c.a.length-1])){var d=new XMLHttpRequest;d.open("POST","api/markread?room="+a.id+"&id="+c.id+"&ts="+c.m,!0);d.send(null);a.B=c.m}}0<=b&&(L.splice(b,1),P());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}E=new Ab;var Ua=function(){function a(a,c){c.sort(function(){return Math.random()-.5});for(var d=0,e=20;e<m-40;e+=k)for(var f=0;f+k<=l;f+=k)g(a,c[d],e,f),d++,d===c.length&&(c.sort(b),d=0)}function b(a,b){return a.O?b.O?Math.random()-.5:-1:1}function c(a,b){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].O){d(a[e].src,function(d){a[e].O=d;c(a,b)});return}var g=[];a.forEach(function(a){a.O&&g.push(a.O)});b(g)}function d(a,b){var c=new XMLHttpRequest;c.responseType="blob";c.onreadystatechange=function(){if(4===
+function Fb(a,b,c){if(b!==K||!window.hasFocus){var d=new RegExp("<@"+a.self.id),e=!1,f=!1,g=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.C)){f=!0;var h;if(!(h=b instanceof t)&&(h=c.text)&&!(h=c.text.match(d)))a:{h=a.self.R.B;for(var m=0,l=h.length;m<l;m++)if(-1!==c.text.indexOf(h[m])){h=!0;break a}h=!1}h&&(-1===L.indexOf(b)&&(g=!0,L.push(b)),e=!0)}});if(f){P();if(c=document.getElementById("room_"+b.id))c.classList.add("unread"),e&&c.classList.add("unreadHi");g&&!window.hasFocus&&eb()}}}
+function $a(){var a=K,b=L.indexOf(a);if(a.P>a.C){var c=E.a[a.id];if(c&&(c=c.a[c.a.length-1])){var d=new XMLHttpRequest;d.open("POST","api/markread?room="+a.id+"&id="+c.id+"&ts="+c.m,!0);d.send(null);a.C=c.m}}0<=b&&(L.splice(b,1),P());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}E=new Eb;var Ua=function(){function a(a,c){c.sort(function(){return Math.random()-.5});for(var d=0,e=20;e<m-40;e+=k)for(var f=0;f+k<=l;f+=k)g(a,c[d],e,f),d++,d===c.length&&(c.sort(b),d=0)}function b(a,b){return a.O?b.O?Math.random()-.5:-1:1}function c(a,b){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].O){d(a[e].src,function(d){a[e].O=d;c(a,b)});return}var g=[];a.forEach(function(a){a.O&&g.push(a.O)});b(g)}function d(a,b){var c=new XMLHttpRequest;c.responseType="blob";c.onreadystatechange=function(){if(4===
 c.readyState)if(c.response){var a=new Image;a.onload=function(){var c=document.createElement("canvas");c.height=c.width=w;c=c.getContext("2d");c.drawImage(a,0,0,w,w);var c=c.getImageData(0,0,w,w),d=0,e;for(e=0;e<c.width*c.height*4;e+=4)c.data[e]=c.data[e+1]=c.data[e+2]=(c.data[e]+c.data[e+1]+c.data[e+2])/3,c.data[e+3]=50,d+=c.data[e];if(50>d/(c.height*c.width))for(e=0;e<c.width*c.height*4;e+=4)c.data[e]=c.data[e+1]=c.data[e+2]=255-c.data[e];b(c)};a.onerror=function(){b(null)};a.src=window.URL.createObjectURL(c.response)}else b(null)};
 c.open("GET",a,!0);c.send(null)}function e(){var a=n.createLinearGradient(0,0,0,l);a.addColorStop(0,"#4D394B");a.addColorStop(1,"#201820");n.fillStyle=a;n.fillRect(0,0,m,l);return n.getImageData(0,0,m,l)}function f(a,b){for(var c=(a.height-b.height)/2,d=0;d<b.height;d++)for(var e=0;e<b.width;e++){var f=b.data[4*(d*b.width+e)]/255,g=4*((d+c)*a.width+e+c);a.data[g]*=f;a.data[g+1]*=f;a.data[g+2]*=f}return a}function g(a,b,c,d){var e=Math.floor(d);a=[a.data[e*m*4+0],a.data[e*m*4+1],a.data[e*m*4+2]];n.fillStyle=
-"#"+(1.1*a[0]<<16|1.1*a[1]<<8|1.1*a[2]).toString(16);n.beginPath();n.moveTo(c+k/2,d+p);n.lineTo(c-p+k,d+k/2);n.lineTo(c+k/2,d-p+k);n.lineTo(c+p,d+k/2);n.closePath();n.fill();n.putImageData(f(n.getImageData(c+p,d+p,u,u),b),c+p,d+p)}var h=document.createElement("canvas"),n=h.getContext("2d"),m=h.width=250,l=h.height=290,k=(m-40)/3,p=.1*k,u=Math.floor(k-2*p),w=.5*u,r={},A={},M={};return function(b,d,f){if(r[b])f(r[b]);else if(M[b])A[b]?A[b].push(f):A[b]=[f];else{var g=e(),k=[];M[b]=!0;A[b]?A[b].push(f):
-A[b]=[f];for(var l in d)d[l].Ma||d[l].ib||k.push({src:"api/avatar?user="+d[l].id});c(k,function(c){a(g,c);r[b]=h.toDataURL();A[b].forEach(function(a){a(r[b])})})}}}();var W=0,K=null,Q=null,T=null,V=null;function lb(){var a=new XMLHttpRequest;a.timeout=6E4;a.onreadystatechange=function(){if(4===a.readyState){var b=document.createElement("script"),c=document.createElement("link");b.innerHTML=a.response;b.language="text/javascript";c.href="hljs-androidstudio.css";c.rel="stylesheet";document.head.appendChild(c);document.body.appendChild(b)}};a.open("GET","highlight.pack.js",!0);a.send(null)}
-function Gb(){var a=K,b=new XMLHttpRequest;b.open("GET","api/hist?room="+a.id,!0);b.onreadystatechange=function(){if(4===b.readyState&&b.response){var c=b.response;try{c=JSON.parse(c)}catch(e){}var d=E.a[a.id];d?d=!!ka(d,c,Date.now()):(E.a[a.id]=new Y(a,100,c,Date.now()),d=!0);d&&(Bb(G(E.context,a.id),a,c),a===K&&R())}};b.send(null)}
-function Hb(a){var b=new XMLHttpRequest;b.timeout=6E4;b.onreadystatechange=function(){if(4===b.readyState)if(b.status){var c=null,d=2===Math.floor(b.status/100);if(d){W&&(W=0,Ya(!0));c=b.response;try{c=JSON.parse(c)}catch(e){c=null}}else W?(W+=Math.floor((W||5)/2),W=Math.min(60,W)):(W=5,Ya(!1));a(d,c)}else W&&(W=0,Ya(!0)),Hb(a)};b.open("GET","api?v="+E.b,!0);b.send(null)}function pb(){var a=new XMLHttpRequest;a.open("POST","api/typing?room="+K.id,!0);a.send(null)}
-function Ib(a,b){a?(b&&E.update(b),tb()):setTimeout(tb,1E3*W)}function tb(){Hb(Ib)}
-function Jb(a){K&&(document.getElementById("room_"+K.id).classList.remove("selected"),document.getElementById("chatSystemContainer").classList.add("no-room-selected"));document.getElementById("room_"+a.id).classList.add("selected");document.body.classList.remove("no-room-selected");K=a;Q=G(E.context,a.id);Za();X.ra();Ua(Q.a.id,Q.j,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"});(!E.a[K.id]||100>E.a[K.id].a.length)&&Gb();document.getElementById("chatSystemContainer").classList.remove("no-room-selected")}
-function Ta(){var a=document.location.hash.substr(1),b=ta(a);b&&b!==K?Jb(b):(a=H(a))&&a.V&&Jb(a.V)}function nb(a,b,c){var d=K;new FileReader;var e=new FormData,f=new XMLHttpRequest;e.append("file",b);e.append("filename",a);f.onreadystatechange=function(){4===f.readyState&&(204===f.status?c(null):c(f.statusText))};f.open("POST","api/file?room="+d.id);f.send(e)}
-function Kb(a,b,c){var d=new XMLHttpRequest;b="api/msg?room="+a.id+"&text="+encodeURIComponent(b);c&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:c.text,author_name:H(c.J).getName(),text:c.text,footer:a.b?J.message:a.name,ts:c.m}])));d.open("POST",b,!0);d.send(null)}
-function ob(a){if(V){var b=new XMLHttpRequest;b.open("PUT","api/msg?room="+K.id+"&ts="+V.id+"&text="+encodeURIComponent(a),!0);b.send(null);return!0}if("/"===a[0]){var c=a.indexOf(" "),b=a.substr(0,-1===c?void 0:c);a=-1===c?"":a.substr(c);var c=Q,d=qb.Pa(b);return d?(d.exec(c,K,a.trim()),!0):c&&(b=c.i.data[b])?(c=new XMLHttpRequest,c.open("POST","api/cmd?room="+K.id+"&cmd="+encodeURIComponent(b.name.substr(1))+"&args="+encodeURIComponent(a.trim()),!0),c.send(null),!0):!1}Kb(K,a,T);return!0}
-function ib(a){var b=new XMLHttpRequest;b.open("DELETE","api/msg?room="+K.id+"&ts="+a.id,!0);b.send(null)}function bb(a,b,c){var d=new XMLHttpRequest;d.open("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c),!0);d.send(null)}function Sa(){var a={},b=[],c=this.value;ra(E.context,function(b){a[b.id]=ia(b,c)});for(var d in a){var e=document.getElementById("room_"+d);e&&(a[d].name+a[d].kb+a[d].ia+a[d].fa?(e.classList.remove("hidden"),b.push(d)):e.classList.add("hidden"))}};var Lb={emojione_v2_3:{Ra:"emojione_v2.3.sprites.js",La:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{Ra:"emojione_v3.sprites.js",La:"emojione_v3.sprites.css",name:"Emojione v3"}},Mb=Lb.emojione_v2_3,Nb;
-function Ob(a){if(Nb!==a){console.log("Loading emoji pack "+a.name);var b=new XMLHttpRequest;b.timeout=6E4;b.onreadystatechange=function(){if(4===b.readyState){var c=document.createElement("script"),d=document.createElement("link");c.innerHTML=b.response;c.language="text/javascript";d.href=a.La;d.rel="stylesheet";document.head.appendChild(d);document.body.appendChild(c);for(var e in E.a)Pb(E.a[e]);R();hb.reset()}};b.open("GET",a.Ra,!0);b.send(null);Nb=a}}
-function Fb(){a:{var a=Cb;for(var b in a.S){var c=a.S[b].emojiProvider;if(c&&Lb[c]){a=c;break a}}a=void 0}Ob(a&&Lb[a]?Lb[a]:Mb)};var X=function(){function a(){d.textContent=r.name;if(r instanceof t)c.style.backgroundImage="url(api/avatar?size=l&user="+r.a.id+")",g.textContent=(r.a.Za||(r.a.Oa||"")+" "+r.a.Sa).trim(),d.classList.add("presence-indicator"),r.a.ua?d.classList.remove("presence-away"):d.classList.add("presence-away"),f.classList.remove("hidden"),n.classList.remove("hidden"),n.textContent=r.a.mb||"",l.textContent=r.a.gb||"",m.classList.remove("hidden"),p.classList.add("hidden"),u.classList.add("hidden"),b.classList.remove("roominfo-channel"),
-b.classList.add("roominfo-user");else{var a=w;a.ca.topic?(f.classList.remove("hidden"),g.textContent=r.ia||"",h.textContent=r.o?J.xa(r.o,r.$):""):f.classList.add("hidden");a.ca.purpose?(m.classList.remove("hidden"),l.textContent=r.fa||"",k.textContent=r.i?J.xa(r.i,r.Z):""):m.classList.add("hidden");c.style.backgroundImage="";d.classList.remove("presence-indicator");p.classList.remove("hidden");u.classList.remove("hidden");b.classList.add("roominfo-channel");b.classList.remove("roominfo-user")}}var b=
-document.createElement("div"),c=document.createElement("header"),d=document.createElement("h3"),e=document.createElement("div"),f=document.createElement("div"),g=document.createElement("span"),h=document.createElement("span"),n=document.createElement("div"),m=document.createElement("div"),l=document.createElement("span"),k=document.createElement("span"),p=document.createElement("div"),u=document.createElement("ul"),w,r;b.className="chat-context-roominfo";c.className="roominfo-title";f.className="roominfo-topic";
-m.className="roominfo-purpose";n.className="roominfo-phone";p.className="roominfo-usercount";u.className="roominfo-userlist";k.className=h.className="roominfo-author";c.appendChild(d);b.appendChild(c);b.appendChild(e);f.appendChild(g);f.appendChild(h);m.appendChild(l);m.appendChild(k);e.appendChild(f);e.appendChild(n);e.appendChild(m);e.appendChild(p);e.appendChild(u);return{Wa:function(b,c){w=b;r=c;a();return this},update:function(){a();return this},show:function(a){a.appendChild(b);b.classList.remove("hidden");
-return this},ra:function(){b.classList.add("hidden");return this}}}();function Y(a,b,c,d){B.call(this,a,b,0,c,d)}Y.prototype=Object.create(B.prototype);Y.prototype.constructor=Y;Y.prototype.i=function(a,b){return!0===a.isMeMessage?new Qb(this.id,a,b):!0===a.isNotice?new Rb(this.id,a,b):new Sb(this.id,a,b)};function Pb(a){a.a.forEach(function(a){a.F()})}
-var Z=function(){function a(a,d){return xa(d,{A:a.context.self.R.A,Y:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=cb(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null},ea:function(c){return b(a,c)}})}function b(a,b){var c=b.indexOf("|");if(-1===c)var d=b;else{d=b.substr(0,c);var g=b.substr(c+1)}if("@"===d[0])if(d=qa(a.context)+"|"+d.substr(1),g=H(d))a=!0,d="#"+g.V.id,g="@"+g.getName();else return null;
-else if("#"===d[0])if(d=qa(a.context)+"|"+d.substr(1),g=ta(d))a=!0,d="#"+d,g="#"+g.name;else return null;else{if(!d.match(/^(https?|mailto):\/\//i))return null;a=!1}return{link:d,text:g||d,Qa:a}}return{F:function(a){a.T=!0;return a},W:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},N:function(a){a.c?a.T&&(a.T=!1,a.I()):a.oa().I();return a.c},I:function(b){var c=H(b.J);b.c.m.innerHTML=J.L(b.m);b.c.wa.innerHTML=a(b,b.text);b.c.pa.textContent=c?c.getName():b.username||"?";for(var c=
-document.createDocumentFragment(),e=0,f=b.s.length;e<f;e++){var g=b.s[e];g&&(g=xb(b,g,e))&&c.appendChild(g)}b.c.s.textContent="";b.c.s.appendChild(c);c=b.b;e=document.createDocumentFragment();if(b.C)for(var h in b.C){var f=c,g=b.id,n=h,m=b.C[h],l=cb(n);if(l){for(var k=document.createElement("li"),p=document.createElement("a"),u=document.createElement("span"),w=document.createElement("span"),r=[],A=0,M=m.length;A<M;A++){var C=H(m[A]);C&&r.push(C.getName())}r.sort();w.textContent=r.join(", ");u.appendChild(l);
-u.className="emoji-small";p.href="javascript:toggleReaction('"+f+"', '"+g+"', '"+n+"')";p.appendChild(u);p.appendChild(w);k.className="chatmsg-reaction-item";k.appendChild(p);f=k}else console.warn("Reaction id not found: "+n),f=null;f&&e.appendChild(f)}b.c.C.textContent="";b.c.C.appendChild(e);b.D&&(b.c.D.innerHTML=J.D(b.D),b.c.classList.add("edited"));return b},K:function(a){return a.c.cloneNode(!0)},w:function(b,d){return a(b,d)}}}();
-function Qb(a,b,c){x.call(this,b,c);this.context=G(E.context,a);this.b=a;this.c=Z.c;this.T=Z.T}Qb.prototype=Object.create(y.prototype);q=Qb.prototype;q.constructor=Qb;q.F=function(){return Z.F(this)};q.w=function(a){return Z.w(this,a)};q.W=function(){return Z.W(this)};q.N=function(){return Z.N(this)};q.oa=function(){this.c=vb(this);this.c.classList.add("chatmsg-me_message");return this};q.K=function(){return Z.K(this)};q.I=function(){Z.I(this);return this};
-q.update=function(a,b){y.prototype.update.call(this,a,b);this.F()};function Sb(a,b,c){x.call(this,b,c);this.context=G(E.context,a);this.b=a;this.c=Z.c;this.T=Z.T}Sb.prototype=Object.create(x.prototype);q=Sb.prototype;q.constructor=Sb;q.F=function(){return Z.F(this)};q.w=function(a){return Z.w(this,a)};q.W=function(){return Z.W(this)};q.N=function(){return Z.N(this)};q.oa=function(){this.c=vb(this);return this};q.K=function(){return Z.K(this)};q.I=function(){Z.I(this);return this};
-q.update=function(a,b){x.prototype.update.call(this,a,b);this.F();if(a=this.text.match(/^<?https:\/\/www\.openstreetmap\.org\/\?mlat=(-?[0-9\.]+)(&amp;|&)mlon=(-?[0-9\.]+)(&amp;|&)macc=([0-9\.]+)[^\s]*/))this.text=this.text.substr(0,a.index)+this.text.substr(a.index+a[0].length).trim(),this.s.unshift({color:"#008000",text:a[0],footer:"Open Street Map",footer_icon:"https://www.openstreetmap.org/assets/favicon-32x32-36d06d8a01933075bc7093c9631cffd02d49b03b659f767340f256bb6839d990.png",geo:{latitude:a[1],
-longitude:a[3],accuracy:a[5]}})};function Rb(a,b,c){x.call(this,b,c);this.context=G(E.context,a);this.b=a;this.a=null;this.T=!0}Rb.prototype=Object.create(z.prototype);q=Rb.prototype;q.constructor=Rb;q.F=function(){return Z.F(this)};q.w=function(a){return Z.w(this,a)};q.W=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};q.N=function(){Z.N(this);return this.a};q.K=function(){return this.a.cloneNode(!0)};
-q.oa=function(){this.c=vb(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=J.Va;this.a.appendChild(this.c);return this};q.I=function(){Z.I(this);return this};q.update=function(a,b){z.prototype.update.call(this,a,b);this.F()};function Eb(){var a=Cb.S,b;for(b in a)if(a.hasOwnProperty(b))return!1;return!0};var Cb;function Db(a){this.S={};for(var b=0,c=a.length;b<c;b++)if(null===a[b].service&&null===a[b].device){var d=void 0,e=JSON.parse(a[b].config);if(e.services)for(d in e.services)this.S[d]=e.services[d]}};var qb=function(){var a=[];return{Pa:function(b){for(var c=0,d=a.length;c<d;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},fb:function(b){var c=[];a.forEach(function(a){for(var d=0,f=a.names.length;d<f;d++)if(a.names[d].substr(0,b.length)===b){c.push(a);break}});return c},nb:function(b){b.U="client";b.exec=b.exec.bind(b);a.push(b)}}}();function Tb(){return new Promise(function(a,b){"geolocation"in window.navigator?navigator.geolocation.getCurrentPosition(function(c){c?a(c):b("denied")}):b("geolocation not available")})}
-va.push(function(){qb.nb({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:J.$a,exec:function(a,b){Tb().then(function(a){var c=a.coords.latitude,e=a.coords.longitude;Kb(b,"https://www.openstreetmap.org/?mlat="+c+"&mlon="+e+"&macc="+a.coords.accuracy+"#map=17/"+c+"/"+e)}).catch(function(a){console.error("Error: ",a)})}})});
+"#"+(1.1*a[0]<<16|1.1*a[1]<<8|1.1*a[2]).toString(16);n.beginPath();n.moveTo(c+k/2,d+q);n.lineTo(c-q+k,d+k/2);n.lineTo(c+k/2,d-q+k);n.lineTo(c+q,d+k/2);n.closePath();n.fill();n.putImageData(f(n.getImageData(c+q,d+q,u,u),b),c+q,d+q)}var h=document.createElement("canvas"),n=h.getContext("2d"),m=h.width=250,l=h.height=290,k=(m-40)/3,q=.1*k,u=Math.floor(k-2*q),w=.5*u,r={},A={},M={};return function(b,d,f){if(r[b])f(r[b]);else if(M[b])A[b]?A[b].push(f):A[b]=[f];else{var g=e(),k=[];M[b]=!0;A[b]?A[b].push(f):
+A[b]=[f];for(var l in d)d[l].Oa||d[l].kb||k.push({src:"api/avatar?user="+d[l].id});c(k,function(c){a(g,c);r[b]=h.toDataURL();A[b].forEach(function(a){a(r[b])})})}}}();var W=0,K=null,Q=null,T=null,V=null;function pb(){var a=new XMLHttpRequest;a.timeout=6E4;a.onreadystatechange=function(){if(4===a.readyState){var b=document.createElement("script"),c=document.createElement("link");b.innerHTML=a.response;b.language="text/javascript";c.href="hljs-androidstudio.css";c.rel="stylesheet";document.head.appendChild(c);document.body.appendChild(b)}};a.open("GET","highlight.pack.js",!0);a.send(null)}
+function Kb(){var a=K,b=new XMLHttpRequest;b.open("GET","api/hist?room="+a.id,!0);b.onreadystatechange=function(){if(4===b.readyState&&b.response){var c=b.response;try{c=JSON.parse(c)}catch(e){}var d=E.a[a.id];d?d=!!ka(d,c,Date.now()):(E.a[a.id]=new Y(a,100,c,Date.now()),d=!0);d&&(Fb(G(E.context,a.id),a,c),a===K&&R())}};b.send(null)}
+function Lb(a){var b=new XMLHttpRequest;b.timeout=6E4;b.onreadystatechange=function(){if(4===b.readyState)if(b.status){var c=null,d=2===Math.floor(b.status/100);if(d){W&&(W=0,Ya(!0));c=b.response;try{c=JSON.parse(c)}catch(e){c=null}}else W?(W+=Math.floor((W||5)/2),W=Math.min(60,W)):(W=5,Ya(!1));a(d,c)}else W&&(W=0,Ya(!0)),Lb(a)};b.open("GET","api?v="+E.b,!0);b.send(null)}function tb(){var a=new XMLHttpRequest;a.open("POST","api/typing?room="+K.id,!0);a.send(null)}
+function Mb(a,b){a?(b&&E.update(b),xb()):setTimeout(xb,1E3*W)}function xb(){Lb(Mb)}
+function Nb(a){K&&(document.getElementById("room_"+K.id).classList.remove("selected"),document.getElementById("chatSystemContainer").classList.add("no-room-selected"));document.getElementById("room_"+a.id).classList.add("selected");document.body.classList.remove("no-room-selected");K=a;Q=G(E.context,a.id);Za();X.ta();Ua(Q.a.id,Q.j,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"});(!E.a[K.id]||100>E.a[K.id].a.length)&&Kb();document.getElementById("chatSystemContainer").classList.remove("no-room-selected")}
+function Ta(){var a=document.location.hash.substr(1),b=ta(a);b&&b!==K?Nb(b):(a=H(a))&&a.V&&Nb(a.V)}function rb(a,b,c){var d=K;new FileReader;var e=new FormData,f=new XMLHttpRequest;e.append("file",b);e.append("filename",a);f.onreadystatechange=function(){4===f.readyState&&(204===f.status?c(null):c(f.statusText))};f.open("POST","api/file?room="+d.id);f.send(e)}
+function Ob(a,b,c){var d=new XMLHttpRequest;b="api/msg?room="+a.id+"&text="+encodeURIComponent(b);c&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:c.text,author_name:H(c.J).getName(),text:c.text,footer:a.b?J.message:a.name,ts:c.m}])));d.open("POST",b,!0);d.send(null)}
+function sb(a){if(V){var b=new XMLHttpRequest;b.open("PUT","api/msg?room="+K.id+"&ts="+V.id+"&text="+encodeURIComponent(a),!0);b.send(null);return!0}if("/"===a[0]){var c=a.indexOf(" "),b=a.substr(0,-1===c?void 0:c);a=-1===c?"":a.substr(c);var c=Q,d=ub.Ra(b);return d?(d.exec(c,K,a.trim()),!0):c&&(b=c.i.data[b])?(c=new XMLHttpRequest,c.open("POST","api/cmd?room="+K.id+"&cmd="+encodeURIComponent(b.name.substr(1))+"&args="+encodeURIComponent(a.trim()),!0),c.send(null),!0):!1}Ob(K,a,T);return!0}
+function mb(a){var b=new XMLHttpRequest;b.open("DELETE","api/msg?room="+K.id+"&ts="+a.id,!0);b.send(null)}function lb(a){var b=new XMLHttpRequest;b.open("POST","api/pinMsg?room="+K.id+"&msgId="+a.id,!0);b.send(null)}function jb(a){var b=new XMLHttpRequest;b.open("POST","api/starMsg?room="+K.id+"&msgId="+a.id,!0);b.send(null)}function kb(a){var b=new XMLHttpRequest;b.open("DELETE","api/pinMsg?room="+K.id+"&msgId="+a.id,!0);b.send(null)}
+function ib(a){var b=new XMLHttpRequest;b.open("DELETE","api/starMsg?room="+K.id+"&msgId="+a.id,!0);b.send(null)}function bb(a,b,c){var d=new XMLHttpRequest;d.open("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c),!0);d.send(null)}
+function Sa(){var a={},b=[],c=this.value;ra(E.context,function(b){a[b.id]=ia(b,c)});for(var d in a){var e=document.getElementById("room_"+d);e&&(a[d].name+a[d].mb+a[d].ka+a[d].ha?(e.classList.remove("hidden"),b.push(d)):e.classList.add("hidden"))}};var Pb={emojione_v2_3:{Ta:"emojione_v2.3.sprites.js",Na:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{Ta:"emojione_v3.sprites.js",Na:"emojione_v3.sprites.css",name:"Emojione v3"}},Qb=Pb.emojione_v2_3,Rb;
+function Sb(a){if(Rb!==a){console.log("Loading emoji pack "+a.name);var b=new XMLHttpRequest;b.timeout=6E4;b.onreadystatechange=function(){if(4===b.readyState){var c=document.createElement("script"),d=document.createElement("link");c.innerHTML=b.response;c.language="text/javascript";d.href=a.Na;d.rel="stylesheet";document.head.appendChild(d);document.body.appendChild(c);for(var e in E.a)Tb(E.a[e]);K&&R();hb.reset()}};b.open("GET",a.Ta,!0);b.send(null);Rb=a}}
+function Jb(){a:{var a=Gb;for(var b in a.S){var c=a.S[b].emojiProvider;if(c&&Pb[c]){a=c;break a}}a=void 0}Sb(a&&Pb[a]?Pb[a]:Qb)};var X=function(){function a(){d.textContent=r.name;if(r instanceof t)c.style.backgroundImage="url(api/avatar?size=l&user="+r.a.id+")",g.textContent=(r.a.ab||(r.a.Qa||"")+" "+r.a.Ua).trim(),d.classList.add("presence-indicator"),r.a.wa?d.classList.remove("presence-away"):d.classList.add("presence-away"),f.classList.remove("hidden"),n.classList.remove("hidden"),n.textContent=r.a.ob||"",l.textContent=r.a.ib||"",m.classList.remove("hidden"),q.classList.add("hidden"),u.classList.add("hidden"),b.classList.remove("roominfo-channel"),
+b.classList.add("roominfo-user");else{var a=w;a.Y.topic?(f.classList.remove("hidden"),g.textContent=r.ka||"",h.textContent=r.o?J.za(r.o,r.ba):""):f.classList.add("hidden");a.Y.purpose?(m.classList.remove("hidden"),l.textContent=r.ha||"",k.textContent=r.i?J.za(r.i,r.$):""):m.classList.add("hidden");c.style.backgroundImage="";d.classList.remove("presence-indicator");q.classList.remove("hidden");u.classList.remove("hidden");b.classList.add("roominfo-channel");b.classList.remove("roominfo-user")}}var b=
+document.createElement("div"),c=document.createElement("header"),d=document.createElement("h3"),e=document.createElement("div"),f=document.createElement("div"),g=document.createElement("span"),h=document.createElement("span"),n=document.createElement("div"),m=document.createElement("div"),l=document.createElement("span"),k=document.createElement("span"),q=document.createElement("div"),u=document.createElement("ul"),w,r;b.className="chat-context-roominfo";c.className="roominfo-title";f.className="roominfo-topic";
+m.className="roominfo-purpose";n.className="roominfo-phone";q.className="roominfo-usercount";u.className="roominfo-userlist";k.className=h.className="roominfo-author";c.appendChild(d);b.appendChild(c);b.appendChild(e);f.appendChild(g);f.appendChild(h);m.appendChild(l);m.appendChild(k);e.appendChild(f);e.appendChild(n);e.appendChild(m);e.appendChild(q);e.appendChild(u);return{Ya:function(b,c){w=b;r=c;a();return this},update:function(){a();return this},show:function(a){a.appendChild(b);b.classList.remove("hidden");
+return this},ta:function(){b.classList.add("hidden");return this}}}();function Y(a,b,c,d){B.call(this,a,b,0,c,d)}Y.prototype=Object.create(B.prototype);Y.prototype.constructor=Y;Y.prototype.i=function(a,b){return!0===a.isMeMessage?new Ub(this.id,a,b):!0===a.isNotice?new Vb(this.id,a,b):new Wb(this.id,a,b)};function Tb(a){a.a.forEach(function(a){a.G()})}
+var Z=function(){function a(a,d){return xa(d,{B:a.context.self.R.B,Z:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=cb(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null},ga:function(c){return b(a,c)}})}function b(a,b){var c=b.indexOf("|");if(-1===c)var d=b;else{d=b.substr(0,c);var g=b.substr(c+1)}if("@"===d[0])if(d=qa(a.context)+"|"+d.substr(1),g=H(d))a=!0,d="#"+g.V.id,g="@"+g.getName();else return null;
+else if("#"===d[0])if(d=qa(a.context)+"|"+d.substr(1),g=ta(d))a=!0,d="#"+d,g="#"+g.name;else return null;else{if(!d.match(/^(https?|mailto):\/\//i))return null;a=!1}return{link:d,text:g||d,Sa:a}}return{G:function(a){a.T=!0;return a},W:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},N:function(a){a.c?a.T&&(a.T=!1,a.I()):a.qa().I();return a.c},I:function(b){var c=H(b.J);b.c.m.innerHTML=J.L(b.m);b.c.ya.innerHTML=a(b,b.text);b.c.ra.textContent=c?c.getName():b.username||"?";for(var c=
+document.createDocumentFragment(),e=0,f=b.s.length;e<f;e++){var g=b.s[e];g&&(g=Bb(b,g,e))&&c.appendChild(g)}b.c.s.textContent="";b.c.s.appendChild(c);c=b.b;e=document.createDocumentFragment();if(b.D)for(var h in b.D){var f=c,g=b.id,n=h,m=b.D[h],l=cb(n);if(l){for(var k=document.createElement("li"),q=document.createElement("a"),u=document.createElement("span"),w=document.createElement("span"),r=[],A=0,M=m.length;A<M;A++){var C=H(m[A]);C&&r.push(C.getName())}r.sort();w.textContent=r.join(", ");u.appendChild(l);
+u.className="emoji-small";q.href="javascript:toggleReaction('"+f+"', '"+g+"', '"+n+"')";q.appendChild(u);q.appendChild(w);k.className="chatmsg-reaction-item";k.appendChild(q);f=k}else console.warn("Reaction id not found: "+n),f=null;f&&e.appendChild(f)}b.c.D.textContent="";b.c.D.appendChild(e);b.c.aa.fa&&(b.c.aa.fa.style.backgroundImage=b.A?'url("star_full.png")':'url("star_empty.png")');b.F&&(b.c.F.innerHTML=J.F(b.F),b.c.classList.add("edited"));return b},K:function(a){return a.c.cloneNode(!0)},
+w:function(b,d){return a(b,d)}}}();function Ub(a,b,c){x.call(this,b,c);this.context=G(E.context,a);this.b=a;this.c=Z.c;this.T=Z.T}Ub.prototype=Object.create(y.prototype);p=Ub.prototype;p.constructor=Ub;p.G=function(){return Z.G(this)};p.w=function(a){return Z.w(this,a)};p.W=function(){return Z.W(this)};p.N=function(){return Z.N(this)};p.qa=function(){this.c=zb(this);this.c.classList.add("chatmsg-me_message");return this};p.K=function(){return Z.K(this)};p.I=function(){Z.I(this);return this};
+p.update=function(a,b){y.prototype.update.call(this,a,b);this.G()};function Wb(a,b,c){x.call(this,b,c);this.context=G(E.context,a);this.b=a;this.c=Z.c;this.T=Z.T}Wb.prototype=Object.create(x.prototype);p=Wb.prototype;p.constructor=Wb;p.G=function(){return Z.G(this)};p.w=function(a){return Z.w(this,a)};p.W=function(){return Z.W(this)};p.N=function(){return Z.N(this)};p.qa=function(){this.c=zb(this);return this};p.K=function(){return Z.K(this)};p.I=function(){Z.I(this);return this};
+p.update=function(a,b){x.prototype.update.call(this,a,b);this.G();if(a=this.text.match(/^<?https:\/\/www\.openstreetmap\.org\/\?mlat=(-?[0-9\.]+)(&amp;|&)mlon=(-?[0-9\.]+)(&amp;|&)macc=([0-9\.]+)[^\s]*/))this.text=this.text.substr(0,a.index)+this.text.substr(a.index+a[0].length).trim(),this.s.unshift({color:"#008000",text:a[0],footer:"Open Street Map",footer_icon:"https://www.openstreetmap.org/assets/favicon-32x32-36d06d8a01933075bc7093c9631cffd02d49b03b659f767340f256bb6839d990.png",geo:{latitude:a[1],
+longitude:a[3],accuracy:a[5]}})};function Vb(a,b,c){x.call(this,b,c);this.context=G(E.context,a);this.b=a;this.a=null;this.T=!0}Vb.prototype=Object.create(z.prototype);p=Vb.prototype;p.constructor=Vb;p.G=function(){return Z.G(this)};p.w=function(a){return Z.w(this,a)};p.W=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};p.N=function(){Z.N(this);return this.a};p.K=function(){return this.a.cloneNode(!0)};
+p.qa=function(){this.c=zb(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=J.Xa;this.a.appendChild(this.c);return this};p.I=function(){Z.I(this);return this};p.update=function(a,b){z.prototype.update.call(this,a,b);this.G()};function Ib(){var a=Gb.S,b;for(b in a)if(a.hasOwnProperty(b))return!1;return!0};var Gb;function Hb(a){this.S={};for(var b=0,c=a.length;b<c;b++)if(null===a[b].service&&null===a[b].device){var d=void 0,e=JSON.parse(a[b].config);if(e.services)for(d in e.services)this.S[d]=e.services[d]}};var ub=function(){var a=[];return{Ra:function(b){for(var c=0,d=a.length;c<d;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},hb:function(b){var c=[];a.forEach(function(a){for(var d=0,f=a.names.length;d<f;d++)if(a.names[d].substr(0,b.length)===b){c.push(a);break}});return c},pb:function(b){b.U="client";b.exec=b.exec.bind(b);a.push(b)}}}();function Xb(){return new Promise(function(a,b){"geolocation"in window.navigator?navigator.geolocation.getCurrentPosition(function(c){c?a(c):b("denied")}):b("geolocation not available")})}
+va.push(function(){ub.pb({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:J.bb,exec:function(a,b){Xb().then(function(a){var c=a.coords.latitude,e=a.coords.longitude;Ob(b,"https://www.openstreetmap.org/?mlat="+c+"&mlon="+e+"&macc="+a.coords.accuracy+"#map=17/"+c+"/"+e)}).catch(function(a){console.error("Error: ",a)})}})});
 })();

+ 1 - 0
srv/public/pin.svg

@@ -0,0 +1 @@
+<?xml version="1.0" ?><svg height="1024" width="519.657" xmlns="http://www.w3.org/2000/svg"><path d="M196.032 704l64 320 64-320c-20.125 2-41.344 3.188-62.281 3.188C239.22 707.188 217.47 706.312 196.032 704zM450.032 404.688c-16.188-15.625-40.312-44.375-62-84.688v-64c7.562-12.406 12.25-39.438 23.375-51.969 15.25-13.375 24-28.594 24-44.875 0-53.094-61.062-95.156-175.375-95.156-114.25 0-182.469 42.062-182.469 95.094 0 16 8.469 31.062 23.375 44.312 13.438 14.844 22.719 38 31.094 52.594v64c-32.375 62.656-82 96.188-82 96.188h0.656C18.749 437.876 0 464.126 0 492.344 0.063 566.625 101.063 640.062 260.032 640c159 0.062 259.625-73.375 259.625-147.656C519.657 458.875 493.407 428.219 450.032 404.688z"/></svg>

+ 8 - 0
srv/src/context.js

@@ -283,6 +283,14 @@ ChatContext.prototype.getWhoIsTyping = function(now) {
     return res;
 };
 
+ChatContext.prototype.getChannelsWithName = function(name) {
+    var chans = [];
+    for (var i in this.channels)
+        if (this.channels[i].name === name)
+            chans.push(this.channels[i]);
+    return chans;
+};
+
 /**
  * @param {number} now
 **/

+ 27 - 0
srv/src/controller/apiController.js

@@ -300,6 +300,33 @@ module.exports.ApiController = {
                 res.end();
             }
             sessionManager.saveSession(req.session);
+        } else if (req.urlObj.match(["api", "starMsg"])) {
+            if (req.urlObj.queryTokens.room && req.urlObj.queryTokens.msgId) {
+                var ctx = res.chatContext.getChannelContext(req.urlObj.queryTokens.room[0]);
+
+                if (!ctx) {
+                    res.writeHeader("404", "Not Found");
+                    res.end();
+                } else if (!ctx.getChatContext().capacities.starMsg) {
+                    res.writeHeader("400", "Bad Request");
+                    res.end();
+                } else if (req.method === 'POST') {
+                    ctx.starMsg(ctx.getChatContext().channels[req.urlObj.queryTokens.room[0]], req.urlObj.queryTokens.msgId[0]);
+                    res.writeHeader("204", "No Content");
+                    res.end();
+                } else if (req.method === 'DELETE') {
+                    ctx.unstarMsg(ctx.getChatContext().channels[req.urlObj.queryTokens.room[0]], req.urlObj.queryTokens.msgId[0]);
+                    res.writeHeader("204", "No Content");
+                    res.end();
+                } else {
+                    res.writeHeader("400", "Bad Request");
+                    res.end();
+                }
+            } else {
+                res.writeHeader("400", "Bad Request");
+                res.end();
+            }
+        } else if (req.urlObj.match(["api", "pinMsg"])) {
         } else if (req.urlObj.match(["api"])) {
             res.chatContext.poll(
                 (req.urlObj.queryTokens.v ? parseInt(req.urlObj.queryTokens.v[0], 10) : 0) || 0, (newData) => {

+ 2 - 6
srv/src/message.js

@@ -24,10 +24,7 @@ function Message(e, ts) {
     this.attachments = [];
 
     /** @type {boolean} */
-    this.starred = false;
-
-    /** @type {boolean} */
-    this.pinned = false;
+    this.starred = e["is_starred"] || false;
 
     /** @type {number|boolean} */
     this.edited = false;
@@ -72,7 +69,6 @@ Message.prototype.update = function(e, ts) {
         this.text = e["text"] || "";
         if (e["attachments"]) this.attachments = e["attachments"];
         this.starred = !!e["is_starred"];
-        this.pinned = false; // TODO
         this.edited = e["edited"] === undefined ? false : e["edited"];
         this.removed = !!e["removed"];
 
@@ -108,7 +104,7 @@ Message.prototype.toStatic = function() {
         ,"ts": this.ts
         ,"text": this.text
         ,"attachments": this.attachments.length ? this.attachments : undefined
-        ,"is_starred": this.is_starred || undefined
+        ,"is_starred": this.starred || undefined
         ,"edited": this.edited === false ? undefined : this.edited
         ,"removed": this.removed || undefined
         ,"reactions": reactions

+ 14 - 0
srv/src/multichatManager.js

@@ -31,6 +31,20 @@ ChatSystem.prototype.sendMeMsg = function(chan, text) {};
 **/
 ChatSystem.prototype.sendMsg = function(chan, text, attachments) {};
 
+/**
+ * Async star msg
+ * @param {Room} chan
+ * @param {string} msgId
+**/
+ChatSystem.prototype.starMsg = function(chan, msgId) {};
+
+/**
+ * Async remove star from msg
+ * @param {Room} chan
+ * @param {string} msgId
+**/
+ChatSystem.prototype.unstarMsg = function(chan, msgId) {};
+
 /**
  * Async fetch history
  * @param {Room} chan

+ 5 - 0
srv/src/room.js

@@ -39,6 +39,8 @@ function Room(id) {
     this.version = 0;
     /** @type {boolean} */
     this.isPrivate;
+    /** @type {Array<Message>|null} */
+    this.pins;
 };
 
 /**
@@ -71,6 +73,7 @@ Room.prototype.toStatic = function(t) {
         ,"last_msg": this.lastMsg
         ,"is_private": this.isPrivate
         ,"is_starred": this.starred || undefined
+        ,"pins": this.pins
     };
     if (this.isMember) {
         res["members"] = this.users ? Object.keys(this.users) : [];
@@ -104,6 +107,7 @@ Room.prototype.update = function(chanData, ctx, t, idPrefix) {
     if (chanData["last_read"] !== undefined) this.lastRead = Math.max(parseFloat(chanData["last_read"]), this.lastRead);
     if (chanData["last_msg"] !== undefined) this.lastMsg = parseFloat(chanData["last_msg"]);
     if (chanData["is_private"] !== undefined) this.isPrivate = chanData["is_private"];
+    if (chanData["pins"] !== undefined) this.pins = chanData["pins"];
     this.starred = !!chanData["is_starred"];
     if (chanData["members"]) {
         this.users = {};
@@ -164,6 +168,7 @@ PrivateMessageRoom.prototype.toStatic = function(t) {
         ,"last_msg": this.lastMsg
         ,"pv": true
         ,"is_starred": this.starred || undefined
+        ,"pins": this.pins
     };
 };
 

+ 90 - 15
srv/src/slack.js

@@ -22,6 +22,8 @@ const SLACK_ENDPOINT = "https://slack.com/api/"
         ,groupHistory: "groups.history"
         ,starChannel: "stars.add"
         ,unstarChannel: "stars.remove"
+        ,starMsg: "stars.add"
+        ,unstarMsg: "stars.remove"
         ,postMsg: "chat.postMessage"
         ,postMeMsg: "chat.meMessage"
         ,editMsg: "chat.update"
@@ -31,6 +33,8 @@ const SLACK_ENDPOINT = "https://slack.com/api/"
         ,setPresence: "users.setPresence"
         ,emojiList: "emoji.list"
         ,slashList: "commands.list"
+        ,listPinned: "pins.list"
+        ,listMpims: "mpim.list"
         ,slashExec: "chat.command"
         ,addReaction: "reactions.add"
         ,removeReaction: "reactions.remove"
@@ -210,19 +214,22 @@ Slack.prototype.onMessage = function(msg, t) {
     }
     if (msg["type"] === "hello" && msg["start"] && msg["start"]["rtm_start"]) {
         var _this = this;
-        _this.getEmojis((emojis) => {
-            _this.getSlashCommands((commands) => {
-                var msgContent = msg.start.rtm_start;
-                var now = Date.now();
-                msgContent.self = msg.self;
-                msgContent.emojis = emojis;
-                msgContent.commands = commands;
-
-                _this.resetVersions(now);
-                _this.data.updateStatic(msgContent, now);
-                _this.connected = true;
-                _this.unstackPendingMessages();
-                _this.ping();
+        _this.getRawMpims((mpims) => {
+            _this.getEmojis((emojis) => {
+                _this.getSlashCommands((commands) => {
+                    var msgContent = msg.start.rtm_start;
+                    var now = Date.now();
+                    msgContent.self = msg.self;
+                    msgContent.emojis = emojis;
+                    msgContent.commands = commands;
+                    msgContent.mpims = mpims;
+
+                    _this.resetVersions(now);
+                    _this.data.updateStatic(msgContent, now);
+                    _this.connected = true;
+                    _this.unstackPendingMessages();
+                    _this.ping();
+                });
             });
         });
     } else if (this.connected) {
@@ -248,6 +255,16 @@ Slack.prototype.onMessage = function(msg, t) {
     }
 };
 
+Slack.prototype.getRawMpims = function(cb) {
+    httpsRequest(SLACK_ENDPOINT +GETAPI.listMpims
+        +"?token=" +this.token, (status, content) => {
+        if (status === 200 && content.ok)
+            cb(content.groups);
+        else
+            cb(undefined);
+    });
+};
+
 /**
  * @param {SlackChan|SlackGroup|SlackIms} chan
  * @param {string} id
@@ -277,8 +294,7 @@ Slack.prototype.connectRtm = function(url, cb) {
     url = url.substr(protocol.length);
     url = protocol +url.substr(0, url.indexOf('/'))+
         "/?flannel=1&token=" +this.token+
-        "&start_args="+
-        encodeURIComponent("?simple_latest=true&presence_sub=true&mpim_aware=false&canonical_avatars=true")
+        "&start_args=" +encodeURIComponent("?simple_latest=true&presence_sub=true&canonical_avatars=true")
     this.rtm = new WebSocket(url);
     this.rtm.on("message", function(msg) {
         if (!_this.connected && cb) {
@@ -570,6 +586,28 @@ Slack.prototype.unstarChannel = function(channel) {
         +"&channel=" +channel.remoteId);
 };
 
+/**
+ * @param {SlackChan|SlackGroup|SlackIms} channel
+ * @param {string} msgId
+**/
+Slack.prototype.starMsg = function(channel, msgId) {
+    httpsRequest(SLACK_ENDPOINT +GETAPI.starChannel
+        +"?token=" +this.token
+        +"&channel=" +channel.remoteId
+        +"&timestamp=" +msgId);
+};
+
+/**
+ * @param {SlackChan|SlackGroup|SlackIms} channel
+ * @param {string} msgId
+**/
+Slack.prototype.unstarMsg = function(channel, msgId) {
+    httpsRequest(SLACK_ENDPOINT +GETAPI.unstarChannel
+        +"?token=" +this.token
+        +"&channel=" +channel.remoteId
+        +"&timestamp=" +msgId);
+};
+
 /**
  * @param {SlackChan|SlackGroup|SlackIms} channel
  * @param {Array.<string>} text
@@ -629,6 +667,33 @@ Slack.prototype.editMsg = function(channel, msgId, text) {
         +"&as_user=true");
 };
 
+/**
+ * @param {SlackChan|SlackGroup|SlackIms} target
+**/
+Slack.prototype.fetchPinned = function(target) {
+    var _this = this;
+
+    httpsRequest(SLACK_ENDPOINT +GETAPI.listPinned
+        +"?token="+this.token
+        +"&channel=" +target.remoteId,
+    (status, resp) => {
+        if (status === 200 && resp && resp.ok) {
+            var msgs = [],
+                histo = _this.history[target.id],
+                now = Date.now();
+
+            if (!histo)
+                histo = _this.history[target.id] = new SlackHistory(_this, target.remoteId, target.id, this.data.team.id +'|', HISTORY_LENGTH, HISTORY_MAX_AGE);
+            resp.items.forEach(function(msg) {
+                msgs.push(histo.messageFactory(msg.message, now));
+            });
+            target.pins = msgs;
+            target.version = Math.max(target.version, now);
+            _this.data.staticV = Math.max(_this.data.staticV, now);
+        }
+    });
+};
+
 /**
  * @param {SlackChan|SlackGroup|SlackIms} target
 **/
@@ -647,6 +712,7 @@ Slack.prototype.fetchHistory = function(target, cb, count, firstMsgId) {
     httpsRequest(baseUrl
         +"?token="+this.token
         +"&channel=" +targetId
+        +"&include_pin_count=true"
         +(firstMsgId ? ("&inclusive=true&latest=" +firstMsgId) : "")
         +"&count=" +(count || 100),
     (status, resp) => {
@@ -659,6 +725,15 @@ Slack.prototype.fetchHistory = function(target, cb, count, firstMsgId) {
                 respMsg["id"] = respMsg["ts"];
                 history.push(histo.messageFactory(histo.prepareMessage(respMsg)));
             });
+            if (!target.pins || target.pins.length !== resp["pin_count"]) {
+                if (!resp["pin_count"]) {
+                    target.pins = [];
+                    target.v = Math.max(target.v, Date.now());
+                    _this.data.staticV = Math.max(_this.data.staticV, target.v);
+                } else {
+                    _this.fetchPinned(target);
+                }
+            }
         }
         cb(history);
     });

+ 16 - 13
srv/src/slackData.js

@@ -69,7 +69,7 @@ SlackChan.prototype.setNameFromMembers = function() {
     var userNames = [];
     for (var i in this.users)
         if (!this.users[i].deleted)
-            userNames.push(this.users[i].name);
+            userNames.push(this.users[i].getName());
     userNames.sort();
     this.name = userNames.join(", ");
 };
@@ -221,11 +221,14 @@ function SlackData(slack) {
     this.slack = slack;
 
     this.capacities = {
-        starMessage: true,
+        starMsg: true,
+        pinMsg: true,
         starChannel: true,
-        msgReactions: true,
+        reactMsg: true,
         editMsg: true,
+        //editOtherMsg: false, // ability to edit other chatter's msg
         removeMsg: true,
+        //moderateMsg: false, // ability to remove other chatter's msg
         replyToMsg: true,
         topic: true,
         purpose: true
@@ -336,20 +339,20 @@ SlackData.prototype.onMessage = function(msg, t) {
             this.staticV = channel.version = Math.max(channel.version, t);
         }
     } else if (msg["type"] === "star_added") {
-        if (msg["user"] === this.self.remoteId) {
-            var target = this.getChannelByRemoteId(msg["item"]["channel"]);
-            if (target && !target.starred) {
-                target.starred = true;
-                target.version = Math.max(target.version, t);
+        if (msg["user"] === this.self.remoteId && msg["item"]["type"] !== "message") {
+            var targetChan = this.getChannelByRemoteId(msg["item"]["channel"]);
+            if (targetChan && !targetChan.starred) {
+                targetChan.starred = true;
+                targetChan.version = Math.max(targetChan.version, t);
                 this.staticV = Math.max(this.staticV, t);
             }
         }
     } else if (msg["type"] === "star_removed") {
-        if (msg["user"] === this.self.remoteId) {
-            var target = this.getChannelByRemoteId(msg["item"]["channel"]);
-            if (target && target.starred) {
-                target.starred = false;
-                target.version = Math.max(target.version, t);
+        if (msg["user"] === this.self.remoteId && msg["item"]["type"] !== "message") {
+            var targetChan = this.getChannelByRemoteId(msg["item"]["channel"]);
+            if (targetChan && targetChan.starred) {
+                targetChan.starred = false;
+                targetChan.version = Math.max(targetChan.version, t);
                 this.staticV = Math.max(this.staticV, t);
             }
         }

+ 6 - 0
srv/src/slackHistory.js

@@ -87,6 +87,9 @@ SlackHistory.prototype.push = function(ev, t) {
             else
                 targetId = ev["deleted_ts"];
             modifArg = null;
+        } else if (ev["subtype"] === "star_changed") {
+            modifArg = ev["message"];
+            targetId = ev["message"]["ts"];
         }
         var msg = this.getMessageById(targetId);
         if (msg) {
@@ -132,6 +135,9 @@ SlackHistory.prototype.push = function(ev, t) {
                 }
             }, 1, ev["item"]["ts"]);
         }
+    } else if (ev["type"] === "star_added" || ev["type"] === "star_removed") {
+        ev["item"]["subtype"] = "star_changed";
+        return this.push(ev["item"], t);
     } else {
         return 0;
     }