/*! For license information please see converse.min.js.LICENSE.txt */
(()=>{var e,t,s,n,i={169:(e,t,s)=>{var n;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function r(e){return function(e,t){var s,n,o,a,c,l,d,u,h,m=1,g=e.length,f="";for(n=0;n ${e} ${e.note}=128&&x("not-basic"),b.push(e.charCodeAt(n));for(i=s>0?s+1:0;i<_;){for(r=S,o=1,u=c;i>=_&&x("invalid-input"),((h=(y=e.charCodeAt(i++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:c)>=c||h>w((a-S)/o))&&x("overflow"),S+=h*o,!(h<(p=u<=E?l:u>=E+d?d:u-E));u+=c)o>w(a/(v=c-p))&&x("overflow"),o*=v;E=k(S-r,t=b.length+1,0==r),w(S/t)>a-A&&x("overflow"),A+=w(S/t),S%=t,b.splice(S++,0,A)}return $(b)}function I(e){var t,s,n,i,r,o,u,h,p,v,y,b,_,A,E,$=[];for(b=(e=C(e)).length,t=g,s=0,r=m,o=0;o=t&&yw((a-s)/(_=n+1))&&x("overflow"),s+=(u-t)*_,t=u,o=0;oa&&x("overflow"),y==t){for(h=s,p=c;!(h<(v=p<=r?l:p>=r+d?d:p-r));p+=c)E=h-v,A=c-v,$.push(S(j(v+E%A,0))),h=w(E/A);$.push(S(j(h,0))),r=k(s,_,n==i),s=0,++n}++s,++t}return $.join("")}o={version:"1.3.2",ucs2:{decode:C,encode:$},decode:T,encode:I,toASCII:function(e){return E(e,(function(e){return v.test(e)?"xn--"+I(e):e}))},toUnicode:function(e){return E(e,(function(e){return p.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(n=function(){return o}.call(t,s,t,e))||(e.exports=n)}()},3945:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>sI});var n={};s.r(n),s.d(n,{DOMParser:()=>x,WebSocket:()=>S,getDummyXMLDOMDocument:()=>A});var i={};s.r(i),s.d(i,{addCookies:()=>P,arrayBufToBase64:()=>D,base64ToArrayBuf:()=>z,copyElement:()=>J,createHtml:()=>Q,default:()=>ae,escapeNode:()=>te,forEachChild:()=>X,getBareJidFromJid:()=>oe,getDomainFromJid:()=>ie,getNodeFromJid:()=>ne,getResourceFromJid:()=>re,getText:()=>ee,handleError:()=>N,isTagEqual:()=>Z,stringToArrayBuf:()=>L,unescapeNode:()=>se,utf16to8:()=>M,validAttribute:()=>W,validCSS:()=>V,validTag:()=>G,xmlElement:()=>H,xmlGenerator:()=>F,xmlHtmlNode:()=>q,xmlTextNode:()=>B,xmlescape:()=>K,xmlunescape:()=>Y,xorArrayBuffers:()=>R});var r={};s.r(r),s.d(r,{ACTIVE:()=>rt,ANONYMOUS:()=>Ve,BOSH_WAIT:()=>He,CHATROOMS_TYPE:()=>dt,CHAT_STATES:()=>pt,CLOSED:()=>Qe,COMPOSING:()=>ot,CONNECTION_STATUS:()=>mt,CONTROLBOX_TYPE:()=>ht,CORE_PLUGINS:()=>gt,DEFAULT_IMAGE:()=>nt,DEFAULT_IMAGE_TYPE:()=>st,EXTERNAL:()=>Je,FAILURE:()=>tt,GONE:()=>ct,HEADLINES_TYPE:()=>ut,INACTIVE:()=>it,KEYCODES:()=>vt,LOGIN:()=>Ke,LOGOUT:()=>Ye,OPENED:()=>Xe,PAUSED:()=>at,PREBIND:()=>Ze,PRIVATE_CHAT_TYPE:()=>lt,STATUS_WEIGHTS:()=>We,SUCCESS:()=>et,URL_PARSE_OPTIONS:()=>ft,VERSION_NAME:()=>Ge});var o={};s.r(o),s.d(o,{decodeHTMLEntities:()=>Ct,isElement:()=>_t,isTagEqual:()=>wt,queryChildren:()=>xt,siblingIndex:()=>At,stringToElement:()=>St});var a={};s.r(a),s.d(a,{isError:()=>tu,isFunction:()=>su,merge:()=>eu});var c={};s.r(c),s.d(c,{clearSession:()=>gu,getUnloadEvent:()=>du,isTestEnv:()=>lu,isUniView:()=>cu,replacePromise:()=>uu,shouldClearCache:()=>hu,tearDown:()=>mu});var l={};s.r(l),s.d(l,{createStore:()=>Tu,getDefaultStore:()=>ju,initStorage:()=>Iu});var d={};s.r(d),s.d(d,{getJIDFromURI:()=>zu,isSameBareJID:()=>Ru,isSameDomain:()=>Du,isValidJID:()=>Nu,isValidMUCJID:()=>Mu});var u={};s.r(u),s.d(u,{getAttributes:()=>xh,isErrorStanza:()=>_h,isForbiddenError:()=>wh,isServiceUnavailableError:()=>Sh});var h={};s.r(h),s.d(h,{getCurrentWord:()=>jh,getSelectValues:()=>Ch,isMentionBoundary:()=>kh,placeCaretAtEnd:()=>Ih,replaceCurrentWord:()=>Th,webForm2xForm:()=>$h});var m={};s.r(m),s.d(m,{appendArrayBuffer:()=>Oh,arrayBufferToBase64:()=>Dh,arrayBufferToHex:()=>Nh,arrayBufferToString:()=>Mh,base64ToArrayBuffer:()=>zh,hexToArrayBuffer:()=>Lh,stringToArrayBuffer:()=>Rh});var g={};s.r(g),s.d(g,{checkFileTypes:()=>Hh,filterQueryParamsFromURL:()=>Gh,getMediaURLs:()=>Zh,getMediaURLsMetadata:()=>Xh,getURI:()=>qh,isAudioURL:()=>Qh,isEncryptedFileURL:()=>Yh,isGIFURL:()=>Vh,isImageURL:()=>Kh,isURLWithImageExtension:()=>Wh,isValidURL:()=>Bh,isVideoURL:()=>Jh});var f={};s.r(f),s.d(f,{AFFILIATIONS:()=>df,AFFILIATION_CHANGES:()=>hf,AFFILIATION_CHANGES_LIST:()=>mf,INFO_CODES:()=>yf,MUC_NICK_CHANGED_CODE:()=>wf,MUC_ROLE_CHANGES:()=>pf,MUC_ROLE_CHANGES_LIST:()=>vf,MUC_ROLE_WEIGHTS:()=>uf,MUC_TRAFFIC_STATES:()=>gf,MUC_TRAFFIC_STATES_LIST:()=>ff,ROLES:()=>lf,ROOMSTATUS:()=>bf,ROOM_FEATURES:()=>_f});var p=s(1615),v=s.n(p),y=s(5569),b=s.n(y),_=s(9807),w=s.n(_);const S=window.WebSocket,x=window.DOMParser;function A(){return document.implementation.createDocument("jabber:client","strophe",null)}const E={HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",FRAMING:"urn:ietf:params:xml:ns:xmpp-framing",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas",XHTML_IM:"http://jabber.org/protocol/xhtml-im",XHTML:"http://www.w3.org/1999/xhtml"},C={tags:["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul","body"],attributes:{a:["href"],blockquote:["style"],br:[],cite:["style"],em:[],img:["src","alt","style","height","width"],li:["style"],ol:["style"],p:["style"],span:["style"],strong:[],ul:["style"],body:[]},css:["background-color","color","font-family","font-size","font-style","font-weight","margin-left","margin-right","text-align","text-decoration"]},$={ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8,REDIRECT:9,CONNTIMEOUT:10,BINDREQUIRED:11,ATTACHFAIL:12,RECONNECTING:13},j={BAD_FORMAT:"bad-format",CONFLICT:"conflict",MISSING_JID_NODE:"x-strophe-bad-non-anon-jid",NO_AUTH_MECH:"no-auth-mech",UNKNOWN_REASON:"unknown"},k={DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},T={NORMAL:1,TEXT:3,CDATA:4,FRAGMENT:11};let I=k.DEBUG;const O={setLogLevel(e){if(e=0&&s<=127?t+=e.charAt(n):s>2047?(t+=String.fromCharCode(224|s>>12&15),t+=String.fromCharCode(128|s>>6&63),t+=String.fromCharCode(128|63&s)):(t+=String.fromCharCode(192|s>>6&31),t+=String.fromCharCode(128|63&s))}return t}function R(e,t){const s=new Uint8Array(e),n=new Uint8Array(t),i=new Uint8Array(e.byteLength);for(let t=0;t=43)}})).catch((function(){return!1}))}(e).then((function(e){return Ro=e,Ro}))}function Fo(e){var t=Do[e.name],s={};s.promise=new ko((function(e,t){s.resolve=e,s.reject=t})),t.deferredOperations.push(s),t.dbReady?t.dbReady=t.dbReady.then((function(){return s.promise})):t.dbReady=s.promise}function Bo(e){var t=Do[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function qo(e,t){var s=Do[e.name].deferredOperations.pop();if(s)return s.reject(t),s.promise}function Ho(e,t){return new ko((function(s,n){if(Do[e.name]=Do[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return s(e.db);Fo(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var r=Co.open.apply(Co,i);t&&(r.onupgradeneeded=function(t){var s=r.result;try{s.createObjectStore(e.storeName),t.oldVersion<=1&&s.createObjectStore(Mo)}catch(s){if("ConstraintError"!==s.name)throw s;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),r.onerror=function(e){e.preventDefault(),n(r.error)},r.onsuccess=function(){var t=r.result;t.onversionchange=function(e){e.target.close()},s(t),Bo(e)}}))}function Go(e){return Ho(e,!1)}function Wo(e){return Ho(e,!0)}function Vo(e,t){if(!e.db)return!0;var s=!e.db.objectStoreNames.contains(e.storeName),n=e.version=0;t--){var s=localStorage.key(t);0===s.indexOf(e)&&localStorage.removeItem(s)}})):ko.reject("Invalid arguments"),To(n,t),n}};const ja=$a,ka=(e,t)=>e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t),Ta=(e,t)=>{const s=e.length;let n=0;for(;n{}))}config(e){if("object"==typeof e){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(let t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config}defineDriver(e,t,s){const n=new ko((function(t,s){try{const n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void s(i);const r=za.concat("_initStorage");for(let t=0,n=r.length;tparseInt(e,16))));return t.buffer}var Ph=s(9542),Uh=s.n(Ph);const Fh=ou;function Bh(e){try{return!!new URL(e)}catch(e){return kt.error(e),!1}}function qh(e){try{return e instanceof Uh()?e:new(Uh())(e)}catch(e){return kt.debug(e),null}}function Hh(e,t){const s=qh(t);if(null===s)throw new Error(`checkFileTypes: could not parse url ${t}`);const n=s.filename().toLowerCase();return!!e.filter((e=>n.endsWith(e))).length}function Gh(e){const t=Fh.get("filter_url_query_params");if(!t)return e;return qh(e).removeQuery(t).toString()}function Wh(e){return Hh([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".svg"],e)}function Vh(e){return Hh([".gif"],e)}function Qh(e){return Hh([".ogg",".mp3",".m4a"],e)}function Jh(e){return Hh([".mp4",".webm"],e)}function Kh(e){const t=Fh.get("image_urls_regex");return t?.test(e)||Wh(e)}function Yh(e){return e.startsWith("aesgcm://")}function Xh(e,t=0){const s=[];if(!e)return{};try{Uh().withinString(e,((e,n,i)=>(e.startsWith("_")&&(e=e.slice(1),n+=1),e.endsWith("_")&&(e=e.slice(0,e.length-1),i-=1),s.push({url:e,start:n+t,end:i+t}),e)),ft)}catch(e){kt.debug(e)}const n=s.map((e=>({end:e.end,is_audio:Qh(e.url),is_image:Kh(e.url),is_video:Jh(e.url),is_encrypted:Yh(e.url),start:e.start})));return n.length?{media_urls:n}:{}}function Zh(e,t,s=0){return e.map((e=>{const n=e.start-s,i=e.end-s;return n<0||n>=t.length?null:Object.assign({},e,{start:n,end:i,url:t.substring(e.start-s,e.end-s)})})).filter((e=>e))}function em(e){if(location.hash.startsWith("#converse?loglevel=")){e?.preventDefault();const t=location.hash.split("=").pop();Object.keys($t).includes(t)?kt.setLogLevel(t):kt.error(`Could not set loglevel of ${t}`)}}function tm(e){return e instanceof wd&&(e=e.attributes),!(e.oob_url||e.file||e.is_encrypted&&e.plaintext||e.message||e.body)}function sm(e){return e instanceof Error}function nm(e,t,s){!function(e){return e.collection&&e.collection.browserStorage}(e)?e.set(t,s):e.save(t,s)}function im(e){return Math.random()*e|0}function rm(e){const t=crypto.randomUUID?.()??"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=im(16);return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t}const om=Object.assign({...m,...h,...o,...d,...a,...c,...u,...l,...g,getLongestSubstring:function(e,t){return t.reduce((function(t,s){return e.startsWith(s)&&s.length>t.length?s:t}),"")},getOpenPromise:vc,getRandomInt:im,getUniqueId:rm,isEmptyMessage:tm,isErrorObject:sm,onMultipleEvents:function(e=[],t){let s=[];function n(n){s.push(n),e.length===s.length&&(t(s),s=[])}e.forEach((e=>e.object.on(e.event,n)))},prefixMentions:function(e){let t=e.getMessageText();return(e.get("references")||[]).sort(((e,t)=>t.begin-e.begin)).forEach((e=>{t=`${t.slice(0,e.begin)}@${t.slice(e.begin)}`})),t},safeSave:nm,shouldCreateMessage:function(e){return e.retracted||!tm(e)},toStanza:Fe,triggerEvent:function(e,t,s="Event",n=!0,i=!0){const r=document.createEvent(s);r.initEvent(t,n,i),e.dispatchEvent(r)},waitUntil:Yu},{muc:null,mam:null});const am=class extends wd{defaults(){return{connection_status:qe.Status.DISCONNECTED,message:""}}initialize(){super.initialize();const{api:e}=yu;this.on("change",(()=>e.trigger("connfeedback",yu.state.connfeedback)))}},cm="array",lm="bit",dm="bits",um="byte",hm="bytes",mm="",gm="exponent",fm="function",pm="iec",vm="Invalid number",ym="Invalid rounding method",bm="jedec",_m="object",wm=".",Sm="round",xm="s",Am="si",Em="kbit",Cm="kB",$m=" ",jm="string",km="0",Tm={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function Im(e,{bits:t=!1,pad:s=!1,base:n=-1,round:i=2,locale:r=mm,localeOptions:o={},separator:a=mm,spacer:c=$m,symbols:l={},standard:d=mm,output:u=jm,fullform:h=!1,fullforms:m=[],exponent:g=-1,roundingMethod:f=Sm,precision:p=0}={}){let v=g,y=Number(e),b=[],_=0,w=mm;d===Am?(n=10,d=bm):d===pm||d===bm?n=2:2===n?d=pm:(n=10,d=bm);const S=10===n?1e3:1024,x=!0===h,A=y<0,E=Math[f];if("bigint"!=typeof e&&isNaN(e))throw new TypeError(vm);if(typeof E!==fm)throw new TypeError(ym);if(A&&(y=-y),(-1===v||isNaN(v))&&(v=Math.floor(Math.log(y)/Math.log(S)),v<0&&(v=0)),v>8&&(p>0&&(p+=8-v),v=8),u===gm)return v;if(0===y)b[0]=0,w=b[1]=Tm.symbol[d][t?dm:hm][v];else{_=y/(2===n?Math.pow(2,10*v):Math.pow(1e3,v)),t&&(_*=8,_>=S&&v<8&&(_/=S,v++));const e=Math.pow(10,v>0?i:0);b[0]=E(_*e)/e,b[0]===S&&v<8&&-1===g&&(b[0]=1,v++),w=b[1]=10===n&&1===v?t?Em:Cm:Tm.symbol[d][t?dm:hm][v]}if(A&&(b[0]=-b[0]),p>0&&(b[0]=b[0].toPrecision(p)),b[1]=l[b[1]]||b[1],!0===r?b[0]=b[0].toLocaleString():r.length>0?b[0]=b[0].toLocaleString(r,o):a.length>0&&(b[0]=b[0].toString().replace(wm,a)),s&&!1===Number.isInteger(b[0])&&i>0){const e=a||wm,t=b[0].toString().split(e),s=t[1]||mm,n=s.length,r=i-n;b[0]=`${t[0]}${e}${s.padEnd(n+r,km)}`}return x&&(b[1]=m[v]?m[v]:Tm.fullform[d][v]+(t?lm:um)+(1===b[0]?mm:xm)),u===cm?b:u===_m?{value:b[0],symbol:b[1],exponent:v,unit:w}:b.join(c)}const Om=window,Nm=Om.ShadowRoot&&(void 0===Om.ShadyCSS||Om.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Mm=Symbol(),Rm=new WeakMap;class Dm{constructor(e,t,s){if(this._$cssResult$=!0,s!==Mm)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Nm&&void 0===e){const s=void 0!==t&&1===t.length;s&&(e=Rm.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Rm.set(t,e))}return e}toString(){return this.cssText}}const zm=Nm?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return(e=>new Dm("string"==typeof e?e:e+"",void 0,Mm))(t)})(e):e;var Lm;const Pm=window,Um=Pm.trustedTypes,Fm=Um?Um.emptyScript:"",Bm=Pm.reactiveElementPolyfillSupport,qm={toAttribute(e,t){switch(t){case Boolean:e=e?Fm:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=null!==e;break;case Number:s=null===e?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch(e){s=null}}return s}},Hm=(e,t)=>t!==e&&(t==t||e==e),Gm={attribute:!0,type:String,converter:qm,reflect:!1,hasChanged:Hm},Wm="finalized";class Vm extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,s)=>{const n=this._$Ep(s,t);void 0!==n&&(this._$Ev.set(n,s),e.push(n))})),e}static createProperty(e,t=Gm){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const s="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,s,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(n){const i=this[e];this[t]=n,this.requestUpdate(e,i,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Gm}static finalize(){if(this.hasOwnProperty(Wm))return!1;this[Wm]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of t)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const e of s)t.unshift(zm(e))}else void 0!==e&&t.push(zm(e));return t}static _$Ep(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,s;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(s=e.hostConnected)||void 0===s||s.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{Nm?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const s=document.createElement("style"),n=Om.litNonce;void 0!==n&&s.setAttribute("nonce",n),s.textContent=t.cssText,e.appendChild(s)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$EO(e,t,s=Gm){var n;const i=this.constructor._$Ep(e,s);if(void 0!==i&&!0===s.reflect){const r=(void 0!==(null===(n=s.converter)||void 0===n?void 0:n.toAttribute)?s.converter:qm).toAttribute(t,s.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var s;const n=this.constructor,i=n._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=n.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(s=e.converter)||void 0===s?void 0:s.fromAttribute)?e.converter:qm;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,s){let n=!0;void 0!==e&&(((s=s||this.constructor.getPropertyOptions(e)).hasChanged||Hm)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===s.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,s))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(s)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(s)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var Qm,Jm;Vm[Wm]=!0,Vm.elementProperties=new Map,Vm.elementStyles=[],Vm.shadowRootOptions={mode:"open"},null==Bm||Bm({ReactiveElement:Vm}),(null!==(Lm=Pm.reactiveElementVersions)&&void 0!==Lm?Lm:Pm.reactiveElementVersions=[]).push("1.6.3");class Km extends Vm{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const s=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=s.firstChild),s}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Gs(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return $s}}Km.finalized=!0,Km._$litElement$=!0,null===(Qm=globalThis.litElementHydrateSupport)||void 0===Qm||Qm.call(globalThis,{LitElement:Km});const Ym=globalThis.litElementPolyfillSupport;null==Ym||Ym({LitElement:Km});(null!==(Jm=globalThis.litElementVersions)&&void 0!==Jm?Jm:globalThis.litElementVersions=[]).push("3.3.3"),yu.api=bh;const Xm=Object.assign(window.converse||{},{CHAT_STATES:pt,keycodes:vt,async initialize(e){const{api:t}=yu;if(await async function(e){const{api:t}=e;await t.trigger("cleanup",{synchronous:!0}),function(e){e.api.trigger("unregisteredGlobalEventHandlers")}(e),t.connection.get()?.reset(),e.stopListening(),e.off(),e.promises.initialized.isResolved&&t.promises.add("initialized")}(yu),function(e){iu=e,nu=new ru;const t=_d(e,Object.keys(Zd));Object.assign(nu,Zd,t)}(e),yu.strict_plugin_dependencies=e.strict_plugin_dependencies,kt.setLogLevel(t.settings.get("loglevel")),t.settings.get("authentication")===Ve&&t.settings.get("auto_login")&&!t.settings.get("jid"))throw new Error("Config Error: you need to provide the server's domain via the 'jid' option when using anonymous authentication with auto_login.");em(),addEventListener("hashchange",em);const s=new am;Object.assign(yu,{connfeedback:s}),Object.assign(yu.state,{connfeedback:s}),await async function(e){await rl.sessionStorageInitialized,e.storage.session=rl.localForage.createInstance({name:lu()?"converse-test-session":"converse-session",description:"sessionStorage instance",driver:["sessionStorageWrapper"]})}(yu),await async function(e){const t="converse.client-config",s=new wd({id:t,trusted:!0});s.browserStorage=Tu(t,"session"),Object.assign(e,{config:s}),Object.assign(e.state,{config:s}),await new Promise((e=>s.fetch({success:e,error:e}))),e.api.trigger("clientConfigInitialized")}(yu),await It.initialize(),function(e){e.pluggable.initialized_plugins=[];const t=gt.concat(e.api.settings.get("whitelisted_plugins"));e.api.settings.get("singleton")&&["converse-bookmarks","converse-controlbox","converse-headline","converse-register"].forEach((t=>e.api.settings.get("blacklisted_plugins").push(t))),e.pluggable.initializePlugins({_converse:e},t,e.api.settings.get("blacklisted_plugins")),e.api.trigger("pluginsInitialized")}(yu),t.elements?.register(),function(e){e.api.trigger("registeredGlobalEventHandlers")}(yu);const n=yu.pluggable.plugins;if((t.settings.get("auto_login")||t.settings.get("keepalive")&&n["converse-bosh"]?.enabled())&&await t.user.login(null,null,!0),t.trigger("initialized"),lu())return yu},plugins:{add(e,t){if(t.__name__=e,void 0!==yu.pluggable.plugins[e])throw new TypeError(`Error: plugin with name "${e}" has already been registered!`);yu.pluggable.plugins[e]=t}},env:{$build:ce,$iq:de,$msg:le,$pres:ue,utils:om,Collection:Gd,Model:wd,Promise,Strophe:qe,TimeoutError:Zu,URI:Uh(),VERSION_NAME:Ge,dayjs:b(),filesize:Im,html:Cs,log:kt,sizzle:Au(),sprintf:Tt.sprintf,stx:function(e,...t){return new Be(e,t)},u:om}}),Zm=Xm;const eg=class extends wd{defaults(){return{current_category:"smileys",current_skintone:"",scroll_position:0}}},tg=new RegExp("|]*>.*?|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|((\\s|^)(\\*\\\\0\\/\\*|\\*\\\\O\\/\\*|\\-___\\-|\\:'\\-\\)|'\\:\\-\\)|'\\:\\-D|\\>\\:\\-\\)|>\\:\\-\\)|'\\:\\-\\(|\\>\\:\\-\\(|>\\:\\-\\(|\\:'\\-\\(|O\\:\\-\\)|0\\:\\-3|0\\:\\-\\)|0;\\^\\)|O;\\-\\)|0;\\-\\)|O\\:\\-3|\\-__\\-|\\:\\-Þ|\\:\\-Þ|\\<\\/3|<\\/3|\\:'\\)|\\:\\-D|'\\:\\)|'\\=\\)|'\\:D|'\\=D|\\>\\:\\)|>\\:\\)|\\>;\\)|>;\\)|\\>\\=\\)|>\\=\\)|;\\-\\)|\\*\\-\\)|;\\-\\]|;\\^\\)|'\\:\\(|'\\=\\(|\\:\\-\\*|\\:\\^\\*|\\>\\:P|>\\:P|X\\-P|\\>\\:\\[|>\\:\\[|\\:\\-\\(|\\:\\-\\[|\\>\\:\\(|>\\:\\(|\\:'\\(|;\\-\\(|\\>\\.\\<|>\\.<|#\\-\\)|%\\-\\)|X\\-\\)|\\\\0\\/|\\\\O\\/|0\\:3|0\\:\\)|O\\:\\)|O\\=\\)|O\\:3|B\\-\\)|8\\-\\)|B\\-D|8\\-D|\\-_\\-|\\>\\:\\\\|>\\:\\\\|\\>\\:\\/|>\\:\\/|\\:\\-\\/|\\:\\-\\.|\\:\\-P|\\:Þ|\\:Þ|\\:\\-b|\\:\\-O|O_O|\\>\\:O|>\\:O|\\:\\-X|\\:\\-#|\\:\\-\\)|\\(y\\)|\\<3|<3|\\:D|\\=D|;\\)|\\*\\)|;\\]|;D|\\:\\*|\\=\\*|\\:\\(|\\:\\[|\\=\\(|\\:@|;\\(|D\\:|\\:\\$|\\=\\$|#\\)|%\\)|X\\)|B\\)|8\\)|\\:\\/|\\:\\\\|\\=\\/|\\=\\\\|\\:L|\\=L|\\:P|\\=P|\\:b|\\:O|\\:X|\\:#|\\=X|\\=#|\\:\\)|\\=\\]|\\=\\)|\\:\\])(?=\\s|$|[!,.?]))","gi"),sg=/(?:\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d])|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5\udeeb\udeec\udef4-\udefa\udfe0-\udfeb]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd1d\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd71\udd73-\udd76\udd7a-\udda2\udda5-\uddaa\uddae-\uddb4\uddb7\uddba\uddbc-\uddca\uddd0\uddde-\uddff\ude70-\ude73\ude78-\ude7a\ude80-\ude82\ude90-\ude95]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g,{u:ng}=Zm.env,ig={},rg={"*\\0/*":"1f646","*\\O/*":"1f646","-___-":"1f611",":'-)":"1f602","':-)":"1f605","':-D":"1f605",">:-)":"1f606","':-(":"1f613",">:-(":"1f620",":'-(":"1f622","O:-)":"1f607","0:-3":"1f607","0:-)":"1f607","0;^)":"1f607","O;-)":"1f607","0;-)":"1f607","O:-3":"1f607","-__-":"1f611",":-Þ":"1f61b","3":"1f494",":')":"1f602",":-D":"1f603","':)":"1f605","'=)":"1f605","':D":"1f605","'=D":"1f605",">:)":"1f606",">;)":"1f606",">=)":"1f606",";-)":"1f609","*-)":"1f609",";-]":"1f609",";^)":"1f609","':(":"1f613","'=(":"1f613",":-*":"1f618",":^*":"1f618",">:P":"1f61c","X-P":"1f61c",">:[":"1f61e",":-(":"1f61e",":-[":"1f61e",">:(":"1f620",":'(":"1f622",";-(":"1f622",">.<":"1f623","#-)":"1f635","%-)":"1f635","X-)":"1f635","\\0/":"1f646","\\O/":"1f646","0:3":"1f607","0:)":"1f607","O:)":"1f607","O=)":"1f607","O:3":"1f607","B-)":"1f60e","8-)":"1f60e","B-D":"1f60e","8-D":"1f60e","-_-":"1f611",">:\\":"1f615",">:/":"1f615",":-/":"1f615",":-.":"1f615",":-P":"1f61b",":Þ":"1f61b",":-b":"1f61b",":-O":"1f62e",O_O:"1f62e",">:O":"1f62e",":-X":"1f636",":-#":"1f636",":-)":"1f642","(y)":"1f44d","<3":"2764",":D":"1f603","=D":"1f603",";)":"1f609","*)":"1f609",";]":"1f609",";D":"1f609",":*":"1f618","=*":"1f618",":(":"1f61e",":[":"1f61e","=(":"1f61e",":@":"1f620",";(":"1f622","D:":"1f628",":$":"1f633","=$":"1f633","#)":"1f635","%)":"1f635","X)":"1f635","B)":"1f60e","8)":"1f60e",":/":"1f615",":\\":"1f615","=/":"1f615","=\\":"1f615",":L":"1f615","=L":"1f615",":P":"1f61b","=P":"1f61b",":b":"1f61b",":O":"1f62e",":X":"1f636",":#":"1f636","=X":"1f636","=#":"1f636",":)":"1f642","=]":"1f642","=)":"1f642",":]":"1f642"};function og(e){if(e.indexOf("-")>-1){const t=[],s=e.split("-");for(let e=0;e
${t.loading_users_with_affiliation?Cs`
${t.loading_users_with_role?Cs`
${e.text}
`)({text:t})}if("jid-multi"===e.getAttribute("type"))return(e=>{const t=om.getUniqueId();return Cs`${e}
\``,preformatted_block:e=>Cs`${e}
${xx(e,t,s)}`,strike:(e,t,s)=>Cs`~
: ${t[e]}
`)(t,e)))}`:Cs`: ${this.model.getMessageText()}
`}});bh.elements.define("converse-message-versions-modal",class extends t_{renderModal(){return Cs`${n.fullname}
`:""}${n.nickname?Cs`${n.nickname}
`:""} ${n.url?Cs``:""} ${n.email?Cs``:""} ${n.role?Cs`${n.role}
`:""}${e.model.get("moderation_reason")}`:""}`})(this)}renderMessageText(){return _A(this)}renderMEPMessage(){return(e=>{const t=uA(e.model.get("time")).toISOString();return Cs` `})(this)}renderInfoMessage(){return(e=>{const t=dA(e.model.get("time")).toISOString(),s=kb("Retry");return Cs` `})(this)}renderFileProgress(){return this.model.file?(e=>{const t=kb("Uploading file:"),s=e.model.file.name,n=lA(e.model.file.size);return Cs` `})(this):""}renderChatMessage(){return((e,t)=>{const s=kb("New messages"),n=e.model.isFollowup();return Cs`${t.is_first_unread?Cs` `:""} `})(this,this.getProps())}shouldShowAvatar(){return bh.settings.get("show_message_avatar")&&!this.model.isMeCommand()&&["chat","groupchat","normal"].includes(this.model.get("type"))}onUnfurlAnimationEnd(){"fade-out"===this.model.get("url_preview_transition")&&this.model.save({hide_url_previews:!0,url_preview_transition:"fade-in"})}async onRetryClicked(){this.show_spinner=!0,this.requestUpdate(),await bh.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(){return this.model.occupant?.get("affiliation")}getOccupantRole(){return this.model.occupant?.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=bh.settings.get("time_format");return{pretty_time:AA(this.model.get("edited")||this.model.get("time")).format(e),has_mentions:this.hasMentions(),hats:rx(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","mep"].includes(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:xA.getResourceFromJid(e)}));const s=this.model.mod?this.model.mod.getDisplayName():"A moderator";return kb("%1$s has removed this message",s)}return kb("%1$s has removed this message",this.model.getDisplayName())}showUserModal(e){if("me"===this.model.get("sender"))bh.modal.show("converse-profile-modal",{model:this.model},e);else if("groupchat"===this.model.get("type"))e.preventDefault(),bh.modal.show("converse-muc-occupant-modal",{model:this.model.getOccupant(),message:this.model},e);else{e.preventDefault();const t=this.model.collection.chatbox;bh.modal.show("converse-user-details-modal",{model:t},e)}}showMessageVersionsModal(e){e.preventDefault(),bh.modal.show("converse-message-versions-modal",{model:this.model},e)}toggleSpoilerMessage(e){e?.preventDefault(),this.model.save({is_spoiler_visible:!this.model.get("is_spoiler_visible")})}});bh.elements.define("converse-message-history",class extends Ob{constructor(){super(),this.model=null,this.messages=[]}static get properties(){return{model:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?bS(e,(e=>e.get("id")),(e=>Cs`${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 s=bh.hook(t,e,"");return Q_(s,"")}{const t=Cs`
${e.status}
`:""}`})(Object.assign(this.model.toJSON(),{heading_buttons_promise:this.getHeadingButtons(),model:this.model,showUserDetailsModal:e=>this.showUserDetailsModal(e)}))}showUserDetailsModal(e){e.preventDefault(),bh.modal.show("converse-user-details-modal",{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:kb("Details"),i18n_title:kb("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===bh.settings.get("view_mode")}];bh.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:kb("Close"),i18n_title:kb("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===bh.settings.get("view_mode")});const{chatboxviews:t}=yu.state,s=t.get(this.getAttribute("jid"));return s?yu.api.hook("getHeadingButtons",s,e):e}});const{ACTIVE:KA,COMPOSING:YA}=wb;class XA extends Ob{async initialize(){const{chatboxes:e}=yu.state;this.model=e.get(this.getAttribute("jid")),await this.model.initialized,this.listenTo(this.model.messages,"change:correcting",this.onMessageCorrecting),this.listenTo(this.model,"change:composing_spoiler",(()=>this.requestUpdate())),this.handleEmojiSelection=({detail:e})=>{this.model.get("jid")===e.jid&&this.insertIntoTextArea(e.value,e.autocompleting,!1,e.ac_position)},document.addEventListener("emojiSelected",this.handleEmojiSelection),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("emojiSelected",this.handleEmojiSelection)}render(){return(e=>{const t=e.composing_spoiler?kb("Hidden message"):kb("Message"),s=kb("Optional hint"),n=bh.settings.get("show_send_button");return Cs``})(Object.assign(this.model.toJSON(),{onDrop:e=>this.onDrop(e),hint_value:this.querySelector(".spoiler-hint")?.value,message_value:this.querySelector(".chat-textarea")?.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)}))}insertIntoTextArea(e,t=!1,s=!1,n,i=" "){const r=this.querySelector(".chat-textarea");if(s?om.addClass("correcting",r):om.removeClass("correcting",r),t)r.value=n&&"string"==typeof t?r.value.replace(new RegExp(t,"g"),((s,r)=>r==n-t.length?e+i:s)):e;else{let t=r.value;t&&t[t.length-1]!==i&&(t+=i),r.value=t+e+i}const o=document.createEvent("HTMLEvents");o.initEvent("change",!1,!0),r.dispatchEvent(o),om.placeCaretAtEnd(r)}onMessageCorrecting(e){if(e.get("correcting"))this.insertIntoTextArea(om.prefixMentions(e),!0,!0);else{const t=this.model.messages.findWhere("correcting");t&&t!==e?this.insertIntoTextArea(om.prefixMentions(e),!0,!0):this.insertIntoTextArea("",!0,!1)}}onEscapePressed(e){const t=this.model.messages.findLastIndex("correcting"),s=t>=0?this.model.messages.at(t):null;s&&(e.preventDefault(),s.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")})}onDrop(e){0!=e.dataTransfer.files.length&&(e.preventDefault(),this.model.sendFiles(e.dataTransfer.files))}onKeyUp(e){this.model.set({draft:e.target.value})}onKeyDown(e){if(!e.ctrlKey){if(!e.shiftKey&&!e.altKey&&!e.metaKey)if(e.keyCode===Zm.keycodes.TAB){const t=om.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&(e.preventDefault(),e.stopPropagation(),this.model.trigger("emoji-picker-autocomplete",e.target,t))}else{if(e.keyCode===Zm.keycodes.FORWARD_SLASH)return;if(e.keyCode===Zm.keycodes.ESCAPE)return this.onEscapePressed(e);if(e.keyCode===Zm.keycodes.ENTER)return this.onFormSubmitted(e);if(e.keyCode!==Zm.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===Zm.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&om.hasClass("correcting",this.querySelector(".chat-textarea")))return this.model.editLaterMessage()}else{const e=this.querySelector(".chat-textarea");if(!e.value||om.hasClass("correcting",e))return this.model.editEarlierMessage()}}[Zm.keycodes.SHIFT,Zm.keycodes.META,Zm.keycodes.META_RIGHT,Zm.keycodes.ESCAPE,Zm.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==YA&&this.model.setChatState(YA)}}async onFormSubmitted(e){e?.preventDefault?.();const{chatboxviews:t}=yu.state,s=this.querySelector(".chat-textarea"),n=s.value.trim();if(bh.settings.get("message_limit")&&n.length>bh.settings.get("message_limit")||!n.replace(/\s/g,"").length)return;if(!bh.connection.get().authenticated){const e=kb("Sorry, the connection has been lost, and your message could not be sent");return bh.alert("error",kb("Error"),e),void bh.connection.reconnect()}let i,r={};this.model.get("composing_spoiler")&&(r=this.querySelector("form.sendXMPPMessage input.spoiler-hint"),i=r.value),om.addClass("disabled",s),s.setAttribute("disabled","disabled"),this.querySelector("converse-emoji-dropdown")?.hideMenu();const o=await async function(e,t){const s=t.replace(/^\s*/,"").match(/^\/(.*)\s*$/);if(s){let n=!1;if(n=await bh.hook("parseMessageForCommands",{model:e,text:t},n),n)return!0;if("clear"===s[1])return QA(e),!0;if("close"===s[1]){const{chatboxviews:t}=yu.state;return t.get(e.get("jid"))?.close(),!0}if("help"===s[1])return e.set({show_help_messages:!1},{silent:!0}),e.set({show_help_messages:!0}),!0}return!1}(this.model,n),a=o?null:await this.model.sendMessage({body:n,spoiler_hint:i});if((o||a)&&(r.value="",s.value="",om.removeClass("correcting",s),s.style.height="auto",this.model.set({draft:""})),"overlayed"===bh.settings.get("view_mode")){t.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display="none"}if(s.removeAttribute("disabled"),om.removeClass("disabled",s),"overlayed"===bh.settings.get("view_mode")){t.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display=""}this.model.setChatState(KA,{silent:!0}),s.focus()}}bh.elements.define("converse-message-form",XA);var ZA=s(9416),eE={};eE.styleTagTransform=Gb(),eE.setAttributes=Fb(),eE.insert=Pb().bind(null,"head"),eE.domAPI=zb(),eE.insertStyleElement=qb();Rb()(ZA.A,eE);ZA.A&&ZA.A.locals&&ZA.A.locals;class tE extends Ob{async connectedCallback(){super.connectedCallback(),await this.initialize(),this.requestUpdate()}async initialize(){this.model=await bh.chatboxes.get(this.getAttribute("jid")),await this.model.initialized,this.listenTo(this.model,"change:num_unread",(()=>this.requestUpdate())),this.listenTo(this.model,"emoji-picker-autocomplete",this.autocompleteInPicker),this.addEventListener("focusin",(e=>this.emitFocused(e))),this.addEventListener("focusout",(e=>this.emitBlurred(e))),this.addEventListener("click",(e=>this.sendButtonClicked(e)))}render(){return this.model?(e=>{const t=kb("You have unread messages"),s=bh.settings.get("message_limit"),n=bh.settings.get("visible_toolbar_buttons").call,i=bh.settings.get("visible_toolbar_buttons").emoji,r=bh.settings.get("show_send_button"),o=bh.settings.get("visible_toolbar_buttons").spoiler,a=bh.settings.get("show_toolbar");return Cs`${e.model.ui.get("scrolled")&&e.model.get("num_unread")?Cs`${yu.VERSION_NAME}
Open Source XMPP chat client brought to you by Opkode
Translate it into your own language
`:""}`}});bh.elements.define("converse-brand-logo",class extends Ob{render(){const e="fullscreen"===bh.settings.get("view_mode");return Cs` converse.js ${e?Cs` `:""}`}});bh.elements.define("converse-brand-heading",class extends Ob{render(){return Cs`${t}
${e.status}
`:""}`)({...this.model.toJSON(),display_name:this.model.getDisplayName(),heading_buttons_promise:this.getHeadingButtons()})}getHeadingButtons(){const e=[];return bh.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:kb("Close"),i18n_title:kb("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===bh.settings.get("view_mode")}),yu.api.hook("getHeadingButtons",this,e)}close(e){e.preventDefault(),this.model.close()}});class YE extends iE{async initialize(){const{chatboxviews:e,chatboxes:t}=yu.state;e.add(this.jid,this),this.model=t.get(this.jid),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())),document.addEventListener("visibilitychange",(()=>this.onWindowStateChanged())),await this.model.messages.fetched,this.model.maybeShow(),bh.trigger("headlinesBoxViewInitialized",this)}render(){return(e=>Cs`${s}
`:""} ${e.moved_jid?(e=>{const t=kb("The conversation has moved to a new address. Click the link below to enter.");return Cs`${t}
e.onSwitch(t)}">${e.moved_jid}
`})(e):""}`};bh.elements.define("converse-muc-destroyed",class extends Ob{constructor(){super(),this.jid=null}static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=yu.state.chatboxes.get(this.jid)}render(){const e=this.model.get("destroyed_reason"),t=this.model.get("moved_jid");return UC({moved_jid:t,reason:e,onSwitch:e=>this.onSwitch(e)})}async onSwitch(e){e.preventDefault();const t=this.model.get("moved_jid");(await bh.rooms.get(t,{},!0)).maybeShow(!0),this.model.destroy()}});bh.elements.define("converse-muc-disconnected",class extends Ob{constructor(){super(),this.jid=null}static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=yu.state.chatboxes.get(this.jid)}render(){const e=this.model.session.get("disconnection_message");if(!e)return;const t=[e],s=this.model.session.get("disconnection_actor");s&&t.push(kb("This action was done by %1$s.",s));const n=this.model.session.get("disconnection_reason");return n&&t.push(kb('The reason given is: "%1$s".',n)),(e=>Cs`${e}
`))}${p}: ${t.name}
${r}:
${c}:
${t}:
${s}: ${e.subject&&e.subject.author}
`})(t):""}${x}: ${i}
${l}:
${yu.VERSION_NAME}
${kA(bt().sanitize(t))}
${kA(bt().sanitize(s))}
${t.message}
`;const n=e.toString();return Aj(n)?QS({src:t,onClick:s.onImgClick,onLoad:s.onImgLoad}):Sj(n)?ww(t):Ej(n)?kw(t):Sw(t,e.filename())}(i,e,s))),o=Cs`${Q_(r,"")}`;s.addTemplateResult(n.start+t,n.end+t,o)}))}function Oj(e){yu.state.config.get("trusted")&&e.addAnnotations(((t,s)=>Ij(t,s,e)))}async function Nj(e,t){if(bh.settings.get("clear_cache_on_logout")||!t.is_encrypted||t.encryption_namespace!==lj.NS.OMEMO)return t;const s=uj(`encrypted[xmlns="${lj.NS.OMEMO}"]`,e).pop(),n=s.querySelector("header");t.encrypted={device_id:n.getAttribute("sid")};const i=await(bh.omemo?.getDeviceID()),r=i&&uj(`key[rid="${i}"]`,s).pop();return r?(Object.assign(t.encrypted,{iv:n.querySelector("iv").textContent,key:r.textContent,payload:s.querySelector("payload")?.textContent||null,prekey:["true","1"].includes(r.getAttribute("prekey"))}),!0===t.encrypted.prekey?async function(e){const t=zj(e),s=Dj(t,parseInt(e.encrypted.device_id,10)),n=yj(e.encrypted.key);let i;try{i=await s.decryptPreKeyWhisperMessage(n,"binary")}catch(t){return kt.error(`${t.name} ${t.message}`),Object.assign(e,Pj(t))}try{const t=await Lj(e,i),{omemo_store:s}=yu.state;return await s.generateMissingPreKeys(),await s.publishBundle(),t?Object.assign(e,{plaintext:t}):Object.assign(e,{is_only_key:!0})}catch(t){return kt.error(`${t.name} ${t.message}`),Object.assign(e,Pj(t))}}(t):async function(e){const t=zj(e),s=Dj(t,parseInt(e.encrypted.device_id,10)),n=yj(e.encrypted.key);try{const t=await s.decryptWhisperMessage(n,"binary"),i=await Lj(e,t);return Object.assign(e,{plaintext:i})}catch(t){return kt.error(`${t.name} ${t.message}`),Object.assign(e,Pj(t))}}(t)):Object.assign(t,{error_condition:"not-encrypted-for-this-device",error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"})}function Mj(){yu.state.chatboxes.on("add",(e=>{Vj(e),e.get("type")===hj&&(e.occupants.on("add",(t=>async function(e,t){if(t.isSelf()||!e.features.get("nonanonymous")||!e.features.get("membersonly"))return;if(e.get("omemo_active")){await jj(t.get("jid"))||(e.createMessage({message:kb("%1$s doesn't appear to have a client that supports OMEMO. Encrypted chat will no longer be possible in this grouchat.",t.get("nick")),type:"error"}),e.save({omemo_active:!1,omemo_supported:!1}))}}(e,t))),e.features.on("change",(()=>Vj(e))))}))}function Rj(e){e.listenTo(e.model.messages,"add",(t=>{t.get("is_encrypted")&&!t.get("is_error")&&e.model.save("omemo_supported",!0)})),e.listenTo(e.model,"change:omemo_supported",(()=>{!e.model.get("omemo_supported")&&e.model.get("omemo_active")?e.model.set("omemo_active",!1):e.querySelector("converse-chat-toolbar")?.requestUpdate()})),e.listenTo(e.model,"change:omemo_active",(()=>{e.querySelector("converse-chat-toolbar").requestUpdate()}))}function Dj(e,t){const{libsignal:s}=window,n=new s.SignalProtocolAddress(e,t);return new s.SessionCipher(yu.state.omemo_store,n)}function zj(e){const t=e.from_muc?e.from_real_jid:e.from;if(!t)throw Object.assign(e,{error_text:kb("Sorry, could not decrypt a received OMEMO message because we don't have the XMPP address for that user."),error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"}),new Error("Could not find JID to decrypt OMEMO message for");return t}async function Lj(e,t){const s=zj(e),n=await bh.omemo.devicelists.get(s,!0),i=e.encrypted;let r=n.devices.get(i.device_id);if(r||(r=await n.devices.create({id:i.device_id,jid:s},{promise:!0})),i.payload){const e=t.slice(0,16),s=t.slice(16),n=await Yj.decryptMessage(Object.assign(i,{key:e,tag:s}));return r.save("active",!0),n}}function Pj(e){return{error_text:kb("Sorry, could not decrypt a received OMEMO message due to an error.")+` ${e.name} ${e.message}`,error_condition:e.name,error_message:e.message,error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"}}function Uj(e){const t=e.querySelector("signedPreKeyPublic"),s=e.querySelector("signedPreKeySignature"),n=uj("prekeys > preKeyPublic",e).map((e=>({id:parseInt(e.getAttribute("preKeyId"),10),key:e.textContent})));return{identity_key:e.querySelector("identityKey").textContent.trim(),signed_prekey:{id:parseInt(t.getAttribute("signedPreKeyId"),10),public_key:t.textContent,signature:s.textContent},prekeys:n}}async function Fj(e){const t=await qj(e);return Promise.all(t.map((e=>Bj(e))))}async function Bj(e){if(e.get("bundle")?.fingerprint)return;const t=await e.getBundle();t.fingerprint=pj(yj(t.identity_key)),e.save("bundle",t),e.trigger("change:bundle")}async function qj(e){await bh.waitUntil("OMEMOInitialized");const t=await bh.omemo.devicelists.get(e,!0);return await t.fetchDevices(),t.devices}async function Hj(e){if(!e.get("bundle"))return kt.error(`Could not build an OMEMO session for device ${e.get("id")} because we don't have its bundle`),null;const{libsignal:t}=window,s=new t.SignalProtocolAddress(e.get("jid"),e.get("id")),n=await yu.state.omemo_store.loadSession(s.toString());if(n)return n;try{const t=await async function(e){const{libsignal:t}=window,s=new t.SignalProtocolAddress(e.get("jid"),e.get("id")),n=new t.SessionBuilder(yu.state.omemo_store,s),i=e.getRandomPreKey(),r=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:yj(r.identity_key),signedPreKey:{keyId:r.signed_prekey.id,publicKey:yj(r.signed_prekey.public_key),signature:yj(r.signed_prekey.signature)},preKey:{keyId:i.id,publicKey:yj(i.key)}})}(e);return t}catch(t){return kt.error(`Could not build an OMEMO session for device ${e.get("id")}`),kt.error(t),null}}function Gj(){bh.connection.get().addHandler((async e=>{try{uj(`event[xmlns="${lj.NS.PUBSUB}#event"]`,e).length&&(await bh.waitUntil("OMEMOInitialized"),await async function(e){const t=uj(`items[node="${lj.NS.OMEMO_DEVICELIST}"]`,e).pop();if(!t)return;const s=`item list[xmlns="${lj.NS.OMEMO}"] device`,n=uj(s,t).map((e=>e.getAttribute("id"))),i=e.getAttribute("from"),r=await bh.omemo.devicelists.get(i,!0),o=r.devices,a=o.pluck("id").filter((e=>!n.includes(e))),c=yu.session.get("bare_jid");a.forEach((e=>{i===c&&e===yu.state.omemo_store.get("device_id")||o.get(e).save("active",!1)})),n.forEach((e=>{const t=o.get(e);t?t.save("active",!0):o.create({id:e,jid:i})})),om.isSameBareJID(i,i)&&r.publishCurrentDevice(n)}(e),await async function(e){const t=uj("items",e).pop();if(!t||!t.getAttribute("node").startsWith(lj.NS.OMEMO_BUNDLES))return;const s=t.getAttribute("node").split(":")[1],n=e.getAttribute("from"),i=uj("item > bundle",t).pop(),r=await bh.omemo.devicelists.get(n,!0);(r.devices.get(s)||r.devices.create({id:s,jid:n})).save({bundle:Uj(i)})}(e))}catch(e){kt.error(e.message)}return!0}),null,"message","headline")}async function Wj(e){if(!e)if(yu.state.config.get("trusted")&&!bh.settings.get("clear_cache_on_logout")){try{await async function(){const e=yu.session.get("bare_jid");yu.state.devicelists=new cj;const t=`converse.devicelists-${e}`;wj(yu.state.devicelists,t),await new Promise((e=>{yu.state.devicelists.fetch({success:e,error:(t,s)=>{kt.error(s),e()}})})),await bh.omemo.devicelists.get(e,!0)}(),await bh.omemo.session.restore(),await yu.state.omemo_store.publishBundle()}catch(e){return kt.error("Could not initialize OMEMO support"),void kt.error(e)}bh.trigger("OMEMOInitialized")}else kt.warn("Not initializing OMEMO, since this browser is not trusted or clear_cache_on_logout is set to true")}async function Vj(e){let t;e.get("type")===hj?(await bh.waitUntil("OMEMOInitialized"),t=e.features.get("nonanonymous")&&e.features.get("membersonly")):e.get("type")===mj&&(t=await jj(e.get("jid"))),e.set("omemo_supported",t),t&&bh.settings.get("omemo_default")&&e.set("omemo_active",!0)}function Qj(e){e.stopPropagation(),e.preventDefault();const t=om.ancestor(e.target,"converse-chat-toolbar");if(!t.model.get("omemo_supported")){let e;return e=t.model.get("type")===hj?[kb("Cannot use end-to-end encryption in this groupchat, either the groupchat has some anonymity or not all participants support OMEMO.")]:[kb("Cannot use end-to-end encryption because %1$s uses a client that doesn't support OMEMO.",t.model.contact.getDisplayName())],bh.alert("error",kb("Error"),e)}t.model.save({omemo_active:!t.model.get("omemo_active")})}function Jj(e,t){const s=e.model,n=s.get("type")===hj;let i,r;if(s.get("omemo_supported")){const e=kb("Messages are being sent in plaintext"),t=kb("Messages are sent encrypted");i=s.get("omemo_active")?t:e}else i=kb(n?"This groupchat needs to be members-only and non-anonymous in order to support OMEMO encrypted messages":"OMEMO encryption is not supported");return r=s.get("omemo_supported")?s.get("omemo_active")?n?"var(--muc-color)":"var(--chat-toolbar-btn-color)":"var(--error-color)":"var(--muc-toolbar-btn-disabled-color)",t.push(Cs``),t}async function Kj(e,t){let{stanza:s}=t;const{message:n}=t;if(!n.get("is_encrypted"))return t;if(!n.get("body"))throw new Error("No message body to encrypt!");const i=await async function(e){const t=kb("Sorry, no devices found to which we can send an OMEMO encrypted message.");let s;if(e instanceof ap){const t=await Promise.all(e.occupants.map((e=>qj(e.get("jid")))));s=t.reduce(((e,t)=>e.concat(t.models)),[])}else if(e.get("type")===mj){const n=await qj(e.get("jid"));if(0===n.length)throw new sj(t);const i=yu.session.get("bare_jid"),r=(await bh.omemo.devicelists.get(i)).devices;s=[...r.models,...n.models]}const n=yu.state.omemo_store.get("device_id");s=s.filter((e=>e.get("id")!==n)),await Promise.all(s.map((e=>e.getBundle())));const i=s.filter((e=>e)).map((e=>Hj(e)));if(await Promise.all(i),i.includes(null)&&(s=s.filter((e=>i[s.indexOf(e)])),0===s.length))throw new sj(t);return s}(e);s.c("encrypted",{xmlns:lj.NS.OMEMO}).c("header",{sid:yu.state.omemo_store.get("device_id")});const{key_and_tag:r,iv:o,payload:a}=await Yj.encryptMessage(n.get("plaintext")),c=await Promise.all(i.filter((e=>-1!=e.get("trusted")&&e.get("active"))).map((e=>function(e,t){return Dj(t.get("jid"),t.get("id")).encrypt(e).then((e=>({payload:e,device:t})))}(r,e))));return s=await function(e,t,s){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const n=t[s].payload,i=t[s].device,r=3==parseInt(n.type,10);e.c("key",{rid:i.get("id")}).t(btoa(n.body)),r&&e.attrs({prekey:r}),e.up()}return e.c("iv").t(s).up().up(),Promise.resolve(e)}(s,c,o),s.c("payload").t(a).up().up(),s.c("store",{xmlns:lj.NS.HINTS}).up(),s.c("encryption",{xmlns:lj.NS.EME,namespace:lj.NS.OMEMO}),{message:n,stanza:s}}const Yj={decryptMessage:async function(e){const t=await crypto.subtle.importKey("raw",e.key,Z$,!0,["encrypt","decrypt"]),s=gj(yj(e.payload),e.tag),n={name:"AES-GCM",iv:yj(e.iv),tagLength:128};return vj(await crypto.subtle.decrypt(n,t,s))},encryptMessage:async function(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),s=await crypto.subtle.generateKey(Z$,!0,["encrypt","decrypt"]),n={name:"AES-GCM",iv:t,tagLength:128},i=await crypto.subtle.encrypt(n,s,Cj(e)),r=i.byteLength-16,o=i.slice(0,r),a=i.slice(r),c=await crypto.subtle.exportKey("raw",s);return{key:c,tag:a,key_and_tag:gj(c,a),payload:fj(o),iv:fj(t)}},formatFingerprint:$j},Xj=e=>{const t=kb("OMEMO Fingerprints"),s=kb("No OMEMO-enabled devices found"),n=e.devicelist.devices;return Cs`${e}
${s} ${e.jid}
${t} ${e.desc}
${n} ${e.occ}
${i}