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
ericgaspar a72742c710
Fix
2022-04-02 21:20:14 +02:00

2317 lines
No EOL
1 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! For license information please see converse.min.js.LICENSE.txt */
(()=>{var e,t,n,i,s={8999:(e,t)=>{"use strict";function n(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var i=n({HTML:"text/html",isHTML:function(e){return e===i.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),s=n({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===s.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.freeze=n,t.MIME_TYPE=i,t.NAMESPACE=s},6647:(e,t,n)=>{var i=n(8999),s=n(976),r=n(5257),o=n(7686),a=s.DOMImplementation,c=i.NAMESPACE,l=o.ParseError,d=o.XMLReader;function u(e){this.options=e||{locator:{}}}function h(){this.cdata=!1}function m(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function f(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function g(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function p(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}u.prototype.parseFromString=function(e,t){var n=this.options,i=new d,s=n.domBuilder||new h,o=n.errorHandler,a=n.locator,l=n.xmlns||{},u=/\/x?html?$/.test(t),m=u?r.HTML_ENTITIES:r.XML_ENTITIES;return a&&s.setDocumentLocator(a),i.errorHandler=function(e,t,n){if(!e){if(t instanceof h)return t;e=t}var i={},s=e instanceof Function;function r(t){var r=e[t];!r&&s&&(r=2==e.length?function(n){e(t,n)}:e),i[t]=r&&function(e){r("[xmldom "+t+"]\t"+e+f(n))}||function(){}}return n=n||{},r("warning"),r("error"),r("fatalError"),i}(o,s,a),i.domBuilder=n.domBuilder||s,u&&(l[""]=c.HTML),l.xml=l.xml||c.XML,e&&"string"==typeof e?i.parse(e,l,m):i.errorHandler.error("invalid doc source"),s.doc},h.prototype={startDocument:function(){this.doc=(new a).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,i){var s=this.doc,r=s.createElementNS(e,n||t),o=i.length;p(this,r),this.currentElement=r,this.locator&&m(this.locator,r);for(var a=0;a<o;a++){e=i.getURI(a);var c=i.getValue(a),l=(n=i.getQName(a),s.createAttributeNS(e,n));this.locator&&m(i.getLocator(a),l),l.value=l.nodeValue=c,r.setAttributeNode(l)}},endElement:function(e,t,n){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&m(this.locator,n),p(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=g.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&m(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=g.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&m(this.locator,i),p(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var i=this.doc.implementation;if(i&&i.createDocumentType){var s=i.createDocumentType(e,t,n);this.locator&&m(this.locator,s),p(this,s),this.doc.doctype=s}},warning:function(e){console.warn("[xmldom warning]\t"+e,f(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,f(this.locator))},fatalError:function(e){throw new l(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){h.prototype[e]=function(){return null}})),t.DOMParser=u,s.DOMImplementation,s.XMLSerializer},976:(e,t,n)=>{var i=n(8999).NAMESPACE;function s(e){return""!==e}function r(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function o(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(s):[]}(e);return Object.keys(t.reduce(r,{}))}function a(e,t){for(var n in e)t[n]=e[n]}function c(e,t){var n=e.prototype;if(!(n instanceof t)){function i(){}i.prototype=t.prototype,a(n,i=new i),e.prototype=n=i}n.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),n.constructor=e)}var l={},d=l.ELEMENT_NODE=1,u=l.ATTRIBUTE_NODE=2,h=l.TEXT_NODE=3,m=l.CDATA_SECTION_NODE=4,f=l.ENTITY_REFERENCE_NODE=5,g=l.ENTITY_NODE=6,p=l.PROCESSING_INSTRUCTION_NODE=7,v=l.COMMENT_NODE=8,y=l.DOCUMENT_NODE=9,_=l.DOCUMENT_TYPE_NODE=10,b=l.DOCUMENT_FRAGMENT_NODE=11,w=l.NOTATION_NODE=12,S={},x={},E=(S.INDEX_SIZE_ERR=(x[1]="Index size error",1),S.DOMSTRING_SIZE_ERR=(x[2]="DOMString size error",2),S.HIERARCHY_REQUEST_ERR=(x[3]="Hierarchy request error",3)),A=(S.WRONG_DOCUMENT_ERR=(x[4]="Wrong document",4),S.INVALID_CHARACTER_ERR=(x[5]="Invalid character",5),S.NO_DATA_ALLOWED_ERR=(x[6]="No data allowed",6),S.NO_MODIFICATION_ALLOWED_ERR=(x[7]="No modification allowed",7),S.NOT_FOUND_ERR=(x[8]="Not found",8)),C=(S.NOT_SUPPORTED_ERR=(x[9]="Not supported",9),S.INUSE_ATTRIBUTE_ERR=(x[10]="Attribute in use",10));function T(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,x[e]),this.message=x[e],Error.captureStackTrace&&Error.captureStackTrace(this,T);return n.code=e,t&&(this.message=this.message+": "+t),n}function k(){}function j(e,t){this._node=e,this._refresh=t,$(this)}function $(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var n=e._refresh(e._node);le(e,"length",n.length),a(n,e),e._inc=t}}function N(){}function O(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function I(e,t,n,s){if(s?t[O(t,s)]=n:t[t.length++]=n,e){n.ownerElement=e;var r=e.ownerDocument;r&&(s&&F(r,e,s),function(e,t,n){e&&e._inc++,n.namespaceURI===i.XMLNS&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(r,e,n))}}function M(e,t,n){var i=O(t,n);if(!(i>=0))throw T(A,new Error(e.tagName+"@"+n));for(var s=t.length-1;i<s;)t[i]=t[++i];if(t.length=s,e){var r=e.ownerDocument;r&&(F(r,e,n),n.ownerElement=null)}}function R(){}function D(){}function L(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function z(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(z(e,t))return!0}while(e=e.nextSibling)}function P(){}function F(e,t,n,s){e&&e._inc++,n.namespaceURI===i.XMLNS&&delete t._nsMap[n.prefix?n.localName:""]}function U(e,t,n){if(e&&e._inc){e._inc++;var i=t.childNodes;if(n)i[i.length++]=n;else{for(var s=t.firstChild,r=0;s;)i[r++]=s,s=s.nextSibling;i.length=r}}}function B(e,t){var n=t.previousSibling,i=t.nextSibling;return n?n.nextSibling=i:e.firstChild=i,i?i.previousSibling=n:e.lastChild=n,U(e.ownerDocument,e),t}function q(e,t,n){var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===b){var s=t.firstChild;if(null==s)return t;var r=t.lastChild}else s=r=t;var o=n?n.previousSibling:e.lastChild;s.previousSibling=o,r.nextSibling=n,o?o.nextSibling=s:e.firstChild=s,null==n?e.lastChild=r:n.previousSibling=r;do{s.parentNode=e}while(s!==r&&(s=s.nextSibling));return U(e.ownerDocument||e,e),t.nodeType==b&&(t.firstChild=t.lastChild=null),t}function H(){this._nsMap={}}function G(){}function W(){}function V(){}function J(){}function Q(){}function Z(){}function Y(){}function X(){}function K(){}function ee(){}function te(){}function ne(){}function ie(e,t){var n=[],i=9==this.nodeType&&this.documentElement||this,s=i.prefix,r=i.namespaceURI;if(r&&null==s&&null==(s=i.lookupPrefix(r)))var o=[{namespace:r,prefix:null}];return oe(this,n,e,t,o),n.join("")}function se(e,t,n){var s=e.prefix||"",r=e.namespaceURI;if(!r)return!1;if("xml"===s&&r===i.XML||r===i.XMLNS)return!1;for(var o=n.length;o--;){var a=n[o];if(a.prefix===s)return a.namespace!==r}return!0}function re(e,t,n){e.push(" ",t,'="',n.replace(/[<&"]/g,L),'"')}function oe(e,t,n,s,r){if(r||(r=[]),s){if(!(e=s(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case d:var o=e.attributes,a=o.length,c=e.firstChild,l=e.tagName,g=l;if(!(n=i.isHTML(e.namespaceURI)||n)&&!e.prefix&&e.namespaceURI){for(var w,S=0;S<o.length;S++)if("xmlns"===o.item(S).name){w=o.item(S).value;break}if(!w)for(var x=r.length-1;x>=0;x--)if(""===(E=r[x]).prefix&&E.namespace===e.namespaceURI){w=E.namespace;break}if(w!==e.namespaceURI)for(x=r.length-1;x>=0;x--){var E;if((E=r[x]).namespace===e.namespaceURI){E.prefix&&(g=E.prefix+":"+l);break}}}t.push("<",g);for(var A=0;A<a;A++)"xmlns"==(C=o.item(A)).prefix?r.push({prefix:C.localName,namespace:C.value}):"xmlns"==C.nodeName&&r.push({prefix:"",namespace:C.value});for(A=0;A<a;A++){var C,T,k;se(C=o.item(A),0,r)&&(re(t,(T=C.prefix||"")?"xmlns:"+T:"xmlns",k=C.namespaceURI),r.push({prefix:T,namespace:k})),oe(C,t,n,s,r)}if(l===g&&se(e,0,r)&&(re(t,(T=e.prefix||"")?"xmlns:"+T:"xmlns",k=e.namespaceURI),r.push({prefix:T,namespace:k})),c||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),n&&/^script$/i.test(l))for(;c;)c.data?t.push(c.data):oe(c,t,n,s,r.slice()),c=c.nextSibling;else for(;c;)oe(c,t,n,s,r.slice()),c=c.nextSibling;t.push("</",g,">")}else t.push("/>");return;case y:case b:for(c=e.firstChild;c;)oe(c,t,n,s,r.slice()),c=c.nextSibling;return;case u:return re(t,e.name,e.value);case h:return t.push(e.data.replace(/[<&]/g,L).replace(/]]>/g,"]]&gt;"));case m:return t.push("<![CDATA[",e.data,"]]>");case v:return t.push("\x3c!--",e.data,"--\x3e");case _:var j=e.publicId,$=e.systemId;if(t.push("<!DOCTYPE ",e.name),j)t.push(" PUBLIC ",j),$&&"."!=$&&t.push(" ",$),t.push(">");else if($&&"."!=$)t.push(" SYSTEM ",$,">");else{var N=e.internalSubset;N&&t.push(" [",N,"]"),t.push(">")}return;case p:return t.push("<?",e.target," ",e.data,"?>");case f:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function ae(e,t,n){var i;switch(t.nodeType){case d:(i=t.cloneNode(!1)).ownerDocument=e;case b:break;case u:n=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,n)for(var s=t.firstChild;s;)i.appendChild(ae(e,s,n)),s=s.nextSibling;return i}function ce(e,t,n){var i=new t.constructor;for(var s in t){var r=t[s];"object"!=typeof r&&r!=i[s]&&(i[s]=r)}switch(t.childNodes&&(i.childNodes=new k),i.ownerDocument=e,i.nodeType){case d:var o=t.attributes,a=i.attributes=new N,c=o.length;a._ownerElement=i;for(var l=0;l<c;l++)i.setAttributeNode(ce(e,o.item(l),!0));break;case u:n=!0}if(n)for(var h=t.firstChild;h;)i.appendChild(ce(e,h,n)),h=h.nextSibling;return i}function le(e,t,n){e[t]=n}S.INVALID_STATE_ERR=(x[11]="Invalid state",11),S.SYNTAX_ERR=(x[12]="Syntax error",12),S.INVALID_MODIFICATION_ERR=(x[13]="Invalid modification",13),S.NAMESPACE_ERR=(x[14]="Invalid namespace",14),S.INVALID_ACCESS_ERR=(x[15]="Invalid access",15),T.prototype=Error.prototype,a(S,T),k.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],i=0;i<this.length;i++)oe(this[i],n,e,t);return n.join("")}},j.prototype.item=function(e){return $(this),this[e]},c(j,k),N.prototype={length:0,item:k.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var n=this[t];if(n.nodeName==e)return n}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new T(C);var n=this.getNamedItem(e.nodeName);return I(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t,n=e.ownerElement;if(n&&n!=this._ownerElement)throw new T(C);return t=this.getNamedItemNS(e.namespaceURI,e.localName),I(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return M(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return M(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var i=this[n];if(i.localName==t&&i.namespaceURI==e)return i}return null}},R.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,n){var i=new P;if(i.implementation=this,i.childNodes=new k,i.doctype=n||null,n&&i.appendChild(n),t){var s=i.createElementNS(e,t);i.appendChild(s)}return i},createDocumentType:function(e,t,n){var i=new Z;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=n||"",i}},D.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return q(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return B(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ce(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==h&&e.nodeType==h?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var i in n)if(n[i]==e)return i;t=t.nodeType==u?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==u?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},a(l,D),a(l,D.prototype),P.prototype={nodeName:"#document",nodeType:y,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==b){for(var n=e.firstChild;n;){var i=n.nextSibling;this.insertBefore(n,t),n=i}return e}return null==this.documentElement&&e.nodeType==d&&(this.documentElement=e),q(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),B(this,e)},importNode:function(e,t){return ae(this,e,t)},getElementById:function(e){var t=null;return z(this.documentElement,(function(n){if(n.nodeType==d&&n.getAttribute("id")==e)return t=n,!0})),t},getElementsByClassName:function(e){var t=o(e);return new j(this,(function(n){var i=[];return t.length>0&&z(n.documentElement,(function(s){if(s!==n&&s.nodeType===d){var r=s.getAttribute("class");if(r){var a=e===r;if(!a){var c=o(r);a=t.every((l=c,function(e){return l&&-1!==l.indexOf(e)}))}a&&i.push(s)}}var l})),i}))},createElement:function(e){var t=new H;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new k,(t.attributes=new N)._ownerElement=t,t},createDocumentFragment:function(){var e=new ee;return e.ownerDocument=this,e.childNodes=new k,e},createTextNode:function(e){var t=new V;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new J;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Q;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new te;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new G;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new K;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new H,i=t.split(":"),s=n.attributes=new N;return n.childNodes=new k,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=t,s._ownerElement=n,n},createAttributeNS:function(e,t){var n=new G,i=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=t,n}},c(P,D),H.prototype={nodeType:d,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===b?this.insertBefore(e,null):function(e,t){var n=t.parentNode;if(n){var i=e.lastChild;n.removeChild(t),i=e.lastChild}return i=e.lastChild,t.parentNode=e,t.previousSibling=i,t.nextSibling=null,i?i.nextSibling=t:e.firstChild=t,e.lastChild=t,U(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+n,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new j(this,(function(t){var n=[];return z(t,(function(i){i===t||i.nodeType!=d||"*"!==e&&i.tagName!=e||n.push(i)})),n}))},getElementsByTagNameNS:function(e,t){return new j(this,(function(n){var i=[];return z(n,(function(s){s===n||s.nodeType!==d||"*"!==e&&s.namespaceURI!==e||"*"!==t&&s.localName!=t||i.push(s)})),i}))}},P.prototype.getElementsByTagName=H.prototype.getElementsByTagName,P.prototype.getElementsByTagNameNS=H.prototype.getElementsByTagNameNS,c(H,D),G.prototype.nodeType=u,c(G,D),W.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(x[E])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},c(W,D),V.prototype={nodeName:"#text",nodeType:h,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},c(V,W),J.prototype={nodeName:"#comment",nodeType:v},c(J,W),Q.prototype={nodeName:"#cdata-section",nodeType:m},c(Q,W),Z.prototype.nodeType=_,c(Z,D),Y.prototype.nodeType=w,c(Y,D),X.prototype.nodeType=g,c(X,D),K.prototype.nodeType=f,c(K,D),ee.prototype.nodeName="#document-fragment",ee.prototype.nodeType=b,c(ee,D),te.prototype.nodeType=p,c(te,D),ne.prototype.serializeToString=function(e,t,n){return ie.call(e,t,n)},D.prototype.toString=ie;try{if(Object.defineProperty){function de(e){switch(e.nodeType){case d:case b:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(de(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(j.prototype,"length",{get:function(){return $(this),this.$$length}}),Object.defineProperty(D.prototype,"textContent",{get:function(){return de(this)},set:function(e){switch(this.nodeType){case d:case b:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),le=function(e,t,n){e["$$"+t]=n}}}catch(e){}t.DocumentType=Z,t.DOMException=T,t.DOMImplementation=R,t.Element=H,t.Node=D,t.NodeList=k,t.XMLSerializer=ne},5257:(e,t,n)=>{var i=n(8999).freeze;t.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"",lowast:"",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"",cap:"∩",cup:"",int:"∫",there4:"∴",sim:"",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:"",emsp:"",thinsp:"",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"",mdash:"—",lsquo:"",rsquo:"",sbquo:"",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"",Prime:"″",lsaquo:"",rsaquo:"",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES},539:(e,t,n)=>{var i=n(976);t.u=i.DOMImplementation,i.XMLSerializer,t.DOMParser=n(6647).DOMParser},7686:(e,t,n)=>{var i=n(8999).NAMESPACE,s=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,r=new RegExp("[\\-\\.0-9"+s.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),o=new RegExp("^"+s.source+r.source+"*(?::"+s.source+r.source+"*)?$");function a(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,a)}function c(){}function l(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function d(e,t,n,s,r,o){function a(e,t,i){n.attributeNames.hasOwnProperty(e)&&o.fatalError("Attribute "+e+" redefined"),n.addValue(e,t,i)}for(var c,l=++t,d=0;;){var u=e.charAt(l);switch(u){case"=":if(1===d)c=e.slice(t,l),d=3;else{if(2!==d)throw new Error("attribute equal must after attrName");d=3}break;case"'":case'"':if(3===d||1===d){if(1===d&&(o.warning('attribute value must after "="'),c=e.slice(t,l)),t=l+1,!((l=e.indexOf(u,t))>0))throw new Error("attribute value no end '"+u+"' match");a(c,h=e.slice(t,l).replace(/&#?\w+;/g,r),t-1),d=5}else{if(4!=d)throw new Error('attribute value must after "="');a(c,h=e.slice(t,l).replace(/&#?\w+;/g,r),t),o.warning('attribute "'+c+'" missed start quot('+u+")!!"),t=l+1,d=5}break;case"/":switch(d){case 0:n.setTagName(e.slice(t,l));case 5:case 6:case 7:d=7,n.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==d&&n.setTagName(e.slice(t,l)),l;case">":switch(d){case 0:n.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(h=e.slice(t,l)).slice(-1)&&(n.closed=!0,h=h.slice(0,-1));case 2:2===d&&(h=c),4==d?(o.warning('attribute "'+h+'" missed quot(")!'),a(c,h.replace(/&#?\w+;/g,r),t)):(i.isHTML(s[""])&&h.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),a(h,h,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":u=" ";default:if(u<=" ")switch(d){case 0:n.setTagName(e.slice(t,l)),d=6;break;case 1:c=e.slice(t,l),d=2;break;case 4:var h=e.slice(t,l).replace(/&#?\w+;/g,r);o.warning('attribute "'+h+'" missed quot(")!!'),a(c,h,t);case 5:d=6}else switch(d){case 2:n.tagName,i.isHTML(s[""])&&c.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),a(c,c,t),t=l,d=1;break;case 5:o.warning('attribute space is required"'+c+'"!!');case 6:d=1,t=l;break;case 3:d=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function u(e,t,n){for(var s=e.tagName,r=null,o=e.length;o--;){var a=e[o],c=a.qName,l=a.value;if((m=c.indexOf(":"))>0)var d=a.prefix=c.slice(0,m),u=c.slice(m+1),h="xmlns"===d&&u;else u=c,d=null,h="xmlns"===c&&"";a.localName=u,!1!==h&&(null==r&&(r={},f(n,n={})),n[h]=r[h]=l,a.uri=i.XMLNS,t.startPrefixMapping(h,l))}for(o=e.length;o--;)(d=(a=e[o]).prefix)&&("xml"===d&&(a.uri=i.XML),"xmlns"!==d&&(a.uri=n[d||""]));var m;(m=s.indexOf(":"))>0?(d=e.prefix=s.slice(0,m),u=e.localName=s.slice(m+1)):(d=null,u=e.localName=s);var g=e.uri=n[d||""];if(t.startElement(g,u,s,e),!e.closed)return e.currentNSMap=n,e.localNSMap=r,!0;if(t.endElement(g,u,s),r)for(d in r)t.endPrefixMapping(d)}function h(e,t,n,i,s){if(/^(?:script|textarea)$/i.test(n)){var r=e.indexOf("</"+n+">",t),o=e.substring(t+1,r);if(/[&<]/.test(o))return/^script$/i.test(n)?(s.characters(o,0,o.length),r):(o=o.replace(/&#?\w+;/g,i),s.characters(o,0,o.length),r)}return t+1}function m(e,t,n,i){var s=i[n];return null==s&&((s=e.lastIndexOf("</"+n+">"))<t&&(s=e.lastIndexOf("</"+n)),i[n]=s),s<t}function f(e,t){for(var n in e)t[n]=e[n]}function g(e,t,n,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(s=e.indexOf("--\x3e",t+4))>t?(n.comment(e,t+4,s-t-4),s+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var s=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,s-t-9),n.endCDATA(),s+3}var r=function(e,t){var n,i=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=t,s.exec(e);n=s.exec(e);)if(i.push(n),n[1])return i}(e,t),o=r.length;if(o>1&&/!doctype/i.test(r[0][0])){var a=r[1][0],c=!1,l=!1;o>3&&(/^public$/i.test(r[2][0])?(c=r[3][0],l=o>4&&r[4][0]):/^system$/i.test(r[2][0])&&(l=r[3][0]));var d=r[o-1];return n.startDTD(a,c,l),n.endDTD(),d.index+d[0].length}return-1}function p(e,t,n){var i=e.indexOf("?>",t);if(i){var s=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,n.processingInstruction(s[1],s[2]),i+2):-1}return-1}function v(){this.attributeNames={}}a.prototype=new Error,a.prototype.name=a.name,c.prototype={parse:function(e,t,n){var s=this.domBuilder;s.startDocument(),f(t,t={}),function(e,t,n,s,r){function o(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function c(t){if(t>E){var n=e.substring(E,t).replace(/&#?\w+;/g,o);w&&f(E),s.characters(n,0,t-E),E=t}}function f(t,n){for(;t>=_&&(n=b.exec(e));)y=n.index,_=y+n[0].length,w.lineNumber++;w.columnNumber=t-y+1}for(var y=0,_=0,b=/.*(?:\r\n?|\n)|.*$/g,w=s.locator,S=[{currentNSMap:t}],x={},E=0;;){try{var A=e.indexOf("<",E);if(A<0){if(!e.substr(E).match(/^\s*$/)){var C=s.doc,T=C.createTextNode(e.substr(E));C.appendChild(T),s.currentElement=T}return}switch(A>E&&c(A),e.charAt(A+1)){case"/":var k=e.indexOf(">",A+3),j=e.substring(A+2,k).replace(/[ \t\n\r]+$/g,""),$=S.pop();k<0?(j=e.substring(A+2).replace(/[\s<].*/,""),r.error("end tag name: "+j+" is not complete:"+$.tagName),k=A+1+j.length):j.match(/\s</)&&(j=j.replace(/[\s<].*/,""),r.error("end tag name: "+j+" maybe not complete"),k=A+1+j.length);var N=$.localNSMap,O=$.tagName==j;if(O||$.tagName&&$.tagName.toLowerCase()==j.toLowerCase()){if(s.endElement($.uri,$.localName,j),N)for(var I in N)s.endPrefixMapping(I);O||r.fatalError("end tag name: "+j+" is not match the current start tagName:"+$.tagName)}else S.push($);k++;break;case"?":w&&f(A),k=p(e,A,s);break;case"!":w&&f(A),k=g(e,A,s,r);break;default:w&&f(A);var M=new v,R=S[S.length-1].currentNSMap,D=(k=d(e,A,M,R,o,r),M.length);if(!M.closed&&m(e,k,M.tagName,x)&&(M.closed=!0,n.nbsp||r.warning("unclosed xml attribute")),w&&D){for(var L=l(w,{}),z=0;z<D;z++){var P=M[z];f(P.offset),P.locator=l(w,{})}s.locator=L,u(M,s,R)&&S.push(M),s.locator=w}else u(M,s,R)&&S.push(M);i.isHTML(M.uri)&&!M.closed?k=h(e,k,M.tagName,o,s):k++}}catch(e){if(e instanceof a)throw e;r.error("element parse error: "+e),k=-1}k>E?E=k:c(Math.max(A,E)+1)}}(e,t,n,s,this.errorHandler),s.endDocument()}},v.prototype={setTagName:function(e){if(!o.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,n){if(!o.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},t.XMLReader=c,t.ParseError=a},4567:(e,t,n)=>{"use strict";const i=n(4095),s=n(257);e.exports={atob:i,btoa:s}},4095: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="",i=0,s=0;for(let r=0;r<e.length;r++)i<<=6,i|=t(e[r]),s+=6,24===s&&(n+=String.fromCharCode((16711680&i)>>16),n+=String.fromCharCode((65280&i)>>8),n+=String.fromCharCode(255&i),i=s=0);return 12===s?(i>>=4,n+=String.fromCharCode(i)):18===s&&(i>>=2,n+=String.fromCharCode((65280&i)>>8),n+=String.fromCharCode(255&i)),n}},257: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 i="";for(n=0;n<e.length;n+=3){const s=[void 0,void 0,void 0,void 0];s[0]=e.charCodeAt(n)>>2,s[1]=(3&e.charCodeAt(n))<<4,e.length>n+1&&(s[1]|=e.charCodeAt(n+1)>>4,s[2]=(15&e.charCodeAt(n+1))<<2),e.length>n+2&&(s[2]|=e.charCodeAt(n+2)>>6,s[3]=63&e.charCodeAt(n+2));for(let e=0;e<s.length;e++)void 0===s[e]?i+="=":i+=t(s[e])}return i}},6561:(e,t,n)=>{e.exports={default:n(1966),__esModule:!0}},5460:(e,t,n)=>{e.exports={default:n(4064),__esModule:!0}},9251:(e,t,n)=>{e.exports={default:n(9791),__esModule:!0}},1683:(e,t,n)=>{"use strict";t.__esModule=!0;var i,s=(i=n(9251))&&i.__esModule?i:{default:i};t.default=function(e){return function(){var t=e.apply(this,arguments);return new s.default((function(e,n){return function i(r,o){try{var a=t[r](o),c=a.value}catch(e){return void n(e)}if(!a.done)return s.default.resolve(c).then((function(e){i("next",e)}),(function(e){i("throw",e)}));e(c)}("next")}))}}},8339:(e,t,n)=>{"use strict";t.__esModule=!0;var i,s=(i=n(6561))&&i.__esModule?i:{default:i};t.default=function(e,t,n){return t in e?(0,s.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},8161:(e,t,n)=>{e.exports=n(7371)},1505:function(e,t,n){var i,s;void 0===(s="function"==typeof(i=function(){"use strict";var e=void 0!==n.g?n.g:this||window,t=document,i=t.documentElement,s=e.BSN={},r=s.supports=[],o="data-toggle",a="data-dismiss",c="Alert",l="Button",d="Collapse",u="Dropdown",h="Modal",m="Popover",f="Tab",g="data-backdrop",p="data-target",v="data-title",y="aria-expanded",_="aria-hidden",b="aria-selected",w="click",S="focus",x="hover",E="keydown",A="keyup",C="resize",T="onmouseleave"in t?["mouseenter","mouseleave"]:["mouseover","mouseout"],k="show",j="shown",$="hide",N="hidden",O="change",I="getAttribute",M="Transition",R="Duration",D="Webkit",L="tabindex",z="active",P="show",F="collapsing",U="left",B="right",q="top",H="bottom",G=/\b(top|bottom|left|right)+/,W=0,V="fixed-top",J="fixed-bottom",Q=D+M in i.style||M.toLowerCase()in i.style,Z=D+M in i.style?D.toLowerCase()+M+"End":M.toLowerCase()+"end",Y=D+R in i.style?D.toLowerCase()+M+R:M.toLowerCase()+R,X=function(e){e.focus?e.focus():e.setActive()},K=function(e,t){e.classList.add(t)},ee=function(e,t){e.classList.remove(t)},te=function(e,t){return e.classList.contains(t)},ne=function(e,t){return[].slice.call(e.getElementsByClassName(t))},ie=function(e,n){return"object"==typeof e?e:(n||t).querySelector(e)},se=function(e,n){var i=n.charAt(0),s=n.substr(1);if("."===i){for(;e&&e!==t;e=e.parentNode)if(null!==ie(n,e.parentNode)&&te(e,s))return e}else if("#"===i)for(;e&&e!==t;e=e.parentNode)if(e.id===s)return e;return!1},re=function(e,t,n,i){i=i||!1,e.addEventListener(t,n,i)},oe=function(e,t,n,i){i=i||!1,e.removeEventListener(t,n,i)},ae=function(e,t,n,i){re(e,t,(function s(r){n(r),oe(e,t,s,i)}),i)},ce=!!function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});ae(e,"testPassive",null,n)}catch(e){}return t}()&&{passive:!0},le=function(t){var n=Q?e.getComputedStyle(t)[Y]:0;return"number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n},de=function(e,t){var n=0;le(e)?ae(e,Z,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},ue=function(e,t,n){var i=new CustomEvent(e+".bs."+t);i.relatedTarget=n,this.dispatchEvent(i)},he=function(n,s,r,o){var a,c,l,d,u,h,m=s.offsetWidth,f=s.offsetHeight,g=i.clientWidth||t.body.clientWidth,p=i.clientHeight||t.body.clientHeight,v=n.getBoundingClientRect(),y=o===t.body?{y:e.pageYOffset||i.scrollTop,x:e.pageXOffset||i.scrollLeft}:{x:o.offsetLeft+o.scrollLeft,y:o.offsetTop+o.scrollTop},_=v.right-v.left,b=v.bottom-v.top,w=te(s,"popover"),S=ie(".arrow",s),x=v.top+b/2-f/2<0,E=v.left+_/2-m/2<0,A=v.left+m/2+_/2>=g,C=v.top+f/2+b/2>=p,T=v.top-f<0,k=v.left-m<0,j=v.top+f+b>=p,$=v.left+m+_>=g;r=(r=(r=(r=(r=(r===U||r===B)&&k&&$?q:r)===q&&T?H:r)===H&&j?q:r)===U&&k?B:r)===B&&$?U:r,-1===s.className.indexOf(r)&&(s.className=s.className.replace(G,r)),u=S.offsetWidth,h=S.offsetHeight,r===U||r===B?(c=r===U?v.left+y.x-m-(w?u:0):v.left+y.x+_,x?(a=v.top+y.y,l=b/2-u):C?(a=v.top+y.y-f+b,l=f-b/2-u):(a=v.top+y.y-f/2+b/2,l=f/2-(w?.9*h:h/2))):r!==q&&r!==H||(a=r===q?v.top+y.y-f-(w?h:0):v.top+y.y+b,E?(c=0,d=v.left+_/2-u):A?(c=g-1.01*m,d=m-(g-v.left)+_/2-u/2):(c=v.left+y.x-m/2+_/2,d=m/2-(w?u:u/2))),s.style.top=a+"px",s.style.left=c+"px",l&&(S.style.top=l+"px"),d&&(S.style.left=d+"px")};s.version="2.0.27";var me=function(e){e=ie(e);var t=this,n="alert",i=se(e,".alert"),s=function(n){i=se(n.target,".alert"),(e=ie('[data-dismiss="alert"]',i))&&i&&(e===n.target||e.contains(n.target))&&t.close()},r=function(){ue.call(i,"closed",n),oe(e,w,s),i.parentNode.removeChild(i)};this.close=function(){i&&e&&te(i,P)&&(ue.call(i,"close",n),ee(i,P),i&&(te(i,"fade")?de(i,r):r()))},c in e||re(e,w,s),e.Alert=t};r.push([c,me,'[data-dismiss="alert"]']);var fe=function(e){e=ie(e);var n=!1,i="button",s="checked",r="LABEL",o="INPUT",a=function(t){var a=t.target.tagName===r?t.target:t.target.parentNode.tagName===r?t.target.parentNode:null;if(a){var c=ne(a.parentNode,"btn"),l=a.getElementsByTagName(o)[0];if(l){if("checkbox"===l.type&&(l.checked?(ee(a,z),l.getAttribute(s),l.removeAttribute(s),l.checked=!1):(K(a,z),l.getAttribute(s),l.setAttribute(s,s),l.checked=!0),n||(n=!0,ue.call(l,O,i),ue.call(e,O,i))),"radio"===l.type&&!n&&(!l.checked||0===t.screenX&&0==t.screenY)){K(a,z),K(a,S),l.setAttribute(s,s),l.checked=!0,ue.call(l,O,i),ue.call(e,O,i),n=!0;for(var d=0,u=c.length;d<u;d++){var h=c[d],m=h.getElementsByTagName(o)[0];h!==a&&te(h,z)&&(ee(h,z),m.removeAttribute(s),m.checked=!1,ue.call(m,O,i))}}setTimeout((function(){n=!1}),50)}}},c=function(e){K(e.target.parentNode,S)},d=function(e){ee(e.target.parentNode,S)};if(!(l in e)){re(e,w,a),re(e,A,(function(e){32===(e.which||e.keyCode)&&e.target===t.activeElement&&a(e)})),re(e,E,(function(e){32===(e.which||e.keyCode)&&e.preventDefault()}));for(var u=ne(e,"btn"),h=0;h<u.length;h++){var m=u[h].getElementsByTagName(o)[0];re(m,S,c),re(m,"blur",d)}}var f=ne(e,"btn"),g=f.length;for(h=0;h<g;h++)!te(f[h],z)&&ie("input:checked",f[h])&&K(f[h],z);e.Button=this};r.push([l,fe,'[data-toggle="buttons"]']);var ge=function(e,t){e=ie(e),t=t||{};var n,i,s,r,o,a=null,c=null,l=this,u=e.getAttribute("data-parent"),h="collapse",m="collapsed",f=function(e,t){ue.call(e,$,h),e.isAnimating=!0,e.style.height=e.scrollHeight+"px",ee(e,h),ee(e,P),K(e,F),e.offsetWidth,e.style.height="0px",de(e,(function(){e.isAnimating=!1,e.setAttribute(y,"false"),t.setAttribute(y,"false"),ee(e,F),K(e,h),e.style.height="",ue.call(e,N,h)}))};this.toggle=function(e){e.preventDefault(),te(c,P)?l.hide():l.show()},this.hide=function(){c.isAnimating||(f(c,e),K(e,m))},this.show=function(){var t,s;a&&(n=ie(".collapse.show",a),i=n&&(ie('[data-target="#'+n.id+'"]',a)||ie('[href="#'+n.id+'"]',a))),(!c.isAnimating||n&&!n.isAnimating)&&(i&&n!==c&&(f(n,i),K(i,m)),s=e,ue.call(t=c,k,h),t.isAnimating=!0,K(t,F),ee(t,h),t.style.height=t.scrollHeight+"px",de(t,(function(){t.isAnimating=!1,t.setAttribute(y,"true"),s.setAttribute(y,"true"),ee(t,F),K(t,h),K(t,P),t.style.height="",ue.call(t,j,h)})),ee(e,m))},d in e||re(e,w,l.toggle),(s=e.href&&e.getAttribute("href"),r=e.getAttribute(p),o=s||r&&"#"===r.charAt(0)&&r,c=o&&ie(o)).isAnimating=!1,a=ie(t.parent)||u&&se(e,u),e.Collapse=l};r.push([d,ge,'[data-toggle="collapse"]']);var pe=function(e,n){e=ie(e),this.persist=!0===n||"true"===e.getAttribute("data-persist")||!1;var i=this,s=e.parentNode,r="dropdown",a=null,c=ie(".dropdown-menu",s),l=function(){for(var e=c.children,t=[],n=0;n<e.length;n++)e[n].children.length&&"A"===e[n].children[0].tagName&&t.push(e[n].children[0]),"A"===e[n].tagName&&t.push(e[n]);return t}(),d=function(e){(e.href&&"#"===e.href.slice(-1)||e.parentNode&&e.parentNode.href&&"#"===e.parentNode.href.slice(-1))&&this.preventDefault()},h=function(){var n=e.open?re:oe;n(t,w,m),n(t,E,g),n(t,A,p),n(t,S,m,!0)},m=function(t){var n=t.target,s=n&&(n.getAttribute(o)||n.parentNode&&I in n.parentNode&&n.parentNode.getAttribute(o));(t.type!==S||n!==e&&n!==c&&!c.contains(n))&&(n!==c&&!c.contains(n)||!i.persist&&!s)&&(a=n===e||e.contains(n)?e:null,_(),d.call(t,n))},f=function(t){a=e,v(),d.call(t,t.target)},g=function(e){var t=e.which||e.keyCode;38!==t&&40!==t||e.preventDefault()},p=function(n){var s=n.which||n.keyCode,r=t.activeElement,o=l.indexOf(r),d=r===e,u=c.contains(r),h=r.parentNode===c||r.parentNode.parentNode===c;h&&(o=d?0:38===s?o>1?o-1:0:40===s&&o<l.length-1?o+1:o,l[o]&&X(l[o])),(l.length&&h||!l.length&&(u||d)||!u)&&e.open&&27===s&&(i.toggle(),a=null)},v=function(){ue.call(s,k,r,a),K(c,P),K(s,P),e.setAttribute(y,!0),ue.call(s,j,r,a),e.open=!0,oe(e,w,f),setTimeout((function(){X(c.getElementsByTagName("INPUT")[0]||e),h()}),1)},_=function(){ue.call(s,$,r,a),ee(c,P),ee(s,P),e.setAttribute(y,!1),ue.call(s,N,r,a),e.open=!1,h(),X(e),setTimeout((function(){re(e,w,f)}),1)};e.open=!1,this.toggle=function(){te(s,P)&&e.open?_():v()},u in e||(!1 in c&&c.setAttribute(L,"0"),re(e,w,f)),e.Dropdown=i};r.push([u,pe,'[data-toggle="dropdown"]']);var ve=function(n,s){n=ie(n);var r="modal",o="static",c="modalTrigger",l="modal-backdrop",d=n.getAttribute(p)||n.getAttribute("href"),u=ie(d),m=te(n,r)?n:u;if(te(n,r)&&(n=null),m){s=s||{},this.keyboard=!1!==s.keyboard&&"false"!==m.getAttribute("data-keyboard"),this.backdrop=s.backdrop!==o&&m.getAttribute(g)!==o||o,this.backdrop=!1!==s.backdrop&&"false"!==m.getAttribute(g)&&this.backdrop,this.animation=!!te(m,"fade"),this.content=s.content,m.isAnimating=!1;var f,v,y,b,S,x=this,A=null,T=ne(i,V).concat(ne(i,J)),O=function(){var n,i=e.getComputedStyle(t.body),s=parseInt(i.paddingRight,10);if(f&&(t.body.style.paddingRight=s+v+"px",m.style.paddingRight=v+"px",T.length))for(var r=0;r<T.length;r++)n=e.getComputedStyle(T[r]).paddingRight,T[r].style.paddingRight=parseInt(n)+v+"px"},I=function(){var n,s,r;f=t.body.clientWidth<(r=i.getBoundingClientRect(),e.innerWidth||r.right-Math.abs(r.left)),(s=t.createElement("div")).className="modal-scrollbar-measure",t.body.appendChild(s),n=s.offsetWidth-s.clientWidth,t.body.removeChild(s),v=n},M=function(){(y=ie(".modal-backdrop"))&&null!==y&&"object"==typeof y&&(W=0,t.body.removeChild(y),y=null)},R=function(){X(m),m.isAnimating=!1,ue.call(m,j,r,A),re(e,C,x.update,ce),re(m,w,z),re(t,E,L)},D=function(){m.style.display="",n&&X(n),ue.call(m,N,r),ne(t,"modal show")[0]||(function(){if(t.body.style.paddingRight="",m.style.paddingRight="",T.length)for(var e=0;e<T.length;e++)T[e].style.paddingRight=""}(),ee(t.body,"modal-open"),y&&te(y,"fade")?(ee(y,P),de(y,M)):M(),oe(e,C,x.update,ce),oe(m,w,z),oe(t,E,L)),m.isAnimating=!1},L=function(e){m.isAnimating||x.keyboard&&27==e.which&&te(m,P)&&x.hide()},z=function(e){if(!m.isAnimating){var t=e.target;te(m,P)&&(t.parentNode.getAttribute(a)===r||t.getAttribute(a)===r||t===m&&x.backdrop!==o)&&(x.hide(),A=null,e.preventDefault())}};this.toggle=function(){te(m,P)?this.hide():this.show()},this.show=function(){te(m,P)||m.isAnimating||(clearTimeout(S),S=setTimeout((function(){m.isAnimating=!0,ue.call(m,k,r,A);var e,n=ne(t,"modal show")[0];n&&n!==m&&(c in n&&n.modalTrigger.Modal.hide(),h in n&&n.Modal.hide()),x.backdrop&&!W&&!y&&(e=t.createElement("div"),null===(y=ie(".modal-backdrop"))&&(e.setAttribute("class",l+(x.animation?" fade":"")),y=e,t.body.appendChild(y)),W=1),y&&!te(y,P)&&(y.offsetWidth,b=le(y),K(y,P)),setTimeout((function(){m.style.display="block",I(),O(),K(t.body,"modal-open"),K(m,P),m.setAttribute(_,!1),te(m,"fade")?de(m,R):R()}),Q&&y&&b?b:1)}),1))},this.hide=function(){!m.isAnimating&&te(m,P)&&(clearTimeout(S),S=setTimeout((function(){m.isAnimating=!0,ue.call(m,$,r),y=ie(".modal-backdrop"),b=y&&le(y),ee(m,P),m.setAttribute(_,!0),setTimeout((function(){te(m,"fade")?de(m,D):D()}),Q&&y&&b?b:2)}),2))},this.setContent=function(e){ie(".modal-content",m).innerHTML=e},this.update=function(){te(m,P)&&(I(),O())},n&&!(h in n)&&re(n,w,(function(e){if(!m.isAnimating){var t=e.target;(t=t.hasAttribute(p)||t.hasAttribute("href")?t:t.parentNode)!==n||te(m,P)||(m.modalTrigger=n,A=n,x.show(),e.preventDefault())}})),x.content&&x.setContent(x.content),n?(n.Modal=x,m.modalTrigger=n):m.Modal=x}};r.push([h,ve,'[data-toggle="modal"]']);var ye=function(n,i){n=ie(n),i=i||{};var s=n.getAttribute("data-trigger"),r=n.getAttribute("data-animation"),o=n.getAttribute("data-placement"),a=n.getAttribute("data-dismissible"),c=n.getAttribute("data-delay"),l=n.getAttribute("data-container"),d="popover",u="class",h="div",f="fade",g="data-content",p='<button type="button" class="close">×</button>',y=ie(i.container),_=ie(l),b=se(n,".modal"),S=se(n,".fixed-top"),E=se(n,".fixed-bottom");this.template=i.template?i.template:null,this.trigger=i.trigger?i.trigger:s||x,this.animation=i.animation&&i.animation!==f?i.animation:r||f,this.placement=i.placement?i.placement:o||q,this.delay=parseInt(i.delay||c)||200,this.dismissible=!(!i.dismissible&&"true"!==a),this.container=y||_||S||E||b||t.body;var A=this,O=i.title||n.getAttribute(v)||null,I=i.content||n.getAttribute(g)||null;if(I||this.template){var M=null,R=0,D=this.placement,L=function(e){null!==M&&e.target===ie(".close",M)&&A.hide()},z=function(i){w!=A.trigger&&"focus"!=A.trigger||!A.dismissible&&i(n,"blur",A.hide),A.dismissible&&i(t,w,L),i(e,C,A.hide,ce)},F=function(){z(re),ue.call(n,j,d)},U=function(){z(oe),A.container.removeChild(M),R=null,M=null,ue.call(n,N,d)};this.toggle=function(){null===M?A.show():A.hide()},this.show=function(){clearTimeout(R),R=setTimeout((function(){null===M&&(D=A.placement,function(){O=i.title||n.getAttribute(v),I=(I=i.content||n.getAttribute(g))?I.trim():null,M=t.createElement(h);var e=t.createElement(h);if(e.setAttribute(u,"arrow"),M.appendChild(e),null!==I&&null===A.template){if(M.setAttribute("role","tooltip"),null!==O){var s=t.createElement("h3");s.setAttribute(u,"popover-header"),s.innerHTML=A.dismissible?O+p:O,M.appendChild(s)}var r=t.createElement(h);r.setAttribute(u,"popover-body"),r.innerHTML=A.dismissible&&null===O?I+p:I,M.appendChild(r)}else{var o=t.createElement(h);A.template=A.template.trim(),o.innerHTML=A.template,M.innerHTML=o.firstChild.innerHTML}A.container.appendChild(M),M.style.display="block",M.setAttribute(u,"popover bs-popover-"+D+" "+A.animation)}(),he(n,M,D,A.container),!te(M,P)&&K(M,P),ue.call(n,k,d),A.animation?de(M,F):F())}),20)},this.hide=function(){clearTimeout(R),R=setTimeout((function(){M&&null!==M&&te(M,P)&&(ue.call(n,$,d),ee(M,P),A.animation?de(M,U):U())}),A.delay)},m in n||(A.trigger===x?(re(n,T[0],A.show),A.dismissible||re(n,T[1],A.hide)):w!=A.trigger&&"focus"!=A.trigger||re(n,A.trigger,A.toggle)),n.Popover=A}};r.push([m,ye,'[data-toggle="popover"]']);var _e=function(e,t){var n=(e=ie(e)).getAttribute("data-height"),i="tab";t=t||{},this.height=!!Q&&(t.height||"true"===n);var s,r,o,a,c,l,d,u=this,h=se(e,".nav"),m=!1,g=h&&ie(".dropdown-toggle",h),p=function(){m.style.height="",ee(m,F),h.isAnimating=!1},v=function(){m?l?p():setTimeout((function(){m.style.height=d+"px",m.offsetWidth,de(m,p)}),50):h.isAnimating=!1,ue.call(s,j,i,r)},y=function(){m&&(o.style.float=U,a.style.float=U,c=o.scrollHeight),K(a,z),ue.call(s,k,i,r),ee(o,z),ue.call(r,N,i,s),m&&(d=a.scrollHeight,l=d===c,K(m,F),m.style.height=c+"px",m.offsetHeight,o.style.float="",a.style.float=""),te(a,"fade")?setTimeout((function(){K(a,P),de(a,v)}),20):v()};if(h){h.isAnimating=!1;var _=function(){var e,t=ne(h,z);return 1!==t.length||te(t[0].parentNode,"dropdown")?t.length>1&&(e=t[t.length-1]):e=t[0],e},S=function(){return ie(_().getAttribute("href"))};this.show=function(){a=ie((s=s||e).getAttribute("href")),r=_(),o=S(),h.isAnimating=!0,ee(r,z),r.setAttribute(b,"false"),K(s,z),s.setAttribute(b,"true"),g&&(te(e.parentNode,"dropdown-menu")?te(g,z)||K(g,z):te(g,z)&&ee(g,z)),ue.call(r,$,i,s),te(o,"fade")?(ee(o,P),de(o,y)):y()},f in e||re(e,w,(function(e){e.preventDefault(),s=e.currentTarget,!h.isAnimating&&!te(s,z)&&u.show()})),u.height&&(m=S().parentNode),e.Tab=u}};r.push([f,_e,'[data-toggle="tab"]']);var be=function(e,t){for(var n=0,i=t.length;n<i;n++)new e(t[n])},we=s.initCallback=function(e){e=e||t;for(var n=0,i=r.length;n<i;n++)be(r[n][1],e.querySelectorAll(r[n][2]))};return t.body?we():re(t,"DOMContentLoaded",(function(){we()})),{Alert:me,Button:fe,Collapse:ge,Dropdown:pe,Modal:ve,Popover:ye,Tab:_e}})?i.apply(t,[]):i)||(e.exports=s)},2234:e=>{window,e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImageElement=function(e,t){return new Promise((function(n,i){e.addEventListener("load",(function(){n(e)}),!1),e.addEventListener("error",(function(e){i(e)}),!1),e.src=t}))},t.resize=function(e,t,n,i){if(!n&&!i)return{currentWidth:e,currentHeight:t};var s=e/t,r=void 0,o=void 0;return s>n/i?o=(r=Math.min(e,n))/s:r=(o=Math.min(t,i))*s,{width:r,height:o}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.base64ToFile=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/jpeg",n=window.atob(e),i=[],s=0;s<n.length;s++)i[s]=n.charCodeAt(s);return new window.Blob([new Uint8Array(i)],{type:t})},t.imageToCanvas=function(e,t,n,i){var s=document.createElement("canvas"),r=s.getContext("2d");if(s.width=t,s.height=n,!i||i>8)return r.drawImage(e,0,0,s.width,s.height),s;switch(i>4&&(s.width=n,s.height=t),i){case 2:r.translate(t,0),r.scale(-1,1);break;case 3:r.translate(t,n),r.rotate(Math.PI);break;case 4:r.translate(0,n),r.scale(1,-1);break;case 5:r.rotate(.5*Math.PI),r.scale(1,-1);break;case 6:r.rotate(.5*Math.PI),r.translate(0,-n);break;case 7:r.rotate(.5*Math.PI),r.translate(t,-n),r.scale(-1,1);break;case 8:r.rotate(-.5*Math.PI),r.translate(-t,0)}return i>4?r.drawImage(e,0,0,s.height,s.width):r.drawImage(e,0,0,s.width,s.height),s},t.canvasToBlob=function(e,t){return new Promise((function(n,i){e.toBlob((function(e){n(e)}),"image/jpeg",t)}))},t.size=function(e){return{kB:.001*e,MB:1e-6*e}},t.blobToBase64=function(e){return new Promise((function(t,n){var i=new window.FileReader;i.addEventListener("load",(function(e){t(e.target.result)}),!1),i.addEventListener("error",(function(e){n(e)}),!1),i.readAsDataURL(e)}))}},function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractOrientation=function(e){return new Promise((function(t,n){var i=new window.FileReader;i.onload=function(e){var n=new DataView(e.target.result);65496!==n.getUint16(0,!1)&&t(-2);for(var i=n.byteLength,s=2;s<i;){var r=n.getUint16(s,!1);if(s+=2,65505===r){1165519206!==n.getUint32(s+=2,!1)&&t(-1);var o=18761===n.getUint16(s+=6,!1);s+=n.getUint32(s+4,o);var a=n.getUint16(s,o);s+=2;for(var c=0;c<a;c++)274===n.getUint16(s+12*c,o)&&t(n.getUint16(s+12*c+8,o))}else{if(65280!=(65280&r))break;s+=n.getUint16(s,!1)}}t(-1)},i.readAsArrayBuffer(e.slice(0,65536))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,s=(i=n(2))&&i.__esModule?i:{default:i},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(3),a=n(0),c=n(1);function l(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function i(s,r){try{var o=t[s](r),a=o.value}catch(e){return void n(e)}if(!o.done)return Promise.resolve(a).then((function(e){i("next",e)}),(function(e){i("throw",e)}));e(a)}("next")}))}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t,this.name=t.name,this.type=t.type,this.size=t.size}return r(e,[{key:"setData",value:function(e){this.data=e,this.size=e.size,this.type=e.type}},{key:"_calculateOrientation",value:function(){var e=l(s.default.mark((function e(){var t;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,o.extractOrientation)(this.data);case 2:t=e.sent,this.orientation=t;case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=l(s.default.mark((function e(){var t,n;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._calculateOrientation();case 2:return t=URL.createObjectURL(this.data),n=new window.Image,e.next=6,(0,a.loadImageElement)(n,t);case 6:URL.revokeObjectURL(t),this._img=n,this.width=n.naturalWidth,this.height=n.naturalHeight;case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getCanvas",value:function(e,t,n){return void 0!==n?(0,c.imageToCanvas)(this._img,e,t,n):(0,c.imageToCanvas)(this._img,e,t,this.orientation)}}]),e}();t.default=d,e.exports=t.default},function(e,t){!function(t){"use strict";var n,i=Object.prototype,s=i.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag",l="object"==typeof e,d=t.regeneratorRuntime;if(d)l&&(e.exports=d);else{(d=t.regeneratorRuntime=l?e.exports:{}).wrap=b;var u="suspendedStart",h="suspendedYield",m="executing",f="completed",g={},p={};p[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(N([])));y&&y!==i&&s.call(y,o)&&(p=y);var _=E.prototype=S.prototype=Object.create(p);x.prototype=_.constructor=E,E.constructor=x,E[c]=x.displayName="GeneratorFunction",d.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},d.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(_),e},d.awrap=function(e){return{__await:e}},A(C.prototype),C.prototype[a]=function(){return this},d.AsyncIterator=C,d.async=function(e,t,n,i){var s=new C(b(e,t,n,i));return d.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},A(_),_[c]="Generator",_[o]=function(){return this},_.toString=function(){return"[object Generator]"},d.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},d.values=N,$.prototype={constructor:$,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(j),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(i,s){return a.type="throw",a.arg=e,t.next=i,s&&(t.method="next",t.arg=n),!!s}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=s.call(o,"catchLoc"),l=s.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=t,r?(this.method="next",this.next=r.finallyLoc,g):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var s=i.arg;j(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:N(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=n),g}}}function b(e,t,n,i){var s=t&&t.prototype instanceof S?t:S,r=Object.create(s.prototype),o=new $(i||[]);return r._invoke=function(e,t,n){var i=u;return function(s,r){if(i===m)throw new Error("Generator is already running");if(i===f){if("throw"===s)throw r;return O()}for(n.method=s,n.arg=r;;){var o=n.delegate;if(o){var a=T(o,n);if(a){if(a===g)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===u)throw i=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var c=w(e,t,n);if("normal"===c.type){if(i=n.done?f:h,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=f,n.method="throw",n.arg=c.arg)}}}(e,n,o),r}function w(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function S(){}function x(){}function E(){}function A(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function C(e){var t;this._invoke=function(n,i){function r(){return new Promise((function(t,r){!function t(n,i,r,o){var a=w(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"==typeof l&&s.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,r,o)}),(function(e){t("throw",e,r,o)})):Promise.resolve(l).then((function(e){c.value=e,r(c)}),o)}o(a.arg)}(n,i,t,r)}))}return t=t?t.then(r,r):r()}}function T(e,t){var i=e.iterator[t.method];if(i===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,T(e,t),"throw"===t.method))return g;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var s=w(i,e.iterator,t.arg);if("throw"===s.type)return t.method="throw",t.arg=s.arg,t.delegate=null,g;var r=s.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,g):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function N(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function t(){for(;++i<e.length;)if(s.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=n,t.done=!0,t};return r.next=r}}return{next:O}}function O(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())},function(e,t,n){var i=function(){return this}()||Function("return this")(),s=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,r=s&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=n(5),s)i.regeneratorRuntime=r;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=c(n(2)),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(1)),o=n(0),a=c(n(4));function c(e){return e&&e.__esModule?e:{default:e}}function l(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function i(s,r){try{var o=t[s](r),a=o.value}catch(e){return void n(e)}if(!o.done)return Promise.resolve(a).then((function(e){i("next",e)}),(function(e){i("throw",e)}));e(a)}("next")}))}}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.setOptions(t)}return s(e,[{key:"setOptions",value:function(e){var t={targetSize:1/0,quality:.75,minQuality:.5,qualityStepSize:.1,maxWidth:1920,maxHeight:1920,resize:!0,throwIfSizeNotReached:!1,autoRotate:!0},n=new Proxy(e,{get:function(e,n){return n in e?e[n]:t[n]}});this.options=n}},{key:"_compressFile",value:function(){var e=l(i.default.mark((function e(t){var n,s;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new a.default(t),(s={}).start=window.performance.now(),s.quality=this.options.quality,s.startType=n.type,e.next=7,n.load();case 7:return e.next=9,this._compressImage(n,s);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_compressImage",value:function(){var e=l(i.default.mark((function e(t,n){var s,a,c,l,d;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.startWidth=t.width,n.startHeight=t.height,s=void 0,a=void 0,this.options.resize?(c=(0,o.resize)(t.width,t.height,this.options.maxWidth,this.options.maxHeight),s=c.width,a=c.height):(s=t.width,a=t.height),n.endWidth=s,n.endHeight=a,l=this.doAutoRotation?void 0:1,d=t.getCanvas(s,a,l),n.iterations=0,n.startSizeMB=r.size(t.size).MB,e.next=12,this._loopCompression(d,t,n);case 12:return n.endSizeMB=r.size(t.size).MB,n.sizeReducedInPercent=(n.startSizeMB-n.endSizeMB)/n.startSizeMB*100,n.end=window.performance.now(),n.elapsedTimeInSeconds=(n.end-n.start)/1e3,n.endType=t.type,e.abrupt("return",{photo:t,info:n});case 18:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"_loopCompression",value:function(){var e=l(i.default.mark((function e(t,n,s){var o;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.iterations++,e.t0=n,e.next=4,r.canvasToBlob(t,s.quality);case 4:if(e.t1=e.sent,e.t0.setData.call(e.t0,e.t1),1==s.iterations&&(n.width=s.endWidth,n.height=s.endHeight),!(r.size(n.size).MB>this.options.targetSize)){e.next=24;break}if(!(s.quality.toFixed(10)-.1<this.options.minQuality)){e.next=18;break}if(o="Couldn't compress image to target size while maintaining quality.\n Target size: "+this.options.targetSize+"\n Actual size: "+r.size(n.size).MB,this.options.throwIfSizeNotReached){e.next=14;break}console.error(o),e.next=15;break;case 14:throw new Error(o);case 15:case 24:return e.abrupt("return");case 18:return s.quality-=this.options.qualityStepSize,e.next=21,this._loopCompression(t,n,s);case 21:return e.abrupt("return",e.sent);case 22:e.next=25;break;case 25:case"end":return e.stop()}}),e,this)})));return function(t,n,i){return e.apply(this,arguments)}}()},{key:"setAutoRotate",value:function(){var t=l(i.default.mark((function t(){var n;return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.automaticRotationFeatureTest();case 2:n=t.sent,this.doAutoRotation=this.options.autoRotate&&!n;case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"compress",value:function(){var e=l(i.default.mark((function e(t){var n=this;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setAutoRotate();case 2:return e.abrupt("return",Promise.all(t.map((function(e){return n._compressFile(e)}))));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}],[{key:"blobToBase64",value:function(){var e=l(i.default.mark((function e(){var t=arguments;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.blobToBase64.apply(r,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"loadImageElement",value:function(){var e=l(i.default.mark((function e(){var t=arguments;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.loadImageElement.apply(void 0,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"automaticRotationFeatureTest",value:function(){return new Promise((function(e){var t=new Image;t.onload=function(){var n=1===t.width&&2===t.height;e(n)},t.src="data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q=="}))}}]),e}();t.default=d,e.exports=t.default}])},1966:(e,t,n)=>{n(7252);var i=n(6356).Object;e.exports=function(e,t,n){return i.defineProperty(e,t,n)}},4064:(e,t,n)=>{n(4304),e.exports=n(6356).Object.keys},9791:(e,t,n)=>{n(5693),n(5758),n(4291),n(9870),n(814),n(955),e.exports=n(6356).Promise},8640:e=>{e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},5678:e=>{e.exports=function(){}},1241:e=>{e.exports=function(e,t,n,i){if(!(e instanceof t)||void 0!==i&&i in e)throw TypeError(n+": incorrect invocation!");return e}},2854:(e,t,n)=>{var i=n(9773);e.exports=function(e){if(!i(e))throw TypeError(e+" is not an object!");return e}},7343:(e,t,n)=>{var i=n(1520),s=n(5836),r=n(9271);e.exports=function(e){return function(t,n,o){var a,c=i(t),l=s(c.length),d=r(o,l);if(e&&n!=n){for(;l>d;)if((a=c[d++])!=a)return!0}else for(;l>d;d++)if((e||d in c)&&c[d]===n)return e||d||0;return!e&&-1}}},2791:(e,t,n)=>{var i=n(103),s=n(3309)("toStringTag"),r="Arguments"==i(function(){return arguments}());e.exports=function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),s))?n:r?i(t):"Object"==(o=i(t))&&"function"==typeof t.callee?"Arguments":o}},103:e=>{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},6356:e=>{var t=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=t)},2389:(e,t,n)=>{var i=n(8640);e.exports=function(e,t,n){if(i(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,i){return e.call(t,n,i)};case 3:return function(n,i,s){return e.call(t,n,i,s)}}return function(){return e.apply(t,arguments)}}},7009:e=>{e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},6033:(e,t,n)=>{e.exports=!n(2889)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},3640:(e,t,n)=>{var i=n(9773),s=n(8942).document,r=i(s)&&i(s.createElement);e.exports=function(e){return r?s.createElement(e):{}}},1159:e=>{e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},3948:(e,t,n)=>{var i=n(8942),s=n(6356),r=n(2389),o=n(7270),a=n(9638),c=function(e,t,n){var l,d,u,h=e&c.F,m=e&c.G,f=e&c.S,g=e&c.P,p=e&c.B,v=e&c.W,y=m?s:s[t]||(s[t]={}),_=y.prototype,b=m?i:f?i[t]:(i[t]||{}).prototype;for(l in m&&(n=t),n)(d=!h&&b&&void 0!==b[l])&&a(y,l)||(u=d?b[l]:n[l],y[l]=m&&"function"!=typeof b[l]?n[l]:p&&d?r(u,i):v&&b[l]==u?function(e){var t=function(t,n,i){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,i)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(u):g&&"function"==typeof u?r(Function.call,u):u,g&&((y.virtual||(y.virtual={}))[l]=u,e&c.R&&_&&!_[l]&&o(_,l,u)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},2889:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},5766:(e,t,n)=>{var i=n(2389),s=n(281),r=n(692),o=n(2854),a=n(5836),c=n(4492),l={},d={},u=e.exports=function(e,t,n,u,h){var m,f,g,p,v=h?function(){return e}:c(e),y=i(n,u,t?2:1),_=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(r(v)){for(m=a(e.length);m>_;_++)if((p=t?y(o(f=e[_])[0],f[1]):y(e[_]))===l||p===d)return p}else for(g=v.call(e);!(f=g.next()).done;)if((p=s(g,y,f.value,t))===l||p===d)return p};u.BREAK=l,u.RETURN=d},8942:e=>{var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)},9638:e=>{var t={}.hasOwnProperty;e.exports=function(e,n){return t.call(e,n)}},7270:(e,t,n)=>{var i=n(8397),s=n(4785);e.exports=n(6033)?function(e,t,n){return i.f(e,t,s(1,n))}:function(e,t,n){return e[t]=n,e}},4455:(e,t,n)=>{var i=n(8942).document;e.exports=i&&i.documentElement},2375:(e,t,n)=>{e.exports=!n(6033)&&!n(2889)((function(){return 7!=Object.defineProperty(n(3640)("div"),"a",{get:function(){return 7}}).a}))},2240:e=>{e.exports=function(e,t,n){var i=void 0===n;switch(t.length){case 0:return i?e():e.call(n);case 1:return i?e(t[0]):e.call(n,t[0]);case 2:return i?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return i?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return i?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},4083:(e,t,n)=>{var i=n(103);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==i(e)?e.split(""):Object(e)}},692:(e,t,n)=>{var i=n(4098),s=n(3309)("iterator"),r=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||r[s]===e)}},9773:e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},281:(e,t,n)=>{var i=n(2854);e.exports=function(e,t,n,s){try{return s?t(i(n)[0],n[1]):t(n)}catch(t){var r=e.return;throw void 0!==r&&i(r.call(e)),t}}},3463:(e,t,n)=>{"use strict";var i=n(8910),s=n(4785),r=n(8200),o={};n(7270)(o,n(3309)("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=i(o,{next:s(1,n)}),r(e,t+" Iterator")}},8534:(e,t,n)=>{"use strict";var i=n(7757),s=n(3948),r=n(9858),o=n(7270),a=n(4098),c=n(3463),l=n(8200),d=n(7471),u=n(3309)("iterator"),h=!([].keys&&"next"in[].keys()),m="keys",f="values",g=function(){return this};e.exports=function(e,t,n,p,v,y,_){c(n,t,p);var b,w,S,x=function(e){if(!h&&e in T)return T[e];switch(e){case m:case f:return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",A=v==f,C=!1,T=e.prototype,k=T[u]||T["@@iterator"]||v&&T[v],j=k||x(v),$=v?A?x("entries"):j:void 0,N="Array"==t&&T.entries||k;if(N&&(S=d(N.call(new e)))!==Object.prototype&&S.next&&(l(S,E,!0),i||"function"==typeof S[u]||o(S,u,g)),A&&k&&k.name!==f&&(C=!0,j=function(){return k.call(this)}),i&&!_||!h&&!C&&T[u]||o(T,u,j),a[t]=j,a[E]=g,v)if(b={values:A?j:x(f),keys:y?j:x(m),entries:$},_)for(w in b)w in T||r(T,w,b[w]);else s(s.P+s.F*(h||C),t,b);return b}},4589:(e,t,n)=>{var i=n(3309)("iterator"),s=!1;try{var r=[7][i]();r.return=function(){s=!0},Array.from(r,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!s)return!1;var n=!1;try{var r=[7],o=r[i]();o.next=function(){return{done:n=!0}},r[i]=function(){return o},e(r)}catch(e){}return n}},3434:e=>{e.exports=function(e,t){return{value:t,done:!!e}}},4098:e=>{e.exports={}},7757:e=>{e.exports=!0},7189:(e,t,n)=>{var i=n(8942),s=n(6673).set,r=i.MutationObserver||i.WebKitMutationObserver,o=i.process,a=i.Promise,c="process"==n(103)(o);e.exports=function(){var e,t,n,l=function(){var i,s;for(c&&(i=o.domain)&&i.exit();e;){s=e.fn,e=e.next;try{s()}catch(i){throw e?n():t=void 0,i}}t=void 0,i&&i.enter()};if(c)n=function(){o.nextTick(l)};else if(!r||i.navigator&&i.navigator.standalone)if(a&&a.resolve){var d=a.resolve(void 0);n=function(){d.then(l)}}else n=function(){s.call(i,l)};else{var u=!0,h=document.createTextNode("");new r(l).observe(h,{characterData:!0}),n=function(){h.data=u=!u}}return function(i){var s={fn:i,next:void 0};t&&(t.next=s),e||(e=s,n()),t=s}}},8278:(e,t,n)=>{"use strict";var i=n(8640);function s(e){var t,n;this.promise=new e((function(e,i){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=i})),this.resolve=i(t),this.reject=i(n)}e.exports.f=function(e){return new s(e)}},8910:(e,t,n)=>{var i=n(2854),s=n(5244),r=n(1159),o=n(6962)("IE_PROTO"),a=function(){},c=function(){var e,t=n(3640)("iframe"),i=r.length;for(t.style.display="none",n(4455).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;i--;)delete c.prototype[r[i]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(a.prototype=i(e),n=new a,a.prototype=null,n[o]=e):n=c(),void 0===t?n:s(n,t)}},8397:(e,t,n)=>{var i=n(2854),s=n(2375),r=n(2737),o=Object.defineProperty;t.f=n(6033)?Object.defineProperty:function(e,t,n){if(i(e),t=r(t,!0),i(n),s)try{return o(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},5244:(e,t,n)=>{var i=n(8397),s=n(2854),r=n(180);e.exports=n(6033)?Object.defineProperties:function(e,t){s(e);for(var n,o=r(t),a=o.length,c=0;a>c;)i.f(e,n=o[c++],t[n]);return e}},7471:(e,t,n)=>{var i=n(9638),s=n(4661),r=n(6962)("IE_PROTO"),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=s(e),i(e,r)?e[r]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},5667:(e,t,n)=>{var i=n(9638),s=n(1520),r=n(7343)(!1),o=n(6962)("IE_PROTO");e.exports=function(e,t){var n,a=s(e),c=0,l=[];for(n in a)n!=o&&i(a,n)&&l.push(n);for(;t.length>c;)i(a,n=t[c++])&&(~r(l,n)||l.push(n));return l}},180:(e,t,n)=>{var i=n(5667),s=n(1159);e.exports=Object.keys||function(e){return i(e,s)}},8745:(e,t,n)=>{var i=n(3948),s=n(6356),r=n(2889);e.exports=function(e,t){var n=(s.Object||{})[e]||Object[e],o={};o[e]=t(n),i(i.S+i.F*r((function(){n(1)})),"Object",o)}},885:e=>{e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},2503:(e,t,n)=>{var i=n(2854),s=n(9773),r=n(8278);e.exports=function(e,t){if(i(e),s(t)&&t.constructor===e)return t;var n=r.f(e);return(0,n.resolve)(t),n.promise}},4785:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},4724:(e,t,n)=>{var i=n(7270);e.exports=function(e,t,n){for(var s in t)n&&e[s]?e[s]=t[s]:i(e,s,t[s]);return e}},9858:(e,t,n)=>{e.exports=n(7270)},4431:(e,t,n)=>{"use strict";var i=n(8942),s=n(6356),r=n(8397),o=n(6033),a=n(3309)("species");e.exports=function(e){var t="function"==typeof s[e]?s[e]:i[e];o&&t&&!t[a]&&r.f(t,a,{configurable:!0,get:function(){return this}})}},8200:(e,t,n)=>{var i=n(8397).f,s=n(9638),r=n(3309)("toStringTag");e.exports=function(e,t,n){e&&!s(e=n?e:e.prototype,r)&&i(e,r,{configurable:!0,value:t})}},6962:(e,t,n)=>{var i=n(4581)("keys"),s=n(1453);e.exports=function(e){return i[e]||(i[e]=s(e))}},4581:(e,t,n)=>{var i=n(6356),s=n(8942),r="__core-js_shared__",o=s[r]||(s[r]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:i.version,mode:n(7757)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},4463:(e,t,n)=>{var i=n(2854),s=n(8640),r=n(3309)("species");e.exports=function(e,t){var n,o=i(e).constructor;return void 0===o||null==(n=i(o)[r])?t:s(n)}},6995:(e,t,n)=>{var i=n(4709),s=n(7009);e.exports=function(e){return function(t,n){var r,o,a=String(s(t)),c=i(n),l=a.length;return c<0||c>=l?e?"":void 0:(r=a.charCodeAt(c))<55296||r>56319||c+1===l||(o=a.charCodeAt(c+1))<56320||o>57343?e?a.charAt(c):r:e?a.slice(c,c+2):o-56320+(r-55296<<10)+65536}}},6673:(e,t,n)=>{var i,s,r,o=n(2389),a=n(2240),c=n(4455),l=n(3640),d=n(8942),u=d.process,h=d.setImmediate,m=d.clearImmediate,f=d.MessageChannel,g=d.Dispatch,p=0,v={},y=function(){var e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e],t()}},_=function(e){y.call(e.data)};h&&m||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return v[++p]=function(){a("function"==typeof e?e:Function(e),t)},i(p),p},m=function(e){delete v[e]},"process"==n(103)(u)?i=function(e){u.nextTick(o(y,e,1))}:g&&g.now?i=function(e){g.now(o(y,e,1))}:f?(r=(s=new f).port2,s.port1.onmessage=_,i=o(r.postMessage,r,1)):d.addEventListener&&"function"==typeof postMessage&&!d.importScripts?(i=function(e){d.postMessage(e+"","*")},d.addEventListener("message",_,!1)):i="onreadystatechange"in l("script")?function(e){c.appendChild(l("script")).onreadystatechange=function(){c.removeChild(this),y.call(e)}}:function(e){setTimeout(o(y,e,1),0)}),e.exports={set:h,clear:m}},9271:(e,t,n)=>{var i=n(4709),s=Math.max,r=Math.min;e.exports=function(e,t){return(e=i(e))<0?s(e+t,0):r(e,t)}},4709:e=>{var t=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:t)(e)}},1520:(e,t,n)=>{var i=n(4083),s=n(7009);e.exports=function(e){return i(s(e))}},5836:(e,t,n)=>{var i=n(4709),s=Math.min;e.exports=function(e){return e>0?s(i(e),9007199254740991):0}},4661:(e,t,n)=>{var i=n(7009);e.exports=function(e){return Object(i(e))}},2737:(e,t,n)=>{var i=n(9773);e.exports=function(e,t){if(!i(e))return e;var n,s;if(t&&"function"==typeof(n=e.toString)&&!i(s=n.call(e)))return s;if("function"==typeof(n=e.valueOf)&&!i(s=n.call(e)))return s;if(!t&&"function"==typeof(n=e.toString)&&!i(s=n.call(e)))return s;throw TypeError("Can't convert object to primitive value")}},1453:e=>{var t=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++t+n).toString(36))}},4593:(e,t,n)=>{var i=n(8942).navigator;e.exports=i&&i.userAgent||""},3309:(e,t,n)=>{var i=n(4581)("wks"),s=n(1453),r=n(8942).Symbol,o="function"==typeof r;(e.exports=function(e){return i[e]||(i[e]=o&&r[e]||(o?r:s)("Symbol."+e))}).store=i},4492:(e,t,n)=>{var i=n(2791),s=n(3309)("iterator"),r=n(4098);e.exports=n(6356).getIteratorMethod=function(e){if(null!=e)return e[s]||e["@@iterator"]||r[i(e)]}},4999:(e,t,n)=>{"use strict";var i=n(5678),s=n(3434),r=n(4098),o=n(1520);e.exports=n(8534)(Array,"Array",(function(e,t){this._t=o(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,s(1)):s(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),r.Arguments=r.Array,i("keys"),i("values"),i("entries")},7252:(e,t,n)=>{var i=n(3948);i(i.S+i.F*!n(6033),"Object",{defineProperty:n(8397).f})},4304:(e,t,n)=>{var i=n(4661),s=n(180);n(8745)("keys",(function(){return function(e){return s(i(e))}}))},5693:()=>{},9870:(e,t,n)=>{"use strict";var i,s,r,o,a=n(7757),c=n(8942),l=n(2389),d=n(2791),u=n(3948),h=n(9773),m=n(8640),f=n(1241),g=n(5766),p=n(4463),v=n(6673).set,y=n(7189)(),_=n(8278),b=n(885),w=n(4593),S=n(2503),x="Promise",E=c.TypeError,A=c.process,C=A&&A.versions,T=C&&C.v8||"",k=c.Promise,j="process"==d(A),$=function(){},N=s=_.f,O=!!function(){try{var e=k.resolve(1),t=(e.constructor={})[n(3309)("species")]=function(e){e($,$)};return(j||"function"==typeof PromiseRejectionEvent)&&e.then($)instanceof t&&0!==T.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(e){}}(),I=function(e){var t;return!(!h(e)||"function"!=typeof(t=e.then))&&t},M=function(e,t){if(!e._n){e._n=!0;var n=e._c;y((function(){for(var i=e._v,s=1==e._s,r=0,o=function(t){var n,r,o,a=s?t.ok:t.fail,c=t.resolve,l=t.reject,d=t.domain;try{a?(s||(2==e._h&&L(e),e._h=1),!0===a?n=i:(d&&d.enter(),n=a(i),d&&(d.exit(),o=!0)),n===t.promise?l(E("Promise-chain cycle")):(r=I(n))?r.call(n,c,l):c(n)):l(i)}catch(e){d&&!o&&d.exit(),l(e)}};n.length>r;)o(n[r++]);e._c=[],e._n=!1,t&&!e._h&&R(e)}))}},R=function(e){v.call(c,(function(){var t,n,i,s=e._v,r=D(e);if(r&&(t=b((function(){j?A.emit("unhandledRejection",s,e):(n=c.onunhandledrejection)?n({promise:e,reason:s}):(i=c.console)&&i.error&&i.error("Unhandled promise rejection",s)})),e._h=j||D(e)?2:1),e._a=void 0,r&&t.e)throw t.v}))},D=function(e){return 1!==e._h&&0===(e._a||e._c).length},L=function(e){v.call(c,(function(){var t;j?A.emit("rejectionHandled",e):(t=c.onrejectionhandled)&&t({promise:e,reason:e._v})}))},z=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),M(t,!0))},P=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw E("Promise can't be resolved itself");(t=I(e))?y((function(){var i={_w:n,_d:!1};try{t.call(e,l(P,i,1),l(z,i,1))}catch(e){z.call(i,e)}})):(n._v=e,n._s=1,M(n,!1))}catch(e){z.call({_w:n,_d:!1},e)}}};O||(k=function(e){f(this,k,x,"_h"),m(e),i.call(this);try{e(l(P,this,1),l(z,this,1))}catch(e){z.call(this,e)}},(i=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(4724)(k.prototype,{then:function(e,t){var n=N(p(this,k));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=j?A.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&M(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),r=function(){var e=new i;this.promise=e,this.resolve=l(P,e,1),this.reject=l(z,e,1)},_.f=N=function(e){return e===k||e===o?new r(e):s(e)}),u(u.G+u.W+u.F*!O,{Promise:k}),n(8200)(k,x),n(4431)(x),o=n(6356).Promise,u(u.S+u.F*!O,x,{reject:function(e){var t=N(this);return(0,t.reject)(e),t.promise}}),u(u.S+u.F*(a||!O),x,{resolve:function(e){return S(a&&this===o?k:this,e)}}),u(u.S+u.F*!(O&&n(4589)((function(e){k.all(e).catch($)}))),x,{all:function(e){var t=this,n=N(t),i=n.resolve,s=n.reject,r=b((function(){var n=[],r=0,o=1;g(e,!1,(function(e){var a=r++,c=!1;n.push(void 0),o++,t.resolve(e).then((function(e){c||(c=!0,n[a]=e,--o||i(n))}),s)})),--o||i(n)}));return r.e&&s(r.v),n.promise},race:function(e){var t=this,n=N(t),i=n.reject,s=b((function(){g(e,!1,(function(e){t.resolve(e).then(n.resolve,i)}))}));return s.e&&i(s.v),n.promise}})},5758:(e,t,n)=>{"use strict";var i=n(6995)(!0);n(8534)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=i(t,n),this._i+=e.length,{value:e,done:!1})}))},814:(e,t,n)=>{"use strict";var i=n(3948),s=n(6356),r=n(8942),o=n(4463),a=n(2503);i(i.P+i.R,"Promise",{finally:function(e){var t=o(this,s.Promise||r.Promise),n="function"==typeof e;return this.then(n?function(n){return a(t,e()).then((function(){return n}))}:e,n?function(n){return a(t,e()).then((function(){throw n}))}:e)}})},955:(e,t,n)=>{"use strict";var i=n(3948),s=n(8278),r=n(885);i(i.S,"Promise",{try:function(e){var t=s.f(this),n=r(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},4291:(e,t,n)=>{n(4999);for(var i=n(8942),s=n(7270),r=n(4098),o=n(3309)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),c=0;c<a.length;c++){var l=a[c],d=i[l],u=d&&d.prototype;u&&!u[o]&&s(u,o,l),r[l]=r.Array}},7180:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,i){"string"==typeof e&&(e=[[null,e,""]]);var s={};if(i)for(var r=0;r<this.length;r++){var o=this[r][0];null!=o&&(s[o]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);i&&s[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},8531:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}e.exports=function(e){var n,i,s=(i=4,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var i,s,r=[],o=!0,a=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(r.push(i.value),!t||r.length!==t);o=!0);}catch(e){a=!0,s=e}finally{try{o||null==n.return||n.return()}finally{if(a)throw s}}return r}}(n,i)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?t(e,n):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=s[1],o=s[3];if(!o)return r;if("function"==typeof btoa){var a=btoa(unescape(encodeURIComponent(JSON.stringify(o)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),l="/*# ".concat(c," */"),d=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")}));return[r].concat(d).concat([l]).join("\n")}return[r].join("\n")}},8570:function(e){e.exports=function(){"use strict";var e=6e4,t=36e5,n="millisecond",i="second",s="minute",r="hour",o="day",a="week",c="month",l="quarter",d="year",u="date",h="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},p=function(e,t,n){var i=String(e);return!i||i.length>=t?e:""+Array(t+1-i.length).join(n)+e},v={s:p,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),i=Math.floor(n/60),s=n%60;return(t<=0?"+":"-")+p(i,2,"0")+":"+p(s,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var i=12*(n.year()-t.year())+(n.month()-t.month()),s=t.clone().add(i,c),r=n-s<0,o=t.clone().add(i+(r?-1:1),c);return+(-(i+(n-s)/(r?s-o:o-s))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:a,d:o,D:u,h:r,m:s,s:i,ms:n,Q:l}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},y="en",_={};_[y]=g;var b=function(e){return e instanceof E},w=function(e,t,n){var i;if(!e)return y;if("string"==typeof e)_[e]&&(i=e),t&&(_[e]=t,i=e);else{var s=e.name;_[s]=e,i=s}return!n&&i&&(y=i),i||!n&&y},S=function(e,t){if(b(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new E(n)},x=v;x.l=w,x.i=b,x.w=function(e,t){return S(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=w(e.locale,null,!0),this.parse(e)}var p=g.prototype;return p.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(x.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var i=t.match(m);if(i){var s=i[2]-1||0,r=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)):new Date(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},p.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},p.$utils=function(){return x},p.isValid=function(){return!(this.$d.toString()===h)},p.isSame=function(e,t){var n=S(e);return this.startOf(t)<=n&&n<=this.endOf(t)},p.isAfter=function(e,t){return S(e)<this.startOf(t)},p.isBefore=function(e,t){return this.endOf(t)<S(e)},p.$g=function(e,t,n){return x.u(e)?this[t]:this.set(n,e)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(e,t){var n=this,l=!!x.u(t)||t,h=x.p(e),m=function(e,t){var i=x.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return l?i:i.endOf(o)},f=function(e,t){return x.w(n.toDate()[e].apply(n.toDate("s"),(l?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},g=this.$W,p=this.$M,v=this.$D,y="set"+(this.$u?"UTC":"");switch(h){case d:return l?m(1,0):m(31,11);case c:return l?m(1,p):m(0,p+1);case a:var _=this.$locale().weekStart||0,b=(g<_?g+7:g)-_;return m(l?v-b:v+(6-b),p);case o:case u:return f(y+"Hours",0);case r:return f(y+"Minutes",1);case s:return f(y+"Seconds",2);case i:return f(y+"Milliseconds",3);default:return this.clone()}},p.endOf=function(e){return this.startOf(e,!1)},p.$set=function(e,t){var a,l=x.p(e),h="set"+(this.$u?"UTC":""),m=(a={},a[o]=h+"Date",a[u]=h+"Date",a[c]=h+"Month",a[d]=h+"FullYear",a[r]=h+"Hours",a[s]=h+"Minutes",a[i]=h+"Seconds",a[n]=h+"Milliseconds",a)[l],f=l===o?this.$D+(t-this.$W):t;if(l===c||l===d){var g=this.clone().set(u,1);g.$d[m](f),g.init(),this.$d=g.set(u,Math.min(this.$D,g.daysInMonth())).$d}else m&&this.$d[m](f);return this.init(),this},p.set=function(e,t){return this.clone().$set(e,t)},p.get=function(e){return this[x.p(e)]()},p.add=function(n,l){var u,h=this;n=Number(n);var m=x.p(l),f=function(e){var t=S(h);return x.w(t.date(t.date()+Math.round(e*n)),h)};if(m===c)return this.set(c,this.$M+n);if(m===d)return this.set(d,this.$y+n);if(m===o)return f(1);if(m===a)return f(7);var g=(u={},u[s]=e,u[r]=t,u[i]=1e3,u)[m]||1,p=this.$d.getTime()+n*g;return x.w(p,this)},p.subtract=function(e,t){return this.add(-1*e,t)},p.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||h;var i=e||"YYYY-MM-DDTHH:mm:ssZ",s=x.z(this),r=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,d=function(e,n,s,r){return e&&(e[n]||e(t,i))||s[n].substr(0,r)},u=function(e){return x.s(r%12||12,e,"0")},m=n.meridiem||function(e,t,n){var i=e<12?"AM":"PM";return n?i.toLowerCase():i},g={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:x.s(a+1,2,"0"),MMM:d(n.monthsShort,a,l,3),MMMM:d(l,a),D:this.$D,DD:x.s(this.$D,2,"0"),d:String(this.$W),dd:d(n.weekdaysMin,this.$W,c,2),ddd:d(n.weekdaysShort,this.$W,c,3),dddd:c[this.$W],H:String(r),HH:x.s(r,2,"0"),h:u(1),hh:u(2),a:m(r,o,!0),A:m(r,o,!1),m:String(o),mm:x.s(o,2,"0"),s:String(this.$s),ss:x.s(this.$s,2,"0"),SSS:x.s(this.$ms,3,"0"),Z:s};return i.replace(f,(function(e,t){return t||g[e]||s.replace(":","")}))},p.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},p.diff=function(n,u,h){var m,f=x.p(u),g=S(n),p=(g.utcOffset()-this.utcOffset())*e,v=this-g,y=x.m(this,g);return y=(m={},m[d]=y/12,m[c]=y,m[l]=y/3,m[a]=(v-p)/6048e5,m[o]=(v-p)/864e5,m[r]=v/t,m[s]=v/e,m[i]=v/1e3,m)[f]||v,h?y:x.a(y)},p.daysInMonth=function(){return this.endOf(c).$D},p.$locale=function(){return _[this.$L]},p.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),i=w(e,t,!0);return i&&(n.$L=i),n},p.clone=function(){return x.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},g}(),A=E.prototype;return S.prototype=A,[["$ms",n],["$s",i],["$m",s],["$H",r],["$W",o],["$M",c],["$y",d],["$D",u]].forEach((function(e){A[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),S.extend=function(e,t){return e.$i||(e(t,E,S),e.$i=!0),S},S.locale=w,S.isDayjs=b,S.unix=function(e){return S(1e3*e)},S.en=_[y],S.Ls=_,S.p={},S}()},8030:function(e){e.exports=function(){"use strict";return function(e,t,n){var i=t.prototype,s=i.format;n.en.ordinal=function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"},i.format=function(e){var t=this,n=this.$locale(),i=this.$utils(),r=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(e){switch(e){case"Q":return Math.ceil((t.$M+1)/3);case"Do":return n.ordinal(t.$D);case"gggg":return t.weekYear();case"GGGG":return t.isoWeekYear();case"wo":return n.ordinal(t.week(),"W");case"w":case"ww":return i.s(t.week(),"w"===e?1:2,"0");case"W":case"WW":return i.s(t.isoWeek(),"W"===e?1:2,"0");case"k":case"kk":return i.s(String(0===t.$H?24:t.$H),"k"===e?1:2,"0");case"X":return Math.floor(t.$d.getTime()/1e3);case"x":return t.$d.getTime();case"z":return"["+t.offsetName()+"]";case"zzz":return"["+t.offsetName("long")+"]";default:return e}}));return s.bind(this)(r)}}}()},1454:function(e){e.exports=function(){"use strict";var e=Object.hasOwnProperty,t=Object.setPrototypeOf,n=Object.isFrozen,i=Object.getPrototypeOf,s=Object.getOwnPropertyDescriptor,r=Object.freeze,o=Object.seal,a=Object.create,c="undefined"!=typeof Reflect&&Reflect,l=c.apply,d=c.construct;l||(l=function(e,t,n){return e.apply(t,n)}),r||(r=function(e){return e}),o||(o=function(e){return e}),d||(d=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var u,h=S(Array.prototype.forEach),m=S(Array.prototype.pop),f=S(Array.prototype.push),g=S(String.prototype.toLowerCase),p=S(String.prototype.match),v=S(String.prototype.replace),y=S(String.prototype.indexOf),_=S(String.prototype.trim),b=S(RegExp.prototype.test),w=(u=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return d(u,t)});function S(e){return function(t){for(var n=arguments.length,i=Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return l(e,t,i)}}function x(e,i){t&&t(e,null);for(var s=i.length;s--;){var r=i[s];if("string"==typeof r){var o=g(r);o!==r&&(n(i)||(i[s]=o),r=o)}e[r]=!0}return e}function E(t){var n=a(null),i=void 0;for(i in t)l(e,t,[i])&&(n[i]=t[i]);return n}function A(e,t){for(;null!==e;){var n=s(e,t);if(n){if(n.get)return S(n.get);if("function"==typeof n.value)return S(n.value)}e=i(e)}return function(e){return console.warn("fallback value for",e),null}}var C=r(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),T=r(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),k=r(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),j=r(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),$=r(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),N=r(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),O=r(["#text"]),I=r(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),M=r(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),R=r(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),D=r(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),L=o(/\{\{[\s\S]*|[\s\S]*\}\}/gm),z=o(/<%[\s\S]*|[\s\S]*%>/gm),P=o(/^data-[\-\w.\u00B7-\uFFFF]/),F=o(/^aria-[\-\w]+$/),U=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),B=o(/^(?:\w+script|data):/i),q=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),H=o(/^html$/i),G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function W(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var V=function(){return"undefined"==typeof window?null:window},J=function(e,t){if("object"!==(void 0===e?"undefined":G(e))||"function"!=typeof e.createPolicy)return null;var n=null,i="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(i)&&(n=t.currentScript.getAttribute(i));var s="dompurify"+(n?"#"+n:"");try{return e.createPolicy(s,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+s+" could not be created."),null}};return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:V(),n=function(t){return e(t)};if(n.version="2.3.6",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var i=t.document,s=t.document,o=t.DocumentFragment,a=t.HTMLTemplateElement,c=t.Node,l=t.Element,d=t.NodeFilter,u=t.NamedNodeMap,S=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,Q=t.HTMLFormElement,Z=t.DOMParser,Y=t.trustedTypes,X=l.prototype,K=A(X,"cloneNode"),ee=A(X,"nextSibling"),te=A(X,"childNodes"),ne=A(X,"parentNode");if("function"==typeof a){var ie=s.createElement("template");ie.content&&ie.content.ownerDocument&&(s=ie.content.ownerDocument)}var se=J(Y,i),re=se?se.createHTML(""):"",oe=s,ae=oe.implementation,ce=oe.createNodeIterator,le=oe.createDocumentFragment,de=oe.getElementsByTagName,ue=i.importNode,he={};try{he=E(s).documentMode?s.documentMode:{}}catch(e){}var me={};n.isSupported="function"==typeof ne&&ae&&void 0!==ae.createHTMLDocument&&9!==he;var fe=L,ge=z,pe=P,ve=F,ye=B,_e=q,be=U,we=null,Se=x({},[].concat(W(C),W(T),W(k),W($),W(O))),xe=null,Ee=x({},[].concat(W(I),W(M),W(R),W(D))),Ae=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,Te=null,ke=!0,je=!0,$e=!1,Ne=!1,Oe=!1,Ie=!1,Me=!1,Re=!1,De=!1,Le=!1,ze=!0,Pe=!0,Fe=!1,Ue={},Be=null,qe=x({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),He=null,Ge=x({},["audio","video","img","source","image","track"]),We=null,Ve=x({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Je="http://www.w3.org/1998/Math/MathML",Qe="http://www.w3.org/2000/svg",Ze="http://www.w3.org/1999/xhtml",Ye=Ze,Xe=!1,Ke=void 0,et=["application/xhtml+xml","text/html"],tt="text/html",nt=void 0,it=null,st=s.createElement("form"),rt=function(e){return e instanceof RegExp||e instanceof Function},ot=function(e){it&&it===e||(e&&"object"===(void 0===e?"undefined":G(e))||(e={}),e=E(e),we="ALLOWED_TAGS"in e?x({},e.ALLOWED_TAGS):Se,xe="ALLOWED_ATTR"in e?x({},e.ALLOWED_ATTR):Ee,We="ADD_URI_SAFE_ATTR"in e?x(E(Ve),e.ADD_URI_SAFE_ATTR):Ve,He="ADD_DATA_URI_TAGS"in e?x(E(Ge),e.ADD_DATA_URI_TAGS):Ge,Be="FORBID_CONTENTS"in e?x({},e.FORBID_CONTENTS):qe,Ce="FORBID_TAGS"in e?x({},e.FORBID_TAGS):{},Te="FORBID_ATTR"in e?x({},e.FORBID_ATTR):{},Ue="USE_PROFILES"in e&&e.USE_PROFILES,ke=!1!==e.ALLOW_ARIA_ATTR,je=!1!==e.ALLOW_DATA_ATTR,$e=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ne=e.SAFE_FOR_TEMPLATES||!1,Oe=e.WHOLE_DOCUMENT||!1,Re=e.RETURN_DOM||!1,De=e.RETURN_DOM_FRAGMENT||!1,Le=e.RETURN_TRUSTED_TYPE||!1,Me=e.FORCE_BODY||!1,ze=!1!==e.SANITIZE_DOM,Pe=!1!==e.KEEP_CONTENT,Fe=e.IN_PLACE||!1,be=e.ALLOWED_URI_REGEXP||be,Ye=e.NAMESPACE||Ze,e.CUSTOM_ELEMENT_HANDLING&&rt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ae.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&rt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ae.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ae.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ke=Ke=-1===et.indexOf(e.PARSER_MEDIA_TYPE)?tt:e.PARSER_MEDIA_TYPE,nt="application/xhtml+xml"===Ke?function(e){return e}:g,Ne&&(je=!1),De&&(Re=!0),Ue&&(we=x({},[].concat(W(O))),xe=[],!0===Ue.html&&(x(we,C),x(xe,I)),!0===Ue.svg&&(x(we,T),x(xe,M),x(xe,D)),!0===Ue.svgFilters&&(x(we,k),x(xe,M),x(xe,D)),!0===Ue.mathMl&&(x(we,$),x(xe,R),x(xe,D))),e.ADD_TAGS&&(we===Se&&(we=E(we)),x(we,e.ADD_TAGS)),e.ADD_ATTR&&(xe===Ee&&(xe=E(xe)),x(xe,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&x(We,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(Be===qe&&(Be=E(Be)),x(Be,e.FORBID_CONTENTS)),Pe&&(we["#text"]=!0),Oe&&x(we,["html","head","body"]),we.table&&(x(we,["tbody"]),delete Ce.tbody),r&&r(e),it=e)},at=x({},["mi","mo","mn","ms","mtext"]),ct=x({},["foreignobject","desc","title","annotation-xml"]),lt=x({},T);x(lt,k),x(lt,j);var dt=x({},$);x(dt,N);var ut=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:Ze,tagName:"template"});var n=g(e.tagName),i=g(t.tagName);if(e.namespaceURI===Qe)return t.namespaceURI===Ze?"svg"===n:t.namespaceURI===Je?"svg"===n&&("annotation-xml"===i||at[i]):Boolean(lt[n]);if(e.namespaceURI===Je)return t.namespaceURI===Ze?"math"===n:t.namespaceURI===Qe?"math"===n&&ct[i]:Boolean(dt[n]);if(e.namespaceURI===Ze){if(t.namespaceURI===Qe&&!ct[i])return!1;if(t.namespaceURI===Je&&!at[i])return!1;var s=x({},["title","style","font","a","script"]);return!dt[n]&&(s[n]||!lt[n])}return!1},ht=function(e){f(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=re}catch(t){e.remove()}}},mt=function(e,t){try{f(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){f(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!xe[e])if(Re||De)try{ht(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},ft=function(e){var t=void 0,n=void 0;if(Me)e="<remove></remove>"+e;else{var i=p(e,/^[\r\n\t ]+/);n=i&&i[0]}"application/xhtml+xml"===Ke&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var r=se?se.createHTML(e):e;if(Ye===Ze)try{t=(new Z).parseFromString(r,Ke)}catch(e){}if(!t||!t.documentElement){t=ae.createDocument(Ye,"template",null);try{t.documentElement.innerHTML=Xe?"":r}catch(e){}}var o=t.body||t.documentElement;return e&&n&&o.insertBefore(s.createTextNode(n),o.childNodes[0]||null),Ye===Ze?de.call(t,Oe?"html":"body")[0]:Oe?t.documentElement:o},gt=function(e){return ce.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},pt=function(e){return e instanceof Q&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof S)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},vt=function(e){return"object"===(void 0===c?"undefined":G(c))?e instanceof c:e&&"object"===(void 0===e?"undefined":G(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},yt=function(e,t,i){me[e]&&h(me[e],(function(e){e.call(n,t,i,it)}))},_t=function(e){var t=void 0;if(yt("beforeSanitizeElements",e,null),pt(e))return ht(e),!0;if(p(e.nodeName,/[\u0080-\uFFFF]/))return ht(e),!0;var i=nt(e.nodeName);if(yt("uponSanitizeElement",e,{tagName:i,allowedTags:we}),!vt(e.firstElementChild)&&(!vt(e.content)||!vt(e.content.firstElementChild))&&b(/<[/\w]/g,e.innerHTML)&&b(/<[/\w]/g,e.textContent))return ht(e),!0;if("select"===i&&b(/<template/i,e.innerHTML))return ht(e),!0;if(!we[i]||Ce[i]){if(!Ce[i]&&wt(i)){if(Ae.tagNameCheck instanceof RegExp&&b(Ae.tagNameCheck,i))return!1;if(Ae.tagNameCheck instanceof Function&&Ae.tagNameCheck(i))return!1}if(Pe&&!Be[i]){var s=ne(e)||e.parentNode,r=te(e)||e.childNodes;if(r&&s)for(var o=r.length-1;o>=0;--o)s.insertBefore(K(r[o],!0),ee(e))}return ht(e),!0}return e instanceof l&&!ut(e)?(ht(e),!0):"noscript"!==i&&"noembed"!==i||!b(/<\/no(script|embed)/i,e.innerHTML)?(Ne&&3===e.nodeType&&(t=e.textContent,t=v(t,fe," "),t=v(t,ge," "),e.textContent!==t&&(f(n.removed,{element:e.cloneNode()}),e.textContent=t)),yt("afterSanitizeElements",e,null),!1):(ht(e),!0)},bt=function(e,t,n){if(ze&&("id"===t||"name"===t)&&(n in s||n in st))return!1;if(je&&!Te[t]&&b(pe,t));else if(ke&&b(ve,t));else if(!xe[t]||Te[t]){if(!(wt(e)&&(Ae.tagNameCheck instanceof RegExp&&b(Ae.tagNameCheck,e)||Ae.tagNameCheck instanceof Function&&Ae.tagNameCheck(e))&&(Ae.attributeNameCheck instanceof RegExp&&b(Ae.attributeNameCheck,t)||Ae.attributeNameCheck instanceof Function&&Ae.attributeNameCheck(t))||"is"===t&&Ae.allowCustomizedBuiltInElements&&(Ae.tagNameCheck instanceof RegExp&&b(Ae.tagNameCheck,n)||Ae.tagNameCheck instanceof Function&&Ae.tagNameCheck(n))))return!1}else if(We[t]);else if(b(be,v(n,_e,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==y(n,"data:")||!He[e])if($e&&!b(ye,v(n,_e,"")));else if(n)return!1;return!0},wt=function(e){return e.indexOf("-")>0},St=function(e){var t=void 0,i=void 0,s=void 0,r=void 0;yt("beforeSanitizeAttributes",e,null);var o=e.attributes;if(o){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe};for(r=o.length;r--;){var c=t=o[r],l=c.name,d=c.namespaceURI;if(i=_(t.value),s=nt(l),a.attrName=s,a.attrValue=i,a.keepAttr=!0,a.forceKeepAttr=void 0,yt("uponSanitizeAttribute",e,a),i=a.attrValue,!a.forceKeepAttr&&(mt(l,e),a.keepAttr))if(b(/\/>/i,i))mt(l,e);else{Ne&&(i=v(i,fe," "),i=v(i,ge," "));var u=nt(e.nodeName);if(bt(u,s,i))try{d?e.setAttributeNS(d,l,i):e.setAttribute(l,i),m(n.removed)}catch(e){}}}yt("afterSanitizeAttributes",e,null)}},xt=function e(t){var n=void 0,i=gt(t);for(yt("beforeSanitizeShadowDOM",t,null);n=i.nextNode();)yt("uponSanitizeShadowNode",n,null),_t(n)||(n.content instanceof o&&e(n.content),St(n));yt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,s){var r=void 0,a=void 0,l=void 0,d=void 0,u=void 0;if((Xe=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!vt(e)){if("function"!=typeof e.toString)throw w("toString is not a function");if("string"!=typeof(e=e.toString()))throw w("dirty is not a string, aborting")}if(!n.isSupported){if("object"===G(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(vt(e))return t.toStaticHTML(e.outerHTML)}return e}if(Ie||ot(s),n.removed=[],"string"==typeof e&&(Fe=!1),Fe){if(e.nodeName){var h=nt(e.nodeName);if(!we[h]||Ce[h])throw w("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)1===(a=(r=ft("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?r=a:r.appendChild(a);else{if(!Re&&!Ne&&!Oe&&-1===e.indexOf("<"))return se&&Le?se.createHTML(e):e;if(!(r=ft(e)))return Re?null:Le?re:""}r&&Me&&ht(r.firstChild);for(var m=gt(Fe?e:r);l=m.nextNode();)3===l.nodeType&&l===d||_t(l)||(l.content instanceof o&&xt(l.content),St(l),d=l);if(d=null,Fe)return e;if(Re){if(De)for(u=le.call(r.ownerDocument);r.firstChild;)u.appendChild(r.firstChild);else u=r;return xe.shadowroot&&(u=ue.call(i,u,!0)),u}var f=Oe?r.outerHTML:r.innerHTML;return Oe&&we["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&b(H,r.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+f),Ne&&(f=v(f,fe," "),f=v(f,ge," ")),se&&Le?se.createHTML(f):f},n.setConfig=function(e){ot(e),Ie=!0},n.clearConfig=function(){it=null,Ie=!1},n.isValidAttribute=function(e,t,n){it||ot({});var i=nt(e),s=nt(t);return bt(i,s,n)},n.addHook=function(e,t){"function"==typeof t&&(me[e]=me[e]||[],f(me[e],t))},n.removeHook=function(e){me[e]&&m(me[e])},n.removeHooks=function(e){me[e]&&(me[e]=[])},n.removeAllHooks=function(){me={}},n}()}()},5402:(e,t)=>{var n,i;i=function(e){"use strict";e=e||{};var t,n,i,s,r,o,a,c,l,d,u,h,m,f,g={bgColor:"#d00",textColor:"#fff",fontFamily:"sans-serif",fontStyle:"bold",type:"circle",position:"down",animation:"slide",elementId:!1,element:null,dataUrl:!1,win:window};(h={}).ff="undefined"!=typeof InstallTrigger,h.chrome=!!window.chrome,h.opera=!!window.opera||navigator.userAgent.indexOf("Opera")>=0,h.ie=!1,h.safari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,h.supported=h.chrome||h.ff||h.opera;var p=[];u=function(){},c=!1;var v={ready:function(){c=!0,v.reset(),u()},reset:function(){c&&(p=[],l=!1,d=!1,o.clearRect(0,0,s,i),o.drawImage(a,0,0,s,i),b.setIcon(r),window.clearTimeout(m),window.clearTimeout(void 0))},start:function(){if(c&&!d&&p.length>0){d=!0;var e=function(){["type","animation","bgColor","textColor","fontFamily","fontStyle"].forEach((function(e){e in p[0].options&&(t[e]=p[0].options[e])})),x.run(p[0].options,(function(){l=p[0],d=!1,p.length>0&&(p.shift(),v.start())}),!1)};l?x.run(l.options,(function(){e()}),!0):e()}}},y={},_=function(e){return e.n="number"==typeof e.n?Math.abs(0|e.n):e.n,e.x=s*e.x,e.y=i*e.y,e.w=s*e.w,e.h=i*e.h,e.len=(""+e.n).length,e};y.circle=function(e){var n=!1;2===(e=_(e)).len?(e.x=e.x-.4*e.w,e.w=1.4*e.w,n=!0):e.len>=3&&(e.x=e.x-.65*e.w,e.w=1.65*e.w,n=!0),o.clearRect(0,0,s,i),o.drawImage(a,0,0,s,i),o.beginPath(),o.font=t.fontStyle+" "+Math.floor(e.h*(e.n>99?.85:1))+"px "+t.fontFamily,o.textAlign="center",n?(o.moveTo(e.x+e.w/2,e.y),o.lineTo(e.x+e.w-e.h/2,e.y),o.quadraticCurveTo(e.x+e.w,e.y,e.x+e.w,e.y+e.h/2),o.lineTo(e.x+e.w,e.y+e.h-e.h/2),o.quadraticCurveTo(e.x+e.w,e.y+e.h,e.x+e.w-e.h/2,e.y+e.h),o.lineTo(e.x+e.h/2,e.y+e.h),o.quadraticCurveTo(e.x,e.y+e.h,e.x,e.y+e.h-e.h/2),o.lineTo(e.x,e.y+e.h/2),o.quadraticCurveTo(e.x,e.y,e.x+e.h/2,e.y)):o.arc(e.x+e.w/2,e.y+e.h/2,e.h/2,0,2*Math.PI),o.fillStyle="rgba("+t.bgColor.r+","+t.bgColor.g+","+t.bgColor.b+","+e.o+")",o.fill(),o.closePath(),o.beginPath(),o.stroke(),o.fillStyle="rgba("+t.textColor.r+","+t.textColor.g+","+t.textColor.b+","+e.o+")","number"==typeof e.n&&e.n>999?o.fillText((e.n>9999?9:Math.floor(e.n/1e3))+"k+",Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.2*e.h)):o.fillText(e.n,Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.15*e.h)),o.closePath()},y.rectangle=function(e){2===(e=_(e)).len?(e.x=e.x-.4*e.w,e.w=1.4*e.w):e.len>=3&&(e.x=e.x-.65*e.w,e.w=1.65*e.w),o.clearRect(0,0,s,i),o.drawImage(a,0,0,s,i),o.beginPath(),o.font=t.fontStyle+" "+Math.floor(e.h*(e.n>99?.9:1))+"px "+t.fontFamily,o.textAlign="center",o.fillStyle="rgba("+t.bgColor.r+","+t.bgColor.g+","+t.bgColor.b+","+e.o+")",o.fillRect(e.x,e.y,e.w,e.h),o.fillStyle="rgba("+t.textColor.r+","+t.textColor.g+","+t.textColor.b+","+e.o+")","number"==typeof e.n&&e.n>999?o.fillText((e.n>9999?9:Math.floor(e.n/1e3))+"k+",Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.2*e.h)):o.fillText(e.n,Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.15*e.h)),o.closePath()};var b={};function w(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,i){return t+t+n+n+i+i}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return!!t&&{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}}function S(e,t){var n,i={};for(n in e)i[n]=e[n];for(n in t)i[n]=t[n];return i}b.getIcons=function(){var e=[];return t.element?e=[t.element]:t.elementId?(e=[f.getElementById(t.elementId)])[0].setAttribute("href",e[0].getAttribute("src")):0===(e=function(){for(var e=[],t=f.getElementsByTagName("head")[0].getElementsByTagName("link"),n=0;n<t.length;n++)/(^|\s)icon(\s|$)/i.test(t[n].getAttribute("rel"))&&e.push(t[n]);return e}()).length&&((e=[f.createElement("link")])[0].setAttribute("rel","icon"),f.getElementsByTagName("head")[0].appendChild(e[0])),e.forEach((function(e){e.setAttribute("type","image/png")})),e},b.setIcon=function(e){var t=e.toDataURL("image/png");b.setIconSrc(t)},b.setIconSrc=function(e){if(t.dataUrl&&t.dataUrl(e),t.element)t.element.setAttribute("href",e),t.element.setAttribute("src",e);else if(t.elementId){var i=f.getElementById(t.elementId);i.setAttribute("href",e),i.setAttribute("src",e)}else if(h.ff||h.opera){var s=n[n.length-1],r=f.createElement("link");n=[r],h.opera&&r.setAttribute("rel","icon"),r.setAttribute("rel","icon"),r.setAttribute("type","image/png"),f.getElementsByTagName("head")[0].appendChild(r),r.setAttribute("href",e),s.parentNode&&s.parentNode.removeChild(s)}else n.forEach((function(t){t.setAttribute("href",e)}))};var x={duration:40,types:{}};return x.types.fade=[{x:.4,y:.4,w:.6,h:.6,o:0},{x:.4,y:.4,w:.6,h:.6,o:.1},{x:.4,y:.4,w:.6,h:.6,o:.2},{x:.4,y:.4,w:.6,h:.6,o:.3},{x:.4,y:.4,w:.6,h:.6,o:.4},{x:.4,y:.4,w:.6,h:.6,o:.5},{x:.4,y:.4,w:.6,h:.6,o:.6},{x:.4,y:.4,w:.6,h:.6,o:.7},{x:.4,y:.4,w:.6,h:.6,o:.8},{x:.4,y:.4,w:.6,h:.6,o:.9},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.none=[{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.pop=[{x:1,y:1,w:0,h:0,o:1},{x:.9,y:.9,w:.1,h:.1,o:1},{x:.8,y:.8,w:.2,h:.2,o:1},{x:.7,y:.7,w:.3,h:.3,o:1},{x:.6,y:.6,w:.4,h:.4,o:1},{x:.5,y:.5,w:.5,h:.5,o:1},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.popFade=[{x:.75,y:.75,w:0,h:0,o:0},{x:.65,y:.65,w:.1,h:.1,o:.2},{x:.6,y:.6,w:.2,h:.2,o:.4},{x:.55,y:.55,w:.3,h:.3,o:.6},{x:.5,y:.5,w:.4,h:.4,o:.8},{x:.45,y:.45,w:.5,h:.5,o:.9},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.slide=[{x:.4,y:1,w:.6,h:.6,o:1},{x:.4,y:.9,w:.6,h:.6,o:1},{x:.4,y:.9,w:.6,h:.6,o:1},{x:.4,y:.8,w:.6,h:.6,o:1},{x:.4,y:.7,w:.6,h:.6,o:1},{x:.4,y:.6,w:.6,h:.6,o:1},{x:.4,y:.5,w:.6,h:.6,o:1},{x:.4,y:.4,w:.6,h:.6,o:1}],x.run=function(e,n,i,s){var o=x.types[f.hidden||f.msHidden||f.webkitHidden||f.mozHidden?"none":t.animation];s=!0===i?void 0!==s?s:o.length-1:void 0!==s?s:0,n=n||function(){},s<o.length&&s>=0?(y[t.type](S(e,o[s])),m=setTimeout((function(){i?s-=1:s+=1,x.run(e,n,i,s)}),x.duration),b.setIcon(r)):n()},function(){(t=S(g,e)).bgColor=w(t.bgColor),t.textColor=w(t.textColor),t.position=t.position.toLowerCase(),t.animation=x.types[""+t.animation]?t.animation:g.animation,f=t.win.document;var c=t.position.indexOf("up")>-1,l=t.position.indexOf("left")>-1;if(c||l)for(var d in x.types)for(var u=0;u<x.types[d].length;u++){var h=x.types[d][u];c&&(h.y<.6?h.y=h.y-.4:h.y=h.y-2*h.y+(1-h.w)),l&&(h.x<.6?h.x=h.x-.4:h.x=h.x-2*h.x+(1-h.h)),x.types[d][u]=h}t.type=y[""+t.type]?t.type:g.type,n=b.getIcons(),r=document.createElement("canvas"),a=document.createElement("img");var m=n[n.length-1];m.hasAttribute("href")?(a.setAttribute("crossOrigin","anonymous"),a.onload=function(){i=a.height>0?a.height:32,s=a.width>0?a.width:32,r.height=i,r.width=s,o=r.getContext("2d"),v.ready()},a.setAttribute("src",m.getAttribute("href"))):(i=32,s=32,a.height=i,a.width=s,r.height=i,r.width=s,o=r.getContext("2d"),v.ready())}(),{badge:function(e,t){t=("string"==typeof t?{animation:t}:t)||{},u=function(){try{if("number"==typeof e?e>0:""!==e){var n={type:"badge",options:{n:e}};if("animation"in t&&x.types[""+t.animation]&&(n.options.animation=""+t.animation),"type"in t&&y[""+t.type]&&(n.options.type=""+t.type),["bgColor","textColor"].forEach((function(e){e in t&&(n.options[e]=w(t[e]))})),["fontStyle","fontFamily"].forEach((function(e){e in t&&(n.options[e]=t[e])})),p.push(n),p.length>100)throw new Error("Too many badges requests in queue.");v.start()}else v.reset()}catch(e){throw new Error("Error setting badge. Message: "+e.message)}},c&&u()},setOpt:function(e,n){var i=e;null==n&&"[object Object]"==Object.prototype.toString.call(e)||((i={})[e]=n);for(var s=Object.keys(i),r=0;r<s.length;r++)"bgColor"==s[r]||"textColor"==s[r]?t[s[r]]=w(i[s[r]]):t[s[r]]=i[s[r]];p.push(l),v.start()},reset:v.reset,browser:{supported:h.supported}}},void 0===(n=function(){return i}.apply(t,[]))||(e.exports=n)},1210:function(e){e.exports=function(){"use strict";var e=/^(b|B)$/,t={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},n={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},i={floor:Math.floor,ceil:Math.ceil};function s(s){var r,o,a,c,l,d,u,h,m,f,g,p,v,y,_,b,w,S,x,E,A,C=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},T=[],k=0;if(isNaN(s))throw new TypeError("Invalid number");if(a=!0===C.bits,_=!0===C.unix,p=!0===C.pad,o=C.base||2,v=void 0!==C.round?C.round:_?1:2,u=void 0!==C.locale?C.locale:"",h=C.localeOptions||{},b=void 0!==C.separator?C.separator:"",w=void 0!==C.spacer?C.spacer:_?"":" ",x=C.symbols||{},S=2===o&&C.standard||"jedec",g=C.output||"string",l=!0===C.fullform,d=C.fullforms instanceof Array?C.fullforms:[],r=void 0!==C.exponent?C.exponent:-1,E=i[C.roundingMethod]||Math.round,m=(f=Number(s))<0,c=o>2?1e3:1024,A=!1===isNaN(C.precision)?parseInt(C.precision,10):0,m&&(f=-f),(-1===r||isNaN(r))&&(r=Math.floor(Math.log(f)/Math.log(c)))<0&&(r=0),r>8&&(A>0&&(A+=8-r),r=8),"exponent"===g)return r;if(0===f)T[0]=0,y=T[1]=_?"":t[S][a?"bits":"bytes"][r];else{k=f/(2===o?Math.pow(2,10*r):Math.pow(1e3,r)),a&&(k*=8)>=c&&r<8&&(k/=c,r++);var j=Math.pow(10,r>0?v:0);T[0]=E(k*j)/j,T[0]===c&&r<8&&void 0===C.exponent&&(T[0]=1,r++),y=T[1]=10===o&&1===r?a?"kb":"kB":t[S][a?"bits":"bytes"][r],_&&(T[1]="jedec"===S?T[1].charAt(0):r>0?T[1].replace(/B$/,""):T[1],e.test(T[1])&&(T[0]=Math.floor(T[0]),T[1]=""))}if(m&&(T[0]=-T[0]),A>0&&(T[0]=T[0].toPrecision(A)),T[1]=x[T[1]]||T[1],!0===u?T[0]=T[0].toLocaleString():u.length>0?T[0]=T[0].toLocaleString(u,h):b.length>0&&(T[0]=T[0].toString().replace(".",b)),p&&!1===Number.isInteger(T[0])&&v>0){var $=b||".",N=T[0].toString().split($),O=N[1]||"",I=O.length,M=v-I;T[0]="".concat(N[0]).concat($).concat(O.padEnd(I+M,"0"))}return l&&(T[1]=d[r]?d[r]:n[S][r]+(a?"bit":"byte")+(1===T[0]?"":"s")),"array"===g?T:"object"===g?{value:T[0],symbol:T[1],exponent:r,unit:y}:T.join(w)}return s.partial=function(e){return function(t){return s(t,e)}},s}()},1971:(e,t,n)=>{"use strict";var i,s,r=n.g.MutationObserver||n.g.WebKitMutationObserver;if(r){var o=0,a=new r(u),c=n.g.document.createTextNode("");a.observe(c,{characterData:!0}),i=function(){c.data=o=++o%2}}else if(n.g.setImmediate||void 0===n.g.MessageChannel)i="document"in n.g&&"onreadystatechange"in n.g.document.createElement("script")?function(){var e=n.g.document.createElement("script");e.onreadystatechange=function(){u(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},n.g.document.documentElement.appendChild(e)}:function(){setTimeout(u,0)};else{var l=new n.g.MessageChannel;l.port1.onmessage=u,i=function(){l.port2.postMessage(0)}}var d=[];function u(){var e,t;s=!0;for(var n=d.length;n;){for(t=d,d=[],e=-1;++e<n;)t[e]();n=d.length}s=!1}e.exports=function(e){1!==d.push(e)||s||i()}},6066:function(e,t){!function(n,i){var s=Array.prototype,r=Object.prototype,o=s.slice,a=r.hasOwnProperty,c=s.forEach,l={},d={forEach:function(e,t,n){var i,s,r;if(null!==e)if(c&&e.forEach===c)e.forEach(t,n);else if(e.length===+e.length){for(i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===l)return}else for(r in e)if(a.call(e,r)&&t.call(n,e[r],r,e)===l)return},extend:function(e){return this.forEach(o.call(arguments,1),(function(t){for(var n in t)e[n]=t[n]})),e}},u=function(e){if(this.defaults={locale_data:{messages:{"":{domain:"messages",lang:"en",plural_forms:"nplurals=2; plural=(n != 1);"}}},domain:"messages",debug:!1},this.options=d.extend({},this.defaults,e),this.textdomain(this.options.domain),e.domain&&!this.options.locale_data[this.options.domain])throw new Error("Text domain set to non-existent domain: `"+e.domain+"`")};function h(e){return u.PF.compile(e||"nplurals=2; plural=(n != 1);")}function m(e,t){this._key=e,this._i18n=t}u.context_delimiter=String.fromCharCode(4),d.extend(m.prototype,{onDomain:function(e){return this._domain=e,this},withContext:function(e){return this._context=e,this},ifPlural:function(e,t){return this._val=e,this._pkey=t,this},fetch:function(e){return"[object Array]"!={}.toString.call(e)&&(e=[].slice.call(arguments,0)),(e&&e.length?u.sprintf:function(e){return e})(this._i18n.dcnpgettext(this._domain,this._context,this._key,this._pkey,this._val),e)}}),d.extend(u.prototype,{translate:function(e){return new m(e,this)},textdomain:function(e){if(!e)return this._textdomain;this._textdomain=e},gettext:function(e){return this.dcnpgettext.call(this,i,i,e)},dgettext:function(e,t){return this.dcnpgettext.call(this,e,i,t)},dcgettext:function(e,t){return this.dcnpgettext.call(this,e,i,t)},ngettext:function(e,t,n){return this.dcnpgettext.call(this,i,i,e,t,n)},dngettext:function(e,t,n,s){return this.dcnpgettext.call(this,e,i,t,n,s)},dcngettext:function(e,t,n,s){return this.dcnpgettext.call(this,e,i,t,n,s)},pgettext:function(e,t){return this.dcnpgettext.call(this,i,e,t)},dpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},dcpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},npgettext:function(e,t,n,s){return this.dcnpgettext.call(this,i,e,t,n,s)},dnpgettext:function(e,t,n,i,s){return this.dcnpgettext.call(this,e,t,n,i,s)},dcnpgettext:function(e,t,n,i,s){var r;if(i=i||n,e=e||this._textdomain,!this.options)return(r=new u).dcnpgettext.call(r,void 0,void 0,n,i,s);if(!this.options.locale_data)throw new Error("No locale data provided.");if(!this.options.locale_data[e])throw new Error("Domain `"+e+"` was not found.");if(!this.options.locale_data[e][""])throw new Error("No locale meta information provided.");if(!n)throw new Error("No translation key found.");var o,a,c,l=t?t+u.context_delimiter+n:n,d=this.options.locale_data,m=d[e],f=(d.messages||this.defaults.locale_data.messages)[""],g=m[""].plural_forms||m[""]["Plural-Forms"]||m[""]["plural-forms"]||f.plural_forms||f["Plural-Forms"]||f["plural-forms"];if(void 0===s)c=0;else{if("number"!=typeof s&&(s=parseInt(s,10),isNaN(s)))throw new Error("The number that was passed in is not a number.");c=h(g)(s)}if(!m)throw new Error("No domain named `"+e+"` could be found.");return!(o=m[l])||c>o.length?(this.options.missing_key_callback&&this.options.missing_key_callback(l,e),a=[n,i],!0===this.options.debug&&console.log(a[h(g)(s)]),a[h()(s)]):(a=o[c])||(a=[n,i])[h()(s)]}});var f,g=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function t(e,t){for(var n=[];t>0;n[--t]=e);return n.join("")}var n=function(){return n.cache.hasOwnProperty(arguments[0])||(n.cache[arguments[0]]=n.parse(arguments[0])),n.format.call(null,n.cache[arguments[0]],arguments)};return n.format=function(n,i){var s,r,o,a,c,l,d,u=1,h=n.length,m="",f=[];for(r=0;r<h;r++)if("string"===(m=e(n[r])))f.push(n[r]);else if("array"===m){if((a=n[r])[2])for(s=i[u],o=0;o<a[2].length;o++){if(!s.hasOwnProperty(a[2][o]))throw g('[sprintf] property "%s" does not exist',a[2][o]);s=s[a[2][o]]}else s=a[1]?i[a[1]]:i[u++];if(/[^s]/.test(a[8])&&"number"!=e(s))throw g("[sprintf] expecting number but found %s",e(s));switch(null==s&&(s=""),a[8]){case"b":s=s.toString(2);break;case"c":s=String.fromCharCode(s);break;case"d":s=parseInt(s,10);break;case"e":s=a[7]?s.toExponential(a[7]):s.toExponential();break;case"f":s=a[7]?parseFloat(s).toFixed(a[7]):parseFloat(s);break;case"o":s=s.toString(8);break;case"s":s=(s=String(s))&&a[7]?s.substring(0,a[7]):s;break;case"u":s=Math.abs(s);break;case"x":s=s.toString(16);break;case"X":s=s.toString(16).toUpperCase()}s=/[def]/.test(a[8])&&a[3]&&s>=0?"+"+s:s,l=a[4]?"0"==a[4]?"0":a[4].charAt(1):" ",d=a[6]-String(s).length,c=a[6]?t(l,d):"",f.push(a[5]?s+c:c+s)}return f.join("")},n.cache={},n.parse=function(e){for(var t=e,n=[],i=[],s=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))i.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))i.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw"[sprintf] huh?";if(n[2]){s|=1;var r=[],o=n[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(o)))throw"[sprintf] huh?";for(r.push(a[1]);""!==(o=o.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(o)))r.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(o)))throw"[sprintf] huh?";r.push(a[1])}n[2]=r}else s|=2;if(3===s)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";i.push(n)}t=t.substring(n[0].length)}return i},n}(),p=function(e,t){return t.unshift(e),g.apply(null,t)};u.parse_plural=function(e,t){return e=e.replace(/n/g,t),u.parse_expression(e)},u.sprintf=function(e,t){return"[object Array]"=={}.toString.call(t)?p(e,[].slice.call(t)):g.apply(this,[].slice.call(arguments))},u.prototype.sprintf=function(){return u.sprintf.apply(this,arguments)},(u.PF={}).parse=function(e){var t=u.PF.extractPluralExpr(e);return u.PF.parser.parse.call(u.PF.parser,t)},u.PF.compile=function(e){var t=u.PF.parse(e);return function(e){return!0===(n=u.PF.interpreter(t)(e))?1:n||0;var n}},u.PF.interpreter=function(e){return function(t){switch(e.type){case"GROUP":return u.PF.interpreter(e.expr)(t);case"TERNARY":return u.PF.interpreter(e.expr)(t)?u.PF.interpreter(e.truthy)(t):u.PF.interpreter(e.falsey)(t);case"OR":return u.PF.interpreter(e.left)(t)||u.PF.interpreter(e.right)(t);case"AND":return u.PF.interpreter(e.left)(t)&&u.PF.interpreter(e.right)(t);case"LT":return u.PF.interpreter(e.left)(t)<u.PF.interpreter(e.right)(t);case"GT":return u.PF.interpreter(e.left)(t)>u.PF.interpreter(e.right)(t);case"LTE":return u.PF.interpreter(e.left)(t)<=u.PF.interpreter(e.right)(t);case"GTE":return u.PF.interpreter(e.left)(t)>=u.PF.interpreter(e.right)(t);case"EQ":return u.PF.interpreter(e.left)(t)==u.PF.interpreter(e.right)(t);case"NEQ":return u.PF.interpreter(e.left)(t)!=u.PF.interpreter(e.right)(t);case"MOD":return u.PF.interpreter(e.left)(t)%u.PF.interpreter(e.right)(t);case"VAR":return t;case"NUM":return e.val;default:throw new Error("Invalid Token found.")}}},u.PF.extractPluralExpr=function(e){e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),/;\s*$/.test(e)||(e=e.concat(";"));var t,n=/nplurals\=(\d+);/,i=e.match(n);if(!(i.length>1))throw new Error("nplurals not found in plural_forms string: "+e);if(i[1],!((t=(e=e.replace(n,"")).match(/plural\=(.*);/))&&t.length>1))throw new Error("`plural` expression not found: "+e);return t[1]},u.PF.parser=((f={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,n:19,NUMBER:20,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"},productions_:[0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],performAction:function(e,t,n,i,s,r,o){var a=r.length-1;switch(s){case 1:return{type:"GROUP",expr:r[a-1]};case 2:this.$={type:"TERNARY",expr:r[a-4],truthy:r[a-2],falsey:r[a]};break;case 3:this.$={type:"OR",left:r[a-2],right:r[a]};break;case 4:this.$={type:"AND",left:r[a-2],right:r[a]};break;case 5:this.$={type:"LT",left:r[a-2],right:r[a]};break;case 6:this.$={type:"LTE",left:r[a-2],right:r[a]};break;case 7:this.$={type:"GT",left:r[a-2],right:r[a]};break;case 8:this.$={type:"GTE",left:r[a-2],right:r[a]};break;case 9:this.$={type:"NEQ",left:r[a-2],right:r[a]};break;case 10:this.$={type:"EQ",left:r[a-2],right:r[a]};break;case 11:this.$={type:"MOD",left:r[a-2],right:r[a]};break;case 12:this.$={type:"GROUP",expr:r[a-1]};break;case 13:this.$={type:"VAR"};break;case 14:this.$={type:"NUM",val:Number(e)}}},table:[{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],defaultActions:{6:[2,1]},parseError:function(e,t){throw new Error(e)},parse:function(e){var t=this,n=[0],i=[null],s=[],r=this.table,o="",a=0,c=0,l=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var d=this.lexer.yylloc;function u(){var e;return"number"!=typeof(e=t.lexer.lex()||1)&&(e=t.symbols_[e]||e),e}s.push(d),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var h,m,f,g,p,v,y,_,b,w={};;){if(f=n[n.length-1],this.defaultActions[f]?g=this.defaultActions[f]:(null==h&&(h=u()),g=r[f]&&r[f][h]),void 0===g||!g.length||!g[0]){if(!l){for(v in b=[],r[f])this.terminals_[v]&&v>2&&b.push("'"+this.terminals_[v]+"'");var S="";S=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+b.join(", ")+", got '"+this.terminals_[h]+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==h?"end of input":"'"+(this.terminals_[h]||h)+"'"),this.parseError(S,{text:this.lexer.match,token:this.terminals_[h]||h,line:this.lexer.yylineno,loc:d,expected:b})}if(3==l){if(1==h)throw new Error(S||"Parsing halted.");c=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,d=this.lexer.yylloc,h=u()}for(;!(2..toString()in r[f]);){if(0==f)throw new Error(S||"Parsing halted.");1,n.length=n.length-2,i.length=i.length-1,s.length=s.length-1,f=n[n.length-1]}m=h,h=2,g=r[f=n[n.length-1]]&&r[f][2],l=3}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+f+", token: "+h);switch(g[0]){case 1:n.push(h),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),n.push(g[1]),h=null,m?(h=m,m=null):(c=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,d=this.lexer.yylloc,l>0&&l--);break;case 2:if(y=this.productions_[g[1]][1],w.$=i[i.length-y],w._$={first_line:s[s.length-(y||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(y||1)].first_column,last_column:s[s.length-1].last_column},void 0!==(p=this.performAction.call(w,o,c,a,this.yy,g[1],i,s)))return p;y&&(n=n.slice(0,-1*y*2),i=i.slice(0,-1*y),s=s.slice(0,-1*y)),n.push(this.productions_[g[1]][0]),i.push(w.$),s.push(w._$),_=r[n[n.length-2]][n[n.length-1]],n.push(_);break;case 3:return!0}}return!0}}).lexer={EOF:1,parseError:function(e,t){if(!this.yy.parseError)throw new Error(e);this.yy.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e,e.match(/\n/)&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;var e,t;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),i=0;i<n.length;i++)if(e=this._input.match(this.rules[n[i]]))return(t=e[0].match(/\n.*/g))&&(this.yylineno+=t.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:t?t[t.length-1].length-1:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],this.performAction.call(this,this.yy,this,n[i],this.conditionStack[this.conditionStack.length-1])||void 0;if(""===this._input)return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)},performAction:function(e,t,n,i){switch(n){case 0:break;case 1:return 20;case 2:return 19;case 3:return 8;case 4:return 9;case 5:return 6;case 6:return 7;case 7:return 11;case 8:return 13;case 9:return 10;case 10:return 12;case 11:return 14;case 12:return 15;case 13:return 16;case 14:return 17;case 15:return 18;case 16:return 5;case 17:return"INVALID"}},rules:[/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^</,/^>/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],inclusive:!0}}},f),e.exports&&(t=e.exports=u),t.Jed=u}()},83:(e,t,n)=>{"use strict";var i=n(1971);function s(){}var r={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==s&&m(this,e)}function d(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){i((function(){var i;try{i=t(n)}catch(t){return r.reject(e,t)}i===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,i)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function m(e,t){var n=!1;function i(t){n||(n=!0,r.reject(e,t))}function s(t){n||(n=!0,r.resolve(e,t))}var o=f((function(){t(s,i)}));"error"===o.status&&i(o.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}e.exports=l,l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(s);return this.state!==c?u(n,this.state===a?e:t,this.outcome):this.queue.push(new d(n,e,t)),n},d.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){r.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},r.resolve=function(e,t){var n=f(h,t);if("error"===n.status)return r.reject(e,n.value);var i=n.value;if(i)m(e,i);else{e.state=a,e.outcome=t;for(var s=-1,o=e.queue.length;++s<o;)e.queue[s].callFulfilled(t)}return e},r.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:r.resolve(new this(s),e)},l.reject=function(e){var t=new this(s);return r.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,c=-1,l=new this(s);++c<n;)d(e[c],c);return l;function d(e,s){t.resolve(e).then((function(e){o[s]=e,++a!==n||i||(i=!0,r.resolve(l,o))}),(function(e){i||(i=!0,r.reject(l,e))}))}},l.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,n=!1;if(!t)return this.resolve([]);for(var i,o=-1,a=new this(s);++o<t;)i=e[o],this.resolve(i).then((function(e){n||(n=!0,r.resolve(a,e))}),(function(e){n||(n=!0,r.reject(a,e))}));return a}},5803:(e,t,n)=>{"use strict";"function"!=typeof n.g.Promise&&(n.g.Promise=n(83))},5533:function(e,t){"undefined"!=typeof self&&self,function(e){"use strict";var t=/^~~local_forage_type~([^~]+)~/,n="__lfsc__:".length,i=n+"arbf".length,s=Object.prototype.toString;function r(e){var t=.75*e.length,n=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var i=new ArrayBuffer(t),s=new Uint8Array(i),r=0,o=0;r<n;r+=4){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[r]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[r+1]),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[r+2]),d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[r+3]);s[o++]=a<<2|c>>4,s[o++]=(15&c)<<4|l>>2,s[o++]=(3&l)<<6|63&d}return i}function o(e){for(var t=new Uint8Array(e),n="",i=0;i<t.length;i+=3)n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[i]>>2],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[i])<<4|t[i+1]>>4],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[i+1])<<2|t[i+2]>>6],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[i+2]];return t.length%3==2?n=n.substring(0,n.length-1)+"=":t.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function a(e){var t,n;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var i=e instanceof Date?new Date(e):e.constructor();try{for(var s=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(Object.keys(e)),r=s.next();!r.done;r=s.next()){var o=r.value;Object.prototype.hasOwnProperty.call(e,o)&&(e.isActiveClone=null,i[o]=a(e[o]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i}function c(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function l(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function d(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function u(e,t){var n=this;if(t=d.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var i=this.config();e.name=e.name||i.name,e.storeName=e.storeName||i.storeName}return{promise:e.name?new Promise((function(t){e.storeName?t(c(e,n._defaultConfig)):t(e.name+"/")})):Promise.reject("Invalid arguments"),callback:t}}function h(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var m={bufferToString:o,deserialize:function(e){if("__lfsc__:"!==e.substring(0,n))return JSON.parse(e);var s,o=e.substring(i),a=e.substring(n,i);if("blob"===a&&t.test(o)){var c=o.match(t);s=c[1],o=o.substring(c[0].length)}var l=r(o);switch(a){case"arbf":return l;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(s){if("TypeError"!==s.name)throw s;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}([l],{type:s});case"si08":return new Int8Array(l);case"ui08":return new Uint8Array(l);case"uic8":return new Uint8ClampedArray(l);case"si16":return new Int16Array(l);case"ur16":return new Uint16Array(l);case"si32":return new Int32Array(l);case"ui32":return new Uint32Array(l);case"fl32":return new Float32Array(l);case"fl64":return new Float64Array(l);default:throw new Error("Unkown type: "+a)}},serialize:function(e,t){var n="";if(e&&(n=s.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===s.call(e.buffer))){var i=void 0,r="__lfsc__:";e instanceof ArrayBuffer?(i=e,r+="arbf"):(i=e.buffer,"[object Int8Array]"===n?r+="si08":"[object Uint8Array]"===n?r+="ui08":"[object Uint8ClampedArray]"===n?r+="uic8":"[object Int16Array]"===n?r+="si16":"[object Uint16Array]"===n?r+="ur16":"[object Int32Array]"===n?r+="si32":"[object Uint32Array]"===n?r+="ui32":"[object Float32Array]"===n?r+="fl32":"[object Float64Array]"===n?r+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(r+o(i))}else if("[object Blob]"===n){var a=new FileReader;a.onload=function(){var n="~~local_forage_type~"+e.type+"~"+o(this.result);t("__lfsc__:blob"+n)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},stringToBuffer:r},f={},g=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return f[t]||(f[t]=new e(t)),f[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete f[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?a(e):{},n=c(t,this._defaultConfig),i=g.resolve(n);return this._dbInfo=t,this._dbInfo.serializer=m,this._dbInfo.keyPrefix=n,this._dbInfo.mStore=i,Promise.resolve()},e.clear=function(e){var t=this,n=this.ready().then((function(){t._dbInfo.mStore.clear()}));return l(n,e),n},e.dropInstance=function(e,t){var n=u.apply(this,arguments),i=n.promise,s=n.callback;return l(i.then((function(e){g.resolve(e).drop()})),s),i},e.getItem=function(e,t){var n=this;e=h(e);var i=this.ready().then((function(){var t=n._dbInfo.mStore.get(e);return null==t?null:n._dbInfo.serializer.deserialize(t)}));return l(i,t),i},e.iterate=function(e,t){var n=this,i=this.ready().then((function(){for(var t=n._dbInfo.mStore,i=t.keys(),s=0;s<i.length;s++){var r=t.get(i[s]);if(r&&(r=n._dbInfo.serializer.deserialize(r)),void 0!==(r=e(r,i[s],s+1)))return r}}));return l(i,t),i},e.key=function(e,t){var n=this,i=this.ready().then((function(){var t;try{void 0===(t=n._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t}));return l(i,t),i},e.keys=function(e){var t=this,n=this.ready().then((function(){return t._dbInfo.mStore.keys()}));return l(n,e),n},e.length=function(e){var t=this.keys().then((function(e){return e.length}));return l(t,e),t},e.removeItem=function(e,t){var n=this;e=h(e);var i=this.ready().then((function(){n._dbInfo.mStore.rm(e)}));return l(i,t),i},e.setItem=function(e,t,n){var i=this;e=h(e);var s=this.ready().then((function(){void 0===t&&(t=null);var n=t;return new Promise((function(s,r){i._dbInfo.serializer.serialize(t,(function(t,o){if(o)r(o);else try{i._dbInfo.mStore.set(e,t),s(n)}catch(e){r(e)}}))}))}));return l(s,n),s},Object.defineProperty(e,"__esModule",{value:!0})}(t)},4718:function(e,t,n){!function(e,t){"use strict";function n(e){return n.result?n.result:e&&"function"==typeof e.getSerializer?(n.result=e.getSerializer(),n.result):Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!"))}function i(e,t){return t&&e.then((function(e){t(null,e)}),(function(e){t(e)})),e}function s(e,t){var n=this.getItem(e).then((function(t){return{key:e,value:t}}));return i(n,t),n}function r(e){var t=this;return new Promise((function(n,i){for(var r=[],o=0,a=e.length;o<a;o++)r.push(s.call(t,e[o]));Promise.all(r).then((function(e){for(var t={},i=0,s=e.length;i<s;i++){var r=e[i];t[r.key]=r.value}n(t)})).catch(i)}))}function o(){var e={};return this.iterate((function(t,n){e[n]=t})).then((function(){return e}))}t="default"in t?t.default:t;var a="undefined"!=typeof IDBKeyRange?IDBKeyRange:"undefined"!=typeof webkitIDBKeyRange?webkitIDBKeyRange:"undefined"!=typeof mozIDBKeyRange?mozIDBKeyRange:void 0;function c(e){e=e.slice();var t=this;function n(e,t){return e<t?-1:e>t?1:0}return new Promise((function(i,s){t.ready().then((function(){var r,o=t._dbInfo,c=o.db.transaction(o.storeName,"readonly").objectStore(o.storeName),l=e.sort(n),d=a.bound(e[0],e[e.length-1],!1,!1);if("getAll"in c)(r=c.getAll(d)).onsuccess=function(){var e=r.result;void 0===e&&(e=null),i(e)};else{r=c.openCursor(d);var u={},h=0;r.onsuccess=function(){var e=r.result;if(e){for(var t=e.key;t>l[h];)if(++h===l.length)return void i(u);if(t===l[h]){var n=e.value;void 0===n&&(n=null),u[t]=n,e.continue()}else e.continue(l[h])}else i(u)}}r.onerror=function(){s(r.error)}})).catch(s)}))}function l(e){var t=this;return new Promise((function(i,s){t.ready().then((function(){return n(t)})).then((function(n){var r=t._dbInfo;r.db.transaction((function(t){for(var o=new Array(e.length),a=0,c=e.length;a<c;a++)o[a]="?";t.executeSql("SELECT * FROM "+r.storeName+" WHERE (key IN ("+o.join(",")+"))",e,(function(e,t){for(var s={},r=t.rows,o=0,a=r.length;o<a;o++){var c=r.item(o),l=c.value;l&&(l=n.deserialize(l)),s[c.key]=l}i(s)}),(function(e,t){s(t)}))}))})).catch(s)}))}function d(e,t){var n,s=this;if(arguments.length&&null!==e){var a=s.driver();n=a===s.INDEXEDDB?c.apply(s,arguments):a===s.WEBSQL?l.apply(s,arguments):r.apply(s,arguments)}else n=o.apply(s);return i(n,t),n}function u(e){var t=Object.getPrototypeOf(e);t&&(t.getItems=d,t.getItems.indexedDB=function(){return c.apply(this,arguments)},t.getItems.websql=function(){return l.apply(this,arguments)},t.getItems.generic=function(){return r.apply(this,arguments)})}var h=u(t);e.localforageGetItems=d,e.extendPrototype=u,e.extendPrototypeResult=h,e.getItemsGeneric=r,Object.defineProperty(e,"__esModule",{value:!0})}(t,n(3871))},8806:function(e,t,n){!function(e,t){"use strict";function n(e){return n.result?n.result:e&&"function"==typeof e.getSerializer?(n.result=e.getSerializer(),n.result):Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!"))}function i(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function s(e,t,n,i){function s(e,t){var n=e||t;return e&&"function"==typeof e||"string"!=typeof n||(e=function(e){return e[n]}),e}var r=[];if("[object Array]"===Object.prototype.toString.call(e)){t=s(t,"key"),n=s(n,"value");for(var o=0,a=e.length;o<a;o++){var c=e[o];r.push(i(t(c),n(c)))}}else for(var l in e)e.hasOwnProperty(l)&&r.push(i(l,e[l]));return r}function r(e,t,n,r){var o=this,a=o.ready().then((function(){return new Promise((function(i,r){var a,c=o._dbInfo,l=c.db.transaction(c.storeName,"readwrite"),d=l.objectStore(c.storeName);function u(e){var t=e.target||this;a=t.error||t.transaction.error,r(a)}l.oncomplete=function(){i(e)},l.onabort=l.onerror=function(e){r(a||e.target)},s(e,t,n,(function(e,t){null===t&&(t=void 0),d.put(t,e).onerror=u}))}))}));return i(a,r),a}function o(e,t,r,o){var a=this,c=new Promise((function(i,o){a.ready().then((function(){return n(a)})).then((function(n){var c=a._dbInfo;c.db.transaction((function(a){var l="INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",d=s(e,t,r,(function(e,t){return new Promise((function(i,s){n.serialize(t,(function(t,n){n?s(n):a.executeSql(l,[e,t],(function(){i()}),(function(e,t){s(t)}))}))}))}));Promise.all(d).then((function(){i(e)}),o)}),(function(e){o(e)}))})).catch(o)}));return i(c,o),c}function a(e,t,n,r){var o=this,a=s(e,t,n,(function(e,t){return o.setItem(e,t)})),c=Promise.all(a);return i(c,r),c}function c(e,t,n,i){var s=this,c=s.driver();return c===s.INDEXEDDB?r.call(s,e,t,n,i):c===s.WEBSQL?o.call(s,e,t,n,i):a.call(s,e,t,n,i)}function l(e){var t=Object.getPrototypeOf(e);t&&(t.setItems=c,t.setItems.indexedDB=function(){return r.apply(this,arguments)},t.setItems.websql=function(){return o.apply(this,arguments)},t.setItems.generic=function(){return a.apply(this,arguments)})}var d=l(t="default"in t?t.default:t);e.setItemsGeneric=a,e.localforageSetItems=c,e.extendPrototype=l,e.extendPrototypeResult=d,Object.defineProperty(e,"__esModule",{value:!0})}(t,n(3871))},6678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=l(n(8339)),s=l(n(5460)),r=l(n(8161)),o=l(n(1683)),a=l(n(9251));t.default=function(e,t){var n=(0,c.getStorage)(),l=!(!n||!n[t]),d=l?n[t]:{clear:function(){},get:function(){},remove:function(){},set:function(){}},u=d.clear.bind(d),h=d.get.bind(d),m=d.remove.bind(d),f=d.set.bind(d);return{_driver:e,_support:l,_initStorage:function(){return a.default.resolve()},clear:function(e){var t=this;return(0,o.default)(r.default.mark((function n(){return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:u(),e&&e();case 2:case"end":return t.stop()}}),n,t)})))()},iterate:function(e,t){var n=this;return(0,o.default)(r.default.mark((function i(){var o;return r.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,c.usePromise)(h,null);case 2:o=n.sent,(0,s.default)(o).forEach((function(t,n){return e(o[t],t,n)})),t&&t();case 6:case"end":return n.stop()}}),i,n)})))()},getItem:function(e,t){var n=this;return(0,o.default)(r.default.mark((function i(){var s;return r.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,(0,c.usePromise)(h,e);case 3:return s=n.sent,s=void 0===(s="string"==typeof e?s[e]:s)?null:s,t&&t(null,s),n.abrupt("return",s);case 10:throw n.prev=10,n.t0=n.catch(0),t&&t(n.t0),n.t0;case 14:case"end":return n.stop()}}),i,n,[[0,10]])})))()},key:function(e,t){var n=this;return(0,o.default)(r.default.mark((function i(){var o,a;return r.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,c.usePromise)(h,null);case 2:return o=n.sent,a=(0,s.default)(o)[e],t&&t(a),n.abrupt("return",a);case 6:case"end":return n.stop()}}),i,n)})))()},keys:function(e){var t=this;return(0,o.default)(r.default.mark((function n(){var i,o;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,c.usePromise)(h,null);case 2:return i=t.sent,o=(0,s.default)(i),e&&e(o),t.abrupt("return",o);case 6:case"end":return t.stop()}}),n,t)})))()},length:function(e){var t=this;return(0,o.default)(r.default.mark((function n(){var i,o;return r.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,c.usePromise)(h,null);case 2:return i=t.sent,o=(0,s.default)(i).length,e&&e(o),t.abrupt("return",o);case 6:case"end":return t.stop()}}),n,t)})))()},removeItem:function(e,t){var n=this;return(0,o.default)(r.default.mark((function i(){return r.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,c.usePromise)(m,e);case 2:t&&t();case 3:case"end":return n.stop()}}),i,n)})))()},setItem:function(e,t,n){var s=this;return(0,o.default)(r.default.mark((function o(){return r.default.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,(0,c.usePromise)(f,(0,i.default)({},e,t));case 2:n&&n();case 3:case"end":return s.stop()}}),o,s)})))()}}};var c=n(3203);function l(e){return e&&e.__esModule?e:{default:e}}},6916:(e,t,n)=>{"use strict";var i,s=(i=n(6678))&&i.__esModule?i:{default:i};t.Z=(0,s.default)("webExtensionLocalStorage","local")},7993:(e,t,n)=>{"use strict";var i,s=(i=n(6678))&&i.__esModule?i:{default:i};t.Z=(0,s.default)("webExtensionSyncStorage","sync")},3203:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,s=(i=n(9251))&&i.__esModule?i:{default:i};function r(){return window.browser&&browser.storage||window.chrome&&chrome.storage}t.getStorage=r,t.usePromise=function(e,t){return function(){var e=r();try{return e&&e.local.get&&e.local.get()&&"function"==typeof e.local.get().then}catch(e){return!1}}()?e(t):new s.default((function(n){e(t,(function(){n.apply(void 0,arguments)}))}))}},3871:(e,t,n)=>{e.exports=function e(t,n,i){function s(o,a){if(!n[o]){if(!t[o]){if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};t[o][0].call(l.exports,(function(e){return s(t[o][1][e]||e)}),l,l.exports,e,t,n,i)}return n[o].exports}for(var r=void 0,o=0;o<i.length;o++)s(i[o]);return s}({1:[function(e,t,i){(function(e){"use strict";var n,i,s=e.MutationObserver||e.WebKitMutationObserver;if(s){var r=0,o=new s(d),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=r=++r%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var c=new e.MessageChannel;c.port1.onmessage=d,n=function(){c.port2.postMessage(0)}}var l=[];function d(){var e,t;i=!0;for(var n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}i=!1}t.exports=function(e){1!==l.push(e)||i||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var i=e(1);function s(){}var r={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==s&&m(this,e)}function d(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){i((function(){var i;try{i=t(n)}catch(t){return r.reject(e,t)}i===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,i)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function m(e,t){var n=!1;function i(t){n||(n=!0,r.reject(e,t))}function s(t){n||(n=!0,r.resolve(e,t))}var o=f((function(){t(s,i)}));"error"===o.status&&i(o.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=l,l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(s);return this.state!==c?u(n,this.state===a?e:t,this.outcome):this.queue.push(new d(n,e,t)),n},d.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){r.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},r.resolve=function(e,t){var n=f(h,t);if("error"===n.status)return r.reject(e,n.value);var i=n.value;if(i)m(e,i);else{e.state=a,e.outcome=t;for(var s=-1,o=e.queue.length;++s<o;)e.queue[s].callFulfilled(t)}return e},r.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:r.resolve(new this(s),e)},l.reject=function(e){var t=new this(s);return r.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,c=-1,l=new this(s);++c<n;)d(e[c],c);return l;function d(e,s){t.resolve(e).then((function(e){o[s]=e,++a!==n||i||(i=!0,r.resolve(l,o))}),(function(e){i||(i=!0,r.reject(l,e))}))}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n,i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=-1,c=new this(s);++a<i;)n=e[a],t.resolve(n).then((function(e){o||(o=!0,r.resolve(c,e))}),(function(e){o||(o=!0,r.reject(c,e))}));return c}},{1:1}],3:[function(e,t,i){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var s=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function r(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(s){if("TypeError"!==s.name)throw s;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var o=Promise;function a(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function l(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function d(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var u="local-forage-detect-blob-support",h=void 0,m={},f=Object.prototype.toString,g="readonly",p="readwrite";function v(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=0;s<t;s++)i[s]=e.charCodeAt(s);return n}function y(e){return"boolean"==typeof h?o.resolve(h):function(e){return new o((function(t){var n=e.transaction(u,p),i=r([""]);n.objectStore(u).put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return h=e}))}function _(e){var t=m[e.name],n={};n.promise=new o((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function b(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var n=m[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function S(e,t){return new o((function(n,i){if(m[e.name]=m[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);_(e),e.db.close()}var r=[e.name];t&&r.push(e.version);var o=s.open.apply(s,r);t&&(o.onupgradeneeded=function(t){var n=o.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(u)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),i(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},n(t),b(e)}}))}function x(e){return S(e,!1)}function E(e){return S(e,!0)}function A(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,s=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),s||n){if(n){var r=e.db.version+1;r>e.version&&(e.version=r)}return!0}return!1}function C(e){return r([v(atob(e.data))],{type:e.type})}function T(e){return e&&e.__local_forage_encoded_blob}function k(e){var t=this,n=t._initReady().then((function(){var e=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(n,e,e),n}function j(e,t,n,i){void 0===i&&(i=1);try{var s=e.db.transaction(e.storeName,t);n(null,s)}catch(s){if(i>0&&(!e.db||"InvalidStateError"===s.name||"NotFoundError"===s.name))return o.resolve().then((function(){if(!e.db||"NotFoundError"===s.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),E(e)})).then((function(){return function(e){_(e);for(var t=m[e.name],n=t.forages,i=0;i<n.length;i++){var s=n[i];s._dbInfo.db&&(s._dbInfo.db.close(),s._dbInfo.db=null)}return e.db=null,x(e).then((function(t){return e.db=t,A(e)?E(e):t})).then((function(i){e.db=t.db=i;for(var s=0;s<n.length;s++)n[s]._dbInfo.db=i})).catch((function(t){throw w(e,t),t}))}(e).then((function(){j(e,t,n,i-1)}))})).catch(n);n(s)}}var $={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var s=m[n.name];s||(s={forages:[],db:null,dbReady:null,deferredOperations:[]},m[n.name]=s),s.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=k);var r=[];function a(){return o.resolve()}for(var c=0;c<s.forages.length;c++){var l=s.forages[c];l!==t&&r.push(l._initReady().catch(a))}var d=s.forages.slice(0);return o.all(r).then((function(){return n.db=s.db,x(n)})).then((function(e){return n.db=e,A(n,t._defaultConfig.version)?E(n):e})).then((function(e){n.db=s.db=e,t._dbInfo=n;for(var i=0;i<d.length;i++){var r=d[i];r!==t&&(r._dbInfo.db=n.db,r._dbInfo.version=n.version)}}))},_support:function(){try{if(!s||!s.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,i=new o((function(t,i){n.ready().then((function(){j(n._dbInfo,g,(function(s,r){if(s)return i(s);try{var o=r.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var i=n.value;T(i)&&(i=C(i));var s=e(i,n.key,a++);void 0!==s?t(s):n.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return a(i,t),i},getItem:function(e,t){var n=this;e=l(e);var i=new o((function(t,i){n.ready().then((function(){j(n._dbInfo,g,(function(s,r){if(s)return i(s);try{var o=r.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),T(e)&&(e=C(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return a(i,t),i},setItem:function(e,t,n){var i=this;e=l(e);var s=new o((function(n,s){var r;i.ready().then((function(){return r=i._dbInfo,"[object Blob]"===f.call(t)?y(r.db).then((function(e){return e?t:(n=t,new o((function(e,t){var i=new FileReader;i.onerror=t,i.onloadend=function(t){var i=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:i,type:n.type})},i.readAsBinaryString(n)})));var n})):t})).then((function(t){j(i._dbInfo,p,(function(r,o){if(r)return s(r);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var c=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=c.error?c.error:c.transaction.error;s(e)}}catch(e){s(e)}}))})).catch(s)}));return a(s,n),s},removeItem:function(e,t){var n=this;e=l(e);var i=new o((function(t,i){n.ready().then((function(){j(n._dbInfo,p,(function(s,r){if(s)return i(s);try{var o=r.objectStore(n._dbInfo.storeName).delete(e);r.oncomplete=function(){t()},r.onerror=function(){i(o.error)},r.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return a(i,t),i},clear:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){j(t._dbInfo,p,(function(i,s){if(i)return n(i);try{var r=s.objectStore(t._dbInfo.storeName).clear();s.oncomplete=function(){e()},s.onabort=s.onerror=function(){var e=r.error?r.error:r.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return a(n,e),n},length:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){j(t._dbInfo,g,(function(i,s){if(i)return n(i);try{var r=s.objectStore(t._dbInfo.storeName).count();r.onsuccess=function(){e(r.result)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,e),n},key:function(e,t){var n=this,i=new o((function(t,i){e<0?t(null):n.ready().then((function(){j(n._dbInfo,g,(function(s,r){if(s)return i(s);try{var o=r.objectStore(n._dbInfo.storeName),a=!1,c=o.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},c.onerror=function(){i(c.error)}}catch(e){i(e)}}))})).catch(i)}));return a(i,t),i},keys:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){j(t._dbInfo,g,(function(i,s){if(i)return n(i);try{var r=s.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];r.onsuccess=function(){var t=r.result;t?(o.push(t.key),t.continue()):e(o)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,e),n},dropInstance:function(e,t){t=d.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;if(e.name){var c=e.name===n.name&&r._dbInfo.db?o.resolve(r._dbInfo.db):x(e).then((function(t){var n=m[e.name],i=n.forages;n.db=t;for(var s=0;s<i.length;s++)i[s]._dbInfo.db=t;return t}));i=e.storeName?c.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;_(e);var i=m[e.name],r=i.forages;t.close();for(var a=0;a<r.length;a++){var c=r[a];c._dbInfo.db=null,c._dbInfo.version=n}var l=new o((function(t,i){var r=s.open(e.name,n);r.onerror=function(e){r.result.close(),i(e)},r.onupgradeneeded=function(){r.result.deleteObjectStore(e.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}}));return l.then((function(e){i.db=e;for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=e,b(n._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}})):c.then((function(t){_(e);var n=m[e.name],i=n.forages;t.close();for(var r=0;r<i.length;r++)i[r]._dbInfo.db=null;var a=new o((function(t,n){var i=s.deleteDatabase(e.name);i.onerror=function(){var e=i.result;e&&e.close(),n(i.error)},i.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}));return a.then((function(e){n.db=e;for(var t=0;t<i.length;t++)b(i[t]._dbInfo)})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}))}else i=o.reject("Invalid arguments");return a(i,t),i}};var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",O=/^~~local_forage_type~([^~]+)~/,I="__lfsc__:",M=I.length,R="arbf",D="blob",L="si08",z="ui08",P="uic8",F="si16",U="si32",B="ur16",q="ui32",H="fl32",G="fl64",W=M+R.length,V=Object.prototype.toString;function J(e){var t,n,i,s,r,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var l=new ArrayBuffer(o),d=new Uint8Array(l);for(t=0;t<a;t+=4)n=N.indexOf(e[t]),i=N.indexOf(e[t+1]),s=N.indexOf(e[t+2]),r=N.indexOf(e[t+3]),d[c++]=n<<2|i>>4,d[c++]=(15&i)<<4|s>>2,d[c++]=(3&s)<<6|63&r;return l}function Q(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=N[n[t]>>2],i+=N[(3&n[t])<<4|n[t+1]>>4],i+=N[(15&n[t+1])<<2|n[t+2]>>6],i+=N[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}var Z={serialize:function(e,t){var n="";if(e&&(n=V.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===V.call(e.buffer))){var i,s=I;e instanceof ArrayBuffer?(i=e,s+=R):(i=e.buffer,"[object Int8Array]"===n?s+=L:"[object Uint8Array]"===n?s+=z:"[object Uint8ClampedArray]"===n?s+=P:"[object Int16Array]"===n?s+=F:"[object Uint16Array]"===n?s+=B:"[object Int32Array]"===n?s+=U:"[object Uint32Array]"===n?s+=q:"[object Float32Array]"===n?s+=H:"[object Float64Array]"===n?s+=G:t(new Error("Failed to get type for BinaryArray"))),t(s+Q(i))}else if("[object Blob]"===n){var r=new FileReader;r.onload=function(){var n="~~local_forage_type~"+e.type+"~"+Q(this.result);t("__lfsc__:blob"+n)},r.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,M)!==I)return JSON.parse(e);var t,n=e.substring(W),i=e.substring(M,W);if(i===D&&O.test(n)){var s=n.match(O);t=s[1],n=n.substring(s[0].length)}var o=J(n);switch(i){case R:return o;case D:return r([o],{type:t});case L:return new Int8Array(o);case z:return new Uint8Array(o);case P:return new Uint8ClampedArray(o);case F:return new Int16Array(o);case B:return new Uint16Array(o);case U:return new Int32Array(o);case q:return new Uint32Array(o);case H:return new Float32Array(o);case G:return new Float64Array(o);default:throw new Error("Unkown type: "+i)}},stringToBuffer:J,bufferToString:Q};function Y(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function X(e,t,n,i,s,r){e.executeSql(n,i,s,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?r(e,o):Y(e,t,(function(){e.executeSql(n,i,s,r)}),r)}),r):r(e,o)}),r)}function K(e,t,n,i){var s=this;e=l(e);var r=new o((function(r,o){s.ready().then((function(){void 0===t&&(t=null);var a=t,c=s._dbInfo;c.serializer.serialize(t,(function(t,l){l?o(l):c.db.transaction((function(n){X(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){r(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void r(K.apply(s,[e,a,n,i-1]));o(t)}}))}))})).catch(o)}));return a(r,n),r}function ee(e){return new o((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var s=[],r=0;r<i.rows.length;r++)s.push(i.rows.item(r).name);t({db:e,storeNames:s})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}var te={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var s=new o((function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction((function(s){Y(s,n,(function(){t._dbInfo=n,e()}),(function(e,t){i(t)}))}),i)}));return n.serializer=Z,s},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,i=new o((function(t,i){n.ready().then((function(){var s=n._dbInfo;s.db.transaction((function(n){X(n,s,"SELECT * FROM "+s.storeName,[],(function(n,i){for(var r=i.rows,o=r.length,a=0;a<o;a++){var c=r.item(a),l=c.value;if(l&&(l=s.serializer.deserialize(l)),void 0!==(l=e(l,c.key,a+1)))return void t(l)}t()}),(function(e,t){i(t)}))}))})).catch(i)}));return a(i,t),i},getItem:function(e,t){var n=this;e=l(e);var i=new o((function(t,i){n.ready().then((function(){var s=n._dbInfo;s.db.transaction((function(n){X(n,s,"SELECT * FROM "+s.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=s.serializer.deserialize(i)),t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return a(i,t),i},setItem:function(e,t,n){return K.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=l(e);var i=new o((function(t,i){n.ready().then((function(){var s=n._dbInfo;s.db.transaction((function(n){X(n,s,"DELETE FROM "+s.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){i(t)}))}))})).catch(i)}));return a(i,t),i},clear:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){X(t,i,"DELETE FROM "+i.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,e),n},length:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){X(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],(function(t,n){var i=n.rows.item(0).c;e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,e),n},key:function(e,t){var n=this,i=new o((function(t,i){n.ready().then((function(){var s=n._dbInfo;s.db.transaction((function(n){X(n,s,"SELECT key FROM "+s.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var i=n.rows.length?n.rows.item(0).key:null;t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return a(i,t),i},keys:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){X(t,i,"SELECT key FROM "+i.storeName,[],(function(t,n){for(var i=[],s=0;s<n.rows.length;s++)i.push(n.rows.item(s).key);e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,e),n},dropInstance:function(e,t){t=d.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,s=this;return a(i=e.name?new o((function(t){var i;i=e.name===n.name?s._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(ee(i))})).then((function(e){return new o((function(t,n){e.db.transaction((function(i){function s(e){return new o((function(t,n){i.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var r=[],a=0,c=e.storeNames.length;a<c;a++)r.push(s(e.storeNames[a]));o.all(r).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):o.reject("Invalid arguments"),t),i}};function ne(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ie(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0}var se={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=ne(e,this._defaultConfig),ie()?(this._dbInfo=t,t.serializer=Z,o.resolve()):o.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,s=i.length,r=localStorage.length,o=1,a=0;a<r;a++){var c=localStorage.key(a);if(0===c.indexOf(i)){var l=localStorage.getItem(c);if(l&&(l=t.serializer.deserialize(l)),void 0!==(l=e(l,c.substring(s),o++)))return l}}}));return a(i,t),i},getItem:function(e,t){var n=this;e=l(e);var i=n.ready().then((function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return a(i,t),i},setItem:function(e,t,n){var i=this;e=l(e);var s=i.ready().then((function(){void 0===t&&(t=null);var n=t;return new o((function(s,r){var o=i._dbInfo;o.serializer.serialize(t,(function(t,i){if(i)r(i);else try{localStorage.setItem(o.keyPrefix+e,t),s(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||r(e),r(e)}}))}))}));return a(s,n),s},removeItem:function(e,t){var n=this;e=l(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return a(i,t),i},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return a(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return a(t,e),t},key:function(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return a(i,t),i},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],s=0;s<n;s++){var r=localStorage.key(s);0===r.indexOf(e.keyPrefix)&&i.push(r.substring(e.keyPrefix.length))}return i}));return a(n,e),n},dropInstance:function(e,t){if(t=d.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,s=this;return i=e.name?new o((function(t){e.storeName?t(ne(e,s._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):o.reject("Invalid arguments"),a(i,t),i}},re=function(e,t){for(var n=e.length,i=0;i<n;){if((s=e[i])===(r=t)||"number"==typeof s&&"number"==typeof r&&isNaN(s)&&isNaN(r))return!0;i++}var s,r;return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ae={},ce={},le={INDEXEDDB:$,WEBSQL:te,LOCALSTORAGE:se},de=[le.INDEXEDDB._driver,le.WEBSQL._driver,le.LOCALSTORAGE._driver],ue=["dropInstance"],he=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ue),me={description:"",driver:de.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function fe(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function ge(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(oe(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var pe=function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),le)if(le.hasOwnProperty(n)){var i=le[n],s=i._driver;this[n]=s,ae[s]||this.defineDriver(i)}this._defaultConfig=ge({},me),this._config=ge({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var 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},e.prototype.defineDriver=function(e,t,n){var i=new o((function(t,n){try{var i=e._driver,s=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(s);for(var r=he.concat("_initStorage"),c=0,l=r.length;c<l;c++){var d=r[c];if((!re(ue,d)||e[d])&&"function"!=typeof e[d])return void n(s)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=o.reject(t);return a(n,arguments[arguments.length-1]),n}},n=0,i=ue.length;n<i;n++){var s=ue[n];e[s]||(e[s]=t(s))}}();var u=function(n){ae[i]&&console.info("Redefining LocalForage driver: "+i),ae[i]=e,ce[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(u,n):u(!!e._support):u(!0)}catch(e){n(e)}}));return c(i,t,n),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var i=ae[e]?o.resolve(ae[e]):o.reject(new Error("Driver not found."));return c(i,t,n),i},e.prototype.getSerializer=function(e){var t=o.resolve(Z);return c(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return c(n,e,e),n},e.prototype.setDriver=function(e,t,n){var i=this;oe(e)||(e=[e]);var s=this._getSupportedDrivers(e);function r(){i._config.driver=i.driver()}function a(e){return i._extend(e),r(),i._ready=i._initStorage(i._config),i._ready}var l=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=l.then((function(){var e=s[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((function(e){i._driver=e._driver,r(),i._wrapLibraryMethodsWithReady(),i._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var s=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(s).then(a).catch(n)}r();var c=new Error("No available storage method found.");return i._driverSet=o.reject(c),i._driverSet}()}}(s)}))})).catch((function(){r();var e=new Error("No available storage method found.");return i._driverSet=o.reject(e),i._driverSet})),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ce[e]},e.prototype._extend=function(e){ge(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var s=e[n];this.supports(s)&&t.push(s)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=he.length;e<t;e++)fe(this,he[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),ve=new pe;t.exports=ve},{3:3}]},{},[4])(4)},1982:(e,t,n)=>{var i=n(9998).Symbol;e.exports=i},7703:(e,t,n)=>{var i=n(1982),s=n(4154),r=n(3994),o=i?i.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?s(e):r(e)}},6730:(e,t,n)=>{var i=n(3373),s=/^\s+/;e.exports=function(e){return e?e.slice(0,i(e)+1).replace(s,""):e}},7637:(e,t,n)=>{var i="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=i},4154:(e,t,n)=>{var i=n(1982),s=Object.prototype,r=s.hasOwnProperty,o=s.toString,a=i?i.toStringTag:void 0;e.exports=function(e){var t=r.call(e,a),n=e[a];try{e[a]=void 0;var i=!0}catch(e){}var s=o.call(e);return i&&(t?e[a]=n:delete e[a]),s}},3994:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9998:(e,t,n)=>{var i=n(7637),s="object"==typeof self&&self&&self.Object===Object&&self,r=i||s||Function("return this")();e.exports=r},3373:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},7272:(e,t,n)=>{var i=n(9910),s=n(4522),r=n(2672),o=Math.max,a=Math.min;e.exports=function(e,t,n){var c,l,d,u,h,m,f=0,g=!1,p=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,i=l;return c=l=void 0,f=t,u=e.apply(i,n)}function _(e){return f=e,h=setTimeout(w,t),g?y(e):u}function b(e){var n=e-m;return void 0===m||n>=t||n<0||p&&e-f>=d}function w(){var e=s();if(b(e))return S(e);h=setTimeout(w,function(e){var n=t-(e-m);return p?a(n,d-(e-f)):n}(e))}function S(e){return h=void 0,v&&c?y(e):(c=l=void 0,u)}function x(){var e=s(),n=b(e);if(c=arguments,l=this,m=e,n){if(void 0===h)return _(m);if(p)return clearTimeout(h),h=setTimeout(w,t),y(m)}return void 0===h&&(h=setTimeout(w,t)),u}return t=r(t)||0,i(n)&&(g=!!n.leading,d=(p="maxWait"in n)?o(r(n.maxWait)||0,t):d,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==h&&clearTimeout(h),f=0,c=m=l=h=void 0},x.flush=function(){return void 0===h?u:S(s())},x}},9910:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},7358:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},730:(e,t,n)=>{var i=n(7703),s=n(7358);e.exports=function(e){return"symbol"==typeof e||s(e)&&"[object Symbol]"==i(e)}},4522:(e,t,n)=>{var i=n(9998);e.exports=function(){return i.Date.now()}},2672:(e,t,n)=>{var i=n(6730),s=n(9910),r=n(730),o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(r(e))return NaN;if(s(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=s(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=i(e);var n=a.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?NaN:+e}},7371:(e,t,n)=>{var i=function(){return this}()||Function("return this")(),s=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,r=s&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=n(141),s)i.regeneratorRuntime=r;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},141:e=>{!function(t){"use strict";var n,i=Object.prototype,s=i.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=_;var d="suspendedStart",u="suspendedYield",h="executing",m="completed",f={},g={};g[o]=function(){return this};var p=Object.getPrototypeOf,v=p&&p(p($([])));v&&v!==i&&s.call(v,o)&&(g=v);var y=x.prototype=w.prototype=Object.create(g);S.prototype=y.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(y),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,i){var s=new A(_(e,t,n,i));return l.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},E(y),y[c]="Generator",y[o]=function(){return this},y.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 i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},l.values=$,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)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(i,s){return a.type="throw",a.arg=e,t.next=i,s&&(t.method="next",t.arg=n),!!s}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=s.call(o,"catchLoc"),l=s.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=t,r?(this.method="next",this.next=r.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var s=i.arg;k(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:$(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=n),f}}}function _(e,t,n,i){var s=t&&t.prototype instanceof w?t:w,r=Object.create(s.prototype),o=new j(i||[]);return r._invoke=function(e,t,n){var i=d;return function(s,r){if(i===h)throw new Error("Generator is already running");if(i===m){if("throw"===s)throw r;return N()}for(n.method=s,n.arg=r;;){var o=n.delegate;if(o){var a=C(o,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=h;var c=b(e,t,n);if("normal"===c.type){if(i=n.done?m:u,c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=m,n.method="throw",n.arg=c.arg)}}}(e,n,o),r}function b(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function w(){}function S(){}function x(){}function E(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function A(e){function t(n,i,r,o){var a=b(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"==typeof l&&s.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,r,o)}),(function(e){t("throw",e,r,o)})):Promise.resolve(l).then((function(e){c.value=e,r(c)}),o)}o(a.arg)}var n;this._invoke=function(e,i){function s(){return new Promise((function(n,s){t(e,i,n,s)}))}return n=n?n.then(s,s):s()}}function C(e,t){var i=e.iterator[t.method];if(i===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,C(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var s=b(i,e.iterator,t.arg);if("throw"===s.type)return t.method="throw",t.arg=s.arg,t.delegate=null,f;var r=s.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,f):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function $(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function t(){for(;++i<e.length;)if(s.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=n,t.done=!0,t};return r.next=r}}return{next:N}}function N(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())},1766:(e,t,n)=>{var i;!function(s){var r,o,a,c,l,d,u,h,m,f,g,p,v,y,_,b,w,S,x,E="sizzle"+1*new Date,A=s.document,C=0,T=0,k=he(),j=he(),$=he(),N=he(),O=function(e,t){return e===t&&(g=!0),0},I={}.hasOwnProperty,M=[],R=M.pop,D=M.push,L=M.push,z=M.slice,P=function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1},F="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",U="[\\x20\\t\\r\\n\\f]",B="(?:\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",q="\\[[\\x20\\t\\r\\n\\f]*("+B+")(?:"+U+"*([*^$|!~]?=)"+U+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+B+"))|)"+U+"*\\]",H=":("+B+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+q+")*)|.*)\\)|)",G=new RegExp(U+"+","g"),W=new RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$","g"),V=new RegExp("^[\\x20\\t\\r\\n\\f]*,[\\x20\\t\\r\\n\\f]*"),J=new RegExp("^[\\x20\\t\\r\\n\\f]*([>+~]|[\\x20\\t\\r\\n\\f])[\\x20\\t\\r\\n\\f]*"),Q=new RegExp(U+"|>"),Z=new RegExp(H),Y=new RegExp("^"+B+"$"),X={ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),TAG:new RegExp("^("+B+"|[*])"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+H),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),bool:new RegExp("^(?:"+F+")$","i"),needsContext:new RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)","i")},K=/HTML$/i,ee=/^(?:input|select|textarea|button)$/i,te=/^h\d$/i,ne=/^[^{]+\{\s*\[native \w/,ie=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,se=/[+~]/,re=new RegExp("\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\([^\\r\\n\\f])","g"),oe=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},ae=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ce=function(e,t){return t?"\0"===e?"<22>":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},le=function(){p()},de=Ee((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{L.apply(M=z.call(A.childNodes),A.childNodes),M[A.childNodes.length].nodeType}catch(e){L={apply:M.length?function(e,t){D.apply(e,z.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}function ue(e,t,n,i){var s,r,a,c,l,u,m,f=t&&t.ownerDocument,g=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==g&&9!==g&&11!==g)return n;if(!i&&(p(t),t=t||v,_)){if(11!==g&&(l=ie.exec(e)))if(s=l[1]){if(9===g){if(!(a=t.getElementById(s)))return n;if(a.id===s)return n.push(a),n}else if(f&&(a=f.getElementById(s))&&x(t,a)&&a.id===s)return n.push(a),n}else{if(l[2])return L.apply(n,t.getElementsByTagName(e)),n;if((s=l[3])&&o.getElementsByClassName&&t.getElementsByClassName)return L.apply(n,t.getElementsByClassName(s)),n}if(o.qsa&&!N[e+" "]&&(!b||!b.test(e))&&(1!==g||"object"!==t.nodeName.toLowerCase())){if(m=e,f=t,1===g&&(Q.test(e)||J.test(e))){for((f=se.test(e)&&we(t.parentNode)||t)===t&&o.scope||((c=t.getAttribute("id"))?c=c.replace(ae,ce):t.setAttribute("id",c=E)),r=(u=d(e)).length;r--;)u[r]=(c?"#"+c:":scope")+" "+xe(u[r]);m=u.join(",")}try{return L.apply(n,f.querySelectorAll(m)),n}catch(t){N(e,!0)}finally{c===E&&t.removeAttribute("id")}}}return h(e.replace(W,"$1"),t,n,i)}function he(){var e=[];return function t(n,i){return e.push(n+" ")>a.cacheLength&&delete t[e.shift()],t[n+" "]=i}}function me(e){return e[E]=!0,e}function fe(e){var t=v.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ge(e,t){for(var n=e.split("|"),i=n.length;i--;)a.attrHandle[n[i]]=t}function pe(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function ve(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function ye(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function _e(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&de(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function be(e){return me((function(t){return t=+t,me((function(n,i){for(var s,r=e([],n.length,t),o=r.length;o--;)n[s=r[o]]&&(n[s]=!(i[s]=n[s]))}))}))}function we(e){return e&&void 0!==e.getElementsByTagName&&e}for(r in o=ue.support={},l=ue.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!K.test(t||n&&n.nodeName||"HTML")},p=ue.setDocument=function(e){var t,n,i=e?e.ownerDocument||e:A;return i!=v&&9===i.nodeType&&i.documentElement?(y=(v=i).documentElement,_=!l(v),A!=v&&(n=v.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",le,!1):n.attachEvent&&n.attachEvent("onunload",le)),o.scope=fe((function(e){return y.appendChild(e).appendChild(v.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),o.attributes=fe((function(e){return e.className="i",!e.getAttribute("className")})),o.getElementsByTagName=fe((function(e){return e.appendChild(v.createComment("")),!e.getElementsByTagName("*").length})),o.getElementsByClassName=ne.test(v.getElementsByClassName),o.getById=fe((function(e){return y.appendChild(e).id=E,!v.getElementsByName||!v.getElementsByName(E).length})),o.getById?(a.filter.ID=function(e){var t=e.replace(re,oe);return function(e){return e.getAttribute("id")===t}},a.find.ID=function(e,t){if(void 0!==t.getElementById&&_){var n=t.getElementById(e);return n?[n]:[]}}):(a.filter.ID=function(e){var t=e.replace(re,oe);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},a.find.ID=function(e,t){if(void 0!==t.getElementById&&_){var n,i,s,r=t.getElementById(e);if(r){if((n=r.getAttributeNode("id"))&&n.value===e)return[r];for(s=t.getElementsByName(e),i=0;r=s[i++];)if((n=r.getAttributeNode("id"))&&n.value===e)return[r]}return[]}}),a.find.TAG=o.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):o.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],s=0,r=t.getElementsByTagName(e);if("*"===e){for(;n=r[s++];)1===n.nodeType&&i.push(n);return i}return r},a.find.CLASS=o.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&_)return t.getElementsByClassName(e)},w=[],b=[],(o.qsa=ne.test(v.querySelectorAll))&&(fe((function(e){var t;y.appendChild(e).innerHTML="<a id='"+E+"'></a><select id='"+E+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&b.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),e.querySelectorAll("[selected]").length||b.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|"+F+")"),e.querySelectorAll("[id~="+E+"-]").length||b.push("~="),(t=v.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||b.push("\\[[\\x20\\t\\r\\n\\f]*name[\\x20\\t\\r\\n\\f]*=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),e.querySelectorAll(":checked").length||b.push(":checked"),e.querySelectorAll("a#"+E+"+*").length||b.push(".#.+[+~]"),e.querySelectorAll("\\\f"),b.push("[\\r\\n\\f]")})),fe((function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=v.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&b.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&b.push(":enabled",":disabled"),y.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&b.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),b.push(",.*:")}))),(o.matchesSelector=ne.test(S=y.matches||y.webkitMatchesSelector||y.mozMatchesSelector||y.oMatchesSelector||y.msMatchesSelector))&&fe((function(e){o.disconnectedMatch=S.call(e,"*"),S.call(e,"[s!='']:x"),w.push("!=",H)})),b=b.length&&new RegExp(b.join("|")),w=w.length&&new RegExp(w.join("|")),t=ne.test(y.compareDocumentPosition),x=t||ne.test(y.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},O=t?function(e,t){if(e===t)return g=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!o.sortDetached&&t.compareDocumentPosition(e)===n?e==v||e.ownerDocument==A&&x(A,e)?-1:t==v||t.ownerDocument==A&&x(A,t)?1:f?P(f,e)-P(f,t):0:4&n?-1:1)}:function(e,t){if(e===t)return g=!0,0;var n,i=0,s=e.parentNode,r=t.parentNode,o=[e],a=[t];if(!s||!r)return e==v?-1:t==v?1:s?-1:r?1:f?P(f,e)-P(f,t):0;if(s===r)return pe(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;o[i]===a[i];)i++;return i?pe(o[i],a[i]):o[i]==A?-1:a[i]==A?1:0},v):v},ue.matches=function(e,t){return ue(e,null,null,t)},ue.matchesSelector=function(e,t){if(p(e),o.matchesSelector&&_&&!N[t+" "]&&(!w||!w.test(t))&&(!b||!b.test(t)))try{var n=S.call(e,t);if(n||o.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return ue(t,v,null,[e]).length>0},ue.contains=function(e,t){return(e.ownerDocument||e)!=v&&p(e),x(e,t)},ue.attr=function(e,t){(e.ownerDocument||e)!=v&&p(e);var n=a.attrHandle[t.toLowerCase()],i=n&&I.call(a.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==i?i:o.attributes||!_?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},ue.escape=function(e){return(e+"").replace(ae,ce)},ue.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ue.uniqueSort=function(e){var t,n=[],i=0,s=0;if(g=!o.detectDuplicates,f=!o.sortStable&&e.slice(0),e.sort(O),g){for(;t=e[s++];)t===e[s]&&(i=n.push(s));for(;i--;)e.splice(n[i],1)}return f=null,e},c=ue.getText=function(e){var t,n="",i=0,s=e.nodeType;if(s){if(1===s||9===s||11===s){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=c(e)}else if(3===s||4===s)return e.nodeValue}else for(;t=e[i++];)n+=c(t);return n},a=ue.selectors={cacheLength:50,createPseudo:me,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(re,oe),e[3]=(e[3]||e[4]||e[5]||"").replace(re,oe),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ue.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ue.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return X.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Z.test(n)&&(t=d(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(re,oe).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=k[e+" "];return t||(t=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+e+"("+U+"|$)"))&&k(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(i){var s=ue.attr(i,e);return null==s?"!="===t:!t||(s+="","="===t?s===n:"!="===t?s!==n:"^="===t?n&&0===s.indexOf(n):"*="===t?n&&s.indexOf(n)>-1:"$="===t?n&&s.slice(-n.length)===n:"~="===t?(" "+s.replace(G," ")+" ").indexOf(n)>-1:"|="===t&&(s===n||s.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,i,s){var r="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===i&&0===s?function(e){return!!e.parentNode}:function(t,n,c){var l,d,u,h,m,f,g=r!==o?"nextSibling":"previousSibling",p=t.parentNode,v=a&&t.nodeName.toLowerCase(),y=!c&&!a,_=!1;if(p){if(r){for(;g;){for(h=t;h=h[g];)if(a?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;f=g="only"===e&&!f&&"nextSibling"}return!0}if(f=[o?p.firstChild:p.lastChild],o&&y){for(_=(m=(l=(d=(u=(h=p)[E]||(h[E]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]||[])[0]===C&&l[1])&&l[2],h=m&&p.childNodes[m];h=++m&&h&&h[g]||(_=m=0)||f.pop();)if(1===h.nodeType&&++_&&h===t){d[e]=[C,m,_];break}}else if(y&&(_=m=(l=(d=(u=(h=t)[E]||(h[E]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]||[])[0]===C&&l[1]),!1===_)for(;(h=++m&&h&&h[g]||(_=m=0)||f.pop())&&((a?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++_||(y&&((d=(u=h[E]||(h[E]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]=[C,_]),h!==t)););return(_-=s)===i||_%i==0&&_/i>=0}}},PSEUDO:function(e,t){var n,i=a.pseudos[e]||a.setFilters[e.toLowerCase()]||ue.error("unsupported pseudo: "+e);return i[E]?i(t):i.length>1?(n=[e,e,"",t],a.setFilters.hasOwnProperty(e.toLowerCase())?me((function(e,n){for(var s,r=i(e,t),o=r.length;o--;)e[s=P(e,r[o])]=!(n[s]=r[o])})):function(e){return i(e,0,n)}):i}},pseudos:{not:me((function(e){var t=[],n=[],i=u(e.replace(W,"$1"));return i[E]?me((function(e,t,n,s){for(var r,o=i(e,null,s,[]),a=e.length;a--;)(r=o[a])&&(e[a]=!(t[a]=r))})):function(e,s,r){return t[0]=e,i(t,null,r,n),t[0]=null,!n.pop()}})),has:me((function(e){return function(t){return ue(e,t).length>0}})),contains:me((function(e){return e=e.replace(re,oe),function(t){return(t.textContent||c(t)).indexOf(e)>-1}})),lang:me((function(e){return Y.test(e||"")||ue.error("unsupported lang: "+e),e=e.replace(re,oe).toLowerCase(),function(t){var n;do{if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(e){var t=s.location&&s.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===y},focus:function(e){return e===v.activeElement&&(!v.hasFocus||v.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:_e(!1),disabled:_e(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!a.pseudos.empty(e)},header:function(e){return te.test(e.nodeName)},input:function(e){return ee.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:be((function(){return[0]})),last:be((function(e,t){return[t-1]})),eq:be((function(e,t,n){return[n<0?n+t:n]})),even:be((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:be((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:be((function(e,t,n){for(var i=n<0?n+t:n>t?t:n;--i>=0;)e.push(i);return e})),gt:be((function(e,t,n){for(var i=n<0?n+t:n;++i<t;)e.push(i);return e}))}},a.pseudos.nth=a.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})a.pseudos[r]=ve(r);for(r in{submit:!0,reset:!0})a.pseudos[r]=ye(r);function Se(){}function xe(e){for(var t=0,n=e.length,i="";t<n;t++)i+=e[t].value;return i}function Ee(e,t,n){var i=t.dir,s=t.next,r=s||i,o=n&&"parentNode"===r,a=T++;return t.first?function(t,n,s){for(;t=t[i];)if(1===t.nodeType||o)return e(t,n,s);return!1}:function(t,n,c){var l,d,u,h=[C,a];if(c){for(;t=t[i];)if((1===t.nodeType||o)&&e(t,n,c))return!0}else for(;t=t[i];)if(1===t.nodeType||o)if(d=(u=t[E]||(t[E]={}))[t.uniqueID]||(u[t.uniqueID]={}),s&&s===t.nodeName.toLowerCase())t=t[i]||t;else{if((l=d[r])&&l[0]===C&&l[1]===a)return h[2]=l[2];if(d[r]=h,h[2]=e(t,n,c))return!0}return!1}}function Ae(e){return e.length>1?function(t,n,i){for(var s=e.length;s--;)if(!e[s](t,n,i))return!1;return!0}:e[0]}function Ce(e,t,n,i,s){for(var r,o=[],a=0,c=e.length,l=null!=t;a<c;a++)(r=e[a])&&(n&&!n(r,i,s)||(o.push(r),l&&t.push(a)));return o}function Te(e,t,n,i,s,r){return i&&!i[E]&&(i=Te(i)),s&&!s[E]&&(s=Te(s,r)),me((function(r,o,a,c){var l,d,u,h=[],m=[],f=o.length,g=r||function(e,t,n){for(var i=0,s=t.length;i<s;i++)ue(e,t[i],n);return n}(t||"*",a.nodeType?[a]:a,[]),p=!e||!r&&t?g:Ce(g,h,e,a,c),v=n?s||(r?e:f||i)?[]:o:p;if(n&&n(p,v,a,c),i)for(l=Ce(v,m),i(l,[],a,c),d=l.length;d--;)(u=l[d])&&(v[m[d]]=!(p[m[d]]=u));if(r){if(s||e){if(s){for(l=[],d=v.length;d--;)(u=v[d])&&l.push(p[d]=u);s(null,v=[],l,c)}for(d=v.length;d--;)(u=v[d])&&(l=s?P(r,u):h[d])>-1&&(r[l]=!(o[l]=u))}}else v=Ce(v===o?v.splice(f,v.length):v),s?s(null,o,v,c):L.apply(o,v)}))}function ke(e){for(var t,n,i,s=e.length,r=a.relative[e[0].type],o=r||a.relative[" "],c=r?1:0,l=Ee((function(e){return e===t}),o,!0),d=Ee((function(e){return P(t,e)>-1}),o,!0),u=[function(e,n,i){var s=!r&&(i||n!==m)||((t=n).nodeType?l(e,n,i):d(e,n,i));return t=null,s}];c<s;c++)if(n=a.relative[e[c].type])u=[Ee(Ae(u),n)];else{if((n=a.filter[e[c].type].apply(null,e[c].matches))[E]){for(i=++c;i<s&&!a.relative[e[i].type];i++);return Te(c>1&&Ae(u),c>1&&xe(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(W,"$1"),n,c<i&&ke(e.slice(c,i)),i<s&&ke(e=e.slice(i)),i<s&&xe(e))}u.push(n)}return Ae(u)}Se.prototype=a.filters=a.pseudos,a.setFilters=new Se,d=ue.tokenize=function(e,t){var n,i,s,r,o,c,l,d=j[e+" "];if(d)return t?0:d.slice(0);for(o=e,c=[],l=a.preFilter;o;){for(r in n&&!(i=V.exec(o))||(i&&(o=o.slice(i[0].length)||o),c.push(s=[])),n=!1,(i=J.exec(o))&&(n=i.shift(),s.push({value:n,type:i[0].replace(W," ")}),o=o.slice(n.length)),a.filter)!(i=X[r].exec(o))||l[r]&&!(i=l[r](i))||(n=i.shift(),s.push({value:n,type:r,matches:i}),o=o.slice(n.length));if(!n)break}return t?o.length:o?ue.error(e):j(e,c).slice(0)},u=ue.compile=function(e,t){var n,i=[],s=[],r=$[e+" "];if(!r){for(t||(t=d(e)),n=t.length;n--;)(r=ke(t[n]))[E]?i.push(r):s.push(r);r=$(e,function(e,t){var n=t.length>0,i=e.length>0,s=function(s,r,o,c,l){var d,u,h,f=0,g="0",y=s&&[],b=[],w=m,S=s||i&&a.find.TAG("*",l),x=C+=null==w?1:Math.random()||.1,E=S.length;for(l&&(m=r==v||r||l);g!==E&&null!=(d=S[g]);g++){if(i&&d){for(u=0,r||d.ownerDocument==v||(p(d),o=!_);h=e[u++];)if(h(d,r||v,o)){c.push(d);break}l&&(C=x)}n&&((d=!h&&d)&&f--,s&&y.push(d))}if(f+=g,n&&g!==f){for(u=0;h=t[u++];)h(y,b,r,o);if(s){if(f>0)for(;g--;)y[g]||b[g]||(b[g]=R.call(c));b=Ce(b)}L.apply(c,b),l&&!s&&b.length>0&&f+t.length>1&&ue.uniqueSort(c)}return l&&(C=x,m=w),y};return n?me(s):s}(s,i)),r.selector=e}return r},h=ue.select=function(e,t,n,i){var s,r,o,c,l,h="function"==typeof e&&e,m=!i&&d(e=h.selector||e);if(n=n||[],1===m.length){if((r=m[0]=m[0].slice(0)).length>2&&"ID"===(o=r[0]).type&&9===t.nodeType&&_&&a.relative[r[1].type]){if(!(t=(a.find.ID(o.matches[0].replace(re,oe),t)||[])[0]))return n;h&&(t=t.parentNode),e=e.slice(r.shift().value.length)}for(s=X.needsContext.test(e)?0:r.length;s--&&(o=r[s],!a.relative[c=o.type]);)if((l=a.find[c])&&(i=l(o.matches[0].replace(re,oe),se.test(r[0].type)&&we(t.parentNode)||t))){if(r.splice(s,1),!(e=i.length&&xe(r)))return L.apply(n,i),n;break}}return(h||u(e,m))(i,t,!_,n,!t||se.test(e)&&we(t.parentNode)||t),n},o.sortStable=E.split("").sort(O).join("")===E,o.detectDuplicates=!!g,p(),o.sortDetached=fe((function(e){return 1&e.compareDocumentPosition(v.createElement("fieldset"))})),fe((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||ge("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),o.attributes&&fe((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||ge("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),fe((function(e){return null==e.getAttribute("disabled")}))||ge(F,(function(e,t,n){var i;if(!n)return!0===e[t]?t.toLowerCase():(i=e.getAttributeNode(t))&&i.specified?i.value:null}));var je=s.Sizzle;ue.noConflict=function(){return s.Sizzle===ue&&(s.Sizzle=je),ue},void 0===(i=function(){return ue}.call(t,n,t,e))||(e.exports=i)}(window)},4223:(e,t,n)=>{var i;!function(){"use strict";var s={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 a(l(e),arguments)}function o(e,t){return r.apply(null,[e].concat(t||[]))}function a(e,t){var n,i,o,a,c,l,d,u,h,m=1,f=e.length,g="";for(i=0;i<f;i++)if("string"==typeof e[i])g+=e[i];else if("object"==typeof e[i]){if((a=e[i]).keys)for(n=t[m],o=0;o<a.keys.length;o++){if(null==n)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[o],a.keys[o-1]));n=n[a.keys[o]]}else n=a.param_no?t[a.param_no]:t[m++];if(s.not_type.test(a.type)&&s.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),s.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(r("[sprintf] expecting number but found %T",n));switch(s.number.test(a.type)&&(u=n>=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}s.json.test(a.type)?g+=n:(!s.number.test(a.type)||u&&!a.sign?h="":(h=u?"+":"-",n=n.toString().replace(s.sign,"")),l=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",d=a.width-(h+n).length,c=a.width&&d>0?l.repeat(d):"",g+=a.align?h+n+c:"0"===l?h+c+n:c+h+n)}return g}var c=Object.create(null);function l(e){if(c[e])return c[e];for(var t,n=e,i=[],r=0;n;){if(null!==(t=s.text.exec(n)))i.push(t[0]);else if(null!==(t=s.modulo.exec(n)))i.push("%");else{if(null===(t=s.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){r|=1;var o=[],a=t[2],l=[];if(null===(l=s.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(l[1]);""!==(a=a.substring(l[0].length));)if(null!==(l=s.key_access.exec(a)))o.push(l[1]);else{if(null===(l=s.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(l[1])}t[2]=o}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");i.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}n=n.substring(t[0].length)}return c[e]=i}t.sprintf=r,t.vsprintf=o,"undefined"!=typeof window&&(window.sprintf=r,window.vsprintf=o,void 0===(i=function(){return{sprintf:r,vsprintf:o}}.call(t,n,t,e))||(e.exports=i))}()},8677:function(e,t,n){var i,s;!function(r,o){"use strict";e.exports?e.exports=o():void 0===(s="function"==typeof(i=o)?i.call(t,n,t,e):i)||(e.exports=s)}(0,(function(e){"use strict";var t=e&&e.IPv6;return{best:function(e){var t,n,i=e.toLowerCase().split(":"),s=i.length,r=8;for(""===i[0]&&""===i[1]&&""===i[2]?(i.shift(),i.shift()):""===i[0]&&""===i[1]?i.shift():""===i[s-1]&&""===i[s-2]&&i.pop(),-1!==i[(s=i.length)-1].indexOf(".")&&(r=7),t=0;t<s&&""!==i[t];t++);if(t<r)for(i.splice(t,1,"0000");i.length<r;)i.splice(t,0,"0000");for(var o=0;o<r;o++){n=i[o].split("");for(var a=0;a<3&&"0"===n[0]&&n.length>1;a++)n.splice(0,1);i[o]=n.join("")}var c=-1,l=0,d=0,u=-1,h=!1;for(o=0;o<r;o++)h?"0"===i[o]?d+=1:(h=!1,d>l&&(c=u,l=d)):"0"===i[o]&&(h=!0,u=o,d=1);d>l&&(c=u,l=d),l>1&&i.splice(c,l,""),s=i.length;var m="";for(""===i[0]&&(m=":"),o=0;o<s&&(m+=i[o],o!==s-1);o++)m+=":";return""===i[s-1]&&(m+=":"),m},noConflict:function(){return e.IPv6===this&&(e.IPv6=t),this}}}))},9827:function(e,t,n){var i,s;!function(r,o){"use strict";e.exports?e.exports=o():void 0===(s="function"==typeof(i=o)?i.call(t,n,t,e):i)||(e.exports=s)}(0,(function(e){"use strict";var t=e&&e.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;var i=e.lastIndexOf(".",t-1);if(i<=0||i>=t-1)return!1;var s=n.list[e.slice(t+1)];return!!s&&s.indexOf(" "+e.slice(i+1,t)+" ")>=0},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;if(e.lastIndexOf(".",t-1)>=0)return!1;var i=n.list[e.slice(t+1)];return!!i&&i.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var i=e.lastIndexOf(".",t-1);if(i<=0||i>=t-1)return null;var s=n.list[e.slice(t+1)];return s?s.indexOf(" "+e.slice(i+1,t)+" ")<0?null:e.slice(i+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n}))},5215:function(e,t,n){var i,s,r;!function(o,a){"use strict";e.exports?e.exports=a(n(7819),n(8677),n(9827)):(s=[n(7819),n(8677),n(9827)],void 0===(r="function"==typeof(i=a)?i.apply(t,s):i)||(e.exports=r))}(0,(function(e,t,n,i){"use strict";var s=i&&i.URI;function r(e,t){var n=arguments.length>=1,i=arguments.length>=2;if(!(this instanceof r))return n?i?new r(e,t):new r(e):new r;if(void 0===e){if(n)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}r.version="1.19.8";var o=r.prototype,a=Object.prototype.hasOwnProperty;function c(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function d(e){return"Array"===l(e)}function u(e,t){var n,i,s={};if("RegExp"===l(t))s=null;else if(d(t))for(n=0,i=t.length;n<i;n++)s[t[n]]=!0;else s[t]=!0;for(n=0,i=e.length;n<i;n++)(s&&void 0!==s[e[n]]||!s&&t.test(e[n]))&&(e.splice(n,1),i--,n--);return e}function h(e,t){var n,i;if(d(t)){for(n=0,i=t.length;n<i;n++)if(!h(e,t[n]))return!1;return!0}var s=l(t);for(n=0,i=e.length;n<i;n++)if("RegExp"===s){if("string"==typeof e[n]&&e[n].match(t))return!0}else if(e[n]===t)return!0;return!1}function m(e,t){if(!d(e)||!d(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function f(e){return e.replace(/^\/+|\/+$/g,"")}function g(e){return escape(e)}function p(e){return encodeURIComponent(e).replace(/[!'()*]/g,g).replace(/\*/g,"%2A")}r._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:r.preventInvalidHostname,duplicateQueryParameters:r.duplicateQueryParameters,escapeQuerySpace:r.escapeQuerySpace}},r.preventInvalidHostname=!1,r.duplicateQueryParameters=!1,r.escapeQuerySpace=!0,r.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,r.idn_expression=/[^a-z0-9\._-]/i,r.punycode_expression=/(xn--)/i,r.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,r.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,r.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},r.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},r.hostProtocols=["http","https"],r.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,r.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},r.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return r.domAttributes[t]}},r.encode=p,r.decode=decodeURIComponent,r.iso8859=function(){r.encode=escape,r.decode=unescape},r.unicode=function(){r.encode=p,r.decode=decodeURIComponent},r.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},r.encodeQuery=function(e,t){var n=r.encode(e+"");return void 0===t&&(t=r.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},r.decodeQuery=function(e,t){e+="",void 0===t&&(t=r.escapeQuerySpace);try{return r.decode(t?e.replace(/\+/g,"%20"):e)}catch(t){return e}};var v,y={encode:"encode",decode:"decode"},_=function(e,t){return function(n){try{return r[t](n+"").replace(r.characters[e][t].expression,(function(n){return r.characters[e][t].map[n]}))}catch(e){return n}}};for(v in y)r[v+"PathSegment"]=_("pathname",y[v]),r[v+"UrnPathSegment"]=_("urnpath",y[v]);var b=function(e,t,n){return function(i){var s;s=n?function(e){return r[t](r[n](e))}:r[t];for(var o=(i+"").split(e),a=0,c=o.length;a<c;a++)o[a]=s(o[a]);return o.join(e)}};function w(e){return function(t,n){return void 0===t?this._parts[e]||"":(this._parts[e]=t||null,this.build(!n),this)}}function S(e,t){return function(n,i){return void 0===n?this._parts[e]||"":(null!==n&&(n+="").charAt(0)===t&&(n=n.substring(1)),this._parts[e]=n,this.build(!i),this)}}r.decodePath=b("/","decodePathSegment"),r.decodeUrnPath=b(":","decodeUrnPathSegment"),r.recodePath=b("/","encodePathSegment","decode"),r.recodeUrnPath=b(":","encodeUrnPathSegment","decode"),r.encodeReserved=_("reserved","encode"),r.parse=function(e,t){var n;return t||(t={preventInvalidHostname:r.preventInvalidHostname}),(n=e.indexOf("#"))>-1&&(t.fragment=e.substring(n+1)||null,e=e.substring(0,n)),(n=e.indexOf("?"))>-1&&(t.query=e.substring(n+1)||null,e=e.substring(0,n)),"//"===(e=e.replace(/^(https?|ftp|wss?)?:[/\\]*/i,"$1://")).substring(0,2)?(t.protocol=null,e=e.substring(2),e=r.parseAuthority(e,t)):(n=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,n)||null,t.protocol&&!t.protocol.match(r.protocol_expression)?t.protocol=void 0:"//"===e.substring(n+1,n+3).replace(/\\/g,"/")?(e=e.substring(n+3),e=r.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0)),t.path=e,t},r.parseHost=function(e,t){e||(e="");var n,i,s=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===s&&(s=e.length),"["===e.charAt(0))n=e.indexOf("]"),t.hostname=e.substring(1,n)||null,t.port=e.substring(n+2,s)||null,"/"===t.port&&(t.port=null);else{var o=e.indexOf(":"),a=e.indexOf("/"),c=e.indexOf(":",o+1);-1!==c&&(-1===a||c<a)?(t.hostname=e.substring(0,s)||null,t.port=null):(i=e.substring(0,s).split(":"),t.hostname=i[0]||null,t.port=i[1]||null)}return t.hostname&&"/"!==e.substring(s).charAt(0)&&(s++,e="/"+e),t.preventInvalidHostname&&r.ensureValidHostname(t.hostname,t.protocol),t.port&&r.ensureValidPort(t.port),e.substring(s)||"/"},r.parseAuthority=function(e,t){return e=r.parseUserinfo(e,t),r.parseHost(e,t)},r.parseUserinfo=function(e,t){var n=e;-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/"));var i,s=e.indexOf("/"),o=e.lastIndexOf("@",s>-1?s:e.length-1);return o>-1&&(-1===s||o<s)?(i=e.substring(0,o).split(":"),t.username=i[0]?r.decode(i[0]):null,i.shift(),t.password=i[0]?r.decode(i.join(":")):null,e=n.substring(o+1)):(t.username=null,t.password=null),e},r.parseQuery=function(e,t){if(!e)return{};if(!(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var n,i,s,o={},c=e.split("&"),l=c.length,d=0;d<l;d++)n=c[d].split("="),i=r.decodeQuery(n.shift(),t),s=n.length?r.decodeQuery(n.join("="),t):null,"__proto__"!==i&&(a.call(o,i)?("string"!=typeof o[i]&&null!==o[i]||(o[i]=[o[i]]),o[i].push(s)):o[i]=s);return o},r.build=function(e){var t="",n=!1;return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//",n=!0),t+=r.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&n&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},r.buildHost=function(e){var t="";return e.hostname?(r.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},r.buildAuthority=function(e){return r.buildUserinfo(e)+r.buildHost(e)},r.buildUserinfo=function(e){var t="";return e.username&&(t+=r.encode(e.username)),e.password&&(t+=":"+r.encode(e.password)),t&&(t+="@"),t},r.buildQuery=function(e,t,n){var i,s,o,c,l="";for(s in e)if("__proto__"!==s&&a.call(e,s))if(d(e[s]))for(i={},o=0,c=e[s].length;o<c;o++)void 0!==e[s][o]&&void 0===i[e[s][o]+""]&&(l+="&"+r.buildQueryParameter(s,e[s][o],n),!0!==t&&(i[e[s][o]+""]=!0));else void 0!==e[s]&&(l+="&"+r.buildQueryParameter(s,e[s],n));return l.substring(1)},r.buildQueryParameter=function(e,t,n){return r.encodeQuery(e,n)+(null!==t?"="+r.encodeQuery(t,n):"")},r.addQuery=function(e,t,n){if("object"==typeof t)for(var i in t)a.call(t,i)&&r.addQuery(e,i,t[i]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=n);"string"==typeof e[t]&&(e[t]=[e[t]]),d(n)||(n=[n]),e[t]=(e[t]||[]).concat(n)}},r.setQuery=function(e,t,n){if("object"==typeof t)for(var i in t)a.call(t,i)&&r.setQuery(e,i,t[i]);else{if("string"!=typeof t)throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");e[t]=void 0===n?null:n}},r.removeQuery=function(e,t,n){var i,s,o;if(d(t))for(i=0,s=t.length;i<s;i++)e[t[i]]=void 0;else if("RegExp"===l(t))for(o in e)t.test(o)&&(e[o]=void 0);else if("object"==typeof t)for(o in t)a.call(t,o)&&r.removeQuery(e,o,t[o]);else{if("string"!=typeof t)throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");void 0!==n?"RegExp"===l(n)?!d(e[t])&&n.test(e[t])?e[t]=void 0:e[t]=u(e[t],n):e[t]!==String(n)||d(n)&&1!==n.length?d(e[t])&&(e[t]=u(e[t],n)):e[t]=void 0:e[t]=void 0}},r.hasQuery=function(e,t,n,i){switch(l(t)){case"String":break;case"RegExp":for(var s in e)if(a.call(e,s)&&t.test(s)&&(void 0===n||r.hasQuery(e,s,n)))return!0;return!1;case"Object":for(var o in t)if(a.call(t,o)&&!r.hasQuery(e,o,t[o]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(l(n)){case"Undefined":return t in e;case"Boolean":return n===Boolean(d(e[t])?e[t].length:e[t]);case"Function":return!!n(e[t],t,e);case"Array":return!!d(e[t])&&(i?h:m)(e[t],n);case"RegExp":return d(e[t])?!!i&&h(e[t],n):Boolean(e[t]&&e[t].match(n));case"Number":n=String(n);case"String":return d(e[t])?!!i&&h(e[t],n):e[t]===n;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var e=[],t=[],n=0,i=0;i<arguments.length;i++){var s=new r(arguments[i]);e.push(s);for(var o=s.segment(),a=0;a<o.length;a++)"string"==typeof o[a]&&t.push(o[a]),o[a]&&n++}if(!t.length||!n)return new r("");var c=new r("").segment(t);return""!==e[0].path()&&"/"!==e[0].path().slice(0,1)||c.path("/"+c.path()),c.normalize()},r.commonPath=function(e,t){var n,i=Math.min(e.length,t.length);for(n=0;n<i;n++)if(e.charAt(n)!==t.charAt(n)){n--;break}return n<1?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":("/"===e.charAt(n)&&"/"===t.charAt(n)||(n=e.substring(0,n).lastIndexOf("/")),e.substring(0,n+1))},r.withinString=function(e,t,n){n||(n={});var i=n.start||r.findUri.start,s=n.end||r.findUri.end,o=n.trim||r.findUri.trim,a=n.parens||r.findUri.parens,c=/[a-z0-9-]=["']?$/i;for(i.lastIndex=0;;){var l=i.exec(e);if(!l)break;var d=l.index;if(n.ignoreHtml){var u=e.slice(Math.max(d-3,0),d);if(u&&c.test(u))continue}for(var h=d+e.slice(d).search(s),m=e.slice(d,h),f=-1;;){var g=a.exec(m);if(!g)break;var p=g.index+g[0].length;f=Math.max(f,p)}if(!((m=f>-1?m.slice(0,f)+m.slice(f).replace(o,""):m.replace(o,"")).length<=l[0].length||n.ignore&&n.ignore.test(m))){var v=t(m,d,h=d+m.length,e);void 0!==v?(v=String(v),e=e.slice(0,d)+v+e.slice(h),i.lastIndex=d+v.length):i.lastIndex=h}}return i.lastIndex=0,e},r.ensureValidHostname=function(t,n){var i=!!t,s=!1;if(!!n&&(s=h(r.hostProtocols,n)),s&&!i)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(r.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(r.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},r.ensureValidPort=function(e){if(e){var t=Number(e);if(!(/^[0-9]+$/.test(t)&&t>0&&t<65536))throw new TypeError('Port "'+e+'" is not a valid port')}},r.noConflict=function(e){if(e){var t={URI:this.noConflict()};return i.URITemplate&&"function"==typeof i.URITemplate.noConflict&&(t.URITemplate=i.URITemplate.noConflict()),i.IPv6&&"function"==typeof i.IPv6.noConflict&&(t.IPv6=i.IPv6.noConflict()),i.SecondLevelDomains&&"function"==typeof i.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=i.SecondLevelDomains.noConflict()),t}return i.URI===this&&(i.URI=s),this},o.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=r.build(this._parts),this._deferred_build=!1),this},o.clone=function(){return new r(this)},o.valueOf=o.toString=function(){return this.build(!1)._string},o.protocol=w("protocol"),o.username=w("username"),o.password=w("password"),o.hostname=w("hostname"),o.port=w("port"),o.query=S("query","?"),o.fragment=S("fragment","#"),o.search=function(e,t){var n=this.query(e,t);return"string"==typeof n&&n.length?"?"+n:n},o.hash=function(e,t){var n=this.fragment(e,t);return"string"==typeof n&&n.length?"#"+n:n},o.pathname=function(e,t){if(void 0===e||!0===e){var n=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?r.decodeUrnPath:r.decodePath)(n):n}return this._parts.urn?this._parts.path=e?r.recodeUrnPath(e):"":this._parts.path=e?r.recodePath(e):"/",this.build(!t),this},o.path=o.pathname,o.href=function(e,t){var n;if(void 0===e)return this.toString();this._string="",this._parts=r._parts();var i=e instanceof r,s="object"==typeof e&&(e.hostname||e.path||e.pathname);if(e.nodeName&&(e=e[r.getDomAttribute(e)]||"",s=!1),!i&&s&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=r.parse(String(e),this._parts);else{if(!i&&!s)throw new TypeError("invalid input");var o=i?e._parts:e;for(n in o)"query"!==n&&a.call(this._parts,n)&&(this._parts[n]=o[n]);o.query&&this.query(o.query,!1)}return this.build(!t),this},o.is=function(e){var t=!1,i=!1,s=!1,o=!1,a=!1,c=!1,l=!1,d=!this._parts.urn;switch(this._parts.hostname&&(d=!1,i=r.ip4_expression.test(this._parts.hostname),s=r.ip6_expression.test(this._parts.hostname),a=(o=!(t=i||s))&&n&&n.has(this._parts.hostname),c=o&&r.idn_expression.test(this._parts.hostname),l=o&&r.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return d;case"absolute":return!d;case"domain":case"name":return o;case"sld":return a;case"ip":return t;case"ip4":case"ipv4":case"inet4":return i;case"ip6":case"ipv6":case"inet6":return s;case"idn":return c;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return l}return null};var x=o.protocol,E=o.port,A=o.hostname;o.protocol=function(e,t){if(e&&!(e=e.replace(/:(\/\/)?$/,"")).match(r.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return x.call(this,e,t)},o.scheme=o.protocol,o.port=function(e,t){return this._parts.urn?void 0===e?"":this:(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),r.ensureValidPort(e))),E.call(this,e,t))},o.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var n={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==r.parseHost(e,n))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&r.ensureValidHostname(e,this._parts.protocol)}return A.call(this,e,t)},o.origin=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=this.protocol();return this.authority()?(n?n+"://":"")+this.authority():""}var i=r(e);return this.protocol(i.protocol()).authority(i.authority()).build(!t),this},o.host=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?r.buildHost(this._parts):"";if("/"!==r.parseHost(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},o.authority=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?r.buildAuthority(this._parts):"";if("/"!==r.parseAuthority(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},o.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=r.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return"@"!==e[e.length-1]&&(e+="@"),r.parseUserinfo(e,this._parts),this.build(!t),this},o.resource=function(e,t){var n;return void 0===e?this.path()+this.search()+this.hash():(n=r.parse(e),this._parts.path=n.path,this._parts.query=n.query,this._parts.fragment=n.fragment,this.build(!t),this)},o.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,n)||""}var i=this._parts.hostname.length-this.domain().length,s=this._parts.hostname.substring(0,i),o=new RegExp("^"+c(s));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&r.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(o,e),this.build(!t),this},o.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.match(/\./g);if(n&&n.length<2)return this._parts.hostname;var i=this._parts.hostname.length-this.tld(t).length-1;return i=this._parts.hostname.lastIndexOf(".",i-1)+1,this._parts.hostname.substring(i)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(r.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var s=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(s,e)}return this.build(!t),this},o.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var i=this._parts.hostname.lastIndexOf("."),s=this._parts.hostname.substring(i+1);return!0!==t&&n&&n.list[s.toLowerCase()]&&n.get(this._parts.hostname)||s}var r;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!n||!n.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');r=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(r,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");r=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(r,e)}return this.build(!t),this},o.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var n=this._parts.path.length-this.filename().length-1,i=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?r.decodePath(i):i}var s=this._parts.path.length-this.filename().length,o=this._parts.path.substring(0,s),a=new RegExp("^"+c(o));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=r.recodePath(e),this._parts.path=this._parts.path.replace(a,e),this.build(!t),this},o.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("string"!=typeof e){if(!this._parts.path||"/"===this._parts.path)return"";var n=this._parts.path.lastIndexOf("/"),i=this._parts.path.substring(n+1);return e?r.decodePathSegment(i):i}var s=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(s=!0);var o=new RegExp(c(this.filename())+"$");return e=r.recodePath(e),this._parts.path=this._parts.path.replace(o,e),s?this.normalizePath(t):this.build(!t),this},o.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var n,i,s=this.filename(),o=s.lastIndexOf(".");return-1===o?"":(n=s.substring(o+1),i=/^[a-z0-9%]+$/i.test(n)?n:"",e?r.decodePathSegment(i):i)}"."===e.charAt(0)&&(e=e.substring(1));var a,l=this.suffix();if(l)a=e?new RegExp(c(l)+"$"):new RegExp(c("."+l)+"$");else{if(!e)return this;this._parts.path+="."+r.recodePath(e)}return a&&(e=r.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},o.segment=function(e,t,n){var i=this._parts.urn?":":"/",s=this.path(),r="/"===s.substring(0,1),o=s.split(i);if(void 0!==e&&"number"!=typeof e&&(n=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(r&&o.shift(),e<0&&(e=Math.max(o.length+e,0)),void 0===t)return void 0===e?o:o[e];if(null===e||void 0===o[e])if(d(t)){o=[];for(var a=0,c=t.length;a<c;a++)(t[a].length||o.length&&o[o.length-1].length)&&(o.length&&!o[o.length-1].length&&o.pop(),o.push(f(t[a])))}else(t||"string"==typeof t)&&(t=f(t),""===o[o.length-1]?o[o.length-1]=t:o.push(t));else t?o[e]=f(t):o.splice(e,1);return r&&o.unshift(""),this.path(o.join(i),n)},o.segmentCoded=function(e,t,n){var i,s,o;if("number"!=typeof e&&(n=t,t=e,e=void 0),void 0===t){if(d(i=this.segment(e,t,n)))for(s=0,o=i.length;s<o;s++)i[s]=r.decode(i[s]);else i=void 0!==i?r.decode(i):void 0;return i}if(d(t))for(s=0,o=t.length;s<o;s++)t[s]=r.encode(t[s]);else t="string"==typeof t||t instanceof String?r.encode(t):t;return this.segment(e,t,n)};var C=o.query;return o.query=function(e,t){if(!0===e)return r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var n=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),i=e.call(this,n);return this._parts.query=r.buildQuery(i||n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=r.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):C.call(this,e,t)},o.setQuery=function(e,t,n){var i=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof e||e instanceof String)i[e]=void 0!==t?t:null;else{if("object"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var s in e)a.call(e,s)&&(i[s]=e[s])}return this._parts.query=r.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.addQuery=function(e,t,n){var i=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.addQuery(i,e,void 0===t?null:t),this._parts.query=r.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.removeQuery=function(e,t,n){var i=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.removeQuery(i,e,t),this._parts.query=r.buildQuery(i,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.hasQuery=function(e,t,n){var i=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(i,e,t,n)},o.setSearch=o.setQuery,o.addSearch=o.addQuery,o.removeSearch=o.removeQuery,o.hasSearch=o.hasQuery,o.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},o.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},o.normalizeHostname=function(n){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!n)),this},o.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===r.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},o.normalizePath=function(e){var t,n=this._parts.path;if(!n)return this;if(this._parts.urn)return this._parts.path=r.recodeUrnPath(this._parts.path),this.build(!e),this;if("/"===this._parts.path)return this;var i,s,o="";for("/"!==(n=r.recodePath(n)).charAt(0)&&(t=!0,n="/"+n),"/.."!==n.slice(-3)&&"/."!==n.slice(-2)||(n+="/"),n=n.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),t&&(o=n.substring(1).match(/^(\.\.\/)+/)||"")&&(o=o[0]);-1!==(i=n.search(/\/\.\.(\/|$)/));)0!==i?(-1===(s=n.substring(0,i).lastIndexOf("/"))&&(s=i),n=n.substring(0,s)+n.substring(i+3)):n=n.substring(3);return t&&this.is("relative")&&(n=o+n.substring(1)),this._parts.path=n,this.build(!e),this},o.normalizePathname=o.normalizePath,o.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(r.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},o.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},o.normalizeSearch=o.normalizeQuery,o.normalizeHash=o.normalizeFragment,o.iso8859=function(){var e=r.encode,t=r.decode;r.encode=escape,r.decode=decodeURIComponent;try{this.normalize()}finally{r.encode=e,r.decode=t}return this},o.unicode=function(){var e=r.encode,t=r.decode;r.encode=p,r.decode=unescape;try{this.normalize()}finally{r.encode=e,r.decode=t}return this},o.readable=function(){var t=this.clone();t.username("").password("").normalize();var n="";if(t._parts.protocol&&(n+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(n+=e.toUnicode(t._parts.hostname),t._parts.port&&(n+=":"+t._parts.port)):n+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(n+="/"),n+=t.path(!0),t._parts.query){for(var i="",s=0,o=t._parts.query.split("&"),a=o.length;s<a;s++){var c=(o[s]||"").split("=");i+="&"+r.decodeQuery(c[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==c[1]&&(i+="="+r.decodeQuery(c[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}n+="?"+i.substring(1)}return n+r.decodeQuery(t.hash(),!0)},o.absoluteTo=function(e){var t,n,i,s=this.clone(),o=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof r||(e=new r(e)),s._parts.protocol)return s;if(s._parts.protocol=e._parts.protocol,this._parts.hostname)return s;for(n=0;i=o[n];n++)s._parts[i]=e._parts[i];return s._parts.path?(".."===s._parts.path.substring(-2)&&(s._parts.path+="/"),"/"!==s.path().charAt(0)&&(t=(t=e.directory())||(0===e.path().indexOf("/")?"/":""),s._parts.path=(t?t+"/":"")+s._parts.path,s.normalizePath())):(s._parts.path=e._parts.path,s._parts.query||(s._parts.query=e._parts.query)),s.build(),s},o.relativeTo=function(e){var t,n,i,s,o,a=this.clone().normalize();if(a._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new r(e).normalize(),t=a._parts,n=e._parts,s=a.path(),o=e.path(),"/"!==s.charAt(0))throw new Error("URI is already relative");if("/"!==o.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===n.protocol&&(t.protocol=null),t.username!==n.username||t.password!==n.password)return a.build();if(null!==t.protocol||null!==t.username||null!==t.password)return a.build();if(t.hostname!==n.hostname||t.port!==n.port)return a.build();if(t.hostname=null,t.port=null,s===o)return t.path="",a.build();if(!(i=r.commonPath(s,o)))return a.build();var c=n.path.substring(i.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=c+t.path.substring(i.length)||"./",a.build()},o.equals=function(e){var t,n,i,s,o,c=this.clone(),l=new r(e),u={};if(c.normalize(),l.normalize(),c.toString()===l.toString())return!0;if(i=c.query(),s=l.query(),c.query(""),l.query(""),c.toString()!==l.toString())return!1;if(i.length!==s.length)return!1;for(o in t=r.parseQuery(i,this._parts.escapeQuerySpace),n=r.parseQuery(s,this._parts.escapeQuerySpace),t)if(a.call(t,o)){if(d(t[o])){if(!m(t[o],n[o]))return!1}else if(t[o]!==n[o])return!1;u[o]=!0}for(o in n)if(a.call(n,o)&&!u[o])return!1;return!0},o.preventInvalidHostname=function(e){return this._parts.preventInvalidHostname=!!e,this},o.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},o.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},r}))},7819:function(e,t,n){var i;e=n.nmd(e),function(s){t&&t.nodeType,e&&e.nodeType;var r="object"==typeof n.g&&n.g;r.global!==r&&r.window!==r&&r.self;var o,a=2147483647,c=36,l=/^xn--/,d=/[^\x20-\x7E]/,u=/[\x2E\u3002\uFF0E\uFF61]/g,h={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,f=String.fromCharCode;function g(e){throw new RangeError(h[e])}function p(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function v(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+p((e=e.replace(u,".")).split("."),t).join(".")}function y(e){for(var t,n,i=[],s=0,r=e.length;s<r;)(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<r?56320==(64512&(n=e.charCodeAt(s++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),s--):i.push(t);return i}function _(e){return p(e,(function(e){var t="";return e>65535&&(t+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+f(e)})).join("")}function b(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,n){var i=0;for(e=n?m(e/700):e>>1,e+=m(e/t);e>455;i+=c)e=m(e/35);return m(i+36*e/(e+38))}function S(e){var t,n,i,s,r,o,l,d,u,h,f,p=[],v=e.length,y=0,b=128,S=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&g("not-basic"),p.push(e.charCodeAt(i));for(s=n>0?n+1:0;s<v;){for(r=y,o=1,l=c;s>=v&&g("invalid-input"),((d=(f=e.charCodeAt(s++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:c)>=c||d>m((a-y)/o))&&g("overflow"),y+=d*o,!(d<(u=l<=S?1:l>=S+26?26:l-S));l+=c)o>m(a/(h=c-u))&&g("overflow"),o*=h;S=w(y-r,t=p.length+1,0==r),m(y/t)>a-b&&g("overflow"),b+=m(y/t),y%=t,p.splice(y++,0,b)}return _(p)}function x(e){var t,n,i,s,r,o,l,d,u,h,p,v,_,S,x,E=[];for(v=(e=y(e)).length,t=128,n=0,r=72,o=0;o<v;++o)(p=e[o])<128&&E.push(f(p));for(i=s=E.length,s&&E.push("-");i<v;){for(l=a,o=0;o<v;++o)(p=e[o])>=t&&p<l&&(l=p);for(l-t>m((a-n)/(_=i+1))&&g("overflow"),n+=(l-t)*_,t=l,o=0;o<v;++o)if((p=e[o])<t&&++n>a&&g("overflow"),p==t){for(d=n,u=c;!(d<(h=u<=r?1:u>=r+26?26:u-r));u+=c)x=d-h,S=c-h,E.push(f(b(h+x%S,0))),d=m(x/S);E.push(f(b(d,0))),r=w(n,_,i==s),n=0,++i}++n,++t}return E.join("")}o={version:"1.3.2",ucs2:{decode:y,encode:_},decode:S,encode:x,toASCII:function(e){return v(e,(function(e){return d.test(e)?"xn--"+x(e):e}))},toUnicode:function(e){return v(e,(function(e){return l.test(e)?S(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return o}.call(t,n,t,e))||(e.exports=i)}()},2291:e=>{"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},791:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>NE});var i=n(5215),s=n.n(i),r=n(4223);const o={initialize(){},__(){return(0,r.sprintf)(...arguments)}},a=function(e){return null!=e&&"object"==typeof e},c="object"==typeof global&&global&&global.Object===Object&&global;var l="object"==typeof self&&self&&self.Object===Object&&self;const d=c||l||Function("return this")(),u=d.Symbol;var h=Object.prototype,m=h.hasOwnProperty,f=h.toString,g=u?u.toStringTag:void 0;var p=Object.prototype.toString;var v=u?u.toStringTag:void 0;const y=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":v&&v in Object(e)?function(e){var t=m.call(e,g),n=e[g];try{e[g]=void 0;var i=!0}catch(e){}var s=f.call(e);return i&&(t?e[g]=n:delete e[g]),s}(e):function(e){return p.call(e)}(e)},_=function(e,t){return function(n){return e(t(n))}},b=_(Object.getPrototypeOf,Object);var w=Function.prototype,S=Object.prototype,x=w.toString,E=S.hasOwnProperty,A=x.call(Object);const C=function(e){if(!a(e)||"[object Object]"!=y(e))return!1;var t=b(e);if(null===t)return!0;var n=E.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&x.call(n)==A},T=function(e){return a(e)&&1===e.nodeType&&!C(e)};var k,j,$,N;const O={debug:0,info:1,warn:2,error:3,fatal:4},I=Object.assign({debug:null!==(k=console)&&void 0!==k&&k.log?console.log.bind(console):function(){},error:null!==(j=console)&&void 0!==j&&j.log?console.log.bind(console):function(){},info:null!==($=console)&&void 0!==$&&$.log?console.log.bind(console):function(){},warn:null!==(N=console)&&void 0!==N&&N.log?console.log.bind(console):function(){}},console),M={setLogLevel(e){if(!["debug","info","warn","error","fatal"].includes(e))throw new Error(`Invalid loglevel: ${e}`);this.loglevel=e},log(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(O[t]<O[this.loglevel])return;"error"===t||"fatal"===t?n=n||"color: maroon":"debug"===t&&(n=n||"color: green"),e instanceof Error?e=e.stack:T(e)&&(e=e.outerHTML);const i=n?"%c":"";"error"===t?I.error(`${i} ERROR: ${e}`,n):"warn"===t?I.warn(`${i} ${(new Date).toISOString()} WARNING: ${e}`,n):"fatal"===t?I.error(`${i} FATAL: ${e}`,n):"debug"===t?I.debug(`${i} ${(new Date).toISOString()} DEBUG: ${e}`,n):I.info(`${i} ${(new Date).toISOString()} INFO: ${e}`,n)},debug(e,t){this.log(e,"debug",t)},error(e,t){this.log(e,"error",t)},info(e,t){this.log(e,"info",t)},warn(e,t){this.log(e,"warn",t)},fatal(e,t){this.log(e,"fatal",t)}},R=M,D=function(){let e=n.g.WebSocket;if(void 0===e)try{e=n(2291)}catch(e){throw new Error('You must install the "ws" package to use Strophe in nodejs.')}return e}(),L=function(){let e=n.g.DOMParser;if(void 0===e)try{e=n(539).DOMParser}catch(e){throw new Error('You must install the "@xmldom/xmldom" package to use Strophe in nodejs.')}return e}();const z=function(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},P=function(e){if("string"!=typeof e)throw new Error("str2binl was passed a non-string");const t=[];for(let n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return t},F=function(e,t,n,i,s,r){return z((o=z(z(t,e),z(i,r)))<<(a=s)|o>>>32-a,n);var o,a},U=function(e,t,n,i,s,r,o){return F(t&n|~t&i,e,t,s,r,o)},B=function(e,t,n,i,s,r,o){return F(t&i|n&~i,e,t,s,r,o)},q=function(e,t,n,i,s,r,o){return F(t^n^i,e,t,s,r,o)},H=function(e,t,n,i,s,r,o){return F(n^(t|~i),e,t,s,r,o)},G=function(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let n,i,s,r,o=1732584193,a=-271733879,c=-1732584194,l=271733878;for(let t=0;t<e.length;t+=16)n=o,i=a,s=c,r=l,o=U(o,a,c,l,e[t+0],7,-680876936),l=U(l,o,a,c,e[t+1],12,-389564586),c=U(c,l,o,a,e[t+2],17,606105819),a=U(a,c,l,o,e[t+3],22,-1044525330),o=U(o,a,c,l,e[t+4],7,-176418897),l=U(l,o,a,c,e[t+5],12,1200080426),c=U(c,l,o,a,e[t+6],17,-1473231341),a=U(a,c,l,o,e[t+7],22,-45705983),o=U(o,a,c,l,e[t+8],7,1770035416),l=U(l,o,a,c,e[t+9],12,-1958414417),c=U(c,l,o,a,e[t+10],17,-42063),a=U(a,c,l,o,e[t+11],22,-1990404162),o=U(o,a,c,l,e[t+12],7,1804603682),l=U(l,o,a,c,e[t+13],12,-40341101),c=U(c,l,o,a,e[t+14],17,-1502002290),a=U(a,c,l,o,e[t+15],22,1236535329),o=B(o,a,c,l,e[t+1],5,-165796510),l=B(l,o,a,c,e[t+6],9,-1069501632),c=B(c,l,o,a,e[t+11],14,643717713),a=B(a,c,l,o,e[t+0],20,-373897302),o=B(o,a,c,l,e[t+5],5,-701558691),l=B(l,o,a,c,e[t+10],9,38016083),c=B(c,l,o,a,e[t+15],14,-660478335),a=B(a,c,l,o,e[t+4],20,-405537848),o=B(o,a,c,l,e[t+9],5,568446438),l=B(l,o,a,c,e[t+14],9,-1019803690),c=B(c,l,o,a,e[t+3],14,-187363961),a=B(a,c,l,o,e[t+8],20,1163531501),o=B(o,a,c,l,e[t+13],5,-1444681467),l=B(l,o,a,c,e[t+2],9,-51403784),c=B(c,l,o,a,e[t+7],14,1735328473),a=B(a,c,l,o,e[t+12],20,-1926607734),o=q(o,a,c,l,e[t+5],4,-378558),l=q(l,o,a,c,e[t+8],11,-2022574463),c=q(c,l,o,a,e[t+11],16,1839030562),a=q(a,c,l,o,e[t+14],23,-35309556),o=q(o,a,c,l,e[t+1],4,-1530992060),l=q(l,o,a,c,e[t+4],11,1272893353),c=q(c,l,o,a,e[t+7],16,-155497632),a=q(a,c,l,o,e[t+10],23,-1094730640),o=q(o,a,c,l,e[t+13],4,681279174),l=q(l,o,a,c,e[t+0],11,-358537222),c=q(c,l,o,a,e[t+3],16,-722521979),a=q(a,c,l,o,e[t+6],23,76029189),o=q(o,a,c,l,e[t+9],4,-640364487),l=q(l,o,a,c,e[t+12],11,-421815835),c=q(c,l,o,a,e[t+15],16,530742520),a=q(a,c,l,o,e[t+2],23,-995338651),o=H(o,a,c,l,e[t+0],6,-198630844),l=H(l,o,a,c,e[t+7],10,1126891415),c=H(c,l,o,a,e[t+14],15,-1416354905),a=H(a,c,l,o,e[t+5],21,-57434055),o=H(o,a,c,l,e[t+12],6,1700485571),l=H(l,o,a,c,e[t+3],10,-1894986606),c=H(c,l,o,a,e[t+10],15,-1051523),a=H(a,c,l,o,e[t+1],21,-2054922799),o=H(o,a,c,l,e[t+8],6,1873313359),l=H(l,o,a,c,e[t+15],10,-30611744),c=H(c,l,o,a,e[t+6],15,-1560198380),a=H(a,c,l,o,e[t+13],21,1309151649),o=H(o,a,c,l,e[t+4],6,-145523070),l=H(l,o,a,c,e[t+11],10,-1120210379),c=H(c,l,o,a,e[t+2],15,718787259),a=H(a,c,l,o,e[t+9],21,-343485551),o=z(o,n),a=z(a,i),c=z(c,s),l=z(l,r);return[o,a,c,l]},W={hexdigest:function(e){return function(e){const t="0123456789abcdef";let n="";for(let i=0;i<4*e.length;i++)n+=t.charAt(e[i>>2]>>i%4*8+4&15)+t.charAt(e[i>>2]>>i%4*8&15);return n}(G(P(e),8*e.length))},hash:function(e){return function(e){let t="";for(let n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(G(P(e),8*e.length))}};class V{constructor(e,t,n){this.mechname=e,this.isClientFirst=t,this.priority=n}test(){return!0}onStart(e){this._connection=e}onChallenge(e,t){throw new Error("You should implement challenge handling!")}clientChallenge(e){if(!this.isClientFirst)throw new Error("clientChallenge should not be called if isClientFirst is false!");return this.onChallenge(e)}onFailure(){this._connection=null}onSuccess(){this._connection=null}}const J=function(e){var t,n,i="",s=e.length;for(t=0;t<s;t++)(n=e.charCodeAt(t))>=0&&n<=127?i+=e.charAt(t):n>2047?(i+=String.fromCharCode(224|n>>12&15),i+=String.fromCharCode(128|n>>6&63),i+=String.fromCharCode(128|n>>0&63)):(i+=String.fromCharCode(192|n>>6&31),i+=String.fromCharCode(128|n>>0&63));return i};function Q(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;var n,i,s,r,o,a,c,l,d=new Array(80),u=1732584193,h=-271733879,m=-1732584194,f=271733878,g=-1009589776;for(n=0;n<e.length;n+=16){for(r=u,o=h,a=m,c=f,l=g,i=0;i<80;i++)d[i]=i<16?e[n+i]:ee(d[i-3]^d[i-8]^d[i-14]^d[i-16],1),s=K(K(ee(u,5),Z(i,h,m,f)),K(K(g,d[i]),Y(i))),g=f,f=m,m=ee(h,30),h=u,u=s;u=K(u,r),h=K(h,o),m=K(m,a),f=K(f,c),g=K(g,l)}return[u,h,m,f,g]}function Z(e,t,n,i){return e<20?t&n|~t&i:e<40?t^n^i:e<60?t&n|t&i|n&i:t^n^i}function Y(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function X(e,t){var n=te(e);n.length>16&&(n=Q(n,8*e.length));for(var i=new Array(16),s=new Array(16),r=0;r<16;r++)i[r]=909522486^n[r],s[r]=1549556828^n[r];var o=Q(i.concat(te(t)),512+8*t.length);return Q(s.concat(o),672)}function K(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function ee(e,t){return e<<t|e>>>32-t}function te(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function ne(e){for(var t,n,i="",s=0;s<4*e.length;s+=3)for(t=(e[s>>2]>>8*(3-s%4)&255)<<16|(e[s+1>>2]>>8*(3-(s+1)%4)&255)<<8|e[s+2>>2]>>8*(3-(s+2)%4)&255,n=0;n<4;n++)8*s+6*n>32*e.length?i+="=":i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return i}function ie(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}const se={b64_hmac_sha1:function(e,t){return ne(X(e,t))},b64_sha1:function(e){return ne(Q(te(e),8*e.length))},binb2str:ie,core_hmac_sha1:X,str_hmac_sha1:function(e,t){return ie(X(e,t))},str_sha1:function(e){return ie(Q(te(e),8*e.length))}};var re=n(4567);function oe(e,t){return new de.Builder(e,t)}function ae(e){return new de.Builder("message",e)}function ce(e){return new de.Builder("iq",e)}function le(e){return new de.Builder("presence",e)}const de={VERSION:"1.4.4",NS:{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"},XHTML:{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"],validTag(e){for(let t=0;t<de.XHTML.tags.length;t++)if(e===de.XHTML.tags[t])return!0;return!1},validAttribute(e,t){if(void 0!==de.XHTML.attributes[e]&&de.XHTML.attributes[e].length>0)for(let n=0;n<de.XHTML.attributes[e].length;n++)if(t===de.XHTML.attributes[e][n])return!0;return!1},validCSS(e){for(let t=0;t<de.XHTML.css.length;t++)if(e===de.XHTML.css[t])return!0;return!1}},Status:{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},ErrorCondition:{BAD_FORMAT:"bad-format",CONFLICT:"conflict",MISSING_JID_NODE:"x-strophe-bad-non-anon-jid",NO_AUTH_MECH:"no-auth-mech",UNKNOWN_REASON:"unknown"},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3,CDATA:4,FRAGMENT:11},TIMEOUT:1.1,SECONDARY_TIMEOUT:.1,addNamespace(e,t){de.NS[e]=t},forEachChild(e,t,n){for(let i=0;i<e.childNodes.length;i++){const s=e.childNodes[i];s.nodeType!==de.ElementType.NORMAL||t&&!this.isTagEqual(s,t)||n(s)}},isTagEqual:(e,t)=>e.tagName===t,_xmlGenerator:null,xmlGenerator:()=>(de._xmlGenerator||(de._xmlGenerator=function(){if("undefined"==typeof document)try{return(new(0,n(539).u)).createDocument("jabber:client","strophe",null)}catch(e){throw new Error('You must install the "@xmldom/xmldom" package to use Strophe in nodejs.')}if(void 0===document.implementation.createDocument||document.implementation.createDocument&&document.documentMode&&document.documentMode<10){const e=function(){const e=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];for(let t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(e){}}();return e.appendChild(e.createElement("strophe")),e}return document.implementation.createDocument("jabber:client","strophe",null)}()),de._xmlGenerator),xmlElement(e){if(!e)return null;const t=de.xmlGenerator().createElement(e);for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)if("string"==typeof n||"number"==typeof n)t.appendChild(de.xmlTextNode(n));else if("object"==typeof n&&"function"==typeof n.sort)for(let e=0;e<n.length;e++){const i=n[e];"object"==typeof i&&"function"==typeof i.sort&&void 0!==i[1]&&null!==i[1]&&t.setAttribute(i[0],i[1])}else if("object"==typeof n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&void 0!==n[e]&&null!==n[e]&&t.setAttribute(e,n[e])}return t},xmlescape:e=>(e=(e=(e=(e=e.replace(/\&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/'/g,"&apos;")).replace(/"/g,"&quot;"),xmlunescape:e=>(e=(e=(e=(e=e.replace(/\&amp;/g,"&")).replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&apos;/g,"'")).replace(/&quot;/g,'"'),xmlTextNode:e=>de.xmlGenerator().createTextNode(e),xmlHtmlNode(e){let t;return L?t=(new L).parseFromString(e,"text/xml"):(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)),t},getText(e){if(!e)return null;let t="";0===e.childNodes.length&&e.nodeType===de.ElementType.TEXT&&(t+=e.nodeValue);for(let n=0;n<e.childNodes.length;n++)e.childNodes[n].nodeType===de.ElementType.TEXT&&(t+=e.childNodes[n].nodeValue);return de.xmlescape(t)},copyElement(e){let t;if(e.nodeType===de.ElementType.NORMAL){t=de.xmlElement(e.tagName);for(let n=0;n<e.attributes.length;n++)t.setAttribute(e.attributes[n].nodeName,e.attributes[n].value);for(let n=0;n<e.childNodes.length;n++)t.appendChild(de.copyElement(e.childNodes[n]))}else e.nodeType===de.ElementType.TEXT&&(t=de.xmlGenerator().createTextNode(e.nodeValue));return t},createHtml(e){let t;if(e.nodeType===de.ElementType.NORMAL){const n=e.nodeName.toLowerCase();if(de.XHTML.validTag(n))try{t=de.xmlElement(n);for(let i=0;i<de.XHTML.attributes[n].length;i++){const s=de.XHTML.attributes[n][i];let r=e.getAttribute(s);if(null!=r&&""!==r&&!1!==r&&0!==r)if("style"===s&&"object"==typeof r&&void 0!==r.cssText&&(r=r.cssText),"style"===s){const e=[],n=r.split(";");for(let t=0;t<n.length;t++){const i=n[t].split(":"),s=i[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase();if(de.XHTML.validCSS(s)){const t=i[1].replace(/^\s*/,"").replace(/\s*$/,"");e.push(s+": "+t)}}e.length>0&&(r=e.join("; "),t.setAttribute(s,r))}else t.setAttribute(s,r)}for(let n=0;n<e.childNodes.length;n++)t.appendChild(de.createHtml(e.childNodes[n]))}catch(e){t=de.xmlTextNode("")}else{t=de.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(de.createHtml(e.childNodes[n]))}}else if(e.nodeType===de.ElementType.FRAGMENT){t=de.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(de.createHtml(e.childNodes[n]))}else e.nodeType===de.ElementType.TEXT&&(t=de.xmlTextNode(e.nodeValue));return t},escapeNode:e=>"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40"),unescapeNode:e=>"string"!=typeof e?e:e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\"),getNodeFromJid:e=>e.indexOf("@")<0?null:e.split("@")[0],getDomainFromJid(e){const t=de.getBareJidFromJid(e);if(t.indexOf("@")<0)return t;{const e=t.split("@");return e.splice(0,1),e.join("@")}},getResourceFromJid(e){if(!e)return null;const t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))},getBareJidFromJid:e=>e?e.split("/")[0]:null,_handleError(e){void 0!==e.stack&&de.fatal(e.stack),e.sourceURL?de.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?de.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):de.fatal("error: "+e.message)},log(e,t){var n;e===this.LogLevel.FATAL&&(null===(n=console)||void 0===n||n.error(t))},debug(e){this.log(this.LogLevel.DEBUG,e)},info(e){this.log(this.LogLevel.INFO,e)},warn(e){this.log(this.LogLevel.WARN,e)},error(e){this.log(this.LogLevel.ERROR,e)},fatal(e){this.log(this.LogLevel.FATAL,e)},serialize(e){if(!e)return null;"function"==typeof e.tree&&(e=e.tree());const t=[...Array(e.attributes.length).keys()].map((t=>e.attributes[t].nodeName));t.sort();let n=t.reduce(((t,n)=>`${t} ${n}="${de.xmlescape(e.attributes.getNamedItem(n).value)}"`),`<${e.nodeName}`);if(e.childNodes.length>0){n+=">";for(let t=0;t<e.childNodes.length;t++){const i=e.childNodes[t];switch(i.nodeType){case de.ElementType.NORMAL:n+=de.serialize(i);break;case de.ElementType.TEXT:n+=de.xmlescape(i.nodeValue);break;case de.ElementType.CDATA:n+="<![CDATA["+i.nodeValue+"]]>"}}n+="</"+e.nodeName+">"}else n+="/>";return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin(e,t){de._connectionPlugins[e]=t},Builder:class{constructor(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=de.NS.CLIENT:t||(t={xmlns:de.NS.CLIENT})),this.nodeTree=de.xmlElement(e,t),this.node=this.nodeTree}tree(){return this.nodeTree}toString(){return de.serialize(this.nodeTree)}up(){return this.node=this.node.parentNode,this}root(){return this.node=this.nodeTree,this}attrs(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===e[t]?this.node.removeAttribute(t):this.node.setAttribute(t,e[t]));return this}c(e,t,n){const i=de.xmlElement(e,t,n);return this.node.appendChild(i),"string"!=typeof n&&"number"!=typeof n&&(this.node=i),this}cnode(e){let t;const n=de.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}const i=t?n.importNode(e,!0):de.copyElement(e);return this.node.appendChild(i),this.node=i,this}t(e){const t=de.xmlTextNode(e);return this.node.appendChild(t),this}h(e){const t=de.xmlGenerator().createElement("body");t.innerHTML=e;const n=de.createHtml(t);for(;n.childNodes.length>0;)this.node.appendChild(n.childNodes[0]);return this}},Handler:function(e,t,n,i,s,r,o){this.handler=e,this.ns=t,this.name=n,this.type=i,this.id=s,this.options=o||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},this.options.matchBare&&(de.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'),this.options.matchBareFromJid=this.options.matchBare,delete this.options.matchBare),this.options.matchBareFromJid?this.from=r?de.getBareJidFromJid(r):null:this.from=r,this.user=!0}};de.Handler.prototype={getNamespace(e){let t=e.getAttribute("xmlns");return t&&this.options.ignoreNamespaceFragment&&(t=t.split("#")[0]),t},namespaceMatch(e){let t=!1;return!this.ns||(de.forEachChild(e,null,(e=>{this.getNamespace(e)===this.ns&&(t=!0)})),t||this.getNamespace(e)===this.ns)},isMatch(e){let t=e.getAttribute("from");this.options.matchBareFromJid&&(t=de.getBareJidFromJid(t));const n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!de.isTagEqual(e,this.name)||this.type&&(Array.isArray(this.type)?-1===this.type.indexOf(n):n!==this.type)||this.id&&e.getAttribute("id")!==this.id||this.from&&t!==this.from)},run(e){let t=null;try{t=this.handler(e)}catch(e){throw de._handleError(e),e}return t},toString(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},de.TimedHandler=class{constructor(e,t){this.period=e,this.handler=t,this.lastCalled=(new Date).getTime(),this.user=!0}run(){return this.lastCalled=(new Date).getTime(),this.handler()}reset(){this.lastCalled=(new Date).getTime()}toString(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}},de.Connection=class{constructor(e,t){this.service=e,this.options=t||{},this.setProtocol(),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_bind=!1,this.do_session=!1,this.mechanisms={},this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.protocolErrorHandlers={HTTP:{},websocket:{}},this._idleTimeout=null,this._disconnectTimeout=null,this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,this._data=[],this._uniqueId=0,this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout((()=>this._onIdle()),100),function(e){e=e||{};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n="",i="",s="";const r=e[t],o="object"==typeof r,a=escape(unescape(o?r.value:r));o&&(n=r.expires?";expires="+r.expires:"",i=r.domain?";domain="+r.domain:"",s=r.path?";path="+r.path:""),document.cookie=t+"="+a+n+i+s}}(this.options.cookies),this.registerSASLMechanisms(this.options.mechanisms);for(const e in de._connectionPlugins)if(Object.prototype.hasOwnProperty.call(de._connectionPlugins,e)){const t=function(){};t.prototype=de._connectionPlugins[e],this[e]=new t,this[e].init(this)}}setProtocol(){const e=this.options.protocol||"";this.options.worker?this._proto=new de.WorkerWebsocket(this):0===this.service.indexOf("ws:")||0===this.service.indexOf("wss:")||0===e.indexOf("ws")?this._proto=new de.Websocket(this):this._proto=new de.Bosh(this)}reset(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0}pause(){this.paused=!0}resume(){this.paused=!1}getUniqueId(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t+""}addProtocolErrorHandler(e,t,n){this.protocolErrorHandlers[e][t]=n}connect(e,t,n,i,s,r,o){let a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:3e3;this.jid=e,this.authzid=de.getBareJidFromJid(this.jid),this.authcid=o||de.getNodeFromJid(this.jid),this.pass=t,this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.disconnection_timeout=a,this.domain=de.getDomainFromJid(this.jid),this._changeConnectStatus(de.Status.CONNECTING,null),this._proto._connect(i,s,r)}attach(e,t,n,i,s,r,o){if(this._proto._attach)return this._proto._attach(e,t,n,i,s,r,o);{const e=new Error('The "attach" method is not available for your connection protocol');throw e.name="StropheSessionError",e}}restore(e,t,n,i,s){if(!this._sessionCachingSupported()){const e=new Error('The "restore" method can only be used with a BOSH connection.');throw e.name="StropheSessionError",e}this._proto._restore(e,t,n,i,s)}_sessionCachingSupported(){if(this._proto instanceof de.Bosh){if(!JSON)return!1;try{sessionStorage.setItem("_strophe_","_strophe_"),sessionStorage.removeItem("_strophe_")}catch(e){return!1}return!0}return!1}xmlInput(e){}xmlOutput(e){}rawInput(e){}rawOutput(e){}nextValidRid(e){}send(e){if(null!==e){if("function"==typeof e.sort)for(let t=0;t<e.length;t++)this._queueData(e[t]);else"function"==typeof e.tree?this._queueData(e.tree()):this._queueData(e);this._proto._send()}}flush(){clearTimeout(this._idleTimeout),this._onIdle()}sendPresence(e,t,n,i){let s=null;"function"==typeof e.tree&&(e=e.tree());let r=e.getAttribute("id");if(r||(r=this.getUniqueId("sendPresence"),e.setAttribute("id",r)),"function"==typeof t||"function"==typeof n){const e=this.addHandler((e=>{s&&this.deleteTimedHandler(s),"error"===e.getAttribute("type")?n&&n(e):t&&t(e)}),null,"presence",null,r);i&&(s=this.addTimedHandler(i,(()=>(this.deleteHandler(e),n&&n(null),!1))))}return this.send(e),r}sendIQ(e,t,n,i){let s=null;"function"==typeof e.tree&&(e=e.tree());let r=e.getAttribute("id");if(r||(r=this.getUniqueId("sendIQ"),e.setAttribute("id",r)),"function"==typeof t||"function"==typeof n){const e=this.addHandler((e=>{s&&this.deleteTimedHandler(s);const i=e.getAttribute("type");if("result"===i)t&&t(e);else{if("error"!==i){const e=new Error(`Got bad IQ type of ${i}`);throw e.name="StropheError",e}n&&n(e)}}),null,"iq",["error","result"],r);i&&(s=this.addTimedHandler(i,(()=>(this.deleteHandler(e),n&&n(null),!1))))}return this.send(e),r}_queueData(e){if(null===e||!e.tagName||!e.childNodes){const e=new Error("Cannot queue non-DOMElement.");throw e.name="StropheError",e}this._data.push(e)}_sendRestart(){this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout((()=>this._onIdle()),100)}addTimedHandler(e,t){const n=new de.TimedHandler(e,t);return this.addTimeds.push(n),n}deleteTimedHandler(e){this.removeTimeds.push(e)}addHandler(e,t,n,i,s,r,o){const a=new de.Handler(e,t,n,i,s,r,o);return this.addHandlers.push(a),a}deleteHandler(e){this.removeHandlers.push(e);const t=this.addHandlers.indexOf(e);t>=0&&this.addHandlers.splice(t,1)}registerSASLMechanisms(e){this.mechanisms={},(e=e||[de.SASLAnonymous,de.SASLExternal,de.SASLOAuthBearer,de.SASLXOAuth2,de.SASLPlain,de.SASLSHA1]).forEach((e=>this.registerSASLMechanism(e)))}registerSASLMechanism(e){const t=new e;this.mechanisms[t.mechname]=t}disconnect(e){if(this._changeConnectStatus(de.Status.DISCONNECTING,e),e?de.warn("Disconnect was called because: "+e):de.info("Disconnect was called"),this.connected){let e=!1;this.disconnecting=!0,this.authenticated&&(e=le({xmlns:de.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(this.disconnection_timeout,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(e)}else de.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()}_changeConnectStatus(e,t,n){for(const n in de._connectionPlugins)if(Object.prototype.hasOwnProperty.call(de._connectionPlugins,n)){const i=this[n];if(i.statusChanged)try{i.statusChanged(e,t)}catch(e){de.error(`${n} plugin caused an exception changing status: ${e}`)}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){de._handleError(e),de.error(`User connection callback caused an exception: ${e}`)}}_doDisconnect(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),de.debug("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(de.Status.DISCONNECTED,e),this.connected=!1}_dataRecv(e,t){const n=this._proto._reqToData(e);if(null===n)return;for(this.xmlInput!==de.Connection.prototype.xmlInput&&(n.nodeName===this._proto.strip&&n.childNodes.length?this.xmlInput(n.childNodes[0]):this.xmlInput(n)),this.rawInput!==de.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(de.serialize(n)));this.removeHandlers.length>0;){const e=this.removeHandlers.pop(),t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())return void this._doDisconnect();const i=n.getAttribute("type");if(null!==i&&"terminate"===i){if(this.disconnecting)return;let e=n.getAttribute("condition");const t=n.getElementsByTagName("conflict");return null!==e?("remote-stream-error"===e&&t.length>0&&(e="conflict"),this._changeConnectStatus(de.Status.CONNFAIL,e)):this._changeConnectStatus(de.Status.CONNFAIL,de.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(e)}de.forEachChild(n,null,(e=>{const t=this.handlers;this.handlers=[];for(let n=0;n<t.length;n++){const i=t[n];try{(!i.isMatch(e)||!this.authenticated&&i.user||i.run(e))&&this.handlers.push(i)}catch(e){de.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}}))}_connect_cb(e,t,n){let i,s;de.debug("_connect_cb was called"),this.connected=!0;try{i=this._proto._reqToData(e)}catch(e){if(e.name!==de.ErrorCondition.BAD_FORMAT)throw e;this._changeConnectStatus(de.Status.CONNFAIL,de.ErrorCondition.BAD_FORMAT),this._doDisconnect(de.ErrorCondition.BAD_FORMAT)}if(!i)return;if(this.xmlInput!==de.Connection.prototype.xmlInput&&(i.nodeName===this._proto.strip&&i.childNodes.length?this.xmlInput(i.childNodes[0]):this.xmlInput(i)),this.rawInput!==de.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(de.serialize(i))),this._proto._connect_cb(i)===de.Status.CONNFAIL)return;if(s=i.getElementsByTagNameNS?i.getElementsByTagNameNS(de.NS.STREAM,"features").length>0:i.getElementsByTagName("stream:features").length>0||i.getElementsByTagName("features").length>0,!s)return void this._proto._no_auth_received(t);const r=Array.from(i.getElementsByTagName("mechanism")).map((e=>this.mechanisms[e.textContent])).filter((e=>e));0!==r.length||0!==i.getElementsByTagName("auth").length?!1!==this.do_authentication&&this.authenticate(r):this._proto._no_auth_received(t)}sortMechanismsByPriority(e){for(let t=0;t<e.length-1;++t){let n=t;for(let i=t+1;i<e.length;++i)e[i].priority>e[n].priority&&(n=i);if(n!==t){const i=e[t];e[t]=e[n],e[n]=i}}return e}authenticate(e){this._attemptSASLAuth(e)||this._attemptLegacyAuth()}_attemptSASLAuth(e){e=this.sortMechanismsByPriority(e||[]);let t=!1;for(let n=0;n<e.length;++n){if(!e[n].test(this))continue;this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge_cb.bind(this),null,"challenge",null,null),this._sasl_mechanism=e[n],this._sasl_mechanism.onStart(this);const i=oe("auth",{xmlns:de.NS.SASL,mechanism:this._sasl_mechanism.mechname});if(this._sasl_mechanism.isClientFirst){const e=this._sasl_mechanism.clientChallenge(this);i.t((0,re.btoa)(e))}this.send(i.tree()),t=!0;break}return t}_sasl_challenge_cb(e){const t=(0,re.atob)(de.getText(e)),n=this._sasl_mechanism.onChallenge(this,t),i=oe("response",{xmlns:de.NS.SASL});return""!==n&&i.t((0,re.btoa)(n)),this.send(i.tree()),!0}_attemptLegacyAuth(){null===de.getNodeFromJid(this.jid)?(this._changeConnectStatus(de.Status.CONNFAIL,de.ErrorCondition.MISSING_JID_NODE),this.disconnect(de.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(de.Status.AUTHENTICATING,null),this._addSysHandler(this._onLegacyAuthIQResult.bind(this),null,null,null,"_auth_1"),this.send(ce({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:de.NS.AUTH}).c("username",{}).t(de.getNodeFromJid(this.jid)).tree()))}_onLegacyAuthIQResult(e){const t=ce({type:"set",id:"_auth_2"}).c("query",{xmlns:de.NS.AUTH}).c("username",{}).t(de.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return de.getResourceFromJid(this.jid)||(this.jid=de.getBareJidFromJid(this.jid)+"/strophe"),t.up().c("resource",{}).t(de.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(t.tree()),!1}_sasl_success_cb(e){if(this._sasl_data["server-signature"]){let t;const n=/([a-z]+)=([^,]+)(,|$)/,i=(0,re.atob)(de.getText(e)).match(n);if("v"===i[1]&&(t=i[2]),t!==this._sasl_data["server-signature"])return this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_data={},this._sasl_failure_cb(null)}de.info("SASL authentication succeeded."),this._sasl_mechanism&&this._sasl_mechanism.onSuccess(),this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null);const t=[],n=(e,t)=>{for(;e.length;)this.deleteHandler(e.pop());return this._onStreamFeaturesAfterSASL(t),!1};return t.push(this._addSysHandler((e=>n(t,e)),null,"stream:features",null,null)),t.push(this._addSysHandler((e=>n(t,e)),de.NS.STREAM,"features",null,null)),this._sendRestart(),!1}_onStreamFeaturesAfterSASL(e){this.features=e;for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];"bind"===n.nodeName&&(this.do_bind=!0),"session"===n.nodeName&&(this.do_session=!0)}return this.do_bind?(this.options.explicitResourceBinding?this._changeConnectStatus(de.Status.BINDREQUIRED,null):this.bind(),!1):(this._changeConnectStatus(de.Status.AUTHFAIL,null),!1)}bind(){if(!this.do_bind)return void de.log(de.LogLevel.INFO,'Strophe.Connection.prototype.bind called but "do_bind" is false');this._addSysHandler(this._onResourceBindResultIQ.bind(this),null,null,null,"_bind_auth_2");const e=de.getResourceFromJid(this.jid);e?this.send(ce({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:de.NS.BIND}).c("resource",{}).t(e).tree()):this.send(ce({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:de.NS.BIND}).tree())}_onResourceBindResultIQ(e){if("error"===e.getAttribute("type")){let t;return de.warn("Resource binding failed."),e.getElementsByTagName("conflict").length>0&&(t=de.ErrorCondition.CONFLICT),this._changeConnectStatus(de.Status.AUTHFAIL,t,e),!1}const t=e.getElementsByTagName("bind");if(!(t.length>0))return de.warn("Resource binding failed."),this._changeConnectStatus(de.Status.AUTHFAIL,null,e),!1;{const e=t[0].getElementsByTagName("jid");e.length>0&&(this.authenticated=!0,this.jid=de.getText(e[0]),this.do_session?this._establishSession():this._changeConnectStatus(de.Status.CONNECTED,null))}}_establishSession(){if(!this.do_session)throw new Error(`Strophe.Connection.prototype._establishSession called but apparently ${de.NS.SESSION} wasn't advertised by the server`);this._addSysHandler(this._onSessionResultIQ.bind(this),null,null,null,"_session_auth_2"),this.send(ce({type:"set",id:"_session_auth_2"}).c("session",{xmlns:de.NS.SESSION}).tree())}_onSessionResultIQ(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(de.Status.CONNECTED,null);else if("error"===e.getAttribute("type"))return this.authenticated=!1,de.warn("Session creation failed."),this._changeConnectStatus(de.Status.AUTHFAIL,null,e),!1;return!1}_sasl_failure_cb(e){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_mechanism&&this._sasl_mechanism.onFailure(),this._changeConnectStatus(de.Status.AUTHFAIL,null,e),!1}_auth2_cb(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(de.Status.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(de.Status.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1}_addSysTimedHandler(e,t){const n=new de.TimedHandler(e,t);return n.user=!1,this.addTimeds.push(n),n}_addSysHandler(e,t,n,i,s){const r=new de.Handler(e,t,n,i,s);return r.user=!1,this.addHandlers.push(r),r}_onDisconnectTimeout(){return de.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(de.Status.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1}_onIdle(){for(;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;){const e=this.removeTimeds.pop(),t=this.timedHandlers.indexOf(e);t>=0&&this.timedHandlers.splice(t,1)}const e=(new Date).getTime(),t=[];for(let n=0;n<this.timedHandlers.length;n++){const i=this.timedHandlers[n];!this.authenticated&&i.user||(i.lastCalled+i.period-e<=0?i.run()&&t.push(i):t.push(i))}this.timedHandlers=t,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout((()=>this._onIdle()),100))}},de.SASLMechanism=V,de.SASLAnonymous=class extends V{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ANONYMOUS",arguments.length>1&&void 0!==arguments[1]&&arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:20)}test(e){return null===e.authcid}},de.SASLPlain=class extends V{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"PLAIN",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:50)}test(e){return null!==e.authcid}onChallenge(e){const{authcid:t,authzid:n,domain:i,pass:s}=e;if(!i)throw new Error("SASLPlain onChallenge: domain is not defined!");let r=n!==`${t}@${i}`?n:"";return r+="\0",r+=t,r+="\0",r+=s,J(r)}},de.SASLSHA1=class extends V{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SCRAM-SHA-1",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:60)}test(e){return null!==e.authcid}onChallenge(e,t){let n,i,s,r,o,a,c,l,d="c=biws,",u=`${e._sasl_data["client-first-message-bare"]},${t},`;const h=e._sasl_data.cnonce,m=/([a-z]+)=([^,]+)(,|$)/;for(;t.match(m);){const e=t.match(m);switch(t=t.replace(e[0],""),e[1]){case"r":n=e[2];break;case"s":i=e[2];break;case"i":s=e[2]}}if(n.substr(0,h.length)!==h)return e._sasl_data={},e._sasl_failure_cb();d+="r="+n,u+=d,i=atob(i),i+="\0\0\0";const f=J(e.pass);for(r=a=se.core_hmac_sha1(f,i),c=1;c<s;c++){for(o=se.core_hmac_sha1(f,se.binb2str(a)),l=0;l<5;l++)r[l]^=o[l];a=o}r=se.binb2str(r);const g=se.core_hmac_sha1(r,"Client Key"),p=se.str_hmac_sha1(r,"Server Key"),v=se.core_hmac_sha1(se.str_sha1(se.binb2str(g)),u);for(e._sasl_data["server-signature"]=se.b64_hmac_sha1(p,u),l=0;l<5;l++)g[l]^=v[l];return d+=",p="+btoa(se.binb2str(g)),d}clientChallenge(e,t){const n=t||W.hexdigest(""+1234567890*Math.random());let i="n="+J(e.authcid);return i+=",r=",i+=n,e._sasl_data.cnonce=n,e._sasl_data["client-first-message-bare"]=i,i="n,,"+i,i}},de.SASLOAuthBearer=class extends V{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"OAUTHBEARER",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:40)}test(e){return null!==e.pass}onChallenge(e){let t="n,";return null!==e.authcid&&(t=t+"a="+e.authzid),t+=",",t+="",t+="auth=Bearer ",t+=e.pass,t+="",t+="",J(t)}},de.SASLExternal=class extends V{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"EXTERNAL",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:10)}onChallenge(e){return e.authcid===e.authzid?"":e.authzid}},de.SASLXOAuth2=class extends V{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"X-OAUTH2",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:30)}test(e){return null!==e.pass}onChallenge(e){let t="\0";return null!==e.authcid&&(t+=e.authzid),t+="\0",t+=e.pass,J(t)}};const ue={Strophe:de,$build:oe,$iq:ce,$msg:ae,$pres:le,SHA1:se,MD5:W,b64_hmac_sha1:se.b64_hmac_sha1,b64_sha1:se.b64_sha1,str_hmac_sha1:se.str_hmac_sha1,str_sha1:se.str_sha1};de.Request=class{constructor(e,t,n,i){this.id=++de._requestId,this.xmlData=e,this.data=de.serialize(e),this.origFunc=t,this.func=t,this.rid=n,this.date=NaN,this.sends=i||0,this.abort=!1,this.dead=null,this.age=function(){return this.date?(new Date-this.date)/1e3:0},this.timeDead=function(){return this.dead?(new Date-this.dead)/1e3:0},this.xhr=this._newXHR()}getResponse(){let e=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){if(e=this.xhr.responseXML.documentElement,"parsererror"===e.tagName)throw de.error("invalid response received"),de.error("responseText: "+this.xhr.responseText),de.error("responseXML: "+de.serialize(this.xhr.responseXML)),new Error("parsererror")}else if(this.xhr.responseText){if(de.debug("Got responseText but no responseXML; attempting to parse it with DOMParser..."),e=(new L).parseFromString(this.xhr.responseText,"application/xml").documentElement,!e)throw new Error("Parsing produced null node");if(e.querySelector("parsererror")){de.error("invalid response received: "+e.querySelector("parsererror").textContent),de.error("responseText: "+this.xhr.responseText);const t=new Error;throw t.name=de.ErrorCondition.BAD_FORMAT,t}}return e}_newXHR(){let e=null;return window.XMLHttpRequest?(e=new XMLHttpRequest,e.overrideMimeType&&e.overrideMimeType("text/xml; charset=utf-8")):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP")),e.onreadystatechange=this.func.bind(null,this),e}},de.Bosh=class e{constructor(e){this._conn=e,this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.hold=1,this.wait=60,this.window=5,this.errors=0,this.inactivity=null,this.lastResponseHeaders=null,this._requests=[]}_buildBody(){const e=oe("body",{rid:this.rid++,xmlns:de.NS.HTTPBIND});return null!==this.sid&&e.attrs({sid:this.sid}),this._conn.options.keepalive&&this._conn._sessionCachingSupported()&&this._cacheSession(),e}_reset(){this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.errors=0,this._conn._sessionCachingSupported()&&window.sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)}_connect(e,t,n){this.wait=e||this.wait,this.hold=t||this.hold,this.errors=0;const i=this._buildBody().attrs({to:this._conn.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":de.NS.BOSH});n&&i.attrs({route:n});const s=this._conn._connect_cb;this._requests.push(new de.Request(i.tree(),this._onRequestStateChange.bind(this,s.bind(this._conn)),i.tree().getAttribute("rid"))),this._throttledRequestHandler()}_attach(e,t,n,i,s,r,o){this._conn.jid=e,this.sid=t,this.rid=n,this._conn.connect_callback=i,this._conn.domain=de.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=s||this.wait,this.hold=r||this.hold,this.window=o||this.window,this._conn._changeConnectStatus(de.Status.ATTACHED,null)}_restore(e,t,n,i,s){const r=JSON.parse(window.sessionStorage.getItem("strophe-bosh-session"));if(!(null!=r&&r.rid&&r.sid&&r.jid&&(null==e||de.getBareJidFromJid(r.jid)===de.getBareJidFromJid(e)||null===de.getNodeFromJid(e)&&de.getDomainFromJid(r.jid)===e))){const e=new Error("_restore: no restoreable session.");throw e.name="StropheSessionError",e}this._conn.restored=!0,this._attach(r.jid,r.sid,r.rid,t,n,i,s)}_cacheSession(){this._conn.authenticated?this._conn.jid&&this.rid&&this.sid&&window.sessionStorage.setItem("strophe-bosh-session",JSON.stringify({jid:this._conn.jid,rid:this.rid,sid:this.sid})):window.sessionStorage.removeItem("strophe-bosh-session")}_connect_cb(e){const t=e.getAttribute("type");if(null!==t&&"terminate"===t){let t=e.getAttribute("condition");de.error("BOSH-Connection failed: "+t);const n=e.getElementsByTagName("conflict");return null!==t?("remote-stream-error"===t&&n.length>0&&(t="conflict"),this._conn._changeConnectStatus(de.Status.CONNFAIL,t)):this._conn._changeConnectStatus(de.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(t),de.Status.CONNFAIL}this.sid||(this.sid=e.getAttribute("sid"));const n=e.getAttribute("requests");n&&(this.window=parseInt(n,10));const i=e.getAttribute("hold");i&&(this.hold=parseInt(i,10));const s=e.getAttribute("wait");s&&(this.wait=parseInt(s,10));const r=e.getAttribute("inactivity");r&&(this.inactivity=parseInt(r,10))}_disconnect(e){this._sendTerminate(e)}_doDisconnect(){this.sid=null,this.rid=Math.floor(4294967295*Math.random()),this._conn._sessionCachingSupported()&&window.sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)}_emptyQueue(){return 0===this._requests.length}_callProtocolErrorHandlers(t){const n=e._getRequestStatus(t),i=this._conn.protocolErrorHandlers.HTTP[n];i&&i.call(this,n)}_hitError(e){this.errors++,de.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(e){de.warn("Server did not yet offer a supported authentication mechanism. Sending a blank poll request."),e=e?e.bind(this._conn):this._conn._connect_cb.bind(this._conn);const t=this._buildBody();this._requests.push(new de.Request(t.tree(),this._onRequestStateChange.bind(this,e),t.tree().getAttribute("rid"))),this._throttledRequestHandler()}_onDisconnectTimeout(){this._abortAllRequests()}_abortAllRequests(){for(;this._requests.length>0;){const e=this._requests.pop();e.abort=!0,e.xhr.abort(),e.xhr.onreadystatechange=function(){}}}_onIdle(){const e=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===e.length&&!this._conn.disconnecting&&(de.debug("no requests during idle cycle, sending blank request"),e.push(null)),!this._conn.paused){if(this._requests.length<2&&e.length>0){const t=this._buildBody();for(let n=0;n<e.length;n++)null!==e[n]&&("restart"===e[n]?t.attrs({to:this._conn.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":de.NS.BOSH}):t.cnode(e[n]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new de.Request(t.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),t.tree().getAttribute("rid"))),this._throttledRequestHandler()}if(this._requests.length>0){const e=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(de.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(de.TIMEOUT*this.wait)&&(de.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(de.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}}static _getRequestStatus(e,t){let n;if(4===e.xhr.readyState)try{n=e.xhr.status}catch(e){de.error("Caught an error while retrieving a request's status, reqStatus: "+n)}return void 0===n&&(n="number"==typeof t?t:0),n}_onRequestStateChange(t,n){if(de.debug("request id "+n.id+"."+n.sends+" state changed to "+n.xhr.readyState),n.abort)return void(n.abort=!1);if(4!==n.xhr.readyState)return;const i=e._getRequestStatus(n);if(this.lastResponseHeaders=n.xhr.getAllResponseHeaders(),this._conn.disconnecting&&i>=400)return this._hitError(i),void this._callProtocolErrorHandlers(n);const s=i>0&&i<500,r=n.sends>this._conn.maxRetries;if((s||r)&&(this._removeRequest(n),de.debug("request id "+n.id+" should now be removed")),200===i){const e=this._requests[0]===n;(this._requests[1]===n||e&&this._requests.length>0&&this._requests[0].age()>Math.floor(de.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),de.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0}else 0===i||i>=400&&i<600||i>=12e3?(de.error("request id "+n.id+"."+n.sends+" error "+i+" happened"),this._hitError(i),this._callProtocolErrorHandlers(n),i>=400&&i<500&&(this._conn._changeConnectStatus(de.Status.DISCONNECTING,null),this._conn._doDisconnect())):de.error("request id "+n.id+"."+n.sends+" error "+i+" happened");s||r?r&&!this._conn.connected&&this._conn._changeConnectStatus(de.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}_processRequest(t){let n=this._requests[t];const i=e._getRequestStatus(n,-1);if(n.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();const s=n.age(),r=!isNaN(s)&&s>Math.floor(de.TIMEOUT*this.wait),o=null!==n.dead&&n.timeDead()>Math.floor(de.SECONDARY_TIMEOUT*this.wait),a=4===n.xhr.readyState&&(i<1||i>=500);if((r||o||a)&&(o&&de.error(`Request ${this._requests[t].id} timed out (secondary), restarting`),n.abort=!0,n.xhr.abort(),n.xhr.onreadystatechange=function(){},this._requests[t]=new de.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[t]),0===n.xhr.readyState){de.debug("request id "+n.id+"."+n.sends+" posting");try{const e=this._conn.options.contentType||"text/xml; charset=utf-8";n.xhr.open("POST",this._conn.service,!this._conn.options.sync),void 0!==n.xhr.setRequestHeader&&n.xhr.setRequestHeader("Content-Type",e),this._conn.options.withCredentials&&(n.xhr.withCredentials=!0)}catch(e){return de.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(de.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}const e=()=>{if(n.date=new Date,this._conn.options.customHeaders){const e=this._conn.options.customHeaders;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.xhr.setRequestHeader(t,e[t])}n.xhr.send(n.data)};if(n.sends>1){const t=1e3*Math.min(Math.floor(de.TIMEOUT*this.wait),Math.pow(n.sends,3));setTimeout((function(){e()}),t)}else e();n.sends++,this._conn.xmlOutput!==de.Connection.prototype.xmlOutput&&(n.xmlData.nodeName===this.strip&&n.xmlData.childNodes.length?this._conn.xmlOutput(n.xmlData.childNodes[0]):this._conn.xmlOutput(n.xmlData)),this._conn.rawOutput!==de.Connection.prototype.rawOutput&&this._conn.rawOutput(n.data)}else de.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+n.xhr.readyState)}_removeRequest(e){de.debug("removing request");for(let t=this._requests.length-1;t>=0;t--)e===this._requests[t]&&this._requests.splice(t,1);e.xhr.onreadystatechange=function(){},this._throttledRequestHandler()}_restartRequest(e){const t=this._requests[e];null===t.dead&&(t.dead=new Date),this._processRequest(e)}_reqToData(e){try{return e.getResponse()}catch(e){if("parsererror"!==e.message)throw e;this._conn.disconnect("strophe-parsererror")}}_sendTerminate(e){de.debug("_sendTerminate was called");const t=this._buildBody().attrs({type:"terminate"});e&&t.cnode(e.tree());const n=new de.Request(t.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),t.tree().getAttribute("rid"));this._requests.push(n),this._throttledRequestHandler()}_send(){clearTimeout(this._conn._idleTimeout),this._throttledRequestHandler(),this._conn._idleTimeout=setTimeout((()=>this._conn._onIdle()),100)}_sendRestart(){this._throttledRequestHandler(),clearTimeout(this._conn._idleTimeout)}_throttledRequestHandler(){this._requests?de.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):de.debug("_throttledRequestHandler called with undefined requests"),this._requests&&0!==this._requests.length&&(this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window&&this._processRequest(1))}},de.Bosh.prototype.strip=null,de.Websocket=class{constructor(e){this._conn=e,this.strip="wrapper";const t=e.service;if(0!==t.indexOf("ws:")&&0!==t.indexOf("wss:")){let n="";"ws"===e.options.protocol&&"https:"!==window.location.protocol?n+="ws":n+="wss",n+="://"+window.location.host,0!==t.indexOf("/")?n+=window.location.pathname+t:n+=t,e.service=n}}_buildStream(){return oe("open",{xmlns:de.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(e,t){let n;if(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(de.NS.STREAM,"error"):e.getElementsByTagName("stream:error"),0===n.length)return!1;const i=n[0];let s="",r="";for(let e=0;e<i.childNodes.length;e++){const t=i.childNodes[e];if("urn:ietf:params:xml:ns:xmpp-streams"!==t.getAttribute("xmlns"))break;"text"===t.nodeName?r=t.textContent:s=t.nodeName}let o="WebSocket stream error: ";return o+=s||"unknown",r&&(o+=" - "+r),de.error(o),this._conn._changeConnectStatus(t,s),this._conn._doDisconnect(),!0}_reset(){}_connect(){this._closeSocket(),this.socket=new D(this._conn.service,"xmpp"),this.socket.onopen=()=>this._onOpen(),this.socket.onerror=e=>this._onError(e),this.socket.onclose=e=>this._onClose(e),this.socket.onmessage=e=>this._onInitialMessage(e)}_connect_cb(e){if(this._checkStreamError(e,de.Status.CONNFAIL))return de.Status.CONNFAIL}_handleStreamStart(e){let t=!1;const n=e.getAttribute("xmlns");"string"!=typeof n?t="Missing xmlns in <open />":n!==de.NS.FRAMING&&(t="Wrong xmlns in <open />: "+n);const i=e.getAttribute("version");return"string"!=typeof i?t="Missing version in <open />":"1.0"!==i&&(t="Wrong version in <open />: "+i),!t||(this._conn._changeConnectStatus(de.Status.CONNFAIL,t),this._conn._doDisconnect(),!1)}_onInitialMessage(e){if(0===e.data.indexOf("<open ")||0===e.data.indexOf("<?xml")){const t=e.data.replace(/^(<\?.*?\?>\s*)*/,"");if(""===t)return;const n=(new L).parseFromString(t,"text/xml").documentElement;this._conn.xmlInput(n),this._conn.rawInput(e.data),this._handleStreamStart(n)&&this._connect_cb(n)}else if(0===e.data.indexOf("<close ")){const t=(new L).parseFromString(e.data,"text/xml").documentElement;this._conn.xmlInput(t),this._conn.rawInput(e.data);const n=t.getAttribute("see-other-uri");if(n){const e=this._conn.service;(e.indexOf("wss:")>=0&&n.indexOf("wss:")>=0||e.indexOf("ws:")>=0)&&(this._conn._changeConnectStatus(de.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=n,this._connect())}else this._conn._changeConnectStatus(de.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect()}else{this._replaceMessageHandler();const t=this._streamWrap(e.data),n=(new L).parseFromString(t,"text/xml").documentElement;this._conn._connect_cb(n,null,e.data)}}_replaceMessageHandler(){this.socket.onmessage=e=>this._onMessage(e)}_disconnect(e){if(this.socket&&this.socket.readyState!==D.CLOSED){e&&this._conn.send(e);const t=oe("close",{xmlns:de.NS.FRAMING});this._conn.xmlOutput(t.tree());const n=de.serialize(t);this._conn.rawOutput(n);try{this.socket.send(n)}catch(e){de.warn("Couldn't send <close /> tag.")}}setTimeout((()=>this._conn._doDisconnect),0)}_doDisconnect(){de.debug("WebSockets _doDisconnect was called"),this._closeSocket()}_streamWrap(e){return"<wrapper>"+e+"</wrapper>"}_closeSocket(){if(this.socket)try{this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.close()}catch(e){de.debug(e.message)}this.socket=null}_emptyQueue(){return!0}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(de.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected&&this.socket?(de.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(de.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):de.debug("Websocket closed")}_no_auth_received(e){de.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(de.Status.CONNFAIL,de.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(e){de.error("Websocket error "+JSON.stringify(e)),this._conn._changeConnectStatus(de.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()}_onIdle(){const e=this._conn._data;if(e.length>0&&!this._conn.paused){for(let t=0;t<e.length;t++)if(null!==e[t]){let n;n="restart"===e[t]?this._buildStream().tree():e[t];const i=de.serialize(n);this._conn.xmlOutput(n),this._conn.rawOutput(i),this.socket.send(i)}this._conn._data=[]}}_onMessage(e){let t;const n='<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';if(e.data===n)return this._conn.rawInput(n),this._conn.xmlInput(e),void(this._conn.disconnecting||this._conn._doDisconnect());if(0===e.data.search("<open ")){if(t=(new L).parseFromString(e.data,"text/xml").documentElement,!this._handleStreamStart(t))return}else{const n=this._streamWrap(e.data);t=(new L).parseFromString(n,"text/xml").documentElement}return this._checkStreamError(t,de.Status.ERROR)?void 0:this._conn.disconnecting&&"presence"===t.firstChild.nodeName&&"unavailable"===t.firstChild.getAttribute("type")?(this._conn.xmlInput(t),void this._conn.rawInput(de.serialize(t))):void this._conn._dataRecv(t,e.data)}_onOpen(){de.debug("Websocket open");const e=this._buildStream();this._conn.xmlOutput(e.tree());const t=de.serialize(e);this._conn.rawOutput(t),this.socket.send(t)}_reqToData(e){return e}_send(){this._conn.flush()}_sendRestart(){clearTimeout(this._conn._idleTimeout),this._conn._onIdle.bind(this._conn)()}};const he={};he.debug=de.LogLevel.DEBUG,he.info=de.LogLevel.INFO,he.warn=de.LogLevel.WARN,he.error=de.LogLevel.ERROR,he.fatal=de.LogLevel.FATAL,de.WorkerWebsocket=class extends de.Websocket{constructor(e){super(e),this._conn=e,this.worker=new SharedWorker(this._conn.options.worker,"Strophe XMPP Connection"),this.worker.onerror=e=>{var t;null===(t=console)||void 0===t||t.error(e),de.log(de.LogLevel.ERROR,`Shared Worker Error: ${e}`)}}get socket(){return{send:e=>this.worker.port.postMessage(["send",e])}}_connect(){this._messageHandler=e=>this._onInitialMessage(e),this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_connect",this._conn.service,this._conn.jid])}_attach(e){this._messageHandler=e=>this._onMessage(e),this._conn.connect_callback=e,this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_attach",this._conn.service])}_attachCallback(e,t){e===de.Status.ATTACHED?(this._conn.jid=t,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(de.Status.ATTACHED)):e===de.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(de.Status.ATTACHFAIL))}_disconnect(e,t){t&&this._conn.send(t);const n=oe("close",{xmlns:de.NS.FRAMING});this._conn.xmlOutput(n.tree());const i=de.serialize(n);this._conn.rawOutput(i),this.worker.port.postMessage(["send",i]),this._conn._doDisconnect()}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(de.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected?(de.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(de.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):de.debug("Websocket closed")}_closeSocket(){this.worker.port.postMessage(["_closeSocket"])}_replaceMessageHandler(){this._messageHandler=e=>this._onMessage(e)}_onWorkerMessage(e){const{data:t}=e,n=t[0];if("_onMessage"===n)this._messageHandler(t[1]);else if(n in this)try{this[n].apply(this,e.data.slice(1))}catch(e){de.log(de.LogLevel.ERROR,e)}else if("log"===n){const e=t[1],n=t[2];de.log(he[e],n)}else de.log(de.LogLevel.ERROR,`Found unhandled service worker message: ${t}`)}},n.g.$build=ue.$build,n.g.$iq=ue.$iq,n.g.$msg=ue.$msg,n.g.$pres=ue.$pres,n.g.Strophe=ue.Strophe;const{b64_sha1:me}=se,fe={};fe[de.Status.ATTACHED]="ATTACHED",fe[de.Status.AUTHENTICATING]="AUTHENTICATING",fe[de.Status.AUTHFAIL]="AUTHFAIL",fe[de.Status.CONNECTED]="CONNECTED",fe[de.Status.CONNECTING]="CONNECTING",fe[de.Status.CONNFAIL]="CONNFAIL",fe[de.Status.DISCONNECTED]="DISCONNECTED",fe[de.Status.DISCONNECTING]="DISCONNECTING",fe[de.Status.ERROR]="ERROR",fe[de.Status.RECONNECTING]="RECONNECTING",fe[de.Status.REDIRECT]="REDIRECT";const ge=["converse-adhoc","converse-bookmarks","converse-bosh","converse-caps","converse-carbons","converse-chat","converse-chatboxes","converse-disco","converse-emoji","converse-headlines","converse-mam","converse-muc","converse-ping","converse-pubsub","converse-roster","converse-smacks","converse-status","converse-vcard"],pe={start:/(\b|_)(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi},ve={TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESCAPE:27,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,FORWARD_SLASH:47,AT:50,META:91,META_RIGHT:93},ye=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},_e=function(e){if(!ye(e))return!1;var t=y(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},be=d["__core-js_shared__"];var we,Se=(we=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||""))?"Symbol(src)_1."+we:"";var xe=Function.prototype.toString;const Ee=function(e){if(null!=e){try{return xe.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var Ae=/^\[object .+?Constructor\]$/,Ce=Function.prototype,Te=Object.prototype,ke=Ce.toString,je=Te.hasOwnProperty,$e=RegExp("^"+ke.call(je).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Ne=function(e){return!(!ye(e)||(t=e,Se&&Se in t))&&(_e(e)?$e:Ae).test(Ee(e));var t},Oe=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ne(n)?n:void 0},Ie=function(){try{var e=Oe(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Me=function(e,t,n){"__proto__"==t&&Ie?Ie(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Re=function(e,t){return e===t||e!=e&&t!=t};var De=Object.prototype.hasOwnProperty;const Le=function(e,t,n){var i=e[t];De.call(e,t)&&Re(i,n)&&(void 0!==n||t in e)||Me(e,t,n)},ze=function(e,t,n,i){var s=!n;n||(n={});for(var r=-1,o=t.length;++r<o;){var a=t[r],c=i?i(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),s?Me(n,a,c):Le(n,a,c)}return n},Pe=function(e){return e},Fe=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)};var Ue=Math.max;const Be=function(e,t,n){return t=Ue(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,r=Ue(i.length-t,0),o=Array(r);++s<r;)o[s]=i[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=i[s];return a[t]=n(o),Fe(e,this,a)}},qe=function(e){return function(){return e}},He=Ie?function(e,t){return Ie(e,"toString",{configurable:!0,enumerable:!1,value:qe(t),writable:!0})}:Pe;var Ge=Date.now;const We=(Ve=He,Je=0,Qe=0,function(){var e=Ge(),t=16-(e-Qe);if(Qe=e,t>0){if(++Je>=800)return arguments[0]}else Je=0;return Ve.apply(void 0,arguments)});var Ve,Je,Qe;const Ze=function(e,t){return We(Be(e,t,Pe),e+"")},Ye=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Xe=function(e){return null!=e&&Ye(e.length)&&!_e(e)};var Ke=/^(?:0|[1-9]\d*)$/;const et=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ke.test(e))&&e>-1&&e%1==0&&e<t},tt=function(e,t,n){if(!ye(n))return!1;var i=typeof t;return!!("number"==i?Xe(n)&&et(t,n.length):"string"==i&&t in n)&&Re(n[t],e)},nt=function(e){return Ze((function(t,n){var i=-1,s=n.length,r=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(s--,r):void 0,o&&tt(n[0],n[1],o)&&(r=s<3?void 0:r,s=1),t=Object(t);++i<s;){var a=n[i];a&&e(t,a,i,r)}return t}))},it=function(e){return a(e)&&"[object Arguments]"==y(e)};var st=Object.prototype,rt=st.hasOwnProperty,ot=st.propertyIsEnumerable;const at=it(function(){return arguments}())?it:function(e){return a(e)&&rt.call(e,"callee")&&!ot.call(e,"callee")},ct=Array.isArray;var lt="object"==typeof exports&&exports&&!exports.nodeType&&exports,dt=lt&&"object"==typeof module&&module&&!module.nodeType&&module,ut=dt&&dt.exports===lt?d.Buffer:void 0;const ht=(ut?ut.isBuffer:void 0)||function(){return!1};var mt={};mt["[object Float32Array]"]=mt["[object Float64Array]"]=mt["[object Int8Array]"]=mt["[object Int16Array]"]=mt["[object Int32Array]"]=mt["[object Uint8Array]"]=mt["[object Uint8ClampedArray]"]=mt["[object Uint16Array]"]=mt["[object Uint32Array]"]=!0,mt["[object Arguments]"]=mt["[object Array]"]=mt["[object ArrayBuffer]"]=mt["[object Boolean]"]=mt["[object DataView]"]=mt["[object Date]"]=mt["[object Error]"]=mt["[object Function]"]=mt["[object Map]"]=mt["[object Number]"]=mt["[object Object]"]=mt["[object RegExp]"]=mt["[object Set]"]=mt["[object String]"]=mt["[object WeakMap]"]=!1;const ft=function(e){return function(t){return e(t)}};var gt="object"==typeof exports&&exports&&!exports.nodeType&&exports,pt=gt&&"object"==typeof module&&module&&!module.nodeType&&module,vt=pt&&pt.exports===gt&&c.process;const yt=function(){try{return pt&&pt.require&&pt.require("util").types||vt&&vt.binding&&vt.binding("util")}catch(e){}}();var _t=yt&&yt.isTypedArray;const bt=_t?ft(_t):function(e){return a(e)&&Ye(e.length)&&!!mt[y(e)]};var wt=Object.prototype.hasOwnProperty;const St=function(e,t){var n=ct(e),i=!n&&at(e),s=!n&&!i&&ht(e),r=!n&&!i&&!s&&bt(e),o=n||i||s||r,a=o?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],c=a.length;for(var l in e)!t&&!wt.call(e,l)||o&&("length"==l||s&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||et(l,c))||a.push(l);return a};var xt=Object.prototype;const Et=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||xt)};var At=Object.prototype.hasOwnProperty;const Ct=function(e){if(!ye(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Et(e),n=[];for(var i in e)("constructor"!=i||!t&&At.call(e,i))&&n.push(i);return n},Tt=function(e){return Xe(e)?St(e,!0):Ct(e)},kt=nt((function(e,t){ze(t,Tt(t),e)})),jt=function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1},$t=function(e,t){for(var n=e.length;n--;)if(Re(e[n][0],t))return n;return-1};var Nt=Array.prototype.splice;function Ot(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ot.prototype.clear=function(){this.__data__=[],this.size=0},Ot.prototype.delete=function(e){var t=this.__data__,n=$t(t,e);return!(n<0||(n==t.length-1?t.pop():Nt.call(t,n,1),--this.size,0))},Ot.prototype.get=function(e){var t=this.__data__,n=$t(t,e);return n<0?void 0:t[n][1]},Ot.prototype.has=function(e){return $t(this.__data__,e)>-1},Ot.prototype.set=function(e,t){var n=this.__data__,i=$t(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};const It=Ot,Mt=Oe(d,"Map"),Rt=Oe(Object,"create");var Dt=Object.prototype.hasOwnProperty;var Lt=Object.prototype.hasOwnProperty;function zt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}zt.prototype.clear=function(){this.__data__=Rt?Rt(null):{},this.size=0},zt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},zt.prototype.get=function(e){var t=this.__data__;if(Rt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Dt.call(t,e)?t[e]:void 0},zt.prototype.has=function(e){var t=this.__data__;return Rt?void 0!==t[e]:Lt.call(t,e)},zt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rt&&void 0===t?"__lodash_hash_undefined__":t,this};const Pt=zt,Ft=function(e,t){var n,i,s=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map};function Ut(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ut.prototype.clear=function(){this.size=0,this.__data__={hash:new Pt,map:new(Mt||It),string:new Pt}},Ut.prototype.delete=function(e){var t=Ft(this,e).delete(e);return this.size-=t?1:0,t},Ut.prototype.get=function(e){return Ft(this,e).get(e)},Ut.prototype.has=function(e){return Ft(this,e).has(e)},Ut.prototype.set=function(e,t){var n=Ft(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};const Bt=Ut;function qt(e){var t=this.__data__=new It(e);this.size=t.size}qt.prototype.clear=function(){this.__data__=new It,this.size=0},qt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},qt.prototype.get=function(e){return this.__data__.get(e)},qt.prototype.has=function(e){return this.__data__.has(e)},qt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof It){var i=n.__data__;if(!Mt||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Bt(i)}return n.set(e,t),this.size=n.size,this};const Ht=qt;function Gt(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Bt;++t<n;)this.add(e[t])}Gt.prototype.add=Gt.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Gt.prototype.has=function(e){return this.__data__.has(e)};const Wt=Gt,Vt=function(e,t){return e.has(t)},Jt=function(e,t,n,i,s,r){var o=1&n,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,m=2&n?new Wt:void 0;for(r.set(e,t),r.set(t,e);++u<a;){var f=e[u],g=t[u];if(i)var p=o?i(g,f,u,t,e,r):i(f,g,u,e,t,r);if(void 0!==p){if(p)continue;h=!1;break}if(m){if(!jt(t,(function(e,t){if(!Vt(m,t)&&(f===e||s(f,e,n,i,r)))return m.push(t)}))){h=!1;break}}else if(f!==g&&!s(f,g,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h},Qt=d.Uint8Array,Zt=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n},Yt=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var Xt=u?u.prototype:void 0,Kt=Xt?Xt.valueOf:void 0;const en=function(e,t){for(var n=-1,i=t.length,s=e.length;++n<i;)e[s+n]=t[n];return e},tn=function(e,t,n){var i=t(e);return ct(e)?i:en(i,n(e))},nn=function(){return[]};var sn=Object.prototype.propertyIsEnumerable,rn=Object.getOwnPropertySymbols;const on=rn?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,i=null==e?0:e.length,s=0,r=[];++n<i;){var o=e[n];t(o,n,e)&&(r[s++]=o)}return r}(rn(e),(function(t){return sn.call(e,t)})))}:nn,an=_(Object.keys,Object);var cn=Object.prototype.hasOwnProperty;const ln=function(e){if(!Et(e))return an(e);var t=[];for(var n in Object(e))cn.call(e,n)&&"constructor"!=n&&t.push(n);return t},dn=function(e){return Xe(e)?St(e):ln(e)},un=function(e){return tn(e,dn,on)};var hn=Object.prototype.hasOwnProperty;const mn=Oe(d,"DataView"),fn=Oe(d,"Promise"),gn=Oe(d,"Set"),pn=Oe(d,"WeakMap");var vn="[object Map]",yn="[object Promise]",_n="[object Set]",bn="[object WeakMap]",wn="[object DataView]",Sn=Ee(mn),xn=Ee(Mt),En=Ee(fn),An=Ee(gn),Cn=Ee(pn),Tn=y;(mn&&Tn(new mn(new ArrayBuffer(1)))!=wn||Mt&&Tn(new Mt)!=vn||fn&&Tn(fn.resolve())!=yn||gn&&Tn(new gn)!=_n||pn&&Tn(new pn)!=bn)&&(Tn=function(e){var t=y(e),n="[object Object]"==t?e.constructor:void 0,i=n?Ee(n):"";if(i)switch(i){case Sn:return wn;case xn:return vn;case En:return yn;case An:return _n;case Cn:return bn}return t});const kn=Tn;var jn="[object Arguments]",$n="[object Array]",Nn="[object Object]",On=Object.prototype.hasOwnProperty;const In=function(e,t,n,i,s,r){var o=ct(e),a=ct(t),c=o?$n:kn(e),l=a?$n:kn(t),d=(c=c==jn?Nn:c)==Nn,u=(l=l==jn?Nn:l)==Nn,h=c==l;if(h&&ht(e)){if(!ht(t))return!1;o=!0,d=!1}if(h&&!d)return r||(r=new Ht),o||bt(e)?Jt(e,t,n,i,s,r):function(e,t,n,i,s,r,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!r(new Qt(e),new Qt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Re(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Zt;case"[object Set]":var c=1&i;if(a||(a=Yt),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;i|=2,o.set(e,t);var d=Jt(a(e),a(t),i,s,r,o);return o.delete(e),d;case"[object Symbol]":if(Kt)return Kt.call(e)==Kt.call(t)}return!1}(e,t,c,n,i,s,r);if(!(1&n)){var m=d&&On.call(e,"__wrapped__"),f=u&&On.call(t,"__wrapped__");if(m||f){var g=m?e.value():e,p=f?t.value():t;return r||(r=new Ht),s(g,p,n,i,r)}}return!!h&&(r||(r=new Ht),function(e,t,n,i,s,r){var o=1&n,a=un(e),c=a.length;if(c!=un(t).length&&!o)return!1;for(var l=c;l--;){var d=a[l];if(!(o?d in t:hn.call(t,d)))return!1}var u=r.get(e),h=r.get(t);if(u&&h)return u==t&&h==e;var m=!0;r.set(e,t),r.set(t,e);for(var f=o;++l<c;){var g=e[d=a[l]],p=t[d];if(i)var v=o?i(p,g,d,t,e,r):i(g,p,d,e,t,r);if(!(void 0===v?g===p||s(g,p,n,i,r):v)){m=!1;break}f||(f="constructor"==d)}if(m&&!f){var y=e.constructor,_=t.constructor;y==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof _&&_ instanceof _||(m=!1)}return r.delete(e),r.delete(t),m}(e,t,n,i,s,r))},Mn=function e(t,n,i,s,r){return t===n||(null==t||null==n||!a(t)&&!a(n)?t!=t&&n!=n:In(t,n,i,s,e,r))},Rn=function(e,t,n,i){var s=n.length,r=s,o=!i;if(null==e)return!r;for(e=Object(e);s--;){var a=n[s];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++s<r;){var c=(a=n[s])[0],l=e[c],d=a[1];if(o&&a[2]){if(void 0===l&&!(c in e))return!1}else{var u=new Ht;if(i)var h=i(l,d,c,e,t,u);if(!(void 0===h?Mn(d,l,3,i,u):h))return!1}}return!0},Dn=function(e){return e==e&&!ye(e)},Ln=function(e){for(var t=dn(e),n=t.length;n--;){var i=t[n],s=e[i];t[n]=[i,s,Dn(s)]}return t},zn=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}},Pn=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==y(e)};var Fn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Un=/^\w*$/;const Bn=function(e,t){if(ct(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Pn(e))||Un.test(e)||!Fn.test(e)||null!=t&&e in Object(t)};function qn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,s=t?t.apply(this,i):i[0],r=n.cache;if(r.has(s))return r.get(s);var o=e.apply(this,i);return n.cache=r.set(s,o)||r,o};return n.cache=new(qn.Cache||Bt),n}qn.Cache=Bt;const Hn=qn;var Gn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wn=/\\(\\)?/g,Vn=function(e){var t=Hn(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Gn,(function(e,n,i,s){t.push(i?s.replace(Wn,"$1"):n||e)})),t}));const Jn=Vn,Qn=function(e,t){for(var n=-1,i=null==e?0:e.length,s=Array(i);++n<i;)s[n]=t(e[n],n,e);return s};var Zn=u?u.prototype:void 0,Yn=Zn?Zn.toString:void 0;const Xn=function e(t){if("string"==typeof t)return t;if(ct(t))return Qn(t,e)+"";if(Pn(t))return Yn?Yn.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},Kn=function(e){return null==e?"":Xn(e)},ei=function(e,t){return ct(e)?e:Bn(e,t)?[e]:Jn(Kn(e))},ti=function(e){if("string"==typeof e||Pn(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},ni=function(e,t){for(var n=0,i=(t=ei(t,e)).length;null!=e&&n<i;)e=e[ti(t[n++])];return n&&n==i?e:void 0},ii=function(e,t){return null!=e&&t in Object(e)},si=function(e,t,n){for(var i=-1,s=(t=ei(t,e)).length,r=!1;++i<s;){var o=ti(t[i]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++i!=s?r:!!(s=null==e?0:e.length)&&Ye(s)&&et(o,s)&&(ct(e)||at(e))},ri=function(e,t){return null!=e&&si(e,t,ii)},oi=function(e,t){return Bn(e)&&Dn(t)?zn(ti(e),t):function(n){var i=function(e,t,n){var i=null==e?void 0:ni(e,t);return void 0===i?n:i}(n,e);return void 0===i&&i===t?ri(n,e):Mn(t,i,3)}},ai=function(e){return Bn(e)?(t=ti(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return ni(t,e)}}(e);var t},ci=function(e){return"function"==typeof e?e:null==e?Pe:"object"==typeof e?ct(e)?oi(e[0],e[1]):1==(n=Ln(t=e)).length&&n[0][2]?zn(n[0][0],n[0][1]):function(e){return e===t||Rn(e,t,n)}:ai(e);var t,n},li=function(e,t,n){for(var i=-1,s=Object(e),r=n(e),o=r.length;o--;){var a=r[di?o:++i];if(!1===t(s[a],a,s))break}return e};var di;const ui=function(e,t){return e&&li(e,t,dn)},hi=function(e,t){return function(n,i){if(null==n)return n;if(!Xe(n))return e(n,i);for(var s=n.length,r=t?s:-1,o=Object(n);(t?r--:++r<s)&&!1!==i(o[r],r,o););return n}}(ui),mi=function(e,t){var n;return hi(e,(function(e,i,s){return!(n=t(e,i,s))})),!!n},fi=function(e,t,n){var i=ct(e)?jt:mi;return n&&tt(e,t,n)&&(t=void 0),i(e,ci(t))};var gi=Object.prototype.hasOwnProperty;const pi=function(e){if(null==e)return!0;if(Xe(e)&&(ct(e)||"string"==typeof e||"function"==typeof e.splice||ht(e)||bt(e)||at(e)))return!e.length;var t=kn(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Et(e))return!ln(e).length;for(var n in e)if(gi.call(e,n))return!1;return!0};var vi=/\s/;var yi=/^\s+/;const _i=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&vi.test(e.charAt(t)););return t}(e)+1).replace(yi,""):e};var bi=/^[-+]0x[0-9a-f]+$/i,wi=/^0b[01]+$/i,Si=/^0o[0-7]+$/i,xi=parseInt;const Ei=function(e){if("number"==typeof e)return e;if(Pn(e))return NaN;if(ye(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ye(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=_i(e);var n=wi.test(e);return n||Si.test(e)?xi(e.slice(2),n?2:8):bi.test(e)?NaN:+e};const Ai=function(e){return e?Infinity===(e=Ei(e))||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0},Ci=function(e){var t=Ai(e),n=t%1;return t==t?n?t-n:t:0},Ti=function(e){return function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=Ci(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}(2,e)};var ki=0;const ji=function(e){var t=++ki;return Kn(e)+t},$i={},Ni=/\s+/;let Oi;const Ii=function(e,t,n,i,s){let r,o=0;if(n&&"object"==typeof n){void 0!==i&&"context"in s&&void 0===s.context&&(s.context=i);for(r=dn(n);o<r.length;o++)t=Ii(e,t,r[o],n[r[o]],s)}else if(n&&Ni.test(n))for(r=n.split(Ni);o<r.length;o++)t=e(t,r[o],i,s);else t=e(t,n,i,s);return t};$i.on=function(e,t,n){return this._events=Ii(Mi,this._events||{},e,t,{context:n,ctx:this,listening:Oi}),Oi&&((this._listeners||(this._listeners={}))[Oi.id]=Oi,Oi.interop=!1),this},$i.listenTo=function(e,t,n){if(!e)return this;const i=e._listenId||(e._listenId=ji("l")),s=this._listeningTo||(this._listeningTo={});let r=Oi=s[i];r||(this._listenId||(this._listenId=ji("l")),r=Oi=s[i]=new Fi(this,e));const o=Ri(e,t,n,this);if(Oi=void 0,o)throw o;return r.interop&&r.on(t,n),this};const Mi=function(e,t,n,i){if(n){const s=e[t]||(e[t]=[]),r=i.context,o=i.ctx,a=i.listening;a&&a.count++,s.push({callback:n,context:r,ctx:r||o,listening:a})}return e},Ri=function(e,t,n,i){try{e.on(t,n,i)}catch(e){return e}};$i.off=function(e,t,n){return this._events?(this._events=Ii(Di,this._events,e,t,{context:n,listeners:this._listeners}),this):this},$i.stopListening=function(e,t,n){const i=this._listeningTo;if(!i)return this;const s=e?[e._listenId]:dn(i);for(let e=0;e<s.length;e++){const r=i[s[e]];if(!r)break;r.obj.off(t,n,this),r.interop&&r.off(t,n)}return pi(i)&&(this._listeningTo=void 0),this};const Di=function(e,t,n,i){if(!e)return;const s=i.context,r=i.listeners;let o,a=0;if(t||s||n){for(o=t?[t]:dn(e);a<o.length;a++){const i=e[t=o[a]];if(!i)break;const r=[];for(let e=0;e<i.length;e++){const o=i[e];if(n&&n!==o.callback&&n!==o.callback._callback||s&&s!==o.context)r.push(o);else{const e=o.listening;e&&e.off(t,n)}}r.length?e[t]=r:delete e[t]}return e}for(o=dn(r);a<o.length;a++)r[o[a]].cleanup()};$i.once=function(e,t,n){const i=Ii(Li,{},e,t,this.off.bind(this));return"string"==typeof e&&null==n&&(t=void 0),this.on(i,t,n)},$i.listenToOnce=function(e,t,n){const i=Ii(Li,{},t,n,this.stopListening.bind(this,e));return this.listenTo(e,i)};const Li=function(e,t,n,i){if(n){const s=e[t]=Ti((function(){i(t,s),n.apply(this,arguments)}));s._callback=n}return e};$i.trigger=function(e){if(!this._events)return this;const t=Math.max(0,arguments.length-1),n=Array(t);for(let e=0;e<t;e++)n[e]=arguments[e+1];return Ii(zi,this._events,e,void 0,n),this};const zi=function(e,t,n,i){if(e){const n=e[t];let s=e.all;n&&s&&(s=s.slice()),n&&Pi(n,i),s&&Pi(s,[t].concat(i))}return e},Pi=function(e,t){let n,i=-1;const s=e.length,r=t[0],o=t[1],a=t[2];switch(t.length){case 0:for(;++i<s;)(n=e[i]).callback.call(n.ctx);return;case 1:for(;++i<s;)(n=e[i]).callback.call(n.ctx,r);return;case 2:for(;++i<s;)(n=e[i]).callback.call(n.ctx,r,o);return;case 3:for(;++i<s;)(n=e[i]).callback.call(n.ctx,r,o,a);return;default:for(;++i<s;)(n=e[i]).callback.apply(n.ctx,t);return}},Fi=function(e,t){this.id=e._listenId,this.listener=e,this.obj=t,this.interop=!0,this.count=0,this._events=void 0};Fi.prototype.on=$i.on,Fi.prototype.off=function(e,t){let n;this.interop?(this._events=Ii(Di,this._events,e,t,{context:void 0,listeners:void 0}),n=!this._events):(this.count--,n=0===this.count),n&&this.cleanup()},Fi.prototype.cleanup=function(){delete this.listener._listeningTo[this.obj._listenId],this.interop||delete this.obj._listeners[this.id]},$i.bind=$i.on,$i.unbind=$i.off;const Ui=function(e,t){return e&&ze(t,dn(t),e)};var Bi=Object.create,qi=function(){function e(){}return function(t){if(!ye(t))return{};if(Bi)return Bi(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();const Hi=qi;var Gi=Object.prototype.hasOwnProperty;const Wi=function(e,t){return null!=e&&Gi.call(e,t)},Vi=function(e,t){return null!=e&&si(e,t,Wi)},Ji=function(e,t,n){var i=-1,s=(t=ei(t,e)).length;for(s||(s=1,e=void 0);++i<s;){var r=null==e?void 0:e[ti(t[i])];void 0===r&&(i=s,r=n),e=_e(r)?r.call(e):r}return e};function Qi(e,t){const n=this;let i;return i=e&&Vi(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},kt(i,n,t),i.prototype=(s=n.prototype,r=e,o=Hi(s),null==r?o:Ui(o,r)),i.prototype.constructor=i,i.__super__=n.prototype,i;var s,r,o}function Zi(){const e={isResolved:!1,isPending:!0,isRejected:!1},t=new Promise(((t,n)=>{e.resolve=t,e.reject=n}));return Object.assign(t,e),t.then((function(e){return t.isResolved=!0,t.isPending=!1,t.isRejected=!1,e}),(function(e){throw t.isResolved=!1,t.isPending=!1,t.isRejected=!0,e})),t}function Yi(){throw new Error('A "url" property or function must be specified')}function Xi(e,t){const n=t.error;t.error=function(i){n&&n.call(t.context,e,i,t),e.trigger("error",e,i,t)}}Error;const Ki={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};function es(e){const t=Ji(e,"browserStorage")||Ji(e.collection,"browserStorage");return t?t.sync():ts}function ts(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Ki[e],s={type:i,dataType:"json"};n.url||(s.url=Ji(t,"url")||Yi()),null!=n.data||!t||"create"!==e&&"update"!==e&&"patch"!==e||(s.contentType="application/json",s.data=JSON.stringify(n.attrs||t.toJSON(n))),"GET"!==s.type&&(s.processData=!1);const r=n.error;n.error=function(e,t,i){n.textStatus=t,n.errorThrown=i,r&&r.call(n.context,e,t,i)};const o=n.xhr=ns(kt(s,n));return t.trigger("request",t,o,n),o}function ns(){return fetch.apply(this,arguments)}const is=function(){this.handlers=[],this.checkUrl=this.checkUrl.bind(this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)};is.extend=Qi;const ss=/^[#\/]|\s+$/g,rs=/^\/+|\/+$/g,os=/#.*$/;is.started=!1,Object.assign(is.prototype,$i,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root&&!this.getSearch()},matchRoot:function(){return this.decodeFragment(this.location.pathname).slice(0,this.root.length-1)+"/"===this.root},decodeFragment:function(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){const e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){const t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){const e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===e.charAt(0)?e.slice(1):e},getFragment:function(e){return null==e&&(e=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),e.replace(ss,"")},start:function(e){if(is.started)throw new Error("history has already been started");if(is.started=!0,this.options=kt({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,this._hasHashChange="onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(rs,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){const e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;const e=document.body,t=e.insertBefore(this.iframe,e.firstChild).contentWindow;t.document.open(),t.document.close(),t.location.hash="#"+this.fragment}if(this._usePushState?addEventListener("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?addEventListener("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){this._usePushState?removeEventListener("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&removeEventListener("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),is.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){let t=this.getFragment();if(t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return!!this.matchRoot()&&(e=this.fragment=this.getFragment(e),fi(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!is.started)return!1;t&&!0!==t||(t={trigger:!!t}),e=this.getFragment(e||"");let n=this.root;""!==e&&"?"!==e.charAt(0)||(n=n.slice(0,-1)||"/");const i=n+e;e=e.replace(os,"");const s=this.decodeFragment(e);if(this.fragment!==s){if(this.fragment=s,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){const n=this.iframe.contentWindow;t.replace||(n.document.open(),n.document.close()),this._updateHash(n.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){const n=e.href.replace(/(javascript:|#).*$/,"");e.replace(n+"#"+t)}else e.hash="#"+t}});const as=is;var cs=yt&&yt.isRegExp;const ls=cs?ft(cs):function(e){return a(e)&&"[object RegExp]"==y(e)},ds=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.history=e.history||new as,this.preinitialize.apply(this,arguments),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};ds.extend=Qi;const us=/\((.*?)\)/g,hs=/(\(\?)?:\w+/g,ms=/\*\w+/g,fs=/[\-{}\[\]+?.,\\\^$|#\s]/g;Object.assign(ds.prototype,$i,{preinitialize:function(){},initialize:function(){},route:function(e,t,n){return ls(e)||(e=this._routeToRegExp(e)),_e(t)&&(n=t,t=""),n||(n=this[t]),this.history.route(e,(i=>{const s=this._extractParameters(e,i);!1!==this.execute(n,s,t)&&(this.trigger.apply(this,["route:"+t].concat(s)),this.trigger("route",t,s),this.history.trigger("route",this,t,s))})),this},execute:function(e,t,n){e&&e.apply(this,t)},navigate:function(e,t){return this.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;let e;this.routes=Ji(this,"routes");const t=dn(this.routes);for(;null!=(e=t.pop());)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(fs,"\\$&").replace(us,"(?:$1)?").replace(hs,(function(e,t){return t?e:"([^/?]+)"})).replace(ms,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){const n=e.exec(t).slice(1);return n.map((function(e,t){return t===n.length-1?e||null:e?decodeURIComponent(e):null}))}});class gs extends Error{}var ps=n(5533);var vs="object"==typeof exports&&exports&&!exports.nodeType&&exports,ys=vs&&"object"==typeof module&&module&&!module.nodeType&&module,_s=ys&&ys.exports===vs?d.Buffer:void 0,bs=_s?_s.allocUnsafe:void 0;const ws=function(e,t){if(t)return e.slice();var n=e.length,i=bs?bs(n):new e.constructor(n);return e.copy(i),i},Ss=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t};var xs=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)en(t,on(e)),e=b(e);return t}:nn;const Es=xs,As=function(e){return tn(e,Tt,Es)};var Cs=Object.prototype.hasOwnProperty;const Ts=function(e){var t=new e.constructor(e.byteLength);return new Qt(t).set(new Qt(e)),t};var ks=/\w*$/;var js=u?u.prototype:void 0,$s=js?js.valueOf:void 0;const Ns=function(e,t){var n=t?Ts(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)},Os=function(e,t,n){var i,s,r,o=e.constructor;switch(t){case"[object ArrayBuffer]":return Ts(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?Ts(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Ns(e,n);case"[object Map]":case"[object Set]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return(r=new(s=e).constructor(s.source,ks.exec(s))).lastIndex=s.lastIndex,r;case"[object Symbol]":return i=e,$s?Object($s.call(i)):{}}},Is=function(e){return"function"!=typeof e.constructor||Et(e)?{}:Hi(b(e))};var Ms=yt&&yt.isMap;const Rs=Ms?ft(Ms):function(e){return a(e)&&"[object Map]"==kn(e)};var Ds=yt&&yt.isSet;const Ls=Ds?ft(Ds):function(e){return a(e)&&"[object Set]"==kn(e)};var zs="[object Arguments]",Ps="[object Function]",Fs={};Fs[zs]=Fs["[object Array]"]=Fs["[object ArrayBuffer]"]=Fs["[object DataView]"]=Fs["[object Boolean]"]=Fs["[object Date]"]=Fs["[object Float32Array]"]=Fs["[object Float64Array]"]=Fs["[object Int8Array]"]=Fs["[object Int16Array]"]=Fs["[object Int32Array]"]=Fs["[object Map]"]=Fs["[object Number]"]=Fs["[object Object]"]=Fs["[object RegExp]"]=Fs["[object Set]"]=Fs["[object String]"]=Fs["[object Symbol]"]=Fs["[object Uint8Array]"]=Fs["[object Uint8ClampedArray]"]=Fs["[object Uint16Array]"]=Fs["[object Uint32Array]"]=!0,Fs["[object Error]"]=Fs[Ps]=Fs["[object WeakMap]"]=!1;const Us=function e(t,n,i,s,r,o){var a,c=1&n,l=2&n,d=4&n;if(i&&(a=r?i(t,s,r,o):i(t)),void 0!==a)return a;if(!ye(t))return t;var u=ct(t);if(u){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Cs.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!c)return Ss(t,a)}else{var h=kn(t),m=h==Ps||"[object GeneratorFunction]"==h;if(ht(t))return ws(t,c);if("[object Object]"==h||h==zs||m&&!r){if(a=l||m?{}:Is(t),!c)return l?function(e,t){return ze(e,Es(e),t)}(t,function(e,t){return e&&ze(t,Tt(t),e)}(a,t)):function(e,t){return ze(e,on(e),t)}(t,Ui(a,t))}else{if(!Fs[h])return r?t:{};a=Os(t,h,c)}}o||(o=new Ht);var f=o.get(t);if(f)return f;o.set(t,a),Ls(t)?t.forEach((function(s){a.add(e(s,n,i,s,t,o))})):Rs(t)&&t.forEach((function(s,r){a.set(r,e(s,n,i,r,t,o))}));var g=u?void 0:(d?l?As:un:l?Tt:dn)(t);return function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););}(g||t,(function(s,r){g&&(s=t[r=s]),Le(a,r,e(s,n,i,r,t,o))})),a},Bs=function(e){return"string"==typeof e||!ct(e)&&a(e)&&"[object String]"==y(e)},qs=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}(),Hs=function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(s){if("TypeError"!==s.name)throw s;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}};"undefined"==typeof Promise&&n(5803);const Gs=Promise,Ws=function(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))},Vs=function(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)};function Js(e){return"string"!=typeof e&&(console.warn(`${e} used as a key, but it is not a string.`),e=String(e)),e}function Qs(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}const Zs="local-forage-detect-blob-support";let Ys;const Xs={},Ks=Object.prototype.toString,er="readonly",tr="readwrite";function nr(e){var t=Xs[e.name],n={};n.promise=new Gs((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function ir(e){var t=Xs[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function sr(e,t){var n=Xs[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function rr(e,t){return new Gs((function(n,i){if(Xs[e.name]=Xs[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);nr(e),e.db.close()}var s=[e.name];t&&s.push(e.version);var r=qs.open.apply(qs,s);t&&(r.onupgradeneeded=function(t){var n=r.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(Zs)}catch(n){if("ConstraintError"!==n.name)throw n;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(),i(r.error)},r.onsuccess=function(){var t=r.result;t.onversionchange=function(e){e.target.close()},n(t),ir(e)}}))}function or(e){return rr(e,!1)}function ar(e){return rr(e,!0)}function cr(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,s=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),s||n){if(n){var r=e.db.version+1;r>e.version&&(e.version=r)}return!0}return!1}function lr(e){var t=function(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=0;s<t;s++)i[s]=e.charCodeAt(s);return n}(atob(e.data));return Hs([t],{type:e.type})}function dr(e){return e&&e.__local_forage_encoded_blob}function ur(e){var t=this,n=t._initReady().then((function(){var e=Xs[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return Vs(n,e,e),n}function hr(e,t,n,i){void 0===i&&(i=1);try{var s=e.db.transaction(e.storeName,t);n(null,s)}catch(s){if(i>0&&(!e.db||"InvalidStateError"===s.name||"NotFoundError"===s.name))return Gs.resolve().then((()=>{if(!e.db||"NotFoundError"===s.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ar(e)})).then((()=>function(e){nr(e);for(var t=Xs[e.name],n=t.forages,i=0;i<n.length;i++){const e=n[i];e._dbInfo.db&&(e._dbInfo.db.close(),e._dbInfo.db=null)}return e.db=null,or(e).then((t=>(e.db=t,cr(e)?ar(e):t))).then((i=>{e.db=t.db=i;for(var s=0;s<n.length;s++)n[s]._dbInfo.db=i})).catch((t=>{throw sr(e,t),t}))}(e).then((function(){hr(e,t,n,i-1)})))).catch(n);n(s)}}var mr={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var s=Xs[n.name];s||(s={forages:[],db:null,dbReady:null,deferredOperations:[]},Xs[n.name]=s),s.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=ur);var r=[];function o(){return Gs.resolve()}for(var a=0;a<s.forages.length;a++){var c=s.forages[a];c!==t&&r.push(c._initReady().catch(o))}var l=s.forages.slice(0);return Gs.all(r).then((function(){return n.db=s.db,or(n)})).then((function(e){return n.db=e,cr(n,t._defaultConfig.version)?ar(n):e})).then((function(e){n.db=s.db=e,t._dbInfo=n;for(var i=0;i<l.length;i++){var r=l[i];r!==t&&(r._dbInfo.db=n.db,r._dbInfo.version=n.version)}}))},_support:function(){try{if(!qs||!qs.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,i=new Gs((function(t,i){n.ready().then((function(){hr(n._dbInfo,er,(function(s,r){if(s)return i(s);try{var o=r.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var i=n.value;dr(i)&&(i=lr(i));var s=e(i,n.key,a++);void 0!==s?t(s):n.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return Ws(i,t),i},getItem:function(e,t){var n=this;e=Js(e);var i=new Gs((function(t,i){n.ready().then((function(){hr(n._dbInfo,er,(function(s,r){if(s)return i(s);try{var o=r.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),dr(e)&&(e=lr(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return Ws(i,t),i},setItem:function(e,t,n){var i=this;e=Js(e);var s=new Gs((function(n,s){var r;i.ready().then((function(){return r=i._dbInfo,"[object Blob]"===Ks.call(t)?(e=r.db,"boolean"==typeof Ys?Gs.resolve(Ys):function(e){return new Gs((function(t){var n=e.transaction(Zs,tr),i=Hs([""]);n.objectStore(Zs).put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return Ys=e,Ys}))).then((function(e){return e?t:(n=t,new Gs((function(e,t){var i=new FileReader;i.onerror=t,i.onloadend=function(t){var i=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:i,type:n.type})},i.readAsBinaryString(n)})));var n})):t;var e})).then((function(t){hr(i._dbInfo,tr,(function(r,o){if(r)return s(r);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var c=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=c.error?c.error:c.transaction.error;s(e)}}catch(e){s(e)}}))})).catch(s)}));return Ws(s,n),s},removeItem:function(e,t){var n=this;e=Js(e);var i=new Gs((function(t,i){n.ready().then((function(){hr(n._dbInfo,tr,(function(s,r){if(s)return i(s);try{var o=r.objectStore(n._dbInfo.storeName).delete(e);r.oncomplete=function(){t()},r.onerror=function(){i(o.error)},r.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return Ws(i,t),i},clear:function(e){var t=this,n=new Gs((function(e,n){t.ready().then((function(){hr(t._dbInfo,tr,(function(i,s){if(i)return n(i);try{var r=s.objectStore(t._dbInfo.storeName).clear();s.oncomplete=function(){e()},s.onabort=s.onerror=function(){var e=r.error?r.error:r.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return Ws(n,e),n},length:function(e){var t=this,n=new Gs((function(e,n){t.ready().then((function(){hr(t._dbInfo,er,(function(i,s){if(i)return n(i);try{var r=s.objectStore(t._dbInfo.storeName).count();r.onsuccess=function(){e(r.result)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))})).catch(n)}));return Ws(n,e),n},key:function(e,t){var n=this,i=new Gs((function(t,i){e<0?t(null):n.ready().then((function(){hr(n._dbInfo,er,(function(s,r){if(s)return i(s);try{var o=r.objectStore(n._dbInfo.storeName),a=!1,c=o.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},c.onerror=function(){i(c.error)}}catch(e){i(e)}}))})).catch(i)}));return Ws(i,t),i},keys:function(e){var t=this,n=new Gs((function(e,n){t.ready().then((function(){hr(t._dbInfo,er,(function(i,s){if(i)return n(i);try{var r=s.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];r.onsuccess=function(){var t=r.result;t?(o.push(t.key),t.continue()):e(o)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))})).catch(n)}));return Ws(n,e),n},dropInstance:function(e,t){t=Qs.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,s=this;if(e.name){const t=e.name===n.name&&s._dbInfo.db?Gs.resolve(s._dbInfo.db):or(e).then((t=>{const n=Xs[e.name],i=n.forages;n.db=t;for(var s=0;s<i.length;s++)i[s]._dbInfo.db=t;return t}));i=e.storeName?t.then((t=>{if(!t.objectStoreNames.contains(e.storeName))return;const n=t.version+1;nr(e);const i=Xs[e.name],s=i.forages;t.close();for(let e=0;e<s.length;e++){const t=s[e];t._dbInfo.db=null,t._dbInfo.version=n}const r=new Gs(((t,i)=>{const s=qs.open(e.name,n);s.onerror=e=>{s.result.close(),i(e)},s.onupgradeneeded=()=>{s.result.deleteObjectStore(e.storeName)},s.onsuccess=()=>{const e=s.result;e.close(),t(e)}}));return r.then((e=>{i.db=e;for(let t=0;t<s.length;t++){const n=s[t];n._dbInfo.db=e,ir(n._dbInfo)}})).catch((t=>{throw(sr(e,t)||Gs.resolve()).catch((()=>{})),t}))})):t.then((t=>{nr(e);const n=Xs[e.name],i=n.forages;t.close();for(var s=0;s<i.length;s++)i[s]._dbInfo.db=null;const r=new Gs(((t,n)=>{var i=qs.deleteDatabase(e.name);i.onerror=()=>{const e=i.result;e&&e.close(),n(i.error)},i.onblocked=()=>{console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},i.onsuccess=()=>{const e=i.result;e&&e.close(),t(e)}}));return r.then((e=>{n.db=e;for(var t=0;t<i.length;t++)ir(i[t]._dbInfo)})).catch((t=>{throw(sr(e,t)||Gs.resolve()).catch((()=>{})),t}))}))}else i=Gs.reject("Invalid arguments");return Ws(i,t),i}};const fr=mr;var gr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pr=/^~~local_forage_type~([^~]+)~/,vr="__lfsc__:",yr=vr.length,_r="arbf",br="blob",wr="si08",Sr="ui08",xr="uic8",Er="si16",Ar="si32",Cr="ur16",Tr="ui32",kr="fl32",jr="fl64",$r=yr+_r.length,Nr=Object.prototype.toString;function Or(e){var t,n,i,s,r,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var l=new ArrayBuffer(o),d=new Uint8Array(l);for(t=0;t<a;t+=4)n=gr.indexOf(e[t]),i=gr.indexOf(e[t+1]),s=gr.indexOf(e[t+2]),r=gr.indexOf(e[t+3]),d[c++]=n<<2|i>>4,d[c++]=(15&i)<<4|s>>2,d[c++]=(3&s)<<6|63&r;return l}function Ir(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=gr[n[t]>>2],i+=gr[(3&n[t])<<4|n[t+1]>>4],i+=gr[(15&n[t+1])<<2|n[t+2]>>6],i+=gr[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}var Mr={serialize:function(e,t){var n="";if(e&&(n=Nr.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===Nr.call(e.buffer))){var i,s=vr;e instanceof ArrayBuffer?(i=e,s+=_r):(i=e.buffer,"[object Int8Array]"===n?s+=wr:"[object Uint8Array]"===n?s+=Sr:"[object Uint8ClampedArray]"===n?s+=xr:"[object Int16Array]"===n?s+=Er:"[object Uint16Array]"===n?s+=Cr:"[object Int32Array]"===n?s+=Ar:"[object Uint32Array]"===n?s+=Tr:"[object Float32Array]"===n?s+=kr:"[object Float64Array]"===n?s+=jr:t(new Error("Failed to get type for BinaryArray"))),t(s+Ir(i))}else if("[object Blob]"===n){var r=new FileReader;r.onload=function(){var n="~~local_forage_type~"+e.type+"~"+Ir(this.result);t("__lfsc__:blob"+n)},r.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,yr)!==vr)return JSON.parse(e);var t,n=e.substring($r),i=e.substring(yr,$r);if(i===br&&pr.test(n)){var s=n.match(pr);t=s[1],n=n.substring(s[0].length)}var r=Or(n);switch(i){case _r:return r;case br:return Hs([r],{type:t});case wr:return new Int8Array(r);case Sr:return new Uint8Array(r);case xr:return new Uint8ClampedArray(r);case Er:return new Int16Array(r);case Cr:return new Uint16Array(r);case Ar:return new Int32Array(r);case Tr:return new Uint32Array(r);case kr:return new Float32Array(r);case jr:return new Float64Array(r);default:throw new Error("Unkown type: "+i)}},stringToBuffer:Or,bufferToString:Ir};const Rr=Mr;function Dr(e,t,n,i){e.executeSql(`CREATE TABLE IF NOT EXISTS ${t.storeName} (id INTEGER PRIMARY KEY, key unique, value)`,[],n,i)}function Lr(e,t,n,i,s,r){e.executeSql(n,i,s,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?r(e,o):Dr(e,t,(function(){e.executeSql(n,i,s,r)}),r)}),r):r(e,o)}),r)}function zr(e,t,n,i){var s=this;e=Js(e);var r=new Gs((function(r,o){s.ready().then((function(){void 0===t&&(t=null);var a=t,c=s._dbInfo;c.serializer.serialize(t,(function(t,l){l?o(l):c.db.transaction((function(n){Lr(n,c,`INSERT OR REPLACE INTO ${c.storeName} (key, value) VALUES (?, ?)`,[e,t],(function(){r(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void r(zr.apply(s,[e,a,n,i-1]));o(t)}}))}))})).catch(o)}));return Ws(r,n),r}function Pr(e){return new Gs((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var s=[],r=0;r<i.rows.length;r++)s.push(i.rows.item(r).name);t({db:e,storeNames:s})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}var Fr={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var s=new Gs((function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction((function(s){Dr(s,n,(function(){t._dbInfo=n,e()}),(function(e,t){i(t)}))}),i)}));return n.serializer=Rr,s},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,i=new Gs((function(t,i){n.ready().then((function(){var s=n._dbInfo;s.db.transaction((function(n){Lr(n,s,`SELECT * FROM ${s.storeName}`,[],(function(n,i){for(var r=i.rows,o=r.length,a=0;a<o;a++){var c=r.item(a),l=c.value;if(l&&(l=s.serializer.deserialize(l)),void 0!==(l=e(l,c.key,a+1)))return void t(l)}t()}),(function(e,t){i(t)}))}))})).catch(i)}));return Ws(i,t),i},getItem:function(e,t){var n=this;e=Js(e);var i=new Gs((function(t,i){n.ready().then((function(){var s=n._dbInfo;s.db.transaction((function(n){Lr(n,s,`SELECT * FROM ${s.storeName} WHERE key = ? LIMIT 1`,[e],(function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=s.serializer.deserialize(i)),t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return Ws(i,t),i},setItem:function(e,t,n){return zr.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=Js(e);var i=new Gs((function(t,i){n.ready().then((function(){var s=n._dbInfo;s.db.transaction((function(n){Lr(n,s,`DELETE FROM ${s.storeName} WHERE key = ?`,[e],(function(){t()}),(function(e,t){i(t)}))}))})).catch(i)}));return Ws(i,t),i},clear:function(e){var t=this,n=new Gs((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){Lr(t,i,`DELETE FROM ${i.storeName}`,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return Ws(n,e),n},length:function(e){var t=this,n=new Gs((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){Lr(t,i,`SELECT COUNT(key) as c FROM ${i.storeName}`,[],(function(t,n){var i=n.rows.item(0).c;e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return Ws(n,e),n},key:function(e,t){var n=this,i=new Gs((function(t,i){n.ready().then((function(){var s=n._dbInfo;s.db.transaction((function(n){Lr(n,s,`SELECT key FROM ${s.storeName} WHERE id = ? LIMIT 1`,[e+1],(function(e,n){var i=n.rows.length?n.rows.item(0).key:null;t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return Ws(i,t),i},keys:function(e){var t=this,n=new Gs((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){Lr(t,i,`SELECT key FROM ${i.storeName}`,[],(function(t,n){for(var i=[],s=0;s<n.rows.length;s++)i.push(n.rows.item(s).key);e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return Ws(n,e),n},dropInstance:function(e,t){t=Qs.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,s=this;return i=e.name?new Gs((function(t){var i;i=e.name===n.name?s._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(Pr(i))})).then((function(e){return new Gs((function(t,n){e.db.transaction((function(i){function s(e){return new Gs((function(t,n){i.executeSql(`DROP TABLE IF EXISTS ${e}`,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var r=[],o=0,a=e.storeNames.length;o<a;o++)r.push(s(e.storeNames[o]));Gs.all(r).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):Gs.reject("Invalid arguments"),Ws(i,t),i}};const Ur=Fr;function Br(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}var qr={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=Br(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=Rr,Gs.resolve()):Gs.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,s=i.length,r=localStorage.length,o=1,a=0;a<r;a++){var c=localStorage.key(a);if(0===c.indexOf(i)){var l=localStorage.getItem(c);if(l&&(l=t.serializer.deserialize(l)),void 0!==(l=e(l,c.substring(s),o++)))return l}}}));return Ws(i,t),i},getItem:function(e,t){var n=this;e=Js(e);var i=n.ready().then((function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return Ws(i,t),i},setItem:function(e,t,n){var i=this;e=Js(e);var s=i.ready().then((function(){void 0===t&&(t=null);var n=t;return new Gs((function(s,r){var o=i._dbInfo;o.serializer.serialize(t,(function(t,i){if(i)r(i);else try{localStorage.setItem(o.keyPrefix+e,t),s(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||r(e),r(e)}}))}))}));return Ws(s,n),s},removeItem:function(e,t){var n=this;e=Js(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return Ws(i,t),i},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return Ws(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return Ws(t,e),t},key:function(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return Ws(i,t),i},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],s=0;s<n;s++){var r=localStorage.key(s);0===r.indexOf(e.keyPrefix)&&i.push(r.substring(e.keyPrefix.length))}return i}));return Ws(n,e),n},dropInstance:function(e,t){if(t=Qs.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,s=this;return i=e.name?new Gs((function(t){e.storeName?t(Br(e,s._defaultConfig)):t(`${e.name}/`)})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):Gs.reject("Invalid arguments"),Ws(i,t),i}};const Hr=qr,Gr=(e,t)=>e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t),Wr=(e,t)=>{const n=e.length;let i=0;for(;i<n;){if(Gr(e[i],t))return!0;i++}return!1},Vr=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Jr={},Qr={},Zr={INDEXEDDB:fr,WEBSQL:Ur,LOCALSTORAGE:Hr},Yr=[Zr.INDEXEDDB._driver,Zr.WEBSQL._driver,Zr.LOCALSTORAGE._driver],Xr=["dropInstance"],Kr=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Xr),eo={description:"",driver:Yr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function to(e,t){e[t]=function(){const n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function no(){for(let e=1;e<arguments.length;e++){const t=arguments[e];if(t)for(let e in t)t.hasOwnProperty(e)&&(Vr(t[e])?arguments[0][e]=t[e].slice():arguments[0][e]=t[e])}return arguments[0]}class io{constructor(e){for(let e in Zr)if(Zr.hasOwnProperty(e)){const t=Zr[e],n=t._driver;this[e]=n,Jr[n]||this.defineDriver(t)}this._defaultConfig=no({},eo),this._config=no({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((()=>{}))}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,n){const i=new Gs((function(t,n){try{const i=e._driver,s=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(s);const r=Kr.concat("_initStorage");for(let t=0,i=r.length;t<i;t++){const i=r[t];if((!Wr(Xr,i)||e[i])&&"function"!=typeof e[i])return void n(s)}const o=function(){const t=function(e){return function(){const t=new Error(`Method ${e} is not implemented by the current driver`),n=Gs.reject(t);return Ws(n,arguments[arguments.length-1]),n}};for(let n=0,i=Xr.length;n<i;n++){const i=Xr[n];e[i]||(e[i]=t(i))}};o();const a=function(n){Jr[i]&&console.info(`Redefining LocalForage driver: ${i}`),Jr[i]=e,Qr[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(a,n):a(!!e._support):a(!0)}catch(e){n(e)}}));return Vs(i,t,n),i}driver(){return this._driver||null}getDriver(e,t,n){const i=Jr[e]?Gs.resolve(Jr[e]):Gs.reject(new Error("Driver not found."));return Vs(i,t,n),i}getSerializer(e){const t=Gs.resolve(Rr);return Vs(t,e),t}ready(e){const t=this,n=t._driverSet.then((()=>(null===t._ready&&(t._ready=t._initDriver()),t._ready)));return Vs(n,e,e),n}setDriver(e,t,n){const i=this;Vr(e)||(e=[e]);const s=this._getSupportedDrivers(e);function r(){i._config.driver=i.driver()}function o(e){return i._extend(e),r(),i._ready=i._initStorage(i._config),i._ready}const a=null!==this._driverSet?this._driverSet.catch((()=>Gs.resolve())):Gs.resolve();return this._driverSet=a.then((()=>{const e=s[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((e=>{i._driver=e._driver,r(),i._wrapLibraryMethodsWithReady(),i._initDriver=function(e){return function(){let t=0;return function n(){for(;t<e.length;){let s=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(s).then(o).catch(n)}r();const s=new Error("No available storage method found.");return i._driverSet=Gs.reject(s),i._driverSet}()}}(s)}))})).catch((()=>{r();const e=new Error("No available storage method found.");return i._driverSet=Gs.reject(e),i._driverSet})),Vs(this._driverSet,t,n),this._driverSet}supports(e){return!!Qr[e]}_extend(e){no(this,e)}_getSupportedDrivers(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];this.supports(i)&&t.push(i)}return t}_wrapLibraryMethodsWithReady(){for(let e=0,t=Kr.length;e<t;e++)to(this,Kr[e])}createInstance(e){return new io(e)}}const so=new io,ro=function(e,t,n){(void 0!==n&&!Re(e[t],n)||void 0===n&&!(t in e))&&Me(e,t,n)},oo=function(e){return a(e)&&Xe(e)},ao=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},co=function(e,t,n,i,s,r,o){var a,c=ao(e,n),l=ao(t,n),d=o.get(l);if(d)ro(e,n,d);else{var u=r?r(c,l,n+"",e,t,o):void 0,h=void 0===u;if(h){var m=ct(l),f=!m&&ht(l),g=!m&&!f&&bt(l);u=l,m||f||g?ct(c)?u=c:oo(c)?u=Ss(c):f?(h=!1,u=ws(l,!0)):g?(h=!1,u=Ns(l,!0)):u=[]:C(l)||at(l)?(u=c,at(c)?u=ze(a=c,Tt(a)):ye(c)&&!_e(c)||(u=Is(l))):h=!1}h&&(o.set(l,u),s(u,l,i,r,o),o.delete(l)),ro(e,n,u)}},lo=function e(t,n,i,s,r){t!==n&&li(n,(function(o,a){if(r||(r=new Ht),ye(o))co(t,n,a,i,e,s,r);else{var c=s?s(ao(t,a),o,a+"",t,n,r):void 0;void 0===c&&(c=o),ro(t,a,c)}}),Tt)},uo=nt((function(e,t,n){lo(e,t,n)})),ho=nt((function(e,t,n,i){lo(e,t,n,i)})),mo=function(){return d.Date.now()};function fo(){const e={isResolved:!1,isPending:!0,isRejected:!1},t=new Promise(((t,n)=>{e.resolve=t,e.reject=n}));return Object.assign(t,e),t.then((function(e){return t.isResolved=!0,t.isPending=!1,t.isRejected=!1,e}),(function(e){throw t.isResolved=!1,t.isPending=!1,t.isRejected=!0,e})),t}const go="Expected a function",po=Math.max,vo=Math.min,yo=function(e,t){let n,i,s,r,o,a,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=0,d=!1,u=c.promise?fo():null;if("function"!=typeof e)throw new TypeError(go);function h(t){const s=n,o=i;return n=i=void 0,l=t,r=e.apply(o,s),c.promise&&(u.resolve(r),u=fo()),c.promise?u:r}function m(e){return l=e,o=setTimeout(p,t),c.promise?u:r}function f(e){const n=t-(e-a);return d?vo(n,s-(e-l)):n}function g(e){const n=e-a;return void 0===a||n>=t||n<0||d&&e-l>=s}function p(){const e=mo();if(g(e))return v(e);o=setTimeout(p,f(e))}function v(e){return o=void 0,n?h(e):(n=i=void 0,c.promise?u:r)}function y(){void 0!==o&&clearTimeout(o),l=0,n=a=i=o=void 0}function _(){return void 0===o?r:v(mo())}function b(e,t){if(Array.isArray(e)&&Array.isArray(t))return null!=c&&c.dedupeArrays?e.concat(t.filter((t=>-1===e.indexOf(t)))):e.concat(t)}function w(e){var t;return null!==(t=n)&&void 0!==t&&t.length?e.length?null!=c&&c.concatArrays||null!=c&&c.dedupeArrays?ho(n,e,b):uo(n,e):n:e||[]}function S(){const e=mo(),s=g(e);if(n=w(Array.from(arguments)),i=this,a=e,s){if(void 0===o)return m(a);if(d)return clearTimeout(o),o=setTimeout(p,t),h(a)}return void 0===o&&(o=setTimeout(p,t)),c.promise?u:r}return t=Ei(t)||0,ye(c)&&(d="maxWait"in c,s=d?po(Ei(c.maxWait)||0,t):s),S.cancel=y,S.flush=_,S};function _o(e,t){let n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}const bo={serializer:{serialize:Rr.serialize,deserialize:Rr.deserialize}},wo={_driver:"sessionStorageWrapper",_initStorage:function(e){if(bo.keyPrefix=_o(e,this._defaultConfig),e)for(const t in e)bo[t]=e[t]},_support:function(){try{if(sessionStorage&&"setItem"in sessionStorage)return!0}catch(e){console.log(e)}return!1}(),iterate:function(e,t){const n=this.ready().then((function(){const t=bo.keyPrefix,n=t.length,i=sessionStorage.length;let s=1;for(let r=0;r<i;r++){const i=sessionStorage.key(r);if(0!==i.indexOf(t))continue;let o=sessionStorage.getItem(i);if(o&&(o=bo.serializer.deserialize(o)),o=e(o,i.substring(n),s++),void 0!==o)return o}}));return Ws(n,t),n},getItem:function(e,t){e=Js(e);const n=this.ready().then((function(){let t=sessionStorage.getItem(bo.keyPrefix+e);return t&&(t=bo.serializer.deserialize(t)),t}));return Ws(n,t),n},setItem:function(e,t,n){e=Js(e);const i=this.ready().then((function(){void 0===t&&(t=null);const n=t;return new Promise((function(i,s){bo.serializer.serialize(t,(function(t,r){if(r)s(r);else try{sessionStorage.setItem(bo.keyPrefix+e,t),i(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||s(e),s(e)}}))}))}));return Ws(i,n),i},removeItem:function(e,t){e=Js(e);const n=this.ready().then((function(){sessionStorage.removeItem(bo.keyPrefix+e)}));return Ws(n,t),n},clear:function(e){const t=this.ready().then((function(){const e=bo.keyPrefix;for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}}));return Ws(t,e),t},length:function(e){const t=this.keys().then((function(e){return e.length}));return Ws(t,e),t},key:function(e,t){const n=this.ready().then((function(){let t;try{t=sessionStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(bo.keyPrefix.length)),t}));return Ws(n,t),n},keys:function(e){const t=this.ready().then((function(){const e=sessionStorage.length,t=[];for(let n=0;n<e;n++){const e=sessionStorage.key(n);0===e.indexOf(bo.keyPrefix)&&t.push(e.substring(bo.keyPrefix.length))}return t}));return Ws(t,e),t},dropInstance:function(e,t){if(t=Qs.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){const t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName}const n=this;let i;return i=e.name?new Promise((function(t){e.storeName?t(_o(e,n._defaultConfig)):t(`${e.name}/`)})).then((function(e){for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}})):Promise.reject(new Error("Invalid arguments")),Ws(i,t),i}},So=wo;var xo=n(8806),Eo=n(4718);const Ao=ps._driver;function Co(){return(65536*(1+Math.random())|0).toString(16).substring(1)}so.defineDriver(ps),(0,xo.extendPrototype)(so),(0,Eo.extendPrototype)(so);class To{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("local"===t&&!window.localStorage)throw new Error("Skeletor.storage: Environment does not support localStorage.");if("session"===t&&!window.sessionStorage)throw new Error("Skeletor.storage: Environment does not support sessionStorage.");Bs(t)?this.storeInitialized=this.initStore(t,n):(this.store=t,n&&(this.store.debouncedSetItems=yo((e=>this.store.setItems(e)),50,{promise:!0})),this.storeInitialized=Promise.resolve()),this.name=e}async initStore(e,t){if("session"===e)so.setDriver(So._driver);else if("local"===e)await so.config({driver:so.LOCALSTORAGE});else if("in_memory"===e)so.config({driver:Ao});else if("indexed"!==e)throw new Error("Skeletor.storage: No storage type was specified");this.store=so,t&&(this.store.debouncedSetItems=yo((e=>this.store.setItems(e)),50,{promise:!0}))}flush(){var e;return null===(e=this.store.debouncedSetItems)||void 0===e?void 0:e.flush()}async clear(){await this.store.removeItem(this.name).catch((e=>console.error(e)));const e=new RegExp(`^${this.name}-`),t=(await this.store.keys()).filter((t=>e.test(t)));await Promise.all(t.map((e=>this.store.removeItem(e).catch((e=>console.error(e))))))}sync(){const e=this;async function t(t,n,i){let s,r,o,a;const c=n.collection;var l;["patch","update"].includes(t)&&(l=n.attributes,a=Us(l,5)),await e.storeInitialized;try{const r=n.attributes;switch(t){case"read":s=void 0!==n.id?await e.find(n):await e.findAll();break;case"create":s=await e.create(n,i);break;case"patch":case"update":i.wait&&(n.attributes=a),o=e.update(n,i),i.wait&&(n.attributes=r),s=await o;break;case"delete":s=await e.destroy(n,c)}}catch(t){r=22===t.code&&0===e.getStorageSize()?"Private browsing is unsupported":t.message}if(s){if(i&&i.success){const e="read"===t?s:null;i.success(e,i)}}else r=r||"Record Not Found",i&&i.error&&i.error(r)}return t.__name__="localSync",t}removeCollectionReference(e,t){if(!t)return;const n=t.filter((t=>t.id!==e.id)).map((e=>this.getItemName(e.id)));return this.store.setItem(this.name,n)}addCollectionReference(e,t){if(!t)return;const n=t.map((e=>this.getItemName(e.id))),i=this.getItemName(e.id);return n.includes(i)||n.push(i),this.store.setItem(this.name,n)}getCollectionReferenceData(e){if(!e.collection)return{};const t=e.collection.map((e=>this.getItemName(e.id))),n=this.getItemName(e.id);t.includes(n)||t.push(n);const i={};return i[this.name]=t,i}async save(e){if(this.store.setItems){const t={};return t[this.getItemName(e.id)]=e.toJSON(),Object.assign(t,this.getCollectionReferenceData(e)),this.store.debouncedSetItems?this.store.debouncedSetItems(t):this.store.setItems(t)}{const t=this.getItemName(e.id),n=await this.store.setItem(t,e.toJSON());return await this.addCollectionReference(e,e.collection),n}}create(e,t){return e.id||(e.id=Co()+Co()+"-"+Co()+"-"+Co()+"-"+Co()+"-"+Co()+Co()+Co(),e.set(e.idAttribute,e.id,t)),this.save(e)}update(e){return this.save(e)}find(e){return this.store.getItem(this.getItemName(e.id))}async findAll(){const e=await this.store.getItem(this.name);if(null!=e&&e.length){const t=await this.store.getItems(e);return Object.values(t)}return[]}async destroy(e,t){return await this.flush(),await this.store.removeItem(this.getItemName(e.id)),await this.removeCollectionReference(e,t),e}getStorageSize(){return this.store.length}getItemName(e){return this.name+"-"+e}}To.sessionStorageInitialized=so.defineDriver(So),To.localForage=so;const ko=To;function jo(){return Ya.config.get("trusted")?"sessionStorage"===Wl.settings.get("persistent_store")?"session":"persistent":"session"}function $o(e){return"persistent"===e&&"IndexedDB"===Wl.settings.get("persistent_store")}function No(e,t){const n=t||jo(),i=Ya.storage[n];if(void 0===i)throw new TypeError(`createStore: Could not find store for ${e}`);return new ko(e,i,$o(t))}function Oo(e,t,n){const i=n||jo();if(e.browserStorage=No(t,i),$o(i)){const t=()=>e.browserStorage.flush();window.addEventListener(Ya.unloadevent,t),e.on("destroy",(()=>window.removeEventListener(Ya.unloadevent,t))),e.listenTo(Ya,"beforeLogout",t)}}const Io=function(e,t){return Mn(e,t)},Mo=function(e,t,n,i){if(!ye(e))return e;for(var s=-1,r=(t=ei(t,e)).length,o=r-1,a=e;null!=a&&++s<r;){var c=ti(t[s]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(s!=o){var d=a[c];void 0===(l=i?i(d,c,a):void 0)&&(l=ye(d)?d:et(t[s+1])?[]:{})}Le(a,c,l),a=a[c]}return e},Ro=function(e,t){return function(e,t,n){for(var i=-1,s=t.length,r={};++i<s;){var o=t[i],a=ni(e,o);n(a,o)&&Mo(r,ei(o,e),a)}return r}(e,t,(function(t,n){return ri(e,n)}))};var Do=u?u.isConcatSpreadable:void 0;const Lo=function(e){return ct(e)||at(e)||!!(Do&&e&&e[Do])},zo=function e(t,n,i,s,r){var o=-1,a=t.length;for(i||(i=Lo),r||(r=[]);++o<a;){var c=t[o];n>0&&i(c)?n>1?e(c,n-1,i,s,r):en(r,c):s||(r[r.length]=c)}return r},Po=function(e){return null!=e&&e.length?zo(e,1):[]},Fo=function(e){return We(Be(e,void 0,Po),e+"")},Uo=Fo((function(e,t){return null==e?{}:Ro(e,t)}));var Bo=n(1454),qo=n.n(Bo);const Ho=function(e){for(var t=-1,n=null==e?0:e.length,i=0,s=[];++t<n;){var r=e[t];r&&(s[i++]=r)}return s},Go=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var Wo=n(1766),Vo=n.n(Wo);const Jo=function(e){return Us(e,4)};var Qo=Object.prototype,Zo=Qo.hasOwnProperty,Yo=Ze((function(e,t){e=Object(e);var n=-1,i=t.length,s=i>2?t[2]:void 0;for(s&&tt(t[0],t[1],s)&&(i=1);++n<i;)for(var r=t[n],o=Tt(r),a=-1,c=o.length;++a<c;){var l=o[a],d=e[l];(void 0===d||Re(d,Qo[l])&&!Zo.call(e,l))&&(e[l]=r[l])}return e}));const Xo=Yo,Ko=Ze((function(e,t){return function(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)}(e,1,t)})),ea=(ta={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},function(e){return null==ta?void 0:ta[e]});var ta,na=/[&<>"']/g,ia=RegExp(na.source);var sa,ra,oa=Object.prototype.toString,aa=(sa=function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=oa.call(t)),e[t]=n},ra=qe(Pe),function(e,t){return function(e,t,n,i){return ui(e,(function(e,s,r){t(i,n(e),s,r)})),i}(e,sa,ra(t),{})});const ca=aa,la=function(e,t){return t.length<2?e:ni(e,function(e,t,n){var i=-1,s=e.length;t<0&&(t=-t>s?0:s+t),(n=n>s?s:n)<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(s);++i<s;)r[i]=e[i+t];return r}(t,0,-1))},da=function(e,t){return t=ei(t,e),null==(e=la(e,t))||delete e[ti(Go(t))]},ua=function(e){return C(e)?void 0:e};var ha=Fo((function(e,t){var n={};if(null==e)return n;var i=!1;t=Qn(t,(function(t){return t=ei(t,e),i||(i=t.length>1),t})),ze(e,As(e),n),i&&(n=Us(n,7,ua));for(var s=t.length;s--;)da(n,t[s]);return n}));const ma=ha,fa=function(e,t){let n=e||{};t||(t={}),this.preinitialize.apply(this,arguments),this.cid=ji(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{});const i=Ji(this,"defaults");n=Xo(kt({},i,n),i),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};fa.extend=Qi,Object.assign(fa.prototype,$i,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",preinitialize:function(){},initialize:function(){},toJSON:function(e){return Jo(this.attributes)},sync:function(e,t,n){return es(this)(e,t,n)},get:function(e){return this.attributes[e]},keys:function(){return Object.keys(this.attributes)},values:function(){return Object.values(this.attributes)},pairs:function(){return this.entries()},entries:function(){return Object.entries(this.attributes)},invert:function(){return ca(this.attributes)},pick:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length&&Array.isArray(t[0])&&(t=t[0]),Uo(this.attributes,t)},omit:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length&&Array.isArray(t[0])&&(t=t[0]),ma(this.attributes,t)},isEmpty:function(){return pi(this.attributes)},escape:function(e){return t=this.get(e),(t=Kn(t))&&ia.test(t)?t.replace(na,ea):t;var t},has:function(e){return null!=this.get(e)},matches:function(e){return!!function(e){return ci("function"==typeof e?e:Us(e,1))}(e)(this.attributes)},set:function(e,t,n){if(null==e)return this;let i;if("object"==typeof e?(i=e,n=t):(i={})[e]=t,n||(n={}),!this._validate(i,n))return!1;const s=n.unset,r=n.silent,o=[],a=this._changing;this._changing=!0,a||(this._previousAttributes=Jo(this.attributes),this.changed={});const c=this.attributes,l=this.changed,d=this._previousAttributes;for(const e in i)t=i[e],Io(c[e],t)||o.push(e),Io(d[e],t)?delete l[e]:l[e]=t,s?delete c[e]:c[e]=t;if(this.idAttribute in i&&(this.id=this.get(this.idAttribute)),!r){o.length&&(this._pending=n);for(let e=0;e<o.length;e++)this.trigger("change:"+o[e],this,c[o[e]],n)}if(a)return this;if(!r)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,kt({},t,{unset:!0}))},clear:function(e){const t={};for(const e in this.attributes)t[e]=void 0;return this.set(t,kt({},e,{unset:!0}))},hasChanged:function(e){return null==e?!pi(this.changed):Vi(this.changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&Jo(this.changed);const t=this._changing?this._previousAttributes:this.attributes,n={};let i;for(const s in e){const r=e[s];Io(t[s],r)||(n[s]=r,i=!0)}return!!i&&n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return Jo(this._previousAttributes)},fetch:function(e){e=kt({parse:!0},e);const t=this,n=e.success;return e.success=function(i){const s=e.parse?t.parse(i,e):i;if(!t.set(s,e))return!1;n&&n.call(e.context,t,i,e),t.trigger("sync",t,i,e)},Xi(this,e),this.sync("read",this,e)},save:function(e,t,n){let i;null==e||"object"==typeof e?(i=e,n=t):(i={})[e]=t;const s=(n=kt({validate:!0,parse:!0},n)).wait,r=n.promise,o=r&&Zi();if(i&&!s){if(!this.set(i,n))return!1}else if(!this._validate(i,n))return!1;const a=this,c=n.success,l=n.error,d=this.attributes;n.success=function(e){a.attributes=d;let t=n.parse?a.parse(e,n):e;if(s&&(t=kt({},i,t)),t&&!a.set(t,n))return!1;c&&c.call(n.context,a,e,n),a.trigger("sync",a,e,n),r&&o.resolve()},n.error=function(e,t,n){l&&l.call(n.context,e,t,n),r&&o.reject(t)},Xi(this,n),i&&s&&(this.attributes=kt({},d,i));const u=this.isNew()?"create":n.patch?"patch":"update";"patch"!==u||n.attrs||(n.attrs=i);const h=this.sync(u,this,n);return this.attributes=d,r?o:h},destroy:function(e){e=e?Jo(e):{};const t=this,n=e.success,i=e.wait,s=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(r){i&&s(),n&&n.call(e.context,t,r,e),t.isNew()||t.trigger("sync",t,r,e)};let r=!1;return this.isNew()?Ko(e.success):(Xi(this,e),r=this.sync("delete",this,e)),i||s(),r},url:function(){const e=Ji(this,"urlRoot")||Ji(this.collection,"url")||Yi();if(this.isNew())return e;const t=this.get(this.idAttribute);return e.replace(/[^\/]$/,"$&/")+encodeURIComponent(t)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},kt({},e,{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=kt({},this.attributes,e);const n=this.validationError=this.validate(e,t)||null;return!n||(this.trigger("invalid",this,n,kt(t,{validationError:n})),!1)}});var ga=Math.max,pa=Math.min;const va=function(e,t,n){var i,s,r,o,a,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=i,r=s;return i=s=void 0,l=t,o=e.apply(r,n)}function f(e){return l=e,a=setTimeout(p,t),d?m(e):o}function g(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function p(){var e=mo();if(g(e))return v(e);a=setTimeout(p,function(e){var n=t-(e-c);return u?pa(n,r-(e-l)):n}(e))}function v(e){return a=void 0,h&&i?m(e):(i=s=void 0,o)}function y(){var e=mo(),n=g(e);if(i=arguments,s=this,c=e,n){if(void 0===a)return f(c);if(u)return clearTimeout(a),a=setTimeout(p,t),m(c)}return void 0===a&&(a=setTimeout(p,t)),o}return t=Ei(t)||0,ye(n)&&(d=!!n.leading,r=(u="maxWait"in n)?ga(Ei(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==a&&clearTimeout(a),l=0,i=c=s=a=void 0},y.flush=function(){return void 0===a?o:v(mo())},y};var ya=n(6916),_a=n(7993);class ba extends de.Connection{constructor(e,t){super(e,t),this.debouncedReconnect=va(this.reconnect,3e3)}static generateResource(){return`/converse.js-${Math.floor(139749528*Math.random()).toString()}`}async bind(){await Wl.trigger("beforeResourceBinding",{synchronous:!0}),super.bind()}async onDomainDiscovered(e){const t=await e.text(),n=(new window.DOMParser).parseFromString(t,"text/xml").firstElementChild;if("XRD"!=n.nodeName||"http://docs.oasis-open.org/ns/xri/xrd-1.0"!=n.namespaceURI)return R.warn("Could not discover XEP-0156 connection methods");const i=Vo()('Link[rel="urn:xmpp:alt-connections:xbosh"]',n),s=Vo()('Link[rel="urn:xmpp:alt-connections:websocket"]',n),r=i.map((e=>e.getAttribute("href"))),o=s.map((e=>e.getAttribute("href")));0===r.length&&0===o.length?R.warn("Neither BOSH nor WebSocket connection methods have been specified with XEP-0156."):(Wl.settings.set("websocket_url",o.pop()),Wl.settings.set("bosh_service_url",r.pop()),this.service=Wl.settings.get("websocket_url")||Wl.settings.get("bosh_service_url"),this.setProtocol())}async discoverConnectionMethods(e){const t={mode:"cors",headers:{Accept:"application/xrd+xml, text/xml"}},n=`https://${e}/.well-known/host-meta`;let i;try{i=await fetch(n,t)}catch(e){return R.error(`Failed to discover alternative connection methods at ${n}`),void R.error(e)}i.status>=200&&i.status<400?await this.onDomainDiscovered(i):R.warn("Could not discover XEP-0156 connection methods")}async connect(e,t,n){if(Wl.settings.get("discover_connection_methods")){const t=de.getDomainFromJid(e);await this.discoverConnectionMethods(t)}if(!Wl.settings.get("bosh_service_url")&&!Wl.settings.get("websocket_url"))throw new Error("You must supply a value for either the bosh_service_url or websocket_url or both.");super.connect(e,t,n||this.onConnectStatusChanged,59)}async switchTransport(){Wl.connection.isType("websocket")&&Wl.settings.get("bosh_service_url")?(await xa(Ya.bare_jid),this._proto._doDisconnect(),this._proto=new de.Bosh(this),this.service=Wl.settings.get("bosh_service_url")):Wl.connection.isType("bosh")&&Wl.settings.get("websocket_url")&&(Wl.settings.get("authentication")===Ya.ANONYMOUS?await xa(Wl.settings.get("jid")):await xa(Ya.bare_jid),this._proto._doDisconnect(),this._proto=new de.Websocket(this),this.service=Wl.settings.get("websocket_url"))}async reconnect(){R.debug("RECONNECTING: the connection has dropped, attempting to reconnect."),this.reconnecting=!0,await Na();const e=Ya.connfeedback.get("connection_status");e===de.Status.CONNFAIL?this.switchTransport():e===de.Status.AUTHFAIL&&Wl.settings.get("authentication")===Ya.ANONYMOUS&&await xa(Wl.settings.get("jid"));const{__:t}=Ya;return this.setConnectionStatus(de.Status.RECONNECTING,t("The connection has dropped, attempting to reconnect.")),Wl.trigger("will-reconnect"),Wl.settings.get("authentication")===Ya.ANONYMOUS&&await Vl(),Wl.user.login()}async onConnected(e){delete this.reconnecting,this.flush(),await xa(this.jid),await Wl.trigger("afterResourceBinding",e,{synchronous:!0}),e?Wl.trigger("reconnected"):Wl.trigger("connected")}setDisconnectionCause(e,t,n){void 0===e?(delete this.disconnection_cause,delete this.disconnection_reason):(void 0===this.disconnection_cause||n)&&(this.disconnection_cause=e,this.disconnection_reason=t)}setConnectionStatus(e,t){this.status=e,Ya.connfeedback.set({connection_status:e,message:t})}async finishDisconnection(){R.debug("DISCONNECTED"),delete this.reconnecting,this.reset(),Na(),await Vl(),delete Ya.connection,Wl.trigger("disconnected")}onDisconnected(){if(!Wl.settings.get("auto_reconnect"))return this.finishDisconnection();{const e=this.disconnection_reason;if(this.disconnection_cause===de.Status.AUTHFAIL)return Wl.settings.get("credentials_url")||Wl.settings.get("authentication")===Ya.ANONYMOUS?Wl.connection.reconnect():this.finishDisconnection();if(this.status===de.Status.CONNECTING){const{__:e}=Ya;return this.setConnectionStatus(de.Status.CONNFAIL,e("An error occurred while connecting to the chat server.")),this.finishDisconnection()}if(this.disconnection_cause===Ya.LOGOUT||e===de.ErrorCondition.NO_AUTH_MECH||"host-unknown"===e||"remote-connection-failed"===e)return this.finishDisconnection();Wl.connection.reconnect()}}onConnectStatusChanged(e,t){const{__:n}=Ya;var i;if(R.debug(`Status changed to: ${Ya.CONNECTION_STATUS[e]}`),e===de.Status.ATTACHFAIL)this.setConnectionStatus(e),null===(i=this.worker_attach_promise)||void 0===i||i.resolve(!1);else if(e===de.Status.CONNECTED||e===de.Status.ATTACHED){var s,r;if(null!==(s=this.worker_attach_promise)&&void 0!==s&&s.isResolved&&this.status===de.Status.ATTACHED)return;this.setConnectionStatus(e),null===(r=this.worker_attach_promise)||void 0===r||r.resolve(!0),Ya.send_initial_presence=!0,this.setDisconnectionCause(),this.reconnecting?(R.debug(e===de.Status.CONNECTED?"Reconnected":"Reattached"),this.onConnected(!0)):(R.debug(e===de.Status.CONNECTED?"Connected":"Attached"),this.restored&&(Ya.send_initial_presence=!1),this.onConnected())}else if(e===de.Status.DISCONNECTED)this.setDisconnectionCause(e,t),this.onDisconnected();else if(e===de.Status.BINDREQUIRED)this.bind();else if(e===de.Status.ERROR)this.setConnectionStatus(e,n("An error occurred while connecting to the chat server."));else if(e===de.Status.CONNECTING)this.setConnectionStatus(e);else if(e===de.Status.AUTHENTICATING)this.setConnectionStatus(e);else if(e===de.Status.AUTHFAIL)t||(t=n("Your XMPP address and/or password is incorrect. Please try again.")),this.setConnectionStatus(e,t),this.setDisconnectionCause(e,t,!0),this.onDisconnected();else if(e===de.Status.CONNFAIL){var o;let i=t;"host-unknown"===t||"remote-connection-failed"==t?i=n("Sorry, we could not connect to the XMPP host with domain: %1$s",`"${de.getDomainFromJid(this.jid)}"`):void 0!==t&&t===(null==de||null===(o=de.ErrorCondition)||void 0===o?void 0:o.NO_AUTH_MECH)&&(i=n("The XMPP server did not offer a supported authentication mechanism")),this.setConnectionStatus(e,i),this.setDisconnectionCause(e,t)}else e===de.Status.DISCONNECTING&&this.setDisconnectionCause(e,t)}isType(e){return"websocket"===e.toLowerCase()?this._proto instanceof de.Websocket:"bosh"===e.toLowerCase()?de.Bosh&&this._proto instanceof de.Bosh:void 0}hasResumed(){var e;return null!==(e=Wl.settings.get("connection_options"))&&void 0!==e&&e.worker||this.isType("bosh")?Ya.connfeedback.get("connection_status")===de.Status.ATTACHED:!this.do_bind}restoreWorkerSession(){return this.attach(this.onConnectStatusChanged),this.worker_attach_promise=fo(),this.worker_attach_promise}}class wa extends ba{constructor(e,t){super(e,t),this.sent_stanzas=[],this.IQ_stanzas=[],this.IQ_ids=[],this.features=de.xmlHtmlNode('<stream:features xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"><ver xmlns="urn:xmpp:features:rosterver"/><csi xmlns="urn:xmpp:csi:0"/><this xmlns="http://jabber.org/protocol/caps" ver="UwBpfJpEt3IoLYfWma/o/p3FFRo=" hash="sha-1" node="http://prosody.im"/><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><required/></bind><sm xmlns=\'urn:xmpp:sm:3\'/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"><optional/></session></stream:features>').firstChild,this._proto._processRequest=()=>{},this._proto._disconnect=()=>this._onDisconnectTimeout(),this._proto._onDisconnectTimeout=()=>{},this._proto._connect=()=>{this.connected=!0,this.mock=!0,this.jid="romeo@montague.lit/orchard",this._changeConnectStatus(de.Status.BINDREQUIRED)}}_processRequest(){}sendIQ(e,t,n){T(e)||(e=e.nodeTree),this.IQ_stanzas.push(e);const i=super.sendIQ(e,t,n);return this.IQ_ids.push(i),i}send(e){return T(e)?this.sent_stanzas.push(e):this.sent_stanzas.push(e.nodeTree),super.send(e)}async bind(){await Wl.trigger("beforeResourceBinding",{synchronous:!0}),this.authenticated=!0,Ya.no_connection_on_bind||this._changeConnectStatus(de.Status.CONNECTED)}}function Sa(e,t){t=e.session.get("jid")||t,e.api.settings.get("authentication")===e.ANONYMOUS||de.getResourceFromJid(t)||(t=t.toLowerCase()+ba.generateResource()),e.jid=t,e.bare_jid=de.getBareJidFromJid(t),e.resource=de.getResourceFromJid(t),e.domain=de.getDomainFromJid(t),e.session.save({jid:t,bare_jid:e.bare_jid,resource:e.resource,domain:e.domain,active:!0}),e.connection.jid=t}async function xa(e){return await async function(e,t){var n;const i=e.api.settings.get("connection_options").worker,s=de.getBareJidFromJid(t).toLowerCase(),r=`converse.session-${s}`;(null===(n=e.session)||void 0===n?void 0:n.get("id"))!==r?(function(e,t){if("sessionStorage"===e.api.settings.get("persistent_store"))return;if("BrowserExtLocal"===e.api.settings.get("persistent_store"))return ko.localForage.defineDriver(ya.Z).then((()=>ko.localForage.setDriver("webExtensionLocalStorage"))),void(e.storage.persistent=ko.localForage);if("BrowserExtSync"===e.api.settings.get("persistent_store"))return ko.localForage.defineDriver(_a.Z).then((()=>ko.localForage.setDriver("webExtensionSyncStorage"))),void(e.storage.persistent=ko.localForage);const n={name:e.isTestEnv()?"converse-test-persistent":"converse-persistent",storeName:t};"localStorage"===e.api.settings.get("persistent_store")?(n.description="localStorage instance",n.driver=[ko.localForage.LOCALSTORAGE]):"IndexedDB"===e.api.settings.get("persistent_store")&&(n.description="indexedDB instance",n.driver=[ko.localForage.INDEXEDDB]),e.storage.persistent=ko.localForage.createInstance(n)}(e,s),e.session=new fa({id:r}),Oo(e.session,r,i?"persistent":"session"),await new Promise((t=>e.session.fetch({success:t,error:t}))),!i&&e.session.get("active")&&(e.session.clear(),e.session.save({id:r})),Sa(e,t),e.api.trigger("userSessionInitialized")):Sa(e,t)}(Ya,e),Ya.api.trigger("setUserJID"),e}function Ea(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise(va((async(e,t)=>{let n=new XMLHttpRequest;n.open("GET",Ya.api.settings.get("credentials_url"),!0),n.setRequestHeader("Accept","application/json, text/javascript"),n.onload=()=>{if(n.status>=200&&n.status<400){const t=JSON.parse(n.responseText);xa(t.jid).then((()=>{e({jid:t.jid,password:t.password})}))}else t(new Error(`${n.status}: ${n.responseText}`))},n.onerror=t,n=await Ya.api.hook("beforeFetchLoginCredentials",this,n),n.send()}),e))}function Aa(){const{api:e}=Ya;return("WebSocket"in window||"MozWebSocket"in window)&&e.settings.get("websocket_url")?e.settings.get("websocket_url"):e.settings.get("bosh_service_url")?e.settings.get("bosh_service_url"):""}function Ca(e){const{api:t}=Ya;if([Ya.ANONYMOUS,Ya.EXTERNAL].includes(t.settings.get("authentication"))){if(!Ya.jid)throw new Error("Config Error: when using anonymous login you need to provide the server's domain via the 'jid' option. Either when calling converse.initialize, or when calling _converse.api.user.login.");Ya.connection.reconnecting||Ya.connection.reset(),Ya.connection.connect(Ya.jid.toLowerCase())}else if(t.settings.get("authentication")===Ya.LOGIN){var n;const i=(null==e?void 0:e.password)??((null===(n=Ya.connection)||void 0===n?void 0:n.pass)||t.settings.get("password"));if(!i){if(t.settings.get("auto_login"))throw new Error("autoLogin: If you use auto_login and authentication='login' then you also need to provide a password.");return Ya.connection.setDisconnectionCause(de.Status.AUTHFAIL,void 0,!0),void t.connection.disconnect()}Ya.connection.reconnecting||(Ya.connection.reset(),Ya.connection.service=Aa()),Ya.connection.connect(Ya.jid,i)}}const Ta={extend:e=>function(e){Ba.merge(qa,e);const t=Object.keys(Uo(e,Object.keys(qa))),n=Uo(Wa,t),i=kt(Uo(e,t),n);Ba.merge(Ha,i)}(e),update(e){return R.warn("The api.settings.update method has been deprecated and will be removed. Please use api.settings.extend instead."),this.extend(e)},get:e=>function(e){if(Object.keys(qa).includes(e))return Ha[e]}(e),set(e,t){!function(e,t){if(null==e)return this;let n;ye(e)?n=e:"string"==typeof e&&(n={},n[e]=t);const i=Object.keys(Uo(n,Object.keys(qa))),s={};i.forEach((e=>{const t=n[e];Io(Ha[e],t)||(s[e]=t,Ha[e]=t)})),Object.keys(s).forEach((e=>Ha.trigger("change:"+e,s[e]))),Ha.trigger("change",s)}(e,t)},listen:{on(e,t,n){!function(e,t,n){Ha.on(e,t,n)}(e,t,n)},not(e,t){!function(e,t){Ha.off(e,t)}(e,t)}}},ka={getModel:()=>Qa(),async get(e,t){const n=await Qa();return void 0===n.get(e)?t:n.get(e)},set(e,t){if(ye(e))return Za(e,{promise:!0});{const n={};return n[e]=t,Za(n,{promise:!0})}},clear:()=>async function(){return await Ja(),Ga.clear()}()};function ja(e){return e instanceof fa&&(e=e.attributes),!(e.oob_url||e.file||e.is_encrypted&&e.plaintext||e.message)}function $a(){return["mobile","fullscreen","embedded"].includes(Ta.get("view_mode"))}async function Na(){return await Ya.api.trigger("beforeTearDown",{synchronous:!0}),window.removeEventListener("click",Ya.onUserActivity),window.removeEventListener("focus",Ya.onUserActivity),window.removeEventListener("keypress",Ya.onUserActivity),window.removeEventListener("mousemove",Ya.onUserActivity),window.removeEventListener(Ya.unloadevent,Ya.onUserActivity),window.clearInterval(Ya.everySecondTrigger),Ya.api.trigger("afterTearDown"),Ya}const Oa={isTagEqual:function(e,t){if(e.nodeTree)return Oa.isTagEqual(e.nodeTree,t);if(e instanceof Element)return de.isTagEqual(e,t);throw Error("isTagEqual called with value which isn't an element or Strophe.Builder instance")}},Ia=new DOMParser,Ma=Ia.parseFromString("invalid","text/xml").getElementsByTagName("parsererror")[0].namespaceURI;function Ra(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}function Da(e,t,n){Oa.isPersistableModel(e)?e.save(t,n):e.set(t,n)}function La(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t}function za(e,t){clearTimeout(e),clearInterval(t)}function Pa(e){const t=Ya.promises[e];if(!t)throw new Error(`Tried to replace non-existing promise: ${e}`);if(t.replace){const n=fo();n.replace=t.replace,Ya.promises[e]=n}else R.debug(`Not replacing promise "${e}"`)}Oa.getJIDFromURI=function(e){return e.startsWith("xmpp:")&&e.endsWith("?join")?e.replace(/^xmpp:/,"").replace(/\?join$/,""):e},Oa.toStanza=function(e){const t=Ia.parseFromString(e,"text/xml");if(t.getElementsByTagNameNS(Ma,"parsererror").length)throw new Error(`Parser Error: ${e}`);return t.firstElementChild},Oa.getLongestSubstring=function(e,t){return t.reduce((function(t,n){return e.startsWith(n)&&n.length>t.length?n:t}),"")},Oa.isValidJID=function(e){return"string"==typeof e&&2===Ho(e.split("@")).length&&!e.startsWith("@")&&!e.endsWith("@")},Oa.isValidMUCJID=function(e){return!e.startsWith("@")&&!e.endsWith("@")},Oa.isSameBareJID=function(e,t){return"string"==typeof e&&"string"==typeof t&&de.getBareJidFromJid(e).toLowerCase()===de.getBareJidFromJid(t).toLowerCase()},Oa.isSameDomain=function(e,t){return"string"==typeof e&&"string"==typeof t&&de.getDomainFromJid(e).toLowerCase()===de.getDomainFromJid(t).toLowerCase()},Oa.isNewMessage=function(e){return e instanceof Element?!(Vo()(`result[xmlns="${de.NS.MAM}"]`,e).length&&Vo()(`delay[xmlns="${de.NS.DELAY}"]`,e).length):(e instanceof fa&&(e=e.attributes),!(e.is_delayed&&e.is_archived))},Oa.shouldCreateMessage=function(e){return e.retracted||!ja(e)},Oa.shouldCreateGroupchatMessage=function(e){return e.nick&&(Oa.shouldCreateMessage(e)||e.is_tombstone)},Oa.isChatRoom=function(e){return e&&"chatroom"===e.get("type")},Oa.isErrorObject=function(e){return e instanceof Error},Oa.isErrorStanza=function(e){return!!T(e)&&"error"===e.getAttribute("type")},Oa.isForbiddenError=function(e){return!!T(e)&&Vo()(`error[type="auth"] forbidden[xmlns="${de.NS.STANZAS}"]`,e).length>0},Oa.isServiceUnavailableError=function(e){return!!T(e)&&Vo()(`error[type="cancel"] service-unavailable[xmlns="${de.NS.STANZAS}"]`,e).length>0},Oa.merge=function e(t,n){for(const i in n)ye(t[i])?e(t[i],n[i]):t[i]=n[i]},Oa.getOuterWidth=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.offsetWidth;if(!t)return n;const i=window.getComputedStyle(e);return n+=parseInt(i.marginLeft?i.marginLeft:0,10)+parseInt(i.marginRight?i.marginRight:0,10),n},Oa.stringToElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},Oa.matchesSelector=function(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return!!n&&n.call(e,t)},Oa.queryChildren=function(e,t){return Array.from(e.childNodes).filter((e=>Oa.matchesSelector(e,t)))},Oa.contains=function(e,t){const n=(e,n)=>e.get(n).toLowerCase().includes(t.toLowerCase());return function(t){if("object"==typeof e)return Object.keys(e).reduce(((e,i)=>e||n(t,i)),!1);if("string"==typeof e)return n(t,e);throw new TypeError("contains: wrong attribute type. Must be string or array.")}},Oa.isOfType=function(e,t){return t.get("type")==e},Oa.isInstance=function(e,t){return t instanceof e},Oa.getAttribute=function(e,t){return t.get(e)},Oa.contains.not=function(e,t){return function(n){return!Oa.contains(e,t)(n)}},Oa.rootContains=function(e,t){return e!==document||e.contains?e.contains?e.contains(t):window.HTMLElement.prototype.contains.call(e,t):document.head.contains(t)||document.body.contains(t)},Oa.createFragmentFromText=function(e){var t,n=document.createDocumentFragment(),i=document.createElement("body");for(i.innerHTML=e;t=i.firstChild;)n.appendChild(t);return n},Oa.isPersistableModel=function(e){return e.collection&&e.collection.browserStorage},Oa.getResolveablePromise=fo,Oa.getOpenPromise=fo,Oa.interpolate=function(e,t){return e.replace(/{{{([^{}]*)}}}/g,((e,n)=>{var i=t[n];return"string"==typeof i||"number"==typeof i?i:e}))},Oa.onMultipleEvents=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=[];function i(i){n.push(i),e.length===n.length&&(t(n),n=[])}e.forEach((e=>e.object.on(e.event,i)))},Oa.safeSave=Da,Oa.siblingIndex=function(e){for(var t=0;e=e.previousElementSibling;t++);return t},Oa.getCurrentWord=function(e,t,n){t||(t=e.selectionEnd||void 0);let[i]=e.value.slice(0,t).split(/\s/).slice(-1);return n&&([i]=i.split(n).slice(-1)),i},Oa.isMentionBoundary=e=>"@"!==e&&RegExp("(\\p{Z}|\\p{P})","u").test(e),Oa.replaceCurrentWord=function(e,t){const n=e.selectionEnd||void 0,i=Go(e.value.slice(0,n).split(/\s/)),s=e.value,r=Oa.isMentionBoundary(i[0])?i[0]:"";e.value=s.slice(0,n-i.length)+r+`${t} `+s.slice(n);const o=n-i.length+t.length+1;e.selectionEnd=r?o+1:o},Oa.triggerEvent=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Event",i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const r=document.createEvent(n);r.initEvent(t,i,s),e.dispatchEvent(r)},Oa.getSelectValues=function(e){const t=[],n=e&&e.options;for(var i=0,s=n.length;i<s;i++){const e=n[i];e.selected&&t.push(e.value||e.text)}return t},Oa.getRandomInt=function(e){return Math.floor(Math.random()*Math.floor(e))},Oa.placeCaretAtEnd=function(e){e!==document.activeElement&&e.focus();const t=2*e.value.length;setTimeout((()=>e.setSelectionRange(t,t)),1),this.scrollTop=999999},Oa.httpToGeoUri=function(e){return e.replace(Ta.get("geouri_regex"),"geo:$1,$2")},Oa.waitUntil=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3;try{const t=e();if(t)return Promise.resolve(t)}catch(e){return Promise.reject(e)}const i=fo(),s=new Error;function r(){try{const t=e();t&&(za(c,o),i.resolve(t))}catch(e){za(c,o),i.reject(e)}}const o=setInterval(r,n);function a(){za(c,o);const e=`Wait until promise timed out: \n\n${s.stack}`;console.trace(),R.error(e),i.reject(new Error(e))}const c=setTimeout(a,t);return i};const Fa=document.createElement("div");function Ua(e){return e&&"string"==typeof e&&(Fa.innerHTML=qo().sanitize(e),e=Fa.textContent,Fa.textContent=""),e}const Ba=Object.assign({prefixMentions:Ra,isEmptyMessage:ja,getUniqueId:La},Oa),qa={allow_non_roster_messaging:!1,allow_url_history_change:!0,assets_path:"/dist",authentication:"login",auto_login:!1,auto_reconnect:!0,blacklisted_plugins:[],clear_cache_on_logout:!1,connection_options:{},credentials_url:null,discover_connection_methods:!0,geouri_regex:/https\:\/\/www.openstreetmap.org\/.*#map=[0-9]+\/([\-0-9.]+)\/([\-0-9.]+)\S*/g,geouri_replacement:"https://www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2",i18n:void 0,idle_presence_timeout:300,jid:void 0,keepalive:!0,loglevel:"info",locales:["af","ar","bg","ca","cs","da","de","el","eo","es","eu","en","fa","fi","fr","gl","he","hi","hu","id","it","ja","lt","nb","nl","mr","oc","pl","pt","pt_BR","ro","ru","sv","th","tr","uk","vi","zh_CN","zh_TW"],nickname:void 0,password:void 0,persistent_store:"IndexedDB",rid:void 0,root:window.document,sid:void 0,singleton:!1,strict_plugin_dependencies:!1,view_mode:"overlayed",websocket_url:void 0,whitelisted_plugins:[]};let Ha,Ga,Wa={};function Va(){return Ha}function Ja(){var e;if(!Ya.bare_jid){const e="No JID to fetch user settings for";throw R.error(e),Error(e)}if(null===(e=Ga)||void 0===e||!e.fetched){const e=`converse.user-settings.${Ya.bare_jid}`;Ga=new fa({id:e}),Oo(Ga,e),Ga.fetched=Ga.fetch({promise:!0})}return Ga.fetched}async function Qa(){return await Ja(),Ga}async function Za(e,t){return await Ja(),Ga.save(e,t)}const Ya={log:R,CONNECTION_STATUS:fe,templates:{},promises:{initialized:fo()},STATUS_WEIGHTS:{offline:6,unavailable:5,xa:4,away:3,dnd:2,chat:1,online:1},ANONYMOUS:"anonymous",CLOSED:"closed",EXTERNAL:"external",LOGIN:"login",LOGOUT:"logout",OPENED:"opened",PREBIND:"prebind",STANZA_TIMEOUT:2e4,SUCCESS:"success",FAILURE:"failure",DEFAULT_IMAGE_TYPE:"image/svg+xml",DEFAULT_IMAGE:"PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+CiA8cmVjdCB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgZmlsbD0iIzU1NSIvPgogPGNpcmNsZSBjeD0iNjQiIGN5PSI0MSIgcj0iMjQiIGZpbGw9IiNmZmYiLz4KIDxwYXRoIGQ9Im0yOC41IDExMiB2LTEyIGMwLTEyIDEwLTI0IDI0LTI0IGgyMyBjMTQgMCAyNCAxMiAyNCAyNCB2MTIiIGZpbGw9IiNmZmYiLz4KPC9zdmc+Cg==",TIMEOUTS:{PAUSED:1e4,INACTIVE:9e4},INACTIVE:"inactive",ACTIVE:"active",COMPOSING:"composing",PAUSED:"paused",GONE:"gone",PRIVATE_CHAT_TYPE:"chatbox",CHATROOMS_TYPE:"chatroom",HEADLINES_TYPE:"headline",CONTROLBOX_TYPE:"controlbox",default_connection_options:{explicitResourceBinding:!0},router:new ds,TimeoutError:gs,isTestEnv:()=>"montague.lit/http-bind"===Wa.bosh_service_url,getDefaultStore:jo,createStore:No,__:function(){return o.__(...arguments)},___:e=>e};var Xa=n(8030),Ka=n.n(Xa),ec=n(8570),tc=n.n(ec);const nc=function(e,t,n){t=ei(t,e);var i=null==(e=la(e,t))?e:e[ti(Go(t))];return null==i?void 0:Fe(i,e,n)},ic=Ze(nc);function sc(e,t,n,i){"function"==typeof n&&(void 0===this.__super__&&(this.__super__=i),this.__super__[e]=n.bind(this));for(var s=arguments.length,r=new Array(s>4?s-4:0),o=4;o<s;o++)r[o-4]=arguments[o];return t.apply(this,r)}class rc{constructor(e,t){this.name=t,this.plugged=e,void 0===this.plugged.__super__?this.plugged.__super__={}:"string"==typeof this.plugged.__super__&&(this.plugged.__super__={__string__:this.plugged.__super__}),this.plugged.__super__[t]=this.plugged,this.plugins={},this.initialized_plugins=[]}_overrideAttribute(e,t){const n=t.overrides[e];if("function"==typeof n){const t={};t[this.name]=this.plugged;const i=this.plugged[e];this.plugged[e]=function(){for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return sc.apply(this,[e,n,i,t,...r])}}else this.plugged[e]=n}_extendObject(e,t){e.prototype.__super__||(e.prototype.__super__={},e.prototype.__super__[this.name]=this.plugged);for(const[n,i]of Object.entries(t))if("events"===n)e.prototype[n]=Object.assign(i,e.prototype[n]);else if("function"==typeof i){const t={};t[this.name]=this.plugged;const s=e.prototype[n];e.prototype[n]=function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return sc.apply(this,[n,i,s,t,...r])}}else e.prototype[n]=i}loadPluginDependencies(e){var t;null===(t=e.dependencies)||void 0===t||t.forEach((t=>{const n=this.plugins[t];if(n){var i;if(null!==(i=n.dependencies)&&void 0!==i&&i.includes(e.__name__))throw'Found a circular dependency between the plugins "'+e.__name__+'" and "'+t+'"';this.initializePlugin(n)}else this.throwUndefinedDependencyError('Could not find dependency "'+t+'" for the plugin "'+e.__name__+"\". If it's needed, make sure it's loaded by require.js")}))}throwUndefinedDependencyError(e){if(this.plugged.strict_plugin_dependencies)throw e;console.warn?console.warn(e):console.log(e)}applyOverrides(e){Object.keys(e.overrides||{}).forEach((t=>{const n=e.overrides[t];"object"==typeof n?void 0===this.plugged[t]?this.throwUndefinedDependencyError(`Plugin "${e.__name__}" tried to override "${t}" but it's not found.`):this._extendObject(this.plugged[t],n):this._overrideAttribute(t,e)}))}initializePlugin(e){var t;Object.keys(this.allowed_plugins).includes(e.__name__)&&(this.initialized_plugins.includes(e.__name__)||("boolean"==typeof e.enabled&&e.enabled||null!==(t=e.enabled)&&void 0!==t&&t.call(e,this.plugged)||null==e.enabled)&&(Object.assign(e,this.properties),e.dependencies&&this.loadPluginDependencies(e),this.applyOverrides(e),"function"==typeof e.initialize&&e.initialize.bind(e)(this),this.initialized_plugins.push(e.__name__)))}registerPlugin(e,t){if(e in this.plugins)throw new Error("Error: Plugin name "+e+" is already taken");t.__name__=e,this.plugins[e]=t}initializePlugins(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(Object.keys(this.plugins).length){this.properties=e,this.allowed_plugins={};for(const[e,i]of Object.entries(this.plugins))t.length&&!t.includes(e)||n.includes(e)||(this.allowed_plugins[e]=i);Object.values(this.allowed_plugins).forEach((e=>this.initializePlugin(e)))}}}const oc=function(e,t,n){return void 0===n&&(n="pluginSocket"),void 0===t&&(t="plugged"),e[n]=new rc(e,t),e},ac=function(e,t,n,i){for(var s=-1,r=null==e?0:e.length;++s<r;){var o=e[s];t(i,o,n(o),e)}return i},cc=function(e,t,n,i){return hi(e,(function(e,s,r){t(i,e,n(e),r)})),i},lc=function(e,t){return function(n,i){var s=ct(n)?ac:cc,r=t?t():{};return s(n,e,ci(i),r)}};var dc=Object.prototype.hasOwnProperty;const uc=lc((function(e,t,n){dc.call(e,n)?++e[n]:Me(e,n,1)})),hc=function(e,t,n,i){for(var s=e.length,r=n+(i?1:-1);i?r--:++r<s;)if(t(e[r],r,e))return r;return-1},mc=function(e){return e!=e},fc=function(e,t,n){return t==t?function(e,t,n){for(var i=n-1,s=e.length;++i<s;)if(e[i]===t)return i;return-1}(e,t,n):hc(e,mc,n)},gc=function(e,t){return!(null==e||!e.length)&&fc(e,t,0)>-1},pc=function(e,t,n){for(var i=-1,s=null==e?0:e.length;++i<s;)if(n(t,e[i]))return!0;return!1},vc=Ze((function(e,t){return oo(e)?function(e,t,n,i){var s=-1,r=gc,o=!0,a=e.length,c=[],l=t.length;if(!a)return c;n&&(t=Qn(t,ft(n))),i?(r=pc,o=!1):t.length>=200&&(r=Vt,o=!1,t=new Wt(t));e:for(;++s<a;){var d=e[s],u=null==n?d:n(d);if(d=i||0!==d?d:0,o&&u==u){for(var h=l;h--;)if(t[h]===u)continue e;c.push(d)}else r(t,u,i)||c.push(d)}return c}(e,zo(t,1,oo,!0)):[]})),yc=function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(!t(e[n],n,e))return!1;return!0},_c=function(e,t){var n=!0;return hi(e,(function(e,i,s){return n=!!t(e,i,s)})),n};var bc=Math.max;var wc=Math.max,Sc=Math.min;var xc=Object.prototype.hasOwnProperty;const Ec=lc((function(e,t,n){xc.call(e,n)?e[n].push(t):Me(e,n,[t])}));var Ac=Math.max;const Cc=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=null==n?0:Ci(n);return s<0&&(s=Ac(i+s,0)),fc(e,t,s)};const Tc=lc((function(e,t,n){Me(e,n,t)}));var kc=Math.max,jc=Math.min;const $c=function(e,t){if(e!==t){var n=void 0!==e,i=null===e,s=e==e,r=Pn(e),o=void 0!==t,a=null===t,c=t==t,l=Pn(t);if(!a&&!l&&!r&&e>t||r&&o&&c&&!a&&!l||i&&o&&c||!n&&c||!s)return 1;if(!i&&!r&&!l&&e<t||l&&n&&s&&!i&&!r||a&&n&&s||!o&&s||!c)return-1}return 0},Nc=function(e,t,n){t=t.length?Qn(t,(function(e){return ct(e)?function(t){return ni(t,1===e.length?e[0]:e)}:e})):[Pe];var i=-1;t=Qn(t,ft(ci));var s=function(e,t){var n=-1,i=Xe(e)?Array(e.length):[];return hi(e,(function(e,s,r){i[++n]=t(e,s,r)})),i}(e,(function(e,n,s){return{criteria:Qn(t,(function(t){return t(e)})),index:++i,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(s,(function(e,t){return function(e,t,n){for(var i=-1,s=e.criteria,r=t.criteria,o=s.length,a=n.length;++i<o;){var c=$c(s[i],r[i]);if(c)return i>=a?c:c*("desc"==n[i]?-1:1)}return e.index-t.index}(e,t,n)}))};var Oc=Ze((function(e,t){if(null==e)return[];var n=t.length;return n>1&&tt(e,t[0],t[1])?t=[]:n>2&&tt(t[0],t[1],t[2])&&(t=[t[0]]),Nc(e,zo(t,1),[])}));const Ic=Oc,Mc=Array.prototype.slice,Rc=function(e,t){t||(t={}),this.preinitialize.apply(this,arguments),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,kt({silent:!0},t))};Rc.extend=Qi;const Dc={add:!0,remove:!0,merge:!0},Lc={add:!0,remove:!1},zc=function(e,t,n){n=Math.min(Math.max(n,0),e.length);const i=Array(e.length-n),s=t.length;let r;for(r=0;r<i.length;r++)i[r]=e[r+n];for(r=0;r<s;r++)e[r+n]=t[r];for(r=0;r<i.length;r++)e[r+s+n]=i[r]};Object.assign(Rc.prototype,$i,{model:fa,preinitialize:function(){},initialize:function(){},toJSON:function(e){return this.map((function(t){return t.toJSON(e)}))},sync:function(e,t,n){return es(this)(e,t,n)},add:function(e,t){return this.set(e,kt({merge:!1},t,Lc))},remove:function(e,t){t=kt({},t);const n=!Array.isArray(e);e=n?[e]:e.slice();const i=this._removeModels(e,t);return!t.silent&&i.length&&(t.changes={added:[],merged:[],removed:i},this.trigger("update",this,t)),n?i[0]:i},set:function(e,t){if(null==e)return;(t=kt({},Dc,t)).parse&&!this._isModel(e)&&(e=this.parse(e,t)||[]);const n=!Array.isArray(e);e=n?[e]:e.slice();let i=t.at;null!=i&&(i=+i),i>this.length&&(i=this.length),i<0&&(i+=this.length+1);const s=[],r=[],o=[],a=[],c={},l=t.add,d=t.merge,u=t.remove;let h=!1;const m=this.comparator&&null==i&&!1!==t.sort,f=Bs(this.comparator)?this.comparator:null;let g,p;for(p=0;p<e.length;p++){g=e[p];const n=this.get(g);if(n){if(d&&g!==n){let e=this._isModel(g)?g.attributes:g;t.parse&&(e=n.parse(e,t)),n.set(e,t),o.push(n),m&&!h&&(h=n.hasChanged(f))}c[n.cid]||(c[n.cid]=!0,s.push(n)),e[p]=n}else l&&(g=e[p]=this._prepareModel(g,t),g&&(r.push(g),this._addReference(g,t),c[g.cid]=!0,s.push(g)))}if(u){for(p=0;p<this.length;p++)g=this.models[p],c[g.cid]||a.push(g);a.length&&this._removeModels(a,t)}let v=!1;const y=!m&&l&&u;if(s.length&&y?(v=this.length!==s.length||fi(this.models,((e,t)=>e!==s[t])),this.models.length=0,zc(this.models,s,0),this.length=this.models.length):r.length&&(m&&(h=!0),zc(this.models,r,null==i?this.length:i),this.length=this.models.length),h&&this.sort({silent:!0}),!t.silent){for(p=0;p<r.length;p++)null!=i&&(t.index=i+p),g=r[p],g.trigger("add",g,this,t);(h||v)&&this.trigger("sort",this,t),(r.length||a.length||o.length)&&(t.changes={added:r,removed:a,merged:o},this.trigger("update",this,t))}return n?e[0]:e},clearStore:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;await Promise.all(this.models.filter(t).map((t=>new Promise((n=>{t.destroy(Object.assign(e,{success:n,error:(e,t)=>{console.error(t),n()}}))}))))),await this.browserStorage.clear(),this.reset()},reset:function(e,t){t=t?Jo(t):{};for(let e=0;e<this.models.length;e++)this._removeReference(this.models[e],t);return t.previousModels=this.models,this._reset(),e=this.add(e,kt({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,kt({at:this.length},t))},pop:function(e){const t=this.at(this.length-1);return this.remove(t,e)},unshift:function(e,t){return this.add(e,kt({at:0},t))},shift:function(e){const t=this.at(0);return this.remove(t,e)},slice:function(){return Mc.apply(this.models,arguments)},filter:function(e,t){return this.models.filter(_e(e)?e:t=>t.matches(e),t)},every:function(e){return function(e,t,n){var i=ct(e)?yc:_c;return n&&tt(e,t,n)&&(t=void 0),i(e,ci(t))}(this.models.map((e=>e.attributes)),e)},difference:function(e){return vc(this.models,e)},max:function(){return Math.max.apply(Math,this.models)},min:function(){return Math.min.apply(Math,this.models)},drop:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.models.slice(e)},some:function(e){return fi(this.models.map((e=>e.attributes)),e)},sortBy:function(e){return Ic(this.models,_e(e)?e:t=>Bs(e)?t.get(e):t.matches(e))},isEmpty:function(){return pi(this.models)},keyBy:function(e){return Tc(this.models,e)},each:function(e,t){return this.forEach(e,t)},forEach:function(e,t){return this.models.forEach(e,t)},includes:function(e){return this.models.includes(e)},size:function(){return this.models.length},countBy:function(e){return uc(this.models,_e(e)?e:t=>Bs(e)?t.get(e):t.matches(e))},groupBy:function(e){return Ec(this.models,_e(e)?e:t=>Bs(e)?t.get(e):t.matches(e))},indexOf:function(e){return Cc(this.models,e)},findLastIndex:function(e,t){return function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=i-1;return void 0!==n&&(s=Ci(n),s=n<0?wc(i+s,0):Sc(s,i-1)),hc(e,ci(t),s,!0)}(this.models,_e(e)?e:t=>Bs(e)?t.get(e):t.matches(e),t)},lastIndexOf:function(e){return function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=i;return void 0!==n&&(s=(s=Ci(n))<0?kc(i+s,0):jc(s,i-1)),t==t?function(e,t,n){for(var i=n+1;i--;)if(e[i]===t)return i;return i}(e,t,s):hc(e,mc,s,!0)}(this.models,e)},findIndex:function(e){return function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var s=null==n?0:Ci(n);return s<0&&(s=bc(i+s,0)),hc(e,ci(t),s)}(this.models,_e(e)?e:t=>Bs(e)?t.get(e):t.matches(e))},last:function(){const e=null==this.models?0:this.models.length;return e?this.models[e-1]:void 0},head:function(){return this.models[0]},first:function(){return this.head()},map:function(e,t){return this.models.map(_e(e)?e:t=>Bs(e)?t.get(e):t.matches(e),t)},reduce:function(e,t){return this.models.reduce(e,t||this.models[0])},reduceRight:function(e,t){return this.models.reduceRight(e,t||this.models[0])},toArray:function(){return Array.from(this.models)},get:function(e){if(null!=e)return this._byId[e]||this._byId[this.modelId(this._isModel(e)?e.attributes:e)]||e.cid&&this._byId[e.cid]},has:function(e){return null!=this.get(e)},at:function(e){return e<0&&(e+=this.length),this.models[e]},where:function(e,t){return this[t?"find":"filter"](e)},findWhere:function(e){return this.where(e,!0)},find:function(e,t){const n=_e(e)?e:t=>t.matches(e);return this.models.find(n,t)},sort:function(e){let t=this.comparator;if(!t)throw new Error("Cannot sort a set without a comparator");e||(e={});const n=t.length;return _e(t)&&(t=t.bind(this)),1===n||Bs(t)?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return this.map(e+"")},fetch:function(e){const t=(e=kt({parse:!0},e)).success,n=this,i=e.promise&&Zi();return e.success=function(s){const r=e.reset?"reset":"set";n[r](s,e),t&&t.call(e.context,n,s,e),i&&i.resolve(),n.trigger("sync",n,s,e)},Xi(this,e),i||this.sync("read",this,e)},create:function(e,t){const n=(t=t?Jo(t):{}).wait,i=t.promise,s=i&&Zi();if(!(e=this._prepareModel(e,t)))return!1;n||this.add(e,t);const r=this,o=t.success,a=t.error;return t.success=function(e,t,a){n&&r.add(e,a),o&&o.call(a.context,e,t,a),i&&s.resolve(e)},t.error=function(e,t,n){a&&a.call(n.context,e,t,n),i&&s.reject(t)},e.save(null,Object.assign(t,{promise:!1})),i?s:e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){var t;return e[(null===(t=this.model.prototype)||void 0===t?void 0:t.idAttribute)||"id"]},values:function(){return new Fc(this,Uc)},keys:function(){return new Fc(this,Bc)},entries:function(){return new Fc(this,qc)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;(t=t?Jo(t):{}).collection=this;const n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_removeModels:function(e,t){const n=[];for(let i=0;i<e.length;i++){const s=this.get(e[i]);if(!s)continue;const r=this.indexOf(s);this.models.splice(r,1),this.length--,delete this._byId[s.cid];const o=this.modelId(s.attributes);null!=o&&delete this._byId[o],t.silent||(t.index=r,s.trigger("remove",s,this,t)),n.push(s),this._removeReference(s,t)}return n},_isModel:function(e){return e instanceof fa},_addReference:function(e,t){this._byId[e.cid]=e;const n=this.modelId(e.attributes);null!=n&&(this._byId[n]=e),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){delete this._byId[e.cid];const n=this.modelId(e.attributes);null!=n&&delete this._byId[n],this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,i){if(t){if(("add"===e||"remove"===e)&&n!==this)return;if("destroy"===e&&this.remove(t,i),"change"===e){const e=this.modelId(t.previousAttributes()),n=this.modelId(t.attributes);e!==n&&(null!=e&&delete this._byId[e],null!=n&&(this._byId[n]=t))}}this.trigger.apply(this,arguments)}});const Pc="function"==typeof Symbol&&Symbol.iterator;Pc&&(Rc.prototype[Pc]=Rc.prototype.values);const Fc=function(e,t){this._collection=e,this._kind=t,this._index=0},Uc=1,Bc=2,qc=3;Pc&&(Fc.prototype[Pc]=function(){return this}),Fc.prototype.next=function(){if(this._collection){if(this._index<this._collection.length){const e=this._collection.at(this._index);let t;if(this._index++,this._kind===Uc)t=e;else{const n=this._collection.modelId(e.attributes);t=this._kind===Bc?n:[n,e]}return{value:t,done:!1}}this._collection=void 0}return{value:void 0,done:!0}};const Hc=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Gc=Symbol(),Wc=new Map;class Vc{constructor(e,t){if(this._$cssResult$=!0,t!==Gc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){let e=Wc.get(this.cssText);return Hc&&void 0===e&&(Wc.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const Jc=e=>new Vc("string"==typeof e?e:e+"",Gc),Qc=Hc?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Jc(t)})(e):e;var Zc;const Yc=window.trustedTypes,Xc=Yc?Yc.emptyScript:"",Kc=window.reactiveElementPolyfillSupport,el={toAttribute(e,t){switch(t){case Boolean:e=e?Xc:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},tl=(e,t)=>t!==e&&(t==t||e==e),nl={attribute:!0,type:String,converter:el,reflect:!1,hasChanged:tl};class il extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(e){var t;null!==(t=this.l)&&void 0!==t||(this.l=[]),this.l.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const i=this._$Eh(n,t);void 0!==i&&(this._$Eu.set(i,n),e.push(i))})),e}static createProperty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nl;if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const s=this[e];this[t]=i,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||nl}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(Qc(e))}else void 0!==e&&t.push(Qc(e));return t}static _$Eh(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}o(){var e;this._$Ep=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(e=this.constructor.l)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$Eg)&&void 0!==t?t:this._$Eg=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$Eg)||void 0===t||t.splice(this._$Eg.indexOf(e)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Et.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)=>{Hc?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),i=window.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=t.cssText,e.appendChild(n)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$Eg)||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._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ES(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nl;var i,s;const r=this.constructor._$Eh(e,n);if(void 0!==r&&!0===n.reflect){const o=(null!==(s=null===(i=n.converter)||void 0===i?void 0:i.toAttribute)&&void 0!==s?s:el.toAttribute)(t,n.type);this._$Ei=e,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Ei=null}}_$AK(e,t){var n,i,s;const r=this.constructor,o=r._$Eu.get(e);if(void 0!==o&&this._$Ei!==o){const e=r.getPropertyOptions(o),a=e.converter,c=null!==(s=null!==(i=null===(n=a)||void 0===n?void 0:n.fromAttribute)&&void 0!==i?i:"function"==typeof a?a:null)&&void 0!==s?s:el.fromAttribute;this._$Ei=o,this[o]=c(t,e.type),this._$Ei=null}}requestUpdate(e,t,n){let i=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||tl)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Ei!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}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._$Et&&(this._$Et.forEach(((e,t)=>this[t]=e)),this._$Et=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$Eg)||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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$ES(t,this[t],e))),this._$EC=void 0),this._$EU()}updated(e){}firstUpdated(e){}}var sl;il.finalized=!0,il.elementProperties=new Map,il.elementStyles=[],il.shadowRootOptions={mode:"open"},null==Kc||Kc({ReactiveElement:il}),(null!==(Zc=globalThis.reactiveElementVersions)&&void 0!==Zc?Zc:globalThis.reactiveElementVersions=[]).push("1.3.0");const rl=globalThis.trustedTypes,ol=rl?rl.createPolicy("lit-html",{createHTML:e=>e}):void 0,al=`lit$${(Math.random()+"").slice(9)}$`,cl="?"+al,ll=`<${cl}>`,dl=document,ul=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return dl.createComment(e)},hl=e=>null===e||"object"!=typeof e&&"function"!=typeof e,ml=Array.isArray,fl=e=>{var t;return ml(e)||"function"==typeof(null===(t=e)||void 0===t?void 0:t[Symbol.iterator])},gl=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pl=/-->/g,vl=/>/g,yl=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,_l=/'/g,bl=/"/g,wl=/^(?:script|style|textarea|title)$/i,Sl=e=>function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return{_$litType$:e,strings:t,values:i}},xl=Sl(1),El=(Sl(2),Symbol.for("lit-noChange")),Al=Symbol.for("lit-nothing"),Cl=new WeakMap,Tl=(e,t,n)=>{var i,s;const r=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:t;let o=r._$litPart$;if(void 0===o){const e=null!==(s=null==n?void 0:n.renderBefore)&&void 0!==s?s:null;r._$litPart$=o=new Il(t.insertBefore(ul(),e),e,void 0,null!=n?n:{})}return o._$AI(e),o},kl=dl.createTreeWalker(dl,129,null,!1),jl=(e,t)=>{const n=e.length-1,i=[];let s,r=2===t?"<svg>":"",o=gl;for(let t=0;t<n;t++){const n=e[t];let a,c,l=-1,d=0;for(;d<n.length&&(o.lastIndex=d,c=o.exec(n),null!==c);)d=o.lastIndex,o===gl?"!--"===c[1]?o=pl:void 0!==c[1]?o=vl:void 0!==c[2]?(wl.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=yl):void 0!==c[3]&&(o=yl):o===yl?">"===c[0]?(o=null!=s?s:gl,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?yl:'"'===c[3]?bl:_l):o===bl||o===_l?o=yl:o===pl||o===vl?o=gl:(o=yl,s=void 0);const u=o===yl&&e[t+1].startsWith("/>")?" ":"";r+=o===gl?n+ll:l>=0?(i.push(a),n.slice(0,l)+"$lit$"+n.slice(l)+al+u):n+al+(-2===l?(i.push(void 0),t):u)}const a=r+(e[n]||"<?>")+(2===t?"</svg>":"");if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==ol?ol.createHTML(a):a,i]};class $l{constructor(e,t){let n,{strings:i,_$litType$:s}=e;this.parts=[];let r=0,o=0;const a=i.length-1,c=this.parts,[l,d]=jl(i,s);if(this.el=$l.createElement(l,t),kl.currentNode=this.el.content,2===s){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=kl.nextNode())&&c.length<a;){if(1===n.nodeType){if(n.hasAttributes()){const e=[];for(const t of n.getAttributeNames())if(t.endsWith("$lit$")||t.startsWith(al)){const i=d[o++];if(e.push(t),void 0!==i){const e=n.getAttribute(i.toLowerCase()+"$lit$").split(al),t=/([.?@])?(.*)/.exec(i);c.push({type:1,index:r,name:t[2],strings:e,ctor:"."===t[1]?Rl:"?"===t[1]?Ll:"@"===t[1]?zl:Ml})}else c.push({type:6,index:r})}for(const t of e)n.removeAttribute(t)}if(wl.test(n.tagName)){const e=n.textContent.split(al),t=e.length-1;if(t>0){n.textContent=rl?rl.emptyScript:"";for(let i=0;i<t;i++)n.append(e[i],ul()),kl.nextNode(),c.push({type:2,index:++r});n.append(e[t],ul())}}}else if(8===n.nodeType)if(n.data===cl)c.push({type:2,index:r});else{let e=-1;for(;-1!==(e=n.data.indexOf(al,e+1));)c.push({type:7,index:r}),e+=al.length-1}r++}}static createElement(e,t){const n=dl.createElement("template");return n.innerHTML=e,n}}function Nl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=arguments.length>3?arguments[3]:void 0;var s,r,o,a;if(t===El)return t;let c=void 0!==i?null===(s=n._$Cl)||void 0===s?void 0:s[i]:n._$Cu;const l=hl(t)?void 0:t._$litDirective$;return(null==c?void 0:c.constructor)!==l&&(null===(r=null==c?void 0:c._$AO)||void 0===r||r.call(c,!1),void 0===l?c=void 0:(c=new l(e),c._$AT(e,n,i)),void 0!==i?(null!==(o=(a=n)._$Cl)&&void 0!==o?o:a._$Cl=[])[i]=c:n._$Cu=c),void 0!==c&&(t=Nl(e,c._$AS(e,t.values),c,i)),t}class Ol{constructor(e,t){this.v=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(e){var t;const{el:{content:n},parts:i}=this._$AD,s=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:dl).importNode(n,!0);kl.currentNode=s;let r=kl.nextNode(),o=0,a=0,c=i[0];for(;void 0!==c;){if(o===c.index){let t;2===c.type?t=new Il(r,r.nextSibling,this,e):1===c.type?t=new c.ctor(r,c.name,c.strings,this,e):6===c.type&&(t=new Pl(r,this,e)),this.v.push(t),c=i[++a]}o!==(null==c?void 0:c.index)&&(r=kl.nextNode(),o++)}return s}m(e){let t=0;for(const n of this.v)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Il{constructor(e,t,n,i){var s;this.type=2,this._$AH=Al,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cg=null===(s=null==i?void 0:i.isConnected)||void 0===s||s}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cg}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e){e=Nl(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),hl(e)?e===Al||null==e||""===e?(this._$AH!==Al&&this._$AR(),this._$AH=Al):e!==this._$AH&&e!==El&&this.$(e):void 0!==e._$litType$?this.T(e):void 0!==e.nodeType?this.k(e):fl(e)?this.S(e):this.$(e)}A(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._$AB;return this._$AA.parentNode.insertBefore(e,t)}k(e){this._$AH!==e&&(this._$AR(),this._$AH=this.A(e))}$(e){this._$AH!==Al&&hl(this._$AH)?this._$AA.nextSibling.data=e:this.k(dl.createTextNode(e)),this._$AH=e}T(e){var t;const{values:n,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=$l.createElement(i.h,this.options)),i);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===s)this._$AH.m(n);else{const e=new Ol(s,this),t=e.p(this.options);e.m(n),this.k(t),this._$AH=e}}_$AC(e){let t=Cl.get(e.strings);return void 0===t&&Cl.set(e.strings,t=new $l(e)),t}S(e){ml(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new Il(this.A(ul()),this.A(ul()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,t=arguments.length>1?arguments[1]:void 0;var n;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cg=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class Ml{constructor(e,t,n,i,s){this.type=1,this._$AH=Al,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Al}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;const s=this.strings;let r=!1;if(void 0===s)e=Nl(this,e,t,0),r=!hl(e)||e!==this._$AH&&e!==El,r&&(this._$AH=e);else{const i=e;let o,a;for(e=s[0],o=0;o<s.length-1;o++)a=Nl(this,i[n+o],t,o),a===El&&(a=this._$AH[o]),r||(r=!hl(a)||a!==this._$AH[o]),a===Al?e=Al:e!==Al&&(e+=(null!=a?a:"")+s[o+1]),this._$AH[o]=a}r&&!i&&this.C(e)}C(e){e===Al?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class Rl extends Ml{constructor(){super(...arguments),this.type=3}C(e){this.element[this.name]=e===Al?void 0:e}}const Dl=rl?rl.emptyScript:"";class Ll extends Ml{constructor(){super(...arguments),this.type=4}C(e){e&&e!==Al?this.element.setAttribute(this.name,Dl):this.element.removeAttribute(this.name)}}class zl extends Ml{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e){var t;if((e=null!==(t=Nl(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,0))&&void 0!==t?t:Al)===El)return;const n=this._$AH,i=e===Al&&n!==Al||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Al&&(n===Al||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;"function"==typeof this._$AH?this._$AH.call(null!==(n=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==n?n:this.element,e):this._$AH.handleEvent(e)}}class Pl{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Nl(this,e)}}const Fl={P:"$lit$",L:al,V:cl,I:1,N:jl,R:Ol,D:fl,j:Nl,H:Il,O:Ml,F:Ll,B:zl,W:Rl,Z:Pl},Ul=window.litHtmlPolyfillSupport;var Bl,ql;null==Ul||Ul($l,Il),(null!==(sl=globalThis.litHtmlVersions)&&void 0!==sl?sl:globalThis.litHtmlVersions=[]).push("2.2.0");class Hl extends il{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var e,t;const n=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=n.firstChild),n}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Dt=Tl(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!1)}render(){return El}}Hl.finalized=!0,Hl._$litElement$=!0,null===(Bl=globalThis.litElementHydrateSupport)||void 0===Bl||Bl.call(globalThis,{LitElement:Hl});const Gl=globalThis.litElementPolyfillSupport;null==Gl||Gl({LitElement:Hl}),(null!==(ql=globalThis.litElementVersions)&&void 0!==ql?ql:globalThis.litElementVersions=[]).push("3.2.0"),tc().extend(Ka()),de.addNamespace("ACTIVITY","http://jabber.org/protocol/activity"),de.addNamespace("CARBONS","urn:xmpp:carbons:2"),de.addNamespace("CHATSTATES","http://jabber.org/protocol/chatstates"),de.addNamespace("CSI","urn:xmpp:csi:0"),de.addNamespace("DELAY","urn:xmpp:delay"),de.addNamespace("EME","urn:xmpp:eme:0"),de.addNamespace("FASTEN","urn:xmpp:fasten:0"),de.addNamespace("FORWARD","urn:xmpp:forward:0"),de.addNamespace("HINTS","urn:xmpp:hints"),de.addNamespace("HTTPUPLOAD","urn:xmpp:http:upload:0"),de.addNamespace("IDLE","urn:xmpp:idle:1"),de.addNamespace("MAM","urn:xmpp:mam:2"),de.addNamespace("MARKERS","urn:xmpp:chat-markers:0"),de.addNamespace("MENTIONS","urn:xmpp:mmn:0"),de.addNamespace("MESSAGE_CORRECT","urn:xmpp:message-correct:0"),de.addNamespace("MODERATE","urn:xmpp:message-moderate:0"),de.addNamespace("NICK","http://jabber.org/protocol/nick"),de.addNamespace("OCCUPANTID","urn:xmpp:occupant-id:0"),de.addNamespace("OMEMO","eu.siacs.conversations.axolotl"),de.addNamespace("OUTOFBAND","jabber:x:oob"),de.addNamespace("PUBSUB","http://jabber.org/protocol/pubsub"),de.addNamespace("RAI","urn:xmpp:rai:0"),de.addNamespace("RECEIPTS","urn:xmpp:receipts"),de.addNamespace("REFERENCE","urn:xmpp:reference:0"),de.addNamespace("REGISTER","jabber:iq:register"),de.addNamespace("RETRACT","urn:xmpp:message-retract:0"),de.addNamespace("ROSTERX","http://jabber.org/protocol/rosterx"),de.addNamespace("RSM","http://jabber.org/protocol/rsm"),de.addNamespace("SID","urn:xmpp:sid:0"),de.addNamespace("SPOILER","urn:xmpp:spoiler:0"),de.addNamespace("STANZAS","urn:ietf:params:xml:ns:xmpp-stanzas"),de.addNamespace("STYLING","urn:xmpp:styling:0"),de.addNamespace("VCARD","vcard-temp"),de.addNamespace("VCARDUPDATE","vcard-temp:x:update"),de.addNamespace("XFORM","jabber:x:data"),de.addNamespace("XHTML","http://www.w3.org/1999/xhtml"),Ya.VERSION_NAME="v9.1.0",Object.assign(Ya,$i),oc(Ya,"_converse","pluggable");const Wl=Ya.api={connection:{connected(){var e;return(null==Ya||null===(e=Ya.connection)||void 0===e?void 0:e.connected)&&!0},disconnect(){Ya.connection&&Ya.connection.disconnect()},reconnect(){var e;return null!==(e=Ya.connection)&&void 0!==e&&e.reconnecting?Ya.connection.debouncedReconnect():Ya.connection.reconnect()},isType:e=>Ya.connection.isType(e)},async trigger(e){if(!Ya._events)return;const t=Array.from(arguments),n=t.pop();if(n&&n.synchronous){const n=Ya._events[e]||[],i=t.splice(1);await Promise.all(n.map((e=>e.callback.apply(e.ctx,i))))}else Ya.trigger.apply(Ya,arguments);const i=Ya.promises[e];void 0!==i&&i.resolve()},hook(e,t,n){const i=Ya._events[e]||[];return i.length?i.reduce(((e,n)=>e.then((e=>n.callback(t,e)))),Promise.resolve(n)):n},user:{settings:ka,jid:()=>Ya.connection.jid,async login(e,t){var n,i;let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e=e||Wl.settings.get("jid"),(null===(n=Ya.connection)||void 0===n||!n.jid||e&&!Ba.isSameDomain(Ya.connection.jid,e))&&await Ya.initConnection(),null!==(i=Wl.settings.get("connection_options"))&&void 0!==i&&i.worker&&await Ya.connection.restoreWorkerSession())return;e&&(e=await xa(e));const r=Ya.pluggable.plugins["converse-bosh"];if(null!=r&&r.enabled()){if(await Ya.restoreBOSHSession())return;if(Wl.settings.get("authentication")===Ya.PREBIND&&(!s||Wl.settings.get("auto_login")))return Ya.startNewPreboundBOSHSession()}t=t||Wl.settings.get("password"),async function(e,t){const{api:n}=Ya;n.settings.get("authentication")===Ya.LOGIN?e?Ca(e):n.settings.get("credentials_url")?Ca(await async function(){let e,t=0;for(;!e;){try{e=await Ea(t)}catch(e){R.error("Could not fetch login credentials"),R.error(e)}t=2e3}return e}()):Ya.jid&&(n.settings.get("password")||Ya.connection.pass)?Ca():!Ya.isTestEnv()&&"credentials"in navigator?Ca(await async function(){try{const e=await navigator.credentials.get({password:!0});if(e&&"password"==e.type&&Oa.isValidJID(e.id))return await xa(e.id),{jid:e.id,password:e.password}}catch(e){R.error(e)}}()):!Ya.isTestEnv()&&R.warn("attemptNonPreboundSession: Couldn't find credentials to log in with"):![Ya.ANONYMOUS,Ya.EXTERNAL].includes(n.settings.get("authentication"))||t&&!n.settings.get("auto_login")||Ca()}(e&&t?{jid:e,password:t}:null,s)},async logout(){await Wl.trigger("beforeLogout",{synchronous:!0});const e=fo(),t=()=>{Object.keys(Ya.promises).forEach(Pa),delete Ya.jid,Wl.trigger("logout"),e.resolve()};return Ya.connection.setDisconnectionCause(Ya.LOGOUT,void 0,!0),void 0!==Ya.connection?(Wl.listen.once("disconnected",(()=>t())),Ya.connection.disconnect()):t(),e}},settings:Ta,promises:{add(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(e=Array.isArray(e)?e:[e]).forEach((e=>{const n=fo();n.replace=t,Ya.promises[e]=n}))}},listen:{once:Ya.once.bind(Ya),on:Ya.on.bind(Ya),not:Ya.off.bind(Ya),stanza(e,t,n){_e(t)?(n=t,t={}):t=t||{},Ya.connection.addHandler(n,t.ns,e,t.type,t.id,t.from,t)}},waitUntil(e){if(_e(e))return Ba.waitUntil(e);{const t=Ya.promises[e];return void 0===t?null:t}},send(e){var t;return Wl.connection.connected()?("string"==typeof e?e=Ba.toStanza(e):null!==(t=e)&&void 0!==t&&t.nodeTree&&(e=e.nodeTree),"iq"===e.tagName?Wl.sendIQ(e):(Ya.connection.send(e),void Wl.trigger("send",e))):(R.warn("Not sending stanza because we're not connected!"),void R.warn(de.serialize(e)))},sendIQ(e){var t;let n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ya.STANZA_TIMEOUT,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e=(null===(t=e)||void 0===t?void 0:t.nodeTree)??e,["get","set"].includes(e.getAttribute("type"))?(i=i||Ya.STANZA_TIMEOUT,s?(n=new Promise(((t,n)=>Ya.connection.sendIQ(e,t,n,i))),n.catch((t=>{if(null===t)throw new gs(`Timeout error after ${i}ms for the following IQ stanza: ${de.serialize(e)}`)}))):n=new Promise((t=>Ya.connection.sendIQ(e,t,t,i)))):(Ya.connection.sendIQ(e),n=Promise.resolve()),Wl.trigger("send",e),n}};function Vl(){var e;return null===(e=Ya.session)||void 0===e||e.destroy(),delete Ya.session,Ya.shouldClearCache()&&Ya.api.user.settings.clear(),Ya.api.trigger("clearSession",{synchronous:!0})}Ya.shouldClearCache=()=>!Ya.config.get("trusted")||Wl.settings.get("clear_cache_on_logout")||Ya.isTestEnv(),Ya.initConnection=function(){const e=Ya.api;if(!e.settings.get("bosh_service_url")&&e.settings.get("authentication")===Ya.PREBIND)throw new Error("authentication is set to 'prebind' but we don't have a BOSH connection");const t=Ya.isTestEnv()?wa:ba;Ya.connection=new t(Aa(),Object.assign(Ya.default_connection_options,e.settings.get("connection_options"),{keepalive:e.settings.get("keepalive")})),function(){const e={};e[de.LogLevel.DEBUG]="debug",e[de.LogLevel.INFO]="info",e[de.LogLevel.WARN]="warn",e[de.LogLevel.ERROR]="error",e[de.LogLevel.FATAL]="fatal",de.log=(t,n)=>R.log(n,e[t]),de.error=e=>R.error(e),Ya.connection.xmlInput=e=>R.debug(e.outerHTML,"color: darkgoldenrod"),Ya.connection.xmlOutput=e=>R.debug(e.outerHTML,"color: darkcyan")}(),e.trigger("connectionInitialized")},Ya.saveWindowState=function(e){let t;const n={focus:"visible",focusin:"visible",pageshow:"visible",blur:"hidden",focusout:"hidden",pagehide:"hidden"};t=(e=e||document.createEvent("Events")).type in n?n[e.type]:document.hidden?"hidden":"visible",Ya.windowState=t,Wl.trigger("windowStateChanged",{state:t})},Ya.ConnectionFeedback=fa.extend({defaults:{connection_status:de.Status.DISCONNECTED,message:""},initialize(){this.on("change",(()=>Wl.trigger("connfeedback",Ya.connfeedback)))}});const Jl=window.converse||{};Object.assign(Jl,{CHAT_STATES:["active","composing","gone","inactive","paused"],keycodes:ve,async initialize(e){var t,n;if(await async function(e){var t;const{api:n}=e;await n.trigger("cleanup",{synchronous:!0}),e.router.history.stop(),function(e){const{api:t}=e;document.removeEventListener("visibilitychange",e.saveWindowState),t.trigger("unregisteredGlobalEventHandlers")}(e),null===(t=e.connection)||void 0===t||t.reset(),e.stopListening(),e.off(),e.promises.initialized.isResolved&&n.promises.add("initialized")}(Ya),"onpagehide"in window?Ya.unloadevent="pagehide":"onbeforeunload"in window?Ya.unloadevent="beforeunload":"onunload"in window&&(Ya.unloadevent="unload"),function(e){Wa=e,Ha={},Object.assign(Ha,$i);const t=Uo(e,Object.keys(qa));kt(Ha,qa,t)}(e),Ya.strict_plugin_dependencies=e.strict_plugin_dependencies,R.setLogLevel(Wl.settings.get("loglevel")),Wl.settings.get("authentication")===Ya.ANONYMOUS&&Wl.settings.get("auto_login")&&!Wl.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.");Ya.router.route(/^converse\?loglevel=(debug|info|warn|error|fatal)$/,"loglevel",(e=>R.setLogLevel(e))),Ya.connfeedback=new Ya.ConnectionFeedback,Ya.send_initial_presence=!0,await async function(e){await ko.sessionStorageInitialized,e.storage={session:ko.localForage.createInstance({name:e.isTestEnv()?"converse-test-session":"converse-session",description:"sessionStorage instance",driver:["sessionStorageWrapper"]})}}(Ya),await async function(e){const t="converse.client-config";e.config=new fa({id:t,trusted:!0}),e.config.browserStorage=No(t,"session"),await new Promise((t=>e.config.fetch({success:t,error:t}))),e.api.trigger("clientConfigInitialized")}(Ya),await o.initialize(),function(e){e.pluggable.initialized_plugins=[];const t=ge.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")}(Ya),null===(t=Wl.elements)||void 0===t||t.register(),n=Ya,document.addEventListener("visibilitychange",n.saveWindowState),n.saveWindowState({type:document.hidden?"blur":"focus"}),n.api.trigger("registeredGlobalEventHandlers");try{!History.started&&Ya.router.history.start()}catch(e){R.error(e)}Wl.settings.get("idle_presence_timeout")>0&&Wl.listen.on("addClientFeatures",(()=>Wl.disco.own.features.add(de.NS.IDLE)));const i=Ya.pluggable.plugins;if((Wl.settings.get("auto_login")||Wl.settings.get("keepalive")&&ic(i["converse-bosh"],"enabled"))&&await Wl.user.login(null,null,!0),Wl.trigger("initialized"),Ya.isTestEnv())return Ya},plugins:{add(e,t){if(t.__name__=e,void 0!==Ya.pluggable.plugins[e])throw new TypeError(`Error: plugin with name "${e}" has already been registered!`);Ya.pluggable.plugins[e]=t}},env:{$build:oe,$iq:ce,$msg:ae,$pres:le,utils:Ba,Collection:Rc,Model:fa,Promise,Strophe:de,URI:s(),dayjs:tc(),html:xl,log:R,sizzle:Vo(),sprintf:r.sprintf,u:Ba}});const Ql=Jl.env.utils;function Zl(e,t){Wl.send(ae({to:e.getAttribute("from"),type:"error",id:e.getAttribute("id")}).c("error",{type:"cancel"}).c("not-allowed",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up().c("text",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).t(t)),R.warn(`Rejecting message stanza with the following reason: ${t}`),R.warn(e)}function Yl(e,t,n,i){const s=ae({from:Ya.connection.jid,id:Ql.getUniqueId(),to:e,type:i||"chat"}).c(n,{xmlns:de.NS.MARKERS,id:t});Wl.send(s)}const{u:Xl}=Jl.env;function Kl(e){const t=ed(e),{protocol:n}=window.location;return!!["chrome-extension:","file:"].includes(n)||"http:"===n||"https:"===n&&["https","aesgcm"].includes(t.protocol().toLowerCase())}function ed(e){try{return e instanceof s()?e:new(s())(e)}catch(e){return R.debug(e),null}}function td(e,t){const n=ed(t);if(null===n)throw new Error(`checkFileTypes: could not parse url ${t}`);const i=n.filename().toLowerCase();return!!e.filter((e=>i.endsWith(e))).length}function nd(e,t){const n=ed(t),i=n.subdomain(),s=n.domain(),r=`${i?`${i}.`:""}${s}`;return e.includes(s)||e.includes(r)}function id(e,t){if(!Kl(e))return!1;const n=Wl.settings.get("render_media"),i=rd(e,`allowed_${t}_domains`);return Array.isArray(n)?i&&nd(n,e):i&&n}function sd(e){const t=Wl.settings.get("filter_url_query_params");return t?ed(e).removeQuery(t).toString():e}function rd(e,t){const n=Wl.settings.get(t);if(!Array.isArray(n))return!0;try{return nd(n,e)}catch(e){return R.debug(e),!1}}function od(e){return e.is_audio&&rd(e.url,"allowed_audio_domains")||e.is_video&&rd(e.url,"allowed_video_domains")||e.is_image&&rd(e.url,"allowed_image_domains")}function ad(e){return td([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".svg"],e)}function cd(e){return td([".gif"],e)}function ld(e){return td([".ogg",".mp3",".m4a"],e)}function dd(e){return td([".mp4",".webm"],e)}function ud(e){const t=Wl.settings.get("image_urls_regex");return(null==t?void 0:t.test(e))||ad(e)}function hd(e){return e.startsWith("aesgcm://")}Object.assign(Xl,{isAudioURL:ld,isGIFURL:cd,isVideoURL:dd,isImageURL:ud,isURLWithImageExtension:ad,checkFileTypes:td,getURI:ed,shouldRenderMediaFromURL:id,isAllowedProtocolForMedia:Kl});const{NS:md}=de;class fd extends Error{constructor(e,t){super(e,t),this.name="StanzaParseError",this.stanza=t}}function gd(e,t){const n={},i=Vo()(`stanza-id[xmlns="${de.NS.SID}"]`,e).reduce(((e,t)=>(e[`stanza_id ${t.getAttribute("by")}`]=t.getAttribute("id"),e)),{});Object.assign(n,i);const s=Vo()(`message > result[xmlns="${de.NS.MAM}"]`,t).pop();s&&(n[`stanza_id ${t.getAttribute("from")||Ya.bare_jid}`]=s.getAttribute("id"));const r=Vo()(`origin-id[xmlns="${de.NS.SID}"]`,e).pop();return r&&(n.origin_id=r.getAttribute("id")),n}function pd(e){const t=Vo()(`encryption[xmlns="${de.NS.EME}"]`,e).pop(),n=null==t?void 0:t.getAttribute("namespace"),i={};return n?(i.is_encrypted=!0,i.encryption_namespace=n):Vo()(`encrypted[xmlns="${de.NS.OMEMO}"]`,e).pop()&&(i.is_encrypted=!0,i.encryption_namespace=de.NS.OMEMO),i}function vd(e,t){const n=Vo()(`> apply-to[xmlns="${de.NS.FASTEN}"]`,e).pop();if(n){const e=n.getAttribute("id");if(Vo()(`> retract[xmlns="${de.NS.RETRACT}"]`,n).pop()){const n=Vo()(`delay[xmlns="${de.NS.DELAY}"]`,t).pop();return{editable:!1,retracted:n?tc()(n.getAttribute("stamp")).toISOString():(new Date).toISOString(),retracted_id:e}}}else{const t=Vo()(`> retracted[xmlns="${de.NS.RETRACT}"]`,e).pop();if(t)return{editable:!1,is_tombstone:!0,retracted:t.getAttribute("stamp")}}return{}}function yd(e,t){const n=Vo()(`replace[xmlns="${de.NS.MESSAGE_CORRECT}"]`,e).pop();if(n){const e=n.getAttribute("id");if(e){const n=Vo()(`delay[xmlns="${de.NS.DELAY}"]`,t).pop();return{replace_id:e,edited:n?tc()(n.getAttribute("stamp")).toISOString():(new Date).toISOString()}}}return{}}function _d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];if(!e)return{};try{s().withinString(e,((e,i,s)=>(e.startsWith("_")&&(e=e.slice(1),i+=1),e.endsWith("_")&&(e=e.slice(0,e.length-1),s-=1),n.push({url:e,start:i+t,end:s+t}),e)),pe)}catch(e){R.debug(e)}const i=n.map((e=>({end:e.end,is_audio:ld(e.url),is_image:ud(e.url),is_video:dd(e.url),is_encrypted:hd(e.url),start:e.start})));return i.length?{media_urls:i}:{}}function bd(e){const t=Vo()(`spoiler[xmlns="${de.NS.SPOILER}"]`,e).pop();return{is_spoiler:!!t,spoiler_hint:null==t?void 0:t.textContent}}function wd(e){const t=Vo()(`x[xmlns="${de.NS.OUTOFBAND}"]`,e).pop();var n,i;return t?{oob_url:null===(n=t.querySelector("url"))||void 0===n?void 0:n.textContent,oob_desc:null===(i=t.querySelector("desc"))||void 0===i?void 0:i.textContent}:{}}function Sd(e){if("error"===e.getAttribute("type")){const t=e.querySelector("error"),n=Vo()(`text[xmlns="${de.NS.STANZAS}"]`,t).pop();return{is_error:!0,error_text:null==n?void 0:n.textContent,error_type:t.getAttribute("type"),error_condition:t.firstElementChild.nodeName}}return{}}function xd(e){return Vo()(`reference[xmlns="${de.NS.REFERENCE}"]`,e).map((t=>{var n;const i=t.getAttribute("anchor"),s=null===(n=e.querySelector(i?`#${i}`:"body"))||void 0===n?void 0:n.textContent;if(!s)return R.warn(`Could not find referenced text for ${t}`),null;const r=t.getAttribute("begin"),o=t.getAttribute("end");return{begin:r,end:o,type:t.getAttribute("type"),value:s.slice(r,o),uri:t.getAttribute("uri")}})).filter((e=>e))}function Ed(e){const t=Vo()(`received[xmlns="${de.NS.RECEIPTS}"]`,e).pop();return null==t?void 0:t.getAttribute("id")}function Ad(e){const t=de.NS.CARBONS;return Vo()(`message > received[xmlns="${t}"]`,e).length>0||Vo()(`message > sent[xmlns="${t}"]`,e).length>0}function Cd(e){var t;return null===(t=Vo()(`\n composing[xmlns="${md.CHATSTATES}"],\n paused[xmlns="${md.CHATSTATES}"],\n inactive[xmlns="${md.CHATSTATES}"],\n active[xmlns="${md.CHATSTATES}"],\n gone[xmlns="${md.CHATSTATES}"]`,e).pop())||void 0===t?void 0:t.nodeName}function Td(e,t){return"me"!==t.sender&&!t.is_carbon&&!t.is_archived&&Vo()(`request[xmlns="${de.NS.RECEIPTS}"]`,e).length}function kd(e){if(Vo()(`message > forwarded[xmlns="${de.NS.FORWARD}"]`,e).length){Zl(e,"Forwarded messages not part of an encapsulating protocol are not supported");const t=e.getAttribute("from");throw new fd(`Ignoring unencapsulated forwarded message from ${t}`,e)}}function jd(e){return Vo()(`\n acknowledged[xmlns="${de.NS.MARKERS}"],\n displayed[xmlns="${de.NS.MARKERS}"],\n received[xmlns="${de.NS.MARKERS}"]`,e).pop()}function $d(e){return"headline"===e.getAttribute("type")}function Nd(e){if(Vo()(`mentions[xmlns="${de.NS.MENTIONS}"]`,e).pop())return!1;const t=e.getAttribute("from");return!("error"===e.getAttribute("type")||!t||t.includes("@"))}function Od(e){return!!Vo()(`message > result[xmlns="${de.NS.MAM}"]`,e).pop()}function Id(e){return e.getAttributeNames().reduce(((t,n)=>(t[n]=de.xmlunescape(e.getAttribute(n)),t)),{})}const{Strophe:Md}=Jl.env;let Rd,Dd;Md.addNamespace("ADHOC","http://jabber.org/protocol/commands");const Ld={adhoc:{async getCommands(e){let t=[];try{n=await Dd.disco.items(e,Md.NS.ADHOC),t=Vo()(`query[xmlns="${Md.NS.DISCO_ITEMS}"][node="${Md.NS.ADHOC}"] item`,n).map(Id)}catch(t){null===t?R.error(`Error: timeout while fetching ad-hoc commands for ${e}`):(R.error(`Error while fetching ad-hoc commands for ${e}`),R.error(t))}var n;return t}}};Jl.plugins.add("converse-adhoc",{dependencies:["converse-disco"],initialize(){Rd=this._converse,Dd=Rd.api,Object.assign(Dd,Ld)}});const zd=fa.extend({initialize(){this.rosterContactAdded=fo()},async setRosterContact(e){const t=await Wl.contacts.get(e);t&&(this.contact=t,this.set("nickname",t.get("nickname")),this.rosterContactAdded.resolve())}}),Pd=zd;var Fd=n(1210),Ud=n.n(Fd);const{u:Bd}=Jl.env;function qd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.map((e=>{const i=e.start-n,s=e.end-n;return i<0||i>=t.length?null:Object.assign({},e,{start:i,end:s,url:t.substring(e.start-n,e.end-n)})})).filter((e=>e))}const Hd=va((function(e){const t=Wl.settings.get("prune_messages_above");if(t&&"number"==typeof t&&e.messages.length>t){const n=e.messages.filter((e=>!Bd.isEmptyMessage(e)));if(n.length>t){for(;n.length>t;)n.shift().destroy();Wl.trigger("historyPruned",e)}}}),500),{Strophe:Gd,sizzle:Wd}=Jl.env;async function Vd(e){var t,n,i,s,r,o;kd(e);let a=e.getAttribute("to");const c=Gd.getResourceFromJid(a);if(Wl.settings.get("filter_by_resource")&&c&&c!==Ya.resource)return new fd(`Ignoring incoming message intended for a different resource: ${a}`,e);const l=e;let d=e.getAttribute("from")||Ya.bare_jid;if(Ad(e)){if(d!==Ya.bare_jid)return Zl(e,"Rejecting carbon from invalid JID"),new fd(`Rejecting carbon from invalid JID ${a}`,e);{const t=`[xmlns="${Gd.NS.CARBONS}"] > forwarded[xmlns="${Gd.NS.FORWARD}"] > message`;a=(e=Wd(t,e).pop()).getAttribute("to"),d=e.getAttribute("from")}}const u=Od(e);if(u){if(d!==Ya.bare_jid)return new fd(`Invalid Stanza: alleged MAM message from ${e.getAttribute("from")}`,e);{const t=`[xmlns="${Gd.NS.MAM}"] > forwarded[xmlns="${Gd.NS.FORWARD}"] > message`;a=(e=Wd(t,e).pop()).getAttribute("to"),d=e.getAttribute("from")}}const h=Gd.getBareJidFromJid(d),m=h===Ya.bare_jid;if(m&&null===a)return new fd(`Don't know how to handle message stanza without 'to' attribute. ${e.outerHTML}`,e);const f=$d(e),g=Nd(e);let p,v;if(!f&&!g&&(v=m?Gd.getBareJidFromJid(a):h,p=await Wl.contacts.get(v),void 0===p&&!Wl.settings.get("allow_non_roster_messaging")))return R.error(e),new fd("Blocking messaging with a JID not in our roster because allow_non_roster_messaging is false.",e);const y=Wd(`delay[xmlns="${Gd.NS.DELAY}"]`,l).pop(),_=jd(e),b=(new Date).toISOString();let w=Object.assign({contact_jid:v,is_archived:u,is_headline:f,is_server_message:g,body:null===(t=e.querySelector("body"))||void 0===t||null===(n=t.textContent)||void 0===n?void 0:n.trim(),chat_state:Cd(e),from:Gd.getBareJidFromJid(e.getAttribute("from")),is_carbon:Ad(l),is_delayed:!!y,is_markable:!!Wd(`markable[xmlns="${Gd.NS.MARKERS}"]`,e).length,is_marker:!!_,is_unstyled:!!Wd(`unstyled[xmlns="${Gd.NS.STYLING}"]`,e).length,marker_id:_&&_.getAttribute("id"),msgid:e.getAttribute("id")||l.getAttribute("id"),nick:null===(i=p)||void 0===i||null===(s=i.attributes)||void 0===s?void 0:s.nickname,receipt_id:Ed(e),received:(new Date).toISOString(),references:xd(e),sender:m?"me":"them",subject:null===(r=e.querySelector("subject"))||void 0===r?void 0:r.textContent,thread:null===(o=e.querySelector("thread"))||void 0===o?void 0:o.textContent,time:y?tc()(y.getAttribute("stamp")).toISOString():b,to:e.getAttribute("to"),type:e.getAttribute("type")},Sd(e),wd(e),bd(e),yd(e,l),gd(e,l),vd(e,l),pd(e));if(w.is_archived){const t=l.getAttribute("from");if(t&&t!==Ya.bare_jid)return new fd(`Invalid Stanza: Forged MAM message from ${t}`,e)}return await Wl.emojis.initialize(),w=Object.assign({message:w.body||w.error,is_only_emojis:!!w.body&&Ba.isOnlyEmojis(w.body),is_valid_receipt_request:Td(e,w)},w),w.id=w.origin_id||w[`stanza_id ${w.from}`]||Ba.getUniqueId(),w=await Wl.hook("parseMessage",e,w),Object.assign(w,_d(w.is_encrypted?w.plaintext:w.body))}const{Strophe:Jd,$msg:Qd}=Jl.env,Zd=Jl.env.utils,Yd=Pd.extend({defaults(){return{bookmarked:!1,chat_state:void 0,hidden:$a()&&!Wl.settings.get("singleton"),message_type:"chat",nickname:void 0,num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),time_sent:new Date(0).toISOString(),type:Ya.PRIVATE_CHAT_TYPE,url:""}},async initialize(){this.initialized=fo(),Pd.prototype.initialize.apply(this,arguments);const e=this.get("jid");e&&(this.set({box_id:`box-${e}`}),this.initNotifications(),this.initUI(),this.initMessages(),this.get("type")===Ya.PRIVATE_CHAT_TYPE&&(this.presence=Ya.presences.findWhere({jid:e})||Ya.presences.create({jid:e}),await this.setRosterContact(e),this.presence.on("change:show",(e=>this.onPresenceChanged(e)))),this.on("change:chat_state",this.sendChatState,this),this.ui.on("change:scrolled",this.onScrolledChanged,this),await this.fetchMessages(),await Wl.trigger("chatBoxInitialized",this,{Synchronous:!0}),this.initialized.resolve())},getMessagesCollection:()=>new Ya.Messages,getMessagesCacheKey(){return`converse.messages-${this.get("jid")}-${Ya.bare_jid}`},initMessages(){this.messages=this.getMessagesCollection(),this.messages.fetched=fo(),this.messages.fetched.then((()=>{this.pruneHistoryWhenScrolledDown(),Wl.trigger("afterMessagesFetched",this)})),this.messages.chatbox=this,Oo(this.messages,this.getMessagesCacheKey()),this.listenTo(this.messages,"change:upload",this.onMessageUploadChanged,this),this.listenTo(this.messages,"add",this.onMessageAdded,this)},initUI(){this.ui=new fa},initNotifications(){this.notifications=new fa},getNotificationsText(){var e,t,n;const{__:i}=Ya;return(null===(e=this.notifications)||void 0===e?void 0:e.get("chat_state"))===Ya.COMPOSING?i("%1$s is typing",this.getDisplayName()):(null===(t=this.notifications)||void 0===t?void 0:t.get("chat_state"))===Ya.PAUSED?i("%1$s has stopped typing",this.getDisplayName()):(null===(n=this.notifications)||void 0===n?void 0:n.get("chat_state"))===Ya.GONE?i("%1$s has gone away",this.getDisplayName()):""},afterMessagesFetched(){Wl.trigger("afterMessagesFetched",this)},fetchMessages(){if(this.messages.fetched_flag)return void R.info(`Not re-fetching messages for ${this.get("jid")}`);this.messages.fetched_flag=!0;const e=this.messages.fetched.resolve;return this.messages.fetch({add:!0,success:t=>{this.afterMessagesFetched(t),e()},error:()=>{this.afterMessagesFetched(),e()}}),this.messages.fetched},async handleErrorMessageStanza(e){const{__:t}=Ya,n=await Vd(e);if(!await this.shouldShowErrorMessage(n))return;const i=this.getMessageReferencedByError(n);if(i){const e={error:n.error,error_condition:n.error_condition,error_text:n.error_text,error_type:n.error_type,editable:!1};n.msgid===i.get("retraction_id")?(e.retraction_id=void 0,n.error||("forbidden"===n.error_condition?e.error=t("You're not allowed to retract your message."):e.error=t("Sorry, an error occurred while trying to retract your message."))):n.error||("forbidden"===n.error_condition?e.error=t("You're not allowed to send a message."):e.error=t("Sorry, an error occurred while trying to send your message.")),i.save(e)}else this.createMessage(n)},queueMessage(e){return this.msg_chain=(this.msg_chain||this.messages.fetched).then((()=>this.onMessage(e))).catch((e=>R.error(e))),this.msg_chain},async onMessage(e){if(e=await e,Zd.isErrorObject(e))return e.stanza&&R.error(e.stanza),R.error(e.message);const t=this.getDuplicateMessage(e);if(t)this.updateMessage(t,e);else if(!this.handleReceipt(e)&&!this.handleChatMarker(e)&&!await this.handleRetraction(e)&&(this.setEditable(e,e.time),e.chat_state&&"them"===e.sender&&this.notifications.set("chat_state",e.chat_state),Zd.shouldCreateMessage(e))){const t=this.handleCorrection(e)||await this.createMessage(e);this.notifications.set({chat_state:null}),this.handleUnreadMessage(t)}},async onMessageUploadChanged(e){if(e.get("upload")===Ya.SUCCESS){const t={body:e.get("body"),spoiler_hint:e.get("spoiler_hint"),oob_url:e.get("oob_url")};await this.sendMessage(t),e.destroy()}},onMessageAdded(e){!Wl.settings.get("prune_messages_above")||"scrolled"!==Wl.settings.get("pruning_behavior")&&this.ui.get("scrolled")||Zd.isEmptyMessage(e)||Hd(this)},async clearMessages(){try{await this.messages.clearStore()}catch(e){this.messages.trigger("reset"),R.error(e)}finally{delete this.msg_chain,delete this.messages.fetched_flag,this.messages.fetched=fo()}},async close(){Wl.connection.connected()&&(this.setChatState(Ya.INACTIVE),this.sendChatState());try{await new Promise(((e,t)=>this.destroy({success:e,error:(e,n)=>t(n)})))}catch(e){R.error(e)}finally{Wl.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()}Wl.trigger("chatBoxClosed",this)},announceReconnection(){Wl.trigger("chatReconnected",this)},async onReconnection(){Wl.settings.get("clear_messages_on_reconnection")&&await this.clearMessages(),this.announceReconnection()},onPresenceChanged(e){const{__:t}=Ya,n=e.get("show"),i=this.getDisplayName();let s;"offline"===n?s=t("%1$s has gone offline",i):"away"===n?s=t("%1$s has gone away",i):"dnd"===n?s=t("%1$s is busy",i):"online"===n&&(s=t("%1$s is online",i)),s&&this.createMessage({message:s,type:"info"})},onScrolledChanged(){this.ui.get("scrolled")||(this.clearUnreadMsgCounter(),this.pruneHistoryWhenScrolledDown())},pruneHistoryWhenScrolledDown(){Wl.settings.get("prune_messages_above")&&"unscrolled"===Wl.settings.get("pruning_behavior")&&!this.ui.get("scrolled")&&Hd(this)},validate(e){if(!e.jid)return"Ignored ChatBox without JID";const t=Wl.settings.get("auto_join_rooms").map((e=>ye(e)?e.jid:e)),n=Wl.settings.get("auto_join_private_chats").concat(t);if(Wl.settings.get("singleton")&&!n.includes(e.jid)&&!Wl.settings.get("auto_join_on_invite")){const t=`${e.jid} is not allowed because singleton is true and it's not being auto_joined`;return R.warn(t),t}},getDisplayName(){return this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("jid")},async createMessageFromError(e){e instanceof Ya.TimeoutError&&((await this.createMessage({type:"error",message:e.message,retry_event_id:e.retry_event_id,is_ephemeral:3e4})).error=e)},editEarlierMessage(){let e,t=this.messages.findLastIndex("correcting");if(t>=0)for(this.messages.at(t).save("correcting",!1);t>0;){t-=1;const n=this.messages.at(t);if(n.get("editable")){e=n;break}}e=e||this.messages.filter({sender:"me"}).reverse().find((e=>e.get("editable"))),e&&e.save("correcting",!0)},editLaterMessage(){let e,t=this.messages.findLastIndex("correcting");if(t>=0)for(this.messages.at(t).save("correcting",!1);t<this.messages.length-1;){t+=1;const n=this.messages.at(t);if(n.get("editable")){e=n,e.save("correcting",!0);break}}return e},getOldestMessage(){for(let e=0;e<this.messages.length;e++){const t=this.messages.at(e);if(t.get("type")===this.get("message_type"))return t}},getMostRecentMessage(){for(let e=this.messages.length-1;e>=0;e--){const t=this.messages.at(e);if(t.get("type")===this.get("message_type"))return t}},getUpdatedMessageAttributes:(e,t)=>t.error_type||"Decryption"!==e.get("error_type")?{is_archived:t.is_archived}:Object.assign({},t,{error_condition:void 0,error_message:void 0,error_text:void 0,error_type:void 0,is_archived:t.is_archived,is_ephemeral:!1,is_error:!1}),updateMessage(e,t){const n=this.getUpdatedMessageAttributes(e,t);n&&e.save(n)},setChatState(e,t){return void 0!==this.chat_state_timeout&&(window.clearTimeout(this.chat_state_timeout),delete this.chat_state_timeout),e===Ya.COMPOSING?this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),Ya.TIMEOUTS.PAUSED,Ya.PAUSED):e===Ya.PAUSED&&(this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),Ya.TIMEOUTS.INACTIVE,Ya.INACTIVE)),this.set("chat_state",e,t),this},getMessageReferencedByError(e){const t=e.msgid;return t&&this.messages.models.find((e=>[e.get("msgid"),e.get("retraction_id")].includes(t)))},shouldShowErrorMessage(e){if(this.getMessageReferencedByError(e)||!e.chat_state)return!0},isSameUser:(e,t)=>Zd.isSameBareJID(e,t),findDanglingRetraction(e){if(!e.origin_id||!this.messages.length)return null;if(this.messages.last().get("time")>e.time){const t=Array.from(this.messages.models);return t.reverse(),t.find((t=>{let{attributes:n}=t;return n.retracted_id===e.origin_id&&n.from===e.from&&!n.moderated_by}))}},async handleRetraction(e){const t=["retracted","retracted_id","editable"];if(e.retracted){if(e.is_tombstone)return!1;const n=this.messages.findWhere({origin_id:e.retracted_id,from:e.from});return n?(n.save(Uo(e,t)),!0):(e.dangling_retraction=!0,await this.createMessage(e),!0)}{const n=this.findDanglingRetraction(e);if(n){const i=Uo(n.attributes,t),s=Object.assign({dangling_retraction:!1},e,i);return delete s.id,n.save(s),!0}}return!1},handleCorrection(e){if(!e.replace_id||!e.from)return;const t=this.messages.findWhere({msgid:e.replace_id,from:e.from});if(!t)return;const n=t.get("older_versions")||{};return e.time<t.get("time")&&t.get("edited")?(n[e.time]=e.message,t.save({older_versions:n})):(Object.keys(n).length?n[t.get("edited")]=t.getMessageText():n[t.get("time")]=t.getMessageText(),delete(e=Object.assign(e,{older_versions:n})).msgid,delete e.id,e.time=t.get("time"),t.save(e)),t},getDuplicateMessage(e){const t=[...this.getStanzaIdQueryAttrs(e),this.getOriginIdQueryAttrs(e),this.getMessageBodyQueryAttrs(e)].filter((e=>e));return this.messages.models.find((e=>t.reduce(((t,n)=>t||function(e,t){return e===t||Rn(e,t,Ln(t))}(e.attributes,n)),!1)))},getOriginIdQueryAttrs:e=>e.origin_id&&{origin_id:e.origin_id,from:e.from},getStanzaIdQueryAttrs(e){const t=Object.keys(e).filter((e=>e.startsWith("stanza_id ")));return t.map((t=>{const n={};return n[`stanza_id ${t.replace(/^stanza_id /,"")}`]=e[t],n}))},getMessageBodyQueryAttrs(e){if(e.msgid){const t={from:e.from,msgid:e.msgid};return!e.is_encrypted&&e.body&&(t.body=e.body),t}},retractOwnMessage(e){this.sendRetractionMessage(e),e.save({retracted:(new Date).toISOString(),retracted_id:e.get("origin_id"),retraction_id:e.get("id"),is_ephemeral:!0,editable:!1})},sendRetractionMessage(e){const t=e.get("origin_id");if(!t)throw new Error("Can't retract message without a XEP-0359 Origin ID");const n=Qd({id:Zd.getUniqueId(),to:this.get("jid"),type:"chat"}).c("store",{xmlns:Jd.NS.HINTS}).up().c("apply-to",{id:t,xmlns:Jd.NS.FASTEN}).c("retract",{xmlns:Jd.NS.RETRACT});return Ya.connection.send(n)},sendMarkerForLastMessage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"displayed",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=Array.from(this.messages.models);n.reverse();const i=n.find((e=>"them"===e.get("sender")&&(t||e.get("is_markable"))));i&&this.sendMarkerForMessage(i,e,t)},sendMarkerForMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"displayed",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e&&Wl.settings.get("send_chat_markers").includes(t)&&(null!=e&&e.get("is_markable")||n)&&Yl(Jd.getBareJidFromJid(e.get("from")),e.get("msgid"),t,e.get("type"))},handleChatMarker(e){if(Jd.getBareJidFromJid(e.to)!==Ya.bare_jid)return!1;if(e.is_markable)return!this.contact||e.is_archived||e.is_carbon||Yl(e.from,e.msgid,"received"),!1;if(e.marker_id){const t=this.messages.findWhere({msgid:e.marker_id}),n=`marker_${e.marker}`;return t&&!t.get(n)&&t.save({field_name:(new Date).toISOString()}),!0}},sendReceiptStanza(e,t){const n=Qd({from:Ya.connection.jid,id:Zd.getUniqueId(),to:e,type:"chat"}).c("received",{xmlns:Jd.NS.RECEIPTS,id:t}).up().c("store",{xmlns:Jd.NS.HINTS}).up();Wl.send(n)},handleReceipt(e){if("them"===e.sender)if(e.is_valid_receipt_request)this.sendReceiptStanza(e.from,e.msgid);else if(e.receipt_id){const t=this.messages.findWhere({msgid:e.receipt_id});return t&&!t.get("received")&&t.save({received:(new Date).toISOString()}),!0}return!1},async createMessageStanza(e){const t=Qd({from:Ya.connection.jid,to:this.get("jid"),type:this.get("message_type"),id:e.get("edited")&&Zd.getUniqueId()||e.get("msgid")}).c("body").t(e.get("body")).up().c(Ya.ACTIVE,{xmlns:Jd.NS.CHATSTATES}).root();return"chat"===e.get("type")&&t.c("request",{xmlns:Jd.NS.RECEIPTS}).root(),e.get("is_encrypted")||(e.get("is_spoiler")&&(e.get("spoiler_hint")?t.c("spoiler",{xmlns:Jd.NS.SPOILER},e.get("spoiler_hint")).root():t.c("spoiler",{xmlns:Jd.NS.SPOILER}).root()),(e.get("references")||[]).forEach((e=>{const n={xmlns:Jd.NS.REFERENCE,begin:e.begin,end:e.end,type:e.type};e.uri&&(n.uri=e.uri),t.c("reference",n).root()})),e.get("oob_url")&&t.c("x",{xmlns:Jd.NS.OUTOFBAND}).c("url").t(e.get("oob_url")).root()),e.get("edited")&&t.c("replace",{xmlns:Jd.NS.MESSAGE_CORRECT,id:e.get("msgid")}).root(),e.get("origin_id")&&t.c("origin-id",{xmlns:Jd.NS.SID,id:e.get("origin_id")}).root(),t.root(),(await Wl.hook("createMessageStanza",this,{message:e,stanza:t})).stanza},async getOutgoingMessageAttributes(e){var t;const n=!!this.get("composing_spoiler"),i=Zd.getUniqueId(),s=null===(t=e)||void 0===t?void 0:t.body,r=s?Zd.httpToGeoUri(Zd.shortnamesToUnicode(s),Ya):void 0;return e=Object.assign({},e,{from:Ya.bare_jid,fullname:Ya.xmppstatus.get("fullname"),id:i,is_only_emojis:!!s&&Zd.isOnlyEmojis(s),jid:this.get("jid"),message:r,msgid:i,nickname:this.get("nickname"),sender:"me",time:(new Date).toISOString(),type:this.get("message_type"),body:r,is_spoiler:n,origin_id:i},_d(s)),await Wl.hook("getOutgoingMessageAttributes",this,e)},setEditable(e,t){if(!e.is_headline&&!Zd.isEmptyMessage(e)&&"me"===e.sender)if("all"===Wl.settings.get("allow_message_corrections"))e.editable=!(e.file||e.retracted||"oob_url"in e);else if("last"===Wl.settings.get("allow_message_corrections")&&t>this.get("time_sent")){this.set({time_sent:t});const n=this.messages.findWhere({editable:!0});n&&n.save({editable:!1}),e.editable=!(e.file||e.retracted||"oob_url"in e)}},async createMessage(e,t){return e.time=e.time||(new Date).toISOString(),await this.messages.fetched,this.messages.create(e,t)},async sendMessage(e){e=await this.getOutgoingMessageAttributes(e);let t=this.messages.findWhere("correcting");if(t){const n=t.get("older_versions")||{};n[t.get("edited")||t.get("time")]=t.getMessageText();const i=e.is_encrypted?e.message:void 0;t.save({body:e.body,message:e.body,correcting:!1,edited:(new Date).toISOString(),is_only_emojis:e.is_only_emojis,origin_id:Zd.getUniqueId(),received:void 0,references:e.references,older_versions:n,plaintext:i})}else this.setEditable(e,(new Date).toISOString()),t=await this.createMessage(e);try{const e=await this.createMessageStanza(t);Wl.send(e)}catch(e){return t.destroy(),void R.error(e)}return Wl.trigger("sendMessage",{chatbox:this,message:t}),t},sendChatState(){if(Wl.settings.get("send_chat_state_notifications")&&this.get("chat_state")){const e=Wl.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;Wl.send(Qd({id:Zd.getUniqueId(),to:this.get("jid"),type:"chat"}).c(this.get("chat_state"),{xmlns:Jd.NS.CHATSTATES}).up().c("no-store",{xmlns:Jd.NS.HINTS}).up().c("no-permanent-store",{xmlns:Jd.NS.HINTS}))}},async sendFiles(e){var t;const{__:n}=Ya,i=(await Wl.disco.features.get(Jd.NS.HTTPUPLOAD,Ya.domain)).pop();if(!i)return void this.createMessage({message:n("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0});const s=i.dataforms.where({FORM_TYPE:{value:Jd.NS.HTTPUPLOAD,type:"hidden"}}).pop(),r=window.parseInt(null===(t=((null==s?void 0:s.attributes)||{})["max-file-size"])||void 0===t?void 0:t.value),o=null==i?void 0:i.id;o?Array.from(e).forEach((async e=>{if(e=await Wl.hook("beforeFileUpload",this,e),!window.isNaN(r)&&window.parseInt(e.size)>r)return this.createMessage({message:n("The size of your file, %1$s, exceeds the maximum allowed by your server, which is %2$s.",e.name,Ud()(r)),type:"error",is_ephemeral:!0});{const t=await this.getOutgoingMessageAttributes(),n=Object.assign(t,{file:!0,progress:0,slot_request_url:o});this.setEditable(n,(new Date).toISOString());const i=await this.createMessage(n,{silent:!0});i.file=e,this.messages.trigger("add",i),i.getRequestSlotURL()}})):this.createMessage({message:n("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0})},maybeShow(e){if(!$a())return Zd.safeSave(this,{hidden:!1}),this.trigger("show"),this;{const t=e=>!e.get("hidden")&&e.get("jid")!==this.get("jid")&&"controlbox"!==e.get("id"),n=Ya.chatboxes.filter(t);(e||0===n.length)&&(n.forEach((e=>Zd.safeSave(e,{hidden:!0}))),Zd.safeSave(this,{hidden:!1}))}},isHidden(){return this.get("hidden")||this.isScrolledUp()||"hidden"===Ya.windowState},handleUnreadMessage(e){null!=e&&e.get("body")&&Zd.isNewMessage(e)&&("me"===e.get("sender")?this.ui.set("scrolled",!1):this.isHidden()?this.incrementUnreadMsgsCounter(e):this.sendMarkerForMessage(e))},incrementUnreadMsgsCounter(e){const t={num_unread:this.get("num_unread")+1};0===this.get("num_unread")&&(t.first_unread_id=e.get("id")),this.save(t)},clearUnreadMsgCounter(){this.get("num_unread")>0&&this.sendMarkerForMessage(this.messages.last()),Zd.safeSave(this,{num_unread:0})},isScrolledUp(){return this.ui.get("scrolled")}}),Xd=Yd,{Strophe:Kd,sizzle:eu,u:tu}=Jl.env,nu={defaults:()=>({msgid:tu.getUniqueId(),time:(new Date).toISOString(),is_ephemeral:!1}),async initialize(){this.checkValidity()&&(this.initialized=fo(),this.get("file")&&this.on("change:put",(()=>this.uploadFile())),this.on("change:type",(()=>this.setContact())),this.on("change:is_ephemeral",(()=>this.setTimerForEphemeralMessage())),await this.setContact(),this.setTimerForEphemeralMessage(),await Wl.trigger("messageInitialized",this,{Synchronous:!0}),this.initialized.resolve())},setContact(){"chat"===this.get("type")&&(Pd.prototype.initialize.apply(this,arguments),this.setRosterContact(Kd.getBareJidFromJid(this.get("from"))))},setTimerForEphemeralMessage(){this.ephemeral_timer&&clearTimeout(this.ephemeral_timer);const e=this.isEphemeral();if(e){const t="number"==typeof e?e:1e4;this.ephemeral_timer=window.setTimeout((()=>this.safeDestroy()),t)}},checkValidity(){return 3!==Object.keys(this.attributes).length||(this.validationError="Empty message",this.safeDestroy(),!1)},mayBeRetracted(){const e="me"===this.get("sender"),t="cancel"!==this.get("error_type");return e&&t&&["all","own"].includes(Wl.settings.get("allow_message_retraction"))},safeDestroy(){try{this.destroy()}catch(e){R.error(e)}},isEphemeral(){return this.get("is_ephemeral")},isMeCommand(){const e=this.getMessageText();return!!e&&e.startsWith("/me ")},isFollowup(){const e=this.collection.models,t=e.indexOf(this),n=t?e[t-1]:null;if(null===n)return!1;const i=tc()(this.get("time"));return this.get("from")===n.get("from")&&!this.isMeCommand()&&!n.isMeCommand()&&"info"!==this.get("type")&&"info"!==n.get("type")&&i.isBefore(tc()(n.get("time")).add(10,"minutes"))&&!!this.get("is_encrypted")==!!n.get("is_encrypted")},getDisplayName(){return this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("from")},getMessageText(){if(this.get("is_encrypted")){const{__:e}=Ya;return this.get("plaintext")||this.get("body")||e("Undecryptable OMEMO message")}return["groupchat","chat"].includes(this.get("type"))?this.get("body"):this.get("message")},sendSlotRequestStanza(){if(!this.file)return Promise.reject(new Error("file is undefined"));const e=Jl.env.$iq({from:Ya.jid,to:this.get("slot_request_url"),type:"get"}).c("request",{xmlns:Kd.NS.HTTPUPLOAD,filename:this.file.name,size:this.file.size,"content-type":this.file.type});return Wl.sendIQ(e)},getUploadRequestMetadata:e=>({headers:eu(`slot[xmlns="${Kd.NS.HTTPUPLOAD}"] put header`,e).map((e=>({name:e.getAttribute("name"),value:e.textContent}))).filter((e=>["Authorization","Expires"].includes(e.name)))}),async getRequestSlotURL(){const{__:e}=Ya;let t;try{t=await this.sendSlotRequestStanza()}catch(t){return R.error(t),this.save({type:"error",message:e("Sorry, could not determine upload URL."),is_ephemeral:!0})}const n=eu(`slot[xmlns="${Kd.NS.HTTPUPLOAD}"]`,t).pop();if(!n)return this.save({type:"error",message:e("Sorry, could not determine file upload URL."),is_ephemeral:!0});this.upload_metadata=this.getUploadRequestMetadata(t),this.save({get:n.querySelector("get").getAttribute("url"),put:n.querySelector("put").getAttribute("url")})},uploadFile(){var e;const t=new XMLHttpRequest;t.onreadystatechange=async()=>{if(t.readyState===XMLHttpRequest.DONE)if(R.info("Status: "+t.status),200===t.status||201===t.status){let e={upload:Ya.SUCCESS,oob_url:this.get("get"),message:this.get("get"),body:this.get("get")};e=await Wl.hook("afterFileUploaded",this,e),this.save(e)}else t.onerror()},t.upload.addEventListener("progress",(e=>{e.lengthComputable&&this.set("progress",e.loaded/e.total)}),!1),t.onerror=()=>{const{__:e}=Ya;let n;n=t.responseText?e('Sorry, could not succesfully upload your file. Your servers response: "%1$s"',t.responseText):e("Sorry, could not succesfully upload your file."),this.save({type:"error",upload:Ya.FAILURE,message:n,is_ephemeral:!0})},t.open("PUT",this.get("put"),!0),t.setRequestHeader("Content-type",this.file.type),null===(e=this.upload_metadata.headers)||void 0===e||e.forEach((e=>t.setRequestHeader(e.name,e.value))),t.send(this.file)}},iu=nu,su={chats:{async create(e,t){if("string"==typeof e){if(t&&(null==t||!t.fullname)){var n;const i=await Wl.contacts.get(e);t.fullname=null==i||null===(n=i.attributes)||void 0===n?void 0:n.fullname}return Wl.chats.get(e,t,!0)||void R.error("Could not open chatbox for JID: "+e)}return Array.isArray(e)?Promise.all(e.forEach((async n=>{var i;const s=await Wl.contacts.get(e);return t.fullname=null==s||null===(i=s.attributes)||void 0===i?void 0:i.fullname,Wl.chats.get(n,t,!0).maybeShow()}))):(R.error("chats.create: You need to provide at least one JID"),null)},async open(e,t,n){if("string"==typeof e){const i=await Wl.chats.get(e,t,!0);return i?i.maybeShow(n):i}if(Array.isArray(e))return Promise.all(e.map((e=>Wl.chats.get(e,t,!0).then((e=>e&&e.maybeShow(n))))).filter((e=>e)));const i="chats.open: You need to provide at least one JID";throw R.error(i),new Error(i)},async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];async function i(e){let i=await Wl.chatboxes.get(e);return!i&&n?i=await Wl.chatboxes.create(e,t,Ya.ChatBox):(i=i&&i.get("type")===Ya.PRIVATE_CHAT_TYPE?i:null,i&&Object.keys(t).length&&i.save(t)),i}return await Wl.waitUntil("chatBoxesFetched"),void 0===e?(await Wl.chatboxes.get()).filter((e=>e.get("type")===Ya.PRIVATE_CHAT_TYPE)):"string"==typeof e?i(e):Promise.all(e.map((e=>i(e))))}}},{Strophe:ru,sizzle:ou,u:au}=Jl.env;function cu(e){if(!au.isValidJID(e))return R.warn(`Invalid JID "${e}" provided in URL fragment`);Wl.chats.open(e)}async function lu(){if(Ya.shouldClearCache()){await Promise.all(Ya.chatboxes.map((e=>e.messages&&e.messages.clearStore({silent:!0}))));const e=e=>e.get("type")!==Ya.CONTROLBOX_TYPE;Ya.chatboxes.clearStore({silent:!0},e)}}function du(){Wl.settings.get("auto_join_private_chats").forEach((e=>{Ya.chatboxes.where({jid:e}).length||("string"==typeof e?Wl.chats.open(e):R.error('Invalid jid criteria specified for "auto_join_private_chats"'))})),Wl.trigger("privateChatsAutoJoined")}function uu(){Ya.connection.addHandler((e=>ou(`message > result[xmlns="${ru.NS.MAM}"]`,e).pop()?(R.warn('Received a MAM message with type "chat".'),!0):(Ya.handleMessageStanza(e),!0)),null,"message","chat"),Ya.connection.addHandler((e=>(null!==e.getAttribute("type")||Ya.handleMessageStanza(e),!0)),ru.NS.RECEIPTS,"message"),Ya.connection.addHandler((e=>(async function(e){const t=ru.getBareJidFromJid(e.getAttribute("from"));if(au.isSameBareJID(t,Ya.bare_jid))return;const n=await Wl.chatboxes.get(t);n.get("type")===Ya.PRIVATE_CHAT_TYPE&&(null==n||n.handleErrorMessageStanza(e))}(e),!0)),null,"message","error")}async function hu(e){if(Nd(e)){const t=e.getAttribute("from");return R.info(`handleMessageStanza: Ignoring incoming server message from JID: ${t}`)}let t;try{t=await Vd(e)}catch(e){return R.error(e)}if(au.isErrorObject(t))return t.stanza&&R.error(t.stanza),R.error(t.message);const n=!(!t.body&&!t.plaintext),i=await Wl.chats.get(t.contact_jid,{nickname:t.nick},n);await(null==i?void 0:i.queueMessage(t));const s={stanza:e,attrs:t,chatbox:i};Wl.trigger("message",s)}Jl.plugins.add("converse-chat",{dependencies:["converse-chatboxes","converse-disco"],initialize(){Wl.settings.extend({allow_message_corrections:"all",allow_message_retraction:"all",allow_message_styling:!0,auto_join_private_chats:[],clear_messages_on_reconnection:!1,filter_by_resource:!1,prune_messages_above:void 0,pruning_behavior:"unscrolled",send_chat_markers:["received","displayed","acknowledged"],send_chat_state_notifications:!0}),Ya.Message=Pd.extend(iu),Ya.Messages=Rc.extend({model:Ya.Message,comparator:"time"}),Object.assign(Ya,{ChatBox:Xd,handleMessageStanza:hu}),Object.assign(Wl,su),Ya.router.route("converse/chat?jid=:jid",cu),Wl.listen.on("chatBoxesFetched",du),Wl.listen.on("presencesInitialized",uu),Wl.listen.on("clearSession",lu)}});const{Strophe:mu}=Jl.env,fu=fa.extend({idAttribute:"jid",initialize(e,t){this.waitUntilFeaturesDiscovered=fo(),this.dataforms=new Rc;let n=`converse.dataforms-${this.get("jid")}`;this.dataforms.browserStorage=Ya.createStore(n,"session"),this.features=new Rc,n=`converse.features-${this.get("jid")}`,this.features.browserStorage=Ya.createStore(n,"session"),this.listenTo(this.features,"add",this.onFeatureAdded),this.fields=new Rc,n=`converse.fields-${this.get("jid")}`,this.fields.browserStorage=Ya.createStore(n,"session"),this.listenTo(this.fields,"add",this.onFieldAdded),this.identities=new Rc,n=`converse.identities-${this.get("jid")}`,this.identities.browserStorage=Ya.createStore(n,"session"),this.fetchFeatures(t),this.items=new Ya.DiscoEntities,n=`converse.disco-items-${this.get("jid")}`,this.items.browserStorage=Ya.createStore(n,"session"),this.items.fetch()},async getIdentity(e,t){return await this.waitUntilFeaturesDiscovered,this.identities.findWhere({category:e,type:t})},async hasFeature(e){if(await this.waitUntilFeaturesDiscovered,this.features.findWhere({var:e}))return this},onFeatureAdded(e){e.entity=this,Wl.trigger("serviceDiscovered",e)},onFieldAdded(e){e.entity=this,Wl.trigger("discoExtensionFieldDiscovered",e)},async fetchFeatures(e){if(e.ignore_cache)this.queryInfo();else{const e=this.features.browserStorage.name,t=await this.features.browserStorage.store.getItem(e);t&&0===t.length||null===t?this.queryInfo():(this.features.fetch({add:!0,success:()=>{this.waitUntilFeaturesDiscovered.resolve(this),this.trigger("featuresDiscovered")}}),this.identities.fetch({add:!0}))}},async queryInfo(){let e;try{e=await Wl.disco.info(this.get("jid"),null)}catch(e){return null===e?R.error(`Timeout for disco#info query for ${this.get("jid")}`):R.error(e),void this.waitUntilFeaturesDiscovered.resolve(this)}this.onInfo(e)},onDiscoItems(e){Vo()(`query[xmlns="${mu.NS.DISCO_ITEMS}"] item`,e).forEach((e=>{if(e.getAttribute("node"))return;const t=e.getAttribute("jid");if(void 0===this.items.get(t)){const e=Ya.disco_entities.get(t);e?this.items.add(e):this.items.create({jid:t})}}))},async queryForItems(){if(0===this.identities.where({category:"server"}).length)return;const e=await Wl.disco.items(this.get("jid"));this.onDiscoItems(e)},onInfo(e){Array.from(e.querySelectorAll("identity")).forEach((e=>{this.identities.create({category:e.getAttribute("category"),type:e.getAttribute("type"),name:e.getAttribute("name")})})),Vo()(`x[type="result"][xmlns="${mu.NS.XFORM}"]`,e).forEach((e=>{const t={};Vo()("field",e).forEach((e=>{var n;t[e.getAttribute("var")]={value:null===(n=e.querySelector("value"))||void 0===n?void 0:n.textContent,type:e.getAttribute("type")}})),this.dataforms.create(t)})),e.querySelector(`feature[var="${mu.NS.DISCO_ITEMS}"]`)&&this.queryForItems(),Array.from(e.querySelectorAll("feature")).forEach((t=>{this.features.create({var:t.getAttribute("var"),from:e.getAttribute("from")})})),Vo()('x[type="result"][xmlns="jabber:x:data"] field',e).forEach((t=>{var n;this.fields.create({var:t.getAttribute("var"),value:null===(n=t.querySelector("value"))||void 0===n?void 0:n.textContent,from:e.getAttribute("from")})})),this.waitUntilFeaturesDiscovered.resolve(this),this.trigger("featuresDiscovered")}}),gu=fu,pu=Rc.extend({model:gu,fetchEntities(){return new Promise(((e,t)=>{this.fetch({add:!0,success:e,error(e,n){R.error(n),t(new Error("Could not fetch disco entities"))}})}))}}),vu=pu,{Strophe:yu,$iq:_u}=Jl.env;async function bu(){Wl.disco.own.identities.add("client","web","Converse"),Wl.disco.own.features.add(yu.NS.CHATSTATES),Wl.disco.own.features.add(yu.NS.DISCO_INFO),Wl.disco.own.features.add(yu.NS.ROSTERX),Wl.settings.get("message_carbons")&&Wl.disco.own.features.add(yu.NS.CARBONS),Wl.trigger("addClientFeatures"),Ya.connection.addHandler((e=>function(e){const t=e.getElementsByTagName("query")[0].getAttribute("node"),n={xmlns:yu.NS.DISCO_INFO};t&&(n.node=t);const i=_u({type:"result",id:e.getAttribute("id")}),s=e.getAttribute("from");return null!==s&&i.attrs({to:s}),i.c("query",n),Ya.disco._identities.forEach((e=>{const t={category:e.category,type:e.type};e.name&&(t.name=e.name),e.lang&&(t["xml:lang"]=e.lang),i.c("identity",t).up()})),Ya.disco._features.forEach((e=>i.c("feature",{var:e}).up())),Wl.send(i.tree()),!0}(e)),yu.NS.DISCO_INFO,"iq","get",null,null),Ya.disco_entities=new Ya.DiscoEntities;const e=`converse.disco-entities-${Ya.bare_jid}`;Ya.disco_entities.browserStorage=Ya.createStore(e,"session");const t=await Ya.disco_entities.fetchEntities();0!==t.length&&t.get(Ya.domain)||Ya.disco_entities.create({jid:Ya.domain}),Wl.trigger("discoInitialized")}function wu(){if(!Ya.stream_features){const e=`converse.stream-features-${yu.getBareJidFromJid(Ya.jid)}`;Wl.promises.add("streamFeaturesAdded"),Ya.stream_features=new Rc,Ya.stream_features.browserStorage=Ya.createStore(e,"session")}}function Su(){Wl.trigger("streamFeaturesAdded")}function xu(){wu(),Array.from(Ya.connection.features.childNodes).forEach((e=>{Ya.stream_features.create({name:e.nodeName,xmlns:e.getAttribute("xmlns")})})),Su()}function Eu(){var e,t,n,i,s;null===(e=Ya.disco_entities)||void 0===e||e.forEach((e=>e.features.clearStore())),null===(t=Ya.disco_entities)||void 0===t||t.forEach((e=>e.identities.clearStore())),null===(n=Ya.disco_entities)||void 0===n||n.forEach((e=>e.dataforms.clearStore())),null===(i=Ya.disco_entities)||void 0===i||i.forEach((e=>e.fields.clearStore())),null===(s=Ya.disco_entities)||void 0===s||s.clearStore(),delete Ya.disco_entities}const{Strophe:Au,$iq:Cu}=Jl.env,Tu={disco:{stream:{async getFeature(e,t){if(await Wl.waitUntil("streamFeaturesAdded"),!e||!t)throw new Error("name and xmlns need to be provided when calling disco.stream.getFeature");if(void 0!==Ya.stream_features||Wl.connection.connected())return Ya.stream_features.findWhere({name:e,xmlns:t});{const n=`Tried to get feature ${e} ${t} but _converse.stream_features has been torn down`;R.warn(n)}}},own:{identities:{add(e,t,n,i){for(var s=0;s<Ya.disco._identities.length;s++)if(Ya.disco._identities[s].category==e&&Ya.disco._identities[s].type==t&&Ya.disco._identities[s].name==n&&Ya.disco._identities[s].lang==i)return!1;Ya.disco._identities.push({category:e,type:t,name:n,lang:i})},clear(){Ya.disco._identities=[]},get:()=>Ya.disco._identities},features:{add(e){for(var t=0;t<Ya.disco._features.length;t++)if(Ya.disco._features[t]==e)return!1;Ya.disco._features.push(e)},clear(){Ya.disco._features=[]},get:()=>Ya.disco._features}},info(e,t){const n={xmlns:Au.NS.DISCO_INFO};t&&(n.node=t);const i=Cu({from:Ya.connection.jid,to:e,type:"get"}).c("query",n);return Wl.sendIQ(i)},items(e,t){const n={xmlns:Au.NS.DISCO_ITEMS};return t&&(n.node=t),Wl.sendIQ(Cu({from:Ya.connection.jid,to:e,type:"get"}).c("query",n))},entities:{async get(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(await Wl.waitUntil("discoInitialized"),!e)return Ya.disco_entities;if(void 0===Ya.disco_entities){const t=`Tried to look up entity ${e} but _converse.disco_entities has been torn down`;return void R.warn(t)}const n=Ya.disco_entities.get(e);return n||!t?n:Wl.disco.entities.create(e)},create:(e,t)=>Ya.disco_entities.create({jid:e},t)},features:{async get(e,t){if(!t)throw new TypeError("You need to provide an entity JID");await Wl.waitUntil("discoInitialized");let n=await Wl.disco.entities.get(t,!0);if(void 0===Ya.disco_entities&&!Wl.connection.connected()){const n=`Tried to get feature ${e} for ${t} but _converse.disco_entities has been torn down`;return void R.warn(n)}n=await n.waitUntilFeaturesDiscovered;const i=[...n.items.map((t=>t.hasFeature(e))),n.hasFeature(e)];return(await Promise.all(i)).filter(ye)}},supports:async(e,t)=>(await Wl.disco.features.get(e,t)||[]).length>0,async refresh(e){if(!e)throw new TypeError("api.disco.refresh: You need to provide an entity JID");await Wl.waitUntil("discoInitialized");let t=await Wl.disco.entities.get(e);return t?(t.features.reset(),t.fields.reset(),t.identities.reset(),t.waitUntilFeaturesDiscovered.isPending||(t.waitUntilFeaturesDiscovered=fo()),t.queryInfo()):t=await Wl.disco.entities.create(e,{ignore_cache:!0}),t.waitUntilFeaturesDiscovered},refreshFeatures:e=>Wl.refresh(e),async getFeatures(e){if(!e)throw new TypeError("api.disco.getFeatures: You need to provide an entity JID");await Wl.waitUntil("discoInitialized");let t=await Wl.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.features},async getFields(e){if(!e)throw new TypeError("api.disco.getFields: You need to provide an entity JID");await Wl.waitUntil("discoInitialized");let t=await Wl.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.fields},async getIdentity(e,t,n){const i=await Wl.disco.entities.get(n,!0);if(void 0!==i||Wl.connection.connected())return i.getIdentity(e,t);{const t=`Tried to look up category ${e} for ${n} but _converse.disco_entities has been torn down`;R.warn(t)}}}},{Strophe:ku}=Jl.env;Jl.plugins.add("converse-disco",{initialize(){Object.assign(Wl,Tu),Wl.promises.add("discoInitialized"),Wl.promises.add("streamFeaturesAdded"),Ya.DiscoEntity=gu,Ya.DiscoEntities=vu,Ya.disco={_identities:[],_features:[]},Wl.listen.on("userSessionInitialized",(async()=>{wu(),Ya.connfeedback.get("connection_status")===ku.Status.ATTACHED&&(await new Promise(((e,t)=>Ya.stream_features.fetch({success:e,error:t}))),Su())})),Wl.listen.on("beforeResourceBinding",xu),Wl.listen.on("reconnected",bu),Wl.listen.on("connected",bu),Wl.listen.on("beforeTearDown",(async()=>{Wl.promises.add("streamFeaturesAdded"),Ya.stream_features&&(await Ya.stream_features.clearStore(),delete Ya.stream_features)})),Wl.listen.on("will-reconnect",Eu),Wl.listen.on("clearSession",Eu)}});const ju=new RegExp("<object[^>]*>.*?</object>|<span[^>]*>.*?</span>|<(?: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"),$u=/(?:\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,Nu=Jl.env.utils;Jl.emojis={initialized:!1,initialized_promise:fo()};const Ou={"*\\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 Iu(e){if(e.indexOf("-")>-1){const t=[],n=e.split("-");for(let e=0;e<n.length;e++){let i=parseInt(n[e],16);if(i>=65536&&i<=1114111){const e=Math.floor((i-65536)/1024)+55296,t=(i-65536)%1024+56320;i=String.fromCharCode(e)+String.fromCharCode(t)}else i=String.fromCharCode(i);t.push(i)}return t.join("")}return function(e){let t="string"==typeof e?parseInt(e,16):e;return t<65536?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}(e)}function Mu(e){return e.replace(ju,((e,t,n,i)=>void 0!==i&&""!==i&&Nu.unescapeHTML(i)in Ou?(i=Nu.unescapeHTML(i),n+Iu(Ou[i].toUpperCase())):e))}function Ru(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{unicode_only:!1,add_title_wrapper:!1};const n=e.emoji,i=e.shortname;if(n){if(t.unicode_only)return n;if(Wl.settings.get("use_system_emojis"))return t.add_title_wrapper&&i?xl`<span title="${i}">${n}</span>`:n;{const t=Wl.settings.get("emoji_image_path");return xl`<img class="emoji"
draggable="false"
title="${i}"
alt="${n}"
src="${t}/72x72/${e.cp}.png"/>`}}return t.unicode_only?i:xl`<img class="emoji"
draggable="false"
title="${i}"
alt="${i}"
src="${Jl.emojis.by_sn[i].url}">`}function Du(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 Lu(e){const t=[];return function(e,n){const i=/\uFE0F/g,s=String.fromCharCode(8205);String(e).replace($u,((e,n,r)=>{const o=function(e){const t=[];let n=0,i=0;for(;i<e.length;){const s=e.charCodeAt(i++);n?(t.push((65536+(n-55296<<10)+(s-56320)).toString(16)),n=0):55296<=s&&s<=56319?n=s:t.push(s.toString(16))}return t.join("-")}(e.indexOf(s)<0?e.replace(i,""):e);o&&((e,n,i)=>{var s;t.push({begin:i,cp:e,emoji:n,end:i+n.length,shortname:(null===(s=Nu.getEmojisByAtrribute("cp")[e])||void 0===s?void 0:s.sn)||""})})(o,e,r)}))}(e),t}Jl.plugins.add("converse-emoji",{initialize(){const{___:e}=Ya;Wl.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")}}),Ya.EmojiPicker=fa.extend({defaults:{current_category:"smileys",current_skintone:"",scroll_position:0}});const t={};Object.assign(Nu,{shortnamesToEmojis(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{unicode_only:!1,add_title_wrapper:!1};return function(e,t){let n=[e];return[...Du(e),...Lu(e)].sort(((e,t)=>t.begin-e.begin)).forEach((e=>{const i=n.shift(),s=Ru(e,t);n="string"==typeof s?[i.slice(0,e.begin)+s+i.slice(e.end),...n]:[i.slice(0,e.begin),s,i.slice(e.end),...n]})),n}(e=Mu(e),t)},shortnamesToUnicode:e=>Nu.shortnamesToEmojis(e,{unicode_only:!0})[0],isOnlyEmojis(e){const t=e.trim().split(/\s+/);if(0===t.length||t.length>3)return!1;const n=t.filter((e=>{const t=Lu(Nu.shortnamesToUnicode(e));return 1===t.length&&(e===t[0].shortname||e===t[0].emoji)}));return n.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(Wl,{emojis:{async initialize(){if(!Jl.emojis.initialized){Jl.emojis.initialized=!0;const{default:t}=await n.e(4610).then(n.t.bind(n,5175,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 i=()=>Jl.emojis.shortnames.map((e=>e.replace(/[+]/g,"\\$&"))).join("|");Jl.emojis.shortnames_regex=new RegExp(i(),"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 zu={initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",(()=>this.uploadFile())),this.on("change:type",(()=>this.setOccupant())),this.on("change:is_ephemeral",(()=>this.setTimerForEphemeralMessage())),this.setTimerForEphemeralMessage(),this.setOccupant(),Wl.trigger("chatRoomMessageInitialized",this))},getDisplayName(){var e;return(null===(e=this.occupant)||void 0===e?void 0:e.getDisplayName())||this.get("nick")},mayBeModerated(){if(void 0!==this.get("from_muc"))return["all","moderator"].includes(Wl.settings.get("allow_message_retraction"))&&this.get(`stanza_id ${this.get("from_muc")}`)&&this.collection.chatbox.canModerateMessages()},checkValidity(){const e=Ya.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 R.error(`Could not get collection.chatbox for message: ${JSON.stringify(this.toJSON())}`);this.listenTo(t.occupants,"add",this.onOccupantAdded)},onOccupantAdded(e){var t;if(this.get("occupant_id")){if(e.get("occupant_id")!==this.get("occupant_id"))return}else if(e.get("nick")!==de.getResourceFromJid(this.get("from")))return;this.occupant=e,this.trigger("occupantAdded"),this.listenTo(this.occupant,"destroy",this.onOccupantRemoved);const n=null==this||null===(t=this.collection)||void 0===t?void 0:t.chatbox;if(!n)return R.error(`Could not get collection.chatbox for message: ${JSON.stringify(this.toJSON())}`);this.stopListening(n.occupants,"add",this.onOccupantAdded)},setOccupant(){var e;if("groupchat"!==this.get("type")||this.isEphemeral()||this.occupant)return;const t=null==this||null===(e=this.collection)||void 0===e?void 0:e.chatbox;if(!t)return R.error(`Could not get collection.chatbox for message: ${JSON.stringify(this.toJSON())}`);const n=de.getResourceFromJid(this.get("from"));if(this.occupant=t.occupants.findOccupant({nick:n,occupant_id:this.get("occupant_id")}),!this.occupant&&Wl.settings.get("muc_send_probes")){this.occupant=t.occupants.create({nick:n,type:"unavailable"});const e=`${t.get("jid")}/${n}`;Wl.user.presence.send("probe",e)}this.occupant?this.listenTo(this.occupant,"destroy",this.onOccupantRemoved):this.listenTo(t.occupants,"add",this.onOccupantAdded)}},Pu=zu,Fu={},Uu=(e,t)=>e.replace(RegExp("\\"+t,"ig"),"\\"+t);Fu.escapeCharacters=e=>t=>e.split("").reduce(Uu,t),Fu.escapeRegexString=Fu.escapeCharacters("[\\^$.?*+(){}|"),Fu.findFirstMatchInArray=e=>t=>{for(let n=0;n<e.length;n++)if(0===t.localeCompare(e[n],void 0,{sensitivity:"base"}))return e[n];return null};const Bu=(e,t,n)=>{let[i,s]=e,r=i,{begin:o,end:a}=t;const{value:c}=t;return o-=n,a=a-n-1,r=`${r.slice(0,o)}${c}${r.slice(a+1)}`,[r,[...s,{...t,begin:o,end:a}]]};Fu.reduceTextFromReferences=(e,t)=>t.reduce(Bu,[e,[]]);const qu=Fu;Ba.webForm2xForm=function(e){const t=e.getAttribute("name");if(!t)return null;let n;return n="checkbox"===e.getAttribute("type")?e.checked?1:0:"TEXTAREA"==e.tagName?e.value.split("\n").filter((e=>e.trim())):"SELECT"==e.tagName?Ba.getSelectValues(e):e.value,Ba.toStanza(`\n <field var="${t}">\n ${n.constructor===Array?n.map((e=>`<value>${e}</value>`)):`<value>${n}</value>`}\n </field>`)};const Hu=Ba,Gu=function(e,t){return function(e,t,n){for(var i=-1,s=e.length,r=t.length,o={};++i<s;){var a=i<r?t[i]:void 0;n(o,e[i],a)}return o}(e||[],t||[],Le)},{Strophe:Wu,sizzle:Vu,u:Ju}=Jl.env,{NS:Qu}=Wu;function Zu(e){const t=Vu(`items[node="${Wu.NS.CONFINFO}"]`,e).pop();if(!t)return null;const n=e.getAttribute("from"),i=e.getAttribute("id"),s=`item conference-info[xmlns="${Wu.NS.CONFINFO}"] activity[xmlns="${Wu.NS.ACTIVITY}"]`;return Vu(s,t).map((t=>{var s;const r=null===(s=t.querySelector("text"))||void 0===s?void 0:s.textContent;if(r){var o;const s=xd(e),a=null===(o=t.querySelector("reason"))||void 0===o?void 0:o.textContent;return{from:n,msgid:i,message:r,reason:a,references:s,type:"mep"}}return{}}))}function Yu(e,t){var n;if(t.features.get(Wu.NS.OCCUPANTID))return null===(n=Vu(`occupant-id[xmlns="${Wu.NS.OCCUPANTID}"]`,e).pop())||void 0===n?void 0:n.getAttribute("id")}async function Xu(e,t){var n,i,s,r,o;kd(e);const a=`[xmlns="${Qu.MAM}"] > forwarded[xmlns="${Qu.FORWARD}"] > message`,c=e;if(e=Vu(a,e).pop()||e,Vu(`message > forwarded[xmlns="${Wu.NS.FORWARD}"]`,e).length)return new fd(`Invalid Stanza: Forged MAM groupchat message from ${e.getAttribute("from")}`,e);const l=Vu(`delay[xmlns="${Wu.NS.DELAY}"]`,c).pop(),d=e.getAttribute("from"),u=Wu.getBareJidFromJid(d),h=Wu.unescapeNode(Wu.getResourceFromJid(d)),m=jd(e),f=(new Date).toISOString();let g=Object.assign({from:d,from_muc:u,nick:h,is_forwarded:!!e.querySelector("forwarded"),activities:Zu(e),body:null===(n=e.querySelector("body"))||void 0===n||null===(i=n.textContent)||void 0===i?void 0:i.trim(),chat_state:Cd(e),is_archived:Od(c),is_carbon:Ad(c),is_delayed:!!l,is_headline:$d(e),is_markable:!!Vu(`markable[xmlns="${Wu.NS.MARKERS}"]`,e).length,is_marker:!!m,is_unstyled:!!Vu(`unstyled[xmlns="${Wu.NS.STYLING}"]`,e).length,marker_id:m&&m.getAttribute("id"),msgid:e.getAttribute("id")||c.getAttribute("id"),occupant_id:Yu(e,t),receipt_id:Ed(e),received:(new Date).toISOString(),references:xd(e),subject:null===(s=e.querySelector("subject"))||void 0===s?void 0:s.textContent,thread:null===(r=e.querySelector("thread"))||void 0===r?void 0:r.textContent,time:l?tc()(l.getAttribute("stamp")).toISOString():f,to:e.getAttribute("to"),type:e.getAttribute("type")},Sd(e),wd(e),bd(e),yd(e,c),gd(e,c),function(e){const t=Vo()(`> apply-to[xmlns="${de.NS.FASTEN}"]`,e).pop();if(t){const e=t.getAttribute("id"),n=Vo()(`> meta[xmlns="${de.NS.XHTML}"]`,t);if(n.length){const t=Wl.settings.get("message_limit"),i=n.reduce(((e,n)=>{const i=n.getAttribute("property");if(i){let s=Ua(n.getAttribute("content")||"");t&&"og:description"===i&&s.length>=t&&(s=`${s.slice(0,t)}${Ua("&#8230;")}`),e[i]=s}return e}),{ogp_for_id:e});if("og:description"in i||"og:title"in i||"og:image"in i)return i}}return{}}(e),vd(e,c),function(e){const t=Vu(`apply-to[xmlns="${Wu.NS.FASTEN}"]`,e).pop();if(t){const e=t.getAttribute("id"),i=Vu(`moderated[xmlns="${Wu.NS.MODERATE}"]`,t).pop();var n;if(i&&Vu(`retract[xmlns="${Wu.NS.RETRACT}"]`,i).pop())return{editable:!1,moderated:"retracted",moderated_by:i.getAttribute("by"),moderated_id:e,moderation_reason:null===(n=i.querySelector("reason"))||void 0===n?void 0:n.textContent}}else{const t=Vu(`> moderated[xmlns="${Wu.NS.MODERATE}"]`,e).pop();var i;if(t&&Vu(`retracted[xmlns="${Wu.NS.RETRACT}"]`,t).pop())return{editable:!1,is_tombstone:!0,moderated_by:t.getAttribute("by"),retracted:t.getAttribute("stamp"),moderation_reason:null===(i=t.querySelector("reason"))||void 0===i?void 0:i.textContent}}return{}}(e),pd(e));await Wl.emojis.initialize();const p=g.is_archived&&function(e){const t=Vu(`x[xmlns="${Wu.NS.MUC_USER}"] item`,e).pop();return null==t?void 0:t.getAttribute("jid")}(e)||(null===(o=t.occupants.findOccupant(g))||void 0===o?void 0:o.get("jid"));return g=Object.assign({from_real_jid:p,is_only_emojis:!!g.body&&Ju.isOnlyEmojis(g.body),is_valid_receipt_request:Td(e,g),message:g.body||g.error,sender:g.nick===t.get("nick")?"me":"them"},g),g.is_archived&&c.getAttribute("from")!==g.from_muc?new fd(`Invalid Stanza: Forged MAM message from ${c.getAttribute("from")}`,e):g.is_archived&&c.getAttribute("from")!==t.get("jid")?new fd(`Invalid Stanza: Forged MAM groupchat message from ${e.getAttribute("from")}`,e):g.is_carbon?new fd("Invalid Stanza: MUC messages SHOULD NOT be XEP-0280 carbon copied",e):(g.id=g.origin_id||g[`stanza_id ${g.from_muc||g.from}`]||Ju.getUniqueId(),g=await Wl.hook("parseMUCMessage",e,g),Object.assign(g,_d(g.is_encrypted?g.plaintext:g.body)))}const{Strophe:Ku,$iq:eh,u:th}=Jl.env;async function nh(e,t){const{__:n}=Ya,i=eh({to:t,type:"get"}).c("query",{xmlns:Ku.NS.MUC_ADMIN}).c("item",{affiliation:e}),s=await Wl.sendIQ(i,null,!1);if(null===s){const i=n("Error: timeout while fetching %1s list for MUC %2s",e,t),r=new Error(i);return R.warn(i),R.warn(s),r}if(th.isErrorStanza(s)){const i=n("Error: not allowed to fetch %1s list for MUC %2s",e,t),r=new Error(i);return R.warn(i),R.warn(s),r}return function(e){return Vu(`query[xmlns="${Wu.NS.MUC_ADMIN}"] item`,e).map((e=>{const t={affiliation:e.getAttribute("affiliation")},n=e.getAttribute("jid");Ju.isValidJID(n)?t.jid=n:t.nick=n;const i=e.getAttribute("nick");return i&&(t.nick=i),e.getAttribute("role")&&(t.role=i),t}))}(s).filter((e=>e)).sort(((e,t)=>e.nick<t.nick?-1:e.nick>t.nick?1:0))}function ih(e){let t=Wl.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Fh:[]),"owner"===e.get("affiliation")?Fh.filter((e=>!t.includes(e))):"admin"===e.get("affiliation")?Fh.filter((e=>!["owner","admin",...t].includes(e))):[]}function sh(e,t){const n=[...new Set(t.map((e=>e.affiliation)))];return Promise.all(n.map((n=>rh(n,e,t))))}function rh(e,t,n){return Array.isArray(t)||(t=[t]),n=n.filter((t=>[void 0,e].includes(t.affiliation))),Promise.all(t.reduce(((t,i)=>[...t,...n.map((t=>function(e,t,n){const i=eh({to:t,type:"set"}).c("query",{xmlns:Ku.NS.MUC_ADMIN}).c("item",{affiliation:n.affiliation||e,nick:n.nick,jid:n.jid});return void 0!==n.reason&&i.c("reason",n.reason),Wl.sendIQ(i)}(e,i,t)))]),[]))}function oh(e,t,n,i){const s=n.map((e=>e.jid)),r=i.map((e=>e.jid));let o=vc(s,r).map((e=>n[Cc(s,e)]));return e||(o=o.concat(n.filter((e=>{const t=Cc(r,e.jid);return t>=0&&e.affiliation!==i[t].affiliation})))),t&&(o=o.concat(vc(r,s).map((e=>({jid:e,affiliation:"none"}))))),o}Ya.getAssignableAffiliations=ih;const ah=["owner"],ch=["admin","ban","deop","destroy","member","op","revoke"],lh=["kick","mute","voice","modtools"],dh=["nick"],uh=["og:article:author","og:article:published_time","og:description","og:image","og:image:height","og:image:width","og:site_name","og:title","og:type","og:url","og:video:height","og:video:secure_url","og:video:tag","og:video:type","og:video:url","og:video:width"],hh=["301","303","333","307","321","322"],mh=fa.extend({defaults:()=>({connection_status:Jl.ROOMSTATUS.DISCONNECTED})}),fh={defaults(){return{bookmarked:!1,chat_state:void 0,has_activity:!1,hidden:$a()&&!Wl.settings.get("singleton"),hidden_occupants:!!Wl.settings.get("hide_muc_participants"),message_type:"groupchat",name:"",num_unread_general:0,num_unread:0,roomconfig:{},time_opened:this.get("time_opened")||(new Date).getTime(),time_sent:new Date(0).toISOString(),type:Ya.CHATROOMS_TYPE}},async initialize(){this.initialized=fo(),this.debouncedRejoin=va(this.rejoin,250),this.set("box_id",`box-${this.get("jid")}`),this.initNotifications(),this.initMessages(),this.initUI(),this.initOccupants(),this.initDiscoModels(),this.registerHandlers(),this.on("change:chat_state",this.sendChatState,this),this.on("change:hidden",this.onHiddenChange,this),this.on("destroy",this.removeHandlers,this),this.ui.on("change:scrolled",this.onScrolledChanged,this),await this.restoreSession(),this.session.on("change:connection_status",this.onConnectionStatusChanged,this),this.listenTo(this.occupants,"add",this.onOccupantAdded),this.listenTo(this.occupants,"remove",this.onOccupantRemoved),this.listenTo(this.occupants,"change:show",this.onOccupantShowChanged),this.listenTo(this.occupants,"change:affiliation",this.createAffiliationChangeMessage),this.listenTo(this.occupants,"change:role",this.createRoleChangeMessage),await this.restoreFromCache()||this.join(),await Wl.trigger("chatRoomInitialized",this,{Synchronous:!0}),this.initialized.resolve()},isEntered(){return this.session.get("connection_status")===Jl.ROOMSTATUS.ENTERED},async restoreFromCache(){return this.isEntered()&&await this.isJoined()?(await new Promise((e=>this.features.fetch({success:e,error:e}))),await new Promise((e=>this.config.fetch({success:e,error:e}))),await this.fetchOccupants().catch((e=>R.error(e))),await this.fetchMessages().catch((e=>R.error(e))),!0):(this.session.save("connection_status",Jl.ROOMSTATUS.DISCONNECTED),this.clearOccupantsCache(),!1)},async join(e,t){return this.isEntered()?this:(this.session.save("connection_status",Jl.ROOMSTATUS.CONNECTING),await this.refreshDiscoInfo(),(e=await this.getAndPersistNickname(e))?(Wl.send(await this.constructJoinPresence(t)),this):(Hu.safeSave(this.session,{connection_status:Jl.ROOMSTATUS.NICKNAME_REQUIRED}),Wl.settings.get("muc_show_logs_before_join")&&await this.fetchMessages(),this))},rejoin(){return this.session.save("connection_status",Jl.ROOMSTATUS.DISCONNECTED),this.registerHandlers(),this.clearOccupantsCache(),this.join()},async constructJoinPresence(e){let t=le({id:La(),from:Ya.connection.jid,to:this.getRoomJIDAndNick()}).c("x",{xmlns:de.NS.MUC}).c("history",{maxstanzas:this.features.get("mam_enabled")?0:Wl.settings.get("muc_history_max_stanzas")}).up();(e=e||this.get("password"))&&t.cnode(de.xmlElement("password",[],e)),t.up();const n=Ya.xmppstatus.get("status");["away","chat","dnd","xa"].includes(n)&&t.c("show").t(n).up();const i=Ya.xmppstatus.get("status_message");return i&&t.c("status").t(i).up(),t=await Wl.hook("constructedMUCPresence",null,t),t},clearOccupantsCache(){this.occupants.length?this.occupants.filter((e=>!e.isMember())).forEach((e=>e.destroy())):this.occupants.clearStore()},sendMarkerForMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"displayed",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&Wl.settings.get("send_chat_markers").includes(t)&&"groupchat"===(null==e?void 0:e.get("type"))&&(null!=e&&e.get("is_markable")||n)){const n=`stanza_id ${this.get("jid")}`,i=e.get(n);if(!i)return void R.error(`Can't send marker for message without stanza ID: ${n}`);Yl(de.getBareJidFromJid(e.get("from")),i,t,e.get("type"))}},enableRAI(){if(Wl.settings.get("muc_subscribe_to_rai")){const e=de.getDomainFromJid(this.get("jid"));Wl.user.presence.send(null,e,null,oe("rai",{xmlns:de.NS.RAI}))}},async onHiddenChange(){const e=Jl.ROOMSTATUS,t=this.session.get("connection_status");this.get("hidden")?t===e.ENTERED&&Wl.settings.get("muc_subscribe_to_rai")&&"none"!==this.getOwnAffiliation()&&(this.sendMarkerForLastMessage("received",!0),await this.leave(),this.enableRAI()):(t===e.DISCONNECTED&&this.rejoin(),this.clearUnreadMsgCounter())},onOccupantAdded(e){Ya.isInfoVisible(Jl.MUC_TRAFFIC_STATES.ENTERED)&&this.session.get("connection_status")===Jl.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),Jl.MUC_TRAFFIC_STATES.ENTERED)},onOccupantRemoved(e){Ya.isInfoVisible(Jl.MUC_TRAFFIC_STATES.EXITED)&&this.isEntered()&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),Jl.MUC_TRAFFIC_STATES.EXITED)},onOccupantShowChanged(e){e.get("states").includes("303")||("offline"===e.get("show")&&Ya.isInfoVisible(Jl.MUC_TRAFFIC_STATES.EXITED)?this.updateNotifications(e.get("nick"),Jl.MUC_TRAFFIC_STATES.EXITED):"online"===e.get("show")&&Ya.isInfoVisible(Jl.MUC_TRAFFIC_STATES.ENTERED)&&this.updateNotifications(e.get("nick"),Jl.MUC_TRAFFIC_STATES.ENTERED))},async onRoomEntered(){await this.occupants.fetchMembers(),Wl.settings.get("clear_messages_on_reconnection")?(await this.messages.clearStore(),this.messages.fetched.resolve()):await this.fetchMessages(),Wl.trigger("enteredNewRoom",this),Wl.settings.get("auto_register_muc_nickname")&&await Wl.disco.supports(de.NS.MUC_REGISTER,this.get("jid"))&&this.registerNickname()},async onConnectionStatusChanged(){if(this.isEntered())if(this.get("hidden")&&Wl.settings.get("muc_subscribe_to_rai")&&"none"!==this.getOwnAffiliation()){try{await this.leave()}catch(e){R.error(e)}this.enableRAI()}else await this.onRoomEntered()},async onReconnection(){await this.rejoin(),this.announceReconnection()},getMessagesCollection:()=>new Ya.ChatRoomMessages,restoreSession(){const e=`muc.session-${Ya.bare_jid}-${this.get("jid")}`;return this.session=new mh({id:e}),Oo(this.session,e,"session"),new Promise((e=>this.session.fetch({success:e,error:e})))},initDiscoModels(){let e=`converse.muc-features-${Ya.bare_jid}-${this.get("jid")}`;this.features=new fa(Object.assign({id:e},Gu(Jl.ROOM_FEATURES,Jl.ROOM_FEATURES.map((()=>!1))))),this.features.browserStorage=Ya.createStore(e,"session"),this.features.listenTo(Ya,"beforeLogout",(()=>this.features.browserStorage.flush())),e=`converse.muc-config-${Ya.bare_jid}-${this.get("jid")}`,this.config=new fa({id:e}),this.config.browserStorage=Ya.createStore(e,"session"),this.config.listenTo(Ya,"beforeLogout",(()=>this.config.browserStorage.flush()))},initOccupants(){this.occupants=new Ya.ChatRoomOccupants;const e=`converse.occupants-${Ya.bare_jid}${this.get("jid")}`;this.occupants.browserStorage=Ya.createStore(e,"session"),this.occupants.chatroom=this,this.occupants.listenTo(Ya,"beforeLogout",(()=>this.occupants.browserStorage.flush()))},fetchOccupants(){return this.occupants.fetched=new Promise((e=>{this.occupants.fetch({add:!0,silent:!0,success:e,error:e})})),this.occupants.fetched},handleAffiliationChangedMessage(e){const t=Vo()(`x[xmlns="${de.NS.MUC_USER}"] item`,e).pop();if(t){const n=e.getAttribute("from"),i=e.getAttribute("type"),s=t.getAttribute("affiliation"),r=t.getAttribute("jid"),o={from:n,type:i,affiliation:s,states:[],show:"unavailable"==i?"offline":"online",role:t.getAttribute("role"),jid:de.getBareJidFromJid(r),resource:de.getResourceFromJid(r)},a=this.occupants.findOccupant({jid:o.jid});a?a.save(o):this.occupants.create(o)}},async handleErrorMessageStanza(e){const{__:t}=Ya,n=await Xu(e,this);if(!await this.shouldShowErrorMessage(n))return;const i=this.getMessageReferencedByError(n);if(i){const e={error:n.error,error_condition:n.error_condition,error_text:n.error_text,error_type:n.error_type,editable:!1};n.msgid===i.get("retraction_id")?(e.retracted=void 0,e.retraction_id=void 0,e.retracted_id=void 0,n.error||("forbidden"===n.error_condition?e.error=t("You're not allowed to retract your message."):"not-acceptable"===n.error_condition?e.error=t("Your retraction was not delivered because you're not present in the groupchat."):e.error=t("Sorry, an error occurred while trying to retract your message."))):n.error||("forbidden"===n.error_condition?e.error=t("Your message was not delivered because you weren't allowed to send it."):"not-acceptable"===n.error_condition?e.error=t("Your message was not delivered because you're not present in the groupchat."):e.error=t("Sorry, an error occurred while trying to send your message.")),i.save(e)}else this.createMessage(n)},handleMessageFromMUCHost(e){if(this.isEntered())return;const t=Vo()(`rai[xmlns="${de.NS.RAI}"]`,e).pop(),n=Array.from((null==t?void 0:t.querySelectorAll("activity"))||[]).map((e=>e.textContent));n.includes(this.get("jid"))&&this.save({has_activity:!0,num_unread_general:0})},handleForwardedMentions(e){if(this.isEntered())return;const t=Vo()(`mentions[xmlns="${de.NS.MENTIONS}"] forwarded[xmlns="${de.NS.FORWARD}"] message[type="groupchat"]`,e),n=this.get("jid"),i=t.filter((e=>de.getBareJidFromJid(e.getAttribute("from"))===n));i.length&&(this.save({has_activity:!0,num_unread:this.get("num_unread")+i.length}),i.forEach((async e=>{const t={stanza:e,attrs:await Xu(e,this),chatbox:this};Wl.trigger("message",t)})))},async handleMessageStanza(e){const t=e.getAttribute("type");if("error"===t)return this.handleErrorMessageStanza(e);if("groupchat"===t){if(Od(e))return R.warn('Received a MAM message with type "groupchat"');this.createInfoMessages(e),this.fetchFeaturesIfConfigurationChanged(e)}else if(!t)return this.handleForwardedMentions(e);let n;try{n=await Xu(e,this)}catch(e){return R.error(e.message)}const i={stanza:e,attrs:n,chatbox:this};return Wl.trigger("message",i),n&&this.queueMessage(n)},registerHandlers(){const e=this.get("jid"),t=de.getDomainFromJid(e);this.removeHandlers(),this.presence_handler=Ya.connection.addHandler((e=>this.onPresence(e)||!0),null,"presence",null,null,e,{ignoreNamespaceFragment:!0,matchBareFromJid:!0}),this.domain_presence_handler=Ya.connection.addHandler((e=>this.onPresenceFromMUCHost(e)||!0),null,"presence",null,null,t),this.message_handler=Ya.connection.addHandler((e=>!!this.handleMessageStanza(e)||!0),null,"message",null,null,e,{matchBareFromJid:!0}),this.domain_message_handler=Ya.connection.addHandler((e=>this.handleMessageFromMUCHost(e)||!0),null,"message",null,null,t),this.affiliation_message_handler=Ya.connection.addHandler((e=>this.handleAffiliationChangedMessage(e)||!0),de.NS.MUC_USER,"message",null,null,e)},removeHandlers(){return this.message_handler&&(Ya.connection&&Ya.connection.deleteHandler(this.message_handler),delete this.message_handler),this.domain_message_handler&&(Ya.connection&&Ya.connection.deleteHandler(this.domain_message_handler),delete this.domain_message_handler),this.presence_handler&&(Ya.connection&&Ya.connection.deleteHandler(this.presence_handler),delete this.presence_handler),this.domain_presence_handler&&(Ya.connection&&Ya.connection.deleteHandler(this.domain_presence_handler),delete this.domain_presence_handler),this.affiliation_message_handler&&(Ya.connection&&Ya.connection.deleteHandler(this.affiliation_message_handler),delete this.affiliation_message_handler),this},invitesAllowed(){return Wl.settings.get("allow_muc_invitations")&&(this.features.get("open")||"owner"===this.getOwnAffiliation())},getDisplayName(){return this.get("name")||("hidden"===Wl.settings.get("locked_muc_domain")?de.getNodeFromJid(this.get("jid")):this.get("jid"))},sendTimedMessage(e){"function"==typeof e.tree&&(e=e.tree());let t=e.getAttribute("id");t||(t=this.getUniqueId("sendIQ"),e.setAttribute("id",t));const n=fo(),i=Ya.connection.addTimedHandler(Ya.STANZA_TIMEOUT,(()=>{Ya.connection.deleteHandler(s);const e=new Ya.TimeoutError("Timeout Error: No response from server");return n.resolve(e),!1})),s=Ya.connection.addHandler((e=>{i&&Ya.connection.deleteTimedHandler(i),n.resolve(e)}),null,"message",["error","groupchat"],t);return Wl.send(e),n},async retractOwnMessage(e){const t=Ya.__,n=e.get("origin_id");if(!n)throw new Error("Can't retract message without a XEP-0359 Origin ID");const i=e.get("editable"),s=ae({id:La(),to:this.get("jid"),type:"groupchat"}).c("store",{xmlns:de.NS.HINTS}).up().c("apply-to",{id:n,xmlns:de.NS.FASTEN}).c("retract",{xmlns:de.NS.RETRACT});e.set({retracted:(new Date).toISOString(),retracted_id:n,retraction_id:s.nodeTree.getAttribute("id"),editable:!1});const r=await this.sendTimedMessage(s);Hu.isErrorStanza(r)?R.error(r):r instanceof Ya.TimeoutError&&(R.error(r),e.save({editable:i,error_type:"timeout",error:t("A timeout happened while while trying to retract your message."),retracted:void 0,retracted_id:void 0,retraction_id:void 0}))},async retractOtherMessage(e,t){const n=e.get("editable");e.save({moderated:"retracted",moderated_by:Ya.bare_jid,moderated_id:e.get("msgid"),moderation_reason:t,editable:!1});const i=await this.sendRetractionIQ(e,t);return(null===i||Hu.isErrorStanza(i))&&e.save({editable:n,moderated:void 0,moderated_by:void 0,moderated_id:void 0,moderation_reason:void 0}),i},sendRetractionIQ(e,t){const n=ce({to:this.get("jid"),type:"set"}).c("apply-to",{id:e.get(`stanza_id ${this.get("jid")}`),xmlns:de.NS.FASTEN}).c("moderate",{xmlns:de.NS.MODERATE}).c("retract",{xmlns:de.NS.RETRACT}).up().c("reason").t(t||"");return Wl.sendIQ(n,null,!1)},sendDestroyIQ(e,t){const n=oe("destroy");t&&n.attrs({jid:t});const i=ce({to:this.get("jid"),type:"set"}).c("query",{xmlns:de.NS.MUC_OWNER}).cnode(n.node);return e&&e.length>0&&i.c("reason",e),Wl.sendIQ(i)},async leave(e){var t;Wl.connection.connected()&&Wl.user.presence.send("unavailable",this.getRoomJIDAndNick(),e),this.features&&await new Promise((e=>this.features.destroy({success:e,error:(t,n)=>{R.error(n),e()}})));const n=null===(t=Ya.disco_entities)||void 0===t?void 0:t.get(this.get("jid"));n&&await new Promise((e=>n.destroy({success:e,error:(t,n)=>{R.error(n),e()}}))),Hu.safeSave(this.session,{connection_status:Jl.ROOMSTATUS.DISCONNECTED})},async close(e){return Hu.safeSave(this.session,{connection_status:Jl.ROOMSTATUS.CLOSING}),this.sendMarkerForLastMessage("received",!0),await this.unregisterNickname(),await this.leave(),this.occupants.clearStore(),"closeAllChatBoxes"!==(null==e?void 0:e.name)&&Wl.settings.get("muc_clear_messages_on_leave")&&this.clearMessages(),await new Promise((e=>this.session.destroy({success:e,error:(t,n)=>{R.error(n),e()}}))),Ya.ChatBox.prototype.close.call(this)},canModerateMessages(){const e=this.getOwnOccupant();return e&&e.isModerator()&&Wl.disco.supports(de.NS.MODERATE,this.get("jid"))},getAllKnownNicknames(){return[...new Set([...this.occupants.map((e=>e.get("nick"))),...this.messages.map((e=>e.get("nick")))])].filter((e=>e))},getAllKnownNicknamesRegex(){const e=this.getAllKnownNicknames().map((e=>qu.escapeRegexString(e))).join("|");return RegExp(`(?:\\p{P}|\\p{Z}|^)@(${e})(?![\\w@-])`,"uig")},getOccupantByJID(e){return this.occupants.findOccupant({jid:e})},getOccupantByNickname(e){return this.occupants.findOccupant({nick:e})},parseTextForReferences(e){if(!e||!/(\p{P}|\p{Z}|^)([@][\w_-]+(?:\.\w+)*)/giu.test(e))return[e,[]];const t=qu.findFirstMatchInArray(this.getAllKnownNicknames()),n=e=>{const t=this.get("jid"),n=this.getOccupant(e)||this.getOccupant(t),i=this.features.get("nonanonymous")&&(null==n?void 0:n.get("jid"))||`${t}/${e}`;return encodeURI(`xmpp:${i}`)},i=this.getAllKnownNicknamesRegex(),s=[...e.matchAll(i)].filter((e=>!e[0].startsWith("/"))),r=s.map((e=>{let i=e[0].indexOf("@");"@"===e[0][i+1]&&(i+=1);const s=e.index+i,r=s+e[0].length-i,o=t(e[1]);return{begin:s,end:r,value:o,type:"mention",uri:n(o)}})),[o,a]=qu.reduceTextFromReferences(e,r);return[o,a]},async getOutgoingMessageAttributes(e){var t;const n=this.get("composing_spoiler");let i,s="";null!==(t=e)&&void 0!==t&&t.body&&([s,i]=this.parseTextForReferences(e.body));const r=La(),o=s?Hu.httpToGeoUri(Hu.shortnamesToUnicode(s),Ya):void 0;return e=Object.assign({},e,{body:o,is_spoiler:n,origin_id:r,references:i,id:r,msgid:r,from:`${this.get("jid")}/${this.get("nick")}`,fullname:this.get("nick"),is_only_emojis:!!s&&Hu.isOnlyEmojis(s),message:o,nick:this.get("nick"),sender:"me",type:"groupchat"},_d(s)),await Wl.hook("getOutgoingMessageAttributes",this,e)},getRoomJIDAndNick(){const e=this.get("nick");return de.getBareJidFromJid(this.get("jid"))+(null!==e?`/${e}`:"")},sendChatState(){if(!Wl.settings.get("send_chat_state_notifications")||!this.get("chat_state")||!this.isEntered()||this.features.get("moderated")&&"visitor"===this.getOwnRole())return;const e=Wl.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;const t=this.get("chat_state");t!==Ya.GONE&&Wl.send(ae({to:this.get("jid"),type:"groupchat"}).c(t,{xmlns:de.NS.CHATSTATES}).up().c("no-store",{xmlns:de.NS.HINTS}).up().c("no-permanent-store",{xmlns:de.NS.HINTS}))},directInvite(e,t){this.features.get("membersonly")&&this.updateMemberLists([{jid:e,affiliation:"member",reason:t}]);const n={xmlns:"jabber:x:conference",jid:this.get("jid")};null!==t&&(n.reason=t),this.get("password")&&(n.password=this.get("password"));const i=ae({from:Ya.connection.jid,to:e,id:La()}).c("x",n);Wl.send(i),Wl.trigger("roomInviteSent",{room:this,recipient:e,reason:t})},refreshDiscoInfo(){return Wl.disco.refresh(this.get("jid")).then((()=>this.getDiscoInfo())).catch((e=>R.error(e)))},getDiscoInfo(){return Wl.disco.getIdentity("conference","text",this.get("jid")).then((e=>this.save({name:null==e?void 0:e.get("name")}))).then((()=>this.getDiscoInfoFields())).then((()=>this.getDiscoInfoFeatures())).catch((e=>R.error(e)))},async getDiscoInfoFields(){const e=(await Wl.disco.getFields(this.get("jid"))).reduce(((e,t)=>{const n=t.get("var");return null!=n&&n.startsWith("muc#roominfo_")&&(e[n.replace("muc#roominfo_","")]=t.get("value")),e}),{});this.config.save(e)},async getDiscoInfoFeatures(){const e=await Wl.disco.getFeatures(this.get("jid")),t=Object.assign(Gu(Jl.ROOM_FEATURES,Jl.ROOM_FEATURES.map((()=>!1))),{fetched:(new Date).toISOString()});e.each((e=>{const n=e.get("var");n.startsWith("muc_")?t[n.replace("muc_","")]=!0:n===de.NS.MAM?t.mam_enabled=!0:t[n]=!0})),this.features.save(t)},addFieldValue(e){const t=e.getAttribute("type");if("fixed"===t)return e;const n=e.getAttribute("var").replace("muc#roomconfig_",""),i=this.get("roomconfig");if(n in i){let s;switch(t){case"boolean":s=[i[n]?1:0];break;case"list-multi":s=i[n];break;default:s=[i[n]]}e.innerHTML=s.map((e=>oe("value").t(e))).join("")}return e},async autoConfigureChatRoom(){const e=await this.fetchRoomConfiguration(),t=Vo()("field",e).map((e=>this.addFieldValue(e)));if(t.length)return this.sendConfiguration(t)},fetchRoomConfiguration(){return Wl.sendIQ(ce({to:this.get("jid"),type:"get"}).c("query",{xmlns:de.NS.MUC_OWNER}))},sendConfiguration(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=ce({to:this.get("jid"),type:"set"}).c("query",{xmlns:de.NS.MUC_OWNER}).c("x",{xmlns:de.NS.XFORM,type:"submit"});return e.forEach((e=>t.cnode(e).up())),Wl.sendIQ(t)},onCommandError(e){const{__:t}=Ya;R.fatal(e);const n=t("Sorry, an error happened while running the command.")+" "+t("Check your browser's developer console for details.");this.createMessage({message:n,type:"error"})},getNickOrJIDFromCommandArgs(e){const{__:t}=Ya;if(Hu.isValidJID(e.trim()))return e.trim();e.startsWith("@")||(e="@"+e);const[n,i]=this.parseTextForReferences(e);if(!i.length){const e=t("Error: couldn't find a groupchat participant based on your arguments");return void this.createMessage({message:e,type:"error"})}if(i.length>1){const e=t("Error: found multiple groupchat participant based on your arguments");return void this.createMessage({message:e,type:"error"})}const s=i.pop().value,r=e.split(s,2)[1];if(!r||r.startsWith(" "))return s;{const e=t("Error: couldn't find a groupchat participant based on your arguments");this.createMessage({message:e,type:"error"})}},validateRoleOrAffiliationChangeArgs(e,t){const{__:n}=Ya;if(!t){const t=n('Error: the "%1$s" command takes two arguments, the user\'s nickname and optionally a reason.',e);return this.createMessage({message:t,type:"error"}),!1}return!0},getAllowedCommands(){let e=["clear","help","me","nick","register"];(this.config.get("changesubject")||["owner","admin"].includes(this.getOwnAffiliation()))&&(e=[...e,"subject","topic"]);const t=this.occupants.findWhere({jid:Ya.bare_jid});return this.verifyAffiliations(["owner"],t,!1)?e=e.concat(ah).concat(ch):this.verifyAffiliations(["admin"],t,!1)&&(e=e.concat(ch)),this.verifyRoles(["moderator"],t,!1)?e=e.concat(lh).concat(dh):this.verifyRoles(["visitor","participant","moderator"],t,!1)||(e=e.concat(dh)),e.sort(),Array.isArray(Wl.settings.get("muc_disable_slash_commands"))?e.filter((e=>!Wl.settings.get("muc_disable_slash_commands").includes(e))):e},verifyAffiliations(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{__:i}=Ya;if(!Array.isArray(e))throw new TypeError("affiliations must be an Array");if(!e.length)return!0;if(t=t||this.occupants.findWhere({jid:Ya.bare_jid})){const n=t.get("affiliation");if(e.includes(n))return!0}if(n){const e=i("Forbidden: you do not have the necessary affiliation in order to do that.");this.createMessage({message:e,type:"error"})}return!1},verifyRoles(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{__:i}=Ya;if(!Array.isArray(e))throw new TypeError("roles must be an Array");if(!e.length)return!0;if(t=t||this.occupants.findWhere({jid:Ya.bare_jid})){const n=t.get("role");if(e.includes(n))return!0}if(n){const e=i("Forbidden: you do not have the necessary role in order to do that.");this.createMessage({message:e,type:"error",is_ephemeral:2e4})}return!1},getOwnRole(){var e,t;return null===(e=this.getOwnOccupant())||void 0===e||null===(t=e.attributes)||void 0===t?void 0:t.role},getOwnAffiliation(){var e,t;return(null===(e=this.getOwnOccupant())||void 0===e||null===(t=e.attributes)||void 0===t?void 0:t.affiliation)||"none"},getOwnOccupant(){return this.occupants.getOwnOccupant()},async setNickname(e){if(Wl.settings.get("auto_register_muc_nickname")&&await Wl.disco.supports(de.NS.MUC_REGISTER,this.get("jid"))){const t=this.get("nick");this.set({nick:e});try{await this.registerNickname()}catch(e){const{__:n}=Ya;R.error(e);const i=n("Error: couldn't register new nickname in members only room");return this.createMessage({message:i,type:"error",is_ephemeral:!0}),void this.set({nick:t})}}const t=de.getBareJidFromJid(this.get("jid"));Wl.send(le({from:Ya.connection.jid,to:`${t}/${e}`,id:La()}).tree())},setRole(e,t,n,i,s){const r=oe("item",{nick:e.get("nick"),role:t}),o=ce({to:this.get("jid"),type:"set"}).c("query",{xmlns:de.NS.MUC_ADMIN}).cnode(r.node);return null!==n&&o.c("reason",n),Wl.sendIQ(o).then(i).catch(s)},getOccupant(e){return Hu.isValidJID(e)?this.getOccupantByJID(e):this.getOccupantByNickname(e)},getOccupantsWithRole(e){return this.getOccupantsSortedBy("nick").filter((t=>t.get("role")===e)).map((e=>({jid:e.get("jid"),nick:e.get("nick"),role:e.get("role")})))},getOccupantsWithAffiliation(e){return this.getOccupantsSortedBy("nick").filter((t=>t.get("affiliation")===e)).map((e=>({jid:e.get("jid"),nick:e.get("nick"),affiliation:e.get("affiliation")})))},getOccupantsSortedBy(e){return Array.from(this.occupants.models).sort(((t,n)=>t.get(e)<n.get(e)?-1:t.get(e)>n.get(e)?1:0))},async updateMemberLists(e){const t=this.get("jid"),n=await Promise.all(["member","admin","owner"].map((e=>nh(e,t)))),i=n.reduce(((e,t)=>Hu.isErrorObject(t)?e:[...t,...e]),[]);await sh(t,oh(!0,!1,e,i)),await this.occupants.fetchMembers()},async getAndPersistNickname(e){return(e=e||this.get("nick")||await this.getReservedNick()||Ya.getDefaultMUCNickname())&&this.save({nick:e},{silent:!0}),e},async getReservedNick(){const e=ce({to:this.get("jid"),from:Ya.connection.jid,type:"get"}).c("query",{xmlns:de.NS.DISCO_INFO,node:"x-roomuser-item"}),t=await Wl.sendIQ(e,null,!1);if(Hu.isErrorObject(t))throw t;const n=null==t?void 0:t.querySelector('query[node="x-roomuser-item"] identity');return n?n.getAttribute("name"):null},async registerNickname(){const{__:e}=Ya,t=this.get("nick"),n=this.get("jid");let i,s;try{i=await Wl.sendIQ(ce({to:n,type:"get"}).c("query",{xmlns:de.NS.MUC_REGISTER}))}catch(t){return Vo()(`not-allowed[xmlns="${de.NS.STANZAS}"]`,t).length?s=e("You're not allowed to register yourself in this groupchat."):Vo()(`registration-required[xmlns="${de.NS.STANZAS}"]`,t).length&&(s=e("You're not allowed to register in this groupchat because it's members-only.")),R.error(t),s}const r=Vo()("field required",i).map((e=>e.parentElement));if(r.length>1&&"muc#register_roomnick"!==r[0].getAttribute("var"))return R.error(`Can't register the user register in the groupchat ${n} due to the required fields`);try{await Wl.sendIQ(ce({to:n,type:"set"}).c("query",{xmlns:de.NS.MUC_REGISTER}).c("x",{xmlns:de.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t("http://jabber.org/protocol/muc#register").up().up().c("field",{var:"muc#register_roomnick"}).c("value").t(t))}catch(t){return Vo()(`service-unavailable[xmlns="${de.NS.STANZAS}"]`,t).length?s=e("Can't register your nickname in this groupchat, it doesn't support registration."):Vo()(`bad-request[xmlns="${de.NS.STANZAS}"]`,t).length&&(s=e("Can't register your nickname in this groupchat, invalid data form supplied.")),R.error(s),R.error(t),s}},async unregisterNickname(){if("unregister"===Wl.settings.get("auto_register_muc_nickname"))try{await Wl.disco.supports(de.NS.MUC_REGISTER,this.get("jid"))&&await this.sendUnregistrationIQ()}catch(e){R.error(e)}},sendUnregistrationIQ(){const e=ce({to:this.get("jid"),type:"set"}).c("query",{xmlns:de.NS.MUC_REGISTER}).c("remove");return Wl.sendIQ(e).catch((e=>R.error(e)))},updateOccupantsOnPresence(e){var t,n;const i=function(e,t){const n=e.getAttribute("from"),i=e.getAttribute("type"),s={from:n,occupant_id:Yu(e,t),nick:Wu.getResourceFromJid(n),type:i,states:[],hats:[],show:"unavailable"!==i?"online":"offline"};return Array.from(e.children).forEach((e=>{if(e.matches("status"))s.status=e.textContent||null;else if(e.matches("show"))s.show=e.textContent||"online";else if(e.matches("x")&&e.getAttribute("xmlns")===Wu.NS.MUC_USER)Array.from(e.children).forEach((e=>{"item"===e.nodeName?(s.affiliation=e.getAttribute("affiliation"),s.role=e.getAttribute("role"),s.jid=e.getAttribute("jid"),s.nick=e.getAttribute("nick")||s.nick):"status"==e.nodeName&&e.getAttribute("code")&&s.states.push(e.getAttribute("code"))}));else if(e.matches("x")&&e.getAttribute("xmlns")===Wu.NS.VCARDUPDATE){var t;s.image_hash=null===(t=e.querySelector("photo"))||void 0===t?void 0:t.textContent}else e.matches("hats")&&e.getAttribute("xmlns")===Wu.NS.MUC_HATS&&(s.hats=Array.from(e.children).map((e=>e.matches("hat")&&{title:e.getAttribute("title"),uri:e.getAttribute("uri")})))})),s}(e,this);if("error"===i.type||!i.jid&&!i.nick&&!i.occupant_id)return!0;const s=this.occupants.findOccupant(i);if("unavailable"===i.type&&s&&!i.states.includes(Jl.MUC_NICK_CHANGED_CODE)&&!["admin","owner","member"].includes(i.affiliation))return s.set(i),void s.destroy();const r=i.jid||"",o=Object.assign(i,{jid:de.getBareJidFromJid(r)||(null==s||null===(t=s.attributes)||void 0===t?void 0:t.jid),resource:de.getResourceFromJid(r)||(null==s||null===(n=s.attributes)||void 0===n?void 0:n.resource)});s?s.save(o):this.occupants.create(o)},fetchFeaturesIfConfigurationChanged(e){const t=["104","170","171","172","173","174"];Vo()("status",e).filter((e=>t.includes(e.getAttribute("status")))).length&&this.refreshDiscoInfo()},isSameUser(e,t){const n=de.getBareJidFromJid(e),i=de.getBareJidFromJid(t),s=de.getResourceFromJid(e),r=de.getResourceFromJid(t);return Hu.isSameBareJID(e,t)?n!==this.get("jid")||s===r:(n===this.get("jid")?this.occupants.findOccupant({nick:s}):this.occupants.findOccupant({jid:n}))===(i===this.get("jid")?this.occupants.findOccupant({nick:r}):this.occupants.findOccupant({jid:i}))},async isSubjectHidden(){return(await Wl.user.settings.get("mucs_with_hidden_subject",[])).includes(this.get("jid"))},async toggleSubjectHiddenState(){const e=this.get("jid"),t=await Wl.user.settings.get("mucs_with_hidden_subject",[]);t.includes(this.get("jid"))?Wl.user.settings.set("mucs_with_hidden_subject",t.filter((t=>t!==e))):Wl.user.settings.set("mucs_with_hidden_subject",[...t,e])},async handleSubjectChange(e){const t=Ya.__;if("string"==typeof e.subject&&!e.thread&&!e.message){const n=e.subject,i=e.nick;if(Hu.safeSave(this,{subject:{author:i,text:e.subject||""}}),!e.is_delayed&&i){const s=t(n?"Topic set by %1$s":"Topic cleared by %1$s",i),r=this.messages.last();(null==r?void 0:r.get("nick"))===e.nick&&"info"===(null==r?void 0:r.get("type"))&&(null==r?void 0:r.get("message"))===s||this.createMessage({message:s,nick:e.nick,type:"info",is_ephemeral:!0}),await this.isSubjectHidden()&&this.toggleSubjectHiddenState()}return!0}return!1},setSubject(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";Wl.send(ae({to:this.get("jid"),from:Ya.connection.jid,type:"groupchat"}).c("subject",{xmlns:"jabber:client"}).t(e).tree())},ignorableCSN(e){return e.chat_state&&!e.body&&(e.is_delayed||this.isOwnMessage(e))},isOwnMessage(e){let t;return t=T(e)?e.getAttribute("from"):e instanceof Ya.Message?e.get("from"):e.from,de.getResourceFromJid(t)==this.get("nick")},getUpdatedMessageAttributes(e,t){const n=Ya.ChatBox.prototype.getUpdatedMessageAttributes.call(this,e,t);if(n.from_muc=t.from_muc,this.isOwnMessage(t)){const i=Object.keys(t).filter((e=>e.startsWith("stanza_id")));Object.assign(n,Uo(t,i)),e.get("received")||(n.received=(new Date).toISOString())}return n},async isJoined(){const e=this.get("jid"),t=ce({to:`${e}/${this.get("nick")}`,type:"get"}).c("ping",{xmlns:de.NS.PING});try{await Wl.sendIQ(t)}catch(t){return null===t?R.warn(`isJoined: Timeout error while checking whether we're joined to MUC: ${e}`):R.warn(`isJoined: Apparently we're no longer connected to MUC: ${e}`),!1}return!0},async sendStatusPresence(e,t,n){if(this.session.get("connection_status")===Jl.ROOMSTATUS.ENTERED){const i=await Ya.xmppstatus.constructPresence(e,this.getRoomJIDAndNick(),t);null==n||n.map((e=>(null==e?void 0:e.tree())??e)).forEach((e=>i.cnode(e).up())),Wl.send(i)}},async rejoinIfNecessary(){if(!await this.isJoined())return this.rejoin(),!0},async shouldShowErrorMessage(e){if("Decryption"===e.error_type){if("Message key not found. The counter was repeated or the key was not filled."===e.error_message)return!1;if("not-encrypted-for-this-device"===e.error_condition)return!1}else if("not-acceptable"===e.error_condition&&await this.rejoinIfNecessary())return!1;return Ya.ChatBox.prototype.shouldShowErrorMessage.call(this,e)},findDanglingModeration(e){if(!this.messages.length)return null;if(this.messages.last().get("time")>e.time){const t=Array.from(this.messages.models),n=e[`stanza_id ${this.get("jid")}`];return n?(t.reverse(),t.find((e=>{let{attributes:t}=e;return"retracted"===t.moderated&&t.moderated_id===n&&t.moderated_by}))):null}},async handleModeration(e){const t=["editable","moderated","moderated_by","moderated_id","moderation_reason"];if("retracted"===e.moderated){const n={};n[`stanza_id ${this.get("jid")}`]=e.moderated_id;const i=this.messages.findWhere(n);return i?(i.save(Uo(e,t)),!0):(e.dangling_moderation=!0,await this.createMessage(e),!0)}{const n=this.findDanglingModeration(e);if(n){const i=Uo(n.attributes,t),s=Object.assign({dangling_moderation:!1},e,i);return delete s.id,n.save(s),!0}}return!1},getNotificationsText(){const{__:e}=Ya,t=this.notifications.toJSON(),n=Wl.settings.get("muc_show_info_messages").filter((e=>Jl.MUC_ROLE_CHANGES_LIST.includes(e))),i=Wl.settings.get("muc_show_info_messages").filter((e=>Jl.MUC_TRAFFIC_STATES_LIST.includes(e)));return[...Jl.CHAT_STATES,...i,...n].reduce(((n,i)=>{const s=t[i];if(null==s||!s.length)return n;const r=s.map((e=>{var t;return(null===(t=this.getOccupant(e))||void 0===t?void 0:t.getDisplayName())||e}));if(1===r.length){if("composing"===i)return`${n}${e("%1$s is typing",r[0])}\n`;if("paused"===i)return`${n}${e("%1$s has stopped typing",r[0])}\n`;if(i===Ya.GONE)return`${n}${e("%1$s has gone away",r[0])}\n`;if("entered"===i)return`${n}${e("%1$s has entered the groupchat",r[0])}\n`;if("exited"===i)return`${n}${e("%1$s has left the groupchat",r[0])}\n`;if("op"===i)return`${n}${e("%1$s is now a moderator",r[0])}\n`;if("deop"===i)return`${n}${e("%1$s is no longer a moderator",r[0])}\n`;if("voice"===i)return`${n}${e("%1$s has been given a voice",r[0])}\n`;if("mute"===i)return`${n}${e("%1$s has been muted",r[0])}\n`}else if(r.length>1){let t;if(r.length>3)t=`${Array.from(r).slice(0,2).join(", ")} and others`;else{const n=r.pop();t=e("%1$s and %2$s",r.join(", "),n)}if("composing"===i)return`${n}${e("%1$s are typing",t)}\n`;if("paused"===i)return`${n}${e("%1$s have stopped typing",t)}\n`;if(i===Ya.GONE)return`${n}${e("%1$s have gone away",t)}\n`;if("entered"===i)return`${n}${e("%1$s have entered the groupchat",t)}\n`;if("exited"===i)return`${n}${e("%1$s have left the groupchat",t)}\n`;if("op"===i)return`${n}${e("%1$s are now moderators",r[0])}\n`;if("deop"===i)return`${n}${e("%1$s are no longer moderators",r[0])}\n`;if("voice"===i)return`${n}${e("%1$s have been given voices",r[0])}\n`;if("mute"===i)return`${n}${e("%1$s have been muted",r[0])}\n`}return n}),"")},removeNotification(e,t){const n=this.notifications.toJSON();(t=Array.isArray(t)?t:[t]).forEach((t=>{const i=Array.from(n[t]||[]);if(i.includes(e)){const n=i.indexOf(e);i.splice(n,1),this.notifications.set(t,Array.from(i))}}))},updateNotifications(e,t){const n=this.notifications.toJSON(),i=n[t]||[];if(i.includes(e))return;const s=(s,r)=>(s[r]=r===t?[...i,e]:(n[r]||[]).filter((t=>t!==e)),s),r=Jl.CHAT_STATES.reduce(s,{}),o=Jl.MUC_TRAFFIC_STATES_LIST.reduce(s,{}),a=Jl.MUC_ROLE_CHANGES_LIST.reduce(s,{});this.notifications.set(Object.assign(r,o,a)),window.setTimeout((()=>this.removeNotification(e,t)),1e4)},handleMetadataFastening(e){if(e.ogp_for_id){if(e.from!==this.get("jid"))return!1;const t=this.messages.findWhere({origin_id:e.ogp_for_id});if(t){const n=t.get("ogp_metadata")||[];if(n.filter((t=>t["og:url"]===e["og:url"])).length)return!1;const i=[...n,Uo(e,uh)];return t.save("ogp_metadata",i),!0}}return!1},handleMEPNotification(e){var t;return!(e.from!==this.get("jid")||!e.activities||(null===(t=e.activities)||void 0===t||t.forEach((t=>{const n=Object.assign(e,t);this.createMessage(n),Wl.trigger("message",{attrs:n,chatbox:this})})),!e.activities.length))},getDuplicateMessage(e){var t;return null!==(t=e.activities)&&void 0!==t&&t.length?this.messages.findWhere({type:"mep",msgid:e.msgid}):Ya.ChatBox.prototype.getDuplicateMessage.call(this,e)},async onMessage(e){if(e=await e,Hu.isErrorObject(e))return e.stanza&&R.error(e.stanza),R.error(e.message);if("error"===e.type&&!await this.shouldShowErrorMessage(e))return;const t=this.getDuplicateMessage(e);if(t)"groupchat"===t.get("type")&&this.updateMessage(t,e);else if(!(e.receipt_id||e.is_marker||this.ignorableCSN(e)))if(this.handleMetadataFastening(e)||this.handleMEPNotification(e)||await this.handleRetraction(e)||await this.handleModeration(e)||await this.handleSubjectChange(e))e.nick&&this.removeNotification(e.nick,["composing","paused"]);else if(this.setEditable(e,e.time),e.chat_state&&this.updateNotifications(e.nick,e.chat_state),Hu.shouldCreateGroupchatMessage(e)){const t=this.handleCorrection(e)||await this.createMessage(e);this.removeNotification(e.nick,["composing","paused"]),this.handleUnreadMessage(t)}},handleModifyError(e){var t;const n=null===(t=e.querySelector("error text"))||void 0===t?void 0:t.textContent;if(n)if(this.session.get("connection_status")===Jl.ROOMSTATUS.CONNECTING)this.setDisconnectionState(n);else{const e={type:"error",message:n,is_ephemeral:!0};this.createMessage(e)}},handleDisconnection(e){var t;const n=null!==e.querySelector("status[code='110']"),i=Vo()(`x[xmlns="${de.NS.MUC_USER}"]`,e).pop();if(!i)return;const s=Object.keys(Ya.muc.disconnect_messages),r=Vo()("status",i).map((e=>e.getAttribute("code"))).filter((e=>s.includes(e)));if(!(n&&r.length>0))return;const o=i.querySelector("item"),a=o?null===(t=o.querySelector("reason"))||void 0===t?void 0:t.textContent:void 0,c=o?ic(o.querySelector("actor"),"getAttribute","nick"):void 0,l=Ya.muc.disconnect_messages[r[0]],d=r.includes("301")?Jl.ROOMSTATUS.BANNED:Jl.ROOMSTATUS.DISCONNECTED;this.setDisconnectionState(l,a,c,d)},getActionInfoMessage(e,t,n){const i=Ya.__;return"301"===e?n?i("%1$s has been banned by %2$s",t,n):i("%1$s has been banned",t):"303"===e?i("%1$s's nickname has changed",t):"307"===e?n?i("%1$s has been kicked out by %2$s",t,n):i("%1$s has been kicked out",t):"321"===e?i("%1$s has been removed because of an affiliation change",t):"322"===e?i("%1$s has been removed for not being a member",t):void 0},createAffiliationChangeMessage(e){const t=Ya.__,n=e._previousAttributes.affiliation;if(!n)return;const i=e.get("affiliation");"admin"===n&&Ya.isInfoVisible(Jl.AFFILIATION_CHANGES.EXADMIN)?this.createMessage({type:"info",message:t("%1$s is no longer an admin of this groupchat",e.get("nick"))}):"owner"===n&&Ya.isInfoVisible(Jl.AFFILIATION_CHANGES.EXOWNER)?this.createMessage({type:"info",message:t("%1$s is no longer an owner of this groupchat",e.get("nick"))}):"outcast"===n&&Ya.isInfoVisible(Jl.AFFILIATION_CHANGES.EXOUTCAST)&&this.createMessage({type:"info",message:t("%1$s is no longer banned from this groupchat",e.get("nick"))}),"none"===i&&"member"===n&&Ya.isInfoVisible(Jl.AFFILIATION_CHANGES.EXMEMBER)&&this.createMessage({type:"info",message:t("%1$s is no longer a member of this groupchat",e.get("nick"))}),"member"===i&&Ya.isInfoVisible(Jl.AFFILIATION_CHANGES.MEMBER)?this.createMessage({type:"info",message:t("%1$s is now a member of this groupchat",e.get("nick"))}):("admin"===i&&Ya.isInfoVisible(Jl.AFFILIATION_CHANGES.ADMIN)||"owner"==i&&Ya.isInfoVisible(Jl.AFFILIATION_CHANGES.OWNER))&&this.createMessage({type:"info",message:t("%1$s is now an %2$s of this groupchat",e.get("nick"),i)})},createRoleChangeMessage(e,t){if("none"===t||e.changed.affiliation)return;const n=e._previousAttributes.role;"moderator"===n&&Ya.isInfoVisible(Jl.MUC_ROLE_CHANGES.DEOP)?this.updateNotifications(e.get("nick"),Jl.MUC_ROLE_CHANGES.DEOP):"visitor"===n&&Ya.isInfoVisible(Jl.MUC_ROLE_CHANGES.VOICE)&&this.updateNotifications(e.get("nick"),Jl.MUC_ROLE_CHANGES.VOICE),"visitor"===e.get("role")&&Ya.isInfoVisible(Jl.MUC_ROLE_CHANGES.MUTE)?this.updateNotifications(e.get("nick"),Jl.MUC_ROLE_CHANGES.MUTE):"moderator"===e.get("role")&&!["owner","admin"].includes(e.get("affiliation"))&&Ya.isInfoVisible(Jl.MUC_ROLE_CHANGES.OP)&&this.updateNotifications(e.get("nick"),Jl.MUC_ROLE_CHANGES.OP)},createInfoMessage(e,t,n){const i=Ya.__,s={type:"info",is_ephemeral:!0};if(Ya.isInfoVisible(e)&&"110"!==e&&("100"!==e||n)){if(e in Ya.muc.info_messages)s.message=Ya.muc.info_messages[e];else if(!n&&hh.includes(e)){var r,o;const n=de.getResourceFromJid(t.getAttribute("from")),i=Vo()(`x[xmlns="${de.NS.MUC_USER}"] item`,t).pop();s.actor=i?null===(r=i.querySelector("actor"))||void 0===r?void 0:r.getAttribute("nick"):void 0,s.reason=i?null===(o=i.querySelector("reason"))||void 0===o?void 0:o.textContent:void 0,s.message=this.getActionInfoMessage(e,n,s.actor)}else if(n&&e in Ya.muc.new_nickname_messages){let r;n&&"210"===e?r=de.getResourceFromJid(t.getAttribute("from")):n&&"303"===e&&(r=Vo()(`x[xmlns="${de.NS.MUC_USER}"] item`,t).pop().getAttribute("nick")),this.save("nick",r),s.message=i(Ya.muc.new_nickname_messages[e],r)}if(s.message){if("201"===e&&this.messages.findWhere(s))return;this.createMessage(s)}}},createInfoMessages(e){const t=Vo()(`x[xmlns="${de.NS.MUC_USER}"] status`,e).map((e=>e.getAttribute("code")));t.includes("333")&&t.includes("307")&&t.splice(t.indexOf("307"),1);const n=t.includes("110");t.forEach((t=>this.createInfoMessage(t,e,n)))},setDisconnectionState(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Jl.ROOMSTATUS.DISCONNECTED;this.session.save({connection_status:i,disconnection_actor:n,disconnection_message:e,disconnection_reason:t})},onNicknameClash(e){const t=Ya.__;if(Wl.settings.get("muc_nickname_from_jid")){const t=e.getAttribute("from").split("/")[1];if(t===Ya.getDefaultMUCNickname())this.join(t+"-2");else{const e=t.lastIndexOf("-"),n=t.substring(e+1,t.length);this.join(t.substring(0,e+1)+String(Number(n)+1))}}else this.save({nickname_validation_message:t("The nickname you chose is reserved or currently in use, please choose a different one.")}),this.session.save({connection_status:Jl.ROOMSTATUS.NICKNAME_REQUIRED})},onErrorPresence(e){var t;const n=Ya.__,i=e.querySelector("error"),s=i.getAttribute("type"),r=null===(t=Vo()(`text[xmlns="${de.NS.STANZAS}"]`,i).pop())||void 0===t?void 0:t.textContent;if("modify"===s)this.handleModifyError(e);else if("auth"===s)if(Vo()(`not-authorized[xmlns="${de.NS.STANZAS}"]`,i).length&&(this.save({password_validation_message:r||n("Password incorrect")}),this.session.save({connection_status:Jl.ROOMSTATUS.PASSWORD_REQUIRED})),i.querySelector("registration-required")){const e=n("You are not on the member list of this groupchat.");this.setDisconnectionState(e,r)}else i.querySelector("forbidden")&&this.setDisconnectionState(Ya.muc.disconnect_messages[301],r,null,Jl.ROOMSTATUS.BANNED);else if("cancel"===s)if(i.querySelector("not-allowed")){const e=n("You are not allowed to create new groupchats.");this.setDisconnectionState(e,r)}else if(i.querySelector("not-acceptable")){const e=n("Your nickname doesn't conform to this groupchat's policies.");this.setDisconnectionState(e,r)}else if(Vo()(`gone[xmlns="${de.NS.STANZAS}"]`,i).length){var o;const e=null===(o=Vo()(`gone[xmlns="${de.NS.STANZAS}"]`,i).pop())||void 0===o?void 0:o.textContent.replace(/^xmpp:/,"").replace(/\?join$/,"");this.save({moved_jid:e,destroyed_reason:r}),this.session.save({connection_status:Jl.ROOMSTATUS.DESTROYED})}else if(i.querySelector("conflict"))this.onNicknameClash(e);else if(i.querySelector("item-not-found")){const e=n("This groupchat does not (yet) exist.");this.setDisconnectionState(e,r)}else if(i.querySelector("service-unavailable")){const e=n("This groupchat has reached its maximum number of participants.");this.setDisconnectionState(e,r)}else if(i.querySelector("remote-server-not-found")){const e=n("Remote server not found");this.setDisconnectionState(e,r)}else if(i.querySelector("forbidden")){const e=n("You're not allowed to enter this groupchat");this.setDisconnectionState(e,r)}else{const e=n("An error happened while trying to enter this groupchat");this.setDisconnectionState(e,r)}},onPresenceFromMUCHost(e){if("error"===e.getAttribute("type")){const t=e.querySelector("error");"wait"===(null==t?void 0:t.getAttribute("type"))&&null!=t&&t.querySelector("resource-constraint")&&this.session.get("connection_status")===Jl.ROOMSTATUS.DISCONNECTED&&this.rejoin()}},onPresence(e){if("error"===e.getAttribute("type"))return this.onErrorPresence(e);this.createInfoMessages(e),e.querySelector("status[code='110']")?(this.onOwnPresence(e),"none"!==this.getOwnRole()&&this.session.get("connection_status")===Jl.ROOMSTATUS.CONNECTING&&this.session.save("connection_status",Jl.ROOMSTATUS.CONNECTED)):this.updateOccupantsOnPresence(e)},async onOwnPresence(e){await this.occupants.fetched;const t=this.session.get("connection_status");if("unavailable"!==e.getAttribute("type")&&t!==Jl.ROOMSTATUS.ENTERED&&t!==Jl.ROOMSTATUS.CLOSING?(this.session.save("connection_status",Jl.ROOMSTATUS.ENTERED,{silent:!0}),this.updateOccupantsOnPresence(e),this.session.trigger("change:connection_status",this.session,t)):this.updateOccupantsOnPresence(e),"unavailable"!==e.getAttribute("type"))if(e.querySelector("status[code='201']"))if(this.get("auto_configure"))this.autoConfigureChatRoom().then((()=>this.refreshDiscoInfo()));else{if(!Wl.settings.get("muc_instant_rooms"))return void this.session.save({view:Jl.MUC.VIEWS.CONFIG});this.sendConfiguration().then((()=>this.refreshDiscoInfo()))}else this.features.get("fetched")||("owner"===this.getOwnAffiliation()&&this.get("auto_configure")?this.autoConfigureChatRoom().then((()=>this.refreshDiscoInfo())):this.getDiscoInfo());else this.handleDisconnection(e)},isUserMentioned(e){const t=this.get("nick");return e.get("references").length?e.get("references").filter((e=>"mention"===e.type)).map((e=>e.value)).includes(t):new RegExp(`\\b${t}\\b`).test(e.get("body"))},incrementUnreadMsgsCounter(e){const t={num_unread_general:this.get("num_unread_general")+1};0===this.get("num_unread_general")&&(t.first_unread_id=e.get("id")),this.isUserMentioned(e)&&(t.num_unread=this.get("num_unread")+1),this.save(t)},clearUnreadMsgCounter(){(this.get("num_unread_general")>0||this.get("num_unread")>0||this.get("has_activity"))&&this.sendMarkerForMessage(this.messages.last()),Hu.safeSave(this,{has_activity:!1,num_unread:0,num_unread_general:0})}},gh=fh,ph=fa.extend({defaults:{hats:[],show:"offline",states:[]},initialize(e){this.set(Object.assign({id:Hu.getUniqueId()},e)),this.on("change:image_hash",this.onAvatarChanged,this)},onAvatarChanged(){const e=this.get("image_hash"),t=[];this.get("jid")&&t.push(Ya.vcards.findWhere({jid:this.get("jid")})),t.push(Ya.vcards.findWhere({jid:this.get("from")})),t.filter((e=>e)).forEach((t=>{e&&t.get("image_hash")!==e&&Wl.vcard.update(t,!0)}))},getDisplayName(){return this.get("nick")||this.get("jid")},isMember(){return["admin","owner","member"].includes(this.get("affiliation"))},isModerator(){return["admin","owner"].includes(this.get("affiliation"))||"moderator"===this.get("role")},isSelf(){return this.get("states").includes("110")}}),vh=ph,yh={moderator:1,participant:2,visitor:3,none:2},_h=Rc.extend({model:vh,comparator(e,t){const n=e.get("role")||"none",i=t.get("role")||"none";if(yh[n]===yh[i]){const n=e.getDisplayName().toLowerCase(),i=t.getDisplayName().toLowerCase();return n<i?-1:n>i?1:0}return yh[n]<yh[i]?-1:1},getOwnOccupant(){return this.findWhere({jid:Ya.bare_jid})},getAutoFetchedAffiliationLists(){const e=Wl.settings.get("muc_fetch_members");return Array.isArray(e)?e:e?["member","admin","owner"]:[]},async fetchMembers(){var e;if(!["member","admin","owner"].includes(null===(e=this.getOwnOccupant())||void 0===e?void 0:e.get("affiliation")))return;const t=this.getAutoFetchedAffiliationLists();if(0===t.length)return;const n=this.chatroom.get("jid"),i=await Promise.all(t.map((e=>nh(e,n)))),s=i.reduce(((e,t)=>Hu.isErrorObject(t)?e:[...t,...e]),[]),r=t.filter((e=>!Hu.isErrorObject(i[t.indexOf(e)]))),o=s.map((e=>e.jid)).filter((e=>void 0!==e)),a=s.map((e=>!e.jid&&e.nick||void 0)).filter((e=>void 0!==e)),c=this.filter((e=>r.includes(e.get("affiliation"))&&!a.includes(e.get("nick"))&&!o.includes(e.get("jid"))));c.forEach((e=>{e.get("jid")!==Ya.bare_jid&&("offline"===e.get("show")?e.destroy():e.save("affiliation",null))})),s.forEach((e=>{const t=this.findOccupant(e);t?t.save(e):this.create(e)})),Wl.trigger("membersFetched")},findOccupant(e){const t=e.jid&&de.getBareJidFromJid(e.jid);return t&&this.findWhere({jid:t})||e.occupant_id&&this.findWhere({occupant_id:e.occupant_id})||e.nick&&this.findWhere({nick:e.nick})}}),bh=_h,wh={affiliations:{set:(e,t)=>(t=Array.isArray(t)?t:[t],sh(e=Array.isArray(e)?e:[e],t))}},Sh={rooms:{create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t="string"==typeof t?{nick:t}:t||{},!t.nick&&Wl.settings.get("muc_nickname_from_jid")&&(t.nick=de.getNodeFromJid(Ya.bare_jid)),void 0===e)throw new TypeError("rooms.create: You need to provide at least one JID");return"string"==typeof e?Wl.rooms.get(Hu.getJIDFromURI(e),t,!0):e.map((e=>Wl.rooms.get(Hu.getJIDFromURI(e),t,!0)))},async open(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(await Wl.waitUntil("chatBoxesFetched"),void 0===e){const e="rooms.open: You need to provide at least one JID";throw R.error(e),new TypeError(e)}if("string"==typeof e){const i=await Wl.rooms.get(e,t,!0);return!t.hidden&&(null==i||i.maybeShow(n)),i}{const i=await Promise.all(e.map((e=>Wl.rooms.get(e,t,!0))));return i.forEach((e=>!t.hidden&&e.maybeShow(n))),i}},async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];async function i(e){e=Hu.getJIDFromURI(e);let i=await Wl.chatboxes.get(e);return!i&&n?i=await Wl.chatboxes.create(e,t,Ya.ChatRoom):(i=i&&i.get("type")===Ya.CHATROOMS_TYPE?i:null,i&&Object.keys(t).length&&i.save(t)),i}return await Wl.waitUntil("chatBoxesFetched"),void 0===e?(await Wl.chatboxes.get()).filter((e=>e.get("type")===Ya.CHATROOMS_TYPE)):"string"==typeof e?i(e):Promise.all(e.map((e=>i(e))))}}},{Strophe:xh,sizzle:Eh,u:Ah}=Jl.env;function Ch(e){let t=Wl.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Ph:[]),"moderator"===e.get("role")?Ph.filter((e=>!t.includes(e))):[]}function Th(){Ya.connection.addHandler((e=>(Ya.onDirectMUCInvitation(e),!0)),"jabber:x:conference","message")}function kh(){return Ya.chatboxes.filter((e=>e.get("type")===Ya.CHATROOMS_TYPE)).forEach((e=>e.session.save({connection_status:Jl.ROOMSTATUS.DISCONNECTED})))}async function jh(e){"visible"===e.state&&Wl.connection.connected()&&(await Wl.rooms.get()).forEach((e=>e.rejoinIfNecessary()))}async function $h(e){if(!Ah.isValidMUCJID(e))return R.warn(`invalid jid "${e}" provided in url fragment`);await Wl.waitUntil("roomsAutoJoined"),Wl.settings.get("allow_bookmarks")&&await Wl.waitUntil("bookmarksInitialized"),Wl.rooms.open(e)}async function Nh(e){const{__:t}=Ya,n=Eh('x[xmlns="jabber:x:conference"]',e).pop(),i=xh.getBareJidFromJid(e.getAttribute("from")),s=n.getAttribute("jid"),r=n.getAttribute("reason");let o;if(Wl.settings.get("auto_join_on_invite"))o=!0;else{let e=Ya.roster.get(i);e=e?e.getDisplayName():i,o=r?confirm(t('%1$s has invited you to join a groupchat: %2$s, and left the following reason: "%3$s"',e,s,r)):confirm(t("%1$s has invited you to join a groupchat: %2$s",e,s))}!0===o&&(await async function(e,t){t.type=Ya.CHATROOMS_TYPE,t.id=e;const n=await Wl.rooms.get(e,t,!0);return n.maybeShow(!0),n}(s,{password:n.getAttribute("password")})).session.get("connection_status")===Jl.ROOMSTATUS.DISCONNECTED&&Ya.chatboxes.get(s).rejoin()}function Oh(){if(!Ya.xmppstatus)throw new Error("Can't call _converse.getDefaultMUCNickname before the statusInitialized has been fired.");return Ya.xmppstatus.getNickname()||(Wl.settings.get("muc_nickname_from_jid")?xh.unescapeNode(xh.getNodeFromJid(Ya.bare_jid)):void 0)}function Ih(e){return!!Wl.settings.get("muc_show_info_messages").includes(e)}async function Mh(){await Promise.all(Wl.settings.get("auto_join_rooms").map((e=>"string"==typeof e?Ya.chatboxes.where({jid:e}).length?Promise.resolve():Wl.rooms.open(e):ye(e)?Wl.rooms.open(e.jid,{...e}):(R.error('Invalid muc criteria specified for "auto_join_rooms"'),Promise.resolve())))),Wl.trigger("roomsAutoJoined")}function Rh(){Wl.settings.get("allow_muc")&&Wl.disco.own.features.add(xh.NS.MUC),Wl.settings.get("allow_muc_invitations")&&Wl.disco.own.features.add("jabber:x:conference")}function Dh(){Ya.chatboxes.where({type:Ya.CHATROOMS_TYPE}).forEach((e=>Da(e.session,{connection_status:Jl.ROOMSTATUS.DISCONNECTED})))}function Lh(){window.addEventListener(Ya.unloadevent,(()=>{!Wl.connection.isType("websocket")||Wl.settings.get("enable_smacks")&&Ya.session.get("smacks_stream_id")||kh()}))}function zh(){Ya.connection.addHandler((e=>{const t=xh.getBareJidFromJid(e.getAttribute("from"));return Ya.chatboxes.get(t)||Wl.waitUntil("chatBoxesFetched").then((async()=>{const n=Ya.chatboxes.get(t);n&&(await n.initialized,n.message_handler.run(e))})),!0}),null,"message","groupchat")}Object.assign(Ya,{getAssignableRoles:Ch});const Ph=["moderator","participant","visitor"],Fh=["owner","admin","member","outcast","none"];Jl.AFFILIATION_CHANGES={OWNER:"owner",ADMIN:"admin",MEMBER:"member",EXADMIN:"exadmin",EXOWNER:"exowner",EXOUTCAST:"exoutcast",EXMEMBER:"exmember"},Jl.AFFILIATION_CHANGES_LIST=Object.values(Jl.AFFILIATION_CHANGES),Jl.MUC_TRAFFIC_STATES={ENTERED:"entered",EXITED:"exited"},Jl.MUC_TRAFFIC_STATES_LIST=Object.values(Jl.MUC_TRAFFIC_STATES),Jl.MUC_ROLE_CHANGES={OP:"op",DEOP:"deop",VOICE:"voice",MUTE:"mute"},Jl.MUC_ROLE_CHANGES_LIST=Object.values(Jl.MUC_ROLE_CHANGES),Jl.MUC={},Jl.MUC.INFO_CODES={visibility_changes:["100","102","103","172","173","174"],self:["110"],non_privacy_changes:["104","201"],muc_logging_changes:["170","171"],nickname_changes:["210","303"],disconnected:["301","307","321","322","332","333"],affiliation_changes:[...Jl.AFFILIATION_CHANGES_LIST],join_leave_events:[...Jl.MUC_TRAFFIC_STATES_LIST],role_changes:[...Jl.MUC_ROLE_CHANGES_LIST]};const{Strophe:Uh}=Jl.env;Uh.addNamespace("MUC_ADMIN",Uh.NS.MUC+"#admin"),Uh.addNamespace("MUC_OWNER",Uh.NS.MUC+"#owner"),Uh.addNamespace("MUC_REGISTER","jabber:iq:register"),Uh.addNamespace("MUC_ROOMCONF",Uh.NS.MUC+"#roomconfig"),Uh.addNamespace("MUC_USER",Uh.NS.MUC+"#user"),Uh.addNamespace("MUC_HATS","xmpp:prosody.im/protocol/hats:1"),Uh.addNamespace("CONFINFO","urn:ietf:params:xml:ns:conference-info"),Jl.MUC_NICK_CHANGED_CODE="303",Jl.ROOM_FEATURES=["passwordprotected","unsecured","hidden","publicroom","membersonly","open","persistent","temporary","nonanonymous","semianonymous","moderated","unmoderated","mam_enabled"],Jl.ROOMSTATUS={CONNECTED:0,CONNECTING:1,NICKNAME_REQUIRED:2,PASSWORD_REQUIRED:3,DISCONNECTED:4,ENTERED:5,DESTROYED:6,BANNED:7,CLOSING:8},Jl.plugins.add("converse-muc",{dependencies:["converse-chatboxes","converse-chat","converse-disco"],overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e&&e.type==n.CHATROOMS_TYPE?new n.ChatRoom(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){const{__:e,___:t}=Ya;if(Wl.settings.extend({allow_muc:!0,allow_muc_invitations:!0,auto_join_on_invite:!1,auto_join_rooms:[],auto_register_muc_nickname:!1,hide_muc_participants:!1,locked_muc_domain:!1,modtools_disable_assign:!1,muc_clear_messages_on_leave:!0,muc_domain:void 0,muc_fetch_members:!0,muc_history_max_stanzas:void 0,muc_instant_rooms:!0,muc_nickname_from_jid:!1,muc_send_probes:!1,muc_show_info_messages:[...Jl.MUC.INFO_CODES.visibility_changes,...Jl.MUC.INFO_CODES.self,...Jl.MUC.INFO_CODES.non_privacy_changes,...Jl.MUC.INFO_CODES.muc_logging_changes,...Jl.MUC.INFO_CODES.nickname_changes,...Jl.MUC.INFO_CODES.disconnected,...Jl.MUC.INFO_CODES.affiliation_changes,...Jl.MUC.INFO_CODES.join_leave_events,...Jl.MUC.INFO_CODES.role_changes],muc_show_logs_before_join:!1,muc_subscribe_to_rai:!1}),Wl.promises.add(["roomsAutoJoined"]),Wl.settings.get("locked_muc_domain")&&"string"!=typeof Wl.settings.get("muc_domain"))throw new Error("Config Error: it makes no sense to set locked_muc_domain to true when muc_domain is not set");Jl.env.muc_utils={computeAffiliationsDelta:oh},Object.assign(Wl,Sh),Object.assign(Wl.rooms,wh),Ya.muc={info_messages:{100:e("This groupchat is not anonymous"),102:e("This groupchat now shows unavailable members"),103:e("This groupchat does not show unavailable members"),104:e("The groupchat configuration has changed"),170:e("Groupchat logging is now enabled"),171:e("Groupchat logging is now disabled"),172:e("This groupchat is now no longer anonymous"),173:e("This groupchat is now semi-anonymous"),174:e("This groupchat is now fully-anonymous"),201:e("A new groupchat has been created")},new_nickname_messages:{210:t("Your nickname has been automatically set to %1$s"),303:t("Your nickname has been changed to %1$s")},disconnect_messages:{301:e("You have been banned from this groupchat"),333:e("You have exited this groupchat due to a technical problem"),307:e("You have been kicked from this groupchat"),321:e("You have been removed from this groupchat because of an affiliation change"),322:e("You have been removed from this groupchat because the groupchat has changed to members-only and you're not a member"),332:e("You have been removed from this groupchat because the service hosting it is being shut down")}},Ya.router.route("converse/room?jid=:jid",$h),Ya.ChatRoom=Ya.ChatBox.extend(gh),Ya.ChatRoomMessage=Ya.Message.extend(Pu),Ya.ChatRoomOccupants=bh,Ya.ChatRoomOccupant=vh,Ya.ChatRoomMessages=Rc.extend({model:Ya.ChatRoomMessage,comparator:"time"}),Object.assign(Ya,{getDefaultMUCNickname:Oh,isInfoVisible:Ih,onDirectMUCInvitation:Nh}),Wl.settings.get("allow_muc_invitations")&&(Wl.listen.on("connected",Th),Wl.listen.on("reconnected",Th)),Wl.listen.on("addClientFeatures",(()=>Wl.disco.own.features.add(`${Uh.NS.CONFINFO}+notify`))),Wl.listen.on("addClientFeatures",Rh),Wl.listen.on("beforeResourceBinding",zh),Wl.listen.on("beforeTearDown",Dh),Wl.listen.on("chatBoxesFetched",Mh),Wl.listen.on("disconnected",kh),Wl.listen.on("statusInitialized",Lh),Wl.listen.on("windowStateChanged",jh)}});const{Strophe:Bh}=Jl.env,qh=fa.extend({idAttribute:"jid",getDisplayName(){return Bh.xmlunescape(this.get("name"))}}),{Strophe:Hh,$iq:Gh,sizzle:Wh}=Jl.env,Vh={model:qh,comparator:e=>e.get("name").toLowerCase(),initialize(){this.on("add",(e=>this.openBookmarkedRoom(e).then((e=>this.markRoomAsBookmarked(e))).catch((e=>R.fatal(e))))),this.on("remove",this.markRoomAsUnbookmarked,this),this.on("remove",this.sendBookmarkStanza,this);const e=`converse.room-bookmarks${Ya.bare_jid}`;this.fetched_flag=e+"fetched",Oo(this,e)},openBookmarkedRoom:async e=>(Wl.settings.get("muc_respect_autojoin")&&e.get("autojoin")&&(await Wl.rooms.create(e.get("jid"),{nick:e.get("nick")})).maybeShow(),e),fetchBookmarks(){const e=fo();return window.sessionStorage.getItem(this.fetched_flag)?this.fetch({success:()=>e.resolve(),error:()=>e.resolve()}):this.fetchBookmarksFromServer(e),e},createBookmark(e){this.create(e),this.sendBookmarkStanza().catch((t=>this.onBookmarkError(t,e)))},sendBookmarkStanza(){const e=Gh({type:"set",from:Ya.connection.jid}).c("pubsub",{xmlns:Hh.NS.PUBSUB}).c("publish",{node:Hh.NS.BOOKMARKS}).c("item",{id:"current"}).c("storage",{xmlns:Hh.NS.BOOKMARKS});return this.forEach((t=>{e.c("conference",{name:t.get("name"),autojoin:t.get("autojoin"),jid:t.get("jid")}).c("nick").t(t.get("nick")).up().up()})),e.up().up().up(),e.c("publish-options").c("x",{xmlns:Hh.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t("http://jabber.org/protocol/pubsub#publish-options").up().up().c("field",{var:"pubsub#persist_items"}).c("value").t("true").up().up().c("field",{var:"pubsub#access_model"}).c("value").t("whitelist"),Wl.sendIQ(e)},onBookmarkError(e,t){const{__:n}=Ya;R.error("Error while trying to add bookmark"),R.error(e),Wl.alert("error",n("Error"),[n("Sorry, something went wrong while trying to save your bookmark.")]),this.findWhere({jid:t.jid}).destroy()},fetchBookmarksFromServer(e){const t=Gh({from:Ya.connection.jid,type:"get"}).c("pubsub",{xmlns:Hh.NS.PUBSUB}).c("items",{node:Hh.NS.BOOKMARKS});Wl.sendIQ(t).then((t=>this.onBookmarksReceived(e,t))).catch((t=>this.onBookmarksReceivedError(e,t)))},markRoomAsBookmarked(e){const t=Ya.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!0)},markRoomAsUnbookmarked(e){const t=Ya.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!1)},createBookmarksFromStanza(e){const t=Hh.NS.BOOKMARKS;Wh(`items[node="${t}"] item storage[xmlns="${t}"] conference`,e).forEach((e=>{var t;const n=e.getAttribute("jid"),i=this.get(n),s={jid:n,name:e.getAttribute("name")||n,autojoin:"true"===e.getAttribute("autojoin"),nick:(null===(t=e.querySelector("nick"))||void 0===t?void 0:t.textContent)||""};i?i.save(s):this.create(s)}))},onBookmarksReceived(e,t){if(this.createBookmarksFromStanza(t),window.sessionStorage.setItem(this.fetched_flag,!0),void 0!==e)return e.resolve()},onBookmarksReceivedError(e,t){const{__:n}=Ya;if(null===t)R.error("Error: timeout while fetching bookmarks"),Wl.alert("error",n("Timeout Error"),[n("The server did not return your bookmarks within the allowed time. You can reload the page to request them again.")]);else{if(e)return t.querySelector('error[type="cancel"] item-not-found')?(window.sessionStorage.setItem(this.fetched_flag,!0),e.resolve()):(R.error("Error while fetching bookmarks"),R.error(t),e.reject(new Error("Could not fetch bookmarks")));R.error("Error while fetching bookmarks"),R.error(t)}},getUnopenedBookmarks(){return this.filter((e=>!Ya.chatboxes.get(e.get("jid"))))}},Jh=Vh,{Strophe:Qh}=Jl.env;async function Zh(){const e=await Wl.disco.getIdentity("pubsub","pep",Ya.bare_jid);return Wl.settings.get("allow_public_bookmarks")?!!e:Wl.disco.supports(Qh.NS.PUBSUB+"#publish-options",Ya.bare_jid)}const{Strophe:Yh,sizzle:Xh}=Jl.env;function Kh(e){return Xh(`event[xmlns="${Yh.NS.PUBSUB}#event"] items[node="${Yh.NS.BOOKMARKS}"]`,e).length&&Wl.waitUntil("bookmarksInitialized").then((()=>Ya.bookmarks.createBookmarksFromStanza(e))).catch((e=>R.fatal(e))),!0}Yh.addNamespace("BOOKMARKS","storage:bookmarks"),Jl.plugins.add("converse-bookmarks",{dependencies:["converse-chatboxes","converse-muc"],overrides:{ChatRoom:{getDisplayName(){const{_converse:e}=this.__super__;if(this.get("bookmarked")&&e.bookmarks){const t=e.bookmarks.findWhere({jid:this.get("jid")});if(t)return t.get("name")}return this.__super__.getDisplayName.apply(this,arguments)},getAndPersistNickname(e){return e=e||function(e){if(!Ya.bookmarks||!Wl.settings.get("allow_bookmarks"))return null;const t=Ya.bookmarks.findWhere({jid:e});return t?t.get("nick"):void 0}(this.get("jid")),this.__super__.getAndPersistNickname.call(this,e)}}},initialize(){Wl.settings.extend({allow_bookmarks:!0,allow_public_bookmarks:!1,muc_respect_autojoin:!0}),Wl.promises.add("bookmarksInitialized"),Ya.Bookmark=qh,Ya.Bookmarks=Rc.extend(Jh),Ya.BookmarksList=fa.extend({defaults:{"toggle-state":Ya.OPENED}}),Wl.listen.on("addClientFeatures",(()=>{Wl.settings.get("allow_bookmarks")&&Wl.disco.own.features.add(Yh.NS.BOOKMARKS+"+notify")})),Wl.listen.on("clearSession",(()=>{void 0!==Ya.bookmarks&&(Ya.bookmarks.clearStore({silent:!0}),window.sessionStorage.removeItem(Ya.bookmarks.fetched_flag),delete Ya.bookmarks)})),Wl.listen.on("connected",(async()=>{const{connection:e}=Ya;e.addHandler(Kh,null,"message","headline",null,Ya.bare_jid),await Promise.all([Wl.waitUntil("chatBoxesFetched")]),async function(){Wl.settings.get("allow_bookmarks")&&await Zh()&&(Ya.bookmarks=new Ya.Bookmarks,await Ya.bookmarks.fetchBookmarks(),Wl.trigger("bookmarksInitialized"))}()}))}});const{Strophe:em}=Jl.env,tm="converse.bosh-session";Jl.plugins.add("converse-bosh",{enabled:()=>!Ya.api.settings.get("blacklisted_plugins").includes("converse-bosh"),initialize(){Wl.settings.extend({bosh_service_url:void 0,prebind_url:null}),Ya.startNewPreboundBOSHSession=function(){if(!Wl.settings.get("prebind_url"))throw new Error("startNewPreboundBOSHSession: If you use prebind then you MUST supply a prebind_url");const e=new XMLHttpRequest;e.open("GET",Wl.settings.get("prebind_url"),!0),e.setRequestHeader("Accept","application/json, text/javascript"),e.onload=async function(){if(e.status>=200&&e.status<400){const t=JSON.parse(e.responseText),n=await xa(t.jid);Ya.connection.attach(n,t.sid,t.rid,Ya.connection.onConnectStatusChanged,59)}else e.onerror()},e.onerror=function(){delete Ya.connection,Wl.trigger("noResumeableBOSHSession",Ya)},e.send()},Ya.restoreBOSHSession=async function(){const e=(await async function(){const e=tm;if(Ya.bosh_session||(Ya.bosh_session=new fa({id:e}),Ya.bosh_session.browserStorage=Ya.createStore(e,"session"),await new Promise((e=>Ya.bosh_session.fetch({success:e,error:e})))),Ya.jid){if(Ya.bosh_session.get("jid")!==Ya.jid){const e=await xa(Ya.jid);Ya.bosh_session.clear({silent:!0}),Ya.bosh_session.save({jid:e})}}else{const e=Ya.bosh_session.get("jid");e&&await xa(e)}return Ya.bosh_session}()).get("jid");if(e&&Ya.connection._proto instanceof em.Bosh)try{return Ya.connection.restore(e,Ya.connection.onConnectStatusChanged),!0}catch(t){return!Ya.isTestEnv()&&R.warn("Could not restore session for jid: "+e+" Error message: "+t.message),!1}return!1},Wl.listen.on("clearSession",(()=>{if(void 0===Ya.bosh_session){const e=tm;sessionStorage.removeItem(e),sessionStorage.removeItem(`${e}-${e}`)}else Ya.bosh_session.destroy(),delete Ya.bosh_session})),Wl.listen.on("setUserJID",(()=>{void 0!==Ya.bosh_session&&Ya.bosh_session.save({jid:Ya.jid})})),Wl.listen.on("addClientFeatures",(()=>Wl.disco.own.features.add(em.NS.BOSH))),Object.assign(Wl,{tokens:{get:e=>void 0===Ya.connection?null:"rid"===e.toLowerCase()?Ya.connection.rid||Ya.connection._proto.rid:"sid"===e.toLowerCase()?Ya.connection.sid||Ya.connection._proto.sid:void 0}})}});const{Strophe:nm,$build:im}=Jl.env;function sm(e,t){return e.sort(((e,n)=>e[t]>n[t]?-1:1))}function rm(){const e=Ya.api.disco.own.identities.get(),t=Ya.api.disco.own.features.get();e.length>1&&(sm(e,"category"),sm(e,"type"),sm(e,"lang"));let n=e.reduce(((e,t)=>`${e}${t.category}/${t.type}/${(null==t?void 0:t.lang)??""}/${t.name}<`),"");return t.sort(),n=t.reduce(((e,t)=>`${e}${t}<`),n),se.b64_sha1(n)}function om(){return im("c",{xmlns:nm.NS.CAPS,hash:"sha-1",node:"https://conversejs.org",ver:rm()}).nodeTree}const{Strophe:am}=Jl.env;function cm(e){var t,n;if(e&&(null===(n=Ya.session)||void 0===n||n.set({carbons_enabled:!1})),!Wl.settings.get("message_carbons")||null!==(t=Ya.session)&&void 0!==t&&t.get("carbons_enabled"))return;const i=new de.Builder("iq",{from:Ya.connection.jid,id:"enablecarbons",type:"set"}).c("enable",{xmlns:de.NS.CARBONS});Ya.connection.addHandler((e=>{e.querySelectorAll("error").length>0?R.warn("An error occurred while trying to enable message carbons."):(Ya.session.set({carbons_enabled:!0}),R.debug("Message carbons have been enabled.")),Ya.session.save()}),null,"iq",null,"enablecarbons"),Ya.connection.send(i)}am.addNamespace("CAPS","http://jabber.org/protocol/caps"),Jl.plugins.add("converse-caps",{dependencies:["converse-status"],initialize(){Wl.listen.on("constructedPresence",((e,t)=>t.root().cnode(om()).up()&&t)),Wl.listen.on("constructedMUCPresence",((e,t)=>t.root().cnode(om()).up()&&t))}}),Jl.plugins.add("converse-carbons",{initialize(){Wl.settings.extend({message_carbons:!0}),Wl.listen.on("afterResourceBinding",cm)}});const lm=Rc.extend({comparator:"time_opened",model:(e,t)=>new Ya.ChatBox(e,t),onChatBoxesFetched(e){e.filter((e=>!e.isValid())).forEach((e=>e.destroy())),Wl.trigger("chatBoxesFetched")},onConnected(e){e||(Oo(this,`converse.chatboxes-${Ya.bare_jid}`),this.fetch({add:!0,success:e=>this.onChatBoxesFetched(e)}))}}),dm=lm,{Strophe:um}=Jl.env;async function hm(e,t,n){let i;e=um.getBareJidFromJid(e.toLowerCase()),Object.assign(t,{jid:e,id:e});try{i=new n(t,{collection:Ya.chatboxes})}catch(e){return R.error(e),null}return await i.initialized,i.isValid()?(Ya.chatboxes.add(i),i):(i.destroy(),null)}const mm={async create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return await Wl.waitUntil("chatBoxesFetched"),"string"==typeof e?hm(e,t,n):Promise.all(e.map((e=>hm(e,t,n))))},get:async e=>(await Wl.waitUntil("chatBoxesFetched"),void 0===e?Ya.chatboxes.models:"string"==typeof e?Ya.chatboxes.get(e.toLowerCase()):(e=e.map((e=>e.toLowerCase())),Ya.chatboxes.models.filter((t=>e.includes(t.get("jid"))))))},{Strophe:fm}=Jl.env;Jl.plugins.add("converse-chatboxes",{dependencies:["converse-emoji","converse-roster","converse-vcard"],initialize(){Wl.promises.add(["chatBoxesFetched","chatBoxesInitialized","privateChatsAutoJoined"]),Object.assign(Wl,{chatboxes:mm}),Ya.ChatBoxes=dm,Wl.listen.on("addClientFeatures",(()=>{Wl.disco.own.features.add(fm.NS.MESSAGE_CORRECT),Wl.disco.own.features.add(fm.NS.HTTPUPLOAD),Wl.disco.own.features.add(fm.NS.OUTOFBAND)})),Wl.listen.on("pluginsInitialized",(()=>{Ya.chatboxes=new Ya.ChatBoxes,Wl.trigger("chatBoxesInitialized")})),Wl.listen.on("presencesInitialized",(e=>Ya.chatboxes.onConnected(e))),Wl.listen.on("reconnected",(()=>Ya.chatboxes.forEach((e=>e.onReconnection()))))}}),Jl.plugins.add("converse-headlines",{dependencies:["converse-chat"],overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e.type==n.HEADLINES_TYPE?new n.HeadlinesBox(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){function e(){Ya.connection.addHandler((e=>async function(e){if($d(e)||Nd(e)){const t=e.getAttribute("from");if(await Wl.waitUntil("rosterInitialized"),t.includes("@")&&!Ya.roster.get(t)&&!Wl.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const n=Ya.chatboxes.create({id:t,jid:t,type:Ya.HEADLINES_TYPE,from:t}),i=await Vd(e);await n.createMessage(i),Wl.trigger("message",{chatbox:n,stanza:e,attrs:i})}}(e)||!0),null,"message")}Ya.HeadlinesBox=Ya.ChatBox.extend({defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(Wl.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:Ya.HEADLINES_TYPE}},async initialize(){this.set({box_id:`box-${this.get("jid")}`}),this.initUI(),this.initMessages(),await this.fetchMessages(),Wl.trigger("headlinesBoxInitialized",this)}}),Wl.listen.on("connected",e),Wl.listen.on("reconnected",e),Object.assign(Wl,{headlines:{async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];async function i(e){let i=await Wl.chatboxes.get(e);return!i&&n?i=await Wl.chatboxes.create(e,t,Ya.HeadlinesBox):(i=i&&i.get("type")===Ya.HEADLINES_TYPE?i:null,i&&Object.keys(t).length&&i.save(t)),i}return void 0===e?(await Wl.chatboxes.get()).filter((e=>e.get("type")===Ya.HEADLINES_TYPE)):"string"==typeof e?i(e):Promise.all(e.map((e=>i(e))))}}})}});const gm=Jl.env.utils;class pm extends fa{defaults(){return{msgid:gm.getUniqueId(),is_ephemeral:!1}}}const{Strophe:vm,$build:ym}=Jl.env;vm.addNamespace("RSM","http://jabber.org/protocol/rsm");const _m=["after","before","index","max"],bm=e=>Number(e),wm=e=>e.toString(),Sm={after:wm,before:wm,count:bm,first:wm,index:bm,last:wm,max:bm},xm=e=>void 0===e,Em=Object.keys(Sm);class Am{static getQueryParameters(){return Uo(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},_m)}static parseXMLResult(e){const t={};for(var n=0;n<Em.length;n++){const i=Em[n],s=e.getElementsByTagName(i)[0];xm(s)||null===s||(t[i]=Sm[i](vm.getText(s)),"first"==i&&(t.index=Sm.index(s.getAttribute("index"))))}return t}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.query=Am.getQueryParameters(e),this.result=e.xml?Am.parseXMLResult(e.xml):{}}toXML(){const e=ym("set",{xmlns:vm.NS.RSM});return _m.reduce(((e,t)=>xm(this.query[t])?e:e.c(t).t((this.query[t]||"").toString()).up()),e).tree()}next(e,t){const n=Object.assign({},this.query,{after:this.result.last,before:t,max:e});return new Am(n)}previous(e,t){const n=Object.assign({},this.query,{after:t,before:this.result.first,max:e});return new Am(n)}}Ya.RSM_ATTRIBUTES=Em,Ya.RSM=Am;const{Strophe:Cm,$iq:Tm,dayjs:km}=Jl.env,{NS:jm}=Cm,$m=Jl.env.utils,Nm={archive:{async query(e){if(!Wl.connection.connected())throw new Error("Can't call `api.archive.query` before having established an XMPP session");const t={type:"set"};if(e&&e.groupchat){if(!e.with)throw new Error('You need to specify a "with" value containing the chat room JID, when querying groupchat messages.');t.to=e.with}const n=t.to||Ya.bare_jid;if(!await Wl.disco.supports(jm.MAM,n))return R.warn(`Did not fetch MAM archive for ${n} because it doesn't support ${jm.MAM}`),{messages:[]};const i=$m.getUniqueId(),s=Tm(t).c("query",{xmlns:jm.MAM,queryid:i});if(e){s.c("x",{xmlns:jm.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(jm.MAM).up().up(),e.with&&!e.groupchat&&s.c("field",{var:"with"}).c("value").t(e.with).up().up(),["start","end"].forEach((t=>{if(e[t]){const n=km(e[t]);if(!n.isValid())throw new TypeError(`archive.query: invalid date provided for: ${t}`);s.c("field",{var:t}).c("value").t(n.toISOString()).up().up()}})),s.up();const t=new Am(e);Object.keys(t.query).length&&s.cnode(t.toXML())}const r=[],o=Ya.connection.addHandler((t=>{const n=Vo()(`message > result[xmlns="${jm.MAM}"]`,t).pop();if(void 0===n||n.getAttribute("queryid")!==i)return!0;const s=t.getAttribute("from")||Ya.bare_jid;if(e.groupchat){if(s!==e.with)return R.warn(`Ignoring alleged groupchat MAM message from ${t.getAttribute("from")}`),!0}else if(s!==Ya.bare_jid)return R.warn(`Ignoring alleged MAM message from ${t.getAttribute("from")}`),!0;return r.push(t),!0}),jm.MAM);let a;const c=Wl.settings.get("message_archiving_timeout"),l=await Wl.sendIQ(s,c,!1);if(null===l){const{__:e}=Ya,t=e("Timeout while trying to fetch archived messages.");return R.error(t),a=new Ya.TimeoutError(t),{messages:r,error:a}}if($m.isErrorStanza(l)){const{__:e}=Ya,t=e("An error occurred while querying for archived messages.");return R.error(t),R.error(l),a=new Error(t),{messages:r,error:a}}let d;Ya.connection.deleteHandler(o);const u=l&&Vo()(`fin[xmlns="${jm.MAM}"]`,l).pop(),h="true"===(null==u?void 0:u.getAttribute("complete")),m=Vo()(`set[xmlns="${jm.RSM}"]`,u).pop();return m&&(d=new Am({...e,xml:m})),{messages:r,rsm:d,complete:h}}}},{Strophe:Om,$iq:Im}=Jl.env,{NS:Mm}=Om,Rm=Jl.env.utils;function Dm(e){null!=e&&e.querySelectorAll("feature-not-implemented").length?R.warn(`Message Archive Management (XEP-0313) not supported by ${e.getAttribute("from")}`):(R.error(`Error while trying to set archiving preferences for ${e.getAttribute("from")}.`),R.error(e))}function Lm(e,t){const n=Vo()(`prefs[xmlns="${Mm.MAM}"]`,e).pop();if(n.getAttribute("default")!==Wl.settings.get("message_archiving")){const e=Im({type:"set"}).c("prefs",{xmlns:Mm.MAM,default:Wl.settings.get("message_archiving")});Array.from(n.children).forEach((t=>e.cnode(t).up())),Wl.sendIQ(e).then((()=>t.save({preferences:{default:Wl.settings.get("message_archiving")}}))).catch(Ya.onMAMError)}else t.save({preferences:{default:Wl.settings.get("message_archiving")}})}function zm(e){const t=e.get("preferences")||{};e.get("var")===Mm.MAM&&void 0!==Wl.settings.get("message_archiving")&&t.default!==Wl.settings.get("message_archiving")&&Wl.sendIQ(Im({type:"get"}).c("prefs",{xmlns:Mm.MAM})).then((t=>Ya.onMAMPreferences(t,e))).catch(Ya.onMAMError)}function Pm(e){Wl.settings.get("muc_show_logs_before_join")&&e.features.get("mam_enabled")&&!e.get("prejoin_mam_fetched")&&(qm(e),e.save({prejoin_mam_fetched:!0}))}async function Fm(e,t,n,i,s){await Wl.emojis.initialize();const r=e.get("type")===Ya.CHATROOMS_TYPE,o=await Promise.all(t.messages.map((t=>r?Xu(t,e):Vd(t))));t.messages=o;const a={query:n,chatbox:e,messages:o};if(await Wl.trigger("MAMResult",a,{synchronous:!0}),o.forEach((t=>e.queueMessage(t))),t.error){const n=t.error.retry_event_id=Rm.getUniqueId();Wl.listen.once(n,(()=>Um(e,i,s))),e.createMessageFromError(t.error)}}async function Um(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(e.disable_mam)return;const i=e.get("type")===Ya.CHATROOMS_TYPE,s=i?e.get("jid"):Ya.bare_jid;if(!await Wl.disco.supports(Mm.MAM,s))return;const r=Wl.settings.get("archived_messages_page_size"),o=Object.assign({groupchat:i,max:r,with:e.get("jid")},t),a=await Wl.archive.query(o);if(await Fm(e,a,o,t,n),a.rsm&&!a.complete){if(n)return"forwards"===n?t=a.rsm.next(r,t.before).query:"backwards"===n&&(t=a.rsm.previous(r,t.after).query),Um(e,t,n);Bm(e,t,a)}}async function Bm(e,t,n){if(""==t.before&&(0===e.messages.length||!t.start))return;if(t.before&&!t.start)return;if(null==t.before)return;const i=await Promise.all(n.messages),{rsm:s}=n,r=`stanza_id ${e.get("jid")}`,o=i.find((e=>e[r]===s.result.first)),a={template_hook:"getMessageTemplate",time:new Date(new Date(o.time)-1).toISOString(),before:s.result.first,start:t.start};e.messages.add(new pm(a))}function qm(e){if(e.disable_mam)return;const t=e.getMostRecentMessage();if(t&&!Wl.settings.get("clear_messages_on_reconnection"))if(Wl.settings.get("mam_request_all_pages")){const n=t.get(`stanza_id ${e.get("jid")}`);Um(e,n?{after:n}:{start:t.get("time")},"forwards")}else Um(e,{before:"",start:t.get("time")});else Um(e,{before:""})}const{Strophe:Hm}=Jl.env,{NS:Gm}=Hm;Jl.plugins.add("converse-mam",{dependencies:["converse-disco","converse-muc"],initialize(){Wl.settings.extend({archived_messages_page_size:"50",mam_request_all_pages:!0,message_archiving:void 0,message_archiving_timeout:2e4}),Object.assign(Wl,Nm),Object.assign(Ya,{onMAMError:Dm,onMAMPreferences:Lm,handleMAMResult:Fm,MAMPlaceholderMessage:pm}),Wl.listen.on("addClientFeatures",(()=>Wl.disco.own.features.add(Gm.MAM))),Wl.listen.on("serviceDiscovered",zm),Wl.listen.on("chatRoomViewInitialized",(e=>{Wl.settings.get("muc_show_logs_before_join")&&(Pm(e.model),e.model.features.on("change:mam_enabled",(()=>Pm(e.model))))})),Wl.listen.on("enteredNewRoom",(e=>e.features.get("mam_enabled")&&qm(e))),Wl.listen.on("chatReconnected",(e=>{e.get("type")===Ya.PRIVATE_CHAT_TYPE&&qm(e)})),Wl.listen.on("afterMessagesFetched",(e=>{e.get("type")!==Ya.PRIVATE_CHAT_TYPE||Ya.connection.restored||qm(e)}))}});const{Strophe:Wm,$iq:Vm}=Jl.env;let Jm;function Qm(e){"visible"===e.state&&Wl.connection.connected()&&Wl.ping(null,5e3)}function Zm(e){Jm=new Date;const t=e.getAttribute("from"),n=e.getAttribute("id"),i=Vm({type:"result",to:t,id:n});return Ya.connection.sendIQ(i),!0}function Ym(){void 0!==Ya.connection.disco&&Wl.disco.own.features.add(Wm.NS.PING),Ya.connection.addHandler(Zm,Wm.NS.PING,"iq","get"),Ya.connection.addHandler((()=>{if(Wl.settings.get("ping_interval")>0)return Jm=new Date,!0}))}function Xm(){if(Ya.isTestEnv()||!Wl.connection.connected())return;const e=Wl.settings.get("ping_interval");if(e>0){const t=new Date;Jm||(Jm=t),(t-Jm)/1e3>e&&Wl.ping()}}const{Strophe:Km,$iq:ef,u:tf}=Jl.env,nf={async ping(e,t){var n;if(n=new Date,Jm=n,e=e||Km.getDomainFromJid(Ya.bare_jid),Ya.connection){const n=ef({type:"get",to:e,id:tf.getUniqueId("ping")}).c("ping",{xmlns:Km.NS.PING}),i=await Wl.sendIQ(n,t||1e4,!1);return null===i?(R.warn(`Timeout while pinging ${e}`),e===Km.getDomainFromJid(Ya.bare_jid)&&Wl.connection.reconnect()):tf.isErrorStanza(i)&&(R.error(`Error while pinging ${e}`),R.error(i)),!0}return!1}},{Strophe:sf}=Jl.env;sf.addNamespace("PING","urn:xmpp:ping"),Jl.plugins.add("converse-ping",{initialize(){Wl.settings.extend({ping_interval:60}),Object.assign(Wl,nf),setInterval(Xm,1e3),Wl.listen.on("connected",Ym),Wl.listen.on("reconnected",Ym),Wl.listen.on("windowStateChanged",Qm)}});const{Strophe:rf,$iq:of}=Jl.env;rf.addNamespace("PUBSUB_ERROR",rf.NS.PUBSUB+"#errors"),Jl.plugins.add("converse-pubsub",{dependencies:["converse-disco"],initialize(){Object.assign(Ya.api,{pubsub:{async publish(e,t,n,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const r=of({from:Ya.bare_jid,type:"set",to:e}).c("pubsub",{xmlns:rf.NS.PUBSUB}).c("publish",{node:t}).cnode(n.tree()).up().up();i&&(e=e||Ya.bare_jid,await Wl.disco.supports(rf.NS.PUBSUB+"#publish-options",e)?(r.c("publish-options").c("x",{xmlns:rf.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(`${rf.NS.PUBSUB}#publish-options`).up().up(),Object.keys(i).forEach((e=>r.c("field",{var:e}).c("value").t(i[e]).up().up()))):R.warn(`_converse.api.publish: ${e} does not support #publish-options, so we didn't set them even though they were provided.`));try{await Wl.sendIQ(r)}catch(e){if(!(e instanceof Element&&s&&e.querySelector(`precondition-not-met[xmlns="${rf.NS.PUBSUB_ERROR}"]`)))throw e;{const e=r.nodeTree;e.querySelector("publish-options").outerHTML="",R.warn(`PubSub: Republishing without publish options. ${e.outerHTML}`),await Wl.sendIQ(e)}}}}})}});const af=function(e){return function(e){return"number"==typeof e||a(e)&&"[object Number]"==y(e)}(e)&&e!=+e},{Strophe:cf,$pres:lf}=Jl.env,df=fa.extend({defaults:()=>({status:Wl.settings.get("default_state")}),initialize(){this.on("change",(e=>{ye(e.changed)&&("status"in e.changed||"status_message"in e.changed)&&Wl.user.presence.send(this.get("status"),null,this.get("status_message"))}))},getNickname:()=>Wl.settings.get("nickname"),getFullname:()=>"",async constructPresence(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0;e="string"==typeof e?e:this.get("status")||Wl.settings.get("default_state"),i="string"==typeof i?i:this.get("status_message");const s={to:n};"unavailable"===e||"probe"===e||"error"===e||"unsubscribe"===e||"unsubscribed"===e||"subscribe"===e||"subscribed"===e?(s.type=e,t=lf(s)):"offline"===e?(s.type="unavailable",t=lf(s)):t="online"===e?lf(s):lf(s).c("show").t(e).up(),i&&t.c("status").t(i).up();const r=Wl.settings.get("priority");if(t.c("priority").t(af(Number(r))?0:r).up(),Ya.idle){const e=new Date;e.setSeconds(e.getSeconds()-Ya.idle_seconds),t.c("idle",{xmlns:cf.NS.IDLE,since:e.toISOString()})}return t=await Wl.hook("constructedPresence",null,t),t}}),uf=df,hf={presence:{async send(e,t,n,i){var s;await Wl.waitUntil("statusInitialized"),i&&!Array.isArray(i)&&(i=[i]);const r=Ya.xmppstatus,o=await r.constructPresence(e,t,n);null===(s=i)||void 0===s||s.map((e=>(null==e?void 0:e.tree())??e)).forEach((e=>o.cnode(e).up())),Wl.send(o),["away","chat","dnd","online","xa",void 0].includes(e)&&(await Wl.rooms.get()).forEach((t=>t.sendStatusPresence(e,n,i)))}},status:{get:async()=>(await Wl.waitUntil("statusInitialized"),Ya.xmppstatus.get("status")),async set(e,t){const n={status:e};if(!Object.keys(Ya.STATUS_WEIGHTS).includes(e))throw new Error("Invalid availability value. See https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.2.2.1");"string"==typeof t&&(n.status_message=t),await Wl.waitUntil("statusInitialized"),Ya.xmppstatus.save(n)},message:{get:async()=>(await Wl.waitUntil("statusInitialized"),Ya.xmppstatus.get("status_message")),async set(e){await Wl.waitUntil("statusInitialized"),Ya.xmppstatus.save({status_message:e})}}}},{Strophe:mf,$build:ff}=Jl.env;function gf(e){Wl.trigger("statusInitialized",e)}function pf(e){if(e=void 0!==Ya.xmppstatus&&e)gf(e);else{const t=`converse.xmppstatus-${Ya.bare_jid}`;Ya.xmppstatus=new Ya.XMPPStatus({id:t}),Oo(Ya.xmppstatus,t,"session"),Ya.xmppstatus.fetch({success:()=>gf(e),error:()=>gf(e),silent:!0})}}function vf(){var e;Ya.idle_seconds>0&&(Ya.idle_seconds=0),null!==(e=Ya.connection)&&void 0!==e&&e.authenticated&&(Ya.inactive&&Ya.sendCSI(Ya.ACTIVE),Ya.idle&&(Ya.idle=!1,Wl.user.presence.send()),!0===Ya.auto_changed_status&&(Ya.auto_changed_status=!1,Ya.xmppstatus.set("status",Wl.settings.get("default_state"))))}function yf(){var e;if(null===(e=Ya.connection)||void 0===e||!e.authenticated)return;const t=Ya.xmppstatus.get("status");Ya.idle_seconds++,Wl.settings.get("csi_waiting_time")>0&&Ya.idle_seconds>Wl.settings.get("csi_waiting_time")&&!Ya.inactive&&Ya.sendCSI(Ya.INACTIVE),Wl.settings.get("idle_presence_timeout")>0&&Ya.idle_seconds>Wl.settings.get("idle_presence_timeout")&&!Ya.idle&&(Ya.idle=!0,Wl.user.presence.send()),Wl.settings.get("auto_away")>0&&Ya.idle_seconds>Wl.settings.get("auto_away")&&"away"!==t&&"xa"!==t&&"dnd"!==t?(Ya.auto_changed_status=!0,Ya.xmppstatus.set("status","away")):Wl.settings.get("auto_xa")>0&&Ya.idle_seconds>Wl.settings.get("auto_xa")&&"xa"!==t&&"dnd"!==t&&(Ya.auto_changed_status=!0,Ya.xmppstatus.set("status","xa"))}function _f(e){Wl.send(ff(e,{xmlns:mf.NS.CSI})),Ya.inactive=e===Ya.INACTIVE}function bf(){if(Wl.settings.get("auto_away")<1&&Wl.settings.get("auto_xa")<1&&Wl.settings.get("csi_waiting_time")<1&&Wl.settings.get("idle_presence_timeout")<1)return;Ya.idle_seconds=0,Ya.auto_changed_status=!1;const{unloadevent:e}=Ya;window.addEventListener("click",Ya.onUserActivity),window.addEventListener("focus",Ya.onUserActivity),window.addEventListener("keypress",Ya.onUserActivity),window.addEventListener("mousemove",Ya.onUserActivity),window.addEventListener(e,Ya.onUserActivity,{once:!0,passive:!0}),window.addEventListener(e,(()=>{var e;return null===(e=Ya.session)||void 0===e?void 0:e.save("active",!1)})),Ya.everySecondTrigger=window.setInterval(Ya.onEverySecond,1e3)}Jl.plugins.add("converse-status",{initialize(){Wl.settings.extend({auto_away:0,auto_xa:0,csi_waiting_time:0,default_state:"online",priority:0}),Wl.promises.add(["statusInitialized"]),Ya.XMPPStatus=uf,Ya.onUserActivity=vf,Ya.onEverySecond=yf,Ya.sendCSI=_f,Ya.registerIntervalHandler=bf,Object.assign(Ya.api.user,hf),Wl.listen.on("presencesInitialized",(e=>{e||Ya.registerIntervalHandler()})),Wl.listen.on("clearSession",(()=>{Ya.shouldClearCache()&&Ya.xmppstatus&&(Ya.xmppstatus.destroy(),delete Ya.xmppstatus,Wl.promises.add(["statusInitialized"]))})),Wl.listen.on("connected",(()=>pf(!1))),Wl.listen.on("reconnected",(()=>pf(!0)))}});const{$pres:wf}=Jl.env;function Sf(e){var t;const n=null===(t=Ya.roster)||void 0===t?void 0:t.findWhere({jid:e.get("jid")});null==n||n.save({num_unread:e.get("num_unread")})}function xf(){void 0!==Ya.presence_ref&&(Ya.connection.deleteHandler(Ya.presence_ref),delete Ya.presence_ref)}async function Ef(){var e;await(null===(e=Ya.presences)||void 0===e?void 0:e.clearStore())}async function Af(){var e;await Ef(),Ya.shouldClearCache()&&(Ya.rostergroups&&(await Ya.rostergroups.clearStore(),delete Ya.rostergroups),Ya.roster&&(null===(e=Ya.roster.data)||void 0===e||e.destroy(),await Ya.roster.clearStore(),delete Ya.roster))}async function Cf(e){e?Wl.trigger("rosterReadyAfterReconnection"):await async function(){await Wl.waitUntil("VCardsInitialized"),Ya.roster=new Ya.RosterContacts;let e=`converse.contacts-${Ya.bare_jid}`;Oo(Ya.roster,e),Ya.roster.data=new fa,e=`converse-roster-model-${Ya.bare_jid}`,Ya.roster.data.id=e,Oo(Ya.roster.data,e),Ya.roster.data.fetch(),Wl.trigger("rosterInitialized")}(),Ya.roster.onConnected(),xf(),Ya.presence_ref=Ya.connection.addHandler((e=>(Ya.roster.presenceHandler(e),!0)),null,"presence",null),async function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(Ya.send_initial_presence=!0);try{await Ya.roster.fetchRosterContacts(),Wl.trigger("rosterContactsFetched")}catch(e){R.error(e)}finally{Ya.send_initial_presence&&Wl.user.presence.send()}}(!Ya.connection.restored)}async function Tf(e){if(e)!Ya.connection.hasResumed()&&await Ef();else{Ya.presences=new Ya.Presences;const e=`converse.presences-${Ya.bare_jid}`;Oo(Ya.presences,e,"session"),Ya.presences.fetch()}Wl.trigger("presencesInitialized",e)}function kf(){Ya.chatboxes.on("change:num_unread",Sf),Ya.chatboxes.on("add",(e=>{e.get("type")===Ya.PRIVATE_CHAT_TYPE&&e.setRosterContact(e.get("jid"))}))}function jf(){Ya.roster.on("add",(e=>{const t=Ya.chatboxes.findWhere({jid:e.get("jid")});null==t||t.setRosterContact(e.get("jid"))}))}function $f(e,t){const n=wf({to:e,type:"unsubscribed"});t&&""!==t&&n.c("status").t(t),Wl.send(n)}function Nf(e,t){const n=e.presence.get("show")||"offline",i=t.presence.get("show")||"offline";if(Ya.STATUS_WEIGHTS[n]===Ya.STATUS_WEIGHTS[i]){const n=e.getDisplayName().toLowerCase(),i=t.getDisplayName().toLowerCase();return n<i?-1:n>i?1:0}return Ya.STATUS_WEIGHTS[n]<Ya.STATUS_WEIGHTS[i]?-1:1}function Of(e,t){const n={};n[Ya.HEADER_UNREAD]=0,n[Ya.HEADER_REQUESTING_CONTACTS]=1,n[Ya.HEADER_CURRENT_CONTACTS]=2,n[Ya.HEADER_UNGROUPED]=3,n[Ya.HEADER_PENDING_CONTACTS]=4;const i=n,s=Object.keys(n),r=s.includes(e),o=s.includes(t);if(!r&&!o)return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0;if(r&&o)return i[e]<i[t]?-1:i[e]>i[t]?1:0;if(!r&&o){const e=Ya.HEADER_CURRENT_CONTACTS;return i[e]<i[t]?-1:i[e]>i[t]?1:0}if(r&&!o){const t=Ya.HEADER_CURRENT_CONTACTS;return i[e]<i[t]?-1:i[e]>i[t]?1:0}}const{Strophe:If,$iq:Mf,$pres:Rf}=Jl.env,Df=fa.extend({defaults:{chat_state:void 0,groups:[],image:Ya.DEFAULT_IMAGE,image_type:Ya.DEFAULT_IMAGE_TYPE,num_unread:0,status:void 0},async initialize(e){this.initialized=fo(),this.setPresence();const{jid:t}=e,n=If.getBareJidFromJid(t).toLowerCase();e.jid=n,this.set(Object.assign({id:n,jid:n,user_id:If.getNodeFromJid(t)},e)),this.listenTo(this.presence,"change:show",(()=>Wl.trigger("contactPresenceChanged",this))),this.listenTo(this.presence,"change:show",(()=>this.trigger("presenceChanged"))),await Wl.trigger("rosterContactInitialized",this,{Synchronous:!0}),this.initialized.resolve()},setPresence(){const e=this.get("jid");this.presence=Ya.presences.findWhere({jid:e})||Ya.presences.create({jid:e})},openChat(){const e=this.attributes;Wl.chats.open(e.jid,e,!0)},getFilterCriteria(){const e=this.get("nickname"),t=this.get("jid");let n=this.getDisplayName();return n=n.includes(t)?n:n.concat(` ${t}`),n=n.includes(e)?n:n.concat(` ${e}`),n.toLowerCase()},getDisplayName(){return this.get("nickname")?this.get("nickname"):this.get("jid")},getFullname(){return this.get("jid")},subscribe(e){const t=Rf({to:this.get("jid"),type:"subscribe"});e&&""!==e&&t.c("status").t(e).up();const n=Ya.xmppstatus.getNickname()||Ya.xmppstatus.getFullname();return n&&t.c("nick",{xmlns:If.NS.NICK}).t(n).up(),Wl.send(t),this.save("ask","subscribe"),this},ackSubscribe(){Wl.send(Rf({type:"subscribe",to:this.get("jid")}))},ackUnsubscribe(){Wl.send(Rf({type:"unsubscribe",to:this.get("jid")})),this.removeFromRoster(),this.destroy()},unauthorize(e){return $f(this.get("jid"),e),this},authorize(e){const t=Rf({to:this.get("jid"),type:"subscribed"});return e&&""!==e&&t.c("status").t(e),Wl.send(t),this},removeFromRoster(){const e=Mf({type:"set"}).c("query",{xmlns:If.NS.ROSTER}).c("item",{jid:this.get("jid"),subscription:"remove"});return Wl.sendIQ(e)}}),Lf=Df,{Strophe:zf,$iq:Pf,sizzle:Ff,u:Uf}=Jl.env,Bf=Rc.extend({model:Lf,initialize(){const e=`roster.state-${Ya.bare_jid}-${this.get("jid")}`;this.state=new fa({id:e,collapsed_groups:[]}),Oo(this.state,e),this.state.fetch()},onConnected(){this.registerRosterHandler(),this.registerRosterXHandler()},registerRosterHandler(){Ya.connection.addHandler((e=>(Ya.roster.onRosterPush(e),!0)),zf.NS.ROSTER,"iq","set")},registerRosterXHandler(){let e=0;Ya.connection.addHandler((function(t){return window.setTimeout((function(){Ya.connection.flush(),Ya.roster.subscribeToSuggestedItems.bind(Ya.roster)(t)}),e),e+=250*t.querySelectorAll("item").length,!0}),zf.NS.ROSTERX,"message",null)},async fetchRosterContacts(){const e=await new Promise(((e,t)=>{this.fetch({add:!0,silent:!0,success:e,error:(e,n)=>t(n)})}));if(Uf.isErrorObject(e)&&(R.error(e),Ya.session.save("roster_cached",!1),this.data.save("version",void 0)),!Ya.session.get("roster_cached"))return Ya.send_initial_presence=!0,Ya.roster.fetchFromServer();Wl.trigger("cachedRoster",e)},subscribeToSuggestedItems:e=>(Array.from(e.querySelectorAll("item")).forEach((e=>{"add"===e.getAttribute("action")&&Ya.roster.addAndSubscribe(e.getAttribute("jid"),Ya.xmppstatus.getNickname()||Ya.xmppstatus.getFullname())})),!0),isSelf:e=>Uf.isSameBareJID(e,Ya.connection.jid),async addAndSubscribe(e,t,n,i,s){const r=await this.addContactToRoster(e,t,n,s);r instanceof Ya.RosterContact&&r.subscribe(i)},sendContactAddIQ(e,t,n){t=t||null;const i=Pf({type:"set"}).c("query",{xmlns:zf.NS.ROSTER}).c("item",{jid:e,name:t});return n.forEach((e=>i.c("group").t(e).up())),Wl.sendIQ(i)},async addContactToRoster(e,t,n,i){await Wl.waitUntil("rosterContactsFetched"),n=n||[];try{await this.sendContactAddIQ(e,t,n)}catch(n){const{__:i}=Ya;return R.error(n),alert(i("Sorry, there was an error while trying to add %1$s as a contact.",t||e)),n}return this.create(Object.assign({ask:void 0,nickname:t,groups:n,jid:e,requesting:!1,subscription:"none"},i),{sort:!1})},async subscribeBack(e,t){const n=this.get(e);if(n instanceof Ya.RosterContact)n.authorize().subscribe();else{var i;const n=(null===(i=Ff(`nick[xmlns="${zf.NS.NICK}"]`,t).pop())||void 0===i?void 0:i.textContent)||null,s=await this.addContactToRoster(e,n,[],{subscription:"from"});s instanceof Ya.RosterContact&&s.authorize().subscribe()}},getNumOnlineContacts(){const e=["offline","unavailable"];return t=this.models.filter((t=>!e.includes(t.presence.get("show")))),t&&t.length?function(e,t){for(var n,i=-1,s=e.length;++i<s;){var r=t(e[i]);void 0!==r&&(n=void 0===n?r:n+r)}return n}(t,Pe):0;var t},onRosterPush(e){const t=e.getAttribute("id"),n=e.getAttribute("from");if(n&&n!==Ya.bare_jid)return void R.warn(`Ignoring roster illegitimate roster push message from ${e.getAttribute("from")}`);Wl.send(Pf({type:"result",id:t,from:Ya.connection.jid}));const i=Ff(`query[xmlns="${zf.NS.ROSTER}"]`,e).pop();this.data.save("version",i.getAttribute("ver"));const s=Ff("item",i);if(s.length>1)throw R.error(e),new Error('Roster push query may not contain more than one "item" element.');if(0===s.length)return R.warn(e),void R.warn('Received a roster push stanza without an "item" element.');this.updateContact(s.pop()),Wl.trigger("rosterPush",e)},rosterVersioningSupported(){return Wl.disco.stream.getFeature("ver","urn:xmpp:features:rosterver")&&this.data.get("version")},async fetchFromServer(){const e=Pf({type:"get",id:Uf.getUniqueId("roster")}).c("query",{xmlns:zf.NS.ROSTER});this.rosterVersioningSupported()&&e.attrs({ver:this.data.get("version")});const t=await Wl.sendIQ(e,null,!1);if("error"!==t.getAttribute("type")){const e=Ff(`query[xmlns="${zf.NS.ROSTER}"]`,t).pop();e&&(Ff("item",e).forEach((e=>this.updateContact(e))),this.data.save("version",e.getAttribute("ver")))}else if(!Uf.isServiceUnavailableError(t))return R.error(t),void R.error("Error while trying to fetch roster from the server");Ya.session.save("roster_cached",!0),Wl.trigger("roster",t)},updateContact(e){const t=e.getAttribute("jid"),n=this.get(t),i=e.getAttribute("subscription"),s=e.getAttribute("ask"),r=[...new Set(Ff("group",e).map((e=>e.textContent)))];if(n){if("remove"===i)return n.destroy();n.save({subscription:i,ask:s,nickname:e.getAttribute("name"),requesting:null,groups:r})}else{if("none"===i&&null===s||"remove"===i)return;this.create({ask:s,nickname:e.getAttribute("name"),groups:r,jid:t,subscription:i},{sort:!1})}},createRequestingContact(e){var t;const n={jid:zf.getBareJidFromJid(e.getAttribute("from")),subscription:"none",ask:null,requesting:!0,nickname:(null===(t=Ff(`nick[xmlns="${zf.NS.NICK}"]`,e).pop())||void 0===t?void 0:t.textContent)||null};Wl.trigger("contactRequest",this.create(n))},handleIncomingSubscription(e){const t=e.getAttribute("from"),n=zf.getBareJidFromJid(t),i=this.get(n);if(!Wl.settings.get("allow_contact_requests")){const{__:e}=Ya;$f(t,e("This client does not allow presence subscriptions"))}Wl.settings.get("auto_subscribe")?i&&"to"===i.get("subscription")?i.authorize():this.subscribeBack(n,e):i?("none"!==i.get("subscription")||"subscribe"===i.get("ask"))&&i.authorize():this.createRequestingContact(e)},handleOwnPresence(e){const t=e.getAttribute("from"),n=zf.getResourceFromJid(t),i=e.getAttribute("type");if(Ya.connection.jid!==t&&"unavailable"!==i&&(!0===Wl.settings.get("synchronize_availability")||Wl.settings.get("synchronize_availability")===n)){var s,r;const t=(null===(s=e.querySelector("show"))||void 0===s?void 0:s.textContent)||"online";Ya.xmppstatus.save({status:t},{silent:!0});const n=null===(r=e.querySelector("status"))||void 0===r?void 0:r.textContent;n&&Ya.xmppstatus.save({status_message:n})}Ya.jid===t&&"unavailable"===i&&Wl.user.presence.send()},presenceHandler(e){var t;const n=e.getAttribute("type");if("error"===n)return!0;const i=e.getAttribute("from"),s=zf.getBareJidFromJid(i);if(this.isSelf(s))return this.handleOwnPresence(e);if(Ff(`query[xmlns="${zf.NS.MUC}"]`,e).length)return;const r=null===(t=e.querySelector("status"))||void 0===t?void 0:t.textContent,o=this.get(s);if(o&&r!==o.get("status")&&o.save({status:r}),"subscribed"===n&&o)o.ackSubscribe();else if("unsubscribed"===n&&o)o.ackUnsubscribe();else{if("unsubscribe"===n)return;if("subscribe"===n)this.handleIncomingSubscription(e);else if("unavailable"===n&&o){const e=zf.getResourceFromJid(i);o.presence.removeResource(e)}else o&&o.presence.addResource(e)}}}),qf=Bf,{Strophe:Hf}=Jl.env,Gf={contacts:{async get(e){await Wl.waitUntil("rosterContactsFetched");const t=e=>Ya.roster.get(Hf.getBareJidFromJid(e));if(void 0===e)e=Ya.roster.pluck("jid");else if("string"==typeof e)return t(e);return e.map(t)},async add(e,t){if(await Wl.waitUntil("rosterContactsFetched"),"string"!=typeof e||!e.includes("@"))throw new TypeError("contacts.add: invalid jid");return Ya.roster.addAndSubscribe(e,t)}}},{Strophe:Wf,dayjs:Vf,sizzle:Jf}=Jl.env,Qf=fa.extend({idAttribute:"name"}),Zf=Rc.extend({model:Qf}),Yf=fa.extend({defaults:{show:"offline"},initialize(){this.resources=new Zf;const e=`converse.identities-${this.get("jid")}`;Oo(this.resources,e,"session"),this.listenTo(this.resources,"update",this.onResourcesChanged),this.listenTo(this.resources,"change",this.onResourcesChanged)},onResourcesChanged(){var e;const t=this.getHighestPriorityResource(),n=(null==t||null===(e=t.attributes)||void 0===e?void 0:e.show)||"offline";this.get("show")!==n&&this.save({show:n})},getHighestPriorityResource(){return this.resources.sortBy((e=>`${e.get("priority")}-${e.get("timestamp")}`)).reverse()[0]},addResource(e){var t,n;const i=e.getAttribute("from"),s=Wf.getResourceFromJid(i),r=Jf(`delay[xmlns="${Wf.NS.DELAY}"]`,e).pop(),o=(null===(t=e.querySelector("priority"))||void 0===t?void 0:t.textContent)??0,a=this.resources.get(s),c={name:s,priority:af(parseInt(o,10))?0:parseInt(o,10),show:(null===(n=e.querySelector("show"))||void 0===n?void 0:n.textContent)??"online",timestamp:r?Vf(r.getAttribute("stamp")).toISOString():(new Date).toISOString()};a?a.save(c):this.resources.create(c)},removeResource(e){const t=this.resources.get(e);t&&t.destroy()}}),Xf=Rc.extend({model:Yf});Jl.plugins.add("converse-roster",{dependencies:["converse-status"],initialize(){Wl.settings.extend({allow_contact_requests:!0,auto_subscribe:!1,synchronize_availability:!0}),Wl.promises.add(["cachedRoster","roster","rosterContactsFetched","rosterInitialized"]),Object.assign(Ya.api,Gf);const{__:e}=Ya;Ya.HEADER_CURRENT_CONTACTS=e("My contacts"),Ya.HEADER_PENDING_CONTACTS=e("Pending contacts"),Ya.HEADER_REQUESTING_CONTACTS=e("Contact requests"),Ya.HEADER_UNGROUPED=e("Ungrouped"),Ya.HEADER_UNREAD=e("New messages"),Ya.Presence=Yf,Ya.Presences=Xf,Ya.RosterContact=Lf,Ya.RosterContacts=qf,Wl.listen.on("beforeTearDown",(()=>xf())),Wl.listen.on("chatBoxesInitialized",kf),Wl.listen.on("clearSession",Af),Wl.listen.on("presencesInitialized",Cf),Wl.listen.on("statusInitialized",Tf),Wl.listen.on("streamResumptionFailed",(()=>Ya.session.set("roster_cached",!1))),Wl.waitUntil("rosterContactsFetched").then(jf)}});const{Strophe:Kf}=Jl.env,eg=Jl.env.utils;function tg(){return!(Wl.connection.isType("bosh")&&!Ya.isTestEnv())&&Wl.disco.stream.getFeature("sm",Kf.NS.SM)}function ng(e){if(!Ya.session.get("smacks_enabled"))return!0;const t=parseInt(e.getAttribute("h"),10),n=Ya.session.get("num_stanzas_handled_by_server"),i=t-n;if(i<0){const e=`New reported stanza count lower than previous. New: ${t} - Previous: ${n}`;R.error(e)}const s=Ya.session.get("unacked_stanzas");if(i>s.length){const e=`Higher reported acknowledge count than unacknowledged stanzas. Reported Acknowledged Count: ${i} -Unacknowledged Stanza Count: ${s.length} -New: ${t} - Previous: ${n}`;R.error(e)}return Ya.session.save({num_stanzas_handled_by_server:t,num_stanzas_since_last_ack:0,unacked_stanzas:s.slice(i)}),!0}function ig(){if(Ya.session.get("smacks_enabled")){const e=Ya.session.get("num_stanzas_handled"),t=eg.toStanza(`<a xmlns="${Kf.NS.SM}" h="${e}"/>`);Wl.send(t)}return!0}function sg(e){if(Ya.session.get("smacks_enabled")&&(eg.isTagEqual(e,"iq")||eg.isTagEqual(e,"presence")||eg.isTagEqual(e,"message"))){const e=Ya.session.get("num_stanzas_handled");Ya.session.save("num_stanzas_handled",e+1)}return!0}function rg(){Ya.session.save({smacks_enabled:Ya.session.get("smacks_enabled")||!1,num_stanzas_handled:Ya.session.get("num_stanzas_handled")||0,num_stanzas_handled_by_server:Ya.session.get("num_stanzas_handled_by_server")||0,num_stanzas_since_last_ack:Ya.session.get("num_stanzas_since_last_ack")||0,unacked_stanzas:Ya.session.get("unacked_stanzas")||[]})}function og(){var e;null===(e=Ya.session)||void 0===e||e.save({smacks_enabled:!1,num_stanzas_handled:0,num_stanzas_handled_by_server:0,num_stanzas_since_last_ack:0,unacked_stanzas:[]})}function ag(e){const t={smacks_enabled:!0};return["1","true"].includes(e.getAttribute("resume"))&&(t.smacks_stream_id=e.getAttribute("id")),Ya.session.save(t),!0}function cg(e){return e.querySelector("item-not-found")?R.warn("Could not resume previous SMACKS session, session id not found. A new session will be established."):(R.error("Failed to enable stream management"),R.error(e.outerHTML)),og(),Wl.trigger("streamResumptionFailed"),!0}async function lg(){if(Wl.settings.get("enable_smacks")&&!Ya.session.get("smacks_enabled")&&await tg()){const e=fo();Ya.connection._addSysHandler((t=>e.resolve(ag(t))),Kf.NS.SM,"enabled"),Ya.connection._addSysHandler((t=>e.resolve(cg(t))),Kf.NS.SM,"failed");const t=Wl.connection.isType("websocket")||Ya.isTestEnv(),n=eg.toStanza(`<enable xmlns="${Kf.NS.SM}" resume="${t}"/>`);Wl.send(n),Ya.connection.flush(),await e}}const dg=[];async function ug(){var e;if(!Wl.settings.get("enable_smacks"))return;if(!await tg())return;const t=Ya.connection;for(;dg.length;)t.deleteHandler(dg.pop());dg.push(t.addHandler(sg)),dg.push(t.addHandler(ig,Kf.NS.SM,"r")),dg.push(t.addHandler(ng,Kf.NS.SM,"a")),null!==(e=Ya.session)&&void 0!==e&&e.get("smacks_stream_id")?await async function(){const e=fo();Ya.connection._addSysHandler((t=>e.resolve(function(e){ag(e),ng(e),function(){const e=Ya.session.get("unacked_stanzas");Ya.session.save("unacked_stanzas",[]),e.forEach((e=>Wl.send(e)))}(),Ya.connection.do_bind=!1,Ya.connection.authenticated=!0,Ya.connection.restored=!0,Ya.connection._changeConnectStatus(Kf.Status.CONNECTED,null)}(t))),Kf.NS.SM,"resumed"),Ya.connection._addSysHandler((t=>e.resolve(cg(t))),Kf.NS.SM,"failed");const t=Ya.session.get("smacks_stream_id"),n=Ya.session.get("num_stanzas_handled"),i=eg.toStanza(`<resume xmlns="${Kf.NS.SM}" h="${n}" previd="${t}"/>`);Wl.send(i),Ya.connection.flush(),await e}():og()}function hg(e){if(Ya.session){if(Ya.session.get("smacks_enabled")&&(eg.isTagEqual(e,"iq")||eg.isTagEqual(e,"presence")||eg.isTagEqual(e,"message"))){const t=Kf.serialize(e);Ya.session.save("unacked_stanzas",(Ya.session.get("unacked_stanzas")||[]).concat([t]));const n=Wl.settings.get("smacks_max_unacked_stanzas");if(n>0){const e=Ya.session.get("num_stanzas_since_last_ack")+1;e%n==0&&Wl.send(eg.toStanza(`<r xmlns="${Kf.NS.SM}"/>`)),Ya.session.save({num_stanzas_since_last_ack:e})}}}else R.warn("No _converse.session!")}const{Strophe:mg}=Jl.env;mg.addNamespace("SM","urn:xmpp:sm:3"),Jl.plugins.add("converse-smacks",{initialize(){Wl.settings.extend({enable_smacks:!0,smacks_max_unacked_stanzas:5}),Wl.listen.on("afterResourceBinding",lg),Wl.listen.on("beforeResourceBinding",ug),Wl.listen.on("send",hg),Wl.listen.on("userSessionInitialized",rg)}});const fg=fa.extend({defaults:{image:Ya.DEFAULT_IMAGE,image_type:Ya.DEFAULT_IMAGE_TYPE},set(e,t,n){let i;return"object"==typeof e?(i=e,n=t):(i={})[e]=t,"image"in i&&!i.image?(i.image=Ya.DEFAULT_IMAGE,i.image_type=Ya.DEFAULT_IMAGE_TYPE,fa.prototype.set.call(this,i,n)):fa.prototype.set.apply(this,arguments)},getDisplayName(){return this.get("nickname")||this.get("fullname")||this.get("jid")}}),gg=fg,{Strophe:pg,$iq:vg,u:yg}=Jl.env;function _g(e,t,n){const i=vg(t?{type:e,to:t}:{type:e});return n?i.cnode(n):i.c("vCard",{xmlns:pg.NS.VCARD}),i}async function bg(e){let t;if(e instanceof Ya.Message){if("error"===e.get("type"))return;t=e.get("from")}else t=e.get("jid");await Wl.waitUntil("VCardsInitialized"),e.vcard=Ya.vcards.findWhere({jid:t}),e.vcard||(e.vcard=Ya.vcards.create({jid:t})),e.vcard.on("change",(()=>e.trigger("vcard:change"))),e.trigger("vcard:add")}function wg(e){var t;const n=null==e||null===(t=e.collection)||void 0===t?void 0:t.chatbox,i=pg.getResourceFromJid(e.get("from"));if(n&&n.get("nick")===i)return Ya.xmppstatus.vcard;{const t=e.occupant&&e.occupant.get("jid")||e.get("from");return t?Ya.vcards.findWhere({jid:t})||Ya.vcards.create({jid:t}):void R.error(`Could not assign VCard for message because no JID found! msgid: ${e.get("msgid")}`)}}async function Sg(e){await Wl.waitUntil("VCardsInitialized"),e.vcard=wg(e),e.vcard&&(e.vcard.on("change",(()=>e.trigger("vcard:change"))),e.trigger("vcard:add"))}async function xg(){Ya.vcards=new Ya.VCards;const e=`${Ya.bare_jid}-converse.vcards`;Oo(Ya.vcards,e),await new Promise((e=>{Ya.vcards.fetch({success:e,error:e},{silent:!0})}));const t=Ya.vcards;if(Ya.session){const e=Ya.session.get("bare_jid"),n=Ya.xmppstatus;n.vcard=t.findWhere({jid:e})||t.create({jid:e}),n.vcard&&(n.vcard.on("change",(()=>n.trigger("vcard:change"))),n.trigger("vcard:add"))}Wl.trigger("VCardsInitialized")}async function Eg(e){const t=pg.getBareJidFromJid(e)===Ya.bare_jid?null:e;let n;try{n=await Wl.sendIQ(_g("get",t))}catch(n){return{jid:e,stanza:n,vcard_error:(new Date).toISOString()}}return async function(e,t){const n=t.querySelector("vCard");let i={};var s,r,o,a,c,l,d;if(null!==n&&(i={stanza:t,fullname:null===(s=n.querySelector("FN"))||void 0===s?void 0:s.textContent,nickname:null===(r=n.querySelector("NICKNAME"))||void 0===r?void 0:r.textContent,image:null===(o=n.querySelector("PHOTO BINVAL"))||void 0===o?void 0:o.textContent,image_type:null===(a=n.querySelector("PHOTO TYPE"))||void 0===a?void 0:a.textContent,url:null===(c=n.querySelector("URL"))||void 0===c?void 0:c.textContent,role:null===(l=n.querySelector("ROLE"))||void 0===l?void 0:l.textContent,email:null===(d=n.querySelector("EMAIL USERID"))||void 0===d?void 0:d.textContent,vcard_updated:(new Date).toISOString(),vcard_error:void 0}),i.image){const e=yg.base64ToArrayBuffer(i.image),t=await crypto.subtle.digest("SHA-1",e);i.image_hash=yg.arrayBufferToHex(t)}return i}(0,n)}const{dayjs:Ag,u:Cg}=Jl.env,Tg={vcard:{async set(e,t){if(!e)throw Error("No jid provided for the VCard data");const n=document.createElement("div"),i=Cg.toStanza(`\n <vCard xmlns="vcard-temp">\n <FN>${t.fn}</FN>\n <NICKNAME>${t.nickname}</NICKNAME>\n <URL>${t.url}</URL>\n <ROLE>${t.role}</ROLE>\n <EMAIL><INTERNET/><PREF/><USERID>${t.email}</USERID></EMAIL>\n <PHOTO>\n <TYPE>${t.image_type}</TYPE>\n <BINVAL>${t.image}</BINVAL>\n </PHOTO>\n </vCard>`,n);let s;try{s=await Wl.sendIQ(_g("set",e,i))}catch(e){throw e}return await Wl.vcard.update(e,!0),s},get(e,t){if("string"==typeof e)return Eg(e);const n=e.get("vcard_error"),i=n&&Ag(n).isSame(new Date,"day");if(t||!e.get("vcard_updated")&&!i){const t=e.get("jid");return t||R.error("No JID to get vcard for"),Eg(t)}return Promise.resolve({})},async update(e,t){const n=await this.get(e,t);(e="string"==typeof e?Ya.vcards.findWhere({jid:e}):e)?(delete n.stanza,e.save(n)):R.error(`Could not find a VCard model for ${e}`)}}},{Strophe:kg}=Jl.env;Jl.plugins.add("converse-vcard",{dependencies:["converse-status","converse-roster"],overrides:{XMPPStatus:{getNickname(){const{_converse:e}=this.__super__,t=this.__super__.getNickname.apply(this);return!t&&e.xmppstatus.vcard?e.xmppstatus.vcard.get("nickname"):t},getFullname(){const{_converse:e}=this.__super__,t=this.__super__.getFullname.apply(this);return!t&&e.xmppstatus.vcard?e.xmppstatus.vcard.get("fullname"):t}},RosterContact:{getDisplayName(){return!this.get("nickname")&&this.vcard?this.vcard.getDisplayName():this.__super__.getDisplayName.apply(this)},getFullname(){return this.vcard?this.vcard.get("fullname"):this.__super__.getFullname.apply(this)}}},initialize(){Wl.promises.add("VCardsInitialized"),Ya.VCard=gg,Ya.VCards=Rc.extend({model:Ya.VCard,initialize(){this.on("add",(e=>e.get("jid")&&Wl.vcard.update(e)))}}),Wl.listen.on("chatRoomInitialized",(e=>{bg(e),e.occupants.forEach(Sg),e.listenTo(e.occupants,"add",Sg)})),Wl.listen.on("chatBoxInitialized",(e=>bg(e))),Wl.listen.on("chatRoomMessageInitialized",(e=>async function(e){["error","info"].includes(e.get("type"))||(await Wl.waitUntil("VCardsInitialized"),e.vcard=wg(e),e.vcard&&(e.vcard.on("change",(()=>e.trigger("vcard:change"))),e.trigger("vcard:add")))}(e))),Wl.listen.on("addClientFeatures",(()=>Wl.disco.own.features.add(kg.NS.VCARD))),Wl.listen.on("clearSession",(()=>{Ya.shouldClearCache()&&(Wl.promises.add("VCardsInitialized"),Ya.vcards&&(Ya.vcards.clearStore(),delete Ya.vcards))})),Wl.listen.on("messageInitialized",(e=>bg(e))),Wl.listen.on("rosterContactInitialized",(e=>bg(e))),Wl.listen.on("statusInitialized",xg),Object.assign(Ya.api,Tg)}});var jg=n(6066),$g=n.n(jg);const{dayjs:Ng}=Jl.env;function Og(e,t){return"string"==typeof e&&t.includes(e)}function Ig(e,t){return"string"!=typeof e||"en"!==e&&!t(e)?function(e){let t;if(window.navigator.userLanguage&&(t=Mg(window.navigator.userLanguage,e)),window.navigator.languages&&!t)for(let n=0;n<window.navigator.languages.length&&!t;n++)t=Mg(window.navigator.languages[n],e);return window.navigator.browserLanguage&&!t&&(t=Mg(window.navigator.browserLanguage,e)),window.navigator.language&&!t&&(t=Mg(window.navigator.language,e)),window.navigator.systemLanguage&&!t&&(t=Mg(window.navigator.systemLanguage,e)),t||"en"}(t)||"en":e}function Mg(e,t){if(t(e))return e;var n=e.split("-")[0];return n!==e&&t(n)?n:void 0}let Rg;Object.assign(o,{getLocale:(e,t)=>Ig(e,(e=>Og(e,t))),translate(e){if(!Rg)return $g().sprintf.apply($g(),arguments);const t=Rg.translate(e);return arguments.length>1?t.fetch.apply(t,[].slice.call(arguments,1)):t.fetch()},async initialize(){if(Ya.isTestEnv())Ya.locale="en";else try{const e=Wl.settings.get("i18n");Ya.locale=o.getLocale(e,Wl.settings.get("locales")),await async function(e){const{api:t,locale:i}=e,s=i.toLowerCase().replace("_","-");if(!Og(i,t.settings.get("locales"))||"en"===i)return;const{default:r}=await n(7521)(`./${i}/LC_MESSAGES/converse.po`);await n(9434)(`./${s}.js`),Ng.locale(Ig(s,(e=>Ng.locale(e)))),Rg=new($g())(r)}(Ya)}catch(e){R.fatal(e.message),Ya.locale="en"}},__(){return o.translate(...arguments)}});const Dg=o.__,Lg={};Wl.elements={registry:Lg,define:function(e,t){this.registry[e]=t},register:function(){Object.keys(Lg).forEach((e=>{customElements.get(e)||customElements.define(e,Lg[e])}))}};class zg extends Hl{createRenderRoot(){return this}connectedCallback(){var e;super.connectedCallback(),null===(e=this.initialize)||void 0===e||e.call(this)}disconnectedCallback(){super.disconnectedCallback(),this.stopListening()}}Object.assign(zg.prototype,$i);const Pg=["converse-bookmark-views","converse-chatboxviews","converse-chatview","converse-controlbox","converse-dragresize","converse-fullscreen","converse-headlines-view","converse-mam-views","converse-minimize","converse-modal","converse-muc-views","converse-notification","converse-omemo","converse-profile","converse-push","converse-register","converse-roomslist","converse-rootview","converse-rosterview","converse-singleton"];var Fg=n(3379),Ug=n.n(Fg),Bg=n(7795),qg=n.n(Bg),Hg=n(569),Gg=n.n(Hg),Wg=n(3565),Vg=n.n(Wg),Jg=n(9216),Qg=n.n(Jg),Zg=n(6655),Yg=n.n(Zg),Xg=n(9537),Kg={};Kg.styleTagTransform=Yg(),Kg.setAttributes=Vg(),Kg.insert=Gg().bind(null,"head"),Kg.domAPI=qg(),Kg.insertStyleElement=Qg(),Ug()(Xg.Z,Kg),Xg.Z&&Xg.Z.locals&&Xg.Z.locals;class ep extends zg{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=Ya.chatboxes.get(this.jid),this.bookmark=Ya.bookmarks.findWhere({jid:this.model.get("jid")})}render(){return(e=>{var t,n;const i=(null===(t=e.bookmark)||void 0===t?void 0:t.get("name"))??e.name,s=(null===(n=e.bookmark)||void 0===n?void 0:n.get("nick"))??e.nick,r=Dg('Bookmark for "%1$s"',i),o=Dg("Would you like this groupchat to be automatically joined upon startup?"),a=Dg("Remove"),c=Dg("The name for this bookmark:"),l=Dg("What should your nickname for this groupchat be?"),d=e.bookmark?Dg("Update"):Dg("Save");return xl`
<form class="converse-form chatroom-form" @submit=${e.onSubmit}>
<legend>${r}</legend>
<fieldset class="form-group">
<label for="converse_muc_bookmark_name">${c}</label>
<input class="form-control" type="text" value="${i}" name="name" required="required" id="converse_muc_bookmark_name"/>
</fieldset>
<fieldset class="form-group">
<label for="converse_muc_bookmark_nick">${l}</label>
<input class="form-control" type="text" name="nick" value="${s||""}" 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">${o}</label>
</fieldset>
<fieldset class="form-group">
<input class="btn btn-primary" type="submit" value="${d}">
${e.bookmark?xl`<input class="btn btn-secondary button-remove" type="button" value="${a}" @click=${e.onCancel}>`:""}
</fieldset>
</form>
`})(Object.assign(this.model.toJSON(),{bookmark:this.bookmark,onCancel:e=>this.removeBookmark(e),onSubmit:e=>this.onBookmarkFormSubmitted(e)}))}onBookmarkFormSubmitted(e){var t,n,i;e.preventDefault(),Ya.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===(i=e.target.querySelector("input[name=nick]"))||void 0===i?void 0:i.value}),this.closeBookmarkForm(e)}removeBookmark(e){var t;null===(t=this.bookmark)||void 0===t||t.destroy(),this.closeBookmarkForm(e)}closeBookmarkForm(e){e.preventDefault();const t=document.createEvent("Event");t.initEvent("hide.bs.modal",!0,!0),this.dispatchEvent(t)}}Wl.elements.define("converse-muc-bookmark-form",ep);const tp=ep;var np=n(1505),ip=n.n(np);const sp=/^\s*</,rp=("undefined"!=typeof Element&&Element.prototype,function(e){this.cid=ji("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),kt(this,Uo(e,ap)),this._ensureElement(),this.initialize.apply(this,arguments)});rp.extend=Qi;const op=/^(\S+)\s*(.*)$/,ap=["model","collection","el","id","attributes","className","tagName","events"];Object.assign(rp.prototype,$i,{tagName:"div",$:function(e){return this.el.querySelectorAll(e)},preinitialize:function(){},initialize:function(){},render:function(){return _e(this.beforeRender)&&this.beforeRender(),_e(this.toHTML)&&Tl(this.toHTML(),this.el),_e(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(sp.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=Ji(this,"events")),!e)return this;this.undelegateEvents();for(const t in e){let n=e[t];if(_e(n)||(n=this[n]),!n)continue;const i=t.match(op);this.delegate(i[1],i[2],n.bind(this))}return this},delegate:function(e,t,n){const i=this.el;if(!i)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const i=this.el.querySelectorAll(t);for(let t=0,s=i.length;t<s;t++){const s=i[t];s.addEventListener(e,n,!1),this._domEvents.push({el:s,eventName:e,handler:n})}return n}const s=t?function(e){let s=e.target||e.srcElement;for(;s&&s!=i;s=s.parentNode)s.matches(t)&&(e.delegateTarget=s,n(e))}:n;return this.el.addEventListener(e,s,!1),this._domEvents.push({el:this.el,eventName:e,handler:s,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 i=this._domEvents.slice();let s=i.length;for(;s--;){const r=i[s];!(r.eventName!==e||n&&r.listener!==n||t&&r.selector!==t)&&(r.el.removeEventListener(r.eventName,r.handler,!1),this._domEvents.splice(s,1))}}return this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(Ji(this,"el"));else{const e=kt({},Ji(this,"attributes"));this.id&&(e.id=Ji(this,"id")),this.className&&(e.class=Ji(this,"className")),this.setElement(this._createElement(Ji(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])}});var cp=n(1638),lp={};lp.styleTagTransform=Yg(),lp.setAttributes=Vg(),lp.insert=Gg().bind(null,"head"),lp.domAPI=qg(),lp.insertStyleElement=Qg(),Ug()(cp.Z,lp),cp.Z&&cp.Z.locals&&cp.Z.locals;const{sizzle:dp}=Jl.env,up=Jl.env.utils,hp=rp.extend({className:"modal",persistent:!1,events:{"click .nav-item .nav-link":"switchTab"},initialize(e){if(!this.id)throw new Error("Each modal class must have a unique id attribute");Object.assign(this,e),this.render(),this.el.setAttribute("tabindex","-1"),this.el.setAttribute("role","dialog"),this.el.setAttribute("aria-hidden","true");const t=this.el.querySelector(".modal-title").getAttribute("id");t&&this.el.setAttribute("aria-labelledby",t),this.insertIntoDOM();const n=ip().Modal;this.modal=new n(this.el,{backdrop:!0,keyboard:!0}),this.el.addEventListener("hide.bs.modal",(()=>this.onHide()),!1)},onHide(){up.removeClass("selected",this.trigger_el),!this.persistent&&Wl.modal.remove(this)},insertIntoDOM(){document.querySelector("#converse-modals").insertAdjacentElement("beforeEnd",this.el)},switchTab(e){e.stopPropagation(),e.preventDefault(),dp(".nav-link.active",this.el).forEach((e=>{up.removeClass("active",this.el.querySelector(e.getAttribute("href"))),up.removeClass("active",e)})),up.addClass("active",e.target),up.addClass("active",this.el.querySelector(e.target.getAttribute("href")))},alert(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"primary";const n=this.el.querySelector(".modal-alert");if(null===n)return void R.error("Could not find a .modal-alert element in the modal to show an alert message in!");Tl((e=>xl`<div class="alert ${e.type}" role="alert"><p>${e.message}</p></div>`)({type:`alert-${t}`,message:e}),n);const i=n.firstElementChild;setTimeout((()=>{up.addClass("fade-out",i),setTimeout((()=>up.removeElement(i)),600)}),5e3)},show(e){e&&(e.preventDefault(),this.trigger_el=e.target,!up.hasClass("chat-image",this.trigger_el)&&up.addClass("selected",this.trigger_el)),this.modal.show()}}),mp=hp,fp=xl`<button type="button" class="btn btn-secondary" data-dismiss="modal">${Dg("Close")}</button>`,gp=xl`<button type="button" class="close" data-dismiss="modal" aria-label="${Dg("Close")}"><span aria-hidden="true">×</span></button>`,pp=mp.extend({id:"converse-bookmark-modal",initialize(e){this.jid=e.jid,this.affiliation=e.affiliation,mp.prototype.initialize.apply(this,arguments)},toHTML(){return(e=>{const t=Dg("Bookmark");return xl`
<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>
${gp}
</div>
<div class="modal-body d-flex flex-column">
<converse-muc-bookmark-form class="muc-form-container" jid="${e.jid}"></converse-muc-bookmark-form>
</div>
</div>
</div>`})(this)}}),vp=pp;var yp=Ze((function(e,t,n){var i=-1,s="function"==typeof t,r=Xe(e)?Array(e.length):[];return hi(e,(function(e){r[++i]=s?Fe(t,e,n):nc(e,t,n)})),r}));const _p=yp;function bp(e,t){if(Wl.settings.get("allow_bookmarks")&&e.model.get("type")===Ya.CHATROOMS_TYPE){const n=e.model.get("bookmarked"),i={i18n_title:Dg(n?"Unbookmark this groupchat":"Bookmark this groupchat"),i18n_text:Dg(n?"Unbookmark":"Bookmark"),handler:t=>e.showBookmarkModal(t),a_class:"toggle-bookmark",icon_class:"fa-bookmark",name:"bookmark"},s=t.map((e=>e.name)).indexOf("details"),r=Zh().then((e=>e?i:null));return s>-1?[...t.slice(0,s),r,...t.slice(s)]:[r,...t]}return t}function wp(e){e.preventDefault();const t=e.target.getAttribute("data-bookmark-name"),n=e.target.getAttribute("data-room-jid");confirm(Dg('Are you sure you want to remove the bookmark "%1$s"?',t))&&_p(Ya.bookmarks.where({jid:n}),fa.prototype.destroy)}function Sp(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid");Wl.modal.show(vp,{jid:t},e)}function xp(e){e.preventDefault();const{Strophe:t}=Jl.env,n=e.target.textContent,i=e.target.getAttribute("data-room-jid"),s={name:n||t.unescapeNode(t.getNodeFromJid(i))||i};Wl.rooms.open(i,s,!0)}const Ep=e=>{const t=e.bm.get("jid"),n=!(!Wl.settings.get("hide_open_bookmarks")||!Ya.chatboxes.get(t)),i=Dg("Unbookmark this groupchat"),s=Dg("Click to open this groupchat");return xl`
<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="${s}"
@click=${xp}>${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="${i}"
@click=${wp}></a>
</div>
`};"undefined"!=typeof Element&&Element.prototype;const Ap=/^(\S+)\s*(.*)$/,Cp=["model","collection","events"];class Tp extends HTMLElement{constructor(e){var t,n,i;super(),i={},(n="events")in(t=this)?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,this.cid=ji("view"),this._domEvents=[],kt(this,Uo(e,Cp))}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 _e(this.beforeRender)&&this.beforeRender(),_e(this.toHTML)&&Tl(this.toHTML(),this),_e(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(_e(t)||(t=this[t]),!t)continue;const n=e.match(Ap);this.delegate(n[1],n[2],t.bind(this))}return this}delegate(e,t,n){const i=this;if(!i)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const i=this.querySelectorAll(t);for(let t=0,s=i.length;t<s;t++){const s=i[t];s.addEventListener(e,n,!1),this._domEvents.push({el:s,eventName:e,handler:n})}return n}const s=t?function(e){let s=e.target||e.srcElement;for(;s&&s!=i;s=s.parentNode)s.matches(t)&&(e.delegateTarget=s,n(e))}:n;return this.addEventListener(e,s,!1),this._domEvents.push({el:this,eventName:e,handler:s,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 i=this._domEvents.slice();let s=i.length;for(;s--;){const r=i[s];!(r.eventName!==e||n&&r.listener!==n||t&&r.selector!==t)&&(r.el.removeEventListener(r.eventName,r.handler,!1),this._domEvents.splice(s,1))}}return this}}Object.assign(Tp.prototype,$i);const kp=Jl.env.utils;class jp extends Tp{async initialize(){await Wl.waitUntil("bookmarksInitialized"),this.listenTo(Ya.bookmarks,"add",this.render),this.listenTo(Ya.bookmarks,"remove",this.render),this.listenTo(Ya.chatboxes,"add",this.render),this.listenTo(Ya.chatboxes,"remove",this.render);const e=`converse.bookmarks-list-model-${Ya.bare_jid}`;this.model=new Ya.BookmarksList({id:e}),Oo(this.model,e),this.model.fetch({success:()=>this.render(),error:(e,t)=>{R.error(t),this.render()}})}render(){Tl((e=>{const t=!!Ya.bookmarks.getUnopenedBookmarks().length,n=Dg("Click to toggle the bookmarks list"),i=Dg("Bookmarks");return xl`
<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===Ya.OPENED?"fa-caret-down":"fa-caret-right"}">
</span> ${i}</a>
<div class="items-list bookmarks rooms-list ${e.toggle_state!==Ya.OPENED?"hidden":""}">
${Ya.bookmarks.map((t=>Ep(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");kp.hasClass("fa-caret-down",n)?(kp.slideIn(this.querySelector(".bookmarks")),this.model.save({"toggle-state":Ya.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"),kp.slideOut(this.querySelector(".bookmarks")),this.model.save({"toggle-state":Ya.OPENED}))}}Wl.elements.define("converse-bookmarks",jp);const{u:$p}=Jl.env,Np={setBookmarkState(){void 0!==Ya.bookmarks&&(Ya.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 Ya.MUCBookmarkForm({model:this.model,chatroomview:this}),this.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)),$p.showElement(this.bookmark_form.el)},showBookmarkModal(e){null==e||e.preventDefault();const t=this.model.get("jid");Wl.modal.show(vp,{jid:t},e)}};var Op=n(5251),Ip={};Ip.styleTagTransform=Yg(),Ip.setAttributes=Vg(),Ip.insert=Gg().bind(null,"head"),Ip.domAPI=qg(),Ip.insertStyleElement=Qg(),Ug()(Op.Z,Ip),Op.Z&&Op.Z.locals&&Op.Z.locals,Jl.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Wl.settings.extend({hide_open_bookmarks:!0}),Ya.removeBookmarkViaEvent=wp,Ya.addBookmarkViaEvent=Sp,Object.assign(Ya.ChatRoomView.prototype,Np),Ya.MUCBookmarkForm=tp,Ya.BookmarksView=jp,Wl.listen.on("getHeadingButtons",bp),Wl.listen.on("chatRoomViewInitialized",(e=>e.setBookmarkState()))}});const Mp=e=>function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return{_$litDirective$:e,values:n}};class Rp{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const{H:Dp}=Fl,Lp=()=>document.createComment(""),zp=(e,t,n)=>{var i;const s=e._$AA.parentNode,r=void 0===t?e._$AB:t._$AA;if(void 0===n){const t=s.insertBefore(Lp(),r),i=s.insertBefore(Lp(),r);n=new Dp(t,i,e,e.options)}else{const t=n._$AB.nextSibling,o=n._$AM,a=o!==e;if(a){let t;null===(i=n._$AQ)||void 0===i||i.call(n,e),n._$AM=e,void 0!==n._$AP&&(t=e._$AU)!==o._$AU&&n._$AP(t)}if(t!==r||a){let e=n._$AA;for(;e!==t;){const t=e.nextSibling;s.insertBefore(e,r),e=t}}}return n},Pp=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return e._$AI(t,n),e},Fp={},Up=e=>{var t;null===(t=e._$AP)||void 0===t||t.call(e,!1,!0);let n=e._$AA;const i=e._$AB.nextSibling;for(;n!==i;){const e=n.nextSibling;n.remove(),n=e}},Bp=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},qp=Mp(class extends Rp{constructor(e){if(super(e),2!==e.type)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;void 0===n?n=t:void 0!==t&&(i=t);const s=[],r=[];let o=0;for(const t of e)s[o]=i?i(t,o):o,r[o]=n(t,o),o++;return{values:r,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,t){let[n,i,s]=t;var r;const o=(e=>e._$AH)(e),{values:a,keys:c}=this.dt(n,i,s);if(!Array.isArray(o))return this.ut=c,a;const l=null!==(r=this.ut)&&void 0!==r?r:this.ut=[],d=[];let u,h,m=0,f=o.length-1,g=0,p=a.length-1;for(;m<=f&&g<=p;)if(null===o[m])m++;else if(null===o[f])f--;else if(l[m]===c[g])d[g]=Pp(o[m],a[g]),m++,g++;else if(l[f]===c[p])d[p]=Pp(o[f],a[p]),f--,p--;else if(l[m]===c[p])d[p]=Pp(o[m],a[p]),zp(e,d[p+1],o[m]),m++,p--;else if(l[f]===c[g])d[g]=Pp(o[f],a[g]),zp(e,o[m],o[f]),f--,g++;else if(void 0===u&&(u=Bp(c,g,p),h=Bp(l,m,f)),u.has(l[m]))if(u.has(l[f])){const t=h.get(c[g]),n=void 0!==t?o[t]:null;if(null===n){const t=zp(e,o[m]);Pp(t,a[g]),d[g]=t}else d[g]=Pp(n,a[g]),zp(e,o[m],n),o[t]=null;g++}else Up(o[f]),f--;else Up(o[m]),m++;for(;g<=p;){const t=zp(e,d[p+1]);Pp(t,a[g]),d[g++]=t}for(;m<=f;){const e=o[m++];null!==e&&Up(e)}return this.ut=c,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fp;e._$AH=t}(e,d),El}});function Hp(e){const{CONTROLBOX_TYPE:t}=Ya,n="overlayed"===Wl.settings.get("view_mode")&&e.get("minimized");return e.get("type")===t||!(e.get("hidden")||n)}Wl.elements.define("converse-chats",class extends zg{initialize(){this.model=Ya.chatboxes,this.listenTo(this.model,"add",(()=>this.requestUpdate())),this.listenTo(this.model,"change:closed",(()=>this.requestUpdate())),this.listenTo(this.model,"change:hidden",(()=>this.requestUpdate())),this.listenTo(this.model,"change:jid",(()=>this.requestUpdate())),this.listenTo(this.model,"change:minimized",(()=>this.requestUpdate())),this.listenTo(this.model,"destroy",(()=>this.requestUpdate())),this.listenTo(Ya,"connected",(()=>this.requestUpdate())),this.listenTo(Ya,"reconnected",(()=>this.requestUpdate())),this.listenTo(Ya,"disconnected",(()=>this.requestUpdate()));const e=Va();this.listenTo(e,"change:view_mode",(()=>this.requestUpdate())),this.listenTo(e,"change:singleton",(()=>this.requestUpdate()));const t=document.getElementById("conversejs-bg");t&&!t.innerHTML.trim()&&Tl(xl`
<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"===Wl.settings.get("view_mode")?xl`<div class="converse-brand__padding"></div>`:""}
</div>`,t),document.querySelector("body").classList.add(`converse-${Wl.settings.get("view_mode")}`),Wl.trigger("chatBoxViewsInitialized")}render(){return(()=>{const{chatboxes:e,CONTROLBOX_TYPE:t,CHATROOMS_TYPE:n,HEADLINES_TYPE:i}=Ya,s=Wl.settings.get("view_mode"),r=null==Ya?void 0:Ya.connection,o=!(null!=r&&r.connected)||!(null!=r&&r.authenticated)||(null==r?void 0:r.disconnecting);return xl`
${o||"overlayed"!==s?"":xl`<converse-minimized-chats></converse-minimized-chats>`}
${qp(e.filter(Hp),(e=>e.get("jid")),(e=>e.get("type")===t?xl`
${"overlayed"===s?xl`<converse-controlbox-toggle class="${e.get("closed")?"":"hidden"}"></converse-controlbox-toggle>`:""}
<converse-controlbox
id="controlbox"
class="chatbox ${"overlayed"===s&&e.get("closed")?"hidden":""} ${o?"logged-out":""}"
style="${e.get("width")?`width: ${e.get("width")}`:""}"></converse-controlbox>
`:e.get("type")===n?xl`
<converse-muc jid="${e.get("jid")}" class="chatbox chatroom"></converse-muc>
`:e.get("type")===i?xl`
<converse-headlines jid="${e.get("jid")}" class="chatbox headlines"></converse-headlines>
`:xl`
<converse-chat jid="${e.get("jid")}" class="chatbox"></converse-chat>
`))}
`})()}});function Gp(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",`${e}px`)}var Wp=n(6931),Vp={};Vp.styleTagTransform=Yg(),Vp.setAttributes=Vg(),Vp.insert=Gg().bind(null,"head"),Vp.domAPI=qg(),Vp.insertStyleElement=Qg(),Ug()(Wp.Z,Vp),Wp.Z&&Wp.Z.locals&&Wp.Z.locals,Jl.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Wl.promises.add(["chatBoxViewsInitialized"]),Wl.settings.extend({animate:!0}),Ya.chatboxviews=new class{constructor(){this.views={}}add(e,t){this.views[e]=t}get(e){return this.views[e]}xget(e){return this.keys().filter((t=>t!==e)).reduce(((e,t)=>(e[t]=this.views[t],e)),{})}getAll(){return Object.values(this.views)}keys(){return Object.keys(this.views)}remove(e){delete this.views[e]}map(e){return Object.values(this.views).map(e)}forEach(e){return Object.values(this.views).forEach(e)}filter(e){return Object.values(this.views).filter(e)}closeAllChatBoxes(){return Promise.all(Object.values(this.views).map((e=>e.close({name:"closeAllChatBoxes"}))))}},Wl.listen.on("chatBoxesInitialized",(()=>{Ya.chatboxes.on("destroy",(e=>Ya.chatboxviews.remove(e.get("jid"))))})),Wl.listen.on("cleanup",(()=>delete Ya.chatboxviews)),Wl.listen.on("clearSession",(()=>Ya.chatboxviews.closeAllChatBoxes())),Wl.listen.on("chatBoxViewsInitialized",Gp),window.addEventListener("resize",Gp),Object.assign(Jl,{insertInto(e){var t;const n=null===(t=Ya.chatboxviews)||void 0===t?void 0:t.el;if(n&&!e.contains(n))e.insertAdjacentElement("afterBegin",n);else if(!n)throw new Error("Cannot insert non-existing #conversejs element into the DOM")}})}});const Jp=mp.extend({id:"alert-modal",initialize(){mp.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){return(e=>xl`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header ${e.level}">
<h5 class="modal-title">${e.title}</h5>
${gp}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
${e.messages.map((e=>xl`<p>${e}</p>`))}
</div>
</div>
</div>`)(Object.assign({__:Dg},this.model.toJSON()))}}),Qp=Jp,Zp=mp.extend({id:"confirm-modal",events:{"submit .confirm":"onConfimation"},initialize(){this.confirmation=fo(),mp.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=>xl`
<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">
${e.messages.map((e=>xl`<p>${e}</p>`))}
</div>
${e.fields.map((e=>(e=>xl`
<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>
`)(e)))}
<div class="form-group">
<button type="submit" class="btn btn-primary">${Dg("OK")}</button>
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${Dg("Cancel")}"/>
</div>
</form>
</div>
</div>
</div>
`)(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()}}),Yp=Zp;let Xp=[];const Kp={modal:{show(e,t,n){const i=this.get(e.id)||this.create(e,t);return i.show(n),i},get:e=>Xp.filter((t=>t.id==e)).pop(),create(e,t){const n=new e(t);return Xp.push(n),n},remove(e){Xp=Xp.filter((t=>t!==e)),e.remove()},removeAll(){Xp.forEach((e=>e.remove())),Xp=[]}},async confirm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];"string"==typeof t&&(t=[t]);const n=new fa({title:e,messages:t,fields:arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],type:"confirm"}),i=new Yp({model:n});let s;i.show();try{s=await i.confirmation}catch(e){s=!1}return i.remove(),s},async prompt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];"string"==typeof t&&(t=[t]);const n=new fa({title:e,messages:t,fields:[{name:"reason",placeholder:arguments.length>2&&void 0!==arguments[2]?arguments[2]:""}],type:"prompt"}),i=new Yp({model:n});let s;i.show();try{var r;s=null===(r=(await i.confirmation).pop())||void 0===r?void 0:r.value}catch(e){s=!1}return i.remove(),s},alert(e,t,n){let i;"string"==typeof n&&(n=[n]),"error"===e?i="alert-danger":"info"===e?i="alert-info":"warn"===e&&(i="alert-warning");const s=new fa({title:t,messages:n,level:i,type:"alert"});Kp.modal.show(Qp,{model:s})}},ev=Kp;Jl.env.BootstrapModal=mp,Jl.plugins.add("converse-modal",{initialize(){Wl.listen.on("disconnect",(()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")})),Wl.listen.on("clearSession",(()=>Wl.modal.removeAll())),Object.assign(Ya.api,ev)}});const tv=(e,t)=>{var n,i;const s=e._$AN;if(void 0===s)return!1;for(const e of s)null===(i=(n=e)._$AO)||void 0===i||i.call(n,t,!1),tv(e,t);return!0},nv=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===(null==n?void 0:n.size))},iv=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),ov(t)}};function sv(e){void 0!==this._$AN?(nv(this),this._$AM=e,iv(this)):this._$AM=e}function rv(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const i=this._$AH,s=this._$AN;if(void 0!==s&&0!==s.size)if(t)if(Array.isArray(i))for(let e=n;e<i.length;e++)tv(i[e],!1),nv(i[e]);else null!=i&&(tv(i,!1),nv(i));else tv(this,e)}const ov=e=>{var t,n,i,s;2==e.type&&(null!==(t=(i=e)._$AP)&&void 0!==t||(i._$AP=rv),null!==(n=(s=e)._$AQ)&&void 0!==n||(s._$AQ=sv))};class av extends Rp{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),iv(this),this.isConnected=e._$AU}_$AO(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var n,i;e!==this.isConnected&&(this.isConnected=e,e?null===(n=this.reconnected)||void 0===n||n.call(this):null===(i=this.disconnected)||void 0===i||i.call(this)),t&&(tv(this,e),nv(this))}setValue(e){if((e=>void 0===this._$Ct.strings)())this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}class cv{constructor(e){this.U=e}disconnect(){this.U=void 0}reconnect(e){this.U=e}deref(){return this.U}}class lv{constructor(){this.Y=void 0,this.q=void 0}get(){return this.Y}pause(){var e;null!==(e=this.Y)&&void 0!==e||(this.Y=new Promise((e=>this.q=e)))}resume(){var e;null===(e=this.q)||void 0===e||e.call(this),this.Y=this.q=void 0}}const dv=e=>!(e=>null===e||"object"!=typeof e&&"function"!=typeof e)(e)&&"function"==typeof e.then,uv=Mp(class extends av{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CG=new cv(this),this._$CK=new lv}render(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return null!==(e=n.find((e=>!dv(e))))&&void 0!==e?e:El}update(e,t){const n=this._$Cyt;let i=n.length;this._$Cyt=t;const s=this._$CG,r=this._$CK;this.isConnected||this.disconnected();for(let e=0;e<t.length&&!(e>this._$Cwt);e++){const o=t[e];if(!dv(o))return this._$Cwt=e,o;e<i&&o===n[e]||(this._$Cwt=1073741823,i=0,Promise.resolve(o).then((async e=>{for(;r.get();)await r.get();const t=s.deref();if(void 0!==t){const n=t._$Cyt.indexOf(o);n>-1&&n<t._$Cwt&&(t._$Cwt=n,t.setValue(e))}})))}return El}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}});var hv=n(4166),mv={};mv.styleTagTransform=Yg(),mv.setAttributes=Vg(),mv.insert=Gg().bind(null,"head"),mv.domAPI=qg(),mv.insertStyleElement=Qg(),Ug()(hv.Z,mv),hv.Z&&hv.Z.locals&&hv.Z.locals;const{Strophe:fv,u:gv}=Jl.env;class pv extends zg{static get properties(){return{is_retracted:{type:Boolean},model:{type:Object}}}initialize(){const e=Va();this.listenTo(e,"change:allowed_audio_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:allowed_image_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:allowed_video_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:render_media",(()=>this.requestUpdate())),this.listenTo(this.model,"change",(()=>this.requestUpdate()))}render(){return xl`${uv(this.renderActions(),"")}`}async renderActions(){const e=this.model.collection.length>2&&this.model===this.model.collection.last(),t=(await this.getActionButtons()).map((e=>pv.getActionsDropdownItem(e)));return t.length?xl`<converse-dropdown
class="chat-msg__actions ${e?"dropup dropup--left":"dropleft"}"
.items=${t}
></converse-dropdown>`:""}static getActionsDropdownItem(e){return xl`
<button class="chat-msg__action ${e.button_class}" @click=${e.handler}>
<converse-icon
class="${e.icon_class}"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${e.i18n_text}
</button>
`}onMessageEditButtonClicked(e){var t,n;e.preventDefault();const i=this.model.collection.findWhere("correcting"),s=null===(t=gv.ancestor(this,".chatbox"))||void 0===t||null===(n=t.querySelector(".chat-textarea"))||void 0===n?void 0:n.value;(!s||i&&i.getMessageText()===s||confirm(Dg("You have an unsent message which will be lost if you continue. Are you sure?")))&&(i!==this.model?(null==i||i.save("correcting",!1),this.model.save("correcting",!0)):this.model.save("correcting",!1))}async onDirectMessageRetractButtonClicked(){if("me"!==this.model.get("sender"))return R.error("onMessageRetractButtonClicked called for someone else's message!");const e=Dg("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),t=[Dg("Are you sure you want to retract this message?")];Wl.settings.get("show_retraction_warning")&&(t[1]=e),await Wl.confirm(Dg("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=Dg("A timeout occurred while trying to retract the message");Wl.alert("error",Dg("Error"),e),R(e,fv.LogLevel.WARN)}else if(gv.isErrorStanza(n)){const e=Dg("Sorry, you're not allowed to retract this message.");Wl.alert("error",Dg("Error"),e),R(e,fv.LogLevel.WARN),R(n,fv.LogLevel.WARN)}}async onMUCMessageRetractButtonClicked(){const e=Dg("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=[Dg("Are you sure you want to retract this message?")];Wl.settings.get("show_retraction_warning")&&(t[1]=e),await Wl.confirm(Dg("Confirm"),t)&&this.model.collection.chatbox.retractOwnMessage(this.model)}else if(await this.model.mayBeModerated())if("me"===this.model.get("sender")){let t=[Dg("Are you sure you want to retract this message?")];Wl.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]),await Wl.confirm(Dg("Confirm"),t)&&this.retractOtherMessage()}else{let t=[Dg("You are about to retract this message."),Dg("You may optionally include a message, explaining the reason for the retraction.")];Wl.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]);const n=await Wl.prompt(Dg("Message Retraction"),t,Dg("Optional reason"));!1!==n&&this.retractOtherMessage(n)}else{const e=Dg("Sorry, you're not allowed to retract this message");Wl.alert("error",Dg("Error"),e)}}onMessageRetractButtonClicked(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.collection.chatbox.get("type")===Ya.CHATROOMS_TYPE?this.onMUCMessageRetractButtonClicked():this.onDirectMessageRetractButtonClicked()}onMediaToggleClicked(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.hasHiddenMedia(this.getMediaURLs())?this.model.save({hide_url_previews:!1,url_preview_transition:"fade-in"}):(this.model.get("ogp_metadata")||[]).length?this.model.set("url_preview_transition","fade-out"):this.model.save({hide_url_previews:!0,url_preview_transition:"fade-in"})}hasHiddenMedia(e){if("boolean"==typeof this.model.get("hide_url_previews"))return this.model.get("hide_url_previews");const t=Wl.settings.get("render_media");return Array.isArray(t)?e.reduce(((e,n)=>e||!nd(t,n)),!1):!t}getMediaURLs(){const e=(this.model.get("ogp_metadata")||[]).map((e=>({url:e["og:image"],is_image:!0}))).filter((e=>od(e))),t=qd(this.model.get("media_urls")||[],this.model.get("body")).filter((e=>od(e)));return[...new Set([...t.map((e=>e.url)),...e.map((e=>e.url))])]}addMediaRenderingToggle(e){const t=this.getMediaURLs();if(t.length){const n=this.hasHiddenMedia(t);e.push({i18n_text:Dg(n?"Show media":"Hide media"),handler:e=>this.onMediaToggleClicked(e),button_class:"chat-msg__action-hide-previews",icon_class:n?"fas fa-eye":"fas fa-eye-slash",name:"hide"})}}async getActionButtons(){const e=[];this.model.get("editable")&&e.push({i18n_text:this.model.get("correcting")?Dg("Cancel Editing"):Dg("Edit"),handler:e=>this.onMessageEditButtonClicked(e),button_class:"chat-msg__action-edit",icon_class:"fa fa-pencil-alt",name:"edit"});const t=["groupchat","mep"].includes(this.model.get("type"))&&await this.model.mayBeModerated();return!this.is_retracted&&(this.model.mayBeRetracted()||t)&&e.push({i18n_text:Dg("Retract"),handler:e=>this.onMessageRetractButtonClicked(e),button_class:"chat-msg__action-retract",icon_class:"fas fa-trash-alt",name:"retract"}),this.model.collection?(this.addMediaRenderingToggle(e),Wl.hook("getMessageActionButtons",this,e)):[]}}Wl.elements.define("converse-message-actions",pv);const vv=mp.extend({id:"image-modal",toHTML(){return(e=>xl`
<div class="modal-dialog fit-content" role="document">
<div class="modal-content fit-content">
<div class="modal-header">
<h4 class="modal-title" id="message-versions-modal-label">${Dg("Image: ")}<a target="_blank" rel="noopener" href="${e.src}">${e.src}</a></h4>
${gp}
</div>
<div class="modal-body modal-body--image fit-content">
<img class="chat-image" src="${e.src}" @load=${e.onload}>
</div>
<div class="modal-footer">${fp}</div>
</div>
</div>`)({src:this.src,onload:e=>e.target.parentElement.style.height=`${e.target.height}px`})}}),yv=(e,t)=>xl`<audio controls src="${e}"></audio>${t?"":xl`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`;class _v{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 bv(e){return e.reduce((function(e,t){return 2*e+t}),0)}function wv(e){const t=[];for(let n=7;n>=0;n--)t.push(!!(e&1<<n));return t}function Sv(e){let t,n;n="";do{t=e.readByte(),n+=e.read(t)}while(0!==t);return n}function xv(e,t){const n=[];for(let i=0;i<t;i++)n.push(e.readBytes(3));return n}function Ev(e,t){const n={};if(n.sig=e.read(3),n.ver=e.read(3),"GIF"!==n.sig)throw new Error("Not a GIF file.");n.width=e.readUnsigned(),n.height=e.readUnsigned();const i=wv(e.readByte());n.gctFlag=i.shift(),n.colorRes=bv(i.splice(0,3)),n.sorted=i.shift(),n.gctSize=bv(i.splice(0,3)),n.bgColor=e.readByte(),n.pixelAspectRatio=e.readByte(),n.gctFlag&&(n.gct=xv(e,1<<n.gctSize+1)),null==t||t(n)}function Av(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 i=wv(e.readByte());t.reserved=i.splice(0,3),t.disposalMethod=bv(i.splice(0,3)),t.userInput=i.shift(),t.transparencyGiven=i.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=Sv(e),n.com&&n.com(t)}(t);break;case 1:t.extType="pte",function(t){e.readByte(),t.ptHeader=e.readBytes(12),t.ptData=Sv(e),n.pte&&n.pte(t)}(t);break;case 255:t.extType="app",function(t){e.readByte(),t.identifier=e.read(8),t.authCode=e.read(3),"NETSCAPE"===t.identifier?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):function(t){t.appData=Sv(e),n.app&&n.app[t.identifier]&&n.app[t.identifier](t)}(t)}(t);break;default:t.extType="unknown",function(t){t.data=Sv(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 i=wv(e.readByte());t.lctFlag=i.shift(),t.interlaced=i.shift(),t.sorted=i.shift(),t.reserved=i.splice(0,2),t.lctSize=bv(i.splice(0,3)),t.lctFlag&&(t.lct=xv(e,1<<t.lctSize+1)),t.lzwMinCodeSize=e.readByte();const s=Sv(e);t.pixels=function(e,t){let n=0;function i(e){let i=0;for(let s=0;s<e;s++)t.charCodeAt(n>>3)&1<<(7&n)&&(i|=1<<s),n++;return i}const s=[],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=i(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]))}s.push.apply(s,c[d]),c.length===1<<a&&a<12&&a++}else l();return s}(t.lzwMinCodeSize,s),t.interlaced&&(t.pixels=function(e,t){const n=new Array(e.length),i=e.length/t;function s(i,s){const r=e.slice(s*t,(s+1)*t);n.splice.apply(n,[i*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<i;t+=o[e])s(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((()=>Av(e,t)),0)}class Cv{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_offsets=[],this.frames=[],this.last_disposal_method=null,this.last_img=null,this.load_error=null,this.playing=this.options.autoplay,this.transparency=null,this.frame_idx=0,this.iteration_count=0,this.start=null,this.initialize()}async initialize(){this.options.width&&this.options.height&&this.setSizes(this.options.width,this.options.height);const e=await this.fetchGIF(this.gif_el.src);requestAnimationFrame((()=>this.startParsing(e)))}initPlayer(){if(!this.load_error&&(this.options.width&&this.options.height||this.ctx.scale(this.getCanvasScale(),this.getCanvasScale()),this.frame_idx=0,this.putFrame(this.frame_idx),this.options.autoplay)){var e;const t=10*((null===(e=this.frames[this.frame_idx])||void 0===e?void 0:e.delay)??0);setTimeout((()=>this.play()),t)}}getNextFrameNo(){return(this.frame_idx+1+this.frames.length)%this.frames.length}onIterationEnd(){var e,t;return this.iteration_count++,null===(e=(t=this.options).onIterationEnd)||void 0===e||e.call(t,this),!this.options.loop&&(this.pause(),!0)}onAnimationFrame(e,t,n){var i;if(!this.playing)return;if(e-t<n)return this.hovering?this.drawPauseIcon():this.putFrame(this.frame_idx),void requestAnimationFrame((e=>this.onAnimationFrame(e,t,n)));const s=this.getNextFrameNo();if(0===s&&this.onIterationEnd())return;this.frame_idx=s,this.putFrame(this.frame_idx);const r=10*((null===(i=this.frames[this.frame_idx])||void 0===i?void 0:i.delay)||8);requestAnimationFrame((t=>this.onAnimationFrame(t,e,r)))}setSizes(e,t){this.canvas.width=e*this.getCanvasScale(),this.canvas.height=t*this.getCanvasScale(),this.offscreenCanvas.width=e,this.offscreenCanvas.height=t,this.offscreenCanvas.style.width=e+"px",this.offscreenCanvas.style.height=t+"px",this.offscreenCanvas.getContext("2d").setTransform(1,0,0,1,0,0)}setFrameOffset(e,t){this.frame_offsets[e]?(void 0!==t.x&&(this.frame_offsets[e].x=t.x),void 0!==t.y&&(this.frame_offsets[e].y=t.y)):this.frame_offsets[e]=t}doShowProgress(e,t,n){if(n&&this.options.show_progress_bar){let n=this.options.progress_bar_height;const i=(this.canvas.height-n)/(this.ctx_scaled?this.getCanvasScale():1),s=e/t*this.canvas.width/(this.ctx_scaled?this.getCanvasScale():1),r=this.canvas.width/(this.ctx_scaled?this.getCanvasScale():1);n/=this.ctx_scaled?this.getCanvasScale():1,this.ctx.fillStyle=this.options.progress_bg_color,this.ctx.fillRect(s,i,r-s,n),this.ctx.fillStyle=this.options.progress_color,this.ctx.fillRect(0,i,s,n)}}startParsing(e){const t=new _v(e),n={hdr:this.withProgress(t,(e=>this.handleHeader(e))),gce:this.withProgress(t,(e=>this.handleGCE(e))),com:this.withProgress(t),img:this.withProgress(t,(e=>this.doImg(e)),!0),eof:()=>this.handleEOF(t)};try{!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ev(e,null==t?void 0:t.hdr),setTimeout((()=>Av(e,t)),0)}(t,n)}catch(e){this.showError("parse")}}drawError(){this.ctx.fillStyle="black",this.ctx.fillRect(0,0,this.options.width?this.options.width:this.hdr.width,this.options.height?this.options.height:this.hdr.height),this.ctx.strokeStyle="red",this.ctx.lineWidth=3,this.ctx.moveTo(0,0),this.ctx.lineTo(this.options.width?this.options.width:this.hdr.width,this.options.height?this.options.height:this.hdr.height),this.ctx.moveTo(0,this.options.height?this.options.height:this.hdr.height),this.ctx.lineTo(this.options.width?this.options.width:this.hdr.width,0),this.ctx.stroke()}showError(e){this.load_error=e,this.hdr={width:this.gif_el.width,height:this.gif_el.height},this.frames=[],this.drawError(),this.el.requestUpdate()}handleHeader(e){this.hdr=e,this.setSizes(this.options.width??this.hdr.width,this.options.height??this.hdr.height)}handleGCE(e){this.pushFrame(e.delayTime),this.clear(),this.transparency=e.transparencyGiven?e.transparencyIndex:null,this.disposal_method=e.disposalMethod}handleEOF(e){this.doDecodeProgress(e,!1),this.options.width&&this.options.height||(this.canvas.width=this.hdr.width*this.getCanvasScale(),this.canvas.height=this.hdr.height*this.getCanvasScale()),this.initPlayer(),!this.options.autoplay&&this.drawPlayIcon()}pushFrame(e){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:e}),this.frame_offsets.push({x:0,y:0}))}doImg(e){this.frame=this.frame||this.offscreenCanvas.getContext("2d");const t=this.frames.length,n=e.lctFlag?e.lct:this.hdr.gct;t>0&&(3===this.last_disposal_method?null!==this.disposal_restore_from_idx?this.frame.putImageData(this.frames[this.disposal_restore_from_idx].data,0,0):this.frame.clearRect(this.last_img.leftPos,this.last_img.topPos,this.last_img.width,this.last_img.height):this.disposal_restore_from_idx=t-1,2===this.last_disposal_method&&this.frame.clearRect(this.last_img.leftPos,this.last_img.topPos,this.last_img.width,this.last_img.height));const i=this.frame.getImageData(e.leftPos,e.topPos,e.width,e.height);e.pixels.forEach(((e,t)=>{e!==this.transparency&&(i.data[4*t+0]=n[e][0],i.data[4*t+1]=n[e][1],i.data[4*t+2]=n[e][2],i.data[4*t+3]=255)})),this.frame.putImageData(i,e.leftPos,e.topPos),this.ctx_scaled||(this.ctx.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctx_scaled=!0),this.last_img||this.ctx.drawImage(this.offscreenCanvas,0,0),this.last_img=e}putFrame(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(e=parseInt(e,10))>this.frames.length-1&&(e=0),e<0&&(e=0);const n=this.frame_offsets[e];this.offscreenCanvas.getContext("2d").putImageData(this.frames[e].data,n.x,n.y),this.ctx.globalCompositeOperation="copy",this.ctx.drawImage(this.offscreenCanvas,0,0),t&&this.hovering&&this.drawPauseIcon()}clear(){this.transparency=null,this.last_disposal_method=this.disposal_method,this.disposal_method=null,this.frame=null}play(){this.playing=!0,requestAnimationFrame((e=>this.onAnimationFrame(e,0,0)))}pause(){this.playing=!1,requestAnimationFrame((()=>this.drawPlayIcon()))}drawPauseIcon(){if(!this.playing)return;this.putFrame(this.frame_idx,!1),this.ctx.globalCompositeOperation="source-over",this.ctx.fillStyle="rgb(0, 0, 0, 0.25)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);const e=.1*this.canvas.height;this.ctx.lineWidth=.04*this.canvas.height,this.ctx.beginPath(),this.ctx.moveTo(this.canvas.width/2-e/2,this.canvas.height/2-e),this.ctx.lineTo(this.canvas.width/2-e/2,this.canvas.height/2+e),this.ctx.fillStyle="rgb(200, 200, 200, 0.75)",this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(this.canvas.width/2+e/2,this.canvas.height/2-e),this.ctx.lineTo(this.canvas.width/2+e/2,this.canvas.height/2+e),this.ctx.fillStyle="rgb(200, 200, 200, 0.75)",this.ctx.stroke(),this.ctx.lineWidth=.02*this.canvas.height,this.ctx.strokeStyle="rgb(200, 200, 200, 0.75)",this.ctx.beginPath(),this.ctx.arc(this.canvas.width/2,this.canvas.height/2,1.5*e,0,2*Math.PI),this.ctx.stroke()}drawPlayIcon(){if(this.playing)return;this.putFrame(this.frame_idx,!1),this.ctx.globalCompositeOperation="source-over",this.ctx.fillStyle="rgb(0, 0, 0, 0.25)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);const e=.1*this.canvas.height,t=new Path2D;t.moveTo(this.canvas.width/2+e,this.canvas.height/2),t.lineTo(this.canvas.width/2-e/2,this.canvas.height/2+e),t.lineTo(this.canvas.width/2-e/2,this.canvas.height/2-e),t.closePath(),this.ctx.fillStyle="rgb(200, 200, 200, 0.75)",this.ctx.fill(t);const n=1.5*e;this.ctx.lineWidth=.02*this.canvas.height,this.ctx.strokeStyle="rgb(200, 200, 200, 0.75)",this.ctx.beginPath(),this.ctx.arc(this.canvas.width/2,this.canvas.height/2,n,0,2*Math.PI),this.ctx.stroke()}doDecodeProgress(e,t){this.doShowProgress(e.pos,e.data.length,t)}withProgress(e,t,n){return i=>{null==t||t(i),this.doDecodeProgress(e,n)}}getCanvasScale(){let e;return e=this.options.max_width&&this.hdr&&this.hdr.width>this.options.max_width?this.options.max_width/this.hdr.width:1,e}fetchGIF(e){const t=fo(),n=new XMLHttpRequest;return n.open("GET",e,!0),null==n||n.overrideMimeType("text/plain; charset=x-user-defined"),n.onload=()=>{if(200!=n.status)return this.showError("xhr - response"),t.reject();t.resolve(n.response)},n.onprogress=e=>e.lengthComputable&&this.doShowProgress(e.loaded,e.total,!0),n.onerror=()=>this.showError("xhr"),n.send(),t}}const Tv=(e,t)=>{const n=Dg('Download file "%1$s"',t);return xl`<a target="_blank" rel="noopener" href="${e}">${n}</a>`},kv=e=>xl`
<div class="form-group">
${"hidden"!==e.type?xl`<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?xl`
<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>`,jv=e=>xl`
<label>${e.label}
<a class="form-url" target="_blank" rel="noopener" href="${e.value}">${e.value}</a>
</label>`,$v=e=>xl`
<div class="form-group">
${e.label?xl`<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>
</div>
</div>
</div>`;function Nv(e){e.preventDefault(),Wl.rooms.open(e.target.href)}const Ov=(e,t)=>{let n=e.normalizePath().toString();return e._parts.protocol||t.startsWith("http://")||t.startsWith("https://")||(n="http://"+n),"xmpp"===e._parts.protocol&&"join"===e._parts.query?xl`
<a target="_blank"
rel="noopener"
@click=${Nv}
href="${n}">${t}</a>`:xl`<a target="_blank" rel="noopener" href="${n}">${t}</a>`},Iv=(e,t)=>xl`<video controls preload="metadata" src="${e}"></video>${t?"":xl`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{sizzle:Mv}=Jl.env,Rv=["http","https","xmpp","mailto"];function Dv(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":null!=t&&t.new_password?"new-password":"current-password"}[e]}const Lv={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"},zv={"xs:anyURI":"url","xs:byte":"number","xs:date":"date","xs:dateTime":"datetime","xs:int":"number","xs:integer":"number","xs:time":"time"};function Pv(e){const t=Lv[e.getAttribute("type")];if("text"==t){const n=e.getElementsByTagNameNS("http://jabber.org/protocol/xdata-validate","validate");if(1===n.length){const e=n[0].getAttribute("datatype");return zv[e]||t}}return t}function Fv(e){e.removeAttribute("data-slider-marker"),e.classList.remove("collapsed"),e.style.overflow="",e.style.height=""}function Uv(e){const t=ed(e);return null===t?e:dd(t)?Iv(e):ld(t)?yv(e):(ud(t),Tv(t.toString(),function(e){try{return decodeURI(e.filename())}catch(t){return R.debug(t),e.filename()}}(t)))}function Bv(e,t){let n=e;for(;null!==n&&!Mv.matchesSelector(n,t);)n=n.parentElement;return n}function qv(e){const t=RegExp("^w{3}.","ig").test(e)?`http://${e}`:e,n=ed(e);return null===n||!function(e){try{return!!new URL(e)}catch(e){return!1}}(t)||!function(e){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rv).includes(e)}(n._parts.protocol)&&n._parts.protocol?e:Ov(n,e)}function Hv(e,t){e.classList.remove("visible"),_e(t)&&t()}Ba.calculateElementHeight=function(e){return Array.from(e.children).reduce(((e,t)=>e+t.offsetHeight),0)},Ba.getNextElement=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=e.nextElementSibling;for(;null!==n&&!Mv.matchesSelector(n,t);)n=n.nextElementSibling;return n},Ba.getPreviousElement=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=e.previousElementSibling;for(;null!==n&&!Mv.matchesSelector(n,t);)n=n.previousElementSibling;return n},Ba.getFirstChildElement=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=e.firstElementChild;for(;null!==n&&!Mv.matchesSelector(n,t);)n=n.nextElementSibling;return n},Ba.getLastChildElement=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=e.lastElementChild;for(;null!==n&&!Mv.matchesSelector(n,t);)n=n.previousElementSibling;return n},Ba.hasClass=function(e,t){return t instanceof Element&&t.classList.contains(e)},Ba.toggleClass=function(e,t){Ba.hasClass(e,t)?Ba.removeClass(e,t):Ba.addClass(e,t)},Ba.addClass=function(e,t){return t instanceof Element&&t.classList.add(e),t},Ba.removeClass=function(e,t){return t instanceof Element&&t.classList.remove(e),t},Ba.removeElement=function(e){return e instanceof Element&&e.parentNode&&e.parentNode.removeChild(e),e},Ba.getElementFromTemplateResult=function(e){const t=document.createElement("div");return Tl(e,t),t.firstElementChild},Ba.showElement=e=>{Ba.removeClass("collapsed",e),Ba.removeClass("hidden",e)},Ba.hideElement=function(e){return e instanceof Element&&e.classList.add("hidden"),e},Ba.nextUntil=function(e,t){const n=[];let i=e.nextElementSibling;for(;null!==i&&!i.matches(t);)n.push(i),i=i.nextElementSibling;return n},Ba.unescapeHTML=function(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText},Ba.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},Ba.slideInAllElements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;return Promise.all(Array.from(e).map((e=>Ba.slideIn(e,t))))},Ba.slideToggleElement=function(e,t){return Ba.hasClass("collapsed",e)||Ba.hasClass("hidden",e)?Ba.slideOut(e,t):Ba.slideIn(e,t)},Ba.slideOut=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return new Promise(((n,i)=>{if(!e){const e="An element needs to be passed in to slideOut";return R.warn(e),void i(new Error(e))}const s=e.getAttribute("data-slider-marker");s&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(s));const r=Ba.calculateElementHeight(e);if(window.converse_disable_effects)return e.style.height=r+"px",Fv(e),void n();if(!Ba.hasClass("collapsed",e)&&!Ba.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("data-slider-marker"),e.style.height=Ba.calculateElementHeight(e)+"px",e.style.overflow="",e.style.height="",n())})))}))},Ba.slideIn=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return new Promise(((n,i)=>{if(!e){const e="An element needs to be passed in to slideIn";return R.warn(e),i(new Error(e))}if(Ba.hasClass("collapsed",e))return n(e);if(window.converse_disable_effects)return e.classList.add("collapsed"),e.style.height="",n(e);const s=e.getAttribute("data-slider-marker");s&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(s));const r=e.offsetHeight,o=t/17;let a=r;e.style.overflow="hidden",e.setAttribute("data-slider-marker",window.requestAnimationFrame((function t(){a-=r/o,a>0?(e.style.height=a+"px",e.setAttribute("data-slider-marker",window.requestAnimationFrame(t))):(e.removeAttribute("data-slider-marker"),e.classList.add("collapsed"),e.style.height="",n(e))})))}))},Ba.isInDOM=function(e){return document.querySelector("body").contains(e)},Ba.isVisible=function(e){return null!==e&&!Ba.hasClass("hidden",e)&&(e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0)},Ba.fadeIn=function(e,t){if(e||R.warn("An element needs to be passed in to fadeIn"),window.converse_disable_effects)return e.classList.remove("hidden"),Hv(e,t);Ba.hasClass("hidden",e)?(e.classList.add("visible"),e.classList.remove("hidden"),e.addEventListener("webkitAnimationEnd",(()=>Hv(e,t))),e.addEventListener("animationend",(()=>Hv(e,t))),e.addEventListener("oanimationend",(()=>Hv(e,t)))):Hv(e,t)},Ba.xForm2TemplateResult=function(e,t,n){if("list-single"===e.getAttribute("type")||"list-multi"===e.getAttribute("type")){const t=Ba.queryChildren(e,"value").map((e=>null==e?void 0:e.textContent));return(e=>{var t;return xl`
<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=>xl`<option value="${e.value}" ?selected="${e.selected}">${e.label}</option>`)(e)))}
</select>
</div>`})({options:Ba.queryChildren(e,"option").map((n=>{var i;const s=null===(i=n.querySelector("value"))||void 0===i?void 0:i.textContent;return{value:s,label:n.getAttribute("label"),selected:t.includes(s),required:!!e.querySelector("required")}})),id:Ba.getUniqueId(),label:e.getAttribute("label"),multiple:"list-multi"===e.getAttribute("type"),name:e.getAttribute("var"),required:!!e.querySelector("required")})}var i,s,r,o;if("fixed"===e.getAttribute("type"))return(e=>xl`<p class="form-help">${e.text}</p>`)({text:null===(i=e.querySelector("value"))||void 0===i?void 0:i.textContent});if("jid-multi"===e.getAttribute("type"))return(e=>xl`
<label class="label-ta">${e.label}</label>
<textarea name="${e.name}">${e.value}</textarea>
`)({name:e.getAttribute("var"),label:e.getAttribute("label")||"",value:null===(s=e.querySelector("value"))||void 0===s?void 0:s.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=>xl`
<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:Ba.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 jv({label:e.getAttribute("label")||"",value:null===(r=e.querySelector("value"))||void 0===r?void 0:r.textContent});if("username"===e.getAttribute("var"))return $v({domain:" @"+n.domain,name:e.getAttribute("var"),type:Pv(e),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"),i=Mv('data[cid="'+n.textContent.replace(/^cid:/,"")+'"]',t)[0];return(e=>xl`
<fieldset class="form-group">
${e.label?xl`<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==i?void 0:i.textContent,type:n.getAttribute("type"),required:!!e.querySelector("required")})}{var c;const t=e.getAttribute("var");return kv({id:Ba.getUniqueId(),label:e.getAttribute("label")||"",name:t,fixed_username:null==n?void 0:n.fixed_username,autocomplete:Dv(t,n),placeholder:null,required:!!e.querySelector("required"),type:Pv(e),value:null===(c=e.querySelector("value"))||void 0===c?void 0:c.textContent})}},Object.assign(Ba,{getOOBURLMarkup:Uv,ancestor:Bv});const Gv=Ba;var Wv=n(4903),Vv={};Vv.styleTagTransform=Yg(),Vv.setAttributes=Vg(),Vv.insert=Gg().bind(null,"head"),Vv.domAPI=qg(),Vv.insertStyleElement=Qg(),Ug()(Wv.Z,Vv),Wv.Z&&Wv.Z.locals&&Wv.Z.locals,Wl.elements.define("converse-gif",class extends zg{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"}initGIF(){const e={autoplay:this.autoplay,loop:!this.noloop};this.progress_color&&(e.progress_color=this.progress_color),this.supergif=new Cv(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.initGIF()}render(){var e;return null!==(e=this.supergif)&&void 0!==e&&e.load_error&&["url","empty"].includes(this.fallback)?this.renderErrorFallback():xl`<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?qv(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 Jv=(e,t)=>xl`<converse-gif autoplay noloop fallback='empty' src=${e}></converse-gif>${t?"":xl`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{URI:Qv}=Jl.env,Zv=Mp(class extends av{render(e,t,n,i){return t?xl`<a href="${t}" class="chat-image__link" target="_blank" rel="noopener">${this.renderImage(e,t,n,i)}</a>`:this.renderImage(e,t,n,i)}renderImage(e,t,n,i){return xl`<img class="chat-image img-thumbnail"
src="${e}"
@click=${i}
@error=${()=>this.onError(e,t,n,i)}
@load=${n}/></a>`}onError(e,t,n,i){if(ad(e))t&&this.setValue(qv(t));else{const s=new Qv(e),r=s.filename();s.filename(`${r}.png`),this.setValue(Zv(s.toString(),t,n,i))}}}),Yv=e=>xl`${Zv(e.url,e.href,e.onLoad,e.onClick)}`,Xv=Mp(class extends Rp{render(e,t,n){const i=new dy(e,t,Object.assign(n,{show_images:!1,embed_videos:!1,embed_audio:!1}));return xl`${uv(async function(e){try{await e.addTemplates()}catch(e){R.error(e)}return e.payload}(i),xl`${i}`)}`}}),Kv=["*","_","~","`"],ey=[...Kv,"```",">"],ty={"*":{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"}},ny=["_",">","`","~"],iy={emphasis:(e,t,n)=>xl`<span class="styling-directive">_</span><i>${Xv(e,t,n)}</i><span class="styling-directive">_</span>`,preformatted:e=>xl`<span class="styling-directive">\`</span><code>${e}</code><span class="styling-directive">\`</span>`,preformatted_block:e=>xl`<div class="styling-directive">\`\`\`</div><code class="block">${e}</code><div class="styling-directive">\`\`\`</div>`,quote:(e,t,n)=>xl`<blockquote>${Xv(e,t,n)}</blockquote>`,strike:(e,t,n)=>xl`<span class="styling-directive">~</span><del>${Xv(e,t,n)}</del><span class="styling-directive">~</span>`,strong:(e,t,n)=>xl`<span class="styling-directive">*</span><b>${Xv(e,t,n)}</b><span class="styling-directive">*</span>`};function sy(e,t,n,i){if(i){const i=RegExp(ny.includes(e)?`^(\\p{L}|\\p{N})${e}`:`^(\\p{L}|\\p{N})\\${e}`,"u");if(n>1&&i.test(t.slice(n-1)))return!1;if(ay(e)&&n>0&&"\n"!==t[n-1])return!1;if(Kv.includes(e)&&t[n+1]===e)return!1}else{const i=RegExp(ny.includes(e)?`^${e}(\\p{L}|\\p{N})`:`^\\${e}(\\p{L}|\\p{N})`,"u");if(n<t.length-1&&i.test(t.slice(n)))return!1;if(Kv.includes(e)&&t[n-1]===e)return!1}return!0}function ry(e,t){let n,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!/(^```\s*\n|^```\s*$)/.test(e.slice(t))||0!==t&&"\n"!==e[t-1]&&">"!==e[t-1]){if(!ey.includes(e.slice(t,t+1)))return null;if(n=e.slice(t,t+1),!sy(n,e,t,i))return null}else n=e.slice(t,t+3);return n}function oy(e,t){const n=ry(e,t),i=n?function(e,t,n){if(!e)return 0;const i=n;if(n+=e.length,ay(e))return(n+=t.slice(n).split(/\n[^>]/).shift().length)-i;if("span"===ty[e].type){const i=t.slice(n).split("\n").shift();let s=0,r=i.indexOf(e);for(;-1!==r;){if(ry(t,n+r,!1)===e)return r+2*e.length;r=i.indexOf(e,s++)}return 0}{const i=t.slice(n+1);let s=0,r=i.indexOf(e);for(;-1!==r;){if(ry(t,n+1+r,!1)===e)return r+1+2*e.length;r=i.indexOf(e,s++)}return 0}}(n,e,t):0;return i>0?{d:n,length:i}:{}}const ay=e=>[">","&gt;"].includes(e);function cy(e,t,n,i){const s=iy[ty[e].name];return ay(e)?s(t.replace(/\n>/g,"\n").replace(/\n$/,""),n,i):s(t,n,i)}const ly=e=>"string"==typeof e;class dy extends String{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(e),this.embed_audio=null==n?void 0:n.embed_audio,this.embed_videos=null==n?void 0:n.embed_videos,this.mentions=(null==n?void 0:n.mentions)||[],this.media_urls=null==n?void 0:n.media_urls,this.nick=null==n?void 0:n.nick,this.offset=t,this.onImgClick=null==n?void 0:n.onImgClick,this.onImgLoad=null==n?void 0:n.onImgLoad,this.options=n,this.payload=[],this.references=[],this.render_styling=null==n?void 0:n.render_styling,this.show_images=null==n?void 0:n.show_images,this.hide_media_urls=null==n?void 0:n.hide_media_urls}shouldRenderMedia(e,t){let n;return"image"===t?n=this.show_images:"audio"===t?n=this.embed_audio:"video"===t&&(n=this.embed_videos),"boolean"==typeof n?n:id(e,t)}addHyperlinks(e,t){const n=t+this.offset;qd(this.media_urls||_d(e,t).media_urls||[],e,n).filter((e=>!e.is_encrypted)).forEach((e=>{const n=e.url,i=sd(n);let s;s=cd(n)&&this.shouldRenderMedia(n,"image")?Jv(i,this.hide_media_urls):ud(n)&&this.shouldRenderMedia(n,"image")?Yv({url:i,href:this.hide_media_urls?null:i,onClick:this.onImgClick,onLoad:this.onImgLoad}):dd(n)&&this.shouldRenderMedia(n,"video")?Iv(i,this.hide_media_urls):ld(n)&&this.shouldRenderMedia(n,"audio")?yv(i,this.hide_media_urls):qv(i),this.addTemplateResult(e.start+t,e.end+t,s)}))}addMapURLs(e,t){const n=/geo:([\-0-9.]+),([\-0-9.]+)(?:,([\-0-9.]+))?(?:\?(.*))?/g,i=e.matchAll(n);for(const e of i)this.addTemplateResult(e.index+t,e.index+e[0].length+t,qv(e[0].replace(n,Wl.settings.get("geouri_replacement"))))}addEmojis(e,t){[...Du(e.toString()),...Lu(e.toString())].forEach((e=>{this.addTemplateResult(e.begin+t,e.end+t,Ru(e,{add_title_wrapper:!0}))}))}addMentions(e,t){var n;const i=t+this.offset;null===(n=this.mentions)||void 0===n||n.forEach((n=>{const s=Number(n.begin)-i;if(s<0||s>=i+e.length)return;const r=Number(n.end)-i,o=e.slice(s,r);o===this.nick?this.addTemplateResult(s+t,r+t,(e=>xl`<span class="mention mention--self badge badge-info">${e.mention}</span>`)({mention:o})):this.addTemplateResult(s+t,r+t,(e=>xl`<span class="mention">${e.mention}</span>`)({mention:o}))}))}addStyling(){const e=[];if(function(e){for(let t=0;t<ey.length;t++)if(e.includes(ey[t]))return!0}(this,this.mentions)){const t=this.mentions.map((e=>Array.from({length:Number(e.end)},((t,n)=>Number(e.begin)+n))));let n=0;for(;n<this.length;){if(t.filter((e=>e.includes(n))).length){n++;continue}const{d:i,length:s}=oy(this,n);if(i&&s){const t=ay(i),r=n+s,o=t?r:r-i.length;let a="```"===i?n+i.length+1:n+i.length;t&&" "===this[a]&&(a+=1);const c=a,l=this.slice(a,o);e.push({begin:n,template:cy(i,l,c,this.options),end:r}),n=r}n++}}e.forEach((e=>this.addTemplateResult(e.begin,e.end,e.template)))}trimMeMessage(){0===this.offset&&this.isMeCommand()&&(this.payload[0]=this.payload[0].substring(4))}addAnnotations(e){const t=this.marshall();let n=0;for(const i of t)i&&(ly(i)?(e.call(this,i,n),n+=i.length):n=i.end)}async addTemplates(){await Wl.trigger("beforeMessageBodyTransformed",this,{Synchronous:!0}),this.render_styling&&this.addStyling(),this.addAnnotations(this.addMentions),this.addAnnotations(this.addHyperlinks),this.addAnnotations(this.addMapURLs),await Wl.emojis.initialize(),this.addAnnotations(this.addEmojis),await Wl.trigger("afterMessageBodyTransformed",this,{Synchronous:!0}),this.payload=this.marshall(),this.options.show_me_message&&this.trimMeMessage(),this.payload=this.payload.map((e=>ly(e)?e:e.template))}addTemplateResult(e,t,n){this.references.push({begin:e,end:t,template:n})}isMeCommand(){const e=this.toString();return!!e&&e.startsWith("/me ")}marshall(){let e=[this.toString()];return this.references.sort(((e,t)=>t.begin-e.begin)).forEach((t=>{const n=e.shift();e=[n.slice(0,t.begin),t,n.slice(t.end),...e]})),e.reduce(((e,t)=>{return ly(t)?[...e,Mu((n=t,n.replace(/\n\n+/g,(e=>`\n${"".repeat(e.length-2)}\n`))))]:[...e,t];var n}),[])}}class uy{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.offset=t,this.options=n,this.text=e}async transform(){const e=new dy(this.text,this.offset,this.options);try{await e.addTemplates()}catch(e){R.error(e)}return e.payload}render(){return xl`${uv(this.transform(),xl`${this.text}`)}`}}const hy=Mp(class extends Rp{render(e,t,n,i){const s=new uy(e,t,n).render();return null==i||i(),s}}),my=hy;var fy=n(6278),gy={};gy.styleTagTransform=Yg(),gy.setAttributes=Vg(),gy.insert=Gg().bind(null,"head"),gy.domAPI=qg(),gy.insertStyleElement=Qg(),Ug()(fy.Z,gy),fy.Z&&fy.Z.locals&&fy.Z.locals,Wl.elements.define("converse-chat-message-body",class extends zg{static get properties(){return{hide_url_previews:{type:String},is_me_message:{type:Boolean},model:{type:Object},text:{type:String}}}initialize(){const e=Va();this.listenTo(e,"change:allowed_audio_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:allowed_image_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:allowed_video_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:render_media",(()=>this.requestUpdate()))}onImgClick(e){e.preventDefault(),Wl.modal.create(vv,{src:e.target.src},e).show(e)}onImgLoad(){this.dispatchEvent(new CustomEvent("imageLoaded",{detail:this,bubbles:!0}))}render(){const e={media_urls:this.model.get("media_urls"),mentions:this.model.get("references"),nick:this.model.collection.chatbox.get("nick"),onImgClick:e=>this.onImgClick(e),onImgLoad:()=>this.onImgLoad(),render_styling:!this.model.get("is_unstyled")&&Wl.settings.get("allow_message_styling"),show_me_message:!0};return"false"===this.hide_url_previews?(e.embed_audio=!0,e.embed_videos=!0,e.show_images=!0):"true"===this.hide_url_previews&&(e.embed_audio=!1,e.embed_videos=!1,e.show_images=!1),my(this.text,0,e,(()=>{var e;return null===(e=this.model.collection)||void 0===e?void 0:e.trigger("rendered",this.model)}))}});var py=n(6450),vy={};vy.styleTagTransform=Yg(),vy.setAttributes=Vg(),vy.insert=Gg().bind(null,"head"),vy.domAPI=qg(),vy.insertStyleElement=Qg(),Ug()(py.Z,vy),py.Z&&py.Z.locals&&py.Z.locals,customElements.define("converse-icon",class extends zg{static get properties(){return{color:String,class_name:{attribute:"class"},style:String,size:String}}constructor(){super(),this.class_name="",this.style="",this.size="",this.color=""}getSource(){return`#icon-${this.class_name.trim().split(" ")[1].replace("fa-","")}`}getStyles(){var e;const t=null===(e=this.color.match(/var\((--.*)\)/))||void 0===e?void 0:e[1],n=t?getComputedStyle(this).getPropertyValue(t):this.color;return`\n ${this.size?`width: ${this.size};`:""}\n ${this.size?`height: ${this.size};`:""}\n ${n?`fill: ${n};`:""}\n ${this.style}\n `}render(){return xl`<svg .style="${this.getStyles()}"> <use href="${this.getSource()}"> </use> </svg>`}});const{keycodes:yy}=Jl;function _y(e){let t=0;do{isNaN(e.offsetTop)||(t+=e.offsetTop)}while(e=e.offsetParent);return t}function by(e){let t=0;do{isNaN(e.offsetLeft)||(t+=e.offsetLeft)}while(e=e.offsetParent);return t}class wy{static get DIRECTION(){return{down:"down",end:"end",home:"home",left:"left",right:"right",up:"up"}}static get DEFAULTS(){return{home:[`${yy.SHIFT}+${yy.UP_ARROW}`],end:[`${yy.SHIFT}+${yy.DOWN_ARROW}`],up:[yy.UP_ARROW],down:[yy.DOWN_ARROW],left:[yy.LEFT_ARROW,`${yy.SHIFT}+${yy.TAB}`],right:[yy.RIGHT_ARROW,yy.TAB],getSelector:null,jump_to_picked:null,jump_to_picked_direction:null,jump_to_picked_selector:"picked",onSelected:null,selected:"selected",selector:"li"}}static getClosestElement(e,t){return e.reduce(((e,n)=>{const i=t(n);return i<e.distance?{distance:i,element:n}:e}),{distance:1/0}).element}constructor(e,t){this.doc=window.document,this.container=e,this.scroll_container=t.scroll_container||e,this.options=Object.assign({},wy.DEFAULTS,t),this.init()}init(){this.selected=null,this.keydownHandler=null,this.elements={},this.keys={},this.options.down.forEach((e=>this.keys[e]=wy.DIRECTION.down)),this.options.end.forEach((e=>this.keys[e]=wy.DIRECTION.end)),this.options.home.forEach((e=>this.keys[e]=wy.DIRECTION.home)),this.options.left.forEach((e=>this.keys[e]=wy.DIRECTION.left)),this.options.right.forEach((e=>this.keys[e]=wy.DIRECTION.right)),this.options.up.forEach((e=>this.keys[e]=wy.DIRECTION.up))}enable(){this.getElements(),this.keydownHandler=e=>this.handleKeydown(e),this.doc.addEventListener("keydown",this.keydownHandler),this.enabled=!0}disable(){this.keydownHandler&&this.doc.removeEventListener("keydown",this.keydownHandler),this.unselect(),this.elements={},this.enabled=!1}destroy(){this.disable(),this.container.domNavigator&&delete this.container.domNavigator}getNextElement(e){let t;if(e===wy.DIRECTION.home)t=this.getElements(e)[0];else if(e===wy.DIRECTION.end)t=Array.from(this.getElements(e)).pop();else if(this.selected)if(e===wy.DIRECTION.right){const n=this.getElements(e);t=n.slice(n.indexOf(this.selected))[1]}else if(e==wy.DIRECTION.left){const n=this.getElements(e);t=n.slice(0,n.indexOf(this.selected)).pop()||this.selected}else if(e==wy.DIRECTION.down){const e=this.selected.offsetLeft,n=this.selected.offsetTop+this.selected.offsetHeight,i=this.elementsAfter(0,n),s=t=>Math.abs(t.offsetLeft-e)+Math.abs(t.offsetTop-n);t=wy.getClosestElement(i,s)}else{if(e!=wy.DIRECTION.up)throw new Error("getNextElement: invalid direction value");{const e=this.selected.offsetLeft,n=this.selected.offsetTop-1,i=this.elementsBefore(1/0,n),s=t=>Math.abs(e-t.offsetLeft)+Math.abs(n-t.offsetTop);t=wy.getClosestElement(i,s)}}else t=e===wy.DIRECTION.right||e===wy.DIRECTION.down?this.getElements(e)[1]:this.getElements(e)[0];return this.options.jump_to_picked&&t&&t.matches(this.options.jump_to_picked)&&e===this.options.jump_to_picked_direction&&(t=this.container.querySelector(this.options.jump_to_picked_selector)||t),t}select(e,t){e&&e!==this.selected&&(this.unselect(),t&&this.scrollTo(e,t),e.matches("input")?e.focus():Gv.addClass(this.options.selected,e),this.selected=e,this.options.onSelected&&this.options.onSelected(e))}unselect(){this.selected&&(Gv.removeClass(this.options.selected,this.selected),delete this.selected)}scrollTo(e,t){if(this.inScrollContainerViewport(e)){if(!function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}(e))switch(t){case wy.DIRECTION.left:document.body.scrollLeft=by(e)-document.body.offsetLeft;break;case wy.DIRECTION.up:document.body.scrollTop=_y(e)-document.body.offsetTop;break;case wy.DIRECTION.right:document.body.scrollLeft=by(e)-document.body.offsetLeft-(document.documentElement.clientWidth-e.offsetWidth);break;case wy.DIRECTION.down:document.body.scrollTop=_y(e)-document.body.offsetTop-(document.documentElement.clientHeight-e.offsetHeight)}}else{const n=this.scroll_container;if(!n.contains(e))return;switch(t){case wy.DIRECTION.left:n.scrollLeft=e.offsetLeft-n.offsetLeft,n.scrollTop=e.offsetTop-n.offsetTop;break;case wy.DIRECTION.up:n.scrollTop=e.offsetTop-n.offsetTop;break;case wy.DIRECTION.right:n.scrollLeft=e.offsetLeft-n.offsetLeft-(n.offsetWidth-e.offsetWidth),n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight);break;case wy.DIRECTION.down:n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight)}}}inScrollContainerViewport(e){const t=this.scroll_container;return!(e.offsetLeft-t.scrollLeft<t.offsetLeft||e.offsetTop-t.scrollTop<t.offsetTop||e.offsetLeft+e.offsetWidth-t.scrollLeft>t.offsetLeft+t.offsetWidth||e.offsetTop+e.offsetHeight-t.scrollTop>t.offsetTop+t.offsetHeight)}getElements(e){const t=this.options.getSelector?this.options.getSelector(e):this.options.selector;return this.elements[t]||(this.elements[t]=Array.from(this.container.querySelectorAll(t))),this.elements[t]}elementsAfter(e,t){return this.getElements(wy.DIRECTION.down).filter((n=>n.offsetLeft>=e&&n.offsetTop>=t))}elementsBefore(e,t){return this.getElements(wy.DIRECTION.up).filter((n=>n.offsetLeft<=e&&n.offsetTop<=t))}handleKeydown(e){const t=yy,n=e.shiftKey?this.keys[`${t.SHIFT}+${e.which}`]:this.keys[e.which];if(n){e.preventDefault(),e.stopPropagation();const t=this.getNextElement(n,e);this.select(t,n)}}}const Sy=wy,xy=Jl.env.utils;class Ey extends zg{connectedCallback(){super.connectedCallback(),this.registerEvents()}registerEvents(){this.clickOutside=e=>this._clickOutside(e),document.addEventListener("click",this.clickOutside)}firstUpdated(){super.firstUpdated(),this.menu=this.querySelector(".dropdown-menu"),this.button=this.querySelector("button"),this.addEventListener("click",(e=>this.toggleMenu(e))),this.addEventListener("keyup",(e=>this.handleKeyUp(e)))}_clickOutside(e){this.contains(e.composedPath()[0])||this.hideMenu(e)}hideMenu(){var e,t;xy.removeClass("show",this.menu),null===(e=this.button)||void 0===e||e.setAttribute("aria-expanded",!1),null===(t=this.button)||void 0===t||t.blur()}showMenu(){xy.addClass("show",this.menu),this.button.setAttribute("aria-expanded",!0)}toggleMenu(e){e.preventDefault(),xy.hasClass("show",this.menu)?this.hideMenu():this.showMenu()}handleKeyUp(e){e.keyCode===Jl.keycodes.ESCAPE&&this.hideMenu()}disconnectedCallback(){document.removeEventListener("click",this.clickOutside),super.disconnectedCallback()}}var Ay=n(7631),Cy={};Cy.styleTagTransform=Yg(),Cy.setAttributes=Vg(),Cy.insert=Gg().bind(null,"head"),Cy.domAPI=qg(),Cy.insertStyleElement=Qg(),Ug()(Ay.Z,Cy),Ay.Z&&Ay.Z.locals&&Ay.Z.locals;class Ty extends Ey{static get properties(){return{icon_classes:{type:String},color:{type:String},items:{type:Array}}}constructor(){super(),this.color="var(--text-color)",this.icon_classes="fa fa-bars"}render(){return xl`
<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}">
</button>
<div class="dropdown-menu">
${this.items.map((e=>uv(e,"")))}
</div>
`}firstUpdated(){super.firstUpdated(),this.initArrowNavigation()}connectedCallback(){super.connectedCallback(),this.hideOnEscape=e=>e.keyCode===ve.ESCAPE&&this.hideMenu(),document.addEventListener("keydown",this.hideOnEscape)}disconnectedCallback(){document.removeEventListener("keydown",this.hideOnEscape),super.disconnectedCallback()}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 Sy(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!==ve.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}}Wl.elements.define("converse-dropdown",Ty);const ky=e=>{return e.image?xl`
<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};var jy=n(5222),$y={};$y.styleTagTransform=Yg(),$y.setAttributes=Vg(),$y.insert=Gg().bind(null,"head"),$y.domAPI=qg(),$y.insertStyleElement=Qg(),Ug()(jy.Z,$y),jy.Z&&jy.Z.locals&&jy.Z.locals,Wl.elements.define("converse-avatar",class extends zg{static get properties(){return{data:{type:Object},width:{type:String},height:{type:String},nonce:{type:String}}}constructor(){super(),this.width=36,this.height=36}render(){var e,t;const n=(null===(e=this.data)||void 0===e?void 0:e.image_type)||Ya.DEFAULT_IMAGE_TYPE;let i;var s,r;null!==(t=this.data)&&void 0!==t&&t.data_uri?i=null===(s=this.data)||void 0===s?void 0:s.data_uri:i="data:"+n+";base64,"+((null===(r=this.data)||void 0===r?void 0:r.image)||Ya.DEFAULT_IMAGE);return ky({classes:this.getAttribute("class"),height:this.height,width:this.width,image:i,image_type:n})}});const{dayjs:Ny}=Jl.env;Wl.elements.define("converse-message-versions",class extends zg{static get properties(){return{model:{type:Object}}}render(){const e=this.model.get("older_versions");return xl`
<h4>Older versions</h4>
${Object.keys(e).map((t=>xl`<p class="older-msg"><time>${Ny(t).format("MMM D, YYYY, HH:mm:ss")}</time>: ${e[t]}</p>`))}
<hr/>
<h4>Current version</h4>
<p>${this.model.getMessageText()}</p>`}});const Oy=mp.extend({id:"message-versions-modal",toHTML(){return(e=>xl`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="message-versions-modal-label">${Dg("Message versions")}</h4>
${gp}
</div>
<div class="modal-body">
<converse-message-versions .model=${e}></converse-message-versions>
</div>
<div class="modal-footer">${fp}</div>
</div>
</div>
`)(this.model)}}),Iy=mp.extend({id:"muc-occupant",initialize(){mp.prototype.initialize.apply(this,arguments),this.model&&this.listenTo(this.model,"change",this.render),Wl.trigger("occupantModalInitialized",{model:this.model,message:this.message})},toHTML(){var e,t,n,i;const s=this.model??this.message,r=null==s?void 0:s.get("jid");return(e=>{var t,n;return xl`
<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>
${gp}
</div>
<div class="modal-body" class="d-flex">
<div class="row">
<div class="col-auto">
<converse-avatar
class="avatar modal-avatar"
.data=${null===(t=e.vcard)||void 0===t?void 0:t.attributes}
nonce=${null===(n=e.vcard)||void 0===n?void 0:n.get("vcard_updated")}
height="120" width="120"></converse-avatar>
</div>
<div class="col">
<ul class="occupant-details">
<li>
${e.nick?xl`<div class="row"><strong>${Dg("Nickname")}:</strong></div><div class="row">${e.nick}</div>`:""}
</li>
<li>
${e.jid?xl`<div class="row"><strong>${Dg("XMPP Address")}:</strong></div><div class="row">${e.jid}</div>`:""}
</li>
<li>
${e.affiliation?xl`<div class="row"><strong>${Dg("Affiliation")}:</strong></div><div class="row">${e.affiliation}</div>`:""}
</li>
<li>
${e.role?xl`<div class="row"><strong>${Dg("Roles")}:</strong></div><div class="row">${e.role}</div>`:""}
</li>
<li>
${e.hats?xl`<div class="row"><strong>${Dg("Hats")}:</strong></div><div class="row">${e.hats}</div>`:""}
</li>
<li>
${e.occupant_id?xl`<div class="row"><strong>${Dg("Occupant Id")}:</strong></div><div class="row">${e.occupant_id}</div>`:""}
</li>
</ul>
</div>
</div>
</div>
<div class="modal-footer">
${fp}
</div>
</div>
</div>
`})({jid:r,vcard:Ya.vcards.findWhere({jid:r}),display_name:null==s?void 0:s.getDisplayName(),nick:s.get("nick"),occupant_id:s.get("occupant_id"),role:null===(e=this.model)||void 0===e?void 0:e.get("role"),affiliation:null===(t=this.model)||void 0===t?void 0:t.get("affiliation"),hats:null!==(n=this.model)&&void 0!==n&&null!==(i=n.get("hats"))&&void 0!==i&&i.length?this.model.get("hats"):null})}});Ya.OccupantModal=Iy;const My=Iy,Ry=Jl.env.utils,Dy=mp.extend({id:"user-details-modal",persistent:!0,events:{"click button.refresh-contact":"refreshContact"},initialize(){mp.prototype.initialize.apply(this,arguments),this.model.rosterContactAdded.then((()=>this.registerContactEventHandlers())),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),Wl.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(e=>{const t=Dg("XMPP Address"),n=Dg("Email"),i=Dg("Full Name"),s=Dg("Nickname"),r=Dg("The User's Profile Image"),o=Dg("Refresh"),a=Dg("Role"),c=Dg("URL"),l={alt_text:r,extra_classes:"mb-3",height:"120",width:"120"};return xl`
<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>
${gp}
</div>
<div class="modal-body">
${e.image?xl`<div class="mb-4">${ky(Object.assign(e,l))}</div>`:""}
${e.fullname?xl`<p><label>${i}:</label> ${e.fullname}</p>`:""}
<p><label>${t}:</label> <a href="xmpp:${e.jid}">${e.jid}</a></p>
${e.nickname?xl`<p><label>${s}:</label> ${e.nickname}</p>`:""}
${e.url?xl`<p><label>${c}:</label> <a target="_blank" rel="noopener" href="${e.url}">${e.url}</a></p>`:""}
${e.email?xl`<p><label>${n}:</label> <a href="mailto:${e.email}">${e.email}</a></p>`:""}
${e.role?xl`<p><label>${a}:</label> ${e.role}</p>`:""}
<converse-omemo-fingerprints jid=${e.jid}></converse-omemo-fingerprints>
</div>
<div class="modal-footer">
${fp}
<button type="button" class="btn btn-info refresh-contact">
<converse-icon
class="fa fa-refresh"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${o}</button>
${e.allow_contact_removal&&e.is_roster_contact?(e=>{const t=Dg("Remove as contact");return xl`
<button type="button" @click="${e.removeContact}" class="btn btn-danger remove-contact">
<converse-icon
class="fas fa-trash-alt"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${t}
</button>
`})(e):""}
</div>
</div>
</div>
`})(Object.assign(this.model.toJSON(),n,{_converse:Ya,allow_contact_removal:Wl.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:Ry}))},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");Ry.addClass("fa-spin",t);try{await Wl.vcard.update(this.model.contact.vcard,!0)}catch(e){R.fatal(e),this.alert(Dg("Sorry, something went wrong while trying to refresh"),"danger")}Ry.removeClass("fa-spin",t)},removeContact(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),Wl.settings.get("allow_contact_removal")&&!0===confirm(Dg("Are you sure you want to remove this contact?"))&&(setTimeout((()=>function(e){e.removeFromRoster((()=>e.destroy()),(t=>{t&&R.error(t),Wl.alert("error",Dg("Error"),[Dg("Sorry, there was an error while trying to remove %1$s as a contact.",e.getDisplayName())])}))}(this.model.contact)),1),this.modal.hide())}});Ya.UserDetailsModal=Dy;const Ly=Dy,{dayjs:zy}=Jl.env,{dayjs:Py}=Jl.env;function Fy(e){return!!ed(e).host()}Wl.elements.define("converse-image",class extends zg{static get properties(){return{href:{type:String},onImgLoad:{type:Function},text:{type:String}}}render(){const e=sd(this.href);return cd(this.text)&&this.shouldRenderMedia(this.text,"image")?Jv(e):Yv({url:this.text,href:e,onClick:this.onImgClick,onLoad:this.onImgLoad})}});const Uy=(e,t)=>e.url&&Fy(e.url)&&!cd(e.image)?xl`<a href="${e.url}" target="_blank" rel="noopener">${t(e)}</a>`:t(e),By=e=>xl`<converse-image class="card-img-top" text="${e.image}" href="${e.url}" .onImgLoad=${e.onload}></converse-image>`;var qy=n(5046),Hy={};Hy.styleTagTransform=Yg(),Hy.setAttributes=Vg(),Hy.insert=Gg().bind(null,"head"),Hy.domAPI=qg(),Hy.insertStyleElement=Qg(),Ug()(qy.Z,Hy),qy.Z&&qy.Z.locals&&qy.Z.locals,Wl.elements.define("converse-message-unfurl",class extends zg{static get properties(){return{description:{type:String},image:{type:String},jid:{type:String},title:{type:String},url:{type:String}}}initialize(){const e=Va();this.listenTo(e,"change:allowed_image_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:render_media",(()=>this.requestUpdate()))}render(){return(e=>{const t=(n=e.image)&&rd(n,"allowed_image_domains")&&Fy(n);var n;const i=e.title||e.description||e.url;return t||i?xl`<div class="card card--unfurl">
${t?Uy(e,By):""}
${i?xl` <div class="card-body">
${e.title?Uy(e,(e=>xl`<h5 class="card-title">${e.title}</h5>`)):""}
${e.description?xl`<p class="card-text">
<converse-rich-text text=${e.description}></converse-rich-text>
</p>`:""}
${e.url?xl`<p class="card-text">
<a href="${e.url}" target="_blank" rel="noopener">${ed(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}))}});var Gy=n(9523),Wy={};Wy.styleTagTransform=Yg(),Wy.setAttributes=Vg(),Wy.insert=Gg().bind(null,"head"),Wy.domAPI=qg(),Wy.insertStyleElement=Qg(),Ug()(Gy.Z,Wy),Gy.Z&&Gy.Z.locals&&Gy.Z.locals;const Vy=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return null!==(e=t.classes)&&void 0!==e&&e.includes("hor_centered")?xl`<div class="spinner__container"><converse-icon size="1em" class="fa fa-spinner spinner centered ${t.classes||""}"></converse-icon></div>`:xl`<converse-icon size="1em" class="fa fa-spinner spinner centered ${t.classes||""}"></converse-icon>`};var Jy=n(7272),Qy=n.n(Jy);const{dayjs:Zy}=Jl.env;function Yy(e){if(!e.isHidden()&&Wl.settings.get("allow_url_history_change")){const t=window.location.hash;t&&e.messages.get(t.slice(1))&&Ya.router.history.navigate()}}const Xy=Qy()((e=>function(e){const t=e.target;if("converse-chat-content"!==t.nodeName.toLowerCase())return;let n=!0;const i=0===Math.floor(t.scrollTop),s=Math.ceil(t.clientHeight-t.scrollTop)>=t.scrollHeight-Math.ceil(t.scrollHeight/20);i?(n=!1,Yy(t.model)):s&&Wl.trigger("chatBoxScrolledUp",t),t.model.get("scolled")!==n&&t.model.ui.set({scrolled:n})}(e)),50);function Ky(e){if("groupchat"===e.get("type")){var t;const n=Wl.settings.get("muc_hats").filter((e=>e)).map((e=>e.toLowerCase()));let i=[];n.includes("vcard_roles")&&(i=e.vcard?e.vcard.get("role"):null,i=i?i.split(",").filter((e=>e)).map((e=>({title:e}))):[]);const s=[...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"))||[],...i,...s]}return[]}const{Strophe:e_,dayjs:t_}=Jl.env;Wl.elements.define("converse-chat-message",class extends zg{static get properties(){return{jid:{type:String},mid:{type:String}}}async initialize(){if(await this.setModels(),!this.model)return void R.error("Could not find module for converse-chat-message");const e=Va();this.listenTo(e,"change:render_media",(()=>{this.model.save("hide_url_previews",void 0),this.requestUpdate()})),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.requestUpdate(),this.listenTo(this.model.occupant,"change",(()=>this.requestUpdate()))})))}async setModels(){this.chatbox=await Wl.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?Vy():this.model.get("file")&&this.model.get("upload")!==Ya.SUCCESS?this.renderFileProgress():["mep"].includes(this.model.get("type"))?this.renderMEPMessage():["error","info"].includes(this.model.get("type"))?this.renderInfoMessage():this.renderChatMessage():""}getProps(){return Object.assign(this.model.toJSON(),this.getDerivedMessageProps())}renderRetraction(){return(e=>{const t=e.isRetracted()?e.getRetractionText():null;return xl`
<div class="retraction">${t}</div>
${e.model.get("moderation_reason")?xl`<q class="chat-msg--retracted__reason">${e.model.get("moderation_reason")}</q>`:""}`})(this)}renderMessageText(){return(e=>{const t=Dg("Show more"),n="groupchat"===e.model.get("type"),i=Dg("Show less"),s=xl`
<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}>
<converse-icon size="1em" color="var(--background)" class="fa ${e.model.get("is_spoiler_visible")?"fa-eye-slash":"fa-eye"}"></converse-icon>
${e.model.get("is_spoiler_visible")?i: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 xl`
${e.model.get("is_spoiler")?s:""}
${e.model.get("subject")?xl`<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()}
text="${o}"></converse-chat-message-body>
${!e.model.get("received")||e.model.isMeCommand()||n?"":xl`<span class="fa fa-check chat-msg__receipt"></span>`}
${e.model.get("edited")?(e=>{const t=Dg("This message has been edited");return xl`<converse-icon title="${t}" class="fa fa-edit chat-msg__edit-modal" @click=${e.showMessageVersionsModal} size="1em"></converse-icon>`})(e):""}
</span>
${a?xl`<div class="chat-msg__media">${Uv(e.model.get("oob_url"))}</div>`:""}
<div class="chat-msg__error">${e.model.get("error_text")||e.model.get("error")}</div>
`})(this)}renderMEPMessage(){return(e=>{const t=Py(e.model.get("time")).toISOString();return xl`
<div class="message chat-info message--mep ${e.getExtraMessageClasses()}"
data-isodate="${t}"
data-type="${e.data_name}"
data-value="${e.data_value}">
<div class="chat-msg__content">
<div class="chat-msg__body chat-msg__body--${e.model.get("type")} ${e.model.get("is_delayed")?"chat-msg__body--delayed":""}">
<div class="chat-info__message">
${e.isRetracted()?e.renderRetraction():xl`
<converse-rich-text
.mentions=${e.model.get("references")}
render_styling
text=${e.model.getMessageText()}>
</converse-rich-text>
${e.model.get("reason")?xl`<q class="reason"><converse-rich-text text=${e.model.get("reason")}></converse-rich-text></q>`:""}
`}
</div>
<converse-message-actions
?is_retracted=${e.isRetracted()}
.model=${e.model}></converse-message-actions>
</div>
</div>
</div>`})(this)}renderInfoMessage(){return(e=>{const t=zy(e.model.get("time")).toISOString(),n=Dg("Retry");return xl`
<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")?xl`<q class="reason">${e.model.get("reason")}</q>`:""}
${e.model.get("error_text")?xl`<q class="reason">${e.model.get("error_text")}</q>`:""}
${e.model.get("retry_event_id")?xl`<a class="retry" @click=${e.onRetryClicked}>${n}</a>`:""}
</div>`})(this)}renderFileProgress(){return this.model.file?(e=>{var t,n;const i=Dg("Uploading file:"),s=e.model.file.name,r=Ud()(e.model.file.size);return xl`
<div class="message chat-msg">
${e.shouldShowAvatar()?xl`<a class="show-msg-author-modal" @click=${e.showUserModal}>
<converse-avatar class="avatar align-self-center"
.data=${null===(t=e.model.vcard)||void 0===t?void 0:t.attributes}
nonce=${null===(n=e.model.vcard)||void 0===n?void 0:n.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>`:""}
<div class="chat-msg__content">
<span class="chat-msg__text">${i} <strong>${s}</strong>, ${r}</span>
<progress value="${e.model.get("progress")}"/>
</div>
</div>`})(this):""}renderChatMessage(){return((e,t)=>{var n,i,s;const r=Dg("New messages"),o=e.model.isFollowup();return xl`
${t.is_first_unread?xl`<div class="message separator"><hr class="separator"><span class="separator-text">${r}</span></div>`:""}
<div class="message chat-msg ${e.getExtraMessageClasses()}"
data-isodate="${t.time}"
data-msgid="${t.msgid}"
data-from="${t.from}"
data-encrypted="${t.is_encrypted}">
<!-- Anchor to allow us to scroll the message into view -->
<a id="${t.msgid}"></a>
${t.should_show_avatar&&!o?xl`<a class="show-msg-author-modal" @click=${e.showUserModal}>
<converse-avatar
class="avatar align-self-center"
.data=${null===(n=e.model.vcard)||void 0===n?void 0:n.attributes}
nonce=${null===(i=e.model.vcard)||void 0===i?void 0:i.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>`:""}
<div class="chat-msg__content chat-msg__content--${t.sender} ${t.is_me_message?"chat-msg__content--action":""}">
${t.is_me_message||o?"":xl`
<span class="chat-msg__heading">
<span class="chat-msg__author"><a class="show-msg-author-modal" @click=${e.showUserModal}>${t.username}</a></span>
${t.hats.map((e=>xl`<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?xl`<converse-icon class="fa fa-lock" size="1.1em"></converse-icon>`:""}
</span>`}
<div class="chat-msg__body chat-msg__body--${t.message_type} ${t.received?"chat-msg__body--received":""} ${t.is_delayed?"chat-msg__body--delayed":""}">
<div class="chat-msg__message">
${t.is_me_message?xl`
<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()}
</div>
<converse-message-actions
.model=${e.model}
?is_retracted=${t.is_retracted}></converse-message-actions>
</div>
${null===(s=e.model.get("ogp_metadata"))||void 0===s?void 0:s.map((t=>{var n;return!0===e.model.get("hide_url_previews")?"":id(t["og:image"],"image")?xl`<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>`:""}))}
</div>
</div>`})(this,this.getProps())}shouldShowAvatar(){return Wl.settings.get("show_message_avatar")&&!this.model.isMeCommand()&&["chat","groupchat"].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 Wl.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=Wl.settings.get("time_format");return{pretty_time:t_(this.model.get("edited")||this.model.get("time")).format(e),has_mentions:this.hasMentions(),hats:Ky(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:e_.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return Dg("%1$s has removed this message",n)}return Dg("%1$s has removed this message",this.model.getDisplayName())}showUserModal(e){if("me"===this.model.get("sender"))Wl.modal.show(Ya.ProfileModal,{model:this.model},e);else if("groupchat"===this.model.get("type"))e.preventDefault(),Wl.modal.show(My,{model:this.model.occupant,message:this.model},e);else{e.preventDefault();const t=this.model.collection.chatbox;Wl.modal.show(Ly,{model:t},e)}}showMessageVersionsModal(e){e.preventDefault(),Wl.modal.show(Oy,{model:this.model},e)}toggleSpoilerMessage(e){null==e||e.preventDefault(),this.model.save({is_spoiler_visible:!this.model.get("is_spoiler_visible")})}}),Wl.elements.define("converse-message-history",class extends zg{static get properties(){return{model:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?qp(e,(e=>e.get("id")),(e=>xl`${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=Wl.hook(t,e,"");return uv(n,"")}{const t=xl`<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 i=n.indexOf(e),s=n[i-1];if(!s||Zy(e.get("time")).isAfter(Zy(s.get("time")),"day")){const t=Zy(e.get("time")).startOf("day");return(e=>xl`
<div class="message date-separator" data-isodate="${e.time}">
<hr class="separator"/>
<time class="separator-text" datetime="${e.time}"><span>${e.datestring}</span></time>
</div>
`)({type:"date",time:t.toISOString(),datestring:t.format("dddd MMM Do YYYY")})}}(e);return n?[n,t]:t}}});var n_=n(8054),i_={};i_.styleTagTransform=Yg(),i_.setAttributes=Vg(),i_.insert=Gg().bind(null,"head"),i_.domAPI=qg(),i_.insertStyleElement=Qg(),Ug()(n_.Z,i_),n_.Z&&n_.Z.locals&&n_.Z.locals,Wl.elements.define("converse-chat-content",class extends zg{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("scroll",Xy)}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",Xy)}async setModels(){this.model=await Wl.chatboxes.get(this.jid),await this.model.initialized,this.requestUpdate()}render(){var e;return this.model?xl`
<div class="chat-content__notifications">${this.model.getNotificationsText()}</div>
<converse-message-history
.model=${this.model}
.messages=${[...this.model.messages.models]}>
</converse-message-history>
${null!==(e=this.model.ui)&&void 0!==e&&e.get("chat-content-spinner-top")?Vy():""}
`:""}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;Wl.trigger("chatBoxScrolledDown",{chatbox:this.model})}}});class s_ extends Rp{constructor(e){if(super(e),this.it=Al,2!==e.type)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Al||null==e)return this.ft=void 0,this.it=e;if(e===El)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this.ft;this.it=e;const t=[e];return t.raw=t,this.ft={_$litType$:this.constructor.resultType,strings:t,values:[]}}}s_.directiveName="unsafeHTML",s_.resultType=1;const r_=Mp(s_);Wl.elements.define("converse-chat-help",class extends zg{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[xl`<converse-icon class="fas fa-times close-chat-help"
@click=${this.close}
path-prefix="${Wl.settings.get("assets_path")}"
size="1em"></converse-icon>`,...this.messages.map((t=>this.renderHelpMessage({isodate:e,markup:qo().sanitize(t,{ALLOWED_TAGS:["strong"]})})))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return xl`<div class="message chat-${this.type}" data-isodate="${e.isodate}">${r_(e.markup)}</div>`}});const o_=Jl.env.utils,a_=e=>xl`
<li class="emoji insert-emoji ${e.shouldBeHidden(e.emoji.sn)?"hidden":""}" data-emoji="${e.emoji.sn}" title="${e.emoji.sn}">
<a href="#" @click=${e.insertEmoji} data-emoji="${e.emoji.sn}">${o_.shortnamesToEmojis(e.emoji.sn)}</a>
</li>
`,c_=e=>{const t=Dg("Search");return xl`
<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}>
${e.query?"":(e=>{const t=Wl.settings.get("emoji_categories");return xl`<ul>${Object.keys(t).map((n=>t[n]?(e=>xl`
<li data-category="${e.category}"
class="emoji-category ${e.category} ${e.current_category===e.category?"picked":""}"
title="${Dg(Wl.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)}
</div>
${e.render_emojis?xl`<converse-emoji-picker-content
.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">
<ul>${["tone1","tone2","tone3","tone4","tone5"].map((t=>(e=>xl`
<li data-skintone="${e.skintone}" class="emoji-skintone ${e.current_skintone===e.skintone?"picked":""}">
<a class="pick-skintone" href="#" data-skintone="${e.skintone}" @click=${e.onSkintonePicked}>${o_.shortnamesToEmojis(":"+e.skintone+":")}</a>
</li>`)(Object.assign({skintone:t},e))))}</ul>
</div>`},{sizzle:l_}=Jl.env;Wl.elements.define("converse-emoji-picker-content",class extends zg{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 xl`
<div class="emoji-picker__lists">
${(e=>{const t=Dg("Search results");return xl`
<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">
${e.search_results.map((t=>a_(Object.assign({emoji:t},e))))}
</ul>
</span>
`})(e)}
${(e=>{const t=Wl.settings.get("emoji_categories");return xl`
<span ?hidden=${e.query} class="emoji-lists__container emoji-lists__container--browse">
${Object.keys(t).map((n=>t[n]?(e=>xl`
<a id="emoji-picker-${e.category}" class="emoji-category__heading" data-category="${e.category}">${Dg(Wl.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=>a_(Object.assign({emoji:t},e))))}
</ul>`)(Object.assign({category:n},e)):""))}
</span>`})(e)}
</div>
`}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)}l_(".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||Ya.FILTER_CONTAINS(e,this.query))}});const d_=Jl.env.utils;Wl.elements.define("converse-emoji-dropdown",class extends Ty{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await Wl.emojis.initialize();const e=`converse.emoji-${Ya.bare_jid}-${this.chatview.model.get("jid")}`;this.model=new Ya.EmojiPicker({id:e}),Oo(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(){const e=this.chatview.model.get("type")===Ya.CHATROOMS_TYPE?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color";return xl`
<div class="dropup">
<button class="toggle-emojis"
title="${Dg("Insert emojis")}"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<converse-icon
color="var(${e})"
class="fa fa-smile "
path-prefix="${Wl.settings.get("assets_path")}"
size="1em"></converse-icon>
</button>
<div class="dropdown-menu">
${uv(this.initModel().then((()=>xl`
<converse-emoji-picker
.chatview=${this.chatview}
.model=${this.model}
@emojiSelected=${()=>this.hideMenu()}
?render_emojis=${this.render_emojis}
current_category="${this.model.get("current_category")||""}"
current_skintone="${this.model.get("current_skintone")||""}"
query="${this.model.get("query")||""}"
></converse-emoji-picker>`)),"")}
</div>
</div>`}connectedCallback(){super.connectedCallback(),this.render_emojis=!1}toggleMenu(e){e.stopPropagation(),e.preventDefault(),d_.hasClass("show",this.menu)?d_.ancestor(e.target,".toggle-emojis")&&this.hideMenu():this.showMenu()}async showMenu(){await this.initModel(),this.render_emojis||(this.render_emojis=!0,this.requestUpdate(),await this.updateComplete),super.showMenu(),setTimeout((()=>{var e;return null===(e=this.querySelector(".emoji-search"))||void 0===e?void 0:e.focus()}))}});var u_=n(8125),h_={};h_.styleTagTransform=Yg(),h_.setAttributes=Vg(),h_.insert=Gg().bind(null,"head"),h_.domAPI=qg(),h_.insertStyleElement=Qg(),Ug()(u_.Z,h_),u_.Z&&u_.Z.locals&&u_.Z.locals;const m_=Jl.env.utils;Wl.elements.define("converse-emoji-picker",class extends zg{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,reflect:!0},render_emojis:{type:Boolean}}}firstUpdated(){super.firstUpdated(),this.listenTo(this.model,"change",(e=>this.onModelChanged(e.changed))),this.initArrowNavigation()}constructor(){super(),this.query="",this._search_results=[],this.debouncedFilter=va((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 c_({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.onSearchInputKeyDown(e),onSkintonePicked:e=>this.chooseSkinTone(e),query:this.query,search_results:this.search_results,render_emojis:this.render_emojis,sn2Emoji:e=>m_.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=Ya.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=[])}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),this.disableArrowNavigation(),super.disconnectedCallback()}_onGlobalKeyDown(e){this.navigator&&(e.keyCode===ve.ENTER&&m_.isVisible(this)?this.onEnterPressed(e):e.keyCode===ve.DOWN_ARROW&&!this.navigator.enabled&&m_.isVisible(this)?this.enableArrowNavigation(e):e.keyCode===ve.ESCAPE&&(this.disableArrowNavigation(),setTimeout((()=>this.chatview.querySelector(".chat-textarea").focus()),50)))}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.model.set({autocompleting:null,query:"",ac_position:null}),this.disableArrowNavigation();const i={bubbles:!0,detail:{value:e,autocompleting:t,ac_position:n}};this.dispatchEvent(new CustomEvent("emojiSelected",i))}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();const t=e.target.matches("li")?e.target:m_.ancestor(e.target,"li");this.setCategoryForElement(t),this.navigator.select(t),!this.navigator.enabled&&this.navigator.enable()}onSearchInputKeyDown(e){if(e.keyCode===ve.TAB)if(e.target.value){e.preventDefault();const t=Jl.emojis.shortnames.find((t=>Ya.FILTER_CONTAINS(t,e.target.value)));t&&this.model.set({query:t})}else this.navigator.enabled||this.enableArrowNavigation(e);else e.keyCode!==ve.DOWN_ARROW||this.navigator.enabled?e.keyCode!==ve.ENTER&&e.keyCode!==ve.DOWN_ARROW&&this.debouncedFilter(e.target):this.enableArrowNavigation(e)}onEnterPressed(e){e.preventDefault(),e.stopPropagation(),Jl.emojis.shortnames.includes(e.target.value)?this.insertIntoTextArea(e.target.value):1===this.search_results.length?this.insertIntoTextArea(this.search_results[0].sn):this.navigator.selected&&this.navigator.selected.matches(".insert-emoji")?this.insertIntoTextArea(this.navigator.selected.getAttribute("data-emoji")):this.navigator.selected&&this.navigator.selected.matches(".emoji-category")&&this.chooseCategory({target:this.navigator.selected})}onSearchInputFocus(e){this.chatview.emitBlurred(e),this.disableArrowNavigation()}getTonedShortname(e){return Jl.emojis.toned.includes(e)&&this.current_skintone?`${e.slice(0,e.length-1)}_${this.current_skintone}:`:e}initArrowNavigation(){if(!this.navigator){const e="li:not(.hidden):not(.emoji-skintone), .emoji-search",t={jump_to_picked:".emoji-category",jump_to_picked_selector:".emoji-category.picked",jump_to_picked_direction:Sy.DIRECTION.down,picked_selector:".picked",scroll_container:this.querySelector(".emoji-picker__lists"),getSelector:t=>{if(t===Sy.DIRECTION.down){const t=this.navigator.selected&&this.navigator.selected.getAttribute("data-category");return t?`ul[data-category="${t}"] li:not(.hidden):not(.emoji-skintone), .emoji-search`:e}return e},onSelected:e=>{e.matches(".insert-emoji")&&this.setCategoryForElement(e.parentElement),e.matches(".insert-emoji, .emoji-category")&&e.firstElementChild.focus(),e.matches(".emoji-search")&&e.focus()}};this.navigator=new Sy(this,t)}}disableArrowNavigation(){var e;null===(e=this.navigator)||void 0===e||e.disable()}enableArrowNavigation(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.disableArrowNavigation(),this.navigator.enable(),this.navigator.handleKeydown(e)}}),Wl.elements.define("converse-message-limit-indicator",class extends zg{static get properties(){return{model:{type:Object}}}connectedCallback(){super.connectedCallback(),this.listenTo(this.model,"change:draft",this.requestUpdate)}render(){const e=Wl.settings.get("message_limit");return e?(e=>{const t=Dg("Message characters remaining");return xl`<span class="message-limit ${e<1?"error":""}" title="${t}">${e}</span>`})(e-(this.model.get("draft")||"").length):""}});var f_=n(6176),g_={};g_.styleTagTransform=Yg(),g_.setAttributes=Vg(),g_.insert=Gg().bind(null,"head"),g_.domAPI=qg(),g_.insertStyleElement=Qg(),Ug()(f_.Z,g_),f_.Z&&f_.Z.locals&&f_.Z.locals;const p_=Jl.env.Strophe;async function v_(e){const t=await e;return t?xl`
<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 y_(e){const t=await e;return xl`
<a
href="#"
class="chatbox-btn ${t.a_class} fa ${t.icon_class}"
@click=${t.handler}
title="${t.i18n_title}"
></a>
`}async function __(e){!0===confirm(Dg("Are you sure you want to clear the messages from this conversation?"))&&await e.clearMessages()}function b_(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 zg{static get properties(){return{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(){return xl`
<span class="toolbar-buttons">${uv((e=this).getButtons(),"")}</span>
${e.show_send_button?function(){const e=Dg("Send the message");return xl`<button type="submit" class="btn send-button" title="${e}">
<converse-icon color="var(--toolbar-btn-text-color)" class="fa fa-paper-plane" size="1em"></converse-icon>
</button>`}():""}
`;var e}firstUpdated(){Wl.trigger("renderToolbar",this)}getButtons(){var e;const t=[];if(this.show_emoji_button){const e=Ya.chatboxviews.get(this.model.get("jid"));t.push(xl`<converse-emoji-dropdown .chatview=${e}></converse-emoji-dropdown>`)}if(this.show_call_button){const e=this.is_groupchat?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color",n=Dg("Start a call");t.push(xl`
<button class="toggle-call" @click=${this.toggleCall} title="${n}">
<converse-icon color="var(${e})" class="fa fa-phone" size="1em"></converse-icon>
</button>`)}Wl.settings.get("message_limit")&&t.push(xl`
<converse-message-limit-indicator .model=${this.model} class="right">
</converse-message-limit-indicator>`),this.show_spoiler_button&&t.push(this.getSpoilerButton());const n=Wl.disco.supports(p_.NS.HTTPUPLOAD,Ya.domain);if(t.push(xl`${uv(n.then((e=>this.getHTTPUploadButton(e))),"")}`),this.is_groupchat&&null!==(e=Wl.settings.get("visible_toolbar_buttons"))&&void 0!==e&&e.toggle_occupants){const e=Dg("Hide participants"),n=Dg("Show participants");t.push(xl`
<button class="toggle_occupants right"
title="${this.hidden_occupants?n:e}"
@click=${this.toggleOccupants}>
<converse-icon
color="var(--muc-toolbar-btn-color)"
class="fa ${this.hidden_occupants?"fa-angle-double-left":"fa-angle-double-right"}"
size="1em"></converse-icon>
</button>`)}return Ya.api.hook("getToolbarButtons",this,t)}getHTTPUploadButton(e){if(e){const e=Dg("Choose a file to send"),t=this.is_groupchat?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color";return xl`
<button title="${e}" @click=${this.toggleFileUpload}>
<converse-icon
color="var(${t})"
class="fa fa-paperclip"
size="1em"></converse-icon>
</button>
<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=t.get("composing_spoiler")?Dg("Click to write as a normal (non-spoiler) message"):Dg("Click to write your message as a spoiler");const i=this.is_groupchat?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color",s=xl`
<button class="toggle-compose-spoiler"
title="${n}"
@click=${this.toggleComposeSpoilerMessage}>
<converse-icon
color="var(${i})"
class="fa ${t.get("composing_spoiler")?"fa-eye-slash":"fa-eye"}"
size="1em"></converse-icon>
</button>`;if(this.is_groupchat)return s;{const e=t.get("jid"),n=Promise.all(t.presence.resources.map((t=>Wl.disco.supports(p_.NS.SPOILER,`${e}/${t.get("name")}`)))).then((e=>e.reduce(((e,t)=>e&&t),!0)));return xl`${uv(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),Wl.trigger("callButtonClicked",{connection:Ya.connection,model:this.model})}});var w_=n(7802),S_={};S_.styleTagTransform=Yg(),S_.setAttributes=Vg(),S_.insert=Gg().bind(null,"head"),S_.domAPI=qg(),S_.insertStyleElement=Qg(),Ug()(w_.Z,S_),w_.Z&&w_.Z.locals&&w_.Z.locals,Wl.elements.define("converse-chat-heading",class extends zg{initialize(){var e;this.model=Ya.chatboxes.get(this.getAttribute("jid")),this.listenTo(this.model,"change:status",this.requestUpdate),this.listenTo(this.model,"vcard:add",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,n;const i=Dg("The User's Profile Image"),s=xl`<span title="${i}">
<converse-avatar
class="avatar chat-msg__avatar"
.data=${null===(t=e.model.vcard)||void 0===t?void 0:t.attributes}
nonce=${null===(n=e.model.vcard)||void 0===n?void 0:n.get("vcard_updated")}
height="40" width="40"></converse-avatar></span>`,r=e.model.getDisplayName();return xl`
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
${Ya.api.settings.get("singleton")?"":xl`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
${e.type!==Ya.HEADLINES_TYPE?xl`<a class="show-msg-author-modal" @click=${e.showUserDetailsModal}>${s}</a>`:""}
<div class="chatbox-title__text" title="${e.jid}">
${e.type!==Ya.HEADLINES_TYPE?xl`<a class="user show-msg-author-modal" @click=${e.showUserDetailsModal}>${r}</a>`:r}
</div>
</div>
<div class="chatbox-title__buttons row no-gutters">
${uv(async function(e){const t=(await e).filter((e=>!e.standalone));return t.map((e=>v_(e)))}(e.heading_buttons_promise).then((e=>e.length?xl`<converse-dropdown class="dropleft" color="var(--chat-head-text-color)" .items=${e}></converse-dropdown>`:"")),"")}
${uv(async function(e){const t=(await e).filter((e=>e.standalone));return t.map((e=>y_(e)))}(e.heading_buttons_promise).then((e=>e.reverse().map((e=>uv(e,""))))),"")}
</div>
</div>
${e.status?xl`<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(),Wl.modal.show(Ly,{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:Dg("Details"),i18n_title:Dg("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===Wl.settings.get("view_mode")}];Wl.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Dg("Close"),i18n_title:Dg("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Wl.settings.get("view_mode")});const t=Ya.chatboxviews.get(this.getAttribute("jid"));return t?Ya.api.hook("getHeadingButtons",t,e):e}});const{u:x_}=Jl.env;class E_ extends Tp{async connectedCallback(){super.connectedCallback(),this.model=Ya.chatboxes.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.render())),this.handleEmojiSelection=e=>{let{detail:t}=e;return this.insertIntoTextArea(t.value,t.autocompleting,!1,t.ac_position)},document.addEventListener("emojiSelected",this.handleEmojiSelection),this.render()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("emojiSelected",this.handleEmojiSelection)}toHTML(){var e,t;return(e=>{const t=e.composing_spoiler?Dg("Hidden message"):Dg("Message"),n=Dg("Optional hint"),i=Wl.settings.get("show_send_button");return xl`
<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=${b_}
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea
${i?"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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;const s=this.querySelector(".chat-textarea");if(n?x_.addClass("correcting",s):x_.removeClass("correcting",s),t)s.value=i&&"string"==typeof t?s.value.replace(new RegExp(t,"g"),((n,s)=>s==i-t.length?e+" ":n)):e;else{let t=s.value;t&&" "!==t[t.length-1]&&(t+=" "),s.value=t+e+" "}const r=document.createEvent("HTMLEvents");r.initEvent("change",!1,!0),s.dispatchEvent(r),x_.placeCaretAtEnd(s)}onMessageCorrecting(e){if(e.get("correcting"))this.insertIntoTextArea(Ra(e),!0,!0);else{const t=this.model.messages.findWhere("correcting");t&&t!==e?this.insertIntoTextArea(Ra(e),!0,!0):this.insertIntoTextArea("",!0,!1)}}onEscapePressed(e){const t=this.model.messages.findLastIndex("correcting"),n=t>=0?this.model.messages.at(t):null;n&&(e.preventDefault(),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=x_.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&&x_.hasClass("correcting",this.querySelector(".chat-textarea")))return this.model.editLaterMessage()}else{const e=this.querySelector(".chat-textarea");if(!e.value||x_.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")!==Ya.COMPOSING&&this.model.setChatState(Ya.COMPOSING)}}async onFormSubmitted(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const i=this.querySelector(".chat-textarea"),s=i.value.trim();if(Wl.settings.get("message_limit")&&s.length>Wl.settings.get("message_limit")||!s.replace(/\s/g,"").length)return;if(!Ya.connection.authenticated){const e=Dg("Sorry, the connection has been lost, and your message could not be sent");return Wl.alert("error",Dg("Error"),e),void Wl.connection.reconnect()}let r,o={};this.model.get("composing_spoiler")&&(o=this.querySelector("form.sendXMPPMessage input.spoiler-hint"),r=o.value),x_.addClass("disabled",i),i.setAttribute("disabled","disabled"),null===(n=this.querySelector("converse-emoji-dropdown"))||void 0===n||n.hideMenu();const a=await async function(e,t){const n=t.replace(/^\s*/,"").match(/^\/(.*)\s*$/);if(n){let s=!1;if(s=await Wl.hook("parseMessageForCommands",{model:e,text:t},s),s)return!0;if("clear"===n[1])return __(e),!0;var i;if("close"===n[1])return null===(i=Ya.chatboxviews.get(e.get("jid")))||void 0===i||i.close(),!0;if("help"===n[1])return e.set({show_help_messages:!1},{silent:!0}),e.set({show_help_messages:!0}),!0}return!1}(this.model,s),c=a?null:await this.model.sendMessage({body:s,spoiler_hint:r});(a||c)&&(o.value="",i.value="",x_.removeClass("correcting",i),i.style.height="auto",this.model.set({draft:""})),"overlayed"===Wl.settings.get("view_mode")&&(Ya.chatboxviews.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display="none"),i.removeAttribute("disabled"),x_.removeClass("disabled",i),"overlayed"===Wl.settings.get("view_mode")&&(Ya.chatboxviews.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display=""),this.model.setChatState(Ya.ACTIVE,{silent:!0}),i.focus()}}Wl.elements.define("converse-message-form",E_);var A_=n(352),C_={};C_.styleTagTransform=Yg(),C_.setAttributes=Vg(),C_.insert=Gg().bind(null,"head"),C_.domAPI=qg(),C_.insertStyleElement=Qg(),Ug()(A_.Z,C_),A_.Z&&A_.Z.locals&&A_.Z.locals;class T_ extends Tp{constructor(){var e,t,n;super(),n={"click .send-button":"sendButtonClicked","click .toggle-clear":"clearMessages"},(t="events")in(e=this)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,this.debouncedRender=va(this.render,100)}async connectedCallback(){super.connectedCallback(),await this.initialize(),this.render()}async initialize(){this.model=await Wl.chatboxes.get(this.getAttribute("jid")),await this.model.initialized,this.listenTo(this.model,"change:num_unread",this.debouncedRender),this.listenTo(this.model,"emoji-picker-autocomplete",this.autocompleteInPicker),this.addEventListener("focusin",(e=>this.emitFocused(e))),this.addEventListener("focusout",(e=>this.emitBlurred(e)))}render(){Tl((e=>{const t=Dg("You have unread messages"),n=Wl.settings.get("message_limit"),i=Wl.settings.get("visible_toolbar_buttons").call,s=Wl.settings.get("visible_toolbar_buttons").emoji,r=Wl.settings.get("show_send_button"),o=Wl.settings.get("visible_toolbar_buttons").spoiler,a=Wl.settings.get("show_toolbar");return xl`
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?xl`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${Wl.settings.get("show_toolbar")?xl`
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?composing_spoiler="${e.model.get("composing_spoiler")}"
?show_call_button="${i}"
?show_emoji_button="${s}"
?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=Ya.chatboxviews.get(this.getAttribute("jid")))||void 0===t||t.emitFocused(e)}emitBlurred(e){var t;null===(t=Ya.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),__(this.model)}async autocompleteInPicker(e,t){await Wl.emojis.initialize();const n=this.querySelector("converse-emoji-picker");if(n){n.model.set({ac_position:e.selectionStart,autocompleting:t,query:t});const i=this.querySelector("converse-emoji-dropdown");null==i||i.showMenu()}}}Wl.elements.define("converse-chat-bottom-panel",T_);class k_ extends zg{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),Ya.chatboxviews.remove(this.jid,this)}updated(){this.model&&this.jid!==this.model.get("jid")&&(this.stopListening(),Ya.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(){Wl.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)||Wl.trigger("chatBoxBlurred",this,e)}emitFocused(e){this.contains(e.relatedTarget)||Wl.trigger("chatBoxFocused",this,e)}getBottomPanel(){return this.model.get("type")===Ya.CHATROOMS_TYPE?this.querySelector("converse-muc-bottom-panel"):this.querySelector("converse-chat-bottom-panel")}getMessageForm(){return this.model.get("type")===Ya.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}),Yy(this.model)}onWindowStateChanged(e){"visible"===e.state?this.model.isHidden()||this.model.clearUnreadMsgCounter():"hidden"===e.state&&(this.model.setChatState(Ya.INACTIVE,{silent:!0}),this.model.sendChatState())}}class j_ extends k_{constructor(){var e,t;super(...arguments),(t="length")in(e=this)?Object.defineProperty(e,t,{value:200,enumerable:!0,configurable:!0,writable:!0}):e[t]=200}async initialize(){Ya.chatboxviews.add(this.jid,this),this.model=Ya.chatboxes.get(this.jid),this.listenTo(Ya,"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(),Wl.trigger("chatBoxViewInitialized",this)}render(){return(e=>xl`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e.model?xl`
<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>
${e.show_help_messages?xl`<div class="chat-content__help">
<converse-chat-help
.model=${e.model}
.messages=${e.help_messages}
?hidden=${!e.show_help_messages}
type="info"
chat_type="${Ya.CHATROOMS_TYPE}"
></converse-chat-help></div>`:""}
</div>
<converse-chat-bottom-panel jid="${e.jid}" class="bottom-panel"> </converse-chat-bottom-panel>
</div>
`:""}
</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>: ${Dg("Remove messages")}`,`<strong>/close</strong>: ${Dg("Close this chat")}`,`<strong>/me</strong>: ${Dg("Write in the third person")}`,`<strong>/help</strong>: ${Dg("Show this menu")}`]}showControlBox(){var e;null===(e=Ya.chatboxviews.get("controlbox"))||void 0===e||e.show()}afterShown(){this.model.setChatState(Ya.ACTIVE),this.model.clearUnreadMsgCounter(),this.maybeFocus()}}Wl.elements.define("converse-chat",j_);var $_=n(5599),N_={};N_.styleTagTransform=Yg(),N_.setAttributes=Vg(),N_.insert=Gg().bind(null,"head"),N_.domAPI=qg(),N_.insertStyleElement=Qg(),Ug()($_.Z,N_),$_.Z&&$_.Z.locals&&$_.Z.locals;const{Strophe:O_}=Jl.env;Jl.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){Wl.settings.extend({allowed_audio_domains:null,allowed_image_domains:null,allowed_video_domains:null,auto_focus:!0,debounced_content_rendering:!0,filter_url_query_params:null,image_urls_regex:null,message_limit:0,muc_hats:["xep317"],render_media:!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}}),Ya.ChatBoxView=j_,Wl.listen.on("connected",(()=>Wl.disco.own.features.add(O_.NS.SPOILER))),Wl.listen.on("chatBoxClosed",(e=>{return t=e.get("jid"),void(Ya.router.history.getFragment()===`converse/chat?jid=${t}`&&Ya.router.navigate(""));var t}))}}),Wl.elements.define("converse-brand-byline",class extends zg{render(){const e="fullscreen"===Wl.settings.get("view_mode");return xl`
${e?xl`
<p class="brand-subtitle">${Ya.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>
`:""}
`}}),Wl.elements.define("converse-brand-logo",class extends zg{render(){const e="fullscreen"===Wl.settings.get("view_mode");return xl`
<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">
<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>
</g>
</g>
</svg>
<span class="brand-name">
<span class="brand-name__text">converse<span class="subdued">.js</span></span>
${e?xl`
<p class="byline">messaging freedom</p>
`:""}
</span>
</span>
</a>
`}}),Wl.elements.define("converse-brand-heading",class extends zg{render(){return xl`
<converse-brand-logo></converse-brand-logo>
<converse-brand-byline></converse-brand-byline>
`}});const I_=[0,1,2,3,4,7,10],M_={0:"Error",1:"Connecting",2:"Connection failure",3:"Authenticating",4:"Authentication failure",5:"Connected",6:"Disconnected",7:"Disconnecting",8:"Attached",9:"Redirect",10:"Reconnecting"},R_={Error:"error",Connecting:"info","Connection failure":"error",Authenticating:"info","Authentication failure":"error",Connected:"info",Disconnected:"error",Disconnecting:"warn",Attached:"info",Redirect:"info",Reconnecting:"warn"},D_=e=>{const t=Ya.connfeedback.get("connection_status");let n,i;I_.includes(t)&&(i=M_[t],n=R_[i]);const s=Ya.connfeedback.get("message");return xl`
<converse-brand-heading></converse-brand-heading>
<form id="converse-login" class="converse-form" method="post" @submit=${e.onLoginFormSubmitted}>
<div class="conn-feedback fade-in ${i?n:"hidden"}">
<p class="feedback-subject">${i}</p>
<p class="feedback-message ${s?"":"hidden"}">${s}</p>
</div>
${"CONNECTING"===Ya.CONNECTION_STATUS[t]?Vy({classes:"hor_centered"}):(e=>{const t=Wl.settings.get("authentication"),{ANONYMOUS:n,EXTERNAL:i,LOGIN:s,PREBIND:r}=Ya,o=Dg("Disconnected"),a=Dg("Click here to log in anonymously");return xl`
${t==s||t==i?(e=>{const t=Wl.settings.get("authentication"),n=Dg("Log in"),i=Dg("XMPP Address"),s=Wl.settings.get("locked_domain"),r=Wl.settings.get("default_domain"),o=(s||r)&&Dg("Username")||Dg("user@domain"),a=Wl.settings.get("allow_user_trust_override");return xl`
<div class="form-group">
<label for="converse-login-jid">${i}:</label>
<input id="converse-login-jid"
?autofocus=${!!Wl.settings.get("auto_focus")}
@changed=${e.validate}
value="${Wl.settings.get("jid")??""}"
required
class="form-control"
type="text"
name="jid"
placeholder="${o}"/>
</div>
${t!==Ya.EXTERNAL?(()=>{const e=Dg("Password");return xl`
<div class="form-group">
<label for="converse-login-password">${e}</label>
<input id="converse-login-password"
class="form-control"
required="required"
value="${Wl.settings.get("password")??""}"
type="password"
name="password"
placeholder="${e}"/>
</div>
`})():""}
${Wl.settings.get("show_connection_url_input")?(()=>{const e=Dg("Connection URL"),t=Dg("HTTP or websocket URL that is used to connect to your XMPP server"),n=Dg("e.g. wss://example.org/xmpp-websocket");return xl`
<div class="form-group fade-in">
<label for="converse-conn-url">${e}</label>
<p class="form-help instructions">${t}</p>
<input id="converse-conn-url"
class="form-control"
type="url"
name="connection-url"
placeholder="${n}"/>
</div>
`})():""}
${a?(e=>{const t=Dg("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=Dg("This is a trusted device");return xl`
<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"!==a):""}
<fieldset class="form-group buttons">
<input class="btn btn-primary" type="submit" value="${n}"/>
</fieldset>
${Wl.settings.get("allow_registration")&&!Wl.settings.get("auto_login")&&Ya.pluggable.plugins["converse-register"].enabled(Ya)?(()=>{const e=Dg("Create an account"),t=Dg("Don't have a chat account?");return xl`
<fieldset class="switch-form">
<p>${t}</p>
<p><a class="register-account toggle-register-login" href="#converse/register">${e}</a></p>
</fieldset>
`})():""}
`})(e):""}
${t==n?xl`<input class="btn btn-primary login-anon" type="submit" value="${a}">`:""}
${t==r?xl`<p>${o}</p>`:""}
`})(e)}
</form>`},{Strophe:L_,u:z_}=Jl.env;function P_(){var e;const t=Ya.chatboxes.add(new Ya.ControlBox({id:"controlbox"}));return null===(e=Ya.chatboxviews.get("controlbox"))||void 0===e||e.setModel(),t}function F_(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=Ya.chatboxes.get("controlbox")||P_();z_.safeSave(n,{closed:!1})}function U_(){const e=Ya.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e}function B_(){const e=null==Ya?void 0:Ya.chatboxviews,t=e&&e.get("controlbox");t&&(z_.safeSave(t.model,{connected:!1}),null!=t&&t.controlbox_pane&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}function q_(){(Ya.chatboxes.get("controlbox")||P_()).save({connected:!0})}const{Strophe:H_,u:G_}=Jl.env;Wl.elements.define("converse-login-panel",class extends zg{initialize(){this.listenTo(Ya.connfeedback,"change",(()=>this.requestUpdate())),this.handler=()=>this.requestUpdate()}connectedCallback(){super.connectedCallback(),Wl.settings.listen.on("change",this.handler)}disconnectedCallback(){super.disconnectedCallback(),Wl.settings.listen.not("change",this.handler)}render(){return D_(this)}firstUpdated(){this.initPopovers()}async onLoginFormSubmitted(e){if(null==e||e.preventDefault(),Wl.settings.get("authentication")===Ya.ANONYMOUS)return this.connect(Ya.jid);(function(e){const t=e.querySelector("input[name=jid]");return!t.value||Wl.settings.get("locked_domain")||Wl.settings.get("default_domain")||z_.isValidJID(t.value)?(t.setCustomValidity(""),!0):(t.setCustomValidity(Dg("Please enter a valid XMPP address")),!1)})(e.target)&&(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new FormData(e),i=n.get("connection-url");null!=i&&i.startsWith("ws")?t.websocket_url=i:null!=i&&i.startsWith("http")&&(t.bosh_service_url=i);let s=n.get("jid");if(Wl.settings.get("locked_domain")){const e="@"+Wl.settings.get("locked_domain");s.endsWith(e)&&(s=s.substr(0,s.length-e.length)),s=L_.escapeNode(s)+e}else Wl.settings.get("default_domain")&&!s.includes("@")&&(s=s+"@"+Wl.settings.get("default_domain"));t.jid=s,t.password=n.get("password"),Wl.settings.set(t),Ya.config.save({trusted:!!n.get("trusted")})}(e.target),Wl.settings.get("bosh_service_url")||Wl.settings.get("websocket_url")||await this.discoverConnectionMethods(e),Wl.settings.get("bosh_service_url")||Wl.settings.get("websocket_url")?this.connect():Wl.settings.set("show_connection_url_input",!0))}async discoverConnectionMethods(e){var t;if(!Wl.settings.get("discover_connection_methods"))return;const n=new FormData(e.target).get("jid"),i=H_.getDomainFromJid(n);return(null===(t=Ya.connection)||void 0===t||!t.jid||n&&!G_.isSameDomain(Ya.connection.jid,n))&&await Ya.initConnection(),Ya.connection.discoverConnectionMethods(i)}initPopovers(){Array.from(this.querySelectorAll("[data-title]")).forEach((e=>{new(ip().Popover)(e,{trigger:"mobile"===Wl.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===Wl.settings.get("view_mode"),container:this.parentElement.parentElement.parentElement})}))}connect(e){var t;["converse/login","converse/register"].includes(Ya.router.history.getFragment())&&Ya.router.navigate("",{replace:!0}),null===(t=Ya.connection)||void 0===t||t.reset(),Wl.user.login(e)}});Wl.elements.define("converse-controlbox-navback",class extends zg{static get properties(){return{jid:{type:String}}}render(){return e=this.jid,xl`<converse-icon size="1em" class="fa fa-arrow-left" @click=${()=>function(e){F_();const t=Ya.chatboxes.get(e);z_.safeSave(t,{hidden:!0})}(e)}></converse-icon>`;var e}});const{dayjs:W_}=Jl.env,V_=fa.extend({defaults:()=>({bookmarked:!1,box_id:"controlbox",chat_state:void 0,closed:!Wl.settings.get("show_controlbox_by_default"),num_unread:0,time_opened:W_(0).valueOf(),type:Ya.CONTROLBOX_TYPE,url:""}),validate(e){return e.type===Ya.CONTROLBOX_TYPE?"embedded"===Wl.settings.get("view_mode")&&Wl.settings.get("singleton")?"Controlbox not relevant in embedded view mode":void 0:Ya.ChatBox.prototype.validate.call(this,e)},maybeShow(e){return e||"controlbox"!==this.get("id")?Ya.ChatBox.prototype.maybeShow.call(this,e):this},onReconnection(){this.save("connected",!0)}});class J_ extends zg{async connectedCallback(){super.connectedCallback(),await Wl.waitUntil("initialized"),this.model=Ya.chatboxes.get("controlbox"),this.listenTo(this.model,"change:closed",(()=>this.requestUpdate())),this.requestUpdate()}render(){var e;return(e=>{const t=Wl.connection.connected()?Dg("Chat Contacts"):Dg("Toggle chat");return xl`<a id="toggle-controlbox" class="toggle-controlbox ${e.hide?"hidden":""}" @click=${e.onClick}><span class="toggle-feedback">${t}</span></a>`})({onClick:F_,hide:!(null!==(e=this.model)&&void 0!==e&&e.get("closed"))})}}Wl.elements.define("converse-controlbox-toggle",J_);const Q_=J_,Z_=Jl.env.utils;class Y_ extends Tp{initialize(){this.setModel(),this.render(),Ya.chatboxviews.add("controlbox",this),Wl.trigger("controlBoxInitialized",this)}setModel(){this.model=Ya.chatboxes.get("controlbox"),this.initEventHandlers()}initEventHandlers(){this.listenTo(this.model,"change:active-form",this.render),this.listenTo(this.model,"change:connected",this.render),this.listenTo(this.model,"change:closed",(()=>!this.model.get("closed")&&this.afterShown()))}render(){Tl((e=>xl`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
<div class="chat-head controlbox-head">
${e.sticky_controlbox?"":xl`
<a class="chatbox-btn close-chatbox-button fa fa-times" @click=${e.close}></a>
`}
</div>
<div class="controlbox-panes">
<div class="controlbox-pane">
${e.connected?xl`
<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>
${Wl.settings.get("authentication")===Ya.ANONYMOUS?"":xl`<div id="converse-roster" class="controlbox-section"><converse-roster></converse-roster></div>`}`:"register"===e["active-form"]?xl`<converse-register-panel></converse-register-panel>`:xl`<converse-login-panel id="converse-login-panel" class="controlbox-pane fade-in row no-gutters">
</converse-login-panel>`}
</div>
</div>
</div>
`)({sticky_controlbox:Wl.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",!Wl.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)||Ya.disconnection_cause===Ya.LOGOUT&&!Wl.settings.get("show_controlbox_by_default"))&&!Wl.settings.get("sticky_controlbox"))return Z_.safeSave(this.model,{closed:!0}),Wl.trigger("controlBoxClosed",this),this}afterShown(){return Wl.trigger("controlBoxOpened",this),this}showHelpMessages(){}}Wl.elements.define("converse-controlbox",Y_);const X_=Y_,{u:K_}=Jl.env,eb={controlbox:{async open(){await Wl.waitUntil("chatBoxesFetched");const e=await Wl.chatboxes.get("controlbox")||Wl.chatboxes.create("controlbox",{},Ya.Controlbox);return K_.safeSave(e,{closed:!1}),e},get:()=>Ya.chatboxviews.get("controlbox")}};var tb=n(1875),nb={};nb.styleTagTransform=Yg(),nb.setAttributes=Vg(),nb.insert=Gg().bind(null,"head"),nb.domAPI=qg(),nb.insertStyleElement=Qg(),Ug()(tb.Z,nb),tb.Z&&tb.Z.locals&&tb.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 V_(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){Wl.settings.extend({allow_logout:!0,allow_user_trust_override:!0,default_domain:void 0,locked_domain:void 0,show_connection_url_input:!1,show_controlbox_by_default:!1,sticky_controlbox:!1}),Wl.promises.add("controlBoxInitialized"),Object.assign(Wl,eb),Ya.ControlBoxView=X_,Ya.ControlBox=V_,Ya.ControlBoxToggle=Q_,Wl.listen.on("chatBoxesFetched",q_),Wl.listen.on("clearSession",B_),Wl.listen.on("will-reconnect",U_),Wl.waitUntil("chatBoxViewsInitialized").then(P_).catch((e=>R.fatal(e)))}});const{u:ib}=Jl.env;function sb(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Wl.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=ib.ancestor(e.target,".box-flyout"),i=window.getComputedStyle(n),s=n.parentElement;s.height=parseInt(i.height.replace(/px$/,""),10),Ya.resizing={chatbox:s,direction:"top"},s.prev_pageY=e.pageY,t&&Wl.trigger("startVerticalResize",s)}function rb(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Wl.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=ib.ancestor(e.target,".box-flyout"),i=window.getComputedStyle(n),s=n.parentElement;s.width=parseInt(i.width.replace(/px$/,""),10),Ya.resizing={chatbox:s,direction:"left"},s.prev_pageX=e.pageX,t&&Wl.trigger("startHorizontalResize",s)}function ob(e){rb(e,!1),sb(e,!1),Ya.resizing.direction="topleft",Wl.trigger("startDiagonalResize",this)}function ab(e,t){if(void 0!==e)return void 0===t?e:e!==t&&Math.abs(e-t)<10?t:e}function cb(e){if(!Ya.resizing||!Wl.settings.get("allow_dragresize"))return!0;e.preventDefault(),Ya.resizing.chatbox.resizeChatBox(e)}function lb(e){if(!Ya.resizing||!Wl.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=ab(Ya.resizing.chatbox.height,Ya.resizing.chatbox.model.get("default_height")),n=ab(Ya.resizing.chatbox.width,Ya.resizing.chatbox.model.get("default_width"));Wl.connection.connected()?(Ya.resizing.chatbox.model.save({height:t}),Ya.resizing.chatbox.model.save({width:n})):(Ya.resizing.chatbox.model.set({height:t}),Ya.resizing.chatbox.model.set({width:n})),Ya.resizing=null}const db=()=>xl`
<div class="dragresize dragresize-top" @mousedown="${sb}"></div>
<div class="dragresize dragresize-topleft" @mousedown="${ob}"></div>
<div class="dragresize dragresize-left" @mousedown="${rb}"></div>
`;customElements.define("converse-dragresize",class extends zg{render(){return db()}});const ub={initDragResize(){var e;const t=this,n=va((()=>t.setDimensions()));window.addEventListener("resize",t.debouncedSetDimensions),this.listenTo(this.model,"destroy",(()=>window.removeEventListener("resize",n)));const i=this.querySelector(".box-flyout"),s=window.getComputedStyle(i);if(void 0===this.model.get("height")){const e=parseInt(s.height.replace(/px$/,""),10),t=parseInt(s.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=s["min-width"],o=s["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=Ya.connection)&&void 0!==e&&e.connected&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===Ya.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))),Ya.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?ab(e,this.model.get("default_height"))+"px":"";const t=this.querySelector(".box-flyout");null!==t&&(t.style.height=e)},setChatBoxWidth(e){e=e?ab(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"),i="controlbox"===this.get("id")?e=>this.set(e):e=>this.save(e);return i({height:ab(t,this.get("default_height")),width:ab(n,this.get("default_width"))}),e}}},initialize(){Wl.settings.extend({allow_dragresize:!0}),Object.assign(Ya.ChatBoxView.prototype,ub),Object.assign(Ya.ChatRoomView.prototype,ub),Ya.ControlBoxView&&Object.assign(Ya.ControlBoxView.prototype,ub),Wl.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",cb),document.addEventListener("mouseup",lb)})),Wl.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",cb),document.removeEventListener("mouseup",lb)})),Wl.listen.on("beforeShowingChatView",(e=>e.initDragResize().setDimensions()))}});var hb=n(1833),mb={};mb.styleTagTransform=Yg(),mb.setAttributes=Vg(),mb.insert=Gg().bind(null,"head"),mb.domAPI=qg(),mb.insertStyleElement=Qg(),Ug()(hb.Z,mb),hb.Z&&hb.Z.locals&&hb.Z.locals,Jl.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){Wl.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0});const e=Wl.settings.get("auto_join_rooms"),t=Wl.settings.get("auto_join_private_chats");if(!Array.isArray(e)&&!Array.isArray(t))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(0===e.length&&0===t.length)throw new Error("If you set singleton set to true, you need to specify auto_join_rooms or auto_join_private_chats");if(e.length>0&&t.length>0)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 fb=n(8041),gb={};gb.styleTagTransform=Yg(),gb.setAttributes=Vg(),gb.insert=Gg().bind(null,"head"),gb.domAPI=qg(),gb.insertStyleElement=Qg(),Ug()(fb.Z,gb),fb.Z&&fb.Z.locals&&fb.Z.locals,Jl.plugins.add("converse-fullscreen",{enabled:()=>$a(),initialize(){Wl.settings.extend({chatview_avatar_height:50,chatview_avatar_width:50,hide_open_bookmarks:!0,show_controlbox_by_default:!0,sticky_controlbox:!0})}}),Wl.elements.define("converse-headlines-heading",class extends Tp{async connectedCallback(){super.connectedCallback(),this.model=Ya.chatboxes.get(this.getAttribute("jid")),await this.model.initialized,this.render()}async render(){const e=await this.generateHeadingTemplate();Tl(e,this)}async generateHeadingTemplate(){const e=await this.getHeadingButtons(),t=e.filter((e=>e.standalone)),n=e.filter((e=>!e.standalone));return(e=>xl`
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
${Ya.api.settings.get("singleton")?"":xl`<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?xl`<converse-dropdown class="dropleft" .items=${e.dropdown_btns}></converse-dropdown>`:""}
${e.standalone_btns.length?(e=>e.standalone_btns.reverse().map((e=>uv(e,""))))(e):""}
</div>
</div>
${e.status?xl`<p class="chat-head__desc">${e.status}</p>`:""}
`)(Object.assign(this.model.toJSON(),{display_name:this.model.getDisplayName(),dropdown_btns:n.map((e=>v_(e))),standalone_btns:t.map((e=>y_(e)))}))}getHeadingButtons(){const e=[];return Wl.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Dg("Close"),i18n_title:Dg("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Wl.settings.get("view_mode")}),Ya.api.hook("getHeadingButtons",this,e)}close(e){e.preventDefault(),this.model.close()}}),Wl.elements.define("converse-headlines",class extends k_{async initialize(){Ya.chatboxviews.add(this.jid,this),this.model=Ya.chatboxes.get(this.jid),this.model.disable_mam=!0,this.listenTo(Ya,"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(),Wl.trigger("headlinesBoxViewInitialized",this)}render(){return(e=>xl`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e?xl`
<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),Ya.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&Ya.router.navigate(""),await this.model.close(e),this}getNotifications(){return[]}afterShown(){this.model.clearUnreadMsgCounter()}});class pb extends Tp{constructor(){var e,t,n;super(...arguments),n={"click .open-headline":"openHeadline"},(t="events")in(e=this)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}initialize(){this.model=Ya.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=>xl`
<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=>xl`
<div class="list-container list-container--headline ${e.headlineboxes.length?"":"hidden"}">
<div class="items-list rooms-list headline-list">
${e.headlineboxes.map((t=>(e=>xl`
<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:Dg("Announcements"),headlineboxes:this.model.filter((e=>e.get("type")===Ya.HEADLINES_TYPE)),open_title:Dg("Click to open this server message")})}renderIfHeadline(e){return e&&e.get("type")===Ya.HEADLINES_TYPE&&this.render()}openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");Ya.chatboxes.get(t).maybeShow(!0)}}Wl.elements.define("converse-headlines-panel",pb);var vb=n(5956),yb={};yb.styleTagTransform=Yg(),yb.setAttributes=Vg(),yb.insert=Gg().bind(null,"head"),yb.domAPI=qg(),yb.insertStyleElement=Qg(),Ug()(vb.Z,yb),vb.Z&&vb.Z.locals&&vb.Z.locals,Jl.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],initialize(){Ya.HeadlinesPanel=pb}});var _b=n(9679),bb={};function wb(e,t){return e instanceof pm?xl`<converse-mam-placeholder .model=${e}></converse-mam-placeholder>`:t}async function Sb(e){if(!e.model.ui.get("chat-content-spinner-top")&&e.model.messages.length){const t=e.model.get("type")===Ya.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const i=t?e.model.get("jid"):Ya.bare_jid,s=n&&n.get(`stanza_id ${i}`);e.model.ui.set("chat-content-spinner-top",!0);try{s?await Um(e.model,{before:s}):await Um(e.model,{end:n.get("time")})}catch(t){return R.error(t),void e.model.ui.set("chat-content-spinner-top",!1)}Wl.settings.get("allow_url_history_change")&&Ya.router.history.navigate(`#${n.get("msgid")}`),setTimeout((()=>e.model.ui.set("chat-content-spinner-top",!1)),250)}}}bb.styleTagTransform=Yg(),bb.setAttributes=Vg(),bb.insert=Gg().bind(null,"head"),bb.domAPI=qg(),bb.insertStyleElement=Qg(),Ug()(_b.Z,bb),_b.Z&&_b.Z.locals&&_b.Z.locals,Wl.elements.define("converse-mam-placeholder",class extends zg{static get properties(){return{model:{type:Object}}}render(){return(e=this).model.get("fetching")?Vy({classes:"hor_centered"}):xl`<a @click="${t=>e.fetchMissingMessages(t)}" title="${Dg("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 Um(this.model.collection.chatbox,n),this.model.destroy()}}),Jl.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Wl.listen.on("chatBoxScrolledUp",Sb),Wl.listen.on("getMessageTemplate",wb)}});const xb=fa.extend({defaults:{collapsed:!1}});Wl.elements.define("converse-minimized-chats",class extends zg{async initialize(){this.model=Ya.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(Ya,"connected",this.requestUpdate),this.listenTo(Ya,"reconnected",this.requestUpdate),this.listenTo(Ya,"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),i={chats:e,num_unread:t,num_minimized:n,collapsed:this.minchats.get("collapsed")};return i.toggle=e=>this.toggle(e),(e=>xl`<div id="minimized-chats" class="${e.chats.length?"":"hidden"}">
<a id="toggle-minimized-chats" class="row no-gutters" @click=${e.toggle}>
${e.num_minimized} ${Dg("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=>xl`<converse-minimized-chat
.model=${e}
title=${e.getDisplayName()}
type=${e.get("type")}
num_unread=${e.get("num_unread")}></converse-minimized-chat>`))}
</div>
</div>`)(i)}async initToggle(){const e=`converse.minchatstoggle-${Ya.bare_jid}`;this.minchats=new xb({id:e}),Oo(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")})}});const{dayjs:Eb,u:Ab}=Jl.env;function Cb(e){if("controlbox"===e.model.get("id")){if(Ab.isVisible(e))return Ab.getOuterWidth(e,!0);{const e=document.querySelector("converse-controlbox-toggle");return e?Ab.getOuterWidth(e,!0):0}}return!e.model.get("minimized")&&Ab.isVisible(e)?Ab.getOuterWidth(e,!0):0}function Tb(){const e=document.querySelector("converse-minimized-chats");return Ya.chatboxes.pluck("minimized").includes(!0)?Ab.getOuterWidth(e,!0):0}function kb(e){const t=e?e.model.get("id"):null,n=e?Ab.getOuterWidth(e,!0):0;return Object.values(Ya.chatboxviews.xget(t)).reduce(((e,t)=>e+Cb(t)),n)}function jb(e){if(Ya.isTestEnv()||Wl.settings.get("no_trimming")||"overlayed"!==Wl.settings.get("view_mode"))return;const t=Ya.chatboxviews.filter((e=>!e.model.get("minimized")&&!e.model.get("closed")&&Ab.isVisible(e)));if(t.length<=1)return;const n=Ab.getOuterWidth(document.querySelector("body"),!0);if(Cb(t[0])!==n&&document.querySelector("converse-minimized-chats"))for(;Tb()+kb(e)>n;){const t=$b([e?e.model.get("id"):null]);if(!t)break;{const e=Ya.chatboxes.get(t.get("id"));null==e||e.save("hidden",!0),Ob(t)}}}function $b(e){e.push("controlbox");let t=0,n=Ya.chatboxes.sort().at(t);for(;e.includes(n.get("id"))||!0===n.get("minimized");)if(t++,n=Ya.chatboxes.at(t),!n)return null;return n}function Nb(e,t){null!=e&&e.preventDefault?e.preventDefault():t=e,Ab.safeSave(t,{hidden:!1,minimized:!1,time_opened:(new Date).getTime()})}function Ob(e,t){null!=e&&e.preventDefault?e.preventDefault():t=e,t.setChatState(Ya.INACTIVE),Ab.safeSave(t,{hidden:!0,minimized:!0,time_minimized:(new Date).toISOString()})}Wl.elements.define("converse-minimized-chat",class extends zg{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=Dg("Click to restore this chat");return xl`
<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?xl`<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>
</a>
</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(),Nb(this.model)}});var Ib=n(4915),Mb={};Mb.styleTagTransform=Yg(),Mb.setAttributes=Vg(),Mb.insert=Gg().bind(null,"head"),Mb.domAPI=qg(),Mb.insertStyleElement=Qg(),Ug()(Ib.Z,Mb),Ib.Z&&Ib.Z.locals&&Ib.Z.locals,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:{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){var t;(t=e).on("change:hidden",(e=>!e.get("hidden")&&Nb(t)),t),"controlbox"!==t.get("id")&&t.save({minimized:t.get("minimized")||!1,time_minimized:t.get("time_minimized")||Eb()}),e.on("change:minimized",(()=>function(e){e.get("minimized")?function(e){Wl.trigger("chatBoxMinimized",e)}(e):function(e){e.isScrolledUp()||e.clearUnreadMsgCounter(),e.setChatState(Ya.ACTIVE),Wl.trigger("chatBoxMaximized",e)}(e)}(e)))}Wl.settings.extend({no_trimming:!1}),Wl.promises.add("minimizedChatsInitialized"),Ya.MinimizedChatsToggle=xb,Ya.minimize={trimChats:jb,minimize:Ob,maximize:Nb},Wl.listen.on("chatBoxViewInitialized",(e=>Ya.minimize.trimChats(e))),Wl.listen.on("chatRoomViewInitialized",(e=>Ya.minimize.trimChats(e))),Wl.listen.on("controlBoxOpened",(e=>Ya.minimize.trimChats(e))),Wl.listen.on("chatBoxInitialized",e),Wl.listen.on("chatRoomInitialized",e),Wl.listen.on("getHeadingButtons",((e,t)=>e.model.get("type")===Ya.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>Ob(t,e.model),i18n_text:Dg("Minimize"),i18n_title:Dg("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===Ya.api.settings.get("view_mode")},i=t.map((e=>e.name)).indexOf("signout");return i>-1?[...t.slice(0,i),n,...t.slice(i)]:[n,...t]}(e,t):function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>Ob(t,e.model),i18n_text:Dg("Minimize"),i18n_title:Dg("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===Ya.api.settings.get("view_mode")},i=t.map((e=>e.name)).indexOf("close");return i>-1?[...t.slice(0,i),n,...t.slice(i)]:[n,...t]}(e,t)));const t=va((()=>Ya.minimize.trimChats()),250);Wl.listen.on("registeredGlobalEventHandlers",(()=>window.addEventListener("resize",t))),Wl.listen.on("unregisteredGlobalEventHandlers",(()=>window.removeEventListener("resize",t)))}});const Rb=Jl.env.utils,Db={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 i=t[n];n.split(/\s+/).forEach((t=>e.addEventListener(t,i)))}},unbind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=t[n];n.split(/\s+/).forEach((t=>e.removeEventListener(t,i)))}},regExpEscape:e=>e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),isMention:(e,t)=>t.includes(e[0])||Rb.isMentionBoundary(e[0])&&t.includes(e[1])},Lb=function(e,t){return RegExp(Db.regExpEscape(t.trim()),"i").test(e)},zb=function(e,t){return RegExp("^"+Db.regExpEscape(t.trim()),"i").test(e)},Pb=function(e,t){const n=e.query.toLowerCase(),i=e.label.toLowerCase().indexOf(n),s=t.label.toLowerCase().indexOf(n);return i===s?function(e,t){return e.length!==t.length?e.length-t.length:e<t?-1:1}(e,t):(-1===i?1/0:i)<(-1===s?1/0:s)?-1:1},Fb=(e,t)=>{t=t.trim();const n=document.createElement("li");n.setAttribute("aria-selected","false");const i=new RegExp("("+t+")","ig");return(t?e.split(i):[e]).forEach((e=>{if(t&&e.match(i)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))})),n},Ub=class extends String{constructor(e,t){super();const n=Array.isArray(e)?{label:e[0],value:e[1]}:"object"==typeof e&&"label"in e&&"value"in e?e:{label:e,value:e};this.label=n.label||n.value,this.value=n.value,this.query=t}get lenth(){return this.label.length}toString(){return""+this.label}valueOf(){return this.toString()}},Bb=Jl.env.utils;class qb{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.suggestions=[],this.is_opened=!1,Bb.hasClass("suggestion-box",e)?this.container=e:this.container=e.querySelector(".suggestion-box"),this.input=this.container.querySelector(".suggestion-box__input"),this.input.setAttribute("aria-autocomplete","list"),this.ul=this.container.querySelector(".suggestion-box__results"),this.status=this.container.querySelector(".suggestion-box__additions"),Object.assign(this,{match_current_word:!1,ac_triggers:[],include_triggers:[],min_chars:2,max_items:10,auto_evaluate:!0,auto_first:!1,data:e=>e,filter:Lb,sort:!1!==t.sort&&Pb,item:Fb},t),this.index=-1,this.bindEvents(),this.input.hasAttribute("list")?(this.list="#"+this.input.getAttribute("list"),this.input.removeAttribute("list")):this.list=this.input.getAttribute("data-list")||t.list||[]}bindEvents(){const e={blur:()=>this.close({reason:"blur"})};this.auto_evaluate&&(e.input=()=>this.evaluate()),this._events={input:e,form:{submit:()=>this.close({reason:"submit"})},ul:{mousedown:e=>this.onMouseDown(e),mouseover:e=>this.onMouseOver(e)}},Db.bind(this.input,this._events.input),Db.bind(this.input.form,this._events.form),Db.bind(this.ul,this._events.ul)}set list(e){if(Array.isArray(e)||"function"==typeof e)this._list=e;else if("string"==typeof e&&e.includes(","))this._list=e.split(/\s*,\s*/);else{var t;const n=(null===(t=Db.getElement(e))||void 0===t?void 0:t.children)||[];this._list=Array.from(n).filter((e=>!e.disabled)).map((e=>{const t=e.textContent.trim(),n=e.value||t,i=e.label||t;return""!==n?{label:i,value:n}:null})).filter((e=>e))}document.activeElement===this.input&&this.evaluate()}get list(){return this._list}get selected(){return this.index>-1}get opened(){return this.is_opened}close(e){this.opened&&(this.ul.setAttribute("hidden",""),this.is_opened=!1,this.index=-1,this.trigger("suggestion-box-close",e||{}))}insertValue(e){this.match_current_word?Bb.replaceCurrentWord(this.input,e.value):this.input.value=e.value}open(){this.ul.removeAttribute("hidden"),this.is_opened=!0,this.auto_first&&-1===this.index&&this.goto(0),this.trigger("suggestion-box-open")}destroy(){Db.unbind(this.input,this._events.input),Db.unbind(this.input.form,this._events.form),this.input.removeAttribute("aria-autocomplete")}next(){const e=this.ul.children.length;this.goto(this.index<e-1?this.index+1:e?0:-1)}previous(){const e=this.ul.children.length,t=this.index-1;this.goto(this.selected&&-1!==t?t:e-1)}goto(e){const t=this.ul.children;this.selected&&t[this.index].setAttribute("aria-selected","false"),this.index=e,e>-1&&t.length>0&&(t[e].setAttribute("aria-selected","true"),t[e].focus(),this.status.textContent=t[e].textContent,this.ul.scrollTop=t[e].offsetTop-this.ul.clientHeight+t[e].clientHeight,this.trigger("suggestion-box-highlight",{text:this.suggestions[this.index]}))}select(e){if(e?this.index=Bb.siblingIndex(e):e=this.ul.children[this.index],e){const e=this.suggestions[this.index];this.insertValue(e),this.close({reason:"select"}),this.auto_completing=!1,this.trigger("suggestion-box-selectcomplete",{text:e})}}onMouseOver(e){const t=Bb.ancestor(e.target,"li");t&&this.goto(Array.prototype.slice.call(this.ul.children).indexOf(t))}onMouseDown(e){if(0!==e.button)return;const t=Bb.ancestor(e.target,"li");t&&(e.preventDefault(),this.select(t,e.target))}onKeyDown(e){if(this.opened){if([Jl.keycodes.ENTER,Jl.keycodes.TAB].includes(e.keyCode)&&this.selected)return e.preventDefault(),e.stopPropagation(),this.select(),!0;if(e.keyCode===Jl.keycodes.ESCAPE)return this.close({reason:"esc"}),!0;if([Jl.keycodes.UP_ARROW,Jl.keycodes.DOWN_ARROW].includes(e.keyCode))return e.preventDefault(),e.stopPropagation(),this[e.keyCode===Jl.keycodes.UP_ARROW?"previous":"next"](),!0}if(![Jl.keycodes.SHIFT,Jl.keycodes.META,Jl.keycodes.META_RIGHT,Jl.keycodes.ESCAPE,Jl.keycodes.ALT].includes(e.keyCode))if(this.ac_triggers.includes(e.key))"Tab"===e.key&&e.preventDefault(),this.auto_completing=!0;else if("Backspace"===e.key){const t=Bb.getCurrentWord(e.target,e.target.selectionEnd-1);Db.isMention(t,this.ac_triggers)&&(this.auto_completing=!0)}}async evaluate(e){const t=this.selected&&e&&(e.keyCode===Jl.keycodes.UP_ARROW||e.keyCode===Jl.keycodes.DOWN_ARROW);if(!this.auto_evaluate&&!this.auto_completing||t)return;const n="function"==typeof this._list?await this._list():this._list;if(0===n.length)return;let i=this.match_current_word?Bb.getCurrentWord(this.input):this.input.value;const s=Db.isMention(i,this.ac_triggers);s&&(this.auto_completing=!0,this.include_triggers.includes(e.key)||(i=Bb.isMentionBoundary(i[0])?i.slice("2"):i.slice("1"))),(s||i.length)&&i.length>=this.min_chars?(this.index=-1,this.ul.innerHTML="",this.suggestions=n.map((e=>new Ub(this.data(e,i),i))).filter((e=>this.filter(e,i))),!1!==this.sort&&(this.suggestions=this.suggestions.sort(this.sort)),this.suggestions=this.suggestions.slice(0,this.max_items),this.suggestions.forEach((e=>this.ul.appendChild(this.item(e,i)))),0===this.ul.children.length?this.close({reason:"nomatches"}):this.open()):(this.close({reason:"nomatches"}),s||(this.auto_completing=!1))}}Object.assign(qb.prototype,$i);const Hb=qb;Wl.elements.define("converse-autocomplete",class extends zg{static get properties(){return{getAutoCompleteList:{type:Function},auto_evaluate:{type:Boolean},auto_first:{type:Boolean},filter:{type:String},include_triggers:{type:String},min_chars:{type:Number},name:{type:String},placeholder:{type:String},triggers:{type:String}}}constructor(){super(),this.auto_evaluate=!0,this.auto_first=!1,this.filter="contains",this.include_triggers="",this.match_current_word=!1,this.max_items=10,this.min_chars=1,this.triggers=""}render(){return xl`
<div class="suggestion-box suggestion-box__name">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<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>
</div>
`}firstUpdated(){this.auto_complete=new Hb(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?Lb:zb,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 Gb=n(4921),Wb={};Wb.styleTagTransform=Yg(),Wb.setAttributes=Vg(),Wb.insert=Gg().bind(null,"head"),Wb.domAPI=qg(),Wb.insertStyleElement=Qg(),Ug()(Gb.Z,Wb),Gb.Z&&Gb.Z.locals&&Gb.Z.locals,Ya.FILTER_CONTAINS=Lb,Ya.FILTER_STARTSWITH=zb,Ya.AutoComplete=Hb;function Vb(e){return"moderator"===e?Dg("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations."):"participant"===e?Dg("The default role, implies that you can read and write messages."):"visitor"==e?Dg("Visitors aren't allowed to write messages in a moderated multi-user chat."):void 0}function Jb(e){return"owner"===e?Dg("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users."):"admin"===e?Dg("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners."):"outcast"===e?Dg('To ban a user, you give them the affiliation of "outcast".'):void 0}const Qb=e=>{const t=Dg("Affiliation"),n=Dg("No users with that affiliation found."),i=Dg("No users with that role found."),s=Dg("Type here to filter the search results"),r=Dg("Role"),o=Dg("Show users"),a=Dg("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=Dg("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 xl`
${e.alert_message?xl`<div class="alert alert-${e.alert_type}" role="alert">${e.alert_message}</div>`:""}
${l?xl`
<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>
</li>
<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?xl`
<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=>xl`
<option value="${e.item||""}"
?selected=${e.item===e.affiliation}
title="${Jb(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_affiliation" value="${o}"/>
</div>
</div>
<div class="row">
<div class="col mt-3">
${Array.isArray(e.users_with_affiliation)&&e.users_with_affiliation.length>5?xl`<input class="form-control" .value="${e.affiliations_filter}" @keyup=${e.filterAffiliationResults} type="text" name="filter" placeholder="${s}"/>`:""}
</div>
</div>
${Jb(e.affiliation)?xl`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${Jb(e.affiliation)}</p></div></div>`:""}
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
${e.loading_users_with_affiliation?xl`<li class="list-group-item"> ${Vy()} </li>`:""}
${Array.isArray(e.users_with_affiliation)&&0===e.users_with_affiliation.length?xl`<li class="list-group-item">${n}</li>`:""}
${e.users_with_affiliation instanceof Error?xl`<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=>xl`
<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">
<div><strong>Affiliation:</strong> ${e.item.affiliation} ${e.assignable_affiliations.length?(e=>xl`
<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=Dg("Change affiliation"),n=Dg("New affiliation"),i=Dg("Reason");return xl`
<form class="affiliation-form hidden" @submit=${e.assignAffiliation}>
<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>
<select class="custom-select select-affiliation" name="affiliation">
${e.assignable_affiliations.map((t=>xl`<option value="${t}" ?selected=${t===e.item.affiliation}>${t}</option>`))}
</select>
</div>
<div class="col">
<label><strong>${i}:</strong></label>
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" name="change" value="${t}"/>
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
`)(Object.assign({item:t},e)):""))}
</ul>
</div>
</div>`:""}
${e.queryable_roles.length?xl`
<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=>xl`
<option value="${e.item||""}"
?selected=${e.item===e.role}
title="${Vb(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?xl`<input class="form-control" .value="${e.roles_filter}" @keyup=${e.filterRoleResults} type="text" name="filter" placeholder="${s}"/>`:""}
</div>
</div>
${Vb(e.role)?xl`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${Vb(e.role)}</p></div></div>`:""}
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
${e.loading_users_with_role?xl`<li class="list-group-item"> ${Vy()} </li>`:""}
${e.users_with_role&&0===e.users_with_role.length?xl`<li class="list-group-item">${i}</li>`:""}
${(e.users_with_role||[]).map((t=>t.nick.match(e.roles_filter)?(e=>xl`
<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">
<div><strong>Role:</strong> ${e.item.role} ${e.assignable_roles.length?(e=>xl`
<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=Dg("Change role"),n=Dg("New Role"),i=Dg("Reason");return xl`
<form class="role-form hidden" @submit=${e.assignRole}>
<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>
<select class="custom-select select-role" name="role">
${e.assignable_roles.map((t=>xl`<option value="${t}" ?selected=${t===e.item.role}>${t}</option>`))}
</select>
</div>
<div class="col">
<label><strong>${i}:</strong></label>
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="${t}"/>
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
`)(Object.assign({item:t},e)):""))}
</ul>
</div>
</div>`:""}
</div>`},{Strophe:Zb,sizzle:Yb,u:Xb}=Jl.env;Wl.elements.define("converse-modtools",class extends zg{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=""}updated(e){e.has("role")&&this.onSearchRoleChange(),e.has("affiliation")&&this.onSearchAffiliationChange(),e.has("jid")&&e.get("jid")&&this.initialize()}async initialize(){this.initialized=fo();const e=await Wl.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:Ya.bare_jid});return Qb({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:ih(e),assignable_roles:Ch(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:Fh.filter((e=>!Wl.settings.get("modtools_disable_query").includes(e))),queryable_roles:Ph.filter((e=>!Wl.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 nh(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=Xb.ancestor(e.target,".toggle-form"),n=t.getAttribute("data-form"),i=Xb.ancestor(t,".list-group-item").querySelector(`.${n}`);Xb.hasClass("hidden",i)?Xb.removeClass("hidden",i):Xb.addClass("hidden",i)}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"),i={jid:t.get("jid"),reason:t.get("reason")},s=this.affiliation,r=this.muc.get("jid");try{await rh(n,r,[i])}catch(e){return null===e?this.alert(Dg("Timeout error while trying to set the affiliation"),"danger"):Yb(`not-allowed[xmlns="${Zb.NS.STANZAS}"]`,e).length?this.alert(Dg("Sorry, you're not allowed to make that change"),"danger"):this.alert(Dg("Sorry, something went wrong while trying to set the affiliation"),"danger"),void R.error(e)}await this.muc.occupants.fetchMembers(),this.affiliation=null,this.affiliation=s,this.alert(Dg("Affiliation changed"),"primary")}assignRole(e){e.stopPropagation(),e.preventDefault(),this.clearAlert();const t=new FormData(e.target),n=this.muc.getOccupant(t.get("jid")||t.get("nick")),i=t.get("role"),s=t.get("reason"),r=this.role;this.muc.setRole(n,i,s,(()=>{this.alert(Dg("Role changed"),"primary"),this.role=null,this.role=r}),(e=>{Yb(`not-allowed[xmlns="${Zb.NS.STANZAS}"]`,e).length?this.alert(Dg("You're not allowed to make that change"),"danger"):(this.alert(Dg("Sorry, something went wrong while trying to set the role"),"danger"),Xb.isErrorObject(e)&&R.error(e))}))}});const Kb=mp.extend({id:"converse-modtools-modal",persistent:!0,initialize(e){this.jid=e.jid,this.affiliation=e.affiliation,mp.prototype.initialize.apply(this,arguments)},toHTML(){return(e=>{const t=Dg("Moderator Tools");return xl`
<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>
${gp}
</div>
<div class="modal-body d-flex flex-column">
<converse-modtools jid=${e.jid} affiliation=${e.affiliation}></converse-modtools>
</div>
</div>
</div>`})(this)}}),ew=Kb,{Strophe:tw,$iq:nw,sizzle:iw,u:sw}=Jl.env,rw={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"},ow={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"};async function aw(e){const t=[Dg("Are you sure you want to destroy this groupchat?")];let n=[{name:"challenge",label:Dg("Please enter the XMPP address of this groupchat to confirm"),challenge:e.get("jid"),placeholder:Dg("name@example.org"),required:!0},{name:"reason",label:Dg("Optional reason for destroying this groupchat"),placeholder:Dg("Reason")},{name:"newjid",label:Dg("Optional XMPP address for a new groupchat that replaces this one"),placeholder:Dg("replacement@example.org")}];try{var i,s;n=await Wl.confirm(Dg("Confirm"),t,n);const r=null===(i=n.filter((e=>"reason"===e.name)).pop())||void 0===i?void 0:i.value,o=null===(s=n.filter((e=>"newjid"===e.name)).pop())||void 0===s?void 0:s.value;return e.sendDestroyIQ(r,o).then((()=>e.close()))}catch(e){R.error(e)}}function cw(e,t){t.querySelector("converse-rooms-list").model.save("muc_domain",tw.getDomainFromJid(e))}function lw(e){e.model.get("connected")&&(e.querySelector("converse-rooms-list").model.get("muc_domain")||(void 0===Wl.settings.get("muc_domain")?function(e){function t(t){t&&t.get("var")===tw.NS.MUC&&t.entity.getIdentity("conference","text").then((n=>{n&&cw(t.get("from"),e)}))}Wl.waitUntil("discoInitialized").then((()=>{Wl.listen.on("serviceDiscovered",t),Ya.disco_entities.each((e=>t(e.features.findWhere({var:tw.NS.MUC}))))})).catch((e=>R.error(e)))}(e):cw(Wl.settings.get("muc_domain"),e)))}function dw(e,t){t=t.trim();const n=document.createElement("li");if(n.setAttribute("aria-selected","false"),Wl.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let i="data:"+Ya.DEFAULT_IMAGE_TYPE+";base64,"+Ya.DEFAULT_IMAGE;if(Ya.vcards){const t=Ya.vcards.findWhere({nickname:e});t&&(i="data:"+t.get("image_type")+";base64,"+t.get("image"))}t.setAttribute("src",i),t.setAttribute("width","22"),t.setAttribute("class","avatar avatar-autocomplete"),n.appendChild(t)}const i=new RegExp("("+t+")","ig");return(t?e.split(i):[e]).forEach((e=>{if(t&&e.match(i)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))})),n}async function uw(){const e=[...await Wl.rooms.get(),...await Wl.contacts.get()],t=[...new Set(e.map((e=>tw.getDomainFromJid(e.get("jid")))))];return t}function hw(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const r=ow[t];if(!r)throw Error(`ChatRoomView#setRole called with invalid command: ${t}`);if(!e.verifyAffiliations(i)||!e.verifyRoles(s))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 mw(e,t,n,i){const s=rw[t];if(!s)throw Error(`verifyAffiliations called with invalid command: ${t}`);if(!e.verifyAffiliations(i))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(!sw.isValidJID(r)){const t=Dg("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&&Wl.settings.get("auto_register_muc_nickname")&&(l.nick=c.get("nick")),rh(s,e.get("jid"),[l]).then((()=>e.occupants.fetchMembers())).catch((t=>e.onCommandError(t)))}function fw(e,t){if(!e.verifyRoles(["moderator"]))return;let n=Wl.modal.get(ew.id);n?(n.affiliation=t,n.render()):n=Wl.modal.create(ew,{affiliation:t,jid:e.get("jid")}),n.show()}function gw(e,t){const n=e.model;if(t||n.get("type")!==Ya.CHATROOMS_TYPE||Wl.settings.get("muc_disable_slash_commands")&&!Array.isArray(Wl.settings.get("muc_disable_slash_commands")))return t;let i=e.text;i=i.replace(/^\s*/,"");const s=(i.match(/^\/([a-zA-Z]*) ?/)||[""]).pop().toLowerCase();if(!s)return!1;const r=i.slice(("/"+s).length+1).trim(),o=n.getAllowedCommands()??[];if("admin"===s&&o.includes(s))return mw(n,s,r,["owner"]),!0;if("ban"===s&&o.includes(s))return mw(n,s,r,["admin","owner"]),!0;if("modtools"===s&&o.includes(s))return fw(n,r),!0;if("deop"===s&&o.includes(s))return hw(n,s,r,["admin","owner"]),!0;if("destroy"===s&&o.includes(s))return!n.verifyAffiliations(["owner"])||(aw(n).catch((e=>n.onCommandError(e))),!0);if("help"===s&&o.includes(s))return n.set({show_help_messages:!1},{silent:!0}),n.set({show_help_messages:!0}),!0;if("kick"===s&&o.includes(s))return hw(n,s,r,[],["moderator"]),!0;if("mute"===s&&o.includes(s))return hw(n,s,r,[],["moderator"]),!0;if("member"===s&&o.includes(s))return mw(n,s,r,["admin","owner"]),!0;if("nick"===s&&o.includes(s)){if(!n.verifyRoles(["visitor","participant","moderator"]))return!0;if(0===r.length){const e=Dg('Your nickname is "%1$s"',n.get("nick"));n.createMessage({message:e,type:"error"})}else n.setNickname(r);return!0}return"owner"===s&&o.includes(s)?(mw(n,s,r,["owner"]),!0):"op"===s&&o.includes(s)?(hw(n,s,r,["admin","owner"]),!0):"register"===s&&o.includes(s)?(r.length>1?n.createMessage({message:Dg("Error: invalid number of arguments"),type:"error"}):n.registerNickname().then((e=>{e&&n.createMessage({message:e,type:"error"})})),!0):"revoke"===s&&o.includes(s)?(mw(n,s,r,["admin","owner"]),!0):"topic"===s&&o.includes(s)||"subject"===s&&o.includes(s)?(n.setSubject(r),!0):!("voice"!==s||!o.includes(s)||(hw(n,s,r,[],["moderator"]),0))}const pw=e=>{const t=Dg("On which entity do you want to run commands?"),n=Dg("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."),i=Dg("Commands found"),s=Dg("List available commands"),r=Dg("XMPP Address"),o=Dg("No commands found");return xl`
${e.alert?xl`<div class="alert alert-${e.alert_type}" role="alert">${e.alert}</div>`:""}
<form class="converse-form" @submit=${e.fetchCommands}>
<fieldset class="form-group">
<label>
${t}
<p class="form-help">${n}</p>
<converse-autocomplete
.getAutoCompleteList="${uw}"
placeholder="${r}"
name="jid"/>
</label>
</fieldset>
<fieldset class="form-group">
<input type="submit" class="btn btn-primary" value="${s}">
</fieldset>
${"list-commands"===e.view?xl`
<fieldset class="form-group">
<ul class="list-group">
<li class="list-group-item active">${e.commands.length?i:o}:</li>
${e.commands.map((t=>((e,t)=>xl`
<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>
${t.node===e.showform?((e,t)=>{const n=Dg("Hide"),i=Dg("Execute");return xl`
<form @submit=${e.runCommand}>
${t.alert?xl`<div class="alert alert-${t.alert_type}" role="alert">${t.alert}</div>`:""}
<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>
${t.fields}
</fieldset>
<fieldset>
<input type="submit" class="btn btn-primary" value="${i}">
<input type="button" class="btn btn-secondary button-cancel" value="${n}" @click=${e.hideCommandForm}>
</fieldset>
</form>
`})(e,t):""}
</li>
`)(e,t)))}
</ul>
</fieldset>`:""}
</form>
`},{Strophe:vw,$iq:yw,sizzle:_w,u:bw}=Jl.env;Wl.elements.define("converse-adhoc-commands",class extends zg{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 pw({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 Wl.disco.supports(vw.NS.ADHOC,t)}catch(e){R.error(e)}if(n)try{this.commands=await Wl.adhoc.getCommands(t),this.view="list-commands"}catch(e){return R.error(e),this.alert_type="danger",this.alert=Dg("Sorry, an error occurred while looking for commands on that entity."),this.commands=[],void R.error(e)}else this.alert_type="danger",this.alert=Dg("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,i=nw({type:"set",to:n}).c("command",{xmlns:tw.NS.ADHOC,node:t,action:"execute"});try{var s;const t=await Wl.sendIQ(i),n=iw(`command[xmlns="${tw.NS.ADHOC}"]`,t).pop();e.sessionid=n.getAttribute("sessionid"),e.instructions=null===(s=iw('x[type="form"][xmlns="jabber:x:data"] instructions',n).pop())||void 0===s?void 0:s.textContent,e.fields=iw('x[type="form"][xmlns="jabber:x:data"] field',n).map((e=>sw.xForm2TemplateResult(e,n)))}catch(t){null===t?R.error(`Error: timeout while trying to execute command for ${n}`):(R.error(`Error while trying to execute command for ${n}`),R.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(),i=t.get("command_node").trim(),s=this.commands.filter((e=>e.node===i))[0];s.alert=null,this.nonce=bw.getUniqueId();const r=_w(":input:not([type=button]):not([type=submit])",e.target).filter((e=>!["command_jid","command_node"].includes(e.getAttribute("name")))).map(bw.webForm2xForm).filter((e=>e)),o=yw({to:n,type:"set"}).c("command",{sessionid:s.sessionid,node:s.node,xmlns:vw.NS.ADHOC}).c("x",{xmlns:vw.NS.XFORM,type:"submit"});let a;r.forEach((e=>o.cnode(e).up()));try{a=await Wl.sendIQ(o)}catch(e){s.alert_type="danger",s.alert=Dg("Sorry, an error occurred while trying to execute the command. See the developer console for details"),R.error("Error while trying to execute an ad-hoc command"),R.error(e)}var c;s.alert=a?null===(c=a.querySelector("note"))||void 0===c?void 0:c.textContent:"Done",s.alert_type="primary",this.nonce=bw.getUniqueId()}}),Wl.elements.define("converse-muc-message-form",class extends E_{async connectedCallback(){super.connectedCallback(),await this.model.initialized}toHTML(){var e,t;return(e=>{const t=e.composing_spoiler?Dg("Hidden message"):Dg("Message"),n=Dg("Optional hint"),i=Wl.settings.get("show_send_button");return xl`
<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=${b_}
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea suggestion-box__input
${i?"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 Ya.AutoComplete(this,{auto_first:!0,auto_evaluate:!1,min_chars:Wl.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==Wl.settings.get("muc_mention_autocomplete_filter")?Ya.FILTER_CONTAINS:Ya.FILTER_STARTSWITH,ac_triggers:["Tab","@"],include_triggers:[],item:dw}),this.mention_auto_complete.on("suggestion-box-selectcomplete",(()=>this.auto_completing=!1))}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)}});var ww=n(6233),Sw={};Sw.styleTagTransform=Yg(),Sw.setAttributes=Vg(),Sw.insert=Gg().bind(null,"head"),Sw.domAPI=qg(),Sw.insertStyleElement=Qg(),Ug()(ww.Z,Sw),ww.Z&&ww.Z.locals&&ww.Z.locals;Wl.elements.define("converse-muc-nickname-form",class extends zg{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=Ya.chatboxes.get(this.jid)}render(){return(e=>{var t,n,i;const s=Dg("Nickname"),r=null!==(t=e.model)&&void 0!==t&&t.isEntered()?Dg("Change nickname"):Dg("Enter groupchat"),o=Wl.settings.get("muc_show_logs_before_join")?Dg("Choose a nickname to enter"):Dg("Please choose your nickname"),a=null===(n=e.model)||void 0===n?void 0:n.get("nickname_validation_message");return xl`
<div class="chatroom-form-container muc-nickname-form"
@submit=${t=>e.submitNickname(t)}>
<form class="converse-form chatroom-form converse-centered-form">
<fieldset class="form-group">
<label>${o}</label>
<p class="validation-message">${a}</p>
<input type="text"
required="required"
name="nick"
value="${(null===(i=e.model)||void 0===i?void 0:i.get("nick"))||""}"
class="form-control ${a?"error":""}"
placeholder="${s}"/>
</fieldset>
<fieldset class="form-group">
<input type="submit" class="btn btn-primary" name="join" value="${r}"/>
</fieldset>
</form>
</div>`})(this)}submitNickname(e){e.preventDefault();const t=e.target.nick.value.trim();t&&(this.model.isEntered()?(this.model.setNickname(t),this.closeModal()):this.model.join(t))}closeModal(){const e=document.createEvent("Event");e.initEvent("hide.bs.modal",!0,!0),this.dispatchEvent(e)}});var xw=n(5655),Ew={};Ew.styleTagTransform=Yg(),Ew.setAttributes=Vg(),Ew.insert=Gg().bind(null,"head"),Ew.domAPI=qg(),Ew.insertStyleElement=Qg(),Ug()(xw.Z,Ew),xw.Z&&xw.Z.locals&&xw.Z.locals,Wl.elements.define("converse-muc-bottom-panel",class extends T_{constructor(){var e,t,n;super(...arguments),n={"click .hide-occupants":"hideOccupants","click .send-button":"sendButtonClicked"},(t="events")in(e=this)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}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=Dg("You have unread messages"),n=e.model.session.get("connection_status"),i=Dg("You're not allowed to send messages in this room");return n===Jl.ROOMSTATUS.ENTERED?xl`
${e.model.ui.get("scrolled")&&e.model.get("num_unread_general")?xl`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${e.can_edit?(e=>{const t=Dg("You have unread messages"),n=Wl.settings.get("message_limit"),i=Wl.settings.get("visible_toolbar_buttons").call,s=Wl.settings.get("visible_toolbar_buttons").emoji,r=Wl.settings.get("show_send_button"),o=Wl.settings.get("visible_toolbar_buttons").spoiler,a=Wl.settings.get("show_toolbar");return xl`
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?xl`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${a?xl`
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?hidden_occupants="${e.model.get("hidden_occupants")}"
?is_groupchat="${e.is_groupchat}"
?show_call_button="${i}"
?show_emoji_button="${s}"
?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):xl`<span class="muc-bottom-panel muc-bottom-panel--muted">${i}</span>`}`:n!=Jl.ROOMSTATUS.NICKNAME_REQUIRED?"":Wl.settings.get("muc_show_logs_before_join")?xl`<span class="muc-bottom-panel muc-bottom-panel--nickname">
<converse-muc-nickname-form jid="${e.model.get("jid")}"></converse-muc-nickname-form>
</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")===Ya.bare_jid&&this.debouncedRender()}sendButtonClicked(e){var t;null===(t=this.querySelector("converse-muc-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 Aw={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"},Cw=(e,t)=>{var n,i;const s=e.get("affiliation"),r=Aw[e.get("show")],o=Dg("Admin"),a=Dg("Member"),c=Dg("Moderator"),l=Dg("Owner"),d=Dg("Visitor"),u=e.get("role"),h=e.get("show");let m,f;return[m,f]="online"===h?["fa fa-circle","chat-status-online"]:"dnd"===h?["fa fa-minus-circle","chat-status-busy"]:"away"===h?["fa fa-circle","chat-status-away"]:["fa fa-circle","subdued-color"],xl`
<li class="occupant" id="${e.id}" title="${(e=>{const t=e.get("role"),n=(e=>Dg("Click to mention %1$s in your message.",e.get("nick")))(e),i=Dg("This user is a moderator."),s=Dg("This user can send messages in this groupchat."),r=Dg("This user can NOT send messages in this groupchat."),o=e.get("jid")?`${e.get("jid")} `:"";return"moderator"===t?`${o}${i} ${n}`:"participant"===t?`${o}${s} ${n}`:"visitor"===t?`${o}${r} ${n}`:["visitor","participant","moderator"].includes(t)?void 0:`${o}${n}`})(e)}">
<div class="row no-gutters">
<div class="col-auto">
<a class="show-msg-author-modal" @click=${t=>function(e,t){Wl.modal.show(My,{model:t},e)}(t,e)}>
<converse-avatar
class="avatar chat-msg__avatar"
.data=${null===(n=e.vcard)||void 0===n?void 0:n.attributes}
nonce=${null===(i=e.vcard)||void 0===i?void 0:i.get("vcard_updated")}
height="30" width="30"></converse-avatar>
<converse-icon
title="${r}"
color="var(--${f})"
style="margin-top: -0.1em"
size="0.82em"
class="${m} chat-status chat-status--avatar"></converse-icon>
</a>
</div>
<div class="col occupant-nick-badge">
<span class="occupant-nick" @click=${t.onOccupantClicked}>${e.getDisplayName()}</span>
<span class="occupant-badges">
${"owner"===s?xl`<span class="badge badge-groupchat">${l}</span>`:""}
${"admin"===s?xl`<span class="badge badge-info">${o}</span>`:""}
${"member"===s?xl`<span class="badge badge-info">${a}</span>`:""}
${"moderator"===u?xl`<span class="badge badge-info">${c}</span>`:""}
${"visitor"===u?xl`<span class="badge badge-secondary">${d}</span>`:""}
</span>
</div>
</div>
</li>
`};var Tw=n(9959),kw={};kw.styleTagTransform=Yg(),kw.setAttributes=Vg(),kw.insert=Gg().bind(null,"head"),kw.domAPI=qg(),kw.insertStyleElement=Qg(),Ug()(Tw.Z,kw),Tw.Z&&Tw.Z.locals&&Tw.Z.locals;var jw=n(902),$w={};$w.styleTagTransform=Yg(),$w.setAttributes=Vg(),$w.insert=Gg().bind(null,"head"),$w.domAPI=qg(),$w.insertStyleElement=Qg(),Ug()(jw.Z,$w),jw.Z&&jw.Z.locals&&jw.Z.locals;const{u:Nw}=Jl.env;Wl.elements.define("converse-muc-sidebar",class extends zg{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=Ya.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.listenTo(this.model.occupants,"vcard:change",this.requestUpdate),this.listenTo(this.model.occupants,"vcard:add",this.requestUpdate),this.model.initialized.then((()=>this.requestUpdate()))}render(){const e=(e=>{const t=Dg("Participants");return xl`
<div class="occupants-header">
<div class="occupants-header--title">
<span class="occupants-heading">${t}</span>
<i class="hide-occupants" @click=${e.closeSidebar}>
<converse-icon class="fa fa-times" size="1em"></converse-icon>
</i>
</div>
</div>
<div class="dragresize dragresize-occupants-left"></div>
<ul class="occupant-list">${e.occupants.map((t=>Cw(t,e)))}</ul>
`})(Object.assign(this.model.toJSON(),{occupants:[...this.model.occupants.models],closeSidebar:e=>this.closeSidebar(e),onOccupantClicked:e=>this.onOccupantClicked(e)}));return 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),Nw.safeSave(this.model,{hidden_occupants:!0})}onOccupantClicked(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=Ya.chatboxviews.get(this.getAttribute("jid"));null==n||n.getMessageForm().insertIntoTextArea(`@${e.target.textContent}`)}});const{u:Ow}=Jl.env;Wl.elements.define("converse-muc-chatarea",class extends zg{static get properties(){return{jid:{type:String},show_help_messages:{type:Boolean},type:{type:String}}}async initialize(){this.model=await Wl.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 xl`
<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")?xl`<div class="chat-content__help">
<converse-chat-help
.model=${e.model}
.messages=${e.getHelpMessages()}
type="info"
chat_type="${Ya.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?xl`
<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:Wl.settings.get("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=Wl.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return[`<strong>/admin</strong>: ${Dg("Change user's affiliation to admin")}`,`<strong>/ban</strong>: ${Dg("Ban user by changing their affiliation to outcast")}`,`<strong>/clear</strong>: ${Dg("Clear the chat area")}`,`<strong>/close</strong>: ${Dg("Close this groupchat")}`,`<strong>/deop</strong>: ${Dg("Change user role to participant")}`,`<strong>/destroy</strong>: ${Dg("Remove this groupchat")}`,`<strong>/help</strong>: ${Dg("Show this menu")}`,`<strong>/kick</strong>: ${Dg("Kick user from groupchat")}`,`<strong>/me</strong>: ${Dg("Write in 3rd person")}`,`<strong>/member</strong>: ${Dg("Grant membership to a user")}`,`<strong>/modtools</strong>: ${Dg("Opens up the moderator tools GUI")}`,`<strong>/mute</strong>: ${Dg("Remove user's ability to post messages")}`,`<strong>/nick</strong>: ${Dg("Change your nickname")}`,`<strong>/op</strong>: ${Dg("Grant moderator role to user")}`,`<strong>/owner</strong>: ${Dg("Grant ownership of this groupchat")}`,`<strong>/register</strong>: ${Dg("Register your nickname")}`,`<strong>/revoke</strong>: ${Dg("Revoke the user's current affiliation")}`,`<strong>/subject</strong>: ${Dg("Set groupchat subject")}`,`<strong>/topic</strong>: ${Dg("Set groupchat subject (alias for /subject)")}`,`<strong>/voice</strong>: ${Dg("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){Ow.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);Ow.safeSave(this.model,{occupants_width:n})}}calculateSidebarWidth(e,t){let n=e.width+t;const i=this.clientWidth;return n<.2*i?(n=.2*i,this.is_minimum=!0):n>.75*i?(n=.75*i,this.is_maximum=!0):i-n<250?(n=i-250,this.is_maximum=!0):(this.is_maximum=!1,this.is_minimum=!1),n}resizeSidebarView(e,t){const n=this.querySelector("converse-muc-sidebar"),i=n.getBoundingClientRect();if(this.is_minimum)this.is_minimum=i.left<t;else if(this.is_maximum)this.is_maximum=i.left>t;else{const t=this.calculateSidebarWidth(i,e);n.style.flex="0 0 "+t+"px"}}});const{sizzle:Iw}=Jl.env,Mw=Jl.env.utils,{sizzle:Rw}=Jl.env,Dw=Jl.env.utils;Wl.elements.define("converse-muc-config-form",class extends zg{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=Ya.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=Wl.settings.get("roomconfig_whitelist"),n=e.model.session.get("config_stanza");let i,s=[],r="";if(n){var o,a;const c=Mw.toStanza(n);s=Iw("field",c),t.length&&(s=s.filter((e=>t.includes(e.getAttribute("var")))));const l={new_password:!e.model.features.get("passwordprotected"),fixed_username:e.model.get("jid")};s=s.map((e=>Mw.xForm2TemplateResult(e,c,l))),r=null===(o=c.querySelector("instructions"))||void 0===o?void 0:o.textContent,i=null===(a=c.querySelector("title"))||void 0===a?void 0:a.textContent}else i=Dg("Loading configuration form");const c=Dg("Save"),l=Dg("Cancel");return xl`
<form class="converse-form chatroom-form ${s.length?"":"converse-form--spinner"}"
autocomplete="off"
@submit=${e.submitConfigForm}>
<fieldset class="form-group">
<legend class="centered">${i}</legend>
${i!==r?xl`<p class="form-help">${r}</p>`:""}
${s.length?s:Vy({classes:"hor_centered"})}
</fieldset>
${s.length?xl`
<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=Rw(":input:not([type=button]):not([type=submit])",e.target).map(Dw.webForm2xForm).filter((e=>e));try{await this.model.sendConfiguration(t)}catch(e){R.error(e);const t=Dg("Sorry, an error occurred while trying to submit the config form.")+" "+Dg("Check your browser's developer console for details.");Wl.alert("error",Dg("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)}});Wl.elements.define("converse-muc-destroyed",class extends zg{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=Ya.chatboxes.get(this.jid)}render(){const e=this.model.get("destroyed_reason");return(e=>{const t=Dg("This groupchat no longer exists"),n=Dg('The following reason was given: "%1$s"',e.reason||"");return xl`
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${t}</h3>
</div>
${e.reason?xl`<p class="destroyed-reason">${n}</p>`:""}
${e.moved_jid?(e=>{const t=Dg("The conversation has moved to a new address. Click the link below to enter.");return xl`
<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 Wl.rooms.get(t,{},!0)).maybeShow(!0),this.model.destroy()}}),Wl.elements.define("converse-muc-disconnected",class extends zg{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=Ya.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(Dg("This action was done by %1$s.",n));const i=this.model.session.get("disconnection_reason");return i&&t.push(Dg('The reason given is: "%1$s".',i)),(e=>xl`
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${e[0]}</h3>
${e.slice(1).map((e=>xl`<p class="disconnect-msg">${e}</p>`))}
</div>`)(t)}});const Lw=Jl.env.utils,zw=mp.extend({id:"muc-invite-modal",initialize(){mp.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.initInviteWidget()},toHTML(){return(e=>{const t=Dg("Invite"),n=Dg("Invite someone to this groupchat"),i=Dg("user@example.org"),s=Dg("Please enter a valid XMPP address"),r=Dg("XMPP Address"),o=Dg("Optional reason for the invitation");return xl`
<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>
${gp}
</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?xl`<div class="error error-feedback">${s}</div>`:""}
<input class="form-control suggestion-box__input"
required="required"
name="invitee_jids"
id="invitee_jids"
placeholder="${i}"
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=Ya.roster.map((e=>({label:e.getDisplayName(),value:e.get("jid")}))),t=this.el.querySelector(".suggestion-box").parentElement;this.invite_auto_complete=new Ya.AutoComplete(t,{min_chars:1,list:e})},submitInviteForm(e){e.preventDefault();const t=new FormData(e.target),n=t.get("invitee_jids"),i=t.get("reason");Lw.isValidJID(n)?(this.chatroomview.model.directInvite(n,i),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}}),Pw=mp.extend({id:"change-nickname-modal",initialize(e){this.model=e.model,mp.prototype.initialize.apply(this,arguments)},toHTML(){return(e=>{const t=this.model.get("jid"),n=Dg("Change your nickname");return xl`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="converse-modtools-modal-label">
${n}</h5>
${gp}
</div>
<div class="modal-body d-flex flex-column">
<converse-muc-nickname-form jid="${t}"></converse-muc-nickname-form>
</div>
</div>
</div>`})()}});var Fw=n(7140),Uw={};Uw.styleTagTransform=Yg(),Uw.setAttributes=Vg(),Uw.insert=Gg().bind(null,"head"),Uw.domAPI=qg(),Uw.insertStyleElement=Qg(),Ug()(Fw.Z,Uw),Fw.Z&&Fw.Z.locals&&Fw.Z.locals;const Bw=mp.extend({id:"muc-details-modal",initialize(){mp.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=e.toJSON(),n=e.config.toJSON(),i=Dg("Groupchat info for %1$s",e.getDisplayName()),s=e.features.toJSON(),r=e.occupants.filter((e=>"offline"!==e.get("show"))).length,o=Dg("XMPP address"),a=Dg("Message archiving"),c=Dg("Messages are archived on the server"),l=Dg("Description"),d=Dg("Features"),u=Dg("Hidden"),h=Dg("This groupchat is not publicly searchable"),m=Dg("This groupchat is restricted to members only"),f=Dg("Members only"),g=Dg("Moderated"),p=Dg("Participants entering this groupchat need to request permission to write"),v=Dg("Name"),y=Dg("This groupchat does not require a password upon entry"),_=Dg("No password required"),b=Dg("Not anonymous"),w=Dg("All other groupchat participants can see your XMPP address"),S=Dg("Not moderated"),x=Dg("Participants entering this groupchat can write right away"),E=Dg("Online users"),A=Dg("Open"),C=Dg("Anyone can join this groupchat"),T=Dg("This groupchat requires a password before entry"),k=Dg("Password protected"),j=Dg("Persistent"),$=Dg("This groupchat persists even if it's unoccupied"),N=Dg("Public"),O=Dg("Semi-anonymous"),I=Dg("Only moderators can see your XMPP address"),M=Dg("Temporary"),R=Dg("This groupchat will disappear once the last person leaves");return xl`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="muc-details-modal-label">${i}</h5>
${gp}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<div class="room-info">
<p class="room-info"><strong>${v}</strong>: ${t.name}</p>
<p class="room-info"><strong>${o}</strong>: <converse-rich-text text="xmpp:${t.jid}?join"></converse-rich-text></p>
<p class="room-info"><strong>${l}</strong>: <converse-rich-text text="${n.description}" render_styling></converse-rich-text></p>
${t.subject?(e=>{const t=Dg("Topic"),n=Dg("Topic author");return xl`
<p class="room-info"><strong>${t}</strong>: <converse-rich-text text=${e.subject.text} render_styling></converse-rich-text></p>
<p class="room-info"><strong>${n}</strong>: ${e.subject&&e.subject.author}</p>
`})(t):""}
<p class="room-info"><strong>${E}</strong>: ${r}</p>
<p class="room-info"><strong>${d}</strong>:
<div class="chatroom-features">
<ul class="features-list">
${s.passwordprotected?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-lock"></converse-icon>${k} - <em>${T}</em></li>`:""}
${s.unsecured?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-unlock"></converse-icon>${_} - <em>${y}</em></li>`:""}
${s.hidden?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-eye-slash"></converse-icon>${u} - <em>${h}</em></li>`:""}
${s.public_room?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-eye"></converse-icon>${N} - <em>${t.__("This groupchat is publicly searchable")}</em></li>`:""}
${s.membersonly?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-address-book"></converse-icon>${f} - <em>${m}</em></li>`:""}
${s.open?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-globe"></converse-icon>${A} - <em>${C}</em></li>`:""}
${s.persistent?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-save"></converse-icon>${j} - <em>${$}</em></li>`:""}
${s.temporary?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-snowflake-o"></converse-icon>${M} - <em>${R}</em></li>`:""}
${s.nonanonymous?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-id-card"></converse-icon>${b} - <em>${w}</em></li>`:""}
${s.semianonymous?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-user-secret"></converse-icon>${O} - <em>${I}</em></li>`:""}
${s.moderated?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-gavel"></converse-icon>${g} - <em>${p}</em></li>`:""}
${s.unmoderated?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-info-circle"></converse-icon>${S} - <em>${x}</em></li>`:""}
${s.mam_enabled?xl`<li class="feature" ><converse-icon size="1em" class="fa fa-database"></converse-icon>${a} - <em>${c}</em></li>`:""}
</ul>
</div>
</p>
</div>
</div>
<div class="modal-footer">${fp}</div>
</div>
</div>
`})(this.model)}});var qw=n(307),Hw={};Hw.styleTagTransform=Yg(),Hw.setAttributes=Vg(),Hw.insert=Gg().bind(null,"head"),Hw.domAPI=qg(),Hw.insertStyleElement=Qg(),Ug()(qw.Z,Hw),qw.Z&&qw.Z.locals&&qw.Z.locals,Wl.elements.define("converse-rich-text",class extends zg{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,hide_media_urls:this.hide_media_urls,mentions:this.mentions,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};return my(this.text,this.offset,e)}});var Gw=n(3288),Ww={};Ww.styleTagTransform=Yg(),Ww.setAttributes=Vg(),Ww.insert=Gg().bind(null,"head"),Ww.domAPI=qg(),Ww.insertStyleElement=Qg(),Ug()(Gw.Z,Ww),Gw.Z&&Gw.Z.locals&&Gw.Z.locals,Wl.elements.define("converse-muc-heading",class extends Tp{async connectedCallback(){super.connectedCallback(),this.model=Ya.chatboxes.get(this.getAttribute("jid")),this.debouncedRender=va(this.render,100),this.listenTo(this.model,"change",this.debouncedRender);const e=await Ya.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")===Ya.bare_jid&&this.debouncedRender()}onOccupantAffiliationChanged(e){e.get("jid")===Ya.bare_jid&&this.debouncedRender()}showRoomDetailsModal(e){e.preventDefault(),Wl.modal.show(Bw,{model:this.model},e)}showInviteModal(e){e.preventDefault(),Wl.modal.show(zw,{model:new fa,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(),aw(this.model)}getHeadingButtons(e){const t=[];t.push({i18n_text:Dg("Details"),i18n_title:Dg("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:Dg("Configure"),i18n_title:Dg("Configure this groupchat"),handler:()=>this.getAndRenderConfigurationForm(),a_class:"configure-chatroom-button",icon_class:"fa-wrench",name:"configure"}),t.push({i18n_text:Dg("Nickname"),i18n_title:Dg("Change the nickname you're using in this groupchat"),handler:e=>Wl.modal.show(Pw,{model:this.model},e),a_class:"open-nickname-modal",icon_class:"fa-smile",name:"nickname"}),this.model.invitesAllowed()&&t.push({i18n_text:Dg("Invite"),i18n_title:Dg("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:Dg(e?"Show topic":"Hide topic"),i18n_title:Dg(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:Dg("Moderate"),i18n_title:Dg("Moderate this groupchat"),handler:()=>fw(this.model),a_class:"moderate-chatroom-button",icon_class:"fa-user-cog",name:"moderate"}),e.includes("destroy")&&t.push({i18n_text:Dg("Destroy"),i18n_title:Dg("Remove this groupchat"),handler:e=>this.destroy(e),a_class:"destroy-chatroom-button",icon_class:"fa-trash",name:"destroy"})}Wl.settings.get("singleton")||t.push({i18n_text:Dg("Leave"),i18n_title:Dg("Leave and close this groupchat"),handler:async e=>{e.stopPropagation();const t=[Dg("Are you sure you want to leave this groupchat?")];await Wl.confirm(Dg("Confirm"),t)&&this.close(e)},a_class:"close-chatbox-button",standalone:"overlayed"===Wl.settings.get("view_mode"),icon_class:"fa-sign-out-alt",name:"signout"});const i=Ya.chatboxviews.get(this.getAttribute("jid"));return i?Ya.api.hook("getHeadingButtons",i,t):t}async generateHeadingTemplate(){const e=await this.model.isSubjectHidden(),t=await this.getHeadingButtons(e),n=t.filter((e=>e.standalone)),i=t.filter((e=>!e.standalone));return(e=>{const t=Dg("Hide the groupchat topic"),n=Dg("This groupchat is bookmarked"),i=e.subject?e.subject.text:"",s=i&&!e.subject_hidden;return xl`
<div class="chatbox-title ${s?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
${Ya.api.settings.get("singleton")?"":xl`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
<div class="chatbox-title__text" title="${"hidden"!==Wl.settings.get("locked_muc_domain")?e.jid:""}">${e.title}
${e.bookmarked?xl`<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="${n}"></i>`:""}
</div>
</div>
<div class="chatbox-title__buttons row no-gutters">
${e.standalone_btns.length?(e=>e.standalone_btns.reverse().map((e=>uv(e,""))))(e):""}
${e.dropdown_btns.length?xl`<converse-dropdown class="dropleft" color="var(--chatroom-head-color)" .items=${e.dropdown_btns}></converse-dropdown>`:""}
</div>
</div>
${s?xl`<p class="chat-head__desc" title="${t}">
<converse-rich-text text=${i} render_styling></converse-rich-text>
</p>`:""}
`})(Object.assign(this.model.toJSON(),{_converse:Ya,subject_hidden:e,dropdown_btns:i.map((e=>v_(e))),standalone_btns:n.map((e=>y_(e))),title:this.model.getDisplayName()}))}});function Vw(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Wl.elements.define("converse-muc-password-form",class extends zg{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=Ya.chatboxes.get(this.jid),this.listenTo(this.model,"change:password_validation_message",this.render),this.render()}render(){return(e=>{const t=Dg("This groupchat requires a password"),n=Dg("Password: "),i=Dg("Submit");return xl`
<form class="converse-form chatroom-form converse-centered-form" @submit=${e.submitPassword}>
<fieldset class="form-group">
<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}"/>
</fieldset>
<fieldset class="form-group">
<input class="btn btn-primary" type="submit" value="${i}"/>
</fieldset>
</form>
`})({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 Jw extends k_{constructor(){super(...arguments),Vw(this,"length",300),Vw(this,"is_chatroom",!0)}async initialize(){this.model=await Wl.rooms.get(this.jid),Ya.chatboxviews.add(this.jid,this),this.setAttribute("id",this.model.get("box_id")),this.listenTo(Ya,"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(),Wl.trigger("chatRoomViewInitialized",this)}render(){return(e=>xl`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e.model?xl`
<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"),i=Jl.ROOMSTATUS,s=e.model.session.get("connection_status");return t===Jl.MUC.VIEWS.CONFIG?xl`<converse-muc-config-form class="muc-form-container" jid="${n}"></converse-muc-config-form>`:xl`
${s==i.PASSWORD_REQUIRED?xl`<converse-muc-password-form class="muc-form-container" jid="${n}"></converse-muc-password-form>`:""}
${s==i.ENTERED?xl`<converse-muc-chatarea jid="${n}"></converse-muc-chatarea>`:""}
${s==i.CONNECTING?Vy():""}
${s==i.NICKNAME_REQUIRED?function(e){const t=e.get("jid");return Wl.settings.get("muc_show_logs_before_join")?xl`<converse-muc-chatarea jid="${t}"></converse-muc-chatarea>`:xl`<converse-muc-nickname-form jid="${t}"></converse-muc-nickname-form>`}(e.model):""}
${s==i.DISCONNECTED?xl`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${s==i.BANNED?xl`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${s==i.DESTROYED?xl`<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()}}Wl.elements.define("converse-muc",Jw);var Qw=n(3076),Zw={};Zw.styleTagTransform=Yg(),Zw.setAttributes=Vg(),Zw.insert=Gg().bind(null,"head"),Zw.domAPI=qg(),Zw.insertStyleElement=Qg(),Ug()(Qw.Z,Zw),Qw.Z&&Qw.Z.locals&&Qw.Z.locals,Jl.MUC.VIEWS={CONFIG:"config-form"},Jl.plugins.add("converse-muc-views",{dependencies:["converse-modal","converse-controlbox","converse-chatview"],initialize(){const{_converse:e}=this;Wl.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=Jw,Wl.listen.on("clearsession",(()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)})),Wl.listen.on("controlBoxInitialized",(e=>{Wl.settings.get("allow_muc")&&(lw(e),e.model.on("change:connected",(()=>lw(e))))})),Wl.listen.on("chatBoxClosed",(t=>{var n;t.get("type")===e.CHATROOMS_TYPE&&(n=t.get("jid"),Ya.router.history.getFragment()===`converse/room?jid=${n}`&&Ya.router.navigate(""))})),Wl.listen.on("parseMessageForCommands",gw)}});var Yw=n(5402),Xw=n.n(Yw);const{Strophe:Kw}=Jl.env,eS="Notification"in window;let tS;function nS(e){var t;return Ya.isTestEnv()||((null===(t=Ya.chatboxes.get(e.from))||void 0===t?void 0:t.isHidden())??!1)}function iS(){return Ya.isTestEnv()||eS&&Wl.settings.get("show_desktop_notifications")&&"granted"===Notification.permission}function sS(){var e,t;tS=null,null===(e=(t=navigator).clearAppBadge)||void 0===e||e.call(t).catch((e=>R.error("Could not clear unread count in app badge "+e)))}function rS(){if(Wl.settings.get("show_tab_notifications")){var e,t;tS=tS??new Jl.env.Favico({type:"circle",animation:"pop"});const n=Ya.chatboxes.models.reduce(((e,t)=>e+(t.get("num_unread")||0)),0);tS.badge(n),null===(e=(t=navigator).setAppBadge)||void 0===e||e.call(t,n).catch((e=>R.error("Could set unread count in app badge - "+e)))}}function oS(e,t,n){return e.reduce(((e,i)=>e||(e=>[Ya.bare_jid,`${t}/${n}`].includes(e.uri.replace(/^xmpp:/,"")))(i)),!1)}async function aS(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,i=Wl.settings.get("notify_all_room_messages"),s=Ya.chatboxes.get(n),r=Kw.getResourceFromJid(t),o=r&&Kw.unescapeNode(r)||"";let a=!1;const c=s.get("nick");Wl.settings.get("notify_nicknames_without_references")&&(a=new RegExp(`\\b${c}\\b`).test(e.body));const l=o!==c,d=!0===i||Array.isArray(i)&&i.includes(n)||oS(e.references,n,c)||a;return!(!l||!d)&&await Wl.hook("shouldNotifyOfGroupMessage",e,!0)}(t);if("info"===t.type)return async function(e){if(!e.from_muc)return!1;const t=await Wl.rooms.get(e.from_muc);if(!t)return!1;const n=t.get("nick"),i=e.from_muc,s=Wl.settings.get("notify_all_room_messages");return!0===s||Array.isArray(s)&&s.includes(i)||oS(e.references,i,n)}(t);if(t.is_headline)return nS(t);const n=Kw.getBareJidFromJid(t.from)===Ya.bare_jid;return!ja(t)&&!n&&("all"===Wl.settings.get("show_desktop_notifications")||nS(t))}(e))return!1;Wl.trigger("messageNotification",e),function(){if(Wl.settings.get("play_sounds")&&void 0!==window.Audio){const e=new Audio(Wl.settings.get("sounds_path")+"msg_received.ogg"),t=e.canPlayType("audio/ogg");if("probably"===t)return e.play();const n=new Audio(Wl.settings.get("sounds_path")+"msg_received.mp3"),i=n.canPlayType("audio/mp3");"probably"===i?n.play():"maybe"===t?e.play():"maybe"===i&&n.play()}}(),function(e){const{attrs:t}=e;if(t.is_error)return;if(!iS())return;let n,i;const s=t.from,r=Kw.getBareJidFromJid(s);if("info"==t.type)n=t.message;else if("headline"===t.type){if(r.includes("@")&&!Wl.settings.get("allow_non_roster_messaging"))return;n=Dg("Notification from %1$s",r)}else if(r.includes("@"))if("groupchat"===t.type)n=Dg("%1$s says",Kw.getResourceFromJid(s));else{if(void 0===Ya.roster)return void R.error("Could not send notification, because roster is undefined");if(i=Ya.roster.get(r),void 0!==i)n=Dg("%1$s says",i.getDisplayName());else{if(!Wl.settings.get("allow_non_roster_messaging"))return;n=Dg("%1$s says",r)}}else n=Dg("Notification from %1$s",r);let o;if("info"==t.type)o=t.reason;else if(o=t.is_encrypted?t.plaintext:t.body,!o)return;const a=new Notification(n,{body:o,lang:Ya.locale,icon:Wl.settings.get("notification_icon"),requireInteraction:!Wl.settings.get("notification_delay")});Wl.settings.get("notification_delay")&&setTimeout((()=>a.close()),Wl.settings.get("notification_delay")),a.onclick=function(e){e.preventDefault(),window.focus(),Ya.chatboxes.get(r).maybeShow(!0)}}(e)}function cS(e){iS()&&function(e){if("error"===e.klass||"warn"===e.klass){const t=new Notification(e.subject,{body:e.message,lang:Ya.locale,icon:Wl.settings.get("notification_icon")});setTimeout(t.close.bind(t),5e3)}}(e)}function lS(e){iS()&&Wl.settings.get("show_chat_state_notifications")&&function(e){var t;if(null!==(t=Wl.settings.get("chatstate_notification_blacklist"))&&void 0!==t&&t.includes(e.jid))return;const n=e.presence.get("show");let i=null;if("offline"===n?i=Dg("has gone offline"):"away"===n?i=Dg("has gone away"):"dnd"===n?i=Dg("is busy"):"online"===n&&(i=Dg("has come online")),null===i)return;const s=new Notification(e.getDisplayName(),{body:i,lang:Ya.locale,icon:Wl.settings.get("notification_icon")});setTimeout((()=>s.close()),5e3)}(e)}function dS(e){iS()&&function(e){const t=new Notification(e.getDisplayName(),{body:Dg("wants to be your contact"),lang:Ya.locale,icon:Wl.settings.get("notification_icon")});setTimeout((()=>t.close()),5e3)}(e)}function uS(){eS&&!["denied","granted"].includes(Notification.permission)&&Notification.requestPermission()}Jl.env.Favico=Xw(),Jl.plugins.add("converse-notification",{dependencies:["converse-chatboxes"],initialize(){Wl.settings.extend({chatstate_notification_blacklist:[],notification_delay:5e3,notification_icon:"logo/conversejs-filled.svg",notify_all_room_messages:!1,notify_nicknames_without_references:!1,play_sounds:!0,show_chat_state_notifications:!1,show_desktop_notifications:!0,show_tab_notifications:!0,sounds_path:Wl.settings.get("assets_path")+"/sounds/"}),Wl.listen.on("clearSession",sS),Wl.waitUntil("chatBoxesInitialized").then((()=>Ya.chatboxes.on("change:num_unread",rS))),Wl.listen.on("pluginsInitialized",(function(){Wl.listen.on("contactRequest",dS),Wl.listen.on("contactPresenceChanged",lS),Wl.listen.on("message",aS),Wl.listen.on("feedback",cS),Wl.listen.on("connected",uS)}))}});const hS={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"},mS={name:"AES-GCM",length:128},{u:fS}=Jl.env;function gS(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 pS(e){return Array.prototype.map.call(new Uint8Array(e),(e=>("00"+e.toString(16)).slice(-2))).join("")}function vS(e){return new TextDecoder("utf-8").decode(e)}function yS(e){return new TextEncoder("utf-8").encode(e).buffer}function _S(e){return btoa(new Uint8Array(e).reduce(((e,t)=>e+String.fromCharCode(t)),""))}function bS(e){const t=window.atob(e),n=t.length,i=new Uint8Array(n);for(let e=0;e<n;e++)i[e]=t.charCodeAt(e);return i.buffer}function wS(e){const t=new Uint8Array(e.match(/[\da-f]{2}/gi).map((e=>parseInt(e,16))));return t.buffer}Object.assign(fS,{arrayBufferToHex:pS,arrayBufferToString:vS,stringToArrayBuffer:yS,arrayBufferToBase64:_S,base64ToArrayBuffer:bS});const{Strophe:SS,URI:xS,sizzle:ES,u:AS}=Jl.env;function CS(e){e=e.replace(/^05/,"");for(let t=1;t<8;t++){const n=8*t+t-1;e=e.slice(0,n)+" "+e.slice(n)}return e}function TS(e,t){return e.get("omemo_active")&&t.body&&(t.is_encrypted=!0,t.plaintext=t.body,t.body=Dg("This is an OMEMO encrypted message which your client doesnt seem to support. Find more information on https://conversations.im/omemo")),t}function kS(e,t,n){const i=[];try{const t={start:/\b(aesgcm:\/\/)/gi};xS.withinString(e,((e,t,n)=>(i.push({url:e,start:t,end:n}),e)),t)}catch(e){return void R.debug(e)}i.forEach((i=>{const s=ed(e.slice(i.start,i.end)),r=async function(e){var t;const n=e.hash().slice(1),i="localhost"===window.location.hostname?"http":"https",s=e.toString().replace(/^aesgcm/,i),r=await async function(e){let t;try{t=await fetch(e)}catch(t){return R.error(`${t.name}: Failed to download encrypted media: ${e}`),R.error(t),null}if(t.status>=200&&t.status<400)return t.arrayBuffer()}(s);if(null===r)return R.error(`Could not decrypt file ${e.toString()} since it could not be downloaded`),null;const o=n.slice(0,24),a=n.slice(24);let c;try{c=await async function(e,t,n){const i=await crypto.subtle.importKey("raw",wS(t),"AES-GCM",!1,["decrypt"]),s={name:"AES-GCM",iv:wS(e)};return crypto.subtle.decrypt(s,i,n)}(o,a,r)}catch(t){return R.error(`Could not decrypt file ${e.toString()}`),R.error(t),null}const[l,d]=null===(t=e.filename())||void 0===t?void 0:t.split("."),u=hS[d];try{const e=new File([c],l,{type:u});return URL.createObjectURL(e)}catch(t){return R.error(`Could not decrypt file ${e.toString()}`),R.error(t),null}}(s).then((e=>function(e,t,n){const i=e.toString();return null===t?i:ud(i)?Yv({url:t,onClick:n.onImgClick,onLoad:n.onImgLoad}):ld(i)?yv(t):dd(i)?Iv(t):Tv(t,e.filename())}(s,e,n))),o=xl`${uv(r,"")}`;n.addTemplateResult(i.start+t,i.end+t,o)}))}function jS(e){Ya.config.get("trusted")&&e.addAnnotations(((t,n)=>kS(t,n,e)))}async function $S(e,t){var n;if(Wl.settings.get("clear_cache_on_logout")||!t.is_encrypted||t.encryption_namespace!==SS.NS.OMEMO)return t;const i=ES(`encrypted[xmlns="${SS.NS.OMEMO}"]`,e).pop(),s=i.querySelector("header");t.encrypted={device_id:s.getAttribute("sid")};const r=await(null===(n=Wl.omemo)||void 0===n?void 0:n.getDeviceID()),o=r&&ES(`key[rid="${r}"]`,i).pop();return o?(Object.assign(t.encrypted,{iv:s.querySelector("iv").textContent,key:o.textContent,payload:(null===(a=i.querySelector("payload"))||void 0===a?void 0:a.textContent)||null,prekey:["true","1"].includes(o.getAttribute("prekey"))}),!0===t.encrypted.prekey?async function(e){const t=IS(MS(e),parseInt(e.encrypted.device_id,10)),n=bS(e.encrypted.key);let i;try{i=await t.decryptPreKeyWhisperMessage(n,"binary")}catch(t){return R.error(`${t.name} ${t.message}`),Object.assign(e,DS(t))}try{const t=await RS(e,i);return await Ya.omemo_store.generateMissingPreKeys(),await Ya.omemo_store.publishBundle(),t?Object.assign(e,{plaintext:t}):Object.assign(e,{is_only_key:!0})}catch(t){return R.error(`${t.name} ${t.message}`),Object.assign(e,DS(t))}}(t):async function(e){const t=IS(MS(e),parseInt(e.encrypted.device_id,10)),n=bS(e.encrypted.key);try{const i=await t.decryptWhisperMessage(n,"binary"),s=await RS(e,i);return Object.assign(e,{plaintext:s})}catch(t){return R.error(`${t.name} ${t.message}`),Object.assign(e,DS(t))}}(t)):Object.assign(t,{error_condition:"not-encrypted-for-this-device",error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"});var a}function NS(){Ya.chatboxes.on("add",(e=>{qS(e),e.get("type")===Ya.CHATROOMS_TYPE&&(e.occupants.on("add",(t=>async function(e,t){!t.isSelf()&&e.features.get("nonanonymous")&&e.features.get("membersonly")&&e.get("omemo_active")&&(await Ya.contactHasOMEMOSupport(t.get("jid"))||(e.createMessage({message:Dg("%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",(()=>qS(e))))}))}function OS(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",(()=>{var t;!e.model.get("omemo_supported")&&e.model.get("omemo_active")?e.model.set("omemo_active",!1):null===(t=e.querySelector("converse-chat-toolbar"))||void 0===t||t.requestUpdate()})),e.listenTo(e.model,"change:omemo_active",(()=>{e.querySelector("converse-chat-toolbar").requestUpdate()}))}function IS(e,t){const n=new libsignal.SignalProtocolAddress(e,t);return new window.libsignal.SessionCipher(Ya.omemo_store,n)}function MS(e){const t=e.from_muc?e.from_real_jid:e.from;if(!t)throw Object.assign(e,{error_text:Dg("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 RS(e,t){const n=MS(e),i=await Wl.omemo.devicelists.get(n,!0),s=e.encrypted;let r=i.devices.get(s.device_id);if(r||(r=await i.devices.create({id:s.device_id,jid:n},{promise:!0})),s.payload){const e=t.slice(0,16),n=t.slice(16),i=await VS.decryptMessage(Object.assign(s,{key:e,tag:n}));return r.save("active",!0),i}}function DS(e){return{error_text:Dg("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 LS(e){const t=e.querySelector("signedPreKeyPublic"),n=e.querySelector("signedPreKeySignature"),i=ES("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:n.textContent},prekeys:i}}async function zS(e){var t;if(null!==(t=e.get("bundle"))&&void 0!==t&&t.fingerprint)return;const n=await e.getBundle();n.fingerprint=pS(bS(n.identity_key)),e.save("bundle",n),e.trigger("change:bundle")}async function PS(e){await Wl.waitUntil("OMEMOInitialized");const t=await Wl.omemo.devicelists.get(e,!0);return await t.fetchDevices(),t.devices}function FS(){Ya.connection.addHandler((async e=>{try{ES(`event[xmlns="${SS.NS.PUBSUB}#event"]`,e).length&&(await Wl.waitUntil("OMEMOInitialized"),await async function(e){const t=ES(`items[node="${SS.NS.OMEMO_DEVICELIST}"]`,e).pop();if(!t)return;const n=`item list[xmlns="${SS.NS.OMEMO}"] device`,i=ES(n,t).map((e=>e.getAttribute("id"))),s=e.getAttribute("from"),r=await Wl.omemo.devicelists.get(s,!0),o=r.devices;vc(o.pluck("id"),i).forEach((e=>{s===Ya.bare_jid&&e===Ya.omemo_store.get("device_id")||o.get(e).save("active",!1)})),i.forEach((e=>{const t=o.get(e);t?t.save("active",!0):o.create({id:e,jid:s})})),AS.isSameBareJID(s,Ya.bare_jid)&&r.publishCurrentDevice(i)}(e),await async function(e){const t=ES("items",e).pop();if(!t||!t.getAttribute("node").startsWith(SS.NS.OMEMO_BUNDLES))return;const n=t.getAttribute("node").split(":")[1],i=e.getAttribute("from"),s=ES("item > bundle",t).pop(),r=await Wl.omemo.devicelists.get(i,!0);(r.devices.get(n)||r.devices.create({id:n,jid:i})).save({bundle:LS(s)})}(e))}catch(e){R.error(e.message)}return!0}),null,"message","headline")}async function US(){if(void 0===Ya.omemo_store){const e=`converse.omemosession-${Ya.bare_jid}`;Ya.omemo_store=new Ya.OMEMOStore({id:e}),Oo(Ya.omemo_store,e)}await Ya.omemo_store.fetchSession()}async function BS(e){if(!e)if(Ya.config.get("trusted")&&!Wl.settings.get("clear_cache_on_logout")){try{await async function(){const e=`converse.devicelists-${Ya.bare_jid}`;Ya.devicelists=new Ya.DeviceLists({id:e}),Oo(Ya.devicelists,e),await new Promise((e=>{Ya.devicelists.fetch({success:e,error:(t,n)=>{R.error(n),e()}})})),await Wl.omemo.devicelists.get(Ya.bare_jid,!0)}(),await US(),await Ya.omemo_store.publishBundle()}catch(e){return R.error("Could not initialize OMEMO support"),void R.error(e)}Wl.trigger("OMEMOInitialized")}else R.warn("Not initializing OMEMO, since this browser is not trusted or clear_cache_on_logout is set to true")}async function qS(e){let t;e.get("type")===Ya.CHATROOMS_TYPE?(await Wl.waitUntil("OMEMOInitialized"),t=e.features.get("nonanonymous")&&e.features.get("membersonly")):e.get("type")===Ya.PRIVATE_CHAT_TYPE&&(t=await Ya.contactHasOMEMOSupport(e.get("jid"))),e.set("omemo_supported",t),t&&Wl.settings.get("omemo_default")&&e.set("omemo_active",!0)}function HS(e){e.stopPropagation(),e.preventDefault();const t=AS.ancestor(e.target,"converse-chat-toolbar");if(!t.model.get("omemo_supported")){let e;return e=t.model.get("type")===Ya.CHATROOMS_TYPE?[Dg("Cannot use end-to-end encryption in this groupchat, either the groupchat has some anonymity or not all participants support OMEMO.")]:[Dg("Cannot use end-to-end encryption because %1$s uses a client that doesn't support OMEMO.",t.model.contact.getDisplayName())],Wl.alert("error",Dg("Error"),e)}t.model.save({omemo_active:!t.model.get("omemo_active")})}function GS(e,t){const n=e.model,i=n.get("type")===Ya.CHATROOMS_TYPE;let s,r;if(n.get("omemo_supported")){const e=Dg("Messages are being sent in plaintext"),t=Dg("Messages are sent encrypted");s=n.get("omemo_active")?t:e}else s=Dg(i?"This groupchat needs to be members-only and non-anonymous in order to support OMEMO encrypted messages":"OMEMO encryption is not supported");return r=n.get("omemo_supported")?n.get("omemo_active")?i?"var(--muc-color)":"var(--chat-toolbar-btn-color)":"var(--error-color)":"var(--muc-toolbar-btn-disabled-color)",t.push(xl`
<button class="toggle-omemo" title="${s}" data-disabled=${!n.get("omemo_supported")} @click=${HS}>
<converse-icon
class="fa ${n.get("omemo_active")?"fa-lock":"fa-unlock"}"
path-prefix="${Wl.settings.get("assets_path")}"
size="1em"
color="${r}"
></converse-icon>
</button>
`),t}async function WS(e,t){let{stanza:n}=t;const{message:i}=t;if(!i.get("is_encrypted"))return t;if(!i.get("body"))throw new Error("No message body to encrypt!");const s=await async function(e){const t=Dg("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===Ya.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map((e=>PS(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],i=e;i--;)t[i-1]=arguments[i];return en(ct(n)?Ss(n):[n],zo(t,1))}(e,t.models)),[])}else if(e.get("type")===Ya.PRIVATE_CHAT_TYPE){const i=await PS(e.get("jid"));if(0===i.length){const e=new Error(t);throw e.user_facing=!0,e}const s=(await Wl.omemo.devicelists.get(Ya.bare_jid)).devices;n=[...s.models,...i.models]}const i=Ya.omemo_store.get("device_id");n=n.filter((e=>e.get("id")!==i)),await Promise.all(n.map((e=>e.getBundle())));const s=n.filter((e=>e)).map((e=>async function(e){if(!e.get("bundle"))return R.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 Ya.omemo_store.loadSession(t.toString());if(n)return n;try{const t=await async function(e){const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=new libsignal.SessionBuilder(Ya.omemo_store,t),i=e.getRandomPreKey(),s=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:bS(s.identity_key),signedPreKey:{keyId:s.signed_prekey.id,publicKey:bS(s.signed_prekey.public_key),signature:bS(s.signed_prekey.signature)},preKey:{keyId:i.id,publicKey:bS(i.key)}})}(e);return t}catch(t){return R.error(`Could not build an OMEMO session for device ${e.get("id")}`),R.error(t),null}}(e)));if(await Promise.all(s),s.includes(null)&&(n=n.filter((e=>s[n.indexOf(e)])),0===n.length)){const e=new Error(t);throw e.user_facing=!0,e}return n}(e);n.c("encrypted",{xmlns:SS.NS.OMEMO}).c("header",{sid:Ya.omemo_store.get("device_id")});const{key_and_tag:r,iv:o,payload:a}=await VS.encryptMessage(i.get("plaintext")),c=await Promise.all(s.filter((e=>-1!=e.get("trusted")&&e.get("active"))).map((e=>function(e,t){return IS(t.get("jid"),t.get("id")).encrypt(e).then((e=>({payload:e,device:t})))}(r,e))));return n=await function(e,t,n){for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const s=t[i].payload,r=t[i].device,o=3==parseInt(s.type,10);e.c("key",{rid:r.get("id")}).t(btoa(s.body)),o&&e.attrs({prekey:o}),e.up(),i==t.length-1&&e.c("iv").t(n).up().up()}return Promise.resolve(e)}(n,c,o),n.c("payload").t(a).up().up(),n.c("store",{xmlns:SS.NS.HINTS}).up(),n.c("encryption",{xmlns:SS.NS.EME,namespace:SS.NS.OMEMO}),{message:i,stanza:n}}const VS={decryptMessage:async function(e){const t=await crypto.subtle.importKey("raw",e.key,mS,!0,["encrypt","decrypt"]),n=gS(bS(e.payload),e.tag),i={name:"AES-GCM",iv:bS(e.iv),tagLength:128};return vS(await crypto.subtle.decrypt(i,t,n))},encryptMessage:async function(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(mS,!0,["encrypt","decrypt"]),i={name:"AES-GCM",iv:t,tagLength:128},s=await crypto.subtle.encrypt(i,n,yS(e)),r=s.byteLength-16,o=s.slice(0,r),a=s.slice(r),c=await crypto.subtle.exportKey("raw",n);return{key:c,tag:a,key_and_tag:gS(c,a),payload:_S(o),iv:_S(t)}},formatFingerprint:CS};Wl.elements.define("converse-omemo-fingerprints",class extends zg{static get properties(){return{jid:{type:String}}}async initialize(){this.devicelist=await Wl.omemo.devicelists.get(this.jid,!0),this.listenTo(this.devicelist.devices,"change:bundle",this.requestUpdate),this.listenTo(this.devicelist.devices,"change:trusted",this.requestUpdate),this.listenTo(this.devicelist.devices,"remove",this.requestUpdate),this.listenTo(this.devicelist.devices,"add",this.requestUpdate),this.listenTo(this.devicelist.devices,"reset",this.requestUpdate),this.requestUpdate()}render(){return this.devicelist?(e=>{const t=Dg("OMEMO Fingerprints"),n=Dg("No OMEMO-enabled devices found"),i=e.devicelist.devices;return xl`
<hr/>
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
${i.length?i.map((t=>((e,t)=>{const n=Dg("Trusted"),i=Dg("Untrusted");return t.get("bundle")&&t.get("bundle").fingerprint?xl`
<li class="list-group-item">
<form class="fingerprint-trust">
<div class="btn-group btn-group-toggle">
<label class="btn btn--small ${1===t.get("trusted")?"btn-primary active":"btn-secondary"}"
@click=${e.toggleDeviceTrust}>
<input type="radio" name="${t.get("id")}" value="1"
?checked=${-1!==t.get("trusted")}>${n}
</label>
<label class="btn btn--small ${-1===t.get("trusted")?"btn-primary active":"btn-secondary"}"
@click=${e.toggleDeviceTrust}>
<input type="radio" name="${t.get("id")}" value="-1"
?checked=${-1===t.get("trusted")}>${i}
</label>
</div>
<code class="fingerprint">${CS(t.get("bundle").fingerprint)}</code>
</form>
</li>
`:""})(e,t))):xl`<li class="list-group-item"> ${n} </li>`}
</ul>
`})(this):""}toggleDeviceTrust(e){const t=e.target;this.devicelist.devices.get(t.getAttribute("name")).save("trusted",parseInt(t.value,10))}});const JS=e=>{var t;const n=Dg("This device's OMEMO fingerprint"),i=Dg("Generate new keys and fingerprint");return xl`
<form class="converse-form fingerprint-removal" @submit=${e.removeSelectedFingerprints}>
<ul class="list-group fingerprints">
<li class="list-group-item active">${n}</li>
<li class="list-group-item">
${e.current_device&&e.current_device.get("bundle")&&e.current_device.get("bundle").fingerprint?(e=>xl`
<span class="fingerprint">${CS(e.current_device.get("bundle").fingerprint)}</span>`)(e):Vy()}
</li>
</ul>
<div class="form-group">
<button type="button" class="generate-bundle btn btn-danger" @click=${e.generateOMEMODeviceBundle}>${i}</button>
</div>
${null!==(t=e.other_devices)&&void 0!==t&&t.length?(e=>{var t;const n=Dg("Other OMEMO-enabled devices"),i=Dg("Checkbox to select fingerprints of all other OMEMO devices"),s=Dg("Remove checked devices and close"),r=Dg("Select all");return xl`
<ul class="list-group fingerprints">
<li class="list-group-item nopadding active">
<label>
<input type="checkbox" class="select-all" @change=${e.selectAll} title="${r}" aria-label="${i}"/>
${n}
</label>
</li>
${null===(t=e.other_devices)||void 0===t?void 0:t.map((t=>(e=>xl`
${e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=Dg("Checkbox for selecting the following fingerprint");return xl`
<li class="fingerprint-removal-item list-group-item nopadding">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${t}"/>
<span class="fingerprint">${CS(e.device.get("bundle").fingerprint)}</span>
</label>
</li>
`})(e):(e=>{const t=Dg("Device without a fingerprint"),n=Dg("Checkbox for selecting the following device");return xl`
<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)}
`)(Object.assign({device:t},e))))}
</ul>
<div class="form-group"><button type="submit" class="save-form btn btn-primary">${s}</button></div>
`})(e):""}
</form>`},{Strophe:QS,sizzle:ZS,u:YS}=Jl.env;Wl.elements.define("converse-omemo-profile",class extends zg{async initialize(){this.devicelist=await Wl.omemo.devicelists.get(Ya.bare_jid,!0),await this.setAttributes(),this.listenTo(this.devicelist.devices,"change:bundle",(()=>this.requestUpdate())),this.listenTo(this.devicelist.devices,"reset",(()=>this.requestUpdate())),this.listenTo(this.devicelist.devices,"reset",(()=>this.requestUpdate())),this.listenTo(this.devicelist.devices,"remove",(()=>this.requestUpdate())),this.listenTo(this.devicelist.devices,"add",(()=>this.requestUpdate())),this.requestUpdate()}async setAttributes(){this.device_id=await Wl.omemo.getDeviceID(),this.current_device=this.devicelist.devices.get(this.device_id),this.other_devices=this.devicelist.devices.filter((e=>e.get("id")!==this.device_id))}render(){return this.devicelist?JS(this):""}selectAll(e){let t=YS.ancestor(e.target,"li");for(;t;)t.querySelector('input[type="checkbox"]').checked=e.target.checked,t=t.nextElementSibling}async removeSelectedFingerprints(e){e.preventDefault(),e.stopPropagation(),e.target.querySelector(".select-all").checked=!1;const t=ZS('.fingerprint-removal-item input[type="checkbox"]:checked',e.target).map((e=>e.value));try{await this.devicelist.removeOwnDevices(t)}catch(e){R.error(e),Ya.api.alert(QS.LogLevel.ERROR,Dg("Error"),[Dg("Sorry, an error occurred while trying to remove the devices.")])}await this.setAttributes(),this.requestUpdate()}async generateOMEMODeviceBundle(e){e.preventDefault(),confirm(Dg("Are you sure you want to generate new OMEMO keys? This will remove your old keys and all previously encrypted messages will no longer be decryptable on this device."))&&(await Wl.omemo.bundle.generate(),await this.setAttributes(),this.requestUpdate())}});let XS;const KS=mp.extend({id:"converse-client-info-modal",initialize(e){XS=e._converse,mp.prototype.initialize.apply(this,arguments)},toHTML(){return(e=>{const t=Dg("Settings"),n=Dg("%1$s Open Source %2$s XMPP chat client brought to you by %3$s Opkode %2$s",'<a target="_blank" rel="nofollow" href="https://conversejs.org">',"</a>",'<a target="_blank" rel="nofollow" href="https://opkode.com">'),i=Dg("%1$s Translate %2$s it into your own language",'<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">',"</a>"),s=Wl.settings.get("show_client_info"),r=Wl.settings.get("allow_adhoc_commands");return xl`
<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>
${gp}
</div>
<div class="modal-body">
${s&&r?(e=>{const t=Dg("About"),n=Dg("Commands");return xl`
<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 ${s?"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>
<p class="brand-subtitle">${r_(qo().sanitize(n))}</p>
<p class="brand-subtitle">${r_(qo().sanitize(i))}</p>
</div>
</div>
<div class="tab-pane tab-pane--columns ${!s&&r?"active":""}"
id="commands-tabpanel"
role="tabpanel"
aria-labelledby="commands-tab">
<converse-adhoc-commands/>
</div>
</div>
</div>
</div>
</div>
`})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{version_name:XS.VERSION_NAME}))}});Wl.elements.define("converse-user-profile",class extends zg{initialize(){this.model=Ya.xmppstatus,this.listenTo(this.model,"vcard:add",this.requestUpdate),this.listenTo(this.model,"change",this.requestUpdate),this.listenTo(this.model,"vcard:change",this.requestUpdate)}render(){return(e=>{var t,n,i;const s=e.model.get("status")||"offline",r=(null===(t=e.model.vcard)||void 0===t?void 0:t.get("fullname"))||Ya.bare_jid,o=e.model.get("status_message")||Dg("I am %1$s","chat"===(a=s)?Dg("online"):"dnd"===a?Dg("busy"):"xa"===a?Dg("away for long"):"away"===a?Dg("away"):"offline"===a?Dg("offline"):Dg(a)||Dg("online"));var a;const c=Dg("Click to change your chat status"),l=Wl.settings.get("show_client_info")||Wl.settings.get("allow_adhoc_commands");let d,u;return[d,u]="online"===s?["fa fa-circle chat-status","chat-status-online"]:"dnd"===s?["fa fa-minus-circle chat-status","chat-status-busy"]:"away"===s?["fa fa-circle chat-status","chat-status-away"]:["fa fa-circle chat-status","subdued-color"],xl`
<div class="userinfo controlbox-padded">
<div class="controlbox-section profile d-flex">
<a class="show-profile" href="#" @click=${e.showProfileModal}>
<converse-avatar class="avatar align-self-center"
.data=${null===(n=e.model.vcard)||void 0===n?void 0:n.attributes}
nonce=${null===(i=e.model.vcard)||void 0===i?void 0:i.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>
<span class="username w-100 align-self-center">${r}</span>
${l?function(e){const t=Dg("Show details about this chat client");return xl`<a class="controlbox-heading__btn show-client-info align-self-center" title="${t}" @click=${e.showUserSettingsModal}>
<converse-icon class="fa fa-cog" size="1em"></converse-icon>
</a>`}(e):""}
${Wl.settings.get("allow_logout")?function(e){const t=Dg("Log out");return xl`<a class="controlbox-heading__btn logout align-self-center" title="${t}" @click=${e.logout}>
<converse-icon class="fa fa-sign-out-alt" size="1em"></converse-icon>
</a>`}(e):""}
</div>
<div class="d-flex xmpp-status">
<a class="change-status" title="${c}" data-toggle="modal" data-target="#changeStatusModal" @click=${e.showStatusChangeModal}>
<span class="${s} w-100 align-self-center" data-value="${s}">
<converse-icon color="var(--${u})" style="margin-top: -0.1em" size="0.82em" class="${d}"></converse-icon> ${o}</span>
</a>
</div>
</div>`})(this)}showProfileModal(e){null==e||e.preventDefault(),Wl.modal.show(Ya.ProfileModal,{model:this.model},e)}showStatusChangeModal(e){null==e||e.preventDefault(),Wl.modal.show(Ya.ChatStatusModal,{model:this.model},e)}showUserSettingsModal(e){null==e||e.preventDefault(),Wl.modal.show(KS,{model:this.model,_converse:Ya},e)}logout(e){null==e||e.preventDefault(),!0===confirm(Dg("Are you sure you want to log out?"))&&Wl.user.logout()}});const ex=Jl.env.utils,tx=mp.extend({id:"modal-status-change",events:{"submit form#set-xmpp-status":"onFormSubmitted","click .clear-input":"clearStatusMessage"},toHTML(){return(e=>xl`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="changeStatusModalLabel">${e.modal_title}</h5>
${gp}
</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">
<converse-icon size="1em" class="fa fa-circle chat-status chat-status--online"></converse-icon>${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">
<converse-icon size="1em" class="fa fa-minus-circle chat-status chat-status--busy"></converse-icon>${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">
<converse-icon size="1em" class="fa fa-circle chat-status chat-status--away"></converse-icon>${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">
<converse-icon size="1em" class="far fa-circle chat-status chat-status--xa"></converse-icon>${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}"/>
<converse-icon size="1em" class="fa fa-times clear-input ${e.status_message?"":"hidden"}"></converse-icon>
</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:Dg("Away"),label_busy:Dg("Busy"),label_cancel:Dg("Cancel"),label_close:Dg("Close"),label_custom_status:Dg("Custom status"),label_offline:Dg("Offline"),label_online:Dg("Online"),label_save:Dg("Save"),label_xa:Dg("Away for long"),modal_title:Dg("Change chat status"),placeholder_status_message:Dg("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(),ex.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()}});Ya.ChatStatusModal=tx;const nx=Dg("Your profile picture");Wl.elements.define("converse-image-picker",class extends zg{static get properties(){return{height:{type:Number},data:{type:Object},width:{type:Number}}}render(){return xl`
<a class="change-avatar" @click=${this.openFileSelection} title="${nx}">
<converse-avatar class="avatar" .data=${this.data} height="${this.height}" width="${this.width}"></converse-avatar>
</a>
<input @change=${this.updateFilePreview} class="hidden" name="image" type="file"/>
`}openFileSelection(e){e.preventDefault(),this.querySelector('input[type="file"]').click()}updateFilePreview(e){const t=e.target.files[0],n=new FileReader;n.onloadend=()=>{this.data={data_uri:n.result,image_type:t.type}},n.readAsDataURL(t)}});var ix=n(2234),sx=n.n(ix);const{sizzle:rx}=Jl.env,ox=new(sx())({targetSize:.1,quality:.75,maxWidth:256,maxHeight:256}),ax=mp.extend({id:"user-profile-modal",events:{"submit .profile-form":"onFormSubmitted"},initialize(){this.listenTo(this.model,"change",this.render),mp.prototype.initialize.apply(this,arguments),Wl.trigger("profileModalInitialized",this.model)},toHTML(){return(e=>{var t,n;const i=Dg("Your Profile"),s=Dg("Email"),r=Dg("Full Name"),o=Dg("XMPP Address"),a=Dg("Nickname"),c=Dg("Role"),l=Dg("Save and close"),d=Dg("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),u=Dg("URL"),h=Dg("OMEMO"),m=Dg("Profile"),f=xl`<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="profile-tab" href="#profile-tabpanel" aria-controls="profile-tabpanel" role="tab" data-toggle="tab">${m}</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link" id="omemo-tab" href="#omemo-tabpanel" aria-controls="omemo-tabpanel" role="tab" data-toggle="tab">${h}</a>
</li>
</ul>`;return xl`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="user-profile-modal-label">${i}</h5>
${gp}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
${null!==(t=Ya.pluggable.plugins["converse-omemo"])&&void 0!==t&&t.enabled(Ya)?f:""}
<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 .data="${{image:e.image,image_type:e.image_type}}" width="128" height="128"></converse-image-picker>
</div>
<div class="col">
<div class="form-group">
<label class="col-form-label">${o}:</label>
<div>${e.jid}</div>
</div>
</div>
</div>
<div class="form-group">
<label for="vcard-fullname" class="col-form-label">${r}:</label>
<input id="vcard-fullname" type="text" class="form-control" name="fn" value="${e.fullname||""}"/>
</div>
<div class="form-group">
<label for="vcard-nickname" class="col-form-label">${a}:</label>
<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">${u}:</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">${s}:</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">${c}:</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">${d}</small>
</div>
<hr/>
<div class="form-group">
<button type="submit" class="save-form btn btn-primary">${l}</button>
</div>
</form>
</div>
${null!==(n=Ya.pluggable.plugins["converse-omemo"])&&void 0!==n&&n.enabled(Ya)?xl`
<div class="tab-pane" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">
<converse-omemo-profile></converse-omemo-profile>
</div>`:""}
</div>
</div>
</div>
</div>
`})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{view:this}))},afterRender(){this.tabs=rx(".nav-item .nav-link",this.el).map((e=>new(ip().Tab)(e)))},async setVCard(e){try{await Wl.vcard.set(Ya.bare_jid,e)}catch(e){return R.fatal(e),void this.alert([Dg("Sorry, an error happened while trying to save your profile data."),Dg("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),i=n.get("image"),s={fn:n.get("fn"),nickname:n.get("nickname"),role:n.get("role"),email:n.get("email"),url:n.get("url")};if(i.size){const e=[i];ox.compress(e).then((e=>{const{photo:n}=e[0];t.onloadend=()=>{Object.assign(s,{image:btoa(t.result),image_type:i.type}),this.setVCard(s)},t.readAsBinaryString(n.data)}))}else Object.assign(s,{image:this.model.vcard.get("image"),image_type:this.model.vcard.get("image_type")}),this.setVCard(s)}});Ya.ProfileModal=ax,Jl.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews"],initialize(){Wl.settings.extend({allow_adhoc_commands:!0,show_client_info:!0})}});const cx={generateFingerprints:async function(e){const t=await PS(e);return Promise.all(t.map((e=>zS(e))))},getDeviceForContact:function(e,t){return PS(e).then((e=>e.get(t)))},contactHasOMEMOSupport:async function(e){return(await PS(e)).length>0}},lx=cx;class dx extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}const{Strophe:ux,sizzle:hx,u:mx,$iq:fx}=Jl.env,gx=fa.extend({defaults:{trusted:0,active:!0},getRandomPreKey(){const e=this.get("bundle");return e.prekeys[mx.getRandomInt(e.prekeys.length)]},async fetchBundleFromServer(){const e=fx({type:"get",from:Ya.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:ux.NS.PUBSUB}).c("items",{node:`${ux.NS.OMEMO_BUNDLES}:${this.get("id")}`});let t;try{t=await Wl.sendIQ(e)}catch(t){return R.error(`Could not fetch bundle for device ${this.get("id")} from ${this.get("jid")}`),R.error(t),null}if(t.querySelector("error"))throw new dx("Could not fetch bundle",t);const n=hx(`items[node="${ux.NS.OMEMO_BUNDLES}:${this.get("id")}"]`,t).pop(),i=LS(hx(`bundle[xmlns="${ux.NS.OMEMO}"]`,n).pop());return this.save("bundle",i),i},getBundle(){return this.get("bundle")?Promise.resolve(this.get("bundle"),this):this.fetchBundleFromServer()}}),{Strophe:px,$build:vx,$iq:yx,sizzle:_x}=Jl.env,bx=fa.extend({idAttribute:"jid",async initialize(){this.initialized=fo(),await this.initDevices(),this.initialized.resolve()},initDevices(){this.devices=new Ya.Devices;const e=`converse.devicelist-${Ya.bare_jid}-${this.get("jid")}`;return Oo(this.devices,e),this.fetchDevices()},async onDevicesFound(e){if(0===e.length){let e=[];try{e=await this.fetchDevicesFromServer()}catch(e){null===e?R.error(`Timeout error while fetching devices for ${this.get("jid")}`):(R.error(`Could not fetch devices for ${this.get("jid")}`),R.error(e)),this.destroy()}this.get("jid")===Ya.bare_jid&&this.publishCurrentDevice(e)}},fetchDevices(){return void 0===this._devices_promise&&(this._devices_promise=new Promise((e=>{this.devices.fetch({success:t=>e(this.onDevicesFound(t)),error:(t,n)=>{R.error(n),e()}})}))),this._devices_promise},async getOwnDeviceId(){let e=Ya.omemo_store.get("device_id");return this.devices.findWhere({id:e})||(await Ya.omemo_store.generateBundle(),e=Ya.omemo_store.get("device_id")),e},async publishCurrentDevice(e){if(this.get("jid")===Ya.bare_jid){if(await US(),Ya.omemo_store)return e.includes(await this.getOwnDeviceId())?void 0:this.publishDevices();R.warn("publishCurrentDevice: omemo_store is not defined, likely a timing issue")}},async fetchDevicesFromServer(){const e=yx({type:"get",from:Ya.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:px.NS.PUBSUB}).c("items",{node:px.NS.OMEMO_DEVICELIST}),t=await Wl.sendIQ(e),n=`list[xmlns="${px.NS.OMEMO}"] device`,i=_x(n,t).map((e=>e.getAttribute("id"))),s=this.get("jid");return Promise.all(i.map((e=>this.devices.create({id:e,jid:s},{promise:!0}))))},publishDevices(){const e=vx("item",{id:"current"}).c("list",{xmlns:px.NS.OMEMO});return this.devices.filter((e=>e.get("active"))).forEach((t=>e.c("device",{id:t.get("id")}).up())),Wl.pubsub.publish(null,px.NS.OMEMO_DEVICELIST,e,{"pubsub#access_model":"open"},!1)},async removeOwnDevices(e){if(this.get("jid")!==Ya.bare_jid)throw new Error("Cannot remove devices from someone else's device list");return await Promise.all(e.map((e=>this.devices.get(e))).map((e=>new Promise((t=>e.destroy({success:t,error:(e,n)=>{R.error(n),t()}})))))),this.publishDevices()}}),wx=bx,Sx=Rc.extend({model:wx}),xx=Rc.extend({model:gx});var Ex=Math.ceil,Ax=Math.max;const Cx=function(e,t,n){return n&&"number"!=typeof n&&tt(e,t,n)&&(t=n=void 0),e=Ai(e),void 0===t?(t=e,e=0):t=Ai(t),function(e,t,n,i){for(var s=-1,r=Ax(Ex((t-e)/(n||1)),0),o=Array(r);r--;)o[i?r:++s]=e,e+=n;return o}(e,t,n=void 0===n?e<t?1:-1:Ai(n),void 0)},{Strophe:Tx,$build:kx,u:jx}=Jl.env,$x=fa.extend({Direction:{SENDING:1,RECEIVING:2},getIdentityKeyPair(){const e=this.get("identity_keypair");return Promise.resolve({privKey:jx.base64ToArrayBuffer(e.privKey),pubKey:jx.base64ToArrayBuffer(e.pubKey)})},getLocalRegistrationId(){return Promise.resolve(parseInt(this.get("device_id"),10))},isTrustedIdentity(e,t,n){if(null==e)throw new Error("Can't check identity key for invalid key");if(!(t instanceof ArrayBuffer))throw new Error("Expected identity_key to be an ArrayBuffer");const i=this.get("identity_key"+e);return void 0===i?Promise.resolve(!0):Promise.resolve(jx.arrayBufferToBase64(t)===i)},loadIdentityKey(e){if(null==e)throw new Error("Can't load identity_key for invalid identifier");return Promise.resolve(jx.base64ToArrayBuffer(this.get("identity_key"+e)))},saveIdentity(e,t){if(null==e)throw new Error("Can't save identity_key for invalid identifier");const n=new libsignal.SignalProtocolAddress.fromString(e),i=this.get("identity_key"+n.getName()),s=jx.arrayBufferToBase64(t);return this.save("identity_key"+n.getName(),s),i&&s!==i?Promise.resolve(!0):Promise.resolve(!1)},getPreKeys(){return this.get("prekeys")||{}},loadPreKey(e){const t=this.getPreKeys()[e];return t?Promise.resolve({privKey:jx.base64ToArrayBuffer(t.privKey),pubKey:jx.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storePreKey(e,t){const n={};return n[e]={pubKey:jx.arrayBufferToBase64(t.pubKey),privKey:jx.arrayBufferToBase64(t.privKey)},this.save("prekeys",Object.assign(this.getPreKeys(),n)),Promise.resolve()},removePreKey(e){return this.save("prekeys",ma(this.getPreKeys(),e)),Promise.resolve()},loadSignedPreKey(e){const t=this.get("signed_prekey");return t?Promise.resolve({privKey:jx.base64ToArrayBuffer(t.privKey),pubKey:jx.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storeSignedPreKey(e){if("object"!=typeof e)throw new Error("storeSignedPreKey: expected an object");return this.save("signed_prekey",{id:e.keyId,privKey:jx.arrayBufferToBase64(e.keyPair.privKey),pubKey:jx.arrayBufferToBase64(e.keyPair.pubKey),signature:jx.arrayBufferToBase64(e.signature)}),Promise.resolve()},removeSignedPreKey(e){return this.get("signed_prekey").id===e&&(this.unset("signed_prekey"),this.save()),Promise.resolve()},loadSession(e){return Promise.resolve(this.get("session"+e))},storeSession(e,t){return Promise.resolve(this.save("session"+e,t))},removeSession(e){return Promise.resolve(this.unset("session"+e))},removeAllSessions(e){const t=Object.keys(this.attributes).filter((t=>!!t.startsWith("session"+e)&&t)),n={};return t.forEach((e=>{n[e]=void 0})),this.save(n),Promise.resolve()},publishBundle(){const e=this.get("signed_prekey"),t=`${Tx.NS.OMEMO_BUNDLES}:${this.get("device_id")}`,n=kx("item").c("bundle",{xmlns:Tx.NS.OMEMO}).c("signedPreKeyPublic",{signedPreKeyId:e.id}).t(e.pubKey).up().c("signedPreKeySignature").t(e.signature).up().c("identityKey").t(this.get("identity_keypair").pubKey).up().c("prekeys");return Object.values(this.get("prekeys")).forEach(((e,t)=>n.c("preKeyPublic",{preKeyId:t}).t(e.pubKey).up())),Wl.pubsub.publish(null,t,n,{"pubsub#access_model":"open"},!1)},async generateMissingPreKeys(){const e=vc(_p(Cx(0,Ya.NUM_PREKEYS),Number.prototype.toString),Object.keys(this.getPreKeys()));if(e.length<1)return R.warn("No missing prekeys to generate for our own device"),Promise.resolve();(await Promise.all(e.map((e=>libsignal.KeyHelper.generatePreKey(parseInt(e,10)))))).forEach((e=>this.storePreKey(e.keyId,e.keyPair)));const t=Object.keys(this.getPreKeys()).map((e=>({id:e.keyId,key:jx.arrayBufferToBase64(e.pubKey)}))),n=(await Wl.omemo.devicelists.get(Ya.bare_jid)).devices.get(this.get("device_id")),i=await n.getBundle();n.save("bundle",Object.assign(i,{prekeys:t}))},async generateBundle(){const e=await libsignal.KeyHelper.generateIdentityKeyPair(),t={},n=jx.arrayBufferToBase64(e.pubKey),i=await async function(){const e=(await Wl.omemo.devicelists.get(Ya.bare_jid,!0)).devices.pluck("id");let t=libsignal.KeyHelper.generateRegistrationId(),n=0;for(;e.includes(t);)if(t=libsignal.KeyHelper.generateRegistrationId(),n++,10===n)throw new Error("Unable to generate a unique device ID");return t.toString()}();t.identity_key=n,t.device_id=i,this.save({device_id:i,identity_keypair:{privKey:jx.arrayBufferToBase64(e.privKey),pubKey:n},identity_key:n});const s=await libsignal.KeyHelper.generateSignedPreKey(e,0);this.storeSignedPreKey(s),t.signed_prekey={id:s.keyId,public_key:jx.arrayBufferToBase64(s.keyPair.pubKey),signature:jx.arrayBufferToBase64(s.signature)};const r=await Promise.all(Cx(0,Ya.NUM_PREKEYS).map((e=>libsignal.KeyHelper.generatePreKey(e))));r.forEach((e=>this.storePreKey(e.keyId,e.keyPair)));const o=await Wl.omemo.devicelists.get(Ya.bare_jid),a=await o.devices.create({id:t.device_id,jid:Ya.bare_jid},{promise:!0}),c=r.map((e=>({id:e.keyId,key:jx.arrayBufferToBase64(e.keyPair.pubKey)})));t.prekeys=c,a.save("bundle",t)},fetchSession(){return void 0===this._setup_promise&&(this._setup_promise=new Promise(((e,t)=>{this.fetch({success:()=>{this.get("device_id")?e():this.generateBundle().then(e).catch(t)},error:(n,i)=>{R.warn("Could not fetch OMEMO session from cache, we'll generate a new one."),R.warn(i),this.generateBundle().then(e).catch(t)}})}))),this._setup_promise}}),Nx=$x,Ox={omemo:{getDeviceID:async()=>(await Wl.waitUntil("OMEMOInitialized"),Ya.omemo_store.get("device_id")),devicelists:{async get(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=Ya.devicelists.get(e)||(t?Ya.devicelists.create({jid:e}):null);return await(null==n?void 0:n.initialized),n}},bundle:{generate:async()=>{await Wl.waitUntil("OMEMOInitialized");const e=await Wl.omemo.devicelists.get(Ya.bare_jid),t=Ya.omemo_store.get("device_id");if(t){const n=e.devices.get(t);Ya.omemo_store.unset(t),n&&await new Promise((e=>n.destroy({success:e,error:e}))),e.devices.trigger("remove")}await Ya.omemo_store.generateBundle(),await e.publishDevices();const n=zS(e.devices.get(Ya.omemo_store.get("device_id")));return await Ya.omemo_store.publishBundle(),n}}}},{Strophe:Ix}=Jl.env;Jl.env.omemo=VS,Ix.addNamespace("OMEMO_DEVICELIST",Ix.NS.OMEMO+".devicelist"),Ix.addNamespace("OMEMO_VERIFICATION",Ix.NS.OMEMO+".verification"),Ix.addNamespace("OMEMO_WHITELISTED",Ix.NS.OMEMO+".whitelisted"),Ix.addNamespace("OMEMO_BUNDLES",Ix.NS.OMEMO+".bundles"),Jl.plugins.add("converse-omemo",{enabled:e=>window.libsignal&&e.config.get("trusted")&&!Wl.settings.get("clear_cache_on_logout")&&!e.api.settings.get("blacklisted_plugins").includes("converse-omemo"),dependencies:["converse-chatview","converse-pubsub"],initialize(){Wl.settings.extend({omemo_default:!1}),Wl.promises.add(["OMEMOInitialized"]),Ya.NUM_PREKEYS=100,Object.assign(Ya,lx),Object.assign(Ya.api,Ox),Ya.OMEMOStore=Nx,Ya.Device=gx,Ya.Devices=xx,Ya.DeviceList=wx,Ya.DeviceLists=Sx,Wl.waitUntil("chatBoxesInitialized").then(NS),Wl.listen.on("getOutgoingMessageAttributes",TS),Wl.listen.on("createMessageStanza",(async(e,t)=>{try{t=await WS(e,t)}catch(t){!function(e,t){if("IQError"===e.name){t.save("omemo_supported",!1);const n=[];ES(`presence-subscription-required[xmlns="${SS.NS.PUBSUB_ERROR}"]`,e.iq).length?n.push(Dg("Sorry, we're unable to send an encrypted message because %1$s requires you to be subscribed to their presence in order to see their OMEMO information",e.iq.getAttribute("from"))):ES('remote-server-not-found[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]',e.iq).length?n.push(Dg("Sorry, we're unable to send an encrypted message because the remote server for %1$s could not be found",e.iq.getAttribute("from"))):(n.push(Dg("Unable to send an encrypted message due to an unexpected error.")),n.push(e.iq.outerHTML)),Wl.alert("error",Dg("Error"),n)}else e.user_facing&&Wl.alert("error",Dg("Error"),[e.message]);throw e}(t,e)}return t})),Wl.listen.on("afterFileUploaded",((e,t)=>e.file.xep454_ivkey?function(e,t){const n=t.oob_url.replace(/^https?:/,"aesgcm:")+"#"+e.file.xep454_ivkey;return Object.assign(t,{oob_url:null,message:n,body:n})}(e,t):t)),Wl.listen.on("beforeFileUpload",((e,t)=>e.get("omemo_active")?async function(e){const t=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),i=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},n,await e.arrayBuffer()),s=await window.crypto.subtle.exportKey("raw",n),r=new File([i],e.name,{type:e.type,lastModified:e.lastModified});return r.xep454_ivkey=pS(t)+pS(s),r}(t):t)),Wl.listen.on("parseMessage",$S),Wl.listen.on("parseMUCMessage",$S),Wl.listen.on("chatBoxViewInitialized",OS),Wl.listen.on("chatRoomViewInitialized",OS),Wl.listen.on("connected",FS),Wl.listen.on("getToolbarButtons",GS),Wl.listen.on("statusInitialized",BS),Wl.listen.on("addClientFeatures",(()=>Wl.disco.own.features.add(`${Ix.NS.OMEMO_DEVICELIST}+notify`))),Wl.listen.on("afterMessageBodyTransformed",jS),Wl.listen.on("userDetailsModalInitialized",(e=>{const t=e.get("jid");Ya.generateFingerprints(t).catch((e=>R.error(e)))})),Wl.listen.on("profileModalInitialized",(()=>{Ya.generateFingerprints(Ya.bare_jid).catch((e=>R.error(e)))})),Wl.listen.on("clearSession",(()=>{delete Ya.omemo_store,Ya.shouldClearCache()&&Ya.devicelists&&(Ya.devicelists.clearStore(),delete Ya.devicelists)}))}});const{Strophe:Mx,$iq:Rx}=Jl.env;async function Dx(e){e=e||Ya.bare_jid;const t=Ya.session.get("push_enabled")||[];if(t.includes(e))return;const n=Wl.settings.get("push_app_servers").filter((e=>!e.disable)),i=Wl.settings.get("push_app_servers").filter((e=>e.disable)),s=n.map((t=>async function(e,t){if(!t.jid||!t.node)return;if(!await Wl.disco.getIdentity("pubsub","push",t.jid))return R.warn(`Not enabling push the service "${t.jid}", it doesn't have the right disco identtiy.`);const n=await Promise.all([Wl.disco.supports(Mx.NS.PUSH,t.jid),Wl.disco.supports(Mx.NS.PUSH,e)]);if(!n[0]&&!n[1])return void R.warn(`Not enabling push app server "${t.jid}", no disco support from your server.`);const i=Rx({type:"set"});return e!==Ya.bare_jid&&i.attrs({to:e}),i.c("enable",{xmlns:Mx.NS.PUSH,jid:t.jid,node:t.node}),t.secret&&i.c("x",{xmlns:Mx.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t(`${Mx.NS.PUBSUB}#publish-options`).up().up().c("field",{var:"secret"}).c("value").t(t.secret),Wl.sendIQ(i)}(e,t))),r=i.map((t=>async function(e,t){if(!t.jid)return;if(!await Wl.disco.supports(Mx.NS.PUSH,e||Ya.bare_jid))return void R.warn(`Not disabling push app server "${t.jid}", no disco support from your server.`);const n=Rx({type:"set"});e!==Ya.bare_jid&&n.attrs({to:e}),n.c("disable",{xmlns:Mx.NS.PUSH,jid:t.jid}),t.node&&n.attrs({node:t.node}),Wl.sendIQ(n).catch((e=>{R.error(`Could not disable push app server for ${t.jid}`),R.error(e)}))}(e,t)));try{await Promise.all(s.concat(r))}catch(e){R.error("Could not enable or disable push App Server"),e&&R.error(e)}finally{t.push(e)}Ya.session.save("push_enabled",t)}function Lx(e){e.get("type")==Ya.CHATROOMS_TYPE&&Dx(Mx.getDomainFromJid(e.get("jid")))}const{Strophe:zx}=Jl.env;zx.addNamespace("PUSH","urn:xmpp:push:0"),Jl.plugins.add("converse-push",{initialize(){Wl.settings.extend({push_app_servers:[],enable_muc_push:!1}),Wl.listen.on("statusInitialized",(()=>Dx())),Wl.settings.get("enable_muc_push")&&Wl.listen.on("chatBoxesInitialized",(()=>Ya.chatboxes.on("add",Lx)))}});const Px=e=>xl`
<converse-brand-logo></converse-brand-logo>
${0===e.model.get("registration_status")?(()=>{const e=Wl.settings.get("registration_domain"),t=Dg("Create your account"),n=Dg("Please enter the XMPP provider to register with:");return xl`
<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=Wl.settings.get("domain_placeholder"),t=Dg("Tip: A list of public XMPP providers is available"),n=Dg("here"),i=Wl.settings.get("providers_link");return xl`
<input class="form-control" required="required" type="text" name="domain" placeholder="${e}" />
<p class="form-text text-muted">
${t}
<a href="${i}" class="url" target="_blank" rel="noopener">${n}</a>.
</p>
`})()}
</div>
${e?"":(()=>{const e=Dg("Fetch registration form"),t=Dg("Already have a chat account?"),n=Dg("Log in here");return xl`
<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=Wl.settings.get("registration_domain"),t=Dg("Hold tight, we're fetching the registration form…"),n=Dg("Cancel");return xl`
<form id="converse-register" class="converse-form no-scrolling">
${Vy({classes:"hor_centered"})}
<p class="info">${t}</p>
${e?"":xl`
<button class="btn btn-secondary button-cancel hor_centered">${n}</button>
`}
</form>
`})():""}
${2===e.model.get("registration_status")?(e=>{const t=Dg("Choose a different provider"),n=Dg("Already have a chat account?"),i=Dg("Account Registration:"),s=Dg("Log in here"),r=Dg("Register"),o=Wl.settings.get("registration_domain");return xl`
<form id="converse-register" class="converse-form">
<legend class="col-form-label">${i} ${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?xl`
<input type="submit" class="btn btn-primary" value="${r}" />
`:""}
${o?"":xl`
<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">${s}</a></p>
</div>
</fieldset>
</form>
`})(e):""}
`;function Fx(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:Ux,sizzle:Bx,$iq:qx}=Jl.env,Hx=Jl.env.utils,Gx=1,Wx=2;Wl.elements.define("converse-register-panel",class extends Tp{constructor(){super(...arguments),Fx(this,"id","converse-register-panel"),Fx(this,"className","controlbox-pane fade-in"),Fx(this,"events",{"submit form#converse-register":"onFormSubmission","click .button-cancel":"renderProviderChoiceForm"})}initialize(){this.reset();const e=Ya.chatboxes.get("controlbox");this.model=e,this.listenTo(Ya,"connectionInitialized",this.registerHooks),this.listenTo(this.model,"change:registration_status",this.render);const t=Wl.settings.get("registration_domain");t?this.fetchRegistrationForm(t):this.model.set("registration_status",0)}render(){Tl(Px({domain:this.domain,fields:this.fields,form_fields:this.form_fields,instructions:this.instructions,model:this.model,title:this.title}),this)}registerHooks(){const e=Ya.connection,t=e._connect_cb.bind(e);e._connect_cb=(e,n,i)=>{this._registering?this.getRegistrationFields(e,n)&&(this._registering=!1):t(e,n,i)}}connectedCallback(){super.connectedCallback(),this.render()}getRegistrationFields(e,t){const n=Ya.connection;n.connected=!0;const i=n._proto._reqToData(e);if(!i)return;if(n._proto._connect_cb(i)===Ux.Status.CONNFAIL)return this.showValidationError(Dg("Sorry, we're unable to connect to your chosen provider.")),!1;const s=i.getElementsByTagName("register"),r=i.getElementsByTagName("mechanism");if(0===s.length&&0===r.length)return n._proto._no_auth_received(t),!1;if(0===s.length)return n._changeConnectStatus(Ux.Status.REGIFAIL),this.showValidationError(Dg("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=qx({type:"get"}).c("query",{xmlns:Ux.NS.REGISTER}).tree();return o.setAttribute("id",n.getUniqueId("sendIQ")),n.send(o),n.connected=!1,!0}onRegistrationFields(e){return"error"===e.getAttribute("type")?(Ya.connection._changeConnectStatus(Ux.Status.REGIFAIL,Dg('Something went wrong while establishing a connection with "%1$s". Are you sure it exists?',this.domain)),!1):1!==e.getElementsByTagName("query").length?(Ya.connection._changeConnectStatus(Ux.Status.REGIFAIL,"unknown"),!1):(this.setFields(e),this.model.get("registration_status")===Gx&&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,Uo(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",Gx),this.reset({domain:Ux.getDomainFromJid(e),_registering:!0}),await Ya.initConnection(this.domain),null===(t=Ya.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 i=this.querySelector("form");i.insertAdjacentHTML("afterbegin",'<span class="reg-feedback"></span>'),n=i.querySelector(".reg-feedback"),n.textContent=e,t&&n.classList.add(t)}showSpinner(){const e=this.querySelector("form");return Tl(Vy(),e),this}onConnectStatusChanged(e){R.debug("converse-register: onConnectStatusChanged"),[Ux.Status.DISCONNECTED,Ux.Status.CONNFAIL,Ux.Status.REGIFAIL,Ux.Status.NOTACCEPTABLE,Ux.Status.CONFLICT].includes(e)?(R.error(`Problem during registration: Strophe.Status is ${Ya.CONNECTION_STATUS[e]}`),this.abortRegistration()):e===Ux.Status.REGISTERED&&(R.debug("Registered successfully."),Ya.connection.reset(),this.showSpinner(),["converse/login","converse/register"].includes(Ya.router.history.getFragment())&&Ya.router.navigate("",{replace:!0}),this.fields.password&&this.fields.username?(Ya.connection.connect(this.fields.username.toLowerCase()+"@"+this.domain.toLowerCase(),this.fields.password,Ya.onConnectStatusChanged),this.giveFeedback(Dg("Now logging you in"),"info")):Ya.giveFeedback(Dg("Registered successfully")),this.reset())}getLegacyFormFields(){const e=Object.keys(this.fields).map((e=>"username"===e?$v({domain:` @${this.domain}`,name:e,type:"text",label:e,value:"",required:!0}):kv({label:e,name:e,placeholder:e,required:!0,type:"password"===e||"email"===e?e:"text",value:""}))),t=this.urls.map((e=>jv({label:"",value:e})));return[...e,...t]}getFormFields(e){return"xform"===this.form_type?Array.from(e.querySelectorAll("field")).map((t=>Hu.xForm2TemplateResult(t,e,{domain:this.domain}))):this.getLegacyFormFields()}renderRegistrationForm(e){this.form_fields=this.getFormFields(e),this.model.set("registration_status",Wx)}showValidationError(e){const t=this.querySelector("form");let n=t.querySelector(".form-errors");if(null===n){n='<div class="form-errors hidden"></div>';const e=t.querySelector("p.instructions");null===e?t.insertAdjacentHTML("afterbegin",n):e.insertAdjacentHTML("afterend",n),n=t.querySelector(".form-errors")}else n.innerHTML="";n.insertAdjacentHTML("beforeend",'<p class="form-help error">'+e+"</p>"),n.classList.remove("hidden")}reportErrors(e){const t=e.querySelectorAll("error");if(t.forEach((e=>this.showValidationError(e.textContent))),!t.length){const e=Dg("The provider rejected your registration attempt. Please check the values you entered for correctness.");this.showValidationError(e)}}renderProviderChoiceForm(e){e&&e.preventDefault&&e.preventDefault(),Ya.connection._proto._abortAllRequests(),Ya.connection.reset(),this.render()}abortRegistration(){Ya.connection._proto._abortAllRequests(),Ya.connection.reset(),[Gx,Wx].includes(this.model.get("registration_status"))?Wl.settings.get("registration_domain")&&this.fetchRegistrationForm(Wl.settings.get("registration_domain")):this.render()}submitRegistrationForm(e){if(Array.from(this.querySelectorAll("input.required")).reduce(((e,t)=>""===t.value?(t.classList.add("error"),e+1):e),0))return;const t=Bx(":input:not([type=button]):not([type=submit])",e),n=qx({type:"set",id:Hx.getUniqueId()}).c("query",{xmlns:Ux.NS.REGISTER});if("xform"===this.form_type){n.c("x",{xmlns:Ux.NS.XFORM,type:"submit"});const e=t.map((e=>Hu.webForm2xForm(e))).filter((e=>e));e.forEach((e=>n.cnode(e).up()))}else t.forEach((e=>n.c(e.getAttribute("name"),{},e.value)));Ya.connection._addSysHandler(this._onRegisterIQ.bind(this),null,"iq",null,null),Ya.connection.send(n),this.setFields(n.tree())}setFields(e){const t=e.querySelector("query"),n=Bx(`x[xmlns="${Ux.NS.XFORM}"]`,t);n.length>0?this._setFieldsFromXForm(n.pop()):this._setFieldsFromLegacy(t)}_setFieldsFromLegacy(e){[].forEach.call(e.children,(e=>{"instructions"!==e.tagName.toLowerCase()?"x"!==e.tagName.toLowerCase()?this.fields[e.tagName.toLowerCase()]=Ux.getText(e):"jabber:x:oob"===e.getAttribute("xmlns")&&this.urls.concat(Bx("url",e).map((e=>e.textContent))):this.instructions=Ux.getText(e)})),this.form_type="legacy"}_setFieldsFromXForm(e){var t,n;this.title=null===(t=e.querySelector("title"))||void 0===t?void 0:t.textContent,this.instructions=null===(n=e.querySelector("instructions"))||void 0===n?void 0:n.textContent,e.querySelectorAll("field").forEach((e=>{const t=e.getAttribute("var");var n;t?this.fields[t.toLowerCase()]=(null===(n=e.querySelector("value"))||void 0===n?void 0:n.textContent)??"":R.warn("Found field we couldn't parse")})),this.form_type="xform"}_onRegisterIQ(e){if("error"===e.getAttribute("type")){R.error("Registration failed."),this.reportErrors(e);let t=e.getElementsByTagName("error");if(1!==t.length)return Ya.connection._changeConnectStatus(Ux.Status.REGIFAIL,"unknown"),!1;t=t[0].firstElementChild.tagName.toLowerCase(),"conflict"===t?Ya.connection._changeConnectStatus(Ux.Status.CONFLICT,t):"not-acceptable"===t?Ya.connection._changeConnectStatus(Ux.Status.NOTACCEPTABLE,t):Ya.connection._changeConnectStatus(Ux.Status.REGIFAIL,t)}else Ya.connection._changeConnectStatus(Ux.Status.REGISTERED,null);return!1}});const{Strophe:Vx}=Jl.env;Vx.addNamespace("REGISTER","jabber:iq:register");const Jx=Object.keys(Vx.Status).reduce(((e,t)=>Math.max(e,Vx.Status[t])),0);Vx.Status.REGIFAIL=Jx+1,Vx.Status.REGISTERED=Jx+2,Vx.Status.CONFLICT=Jx+3,Vx.Status.NOTACCEPTABLE=Jx+5,Jl.plugins.add("converse-register",{dependencies:["converse-controlbox"],enabled:()=>!0,initialize(){async function e(e){await Wl.waitUntil("controlBoxInitialized"),Ya.chatboxes.get("controlbox").set({"active-form":e})}Ya.CONNECTION_STATUS[Vx.Status.REGIFAIL]="REGIFAIL",Ya.CONNECTION_STATUS[Vx.Status.REGISTERED]="REGISTERED",Ya.CONNECTION_STATUS[Vx.Status.CONFLICT]="CONFLICT",Ya.CONNECTION_STATUS[Vx.Status.NOTACCEPTABLE]="NOTACCEPTABLE",Wl.settings.extend({allow_registration:!0,domain_placeholder:Dg(" e.g. conversejs.org"),providers_link:"https://compliance.conversations.im/",registration_domain:""}),Ya.router.route("converse/login",(()=>e("login"))),Ya.router.route("converse/register",(()=>e("register"))),Wl.listen.on("controlBoxInitialized",(e=>{e.model.on("change:active-form",e.showLoginOrRegisterForm,e)}))}});const{Strophe:Qx}=Jl.env,Zx=fa.extend({defaults:function(){return{muc_domain:Wl.settings.get("muc_domain"),nick:Ya.getDefaultMUCNickname(),"toggle-state":Ya.OPENED}},setDomain(e){Wl.settings.get("locked_muc_domain")||this.save("muc_domain",Qx.getDomainFromJid(e))}}),Yx=Jl.env.utils,{Strophe:Xx}=Jl.env,Kx=mp.extend({persistent:!0,id:"add-chatroom-modal",events:{"submit form.add-chatroom":"openChatRoom","keyup .roomjid-input":"checkRoomidPolicy","change .roomjid-input":"checkRoomidPolicy"},initialize(){mp.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:muc_domain",this.render),this.muc_roomid_policy_error_msg=null},toHTML(){let e="";if(!Wl.settings.get("locked_muc_domain")){const t=this.model.get("muc_domain")||Wl.settings.get("muc_domain");e=t?`name@${t}`:Dg("name@conference.example.org")}return(e=>{const t=Dg("Join"),n=Dg("Enter a new Groupchat");return xl`
<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>
${gp}
</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?xl`<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}"/>
</div>
${e.muc_roomid_policy_hint?xl`<div class="form-group">${r_(qo().sanitize(e.muc_roomid_policy_hint,{ALLOWED_TAGS:["b","br","em"]}))}</div>`:""}
${Wl.settings.get("locked_muc_nickname")?"":(e=>{const t=Dg("Nickname"),n=Dg("This field is required");return xl`
<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:Ya,label_room_address:Wl.settings.get("muc_domain")?Dg("Groupchat name"):Dg("Groupchat address"),chatroom_placeholder:e,muc_roomid_policy_error_msg:this.muc_roomid_policy_error_msg,muc_roomid_policy_hint:Wl.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 i;if(Wl.settings.get("locked_muc_nickname")){if(i=Ya.getDefaultMUCNickname(),!i)throw new Error("Using locked_muc_nickname but no nickname found!")}else i=t.get("nickname").trim();return{jid:n,nick:i}},openChatRoom(e){e.preventDefault();const t=this.parseRoomDataFromEvent(e.target);let n;""===t.nick&&(t.nick=void 0),Wl.settings.get("locked_muc_domain")||Wl.settings.get("muc_domain")&&!Yx.isValidJID(t.jid)?n=`${Xx.escapeNode(t.jid)}@${Wl.settings.get("muc_domain")}`:(n=t.jid,this.model.setDomain(n)),Wl.rooms.open(n,Object.assign(t,{jid:n}),!0),this.modal.hide(),e.target.reset()},checkRoomidPolicy(){if(Wl.settings.get("muc_roomid_policy")&&Wl.settings.get("muc_domain")){let e=this.el.querySelector(".roomjid-input").value;!Wl.settings.get("locked_muc_domain")&&Yx.isValidJID(e)||(e=`${Xx.escapeNode(e)}@${Wl.settings.get("muc_domain")}`);const t=Xx.getNodeFromJid(e),n=Xx.getDomainFromJid(e);Wl.settings.get("muc_domain")!==n||Wl.settings.get("muc_roomid_policy").test(t)?this.muc_roomid_policy_error_msg=null:this.muc_roomid_policy_error_msg=Dg("Groupchat id is invalid."),this.render()}}}),eE=function(e){return e&&e.length?e[0]:void 0},{Strophe:tE,$iq:nE,sizzle:iE}=Jl.env,sE=Jl.env.utils;const rE=mp.extend({id:"muc-list-modal",persistent:!0,initialize(){this.items=[],this.loading_items=!1,mp.prototype.initialize.apply(this,arguments),Wl.settings.get("muc_domain")&&!this.model.get("muc_domain")&&this.model.save("muc_domain",Wl.settings.get("muc_domain")),this.listenTo(this.model,"change:muc_domain",this.onDomainChange),this.el.addEventListener("shown.bs.modal",(()=>Wl.settings.get("locked_muc_domain")?this.updateRoomsList():this.el.querySelector('input[name="server"]').focus()))},toHTML(){const e=this.model.get("muc_domain")||Wl.settings.get("muc_domain");return(e=>{const t=Dg("Query for Groupchats");return xl`
<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>
${gp}
</div>
<div class="modal-body d-flex flex-column">
<span class="modal-alert"></span>
${e.show_form?(e=>{const t=Dg("Show groupchats"),n=Dg("Server address");return xl`
<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?xl`<li class="list-group-item"> ${Vy()} </li>`:""}
${e.feedback_text?xl`<li class="list-group-item active">${e.feedback_text}</li>`:""}
${qp(e.items,(e=>e.jid),(t=>((e,t)=>{const n=Dg("Show more information on this groupchat"),i=Dg("Click to open this groupchat");return xl`
<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="${i}"
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">${fp}</div>
</div>
</div>
`})(Object.assign(this.model.toJSON(),{show_form:!Wl.settings.get("locked_muc_domain"),server_placeholder:e||Dg("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(),Wl.rooms.open(t,{name:n},!0)},toggleRoomInfo(e){e.preventDefault(),function(e){const t=sE.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(sE.slideIn(n).then(sE.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",sE.getElementFromTemplateResult(Vy())),Wl.disco.info(e.target.getAttribute("data-room-jid"),null).then((e=>function(e,t){var n,i;e.querySelector("span.spinner").remove(),e.querySelector("a.room-info").classList.add("selected"),e.insertAdjacentHTML("beforeEnd",sE.getElementFromTemplateResult((e=>{const t=Dg("Description:"),n=Dg("Groupchat XMPP Address:"),i=Dg("Participants:"),s=Dg("Features:"),r=Dg("Requires authentication"),o=Dg("Hidden"),a=Dg("Requires an invitation"),c=Dg("Moderated"),l=Dg("Non-anonymous"),d=Dg("Open"),u=Dg("Permanent"),h=Dg("Public"),m=Dg("Semi-anonymous"),f=Dg("Temporary"),g=Dg("Unmoderated");return xl`
<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>${i}</strong> ${e.occ}</p>
<p class="room-info"><strong>${s}</strong>
<ul>
${e.passwordprotected?xl`<li class="room-info locked">${r}</li>`:""}
${e.hidden?xl`<li class="room-info">${o}</li>`:""}
${e.membersonly?xl`<li class="room-info">${a}</li>`:""}
${e.moderated?xl`<li class="room-info">${c}</li>`:""}
${e.nonanonymous?xl`<li class="room-info">${l}</li>`:""}
${e.open?xl`<li class="room-info">${d}</li>`:""}
${e.persistent?xl`<li class="room-info">${u}</li>`:""}
${e.publicroom?xl`<li class="room-info">${h}</li>`:""}
${e.semianonymous?xl`<li class="room-info">${m}</li>`:""}
${e.temporary?xl`<li class="room-info">${f}</li>`:""}
${e.unmoderated?xl`<li class="room-info">${g}</li>`:""}
</ul>
</p>
</div>
`})({jid:t.getAttribute("from"),desc:null===(n=eE(iE('field[var="muc#roominfo_description"] value',t)))||void 0===n?void 0:n.textContent,occ:null===(i=eE(iE('field[var="muc#roominfo_occupants"] value',t)))||void 0===i?void 0:i.textContent,hidden:iE('feature[var="muc_hidden"]',t).length,membersonly:iE('feature[var="muc_membersonly"]',t).length,moderated:iE('feature[var="muc_moderated"]',t).length,nonanonymous:iE('feature[var="muc_nonanonymous"]',t).length,open:iE('feature[var="muc_open"]',t).length,passwordprotected:iE('feature[var="muc_passwordprotected"]',t).length,persistent:iE('feature[var="muc_persistent"]',t).length,publicroom:iE('feature[var="muc_publicroom"]',t).length,semianonymous:iE('feature[var="muc_semianonymous"]',t).length,temporary:iE('feature[var="muc_temporary"]',t).length,unmoderated:iE('feature[var="muc_unmoderated"]',t).length})))}(t,e))).catch((e=>R.error(e))))}(e)},onDomainChange(){Wl.settings.get("auto_list_rooms")&&this.updateRoomsList()},onRoomsFound(e){this.loading_items=!1;const t=e?iE("query item",e):[];return t.length?(this.model.set({feedback_text:Dg("Groupchats found")},{silent:!0}),this.items=t.map(Id)):(this.items=[],this.model.set({feedback_text:Dg("No groupchats found")},{silent:!0})),this.render(),!0},updateRoomsList(){const e=nE({to:this.model.get("muc_domain"),from:Ya.connection.jid,type:"get"}).c("query",{xmlns:tE.NS.DISCO_ITEMS});Wl.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:oE,u:aE}=Jl.env;function cE(){if(!Wl.settings.get("auto_insert"))return;const e=Wl.settings.get("root");if(!e.querySelector("converse-root")){const t=document.createElement("converse-root"),n=e.querySelector("body");n?n.appendChild(t):e.appendChild(t)}}Wl.elements.define("converse-rooms-list",class extends zg{initialize(){const e=`converse.roomspanel${Ya.bare_jid}`;this.model=new Zx({id:e}),Oo(this.model,e),this.model.fetch(),this.listenTo(Ya.chatboxes,"add",this.renderIfChatRoom),this.listenTo(Ya.chatboxes,"remove",this.renderIfChatRoom),this.listenTo(Ya.chatboxes,"destroy",this.renderIfChatRoom),this.listenTo(Ya.chatboxes,"change",this.renderIfRelevantChange),this.requestUpdate()}renderIfChatRoom(e){aE.isChatRoom(e)&&this.requestUpdate()}renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general","has_activity"],n=e.changed||{};aE.isChatRoom(e)&&Object.keys(n).filter((e=>t.includes(e))).length&&this.requestUpdate()}render(){return(e=>{const t=Dg("Click to toggle the list of open groupchats"),n=Dg("Groupchats"),i=Dg("Query for groupchats"),s=Dg("Add a new groupchat");return xl`
<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=>Wl.modal.show(rE,{model:e.model},t)}
title="${i}" data-toggle="modal" data-target="#muc-list-modal">
<converse-icon class="fa fa-list-ul right" path-prefix="/dist" size="1em"></converse-icon>
</a>
<a class="controlbox-heading__btn show-add-muc-modal"
@click=${t=>Wl.modal.show(Kx,{model:e.model},t)}
title="${s}" data-toggle="modal" data-target="#add-chatrooms-modal">
<converse-icon class="fa fa-plus right" path-prefix="/dist" size="1em"></converse-icon>
</a>
</div>
<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===Ya.OPENED?"fa-caret-down":"fa-caret-right"}"></span> ${Dg("Open Groupchats")}</a>
<div class="items-list rooms-list open-rooms-list ${e.collapsed&&"collapsed"}">
${e.rooms.map((t=>(e=>{const t=Dg("Leave this groupchat"),n=e.room.get("num_unread_general")||e.room.get("has_activity");return xl`
<div class="list-item controlbox-padded available-chatroom d-flex flex-row ${e.currently_open(e.room)?"open":""} ${n?"unread-msgs":""}"
data-room-jid="${e.room.get("jid")}">
${e.room.get("num_unread")?(e=>xl`<span class="list-item-badge badge badge--muc msgs-indicator">${e.room.get("num_unread")}</span>`)(e):e.room.get("has_activity")?xl`<span class="list-item-badge badge badge--muc msgs-indicator"></span>`:""}
<a class="list-item-link open-room available-room w-100"
data-room-jid="${e.room.get("jid")}"
title="${Dg("Click to open this groupchat")}"
@click=${e.openRoom}>${e.room.getDisplayName()}</a>
${Wl.settings.get("allow_bookmarks")?(e=>{const t=Dg("Bookmark this groupchat"),n=Dg("Unbookmark this groupchat");return e.bookmarked?xl`
<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}
title="${e.bookmarked?n:t}"></a>`:xl`
<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"
data-room-jid="${e.room.get("jid")}"
title="${Dg("Show more information on this groupchat")}"
@click=${e.showRoomDetailsModal}></a>
<a class="list-item-action fa fa-sign-out-alt close-room"
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))))}
</div>
</div>`})({addBookmark:e=>this.addBookmark(e),allow_bookmarks:Wl.settings.get("allow_bookmarks")&&Ya.bookmarks,closeRoom:e=>this.closeRoom(e),collapsed:this.model.get("toggle-state")!==Ya.OPENED,currently_open:e=>$a()&&!e.get("hidden"),model:this.model,openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),rooms:Ya.chatboxes.filter((e=>e.get("type")===Ya.CHATROOMS_TYPE)),showRoomDetailsModal:e=>this.showRoomDetailsModal(e),toggleRoomsList:e=>this.toggleRoomsList(e),toggle_state:this.model.get("toggle-state")})}showRoomDetailsModal(e){const t=e.target.getAttribute("data-room-jid"),n=Ya.chatboxes.get(t);e.preventDefault(),Wl.modal.show(Bw,{model:n},e)}async openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),i={name:t||oE.unescapeNode(oE.getNodeFromJid(n))||n};await Wl.rooms.open(n,i,!0)}async closeRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-name");if(confirm(Dg("Are you sure you want to leave the groupchat %1$s?",t))){const t=e.target.getAttribute("data-room-jid");(await Wl.rooms.get(t)).close()}}removeBookmark(e){Ya.removeBookmarkViaEvent(e)}addBookmark(e){Ya.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")?aE.slideIn(this.querySelector(".open-rooms-list")).then((()=>{this.model.save({"toggle-state":Ya.CLOSED}),n.classList.remove("fa-caret-down"),n.classList.add("fa-caret-right")})):aE.slideOut(this.querySelector(".open-rooms-list")).then((()=>{this.model.save({"toggle-state":Ya.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(){Wl.listen.on("connected",(async()=>{Wl.settings.get("allow_bookmarks")?await Wl.waitUntil("bookmarksInitialized"):await Promise.all([Wl.waitUntil("chatBoxesFetched")])}))}}),window.customElements.define("converse-fontawesome",class extends zg{render(){return xl`
<?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>
<symbol id="icon-refresh" viewBox="0 0 512 512">
<path d="M464 16c-17.67 0-32 14.31-32 32v74.09C392.1 66.52 327.4 32 256 32C161.5 32 78.59 92.34 49.58 182.2c-5.438 16.81 3.797 34.88 20.61 40.28c16.89 5.5 34.88-3.812 40.3-20.59C130.9 138.5 189.4 96 256 96c50.5 0 96.26 24.55 124.4 64H336c-17.67 0-32 14.31-32 32s14.33 32 32 32h128c17.67 0 32-14.31 32-32V48C496 30.31 481.7 16 464 16zM441.8 289.6c-16.92-5.438-34.88 3.812-40.3 20.59C381.1 373.5 322.6 416 256 416c-50.5 0-96.25-24.55-124.4-64H176c17.67 0 32-14.31 32-32s-14.33-32-32-32h-128c-17.67 0-32 14.31-32 32v144c0 17.69 14.33 32 32 32s32-14.31 32-32v-74.09C119.9 445.5 184.6 480 255.1 480c94.45 0 177.4-60.34 206.4-150.2C467.9 313 458.6 294.1 441.8 289.6z"></path>
</symbol>
</svg>
`}});var lE=n(1513),dE={};dE.styleTagTransform=Yg(),dE.setAttributes=Vg(),dE.insert=Gg().bind(null,"head"),dE.domAPI=qg(),dE.insertStyleElement=Qg(),Ug()(lE.Z,dE),lE.Z&&lE.Z.locals&&lE.Z.locals;class uE extends zg{render(){return(()=>{const e=Wl.settings.get("singleton")?["converse-singleton"]:[];return e.push(`converse-${Wl.settings.get("view_mode")}`),xl`
<converse-chats class="converse-chatboxes row no-gutters ${e.join(" ")}"></converse-chats>
<div id="converse-modals" class="modals"></div>
<converse-fontawesome></converse-fontawesome>
`})()}initialize(){this.setAttribute("id","conversejs"),this.setClasses();const e=Va();this.listenTo(e,"change:view_mode",(()=>this.setClasses())),this.listenTo(e,"change:singleton",(()=>this.setClasses())),window.matchMedia("(prefers-color-scheme: dark)").addListener((()=>this.setClasses())),window.matchMedia("(prefers-color-scheme: light)").addListener((()=>this.setClasses()))}setClasses(){this.className="",this.classList.add("conversejs"),this.classList.add(`converse-${Wl.settings.get("view_mode")}`),this.classList.add(`theme-${window.matchMedia("(prefers-color-scheme: dark)").matches?Wl.settings.get("dark_theme"):Wl.settings.get("theme")}`),this.requestUpdate()}}Jl.plugins.add("converse-rootview",{initialize(){Wl.settings.extend({auto_insert:!0,theme:"classic",dark_theme:"dracula"}),Wl.listen.on("chatBoxesInitialized",cE),Wl.elements.define("converse-root",uE)}});const{Strophe:hE}=Jl.env,mE=Jl.env.utils,fE=mp.extend({id:"add-contact-modal",events:{"submit form":"addContactFromForm"},initialize(){mp.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){const e=Wl.settings.get("xhr_user_search_url")?Dg("Contact name"):Dg("Optional nickname");return(e=>{const t=Dg("name@example.org"),n=Dg("Add"),i=Dg("Please enter a valid XMPP address"),s=Dg("Add a Contact"),r=Dg("XMPP Address"),o=Dg("Nickname");return xl`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addContactModalLabel">${s}</h5>
${gp}
</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">
<label class="clearfix" for="jid">${r}:</label>
<div class="suggestion-box suggestion-box__jid">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<input type="text" name="jid" ?required=${!Wl.settings.get("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">
<div class="invalid-feedback">${i}</div>
</div>
<button type="submit" class="btn btn-primary">${n}</button>
</div>
</form>
</div>
</div>
`})(Object.assign(this.model.toJSON(),{_converse:Ya,label_nickname:e}))},afterRender(){"string"==typeof Wl.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(!Wl.settings.get("autocomplete_add_contact"))return;const e=this.el.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new Ya.AutoComplete(e,{data:(e,t)=>`${t.slice(0,t.indexOf("@"))}@${e}`,filter:Ya.FILTER_STARTSWITH,list:[...new Set(Ya.roster.map((e=>hE.getDomainFromJid(e.get("jid")))))]})},initXHRAutoComplete(){if(!Wl.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.el.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new Ya.AutoComplete(e,{auto_evaluate:!1,filter:Ya.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",va((()=>{t.open("GET",`${Wl.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=Dg("Sorry, could not find a contact with that name"),void mE.addClass("d-block",e)}const n=t[0].value;if(this.validateSubmission(n)){const e=this.el.querySelector("form"),i=t[0].label;this.afterSubmission(e,n,i)}}}},validateSubmission(e){const t=this.el.querySelector(".invalid-feedback");return!e||Ho(e.split("@")).length<2?(mE.addClass("is-invalid",this.el.querySelector('input[name="jid"]')),mE.addClass("d-block",t),!1):Ya.roster.get(hE.getBareJidFromJid(e))?(t.textContent=Dg("This contact has already been added"),mE.addClass("d-block",t),!1):(mE.removeClass("d-block",t),!0)},afterSubmission(e,t,n){Ya.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 Wl.settings.get("xhr_user_search_url")){const e=this.el.querySelector('input[name="name"]');return this.xhr.open("GET",`${Wl.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 gE(e){var t,n;null===(t=Ya.roster)||void 0===t||null===(n=t.findWhere({jid:e.get("jid")}))||void 0===n||n.trigger("highlight")}function pE(e,t){const n=Ya.roster_filter,i=n.get("filter_type"),s="state"===i?n.get("chat_state").toLowerCase():n.get("filter_text").toLowerCase();return!!s&&("state"===i?![Ya.HEADER_REQUESTING_CONTACTS,Ya.HEADER_UNREAD].includes(t)&&("unread_messages"===s?0===e.get("num_unread"):"online"===s?["offline","unavailable"].includes(e.presence.get("show")):!e.presence.get("show").includes(s)):"contacts"===i?!e.getFilterCriteria().includes(s):void 0)}function vE(e){const t=Ya.roster_filter;if("groups"===t.get("filter_type")){var n;const i=null===(n=t.get("filter_text"))||void 0===n?void 0:n.toLowerCase();if(!i)return!0;if(!e.toLowerCase().includes(i))return!1}return!0}Ya.AddContactModal=fE;const{u:yE}=Jl.env;function _E(e){const t=e.get("jid"),n=[];if($a()){const e=Ya.chatboxes.get(t);e&&!e.get("hidden")&&n.push("open")}const i=e.get("ask"),s=e.get("requesting"),r=e.get("subscription");return"subscribe"===i||"from"===r?n.push("pending-xmpp-contact"):!0===s?n.push("requesting-xmpp-contact"):("both"===r||"to"===r||yE.isSameBareJID(t,Ya.connection.jid))&&(n.push("current-xmpp-contact"),n.push(r),n.push(e.presence.get("show"))),xl`
<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 bE=e=>{const t=Dg("Contacts"),n=Dg("Add a contact"),i=Dg("Re-sync your contacts"),s=(Ya.roster||[]).reduce(((e,t)=>function(e,t){if("subscribe"===t.get("ask")){const n=Ya.HEADER_PENDING_CONTACTS;e[n]?e[n].push(t):e[n]=[t]}else if(t.get("requesting")){const n=Ya.HEADER_REQUESTING_CONTACTS;e[n]?e[n].push(t):e[n]=[t]}else{let n;Wl.settings.get("roster_groups")?(n=t.get("groups"),n=0===n.length?[Ya.HEADER_UNGROUPED]:n):n=[Ya.HEADER_CURRENT_CONTACTS];for(const i of n)e[i]?e[i].push(t):e[i]=[t]}if(t.get("num_unread")){const n=Ya.HEADER_UNREAD;e[n]?e[n].push(t):e[n]=[t]}return e}(e,t)),{}),r=Object.keys(s).filter(vE);return r.sort(Of),xl`
<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="${i}">
<converse-icon class="fa fa-sync right ${e.syncing_contacts?"fa-spin":""}" size="1em"></converse-icon>
</a>
${Wl.settings.get("allow_contact_requests")?xl`
<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" size="1.25em"></converse-icon>
</a>`:""}
</div>
<converse-roster-filter></converse-roster-filter>
<div class="list-container roster-contacts">
${qp(r,(e=>e),(e=>{const t=s[e].filter((t=>function(e,t){const n=e.presence.get("show");return Wl.settings.get("hide_offline_users")&&"offline"===n?("subscribe"===e.get("ask")||"from"===e.get("subscription")||!0===e.get("requesting"))&&!pE(e,t):!pE(e,t)}(t,e)));return t.sort(Nf),t.length?(e=>{const t=Dg("Click to hide these contacts"),n=Ya.roster.state.get("collapsed_groups");return xl`
<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 i=Ya.roster.state.get("collapsed_groups");i.includes(t)?Ya.roster.state.save("collapsed_groups",i.filter((e=>e!==t))):Ya.roster.state.save("collapsed_groups",[...i,t])}(t,e.name)}>
<converse-icon color="var(--chat-head-color-dark)" 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(_E)}
</ul>
</div>`})({contacts:t,name:e}):""}))}
</div>
`};Wl.elements.define("converse-roster",class extends zg{async initialize(){await Wl.waitUntil("rosterInitialized"),this.listenTo(Ya,"rosterContactsFetched",this.requestUpdate),this.listenTo(Ya.presences,"change:show",this.requestUpdate),this.listenTo(Ya.roster,"add",this.requestUpdate),this.listenTo(Ya.roster,"destroy",this.requestUpdate),this.listenTo(Ya.roster,"remove",this.requestUpdate),this.listenTo(Ya.roster,"change",this.requestUpdate),this.listenTo(Ya.roster.state,"change",this.requestUpdate),Wl.trigger("rosterViewInitialized")}firstUpdated(){this.listenToRosterFilter()}render(){return bE(this)}listenToRosterFilter(){this.filter_view=this.querySelector("converse-roster-filter"),this.filter_view.addEventListener("update",(()=>this.requestUpdate()))}showAddContactModal(e){Wl.modal.show(Ya.AddContactModal,{model:new fa},e)}async syncContacts(e){e.preventDefault(),this.syncing_contacts=!0,this.requestUpdate(),Ya.roster.data.save("version",null),await Ya.roster.fetchFromServer(),Wl.user.presence.send(),this.syncing_contacts=!1,this.requestUpdate()}});const wE=e=>xl`<span class="pending-contact-name" title="JID: ${e.jid}">${e.display_name}</span>`,SE=e=>xl`<span class="req-contact-name w-100" title="JID: ${e.jid}">${e.display_name}</span>`,xE={dnd:Dg("This contact is busy"),online:Dg("This contact is online"),offline:Dg("This contact is offline"),unavailable:Dg("This contact is unavailable"),xa:Dg("This contact is away for an extended period"),away:Dg("This contact is away")},EE=Jl.env.utils;class AE extends zg{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"),i=this.model.get("jid");if("subscribe"===e||"from"===n){const e=this.model.getDisplayName();return(e=>{const t=Dg("Click to remove %1$s as a contact",e.display_name);return xl`
${Wl.settings.get("allow_chat_pending_contacts")?xl`<a class="list-item-link open-chat w-100" href="#" @click=${e.openChat}>${wE(e)}</a>`:wE(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=>xl`
${Wl.settings.get("allow_chat_pending_contacts")?xl`<a class="open-chat w-100" href="#" @click=${e.openChat}>${SE(e)}</a>`:SE(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:Dg("Click to accept the contact request from %1$s",e),desc_decline:Dg("Click to decline the contact request from %1$s",e),allow_chat_pending_contacts:Wl.settings.get("allow_chat_pending_contacts")}))}if("both"===n||"to"===n||EE.isSameBareJID(i,Ya.connection.jid))return this.renderRosterItem(this.model)}renderRosterItem(e){return((e,t)=>{var n,i;const s=t.presence.get("show")||"offline";let r,o;[r,o]="online"===s?["fa fa-circle","chat-status-online"]:"dnd"===s?["fa fa-minus-circle","chat-status-busy"]:"away"===s?["fa fa-circle","chat-status-away"]:["fa fa-circle","subdued-color"];const a=xE[s],c=t.get("num_unread")||0,l=t.getDisplayName(),d=Dg("Click to chat with %1$s (XMPP address: %2$s)",l,e.model.get("jid"));return xl`
<a class="list-item-link cbox-list-item open-chat ${c?"unread-msgs":""}" title="${d}" href="#" @click=${e.openChat}>
<span>
<converse-avatar
class="avatar"
.data=${null===(n=e.model.vcard)||void 0===n?void 0:n.attributes}
nonce=${null===(i=e.model.vcard)||void 0===i?void 0:i.get("vcard_updated")}
height="30" width="30"></converse-avatar>
<converse-icon
title="${a}"
color="var(--${o})"
size="1em"
class="${r} chat-status chat-status--avatar"></converse-icon>
</span>
${c?xl`<span class="msgs-indicator">${c}</span>`:""}
<span class="contact-name contact-name--${e.show} ${c?"unread-msgs":""}">${l}</span>
</a>
${Wl.settings.get("allow_contact_removal")?((e,t)=>{const n=t.getDisplayName(),i=Dg("Click to remove %1$s as a contact",n);return xl`
<a class="list-item-action remove-xmpp-contact" @click=${e.removeContact} title="${i}" href="#">
<converse-icon class="fa fa-trash-alt" size="1.5em"></converse-icon>
</a>
`})(e,t):""}`})(this,e)}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),Wl.settings.get("allow_contact_removal")&&confirm(Dg("Are you sure you want to remove this contact?")))try{this.model.removeFromRoster(),this.model.collection&&this.model.destroy()}catch(e){R.error(e),Wl.alert("error",Dg("Error"),[Dg("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 Ya.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()}declineRequest(e){return e&&e.preventDefault&&e.preventDefault(),!0===confirm(Dg("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}}Wl.elements.define("converse-roster-contact",AE);const CE=fa.extend({initialize(){this.set({filter_text:"",filter_type:"contacts",chat_state:"online"})}});class TE extends zg{initialize(){const e=new Ya.RosterFilter;e.id=`_converse.rosterfilter-${Ya.bare_jid}`,Oo(e,e.id),this.model=e,Ya.roster_filter=e,this.liveFilter=va((()=>{this.model.save({filter_text:this.querySelector(".roster-filter").value})}),250),this.listenTo(Ya,"rosterContactsFetched",this.requestUpdate),this.listenTo(Ya.presences,"change:show",this.requestUpdate),this.listenTo(Ya.roster,"add",this.requestUpdate),this.listenTo(Ya.roster,"destroy",this.requestUpdate),this.listenTo(Ya.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=Dg("Filter"),n=Dg("Filter by contact name"),i=Dg("Filter by group name"),s=Dg("Filter by status"),r=Dg("Any"),o=Dg("Unread"),a=Dg("Online"),c=Dg("Chatty"),l=Dg("Busy"),d=Dg("Away"),u=Dg("Extended Away"),h=Dg("Offline");return xl`
<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">
<converse-icon size="1em" @click=${e.changeTypeFilter} class="fa fa-user clickable ${"contacts"===e.filter_type?"selected":""}" data-type="contacts" title="${n}"></converse-icon>
<converse-icon size="1em" @click=${e.changeTypeFilter} class="fa fa-users clickable ${"groups"===e.filter_type?"selected":""}" data-type="groups" title="${i}"></converse-icon>
<converse-icon size="1em" @click=${e.changeTypeFilter} class="fa fa-circle clickable ${"state"===e.filter_type?"selected":""}" data-type="state" title="${s}"></converse-icon>
</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}"/>
<converse-icon size="1em" class="fa fa-times clear-input ${e.filter_text&&"state"!==e.filter_type?"":"hidden"}"
@click=${e.clearFilter}>
</converse-icon>
</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){var t;e&&e.preventDefault();const n=(null===(t=Bv(e.target,"converse-icon"))||void 0===t?void 0:t.dataset.type)||"contacts";"state"===n?this.model.save({filter_type:n,chat_state:this.querySelector(".state-type").value}):this.model.save({filter_type:n,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=Ya.roster)||void 0===e?void 0:e.length)>=5||this.isActive()}clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}Wl.elements.define("converse-roster-filter",TE);var kE=n(1984),jE={};jE.styleTagTransform=Yg(),jE.setAttributes=Vg(),jE.insert=Gg().bind(null,"head"),jE.domAPI=qg(),jE.insertStyleElement=Qg(),Ug()(kE.Z,jE),kE.Z&&kE.Z.locals&&kE.Z.locals,Jl.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Wl.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}),Wl.promises.add("rosterViewInitialized"),Ya.RosterFilter=CE,Ya.RosterFilterView=TE,Ya.RosterContactView=AE,Wl.listen.on("chatBoxesInitialized",(()=>{Ya.chatboxes.on("destroy",(e=>gE(e))),Ya.chatboxes.on("change:hidden",(e=>gE(e)))})),Wl.listen.on("afterTearDown",(()=>{var e;return null===(e=Ya.rotergroups)||void 0===e?void 0:e.off().reset()}))}}),Ya.CustomElement=zg;const $E=Jl.initialize;Jl.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(Pg):e.whitelisted_plugins=Pg,$E(e,t)};const NE=Jl},5251:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6931:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},352:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7802:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5599:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1875:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8041:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5956:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9679:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4915:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1638:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},3076:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5655:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7140:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},3288:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},902:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6233:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1513:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1984:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1833:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4921:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5222:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8054:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8125:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4166:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6278:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9523:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6176:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5046:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7631:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4903:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6450:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},307:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9537:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9959:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(8531),s=n.n(i),r=n(7180),o=n.n(r)()(s());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9434:(e,t,n)=>{var i={"./af.js":[4862,9210],"./am.js":[2469,5073],"./ar-dz.js":[7966,9406],"./ar-kw.js":[1781,9897],"./ar-ly.js":[7909,3521],"./ar-ma.js":[1917,5313],"./ar-sa.js":[140,485],"./ar-tn.js":[22,8040],"./ar.js":[5992,6755],"./az.js":[145,4963],"./be.js":[9811,9478],"./bg.js":[3604,578],"./bi.js":[1434,2984],"./bm.js":[6694,2263],"./bn.js":[6209,280],"./bo.js":[750,9950],"./br.js":[2766,760],"./bs.js":[3827,9833],"./ca.js":[2914,102],"./cs.js":[9280,7400],"./cv.js":[1093,4481],"./cy.js":[8132,6740],"./da.js":[2817,2548],"./de-at.js":[7197,7175],"./de-ch.js":[5151,1679],"./de.js":[7360,52],"./dv.js":[6164,5569],"./el.js":[8916,1606],"./en-au.js":[8989,5485],"./en-ca.js":[9451,4035],"./en-gb.js":[8876,6031],"./en-ie.js":[1690,8129],"./en-il.js":[5022,3463],"./en-in.js":[5917,6898],"./en-nz.js":[2156,8547],"./en-sg.js":[9405,1735],"./en-tt.js":[1811,6105],"./en.js":[7774,535],"./eo.js":[9541,5121],"./es-do.js":[1156,8758],"./es-pr.js":[7483,911],"./es-us.js":[4664,3208],"./es.js":[9130,3411],"./et.js":[4533,4153],"./eu.js":[4713,1396],"./fa.js":[5087,5544],"./fi.js":[1302,2130],"./fo.js":[1036,8745],"./fr-ca.js":[2104,7363],"./fr-ch.js":[7378,7952],"./fr.js":[3981,1910],"./fy.js":[6372,6376],"./ga.js":[9517,688],"./gd.js":[5808,5050],"./gl.js":[9219,5818],"./gom-latn.js":[3683,825],"./gu.js":[9299,3623],"./he.js":[6626,9372],"./hi.js":[4215,8010],"./hr.js":[9320,7419],"./ht.js":[7608,5822],"./hu.js":[3461,8214],"./hy-am.js":[2045,5407],"./id.js":[8516,9513],"./is.js":[9099,1194],"./it-ch.js":[5447,6010],"./it.js":[2869,1880],"./ja.js":[2754,1107],"./jv.js":[6615,4305],"./ka.js":[7830,5186],"./kk.js":[4723,5206],"./km.js":[4532,2475],"./kn.js":[1170,7523],"./ko.js":[3898,3446],"./ku.js":[7922,7024],"./ky.js":[8031,5055],"./lb.js":[3454,5215],"./lo.js":[9813,1204],"./lt.js":[8831,7899],"./lv.js":[7281,631],"./me.js":[3901,145],"./mi.js":[2626,7454],"./mk.js":[9025,4951],"./ml.js":[7145,7679],"./mn.js":[9778,8618],"./mr.js":[5587,5600],"./ms-my.js":[4208,882],"./ms.js":[1504,9095],"./mt.js":[8591,9665],"./my.js":[5839,5166],"./nb.js":[98,646],"./ne.js":[3553,9030],"./nl-be.js":[4757,3155],"./nl.js":[587,1520],"./nn.js":[9192,7050],"./oc-lnc.js":[6247,7203],"./pa-in.js":[2561,5850],"./pl.js":[545,1211],"./pt-br.js":[9326,5274],"./pt.js":[7216,265],"./ro.js":[3041,8022],"./ru.js":[7068,559],"./rw.js":[2574,3221],"./sd.js":[1160,1298],"./se.js":[7344,1942],"./si.js":[5791,9333],"./sk.js":[3727,6783],"./sl.js":[330,9625],"./sq.js":[2749,8603],"./sr-cyrl.js":[487,3435],"./sr.js":[5883,7390],"./ss.js":[2868,9238],"./sv-fi.js":[5520,9997],"./sv.js":[3403,9652],"./sw.js":[2950,9733],"./ta.js":[7265,7645],"./te.js":[4342,7714],"./tet.js":[3849,555],"./tg.js":[4727,2446],"./th.js":[8114,1729],"./tk.js":[7139,5256],"./tl-ph.js":[9307,9443],"./tlh.js":[769,2814],"./tr.js":[5538,8665],"./tzl.js":[5857,2843],"./tzm-latn.js":[6170,3933],"./tzm.js":[1353,4342],"./ug-cn.js":[6028,6890],"./uk.js":[2248,1619],"./ur.js":[6814,9568],"./uz-latn.js":[6810,1110],"./uz.js":[9505,3153],"./vi.js":[4667,8073],"./x-pseudo.js":[3936,4423],"./yo.js":[51,8692],"./zh-cn.js":[7983,9630],"./zh-hk.js":[7839,3755],"./zh-tw.js":[9176,6776],"./zh.js":[3333,8458]};function s(e){if(!n.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],s=t[0];return n.e(t[1]).then((()=>n.t(s,23)))}s.keys=()=>Object.keys(i),s.id=9434,e.exports=s},3379:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var r={},o=[],a=0;a<e.length;a++){var c=e[a],l=i.base?c[0]+i.base:c[0],d=r[l]||0,u="".concat(l," ").concat(d);r[l]=d+1;var h=n(u),m={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(m);else{var f=s(m,i);i.byIndex=a,t.splice(a,0,{identifier:u,updater:f,references:1})}o.push(u)}return o}function s(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,s){var r=i(e=e||[],s=s||{});return function(e){e=e||[];for(var o=0;o<r.length;o++){var a=n(r[o]);t[a].references--}for(var c=i(e,s),l=0;l<r.length;l++){var d=n(r[l]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}r=c}}},569:e=>{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var s=void 0!==n.layer;s&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,s&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},6655:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},7521:(e,t,n)=>{var i={"./af/LC_MESSAGES/converse.po":[4534,5830],"./ar/LC_MESSAGES/converse.po":[4201,4469],"./bg/LC_MESSAGES/converse.po":[5384,2551],"./ca/LC_MESSAGES/converse.po":[122,1553],"./cs/LC_MESSAGES/converse.po":[3893,5301],"./da/LC_MESSAGES/converse.po":[7889,1163],"./de/LC_MESSAGES/converse.po":[1658,2895],"./el/LC_MESSAGES/converse.po":[7530,5524],"./eo/LC_MESSAGES/converse.po":[1758,2433],"./es/LC_MESSAGES/converse.po":[7790,8269],"./eu/LC_MESSAGES/converse.po":[9398,3103],"./fa/LC_MESSAGES/converse.po":[2897,321],"./fi/LC_MESSAGES/converse.po":[9583,7618],"./fr/LC_MESSAGES/converse.po":[5011,5129],"./gl/LC_MESSAGES/converse.po":[8816,777],"./he/LC_MESSAGES/converse.po":[6725,4363],"./hi/LC_MESSAGES/converse.po":[411,4468],"./hu/LC_MESSAGES/converse.po":[2825,6239],"./id/LC_MESSAGES/converse.po":[6042,6678],"./it/LC_MESSAGES/converse.po":[3741,3719],"./ja/LC_MESSAGES/converse.po":[6893,6249],"./lt/LC_MESSAGES/converse.po":[5176,513],"./mr/LC_MESSAGES/converse.po":[6292,1784],"./nb/LC_MESSAGES/converse.po":[8467,473],"./nl/LC_MESSAGES/converse.po":[8544,2473],"./nl_BE/LC_MESSAGES/converse.po":[8133,8131],"./oc/LC_MESSAGES/converse.po":[8857,5500],"./pl/LC_MESSAGES/converse.po":[1759,3606],"./pt/LC_MESSAGES/converse.po":[1132,6227],"./pt_BR/LC_MESSAGES/converse.po":[6380,1455],"./ro/LC_MESSAGES/converse.po":[9740,3539],"./ru/LC_MESSAGES/converse.po":[2276,7917],"./sv/LC_MESSAGES/converse.po":[1025,8859],"./th/LC_MESSAGES/converse.po":[4297,457],"./tr/LC_MESSAGES/converse.po":[2266,4195],"./uk/LC_MESSAGES/converse.po":[9642,7979],"./vi/LC_MESSAGES/converse.po":[1298,2110],"./zh_CN/LC_MESSAGES/converse.po":[9771,3325],"./zh_TW/LC_MESSAGES/converse.po":[4133,1458]};function s(e){if(!n.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],s=t[0];return n.e(t[1]).then((()=>n.t(s,19)))}s.keys=()=>Object.keys(i),s.id=7521,e.exports=s}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={id:e,loaded:!1,exports:{}};return s[e].call(n.exports,n,n.exports,o),n.loaded=!0,n.exports}o.m=s,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,i){if(1&i&&(n=this(n)),8&i)return n;if("object"==typeof n&&n){if(4&i&&n.__esModule)return n;if(16&i&&"function"==typeof n.then)return n}var s=Object.create(null);o.r(s);var r={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>r[e]=()=>n[e]));return r.default=()=>n,o.d(s,r),s},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>({52:"locales/dayjs/de-js",102:"locales/dayjs/ca-js",145:"locales/dayjs/me-js",265:"locales/dayjs/pt-js",280:"locales/dayjs/bn-js",321:"locales/fa-LC_MESSAGES-converse-po",457:"locales/th-LC_MESSAGES-converse-po",473:"locales/nb-LC_MESSAGES-converse-po",485:"locales/dayjs/ar-sa-js",513:"locales/lt-LC_MESSAGES-converse-po",535:"locales/dayjs/en-js",555:"locales/dayjs/tet-js",559:"locales/dayjs/ru-js",578:"locales/dayjs/bg-js",631:"locales/dayjs/lv-js",646:"locales/dayjs/nb-js",688:"locales/dayjs/ga-js",760:"locales/dayjs/br-js",777:"locales/gl-LC_MESSAGES-converse-po",825:"locales/dayjs/gom-latn-js",882:"locales/dayjs/ms-my-js",911:"locales/dayjs/es-pr-js",1107:"locales/dayjs/ja-js",1110:"locales/dayjs/uz-latn-js",1163:"locales/da-LC_MESSAGES-converse-po",1194:"locales/dayjs/is-js",1204:"locales/dayjs/lo-js",1211:"locales/dayjs/pl-js",1298:"locales/dayjs/sd-js",1396:"locales/dayjs/eu-js",1455:"locales/pt_BR-LC_MESSAGES-converse-po",1458:"locales/zh_TW-LC_MESSAGES-converse-po",1520:"locales/dayjs/nl-js",1553:"locales/ca-LC_MESSAGES-converse-po",1606:"locales/dayjs/el-js",1619:"locales/dayjs/uk-js",1679:"locales/dayjs/de-ch-js",1729:"locales/dayjs/th-js",1735:"locales/dayjs/en-sg-js",1784:"locales/mr-LC_MESSAGES-converse-po",1880:"locales/dayjs/it-js",1910:"locales/dayjs/fr-js",1942:"locales/dayjs/se-js",2110:"locales/vi-LC_MESSAGES-converse-po",2130:"locales/dayjs/fi-js",2263:"locales/dayjs/bm-js",2433:"locales/eo-LC_MESSAGES-converse-po",2446:"locales/dayjs/tg-js",2473:"locales/nl-LC_MESSAGES-converse-po",2475:"locales/dayjs/km-js",2548:"locales/dayjs/da-js",2551:"locales/bg-LC_MESSAGES-converse-po",2814:"locales/dayjs/tlh-js",2843:"locales/dayjs/tzl-js",2895:"locales/de-LC_MESSAGES-converse-po",2984:"locales/dayjs/bi-js",3103:"locales/eu-LC_MESSAGES-converse-po",3153:"locales/dayjs/uz-js",3155:"locales/dayjs/nl-be-js",3208:"locales/dayjs/es-us-js",3221:"locales/dayjs/rw-js",3325:"locales/zh_CN-LC_MESSAGES-converse-po",3411:"locales/dayjs/es-js",3435:"locales/dayjs/sr-cyrl-js",3446:"locales/dayjs/ko-js",3463:"locales/dayjs/en-il-js",3521:"locales/dayjs/ar-ly-js",3539:"locales/ro-LC_MESSAGES-converse-po",3606:"locales/pl-LC_MESSAGES-converse-po",3623:"locales/dayjs/gu-js",3719:"locales/it-LC_MESSAGES-converse-po",3755:"locales/dayjs/zh-hk-js",3933:"locales/dayjs/tzm-latn-js",4035:"locales/dayjs/en-ca-js",4153:"locales/dayjs/et-js",4195:"locales/tr-LC_MESSAGES-converse-po",4305:"locales/dayjs/jv-js",4342:"locales/dayjs/tzm-js",4363:"locales/he-LC_MESSAGES-converse-po",4423:"locales/dayjs/x-pseudo-js",4468:"locales/hi-LC_MESSAGES-converse-po",4469:"locales/ar-LC_MESSAGES-converse-po",4481:"locales/dayjs/cv-js",4610:"emojis",4951:"locales/dayjs/mk-js",4963:"locales/dayjs/az-js",5050:"locales/dayjs/gd-js",5055:"locales/dayjs/ky-js",5073:"locales/dayjs/am-js",5121:"locales/dayjs/eo-js",5129:"locales/fr-LC_MESSAGES-converse-po",5166:"locales/dayjs/my-js",5186:"locales/dayjs/ka-js",5206:"locales/dayjs/kk-js",5215:"locales/dayjs/lb-js",5256:"locales/dayjs/tk-js",5274:"locales/dayjs/pt-br-js",5301:"locales/cs-LC_MESSAGES-converse-po",5313:"locales/dayjs/ar-ma-js",5407:"locales/dayjs/hy-am-js",5485:"locales/dayjs/en-au-js",5500:"locales/oc-LC_MESSAGES-converse-po",5524:"locales/el-LC_MESSAGES-converse-po",5544:"locales/dayjs/fa-js",5569:"locales/dayjs/dv-js",5600:"locales/dayjs/mr-js",5818:"locales/dayjs/gl-js",5822:"locales/dayjs/ht-js",5830:"locales/af-LC_MESSAGES-converse-po",5850:"locales/dayjs/pa-in-js",6010:"locales/dayjs/it-ch-js",6031:"locales/dayjs/en-gb-js",6105:"locales/dayjs/en-tt-js",6227:"locales/pt-LC_MESSAGES-converse-po",6239:"locales/hu-LC_MESSAGES-converse-po",6249:"locales/ja-LC_MESSAGES-converse-po",6376:"locales/dayjs/fy-js",6678:"locales/id-LC_MESSAGES-converse-po",6740:"locales/dayjs/cy-js",6755:"locales/dayjs/ar-js",6776:"locales/dayjs/zh-tw-js",6783:"locales/dayjs/sk-js",6890:"locales/dayjs/ug-cn-js",6898:"locales/dayjs/en-in-js",7024:"locales/dayjs/ku-js",7050:"locales/dayjs/nn-js",7175:"locales/dayjs/de-at-js",7203:"locales/dayjs/oc-lnc-js",7363:"locales/dayjs/fr-ca-js",7390:"locales/dayjs/sr-js",7400:"locales/dayjs/cs-js",7419:"locales/dayjs/hr-js",7454:"locales/dayjs/mi-js",7523:"locales/dayjs/kn-js",7618:"locales/fi-LC_MESSAGES-converse-po",7645:"locales/dayjs/ta-js",7679:"locales/dayjs/ml-js",7714:"locales/dayjs/te-js",7899:"locales/dayjs/lt-js",7917:"locales/ru-LC_MESSAGES-converse-po",7952:"locales/dayjs/fr-ch-js",7979:"locales/uk-LC_MESSAGES-converse-po",8010:"locales/dayjs/hi-js",8022:"locales/dayjs/ro-js",8040:"locales/dayjs/ar-tn-js",8073:"locales/dayjs/vi-js",8129:"locales/dayjs/en-ie-js",8131:"locales/nl_BE-LC_MESSAGES-converse-po",8214:"locales/dayjs/hu-js",8269:"locales/es-LC_MESSAGES-converse-po",8458:"locales/dayjs/zh-js",8547:"locales/dayjs/en-nz-js",8603:"locales/dayjs/sq-js",8618:"locales/dayjs/mn-js",8665:"locales/dayjs/tr-js",8692:"locales/dayjs/yo-js",8745:"locales/dayjs/fo-js",8758:"locales/dayjs/es-do-js",8859:"locales/sv-LC_MESSAGES-converse-po",9030:"locales/dayjs/ne-js",9095:"locales/dayjs/ms-js",9210:"locales/dayjs/af-js",9238:"locales/dayjs/ss-js",9333:"locales/dayjs/si-js",9372:"locales/dayjs/he-js",9406:"locales/dayjs/ar-dz-js",9443:"locales/dayjs/tl-ph-js",9478:"locales/dayjs/be-js",9513:"locales/dayjs/id-js",9568:"locales/dayjs/ur-js",9625:"locales/dayjs/sl-js",9630:"locales/dayjs/zh-cn-js",9652:"locales/dayjs/sv-js",9665:"locales/dayjs/mt-js",9733:"locales/dayjs/sw-js",9833:"locales/dayjs/bs-js",9897:"locales/dayjs/ar-kw-js",9950:"locales/dayjs/bo-js",9997:"locales/dayjs/sv-fi-js"}[e]+".js"),o.miniCssF=e=>"../dist/converse.min.css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},i="converse.js:",o.l=(e,t,s,r)=>{if(n[e])n[e].push(t);else{var a,c;if(void 0!==s)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==i+s){a=u;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",i+s),a.src=e),n[e]=[t];var h=(t,i)=>{a.onerror=a.onload=null,clearTimeout(m);var s=n[e];if(delete n[e],a.parentNode&&a.parentNode.removeChild(a),s&&s.forEach((e=>e(i))),t)return t(i)},m=setTimeout(h.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=h.bind(null,a.onerror),a.onload=h.bind(null,a.onload),c&&document.head.appendChild(a)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o.p="/dist/",(()=>{var e={179:0};o.f.j=(t,n)=>{var i=o.o(e,t)?e[t]:void 0;if(0!==i)if(i)n.push(i[2]);else{var s=new Promise(((n,s)=>i=e[t]=[n,s]));n.push(i[2]=s);var r=o.p+o.u(t),a=new Error;o.l(r,(n=>{if(o.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var s=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+s+": "+r+")",a.name="ChunkLoadError",a.type=s,a.request=r,i[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var i,s,[r,a,c]=n,l=0;if(r.some((t=>0!==e[t]))){for(i in a)o.o(a,i)&&(o.m[i]=a[i]);c&&c(o)}for(t&&t(n);l<r.length;l++)s=r[l],o.o(e,s)&&e[s]&&e[s][0](),e[s]=0},n=self.webpackChunkconverse_js=self.webpackChunkconverse_js||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),(()=>{"use strict";const e={},t={plugins:{add(t,n){if(void 0!==e[t])throw new TypeError(`Error: plugin with name "${t}" has already been registered!`);e[t]=n}},initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.load(e).initialize(e)},load(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n.assets_path&&(o.p=n.assets_path),o(791),Object.keys(e).forEach((n=>t.plugins.add(n,e[n]))),t}};window.converse=t;const n=new CustomEvent("converse-loaded",{detail:{converse:t}});window.dispatchEvent(n)})()})();
//# sourceMappingURL=converse.min.js.map