| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- "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.zb=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.Z=a.category}function ca(){this.a={};this.G=[];this.version=0}
- ca.prototype.update=function(a,b){a.emoji_use&&(this.a=JSON.parse(a.emoji_use));a.highlight_words?this.G=(a.highlight_words||"").split(",").filter(function(a){return""!==a.trim()}):a.highlights&&(this.G=a.highlights);this.version=Math.max(this.version,b)};function da(){this.a=null;this.m={};this.l={};this.self=null;this.b={version:0,data:{}};this.j={version:0,data:{}};this.A={};this.Y={};this.s=0}function ea(a,b){return b.pv?new r(b.id,a.l[b.user]):new u(b.id)}
- function fa(a,b,c){var e=e||"";b.team&&(a.a||(a.a=new aa(b.team.id)),a.a.update(b.team,c));if(b.users)for(var d=0,f=b.users.length;d<f;d++){var g=a.l[e+b.users[d].id];g||(g=a.l[e+b.users[d].id]=new ga(b.users[d].id));g.update(b.users[d],c)}if(b.channels)for(d=0,f=b.channels.length;d<f;d++)(g=a.m[e+b.channels[d].id])||(g=a.m[e+b.channels[d].id]=ea(a,b.channels[d])),g.update(b.channels[d],a,c,e);b.emojis&&(a.b.data=b.emojis,a.b.version=c);if(void 0!==b.commands){a.j.data={};for(d in b.commands)a.j.data[d]=
- new ba(b.commands[d]);a.j.version=c}b.self&&(a.self=a.l[e+b.self.id]||null,a.self.W||(a.self.W=new ca),b.self.prefs&&a.self.W.update(b.self.prefs,c));b.capacities&&(a.Y={},b.capacities.forEach(function(a){this.Y[a]=!0},a));a.s=Math.max(a.s,c)}"undefined"!==typeof module&&(module.M.Rb=da,module.M.Sb=aa,module.M.Ub=ba);function u(a){this.id=a;this.D=!1;this.C=0;this.l={};this.version=0}function ha(a,b,c){if(!a.F||a.F<b)a.F=b,a.version=c}
- u.prototype.update=function(a,b,c,e){e=e||"";void 0!==a.name&&(this.name=a.name);void 0!==a.is_archived&&(this.la=a.is_archived);void 0!==a.is_member&&(this.da=a.is_member);void 0!==a.last_read&&(this.C=Math.max(parseFloat(a.last_read),this.C));void 0!==a.last_msg&&(this.F=parseFloat(a.last_msg));this.F&&(this.C=Math.min(this.C,this.F));void 0!==a.is_private&&(this.j=a.is_private);void 0!==a.pins&&(this.b=a.pins);this.D=!!a.is_starred;if(a.members&&(this.l={},a.members))for(var d=0,f=a.members.length;d<
- f;d++){var g=b.l[e+a.members[d]];this.l[g.id]=g;g.m[this.id]=this}a.topic&&(this.za=a.topic.value,this.w=b.l[e+a.topic.creator],this.ga=a.topic.last_set);a.purpose&&(this.va=a.purpose.value,this.s=b.l[e+a.purpose.creator],this.fa=a.purpose.last_set);this.version=Math.max(this.version,c)};function ia(a,b){var c=ja;return{name:c.oa(b,a.name),sa:c.oa(b,Object.values(a.l),function(a){return a?a.getName():null}),za:c.oa(b,a.za),va:c.oa(b,a.va)}}
- function r(a,b){u.call(this,a);this.a=b;this.name=b.getName();this.j=!0;b.S=this}r.prototype=Object.create(u.prototype);r.prototype.constructor=r;"undefined"!==typeof module&&(module.M.$b=u,module.M.Zb=r);function w(a,b){this.O=a.user;this.username=a.username;this.id=a.id||a.ts;this.f=parseFloat(a.ts);this.text="";this.u=[];this.D=a.is_starred||!1;this.b=this.I=!1;this.H={};this.version=b;this.update(a,b)}function x(a,b){w.call(this,a,b)}function y(a,b){w.call(this,a,b)}
- w.prototype.update=function(a,b){if(a){this.text=a.text||"";a.attachments&&(this.u=a.attachments);this.D=!!a.is_starred;this.I=void 0===a.edited?!1:a.edited;this.b=!!a.removed;if(a.reactions){var c={};a.reactions.forEach(function(a){c[a.name]=[];a.users.forEach(function(b){c[a.name].push(b)})});this.H=c}a.pendingId&&(this.ta=a.pendingId)}else this.b=!0;this.version=b};function ka(a,b,c,e,d){this.id="string"===typeof a?a:a.id;this.i=[];this.b=c;this.tb=0;this.j=b;e&&la(this,e,d)}
- function la(a,b,c){var e=0;b.forEach(function(a){e=Math.max(this.push(a,c),e)}.bind(a));ma(a);return e}ka.prototype.a=function(a,b){return!0===a.isMeMessage?new x(a,b):!0===a.isNotice?new y(a,b):new w(a,b)};
- ka.prototype.push=function(a,b){for(var c,e=!1,d,f=0,g=this.i.length;f<g;f++)if(c=this.i[f],c.id===a.id){d=c.update(a,b);e=!0;break}e||(c=this.a(a,b),this.i.push(c),d=c.f);for(;this.i.length>this.j;)this.i.shift();if(this.b)for(a=0;a<this.i.length;a++)this.i[a].version<b-this.b&&this.i.splice(a--,1);return d||0};function na(a){return a.i[a.i.length-1]}
- function oa(a){var b=C.a[D.id];if(a.indexOf(b.id))return null;a=a.substr(b.id.length+1);for(var c=0,e=b.i.length;c<e;c++)if(b.i[c].id==a)return b.i[c];return null}function ma(a){a.i.sort(function(a,c){return a.f-c.f})}x.prototype=Object.create(w.prototype);x.prototype.constructor=x;y.prototype=Object.create(w.prototype);y.prototype.constructor=y;"undefined"!==typeof module&&(module.M={Wb:w,Vb:x,Yb:y,ac:ka});function ga(a){this.id=a;this.m={};this.S=this.W=null;this.version=0}
- ga.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.bb=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.goal&&(this.Bb=a.goal);void 0!==a.phone&&(this.Lb=a.phone);void 0!==a.first_name&&(this.eb=a.first_name);void 0!==a.last_name&&(this.ib=a.last_name);void 0!==a.real_name&&(this.qb=a.real_name);void 0!==a.isPresent&&(this.R=a.isPresent);a.isBot&&(this.Fb=a.isBot);this.version=Math.max(this.version,b)};
- function pa(a){return"api/avatar?user="+encodeURIComponent(a.id)}ga.prototype.getName=function(){return this.name||this.qb||this.eb||this.ib};"undefined"!==typeof module&&(module.M.Tb=ga);function qa(){this.a=[]}qa.prototype.push=function(a){this.a.push(a)};function ra(a,b){for(var c=0,e=a.a.length;c<e;c++)if(b===sa(a.a[c]))return a.a[c];return null}function ta(a,b){for(var c=0,e=a.a.length;c<e;c++){var d=a.a[c],f;for(f in d.m)if(!0===b(d.m[f],f))return}}function ua(a){for(var b=C.context,c=0,e=b.a.length;c<e&&!0!==a(b.a[c]);c++);}function E(a,b){for(var c=0,e=a.a.length;c<e;c++)if(a.a[c].m[b])return a.a[c];return null}
- function va(a){for(var b=C.context,c=0,e=b.a.length;c<e;c++){var d=b.a[c].m[a];if(d)return d}return null}function wa(a){for(var b=C.context,c=[],e=0,d=b.a.length;e<d;e++){var f=b.a[e].m,g;for(g in f)a&&!a(f[g],b.a[e],g)||c.push(g)}return c}function G(a){for(var b=C.context,c=0,e=b.a.length;c<e;c++){var d=b.a[c].l[a];if(d)return d}return null}qa.prototype.Ia=function(a){for(var b=0,c=this.a.length;b<c;b++){var e=this.a[b];if(e.self&&e.self.id===a)return!0}return!1};
- "undefined"!==typeof module&&(module.M.Xb=qa);var ja=function(){function a(b,c,e){if(Array.isArray(c)){for(var d=0,f=0,g=c.length;f<g;f++){var k=a(b,c[f],e);if(1===k)return 1;d=Math.max(k,d)}return d}return(c=e?e(c):c)&&void 0!==b&&null!==b?b.length?-1===c.indexOf(b)?0:b.length/c.length:1:0}return{oa:a}}();"undefined"!==typeof module&&(module.M.bc=ja);var H={},K,xa=[];function za(){if(!c){for(var a=0,b=navigator.languages.length;a<b;a++)if(H.hasOwnProperty(navigator.languages[a])){var c=navigator.languages[a];break}c||(c="en")}K=H[c];console.log("Loading language pack: "+c);if(K.c)for(var e in K.c)if(c=document.getElementById(e))c.textContent=K.c[e];xa.forEach(function(a){a()})};H.fr={Qb:"Utilisateur inconnu",Pb:"Channel inconnu",Ja:"Nouveau message",message:"Message",kb:"Reseau",lb:"(visible seulement par vous)",D:"Favoris",m:"Discutions",sa:"Membres",pb:"Discutions priv\u00e9es",rb:"Partage sa position GPS",ok:"Ok",cb:"Annuler",U: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()},fb:function(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()?"aujourd'hui":a.getTime()>c.getTime()?"hier":a.toLocaleDateString()},Ga:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Annuler",neterror:"Impossible de se connecter au chat !",ctxMenuSettings:"Configuration",ctxMenuLogout:"D\u00e9connexion",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","settings-displayEmojiProviderLbl":"Gestionnaire d'emojis","settings-displayDisplayAvatarLbl":"Afficher les avatars",
- "settings-displayColorfulNamesLbl":"Afficher les nomes en couleur","settings-displayScrollAvatarsLbl":"Faire d\u00e9filer les avatars lors de la lecture","settings-displayAttachmentContentLbl":"Afficher les pieces jointes ?","settings-displayAttachmentContent-never":"Jamais","settings-displayAttachmentContent-always":"Toujours","settings-displayAttachmentContent-notimg":"Si elles ne contiennent pas d'images"}};
- H.fr.mb=function(a){return 0===a?"Pas de message \u00e9pingl\u00e9":a+(1===a?" message \u00e9pingl\u00e9":" messages \u00e9pingl\u00e9s")};H.fr.sb=function(a){return 0===a?"Pas de chatteur":a+(1===a?" chatteur":" chatteurs")};H.fr.I=function(a){return"(edité "+H.fr.U(a)+")"};H.fr.Na=function(a,b){return"par "+a.getName()+" le "+H.fr.U(b)};H.en={Qb:"Unknown member",Pb:"Unknown channel",Ja:"New message",message:"Message",kb:"Network",lb:"(only visible to you)",D:"Starred",m:"Channels",sa:"Members",pb:"Direct messages",rb:"Share your GPS location",ok:"Ok",cb:"Cancel",U: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()},fb:function(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()?"today":a.getTime()>c.getTime()?"yesterday":a.toLocaleDateString()},Ga:function(a,b){return a+"/"+b},c:{fileUploadCancel:"Cancel",neterror:"Cannot connect to chat !",ctxMenuSettings:"Settings",ctxMenuLogout:"Logout",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","settings-displayEmojiProviderLbl":"Emoji provider","settings-displayDisplayAvatarLbl":"Display avatars","settings-displayColorfulNamesLbl":"Colorful names","settings-displayScrollAvatarsLbl":"Scroll avatars",
- "settings-displayAttachmentContentLbl":"Automaticcaly unwrap attachments ?","settings-displayAttachmentContent-never":"Never","settings-displayAttachmentContent-always":"Always","settings-displayAttachmentContent-notimg":"If they don't contain image"}};H.en.mb=function(a){return 0===a?"No pinned messages":a+(1===a?" pinned message":" pinned messages")};H.en.sb=function(a){return 0===a?"No users in this room":a+(1===a?" user":" users")};H.en.I=function(a){return"(edited "+H.en.U(a)+")"};
- H.en.Na=function(a,b){return"by "+a.getName()+" on "+H.en.U(b)};var Aa=function(){function a(a){this.text="";this.h=a}function b(b,c,d){this.aa=c;this.g=null;this.o=[];this.a=d||"";this.Ca="<"===this.a;this.La="*"===this.a;this.Ba="_"===this.a;this.Da="~"===this.a||"-"===this.a;this.j=">"===this.a||">"===this.a;this.w=":"===this.a;this.Oa="`"===this.a;this.Za="```"===this.a;this.Pa="\n"===this.a;this.Aa=void 0!==d&&-1!==p.G.indexOf(d);this.h=b;this.Ea=null;this.b=this.Pa||this.Aa?c+d.length-1:!1;this.Aa&&(this.g=new a(this),this.o.push(this.g),this.g.text=
- d)}function c(a){return/[A-Za-z0-9\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+]/.test(a)}function e(a){a=a||m;for(var c=0,d=a.o.length;c<d;c++){var f=a.o[c];if(f instanceof b)if(f.b){if(f=
- e(f))return f}else return f}return null}function d(a,c){a.h instanceof b&&(a.h.o.splice(a.h.o.indexOf(a)+(c?1:0)),a.h.g=a.h.o[a.h.o.length-1],d(a.h,!0))}function f(a){return a.replace("<","<")}function g(a){return a}function k(a){return{link:a,text:a,hb:!1}}var h,m,p={G:[],$:g,ya:g,ra:k};b.prototype.Ra=function(){return this.La&&!!this.b||this.h instanceof b&&this.h.Ra()};b.prototype.Ua=function(){return this.Ba&&!!this.b||this.h instanceof b&&this.h.Ua()};b.prototype.Va=function(){return this.Da&&
- !!this.b||this.h instanceof b&&this.h.Va()};b.prototype.ga=function(){return this.w&&!!this.b||this.h instanceof b&&this.h.ga()};b.prototype.Ta=function(){return this.Aa&&!!this.b||this.h instanceof b&&this.h.Ta()};b.prototype.Sa=function(){return this.Oa&&!!this.b||this.h instanceof b&&this.h.Sa()};b.prototype.fa=function(){return this.Za&&!!this.b||this.h instanceof b&&this.h.fa()};b.prototype.Wa=function(){for(var a=0,c=this.o.length;a<c;a++)if(this.o[a]instanceof b&&(!this.o[a].b||this.o[a].Wa()))return!0;
- return!1};b.prototype.Xa=function(a){if("<"===this.a&&">"===h[a])return!0;var b=c(h[a-1]);if(!this.j&&h.substr(a,this.a.length)===this.a){if(!b&&(this.La||this.Ba||this.Da))return!1;if(this.g&&this.Wa())return this.g.$a();if(this.ub())return!0}return"\n"===h[a]&&this.j?!0:!1};b.prototype.ub=function(){for(var a=this;a;){for(var c=0,d=a.o.length;c<d;c++)if(a.o[c]instanceof b||a.o[c].text.length)return!0;a=a.Ea}return!1};b.prototype.$a=function(){var a=new b(this.h,this.aa,this.a);a.Ea=this;this.g&&
- this.g instanceof b&&(a.g=this.g.$a(),a.o=[a.g]);return a};b.prototype.vb=function(a){return this.w&&(" "===h[a]||"\t"===h[a])||(this.w||this.Ca||this.La||this.Ba||this.Da||this.Oa)&&"\n"===h[a]?!1:!0};b.prototype.wb=function(b){if(this.Oa||this.w||this.Za||this.Ca)return null;if(!this.g||this.g.b||this.g instanceof a){var d=c(h[b-1]),e=c(h[b+1]);if("```"===h.substr(b,3))return"```";var f=m.Ka();if(void 0===f||f){if(">"===h.substr(b,4))return">";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=p.G.length;d<e;d++)if(f=p.G[d],h.substr(b,f.length)===f)return f}return null};a.prototype.Ka=function(){if(""!==this.text.trim())return!1};b.prototype.Ka=function(){for(var a=this.o.length-1;0<=a;a--){var b=this.o[a].Ka();if(void 0!==b)return b}if(this.Pa||
- this.j)return!0};a.prototype.s=function(a){this.text+=h[a];return 1};b.prototype.s=function(c){var d=this.g&&!this.g.b&&this.g.Xa?this.g.Xa(c):null;if(d){var e=this.g.a.length;this.g.Qa(c);d instanceof b&&(this.g=d,this.o.push(d));return e}if(!this.g||this.g.b||this.g instanceof a||this.g.vb(c)){if(d=this.wb(c))return this.g=new b(this,c,d),this.o.push(this.g),this.g.a.length;if(!this.g||this.g.b)this.g=new a(this),this.o.push(this.g);return this.g.s(c)}d=this.g.aa+1;m.da(this.g.aa);this.g=new a(this);
- this.g.s(d-1);this.o.pop();this.o.push(this.g);return d-c};b.prototype.Qa=function(a){for(var b=this;b;)b.b=a,b=b.Ea};b.prototype.da=function(a){this.b&&this.b>=a&&(this.b=!1);this.o.forEach(function(c){c instanceof b&&c.da(a)})};a.prototype.innerHTML=function(){if(this.h.ga()){for(var a=this.h;a&&!a.w;)a=a.h;if(a){var a=a.a+this.text+a.a,b=p.$(a);return b?b:a}return(a=p.$(this.text))?a:this.text}if(this.h.fa()){if("undefined"!==typeof hljs)try{return a=this.text.match(/^\w+/),hljs.configure({useBR:!0,
- tabReplace:" "}),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(v){console.error(v)}return this.text.replace(/\n/g,"<br/>")}return p.ya(this.text)};a.prototype.outerHTML=function(){var a="span",b=[],c="";if(this.h.fa()){a="pre";b.push("codeblock");var d=this.innerHTML()}else this.h.Sa()?(b.push("code"),d=this.innerHTML()):(this.h.Ca&&(d=p.ra(this.text))?
- (a="a",c=' href="'+d.link+'"',d.style&&(c+=' style="'+d.style+'"'),d.hb||(c+=' target="_blank"'),d.ab&&d.ab.forEach(function(a){b.push(a)}),d=p.ya(d.text)):d=this.innerHTML(),this.h.Ra()&&b.push("bold"),this.h.Ua()&&b.push("italic"),this.h.Va()&&b.push("strike"),this.h.ga()&&b.push("emoji"),this.h.Ta()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+"</"+a+">"};b.prototype.outerHTML=function(){var a="";this.j&&(a+='<span class="quote">');this.Pa&&(a+="<br/>");this.o.forEach(function(b){a+=
- b.outerHTML()});this.j&&(a+="</span>");return a};b.prototype.Ya=function(a){this.j&&!this.b&&this.Qa(a);this.o.forEach(function(c){c instanceof b&&c.Ya(a)})};return function(c,n){n||(n={});p.G=n.G||[];p.$=n.$||g;p.ya=n.ya||f;p.ra=n.ra||k;h=c;m=new b(this,0);n=0;c=h.length;do{for(;n<c;)n+=m.s(n);m.Ya(h.length);if(n=e()){d(n,!1);m.da(n.aa);var l=new a(n.h);l.s(n.aa);n.h.o.push(l);n.h.g=l;n=n.aa+1}else n=void 0}while(void 0!==n);return m.outerHTML()}}();"undefined"!==typeof module&&(module.M.B=Aa);function Ba(){var a=N.X,b;for(b in a)if(a.hasOwnProperty(b))return!1;return!0}function Ca(a,b){a=new Date(a);b=new Date(b);a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0);return a.getTime()===b.getTime()};function Da(a,b){this.w=b||a;this.method=b?a:"GET"}function Ea(a,b,c,e){a&&a.forEach(function(a){a(b,c,e)})}function Fa(a,b){a.ia||(a.ia=[]);a.ia.push(b);return a}function Ga(a,b){a.ka||(a.ka=[]);a.ka.push(b);return a}function Ha(a,b){a.ja||(a.ja=[]);a.ja.push(b);return a}
- function O(a,b){Da.call(this,a,b);this.b=new XMLHttpRequest;this.b.onreadystatechange=function(){4===this.b.readyState&&(2===Math.floor(this.b.status/100)?Ea(this.ka,this.b.status,this.b.statusText,this.b.response):Ea(this.ja,this.b.status,this.b.statusText,this.b.response),Ea(this.ia,this.b.status,this.b.statusText,this.b.response))}.bind(this)}O.prototype=Object.create(Da.prototype);O.prototype.constructor=O;O.prototype.s=function(a){this.b.timeout=a;return this};
- O.prototype.j=function(a){this.b.responseType=a;return this};O.prototype.a=function(a){this.b.open(this.method,this.w,!0);this.b.send(a);return this};function Ia(a,b){Da.call(this,a,b);this.b=5E3;this.responseType="text"}Ia.prototype=Object.create(Da.prototype);Ia.prototype.constructor=O;Ia.prototype.s=function(a){this.b=a;return this};Ia.prototype.j=function(a){this.responseType=a;return this};
- function Ja(a){if(!a)return null;if("string"===typeof a)return a;var b={},c;for(c in a)b[c]=a[c];return JSON.stringify(b)}var Ka=function(){var a=document.createElement("a");return function(b){a.href=b;return a.href}}();
- Ia.prototype.a=function(a){__native.sendHttpRequest(this.method,Ka(this.w),this.b,this.responseType,Ja(a),La.jb(function(a,c,e){try{var b="text"===this.responseType?e:JSON.parse(e)}catch(f){b=e}__native.isDebug()&&console.log(this,{ec:a,statusText:c,dc:e});2===Math.floor(a/100)?Ea(this.ka,a,c,b):Ea(this.ja,a,c,b);Ea(this.ia,a,c,b)},this));return this};function P(a,b){return Ma()?new Ia(a,b):new O(a,b)};function Na(a,b){this.title=a;this.content=b;this.c=Oa(this);this.b=Pa(this);this.a=[];this.j=[]}
- function Oa(a){var b=document.createElement("div"),c=document.createElement("header"),e=document.createElement("span"),d=document.createElement("span"),f=document.createElement("div"),g=document.createElement("footer");b.a=document.createElement("span");b.b=document.createElement("span");e.textContent=a.title;"string"==typeof a.content?f.innerHTML=a.content:f.appendChild(a.content);c.className=Qa;e.className=Ra;d.className=Sa;d.textContent="x";c.appendChild(e);c.appendChild(d);b.appendChild(c);f.className=
- Ta;b.appendChild(f);b.b.className=Ua;b.b.textContent=K.cb;b.b.addEventListener("click",function(){Va(a,!1)});d.addEventListener("click",function(){Va(a,!1)});b.a.addEventListener("click",function(){Va(a,!0)});g.appendChild(b.b);b.a.className=Ua;b.a.textContent=K.ok;g.appendChild(b.a);g.className=Wa+" "+Xa;b.appendChild(g);b.className=Ya;return b}function Va(a,b){(b?a.a:a.j).forEach(function(a){a()});a.close()}
- function Pa(a){var b=document.createElement("div");b.className=Za;b.addEventListener("click",function(){Va(this,!1)}.bind(a));return b}function $a(a,b,c){a.c.a.textContent=b;a.c.b.textContent=c;return a}Na.prototype.wa=function(a){a=a||document.body;a.appendChild(this.b);a.appendChild(this.c);return this};Na.prototype.close=function(){this.c.remove();this.b.remove();return this};function ab(a,b){a.a.push(b);return a};var Ua="button",Wa="button-container",Ya="dialog",Za="dialog-overlay",Qa="dialog-title",Ra="dialog-title-label",Sa="dialog-title-close",Ta="dialog-body",Xa="dialog-footer";function bb(a){var b=document.createElement("lh");b.textContent=a;b.className="chat-command-header";return b}
- function cb(a,b){var c=document.createElement("li"),e=document.createElement("span");e.className="chat-command-name";if("string"===typeof a)b&&c.appendChild(b),e.textContent=a,c.appendChild(e);else{b=document.createElement("span");var d=document.createElement("span");e.textContent=a.name;b.textContent=a.usage;d.textContent=a.zb;b.className="chat-command-usage";d.className="chat-command-desc";c.appendChild(e);c.appendChild(b);c.appendChild(d)}c.dataset.input=e.textContent;c.className="chat-command-item";
- return c}
- function db(a){var b,c=document.getElementById("slashList");c.dataset.cursor&&delete c.dataset.cursor;var e=[],d=a.value;if(a.selectionStart===a.selectionEnd&&a.selectionStart){for(var f=a.selectionStart,g=a.selectionEnd;f&&" "!==d[f-1];f--);for(b=d.length;g<b&&" "!==d[g];g++);if(f!==g&&0<g-f-1){if("#"===d[f]){var k=Q.m;b=d.substr(f+1,g-f-1);for(var h in k)k[h].name.length>=b.length&&k[h].name.substr(0,b.length)===b&&e.push(k[h])}else if("@"===d[f])for(h in k=D instanceof r?Q.l:D.l,b=d.substr(f+1,
- g-f-1),k){var m=k[h].getName();m.length>=b.length&&m.substr(0,b.length)===b&&e.push(k[h])}else if(":"===d[f]&&window.searchEmojis){b=d.substr(f+1,g-f-1);m=window.searchEmojis(b);for(k in m){var m=window.makeEmoji(k,!1),p=document.createElement("span");p.appendChild(m);p.className="emoji-small";e.push({name:":"+k+":",Ha:p,ua:eb.name})}for(h in Q.b.data)h.length>=b.length&&h.substr(0,b.length)===b&&(k=document.createElement("span"),k.className="emoji-small",k.appendChild(fb(h)),e.push({name:":"+h+":",
- Ha:k,ua:"custom"}))}e.length&&(c.dataset.cursor=JSON.stringify([f,g]))}}if(!e.length&&"/"===d[0]){h=d.indexOf(" ");f=-1!==h;h=-1===h?d.length:h;b=d.substr(0,h);f?(a=gb.gb(b))&&e.push(a):(e=gb.Ab(b),c.dataset.cursor=JSON.stringify([0,a.selectionEnd]));a=Q?Q.j.data:{};for(var l in a)d=a[l],(!f&&d.name.substr(0,h)===b||f&&d.name===b)&&e.push(d);e.sort(function(a,b){return a.Z.localeCompare(b.Z)||a.name.localeCompare(b.name)})}c.textContent="";if(e.length){l=document.createDocumentFragment();h=0;for(a=
- e.length;h<a;h++)if(d=e[h],d instanceof ga){if(!n){var n=!0;l.appendChild(bb(K.sa))}b=document.createElement("span");b.className="chat-command-userIcon";b.style.backgroundImage='url("'+pa(d)+'")';l.appendChild(cb("@"+d.getName(),b))}else d instanceof u?(n||(n=!0,l.appendChild(bb(K.m))),l.appendChild(cb("#"+d.name))):d.Ha?(n!==d.ua&&(n=d.ua,l.appendChild(bb(d.ua))),l.appendChild(cb(d.name,d.Ha))):(n!==d.Z&&(n=d.Z,l.appendChild(bb(d.Z))),l.appendChild(cb(d)));c.appendChild(l)}}
- function hb(a){if(R)return P("PUT","api/msg?room="+encodeURIComponent(D.id)+"&ts="+R.id+"&text="+encodeURIComponent(a)).a(),!0;if("/"===a[0]){var b=a.indexOf(" "),c=a.substr(0,-1===b?void 0:b);a=-1===b?"":a.substr(b);var b=Q,e=gb.gb(c);if(e)return a=a.trim(),e.exec(b,D,a),!0;if(b&&(c=b.j.data[c])){if("/me"===c.name)ib(D,a,!0);else if("/msg"===c.name){a=a.trim();var b=/(\S+)\s+(.*)/.exec(a);a:{var d=b[1],e=Q,f=d,g=[];"#"===f[0]&&(f=f.substr(1));for(var k in e.m)e.m[k].name===f&&g.push(e.m[k]);if(g.length)var h=
- g[0];else{k=[];"@"===d[0]&&(d=d.substr(1));for(h in e.l)e.l[h].getName()===d&&k.push(e.m[h]);if(k.length)for(h=0,e=k.length;h<e;h++)if(k[h].S){h=k[h].S;break a}h=null}}h&&ib(h,b[2],!1)}P("POST","api/cmd?room="+encodeURIComponent(D.id)+"&cmd="+encodeURIComponent(c.name.substr(1))+"&args="+encodeURIComponent(a)).a();return!0}return!1}h=ib(D,a,!1);jb(D,a,h,S);return!0}function kb(){document.getElementById("msgInput").focus()}
- function lb(a){for(var b=1,c=0,e=a.value.length;c<e;c++)"\n"===a.value[c]&&b++;for(a.rows=Math.min(5,b);5>a.rows&&a.scrollHeight>a.clientHeight;)a.rows++}
- function mb(){var a=0,b=document.getElementById("msgInput");b.addEventListener("input",function(){if(D){var b=Date.now();a+3E3<b&&(Q.self.R||D instanceof r)&&(P("POST","api/typing?room="+encodeURIComponent(D.id)).a(),a=b);db(this);lb(this)}});b.addEventListener("keydown",function(a){if(9===a.keyCode)return a.preventDefault(),!1;if(13===a.keyCode)return a.preventDefault(),a.shiftKey||a.altKey||a.ctrlKey?(a=this.selectionStart,this.value=this.value.substr(0,a)+"\n"+this.value.substr(this.selectionEnd),
- lb(this),this.selectionStart=this.selectionEnd=a+1):nb(),!1});document.getElementById("slashList").addEventListener("click",function(a){if(D){var b=a.target;if(a=this.dataset.cursor)for(a=JSON.parse(a);b&&b!==this;){if(b.dataset.input){var c=document.getElementById("msgInput"),b=b.dataset.input;c.value.length<=a[1]&&(b+=" ");c.value=c.value.substr(0,a[0])+b+c.value.substr(a[1]);c.selectionStart=c.selectionEnd=a[0]+b.length;db(c);c.focus();break}b=b.parentElement}}})};var T=[],U=null,ob=0;
- function pb(){var a=document.createDocumentFragment(),b=wa(function(a){return!a.la&&!1!==a.da}),c=[],e=[],d=[],f=[],g={};b.sort(function(a,b){if(a[0]!==b[0])return a[0]-b[0];var c=E(C.context,a),d=E(C.context,b);a=c.m[a];b=d.m[b];return a.name===b.name?(g[a.id]=K.Ga(c.a.name,a.name),g[b.id]=K.Ga(d.a.name,b.name),c.a.name.localeCompare(d.a.name)):a.name.localeCompare(b.name)});b.forEach(function(a){a=va(a);if(a instanceof r){var b;if(b=!a.a.bb){var k=g[a.id];b=document.createElement("li");var p=document.createElement("a");
- b.id="room_"+a.id;p.href="#"+a.id;b.className="chat-context-room chat-ims presence-indicator";p.textContent=k||a.a.getName();b.appendChild(qb());b.appendChild(p);a.a.R||b.classList.add("presence-away");D===a&&b.classList.add("selected");a.F!==a.C&&void 0!==a.F&&(b.classList.add("unread"),b.classList.add("unreadHi"));b=k=b}b&&(a.D?c.push(k):f.push(k))}else if(k=g[a.id],b=document.createElement("li"),p=document.createElement("a"),b.id="room_"+a.id,p.href="#"+a.id,a.j?(b.className="chat-context-room chat-group",
- b.dataset.count=Object.keys(a.l||{}).length):b.className="chat-context-room chat-channel",D===a&&b.classList.add("selected"),p.textContent=k||a.name,b.appendChild(qb()),b.appendChild(p),a.F!==a.C&&void 0!==a.F&&(b.classList.add("unread"),0<=V.indexOf(a)&&b.classList.add("unreadHi")),k=b)a.D?c.push(k):a.j?d.push(k):e.push(k)});c.length&&a.appendChild(rb(K.D));c.forEach(function(b){a.appendChild(b)});e.length&&a.appendChild(rb(K.m));e.forEach(function(b){a.appendChild(b)});d.forEach(function(b){a.appendChild(b)});
- f.length&&a.appendChild(rb(K.pb));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);sb.apply(document.getElementById("chanSearch"));tb()?ub(Q.a.id,Q.l,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"}):Ma()&&(b=__native.getPreviousChannel())&&(document.location.hash=b)}
- function vb(){ua(function(a){var b=a.A,c;for(c in a.self.m)if(!a.self.m[c].la){var e=document.getElementById("room_"+c);b[c]?e.classList.add("chat-context-typing"):e.classList.remove("chat-context-typing")}for(var d in a.l)(c=a.l[d].S)&&!c.la&&(e=document.getElementById("room_"+c.id))&&(b[c.id]?e.classList.add("chat-context-typing"):e.classList.remove("chat-context-typing"))});wb()}
- function wb(){var a;document.getElementById("whoistyping").textContent="";if(Q&&D&&(a=Q.A[D.id])){var b=document.createDocumentFragment(),c=!1,e;for(e in a)(a=G(e))?b.appendChild(xb(a)):c=!0;c&&(C.b=0);document.getElementById("whoistyping").appendChild(b)}}function yb(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");zb()}
- function Ab(){var a=D.name||(D.a?D.a.getName():void 0);if(!a){console.error("No name provided for ",D);var a=[],b;for(b in D.l)a.push(D.l[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;document.getElementById("chatWindow").textContent="";T=[];Bb();kb();document.getElementById("fileUploadContainer").classList.add("hidden");Cb();S&&(S=null,W());R&&(R=null,W());wb()}
- function W(){if(S){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){S=null;W()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(S.P())}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";kb()}
- function Db(){if(R){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){R=null;Db()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(R.P());document.getElementById("msgInput").value=R.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";kb()}
- window.toggleReaction=function(a,b,c){var e,d,f;if(f=e=C.a[a]){a:{var g=0;for(f=e.i.length;g<f;g++)if(e.i[g].id==b){e=e.i[g];break a}e=null}f=g=e}f&&(d=E(C.context,a))&&(g.H[c]&&-1!==g.H[c].indexOf(d.self.id)?P("DELETE","api/reaction?room="+encodeURIComponent(a)+"&msg="+b+"&reaction="+encodeURIComponent(c)).a():Eb(a,b,c))};function Fb(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}
- function zb(){var a=V.length,b="";if(X)b="!"+K.kb+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",Fb(a,a);else{var c=0;ta(C.context,function(a){a.F>a.C&&c++});c&&(b="("+c+")");Fb(0,c)}!b.length&&D&&(b=D.name);b=b.length?b:"Mimouchat";document.title=b;Gb(b)}
- function Hb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(ob+3E4<a){var b=new Notification(K.Ja);ob=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}function Ib(a,b){return a&&Ca(b.f,a.f)&&!(b instanceof x)&&!a.Ib&&b.O===a.O}
- function Jb(a){var b=a.scrollTop,c=null,e=!1;if(10>a.scrollHeight-a.scrollTop-a.clientHeight)return 0;if(e=T.some(function(a){for(var d=0,e=a.content.children.length;d<e;++d){var k=a.content.children[d];if(k.offsetTop+k.parentElement.offsetTop+k.parentElement.parentElement.offsetTop>b)return c=k.id,!0}}))if(a=oa(c))return a.f}function Kb(a){C.a[D.id]&&C.a[D.id].i.some(function(b){if(b.f>=a)return b.J().scrollIntoView(),!0})}
- function Bb(){function a(){for(;T[d].content.children[f];)T[d].content.children[f].remove();T[d].i.splice(f);T[d].i.length?d++:(T[d].remove(),T[d]=null);e=null}function b(a,b){var c=a.J();if(e){var g=e.J();6E4>Math.abs(e.f-a.f)?g.classList.add("chatmsg-same-ts"):g.classList.remove("chatmsg-same-ts")}(!e||e.f<=D.C)&&a.f>D.C?c.classList.add("chatmsg-first-unread"):c.classList.remove("chatmsg-first-unread");b?T[d].content.replaceChild(b,c):f>=T[d].i.length?(T[d].content.appendChild(c),T[d].i.push(a.id)):
- (T[d].content.insertBefore(c,T[d].content.children[f]),T[d].i.splice(f,0,a.id));T[d].f=T[d].f?a.f:Math.min(T[d].f,a.f);++f;e=a}var c=document.getElementById("chatWindow"),e=null,d=0,f=0;D.D?document.getElementById("chatSystemContainer").classList.add("starred"):document.getElementById("chatSystemContainer").classList.remove("starred");var g=Jb(c);C.a[D.id]&&C.a[D.id].i.forEach(function(g){if(T[d]){if(Ib(T[d],g)){if(T[d].i[f]===g.id){var k=T[d].content.children[f];g.b?(k.remove(),T[d].i.splice(f,1)):
- g.T?b(g,k):++f}else g.b||b(g);return}if(g.b)return;if(g.f<T[d].f){for(;0<d&&g.f<T[d].f;)--d;for(;T[d];)T[d].remove(),T.splice(d,1)}else a();e=null;f=0}g.b||(T[d]&&!Ib(T[d],g)&&a(),T[d]||(T[d]=Lb(G(g.O),g.username,g instanceof x,g.f),T[d+1]?c.insertBefore(T[d],T[d+1]):c.appendChild(T[d]),f=0),b(g))});if(T[d]){for(;T[d].content.children[f];)T[d].content.children[f].remove();T[d].i.splice(f);T[d].i.length||--d;for(var k=d+1;T[k];k++)T[k].remove();T.splice(d+1)}for(var k=0,h=T.length;k<h;++k)T[k-1]&&
- Ca(T[k-1].f,T[k].f)?T[k].classList.remove("chatmsg-first-daily"):(T[k].classList.add("chatmsg-first-daily"),T[k].dataset.date=T[k].dataset.date||K.fb(T[k].f));U?(U.content.textContent="",U.i=[]):(U=Lb(Q.self,Q.self.getName(),!1,0),U.classList.add("pending"));Mb.forEach(function(a){a.channel===D.id&&(U.content.appendChild(a.c),U.i.push(a.id))});U.i.length?c.appendChild(U):U.remove();T=T.filter(function(a){var b=a&&a.i.length&&a.content.children.length;!b&&a&&a.remove();return b});g?Kb(g):c.scrollTop=
- c.scrollHeight-c.clientHeight;zb();window.hasFocus&&Cb()}
- function Nb(a,b){if(a.classList.contains("chatmsg-hover-reply"))R&&(R=null,Db()),S!==b&&(S=b,W());else if(a.classList.contains("chatmsg-hover-reaction")){var c=D.id,e=b.id;Ob.wa(document.body,Q,function(a){a&&Eb(c,e,a)})}else a.classList.contains("chatmsg-hover-edit")?(S&&(S=null,W()),R!==b&&(R=b,Db())):a.classList.contains("chatmsg-hover-star")?b.D?P("DELETE","api/starMsg?room="+encodeURIComponent(D.id)+"&msgId="+b.id).a():P("POST","api/starMsg?room="+encodeURIComponent(D.id)+"&msgId="+b.id).a():
- a.classList.contains("chatmsg-hover-pin")?b.pinned?Pb(D,b):P("POST","api/pinMsg?room="+encodeURIComponent(D.id)+"&msgId="+b.id).a():a.classList.contains("chatmsg-hover-remove")&&(S&&(S=null,W()),R&&(R=null,Db()),P("DELETE","api/msg?room="+encodeURIComponent(D.id)+"&ts="+b.id).a())}function ib(a,b,c){b={channel:a.id,text:b.trim(),Ia:c,c:Qb(b,c),f:Date.now(),id:"pending"+a.id+Date.now()};Mb.push(b);a===D&&Bb();return b}
- function Rb(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 e;if(c.parentElement&&c.classList.contains("chatmsg-attachment-actions-item")){var d=c.dataset.attachmentIndex,f=c.dataset.actionIndex;if((e=b(a,c))&&void 0!==d&&void 0!==f){(a=oa(e))&&a.u[d]&&a.u[d].actions&&a.u[d].actions[f]&&Sb(a,a.u[d],a.u[d].actions[f]);break}}if(c.parentElement&&
- c.parentElement.classList.contains("chatmsg-hover")){(e=b(a,c))&&(a=oa(e))&&Nb(c,a);break}c=c.parentElement}}function Sb(a,b,c){function e(){var e={actions:[c],attachment_id:b.id,callback_id:b.callback_id,channel_id:d,is_ephemeral:a instanceof y,message_ts:a.id};P("POST","api/attachmentAction?serviceId="+encodeURIComponent(a.O)).a(JSON.stringify(e))}var d=D.id;c.confirm?ab($a(new Na(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),e).wa():e()}
- function Tb(){if(!1!==N.b&&!1!==N.j){var a=document.getElementById("chatWindow").getBoundingClientRect().top;T.forEach(function(b){var c=b.ma,e=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-e-e/2))+"px"})}}function Ub(){var a=document.getElementById("chatCtx");a.classList.contains("opened")?a.classList.remove("opened"):a.classList.add("opened")}
- document.addEventListener("DOMContentLoaded",function(){za();Vb();mb();var a=document.getElementById("chanSearch");a.addEventListener("input",sb);a.addEventListener("blur",sb);document.getElementById("chatWindow").addEventListener("click",Rb);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&tb()});document.addEventListener("mouseover",function(a){a=a.target;if(Wb.Gb(a))Wb.ba();else{for(;a&&a!==this;){if("A"===a.nodeName){var b=a.href,e=b.indexOf("#");
- if(0<=e){b=b.substr(e+1);if(e=E(C.context,b)){Wb.nb(e,e.m[b]).show(a);return}a:{for(var e=C.context,d=0,f=e.a.length;d<f;d++)if(e.a[d].l[b]){e=e.a[d];break a}e=null}if(e&&(b=e.l[b].S)){Wb.nb(e,b).show(a);return}}}a=a.parentElement}Wb.Db()}});document.getElementById("chatCtxButton").addEventListener("click",Ub);document.getElementById("currentRoomStar").addEventListener("click",function(a){a.preventDefault();D&&(D.D?Xb(D):Yb(D));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("ctxMenuLogout").addEventListener("click",Zb);document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();$b.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),ac(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();D&&document.getElementById("fileUploadContainer").classList.remove("hidden");
- return!1});document.getElementById("msgFormSubmit").addEventListener("click",function(a){a.preventDefault();nb();return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();nb();return!1});window.addEventListener("blur",function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;ob=0;D&&Cb();kb()});window.hasFocus=!0;document.getElementById("emojiButton").addEventListener("click",function(){Q&&Ob.wa(document.body,Q,function(a){a&&
- (document.getElementById("msgInput").value+=":"+a+":");kb()})});Ma()&&(__native.readSmsPermission(La.jb(function(){var a=JSON.parse(__native.getStatic());a&&C.update(a)})),document.body.classList.add("native"));IS_LOCAL||bc()});function nb(){var a=document.getElementById("msgInput");D&&a.value&&hb(a.value)&&(a.value="",S&&(S=null,W()),R&&(R=null,W()),document.getElementById("slashList").textContent="",lb(a));kb()};var $b=function(){function a(){document.getElementById("settings").classList.add("hidden");c=!1}function b(a){e&&(document.getElementById("settings").classList.remove("display-"+e),document.getElementById("setting-menu-"+e).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");e=a}var c=!1,e=null,d={X:"services",
- display:"display",cc:"privacy"};document.getElementById("settingMenuItems").addEventListener("click",function(a){for(var c=a.target;a.currentTarget!==c&&c;c=c.parentNode)if(c.dataset&&c.dataset.target)for(var e in d)if(d[e]===c.dataset.target){b(d[e]);return}});document.getElementById("settingDiscardClose").addEventListener("click",a);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});document.getElementById("settingCommit").addEventListener("click",function(){var b={};document.getElementById("settings-displayEmojiProvider").value!==N.w&&(b.emojiProvider=document.getElementById("settings-displayEmojiProvider").value);var c=!!document.getElementById("settings-displayDisplayAvatar").checked;
- c!==(!1!==N.b)&&(b.displayAvatar=c);c=!!document.getElementById("settings-displayColorfulNames").checked;c!==(!0===N.s)&&(b.colorfulNames=c);c=!!document.getElementById("settings-displayScrollAvatars").checked;c!==(!1!==N.j)&&(b.scrollAvatars=c);c=document.getElementById("settings-displayAttachmentContent").value;c!==N.a&&(b.autoExpandAttachments=c);var c=N,d;for(d in b){cc(c,b);dc();P("POST","api/settings?service=null&device=null").a(JSON.stringify(b));break}a()});return{display:function(a){if(!c){document.getElementById("settings").classList.remove("hidden");
- var e=document.createDocumentFragment(),f=!1,h;for(h in N.X){var m=N.X[h];for(n in m){var f=document.createElement("li"),p=document.createElement("span"),l=document.createElement("span");p.textContent=h;l.textContent=m[n];f.className="settings-service-list-item";p.className="settings-service-list-item-provider";l.className="settings-service-list-item-service";f.appendChild(p);f.appendChild(l);e.appendChild(f);f=!0}}m=document.getElementById("settings-serviceList");m.textContent="";f?(document.getElementById("settings-serviceListEmpty").classList.remove("hidden"),
- m.appendChild(e)):document.getElementById("settings-serviceListEmpty").classList.add("hidden");e=document.createDocumentFragment();m=document.getElementById("settings-displayEmojiProvider");for(h in ec){var n=document.createElement("option");n.value=h;n.textContent=ec[h].name;ec[h]===eb&&(n.selected=!0);e.appendChild(n)}m.textContent="";m.appendChild(e);document.getElementById("settings-displayDisplayAvatar").checked=!1!==N.b;document.getElementById("settings-displayColorfulNames").checked=!0===N.s;
- document.getElementById("settings-displayScrollAvatars").checked=!1!==N.j;document.getElementById("settings-displayAttachmentContent").value=void 0!==N.a?N.a:fc;c=!0}b(a||d.X);return this},Nb:function(){return this},Kb:d}}();function gc(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.V=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"})},e=document.createElement("canvas"),d=document.createElement("canvas");
- e.height=e.width=d.height=d.width=300;var f=e.getContext("2d"),g=d.getContext("2d"),k=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)))},h=function(a,d,e,h){g.fillStyle="#808080";g.fillRect(0,0,300,300);f.fillStyle="#808080";f.fillRect(0,0,300,300);var p=Math.pow(2,a),n=(e+180)/360*p,m=(1-Math.log(Math.tan(d*Math.PI/180)+1/Math.cos(d*Math.PI/180))/Math.PI)/2*p,l=Math.floor(n),L=Math.floor(m),
- ya=h?100*h/k(180/Math.PI*Math.atan(.5*(Math.exp(Math.PI-2*Math.PI*L/p)-Math.exp(-(Math.PI-2*Math.PI*L/p)))),l/p*360-180,(l+1)/p*360-180):0;d=b;for(e=0;3>e;e++)for(h=0;3>h;h++)c(a,l+e-1,L+h-1,{Eb:e,Hb:h,tb:d}).then(function(a){if(a.tb===b){g.drawImage(a.V,100*a.Eb,100*a.Hb,100,100);a=n-l;var c=m-L;a=100*a+100;c=100*c+100;f.putImageData(g.getImageData(0,0,300,300),0,0);void 0!==ya&&(f.beginPath(),f.arc(a,c,Math.max(ya,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===ya||25<ya)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()}}).catch(function(){})},m,p=function(c){c=Math.max(4,Math.min(19,c));m!==c&&(b++,m=c,h(m,Number(a.latitude),Number(a.longitude),Number(a.accuracy)))};p(12);var d=document.createElement("div"),l=document.createElement("div"),n=document.createElement("button"),v=document.createElement("button");
- d.className="OSM-wrapper";e.className="OSM-canvas";l.className="OSM-controls";v.className="OSM-controls-zoomMin";n.className="OSM-controls-zoomPlus";v.addEventListener("click",function(){p(m-1)});n.addEventListener("click",function(){p(m+1)});l.appendChild(v);l.appendChild(n);d.appendChild(e);d.appendChild(l);return d}};function qb(){var a=document.createElement("span"),b=document.createElement("span"),c=document.createElement("span"),e=document.createElement("span");a.className="typing-container";b.className="typing-dot1";c.className="typing-dot2";e.className="typing-dot3";b.textContent=c.textContent=e.textContent=".";a.appendChild(b);a.appendChild(c);a.appendChild(e);return a}var rb=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
- function hc(a){var b={},c=a;if(Q)for(var e=Q;!b[a];){var d=e.b.data[a];if(d)if("alias:"==d.substr(0,6))b[a]=!0,a=d.substr(6);else return a=document.createElement("span"),a.className="emoji-custom emoji",a.style.backgroundImage="url('"+d+"')",a.textContent=":"+c+":",a.title=c,a;else return a}return c}function fb(a){return"makeEmoji"in window?(a=hc(a),"string"===typeof a&&(a=window.makeEmoji(a)),"string"===typeof a?null:a):null}
- function ic(a,b){var c=b.context.Y;b=C.context.Ia(b.O);if(c.replyToMsg){var e=document.createElement("li");e.className="chatmsg-hover-reply";e.style.backgroundImage='url("repl.svg")';a.appendChild(e)}c.reactMsg&&(e=document.createElement("li"),e.className="chatmsg-hover-reaction",e.style.backgroundImage='url("smile.svg")',a.appendChild(e));if(b&&c.editMsg||c.editOtherMsg)e=document.createElement("li"),e.className="chatmsg-hover-edit",e.style.backgroundImage='url("edit.svg")',a.appendChild(e);c.starMsg&&
- (a.pa=document.createElement("li"),a.pa.className="chatmsg-hover-star",a.appendChild(a.pa));c.pinMsg&&(e=document.createElement("li"),e.className="chatmsg-hover-pin",a.appendChild(e),e.style.backgroundImage='url("pin.svg")');if(b&&c.removeMsg||c.moderate)c=document.createElement("li"),c.className="chatmsg-hover-remove",c.style.backgroundImage='url("remove.svg")',a.appendChild(c)}
- function jc(a){var b=document.createElement("div"),c=document.createElement("div"),e=document.createElement("summary");b.ea=document.createElement("ul");b.u=document.createElement("ul");b.H=document.createElement("ul");b.f=document.createElement("div");b.xa=document.createElement("div");b.na=document.createElement("span");b.L=document.createElement("details");b.L.addEventListener("toggle",function(){this.Ob=!0});b.className="chatmsg-item";b.f.className="chatmsg-ts";b.xa.className="chatmsg-msg";b.na.className=
- "chatmsg-author-name";a&&(b.id=a.j+"_"+a.id,ic(b.ea,a),b.ea.className="chatmsg-hover");c.appendChild(b.na);c.appendChild(b.xa);c.appendChild(b.f);e.textContent="attachment";b.L.appendChild(e);b.L.appendChild(b.u);c.appendChild(b.L);b.I=document.createElement("div");b.I.className="chatmsg-edited";c.appendChild(b.I);c.appendChild(b.H);c.className="chatmsg-content";b.u.className="chatmsg-attachments";b.H.className="chatmsg-reactions";b.appendChild(c);b.appendChild(b.ea);return b}
- function kc(a){if(!a.length)return"black";for(var b=0,c=0,c=[],e=0,d=0,f=0,g,k=0,h=a.length;k<h;k++)c[k]=a.charCodeAt(k),e+=c[k];g=e/a.length;c.forEach(function(a){var c=Math.abs(g-a);d+=c;f=Math.max(c,f);b=a+((b<<5)-b)});d/=a.length;b=Math.abs(b-60)%199*360/199;c=f?Math.round(Math.min(100,Math.max(75,d/f*25+75))):100;return"hsl("+b+", 100%, "+c+"%)"}
- function Lb(a,b,c,e){var d=document.createElement("div"),f=document.createElement("div"),g=document.createElement("a"),k=document.createElement("img");d.ma=document.createElement("span");d.ma.className="chatmsg-author-img-wrapper";k.className="chatmsg-author-img";g.className="chatmsg-author-name";g.href="#"+a.id;a?(g.textContent=a.getName(),g.style.backgroundColor=kc(a.getName()),k.src=pa(a)):(g.textContent=b||"?",k.src="");d.ma.appendChild(k);f.appendChild(d.ma);f.appendChild(g);f.className="chatmsg-author";
- d.className="chatmsg-authorGroup";c&&d.classList.add("chatmsg-me_message");d.appendChild(f);d.content=document.createElement("div");d.content.className="chatmsg-author-messages";d.i=[];d.appendChild(d.content);d.f=e;d.Ib=c;d.O=a.id;return d}function lc(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 mc(a,b,c){var e=document.createElement("li"),d=document.createElement("div"),f=document.createElement("div"),g=document.createElement("a"),k=document.createElement("div"),h=document.createElement("img"),m=document.createElement("a"),p=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div"),v=document.createElement("img"),B=document.createElement("div");e.className="chatmsg-attachment";d.style.borderColor=lc(b.color||"");d.className="chatmsg-attachment-block";
- f.className="chatmsg-attachment-pretext";b.pretext?f.innerHTML=a.B(b.pretext):f.classList.add("hidden");g.target="_blank";b.title?(g.innerHTML=a.B(b.title),b.title_link&&(g.href=b.title_link),g.className="chatmsg-attachment-title"):g.className="hidden chatmsg-attachment-title";m.target="_blank";k.className="chatmsg-author";b.author_name&&(m.innerHTML=a.B(b.author_name),m.href=b.author_link||"",m.className="chatmsg-author-name",h.className="chatmsg-author-img",b.author_icon&&(h.src=b.author_icon,k.appendChild(h)),
- k.appendChild(m));n.className="chatmsg-attachment-thumb";b.thumb_url?(h=document.createElement("img"),h.src=b.thumb_url,n.appendChild(h),d.classList.add("has-thumb"),b.video_html&&(n.dataset.video=b.video_html)):n.classList.add("hidden");p.className="chatmsg-attachment-content";h=a.B(b.text||"");l.className="chatmsg-attachment-text";h&&""!=h?l.innerHTML=h:l.classList.add("hidden");p.appendChild(n);p.appendChild(l);b.geo&&(l=gc(b.geo))&&p.appendChild(l);v.className="chatmsg-attachment-img";b.image_url?
- v.src=b.image_url:v.classList.add("hidden");B.className="chatmsg-attachment-footer";b.footer&&(l=document.createElement("span"),l.className="chatmsg-attachment-footer-text",l.innerHTML=a.B(b.footer),b.footer_icon&&(n=document.createElement("img"),n.src=b.footer_icon,n.className="chatmsg-attachment-footer-icon",B.appendChild(n)),B.appendChild(l));b.ts&&(l=document.createElement("span"),l.className="chatmsg-ts",l.innerHTML=K.U(b.ts),B.appendChild(l));d.appendChild(g);d.appendChild(k);d.appendChild(p);
- d.appendChild(v);if(b.fields&&b.fields.length){var z=document.createElement("ul");d.appendChild(z);z.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.B(d);e.appendChild(f);e.appendChild(g);e&&z.appendChild(e)})}if(b.actions&&
- b.actions.length)for(g=document.createElement("ul"),g.className="chatmsg-attachment-actions "+Wa,d.appendChild(g),k=0,p=b.actions.length;k<p;k++)(v=b.actions[k])&&(v=nc(c,k,v))&&g.appendChild(v);d.appendChild(B);e.appendChild(f);e.appendChild(d);return e}
- function nc(a,b,c){var e=document.createElement("li"),d=lc(c.style);e.textContent=c.text;d!==lc()&&(e.style.color=d);e.style.borderColor=d;e.dataset.attachmentIndex=a;e.dataset.actionIndex=b;e.className="chatmsg-attachment-actions-item "+Ua;return e}function xb(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(qb());b.appendChild(c);return b};var Ob=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(){z={};l.textContent="";window.emojiProviderHeader&&(l.appendChild(k(window.emojiProviderHeader)),n.textContent="",l.appendChild(n));l.appendChild(k("emojicustom.png"));l.appendChild(v)}function c(){if(!e())return!1;t&&t(null);return!0}function e(){return m.parentElement?(m.parentElement.removeChild(p),m.parentElement.removeChild(m),
- !0):!1}function d(a){var b=0;a=void 0===a?B.value:a;if(h()){var c=0,d=window.searchEmojis(a),e=f(d,J?J.self.W.a:[]),k;for(p in z)z[p].visible&&(z[p].visible=!1,n.removeChild(z[p].c));var p=0;for(k=e.length;p<k;p++){var m=e[p].name,l=z[m];if(!l){var l=z,L=m;var t=m;var m=window.makeEmoji(d[m]),I=document.createElement("span");I.appendChild(m);I.className="emoji-medium";t=g(t,I);l=l[L]=t}l.visible||(l.visible=!0,n.appendChild(l.c));c++}b+=c}p=b;c=0;for(F in A)A[F].visible&&(A[F].visible=!1,v.removeChild(A[F].c));
- if(J){d=f(J.b.data,J?J.self.W.a:[]);var F=0;for(b=d.length;F<b;F++)L=d[F].name,""!==a&&L.substr(0,a.length)!==a||"alias:"===J.b.data[L].substr(0,6)||(e=A[L],e||(e=A,l=k=L,L=J.b.data[L],t=document.createElement("span"),m=document.createElement("span"),t.className="emoji emoji-custom",t.style.backgroundImage='url("'+L+'")',t.textContent=":"+l+":",t.title=l,m.appendChild(t),m.className="emoji-medium",l=g(l,m),e=e[k]=l),e.visible||(e.visible=!0,v.appendChild(e.c)),c++);F=c}else F=0;return p+F}function f(a,
- b){var c=[],d;for(d in a){var e={name:d,ob: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.ob-b.ob})}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 k(a){var b=document.createElement("img"),c=document.createElement("div");b.src=a;c.appendChild(b);c.className="emojibar-header";
- return c}function h(){return"searchEmojis"in window}var m=document.createElement("div"),p=document.createElement("div"),l=document.createElement("div"),n=document.createElement("ul"),v=document.createElement("ul"),B=document.createElement("input"),z={},A={},M=document.createElement("div"),I=document.createElement("span"),F=document.createElement("span"),t,J;p.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()});p.className="emojibar-overlay";m.className="emojibar";l.className="emojibar-emojis";n.className=v.className="emojibar-list";B.className="emojibar-search";M.className="emojibar-detail";I.className="emojibar-detail-img";F.className="emojibar-detail-name";M.appendChild(I);M.appendChild(F);b();m.appendChild(l);m.appendChild(M);m.appendChild(B);B.addEventListener("keyup",function(){d()});m.addEventListener("mousemove",function(b){a(b,function(a){var b=a?z[a]||A[a]:null;b?(I.innerHTML=b.c.outerHTML,
- F.textContent=":"+a+":"):(I.textContent="",F.textContent="")})});m.addEventListener("click",function(b){a(b,function(a){a&&e()&&t&&t(a)})});return{isSupported:h,wa:function(a,b,c){return h()?(J=b,t=c,a.appendChild(p),a.appendChild(m),B.value="",d(),B.focus(),!0):!1},search:d,close:c,reset:function(){b();d()}}}();var C,V=[];function oc(){da.call(this)}oc.prototype=Object.create(da.prototype);oc.prototype.constructor=oc;function sa(a){return a.a?a.a.id:null}function pc(){this.b=0;this.context=new qa;this.a={}}
- pc.prototype.update=function(a){var b=Date.now();a.v&&(this.b=a.v);if(a["static"])for(h in a["static"]){var c=ra(this.context,h);c||(c=new oc,this.context.push(c));var e={};a["static"][h].channels&&a["static"][h].channels.forEach(function(a){a.pins&&(e[a.id]=a.pins,a.pins=void 0)});fa(c,a["static"][h],b);for(var d in e){var f=[],g=this.a[d];g||(g=this.a[d]=new Y(d,250,null,b));e[d].forEach(function(a){f.push(g.a(a,b))});c.m[d].b=f}}ta(this.context,function(a){a.F===a.C&&(a=V.indexOf(a),-1!==a&&V.splice(a,
- 1))});if(a.live){for(h in a.live)(c=this.a[h])?la(c,a.live[h],b):c=this.a[h]=new Y(h,250,a.live[h],b);for(var k in a.live){var h=E(this.context,k);(c=h.m[k])?(this.a[k].i.length&&ha(c,na(this.a[k]).f,b),c.la||(qc(h,c,a.live[k]),D&&a.live[D.id]&&Bb())):C.b=0}}a["static"]&&pb();var m=!1;a.typing&&this.context.a.forEach(function(c){var d=m,e=a.typing,f=!1;if(c.A)for(var g in c.A)e&&!e[g]&&(delete c.A[g],f=!0);if(e)for(g in e)if(c.m[g]){c.A[g]||(c.A[g]={});for(var h in e[g])c.A[g][h]||(f=!0),c.A[g][h]=
- b}m=d|f},this);(a["static"]||m)&&vb();a.config&&(N=new rc(a.config),dc());if(Q&&D&&a["static"]&&a["static"][Q.a.id]&&a["static"][Q.a.id].channels&&a["static"][Q.a.id].channels)for(k=a["static"][Q.a.id].channels,h=0,c=k.length;h<c;h++)if(k[h].id===D.id){Bb();break}};setInterval(function(){var a=!1,b=Date.now();ua(function(c){var e=!1,d;for(d in c.A){var f=!0,g;for(g in c.A[d])c.A[d][g]+6500<b?(delete c.A[d][g],e=!0):f=!1;f&&(delete c.A[d],e=!0)}e&&(a=!0)});a&&vb()},1E3);
- function qc(a,b,c){var e;if(b!==D||!window.hasFocus){var d=(e=a.self?a.self.id:null)?new RegExp("<@"+e):null,f=!1,g=!1,k=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.C)&&c.user!==a.self.id){g=!0;var e;if(!(e=b instanceof r)&&(e=c.text)&&!(e=d&&c.text.match(d)))a:{e=a.self.W.G;for(var h=0,n=e.length;h<n;h++)if(-1!==c.text.indexOf(e[h])){e=!0;break a}e=!1}e&&(-1===V.indexOf(b)&&(k=!0,V.push(b)),f=!0)}});if(g){zb();var h=document.getElementById("room_"+b.id);h&&(h.classList.add("unread"),f&&h.classList.add("unreadHi"));
- k&&!window.hasFocus&&Hb()}}c.forEach(function(a){if(!e||e===a.O)for(var c=0,d=Mb.length;c<d;c++){var f=Mb[c];if(f.channel===b.id&&!!a.isMeMessage===f.Ia&&(a.pendingId===f.ta&&f.ta||!f.ta&&a.text.trim()===f.text)){Mb.splice(c,1);break}}})}
- function Cb(){var a=D,b=V.indexOf(a);if(a.F>a.C){var c=C.a[a.id];c&&(c=na(c))&&(P("POST","api/markread?room="+encodeURIComponent(a.id)+"&id="+c.id+"&ts="+c.f).a(),a.C=c.f)}0<=b&&(V.splice(b,1),zb());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}function sc(){for(var a in C.a)tc(C.a[a]);D&&Bb()}C=new pc;var ub=function(){function a(a,c){c.sort(function(){return Math.random()-.5});for(var d=0,e=20;e<m-40;e+=l)for(var f=0;f+l<=p;f+=l)g(a,c[d],e,f),d++,d===c.length&&(c.sort(b),d=0)}function b(a,b){return a.V?b.V?Math.random()-.5:-1:1}function c(a,b){for(var d=0,f=a.length;d<f;d++)if(void 0===a[d].V){e(a[d].src,function(e){a[d].V=e;c(a,b)});return}var g=[];a.forEach(function(a){a.V&&g.push(a.V)});b(g)}function e(a,b){Ha(Ga(P(a),function(a,c,d){if(d){var e=new Image;e.onload=function(){var a=document.createElement("canvas");
- a.height=a.width=B;a=a.getContext("2d");a.drawImage(e,0,0,B,B);var a=a.getImageData(0,0,B,B),c=0,d;for(d=0;d<a.width*a.height*4;d+=4)a.data[d]=a.data[d+1]=a.data[d+2]=(a.data[d]+a.data[d+1]+a.data[d+2])/3,a.data[d+3]=50,c+=a.data[d];if(50>c/(a.height*a.width))for(d=0;d<a.width*a.height*4;d+=4)a.data[d]=a.data[d+1]=a.data[d+2]=255-a.data[d];b(a)};e.onerror=function(){b(null)};e.src=window.URL.createObjectURL(d)}else b(null)}),function(){b(null)}).j("blob").a()}function d(){var a=h.createLinearGradient(0,
- 0,0,p);a.addColorStop(0,"#4D394B");a.addColorStop(1,"#201820");h.fillStyle=a;h.fillRect(0,0,m,p);return h.getImageData(0,0,m,p)}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]];h.fillStyle="#"+(1.1*a[0]<<16|1.1*a[1]<<8|1.1*a[2]).toString(16);h.beginPath();
- h.moveTo(c+l/2,d+n);h.lineTo(c-n+l,d+l/2);h.lineTo(c+l/2,d-n+l);h.lineTo(c+n,d+l/2);h.closePath();h.fill();h.putImageData(f(h.getImageData(c+n,d+n,v,v),b),c+n,d+n)}var k=document.createElement("canvas"),h=k.getContext("2d"),m=k.width=250,p=k.height=290,l=(m-40)/3,n=.1*l,v=Math.floor(l-2*n),B=.5*v,z={},A={},M={};return function(b,e,f){if(z[b])f(z[b]);else if(M[b])A[b]?A[b].push(f):A[b]=[f];else{var g=d(),h=[];M[b]=!0;A[b]?A[b].push(f):A[b]=[f];for(var l in e)e[l].bb||e[l].Fb||h.push({src:pa(e[l])});
- c(h,function(c){a(g,c);z[b]=k.toDataURL();A[b].forEach(function(a){a(z[b])})})}}}();var X=0,D=null,uc=document.createElement("span"),Q=null,S=null,R=null,Mb=[];function Vb(){Ha(Ga(P("highlight.pack.js"),function(a,b,c){a=document.createElement("script");b=document.createElement("link");a.innerHTML=c;a.language="text/javascript";b.href="hljs-androidstudio.css";b.rel="stylesheet";document.head.appendChild(b);document.body.appendChild(a)}),function(){console.error("Failure loading hljs required files")}).s(6E4).a()}
- function vc(){var a=D;Fa(Ga(P("api/hist?room="+encodeURIComponent(a.id)).j("json"),function(b,c,e){if(e){b=C.a[a.id];var d=Date.now();b?c=!!la(b,e,d):(b=C.a[a.id]=new Y(a,100,e,d),c=!0);c&&(b.i.length&&ha(a,na(b).f,d),qc(E(C.context,a.id),a,e),a===D&&Bb())}}),function(){}).a()}
- function dc(){Ba()&&$b.Nb(!1).display($b.Kb.X);wc();!1!==N.j?(document.getElementById("chatWindow").addEventListener("scroll",Tb),Tb()):(sc(),document.getElementById("chatWindow").removeEventListener("scroll",Tb));for(var a in C.a)C.a[a].i.forEach(function(a){a.c&&a.N()});document.getElementById("customsheet").innerHTML=xc()}
- function bc(){var a=yc;IS_LOCAL||Fa(P("api?v="+C.b),function(b,c,e){(b=2===Math.floor(b/100))?X&&(X=0,yb(!0)):X?(X+=Math.floor((X||5)/2),X=Math.min(60,X)):(X=5,yb(!1));a(b,e)}).j("json").s(6E4).a()}function yc(a,b){a?(b&&C.update(b),bc()):setTimeout(zc,1E3*X)}function zc(){bc()}function Gb(a){if(Ma()){var b=!(!Q||!Q.Y.starChannel);__native.setTitle(a,b,b?D.D:!1)}}
- function Ac(a){D&&(document.getElementById("room_"+D.id).classList.remove("selected"),document.getElementById("chatSystemContainer").classList.add("no-room-selected"),uc.remove());uc.className="chatmsg-unread";uc.textContent=K.Ja;document.getElementById("room_"+a.id).classList.add("selected");document.body.classList.remove("no-room-selected");D=a;Q=E(C.context,a.id);Ma()&&__native.setCurrentChannel(a.id);Ab();Wb.Cb();ub(Q.a.id,Q.l,function(a){document.getElementById("chatCtx").style.backgroundImage=
- "url("+a+")"});(!C.a[D.id]||100>C.a[D.id].i.length)&&vc();document.getElementById("chatSystemContainer").classList.remove("no-room-selected");document.getElementById("chatCtx").classList.remove("opened")}function tb(){var a=document.location.hash.substr(1),b=va(a);return b&&b!==D?(Ac(b),!0):(a=G(a))&&a.S?(Ac(a.S),!0):!1}function Yb(a){P("POST","api/starChannel?room="+encodeURIComponent(a.id)).a()}function Xb(a){P("POST","api/unstarChannel?room="+encodeURIComponent(a.id)).a()}
- function ac(a,b,c){var e=D;new FileReader;var d=new FormData;d.append("file",b);d.append("filename",a);Ha(Ga(P("POST","api/file?room="+encodeURIComponent(e.id)),function(){c(null)}),function(a,b){c(b)}).a(d)}
- function jb(a,b,c,e){b="api/msg?room="+encodeURIComponent(a.id)+"&text="+encodeURIComponent(b);e&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:e.text,author_name:G(e.O).getName(),text:e.text,footer:a.j?K.message:a.name,ts:e.f}])));uc.remove();Ga(P("POST",b).j("json"),function(a,b,e){e&&void 0!==e.pendingId&&(c.ta=e.pendingId)}).a()}function Pb(a,b){P("DELETE","api/pinMsg?room="+encodeURIComponent(a.id)+"&msgId="+b.id).a()}
- function Eb(a,b,c){P("POST","api/reaction?room="+encodeURIComponent(a)+"&msg="+b+"&reaction="+encodeURIComponent(c)).a()}function Zb(){P("POST","api/logout").a();document.cookie="sessID=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";document.location.reload();Ma()&&__native.logout()}
- function sb(){var a={},b=[],c=this.value;ta(C.context,function(b){a[b.id]=ia(b,c)});for(var e in a){var d=document.getElementById("room_"+e);d&&(a[e].name+a[e].sa+a[e].za+a[e].va?(d.classList.remove("hidden"),b.push(e)):d.classList.add("hidden"))}};var ec={noemoji:{qa:"noemoji.js",ca:null,name:"None"},emojione_v2_3:{qa:"emojione_v2.3.sprites.js",ca:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{qa:"emojione_v3.sprites.js",ca:"emojione_v3.sprites.css",name:"Emojione v3"},"emojione_v4.5":{qa:"emojione_v4.5.sprites.js",ca:"emojione_v4.5.sprites.css",name:"Emojione v4.5"}},Bc=ec.emojione_v2_3,eb;
- function Cc(a){eb!==a&&(console.log("Loading emoji pack "+a.name),Ga(P(a.qa),function(b,c,e){b=document.createElement("script");b.innerHTML=e;b.language="text/javascript";document.body.appendChild(b);a.ca&&(e=document.createElement("link"),e.href=a.ca,e.rel="stylesheet",document.head.appendChild(e));e=document.getElementById("emojiButton");sc();Ob.reset();"makeEmoji"in window?(e.style.backgroundImage='url("smile.svg")',e.classList.remove("hidden")):e.classList.add("hidden")}).s(6E4).a(),eb=a)}
- function wc(){var a=N.w;Cc(a&&ec[a]?ec[a]:Bc)};var Wb=function(){function a(){c();t instanceof r?(f.style.backgroundImage="url(api/avatar?size=l&user="+encodeURIComponent(t.a.id)+")",m.textContent=(t.a.qb||(t.a.eb||"")+" "+t.a.ib).trim(),g.classList.add("presence-indicator"),t.a.R?g.classList.remove("presence-away"):g.classList.add("presence-away"),h.classList.remove("hidden"),l.classList.remove("hidden"),l.textContent=t.a.Lb||"",v.textContent=t.a.Bb||"",n.classList.remove("hidden"),d.classList.remove("roominfo-channel"),d.classList.add("roominfo-user")):
- b()}function b(){var a=F;a.Y.topic?(h.classList.remove("hidden"),m.textContent=t.za||"",p.textContent=t.w?K.Na(t.w,t.ga):""):h.classList.add("hidden");a.Y.purpose?(n.classList.remove("hidden"),v.textContent=t.va||"",B.textContent=t.s?K.Na(t.s,t.fa):""):n.classList.add("hidden");f.style.backgroundImage="";g.classList.remove("presence-indicator");M.textContent=K.sb(t.l?Object.keys(t.l).length:0);a=[];if(t.l)for(var b in t.l)a.push(t.l[b]);a.sort(function(a,b){return a.R&&!b.R?-1:b.R&&!a.R?1:a.getName().localeCompare(b.getName())});
- var c=document.createDocumentFragment();a.forEach(function(a){var b=document.createElement("li"),d=document.createElement("a");d.href="#"+a.id;d.textContent=a.getName();b.appendChild(d);b.classList.add("presence-indicator");a.R||b.classList.add("presence-away");c.appendChild(b)});I.textContent="";I.appendChild(c);d.classList.add("roominfo-channel");d.classList.remove("roominfo-user")}function c(){g.textContent=t.name;if(t.b){z.textContent=K.mb(t.b.length);z.classList.remove("hidden");A.classList.remove("hidden");
- var a=document.createDocumentFragment();t.b.forEach(function(b){var c=document.createElement("li"),d=document.createElement("a");d.href="javascript:void(0)";d.dataset.msgId=b.id;d.addEventListener("click",e);d.className=Ua+" roominfo-unpin";c.className="roominfo-pinlist-item";c.appendChild(b.P());c.appendChild(d);a.appendChild(c)});A.textContent="";A.appendChild(a)}else z.classList.add("hidden"),A.classList.add("hidden")}function e(){if(t.b)for(var a=0,b=t.b.length;a<b;a++)if(t.b[a].id===this.dataset.msgId){Pb(t,
- t.b[a]);break}}var d=document.createElement("div"),f=document.createElement("header"),g=document.createElement("h3"),k=document.createElement("div"),h=document.createElement("div"),m=document.createElement("span"),p=document.createElement("span"),l=document.createElement("div"),n=document.createElement("div"),v=document.createElement("span"),B=document.createElement("span"),z=document.createElement("div"),A=document.createElement("ul"),M=document.createElement("div"),I=document.createElement("ul"),
- F,t;d.className="chat-context-roominfo";f.className="roominfo-title";h.className="roominfo-topic";n.className="roominfo-purpose";l.className="roominfo-phone";z.className="roominfo-pincount";A.className="roominfo-pinlist";M.className="roominfo-usercount";I.className="roominfo-userlist";B.className=p.className="roominfo-author";f.appendChild(g);d.appendChild(f);d.appendChild(k);h.appendChild(m);h.appendChild(p);n.appendChild(v);n.appendChild(B);k.appendChild(h);k.appendChild(l);k.appendChild(n);k.appendChild(z);
- k.appendChild(A);k.appendChild(M);k.appendChild(I);var J=null;return{nb:function(b,c){this.ba();F=b;t=c;a();return this},update:function(){this.ba();a();return this},show:function(a){this.ba();a.appendChild(d);d.classList.remove("hidden");return this},Cb:function(){this.ba();d.classList.add("hidden");return this},ba:function(){J&&clearTimeout(J);J=null;return this},Db:function(){J||(J=setTimeout(function(){d.classList.add("hidden");J=null},300));return this},Gb:function(a){for(;a;){if(a===d)return!0;
- a=a.parentNode}return!1}}}();function Y(a,b,c,e){ka.call(this,a,b,0,c,e)}Y.prototype=Object.create(ka.prototype);Y.prototype.constructor=Y;Y.prototype.a=function(a,b){return!0===a.isMeMessage?new Dc(this.id,a,b):!0===a.isNotice?new Ec(this.id,a,b):new Fc(this.id,a,b)};function tc(a){a.i.forEach(function(a){a.K()})}
- var Z=function(){function a(a,e){return Aa(e,{G:a.context.self.W.G,$:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=fb(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null},ra:function(c){return b(a,c)}})}function b(a,b){var c=b.indexOf("|"),e;if(-1===c)var g=b;else{g=b.substr(0,c);var k=b.substr(c+1)}if("@"===g[0])if(g=sa(a.context)+"|"+g.substr(1),e=G(g))a=!0,g="#"+e.S.id,k="@"+e.getName(),e="background-color:"+
- kc(e.getName()),b=["chatmsg-link-user","chatmsg-link"];else return null;else if("#"===g[0])if(g=sa(a.context)+"|"+g.substr(1),k=va(g))a=!0,g="#"+g,k="#"+k.name,b=["chatmsg-link-chan","chatmsg-link"];else return null;else{if(!g.match(/^(https?|mailto):\/\//i))return null;b=["chatmsg-link"];a=!1}return{link:g,text:k||g,style:e,ab:b,hb:a}}return{K:function(a){a.T=!0;return a},ha:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},J:function(a){a.c?a.T&&(a.T=!1,a.N()):a.Fa().N();return a.c},
- N:function(b){var c=G(b.O);b.c.f.innerHTML=K.U(b.f);b.c.xa.innerHTML=a(b,b.text);b.c.na.textContent=c?c.getName():b.username||"?";for(var d=document.createDocumentFragment(),f=c=!1,g=0,k=b.u.length;g<k;g++){var h=b.u[g];if(h){var m=mc(b,h,g);m&&(d.appendChild(m),c|=!!h.image_url,f=!0)}}b.c.u.textContent="";b.c.u.appendChild(d);f?(b.c.L.classList.remove("hidden"),b.c.L.Ob||(d=N,b.c.L.open=1!==d.a&&(d.a!==fc&&void 0!==d.a||c)?!1:!0)):b.c.L.classList.add("hidden");c=b.j;d=document.createDocumentFragment();
- if(b.H)for(var p in b.H){f=c;g=b.id;k=p;h=b.H[p];if(m=fb(k)){for(var l=document.createElement("li"),n=document.createElement("a"),v=document.createElement("span"),B=document.createElement("span"),z=[],A=0,M=h.length;A<M;A++){var I=G(h[A]);I&&z.push(I.getName())}z.sort();B.textContent=z.join(", ");v.appendChild(m);v.className="emoji-small";n.href="javascript:toggleReaction('"+f+"', '"+g+"', '"+k+"')";n.appendChild(v);n.appendChild(B);l.className="chatmsg-reaction-item";l.appendChild(n);f=l}else console.warn("Reaction id not found: "+
- k),f=null;f&&d.appendChild(f)}b.c.H.textContent="";b.c.H.appendChild(d);b.c.ea.pa&&(b.c.ea.pa.style.backgroundImage=b.D?'url("star_full.png")':'url("star_empty.png")');b.I&&(b.c.I.innerHTML=K.I(b.I),b.c.classList.add("edited"));return b},P:function(a){return a.J().cloneNode(!0)},B:function(b,e){return a(b,e)}}}();function Dc(a,b,c){w.call(this,b,c);this.context=E(C.context,a);this.j=a;this.c=Z.c;this.T=Z.T}Dc.prototype=Object.create(x.prototype);q=Dc.prototype;q.constructor=Dc;q.K=function(){return Z.K(this)};
- q.B=function(a){return Z.B(this,a)};q.ha=function(){return Z.ha(this)};q.J=function(){return Z.J(this)};q.Fa=function(){this.c=jc(this);this.c.classList.add("chatmsg-me_message");return this};q.P=function(){return Z.P(this)};q.N=function(){Z.N(this);return this};q.update=function(a,b){x.prototype.update.call(this,a,b);this.K()};function Fc(a,b,c){w.call(this,b,c);this.context=E(C.context,a);this.j=a;this.c=Z.c;this.T=Z.T}Fc.prototype=Object.create(w.prototype);q=Fc.prototype;q.constructor=Fc;
- q.K=function(){return Z.K(this)};q.B=function(a){return Z.B(this,a)};q.ha=function(){return Z.ha(this)};q.J=function(){return Z.J(this)};q.Fa=function(){this.c=jc(this);return this};q.P=function(){return Z.P(this)};q.N=function(){Z.N(this);return this};
- q.update=function(a,b){w.prototype.update.call(this,a,b);this.K();if(a=this.text.match(/^<?https:\/\/www\.openstreetmap\.org\/\?mlat=(-?[0-9\.]+)(&|&)mlon=(-?[0-9\.]+)(&|&)macc=([0-9\.]+)[^\s]*/))this.text=this.text.substr(0,a.index)+this.text.substr(a.index+a[0].length).trim(),this.u.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 Ec(a,b,c){w.call(this,b,c);this.context=E(C.context,a);this.j=a;this.a=null;this.T=!0}Ec.prototype=Object.create(y.prototype);q=Ec.prototype;q.constructor=Ec;q.K=function(){return Z.K(this)};q.B=function(a){return Z.B(this,a)};q.ha=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};q.J=function(){Z.J(this);return this.a};q.P=function(){return this.a.cloneNode(!0)};
- q.Fa=function(){this.c=jc(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=K.lb;this.a.appendChild(this.c);return this};q.N=function(){Z.N(this);return this};q.update=function(a,b){y.prototype.update.call(this,a,b);this.K()};
- function Qb(a,b){var c=jc(null);c.classList.add("chatmsg-pending");b&&c.classList.add("chatmsg-me_message");c.xa.innerHTML=Aa(a,{$:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=fb(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null}});c.na.textContent=Q.self?Q.self.getName():"";a=document.createElement("span");a.className="typing-dot1";a.textContent=".";c.f.appendChild(a);a=document.createElement("span");
- a.className="typing-dot2";a.textContent=".";c.f.appendChild(a);a=document.createElement("span");a.className="typing-dot3";a.textContent=".";c.f.appendChild(a);c.f.classList.add("typing-container");c.L.remove();return c};var N,fc=2;function rc(a){this.X={};for(var b=0,c=a.length;b<c;b++)null===a[b].service&&null===a[b].device&&cc(this,JSON.parse(a[b].config))}
- function cc(a,b){if(b.services)for(var c in b.services)a.X[c]=b.services[c];void 0!==b.emojiProvider&&(a.w=b.emojiProvider);void 0!==b.displayAvatar&&(a.b=b.displayAvatar);void 0!==b.colorfulNames&&(a.s=b.colorfulNames);void 0!==b.scrollAvatars&&(a.j=b.scrollAvatars);void 0!==b.autoExpandAttachments&&(a.a=b.autoExpandAttachments);"string"===typeof a.a&&(a.a=parseInt(a.a,10))}
- function xc(){var a=N,b={},c="";!1===a.b&&(b[".chatsystem-content .chatmsg-authorGroup .chatmsg-author-img-wrapper"]=["display: none"],b[".chatsystem-content .chatmsg-authorGroup"]=["display: flex"],b[".chatsystem-content .chatmsg-authorGroup .chatmsg-author"]=["position:initial","vertical-align:top","min-width:75px"],b[".chatsystem-content .chatmsg-authorGroup .chatmsg-author-messages"]=["padding-top:0","padding-left:0","display:inline-block","margin-top:-4px","flex:1"],b[".chatmsg-author-name::before"]=
- ["content:'<'"],b[".chatmsg-author-name::after"]=["content:'>'"]);!0===a.s||(b[".chatmsg-authorGroup .chatmsg-item .chatmsg-link-user, .chatsystem-content a.chatmsg-author-name, .chatmsg-author-name"]=["background-color: transparent !important;"]);for(var e in b)c+=e+"{",b[e].forEach(function(a){c+=a+";"}),c+="}";return c}N=new rc([]);function Gc(){}Gc.prototype.close=function(){};function Hc(a,b){Gc.apply(this);this.Ma=Ic++;this.xb=a;this.port=b}Hc.prototype=Object.create(Gc);Hc.prototype.constructor=Hc;Hc.prototype.connect=function(){return new Promise(function(){__native.TCPConnect(this.Ma,this.xb,this.port)})};Hc.prototype.write=function(a){__native.TCPWrite(this.Ma,a)};Hc.prototype.close=function(){__native.TCPClose(this.Ma)};var Ic=0;var La=function(){var a={},b=0;return{jb:function(c,e){var d=b++;e&&(c.yb=e);a[""+d]=c;return d},Jb:function(){var b=""+Array.prototype.shift.call(arguments);a[b]&&(a[b].apply(a[b].yb,arguments),delete a[b])}}}();window.__CALLBACK={onResult:La.Jb};function Ma(){return!!("__native"in window)};window.displayMenu=function(){document.getElementById("chatCtx").classList.add("opened")};window.hideMenu=function(){document.getElementById("chatCtx").classList.remove("opened")};window.toggleMenu=function(){Ub()};window.setChannelFavorite=function(a,b){var c=va(a);c?b?Yb(c):Xb(c):console.error("Channel "+a+" not found")};window.onApplicationPaused=function(){window.hasFocus=!1};window.onApplicationResumed=function(){window.hasFocus=!0};var gb=function(){var a=[];return{gb:function(b){for(var c=0,e=a.length;c<e;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},Ab:function(b){var c=[];a.forEach(function(a){for(var d=0,e=a.names.length;d<e;d++)if(a.names[d].substr(0,b.length)===b){c.push(a);break}});return c},Mb:function(b){b.Z="client";b.exec=b.exec.bind(b);a.push(b)}}}();function Jc(){return new Promise(function(a,b){"geolocation"in window.navigator?navigator.geolocation.getCurrentPosition(function(c){c?a(c):b("denied")}):b("geolocation not available")})}
- xa.push(function(){gb.Mb({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:K.rb,exec:function(a,b){Jc().then(function(a){var c=a.coords.latitude,d=a.coords.longitude;jb(b,"https://www.openstreetmap.org/?mlat="+c+"&mlon="+d+"&macc="+a.coords.accuracy+"#map=17/"+c+"/"+d)}).catch(function(a){console.error("Error: ",a)})}})});
- })();
|