mimouchat.min.js 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. "use strict";(function(){
  2. 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.wb=a.desc;this.name=a.name;this.type=a.type;this.usage=a.usage;this.X=a.category}function ca(){this.a={};this.C=[];this.version=0}
  3. ca.prototype.update=function(a,b){a.emoji_use&&(this.a=JSON.parse(a.emoji_use));a.highlight_words?this.C=(a.highlight_words||"").split(",").filter(function(a){return""!==a.trim()}):a.highlights&&(this.C=a.highlights);this.version=Math.max(this.version,b)};function da(){this.a=null;this.j={};this.i={};this.self=null;this.b={version:0,data:{}};this.h={version:0,data:{}};this.u={};this.W={};this.o=0}function ea(a,b){return b.pv?new t(b.id,a.i[b.user]):new u(b.id)}
  4. function fa(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 k=a.i[d+b.users[e].id];k||(k=a.i[d+b.users[e].id]=new ga(b.users[e].id));k.update(b.users[e],c)}if(b.channels)for(e=0,f=b.channels.length;e<f;e++)(k=a.j[d+b.channels[e].id])||(k=a.j[d+b.channels[e].id]=ea(a,b.channels[e])),k.update(b.channels[e],a,c,d);b.emojis&&(a.b.data=b.emojis,a.b.version=c);if(void 0!==b.commands){a.h.data={};for(e in b.commands)a.h.data[e]=
  5. new ba(b.commands[e]);a.h.version=c}b.self&&(a.self=a.i[d+b.self.id]||null,a.self.T||(a.self.T=new ca),b.self.prefs&&a.self.T.update(b.self.prefs,c));b.capacities&&(a.W={},b.capacities.forEach(function(a){this.W[a]=!0},a));a.o=Math.max(a.o,c)}"undefined"!==typeof module&&(module.J.Mb=da,module.J.Nb=aa,module.J.Pb=ba);function u(a){this.id=a;this.A=!1;this.D=0;this.i={};this.version=0}function ha(a,b,c){if(!a.I||a.I<b)a.I=b,a.version=c}
  6. u.prototype.update=function(a,b,c,d){d=d||"";void 0!==a.name&&(this.name=a.name);void 0!==a.is_archived&&(this.ia=a.is_archived);void 0!==a.is_member&&(this.ba=a.is_member);void 0!==a.last_read&&(this.D=Math.max(parseFloat(a.last_read),this.D));void 0!==a.last_msg&&(this.I=parseFloat(a.last_msg));void 0!==a.is_private&&(this.h=a.is_private);void 0!==a.pins&&(this.b=a.pins);this.A=!!a.is_starred;if(a.members&&(this.i={},a.members))for(var e=0,f=a.members.length;e<f;e++){var k=b.i[d+a.members[e]];this.i[k.id]=
  7. k;k.j[this.id]=this}a.topic&&(this.wa=a.topic.value,this.B=b.i[d+a.topic.creator],this.ea=a.topic.last_set);a.purpose&&(this.sa=a.purpose.value,this.o=b.i[d+a.purpose.creator],this.da=a.purpose.last_set);this.version=Math.max(this.version,c)};function ia(a,b){var c=ja;return{name:c.ma(b,a.name),pa:c.ma(b,Object.values(a.i),function(a){return a?a.getName():null}),wa:c.ma(b,a.wa),sa:c.ma(b,a.sa)}}function t(a,b){u.call(this,a);this.a=b;this.name=b.getName();this.h=!0;b.O=this}t.prototype=Object.create(u.prototype);
  8. t.prototype.constructor=t;"undefined"!==typeof module&&(module.J.Vb=u,module.J.Ub=t);function v(a,b){this.K=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.h=this.G=!1;this.F={};this.version=b;this.update(a,b)}function z(a,b){v.call(this,a,b)}function B(a,b){v.call(this,a,b)}
  9. v.prototype.update=function(a,b){if(a){this.text=a.text||"";a.attachments&&(this.s=a.attachments);this.A=!!a.is_starred;this.G=void 0===a.edited?!1:a.edited;this.h=!!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.F=c}a.pendingId&&(this.qa=a.pendingId)}else this.h=!0;this.version=b};function ka(a,b,c,d,e){this.id="string"===typeof a?a:a.id;this.a=[];this.h=c;this.qb=0;this.o=b;d&&la(this,d,e)}
  10. function la(a,b,c){var d=0;b.forEach(function(a){d=Math.max(this.push(a,c),d)}.bind(a));ma(a);return d}ka.prototype.b=function(a,b){return!0===a.isMeMessage?new z(a,b):!0===a.isNotice?new B(a,b):new v(a,b)};
  11. ka.prototype.push=function(a,b){for(var c,d=!1,e,f=0,k=this.a.length;f<k;f++)if(c=this.a[f],c.id===a.id){e=c.update(a,b);d=!0;break}d||(c=this.b(a,b),this.a.push(c),e=c.m);for(;this.a.length>this.o;)this.a.shift();if(this.h)for(a=0;a<this.a.length;a++)this.a[a].version<b-this.h&&this.a.splice(a--,1);return e||0};function na(a){return a.a[a.a.length-1]}function oa(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}
  12. function ma(a){a.a.sort(function(a,c){return a.m-c.m})}z.prototype=Object.create(v.prototype);z.prototype.constructor=z;B.prototype=Object.create(v.prototype);B.prototype.constructor=B;"undefined"!==typeof module&&(module.J={Rb:v,Qb:z,Tb:B,Wb:ka});function ga(a){this.id=a;this.j={};this.O=this.T=null;this.version=0}
  13. ga.prototype.update=function(a,b){void 0!==a.name&&(this.name=a.name);void 0!==a.deleted&&(this.Za=a.deleted);void 0!==a.status&&(this.status=a.status);void 0!==a.goal&&(this.yb=a.goal);void 0!==a.phone&&(this.Hb=a.phone);void 0!==a.first_name&&(this.ab=a.first_name);void 0!==a.last_name&&(this.eb=a.last_name);void 0!==a.real_name&&(this.nb=a.real_name);void 0!==a.isPresent&&(this.N=a.isPresent);a.isBot&&(this.Cb=a.isBot);this.version=Math.max(this.version,b)};
  14. function pa(a){return"api/avatar?user="+a.id}ga.prototype.getName=function(){return this.name||this.nb||this.ab||this.eb};"undefined"!==typeof module&&(module.J.Ob=ga);function qa(){this.a=[]}qa.prototype.push=function(a){this.a.push(a)};function ra(a,b){for(var c=0,d=a.a.length;c<d;c++)if(b===sa(a.a[c]))return a.a[c];return null}function ta(a,b){for(var c=0,d=a.a.length;c<d;c++){var e=a.a[c],f;for(f in e.j)if(!0===b(e.j[f],f))return}}function ua(a){for(var b=C.context,c=0,d=b.a.length;c<d&&!0!==a(b.a[c]);c++);}function D(a,b){for(var c=0,d=a.a.length;c<d;c++)if(a.a[c].j[b])return a.a[c];return null}
  15. function va(a){for(var b=C.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].j[a];if(e)return e}return null}function xa(a){for(var b=C.context,c=[],d=0,e=b.a.length;d<e;d++){var f=b.a[d].j,k;for(k in f)a&&!a(f[k],b.a[d],k)||c.push(k)}return c}function F(a){for(var b=C.context,c=0,d=b.a.length;c<d;c++){var e=b.a[c].i[a];if(e)return e}return null}qa.prototype.Fa=function(a){for(var b=0,c=this.a.length;b<c;b++){var d=this.a[b];if(d.self&&d.self.id===a)return!0}return!1};
  16. "undefined"!==typeof module&&(module.J.Sb=qa);var ja=function(){function a(b,c,d){if(Array.isArray(c)){for(var e=0,f=0,k=c.length;f<k;f++){var g=a(b,c[f],d);if(1===g)return 1;e=Math.max(g,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{ma:a}}();"undefined"!==typeof module&&(module.J.Xb=ja);var G={},J,ya=[];function za(){if(!c){for(var a=0,b=navigator.languages.length;a<b;a++)if(G.hasOwnProperty(navigator.languages[a])){var c=navigator.languages[a];break}c||(c="en")}J=G[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];ya.forEach(function(a){a()})};G.fr={Lb:"Utilisateur inconnu",Kb:"Channel inconnu",hb:"Nouveau message",message:"Message",gb:"Reseau",ib:"(visible seulement par vous)",A:"Favoris",j:"Discutions",pa:"Membres",mb:"Discutions priv\u00e9es",ob:"Partage sa position GPS",ok:"Ok",$a:"Annuler",R: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, "+
  17. a.toLocaleTimeString():a.toLocaleString()},Da: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",
  18. "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"}};
  19. G.fr.jb=function(a){return 0===a?"Pas de message \u00e9pingl\u00e9":a+(1===a?" message \u00e9pingl\u00e9":" messages \u00e9pingl\u00e9s")};G.fr.pb=function(a){return 0===a?"Pas de chatteur":a+(1===a?" chatteur":" chatteurs")};G.fr.G=function(a){return"(edit&eacute; "+G.fr.R(a)+")"};G.fr.Ka=function(a,b){return"par "+a.getName()+" le "+G.fr.R(b)};G.en={Lb:"Unknown member",Kb:"Unknown channel",hb:"New message",message:"Message",gb:"Network",ib:"(only visible to you)",A:"Starred",j:"Channels",pa:"Members",mb:"Direct messages",ob:"Share your GPS location",ok:"Ok",$a:"Cancel",R: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():
  20. a.toLocaleString()},Da: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.",
  21. "settings-serviceAddConfirm":"Next","settings-displayEmojiProviderLbl":"Emoji provider","settings-displayDisplayAvatarLbl":"Display avatars","settings-displayColorfulNamesLbl":"Colorful names","settings-displayScrollAvatarsLbl":"Scroll avatars"}};G.en.jb=function(a){return 0===a?"No pinned messages":a+(1===a?" pinned message":" pinned messages")};G.en.pb=function(a){return 0===a?"No users in this room":a+(1===a?" user":" users")};G.en.G=function(a){return"(edited "+G.en.R(a)+")"};
  22. G.en.Ka=function(a,b){return"by "+a.getName()+" on "+G.en.R(b)};var Aa=function(){function a(a){this.text="";this.g=a}function b(b,c,d){this.$=c;this.f=null;this.l=[];this.a=d||"";this.za="<"===this.a;this.Ia="*"===this.a;this.ya="_"===this.a;this.Aa="~"===this.a||"-"===this.a;this.h=">"===this.a||"&gt;"===this.a;this.B=":"===this.a;this.La="`"===this.a;this.Wa="```"===this.a;this.Ma="\n"===this.a;this.xa=void 0!==d&&-1!==m.C.indexOf(d);this.g=b;this.Ba=null;this.b=this.Ma||this.xa?c+d.length-1:!1;this.xa&&(this.f=new a(this),this.l.push(this.f),this.f.text=d)}
  23. function c(a){a=a||h;for(var d=0,e=a.l.length;d<e;d++){var n=a.l[d];if(n instanceof b)if(n.b){if(n=c(n))return n}else return n}return null}function d(a,c){a.g instanceof b&&(a.g.l.splice(a.g.l.indexOf(a)+(c?1:0)),a.g.f=a.g.l[a.g.l.length-1],d(a.g,!0))}function e(a){return a.replace("<","&lt;")}function f(a){return a}function k(a){return{link:a,text:a,cb:!1}}var g,h,m={C:[],Y:f,va:f,oa:k};b.prototype.Oa=function(){return this.Ia&&!!this.b||this.g instanceof b&&this.g.Oa()};b.prototype.Ra=function(){return this.ya&&
  24. !!this.b||this.g instanceof b&&this.g.Ra()};b.prototype.Sa=function(){return this.Aa&&!!this.b||this.g instanceof b&&this.g.Sa()};b.prototype.ea=function(){return this.B&&!!this.b||this.g instanceof b&&this.g.ea()};b.prototype.Qa=function(){return this.xa&&!!this.b||this.g instanceof b&&this.g.Qa()};b.prototype.Pa=function(){return this.La&&!!this.b||this.g instanceof b&&this.g.Pa()};b.prototype.da=function(){return this.Wa&&!!this.b||this.g instanceof b&&this.g.da()};b.prototype.Ta=function(){for(var a=
  25. 0,c=this.l.length;a<c;a++)if(this.l[a]instanceof b&&(!this.l[a].b||this.l[a].Ta()))return!0;return!1};b.prototype.Ua=function(a){if("<"===this.a&&">"===g[a])return!0;var b=/\S/.test(g[a-1]);if(!this.h&&g.substr(a,this.a.length)===this.a){if(!b&&(this.Ia||this.ya||this.Aa))return!1;if(this.f&&this.Ta())return this.f.Xa();if(this.rb())return!0}return"\n"===g[a]&&this.h?!0:!1};b.prototype.rb=function(){for(var a=this;a;){for(var c=0,d=a.l.length;c<d;c++)if(a.l[c]instanceof b||a.l[c].text.length)return!0;
  26. a=a.Ba}return!1};b.prototype.Xa=function(){var a=new b(this.g,this.$,this.a);a.Ba=this;this.f&&this.f instanceof b&&(a.f=this.f.Xa(),a.l=[a.f]);return a};b.prototype.sb=function(a){return this.B&&(" "===g[a]||"\t"===g[a])||(this.B||this.za||this.Ia||this.ya||this.Aa||this.La)&&"\n"===g[a]?!1:!0};b.prototype.tb=function(b){if(this.La||this.B||this.Wa||this.za)return null;if(!this.f||this.f.b||this.f instanceof a){var c=/\S/.test(g[b-1]),d=/\S/.test(g[b+1]);if("```"===g.substr(b,3))return"```";var e=
  27. h.Ha();if(void 0===e||e){if("&gt;"===g.substr(b,4))return"&gt;";if(">"===g[b])return g[b]}if("`"===g[b]&&!c||"\n"===g[b]||!(-1===["*","~","-","_"].indexOf(g[b])||!d&&void 0!==g[b+1]&&-1==="*~-_<&".split("").indexOf(g[b+1])||c&&void 0!==g[b-1]&&-1==="*~-_<&".split("").indexOf(g[b-1]))||-1!==[":"].indexOf(g[b])&&d||-1!==["<"].indexOf(g[b]))return g[b];c=0;for(d=m.C.length;c<d;c++)if(e=m.C[c],g.substr(b,e.length)===e)return e}return null};a.prototype.Ha=function(){if(""!==this.text.trim())return!1};
  28. b.prototype.Ha=function(){for(var a=this.l.length-1;0<=a;a--){var b=this.l[a].Ha();if(void 0!==b)return b}if(this.Ma||this.h)return!0};a.prototype.o=function(a){this.text+=g[a];return 1};b.prototype.o=function(c){var d=this.f&&!this.f.b&&this.f.Ua?this.f.Ua(c):null;if(d){var e=this.f.a.length;this.f.Na(c);d instanceof b&&(this.f=d,this.l.push(d));return e}if(!this.f||this.f.b||this.f instanceof a||this.f.sb(c)){if(d=this.tb(c))return this.f=new b(this,c,d),this.l.push(this.f),this.f.a.length;if(!this.f||
  29. this.f.b)this.f=new a(this),this.l.push(this.f);return this.f.o(c)}d=this.f.$+1;h.ba(this.f.$);this.f=new a(this);this.f.o(d-1);this.l.pop();this.l.push(this.f);return d-c};b.prototype.Na=function(a){for(var b=this;b;)b.b=a,b=b.Ba};b.prototype.ba=function(a){this.b&&this.b>=a&&(this.b=!1);this.l.forEach(function(c){c instanceof b&&c.ba(a)})};a.prototype.innerHTML=function(){if(this.g.ea()){for(var a=this.g;a&&!a.B;)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))?
  30. a:this.text}if(this.g.da()){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.va(this.text)};a.prototype.outerHTML=function(){var a="span",b=[],c="";if(this.g.da()){a="pre";b.push("codeblock");
  31. var d=this.innerHTML()}else this.g.Pa()?(b.push("code"),d=this.innerHTML()):(this.g.za&&(d=m.oa(this.text))?(a="a",c=' href="'+d.link+'"',d.style&&(c+=' style="'+d.style+'"'),d.cb||(c+=' target="_blank"'),d.Ya&&d.Ya.forEach(function(a){b.push(a)}),d=m.va(d.text)):d=this.innerHTML(),this.g.Oa()&&b.push("bold"),this.g.Ra()&&b.push("italic"),this.g.Sa()&&b.push("strike"),this.g.ea()&&b.push("emoji"),this.g.Qa()&&b.push("highlight"));return"<"+a+c+(b.length?' class="'+b.join(" ")+'"':"")+">"+d+"</"+a+
  32. ">"};b.prototype.outerHTML=function(){var a="";this.h&&(a+='<span class="quote">');this.Ma&&(a+="<br/>");this.l.forEach(function(b){a+=b.outerHTML()});this.h&&(a+="</span>");return a};b.prototype.Va=function(a){this.h&&!this.b&&this.Na(a);this.l.forEach(function(c){c instanceof b&&c.Va(a)})};return function(n,l){l||(l={});m.C=l.C||[];m.Y=l.Y||f;m.va=l.va||e;m.oa=l.oa||k;g=n;h=new b(this,0);l=0;n=g.length;do{for(;l<n;)l+=h.o(l);h.Va(g.length);if(l=c()){d(l,!1);h.ba(l.$);var p=new a(l.g);p.o(l.$);l.g.l.push(p);
  33. l.g.f=p;l=l.$+1}else l=void 0}while(void 0!==l);return h.outerHTML()}}();"undefined"!==typeof module&&(module.J.w=Aa);function Ba(a,b){this.B=b||a;this.method=b?a:"GET"}function M(a,b,c,d){a&&a.forEach(function(a){a(b,c,d)})}function Ca(a,b){a.fa||(a.fa=[]);a.fa.push(b);return a}function N(a,b){a.ha||(a.ha=[]);a.ha.push(b);return a}function Da(a,b){a.ga||(a.ga=[]);a.ga.push(b);return a}
  34. function O(a,b){Ba.call(this,a,b);this.b=new XMLHttpRequest;this.b.onreadystatechange=function(){4===this.b.readyState&&(2===Math.floor(this.b.status/100)?M(this.ha,this.b.status,this.b.statusText,this.b.response):M(this.ga,this.b.status,this.b.statusText,this.b.response),M(this.fa,this.b.status,this.b.statusText,this.b.response))}.bind(this)}O.prototype=Object.create(Ba.prototype);O.prototype.constructor=O;O.prototype.o=function(a){this.b.timeout=a;return this};
  35. O.prototype.h=function(a){this.b.responseType=a;return this};O.prototype.a=function(a){this.b.open(this.method,this.B,!0);this.b.send(a);return this};function Ea(a,b){Ba.call(this,a,b);this.b=5E3;this.responseType="text"}Ea.prototype=Object.create(Ba.prototype);Ea.prototype.constructor=O;Ea.prototype.o=function(a){this.b=a;return this};Ea.prototype.h=function(a){this.responseType=a;return this};
  36. function Fa(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 Ga=function(){var a=document.createElement("a");return function(b){a.href=b;return a.href}}();
  37. Ea.prototype.a=function(a){__native.sendHttpRequest(this.method,Ga(this.B),this.b,this.responseType,Fa(a),Ha.fb(function(a,c,d){try{var b="text"===this.responseType?d:JSON.parse(d)}catch(f){b=d}__native.isDebug()&&console.log(this,{$b:a,statusText:c,Zb:d});2===Math.floor(a/100)?M(this.ha,a,c,b):M(this.ga,a,c,b);M(this.fa,a,c,b)},this));return this};function P(a,b){return Ia()?new Ea(a,b):new O(a,b)};function Ja(a,b){this.title=a;this.content=b;this.c=Ka(this);this.b=La(this);this.a=[];this.h=[]}
  38. function Ka(a){var b=document.createElement("div"),c=document.createElement("header"),d=document.createElement("span"),e=document.createElement("span"),f=document.createElement("div"),k=document.createElement("footer");b.a=document.createElement("span");b.b=document.createElement("span");d.textContent=a.title;"string"==typeof a.content?f.innerHTML=a.content:f.appendChild(a.content);c.className=Ma;d.className=Na;e.className=Oa;e.textContent="x";c.appendChild(d);c.appendChild(e);b.appendChild(c);f.className=
  39. Pa;b.appendChild(f);b.b.className=Qa;b.b.textContent=J.$a;b.b.addEventListener("click",function(){Ra(a,!1)});e.addEventListener("click",function(){Ra(a,!1)});b.a.addEventListener("click",function(){Ra(a,!0)});k.appendChild(b.b);b.a.className=Qa;b.a.textContent=J.ok;k.appendChild(b.a);k.className=Sa+" "+Ta;b.appendChild(k);b.className=Ua;return b}function Ra(a,b){(b?a.a:a.h).forEach(function(a){a()});a.close()}
  40. function La(a){var b=document.createElement("div");b.className=Va;b.addEventListener("click",function(){Ra(this,!1)}.bind(a));return b}function Wa(a,b,c){a.c.a.textContent=b;a.c.b.textContent=c;return a}Ja.prototype.ta=function(a){a=a||document.body;a.appendChild(this.b);a.appendChild(this.c);return this};Ja.prototype.close=function(){this.c.remove();this.b.remove();return this};function Xa(a,b){a.a.push(b);return a};var Qa="button",Sa="button-container",Ua="dialog",Va="dialog-overlay",Ma="dialog-title",Na="dialog-title-label",Oa="dialog-title-close",Pa="dialog-body",Ta="dialog-footer";function Ya(a){var b=document.createElement("lh");b.textContent=a;b.className="chat-command-header";return b}
  41. function Za(a,b){var c=document.createElement("li"),d=document.createElement("span");d.className="chat-command-name";if("string"===typeof a)b&&c.appendChild(b),d.textContent=a,c.appendChild(d);else{b=document.createElement("span");var e=document.createElement("span");d.textContent=a.name;b.textContent=a.usage;e.textContent=a.wb;b.className="chat-command-usage";e.className="chat-command-desc";c.appendChild(d);c.appendChild(b);c.appendChild(e)}c.dataset.input=d.textContent;c.className="chat-command-item";
  42. return c}
  43. function $a(a){var b,c=document.getElementById("slashList");c.dataset.cursor&&delete c.dataset.cursor;var d=[],e=a.value;if(a.selectionStart===a.selectionEnd&&a.selectionStart){for(var f=a.selectionStart,k=a.selectionEnd;f&&" "!==e[f-1];f--);for(b=e.length;k<b&&" "!==e[k];k++);if(f!==k&&0<k-f-1){if("#"===e[f]){var g=Q.j;b=e.substr(f+1,k-f-1);for(var h in g)g[h].name.length>=b.length&&g[h].name.substr(0,b.length)===b&&d.push(g[h])}else if("@"===e[f])for(h in g=R instanceof t?Q.i:R.i,b=e.substr(f+1,
  44. k-f-1),g){var m=g[h].getName();m.length>=b.length&&m.substr(0,b.length)===b&&d.push(g[h])}else if(":"===e[f]&&window.searchEmojis){b=e.substr(f+1,k-f-1);m=window.searchEmojis(b);for(g in m){var m=window.makeEmoji(g,!1),n=document.createElement("span");n.appendChild(m);n.className="emoji-small";d.push({name:":"+g+":",Ea:n,ra:ab.name})}for(h in Q.b.data)h.length>=b.length&&h.substr(0,b.length)===b&&(g=document.createElement("span"),g.className="emoji-small",g.appendChild(bb(h)),d.push({name:":"+h+":",
  45. Ea:g,ra:"custom"}))}d.length&&(c.dataset.cursor=JSON.stringify([f,k]))}}if(!d.length&&"/"===e[0]){h=e.indexOf(" ");f=-1!==h;h=-1===h?e.length:h;b=e.substr(0,h);f?(a=cb.bb(b))&&d.push(a):(d=cb.xb(b),c.dataset.cursor=JSON.stringify([0,a.selectionEnd]));a=Q?Q.h.data:{};for(var l in a)e=a[l],(!f&&e.name.substr(0,h)===b||f&&e.name===b)&&d.push(e);d.sort(function(a,b){return a.X.localeCompare(b.X)||a.name.localeCompare(b.name)})}c.textContent="";if(d.length){l=document.createDocumentFragment();h=0;for(a=
  46. d.length;h<a;h++)if(e=d[h],e instanceof ga){if(!p){var p=!0;l.appendChild(Ya(J.pa))}b=document.createElement("span");b.className="chat-command-userIcon";b.style.backgroundImage='url("'+pa(e)+'")';l.appendChild(Za("@"+e.getName(),b))}else e instanceof u?(p||(p=!0,l.appendChild(Ya(J.j))),l.appendChild(Za("#"+e.name))):e.Ea?(p!==e.ra&&(p=e.ra,l.appendChild(Ya(e.ra))),l.appendChild(Za(e.name,e.Ea))):(p!==e.X&&(p=e.X,l.appendChild(Ya(e.X))),l.appendChild(Za(e)));c.appendChild(l)}}
  47. function db(a){if(S)return P("PUT","api/msg?room="+R.id+"&ts="+S.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,d=cb.bb(c);if(d)return a=a.trim(),d.exec(b,R,a),!0;if(b&&(c=b.h.data[c])){if("/me"===c.name)eb(R,a,!0);else if("/msg"===c.name){a=a.trim();var b=/(\S+)\s+(.*)/.exec(a);a:{var e=b[1],d=Q,f=e,k=[];"#"===f[0]&&(f=f.substr(1));for(var g in d.j)d.j[g].name===f&&k.push(d.j[g]);if(k.length)var h=k[0];else{g=
  48. [];"@"===e[0]&&(e=e.substr(1));for(h in d.i)d.i[h].getName()===e&&g.push(d.j[h]);if(g.length)for(h=0,d=g.length;h<d;h++)if(g[h].O){h=g[h].O;break a}h=null}}h&&eb(h,b[2],!1)}P("POST","api/cmd?room="+R.id+"&cmd="+encodeURIComponent(c.name.substr(1))+"&args="+encodeURIComponent(a)).a();return!0}return!1}h=eb(R,a,!1);fb(R,a,h,T);return!0}function gb(){document.getElementById("msgInput").focus()}
  49. function hb(a){for(var b=1,c=0,d=a.value.length;c<d;c++)"\n"===a.value[c]&&b++;for(a.rows=Math.min(5,b);5>a.rows&&a.scrollHeight>a.clientHeight;)a.rows++}
  50. function ib(){var a=0,b=document.getElementById("msgInput");b.addEventListener("input",function(){if(R){var b=Date.now();a+3E3<b&&(Q.self.N||R instanceof t)&&(P("POST","api/typing?room="+R.id).a(),a=b);$a(this);hb(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),hb(this),this.selectionStart=
  51. this.selectionEnd=a+1):jb(),!1});document.getElementById("slashList").addEventListener("click",function(a){if(R){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;$a(c);c.focus();break}b=b.parentElement}}})};var kb=[],lb=0;
  52. function mb(){var a=document.createDocumentFragment(),b=xa(function(a){return!a.ia&&!1!==a.ba}),c=[],d=[],e=[],f=[],k={};b.sort(function(a,b){if(a[0]!==b[0])return a[0]-b[0];var c=D(C.context,a),d=D(C.context,b);a=c.j[a];b=d.j[b];return a.name===b.name?(k[a.id]=J.Da(c.a.name,a.name),k[b.id]=J.Da(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 t){var b;if(b=!a.a.Za){var g=k[a.id];b=document.createElement("li");var n=document.createElement("a");
  53. b.id="room_"+a.id;n.href="#"+a.id;b.className="chat-context-room chat-ims presence-indicator";n.textContent=g||a.a.getName();b.appendChild(nb());b.appendChild(n);a.a.N||b.classList.add("presence-away");R===a&&b.classList.add("selected");a.I!==a.D&&void 0!==a.I&&(b.classList.add("unread"),b.classList.add("unreadHi"));b=g=b}b&&(a.A?c.push(g):f.push(g))}else if(g=k[a.id],b=document.createElement("li"),n=document.createElement("a"),b.id="room_"+a.id,n.href="#"+a.id,a.h?(b.className="chat-context-room chat-group",
  54. b.dataset.count=Object.keys(a.i||{}).length):b.className="chat-context-room chat-channel",R===a&&b.classList.add("selected"),n.textContent=g||a.name,b.appendChild(nb()),b.appendChild(n),a.I!==a.D&&void 0!==a.I&&(b.classList.add("unread"),0<=U.indexOf(a)&&b.classList.add("unreadHi")),g=b)a.A?c.push(g):a.h?e.push(g):d.push(g)});c.length&&a.appendChild(ob(J.A));c.forEach(function(b){a.appendChild(b)});d.length&&a.appendChild(ob(J.j));d.forEach(function(b){a.appendChild(b)});e.forEach(function(b){a.appendChild(b)});
  55. f.length&&a.appendChild(ob(J.mb));f.forEach(function(b){a.appendChild(b)});document.getElementById("chanList").textContent="";document.getElementById("chanList").appendChild(a);pb.apply(document.getElementById("chanSearch"));qb()?rb(Q.a.id,Q.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"}):Ia()&&(b=__native.getPreviousChannel())&&(document.location.hash=b)}
  56. function sb(){ua(function(a){var b=a.u,c;for(c in a.self.j)if(!a.self.j[c].ia){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.i)(c=a.i[e].O)&&!c.ia&&(d=document.getElementById("room_"+c.id))&&(b[c.id]?d.classList.add("chat-context-typing"):d.classList.remove("chat-context-typing"))});tb()}
  57. function tb(){var a;document.getElementById("whoistyping").textContent="";if(Q&&R&&(a=Q.u[R.id])){var b=document.createDocumentFragment(),c=!1,d;for(d in a)(a=F(d))?b.appendChild(ub(a)):c=!0;c&&(C.b=0);document.getElementById("whoistyping").appendChild(b)}}function vb(a){a?document.body.classList.remove("no-network"):document.body.classList.add("no-network");wb()}
  58. function xb(){var a=R.name||(R.a?R.a.getName():void 0);if(!a){console.error("No name provided for ",R);var a=[],b;for(b in R.i)a.push(R.i[b].getName());a=a.join(", ")}document.getElementById("currentRoomTitle").textContent=a;yb();gb();document.getElementById("fileUploadContainer").classList.add("hidden");zb();T&&(T=null,V());S&&(S=null,V());tb()}
  59. function V(){if(T){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){T=null;V()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(T.L())}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";gb()}
  60. function Ab(){if(S){document.body.classList.add("replyingTo");var a=document.getElementById("replyToContainer"),b=document.createElement("a");b.addEventListener("click",function(){S=null;Ab()});b.className="replyto-close";b.textContent="x";a.textContent="";a.appendChild(b);a.appendChild(S.L());document.getElementById("msgInput").value=S.text}else document.body.classList.remove("replyingTo"),document.getElementById("replyToContainer").textContent="";gb()}
  61. window.toggleReaction=function(a,b,c){var d=C.a[a],e,f;(d=C.a[a])&&(e=oa(d,b))&&(f=D(C.context,a))&&(e.F[c]&&-1!==e.F[c].indexOf(f.self.id)?P("DELETE","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c)).a():Bb(a,b,c))};function Cb(a,b){document.getElementById("linkFavicon").href=a||b?"favicon.png?h="+a+"&m="+b:"favicon_ok.png"}
  62. function wb(){var a=U.length,b="";if(W)b="!"+J.gb+" - Mimouchat",document.getElementById("linkFavicon").href="favicon_err.png";else if(a)b="(!"+a+")",Cb(a,a);else{var c=0;ta(C.context,function(a){a.I>a.D&&c++});c&&(b="("+c+")");Cb(0,c)}!b.length&&R&&(b=R.name);b=b.length?b:"Mimouchat";document.title=b;Db(b)}
  63. function Eb(){if("Notification"in window)if("granted"===Notification.permission){var a=Date.now();if(lb+3E4<a){var b=new Notification(J.hb);lb=a;setTimeout(function(){b.close()},5E3)}}else"denied"!==Notification.permission&&Notification.requestPermission()}
  64. function yb(){var a=document.createDocumentFragment(),b=R.id,c=null,d=0,e=null,f;R.A?document.getElementById("chatSystemContainer").classList.add("starred"):document.getElementById("chatSystemContainer").classList.remove("starred");kb=[];C.a[b]&&C.a[b].a.forEach(function(b){if(b.h)b.Z();else{var g=b.M(),k=!1;c&&c.K===b.K&&b.K?30>Math.abs(d-b.m)&&!(b instanceof z)?e.classList.add("chatmsg-same-ts"):d=b.m:(d=b.m,k=!0);(!c||c.m<=R.D)&&b.m>R.D?g.classList.add("chatmsg-first-unread"):g.classList.remove("chatmsg-first-unread");
  65. if(b instanceof z)e=c=null,d=0,a.appendChild(g),f=null;else{if(k||!f)f=Fb(F(b.K),b.username),kb.push(f),a.appendChild(f);c=b;e=g;f.content.appendChild(g)}}});var k=!0;Gb.forEach(function(b){b.channel===R.id&&(k&&(f=Fb(Q.self,""),a.appendChild(f),k=!1),f.content.appendChild(b.c))});b=document.getElementById("chatWindow");b.textContent="";b.appendChild(a);b.scrollTop=b.scrollHeight-b.clientHeight;wb();window.hasFocus&&zb()}
  66. function Hb(a,b){if(a.classList.contains("chatmsg-hover-reply"))S&&(S=null,Ab()),T!==b&&(T=b,V());else if(a.classList.contains("chatmsg-hover-reaction")){var c=R.id,d=b.id;Ib.ta(document.body,Q,function(a){a&&Bb(c,d,a)})}else a.classList.contains("chatmsg-hover-edit")?(T&&(T=null,V()),S!==b&&(S=b,Ab())):a.classList.contains("chatmsg-hover-star")?b.A?P("DELETE","api/starMsg?room="+R.id+"&msgId="+b.id).a():P("POST","api/starMsg?room="+R.id+"&msgId="+b.id).a():a.classList.contains("chatmsg-hover-pin")?
  67. b.pinned?Jb(R,b):P("POST","api/pinMsg?room="+R.id+"&msgId="+b.id).a():a.classList.contains("chatmsg-hover-remove")&&(T&&(T=null,V()),S&&(S=null,Ab()),P("DELETE","api/msg?room="+R.id+"&ts="+b.id).a())}function eb(a,b,c){b={channel:a.id,text:b.trim(),Fa:c,c:Kb(b,c)};Gb.push(b);a===R&&yb();return b}
  68. function Lb(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=oa(C.a[R.id],d))&&a.s[e]&&a.s[e].actions&&a.s[e].actions[f]&&
  69. Mb(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=oa(C.a[R.id],d))&&Hb(c,a);break}c=c.parentElement}}
  70. function Mb(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 B,message_ts:a.id};P("POST","api/attachmentAction?serviceId="+a.K).a(JSON.stringify(d))}var e=R.id;c.confirm?Xa(Wa(new Ja(c.confirm.title,c.confirm.text),c.confirm.ok_text,c.confirm.dismiss_text),d).ta():d()}
  71. function Nb(){if(!1!==X.a&&!1!==X.b){var a=document.getElementById("chatWindow").getBoundingClientRect().top;kb.forEach(function(b){var c=b.ja,d=c.clientHeight;b=b.getBoundingClientRect();c.style.top=Math.max(0,Math.min(a-b.top,b.height-d-d/2))+"px"})}}function Ob(){var a=document.getElementById("chatCtx");a.classList.contains("opened")?a.classList.remove("opened"):a.classList.add("opened")}
  72. document.addEventListener("DOMContentLoaded",function(){za();Pb();ib();var a=document.getElementById("chanSearch");a.addEventListener("input",pb);a.addEventListener("blur",pb);document.getElementById("chatWindow").addEventListener("click",Lb);window.addEventListener("hashchange",function(){document.location.hash&&"#"===document.location.hash[0]&&qb()});document.addEventListener("mouseover",function(a){a=a.target;if(Qb.Db(a))Qb.aa();else{for(;a&&a!==this;){if("A"===a.nodeName){var b=a.href,d=b.indexOf("#");
  73. if(0<=d){b=b.substr(d+1);if(d=D(C.context,b)){Qb.kb(d,d.j[b]).show(a);return}a:{for(var d=C.context,e=0,f=d.a.length;e<f;e++)if(d.a[e].i[b]){d=d.a[e];break a}d=null}if(d&&(b=d.i[b].O)){Qb.kb(d,b).show(a);return}}}a=a.parentElement}Qb.Ab()}});document.getElementById("chatCtxButton").addEventListener("click",Ob);document.getElementById("currentRoomStar").addEventListener("click",function(a){a.preventDefault();R&&(R.A?Rb(R):Sb(R));return!1});document.getElementById("fileUploadCancel").addEventListener("click",
  74. 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",Tb);document.getElementById("ctxMenuSettings").addEventListener("click",function(a){a.preventDefault();Ub.display()});document.getElementById("fileUploadForm").addEventListener("submit",function(a){a.preventDefault();
  75. a=document.getElementById("fileUploadInput");var b=a.value;b&&(b=b.substr(b.lastIndexOf("\\")+1),Vb(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();R&&document.getElementById("fileUploadContainer").classList.remove("hidden");
  76. return!1});document.getElementById("msgFormSubmit").addEventListener("click",function(a){a.preventDefault();jb();return!1});document.getElementById("msgForm").addEventListener("submit",function(a){a.preventDefault();jb();return!1});window.addEventListener("blur",function(){window.hasFocus=!1});window.addEventListener("focus",function(){window.hasFocus=!0;lb=0;R&&zb();gb()});window.hasFocus=!0;document.getElementById("emojiButton").addEventListener("click",function(){Q&&Ib.ta(document.body,Q,function(a){a&&
  77. (document.getElementById("msgInput").value+=":"+a+":");gb()})});Ia()&&(__native.readSmsPermission(Ha.fb(function(){var a=JSON.parse(__native.getStatic());a&&C.update(a)})),document.body.classList.add("native"));IS_LOCAL||Wb()});function jb(){var a=document.getElementById("msgInput");R&&a.value&&db(a.value)&&(a.value="",T&&(T=null,V()),S&&(S=null,V()),document.getElementById("slashList").textContent="",hb(a));gb()};var Ub=function(){function a(){document.getElementById("settings").classList.add("hidden");c=!1}function b(a){d&&(document.getElementById("settings").classList.remove("display-"+d),document.getElementById("setting-menu-"+d).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");d=a}var c=!1,d=null,e={U:"services",
  78. display:"display",Yb:"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 d in e)if(e[d]===c.dataset.target){b(e[d]);return}});document.getElementById("settingDiscardClose").addEventListener("click",a);document.getElementById("settings-serviceAddButton").addEventListener("click",function(a){a.preventDefault();document.getElementById("settings-serviceAddSection").classList.remove("hidden");
  79. 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!==X.o&&(b.emojiProvider=document.getElementById("settings-displayEmojiProvider").value);var c=!!document.getElementById("settings-displayDisplayAvatar").checked;
  80. c!==(!1!==X.a)&&(b.displayAvatar=c);c=!!document.getElementById("settings-displayColorfulNames").checked;c!==(!0===X.h)&&(b.colorfulNames=c);c=!!document.getElementById("settings-displayScrollAvatars").checked;c!==(!1!==X.b)&&(b.scrollAvatars=c);var c=X,d;for(d in b){Xb(c,b);Yb();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 d=document.createDocumentFragment(),
  81. f=!1,h;for(h in X.U){var m=X.U[h];for(p in m){var f=document.createElement("li"),n=document.createElement("span"),l=document.createElement("span");n.textContent=h;l.textContent=m[p];f.className="settings-service-list-item";n.className="settings-service-list-item-provider";l.className="settings-service-list-item-service";f.appendChild(n);f.appendChild(l);d.appendChild(f);f=!0}}m=document.getElementById("settings-serviceList");m.textContent="";f?(document.getElementById("settings-serviceListEmpty").classList.remove("hidden"),
  82. m.appendChild(d)):document.getElementById("settings-serviceListEmpty").classList.add("hidden");d=document.createDocumentFragment();m=document.getElementById("settings-displayEmojiProvider");for(h in Zb){var p=document.createElement("option");p.value=h;p.textContent=Zb[h].name;Zb[h]===ab&&(p.selected=!0);d.appendChild(p)}m.textContent="";m.appendChild(d);document.getElementById("settings-displayDisplayAvatar").checked=!1!==X.a;document.getElementById("settings-displayColorfulNames").checked=!0===X.h;
  83. document.getElementById("settings-displayScrollAvatars").checked=!1!==X.b;c=!0}b(a||e.U);return this},Jb:function(){return this},Gb:e}}();function $b(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.S=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");
  84. d.height=d.width=e.height=e.width=300;var f=d.getContext("2d"),k=e.getContext("2d"),g=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){k.fillStyle="#808080";k.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),K=Math.floor(m),
  85. wa=h?100*h/g(180/Math.PI*Math.atan(.5*(Math.exp(Math.PI-2*Math.PI*K/n)-Math.exp(-(Math.PI-2*Math.PI*K/n)))),p/n*360-180,(p+1)/n*360-180):0;d=b;for(e=0;3>e;e++)for(h=0;3>h;h++)c(a,p+e-1,K+h-1,{Bb:e,Eb:h,qb:d}).then(function(a){if(a.qb===b){k.drawImage(a.S,100*a.Bb,100*a.Eb,100,100);a=l-p;var c=m-K;a=100*a+100;c=100*c+100;f.putImageData(k.getImageData(0,0,300,300),0,0);void 0!==wa&&(f.beginPath(),f.arc(a,c,Math.max(wa,10),0,2*Math.PI,!1),f.lineWidth=2,f.fillStyle="rgba(244, 146, 66, 0.4)",f.strokeStyle=
  86. "rgba(244, 146, 66, 0.8)",f.stroke(),f.fill());if(void 0===wa||25<wa)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,n=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)))};n(12);var e=document.createElement("div"),l=document.createElement("div"),p=document.createElement("button"),w=document.createElement("button");e.className=
  87. "OSM-wrapper";d.className="OSM-canvas";l.className="OSM-controls";w.className="OSM-controls-zoomMin";p.className="OSM-controls-zoomPlus";w.addEventListener("click",function(){n(m-1)});p.addEventListener("click",function(){n(m+1)});l.appendChild(w);l.appendChild(p);e.appendChild(d);e.appendChild(l);return e}};function nb(){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 ob=function(){var a={};return function(b){var c=a[b];c||(c=a[b]=document.createElement("header"),c.textContent=b);return c}}();
  88. function ac(a){var b={},c=a;if(Q)for(var d=Q;!b[a];){var e=d.b.data[a];if(e)if("alias:"==e.substr(0,6))b[a]=!0,a=e.substr(6);else return a=document.createElement("span"),a.className="emoji-custom emoji",a.style.backgroundImage="url('"+e+"')",a.textContent=":"+c+":",a.title=c,a;else return a}return c}function bb(a){return"makeEmoji"in window?(a=ac(a),"string"===typeof a&&(a=window.makeEmoji(a)),"string"===typeof a?null:a):null}
  89. function bc(a){var b=document.createElement("div"),c=document.createElement("div");b.ca=document.createElement("ul");b.s=document.createElement("ul");b.F=document.createElement("ul");b.m=document.createElement("div");b.ua=document.createElement("div");b.ka=document.createElement("span");b.className="chatmsg-item";b.m.className="chatmsg-ts";b.ua.className="chatmsg-msg";b.ka.className="chatmsg-author-name";if(a){b.id=a.b+"_"+a.id;var d=b.ca,e=a.context.W;a=C.context.Fa(a.K);if(e.replyToMsg){var f=document.createElement("li");
  90. f.className="chatmsg-hover-reply";f.style.backgroundImage='url("repl.svg")';d.appendChild(f)}e.reactMsg&&(f=document.createElement("li"),f.className="chatmsg-hover-reaction",f.style.backgroundImage='url("smile.svg")',d.appendChild(f));if(a&&e.editMsg||e.editOtherMsg)f=document.createElement("li"),f.className="chatmsg-hover-edit",f.style.backgroundImage='url("edit.svg")',d.appendChild(f);e.starMsg&&(d.na=document.createElement("li"),d.na.className="chatmsg-hover-star",d.appendChild(d.na));e.pinMsg&&
  91. (f=document.createElement("li"),f.className="chatmsg-hover-pin",d.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")',d.appendChild(e);b.ca.className="chatmsg-hover"}c.appendChild(b.ka);c.appendChild(b.ua);c.appendChild(b.m);c.appendChild(b.s);b.G=document.createElement("div");b.G.className="chatmsg-edited";c.appendChild(b.G);c.appendChild(b.F);c.className=
  92. "chatmsg-content";b.s.className="chatmsg-attachments";b.F.className="chatmsg-reactions";b.appendChild(c);b.appendChild(b.ca);return b}function cc(a){if(!a.length)return"black";for(var b=0,c=0,c=[],d=0,e=0,f=0,k,g=0,h=a.length;g<h;g++)c[g]=a.charCodeAt(g),d+=c[g];k=d/a.length;c.forEach(function(a){var c=Math.abs(k-a);e+=c;f=Math.max(c,f);b=a+((b<<5)-b)});e/=a.length;b=Math.abs(b-60)%199*360/199;c=f?Math.round(Math.min(100,Math.max(75,e/f*25+75))):100;return"hsl("+b+", 100%, "+c+"%)"}
  93. function Fb(a,b){var c=document.createElement("div"),d=document.createElement("div"),e=document.createElement("a"),f=document.createElement("img");c.ja=document.createElement("span");c.ja.className="chatmsg-author-img-wrapper";f.className="chatmsg-author-img";e.className="chatmsg-author-name";e.href="#"+a.id;a?(e.textContent=a.getName(),e.style.backgroundColor=cc(a.getName()),f.src=pa(a)):(e.textContent=b||"?",f.src="");c.ja.appendChild(f);d.appendChild(c.ja);d.appendChild(e);d.className="chatmsg-author";
  94. c.className="chatmsg-authorGroup";c.appendChild(d);c.content=document.createElement("div");c.content.className="chatmsg-author-messages";c.appendChild(c.content);return c}function dc(a){var b={good:"#2fa44f",warning:"#de9e31",danger:"#d50200"};if(a){if("#"===a[0])return a;if(b[a])return b[a]}return"#e3e4e6"}
  95. function ec(a,b,c){var d=document.createElement("li"),e=document.createElement("div"),f=document.createElement("div"),k=document.createElement("a"),g=document.createElement("div"),h=document.createElement("img"),m=document.createElement("a"),n=document.createElement("div"),l=document.createElement("div"),p=document.createElement("div"),w=document.createElement("img"),A=document.createElement("div");d.className="chatmsg-attachment";e.style.borderColor=dc(b.color||"");e.className="chatmsg-attachment-block";
  96. f.className="chatmsg-attachment-pretext";b.pretext?f.innerHTML=a.w(b.pretext):f.classList.add("hidden");k.target="_blank";b.title?(k.innerHTML=a.w(b.title),b.title_link&&(k.href=b.title_link),k.className="chatmsg-attachment-title"):k.className="hidden chatmsg-attachment-title";m.target="_blank";g.className="chatmsg-author";b.author_name&&(m.innerHTML=a.w(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,g.appendChild(h)),
  97. g.appendChild(m));p.className="chatmsg-attachment-thumb";b.thumb_url?(h=document.createElement("img"),h.src=b.thumb_url,p.appendChild(h),e.classList.add("has-thumb"),b.video_html&&(p.dataset.video=b.video_html)):p.classList.add("hidden");n.className="chatmsg-attachment-content";h=a.w(b.text||"");l.className="chatmsg-attachment-text";h&&""!=h?l.innerHTML=h:l.classList.add("hidden");n.appendChild(p);n.appendChild(l);b.geo&&(l=$b(b.geo))&&n.appendChild(l);w.className="chatmsg-attachment-img";b.image_url?
  98. w.src=b.image_url:w.classList.add("hidden");A.className="chatmsg-attachment-footer";b.footer&&(l=document.createElement("span"),l.className="chatmsg-attachment-footer-text",l.innerHTML=a.w(b.footer),b.footer_icon&&(p=document.createElement("img"),p.src=b.footer_icon,p.className="chatmsg-attachment-footer-icon",A.appendChild(p)),A.appendChild(l));b.ts&&(l=document.createElement("span"),l.className="chatmsg-ts",l.innerHTML=J.R(b.ts),A.appendChild(l));e.appendChild(k);e.appendChild(g);e.appendChild(n);
  99. e.appendChild(w);if(b.fields&&b.fields.length){var x=document.createElement("ul");e.appendChild(x);x.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&&x.appendChild(e)})}if(b.actions&&
  100. b.actions.length)for(k=document.createElement("ul"),k.className="chatmsg-attachment-actions "+Sa,e.appendChild(k),g=0,n=b.actions.length;g<n;g++)(w=b.actions[g])&&(w=fc(c,g,w))&&k.appendChild(w);e.appendChild(A);d.appendChild(f);d.appendChild(e);return d}
  101. function fc(a,b,c){var d=document.createElement("li"),e=dc(c.style);d.textContent=c.text;e!==dc()&&(d.style.color=e);d.style.borderColor=e;d.dataset.attachmentIndex=a;d.dataset.actionIndex=b;d.className="chatmsg-attachment-actions-item "+Qa;return d}function ub(a){var b=document.createElement("li"),c=document.createElement("span");c.textContent=a.getName();b.appendChild(nb());b.appendChild(c);return b};var Ib=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(){x={};l.textContent="";window.emojiProviderHeader&&(l.appendChild(g(window.emojiProviderHeader)),p.textContent="",l.appendChild(p));l.appendChild(g("emojicustom.png"));l.appendChild(w)}function c(){if(!d())return!1;r&&r(null);return!0}function d(){return m.parentElement?(m.parentElement.removeChild(n),m.parentElement.removeChild(m),
  102. !0):!1}function e(a){var b=0;a=void 0===a?A.value:a;if(h()){var c=0,d=window.searchEmojis(a),e=f(d,I?I.self.T.a:[]),g;for(n in x)x[n].visible&&(x[n].visible=!1,p.removeChild(x[n].c));var n=0;for(g=e.length;n<g;n++){var l=e[n].name,m=x[l];if(!m){var m=x,K=l;var r=l;var l=window.makeEmoji(d[l]),H=document.createElement("span");H.appendChild(l);H.className="emoji-medium";r=k(r,H);m=m[K]=r}m.visible||(m.visible=!0,p.appendChild(m.c));c++}b+=c}n=b;c=0;for(E in y)y[E].visible&&(y[E].visible=!1,w.removeChild(y[E].c));
  103. if(I){d=f(I.b.data,I?I.self.T.a:[]);var E=0;for(b=d.length;E<b;E++)K=d[E].name,""!==a&&K.substr(0,a.length)!==a||"alias:"===I.b.data[K].substr(0,6)||(e=y[K],e||(e=y,m=g=K,K=I.b.data[K],r=document.createElement("span"),l=document.createElement("span"),r.className="emoji emoji-custom",r.style.backgroundImage='url("'+K+'")',r.textContent=":"+m+":",r.title=m,l.appendChild(r),l.className="emoji-medium",m=k(m,l),e=e[g]=m),e.visible||(e.visible=!0,w.appendChild(e.c)),c++);E=c}else E=0;return n+E}function f(a,
  104. b){var c=[],d;for(d in a){var e={name:d,lb: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.lb-b.lb})}function k(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 g(a){var b=document.createElement("img"),c=document.createElement("div");b.src=a;c.appendChild(b);c.className="emojibar-header";
  105. return c}function h(){return"searchEmojis"in window}var m=document.createElement("div"),n=document.createElement("div"),l=document.createElement("div"),p=document.createElement("ul"),w=document.createElement("ul"),A=document.createElement("input"),x={},y={},L=document.createElement("div"),H=document.createElement("span"),E=document.createElement("span"),r,I;n.addEventListener("click",function(a){var b=m.getBoundingClientRect();(a.screenY<b.top||a.screenY>b.bottom||a.screenX<b.left||a.screenX>b.right)&&
  106. c()});n.className="emojibar-overlay";m.className="emojibar";l.className="emojibar-emojis";p.className=w.className="emojibar-list";A.className="emojibar-search";L.className="emojibar-detail";H.className="emojibar-detail-img";E.className="emojibar-detail-name";L.appendChild(H);L.appendChild(E);b();m.appendChild(l);m.appendChild(L);m.appendChild(A);A.addEventListener("keyup",function(){e()});m.addEventListener("mousemove",function(b){a(b,function(a){var b=a?x[a]||y[a]:null;b?(H.innerHTML=b.c.outerHTML,
  107. E.textContent=":"+a+":"):(H.textContent="",E.textContent="")})});m.addEventListener("click",function(b){a(b,function(a){a&&d()&&r&&r(a)})});return{isSupported:h,ta:function(a,b,c){return h()?(I=b,r=c,a.appendChild(n),a.appendChild(m),A.value="",e(),A.focus(),!0):!1},search:e,close:c,reset:function(){b();e()}}}();var C,U=[];function gc(){da.call(this)}gc.prototype=Object.create(da.prototype);gc.prototype.constructor=gc;function sa(a){return a.a?a.a.id:null}function hc(){this.b=0;this.context=new qa;this.a={}}
  108. hc.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 gc,this.context.push(c));var d={};a["static"][h].channels&&a["static"][h].channels.forEach(function(a){a.pins&&(d[a.id]=a.pins,a.pins=void 0)});fa(c,a["static"][h],b);for(var e in d){var f=[],k=this.a[e];k||(k=this.a[e]=new Y(e,250,null,b));d[e].forEach(function(a){f.push(k.b(a,b))});c.j[e].b=f}}ta(this.context,function(a){a.I===a.D&&(a=U.indexOf(a),-1!==a&&U.splice(a,
  109. 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 g in a.live){var h=D(this.context,g);(c=h.j[g])?(this.a[g].a.length&&ha(c,na(this.a[g]).m,b),c.ia||(ic(h,c,a.live[g]),R&&a.live[R.id]&&yb())):C.b=0}}a["static"]&&mb();var m=!1;a.typing&&this.context.a.forEach(function(c){var d=m,e=a.typing,f=!1;if(c.u)for(var g in c.u)e&&!e[g]&&(delete c.u[g],f=!0);if(e)for(g in e)if(c.j[g]){c.u[g]||(c.u[g]={});for(var h in e[g])c.u[g][h]||(f=!0),c.u[g][h]=
  110. b}m=d|f},this);(a["static"]||m)&&sb();a.config&&(X=new jc(a.config),Yb());if(Q&&R&&a["static"]&&a["static"][Q.a.id]&&a["static"][Q.a.id].channels&&a["static"][Q.a.id].channels)for(g=a["static"][Q.a.id].channels,h=0,c=g.length;h<c;h++)if(g[h].id===R.id){yb();break}};setInterval(function(){var a=!1,b=Date.now();ua(function(c){var d=!1,e;for(e in c.u){var f=!0,k;for(k in c.u[e])c.u[e][k]+6500<b?(delete c.u[e][k],d=!0):f=!1;f&&(delete c.u[e],d=!0)}d&&(a=!0)});a&&sb()},1E3);
  111. function ic(a,b,c){var d;if(b!==R||!window.hasFocus){var e=(d=a.self?a.self.id:null)?new RegExp("<@"+d):null,f=!1,k=!1,g=!1;c.forEach(function(c){if(!(parseFloat(c.ts)<=b.D)&&c.user!==a.self.id){k=!0;var d;if(!(d=b instanceof t)&&(d=c.text)&&!(d=e&&c.text.match(e)))a:{d=a.self.T.C;for(var h=0,m=d.length;h<m;h++)if(-1!==c.text.indexOf(d[h])){d=!0;break a}d=!1}d&&(-1===U.indexOf(b)&&(g=!0,U.push(b)),f=!0)}});if(k){wb();var h=document.getElementById("room_"+b.id);h&&(h.classList.add("unread"),f&&h.classList.add("unreadHi"));
  112. g&&!window.hasFocus&&Eb()}}c.forEach(function(a){if(!d||d===a.K)for(var c=0,e=Gb.length;c<e;c++){var f=Gb[c];if(f.channel===b.id&&!!a.isMeMessage===f.Fa&&(a.pendingId===f.qa&&f.qa||!f.qa&&a.text.trim()===f.text)){Gb.splice(c,1);break}}})}
  113. function zb(){var a=R,b=U.indexOf(a);if(a.I>a.D){var c=C.a[a.id];c&&(c=na(c))&&(P("POST","api/markread?room="+a.id+"&id="+c.id+"&ts="+c.m).a(),a.D=c.m)}0<=b&&(U.splice(b,1),wb());a=document.getElementById("room_"+a.id);a.classList.remove("unread");a.classList.remove("unreadHi")}function kc(){for(var a in C.a)lc(C.a[a]);R&&yb()}C=new hc;var rb=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<=n;f+=l)k(a,c[d],e,f),d++,d===c.length&&(c.sort(b),d=0)}function b(a,b){return a.S?b.S?Math.random()-.5:-1:1}function c(a,b){for(var e=0,f=a.length;e<f;e++)if(void 0===a[e].S){d(a[e].src,function(d){a[e].S=d;c(a,b)});return}var g=[];a.forEach(function(a){a.S&&g.push(a.S)});b(g)}function d(a,b){Da(N(P(a),function(a,c,d){if(d){var e=new Image;e.onload=function(){var a=document.createElement("canvas");
  114. a.height=a.width=A;a=a.getContext("2d");a.drawImage(e,0,0,A,A);var a=a.getImageData(0,0,A,A),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)}).h("blob").a()}function e(){var a=h.createLinearGradient(0,
  115. 0,0,n);a.addColorStop(0,"#4D394B");a.addColorStop(1,"#201820");h.fillStyle=a;h.fillRect(0,0,m,n);return h.getImageData(0,0,m,n)}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 k(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();
  116. h.moveTo(c+l/2,d+p);h.lineTo(c-p+l,d+l/2);h.lineTo(c+l/2,d-p+l);h.lineTo(c+p,d+l/2);h.closePath();h.fill();h.putImageData(f(h.getImageData(c+p,d+p,w,w),b),c+p,d+p)}var g=document.createElement("canvas"),h=g.getContext("2d"),m=g.width=250,n=g.height=290,l=(m-40)/3,p=.1*l,w=Math.floor(l-2*p),A=.5*w,x={},y={},L={};return function(b,d,f){if(x[b])f(x[b]);else if(L[b])y[b]?y[b].push(f):y[b]=[f];else{var h=e(),k=[];L[b]=!0;y[b]?y[b].push(f):y[b]=[f];for(var l in d)d[l].Za||d[l].Cb||k.push({src:pa(d[l])});
  117. c(k,function(c){a(h,c);x[b]=g.toDataURL();y[b].forEach(function(a){a(x[b])})})}}}();var W=0,R=null,Q=null,T=null,S=null,Gb=[];function Pb(){Da(N(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")}).o(6E4).a()}
  118. function mc(){var a=R;Ca(N(P("api/hist?room="+a.id).h("json"),function(b,c,d){if(d){b=C.a[a.id];var e=Date.now();b?c=!!la(b,d,e):(b=C.a[a.id]=new Y(a,100,d,e),c=!0);c&&(b.a.length&&ha(a,na(b).m,e),ic(D(C.context,a.id),a,d),a===R&&yb())}}),function(){}).a()}
  119. function Yb(){a:{var a=X.U;for(var b in a)if(a.hasOwnProperty(b)){a=!1;break a}a=!0}a&&Ub.Jb(!1).display(Ub.Gb.U);a=X.o;nc(a&&Zb[a]?Zb[a]:oc);!1!==X.b?(document.getElementById("chatWindow").addEventListener("scroll",Nb),Nb()):(kc(),document.getElementById("chatWindow").removeEventListener("scroll",Nb));document.getElementById("customsheet").innerHTML=pc()}
  120. function Wb(){var a=qc;IS_LOCAL||Ca(P("api?v="+C.b),function(b,c,d){(b=2===Math.floor(b/100))?W&&(W=0,vb(!0)):W?(W+=Math.floor((W||5)/2),W=Math.min(60,W)):(W=5,vb(!1));a(b,d)}).h("json").o(6E4).a()}function qc(a,b){a?(b&&C.update(b),Wb()):setTimeout(rc,1E3*W)}function rc(){Wb()}function Db(a){if(Ia()){var b=!(!Q||!Q.W.starChannel);__native.setTitle(a,b,b?R.A:!1)}}
  121. function sc(a){R&&(document.getElementById("room_"+R.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");R=a;Q=D(C.context,a.id);Ia()&&__native.setCurrentChannel(a.id);xb();Qb.zb();rb(Q.a.id,Q.i,function(a){document.getElementById("chatCtx").style.backgroundImage="url("+a+")"});(!C.a[R.id]||100>C.a[R.id].a.length)&&mc();document.getElementById("chatSystemContainer").classList.remove("no-room-selected");
  122. document.getElementById("chatCtx").classList.remove("opened")}function qb(){var a=document.location.hash.substr(1),b=va(a);return b&&b!==R?(sc(b),!0):(a=F(a))&&a.O?(sc(a.O),!0):!1}function Sb(a){P("POST","api/starChannel?room="+a.id).a()}function Rb(a){P("POST","api/unstarChannel?room="+a.id).a()}function Vb(a,b,c){var d=R;new FileReader;var e=new FormData;e.append("file",b);e.append("filename",a);Da(N(P("POST","api/file?room="+d.id),function(){c(null)}),function(a,b){c(b)}).a(e)}
  123. function fb(a,b,c,d){b="api/msg?room="+a.id+"&text="+encodeURIComponent(b);d&&(b+="&attachments="+encodeURIComponent(JSON.stringify([{fallback:d.text,author_name:F(d.K).getName(),text:d.text,footer:a.h?J.message:a.name,ts:d.m}])));N(P("POST",b).h("json"),function(a,b,d){d&&void 0!==d.pendingId&&(c.qa=d.pendingId)}).a()}function Jb(a,b){P("DELETE","api/pinMsg?room="+a.id+"&msgId="+b.id).a()}function Bb(a,b,c){P("POST","api/reaction?room="+a+"&msg="+b+"&reaction="+encodeURIComponent(c)).a()}
  124. function Tb(){P("POST","api/logout").a();document.cookie="sessID=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";document.location.reload();Ia()&&__native.logout()}function pb(){var a={},b=[],c=this.value;ta(C.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].pa+a[d].wa+a[d].sa?(e.classList.remove("hidden"),b.push(d)):e.classList.add("hidden"))}};var Zb={noemoji:{Ga:"noemoji.js",la:null,name:"None"},emojione_v2_3:{Ga:"emojione_v2.3.sprites.js",la:"emojione_v2.3.sprites.css",name:"Emojione v2.3"},emojione_v3:{Ga:"emojione_v3.sprites.js",la:"emojione_v3.sprites.css",name:"Emojione v3"}},oc=Zb.emojione_v2_3,ab;
  125. function nc(a){ab!==a&&(console.log("Loading emoji pack "+a.name),N(P(a.Ga),function(b,c,d){b=document.createElement("script");b.innerHTML=d;b.language="text/javascript";document.body.appendChild(b);a.la&&(d=document.createElement("link"),d.href=a.la,d.rel="stylesheet",document.head.appendChild(d));d=document.getElementById("emojiButton");kc();Ib.reset();"makeEmoji"in window?(d.style.backgroundImage='url("smile.svg")',d.classList.remove("hidden")):d.classList.add("hidden")}).o(6E4).a(),ab=a)};var Qb=function(){function a(){c();r instanceof t?(f.style.backgroundImage="url(api/avatar?size=l&user="+r.a.id+")",m.textContent=(r.a.nb||(r.a.ab||"")+" "+r.a.eb).trim(),k.classList.add("presence-indicator"),r.a.N?k.classList.remove("presence-away"):k.classList.add("presence-away"),h.classList.remove("hidden"),l.classList.remove("hidden"),l.textContent=r.a.Hb||"",w.textContent=r.a.yb||"",p.classList.remove("hidden"),e.classList.remove("roominfo-channel"),e.classList.add("roominfo-user")):b()}function b(){var a=
  126. E;a.W.topic?(h.classList.remove("hidden"),m.textContent=r.wa||"",n.textContent=r.B?J.Ka(r.B,r.ea):""):h.classList.add("hidden");a.W.purpose?(p.classList.remove("hidden"),w.textContent=r.sa||"",A.textContent=r.o?J.Ka(r.o,r.da):""):p.classList.add("hidden");f.style.backgroundImage="";k.classList.remove("presence-indicator");L.textContent=J.pb(r.i?Object.keys(r.i).length:0);a=[];if(r.i)for(var b in r.i)a.push(r.i[b]);a.sort(function(a,b){return a.N&&!b.N?-1:b.N&&!a.N?1:a.getName().localeCompare(b.getName())});
  127. 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.N||b.classList.add("presence-away");c.appendChild(b)});H.textContent="";H.appendChild(c);e.classList.add("roominfo-channel");e.classList.remove("roominfo-user")}function c(){k.textContent=r.name;if(r.b){x.textContent=J.jb(r.b.length);x.classList.remove("hidden");y.classList.remove("hidden");
  128. var a=document.createDocumentFragment();r.b.forEach(function(b){var c=document.createElement("li"),e=document.createElement("a");e.href="javascript:void(0)";e.dataset.msgId=b.id;e.addEventListener("click",d);e.className=Qa+" roominfo-unpin";c.className="roominfo-pinlist-item";c.appendChild(b.L());c.appendChild(e);a.appendChild(c)});y.textContent="";y.appendChild(a)}else x.classList.add("hidden"),y.classList.add("hidden")}function d(){if(r.b)for(var a=0,b=r.b.length;a<b;a++)if(r.b[a].id===this.dataset.msgId){Jb(r,
  129. r.b[a]);break}}var e=document.createElement("div"),f=document.createElement("header"),k=document.createElement("h3"),g=document.createElement("div"),h=document.createElement("div"),m=document.createElement("span"),n=document.createElement("span"),l=document.createElement("div"),p=document.createElement("div"),w=document.createElement("span"),A=document.createElement("span"),x=document.createElement("div"),y=document.createElement("ul"),L=document.createElement("div"),H=document.createElement("ul"),
  130. E,r;e.className="chat-context-roominfo";f.className="roominfo-title";h.className="roominfo-topic";p.className="roominfo-purpose";l.className="roominfo-phone";x.className="roominfo-pincount";y.className="roominfo-pinlist";L.className="roominfo-usercount";H.className="roominfo-userlist";A.className=n.className="roominfo-author";f.appendChild(k);e.appendChild(f);e.appendChild(g);h.appendChild(m);h.appendChild(n);p.appendChild(w);p.appendChild(A);g.appendChild(h);g.appendChild(l);g.appendChild(p);g.appendChild(x);
  131. g.appendChild(y);g.appendChild(L);g.appendChild(H);var I=null;return{kb:function(b,c){this.aa();E=b;r=c;a();return this},update:function(){this.aa();a();return this},show:function(a){this.aa();a.appendChild(e);e.classList.remove("hidden");return this},zb:function(){this.aa();e.classList.add("hidden");return this},aa:function(){I&&clearTimeout(I);I=null;return this},Ab:function(){I||(I=setTimeout(function(){e.classList.add("hidden");I=null},300));return this},Db:function(a){for(;a;){if(a===e)return!0;
  132. a=a.parentNode}return!1}}}();function Y(a,b,c,d){ka.call(this,a,b,0,c,d)}Y.prototype=Object.create(ka.prototype);Y.prototype.constructor=Y;Y.prototype.b=function(a,b){return!0===a.isMeMessage?new tc(this.id,a,b):!0===a.isNotice?new uc(this.id,a,b):new vc(this.id,a,b)};function lc(a){a.a.forEach(function(a){a.H()})}
  133. var Z=function(){function a(a,d){return Aa(d,{C:a.context.self.T.C,Y:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=bb(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null},oa:function(c){return b(a,c)}})}function b(a,b){var c=b.indexOf("|"),d;if(-1===c)var k=b;else{k=b.substr(0,c);var g=b.substr(c+1)}if("@"===k[0])if(k=sa(a.context)+"|"+k.substr(1),d=F(k))a=!0,k="#"+d.O.id,g="@"+d.getName(),d="background-color:"+
  134. cc(d.getName()),b=["chatmsg-link-user","chatmsg-link"];else return null;else if("#"===k[0])if(k=sa(a.context)+"|"+k.substr(1),g=va(k))a=!0,k="#"+k,g="#"+g.name,b=["chatmsg-link-chan","chatmsg-link"];else return null;else{if(!k.match(/^(https?|mailto):\/\//i))return null;b=["chatmsg-link"];a=!1}return{link:k,text:g||k,style:d,Ya:b,cb:a}}return{H:function(a){a.V=!0;return a},Z:function(a){a.c&&a.c.parentElement&&(a.c.remove(),delete a.c);return a},M:function(a){a.c?a.V&&(a.V=!1,a.P()):a.Ca().P();return a.c},
  135. P:function(b){var c=F(b.K);b.c.m.innerHTML=J.R(b.m);b.c.ua.innerHTML=a(b,b.text);b.c.ka.textContent=c?c.getName():b.username||"?";for(var c=document.createDocumentFragment(),e=0,f=b.s.length;e<f;e++){var k=b.s[e];k&&(k=ec(b,k,e))&&c.appendChild(k)}b.c.s.textContent="";b.c.s.appendChild(c);c=b.b;e=document.createDocumentFragment();if(b.F)for(var g in b.F){var f=c,k=b.id,h=g,m=b.F[g],n=bb(h);if(n){for(var l=document.createElement("li"),p=document.createElement("a"),w=document.createElement("span"),
  136. A=document.createElement("span"),x=[],y=0,L=m.length;y<L;y++){var H=F(m[y]);H&&x.push(H.getName())}x.sort();A.textContent=x.join(", ");w.appendChild(n);w.className="emoji-small";p.href="javascript:toggleReaction('"+f+"', '"+k+"', '"+h+"')";p.appendChild(w);p.appendChild(A);l.className="chatmsg-reaction-item";l.appendChild(p);f=l}else console.warn("Reaction id not found: "+h),f=null;f&&e.appendChild(f)}b.c.F.textContent="";b.c.F.appendChild(e);b.c.ca.na&&(b.c.ca.na.style.backgroundImage=b.A?'url("star_full.png")':
  137. 'url("star_empty.png")');b.G&&(b.c.G.innerHTML=J.G(b.G),b.c.classList.add("edited"));return b},L:function(a){return a.M().cloneNode(!0)},w:function(b,d){return a(b,d)}}}();function tc(a,b,c){v.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.V=Z.V}tc.prototype=Object.create(z.prototype);q=tc.prototype;q.constructor=tc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Z=function(){return Z.Z(this)};q.M=function(){return Z.M(this)};
  138. q.Ca=function(){this.c=bc(this);this.c.classList.add("chatmsg-me_message");return this};q.L=function(){return Z.L(this)};q.P=function(){Z.P(this);return this};q.update=function(a,b){z.prototype.update.call(this,a,b);this.H()};function vc(a,b,c){v.call(this,b,c);this.context=D(C.context,a);this.b=a;this.c=Z.c;this.V=Z.V}vc.prototype=Object.create(v.prototype);q=vc.prototype;q.constructor=vc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Z=function(){return Z.Z(this)};q.M=function(){return Z.M(this)};
  139. q.Ca=function(){this.c=bc(this);return this};q.L=function(){return Z.L(this)};q.P=function(){Z.P(this);return this};
  140. q.update=function(a,b){v.prototype.update.call(this,a,b);this.H();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],
  141. longitude:a[3],accuracy:a[5]}})};function uc(a,b,c){v.call(this,b,c);this.context=D(C.context,a);this.b=a;this.a=null;this.V=!0}uc.prototype=Object.create(B.prototype);q=uc.prototype;q.constructor=uc;q.H=function(){return Z.H(this)};q.w=function(a){return Z.w(this,a)};q.Z=function(){this.a&&this.a.parentElement&&(this.a.remove(),delete this.a);this.c&&delete this.c;return this};q.M=function(){Z.M(this);return this.a};q.L=function(){return this.a.cloneNode(!0)};
  142. q.Ca=function(){this.c=bc(this);this.a=document.createElement("span");this.c.classList.add("chatmsg-notice");this.a.className="chatmsg-notice";this.a.textContent=J.ib;this.a.appendChild(this.c);return this};q.P=function(){Z.P(this);return this};q.update=function(a,b){B.prototype.update.call(this,a,b);this.H()};
  143. function Kb(a,b){var c=bc(null);c.classList.add("chatmsg-pending");b&&c.classList.add("chatmsg-me_message");c.ua.innerHTML=Aa(a,{Y:function(a){":"===a[0]&&":"===a[a.length-1]&&(a=a.substr(1,a.length-2));if(a=bb(a)){var b=document.createElement("span");b.className="emoji-small";b.appendChild(a);return b.outerHTML}return null}});c.ka.textContent=Q.self?Q.self.getName():"";a=document.createElement("span");a.className="typing-dot1";a.textContent=".";c.m.appendChild(a);a=document.createElement("span");
  144. a.className="typing-dot2";a.textContent=".";c.m.appendChild(a);a=document.createElement("span");a.className="typing-dot3";a.textContent=".";c.m.appendChild(a);c.m.classList.add("typing-container");return c};var X;function jc(a){this.U={};for(var b=0,c=a.length;b<c;b++)null===a[b].service&&null===a[b].device&&Xb(this,JSON.parse(a[b].config))}function Xb(a,b){if(b.services)for(var c in b.services)a.U[c]=b.services[c];void 0!==b.emojiProvider&&(a.o=b.emojiProvider);void 0!==b.displayAvatar&&(a.a=b.displayAvatar);void 0!==b.colorfulNames&&(a.h=b.colorfulNames);void 0!==b.scrollAvatars&&(a.b=b.scrollAvatars)}
  145. function pc(){var a=X,b={},c="";!1===a.a&&(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"]=
  146. ["content:'<'"],b[".chatmsg-author-name::after"]=["content:'>'"]);!0===a.h||(b[".chatmsg-authorGroup .chatmsg-item .chatmsg-link-user, .chatsystem-content a.chatmsg-author-name, .chatmsg-author-name"]=["background-color: transparent !important;"]);for(var d in b)c+=d+"{",b[d].forEach(function(a){c+=a+";"}),c+="}";return c}X=new jc([]);function wc(){}wc.prototype.close=function(){};function xc(a,b){wc.apply(this);this.Ja=yc++;this.ub=a;this.port=b}xc.prototype=Object.create(wc);xc.prototype.constructor=xc;xc.prototype.connect=function(){return new Promise(function(){__native.TCPConnect(this.Ja,this.ub,this.port)})};xc.prototype.write=function(a){__native.TCPWrite(this.Ja,a)};xc.prototype.close=function(){__native.TCPClose(this.Ja)};var yc=0;window.displayMenu=function(){document.getElementById("chatCtx").classList.add("opened")};window.hideMenu=function(){document.getElementById("chatCtx").classList.remove("opened")};window.toggleMenu=function(){Ob()};window.setChannelFavorite=function(a,b){var c=va(a);c?b?Sb(c):Rb(c):console.error("Channel "+a+" not found")};window.onApplicationPaused=function(){window.hasFocus=!1};window.onApplicationResumed=function(){window.hasFocus=!0};
  147. var Ha=function(){var a={},b=0;return{fb:function(c,d){var e=b++;d&&(c.vb=d);a[""+e]=c;return e},Fb:function(){var b=""+Array.prototype.shift.call(arguments);a[b]&&(a[b].apply(a[b].vb,arguments),delete a[b])}}}();window.__CALLBACK={onResult:Ha.Fb};function Ia(){return!!("__native"in window)};var cb=function(){var a=[];return{bb:function(b){for(var c=0,d=a.length;c<d;c++)if(-1!==a[c].names.indexOf(b))return a[c];return null},xb: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},Ib:function(b){b.X="client";b.exec=b.exec.bind(b);a.push(b)}}}();function zc(){return new Promise(function(a,b){"geolocation"in window.navigator?navigator.geolocation.getCurrentPosition(function(c){c?a(c):b("denied")}):b("geolocation not available")})}
  148. ya.push(function(){cb.Ib({name:"/sherlock",names:["/sherlock","/sharelock"],usage:"",description:J.ob,exec:function(a,b){zc().then(function(a){var c=a.coords.latitude,e=a.coords.longitude;fb(b,"https://www.openstreetmap.org/?mlat="+c+"&mlon="+e+"&macc="+a.coords.accuracy+"#map=17/"+c+"/"+e)}).catch(function(a){console.error("Error: ",a)})}})});
  149. })();