1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/converse_ynh.git synced 2024-09-03 18:25:53 +02:00
converse_ynh/sources/dist/converse.min.js

2155 lines
1,005 KiB
JavaScript
Raw Normal View History

2021-11-11 22:06:49 +01:00
/*! For license information please see converse.min.js.LICENSE.txt */
(()=>{var e,t,n,s,i={7706:(e,t,n)=>{"use strict";const s=n(171),i=n(8713);e.exports={atob:s,btoa:i}},171:e=>{"use strict";function t(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e);return t<0?void 0:t}e.exports=function(e){if((e=(e=`${e}`).replace(/[ \t\n\f\r]/g,"")).length%4==0&&(e=e.replace(/==?$/,"")),e.length%4==1||/[^+/0-9A-Za-z]/.test(e))return null;let n="",s=0,i=0;for(let r=0;r<e.length;r++)s<<=6,s|=t(e[r]),i+=6,24===i&&(n+=String.fromCharCode((16711680&s)>>16),n+=String.fromCharCode((65280&s)>>8),n+=String.fromCharCode(255&s),s=i=0);return 12===i?(s>>=4,n+=String.fromCharCode(s)):18===i&&(s>>=2,n+=String.fromCharCode((65280&s)>>8),n+=String.fromCharCode(255&s)),n}},8713:e=>{"use strict";function t(e){if(e>=0&&e<64)return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[e]}e.exports=function(e){let n;for(e=`${e}`,n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return null;let s="";for(n=0;n<e.length;n+=3){const i=[void 0,void 0,void 0,void 0];i[0]=e.charCodeAt(n)>>2,i[1]=(3&e.charCodeAt(n))<<4,e.length>n+1&&(i[1]|=e.charCodeAt(n+1)>>4,i[2]=(15&e.charCodeAt(n+1))<<2),e.length>n+2&&(i[2]|=e.charCodeAt(n+2)>>6,i[3]=63&e.charCodeAt(n+2));for(let e=0;e<i.length;e++)void 0===i[e]?s+="=":s+=t(i[e])}return s}},8826:(e,t,n)=>{e.exports={default:n(5820),__esModule:!0}},1060:(e,t,n)=>{e.exports={default:n(3248),__esModule:!0}},3415:(e,t,n)=>{e.exports={default:n(9830),__esModule:!0}},8681:(e,t,n)=>{"use strict";t.__esModule=!0;var s,i=(s=n(3415))&&s.__esModule?s:{default:s};t.default=function(e){return function(){var t=e.apply(this,arguments);return new i.default((function(e,n){return function s(r,o){try{var a=t[r](o),c=a.value}catch(e){return void n(e)}if(!a.done)return i.default.resolve(c).then((function(e){s("next",e)}),(function(e){s("throw",e)}));e(c)}("next")}))}}},8584:(e,t,n)=>{"use strict";t.__esModule=!0;var s,i=(s=n(8826))&&s.__esModule?s:{default:s};t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},7034:(e,t,n)=>{var s=function(){return this}()||Function("return this")(),i=s.regeneratorRuntime&&Object.getOwnPropertyNames(s).indexOf("regeneratorRuntime")>=0,r=i&&s.regeneratorRuntime;if(s.regeneratorRuntime=void 0,e.exports=n(4267),i)s.regeneratorRuntime=r;else try{delete s.regeneratorRuntime}catch(e){s.regeneratorRuntime=void 0}},4267:e=>{!function(t){"use strict";var n,s=Object.prototype,i=s.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag",l=t.regeneratorRuntime;if(l)e.exports=l;else{(l=t.regeneratorRuntime=e.exports).wrap=y;var d="suspendedStart",u="suspendedYield",h="executing",m="completed",f={},g={};g[o]=function(){return this};var p=Object.getPrototypeOf,v=p&&p(p(N([])));v&&v!==s&&i.call(v,o)&&(g=v);var b=x.prototype=w.prototype=Object.create(g);S.prototype=b.constructor=x,x.constructor=S,x[c]=S.displayName="GeneratorFunction",l.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(b),e},l.awrap=function(e){return{__await:e}},E(A.prototype),A.prototype[a]=function(){return this},l.AsyncIterator=A,l.async=function(e,t,n,s){var i=new A(y(e,t,n,s));return l.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(b),b[c]="Generator",b[o]=function(){return this},b.toString=function(){return"[object Generator]"},l.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var s=t.pop();if(s in e)return n.value=s,n.done=!1,n}return n.done=!0,n}},l.values=N,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&i.call(thi
2021-03-19 19:26:15 +01:00
draggable="false"
2021-11-11 22:06:49 +01:00
title="${s}"
2021-03-19 19:26:15 +01:00
alt="${n}"
2021-11-11 22:06:49 +01:00
src="${t}/72x72/${e.cp}.png"/>`}}return t.unicode_only?s:Qc`<img class="emoji"
2021-03-19 19:26:15 +01:00
draggable="false"
2021-11-11 22:06:49 +01:00
title="${s}"
alt="${s}"
src="${jl.emojis.by_sn[s].url}">`}function au(e){if(!jl.emojis.initialized)throw new Error("getShortnameReferences called before emojis are initialized. To avoid this problem, first await the converse.emojis.initilaized_promise.");return[...e.matchAll(jl.emojis.shortnames_regex)].filter((e=>e[0].length>0)).map((e=>{const t=jl.emojis.by_sn[e[0]].cp;return{cp:t,begin:e.index,end:e.index+e[0].length,shortname:e[0],emoji:t?iu(t):null}}))}function cu(e){const t=[];return function(e,n){const s=/\uFE0F/g,i=String.fromCharCode(8205);String(e).replace(tu,((e,n,r)=>{const o=function(e){const t=[];let n=0,s=0;for(;s<e.length;){const i=e.charCodeAt(s++);n?(t.push((65536+(n-55296<<10)+(i-56320)).toString(16)),n=0):55296<=i&&i<=56319?n=i:t.push(i.toString(16))}return t.join("-")}(e.indexOf(i)<0?e.replace(s,""):e);o&&((e,n,s)=>{var i;t.push({begin:s,cp:e,emoji:n,end:s+n.length,shortname:(null===(i=nu.getEmojisByAtrribute("cp")[e])||void 0===i?void 0:i.sn)||""})})(o,e,r)}))}(e),t}jl.plugins.add("converse-emoji",{initialize(){const{___:e}=va;Cl.settings.extend({emoji_image_path:"https://twemoji.maxcdn.com/v/12.1.6/",emoji_categories:{smileys:":grinning:",people:":thumbsup:",activity:":soccer:",travel:":motorcycle:",objects:":bomb:",nature:":rainbow:",food:":hotdog:",symbols:":musical_note:",flags:":flag_ac:",custom:null},emoji_category_labels:{smileys:e("Smileys and emotions"),people:e("People"),activity:e("Activities"),travel:e("Travel"),objects:e("Objects"),nature:e("Animals and nature"),food:e("Food and drink"),symbols:e("Symbols"),flags:e("Flags"),custom:e("Stickers")}}),va.EmojiPicker=Zo.extend({defaults:{current_category:"smileys",current_skintone:"",scroll_position:0}});const t={};Object.assign(nu,{shortnamesToEmojis:(e,t={unicode_only:!1,add_title_wrapper:!1})=>function(e,t){let n=[e];return[...au(e),...cu(e)].sort(((e,t)=>t.begin-e.begin)).forEach((e=>{const s=n.shift(),i=ou(e,t);n="string"==typeof i?[s.slice(0,e.begin)+i+s.slice(e.end),...n]:[s.slice(0,e.begin),i,s.slice(e.end),...n]})),n}(e=ru(e),t),shortnamesToUnicode:e=>nu.shortnamesToEmojis(e,{unicode_only:!0})[0],isOnlyEmojis(e){const t=e.trim().split(/\s+/);return!(0===t.length||t.length>3)&&t.filter((e=>{const t=cu(nu.shortnamesToUnicode(e));return 1===t.length&&(e===t[0].shortname||e===t[0].emoji)})).length===t.length},getEmojisByAtrribute(e){if(t[e])return t[e];if("category"===e)return jl.emojis.json;const n=jl.emojis.list.map((t=>t[e])).filter(((e,t,n)=>n.indexOf(e)==t));return t[e]={},n.forEach((n=>t[e][n]=jl.emojis.list.find((t=>t[e]===n)))),t[e]}}),Object.assign(Cl,{emojis:{async initialize(){if(!jl.emojis.initialized){jl.emojis.initialized=!0;const{default:t}=await n.e(4610).then(n.t.bind(n,7530,19));jl.emojis.json=t,jl.emojis.by_sn=Object.keys(t).reduce(((e,n)=>Object.assign(e,t[n])),{}),jl.emojis.list=Object.values(jl.emojis.by_sn),jl.emojis.list.sort(((e,t)=>e.sn<t.sn?-1:e.sn>t.sn?1:0)),jl.emojis.shortnames=jl.emojis.list.map((e=>e.sn));const s=()=>jl.emojis.shortnames.map((e=>e.replace(/[+]/g,"\\$&"))).join("|");jl.emojis.shortnames_regex=new RegExp(s(),"gi"),jl.emojis.toned=(jl.emojis.toned||(jl.emojis.toned=(e=Object.values(jl.emojis.json.people).filter((e=>e.sn.includes("_tone"))).map((e=>e.sn.replace(/_tone[1-5]/,""))),[...new Set(e)])),jl.emojis.toned),jl.emojis.initialized_promise.resolve()}var e;return jl.emojis.initialized_promise}}})}});const lu={initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage()||this.setOccupant(),Cl.trigger("chatRoomMessageInitialized",this))},mayBeModerated(){return["all","moderator"].includes(Cl.settings.get("allow_message_retraction"))&&this.collection.chatbox.canModerateMessages()},checkValidity(){const e=va.Message.prototype.checkValidity.call(this);return!e&&this.collection.chatbox.debouncedRejoin(),e},onOccupantRemoved(){var e;this.stopListening(this.occupant),delete this.occupant;const t=null==this||null===(e=this.collection)||void 0===e?void 0:e.chatbox;if(!t)return M.error(`Could not get collection.chatbox for message: ${JSON.str
2021-03-19 19:26:15 +01:00
<form class="converse-form chatroom-form" @submit=${e.onSubmit}>
<legend>${t}</legend>
<fieldset class="form-group">
<label for="converse_muc_bookmark_name">${i}</label>
<input class="form-control" type="text" value="${e.name}" name="name" required="required" id="converse_muc_bookmark_name"/>
</fieldset>
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<label for="converse_muc_bookmark_nick">${r}</label>
2021-03-19 19:26:15 +01:00
<input class="form-control" type="text" name="nick" value="${e.nick||""}" id="converse_muc_bookmark_nick"/>
</fieldset>
<fieldset class="form-group form-check">
<input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" name="autojoin"/>
<label class="form-check-label" for="converse_muc_bookmark_autojoin">${n}</label>
</fieldset>
<fieldset class="form-group">
<input class="btn btn-primary" type="submit" value="${o}">
2021-11-11 22:06:49 +01:00
<input class="btn btn-secondary button-cancel" type="button" value="${s}" @click=${e.onCancel}>
2021-03-19 19:26:15 +01:00
</fieldset>
</form>
2021-11-11 22:06:49 +01:00
`})(Object.assign(this.model.toJSON(),{onCancel:e=>this.closeBookmarkForm(e),onSubmit:e=>this.onBookmarkFormSubmitted(e)}))}onBookmarkFormSubmitted(e){var t,n,s;e.preventDefault(),va.bookmarks.createBookmark({jid:this.model.get("jid"),autojoin:(null===(t=e.target.querySelector('input[name="autojoin"]'))||void 0===t?void 0:t.checked)||!1,name:null===(n=e.target.querySelector("input[name=name]"))||void 0===n?void 0:n.value,nick:null===(s=e.target.querySelector("input[name=nick]"))||void 0===s?void 0:s.value}),this.closeBookmarkForm(e)}closeBookmarkForm(e){e.preventDefault(),this.model.session.save("view",null)}}Cl.elements.define("converse-muc-bookmark-form",sg);const ig=sg,rg=Je((function(e,t,n){var s=-1,i="function"==typeof t,r=Ye(e)?Array(e.length):[];return ls(e,(function(e){r[++s]=i?ze(t,e,n):Sa(e,t,n)})),r}));function og(e,t){if(va.allow_bookmarks&&e.model.get("type")===va.CHATROOMS_TYPE){const n=e.model.get("bookmarked"),s={i18n_title:vh(n?"Unbookmark this groupchat":"Bookmark this groupchat"),i18n_text:vh(n?"Unbookmark":"Bookmark"),handler:t=>e.toggleBookmark(t),a_class:"toggle-bookmark",icon_class:"fa-bookmark",name:"bookmark"},i=t.map((e=>e.name)).indexOf("details"),r=xh().then((e=>e?s:""));return i>-1?[...t.slice(0,i),r,...t.slice(i)]:[r,...t]}return t}function ag(e){e.preventDefault();const t=e.target.getAttribute("data-bookmark-name"),n=e.target.getAttribute("data-room-jid");confirm(vh('Are you sure you want to remove the bookmark "%1$s"?',t))&&rg(va.bookmarks.where({jid:n}),Zo.prototype.destroy)}async function cg(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid");(await Cl.rooms.open(t,{bring_to_foreground:!0})).session.save("view",jl.MUC.VIEWS.BOOKMARK)}function lg(e){e.preventDefault();const{Strophe:t}=jl.env,n=e.target.textContent,s=e.target.getAttribute("data-room-jid"),i={name:n||t.unescapeNode(t.getNodeFromJid(s))||s};Cl.rooms.open(s,i,!0)}const dg=e=>{const t=e.bm.get("jid"),n=!(!Cl.settings.get("hide_open_bookmarks")||!va.chatboxes.get(t)),s=vh("Unbookmark this groupchat"),i=vh("Click to open this groupchat");return Qc`
<div class="list-item controlbox-padded room-item available-chatroom d-flex flex-row ${n?"hidden":""}" data-room-jid="${t}">
<a class="list-item-link open-room w-100" data-room-jid="${t}"
title="${i}"
@click=${lg}>${e.bm.getDisplayName()}</a>
<a class="list-item-action remove-bookmark fa fa-bookmark align-self-center ${e.bm.get("bookmarked")?"button-on":""}"
data-room-jid="${t}"
data-bookmark-name="${e.bm.getDisplayName()}"
title="${s}"
@click=${ag}></a>
</div>
`};"undefined"!=typeof Element&&Element.prototype;const ug=/^(\S+)\s*(.*)$/,hg=["model","collection","events"];class mg extends HTMLElement{constructor(e){var t,n,s;super(),s={},(n="events")in(t=this)?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s,this.cid=Ts("view"),this._domEvents=[],Ct(this,ko(e,hg))}createRenderRoot(){return this}connectedCallback(){this._initialized||(this.preinitialize.apply(this,arguments),this.initialize.apply(this,arguments),this._initialized=!0),this.delegateEvents()}disconnectedCallback(){this.undelegateEvents(),this.stopListening()}preinitialize(){}initialize(){}render(){return ve(this.beforeRender)&&this.beforeRender(),ve(this.toHTML)&&tl(this.toHTML(),this),ve(this.afterRender)&&this.afterRender(),this}delegateEvents(){if(!this.events)return this;this.undelegateEvents();for(const e in this.events){let t=this.events[e];if(ve(t)||(t=this[t]),!t)continue;const n=e.match(ug);this.delegate(n[1],n[2],t.bind(this))}return this}delegate(e,t,n){const s=this;if(!s)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const s=this.querySelectorAll(t);for(let t=0,i=s.length;t<i;t++){const i=s[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=s;i=i.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.addEventListener(e,i,!1),this._domEvents.push({el:this,eventName:e,handler:i,listener:n,selector:t}),this}undelegateEvents(){if(this){for(let e=0,t=this._domEvents.length;e<t;e++){const t=this._domEvents[e];t.el.removeEventListener(t.eventName,t.handler,!1)}this._domEvents.length=0}return this}undelegate(e,t,n){if("function"==typeof t&&(n=t,t=null),this){const s=this._domEvents.slice();let i=s.length;for(;i--;){const r=s[i];!(r.eventName!==e||n&&r.listener!==n||t&&r.selector!==t)&&(r.el.removeEventListener(r.eventName,r.handler,!1),this._domEvents.splice(i,1))}}return this}}Object.assign(mg.prototype,ks);const fg=jl.env.utils;class gg extends mg{async initialize(){await Cl.waitUntil("bookmarksInitialized"),this.listenTo(va.bookmarks,"add",this.render),this.listenTo(va.bookmarks,"remove",this.render),this.listenTo(va.chatboxes,"add",this.render),this.listenTo(va.chatboxes,"remove",this.render);const e=`converse.bookmarks-list-model-${va.bare_jid}`;this.model=new va.BookmarksList({id:e}),_o(this.model,e),this.model.fetch({success:()=>this.render(),error:(e,t)=>{M.error(t),this.render()}})}render(){tl((e=>{const t=!!va.bookmarks.getUnopenedBookmarks().length,n=vh("Click to toggle the bookmarks list"),s=vh("Bookmarks");return Qc`
<div class="list-container list-container--bookmarks ${t?"":"hidden"}">
<a class="list-toggle bookmarks-toggle controlbox-padded"
title="${n}"
@click=${e.toggleBookmarksList}>
<span class="fa ${e.toggle_state===va.OPENED?"fa-caret-down":"fa-caret-right"}">
</span> ${s}</a>
<div class="items-list bookmarks rooms-list ${e.toggle_state!==va.OPENED?"hidden":""}">
${va.bookmarks.map((t=>dg(Object.assign({bm:t},e))))}
</div>
</div>
`})({toggleBookmarksList:e=>this.toggleBookmarksList(e),toggle_state:this.model.get("toggle-state")}),this)}toggleBookmarksList(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");fg.hasClass("fa-caret-down",n)?(fg.slideIn(this.querySelector(".bookmarks")),this.model.save({"toggle-state":va.CLOSED}),n.classList.remove("fa-caret-down"),n.classList.add("fa-caret-right")):(n.classList.remove("fa-caret-right"),n.classList.add("fa-caret-down"),fg.slideOut(this.querySelector(".bookmarks")),this.model.save({"toggle-state":va.OPENED}))}}Cl.elements.define("converse-bookmarks",gg);const{u:pg}=jl.env,vg={setBookmarkState(){void 0!==va.bookmarks&&(va.bookmarks.where({jid:this.model.get("jid")}).length?this.model.save("bookmarked",!0):this.model.save("bookmarked",!1))},renderBookmarkForm(){this.bookmark_form||(this.bookmark_form=new va.MUCBookmarkForm({model:this.model,chatroomview:this}),this.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)),pg.showElement(this.bookmark_form.el)},toggleBookmark(e){null==e||e.preventDefault();const t=va.bookmarks.where({jid:this.model.get("jid")});t.length?t.forEach((e=>e.destroy())):this.model.session.set("view",jl.MUC.VIEWS.BOOKMARK)}};var bg=n(3742),yg={};yg.styleTagTransform=eg(),yg.setAttributes=Yf(),yg.insert=Jf().bind(null,"head"),yg.domAPI=Wf(),yg.insertStyleElement=Xf(),Hf()(bg.Z,yg),bg.Z&&bg.Z.locals&&bg.Z.locals,jl.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Cl.settings.extend({hide_open_bookmarks:!0}),va.removeBookmarkViaEvent=ag,va.addBookmarkViaEvent=cg,Object.assign(va.ChatRoomView.prototype,vg),va.MUCBookmarkForm=ig,va.BookmarksView=gg,Cl.listen.on("getHeadingButtons",og),Cl.listen.on("chatRoomViewInitialized",(e=>e.setBookmarkState()))}});const _g=e=>(...t)=>({_$litDirective$:e,values:t});class wg{constructor(e){}T(e,t,n){this.Σdt=e,this.M=t,this.Σct=n}S(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const{et:Sg}=ml,xg=()=>document.createComment(""),Eg=(e,t,n)=>{var s;const i=e.A.parentNode,r=void 0===t?e.B:t.A;if(void 0===n){const t=i.insertBefore(xg(),r),s=i.insertBefore(xg(),r);n=new Sg(t,s,e,e.options)}else{const t=n.B.nextSibling,o=n.M!==e;if(o&&(null===(s=n.Q)||void 0===s||s.call(n,e),n.M=e),t!==r||o){let e=n.A;for(;e!==t;){const t=e.nextSibling;i.insertBefore(e,r),e=t}}}return n},Ag=(e,t,n=e)=>(e.I(t,n),e),Cg={},Tg=e=>{var t;null===(t=e.P)||void 0===t||t.call(e,!1,!0);let n=e.A;const s=e.B.nextSibling;for(;n!==s;){const e=n.nextSibling;n.remove(),n=e}},kg=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},jg=_g(class extends wg{constructor(e){if(super(e),2!==e.type)throw Error("repeat() can only be used in text expressions")}Mt(e,t,n){let s;void 0===n?n=t:void 0!==t&&(s=t);const i=[],r=[];let o=0;for(const t of e)i[o]=s?s(t,o):o,r[o]=n(t,o),o++;return{values:r,keys:i}}render(e,t,n){return this.Mt(e,t,n).values}update(e,[t,n,s]){var i;const r=(e=>e.H)(e),{values:o,keys:a}=this.Mt(t,n,s);if(!r)return this.Pt=a,o;const c=null!==(i=this.Pt)&&void 0!==i?i:this.Pt=[],l=[];let d,u,h=0,m=r.length-1,f=0,g=o.length-1;for(;h<=m&&f<=g;)if(null===r[h])h++;else if(null===r[m])m--;else if(c[h]===a[f])l[f]=Ag(r[h],o[f]),h++,f++;else if(c[m]===a[g])l[g]=Ag(r[m],o[g]),m--,g--;else if(c[h]===a[g])l[g]=Ag(r[h],o[g]),Eg(e,l[g+1],r[h]),h++,g--;else if(c[m]===a[f])l[f]=Ag(r[m],o[f]),Eg(e,r[h],r[m]),m--,f++;else if(void 0===d&&(d=kg(a,f,g),u=kg(c,h,m)),d.has(c[h]))if(d.has(c[m])){const t=u.get(a[f]),n=void 0!==t?r[t]:null;if(null===n){const t=Eg(e,r[h]);Ag(t,o[f]),l[f]=t}else l[f]=Ag(n,o[f]),Eg(e,r[h],n),r[t]=null;f++}else Tg(r[m]),m--;else Tg(r[h]),h++;for(;f<=g;){const t=Eg(e,l[g+1]);Ag(t,o[f]),l[f++]=t}for(;h<=m;){const e=r[h++];null!==e&&Tg(e)}return this.Pt=a,((e,t=Cg)=>{e.H=t})(e,l),Xc}});function Ng(e){const{CONTROLBOX_TYPE:t}=va,n="overlayed"===Cl.settings.get("view_mode")&&e.get("minimized");return e.get("type")===t||!(e.get("hidden")||n)}C
<div class="inner-content converse-brand row">
<div class="converse-brand__padding"></div>
<div class="converse-brand__heading">
<svg height="200px"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 364 364"
version="1.1">
<title>Logo Converse</title>
<defs>
<linearGradient id="gradient" x1="92.14" y1="27.64" x2="267.65" y2="331.62" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff1d1"/>
<stop offset="0.05" stop-color="#fae8c1"/>
<stop offset="0.15" stop-color="#f0d5a1"/>
<stop offset="0.27" stop-color="#e7c687"/>
<stop offset="0.4" stop-color="#e1bb72"/>
<stop offset="0.54" stop-color="#dcb264"/>
<stop offset="0.71" stop-color="#daad5c"/>
<stop offset="1" stop-color="#d9ac59"/>
</linearGradient>
<filter id="shadow">
<feGaussianBlur in="SourceAlpha" stdDeviation="2.3" result="blur1"/>
<feOffset in="blur1" dx="3" dy="3" result="blur2"/>
<feColorMatrix in="blur2" type="matrix" result="blur3"
values="1 0 0 0 0.1
0 1 0 0 0.1
0 0 1 0 0.1
0 0 0 1 0"/>
<feMerge>
<feMergeNode in="blur3"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</defs>
<g filter="url(#shadow)">
<path d="M221.46,103.71c0,18.83-29.36,18.83-29.12,0C192.1,84.88,221.46,84.88,221.46,103.71Z" fill="#d9ac59"/>
<path d="M179.9,4.15A175.48,175.48,0,1,0,355.38,179.63,175.48,175.48,0,0,0,179.9,4.15Zm-40.79,264.5c-.23-17.82,27.58-17.82,27.58,0S138.88,286.48,139.11,268.65ZM218.6,168.24A79.65,79.65,0,0,1,205.15,174a12.76,12.76,0,0,0-6.29,4.65L167.54,222a1.36,1.36,0,0,1-2.46-.8v-35.8a2.58,2.58,0,0,0-3.06-2.53c-15.43,3-30.23,7.7-42.73,19.94-38.8,38-29.42,105.69,16.09,133.16a162.25,162.25,0,0,1-91.47-67.27C-3.86,182.26,34.5,47.25,138.37,25.66c46.89-9.75,118.25,5.16,123.73,62.83C265.15,120.64,246.56,152.89,218.6,168.24Z" fill="url(#gradient)"/>
</g>
</svg>
<span class="converse-brand__text">
<span>converse<span class="subdued">.js</span></span>
<p class="byline">messaging freedom</p>
</span>
</div>
${"overlayed"===Cl.settings.get("view_mode")?Qc`<div class="converse-brand__padding"></div>`:""}
</div>`,e),document.querySelector("body").classList.add(`converse-${Cl.settings.get("view_mode")}`),this.render(),Cl.trigger("chatBoxViewsInitialized")}render(){tl((()=>{const{chatboxes:e,CONTROLBOX_TYPE:t,CHATROOMS_TYPE:n,HEADLINES_TYPE:s}=va,i=Cl.settings.get("view_mode"),r=null==va?void 0:va.connection,o=!(null!=r&&r.connected)||!(null!=r&&r.authenticated)||(null==r?void 0:r.disconnecting);return Qc`
${o||"overlayed"!==i?"":Qc`<converse-minimized-chats></converse-minimized-chats>`}
${jg(e.filter(Ng),(e=>e.get("jid")),(e=>e.get("type")===t?Qc`
${"overlayed"===i?Qc`<converse-controlbox-toggle class="${e.get("closed")?"":"hidden"}"></converse-controlbox-toggle>`:""}
<converse-controlbox
id="controlbox"
class="chatbox ${e.get("closed")?"hidden":""} ${o?"logged-out":""}"
style="${e.get("width")?`width: ${e.get("width")}`:""}"></converse-controlbox>
`:e.get("type")===n?Qc`
<converse-muc jid="${e.get("jid")}" class="chatbox chatroom"></converse-muc>
`:e.get("type")===s?Qc`
<converse-headlines jid="${e.get("jid")}" class="chatbox headlines"></converse-headlines>
`:Qc`
<converse-chat jid="${e.get("jid")}" class="chatbox"></converse-chat>
`))}
`})(),this)}});const Og=e=>{return e.image?Qc`
<svg xmlns="http://www.w3.org/2000/svg" class="avatar ${e.classes}" width="${e.width}" height="${e.height}">
<image width="${e.width}" height="${e.height}" preserveAspectRatio="xMidYMid meet" href="${t=e.image,n=e.image_type,t.startsWith("data:")?t:`data:${n};base64,${t}`}"/>
</svg>`:"";var t,n},$g=/^\s*</,Ig=("undefined"!=typeof Element&&Element.prototype,function(e){this.cid=Ts("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),Ct(this,ko(e,Rg)),this._ensureElement(),this.initialize.apply(this,arguments)});Ig.extend=Ws;const Mg=/^(\S+)\s*(.*)$/,Rg=["model","collection","el","id","attributes","className","tagName","events"];Object.assign(Ig.prototype,ks,{tagName:"div",$:function(e){return this.el.querySelectorAll(e)},preinitialize:function(){},initialize:function(){},render:function(){return ve(this.beforeRender)&&this.beforeRender(),ve(this.toHTML)&&tl(this.toHTML(),this.el),ve(this.afterRender)&&this.afterRender(),this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){if("string"==typeof e)if($g.test(e)){const t=document.createElement("div");t.innerHTML=e,this.el=t.firstChild}else this.el=document.querySelector(e);else e&&!T(e)&&e.length?this.el=e[0]:this.el=e},delegateEvents:function(e){if(e||(e=Gs(this,"events")),!e)return this;this.undelegateEvents();for(const t in e){let n=e[t];if(ve(n)||(n=this[n]),!n)continue;const s=t.match(Mg);this.delegate(s[1],s[2],n.bind(this))}return this},delegate:function(e,t,n){const s=this.el;if(!s)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const s=this.el.querySelectorAll(t);for(let t=0,i=s.length;t<i;t++){const i=s[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=s;i=i.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.el.addEventListener(e,i,!1),this._domEvents.push({el:this.el,eventName:e,handler:i,listener:n,selector:t}),this},undelegateEvents:function(){if(this.el){for(let e=0,t=this._domEvents.length;e<t;e++){const t=this._domEvents[e];t.el.removeEventListener(t.eventName,t.handler,!1)}this._domEvents.length=0}return this},undelegate:function(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el){const s=this._domEvents.slice();let i=s.length;for(;i--;){const r=s[i];!(r.eventName!==e||n&&r.listener!==n||t&&r.selector!==t)&&(r.el.removeEventListener(r.eventName,r.handler,!1),this._domEvents.splice(i,1))}}return this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(Gs(this,"el"));else{const e=Ct({},Gs(this,"attributes"));this.id&&(e.id=Gs(this,"id")),this.className&&(e.class=Gs(this,"className")),this.setElement(this._createElement(Gs(this,"tagName"))),this._setAttributes(e)}},_setAttributes:function(e){for(const t in e)t in this.el?this.el[t]=e[t]:this.el.setAttribute(t,e[t])}});const Dg=jl.env.utils,Lg={renderAvatar(e){const t=(e=e||((null==this?void 0:this.el)??this)).querySelector("canvas.avatar, svg.avatar");if(null!==t&&this.model.vcard){const e={classes:t.getAttribute("class"),width:t.getAttribute("width"),height:t.getAttribute("height"),image_type:this.model.vcard.get("image_type"),image:this.model.vcard.get("image")};t.outerHTML=Dg.getElementFromTemplateResult(Og(e)).outerHTML}}},zg=Ig.extend(Lg);class Pg extends mg{renderAvatar(e){Lg.renderAvatar.call(this,e)}}function Fg(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",`${e}px`)}var Ug=n(7904),Bg={};Bg.styleTagTransform=eg(),Bg.setAttributes=Yf(),Bg.insert=Jf().bind(null,"head"),Bg.domAPI=Wf(),Bg.insertStyleElement=Xf(),Hf()(Ug.Z,Bg),Ug.Z&&Ug.Z.locals&&Ug.Z.locals,jl.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Cl.elements.register(),Cl.promises.add(["chatBoxViewsInitialized"]),Cl.settings.extend({animate:!0,theme:"default"}),va.ViewWithAvatar=zg,va.chatboxviews=new class{constructor(){this.views={}}add(e,t){this.views[e]=t}get(e){return this.views[e]}getAll(){return Object.values(this.views
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header ${e.level}">
<h5 class="modal-title">${e.title}</h5>
${Qg}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
${e.messages.map((e=>Qc`<p>${e}</p>`))}
</div>
</div>
</div>
`)(Object.assign({__:vh},this.model.toJSON()))}}),Zg=Kg.extend({id:"confirm-modal",events:{"submit .confirm":"onConfimation"},initialize(){this.confirmation=ji(),Kg.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.el.addEventListener("closed.bs.modal",(()=>this.confirmation.reject()),!1)},toHTML(){return(e=>Qc`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header ${e.level||""}">
<h5 class="modal-title">${e.title}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form converse-form--modal confirm" action="#">
<div class="form-group">
2021-11-11 22:06:49 +01:00
${e.messages.map((e=>Qc`<p>${e}</p>`))}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
${e.fields.map((e=>(e=>Qc`
2021-03-19 19:26:15 +01:00
<div class="form-group">
<label>
${e.label||""}
<input type="text"
name="${e.name}"
class="${e.challenge_failed?"error":""} form-control form-control--labeled"
?required="${e.required}"
placeholder="${e.placeholder}" />
</label>
</div>
2021-11-11 22:06:49 +01:00
`)(e)))}
2021-03-19 19:26:15 +01:00
<div class="form-group">
2021-11-11 22:06:49 +01:00
<button type="submit" class="btn btn-primary">${vh("OK")}</button>
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${vh("Cancel")}"/>
2021-03-19 19:26:15 +01:00
</div>
</form>
</div>
</div>
</div>
2021-11-11 22:06:49 +01:00
`)(this.model.toJSON())},afterRender(){this.close_handler_registered||(this.el.addEventListener("closed.bs.modal",(()=>{this.confirmation.isResolved||this.confirmation.reject()}),!1),this.close_handler_registered=!0)},onConfimation(e){e.preventDefault();const t=new FormData(e.target),n=(this.model.get("fields")||[]).map((e=>{const n=t.get(e.name).trim();return e.value=n,e.challenge&&(e.challenge_failed=n!==e.challenge),e}));if(n.filter((e=>e.challenge_failed)).length)return this.model.set("fields",n),void this.model.trigger("change");this.confirmation.resolve(n),this.modal.hide()}});jl.env.BootstrapModal=Kg;let ep=[];const tp={modal:{show(e,t,n){const s=this.get(e.id)||this.create(e,t);return s.show(n),s},get:e=>ep.filter((t=>t.id==e)).pop(),create(e,t){const n=new e(t);return ep.push(n),n},remove(e){ep=ep.filter((t=>t!==e)),e.remove()},removeAll(){ep.forEach((e=>e.remove())),ep=[]}},async confirm(e,t=[],n=[]){"string"==typeof t&&(t=[t]);const s=new Zo({title:e,messages:t,fields:n,type:"confirm"}),i=new Zg({model:s});let r;i.show();try{r=await i.confirmation}catch(e){r=!1}return i.remove(),r},async prompt(e,t=[],n=""){"string"==typeof t&&(t=[t]);const s=new Zo({title:e,messages:t,fields:[{name:"reason",placeholder:n}],type:"prompt"}),i=new Zg({model:s});let r;i.show();try{var o;r=null===(o=(await i.confirmation).pop())||void 0===o?void 0:o.value}catch(e){r=!1}return i.remove(),r},alert(e,t,n){let s;"string"==typeof n&&(n=[n]),"error"===e?s="alert-danger":"info"===e?s="alert-info":"warn"===e&&(s="alert-warning");const i=new Zo({title:t,messages:n,level:s,type:"alert"});Cl.modal.show(Xg,{model:i})}};jl.plugins.add("converse-modal",{initialize(){Cl.listen.on("disconnect",(()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")})),Cl.listen.on("clearSession",(()=>Cl.modal.removeAll())),Object.assign(va.api,tp)}});const np=(e,t)=>{var n,s;const i=e.N;if(void 0===i)return!1;for(const e of i)null===(s=(n=e).O)||void 0===s||s.call(n,t,!1),np(e,t);return!0},sp=e=>{let t,n;do{if(void 0===(t=e.M))break;n=t.N,n.delete(e),e=t}while(0===(null==n?void 0:n.size))},ip=e=>{for(let t;t=e.M;e=t){let n=t.N;if(void 0===n)t.N=n=new Set;else if(n.has(e))break;n.add(e),ap(t)}};function rp(e){void 0!==this.N?(sp(this),this.M=e,ip(this)):this.M=e}function op(e,t=!1,n=0){const s=this.H,i=this.N;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(s))for(let e=n;e<s.length;e++)np(s[e],!1),sp(s[e]);else null!=s&&(np(s,!1),sp(s));else np(this,e)}const ap=e=>{var t,n,s,i;2==e.type&&(null!==(t=(s=e).P)&&void 0!==t||(s.P=op),null!==(n=(i=e).Q)&&void 0!==n||(i.Q=rp))};class cp extends wg{constructor(){super(...arguments),this.isConnected=!0,this.ut=Xc,this.N=void 0}T(e,t,n){super.T(e,t,n),ip(this)}O(e,t=!0){this.at(e),t&&(np(this,e),sp(this))}at(e){var t,n;e!==this.isConnected&&(e?(this.isConnected=!0,this.ut!==Xc&&(this.setValue(this.ut),this.ut=Xc),null===(t=this.reconnected)||void 0===t||t.call(this)):(this.isConnected=!1,null===(n=this.disconnected)||void 0===n||n.call(this)))}S(e,t){if(!this.isConnected)throw Error(`AsyncDirective ${this.constructor.name} was rendered while its tree was disconnected.`);return super.S(e,t)}setValue(e){if(this.isConnected)if((e=>void 0===this.Σdt.strings)())this.Σdt.I(e,this);else{const t=[...this.Σdt.H];t[this.Σct]=e,this.Σdt.I(t,this,0)}else this.ut=e}disconnected(){}reconnected(){}}const lp=e=>!(e=>null===e||"object"!=typeof e&&"function"!=typeof e)(e)&&"function"==typeof e.then,dp=_g(class extends cp{constructor(){super(...arguments),this.Ct=2147483647,this.Rt=[]}render(...e){var t;return null!==(t=e.find((e=>!lp(e))))&&void 0!==t?t:Xc}update(e,t){const n=this.Rt;let s=n.length;this.Rt=t;for(let e=0;e<t.length&&!(e>this.Ct);e++){const i=t[e];if(!lp(i))return this.Ct=e,i;e<s&&i===n[e]||(this.Ct=2147483647,s=0,Promise.resolve(i).then((e=>{const t=this.Rt.indexOf(i);t>-1&&t<this.Ct&&(this.Ct=t,this.setValue(e))})))}return Xc}}),{Strophe:up,u:hp}=jl.env;class mp extends Uf{static get properties(){return{correcting:{type:Boolean},editable:{type:Boolean},hide_url_previews:{type:Boolean},is_retracted:
class="chat-msg__actions ${e?"dropup dropup--left":"dropleft"}"
.items=${t}
></converse-dropdown>`:""}static getActionsDropdownItem(e){return Qc`
<button class="chat-msg__action ${e.button_class}" @click=${e.handler}>
<converse-icon
class="${e.icon_class}"
path-prefix="${Cl.settings.get("assets_path")}"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${e.i18n_text}
</button>
`}onMessageEditButtonClicked(e){var t,n;e.preventDefault();const s=this.model.collection.findWhere("correcting"),i=null===(t=hp.ancestor(this,".chatbox"))||void 0===t||null===(n=t.querySelector(".chat-textarea"))||void 0===n?void 0:n.value;(!i||s&&s.get("message")===i||confirm(vh("You have an unsent message which will be lost if you continue. Are you sure?")))&&(s!==this.model?(null==s||s.save("correcting",!1),this.model.save("correcting",!0)):this.model.save("correcting",!1))}async onDirectMessageRetractButtonClicked(){if("me"!==this.model.get("sender"))return M.error("onMessageRetractButtonClicked called for someone else's message!");const e=vh("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),t=[vh("Are you sure you want to retract this message?")];Cl.settings.get("show_retraction_warning")&&(t[1]=e),await Cl.confirm(vh("Confirm"),t)&&this.model.collection.chatbox.retractOwnMessage(this.model)}async retractOtherMessage(e){const t=this.model.collection.chatbox,n=await t.retractOtherMessage(this.model,e);if(null===n){const e=vh("A timeout occurred while trying to retract the message");Cl.alert("error",vh("Error"),e),M(e,up.LogLevel.WARN)}else if(hp.isErrorStanza(n)){const e=vh("Sorry, you're not allowed to retract this message.");Cl.alert("error",vh("Error"),e),M(e,up.LogLevel.WARN),M(n,up.LogLevel.WARN)}}async onMUCMessageRetractButtonClicked(){const e=vh("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere.");if(this.model.mayBeRetracted()){const t=[vh("Are you sure you want to retract this message?")];Cl.settings.get("show_retraction_warning")&&(t[1]=e),await Cl.confirm(vh("Confirm"),t)&&this.model.collection.chatbox.retractOwnMessage(this.model)}else if(await this.model.mayBeModerated())if("me"===this.model.get("sender")){let t=[vh("Are you sure you want to retract this message?")];Cl.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]),await Cl.confirm(vh("Confirm"),t)&&this.retractOtherMessage()}else{let t=[vh("You are about to retract this message."),vh("You may optionally include a message, explaining the reason for the retraction.")];Cl.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]);const n=await Cl.prompt(vh("Message Retraction"),t,vh("Optional reason"));!1!==n&&this.retractOtherMessage(n)}else{const e=vh("Sorry, you're not allowed to retract this message");Cl.alert("error",vh("Error"),e)}}onMessageRetractButtonClicked(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.collection.chatbox.get("type")===va.CHATROOMS_TYPE?this.onMUCMessageRetractButtonClicked():this.onDirectMessageRetractButtonClicked()}onHidePreviewsButtonClicked(e){var t;if(null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.hide_url_previews)this.model.save({hide_url_previews:!1,url_preview_transition:"fade-in"});else{const e=this.model.get("ogp_metadata")||[];Cl.settings.get("muc_show_ogp_unfurls")&&e.length?this.model.set("url_preview_transition","fade-out"):this.model.save({hide_url_previews:!0,url_preview_transition:"fade-in"})}}async getActionButtons(){var e;const t=[];this.editable&&t.push({i18n_text:this.correcting?vh("Cancel Editing"):vh("Edit"),handler:e=>this.onMessageEditButtonClicked(e),button_class:"chat-msg__action-edit",icon_class:"fa fa-pencil-alt",name:"edit"});const n="groupchat"===this.model.get("type")&&await this.model.mayBeModerated();if(!this.is_retracted&&(this.model.mayBeRetracted()||n)&&t.push({i18n_text:vh("Retract"),handler:e=>this.onMessageRetractButtonClicked(e),button_class:"chat-msg__action-retract",icon_class:"fas fa-trash-alt",name:"retract"}),!this.model.collection)return[];const s=this.model.get("ogp_metadata")||[],i=Cl.settings.get("muc_show_ogp_unfurls")&&s.length,r=null===(e=this.model.get("media_urls"))||void 0===e?void 0:e.length;if(i||r){let e;const n=this.hide_url_previews;e=s.length>1?vh(n?"Show URL previews":"Hide URL previews"):1===s.length?vh(n?"Show URL
2021-03-19 19:26:15 +01:00
<div class="modal-dialog fit-content" role="document">
<div class="modal-content fit-content">
<div class="modal-header">
2021-11-11 22:06:49 +01:00
<h4 class="modal-title" id="message-versions-modal-label">${vh("Image: ")}<a target="_blank" rel="noopener" href="${e.src}">${e.src}</a></h4>
${Qg}
2021-03-19 19:26:15 +01:00
</div>
<div class="modal-body modal-body--image fit-content">
<img class="chat-image" src="${e.src}" @load=${e.onload}>
</div>
2021-11-11 22:06:49 +01:00
<div class="modal-footer">${Yg}</div>
</div>
</div>`)({src:this.src,onload:e=>e.target.parentElement.style.height=`${e.target.height}px`})}}),gp=(e,t)=>Qc`<audio controls src="${e}"></audio>${t?"":Qc`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`;class pp{constructor(e){e.toString().indexOf("ArrayBuffer")>0&&(e=new Uint8Array(e)),this.data=e,this.len=this.data.length,this.pos=0}readByte(){if(this.pos>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.pos++]:255&this.data.charCodeAt(this.pos++)}readBytes(e){const t=[];for(let n=0;n<e;n++)t.push(this.readByte());return t}read(e){let t="";for(let n=0;n<e;n++)t+=String.fromCharCode(this.readByte());return t}readUnsigned(){const e=this.readBytes(2);return(e[1]<<8)+e[0]}}function vp(e){return e.reduce((function(e,t){return 2*e+t}),0)}function bp(e){const t=[];for(let n=7;n>=0;n--)t.push(!!(e&1<<n));return t}function yp(e){let t,n;n="";do{t=e.readByte(),n+=e.read(t)}while(0!==t);return n}function _p(e,t){const n=[];for(let s=0;s<t;s++)n.push(e.readBytes(3));return n}function wp(e,t){const n={};switch(n.sentinel=e.readByte(),String.fromCharCode(n.sentinel)){case"!":n.type="ext",function(e,t,n){switch(t.label=e.readByte(),t.label){case 249:t.extType="gce",function(t){e.readByte();const s=bp(e.readByte());t.reserved=s.splice(0,3),t.disposalMethod=vp(s.splice(0,3)),t.userInput=s.shift(),t.transparencyGiven=s.shift(),t.delayTime=e.readUnsigned(),t.transparencyIndex=e.readByte(),t.terminator=e.readByte(),null==n||n.gce(t)}(t);break;case 254:t.extType="com",function(t){t.comment=yp(e),n.com&&n.com(t)}(t);break;case 1:t.extType="pte",function(t){e.readByte(),t.ptHeader=e.readBytes(12),t.ptData=yp(e),n.pte&&n.pte(t)}(t);break;case 255:t.extType="app",function(t){switch(e.readByte(),t.identifier=e.read(8),t.authCode=e.read(3),t.identifier){case"NETSCAPE":!function(t){e.readByte(),t.unknown=e.readByte(),t.iterations=e.readUnsigned(),t.terminator=e.readByte(),n.app&&n.app.NETSCAPE&&n.app.NETSCAPE(t)}(t);break;default:!function(t){t.appData=yp(e),n.app&&n.app[t.identifier]&&n.app[t.identifier](t)}(t)}}(t);break;default:t.extType="unknown",function(t){t.data=yp(e),n.unknown&&n.unknown(t)}(t)}}(e,n,t);break;case",":n.type="img",function(e,t,n){t.leftPos=e.readUnsigned(),t.topPos=e.readUnsigned(),t.width=e.readUnsigned(),t.height=e.readUnsigned();const s=bp(e.readByte());t.lctFlag=s.shift(),t.interlaced=s.shift(),t.sorted=s.shift(),t.reserved=s.splice(0,2),t.lctSize=vp(s.splice(0,3)),t.lctFlag&&(t.lct=_p(e,1<<t.lctSize+1)),t.lzwMinCodeSize=e.readByte();const i=yp(e);t.pixels=function(e,t){let n=0;function s(e){let s=0;for(let i=0;i<e;i++)t.charCodeAt(n>>3)&1<<(7&n)&&(s|=1<<i),n++;return s}const i=[],r=1<<e,o=r+1;let a=e+1,c=[];const l=function(){c=[],a=e+1;for(let e=0;e<r;e++)c[e]=[e];c[r]=[],c[o]=null};let d,u;for(;;)if(u=d,d=s(a),d!==r){if(d===o)break;if(d<c.length)u!==r&&c.push(c[u].concat(c[d][0]));else{if(d!==c.length)throw new Error("Invalid LZW code.");c.push(c[u].concat(c[u][0]))}i.push.apply(i,c[d]),c.length===1<<a&&a<12&&a++}else l();return i}(t.lzwMinCodeSize,i),t.interlaced&&(t.pixels=function(e,t){const n=new Array(e.length),s=e.length/t;function i(s,i){const r=e.slice(i*t,(i+1)*t);n.splice.apply(n,[s*t,t].concat(r))}const r=[0,4,2,1],o=[8,8,4,2];let a=0;for(let e=0;e<4;e++)for(let t=r[e];t<s;t+=o[e])i(t,a),a++;return n}(t.pixels,t.width)),null==n||n(t)}(e,n,null==t?void 0:t.img);break;case";":n.type="eof",null==t||t.eof(n);break;default:throw new Error("Unknown block: 0x"+n.sentinel.toString(16))}"eof"!==n.type&&setTimeout((()=>wp(e,t)),0)}class Sp{constructor(e,t){this.options=Object.assign({width:null,height:null,autoplay:!0,loop:!0,show_progress_bar:!0,progress_bg_color:"rgba(0,0,0,0.4)",progress_color:"rgba(255,0,22,.8)",progress_bar_height:5},t),this.el=e,this.gif_el=e.querySelector("img"),this.canvas=e.querySelector("canvas"),this.ctx=this.canvas.getContext("2d"),this.offscreenCanvas=document.createElement("canvas"),this.ctx_scaled=!1,this.disposal_method=null,this.disposal_restore_from_idx=null,this.frame=null,this.frame
<div class="form-group">
${"hidden"!==e.type?Qc`<label for="${e.id}">${e.label}</label>`:""}
<!-- This is a hack to prevent Chrome from auto-filling the username in
any of the other input fields in the MUC configuration form. -->
${"password"===e.type&&e.fixed_username?Qc`
<input class="hidden-username" type="text" autocomplete="username" value="${e.fixed_username}"></input>
`:""}
<input
autocomplete="${e.autocomplete||""}"
class="form-control"
id="${e.id}"
name="${e.name}"
placeholder="${e.placeholder||""}"
type="${e.type}"
value="${e.value||""}"
?required=${e.required} />
</div>`,Ap=e=>Qc`
<label>${e.label}
<a class="form-url" target="_blank" rel="noopener" href="${e.value}">${e.value}</a>
</label>`,Cp=e=>Qc`
<div class="form-group">
${e.label?Qc`<label>${e.label}</label>`:""}
<div class="input-group">
<div class="input-group-prepend">
<input name="${e.name}"
type="${e.type}"
value="${e.value||""}"
?required="${e.required}" />
<div class="input-group-text col" title="${e.domain}">${e.domain}</div>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>
</div>`;function Tp(e){e.preventDefault(),Cl.rooms.open(e.target.href)}const kp=(e,t)=>{let n=e.normalize()._string;const s=e._parts.urn?n:e.readable(),i=t||s;return e._parts.protocol||n.startsWith("http://")||n.startsWith("https://")||(n="http://"+n),"xmpp"===e._parts.protocol&&"join"===e._parts.query?Qc`
2021-03-19 19:26:15 +01:00
<a target="_blank"
rel="noopener"
2021-11-11 22:06:49 +01:00
@click=${Tp}
href="${n}">${i}</a>`:Qc`<a target="_blank" rel="noopener" href="${n}">${i}</a>`},jp=(e,t)=>Qc`<video controls preload="metadata" src="${e}"></video>${t?"":Qc`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{sizzle:Np}=jl.env,Op=["http","https","xmpp","mailto"];function $p(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":null!=t&&t.new_password?"new-password":"current-password"}[e]}const Ip={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"};function Mp(e){const t=Il(e);return null===t?e:Bl(t)?jp(e):Ul(t)?gp(e):(ql(t),xp(t.toString(),function(e){try{return decodeURI(e.filename())}catch(t){return M.debug(t),e.filename()}}(t)))}function Rp(e){const t=RegExp("^w{3}.","ig").test(e)?`http://${e}`:e,n=Il(e);return null===n||!function(e){try{return!!new URL(e)}catch(e){return!1}}(t)||!function(e,t=Op){return!!t.includes(e)}(n._parts.protocol)&&n._parts.protocol?e:kp(n,e)}function Dp(e,t){e.classList.remove("visible"),ve(t)&&t()}la.calculateElementHeight=function(e){return Array.from(e.children).reduce(((e,t)=>e+t.offsetHeight),0)},la.getNextElement=function(e,t="*"){let n=e.nextElementSibling;for(;null!==n&&!Np.matchesSelector(n,t);)n=n.nextElementSibling;return n},la.getPreviousElement=function(e,t="*"){let n=e.previousElementSibling;for(;null!==n&&!Np.matchesSelector(n,t);)n=n.previousElementSibling;return n},la.getFirstChildElement=function(e,t="*"){let n=e.firstElementChild;for(;null!==n&&!Np.matchesSelector(n,t);)n=n.nextElementSibling;return n},la.getLastChildElement=function(e,t="*"){let n=e.lastElementChild;for(;null!==n&&!Np.matchesSelector(n,t);)n=n.previousElementSibling;return n},la.hasClass=function(e,t){return t instanceof Element&&t.classList.contains(e)},la.toggleClass=function(e,t){la.hasClass(e,t)?la.removeClass(e,t):la.addClass(e,t)},la.addClass=function(e,t){return t instanceof Element&&t.classList.add(e),t},la.removeClass=function(e,t){return t instanceof Element&&t.classList.remove(e),t},la.removeElement=function(e){return e instanceof Element&&e.parentNode&&e.parentNode.removeChild(e),e},la.getElementFromTemplateResult=function(e){const t=document.createElement("div");return tl(e,t),t.firstElementChild},la.showElement=e=>{la.removeClass("collapsed",e),la.removeClass("hidden",e)},la.hideElement=function(e){return e instanceof Element&&e.classList.add("hidden"),e},la.ancestor=function(e,t){let n=e;for(;null!==n&&!Np.matchesSelector(n,t);)n=n.parentElement;return n},la.nextUntil=function(e,t){const n=[];let s=e.nextElementSibling;for(;null!==s&&!s.matches(t);)n.push(s),s=s.nextElementSibling;return n},la.unescapeHTML=function(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText},la.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},la.slideInAllElements=function(e,t=300){return Promise.all(Array.from(e).map((e=>la.slideIn(e,t))))},la.slideToggleElement=function(e,t){return la.hasClass("collapsed",e)||la.hasClass("hidden",e)?la.slideOut(e,t):la.slideIn(e,t)},la.slideOut=function(e,t=200){return new Promise(((n,s)=>{if(!e){const e="An element needs to be passed in to slideOut";return M.warn(e),void s(new Error(e))}const i=e.getAttribute("data-slider-marker");i&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(i));const r=la.calculateElementHeight(e);if(window.converse_disable_effects)return e.style.height=r+"px",function(e){e.removeAttribute("data-slider-marker"),e.classList.remove("collapsed"),e.style.overflow="",e.style.height=""}(e),void n();if(!la.hasClass("collapsed",e)&&!la.hasClass("hidden",e))return void n();const o=t/17;let a=0;e.style.height="0",e.style.overflow="hidden",e.classList.remove("hidden"),e.classList.remove("collapsed"),e.setAttribute("data-slider-marker",window.requestAnimationFrame((function t(){a+=r/o,a<r?(e.style.height=a+"px",e.setAttribute("data-slider-marker",window.requestAnimationFrame(t))):(e.removeAttribute(
<div class="form-group">
<label for="${e.id}">${e.label}</label>
<select class="form-control" id="${e.id}" name="${e.name}" ?multiple="${e.multiple}">
${null===(t=e.options)||void 0===t?void 0:t.map((e=>(e=>Qc`<option value="${e.value}" ?selected="${e.selected}">${e.label}</option>`)(e)))}
</select>
</div>`})({options:la.queryChildren(e,"option").map((n=>{var s;const i=null===(s=n.querySelector("value"))||void 0===s?void 0:s.textContent;return{value:i,label:n.getAttribute("label"),selected:t.includes(i),required:!!e.querySelector("required")}})),id:la.getUniqueId(),label:e.getAttribute("label"),multiple:"list-multi"===e.getAttribute("type"),name:e.getAttribute("var"),required:!!e.querySelector("required")})}var s,i,r,o;if("fixed"===e.getAttribute("type"))return(e=>Qc`<p class="form-help">${e.text}</p>`)({text:null===(s=e.querySelector("value"))||void 0===s?void 0:s.textContent});if("jid-multi"===e.getAttribute("type"))return(e=>Qc`
<label class="label-ta">${e.label}</label>
<textarea name="${e.name}">${e.value}</textarea>
`)({name:e.getAttribute("var"),label:e.getAttribute("label")||"",value:null===(i=e.querySelector("value"))||void 0===i?void 0:i.textContent,required:!!e.querySelector("required")});if("boolean"===e.getAttribute("type")){var a;const t=null===(a=e.querySelector("value"))||void 0===a?void 0:a.textContent;return(e=>Qc`
<fieldset class="form-group">
<input id="${e.id}" name="${e.name}" type="checkbox" ?checked=${e.checked} ?required=${e.required} />
<label class="form-check-label" for="${e.id}">${e.label}</label>
</fieldset>`)({id:la.getUniqueId(),name:e.getAttribute("var"),label:e.getAttribute("label")||"",checked:"1"===t||"true"===t?'checked="1"':"",required:!!e.querySelector("required")})}if("url"===e.getAttribute("var"))return Ap({label:e.getAttribute("label")||"",value:null===(r=e.querySelector("value"))||void 0===r?void 0:r.textContent});if("username"===e.getAttribute("var"))return Cp({domain:" @"+n.domain,name:e.getAttribute("var"),type:Ip[e.getAttribute("type")],label:e.getAttribute("label")||"",value:null===(o=e.querySelector("value"))||void 0===o?void 0:o.textContent,required:!!e.querySelector("required")});if("ocr"===e.getAttribute("var")){const n=e.querySelector("uri"),s=Np('data[cid="'+n.textContent.replace(/^cid:/,"")+'"]',t)[0];return(e=>Qc`
<fieldset class="form-group">
${e.label?Qc`<label>${e.label}</label>`:""}
<img src="data:${e.type};base64,${e.data}">
<input name="${e.name}" type="text" ?required="${e.required}" />
</fieldset>
`)({label:e.getAttribute("label"),name:e.getAttribute("var"),data:null==s?void 0:s.textContent,type:n.getAttribute("type"),required:!!e.querySelector("required")})}{var c;const t=e.getAttribute("var");return Ep({id:la.getUniqueId(),label:e.getAttribute("label")||"",name:t,fixed_username:null==n?void 0:n.fixed_username,autocomplete:$p(t,n),placeholder:null,required:!!e.querySelector("required"),type:Ip[e.getAttribute("type")],value:null===(c=e.querySelector("value"))||void 0===c?void 0:c.textContent})}},Object.assign(la,{getOOBURLMarkup:Mp});const Lp=la;var zp=n(3735),Pp={};Pp.styleTagTransform=eg(),Pp.setAttributes=Yf(),Pp.insert=Jf().bind(null,"head"),Pp.domAPI=Wf(),Pp.insertStyleElement=Xf(),Hf()(zp.Z,Pp),zp.Z&&zp.Z.locals&&zp.Z.locals,Cl.elements.define("converse-gif",class extends Uf{static get properties(){return{autoplay:{type:Boolean},noloop:{type:Boolean},progress_color:{type:String},fallback:{type:String},src:{type:String}}}constructor(){super(),this.autoplay=!1,this.noloop=!1,this.fallback="url"}initialize(){const e={autoplay:this.autoplay,loop:!this.noloop};this.progress_color&&(e.progress_color=this.progress_color),this.supergif=new Sp(this,e)}updated(e){this.supergif&&!e.has("src")?(e.has("autoplay")&&(this.supergif.options.autoplay=this.autoplay),e.has("noloop")&&(this.supergif.options.loop=!this.noloop),e.has("progress_color")&&(this.supergif.options.progress_color=this.progress_color)):this.initialize()}render(){var e;return null!==(e=this.supergif)&&void 0!==e&&e.load_error&&["url","empty"].includes(this.fallback)?this.renderErrorFallback():Qc`<canvas class="gif-canvas"
@mouseover=${()=>this.setHover()}
@mouseleave=${()=>this.unsetHover()}
@click=${e=>this.onControlsClicked(e)}><img class="gif" src="${this.src}"></a></canvas>`}renderErrorFallback(){return"url"===this.fallback?Rp(this.src):"empty"===this.fallback?"":void 0}setHover(){this.supergif&&(this.supergif.hovering=!0,this.hover_timeout&&clearTimeout(this.hover_timeout),this.hover_timeout=setTimeout((()=>this.unsetHover()),2e3))}unsetHover(){this.supergif&&(this.supergif.hovering=!1)}onControlsClicked(e){e.preventDefault(),this.supergif.playing?this.supergif.pause():(this.supergif.options.loop=!0,this.supergif.play())}});const{URI:Fp}=jl.env,Up=_g(class extends cp{render(e,t,n,s){return t?Qc`<a href="${t}" class="chat-image__link" target="_blank" rel="noopener">${this.renderImage(e,t,n,s)}</a>`:this.renderImage(e,t,n,s)}renderImage(e,t,n,s){return Qc`<img class="chat-image img-thumbnail"
src="${e}"
@click=${s}
@error=${()=>this.onError(e,t,n,s)}
@load=${n}/></a>`}onError(e,t,n,s){if(Pl(e))t&&this.setValue(Rp(t));else{const i=new Fp(e),r=i.filename();i.filename(`${r}.png`),this.setValue(Up(i.toString(),t,n,s))}}}),Bp=e=>Qc`${Up(e.url,e.href,e.onLoad,e.onClick)}`,qp=_g(class extends wg{render(e,t,n,s){const i=new tv(e,t,n,Object.assign(s,{show_images:!1,embed_videos:!1,embed_audio:!1}));return Qc`${dp(async function(e){return await e.addTemplates(),e.payload}(i),Qc`${i}`)}`}}),Hp=["*","_","~","`"],Gp=[...Hp,"```",">"],Wp={"*":{name:"strong",type:"span"},_:{name:"emphasis",type:"span"},"~":{name:"strike",type:"span"},"`":{name:"preformatted",type:"span"},"```":{name:"preformatted_block",type:"block"},">":{name:"quote",type:"block"}},Vp=["_",">","`","~"],Jp={emphasis:(e,t,n,s)=>Qc`<span class="styling-directive">_</span><i>${qp(e,t,n,s)}</i><span class="styling-directive">_</span>`,preformatted:e=>Qc`<span class="styling-directive">\`</span><code>${e}</code><span class="styling-directive">\`</span>`,preformatted_block:e=>Qc`<div class="styling-directive">\`\`\`</div><code class="block">${e}</code><div class="styling-directive">\`\`\`</div>`,quote:(e,t,n,s)=>Qc`<blockquote>${qp(e,t,n,s)}</blockquote>`,strike:(e,t,n,s)=>Qc`<span class="styling-directive">~</span><del>${qp(e,t,n,s)}</del><span class="styling-directive">~</span>`,strong:(e,t,n,s)=>Qc`<span class="styling-directive">*</span><b>${qp(e,t,n,s)}</b><span class="styling-directive">*</span>`};function Kp(e,t,n=!0){let s;if(!/(^```\s*\n|^```\s*$)/.test(e.slice(t))||0!==t&&"\n"!==e[t-1]&&">"!==e[t-1]){if(!Gp.includes(e.slice(t,t+1)))return null;if(s=e.slice(t,t+1),!function(e,t,n,s){if(s){const s=RegExp(Vp.includes(e)?`^(\\p{L}|\\p{N})${e}`:`^(\\p{L}|\\p{N})\\${e}`,"u");if(n>1&&s.test(t.slice(n-1)))return!1;if(Qp(e)&&n>0&&"\n"!==t[n-1])return!1;if(Hp.includes(e)&&t[n+1]===e)return!1}else{const s=RegExp(Vp.includes(e)?`^${e}(\\p{L}|\\p{N})`:`^\\${e}(\\p{L}|\\p{N})`,"u");if(n<t.length-1&&s.test(t.slice(n)))return!1;if(Hp.includes(e)&&t[n-1]===e)return!1}return!0}(s,e,t,n))return null}else s=e.slice(t,t+3);return s}function Yp(e,t){const n=Kp(e,t),s=n?function(e,t,n){if(!e)return 0;const s=n;if(n+=e.length,Qp(e))return(n+=t.slice(n).split(/\n[^>]/).shift().length)-s;if("span"===Wp[e].type){const s=t.slice(n).split("\n").shift();let i=0,r=s.indexOf(e);for(;-1!==r;){if(Kp(t,n+r,!1)===e)return r+2*e.length;r=s.indexOf(e,i++)}return 0}{const s=t.slice(n+1);let i=0,r=s.indexOf(e);for(;-1!==r;){if(Kp(t,n+1+r,!1)===e)return r+1+2*e.length;r=s.indexOf(e,i++)}return 0}}(n,e,t):0;return s>0?{d:n,length:s}:{}}const Qp=e=>[">","&gt;"].includes(e);function Xp(e,t,n,s,i){const r=Jp[Wp[e].name];return Qp(e)?r(t.replace(/\n>/g,"\n").replace(/\n$/,""),n,s,i):r(t,n,s,i)}const{URI:Zp}=jl.env,ev=e=>"string"==typeof e;class tv extends String{constructor(e,t=0,n=[],s={}){super(e),this.embed_audio=null==s?void 0:s.embed_audio,this.embed_videos=null==s?void 0:s.embed_videos,this.mentions=n,this.nick=null==s?void 0:s.nick,this.offset=t,this.onImgClick=null==s?void 0:s.onImgClick,this.onImgLoad=null==s?void 0:s.onImgLoad,this.options=s,this.payload=[],this.references=[],this.render_styling=null==s?void 0:s.render_styling,this.show_images=null==s?void 0:s.show_images,this.hide_media_urls=null==s?void 0:s.hide_media_urls}addHyperlinks(e,t){const n=[];try{Zp.withinString(e,((e,t,s)=>(n.push({url:e,start:t,end:s}),e)),ge)}catch(e){return void M.debug(e)}n.filter((t=>!e.slice(t.start,t.end).startsWith("aesgcm://"))).forEach((e=>{const n=e.url,s=function(e){const t=Cl.settings.get("filter_url_query_params");return t?Il(e).removeQuery(t).toString():e}(n);let i;var r,o;this.show_images&&Fl(n)&&zl(n)?(r=s,o=this.hide_media_urls,i=Qc`<converse-gif autoplay noloop fallback='empty' src=${r}></converse-gif>${o?"":Qc`<a target="_blank" rel="noopener" href="${r}">${r}</a>`}`):i=this.show_images&&ql(n)&&zl(n)?Bp({url:s,href:this.hide_media_urls?null:s,onClick:this.onImgClick,onLoad:this.onImgLoad}):this.embed_videos&&Bl(n)&&Ll(n)?jp(s,this.hide_media_urls):this.embed_audio&&Ul(n)&&Dl(n)?gp(s,this.hide_media_urls):Rp(s),this.addTemplateResu
<button type="button" class="btn btn--transparent btn--standalone" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<converse-icon color="${this.color}" size="1em" class="${this.icon_classes}">
2021-03-19 19:26:15 +01:00
</button>
2021-11-11 22:06:49 +01:00
<div class="dropdown-menu">
${this.items.map((e=>dp(e,"")))}
</div>
`}firstUpdated(){super.firstUpdated(),this.initArrowNavigation()}hideMenu(){var e;super.hideMenu(),null===(e=this.navigator)||void 0===e||e.disable()}initArrowNavigation(){if(!this.navigator){const e={selector:".dropdown-item",onSelected:e=>e.focus()};this.navigator=new hv(this.menu,e)}}enableArrowNavigation(e){e&&(e.preventDefault(),e.stopPropagation()),this.navigator.enable(),this.navigator.select(this.menu.firstElementChild)}handleKeyUp(e){super.handleKeyUp(e),e.keyCode!==jl.keycodes.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}}Cl.elements.define("converse-dropdown",vv);const{dayjs:bv}=jl.env;Cl.elements.define("converse-message-versions",class extends Uf{static get properties(){return{model:{type:Object}}}render(){const e=this.model.get("older_versions"),t=this.model.get("message");return Qc`
<h4>Older versions</h4>
${Object.keys(e).map((t=>Qc`<p class="older-msg"><time>${bv(t).format("MMM D, YYYY, HH:mm:ss")}</time>: ${e[t]}</p>`))}
<hr/>
<h4>Current version</h4>
<p>${t}</p>`}});const yv=Kg.extend({id:"message-versions-modal",toHTML(){return(e=>Qc`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2021-11-11 22:06:49 +01:00
<h4 class="modal-title" id="message-versions-modal-label">${vh("Message versions")}</h4>
${Qg}
2021-03-19 19:26:15 +01:00
</div>
<div class="modal-body">
2021-11-11 22:06:49 +01:00
<converse-message-versions .model=${e}></converse-message-versions>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="modal-footer">${Yg}</div>
2021-03-19 19:26:15 +01:00
</div>
</div>
2021-11-11 22:06:49 +01:00
`)(this.model)}}),_v=_g(class extends wg{render(e){const t={classes:e.classes?`${e.classes} avatar`:"avatar",height:e.width||36,image:e.image,image_type:e.image_type,width:e.height||36};return Og(t)}}),wv=Kg.extend({initialize(){Kg.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),Cl.trigger("occupantModalInitialized",this.model)},toHTML(){return(e=>Qc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="user-details-modal-label">${e.display_name}</h5>
${Qg}
</div>
<div class="modal-body">
${_v(e.avatar_data)}
</div>
<div class="modal-footer">
${Yg}
</div>
</div>
</div>
`)(Object.assign(this.model.toJSON(),{avatar_data:this.getAvatarData(),display_name:this.model.getDisplayName()}))},getAvatarData(){const e=va.vcards.findWhere({jid:this.model.get("jid")});return{classes:"chat-msg__avatar",height:120,width:120,image:"data:"+((null==e?void 0:e.get("image_type"))||va.DEFAULT_IMAGE_TYPE)+";base64,"+((null==e?void 0:e.get("image"))||va.DEFAULT_IMAGE)}}});va.OccupantModal=wv;const Sv=wv,xv=e=>{const t=vh("XMPP Address"),n=vh("Email"),s=vh("Full Name"),i=vh("Nickname"),r=vh("The User's Profile Image"),o=vh("Refresh"),a=vh("Role"),c=vh("URL"),l={alt_text:r,extra_classes:"mb-3",height:"120",width:"120"};return Qc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="user-details-modal-label">${e.display_name}</h5>
${Qg}
</div>
<div class="modal-body">
${e.image?Qc`<div class="mb-4">${Og(Object.assign(e,l))}</div>`:""}
${e.fullname?Qc`<p><label>${s}:</label> ${e.fullname}</p>`:""}
<p><label>${t}:</label> <a href="xmpp:${e.jid}">${e.jid}</a></p>
${e.nickname?Qc`<p><label>${i}:</label> ${e.nickname}</p>`:""}
${e.url?Qc`<p><label>${c}:</label> <a target="_blank" rel="noopener" href="${e.url}">${e.url}</a></p>`:""}
${e.email?Qc`<p><label>${n}:</label> <a href="mailto:${e.email}">${e.email}</a></p>`:""}
${e.role?Qc`<p><label>${a}:</label> ${e.role}</p>`:""}
${e._converse.pluggable.plugins["converse-omemo"].enabled(e._converse)?(e=>{const t=vh("OMEMO Fingerprints"),n=vh("No OMEMO-enabled devices found"),s=e.view.devicelist.devices;return Qc`
<hr/>
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
${s.length?s.map((t=>(e=>{const t=vh("Trusted"),n=vh("Untrusted");return e.device.get("bundle")&&e.device.get("bundle").fingerprint?Qc`
<li class="list-group-item">
<form class="fingerprint-trust">
<div class="btn-group btn-group-toggle">
<label class="btn btn--small ${-1!==e.device.get("trusted")?"btn-primary active":"btn-secondary"}">
<input type="radio" name="${e.device.get("id")}" value="1" ?checked=${-1!==e.device.get("trusted")}>${t}
</label>
<label class="btn btn--small ${-1!==e.device.get("trusted")?"btn-primary active":"btn-secondary"}">
<input type="radio" name="${e.device.get("id")}" value="-1" ?checked=${-1===e.device.get("trusted")}>${n}
</label>
</div>
<code class="fingerprint">${e.utils.formatFingerprint(e.device.get("bundle").fingerprint)}</code>
</form>
</li>
`:""})(Object.assign({device:t},e)))):Qc`<li class="list-group-item"> ${n} </li>`}
</ul>
`})(e):""}
</div>
<div class="modal-footer">
${Yg}
<button type="button" class="btn btn-info refresh-contact"><i class="fa fa-refresh"> </i>${o}</button>
${e.allow_contact_removal&&e.is_roster_contact?(e=>{const t=vh("Remove as contact");return Qc`
<button type="button" @click="${e.removeContact}" class="btn btn-danger remove-contact">
<i class="far fa-trash-alt"></i>${t}
</button>
`})(e):""}
2021-03-19 19:26:15 +01:00
</div>
</div>
2021-11-11 22:06:49 +01:00
</div>
`},Ev=jl.env.utils,Av=Kg.extend({id:"user-details-modal",persistent:!0,events:{"click button.refresh-contact":"refreshContact","click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){Kg.prototype.initialize.apply(this,arguments),this.model.rosterContactAdded.then((()=>this.registerContactEventHandlers())),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),Cl.trigger("userDetailsModalInitialized",this.model)},toHTML(){var e;const t=null===(e=this.model)||void 0===e?void 0:e.vcard,n=t?t.toJSON():{};return xv(Object.assign(this.model.toJSON(),n,{_converse:va,allow_contact_removal:Cl.settings.get("allow_contact_removal"),display_name:this.model.getDisplayName(),is_roster_contact:void 0!==this.model.contact,removeContact:e=>this.removeContact(e),view:this,utils:Ev}))},registerContactEventHandlers(){void 0!==this.model.contact&&(this.listenTo(this.model.contact,"change",this.render),this.listenTo(this.model.contact.vcard,"change",this.render),this.model.contact.on("destroy",(()=>{delete this.model.contact,this.render()})))},async refreshContact(e){e&&e.preventDefault&&e.preventDefault();const t=this.el.querySelector(".fa-refresh");Ev.addClass("fa-spin",t);try{await Cl.vcard.update(this.model.contact.vcard,!0)}catch(e){M.fatal(e),this.alert(vh("Sorry, something went wrong while trying to refresh"),"danger")}Ev.removeClass("fa-spin",t)},removeContact(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),Cl.settings.get("allow_contact_removal")&&!0===confirm(vh("Are you sure you want to remove this contact?"))&&(setTimeout((()=>function(e){e.removeFromRoster((()=>e.destroy()),(t=>{t&&M.error(t),Cl.alert("error",vh("Error"),[vh("Sorry, there was an error while trying to remove %1$s as a contact.",e.getDisplayName())])}))}(this.model.contact)),1),this.modal.hide())}});va.UserDetailsModal=Av;const Cv=Av,{dayjs:Tv}=jl.env;function kv(e){return!!Il(e).host()}const jv=(e,t)=>e.url&&kv(e.url)&&!Fl(e.url)?Qc`<a href="${e.url}" target="_blank" rel="noopener">${t(e)}</a>`:t(e),Nv=e=>Qc`<converse-rich-text class="card-img-top" text="${e.image}" show_images ?hide_media_urls=${function(e){return Fl(e.url)||Bl(e.url)||Ul(e.url)}(e.url)} .onImgLoad=${e.onload}></converse-rich-text>`;var Ov=n(7415),$v={};$v.styleTagTransform=eg(),$v.setAttributes=Yf(),$v.insert=Jf().bind(null,"head"),$v.domAPI=Wf(),$v.insertStyleElement=Xf(),Hf()(Ov.Z,$v),Ov.Z&&Ov.Z.locals&&Ov.Z.locals,Cl.elements.define("converse-message-unfurl",class extends Uf{static get properties(){return{description:{type:String},image:{type:String},jid:{type:String},title:{type:String},url:{type:String}}}render(){return(e=>{const t=(n=e.image)&&zl(n)&&kv(n);var n;const s=e.title||e.description||e.url;return t||s?Qc`<div class="card card--unfurl">
${t?jv(e,Nv):""}
${s?Qc`
<div class="card-body">
${e.title?jv(e,(e=>Qc`<h5 class="card-title">${e.title}</h5>`)):""}
${e.description?Qc`<p class="card-text"><converse-rich-text text=${e.description}></converse-rich-text></p>`:""}
${e.url?Qc`<p class="card-text"><a href="${e.url}" target="_blank" rel="noopener">${Il(e.url).domain()}</a></p>`:""}
</div>`:""}
</div>`:""})(Object.assign({onload:()=>this.onImageLoad()},{description:this.description||"",image:this.image||"",title:this.title||"",url:this.url||""}))}onImageLoad(){this.dispatchEvent(new CustomEvent("imageLoaded",{detail:this,bubbles:!0}))}});const Iv=(e={})=>{var t;return null!==(t=e.classes)&&void 0!==t&&t.includes("hor_centered")?Qc`<div class="spinner__container"><span class="spinner fa fa-spinner centered ${e.classes||""}"/></div>`:Qc`<span class="spinner fa fa-spinner centered ${e.classes||""}"/>`};var Mv=n(4971),Rv=n.n(Mv);const{dayjs:Dv}=jl.env;function Lv(e){if(!e.isHidden()&&Cl.settings.get("allow_url_history_change")){const t=window.location.hash;t&&e.messages.get(t.slice(1))&&va.router.history.navigate()}}const zv=Rv()((e=>function(e){const t=e.target;if("converse-chat-content"!==t.nodeName.toLowerCase())return;let n=!0;const s=0===Math.floor(t.scrollTop),i=Math.ceil(t.clientHeight-t.scrollTop)>=t.scrollHeight-Math.ceil(t.scrollHeight/20);s?(n=!1,Lv(t.model)):i&&Cl.trigger("chatBoxScrolledUp",t),t.model.get("scolled")!==n&&t.model.ui.set({scrolled:n})}(e)),50);function Pv(e){if("groupchat"===e.get("type")){var t;const n=Cl.settings.get("muc_hats").filter((e=>e)).map((e=>e.toLowerCase()));let s=[];n.includes("vcard_roles")&&(s=e.vcard?e.vcard.get("role"):null,s=s?s.split(",").filter((e=>e)).map((e=>({title:e}))):[]);const i=[...e.occupant?[e.occupant.get("role")]:[],...e.occupant?[e.occupant.get("affiliation")]:[]].filter((e=>e)).filter((e=>n.includes(e.toLowerCase()))).map((e=>({title:e})));return[...n.includes("xep317")&&(null===(t=e.occupant)||void 0===t?void 0:t.get("hats"))||[],...s,...i]}return[]}const{Strophe:Fv,dayjs:Uv}=jl.env;Cl.elements.define("converse-chat-message",class extends Uf{static get properties(){return{jid:{type:String},mid:{type:String}}}connectedCallback(){super.connectedCallback(),this.initialize()}async initialize(){await this.setModels(),this.model?(this.listenTo(this.chatbox,"change:first_unread_id",this.requestUpdate),this.listenTo(this.model,"change",this.requestUpdate),this.model.vcard&&this.listenTo(this.model.vcard,"change",this.requestUpdate),"groupchat"===this.model.get("type")&&(this.model.occupant?this.listenTo(this.model.occupant,"change",this.requestUpdate):this.listenTo(this.model,"occupantAdded",(()=>{this.listenTo(this.model.occupant,"change",this.requestUpdate)})))):M.error("Could not find module for converse-chat-message")}async setModels(){this.chatbox=await Cl.chatboxes.get(this.jid),await this.chatbox.initialized,await this.chatbox.messages.fetched,this.model=this.chatbox.messages.get(this.mid),this.model&&this.requestUpdate()}render(){return this.model?this.show_spinner?Iv():this.model.get("file")&&this.model.get("upload")!==va.SUCCESS?this.renderFileProgress():["error","info"].includes(this.model.get("type"))?this.renderInfoMessage():this.renderChatMessage():""}getProps(){return Object.assign(this.model.toJSON(),this.getDerivedMessageProps())}renderInfoMessage(){return(e=>{const t=Tv(e.model.get("time")).toISOString(),n=vh("Retry");return Qc`
<div class="message chat-info chat-${e.model.get("type")}"
data-isodate="${t}"
data-type="${e.data_name}"
data-value="${e.data_value}">
<div class="chat-info__message">
<converse-rich-text
.mentions=${e.model.get("references")}
render_styling
text=${e.model.getMessageText()}>
</converse-rich-text>
</div>
${e.model.get("reason")?Qc`<q class="reason">${e.model.get("reason")}</q>`:""}
${e.model.get("error_text")?Qc`<q class="reason">${e.model.get("error_text")}</q>`:""}
${e.model.get("retry_event_id")?Qc`<a class="retry" @click=${e.onRetryClicked}>${n}</a>`:""}
</div>`})(this)}renderFileProgress(){if(!this.model.file)return"";const e=vh("Uploading file:"),t=this.model.file.name,n=vd()(this.model.file.size);return Qc`
2021-03-19 19:26:15 +01:00
<div class="message chat-msg">
2021-11-11 22:06:49 +01:00
${_v(this.getAvatarData())}
2021-03-19 19:26:15 +01:00
<div class="chat-msg__content">
<span class="chat-msg__text">${e} <strong>${t}</strong>, ${n}</span>
2021-11-11 22:06:49 +01:00
<progress value="${this.model.get("progress")}"/>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>`}renderChatMessage(){return((e,t)=>{var n,s;const i=vh("New messages");return Qc`
${t.is_first_unread?Qc`<div class="message separator"><hr class="separator"><span class="separator-text">${i}</span></div>`:""}
2021-03-19 19:26:15 +01:00
<div class="message chat-msg ${e.getExtraMessageClasses()}"
2021-11-11 22:06:49 +01:00
data-isodate="${t.time}"
data-msgid="${t.msgid}"
data-from="${t.from}"
data-encrypted="${t.is_encrypted}">
2021-03-19 19:26:15 +01:00
<!-- Anchor to allow us to scroll the message into view -->
2021-11-11 22:06:49 +01:00
<a id="${t.msgid}"></a>
2021-03-19 19:26:15 +01:00
2021-11-11 22:06:49 +01:00
<a class="show-msg-author-modal" @click=${e.showUserModal}>${t.should_show_avatar?_v(e.getAvatarData()):""}</a>
<div class="chat-msg__content chat-msg__content--${t.sender} ${t.is_me_message?"chat-msg__content--action":""}">
2021-03-19 19:26:15 +01:00
2021-11-11 22:06:49 +01:00
${t.is_me_message?"":Qc`
2021-03-19 19:26:15 +01:00
<span class="chat-msg__heading">
2021-11-11 22:06:49 +01:00
<span class="chat-msg__author"><a class="show-msg-author-modal" @click=${e.showUserModal}>${t.username}</a></span>
${t.hats.map((e=>Qc`<span class="badge badge-secondary">${e.title}</span>`))}
<time timestamp="${e.model.get("edited")||e.model.get("time")}" class="chat-msg__time">${t.pretty_time}</time>
${t.is_encrypted?Qc`<span class="fa fa-lock"></span>`:""}
2021-03-19 19:26:15 +01:00
</span>`}
2021-11-11 22:06:49 +01:00
<div class="chat-msg__body chat-msg__body--${t.message_type} ${t.received?"chat-msg__body--received":""} ${t.is_delayed?"chat-msg__body--delayed":""}">
2021-03-19 19:26:15 +01:00
<div class="chat-msg__message">
2021-11-11 22:06:49 +01:00
${t.is_me_message?Qc`
<time timestamp="${t.edited||t.time}" class="chat-msg__time">${t.pretty_time}</time>&nbsp;
<span class="chat-msg__author">${t.is_me_message?"**":""}${t.username}</span>&nbsp;`:""}
${t.is_retracted?e.renderRetraction():e.renderMessageText()}
2021-03-19 19:26:15 +01:00
</div>
<converse-message-actions
.model=${e.model}
2021-11-11 22:06:49 +01:00
?correcting=${t.correcting}
?editable=${t.editable}
?hide_url_previews=${e.model.get("hide_url_previews")}
?is_retracted=${t.is_retracted}
unfurls="${null===(n=e.model.get("ogp_metadata"))||void 0===n?void 0:n.length}"
message_type="${t.message_type}"></converse-message-actions>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
${e.model.get("hide_url_previews")?"":null===(s=e.model.get("ogp_metadata"))||void 0===s?void 0:s.map((t=>{var n;return Qc`<converse-message-unfurl
@animationend="${e.onUnfurlAnimationEnd}"
class="${e.model.get("url_preview_transition")}"
jid="${null===(n=e.chatbox)||void 0===n?void 0:n.get("jid")}"
description="${t["og:description"]||""}"
title="${t["og:title"]||""}"
image="${t["og:image"]||""}"
url="${t["og:url"]||""}"></converse-message-unfurl>`}))}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>`})(this,this.getProps())}shouldShowAvatar(){return Cl.settings.get("show_message_avatar")&&!this.model.isMeCommand()&&"headline"!==this.type}getAvatarData(){var e,t;return{classes:"chat-msg__avatar",height:36,width:36,image:"data:"+((null===(e=this.model.vcard)||void 0===e?void 0:e.get("image_type"))||va.DEFAULT_IMAGE_TYPE)+";base64,"+((null===(t=this.model.vcard)||void 0===t?void 0:t.get("image"))||va.DEFAULT_IMAGE)}}onUnfurlAnimationEnd(){"fade-out"===this.model.get("url_preview_transition")&&this.model.save({hide_url_previews:!this.model.get("hide_url_previews"),url_preview_transition:"fade-in"})}async onRetryClicked(){this.show_spinner=!0,this.requestUpdate(),await Cl.trigger(this.model.get("retry_event_id"),{synchronous:!0}),this.model.destroy(),this.parentElement.removeChild(this)}isRetracted(){return this.model.get("retracted")||"retracted"===this.model.get("moderated")}hasMentions(){return"groupchat"===this.model.get("type")&&"them"===this.model.get("sender")&&this.chatbox.isUserMentioned(this.model)}getOccupantAffiliation(){var e;return null===(e=this.model.occupant)||void 0===e?void 0:e.get("affiliation")}getOccupantRole(){var e;return null===(e=this.model.occupant)||void 0===e?void 0:e.get("role")}getExtraMessageClasses(){const e=[this.model.isFollowup()?"chat-msg--followup":null,this.model.get("is_delayed")?"delayed":null,this.model.isMeCommand()?"chat-msg--action":null,this.isRetracted()?"chat-msg--retracted":null,this.model.get("type"),this.shouldShowAvatar()?"chat-msg--with-avatar":null].map((e=>e));return"groupchat"===this.model.get("type")&&(e.push(this.getOccupantRole()??""),e.push(this.getOccupantAffiliation()??""),"them"===this.model.get("sender")&&this.hasMentions()&&e.push("mentioned")),this.model.get("correcting")&&e.push("correcting"),e.filter((e=>e)).join(" ")}getDerivedMessageProps(){const e=Cl.settings.get("time_format");return{pretty_time:Uv(this.model.get("edited")||this.model.get("time")).format(e),has_mentions:this.hasMentions(),hats:Pv(this.model),is_first_unread:this.chatbox.get("first_unread_id")===this.model.get("id"),is_me_message:this.model.isMeCommand(),is_retracted:this.isRetracted(),username:this.model.getDisplayName(),should_show_avatar:this.shouldShowAvatar()}}getRetractionText(){if("groupchat"===this.model.get("type")&&this.model.get("moderated_by")){const e=this.model.get("moderated_by"),t=this.model.collection.chatbox;this.model.mod||(this.model.mod=t.occupants.findOccupant({jid:e})||t.occupants.findOccupant({nick:Fv.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return vh("%1$s has removed this message",n)}return vh("%1$s has removed this message",this.model.getDisplayName())}renderRetraction(){const e=this.isRetracted()?this.getRetractionText():null;return Qc`
2021-03-19 19:26:15 +01:00
<div>${e}</div>
2021-11-11 22:06:49 +01:00
${this.model.get("moderation_reason")?Qc`<q class="chat-msg--retracted__reason">${this.model.get("moderation_reason")}</q>`:""}
`}renderMessageText(){return(e=>{const t=vh("Show more"),n="groupchat"===e.model.get("type"),s=vh("Show less"),i=Qc`
<div class="chat-msg__spoiler-hint">
<span class="spoiler-hint">${e.model.get("spoiler_hint")}</span>
<a class="badge badge-info spoiler-toggle" href="#" @click=${e.toggleSpoilerMessage}>
<i class="fa ${e.model.get("is_spoiler_visible")?"fa-eye-slash":"fa-eye"}"></i>
${e.model.get("is_spoiler_visible")?s:t}
</a>
</div>
`,r=e.model.get("is_spoiler")?"spoiler "+(e.model.get("is_spoiler_visible")?"":"hidden"):"",o=e.model.getMessageText(),a=e.model.get("oob_url")&&o!==e.model.get("oob_url");return Qc`
${e.model.get("is_spoiler")?i:""}
${e.model.get("subject")?Qc`<div class="chat-msg__subject">${e.model.get("subject")}</div>`:""}
<span>
<converse-chat-message-body
class="chat-msg__text ${e.model.get("is_only_emojis")?"chat-msg__text--larger":""} ${r}"
.model="${e.model}"
?hide_url_previews=${e.model.get("hide_url_previews")}
?is_me_message=${e.model.isMeCommand()}
?show_images=${Cl.settings.get("show_images_inline")}
?embed_videos=${Cl.settings.get("embed_videos")}
?embed_audio=${Cl.settings.get("embed_audio")}
text="${o}"></converse-chat-message-body>
${!e.model.get("received")||e.model.isMeCommand()||n?"":Qc`<span class="fa fa-check chat-msg__receipt"></span>`}
${e.model.get("edited")?(e=>{const t=vh("This message has been edited");return Qc`<converse-icon title="${t}" class="fa fa-edit chat-msg__edit-modal" @click=${e.showMessageVersionsModal} size="1em"></converse-icon>`})(e):""}
</span>
${a?Qc`<div class="chat-msg__media">${Mp(e.model.get("oob_url"))}</div>`:""}
<div class="chat-msg__error">${e.model.get("error_text")||e.model.get("error")}</div>
`})(this)}showUserModal(e){if("me"===this.model.get("sender"))Cl.modal.show(va.ProfileModal,{model:this.model},e);else if("groupchat"===this.model.get("type"))e.preventDefault(),Cl.modal.show(Sv,{model:this.model.occupant},e);else{e.preventDefault();const t=this.model.collection.chatbox;Cl.modal.show(Cv,{model:t},e)}}showMessageVersionsModal(e){e.preventDefault(),Cl.modal.show(yv,{model:this.model},e)}toggleSpoilerMessage(e){null==e||e.preventDefault(),this.model.save({is_spoiler_visible:!this.model.get("is_spoiler_visible")})}}),Cl.elements.define("converse-message-history",class extends Uf{static get properties(){return{model:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?jg(e,(e=>e.get("id")),(e=>Qc`${this.renderMessage(e)}`)):""}renderMessage(e){if(e.get("dangling_retraction")||e.get("is_only_key"))return"";const t=e.get("template_hook");if("string"==typeof t){const n=Cl.hook(t,e,"");return dp(n,"")}{const t=Qc`<converse-chat-message
jid="${this.model.get("jid")}"
mid="${e.get("id")}"></converse-chat-message>`,n=function(e){var t;const n=null===(t=e.collection)||void 0===t?void 0:t.models;if(!n)return;const s=n.indexOf(e),i=n[s-1];if(!i||Dv(e.get("time")).isAfter(Dv(i.get("time")),"day")){const t=Dv(e.get("time")).startOf("day");return(e=>Qc`
<div class="message date-separator" data-isodate="${e.time}">
2021-03-19 19:26:15 +01:00
<hr class="separator"/>
2021-11-11 22:06:49 +01:00
<time class="separator-text" datetime="${e.time}"><span>${e.datestring}</span></time>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
`)({type:"date",time:t.toISOString(),datestring:t.format("dddd MMM Do YYYY")})}}(e);return n?[n,t]:t}}});var Bv=n(8269),qv={};qv.styleTagTransform=eg(),qv.setAttributes=Yf(),qv.insert=Jf().bind(null,"head"),qv.domAPI=Wf(),qv.insertStyleElement=Xf(),Hf()(Bv.Z,qv),Bv.Z&&Bv.Z.locals&&Bv.Z.locals,Cl.elements.define("converse-chat-content",class extends Uf{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.initialize()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("scroll",zv)}async initialize(){await this.setModels(),this.listenTo(this.model,"change:hidden_occupants",this.requestUpdate),this.listenTo(this.model.messages,"add",this.requestUpdate),this.listenTo(this.model.messages,"change",this.requestUpdate),this.listenTo(this.model.messages,"remove",this.requestUpdate),this.listenTo(this.model.messages,"rendered",this.requestUpdate),this.listenTo(this.model.messages,"reset",this.requestUpdate),this.listenTo(this.model.notifications,"change",this.requestUpdate),this.listenTo(this.model.ui,"change",this.requestUpdate),this.listenTo(this.model.ui,"change:scrolled",this.scrollDown),this.model.occupants&&this.listenTo(this.model.occupants,"change",this.requestUpdate),this.addEventListener("scroll",zv)}async setModels(){this.model=await Cl.chatboxes.get(this.jid),await this.model.initialized,this.requestUpdate()}render(){var e;return this.model?Qc`
<div class="chat-content__notifications">${this.model.getNotificationsText()}</div>
2021-03-19 19:26:15 +01:00
<converse-message-history
2021-11-11 22:06:49 +01:00
.model=${this.model}
.messages=${[...this.model.messages.models]}>
2021-03-19 19:26:15 +01:00
</converse-message-history>
2021-11-11 22:06:49 +01:00
${null!==(e=this.model.ui)&&void 0!==e&&e.get("chat-content-spinner-top")?Qc`<span class="spinner fa fa-spinner centered"></span>`:""}
`:""}scrollDown(){if(!this.model.ui.get("scrolled")){if(this.scrollTo){const e=this.scrollTop?"smooth":"auto";this.scrollTo({top:0,behavior:e})}else this.scrollTop=0;Cl.trigger("chatBoxScrolledDown",{chatbox:this.model})}}});class Hv extends wg{constructor(e){if(super(e),this.vt=Zc,2!==e.type)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Zc)return this.Vt=void 0,this.vt=e;if(e===Xc)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.vt)return this.Vt;this.vt=e;const t=[e];return t.raw=t,this.Vt={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Hv.directiveName="unsafeHTML",Hv.resultType=1;const Gv=_g(Hv);Cl.elements.define("converse-chat-help",class extends Uf{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[Qc`<converse-icon class="fas fa-times close-chat-help"
2021-03-19 19:26:15 +01:00
@click=${this.close}
2021-11-11 22:06:49 +01:00
path-prefix="${Cl.settings.get("assets_path")}"
size="1em"></converse-icon>`,...this.messages.map((t=>this.renderHelpMessage({isodate:e,markup:No().sanitize(t,{ALLOWED_TAGS:["strong"]})})))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return Qc`<div class="message chat-${this.type}" data-isodate="${e.isodate}">${Gv(e.markup)}</div>`}});const Wv=jl.env.utils,Vv=e=>Qc`
2021-03-19 19:26:15 +01:00
<li class="emoji insert-emoji ${e.shouldBeHidden(e.emoji.sn)?"hidden":""}" data-emoji="${e.emoji.sn}" title="${e.emoji.sn}">
2021-11-11 22:06:49 +01:00
<a href="#" @click=${e.insertEmoji} data-emoji="${e.emoji.sn}">${Wv.shortnamesToEmojis(e.emoji.sn)}</a>
2021-03-19 19:26:15 +01:00
</li>
2021-11-11 22:06:49 +01:00
`,Jv=e=>{const t=vh("Search");return Qc`
2021-03-19 19:26:15 +01:00
<div class="emoji-picker__header">
<input class="form-control emoji-search" name="emoji-search" placeholder="${t}"
.value=${e.query||""}
@keydown=${e.onSearchInputKeyDown}
@blur=${e.onSearchInputBlurred}
@focus=${e.onSearchInputFocus}>
2021-11-11 22:06:49 +01:00
${e.query?"":(e=>{const t=Cl.settings.get("emoji_categories");return Qc`<ul>${Object.keys(t).map((n=>t[n]?(e=>Qc`
<li data-category="${e.category}"
class="emoji-category ${e.category} ${e.current_category===e.category?"picked":""}"
title="${vh(Cl.settings.get("emoji_category_labels")[e.category])}">
<a class="pick-category"
@click=${e.onCategoryPicked}
href="#emoji-picker-${e.category}"
data-category="${e.category}">${e.emoji} </a>
</li>
`)(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):""))}</ul>`})(e)}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
${e.render_emojis?Qc`<converse-emoji-picker-content
2021-03-19 19:26:15 +01:00
.chatview=${e.chatview}
.model=${e.model}
.search_results="${e.search_results}"
current_skintone="${e.current_skintone}"
query="${e.query}"></converse-emoji-picker-content>`:""}
<div class="emoji-skintone-picker">
<label>Skin tone</label>
2021-11-11 22:06:49 +01:00
<ul>${["tone1","tone2","tone3","tone4","tone5"].map((t=>(e=>Qc`
2021-03-19 19:26:15 +01:00
<li data-skintone="${e.skintone}" class="emoji-skintone ${e.current_skintone===e.skintone?"picked":""}">
2021-11-11 22:06:49 +01:00
<a class="pick-skintone" href="#" data-skintone="${e.skintone}" @click=${e.onSkintonePicked}>${Wv.shortnamesToEmojis(":"+e.skintone+":")}</a>
</li>`)(Object.assign({skintone:t},e))))}</ul>
</div>`},{sizzle:Kv}=jl.env;Cl.elements.define("converse-emoji-picker-content",class extends Uf{static get properties(){return{chatview:{type:Object},search_results:{type:Array},current_skintone:{type:String},model:{type:Object},query:{type:String}}}render(){const e={current_skintone:this.current_skintone,insertEmoji:e=>this.insertEmoji(e),query:this.query,search_results:this.search_results,shouldBeHidden:e=>this.shouldBeHidden(e)};return Qc`
2021-03-19 19:26:15 +01:00
<div class="emoji-picker__lists">
2021-11-11 22:06:49 +01:00
${(e=>{const t=vh("Search results");return Qc`
2021-03-19 19:26:15 +01:00
<span ?hidden=${!e.query} class="emoji-lists__container emojis-lists__container--search">
<a id="emoji-picker-search-results" class="emoji-category__heading">${t}</a>
<ul class="emoji-picker">
2021-11-11 22:06:49 +01:00
${e.search_results.map((t=>Vv(Object.assign({emoji:t},e))))}
2021-03-19 19:26:15 +01:00
</ul>
</span>
`})(e)}
2021-11-11 22:06:49 +01:00
${(e=>{const t=Cl.settings.get("emoji_categories");return Qc`
<span ?hidden=${e.query} class="emoji-lists__container emoji-lists__container--browse">
${Object.keys(t).map((n=>t[n]?(e=>Qc`
<a id="emoji-picker-${e.category}" class="emoji-category__heading" data-category="${e.category}">${vh(Cl.settings.get("emoji_category_labels")[e.category])}</a>
<ul class="emoji-picker" data-category="${e.category}">
${Object.values(jl.emojis.json[e.category]).map((t=>Vv(Object.assign({emoji:t},e))))}
</ul>`)(Object.assign({category:n},e)):""))}
</span>`})(e)}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
`}firstUpdated(){this.initIntersectionObserver()}initIntersectionObserver(){if(window.IntersectionObserver){if(this.observer)this.observer.disconnect();else{const e={root:this.querySelector(".emoji-picker__lists"),threshold:[.1]},t=e=>this.setCategoryOnVisibilityChange(e);this.observer=new IntersectionObserver(t,e)}Kv(".emoji-picker",this).forEach((e=>this.observer.observe(e)))}}setCategoryOnVisibilityChange(e){const t=this.parentElement.navigator.selected;let n;if(n=e.filter((e=>e.target.contains(t))).pop()||e.reduce(((e,t)=>t.intersectionRatio>=((null==e?void 0:e.intersectionRatio)||0)?t:e),null),n&&n.isIntersecting){const e=n.target.getAttribute("data-category");e!==this.model.get("current_category")&&(this.parentElement.preserve_scroll=!0,this.model.save({current_category:e}))}}insertEmoji(e){e.preventDefault(),e.stopPropagation();const t="IMG"===e.target.nodeName?e.target.parentElement:e.target;this.parentElement.insertIntoTextArea(t.getAttribute("data-emoji"))}shouldBeHidden(e){if(e.includes("_tone")){if(!this.current_skintone||!e.includes(this.current_skintone))return!0}else if(this.current_skintone&&jl.emojis.toned.includes(e))return!0;return!(!this.query||va.FILTER_CONTAINS(e,this.query))}});const Yv=jl.env.utils;Cl.elements.define("converse-emoji-dropdown",class extends vv{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await Cl.emojis.initialize();const e=`converse.emoji-${va.bare_jid}-${this.chatview.model.get("jid")}`;this.model=new va.EmojiPicker({id:e}),_o(this.model,e),await new Promise((e=>this.model.fetch({success:e,error:e}))),this.model.set({autocompleting:null,ac_position:null})})()),this.init_promise}render(){return Qc`
2021-03-19 19:26:15 +01:00
<div class="dropup">
<button class="toggle-emojis"
2021-11-11 22:06:49 +01:00
title="${vh("Insert emojis")}"
2021-03-19 19:26:15 +01:00
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<converse-icon
class="fa fa-smile "
2021-11-11 22:06:49 +01:00
path-prefix="${Cl.settings.get("assets_path")}"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
</button>
<div class="dropdown-menu">
2021-11-11 22:06:49 +01:00
${dp(this.initModel().then((()=>Qc`
2021-03-19 19:26:15 +01:00
<converse-emoji-picker
.chatview=${this.chatview}
.model=${this.model}
?render_emojis=${this.render_emojis}
current_category="${this.model.get("current_category")||""}"
current_skintone="${this.model.get("current_skintone")||""}"
query="${this.model.get("query")||""}"
2021-11-11 22:06:49 +01:00
></converse-emoji-picker>`)),"")}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>`}connectedCallback(){super.connectedCallback(),this.render_emojis=!1}toggleMenu(e){e.stopPropagation(),e.preventDefault(),Yv.hasClass("show",this.menu)?Yv.ancestor(e.target,".toggle-emojis")&&this.hideMenu():this.showMenu()}async showMenu(){await this.initModel(),this.render_emojis||(this.render_emojis=!0,await this.requestUpdate()),super.showMenu(),setTimeout((()=>{var e;return null===(e=this.querySelector(".emoji-search"))||void 0===e?void 0:e.focus()}))}});var Qv=n(9796),Xv={};Xv.styleTagTransform=eg(),Xv.setAttributes=Yf(),Xv.insert=Jf().bind(null,"head"),Xv.domAPI=Wf(),Xv.insertStyleElement=Xf(),Hf()(Qv.Z,Xv),Qv.Z&&Qv.Z.locals&&Qv.Z.locals;const Zv=jl.env.utils;Cl.elements.define("converse-emoji-picker",class extends Uf{static get properties(){return{chatview:{type:Object},current_category:{type:String,reflect:!0},current_skintone:{type:String,reflect:!0},model:{type:Object},query:{type:String,reflet:!0},render_emojis:{type:Boolean}}}firstUpdated(){super.firstUpdated(),this.listenTo(this.model,"change",(e=>this.onModelChanged(e.changed))),this.initArrowNavigation()}constructor(){super(),this._search_results=[],this.debouncedFilter=hc((e=>this.model.set({query:e.value})),250)}get search_results(){return this._search_results}set search_results(e){this._search_results=e,this.requestUpdate()}render(){return Jv({chatview:this.chatview,current_category:this.current_category,current_skintone:this.current_skintone,model:this.model,onCategoryPicked:e=>this.chooseCategory(e),onSearchInputBlurred:e=>this.chatview.emitFocused(e),onSearchInputFocus:e=>this.onSearchInputFocus(e),onSearchInputKeyDown:e=>this.onKeyDown(e),onSkintonePicked:e=>this.chooseSkinTone(e),query:this.query,search_results:this.search_results,render_emojis:this.render_emojis,sn2Emoji:e=>Zv.shortnamesToEmojis(this.getTonedShortname(e))})}updated(e){e.has("query")&&this.updateSearchResults(e),e.has("current_category")&&this.setScrollPosition()}onModelChanged(e){"current_category"in e&&(this.current_category=e.current_category),"current_skintone"in e&&(this.current_skintone=e.current_skintone),"query"in e&&(this.query=e.query)}setScrollPosition(){if(this.preserve_scroll)return void(this.preserve_scroll=!1);const e=this.querySelector(".emoji-lists__container--browse"),t=this.querySelector(`#emoji-picker-${this.current_category}`);t&&(e.scrollTop=t.offsetTop-3*t.offsetHeight+4)}updateSearchResults(e){const t=e.get("query"),n=va.FILTER_CONTAINS;if(this.query){if(this.query===t)return this.search_results;t&&this.query.includes(t)?this.search_results=this.search_results.filter((e=>n(e.sn,this.query))):this.search_results=jl.emojis.list.filter((e=>n(e.sn,this.query)))}else this.search_results.length&&(this.search_results=[]);this.requestUpdate()}registerEvents(){this.onGlobalKeyDown=e=>this._onGlobalKeyDown(e),document.querySelector("body").addEventListener("keydown",this.onGlobalKeyDown)}connectedCallback(){super.connectedCallback(),this.registerEvents()}disconnectedCallback(){document.querySelector("body").removeEventListener("keydown",this.onGlobalKeyDown),super.disconnectedCallback()}_onGlobalKeyDown(e){this.navigator&&(e.keyCode===jl.keycodes.ENTER&&this.navigator.selected&&Zv.isVisible(this)?this.onEnterPressed(e):e.keyCode===jl.keycodes.DOWN_ARROW&&!this.navigator.enabled&&Zv.isVisible(this)&&this.enableArrowNavigation(e))}setCategoryForElement(e){const t=this.current_category,n=(null==e?void 0:e.getAttribute("data-category"))||t;t!==n&&this.model.save({current_category:n})}insertIntoTextArea(e){const t=this.model.get("autocompleting"),n=this.model.get("ac_position");this.chatview.getMessageForm().insertIntoTextArea(e,t,!1,n),this.model.set({autocompleting:null,query:"",ac_position:null})}chooseSkinTone(e){e.preventDefault(),e.stopPropagation();const t=("IMG"===e.target.nodeName?e.target.parentElement:e.target).getAttribute("data-skintone").trim();this.current_skintone===t?this.model.save({current_skintone:""}):this.model.save({current_skintone:t})}chooseCategory(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation();
<a href="#" class="dropdown-item ${t.a_class}" @click=${t.handler} title="${t.i18n_title}">
<converse-icon size="1em" color="var(--text-color-lighten-15-percent)" class="fa ${t.icon_class}"></converse-icon>
${t.i18n_text}
</a>
`}async function ib(e){const t=await e;return Qc`
<a
href="#"
class="chatbox-btn ${t.a_class} fa ${t.icon_class}"
@click=${t.handler}
title="${t.i18n_title}"
></a>
`}async function rb(e){!0===confirm(vh("Are you sure you want to clear the messages from this conversation?"))&&await e.clearMessages()}function ob(e,t){const n=t.replace(/^\s*/,"").match(/^\/(.*)\s*$/);if(n){if("clear"===n[1])return rb(e),!0;var s;if("close"===n[1])return null===(s=va.chatboxviews.get(e.get("jid")))||void 0===s||s.close(),!0;if("help"===n[1])return e.set({show_help_messages:!1},{silent:!0}),e.set({show_help_messages:!0}),!0}}function ab(e){if(e.target.value){const t=e.target.scrollHeight+"px";e.target.style.height!=t&&(e.target.style.height="auto",e.target.style.height=t)}else e.target.style=""}window.customElements.define("converse-chat-toolbar",class extends Uf{static get properties(){return{composing_spoiler:{type:Boolean},hidden_occupants:{type:Boolean},is_groupchat:{type:Boolean},message_limit:{type:Number},model:{type:Object},show_call_button:{type:Boolean},show_emoji_button:{type:Boolean},show_send_button:{type:Boolean},show_spoiler_button:{type:Boolean}}}connectedCallback(){super.connectedCallback(),this.listenTo(this.model,"change:composing_spoiler",this.requestUpdate)}render(){const e=vh("Send the message");return Qc`
<span class="toolbar-buttons">${dp(this.getButtons(),"")}</span>
${this.show_send_button?Qc`<button type="submit" class="btn send-button fa fa-paper-plane" title="${e}"></button>`:""}
`}firstUpdated(){Cl.trigger("renderToolbar",this)}getButtons(){var e;const t=[];if(this.show_emoji_button){const e=va.chatboxviews.get(this.model.get("jid"));t.push(Qc`<converse-emoji-dropdown .chatview=${e}></converse-emoji-dropdown>`)}if(this.show_call_button){const e=vh("Start a call");t.push(Qc`
<button class="toggle-call" @click=${this.toggleCall} title="${e}">
2021-03-19 19:26:15 +01:00
<converse-icon class="fa fa-phone" path-prefix="/dist" size="1em"></converse-icon>
2021-11-11 22:06:49 +01:00
</button>`)}Cl.settings.get("message_limit")&&t.push(Qc`
<converse-message-limit-indicator .model=${this.model} class="right">
</converse-message-limit-indicator>`),this.show_spoiler_button&&t.push(this.getSpoilerButton());const n=Cl.disco.supports(nb.NS.HTTPUPLOAD,va.domain);if(t.push(Qc`${dp(n.then((e=>this.getHTTPUploadButton(e))),"")}`),this.is_groupchat&&null!==(e=Cl.settings.get("visible_toolbar_buttons"))&&void 0!==e&&e.toggle_occupants){const e=vh("Hide participants"),n=vh("Show participants");t.push(Qc`
2021-03-19 19:26:15 +01:00
<button class="toggle_occupants right"
2021-11-11 22:06:49 +01:00
title="${this.hidden_occupants?n:e}"
2021-03-19 19:26:15 +01:00
@click=${this.toggleOccupants}>
<converse-icon class="fa ${this.hidden_occupants?"fa-angle-double-left":"fa-angle-double-right"}"
2021-11-11 22:06:49 +01:00
path-prefix="${Cl.settings.get("assets_path")}" size="1em"></converse-icon>
</button>`)}return va.api.hook("getToolbarButtons",this,t)}getHTTPUploadButton(e){if(e){const e=vh("Choose a file to send");return Qc`
2021-03-19 19:26:15 +01:00
<button title="${e}" @click=${this.toggleFileUpload}>
<converse-icon class="fa fa-paperclip"
2021-11-11 22:06:49 +01:00
path-prefix="${Cl.settings.get("assets_path")}"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
</button>
2021-11-11 22:06:49 +01:00
<input type="file" @change=${this.onFileSelection} class="fileupload" multiple="" style="display:none"/>`}return""}getSpoilerButton(){var e;const t=this.model;if(!(this.is_groupchat||null!==(e=t.presence)&&void 0!==e&&e.resources.length))return;let n;n=this.composing_spoiler?vh("Click to write as a normal (non-spoiler) message"):vh("Click to write your message as a spoiler");const s=Qc`
2021-03-19 19:26:15 +01:00
<button class="toggle-compose-spoiler"
2021-11-11 22:06:49 +01:00
title="${n}"
2021-03-19 19:26:15 +01:00
@click=${this.toggleComposeSpoilerMessage}>
<converse-icon class="fa ${this.composing_spoiler?"fa-eye-slash":"fa-eye"}"
2021-11-11 22:06:49 +01:00
path-prefix="${Cl.settings.get("assets_path")}"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
2021-11-11 22:06:49 +01:00
</button>`;if(this.is_groupchat)return s;{const e=t.get("jid"),n=Promise.all(t.presence.resources.map((t=>Cl.disco.supports(nb.NS.SPOILER,`${e}/${t.get("name")}`)))).then((e=>e.reduce(((e,t)=>e&&t),!0)));return Qc`${dp(n.then((()=>s)),"")}`}}toggleFileUpload(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.querySelector(".fileupload").click()}onFileSelection(e){this.model.sendFiles(e.target.files)}toggleComposeSpoilerMessage(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.set("composing_spoiler",!this.model.get("composing_spoiler"))}toggleOccupants(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.save({hidden_occupants:!this.model.get("hidden_occupants")})}toggleCall(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),Cl.trigger("callButtonClicked",{connection:va.connection,model:this.model})}});var cb=n(6220),lb={};lb.styleTagTransform=eg(),lb.setAttributes=Yf(),lb.insert=Jf().bind(null,"head"),lb.domAPI=Wf(),lb.insertStyleElement=Xf(),Hf()(cb.Z,lb),cb.Z&&cb.Z.locals&&cb.Z.locals,Cl.elements.define("converse-chat-heading",class extends Uf{connectedCallback(){super.connectedCallback(),this.initialize()}initialize(){var e;this.model=va.chatboxes.get(this.getAttribute("jid")),this.listenTo(this.model,"change:status",this.requestUpdate),this.listenTo(this.model,"vcard:change",this.requestUpdate),this.model.contact&&this.listenTo(this.model.contact,"destroy",this.requestUpdate),null===(e=this.model.rosterContactAdded)||void 0===e||e.then((()=>{this.listenTo(this.model.contact,"change:nickname",this.requestUpdate),this.requestUpdate()}))}render(){return(e=>{var t;const n=null===(t=e.model)||void 0===t?void 0:t.vcard,s=n?n.toJSON():{},i=vh("The User's Profile Image"),r=Object.assign({alt_text:i,extra_classes:"",height:40,width:40},s),o=Qc`<span class="mr-2">${_v(r)}</span>`,a=e.model.getDisplayName();return Qc`
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
${va.api.settings.get("singleton")?"":Qc`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
${e.type!==va.HEADLINES_TYPE?Qc`<a class="show-msg-author-modal" @click=${e.showUserDetailsModal}>${o}</a>`:""}
<div class="chatbox-title__text" title="${e.jid}">
${e.type!==va.HEADLINES_TYPE?Qc`<a class="user show-msg-author-modal" @click=${e.showUserDetailsModal}>${a}</a>`:a}
</div>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="chatbox-title__buttons row no-gutters">
${dp(async function(e){return(await e).filter((e=>!e.standalone)).map((e=>sb(e)))}(e.heading_buttons_promise).then((e=>e.length?Qc`<converse-dropdown class="dropleft" color="var(--chat-head-text-color)" .items=${e}></converse-dropdown>`:"")),"")}
${dp(async function(e){return(await e).filter((e=>e.standalone)).map((e=>ib(e)))}(e.heading_buttons_promise).then((e=>e.reverse().map((e=>dp(e,""))))),"")}
2021-03-19 19:26:15 +01:00
</div>
</div>
2021-11-11 22:06:49 +01:00
${e.status?Qc`<p class="chat-head__desc">${e.status}</p>`:""}
`})(Object.assign(this.model.toJSON(),{heading_buttons_promise:this.getHeadingButtons(),model:this.model,showUserDetailsModal:e=>this.showUserDetailsModal(e)}))}showUserDetailsModal(e){e.preventDefault(),Cl.modal.show(Cv,{model:this.model},e)}close(e){e.preventDefault(),this.model.close()}getHeadingButtons(){const e=[{a_class:"show-user-details-modal",handler:e=>this.showUserDetailsModal(e),i18n_text:vh("Details"),i18n_title:vh("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===Cl.settings.get("view_mode")}];Cl.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:vh("Close"),i18n_title:vh("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Cl.settings.get("view_mode")});const t=va.chatboxviews.get(this.getAttribute("jid"));return t?va.api.hook("getHeadingButtons",t,e):e}});const{u:db}=jl.env;class ub extends mg{async connectedCallback(){super.connectedCallback(),this.model=va.chatboxes.get(this.getAttribute("jid")),await this.model.initialized,this.listenTo(this.model.messages,"change:correcting",this.onMessageCorrecting),this.render()}toHTML(){var e,t;return(e=>{const t=e.composing_spoiler?vh("Hidden message"):vh("Message"),n=vh("Optional hint"),s=Cl.settings.get("show_send_button");return Qc`
<form class="sendXMPPMessage">
<input type="text" placeholder="${n||""}" value="${e.hint_value||""}" class="${e.composing_spoiler?"":"hidden"} spoiler-hint"/>
<textarea
autofocus
type="text"
@drop=${e.onDrop}
@input=${ab}
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea
${s?"chat-textarea-send-button":""}
${e.composing_spoiler?"spoiler":""}"
placeholder="${t}">${e.message_value||""}</textarea>
</form>`})(Object.assign(this.model.toJSON(),{onDrop:e=>this.onDrop(e),hint_value:null===(e=this.querySelector(".spoiler-hint"))||void 0===e?void 0:e.value,message_value:null===(t=this.querySelector(".chat-textarea"))||void 0===t?void 0:t.value,onChange:e=>this.model.set({draft:e.target.value}),onKeyDown:e=>this.onKeyDown(e),onKeyUp:e=>this.onKeyUp(e),onPaste:e=>this.onPaste(e),viewUnreadMessages:e=>this.viewUnreadMessages(e)}))}insertIntoTextArea(e,t=!1,n=!1,s){const i=this.querySelector(".chat-textarea");if(n?db.addClass("correcting",i):db.removeClass("correcting",i),t)i.value=s&&"string"==typeof t?i.value.replace(new RegExp(t,"g"),((n,i)=>i==s-t.length?e+" ":n)):e;else{let t=i.value;t&&" "!==t[t.length-1]&&(t+=" "),i.value=t+e+" "}const r=document.createEvent("HTMLEvents");r.initEvent("change",!1,!0),i.dispatchEvent(r),db.placeCaretAtEnd(i)}onMessageCorrecting(e){if(e.get("correcting"))this.insertIntoTextArea(db.prefixMentions(e),!0,!0);else{const t=this.model.messages.findWhere("correcting");t&&t!==e?this.insertIntoTextArea(db.prefixMentions(e),!0,!0):this.insertIntoTextArea("",!0,!1)}}onEscapePressed(e){e.preventDefault();const t=this.model.messages.findLastIndex("correcting"),n=t>=0?this.model.messages.at(t):null;n&&n.save("correcting",!1),this.insertIntoTextArea("",!0,!1)}onPaste(e){if(e.stopPropagation(),0!==e.clipboardData.files.length)return e.preventDefault(),void this.model.sendFiles(Array.from(e.clipboardData.files));this.model.set({draft:e.clipboardData.getData("text/plain")})}onKeyUp(e){this.model.set({draft:e.target.value})}onKeyDown(e){if(!e.ctrlKey){if(!e.shiftKey&&!e.altKey&&!e.metaKey)if(e.keyCode===jl.keycodes.TAB){const t=db.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&(e.preventDefault(),e.stopPropagation(),this.model.trigger("emoji-picker-autocomplete",e.target,t))}else{if(e.keyCode===jl.keycodes.FORWARD_SLASH)return;if(e.keyCode===jl.keycodes.ESCAPE)return this.onEscapePressed(e,this);if(e.keyCode===jl.keycodes.ENTER)return this.onFormSubmitted(e);if(e.keyCode!==jl.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===jl.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&db.hasClass("correcting",this.querySelector(".chat-textarea")))return this.model.editLaterMessage()}else{const e=this.querySelector(".chat-textarea");if(!e.value||db.hasClass("correcting",e))return this.model.editEarlierMessage()}}[jl.keycodes.SHIFT,jl.keycodes.META,jl.keycodes.META_RIGHT,jl.keycodes.ESCAPE,jl.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==va.COMPOSING&&this.model.setChatState(va.COMPOSING)}}parseMessageForCommands(e){return ob(this.model,e)}async onFormSubmitted(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const s=this.querySelector(".chat-textarea"),i=s.value.trim();if(Cl.settings.get("message_limit")&&i.length>Cl.settings.get("message_limit")||!i.replace(/\s/g,"").length)return;if(!va.connection.authenticated){const e=vh("Sorry, the connection has been lost, and your message could not be sent");return Cl.alert("error",vh("Error"),e),void Cl.connection.reconnect()}let r,o={};this.model.get("composing_spoiler")&&(o=this.querySelector("form.sendXMPPMessage input.spoiler-hint"),r=o.value),db.addClass("disabled",s),s.setAttribute("disabled","disabled"),null===(n=this.querySelector("converse-emoji-dropdown"))||void 0===n||n.hideMenu();const a=this.parseMessageForCommands(i),c=a?null:await this.model.sendMessage({body:i,spoiler_hint:r});(a||c)&&(o.value="",s.value="",db.removeClass("correcting",s),s.style.height="auto",this.model.set({draft:""})),"overlayed"===Cl.settings.get("view_mode")&&(va.chatboxviews.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display="none"),s.removeAttribute("disabled"),db.removeClass("disabled",s),"overlayed"===Cl.settings.get("view_mode")&&(va.chatboxviews.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display=""),this.model.setChatState(va.ACTIVE,{silent:!0}),s.focus()}}Cl.elements.define("converse-message-form",
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?Qc`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${Cl.settings.get("show_toolbar")?Qc`
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?composing_spoiler="${e.model.get("composing_spoiler")}"
?show_call_button="${s}"
?show_emoji_button="${i}"
?show_send_button="${r}"
?show_spoiler_button="${o}"
?show_toolbar="${a}"
message_limit="${n}"></converse-chat-toolbar>`:""}
<converse-message-form jid="${e.model.get("jid")}"></converse-message-form>
`})({model:this.model,viewUnreadMessages:e=>this.viewUnreadMessages(e)}),this)}sendButtonClicked(e){var t;null===(t=this.querySelector("converse-message-form"))||void 0===t||t.onFormSubmitted(e)}viewUnreadMessages(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.ui.set({scrolled:!1})}emitFocused(e){var t;null===(t=va.chatboxviews.get(this.getAttribute("jid")))||void 0===t||t.emitFocused(e)}emitBlurred(e){var t;null===(t=va.chatboxviews.get(this.getAttribute("jid")))||void 0===t||t.emitBlurred(e)}onDrop(e){0!=e.dataTransfer.files.length&&(e.preventDefault(),this.model.sendFiles(e.dataTransfer.files))}onDragOver(e){e.preventDefault()}clearMessages(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),rb(this.model)}async autocompleteInPicker(e,t){await Cl.emojis.initialize();const n=this.querySelector("converse-emoji-picker");if(n){n.model.set({ac_position:e.selectionStart,autocompleting:t,query:t});const s=this.querySelector("converse-emoji-dropdown");null==s||s.showMenu()}}}Cl.elements.define("converse-chat-bottom-panel",fb);class gb extends Uf{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),va.chatboxviews.remove(this.jid,this)}updated(){this.model&&this.jid!==this.model.get("jid")&&(this.stopListening(),va.chatboxviews.remove(this.model.get("jid"),this),delete this.model,this.requestUpdate(),this.initialize())}close(e){var t;return null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.close(e)}maybeFocus(){Cl.settings.get("auto_focus")&&this.focus()}focus(){const e=this.getElementsByClassName("chat-textarea")[0];return e&&document.activeElement!==e&&e.focus(),this}emitBlurred(e){this.contains(document.activeElement)||this.contains(e.relatedTarget)||Cl.trigger("chatBoxBlurred",this,e)}emitFocused(e){this.contains(e.relatedTarget)||Cl.trigger("chatBoxFocused",this,e)}getBottomPanel(){return this.model.get("type")===va.CHATROOMS_TYPE?this.querySelector("converse-muc-bottom-panel"):this.querySelector("converse-chat-bottom-panel")}getMessageForm(){return this.model.get("type")===va.CHATROOMS_TYPE?this.querySelector("converse-muc-message-form"):this.querySelector("converse-message-form")}scrollDown(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.ui.get("scrolled")&&this.model.ui.set({scrolled:!1}),Lv(this.model)}onWindowStateChanged(e){"visible"===e.state?this.model.isHidden()||this.model.clearUnreadMsgCounter():"hidden"===e.state&&(this.model.setChatState(va.INACTIVE,{silent:!0}),this.model.sendChatState())}}class pb extends gb{constructor(...e){var t,n;super(...e),(n="length")in(t=this)?Object.defineProperty(t,n,{value:200,enumerable:!0,configurable:!0,writable:!0}):t[n]=200}connectedCallback(){super.connectedCallback(),this.initialize()}async initialize(){va.chatboxviews.add(this.jid,this),this.model=va.chatboxes.get(this.jid),this.listenTo(va,"windowStateChanged",this.onWindowStateChanged),this.listenTo(this.model,"change:hidden",(()=>!this.model.get("hidden")&&this.afterShown())),this.listenTo(this.model,"change:show_help_messages",this.requestUpdate),await this.model.messages.fetched,!this.model.get("hidden")&&this.afterShown(),Cl.trigger("chatBoxViewInitialized",this)}render(){return(e=>Qc`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e.model?Qc`
<converse-chat-heading jid="${e.jid}" class="chat-head chat-head-chatbox row no-gutters"></converse-chat-heading>
<div class="chat-body">
<div class="chat-content ${e.show_send_button?"chat-content-sendbutton":""}" aria-live="polite">
<converse-chat-content
class="chat-content__messages"
jid="${e.jid}"></converse-chat-content>
2021-03-19 19:26:15 +01:00
2021-11-11 22:06:49 +01:00
${e.show_help_messages?Qc`<div class="chat-content__help">
<converse-chat-help
.model=${e.model}
.messages=${e.help_messages}
?hidden=${!e.show_help_messages}
type="info"
chat_type="${va.CHATROOMS_TYPE}"
></converse-chat-help></div>`:""}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<converse-chat-bottom-panel jid="${e.jid}" class="bottom-panel"> </converse-chat-bottom-panel>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
`:""}
</div>
`)(Object.assign({model:this.model,help_messages:this.getHelpMessages(),show_help_messages:this.model.get("show_help_messages")},this.model.toJSON()))}getHelpMessages(){return[`<strong>/clear</strong>: ${vh("Remove messages")}`,`<strong>/close</strong>: ${vh("Close this chat")}`,`<strong>/me</strong>: ${vh("Write in the third person")}`,`<strong>/help</strong>: ${vh("Show this menu")}`]}showControlBox(){var e;null===(e=va.chatboxviews.get("controlbox"))||void 0===e||e.show()}afterShown(){this.model.setChatState(va.ACTIVE),this.model.clearUnreadMsgCounter(),this.maybeFocus()}}Cl.elements.define("converse-chat",pb);var vb=n(9107),bb={};bb.styleTagTransform=eg(),bb.setAttributes=Yf(),bb.insert=Jf().bind(null,"head"),bb.domAPI=Wf(),bb.insertStyleElement=Xf(),Hf()(vb.Z,bb),vb.Z&&vb.Z.locals&&vb.Z.locals;const{Strophe:yb}=jl.env;jl.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){Cl.settings.extend({auto_focus:!0,debounced_content_rendering:!0,embed_videos:!0,embed_audio:!0,filter_url_query_params:null,image_urls_regex:null,message_limit:0,muc_hats:["xep317"],show_images_inline:!0,show_message_avatar:!0,show_retraction_warning:!0,show_send_button:!0,show_toolbar:!0,time_format:"HH:mm",use_system_emojis:!0,visible_toolbar_buttons:{call:!1,clear:!0,emoji:!0,spoiler:!0}}),va.ChatBoxView=pb,Cl.listen.on("connected",(()=>Cl.disco.own.features.add(yb.NS.SPOILER))),Cl.listen.on("chatBoxClosed",(e=>{return t=e.get("jid"),void(va.router.history.getFragment()===`converse/chat?jid=${t}`&&va.router.navigate(""));var t}))}}),Cl.elements.define("converse-brand-byline",class extends Uf{render(){const e="fullscreen"===Cl.settings.get("view_mode");return Qc`
${e?Qc`
<p class="brand-subtitle">${va.VERSION_NAME}</p>
<p class="brand-subtitle">
<a target="_blank" rel="nofollow" href="https://conversejs.org">Open Source</a> XMPP chat client
brought to you by <a target="_blank" rel="nofollow" href="https://opkode.com">Opkode</a>
</p>
<p class="brand-subtitle">
<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages"
>Translate</a
>
it into your own language
</p>
`:""}
`}}),Cl.elements.define("converse-brand-logo",class extends Uf{render(){const e="fullscreen"===Cl.settings.get("view_mode");return Qc`
<a class="brand-heading" href="https://conversejs.org" target="_blank" rel="noopener">
<span class="brand-name-wrapper ${e?"brand-name-wrapper--fullscreen":""}">
<svg
class="converse-svg-logo"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 364 364">
2021-03-19 19:26:15 +01:00
2021-11-11 22:06:49 +01:00
<title>Converse</title>
<g class="cls-1" id="g904">
<g data-name="Layer 2">
<g data-name="Layer 7">
<path
class="cls-3"
d="M221.46,103.71c0,18.83-29.36,18.83-29.12,0C192.1,84.88,221.46,84.88,221.46,103.71Z"
/>
<path
class="cls-4"
d="M179.9,4.15A175.48,175.48,0,1,0,355.38,179.63,175.48,175.48,0,0,0,179.9,4.15Zm-40.79,264.5c-.23-17.82,27.58-17.82,27.58,0S138.88,286.48,139.11,268.65ZM218.6,168.24A79.65,79.65,0,0,1,205.15,174a12.76,12.76,0,0,0-6.29,4.65L167.54,222a1.36,1.36,0,0,1-2.46-.8v-35.8a2.58,2.58,0,0,0-3.06-2.53c-15.43,3-30.23,7.7-42.73,19.94-38.8,38-29.42,105.69,16.09,133.16a162.25,162.25,0,0,1-91.47-67.27C-3.86,182.26,34.5,47.25,138.37,25.66c46.89-9.75,118.25,5.16,123.73,62.83C265.15,120.64,246.56,152.89,218.6,168.24Z"
/>
</g>
2021-03-19 19:26:15 +01:00
</g>
</g>
2021-11-11 22:06:49 +01:00
</svg>
<span class="brand-name">
<span class="brand-name__text">converse<span class="subdued">.js</span></span>
${e?Qc`
<p class="byline">messaging freedom</p>
`:""}
</span>
2021-03-19 19:26:15 +01:00
</span>
2021-11-11 22:06:49 +01:00
</a>
`}}),Cl.elements.define("converse-brand-heading",class extends Uf{render(){return Qc`
<converse-brand-logo></converse-brand-logo>
<converse-brand-byline></converse-brand-byline>
`}});const _b=e=>Qc`
<converse-brand-heading></converse-brand-heading>
<form id="converse-login" class="converse-form" method="post">
<div class="conn-feedback fade-in ${e.conn_feedback_subject?e.conn_feedback_class:"hidden"}">
<p class="feedback-subject">${e.conn_feedback_subject}</p>
<p class="feedback-message ${e.conn_feedback_message?"":"hidden"}">${e.conn_feedback_message}</p>
</div>
${"CONNECTING"===va.CONNECTION_STATUS[e.connection_status]?Iv({classes:"hor_centered"}):(e=>{const t=vh("Disconnected"),n=vh("Click here to log in anonymously");return Qc`
${e.authentication==e.LOGIN||e.authentication==e.EXTERNAL?(e=>{const t=vh("Log in"),n=vh("XMPP Address");return Qc`
2021-03-19 19:26:15 +01:00
<div class="form-group">
<label for="converse-login-jid">${n}:</label>
<input id="converse-login-jid"
2021-11-11 22:06:49 +01:00
?autofocus=${!!Cl.settings.get("auto_focus")}
2021-03-19 19:26:15 +01:00
required
class="form-control"
type="text"
name="jid"
placeholder="${e.placeholder_username}"/>
</div>
2021-11-11 22:06:49 +01:00
${e.authentication!==e.EXTERNAL?(()=>{const e=vh("Password");return Qc`
2021-03-19 19:26:15 +01:00
<div class="form-group">
<label for="converse-login-password">${e}</label>
<input id="converse-login-password" class="form-control" required="required" type="password" name="password" placeholder="${e}"/>
</div>
`})():""}
2021-11-11 22:06:49 +01:00
${e.show_trust_checkbox?(e=>{const t=vh("To improve performance, we cache your data in this browser. Uncheck this box if this is a public computer or if you want your data to be deleted when you log out. It's important that you explicitly log out, otherwise not all cached data might be deleted. Please note, when using an untrusted device, OMEMO encryption is NOT available."),n=vh("This is a trusted device");return Qc`
2021-03-19 19:26:15 +01:00
<div class="form-group form-check login-trusted">
<input id="converse-login-trusted" type="checkbox" class="form-check-input" name="trusted" ?checked=${e}>
<label for="converse-login-trusted" class="form-check-label login-trusted__desc">${n}</label>
<i class="fa fa-info-circle" data-toggle="popover"
data-title="Trusted device?"
data-content="${t}"></i>
</div>
`})("off"!==e.show_trust_checkbox):""}
2021-11-11 22:06:49 +01:00
<fieldset class="form-group buttons">
2021-03-19 19:26:15 +01:00
<input class="btn btn-primary" type="submit" value="${t}"/>
</fieldset>
2021-11-11 22:06:49 +01:00
${va.allow_registration&&!Cl.settings.get("auto_login")&&va.pluggable.plugins["converse-register"].enabled(va)?(()=>{const e=vh("Create an account"),t=vh("Don't have a chat account?");return Qc`
2021-03-19 19:26:15 +01:00
<fieldset class="switch-form">
<p>${t}</p>
<p><a class="register-account toggle-register-login" href="#converse/register">${e}</a></p>
</fieldset>
`})():""}
2021-11-11 22:06:49 +01:00
`})(e):""}
${e.authentication==e.ANONYMOUS?Qc`<input class="btn btn-primary login-anon" type="submit" value="${n}">`:""}
${e.authentication==e.PREBIND?Qc`<p>${t}</p>`:""}
2021-03-19 19:26:15 +01:00
`})(e)}
</form>
2021-11-11 22:06:49 +01:00
`;function wb(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sb=jl.env.utils,{Strophe:xb}=jl.env,Eb=[0,1,2,3,4,7,10],Ab={0:"Error",1:"Connecting",2:"Connection failure",3:"Authenticating",4:"Authentication failure",5:"Connected",6:"Disconnected",7:"Disconnecting",8:"Attached",9:"Redirect",10:"Reconnecting"},Cb={Error:"error",Connecting:"info","Connection failure":"error",Authenticating:"info","Authentication failure":"error",Connected:"info",Disconnected:"error",Disconnecting:"warn",Attached:"info",Redirect:"info",Reconnecting:"warn"},Tb=Zo.extend({defaults:{errors:[]}});Cl.elements.define("converse-login-panel",class extends mg{constructor(...e){super(...e),wb(this,"id","converse-login-panel"),wb(this,"className","controlbox-pane fade-in row no-gutters"),wb(this,"events",{"submit form#converse-login":"authenticate","change input":"validate"})}initialize(){this.model=new Tb,this.listenTo(this.model,"change",this.render),this.listenTo(va.connfeedback,"change",this.render),this.render(),this.initPopovers()}render(){const e=va.connfeedback.get("connection_status");let t,n;Eb.includes(e)&&(n=Ab[e],t=Cb[n]),tl(_b(Object.assign(this.model.toJSON(),{_converse:va,ANONYMOUS:va.ANONYMOUS,EXTERNAL:va.EXTERNAL,LOGIN:va.LOGIN,PREBIND:va.PREBIND,auto_login:Cl.settings.get("auto_login"),authentication:Cl.settings.get("authentication"),connection_status:e,conn_feedback_class:t,conn_feedback_subject:n,conn_feedback_message:va.connfeedback.get("message"),placeholder_username:(Cl.settings.get("locked_domain")||Cl.settings.get("default_domain"))&&vh("Username")||vh("user@domain"),show_trust_checkbox:Cl.settings.get("allow_user_trust_override")})),this)}initPopovers(){Array.from(this.querySelectorAll("[data-title]")).forEach((e=>{new(Hg().Popover)(e,{trigger:"mobile"===Cl.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===Cl.settings.get("view_mode"),container:this.parentElement.parentElement.parentElement})}))}validate(){const e=this.querySelector("form").querySelector("input[name=jid]");return!e.value||Cl.settings.get("locked_domain")||Cl.settings.get("default_domain")||Sb.isValidJID(e.value)?(e.setCustomValidity(""),!0):(e.setCustomValidity(vh("Please enter a valid XMPP address")),!1)}authenticate(e){if(null==e||e.preventDefault(),Cl.settings.get("authentication")===va.ANONYMOUS)return this.connect(va.jid,null);if(!this.validate())return;const t=new FormData(e.target);va.config.save({trusted:!!t.get("trusted")});let n=t.get("jid");if(Cl.settings.get("locked_domain")){const e="@"+Cl.settings.get("locked_domain");n.endsWith(e)&&(n=n.substr(0,n.length-e.length)),n=xb.escapeNode(n)+e}else Cl.settings.get("default_domain")&&!n.includes("@")&&(n=n+"@"+Cl.settings.get("default_domain"));this.connect(n,t.get("password"))}connect(e,t){["converse/login","converse/register"].includes(va.router.history.getFragment())&&va.router.navigate("",{replace:!0}),va.connection&&va.connection.reset(),Cl.user.login(e,t)}});const kb=jl.env.utils;function jb(){var e;const t=va.chatboxes.add(new va.ControlBox({id:"controlbox"}));return null===(e=va.chatboxviews.get("controlbox"))||void 0===e||e.setModel(),t}function Nb(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=va.chatboxes.get("controlbox")||jb();kb.safeSave(n,{closed:!1})}function Ob(){const e=va.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e}function $b(){const e=null==va?void 0:va.chatboxviews,t=e&&e.get("controlbox");t&&(kb.safeSave(t.model,{connected:!1}),null!=t&&t.controlbox_pane&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}function Ib(){(va.chatboxes.get("controlbox")||jb()).save({connected:!0})}Cl.elements.define("converse-controlbox-navback",class extends Uf{static get properties(){return{jid:{type:String}}}render(){return e=this.jid,Qc`<i class="fa fa-arrow-left" @click=${()=>function(e){Nb();const t=va.chatboxes.get(e);kb.safeSave(t,{hidden:!0})}(e)}></i>`;var e}});const{dayjs:Mb}=jl.env,Rb=Zo.extend({defaults:()=>({bookmarked:!1,box_id:"controlbox",chat_s
2021-03-19 19:26:15 +01:00
<div class="flyout box-flyout">
2021-11-11 22:06:49 +01:00
<converse-dragresize></converse-dragresize>
2021-03-19 19:26:15 +01:00
<div class="chat-head controlbox-head">
2021-11-11 22:06:49 +01:00
${e.sticky_controlbox?"":Qc`
<a class="chatbox-btn close-chatbox-button fa fa-times" @click=${e.close}></a>
`}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="controlbox-panes">
<div class="controlbox-pane">
${e.connected?Qc`
<converse-user-profile></converse-user-profile>
<converse-headlines-panel class="controlbox-section"></converse-headlines-panel>
<div id="chatrooms" class="controlbox-section">
<converse-rooms-list></converse-rooms-list>
<converse-bookmarks></converse-bookmarks>
</div>
${Cl.settings.get("authentication")===va.ANONYMOUS?"":Qc`<div id="converse-roster" class="controlbox-section"><converse-roster></converse-roster></div>`}`:"register"===e["active-form"]?Qc`<converse-register-panel></converse-register-panel>`:Qc`<converse-login-panel></converse-login-panel>`}
</div>
</div>
</div>
`)({sticky_controlbox:Cl.settings.get("sticky_controlbox"),...this.model.toJSON(),close:e=>this.close(e)}),this)}afterRender(){this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!Cl.settings.get("show_controlbox_by_default"))}close(e){var t;if(null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),("closeAllChatBoxes"!==(null==e?void 0:e.name)||va.disconnection_cause===va.LOGOUT&&!Cl.settings.get("show_controlbox_by_default"))&&!Cl.settings.get("sticky_controlbox"))return zb.safeSave(this.model,{closed:!0}),Cl.trigger("controlBoxClosed",this),this}afterShown(){return Cl.trigger("controlBoxOpened",this),this}showHelpMessages(){}}Cl.elements.define("converse-controlbox",Pb);const Fb=Pb,{u:Ub}=jl.env,Bb={controlbox:{async open(){await Cl.waitUntil("chatBoxesFetched");const e=await Cl.chatboxes.get("controlbox")||Cl.chatboxes.create("controlbox",{},va.Controlbox);return Ub.safeSave(e,{closed:!1}),e},get:()=>va.chatboxviews.get("controlbox")}};var qb=n(7581),Hb={};Hb.styleTagTransform=eg(),Hb.setAttributes=Yf(),Hb.insert=Jf().bind(null,"head"),Hb.domAPI=Wf(),Hb.insertStyleElement=Xf(),Hf()(qb.Z,Hb),qb.Z&&qb.Z.locals&&qb.Z.locals,jl.plugins.add("converse-controlbox",{dependencies:["converse-modal","converse-chatboxes","converse-chat","converse-rosterview","converse-chatview"],enabled:e=>!e.api.settings.get("singleton"),overrides:{ChatBoxes:{model(e,t){return e&&"controlbox"==e.id?new Rb(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){Cl.settings.extend({allow_logout:!0,allow_user_trust_override:!0,default_domain:void 0,locked_domain:void 0,show_controlbox_by_default:!1,sticky_controlbox:!1}),Cl.promises.add("controlBoxInitialized"),Object.assign(Cl,Bb),va.ControlBoxView=Fb,va.ControlBox=Rb,va.ControlBoxToggle=Lb,Cl.listen.on("chatBoxesFetched",Ib),Cl.listen.on("cleanup",(()=>delete va.controlboxtoggle)),Cl.listen.on("clearSession",$b),Cl.listen.on("will-reconnect",Ob),Cl.waitUntil("chatBoxViewsInitialized").then(jb).catch((e=>M.fatal(e)))}});const{u:Gb}=jl.env;function Wb(e,t=!0){if(!Cl.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=Gb.ancestor(e.target,".box-flyout"),s=window.getComputedStyle(n),i=n.parentElement;i.height=parseInt(s.height.replace(/px$/,""),10),va.resizing={chatbox:i,direction:"top"},i.prev_pageY=e.pageY,t&&Cl.trigger("startVerticalResize",i)}function Vb(e,t=!0){if(!Cl.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=Gb.ancestor(e.target,".box-flyout"),s=window.getComputedStyle(n),i=n.parentElement;i.width=parseInt(s.width.replace(/px$/,""),10),va.resizing={chatbox:i,direction:"left"},i.prev_pageX=e.pageX,t&&Cl.trigger("startHorizontalResize",i)}function Jb(e){Vb(e,!1),Wb(e,!1),va.resizing.direction="topleft",Cl.trigger("startDiagonalResize",this)}function Kb(e,t){if(void 0!==e)return void 0===t?e:e!==t&&Math.abs(e-t)<10?t:e}function Yb(e){if(!va.resizing||!Cl.settings.get("allow_dragresize"))return!0;e.preventDefault(),va.resizing.chatbox.resizeChatBox(e)}function Qb(e){if(!va.resizing||!Cl.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=Kb(va.resizing.chatbox.height,va.resizing.chatbox.model.get("default_height")),n=Kb(va.resizing.chatbox.width,va.resizing.chatbox.model.get("default_width"));Cl.connection.connected()?(va.resizing.chatbox.model.save({height:t}),va.resizing.chatbox.model.save({width:n})):(va.resizing.chatbox.model.set({height:t}),va.resizing.chatbox.model.set({width:n})),va.resizing=null}const Xb=()=>Qc`
<div class="dragresize dragresize-top" @mousedown="${Wb}"></div>
<div class="dragresize dragresize-topleft" @mousedown="${Jb}"></div>
<div class="dragresize dragresize-left" @mousedown="${Vb}"></div>
`;customElements.define("converse-dragresize",class extends Uf{render(){return Xb()}});const Zb={initDragResize(){var e;const t=this,n=hc((()=>t.setDimensions()));window.addEventListener("resize",t.debouncedSetDimensions),this.listenTo(this.model,"destroy",(()=>window.removeEventListener("resize",n)));const s=this.querySelector(".box-flyout"),i=window.getComputedStyle(s);if(void 0===this.model.get("height")){const e=parseInt(i.height.replace(/px$/,""),10),t=parseInt(i.width.replace(/px$/,""),10);this.model.set("height",e),this.model.set("default_height",e),this.model.set("width",t),this.model.set("default_width",t)}const r=i["min-width"],o=i["min-height"];return this.model.set("min_width",r.endsWith("px")?Number(r.replace(/px$/,"")):0),this.model.set("min_height",o.endsWith("px")?Number(o.replace(/px$/,"")):0),this.prev_pageY=0,this.prev_pageX=0,null!==(e=va.connection)&&void 0!==e&&e.connected&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===va.resizing.direction.indexOf("top")&&(t=e.pageY-this.prev_pageY,t&&(this.height=this.height-t>(this.model.get("min_height")||0)?this.height-t:this.model.get("min_height"),this.prev_pageY=e.pageY,this.setChatBoxHeight(this.height))),va.resizing.direction.includes("left")&&(t=this.prev_pageX-e.pageX,t&&(this.width=this.width+t>(this.model.get("min_width")||0)?this.width+t:this.model.get("min_width"),this.prev_pageX=e.pageX,this.setChatBoxWidth(this.width)))},setDimensions(){this.adjustToViewport(),this.setChatBoxHeight(this.model.get("height")),this.setChatBoxWidth(this.model.get("width"))},setChatBoxHeight(e){e=e?Kb(e,this.model.get("default_height"))+"px":"";const t=this.querySelector(".box-flyout");null!==t&&(t.style.height=e)},setChatBoxWidth(e){e=e?Kb(e,this.model.get("default_width"))+"px":"",this.style.width=e;const t=this.querySelector(".box-flyout");null!==t&&(t.style.width=e)},adjustToViewport(){const e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),t=Math.max(document.documentElement.clientHeight,window.innerHeight||0);e<=480?(this.model.set("height",void 0),this.model.set("width",void 0)):e<=this.model.get("width")?this.model.set("width",void 0):t<=this.model.get("height")&&this.model.set("height",void 0)}};jl.plugins.add("converse-dragresize",{dependencies:["converse-chatview","converse-headlines-view","converse-muc-views"],enabled:e=>"overlayed"==e.api.settings.get("view_mode"),overrides:{ChatBox:{initialize(){const e=this.__super__.initialize.apply(this,arguments),t=this.get("height"),n=this.get("width");return("controlbox"===this.get("id")?e=>this.set(e):e=>this.save(e))({height:Kb(t,this.get("default_height")),width:Kb(n,this.get("default_width"))}),e}}},initialize(){Cl.settings.extend({allow_dragresize:!0}),Object.assign(va.ChatBoxView.prototype,Zb),Object.assign(va.ChatRoomView.prototype,Zb),Object.assign(va.ControlBoxView.prototype,Zb),Cl.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",Yb),document.addEventListener("mouseup",Qb)})),Cl.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",Yb),document.removeEventListener("mouseup",Qb)})),Cl.listen.on("beforeShowingChatView",(e=>e.initDragResize().setDimensions()))}}),jl.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){if(Cl.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0}),!Array.isArray(Cl.settings.get("auto_join_rooms"))&&!Array.isArray(Cl.settings.get("auto_join_private_chats")))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(Cl.settings.get("auto_join_rooms").length>1||Cl.settings.get("auto_join_private_chats").length>1)throw new Error("It doesn't make sense to have singleton set to true and auto_join_rooms or auto_join_private_chats set to more then one, since only one chat room may be open at any time.")}});var ey=n(6752),ty={};ty.styleTagTransform=eg(),ty.setAttributes=Yf(),ty.insert=Jf().bind(null,"head"),ty.domAPI=Wf(),ty.insertStyleElement=Xf(),
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
${va.api.settings.get("singleton")?"":Qc`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
<div class="chatbox-title__text" title="${e.jid}">${e.display_name}</div>
</div>
<div class="chatbox-title__buttons row no-gutters">
${e.dropdown_btns.length?Qc`<converse-dropdown class="dropleft" .items=${e.dropdown_btns}></converse-dropdown>`:""}
${e.standalone_btns.length?(e=>e.standalone_btns.reverse().map((e=>dp(e,""))))(e):""}
</div>
</div>
${e.status?Qc`<p class="chat-head__desc">${e.status}</p>`:""}
`)(Object.assign(this.model.toJSON(),{display_name:this.model.getDisplayName(),dropdown_btns:n.map((e=>sb(e))),standalone_btns:t.map((e=>ib(e)))}))}getHeadingButtons(){const e=[];return Cl.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:vh("Close"),i18n_title:vh("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Cl.settings.get("view_mode")}),va.api.hook("getHeadingButtons",this,e)}close(e){e.preventDefault(),this.model.close()}}),Cl.elements.define("converse-headlines",class extends gb{connectedCallback(){super.connectedCallback(),this.initialize()}async initialize(){va.chatboxviews.add(this.jid,this),this.model=va.chatboxes.get(this.jid),this.model.disable_mam=!0,this.listenTo(va,"windowStateChanged",this.onWindowStateChanged),this.listenTo(this.model,"change:hidden",(()=>this.afterShown())),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model.messages,"add",this.requestUpdate),this.listenTo(this.model.messages,"remove",this.requestUpdate),this.listenTo(this.model.messages,"reset",this.requestUpdate),await this.model.messages.fetched,this.model.maybeShow(),Cl.trigger("headlinesBoxViewInitialized",this)}render(){return(e=>Qc`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e?Qc`
<converse-headlines-heading jid="${e.get("jid")}" class="chat-head chat-head-chatbox row no-gutters">
</converse-headlines-heading>
<div class="chat-body">
<div class="chat-content" aria-live="polite">
<converse-chat-content
class="chat-content__messages"
jid="${e.get("jid")}"></converse-chat-content>
</div>
</div>`:""}
</div>
`)(this.model)}async close(e){var t;return null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),va.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&va.router.navigate(""),await this.model.close(e),this}getNotifications(){return[]}afterShown(){this.model.clearUnreadMsgCounter()}});class ny extends mg{constructor(...e){var t,n,s;super(...e),s={"click .open-headline":"openHeadline"},(n="events")in(t=this)?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s}initialize(){this.model=va.chatboxes,this.listenTo(this.model,"add",this.renderIfHeadline),this.listenTo(this.model,"remove",this.renderIfHeadline),this.listenTo(this.model,"destroy",this.renderIfHeadline),this.render()}toHTML(){return(e=>Qc`
<div class="controlbox-section" id="headline">
<div class="d-flex controlbox-padded ${e.headlineboxes.length?"":"hidden"}">
<span class="w-100 controlbox-heading controlbox-heading--headline">${e.heading_headline}</span>
</div>
</div>
${(e=>Qc`
<div class="list-container list-container--headline ${e.headlineboxes.length?"":"hidden"}">
<div class="items-list rooms-list headline-list">
${e.headlineboxes.map((t=>(e=>Qc`
<div class="list-item controlbox-padded d-flex flex-row"
data-headline-jid="${e.headlinebox.get("jid")}">
<a class="list-item-link open-headline available-room w-100"
data-headline-jid="${e.headlinebox.get("jid")}"
title="${e.open_title}" href="#">${e.headlinebox.get("jid")}</a>
</div>
`)(Object.assign({headlinebox:t},e))))}
</div>
</div>
`)(e)}
`)({heading_headline:vh("Announcements"),headlineboxes:this.model.filter((e=>e.get("type")===va.HEADLINES_TYPE)),open_title:vh("Click to open this server message")})}renderIfHeadline(e){return e&&e.get("type")===va.HEADLINES_TYPE&&this.render()}openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");va.chatboxes.get(t).maybeShow(!0)}}Cl.elements.define("converse-headlines-panel",ny);var sy=n(115),iy={};iy.styleTagTransform=eg(),iy.setAttributes=Yf(),iy.insert=Jf().bind(null,"head"),iy.domAPI=Wf(),iy.insertStyleElement=Xf(),Hf()(sy.Z,iy),sy.Z&&sy.Z.locals&&sy.Z.locals,jl.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],initialize(){va.HeadlinesPanel=ny}});var ry=n(8859),oy={};function ay(e,t){return e instanceof Bh?Qc`<converse-mam-placeholder .model=${e}></converse-mam-placeholder>`:t}async function cy(e){if(!e.model.ui.get("chat-content-spinner-top")&&e.model.messages.length){const t=e.model.get("type")===va.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const s=t?e.model.get("jid"):va.bare_jid,i=n&&n.get(`stanza_id ${s}`);e.model.ui.set("chat-content-spinner-top",!0);try{i?await mm(e.model,{before:i}):await mm(e.model,{end:n.get("time")})}catch(t){return M.error(t),void e.model.ui.set("chat-content-spinner-top",!1)}Cl.settings.get("allow_url_history_change")&&va.router.history.navigate(`#${n.get("msgid")}`),setTimeout((()=>e.model.ui.set("chat-content-spinner-top",!1)),250)}}}oy.styleTagTransform=eg(),oy.setAttributes=Yf(),oy.insert=Jf().bind(null,"head"),oy.domAPI=Wf(),oy.insertStyleElement=Xf(),Hf()(ry.Z,oy),ry.Z&&ry.Z.locals&&ry.Z.locals,Cl.elements.define("converse-mam-placeholder",class extends Uf{static get properties(){return{model:{type:Object}}}render(){return(e=this).model.get("fetching")?Iv({classes:"hor_centered"}):Qc`<a @click="${t=>e.fetchMissingMessages(t)}" title="${vh("Click to load missing messages")}">
<div class="message mam-placeholder"></div>
</a>`;var e}async fetchMissingMessages(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.set("fetching",!0);const n={before:this.model.get("before"),start:this.model.get("start")};await mm(this.model.collection.chatbox,n),this.model.destroy()}}),jl.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Cl.listen.on("chatBoxScrolledUp",cy),Cl.listen.on("getMessageTemplate",ay)}});const ly=jl.env.utils;function dy(e){return"controlbox"===e.model.get("id")?ly.isVisible(e)?ly.getOuterWidth(e,!0):ly.getOuterWidth(va.controlboxtoggle.el,!0):!e.model.get("minimized")&&ly.isVisible(e)?ly.getOuterWidth(e,!0):0}function uy(){var e;const t=null===(e=va.minimized_chats)||void 0===e?void 0:e.el;return va.chatboxes.pluck("minimized").includes(!0)?ly.getOuterWidth(t,!0):0}function hy(e){const t=e?e.model.get("id"):null,n=e?ly.getOuterWidth(e.el,!0):0;return Object.values(va.chatboxviews.xget(t)).reduce(((e,t)=>e+dy(t)),n)}async function my(e){var t;if(va.isTestEnv()||Cl.settings.get("no_trimming")||!Cl.connection.connected()||"overlayed"!==Cl.settings.get("view_mode"))return;const n=va.chatboxviews.filter((e=>!e.model.get("minimized")&&!e.model.get("closed")&&ly.isVisible(e)));if(n.length<=1)return;const s=ly.getOuterWidth(document.querySelector("body"),!0);if(dy(n[0])!==s&&(await Cl.waitUntil("minimizedChatsInitialized"),null===(t=va.minimized_chats)||void 0===t?void 0:t.el))for(;uy()+hy(e)>s;){const t=fy([e?e.model.get("id"):null]);if(!t)break;{const e=va.chatboxviews.get(t.get("id"));e&&e.hide(),py(t)}}}function fy(e){e.push("controlbox");let t=0,n=va.chatboxes.sort().at(t);for(;e.includes(n.get("id"))||!0===n.get("minimized");)if(t++,n=va.chatboxes.at(t),!n)return null;return n}function gy(e,t){null!=e&&e.preventDefault?e.preventDefault():t=e,ly.safeSave(t,{hidden:!1,minimized:!1,time_opened:(new Date).getTime()})}function py(e,t){null!=e&&e.preventDefault?e.preventDefault():t=e,t.setChatState(va.INACTIVE),ly.safeSave(t,{hidden:!0,minimized:!0,time_minimized:(new Date).toISOString()})}Cl.elements.define("converse-minimized-chat",class extends Uf{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=vh("Click to restore this chat");return Qc`
<div class="chat-head-${e.type} chat-head row no-gutters">
<a class="restore-chat w-100 align-self-center" title="${t}" @click=${e.restore}>
${e.num_unread?Qc`<span class="message-count badge badge-light">${e.num_unread}</span>`:""}
${e.title}
</a>
<a class="chatbox-btn close-chatbox-button" @click=${e.close}>
<converse-icon color=${"chatroom"===e.type?"var(--chatroom-head-color)":"var(--chat-head-text-color)"} class="fas fa-times" @click=${e.close} size="1em"></converse-icon>
2021-03-19 19:26:15 +01:00
</a>
2021-11-11 22:06:49 +01:00
</div>`})({close:e=>this.close(e),num_unread:this.num_unread,restore:e=>this.restore(e),title:this.title,type:this.type})}close(e){null==e||e.preventDefault(),this.model.close()}restore(e){null==e||e.preventDefault(),gy(this.model)}});const vy=Zo.extend({defaults:{collapsed:!1}});class by extends Uf{constructor(){super(),this.initialize()}async initialize(){this.model=va.chatboxes,await this.initToggle(),this.listenTo(this.minchats,"change:collapsed",this.requestUpdate),this.listenTo(this.model,"add",this.requestUpdate),this.listenTo(this.model,"change:fullname",this.requestUpdate),this.listenTo(this.model,"change:jid",this.requestUpdate),this.listenTo(this.model,"change:minimized",this.requestUpdate),this.listenTo(this.model,"change:name",this.requestUpdate),this.listenTo(this.model,"change:num_unread",this.requestUpdate),this.listenTo(this.model,"remove",this.requestUpdate),this.listenTo(va,"connected",this.requestUpdate),this.listenTo(va,"reconnected",this.requestUpdate),this.listenTo(va,"disconnected",this.requestUpdate)}render(){const e=this.model.where({minimized:!0}),t=e.reduce(((e,t)=>e+t.get("num_unread")),0),n=e.reduce(((e,t)=>e+(t.get("minimized")?1:0)),0),s={chats:e,num_unread:t,num_minimized:n,collapsed:this.minchats.get("collapsed")};return s.toggle=e=>this.toggle(e),(e=>Qc`<div id="minimized-chats" class="${e.chats.length?"":"hidden"}">
<a id="toggle-minimized-chats" class="row no-gutters" @click=${e.toggle}>
${e.num_minimized} ${vh("Minimized")}
<span class="unread-message-count ${e.num_unread?"":"unread-message-count-hidden"}" href="#">${e.num_unread}</span>
</a>
<div class="flyout minimized-chats-flyout row no-gutters ${e.collapsed?"hidden":""}">
${e.chats.map((e=>Qc`<converse-minimized-chat
2021-03-19 19:26:15 +01:00
.model=${e}
title=${e.getDisplayName()}
type=${e.get("type")}
2021-11-11 22:06:49 +01:00
num_unread=${e.get("num_unread")}></converse-minimized-chat>`))}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>`)(s)}async initToggle(){const e=`converse.minchatstoggle-${va.bare_jid}`;this.minchats=new vy({id:e}),_o(this.minchats,e,"session"),await new Promise((e=>this.minchats.fetch({success:e,error:e})))}toggle(e){null==e||e.preventDefault(),this.minchats.save({collapsed:!this.minchats.get("collapsed")})}}Cl.elements.define("converse-minimized-chats",by);var yy=n(7926),_y={};_y.styleTagTransform=eg(),_y.setAttributes=Yf(),_y.insert=Jf().bind(null,"head"),_y.domAPI=Wf(),_y.insertStyleElement=Xf(),Hf()(yy.Z,_y),yy.Z&&yy.Z.locals&&yy.Z.locals;const{dayjs:wy}=jl.env;jl.plugins.add("converse-minimize",{dependencies:["converse-chatview","converse-controlbox","converse-muc-views","converse-headlines-view","converse-dragresize"],enabled:e=>"overlayed"===e.api.settings.get("view_mode"),overrides:{ChatBox:{initialize(){this.__super__.initialize.apply(this,arguments),this.on("change:hidden",(e=>!e.get("hidden")&&gy(this)),this),"controlbox"!==this.get("id")&&this.save({minimized:this.get("minimized")||!1,time_minimized:this.get("time_minimized")||wy()})},maybeShow(e){return!e&&this.get("minimized")?this:this.__super__.maybeShow.apply(this,arguments)},isHidden(){return this.__super__.isHidden.call(this)||this.get("minimized")}},ChatBoxView:{isNewMessageHidden(){return this.model.get("minimized")||this.__super__.isNewMessageHidden.apply(this,arguments)},setChatBoxHeight(e){if(!this.model.get("minimized"))return this.__super__.setChatBoxHeight.call(this,e)},setChatBoxWidth(e){if(!this.model.get("minimized"))return this.__super__.setChatBoxWidth.call(this,e)}}},initialize(){function e(e){e.on("change:minimized",(()=>function(e){e.get("minimized")?function(e){Cl.trigger("chatBoxMinimized",e)}(e):function(e){e.isScrolledUp()||e.clearUnreadMsgCounter(),e.setChatState(va.ACTIVE),Cl.trigger("chatBoxMaximized",e)}(e)}(e)))}Cl.settings.extend({no_trimming:!1}),Cl.promises.add("minimizedChatsInitialized"),va.MinimizedChatsToggle=vy,va.MinimizedChats=by,va.minimize={},va.minimize.trimChats=my,va.minimize.minimize=py,va.minimize.maximize=gy,Cl.listen.on("chatBoxViewInitialized",(e=>va.minimize.trimChats(e))),Cl.listen.on("chatRoomViewInitialized",(e=>va.minimize.trimChats(e))),Cl.listen.on("chatBoxMaximized",(e=>va.minimize.trimChats(e))),Cl.listen.on("controlBoxOpened",(e=>va.minimize.trimChats(e))),Cl.listen.on("chatBoxInitialized",e),Cl.listen.on("chatRoomInitialized",e),Cl.listen.on("getHeadingButtons",((e,t)=>e.model.get("type")===va.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>py(t,e.model),i18n_text:vh("Minimize"),i18n_title:vh("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===va.api.settings.get("view_mode")},s=t.map((e=>e.name)).indexOf("signout");return s>-1?[...t.slice(0,s),n,...t.slice(s)]:[n,...t]}(e,t):function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>py(t,e.model),i18n_text:vh("Minimize"),i18n_title:vh("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===va.api.settings.get("view_mode")},s=t.map((e=>e.name)).indexOf("close");return s>-1?[...t.slice(0,s),n,...t.slice(s)]:[n,...t]}(e,t)));const t=hc((()=>va.minimize.trimChats()),250);Cl.listen.on("registeredGlobalEventHandlers",(()=>window.addEventListener("resize",t))),Cl.listen.on("unregisteredGlobalEventHandlers",(()=>window.removeEventListener("resize",t)))}});const Sy=jl.env.utils,xy={getElement:(e,t)=>"string"==typeof e?(t||document).querySelector(e):e||null,bind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=t[n];n.split(/\s+/).forEach((t=>e.addEventListener(t,s)))}},unbind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=t[n];n.split(/\s+/).forEach((t=>e.removeEventListener(t,s)))}},regExpEscape:e=>e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),isMention:(e,t)=>t.includes(e[0])||Sy.isMentionBoundary(e[0])&&t.includes(e[1])},Ey=function(e,t){return RegExp(xy.regExpEscape(t.trim()),"i").test(e)},Ay=function(e,t){return RegExp("^"+xy.regExpEscape(t.trim()),"i").test(e)},Cy=fun
2021-03-19 19:26:15 +01:00
<div class="suggestion-box suggestion-box__name">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
2021-11-11 22:06:49 +01:00
<input
type="text"
name="${this.name}"
autocomplete="off"
@keydown=${this.onKeyDown}
@keyup=${this.onKeyUp}
class="form-control suggestion-box__input"
placeholder="${this.placeholder}"
/>
<span
class="suggestion-box__additions visually-hidden"
role="status"
aria-live="assertive"
aria-relevant="additions"
></span>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
`}firstUpdated(){this.auto_complete=new Oy(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?Ey:Ay,include_triggers:[],list:()=>this.getAutoCompleteList(),match_current_word:!0,max_items:this.max_items,min_chars:this.min_chars}),this.auto_complete.on("suggestion-box-selectcomplete",(()=>this.auto_completing=!1))}onKeyDown(e){this.auto_complete.onKeyDown(e)}onKeyUp(e){this.auto_complete.evaluate(e)}});var $y=n(8481),Iy={};Iy.styleTagTransform=eg(),Iy.setAttributes=Yf(),Iy.insert=Jf().bind(null,"head"),Iy.domAPI=Wf(),Iy.insertStyleElement=Xf(),Hf()($y.Z,Iy),$y.Z&&$y.Z.locals&&$y.Z.locals,va.FILTER_CONTAINS=Ey,va.FILTER_STARTSWITH=Ay,va.AutoComplete=Oy;function My(e){return"moderator"===e?vh("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations."):"participant"===e?vh("The default role, implies that you can read and write messages."):"visitor"==e?vh("Visitors aren't allowed to write messages in a moderated multi-user chat."):void 0}function Ry(e){return"owner"===e?vh("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users."):"admin"===e?vh("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners."):"outcast"===e?vh('To ban a user, you give them the affiliation of "outcast".'):void 0}const Dy=e=>{const t=vh("Affiliation"),n=vh("No users with that affiliation found."),s=vh("No users with that role found."),i=vh("Type here to filter the search results"),r=vh("Role"),o=vh("Show users"),a=vh("Roles are assigned to users to grant or deny them certain abilities in a multi-user chat. They're assigned either explicitly or implicitly as part of an affiliation. A role that's not due to an affiliation, is only valid for the duration of the user's session."),c=vh("An affiliation is a long-lived entitlement which typically implies a certain role and which grants privileges and responsibilities. For example admins and owners automatically have the moderator role."),l=e.queryable_roles.length&&e.queryable_affiliations.length;return Qc`
${e.alert_message?Qc`<div class="alert alert-${e.alert_type}" role="alert">${e.alert_message}</div>`:""}
${l?Qc`
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="affiliations-tab" href="#affiliations-tabpanel" aria-controls="affiliations-tabpanel" role="tab" data-toggle="tab">Affiliations</a>
2021-03-19 19:26:15 +01:00
</li>
2021-11-11 22:06:49 +01:00
<li role="presentation" class="nav-item">
<a class="nav-link" id="roles-tab" href="#roles-tabpanel" aria-controls="roles-tabpanel" role="tab" data-toggle="tab">Roles</a>
</li>
</ul>
`:""}
<div class="tab-content">
${e.queryable_affiliations.length?Qc`
<div class="tab-pane tab-pane--columns ${e.queryable_affiliations.length?"active":""}" id="affiliations-tabpanel" role="tabpanel" aria-labelledby="affiliations-tab">
<form class="converse-form query-affiliation" @submit=${e.queryAffiliation}>
<p class="helptext pb-3">${c}</p>
<div class="form-group">
<label for="affiliation">
<strong>${t}:</strong>
</label>
<div class="row">
<div class="col">
<select class="custom-select select-affiliation" name="affiliation">
${e.queryable_affiliations.map((t=>(e=>Qc`
<option value="${e.item||""}"
?selected=${e.item===e.affiliation}
title="${Ry(e.item)}">${e.item}</option>
`)(Object.assign({item:t},e))))}
</select>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_affiliation" value="${o}"/>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>
<div class="row">
<div class="col mt-3">
${Array.isArray(e.users_with_affiliation)&&e.users_with_affiliation.length>5?Qc`<input class="form-control" .value="${e.affiliations_filter}" @keyup=${e.filterAffiliationResults} type="text" name="filter" placeholder="${i}"/>`:""}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>
${Ry(e.affiliation)?Qc`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${Ry(e.affiliation)}</p></div></div>`:""}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
${e.loading_users_with_affiliation?Qc`<li class="list-group-item"> ${Iv()} </li>`:""}
${Array.isArray(e.users_with_affiliation)&&0===e.users_with_affiliation.length?Qc`<li class="list-group-item">${n}</li>`:""}
${e.users_with_affiliation instanceof Error?Qc`<li class="list-group-item">${e.users_with_affiliation.message}</li>`:(e.users_with_affiliation||[]).map((t=>(t.nick||t.jid).match(new RegExp(e.affiliations_filter,"i"))?(e=>Qc`
2021-03-19 19:26:15 +01:00
<li class="list-group-item" data-nick="${e.item.nick}">
<ul class="list-group">
<li class="list-group-item active">
<div><strong>JID:</strong> ${e.item.jid}</div>
</li>
<li class="list-group-item">
<div><strong>Nickname:</strong> ${e.item.nick}</div>
</li>
<li class="list-group-item">
2021-11-11 22:06:49 +01:00
<div><strong>Affiliation:</strong> ${e.item.affiliation} ${e.assignable_affiliations.length?(e=>Qc`
<a href="#" data-form="affiliation-form" class="toggle-form right" color="var(--subdued-color)" @click=${e.toggleForm}>
<converse-icon class="fa fa-wrench" size="1em"></converse-icon>
</a>`)(e):""}</div>
${e.assignable_affiliations.length?(e=>{const t=vh("Change affiliation"),n=vh("New affiliation"),s=vh("Reason");return Qc`
<form class="affiliation-form hidden" @submit=${e.assignAffiliation}>
2021-03-19 19:26:15 +01:00
<div class="form-group">
<input type="hidden" name="jid" value="${e.item.jid}"/>
<input type="hidden" name="nick" value="${e.item.nick}"/>
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
2021-11-11 22:06:49 +01:00
<select class="custom-select select-affiliation" name="affiliation">
${e.assignable_affiliations.map((t=>Qc`<option value="${t}" ?selected=${t===e.item.affiliation}>${t}</option>`))}
2021-03-19 19:26:15 +01:00
</select>
</div>
<div class="col">
2021-11-11 22:06:49 +01:00
<label><strong>${s}:</strong></label>
2021-03-19 19:26:15 +01:00
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" name="change" value="${t}"/>
2021-03-19 19:26:15 +01:00
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
2021-11-11 22:06:49 +01:00
`)(Object.assign({item:t},e)):""))}
</ul>
</div>
</div>`:""}
${e.queryable_roles.length?Qc`
<div class="tab-pane tab-pane--columns ${!l&&e.queryable_roles.length?"active":""}" id="roles-tabpanel" role="tabpanel" aria-labelledby="roles-tab">
<form class="converse-form query-role" @submit=${e.queryRole}>
<p class="helptext pb-3">${a}</p>
<div class="form-group">
<label for="role"><strong>${r}:</strong></label>
<div class="row">
<div class="col">
<select class="custom-select select-role" name="role">
${e.queryable_roles.map((t=>(e=>Qc`
<option value="${e.item||""}"
?selected=${e.item===e.role}
title="${My(e.item)}">${e.item}</option>
`)(Object.assign({item:t},e))))}
</select>
</div>
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_role" value="${o}"/>
</div>
</div>
<div class="row">
<div class="col mt-3">
${Array.isArray(e.users_with_role)&&e.users_with_role.length>5?Qc`<input class="form-control" .value="${e.roles_filter}" @keyup=${e.filterRoleResults} type="text" name="filter" placeholder="${i}"/>`:""}
</div>
</div>
${My(e.role)?Qc`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${My(e.role)}</p></div></div>`:""}
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
${e.loading_users_with_role?Qc`<li class="list-group-item"> ${Iv()} </li>`:""}
${e.users_with_role&&0===e.users_with_role.length?Qc`<li class="list-group-item">${s}</li>`:""}
${(e.users_with_role||[]).map((t=>t.nick.match(e.roles_filter)?(e=>Qc`
2021-03-19 19:26:15 +01:00
<li class="list-group-item" data-nick="${e.item.nick}">
<ul class="list-group">
<li class="list-group-item active">
<div><strong>JID:</strong> ${e.item.jid}</div>
</li>
<li class="list-group-item">
<div><strong>Nickname:</strong> ${e.item.nick}</div>
</li>
<li class="list-group-item">
2021-11-11 22:06:49 +01:00
<div><strong>Role:</strong> ${e.item.role} ${e.assignable_roles.length?(e=>Qc`
<a href="#" data-form="role-form" class="toggle-form right" color="var(--subdued-color)" @click=${e.toggleForm}>
<converse-icon class="fa fa-wrench" size="1em"></converse-icon>
</a>`)(e):""}</div>
${e.assignable_roles.length?(e=>{const t=vh("Change role"),n=vh("New Role"),s=vh("Reason");return Qc`
<form class="role-form hidden" @submit=${e.assignRole}>
2021-03-19 19:26:15 +01:00
<div class="form-group">
<input type="hidden" name="jid" value="${e.item.jid}"/>
<input type="hidden" name="nick" value="${e.item.nick}"/>
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
2021-11-11 22:06:49 +01:00
<select class="custom-select select-role" name="role">
${e.assignable_roles.map((t=>Qc`<option value="${t}" ?selected=${t===e.item.role}>${t}</option>`))}
2021-03-19 19:26:15 +01:00
</select>
</div>
<div class="col">
2021-11-11 22:06:49 +01:00
<label><strong>${s}:</strong></label>
2021-03-19 19:26:15 +01:00
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" value="${t}"/>
2021-03-19 19:26:15 +01:00
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
2021-11-11 22:06:49 +01:00
`)(Object.assign({item:t},e)):""))}
</ul>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>`:""}
</div>`},{Strophe:Ly,sizzle:zy,u:Py}=jl.env;Cl.elements.define("converse-modtools",class extends Uf{static get properties(){return{affiliation:{type:String},affiliations_filter:{type:String,attribute:!1},alert_message:{type:String,attribute:!1},alert_type:{type:String,attribute:!1},jid:{type:String},muc:{type:Object,attribute:!1},role:{type:String},roles_filter:{type:String,attribute:!1},users_with_affiliation:{type:Array,attribute:!1},users_with_role:{type:Array,attribute:!1}}}constructor(){super(),this.affiliation="",this.affiliations_filter="",this.role="",this.roles_filter=""}connectedCallback(){super.connectedCallback(),this.initialize()}updated(e){e.has("role")&&this.onSearchRoleChange(),e.has("affiliation")&&this.onSearchAffiliationChange(),e.has("jid")&&e.get("jid")&&this.initialize()}async initialize(){this.initialized=ji();const e=await Cl.rooms.get(this.jid);await e.initialized,this.muc=e,this.initialized.resolve()}render(){var e;if(null!==(e=this.muc)&&void 0!==e&&e.occupants){const e=this.muc.occupants.findWhere({jid:va.bare_jid});return Dy({affiliations_filter:this.affiliations_filter,alert_message:this.alert_message,alert_type:this.alert_type,assignAffiliation:e=>this.assignAffiliation(e),assignRole:e=>this.assignRole(e),assignable_affiliations:Cu(e),assignable_roles:Wu(e),filterAffiliationResults:e=>this.filterAffiliationResults(e),filterRoleResults:e=>this.filterRoleResults(e),loading_users_with_affiliation:this.loading_users_with_affiliation,queryAffiliation:e=>this.queryAffiliation(e),queryRole:e=>this.queryRole(e),queryable_affiliations:oh.filter((e=>!Cl.settings.get("modtools_disable_query").includes(e))),queryable_roles:rh.filter((e=>!Cl.settings.get("modtools_disable_query").includes(e))),roles_filter:this.roles_filter,switchTab:e=>this.switchTab(e),toggleForm:e=>this.toggleForm(e),users_with_affiliation:this.users_with_affiliation,users_with_role:this.users_with_role})}return""}async onSearchAffiliationChange(){if(this.affiliation){if(await this.initialized,this.clearAlert(),this.loading_users_with_affiliation=!0,this.users_with_affiliation=null,this.shouldFetchAffiliationsList()){const e=await Au(this.affiliation,this.jid);e instanceof Error?(this.alert(e.message,"danger"),this.users_with_affiliation=[]):this.users_with_affiliation=e}else this.users_with_affiliation=this.muc.getOccupantsWithAffiliation(this.affiliation);this.loading_users_with_affiliation=!1}}async onSearchRoleChange(){this.role&&(await this.initialized,this.clearAlert(),this.users_with_role=this.muc.getOccupantsWithRole(this.role))}shouldFetchAffiliationsList(){const e=this.affiliation;return"none"!==e&&!this.muc.occupants.getAutoFetchedAffiliationLists().includes(e)}toggleForm(e){e.stopPropagation(),e.preventDefault();const t=Py.ancestor(e.target,".toggle-form"),n=t.getAttribute("data-form"),s=Py.ancestor(t,".list-group-item").querySelector(`.${n}`);Py.hasClass("hidden",s)?Py.removeClass("hidden",s):Py.addClass("hidden",s)}filterRoleResults(e){this.roles_filter=e.target.value,this.render()}filterAffiliationResults(e){this.affiliations_filter=e.target.value}queryRole(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target).get("role");this.role=null,this.role=t}queryAffiliation(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target).get("affiliation");this.affiliation=null,this.affiliation=t}alert(e,t){this.alert_message=e,this.alert_type=t}clearAlert(){this.alert_message=void 0,this.alert_type=void 0}async assignAffiliation(e){e.stopPropagation(),e.preventDefault(),this.clearAlert();const t=new FormData(e.target),n=t.get("affiliation"),s={jid:t.get("jid"),reason:t.get("reason")},i=this.affiliation,r=this.muc.get("jid");try{await ku(n,r,[s])}catch(e){return null===e?this.alert(vh("Timeout error while trying to set the affiliation"),"danger"):zy(`not-allowed[xmlns="${Ly.NS.STANZAS}"]`,e).length?this.alert(vh("Sorry, you're not allowed to make that change"),"danger"):this.alert(vh("Sorry, something went wrong while trying to set the affiliation"),"danger"),void M.error(e)}await this.muc.oc
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2021-11-11 22:06:49 +01:00
<h5 class="modal-title" id="converse-modtools-modal-label">${t}</h5>
${Qg}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="modal-body d-flex flex-column">
<converse-modtools jid=${e.jid} affiliation=${e.affiliation}></converse-modtools>
2021-03-19 19:26:15 +01:00
</div>
</div>
2021-11-11 22:06:49 +01:00
</div>`})(this)}}),{Strophe:Uy,$pres:By,$iq:qy,sizzle:Hy,u:Gy}=jl.env,Wy={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"},Vy={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"};async function Jy(e){const t=[vh("Are you sure you want to destroy this groupchat?")];let n=[{name:"challenge",label:vh("Please enter the XMPP address of this groupchat to confirm"),challenge:e.get("jid"),placeholder:vh("name@example.org"),required:!0},{name:"reason",label:vh("Optional reason for destroying this groupchat"),placeholder:vh("Reason")},{name:"newjid",label:vh("Optional XMPP address for a new groupchat that replaces this one"),placeholder:vh("replacement@example.org")}];try{var s,i;n=await Cl.confirm(vh("Confirm"),t,n);const r=null===(s=n.filter((e=>"reason"===e.name)).pop())||void 0===s?void 0:s.value,o=null===(i=n.filter((e=>"newjid"===e.name)).pop())||void 0===i?void 0:i.value;return e.sendDestroyIQ(r,o).then((()=>e.close()))}catch(e){M.error(e)}}function Ky(e,t){t.querySelector("converse-rooms-list").model.save("muc_domain",Uy.getDomainFromJid(e))}function Yy(e){e.model.get("connected")&&(e.querySelector("converse-rooms-list").model.get("muc_domain")||(void 0===Cl.settings.get("muc_domain")?function(e){function t(t){t&&t.get("var")===Uy.NS.MUC&&t.entity.getIdentity("conference","text").then((n=>{n&&Ky(t.get("from"),e)}))}Cl.waitUntil("discoInitialized").then((()=>{Cl.listen.on("serviceDiscovered",t),va.disco_entities.each((e=>t(e.features.findWhere({var:Uy.NS.MUC}))))})).catch((e=>M.error(e)))}(e):Ky(Cl.settings.get("muc_domain"),e)))}function Qy(e,t){t=t.trim();const n=document.createElement("li");if(n.setAttribute("aria-selected","false"),Cl.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let s="data:"+va.DEFAULT_IMAGE_TYPE+";base64,"+va.DEFAULT_IMAGE;if(va.vcards){const t=va.vcards.findWhere({nickname:e});t&&(s="data:"+t.get("image_type")+";base64,"+t.get("image"))}t.setAttribute("src",s),t.setAttribute("width","22"),t.setAttribute("class","avatar avatar-autocomplete"),n.appendChild(t)}const s=new RegExp("("+t+")","ig");return(t?e.split(s):[e]).forEach((e=>{if(t&&e.match(s)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))})),n}async function Xy(){const e=[...await Cl.rooms.get(),...await Cl.contacts.get()];return[...new Set(e.map((e=>Uy.getDomainFromJid(e.get("jid")))))]}function Zy(e,t,n,s=[],i=[]){const r=Vy[t];if(!r)throw Error(`ChatRoomView#setRole called with invalid command: ${t}`);if(!e.verifyAffiliations(s)||!e.verifyRoles(i))return!1;if(!e.validateRoleOrAffiliationChangeArgs(t,n))return!1;const o=e.getNickOrJIDFromCommandArgs(n);if(!o)return!1;const a=n.split(o,2)[1].trim(),c=e.getOccupant(o);return e.setRole(c,r,a,void 0,(t=>e.onCommandError(t))),!0}function e_(e,t,n,s){const i=Wy[t];if(!i)throw Error(`verifyAffiliations called with invalid command: ${t}`);if(!e.verifyAffiliations(s))return!1;if(!e.validateRoleOrAffiliationChangeArgs(t,n))return!1;const r=e.getNickOrJIDFromCommandArgs(n);if(!r)return!1;let o;const a=n.split(r,2)[1].trim(),c=e.getOccupant(r);if(c)o=c.get("jid");else{if(!Gy.isValidJID(r)){const t=vh("Couldn't find a participant with that nickname. They might have left the groupchat.");return void e.createMessage({message:t,type:"error"})}o=r}const l={jid:o,reason:a};c&&Cl.settings.get("auto_register_muc_nickname")&&(l.nick=c.get("nick")),ku(i,e.get("jid"),[l]).then((()=>e.occupants.fetchMembers())).catch((t=>e.onCommandError(t)))}function t_(e,t){if(!e.verifyRoles(["moderator"]))return;let n=Cl.modal.get(Fy.id);n?(n.affiliation=t,n.render()):n=Cl.modal.create(Fy,{affiliation:t,jid:e.get("jid")}),n.show()}const n_=e=>{const t=vh("On which entity do you want to run commands?"),n=vh("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."),s=vh("Commands found"),i=vh("List available commands"),r=vh("XMPP Address"),o=vh("No commands found");return Qc`
${e.alert?Qc`<div class="alert alert-${e.alert_type}" role="alert">${e.alert}</div>`:""}
<form class="converse-form" @submit=${e.fetchCommands}>
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<label>
${t}
<p class="form-help">${n}</p>
<converse-autocomplete
.getAutoCompleteList="${Xy}"
placeholder="${r}"
name="jid"/>
</label>
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" value="${i}">
2021-03-19 19:26:15 +01:00
</fieldset>
2021-11-11 22:06:49 +01:00
${"list-commands"===e.view?Qc`
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<ul class="list-group">
<li class="list-group-item active">${e.commands.length?s:o}:</li>
${e.commands.map((t=>((e,t)=>Qc`
2021-03-19 19:26:15 +01:00
<li class="room-item list-group-item">
<div class="available-chatroom d-flex flex-row">
<a class="open-room available-room w-100"
@click=${e.toggleCommandForm}
data-command-node="${t.node}"
data-command-jid="${t.jid}"
data-command-name="${t.name}"
title="${t.name}"
href="#">${t.name||t.jid}</a>
</div>
2021-11-11 22:06:49 +01:00
${t.node===e.showform?((e,t)=>{const n=vh("Hide"),s=vh("Execute");return Qc`
2021-03-19 19:26:15 +01:00
<form @submit=${e.runCommand}>
2021-11-11 22:06:49 +01:00
${t.alert?Qc`<div class="alert alert-${t.alert_type}" role="alert">${t.alert}</div>`:""}
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
<input type="hidden" name="command_node" value="${t.node}"/>
<input type="hidden" name="command_jid" value="${t.jid}"/>
<p class="form-help">${t.instructions}</p>
2021-11-11 22:06:49 +01:00
${t.fields}
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset>
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" value="${s}">
2021-03-19 19:26:15 +01:00
<input type="button" class="btn btn-secondary button-cancel" value="${n}" @click=${e.hideCommandForm}>
</fieldset>
</form>
`})(e,t):""}
</li>
2021-11-11 22:06:49 +01:00
`)(e,t)))}
</ul>
</fieldset>`:""}
</form>
`},{Strophe:s_,$iq:i_,sizzle:r_,u:o_}=jl.env;Cl.elements.define("converse-adhoc-commands",class extends Uf{static get properties(){return{alert:{type:String},alert_type:{type:String},nonce:{type:String},showform:{type:String},view:{type:String}}}constructor(){super(),this.view="choose-service",this.showform="",this.commands=[]}render(){return n_({alert:this.alert,alert_type:this.alert_type,commands:this.commands,fetchCommands:e=>this.fetchCommands(e),hideCommandForm:e=>this.hideCommandForm(e),runCommand:e=>this.runCommand(e),showform:this.showform,toggleCommandForm:e=>this.toggleCommandForm(e),view:this.view})}async fetchCommands(e){e.preventDefault(),delete this.alert_type,delete this.alert;const t=new FormData(e.target).get("jid").trim();let n;try{n=await Cl.disco.supports(s_.NS.ADHOC,t)}catch(e){M.error(e)}if(n)try{this.commands=await Cl.adhoc.getCommands(t),this.view="list-commands"}catch(e){return M.error(e),this.alert_type="danger",this.alert=vh("Sorry, an error occurred while looking for commands on that entity."),this.commands=[],void M.error(e)}else this.alert_type="danger",this.alert=vh("The specified entity doesn't support ad-hoc commands")}async toggleCommandForm(e){e.preventDefault();const t=e.target.getAttribute("data-command-node"),n=this.commands.filter((e=>e.node===t))[0];this.showform!==t&&await async function(e){const t=e.node,n=e.jid,s=qy({type:"set",to:n}).c("command",{xmlns:Uy.NS.ADHOC,node:t,action:"execute"});try{var i;const t=await Cl.sendIQ(s),n=Hy(`command[xmlns="${Uy.NS.ADHOC}"]`,t).pop();e.sessionid=n.getAttribute("sessionid"),e.instructions=null===(i=Hy('x[type="form"][xmlns="jabber:x:data"] instructions',n).pop())||void 0===i?void 0:i.textContent,e.fields=Hy('x[type="form"][xmlns="jabber:x:data"] field',n).map((e=>Gy.xForm2TemplateResult(e,n)))}catch(t){null===t?M.error(`Error: timeout while trying to execute command for ${n}`):(M.error(`Error while trying to execute command for ${n}`),M.error(t)),e.fields=[]}}(n),this.showform=t}hideCommandForm(e){e.preventDefault(),this.showform=""}async runCommand(e){e.preventDefault();const t=new FormData(e.target),n=t.get("command_jid").trim(),s=t.get("command_node").trim(),i=this.commands.filter((e=>e.node===s))[0];i.alert=null,this.nonce=o_.getUniqueId();const r=r_(":input:not([type=button]):not([type=submit])",e.target).filter((e=>!["command_jid","command_node"].includes(e.getAttribute("name")))).map(o_.webForm2xForm).filter((e=>e)),o=i_({to:n,type:"set"}).c("command",{sessionid:i.sessionid,node:i.node,xmlns:s_.NS.ADHOC}).c("x",{xmlns:s_.NS.XFORM,type:"submit"});let a;r.forEach((e=>o.cnode(e).up()));try{a=await Cl.sendIQ(o)}catch(e){i.alert_type="danger",i.alert=vh("Sorry, an error occurred while trying to execute the command. See the developer console for details"),M.error("Error while trying to execute an ad-hoc command"),M.error(e)}var c;i.alert=a?null===(c=a.querySelector("note"))||void 0===c?void 0:c.textContent:"Done",i.alert_type="primary",this.nonce=o_.getUniqueId()}}),Cl.elements.define("converse-muc-message-form",class extends ub{toHTML(){var e,t;return(e=>{const t=e.composing_spoiler?vh("Hidden message"):vh("Message"),n=vh("Optional hint"),s=Cl.settings.get("show_send_button");return Qc`
<form class="setNicknameButtonForm hidden">
<input type="submit" class="btn btn-primary" name="join" value="Join"/>
</form>
<form class="sendXMPPMessage">
<input type="text" placeholder="${n||""}" value="${e.hint_value||""}" class="${e.composing_spoiler?"":"hidden"} spoiler-hint"/>
<div class="suggestion-box">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<textarea
autofocus
type="text"
@drop=${e.onDrop}
@input=${ab}
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea suggestion-box__input
${s?"chat-textarea-send-button":""}
${e.composing_spoiler?"spoiler":""}"
placeholder="${t}">${e.message_value||""}</textarea>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</form>`})(Object.assign(this.model.toJSON(),{hint_value:null===(e=this.querySelector(".spoiler-hint"))||void 0===e?void 0:e.value,message_value:null===(t=this.querySelector(".chat-textarea"))||void 0===t?void 0:t.value,onChange:e=>this.model.set({draft:e.target.value}),onDrop:e=>this.onDrop(e),onKeyDown:e=>this.onKeyDown(e),onKeyUp:e=>this.onKeyUp(e),onPaste:e=>this.onPaste(e),scrolled:this.model.ui.get("scrolled"),viewUnreadMessages:e=>this.viewUnreadMessages(e)}))}afterRender(){const e=this.model.session.get("connection_status")===jl.ROOMSTATUS.ENTERED,t=e&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());e&&t&&this.initMentionAutoComplete()}initMentionAutoComplete(){this.mention_auto_complete=new va.AutoComplete(this,{auto_first:!0,auto_evaluate:!1,min_chars:Cl.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==Cl.settings.get("muc_mention_autocomplete_filter")?va.FILTER_CONTAINS:va.FILTER_STARTSWITH,ac_triggers:["Tab","@"],include_triggers:[],item:Qy}),this.mention_auto_complete.on("suggestion-box-selectcomplete",(()=>this.auto_completing=!1))}parseMessageForCommands(e){return function(e,t){if(Cl.settings.get("muc_disable_slash_commands")&&!Array.isArray(Cl.settings.get("muc_disable_slash_commands")))return ob(e,t);const n=((t=t.replace(/^\s*/,"")).match(/^\/([a-zA-Z]*) ?/)||[""]).pop().toLowerCase();if(!n)return!1;const s=t.slice(("/"+n).length+1).trim();if(!e.getAllowedCommands().includes(n))return!1;switch(n){case"admin":e_(e,n,s,["owner"]);break;case"ban":e_(e,n,s,["admin","owner"]);break;case"modtools":t_(e,s);break;case"deop":Zy(e,n,s,["admin","owner"]);break;case"destroy":if(!e.verifyAffiliations(["owner"]))break;Jy(e).catch((t=>e.onCommandError(t)));break;case"help":e.set({show_help_messages:!1},{silent:!0}),e.set({show_help_messages:!0});break;case"kick":case"mute":Zy(e,n,s,[],["moderator"]);break;case"member":e_(e,n,s,["admin","owner"]);break;case"nick":if(!e.verifyRoles(["visitor","participant","moderator"]))break;if(0===s.length){const t=vh('Your nickname is "%1$s"',e.get("nick"));e.createMessage({message:t,type:"error"})}else{const t=Uy.getBareJidFromJid(e.get("jid"));Cl.send(By({from:va.connection.jid,to:`${t}/${s}`,id:Gy.getUniqueId()}).tree())}break;case"owner":e_(e,n,s,["owner"]);break;case"op":Zy(e,n,s,["admin","owner"]);break;case"register":s.length>1?e.createMessage({message:vh("Error: invalid number of arguments"),type:"error"}):e.registerNickname().then((t=>{t&&e.createMessage({message:t,type:"error"})}));break;case"revoke":e_(e,n,s,["admin","owner"]);break;case"topic":case"subject":e.setSubject(s);break;case"voice":Zy(e,n,s,[],["moderator"]);break;default:return ob(e,t)}return!0}(this.model,e)}getAutoCompleteList(){return this.model.getAllKnownNicknames().map((e=>({label:e,value:`@${e}`})))}onKeyDown(e){this.mention_auto_complete.onKeyDown(e)||super.onKeyDown(e)}onKeyUp(e){this.mention_auto_complete.evaluate(e),super.onKeyUp(e)}});const a_=e=>{const t=vh("Nickname"),n=vh("Enter groupchat"),s=Cl.settings.get("muc_show_logs_before_join")?vh("Choose a nickname to enter"):vh("Please choose your nickname"),i=e.get("nickname_validation_message");return Qc`
<div class="chatroom-form-container muc-nickname-form"
@submit=${t=>function(e,t){e.preventDefault();const n=e.target.nick.value.trim();n&&t.join(n)}(t,e)}>
<form class="converse-form chatroom-form converse-centered-form">
<fieldset class="form-group">
<label>${s}</label>
<p class="validation-message">${i}</p>
<input type="text"
required="required"
name="nick"
value="${e.get("nick")||""}"
class="form-control ${i?"error":""}"
placeholder="${t}"/>
</fieldset>
<fieldset class="form-group">
<input type="submit" class="btn btn-primary" name="join" value="${n}"/>
</fieldset>
</form>
</div>`};var c_=n(2490),l_={};l_.styleTagTransform=eg(),l_.setAttributes=Yf(),l_.insert=Jf().bind(null,"head"),l_.domAPI=Wf(),l_.insertStyleElement=Xf(),Hf()(c_.Z,l_),c_.Z&&c_.Z.locals&&c_.Z.locals,Cl.elements.define("converse-muc-bottom-panel",class extends fb{constructor(...e){var t,n,s;super(...e),s={"click .hide-occupants":"hideOccupants","click .send-button":"sendButtonClicked"},(n="events")in(t=this)?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s}async initialize(){await super.initialize(),this.listenTo(this.model,"change:hidden_occupants",this.debouncedRender),this.listenTo(this.model,"change:num_unread_general",this.debouncedRender),this.listenTo(this.model.features,"change:moderated",this.debouncedRender),this.listenTo(this.model.occupants,"add",this.renderIfOwnOccupant),this.listenTo(this.model.occupants,"change:role",this.renderIfOwnOccupant),this.listenTo(this.model.session,"change:connection_status",this.debouncedRender)}render(){const e=this.model.session.get("connection_status")===jl.ROOMSTATUS.ENTERED,t=e&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());tl((e=>{const t=vh("You have unread messages"),n=e.model.session.get("connection_status"),s=vh("You're not allowed to send messages in this room");return n===jl.ROOMSTATUS.ENTERED?Qc`
${e.model.ui.get("scrolled")&&e.model.get("num_unread_general")?Qc`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${e.can_edit?(e=>{const t=vh("You have unread messages"),n=Cl.settings.get("message_limit"),s=Cl.settings.get("visible_toolbar_buttons").call,i=Cl.settings.get("visible_toolbar_buttons").emoji,r=Cl.settings.get("show_send_button"),o=Cl.settings.get("visible_toolbar_buttons").spoiler,a=Cl.settings.get("show_toolbar");return Qc`
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?Qc`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${a?Qc`
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?composing_spoiler="${e.model.get("composing_spoiler")}"
?hidden_occupants="${e.model.get("hidden_occupants")}"
?is_groupchat="${e.is_groupchat}"
?show_call_button="${s}"
?show_emoji_button="${i}"
?show_send_button="${r}"
?show_spoiler_button="${o}"
?show_toolbar="${a}"
message_limit="${n}"></converse-chat-toolbar>`:""}
<converse-muc-message-form jid=${e.model.get("jid")}></converse-muc-message-form>`})(e):Qc`<span class="muc-bottom-panel muc-bottom-panel--muted">${s}</span>`}`:n!=jl.ROOMSTATUS.NICKNAME_REQUIRED?"":Cl.settings.get("muc_show_logs_before_join")?Qc`<span class="muc-bottom-panel muc-bottom-panel--nickname">${a_(e.model)}</span>`:void 0})({can_edit:t,entered:e,model:this.model,is_groupchat:!0,viewUnreadMessages:e=>this.viewUnreadMessages(e)}),this)}renderIfOwnOccupant(e){e.get("jid")===va.bare_jid&&this.debouncedRender()}sendButtonClicked(e){var t;null===(t=this.querySelector("converse-message-form"))||void 0===t||t.onFormSubmitted(e)}hideOccupants(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.save({hidden_occupants:!0})}});const d_={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"};var u_=n(1107),h_={};h_.styleTagTransform=eg(),h_.setAttributes=Yf(),h_.insert=Jf().bind(null,"head"),h_.domAPI=Wf(),h_.insertStyleElement=Xf(),Hf()(u_.Z,h_),u_.Z&&u_.Z.locals&&u_.Z.locals;const{u:m_}=jl.env;Cl.elements.define("converse-muc-sidebar",class extends Uf{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=va.chatboxes.get(this.jid),this.listenTo(this.model.occupants,"add",this.requestUpdate),this.listenTo(this.model.occupants,"remove",this.requestUpdate),this.listenTo(this.model.occupants,"change",this.requestUpdate),this.model.initialized.then((()=>this.requestUpdate()))}render(){return(e=>{const t=e=>vh("Click to mention %1$s in your message.",e.get("nick")),n=vh("Participants"),s=e.occupants.map((n=>(e=>{const t=vh("Owner"),n=vh("Admin"),s=vh("Member"),i=vh("Moderator"),r=vh("Visitor");return Qc`
<li class="occupant" id="${e.id}" title="${(e=>{const t=vh("This user is a moderator."),n=vh("This user can send messages in this groupchat."),s=vh("This user can NOT send messages in this groupchat."),i=`${e.jid} `||"";return"moderator"===e.role?`${i}${t} ${e.hint_occupant}`:"participant"===e.role?`${i}${n} ${e.hint_occupant}`:"visitor"===e.role?`${i}${s} ${e.hint_occupant}`:["visitor","participant","moderator"].includes(e.role)?void 0:`${i}${e.hint_occupant}`})(e)}">
<div class="row no-gutters">
<div class="col-auto">
<div class="occupant-status occupant-${e.show} circle" title="${e.hint_show}"></div>
</div>
<div class="col occupant-nick-badge">
<span class="occupant-nick" @click=${e.onOccupantClicked}>${e.nick||e.jid}</span>
<span class="occupant-badges">
${"owner"===e.affiliation?Qc`<span class="badge badge-groupchat">${t}</span>`:""}
${"admin"===e.affiliation?Qc`<span class="badge badge-info">${n}</span>`:""}
${"member"===e.affiliation?Qc`<span class="badge badge-info">${s}</span>`:""}
${"moderator"===e.role?Qc`<span class="badge badge-info">${i}</span>`:""}
${"visitor"===e.role?Qc`<span class="badge badge-secondary">${r}</span>`:""}
</span>
</div>
</div>
</li>
`})(Object.assign({jid:"",hint_show:d_[n.get("show")],hint_occupant:t(n),onOccupantClicked:e.onOccupantClicked},n.toJSON()))));return Qc`
<div class="occupants-header">
<i class="hide-occupants fa fa-times" @click=${e.closeSidebar}></i>
<div class="occupants-header--title">
<span class="occupants-heading">${n}</span>
</div>
</div>
<div class="dragresize dragresize-occupants-left"></div>
<ul class="occupant-list">${s}</ul>
`})(Object.assign(this.model.toJSON(),{occupants:[...this.model.occupants.models],closeSidebar:e=>this.closeSidebar(e),onOccupantClicked:e=>this.onOccupantClicked(e)}))}closeSidebar(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),m_.safeSave(this.model,{hidden_occupants:!0})}onOccupantClicked(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=va.chatboxviews.get(this.getAttribute("jid"));null==n||n.getBottomPanel().insertIntoTextArea(`@${e.target.textContent}`)}});const{u:f_}=jl.env;Cl.elements.define("converse-muc-chatarea",class extends Uf{static get properties(){return{jid:{type:String},show_help_messages:{type:Boolean},type:{type:String}}}connectedCallback(){super.connectedCallback(),this.initialize()}async initialize(){this.model=await Cl.rooms.get(this.jid),this.listenTo(this.model,"change:show_help_messages",(()=>this.requestUpdate())),this.listenTo(this.model,"change:hidden_occupants",(()=>this.requestUpdate())),this.listenTo(this.model.session,"change:connection_status",(()=>this.requestUpdate())),this.onMouseMove=this._onMouseMove.bind(this),this.onMouseUp=this._onMouseUp.bind(this),this.requestUpdate()}render(){return(e=>{var t;return Qc`
<div class="chat-area">
<div class="chat-content ${e.show_send_button?"chat-content-sendbutton":""}" aria-live="polite">
<converse-chat-content
class="chat-content__messages"
jid="${e.jid}"></converse-chat-content>
${null!==(t=e.model)&&void 0!==t&&t.get("show_help_messages")?Qc`<div class="chat-content__help">
<converse-chat-help
.model=${e.model}
.messages=${e.getHelpMessages()}
type="info"
chat_type="${va.CHATROOMS_TYPE}"
></converse-chat-help></div>`:""}
</div>
<converse-muc-bottom-panel jid="${e.jid}" class="bottom-panel"></converse-muc-bottom-panel>
</div>
<div class="disconnect-container hidden"></div>
${e.model?Qc`
<converse-muc-sidebar
class="occupants col-md-3 col-4 ${e.shouldShowSidebar()?"":"hidden"}"
style="flex: 0 0 ${e.model.get("occupants_width")}px"
jid=${e.jid}
@mousedown=${e.onMousedown}></converse-muc-sidebar>`:""}
`})({getHelpMessages:()=>this.getHelpMessages(),jid:this.jid,model:this.model,onMousedown:e=>this.onMousedown(e),show_send_button:va.show_send_button,shouldShowSidebar:()=>this.shouldShowSidebar(),type:this.type})}shouldShowSidebar(){return!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===jl.ROOMSTATUS.ENTERED}getHelpMessages(){const e=Cl.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return[`<strong>/admin</strong>: ${vh("Change user's affiliation to admin")}`,`<strong>/ban</strong>: ${vh("Ban user by changing their affiliation to outcast")}`,`<strong>/clear</strong>: ${vh("Clear the chat area")}`,`<strong>/close</strong>: ${vh("Close this groupchat")}`,`<strong>/deop</strong>: ${vh("Change user role to participant")}`,`<strong>/destroy</strong>: ${vh("Remove this groupchat")}`,`<strong>/help</strong>: ${vh("Show this menu")}`,`<strong>/kick</strong>: ${vh("Kick user from groupchat")}`,`<strong>/me</strong>: ${vh("Write in 3rd person")}`,`<strong>/member</strong>: ${vh("Grant membership to a user")}`,`<strong>/modtools</strong>: ${vh("Opens up the moderator tools GUI")}`,`<strong>/mute</strong>: ${vh("Remove user's ability to post messages")}`,`<strong>/nick</strong>: ${vh("Change your nickname")}`,`<strong>/op</strong>: ${vh("Grant moderator role to user")}`,`<strong>/owner</strong>: ${vh("Grant ownership of this groupchat")}`,`<strong>/register</strong>: ${vh("Register your nickname")}`,`<strong>/revoke</strong>: ${vh("Revoke the user's current affiliation")}`,`<strong>/subject</strong>: ${vh("Set groupchat subject")}`,`<strong>/topic</strong>: ${vh("Set groupchat subject (alias for /subject)")}`,`<strong>/voice</strong>: ${vh("Allow muted user to post messages")}`].filter((e=>t.every((t=>!e.startsWith(t+"<",9))))).filter((e=>this.model.getAllowedCommands().some((t=>e.startsWith(t+"<",9)))))}onMousedown(e){f_.hasClass("dragresize-occupants-left",e.target)&&this.onStartResizeOccupants(e)}onStartResizeOccupants(e){this.resizing=!0,this.addEventListener("mousemove",this.onMouseMove),this.addEventListener("mouseup",this.onMouseUp);const t=this.querySelector("converse-muc-sidebar"),n=window.getComputedStyle(t);this.width=parseInt(n.width.replace(/px$/,""),10),this.prev_pageX=e.pageX}_onMouseMove(e){if(this.resizing){e.preventDefault();const t=this.prev_pageX-e.pageX;this.resizeSidebarView(t,e.pageX),this.prev_pageX=e.pageX}}_onMouseUp(e){if(this.resizing){e.preventDefault(),this.resizing=!1,this.removeEventListener("mousemove",this.onMouseMove),this.removeEventListener("mouseup",this.onMouseUp);const t=this.querySelector("converse-muc-sidebar").getBoundingClientRect(),n=this.calculateSidebarWidth(t,0);f_.safeSave(this.model,{occupants_width:n})}}calculateSidebarWidth(e,t){let n=e.width+t;const s=this.clientWidth;return n<.2*s?(n=.2*s,this.is_minimum=!0):n>.75*s?(n=.75*s,this.is_maximum=!0):s-n<250?(n=s-250,this.is_maximum=!0):(this.is_maximum=!1,this.is_minimum=!1),n}resizeSidebarView(e,t){const n=this.querySelector("converse-muc-sidebar"),s=n.getBoundingClientRect();if(this.is_minimum)this.is_minimum=s.left<t;else if(this.is_maximum)this.is_maximum=s.left>t;else{const t=this.calculateSidebarWidth(s,e);n.style.flex="0 0 "+t+"px"}}});const{sizzle:g_}=jl.env,p_=jl.env.utils,{sizzle:v_}=jl.env,b_=jl.env.utils;Cl.elements.define("converse-muc-config-form",class extends Uf{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=va.chatboxes.get(this.jid),this.listenTo(this.model.features,"change:passwordprotected",this.requestUpdate),this.listenTo(this.model.session,"change:config_stanza",this.requestUpdate),this.getConfig()}render(){return(e=>{const t=Cl.settings.get("roomconfig_whitelist"),n=e.model.session.get("config_stanza");let s,i=[],r="";if(n){var o,a;const c=p_.toStanza(n);i=g_("field",c),t.length&&(i=i.filter((e=>t.includes(e.getAttribute("var")))));const l={new_password:!e.model.features.get("passwordprotected"),fixed_username:e.model.get("jid")};i=i.map((e=>p_.xForm2TemplateResult(e,c,l))),r=null===(o=c.querySele
<form class="converse-form chatroom-form ${i.length?"":"converse-form--spinner"}"
autocomplete="off"
@submit=${e.submitConfigForm}>
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<legend class="centered">${s}</legend>
${s!==r?Qc`<p class="form-help">${r}</p>`:""}
${i.length?i:Iv({classes:"hor_centered"})}
2021-03-19 19:26:15 +01:00
</fieldset>
2021-11-11 22:06:49 +01:00
${i.length?Qc`
<fieldset>
<input type="submit" class="btn btn-primary" value="${c}">
<input type="button" class="btn btn-secondary button-cancel" value="${l}" @click=${e.closeConfigForm}>
</fieldset>`:""}
</form>
`})({model:this.model,closeConfigForm:e=>this.closeForm(e),submitConfigForm:e=>this.submitConfigForm(e)})}async getConfig(){const e=await this.model.fetchRoomConfiguration();this.model.session.set("config_stanza",e.outerHTML)}async submitConfigForm(e){e.preventDefault();const t=v_(":input:not([type=button]):not([type=submit])",e.target).map(b_.webForm2xForm).filter((e=>e));try{await this.model.sendConfiguration(t)}catch(e){M.error(e);const t=vh("Sorry, an error occurred while trying to submit the config form.")+" "+vh("Check your browser's developer console for details.");Cl.alert("error",vh("Error"),t)}await this.model.refreshDiscoInfo(),this.closeForm()}closeForm(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.session.set("view",null)}});Cl.elements.define("converse-muc-destroyed",class extends Uf{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=va.chatboxes.get(this.jid)}render(){const e=this.model.get("destroyed_reason");return(e=>{const t=vh("This groupchat no longer exists"),n=vh('The following reason was given: "%1$s"',e.reason||"");return Qc`
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${t}</h3>
</div>
${e.reason?Qc`<p class="destroyed-reason">${n}</p>`:""}
${e.moved_jid?(e=>{const t=vh("The conversation has moved to a new address. Click the link below to enter.");return Qc`
<p class="moved-label">${t}</p>
<p class="moved-link">
<a class="switch-chat" @click=${t=>e.onSwitch(t)}>${e.moved_jid}</a>
</p>`})(e):""}
`})({moved_jid:this.model.get("moved_jid"),reason:e,onSwitch:e=>this.onSwitch(e)})}async onSwitch(e){e.preventDefault();const t=this.model.get("moved_jid");(await Cl.rooms.get(t,{},!0)).maybeShow(!0),this.model.destroy()}}),Cl.elements.define("converse-muc-disconnected",class extends Uf{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=va.chatboxes.get(this.jid)}render(){const e=this.model.session.get("disconnection_message");if(!e)return;const t=[e],n=this.model.session.get("disconnection_actor");n&&t.push(vh("This action was done by %1$s.",n));const s=this.model.session.get("disconnection_reason");return s&&t.push(vh('The reason given is: "%1$s".',s)),(e=>Qc`
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${e[0]}</h3>
${e.slice(1).map((e=>Qc`<p class="disconnect-msg">${e}</p>`))}
</div>`)(t)}});const y_=jl.env.utils,__=Kg.extend({id:"muc-invite-modal",initialize(){Kg.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.initInviteWidget()},toHTML(){return(e=>{const t=vh("Invite"),n=vh("Invite someone to this groupchat"),s=vh("user@example.org"),i=vh("Please enter a valid XMPP address"),r=vh("XMPP Address"),o=vh("Optional reason for the invitation");return Qc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="add-chatroom-modal-label">${n}</h5>
${Qg}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<div class="suggestion-box room-invite">
<form @submit=${e.submitInviteForm}>
<div class="form-group">
<label class="clearfix" for="invitee_jids">${r}:</label>
${e.invalid_invite_jid?Qc`<div class="error error-feedback">${i}</div>`:""}
<input class="form-control suggestion-box__input"
required="required"
name="invitee_jids"
id="invitee_jids"
placeholder="${s}"
type="text"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
<ul class="suggestion-box__results suggestion-box__results--below" hidden=""></ul>
</div>
<div class="form-group">
<label>${o}:</label>
<textarea class="form-control" name="reason"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">${t}</button>
</div>
</form>
</div>
</div>
</div>
</div>
`})(Object.assign(this.model.toJSON(),{submitInviteForm:e=>this.submitInviteForm(e)}))},initInviteWidget(){this.invite_auto_complete&&this.invite_auto_complete.destroy();const e=va.roster.map((e=>({label:e.getDisplayName(),value:e.get("jid")}))),t=this.el.querySelector(".suggestion-box").parentElement;this.invite_auto_complete=new va.AutoComplete(t,{min_chars:1,list:e})},submitInviteForm(e){e.preventDefault();const t=new FormData(e.target),n=t.get("invitee_jids"),s=t.get("reason");y_.isValidJID(n)?(this.chatroomview.model.directInvite(n,s),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}}),w_=Kg.extend({id:"muc-details-modal",initialize(){Kg.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.listenTo(this.model.features,"change",this.render),this.listenTo(this.model.occupants,"add",this.render),this.listenTo(this.model.occupants,"change",this.render)},toHTML(){return(e=>{const t=vh("Groupchat XMPP address"),n=vh("Message archiving"),s=vh("Messages are archived on the server"),i=vh("Description"),r=vh("Features"),o=vh("Hidden"),a=vh("This groupchat is not publicly searchable"),c=vh("This groupchat is restricted to members only"),l=vh("Members only"),d=vh("Moderated"),u=vh("Participants entering this groupchat need to request permission to write"),h=vh("Name"),m=vh("This groupchat does not require a password upon entry"),f=vh("No password required"),g=vh("Not anonymous"),p=vh("All other groupchat participants can see your XMPP address"),v=vh("Not moderated"),b=vh("Participants entering this groupchat can write right away"),y=vh("Online users"),_=vh("Open"),w=vh("Anyone can join this groupchat"),S=vh("This groupchat requires a password before entry"),x=vh("Password protected"),E=vh("Persistent"),A=vh("This groupchat persists even if it's unoccupied"),C=vh("Public"),T=vh("Semi-anonymous"),k=vh("Only moderators can see your XMPP address"),j=vh("Temporary"),N=vh("This groupchat will disappear once the last person leaves");return Qc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="muc-details-modal-label">${e.display_name}</h5>
${Qg}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<div class="room-info">
<p class="room-info"><strong>${h}</strong>: ${e.name}</p>
<p class="room-info"><strong>${t}</strong>: ${e.jid}</p>
<p class="room-info"><strong>${i}</strong>: ${e.config.description}</p>
${e.subject?(e=>{const t=vh("Topic"),n=vh("Topic author");return Qc`
<p class="room-info"><strong>${t}</strong>: ${e.subject.text}</p>
<p class="room-info"><strong>${n}</strong>: ${e.subject&&e.subject.author}</p>
`})(e):""}
<p class="room-info"><strong>${y}</strong>: ${e.num_occupants}</p>
<p class="room-info"><strong>${r}</strong>:
<div class="chatroom-features">
<ul class="features-list">
${e.features.passwordprotected?Qc`<li class="feature" ><span class="fa fa-lock"></span>${x} - <em>${S}</em></li>`:""}
${e.features.unsecured?Qc`<li class="feature" ><span class="fa fa-unlock"></span>${f} - <em>${m}</em></li>`:""}
${e.features.hidden?Qc`<li class="feature" ><span class="fa fa-eye-slash"></span>${o} - <em>${a}</em></li>`:""}
${e.features.public_room?Qc`<li class="feature" ><span class="fa fa-eye"></span>${C} - <em>${e.__("This groupchat is publicly searchable")}</em></li>`:""}
${e.features.membersonly?Qc`<li class="feature" ><span class="fa fa-address-book"></span>${l} - <em>${c}</em></li>`:""}
${e.features.open?Qc`<li class="feature" ><span class="fa fa-globe"></span>${_} - <em>${w}</em></li>`:""}
${e.features.persistent?Qc`<li class="feature" ><span class="fa fa-save"></span>${E} - <em>${A}</em></li>`:""}
${e.features.temporary?Qc`<li class="feature" ><span class="fa fa-snowflake-o"></span>${j} - <em>${N}</em></li>`:""}
${e.features.nonanonymous?Qc`<li class="feature" ><span class="fa fa-id-card"></span>${g} - <em>${p}</em></li>`:""}
${e.features.semianonymous?Qc`<li class="feature" ><span class="fa fa-user-secret"></span>${T} - <em>${k}</em></li>`:""}
${e.features.moderated?Qc`<li class="feature" ><span class="fa fa-gavel"></span>${d} - <em>${u}</em></li>`:""}
${e.features.unmoderated?Qc`<li class="feature" ><span class="fa fa-info-circle"></span>${v} - <em>${b}</em></li>`:""}
${e.features.mam_enabled?Qc`<li class="feature" ><span class="fa fa-database"></span>${n} - <em>${s}</em></li>`:""}
</ul>
</div>
</p>
</div>
</div>
<div class="modal-footer">${Yg}</div>
</div>
</div>
`})(Object.assign(this.model.toJSON(),{config:this.model.config.toJSON(),display_name:vh("Groupchat info for %1$s",this.model.getDisplayName()),features:this.model.features.toJSON(),num_occupants:this.model.occupants.length}))}});Cl.elements.define("converse-rich-text",class extends Uf{static get properties(){return{embed_audio:{type:Boolean},embed_videos:{type:Boolean},mentions:{type:Array},nick:{type:String},offset:{type:Number},onImgClick:{type:Function},onImgLoad:{type:Function},render_styling:{type:Boolean},show_images:{type:Boolean},hide_media_urls:{type:Boolean},show_me_message:{type:Boolean},text:{type:String}}}constructor(){super(),this.embed_audio=!1,this.embed_videos=!1,this.hide_media_urls=!1,this.mentions=[],this.offset=0,this.render_styling=!1,this.show_image_urls=!0,this.show_images=!1,this.show_me_message=!1}render(){const e={embed_audio:this.embed_audio,embed_videos:this.embed_videos,nick:this.nick,onImgClick:this.onImgClick,onImgLoad:this.onImgLoad,render_styling:this.render_styling,show_images:this.show_images,show_me_message:this.show_me_message,hide_media_urls:this.hide_media_urls};return sv(this.text,this.offset,this.mentions,e)}});var S_=n(679),x_={};x_.styleTagTransform=eg(),x_.setAttributes=Yf(),x_.insert=Jf().bind(null,"head"),x_.domAPI=Wf(),x_.insertStyleElement=Xf(),Hf()(S_.Z,x_),S_.Z&&S_.Z.locals&&S_.Z.locals,Cl.elements.define("converse-muc-heading",class extends mg{async connectedCallback(){super.connectedCallback(),this.model=va.chatboxes.get(this.getAttribute("jid")),this.debouncedRender=hc(this.render,100),this.listenTo(this.model,"change",this.debouncedRender);const e=await va.api.user.settings.getModel();this.listenTo(e,"change:mucs_with_hidden_subject",this.debouncedRender),await this.model.initialized,this.listenTo(this.model.features,"change:open",this.debouncedRender),this.model.occupants.forEach((e=>this.onOccupantAdded(e))),this.listenTo(this.model.occupants,"add",this.onOccupantAdded),this.listenTo(this.model.occupants,"change:affiliation",this.onOccupantAffiliationChanged),this.render()}async render(){const e=await this.generateHeadingTemplate();tl(e,this)}onOccupantAdded(e){e.get("jid")===va.bare_jid&&this.debouncedRender()}onOccupantAffiliationChanged(e){e.get("jid")===va.bare_jid&&this.debouncedRender()}showRoomDetailsModal(e){e.preventDefault(),Cl.modal.show(w_,{model:this.model},e)}showInviteModal(e){e.preventDefault(),Cl.modal.show(__,{model:new Zo,chatroomview:this},e)}toggleTopic(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.toggleSubjectHiddenState()}getAndRenderConfigurationForm(){this.model.session.set("view",jl.MUC.VIEWS.CONFIG)}close(e){e.preventDefault(),this.model.close()}destroy(e){e.preventDefault(),Jy(this.model)}getHeadingButtons(e){const t=[];t.push({i18n_text:vh("Details"),i18n_title:vh("Show more information about this groupchat"),handler:e=>this.showRoomDetailsModal(e),a_class:"show-muc-details-modal",icon_class:"fa-info-circle",name:"details"}),"owner"===this.model.getOwnAffiliation()&&t.push({i18n_text:vh("Configure"),i18n_title:vh("Configure this groupchat"),handler:()=>this.getAndRenderConfigurationForm(),a_class:"configure-chatroom-button",icon_class:"fa-wrench",name:"configure"}),this.model.invitesAllowed()&&t.push({i18n_text:vh("Invite"),i18n_title:vh("Invite someone to join this groupchat"),handler:e=>this.showInviteModal(e),a_class:"open-invite-modal",icon_class:"fa-user-plus",name:"invite"});const n=this.model.get("subject");if(n&&n.text&&t.push({i18n_text:vh(e?"Show topic":"Hide topic"),i18n_title:vh(e?"Show the topic message in the heading":"Hide the topic in the heading"),handler:e=>this.toggleTopic(e),a_class:"hide-topic",icon_class:"fa-minus-square",name:"toggle-topic"}),this.model.session.get("connection_status")===jl.ROOMSTATUS.ENTERED){const e=this.model.getAllowedCommands();e.includes("modtools")&&t.push({i18n_text:vh("Moderate"),i18n_title:vh("Moderate this groupchat"),handler:()=>t_(this.model),a_class:"moderate-chatroom-button",icon_class:"fa-user-cog",name:"moderate"}),e.includes("destroy")&&t.
<div class="chatbox-title ${i?"":"chatbox-title--no-desc"}">
${va.api.settings.get("singleton")?"":Qc`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
<div class="chatbox-title__text" title="${"hidden"!==va.locked_muc_domain?e.jid:""}">${e.title}
${e.bookmarked?Qc`<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="${n}"></i>`:""}
</div>
<div class="chatbox-title__buttons row no-gutters">
${e.standalone_btns.length?(e=>e.standalone_btns.reverse().map((e=>dp(e,""))))(e):""}
${e.dropdown_btns.length?Qc`<converse-dropdown class="dropleft" color="var(--chatroom-head-color)" .items=${e.dropdown_btns}></converse-dropdown>`:""}
</div>
</div>
${i?Qc`<p class="chat-head__desc" title="${t}">
<converse-rich-text text=${s} render_styling></converse-rich-text>
</p>`:""}
`})(Object.assign(this.model.toJSON(),{_converse:va,subject_hidden:e,dropdown_btns:s.map((e=>sb(e))),standalone_btns:n.map((e=>ib(e))),title:this.model.getDisplayName()}))}});Cl.elements.define("converse-muc-nickname-form",class extends Uf{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=va.chatboxes.get(this.jid)}render(){return a_(this.model)}});function E_(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Cl.elements.define("converse-muc-password-form",class extends Uf{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=va.chatboxes.get(this.jid),this.listenTo(this.model,"change:password_validation_message",this.render),this.render()}render(){return(e=>{const t=vh("This groupchat requires a password"),n=vh("Password: "),s=vh("Submit");return Qc`
<form class="converse-form chatroom-form converse-centered-form" @submit=${e.submitPassword}>
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<label>${t}</label>
<p class="validation-message">${e.validation_message}</p>
<input class="hidden-username" type="text" autocomplete="username" value="${e.jid}"></input>
<input type="password"
name="password"
required="required"
class="form-control ${e.validation_message?"error":""}"
placeholder="${n}"/>
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<input class="btn btn-primary" type="submit" value="${s}"/>
</fieldset>
2021-03-19 19:26:15 +01:00
</form>
2021-11-11 22:06:49 +01:00
`})({jid:this.model.get("jid"),submitPassword:e=>this.submitPassword(e),validation_message:this.model.get("password_validation_message")})}submitPassword(e){e.preventDefault();const t=this.querySelector("input[type=password]").value;this.model.join(this.model.get("nick"),t),this.model.set("password_validation_message",null)}});class A_ extends gb{constructor(...e){super(...e),E_(this,"length",300),E_(this,"is_chatroom",!0)}connectedCallback(){super.connectedCallback(),this.initialize()}async initialize(){this.model=await Cl.rooms.get(this.jid),va.chatboxviews.add(this.jid,this),this.setAttribute("id",this.model.get("box_id")),this.listenTo(va,"windowStateChanged",this.onWindowStateChanged),this.listenTo(this.model,"change:composing_spoiler",this.requestUpdateMessageForm),this.listenTo(this.model.session,"change:connection_status",this.onConnectionStatusChanged),this.listenTo(this.model.session,"change:view",this.requestUpdate),this.onConnectionStatusChanged(),this.model.maybeShow(),Cl.trigger("chatRoomViewInitialized",this)}render(){return(e=>Qc`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e.model?Qc`
<converse-muc-heading jid="${e.model.get("jid")}" class="chat-head chat-head-chatroom row no-gutters">
</converse-muc-heading>
<div class="chat-body chatroom-body row no-gutters">${function(e){const t=e.model.session.get("view"),n=e.model.get("jid"),s=jl.ROOMSTATUS,i=e.model.session.get("connection_status");return t===jl.MUC.VIEWS.CONFIG?Qc`<converse-muc-config-form class="muc-form-container" jid="${n}"></converse-muc-config-form>`:t===jl.MUC.VIEWS.BOOKMARK?Qc`<converse-muc-bookmark-form class="muc-form-container" jid="${n}"></converse-muc-bookmark-form>`:Qc`
${i==s.PASSWORD_REQUIRED?Qc`<converse-muc-password-form class="muc-form-container" jid="${n}"></converse-muc-password-form>`:""}
${i==s.ENTERED?Qc`<converse-muc-chatarea jid="${n}"></converse-muc-chatarea>`:""}
${i==s.CONNECTING?Iv():""}
${i==s.NICKNAME_REQUIRED?function(e){const t=e.get("jid");return Cl.settings.get("muc_show_logs_before_join")?Qc`<converse-muc-chatarea jid="${t}"></converse-muc-chatarea>`:Qc`<converse-muc-nickname-form jid="${t}"></converse-muc-nickname-form>`}(e.model):""}
${i==s.DISCONNECTED?Qc`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${i==s.BANNED?Qc`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${i==s.DESTROYED?Qc`<converse-muc-destroyed jid="${n}"></converse-muc-destroyed>`:""}
`}(e)}</div>
`:""}
</div>`)({model:this.model})}onConnectionStatusChanged(){this.model.session.get("connection_status")===jl.ROOMSTATUS.CONNECTING&&(this.model.session.save({disconnection_actor:void 0,disconnection_message:void 0,disconnection_reason:void 0}),this.model.save({moved_jid:void 0,password_validation_message:void 0,reason:void 0})),this.requestUpdate()}}Cl.elements.define("converse-muc",A_);var C_=n(1557),T_={};T_.styleTagTransform=eg(),T_.setAttributes=Yf(),T_.insert=Jf().bind(null,"head"),T_.domAPI=Wf(),T_.insertStyleElement=Xf(),Hf()(C_.Z,T_),C_.Z&&C_.Z.locals&&C_.Z.locals,jl.MUC.VIEWS={CONFIG:"config-form",BOOKMARK:"bookmark-form"},jl.plugins.add("converse-muc-views",{dependencies:["converse-modal","converse-controlbox","converse-chatview"],initialize(){const{_converse:e}=this;Cl.settings.extend({auto_list_rooms:!1,cache_muc_messages:!0,locked_muc_nickname:!1,modtools_disable_query:[],muc_disable_slash_commands:!1,muc_mention_autocomplete_filter:"contains",muc_mention_autocomplete_min_chars:0,muc_mention_autocomplete_show_avatar:!0,muc_roomid_policy:null,muc_roomid_policy_hint:null,roomconfig_whitelist:[],show_retraction_warning:!0,visible_toolbar_buttons:{toggle_occupants:!0}}),e.ChatRoomView=A_,Cl.listen.on("clearsession",(()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)})),Cl.listen.on("controlBoxInitialized",(e=>{Cl.settings.get("allow_muc")&&(Yy(e),e.model.on("change:connected",(()=>Yy(e))))})),Cl.listen.on("chatBoxClosed",(t=>{var n;t.get("type")===e.CHATROOMS_TYPE&&(n=t.get("jid"),va.router.history.getFragment()===`converse/room?jid=${n}`&&va.router.navigate(""))}))}});var k_=n(2329),j_=n.n(k_);const{Strophe:N_}=jl.env,O_="Notification"in window;let $_;function I_(e){var t;return va.isTestEnv()||((null===(t=va.chatboxes.get(e.from))||void 0===t?void 0:t.isHidden())??!1)}function M_(){return va.isTestEnv()||O_&&Cl.settings.get("show_desktop_notifications")&&"granted"===Notification.permission}function R_(){var e,t;$_=null,null===(e=(t=navigator).clearAppBadge)||void 0===e||e.call(t).catch((e=>M.error("Could not clear unread count in app badge "+e)))}function D_(){if(Cl.settings.get("show_tab_notifications")){var e,t;$_=$_??new jl.env.Favico({type:"circle",animation:"pop"});const n=va.chatboxes.models.reduce(((e,t)=>e+(t.get("num_unread")||0)),0);$_.badge(n),null===(e=(t=navigator).setAppBadge)||void 0===e||e.call(t,n).catch((e=>M.error("Could set unread count in app badge - "+e)))}}function L_(e,t,n){return e.reduce(((e,s)=>e||(e=>[va.bare_jid,`${t}/${n}`].includes(e.uri.replace(/^xmpp:/,"")))(s)),!1)}async function z_(e){if(!await function(e){const{attrs:t}=e;if(!t||t.is_forwarded)return!1;if("groupchat"===t.type)return async function(e){if(!(null!=e&&e.body||null!=e&&e.message))return!1;const t=e.from,n=e.from_muc,s=Cl.settings.get("notify_all_room_messages"),i=va.chatboxes.get(n),r=N_.getResourceFromJid(t),o=r&&N_.unescapeNode(r)||"";let a=!1;const c=i.get("nick");Cl.settings.get("notify_nicknames_without_references")&&(a=new RegExp(`\\b${c}\\b`).test(e.body));const l=o!==c,d=!0===s||Array.isArray(s)&&s.includes(n)||L_(e.references,n,c)||a;return!(!l||!d)&&await Cl.hook("shouldNotifyOfGroupMessage",e,!0)}(t);if("info"===t.type)return async function(e){if(!e.from_muc)return!1;const t=await Cl.rooms.get(e.from_muc);if(!t)return!1;const n=t.get("nick"),s=e.from_muc,i=Cl.settings.get("notify_all_room_messages");return!0===i||Array.isArray(i)&&i.includes(s)||L_(e.references,s,n)}(t);if(t.is_headline)return I_(t);const n=N_.getBareJidFromJid(t.from)===va.bare_jid;return!ea(t)&&!n&&("all"===Cl.settings.get("show_desktop_notifications")||I_(t))}(e))return!1;Cl.trigger("messageNotification",e),function(){if(Cl.settings.get("play_sounds")&&void 0!==window.Audio){const e=new Audio(Cl.settings.get("sounds_path")+"msg_received.ogg"),t=e.canPlayType("audio/ogg");if("probably"===t)return e.play();const n=new Audio(Cl.settings.get("sounds_path")+"msg_received.mp3"),s=n.canPlayType("audio/mp3");"probably"===s?n.play():"maybe"===t?e.play(
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="converse-modtools-modal-label">${t}</h5>
2021-11-11 22:06:49 +01:00
${Qg}
2021-03-19 19:26:15 +01:00
</div>
<div class="modal-body">
2021-11-11 22:06:49 +01:00
${i&&r?(e=>{const t=vh("About"),n=vh("Commands");return Qc`
2021-03-19 19:26:15 +01:00
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="about-tab" href="#about-tabpanel" aria-controls="about-tabpanel" role="tab" data-toggle="tab" @click=${e.switchTab}>${t}</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link" id="commands-tab" href="#commands-tabpanel" aria-controls="commands-tabpanel" role="tab" data-toggle="tab" @click=${e.switchTab}>${n}</a>
</li>
</ul>
`})(e):""}
<div class="tab-content">
<div class="tab-pane tab-pane--columns ${i?"active":""}"
id="about-tabpanel" role="tabpanel" aria-labelledby="about-tab">
<span class="modal-alert"></span>
<br/>
<div class="container">
<h6 class="brand-heading">Converse</h6>
<p class="brand-subtitle">${e.version_name}</p>
2021-11-11 22:06:49 +01:00
<p class="brand-subtitle">${Gv(No().sanitize(n))}</p>
<p class="brand-subtitle">${Gv(No().sanitize(s))}</p>
2021-03-19 19:26:15 +01:00
</div>
</div>
2021-11-11 22:06:49 +01:00
<div class="tab-pane tab-pane--columns ${!i&&r?"active":""}"
2021-03-19 19:26:15 +01:00
id="commands-tabpanel"
role="tabpanel"
aria-labelledby="commands-tab">
<converse-adhoc-commands/>
</div>
</div>
</div>
</div>
</div>
2021-11-11 22:06:49 +01:00
`})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{version_name:q_.VERSION_NAME}))}});Cl.elements.define("converse-user-profile",class extends Pg{async initialize(){this.model=va.xmppstatus,this.listenTo(this.model,"change",this.render),await Cl.waitUntil("VCardsInitialized"),this.listenTo(this.model.vcard,"change",this.render),this.render()}render(){const e=this.model.get("status")||"offline";var t;tl((e=>{const t=vh("Log out"),n=vh("Click to change your chat status"),s=vh("Show details about this chat client"),i=Cl.settings.get("show_client_info")||Cl.settings.get("allow_adhoc_commands");return Qc`
<div class="userinfo controlbox-padded">
<div class="controlbox-section profile d-flex">
<a class="show-profile" href="#" @click=${e.showProfileModal}>
<canvas class="avatar align-self-center" height="40" width="40"></canvas>
</a>
<span class="username w-100 align-self-center">${e.fullname}</span>
${i?Qc`<a class="controlbox-heading__btn show-client-info fa fa-cog align-self-center" title="${s}" @click=${e.showUserSettingsModal}></a>`:""}
${Cl.settings.get("allow_logout")?Qc`<a class="controlbox-heading__btn logout fa fa-sign-out-alt align-self-center" title="${t}" @click=${e.logout}></a>`:""}
</div>
<div class="d-flex xmpp-status">
<a class="change-status" title="${n}" data-toggle="modal" data-target="#changeStatusModal" @click=${e.showStatusChangeModal}>
<span class="${e.chat_status} w-100 align-self-center" data-value="${e.chat_status}">
<span class="
${"online"===e.chat_status&&"fa fa-circle chat-status chat-status--online"}
${"dnd"===e.chat_status&&"fa fa-minus-circle chat-status chat-status--busy"}
${"away"===e.chat_status&&"fa fa-circle chat-status chat-status--away"}
${"xa"===e.chat_status&&"far fa-circle chat-status chat-status--xa "}
${"offline"===e.chat_status&&"fa fa-circle chat-status chat-status--offline"}"></span> ${e.status_message}</span>
</a>
</div>
</div>
`})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{chat_status:e,fullname:this.model.vcard.get("fullname")||va.bare_jid,showUserSettingsModal:e=>this.showUserSettingsModal(e),status_message:this.model.get("status_message")||vh("I am %1$s",(t=e,"chat"===t?vh("online"):"dnd"===t?vh("busy"):"xa"===t?vh("away for long"):"away"===t?vh("away"):"offline"===t?vh("offline"):vh(t)||vh("online"))),logout:this.logout,showStatusChangeModal:()=>this.showStatusChangeModal(),showProfileModal:()=>this.showProfileModal()})),this),this.renderAvatar()}showProfileModal(e){null==e||e.preventDefault(),Cl.modal.show(va.ProfileModal,{model:this.model},e)}showStatusChangeModal(e){null==e||e.preventDefault(),Cl.modal.show(va.ChatStatusModal,{model:this.model},e)}showUserSettingsModal(e){null==e||e.preventDefault(),Cl.modal.show(H_,{model:this.model,_converse:va},e)}logout(e){null==e||e.preventDefault(),!0===confirm(vh("Are you sure you want to log out?"))&&Cl.user.logout()}});const G_=jl.env.utils,W_=Kg.extend({id:"modal-status-change",events:{"submit form#set-xmpp-status":"onFormSubmitted","click .clear-input":"clearStatusMessage"},toHTML(){return(e=>Qc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="changeStatusModalLabel">${e.modal_title}</h5>
${Qg}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form set-xmpp-status" id="set-xmpp-status">
<div class="form-group">
<div class="custom-control custom-radio">
<input ?checked=${"online"===e.status}
type="radio" id="radio-online" value="online" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-online">
<span class="fa fa-circle chat-status chat-status--online"></span>${e.label_online}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"busy"===e.status}
type="radio" id="radio-busy" value="dnd" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-busy">
<span class="fa fa-minus-circle chat-status chat-status--busy"></span>${e.label_busy}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"away"===e.status}
type="radio" id="radio-away" value="away" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-away">
<span class="fa fa-circle chat-status chat-status--away"></span>${e.label_away}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"xa"===e.status}
type="radio" id="radio-xa" value="xa" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-xa">
<span class="far fa-circle chat-status chat-status--xa"></span>${e.label_xa}</label>
</div>
</div>
<div class="form-group">
<div class="btn-group w-100">
<input name="status_message" type="text" class="form-control"
value="${e.status_message||""}" placeholder="${e.placeholder_status_message}"/>
<span class="clear-input fa fa-times ${e.status_message?"":"hidden"}"></span>
</div>
</div>
<button type="submit" class="btn btn-primary">${e.label_save}</button>
</form>
</div>
</div>
</div>
`)(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{label_away:vh("Away"),label_busy:vh("Busy"),label_cancel:vh("Cancel"),label_close:vh("Close"),label_custom_status:vh("Custom status"),label_offline:vh("Offline"),label_online:vh("Online"),label_save:vh("Save"),label_xa:vh("Away for long"),modal_title:vh("Change chat status"),placeholder_status_message:vh("Personal status message")}))},afterRender(){this.el.addEventListener("shown.bs.modal",(()=>{this.el.querySelector('input[name="status_message"]').focus()}),!1)},clearStatusMessage(e){e&&e.preventDefault&&(e.preventDefault(),G_.hideElement(this.el.querySelector(".clear-input"))),this.el.querySelector('input[name="status_message"]').value=""},onFormSubmitted(e){e.preventDefault();const t=new FormData(e.target);this.model.save({status_message:t.get("status_message"),status:t.get("chat_status")}),this.modal.hide()}});va.ChatStatusModal=W_;const V_=vh("Your profile picture");Cl.elements.define("converse-image-picker",class extends Uf{static get properties(){return{height:{type:Number},image:{type:String},width:{type:Number}}}render(){const e={height:this.height,image:this.image,width:this.width};return Qc`
<a class="change-avatar" @click=${this.openFileSelection} title="${V_}">
${_v(e)}
2021-03-19 19:26:15 +01:00
</a>
<input @change=${this.updateFilePreview} class="hidden" name="image" type="file"/>
2021-11-11 22:06:49 +01:00
`}openFileSelection(e){e.preventDefault(),this.querySelector('input[type="file"]').click()}updateFilePreview(e){const t=e.target.files[0],n=new FileReader;n.onloadend=()=>this.image=n.result,n.readAsDataURL(t)}});const J_=jl.env.utils,K_=e=>{var t;const n=vh("This device's OMEMO fingerprint"),s=vh("Generate new keys and fingerprint");return Qc`
<div class="tab-pane" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">
<form class="converse-form fingerprint-removal">
<ul class="list-group fingerprints">
<li class="list-group-item active">${n}</li>
<li class="list-group-item">
${e.view.current_device&&e.view.current_device.get("bundle")&&e.view.current_device.get("bundle").fingerprint?(e=>Qc`
<span class="fingerprint">${J_.formatFingerprint(e.view.current_device.get("bundle").fingerprint)}</span>`)(e):Iv()}
</li>
</ul>
<div class="form-group">
<button type="button" class="generate-bundle btn btn-danger">${s}</button>
</div>
${null!==(t=e.view.other_devices)&&void 0!==t&&t.length?(e=>{var t;const n=vh("Other OMEMO-enabled devices"),s=vh("Checkbox to select fingerprints of all other OMEMO devices"),i=vh("Remove checked devices and close"),r=vh("Select all");return Qc`
<ul class="list-group fingerprints">
<li class="list-group-item nopadding active">
<label>
<input type="checkbox" class="select-all" title="${r}" aria-label="${s}"/>
${n}
</label>
</li>
${null===(t=e.view.other_devices)||void 0===t?void 0:t.map((t=>(e=>Qc`
${e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=vh("Checkbox for selecting the following fingerprint");return Qc`
2021-03-19 19:26:15 +01:00
<li class="fingerprint-removal-item list-group-item nopadding">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${t}"/>
2021-11-11 22:06:49 +01:00
<span class="fingerprint">${J_.formatFingerprint(e.device.get("bundle").fingerprint)}</span>
2021-03-19 19:26:15 +01:00
</label>
</li>
2021-11-11 22:06:49 +01:00
`})(e):(e=>{const t=vh("Device without a fingerprint"),n=vh("Checkbox for selecting the following device");return Qc`
2021-03-19 19:26:15 +01:00
<li class="fingerprint-removal-item list-group-item nopadding">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${n}"/>
<span>${t}</span>
</label>
</li>
`})(e)}
2021-11-11 22:06:49 +01:00
`)(Object.assign({device:t},e))))}
2021-03-19 19:26:15 +01:00
</ul>
2021-11-11 22:06:49 +01:00
<div class="form-group"><button type="submit" class="save-form btn btn-primary">${i}</button></div>
2021-03-19 19:26:15 +01:00
`})(e):""}
</form>
2021-11-11 22:06:49 +01:00
</div>`},{sizzle:Y_}=converse.env,Q_=Kg.extend({id:"user-profile-modal",events:{"submit .profile-form":"onFormSubmitted"},initialize(){this.listenTo(this.model,"change",this.render),Kg.prototype.initialize.apply(this,arguments),Cl.trigger("profileModalInitialized",this.model)},toHTML(){return(e=>{const t=vh("Your Profile"),n=vh("Email"),s=vh("Full Name"),i=vh("XMPP Address"),r=vh("Nickname"),o=vh("Role"),a=vh("Save and close"),c=vh("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),l=vh("URL"),d=vh("OMEMO"),u=vh("Profile"),h=e.view.current_device?Qc`<ul class="nav nav-pills justify-content-center">
2021-03-19 19:26:15 +01:00
<li role="presentation" class="nav-item">
2021-11-11 22:06:49 +01:00
<a class="nav-link active" id="profile-tab" href="#profile-tabpanel" aria-controls="profile-tabpanel" role="tab" data-toggle="tab">${u}</a>
2021-03-19 19:26:15 +01:00
</li>
<li role="presentation" class="nav-item">
2021-11-11 22:06:49 +01:00
<a class="nav-link" id="omemo-tab" href="#omemo-tabpanel" aria-controls="omemo-tabpanel" role="tab" data-toggle="tab">${d}</a>
2021-03-19 19:26:15 +01:00
</li>
2021-11-11 22:06:49 +01:00
</ul>`:"";return Qc`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="user-profile-modal-label">${t}</h5>
2021-11-11 22:06:49 +01:00
${Qg}
2021-03-19 19:26:15 +01:00
</div>
<div class="modal-body">
<span class="modal-alert"></span>
2021-11-11 22:06:49 +01:00
${va.pluggable.plugins["converse-omemo"].enabled(va)&&h||""}
2021-03-19 19:26:15 +01:00
<div class="tab-content">
<div class="tab-pane active" id="profile-tabpanel" role="tabpanel" aria-labelledby="profile-tab">
<form class="converse-form converse-form--modal profile-form" action="#">
<div class="row">
<div class="col-auto">
<converse-image-picker image="${e.image}" width="${e.width}" height="${e.height}"></converse-image-picker>
</div>
<div class="col">
<div class="form-group">
<label class="col-form-label">${i}:</label>
<div>${e.jid}</div>
</div>
</div>
</div>
<div class="form-group">
2021-11-11 22:06:49 +01:00
<label for="vcard-fullname" class="col-form-label">${s}:</label>
2021-03-19 19:26:15 +01:00
<input id="vcard-fullname" type="text" class="form-control" name="fn" value="${e.fullname||""}"/>
</div>
<div class="form-group">
2021-11-11 22:06:49 +01:00
<label for="vcard-nickname" class="col-form-label">${r}:</label>
2021-03-19 19:26:15 +01:00
<input id="vcard-nickname" type="text" class="form-control" name="nickname" value="${e.nickname||""}"/>
</div>
<div class="form-group">
<label for="vcard-url" class="col-form-label">${l}:</label>
<input id="vcard-url" type="url" class="form-control" name="url" value="${e.url||""}"/>
</div>
<div class="form-group">
<label for="vcard-email" class="col-form-label">${n}:</label>
<input id="vcard-email" type="email" class="form-control" name="email" value="${e.email||""}"/>
</div>
<div class="form-group">
<label for="vcard-role" class="col-form-label">${o}:</label>
<input id="vcard-role" type="text" class="form-control" name="role" value="${e.role||""}" aria-describedby="vcard-role-help"/>
<small id="vcard-role-help" class="form-text text-muted">${c}</small>
</div>
<hr/>
<div class="form-group">
<button type="submit" class="save-form btn btn-primary">${a}</button>
</div>
</form>
</div>
2021-11-11 22:06:49 +01:00
${va.pluggable.plugins["converse-omemo"].enabled(va)&&K_(e)||""}
2021-03-19 19:26:15 +01:00
</div>
</div>
</div>
</div>
2021-11-11 22:06:49 +01:00
`})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),this.getAvatarData(),{view:this}))},getAvatarData(){return{height:128,width:128,image:"data:"+this.model.vcard.get("image_type")+";base64,"+this.model.vcard.get("image")}},afterRender(){this.tabs=Y_(".nav-item .nav-link",this.el).map((e=>new(Hg().Tab)(e)))},async setVCard(e){try{await Cl.vcard.set(va.bare_jid,e)}catch(e){return M.fatal(e),void this.alert([vh("Sorry, an error happened while trying to save your profile data."),vh("You can check your browser's developer console for any error output.")].join(" "))}this.modal.hide()},onFormSubmitted(e){e.preventDefault();const t=new FileReader,n=new FormData(e.target),s=n.get("image"),i={fn:n.get("fn"),nickname:n.get("nickname"),role:n.get("role"),email:n.get("email"),url:n.get("url")};s.size?(t.onloadend=()=>{Object.assign(i,{image:btoa(t.result),image_type:s.type}),this.setVCard(i)},t.readAsBinaryString(s)):(Object.assign(i,{image:this.model.vcard.get("image"),image_type:this.model.vcard.get("image_type")}),this.setVCard(i))}});va.ProfileModal=Q_,jl.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews"],initialize(){Cl.settings.extend({allow_adhoc_commands:!0,show_client_info:!0})}});const X_={aac:"audio/aac",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",cda:"application/x-cdf",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",m4a:"audio/mp4",mid:"audio/midi",midi:"audio/midi",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",png:"image/png",pdf:"application/pdf",php:"application/x-httpd-php",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",rar:"application/vnd.rar",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"text/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2","7z":"application/x-7z-compressed"},Z_={name:"AES-GCM",length:128},{u:ew}=jl.env;function tw(e,t){const n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer}function nw(e){return Array.prototype.map.call(new Uint8Array(e),(e=>("00"+e.toString(16)).slice(-2))).join("")}function sw(e){return new TextDecoder("utf-8").decode(e)}function iw(e){return new TextEncoder("utf-8").encode(e).buffer}function rw(e){return btoa(new Uint8Array(e).reduce(((e,t)=>e+String.fromCharCode(t)),""))}function ow(e){const t=window.atob(e),n=t.length,s=new Uint8Array(n);for(let e=0;e<n;e++)s[e]=t.charCodeAt(e);return s.buffer}function aw(e){return new Uint8Array(e.match(/[\da-f]{2}/gi).map((e=>parseInt(e,16)))).buffer}Object.assign(ew,{arrayBufferToHex:nw,arrayBufferToString:sw,stringToArrayBuffer:iw,ar
<button class="toggle-omemo" title="${i}" data-disabled=${!n.get("omemo_supported")} @click=${jw}>
<converse-icon
class="fa ${n.get("omemo_active")?"fa-lock":"fa-unlock"}"
path-prefix="${Cl.settings.get("assets_path")}"
size="1em"
color="${r}"
></converse-icon>
</button>
`),t}const Ow={async sendMessage(e){var t;if(this.get("omemo_active")&&null!==(t=e)&&void 0!==t&&t.body){var n;const t=null===(n=e)||void 0===n?void 0:n.body;let s,i;(e=this.getOutgoingMessageAttributes(e)).is_encrypted=!0,e.plaintext=t;try{const t=await async function(e){const t=vh("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===va.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map((e=>Ew(e.get("jid")))));n=t.reduce(((e,t)=>function(){var e=arguments.length;if(!e)return[];for(var t=Array(e-1),n=arguments[0],s=e;s--;)t[s-1]=arguments[s];return Xt(ot(n)?_i(n):[n],Ao(t,1))}(e,t.models)),[])}else if(e.get("type")===va.PRIVATE_CHAT_TYPE){const s=await Ew(e.get("jid"));if(0===s.length){const e=new Error(t);throw e.user_facing=!0,e}const i=va.devicelists.get(va.bare_jid).devices;n=[...i.models,...s.models]}const s=va.omemo_store.get("device_id");n=n.filter((e=>e.get("id")!==s)),await Promise.all(n.map((e=>e.getBundle())));const i=n.filter((e=>e)).map((e=>async function(e){if(!e.get("bundle"))return M.error(`Could not build an OMEMO session for device ${e.get("id")} because we don't have its bundle`),null;const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=await va.omemo_store.loadSession(t.toString());if(n)return n;try{return await async function(e){const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=new libsignal.SessionBuilder(va.omemo_store,t),s=e.getRandomPreKey(),i=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:ow(i.identity_key),signedPreKey:{keyId:i.signed_prekey.id,publicKey:ow(i.signed_prekey.public_key),signature:ow(i.signed_prekey.signature)},preKey:{keyId:s.id,publicKey:ow(s.key)}})}(e)}catch(t){return M.error(`Could not build an OMEMO session for device ${e.get("id")}`),M.error(t),null}}(e)));if(await Promise.all(i),i.includes(null)&&(n=n.filter((e=>i[n.indexOf(e)])),0===n.length)){const e=new Error(t);throw e.user_facing=!0,e}return n}(this);s=await this.createMessage(e),i=await function(e,t,n){const s=vh("This is an OMEMO encrypted message which your client doesnt seem to support. Find more information on https://conversations.im/omemo");if(!t.get("message"))throw new Error("No message body to encrypt!");const i=cw({from:va.connection.jid,to:e.get("jid"),type:e.get("message_type"),id:t.get("msgid")}).c("body").t(s).up();return"chat"===t.get("type")&&i.c("request",{xmlns:lw.NS.RECEIPTS}).up(),i.c("encrypted",{xmlns:lw.NS.OMEMO}).c("header",{sid:va.omemo_store.get("device_id")}),mw.encryptMessage(t.get("message")).then((t=>{const s=n.filter((e=>-1!=e.get("trusted")&&e.get("active"))).map((n=>e.encryptKey(t.key_and_tag,n)));return Promise.all(s).then((e=>function(e,t,n){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const i=t[s].payload,r=t[s].device,o=3==parseInt(i.type,10);e.c("key",{rid:r.get("id")}).t(btoa(i.body)),o&&e.attrs({prekey:o}),e.up(),s==t.length-1&&e.c("iv").t(n).up().up()}return Promise.resolve(e)}(i,e,t.iv))).then((e=>(e.c("payload").t(t.payload).up().up(),e.c("store",{xmlns:lw.NS.HINTS}).up(),e.c("encryption",{xmlns:lw.NS.EME,namespace:lw.NS.OMEMO}),e)))}))}(this,s,t)}catch(e){return this.handleMessageSendError(e),null}return va.api.send(i),s}return this.__super__.sendMessage.apply(this,arguments)}},$w={generateFingerprints:async function(e){const t=await Ew(e);return Promise.all(t.map((e=>xw(e))))},getDeviceForContact:function(e,t){return Ew(e).then((e=>e.get(t)))},contactHasOMEMOSupport:async function(e){return(await Ew(e)).length>0}};class Iw extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}const{Strophe:Mw,sizzle:Rw,u:Dw,$iq:Lw}=jl.env,zw=Zo.extend({defaults:{trusted:0,active:!0},getRandomPreKey(){const e=this.get("bundle");return e.prekeys[Dw.getRandomInt(e.prekeys.length)]},async fetchBundleFromServer(){const e=Lw({type:"get",from:va.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:Mw.NS.PUBSUB}).c("items",{node:`${Mw.NS.OMEMO_BUNDLES}:${this.get("id")}`});let t;try{t=await Cl.sendIQ(e)}catch(t){ret
<converse-brand-logo></converse-brand-logo>
${0===e.model.get("registration_status")?(()=>{const e=Cl.settings.get("registration_domain"),t=vh("Create your account"),n=vh("Please enter the XMPP provider to register with:");return Qc`
<form id="converse-register" class="converse-form">
<legend class="col-form-label">${t}</legend>
<div class="form-group">
<label>${n}</label>
<div class="form-errors hidden"></div>
${e||(()=>{const e=Cl.settings.get("domain_placeholder"),t=vh("Tip: A list of public XMPP providers is available"),n=vh("here"),s=Cl.settings.get("providers_link");return Qc`
<input class="form-control" required="required" type="text" name="domain" placeholder="${e}" />
<p class="form-text text-muted">
${t}
<a href="${s}" class="url" target="_blank" rel="noopener">${n}</a>.
</p>
`})()}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
${e?"":(()=>{const e=vh("Fetch registration form"),t=vh("Already have a chat account?"),n=vh("Log in here");return Qc`
<fieldset class="form-group buttons">
<input class="btn btn-primary" type="submit" value="${e}" />
</fieldset>
<div class="switch-form">
<p>${t}</p>
<p><a class="login-here toggle-register-login" href="#converse/login">${n}</a></p>
</div>
`})()}
</form>
`})():""}
${1===e.model.get("registration_status")?(()=>{const e=Cl.settings.get("registration_domain"),t=vh("Hold tight, we're fetching the registration form…"),n=vh("Cancel");return Qc`
<form id="converse-register" class="converse-form no-scrolling">
${Iv({classes:"hor_centered"})}
<p class="info">${t}</p>
${e?"":Qc`
<button class="btn btn-secondary button-cancel hor_centered">${n}</button>
`}
</form>
`})():""}
${2===e.model.get("registration_status")?(e=>{const t=vh("Choose a different provider"),n=vh("Already have a chat account?"),s=vh("Account Registration:"),i=vh("Log in here"),r=vh("Register"),o=Cl.settings.get("registration_domain");return Qc`
<form id="converse-register" class="converse-form">
<legend class="col-form-label">${s} ${e.domain}</legend>
<p class="title">${e.title}</p>
<p class="form-help instructions">${e.instructions}</p>
<div class="form-errors hidden"></div>
${e.form_fields}
<fieldset class="buttons form-group">
${e.fields?Qc`
<input type="submit" class="btn btn-primary" value="${r}" />
`:""}
${o?"":Qc`
<input
type="button"
class="btn btn-secondary button-cancel"
value="${t}"
/>
`}
<div class="switch-form">
<p>${n}</p>
<p><a class="login-here toggle-register-login" href="#converse/login">${i}</a></p>
</div>
</fieldset>
</form>
`})(e):""}
`;function gS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Strophe:pS,sizzle:vS,$iq:bS}=jl.env,yS=jl.env.utils,_S=1,wS=2;Cl.elements.define("converse-register-panel",class extends mg{constructor(...e){super(...e),gS(this,"id","converse-register-panel"),gS(this,"className","controlbox-pane fade-in"),gS(this,"events",{"submit form#converse-register":"onFormSubmission","click .button-cancel":"renderProviderChoiceForm"})}initialize(){this.reset();const e=va.chatboxes.get("controlbox");this.model=e,this.listenTo(va,"connectionInitialized",this.registerHooks),this.listenTo(this.model,"change:registration_status",this.render);const t=Cl.settings.get("registration_domain");t?this.fetchRegistrationForm(t):this.model.set("registration_status",0)}render(){tl(fS({domain:this.domain,fields:this.fields,form_fields:this.form_fields,instructions:this.instructions,model:this.model,title:this.title}),this)}registerHooks(){const e=va.connection,t=e._connect_cb.bind(e);e._connect_cb=(e,n,s)=>{this._registering?this.getRegistrationFields(e,n)&&(this._registering=!1):t(e,n,s)}}connectedCallback(){super.connectedCallback(),this.render()}getRegistrationFields(e,t){const n=va.connection;n.connected=!0;const s=n._proto._reqToData(e);if(!s)return;if(n._proto._connect_cb(s)===pS.Status.CONNFAIL)return this.showValidationError(vh("Sorry, we're unable to connect to your chosen provider.")),!1;const i=s.getElementsByTagName("register"),r=s.getElementsByTagName("mechanism");if(0===i.length&&0===r.length)return n._proto._no_auth_received(t),!1;if(0===i.length)return n._changeConnectStatus(pS.Status.REGIFAIL),this.showValidationError(vh("Sorry, the given provider does not support in band account registration. Please try with a different provider.")),!0;n._addSysHandler(this.onRegistrationFields.bind(this),null,"iq",null,null);const o=bS({type:"get"}).c("query",{xmlns:pS.NS.REGISTER}).tree();return o.setAttribute("id",n.getUniqueId("sendIQ")),n.send(o),n.connected=!1,!0}onRegistrationFields(e){return"error"===e.getAttribute("type")?(va.connection._changeConnectStatus(pS.Status.REGIFAIL,vh('Something went wrong while establishing a connection with "%1$s". Are you sure it exists?',this.domain)),!1):1!==e.getElementsByTagName("query").length?(va.connection._changeConnectStatus(pS.Status.REGIFAIL,"unknown"),!1):(this.setFields(e),this.model.get("registration_status")===_S&&this.renderRegistrationForm(e),!1)}reset(e){const t={fields:{},urls:[],title:"",instructions:"",registered:!1,_registering:!1,domain:null,form_type:null};Object.assign(this,t),e&&Object.assign(this,ko(e,Object.keys(t)))}onFormSubmission(e){e&&e.preventDefault&&e.preventDefault(),null===e.target.querySelector("input[name=domain]")?this.submitRegistrationForm(e.target):this.onProviderChosen(e.target)}onProviderChosen(e){const t=e.querySelector("input[name=domain]"),n=null==t?void 0:t.value;n?(e.querySelector("input[type=submit]").classList.add("hidden"),this.fetchRegistrationForm(n.trim())):t.classList.add("error")}async fetchRegistrationForm(e){var t;return this.model.set("registration_status",_S),this.reset({domain:pS.getDomainFromJid(e),_registering:!0}),await va.initConnection(this.domain),null===(t=va.connection)||void 0===t||t.connect(this.domain,"",(e=>this.onConnectStatusChanged(e))),!1}giveFeedback(e,t){let n=this.querySelector(".reg-feedback");null!==n&&n.parentNode.removeChild(n);const s=this.querySelector("form");s.insertAdjacentHTML("afterbegin",'<span class="reg-feedback"></span>'),n=s.querySelector(".reg-feedback"),n.textContent=e,t&&n.classList.add(t)}showSpinner(){const e=this.querySelector("form");return tl(Iv(),e),this}onConnectStatusChanged(e){M.debug("converse-register: onConnectStatusChanged"),[pS.Status.DISCONNECTED,pS.Status.CONNFAIL,pS.Status.REGIFAIL,pS.Status.NOTACCEPTABLE,pS.Status.CONFLICT].includes(e)?(M.error(`Problem during registration: Strophe.Status is ${va.CONNECTION_STATUS[e]}`),this.abortRegistration()):e===pS.Status.REGISTERED&&(M.debug("Registered successfully."),va.connection.re
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="add-chatroom-modal-label">${n}</h5>
${Qg}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form add-chatroom">
<div class="form-group">
<label for="chatroom">${e.label_room_address}:</label>
${e.muc_roomid_policy_error_msg?Qc`<label class="roomid-policy-error">${e.muc_roomid_policy_error_msg}</label>`:""}
<input type="text" required="required" name="chatroom" class="form-control roomjid-input" placeholder="${e.chatroom_placeholder}"/>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
${e.muc_roomid_policy_hint?Qc`<div class="form-group">${Gv(No().sanitize(e.muc_roomid_policy_hint,{ALLOWED_TAGS:["b","br","em"]}))}</div>`:""}
${e._converse.locked_muc_nickname?"":(e=>{const t=vh("Nickname"),n=vh("This field is required");return Qc`
<div class="form-group" >
<label for="nickname">${t}:</label>
<input type="text" title="${n}" required="required" name="nickname" value="${e.nick||""}" class="form-control"/>
</div>
`})(e)}
<input type="submit" class="btn btn-primary" name="join" value="${t||""}" ?disabled=${e.muc_roomid_policy_error_msg}>
</form>
</div>
</div>
</div>
`})(Object.assign(this.model.toJSON(),{_converse:va,label_room_address:Cl.settings.get("muc_domain")?vh("Groupchat name"):vh("Groupchat address"),chatroom_placeholder:e,muc_roomid_policy_error_msg:this.muc_roomid_policy_error_msg,muc_roomid_policy_hint:Cl.settings.get("muc_roomid_policy_hint")}))},afterRender(){this.el.addEventListener("shown.bs.modal",(()=>{this.el.querySelector('input[name="chatroom"]').focus()}),!1)},parseRoomDataFromEvent(e){const t=new FormData(e),n=t.get("chatroom");let s;if(Cl.settings.get("locked_muc_nickname")){if(s=va.getDefaultMUCNickname(),!s)throw new Error("Using locked_muc_nickname but no nickname found!")}else s=t.get("nickname").trim();return{jid:n,nick:s}},openChatRoom(e){e.preventDefault();const t=this.parseRoomDataFromEvent(e.target);let n;""===t.nick&&(t.nick=void 0),Cl.settings.get("locked_muc_domain")||Cl.settings.get("muc_domain")&&!ES.isValidJID(t.jid)?n=`${AS.escapeNode(t.jid)}@${Cl.settings.get("muc_domain")}`:(n=t.jid,this.model.setDomain(n)),Cl.rooms.open(n,Object.assign(t,{jid:n}),!0),this.modal.hide(),e.target.reset()},checkRoomidPolicy(){if(Cl.settings.get("muc_roomid_policy")&&Cl.settings.get("muc_domain")){let e=this.el.querySelector(".roomjid-input").value;!jl.locked_muc_domain&&ES.isValidJID(e)||(e=`${AS.escapeNode(e)}@${Cl.settings.get("muc_domain")}`);const t=AS.getNodeFromJid(e),n=AS.getDomainFromJid(e);Cl.settings.get("muc_domain")!==n||Cl.settings.get("muc_roomid_policy").test(t)?this.muc_roomid_policy_error_msg=null:this.muc_roomid_policy_error_msg=vh("Groupchat id is invalid."),this.render()}}}),TS=function(e){return e&&e.length?e[0]:void 0},{Strophe:kS,$iq:jS,sizzle:NS}=jl.env,OS=jl.env.utils;const $S=Kg.extend({id:"muc-list-modal",persistent:!0,initialize(){this.items=[],this.loading_items=!1,Kg.prototype.initialize.apply(this,arguments),Cl.settings.get("muc_domain")&&!this.model.get("muc_domain")&&this.model.save("muc_domain",Cl.settings.get("muc_domain")),this.listenTo(this.model,"change:muc_domain",this.onDomainChange),this.el.addEventListener("shown.bs.modal",(()=>Cl.settings.get("locked_muc_domain")?this.updateRoomsList():this.el.querySelector('input[name="server"]').focus()))},toHTML(){const e=this.model.get("muc_domain")||Cl.settings.get("muc_domain");return(e=>{const t=vh("Query for Groupchats");return Qc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="muc-list-modal-label">${t}</h5>
${Qg}
</div>
<div class="modal-body d-flex flex-column">
<span class="modal-alert"></span>
${e.show_form?(e=>{const t=vh("Show groupchats"),n=vh("Server address");return Qc`
<form class="converse-form list-chatrooms"
@submit=${e.submitForm}>
<div class="form-group">
<label for="chatroom">${n}:</label>
<input type="text"
@change=${e.setDomainFromEvent}
value="${e.muc_domain||""}"
required="required"
name="server"
class="form-control"
placeholder="${e.server_placeholder}"/>
</div>
<input type="submit" class="btn btn-primary" name="list" value="${t}"/>
</form>
`})(e):""}
<ul class="available-chatrooms list-group">
${e.loading_items?Qc`<li class="list-group-item"> ${Iv()} </li>`:""}
${e.feedback_text?Qc`<li class="list-group-item active">${e.feedback_text}</li>`:""}
${jg(e.items,(e=>e.jid),(t=>((e,t)=>{const n=vh("Show more information on this groupchat"),s=vh("Click to open this groupchat");return Qc`
<li class="room-item list-group-item">
<div class="available-chatroom d-flex flex-row">
<a class="open-room available-room w-100"
@click=${e.openRoom}
data-room-jid="${t.jid}"
data-room-name="${t.name}"
title="${s}"
href="#">${t.name||t.jid}</a>
<a class="right room-info icon-room-info"
@click=${e.toggleRoomInfo}
data-room-jid="${t.jid}"
title="${n}"
href="#"></a>
</div>
</li>
`})(e,t)))}
</ul>
</div>
<div class="modal-footer">${Yg}</div>
2021-03-19 19:26:15 +01:00
</div>
</div>
2021-11-11 22:06:49 +01:00
`})(Object.assign(this.model.toJSON(),{show_form:!Cl.settings.get("locked_muc_domain"),server_placeholder:e||vh("conference.example.org"),items:this.items,loading_items:this.loading_items,openRoom:e=>this.openRoom(e),setDomainFromEvent:e=>this.setDomainFromEvent(e),submitForm:e=>this.showRooms(e),toggleRoomInfo:e=>this.toggleRoomInfo(e)}))},openRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid"),n=e.target.getAttribute("data-room-name");this.modal.hide(),Cl.rooms.open(t,{name:n},!0)},toggleRoomInfo(e){e.preventDefault(),function(e){const t=OS.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(OS.slideIn(n).then(OS.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",OS.getElementFromTemplateResult(Iv())),Cl.disco.info(e.target.getAttribute("data-room-jid"),null).then((e=>function(e,t){var n,s;e.querySelector("span.spinner").remove(),e.querySelector("a.room-info").classList.add("selected"),e.insertAdjacentHTML("beforeEnd",OS.getElementFromTemplateResult((e=>{const t=vh("Description:"),n=vh("Groupchat XMPP Address:"),s=vh("Participants:"),i=vh("Features:"),r=vh("Requires authentication"),o=vh("Hidden"),a=vh("Requires an invitation"),c=vh("Moderated"),l=vh("Non-anonymous"),d=vh("Open"),u=vh("Permanent"),h=vh("Public"),m=vh("Semi-anonymous"),f=vh("Temporary"),g=vh("Unmoderated");return Qc`
<div class="room-info">
<p class="room-info"><strong>${n}</strong> ${e.jid}</p>
<p class="room-info"><strong>${t}</strong> ${e.desc}</p>
<p class="room-info"><strong>${s}</strong> ${e.occ}</p>
<p class="room-info"><strong>${i}</strong>
<ul>
${e.passwordprotected?Qc`<li class="room-info locked">${r}</li>`:""}
${e.hidden?Qc`<li class="room-info">${o}</li>`:""}
${e.membersonly?Qc`<li class="room-info">${a}</li>`:""}
${e.moderated?Qc`<li class="room-info">${c}</li>`:""}
${e.nonanonymous?Qc`<li class="room-info">${l}</li>`:""}
${e.open?Qc`<li class="room-info">${d}</li>`:""}
${e.persistent?Qc`<li class="room-info">${u}</li>`:""}
${e.publicroom?Qc`<li class="room-info">${h}</li>`:""}
${e.semianonymous?Qc`<li class="room-info">${m}</li>`:""}
${e.temporary?Qc`<li class="room-info">${f}</li>`:""}
${e.unmoderated?Qc`<li class="room-info">${g}</li>`:""}
</ul>
</p>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
`})({jid:t.getAttribute("from"),desc:null===(n=TS(NS('field[var="muc#roominfo_description"] value',t)))||void 0===n?void 0:n.textContent,occ:null===(s=TS(NS('field[var="muc#roominfo_occupants"] value',t)))||void 0===s?void 0:s.textContent,hidden:NS('feature[var="muc_hidden"]',t).length,membersonly:NS('feature[var="muc_membersonly"]',t).length,moderated:NS('feature[var="muc_moderated"]',t).length,nonanonymous:NS('feature[var="muc_nonanonymous"]',t).length,open:NS('feature[var="muc_open"]',t).length,passwordprotected:NS('feature[var="muc_passwordprotected"]',t).length,persistent:NS('feature[var="muc_persistent"]',t).length,publicroom:NS('feature[var="muc_publicroom"]',t).length,semianonymous:NS('feature[var="muc_semianonymous"]',t).length,temporary:NS('feature[var="muc_temporary"]',t).length,unmoderated:NS('feature[var="muc_unmoderated"]',t).length})))}(t,e))).catch((e=>M.error(e))))}(e)},onDomainChange(){Cl.settings.get("auto_list_rooms")&&this.updateRoomsList()},onRoomsFound(e){this.loading_items=!1;const t=e?NS("query item",e):[];return t.length?(this.model.set({feedback_text:vh("Groupchats found")},{silent:!0}),this.items=t.map(dd)):(this.items=[],this.model.set({feedback_text:vh("No groupchats found")},{silent:!0})),this.render(),!0},updateRoomsList(){const e=jS({to:this.model.get("muc_domain"),from:va.connection.jid,type:"get"}).c("query",{xmlns:kS.NS.DISCO_ITEMS});Cl.sendIQ(e).then((e=>this.onRoomsFound(e))).catch((()=>this.onRoomsFound()))},showRooms(e){e.preventDefault(),this.loading_items=!0,this.render();const t=new FormData(e.target);this.model.setDomain(t.get("server")),this.updateRoomsList()},setDomainFromEvent(e){this.model.setDomain(e.target.value)},setNick(e){this.model.save({nick:e.target.value})}}),{Strophe:IS}=jl.env,MS=Zo.extend({defaults:function(){return{muc_domain:Cl.settings.get("muc_domain"),nick:va.getDefaultMUCNickname(),"toggle-state":va.OPENED}},setDomain(e){Cl.settings.get("locked_muc_domain")||this.save("muc_domain",IS.getDomainFromJid(e))}}),{Strophe:RS,u:DS}=jl.env;function LS(){if(!Cl.settings.get("auto_insert"))return;const e=Cl.settings.get("root");if(!e.querySelector("converse-root#conversejs")){const t=document.createElement("converse-root"),n=e.querySelector("body");n?n.appendChild(t):e.appendChild(t)}}Cl.elements.define("converse-rooms-list",class extends mg{initialize(){const e=`converse.roomspanel${va.bare_jid}`;this.model=new MS({id:e}),_o(this.model,e),this.model.fetch(),this.listenTo(va.chatboxes,"add",this.renderIfChatRoom),this.listenTo(va.chatboxes,"remove",this.renderIfChatRoom),this.listenTo(va.chatboxes,"destroy",this.renderIfChatRoom),this.listenTo(va.chatboxes,"change",this.renderIfRelevantChange),this.render()}renderIfChatRoom(e){DS.isChatRoom(e)&&this.render()}renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general","has_activity"],n=e.changed||{};DS.isChatRoom(e)&&Object.keys(n).filter((e=>t.includes(e))).length&&this.render()}render(){tl((e=>{const t=vh("Click to toggle the list of open groupchats"),n=vh("Groupchats"),s=vh("Query for groupchats"),i=vh("Add a new groupchat");return Qc`
<div class="d-flex controlbox-padded">
<span class="w-100 controlbox-heading controlbox-heading--groupchats">${n}</span>
<a class="controlbox-heading__btn show-list-muc-modal"
@click=${t=>Cl.modal.show($S,{model:e.model},t)}
title="${s}" data-toggle="modal" data-target="#muc-list-modal">
<converse-icon class="fa fa-list-ul right" color="var(--subdued-color)" path-prefix="/dist" size="1em"></converse-icon>
2021-03-19 19:26:15 +01:00
</a>
2021-11-11 22:06:49 +01:00
<a class="controlbox-heading__btn show-add-muc-modal"
@click=${t=>Cl.modal.show(CS,{model:e.model},t)}
title="${i}" data-toggle="modal" data-target="#add-chatrooms-modal">
<converse-icon class="fa fa-plus right" color="var(--subdued-color)" path-prefix="/dist" size="1em"></converse-icon>
2021-03-19 19:26:15 +01:00
</a>
</div>
2021-11-11 22:06:49 +01:00
<div class="list-container list-container--openrooms ${e.rooms.length?"":"hidden"}">
<a class="list-toggle open-rooms-toggle controlbox-padded" title="${t}" @click=${e.toggleRoomsList}>
<span class="fa ${e.toggle_state===va.OPENED?"fa-caret-down":"fa-caret-right"}"></span> ${vh("Open Groupchats")}</a>
<div class="items-list rooms-list open-rooms-list ${e.collapsed&&"collapsed"}">
${e.rooms.map((t=>(e=>{const t=vh("Leave this groupchat"),n=e.room.get("num_unread_general")||e.room.get("has_activity");return Qc`
<div class="list-item controlbox-padded available-chatroom d-flex flex-row ${e.currently_open(e.room)?"open":""} ${n?"unread-msgs":""}"
2021-03-19 19:26:15 +01:00
data-room-jid="${e.room.get("jid")}">
2021-11-11 22:06:49 +01:00
${e.room.get("num_unread")?(e=>Qc`<span class="list-item-badge badge badge--muc msgs-indicator">${e.room.get("num_unread")}</span>`)(e):e.room.get("has_activity")?Qc`<span class="list-item-badge badge badge--muc msgs-indicator"></span>`:""}
2021-03-19 19:26:15 +01:00
<a class="list-item-link open-room available-room w-100"
2021-11-11 22:06:49 +01:00
data-room-jid="${e.room.get("jid")}"
title="${vh("Click to open this groupchat")}"
@click=${e.openRoom}>${e.room.getDisplayName()}</a>
2021-03-19 19:26:15 +01:00
2021-11-11 22:06:49 +01:00
${e.allow_bookmarks?(e=>{const t=vh("Bookmark this groupchat"),n=vh("Unbookmark this groupchat");return e.bookmarked?Qc`
2021-03-19 19:26:15 +01:00
<a class="list-item-action fa fa-bookmark remove-bookmark button-on"
data-room-jid="${e.room.get("jid")}"
data-bookmark-name="${e.room.getDisplayName()}"
@click=${e.removeBookmark}
2021-11-11 22:06:49 +01:00
title="${e.bookmarked?n:t}"></a>`:Qc`
2021-03-19 19:26:15 +01:00
<a class="list-item-action fa fa-bookmark add-bookmark"
data-room-jid="${e.room.get("jid")}"
data-bookmark-name="${e.room.getDisplayName()}"
@click=${e.addBookmark}
title="${e.bookmarked?n:t}"></a>`})(e):""}
<a class="list-item-action room-info fa fa-info-circle"
2021-11-11 22:06:49 +01:00
data-room-jid="${e.room.get("jid")}"
title="${vh("Show more information on this groupchat")}"
@click=${e.showRoomDetailsModal}></a>
2021-03-19 19:26:15 +01:00
<a class="list-item-action fa fa-sign-out-alt close-room"
2021-11-11 22:06:49 +01:00
data-room-jid="${e.room.get("jid")}"
data-room-name="${e.room.getDisplayName()}"
title="${t}"
@click=${e.closeRoom}></a>
</div>`})(Object.assign({room:t},e))))}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>`})({addBookmark:e=>this.addBookmark(e),allow_bookmarks:va.allow_bookmarks&&va.bookmarks,closeRoom:e=>this.closeRoom(e),collapsed:this.model.get("toggle-state")!==va.OPENED,currently_open:e=>va.isUniView()&&!e.get("hidden"),model:this.model,openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),rooms:va.chatboxes.filter((e=>e.get("type")===va.CHATROOMS_TYPE)),showRoomDetailsModal:e=>this.showRoomDetailsModal(e),toggleRoomsList:e=>this.toggleRoomsList(e),toggle_state:this.model.get("toggle-state")}),this)}showRoomDetailsModal(e){const t=e.target.getAttribute("data-room-jid"),n=va.chatboxes.get(t);e.preventDefault(),Cl.modal.show(w_,{model:n},e)}async openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),s={name:t||RS.unescapeNode(RS.getNodeFromJid(n))||n};await Cl.rooms.open(n,s,!0)}async closeRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-name");if(confirm(vh("Are you sure you want to leave the groupchat %1$s?",t))){const t=e.target.getAttribute("data-room-jid");(await Cl.rooms.get(t)).close()}}removeBookmark(e){va.removeBookmarkViaEvent(e)}addBookmark(e){va.addBookmarkViaEvent(e)}toggleRoomsList(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");n.classList.contains("fa-caret-down")?DS.slideIn(this.querySelector(".open-rooms-list")).then((()=>{this.model.save({"toggle-state":va.CLOSED}),n.classList.remove("fa-caret-down"),n.classList.add("fa-caret-right")})):DS.slideOut(this.querySelector(".open-rooms-list")).then((()=>{this.model.save({"toggle-state":va.OPENED}),n.classList.remove("fa-caret-right"),n.classList.add("fa-caret-down")}))}}),jl.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){Cl.listen.on("connected",(async()=>{va.allow_bookmarks?await Cl.waitUntil("bookmarksInitialized"):await Promise.all([Cl.waitUntil("chatBoxesFetched")])}))}}),window.customElements.define("converse-fontawesome",class extends Uf{render(){return Qc`
<?xml version="1.0" encoding="UTF-8"?>
<!--
Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
-->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="icon-address-book" viewBox="0 0 448 512">
<path d="M436 160c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h320c26.5 0 48-21.5 48-48v-48h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20zm-228-32c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H118.4C106 384 96 375.4 96 364.8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2z"></path>
</symbol>
<symbol id="icon-angle-double-down" viewBox="0 0 320 512">
<path d="M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"></path>
</symbol>
<symbol id="icon-angle-double-left" viewBox="0 0 448 512">
<path d="M223.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L319.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L393.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34zm-192 34l136 136c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9L127.9 256l96.4-96.4c9.4-9.4 9.4-24.6 0-33.9L201.7 103c-9.4-9.4-24.6-9.4-33.9 0l-136 136c-9.5 9.4-9.5 24.6-.1 34z"></path>
</symbol>
<symbol id="icon-angle-double-right" viewBox="0 0 448 512">
<path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34zm192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8z"></path>
</symbol>
<symbol id="icon-angle-double-up" viewBox="0 0 320 512">
<path d="M177 255.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 351.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 425.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1zm-34-192L7 199.7c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l96.4-96.4 96.4 96.4c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9l-136-136c-9.2-9.4-24.4-9.4-33.8 0z"></path>
</symbol>
<symbol id="icon-angle-down" viewBox="0 0 320 512">
<path d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"></path>
</symbol>
<symbol id="icon-angle-left" viewBox="0 0 256 512">
<path d="M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"></path>
</symbol>
<symbol id="icon-angle-right" viewBox="0 0 256 512">
<path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"></path>
</symbol>
<symbol id="icon-angle-up" viewBox="0 0 320 512">
<path d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-down" viewBox="0 0 512 512">
<path d="M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zM212 140v116h-70.9c-10.7 0-16.1 13-8.5 20.5l114.9 114.3c4.7 4.7 12.2 4.7 16.9 0l114.9-114.3c7.6-7.6 2.2-20.5-8.5-20.5H300V140c0-6.6-5.4-12-12-12h-64c-6.6 0-12 5.4-12 12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-left" viewBox="0 0 512 512">
<path d="M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm116-292H256v-70.9c0-10.7-13-16.1-20.5-8.5L121.2 247.5c-4.7 4.7-4.7 12.2 0 16.9l114.3 114.9c7.6 7.6 20.5 2.2 20.5-8.5V300h116c6.6 0 12-5.4 12-12v-64c0-6.6-5.4-12-12-12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-right" viewBox="0 0 512 512">
<path d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zM140 300h116v70.9c0 10.7 13 16.1 20.5 8.5l114.3-114.9c4.7-4.7 4.7-12.2 0-16.9l-114.3-115c-7.6-7.6-20.5-2.2-20.5 8.5V212H140c-6.6 0-12 5.4-12 12v64c0 6.6 5.4 12 12 12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-up" viewBox="0 0 512 512">
<path d="M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm292 116V256h70.9c10.7 0 16.1-13 8.5-20.5L264.5 121.2c-4.7-4.7-12.2-4.7-16.9 0l-115 114.3c-7.6 7.6-2.2 20.5 8.5 20.5H212v116c0 6.6 5.4 12 12 12h64c6.6 0 12-5.4 12-12z"></path>
</symbol>
<symbol id="icon-arrow-circle-down" viewBox="0 0 512 512">
<path d="M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-143.6-28.9L288 302.6V120c0-13.3-10.7-24-24-24h-16c-13.3 0-24 10.7-24 24v182.6l-72.4-75.5c-9.3-9.7-24.8-9.9-34.3-.4l-10.9 11c-9.4 9.4-9.4 24.6 0 33.9L239 404.3c9.4 9.4 24.6 9.4 33.9 0l132.7-132.7c9.4-9.4 9.4-24.6 0-33.9l-10.9-11c-9.5-9.5-25-9.3-34.3.4z"></path>
</symbol>
<symbol id="icon-arrow-circle-left" viewBox="0 0 512 512">
<path d="M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm28.9-143.6L209.4 288H392c13.3 0 24-10.7 24-24v-16c0-13.3-10.7-24-24-24H209.4l75.5-72.4c9.7-9.3 9.9-24.8.4-34.3l-11-10.9c-9.4-9.4-24.6-9.4-33.9 0L107.7 239c-9.4 9.4-9.4 24.6 0 33.9l132.7 132.7c9.4 9.4 24.6 9.4 33.9 0l11-10.9c9.5-9.5 9.3-25-.4-34.3z"></path>
</symbol>
<symbol id="icon-arrow-circle-right" viewBox="0 0 512 512">
<path d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zm-28.9 143.6l75.5 72.4H120c-13.3 0-24 10.7-24 24v16c0 13.3 10.7 24 24 24h182.6l-75.5 72.4c-9.7 9.3-9.9 24.8-.4 34.3l11 10.9c9.4 9.4 24.6 9.4 33.9 0L404.3 273c9.4-9.4 9.4-24.6 0-33.9L271.6 106.3c-9.4-9.4-24.6-9.4-33.9 0l-11 10.9c-9.5 9.6-9.3 25.1.4 34.4z"></path>
</symbol>
<symbol id="icon-arrow-circle-up" viewBox="0 0 512 512">
<path d="M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm143.6 28.9l72.4-75.5V392c0 13.3 10.7 24 24 24h16c13.3 0 24-10.7 24-24V209.4l72.4 75.5c9.3 9.7 24.8 9.9 34.3.4l10.9-11c9.4-9.4 9.4-24.6 0-33.9L273 107.7c-9.4-9.4-24.6-9.4-33.9 0L106.3 240.4c-9.4 9.4-9.4 24.6 0 33.9l10.9 11c9.6 9.5 25.1 9.3 34.4-.4z"></path>
</symbol>
<symbol id="icon-arrow-down" viewBox="0 0 448 512">
<path d="M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"></path>
</symbol>
<symbol id="icon-arrow-left" viewBox="0 0 448 512">
<path d="M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"></path>
</symbol>
<symbol id="icon-arrow-right" viewBox="0 0 448 512">
<path d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path>
</symbol>
<symbol id="icon-arrow-up" viewBox="0 0 448 512">
<path d="M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"></path>
</symbol>
<symbol id="icon-arrows-alt" viewBox="0 0 512 512">
<path d="M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"></path>
</symbol>
<symbol id="icon-arrows-alt-h" viewBox="0 0 512 512">
<path d="M377.941 169.941V216H134.059v-46.059c0-21.382-25.851-32.09-40.971-16.971L7.029 239.029c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971V296h243.882v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.568 0-33.941l-86.059-86.059c-15.119-15.12-40.971-4.412-40.971 16.97z"></path>
</symbol>
<symbol id="icon-arrows-alt-v" viewBox="0 0 256 512">
<path d="M214.059 377.941H168V134.059h46.059c21.382 0 32.09-25.851 16.971-40.971L144.971 7.029c-9.373-9.373-24.568-9.373-33.941 0L24.971 93.088c-15.119 15.119-4.411 40.971 16.971 40.971H88v243.882H41.941c-21.382 0-32.09 25.851-16.971 40.971l86.059 86.059c9.373 9.373 24.568 9.373 33.941 0l86.059-86.059c15.12-15.119 4.412-40.971-16.97-40.971z"></path>
</symbol>
<symbol id="icon-bars" viewBox="0 0 448 512">
<path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"></path>
</symbol>
<symbol id="icon-bookmark" viewBox="0 0 384 512">
<path d="M0 512V48C0 21.49 21.49 0 48 0h288c26.51 0 48 21.49 48 48v464L192 400 0 512z"></path>
</symbol>
<symbol id="icon-caret-down" viewBox="0 0 320 512">
<path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"></path>
</symbol>
<symbol id="icon-caret-right" viewBox="0 0 192 512">
<path d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"></path>
</symbol>
<symbol id="icon-check" viewBox="0 0 512 512">
<path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"></path>
</symbol>
<symbol id="icon-circle" viewBox="0 0 512 512">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"></path>
</symbol>
<symbol id="icon-cog" viewBox="0 0 512 512">
<path d="M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"></path>
</symbol>
<symbol id="icon-database" viewBox="0 0 448 512">
<path d="M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z"></path>
</symbol>
<symbol id="icon-edit" viewBox="0 0 576 512">
<path d="M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z"></path>
</symbol>
<symbol id="icon-eye" viewBox="0 0 576 512">
<path d="M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"></path>
</symbol>
<symbol id="icon-eye-slash" viewBox="0 0 640 512">
<path d="M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"></path>
</symbol>
<symbol id="icon-gavel" viewBox="0 0 512 512">
<path d="M504.971 199.362l-22.627-22.627c-9.373-9.373-24.569-9.373-33.941 0l-5.657 5.657L329.608 69.255l5.657-5.657c9.373-9.373 9.373-24.569 0-33.941L312.638 7.029c-9.373-9.373-24.569-9.373-33.941 0L154.246 131.48c-9.373 9.373-9.373 24.569 0 33.941l22.627 22.627c9.373 9.373 24.569 9.373 33.941 0l5.657-5.657 39.598 39.598-81.04 81.04-5.657-5.657c-12.497-12.497-32.758-12.497-45.255 0L9.373 412.118c-12.497 12.497-12.497 32.758 0 45.255l45.255 45.255c12.497 12.497 32.758 12.497 45.255 0l114.745-114.745c12.497-12.497 12.497-32.758 0-45.255l-5.657-5.657 81.04-81.04 39.598 39.598-5.657 5.657c-9.373 9.373-9.373 24.569 0 33.941l22.627 22.627c9.373 9.373 24.569 9.373 33.941 0l124.451-124.451c9.372-9.372 9.372-24.568 0-33.941z"></path>
</symbol>
<symbol id="icon-globe" viewBox="0 0 496 512">
<path d="M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"></path>
</symbol>
<symbol id="icon-id-card" viewBox="0 0 576 512">
<path d="M528 32H48C21.5 32 0 53.5 0 80v16h576V80c0-26.5-21.5-48-48-48zM0 432c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V128H0v304zm352-232c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zm0 64c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zm0 64c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zM176 192c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zM67.1 396.2C75.5 370.5 99.6 352 128 352h8.2c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h8.2c28.4 0 52.5 18.5 60.9 44.2 3.2 9.9-5.2 19.8-15.6 19.8H82.7c-10.4 0-18.8-10-15.6-19.8z"></path>
</symbol>
<symbol id="icon-id-card-alt" viewBox="0 0 576 512">
<path d="M528 64H384v96H192V64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM288 224c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm93.3 224H194.7c-10.4 0-18.8-10-15.6-19.8 8.3-25.6 32.4-44.2 60.9-44.2h8.2c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h8.2c28.4 0 52.5 18.5 60.9 44.2 3.2 9.8-5.2 19.8-15.6 19.8zM352 32c0-17.7-14.3-32-32-32h-64c-17.7 0-32 14.3-32 32v96h128V32z"></path>
</symbol>
<symbol id="icon-info" viewBox="0 0 192 512">
<path d="M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z"></path>
</symbol>
<symbol id="icon-info-circle" viewBox="0 0 512 512">
<path d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"></path>
</symbol>
<symbol id="icon-list-ul" viewBox="0 0 512 512">
<path d="M48 48a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm0 160a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm0 160a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm448 16H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"></path>
</symbol>
<symbol id="icon-lock" viewBox="0 0 448 512">
<path d="M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"></path>
</symbol>
<symbol id="icon-lock-open" viewBox="0 0 576 512">
<path d="M423.5 0C339.5.3 272 69.5 272 153.5V224H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48h-48v-71.1c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v80c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-80C576 68 507.5-.3 423.5 0z"></path>
</symbol>
<symbol id="icon-minus" viewBox="0 0 448 512">
<path d="M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"></path>
</symbol>
<symbol id="icon-minus-circle" viewBox="0 0 512 512">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zM124 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H124z"></path>
</symbol>
<symbol id="icon-minus-square" viewBox="0 0 448 512">
<path d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM92 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H92z"></path>
</symbol>
<symbol id="icon-paper-plane" viewBox="0 0 512 512">
<path d="M476 3.2L12.5 270.6c-18.1 10.4-15.8 35.6 2.2 43.2L121 358.4l287.3-253.2c5.5-4.9 13.3 2.6 8.6 8.3L176 407v80.5c0 23.6 28.5 32.9 42.5 15.8L282 426l124.6 52.2c14.2 6 30.4-2.9 33-18.2l72-432C515 7.8 493.3-6.8 476 3.2z"></path>
</symbol>
<symbol id="icon-paperclip" viewBox="0 0 448 512">
<path d="M43.246 466.142c-58.43-60.289-57.341-157.511 1.386-217.581L254.392 34c44.316-45.332 116.351-45.336 160.671 0 43.89 44.894 43.943 117.329 0 162.276L232.214 383.128c-29.855 30.537-78.633 30.111-107.982-.998-28.275-29.97-27.368-77.473 1.452-106.953l143.743-146.835c6.182-6.314 16.312-6.422 22.626-.241l22.861 22.379c6.315 6.182 6.422 16.312.241 22.626L171.427 319.927c-4.932 5.045-5.236 13.428-.648 18.292 4.372 4.634 11.245 4.711 15.688.165l182.849-186.851c19.613-20.062 19.613-52.725-.011-72.798-19.189-19.627-49.957-19.637-69.154 0L90.39 293.295c-34.763 35.56-35.299 93.12-1.191 128.313 34.01 35.093 88.985 35.137 123.058.286l172.06-175.999c6.177-6.319 16.307-6.433 22.626-.256l22.877 22.364c6.319 6.177 6.434 16.307.256 22.626l-172.06 175.998c-59.576 60.938-155.943 60.216-214.77-.485z"></path>
</symbol>
<symbol id="icon-pencil-alt" viewBox="0 0 512 512">
<path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"></path>
</symbol>
<symbol id="icon-phone" viewBox="0 0 512 512">
<path d="M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z"></path>
</symbol>
<symbol id="icon-plus" viewBox="0 0 448 512">
<path d="M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"></path>
</symbol>
<symbol id="icon-plus-circle" viewBox="0 0 512 512">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"></path>
</symbol>
<symbol id="icon-plus-square" viewBox="0 0 448 512">
<path d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-32 252c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92H92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"></path>
</symbol>
<symbol id="icon-save" viewBox="0 0 448 512">
<path d="M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"></path>
</symbol>
<symbol id="icon-sign-out-alt" viewBox="0 0 512 512">
<path d="M497 273L329 441c-15 15-41 4.5-41-17v-96H152c-13.3 0-24-10.7-24-24v-96c0-13.3 10.7-24 24-24h136V88c0-21.4 25.9-32 41-17l168 168c9.3 9.4 9.3 24.6 0 34zM192 436v-40c0-6.6-5.4-12-12-12H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h84c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12H96c-53 0-96 43-96 96v192c0 53 43 96 96 96h84c6.6 0 12-5.4 12-12z"></path>
</symbol>
<symbol id="icon-smile" viewBox="0 0 496 512">
<path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z"></path>
</symbol>
<symbol id="icon-snowflake" viewBox="0 0 448 512">
<path d="M440.3 345.2l-33.8-19.5 26-7c8.2-2.2 13.1-10.7 10.9-18.9l-4-14.9c-2.2-8.2-10.7-13.1-18.9-10.9l-70.8 19-63.9-37 63.8-36.9 70.8 19c8.2 2.2 16.7-2.7 18.9-10.9l4-14.9c2.2-8.2-2.7-16.7-10.9-18.9l-26-7 33.8-19.5c7.4-4.3 9.9-13.7 5.7-21.1L430.4 119c-4.3-7.4-13.7-9.9-21.1-5.7l-33.8 19.5 7-26c2.2-8.2-2.7-16.7-10.9-18.9l-14.9-4c-8.2-2.2-16.7 2.7-18.9 10.9l-19 70.8-62.8 36.2v-77.5l53.7-53.7c6.2-6.2 6.2-16.4 0-22.6l-11.3-11.3c-6.2-6.2-16.4-6.2-22.6 0L256 56.4V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v40.4l-19.7-19.7c-6.2-6.2-16.4-6.2-22.6 0L138.3 48c-6.3 6.2-6.3 16.4 0 22.6l53.7 53.7v77.5l-62.8-36.2-19-70.8c-2.2-8.2-10.7-13.1-18.9-10.9l-14.9 4c-8.2 2.2-13.1 10.7-10.9 18.9l7 26-33.8-19.5c-7.4-4.3-16.8-1.7-21.1 5.7L2.1 145.7c-4.3 7.4-1.7 16.8 5.7 21.1l33.8 19.5-26 7c-8.3 2.2-13.2 10.7-11 19l4 14.9c2.2 8.2 10.7 13.1 18.9 10.9l70.8-19 63.8 36.9-63.8 36.9-70.8-19c-8.2-2.2-16.7 2.7-18.9 10.9l-4 14.9c-2.2 8.2 2.7 16.7 10.9 18.9l26 7-33.8 19.6c-7.4 4.3-9.9 13.7-5.7 21.1l15.5 26.8c4.3 7.4 13.7 9.9 21.1 5.7l33.8-19.5-7 26c-2.2 8.2 2.7 16.7 10.9 18.9l14.9 4c8.2 2.2 16.7-2.7 18.9-10.9l19-70.8 62.8-36.2v77.5l-53.7 53.7c-6.3 6.2-6.3 16.4 0 22.6l11.3 11.3c6.2 6.2 16.4 6.2 22.6 0l19.7-19.7V496c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-40.4l19.7 19.7c6.2 6.2 16.4 6.2 22.6 0l11.3-11.3c6.2-6.2 6.2-16.4 0-22.6L256 387.7v-77.5l62.8 36.2 19 70.8c2.2 8.2 10.7 13.1 18.9 10.9l14.9-4c8.2-2.2 13.1-10.7 10.9-18.9l-7-26 33.8 19.5c7.4 4.3 16.8 1.7 21.1-5.7l15.5-26.8c4.3-7.3 1.8-16.8-5.6-21z"></path>
</symbol>
<symbol id="icon-spinner" viewBox="0 0 512 512">
<path d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path>
</symbol>
<symbol id="icon-sync" viewBox="0 0 512 512">
<path d="M440.65 12.57l4 82.77A247.16 247.16 0 0 0 255.83 8C134.73 8 33.91 94.92 12.29 209.82A12 12 0 0 0 24.09 224h49.05a12 12 0 0 0 11.67-9.26 175.91 175.91 0 0 1 317-56.94l-101.46-4.86a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12H500a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12h-47.37a12 12 0 0 0-11.98 12.57zM255.83 432a175.61 175.61 0 0 1-146-77.8l101.8 4.87a12 12 0 0 0 12.57-12v-47.4a12 12 0 0 0-12-12H12a12 12 0 0 0-12 12V500a12 12 0 0 0 12 12h47.35a12 12 0 0 0 12-12.6l-4.15-82.57A247.17 247.17 0 0 0 255.83 504c121.11 0 221.93-86.92 243.55-201.82a12 12 0 0 0-11.8-14.18h-49.05a12 12 0 0 0-11.67 9.26A175.86 175.86 0 0 1 255.83 432z"></path>
</symbol>
<symbol id="icon-times" viewBox="0 0 352 512">
<path d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path>
</symbol>
<symbol id="icon-times-circle" viewBox="0 0 512 512">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"></path>
</symbol>
<symbol id="icon-trash" viewBox="0 0 448 512">
<path d="M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"></path>
</symbol>
<symbol id="icon-trash-alt" viewBox="0 0 448 512">
<path d="M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"></path>
</symbol>
<symbol id="icon-unlock" viewBox="0 0 448 512">
<path d="M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"></path>
</symbol>
<symbol id="icon-user" viewBox="0 0 448 512">
<path d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"></path>
</symbol>
<symbol id="icon-user-cog" viewBox="0 0 640 512">
<path d="M610.5 373.3c2.6-14.1 2.6-28.5 0-42.6l25.8-14.9c3-1.7 4.3-5.2 3.3-8.5-6.7-21.6-18.2-41.2-33.2-57.4-2.3-2.5-6-3.1-9-1.4l-25.8 14.9c-10.9-9.3-23.4-16.5-36.9-21.3v-29.8c0-3.4-2.4-6.4-5.7-7.1-22.3-5-45-4.8-66.2 0-3.3.7-5.7 3.7-5.7 7.1v29.8c-13.5 4.8-26 12-36.9 21.3l-25.8-14.9c-2.9-1.7-6.7-1.1-9 1.4-15 16.2-26.5 35.8-33.2 57.4-1 3.3.4 6.8 3.3 8.5l25.8 14.9c-2.6 14.1-2.6 28.5 0 42.6l-25.8 14.9c-3 1.7-4.3 5.2-3.3 8.5 6.7 21.6 18.2 41.1 33.2 57.4 2.3 2.5 6 3.1 9 1.4l25.8-14.9c10.9 9.3 23.4 16.5 36.9 21.3v29.8c0 3.4 2.4 6.4 5.7 7.1 22.3 5 45 4.8 66.2 0 3.3-.7 5.7-3.7 5.7-7.1v-29.8c13.5-4.8 26-12 36.9-21.3l25.8 14.9c2.9 1.7 6.7 1.1 9-1.4 15-16.2 26.5-35.8 33.2-57.4 1-3.3-.4-6.8-3.3-8.5l-25.8-14.9zM496 400.5c-26.8 0-48.5-21.8-48.5-48.5s21.8-48.5 48.5-48.5 48.5 21.8 48.5 48.5-21.7 48.5-48.5 48.5zM224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm201.2 226.5c-2.3-1.2-4.6-2.6-6.8-3.9l-7.9 4.6c-6 3.4-12.8 5.3-19.6 5.3-10.9 0-21.4-4.6-28.9-12.6-18.3-19.8-32.3-43.9-40.2-69.6-5.5-17.7 1.9-36.4 17.9-45.7l7.9-4.6c-.1-2.6-.1-5.2 0-7.8l-7.9-4.6c-16-9.2-23.4-28-17.9-45.7.9-2.9 2.2-5.8 3.2-8.7-3.8-.3-7.5-1.2-11.4-1.2h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c10.1 0 19.5-3.2 27.2-8.5-1.2-3.8-2-7.7-2-11.8v-9.2z"></path>
</symbol>
<symbol id="icon-user-plus" viewBox="0 0 640 512">
<path d="M624 208h-64v-64c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v64h-64c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h64v64c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-64h64c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm-400 48c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"></path>
</symbol>
<symbol id="icon-user-secret" viewBox="0 0 448 512">
<path d="M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"></path>
</symbol>
<symbol id="icon-users" viewBox="0 0 640 512">
<path d="M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"></path>
</symbol>
<symbol id="icon-wrench" viewBox="0 0 512 512">
<path d="M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"></path>
</symbol>
</svg>
`}}),customElements.define("converse-root",class extends Uf{render(){return(()=>{let e=Cl.settings.get("singleton")?"converse-singleton":"";return e+=`converse-${Cl.settings.get("view_mode")}`,Qc`
<converse-chats class="converse-chatboxes row no-gutters ${e}"></converse-chats>
<div id="converse-modals" class="modals"></div>
<converse-fontawesome></converse-fontawesome>
`})()}connectedCallback(){super.connectedCallback(),this.classList.add("conversejs"),this.classList.add(`converse-${Cl.settings.get("view_mode")}`),this.classList.add(`theme-${Cl.settings.get("theme")}`),this.setAttribute("id","conversejs")}}),jl.plugins.add("converse-rootview",{initialize(){Cl.settings.extend({auto_insert:!0}),Cl.listen.on("chatBoxesInitialized",LS)}});const{Strophe:zS}=jl.env,PS=jl.env.utils,FS=Kg.extend({id:"add-contact-modal",events:{"submit form":"addContactFromForm"},initialize(){Kg.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){const e=Cl.settings.get("xhr_user_search_url")?vh("Contact name"):vh("Optional nickname");return(e=>{const t=vh("name@example.org"),n=vh("Add"),s=vh("Please enter a valid XMPP address"),i=vh("Add a Contact"),r=vh("XMPP Address"),o=vh("Nickname");return Qc`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addContactModalLabel">${i}</h5>
2021-11-11 22:06:49 +01:00
${Qg}
2021-03-19 19:26:15 +01:00
</div>
<form class="converse-form add-xmpp-contact">
<div class="modal-body">
<span class="modal-alert"></span>
<div class="form-group add-xmpp-contact__jid">
2021-11-11 22:06:49 +01:00
<label class="clearfix" for="jid">${r}:</label>
2021-03-19 19:26:15 +01:00
<div class="suggestion-box suggestion-box__jid">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<input type="text" name="jid" ?required=${!e._converse.xhr_user_search_url}
value="${e.jid||""}"
class="form-control suggestion-box__input"
placeholder="${t}"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</div>
<div class="form-group add-xmpp-contact__name">
<label class="clearfix" for="name">${o}:</label>
<div class="suggestion-box suggestion-box__name">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<input type="text" name="name" value="${e.nickname||""}"
class="form-control suggestion-box__input"
placeholder="${o}"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</div>
<div class="form-group">
2021-11-11 22:06:49 +01:00
<div class="invalid-feedback">${s}</div>
2021-03-19 19:26:15 +01:00
</div>
<button type="submit" class="btn btn-primary">${n}</button>
</div>
</form>
</div>
</div>
2021-11-11 22:06:49 +01:00
`})(Object.assign(this.model.toJSON(),{_converse:va,label_nickname:e}))},afterRender(){"string"==typeof Cl.settings.get("xhr_user_search_url")?this.initXHRAutoComplete():this.initJIDAutoComplete();const e=this.el.querySelector('input[name="jid"]');this.el.addEventListener("shown.bs.modal",(()=>e.focus()),!1)},initJIDAutoComplete(){if(!Cl.settings.get("autocomplete_add_contact"))return;const e=this.el.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new va.AutoComplete(e,{data:(e,t)=>`${t.slice(0,t.indexOf("@"))}@${e}`,filter:va.FILTER_STARTSWITH,list:[...new Set(va.roster.map((e=>zS.getDomainFromJid(e.get("jid")))))]})},initXHRAutoComplete(){if(!Cl.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.el.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new va.AutoComplete(e,{auto_evaluate:!1,filter:va.FILTER_STARTSWITH,list:[]});const t=new window.XMLHttpRequest;t.onload=()=>{if(t.responseText){const e=t.responseText;this.name_auto_complete.list=JSON.parse(e).map((e=>({label:e.fullname||e.jid,value:e.jid}))),this.name_auto_complete.auto_completing=!0,this.name_auto_complete.evaluate()}};const n=this.el.querySelector('input[name="name"]');n.addEventListener("input",hc((()=>{t.open("GET",`${Cl.settings.get("xhr_user_search_url")}q=${encodeURIComponent(n.value)}`,!0),t.send()}),300)),this.name_auto_complete.on("suggestion-box-selectcomplete",(e=>{this.el.querySelector('input[name="name"]').value=e.text.label,this.el.querySelector('input[name="jid"]').value=e.text.value}))},initXHRFetch(){this.xhr=new window.XMLHttpRequest,this.xhr.onload=()=>{if(this.xhr.responseText){const e=this.xhr.responseText,t=JSON.parse(e).map((e=>({label:e.fullname||e.jid,value:e.jid})));if(1!==t.length){const e=this.el.querySelector(".invalid-feedback");return e.textContent=vh("Sorry, could not find a contact with that name"),void PS.addClass("d-block",e)}const n=t[0].value;if(this.validateSubmission(n)){const e=this.el.querySelector("form"),s=t[0].label;this.afterSubmission(e,n,s)}}}},validateSubmission(e){const t=this.el.querySelector(".invalid-feedback");return!e||Oo(e.split("@")).length<2?(PS.addClass("is-invalid",this.el.querySelector('input[name="jid"]')),PS.addClass("d-block",t),!1):va.roster.get(zS.getBareJidFromJid(e))?(t.textContent=vh("This contact has already been added"),PS.addClass("d-block",t),!1):(PS.removeClass("d-block",t),!0)},afterSubmission(e,t,n){va.roster.addAndSubscribe(t,n),this.model.clear(),this.modal.hide()},addContactFromForm(e){e.preventDefault();const t=new FormData(e.target),n=(t.get("jid")||"").trim();if(!n&&"string"==typeof Cl.settings.get("xhr_user_search_url")){const e=this.el.querySelector('input[name="name"]');return this.xhr.open("GET",`${Cl.settings.get("xhr_user_search_url")}q=${encodeURIComponent(e.value)}`,!0),void this.xhr.send()}this.validateSubmission(n)&&this.afterSubmission(e.target,n,t.get("name"))}});function US(e){var t,n;null===(t=va.roster)||void 0===t||null===(n=t.findWhere({jid:e.get("jid")}))||void 0===n||n.trigger("highlight")}function BS(e,t){const n=va.roster_filter,s=n.get("filter_type"),i="state"===s?n.get("chat_state").toLowerCase():n.get("filter_text").toLowerCase();return!!i&&("state"===s?![va.HEADER_REQUESTING_CONTACTS,va.HEADER_UNREAD].includes(t)&&("unread_messages"===i?0===e.get("num_unread"):"online"===i?["offline","unavailable"].includes(e.presence.get("show")):!e.presence.get("show").includes(i)):"contacts"===s?!e.getFilterCriteria().includes(i):void 0)}function qS(e){const t=va.roster_filter;if("groups"===t.get("filter_type")){var n;const s=null===(n=t.get("filter_text"))||void 0===n?void 0:n.toLowerCase();if(!s)return!0;if(!e.toLowerCase().includes(s))return!1}return!0}va.AddContactModal=FS;const{u:HS}=jl.env;function GS(e){const t=e.get("jid"),n=[];if(va.isUniView()){const e=va.chatboxes.get(t);e&&!e.get("hidden")&&n.push("open")}const s=e.get("ask"),i=e.get("requesting"),r=e.get("subscription");return"subscribe"===s||"from"===r?n.push("pending-xmpp-contact"):!0===i?n.push("requesting-xmpp-c
<li class="list-item d-flex controlbox-padded ${n.join(" ")}" data-status="${e.presence.get("show")}">
<converse-roster-contact .model=${e}></converse-roster-contact>
</li>`}const WS=e=>{const t=vh("Contacts"),n=vh("Add a contact"),s=vh("Re-sync your contacts"),i=(va.roster||[]).reduce(((e,t)=>function(e,t){if("subscribe"===t.get("ask")){const n=va.HEADER_PENDING_CONTACTS;e[n]?e[n].push(t):e[n]=[t]}else if(t.get("requesting")){const n=va.HEADER_REQUESTING_CONTACTS;e[n]?e[n].push(t):e[n]=[t]}else{let n;Cl.settings.get("roster_groups")?(n=t.get("groups"),n=0===n.length?[va.HEADER_UNGROUPED]:n):n=[va.HEADER_CURRENT_CONTACTS];for(const s of n)e[s]?e[s].push(t):e[s]=[t]}if(t.get("num_unread")){const n=va.HEADER_UNREAD;e[n]?e[n].push(t):e[n]=[t]}return e}(e,t)),{}),r=Object.keys(i).filter(qS);return r.sort(tf),Qc`
<div class="d-flex controlbox-padded">
<span class="w-100 controlbox-heading controlbox-heading--contacts">${t}</span>
<a class="controlbox-heading__btn sync-contacts" @click=${t=>e.syncContacts(t)} title="${s}">
<converse-icon class="fa fa-sync right ${e.syncing_contacts?"fa-spin":""}" color="var(--subdued-color)" path-prefix="/dist" size="1em"></converse-icon>
</a>
${Cl.settings.get("allow_contact_requests")?Qc`
<a class="controlbox-heading__btn add-contact"
@click=${t=>e.showAddContactModal(t)}
title="${n}"
data-toggle="modal"
data-target="#add-contact-modal">
<converse-icon class="fa fa-user-plus right" color="var(--subdued-color)" path-prefix="/dist" size="1.25em"></converse-icon>
</a>`:""}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<converse-roster-filter></converse-roster-filter>
<div class="list-container roster-contacts">
${jg(r,(e=>e),(e=>{const t=i[e].filter((t=>function(e,t){const n=e.presence.get("show");return Cl.settings.get("hide_offline_users")&&"offline"===n?("subscribe"===e.get("ask")||"from"===e.get("subscription")||!0===e.get("requesting"))&&!BS(e,t):!BS(e,t)}(t,e)));return t.sort(ef),t.length?(e=>{const t=vh("Click to hide these contacts"),n=va.roster.state.get("collapsed_groups");return Qc`
<div class="roster-group" data-group="${e.name}">
<a href="#" class="list-toggle group-toggle controlbox-padded" title="${t}" @click=${t=>function(e,t){var n;null==e||null===(n=e.preventDefault)||void 0===n||n.call(e);const s=va.roster.state.get("collapsed_groups");s.includes(t)?va.roster.state.save("collapsed_groups",s.filter((e=>e!==t))):va.roster.state.save("collapsed_groups",[...s,t])}(t,e.name)}>
<converse-icon color="var(--chat-head-color)" size="1em" class="fa ${n.includes(e.name)?"fa-caret-right":"fa-caret-down"}"></converse-icon> ${e.name}
</a>
<ul class="items-list roster-group-contacts ${n.includes(e.name)?"collapsed":""}" data-group="${e.name}">
${e.contacts.map(GS)}
</ul>
</div>`})({contacts:t,name:e}):""}))}
</div>
`};Cl.elements.define("converse-roster",class extends Uf{constructor(){super(),this.initialize()}async initialize(){await Cl.waitUntil("rosterInitialized"),this.listenTo(va,"rosterContactsFetched",this.requestUpdate),this.listenTo(va.presences,"change:show",this.requestUpdate),this.listenTo(va.roster,"add",this.requestUpdate),this.listenTo(va.roster,"destroy",this.requestUpdate),this.listenTo(va.roster,"remove",this.requestUpdate),this.listenTo(va.roster,"change",this.requestUpdate),this.listenTo(va.roster.state,"change",this.requestUpdate),Cl.trigger("rosterViewInitialized")}firstUpdated(){this.listenToRosterFilter()}render(){return WS(this)}listenToRosterFilter(){this.filter_view=this.querySelector("converse-roster-filter"),this.filter_view.addEventListener("update",(()=>this.requestUpdate()))}showAddContactModal(e){Cl.modal.show(va.AddContactModal,{model:new Zo},e)}async syncContacts(e){e.preventDefault(),this.syncing_contacts=!0,this.requestUpdate(),va.roster.data.save("version",null),await va.roster.fetchFromServer(),Cl.user.presence.send(),this.syncing_contacts=!1,this.requestUpdate()}});const VS=e=>Qc`<span class="pending-contact-name" title="JID: ${e.jid}">${e.display_name}</span>`,JS=e=>Qc`<span class="req-contact-name w-100" title="JID: ${e.jid}">${e.display_name}</span>`,KS=jl.env.utils;class YS extends Uf{static get properties(){return{model:{type:Object}}}connectedCallback(){super.connectedCallback(),this.listenTo(this.model,"change",this.requestUpdate),this.listenTo(this.model,"highlight",this.requestUpdate),this.listenTo(this.model,"vcard:change",this.requestUpdate)}render(){const e=this.model.get("ask"),t=this.model.get("requesting"),n=this.model.get("subscription"),s=this.model.get("jid");if("subscribe"===e||"from"===n){const e=this.model.getDisplayName();return(e=>{const t=vh("Click to remove %1$s as a contact",e.display_name);return Qc`
${Cl.settings.get("allow_chat_pending_contacts")?Qc`<a class="list-item-link open-chat w-100" href="#" @click=${e.openChat}>${VS(e)}</a>`:VS(e)}
<a class="list-item-action remove-xmpp-contact far fa-trash-alt" @click=${e.removeContact} title="${t}" href="#"></a>`})(Object.assign(this.model.toJSON(),{display_name:e,openChat:e=>this.openChat(e),removeContact:e=>this.removeContact(e)}))}if(!0===t){const e=this.model.getDisplayName();return(e=>Qc`
${Cl.settings.get("allow_chat_pending_contacts")?Qc`<a class="open-chat w-100" href="#" @click=${e.openChat}>${JS(e)}</a>`:JS(e)}
<a class="accept-xmpp-request list-item-action list-item-action--visible fa fa-check"
@click=${e.acceptRequest}
aria-label="${e.desc_accept}" title="${e.desc_accept}" href="#"></a>
<a class="decline-xmpp-request list-item-action list-item-action--visible fa fa-times"
@click=${e.declineRequest}
aria-label="${e.desc_decline}" title="${e.desc_decline}" href="#"></a>`)(Object.assign(this.model.toJSON(),{display_name:e,openChat:e=>this.openChat(e),acceptRequest:e=>this.acceptRequest(e),declineRequest:e=>this.declineRequest(e),desc_accept:vh("Click to accept the contact request from %1$s",e),desc_decline:vh("Click to decline the contact request from %1$s",e),allow_chat_pending_contacts:Cl.settings.get("allow_chat_pending_contacts")}))}if("both"===n||"to"===n||KS.isSameBareJID(s,va.connection.jid))return this.renderRosterItem(this.model)}renderRosterItem(e){const t={dnd:vh("This contact is busy"),online:vh("This contact is online"),offline:vh("This contact is offline"),unavailable:vh("This contact is unavailable"),xa:vh("This contact is away for an extended period"),away:vh("This contact is away")},n=e.presence.get("show")||"offline";let s;s="online"===n?"fa fa-circle chat-status chat-status--online":"away"===n?"fa fa-circle chat-status chat-status--away":"xa"===n?"far fa-circle chat-status chat-status-xa":"dnd"===n?"fa fa-minus-circle chat-status chat-status--busy":"fa fa-times-circle chat-status chat-status--offline";const i=e.getDisplayName();return(e=>{const t=vh("Click to chat with %1$s (XMPP address: %2$s)",e.display_name,e.jid),n=vh("Click to remove %1$s as a contact",e.display_name);return Qc`
<a class="list-item-link cbox-list-item open-chat ${e.num_unread?"unread-msgs":""}" title="${t}" href="#" @click=${e.openChat}>
${_v(e.getAvatarData())}
<span class="${e.status_icon}" title="${e.desc_status}"></span>
${e.num_unread?Qc`<span class="msgs-indicator">${e.num_unread}</span>`:""}
<span class="contact-name contact-name--${e.show} ${e.num_unread?"unread-msgs":""}">${e.display_name}</span>
</a>
${Cl.settings.get("allow_contact_removal")?Qc`<a class="list-item-action remove-xmpp-contact far fa-trash-alt" @click=${e.removeContact} title="${n}" href="#"></a>`:""}`})(Object.assign(e.toJSON(),{show:n,display_name:i,status_icon:s,openChat:e=>this.openChat(e),removeContact:e=>this.removeContact(e),getAvatarData:()=>this.getAvatarData(),desc_status:t[n],num_unread:e.get("num_unread")||0}))}getAvatarData(){var e,t;return{classes:"avatar",height:30,width:30,image:"data:"+((null===(e=this.model.vcard)||void 0===e?void 0:e.get("image_type"))||va.DEFAULT_IMAGE_TYPE)+";base64,"+((null===(t=this.model.vcard)||void 0===t?void 0:t.get("image"))||va.DEFAULT_IMAGE)}}openChat(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.openChat()}removeContact(e){var t;if(null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),Cl.settings.get("allow_contact_removal")&&confirm(vh("Are you sure you want to remove this contact?")))try{this.model.removeFromRoster(),this.model.collection&&this.model.destroy()}catch(e){M.error(e),Cl.alert("error",vh("Error"),[vh("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.getDisplayName())])}}async acceptRequest(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),await va.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()}declineRequest(e){return e&&e.preventDefault&&e.preventDefault(),!0===confirm(vh("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}}Cl.elements.define("converse-roster-contact",YS);const QS=Zo.extend({initialize(){this.set({filter_text:"",filter_type:"contacts",chat_state:"online"})}});class XS extends Uf{constructor(){super(),this.initialize()}initialize(){const e=new va.RosterFilter;e.id=`_converse.rosterfilter-${va.bare_jid}`,_o(e,e.id),this.model=e,va.roster_filter=e,this.liveFilter=hc((()=>{this.model.save({filter_text:this.querySelector(".roster-filter").value})}),250),this.listenTo(va,"rosterContactsFetched",this.requestUpdate),this.listenTo(va.presences,"change:show",this.requestUpdate),this.listenTo(va.roster,"add",this.requestUpdate),this.listenTo(va.roster,"destroy",this.requestUpdate),this.listenTo(va.roster,"remove",this.requestUpdate),this.listenTo(this.model,"change",this.dispatchUpdateEvent),this.listenTo(this.model,"change",this.requestUpdate),this.model.fetch()}render(){return(e=>{const t=vh("Filter"),n=vh("Filter by contact name"),s=vh("Filter by group name"),i=vh("Filter by status"),r=vh("Any"),o=vh("Unread"),a=vh("Online"),c=vh("Chatty"),l=vh("Busy"),d=vh("Away"),u=vh("Extended Away"),h=vh("Offline");return Qc`
<form class="controlbox-padded roster-filter-form input-button-group ${e.visible?"fade-in":"hidden"}"
@submit=${e.submitFilter}>
<div class="form-inline flex-nowrap">
<div class="filter-by d-flex flex-nowrap">
<span @click=${e.changeTypeFilter} class="fa fa-user ${"contacts"===e.filter_type?"selected":""}" data-type="contacts" title="${n}"></span>
<span @click=${e.changeTypeFilter} class="fa fa-users ${"groups"===e.filter_type?"selected":""}" data-type="groups" title="${s}"></span>
<span @click=${e.changeTypeFilter} class="fa fa-circle ${"state"===e.filter_type?"selected":""}" data-type="state" title="${i}"></span>
</div>
<div class="btn-group">
<input .value="${e.filter_text||""}"
@keydown=${e.liveFilter}
class="roster-filter form-control ${"state"===e.filter_type?"hidden":""}"
placeholder="${t}"/>
<span class="clear-input fa fa-times ${e.filter_text&&"state"!==e.filter_type?"":"hidden"}"
@click=${e.clearFilter}>
</span>
</div>
<select class="form-control state-type ${"state"!==e.filter_type?"hidden":""}"
@change=${e.changeChatStateFilter}>
<option value="">${r}</option>
<option ?selected=${"unread_messages"===e.chat_state} value="unread_messages">${o}</option>
<option ?selected=${"online"===e.chat_state} value="online">${a}</option>
<option ?selected=${"chat"===e.chat_state} value="chat">${c}</option>
<option ?selected=${"dnd"===e.chat_state} value="dnd">${l}</option>
<option ?selected=${"away"===e.chat_state} value="away">${d}</option>
<option ?selected=${"xa"===e.chat_state} value="xa">${u}</option>
<option ?selected=${"offline"===e.chat_state} value="offline">${h}</option>
</select>
</div>
</form>`})(Object.assign(this.model.toJSON(),{visible:this.shouldBeVisible(),changeChatStateFilter:e=>this.changeChatStateFilter(e),changeTypeFilter:e=>this.changeTypeFilter(e),clearFilter:e=>this.clearFilter(e),liveFilter:e=>this.liveFilter(e),submitFilter:e=>this.submitFilter(e)}))}dispatchUpdateEvent(){this.dispatchEvent(new CustomEvent("update",{detail:this.model.changed}))}changeChatStateFilter(e){e&&e.preventDefault(),this.model.save({chat_state:this.querySelector(".state-type").value})}changeTypeFilter(e){e&&e.preventDefault();const t=e.target.dataset.type;"state"===t?this.model.save({filter_type:t,chat_state:this.querySelector(".state-type").value}):this.model.save({filter_type:t,filter_text:this.querySelector(".roster-filter").value})}submitFilter(e){e&&e.preventDefault(),this.liveFilter()}isActive(){return"state"===this.model.get("filter_type")||this.model.get("filter_text")}shouldBeVisible(){var e;return(null===(e=va.roster)||void 0===e?void 0:e.length)>=5||this.isActive()}clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}Cl.elements.define("converse-roster-filter",XS);var ZS=n(74),ex={};ex.styleTagTransform=eg(),ex.setAttributes=Yf(),ex.insert=Jf().bind(null,"head"),ex.domAPI=Wf(),ex.insertStyleElement=Xf(),Hf()(ZS.Z,ex),ZS.Z&&ZS.Z.locals&&ZS.Z.locals,jl.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Cl.settings.extend({autocomplete_add_contact:!0,allow_chat_pending_contacts:!0,allow_contact_removal:!0,hide_offline_users:!1,roster_groups:!0,xhr_user_search_url:null}),Cl.promises.add("rosterViewInitialized"),va.RosterFilter=QS,va.RosterFilterView=XS,va.RosterContactView=YS,Cl.listen.on("chatBoxesInitialized",(()=>{va.chatboxes.on("destroy",(e=>US(e))),va.chatboxes.on("change:hidden",(e=>US(e)))})),Cl.listen.on("afterTearDown",(()=>{var e;return null===(e=va.rotergroups)||void 0===e?void 0:e.off().reset()}))}}),va.CustomElement=Uf;const tx=jl.initialize;jl.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(Bf):e.whitelisted_plugins=Bf,tx(e,t)};const nx=jl},6300:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},3742:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7904:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4639:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6220:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9107:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7581:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6752:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},115:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8859:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7926:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7620),i=n.n(s),r=n(1246),o=n
2021-01-29 23:34:36 +01:00
//# sourceMappingURL=converse.min.js.map