This repository has been archived on 2022-09-21. You can view files and clone it, but cannot push or open issues or pull requests.
converse.js-dist/dist/converse.min.js

543 lines
1.1 MiB
Raw Permalink 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.

!function(e){function t(t){for(var n,i,s=t[0],o=t[1],a=0,l=[];a<s.length;a++)i=s[a],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&l.push(r[i][0]),r[i]=0;for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n]);for(c&&c(t);l.length;)l.shift()()}var n={},r={177:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var s=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=s);var o,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({0:"locales/dayjs/af",1:"locales/dayjs/ar",2:"locales/dayjs/ar-dz",3:"locales/dayjs/ar-kw",4:"locales/dayjs/ar-ly",5:"locales/dayjs/ar-ma",6:"locales/dayjs/ar-sa",7:"locales/dayjs/ar-tn",8:"locales/dayjs/az",9:"locales/dayjs/be",10:"locales/dayjs/bg",11:"locales/dayjs/bi",12:"locales/dayjs/bm",13:"locales/dayjs/bn",14:"locales/dayjs/bo",15:"locales/dayjs/br",16:"locales/dayjs/bs",17:"locales/dayjs/ca",18:"locales/dayjs/cs",19:"locales/dayjs/cv",20:"locales/dayjs/cy",21:"locales/dayjs/da",22:"locales/dayjs/de",23:"locales/dayjs/de-at",24:"locales/dayjs/de-ch",25:"locales/dayjs/dv",26:"locales/dayjs/el",27:"locales/dayjs/en",28:"locales/dayjs/en-SG",29:"locales/dayjs/en-au",30:"locales/dayjs/en-ca",31:"locales/dayjs/en-gb",32:"locales/dayjs/en-ie",33:"locales/dayjs/en-il",34:"locales/dayjs/en-in",35:"locales/dayjs/en-nz",36:"locales/dayjs/en-tt",37:"locales/dayjs/eo",38:"locales/dayjs/es",39:"locales/dayjs/es-do",40:"locales/dayjs/es-pr",41:"locales/dayjs/es-us",42:"locales/dayjs/et",43:"locales/dayjs/eu",44:"locales/dayjs/fa",45:"locales/dayjs/fi",46:"locales/dayjs/fo",47:"locales/dayjs/fr",48:"locales/dayjs/fr-ca",49:"locales/dayjs/fr-ch",50:"locales/dayjs/fy",51:"locales/dayjs/ga",52:"locales/dayjs/gd",53:"locales/dayjs/gl",54:"locales/dayjs/gom-latn",55:"locales/dayjs/gu",56:"locales/dayjs/he",57:"locales/dayjs/hi",58:"locales/dayjs/hr",59:"locales/dayjs/ht",60:"locales/dayjs/hu",61:"locales/dayjs/hy-am",62:"locales/dayjs/id",63:"locales/dayjs/is",64:"locales/dayjs/it",65:"locales/dayjs/it-ch",66:"locales/dayjs/ja",67:"locales/dayjs/jv",68:"locales/dayjs/ka",69:"locales/dayjs/kk",70:"locales/dayjs/km",71:"locales/dayjs/kn",72:"locales/dayjs/ko",73:"locales/dayjs/ku",74:"locales/dayjs/ky",75:"locales/dayjs/lb",76:"locales/dayjs/lo",77:"locales/dayjs/lt",78:"locales/dayjs/lv",79:"locales/dayjs/me",80:"locales/dayjs/mi",81:"locales/dayjs/mk",82:"locales/dayjs/ml",83:"locales/dayjs/mn",84:"locales/dayjs/mr",85:"locales/dayjs/ms",86:"locales/dayjs/ms-my",87:"locales/dayjs/mt",88:"locales/dayjs/my",89:"locales/dayjs/nb",90:"locales/dayjs/ne",91:"locales/dayjs/nl",92:"locales/dayjs/nl-be",93:"locales/dayjs/nn",94:"locales/dayjs/oc-lnc",95:"locales/dayjs/pa-in",96:"locales/dayjs/pl",97:"locales/dayjs/pt",98:"locales/dayjs/pt-br",99:"locales/dayjs/ro",100:"locales/dayjs/ru",101:"locales/dayjs/rw",102:"locales/dayjs/sd",103:"locales/dayjs/se",104:"locales/dayjs/si",105:"locales/dayjs/sk",106:"locales/dayjs/sl",107:"locales/dayjs/sq",108:"locales/dayjs/sr",109:"locales/dayjs/sr-cyrl",110:"locales/dayjs/ss",111:"locales/dayjs/sv",112:"locales/dayjs/sw",113:"locales/dayjs/ta",114:"locales/dayjs/te",115:"locales/dayjs/tet",116:"locales/dayjs/tg",117:"locales/dayjs/th",118:"locales/dayjs/tk",119:"locales/dayjs/tl-ph",120:"locales/dayjs/tlh",121:"locales/dayjs/tr",122:"locales/dayjs/tzl",123:"locales/dayjs/tzm",124:"locales/dayjs/tzm-latn",125:"locales/dayjs/ug-cn",126:"locales/dayjs/uk",127:"locales/dayjs/ur",128:"locales/dayjs/uz",129:"locales/dayjs/uz-latn",130:"locales/dayjs/vi",131:"locales/dayjs/x-pseudo",132:"locales/dayjs/yo",133:"locales/dayjs/zh",134:"locales/dayjs/zh-cn",135:"locales/dayjs/zh-hk",136:"locales/dayjs/zh-tw",137:"emojis",138:"locales/af-LC_MESSAGES-converse-po",139:"locales/ar-LC_MESSAGES-converse-po",140:"locales/bg-LC_MESSAGES-converse-po",141:"locales/ca-LC_MESSAGES-converse-po",142:"locales/cs-LC_MESSAGES-converse-po",143:"locales/da-LC_MESSAGES-converse-po",144:"locales/dayjs/index-d-ts",145:"locales/dayjs/types-d-ts",146:"locales/de-LC_MESSAGES-converse-po",147:"locales/eo-LC_MESSAGES-converse-po",148:"locales/es-LC_MESSAGES-converse-po",149:"locales/eu-LC_MESSAGES-converse-po",150:"locales/fi-LC_MESSAGES-converse-po",151:"locales/fr-LC_MESSAGES-converse-po",152:"locales/gl-LC_MESSAGES-converse-po",153:"locales/he-LC_MESSAGES-converse-po",154:"locales/hi-LC_MESSAGES-converse-po",155:"locales/hu-LC_MESSAGES-converse-po",156:"locales/id-LC_MESSAGES-converse-po",157:"locales/it-LC_MESSAGES-converse-po",158:"locales/ja-LC_MESSAGES-converse-po",159:"locales/lt-LC_MESSAGES-converse-po",160:"locales/mr-LC_MESSAGES-converse-po",161:"locales/nb-LC_MESSAGES-converse-po",162:"locales/nl-LC_MESSAGES-converse-po",163:"locales/nl_BE-LC_MESSAGES-converse-po",164:"locales/oc-LC_MESSAGES-converse-po",165:"locales/pl-LC_MESSAGES-converse-po",166:"locales/pt-LC_MESSAGES-converse-po",167:"locales/pt_BR-LC_MESSAGES-converse-po",168:"locales/ro-LC_MESSAGES-converse-po",169:"locales/ru-LC_MESSAGES-converse-po",170:"locales/sv-LC_MESSAGES-converse-po",171:"locales/th-LC_MESSAGES-converse-po",172:"locales/tr-LC_MESSAGES-converse-po",173:"locales/uk-LC_MESSAGES-converse-po",174:"locales/vi-LC_MESSAGES-converse-po",175:"locales/zh_CN-LC_MESSAGES-converse-po",176:"locales/zh_TW-LC_MESSAGES-converse-po"}[e]||e)+".js"}(e);var c=new Error;o=function(t){a.onerror=a.onload=null,clearTimeout(l);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+i+": "+s+")",c.name="ChunkLoadError",c.type=i,c.request=s,n[1](c)}r[e]=void 0}};var l=setTimeout((function(){o({type:"timeout",target:a})}),12e4);a.onerror=a.onload=o,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/dist/",i.oe=function(e){throw console.error(e),e};var s=window.webpackJsonp=window.webpackJsonp||[],o=s.push.bind(s);s.push=t,s=s.slice();for(var a=0;a<s.length;a++)t(s[a]);var c=o;i(i.s=310)}([function(e,t,n){"use strict";(function(e){n(152),n(154),n(473);var r=n(1);n.d(t,"e",(function(){return r.e})),n.d(t,"a",(function(){return r.a})),n.d(t,"b",(function(){return r.b})),n.d(t,"c",(function(){return r.c})),n.d(t,"d",(function(){return r.d})),e.$build=r.f.$build,e.$iq=r.f.$iq,e.$msg=r.f.$msg,e.$pres=r.f.$pres,e.Strophe=r.f.Strophe}).call(this,n(14))},function(e,t,n){"use strict";n.d(t,"a",(function(){return v})),n.d(t,"c",(function(){return _})),n.d(t,"b",(function(){return b})),n.d(t,"d",(function(){return y})),n.d(t,"e",(function(){return w}));var r=n(13);const i=function(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},s=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},o=function(e,t,n,r,s,o){return i((a=i(i(t,e),i(r,o)))<<(c=s)|a>>>32-c,n);var a,c},a=function(e,t,n,r,i,s,a){return o(t&n|~t&r,e,t,i,s,a)},c=function(e,t,n,r,i,s,a){return o(t&r|n&~r,e,t,i,s,a)},l=function(e,t,n,r,i,s,a){return o(t^n^r,e,t,i,s,a)},u=function(e,t,n,r,i,s,a){return o(n^(t|~r),e,t,i,s,a)},d=function(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let n,r,s,o,d=1732584193,h=-271733879,f=-1732584194,p=271733878;for(let t=0;t<e.length;t+=16)n=d,r=h,s=f,o=p,d=a(d,h,f,p,e[t+0],7,-680876936),p=a(p,d,h,f,e[t+1],12,-389564586),f=a(f,p,d,h,e[t+2],17,606105819),h=a(h,f,p,d,e[t+3],22,-1044525330),d=a(d,h,f,p,e[t+4],7,-176418897),p=a(p,d,h,f,e[t+5],12,1200080426),f=a(f,p,d,h,e[t+6],17,-1473231341),h=a(h,f,p,d,e[t+7],22,-45705983),d=a(d,h,f,p,e[t+8],7,1770035416),p=a(p,d,h,f,e[t+9],12,-1958414417),f=a(f,p,d,h,e[t+10],17,-42063),h=a(h,f,p,d,e[t+11],22,-1990404162),d=a(d,h,f,p,e[t+12],7,1804603682),p=a(p,d,h,f,e[t+13],12,-40341101),f=a(f,p,d,h,e[t+14],17,-1502002290),h=a(h,f,p,d,e[t+15],22,1236535329),d=c(d,h,f,p,e[t+1],5,-165796510),p=c(p,d,h,f,e[t+6],9,-1069501632),f=c(f,p,d,h,e[t+11],14,643717713),h=c(h,f,p,d,e[t+0],20,-373897302),d=c(d,h,f,p,e[t+5],5,-701558691),p=c(p,d,h,f,e[t+10],9,38016083),f=c(f,p,d,h,e[t+15],14,-660478335),h=c(h,f,p,d,e[t+4],20,-405537848),d=c(d,h,f,p,e[t+9],5,568446438),p=c(p,d,h,f,e[t+14],9,-1019803690),f=c(f,p,d,h,e[t+3],14,-187363961),h=c(h,f,p,d,e[t+8],20,1163531501),d=c(d,h,f,p,e[t+13],5,-1444681467),p=c(p,d,h,f,e[t+2],9,-51403784),f=c(f,p,d,h,e[t+7],14,1735328473),h=c(h,f,p,d,e[t+12],20,-1926607734),d=l(d,h,f,p,e[t+5],4,-378558),p=l(p,d,h,f,e[t+8],11,-2022574463),f=l(f,p,d,h,e[t+11],16,1839030562),h=l(h,f,p,d,e[t+14],23,-35309556),d=l(d,h,f,p,e[t+1],4,-1530992060),p=l(p,d,h,f,e[t+4],11,1272893353),f=l(f,p,d,h,e[t+7],16,-155497632),h=l(h,f,p,d,e[t+10],23,-1094730640),d=l(d,h,f,p,e[t+13],4,681279174),p=l(p,d,h,f,e[t+0],11,-358537222),f=l(f,p,d,h,e[t+3],16,-722521979),h=l(h,f,p,d,e[t+6],23,76029189),d=l(d,h,f,p,e[t+9],4,-640364487),p=l(p,d,h,f,e[t+12],11,-421815835),f=l(f,p,d,h,e[t+15],16,530742520),h=l(h,f,p,d,e[t+2],23,-995338651),d=u(d,h,f,p,e[t+0],6,-198630844),p=u(p,d,h,f,e[t+7],10,1126891415),f=u(f,p,d,h,e[t+14],15,-1416354905),h=u(h,f,p,d,e[t+5],21,-57434055),d=u(d,h,f,p,e[t+12],6,1700485571),p=u(p,d,h,f,e[t+3],10,-1894986606),f=u(f,p,d,h,e[t+10],15,-1051523),h=u(h,f,p,d,e[t+1],21,-2054922799),d=u(d,h,f,p,e[t+8],6,1873313359),p=u(p,d,h,f,e[t+15],10,-30611744),f=u(f,p,d,h,e[t+6],15,-1560198380),h=u(h,f,p,d,e[t+13],21,1309151649),d=u(d,h,f,p,e[t+4],6,-145523070),p=u(p,d,h,f,e[t+11],10,-1120210379),f=u(f,p,d,h,e[t+2],15,718787259),h=u(h,f,p,d,e[t+9],21,-343485551),d=i(d,n),h=i(h,r),f=i(f,s),p=i(p,o);return[d,h,f,p]},h={hexdigest:function(e){return function(e){let t="";for(let n=0;n<4*e.length;n++)t+="0123456789abcdef".charAt(e[n>>2]>>n%4*8+4&15)+"0123456789abcdef".charAt(e[n>>2]>>n%4*8&15);return t}(d(s(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}(d(s(e),8*e.length))}};var f=n(6);const p=function(e){var t,n,r="",i=e.length;for(t=0;t<i;t++)(n=e.charCodeAt(t))>=0&&n<=127?r+=e.charAt(t):n>2047?(r+=String.fromCharCode(224|n>>12&15),r+=String.fromCharCode(128|n>>6&63),r+=String.fromCharCode(128|n>>0&63)):(r+=String.fromCharCode(192|n>>6&31),r+=String.fromCharCode(128|n>>0&63));return r},m=function(e){e=e||{};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n="",r="",i="";const s=e[t],o="object"==typeof s,a=escape(unescape(o?s.value:s));o&&(n=s.expires?";expires="+s.expires:"",r=s.domain?";domain="+s.domain:"",i=s.path?";path="+s.path:""),document.cookie=t+"="+a+n+r+i}};var g=n(9);function v(e,t){return new w.Builder(e,t)}function _(e){return new w.Builder("message",e)}function b(e){return new w.Builder("iq",e)}function y(e){return new w.Builder("presence",e)}const w={VERSION:"1.3.6",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<w.XHTML.tags.length;t++)if(e===w.XHTML.tags[t])return!0;return!1},validAttribute(e,t){if(void 0!==w.XHTML.attributes[e]&&w.XHTML.attributes[e].length>0)for(let n=0;n<w.XHTML.attributes[e].length;n++)if(t===w.XHTML.attributes[e][n])return!0;return!1},validCSS(e){for(let t=0;t<w.XHTML.css.length;t++)if(e===w.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){w.NS[e]=t},forEachChild(e,t,n){for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];i.nodeType!==w.ElementType.NORMAL||t&&!this.isTagEqual(i,t)||n(i)}},isTagEqual:(e,t)=>e.tagName===t,_xmlGenerator:null,xmlGenerator:()=>(w._xmlGenerator||(w._xmlGenerator=r.b()),w._xmlGenerator),xmlElement(e){if(!e)return null;const t=w.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(w.xmlTextNode(n));else if("object"==typeof n&&"function"==typeof n.sort)for(let e=0;e<n.length;e++){const r=n[e];"object"==typeof r&&"function"==typeof r.sort&&void 0!==r[1]&&null!==r[1]&&t.setAttribute(r[0],r[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=e.replace(/\&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/'/g,"&apos;")).replace(/"/g,"&quot;"),xmlunescape:e=>e=(e=(e=(e=(e=e.replace(/\&amp;/g,"&")).replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&apos;/g,"'")).replace(/&quot;/g,'"'),xmlTextNode:e=>w.xmlGenerator().createTextNode(e),xmlHtmlNode(e){let t;if(r.a){t=(new r.a).parseFromString(e,"text/xml")}else t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e);return t},getText(e){if(!e)return null;let t="";0===e.childNodes.length&&e.nodeType===w.ElementType.TEXT&&(t+=e.nodeValue);for(let n=0;n<e.childNodes.length;n++)e.childNodes[n].nodeType===w.ElementType.TEXT&&(t+=e.childNodes[n].nodeValue);return w.xmlescape(t)},copyElement(e){let t;if(e.nodeType===w.ElementType.NORMAL){t=w.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(w.copyElement(e.childNodes[n]))}else e.nodeType===w.ElementType.TEXT&&(t=w.xmlGenerator().createTextNode(e.nodeValue));return t},createHtml(e){let t;if(e.nodeType===w.ElementType.NORMAL){const n=e.nodeName.toLowerCase();if(w.XHTML.validTag(n))try{t=w.xmlElement(n);for(let r=0;r<w.XHTML.attributes[n].length;r++){const i=w.XHTML.attributes[n][r];let s=e.getAttribute(i);if(null!=s&&""!==s&&!1!==s&&0!==s)if("style"===i&&"object"==typeof s&&void 0!==s.cssText&&(s=s.cssText),"style"===i){const e=[],n=s.split(";");for(let t=0;t<n.length;t++){const r=n[t].split(":"),i=r[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase();if(w.XHTML.validCSS(i)){const t=r[1].replace(/^\s*/,"").replace(/\s*$/,"");e.push(i+": "+t)}}e.length>0&&(s=e.join("; "),t.setAttribute(i,s))}else t.setAttribute(i,s)}for(let n=0;n<e.childNodes.length;n++)t.appendChild(w.createHtml(e.childNodes[n]))}catch(e){t=w.xmlTextNode("")}else{t=w.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(w.createHtml(e.childNodes[n]))}}else if(e.nodeType===w.ElementType.FRAGMENT){t=w.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(w.createHtml(e.childNodes[n]))}else e.nodeType===w.ElementType.TEXT&&(t=w.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=w.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&&w.fatal(e.stack),e.sourceURL?w.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?w.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):w.fatal("error: "+e.message)},log(e,t){e===this.LogLevel.FATAL&&"object"==typeof window.console&&"function"==typeof window.console.error&&window.console.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)=>"".concat(t," ").concat(n,'="').concat(w.xmlescape(e.attributes.getNamedItem(n).value),'"'),"<".concat(e.nodeName));if(e.childNodes.length>0){n+=">";for(let t=0;t<e.childNodes.length;t++){const r=e.childNodes[t];switch(r.nodeType){case w.ElementType.NORMAL:n+=w.serialize(r);break;case w.ElementType.TEXT:n+=w.xmlescape(r.nodeValue);break;case w.ElementType.CDATA:n+="<![CDATA["+r.nodeValue+"]]>"}}n+="</"+e.nodeName+">"}else n+="/>";return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin(e,t){w._connectionPlugins[e]=t},Builder:class{constructor(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=w.NS.CLIENT:t||(t={xmlns:w.NS.CLIENT})),this.nodeTree=w.xmlElement(e,t),this.node=this.nodeTree}tree(){return this.nodeTree}toString(){return w.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 r=w.xmlElement(e,t,n);return this.node.appendChild(r),"string"!=typeof n&&"number"!=typeof n&&(this.node=r),this}cnode(e){let t;const n=w.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}const r=t?n.importNode(e,!0):w.copyElement(e);return this.node.appendChild(r),this.node=r,this}t(e){const t=w.xmlTextNode(e);return this.node.appendChild(t),this}h(e){const t=w.xmlGenerator().createElement("body");t.innerHTML=e;const n=w.createHtml(t);for(;n.childNodes.length>0;)this.node.appendChild(n.childNodes[0]);return this}},Handler:function(e,t,n,r,i,s,o){this.handler=e,this.ns=t,this.name=n,this.type=r,this.id=i,this.options=o||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},this.options.matchBare&&(w.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'),this.options.matchBareFromJid=this.options.matchBare,delete this.options.matchBare),this.options.matchBareFromJid?this.from=s?w.getBareJidFromJid(s):null:this.from=s,this.user=!0}};w.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||(w.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=w.getBareJidFromJid(t));const n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!w.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 w._handleError(e),e}return t},toString(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},w.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+")}"}},w.Connection=class{constructor(e,t){this.service=e,this.options=t||{};const n=this.options.protocol||"";this.options.worker?this._proto=new w.WorkerWebsocket(this):0===e.indexOf("ws:")||0===e.indexOf("wss:")||0===n.indexOf("ws")?this._proto=new w.Websocket(this):this._proto=new w.Bosh(this),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),m(this.options.cookies),this.registerSASLMechanisms(this.options.mechanisms);for(const e in w._connectionPlugins)if(Object.prototype.hasOwnProperty.call(w._connectionPlugins,e)){const t=function(){};t.prototype=w._connectionPlugins[e],this[e]=new t,this[e].init(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,r,i,s,o){this.jid=e,this.authzid=w.getBareJidFromJid(this.jid),this.authcid=o||w.getNodeFromJid(this.jid),this.pass=t,this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=w.getDomainFromJid(this.jid),this._changeConnectStatus(w.Status.CONNECTING,null),this._proto._connect(r,i,s)}attach(e,t,n,r,i,s,o){if(this._proto._attach)return this._proto._attach(e,t,n,r,i,s,o);{const e=new Error('The "attach" method is not available for your connection protocol');throw e.name="StropheSessionError",e}}restore(e,t,n,r,i){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,r,i)}_sessionCachingSupported(){if(this._proto instanceof w.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,r){let i=null;"function"==typeof e.tree&&(e=e.tree());let s=e.getAttribute("id");if(s||(s=this.getUniqueId("sendPresence"),e.setAttribute("id",s)),"function"==typeof t||"function"==typeof n){const e=this.addHandler(e=>{i&&this.deleteTimedHandler(i),"error"===e.getAttribute("type")?n&&n(e):t&&t(e)},null,"presence",null,s);r&&(i=this.addTimedHandler(r,()=>(this.deleteHandler(e),n&&n(null),!1)))}return this.send(e),s}sendIQ(e,t,n,r){let i=null;"function"==typeof e.tree&&(e=e.tree());let s=e.getAttribute("id");if(s||(s=this.getUniqueId("sendIQ"),e.setAttribute("id",s)),"function"==typeof t||"function"==typeof n){const e=this.addHandler(e=>{i&&this.deleteTimedHandler(i);const r=e.getAttribute("type");if("result"===r)t&&t(e);else{if("error"!==r){const e=new Error("Got bad IQ type of ".concat(r));throw e.name="StropheError",e}n&&n(e)}},null,"iq",["error","result"],s);r&&(i=this.addTimedHandler(r,()=>(this.deleteHandler(e),n&&n(null),!1)))}return this.send(e),s}_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 w.TimedHandler(e,t);return this.addTimeds.push(n),n}deleteTimedHandler(e){this.removeTimeds.push(e)}addHandler(e,t,n,r,i,s,o){const a=new w.Handler(e,t,n,r,i,s,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||[w.SASLAnonymous,w.SASLExternal,w.SASLOAuthBearer,w.SASLXOAuth2,w.SASLPlain,w.SASLSHA1]).forEach(e=>this.registerSASLMechanism(e))}registerSASLMechanism(e){this.mechanisms[e.name]=e}disconnect(e){if(this._changeConnectStatus(w.Status.DISCONNECTING,e),e?w.warn("Disconnect was called because: "+e):w.info("Disconnect was called"),this.connected){let e=!1;this.disconnecting=!0,this.authenticated&&(e=y({xmlns:w.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(e)}else w.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()}_changeConnectStatus(e,t,n){for(const n in w._connectionPlugins)if(Object.prototype.hasOwnProperty.call(w._connectionPlugins,n)){const r=this[n];if(r.statusChanged)try{r.statusChanged(e,t)}catch(e){w.error("".concat(n," plugin caused an exception changing status: ").concat(e))}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){w._handleError(e),w.error("User connection callback caused an exception: ".concat(e))}}_doDisconnect(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),w.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(w.Status.DISCONNECTED,e),this.connected=!1}_dataRecv(e,t){const n=this._proto._reqToData(e);if(null===n)return;for(this.xmlInput!==w.Connection.prototype.xmlInput&&(n.nodeName===this._proto.strip&&n.childNodes.length?this.xmlInput(n.childNodes[0]):this.xmlInput(n)),this.rawInput!==w.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(w.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 r=n.getAttribute("type");if(null!==r&&"terminate"===r){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(w.Status.CONNFAIL,e)):this._changeConnectStatus(w.Status.CONNFAIL,w.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(e)}w.forEachChild(n,null,e=>{const t=this.handlers;this.handlers=[];for(let n=0;n<t.length;n++){const r=t[n];try{(!r.isMatch(e)||!this.authenticated&&r.user||r.run(e))&&this.handlers.push(r)}catch(e){w.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}})}_connect_cb(e,t,n){let r;w.debug("_connect_cb was called"),this.connected=!0;try{r=this._proto._reqToData(e)}catch(e){if(e.name!==w.ErrorCondition.BAD_FORMAT)throw e;this._changeConnectStatus(w.Status.CONNFAIL,w.ErrorCondition.BAD_FORMAT),this._doDisconnect(w.ErrorCondition.BAD_FORMAT)}if(!r)return;if(this.xmlInput!==w.Connection.prototype.xmlInput&&(r.nodeName===this._proto.strip&&r.childNodes.length?this.xmlInput(r.childNodes[0]):this.xmlInput(r)),this.rawInput!==w.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(w.serialize(r))),this._proto._connect_cb(r)===w.Status.CONNFAIL)return;let i;if(i=r.getElementsByTagNameNS?r.getElementsByTagNameNS(w.NS.STREAM,"features").length>0:r.getElementsByTagName("stream:features").length>0||r.getElementsByTagName("features").length>0,!i)return void this._proto._no_auth_received(t);const s=Array.from(r.getElementsByTagName("mechanism")).map(e=>this.mechanisms[e.textContent]).filter(e=>e);0!==s.length||0!==r.getElementsByTagName("auth").length?!1!==this.do_authentication&&this.authenticate(s):this._proto._no_auth_received(t)}sortMechanismsByPriority(e){for(let t=0;t<e.length-1;++t){let n=t;for(let r=t+1;r<e.length;++r)e[r].priority>e[n].priority&&(n=r);if(n!==t){const r=e[t];e[t]=e[n],e[n]=r}}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=new e[n],this._sasl_mechanism.onStart(this);const r=v("auth",{xmlns:w.NS.SASL,mechanism:this._sasl_mechanism.name});if(this._sasl_mechanism.isClientFirst){const e=this._sasl_mechanism.onChallenge(this,null);r.t(Object(g.btoa)(e))}this.send(r.tree()),t=!0;break}return t}_sasl_challenge_cb(e){const t=Object(g.atob)(w.getText(e)),n=this._sasl_mechanism.onChallenge(this,t),r=v("response",{xmlns:w.NS.SASL});return""!==n&&r.t(Object(g.btoa)(n)),this.send(r.tree()),!0}_attemptLegacyAuth(){null===w.getNodeFromJid(this.jid)?(this._changeConnectStatus(w.Status.CONNFAIL,w.ErrorCondition.MISSING_JID_NODE),this.disconnect(w.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(w.Status.AUTHENTICATING,null),this._addSysHandler(this._onLegacyAuthIQResult.bind(this),null,null,null,"_auth_1"),this.send(b({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:w.NS.AUTH}).c("username",{}).t(w.getNodeFromJid(this.jid)).tree()))}_onLegacyAuthIQResult(e){const t=b({type:"set",id:"_auth_2"}).c("query",{xmlns:w.NS.AUTH}).c("username",{}).t(w.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return w.getResourceFromJid(this.jid)||(this.jid=w.getBareJidFromJid(this.jid)+"/strophe"),t.up().c("resource",{}).t(w.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]+)=([^,]+)(,|$)/,r=Object(g.atob)(w.getText(e)).match(n);if("v"===r[1]&&(t=r[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)}w.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),w.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(w.Status.BINDREQUIRED,null):this.bind(),!1):(this._changeConnectStatus(w.Status.AUTHFAIL,null),!1)}bind(){if(!this.do_bind)return void w.log(w.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=w.getResourceFromJid(this.jid);e?this.send(b({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:w.NS.BIND}).c("resource",{}).t(e).tree()):this.send(b({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:w.NS.BIND}).tree())}_onResourceBindResultIQ(e){if("error"===e.getAttribute("type")){let t;return w.warn("Resource binding failed."),e.getElementsByTagName("conflict").length>0&&(t=w.ErrorCondition.CONFLICT),this._changeConnectStatus(w.Status.AUTHFAIL,t,e),!1}const t=e.getElementsByTagName("bind");if(!(t.length>0))return w.warn("Resource binding failed."),this._changeConnectStatus(w.Status.AUTHFAIL,null,e),!1;{const e=t[0].getElementsByTagName("jid");e.length>0&&(this.jid=w.getText(e[0]),this.do_session?this._establishSession():(this.authenticated=!0,this._changeConnectStatus(w.Status.CONNECTED,null)))}}_establishSession(){if(!this.do_session)throw new Error("Strophe.Connection.prototype._establishSession "+"called but apparently ".concat(w.NS.SESSION," wasn't advertised by the server"));this._addSysHandler(this._onSessionResultIQ.bind(this),null,null,null,"_session_auth_2"),this.send(b({type:"set",id:"_session_auth_2"}).c("session",{xmlns:w.NS.SESSION}).tree())}_onSessionResultIQ(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(w.Status.CONNECTED,null);else if("error"===e.getAttribute("type"))return w.warn("Session creation failed."),this._changeConnectStatus(w.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(w.Status.AUTHFAIL,null,e),!1}_auth2_cb(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(w.Status.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(w.Status.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1}_addSysTimedHandler(e,t){const n=new w.TimedHandler(e,t);return n.user=!1,this.addTimeds.push(n),n}_addSysHandler(e,t,n,r,i){const s=new w.Handler(e,t,n,r,i);return s.user=!1,this.addHandlers.push(s),s}_onDisconnectTimeout(){return w.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(w.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 r=this.timedHandlers[n];if(this.authenticated||!r.user){r.lastCalled+r.period-e<=0?r.run()&&t.push(r):t.push(r)}}this.timedHandlers=t,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout(()=>this._onIdle(),100))}},w.SASLMechanism=class{constructor(e,t,n){this.name=e,this.isClientFirst=t,this.priority=n}static test(e){return!0}onStart(e){this._connection=e}onChallenge(e,t){throw new Error("You should implement challenge handling!")}onFailure(){this._connection=null}onSuccess(){this._connection=null}},w.SASLAnonymous=class extends w.SASLMechanism{constructor(){super(w.SASLAnonymous.name,!1,w.SASLAnonymous.priority)}static get name(){return"ANONYMOUS"}static get priority(){return 20}static test(e){return null===e.authcid}},w.SASLPlain=class extends w.SASLMechanism{constructor(){super(w.SASLPlain.name,!0,w.SASLPlain.priority)}static get name(){return"PLAIN"}static get priority(){return 50}static test(e){return null!==e.authcid}onChallenge(e){const{authcid:t,authzid:n,domain:r,pass:i}=e;if(!r)throw new Error("SASLPlain onChallenge: domain is not defined!");let s=n!=="".concat(t,"@").concat(r)?n:"";return s+="\0",s+=t,s+="\0",s+=i,p(s)}},w.SASLSHA1=class extends w.SASLMechanism{constructor(){super(w.SASLSHA1.name,!0,w.SASLSHA1.priority)}static get name(){return"SCRAM-SHA-1"}static get priority(){return 60}static test(e){return null!==e.authcid}onChallenge(e,t,n){const r=n||h.hexdigest(""+1234567890*Math.random());let i="n="+p(e.authcid);return i+=",r=",i+=r,e._sasl_data.cnonce=r,e._sasl_data["client-first-message-bare"]=i,i="n,,"+i,this.onChallenge=(e,t)=>{let n,r,i,s,o,a,c,l,u="c=biws,",d="".concat(e._sasl_data["client-first-message-bare"],",").concat(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":r=e[2];break;case"i":i=e[2]}}if(n.substr(0,h.length)!==h)return e._sasl_data={},e._sasl_failure_cb();u+="r="+n,d+=u,r=Object(g.atob)(r),r+="\0\0\0";const v=p(e.pass);for(s=a=f.a.core_hmac_sha1(v,r),c=1;c<i;c++){for(o=f.a.core_hmac_sha1(v,f.a.binb2str(a)),l=0;l<5;l++)s[l]^=o[l];a=o}s=f.a.binb2str(s);const _=f.a.core_hmac_sha1(s,"Client Key"),b=f.a.str_hmac_sha1(s,"Server Key"),y=f.a.core_hmac_sha1(f.a.str_sha1(f.a.binb2str(_)),d);for(e._sasl_data["server-signature"]=f.a.b64_hmac_sha1(b,d),l=0;l<5;l++)_[l]^=y[l];return u+=",p="+Object(g.btoa)(f.a.binb2str(_)),u},i}},w.SASLOAuthBearer=class extends w.SASLMechanism{constructor(){super(w.SASLOAuthBearer.name,!0,w.SASLOAuthBearer.priority)}static get name(){return"OAUTHBEARER"}static get priority(){return 40}static 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+="",p(t)}},w.SASLExternal=class extends w.SASLMechanism{constructor(){super(w.SASLExternal.name,!0,w.SASLExternal.priority)}static get name(){return"EXTERNAL"}static get priority(){return 10}onChallenge(e){return e.authcid===e.authzid?"":e.authzid}},w.SASLXOAuth2=class extends w.SASLMechanism{constructor(){super(w.SASLXOAuth2.name,!0,w.SASLXOAuth2.priority)}static get name(){return"X-OAUTH2"}static get priority(){return 30}static test(e){return null!==e.pass}onChallenge(e){let t="\0";return null!==e.authcid&&(t+=e.authzid),t+="\0",t+=e.pass,p(t)}};t.f={Strophe:w,$build:v,$iq:b,$msg:_,$pres:y,SHA1:f.a,MD5:h,b64_hmac_sha1:f.a.b64_hmac_sha1,b64_sha1:f.a.b64_sha1,str_hmac_sha1:f.a.str_hmac_sha1,str_sha1:f.a.str_sha1}},function(e,t,n){"use strict";n.d(t,"a",(function(){return C})),n.d(t,"b",(function(){return O})),n.d(t,"d",(function(){return j})),n.d(t,"c",(function(){return S}));var r=n(8);const i=function(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},s=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},o=function(e,t,n,r,s,o){return i((a=i(i(t,e),i(r,o)))<<(c=s)|a>>>32-c,n);var a,c},a=function(e,t,n,r,i,s,a){return o(t&n|~t&r,e,t,i,s,a)},c=function(e,t,n,r,i,s,a){return o(t&r|n&~r,e,t,i,s,a)},l=function(e,t,n,r,i,s,a){return o(t^n^r,e,t,i,s,a)},u=function(e,t,n,r,i,s,a){return o(n^(t|~r),e,t,i,s,a)},d=function(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let n,r,s,o,d=1732584193,h=-271733879,f=-1732584194,p=271733878;for(let t=0;t<e.length;t+=16)n=d,r=h,s=f,o=p,d=a(d,h,f,p,e[t+0],7,-680876936),p=a(p,d,h,f,e[t+1],12,-389564586),f=a(f,p,d,h,e[t+2],17,606105819),h=a(h,f,p,d,e[t+3],22,-1044525330),d=a(d,h,f,p,e[t+4],7,-176418897),p=a(p,d,h,f,e[t+5],12,1200080426),f=a(f,p,d,h,e[t+6],17,-1473231341),h=a(h,f,p,d,e[t+7],22,-45705983),d=a(d,h,f,p,e[t+8],7,1770035416),p=a(p,d,h,f,e[t+9],12,-1958414417),f=a(f,p,d,h,e[t+10],17,-42063),h=a(h,f,p,d,e[t+11],22,-1990404162),d=a(d,h,f,p,e[t+12],7,1804603682),p=a(p,d,h,f,e[t+13],12,-40341101),f=a(f,p,d,h,e[t+14],17,-1502002290),h=a(h,f,p,d,e[t+15],22,1236535329),d=c(d,h,f,p,e[t+1],5,-165796510),p=c(p,d,h,f,e[t+6],9,-1069501632),f=c(f,p,d,h,e[t+11],14,643717713),h=c(h,f,p,d,e[t+0],20,-373897302),d=c(d,h,f,p,e[t+5],5,-701558691),p=c(p,d,h,f,e[t+10],9,38016083),f=c(f,p,d,h,e[t+15],14,-660478335),h=c(h,f,p,d,e[t+4],20,-405537848),d=c(d,h,f,p,e[t+9],5,568446438),p=c(p,d,h,f,e[t+14],9,-1019803690),f=c(f,p,d,h,e[t+3],14,-187363961),h=c(h,f,p,d,e[t+8],20,1163531501),d=c(d,h,f,p,e[t+13],5,-1444681467),p=c(p,d,h,f,e[t+2],9,-51403784),f=c(f,p,d,h,e[t+7],14,1735328473),h=c(h,f,p,d,e[t+12],20,-1926607734),d=l(d,h,f,p,e[t+5],4,-378558),p=l(p,d,h,f,e[t+8],11,-2022574463),f=l(f,p,d,h,e[t+11],16,1839030562),h=l(h,f,p,d,e[t+14],23,-35309556),d=l(d,h,f,p,e[t+1],4,-1530992060),p=l(p,d,h,f,e[t+4],11,1272893353),f=l(f,p,d,h,e[t+7],16,-155497632),h=l(h,f,p,d,e[t+10],23,-1094730640),d=l(d,h,f,p,e[t+13],4,681279174),p=l(p,d,h,f,e[t+0],11,-358537222),f=l(f,p,d,h,e[t+3],16,-722521979),h=l(h,f,p,d,e[t+6],23,76029189),d=l(d,h,f,p,e[t+9],4,-640364487),p=l(p,d,h,f,e[t+12],11,-421815835),f=l(f,p,d,h,e[t+15],16,530742520),h=l(h,f,p,d,e[t+2],23,-995338651),d=u(d,h,f,p,e[t+0],6,-198630844),p=u(p,d,h,f,e[t+7],10,1126891415),f=u(f,p,d,h,e[t+14],15,-1416354905),h=u(h,f,p,d,e[t+5],21,-57434055),d=u(d,h,f,p,e[t+12],6,1700485571),p=u(p,d,h,f,e[t+3],10,-1894986606),f=u(f,p,d,h,e[t+10],15,-1051523),h=u(h,f,p,d,e[t+1],21,-2054922799),d=u(d,h,f,p,e[t+8],6,1873313359),p=u(p,d,h,f,e[t+15],10,-30611744),f=u(f,p,d,h,e[t+6],15,-1560198380),h=u(h,f,p,d,e[t+13],21,1309151649),d=u(d,h,f,p,e[t+4],6,-145523070),p=u(p,d,h,f,e[t+11],10,-1120210379),f=u(f,p,d,h,e[t+2],15,718787259),h=u(h,f,p,d,e[t+9],21,-343485551),d=i(d,n),h=i(h,r),f=i(f,s),p=i(p,o);return[d,h,f,p]},h={hexdigest:function(e){return function(e){let t="";for(let n=0;n<4*e.length;n++)t+="0123456789abcdef".charAt(e[n>>2]>>n%4*8+4&15)+"0123456789abcdef".charAt(e[n>>2]>>n%4*8&15);return t}(d(s(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}(d(s(e),8*e.length))}};function f(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;var n,r,i,s,o,a,c,l,u=new Array(80),d=1732584193,h=-271733879,f=-1732584194,g=271733878,b=-1009589776;for(n=0;n<e.length;n+=16){for(s=d,o=h,a=f,c=g,l=b,r=0;r<80;r++)u[r]=r<16?e[n+r]:_(u[r-3]^u[r-8]^u[r-14]^u[r-16],1),i=v(v(_(d,5),p(r,h,f,g)),v(v(b,u[r]),m(r))),b=g,g=f,f=_(h,30),h=d,d=i;d=v(d,s),h=v(h,o),f=v(f,a),g=v(g,c),b=v(b,l)}return[d,h,f,g,b]}function p(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function m(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function g(e,t){var n=b(e);n.length>16&&(n=f(n,8*e.length));for(var r=new Array(16),i=new Array(16),s=0;s<16;s++)r[s]=909522486^n[s],i[s]=1549556828^n[s];var o=f(r.concat(b(t)),512+8*t.length);return f(i.concat(o),672)}function v(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function _(e,t){return e<<t|e>>>32-t}function b(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 y(e){for(var t,n,r="",i=0;i<4*e.length;i+=3)for(t=(e[i>>2]>>8*(3-i%4)&255)<<16|(e[i+1>>2]>>8*(3-(i+1)%4)&255)<<8|e[i+2>>2]>>8*(3-(i+2)%4)&255,n=0;n<4;n++)8*i+6*n>32*e.length?r+="=":r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return r}function w(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 S={b64_hmac_sha1:function(e,t){return y(g(e,t))},b64_sha1:function(e){return y(f(b(e),8*e.length))},binb2str:w,core_hmac_sha1:g,str_hmac_sha1:function(e,t){return w(g(e,t))},str_sha1:function(e){return w(f(b(e),8*e.length))}},x=function(e){var t,n,r="",i=e.length;for(t=0;t<i;t++)(n=e.charCodeAt(t))>=0&&n<=127?r+=e.charAt(t):n>2047?(r+=String.fromCharCode(224|n>>12&15),r+=String.fromCharCode(128|n>>6&63),r+=String.fromCharCode(128|n>>0&63)):(r+=String.fromCharCode(192|n>>6&31),r+=String.fromCharCode(128|n>>0&63));return r},E=function(e){e=e||{};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n="",r="",i="";const s=e[t],o="object"==typeof s,a=escape(unescape(o?s.value:s));o&&(n=s.expires?";expires="+s.expires:"",r=s.domain?";domain="+s.domain:"",i=s.path?";path="+s.path:""),document.cookie=t+"="+a+n+r+i}};var A=n(9);function C(e,t){return new j.Builder(e,t)}function T(e){return new j.Builder("iq",e)}function O(e){return new j.Builder("presence",e)}const j={VERSION:"1.4.1",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<j.XHTML.tags.length;t++)if(e===j.XHTML.tags[t])return!0;return!1},validAttribute(e,t){if(void 0!==j.XHTML.attributes[e]&&j.XHTML.attributes[e].length>0)for(let n=0;n<j.XHTML.attributes[e].length;n++)if(t===j.XHTML.attributes[e][n])return!0;return!1},validCSS(e){for(let t=0;t<j.XHTML.css.length;t++)if(e===j.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){j.NS[e]=t},forEachChild(e,t,n){for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];i.nodeType!==j.ElementType.NORMAL||t&&!this.isTagEqual(i,t)||n(i)}},isTagEqual:(e,t)=>e.tagName===t,_xmlGenerator:null,xmlGenerator:()=>(j._xmlGenerator||(j._xmlGenerator=r.c()),j._xmlGenerator),xmlElement(e){if(!e)return null;const t=j.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(j.xmlTextNode(n));else if("object"==typeof n&&"function"==typeof n.sort)for(let e=0;e<n.length;e++){const r=n[e];"object"==typeof r&&"function"==typeof r.sort&&void 0!==r[1]&&null!==r[1]&&t.setAttribute(r[0],r[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=e.replace(/\&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/'/g,"&apos;")).replace(/"/g,"&quot;"),xmlunescape:e=>e=(e=(e=(e=(e=e.replace(/\&amp;/g,"&")).replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&apos;/g,"'")).replace(/&quot;/g,'"'),xmlTextNode:e=>j.xmlGenerator().createTextNode(e),xmlHtmlNode(e){let t;if(r.a){t=(new r.a).parseFromString(e,"text/xml")}else t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e);return t},getText(e){if(!e)return null;let t="";0===e.childNodes.length&&e.nodeType===j.ElementType.TEXT&&(t+=e.nodeValue);for(let n=0;n<e.childNodes.length;n++)e.childNodes[n].nodeType===j.ElementType.TEXT&&(t+=e.childNodes[n].nodeValue);return j.xmlescape(t)},copyElement(e){let t;if(e.nodeType===j.ElementType.NORMAL){t=j.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(j.copyElement(e.childNodes[n]))}else e.nodeType===j.ElementType.TEXT&&(t=j.xmlGenerator().createTextNode(e.nodeValue));return t},createHtml(e){let t;if(e.nodeType===j.ElementType.NORMAL){const n=e.nodeName.toLowerCase();if(j.XHTML.validTag(n))try{t=j.xmlElement(n);for(let r=0;r<j.XHTML.attributes[n].length;r++){const i=j.XHTML.attributes[n][r];let s=e.getAttribute(i);if(null!=s&&""!==s&&!1!==s&&0!==s)if("style"===i&&"object"==typeof s&&void 0!==s.cssText&&(s=s.cssText),"style"===i){const e=[],n=s.split(";");for(let t=0;t<n.length;t++){const r=n[t].split(":"),i=r[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase();if(j.XHTML.validCSS(i)){const t=r[1].replace(/^\s*/,"").replace(/\s*$/,"");e.push(i+": "+t)}}e.length>0&&(s=e.join("; "),t.setAttribute(i,s))}else t.setAttribute(i,s)}for(let n=0;n<e.childNodes.length;n++)t.appendChild(j.createHtml(e.childNodes[n]))}catch(e){t=j.xmlTextNode("")}else{t=j.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(j.createHtml(e.childNodes[n]))}}else if(e.nodeType===j.ElementType.FRAGMENT){t=j.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(j.createHtml(e.childNodes[n]))}else e.nodeType===j.ElementType.TEXT&&(t=j.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=j.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&&j.fatal(e.stack),e.sourceURL?j.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?j.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):j.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)=>"".concat(t," ").concat(n,'="').concat(j.xmlescape(e.attributes.getNamedItem(n).value),'"'),"<".concat(e.nodeName));if(e.childNodes.length>0){n+=">";for(let t=0;t<e.childNodes.length;t++){const r=e.childNodes[t];switch(r.nodeType){case j.ElementType.NORMAL:n+=j.serialize(r);break;case j.ElementType.TEXT:n+=j.xmlescape(r.nodeValue);break;case j.ElementType.CDATA:n+="<![CDATA["+r.nodeValue+"]]>"}}n+="</"+e.nodeName+">"}else n+="/>";return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin(e,t){j._connectionPlugins[e]=t},Builder:class{constructor(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=j.NS.CLIENT:t||(t={xmlns:j.NS.CLIENT})),this.nodeTree=j.xmlElement(e,t),this.node=this.nodeTree}tree(){return this.nodeTree}toString(){return j.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 r=j.xmlElement(e,t,n);return this.node.appendChild(r),"string"!=typeof n&&"number"!=typeof n&&(this.node=r),this}cnode(e){let t;const n=j.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}const r=t?n.importNode(e,!0):j.copyElement(e);return this.node.appendChild(r),this.node=r,this}t(e){const t=j.xmlTextNode(e);return this.node.appendChild(t),this}h(e){const t=j.xmlGenerator().createElement("body");t.innerHTML=e;const n=j.createHtml(t);for(;n.childNodes.length>0;)this.node.appendChild(n.childNodes[0]);return this}},Handler:function(e,t,n,r,i,s,o){this.handler=e,this.ns=t,this.name=n,this.type=r,this.id=i,this.options=o||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},this.options.matchBare&&(j.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'),this.options.matchBareFromJid=this.options.matchBare,delete this.options.matchBare),this.options.matchBareFromJid?this.from=s?j.getBareJidFromJid(s):null:this.from=s,this.user=!0}};j.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||(j.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=j.getBareJidFromJid(t));const n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!j.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 j._handleError(e),e}return t},toString(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},j.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+")}"}},j.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),E(this.options.cookies),this.registerSASLMechanisms(this.options.mechanisms);for(const e in j._connectionPlugins)if(Object.prototype.hasOwnProperty.call(j._connectionPlugins,e)){const t=function(){};t.prototype=j._connectionPlugins[e],this[e]=new t,this[e].init(this)}}setProtocol(){const e=this.options.protocol||"";this.options.worker?this._proto=new j.WorkerWebsocket(this):0===this.service.indexOf("ws:")||0===this.service.indexOf("wss:")||0===e.indexOf("ws")?this._proto=new j.Websocket(this):this._proto=new j.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,r,i,s,o){this.jid=e,this.authzid=j.getBareJidFromJid(this.jid),this.authcid=o||j.getNodeFromJid(this.jid),this.pass=t,this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=j.getDomainFromJid(this.jid),this._changeConnectStatus(j.Status.CONNECTING,null),this._proto._connect(r,i,s)}attach(e,t,n,r,i,s,o){if(this._proto._attach)return this._proto._attach(e,t,n,r,i,s,o);{const e=new Error('The "attach" method is not available for your connection protocol');throw e.name="StropheSessionError",e}}restore(e,t,n,r,i){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,r,i)}_sessionCachingSupported(){if(this._proto instanceof j.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,r){let i=null;"function"==typeof e.tree&&(e=e.tree());let s=e.getAttribute("id");if(s||(s=this.getUniqueId("sendPresence"),e.setAttribute("id",s)),"function"==typeof t||"function"==typeof n){const e=this.addHandler(e=>{i&&this.deleteTimedHandler(i),"error"===e.getAttribute("type")?n&&n(e):t&&t(e)},null,"presence",null,s);r&&(i=this.addTimedHandler(r,()=>(this.deleteHandler(e),n&&n(null),!1)))}return this.send(e),s}sendIQ(e,t,n,r){let i=null;"function"==typeof e.tree&&(e=e.tree());let s=e.getAttribute("id");if(s||(s=this.getUniqueId("sendIQ"),e.setAttribute("id",s)),"function"==typeof t||"function"==typeof n){const e=this.addHandler(e=>{i&&this.deleteTimedHandler(i);const r=e.getAttribute("type");if("result"===r)t&&t(e);else{if("error"!==r){const e=new Error("Got bad IQ type of ".concat(r));throw e.name="StropheError",e}n&&n(e)}},null,"iq",["error","result"],s);r&&(i=this.addTimedHandler(r,()=>(this.deleteHandler(e),n&&n(null),!1)))}return this.send(e),s}_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 j.TimedHandler(e,t);return this.addTimeds.push(n),n}deleteTimedHandler(e){this.removeTimeds.push(e)}addHandler(e,t,n,r,i,s,o){const a=new j.Handler(e,t,n,r,i,s,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||[j.SASLAnonymous,j.SASLExternal,j.SASLOAuthBearer,j.SASLXOAuth2,j.SASLPlain,j.SASLSHA1]).forEach(e=>this.registerSASLMechanism(e))}registerSASLMechanism(e){const t=new e;this.mechanisms[t.mechname]=t}disconnect(e){if(this._changeConnectStatus(j.Status.DISCONNECTING,e),e?j.warn("Disconnect was called because: "+e):j.info("Disconnect was called"),this.connected){let e=!1;this.disconnecting=!0,this.authenticated&&(e=O({xmlns:j.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(e)}else j.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()}_changeConnectStatus(e,t,n){for(const n in j._connectionPlugins)if(Object.prototype.hasOwnProperty.call(j._connectionPlugins,n)){const r=this[n];if(r.statusChanged)try{r.statusChanged(e,t)}catch(e){j.error("".concat(n," plugin caused an exception changing status: ").concat(e))}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){j._handleError(e),j.error("User connection callback caused an exception: ".concat(e))}}_doDisconnect(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),j.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(j.Status.DISCONNECTED,e),this.connected=!1}_dataRecv(e,t){const n=this._proto._reqToData(e);if(null===n)return;for(this.xmlInput!==j.Connection.prototype.xmlInput&&(n.nodeName===this._proto.strip&&n.childNodes.length?this.xmlInput(n.childNodes[0]):this.xmlInput(n)),this.rawInput!==j.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(j.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 r=n.getAttribute("type");if(null!==r&&"terminate"===r){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(j.Status.CONNFAIL,e)):this._changeConnectStatus(j.Status.CONNFAIL,j.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(e)}j.forEachChild(n,null,e=>{const t=this.handlers;this.handlers=[];for(let n=0;n<t.length;n++){const r=t[n];try{(!r.isMatch(e)||!this.authenticated&&r.user||r.run(e))&&this.handlers.push(r)}catch(e){j.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}})}_connect_cb(e,t,n){let r;j.debug("_connect_cb was called"),this.connected=!0;try{r=this._proto._reqToData(e)}catch(e){if(e.name!==j.ErrorCondition.BAD_FORMAT)throw e;this._changeConnectStatus(j.Status.CONNFAIL,j.ErrorCondition.BAD_FORMAT),this._doDisconnect(j.ErrorCondition.BAD_FORMAT)}if(!r)return;if(this.xmlInput!==j.Connection.prototype.xmlInput&&(r.nodeName===this._proto.strip&&r.childNodes.length?this.xmlInput(r.childNodes[0]):this.xmlInput(r)),this.rawInput!==j.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(j.serialize(r))),this._proto._connect_cb(r)===j.Status.CONNFAIL)return;let i;if(i=r.getElementsByTagNameNS?r.getElementsByTagNameNS(j.NS.STREAM,"features").length>0:r.getElementsByTagName("stream:features").length>0||r.getElementsByTagName("features").length>0,!i)return void this._proto._no_auth_received(t);const s=Array.from(r.getElementsByTagName("mechanism")).map(e=>this.mechanisms[e.textContent]).filter(e=>e);0!==s.length||0!==r.getElementsByTagName("auth").length?!1!==this.do_authentication&&this.authenticate(s):this._proto._no_auth_received(t)}sortMechanismsByPriority(e){for(let t=0;t<e.length-1;++t){let n=t;for(let r=t+1;r<e.length;++r)e[r].priority>e[n].priority&&(n=r);if(n!==t){const r=e[t];e[t]=e[n],e[n]=r}}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 r=C("auth",{xmlns:j.NS.SASL,mechanism:this._sasl_mechanism.mechname});if(this._sasl_mechanism.isClientFirst){const e=this._sasl_mechanism.onChallenge(this,null);r.t(Object(A.btoa)(e))}this.send(r.tree()),t=!0;break}return t}_sasl_challenge_cb(e){const t=Object(A.atob)(j.getText(e)),n=this._sasl_mechanism.onChallenge(this,t),r=C("response",{xmlns:j.NS.SASL});return""!==n&&r.t(Object(A.btoa)(n)),this.send(r.tree()),!0}_attemptLegacyAuth(){null===j.getNodeFromJid(this.jid)?(this._changeConnectStatus(j.Status.CONNFAIL,j.ErrorCondition.MISSING_JID_NODE),this.disconnect(j.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(j.Status.AUTHENTICATING,null),this._addSysHandler(this._onLegacyAuthIQResult.bind(this),null,null,null,"_auth_1"),this.send(T({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:j.NS.AUTH}).c("username",{}).t(j.getNodeFromJid(this.jid)).tree()))}_onLegacyAuthIQResult(e){const t=T({type:"set",id:"_auth_2"}).c("query",{xmlns:j.NS.AUTH}).c("username",{}).t(j.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return j.getResourceFromJid(this.jid)||(this.jid=j.getBareJidFromJid(this.jid)+"/strophe"),t.up().c("resource",{}).t(j.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]+)=([^,]+)(,|$)/,r=Object(A.atob)(j.getText(e)).match(n);if("v"===r[1]&&(t=r[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)}j.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),j.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(j.Status.BINDREQUIRED,null):this.bind(),!1):(this._changeConnectStatus(j.Status.AUTHFAIL,null),!1)}bind(){if(!this.do_bind)return void j.log(j.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=j.getResourceFromJid(this.jid);e?this.send(T({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:j.NS.BIND}).c("resource",{}).t(e).tree()):this.send(T({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:j.NS.BIND}).tree())}_onResourceBindResultIQ(e){if("error"===e.getAttribute("type")){let t;return j.warn("Resource binding failed."),e.getElementsByTagName("conflict").length>0&&(t=j.ErrorCondition.CONFLICT),this._changeConnectStatus(j.Status.AUTHFAIL,t,e),!1}const t=e.getElementsByTagName("bind");if(!(t.length>0))return j.warn("Resource binding failed."),this._changeConnectStatus(j.Status.AUTHFAIL,null,e),!1;{const e=t[0].getElementsByTagName("jid");e.length>0&&(this.authenticated=!0,this.jid=j.getText(e[0]),this.do_session?this._establishSession():this._changeConnectStatus(j.Status.CONNECTED,null))}}_establishSession(){if(!this.do_session)throw new Error("Strophe.Connection.prototype._establishSession "+"called but apparently ".concat(j.NS.SESSION," wasn't advertised by the server"));this._addSysHandler(this._onSessionResultIQ.bind(this),null,null,null,"_session_auth_2"),this.send(T({type:"set",id:"_session_auth_2"}).c("session",{xmlns:j.NS.SESSION}).tree())}_onSessionResultIQ(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(j.Status.CONNECTED,null);else if("error"===e.getAttribute("type"))return this.authenticated=!1,j.warn("Session creation failed."),this._changeConnectStatus(j.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(j.Status.AUTHFAIL,null,e),!1}_auth2_cb(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(j.Status.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(j.Status.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1}_addSysTimedHandler(e,t){const n=new j.TimedHandler(e,t);return n.user=!1,this.addTimeds.push(n),n}_addSysHandler(e,t,n,r,i){const s=new j.Handler(e,t,n,r,i);return s.user=!1,this.addHandlers.push(s),s}_onDisconnectTimeout(){return j.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(j.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 r=this.timedHandlers[n];if(this.authenticated||!r.user){r.lastCalled+r.period-e<=0?r.run()&&t.push(r):t.push(r)}}this.timedHandlers=t,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout(()=>this._onIdle(),100))}},j.SASLMechanism=class{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!")}onFailure(){this._connection=null}onSuccess(){this._connection=null}},j.SASLAnonymous=class extends j.SASLMechanism{constructor(e="ANONYMOUS",t=!1,n=20){super(e,t,n)}test(e){return null===e.authcid}},j.SASLPlain=class extends j.SASLMechanism{constructor(e="PLAIN",t=!0,n=50){super(e,t,n)}test(e){return null!==e.authcid}onChallenge(e){const{authcid:t,authzid:n,domain:r,pass:i}=e;if(!r)throw new Error("SASLPlain onChallenge: domain is not defined!");let s=n!=="".concat(t,"@").concat(r)?n:"";return s+="\0",s+=t,s+="\0",s+=i,x(s)}},j.SASLSHA1=class extends j.SASLMechanism{constructor(e="SCRAM-SHA-1",t=!0,n=60){super(e,t,n)}test(e){return null!==e.authcid}onChallenge(e,t,n){const r=n||h.hexdigest(""+1234567890*Math.random());let i="n="+x(e.authcid);return i+=",r=",i+=r,e._sasl_data.cnonce=r,e._sasl_data["client-first-message-bare"]=i,i="n,,"+i,this.onChallenge=(e,t)=>{let n,r,i,s,o,a,c,l,u="c=biws,",d="".concat(e._sasl_data["client-first-message-bare"],",").concat(t,",");const h=e._sasl_data.cnonce,f=/([a-z]+)=([^,]+)(,|$)/;for(;t.match(f);){const e=t.match(f);switch(t=t.replace(e[0],""),e[1]){case"r":n=e[2];break;case"s":r=e[2];break;case"i":i=e[2]}}if(n.substr(0,h.length)!==h)return e._sasl_data={},e._sasl_failure_cb();u+="r="+n,d+=u,r=Object(A.atob)(r),r+="\0\0\0";const p=x(e.pass);for(s=a=S.core_hmac_sha1(p,r),c=1;c<i;c++){for(o=S.core_hmac_sha1(p,S.binb2str(a)),l=0;l<5;l++)s[l]^=o[l];a=o}s=S.binb2str(s);const m=S.core_hmac_sha1(s,"Client Key"),g=S.str_hmac_sha1(s,"Server Key"),v=S.core_hmac_sha1(S.str_sha1(S.binb2str(m)),d);for(e._sasl_data["server-signature"]=S.b64_hmac_sha1(g,d),l=0;l<5;l++)m[l]^=v[l];return u+=",p="+Object(A.btoa)(S.binb2str(m)),u},i}},j.SASLOAuthBearer=class extends j.SASLMechanism{constructor(e="OAUTHBEARER",t=!0,n=40){super(e,t,n)}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+="",x(t)}},j.SASLExternal=class extends j.SASLMechanism{constructor(e="EXTERNAL",t=!0,n=10){super(e,t,n)}onChallenge(e){return e.authcid===e.authzid?"":e.authzid}},j.SASLXOAuth2=class extends j.SASLMechanism{constructor(e="X-OAUTH2",t=!0,n=30){super(e,t,n)}test(e){return null!==e.pass}onChallenge(e){let t="\0";return null!==e.authcid&&(t+=e.authzid),t+="\0",t+=e.pass,x(t)}};t.e={Strophe:j,$build:C,$iq:T,$msg:function(e){return new j.Builder("message",e)},$pres:O,SHA1:S,MD5:h,b64_hmac_sha1:S.b64_hmac_sha1,b64_sha1:S.b64_sha1,str_hmac_sha1:S.str_hmac_sha1,str_sha1:S.str_sha1}},function(e,t,n){var r;
/*!
* Sizzle CSS Selector Engine v2.3.5
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2020-03-14
*/!function(i){var s,o,a,c,l,u,d,h,f,p,m,g,v,_,b,y,w,S,x,E="sizzle"+1*new Date,A=i.document,C=0,T=0,O=he(),j=he(),k=he(),N=he(),M=function(e,t){return e===t&&(m=!0),0},I={}.hasOwnProperty,R=[],D=R.pop,L=R.push,z=R.push,P=R.slice,F=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",H="[\\x20\\t\\r\\n\\f]",q="(?:\\\\[\\da-fA-F]{1,6}"+H+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",U="\\["+H+"*("+q+")(?:"+H+"*([*^$|!~]?=)"+H+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+q+"))|)"+H+"*\\]",V=":("+q+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+U+")*)|.*)\\)|)",$=new RegExp(H+"+","g"),G=new RegExp("^"+H+"+|((?:^|[^\\\\])(?:\\\\.)*)"+H+"+$","g"),W=new RegExp("^"+H+"*,"+H+"*"),J=new RegExp("^"+H+"*([>+~]|"+H+")"+H+"*"),X=new RegExp(H+"|>"),Q=new RegExp(V),Y=new RegExp("^"+q+"$"),K={ID:new RegExp("^#("+q+")"),CLASS:new RegExp("^\\.("+q+")"),TAG:new RegExp("^("+q+"|[*])"),ATTR:new RegExp("^"+U),PSEUDO:new RegExp("^"+V),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+H+"*(even|odd|(([+-]|)(\\d*)n|)"+H+"*(?:([+-]|)"+H+"*(\\d+)|))"+H+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+H+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+H+"*((?:-\\d)?\\d*)"+H+"*\\)|)(?=[^-]|$)","i")},Z=/HTML$/i,ee=/^(?:input|select|textarea|button)$/i,te=/^h\d$/i,ne=/^[^{]+\{\s*\[native \w/,re=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ie=/[+~]/,se=new RegExp("\\\\[\\da-fA-F]{1,6}"+H+"?|\\\\([^\\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(){g()},ue=Ee((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{z.apply(R=P.call(A.childNodes),A.childNodes),R[A.childNodes.length].nodeType}catch(e){z={apply:R.length?function(e,t){L.apply(e,P.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function de(e,t,n,r){var i,s,a,c,l,d,f,p=t&&t.ownerDocument,m=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==m&&9!==m&&11!==m)return n;if(!r&&(g(t),t=t||v,b)){if(11!==m&&(l=re.exec(e)))if(i=l[1]){if(9===m){if(!(a=t.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(p&&(a=p.getElementById(i))&&x(t,a)&&a.id===i)return n.push(a),n}else{if(l[2])return z.apply(n,t.getElementsByTagName(e)),n;if((i=l[3])&&o.getElementsByClassName&&t.getElementsByClassName)return z.apply(n,t.getElementsByClassName(i)),n}if(o.qsa&&!N[e+" "]&&(!y||!y.test(e))&&(1!==m||"object"!==t.nodeName.toLowerCase())){if(f=e,p=t,1===m&&(X.test(e)||J.test(e))){for((p=ie.test(e)&&we(t.parentNode)||t)===t&&o.scope||((c=t.getAttribute("id"))?c=c.replace(ae,ce):t.setAttribute("id",c=E)),s=(d=u(e)).length;s--;)d[s]=(c?"#"+c:":scope")+" "+xe(d[s]);f=d.join(",")}try{return z.apply(n,p.querySelectorAll(f)),n}catch(t){N(e,!0)}finally{c===E&&t.removeAttribute("id")}}}return h(e.replace(G,"$1"),t,n,r)}function he(){var e=[];return function t(n,r){return e.push(n+" ")>a.cacheLength&&delete t[e.shift()],t[n+" "]=r}}function fe(e){return e[E]=!0,e}function pe(e){var t=v.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function me(e,t){for(var n=e.split("|"),r=n.length;r--;)a.attrHandle[n[r]]=t}function ge(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;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 _e(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function be(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&&ue(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ye(e){return fe((function(t){return t=+t,fe((function(n,r){for(var i,s=e([],n.length,t),o=s.length;o--;)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))}))}))}function we(e){return e&&void 0!==e.getElementsByTagName&&e}for(s in o=de.support={},l=de.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Z.test(t||n&&n.nodeName||"HTML")},g=de.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:A;return r!=v&&9===r.nodeType&&r.documentElement?(_=(v=r).documentElement,b=!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=pe((function(e){return _.appendChild(e).appendChild(v.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),o.attributes=pe((function(e){return e.className="i",!e.getAttribute("className")})),o.getElementsByTagName=pe((function(e){return e.appendChild(v.createComment("")),!e.getElementsByTagName("*").length})),o.getElementsByClassName=ne.test(v.getElementsByClassName),o.getById=pe((function(e){return _.appendChild(e).id=E,!v.getElementsByName||!v.getElementsByName(E).length})),o.getById?(a.filter.ID=function(e){var t=e.replace(se,oe);return function(e){return e.getAttribute("id")===t}},a.find.ID=function(e,t){if(void 0!==t.getElementById&&b){var n=t.getElementById(e);return n?[n]:[]}}):(a.filter.ID=function(e){var t=e.replace(se,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&&b){var n,r,i,s=t.getElementById(e);if(s){if((n=s.getAttributeNode("id"))&&n.value===e)return[s];for(i=t.getElementsByName(e),r=0;s=i[r++];)if((n=s.getAttributeNode("id"))&&n.value===e)return[s]}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,r=[],i=0,s=t.getElementsByTagName(e);if("*"===e){for(;n=s[i++];)1===n.nodeType&&r.push(n);return r}return s},a.find.CLASS=o.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&b)return t.getElementsByClassName(e)},w=[],y=[],(o.qsa=ne.test(v.querySelectorAll))&&(pe((function(e){var t;_.appendChild(e).innerHTML="<a id='"+E+"'></a><select id='"+E+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+H+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+H+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+E+"-]").length||y.push("~="),(t=v.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+H+"*name"+H+"*="+H+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+E+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")})),pe((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&&y.push("name"+H+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),_.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")}))),(o.matchesSelector=ne.test(S=_.matches||_.webkitMatchesSelector||_.mozMatchesSelector||_.oMatchesSelector||_.msMatchesSelector))&&pe((function(e){o.disconnectedMatch=S.call(e,"*"),S.call(e,"[s!='']:x"),w.push("!=",V)})),y=y.length&&new RegExp(y.join("|")),w=w.length&&new RegExp(w.join("|")),t=ne.test(_.compareDocumentPosition),x=t||ne.test(_.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},M=t?function(e,t){if(e===t)return m=!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:p?F(p,e)-F(p,t):0:4&n?-1:1)}:function(e,t){if(e===t)return m=!0,0;var n,r=0,i=e.parentNode,s=t.parentNode,o=[e],a=[t];if(!i||!s)return e==v?-1:t==v?1:i?-1:s?1:p?F(p,e)-F(p,t):0;if(i===s)return ge(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;o[r]===a[r];)r++;return r?ge(o[r],a[r]):o[r]==A?-1:a[r]==A?1:0},v):v},de.matches=function(e,t){return de(e,null,null,t)},de.matchesSelector=function(e,t){if(g(e),o.matchesSelector&&b&&!N[t+" "]&&(!w||!w.test(t))&&(!y||!y.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 de(t,v,null,[e]).length>0},de.contains=function(e,t){return(e.ownerDocument||e)!=v&&g(e),x(e,t)},de.attr=function(e,t){(e.ownerDocument||e)!=v&&g(e);var n=a.attrHandle[t.toLowerCase()],r=n&&I.call(a.attrHandle,t.toLowerCase())?n(e,t,!b):void 0;return void 0!==r?r:o.attributes||!b?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},de.escape=function(e){return(e+"").replace(ae,ce)},de.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},de.uniqueSort=function(e){var t,n=[],r=0,i=0;if(m=!o.detectDuplicates,p=!o.sortStable&&e.slice(0),e.sort(M),m){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return p=null,e},c=de.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=c(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=c(t);return n},(a=de.selectors={cacheLength:50,createPseudo:fe,match:K,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(se,oe),e[3]=(e[3]||e[4]||e[5]||"").replace(se,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]||de.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]&&de.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Q.test(n)&&(t=u(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(se,oe).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=O[e+" "];return t||(t=new RegExp("(^|"+H+")"+e+"("+H+"|$)"))&&O(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(r){var i=de.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,c){var l,u,d,h,f,p,m=s!==o?"nextSibling":"previousSibling",g=t.parentNode,v=a&&t.nodeName.toLowerCase(),_=!c&&!a,b=!1;if(g){if(s){for(;m;){for(h=t;h=h[m];)if(a?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;p=m="only"===e&&!p&&"nextSibling"}return!0}if(p=[o?g.firstChild:g.lastChild],o&&_){for(b=(f=(l=(u=(d=(h=g)[E]||(h[E]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===C&&l[1])&&l[2],h=f&&g.childNodes[f];h=++f&&h&&h[m]||(b=f=0)||p.pop();)if(1===h.nodeType&&++b&&h===t){u[e]=[C,f,b];break}}else if(_&&(b=f=(l=(u=(d=(h=t)[E]||(h[E]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===C&&l[1]),!1===b)for(;(h=++f&&h&&h[m]||(b=f=0)||p.pop())&&((a?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++b||(_&&((u=(d=h[E]||(h[E]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]=[C,b]),h!==t)););return(b-=i)===r||b%r==0&&b/r>=0}}},PSEUDO:function(e,t){var n,r=a.pseudos[e]||a.setFilters[e.toLowerCase()]||de.error("unsupported pseudo: "+e);return r[E]?r(t):r.length>1?(n=[e,e,"",t],a.setFilters.hasOwnProperty(e.toLowerCase())?fe((function(e,n){for(var i,s=r(e,t),o=s.length;o--;)e[i=F(e,s[o])]=!(n[i]=s[o])})):function(e){return r(e,0,n)}):r}},pseudos:{not:fe((function(e){var t=[],n=[],r=d(e.replace(G,"$1"));return r[E]?fe((function(e,t,n,i){for(var s,o=r(e,null,i,[]),a=e.length;a--;)(s=o[a])&&(e[a]=!(t[a]=s))})):function(e,i,s){return t[0]=e,r(t,null,s,n),t[0]=null,!n.pop()}})),has:fe((function(e){return function(t){return de(e,t).length>0}})),contains:fe((function(e){return e=e.replace(se,oe),function(t){return(t.textContent||c(t)).indexOf(e)>-1}})),lang:fe((function(e){return Y.test(e||"")||de.error("unsupported lang: "+e),e=e.replace(se,oe).toLowerCase(),function(t){var n;do{if(n=b?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=i.location&&i.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===_},focus:function(e){return e===v.activeElement&&(!v.hasFocus||v.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:be(!1),disabled:be(!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:ye((function(){return[0]})),last:ye((function(e,t){return[t-1]})),eq:ye((function(e,t,n){return[n<0?n+t:n]})),even:ye((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:ye((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:ye((function(e,t,n){for(var r=n<0?n+t:n>t?t:n;--r>=0;)e.push(r);return e})),gt:ye((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}}).pseudos.nth=a.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})a.pseudos[s]=ve(s);for(s in{submit:!0,reset:!0})a.pseudos[s]=_e(s);function Se(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function Ee(e,t,n){var r=t.dir,i=t.next,s=i||r,o=n&&"parentNode"===s,a=T++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||o)return e(t,n,i);return!1}:function(t,n,c){var l,u,d,h=[C,a];if(c){for(;t=t[r];)if((1===t.nodeType||o)&&e(t,n,c))return!0}else for(;t=t[r];)if(1===t.nodeType||o)if(u=(d=t[E]||(t[E]={}))[t.uniqueID]||(d[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=u[s])&&l[0]===C&&l[1]===a)return h[2]=l[2];if(u[s]=h,h[2]=e(t,n,c))return!0}return!1}}function Ae(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function Ce(e,t,n,r,i){for(var s,o=[],a=0,c=e.length,l=null!=t;a<c;a++)(s=e[a])&&(n&&!n(s,r,i)||(o.push(s),l&&t.push(a)));return o}function Te(e,t,n,r,i,s){return r&&!r[E]&&(r=Te(r)),i&&!i[E]&&(i=Te(i,s)),fe((function(s,o,a,c){var l,u,d,h=[],f=[],p=o.length,m=s||function(e,t,n){for(var r=0,i=t.length;r<i;r++)de(e,t[r],n);return n}(t||"*",a.nodeType?[a]:a,[]),g=!e||!s&&t?m:Ce(m,h,e,a,c),v=n?i||(s?e:p||r)?[]:o:g;if(n&&n(g,v,a,c),r)for(l=Ce(v,f),r(l,[],a,c),u=l.length;u--;)(d=l[u])&&(v[f[u]]=!(g[f[u]]=d));if(s){if(i||e){if(i){for(l=[],u=v.length;u--;)(d=v[u])&&l.push(g[u]=d);i(null,v=[],l,c)}for(u=v.length;u--;)(d=v[u])&&(l=i?F(s,d):h[u])>-1&&(s[l]=!(o[l]=d))}}else v=Ce(v===o?v.splice(p,v.length):v),i?i(null,o,v,c):z.apply(o,v)}))}function Oe(e){for(var t,n,r,i=e.length,s=a.relative[e[0].type],o=s||a.relative[" "],c=s?1:0,l=Ee((function(e){return e===t}),o,!0),u=Ee((function(e){return F(t,e)>-1}),o,!0),d=[function(e,n,r){var i=!s&&(r||n!==f)||((t=n).nodeType?l(e,n,r):u(e,n,r));return t=null,i}];c<i;c++)if(n=a.relative[e[c].type])d=[Ee(Ae(d),n)];else{if((n=a.filter[e[c].type].apply(null,e[c].matches))[E]){for(r=++c;r<i&&!a.relative[e[r].type];r++);return Te(c>1&&Ae(d),c>1&&xe(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(G,"$1"),n,c<r&&Oe(e.slice(c,r)),r<i&&Oe(e=e.slice(r)),r<i&&xe(e))}d.push(n)}return Ae(d)}Se.prototype=a.filters=a.pseudos,a.setFilters=new Se,u=de.tokenize=function(e,t){var n,r,i,s,o,c,l,u=j[e+" "];if(u)return t?0:u.slice(0);for(o=e,c=[],l=a.preFilter;o;){for(s in n&&!(r=W.exec(o))||(r&&(o=o.slice(r[0].length)||o),c.push(i=[])),n=!1,(r=J.exec(o))&&(n=r.shift(),i.push({value:n,type:r[0].replace(G," ")}),o=o.slice(n.length)),a.filter)!(r=K[s].exec(o))||l[s]&&!(r=l[s](r))||(n=r.shift(),i.push({value:n,type:s,matches:r}),o=o.slice(n.length));if(!n)break}return t?o.length:o?de.error(e):j(e,c).slice(0)},d=de.compile=function(e,t){var n,r=[],i=[],s=k[e+" "];if(!s){for(t||(t=u(e)),n=t.length;n--;)(s=Oe(t[n]))[E]?r.push(s):i.push(s);(s=k(e,function(e,t){var n=t.length>0,r=e.length>0,i=function(i,s,o,c,l){var u,d,h,p=0,m="0",_=i&&[],y=[],w=f,S=i||r&&a.find.TAG("*",l),x=C+=null==w?1:Math.random()||.1,E=S.length;for(l&&(f=s==v||s||l);m!==E&&null!=(u=S[m]);m++){if(r&&u){for(d=0,s||u.ownerDocument==v||(g(u),o=!b);h=e[d++];)if(h(u,s||v,o)){c.push(u);break}l&&(C=x)}n&&((u=!h&&u)&&p--,i&&_.push(u))}if(p+=m,n&&m!==p){for(d=0;h=t[d++];)h(_,y,s,o);if(i){if(p>0)for(;m--;)_[m]||y[m]||(y[m]=D.call(c));y=Ce(y)}z.apply(c,y),l&&!i&&y.length>0&&p+t.length>1&&de.uniqueSort(c)}return l&&(C=x,f=w),_};return n?fe(i):i}(i,r))).selector=e}return s},h=de.select=function(e,t,n,r){var i,s,o,c,l,h="function"==typeof e&&e,f=!r&&u(e=h.selector||e);if(n=n||[],1===f.length){if((s=f[0]=f[0].slice(0)).length>2&&"ID"===(o=s[0]).type&&9===t.nodeType&&b&&a.relative[s[1].type]){if(!(t=(a.find.ID(o.matches[0].replace(se,oe),t)||[])[0]))return n;h&&(t=t.parentNode),e=e.slice(s.shift().value.length)}for(i=K.needsContext.test(e)?0:s.length;i--&&(o=s[i],!a.relative[c=o.type]);)if((l=a.find[c])&&(r=l(o.matches[0].replace(se,oe),ie.test(s[0].type)&&we(t.parentNode)||t))){if(s.splice(i,1),!(e=r.length&&xe(s)))return z.apply(n,r),n;break}}return(h||d(e,f))(r,t,!b,n,!t||ie.test(e)&&we(t.parentNode)||t),n},o.sortStable=E.split("").sort(M).join("")===E,o.detectDuplicates=!!m,g(),o.sortDetached=pe((function(e){return 1&e.compareDocumentPosition(v.createElement("fieldset"))})),pe((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||me("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),o.attributes&&pe((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||me("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),pe((function(e){return null==e.getAttribute("disabled")}))||me(B,(function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}));var je=i.Sizzle;de.noConflict=function(){return i.Sizzle===de&&(i.Sizzle=je),de},void 0===(r=function(){return de}.call(t,n,t,e))||(e.exports=r)}(window)},function(e,t,n){e.exports=function(){"use strict";var e="millisecond",t="second",n="minute",r="hour",i="day",s="week",o="month",a="quarter",c="year",l=/^(\d{4})-?(\d{1,2})-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/,u=/\[([^\]]+)]|Y{2,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,d=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},h={s:d,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+d(r,2,"0")+":"+d(i,2,"0")},m:function(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),r=e.clone().add(n,o),i=t-r<0,s=e.clone().add(n+(i?-1:1),o);return Number(-(n+(t-r)/(i?r-s:s-r))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(l){return{M:o,y:c,w:s,d:i,D:"date",h:r,m:n,s:t,ms:e,Q:a}[l]||String(l||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},f={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="en",m={};m[p]=f;var g=function(e){return e instanceof y},v=function(e,t,n){var r;if(!e)return p;if("string"==typeof e)m[e]&&(r=e),t&&(m[e]=t,r=e);else{var i=e.name;m[i]=e,r=i}return!n&&r&&(p=r),r||!n&&p},_=function(e,t){if(g(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new y(n)},b=h;b.l=v,b.i=g,b.w=function(e,t){return _(e,{locale:t.$L,utc:t.$u,$offset:t.$offset})};var y=function(){function d(e){this.$L=this.$L||v(e.locale,null,!0),this.parse(e)}var h=d.prototype;return h.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(b.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(l);if(r)return n?new Date(Date.UTC(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)):new Date(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)}return new Date(t)}(e),this.init()},h.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()},h.$utils=function(){return b},h.isValid=function(){return!("Invalid Date"===this.$d.toString())},h.isSame=function(e,t){var n=_(e);return this.startOf(t)<=n&&n<=this.endOf(t)},h.isAfter=function(e,t){return _(e)<this.startOf(t)},h.isBefore=function(e,t){return this.endOf(t)<_(e)},h.$g=function(e,t,n){return b.u(e)?this[t]:this.set(n,e)},h.year=function(e){return this.$g(e,"$y",c)},h.month=function(e){return this.$g(e,"$M",o)},h.day=function(e){return this.$g(e,"$W",i)},h.date=function(e){return this.$g(e,"$D","date")},h.hour=function(e){return this.$g(e,"$H",r)},h.minute=function(e){return this.$g(e,"$m",n)},h.second=function(e){return this.$g(e,"$s",t)},h.millisecond=function(t){return this.$g(t,"$ms",e)},h.unix=function(){return Math.floor(this.valueOf()/1e3)},h.valueOf=function(){return this.$d.getTime()},h.startOf=function(e,a){var l=this,u=!!b.u(a)||a,d=b.p(e),h=function(e,t){var n=b.w(l.$u?Date.UTC(l.$y,t,e):new Date(l.$y,t,e),l);return u?n:n.endOf(i)},f=function(e,t){return b.w(l.toDate()[e].apply(l.toDate("s"),(u?[0,0,0,0]:[23,59,59,999]).slice(t)),l)},p=this.$W,m=this.$M,g=this.$D,v="set"+(this.$u?"UTC":"");switch(d){case c:return u?h(1,0):h(31,11);case o:return u?h(1,m):h(0,m+1);case s:var _=this.$locale().weekStart||0,y=(p<_?p+7:p)-_;return h(u?g-y:g+(6-y),m);case i:case"date":return f(v+"Hours",0);case r:return f(v+"Minutes",1);case n:return f(v+"Seconds",2);case t:return f(v+"Milliseconds",3);default:return this.clone()}},h.endOf=function(e){return this.startOf(e,!1)},h.$set=function(s,a){var l,u=b.p(s),d="set"+(this.$u?"UTC":""),h=(l={},l.day=d+"Date",l.date=d+"Date",l[o]=d+"Month",l[c]=d+"FullYear",l[r]=d+"Hours",l[n]=d+"Minutes",l[t]=d+"Seconds",l[e]=d+"Milliseconds",l)[u],f=u===i?this.$D+(a-this.$W):a;if(u===o||u===c){var p=this.clone().set("date",1);p.$d[h](f),p.init(),this.$d=p.set("date",Math.min(this.$D,p.daysInMonth())).$d}else h&&this.$d[h](f);return this.init(),this},h.set=function(e,t){return this.clone().$set(e,t)},h.get=function(e){return this[b.p(e)]()},h.add=function(e,a){var l,u=this;e=Number(e);var d=b.p(a),h=function(t){var n=_(u);return b.w(n.date(n.date()+Math.round(t*e)),u)};if(d===o)return this.set(o,this.$M+e);if(d===c)return this.set(c,this.$y+e);if(d===i)return h(1);if(d===s)return h(7);var f=(l={},l[n]=6e4,l[r]=36e5,l[t]=1e3,l)[d]||1,p=this.$d.getTime()+e*f;return b.w(p,this)},h.subtract=function(e,t){return this.add(-1*e,t)},h.format=function(e){var t=this;if(!this.isValid())return"Invalid Date";var n=e||"YYYY-MM-DDTHH:mm:ssZ",r=b.z(this),i=this.$locale(),s=this.$H,o=this.$m,a=this.$M,c=i.weekdays,l=i.months,d=function(e,r,i,s){return e&&(e[r]||e(t,n))||i[r].substr(0,s)},h=function(e){return b.s(s%12||12,e,"0")},f=i.meridiem||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r},p={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:b.s(a+1,2,"0"),MMM:d(i.monthsShort,a,l,3),MMMM:d(l,a),D:this.$D,DD:b.s(this.$D,2,"0"),d:String(this.$W),dd:d(i.weekdaysMin,this.$W,c,2),ddd:d(i.weekdaysShort,this.$W,c,3),dddd:c[this.$W],H:String(s),HH:b.s(s,2,"0"),h:h(1),hh:h(2),a:f(s,o,!0),A:f(s,o,!1),m:String(o),mm:b.s(o,2,"0"),s:String(this.$s),ss:b.s(this.$s,2,"0"),SSS:b.s(this.$ms,3,"0"),Z:r};return n.replace(u,(function(e,t){return t||p[e]||r.replace(":","")}))},h.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},h.diff=function(e,i,l){var u,d=b.p(i),h=_(e),f=6e4*(h.utcOffset()-this.utcOffset()),p=this-h,m=b.m(this,h);return m=(u={},u[c]=m/12,u[o]=m,u[a]=m/3,u[s]=(p-f)/6048e5,u.day=(p-f)/864e5,u[r]=p/36e5,u[n]=p/6e4,u[t]=p/1e3,u)[d]||p,l?m:b.a(m)},h.daysInMonth=function(){return this.endOf(o).$D},h.$locale=function(){return m[this.$L]},h.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=v(e,t,!0);return r&&(n.$L=r),n},h.clone=function(){return b.w(this.$d,this)},h.toDate=function(){return new Date(this.valueOf())},h.toJSON=function(){return this.isValid()?this.toISOString():null},h.toISOString=function(){return this.$d.toISOString()},h.toString=function(){return this.$d.toUTCString()},d}();return _.prototype=y.prototype,_.extend=function(e,t){return e(t,y,_),_},_.locale=v,_.isDayjs=g,_.unix=function(e){return _(1e3*e)},_.en=m[p],_.Ls=m,_}()},function(e,t,n){"use strict";var r=n(59),i="object"==typeof self&&self&&self.Object===Object&&self,s=r.a||i||Function("return this")();t.a=s},function(e,t,n){"use strict";function r(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;var n,r,o,l,u,d,h,f,p=new Array(80),m=1732584193,g=-271733879,v=-1732584194,_=271733878,b=-1009589776;for(n=0;n<e.length;n+=16){for(l=m,u=g,d=v,h=_,f=b,r=0;r<80;r++)p[r]=r<16?e[n+r]:c(p[r-3]^p[r-8]^p[r-14]^p[r-16],1),o=a(a(c(m,5),i(r,g,v,_)),a(a(b,p[r]),s(r))),b=_,_=v,v=c(g,30),g=m,m=o;m=a(m,l),g=a(g,u),v=a(v,d),_=a(_,h),b=a(b,f)}return[m,g,v,_,b]}function i(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function s(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function o(e,t){var n=l(e);n.length>16&&(n=r(n,8*e.length));for(var i=new Array(16),s=new Array(16),o=0;o<16;o++)i[o]=909522486^n[o],s[o]=1549556828^n[o];var a=r(i.concat(l(t)),512+8*t.length);return r(s.concat(a),672)}function a(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function c(e,t){return e<<t|e>>>32-t}function l(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 u(e){for(var t,n,r="",i=0;i<4*e.length;i+=3)for(t=(e[i>>2]>>8*(3-i%4)&255)<<16|(e[i+1>>2]>>8*(3-(i+1)%4)&255)<<8|e[i+2>>2]>>8*(3-(i+2)%4)&255,n=0;n<4;n++)8*i+6*n>32*e.length?r+="=":r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return r}function d(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}n.d(t,"a",(function(){return h}));const h={b64_hmac_sha1:function(e,t){return u(o(e,t))},b64_sha1:function(e){return u(r(l(e),8*e.length))},binb2str:d,core_hmac_sha1:o,str_hmac_sha1:function(e,t){return d(o(e,t))},str_sha1:function(e){return d(r(l(e),8*e.length))}}},function(e,t,n){var r=n(94),i="object"==typeof self&&self&&self.Object===Object&&self,s=r||i||Function("return this")();e.exports=s},function(e,t,n){"use strict";(function(e){n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i})),n.d(t,"c",(function(){return s}));const r=function(){let t=e.WebSocket;if(void 0===t)try{t=n(484)}catch(e){throw new Error('You must install the "ws" package to use Strophe in nodejs.')}return t}();const i=function(){let t=e.DOMParser;if(void 0===t)try{t=n(57).DOMParser}catch(e){throw new Error('You must install the "xmldom" package to use Strophe in nodejs.')}return t}();function s(){if("undefined"==typeof document)try{return(new(0,n(57).DOMImplementation)).createDocument("jabber:client","strophe",null)}catch(e){throw new Error('You must install the "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)}}).call(this,n(14))},function(e,t,n){"use strict";const r=n(471),i=n(472);e.exports={atob:r,btoa:i}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";(function(e){var r=n(59),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=i&&"object"==typeof e&&e&&!e.nodeType&&e,o=s&&s.exports===i&&r.a.process,a=function(){try{var e=s&&s.require&&s.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();t.a=a}).call(this,n(62)(e))},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));!function(){let t=e.WebSocket;if(void 0===t)try{t=n(469)}catch(e){throw new Error('You must install the "ws" package to use Strophe in nodejs.')}}();const r=function(){let t=e.DOMParser;if(void 0===t)try{t=n(57).DOMParser}catch(e){throw new Error('You must install the "xmldom" package to use Strophe in nodejs.')}return t}();function i(){if("undefined"==typeof document)try{return(new(0,n(57).DOMImplementation)).createDocument("jabber:client","strophe",null)}catch(e){throw new Error('You must install the "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)}}).call(this,n(14))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var r=n(142)("wks"),i=n(143),s=n(11).Symbol,o="function"==typeof s;(e.exports=function(e){return r[e]||(r[e]=o&&s[e]||(o?s:i)("Symbol."+e))}).store=r},function(e,t,n){!function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){if(s)return s(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 i(t[o][1][e]||e)}),l,l.exports,e,t,n,r)}return n[o].exports}for(var s=!1,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){var r=e("cssfilter").FilterCSS,i=e("cssfilter").getDefaultWhiteList,s=e("./util");function o(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","loop","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height"],ins:["datetime"],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],sup:[],strong:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","loop","preload","src","height","width"]}}var a=new r;function c(e){return e.replace(l,"&lt;").replace(u,"&gt;")}var l=/</g,u=/>/g,d=/"/g,h=/&quot;/g,f=/&#([a-zA-Z0-9]*);?/gim,p=/&colon;?/gim,m=/&newline;?/gim,g=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a)\:/gi,v=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,_=/u\s*r\s*l\s*\(.*/gi;function b(e){return e.replace(d,"&quot;")}function y(e){return e.replace(h,'"')}function w(e){return e.replace(f,(function(e,t){return"x"===t[0]||"X"===t[0]?String.fromCharCode(parseInt(t.substr(1),16)):String.fromCharCode(parseInt(t,10))}))}function S(e){return e.replace(p,":").replace(m," ")}function x(e){for(var t="",n=0,r=e.length;n<r;n++)t+=e.charCodeAt(n)<32?" ":e.charAt(n);return s.trim(t)}function E(e){return e=x(e=S(e=w(e=y(e))))}function A(e){return e=c(e=b(e))}var C=/<!--[\s\S]*?-->/g;n.whiteList={a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","loop","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height"],ins:["datetime"],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],sup:[],strong:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","loop","preload","src","height","width"]},n.getDefaultWhiteList=o,n.onTag=function(e,t,n){},n.onIgnoreTag=function(e,t,n){},n.onTagAttr=function(e,t,n){},n.onIgnoreTagAttr=function(e,t,n){},n.safeAttrValue=function(e,t,n,r){if(n=E(n),"href"===t||"src"===t){if("#"===(n=s.trim(n)))return"#";if("http://"!==n.substr(0,7)&&"https://"!==n.substr(0,8)&&"mailto:"!==n.substr(0,7)&&"tel:"!==n.substr(0,4)&&"data:image/"!==n.substr(0,11)&&"ftp://"!==n.substr(0,6)&&"./"!==n.substr(0,2)&&"../"!==n.substr(0,3)&&"#"!==n[0]&&"/"!==n[0])return""}else if("background"===t){if(g.lastIndex=0,g.test(n))return""}else if("style"===t){if(v.lastIndex=0,v.test(n))return"";if(_.lastIndex=0,_.test(n)&&(g.lastIndex=0,g.test(n)))return"";!1!==r&&(n=(r=r||a).process(n))}return n=A(n)},n.escapeHtml=c,n.escapeQuote=b,n.unescapeQuote=y,n.escapeHtmlEntities=w,n.escapeDangerHtml5Entities=S,n.clearNonPrintableCharacter=x,n.friendlyAttrValue=E,n.escapeAttrValue=A,n.onIgnoreTagStripAll=function(){return""},n.StripTagBody=function(e,t){"function"!=typeof t&&(t=function(){});var n=!Array.isArray(e),r=[],i=!1;return{onIgnoreTag:function(o,a,c){if(function(t){return!!n||-1!==s.indexOf(e,t)}(o)){if(c.isClosing){var l="[/removed]",u=c.position+l.length;return r.push([!1!==i?i:c.position,u]),i=!1,l}return i||(i=c.position),"[removed]"}return t(o,a,c)},remove:function(e){var t="",n=0;return s.forEach(r,(function(r){t+=e.slice(n,r[0]),n=r[1]})),t+=e.slice(n)}}},n.stripCommentTag=function(e){return e.replace(C,"")},n.stripBlankChar=function(e){var t=e.split("");return(t=t.filter((function(e){var t=e.charCodeAt(0);return 127!==t&&(!(t<=31)||(10===t||13===t))}))).join("")},n.cssFilter=a,n.getDefaultCSSWhiteList=i},{"./util":4,cssfilter:8}],2:[function(e,t,n){var r=e("./default"),i=e("./parser"),s=e("./xss");function o(e,t){return new s(t).process(e)}for(var a in(n=t.exports=o).filterXSS=o,n.FilterXSS=s,r)n[a]=r[a];for(var a in i)n[a]=i[a];"undefined"!=typeof window&&(window.filterXSS=t.exports),"undefined"!=typeof self&&"undefined"!=typeof DedicatedWorkerGlobalScope&&self instanceof DedicatedWorkerGlobalScope&&(self.filterXSS=t.exports)},{"./default":1,"./parser":3,"./xss":5}],3:[function(e,t,n){var r=e("./util");function i(e){var t=r.spaceIndex(e);if(-1===t)var n=e.slice(1,-1);else n=e.slice(1,t+1);return"/"===(n=r.trim(n).toLowerCase()).slice(0,1)&&(n=n.slice(1)),"/"===n.slice(-1)&&(n=n.slice(0,-1)),n}function s(e){return"</"===e.slice(0,2)}var o=/[^a-zA-Z0-9_:\.\-]/gim;function a(e,t){for(;t<e.length;t++){var n=e[t];if(" "!==n)return"="===n?t:-1}}function c(e,t){for(;t>0;t--){var n=e[t];if(" "!==n)return"="===n?t:-1}}function l(e){return function(e){return'"'===e[0]&&'"'===e[e.length-1]||"'"===e[0]&&"'"===e[e.length-1]}(e)?e.substr(1,e.length-2):e}n.parseTag=function(e,t,n){"use strict";var r="",o=0,a=!1,c=!1,l=0,u=e.length,d="",h="";e:for(l=0;l<u;l++){var f=e.charAt(l);if(!1===a){if("<"===f){a=l;continue}}else if(!1===c){if("<"===f){r+=n(e.slice(o,l)),a=l,o=l;continue}if(">"===f){r+=n(e.slice(o,a)),d=i(h=e.slice(a,l+1)),r+=t(a,r.length,d,h,s(h)),o=l+1,a=!1;continue}if('"'===f||"'"===f)for(var p=1,m=e.charAt(l-p);" "===m||"="===m;){if("="===m){c=f;continue e}m=e.charAt(l-++p)}}else if(f===c){c=!1;continue}}return o<e.length&&(r+=n(e.substr(o))),r},n.parseAttr=function(e,t){"use strict";var n=0,i=[],s=!1,u=e.length;function d(e,n){if(!((e=(e=r.trim(e)).replace(o,"").toLowerCase()).length<1)){var s=t(e,n||"");s&&i.push(s)}}for(var h=0;h<u;h++){var f,p=e.charAt(h);if(!1!==s||"="!==p)if(!1===s||h!==n||'"'!==p&&"'"!==p||"="!==e.charAt(h-1))if(/\s|\n|\t/.test(p)){if(e=e.replace(/\s|\n|\t/g," "),!1===s){if(-1===(f=a(e,h))){d(r.trim(e.slice(n,h))),s=!1,n=h+1;continue}h=f-1;continue}if(-1===(f=c(e,h-1))){d(s,l(r.trim(e.slice(n,h)))),s=!1,n=h+1;continue}}else;else{if(-1===(f=e.indexOf(p,h+1)))break;d(s,r.trim(e.slice(n+1,f))),s=!1,n=(h=f)+1}else s=e.slice(n,h),n=h+1}return n<e.length&&(!1===s?d(e.slice(n)):d(s,l(r.trim(e.slice(n))))),r.trim(i.join(" "))}},{"./util":4}],4:[function(e,t,n){t.exports={indexOf:function(e,t){var n,r;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var r,i;if(Array.prototype.forEach)return e.forEach(t,n);for(r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},spaceIndex:function(e){var t=/\s|\n|\t/.exec(e);return t?t.index:-1}}},{}],5:[function(e,t,n){var r=e("cssfilter").FilterCSS,i=e("./default"),s=e("./parser"),o=s.parseTag,a=s.parseAttr,c=e("./util");function l(e){return null==e}function u(e){(e=function(e){var t={};for(var n in e)t[n]=e[n];return t}(e||{})).stripIgnoreTag&&(e.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),e.onIgnoreTag=i.onIgnoreTagStripAll),e.whiteList=e.whiteList||i.whiteList,e.onTag=e.onTag||i.onTag,e.onTagAttr=e.onTagAttr||i.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||i.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||i.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||i.safeAttrValue,e.escapeHtml=e.escapeHtml||i.escapeHtml,this.options=e,!1===e.css?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new r(e.css))}u.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t=this.options,n=t.whiteList,r=t.onTag,s=t.onIgnoreTag,u=t.onTagAttr,d=t.onIgnoreTagAttr,h=t.safeAttrValue,f=t.escapeHtml,p=this.cssFilter;t.stripBlankChar&&(e=i.stripBlankChar(e)),t.allowCommentTag||(e=i.stripCommentTag(e));var m=!1;if(t.stripIgnoreTagBody){m=i.StripTagBody(t.stripIgnoreTagBody,s);s=m.onIgnoreTag}var g=o(e,(function(e,t,i,o,m){var g,v={sourcePosition:e,position:t,isClosing:m,isWhite:n.hasOwnProperty(i)};if(!l(g=r(i,o,v)))return g;if(v.isWhite){if(v.isClosing)return"</"+i+">";var _=function(e){var t=c.spaceIndex(e);if(-1===t)return{html:"",closing:"/"===e[e.length-2]};var n="/"===(e=c.trim(e.slice(t+1,-1)))[e.length-1];return n&&(e=c.trim(e.slice(0,-1))),{html:e,closing:n}}(o),b=n[i],y=a(_.html,(function(e,t){var n,r=-1!==c.indexOf(b,e);return l(n=u(i,e,t,r))?r?(t=h(i,e,t,p))?e+'="'+t+'"':e:l(n=d(i,e,t,r))?void 0:n:n}));o="<"+i;return y&&(o+=" "+y),_.closing&&(o+=" /"),o+=">"}return l(g=s(i,o,v))?f(o):g}),f);return m&&(g=m.remove(g)),g},t.exports=u},{"./default":1,"./parser":3,"./util":4,cssfilter:8}],6:[function(e,t,n){var r=e("./default"),i=e("./parser");e("./util");function s(e){return null==e}function o(e){(e=function(e){var t={};for(var n in e)t[n]=e[n];return t}(e||{})).whiteList=e.whiteList||r.whiteList,e.onAttr=e.onAttr||r.onAttr,e.onIgnoreAttr=e.onIgnoreAttr||r.onIgnoreAttr,e.safeAttrValue=e.safeAttrValue||r.safeAttrValue,this.options=e}o.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t=this.options,n=t.whiteList,r=t.onAttr,o=t.onIgnoreAttr,a=t.safeAttrValue;return i(e,(function(e,t,i,c,l){var u=n[i],d=!1;if(!0===u?d=u:"function"==typeof u?d=u(c):u instanceof RegExp&&(d=u.test(c)),!0!==d&&(d=!1),c=a(i,c)){var h,f={position:t,sourcePosition:e,source:l,isWhite:d};return d?s(h=r(i,c,f))?i+":"+c:h:s(h=o(i,c,f))?void 0:h}}))},t.exports=o},{"./default":7,"./parser":9,"./util":10}],7:[function(e,t,n){function r(){var e={"align-content":!1,"align-items":!1,"align-self":!1,"alignment-adjust":!1,"alignment-baseline":!1,all:!1,"anchor-point":!1,animation:!1,"animation-delay":!1,"animation-direction":!1,"animation-duration":!1,"animation-fill-mode":!1,"animation-iteration-count":!1,"animation-name":!1,"animation-play-state":!1,"animation-timing-function":!1,azimuth:!1,"backface-visibility":!1,background:!0,"background-attachment":!0,"background-clip":!0,"background-color":!0,"background-image":!0,"background-origin":!0,"background-position":!0,"background-repeat":!0,"background-size":!0,"baseline-shift":!1,binding:!1,bleed:!1,"bookmark-label":!1,"bookmark-level":!1,"bookmark-state":!1,border:!0,"border-bottom":!0,"border-bottom-color":!0,"border-bottom-left-radius":!0,"border-bottom-right-radius":!0,"border-bottom-style":!0,"border-bottom-width":!0,"border-collapse":!0,"border-color":!0,"border-image":!0,"border-image-outset":!0,"border-image-repeat":!0,"border-image-slice":!0,"border-image-source":!0,"border-image-width":!0,"border-left":!0,"border-left-color":!0,"border-left-style":!0,"border-left-width":!0,"border-radius":!0,"border-right":!0,"border-right-color":!0,"border-right-style":!0,"border-right-width":!0,"border-spacing":!0,"border-style":!0,"border-top":!0,"border-top-color":!0,"border-top-left-radius":!0,"border-top-right-radius":!0,"border-top-style":!0,"border-top-width":!0,"border-width":!0,bottom:!1,"box-decoration-break":!0,"box-shadow":!0,"box-sizing":!0,"box-snap":!0,"box-suppress":!0,"break-after":!0,"break-before":!0,"break-inside":!0,"caption-side":!1,chains:!1,clear:!0,clip:!1,"clip-path":!1,"clip-rule":!1,color:!0,"color-interpolation-filters":!0,"column-count":!1,"column-fill":!1,"column-gap":!1,"column-rule":!1,"column-rule-color":!1,"column-rule-style":!1,"column-rule-width":!1,"column-span":!1,"column-width":!1,columns:!1,contain:!1,content:!1,"counter-increment":!1,"counter-reset":!1,"counter-set":!1,crop:!1,cue:!1,"cue-after":!1,"cue-before":!1,cursor:!1,direction:!1,display:!0,"display-inside":!0,"display-list":!0,"display-outside":!0,"dominant-baseline":!1,elevation:!1,"empty-cells":!1,filter:!1,flex:!1,"flex-basis":!1,"flex-direction":!1,"flex-flow":!1,"flex-grow":!1,"flex-shrink":!1,"flex-wrap":!1,float:!1,"float-offset":!1,"flood-color":!1,"flood-opacity":!1,"flow-from":!1,"flow-into":!1,font:!0,"font-family":!0,"font-feature-settings":!0,"font-kerning":!0,"font-language-override":!0,"font-size":!0,"font-size-adjust":!0,"font-stretch":!0,"font-style":!0,"font-synthesis":!0,"font-variant":!0,"font-variant-alternates":!0,"font-variant-caps":!0,"font-variant-east-asian":!0,"font-variant-ligatures":!0,"font-variant-numeric":!0,"font-variant-position":!0,"font-weight":!0,grid:!1,"grid-area":!1,"grid-auto-columns":!1,"grid-auto-flow":!1,"grid-auto-rows":!1,"grid-column":!1,"grid-column-end":!1,"grid-column-start":!1,"grid-row":!1,"grid-row-end":!1,"grid-row-start":!1,"grid-template":!1,"grid-template-areas":!1,"grid-template-columns":!1,"grid-template-rows":!1,"hanging-punctuation":!1,height:!0,hyphens:!1,icon:!1,"image-orientation":!1,"image-resolution":!1,"ime-mode":!1,"initial-letters":!1,"inline-box-align":!1,"justify-content":!1,"justify-items":!1,"justify-self":!1,left:!1,"letter-spacing":!0,"lighting-color":!0,"line-box-contain":!1,"line-break":!1,"line-grid":!1,"line-height":!1,"line-snap":!1,"line-stacking":!1,"line-stacking-ruby":!1,"line-stacking-shift":!1,"line-stacking-strategy":!1,"list-style":!0,"list-style-image":!0,"list-style-position":!0,"list-style-type":!0,margin:!0,"margin-bottom":!0,"margin-left":!0,"margin-right":!0,"margin-top":!0,"marker-offset":!1,"marker-side":!1,marks:!1,mask:!1,"mask-box":!1,"mask-box-outset":!1,"mask-box-repeat":!1,"mask-box-slice":!1,"mask-box-source":!1,"mask-box-width":!1,"mask-clip":!1,"mask-image":!1,"mask-origin":!1,"mask-position":!1,"mask-repeat":!1,"mask-size":!1,"mask-source-type":!1,"mask-type":!1,"max-height":!0,"max-lines":!1,"max-width":!0,"min-height":!0,"min-width":!0,"move-to":!1,"nav-down":!1,"nav-index":!1,"nav-left":!1,"nav-right":!1,"nav-up":!1,"object-fit":!1,"object-position":!1,opacity:!1,order:!1,orphans:!1,outline:!1,"outline-color":!1,"outline-offset":!1,"outline-style":!1,"outline-width":!1,overflow:!1,"overflow-wrap":!1,"overflow-x":!1,"overflow-y":!1,padding:!0,"padding-bottom":!0,"padding-left":!0,"padding-right":!0,"padding-top":!0,page:!1,"page-break-after":!1,"page-break-before":!1,"page-break-inside":!1,"page-policy":!1,pause:!1,"pause-after":!1,"pause-before":!1,perspective:!1,"perspective-origin":!1,pitch:!1,"pitch-range":!1,"play-during":!1,position:!1,"presentation-level":!1,quotes:!1,"region-fragment":!1,resize:!1,rest:!1,"rest-after":!1,"rest-before":!1,richness:!1,right:!1,rotation:!1,"rotation-point":!1,"ruby-align":!1,"ruby-merge":!1,"ruby-position":!1,"shape-image-threshold":!1,"shape-outside":!1,"shape-margin":!1,size:!1,speak:!1,"speak-as":!1,"speak-header":!1,"speak-numeral":!1,"speak-punctuation":!1,"speech-rate":!1,stress:!1,"string-set":!1,"tab-size":!1,"table-layout":!1,"text-align":!0,"text-align-last":!0,"text-combine-upright":!0,"text-decoration":!0,"text-decoration-color":!0,"text-decoration-line":!0,"text-decoration-skip":!0,"text-decoration-style":!0,"text-emphasis":!0,"text-emphasis-color":!0,"text-emphasis-position":!0,"text-emphasis-style":!0,"text-height":!0,"text-indent":!0,"text-justify":!0,"text-orientation":!0,"text-overflow":!0,"text-shadow":!0,"text-space-collapse":!0,"text-transform":!0,"text-underline-position":!0,"text-wrap":!0,top:!1,transform:!1,"transform-origin":!1,"transform-style":!1,transition:!1,"transition-delay":!1,"transition-duration":!1,"transition-property":!1,"transition-timing-function":!1,"unicode-bidi":!1,"vertical-align":!1,visibility:!1,"voice-balance":!1,"voice-duration":!1,"voice-family":!1,"voice-pitch":!1,"voice-range":!1,"voice-rate":!1,"voice-stress":!1,"voice-volume":!1,volume:!1,"white-space":!1,widows:!1,width:!0,"will-change":!1,"word-break":!0,"word-spacing":!0,"word-wrap":!0,"wrap-flow":!1,"wrap-through":!1,"writing-mode":!1,"z-index":!1};return e}var i=/javascript\s*\:/gim;n.whiteList=r(),n.getDefaultWhiteList=r,n.onAttr=function(e,t,n){},n.onIgnoreAttr=function(e,t,n){},n.safeAttrValue=function(e,t){return i.test(t)?"":t}},{}],8:[function(e,t,n){var r=e("./default"),i=e("./css");for(var s in(n=t.exports=function(e,t){return new i(t).process(e)}).FilterCSS=i,r)n[s]=r[s];"undefined"!=typeof window&&(window.filterCSS=t.exports)},{"./css":6,"./default":7}],9:[function(e,t,n){var r=e("./util");t.exports=function(e,t){";"!==(e=r.trimRight(e))[e.length-1]&&(e+=";");var n=e.length,i=!1,s=0,o=0,a="";function c(){if(!i){var n=r.trim(e.slice(s,o)),c=n.indexOf(":");if(-1!==c){var l=r.trim(n.slice(0,c)),u=r.trim(n.slice(c+1));if(l){var d=t(s,a.length,l,u,n);d&&(a+=d+"; ")}}}s=o+1}for(;o<n;o++){var l=e[o];if("/"===l&&"*"===e[o+1]){var u=e.indexOf("*/",o+2);if(-1===u)break;s=(o=u+1)+1,i=!1}else"("===l?i=!0:")"===l?i=!1:";"===l?i||c():"\n"===l&&c()}return r.trim(a)}},{"./util":10}],10:[function(e,t,n){t.exports={indexOf:function(e,t){var n,r;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var r,i;if(Array.prototype.forEach)return e.forEach(t,n);for(r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(e){return String.prototype.trimRight?e.trimRight():e.replace(/(\s*$)/g,"")}}},{}]},{},[2]),t.filterXSS=filterXSS,t.filterCSS=filterCSS},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},function(e,t,n){"use strict";(function(e){var r=n(5),i=n(159),s="object"==typeof exports&&exports&&!exports.nodeType&&exports,o=s&&"object"==typeof e&&e&&!e.nodeType&&e,a=o&&o.exports===s?r.a.Buffer:void 0,c=(a?a.isBuffer:void 0)||i.a;t.a=c}).call(this,n(62)(e))},function(e,t,n){var r=n(35),i=n(314),s=n(315),o=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):s(e)}},,function(e,t,n){var r=n(332),i=n(335);e.exports=function(e,t){var n=i(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(40);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){(function(t){e.exports=function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){if(s)return s(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){var n=t[o][1][e];return i(n||e)}),l,l.exports,e,t,n,r)}return n[o].exports}for(var s=!1,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,n,r){(function(e){"use strict";var t,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var s=0,o=new i(u),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),t=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)t="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var c=new e.MessageChannel;c.port1.onmessage=u,t=function(){c.port2.postMessage(0)}}var l=[];function u(){var e,t;r=!0;for(var n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}r=!1}n.exports=function(e){1!==l.push(e)||r||t()}}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var r=e(1);function i(){}var s={},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!==i&&f(this,e)}function u(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 d(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return s.reject(e,t)}r===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,r)}))}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 f(e,t){var n=!1;function r(t){n||(n=!0,s.reject(e,t))}function i(t){n||(n=!0,s.resolve(e,t))}var o=p((function(){t(i,r)}));"error"===o.status&&r(o.value)}function p(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(i);return this.state!==c?d(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){s.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=p(h,t);if("error"===n.status)return s.reject(e,n.value);var r=n.value;if(r)f(e,r);else{e.state=a,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:s.resolve(new this(i),e)},l.reject=function(e){var t=new this(i);return s.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,r=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,c=-1,l=new this(i);++c<n;)u(e[c],c);return l;function u(e,i){t.resolve(e).then((function(e){o[i]=e,++a!==n||r||(r=!0,s.resolve(l,o))}),(function(e){r||(r=!0,s.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=e.length,r=!1;if(!n)return this.resolve([]);for(var o,a=-1,c=new this(i);++a<n;)o=e[a],t.resolve(o).then((function(e){r||(r=!0,s.resolve(c,e))}),(function(e){r||(r=!0,s.reject(c,e))}));return c}},{1:1}],3:[function(e,n,r){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var r="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},i=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 s(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);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 u(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d=void 0,h={},f=Object.prototype.toString;function p(e){return"boolean"==typeof d?o.resolve(d):function(e){return new o((function(t){var n=e.transaction("local-forage-detect-blob-support","readwrite"),r=s([""]);n.objectStore("local-forage-detect-blob-support").put(r,"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 d=e}))}function m(e){var t=h[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 g(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function v(e,t){var n=h[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function _(e,t){return new o((function(n,r){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);m(e),e.db.close()}var s=[e.name];t&&s.push(e.version);var o=i.open.apply(i,s);t&&(o.onupgradeneeded=function(t){var n=o.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore("local-forage-detect-blob-support")}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(),r(o.error)},o.onsuccess=function(){n(o.result),g(e)}}))}function b(e){return _(e,!1)}function y(e){return _(e,!0)}function w(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,i=e.version>e.db.version;if(r&&(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),i||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function S(e){return s([function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}(atob(e.data))],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,n=t._initReady().then((function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(n,e,e),n}function A(e,t,n,r){void 0===r&&(r=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(r>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return o.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),y(e)})).then((function(){return function(e){m(e);for(var t=h[e.name],n=t.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,b(e).then((function(t){return e.db=t,w(e)?y(e):t})).then((function(r){e.db=t.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r})).catch((function(t){throw v(e,t),t}))}(e).then((function(){A(e,t,n,r-1)}))})).catch(n);n(i)}}var C={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var i=h[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},h[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E);var s=[];function a(){return o.resolve()}for(var c=0;c<i.forages.length;c++){var l=i.forages[c];l!==t&&s.push(l._initReady().catch(a))}var u=i.forages.slice(0);return o.all(s).then((function(){return n.db=i.db,b(n)})).then((function(e){return n.db=e,w(n,t._defaultConfig.version)?y(n):e})).then((function(e){n.db=i.db=e,t._dbInfo=n;for(var r=0;r<u.length;r++){var s=u[r];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))},_support:function(){try{if(!i||!i.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,r=new o((function(t,r){n.ready().then((function(){A(n._dbInfo,"readonly",(function(i,s){if(i)return r(i);try{var o=s.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var r=n.value;x(r)&&(r=S(r));var i=e(r,n.key,a++);void 0!==i?t(i):n.continue()}else t()},o.onerror=function(){r(o.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=new o((function(t,r){n.ready().then((function(){A(n._dbInfo,"readonly",(function(i,s){if(i)return r(i);try{var o=s.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),x(e)&&(e=S(e)),t(e)},o.onerror=function(){r(o.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,t),r},setItem:function(e,t,n){var r=this;e=l(e);var i=new o((function(n,i){var s;r.ready().then((function(){return s=r._dbInfo,"[object Blob]"===f.call(t)?p(s.db).then((function(e){return e?t:(n=t,new o((function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):t})).then((function(t){A(r._dbInfo,"readwrite",(function(s,o){if(s)return i(s);try{var a=o.objectStore(r._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;i(e)}}catch(e){i(e)}}))})).catch(i)}));return a(i,n),i},removeItem:function(e,t){var n=this;e=l(e);var r=new o((function(t,r){n.ready().then((function(){A(n._dbInfo,"readwrite",(function(i,s){if(i)return r(i);try{var o=s.objectStore(n._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){r(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return a(r,t),r},clear:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){A(t._dbInfo,"readwrite",(function(r,i){if(r)return n(r);try{var s=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=s.error?s.error:s.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(){A(t._dbInfo,"readonly",(function(r,i){if(r)return n(r);try{var s=i.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,e),n},key:function(e,t){var n=this,r=new o((function(t,r){e<0?t(null):n.ready().then((function(){A(n._dbInfo,"readonly",(function(i,s){if(i)return r(i);try{var o=s.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(){r(c.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,t),r},keys:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){A(t._dbInfo,"readonly",(function(r,i){if(r)return n(r);try{var s=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,e),n},dropInstance:function(e,t){t=u.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 r,s=this;if(e.name){var c=e.name===n.name&&s._dbInfo.db,l=c?o.resolve(s._dbInfo.db):b(e).then((function(t){var n=h[e.name],r=n.forages;n.db=t;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=t;return t}));r=e.storeName?l.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;m(e);var r=h[e.name],s=r.forages;t.close();for(var a=0;a<s.length;a++){var c=s[a];c._dbInfo.db=null,c._dbInfo.version=n}return new o((function(t,r){var s=i.open(e.name,n);s.onerror=function(e){s.result.close(),r(e)},s.onupgradeneeded=function(){s.result.deleteObjectStore(e.storeName)},s.onsuccess=function(){var e=s.result;e.close(),t(e)}})).then((function(e){r.db=e;for(var t=0;t<s.length;t++){var n=s[t];n._dbInfo.db=e,g(n._dbInfo)}})).catch((function(t){throw(v(e,t)||o.resolve()).catch((function(){})),t}))}})):l.then((function(t){m(e);var n=h[e.name],r=n.forages;t.close();for(var s=0;s<r.length;s++)r[s]._dbInfo.db=null;return new o((function(t,n){var r=i.deleteDatabase(e.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}})).then((function(e){n.db=e;for(var t=0;t<r.length;t++)g(r[t]._dbInfo)})).catch((function(t){throw(v(e,t)||o.resolve()).catch((function(){})),t}))}))}else r=o.reject("Invalid arguments");return a(r,t),r}},T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",O=/^~~local_forage_type~([^~]+)~/,j="__lfsc__:".length,k=j+"arbf".length,N=Object.prototype.toString;function M(e){var t,n,r,i,s,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var l=new ArrayBuffer(o),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=T.indexOf(e[t]),r=T.indexOf(e[t+1]),i=T.indexOf(e[t+2]),s=T.indexOf(e[t+3]),u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|i>>2,u[c++]=(3&i)<<6|63&s;return l}function I(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=T[n[t]>>2],r+=T[(3&n[t])<<4|n[t+1]>>4],r+=T[(15&n[t+1])<<2|n[t+2]>>6],r+=T[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var R={serialize:function(e,t){var n="";if(e&&(n=N.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===N.call(e.buffer))){var r,i="__lfsc__:";e instanceof ArrayBuffer?(r=e,i+="arbf"):(r=e.buffer,"[object Int8Array]"===n?i+="si08":"[object Uint8Array]"===n?i+="ui08":"[object Uint8ClampedArray]"===n?i+="uic8":"[object Int16Array]"===n?i+="si16":"[object Uint16Array]"===n?i+="ur16":"[object Int32Array]"===n?i+="si32":"[object Uint32Array]"===n?i+="ui32":"[object Float32Array]"===n?i+="fl32":"[object Float64Array]"===n?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+I(r))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n="~~local_forage_type~"+e.type+"~"+I(this.result);t("__lfsc__:blob"+n)},s.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("__lfsc__:"!==e.substring(0,j))return JSON.parse(e);var t,n=e.substring(k),r=e.substring(j,k);if("blob"===r&&O.test(n)){var i=n.match(O);t=i[1],n=n.substring(i[0].length)}var o=M(n);switch(r){case"arbf":return o;case"blob":return s([o],{type:t});case"si08":return new Int8Array(o);case"ui08":return new Uint8Array(o);case"uic8":return new Uint8ClampedArray(o);case"si16":return new Int16Array(o);case"ur16":return new Uint16Array(o);case"si32":return new Int32Array(o);case"ui32":return new Uint32Array(o);case"fl32":return new Float32Array(o);case"fl64":return new Float64Array(o);default:throw new Error("Unkown type: "+r)}},stringToBuffer:M,bufferToString:I};function D(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function L(e,t,n,r,i,s){e.executeSql(n,r,i,(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?s(e,o):D(e,t,(function(){e.executeSql(n,r,i,s)}),s)}),s):s(e,o)}),s)}function z(e,t,n,r){var i=this;e=l(e);var s=new o((function(s,o){i.ready().then((function(){void 0===t&&(t=null);var a=t,c=i._dbInfo;c.serializer.serialize(t,(function(t,l){l?o(l):c.db.transaction((function(n){L(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void s(z.apply(i,[e,a,n,r-1]));o(t)}}))}))})).catch(o)}));return a(s,n),s}function P(e){return new o((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var i=[],s=0;s<r.rows.length;s++)i.push(r.rows.item(s).name);t({db:e,storeNames:i})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}var F={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var i=new o((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(i){D(i,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=R,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new o((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){L(n,i,"SELECT * FROM "+i.storeName,[],(function(n,r){for(var s=r.rows,o=s.length,a=0;a<o;a++){var c=s.item(a),l=c.value;if(l&&(l=i.serializer.deserialize(l)),void 0!==(l=e(l,c.key,a+1)))return void t(l)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=new o((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){L(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=i.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,t),r},setItem:function(e,t,n){return z.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=l(e);var r=new o((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){L(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,t),r},clear:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){L(t,r,"DELETE FROM "+r.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 r=t._dbInfo;r.db.transaction((function(t){L(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,e),n},key:function(e,t){var n=this,r=new o((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){L(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,t),r},keys:function(e){var t=this,n=new o((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){L(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],i=0;i<n.rows.length;i++)r.push(n.rows.item(i).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,e),n},dropInstance:function(e,t){t=u.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 r,i=this;return a(r=e.name?new o((function(t){var r;r=e.name===n.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(P(r))})).then((function(e){return new o((function(t,n){e.db.transaction((function(r){function i(e){return new o((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var s=[],a=0,c=e.storeNames.length;a<c;a++)s.push(i(e.storeNames[a]));o.all(s).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):o.reject("Invalid arguments"),t),r}};function B(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function H(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(e){return!0}}()||localStorage.length>0}var q={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=B(e,this._defaultConfig),H()?(this._dbInfo=t,t.serializer=R,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,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,i=r.length,s=localStorage.length,o=1,a=0;a<s;a++){var c=localStorage.key(a);if(0===c.indexOf(r)){var l=localStorage.getItem(c);if(l&&(l=t.serializer.deserialize(l)),void 0!==(l=e(l,c.substring(i),o++)))return l}}}));return a(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return a(r,t),r},setItem:function(e,t,n){var r=this;e=l(e);var i=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new o((function(i,s){var o=r._dbInfo;o.serializer.serialize(t,(function(t,r){if(r)s(r);else try{localStorage.setItem(o.keyPrefix+e,t),i(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||s(e),s(e)}}))}))}));return a(i,n),i},removeItem:function(e,t){var n=this;e=l(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return a(r,t),r},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 r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));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,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return a(r,t),r},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],i=0;i<n;i++){var s=localStorage.key(i);0===s.indexOf(e.keyPrefix)&&r.push(s.substring(e.keyPrefix.length))}return r}));return a(n,e),n},dropInstance:function(e,t){if(t=u.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 r,i=this;return a(r=e.name?new o((function(t){e.storeName?t(B(e,i._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"),t),r}},U=function(e,t){for(var n,r,i=e.length,s=0;s<i;){if((n=e[s])===(r=t)||"number"==typeof n&&"number"==typeof r&&isNaN(n)&&isNaN(r))return!0;s++}return!1},V=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},$={},G={},W={INDEXEDDB:C,WEBSQL:F,LOCALSTORAGE:q},J=[W.INDEXEDDB._driver,W.WEBSQL._driver,W.LOCALSTORAGE._driver],X=["dropInstance"],Q=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(X),Y={description:"",driver:J.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function K(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function Z(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(V(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ee=new(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),W)if(W.hasOwnProperty(n)){var r=W[n],i=r._driver;this[n]=i,$[i]||this.defineDriver(r)}this._defaultConfig=Z({},Y),this._config=Z({},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":r(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 r=new o((function(t,n){try{var r=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(i);for(var s=Q.concat("_initStorage"),c=0,l=s.length;c<l;c++){var u=s[c];if((!U(X,u)||e[u])&&"function"!=typeof e[u])return void n(i)}!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,r=X.length;n<r;n++){var i=X[n];e[i]||(e[i]=t(i))}}();var d=function(n){$[r]&&console.info("Redefining LocalForage driver: "+r),$[r]=e,G[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return c(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=$[e]?o.resolve($[e]):o.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=o.resolve(R);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 r=this;V(e)||(e=[e]);var i=this._getSupportedDrivers(e);function s(){r._config.driver=r.driver()}function a(e){return r._extend(e),s(),r._ready=r._initStorage(r._config),r._ready}var l=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=l.then((function(){var e=i[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,s(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var i=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(i).then(a).catch(n)}s();var c=new Error("No available storage method found.");return r._driverSet=o.reject(c),r._driverSet}()}}(i)}))})).catch((function(){s();var e=new Error("No available storage method found.");return r._driverSet=o.reject(e),r._driverSet})),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!G[e]},e.prototype._extend=function(e){Z(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=Q.length;e<t;e++)K(this,Q[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ee},{3:3}]},{},[4])(4)}).call(this,n(14))},function(e,t,n){var r=n(58),i=n(66);e.exports=function(e){return null!=e&&i(e.length)&&!r(e)}},function(e,t,n){var r=n(11),i=n(19),s=n(53),o=n(28),a=n(55),c=function(e,t,n){var l,u,d,h=e&c.F,f=e&c.G,p=e&c.S,m=e&c.P,g=e&c.B,v=e&c.W,_=f?i:i[t]||(i[t]={}),b=_.prototype,y=f?r:p?r[t]:(r[t]||{}).prototype;for(l in f&&(n=t),n)(u=!h&&y&&void 0!==y[l])&&a(_,l)||(d=u?y[l]:n[l],_[l]=f&&"function"!=typeof y[l]?n[l]:g&&u?s(d,r):v&&y[l]==d?function(e){var t=function(t,n,r){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,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):m&&"function"==typeof d?s(Function.call,d):d,m&&((_.virtual||(_.virtual={}))[l]=d,e&c.R&&b&&!b[l]&&o(b,l,d)))};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},function(e,t,n){var r=n(39),i=n(138);e.exports=n(29)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){e.exports=!n(79)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(96),i=n(99),s=n(26);e.exports=function(e){return s(e)?r(e):i(e)}},function(e,t,n){(function(n){var r,i,s;i=[],void 0===(s="function"==typeof(r=function(){"use strict";var e=void 0!==n?n:this||window,t=document,r=t.documentElement,i="body",s=e.BSN={},o=s.supports=[],a="data-toggle",c="delay",l="target",u="animation",d="onmouseleave"in t?["mouseenter","mouseleave"]:["mouseover","mouseout"],h="getAttribute",f="setAttribute",p="parentNode",m="length",g="style",v="push",_="active",b="left",y="top",w=/\b(top|bottom|left|right)+/,S=0,x="WebkitTransition"in r[g]||"Transition".toLowerCase()in r[g],E="WebkitTransition"in r[g]?"Webkit".toLowerCase()+"TransitionEnd":"Transition".toLowerCase()+"end",A="WebkitDuration"in r[g]?"Webkit".toLowerCase()+"TransitionDuration":"Transition".toLowerCase()+"Duration",C=function(e){e.focus?e.focus():e.setActive()},T=function(e,t){e.classList.add(t)},O=function(e,t){e.classList.remove(t)},j=function(e,t){return e.classList.contains(t)},k=function(e,t){return[].slice.call(e.getElementsByClassName(t))},N=function(e,n){return"object"==typeof e?e:(n||t).querySelector(e)},M=function(e,n){var r=n.charAt(0),i=n.substr(1);if("."===r){for(;e&&e!==t;e=e[p])if(null!==N(n,e[p])&&j(e,i))return e}else if("#"===r)for(;e&&e!==t;e=e[p])if(e.id===i)return e;return!1},I=function(e,t,n,r){r=r||!1,e.addEventListener(t,n,r)},R=function(e,t,n,r){r=r||!1,e.removeEventListener(t,n,r)},D=function(e,t,n,r){I(e,t,(function i(s){n(s),R(e,t,i,r)}),r)},L=!!function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});D(e,"testPassive",null,n)}catch(e){}return t}()&&{passive:!0},z=function(t){var n=x?e.getComputedStyle(t)[A]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n},P=function(e,t){var n=0;z(e)?D(e,E,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},F=function(e,t,n){var r=new CustomEvent(e+".bs."+t);r.relatedTarget=n,this.dispatchEvent(r)},B=function(n,s,o,a){var c,l,u,d,h,f,p=s.offsetWidth,m=s.offsetHeight,v=r.clientWidth||t[i].clientWidth,_=r.clientHeight||t[i].clientHeight,S=n.getBoundingClientRect(),x=a===t[i]?{y:e.pageYOffset||r.scrollTop,x:e.pageXOffset||r.scrollLeft}:{x:a.offsetLeft+a.scrollLeft,y:a.offsetTop+a.scrollTop},E=S.right-S[b],A=S.bottom-S.top,C=j(s,"popover"),T=N(".arrow",s),O=S.top+A/2-m/2<0,k=S[b]+E/2-p/2<0,M=S[b]+p/2+E/2>=v,I=S.top+m/2+A/2>=_,R=S.top-m<0,D=S[b]-p<0,L=S.top+m+A>=_,z=S[b]+p+E>=v;o="right"===(o=(o="bottom"===(o=(o=(o===b||"right"===o)&&D&&z?y:o)===y&&R?"bottom":o)&&L?y:o)===b&&D?"right":o)&&z?b:o,-1===s.className.indexOf(o)&&(s.className=s.className.replace(w,o)),h=T.offsetWidth,f=T.offsetHeight,o===b||"right"===o?(l=o===b?S[b]+x.x-p-(C?h:0):S[b]+x.x+E,O?(c=S.top+x.y,u=A/2-h):I?(c=S.top+x.y-m+A,u=m-A/2-h):(c=S.top+x.y-m/2+A/2,u=m/2-(C?.9*f:f/2))):o!==y&&"bottom"!==o||(c=o===y?S.top+x.y-m-(C?f:0):S.top+x.y+A,k?(l=0,d=S[b]+E/2-h):M?(l=v-1.01*p,d=p-(v-S[b])+E/2-h/2):(l=S[b]+x.x-p/2+E/2,d=p/2-(C?h:h/2))),s[g].top=c+"px",s[g][b]=l+"px",u&&(T[g].top=u+"px"),d&&(T[g][b]=d+"px")};s.version="2.0.27";var H=function(e){e=N(e);var t=this,n=M(e,".alert"),r=function(r){n=M(r[l],".alert"),(e=N('[data-dismiss="alert"]',n))&&n&&(e===r[l]||e.contains(r[l]))&&t.close()},i=function(){F.call(n,"closed","alert"),R(e,"click",r),n[p].removeChild(n)};this.close=function(){n&&e&&j(n,"show")&&(F.call(n,"close","alert"),O(n,"show"),n&&(j(n,"fade")?P(n,i):i()))},"Alert"in e||I(e,"click",r),e.Alert=t};o[v](["Alert",H,'[data-dismiss="alert"]']);var q=function(e){e=N(e);var n=!1,r="checked",i=function(t){var i="LABEL"===t[l].tagName?t[l]:"LABEL"===t[l][p].tagName?t[l][p]:null;if(i){var s=k(i[p],"btn"),o=i.getElementsByTagName("INPUT")[0];if(o){if("checkbox"===o.type&&(o[r]?(O(i,_),o[h](r),o.removeAttribute(r),o[r]=!1):(T(i,_),o[h](r),o[f](r,r),o[r]=!0),n||(n=!0,F.call(o,"change","button"),F.call(e,"change","button"))),"radio"===o.type&&!n&&(!o[r]||0===t.screenX&&0==t.screenY)){T(i,_),T(i,"focus"),o[f](r,r),o[r]=!0,F.call(o,"change","button"),F.call(e,"change","button"),n=!0;for(var a=0,c=s[m];a<c;a++){var u=s[a],d=u.getElementsByTagName("INPUT")[0];u!==i&&j(u,_)&&(O(u,_),d.removeAttribute(r),d[r]=!1,F.call(d,"change","button"))}}setTimeout((function(){n=!1}),50)}}},s=function(e){T(e[l][p],"focus")},o=function(e){O(e[l][p],"focus")};if(!("Button"in e)){I(e,"click",i),I(e,"keyup",(function(e){32===(e.which||e.keyCode)&&e[l]===t.activeElement&&i(e)})),I(e,"keydown",(function(e){32===(e.which||e.keyCode)&&e.preventDefault()}));for(var a=k(e,"btn"),c=0;c<a.length;c++){var u=a[c].getElementsByTagName("INPUT")[0];I(u,"focus",s),I(u,"blur",o)}}var d=k(e,"btn"),g=d[m];for(c=0;c<g;c++)!j(d[c],_)&&N("input:checked",d[c])&&T(d[c],_);e.Button=this};o[v](["Button",q,"["+a+'="buttons"]']);var U=function(e,t){e=N(e),t=t||{};var n,r,i,s,o,a=null,c=null,l=this,u=e[h]("data-parent"),d=function(e,t){F.call(e,"hide","collapse"),e.isAnimating=!0,e[g].height=e.scrollHeight+"px",O(e,"collapse"),O(e,"show"),T(e,"collapsing"),e.offsetWidth,e[g].height="0px",P(e,(function(){e.isAnimating=!1,e[f]("aria-expanded","false"),t[f]("aria-expanded","false"),O(e,"collapsing"),T(e,"collapse"),e[g].height="",F.call(e,"hidden","collapse")}))};this.toggle=function(e){e.preventDefault(),j(c,"show")?l.hide():l.show()},this.hide=function(){c.isAnimating||(d(c,e),T(e,"collapsed"))},this.show=function(){var t,i;a&&(n=N(".collapse.show",a),r=n&&(N('[data-target="#'+n.id+'"]',a)||N('[href="#'+n.id+'"]',a))),(!c.isAnimating||n&&!n.isAnimating)&&(r&&n!==c&&(d(n,r),T(r,"collapsed")),i=e,F.call(t=c,"show","collapse"),t.isAnimating=!0,T(t,"collapsing"),O(t,"collapse"),t[g].height=t.scrollHeight+"px",P(t,(function(){t.isAnimating=!1,t[f]("aria-expanded","true"),i[f]("aria-expanded","true"),O(t,"collapsing"),T(t,"collapse"),T(t,"show"),t[g].height="",F.call(t,"shown","collapse")})),O(e,"collapsed"))},"Collapse"in e||I(e,"click",l.toggle),i=e.href&&e[h]("href"),s=e[h]("data-target"),o=i||s&&"#"===s.charAt(0)&&s,(c=o&&N(o)).isAnimating=!1,a=N(t.parent)||u&&M(e,u),e.Collapse=l};o[v](["Collapse",U,"["+a+'="collapse"]']);var V=function(e,n){e=N(e),this.persist=!0===n||"true"===e[h]("data-persist")||!1;var r=this,i=e[p],s=null,o=N(".dropdown-menu",i),c=function(){for(var e=o.children,t=[],n=0;n<e[m];n++)e[n].children[m]&&"A"===e[n].children[0].tagName&&t[v](e[n].children[0]),"A"===e[n].tagName&&t[v](e[n]);return t}(),u=function(e){(e.href&&"#"===e.href.slice(-1)||e[p]&&e[p].href&&"#"===e[p].href.slice(-1))&&this.preventDefault()},d=function(){var n=e.open?I:R;n(t,"click",g),n(t,"keydown",b),n(t,"keyup",y),n(t,"focus",g,!0)},g=function(t){var n=t[l],i=n&&(n[h](a)||n[p]&&h in n[p]&&n[p][h](a));("focus"!==t.type||n!==e&&n!==o&&!o.contains(n))&&(n!==o&&!o.contains(n)||!r.persist&&!i)&&(s=n===e||e.contains(n)?e:null,S(),u.call(t,n))},_=function(t){s=e,w(),u.call(t,t[l])},b=function(e){var t=e.which||e.keyCode;38!==t&&40!==t||e.preventDefault()},y=function(n){var i=n.which||n.keyCode,a=t.activeElement,l=c.indexOf(a),u=a===e,d=o.contains(a),h=a[p]===o||a[p][p]===o;h&&(l=u?0:38===i?l>1?l-1:0:40===i&&l<c[m]-1?l+1:l,c[l]&&C(c[l])),(c[m]&&h||!c[m]&&(d||u)||!d)&&e.open&&27===i&&(r.toggle(),s=null)},w=function(){F.call(i,"show","dropdown",s),T(o,"show"),T(i,"show"),e[f]("aria-expanded",!0),F.call(i,"shown","dropdown",s),e.open=!0,R(e,"click",_),setTimeout((function(){C(o.getElementsByTagName("INPUT")[0]||e),d()}),1)},S=function(){F.call(i,"hide","dropdown",s),O(o,"show"),O(i,"show"),e[f]("aria-expanded",!1),F.call(i,"hidden","dropdown",s),e.open=!1,d(),C(e),setTimeout((function(){I(e,"click",_)}),1)};e.open=!1,this.toggle=function(){j(i,"show")&&e.open?S():w()},"Dropdown"in e||(!1 in o&&o[f]("tabindex","0"),I(e,"click",_)),e.Dropdown=r};o[v](["Dropdown",V,"["+a+'="dropdown"]']);var $=function(n,s){var o=(n=N(n))[h]("data-target")||n[h]("href"),a=N(o),c=j(n,"modal")?n:a;if(j(n,"modal")&&(n=null),c){s=s||{},this.keyboard=!1!==s.keyboard&&"false"!==c[h]("data-keyboard"),this.backdrop="static"!==s.backdrop&&"static"!==c[h]("data-backdrop")||"static",this.backdrop=!1!==s.backdrop&&"false"!==c[h]("data-backdrop")&&this.backdrop,this[u]=!!j(c,"fade"),this.content=s.content,c.isAnimating=!1;var d,v,_,y,w,E=this,A=null,M=k(r,"fixed-top").concat(k(r,"fixed-bottom")),D=function(){var n,r=e.getComputedStyle(t[i]),s=parseInt(r.paddingRight,10);if(d&&(t[i][g].paddingRight=s+v+"px",c[g].paddingRight=v+"px",M[m]))for(var o=0;o<M[m];o++)n=e.getComputedStyle(M[o]).paddingRight,M[o][g].paddingRight=parseInt(n)+v+"px"},B=function(){var n,s,o;d=t[i].clientWidth<(n=r.getBoundingClientRect(),e.innerWidth||n.right-Math.abs(n[b])),(o=t.createElement("div")).className="modal-scrollbar-measure",t[i].appendChild(o),s=o.offsetWidth-o.clientWidth,t[i].removeChild(o),v=s},H=function(){(_=N(".modal-backdrop"))&&null!==_&&"object"==typeof _&&(S=0,t[i].removeChild(_),_=null)},q=function(){C(c),c.isAnimating=!1,F.call(c,"shown","modal",A),I(e,"resize",E.update,L),I(c,"click",$),I(t,"keydown",V)},U=function(){c[g].display="",n&&C(n),F.call(c,"hidden","modal"),k(t,"modal show")[0]||(function(){if(t[i][g].paddingRight="",c[g].paddingRight="",M[m])for(var e=0;e<M[m];e++)M[e][g].paddingRight=""}(),O(t[i],"modal-open"),_&&j(_,"fade")?(O(_,"show"),P(_,H)):H(),R(e,"resize",E.update,L),R(c,"click",$),R(t,"keydown",V)),c.isAnimating=!1},V=function(e){c.isAnimating||E.keyboard&&27==e.which&&j(c,"show")&&E.hide()},$=function(e){if(!c.isAnimating){var t=e[l];j(c,"show")&&("modal"===t[p][h]("data-dismiss")||"modal"===t[h]("data-dismiss")||t===c&&"static"!==E.backdrop)&&(E.hide(),A=null,e.preventDefault())}};this.toggle=function(){j(c,"show")?this.hide():this.show()},this.show=function(){j(c,"show")||c.isAnimating||(clearTimeout(w),w=setTimeout((function(){c.isAnimating=!0,F.call(c,"show","modal",A);var e,n=k(t,"modal show")[0];n&&n!==c&&("modalTrigger"in n&&n.modalTrigger.Modal.hide(),"Modal"in n&&n.Modal.hide()),E.backdrop&&!S&&!_&&(e=t.createElement("div"),null===(_=N(".modal-backdrop"))&&(e[f]("class","modal-backdrop"+(E[u]?" fade":"")),_=e,t[i].appendChild(_)),S=1),_&&!j(_,"show")&&(_.offsetWidth,y=z(_),T(_,"show")),setTimeout((function(){c[g].display="block",B(),D(),T(t[i],"modal-open"),T(c,"show"),c[f]("aria-hidden",!1),j(c,"fade")?P(c,q):q()}),x&&_&&y?y:1)}),1))},this.hide=function(){!c.isAnimating&&j(c,"show")&&(clearTimeout(w),w=setTimeout((function(){c.isAnimating=!0,F.call(c,"hide","modal"),_=N(".modal-backdrop"),y=_&&z(_),O(c,"show"),c[f]("aria-hidden",!0),setTimeout((function(){j(c,"fade")?P(c,U):U()}),x&&_&&y?y:2)}),2))},this.setContent=function(e){N(".modal-content",c).innerHTML=e},this.update=function(){j(c,"show")&&(B(),D())},n&&!("Modal"in n)&&I(n,"click",(function(e){if(!c.isAnimating){var t=e[l];(t=t.hasAttribute("data-target")||t.hasAttribute("href")?t:t[p])!==n||j(c,"show")||(c.modalTrigger=n,A=n,E.show(),e.preventDefault())}})),E.content&&E.setContent(E.content),n?(n.Modal=E,c.modalTrigger=n):c.Modal=E}};o[v](["Modal",$,"["+a+'="modal"]']);var G=function(n,r){n=N(n),r=r||{};var s=n[h]("data-trigger"),o=n[h]("data-animation"),a=n[h]("data-placement"),p=n[h]("data-dismissible"),m=n[h]("data-delay"),v=n[h]("data-container"),_='<button type="button" class="close">×</button>',b=N(r.container),w=N(v),S=M(n,".modal"),x=M(n,".fixed-top"),E=M(n,".fixed-bottom");this.template=r.template?r.template:null,this.trigger=r.trigger?r.trigger:s||"hover",this[u]=r[u]&&"fade"!==r[u]?r[u]:o||"fade",this.placement=r.placement?r.placement:a||y,this[c]=parseInt(r[c]||m)||200,this.dismissible=!(!r.dismissible&&"true"!==p),this.container=b||w||x||E||S||t[i];var A=this,C=r.title||n[h]("data-title")||null,k=r.content||n[h]("data-content")||null;if(k||this.template){var D=null,z=0,H=this.placement,q=function(e){null!==D&&e[l]===N(".close",D)&&A.hide()},U=function(r){"click"!=A.trigger&&"focus"!=A.trigger||!A.dismissible&&r(n,"blur",A.hide),A.dismissible&&r(t,"click",q),r(e,"resize",A.hide,L)},V=function(){U(I),F.call(n,"shown","popover")},$=function(){U(R),A.container.removeChild(D),z=null,D=null,F.call(n,"hidden","popover")};this.toggle=function(){null===D?A.show():A.hide()},this.show=function(){clearTimeout(z),z=setTimeout((function(){null===D&&(H=A.placement,function(){C=r.title||n[h]("data-title"),k=(k=r.content||n[h]("data-content"))?k.trim():null,D=t.createElement("div");var e=t.createElement("div");if(e[f]("class","arrow"),D.appendChild(e),null!==k&&null===A.template){if(D[f]("role","tooltip"),null!==C){var i=t.createElement("h3");i[f]("class","popover-header"),i.innerHTML=A.dismissible?C+_:C,D.appendChild(i)}var s=t.createElement("div");s[f]("class","popover-body"),s.innerHTML=A.dismissible&&null===C?k+_:k,D.appendChild(s)}else{var o=t.createElement("div");A.template=A.template.trim(),o.innerHTML=A.template,D.innerHTML=o.firstChild.innerHTML}A.container.appendChild(D),D[g].display="block",D[f]("class","popover bs-popover-"+H+" "+A[u])}(),B(n,D,H,A.container),!j(D,"show")&&T(D,"show"),F.call(n,"show","popover"),A[u]?P(D,V):V())}),20)},this.hide=function(){clearTimeout(z),z=setTimeout((function(){D&&null!==D&&j(D,"show")&&(F.call(n,"hide","popover"),O(D,"show"),A[u]?P(D,$):$())}),A[c])},"Popover"in n||("hover"===A.trigger?(I(n,d[0],A.show),A.dismissible||I(n,d[1],A.hide)):"click"!=A.trigger&&"focus"!=A.trigger||I(n,A.trigger,A.toggle)),n.Popover=A}};o[v](["Popover",G,"["+a+'="popover"]']);var W=function(e,t){var n=(e=N(e))[h]("data-height");t=t||{},this.height=!!x&&(t.height||"true"===n);var r,i,s,o,a,c,l,u=this,d=M(e,".nav"),v=!1,y=d&&N(".dropdown-toggle",d),w=function(){v[g].height="",O(v,"collapsing"),d.isAnimating=!1},S=function(){v?c?w():setTimeout((function(){v[g].height=l+"px",v.offsetWidth,P(v,w)}),50):d.isAnimating=!1,F.call(r,"shown","tab",i)},E=function(){v&&(s[g].float=b,o[g].float=b,a=s.scrollHeight),T(o,_),F.call(r,"show","tab",i),O(s,_),F.call(i,"hidden","tab",r),v&&(l=o.scrollHeight,c=l===a,T(v,"collapsing"),v[g].height=a+"px",v.offsetHeight,s[g].float="",o[g].float=""),j(o,"fade")?setTimeout((function(){T(o,"show"),P(o,S)}),20):S()};if(d){d.isAnimating=!1;var A=function(){var e,t=k(d,_);return 1!==t[m]||j(t[0][p],"dropdown")?t[m]>1&&(e=t[t[m]-1]):e=t[0],e},C=function(){return N(A()[h]("href"))};this.show=function(){o=N((r=r||e)[h]("href")),i=A(),s=C(),d.isAnimating=!0,O(i,_),i[f]("aria-selected","false"),T(r,_),r[f]("aria-selected","true"),y&&(j(e[p],"dropdown-menu")?j(y,_)||T(y,_):j(y,_)&&O(y,_)),F.call(i,"hide","tab",r),j(s,"fade")?(O(s,"show"),P(s,E)):E()},"Tab"in e||I(e,"click",(function(e){e.preventDefault(),r=e.currentTarget,!d.isAnimating&&!j(r,_)&&u.show()})),u.height&&(v=C()[p]),e.Tab=u}};o[v](["Tab",W,"["+a+'="tab"]']);var J=function(e,t){t=t||{};var n=(e=N(e))[h]("data-animation"),r=e[h]("data-autohide"),i=e[h]("data-delay");this.animation=!1===t.animation||"false"===n?0:1,this.autohide=!1===t.autohide||"false"===r?0:1,this[c]=parseInt(t[c]||i)||500;var s=this,o=0,a=M(e,".toast"),l=function(){O(a,"showing"),T(a,"show"),F.call(a,"shown","toast"),s.autohide&&s.hide()},u=function(){T(a,"hide"),F.call(a,"hidden","toast")},d=function(){O(a,"show"),s.animation?P(a,u):u()},f=function(){clearTimeout(o),o=null,T(a,"hide"),R(e,"click",s.hide),e.Toast=null,e=null,a=null};this.show=function(){a&&(F.call(a,"show","toast"),s.animation&&T(a,"fade"),O(a,"hide"),T(a,"showing"),s.animation?P(a,l):l())},this.hide=function(e){a&&j(a,"show")&&(F.call(a,"hide","toast"),e?d():o=setTimeout(d,s[c]))},this.dispose=function(){a&&j(a,"show")&&(O(a,"show"),s.animation?P(a,f):f())},"Toast"in e||I(e,"click",s.hide),e.Toast=s};o[v](["Toast",J,'[data-dismiss="toast"]']);var X=function(n,r){r=r||{};var s=(n=N(n))[h]("data-animation"),o=n[h]("data-placement"),a=n[h]("data-delay"),l=n[h]("data-container"),p=N(r.container),m=N(l),v=M(n,".modal"),_=M(n,".fixed-top"),w=M(n,".fixed-bottom");this[u]=r[u]&&"fade"!==r[u]?r[u]:s||"fade",this.placement=r.placement?r.placement:o||y,this[c]=parseInt(r[c]||a)||200,this.container=p||m||_||w||v||t[i];var S=this,x=0,E=this.placement,A=null,C=n[h]("title")||n[h]("data-title")||n[h]("data-original-title");if(C&&""!=C){var k=function(){I(e,"resize",S.hide,L),F.call(n,"shown","tooltip")},D=function(){R(e,"resize",S.hide,L),S.container.removeChild(A),A=null,x=null,F.call(n,"hidden","tooltip")};this.show=function(){clearTimeout(x),x=setTimeout((function(){null===A&&(E=S.placement,!1!==function(){if((C=n[h]("title")||n[h]("data-title")||n[h]("data-original-title"))&&""!==C){(A=t.createElement("div"))[f]("role","tooltip"),A[g][b]="0",A[g].top="0";var e=t.createElement("div");e[f]("class","arrow"),A.appendChild(e);var r=t.createElement("div");r[f]("class","tooltip-inner"),A.appendChild(r),r.innerHTML=C,S.container.appendChild(A),A[f]("class","tooltip bs-tooltip-"+E+" "+S[u])}}()&&(B(n,A,E,S.container),!j(A,"show")&&T(A,"show"),F.call(n,"show","tooltip"),S[u]?P(A,k):k()))}),20)},this.hide=function(){clearTimeout(x),x=setTimeout((function(){A&&j(A,"show")&&(F.call(n,"hide","tooltip"),O(A,"show"),S[u]?P(A,D):D())}),S[c])},this.toggle=function(){A?S.hide():S.show()},"Tooltip"in n||(n[f]("data-original-title",C),n.removeAttribute("title"),I(n,d[0],S.show),I(n,d[1],S.hide)),n.Tooltip=S}};o[v](["Tooltip",X,"["+a+'="tooltip"]']);var Q=function(e,t){for(var n=0,r=t[m];n<r;n++)new e(t[n])},Y=s.initCallback=function(e){e=e||t;for(var n=0,r=o[m];n<r;n++)Q(o[n][1],e.querySelectorAll(o[n][2]))};return t[i]?Y():I(t,"DOMContentLoaded",(function(){Y()})),{Alert:H,Button:q,Collapse:U,Dropdown:V,Modal:$,Popover:G,Tab:W,Toast:J,Tooltip:X}})?r.apply(t,i):r)||(e.exports=s)}).call(this,n(14))},function(e,t,n){var r,i,s;
/*!
* URI.js - Mutating URLs
*
* Version: 1.19.2
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/!function(o,a){"use strict";e.exports?e.exports=a(n(155),n(156),n(157)):(i=[n(155),n(156),n(157)],void 0===(s="function"==typeof(r=a)?r.apply(t,i):r)||(e.exports=s))}(0,(function(e,t,n,r){"use strict";var i=r&&r.URI;function s(e,t){var n=arguments.length>=1,r=arguments.length>=2;if(!(this instanceof s))return n?r?new s(e,t):new s(e):new s;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}s.version="1.19.2";var o=s.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 u(e){return"Array"===l(e)}function d(e,t){var n,r,i={};if("RegExp"===l(t))i=null;else if(u(t))for(n=0,r=t.length;n<r;n++)i[t[n]]=!0;else i[t]=!0;for(n=0,r=e.length;n<r;n++){(i&&void 0!==i[e[n]]||!i&&t.test(e[n]))&&(e.splice(n,1),r--,n--)}return e}function h(e,t){var n,r;if(u(t)){for(n=0,r=t.length;n<r;n++)if(!h(e,t[n]))return!1;return!0}var i=l(t);for(n=0,r=e.length;n<r;n++)if("RegExp"===i){if("string"==typeof e[n]&&e[n].match(t))return!0}else if(e[n]===t)return!0;return!1}function f(e,t){if(!u(e)||!u(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function p(e){return e.replace(/^\/+|\/+$/g,"")}function m(e){return escape(e)}function g(e){return encodeURIComponent(e).replace(/[!'()*]/g,m).replace(/\*/g,"%2A")}s._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:s.preventInvalidHostname,duplicateQueryParameters:s.duplicateQueryParameters,escapeQuerySpace:s.escapeQuerySpace}},s.preventInvalidHostname=!1,s.duplicateQueryParameters=!1,s.escapeQuerySpace=!0,s.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,s.idn_expression=/[^a-z0-9\._-]/i,s.punycode_expression=/(xn--)/i,s.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,s.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*$/,s.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,s.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},s.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},s.hostProtocols=["http","https"],s.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,s.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"},s.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return s.domAttributes[t]}},s.encode=g,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=g,s.decode=decodeURIComponent},s.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"}}}},s.encodeQuery=function(e,t){var n=s.encode(e+"");return void 0===t&&(t=s.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},s.decodeQuery=function(e,t){e+="",void 0===t&&(t=s.escapeQuerySpace);try{return s.decode(t?e.replace(/\+/g,"%20"):e)}catch(t){return e}};var v,_={encode:"encode",decode:"decode"},b=function(e,t){return function(n){try{return s[t](n+"").replace(s.characters[e][t].expression,(function(n){return s.characters[e][t].map[n]}))}catch(e){return n}}};for(v in _)s[v+"PathSegment"]=b("pathname",_[v]),s[v+"UrnPathSegment"]=b("urnpath",_[v]);var y=function(e,t,n){return function(r){var i;i=n?function(e){return s[t](s[n](e))}:s[t];for(var o=(r+"").split(e),a=0,c=o.length;a<c;a++)o[a]=i(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,r){return void 0===n?this._parts[e]||"":(null!==n&&(n+="").charAt(0)===t&&(n=n.substring(1)),this._parts[e]=n,this.build(!r),this)}}s.decodePath=y("/","decodePathSegment"),s.decodeUrnPath=y(":","decodeUrnPathSegment"),s.recodePath=y("/","encodePathSegment","decode"),s.recodeUrnPath=y(":","encodeUrnPathSegment","decode"),s.encodeReserved=b("reserved","encode"),s.parse=function(e,t){var n;return t||(t={preventInvalidHostname:s.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.substring(0,2)?(t.protocol=null,e=e.substring(2),e=s.parseAuthority(e,t)):(n=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,n)||null,t.protocol&&!t.protocol.match(s.protocol_expression)?t.protocol=void 0:"//"===e.substring(n+1,n+3)?(e=e.substring(n+3),e=s.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0)),t.path=e,t},s.parseHost=function(e,t){e||(e="");var n,r,i=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===i&&(i=e.length),"["===e.charAt(0))n=e.indexOf("]"),t.hostname=e.substring(1,n)||null,t.port=e.substring(n+2,i)||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,i)||null,t.port=null):(r=e.substring(0,i).split(":"),t.hostname=r[0]||null,t.port=r[1]||null)}return t.hostname&&"/"!==e.substring(i).charAt(0)&&(i++,e="/"+e),t.preventInvalidHostname&&s.ensureValidHostname(t.hostname,t.protocol),t.port&&s.ensureValidPort(t.port),e.substring(i)||"/"},s.parseAuthority=function(e,t){return e=s.parseUserinfo(e,t),s.parseHost(e,t)},s.parseUserinfo=function(e,t){var n,r=e.indexOf("/"),i=e.lastIndexOf("@",r>-1?r:e.length-1);return i>-1&&(-1===r||i<r)?(n=e.substring(0,i).split(":"),t.username=n[0]?s.decode(n[0]):null,n.shift(),t.password=n[0]?s.decode(n.join(":")):null,e=e.substring(i+1)):(t.username=null,t.password=null),e},s.parseQuery=function(e,t){if(!e)return{};if(!(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var n,r,i,o={},c=e.split("&"),l=c.length,u=0;u<l;u++)n=c[u].split("="),r=s.decodeQuery(n.shift(),t),i=n.length?s.decodeQuery(n.join("="),t):null,a.call(o,r)?("string"!=typeof o[r]&&null!==o[r]||(o[r]=[o[r]]),o[r].push(i)):o[r]=i;return o},s.build=function(e){var t="",n=!1;return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//",n=!0),t+=s.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},s.buildHost=function(e){var t="";return e.hostname?(s.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},s.buildAuthority=function(e){return s.buildUserinfo(e)+s.buildHost(e)},s.buildUserinfo=function(e){var t="";return e.username&&(t+=s.encode(e.username)),e.password&&(t+=":"+s.encode(e.password)),t&&(t+="@"),t},s.buildQuery=function(e,t,n){var r,i,o,c,l="";for(i in e)if(a.call(e,i))if(u(e[i]))for(r={},o=0,c=e[i].length;o<c;o++)void 0!==e[i][o]&&void 0===r[e[i][o]+""]&&(l+="&"+s.buildQueryParameter(i,e[i][o],n),!0!==t&&(r[e[i][o]+""]=!0));else void 0!==e[i]&&(l+="&"+s.buildQueryParameter(i,e[i],n));return l.substring(1)},s.buildQueryParameter=function(e,t,n){return s.encodeQuery(e,n)+(null!==t?"="+s.encodeQuery(t,n):"")},s.addQuery=function(e,t,n){if("object"==typeof t)for(var r in t)a.call(t,r)&&s.addQuery(e,r,t[r]);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]]),u(n)||(n=[n]),e[t]=(e[t]||[]).concat(n)}},s.setQuery=function(e,t,n){if("object"==typeof t)for(var r in t)a.call(t,r)&&s.setQuery(e,r,t[r]);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}},s.removeQuery=function(e,t,n){var r,i,o;if(u(t))for(r=0,i=t.length;r<i;r++)e[t[r]]=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)&&s.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)?!u(e[t])&&n.test(e[t])?e[t]=void 0:e[t]=d(e[t],n):e[t]!==String(n)||u(n)&&1!==n.length?u(e[t])&&(e[t]=d(e[t],n)):e[t]=void 0:e[t]=void 0}},s.hasQuery=function(e,t,n,r){switch(l(t)){case"String":break;case"RegExp":for(var i in e)if(a.call(e,i)&&t.test(i)&&(void 0===n||s.hasQuery(e,i,n)))return!0;return!1;case"Object":for(var o in t)if(a.call(t,o)&&!s.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(u(e[t])?e[t].length:e[t]);case"Function":return!!n(e[t],t,e);case"Array":return!!u(e[t])&&(r?h:f)(e[t],n);case"RegExp":return u(e[t])?!!r&&h(e[t],n):Boolean(e[t]&&e[t].match(n));case"Number":n=String(n);case"String":return u(e[t])?!!r&&h(e[t],n):e[t]===n;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},s.joinPaths=function(){for(var e=[],t=[],n=0,r=0;r<arguments.length;r++){var i=new s(arguments[r]);e.push(i);for(var o=i.segment(),a=0;a<o.length;a++)"string"==typeof o[a]&&t.push(o[a]),o[a]&&n++}if(!t.length||!n)return new s("");var c=new s("").segment(t);return""!==e[0].path()&&"/"!==e[0].path().slice(0,1)||c.path("/"+c.path()),c.normalize()},s.commonPath=function(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n<r;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))},s.withinString=function(e,t,n){n||(n={});var r=n.start||s.findUri.start,i=n.end||s.findUri.end,o=n.trim||s.findUri.trim,a=n.parens||s.findUri.parens,c=/[a-z0-9-]=["']?$/i;for(r.lastIndex=0;;){var l=r.exec(e);if(!l)break;var u=l.index;if(n.ignoreHtml){var d=e.slice(Math.max(u-3,0),u);if(d&&c.test(d))continue}for(var h=u+e.slice(u).search(i),f=e.slice(u,h),p=-1;;){var m=a.exec(f);if(!m)break;var g=m.index+m[0].length;p=Math.max(p,g)}if(!((f=p>-1?f.slice(0,p)+f.slice(p).replace(o,""):f.replace(o,"")).length<=l[0].length||n.ignore&&n.ignore.test(f))){var v=t(f,u,h=u+f.length,e);void 0!==v?(v=String(v),e=e.slice(0,u)+v+e.slice(h),r.lastIndex=u+v.length):r.lastIndex=h}}return r.lastIndex=0,e},s.ensureValidHostname=function(t,n){var r=!!t,i=!1;if(!!n&&(i=h(s.hostProtocols,n)),i&&!r)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(s.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(s.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},s.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')}},s.noConflict=function(e){if(e){var t={URI:this.noConflict()};return r.URITemplate&&"function"==typeof r.URITemplate.noConflict&&(t.URITemplate=r.URITemplate.noConflict()),r.IPv6&&"function"==typeof r.IPv6.noConflict&&(t.IPv6=r.IPv6.noConflict()),r.SecondLevelDomains&&"function"==typeof r.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=r.SecondLevelDomains.noConflict()),t}return r.URI===this&&(r.URI=i),this},o.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=s.build(this._parts),this._deferred_build=!1),this},o.clone=function(){return new s(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?s.decodeUrnPath:s.decodePath)(n):n}return this._parts.urn?this._parts.path=e?s.recodeUrnPath(e):"":this._parts.path=e?s.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=s._parts();var r=e instanceof s,i="object"==typeof e&&(e.hostname||e.path||e.pathname);e.nodeName&&(e=e[s.getDomAttribute(e)]||"",i=!1);if(!r&&i&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=s.parse(String(e),this._parts);else{if(!r&&!i)throw new TypeError("invalid input");var o=r?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,r=!1,i=!1,o=!1,a=!1,c=!1,l=!1,u=!this._parts.urn;switch(this._parts.hostname&&(u=!1,r=s.ip4_expression.test(this._parts.hostname),i=s.ip6_expression.test(this._parts.hostname),a=(o=!(t=r||i))&&n&&n.has(this._parts.hostname),c=o&&s.idn_expression.test(this._parts.hostname),l=o&&s.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return u;case"absolute":return!u;case"domain":case"name":return o;case"sld":return a;case"ip":return t;case"ip4":case"ipv4":case"inet4":return r;case"ip6":case"ipv6":case"inet6":return i;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(s.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)),s.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("/"!==s.parseHost(e,n))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&s.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 r=s(e);return this.protocol(r.protocol()).authority(r.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?s.buildHost(this._parts):"";if("/"!==s.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?s.buildAuthority(this._parts):"";if("/"!==s.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=s.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return"@"!==e[e.length-1]&&(e+="@"),s.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=s.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 r=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,r),o=new RegExp("^"+c(i));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&s.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 r=this._parts.hostname.length-this.tld(t).length-1;return r=this._parts.hostname.lastIndexOf(".",r-1)+1,this._parts.hostname.substring(r)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(s.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var i=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,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 r=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(r+1);return!0!==t&&n&&n.list[i.toLowerCase()]&&n.get(this._parts.hostname)||i}var s;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]');s=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(s,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");s=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(s,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,r=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?s.decodePath(r):r}var i=this._parts.path.length-this.filename().length,o=this._parts.path.substring(0,i),a=new RegExp("^"+c(o));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=s.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("/"),r=this._parts.path.substring(n+1);return e?s.decodePathSegment(r):r}var i=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(i=!0);var o=new RegExp(c(this.filename())+"$");return e=s.recodePath(e),this._parts.path=this._parts.path.replace(o,e),i?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,r,i=this.filename(),o=i.lastIndexOf(".");return-1===o?"":(n=i.substring(o+1),r=/^[a-z0-9%]+$/i.test(n)?n:"",e?s.decodePathSegment(r):r)}"."===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+="."+s.recodePath(e)}return a&&(e=s.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},o.segment=function(e,t,n){var r=this._parts.urn?":":"/",i=this.path(),s="/"===i.substring(0,1),o=i.split(r);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(s&&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(u(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(p(t[a])))}else(t||"string"==typeof t)&&(t=p(t),""===o[o.length-1]?o[o.length-1]=t:o.push(t));else t?o[e]=p(t):o.splice(e,1);return s&&o.unshift(""),this.path(o.join(r),n)},o.segmentCoded=function(e,t,n){var r,i,o;if("number"!=typeof e&&(n=t,t=e,e=void 0),void 0===t){if(u(r=this.segment(e,t,n)))for(i=0,o=r.length;i<o;i++)r[i]=s.decode(r[i]);else r=void 0!==r?s.decode(r):void 0;return r}if(u(t))for(i=0,o=t.length;i<o;i++)t[i]=s.encode(t[i]);else t="string"==typeof t||t instanceof String?s.encode(t):t;return this.segment(e,t,n)};var C=o.query;return o.query=function(e,t){if(!0===e)return s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var n=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace),r=e.call(this,n);return this._parts.query=s.buildQuery(r||n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=s.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):C.call(this,e,t)},o.setQuery=function(e,t,n){var r=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof e||e instanceof String)r[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 i in e)a.call(e,i)&&(r[i]=e[i])}return this._parts.query=s.buildQuery(r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.addQuery=function(e,t,n){var r=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.addQuery(r,e,void 0===t?null:t),this._parts.query=s.buildQuery(r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.removeQuery=function(e,t,n){var r=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.removeQuery(r,e,t),this._parts.query=s.buildQuery(r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.hasQuery=function(e,t,n){var r=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.hasQuery(r,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===s.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=s.recodeUrnPath(this._parts.path),this.build(!e),this;if("/"===this._parts.path)return this;var r,i,o="";for("/"!==(n=s.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!==(r=n.search(/\/\.\.(\/|$)/));)0!==r?(-1===(i=n.substring(0,r).lastIndexOf("/"))&&(i=r),n=n.substring(0,i)+n.substring(r+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(s.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=s.encode,t=s.decode;s.encode=escape,s.decode=decodeURIComponent;try{this.normalize()}finally{s.encode=e,s.decode=t}return this},o.unicode=function(){var e=s.encode,t=s.decode;s.encode=g,s.decode=unescape;try{this.normalize()}finally{s.encode=e,s.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 r="",i=0,o=t._parts.query.split("&"),a=o.length;i<a;i++){var c=(o[i]||"").split("=");r+="&"+s.decodeQuery(c[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==c[1]&&(r+="="+s.decodeQuery(c[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}n+="?"+r.substring(1)}return n+=s.decodeQuery(t.hash(),!0)},o.absoluteTo=function(e){var t,n,r,i=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 s||(e=new s(e)),i._parts.protocol)return i;if(i._parts.protocol=e._parts.protocol,this._parts.hostname)return i;for(n=0;r=o[n];n++)i._parts[r]=e._parts[r];return i._parts.path?(".."===i._parts.path.substring(-2)&&(i._parts.path+="/"),"/"!==i.path().charAt(0)&&(t=(t=e.directory())||(0===e.path().indexOf("/")?"/":""),i._parts.path=(t?t+"/":"")+i._parts.path,i.normalizePath())):(i._parts.path=e._parts.path,i._parts.query||(i._parts.query=e._parts.query)),i.build(),i},o.relativeTo=function(e){var t,n,r,i,o,a=this.clone().normalize();if(a._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new s(e).normalize(),t=a._parts,n=e._parts,i=a.path(),o=e.path(),"/"!==i.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,i===o)return t.path="",a.build();if(!(r=s.commonPath(i,o)))return a.build();var c=n.path.substring(r.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=c+t.path.substring(r.length)||"./",a.build()},o.equals=function(e){var t,n,r,i,o,c=this.clone(),l=new s(e),d={};if(c.normalize(),l.normalize(),c.toString()===l.toString())return!0;if(r=c.query(),i=l.query(),c.query(""),l.query(""),c.toString()!==l.toString())return!1;if(r.length!==i.length)return!1;for(o in t=s.parseQuery(r,this._parts.escapeQuerySpace),n=s.parseQuery(i,this._parts.escapeQuerySpace),t)if(a.call(t,o)){if(u(t[o])){if(!f(t[o],n[o]))return!1}else if(t[o]!==n[o])return!1;d[o]=!0}for(o in n)if(a.call(n,o)&&!d[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},s}))},function(e,t,n){var r=n(110),i=n(26),s=n(111),o=n(63),a=n(89),c=Math.max;e.exports=function(e,t,n,l){e=i(e)?e:a(e),n=n&&!l?o(n):0;var u=e.length;return n<0&&(n=c(u+n,0)),s(e)?n<=u&&e.indexOf(t,n)>-1:!!u&&r(e,t,n)>-1}},function(e,t,n){"use strict";(function(e){n(483),n(158),n(485);var r=n(2);n.d(t,"b",(function(){return r.d})),n.d(t,"a",(function(){return r.b})),e.$build=r.e.$build,e.$iq=r.e.$iq,e.$msg=r.e.$msg,e.$pres=r.e.$pres,e.Strophe=r.e.Strophe;const{b64_sha1:i}=r.c}).call(this,n(14))},function(e,t,n){var r=n(7).Symbol;e.exports=r},function(e,t){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t){e.exports=function(e){return e}},function(e,t,n){var r=n(44);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t,n){var r=n(24),i=n(427),s=n(428),o=Object.defineProperty;t.f=n(29)?Object.defineProperty:function(e,t,n){if(r(e),t=s(t,!0),r(n),i)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}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports={}},function(e,t,n){e.exports=n(316)},function(e,t,n){e.exports=n(330)},function(e,t,n){var r=n(21),i=n(18);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(70),i=n(17);e.exports=function(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=r(e.prototype),s=e.apply(n,t);return i(s)?s:n}}},function(e,t){e.exports=function(e,t){for(var n=-1,r=e.length,i=0,s=[];++n<r;){var o=e[n];o!==t&&"__lodash_placeholder__"!==o||(e[n]="__lodash_placeholder__",s[i++]=n)}return s}},function(e,t,n){var r=n(366),i=n(367),s=n(368),o=n(369),a=n(370);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=s,c.prototype.has=o,c.prototype.set=a,e.exports=c},function(e,t,n){var r=n(45);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t,n){var r=n(23)(Object,"create");e.exports=r},function(e,t,n){var r=n(384);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t,n){var r=n(10),i=n(78),s=n(407),o=n(410);e.exports=function(e,t){return r(e)?e:i(e,t)?[e]:s(o(e))}},function(e,t,n){var r=n(54);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){function r(e){this.options=e||{locator:{}}}function i(){this.cdata=!1}function s(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function o(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function a(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 c(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}r.prototype.parseFromString=function(e,t){var n=this.options,r=new l,s=n.domBuilder||new i,a=n.errorHandler,c=n.locator,u=n.xmlns||{},d={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return c&&s.setDocumentLocator(c),r.errorHandler=function(e,t,n){if(!e){if(t instanceof i)return t;e=t}var r={},s=e instanceof Function;function a(t){var i=e[t];!i&&s&&(i=2==e.length?function(n){e(t,n)}:e),r[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+o(n))}||function(){}}return n=n||{},a("warning"),a("error"),a("fatalError"),r}(a,s,c),r.domBuilder=n.domBuilder||s,/\/x?html?$/.test(t)&&(d.nbsp=" ",d.copy="©",u[""]="http://www.w3.org/1999/xhtml"),u.xml=u.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,u,d):r.errorHandler.error("invalid doc source"),s.doc},i.prototype={startDocument:function(){this.doc=(new u).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var i=this.doc,o=i.createElementNS(e,n||t),a=r.length;c(this,o),this.currentElement=o,this.locator&&s(this.locator,o);for(var l=0;l<a;l++){e=r.getURI(l);var u=r.getValue(l),d=(n=r.getQName(l),i.createAttributeNS(e,n));this.locator&&s(r.getLocator(l),d),d.value=d.nodeValue=u,o.setAttributeNode(d)}},endElement:function(e,t,n){var r=this.currentElement;r.tagName;this.currentElement=r.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&s(this.locator,n),c(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=a.apply(this,arguments)){if(this.cdata)var r=this.doc.createCDATASection(e);else r=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(e)&&this.doc.appendChild(r),this.locator&&s(this.locator,r)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=a.apply(this,arguments);var r=this.doc.createComment(e);this.locator&&s(this.locator,r),c(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(e,t,n);this.locator&&s(this.locator,i),c(this,i)}},warning:function(e){console.warn("[xmldom warning]\t"+e,o(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,o(this.locator))},fatalError:function(e){throw console.error("[xmldom fatalError]\t"+e,o(this.locator)),e}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){i.prototype[e]=function(){return null}}));var l=n(470).XMLReader,u=t.DOMImplementation=n(153).DOMImplementation;t.XMLSerializer=n(153).XMLSerializer,t.DOMParser=r},function(e,t,n){var r=n(21),i=n(17);e.exports=function(e){if(!i(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(this,n(14))},function(e,t,n){var r=n(17),i=n(474),s=n(93),o=Math.max,a=Math.min;e.exports=function(e,t,n){var c,l,u,d,h,f,p=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function _(t){var n=c,r=l;return c=l=void 0,p=t,d=e.apply(r,n)}function b(e){return p=e,h=setTimeout(w,t),m?_(e):d}function y(e){var n=e-f;return void 0===f||n>=t||n<0||g&&e-p>=u}function w(){var e=i();if(y(e))return S(e);h=setTimeout(w,function(e){var n=t-(e-f);return g?a(n,u-(e-p)):n}(e))}function S(e){return h=void 0,v&&c?_(e):(c=l=void 0,d)}function x(){var e=i(),n=y(e);if(c=arguments,l=this,f=e,n){if(void 0===h)return b(f);if(g)return clearTimeout(h),h=setTimeout(w,t),_(f)}return void 0===h&&(h=setTimeout(w,t)),d}return t=s(t)||0,r(n)&&(m=!!n.leading,u=(g="maxWait"in n)?o(s(n.maxWait)||0,t):u,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==h&&clearTimeout(h),p=0,c=f=l=h=void 0},x.flush=function(){return void 0===h?d:S(i())},x}},function(e,t,n){
/**
* @preserve jed.js https://github.com/SlexAxton/Jed
*/
!function(n,r){var i=Array.prototype,s=Object.prototype,o=i.slice,a=s.hasOwnProperty,c=i.forEach,l={},u={forEach:function(e,t,n){var r,i,s;if(null!==e)if(c&&e.forEach===c)e.forEach(t,n);else if(e.length===+e.length){for(r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r,e)===l)return}else for(s in e)if(a.call(e,s)&&t.call(n,e[s],s,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}},d=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=u.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 d.PF.compile(e||"nplurals=2; plural=(n != 1);")}function f(e,t){this._key=e,this._i18n=t}d.context_delimiter=String.fromCharCode(4),u.extend(f.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?d.sprintf:function(e){return e})(this._i18n.dcnpgettext(this._domain,this._context,this._key,this._pkey,this._val),e)}}),u.extend(d.prototype,{translate:function(e){return new f(e,this)},textdomain:function(e){if(!e)return this._textdomain;this._textdomain=e},gettext:function(e){return this.dcnpgettext.call(this,void 0,void 0,e)},dgettext:function(e,t){return this.dcnpgettext.call(this,e,void 0,t)},dcgettext:function(e,t){return this.dcnpgettext.call(this,e,void 0,t)},ngettext:function(e,t,n){return this.dcnpgettext.call(this,void 0,void 0,e,t,n)},dngettext:function(e,t,n,r){return this.dcnpgettext.call(this,e,void 0,t,n,r)},dcngettext:function(e,t,n,r){return this.dcnpgettext.call(this,e,void 0,t,n,r)},pgettext:function(e,t){return this.dcnpgettext.call(this,void 0,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,r){return this.dcnpgettext.call(this,void 0,e,t,n,r)},dnpgettext:function(e,t,n,r,i){return this.dcnpgettext.call(this,e,t,n,r,i)},dcnpgettext:function(e,t,n,r,i){var s;if(r=r||n,e=e||this._textdomain,!this.options)return(s=new d).dcnpgettext.call(s,void 0,void 0,n,r,i);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+d.context_delimiter+n:n,u=this.options.locale_data,f=u[e],p=(u.messages||this.defaults.locale_data.messages)[""],m=f[""].plural_forms||f[""]["Plural-Forms"]||f[""]["plural-forms"]||p.plural_forms||p["Plural-Forms"]||p["plural-forms"];if(void 0===i)c=0;else{if("number"!=typeof i&&(i=parseInt(i,10),isNaN(i)))throw new Error("The number that was passed in is not a number.");c=h(m)(i)}if(!f)throw new Error("No domain named `"+e+"` could be found.");return!(o=f[l])||c>o.length?(this.options.missing_key_callback&&this.options.missing_key_callback(l,e),a=[n,r],!0===this.options.debug&&console.log(a[h(m)(i)]),a[h()(i)]):(a=o[c])||(a=[n,r])[h()(i)]}});var p,m,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,r){var i,s,o,a,c,l,u,d=1,h=n.length,f="",p=[];for(s=0;s<h;s++)if("string"===(f=e(n[s])))p.push(n[s]);else if("array"===f){if((a=n[s])[2])for(i=r[d],o=0;o<a[2].length;o++){if(!i.hasOwnProperty(a[2][o]))throw g('[sprintf] property "%s" does not exist',a[2][o]);i=i[a[2][o]]}else i=a[1]?r[a[1]]:r[d++];if(/[^s]/.test(a[8])&&"number"!=e(i))throw g("[sprintf] expecting number but found %s",e(i));switch(null==i&&(i=""),a[8]){case"b":i=i.toString(2);break;case"c":i=String.fromCharCode(i);break;case"d":i=parseInt(i,10);break;case"e":i=a[7]?i.toExponential(a[7]):i.toExponential();break;case"f":i=a[7]?parseFloat(i).toFixed(a[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=(i=String(i))&&a[7]?i.substring(0,a[7]):i;break;case"u":i=Math.abs(i);break;case"x":i=i.toString(16);break;case"X":i=i.toString(16).toUpperCase()}i=/[def]/.test(a[8])&&a[3]&&i>=0?"+"+i:i,l=a[4]?"0"==a[4]?"0":a[4].charAt(1):" ",u=a[6]-String(i).length,c=a[6]?t(l,u):"",p.push(a[5]?i+c:c+i)}return p.join("")},n.cache={},n.parse=function(e){for(var t=e,n=[],r=[],i=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))r.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))r.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw"[sprintf] huh?";if(n[2]){i|=1;var s=[],o=n[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(o)))throw"[sprintf] huh?";for(s.push(a[1]);""!==(o=o.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(o)))s.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(o)))throw"[sprintf] huh?";s.push(a[1])}n[2]=s}else i|=2;if(3===i)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";r.push(n)}t=t.substring(n[0].length)}return r},n}(),v=function(e,t){return t.unshift(e),g.apply(null,t)};d.parse_plural=function(e,t){return e=e.replace(/n/g,t),d.parse_expression(e)},d.sprintf=function(e,t){return"[object Array]"=={}.toString.call(t)?v(e,[].slice.call(t)):g.apply(this,[].slice.call(arguments))},d.prototype.sprintf=function(){return d.sprintf.apply(this,arguments)},(d.PF={}).parse=function(e){var t=d.PF.extractPluralExpr(e);return d.PF.parser.parse.call(d.PF.parser,t)},d.PF.compile=function(e){var t=d.PF.parse(e);return function(e){return!0===(n=d.PF.interpreter(t)(e))?1:n||0;var n}},d.PF.interpreter=function(e){return function(t){switch(e.type){case"GROUP":return d.PF.interpreter(e.expr)(t);case"TERNARY":return d.PF.interpreter(e.expr)(t)?d.PF.interpreter(e.truthy)(t):d.PF.interpreter(e.falsey)(t);case"OR":return d.PF.interpreter(e.left)(t)||d.PF.interpreter(e.right)(t);case"AND":return d.PF.interpreter(e.left)(t)&&d.PF.interpreter(e.right)(t);case"LT":return d.PF.interpreter(e.left)(t)<d.PF.interpreter(e.right)(t);case"GT":return d.PF.interpreter(e.left)(t)>d.PF.interpreter(e.right)(t);case"LTE":return d.PF.interpreter(e.left)(t)<=d.PF.interpreter(e.right)(t);case"GTE":return d.PF.interpreter(e.left)(t)>=d.PF.interpreter(e.right)(t);case"EQ":return d.PF.interpreter(e.left)(t)==d.PF.interpreter(e.right)(t);case"NEQ":return d.PF.interpreter(e.left)(t)!=d.PF.interpreter(e.right)(t);case"MOD":return d.PF.interpreter(e.left)(t)%d.PF.interpreter(e.right)(t);case"VAR":return t;case"NUM":return e.val;default:throw new Error("Invalid Token found.")}}},d.PF.extractPluralExpr=function(e){e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),/;\s*$/.test(e)||(e=e.concat(";"));var t,n=/nplurals\=(\d+);/,r=e.match(n);if(!(r.length>1))throw new Error("nplurals not found in plural_forms string: "+e);if(r[1],!((t=(e=e.replace(n,"")).match(/plural\=(.*);/))&&t.length>1))throw new Error("`plural` expression not found: "+e);return t[1]},d.PF.parser=(p={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,r,i,s,o){var a=s.length-1;switch(i){case 1:return{type:"GROUP",expr:s[a-1]};case 2:this.$={type:"TERNARY",expr:s[a-4],truthy:s[a-2],falsey:s[a]};break;case 3:this.$={type:"OR",left:s[a-2],right:s[a]};break;case 4:this.$={type:"AND",left:s[a-2],right:s[a]};break;case 5:this.$={type:"LT",left:s[a-2],right:s[a]};break;case 6:this.$={type:"LTE",left:s[a-2],right:s[a]};break;case 7:this.$={type:"GT",left:s[a-2],right:s[a]};break;case 8:this.$={type:"GTE",left:s[a-2],right:s[a]};break;case 9:this.$={type:"NEQ",left:s[a-2],right:s[a]};break;case 10:this.$={type:"EQ",left:s[a-2],right:s[a]};break;case 11:this.$={type:"MOD",left:s[a-2],right:s[a]};break;case 12:this.$={type:"GROUP",expr:s[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],r=[null],i=[],s=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 u=this.lexer.yylloc;function d(){var e;return"number"!=typeof(e=t.lexer.lex()||1)&&(e=t.symbols_[e]||e),e}i.push(u),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var h,f,p,m,g,v,_,b,y,w,S={};;){if(p=n[n.length-1],this.defaultActions[p]?m=this.defaultActions[p]:(null==h&&(h=d()),m=s[p]&&s[p][h]),void 0===m||!m.length||!m[0]){if(!l){for(v in y=[],s[p])this.terminals_[v]&&v>2&&y.push("'"+this.terminals_[v]+"'");var x="";x=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+this.terminals_[h]+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==h?"end of input":"'"+(this.terminals_[h]||h)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[h]||h,line:this.lexer.yylineno,loc:u,expected:y})}if(3==l){if(1==h)throw new Error(x||"Parsing halted.");c=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,u=this.lexer.yylloc,h=d()}for(;!(2..toString()in s[p]);){if(0==p)throw new Error(x||"Parsing halted.");w=1,n.length=n.length-2*w,r.length=r.length-w,i.length=i.length-w,p=n[n.length-1]}f=h,h=2,m=s[p=n[n.length-1]]&&s[p][2],l=3}if(m[0]instanceof Array&&m.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+h);switch(m[0]){case 1:n.push(h),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(m[1]),h=null,f?(h=f,f=null):(c=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,u=this.lexer.yylloc,l>0&&l--);break;case 2:if(_=this.productions_[m[1]][1],S.$=r[r.length-_],S._$={first_line:i[i.length-(_||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(_||1)].first_column,last_column:i[i.length-1].last_column},void 0!==(g=this.performAction.call(S,o,c,a,this.yy,m[1],r,i)))return g;_&&(n=n.slice(0,-1*_*2),r=r.slice(0,-1*_),i=i.slice(0,-1*_)),n.push(this.productions_[m[1]][0]),r.push(S.$),i.push(S._$),b=s[n[n.length-2]][n[n.length-1]],n.push(b);break;case 3:return!0}}return!0}},m=function(){var e={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(),r=0;r<n.length;r++)if(e=this._input.match(this.rules[n[r]]))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[r],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,r){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}}};return e}(),p.lexer=m,p),e.exports&&(t=e.exports=d),t.Jed=d}()},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){var r=n(313);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},function(e,t,n){var r=n(322),i=n(18),s=Object.prototype,o=s.hasOwnProperty,a=s.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return i(e)&&o.call(e,"callee")&&!a.call(e,"callee")};e.exports=c},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t){e.exports=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)}},function(e,t,n){var r=n(337),i=n(108)(r);e.exports=i},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}},function(e,t,n){var r=n(17),i=Object.create,s=function(){function e(){}return function(t){if(!r(t))return{};if(i)return i(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=s},function(e,t,n){var r=n(70),i=n(72);function s(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}s.prototype=r(i.prototype),s.prototype.constructor=s,e.exports=s},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e){return e.placeholder}},function(e,t,n){var r=n(23)(n(7),"Map");e.exports=r},function(e,t,n){var r=n(376),i=n(383),s=n(385),o=n(386),a=n(387);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=s,c.prototype.has=o,c.prototype.set=a,e.exports=c},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}},function(e,t,n){var r=n(52),i=n(38);e.exports=function(e,t){for(var n=0,s=(t=r(t,e)).length;null!=e&&n<s;)e=e[i(t[n++])];return n&&n==s?e:void 0}},function(e,t,n){var r=n(10),i=n(44),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(o.test(e)||!s.test(e)||null!=t&&e in Object(t))}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(40),i=n(11).document,s=r(i)&&r(i.createElement);e.exports=function(e){return s?i.createElement(e):{}}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(433),i=n(81);e.exports=function(e){return r(i(e))}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(142)("keys"),i=n(143);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t){e.exports=!0},function(e,t,n){e.exports={default:n(441),__esModule:!0}},function(e,t,n){var r=n(39).f,i=n(55),s=n(15)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,s)&&r(e,s,{configurable:!0,value:t})}},function(e,t,n){"use strict";var r=n(54);function i(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)}e.exports.f=function(e){return new i(e)}},function(e,t,n){var r=n(345),i=n(30);e.exports=function(e){return null==e?[]:r(e,i(e))}},function(e,t,n){var r=n(106),i=n(346),s=n(73),o=n(47),a=r((function(e,t){var n=o(t,s(a));return i(e,32,void 0,t,n)}));a.placeholder={},e.exports=a},function(e,t,n){var r=n(18),i=n(475);e.exports=function(e){return r(e)&&1===e.nodeType&&!i(e)}},function(e,t,n){var r;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function s(e){return a(l(e),arguments)}function o(e,t){return s.apply(null,[e].concat(t||[]))}function a(e,t){var n,r,o,a,c,l,u,d,h,f=1,p=e.length,m="";for(r=0;r<p;r++)if("string"==typeof e[r])m+=e[r];else if("object"==typeof e[r]){if((a=e[r]).keys)for(n=t[f],o=0;o<a.keys.length;o++){if(null==n)throw new Error(s('[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[f++];if(i.not_type.test(a.type)&&i.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),i.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(s("[sprintf] expecting number but found %T",n));switch(i.number.test(a.type)&&(d=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()}i.json.test(a.type)?m+=n:(!i.number.test(a.type)||d&&!a.sign?h="":(h=d?"+":"-",n=n.toString().replace(i.sign,"")),l=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",u=a.width-(h+n).length,c=a.width&&u>0?l.repeat(u):"",m+=a.align?h+n+c:"0"===l?h+c+n:c+h+n)}return m}var c=Object.create(null);function l(e){if(c[e])return c[e];for(var t,n=e,r=[],s=0;n;){if(null!==(t=i.text.exec(n)))r.push(t[0]);else if(null!==(t=i.modulo.exec(n)))r.push("%");else{if(null===(t=i.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){s|=1;var o=[],a=t[2],l=[];if(null===(l=i.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=i.key_access.exec(a)))o.push(l[1]);else{if(null===(l=i.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(l[1])}t[2]=o}else s|=2;if(3===s)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.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]=r}t.sprintf=s,t.vsprintf=o,"undefined"!=typeof window&&(window.sprintf=s,window.vsprintf=o,void 0===(r=function(){return{sprintf:s,vsprintf:o}}.call(t,n,t,e))||(e.exports=r))}()},function(e,t,n){var r=n(17),i=n(44),s=/^\s+|\s+$/g,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(i(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var n=a.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?NaN:+e}},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(14))},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}},function(e,t,n){var r=n(321),i=n(64),s=n(10),o=n(97),a=n(36),c=n(98),l=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=s(e),u=!n&&i(e),d=!n&&!u&&o(e),h=!n&&!u&&!d&&c(e),f=n||u||d||h,p=f?r(e.length,String):[],m=p.length;for(var g in e)!t&&!l.call(e,g)||f&&("length"==g||d&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,m))||p.push(g);return p}},function(e,t,n){(function(e){var r=n(7),i=n(323),s=t&&!t.nodeType&&t,o=s&&"object"==typeof e&&e&&!e.nodeType&&e,a=o&&o.exports===s?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||i;e.exports=c}).call(this,n(65)(e))},function(e,t,n){var r=n(324),i=n(325),s=n(326),o=s&&s.isTypedArray,a=o?i(o):r;e.exports=a},function(e,t,n){var r=n(100),i=n(327),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=[];for(var n in Object(e))s.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(103),i=n(45),s=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var o=e[t];s.call(e,t)&&i(o,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(104);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(23),i=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=i},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var r=n(37),i=n(107),s=n(68);e.exports=function(e,t){return s(i(e,t,r),e+"")}},function(e,t,n){var r=n(67),i=Math.max;e.exports=function(e,t,n){return t=i(void 0===t?e.length-1:t,0),function(){for(var s=arguments,o=-1,a=i(s.length-t,0),c=Array(a);++o<a;)c[o]=s[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=s[o];return l[t]=n(c),r(e,this,l)}}},function(e,t){var n=Date.now;e.exports=function(e){var t=0,r=0;return function(){var i=n(),s=16-(i-r);if(r=i,s>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(96),i=n(340),s=n(26);e.exports=function(e){return s(e)?r(e,!0):i(e)}},function(e,t,n){var r=n(342),i=n(343),s=n(344);e.exports=function(e,t,n){return t==t?s(e,t,n):r(e,i,n)}},function(e,t,n){var r=n(21),i=n(10),s=n(18);e.exports=function(e){return"string"==typeof e||!i(e)&&s(e)&&"[object String]"==r(e)}},function(e,t,n){var r=n(37),i=n(113),s=i?function(e,t){return i.set(e,t),e}:r;e.exports=s},function(e,t,n){var r=n(114),i=r&&new r;e.exports=i},function(e,t,n){var r=n(23)(n(7),"WeakMap");e.exports=r},function(e,t,n){var r=n(116),i=n(117),s=n(349),o=n(46),a=n(118),c=n(73),l=n(360),u=n(47),d=n(7);e.exports=function e(t,n,h,f,p,m,g,v,_,b){var y=128&n,w=1&n,S=2&n,x=24&n,E=512&n,A=S?void 0:o(t);return function C(){for(var T=arguments.length,O=Array(T),j=T;j--;)O[j]=arguments[j];if(x)var k=c(C),N=s(O,k);if(f&&(O=r(O,f,p,x)),m&&(O=i(O,m,g,x)),T-=N,x&&T<b){var M=u(O,k);return a(t,n,e,C.placeholder,h,O,M,v,_,b-T)}var I=w?h:this,R=S?I[t]:t;return T=O.length,v?O=l(O,v):E&&T>1&&O.reverse(),y&&_<T&&(O.length=_),this&&this!==d&&this instanceof C&&(R=A||o(R)),R.apply(I,O)}}},function(e,t){var n=Math.max;e.exports=function(e,t,r,i){for(var s=-1,o=e.length,a=r.length,c=-1,l=t.length,u=n(o-a,0),d=Array(l+u),h=!i;++c<l;)d[c]=t[c];for(;++s<a;)(h||s<o)&&(d[r[s]]=e[s]);for(;u--;)d[c++]=e[s++];return d}},function(e,t){var n=Math.max;e.exports=function(e,t,r,i){for(var s=-1,o=e.length,a=-1,c=r.length,l=-1,u=t.length,d=n(o-c,0),h=Array(d+u),f=!i;++s<d;)h[s]=e[s];for(var p=s;++l<u;)h[p+l]=t[l];for(;++a<c;)(f||s<o)&&(h[p+r[a]]=e[s++]);return h}},function(e,t,n){var r=n(350),i=n(122),s=n(123);e.exports=function(e,t,n,o,a,c,l,u,d,h){var f=8&t;t|=f?32:64,4&(t&=~(f?64:32))||(t&=-4);var p=[e,t,a,f?c:void 0,f?l:void 0,f?void 0:c,f?void 0:l,u,d,h],m=n.apply(void 0,p);return r(e)&&i(m,p),m.placeholder=o,s(m,e,t)}},function(e,t,n){var r=n(113),i=n(351),s=r?function(e){return r.get(e)}:i;e.exports=s},function(e,t,n){var r=n(70),i=n(72);function s(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}s.prototype=r(i.prototype),s.prototype.constructor=s,e.exports=s},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},function(e,t,n){var r=n(112),i=n(108)(r);e.exports=i},function(e,t,n){var r=n(356),i=n(357),s=n(68),o=n(358);e.exports=function(e,t,n){var a=t+"";return s(e,i(a,o(r(a),n)))}},function(e,t,n){var r=n(48),i=n(371),s=n(372),o=n(373),a=n(374),c=n(375);function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=i,l.prototype.delete=s,l.prototype.get=o,l.prototype.has=a,l.prototype.set=c,e.exports=l},function(e,t,n){var r=n(388),i=n(18);e.exports=function e(t,n,s,o,a){return t===n||(null==t||null==n||!i(t)&&!i(n)?t!=t&&n!=n:r(t,n,s,o,e,a))}},function(e,t,n){var r=n(389),i=n(392),s=n(393);e.exports=function(e,t,n,o,a,c){var l=1&n,u=e.length,d=t.length;if(u!=d&&!(l&&d>u))return!1;var h=c.get(e),f=c.get(t);if(h&&f)return h==t&&f==e;var p=-1,m=!0,g=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++p<u;){var v=e[p],_=t[p];if(o)var b=l?o(_,v,p,t,e,c):o(v,_,p,e,t,c);if(void 0!==b){if(b)continue;m=!1;break}if(g){if(!i(t,(function(e,t){if(!s(g,t)&&(v===e||a(v,e,n,o,c)))return g.push(t)}))){m=!1;break}}else if(v!==_&&!a(v,_,n,o,c)){m=!1;break}}return c.delete(e),c.delete(t),m}},function(e,t,n){var r=n(76),i=n(10);e.exports=function(e,t,n){var s=t(e);return i(e)?s:r(s,n(e))}},function(e,t,n){var r=n(400),i=n(129),s=Object.prototype.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(e){return null==e?[]:(e=Object(e),r(o(e),(function(t){return s.call(e,t)})))}:i;e.exports=a},function(e,t){e.exports=function(){return[]}},function(e,t,n){var r=n(401),i=n(74),s=n(402),o=n(403),a=n(114),c=n(21),l=n(105),u=l(r),d=l(i),h=l(s),f=l(o),p=l(a),m=c;(r&&"[object DataView]"!=m(new r(new ArrayBuffer(1)))||i&&"[object Map]"!=m(new i)||s&&"[object Promise]"!=m(s.resolve())||o&&"[object Set]"!=m(new o)||a&&"[object WeakMap]"!=m(new a))&&(m=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?l(n):"";if(r)switch(r){case u:return"[object DataView]";case d:return"[object Map]";case h:return"[object Promise]";case f:return"[object Set]";case p:return"[object WeakMap]"}return t}),e.exports=m},function(e,t,n){var r=n(17);e.exports=function(e){return e==e&&!r(e)}},function(e,t){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},function(e,t,n){var r=n(412),i=n(413);e.exports=function(e,t){return null!=e&&i(e,t,r)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){var r=n(77),i=n(416),s=n(52);e.exports=function(e,t,n){for(var o=-1,a=t.length,c={};++o<a;){var l=t[o],u=r(e,l);n(u,l)&&i(c,s(l,e),u)}return c}},function(e,t,n){var r=n(101)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(423)),i=l(n(429)),s=l(n(437)),o=l(n(440)),a=l(n(86));t.default=function(e,t){var n=(0,c.getStorage)(),l=!(!n||!n[t]),u=l?n[t]:{clear:function(){},get:function(){},remove:function(){},set:function(){}},d=u.clear.bind(u),h=u.get.bind(u),f=u.remove.bind(u),p=u.set.bind(u);return{_driver:e,_support:l,_initStorage:function(){return a.default.resolve()},clear:function(e){var t=this;return(0,o.default)(s.default.mark((function n(){return s.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:d(),e&&e();case 2:case"end":return t.stop()}}),n,t)})))()},iterate:function(e,t){var n=this;return(0,o.default)(s.default.mark((function r(){var o;return s.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,i.default)(o).forEach((function(t,n){return e(o[t],t,n)})),t&&t();case 6:case"end":return n.stop()}}),r,n)})))()},getItem:function(e,t){var n=this;return(0,o.default)(s.default.mark((function r(){var i;return s.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 i=n.sent,i=void 0===(i="string"==typeof e?i[e]:i)?null:i,t&&t(null,i),n.abrupt("return",i);case 10:throw n.prev=10,n.t0=n.catch(0),t&&t(n.t0),n.t0;case 14:case"end":return n.stop()}}),r,n,[[0,10]])})))()},key:function(e,t){var n=this;return(0,o.default)(s.default.mark((function r(){var o,a;return s.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,i.default)(o)[e],t&&t(a),n.abrupt("return",a);case 6:case"end":return n.stop()}}),r,n)})))()},keys:function(e){var t=this;return(0,o.default)(s.default.mark((function n(){var r,o;return s.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,c.usePromise)(h,null);case 2:return r=t.sent,o=(0,i.default)(r),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)(s.default.mark((function n(){var r,o;return s.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,c.usePromise)(h,null);case 2:return r=t.sent,o=(0,i.default)(r).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)(s.default.mark((function r(){return s.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,c.usePromise)(f,e);case 2:t&&t();case 3:case"end":return n.stop()}}),r,n)})))()},setItem:function(e,t,n){var i=this;return(0,o.default)(s.default.mark((function o(){return s.default.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,(0,c.usePromise)(p,(0,r.default)({},e,t));case 2:n&&n();case 3:case"end":return i.stop()}}),o,i)})))()}}};var c=n(468);function l(e){return e&&e.__esModule?e:{default:e}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(81);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(432),i=n(144);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){var r=n(83),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(19),i=n(11),s=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return s[e]||(s[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(85)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){"use strict";var r=n(85),i=n(27),s=n(445),o=n(28),a=n(41),c=n(446),l=n(87),u=n(449),d=n(15)("iterator"),h=!([].keys&&"next"in[].keys()),f=function(){return this};e.exports=function(e,t,n,p,m,g,v){c(n,t,p);var _,b,y,w=function(e){if(!h&&e in A)return A[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+" Iterator",x="values"==m,E=!1,A=e.prototype,C=A[d]||A["@@iterator"]||m&&A[m],T=C||w(m),O=m?x?w("entries"):T:void 0,j="Array"==t&&A.entries||C;if(j&&(y=u(j.call(new e)))!==Object.prototype&&y.next&&(l(y,S,!0),r||"function"==typeof y[d]||o(y,d,f)),x&&C&&"values"!==C.name&&(E=!0,T=function(){return C.call(this)}),r&&!v||!h&&!E&&A[d]||o(A,d,T),a[t]=T,a[S]=f,m)if(_={values:x?T:w("values"),keys:g?T:w("keys"),entries:O},v)for(b in _)b in A||s(A,b,_[b]);else i(i.P+i.F*(h||E),t,_);return _}},function(e,t,n){var r=n(11).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(56),i=n(15)("toStringTag"),s="Arguments"==r(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),i))?n:s?r(t):"Object"==(o=r(t))&&"function"==typeof t.callee?"Arguments":o}},function(e,t,n){var r=n(24),i=n(54),s=n(15)("species");e.exports=function(e,t){var n,o=r(e).constructor;return void 0===o||null==(n=r(o)[s])?t:i(n)}},function(e,t,n){var r,i,s,o=n(53),a=n(460),c=n(146),l=n(80),u=n(11),d=u.process,h=u.setImmediate,f=u.clearImmediate,p=u.MessageChannel,m=u.Dispatch,g=0,v={},_=function(){var e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e],t()}},b=function(e){_.call(e.data)};h&&f||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return v[++g]=function(){a("function"==typeof e?e:Function(e),t)},r(g),g},f=function(e){delete v[e]},"process"==n(56)(d)?r=function(e){d.nextTick(o(_,e,1))}:m&&m.now?r=function(e){m.now(o(_,e,1))}:p?(s=(i=new p).port2,i.port1.onmessage=b,r=o(s.postMessage,s,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(r=function(e){u.postMessage(e+"","*")},u.addEventListener("message",b,!1)):r="onreadystatechange"in l("script")?function(e){c.appendChild(l("script")).onreadystatechange=function(){c.removeChild(this),_.call(e)}}:function(e){setTimeout(o(_,e,1),0)}),e.exports={set:h,clear:f}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r=n(24),i=n(40),s=n(88);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=s.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){"use strict";var r=n(13),i=n(1);i.e.Request=class{constructor(e,t,n,r){this.id=++i.e._requestId,this.xmlData=e,this.data=i.e.serialize(e),this.origFunc=t,this.func=t,this.rid=n,this.date=NaN,this.sends=r||0,this.abort=!1,this.dead=null,this.age=function(){if(!this.date)return 0;return(new Date-this.date)/1e3},this.timeDead=function(){if(!this.dead)return 0;return(new Date-this.dead)/1e3},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 i.e.error("invalid response received"),i.e.error("responseText: "+this.xhr.responseText),i.e.error("responseXML: "+i.e.serialize(this.xhr.responseXML)),new Error("parsererror")}else if(this.xhr.responseText){if(i.e.debug("Got responseText but no responseXML; attempting to parse it with DOMParser..."),e=(new r.a).parseFromString(this.xhr.responseText,"application/xml").documentElement,!e)throw new Error("Parsing produced null node");if(e.querySelector("parsererror")){i.e.error("invalid response received: "+e.querySelector("parsererror").textContent),i.e.error("responseText: "+this.xhr.responseText);const t=new Error;throw t.name=i.e.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}},i.e.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=Object(i.a)("body",{rid:this.rid++,xmlns:i.e.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 r=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":i.e.NS.BOSH});n&&r.attrs({route:n});const s=this._conn._connect_cb;this._requests.push(new i.e.Request(r.tree(),this._onRequestStateChange.bind(this,s.bind(this._conn)),r.tree().getAttribute("rid"))),this._throttledRequestHandler()}_attach(e,t,n,r,s,o,a){this._conn.jid=e,this.sid=t,this.rid=n,this._conn.connect_callback=r,this._conn.domain=i.e.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=s||this.wait,this.hold=o||this.hold,this.window=a||this.window,this._conn._changeConnectStatus(i.e.Status.ATTACHED,null)}_restore(e,t,n,r,s){const o=JSON.parse(window.sessionStorage.getItem("strophe-bosh-session"));if(!(null!=o&&o.rid&&o.sid&&o.jid&&(null==e||i.e.getBareJidFromJid(o.jid)===i.e.getBareJidFromJid(e)||null===i.e.getNodeFromJid(e)&&i.e.getDomainFromJid(o.jid)===e))){const e=new Error("_restore: no restoreable session.");throw e.name="StropheSessionError",e}this._conn.restored=!0,this._attach(o.jid,o.sid,o.rid,t,n,r,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");i.e.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(i.e.Status.CONNFAIL,t)):this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(t),i.e.Status.CONNFAIL}this.sid||(this.sid=e.getAttribute("sid"));const n=e.getAttribute("requests");n&&(this.window=parseInt(n,10));const r=e.getAttribute("hold");r&&(this.hold=parseInt(r,10));const s=e.getAttribute("wait");s&&(this.wait=parseInt(s,10));const o=e.getAttribute("inactivity");o&&(this.inactivity=parseInt(o,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),r=this._conn.protocolErrorHandlers.HTTP[n];r&&r.call(this,n)}_hitError(e){this.errors++,i.e.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(e){i.e.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 i.e.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&&(i.e.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":i.e.NS.BOSH}):t.cnode(e[n]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new i.e.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(i.e.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(i.e.TIMEOUT*this.wait)&&(i.e.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(i.e.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){i.e.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(i.e.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 r=e._getRequestStatus(n);if(this.lastResponseHeaders=n.xhr.getAllResponseHeaders(),this._conn.disconnecting&&r>=400)return this._hitError(r),void this._callProtocolErrorHandlers(n);const s=r>0&&r<500,o=n.sends>this._conn.maxRetries;if((s||o)&&(this._removeRequest(n),i.e.debug("request id "+n.id+" should now be removed")),200===r){const e=this._requests[0]===n;(this._requests[1]===n||e&&this._requests.length>0&&this._requests[0].age()>Math.floor(i.e.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),i.e.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0}else 0===r||r>=400&&r<600||r>=12e3?(i.e.error("request id "+n.id+"."+n.sends+" error "+r+" happened"),this._hitError(r),this._callProtocolErrorHandlers(n),r>=400&&r<500&&(this._conn._changeConnectStatus(i.e.Status.DISCONNECTING,null),this._conn._doDisconnect())):i.e.error("request id "+n.id+"."+n.sends+" error "+r+" happened");s||o?o&&!this._conn.connected&&this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}_processRequest(t){let n=this._requests[t];const r=e._getRequestStatus(n,-1);if(n.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();const s=n.age(),o=!isNaN(s)&&s>Math.floor(i.e.TIMEOUT*this.wait),a=null!==n.dead&&n.timeDead()>Math.floor(i.e.SECONDARY_TIMEOUT*this.wait),c=4===n.xhr.readyState&&(r<1||r>=500);if((o||a||c)&&(a&&i.e.error("Request ".concat(this._requests[t].id," timed out (secondary), restarting")),n.abort=!0,n.xhr.abort(),n.xhr.onreadystatechange=function(){},this._requests[t]=new i.e.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[t]),0===n.xhr.readyState){i.e.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 i.e.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(i.e.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(i.e.TIMEOUT*this.wait),Math.pow(n.sends,3));setTimeout((function(){e()}),t)}else e();n.sends++,this._conn.xmlOutput!==i.e.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!==i.e.Connection.prototype.rawOutput&&this._conn.rawOutput(n.data)}else i.e.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+n.xhr.readyState)}_removeRequest(e){i.e.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){i.e.debug("_sendTerminate was called");const t=this._buildBody().attrs({type:"terminate"});e&&t.cnode(e.tree());const n=new i.e.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?i.e.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):i.e.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))}},i.e.Bosh.prototype.strip=null},function(e,t){function n(e,t){for(var n in e)t[n]=e[n]}function r(e,t){var r=e.prototype;if(Object.create){var i=Object.create(t.prototype);r.__proto__=i}if(!(r instanceof t)){function s(){}s.prototype=t.prototype,n(r,s=new s),e.prototype=r=s}r.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),r.constructor=e)}var i={},s=i.ELEMENT_NODE=1,o=i.ATTRIBUTE_NODE=2,a=i.TEXT_NODE=3,c=i.CDATA_SECTION_NODE=4,l=i.ENTITY_REFERENCE_NODE=5,u=i.ENTITY_NODE=6,d=i.PROCESSING_INSTRUCTION_NODE=7,h=i.COMMENT_NODE=8,f=i.DOCUMENT_NODE=9,p=i.DOCUMENT_TYPE_NODE=10,m=i.DOCUMENT_FRAGMENT_NODE=11,g=i.NOTATION_NODE=12,v={},_={},b=(v.INDEX_SIZE_ERR=(_[1]="Index size error",1),v.DOMSTRING_SIZE_ERR=(_[2]="DOMString size error",2),v.HIERARCHY_REQUEST_ERR=(_[3]="Hierarchy request error",3)),y=(v.WRONG_DOCUMENT_ERR=(_[4]="Wrong document",4),v.INVALID_CHARACTER_ERR=(_[5]="Invalid character",5),v.NO_DATA_ALLOWED_ERR=(_[6]="No data allowed",6),v.NO_MODIFICATION_ALLOWED_ERR=(_[7]="No modification allowed",7),v.NOT_FOUND_ERR=(_[8]="Not found",8)),w=(v.NOT_SUPPORTED_ERR=(_[9]="Not supported",9),v.INUSE_ATTRIBUTE_ERR=(_[10]="Attribute in use",10));v.INVALID_STATE_ERR=(_[11]="Invalid state",11),v.SYNTAX_ERR=(_[12]="Syntax error",12),v.INVALID_MODIFICATION_ERR=(_[13]="Invalid modification",13),v.NAMESPACE_ERR=(_[14]="Invalid namespace",14),v.INVALID_ACCESS_ERR=(_[15]="Invalid access",15);function S(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,_[e]),this.message=_[e],Error.captureStackTrace&&Error.captureStackTrace(this,S);return n.code=e,t&&(this.message=this.message+": "+t),n}function x(){}function E(e,t){this._node=e,this._refresh=t,A(this)}function A(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var r=e._refresh(e._node);te(e,"length",r.length),n(r,e),e._inc=t}}function C(){}function T(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function O(e,t,n,r){if(r?t[T(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var i=e.ownerDocument;i&&(r&&D(i,e,r),function(e,t,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(i,e,n))}}function j(e,t,n){var r=T(t,n);if(!(r>=0))throw S(y,new Error(e.tagName+"@"+n));for(var i=t.length-1;r<i;)t[r]=t[++r];if(t.length=i,e){var s=e.ownerDocument;s&&(D(s,e,n),n.ownerElement=null)}}function k(e){if(this._features={},e)for(var t in e)this._features=e[t]}function N(){}function M(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function I(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(I(e,t))return!0}while(e=e.nextSibling)}function R(){}function D(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function L(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var i=t.firstChild,s=0;i;)r[s++]=i,i=i.nextSibling;r.length=s}}}function z(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,L(e.ownerDocument,e),t}function P(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===m){var i=t.firstChild;if(null==i)return t;var s=t.lastChild}else i=s=t;var o=n?n.previousSibling:e.lastChild;i.previousSibling=o,s.nextSibling=n,o?o.nextSibling=i:e.firstChild=i,null==n?e.lastChild=s:n.previousSibling=s;do{i.parentNode=e}while(i!==s&&(i=i.nextSibling));return L(e.ownerDocument||e,e),t.nodeType==m&&(t.firstChild=t.lastChild=null),t}function F(){this._nsMap={}}function B(){}function H(){}function q(){}function U(){}function V(){}function $(){}function G(){}function W(){}function J(){}function X(){}function Q(){}function Y(){}function K(e,t){var n=[],r=9==this.nodeType?this.documentElement:this,i=r.prefix,s=r.namespaceURI;if(s&&null==i&&null==(i=r.lookupPrefix(s)))var o=[{namespace:s,prefix:null}];return ee(this,n,e,t,o),n.join("")}function Z(e,t,n){var r=e.prefix||"",i=e.namespaceURI;if(!r&&!i)return!1;if("xml"===r&&"http://www.w3.org/XML/1998/namespace"===i||"http://www.w3.org/2000/xmlns/"==i)return!1;for(var s=n.length;s--;){var o=n[s];if(o.prefix==r)return o.namespace!=i}return!0}function ee(e,t,n,r,i){if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case s:i||(i=[]);i.length;var u=e.attributes,g=u.length,v=e.firstChild,_=e.tagName;n="http://www.w3.org/1999/xhtml"===e.namespaceURI||n,t.push("<",_);for(var b=0;b<g;b++){"xmlns"==(y=u.item(b)).prefix?i.push({prefix:y.localName,namespace:y.value}):"xmlns"==y.nodeName&&i.push({prefix:"",namespace:y.value})}for(b=0;b<g;b++){var y;if(Z(y=u.item(b),0,i)){var w=y.prefix||"",S=y.namespaceURI,x=w?" xmlns:"+w:" xmlns";t.push(x,'="',S,'"'),i.push({prefix:w,namespace:S})}ee(y,t,n,r,i)}if(Z(e,0,i)){w=e.prefix||"",S=e.namespaceURI,x=w?" xmlns:"+w:" xmlns";t.push(x,'="',S,'"'),i.push({prefix:w,namespace:S})}if(v||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(_)){if(t.push(">"),n&&/^script$/i.test(_))for(;v;)v.data?t.push(v.data):ee(v,t,n,r,i),v=v.nextSibling;else for(;v;)ee(v,t,n,r,i),v=v.nextSibling;t.push("</",_,">")}else t.push("/>");return;case f:case m:for(v=e.firstChild;v;)ee(v,t,n,r,i),v=v.nextSibling;return;case o:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,M),'"');case a:return t.push(e.data.replace(/[<&]/g,M));case c:return t.push("<![CDATA[",e.data,"]]>");case h:return t.push("\x3c!--",e.data,"--\x3e");case p:var E=e.publicId,A=e.systemId;if(t.push("<!DOCTYPE ",e.name),E)t.push(' PUBLIC "',E),A&&"."!=A&&t.push('" "',A),t.push('">');else if(A&&"."!=A)t.push(' SYSTEM "',A,'">');else{var C=e.internalSubset;C&&t.push(" [",C,"]"),t.push(">")}return;case d:return t.push("<?",e.target," ",e.data,"?>");case l:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function te(e,t,n){e[t]=n}S.prototype=Error.prototype,n(v,S),x.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],r=0;r<this.length;r++)ee(this[r],n,e,t);return n.join("")}},E.prototype.item=function(e){return A(this),this[e]},r(E,x),C.prototype={length:0,item:x.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 S(w);var n=this.getNamedItem(e.nodeName);return O(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t,n=e.ownerElement;if(n&&n!=this._ownerElement)throw new S(w);return t=this.getNamedItemNS(e.namespaceURI,e.localName),O(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return j(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return j(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var r=this[n];if(r.localName==t&&r.namespaceURI==e)return r}return null}},k.prototype={hasFeature:function(e,t){var n=this._features[e.toLowerCase()];return!(!n||t&&!(t in n))},createDocument:function(e,t,n){var r=new R;if(r.implementation=this,r.childNodes=new x,r.doctype=n,n&&r.appendChild(n),t){var i=r.createElementNS(e,t);r.appendChild(i)}return r},createDocumentType:function(e,t,n){var r=new $;return r.name=e,r.nodeName=e,r.publicId=t,r.systemId=n,r}},N.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 P(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return z(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,n,r){var i=new n.constructor;for(var a in n){var c=n[a];"object"!=typeof c&&c!=i[a]&&(i[a]=c)}n.childNodes&&(i.childNodes=new x);switch(i.ownerDocument=t,i.nodeType){case s:var l=n.attributes,u=i.attributes=new C,d=l.length;u._ownerElement=i;for(var h=0;h<d;h++)i.setAttributeNode(e(t,l.item(h),!0));break;case o:r=!0}if(r)for(var f=n.firstChild;f;)i.appendChild(e(t,f,r)),f=f.nextSibling;return i}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==a&&e.nodeType==a?(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 r in n)if(n[r]==e)return r;t=t.nodeType==o?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==o?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},n(i,N),n(i,N.prototype),R.prototype={nodeName:"#document",nodeType:f,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==m){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==s&&(this.documentElement=e),P(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),z(this,e)},importNode:function(e,t){return function e(t,n,r){var i;switch(n.nodeType){case s:(i=n.cloneNode(!1)).ownerDocument=t;case m:break;case o:r=!0}i||(i=n.cloneNode(!1));if(i.ownerDocument=t,i.parentNode=null,r)for(var a=n.firstChild;a;)i.appendChild(e(t,a,r)),a=a.nextSibling;return i}(this,e,t)},getElementById:function(e){var t=null;return I(this.documentElement,(function(n){if(n.nodeType==s&&n.getAttribute("id")==e)return t=n,!0})),t},createElement:function(e){var t=new F;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new x,(t.attributes=new C)._ownerElement=t,t},createDocumentFragment:function(){var e=new X;return e.ownerDocument=this,e.childNodes=new x,e},createTextNode:function(e){var t=new q;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new U;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new V;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new Q;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new B;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new J;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new F,r=t.split(":"),i=n.attributes=new C;return n.childNodes=new x,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,i._ownerElement=n,n},createAttributeNS:function(e,t){var n=new B,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},r(R,N),F.prototype={nodeType:s,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===m?this.insertBefore(e,null):function(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t);r=e.lastChild}return r=e.lastChild,t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,L(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 r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new E(this,(function(t){var n=[];return I(t,(function(r){r===t||r.nodeType!=s||"*"!==e&&r.tagName!=e||n.push(r)})),n}))},getElementsByTagNameNS:function(e,t){return new E(this,(function(n){var r=[];return I(n,(function(i){i===n||i.nodeType!==s||"*"!==e&&i.namespaceURI!==e||"*"!==t&&i.localName!=t||r.push(i)})),r}))}},R.prototype.getElementsByTagName=F.prototype.getElementsByTagName,R.prototype.getElementsByTagNameNS=F.prototype.getElementsByTagNameNS,r(F,N),B.prototype.nodeType=o,r(B,N),H.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(_[b])},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}},r(H,N),q.prototype={nodeName:"#text",nodeType:a,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 r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},r(q,H),U.prototype={nodeName:"#comment",nodeType:h},r(U,H),V.prototype={nodeName:"#cdata-section",nodeType:c},r(V,H),$.prototype.nodeType=p,r($,N),G.prototype.nodeType=g,r(G,N),W.prototype.nodeType=u,r(W,N),J.prototype.nodeType=l,r(J,N),X.prototype.nodeName="#document-fragment",X.prototype.nodeType=m,r(X,N),Q.prototype.nodeType=d,r(Q,N),Y.prototype.serializeToString=function(e,t,n){return K.call(e,t,n)},N.prototype.toString=K;try{if(Object.defineProperty){Object.defineProperty(E.prototype,"length",{get:function(){return A(this),this.$$length}}),Object.defineProperty(N.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case s:case m:var n=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&n.push(e(t)),t=t.nextSibling;return n.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case s:case m: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}}}),te=function(e,t,n){e["$$"+t]=n}}}catch(e){}t.DOMImplementation=k,t.XMLSerializer=Y},function(e,t,n){"use strict";var r=n(13),i=n(1);i.e.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 Object(i.a)("open",{xmlns:i.e.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(e,t){let n;if(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(i.e.NS.STREAM,"error"):e.getElementsByTagName("stream:error"),0===n.length)return!1;const r=n[0];let s="",o="";for(let e=0;e<r.childNodes.length;e++){const t=r.childNodes[e];if("urn:ietf:params:xml:ns:xmpp-streams"!==t.getAttribute("xmlns"))break;"text"===t.nodeName?o=t.textContent:s=t.nodeName}let a="WebSocket stream error: ";return a+=s||"unknown",o&&(a+=" - "+o),i.e.error(a),this._conn._changeConnectStatus(t,s),this._conn._doDisconnect(),!0}_reset(){}_connect(){this._closeSocket(),this.socket=new WebSocket(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,i.e.Status.CONNFAIL))return i.e.Status.CONNFAIL}_handleStreamStart(e){let t=!1;const n=e.getAttribute("xmlns");"string"!=typeof n?t="Missing xmlns in <open />":n!==i.e.NS.FRAMING&&(t="Wrong xmlns in <open />: "+n);const r=e.getAttribute("version");return"string"!=typeof r?t="Missing version in <open />":"1.0"!==r&&(t="Wrong version in <open />: "+r),!t||(this._conn._changeConnectStatus(i.e.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 r.a).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 r.a).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(i.e.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=n,this._connect())}else this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect()}else{this._replaceMessageHandler();const t=this._streamWrap(e.data),n=(new r.a).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!==WebSocket.CLOSED){e&&this._conn.send(e);const t=Object(i.a)("close",{xmlns:i.e.NS.FRAMING});this._conn.xmlOutput(t.tree());const n=i.e.serialize(t);this._conn.rawOutput(n);try{this.socket.send(n)}catch(e){i.e.warn("Couldn't send <close /> tag.")}}this._conn._doDisconnect()}_doDisconnect(){i.e.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){i.e.debug(e.message)}this.socket=null}_emptyQueue(){return!0}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(i.e.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected&&this.socket?(i.e.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):i.e.debug("Websocket closed")}_no_auth_received(e){i.e.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(i.e.Status.CONNFAIL,i.e.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(e){i.e.error("Websocket error "+e),this._conn._changeConnectStatus(i.e.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 r=i.e.serialize(n);this._conn.xmlOutput(n),this._conn.rawOutput(r),this.socket.send(r)}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 r.a).parseFromString(e.data,"text/xml").documentElement,!this._handleStreamStart(t))return}else{const n=this._streamWrap(e.data);t=(new r.a).parseFromString(n,"text/xml").documentElement}return this._checkStreamError(t,i.e.Status.ERROR)?void 0:this._conn.disconnecting&&"presence"===t.firstChild.nodeName&&"unavailable"===t.firstChild.getAttribute("type")?(this._conn.xmlInput(t),void this._conn.rawInput(i.e.serialize(t))):void this._conn._dataRecv(t,e.data)}_onOpen(){i.e.debug("Websocket open");const e=this._buildStream();this._conn.xmlOutput(e.tree());const t=i.e.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)()}}},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.0 by @mathias */!function(s){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof r&&r;o.global!==o&&o.window!==o&&o.self;var a,c=2147483647,l=/^xn--/,u=/[^\x20-\x7E]/,d=/[\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"},f=Math.floor,p=String.fromCharCode;function m(e){throw new RangeError(h[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(d,".")).split("."),t).join(".")}function _(e){for(var t,n,r=[],i=0,s=e.length;i<s;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<s?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function b(e){return g(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function y(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function S(e){var t,n,r,i,s,o,a,l,u,d,h,p=[],g=e.length,v=0,_=128,y=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&m("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<g;){for(s=v,o=1,a=36;i>=g&&m("invalid-input"),((l=(h=e.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||l>f((c-v)/o))&&m("overflow"),v+=l*o,!(l<(u=a<=y?1:a>=y+26?26:a-y));a+=36)o>f(c/(d=36-u))&&m("overflow"),o*=d;y=w(v-s,t=p.length+1,0==s),f(v/t)>c-_&&m("overflow"),_+=f(v/t),v%=t,p.splice(v++,0,_)}return b(p)}function x(e){var t,n,r,i,s,o,a,l,u,d,h,g,v,b,S,x=[];for(g=(e=_(e)).length,t=128,n=0,s=72,o=0;o<g;++o)(h=e[o])<128&&x.push(p(h));for(r=i=x.length,i&&x.push("-");r<g;){for(a=c,o=0;o<g;++o)(h=e[o])>=t&&h<a&&(a=h);for(a-t>f((c-n)/(v=r+1))&&m("overflow"),n+=(a-t)*v,t=a,o=0;o<g;++o)if((h=e[o])<t&&++n>c&&m("overflow"),h==t){for(l=n,u=36;!(l<(d=u<=s?1:u>=s+26?26:u-s));u+=36)S=l-d,b=36-d,x.push(p(y(d+S%b,0))),l=f(S/b);x.push(p(y(l,0))),s=w(n,v,r==i),n=0,++r}++n,++t}return x.join("")}a={version:"1.3.2",ucs2:{decode:_,encode:b},decode:S,encode:x,toASCII:function(e){return v(e,(function(e){return u.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 a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(65)(e),n(14))},function(e,t,n){var r,i;
/*!
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.19.2
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/!function(s,o){"use strict";e.exports?e.exports=o():void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i)}(0,(function(e){"use strict";var t=e&&e.IPv6;return{best:function(e){var t,n,r=e.toLowerCase().split(":"),i=r.length,s=8;for(""===r[0]&&""===r[1]&&""===r[2]?(r.shift(),r.shift()):""===r[0]&&""===r[1]?r.shift():""===r[i-1]&&""===r[i-2]&&r.pop(),-1!==r[(i=r.length)-1].indexOf(".")&&(s=7),t=0;t<i&&""!==r[t];t++);if(t<s)for(r.splice(t,1,"0000");r.length<s;)r.splice(t,0,"0000");for(var o=0;o<s;o++){n=r[o].split("");for(var a=0;a<3&&("0"===n[0]&&n.length>1);a++)n.splice(0,1);r[o]=n.join("")}var c=-1,l=0,u=0,d=-1,h=!1;for(o=0;o<s;o++)h?"0"===r[o]?u+=1:(h=!1,u>l&&(c=d,l=u)):"0"===r[o]&&(h=!0,d=o,u=1);u>l&&(c=d,l=u),l>1&&r.splice(c,l,""),i=r.length;var f="";for(""===r[0]&&(f=":"),o=0;o<i&&(f+=r[o],o!==i-1);o++)f+=":";return""===r[i-1]&&(f+=":"),f},noConflict:function(){return e.IPv6===this&&(e.IPv6=t),this}}}))},function(e,t,n){var r,i;
/*!
* URI.js - Mutating URLs
* Second Level Domain (SLD) Support
*
* Version: 1.19.2
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/!function(s,o){"use strict";e.exports?e.exports=o():void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i)}(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 r=e.lastIndexOf(".",t-1);if(r<=0||r>=t-1)return!1;var i=n.list[e.slice(t+1)];return!!i&&i.indexOf(" "+e.slice(r+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 r=n.list[e.slice(t+1)];return!!r&&r.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var r=e.lastIndexOf(".",t-1);if(r<=0||r>=t-1)return null;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(r+1,t)+" ")<0?null:e.slice(r+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n}))},function(e,t,n){"use strict";var r=n(8),i=n(2);i.d.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 Object(i.a)("open",{xmlns:i.d.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(e,t){let n;if(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(i.d.NS.STREAM,"error"):e.getElementsByTagName("stream:error"),0===n.length)return!1;const r=n[0];let s="",o="";for(let e=0;e<r.childNodes.length;e++){const t=r.childNodes[e];if("urn:ietf:params:xml:ns:xmpp-streams"!==t.getAttribute("xmlns"))break;"text"===t.nodeName?o=t.textContent:s=t.nodeName}let a="WebSocket stream error: ";return a+=s||"unknown",o&&(a+=" - "+o),i.d.error(a),this._conn._changeConnectStatus(t,s),this._conn._doDisconnect(),!0}_reset(){}_connect(){this._closeSocket(),this.socket=new r.b(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,i.d.Status.CONNFAIL))return i.d.Status.CONNFAIL}_handleStreamStart(e){let t=!1;const n=e.getAttribute("xmlns");"string"!=typeof n?t="Missing xmlns in <open />":n!==i.d.NS.FRAMING&&(t="Wrong xmlns in <open />: "+n);const r=e.getAttribute("version");return"string"!=typeof r?t="Missing version in <open />":"1.0"!==r&&(t="Wrong version in <open />: "+r),!t||(this._conn._changeConnectStatus(i.d.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 r.a).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 r.a).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(i.d.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=n,this._connect())}else this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect()}else{this._replaceMessageHandler();const t=this._streamWrap(e.data),n=(new r.a).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!==r.b.CLOSED){e&&this._conn.send(e);const t=Object(i.a)("close",{xmlns:i.d.NS.FRAMING});this._conn.xmlOutput(t.tree());const n=i.d.serialize(t);this._conn.rawOutput(n);try{this.socket.send(n)}catch(e){i.d.warn("Couldn't send <close /> tag.")}}setTimeout(()=>this._conn._doDisconnect,0)}_doDisconnect(){i.d.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){i.d.debug(e.message)}this.socket=null}_emptyQueue(){return!0}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(i.d.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected&&this.socket?(i.d.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):i.d.debug("Websocket closed")}_no_auth_received(e){i.d.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(i.d.Status.CONNFAIL,i.d.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(e){i.d.error("Websocket error "+e),this._conn._changeConnectStatus(i.d.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 r=i.d.serialize(n);this._conn.xmlOutput(n),this._conn.rawOutput(r),this.socket.send(r)}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 r.a).parseFromString(e.data,"text/xml").documentElement,!this._handleStreamStart(t))return}else{const n=this._streamWrap(e.data);t=(new r.a).parseFromString(n,"text/xml").documentElement}return this._checkStreamError(t,i.d.Status.ERROR)?void 0:this._conn.disconnecting&&"presence"===t.firstChild.nodeName&&"unavailable"===t.firstChild.getAttribute("type")?(this._conn.xmlInput(t),void this._conn.rawInput(i.d.serialize(t))):void this._conn._dataRecv(t,e.data)}_onOpen(){i.d.debug("Websocket open");const e=this._buildStream();this._conn.xmlOutput(e.tree());const t=i.d.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)()}}},function(e,t,n){"use strict";t.a=function(){return!1}},function(e,t,n){"use strict";(function(e){var r=n(5),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=i&&"object"==typeof e&&e&&!e.nodeType&&e,o=s&&s.exports===i?r.a.Buffer:void 0,a=o?o.allocUnsafe:void 0;t.a=function(e,t){if(t)return e.slice();var n=e.length,r=a?a(n):new e.constructor(n);return e.copy(r),r}}).call(this,n(62)(e))},function(e,t,n){e.exports=function(){"use strict";return function(e,t,n){var r=t.prototype,i=r.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])+"]"},r.format=function(e){var t=this,n=this.$locale(),r=this.$utils(),s=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|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"wo":return n.ordinal(t.week(),"W");case"w":case"ww":return r.s(t.week(),"w"===e?1:2,"0");case"k":case"kk":return r.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();default:return e}}));return i.bind(this)(s)}}}()},function(e,t,n){var r=n(312),i=n(63);e.exports=function(e,t,n){var s=null==e?0:e.length;return s?(t=n||void 0===t?1:i(t),r(e,t<0?0:t,s)):[]}},function(e,t,n){var r=n(21),i=n(18);e.exports=function(e){return!0===e||!1===e||i(e)&&"[object Boolean]"==r(e)}},function(e,t){e.exports=function(e){return null==e}},function(e,t,n){var r=n(69),i=n(363),s=n(135),o=n(417);e.exports=function(e,t){if(null==e)return{};var n=r(o(e),(function(e){return[e]}));return t=i(t),s(e,n,(function(e,n){return t(e,n[0])}))}},function(e,t,n){var r=n(99),i=n(130),s=n(26),o=n(111),a=n(419);e.exports=function(e){if(null==e)return 0;if(s(e))return o(e)?a(e):e.length;var t=i(e);return"[object Map]"==t||"[object Set]"==t?e.size:r(e).length}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(137),s=(r=i)&&r.__esModule?r:{default:r};t.default=(0,s.default)("webExtensionSyncStorage","sync")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(137),s=(r=i)&&r.__esModule?r:{default:r};t.default=(0,s.default)("webExtensionLocalStorage","local")},function(e,t,n){"use strict";(function(t){!function(t){var n=/^(b|B)$/,r={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"]}},i={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function s(e){var t,s,o,a,c,l,u,d,h,f,p,m,g,v,_,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},y=[],w=0,S=void 0,x=void 0;if(isNaN(e))throw new TypeError("Invalid number");return s=!0===b.bits,p=!0===b.unix,t=b.base||2,f=void 0!==b.round?b.round:p?1:2,l=void 0!==b.locale?b.locale:"",u=b.localeOptions||{},m=void 0!==b.separator?b.separator:"",g=void 0!==b.spacer?b.spacer:p?"":" ",_=b.symbols||{},v=2===t&&b.standard||"jedec",h=b.output||"string",a=!0===b.fullform,c=b.fullforms instanceof Array?b.fullforms:[],S=void 0!==b.exponent?b.exponent:-1,o=2<t?1e3:1024,(d=(x=Number(e))<0)&&(x=-x),(-1===S||isNaN(S))&&(S=Math.floor(Math.log(x)/Math.log(o)))<0&&(S=0),8<S&&(S=8),"exponent"===h?S:(0===x?(y[0]=0,y[1]=p?"":r[v][s?"bits":"bytes"][S]):(w=x/(2===t?Math.pow(2,10*S):Math.pow(1e3,S)),s&&o<=(w*=8)&&S<8&&(w/=o,S++),y[0]=Number(w.toFixed(0<S?f:0)),y[0]===o&&S<8&&void 0===b.exponent&&(y[0]=1,S++),y[1]=10===t&&1===S?s?"kb":"kB":r[v][s?"bits":"bytes"][S],p&&(y[1]="jedec"===v?y[1].charAt(0):0<S?y[1].replace(/B$/,""):y[1],n.test(y[1])&&(y[0]=Math.floor(y[0]),y[1]=""))),d&&(y[0]=-y[0]),y[1]=_[y[1]]||y[1],!0===l?y[0]=y[0].toLocaleString():0<l.length?y[0]=y[0].toLocaleString(l,u):0<m.length&&(y[0]=y[0].toString().replace(".",m)),"array"===h?y:(a&&(y[1]=c[S]?c[S]:i[v][S]+(s?"bit":"byte")+(1===y[0]?"":"s")),"object"===h?{value:y[0],symbol:y[1],exponent:S}:y.join(g)))}s.partial=function(e){return function(t){return s(t,e)}},e.exports=s}("undefined"!=typeof window&&window)}).call(this,n(14))},function(e,t,n){var r=n(478),i=n(479)((function(e,t){return null==e?{}:r(e,t)}));e.exports=i},function(e,t,n){"use strict";(function(t){!function(t){var n=/^(b|B)$/,r={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"]}},i={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function s(e){var t,s,o,a,c,l,u,d,h,f,p,m,g,v,_,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},y=[],w=0,S=void 0,x=void 0;if(isNaN(e))throw new TypeError("Invalid number");return s=!0===b.bits,p=!0===b.unix,t=b.base||2,f=void 0!==b.round?b.round:p?1:2,l=void 0!==b.locale?b.locale:"",u=b.localeOptions||{},m=void 0!==b.separator?b.separator:"",g=void 0!==b.spacer?b.spacer:p?"":" ",_=b.symbols||{},v=2===t&&b.standard||"jedec",h=b.output||"string",a=!0===b.fullform,c=b.fullforms instanceof Array?b.fullforms:[],S=void 0!==b.exponent?b.exponent:-1,o=2<t?1e3:1024,(d=(x=Number(e))<0)&&(x=-x),(-1===S||isNaN(S))&&(S=Math.floor(Math.log(x)/Math.log(o)))<0&&(S=0),8<S&&(S=8),"exponent"===h?S:(0===x?(y[0]=0,y[1]=p?"":r[v][s?"bits":"bytes"][S]):(w=x/(2===t?Math.pow(2,10*S):Math.pow(1e3,S)),s&&o<=(w*=8)&&S<8&&(w/=o,S++),y[0]=Number(w.toFixed(0<S?f:0)),y[0]===o&&S<8&&void 0===b.exponent&&(y[0]=1,S++),y[1]=10===t&&1===S?s?"kb":"kB":r[v][s?"bits":"bytes"][S],p&&(y[1]="jedec"===v?y[1].charAt(0):0<S?y[1].replace(/B$/,""):y[1],n.test(y[1])&&(y[0]=Math.floor(y[0]),y[1]=""))),d&&(y[0]=-y[0]),y[1]=_[y[1]]||y[1],!0===l?y[0]=y[0].toLocaleString():0<l.length?y[0]=y[0].toLocaleString(l,u):0<m.length&&(y[0]=y[0].toString().replace(".",m)),"array"===h?y:(a&&(y[1]=c[S]?c[S]:i[v][S]+(s?"bit":"byte")+(1===y[0]?"":"s")),"object"===h?{value:y[0],symbol:y[1],exponent:S}:y.join(g)))}s.partial=function(e){return function(t){return s(t,e)}},e.exports=s}("undefined"!=typeof window&&window)}).call(this,n(14))},function(e,t,n){var r,i;
/**
* @license MIT or GPL-2.0
* @fileOverview Favico animations
* @author Miroslav Magda, http://blog.ejci.net
* @source: https://github.com/ejci/favico.js
* @version 0.3.10
*/i=function(e){"use strict";e=e||{};var t,n,r,i,s,o,a,c,l,u,d,h,f,p,m={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=/*@cc_on!@*/!1,h.safari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,h.supported=h.chrome||h.ff||h.opera;var g=[];d=function(){},c=!1;var v={ready:function(){c=!0,v.reset(),d()},reset:function(){c&&(g=[],l=!1,u=!1,o.clearRect(0,0,i,r),o.drawImage(a,0,0,i,r),y.setIcon(s),window.clearTimeout(f),window.clearTimeout(void 0))},start:function(){if(c&&!u&&g.length>0){u=!0;var e=function(){["type","animation","bgColor","textColor","fontFamily","fontStyle"].forEach((function(e){e in g[0].options&&(t[e]=g[0].options[e])})),x.run(g[0].options,(function(){l=g[0],u=!1,g.length>0&&(g.shift(),v.start())}),!1)};l?x.run(l.options,(function(){e()}),!0):e()}}},_={},b=function(e){return e.n="number"==typeof e.n?Math.abs(0|e.n):e.n,e.x=i*e.x,e.y=r*e.y,e.w=i*e.w,e.h=r*e.h,e.len=(""+e.n).length,e};_.circle=function(e){var n=!1;2===(e=b(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,i,r),o.drawImage(a,0,0,i,r),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()},_.rectangle=function(e){2===(e=b(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,i,r),o.drawImage(a,0,0,i,r),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 y={};function w(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,r){return t+t+n+n+r+r}));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,r={};for(n in e)r[n]=e[n];for(n in t)r[n]=t[n];return r}y.getIcons=function(){var e=[];return t.element?e=[t.element]:t.elementId?(e=[p.getElementById(t.elementId)])[0].setAttribute("href",e[0].getAttribute("src")):0===(e=function(){for(var e=[],t=p.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=[p.createElement("link")])[0].setAttribute("rel","icon"),p.getElementsByTagName("head")[0].appendChild(e[0])),e.forEach((function(e){e.setAttribute("type","image/png")})),e},y.setIcon=function(e){var t=e.toDataURL("image/png");y.setIconSrc(t)},y.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 r=p.getElementById(t.elementId);r.setAttribute("href",e),r.setAttribute("src",e)}else if(h.ff||h.opera){var i=n[n.length-1],s=p.createElement("link");n=[s],h.opera&&s.setAttribute("rel","icon"),s.setAttribute("rel","icon"),s.setAttribute("type","image/png"),p.getElementsByTagName("head")[0].appendChild(s),s.setAttribute("href",e),i.parentNode&&i.parentNode.removeChild(i)}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,r,i){var o=x.types[p.hidden||p.msHidden||p.webkitHidden||p.mozHidden?"none":t.animation];i=!0===r?void 0!==i?i:o.length-1:void 0!==i?i:0,n=n||function(){},i<o.length&&i>=0?(_[t.type](S(e,o[i])),f=setTimeout((function(){r?i-=1:i+=1,x.run(e,n,r,i)}),x.duration),y.setIcon(s)):n()},function(){(t=S(m,e)).bgColor=w(t.bgColor),t.textColor=w(t.textColor),t.position=t.position.toLowerCase(),t.animation=x.types[""+t.animation]?t.animation:m.animation,p=t.win.document;var c=t.position.indexOf("up")>-1,l=t.position.indexOf("left")>-1;if(c||l)for(var u in x.types)for(var d=0;d<x.types[u].length;d++){var h=x.types[u][d];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[u][d]=h}t.type=_[""+t.type]?t.type:m.type,n=y.getIcons(),s=document.createElement("canvas"),a=document.createElement("img");var f=n[n.length-1];f.hasAttribute("href")?(a.setAttribute("crossOrigin","anonymous"),a.onload=function(){r=a.height>0?a.height:32,i=a.width>0?a.width:32,s.height=r,s.width=i,o=s.getContext("2d"),v.ready()},a.setAttribute("src",f.getAttribute("href"))):(r=32,i=32,a.height=r,a.width=i,s.height=r,s.width=i,o=s.getContext("2d"),v.ready())}(),{badge:function(e,t){t=("string"==typeof t?{animation:t}:t)||{},d=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&&_[""+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])})),g.push(n),g.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&&d()},setOpt:function(e,n){var r=e;null==n&&"[object Object]"==Object.prototype.toString.call(e)||((r={})[e]=n);for(var i=Object.keys(r),s=0;s<i.length;s++)"bgColor"==i[s]||"textColor"==i[s]?t[i[s]]=w(r[i[s]]):t[i[s]]=r[i[s]];g.push(l),v.start()},reset:v.reset,browser:{supported:h.supported}}},void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);const r={},i={plugins:{add(e,t){if(void 0!==r[e])throw new TypeError('Error: plugin with name "'.concat(e,'" has already been ')+"registered!");r[e]=t}},initialize(e={}){i.load(e).initialize(e)},load:(e={})=>(e.assets_path&&(n.p=e.assets_path),n(491),Object.keys(r).forEach(e=>i.plugins.add(e,r[e])),i)};window.converse=i,t.default=i},function(e,t){function n(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}"function"!=typeof window.CustomEvent&&(n.prototype=window.Event.prototype,window.CustomEvent=n),String.prototype.includes||(String.prototype.includes=function(e,t){"use strict";return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){const n=this.toString();(void 0===t||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return-1!==r&&r===t}),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),String.prototype.splitOnce||(String.prototype.splitOnce=function(e){const t=this.split(e);return[t.shift(),t.join(e)]}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")})},function(e,t){e.exports=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}},function(e,t,n){var r=n(93);e.exports=function(e){return e?(e=r(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},function(e,t,n){var r=n(35),i=Object.prototype,s=i.hasOwnProperty,o=i.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var i=o.call(e);return r&&(t?e[a]=n:delete e[a]),i}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r=n(95),i=n(317),s=n(329),o=n(10);e.exports=function(e,t){return(o(e)?r:i)(e,s(t))}},function(e,t,n){var r=n(318),i=n(328)(r);e.exports=i},function(e,t,n){var r=n(319),i=n(30);e.exports=function(e,t){return e&&r(e,t,i)}},function(e,t,n){var r=n(320)();e.exports=r},function(e,t){e.exports=function(e){return function(t,n,r){for(var i=-1,s=Object(t),o=r(t),a=o.length;a--;){var c=o[e?a:++i];if(!1===n(s[c],c,s))break}return t}}},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},function(e,t,n){var r=n(21),i=n(18);e.exports=function(e){return i(e)&&"[object Arguments]"==r(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,n){var r=n(21),i=n(66),s=n(18),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return s(e)&&i(e.length)&&!!o[r(e)]}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){(function(e){var r=n(94),i=t&&!t.nodeType&&t,s=i&&"object"==typeof e&&e&&!e.nodeType&&e,o=s&&s.exports===i&&r.process,a=function(){try{var e=s&&s.require&&s.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}).call(this,n(65)(e))},function(e,t,n){var r=n(101)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(26);e.exports=function(e,t){return function(n,i){if(null==n)return n;if(!r(n))return e(n,i);for(var s=n.length,o=t?s:-1,a=Object(n);(t?o--:++o<s)&&!1!==i(a[o],o,a););return n}}},function(e,t,n){var r=n(37);e.exports=function(e){return"function"==typeof e?e:r}},function(e,t,n){var r=n(331),i=n(336),s=n(109),o=i((function(e,t){r(t,s(t),e)}));e.exports=o},function(e,t,n){var r=n(102),i=n(103);e.exports=function(e,t,n,s){var o=!n;n||(n={});for(var a=-1,c=t.length;++a<c;){var l=t[a],u=s?s(n[l],e[l],l,n,e):void 0;void 0===u&&(u=e[l]),o?i(n,l,u):r(n,l,u)}return n}},function(e,t,n){var r=n(58),i=n(333),s=n(17),o=n(105),a=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,h=RegExp("^"+u.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!s(e)||i(e))&&(r(e)?h:a).test(o(e))}},function(e,t,n){var r,i=n(334),s=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!s&&s in e}},function(e,t,n){var r=n(7)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var r=n(106),i=n(339);e.exports=function(e){return r((function(t,n){var r=-1,s=n.length,o=s>1?n[s-1]:void 0,a=s>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(s--,o):void 0,a&&i(n[0],n[1],a)&&(o=s<3?void 0:o,s=1),t=Object(t);++r<s;){var c=n[r];c&&e(t,c,r,o)}return t}))}},function(e,t,n){var r=n(338),i=n(104),s=n(37),o=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:s;e.exports=o},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t,n){var r=n(45),i=n(26),s=n(36),o=n(17);e.exports=function(e,t,n){if(!o(n))return!1;var a=typeof t;return!!("number"==a?i(n)&&s(t,n.length):"string"==a&&t in n)&&r(n[t],e)}},function(e,t,n){var r=n(17),i=n(100),s=n(341),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return s(e);var t=i(e),n=[];for(var a in e)("constructor"!=a||!t&&o.call(e,a))&&n.push(a);return n}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},function(e,t){e.exports=function(e,t,n,r){for(var i=e.length,s=n+(r?1:-1);r?s--:++s<i;)if(t(e[s],s,e))return s;return-1}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}},function(e,t,n){var r=n(69);e.exports=function(e,t){return r(t,(function(t){return e[t]}))}},function(e,t,n){var r=n(112),i=n(347),s=n(348),o=n(115),a=n(361),c=n(119),l=n(362),u=n(122),d=n(123),h=n(63),f=Math.max;e.exports=function(e,t,n,p,m,g,v,_){var b=2&t;if(!b&&"function"!=typeof e)throw new TypeError("Expected a function");var y=p?p.length:0;if(y||(t&=-97,p=m=void 0),v=void 0===v?v:f(h(v),0),_=void 0===_?_:h(_),y-=m?m.length:0,64&t){var w=p,S=m;p=m=void 0}var x=b?void 0:c(e),E=[e,t,n,p,m,w,S,g,v,_];if(x&&l(E,x),e=E[0],t=E[1],n=E[2],p=E[3],m=E[4],!(_=E[9]=void 0===E[9]?b?0:e.length:f(E[9]-y,0))&&24&t&&(t&=-25),t&&1!=t)A=8==t||16==t?s(e,t,_):32!=t&&33!=t||m.length?o.apply(void 0,E):a(e,t,n,p);else var A=i(e,t,n);return d((x?r:u)(A,E),e,t)}},function(e,t,n){var r=n(46),i=n(7);e.exports=function(e,t,n){var s=1&t,o=r(e);return function t(){var r=this&&this!==i&&this instanceof t?o:e;return r.apply(s?n:this,arguments)}}},function(e,t,n){var r=n(67),i=n(46),s=n(115),o=n(118),a=n(73),c=n(47),l=n(7);e.exports=function(e,t,n){var u=i(e);return function i(){for(var d=arguments.length,h=Array(d),f=d,p=a(i);f--;)h[f]=arguments[f];var m=d<3&&h[0]!==p&&h[d-1]!==p?[]:c(h,p);if((d-=m.length)<n)return o(e,t,s,i.placeholder,void 0,h,m,void 0,void 0,n-d);var g=this&&this!==l&&this instanceof i?u:e;return r(g,this,h)}}},function(e,t){e.exports=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}},function(e,t,n){var r=n(71),i=n(119),s=n(352),o=n(354);e.exports=function(e){var t=s(e),n=o[t];if("function"!=typeof n||!(t in r.prototype))return!1;if(e===n)return!0;var a=i(n);return!!a&&e===a[0]}},function(e,t){e.exports=function(){}},function(e,t,n){var r=n(353),i=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",n=r[t],s=i.call(r,t)?n.length:0;s--;){var o=n[s],a=o.func;if(null==a||a==e)return o.name}return t}},function(e,t){e.exports={}},function(e,t,n){var r=n(71),i=n(120),s=n(72),o=n(10),a=n(18),c=n(355),l=Object.prototype.hasOwnProperty;function u(e){if(a(e)&&!o(e)&&!(e instanceof r)){if(e instanceof i)return e;if(l.call(e,"__wrapped__"))return c(e)}return new i(e)}u.prototype=s.prototype,u.prototype.constructor=u,e.exports=u},function(e,t,n){var r=n(71),i=n(120),s=n(121);e.exports=function(e){if(e instanceof r)return e.clone();var t=new i(e.__wrapped__,e.__chain__);return t.__actions__=s(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},function(e,t){var n=/\{\n\/\* \[wrapped with (.+)\] \*/,r=/,? & /;e.exports=function(e){var t=e.match(n);return t?t[1].split(r):[]}},function(e,t){var n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=function(e,t){var r=t.length;if(!r)return e;var i=r-1;return t[i]=(r>1?"& ":"")+t[i],t=t.join(r>2?", ":" "),e.replace(n,"{\n/* [wrapped with "+t+"] */\n")}},function(e,t,n){var r=n(95),i=n(359),s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=function(e,t){return r(s,(function(n){var r="_."+n[0];t&n[1]&&!i(e,r)&&e.push(r)})),e.sort()}},function(e,t,n){var r=n(110);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},function(e,t,n){var r=n(121),i=n(36),s=Math.min;e.exports=function(e,t){for(var n=e.length,o=s(t.length,n),a=r(e);o--;){var c=t[o];e[o]=i(c,n)?a[c]:void 0}return e}},function(e,t,n){var r=n(67),i=n(46),s=n(7);e.exports=function(e,t,n,o){var a=1&t,c=i(e);return function t(){for(var i=-1,l=arguments.length,u=-1,d=o.length,h=Array(d+l),f=this&&this!==s&&this instanceof t?c:e;++u<d;)h[u]=o[u];for(;l--;)h[u++]=arguments[++i];return r(f,a?n:this,h)}}},function(e,t,n){var r=n(116),i=n(117),s=n(47),o=Math.min;e.exports=function(e,t){var n=e[1],a=t[1],c=n|a,l=c<131,u=128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n;if(!l&&!u)return e;1&a&&(e[2]=t[2],c|=1&n?0:4);var d=t[3];if(d){var h=e[3];e[3]=h?r(h,d,t[4]):d,e[4]=h?s(e[3],"__lodash_placeholder__"):t[4]}return(d=t[5])&&(h=e[5],e[5]=h?i(h,d,t[6]):d,e[6]=h?s(e[5],"__lodash_placeholder__"):t[6]),(d=t[7])&&(e[7]=d),128&a&&(e[8]=null==e[8]?t[8]:o(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=c,e}},function(e,t,n){var r=n(364),i=n(405),s=n(37),o=n(10),a=n(414);e.exports=function(e){return"function"==typeof e?e:null==e?s:"object"==typeof e?o(e)?i(e[0],e[1]):r(e):a(e)}},function(e,t,n){var r=n(365),i=n(404),s=n(132);e.exports=function(e){var t=i(e);return 1==t.length&&t[0][2]?s(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(124),i=n(125);e.exports=function(e,t,n,s){var o=n.length,a=o,c=!s;if(null==e)return!a;for(e=Object(e);o--;){var l=n[o];if(c&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var u=(l=n[o])[0],d=e[u],h=l[1];if(c&&l[2]){if(void 0===d&&!(u in e))return!1}else{var f=new r;if(s)var p=s(d,h,u,e,t,f);if(!(void 0===p?i(h,d,3,s,f):p))return!1}}return!0}},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var r=n(49),i=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():i.call(t,n,1),--this.size,!0)}},function(e,t,n){var r=n(49);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(49);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(49);e.exports=function(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}},function(e,t,n){var r=n(48);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(48),i=n(74),s=n(75);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!i||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new s(o)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(377),i=n(48),s=n(74);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(s||i),string:new r}}},function(e,t,n){var r=n(378),i=n(379),s=n(380),o=n(381),a=n(382);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=s,c.prototype.has=o,c.prototype.set=a,e.exports=c},function(e,t,n){var r=n(50);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var r=n(50),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(t,e)?t[e]:void 0}},function(e,t,n){var r=n(50),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:i.call(t,e)}},function(e,t,n){var r=n(50);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t,n){var r=n(51);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var r=n(51);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(51);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(51);e.exports=function(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}},function(e,t,n){var r=n(124),i=n(126),s=n(394),o=n(398),a=n(130),c=n(10),l=n(97),u=n(98),d="[object Object]",h=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,f,p,m){var g=c(e),v=c(t),_=g?"[object Array]":a(e),b=v?"[object Array]":a(t),y=(_="[object Arguments]"==_?d:_)==d,w=(b="[object Arguments]"==b?d:b)==d,S=_==b;if(S&&l(e)){if(!l(t))return!1;g=!0,y=!1}if(S&&!y)return m||(m=new r),g||u(e)?i(e,t,n,f,p,m):s(e,t,_,n,f,p,m);if(!(1&n)){var x=y&&h.call(e,"__wrapped__"),E=w&&h.call(t,"__wrapped__");if(x||E){var A=x?e.value():e,C=E?t.value():t;return m||(m=new r),p(A,C,n,f,m)}}return!!S&&(m||(m=new r),o(e,t,n,f,p,m))}},function(e,t,n){var r=n(75),i=n(390),s=n(391);function o(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}o.prototype.add=o.prototype.push=i,o.prototype.has=s,e.exports=o},function(e,t){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},function(e,t){e.exports=function(e,t){return e.has(t)}},function(e,t,n){var r=n(35),i=n(395),s=n(45),o=n(126),a=n(396),c=n(397),l=r?r.prototype:void 0,u=l?l.valueOf:void 0;e.exports=function(e,t,n,r,l,d,h){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||!d(new i(e),new i(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return s(+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 f=a;case"[object Set]":var p=1&r;if(f||(f=c),e.size!=t.size&&!p)return!1;var m=h.get(e);if(m)return m==t;r|=2,h.set(e,t);var g=o(f(e),f(t),r,l,d,h);return h.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(t)}return!1}},function(e,t,n){var r=n(7).Uint8Array;e.exports=r},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},function(e,t,n){var r=n(399),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,s,o,a){var c=1&n,l=r(e),u=l.length;if(u!=r(t).length&&!c)return!1;for(var d=u;d--;){var h=l[d];if(!(c?h in t:i.call(t,h)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var m=!0;a.set(e,t),a.set(t,e);for(var g=c;++d<u;){var v=e[h=l[d]],_=t[h];if(s)var b=c?s(_,v,h,t,e,a):s(v,_,h,e,t,a);if(!(void 0===b?v===_||o(v,_,n,s,a):b)){m=!1;break}g||(g="constructor"==h)}if(m&&!g){var y=e.constructor,w=t.constructor;y==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof w&&w instanceof w||(m=!1)}return a.delete(e),a.delete(t),m}},function(e,t,n){var r=n(127),i=n(128),s=n(30);e.exports=function(e){return r(e,s,i)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}},function(e,t,n){var r=n(23)(n(7),"DataView");e.exports=r},function(e,t,n){var r=n(23)(n(7),"Promise");e.exports=r},function(e,t,n){var r=n(23)(n(7),"Set");e.exports=r},function(e,t,n){var r=n(131),i=n(30);e.exports=function(e){for(var t=i(e),n=t.length;n--;){var s=t[n],o=e[s];t[n]=[s,o,r(o)]}return t}},function(e,t,n){var r=n(125),i=n(406),s=n(133),o=n(78),a=n(131),c=n(132),l=n(38);e.exports=function(e,t){return o(e)&&a(t)?c(l(e),t):function(n){var o=i(n,e);return void 0===o&&o===t?s(n,e):r(t,o,3)}}},function(e,t,n){var r=n(77);e.exports=function(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}},function(e,t,n){var r=n(408),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,o=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,(function(e,n,r,i){t.push(r?i.replace(s,"$1"):n||e)})),t}));e.exports=o},function(e,t,n){var r=n(409);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},function(e,t,n){var r=n(75);function i(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=e.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(i.Cache||r),n}i.Cache=r,e.exports=i},function(e,t,n){var r=n(411);e.exports=function(e){return null==e?"":r(e)}},function(e,t,n){var r=n(35),i=n(69),s=n(10),o=n(44),a=r?r.prototype:void 0,c=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(s(t))return i(t,e)+"";if(o(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},function(e,t,n){var r=n(52),i=n(64),s=n(10),o=n(36),a=n(66),c=n(38);e.exports=function(e,t,n){for(var l=-1,u=(t=r(t,e)).length,d=!1;++l<u;){var h=c(t[l]);if(!(d=null!=e&&n(e,h)))break;e=e[h]}return d||++l!=u?d:!!(u=null==e?0:e.length)&&a(u)&&o(h,u)&&(s(e)||i(e))}},function(e,t,n){var r=n(134),i=n(415),s=n(78),o=n(38);e.exports=function(e){return s(e)?r(o(e)):i(e)}},function(e,t,n){var r=n(77);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(102),i=n(52),s=n(36),o=n(17),a=n(38);e.exports=function(e,t,n,c){if(!o(e))return e;for(var l=-1,u=(t=i(t,e)).length,d=u-1,h=e;null!=h&&++l<u;){var f=a(t[l]),p=n;if("__proto__"===f||"constructor"===f||"prototype"===f)return e;if(l!=d){var m=h[f];void 0===(p=c?c(m,f,h):void 0)&&(p=o(m)?m:s(t[l+1])?[]:{})}r(h,f,p),h=h[f]}return e}},function(e,t,n){var r=n(127),i=n(418),s=n(109);e.exports=function(e){return r(e,s,i)}},function(e,t,n){var r=n(76),i=n(136),s=n(128),o=n(129),a=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,s(e)),e=i(e);return t}:o;e.exports=a},function(e,t,n){var r=n(420),i=n(421),s=n(422);e.exports=function(e){return i(e)?s(e):r(e)}},function(e,t,n){var r=n(134)("length");e.exports=r},function(e,t){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return n.test(e)}},function(e,t){var n="[\\ud800-\\udfff]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",i="\\ud83c[\\udffb-\\udfff]",s="[^\\ud800-\\udfff]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",c="(?:"+r+"|"+i+")"+"?",l="[\\ufe0e\\ufe0f]?"+c+("(?:\\u200d(?:"+[s,o,a].join("|")+")[\\ufe0e\\ufe0f]?"+c+")*"),u="(?:"+[s+r+"?",r,o,a,n].join("|")+")",d=RegExp(i+"(?="+i+")|"+u+l,"g");e.exports=function(e){for(var t=d.lastIndex=0;d.test(e);)++t;return t}},function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(424),s=(r=i)&&r.__esModule?r:{default:r};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}},function(e,t,n){e.exports={default:n(425),__esModule:!0}},function(e,t,n){n(426);var r=n(19).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){var r=n(27);r(r.S+r.F*!n(29),"Object",{defineProperty:n(39).f})},function(e,t,n){e.exports=!n(29)&&!n(79)((function(){return 7!=Object.defineProperty(n(80)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(40);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){e.exports={default:n(430),__esModule:!0}},function(e,t,n){n(431),e.exports=n(19).Object.keys},function(e,t,n){var r=n(139),i=n(140);n(436)("keys",(function(){return function(e){return i(r(e))}}))},function(e,t,n){var r=n(55),i=n(82),s=n(434)(!1),o=n(84)("IE_PROTO");e.exports=function(e,t){var n,a=i(e),c=0,l=[];for(n in a)n!=o&&r(a,n)&&l.push(n);for(;t.length>c;)r(a,n=t[c++])&&(~s(l,n)||l.push(n));return l}},function(e,t,n){var r=n(56);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(82),i=n(141),s=n(435);e.exports=function(e){return function(t,n,o){var a,c=r(t),l=i(c.length),u=s(o,l);if(e&&n!=n){for(;l>u;)if((a=c[u++])!=a)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var r=n(83),i=Math.max,s=Math.min;e.exports=function(e,t){return(e=r(e))<0?i(e+t,0):s(e,t)}},function(e,t,n){var r=n(27),i=n(19),s=n(79);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],o={};o[e]=t(n),r(r.S+r.F*s((function(){n(1)})),"Object",o)}},function(e,t,n){e.exports=n(438)},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,s=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(439),i)r.regeneratorRuntime=s;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";var n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag",c="object"==typeof e,l=t.regeneratorRuntime;if(l)c&&(e.exports=l);else{(l=t.regeneratorRuntime=c?e.exports:{}).wrap=m;var u={},d={};d[s]=function(){return this};var h=Object.getPrototypeOf,f=h&&h(h(C([])));f&&f!==n&&r.call(f,s)&&(d=f);var p=b.prototype=v.prototype=Object.create(d);_.prototype=p.constructor=b,b.constructor=_,b[a]=_.displayName="GeneratorFunction",l.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(p),e},l.awrap=function(e){return{__await:e}},y(w.prototype),w.prototype[o]=function(){return this},l.AsyncIterator=w,l.async=function(e,t,n,r){var i=new w(m(e,t,n,r));return l.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},y(p),p[a]="Generator",p[s]=function(){return this},p.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 r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},l.values=C,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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 n(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var a=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(a&&c){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.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&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,u):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),u},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),E(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}}}function m(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,s=Object.create(i.prototype),o=new A(r||[]);return s._invoke=function(e,t,n){var r="suspendedStart";return function(i,s){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw s;return T()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=S(o,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=g(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),s}function g(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function v(){}function _(){}function b(){}function y(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function w(e){var t;this._invoke=function(n,i){function s(){return new Promise((function(t,s){!function t(n,i,s,o){var a=g(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,s,o)}),(function(e){t("throw",e,s,o)})):Promise.resolve(l).then((function(e){c.value=e,s(c)}),o)}o(a.arg)}(n,i,t,s)}))}return t=t?t.then(s,s):s()}}function S(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=g(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,u;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function x(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 E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function C(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:void 0,done:!0}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(86),s=(r=i)&&r.__esModule?r:{default:r};t.default=function(e){return function(){var t=e.apply(this,arguments);return new s.default((function(e,n){return function r(i,o){try{var a=t[i](o),c=a.value}catch(e){return void n(e)}if(!a.done)return s.default.resolve(c).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(c)}("next")}))}}},function(e,t,n){n(442),n(443),n(450),n(454),n(466),n(467),e.exports=n(19).Promise},function(e,t){},function(e,t,n){"use strict";var r=n(444)(!0);n(145)(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=r(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(83),i=n(81);e.exports=function(e){return function(t,n){var s,o,a=String(i(t)),c=r(n),l=a.length;return c<0||c>=l?e?"":void 0:(s=a.charCodeAt(c))<55296||s>56319||c+1===l||(o=a.charCodeAt(c+1))<56320||o>57343?e?a.charAt(c):s:e?a.slice(c,c+2):o-56320+(s-55296<<10)+65536}}},function(e,t,n){e.exports=n(28)},function(e,t,n){"use strict";var r=n(447),i=n(138),s=n(87),o={};n(28)(o,n(15)("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(o,{next:i(1,n)}),s(e,t+" Iterator")}},function(e,t,n){var r=n(24),i=n(448),s=n(144),o=n(84)("IE_PROTO"),a=function(){},c=function(){var e,t=n(80)("iframe"),r=s.length;for(t.style.display="none",n(146).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;r--;)delete c.prototype[s[r]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(a.prototype=r(e),n=new a,a.prototype=null,n[o]=e):n=c(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(39),i=n(24),s=n(140);e.exports=n(29)?Object.defineProperties:function(e,t){i(e);for(var n,o=s(t),a=o.length,c=0;a>c;)r.f(e,n=o[c++],t[n]);return e}},function(e,t,n){var r=n(55),i=n(139),s=n(84)("IE_PROTO"),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},function(e,t,n){n(451);for(var r=n(11),i=n(28),s=n(41),o=n(15)("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],u=r[l],d=u&&u.prototype;d&&!d[o]&&i(d,o,l),s[l]=s.Array}},function(e,t,n){"use strict";var r=n(452),i=n(453),s=n(41),o=n(82);e.exports=n(145)(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,i(1)):i(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),s.Arguments=s.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){"use strict";var r,i,s,o,a=n(85),c=n(11),l=n(53),u=n(147),d=n(27),h=n(40),f=n(54),p=n(455),m=n(456),g=n(148),v=n(149).set,_=n(461)(),b=n(88),y=n(150),w=n(462),S=n(151),x=c.TypeError,E=c.process,A=E&&E.versions,C=A&&A.v8||"",T=c.Promise,O="process"==u(E),j=function(){},k=i=b.f,N=!!function(){try{var e=T.resolve(1),t=(e.constructor={})[n(15)("species")]=function(e){e(j,j)};return(O||"function"==typeof PromiseRejectionEvent)&&e.then(j)instanceof t&&0!==C.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(e){}}(),M=function(e){var t;return!(!h(e)||"function"!=typeof(t=e.then))&&t},I=function(e,t){if(!e._n){e._n=!0;var n=e._c;_((function(){for(var r=e._v,i=1==e._s,s=0,o=function(t){var n,s,o,a=i?t.ok:t.fail,c=t.resolve,l=t.reject,u=t.domain;try{a?(i||(2==e._h&&L(e),e._h=1),!0===a?n=r:(u&&u.enter(),n=a(r),u&&(u.exit(),o=!0)),n===t.promise?l(x("Promise-chain cycle")):(s=M(n))?s.call(n,c,l):c(n)):l(r)}catch(e){u&&!o&&u.exit(),l(e)}};n.length>s;)o(n[s++]);e._c=[],e._n=!1,t&&!e._h&&R(e)}))}},R=function(e){v.call(c,(function(){var t,n,r,i=e._v,s=D(e);if(s&&(t=y((function(){O?E.emit("unhandledRejection",i,e):(n=c.onunhandledrejection)?n({promise:e,reason:i}):(r=c.console)&&r.error&&r.error("Unhandled promise rejection",i)})),e._h=O||D(e)?2:1),e._a=void 0,s&&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;O?E.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()),I(t,!0))},P=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw x("Promise can't be resolved itself");(t=M(e))?_((function(){var r={_w:n,_d:!1};try{t.call(e,l(P,r,1),l(z,r,1))}catch(e){z.call(r,e)}})):(n._v=e,n._s=1,I(n,!1))}catch(e){z.call({_w:n,_d:!1},e)}}};N||(T=function(e){p(this,T,"Promise","_h"),f(e),r.call(this);try{e(l(P,this,1),l(z,this,1))}catch(e){z.call(this,e)}},(r=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(463)(T.prototype,{then:function(e,t){var n=k(g(this,T));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=O?E.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&I(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),s=function(){var e=new r;this.promise=e,this.resolve=l(P,e,1),this.reject=l(z,e,1)},b.f=k=function(e){return e===T||e===o?new s(e):i(e)}),d(d.G+d.W+d.F*!N,{Promise:T}),n(87)(T,"Promise"),n(464)("Promise"),o=n(19).Promise,d(d.S+d.F*!N,"Promise",{reject:function(e){var t=k(this);return(0,t.reject)(e),t.promise}}),d(d.S+d.F*(a||!N),"Promise",{resolve:function(e){return S(a&&this===o?T:this,e)}}),d(d.S+d.F*!(N&&n(465)((function(e){T.all(e).catch(j)}))),"Promise",{all:function(e){var t=this,n=k(t),r=n.resolve,i=n.reject,s=y((function(){var n=[],s=0,o=1;m(e,!1,(function(e){var a=s++,c=!1;n.push(void 0),o++,t.resolve(e).then((function(e){c||(c=!0,n[a]=e,--o||r(n))}),i)})),--o||r(n)}));return s.e&&i(s.v),n.promise},race:function(e){var t=this,n=k(t),r=n.reject,i=y((function(){m(e,!1,(function(e){t.resolve(e).then(n.resolve,r)}))}));return i.e&&r(i.v),n.promise}})},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(53),i=n(457),s=n(458),o=n(24),a=n(141),c=n(459),l={},u={};(t=e.exports=function(e,t,n,d,h){var f,p,m,g,v=h?function(){return e}:c(e),_=r(n,d,t?2:1),b=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(s(v)){for(f=a(e.length);f>b;b++)if((g=t?_(o(p=e[b])[0],p[1]):_(e[b]))===l||g===u)return g}else for(m=v.call(e);!(p=m.next()).done;)if((g=i(m,_,p.value,t))===l||g===u)return g}).BREAK=l,t.RETURN=u},function(e,t,n){var r=n(24);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var s=e.return;throw void 0!==s&&r(s.call(e)),t}}},function(e,t,n){var r=n(41),i=n(15)("iterator"),s=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||s[i]===e)}},function(e,t,n){var r=n(147),i=n(15)("iterator"),s=n(41);e.exports=n(19).getIteratorMethod=function(e){if(null!=e)return e[i]||e["@@iterator"]||s[r(e)]}},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?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)}},function(e,t,n){var r=n(11),i=n(149).set,s=r.MutationObserver||r.WebKitMutationObserver,o=r.process,a=r.Promise,c="process"==n(56)(o);e.exports=function(){var e,t,n,l=function(){var r,i;for(c&&(r=o.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(c)n=function(){o.nextTick(l)};else if(!s||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var u=a.resolve(void 0);n=function(){u.then(l)}}else n=function(){i.call(r,l)};else{var d=!0,h=document.createTextNode("");new s(l).observe(h,{characterData:!0}),n=function(){h.data=d=!d}}return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t,n){var r=n(11).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){var r=n(28);e.exports=function(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:r(e,i,t[i]);return e}},function(e,t,n){"use strict";var r=n(11),i=n(19),s=n(39),o=n(29),a=n(15)("species");e.exports=function(e){var t="function"==typeof i[e]?i[e]:r[e];o&&t&&!t[a]&&s.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(15)("iterator"),i=!1;try{var s=[7][r]();s.return=function(){i=!0},Array.from(s,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var s=[7],o=s[r]();o.next=function(){return{done:n=!0}},s[r]=function(){return o},e(s)}catch(e){}return n}},function(e,t,n){"use strict";var r=n(27),i=n(19),s=n(11),o=n(148),a=n(151);r(r.P+r.R,"Promise",{finally:function(e){var t=o(this,i.Promise||s.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)}})},function(e,t,n){"use strict";var r=n(27),i=n(88),s=n(150);r(r.S,"Promise",{try:function(e){var t=i.f(this),n=s(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(86),s=(r=i)&&r.__esModule?r:{default:r};function o(){return window.browser&&browser.storage||window.chrome&&chrome.storage}t.getStorage=o,t.usePromise=function(e,t){if(function(){var e=o();try{return e&&e.local.get&&e.local.get()&&"function"==typeof e.local.get().then}catch(e){return!1}}())return e(t);return new s.default((function(n){e(t,(function(){n.apply(void 0,arguments)}))}))}},function(e,t,n){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(e,t){var n=/[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"+n.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+n.source+r.source+"*(?::"+n.source+r.source+"*)?$");function s(){}function o(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function a(e,t,n,r,i,s){for(var o,a=++t,c=0;;){var l=e.charAt(a);switch(l){case"=":if(1===c)o=e.slice(t,a),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(s.warning('attribute value must after "="'),o=e.slice(t,a)),t=a+1,!((a=e.indexOf(l,t))>0))throw new Error("attribute value no end '"+l+"' match");u=e.slice(t,a).replace(/&#?\w+;/g,i),n.add(o,u,t-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');u=e.slice(t,a).replace(/&#?\w+;/g,i),n.add(o,u,t),s.warning('attribute "'+o+'" missed start quot('+l+")!!"),t=a+1,c=5}break;case"/":switch(c){case 0:n.setTagName(e.slice(t,a));case 5:case 6:case 7:c=7,n.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==c&&n.setTagName(e.slice(t,a)),a;case">":switch(c){case 0:n.setTagName(e.slice(t,a));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=e.slice(t,a)).slice(-1)&&(n.closed=!0,u=u.slice(0,-1));case 2:2===c&&(u=o),4==c?(s.warning('attribute "'+u+'" missed quot(")!!'),n.add(o,u.replace(/&#?\w+;/g,i),t)):("http://www.w3.org/1999/xhtml"===r[""]&&u.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),n.add(u,u,t));break;case 3:throw new Error("attribute value missed!!")}return a;case"€":l=" ";default:if(l<=" ")switch(c){case 0:n.setTagName(e.slice(t,a)),c=6;break;case 1:o=e.slice(t,a),c=2;break;case 4:var u=e.slice(t,a).replace(/&#?\w+;/g,i);s.warning('attribute "'+u+'" missed quot(")!!'),n.add(o,u,t);case 5:c=6}else switch(c){case 2:n.tagName;"http://www.w3.org/1999/xhtml"===r[""]&&o.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),n.add(o,o,t),t=a,c=1;break;case 5:s.warning('attribute space is required"'+o+'"!!');case 6:c=1,t=a;break;case 3:c=4,t=a;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}a++}}function c(e,t,n){for(var r=e.tagName,i=null,s=e.length;s--;){var o=e[s],a=o.qName,c=o.value;if((f=a.indexOf(":"))>0)var l=o.prefix=a.slice(0,f),u=a.slice(f+1),h="xmlns"===l&&u;else u=a,l=null,h="xmlns"===a&&"";o.localName=u,!1!==h&&(null==i&&(i={},d(n,n={})),n[h]=i[h]=c,o.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(h,c))}for(s=e.length;s--;){(l=(o=e[s]).prefix)&&("xml"===l&&(o.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==l&&(o.uri=n[l||""]))}var f;(f=r.indexOf(":"))>0?(l=e.prefix=r.slice(0,f),u=e.localName=r.slice(f+1)):(l=null,u=e.localName=r);var p=e.uri=n[l||""];if(t.startElement(p,u,r,e),!e.closed)return e.currentNSMap=n,e.localNSMap=i,!0;if(t.endElement(p,u,r),i)for(l in i)t.endPrefixMapping(l)}function l(e,t,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var s=e.indexOf("</"+n+">",t),o=e.substring(t+1,s);if(/[&<]/.test(o))return/^script$/i.test(n)?(i.characters(o,0,o.length),s):(o=o.replace(/&#?\w+;/g,r),i.characters(o,0,o.length),s)}return t+1}function u(e,t,n,r){var i=r[n];return null==i&&((i=e.lastIndexOf("</"+n+">"))<t&&(i=e.lastIndexOf("</"+n)),r[n]=i),i<t}function d(e,t){for(var n in e)t[n]=e[n]}function h(e,t,n,r){switch(e.charAt(t+2)){case"-":return"-"===e.charAt(t+3)?(i=e.indexOf("--\x3e",t+4))>t?(n.comment(e,t+4,i-t-4),i+3):(r.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var i=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,i-t-9),n.endCDATA(),i+3}var s=function(e,t){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;i.lastIndex=t,i.exec(e);for(;n=i.exec(e);)if(r.push(n),n[1])return r}(e,t),o=s.length;if(o>1&&/!doctype/i.test(s[0][0])){var a=s[1][0],c=o>3&&/^public$/i.test(s[2][0])&&s[3][0],l=o>4&&s[4][0],u=s[o-1];return n.startDTD(a,c&&c.replace(/^(['"])(.*?)\1$/,"$2"),l&&l.replace(/^(['"])(.*?)\1$/,"$2")),n.endDTD(),u.index+u[0].length}}return-1}function f(e,t,n){var r=e.indexOf("?>",t);if(r){var i=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i){i[0].length;return n.processingInstruction(i[1],i[2]),r+2}return-1}return-1}function p(e){}function m(e,t){return e.__proto__=t,e}s.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),d(t,t={}),function(e,t,n,r,i){function s(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"))):(i.error("entity not found:"+e),e)}function d(t){if(t>S){var n=e.substring(S,t).replace(/&#?\w+;/g,s);b&&m(S),r.characters(n,0,t-S),S=t}}function m(t,n){for(;t>=v&&(n=_.exec(e));)g=n.index,v=g+n[0].length,b.lineNumber++;b.columnNumber=t-g+1}var g=0,v=0,_=/.*(?:\r\n?|\n)|.*$/g,b=r.locator,y=[{currentNSMap:t}],w={},S=0;for(;;){try{var x=e.indexOf("<",S);if(x<0){if(!e.substr(S).match(/^\s*$/)){var E=r.doc,A=E.createTextNode(e.substr(S));E.appendChild(A),r.currentElement=A}return}switch(x>S&&d(x),e.charAt(x+1)){case"/":var C=e.indexOf(">",x+3),T=e.substring(x+2,C),O=y.pop();C<0?(T=e.substring(x+2).replace(/[\s<].*/,""),i.error("end tag name: "+T+" is not complete:"+O.tagName),C=x+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),i.error("end tag name: "+T+" maybe not complete"),C=x+1+T.length);var j=O.localNSMap,k=O.tagName==T;if(k||O.tagName&&O.tagName.toLowerCase()==T.toLowerCase()){if(r.endElement(O.uri,O.localName,T),j)for(var N in j)r.endPrefixMapping(N);k||i.fatalError("end tag name: "+T+" is not match the current start tagName:"+O.tagName)}else y.push(O);C++;break;case"?":b&&m(x),C=f(e,x,r);break;case"!":b&&m(x),C=h(e,x,r,i);break;default:b&&m(x);var M=new p,I=y[y.length-1].currentNSMap,R=(C=a(e,x,M,I,s,i),M.length);if(!M.closed&&u(e,C,M.tagName,w)&&(M.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),b&&R){for(var D=o(b,{}),L=0;L<R;L++){var z=M[L];m(z.offset),z.locator=o(b,{})}r.locator=D,c(M,r,I)&&y.push(M),r.locator=b}else c(M,r,I)&&y.push(M);"http://www.w3.org/1999/xhtml"!==M.uri||M.closed?C++:C=l(e,C,M.tagName,s,r)}}catch(e){i.error("element parse error: "+e),C=-1}C>S?S=C:d(Math.max(x,S)+1)}}(e,t,n,r,this.errorHandler),r.endDocument()}},p.prototype={setTagName:function(e){if(!i.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,n){if(!i.test(e))throw new Error("invalid attribute:"+e);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}},m({},m.prototype)instanceof m||(m=function(e,t){function n(){}for(t in n.prototype=t,n=new n,e)n[t]=e[t];return n}),t.XMLReader=s},function(e,t,n){"use strict";function r(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 t="",n=0,i=0;for(let s=0;s<e.length;s++)n<<=6,n|=r(e[s]),i+=6,24===i&&(t+=String.fromCharCode((16711680&n)>>16),t+=String.fromCharCode((65280&n)>>8),t+=String.fromCharCode(255&n),n=i=0);return 12===i?(n>>=4,t+=String.fromCharCode(n)):18===i&&(n>>=2,t+=String.fromCharCode((65280&n)>>8),t+=String.fromCharCode(255&n)),t}},function(e,t,n){"use strict";function r(e){if(e>=0&&e<64)return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[e]}e.exports=function(e){let t;for(e=""+e,t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return null;let n="";for(t=0;t<e.length;t+=3){const i=[void 0,void 0,void 0,void 0];i[0]=e.charCodeAt(t)>>2,i[1]=(3&e.charCodeAt(t))<<4,e.length>t+1&&(i[1]|=e.charCodeAt(t+1)>>4,i[2]=(15&e.charCodeAt(t+1))<<2),e.length>t+2&&(i[2]|=e.charCodeAt(t+2)>>6,i[3]=63&e.charCodeAt(t+2));for(let e=0;e<i.length;e++)void 0===i[e]?n+="=":n+=r(i[e])}return n}},function(e,t,n){"use strict";n(154);var r=n(1);const i={};i.debug=r.e.LogLevel.DEBUG,i.info=r.e.LogLevel.INFO,i.warn=r.e.LogLevel.WARN,i.error=r.e.LogLevel.ERROR,i.fatal=r.e.LogLevel.FATAL,r.e.WorkerWebsocket=class extends r.e.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),r.e.log(r.e.LogLevel.ERROR,"Shared Worker Error: ".concat(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===r.e.Status.ATTACHED?(this._conn.jid=t,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(r.e.Status.ATTACHED)):e===r.e.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(r.e.Status.ATTACHFAIL))}_disconnect(e,t){t&&this._conn.send(t);const n=Object(r.a)("close",{xmlns:r.e.NS.FRAMING});this._conn.xmlOutput(n.tree());const i=r.e.serialize(n);this._conn.rawOutput(i),this.worker.port.postMessage(["send",i]),this._conn._doDisconnect()}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(r.e.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected?(r.e.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(r.e.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):r.e.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){r.e.log(r.e.LogLevel.ERROR,e)}else if("log"===n){const e=t[1],n=t[2];r.e.log(i[e],n)}else r.e.log(r.e.LogLevel.ERROR,"Found unhandled service worker message: ".concat(t))}}},function(e,t,n){var r=n(7);e.exports=function(){return r.Date.now()}},function(e,t,n){var r=n(21),i=n(136),s=n(18),o=Function.prototype,a=Object.prototype,c=o.toString,l=a.hasOwnProperty,u=c.call(Object);e.exports=function(e){if(!s(e)||"[object Object]"!=r(e))return!1;var t=i(e);if(null===t)return!0;var n=l.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==u}},function(e,t,n){var r={"./af/LC_MESSAGES/converse.po":[492,138],"./ar/LC_MESSAGES/converse.po":[493,139],"./bg/LC_MESSAGES/converse.po":[494,140],"./ca/LC_MESSAGES/converse.po":[495,141],"./cs/LC_MESSAGES/converse.po":[496,142],"./da/LC_MESSAGES/converse.po":[497,143],"./de/LC_MESSAGES/converse.po":[498,146],"./eo/LC_MESSAGES/converse.po":[499,147],"./es/LC_MESSAGES/converse.po":[500,148],"./eu/LC_MESSAGES/converse.po":[501,149],"./fi/LC_MESSAGES/converse.po":[502,150],"./fr/LC_MESSAGES/converse.po":[503,151],"./gl/LC_MESSAGES/converse.po":[504,152],"./he/LC_MESSAGES/converse.po":[505,153],"./hi/LC_MESSAGES/converse.po":[506,154],"./hu/LC_MESSAGES/converse.po":[507,155],"./id/LC_MESSAGES/converse.po":[508,156],"./it/LC_MESSAGES/converse.po":[509,157],"./ja/LC_MESSAGES/converse.po":[510,158],"./lt/LC_MESSAGES/converse.po":[511,159],"./mr/LC_MESSAGES/converse.po":[512,160],"./nb/LC_MESSAGES/converse.po":[513,161],"./nl/LC_MESSAGES/converse.po":[514,162],"./nl_BE/LC_MESSAGES/converse.po":[515,163],"./oc/LC_MESSAGES/converse.po":[516,164],"./pl/LC_MESSAGES/converse.po":[517,165],"./pt/LC_MESSAGES/converse.po":[518,166],"./pt_BR/LC_MESSAGES/converse.po":[519,167],"./ro/LC_MESSAGES/converse.po":[520,168],"./ru/LC_MESSAGES/converse.po":[521,169],"./sv/LC_MESSAGES/converse.po":[522,170],"./th/LC_MESSAGES/converse.po":[523,171],"./tr/LC_MESSAGES/converse.po":[524,172],"./uk/LC_MESSAGES/converse.po":[525,173],"./vi/LC_MESSAGES/converse.po":[526,174],"./zh_CN/LC_MESSAGES/converse.po":[527,175],"./zh_TW/LC_MESSAGES/converse.po":[528,176]};function i(e){if(!n.o(r,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return n.e(t[1]).then((function(){return n.t(i,3)}))}i.keys=function(){return Object.keys(r)},i.id=476,e.exports=i},function(e,t,n){var r={"./af":[173,0],"./af.js":[173,0],"./ar":[180,1],"./ar-dz":[174,2],"./ar-dz.js":[174,2],"./ar-kw":[175,3],"./ar-kw.js":[175,3],"./ar-ly":[176,4],"./ar-ly.js":[176,4],"./ar-ma":[177,5],"./ar-ma.js":[177,5],"./ar-sa":[178,6],"./ar-sa.js":[178,6],"./ar-tn":[179,7],"./ar-tn.js":[179,7],"./ar.js":[180,1],"./az":[181,8],"./az.js":[181,8],"./be":[182,9],"./be.js":[182,9],"./bg":[183,10],"./bg.js":[183,10],"./bi":[184,11],"./bi.js":[184,11],"./bm":[185,12],"./bm.js":[185,12],"./bn":[186,13],"./bn.js":[186,13],"./bo":[187,14],"./bo.js":[187,14],"./br":[188,15],"./br.js":[188,15],"./bs":[189,16],"./bs.js":[189,16],"./ca":[190,17],"./ca.js":[190,17],"./cs":[191,18],"./cs.js":[191,18],"./cv":[192,19],"./cv.js":[192,19],"./cy":[193,20],"./cy.js":[193,20],"./da":[194,21],"./da.js":[194,21],"./de":[197,22],"./de-at":[195,23],"./de-at.js":[195,23],"./de-ch":[196,24],"./de-ch.js":[196,24],"./de.js":[197,22],"./dv":[198,25],"./dv.js":[198,25],"./el":[199,26],"./el.js":[199,26],"./en":[209,27],"./en-SG":[200,28],"./en-SG.js":[200,28],"./en-au":[201,29],"./en-au.js":[201,29],"./en-ca":[202,30],"./en-ca.js":[202,30],"./en-gb":[203,31],"./en-gb.js":[203,31],"./en-ie":[204,32],"./en-ie.js":[204,32],"./en-il":[205,33],"./en-il.js":[205,33],"./en-in":[206,34],"./en-in.js":[206,34],"./en-nz":[207,35],"./en-nz.js":[207,35],"./en-tt":[208,36],"./en-tt.js":[208,36],"./en.js":[209,27],"./eo":[210,37],"./eo.js":[210,37],"./es":[214,38],"./es-do":[211,39],"./es-do.js":[211,39],"./es-pr":[212,40],"./es-pr.js":[212,40],"./es-us":[213,41],"./es-us.js":[213,41],"./es.js":[214,38],"./et":[215,42],"./et.js":[215,42],"./eu":[216,43],"./eu.js":[216,43],"./fa":[217,44],"./fa.js":[217,44],"./fi":[218,45],"./fi.js":[218,45],"./fo":[219,46],"./fo.js":[219,46],"./fr":[222,47],"./fr-ca":[220,48],"./fr-ca.js":[220,48],"./fr-ch":[221,49],"./fr-ch.js":[221,49],"./fr.js":[222,47],"./fy":[223,50],"./fy.js":[223,50],"./ga":[224,51],"./ga.js":[224,51],"./gd":[225,52],"./gd.js":[225,52],"./gl":[226,53],"./gl.js":[226,53],"./gom-latn":[227,54],"./gom-latn.js":[227,54],"./gu":[228,55],"./gu.js":[228,55],"./he":[229,56],"./he.js":[229,56],"./hi":[230,57],"./hi.js":[230,57],"./hr":[231,58],"./hr.js":[231,58],"./ht":[232,59],"./ht.js":[232,59],"./hu":[233,60],"./hu.js":[233,60],"./hy-am":[234,61],"./hy-am.js":[234,61],"./id":[235,62],"./id.js":[235,62],"./index.d.ts":[529,144],"./is":[236,63],"./is.js":[236,63],"./it":[238,64],"./it-ch":[237,65],"./it-ch.js":[237,65],"./it.js":[238,64],"./ja":[239,66],"./ja.js":[239,66],"./jv":[240,67],"./jv.js":[240,67],"./ka":[241,68],"./ka.js":[241,68],"./kk":[242,69],"./kk.js":[242,69],"./km":[243,70],"./km.js":[243,70],"./kn":[244,71],"./kn.js":[244,71],"./ko":[245,72],"./ko.js":[245,72],"./ku":[246,73],"./ku.js":[246,73],"./ky":[247,74],"./ky.js":[247,74],"./lb":[248,75],"./lb.js":[248,75],"./lo":[249,76],"./lo.js":[249,76],"./lt":[250,77],"./lt.js":[250,77],"./lv":[251,78],"./lv.js":[251,78],"./me":[252,79],"./me.js":[252,79],"./mi":[253,80],"./mi.js":[253,80],"./mk":[254,81],"./mk.js":[254,81],"./ml":[255,82],"./ml.js":[255,82],"./mn":[256,83],"./mn.js":[256,83],"./mr":[257,84],"./mr.js":[257,84],"./ms":[259,85],"./ms-my":[258,86],"./ms-my.js":[258,86],"./ms.js":[259,85],"./mt":[260,87],"./mt.js":[260,87],"./my":[261,88],"./my.js":[261,88],"./nb":[262,89],"./nb.js":[262,89],"./ne":[263,90],"./ne.js":[263,90],"./nl":[265,91],"./nl-be":[264,92],"./nl-be.js":[264,92],"./nl.js":[265,91],"./nn":[266,93],"./nn.js":[266,93],"./oc-lnc":[267,94],"./oc-lnc.js":[267,94],"./pa-in":[268,95],"./pa-in.js":[268,95],"./pl":[269,96],"./pl.js":[269,96],"./pt":[271,97],"./pt-br":[270,98],"./pt-br.js":[270,98],"./pt.js":[271,97],"./ro":[272,99],"./ro.js":[272,99],"./ru":[273,100],"./ru.js":[273,100],"./rw":[274,101],"./rw.js":[274,101],"./sd":[275,102],"./sd.js":[275,102],"./se":[276,103],"./se.js":[276,103],"./si":[277,104],"./si.js":[277,104],"./sk":[278,105],"./sk.js":[278,105],"./sl":[279,106],"./sl.js":[279,106],"./sq":[280,107],"./sq.js":[280,107],"./sr":[282,108],"./sr-cyrl":[281,109],"./sr-cyrl.js":[281,109],"./sr.js":[282,108],"./ss":[283,110],"./ss.js":[283,110],"./sv":[284,111],"./sv.js":[284,111],"./sw":[285,112],"./sw.js":[285,112],"./ta":[286,113],"./ta.js":[286,113],"./te":[287,114],"./te.js":[287,114],"./tet":[288,115],"./tet.js":[288,115],"./tg":[289,116],"./tg.js":[289,116],"./th":[290,117],"./th.js":[290,117],"./tk":[291,118],"./tk.js":[291,118],"./tl-ph":[292,119],"./tl-ph.js":[292,119],"./tlh":[293,120],"./tlh.js":[293,120],"./tr":[294,121],"./tr.js":[294,121],"./types.d.ts":[530,145],"./tzl":[295,122],"./tzl.js":[295,122],"./tzm":[297,123],"./tzm-latn":[296,124],"./tzm-latn.js":[296,124],"./tzm.js":[297,123],"./ug-cn":[298,125],"./ug-cn.js":[298,125],"./uk":[299,126],"./uk.js":[299,126],"./ur":[300,127],"./ur.js":[300,127],"./uz":[302,128],"./uz-latn":[301,129],"./uz-latn.js":[301,129],"./uz.js":[302,128],"./vi":[303,130],"./vi.js":[303,130],"./x-pseudo":[304,131],"./x-pseudo.js":[304,131],"./yo":[305,132],"./yo.js":[305,132],"./zh":[309,133],"./zh-cn":[306,134],"./zh-cn.js":[306,134],"./zh-hk":[307,135],"./zh-hk.js":[307,135],"./zh-tw":[308,136],"./zh-tw.js":[308,136],"./zh.js":[309,133]};function i(e){if(!n.o(r,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return n.e(t[1]).then((function(){return n.t(i,7)}))}i.keys=function(){return Object.keys(r)},i.id=477,e.exports=i},function(e,t,n){var r=n(135),i=n(133);e.exports=function(e,t){return r(e,t,(function(t,n){return i(e,n)}))}},function(e,t,n){var r=n(480),i=n(107),s=n(68);e.exports=function(e){return s(i(e,void 0,r),e+"")}},function(e,t,n){var r=n(481);e.exports=function(e){return(null==e?0:e.length)?r(e,1):[]}},function(e,t,n){var r=n(76),i=n(482);e.exports=function e(t,n,s,o,a){var c=-1,l=t.length;for(s||(s=i),a||(a=[]);++c<l;){var u=t[c];n>0&&s(u)?n>1?e(u,n-1,s,o,a):r(a,u):o||(a[a.length]=u)}return a}},function(e,t,n){var r=n(35),i=n(64),s=n(10),o=r?r.isConcatSpreadable:void 0;e.exports=function(e){return s(e)||i(e)||!!(o&&e&&e[o])}},function(e,t,n){"use strict";var r=n(8),i=n(2);i.d.Request=class{constructor(e,t,n,r){this.id=++i.d._requestId,this.xmlData=e,this.data=i.d.serialize(e),this.origFunc=t,this.func=t,this.rid=n,this.date=NaN,this.sends=r||0,this.abort=!1,this.dead=null,this.age=function(){if(!this.date)return 0;return(new Date-this.date)/1e3},this.timeDead=function(){if(!this.dead)return 0;return(new Date-this.dead)/1e3},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 i.d.error("invalid response received"),i.d.error("responseText: "+this.xhr.responseText),i.d.error("responseXML: "+i.d.serialize(this.xhr.responseXML)),new Error("parsererror")}else if(this.xhr.responseText){if(i.d.debug("Got responseText but no responseXML; attempting to parse it with DOMParser..."),e=(new r.a).parseFromString(this.xhr.responseText,"application/xml").documentElement,!e)throw new Error("Parsing produced null node");if(e.querySelector("parsererror")){i.d.error("invalid response received: "+e.querySelector("parsererror").textContent),i.d.error("responseText: "+this.xhr.responseText);const t=new Error;throw t.name=i.d.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}},i.d.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=Object(i.a)("body",{rid:this.rid++,xmlns:i.d.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 r=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":i.d.NS.BOSH});n&&r.attrs({route:n});const s=this._conn._connect_cb;this._requests.push(new i.d.Request(r.tree(),this._onRequestStateChange.bind(this,s.bind(this._conn)),r.tree().getAttribute("rid"))),this._throttledRequestHandler()}_attach(e,t,n,r,s,o,a){this._conn.jid=e,this.sid=t,this.rid=n,this._conn.connect_callback=r,this._conn.domain=i.d.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=s||this.wait,this.hold=o||this.hold,this.window=a||this.window,this._conn._changeConnectStatus(i.d.Status.ATTACHED,null)}_restore(e,t,n,r,s){const o=JSON.parse(window.sessionStorage.getItem("strophe-bosh-session"));if(!(null!=o&&o.rid&&o.sid&&o.jid&&(null==e||i.d.getBareJidFromJid(o.jid)===i.d.getBareJidFromJid(e)||null===i.d.getNodeFromJid(e)&&i.d.getDomainFromJid(o.jid)===e))){const e=new Error("_restore: no restoreable session.");throw e.name="StropheSessionError",e}this._conn.restored=!0,this._attach(o.jid,o.sid,o.rid,t,n,r,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");i.d.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(i.d.Status.CONNFAIL,t)):this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(t),i.d.Status.CONNFAIL}this.sid||(this.sid=e.getAttribute("sid"));const n=e.getAttribute("requests");n&&(this.window=parseInt(n,10));const r=e.getAttribute("hold");r&&(this.hold=parseInt(r,10));const s=e.getAttribute("wait");s&&(this.wait=parseInt(s,10));const o=e.getAttribute("inactivity");o&&(this.inactivity=parseInt(o,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),r=this._conn.protocolErrorHandlers.HTTP[n];r&&r.call(this,n)}_hitError(e){this.errors++,i.d.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(e){i.d.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 i.d.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&&(i.d.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":i.d.NS.BOSH}):t.cnode(e[n]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new i.d.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(i.d.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(i.d.TIMEOUT*this.wait)&&(i.d.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(i.d.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){i.d.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(i.d.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 r=e._getRequestStatus(n);if(this.lastResponseHeaders=n.xhr.getAllResponseHeaders(),this._conn.disconnecting&&r>=400)return this._hitError(r),void this._callProtocolErrorHandlers(n);const s=r>0&&r<500,o=n.sends>this._conn.maxRetries;if((s||o)&&(this._removeRequest(n),i.d.debug("request id "+n.id+" should now be removed")),200===r){const e=this._requests[0]===n;(this._requests[1]===n||e&&this._requests.length>0&&this._requests[0].age()>Math.floor(i.d.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),i.d.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0}else 0===r||r>=400&&r<600||r>=12e3?(i.d.error("request id "+n.id+"."+n.sends+" error "+r+" happened"),this._hitError(r),this._callProtocolErrorHandlers(n),r>=400&&r<500&&(this._conn._changeConnectStatus(i.d.Status.DISCONNECTING,null),this._conn._doDisconnect())):i.d.error("request id "+n.id+"."+n.sends+" error "+r+" happened");s||o?o&&!this._conn.connected&&this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}_processRequest(t){let n=this._requests[t];const r=e._getRequestStatus(n,-1);if(n.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();const s=n.age(),o=!isNaN(s)&&s>Math.floor(i.d.TIMEOUT*this.wait),a=null!==n.dead&&n.timeDead()>Math.floor(i.d.SECONDARY_TIMEOUT*this.wait),c=4===n.xhr.readyState&&(r<1||r>=500);if((o||a||c)&&(a&&i.d.error("Request ".concat(this._requests[t].id," timed out (secondary), restarting")),n.abort=!0,n.xhr.abort(),n.xhr.onreadystatechange=function(){},this._requests[t]=new i.d.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[t]),0===n.xhr.readyState){i.d.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 i.d.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(i.d.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(i.d.TIMEOUT*this.wait),Math.pow(n.sends,3));setTimeout((function(){e()}),t)}else e();n.sends++,this._conn.xmlOutput!==i.d.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!==i.d.Connection.prototype.rawOutput&&this._conn.rawOutput(n.data)}else i.d.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+n.xhr.readyState)}_removeRequest(e){i.d.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){i.d.debug("_sendTerminate was called");const t=this._buildBody().attrs({type:"terminate"});e&&t.cnode(e.tree());const n=new i.d.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?i.d.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):i.d.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))}},i.d.Bosh.prototype.strip=null},function(e,t,n){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(e,t,n){"use strict";n(158);var r=n(2);const i={};i.debug=r.d.LogLevel.DEBUG,i.info=r.d.LogLevel.INFO,i.warn=r.d.LogLevel.WARN,i.error=r.d.LogLevel.ERROR,i.fatal=r.d.LogLevel.FATAL,r.d.WorkerWebsocket=class extends r.d.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),r.d.log(r.d.LogLevel.ERROR,"Shared Worker Error: ".concat(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===r.d.Status.ATTACHED?(this._conn.jid=t,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(r.d.Status.ATTACHED)):e===r.d.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(r.d.Status.ATTACHFAIL))}_disconnect(e,t){t&&this._conn.send(t);const n=Object(r.a)("close",{xmlns:r.d.NS.FRAMING});this._conn.xmlOutput(n.tree());const i=r.d.serialize(n);this._conn.rawOutput(i),this.worker.port.postMessage(["send",i]),this._conn._doDisconnect()}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(r.d.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected?(r.d.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(r.d.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):r.d.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){r.d.log(r.d.LogLevel.ERROR,e)}else if("log"===n){const e=t[1],n=t[2];r.d.log(i[e],n)}else r.d.log(r.d.LogLevel.ERROR,"Found unhandled service worker message: ".concat(t))}}},function(e,t,n){var r=n(487);"string"==typeof r&&(r=[[e.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(489)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=n(488)(!0)).push([e.i,"","",{version:3,sources:[],names:[],mappings:"",file:"converse.scss"}]),e.exports=t},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=(o=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(o)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(c," */")),s=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return[n].concat(s).concat([i]).join("\n")}var o,a,c;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var s=0;s<this.length;s++){var o=this[s][0];null!=o&&(i[o]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);r&&i[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},function(e,t,n){var r,i,s={},o=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=r.apply(this,arguments)),i}),a=function(e,t){return t?t.querySelector(e):document.querySelector(e)},c=function(e){var t={};return function(e,n){if("function"==typeof e)return e();if(void 0===t[e]){var r=a.call(this,e,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}}(),l=null,u=0,d=[],h=n(490);function f(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=s[r.id];if(i){i.refs++;for(var o=0;o<i.parts.length;o++)i.parts[o](r.parts[o]);for(;o<r.parts.length;o++)i.parts.push(b(r.parts[o],t))}else{var a=[];for(o=0;o<r.parts.length;o++)a.push(b(r.parts[o],t));s[r.id]={id:r.id,refs:1,parts:a}}}}function p(e,t){for(var n=[],r={},i=0;i<e.length;i++){var s=e[i],o=t.base?s[0]+t.base:s[0],a={css:s[1],media:s[2],sourceMap:s[3]};r[o]?r[o].parts.push(a):n.push(r[o]={id:o,parts:[a]})}return n}function m(e,t){var n=c(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=d[d.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),d.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=c(e.insertAt.before,n);n.insertBefore(t,i)}}function g(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=d.indexOf(e);t>=0&&d.splice(t,1)}function v(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var r=function(){0;return n.nc}();r&&(e.attrs.nonce=r)}return _(t,e.attrs),m(e,t),t}function _(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,r,i,s;if(t.transform&&e.css){if(!(s="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=s}if(t.singleton){var o=u++;n=l||(l=v(t)),r=S.bind(null,n,o,!1),i=S.bind(null,n,o,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",_(t,e.attrs),m(e,t),t}(t),r=E.bind(null,n,t),i=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),r=x.bind(null,n),i=function(){g(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=o()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return f(n,t),function(e){for(var r=[],i=0;i<n.length;i++){var o=n[i];(a=s[o.id]).refs--,r.push(a)}e&&f(p(e,t),t);for(i=0;i<r.length;i++){var a;if(0===(a=r[i]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete s[a.id]}}}};var y,w=(y=[],function(e,t){return y[e]=t,y.filter(Boolean).join("\n")});function S(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=w(t,i);else{var s=document.createTextNode(i),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(s,o[t]):e.appendChild(s)}}function x(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function E(e,t,n){var r=n.css,i=n.sourceMap,s=void 0===t.convertToAbsoluteUrls&&i;(t.convertToAbsoluteUrls||s)&&(r=h(r)),i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var o=new Blob([r],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,r=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var i,s=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(s)?e:(i=0===s.indexOf("//")?s:0===s.indexOf("/")?n+s:r+s.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(e,t,n){"use strict";n.r(t);var r=Array.isArray,i=n(5),s=i.a.Symbol,o=Object.prototype,a=o.hasOwnProperty,c=o.toString,l=s?s.toStringTag:void 0;var u=function(e){var t=a.call(e,l),n=e[l];try{e[l]=void 0;var r=!0}catch(e){}var i=c.call(e);return r&&(t?e[l]=n:delete e[l]),i},d=Object.prototype.toString;var h=function(e){return d.call(e)},f=s?s.toStringTag:void 0;var p=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":f&&f in Object(e)?u(e):h(e)};var m=function(e){return null!=e&&"object"==typeof e};var g=function(e){return"symbol"==typeof e||m(e)&&"[object Symbol]"==p(e)},v=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_=/^\w*$/;var b=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!g(e))||(_.test(e)||!v.test(e)||null!=t&&e in Object(t))};var y=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var w,S=function(e){if(!y(e))return!1;var t=p(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},x=i.a["__core-js_shared__"],E=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var A=function(e){return!!E&&E in e},C=Function.prototype.toString;var T=function(e){if(null!=e){try{return C.call(e)}catch(e){}try{return e+""}catch(e){}}return""},O=/^\[object .+?Constructor\]$/,j=Function.prototype,k=Object.prototype,N=j.toString,M=k.hasOwnProperty,I=RegExp("^"+N.call(M).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var R=function(e){return!(!y(e)||A(e))&&(S(e)?I:O).test(T(e))};var D=function(e,t){return null==e?void 0:e[t]};var L=function(e,t){var n=D(e,t);return R(n)?n:void 0},z=L(Object,"create");var P=function(){this.__data__=z?z(null):{},this.size=0};var F=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},B=Object.prototype.hasOwnProperty;var H=function(e){var t=this.__data__;if(z){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return B.call(t,e)?t[e]:void 0},q=Object.prototype.hasOwnProperty;var U=function(e){var t=this.__data__;return z?void 0!==t[e]:q.call(t,e)};var V=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=z&&void 0===t?"__lodash_hash_undefined__":t,this};function $(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}$.prototype.clear=P,$.prototype.delete=F,$.prototype.get=H,$.prototype.has=U,$.prototype.set=V;var G=$;var W=function(){this.__data__=[],this.size=0};var J=function(e,t){return e===t||e!=e&&t!=t};var X=function(e,t){for(var n=e.length;n--;)if(J(e[n][0],t))return n;return-1},Q=Array.prototype.splice;var Y=function(e){var t=this.__data__,n=X(t,e);return!(n<0)&&(n==t.length-1?t.pop():Q.call(t,n,1),--this.size,!0)};var K=function(e){var t=this.__data__,n=X(t,e);return n<0?void 0:t[n][1]};var Z=function(e){return X(this.__data__,e)>-1};var ee=function(e,t){var n=this.__data__,r=X(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function te(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}te.prototype.clear=W,te.prototype.delete=Y,te.prototype.get=K,te.prototype.has=Z,te.prototype.set=ee;var ne=te,re=L(i.a,"Map");var ie=function(){this.size=0,this.__data__={hash:new G,map:new(re||ne),string:new G}};var se=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var oe=function(e,t){var n=e.__data__;return se(t)?n["string"==typeof t?"string":"hash"]:n.map};var ae=function(e){var t=oe(this,e).delete(e);return this.size-=t?1:0,t};var ce=function(e){return oe(this,e).get(e)};var le=function(e){return oe(this,e).has(e)};var ue=function(e,t){var n=oe(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function de(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}de.prototype.clear=ie,de.prototype.delete=ae,de.prototype.get=ce,de.prototype.has=le,de.prototype.set=ue;var he=de;function fe(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=e.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(fe.Cache||he),n}fe.Cache=he;var pe=fe;var me=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ge=/\\(\\)?/g,ve=function(e){var t=pe(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(me,(function(e,n,r,i){t.push(r?i.replace(ge,"$1"):n||e)})),t}));var _e=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},be=s?s.prototype:void 0,ye=be?be.toString:void 0;var we=function e(t){if("string"==typeof t)return t;if(r(t))return _e(t,e)+"";if(g(t))return ye?ye.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var Se=function(e){return null==e?"":we(e)};var xe=function(e,t){return r(e)?e:b(e,t)?[e]:ve(Se(e))};var Ee=function(e){if("string"==typeof e||g(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Ae=function(e,t){for(var n=0,r=(t=xe(t,e)).length;null!=e&&n<r;)e=e[Ee(t[n++])];return n&&n==r?e:void 0},Ce=function(){try{var e=L(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Te=function(e,t,n){"__proto__"==t&&Ce?Ce(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Oe=Object.prototype.hasOwnProperty;var je=function(e,t,n){var r=e[t];Oe.call(e,t)&&J(r,n)&&(void 0!==n||t in e)||Te(e,t,n)},ke=/^(?:0|[1-9]\d*)$/;var Ne=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};var Me=function(e,t,n,r){if(!y(e))return e;for(var i=-1,s=(t=xe(t,e)).length,o=s-1,a=e;null!=a&&++i<s;){var c=Ee(t[i]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=o){var u=a[c];void 0===(l=r?r(u,c,a):void 0)&&(l=y(u)?u:Ne(t[i+1])?[]:{})}je(a,c,l),a=a[c]}return e};var Ie=function(e,t,n){for(var r=-1,i=t.length,s={};++r<i;){var o=t[r],a=Ae(e,o);n(a,o)&&Me(s,xe(o,e),a)}return s};var Re=function(e,t){return null!=e&&t in Object(e)};var De=function(e){return m(e)&&"[object Arguments]"==p(e)},Le=Object.prototype,ze=Le.hasOwnProperty,Pe=Le.propertyIsEnumerable,Fe=De(function(){return arguments}())?De:function(e){return m(e)&&ze.call(e,"callee")&&!Pe.call(e,"callee")};var Be=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var He=function(e,t,n){for(var i=-1,s=(t=xe(t,e)).length,o=!1;++i<s;){var a=Ee(t[i]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++i!=s?o:!!(s=null==e?0:e.length)&&Be(s)&&Ne(a,s)&&(r(e)||Fe(e))};var qe=function(e,t){return null!=e&&He(e,t,Re)};var Ue=function(e,t){return Ie(e,t,(function(t,n){return qe(e,n)}))};var Ve=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},$e=s?s.isConcatSpreadable:void 0;var Ge=function(e){return r(e)||Fe(e)||!!($e&&e&&e[$e])};var We=function e(t,n,r,i,s){var o=-1,a=t.length;for(r||(r=Ge),s||(s=[]);++o<a;){var c=t[o];n>0&&r(c)?n>1?e(c,n-1,r,i,s):Ve(s,c):i||(s[s.length]=c)}return s};var Je=function(e){return(null==e?0:e.length)?We(e,1):[]};var Xe=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)},Qe=Math.max;var Ye=function(e,t,n){return t=Qe(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=Qe(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(o),Xe(e,this,a)}};var Ke=function(e){return function(){return e}};var Ze=function(e){return e},et=Ce?function(e,t){return Ce(e,"toString",{configurable:!0,enumerable:!1,value:Ke(t),writable:!0})}:Ze,tt=Date.now;var nt=function(e){var t=0,n=0;return function(){var r=tt(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(et);var rt=function(e){return nt(Ye(e,void 0,Je),e+"")},it=rt((function(e,t){return null==e?{}:Ue(e,t)}));var st=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var ot=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s};var at=function(e,t){return t.length<2?e:Ae(e,ot(t,0,-1))};var ct=function(e,t,n){t=xe(t,e);var r=null==(e=at(e,t))?e:e[Ee(st(t))];return null==r?void 0:Xe(r,e,n)};var lt=function(e,t){return nt(Ye(e,t,Ze),e+"")},ut=lt(ct),dt=function(){return i.a.Date.now()},ht=/^\s+|\s+$/g,ft=/^[-+]0x[0-9a-f]+$/i,pt=/^0b[01]+$/i,mt=/^0o[0-7]+$/i,gt=parseInt;var vt=function(e){if("number"==typeof e)return e;if(g(e))return NaN;if(y(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=y(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(ht,"");var n=pt.test(e);return n||mt.test(e)?gt(e.slice(2),n?2:8):ft.test(e)?NaN:+e},_t=Math.max,bt=Math.min;var yt=function(e,t,n){var r,i,s,o,a,c,l=0,u=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=r,s=i;return r=i=void 0,l=t,o=e.apply(s,n)}function p(e){return l=e,a=setTimeout(g,t),u?f(e):o}function m(e){var n=e-c;return void 0===c||n>=t||n<0||d&&e-l>=s}function g(){var e=dt();if(m(e))return v(e);a=setTimeout(g,function(e){var n=t-(e-c);return d?bt(n,s-(e-l)):n}(e))}function v(e){return a=void 0,h&&r?f(e):(r=i=void 0,o)}function _(){var e=dt(),n=m(e);if(r=arguments,i=this,c=e,n){if(void 0===a)return p(c);if(d)return clearTimeout(a),a=setTimeout(g,t),f(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=vt(t)||0,y(n)&&(u=!!n.leading,s=(d="maxWait"in n)?_t(vt(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==a&&clearTimeout(a),l=0,r=c=i=a=void 0},_.flush=function(){return void 0===a?o:v(dt())},_};var wt=function(e,t,n,r){var i=!n;n||(n={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=r?r(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),i?Te(n,a,c):je(n,a,c)}return n};var St=function(e){return null!=e&&Be(e.length)&&!S(e)};var xt=function(e,t,n){if(!y(n))return!1;var r=typeof t;return!!("number"==r?St(n)&&Ne(t,n.length):"string"==r&&t in n)&&J(n[t],e)};var Et=function(e){return lt((function(t,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(i--,s):void 0,o&&xt(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),t=Object(t);++r<i;){var a=n[r];a&&e(t,a,r,s)}return t}))};var At=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},Ct=n(20),Tt={};Tt["[object Float32Array]"]=Tt["[object Float64Array]"]=Tt["[object Int8Array]"]=Tt["[object Int16Array]"]=Tt["[object Int32Array]"]=Tt["[object Uint8Array]"]=Tt["[object Uint8ClampedArray]"]=Tt["[object Uint16Array]"]=Tt["[object Uint32Array]"]=!0,Tt["[object Arguments]"]=Tt["[object Array]"]=Tt["[object ArrayBuffer]"]=Tt["[object Boolean]"]=Tt["[object DataView]"]=Tt["[object Date]"]=Tt["[object Error]"]=Tt["[object Function]"]=Tt["[object Map]"]=Tt["[object Number]"]=Tt["[object Object]"]=Tt["[object RegExp]"]=Tt["[object Set]"]=Tt["[object String]"]=Tt["[object WeakMap]"]=!1;var Ot=function(e){return m(e)&&Be(e.length)&&!!Tt[p(e)]};var jt=function(e){return function(t){return e(t)}},kt=n(12),Nt=kt.a&&kt.a.isTypedArray,Mt=Nt?jt(Nt):Ot,It=Object.prototype.hasOwnProperty;var Rt=function(e,t){var n=r(e),i=!n&&Fe(e),s=!n&&!i&&Object(Ct.a)(e),o=!n&&!i&&!s&&Mt(e),a=n||i||s||o,c=a?At(e.length,String):[],l=c.length;for(var u in e)!t&&!It.call(e,u)||a&&("length"==u||s&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Ne(u,l))||c.push(u);return c},Dt=Object.prototype;var Lt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Dt)};var zt=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},Pt=Object.prototype.hasOwnProperty;var Ft=function(e){if(!y(e))return zt(e);var t=Lt(e),n=[];for(var r in e)("constructor"!=r||!t&&Pt.call(e,r))&&n.push(r);return n};var Bt=function(e){return St(e)?Rt(e,!0):Ft(e)},Ht=Et((function(e,t){wt(t,Bt(t),e)})),qt=(n(311),n(25));var Ut=function(){this.__data__=new ne,this.size=0};var Vt=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var $t=function(e){return this.__data__.get(e)};var Gt=function(e){return this.__data__.has(e)};var Wt=function(e,t){var n=this.__data__;if(n instanceof ne){var r=n.__data__;if(!re||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new he(r)}return n.set(e,t),this.size=n.size,this};function Jt(e){var t=this.__data__=new ne(e);this.size=t.size}Jt.prototype.clear=Ut,Jt.prototype.delete=Vt,Jt.prototype.get=$t,Jt.prototype.has=Gt,Jt.prototype.set=Wt;var Xt=Jt;var Qt=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e};var Yt=function(e,t){return function(n){return e(t(n))}},Kt=Yt(Object.keys,Object),Zt=Object.prototype.hasOwnProperty;var en=function(e){if(!Lt(e))return Kt(e);var t=[];for(var n in Object(e))Zt.call(e,n)&&"constructor"!=n&&t.push(n);return t};var tn=function(e){return St(e)?Rt(e):en(e)};var nn=function(e,t){return e&&wt(t,tn(t),e)};var rn=function(e,t){return e&&wt(t,Bt(t),e)},sn=n(160);var on=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var an=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s};var cn=function(){return[]},ln=Object.prototype.propertyIsEnumerable,un=Object.getOwnPropertySymbols,dn=un?function(e){return null==e?[]:(e=Object(e),an(un(e),(function(t){return ln.call(e,t)})))}:cn;var hn=function(e,t){return wt(e,dn(e),t)},fn=Yt(Object.getPrototypeOf,Object),pn=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ve(t,dn(e)),e=fn(e);return t}:cn;var mn=function(e,t){return wt(e,pn(e),t)};var gn=function(e,t,n){var i=t(e);return r(e)?i:Ve(i,n(e))};var vn=function(e){return gn(e,tn,dn)};var _n=function(e){return gn(e,Bt,pn)},bn=L(i.a,"DataView"),yn=L(i.a,"Promise"),wn=L(i.a,"Set"),Sn=L(i.a,"WeakMap"),xn=T(bn),En=T(re),An=T(yn),Cn=T(wn),Tn=T(Sn),On=p;(bn&&"[object DataView]"!=On(new bn(new ArrayBuffer(1)))||re&&"[object Map]"!=On(new re)||yn&&"[object Promise]"!=On(yn.resolve())||wn&&"[object Set]"!=On(new wn)||Sn&&"[object WeakMap]"!=On(new Sn))&&(On=function(e){var t=p(e),n="[object Object]"==t?e.constructor:void 0,r=n?T(n):"";if(r)switch(r){case xn:return"[object DataView]";case En:return"[object Map]";case An:return"[object Promise]";case Cn:return"[object Set]";case Tn:return"[object WeakMap]"}return t});var jn=On,kn=Object.prototype.hasOwnProperty;var Nn=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&kn.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Mn=i.a.Uint8Array;var In=function(e){var t=new e.constructor(e.byteLength);return new Mn(t).set(new Mn(e)),t};var Rn=function(e,t){var n=t?In(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Dn=/\w*$/;var Ln=function(e){var t=new e.constructor(e.source,Dn.exec(e));return t.lastIndex=e.lastIndex,t},zn=s?s.prototype:void 0,Pn=zn?zn.valueOf:void 0;var Fn=function(e){return Pn?Object(Pn.call(e)):{}};var Bn=function(e,t){var n=t?In(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var Hn=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return In(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return Rn(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 Bn(e,n);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return Ln(e);case"[object Set]":return new r;case"[object Symbol]":return Fn(e)}},qn=Object.create,Un=function(){function e(){}return function(t){if(!y(t))return{};if(qn)return qn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Vn=function(e){return"function"!=typeof e.constructor||Lt(e)?{}:Un(fn(e))};var $n=function(e){return m(e)&&"[object Map]"==jn(e)},Gn=kt.a&&kt.a.isMap,Wn=Gn?jt(Gn):$n;var Jn=function(e){return m(e)&&"[object Set]"==jn(e)},Xn=kt.a&&kt.a.isSet,Qn=Xn?jt(Xn):Jn,Yn={};Yn["[object Arguments]"]=Yn["[object Array]"]=Yn["[object ArrayBuffer]"]=Yn["[object DataView]"]=Yn["[object Boolean]"]=Yn["[object Date]"]=Yn["[object Float32Array]"]=Yn["[object Float64Array]"]=Yn["[object Int8Array]"]=Yn["[object Int16Array]"]=Yn["[object Int32Array]"]=Yn["[object Map]"]=Yn["[object Number]"]=Yn["[object Object]"]=Yn["[object RegExp]"]=Yn["[object Set]"]=Yn["[object String]"]=Yn["[object Symbol]"]=Yn["[object Uint8Array]"]=Yn["[object Uint8ClampedArray]"]=Yn["[object Uint16Array]"]=Yn["[object Uint32Array]"]=!0,Yn["[object Error]"]=Yn["[object Function]"]=Yn["[object WeakMap]"]=!1;var Kn=function e(t,n,i,s,o,a){var c,l=1&n,u=2&n,d=4&n;if(i&&(c=o?i(t,s,o,a):i(t)),void 0!==c)return c;if(!y(t))return t;var h=r(t);if(h){if(c=Nn(t),!l)return on(t,c)}else{var f=jn(t),p="[object Function]"==f||"[object GeneratorFunction]"==f;if(Object(Ct.a)(t))return Object(sn.a)(t,l);if("[object Object]"==f||"[object Arguments]"==f||p&&!o){if(c=u||p?{}:Vn(t),!l)return u?mn(t,rn(c,t)):hn(t,nn(c,t))}else{if(!Yn[f])return o?t:{};c=Hn(t,f,l)}}a||(a=new Xt);var m=a.get(t);if(m)return m;a.set(t,c),Qn(t)?t.forEach((function(r){c.add(e(r,n,i,r,t,a))})):Wn(t)&&t.forEach((function(r,s){c.set(s,e(r,n,i,s,t,a))}));var g=h?void 0:(d?u?_n:vn:u?Bt:tn)(t);return Qt(g||t,(function(r,s){g&&(r=t[s=r]),je(c,s,e(r,n,i,s,t,a))})),c};var Zn=function(e){return Kn(e,5)};var er=function(e){return"string"==typeof e||!r(e)&&m(e)&&"[object String]"==p(e)};var tr=function(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))};function nr(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function rr(e){return"string"!=typeof e&&(console.warn("".concat(e," used as a key, but it is not a string.")),e=String(e)),e}var ir=function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}},sr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",or=/^~~local_forage_type~([^~]+)~/,ar="__lfsc__:".length,cr=ar+"arbf".length,lr=Object.prototype.toString;function ur(e){var t,n,r,i,s,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var l=new ArrayBuffer(o),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=sr.indexOf(e[t]),r=sr.indexOf(e[t+1]),i=sr.indexOf(e[t+2]),s=sr.indexOf(e[t+3]),u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|i>>2,u[c++]=(3&i)<<6|63&s;return l}function dr(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=sr[n[t]>>2],r+=sr[(3&n[t])<<4|n[t+1]>>4],r+=sr[(15&n[t+1])<<2|n[t+2]>>6],r+=sr[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var hr={serialize:function(e,t){var n="";if(e&&(n=lr.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===lr.call(e.buffer))){var r,i="__lfsc__:";e instanceof ArrayBuffer?(r=e,i+="arbf"):(r=e.buffer,"[object Int8Array]"===n?i+="si08":"[object Uint8Array]"===n?i+="ui08":"[object Uint8ClampedArray]"===n?i+="uic8":"[object Int16Array]"===n?i+="si16":"[object Uint16Array]"===n?i+="ur16":"[object Int32Array]"===n?i+="si32":"[object Uint32Array]"===n?i+="ui32":"[object Float32Array]"===n?i+="fl32":"[object Float64Array]"===n?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+dr(r))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n="~~local_forage_type~"+e.type+"~"+dr(this.result);t("__lfsc__:blob"+n)},s.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("__lfsc__:"!==e.substring(0,ar))return JSON.parse(e);var t,n=e.substring(cr),r=e.substring(ar,cr);if("blob"===r&&or.test(n)){var i=n.match(or);t=i[1],n=n.substring(i[0].length)}var s=ur(n);switch(r){case"arbf":return s;case"blob":return ir([s],{type:t});case"si08":return new Int8Array(s);case"ui08":return new Uint8Array(s);case"uic8":return new Uint8ClampedArray(s);case"si16":return new Int16Array(s);case"ur16":return new Uint16Array(s);case"si32":return new Int32Array(s);case"ui32":return new Uint32Array(s);case"fl32":return new Float32Array(s);case"fl64":return new Float64Array(s);default:throw new Error("Unkown type: "+r)}},stringToBuffer:ur,bufferToString:dr};function fr(e,t){let n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}const pr={serializer:{serialize:hr.serialize,deserialize:hr.deserialize}};var mr={_driver:"sessionStorageWrapper",_initStorage:function(e){if(pr.keyPrefix=fr(e,this._defaultConfig),e)for(const t in e)pr[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=pr.keyPrefix,n=t.length,r=sessionStorage.length;let i=1;for(let s=0;s<r;s++){const r=sessionStorage.key(s);if(0!==r.indexOf(t))continue;let o=sessionStorage.getItem(r);if(o&&(o=pr.serializer.deserialize(o)),o=e(o,r.substring(n),i++),void 0!==o)return o}}));return tr(n,t),n},getItem:function(e,t){e=rr(e);const n=this.ready().then((function(){let t=sessionStorage.getItem(pr.keyPrefix+e);return t&&(t=pr.serializer.deserialize(t)),t}));return tr(n,t),n},setItem:function(e,t,n){e=rr(e);const r=this.ready().then((function(){void 0===t&&(t=null);const n=t;return new Promise((function(r,i){pr.serializer.serialize(t,(function(t,s){if(s)i(s);else try{sessionStorage.setItem(pr.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}}))}))}));return tr(r,n),r},removeItem:function(e,t){e=rr(e);const n=this.ready().then((function(){sessionStorage.removeItem(pr.keyPrefix+e)}));return tr(n,t),n},clear:function(e){const t=this.ready().then((function(){const e=pr.keyPrefix;for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}}));return tr(t,e),t},length:function(e){const t=this.keys().then((function(e){return e.length}));return tr(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(pr.keyPrefix.length)),t}));return tr(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(pr.keyPrefix)&&t.push(e.substring(pr.keyPrefix.length))}return t}));return tr(t,e),t},dropInstance:function(e,t){if(t=nr.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 r;return r=e.name?new Promise((function(t){e.storeName?t(fr(e,n._defaultConfig)):t("".concat(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")),tr(r,t),r}};function gr(){return(65536*(1+Math.random())|0).toString(16).substring(1)}class vr{constructor(e,t){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.");er(t)?this.storeInitialized=this.initStore(t):(this.store=t,this.storeInitialized=Promise.resolve()),this.name=e}async initStore(e){if("session"===e)qt.setDriver(mr._driver);else if("local"===e)await qt.config({driver:qt.LOCALSTORAGE});else if("indexed"!==e)throw new Error("Skeletor.storage: No storage type was specified");this.store=qt}async clear(){await this.store.removeItem(this.name).catch(e=>console.error(e));const e=new RegExp("^".concat(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(e){const t=this;async function n(e,n,r){let i,s,o,a;const c=n.collection;["patch","update"].includes(e)&&(a=Zn(n.attributes)),await t.storeInitialized;try{const s=n.attributes;switch(e){case"read":i=void 0!==n.id?await t.find(n):await t.findAll();break;case"create":i=await t.create(n,r);break;case"patch":case"update":r.wait&&(n.attributes=a),o=t.update(n,r),r.wait&&(n.attributes=s),i=await o;break;case"delete":i=await t.destroy(n,c)}}catch(e){s=22===e.code&&0===t.getStorageSize()?"Private browsing is unsupported":e.message}if(i){if(r&&r.success){const t="read"===e?i:null;r.success(t,r)}}else s=s||"Record Not Found",r&&r.error&&r.error(s)}return n.__name__="localSync",n}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)),r=this.getItemName(e.id);return n.includes(r)||n.push(r),this.store.setItem(this.name,n)}async save(e,t={}){const n=this.getItemName(e.id),r=await this.store.setItem(n,e.toJSON());return await this.addCollectionReference(e,e.collection),r}create(e,t){return e.id||(e.id=gr()+gr()+"-"+gr()+"-"+gr()+"-"+gr()+"-"+gr()+gr()+gr(),e.set(e.idAttribute,e.id,t)),this.save(e)}update(e,t){return this.save(e,t)}find(e){return this.store.getItem(this.getItemName(e.id))}async findAll(){const e=await this.store.getItem(this.name);return e&&e.length?Promise.all(e.map(e=>this.store.getItem(e))):[]}async destroy(e,t){return 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}}vr.sessionStorageInitialized=qt.defineDriver(mr),vr.localForage=qt;var _r=vr,br=n(161),yr=n.n(br),wr=n(4),Sr=n.n(wr),xr=Function.prototype,Er=Object.prototype,Ar=xr.toString,Cr=Er.hasOwnProperty,Tr=Ar.call(Object);var Or=function(e){if(!m(e)||"[object Object]"!=p(e))return!1;var t=fn(e);if(null===t)return!0;var n=Cr.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ar.call(n)==Tr};var jr,kr,Nr,Mr,Ir=function(e){return m(e)&&1===e.nodeType&&!Or(e)};const Rr={debug:0,info:1,warn:2,error:3,fatal:4},Dr=Object.assign({debug:(null===(jr=console)||void 0===jr?void 0:jr.log)?console.log.bind(console):function(){},error:(null===(kr=console)||void 0===kr?void 0:kr.log)?console.log.bind(console):function(){},info:(null===(Nr=console)||void 0===Nr?void 0:Nr.log)?console.log.bind(console):function(){},warn:(null===(Mr=console)||void 0===Mr?void 0:Mr.log)?console.log.bind(console):function(){}},console);var Lr={setLogLevel(e){if(!["debug","info","warn","error","fatal"].includes(e))throw new Error("Invalid loglevel: ".concat(e));this.loglevel=e},log(e,t,n=""){if(Rr[t]<Rr[this.loglevel])return;"error"===t||"fatal"===t?n=n||"color: maroon":"debug"===t&&(n=n||"color: green"),e instanceof Error?e=e.stack:Ir(e)&&(e=e.outerHTML);const r=n?"%c":"";"error"===t?Dr.error("".concat(r," ERROR: ").concat(e),n):"warn"===t?Dr.warn("".concat(r," ").concat((new Date).toISOString()," WARNING: ").concat(e),n):"fatal"===t?Dr.error("".concat(r," FATAL: ").concat(e),n):"debug"===t?Dr.debug("".concat(r," ").concat((new Date).toISOString()," DEBUG: ").concat(e),n):Dr.info("".concat(r," ").concat((new Date).toISOString()," INFO: ").concat(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)}},zr=n(162),Pr=n.n(zr),Fr=n(42),Br=n.n(Fr),Hr=n(43),qr=n.n(Hr),Ur=n(33),Vr=n.n(Ur),$r=n(163),Gr=n.n($r),Wr=n(58),Jr=n.n(Wr),Xr=n(164),Qr=n.n(Xr),Yr=n(30),Kr=n.n(Yr),Zr=n(90),ei=n.n(Zr),ti=n(165),ni=n.n(ti),ri=n(166),ii=n.n(ri),si=n(89),oi=n.n(si);function ai(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=[]}qr()(ai.prototype,{wrappedOverride:function(e,t,n,r){return"function"==typeof n&&(void 0===this.__super__&&(this.__super__=r),this.__super__[e]=n.bind(this)),t.apply(this,Pr()(arguments,4))},_overrideAttribute:function(e,t){let n=t.overrides[e];if("function"==typeof n){let t={};t[this.name]=this.plugged;let r=ei()(this.wrappedOverride,e,n,this.plugged[e],t);this.plugged[e]=r}else this.plugged[e]=n},_extendObject:function(e,t){e.prototype.__super__||(e.prototype.__super__={},e.prototype.__super__[this.name]=this.plugged);let n=this;Br()(t,(function(t,r){if("events"===r)e.prototype[r]=qr()(t,e.prototype[r]);else if("function"==typeof t){let i={};i[n.name]=n.plugged;let s=ei()(n.wrappedOverride,r,t,e.prototype[r],i);e.prototype[r]=s}else e.prototype[r]=t}))},loadPluginDependencies:function(e){Br()(e.dependencies,t=>{let n=this.plugins[t];if(n){if(Vr()(n.dependencies,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:function(e){if(this.plugged.strict_plugin_dependencies)throw e;console.warn?console.warn(e):console.log(e)},applyOverrides:function(e){Br()(Object.keys(e.overrides||{}),t=>{let n=e.overrides[t];"object"==typeof n?void 0===this.plugged[t]?this.throwUndefinedDependencyError('Plugin "'.concat(e.__name__,'" tried to override "').concat(t,"\" but it's not found.")):this._extendObject(this.plugged[t],n):this._overrideAttribute(t,e)})},initializePlugin:function(e){Vr()(Kr()(this.allowed_plugins),e.__name__)&&(Vr()(this.initialized_plugins,e.__name__)||(Gr()(e.enabled)&&e.enabled||Jr()(e.enabled)&&e.enabled(this.plugged)||Qr()(e.enabled))&&(qr()(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:function(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:function(e={},t=[],n=[]){ii()(this.plugins)&&(this.properties=e,this.allowed_plugins=ni()(this.plugins,(function(e,r){return(!t.length||t.length&&Vr()(t,r))&&!Vr()(n,r)})),Br()(oi()(this.allowed_plugins),this.initializePlugin.bind(this)))}});var ci={enable:function(e,t,n){void 0===n&&(n="pluginSocket"),void 0===t&&(t="plugged");let r={};return r[n]=new ai(e,t),qr()(e,r)}},li=n(167),ui=n.n(li),di=n(168),hi=n.n(di),fi=n(3),pi=n.n(fi);var mi=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var s=e[t];s&&(i[r++]=s)}return i},gi=n(0);var vi=function(e,t){var n=Un(e);return null==t?n:nn(n,t)},_i=Object.prototype.hasOwnProperty;var bi=function(e,t){return null!=e&&_i.call(e,t)};var yi=function(e,t){return null!=e&&He(e,t,bi)};var wi=function(e,t,n){var r=-1,i=(t=xe(t,e)).length;for(i||(i=1,e=void 0);++r<i;){var s=null==e?void 0:e[Ee(t[r])];void 0===s&&(r=i,s=n),e=S(s)?s.call(e):s}return e};Error;function Si(e,t){const n=this;let r;return r=e&&yi(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},Ht(r,n,t),r.prototype=vi(n.prototype,e),r.prototype.constructor=r,r.__super__=n.prototype,r}function xi(){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 Ei(){throw new Error('A "url" property or function must be specified')}function Ai(e,t){const n=t.error;t.error=function(r){n&&n.call(t.context,e,r,t),e.trigger("error",e,r,t)}}const Ci={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};function Ti(e){const t=wi(e,"browserStorage")||wi(e.collection,"browserStorage");return t?t.sync():Oi}function Oi(e,t,n={}){const r={type:Ci[e],dataType:"json"};n.url||(r.url=wi(t,"url")||Ei()),null!=n.data||!t||"create"!==e&&"update"!==e&&"patch"!==e||(r.contentType="application/json",r.data=JSON.stringify(n.attrs||t.toJSON(n))),"GET"!==r.type&&(r.processData=!1);const i=n.error;n.error=function(e,t,r){n.textStatus=t,n.errorThrown=r,i&&i.call(n.context,e,t,r)};const s=n.xhr=function(){return fetch.apply(this,arguments)}(Ht(r,n));return t.trigger("request",t,s,n),s}var ji=Object.prototype.hasOwnProperty;var ki=function(e){if(null==e)return!0;if(St(e)&&(r(e)||"string"==typeof e||"function"==typeof e.splice||Object(Ct.a)(e)||Mt(e)||Fe(e)))return!e.length;var t=jn(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Lt(e))return!en(e).length;for(var n in e)if(ji.call(e,n))return!1;return!0};var Ni=function(e){return e?(e=vt(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var Mi=function(e){var t=Ni(e),n=t%1;return t==t?n?t-n:t:0};var Ii=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=Mi(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}};var Ri=function(e){return Ii(2,e)},Di=0;var Li=function(e){var t=++Di;return Se(e)+t};const zi={},Pi=/\s+/;let Fi;const Bi=function(e,t,n,r,i){let s,o=0;if(n&&"object"==typeof n){void 0!==r&&"context"in i&&void 0===i.context&&(i.context=r);for(s=tn(n);o<s.length;o++)t=Bi(e,t,s[o],n[s[o]],i)}else if(n&&Pi.test(n))for(s=n.split(Pi);o<s.length;o++)t=e(t,s[o],r,i);else t=e(t,n,r,i);return t};zi.on=function(e,t,n){if(this._events=Bi(Hi,this._events||{},e,t,{context:n,ctx:this,listening:Fi}),Fi){(this._listeners||(this._listeners={}))[Fi.id]=Fi,Fi.interop=!1}return this},zi.listenTo=function(e,t,n){if(!e)return this;const r=e._listenId||(e._listenId=Li("l")),i=this._listeningTo||(this._listeningTo={});let s=Fi=i[r];s||(this._listenId||(this._listenId=Li("l")),s=Fi=i[r]=new Wi(this,e));const o=qi(e,t,n,this);if(Fi=void 0,o)throw o;return s.interop&&s.on(t,n),this};const Hi=function(e,t,n,r){if(n){const i=e[t]||(e[t]=[]),s=r.context,o=r.ctx,a=r.listening;a&&a.count++,i.push({callback:n,context:s,ctx:s||o,listening:a})}return e},qi=function(e,t,n,r){try{e.on(t,n,r)}catch(e){return e}};zi.off=function(e,t,n){return this._events?(this._events=Bi(Ui,this._events,e,t,{context:n,listeners:this._listeners}),this):this},zi.stopListening=function(e,t,n){const r=this._listeningTo;if(!r)return this;const i=e?[e._listenId]:tn(r);for(let e=0;e<i.length;e++){const s=r[i[e]];if(!s)break;s.obj.off(t,n,this),s.interop&&s.off(t,n)}return ki(r)&&(this._listeningTo=void 0),this};const Ui=function(e,t,n,r){if(!e)return;const i=r.context,s=r.listeners;let o,a=0;if(t||i||n){for(o=t?[t]:tn(e);a<o.length;a++){const r=e[t=o[a]];if(!r)break;const s=[];for(let e=0;e<r.length;e++){const o=r[e];if(n&&n!==o.callback&&n!==o.callback._callback||i&&i!==o.context)s.push(o);else{const e=o.listening;e&&e.off(t,n)}}s.length?e[t]=s:delete e[t]}return e}for(o=tn(s);a<o.length;a++)s[o[a]].cleanup()};zi.once=function(e,t,n){const r=Bi(Vi,{},e,t,this.off.bind(this));return"string"==typeof e&&null==n&&(t=void 0),this.on(r,t,n)},zi.listenToOnce=function(e,t,n){const r=Bi(Vi,{},t,n,this.stopListening.bind(this,e));return this.listenTo(e,r)};const Vi=function(e,t,n,r){if(n){const i=e[t]=Ri((function(){r(t,i),n.apply(this,arguments)}));i._callback=n}return e};zi.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 Bi($i,this._events,e,void 0,n),this};const $i=function(e,t,n,r){if(e){const n=e[t];let i=e.all;n&&i&&(i=i.slice()),n&&Gi(n,r),i&&Gi(i,[t].concat(r))}return e},Gi=function(e,t){let n,r=-1;const i=e.length,s=t[0],o=t[1],a=t[2];switch(t.length){case 0:for(;++r<i;)(n=e[r]).callback.call(n.ctx);return;case 1:for(;++r<i;)(n=e[r]).callback.call(n.ctx,s);return;case 2:for(;++r<i;)(n=e[r]).callback.call(n.ctx,s,o);return;case 3:for(;++r<i;)(n=e[r]).callback.call(n.ctx,s,o,a);return;default:for(;++r<i;)(n=e[r]).callback.apply(n.ctx,t);return}},Wi=function(e,t){this.id=e._listenId,this.listener=e,this.obj=t,this.interop=!0,this.count=0,this._events=void 0};Wi.prototype.on=zi.on,Wi.prototype.off=function(e,t){let n;this.interop?(this._events=Bi(Ui,this._events,e,t,{context:void 0,listeners:void 0}),n=!this._events):(this.count--,n=0===this.count),n&&this.cleanup()},Wi.prototype.cleanup=function(){delete this.listener._listeningTo[this.obj._listenId],this.interop||delete this.obj._listeners[this.id]},zi.bind=zi.on,zi.unbind=zi.off;var Ji=function(e){return Kn(e,4)},Xi=Object.prototype,Qi=Xi.hasOwnProperty,Yi=lt((function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&xt(t[0],t[1],i)&&(r=1);++n<r;)for(var s=t[n],o=Bt(s),a=-1,c=o.length;++a<c;){var l=o[a],u=e[l];(void 0===u||J(u,Xi[l])&&!Qi.call(e,l))&&(e[l]=s[l])}return e}));var Ki=function(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)},Zi=lt((function(e,t){return Ki(e,1,t)}));var es=function(e){return function(t){return null==e?void 0:e[t]}}({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),ts=/[&<>"']/g,ns=RegExp(ts.source);var rs=function(e){return(e=Se(e))&&ns.test(e)?e.replace(ts,es):e};var is=function(e){return function(t,n,r){for(var i=-1,s=Object(t),o=r(t),a=o.length;a--;){var c=o[e?a:++i];if(!1===n(s[c],c,s))break}return t}},ss=is();var os=function(e,t){return e&&ss(e,t,tn)};var as=function(e,t,n,r){return os(e,(function(e,i,s){t(r,n(e),i,s)})),r};var cs=function(e,t){return function(n,r){return as(n,e,t(r),{})}},ls=Object.prototype.toString,us=cs((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=ls.call(t)),e[t]=n}),Ke(Ze));var ds=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var hs=function(e){return this.__data__.has(e)};function fs(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new he;++t<n;)this.add(e[t])}fs.prototype.add=fs.prototype.push=ds,fs.prototype.has=hs;var ps=fs;var ms=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1};var gs=function(e,t){return e.has(t)};var vs=function(e,t,n,r,i,s){var o=1&n,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(e),u=s.get(t);if(l&&u)return l==t&&u==e;var d=-1,h=!0,f=2&n?new ps:void 0;for(s.set(e,t),s.set(t,e);++d<a;){var p=e[d],m=t[d];if(r)var g=o?r(m,p,d,t,e,s):r(p,m,d,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(f){if(!ms(t,(function(e,t){if(!gs(f,t)&&(p===e||i(p,e,n,r,s)))return f.push(t)}))){h=!1;break}}else if(p!==m&&!i(p,m,n,r,s)){h=!1;break}}return s.delete(e),s.delete(t),h};var _s=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n};var bs=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},ys=s?s.prototype:void 0,ws=ys?ys.valueOf:void 0;var Ss=function(e,t,n,r,i,s,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||!s(new Mn(e),new Mn(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return J(+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=_s;case"[object Set]":var c=1&r;if(a||(a=bs),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var u=vs(a(e),a(t),r,i,s,o);return o.delete(e),u;case"[object Symbol]":if(ws)return ws.call(e)==ws.call(t)}return!1},xs=Object.prototype.hasOwnProperty;var Es=function(e,t,n,r,i,s){var o=1&n,a=vn(e),c=a.length;if(c!=vn(t).length&&!o)return!1;for(var l=c;l--;){var u=a[l];if(!(o?u in t:xs.call(t,u)))return!1}var d=s.get(e),h=s.get(t);if(d&&h)return d==t&&h==e;var f=!0;s.set(e,t),s.set(t,e);for(var p=o;++l<c;){var m=e[u=a[l]],g=t[u];if(r)var v=o?r(g,m,u,t,e,s):r(m,g,u,e,t,s);if(!(void 0===v?m===g||i(m,g,n,r,s):v)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var _=e.constructor,b=t.constructor;_==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof b&&b instanceof b||(f=!1)}return s.delete(e),s.delete(t),f},As=Object.prototype.hasOwnProperty;var Cs=function(e,t,n,i,s,o){var a=r(e),c=r(t),l=a?"[object Array]":jn(e),u=c?"[object Array]":jn(t),d="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l),h="[object Object]"==(u="[object Arguments]"==u?"[object Object]":u),f=l==u;if(f&&Object(Ct.a)(e)){if(!Object(Ct.a)(t))return!1;a=!0,d=!1}if(f&&!d)return o||(o=new Xt),a||Mt(e)?vs(e,t,n,i,s,o):Ss(e,t,l,n,i,s,o);if(!(1&n)){var p=d&&As.call(e,"__wrapped__"),m=h&&As.call(t,"__wrapped__");if(p||m){var g=p?e.value():e,v=m?t.value():t;return o||(o=new Xt),s(g,v,n,i,o)}}return!!f&&(o||(o=new Xt),Es(e,t,n,i,s,o))};var Ts=function e(t,n,r,i,s){return t===n||(null==t||null==n||!m(t)&&!m(n)?t!=t&&n!=n:Cs(t,n,r,i,e,s))};var Os=function(e,t){return Ts(e,t)};var js=function(e,t,n,r){var i=n.length,s=i,o=!r;if(null==e)return!s;for(e=Object(e);i--;){var a=n[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){var c=(a=n[i])[0],l=e[c],u=a[1];if(o&&a[2]){if(void 0===l&&!(c in e))return!1}else{var d=new Xt;if(r)var h=r(l,u,c,e,t,d);if(!(void 0===h?Ts(u,l,3,r,d):h))return!1}}return!0};var ks=function(e){return e==e&&!y(e)};var Ns=function(e){for(var t=tn(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,ks(i)]}return t};var Ms=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}};var Is=function(e){var t=Ns(e);return 1==t.length&&t[0][2]?Ms(t[0][0],t[0][1]):function(n){return n===e||js(n,e,t)}};var Rs=function(e,t,n){var r=null==e?void 0:Ae(e,t);return void 0===r?n:r};var Ds=function(e,t){return b(e)&&ks(t)?Ms(Ee(e),t):function(n){var r=Rs(n,e);return void 0===r&&r===t?qe(n,e):Ts(t,r,3)}};var Ls=function(e){return function(t){return null==t?void 0:t[e]}};var zs=function(e){return function(t){return Ae(t,e)}};var Ps=function(e){return b(e)?Ls(Ee(e)):zs(e)};var Fs=function(e){return"function"==typeof e?e:null==e?Ze:"object"==typeof e?r(e)?Ds(e[0],e[1]):Is(e):Ps(e)};var Bs=function(e){return Fs("function"==typeof e?e:Kn(e,1))};var Hs=function(e,t){return t=xe(t,e),null==(e=at(e,t))||delete e[Ee(st(t))]};var qs=function(e){return Or(e)?void 0:e},Us=rt((function(e,t){var n={};if(null==e)return n;var r=!1;t=_e(t,(function(t){return t=xe(t,e),r||(r=t.length>1),t})),wt(e,_n(e),n),r&&(n=Kn(n,7,qs));for(var i=t.length;i--;)Hs(n,t[i]);return n}));const Vs=function(e,t){let n=e||{};t||(t={}),this.preinitialize.apply(this,arguments),this.cid=Li(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{});const r=wi(this,"defaults");n=Yi(Ht({},r,n),r),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};Vs.extend=Si,Object.assign(Vs.prototype,zi,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",preinitialize:function(){},initialize:function(){},toJSON:function(e){return Ji(this.attributes)},sync:function(e,t,n){return Ti(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 us(this.attributes)},pick:function(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),it(this.attributes,e)},omit:function(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),Us(this.attributes,e)},isEmpty:function(){return ki(this.attributes)},escape:function(e){return rs(this.get(e))},has:function(e){return null!=this.get(e)},matches:function(e){return!!Bs(e,this)(this.attributes)},set:function(e,t,n){if(null==e)return this;let r;if("object"==typeof e?(r=e,n=t):(r={})[e]=t,n||(n={}),!this._validate(r,n))return!1;const i=n.unset,s=n.silent,o=[],a=this._changing;this._changing=!0,a||(this._previousAttributes=Ji(this.attributes),this.changed={});const c=this.attributes,l=this.changed,u=this._previousAttributes;for(const e in r)t=r[e],Os(c[e],t)||o.push(e),Os(u[e],t)?delete l[e]:l[e]=t,i?delete c[e]:c[e]=t;if(this.idAttribute in r&&(this.id=this.get(this.idAttribute)),!s){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(!s)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,Ht({},t,{unset:!0}))},clear:function(e){const t={};for(const e in this.attributes)t[e]=void 0;return this.set(t,Ht({},e,{unset:!0}))},hasChanged:function(e){return null==e?!ki(this.changed):yi(this.changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&Ji(this.changed);const t=this._changing?this._previousAttributes:this.attributes,n={};let r;for(const i in e){const s=e[i];Os(t[i],s)||(n[i]=s,r=!0)}return!!r&&n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return Ji(this._previousAttributes)},fetch:function(e){e=Ht({parse:!0},e);const t=this,n=e.success;return e.success=function(r){const i=e.parse?t.parse(r,e):r;if(!t.set(i,e))return!1;n&&n.call(e.context,t,r,e),t.trigger("sync",t,r,e)},Ai(this,e),this.sync("read",this,e)},save:function(e,t,n){let r;null==e||"object"==typeof e?(r=e,n=t):(r={})[e]=t;const i=(n=Ht({validate:!0,parse:!0},n)).wait,s=n.promise,o=s&&xi();if(r&&!i){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;const a=this,c=n.success,l=n.error,u=this.attributes;n.success=function(e){a.attributes=u;let t=n.parse?a.parse(e,n):e;if(i&&(t=Ht({},r,t)),t&&!a.set(t,n))return!1;c&&c.call(n.context,a,e,n),a.trigger("sync",a,e,n),s&&o.resolve()},n.error=function(e,t,n){l&&l.call(n.context,e,t,n),s&&o.reject(t)},Ai(this,n),r&&i&&(this.attributes=Ht({},u,r));const d=this.isNew()?"create":n.patch?"patch":"update";"patch"!==d||n.attrs||(n.attrs=r);const h=this.sync(d,this,n);return this.attributes=u,s?o:h},destroy:function(e){e=e?Ji(e):{};const t=this,n=e.success,r=e.wait,i=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(s){r&&i(),n&&n.call(e.context,t,s,e),t.isNew()||t.trigger("sync",t,s,e)};let s=!1;return this.isNew()?Zi(e.success):(Ai(this,e),s=this.sync("delete",this,e)),r||i(),s},url:function(){const e=wi(this,"urlRoot")||wi(this.collection,"url")||Ei();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({},Ht({},e,{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=Ht({},this.attributes,e);const n=this.validationError=this.validate(e,t)||null;return!n||(this.trigger("invalid",this,n,Ht(t,{validationError:n})),!1)}});
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the core utilities module.
*/
const $s={isTagEqual:function(e,t){if(e.nodeTree)return $s.isTagEqual(e.nodeTree,t);if(e instanceof Element)return gi.e.isTagEqual(e,t);throw Error("isTagEqual called with value which isn't an element or Strophe.Builder instance")}},Gs=new DOMParser,Ws=Gs.parseFromString("invalid","text/xml").getElementsByTagName("parsererror")[0].namespaceURI;
/**
* Clears the specified timeout and interval.
* @method u#clearTimers
* @param {number} timeout - Id if the timeout to clear.
* @param {number} interval - Id of the interval to clear.
* @private
* @copyright Simen Bekkhus 2016
* @license MIT
*/
function Js(e,t){clearTimeout(e),clearInterval(t)}
/**
* Creates a {@link Promise} that resolves if the passed in function returns a truthy value.
* Rejects if it throws or does not return truthy within the given max_wait.
* @method u#waitUntil
* @param {Function} func - The function called every check_delay,
* and the result of which is the resolved value of the promise.
* @param {number} [max_wait=300] - The time to wait before rejecting the promise.
* @param {number} [check_delay=3] - The time to wait before each invocation of {func}.
* @returns {Promise} A promise resolved with the value of func,
* or rejected with the exception thrown by it or it times out.
* @copyright Simen Bekkhus 2016
* @license MIT
*/$s.getJIDFromURI=function(e){return e.startsWith("xmpp:")&&e.endsWith("?join")?e.replace(/^xmpp:/,"").replace(/\?join$/,""):e},$s.toStanza=function(e){const t=Gs.parseFromString(e,"text/xml");if(t.getElementsByTagNameNS(Ws,"parsererror").length)throw new Error("Parser Error: ".concat(e));return t.firstElementChild},$s.getLongestSubstring=function(e,t){return t.reduce((function(t,n){return e.startsWith(n)&&n.length>t.length?n:t}),"")},$s.prefixMentions=function(e){let t=e.get("message");return(e.get("references")||[]).sort((e,t)=>t.begin-e.begin).forEach(e=>{t="".concat(t.slice(0,e.begin),"@").concat(t.slice(e.begin))}),t},$s.isValidJID=function(e){return"string"==typeof e&&(2===mi(e.split("@")).length&&!e.startsWith("@")&&!e.endsWith("@"))},$s.isValidMUCJID=function(e){return!e.startsWith("@")&&!e.endsWith("@")},$s.isSameBareJID=function(e,t){return"string"==typeof e&&"string"==typeof t&&gi.e.getBareJidFromJid(e).toLowerCase()===gi.e.getBareJidFromJid(t).toLowerCase()},$s.isSameDomain=function(e,t){return"string"==typeof e&&"string"==typeof t&&gi.e.getDomainFromJid(e).toLowerCase()===gi.e.getDomainFromJid(t).toLowerCase()},$s.isNewMessage=function(e){return e instanceof Element?!(pi()('result[xmlns="'.concat(gi.e.NS.MAM,'"]'),e).length&&pi()('delay[xmlns="'.concat(gi.e.NS.DELAY,'"]'),e).length):(e instanceof Vs&&(e=e.attributes),!(e.is_delayed&&e.is_archived))},$s.shouldCreateMessage=function(e){return e.retracted||!$s.isEmptyMessage(e)},$s.shouldCreateGroupchatMessage=function(e){return e.nick&&($s.shouldCreateMessage(e)||e.is_tombstone)},$s.isEmptyMessage=function(e){return e instanceof Vs&&(e=e.attributes),!(e.oob_url||e.file||e.is_encrypted&&e.plaintext||e.message)},$s.isOnlyChatStateNotification=function(e){return e instanceof Element?null===e.querySelector("body")&&(null!==e.querySelector("active")||null!==e.querySelector("composing")||null!==e.querySelector("inactive")||null!==e.querySelector("paused")||null!==e.querySelector("gone")):(e instanceof Vs&&(e=e.attributes),e.chat_state&&$s.isEmptyMessage(e))},$s.isOnlyMessageDeliveryReceipt=function(e){return e instanceof Element?null===e.querySelector("body")&&null!==e.querySelector("received"):(e instanceof Vs&&(e=e.attributes),e.received&&$s.isEmptyMessage(e))},$s.isChatRoom=function(e){return e&&"chatroom"===e.get("type")},$s.isErrorObject=function(e){return e instanceof Error},$s.isErrorStanza=function(e){return!!Ir(e)&&"error"===e.getAttribute("type")},$s.isForbiddenError=function(e){return!!Ir(e)&&pi()('error[type="auth"] forbidden[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),e).length>0},$s.isServiceUnavailableError=function(e){return!!Ir(e)&&pi()('error[type="cancel"] service-unavailable[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),e).length>0},$s.merge=function e(t,n){for(const r in n)y(t[r])?e(t[r],n[r]):t[r]=n[r]},$s.getOuterWidth=function(e,t=!1){let n=e.offsetWidth;if(!t)return n;const r=window.getComputedStyle(e);return n+=parseInt(r.marginLeft?r.marginLeft:0,10)+parseInt(r.marginRight?r.marginRight:0,10),n},$s.stringToElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},$s.matchesSelector=function(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return!!n&&n.call(e,t)},$s.queryChildren=function(e,t){return Array.from(e.childNodes).filter(e=>$s.matchesSelector(e,t))},$s.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,r)=>e||n(t,r),!1);if("string"==typeof e)return n(t,e);throw new TypeError("contains: wrong attribute type. Must be string or array.")}},$s.isOfType=function(e,t){return t.get("type")==e},$s.isInstance=function(e,t){return t instanceof e},$s.getAttribute=function(e,t){return t.get(e)},$s.contains.not=function(e,t){return function(n){return!$s.contains(e,t)(n)}},$s.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)},$s.createFragmentFromText=function(e){var t,n=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=e;t=r.firstChild;)n.appendChild(t);return n},$s.isPersistableModel=function(e){return e.collection&&e.collection.browserStorage},$s.getResolveablePromise=function(){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},$s.interpolate=function(e,t){return e.replace(/{{{([^{}]*)}}}/g,(e,n)=>{var r=t[n];return"string"==typeof r||"number"==typeof r?r:e})},$s.onMultipleEvents=function(e=[],t){let n=[];function r(r){n.push(r),e.length===n.length&&(t(n),n=[])}e.forEach(e=>e.object.on(e.event,r))},$s.safeSave=function(e,t,n){$s.isPersistableModel(e)?e.save(t,n):e.set(t,n)},$s.siblingIndex=function(e){for(var t=0;e=e.previousElementSibling;t++);return t},$s.getCurrentWord=function(e,t,n){t||(t=e.selectionEnd||void 0);let[r]=e.value.slice(0,t).split(/\s/).slice(-1);return n&&([r]=r.split(n).slice(-1)),r},$s.isMentionBoundary=e=>"@"!==e&&RegExp("(\\p{Z}|\\p{P})","u").test(e),$s.replaceCurrentWord=function(e,t){const n=e.selectionEnd||void 0,r=st(e.value.slice(0,n).split(/\s/)),i=e.value,s=$s.isMentionBoundary(r[0])?r[0]:"";e.value=i.slice(0,n-r.length)+s+"".concat(t," ")+i.slice(n);const o=n-r.length+t.length+1;e.selectionEnd=s?o+1:o},$s.triggerEvent=function(e,t,n="Event",r=!0,i=!0){const s=document.createEvent(n);s.initEvent(t,r,i),e.dispatchEvent(s)},$s.getSelectValues=function(e){const t=[],n=e&&e.options;for(var r=0,i=n.length;r<i;r++){const e=n[r];e.selected&&t.push(e.value||e.text)}return t},$s.formatFingerprint=function(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},$s.appendArrayBuffer=function(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},$s.arrayBufferToHex=function(e){return Array.prototype.map.call(new Uint8Array(e),e=>("00"+e.toString(16)).slice(-2)).join("")},$s.arrayBufferToString=function(e){return new TextDecoder("utf-8").decode(e)},$s.stringToArrayBuffer=function(e){return new TextEncoder("utf-8").encode(e).buffer},$s.arrayBufferToBase64=function(e){return btoa(new Uint8Array(e).reduce((e,t)=>e+String.fromCharCode(t),""))},$s.base64ToArrayBuffer=function(e){const t=window.atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer},$s.getRandomInt=function(e){return Math.floor(Math.random()*Math.floor(e))},$s.placeCaretAtEnd=function(e){e!==document.activeElement&&e.focus();const t=2*e.value.length;setTimeout(()=>e.setSelectionRange(t,t),1),this.scrollTop=999999},$s.getUniqueId=function(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},$s.waitUntil=function(e,t=300,n=3){try{const t=e();if(t)return Promise.resolve(t)}catch(e){return Promise.reject(e)}const r=$s.getResolveablePromise(),i=new Error;const s=setInterval((function(){try{const t=e();t&&(Js(o,s),r.resolve(t))}catch(e){Js(o,s),r.reject(e)}}),n);const o=setTimeout((function(){Js(o,s);const e="Wait until promise timed out: \n\n".concat(i.stack);console.trace(),Lr.error(e),r.reject(new Error(e))}),t);return r};var Xs=$s;var Qs=function(e,t,n,r){for(var i=-1,s=null==e?0:e.length;++i<s;){var o=e[i];t(r,o,n(o),e)}return r};var Ys=function(e,t){return function(n,r){if(null==n)return n;if(!St(n))return e(n,r);for(var i=n.length,s=t?i:-1,o=Object(n);(t?s--:++s<i)&&!1!==r(o[s],s,o););return n}},Ks=Ys(os);var Zs=function(e,t,n,r){return Ks(e,(function(e,i,s){t(r,e,n(e),s)})),r};var eo=function(e,t){return function(n,i){var s=r(n)?Qs:Zs,o=t?t():{};return s(n,e,Fs(i,2),o)}},to=Object.prototype.hasOwnProperty,no=eo((function(e,t,n){to.call(e,n)?++e[n]:Te(e,n,1)}));var ro=function(e,t,n,r){for(var i=e.length,s=n+(r?1:-1);r?s--:++s<i;)if(t(e[s],s,e))return s;return-1};var io=function(e){return e!=e};var so=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1};var oo=function(e,t,n){return t==t?so(e,t,n):ro(e,io,n)};var ao=function(e,t){return!!(null==e?0:e.length)&&oo(e,t,0)>-1};var co=function(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1};var lo=function(e,t,n,r){var i=-1,s=ao,o=!0,a=e.length,c=[],l=t.length;if(!a)return c;n&&(t=_e(t,jt(n))),r?(s=co,o=!1):t.length>=200&&(s=gs,o=!1,t=new ps(t));e:for(;++i<a;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,o&&d==d){for(var h=l;h--;)if(t[h]===d)continue e;c.push(u)}else s(t,d,r)||c.push(u)}return c};var uo=function(e){return m(e)&&St(e)},ho=lt((function(e,t){return uo(e)?lo(e,We(t,1,uo,!0)):[]}));var fo=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0};var po=function(e,t){var n=!0;return Ks(e,(function(e,r,i){return n=!!t(e,r,i)})),n};var mo=function(e,t,n){var i=r(e)?fo:po;return n&&xt(e,t,n)&&(t=void 0),i(e,Fs(t,3))},go=Math.max;var vo=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Mi(n);return i<0&&(i=go(r+i,0)),ro(e,Fs(t,3),i)},_o=Math.max,bo=Math.min;var yo=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=Mi(n),i=n<0?_o(r+i,0):bo(i,r-1)),ro(e,Fs(t,3),i,!0)},wo=Object.prototype.hasOwnProperty,So=eo((function(e,t,n){wo.call(e,n)?e[n].push(t):Te(e,n,[t])})),xo=Math.max;var Eo=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Mi(n);return i<0&&(i=xo(r+i,0)),oo(e,t,i)},Ao=eo((function(e,t,n){Te(e,n,t)}));var Co=function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r},To=Math.max,Oo=Math.min;var jo=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=Mi(n))<0?To(r+i,0):Oo(i,r-1)),t==t?Co(e,t,i):ro(e,io,i,!0)};var ko=function(e,t){var n;return Ks(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n};var No=function(e,t,n){var i=r(e)?ms:ko;return n&&xt(e,t,n)&&(t=void 0),i(e,Fs(t,3))};var Mo=function(e,t){var n=-1,r=St(e)?Array(e.length):[];return Ks(e,(function(e,i,s){r[++n]=t(e,i,s)})),r};var Io=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e};var Ro=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,s=g(e),o=void 0!==t,a=null===t,c=t==t,l=g(t);if(!a&&!l&&!s&&e>t||s&&o&&c&&!a&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!s&&!l&&e<t||l&&n&&i&&!r&&!s||a&&n&&i||!o&&i||!c)return-1}return 0};var Do=function(e,t,n){for(var r=-1,i=e.criteria,s=t.criteria,o=i.length,a=n.length;++r<o;){var c=Ro(i[r],s[r]);if(c)return r>=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index};var Lo=function(e,t,n){t=t.length?_e(t,(function(e){return r(e)?function(t){return Ae(t,1===e.length?e[0]:e)}:e})):[Ze];var i=-1;t=_e(t,jt(Fs));var s=Mo(e,(function(e,n,r){return{criteria:_e(t,(function(t){return t(e)})),index:++i,value:e}}));return Io(s,(function(e,t){return Do(e,t,n)}))},zo=lt((function(e,t){if(null==e)return[];var n=t.length;return n>1&&xt(e,t[0],t[1])?t=[]:n>2&&xt(t[0],t[1],t[2])&&(t=[t[0]]),Lo(e,We(t,1),[])}));const Po=Array.prototype.slice,Fo=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,Ht({silent:!0},t))};Fo.extend=Si;const Bo={add:!0,remove:!0,merge:!0},Ho={add:!0,remove:!1},qo=function(e,t,n){n=Math.min(Math.max(n,0),e.length);const r=Array(e.length-n),i=t.length;let s;for(s=0;s<r.length;s++)r[s]=e[s+n];for(s=0;s<i;s++)e[s+n]=t[s];for(s=0;s<r.length;s++)e[s+i+n]=r[s]};Object.assign(Fo.prototype,zi,{model:Vs,preinitialize:function(){},initialize:function(){},toJSON:function(e){return this.map((function(t){return t.toJSON(e)}))},sync:function(e,t,n){return Ti(this)(e,t,n)},add:function(e,t){return this.set(e,Ht({merge:!1},t,Ho))},remove:function(e,t){t=Ht({},t);const n=!Array.isArray(e);e=n?[e]:e.slice();const r=this._removeModels(e,t);return!t.silent&&r.length&&(t.changes={added:[],merged:[],removed:r},this.trigger("update",this,t)),n?r[0]:r},set:function(e,t){if(null==e)return;(t=Ht({},Bo,t)).parse&&!this._isModel(e)&&(e=this.parse(e,t)||[]);const n=!Array.isArray(e);e=n?[e]:e.slice();let r=t.at;null!=r&&(r=+r),r>this.length&&(r=this.length),r<0&&(r+=this.length+1);const i=[],s=[],o=[],a=[],c={},l=t.add,u=t.merge,d=t.remove;let h=!1;const f=this.comparator&&null==r&&!1!==t.sort,p=er(this.comparator)?this.comparator:null;let m,g;for(g=0;g<e.length;g++){m=e[g];const n=this.get(m);if(n){if(u&&m!==n){let e=this._isModel(m)?m.attributes:m;t.parse&&(e=n.parse(e,t)),n.set(e,t),o.push(n),f&&!h&&(h=n.hasChanged(p))}c[n.cid]||(c[n.cid]=!0,i.push(n)),e[g]=n}else l&&(m=e[g]=this._prepareModel(m,t),m&&(s.push(m),this._addReference(m,t),c[m.cid]=!0,i.push(m)))}if(d){for(g=0;g<this.length;g++)m=this.models[g],c[m.cid]||a.push(m);a.length&&this._removeModels(a,t)}let v=!1;const _=!f&&l&&d;if(i.length&&_?(v=this.length!==i.length||No(this.models,(e,t)=>e!==i[t]),this.models.length=0,qo(this.models,i,0),this.length=this.models.length):s.length&&(f&&(h=!0),qo(this.models,s,null==r?this.length:r),this.length=this.models.length),h&&this.sort({silent:!0}),!t.silent){for(g=0;g<s.length;g++)null!=r&&(t.index=r+g),m=s[g],m.trigger("add",m,this,t);(h||v)&&this.trigger("sort",this,t),(s.length||a.length||o.length)&&(t.changes={added:s,removed:a,merged:o},this.trigger("update",this,t))}return n?e[0]:e},clearStore:async function(e={},t=(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?Ji(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,Ht({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,Ht({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,Ht({at:0},t))},shift:function(e){const t=this.at(0);return this.remove(t,e)},slice:function(){return Po.apply(this.models,arguments)},filter:function(e,t){return this.models.filter(S(e)?e:t=>t.matches(e),t)},every:function(e){return mo(this.models.map(e=>e.attributes),e)},difference:function(e){return ho(this.models,e)},max:function(){return Math.max.apply(Math,this.models)},min:function(){return Math.min.apply(Math,this.models)},drop:function(e=1){return this.models.slice(e)},some:function(e){return No(this.models.map(e=>e.attributes),e)},sortBy:function(e){return zo(this.models,S(e)?e:t=>er(e)?t.get(e):t.matches(e))},isEmpty:function(){return ki(this.models)},keyBy:function(e){return Ao(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 no(this.models,S(e)?e:t=>er(e)?t.get(e):t.matches(e))},groupBy:function(e){return So(this.models,S(e)?e:t=>er(e)?t.get(e):t.matches(e))},indexOf:function(e){return Eo(this.models,e)},findLastIndex:function(e,t){return yo(this.models,S(e)?e:t=>er(e)?t.get(e):t.matches(e),t)},lastIndexOf:function(e){return jo(this.models,e)},findIndex:function(e){return vo(this.models,S(e)?e:t=>er(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(S(e)?e:t=>er(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=S(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 S(t)&&(t=t.bind(this)),1===n||er(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=Ht({parse:!0},e)).success,n=this,r=e.promise&&xi();return e.success=function(i){const s=e.reset?"reset":"set";n[s](i,e),t&&t.call(e.context,n,i,e),r&&r.resolve(),n.trigger("sync",n,i,e)},Ai(this,e),r||this.sync("read",this,e)},create:function(e,t){const n=(t=t?Ji(t):{}).wait,r=t.promise,i=r&&xi();if(!(e=this._prepareModel(e,t)))return!1;n||this.add(e,t);const s=this,o=t.success,a=t.error;return t.success=function(e,t,a){n&&s.add(e,a),o&&o.call(a.context,e,t,a),r&&i.resolve(e)},t.error=function(e,t,n){a&&a.call(n.context,e,t,n),r&&i.reject(t)},e.save(null,Object.assign(t,{promise:!1})),r?i:e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype.idAttribute||"id"]},values:function(){return new Vo(this,$o)},keys:function(){return new Vo(this,Go)},entries:function(){return new Vo(this,Wo)},_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?Ji(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 r=0;r<e.length;r++){const i=this.get(e[r]);if(!i)continue;const s=this.indexOf(i);this.models.splice(s,1),this.length--,delete this._byId[i.cid];const o=this.modelId(i.attributes);null!=o&&delete this._byId[o],t.silent||(t.index=s,i.trigger("remove",i,this,t)),n.push(i),this._removeReference(i,t)}return n},_isModel:function(e){return e instanceof Vs},_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,r){if(t){if(("add"===e||"remove"===e)&&n!==this)return;if("destroy"===e&&this.remove(t,r),"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 Uo="function"==typeof Symbol&&Symbol.iterator;Uo&&(Fo.prototype[Uo]=Fo.prototype.values);const Vo=function(e,t){this._collection=e,this._kind=t,this._index=0},$o=1,Go=2,Wo=3;Uo&&(Vo.prototype[Uo]=function(){return this}),Vo.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===$o)t=e;else{const n=this._collection.modelId(e.attributes);t=this._kind===Go?n:[n,e]}return{value:t,done:!1}}this._collection=void 0}return{value:void 0,done:!0}};var Jo=n(60),Xo=n.n(Jo),Qo=n(91),Yo=n.n(Qo),Ko=n(1);class Zo extends Ko.e.Connection{constructor(e,t){super(e,t),this.debouncedReconnect=Xo()(this.reconnect,2e3)}static generateResource(){return"/converse.js-".concat(Math.floor(139749528*Math.random()).toString())}async bind(){await Tc.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 Lr.warn("Could not discover XEP-0156 connection methods");const r=pi()('Link[rel="urn:xmpp:alt-connections:xbosh"]',n),i=pi()('Link[rel="urn:xmpp:alt-connections:websocket"]',n),s=r.map(e=>e.getAttribute("href")),o=i.map(e=>e.getAttribute("href"));0===s.length&&0===o.length?Lr.warn("Neither BOSH nor WebSocket connection methods have been specified with XEP-0156."):(Tc.settings.set("websocket_url",o.pop()),Tc.settings.set("bosh_service_url",s.pop()),this.service=Tc.settings.get("websocket_url")||Tc.settings.get("bosh_service_url"),this.setProtocol())}async discoverConnectionMethods(e){const t={mode:"cors",headers:{Accept:"application/xrd+xml, text/xml"}},n="https://".concat(e,"/.well-known/host-meta");let r;try{r=await fetch(n,t)}catch(e){return Lr.error("Failed to discover alternative connection methods at ".concat(n)),void Lr.error(e)}r.status>=200&&r.status<400?await this.onDomainDiscovered(r):Lr.warn("Could not discover XEP-0156 connection methods")}async connect(e,t,n){if(Tc.settings.get("discover_connection_methods")){const t=Ko.e.getDomainFromJid(e);await this.discoverConnectionMethods(t)}super.connect(e,t,n||this.onConnectStatusChanged,59)}async reconnect(){const{__:e}=xc;return Lr.debug("RECONNECTING: the connection has dropped, attempting to reconnect."),this.setConnectionStatus(Ko.e.Status.RECONNECTING,e("The connection has dropped, attempting to reconnect.")),Tc.trigger("will-reconnect"),this.reconnecting=!0,await kc(),Tc.user.login()}async onConnected(e){delete this.reconnecting,this.flush(),await xc.setUserJID(this.jid),await Tc.trigger("afterResourceBinding",e,{synchronous:!0}),e?Tc.trigger("reconnected"):Tc.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,xc.connfeedback.set({connection_status:e,message:t})}async finishDisconnection(){Lr.debug("DISCONNECTED"),delete this.reconnecting,this.reset(),kc(),await Mc(),delete xc.connection,Tc.trigger("disconnected")}onDisconnected(){if(!Tc.settings.get("auto_reconnect"))return this.finishDisconnection();{const e=this.disconnection_reason;if(this.disconnection_cause===Ko.e.Status.AUTHFAIL)return Tc.settings.get("credentials_url")||Tc.settings.get("authentication")===xc.ANONYMOUS?Tc.connection.reconnect():this.finishDisconnection();if(this.disconnection_cause===xc.LOGOUT||e===Ko.e.ErrorCondition.NO_AUTH_MECH||"host-unknown"===e||"remote-connection-failed"===e)return this.finishDisconnection();Tc.connection.reconnect()}}onConnectStatusChanged(e,t){const{__:n}=xc;var r;if(Lr.debug("Status changed to: ".concat(xc.CONNECTION_STATUS[e])),e===Ko.e.Status.ATTACHFAIL)this.setConnectionStatus(e),null===(r=this.worker_attach_promise)||void 0===r||r.resolve(!1);else if(e===Ko.e.Status.CONNECTED||e===Ko.e.Status.ATTACHED){var i,s;if((null===(i=this.worker_attach_promise)||void 0===i?void 0:i.isResolved)&&this.status===Ko.e.Status.ATTACHED)return;this.setConnectionStatus(e),null===(s=this.worker_attach_promise)||void 0===s||s.resolve(!0),xc.send_initial_presence=!0,this.setDisconnectionCause(),this.reconnecting?(Lr.debug(e===Ko.e.Status.CONNECTED?"Reconnected":"Reattached"),this.onConnected(!0)):(Lr.debug(e===Ko.e.Status.CONNECTED?"Connected":"Attached"),this.restored&&(xc.send_initial_presence=!1),this.onConnected())}else if(e===Ko.e.Status.DISCONNECTED)this.setDisconnectionCause(e,t),this.onDisconnected();else if(e===Ko.e.Status.BINDREQUIRED)this.bind();else if(e===Ko.e.Status.ERROR)this.setConnectionStatus(e,n("An error occurred while connecting to the chat server."));else if(e===Ko.e.Status.CONNECTING)this.setConnectionStatus(e);else if(e===Ko.e.Status.AUTHENTICATING)this.setConnectionStatus(e);else if(e===Ko.e.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===Ko.e.Status.CONNFAIL){var o;let r=t;"host-unknown"===t||"remote-connection-failed"==t?r=n("Sorry, we could not connect to the XMPP host with domain: %1$s",'"'.concat(Ko.e.getDomainFromJid(this.jid),'"')):void 0!==t&&t===(null===Ko.e||void 0===Ko.e||null===(o=Ko.e.ErrorCondition)||void 0===o?void 0:o.NO_AUTH_MECH)&&(r=n("The XMPP server did not offer a supported authentication mechanism")),this.setConnectionStatus(e,r),this.setDisconnectionCause(e,t)}else e===Ko.e.Status.DISCONNECTING&&this.setDisconnectionCause(e,t)}isType(e){return"websocket"===e.toLowerCase()?this._proto instanceof Ko.e.Websocket:"bosh"===e.toLowerCase()?Ko.e.Bosh&&this._proto instanceof Ko.e.Bosh:void 0}hasResumed(){var e;return(null===(e=Tc.settings.get("connection_options"))||void 0===e?void 0:e.worker)||this.isType("bosh")?xc.connfeedback.get("connection_status")===Ko.e.Status.ATTACHED:!this.do_bind}restoreWorkerSession(){return this.attach(this.onConnectStatusChanged),this.worker_attach_promise=Xs.getResolveablePromise(),this.worker_attach_promise}}class ea extends Zo{constructor(e,t){super(e,t),this.sent_stanzas=[],this.IQ_stanzas=[],this.IQ_ids=[],this.features=Ko.e.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(Ko.e.Status.BINDREQUIRED)}}_processRequest(){}sendIQ(e,t,n){Yo()(e)||(e=e.nodeTree),this.IQ_stanzas.push(e);const r=super.sendIQ(e,t,n);return this.IQ_ids.push(r),r}send(e){return Yo()(e)?this.sent_stanzas.push(e):this.sent_stanzas.push(e.nodeTree),super.send(e)}async bind(){await Tc.trigger("beforeResourceBinding",{synchronous:!0}),this.authenticated=!0,xc.no_connection_on_bind||this._changeConnectStatus(Ko.e.Status.CONNECTED)}}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/const ta="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,na=(e,t,n=null,r=null)=>{for(;t!==n;){const n=t.nextSibling;e.insertBefore(t,r),t=n}},ra=(e,t,n=null)=>{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}},ia=`{{lit-${String(Math.random()).slice(2)}}}`,sa=`\x3c!--${ia}--\x3e`,oa=new RegExp(`${ia}|${sa}`);class aa{constructor(e,t){this.parts=[],this.element=t;const n=[],r=[],i=document.createTreeWalker(t.content,133,null,!1);let s=0,o=-1,a=0;const{strings:c,values:{length:l}}=e;for(;a<l;){const e=i.nextNode();if(null!==e){if(o++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:n}=t;let r=0;for(let e=0;e<n;e++)ca(t[e].name,"$lit$")&&r++;for(;r-- >0;){const t=c[a],n=da.exec(t)[2],r=n.toLowerCase()+"$lit$",i=e.getAttribute(r);e.removeAttribute(r);const s=i.split(oa);this.parts.push({type:"attribute",index:o,name:n,strings:s}),a+=s.length-1}}"TEMPLATE"===e.tagName&&(r.push(e),i.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(ia)>=0){const r=e.parentNode,i=t.split(oa),s=i.length-1;for(let t=0;t<s;t++){let n,s=i[t];if(""===s)n=ua();else{const e=da.exec(s);null!==e&&ca(e[2],"$lit$")&&(s=s.slice(0,e.index)+e[1]+e[2].slice(0,-"$lit$".length)+e[3]),n=document.createTextNode(s)}r.insertBefore(n,e),this.parts.push({type:"node",index:++o})}""===i[s]?(r.insertBefore(ua(),e),n.push(e)):e.data=i[s],a+=s}}else if(8===e.nodeType)if(e.data===ia){const t=e.parentNode;null!==e.previousSibling&&o!==s||(o++,t.insertBefore(ua(),e)),s=o,this.parts.push({type:"node",index:o}),null===e.nextSibling?e.data="":(n.push(e),o--),a++}else{let t=-1;for(;-1!==(t=e.data.indexOf(ia,t+1));)this.parts.push({type:"node",index:-1}),a++}}else i.currentNode=r.pop()}for(const e of n)e.parentNode.removeChild(e)}}const ca=(e,t)=>{const n=e.length-t.length;return n>=0&&e.slice(n)===t},la=e=>-1!==e.index,ua=()=>document.createComment(""),da=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function ha(e,t){const{element:{content:n},parts:r}=e,i=document.createTreeWalker(n,133,null,!1);let s=pa(r),o=r[s],a=-1,c=0;const l=[];let u=null;for(;i.nextNode();){a++;const e=i.currentNode;for(e.previousSibling===u&&(u=null),t.has(e)&&(l.push(e),null===u&&(u=e)),null!==u&&c++;void 0!==o&&o.index===a;)o.index=null!==u?-1:o.index-c,s=pa(r,s),o=r[s]}l.forEach(e=>e.parentNode.removeChild(e))}const fa=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,133,null,!1);for(;n.nextNode();)t++;return t},pa=(e,t=-1)=>{for(let n=t+1;n<e.length;n++){const t=e[n];if(la(t))return n}return-1};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
const ma=new WeakMap,ga=e=>(...t)=>{const n=e(...t);return ma.set(n,!0),n},va=e=>"function"==typeof e&&ma.has(e),_a={},ba={};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
class ya{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=ta?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let i,s=0,o=0,a=r.nextNode();for(;s<n.length;)if(i=n[s],la(i)){for(;o<i.index;)o++,"TEMPLATE"===a.nodeName&&(t.push(a),r.currentNode=a.content),null===(a=r.nextNode())&&(r.currentNode=t.pop(),a=r.nextNode());if("node"===i.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(a.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(a,i.name,i.strings,this.options));s++}else this.__parts.push(void 0),s++;return ta&&(document.adoptNode(e),customElements.upgrade(e)),e}}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/const wa=` ${ia} `;class Sa{constructor(e,t,n,r){this.strings=e,this.values=t,this.type=n,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let r=0;r<e;r++){const e=this.strings[r],i=e.lastIndexOf("\x3c!--");n=(i>-1||n)&&-1===e.indexOf("--\x3e",i+1);const s=da.exec(e);t+=null===s?e+(n?wa:sa):e.substr(0,s.index)+s[1]+s[2]+"$lit$"+s[3]+ia}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
const xa=e=>null===e||!("object"==typeof e||"function"==typeof e),Ea=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class Aa{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e<n.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new Ca(this)}_getValue(){const e=this.strings,t=e.length-1;let n="";for(let r=0;r<t;r++){n+=e[r];const t=this.parts[r];if(void 0!==t){const e=t.value;if(xa(e)||!Ea(e))n+="string"==typeof e?e:String(e);else for(const t of e)n+="string"==typeof t?t:String(t)}}return n+=e[t],n}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class Ca{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===_a||xa(e)&&e===this.value||(this.value=e,va(e)||(this.committer.dirty=!0))}commit(){for(;va(this.value);){const e=this.value;this.value=_a,e(this)}this.value!==_a&&this.committer.commit()}}class Ta{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(ua()),this.endNode=e.appendChild(ua())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=ua()),e.__insert(this.endNode=ua())}insertAfterPart(e){e.__insert(this.startNode=ua()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;va(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=_a,e(this)}const e=this.__pendingValue;e!==_a&&(xa(e)?e!==this.value&&this.__commitText(e):e instanceof Sa?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Ea(e)?this.__commitIterable(e):e===ba?(this.value=ba,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,n="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=n:this.__commitNode(document.createTextNode(n)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof ya&&this.value.template===t)this.value.update(e.values);else{const n=new ya(t,e.processor,this.options),r=n._clone();n.update(e.values),this.__commitNode(r),this.value=n}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let n,r=0;for(const i of e)n=t[r],void 0===n&&(n=new Ta(this.options),t.push(n),0===r?n.appendIntoPart(this):n.insertAfterPart(t[r-1])),n.setValue(i),n.commit(),r++;r<t.length&&(t.length=r,this.clear(n&&n.endNode))}clear(e=this.startNode){ra(this.startNode.parentNode,e.nextSibling,this.endNode)}}class Oa{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;va(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=_a,e(this)}if(this.__pendingValue===_a)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=_a}}class ja extends Aa{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new ka(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class ka extends Ca{}let Na=!1;(()=>{try{const e={get capture(){return Na=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class Ma{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;va(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=_a,e(this)}if(this.__pendingValue===_a)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),r=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=Ia(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=_a}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const Ia=e=>e&&(Na?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/;function Ra(e){let t=Da.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},Da.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const r=e.strings.join(ia);return n=t.keyString.get(r),void 0===n&&(n=new aa(e,e.getTemplateElement()),t.keyString.set(r,n)),t.stringsArray.set(e.strings,n),n}const Da=new Map,La=new WeakMap,za=(e,t,n)=>{let r=La.get(t);void 0===r&&(ra(t,t.firstChild),La.set(t,r=new Ta(Object.assign({templateFactory:Ra},n))),r.appendInto(t)),r.setValue(e),r.commit()};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/const Pa=new
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
class{handleAttributeExpressions(e,t,n,r){const i=t[0];if("."===i){return new ja(e,t.slice(1),n).parts}return"@"===i?[new Ma(e,t.slice(1),r.eventContext)]:"?"===i?[new Oa(e,t.slice(1),n)]:new Aa(e,t,n).parts}handleTextExpression(e){return new Ta(e)}};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const Fa=(e,...t)=>new Sa(e,t,"html",Pa),Ba=(e,t)=>`${e}--${t}`;let Ha=!0;void 0===window.ShadyCSS?Ha=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Ha=!1);const qa=e=>t=>{const n=Ba(t.type,e);let r=Da.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},Da.set(n,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const s=t.strings.join(ia);if(i=r.keyString.get(s),void 0===i){const n=t.getTemplateElement();Ha&&window.ShadyCSS.prepareTemplateDom(n,e),i=new aa(t,n),r.keyString.set(s,i)}return r.stringsArray.set(t.strings,i),i},Ua=["html","svg"],Va=new Set,$a=(e,t,n)=>{Va.add(e);const r=n?n.element:document.createElement("template"),i=t.querySelectorAll("style"),{length:s}=i;if(0===s)return void window.ShadyCSS.prepareTemplateStyles(r,e);const o=document.createElement("style");for(let e=0;e<s;e++){const t=i[e];t.parentNode.removeChild(t),o.textContent+=t.textContent}(e=>{Ua.forEach(t=>{const n=Da.get(Ba(t,e));void 0!==n&&n.keyString.forEach(e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{n.add(e)}),ha(e,n)})})})(e);const a=r.content;n?function(e,t,n=null){const{element:{content:r},parts:i}=e;if(null==n)return void r.appendChild(t);const s=document.createTreeWalker(r,133,null,!1);let o=pa(i),a=0,c=-1;for(;s.nextNode();){for(c++,s.currentNode===n&&(a=fa(t),n.parentNode.insertBefore(t,n));-1!==o&&i[o].index===c;){if(a>0){for(;-1!==o;)i[o].index+=a,o=pa(i,o);return}o=pa(i,o)}}}(n,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(r,e);const c=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)t.insertBefore(c.cloneNode(!0),t.firstChild);else if(n){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),ha(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const Ga={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Wa=(e,t)=>t!==e&&(t==t||e==e),Ja={attribute:!0,type:String,converter:Ga,reflect:!1,hasChanged:Wa};class Xa extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,n)=>{const r=this._attributeNameForProperty(n,t);void 0!==r&&(this._attributeToPropertyMap.set(r,n),e.push(r))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=Ja){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(r){const i=this[e];this[t]=r,this.requestUpdateInternal(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Ja}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,n=Wa){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,r=t.converter||Ga,i="function"==typeof r?r:r.fromAttribute;return i?i(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,r=t.converter;return(r&&r.toAttribute||Ga.toAttribute)(e,n)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,n=Ja){const r=this.constructor,i=r._attributeNameForProperty(e,n);if(void 0!==i){const e=r._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(i):this.setAttribute(i,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const n=this.constructor,r=n._attributeToPropertyMap.get(e);if(void 0!==r){const e=n.getPropertyOptions(r);this._updateState=16|this._updateState,this[r]=n._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,n){let r=!0;if(void 0!==e){const i=this.constructor;n=n||i.getPropertyOptions(e),i._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):r=!1}!this._hasRequestedUpdate&&r&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}Xa.finalized=!0;const Qa=Element.prototype;Qa.msMatchesSelector||Qa.webkitMatchesSelector;
/**
@license
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
part of the polymer project is also subject to an additional IP rights grant
found at http://polymer.github.io/PATENTS.txt
*/
const Ya=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ka=Symbol();class Za{constructor(e,t){if(t!==Ka)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(Ya?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const ec=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof Za)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[r+1],e[0]);return new Za(n,Ka)};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const tc={};class nc extends Xa{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,n)=>e.reduceRight((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e),n),n=t(e,new Set),r=[];n.forEach(e=>r.unshift(e)),this._styles=r}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!Ya){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return new Za(String(t),Ka)}return e})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Ya?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==tc&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return tc}}nc.finalized=!0,nc.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=La.has(t),s=Ha&&11===t.nodeType&&!!t.host,o=s&&!Va.has(r),a=o?document.createDocumentFragment():t;if(za(e,a,Object.assign({templateFactory:qa(r)},n)),o){const e=La.get(a);La.delete(a);const n=e.value instanceof ya?e.value.template:void 0;$a(r,a,n),ra(t,t.firstChild),t.appendChild(a),La.set(t,e)}!i&&s&&window.ShadyCSS.styleElement(t.host)};class rc extends nc{constructor(){super(),Object.assign(this,zi)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.stopListening()}}const ic=function(){this.handlers=[],this.checkUrl=this.checkUrl.bind(this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)};ic.extend=Si;const sc=/^[#\/]|\s+$/g,oc=/^\/+|\/+$/g,ac=/#.*$/;ic.started=!1,Object.assign(ic.prototype,zi,{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(sc,"")},start:function(e){if(ic.started)throw new Error("history has already been started");if(ic.started=!0,this.options=Ht({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(oc,"/"),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),ic.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),No(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!ic.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 r=n+e;e=e.replace(ac,"");const i=this.decodeFragment(e);if(this.fragment!==i){if(this.fragment=i,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);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}});var cc=ic;var lc=function(e){return m(e)&&"[object RegExp]"==p(e)},uc=kt.a&&kt.a.isRegExp,dc=uc?jt(uc):lc;const hc=function(e={}){this.history=e.history||new cc,this.preinitialize.apply(this,arguments),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};hc.extend=Si;const fc=/\((.*?)\)/g,pc=/(\(\?)?:\w+/g,mc=/\*\w+/g,gc=/[\-{}\[\]+?.,\\\^$|#\s]/g;Object.assign(hc.prototype,zi,{preinitialize:function(){},initialize:function(){},route:function(e,t,n){return dc(e)||(e=this._routeToRegExp(e)),S(t)&&(n=t,t=""),n||(n=this[t]),this.history.route(e,r=>{const i=this._extractParameters(e,r);!1!==this.execute(n,i,t)&&(this.trigger.apply(this,["route:"+t].concat(i)),this.trigger("route",t,i),this.history.trigger("route",this,t,i))}),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=wi(this,"routes");const t=tn(this.routes);for(;null!=(e=t.pop());)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(gc,"\\$&").replace(fc,"(?:$1)?").replace(pc,(function(e,t){return t?e:"([^/?]+)"})).replace(mc,"([^?]*?)"),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}))}});var vc=n(92);
/**
* @module converse-core
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/Sr.a.extend(yr.a),gi.e.addNamespace("CARBONS","urn:xmpp:carbons:2"),gi.e.addNamespace("CHATSTATES","http://jabber.org/protocol/chatstates"),gi.e.addNamespace("CSI","urn:xmpp:csi:0"),gi.e.addNamespace("DELAY","urn:xmpp:delay"),gi.e.addNamespace("FASTEN","urn:xmpp:fasten:0"),gi.e.addNamespace("FORWARD","urn:xmpp:forward:0"),gi.e.addNamespace("HINTS","urn:xmpp:hints"),gi.e.addNamespace("HTTPUPLOAD","urn:xmpp:http:upload:0"),gi.e.addNamespace("IDLE","urn:xmpp:idle:1"),gi.e.addNamespace("MAM","urn:xmpp:mam:2"),gi.e.addNamespace("MENTIONS","urn:xmpp:mmn:0"),gi.e.addNamespace("MODERATE","urn:xmpp:message-moderate:0"),gi.e.addNamespace("NICK","http://jabber.org/protocol/nick"),gi.e.addNamespace("OMEMO","eu.siacs.conversations.axolotl"),gi.e.addNamespace("OUTOFBAND","jabber:x:oob"),gi.e.addNamespace("PUBSUB","http://jabber.org/protocol/pubsub"),gi.e.addNamespace("RAI","urn:xmpp:rai:0"),gi.e.addNamespace("REGISTER","jabber:iq:register"),gi.e.addNamespace("RETRACT","urn:xmpp:message-retract:0"),gi.e.addNamespace("ROSTERX","http://jabber.org/protocol/rosterx"),gi.e.addNamespace("RSM","http://jabber.org/protocol/rsm"),gi.e.addNamespace("SID","urn:xmpp:sid:0"),gi.e.addNamespace("SPOILER","urn:xmpp:spoiler:0"),gi.e.addNamespace("STANZAS","urn:ietf:params:xml:ns:xmpp-stanzas"),gi.e.addNamespace("STYLING","urn:xmpp:styling:0"),gi.e.addNamespace("VCARD","vcard-temp"),gi.e.addNamespace("VCARDUPDATE","vcard-temp:x:update"),gi.e.addNamespace("XFORM","jabber:x:data");class _c extends Error{}const bc=["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"],yc={allow_non_roster_messaging:!1,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:"en",idle_presence_timeout:300,jid:void 0,keepalive:!0,loglevel:"info",locales:["af","ar","bg","ca","cs","de","eo","es","eu","en","fi","fr","gl","he","hi","hu","id","it","ja","nb","nl","mr","oc","pl","pt","pt_BR","ro","ru","tr","uk","vi","zh_CN","zh_TW"],nickname:void 0,password:void 0,persistent_store:"localStorage",rid:void 0,root:window.document,sid:void 0,singleton:!1,strict_plugin_dependencies:!1,view_mode:"overlayed",websocket_url:void 0,whitelisted_plugins:[]},wc={};wc[gi.e.Status.ATTACHED]="ATTACHED",wc[gi.e.Status.AUTHENTICATING]="AUTHENTICATING",wc[gi.e.Status.AUTHFAIL]="AUTHFAIL",wc[gi.e.Status.CONNECTED]="CONNECTED",wc[gi.e.Status.CONNECTING]="CONNECTING",wc[gi.e.Status.CONNFAIL]="CONNFAIL",wc[gi.e.Status.DISCONNECTED]="DISCONNECTED",wc[gi.e.Status.DISCONNECTING]="DISCONNECTING",wc[gi.e.Status.ERROR]="ERROR",wc[gi.e.Status.RECONNECTING]="RECONNECTING",wc[gi.e.Status.REDIRECT]="REDIRECT";const Sc={initialize(){},__:(...e)=>Object(vc.sprintf)(...e)},xc={log:Lr,CONNECTION_STATUS:wc,templates:{},promises:{initialized:Xs.getResolveablePromise()},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:1e4,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 hc,TimeoutError:_c,isTestEnv:()=>"montague.lit/http-bind"===Ac.bosh_service_url,__:(...e)=>Sc.__(...e),___:e=>e};let Ec;xc.VERSION_NAME="v7.0.3dev",Object.assign(xc,zi),ci.enable(xc,"_converse","pluggable");let Ac={};function Cc(){var e;if(!xc.bare_jid){const e="No JID to fetch user settings for";throw Lr.error(e),Error(e)}if(!(null===(e=Ec)||void 0===e?void 0:e.fetched)){const e="converse.user-settings.".concat(xc.bare_jid);Ec=new Vs({id:e}),Ec.browserStorage=jc(e),Ec.fetched=Ec.fetch({promise:!0})}return Ec.fetched}const Tc=xc.api={connection:{connected(){var e;return(null==xc||null===(e=xc.connection)||void 0===e?void 0:e.connected)&&!0},disconnect(){xc.connection&&xc.connection.disconnect()},async reconnect(){const e=xc.connfeedback.get("connection_status");if(Tc.settings.get("authentication")===xc.ANONYMOUS&&(await kc(),await Mc()),e===gi.e.Status.CONNFAIL?Tc.connection.isType("websocket")&&Tc.settings.get("bosh_service_url")?(await xc.setUserJID(xc.bare_jid),xc.connection._proto._doDisconnect(),xc.connection._proto=new gi.e.Bosh(xc.connection),xc.connection.service=Tc.settings.get("bosh_service_url")):Tc.connection.isType("bosh")&&Tc.settings.get("websocket_url")&&(Tc.settings.get("authentication")===xc.ANONYMOUS?await xc.setUserJID(Tc.settings.get("jid")):await xc.setUserJID(xc.bare_jid),xc.connection._proto._doDisconnect(),xc.connection._proto=new gi.e.Websocket(xc.connection),xc.connection.service=Tc.settings.get("websocket_url")):e===gi.e.Status.AUTHFAIL&&Tc.settings.get("authentication")===xc.ANONYMOUS&&await xc.setUserJID(Tc.settings.get("jid")),!xc.connection.reconnecting)return xc.connection.reconnect();xc.connection.debouncedReconnect()},isType:e=>xc.connection.isType(e)},async trigger(e){if(!xc._events)return;const t=Array.from(arguments),n=t.pop();if(n&&n.synchronous){const n=xc._events[e]||[],r=t.splice(1);await Promise.all(n.map(e=>e.callback.apply(e.ctx,r)))}else xc.trigger.apply(xc,arguments);const r=xc.promises[e];void 0!==r&&r.resolve()},hook(e,t,n){const r=xc._events[e]||[];if(r.length){const e=r.reduce((e,n)=>e.then(e=>n.callback(t,e)),Promise.resolve(n));return e.catch(e=>{throw Lr.error(e),e}),e}return n},user:{jid:()=>xc.connection.jid,async login(e,t,n=!1){var r,i;if(e=e||xc.jid,(!(null===(r=xc.connection)||void 0===r?void 0:r.jid)||e&&!Xs.isSameDomain(xc.connection.jid,e))&&await xc.initConnection(),(null===(i=Tc.settings.get("connection_options"))||void 0===i?void 0:i.worker)&&await xc.connection.restoreWorkerSession())return;e&&(e=await xc.setUserJID(e));const s=xc.pluggable.plugins["converse-bosh"];if(s&&s.enabled()){if(await xc.restoreBOSHSession())return;if(Tc.settings.get("authentication")===xc.PREBIND&&(!n||Tc.settings.get("auto_login")))return xc.startNewPreboundBOSHSession()}t=t||Tc.settings.get("password"),async function(e,t){const{api:n}=xc;n.settings.get("authentication")===xc.LOGIN?e?Nc(e):xc.api.settings.get("credentials_url")?Nc(await async function(){let e,t=0;for(;!e;){try{e=await Lc(t)}catch(e){Lr.error("Could not fetch login credentials"),Lr.error(e)}t=2e3}return e}()):xc.jid&&(xc.api.settings.get("password")||xc.connection.pass)?Nc():!xc.isTestEnv()&&"credentials"in navigator?Nc(await async function(){try{const e=await navigator.credentials.get({password:!0});if(e&&"password"==e.type&&Xs.isValidJID(e.id))return await xc.setUserJID(e.id),{jid:e.id,password:e.password}}catch(e){Lr.error(e)}}()):!xc.isTestEnv()&&Lr.warn("attemptNonPreboundSession: Couldn't find credentials to log in with"):![xc.ANONYMOUS,xc.EXTERNAL].includes(xc.api.settings.get("authentication"))||t&&!xc.api.settings.get("auto_login")||Nc()}(e&&t?{jid:e,password:t}:null,n)},logout(){const e=Xs.getResolveablePromise(),t=()=>{Object.keys(xc.promises).forEach(Oc),delete xc.jid,Tc.trigger("logout"),e.resolve()};return xc.connection.setDisconnectionCause(xc.LOGOUT,void 0,!0),void 0!==xc.connection?(Tc.listen.once("disconnected",()=>t()),xc.connection.disconnect()):t(),e},settings:{getModel:async()=>(await Cc(),Ec),get:async(e,t)=>(await Cc(),void 0===Ec.get(e)?t:Ec.get(e)),async set(e,t){if(await Cc(),y(e))return Ec.save(e,{promise:!0});{const n={};return n[e]=t,Ec.save(n,{promise:!0})}},async clear(){await Cc(),Ec.clear()}}},settings:{extend(e){Xs.merge(yc,e);const t=Object.keys(it(e,Object.keys(yc))),n=it(Ac,t),r=Ht(it(e,t),n);Xs.merge(xc.settings,r),Xs.merge(xc,r)},update(e){return Lr.warn("The api.settings.update method has been deprecated and will be removed. Please use api.settings.extend instead."),this.extend(e)},get(e){if(Object.keys(yc).includes(e))return xc[e]},set(e,t){const n={};y(e)?(Ht(xc,it(e,Object.keys(yc))),Ht(xc.settings,it(e,Object.keys(yc)))):"string"==typeof e&&(n[e]=t,Ht(xc,it(n,Object.keys(yc))),Ht(xc.settings,it(n,Object.keys(yc))))}},promises:{add(e,t=!0){(e=Array.isArray(e)?e:[e]).forEach(e=>{const n=Xs.getResolveablePromise();n.replace=t,xc.promises[e]=n})}},listen:{once:xc.once.bind(xc),on:xc.on.bind(xc),not:xc.off.bind(xc),stanza(e,t,n){S(t)?(n=t,t={}):t=t||{},xc.connection.addHandler(n,t.ns,e,t.type,t.id,t.from,t)}},waitUntil(e){if(S(e))return Xs.waitUntil(e);{const t=xc.promises[e];return void 0===t?null:t}},send:e=>Tc.connection.connected()?("string"==typeof e&&(e=Xs.toStanza(e)),"iq"===e.tagName?Tc.sendIQ(e):(xc.connection.send(e),void Tc.trigger("send",e))):(Lr.warn("Not sending stanza because we're not connected!"),void Lr.warn(gi.e.serialize(e))),sendIQ(e,t=xc.STANZA_TIMEOUT,n=!0){var r,i;let s;return e=null!==(r=null===(i=e)||void 0===i?void 0:i.nodeTree)&&void 0!==r?r:e,["get","set"].includes(e.getAttribute("type"))?(t=t||xc.STANZA_TIMEOUT,n?(s=new Promise((n,r)=>xc.connection.sendIQ(e,n,r,t)),s.catch(n=>{if(null===n)throw new _c("Timeout error after ".concat(t,"ms for the following IQ stanza: ").concat(gi.e.serialize(e)))})):s=new Promise(n=>xc.connection.sendIQ(e,n,n,t))):(xc.connection.sendIQ(e),s=Promise.resolve()),Tc.trigger("send",e),s}};function Oc(e){const t=xc.promises[e];if(!t)throw new Error("Tried to replace non-existing promise: ".concat(e));if(t.replace){const n=Xs.getResolveablePromise();n.replace=t.replace,xc.promises[e]=n}else Lr.debug('Not replacing promise "'.concat(e,'"'))}function jc(e,t){const n=xc.storage[t||xc.getDefaultStore()];return new _r(e,n)}async function kc(){return await xc.api.trigger("beforeTearDown",{synchronous:!0}),window.removeEventListener("click",xc.onUserActivity),window.removeEventListener("focus",xc.onUserActivity),window.removeEventListener("keypress",xc.onUserActivity),window.removeEventListener("mousemove",xc.onUserActivity),window.removeEventListener(xc.unloadevent,xc.onUserActivity),window.clearInterval(xc.everySecondTrigger),xc.api.trigger("afterTearDown"),xc}function Nc(e){if([xc.ANONYMOUS,xc.EXTERNAL].includes(xc.api.settings.get("authentication"))){if(!xc.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.");xc.connection.reconnecting||xc.connection.reset(),xc.connection.connect(xc.jid.toLowerCase())}else if(xc.api.settings.get("authentication")===xc.LOGIN){var t;const n=e?e.password:(null===(t=xc.connection)||void 0===t?void 0:t.pass)||xc.api.settings.get("password");if(!n){if(xc.api.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 xc.connection.setDisconnectionCause(gi.e.Status.AUTHFAIL,void 0,!0),void xc.api.connection.disconnect()}xc.connection.reconnecting||xc.connection.reset(),xc.connection.connect(xc.jid,n)}}function Mc(){var e;return null===(e=xc.session)||void 0===e||e.destroy(),delete xc.session,xc.shouldClearCache()&&xc.api.user.settings.clear(),xc.api.trigger("clearSession",{synchronous:!0})}async function Ic(e){var t;const n=Tc.settings.get("connection_options").worker,r=gi.e.getBareJidFromJid(e).toLowerCase(),i="converse.session-".concat(r);(null===(t=xc.session)||void 0===t?void 0:t.get("id"))!==i?(xc.session=new Vs({id:i}),xc.session.browserStorage=jc(i,n?"persistent":"session"),await new Promise(e=>xc.session.fetch({success:e,error:e})),!n&&xc.session.get("active")&&(xc.session.clear(),xc.session.save({id:i})),Rc(e),function(){if("sessionStorage"===Tc.settings.get("persistent_store"))return;if("BrowserExtLocal"===xc.api.settings.get("persistent_store"))return _r.localForage.defineDriver(hi.a).then(()=>_r.localForage.setDriver("webExtensionLocalStorage")),void(xc.storage.persistent=_r.localForage);if("BrowserExtSync"===xc.api.settings.get("persistent_store"))return _r.localForage.defineDriver(ui.a).then(()=>_r.localForage.setDriver("webExtensionSyncStorage")),void(xc.storage.persistent=_r.localForage);const e={name:xc.isTestEnv()?"converse-test-persistent":"converse-persistent",storeName:xc.bare_jid};"localStorage"===xc.api.settings.get("persistent_store")?(e.description="localStorage instance",e.driver=[_r.localForage.LOCALSTORAGE]):"IndexedDB"===xc.api.settings.get("persistent_store")&&(e.description="indexedDB instance",e.driver=[_r.localForage.INDEXEDDB]),xc.storage.persistent=_r.localForage.createInstance(e)}(),xc.api.trigger("userSessionInitialized")):Rc(e)}function Rc(e){e=xc.session.get("jid")||e,xc.api.settings.get("authentication")===xc.ANONYMOUS||gi.e.getResourceFromJid(e)||(e=e.toLowerCase()+Zo.generateResource()),xc.jid=e,xc.bare_jid=gi.e.getBareJidFromJid(e),xc.resource=gi.e.getResourceFromJid(e),xc.domain=gi.e.getDomainFromJid(e),xc.session.save({jid:e,bare_jid:xc.bare_jid,resource:xc.resource,domain:xc.domain,active:!0}),xc.connection.jid=e}async function Dc(){var e;await Tc.trigger("cleanup",{synchronous:!0}),xc.router.history.stop(),document.removeEventListener("visibilitychange",xc.saveWindowState),Tc.trigger("unregisteredGlobalEventHandlers"),null===(e=xc.connection)||void 0===e||e.reset(),xc.stopListening(),xc.off(),xc.promises.initialized.isResolved&&Tc.promises.add("initialized")}function Lc(e=0){return new Promise(yt((e,t)=>{const n=new XMLHttpRequest;n.open("GET",Tc.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);xc.setUserJID(t.jid).then(()=>{e({jid:t.jid,password:t.password})})}else t(new Error("".concat(n.status,": ").concat(n.responseText)))},n.onerror=t,n.send()},e))}xc.isUniView=function(){return["mobile","fullscreen","embedded"].includes(Tc.settings.get("view_mode"))},xc.getDefaultStore=function(){if(xc.config.get("trusted")){return"sessionStorage"===Tc.settings.get("persistent_store")?"session":"persistent"}return"session"},xc.createStore=jc,xc.shouldClearCache=()=>!xc.config.get("trusted")||Tc.settings.get("clear_cache_on_logout")||xc.isTestEnv(),xc.initConnection=function(){const e=xc.api;if(!e.settings.get("bosh_service_url")){if(e.settings.get("authentication")===xc.PREBIND)throw new Error("authentication is set to 'prebind' but we don't have a BOSH connection");if(!e.settings.get("websocket_url"))throw new Error("initConnection: you must supply a value for either the bosh_service_url or websocket_url or both.")}const t=xc.isTestEnv()?ea:Zo;if(("WebSocket"in window||"MozWebSocket"in window)&&e.settings.get("websocket_url"))xc.connection=new t(e.settings.get("websocket_url"),Object.assign(xc.default_connection_options,e.settings.get("connection_options")));else{if(!e.settings.get("bosh_service_url"))throw new Error("initConnection: this browser does not support websockets and bosh_service_url wasn't specified.");xc.connection=new t(e.settings.get("bosh_service_url"),Object.assign(xc.default_connection_options,e.settings.get("connection_options"),{keepalive:e.settings.get("keepalive")}))}!function(){const e={};e[gi.e.LogLevel.DEBUG]="debug",e[gi.e.LogLevel.INFO]="info",e[gi.e.LogLevel.WARN]="warn",e[gi.e.LogLevel.ERROR]="error",e[gi.e.LogLevel.FATAL]="fatal",gi.e.log=(t,n)=>Lr.log(n,e[t]),gi.e.error=e=>Lr.error(e),xc.connection.xmlInput=e=>Lr.debug(e.outerHTML,"color: darkgoldenrod"),xc.connection.xmlOutput=e=>Lr.debug(e.outerHTML,"color: darkcyan")}(),e.trigger("connectionInitialized")},xc.setUserJID=async function(e){return await Ic(e),xc.api.trigger("setUserJID"),e},xc.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",xc.windowState=t,Tc.trigger("windowStateChanged",{state:t})},xc.ConnectionFeedback=Vs.extend({defaults:{connection_status:gi.e.Status.DISCONNECTED,message:""},initialize(){this.on("change",()=>Tc.trigger("connfeedback",xc.connfeedback))}});const zc=window.converse||{};Object.assign(zc,{CHAT_STATES:["active","composing","gone","inactive","paused"],keycodes:{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},async initialize(e){if(await Dc(),"onpagehide"in window?xc.unloadevent="pagehide":"onbeforeunload"in window?xc.unloadevent="beforeunload":"onunload"in window&&(xc.unloadevent="unload"),function(e){xc.settings={},Ac=e;const t=it(e,Object.keys(yc));Ht(xc.settings,yc,t),Ht(xc,yc,t)}(e),xc.strict_plugin_dependencies=e.strict_plugin_dependencies,Lr.setLogLevel(Tc.settings.get("loglevel")),Tc.settings.get("authentication")===xc.ANONYMOUS&&Tc.settings.get("auto_login")&&!Tc.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.");xc.router.route(/^converse\?loglevel=(debug|info|warn|error|fatal)$/,"loglevel",e=>Lr.setLogLevel(e)),xc.connfeedback=new xc.ConnectionFeedback,xc.send_initial_presence=!0,await async function(){await _r.sessionStorageInitialized,xc.storage={session:_r.localForage.createInstance({name:xc.isTestEnv()?"converse-test-session":"converse-session",description:"sessionStorage instance",driver:["sessionStorageWrapper"]})}}(),await async function(){const e="converse.client-config";xc.config=new Vs({id:e,trusted:!0}),xc.config.browserStorage=jc(e,"session"),await new Promise(e=>xc.config.fetch({success:e,error:e})),xc.api.trigger("clientConfigInitialized")}(),await Sc.initialize(),function(){xc.pluggable.initialized_plugins=[];const e=bc.concat(xc.api.settings.get("whitelisted_plugins"));xc.api.settings.get("singleton")&&["converse-bookmarks","converse-controlbox","converse-headline","converse-register"].forEach(e=>xc.api.settings.get("blacklisted_plugins").push(e)),xc.pluggable.initializePlugins({_converse:xc},e,xc.api.settings.get("blacklisted_plugins")),xc.api.trigger("pluginsInitialized")}(),document.addEventListener("visibilitychange",xc.saveWindowState),xc.saveWindowState({type:document.hidden?"blur":"focus"}),Tc.trigger("registeredGlobalEventHandlers"),!History.started&&xc.router.history.start(),Tc.settings.get("idle_presence_timeout")>0&&Tc.listen.on("addClientFeatures",()=>Tc.disco.own.features.add(gi.e.NS.IDLE));const t=xc.pluggable.plugins;if((Tc.settings.get("auto_login")||Tc.settings.get("keepalive")&&ut(t["converse-bosh"],"enabled"))&&await Tc.user.login(null,null,!0),Tc.trigger("initialized"),xc.isTestEnv())return xc},plugins:{add(e,t){if(t.__name__=e,void 0!==xc.pluggable.plugins[e])throw new TypeError('Error: plugin with name "'.concat(e,'" has already been ')+"registered!");xc.pluggable.plugins[e]=t}},env:{$build:gi.a,$iq:gi.b,$msg:gi.c,$pres:gi.d,utils:Xs,Collection:Fo,CustomElement:rc,Model:Vs,Promise:Promise,Strophe:gi.e,dayjs:Sr.a,html:Fa,log:Lr,sizzle:pi.a,sprintf:vc.sprintf,u:Xs}});const Pc=new CustomEvent("converse-loaded",{detail:{converse:zc}});window.dispatchEvent(Pc);const Fc=zc.env.utils;function Bc(e,t){Tc.send(Object(gi.c)({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)),Lr.warn("Rejecting message stanza with the following reason: ".concat(t)),Lr.warn(e)}function Hc(e,t,n,r){const i=Object(gi.c)({from:xc.connection.jid,id:Fc.getUniqueId(),to:e,type:r||"chat"}).c(n,{xmlns:gi.e.NS.MARKERS,id:t});Tc.send(i)}const{NS:qc}=gi.e;class Uc extends Error{constructor(e,t){super(e,t),this.name="StanzaParseError",this.stanza=t}}function Vc(e,t){const n={},r=pi()('stanza-id[xmlns="'.concat(gi.e.NS.SID,'"]'),e).reduce((e,t)=>(e["stanza_id ".concat(t.getAttribute("by"))]=t.getAttribute("id"),e),{});Object.assign(n,r);const i=pi()('message > result[xmlns="'.concat(gi.e.NS.MAM,'"]'),t).pop();if(i){const e=t.getAttribute("from")||xc.bare_jid;n["stanza_id ".concat(e)]=i.getAttribute("id")}const s=pi()('origin-id[xmlns="'.concat(gi.e.NS.SID,'"]'),e).pop();return s&&(n.origin_id=s.getAttribute("id")),n}function $c(e,t){var n;const r=pi()('encrypted[xmlns="'.concat(gi.e.NS.OMEMO,'"]'),e).pop(),i={is_encrypted:!!r};if(!r||Tc.settings.get("clear_cache_on_logout"))return i;const s=r.querySelector("header");i.encrypted={device_id:s.getAttribute("sid")};const o=null===(n=t.omemo_store)||void 0===n?void 0:n.get("device_id"),a=o&&pi()('key[rid="'.concat(o,'"]'),r).pop();var c;a&&Object.assign(i.encrypted,{iv:s.querySelector("iv").textContent,key:a.textContent,payload:(null===(c=r.querySelector("payload"))||void 0===c?void 0:c.textContent)||null,prekey:["true","1"].includes(a.getAttribute("prekey"))});return i}function Gc(e,t){const n=pi()('> apply-to[xmlns="'.concat(gi.e.NS.FASTEN,'"]'),e).pop();if(n){const e=n.getAttribute("id");if(pi()('> retract[xmlns="'.concat(gi.e.NS.RETRACT,'"]'),n).pop()){const n=pi()('delay[xmlns="'.concat(gi.e.NS.DELAY,'"]'),t).pop();return{editable:!1,retracted:n?Sr()(n.getAttribute("stamp")).toISOString():(new Date).toISOString(),retracted_id:e}}}else{const t=pi()('> retracted[xmlns="'.concat(gi.e.NS.RETRACT,'"]'),e).pop();if(t)return{editable:!1,is_tombstone:!0,retracted:t.getAttribute("stamp")}}return{}}function Wc(e,t){const n=pi()('replace[xmlns="'.concat(gi.e.NS.MESSAGE_CORRECT,'"]'),e).pop();if(n){const e=n.getAttribute("id"),r=e;if(e){const n=pi()('delay[xmlns="'.concat(gi.e.NS.DELAY,'"]'),t).pop();return{msgid:r,replace_id:e,edited:n?Sr()(n.getAttribute("stamp")).toISOString():(new Date).toISOString()}}}return{}}function Jc(e){const t=pi()('spoiler[xmlns="'.concat(gi.e.NS.SPOILER,'"]'),e).pop();return{is_spoiler:!!t,spoiler_hint:null==t?void 0:t.textContent}}function Xc(e){const t=pi()('x[xmlns="'.concat(gi.e.NS.OUTOFBAND,'"]'),e).pop();var n,r;return t?{oob_url:null===(n=t.querySelector("url"))||void 0===n?void 0:n.textContent,oob_desc:null===(r=t.querySelector("desc"))||void 0===r?void 0:r.textContent}:{}}function Qc(e){if("error"===e.getAttribute("type")){const t=e.querySelector("error"),n=pi()('text[xmlns="'.concat(gi.e.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 Yc(e){var t;const n=null===(t=e.querySelector("body"))||void 0===t?void 0:t.textContent;return pi()('reference[xmlns="'.concat(gi.e.NS.REFERENCE,'"]'),e).map(e=>{const t=e.getAttribute("begin"),r=e.getAttribute("end");return{begin:t,end:r,type:e.getAttribute("type"),value:n.slice(t,r),uri:e.getAttribute("uri")}})}function Kc(e){const t=pi()('received[xmlns="'.concat(gi.e.NS.RECEIPTS,'"]'),e).pop();return null==t?void 0:t.getAttribute("id")}function Zc(e){const t=gi.e.NS.CARBONS;return pi()('message > received[xmlns="'.concat(t,'"]'),e).length>0||pi()('message > sent[xmlns="'.concat(t,'"]'),e).length>0}function el(e){var t;return null===(t=pi()('\n composing[xmlns="'.concat(qc.CHATSTATES,'"],\n paused[xmlns="').concat(qc.CHATSTATES,'"],\n inactive[xmlns="').concat(qc.CHATSTATES,'"],\n active[xmlns="').concat(qc.CHATSTATES,'"],\n gone[xmlns="').concat(qc.CHATSTATES,'"]'),e).pop())||void 0===t?void 0:t.nodeName}function tl(e,t){return"me"!==t.sender&&!t.is_carbon&&!t.is_archived&&pi()('request[xmlns="'.concat(gi.e.NS.RECEIPTS,'"]'),e).length}function nl(e){if(pi()('message > forwarded[xmlns="'.concat(gi.e.NS.FORWARD,'"]'),e).length){Bc(e,"Forwarded messages not part of an encapsulating protocol are not supported");const t=e.getAttribute("from");return new Uc("Ignoring unencapsulated forwarded message from ".concat(t),e)}}function rl(e){return pi()('\n acknowledged[xmlns="'.concat(gi.e.NS.MARKERS,'"],\n displayed[xmlns="').concat(gi.e.NS.MARKERS,'"],\n received[xmlns="').concat(gi.e.NS.MARKERS,'"]'),e).pop()}function il(e){return"headline"===e.getAttribute("type")}function sl(e){if(pi()('mentions[xmlns="'.concat(gi.e.NS.MENTIONS,'"]'),e).pop())return!1;const t=e.getAttribute("from");return!("error"===e.getAttribute("type")||!t||t.includes("@"))}function ol(e){return!!pi()('message > result[xmlns="'.concat(gi.e.NS.MAM,'"]'),e).pop()}function al(e){return e.getAttributeNames().reduce((t,n)=>(t[n]=gi.e.xmlunescape(e.getAttribute(n)),t),{})}const{Strophe:cl}=zc.env;let ll,ul;cl.addNamespace("ADHOC","http://jabber.org/protocol/commands");const dl={adhoc:{async getCommands(e){let t=[];try{n=await ul.disco.items(e,cl.NS.ADHOC),t=pi()('query[xmlns="'.concat(cl.NS.DISCO_ITEMS,'"][node="').concat(cl.NS.ADHOC,'"] item'),n).map(al)}catch(t){null===t?Lr.error("Error: timeout while fetching ad-hoc commands for ".concat(e)):(Lr.error("Error while fetching ad-hoc commands for ".concat(e)),Lr.error(t))}var n;return t}}};zc.plugins.add("converse-adhoc",{dependencies:["converse-disco"],initialize(){ll=this._converse,ul=ll.api,Object.assign(ul,dl)}});var hl=function(e,t){return e===t||js(e,t,Ns(t))};var fl=function(e){return function(t,n,r){var i=Object(t);if(!St(t)){var s=Fs(n,3);t=tn(t),n=function(e){return s(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[s?t[o]:o]:void 0}}(vo);const pl=zc.env.utils;var ml=Vs.extend({initialize(){this.rosterContactAdded=pl.getResolveablePromise()},async setRosterContact(e){const t=await Tc.contacts.get(e);t&&(this.contact=t,this.set("nickname",t.get("nickname")),this.rosterContactAdded.resolve())}}),gl=n(169),vl=n.n(gl);const{Strophe:_l,sizzle:bl}=zc.env;async function yl(e,t){var n,r,i,s,o,a;const c=nl(e);if(c)return c;let l=e.getAttribute("to");const u=_l.getResourceFromJid(l);if(Tc.settings.get("filter_by_resource")&&u&&u!==t.resource)return new Uc("Ignoring incoming message intended for a different resource: ".concat(l),e);const d=e;let h=e.getAttribute("from")||t.bare_jid;if(Zc(e)){if(h!==t.bare_jid)return Bc(e,"Rejecting carbon from invalid JID"),new Uc("Rejecting carbon from invalid JID ".concat(l),e);{const t='[xmlns="'.concat(_l.NS.CARBONS,'"] > forwarded[xmlns="').concat(_l.NS.FORWARD,'"] > message');l=(e=bl(t,e).pop()).getAttribute("to"),h=e.getAttribute("from")}}const f=ol(e);if(f){if(h!==t.bare_jid)return new Uc("Invalid Stanza: alleged MAM message from ".concat(e.getAttribute("from")),e);{const t='[xmlns="'.concat(_l.NS.MAM,'"] > forwarded[xmlns="').concat(_l.NS.FORWARD,'"] > message');l=(e=bl(t,e).pop()).getAttribute("to"),h=e.getAttribute("from")}}const p=_l.getBareJidFromJid(h),m=p===t.bare_jid;if(m&&null===l)return new Uc("Don't know how to handle message stanza without 'to' attribute. ".concat(e.outerHTML),e);const g=il(e),v=sl(e);let _,b;if(!g&&!v&&(b=m?_l.getBareJidFromJid(l):p,_=await Tc.contacts.get(b),void 0===_&&!Tc.settings.get("allow_non_roster_messaging")))return Lr.error(e),new Uc("Blocking messaging with a JID not in our roster because allow_non_roster_messaging is false.",e);const y=bl('delay[xmlns="'.concat(_l.NS.DELAY,'"]'),d).pop(),w=rl(e),S=(new Date).toISOString();let x=Object.assign({contact_jid:b,is_archived:f,is_headline:g,is_server_message:v,body:null===(n=e.querySelector("body"))||void 0===n||null===(r=n.textContent)||void 0===r?void 0:r.trim(),chat_state:el(e),from:_l.getBareJidFromJid(e.getAttribute("from")),is_carbon:Zc(d),is_delayed:!!y,is_markable:!!bl('markable[xmlns="'.concat(_l.NS.MARKERS,'"]'),e).length,is_marker:!!w,is_unstyled:!!bl('unstyled[xmlns="'.concat(_l.NS.STYLING,'"]'),e).length,marker_id:w&&w.getAttribute("id"),msgid:e.getAttribute("id")||d.getAttribute("id"),nick:null===(i=_)||void 0===i||null===(s=i.attributes)||void 0===s?void 0:s.nickname,receipt_id:Kc(e),received:(new Date).toISOString(),references:Yc(e),sender:m?"me":"them",subject:null===(o=e.querySelector("subject"))||void 0===o?void 0:o.textContent,thread:null===(a=e.querySelector("thread"))||void 0===a?void 0:a.textContent,time:y?Sr()(y.getAttribute("stamp")).toISOString():S,to:e.getAttribute("to"),type:e.getAttribute("type")},Qc(e),Xc(e),Jc(e),Wc(e,d),Vc(e,d),Gc(e,d),$c(e,t));if(x.is_archived){const n=d.getAttribute("from");if(n&&n!==t.bare_jid)return new Uc("Invalid Stanza: Forged MAM message from ".concat(n),e)}return await Tc.emojis.initialize(),x=Object.assign({message:x.body||x.error,is_only_emojis:!!x.body&&Xs.isOnlyEmojis(x.body),is_valid_receipt_request:tl(e,x)},x),x.id=x.origin_id||x["stanza_id ".concat(x.from)]||Xs.getUniqueId(),Tc.hook("parseMessage",e,x)}const{Strophe:wl,$msg:Sl}=zc.env,xl=zc.env.utils;var El=ml.extend({defaults(){return{bookmarked:!1,chat_state:void 0,hidden:xc.isUniView()&&!Tc.settings.get("singleton"),message_type:"chat",nickname:void 0,num_unread:0,time_sent:new Date(0).toISOString(),time_opened:this.get("time_opened")||(new Date).getTime(),type:xc.PRIVATE_CHAT_TYPE,url:""}},async initialize(){this.initialized=xl.getResolveablePromise(),ml.prototype.initialize.apply(this,arguments);const e=this.get("jid");e&&(this.set({box_id:"box-".concat(e)}),this.initNotifications(),this.initMessages(),this.get("type")===xc.PRIVATE_CHAT_TYPE&&(this.presence=xc.presences.findWhere({jid:e})||xc.presences.create({jid:e}),await this.setRosterContact(e)),this.on("change:chat_state",this.sendChatState,this),await this.fetchMessages(),await Tc.trigger("chatBoxInitialized",this,{Synchronous:!0}),this.initialized.resolve())},getMessagesCollection:()=>new xc.Messages,getMessagesCacheKey(){return"converse.messages-".concat(this.get("jid"),"-").concat(xc.bare_jid)},initMessages(){this.messages=this.getMessagesCollection(),this.messages.fetched=xl.getResolveablePromise(),this.messages.fetched.then(()=>{Tc.trigger("afterMessagesFetched",this)}),this.messages.chatbox=this,this.messages.browserStorage=xc.createStore(this.getMessagesCacheKey()),this.listenTo(this.messages,"change:upload",e=>{e.get("upload")===xc.SUCCESS&&Tc.send(this.createMessageStanza(e))})},initNotifications(){this.notifications=new Vs},afterMessagesFetched(){Tc.trigger("afterMessagesFetched",this)},fetchMessages(){if(this.messages.fetched_flag)return void Lr.info("Not re-fetching messages for ".concat(this.get("jid")));this.messages.fetched_flag=!0;const e=this.messages.fetched.resolve;return this.messages.fetch({add:!0,success:()=>{this.afterMessagesFetched(),e()},error:()=>{this.afterMessagesFetched(),e()}}),this.messages.fetched},async handleErrorMessageStanza(e){const{__:t}=xc,n=await yl(e,xc);if(!await this.shouldShowErrorMessage(n))return;const r=this.getMessageReferencedByError(n);if(r){const e={error:n.error,error_condition:n.error_condition,error_text:n.error_text,error_type:n.error_type,editable:!1};n.msgid===r.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.")),r.save(e)}else this.createMessage(n)},queueMessage(e){return this.msg_chain=(this.msg_chain||this.messages.fetched).then(()=>this.onMessage(e)).catch(e=>Lr.error(e)),this.msg_chain},async onMessage(e){if(e=await e,xl.isErrorObject(e))return e.stanza&&Lr.error(e.stanza),Lr.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),xl.shouldCreateMessage(e))){const t=this.handleCorrection(e)||await this.createMessage(e);this.notifications.set({chat_state:null}),this.handleUnreadMessage(t)}},async clearMessages(){try{await this.messages.clearStore()}catch(e){this.messages.trigger("reset"),Lr.error(e)}finally{delete this.msg_chain,delete this.messages.fetched_flag,this.messages.fetched=xl.getResolveablePromise()}},async close(){try{await new Promise((e,t)=>this.destroy({success:e,error:(e,n)=>t(n)}))}catch(e){Lr.error(e)}finally{Tc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()}},announceReconnection(){Tc.trigger("chatReconnected",this)},async onReconnection(){Tc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages(),this.announceReconnection()},validate(e){if(!e.jid)return"Ignored ChatBox without JID";const t=xc.auto_join_rooms.map(e=>y(e)?e.jid:e),n=Tc.settings.get("auto_join_private_chats").concat(t);if(Tc.settings.get("singleton")&&!n.includes(e.jid)&&!Tc.settings.get("auto_join_on_invite")){const t="".concat(e.jid," is not allowed because singleton is true and it's not being auto_joined");return Lr.warn(t),t}},getDisplayName(){return this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("jid")},async createMessageFromError(e){if(e instanceof xc.TimeoutError){(await this.createMessage({type:"error",message:e.message,retry_event_id:e.retry_event_id})).error=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)=>(({is_archived:e})=>({is_archived:e}))(t),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===xc.COMPOSING?this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),xc.TIMEOUTS.PAUSED,xc.PAUSED):e===xc.PAUSED&&(this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),xc.TIMEOUTS.INACTIVE,xc.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.body)return!0},isSameUser:(e,t)=>xl.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(({attributes:t})=>t.retracted_id===e.origin_id&&t.from===e.from&&!t.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(it(e,t)),!0):(e.dangling_retraction=!0,await this.createMessage(e),!0)}{const n=this.findDanglingRetraction(e);if(n){const r=it(n.attributes,t),i=Object.assign({dangling_retraction:!1},e,r);return delete i.id,n.save(i),!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.get("message"):n[t.get("time")]=t.get("message"),delete(e=Object.assign(e,{older_versions:n})).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),n=this.messages.models;return fl(n,e=>t.reduce((t,n)=>t||hl(e.attributes,n),!1))},getOriginIdQueryAttrs:e=>e.origin_id&&{origin_id:e.origin_id,from:e.from},getStanzaIdQueryAttrs:e=>Object.keys(e).filter(e=>e.startsWith("stanza_id ")).map(t=>{const n=t.replace(/^stanza_id /,""),r={};return r["stanza_id ".concat(n)]=e[t],r}),getMessageBodyQueryAttrs(e){if(e.message&&e.msgid){const t={from:e.from,msgid:e.msgid};return e.is_encrypted||(t.message=e.message),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=Sl({id:xl.getUniqueId(),to:this.get("jid"),type:"chat"}).c("store",{xmlns:wl.NS.HINTS}).up().c("apply-to",{id:t,xmlns:wl.NS.FASTEN}).c("retract",{xmlns:wl.NS.RETRACT});return xc.connection.send(n)},sendMarkerForLastMessage(e="displayed",t=!1){const n=Array.from(this.messages.models);n.reverse();const r=n.find(e=>"them"===e.get("sender")&&(t||e.get("is_markable")));r&&this.sendMarkerForMessage(r,e,t)},sendMarkerForMessage(e,t="displayed",n=!1){if(e&&((null==e?void 0:e.get("is_markable"))||n)){Hc(wl.getBareJidFromJid(e.get("from")),e.get("msgid"),t,e.get("type"))}},handleChatMarker(e){if(wl.getBareJidFromJid(e.to)!==xc.bare_jid)return!1;if(e.is_markable)return!this.contact||e.is_archived||e.is_carbon||Hc(e.from,e.msgid,"received"),!1;if(e.marker_id){const t=this.messages.findWhere({msgid:e.marker_id}),n="marker_".concat(e.marker);return t&&!t.get(n)&&t.save({field_name:(new Date).toISOString()}),!0}},sendReceiptStanza(e,t){const n=Sl({from:xc.connection.jid,id:xl.getUniqueId(),to:e,type:"chat"}).c("received",{xmlns:wl.NS.RECEIPTS,id:t}).up().c("store",{xmlns:wl.NS.HINTS}).up();Tc.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},createMessageStanza(e){const t=Sl({from:xc.connection.jid,to:this.get("jid"),type:this.get("message_type"),id:e.get("edited")&&xl.getUniqueId()||e.get("msgid")}).c("body").t(e.get("message")).up().c(xc.ACTIVE,{xmlns:wl.NS.CHATSTATES}).root();return"chat"===e.get("type")&&t.c("request",{xmlns:wl.NS.RECEIPTS}).root(),e.get("is_spoiler")&&(e.get("spoiler_hint")?t.c("spoiler",{xmlns:wl.NS.SPOILER},e.get("spoiler_hint")).root():t.c("spoiler",{xmlns:wl.NS.SPOILER}).root()),(e.get("references")||[]).forEach(e=>{const n={xmlns:wl.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:wl.NS.OUTOFBAND}).c("url").t(e.get("oob_url")).root(),e.get("edited")&&t.c("replace",{xmlns:wl.NS.MESSAGE_CORRECT,id:e.get("msgid")}).root(),e.get("origin_id")&&t.c("origin-id",{xmlns:wl.NS.SID,id:e.get("origin_id")}).root(),t},getOutgoingMessageAttributes(e,t){const n=this.get("composing_spoiler"),r=xl.getUniqueId(),i=e?xl.httpToGeoUri(xl.shortnamesToUnicode(e),xc):void 0;return{from:xc.bare_jid,fullname:xc.xmppstatus.get("fullname"),id:r,is_only_emojis:!!e&&xl.isOnlyEmojis(e),jid:this.get("jid"),message:i,msgid:r,nickname:this.get("nickname"),sender:"me",spoiler_hint:n?t:void 0,time:(new Date).toISOString(),type:this.get("message_type"),body:i,is_spoiler:n,origin_id:r}},setEditable(e,t){if(!e.is_headline&&!xl.isEmptyMessage(e)&&"me"===e.sender)if("all"===Tc.settings.get("allow_message_corrections"))e.editable=!(e.file||e.retracted||"oob_url"in e);else if("last"===Tc.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,Object.assign({wait:!0,promise:!0},t))},async sendMessage(e,t){const n=this.getOutgoingMessageAttributes(e,t);let r=this.messages.findWhere("correcting");if(r){const e=r.get("older_versions")||{};e[r.get("time")]=r.get("message"),r.save({correcting:!1,edited:(new Date).toISOString(),message:n.message,older_versions:e,references:n.references,is_only_emojis:n.is_only_emojis,origin_id:xl.getUniqueId(),received:void 0})}else this.setEditable(n,(new Date).toISOString()),r=await this.createMessage(n);return Tc.send(this.createMessageStanza(r)),Tc.trigger("sendMessage",{chatbox:this,message:r}),r},sendChatState(){if(Tc.settings.get("send_chat_state_notifications")&&this.get("chat_state")){const e=Tc.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;Tc.send(Sl({id:xl.getUniqueId(),to:this.get("jid"),type:"chat"}).c(this.get("chat_state"),{xmlns:wl.NS.CHATSTATES}).up().c("no-store",{xmlns:wl.NS.HINTS}).up().c("no-permanent-store",{xmlns:wl.NS.HINTS}))}},async sendFiles(e){var t;const{__:n}=xc,r=(await Tc.disco.features.get(wl.NS.HTTPUPLOAD,xc.domain)).pop();if(!r)return void this.createMessage({message:n("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0});const i=r.dataforms.where({FORM_TYPE:{value:wl.NS.HTTPUPLOAD,type:"hidden"}}).pop(),s=window.parseInt(null===(t=((null==i?void 0:i.attributes)||{})["max-file-size"])||void 0===t?void 0:t.value),o=null==r?void 0:r.id;o?Array.from(e).forEach(async e=>{if(!window.isNaN(s)&&window.parseInt(e.size)>s)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,vl()(s)),type:"error",is_ephemeral:!0});{const t=Object.assign(this.getOutgoingMessageAttributes(),{file:!0,progress:0,slot_request_url:o});this.setEditable(t,(new Date).toISOString());const n=await this.createMessage(t,{silent:!0});n.file=e,this.messages.trigger("add",n),n.getRequestSlotURL()}}):this.createMessage({message:n("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0})},maybeShow(e){if(e){if(xc.isUniView()){const e=e=>!e.get("hidden")&&e.get("jid")!==this.get("jid")&&"controlbox"!==e.get("id");xc.chatboxes.filter(e).forEach(e=>xl.safeSave(e,{hidden:!0}))}xl.safeSave(this,{hidden:!1})}return xc.isUniView()&&this.get("hidden")?void 0:this.trigger("show")},isHidden(){return xc.isUniView()&&this.get("hidden")||this.isScrolledUp()||"hidden"===xc.windowState},handleUnreadMessage(e){if((null==e?void 0:e.get("body"))&&xl.isNewMessage(e))if(this.isHidden()){const t={num_unread:this.get("num_unread")+1};0===this.get("num_unread")&&(t.first_unread_id=e.get("id")),this.save(t)}else this.sendMarkerForMessage(e)},clearUnreadMsgCounter(){this.get("num_unread")>0&&this.sendMarkerForMessage(this.messages.last()),xl.safeSave(this,{num_unread:0})},isScrolledUp(){return this.get("scrolled",!0)}});const Al=zc.env.utils,{Strophe:Cl}=zc.env;var Tl={defaults:()=>({msgid:Al.getUniqueId(),time:(new Date).toISOString(),is_ephemeral:!1}),async initialize(){this.checkValidity()&&(this.initialized=Al.getResolveablePromise(),"chat"===this.get("type")&&(ml.prototype.initialize.apply(this,arguments),this.setRosterContact(Cl.getBareJidFromJid(this.get("from")))),this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage(),await Tc.trigger("messageInitialized",this,{Synchronous:!0}),this.initialized.resolve())},setTimerForEphemeralMessage(){const e=()=>{this.ephemeral_timer=window.setTimeout(this.safeDestroy.bind(this),1e4)};return this.isEphemeral()?(e(),!0):(this.on("change:is_ephemeral",()=>this.isEphemeral()?e():clearTimeout(this.ephemeral_timer)),!1)},checkValidity(){return 3!==Object.keys(this.attributes).length||(this.validationError="Empty message",this.safeDestroy(),!1)},mayBeRetracted(){return"me"===this.get("sender")&&["all","own"].includes(Tc.settings.get("allow_message_retraction"))},safeDestroy(){try{this.destroy()}catch(e){Lr.error(e)}},isEphemeral(){return this.get("is_ephemeral")},getDisplayName(){return"groupchat"===this.get("type")?this.get("nick"):this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("from")},getMessageText(){const{__:e}=xc;return this.get("is_encrypted")?this.get("plaintext")||this.get("body")||e("Undecryptable OMEMO message"):this.get("message")},isMeCommand(){const e=this.getMessageText();return!!e&&e.startsWith("/me ")},sendSlotRequestStanza(){if(!this.file)return Promise.reject(new Error("file is undefined"));const e=zc.env.$iq({from:xc.jid,to:this.get("slot_request_url"),type:"get"}).c("request",{xmlns:Cl.NS.HTTPUPLOAD,filename:this.file.name,size:this.file.size,"content-type":this.file.type});return Tc.sendIQ(e)},async getRequestSlotURL(){const{__:e}=xc;let t;try{t=await this.sendSlotRequestStanza()}catch(t){return Lr.error(t),this.save({type:"error",message:e("Sorry, could not determine upload URL."),is_ephemeral:!0})}const n=t.querySelector("slot");if(!n)return this.save({type:"error",message:e("Sorry, could not determine file upload URL."),is_ephemeral:!0});this.save({get:n.querySelector("get").getAttribute("url"),put:n.querySelector("put").getAttribute("url")})},uploadFile(){const e=new XMLHttpRequest;e.onreadystatechange=()=>{e.readyState===XMLHttpRequest.DONE&&(Lr.info("Status: "+e.status),200===e.status||201===e.status?this.save({upload:xc.SUCCESS,oob_url:this.get("get"),message:this.get("get")}):e.onerror())},e.upload.addEventListener("progress",e=>{e.lengthComputable&&this.set("progress",e.loaded/e.total)},!1),e.onerror=()=>{const{__:t}=xc;let n;n=e.responseText?t('Sorry, could not succesfully upload your file. Your servers response: "%1$s"',e.responseText):t("Sorry, could not succesfully upload your file."),this.save({type:"error",upload:xc.FAILURE,message:n,is_ephemeral:!0})},e.open("PUT",this.get("put"),!0),e.setRequestHeader("Content-type",this.file.type),e.send(this.file)}},Ol={chats:{async create(e,t){if("string"==typeof e){if(t&&!(null==t?void 0:t.fullname)){var n;const r=await Tc.contacts.get(e);t.fullname=null==r||null===(n=r.attributes)||void 0===n?void 0:n.fullname}const r=Tc.chats.get(e,t,!0);return r||void Lr.error("Could not open chatbox for JID: "+e)}return Array.isArray(e)?Promise.all(e.forEach(async n=>{var r;const i=await Tc.contacts.get(e);return t.fullname=null==i||null===(r=i.attributes)||void 0===r?void 0:r.fullname,Tc.chats.get(n,t,!0).maybeShow()})):(Lr.error("chats.create: You need to provide at least one JID"),null)},async open(e,t,n){if("string"==typeof e){const r=await Tc.chats.get(e,t,!0);return r?r.maybeShow(n):r}if(Array.isArray(e))return Promise.all(e.map(e=>Tc.chats.get(e,t,!0).then(e=>e&&e.maybeShow(n))).filter(e=>e));const r="chats.open: You need to provide at least one JID";throw Lr.error(r),new Error(r)},async get(e,t={},n=!1){async function r(e){let r=await Tc.chatboxes.get(e);return!r&&n?r=await Tc.chatboxes.create(e,t,xc.ChatBox):(r=r&&r.get("type")===xc.PRIVATE_CHAT_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Tc.chatboxes.get()).filter(e=>e.get("type")===xc.PRIVATE_CHAT_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}};
/**
* @module converse-chat
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:jl,sizzle:kl,utils:Nl}=zc.env,Ml=zc.env.utils;zc.plugins.add("converse-chat",{dependencies:["converse-chatboxes","converse-disco"],initialize(){Object.assign(Tc,Ol),Tc.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,send_chat_state_notifications:!0}),xc.Message=ml.extend(Tl),xc.Messages=Fo.extend({model:xc.Message,comparator:"time"}),xc.ChatBox=El,xc.handleMessageStanza=async function(e){if(sl(e)){const t=e.getAttribute("from");return Lr.info("handleMessageStanza: Ignoring incoming server message from JID: ".concat(t))}const t=await yl(e,xc);if(Ml.isErrorObject(t))return t.stanza&&Lr.error(t.stanza),Lr.error(t.message);const n=!!kl('body, encrypted[xmlns="'.concat(jl.NS.OMEMO,'"]'),e).length,r=await Tc.chats.get(t.contact_jid,{nickname:t.nick},n);await(null==r?void 0:r.queueMessage(t));const i={stanza:e,attrs:t,chatbox:r};Tc.trigger("message",i)},xc.router.route("converse/chat?jid=:jid",(function(e){if(!Nl.isValidJID(e))return Lr.warn('Invalid JID "'.concat(e,'" provided in URL fragment'));Tc.chats.open(e)})),Tc.listen.on("chatBoxesFetched",(function(){Tc.settings.get("auto_join_private_chats").forEach(e=>{xc.chatboxes.where({jid:e}).length||("string"==typeof e?Tc.chats.open(e):Lr.error('Invalid jid criteria specified for "auto_join_private_chats"'))}),Tc.trigger("privateChatsAutoJoined")})),Tc.listen.on("presencesInitialized",(function(){xc.connection.addHandler(e=>kl('message > result[xmlns="'.concat(jl.NS.MAM,'"]'),e).pop()?(Lr.warn('Received a MAM message with type "chat".'),!0):(xc.handleMessageStanza(e),!0),null,"message","chat"),xc.connection.addHandler(e=>(null!==e.getAttribute("type")||xc.handleMessageStanza(e),!0),jl.NS.RECEIPTS,"message"),xc.connection.addHandler(e=>(async function(e){const t=jl.getBareJidFromJid(e.getAttribute("from"));if(Nl.isSameBareJID(t,xc.bare_jid))return;const n=await Tc.chatboxes.get(t);null==n||n.handleErrorMessageStanza(e)}(e),!0),null,"message","error")})),Tc.listen.on("clearSession",async()=>{if(xc.shouldClearCache()){await Promise.all(xc.chatboxes.map(e=>e.messages&&e.messages.clearStore({silent:!0})));const e=e=>e.get("type")!==xc.CONTROLBOX_TYPE;xc.chatboxes.clearStore({silent:!0},e)}})}});
/**
* @module converse-disco
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Converse plugin which add support for XEP-0030: Service Discovery
*/
const{Strophe:Il,$iq:Rl,utils:Dl}=zc.env;zc.plugins.add("converse-disco",{initialize(){function e(){if(!xc.stream_features){const e=Il.getBareJidFromJid(xc.jid),t="converse.stream-features-".concat(e);Tc.promises.add("streamFeaturesAdded"),xc.stream_features=new Fo,xc.stream_features.browserStorage=xc.createStore(t,"session")}}function t(){Tc.trigger("streamFeaturesAdded")}Tc.promises.add("discoInitialized"),Tc.promises.add("streamFeaturesAdded"),xc.DiscoEntity=Vs.extend({idAttribute:"jid",initialize(e,t){this.waitUntilFeaturesDiscovered=Dl.getResolveablePromise(),this.dataforms=new Fo;let n="converse.dataforms-".concat(this.get("jid"));this.dataforms.browserStorage=xc.createStore(n,"session"),this.features=new Fo,n="converse.features-".concat(this.get("jid")),this.features.browserStorage=xc.createStore(n,"session"),this.listenTo(this.features,"add",this.onFeatureAdded),this.fields=new Fo,n="converse.fields-".concat(this.get("jid")),this.fields.browserStorage=xc.createStore(n,"session"),this.listenTo(this.fields,"add",this.onFieldAdded),this.identities=new Fo,n="converse.identities-".concat(this.get("jid")),this.identities.browserStorage=xc.createStore(n,"session"),this.fetchFeatures(t),this.items=new xc.DiscoEntities,n="converse.disco-items-".concat(this.get("jid")),this.items.browserStorage=xc.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,Tc.trigger("serviceDiscovered",e)},onFieldAdded(e){e.entity=this,Tc.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 Tc.disco.info(this.get("jid"),null)}catch(e){return null===e?Lr.error("Timeout for disco#info query for ".concat(this.get("jid"))):Lr.error(e),void this.waitUntilFeaturesDiscovered.resolve(this)}this.onInfo(e)},onDiscoItems(e){pi()('query[xmlns="'.concat(Il.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=xc.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 Tc.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")})}),pi()('x[type="result"][xmlns="'.concat(Il.NS.XFORM,'"]'),e).forEach(e=>{const t={};pi()("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="'.concat(Il.NS.DISCO_ITEMS,'"]'))&&this.queryForItems(),Array.from(e.querySelectorAll("feature")).forEach(t=>{this.features.create({var:t.getAttribute("var"),from:e.getAttribute("from")})}),pi()('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")}}),xc.DiscoEntities=Fo.extend({model:xc.DiscoEntity,fetchEntities(){return new Promise((e,t)=>{this.fetch({add:!0,success:e,error(e,n){Lr.error(n),t(new Error("Could not fetch disco entities"))}})})}});const n=this;function r(e){const t=e.getElementsByTagName("query")[0].getAttribute("node"),r={xmlns:Il.NS.DISCO_INFO};t&&(r.node=t);const i=Rl({type:"result",id:e.getAttribute("id")}),s=e.getAttribute("from");return null!==s&&i.attrs({to:s}),i.c("query",r),n._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()}),n._features.forEach(e=>i.c("feature",{var:e}).up()),Tc.send(i.tree()),!0}async function i(){Tc.disco.own.identities.add("client","web","Converse"),Tc.disco.own.features.add(Il.NS.CHATSTATES),Tc.disco.own.features.add(Il.NS.DISCO_INFO),Tc.disco.own.features.add(Il.NS.ROSTERX),Tc.settings.get("message_carbons")&&Tc.disco.own.features.add(Il.NS.CARBONS),Tc.trigger("addClientFeatures"),xc.connection.addHandler(r,Il.NS.DISCO_INFO,"iq","get",null,null),xc.disco_entities=new xc.DiscoEntities;const e="converse.disco-entities-".concat(xc.bare_jid);xc.disco_entities.browserStorage=xc.createStore(e,"session");const t=await xc.disco_entities.fetchEntities();0!==t.length&&t.get(xc.domain)||xc.disco_entities.create({jid:xc.domain}),Tc.trigger("discoInitialized")}n._identities=[],n._features=[],Tc.listen.on("userSessionInitialized",async()=>{e(),xc.connfeedback.get("connection_status")===Il.Status.ATTACHED&&(await new Promise((e,t)=>xc.stream_features.fetch({success:e,error:t})),t())}),Tc.listen.on("beforeResourceBinding",(function(){e(),Array.from(xc.connection.features.childNodes).forEach(e=>{xc.stream_features.create({name:e.nodeName,xmlns:e.getAttribute("xmlns")})}),t()})),Tc.listen.on("reconnected",i),Tc.listen.on("connected",i),Tc.listen.on("beforeTearDown",async()=>{Tc.promises.add("streamFeaturesAdded"),xc.stream_features&&(await xc.stream_features.clearStore(),delete xc.stream_features)}),Tc.listen.on("clearSession",()=>{xc.shouldClearCache()&&xc.disco_entities&&(Array.from(xc.disco_entities.models).forEach(e=>e.features.clearStore()),Array.from(xc.disco_entities.models).forEach(e=>e.identities.clearStore()),Array.from(xc.disco_entities.models).forEach(e=>e.dataforms.clearStore()),Array.from(xc.disco_entities.models).forEach(e=>e.fields.clearStore()),xc.disco_entities.clearStore(),delete xc.disco_entities)}),Object.assign(Tc,{disco:{stream:{async getFeature(e,t){if(await Tc.waitUntil("streamFeaturesAdded"),!e||!t)throw new Error("name and xmlns need to be provided when calling disco.stream.getFeature");if(void 0!==xc.stream_features||Tc.connection.connected())return xc.stream_features.findWhere({name:e,xmlns:t});{const n="Tried to get feature ".concat(e," ").concat(t," but _converse.stream_features has been torn down");Lr.warn(n)}}},own:{identities:{add(e,t,r,i){for(var s=0;s<n._identities.length;s++)if(n._identities[s].category==e&&n._identities[s].type==t&&n._identities[s].name==r&&n._identities[s].lang==i)return!1;n._identities.push({category:e,type:t,name:r,lang:i})},clear(){n._identities=[]},get:()=>n._identities},features:{add(e){for(var t=0;t<n._features.length;t++)if(n._features[t]==e)return!1;n._features.push(e)},clear(){n._features=[]},get:()=>n._features}},info(e,t){const n={xmlns:Il.NS.DISCO_INFO};t&&(n.node=t);const r=Rl({from:xc.connection.jid,to:e,type:"get"}).c("query",n);return Tc.sendIQ(r)},items(e,t){const n={xmlns:Il.NS.DISCO_ITEMS};return t&&(n.node=t),Tc.sendIQ(Rl({from:xc.connection.jid,to:e,type:"get"}).c("query",n))},entities:{async get(e,t=!1){if(await Tc.waitUntil("discoInitialized"),!e)return xc.disco_entities;if(void 0===xc.disco_entities&&!Tc.connection.connected()){const t="Tried to look up entity ".concat(e," but _converse.disco_entities has been torn down");return void Lr.warn(t)}const n=xc.disco_entities.get(e);return n||!t?n:Tc.disco.entities.create(e)},create:(e,t)=>xc.disco_entities.create({jid:e},t)},features:{async get(e,t){if(!t)throw new TypeError("You need to provide an entity JID");await Tc.waitUntil("discoInitialized");let n=await Tc.disco.entities.get(t,!0);if(void 0===xc.disco_entities&&!Tc.connection.connected()){const n="Tried to get feature ".concat(e," for ").concat(t," but _converse.disco_entities has been torn down");return void Lr.warn(n)}n=await n.waitUntilFeaturesDiscovered;const r=[...n.items.map(t=>t.hasFeature(e)),n.hasFeature(e)];return(await Promise.all(r)).filter(y)}},supports:async(e,t)=>(await Tc.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 Tc.waitUntil("discoInitialized");let t=await Tc.disco.entities.get(e);return t?(t.features.reset(),t.fields.reset(),t.identities.reset(),t.waitUntilFeaturesDiscovered.isPending||(t.waitUntilFeaturesDiscovered=Dl.getResolveablePromise()),t.queryInfo()):t=await Tc.disco.entities.create(e,{ignore_cache:!0}),t.waitUntilFeaturesDiscovered},refreshFeatures:e=>Tc.refresh(e),async getFeatures(e){if(!e)throw new TypeError("api.disco.getFeatures: You need to provide an entity JID");await Tc.waitUntil("discoInitialized");let t=await Tc.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 Tc.waitUntil("discoInitialized");let t=await Tc.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.fields},async getIdentity(e,t,n){const r=await Tc.disco.entities.get(n,!0);if(void 0!==r||Tc.connection.connected())return r.getIdentity(e,t);{const t="Tried to look up category ".concat(e," for ").concat(n," but _converse.disco_entities has been torn down");Lr.warn(t)}}}})}});const Ll=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"),zl=/(?:\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;function Pl(){const e=Hl(['<img class="emoji"\n draggable="false"\n title="','"\n alt="','"\n src="','">']);return Pl=function(){return e},e}function Fl(){const e=Hl(['<img class="emoji"\n draggable="false"\n title="','"\n alt="','"\n src="',"/72x72/",'.png"/>']);return Fl=function(){return e},e}function Bl(){const e=Hl(['<span title="','">',"</span>"]);return Bl=function(){return e},e}function Hl(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @module converse-emoji
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const ql=zc.env.utils;zc.emojis={initialized:!1,initialized_promise:ql.getResolveablePromise()};const Ul={"*\\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 Vl(e){if(e.indexOf("-")>-1){const t=[],n=e.split("-");for(let e=0;e<n.length;e++){let r=parseInt(n[e],16);if(r>=65536&&r<=1114111){const e=Math.floor((r-65536)/1024)+55296,t=(r-65536)%1024+56320;r=String.fromCharCode(e)+String.fromCharCode(t)}else r=String.fromCharCode(r);t.push(r)}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 $l(){var e;return zc.emojis.toned||(zc.emojis.toned=(e=Object.values(zc.emojis.json.people).filter(e=>e.sn.includes("_tone")).map(e=>e.sn.replace(/_tone[1-5]/,"")),[...new Set(e)])),zc.emojis.toned}function Gl(e){return e.replace(Ll,(e,t,n,r)=>{if(void 0===r||""===r||!(ql.unescapeHTML(r)in Ul))return e;return r=ql.unescapeHTML(r),n+Vl(Ul[r].toUpperCase())})}function Wl(e,t={unicode_only:!1,add_title_wrapper:!1}){const n=e.emoji,r=e.shortname;if(n){if(t.unicode_only)return n;if(Tc.settings.get("use_system_emojis"))return t.add_title_wrapper&&r?Fa(Bl(),r,n):n;{const t=Tc.settings.get("emoji_image_path");return Fa(Fl(),r,n,t,e.cp)}}return t.unicode_only?r:Fa(Pl(),r,r,zc.emojis.by_sn[r].url)}function Jl(e){if(!zc.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(zc.emojis.shortnames_regex)].filter(e=>e[0].length>0).map(e=>{const t=zc.emojis.by_sn[e[0]].cp;return{cp:t,begin:e.index,end:e.index+e[0].length,shortname:e[0],emoji:t?Vl(t):null}})}function Xl(e){const t=[];return function(e,t){const n=/\uFE0F/g,r=String.fromCharCode(8205);String(e).replace(zl,(e,i,s)=>{const o=function(e){const t=[];let n=0,r=0;for(;r<e.length;){const i=e.charCodeAt(r++);n?(t.push((65536+(n-55296<<10)+(i-56320)).toString(16)),n=0):55296<=i&&i<=56319?n=i:t.push(i.toString(16))}return t.join("-")}(e.indexOf(r)<0?e.replace(n,""):e);o&&t(o,e,s)})}(e,(e,n,r)=>{var i;t.push({begin:r,cp:e,emoji:n,end:r+n.length,shortname:(null===(i=ql.getEmojisByAtrribute("cp")[e])||void 0===i?void 0:i.sn)||""})}),t}zc.plugins.add("converse-emoji",{initialize(){const{___:e}=xc;Tc.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")}}),xc.EmojiPicker=Vs.extend({defaults:{current_category:"smileys",current_skintone:"",scroll_position:0}});const t={};Object.assign(ql,{shortnamesToEmojis:(e,t={unicode_only:!1,add_title_wrapper:!1})=>function(e,t){let n=[e];return[...Jl(e),...Xl(e)].sort((e,t)=>t.begin-e.begin).forEach(e=>{const r=n.shift(),i=Wl(e,t);n="string"==typeof i?[r.slice(0,e.begin)+i+r.slice(e.end),...n]:[r.slice(0,e.begin),i,r.slice(e.end),...n]}),n}(e=Gl(e),t),shortnamesToUnicode:e=>ql.shortnamesToEmojis(e,{unicode_only:!0})[0],isOnlyEmojis(e){const t=e.trim().split(/\s+/);return!(0===t.length||t.length>3)&&t.filter(e=>{const t=Xl(ql.shortnamesToUnicode(e));return 1===t.length&&(e===t[0].shortname||e===t[0].emoji)}).length===t.length},getEmojisByAtrribute(e){if(t[e])return t[e];if("category"===e)return zc.emojis.json;const n=zc.emojis.list.map(t=>t[e]).filter((e,t,n)=>n.indexOf(e)==t);return t[e]={},n.forEach(n=>t[e][n]=zc.emojis.list.find(t=>t[e]===n)),t[e]}}),Object.assign(Tc,{emojis:{async initialize(){if(!zc.emojis.initialized){zc.emojis.initialized=!0;const{default:e}=await n.e(137).then(n.t.bind(null,532,3));zc.emojis.json=e,zc.emojis.by_sn=Object.keys(e).reduce((t,n)=>Object.assign(t,e[n]),{}),zc.emojis.list=Object.values(zc.emojis.by_sn),zc.emojis.list.sort((e,t)=>e.sn<t.sn?-1:e.sn>t.sn?1:0),zc.emojis.shortnames=zc.emojis.list.map(e=>e.sn);const t=()=>zc.emojis.shortnames.map(e=>e.replace(/[+]/g,"\\$&")).join("|");zc.emojis.shortnames_regex=new RegExp(t(),"gi"),zc.emojis.toned=$l(),zc.emojis.initialized_promise.resolve()}return zc.emojis.initialized_promise}}})}});var Ql={initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage()||this.setOccupant(),Tc.trigger("chatRoomMessageInitialized",this))},mayBeModerated(){return["all","moderator"].includes(Tc.settings.get("allow_message_retraction"))&&this.collection.chatbox.canModerateMessages()},checkValidity(){const e=xc.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 Lr.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON())));this.listenTo(t.occupants,"add",this.onOccupantAdded)},onOccupantAdded(e){if(e.get("nick")===gi.e.getResourceFromJid(this.get("from"))){var t;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 Lr.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON())));this.stopListening(n.occupants,"add",this.onOccupantAdded)}},setOccupant(){var e;if("groupchat"!==this.get("type"))return;const t=null==this||null===(e=this.collection)||void 0===e?void 0:e.chatbox;if(!t)return Lr.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON())));const n=gi.e.getResourceFromJid(this.get("from"));if(this.occupant=t.occupants.findWhere({nick:n}),!this.occupant&&Tc.settings.get("muc_send_probes")){this.occupant=t.occupants.create({nick:n,type:"unavailable"});const e="".concat(t.get("jid"),"/").concat(n);Tc.user.presence.send("probe",e)}this.occupant?this.listenTo(this.occupant,"destroy",this.onOccupantRemoved):this.listenTo(t.occupants,"add",this.onOccupantAdded)}};var Yl=function(e,t,n){for(var r=-1,i=e.length,s=t.length,o={};++r<i;){var a=r<s?t[r]:void 0;n(o,e[r],a)}return o};var Kl=function(e,t){return Yl(e||[],t||[],je)},Zl=Math.min;var eu=function(e,t,n){for(var r=n?co:ao,i=e[0].length,s=e.length,o=s,a=Array(s),c=1/0,l=[];o--;){var u=e[o];o&&t&&(u=_e(u,jt(t))),c=Zl(u.length,c),a[o]=!n&&(t||i>=120&&u.length>=120)?new ps(o&&u):void 0}u=e[0];var d=-1,h=a[0];e:for(;++d<i&&l.length<c;){var f=u[d],p=t?t(f):f;if(f=n||0!==f?f:0,!(h?gs(h,p):r(l,p,n))){for(o=s;--o;){var m=a[o];if(!(m?gs(m,p):r(e[o],p,n)))continue e}h&&h.push(p),l.push(f)}}return l};var tu=function(e){return uo(e)?e:[]},nu=lt((function(e){var t=_e(e,tu);return t.length&&t[0]===e[0]?eu(t):[]}));var ru={computeAffiliationsDelta(e,t,n,r){const i=n.map(e=>e.jid),s=r.map(e=>e.jid);let o=ho(i,s).map(e=>n[Eo(i,e)]);return e||(o=o.concat(n.filter(e=>{const t=Eo(s,e.jid);return t>=0&&e.affiliation!==r[t].affiliation}))),t&&(o=o.concat(ho(s,i).map(e=>({jid:e,affiliation:"none"})))),o}};
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Pure functions to help functionally parse messages.
* @todo Other parsing helpers can be made more abstract and placed here.
*/const iu={},su=(e,t)=>e.replace(RegExp("\\"+t,"ig"),"\\"+t);iu.escapeCharacters=e=>t=>e.split("").reduce(su,t),iu.escapeRegexString=iu.escapeCharacters("[\\^$.?*+(){}"),iu.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 ou=([e,t],n,r)=>{let i=e,{begin:s,end:o}=n;const{value:a}=n;return s-=r,o=o-r-1,i="".concat(i.slice(0,s)).concat(a).concat(i.slice(o+1)),[i,[...t,{...n,begin:s,end:o}]]};iu.reduceTextFromReferences=(e,t)=>t.reduce(ou,[e,[]]);var au=iu;
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the form utilities module.
*/Xs.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?Xs.getSelectValues(e):e.value,Xs.toStanza('\n <field var="'.concat(t,'">\n ').concat(n.constructor===Array?n.map(e=>"<value>".concat(e,"</value>")):"<value>".concat(n,"</value>"),"\n </field>"))};var cu=Xs;const{Strophe:lu,sizzle:uu,u:du}=zc.env,{NS:hu}=lu;async function fu(e,t,n){var r,i,s,o,a;const c=nl(e);if(c)return c;const l='[xmlns="'.concat(hu.MAM,'"] > forwarded[xmlns="').concat(hu.FORWARD,'"] > message'),u=e;if(e=uu(l,e).pop()||e,uu('message > forwarded[xmlns="'.concat(lu.NS.FORWARD,'"]'),e).length)return new Uc("Invalid Stanza: Forged MAM groupchat message from ".concat(e.getAttribute("from")),e);const d=uu('delay[xmlns="'.concat(lu.NS.DELAY,'"]'),u).pop(),h=e.getAttribute("from"),f=lu.unescapeNode(lu.getResourceFromJid(h)),p=rl(e),m=(new Date).toISOString();let g=Object.assign({from:h,nick:f,body:null===(r=e.querySelector("body"))||void 0===r||null===(i=r.textContent)||void 0===i?void 0:i.trim(),chat_state:el(e),from_muc:lu.getBareJidFromJid(h),from_real_jid:null===(s=t.occupants.findOccupant({nick:f}))||void 0===s?void 0:s.get("jid"),is_archived:ol(u),is_carbon:Zc(u),is_delayed:!!d,is_headline:il(e),is_markable:!!uu('markable[xmlns="'.concat(lu.NS.MARKERS,'"]'),e).length,is_marker:!!p,is_unstyled:!!uu('unstyled[xmlns="'.concat(lu.NS.STYLING,'"]'),e).length,marker_id:p&&p.getAttribute("id"),msgid:e.getAttribute("id")||u.getAttribute("id"),receipt_id:Kc(e),received:(new Date).toISOString(),references:Yc(e),subject:null===(o=e.querySelector("subject"))||void 0===o?void 0:o.textContent,thread:null===(a=e.querySelector("thread"))||void 0===a?void 0:a.textContent,time:d?Sr()(d.getAttribute("stamp")).toISOString():m,to:e.getAttribute("to"),type:e.getAttribute("type")},Qc(e),Xc(e),Jc(e),Wc(e,u),Vc(e,u),Gc(e,u),function(e){const t=uu('apply-to[xmlns="'.concat(lu.NS.FASTEN,'"]'),e).pop();if(t){const e=t.getAttribute("id"),r=uu('moderated[xmlns="'.concat(lu.NS.MODERATE,'"]'),t).pop();if(r){var n;if(uu('retract[xmlns="'.concat(lu.NS.RETRACT,'"]'),r).pop())return{editable:!1,moderated:"retracted",moderated_by:r.getAttribute("by"),moderated_id:e,moderation_reason:null===(n=r.querySelector("reason"))||void 0===n?void 0:n.textContent}}}else{const t=uu('> moderated[xmlns="'.concat(lu.NS.MODERATE,'"]'),e).pop();if(t){var r;if(uu('retracted[xmlns="'.concat(lu.NS.RETRACT,'"]'),t).pop())return{editable:!1,is_tombstone:!0,moderated_by:t.getAttribute("by"),retracted:t.getAttribute("stamp"),moderation_reason:null===(r=t.querySelector("reason"))||void 0===r?void 0:r.textContent}}}return{}}(e),$c(e,n));return await Tc.emojis.initialize(),g=Object.assign({is_only_emojis:!!g.body&&du.isOnlyEmojis(g.body),is_valid_receipt_request:tl(e,g),message:g.body||g.error,sender:g.nick===t.get("nick")?"me":"them"},g),g.is_archived&&u.getAttribute("from")!==g.from_muc?new Uc("Invalid Stanza: Forged MAM message from ".concat(u.getAttribute("from")),e):g.is_archived&&u.getAttribute("from")!==t.get("jid")?new Uc("Invalid Stanza: Forged MAM groupchat message from ".concat(e.getAttribute("from")),e):g.is_carbon?new Uc("Invalid Stanza: MUC messages SHOULD NOT be XEP-0280 carbon copied",e):(g.id=g.origin_id||g["stanza_id ".concat(g.from_muc||g.from)]||du.getUniqueId(),Tc.hook("parseMUCMessage",e,g))}const pu=["301","303","333","307","321","322"],mu=Vs.extend({defaults:()=>({connection_status:zc.ROOMSTATUS.DISCONNECTED})});var gu={defaults(){return{bookmarked:!1,chat_state:void 0,has_activity:!1,hidden:xc.isUniView()&&!Tc.settings.get("singleton"),hidden_occupants:!!Tc.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:xc.CHATROOMS_TYPE}},async initialize(){this.initialized=cu.getResolveablePromise(),this.debouncedRejoin=yt(this.rejoin,250),this.set("box_id","box-".concat(this.get("jid"))),this.initNotifications(),this.initMessages(),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),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 Tc.trigger("chatRoomInitialized",this,{Synchronous:!0}),this.initialized.resolve()},async restoreFromCache(){return this.session.get("connection_status")===zc.ROOMSTATUS.ENTERED&&await this.isJoined()?(await new Promise(e=>this.features.fetch({success:e,error:e})),await this.fetchOccupants().catch(e=>Lr.error(e)),await this.fetchMessages().catch(e=>Lr.error(e)),!0):(this.clearCache(),!1)},async join(e,t){if(this.session.get("connection_status")===zc.ROOMSTATUS.ENTERED)return this;if(this.session.save("connection_status",zc.ROOMSTATUS.CONNECTING),await this.refreshDiscoInfo(),!(e=await this.getAndPersistNickname(e)))return cu.safeSave(this.session,{connection_status:zc.ROOMSTATUS.NICKNAME_REQUIRED}),Tc.settings.get("muc_show_logs_before_join")&&await this.fetchMessages(),this;const n=Object(gi.d)({from:xc.connection.jid,to:this.getRoomJIDAndNick()}).c("x",{xmlns:gi.e.NS.MUC}).c("history",{maxstanzas:this.features.get("mam_enabled")?0:Tc.settings.get("muc_history_max_stanzas")}).up();return(t=t||this.get("password"))&&n.cnode(gi.e.xmlElement("password",[],t)),Tc.send(n),this},rejoin(){return this.registerHandlers(),this.clearCache(),this.join()},clearCache(){this.session.save("connection_status",zc.ROOMSTATUS.DISCONNECTED),this.occupants.length?this.occupants.filter(e=>!e.isMember()).forEach(e=>e.destroy()):this.occupants.clearStore()},sendMarkerForMessage(e,t="displayed",n=!1){if(e&&((null==e?void 0:e.get("is_markable"))||n)){const n=e.get("stanza_id ".concat(this.get("jid")));if(!n)return void Lr.error("Can't send marker for message without stanza ID: ".concat(e));Hc(gi.e.getBareJidFromJid(e.get("from")),n,t,e.get("type"))}},enableRAI(){if(Tc.settings.get("muc_subscribe_to_rai")){const e=xc.session.get("rai_enabled_domains")||"",t=gi.e.getDomainFromJid(this.get("jid"));e.includes(t)||(Tc.user.presence.send(null,t,null,Object(gi.a)("rai",{xmlns:gi.e.NS.RAI})),xc.session.save({rai_enabled_domains:"".concat(e," ").concat(t)}))}},async onHiddenChange(){const e=this.session.get("connection_status");this.get("hidden")&&e===zc.ROOMSTATUS.ENTERED?Tc.settings.get("muc_subscribe_to_rai")&&"none"!==this.getOwnAffiliation()&&(e!==zc.ROOMSTATUS.DISCONNECTED&&(this.sendMarkerForLastMessage("received",!0),await this.leave()),this.enableRAI()):e===zc.ROOMSTATUS.DISCONNECTED&&this.rejoin()},onOccupantAdded(e){xc.isInfoVisible(zc.MUC_TRAFFIC_STATES.ENTERED)&&this.session.get("connection_status")===zc.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),zc.MUC_TRAFFIC_STATES.ENTERED)},onOccupantRemoved(e){xc.isInfoVisible(zc.MUC_TRAFFIC_STATES.EXITED)&&this.session.get("connection_status")===zc.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),zc.MUC_TRAFFIC_STATES.EXITED)},onOccupantShowChanged(e){e.get("states").includes("303")||("offline"===e.get("show")&&xc.isInfoVisible(zc.MUC_TRAFFIC_STATES.EXITED)?this.updateNotifications(e.get("nick"),zc.MUC_TRAFFIC_STATES.EXITED):"online"===e.get("show")&&xc.isInfoVisible(zc.MUC_TRAFFIC_STATES.ENTERED)&&this.updateNotifications(e.get("nick"),zc.MUC_TRAFFIC_STATES.ENTERED))},async onRoomEntered(){await this.occupants.fetchMembers(),Tc.settings.get("clear_messages_on_reconnection")?(await this.messages.clearStore(),this.messages.fetched.resolve()):await this.fetchMessages(),Tc.trigger("enteredNewRoom",this),Tc.settings.get("auto_register_muc_nickname")&&await Tc.disco.supports(gi.e.NS.MUC_REGISTER,this.get("jid"))&&this.registerNickname()},async onConnectionStatusChanged(){this.session.get("connection_status")===zc.ROOMSTATUS.ENTERED&&(this.get("hidden")&&Tc.settings.get("muc_subscribe_to_rai")&&"none"!==this.getOwnAffiliation()?(await this.leave(),this.enableRAI()):await this.onRoomEntered())},async onReconnection(){await this.rejoin(),this.announceReconnection()},getMessagesCollection:()=>new xc.ChatRoomMessages,restoreSession(){const e="muc.session-".concat(xc.bare_jid,"-").concat(this.get("jid"));return this.session=new mu({id:e}),this.session.browserStorage=xc.createStore(e,"session"),new Promise(e=>this.session.fetch({success:e,error:e}))},initDiscoModels(){let e="converse.muc-features-".concat(xc.bare_jid,"-").concat(this.get("jid"));this.features=new Vs(Object.assign({id:e},Kl(zc.ROOM_FEATURES,zc.ROOM_FEATURES.map(()=>!1)))),this.features.browserStorage=xc.createStore(e,"session"),e="converse.muc-config-{_converse.bare_jid}-".concat(this.get("jid")),this.config=new Vs,this.config.browserStorage=xc.createStore(e,"session")},initOccupants(){this.occupants=new xc.ChatRoomOccupants;const e="converse.occupants-".concat(xc.bare_jid).concat(this.get("jid"));this.occupants.browserStorage=xc.createStore(e,"session"),this.occupants.chatroom=this},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=pi()('x[xmlns="'.concat(gi.e.NS.MUC_USER,'"] item'),e).pop();if(t){const n=e.getAttribute("from"),r=e.getAttribute("type"),i=t.getAttribute("affiliation"),s=t.getAttribute("jid"),o={from:n,type:r,affiliation:i,nick:gi.e.getNodeFromJid(s),states:[],show:"unavailable"==r?"offline":"online",role:t.getAttribute("role"),jid:gi.e.getBareJidFromJid(s),resource:gi.e.getResourceFromJid(s)},a=this.occupants.findOccupant({jid:o.jid});a?a.save(o):this.occupants.create(o)}},async handleErrorMessageStanza(e){const{__:t}=xc,n=await fu(e,this,xc);if(!await this.shouldShowErrorMessage(n))return;const r=this.getMessageReferencedByError(n);if(r){const e={error:n.error,error_condition:n.error_condition,error_text:n.error_text,error_type:n.error_type,editable:!1};n.msgid===r.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."):"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.")),r.save(e)}else this.createMessage(n)},handleMessageFromMUCHost(e){if(this.session.get("connection_status")===zc.ROOMSTATUS.ENTERED)return;const t=pi()('rai[xmlns="'.concat(gi.e.NS.RAI,'"]'),e).pop();Array.from((null==t?void 0:t.querySelectorAll("activity"))||[]).map(e=>e.textContent).includes(this.get("jid"))&&this.save({has_activity:!0,num_unread_general:0})},handleForwardedMentions(e){if(this.session.get("connection_status")===zc.ROOMSTATUS.ENTERED)return;const t=pi()('mentions[xmlns="'.concat(gi.e.NS.MENTIONS,'"] forwarded[xmlns="').concat(gi.e.NS.FORWARD,'"] message[type="groupchat"]'),e),n=this.get("jid"),r=t.filter(e=>gi.e.getBareJidFromJid(e.getAttribute("from"))===n);r.length&&(this.save({has_activity:!0,num_unread:this.get("num_unread")+r.length}),r.forEach(async e=>{const t={stanza:e,attrs:await fu(e,this,xc),chatbox:this};Tc.trigger("message",t)}))},async handleMessageStanza(e){if("groupchat"!==e.getAttribute("type"))return void this.handleForwardedMentions(e);if(ol(e))return Lr.warn('Received a MAM message with type "groupchat"');this.createInfoMessages(e),this.fetchFeaturesIfConfigurationChanged(e);const t=await fu(e,this,xc),n={stanza:e,attrs:t,chatbox:this};return Tc.trigger("message",n),t&&this.queueMessage(t)},registerHandlers(){const e=this.get("jid"),t=gi.e.getDomainFromJid(e);this.removeHandlers(),this.presence_handler=xc.connection.addHandler(e=>this.onPresence(e)||!0,null,"presence",null,null,e,{ignoreNamespaceFragment:!0,matchBareFromJid:!0}),this.domain_presence_handler=xc.connection.addHandler(e=>this.onPresenceFromMUCHost(e)||!0,null,"presence",null,null,t),this.message_handler=xc.connection.addHandler(e=>!!this.handleMessageStanza(e)||!0,null,"message",null,null,e,{matchBareFromJid:!0}),this.domain_message_handler=xc.connection.addHandler(e=>this.handleMessageFromMUCHost(e)||!0,null,"message",null,null,t),this.affiliation_message_handler=xc.connection.addHandler(e=>this.handleAffiliationChangedMessage(e)||!0,gi.e.NS.MUC_USER,"message",null,null,e)},removeHandlers(){return this.message_handler&&(xc.connection&&xc.connection.deleteHandler(this.message_handler),delete this.message_handler),this.domain_message_handler&&(xc.connection&&xc.connection.deleteHandler(this.domain_message_handler),delete this.domain_message_handler),this.presence_handler&&(xc.connection&&xc.connection.deleteHandler(this.presence_handler),delete this.presence_handler),this.domain_presence_handler&&(xc.connection&&xc.connection.deleteHandler(this.domain_presence_handler),delete this.domain_presence_handler),this.affiliation_message_handler&&(xc.connection&&xc.connection.deleteHandler(this.affiliation_message_handler),delete this.affiliation_message_handler),this},invitesAllowed(){return Tc.settings.get("allow_muc_invitations")&&(this.features.get("open")||"owner"===this.getOwnAffiliation())},getDisplayName(){const e=this.get("name");return e||("hidden"===Tc.settings.get("locked_muc_domain")?gi.e.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=cu.getResolveablePromise(),r=xc.connection.addTimedHandler(xc.STANZA_TIMEOUT,()=>(xc.connection.deleteHandler(i),n.reject(new xc.TimeoutError("Timeout Error: No response from server")),!1)),i=xc.connection.addHandler(e=>{r&&xc.connection.deleteTimedHandler(r),"groupchat"===e.getAttribute("type")?n.resolve(e):n.reject(e)},null,"message",["error","groupchat"],t);return Tc.send(e),n},async retractOwnMessage(e){const t=xc.__,n=e.get("origin_id");if(!n)throw new Error("Can't retract message without a XEP-0359 Origin ID");const r=e.get("editable"),i=Object(gi.c)({id:cu.getUniqueId(),to:this.get("jid"),type:"groupchat"}).c("store",{xmlns:gi.e.NS.HINTS}).up().c("apply-to",{id:n,xmlns:gi.e.NS.FASTEN}).c("retract",{xmlns:gi.e.NS.RETRACT});e.set({retracted:(new Date).toISOString(),retracted_id:n,retraction_id:i.nodeTree.getAttribute("id"),editable:!1});try{await this.sendTimedMessage(i)}catch(n){throw e.save({editable:r,error_type:"timeout",error:t("A timeout happened while while trying to retract your message."),retracted:void 0,retracted_id:void 0}),n}},async retractOtherMessage(e,t){const n=e.get("editable");e.save({moderated:"retracted",moderated_by:xc.bare_jid,moderated_id:e.get("msgid"),moderation_reason:t,editable:!1});const r=await this.sendRetractionIQ(e,t);return(null===r||cu.isErrorStanza(r))&&e.save({editable:n,moderated:void 0,moderated_by:void 0,moderated_id:void 0,moderation_reason:void 0}),r},sendRetractionIQ(e,t){const n=Object(gi.b)({to:this.get("jid"),type:"set"}).c("apply-to",{id:e.get("stanza_id ".concat(this.get("jid"))),xmlns:gi.e.NS.FASTEN}).c("moderate",{xmlns:gi.e.NS.MODERATE}).c("retract",{xmlns:gi.e.NS.RETRACT}).up().c("reason").t(t||"");return Tc.sendIQ(n,null,!1)},sendDestroyIQ(e,t){const n=Object(gi.a)("destroy");t&&n.attrs({jid:t});const r=Object(gi.b)({to:this.get("jid"),type:"set"}).c("query",{xmlns:gi.e.NS.MUC_OWNER}).cnode(n.node);return e&&e.length>0&&r.c("reason",e),Tc.sendIQ(r)},async leave(e){var t;this.features.destroy();const n=null===(t=xc.disco_entities)||void 0===t?void 0:t.get(this.get("jid"));n&&await new Promise((e,t)=>n.destroy({success:e,error:t})),Tc.connection.connected()&&Tc.user.presence.send("unavailable",this.getRoomJIDAndNick(),e),cu.safeSave(this.session,{connection_status:zc.ROOMSTATUS.DISCONNECTED})},async close(e){return await this.leave(),this.occupants.clearStore(),"closeAllChatBoxes"!==(null==e?void 0:e.name)&&Tc.settings.get("muc_clear_messages_on_leave")&&this.clearMessages(),await new Promise(e=>this.session.destroy({success:e,error:(t,n)=>{Lr.error(n),e()}})),await new Promise(e=>this.features.destroy({success:e,error:(t,n)=>{Lr.error(n),e()}})),xc.ChatBox.prototype.close.call(this)},canModerateMessages(){const e=this.getOwnOccupant();return e&&e.isModerator()&&Tc.disco.supports(gi.e.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().join("|"),t=au.escapeRegexString(e);return RegExp("(?:\\p{P}|\\p{Z}|^)@(".concat(t,")(?![\\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=au.findFirstMatchInArray(this.getAllKnownNicknames()),n=e=>{const t=this.get("jid"),n=this.getOccupant(e)||this.getOccupant(t),r=this.features.get("nonanonymous")&&(null==n?void 0:n.get("jid"))||"".concat(t,"/").concat(e);return encodeURI("xmpp:".concat(r))},r=this.getAllKnownNicknamesRegex(),i=[...e.matchAll(r)].filter(e=>!e[0].startsWith("/")).map(e=>{let r=e[0].indexOf("@");"@"===e[0][r+1]&&(r+=1);const i=e.index+r,s=i+e[0].length-r,o=t(e[1]);return{begin:i,end:s,value:o,type:"mention",uri:n(o)}}),[s,o]=au.reduceTextFromReferences(e,i);return[s,o]},getOutgoingMessageAttributes(e,t){const n=this.get("composing_spoiler"),[r,i]=this.parseTextForReferences(e),s=cu.getUniqueId(),o=r?cu.httpToGeoUri(cu.shortnamesToUnicode(r),xc):void 0;return{body:o,is_spoiler:n,origin_id:s,references:i,id:s,msgid:s,from:"".concat(this.get("jid"),"/").concat(this.get("nick")),fullname:this.get("nick"),is_only_emojis:!!r&&cu.isOnlyEmojis(r),message:o,nick:this.get("nick"),sender:"me",spoiler_hint:n?t:void 0,type:"groupchat"}},getRoomJIDAndNick(){const e=this.get("nick");return gi.e.getBareJidFromJid(this.get("jid"))+(null!==e?"/".concat(e):"")},sendChatState(){if(!Tc.settings.get("send_chat_state_notifications")||!this.get("chat_state")||this.session.get("connection_status")!==zc.ROOMSTATUS.ENTERED||this.features.get("moderated")&&"visitor"===this.getOwnRole())return;const e=Tc.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;const t=this.get("chat_state");t!==xc.GONE&&Tc.send(Object(gi.c)({to:this.get("jid"),type:"groupchat"}).c(t,{xmlns:gi.e.NS.CHATSTATES}).up().c("no-store",{xmlns:gi.e.NS.HINTS}).up().c("no-permanent-store",{xmlns:gi.e.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 r=Object(gi.c)({from:xc.connection.jid,to:e,id:cu.getUniqueId()}).c("x",n);Tc.send(r),Tc.trigger("roomInviteSent",{room:this,recipient:e,reason:t})},refreshDiscoInfo(){return Tc.disco.refresh(this.get("jid")).then(()=>this.getDiscoInfo()).catch(e=>Lr.error(e))},getDiscoInfo(){return Tc.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=>Lr.error(e))},async getDiscoInfoFields(){const e=(await Tc.disco.getFields(this.get("jid"))).reduce((e,t)=>{const n=t.get("var");return n&&n.startsWith("muc#roominfo_")&&(e[n.replace("muc#roominfo_","")]=t.get("value")),e},{});this.config.save(e)},async getDiscoInfoFeatures(){const e=await Tc.disco.getFeatures(this.get("jid")),t=Object.assign(Kl(zc.ROOM_FEATURES,zc.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===gi.e.NS.MAM&&(t.mam_enabled=!0)}),this.features.save(t)},setAffiliation(e,t){return t=t.filter(t=>void 0===t.affiliation||t.affiliation===e),Promise.all(t.map(t=>this.sendAffiliationIQ(e,t)))},addFieldValue(e){const t=e.getAttribute("type");if("fixed"===t)return e;const n=e.getAttribute("var").replace("muc#roomconfig_",""),r=this.get("roomconfig");if(n in r){let i;switch(t){case"boolean":i=[r[n]?1:0];break;case"list-multi":i=r[n];break;default:i=[r[n]]}e.innerHTML=i.map(e=>Object(gi.a)("value").t(e)).join("")}return e},async autoConfigureChatRoom(){const e=await this.fetchRoomConfiguration(),t=pi()("field",e).map(e=>this.addFieldValue(e));if(t.length)return this.sendConfiguration(t)},fetchRoomConfiguration(){return Tc.sendIQ(Object(gi.b)({to:this.get("jid"),type:"get"}).c("query",{xmlns:gi.e.NS.MUC_OWNER}))},sendConfiguration(e=[]){const t=Object(gi.b)({to:this.get("jid"),type:"set"}).c("query",{xmlns:gi.e.NS.MUC_OWNER}).c("x",{xmlns:gi.e.NS.XFORM,type:"submit"});return e.forEach(e=>t.cnode(e).up()),Tc.sendIQ(t)},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.findWhere({jid:xc.bare_jid})},sendAffiliationIQ(e,t){const n=Object(gi.b)({to:this.get("jid"),type:"set"}).c("query",{xmlns:gi.e.NS.MUC_ADMIN}).c("item",{affiliation:t.affiliation||e,nick:t.nick,jid:t.jid});return void 0!==t.reason&&n.c("reason",t.reason),Tc.sendIQ(n)},setAffiliations(e){const t=[...new Set(e.map(e=>e.affiliation))];return Promise.all(t.map(t=>this.setAffiliation(t,e)))},setRole(e,t,n,r,i){const s=Object(gi.a)("item",{nick:e.get("nick"),role:t}),o=Object(gi.b)({to:this.get("jid"),type:"set"}).c("query",{xmlns:gi.e.NS.MUC_ADMIN}).cnode(s.node);return null!==n&&o.c("reason",n),Tc.sendIQ(o).then(r).catch(i)},getOccupant(e){return cu.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 getAffiliationList(e){const t=Object(gi.b)({to:this.get("jid"),type:"get"}).c("query",{xmlns:gi.e.NS.MUC_ADMIN}).c("item",{affiliation:e}),n=await Tc.sendIQ(t,null,!1);if(null===n){const t="Error: timeout while fetching ".concat(e," list for MUC ").concat(this.get("jid")),r=new Error(t);return Lr.warn(t),Lr.warn(n),r}if(cu.isErrorStanza(n)){const t="Error: not allowed to fetch ".concat(e," list for MUC ").concat(this.get("jid")),r=new Error(t);return Lr.warn(t),Lr.warn(n),r}return function(e){return uu('query[xmlns="'.concat(lu.NS.MUC_ADMIN,'"] item'),e).map(e=>{const t={affiliation:e.getAttribute("affiliation")},n=e.getAttribute("jid");du.isValidJID(n)?t.jid=n:t.nick=n;const r=e.getAttribute("nick");return r&&(t.nick=r),e.getAttribute("role")&&(t.role=r),t})}(n).filter(e=>e).sort((e,t)=>e.nick<t.nick?-1:e.nick>t.nick?1:0)},async updateMemberLists(e){const t=(await Promise.all(["member","admin","owner"].map(e=>this.getAffiliationList(e)))).reduce((e,t)=>cu.isErrorObject(t)?e:[...t,...e],[]);await this.setAffiliations(ru.computeAffiliationsDelta(!0,!1,e,t)),await this.occupants.fetchMembers()},async getAndPersistNickname(e){return(e=e||this.get("nick")||await this.getReservedNick()||xc.getDefaultMUCNickname())&&this.save({nick:e},{silent:!0}),e},async getReservedNick(){const e=Object(gi.b)({to:this.get("jid"),from:xc.connection.jid,type:"get"}).c("query",{xmlns:gi.e.NS.DISCO_INFO,node:"x-roomuser-item"}),t=await Tc.sendIQ(e,null,!1);if(cu.isErrorObject(t))throw t;const n=t.querySelector('query[node="x-roomuser-item"] identity');return n?n.getAttribute("name"):null},async registerNickname(){const e=xc.__,t=this.get("nick"),n=this.get("jid");let r,i;try{r=await Tc.sendIQ(Object(gi.b)({to:n,from:xc.connection.jid,type:"get"}).c("query",{xmlns:gi.e.NS.MUC_REGISTER}))}catch(t){return pi()('not-allowed[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),t).length?i=e("You're not allowed to register yourself in this groupchat."):pi()('registration-required[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),t).length&&(i=e("You're not allowed to register in this groupchat because it's members-only.")),Lr.error(t),i}const s=pi()("field required",r).map(e=>e.parentElement);if(s.length>1&&"muc#register_roomnick"!==s[0].getAttribute("var"))return Lr.error("Can't register the user register in the groupchat ".concat(n," due to the required fields"));try{await Tc.sendIQ(Object(gi.b)({to:n,from:xc.connection.jid,type:"set"}).c("query",{xmlns:gi.e.NS.MUC_REGISTER}).c("x",{xmlns:gi.e.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 pi()('service-unavailable[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),t).length?i=e("Can't register your nickname in this groupchat, it doesn't support registration."):pi()('bad-request[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),t).length&&(i=e("Can't register your nickname in this groupchat, invalid data form supplied.")),Lr.error(i),Lr.error(t),i}},updateOccupantsOnPresence(e){var t,n;const r=function(e){const t=e.getAttribute("from"),n=e.getAttribute("type"),r={from:t,nick:lu.getResourceFromJid(t),type:n,states:[],hats:[],show:"unavailable"!==n?"online":"offline"};return Array.from(e.children).forEach(e=>{if(e.matches("status"))r.status=e.textContent||null;else if(e.matches("show"))r.show=e.textContent||"online";else if(e.matches("x")&&e.getAttribute("xmlns")===lu.NS.MUC_USER)Array.from(e.children).forEach(e=>{"item"===e.nodeName?(r.affiliation=e.getAttribute("affiliation"),r.role=e.getAttribute("role"),r.jid=e.getAttribute("jid"),r.nick=e.getAttribute("nick")||r.nick):"status"==e.nodeName&&e.getAttribute("code")&&r.states.push(e.getAttribute("code"))});else if(e.matches("x")&&e.getAttribute("xmlns")===lu.NS.VCARDUPDATE){var t;r.image_hash=null===(t=e.querySelector("photo"))||void 0===t?void 0:t.textContent}else e.matches("hats")&&e.getAttribute("xmlns")===lu.NS.MUC_HATS&&(r.hats=Array.from(e.children).map(e=>e.matches("hat")&&{title:e.getAttribute("title"),uri:e.getAttribute("uri")}))}),r}(e);if("error"===r.type||!r.jid&&!r.nick)return!0;const i=this.occupants.findOccupant(r);if("unavailable"===r.type&&i&&!r.states.includes(zc.MUC_NICK_CHANGED_CODE)&&!["admin","owner","member"].includes(r.affiliation))return i.set(r),void i.destroy();const s=r.jid||"",o=Object.assign(r,{jid:gi.e.getBareJidFromJid(s)||(null==i||null===(t=i.attributes)||void 0===t?void 0:t.jid),resource:gi.e.getResourceFromJid(s)||(null==i||null===(n=i.attributes)||void 0===n?void 0:n.resource)});i?i.save(o):this.occupants.create(o)},fetchFeaturesIfConfigurationChanged(e){const t=["104","170","171","172","173","174"];pi()("status",e).filter(e=>t.includes(e.getAttribute("status"))).length&&this.refreshDiscoInfo()},isSameUser(e,t){const n=gi.e.getBareJidFromJid(e),r=gi.e.getBareJidFromJid(t),i=gi.e.getResourceFromJid(e),s=gi.e.getResourceFromJid(t);if(cu.isSameBareJID(e,t))return n!==this.get("jid")||i===s;return(n===this.get("jid")?this.occupants.findOccupant({nick:i}):this.occupants.findOccupant({jid:n}))===(r===this.get("jid")?this.occupants.findOccupant({nick:s}):this.occupants.findOccupant({jid:r}))},async isSubjectHidden(){return(await Tc.user.settings.get("mucs_with_hidden_subject",[])).includes(this.get("jid"))},async toggleSubjectHiddenState(){const e=this.get("jid"),t=await Tc.user.settings.get("mucs_with_hidden_subject",[]);t.includes(this.get("jid"))?Tc.user.settings.set("mucs_with_hidden_subject",t.filter(t=>t!==e)):Tc.user.settings.set("mucs_with_hidden_subject",[...t,e])},async handleSubjectChange(e){const t=xc.__;if("string"==typeof e.subject&&!e.thread&&!e.message){const n=e.subject,r=e.nick;if(cu.safeSave(this,{subject:{author:r,text:e.subject||""}}),!e.is_delayed&&r){const i=t(n?"Topic set by %1$s":"Topic cleared by %1$s",r),s=this.messages.last();(null==s?void 0:s.get("nick"))===e.nick&&"info"===(null==s?void 0:s.get("type"))&&(null==s?void 0:s.get("message"))===i||this.createMessage({message:i,nick:e.nick,type:"info"}),await this.isSubjectHidden()&&this.toggleSubjectHiddenState()}return!0}return!1},setSubject(e=""){Tc.send(Object(gi.c)({to:this.get("jid"),from:xc.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=Ir(e)?e.getAttribute("from"):e instanceof xc.Message?e.get("from"):e.from,gi.e.getResourceFromJid(t)==this.get("nick")},getUpdatedMessageAttributes(e,t){const n=xc.ChatBox.prototype.getUpdatedMessageAttributes.call(this,e,t);if(this.isOwnMessage(t)){const r=Object.keys(t).filter(e=>e.startsWith("stanza_id"));Object.assign(n,it(t,r)),e.get("received")||(n.received=(new Date).toISOString())}return n},async isJoined(){const e=this.get("jid"),t=Object(gi.b)({to:"".concat(e,"/").concat(this.get("nick")),type:"get"}).c("ping",{xmlns:gi.e.NS.PING});try{await Tc.sendIQ(t)}catch(t){return null===t?Lr.warn("isJoined: Timeout error while checking whether we're joined to MUC: ".concat(e)):Lr.warn("isJoined: Apparently we're no longer connected to MUC: ".concat(e)),!1}return!0},async rejoinIfNecessary(){if(!await this.isJoined())return this.rejoin(),!0},async shouldShowErrorMessage(e){return("not-acceptable"!==e.error_condition||!await this.rejoinIfNecessary())&&xc.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 ".concat(this.get("jid"))];return n?(t.reverse(),t.find(({attributes:e})=>"retracted"===e.moderated&&e.moderated_id===n&&e.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 ".concat(this.get("jid"))]=e.moderated_id;const r=this.messages.findWhere(n);return r?(r.save(it(e,t)),!0):(e.dangling_moderation=!0,await this.createMessage(e),!0)}{const n=this.findDanglingModeration(e);if(n){const r=it(n.attributes,t),i=Object.assign({dangling_moderation:!1},e,r);return delete i.id,n.save(i),!0}}return!1},removeNotification(e,t){const n=this.notifications.toJSON();(t=Array.isArray(t)?t:[t]).forEach(t=>{const r=Array.from(n[t]||[]);if(r.includes(e)){const n=r.indexOf(e);r.splice(n,1),this.notifications.set(t,Array.from(r))}})},updateNotifications(e,t){const n=this.notifications.toJSON(),r=n[t]||[];if(r.includes(e))return;const i=(i,s)=>(i[s]=s===t?[...r,e]:(n[s]||[]).filter(t=>t!==e),i),s=zc.CHAT_STATES.reduce(i,{}),o=zc.MUC_TRAFFIC_STATES_LIST.reduce(i,{}),a=zc.MUC_ROLE_CHANGES_LIST.reduce(i,{});this.notifications.set(Object.assign(s,o,a)),window.setTimeout(()=>this.removeNotification(e,t),1e4)},async onMessage(e){if(e=await e,cu.isErrorObject(e))return e.stanza&&Lr.error(e.stanza),Lr.error(e.message);const t=this.getDuplicateMessage(e);if(t)return this.updateMessage(t,e);if(!(e.is_valid_receipt_request||e.is_marker||this.ignorableCSN(e))){if(await this.handleRetraction(e)||await this.handleModeration(e)||await this.handleSubjectChange(e))return this.removeNotification(e.nick,["composing","paused"]);if(this.setEditable(e,e.time),e.chat_state&&this.updateNotifications(e.nick,e.chat_state),cu.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")===zc.ROOMSTATUS.CONNECTING)this.setDisconnectionMessage(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']"),r=pi()('x[xmlns="'.concat(gi.e.NS.MUC_USER,'"]'),e).pop();if(!r)return;const i=pi()("status",r).map(e=>e.getAttribute("code")),s=nu(i,Object.keys(xc.muc.disconnect_messages));if(!(n&&s.length>0))return;const o=r.querySelector("item"),a=o?null===(t=o.querySelector("reason"))||void 0===t?void 0:t.textContent:void 0,c=o?ut(o.querySelector("actor"),"getAttribute","nick"):void 0,l=xc.muc.disconnect_messages[s[0]];this.setDisconnectionMessage(l,a,c)},getActionInfoMessage(e,t,n){const r=xc.__;return"301"===e?n?r("%1$s has been banned by %2$s",t,n):r("%1$s has been banned",t):"303"===e?r("%1$s's nickname has changed",t):"307"===e?n?r("%1$s has been kicked out by %2$s",t,n):r("%1$s has been kicked out",t):"321"===e?r("%1$s has been removed because of an affiliation change",t):"322"===e?r("%1$s has been removed for not being a member",t):void 0},createAffiliationChangeMessage(e){const t=xc.__,n=e._previousAttributes.affiliation;if(!n)return;const r=e.get("affiliation");"admin"===n&&xc.isInfoVisible(zc.AFFILIATION_CHANGES.EXADMIN)?this.createMessage({type:"info",message:t("%1$s is no longer an admin of this groupchat",e.get("nick"))}):"owner"===n&&xc.isInfoVisible(zc.AFFILIATION_CHANGES.EXOWNER)?this.createMessage({type:"info",message:t("%1$s is no longer an owner of this groupchat",e.get("nick"))}):"outcast"===n&&xc.isInfoVisible(zc.AFFILIATION_CHANGES.EXOUTCAST)&&this.createMessage({type:"info",message:t("%1$s is no longer banned from this groupchat",e.get("nick"))}),"none"===r&&"member"===n&&xc.isInfoVisible(zc.AFFILIATION_CHANGES.EXMEMBER)&&this.createMessage({type:"info",message:t("%1$s is no longer a member of this groupchat",e.get("nick"))}),"member"===r&&xc.isInfoVisible(zc.AFFILIATION_CHANGES.MEMBER)?this.createMessage({type:"info",message:t("%1$s is now a member of this groupchat",e.get("nick"))}):("admin"===r&&xc.isInfoVisible(zc.AFFILIATION_CHANGES.ADMIN)||"owner"==r&&xc.isInfoVisible(zc.AFFILIATION_CHANGES.OWNER))&&this.createMessage({type:"info",message:t("%1$s is now an %2$s of this groupchat",e.get("nick"),r)})},createRoleChangeMessage(e,t){if("none"===t||e.changed.affiliation)return;const n=e._previousAttributes.role;"moderator"===n&&xc.isInfoVisible(zc.MUC_ROLE_CHANGES.DEOP)?this.updateNotifications(e.get("nick"),zc.MUC_ROLE_CHANGES.DEOP):"visitor"===n&&xc.isInfoVisible(zc.MUC_ROLE_CHANGES.VOICE)&&this.updateNotifications(e.get("nick"),zc.MUC_ROLE_CHANGES.VOICE),"visitor"===e.get("role")&&xc.isInfoVisible(zc.MUC_ROLE_CHANGES.MUTE)?this.updateNotifications(e.get("nick"),zc.MUC_ROLE_CHANGES.MUTE):"moderator"===e.get("role")&&!["owner","admin"].includes(e.get("affiliation"))&&xc.isInfoVisible(zc.MUC_ROLE_CHANGES.OP)&&this.updateNotifications(e.get("nick"),zc.MUC_ROLE_CHANGES.OP)},createInfoMessage(e,t,n){const r=xc.__,i={type:"info"};if(xc.isInfoVisible(e)&&"110"!==e&&("100"!==e||n)){if(e in xc.muc.info_messages)i.message=xc.muc.info_messages[e];else if(!n&&pu.includes(e)){var s,o;const n=gi.e.getResourceFromJid(t.getAttribute("from")),r=t.querySelector('x[xmlns="'.concat(gi.e.NS.MUC_USER,'"] item'));i.actor=r?null===(s=r.querySelector("actor"))||void 0===s?void 0:s.getAttribute("nick"):void 0,i.reason=r?null===(o=r.querySelector("reason"))||void 0===o?void 0:o.textContent:void 0,i.message=this.getActionInfoMessage(e,n,i.actor)}else if(n&&e in xc.muc.new_nickname_messages){let s;n&&"210"===e?s=gi.e.getResourceFromJid(t.getAttribute("from")):n&&"303"===e&&(s=t.querySelector('x[xmlns="'.concat(gi.e.NS.MUC_USER,'"] item')).getAttribute("nick")),this.save("nick",s),i.message=r(xc.muc.new_nickname_messages[e],s)}if(i.message){if("201"===e&&this.messages.findWhere(i))return;if(e in xc.muc.info_messages&&this.messages.length&&this.messages.pop().get("message")===i.message)return;this.createMessage(i)}}},createInfoMessages(e){const t=pi()('x[xmlns="'.concat(gi.e.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))},setDisconnectionMessage(e,t,n){this.save({disconnection_message:e,disconnection_reason:t,disconnection_actor:n}),this.session.save({connection_status:zc.ROOMSTATUS.DISCONNECTED})},onNicknameClash(e){const t=xc.__;if(Tc.settings.get("muc_nickname_from_jid")){const t=e.getAttribute("from").split("/")[1];if(t===xc.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:zc.ROOMSTATUS.NICKNAME_REQUIRED})},onErrorPresence(e){var t;const n=xc.__,r=e.querySelector("error"),i=r.getAttribute("type"),s=null===(t=pi()('text[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),r).pop())||void 0===t?void 0:t.textContent;if("modify"===i)this.handleModifyError(e);else if("auth"===i){if(pi()('not-authorized[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),r).length&&(this.save({password_validation_message:s||n("Password incorrect")}),this.session.save({connection_status:zc.ROOMSTATUS.PASSWORD_REQUIRED})),r.querySelector("registration-required")){const e=n("You are not on the member list of this groupchat.");this.setDisconnectionMessage(e,s)}else if(r.querySelector("forbidden")){const e=n("You have been banned from this groupchat.");this.setDisconnectionMessage(e,s)}}else if("cancel"===i)if(r.querySelector("not-allowed")){const e=n("You are not allowed to create new groupchats.");this.setDisconnectionMessage(e,s)}else if(r.querySelector("not-acceptable")){const e=n("Your nickname doesn't conform to this groupchat's policies.");this.setDisconnectionMessage(e,s)}else if(pi()('gone[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),r).length){var o;const e=null===(o=pi()('gone[xmlns="'.concat(gi.e.NS.STANZAS,'"]'),r).pop())||void 0===o?void 0:o.textContent.replace(/^xmpp:/,"").replace(/\?join$/,"");this.save({moved_jid:e,destroyed_reason:s}),this.session.save({connection_status:zc.ROOMSTATUS.DESTROYED})}else if(r.querySelector("conflict"))this.onNicknameClash(e);else if(r.querySelector("item-not-found")){const e=n("This groupchat does not (yet) exist.");this.setDisconnectionMessage(e,s)}else if(r.querySelector("service-unavailable")){const e=n("This groupchat has reached its maximum number of participants.");this.setDisconnectionMessage(e,s)}else if(r.querySelector("remote-server-not-found")){const e=n("Remote server not found"),t=s?n('The explanation given is: "%1$s".',s):void 0;this.setDisconnectionMessage(e,t)}},onPresenceFromMUCHost(e){if("error"===e.getAttribute("type")){const t=e.querySelector("error");if("wait"===(null==t?void 0:t.getAttribute("type"))&&(null==t?void 0:t.querySelector("resource-constraint"))){const e=xc.session.get("rai_enabled_domains")||"",t=gi.e.getDomainFromJid(this.get("jid"));if(e.includes(t)){const n=new RegExp(t,"g");xc.session.save({rai_enabled_domains:e.replace(n,"")}),this.session.get("connection_status")===zc.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")===zc.ROOMSTATUS.CONNECTING&&this.session.save("connection_status",zc.ROOMSTATUS.CONNECTED)):this.updateOccupantsOnPresence(e)},onOwnPresence(e){if("unavailable"!==e.getAttribute("type")){const t=this.session.get("connection_status");t!==zc.ROOMSTATUS.ENTERED?(this.session.save("connection_status",zc.ROOMSTATUS.ENTERED,{silent:!0}),this.updateOccupantsOnPresence(e),this.session.trigger("change:connection_status",this.session,t)):this.updateOccupantsOnPresence(e)}else this.updateOccupantsOnPresence(e);if("unavailable"!==e.getAttribute("type")){if(e.querySelector("status[code='201']"))if(this.get("auto_configure"))this.autoConfigureChatRoom().then(()=>this.refreshDiscoInfo());else{if(!Tc.settings.get("muc_instant_rooms"))return void this.trigger("configurationNeeded");this.sendConfiguration().then(()=>this.refreshDiscoInfo())}else this.features.get("fetched")||("owner"===this.getOwnAffiliation()&&this.get("auto_configure")?this.autoConfigureChatRoom().then(()=>this.refreshDiscoInfo()):this.getDiscoInfo());this.session.save({connection_status:zc.ROOMSTATUS.ENTERED})}else this.handleDisconnection(e)},isUserMentioned(e){const t=this.get("nick");if(e.get("references").length){return e.get("references").filter(e=>"mention"===e.type).map(e=>e.value).includes(t)}return new RegExp("\\b".concat(t,"\\b")).test(e.get("message"))},handleUnreadMessage(e){if((null==e?void 0:e.get("body"))&&cu.isNewMessage(e))if(this.isHidden()){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)}else this.sendMarkerForMessage(e)},clearUnreadMsgCounter(){(this.get("num_unread_general")>0||this.get("num_unread")>0||this.get("has_activity"))&&this.sendMarkerForMessage(this.messages.last()),cu.safeSave(this,{has_activity:!1,num_unread:0,num_unread_general:0})}};var vu=Vs.extend({defaults:{hats:[],show:"offline",states:[]},initialize(e){this.set(Object.assign({id:cu.getUniqueId()},e)),this.on("change:image_hash",this.onAvatarChanged,this)},onAvatarChanged(){const e=this.get("image_hash"),t=[];this.get("jid")&&t.push(xc.vcards.findWhere({jid:this.get("jid")})),t.push(xc.vcards.findWhere({jid:this.get("from")})),t.filter(e=>e).forEach(t=>{e&&t.get("image_hash")!==e&&Tc.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")}});const _u={moderator:1,participant:2,visitor:3,none:2};var bu=Fo.extend({model:vu,comparator(e,t){const n=e.get("role")||"none",r=t.get("role")||"none";if(_u[n]===_u[r]){const n=e.getDisplayName().toLowerCase(),r=t.getDisplayName().toLowerCase();return n<r?-1:n>r?1:0}return _u[n]<_u[r]?-1:1},getAutoFetchedAffiliationLists(){const e=Tc.settings.get("muc_fetch_members");return Array.isArray(e)?e:e?["member","admin","owner"]:[]},async fetchMembers(){const e=this.getAutoFetchedAffiliationLists();if(0===e.length)return;const t=await Promise.all(e.map(e=>this.chatroom.getAffiliationList(e))),n=t.reduce((e,t)=>cu.isErrorObject(t)?e:[...t,...e],[]),r=e.filter(n=>!cu.isErrorObject(t[e.indexOf(n)])),i=n.map(e=>e.jid).filter(e=>void 0!==e),s=n.map(e=>!e.jid&&e.nick||void 0).filter(e=>void 0!==e);this.filter(e=>r.includes(e.get("affiliation"))&&!s.includes(e.get("nick"))&&!i.includes(e.get("jid"))).forEach(e=>{e.get("jid")!==xc.bare_jid&&("offline"===e.get("show")?e.destroy():e.save("affiliation",null))}),n.forEach(e=>{const t=e.jid?this.findOccupant({jid:e.jid}):this.findOccupant({nick:e.nick});t?t.save(e):this.create(e)}),Tc.trigger("membersFetched")},findOccupant(e){const t=gi.e.getBareJidFromJid(e.jid);return t&&this.findWhere({jid:t})||this.findWhere({nick:e.nick})}}),yu={rooms:{create(e,t={}){if(!(t="string"==typeof t?{nick:t}:t||{}).nick&&Tc.settings.get("muc_nickname_from_jid")&&(t.nick=gi.e.getNodeFromJid(xc.bare_jid)),void 0===e)throw new TypeError("rooms.create: You need to provide at least one JID");return"string"==typeof e?Tc.rooms.get(cu.getJIDFromURI(e),t,!0):e.map(e=>Tc.rooms.get(cu.getJIDFromURI(e),t,!0))},async open(e,t={},n=!1){if(await Tc.waitUntil("chatBoxesFetched"),void 0===e){const e="rooms.open: You need to provide at least one JID";throw Lr.error(e),new TypeError(e)}if("string"==typeof e){const r=await Tc.rooms.get(e,t,!0);return r&&r.maybeShow(n),r}{const r=await Promise.all(e.map(e=>Tc.rooms.get(e,t,!0)));return r.forEach(e=>e.maybeShow(n)),r}},async get(e,t={},n=!1){async function r(e){e=cu.getJIDFromURI(e);let r=await Tc.chatboxes.get(e);return!r&&n?r=await Tc.chatboxes.create(e,t,xc.ChatRoom):(r=r&&r.get("type")===xc.CHATROOMS_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Tc.chatboxes.get()).filter(e=>e.get("type")===xc.CHATROOMS_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}};
/**
* @module converse-muc
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Implements the non-view logic for XEP-0045 Multi-User Chat
*/
const wu=["moderator","participant","visitor"],Su=["owner","admin","member","outcast","none"];zc.AFFILIATION_CHANGES={OWNER:"owner",ADMIN:"admin",MEMBER:"member",EXADMIN:"exadmin",EXOWNER:"exowner",EXOUTCAST:"exoutcast",EXMEMBER:"exmember"},zc.AFFILIATION_CHANGES_LIST=Object.values(zc.AFFILIATION_CHANGES),zc.MUC_TRAFFIC_STATES={ENTERED:"entered",EXITED:"exited"},zc.MUC_TRAFFIC_STATES_LIST=Object.values(zc.MUC_TRAFFIC_STATES),zc.MUC_ROLE_CHANGES={OP:"op",DEOP:"deop",VOICE:"voice",MUTE:"mute"},zc.MUC_ROLE_CHANGES_LIST=Object.values(zc.MUC_ROLE_CHANGES),zc.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"],disconnect_messages:["301","307","321","322","332","333"],affiliation_changes:[...zc.AFFILIATION_CHANGES_LIST],join_leave_events:[...zc.MUC_TRAFFIC_STATES_LIST],role_changes:[...zc.MUC_ROLE_CHANGES_LIST]};const{Strophe:xu,sizzle:Eu}=zc.env;function Au(){xc.connection.addHandler(e=>(xc.onDirectMUCInvitation(e),!0),"jabber:x:conference","message")}function Cu(){return xc.chatboxes.filter(e=>e.get("type")===xc.CHATROOMS_TYPE).forEach(e=>e.session.save({connection_status:zc.ROOMSTATUS.DISCONNECTED}))}async function Tu(e){if("visible"===e.state&&Tc.connection.connected()){(await Tc.rooms.get()).forEach(e=>e.rejoinIfNecessary())}}async function Ou(e){if(!cu.isValidMUCJID(e))return Lr.warn('invalid jid "'.concat(e,'" provided in url fragment'));await Tc.waitUntil("roomsAutoJoined"),Tc.settings.get("allow_bookmarks")&&await Tc.waitUntil("bookmarksInitialized"),Tc.rooms.open(e)}async function ju(){await Promise.all(Tc.settings.get("auto_join_rooms").map(e=>"string"==typeof e?xc.chatboxes.where({jid:e}).length?Promise.resolve():Tc.rooms.open(e):y(e)?Tc.rooms.open(e.jid,{...e}):(Lr.error('Invalid muc criteria specified for "auto_join_rooms"'),Promise.resolve()))),Tc.trigger("roomsAutoJoined")}xu.addNamespace("MUC_ADMIN",xu.NS.MUC+"#admin"),xu.addNamespace("MUC_OWNER",xu.NS.MUC+"#owner"),xu.addNamespace("MUC_REGISTER","jabber:iq:register"),xu.addNamespace("MUC_ROOMCONF",xu.NS.MUC+"#roomconfig"),xu.addNamespace("MUC_USER",xu.NS.MUC+"#user"),xu.addNamespace("MUC_HATS","xmpp:prosody.im/protocol/hats:1"),zc.MUC_NICK_CHANGED_CODE="303",zc.ROOM_FEATURES=["passwordprotected","unsecured","hidden","publicroom","membersonly","open","persistent","temporary","nonanonymous","semianonymous","moderated","unmoderated","mam_enabled"],zc.ROOMSTATUS={CONNECTED:0,CONNECTING:1,NICKNAME_REQUIRED:2,PASSWORD_REQUIRED:3,DISCONNECTED:4,ENTERED:5,DESTROYED:6},zc.plugins.add("converse-muc",{dependencies:["converse-chatboxes","converse-chat","converse-disco","converse-controlbox"],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}=xc;if(Tc.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,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:[...zc.MUC_INFO_CODES.visibility_changes,...zc.MUC_INFO_CODES.self,...zc.MUC_INFO_CODES.non_privacy_changes,...zc.MUC_INFO_CODES.muc_logging_changes,...zc.MUC_INFO_CODES.nickname_changes,...zc.MUC_INFO_CODES.disconnect_messages,...zc.MUC_INFO_CODES.affiliation_changes,...zc.MUC_INFO_CODES.join_leave_events,...zc.MUC_INFO_CODES.role_changes],muc_show_logs_before_join:!1,muc_subscribe_to_rai:!1}),Tc.promises.add(["roomsAutoJoined"]),Tc.settings.get("locked_muc_domain")&&"string"!=typeof Tc.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");zc.env.muc_utils=ru,Object.assign(Tc,yu),xc.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")}},xc.isInfoVisible=function(e){return!!Tc.settings.get("muc_show_info_messages").includes(e)},xc.router.route("converse/room?jid=:jid",Ou),xc.ChatRoom=xc.ChatBox.extend(gu),xc.ChatRoomMessage=xc.Message.extend(Ql),xc.ChatRoomOccupants=bu,xc.ChatRoomOccupant=vu,xc.getDefaultMUCNickname=function(){if(!xc.xmppstatus)throw new Error("Can't call _converse.getDefaultMUCNickname before the statusInitialized has been fired.");const e=xc.xmppstatus.getNickname();return e||(Tc.settings.get("muc_nickname_from_jid")?xu.unescapeNode(xu.getNodeFromJid(xc.bare_jid)):void 0)},xc.ChatRoomMessages=Fo.extend({model:xc.ChatRoomMessage,comparator:"time"}),xc.RoomsPanelModel=Vs.extend({defaults:function(){return{muc_domain:Tc.settings.get("muc_domain"),nick:xc.getDefaultMUCNickname()}},setDomain(e){Tc.settings.get("locked_muc_domain")||this.save("muc_domain",xu.getDomainFromJid(e))}}),xc.onDirectMUCInvitation=async function(t){const n=Eu('x[xmlns="jabber:x:conference"]',t).pop(),r=xu.getBareJidFromJid(t.getAttribute("from")),i=n.getAttribute("jid"),s=n.getAttribute("reason");let o;if(Tc.settings.get("auto_join_on_invite"))o=!0;else{let t=xc.roster.get(r);t=t?t.getDisplayName():r,o=s?confirm(e('%1$s has invited you to join a groupchat: %2$s, and left the following reason: "%3$s"',t,i,s)):confirm(e("%1$s has invited you to join a groupchat: %2$s",t,i))}if(!0===o){(await async function(e,t){t.type=xc.CHATROOMS_TYPE,t.id=e;const n=await Tc.rooms.get(e,t,!0);return n.maybeShow(!0),n}(i,{password:n.getAttribute("password")})).session.get("connection_status")===zc.ROOMSTATUS.DISCONNECTED&&xc.chatboxes.get(i).rejoin()}},Tc.settings.get("allow_muc_invitations")&&(Tc.listen.on("connected",Au),Tc.listen.on("reconnected",Au)),Tc.listen.on("reconnected",()=>xc.session.save("rai_enabled_domains","")),Tc.listen.on("beforeTearDown",()=>{xc.chatboxes.where({type:xc.CHATROOMS_TYPE}).forEach(e=>cu.safeSave(e.session,{connection_status:zc.ROOMSTATUS.DISCONNECTED}))}),Tc.listen.on("windowStateChanged",Tu),Tc.listen.on("addClientFeatures",()=>{Tc.settings.get("allow_muc")&&Tc.disco.own.features.add(xu.NS.MUC),Tc.settings.get("allow_muc_invitations")&&Tc.disco.own.features.add("jabber:x:conference")}),Tc.listen.on("chatBoxesFetched",ju),Tc.listen.on("beforeResourceBinding",()=>{xc.connection.addHandler(e=>{const t=xu.getBareJidFromJid(e.getAttribute("from"));return xc.chatboxes.get(t)||Tc.waitUntil("chatBoxesFetched").then(async()=>{const n=xc.chatboxes.get(t);n&&(await n.initialized,n.message_handler.run(e))}),!0},null,"message","groupchat")}),Tc.listen.on("disconnected",Cu),Tc.listen.on("statusInitialized",()=>{window.addEventListener(xc.unloadevent,()=>{!Tc.connection.isType("websocket")||Tc.settings.get("enable_smacks")&&xc.session.get("smacks_stream_id")||Cu()})})}});const{Strophe:ku}=zc.env;var Nu=Vs.extend({idAttribute:"jid",getDisplayName(){return ku.xmlunescape(this.get("name"))}}),Mu=n(61),Iu=n.n(Mu);function Ru(e,t){return"string"==typeof e&&t.includes(e)}function Du(e,t){return"string"!=typeof e||"en"!==e&&!t(e)?
/**
* @module i18n
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the internationalization module
*/
function(e){var t,n;if(window.navigator.userLanguage&&(t=Lu(window.navigator.userLanguage,e)),window.navigator.languages&&!t)for(n=0;n<window.navigator.languages.length&&!t;n++)t=Lu(window.navigator.languages[n],e);return window.navigator.browserLanguage&&!t&&(t=Lu(window.navigator.browserLanguage,e)),window.navigator.language&&!t&&(t=Lu(window.navigator.language,e)),window.navigator.systemLanguage&&!t&&(t=Lu(window.navigator.systemLanguage,e)),t||"en"}(t)||"en":e}function Lu(e,t){if(t(e))return e;var n=e.split("-")[0];return n!==e&&t(n)?n:void 0}let zu;Object.assign(Sc,{getLocale:(e,t)=>Du(e,e=>Ru(e,t)),translate(e){if(!zu)return Iu.a.sprintf.apply(Iu.a,arguments);const t=zu.translate(e);return arguments.length>1?t.fetch.apply(t,[].slice.call(arguments,1)):t.fetch()},async initialize(){if(xc.isTestEnv())xc.locale="en";else try{xc.locale=Sc.getLocale(Tc.settings.get("i18n"),Tc.settings.get("locales")),await async function(e){const{api:t,locale:r}=e,i=r.toLowerCase().replace("_","-");if(!Ru(r,t.settings.get("locales"))||"en"===r)return;const{default:s}=await n(476)("./".concat(r,"/LC_MESSAGES/converse.po"));await n(477)("./".concat(i)),Sr.a.locale(Du(i,e=>Sr.a.locale(e))),zu=new Iu.a(s)}(xc)}catch(e){Lr.fatal(e.message),xc.locale="en"}},__:(...e)=>Sc.translate(...e)});const Pu=Sc.__,{Strophe:Fu,$iq:Bu,sizzle:Hu}=zc.env,qu=zc.env.utils;var Uu={model:Nu,comparator:e=>e.get("name").toLowerCase(),initialize(){this.on("add",e=>this.openBookmarkedRoom(e).then(e=>this.markRoomAsBookmarked(e)).catch(e=>Lr.fatal(e))),this.on("remove",this.markRoomAsUnbookmarked,this),this.on("remove",this.sendBookmarkStanza,this);const e="converse.room-bookmarks".concat(xc.bare_jid);this.fetched_flag=e+"fetched",this.browserStorage=xc.createStore(e)},async openBookmarkedRoom(e){if(Tc.settings.get("muc_respect_autojoin")&&e.get("autojoin")){(await Tc.rooms.create(e.get("jid"),{nick:e.get("nick")})).maybeShow()}return e},fetchBookmarks(){const e=qu.getResolveablePromise();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=Bu({type:"set",from:xc.connection.jid}).c("pubsub",{xmlns:Fu.NS.PUBSUB}).c("publish",{node:Fu.NS.BOOKMARKS}).c("item",{id:"current"}).c("storage",{xmlns:Fu.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:Fu.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"),Tc.sendIQ(e)},onBookmarkError(e,t){Lr.error("Error while trying to add bookmark"),Lr.error(e),Tc.alert("error",Pu("Error"),[Pu("Sorry, something went wrong while trying to save your bookmark.")]),this.findWhere({jid:t.jid}).destroy()},fetchBookmarksFromServer(e){const t=Bu({from:xc.connection.jid,type:"get"}).c("pubsub",{xmlns:Fu.NS.PUBSUB}).c("items",{node:Fu.NS.BOOKMARKS});Tc.sendIQ(t).then(t=>this.onBookmarksReceived(e,t)).catch(t=>this.onBookmarksReceivedError(e,t))},markRoomAsBookmarked(e){const t=xc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!0)},markRoomAsUnbookmarked(e){const t=xc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!1)},createBookmarksFromStanza(e){const t=Fu.NS.BOOKMARKS,n='items[node="'.concat(t,'"] item storage[xmlns="').concat(t,'"] conference');Hu(n,e).forEach(e=>{var t;const n=e.getAttribute("jid"),r=this.get(n),i={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)||""};r?r.save(i):this.create(i)})},onBookmarksReceived(e,t){if(this.createBookmarksFromStanza(t),window.sessionStorage.setItem(this.fetched_flag,!0),void 0!==e)return e.resolve()},onBookmarksReceivedError(e,t){if(null===t)Lr.error("Error: timeout while fetching bookmarks"),Tc.alert("error",Pu("Timeout Error"),[Pu("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()):(Lr.error("Error while fetching bookmarks"),Lr.error(t),e.reject(new Error("Could not fetch bookmarks")));Lr.error("Error while fetching bookmarks"),Lr.error(t)}},getUnopenedBookmarks(){return this.filter(e=>!xc.chatboxes.get(e.get("jid")))}};const{Strophe:Vu}=zc.env;async function $u(){const e=await Tc.disco.getIdentity("pubsub","pep",xc.bare_jid);return xc.allow_public_bookmarks?!!e:Tc.disco.supports(Vu.NS.PUBSUB+"#publish-options",xc.bare_jid)}
/**
* @description
* Converse.js plugin which adds views for bookmarks specified in XEP-0048.
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Gu,sizzle:Wu}=zc.env;async function Ju(){Tc.settings.get("allow_bookmarks")&&await $u()&&(xc.bookmarks=new xc.Bookmarks,await xc.bookmarks.fetchBookmarks(),Tc.trigger("bookmarksInitialized"))}function Xu(e){return Wu('event[xmlns="'.concat(Gu.NS.PUBSUB,'#event"] items[node="').concat(Gu.NS.BOOKMARKS,'"]'),e).length&&Tc.waitUntil("bookmarksInitialized").then(()=>xc.bookmarks.createBookmarksFromStanza(e)).catch(e=>Lr.fatal(e)),!0}Gu.addNamespace("BOOKMARKS","storage:bookmarks"),zc.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(!xc.bookmarks||!Tc.settings.get("allow_bookmarks"))return null;const t=xc.bookmarks.findWhere({jid:e});return t?t.get("nick"):void 0}(this.get("jid")),this.__super__.getAndPersistNickname.call(this,e)}}},initialize(){Tc.settings.extend({allow_bookmarks:!0,allow_public_bookmarks:!1,muc_respect_autojoin:!0}),Tc.promises.add("bookmarksInitialized"),xc.Bookmark=Nu,xc.Bookmarks=Fo.extend(Uu),xc.BookmarksList=Vs.extend({defaults:{"toggle-state":xc.OPENED}}),Tc.listen.on("addClientFeatures",()=>{Tc.settings.get("allow_bookmarks")&&Tc.disco.own.features.add(Gu.NS.BOOKMARKS+"+notify")}),Tc.listen.on("clearSession",()=>{void 0!==xc.bookmarks&&(xc.bookmarks.clearStore({silent:!0}),window.sessionStorage.removeItem(xc.bookmarks.fetched_flag),delete xc.bookmarks)}),Tc.listen.on("reconnected",Ju),Tc.listen.on("connected",async()=>{const{connection:e}=xc;e.addHandler(Xu,null,"message","headline",null,xc.bare_jid),await Promise.all([Tc.waitUntil("chatBoxesFetched")]),Ju()})}});n(152);
/**
* @module converse-bosh
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Converse.js plugin which add support for XEP-0206: XMPP Over BOSH
*/const{Strophe:Qu}=zc.env;zc.plugins.add("converse-bosh",{enabled:()=>!xc.api.settings.get("blacklisted_plugins").includes("converse-bosh"),initialize(){Tc.settings.extend({bosh_service_url:void 0,prebind_url:null}),xc.startNewPreboundBOSHSession=function(){if(!Tc.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",Tc.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 xc.setUserJID(t.jid);xc.connection.attach(n,t.sid,t.rid,xc.connection.onConnectStatusChanged)}else e.onerror()},e.onerror=function(){delete xc.connection,Tc.trigger("noResumeableBOSHSession",xc)},e.send()},xc.restoreBOSHSession=async function(){const e=(await async function(){const e="converse.bosh-session";if(xc.bosh_session||(xc.bosh_session=new Vs({id:e}),xc.bosh_session.browserStorage=xc.createStore(e,"session"),await new Promise(e=>xc.bosh_session.fetch({success:e,error:e}))),xc.jid){if(xc.bosh_session.get("jid")!==xc.jid){const e=await xc.setUserJID(xc.jid);xc.bosh_session.clear({silent:!0}),xc.bosh_session.save({jid:e})}}else{const e=xc.bosh_session.get("jid");e&&await xc.setUserJID(e)}return xc.bosh_session}()).get("jid");if(e&&xc.connection._proto instanceof Qu.Bosh)try{return xc.connection.restore(e,xc.connection.onConnectStatusChanged),!0}catch(t){return!xc.isTestEnv()&&Lr.warn("Could not restore session for jid: "+e+" Error message: "+t.message),!1}return!1},Tc.listen.on("clearSession",()=>{if(void 0===xc.bosh_session){const e="converse.bosh-session";sessionStorage.removeItem(e),sessionStorage.removeItem("".concat(e,"-").concat(e))}else xc.bosh_session.destroy(),delete xc.bosh_session}),Tc.listen.on("setUserJID",()=>{void 0!==xc.bosh_session&&xc.bosh_session.save({jid:xc.jid})}),Tc.listen.on("addClientFeatures",()=>Tc.disco.own.features.add(Qu.NS.BOSH)),Object.assign(Tc,{tokens:{get:e=>void 0===xc.connection?null:"rid"===e.toLowerCase()?xc.connection.rid||xc.connection._proto.rid:"sid"===e.toLowerCase()?xc.connection.sid||xc.connection._proto.sid:void 0}})}});var Yu=n(6);
/**
* @module converse-caps
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Ku,$build:Zu}=zc.env;function ed(e,t){return e.sort((e,n)=>e[t]>n[t]?-1:1)}function td(e){const t=e.api.disco.own.identities.get(),n=e.api.disco.own.features.get();t.length>1&&(ed(t,"category"),ed(t,"type"),ed(t,"lang"));let r=t.reduce((e,t)=>{var n;return"".concat(e).concat(t.category,"/").concat(t.type,"/").concat(null!==(n=null==t?void 0:t.lang)&&void 0!==n?n:"","/").concat(t.name,"<")},"");return n.sort(),r=n.reduce((e,t)=>"".concat(e).concat(t,"<"),r),Yu.a.b64_sha1(r)}
/**
* @module converse-carbons
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Implements support for XEP-0280 Message Carbons
*/
function nd(e){var t,n;e&&(null===(n=xc.session)||void 0===n||n.set({carbons_enabled:!1}));if(!Tc.settings.get("message_carbons")||(null===(t=xc.session)||void 0===t?void 0:t.get("carbons_enabled")))return;const r=new gi.e.Builder("iq",{from:xc.connection.jid,id:"enablecarbons",type:"set"}).c("enable",{xmlns:gi.e.NS.CARBONS});xc.connection.addHandler(e=>{e.querySelectorAll("error").length>0?Lr.warn("An error occurred while trying to enable message carbons."):(xc.session.set({carbons_enabled:!0}),Lr.debug("Message carbons have been enabled.")),xc.session.save()},null,"iq",null,"enablecarbons"),xc.connection.send(r)}Ku.addNamespace("CAPS","http://jabber.org/protocol/caps"),zc.plugins.add("converse-caps",{overrides:{XMPPStatus:{constructPresence(){const e=this.__super__.constructPresence.apply(this,arguments);var t;return e.root().cnode((t=this.__super__._converse,Zu("c",{xmlns:Ku.NS.CAPS,hash:"sha-1",node:"https://conversejs.org",ver:td(t)}).nodeTree)).up(),e}}}}),zc.plugins.add("converse-carbons",{initialize(){Tc.settings.extend({message_carbons:!0}),Tc.listen.on("afterResourceBinding",nd)}});
/**
* @module converse-chatboxes
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:rd}=zc.env;rd.addNamespace("MESSAGE_CORRECT","urn:xmpp:message-correct:0"),rd.addNamespace("RECEIPTS","urn:xmpp:receipts"),rd.addNamespace("REFERENCE","urn:xmpp:reference:0"),rd.addNamespace("MARKERS","urn:xmpp:chat-markers:0"),zc.plugins.add("converse-chatboxes",{dependencies:["converse-emoji","converse-roster","converse-vcard"],initialize(){async function e(e,t,n){let r;e=rd.getBareJidFromJid(e.toLowerCase()),Object.assign(t,{jid:e,id:e});try{r=new n(t,{collection:xc.chatboxes})}catch(e){return Lr.error(e),null}return await r.initialized,r.isValid()?(xc.chatboxes.add(r),r):(r.destroy(),null)}Tc.promises.add(["chatBoxesFetched","chatBoxesInitialized","privateChatsAutoJoined"]),xc.ChatBoxes=Fo.extend({comparator:"time_opened",model:(e,t)=>new xc.ChatBox(e,t),onChatBoxesFetched(e){e.filter(e=>!e.isValid()).forEach(e=>e.destroy()),Tc.trigger("chatBoxesFetched")},onConnected(e){e||(this.browserStorage=xc.createStore("converse.chatboxes-".concat(xc.bare_jid)),this.fetch({add:!0,success:e=>this.onChatBoxesFetched(e)}))}}),Tc.listen.on("addClientFeatures",()=>{Tc.disco.own.features.add(rd.NS.MESSAGE_CORRECT),Tc.disco.own.features.add(rd.NS.HTTPUPLOAD),Tc.disco.own.features.add(rd.NS.OUTOFBAND)}),Tc.listen.on("pluginsInitialized",()=>{xc.chatboxes=new xc.ChatBoxes,Tc.trigger("chatBoxesInitialized")}),Tc.listen.on("presencesInitialized",e=>xc.chatboxes.onConnected(e)),Tc.listen.on("reconnected",()=>xc.chatboxes.forEach(e=>e.onReconnection())),Object.assign(Tc,{chatboxes:{create:async(t=[],n={},r)=>(await Tc.waitUntil("chatBoxesFetched"),"string"==typeof t?e(t,n,r):Promise.all(t.map(t=>e(t,n,r)))),get:async e=>(await Tc.waitUntil("chatBoxesFetched"),void 0===e?xc.chatboxes.models:"string"==typeof e?xc.chatboxes.get(e.toLowerCase()):(e=e.map(e=>e.toLowerCase()),xc.chatboxes.models.filter(t=>e.includes(t.get("jid")))))}})}}),zc.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(){xc.connection.addHandler(e=>async function(e){if(il(e)||sl(e)){const t=e.getAttribute("from");if(t.includes("@")&&!xc.roster.get(t)&&!Tc.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const n=xc.chatboxes.create({id:t,jid:t,type:xc.HEADLINES_TYPE,from:t}),r=await yl(e,xc);await n.createMessage(r),Tc.trigger("message",{chatbox:n,stanza:e,attrs:r})}}(e)||!0,null,"message")}xc.HeadlinesBox=xc.ChatBox.extend({defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(Tc.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:xc.HEADLINES_TYPE}},async initialize(){this.set({box_id:"box-".concat(this.get("jid"))}),this.initMessages(),await this.fetchMessages(),Tc.trigger("headlinesBoxInitialized",this)}}),Tc.listen.on("connected",e),Tc.listen.on("reconnected",e),Object.assign(Tc,{headlines:{async get(e,t={},n=!1){async function r(e){let r=await Tc.chatboxes.get(e);return!r&&n?r=await Tc.chatboxes.create(e,t,xc.HeadlinesBox):(r=r&&r.get("type")===xc.HEADLINES_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Tc.chatboxes.get()).filter(e=>e.get("type")===xc.HEADLINES_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}})}});var id=n(170),sd=n.n(id);
/**
* @module converse-rsm
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description XEP-0059 Result Set Management
* Some code taken from the Strophe RSM plugin, licensed under the MIT License
* Copyright 2006-2017 Strophe (https://github.com/strophe/strophejs)
*/
const{Strophe:od,$build:ad}=zc.env;od.addNamespace("RSM","http://jabber.org/protocol/rsm");const cd=["after","before","index","max"],ld=e=>Number(e),ud=e=>e.toString(),dd={after:ud,before:ud,count:ld,first:ud,index:ld,last:ud,max:ld},hd=e=>void 0===e,fd=Object.keys(dd);class pd{static getQueryParameters(e={}){return sd()(e,cd)}static parseXMLResult(e){const t={};for(var n=0;n<fd.length;n++){const r=fd[n],i=e.getElementsByTagName(r)[0];hd(i)||null===i||(t[r]=dd[r](od.getText(i)),"first"==r&&(t.index=dd.index(i.getAttribute("index"))))}return t}constructor(e={}){this.query=pd.getQueryParameters(e),this.result=e.xml?pd.parseXMLResult(e.xml):{}}toXML(){const e=ad("set",{xmlns:od.NS.RSM});return cd.reduce((e,t)=>hd(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 pd(n)}previous(e,t){const n=Object.assign({},this.query,{after:t,before:this.result.first,max:e});return new pd(n)}}xc.RSM_ATTRIBUTES=fd,xc.RSM=pd;const{Strophe:md,$iq:gd,dayjs:vd}=zc.env,{NS:_d}=md,bd=zc.env.utils;var yd={archive:{async query(e){if(!Tc.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||xc.bare_jid;if(!await Tc.disco.supports(_d.MAM,n))return Lr.warn("Did not fetch MAM archive for ".concat(n," because it doesn't support ").concat(_d.MAM)),{messages:[]};const r=bd.getUniqueId(),i=gd(t).c("query",{xmlns:_d.MAM,queryid:r});if(e){i.c("x",{xmlns:_d.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(_d.MAM).up().up(),e.with&&!e.groupchat&&i.c("field",{var:"with"}).c("value").t(e.with).up().up(),["start","end"].forEach(t=>{if(e[t]){const n=vd(e[t]);if(!n.isValid())throw new TypeError("archive.query: invalid date provided for: ".concat(t));i.c("field",{var:t}).c("value").t(n.toISOString()).up().up()}}),i.up();const t=new pd(e);Object.keys(t.query).length&&i.cnode(t.toXML())}const s=[],o=xc.connection.addHandler(t=>{const n=pi()('message > result[xmlns="'.concat(_d.MAM,'"]'),t).pop();if(void 0===n||n.getAttribute("queryid")!==r)return!0;const i=t.getAttribute("from")||xc.bare_jid;if(e.groupchat){if(i!==e.with)return Lr.warn("Ignoring alleged groupchat MAM message from ".concat(t.getAttribute("from"))),!0}else if(i!==xc.bare_jid)return Lr.warn("Ignoring alleged MAM message from ".concat(t.getAttribute("from"))),!0;return s.push(t),!0},_d.MAM);let a;const c=await Tc.sendIQ(i,Tc.settings.get("message_archiving_timeout"),!1);if(null===c){const{__:e}=xc,t=e("Timeout while trying to fetch archived messages.");return Lr.error(t),a=new xc.TimeoutError(t),{messages:s,error:a}}if(bd.isErrorStanza(c)){const{__:e}=xc,t=e("An error occurred while querying for archived messages.");return Lr.error(t),Lr.error(c),a=new Error(t),{messages:s,error:a}}let l;xc.connection.deleteHandler(o);const u=c&&pi()('fin[xmlns="'.concat(_d.MAM,'"]'),c).pop(),d="true"===(null==u?void 0:u.getAttribute("complete")),h=pi()('set[xmlns="'.concat(_d.RSM,'"]'),u).pop();return h&&(l=new pd({...e,xml:h})),{messages:s,rsm:l,complete:d}}}};const{Strophe:wd,$iq:Sd}=zc.env,{NS:xd}=wd,Ed=zc.env.utils;function Ad(e){(null==e?void 0:e.querySelectorAll("feature-not-implemented").length)?Lr.warn("Message Archive Management (XEP-0313) not supported by ".concat(e.getAttribute("from"))):(Lr.error("Error while trying to set archiving preferences for ".concat(e.getAttribute("from"),".")),Lr.error(e))}function Cd(e,t){const n=pi()('prefs[xmlns="'.concat(xd.MAM,'"]'),e).pop();if(n.getAttribute("default")!==Tc.settings.get("message_archiving")){const e=Sd({type:"set"}).c("prefs",{xmlns:xd.MAM,default:Tc.settings.get("message_archiving")});Array.from(n.children).forEach(t=>e.cnode(t).up()),Tc.sendIQ(e).then(()=>t.save({preferences:{default:Tc.settings.get("message_archiving")}})).catch(xc.onMAMError)}else t.save({preferences:{default:Tc.settings.get("message_archiving")}})}function Td(e){const t=e.get("preferences")||{};e.get("var")===xd.MAM&&void 0!==Tc.settings.get("message_archiving")&&t.default!==Tc.settings.get("message_archiving")&&Tc.sendIQ(Sd({type:"get"}).c("prefs",{xmlns:xd.MAM})).then(t=>xc.onMAMPreferences(t,e)).catch(xc.onMAMError)}function Od(e){Tc.settings.get("muc_show_logs_before_join")&&e.features.get("mam_enabled")&&!e.get("prejoin_mam_fetched")&&(Nd(e),e.save({prejoin_mam_fetched:!0}))}async function jd(e,t,n,r,i){await Tc.emojis.initialize();const s=e.get("type")===xc.CHATROOMS_TYPE;t.messages=t.messages.map(t=>s?fu(t,e,xc):yl(t,xc));const o={query:n,chatbox:e,messages:t.messages};if(await Tc.trigger("MAMResult",o,{synchronous:!0}),t.messages.forEach(t=>e.queueMessage(t)),t.error){const n=t.error.retry_event_id=Ed.getUniqueId();Tc.listen.once(n,()=>kd(e,r,i)),e.createMessageFromError(t.error)}}async function kd(e,t={},n){if(e.disable_mam)return;const r=e.get("type")===xc.CHATROOMS_TYPE,i=r?e.get("jid"):xc.bare_jid;if(!await Tc.disco.supports(xd.MAM,i))return;const s=Tc.settings.get("archived_messages_page_size"),o=Object.assign({groupchat:r,max:s,with:e.get("jid")},t),a=await Tc.archive.query(o);return await jd(e,a,o,t,n),n&&a.rsm&&!a.complete?("forwards"===n?t=a.rsm.next(s,t.before).query:"backwards"===n&&(t=a.rsm.previous(s,t.after).query),kd(e,t,n)):void 0}function Nd(e){if(e.disable_mam)return;const t=e.getMostRecentMessage();if(t&&!Tc.settings.get("clear_messages_on_reconnection")){const n=t.get("stanza_id ".concat(e.get("jid")));kd(e,n?{after:n}:{start:t.get("time")},"forwards")}else kd(e,{before:""})}
/**
* @description XEP-0313 Message Archive Management
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Md}=zc.env,{NS:Id}=Md;zc.plugins.add("converse-mam",{dependencies:["converse-disco","converse-muc"],initialize(){Tc.settings.extend({archived_messages_page_size:"50",message_archiving:void 0,message_archiving_timeout:2e4}),Object.assign(Tc,yd),Object.assign(xc,{onMAMError:Ad,onMAMPreferences:Cd,handleMAMResult:jd}),Tc.listen.on("addClientFeatures",()=>Tc.disco.own.features.add(Id.MAM)),Tc.listen.on("serviceDiscovered",Td),Tc.listen.on("chatRoomViewInitialized",e=>{Tc.settings.get("muc_show_logs_before_join")&&(Od(e.model),e.model.features.on("change:mam_enabled",()=>Od(e.model)))}),Tc.listen.on("enteredNewRoom",e=>e.features.get("mam_enabled")&&Nd(e)),Tc.listen.on("chatReconnected",e=>{e.get("type")===xc.PRIVATE_CHAT_TYPE&&Nd(e)}),Tc.listen.on("afterMessagesFetched",e=>{e.get("type")!==xc.PRIVATE_CHAT_TYPE||xc.connection.restored||Nd(e)})}});
/**
* @module converse-ping
* @description
* Converse.js plugin which add support for application-level pings
* as specified in XEP-0199 XMPP Ping.
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Rd,$iq:Dd}=zc.env,Ld=zc.env.utils;Rd.addNamespace("PING","urn:xmpp:ping"),zc.plugins.add("converse-ping",{initialize(){let e;function t(t){e=new Date;const n=t.getAttribute("from"),r=t.getAttribute("id"),i=Dd({type:"result",to:n,id:r});return xc.connection.sendIQ(i),!0}Tc.settings.extend({ping_interval:60}),setTimeout(()=>{if(Tc.settings.get("ping_interval")>0){const t=new Date;return e||(e=t),!((t-e)/1e3>Tc.settings.get("ping_interval"))||Tc.ping()}},1e3);const n=function(){void 0!==xc.connection.disco&&Tc.disco.own.features.add(Rd.NS.PING),xc.connection.addHandler(t,Rd.NS.PING,"iq","get"),xc.connection.addHandler(()=>{if(Tc.settings.get("ping_interval")>0)return e=new Date,!0})};Tc.listen.on("connected",n),Tc.listen.on("reconnected",n),Tc.listen.on("windowStateChanged",(function(e){"visible"===e.state&&Tc.connection.connected()&&Tc.ping(null,5e3)})),Object.assign(Tc,{async ping(t,n){if(e=new Date,t=t||Rd.getDomainFromJid(xc.bare_jid),xc.connection){const e=Dd({type:"get",to:t,id:Ld.getUniqueId("ping")}).c("ping",{xmlns:Rd.NS.PING}),r=await Tc.sendIQ(e,n||1e4,!1);return null===r?(Lr.warn("Timeout while pinging ".concat(t)),t===Rd.getDomainFromJid(xc.bare_jid)&&Tc.connection.reconnect()):Ld.isErrorStanza(r)&&(Lr.error("Error while pinging ".concat(t)),Lr.error(r)),!0}return!1}})}});
/**
* @module converse-pubsub
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:zd,$iq:Pd}=zc.env;zd.addNamespace("PUBSUB_ERROR",zd.NS.PUBSUB+"#errors"),zc.plugins.add("converse-pubsub",{dependencies:["converse-disco"],initialize(){Object.assign(xc.api,{pubsub:{async publish(e,t,n,r,i=!0){const s=Pd({from:xc.bare_jid,type:"set",to:e}).c("pubsub",{xmlns:zd.NS.PUBSUB}).c("publish",{node:t}).cnode(n.tree()).up().up();r&&(e=e||xc.bare_jid,await Tc.disco.supports(zd.NS.PUBSUB+"#publish-options",e)?(s.c("publish-options").c("x",{xmlns:zd.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t("".concat(zd.NS.PUBSUB,"#publish-options")).up().up(),Object.keys(r).forEach(e=>s.c("field",{var:e}).c("value").t(r[e]).up().up())):Lr.warn("_converse.api.publish: ".concat(e," does not support #publish-options, ")+"so we didn't set them even though they were provided."));try{await Tc.sendIQ(s)}catch(e){if(!(e instanceof Element&&i&&e.querySelector('precondition-not-met[xmlns="'.concat(zd.NS.PUBSUB_ERROR,'"]'))))throw e;{const e=s.nodeTree;e.querySelector("publish-options").outerHTML="",Lr.warn("PubSub: Republishing without publish options. ".concat(e.outerHTML)),await Tc.sendIQ(e)}}}}})}});var Fd=function(e,t){for(var n,r=-1,i=e.length;++r<i;){var s=t(e[r]);void 0!==s&&(n=void 0===n?s:n+s)}return n};var Bd=function(e){return e&&e.length?Fd(e,Ze):0};var Hd=function(e){return function(t){return null==e?void 0:Ae(e,t)}};var qd=function(e){return"number"==typeof e||m(e)&&"[object Number]"==p(e)};var Ud=function(e){return qd(e)&&e!=+e};const{Strophe:Vd,$build:$d,$pres:Gd}=zc.env;zc.plugins.add("converse-status",{initialize(){function e(e){Tc.trigger("statusInitialized",e)}function t(t){if(t=void 0!==xc.xmppstatus&&t)e(t);else{const n="converse.xmppstatus-".concat(xc.bare_jid);xc.xmppstatus=new xc.XMPPStatus({id:n}),xc.xmppstatus.browserStorage=xc.createStore(n,"session"),xc.xmppstatus.fetch({success:()=>e(t),error:()=>e(t),silent:!0})}}Tc.settings.extend({auto_away:0,auto_xa:0,csi_waiting_time:0,default_state:"online",priority:0}),Tc.promises.add(["statusInitialized"]),xc.XMPPStatus=Vs.extend({defaults:()=>({status:Tc.settings.get("default_state")}),initialize(){this.on("change",e=>{y(e.changed)&&("status"in e.changed||"status_message"in e.changed)&&Tc.user.presence.send(this.get("status"),null,this.get("status_message"))})},getNickname:()=>xc.nickname,getFullname:()=>"",constructPresence(e,t=null,n){let r;e="string"==typeof e?e:this.get("status")||Tc.settings.get("default_state"),n="string"==typeof n?n:this.get("status_message");const i={to:t};"unavailable"===e||"probe"===e||"error"===e||"unsubscribe"===e||"unsubscribed"===e||"subscribe"===e||"subscribed"===e?(i.type=e,r=Gd(i)):"offline"===e?(i.type="unavailable",r=Gd(i)):r="online"===e?Gd(i):Gd(i).c("show").t(e).up(),n&&r.c("status").t(n).up();const s=Tc.settings.get("priority");if(r.c("priority").t(Ud(Number(s))?0:s).up(),xc.idle){const e=new Date;e.setSeconds(e.getSeconds()-xc.idle_seconds),r.c("idle",{xmlns:Vd.NS.IDLE,since:e.toISOString()})}return r}}),xc.sendCSI=function(e){Tc.send($d(e,{xmlns:Vd.NS.CSI})),xc.inactive=e===xc.INACTIVE},xc.onUserActivity=function(){var e;xc.idle_seconds>0&&(xc.idle_seconds=0),(null===(e=xc.connection)||void 0===e?void 0:e.authenticated)&&(xc.inactive&&xc.sendCSI(xc.ACTIVE),xc.idle&&(xc.idle=!1,Tc.user.presence.send()),!0===xc.auto_changed_status&&(xc.auto_changed_status=!1,xc.xmppstatus.set("status",Tc.settings.get("default_state"))))},xc.onEverySecond=function(){var e;if(!(null===(e=xc.connection)||void 0===e?void 0:e.authenticated))return;const t=xc.xmppstatus.get("status");xc.idle_seconds++,Tc.settings.get("csi_waiting_time")>0&&xc.idle_seconds>Tc.settings.get("csi_waiting_time")&&!xc.inactive&&xc.sendCSI(xc.INACTIVE),Tc.settings.get("idle_presence_timeout")>0&&xc.idle_seconds>Tc.settings.get("idle_presence_timeout")&&!xc.idle&&(xc.idle=!0,Tc.user.presence.send()),Tc.settings.get("auto_away")>0&&xc.idle_seconds>Tc.settings.get("auto_away")&&"away"!==t&&"xa"!==t&&"dnd"!==t?(xc.auto_changed_status=!0,xc.xmppstatus.set("status","away")):Tc.settings.get("auto_xa")>0&&xc.idle_seconds>Tc.settings.get("auto_xa")&&"xa"!==t&&"dnd"!==t&&(xc.auto_changed_status=!0,xc.xmppstatus.set("status","xa"))},xc.registerIntervalHandler=function(){if(Tc.settings.get("auto_away")<1&&Tc.settings.get("auto_xa")<1&&Tc.settings.get("csi_waiting_time")<1&&Tc.settings.get("idle_presence_timeout")<1)return;xc.idle_seconds=0,xc.auto_changed_status=!1;const{unloadevent:e}=xc;window.addEventListener("click",xc.onUserActivity),window.addEventListener("focus",xc.onUserActivity),window.addEventListener("keypress",xc.onUserActivity),window.addEventListener("mousemove",xc.onUserActivity),window.addEventListener(e,xc.onUserActivity,{once:!0,passive:!0}),window.addEventListener(e,()=>{var e;return null===(e=xc.session)||void 0===e?void 0:e.save("active",!1)}),xc.everySecondTrigger=window.setInterval(xc.onEverySecond,1e3)},Tc.listen.on("presencesInitialized",e=>{e||xc.registerIntervalHandler()}),Tc.listen.on("clearSession",()=>{xc.shouldClearCache()&&xc.xmppstatus&&(xc.xmppstatus.destroy(),delete xc.xmppstatus,Tc.promises.add(["statusInitialized"]))}),Tc.listen.on("connected",()=>t(!1)),Tc.listen.on("reconnected",()=>t(!0)),Object.assign(xc.api.user,{presence:{async send(e,t,n,r){await Tc.waitUntil("statusInitialized");const i=xc.xmppstatus.constructPresence(e,t,n);r&&(Array.isArray(r)||(r=[r]),r.map(e=>{var t;return null!==(t=null==e?void 0:e.tree())&&void 0!==t?t:e}).forEach(e=>i.cnode(e).up())),Tc.send(i)}},status:{get:async()=>(await Tc.waitUntil("statusInitialized"),xc.xmppstatus.get("status")),async set(e,t){const n={status:e};if(!Object.keys(xc.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 Tc.waitUntil("statusInitialized"),xc.xmppstatus.save(n)},message:{get:async()=>(await Tc.waitUntil("statusInitialized"),xc.xmppstatus.get("status_message")),async set(e){await Tc.waitUntil("statusInitialized"),xc.xmppstatus.save({status_message:e})}}}})}});
/**
* @module converse-roster
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Wd,$iq:Jd,$pres:Xd,dayjs:Qd,sizzle:Yd}=zc.env,Kd=zc.env.utils;zc.plugins.add("converse-roster",{dependencies:["converse-status"],initialize(){const{__:e}=xc;Tc.settings.extend({allow_contact_requests:!0,auto_subscribe:!1,synchronize_availability:!0}),Tc.promises.add(["cachedRoster","roster","rosterContactsFetched","rosterGroupsFetched","rosterInitialized"]),xc.HEADER_CURRENT_CONTACTS=e("My contacts"),xc.HEADER_PENDING_CONTACTS=e("Pending contacts"),xc.HEADER_REQUESTING_CONTACTS=e("Contact requests"),xc.HEADER_UNGROUPED=e("Ungrouped"),xc.HEADER_UNREAD=e("New messages");const t={};t[xc.HEADER_UNREAD]=0,t[xc.HEADER_REQUESTING_CONTACTS]=1,t[xc.HEADER_CURRENT_CONTACTS]=2,t[xc.HEADER_UNGROUPED]=3,t[xc.HEADER_PENDING_CONTACTS]=4,xc.registerPresenceHandler=function(){xc.unregisterPresenceHandler(),xc.presence_ref=xc.connection.addHandler(e=>(xc.roster.presenceHandler(e),!0),null,"presence",null)},xc.rejectPresenceSubscription=function(e,t){const n=Xd({to:e,type:"unsubscribed"});t&&""!==t&&n.c("status").t(t),Tc.send(n)},xc.sendInitialPresence=function(){xc.send_initial_presence&&Tc.user.presence.send()},xc.populateRoster=async function(e=!1){e&&(xc.send_initial_presence=!0);try{await xc.rostergroups.fetchRosterGroups(),Tc.trigger("rosterGroupsFetched"),await xc.roster.fetchRosterContacts(),Tc.trigger("rosterContactsFetched")}catch(e){Lr.error(e)}finally{xc.sendInitialPresence()}};const n=Vs.extend({idAttribute:"name"}),r=Fo.extend({model:n});function i(e){const t=xc.roster&&xc.roster.findWhere({jid:e.get("jid")});void 0!==t&&t.save({num_unread:e.get("num_unread")})}async function s(){xc.presences&&await xc.presences.clearStore()}xc.Presence=Vs.extend({defaults:{show:"offline"},initialize(){this.resources=new r;const e="converse.identities-".concat(this.get("jid"));this.resources.browserStorage=xc.createStore(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=>"".concat(e.get("priority"),"-").concat(e.get("timestamp"))).reverse()[0]},addResource(e){const t=e.getAttribute("from"),n=Wd.getResourceFromJid(t),r=Yd('delay[xmlns="'.concat(Wd.NS.DELAY,'"]'),e).pop(),i=Hd(e.querySelector("priority"))("textContent")||0,s=this.resources.get(n),o={name:n,priority:Ud(parseInt(i,10))?0:parseInt(i,10),show:Hd(e.querySelector("show"))("textContent")||"online",timestamp:r?Qd(r.getAttribute("stamp")).toISOString():(new Date).toISOString()};s?s.save(o):this.resources.create(o)},removeResource(e){const t=this.resources.get(e);t&&t.destroy()}}),xc.Presences=Fo.extend({model:xc.Presence}),xc.RosterContact=Vs.extend({defaults:{chat_state:void 0,image:xc.DEFAULT_IMAGE,image_type:xc.DEFAULT_IMAGE_TYPE,num_unread:0,status:void 0},async initialize(e){this.initialized=Kd.getResolveablePromise(),this.setPresence();const{jid:t}=e,n=Wd.getBareJidFromJid(t).toLowerCase();e.jid=n,this.set(Object.assign({groups:[],id:n,jid:n,user_id:Wd.getNodeFromJid(t)},e)),this.listenTo(this.presence,"change:show",()=>Tc.trigger("contactPresenceChanged",this)),this.listenTo(this.presence,"change:show",()=>this.trigger("presenceChanged")),await Tc.trigger("rosterContactInitialized",this,{Synchronous:!0}),this.initialized.resolve()},setPresence(){const e=this.get("jid");this.presence=xc.presences.findWhere({jid:e})||xc.presences.create({jid:e})},openChat(){const e=this.attributes;Tc.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(" ".concat(t)),n=n.includes(e)?n:n.concat(" ".concat(e)),n.toLowerCase()},getDisplayName(){return this.get("nickname")?this.get("nickname"):this.get("jid")},getFullname(){return this.get("jid")},subscribe(e){const t=Xd({to:this.get("jid"),type:"subscribe"});e&&""!==e&&t.c("status").t(e).up();const n=xc.xmppstatus.getNickname()||xc.xmppstatus.getFullname();return n&&t.c("nick",{xmlns:Wd.NS.NICK}).t(n).up(),Tc.send(t),this.save("ask","subscribe"),this},ackSubscribe(){Tc.send(Xd({type:"subscribe",to:this.get("jid")}))},ackUnsubscribe(){Tc.send(Xd({type:"unsubscribe",to:this.get("jid")})),this.removeFromRoster(),this.destroy()},unauthorize(e){return xc.rejectPresenceSubscription(this.get("jid"),e),this},authorize(e){const t=Xd({to:this.get("jid"),type:"subscribed"});return e&&""!==e&&t.c("status").t(e),Tc.send(t),this},removeFromRoster(){const e=Jd({type:"set"}).c("query",{xmlns:Wd.NS.ROSTER}).c("item",{jid:this.get("jid"),subscription:"remove"});return Tc.sendIQ(e)}}),xc.RosterContacts=Fo.extend({model:xc.RosterContact,comparator(e,t){const n=e.presence.get("show")||"offline",r=t.presence.get("show")||"offline";if(xc.STATUS_WEIGHTS[n]===xc.STATUS_WEIGHTS[r]){const n=e.getDisplayName().toLowerCase(),r=t.getDisplayName().toLowerCase();return n<r?-1:n>r?1:0}return xc.STATUS_WEIGHTS[n]<xc.STATUS_WEIGHTS[r]?-1:1},onConnected(){this.registerRosterHandler(),this.registerRosterXHandler()},registerRosterHandler(){xc.connection.addHandler(e=>(xc.roster.onRosterPush(e),!0),Wd.NS.ROSTER,"iq","set")},registerRosterXHandler(){let e=0;xc.connection.addHandler((function(t){return window.setTimeout((function(){xc.connection.flush(),xc.roster.subscribeToSuggestedItems.bind(xc.roster)(t)}),e),e+=250*t.querySelectorAll("item").length,!0}),Wd.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(Kd.isErrorObject(e)&&(Lr.error(e),xc.session.set("roster_cached",!1),this.data.save("version",void 0)),!xc.session.get("roster_cached"))return xc.send_initial_presence=!0,xc.roster.fetchFromServer();Tc.trigger("cachedRoster",e)},subscribeToSuggestedItems:e=>(Array.from(e.querySelectorAll("item")).forEach(e=>{"add"===e.getAttribute("action")&&xc.roster.addAndSubscribe(e.getAttribute("jid"),xc.xmppstatus.getNickname()||xc.xmppstatus.getFullname())}),!0),isSelf:e=>Kd.isSameBareJID(e,xc.connection.jid),async addAndSubscribe(e,t,n,r,i){const s=await this.addContactToRoster(e,t,n,i);s instanceof xc.RosterContact&&s.subscribe(r)},sendContactAddIQ(e,t,n){t=t||null;const r=Jd({type:"set"}).c("query",{xmlns:Wd.NS.ROSTER}).c("item",{jid:e,name:t});return n.forEach(e=>r.c("group").t(e).up()),Tc.sendIQ(r)},async addContactToRoster(t,n,r,i){await Tc.waitUntil("rosterContactsFetched"),r=r||[];try{await this.sendContactAddIQ(t,n,r)}catch(r){return Lr.error(r),alert(e("Sorry, there was an error while trying to add %1$s as a contact.",n||t)),r}return this.create(Object.assign({ask:void 0,nickname:n,groups:r,jid:t,requesting:!1,subscription:"none"},i),{sort:!1})},async subscribeBack(e,t){const n=this.get(e);if(n instanceof xc.RosterContact)n.authorize().subscribe();else{var r;const n=(null===(r=Yd('nick[xmlns="'.concat(Wd.NS.NICK,'"]'),t).pop())||void 0===r?void 0:r.textContent)||null,i=await this.addContactToRoster(e,n,[],{subscription:"from"});i instanceof xc.RosterContact&&i.authorize().subscribe()}},getNumOnlineContacts(){const e=["offline","unavailable"];return Bd(this.models.filter(t=>!e.includes(t.presence.get("show"))))},onRosterPush(e){const t=e.getAttribute("id"),n=e.getAttribute("from");if(n&&n!==xc.bare_jid)return void Lr.warn("Ignoring roster illegitimate roster push message from ".concat(e.getAttribute("from")));Tc.send(Jd({type:"result",id:t,from:xc.connection.jid}));const r=Yd('query[xmlns="'.concat(Wd.NS.ROSTER,'"]'),e).pop();this.data.save("version",r.getAttribute("ver"));const i=Yd("item",r);if(i.length>1)throw Lr.error(e),new Error('Roster push query may not contain more than one "item" element.');if(0===i.length)return Lr.warn(e),void Lr.warn('Received a roster push stanza without an "item" element.');this.updateContact(i.pop()),Tc.trigger("rosterPush",e)},rosterVersioningSupported(){return Tc.disco.stream.getFeature("ver","urn:xmpp:features:rosterver")&&this.data.get("version")},async fetchFromServer(){const e=Jd({type:"get",id:Kd.getUniqueId("roster")}).c("query",{xmlns:Wd.NS.ROSTER});this.rosterVersioningSupported()&&e.attrs({ver:this.data.get("version")});const t=await Tc.sendIQ(e,null,!1);if("error"!==t.getAttribute("type")){const e=Yd('query[xmlns="'.concat(Wd.NS.ROSTER,'"]'),t).pop();if(e){Yd("item",e).forEach(e=>this.updateContact(e)),this.data.save("version",e.getAttribute("ver"))}}else if(!Kd.isServiceUnavailableError(t))return Lr.error(t),void Lr.error("Error while trying to fetch roster from the server");xc.session.save("roster_cached",!0),Tc.trigger("roster",t)},updateContact(e){const t=e.getAttribute("jid"),n=this.get(t),r=e.getAttribute("subscription"),i=e.getAttribute("ask"),s=Array.from(e.getElementsByTagName("group")).map(e=>e.textContent);if(n){if("remove"===r)return n.destroy();n.save({subscription:r,ask:i,nickname:e.getAttribute("name"),requesting:null,groups:s})}else{if("none"===r&&null===i||"remove"===r)return;this.create({ask:i,nickname:e.getAttribute("name"),groups:s,jid:t,subscription:r},{sort:!1})}},createRequestingContact(e){var t;const n={jid:Wd.getBareJidFromJid(e.getAttribute("from")),subscription:"none",ask:null,requesting:!0,nickname:(null===(t=Yd('nick[xmlns="'.concat(Wd.NS.NICK,'"]'),e).pop())||void 0===t?void 0:t.textContent)||null};Tc.trigger("contactRequest",this.create(n))},handleIncomingSubscription(t){const n=t.getAttribute("from"),r=Wd.getBareJidFromJid(n),i=this.get(r);Tc.settings.get("allow_contact_requests")||xc.rejectPresenceSubscription(n,e("This client does not allow presence subscriptions")),Tc.settings.get("auto_subscribe")?i&&"to"===i.get("subscription")?i.authorize():this.subscribeBack(r,t):i?("none"!==i.get("subscription")||"subscribe"===i.get("ask"))&&i.authorize():this.createRequestingContact(t)},handleOwnPresence(e){const t=e.getAttribute("from"),n=Wd.getResourceFromJid(t),r=e.getAttribute("type");if(xc.connection.jid!==t&&"unavailable"!==r&&(!0===Tc.settings.get("synchronize_availability")||Tc.settings.get("synchronize_availability")===n)){const t=Hd(e.querySelector("show"))("textContent")||"online";xc.xmppstatus.save({status:t},{silent:!0});const n=Hd(e.querySelector("status"))("textContent");n&&xc.xmppstatus.save({status_message:n})}xc.jid===t&&"unavailable"===r&&Tc.user.presence.send()},presenceHandler(e){const t=e.getAttribute("type");if("error"===t)return!0;const n=e.getAttribute("from"),r=Wd.getBareJidFromJid(n);if(this.isSelf(r))return this.handleOwnPresence(e);if(Yd('query[xmlns="'.concat(Wd.NS.MUC,'"]'),e).length)return;const i=Hd(e.querySelector("status"))("textContent"),s=this.get(r);if(s&&i!==s.get("status")&&s.save({status:i}),"subscribed"===t&&s)s.ackSubscribe();else if("unsubscribed"===t&&s)s.ackUnsubscribe();else{if("unsubscribe"===t)return;if("subscribe"===t)this.handleIncomingSubscription(e);else if("unavailable"===t&&s){const e=Wd.getResourceFromJid(n);s.presence.removeResource(e)}else s&&s.presence.addResource(e)}}}),xc.RosterGroup=Vs.extend({initialize(t){this.set(Object.assign({description:e("Click to hide these contacts"),state:xc.OPENED},t)),this.contacts=new xc.RosterContacts}}),xc.RosterGroups=Fo.extend({model:xc.RosterGroup,comparator(e,n){e=e.get("name"),n=n.get("name");const r=t,i=Object.keys(t),s=i.includes(e),o=i.includes(n);if(!s&&!o)return e.toLowerCase()<n.toLowerCase()?-1:e.toLowerCase()>n.toLowerCase()?1:0;if(s&&o)return r[e]<r[n]?-1:r[e]>r[n]?1:0;if(!s&&o){const e=xc.HEADER_CURRENT_CONTACTS;return r[e]<r[n]?-1:r[e]>r[n]?1:0}if(s&&!o){const t=xc.HEADER_CURRENT_CONTACTS;return r[e]<r[t]?-1:r[e]>r[t]?1:0}},fetchRosterGroups(){return new Promise(e=>{this.fetch({success:e,silent:!0})})}}),xc.unregisterPresenceHandler=function(){void 0!==xc.presence_ref&&(xc.connection.deleteHandler(xc.presence_ref),delete xc.presence_ref)},Tc.listen.on("chatBoxesInitialized",()=>{xc.chatboxes.on("change:num_unread",i),xc.chatboxes.on("add",e=>{e.get("type")===xc.PRIVATE_CHAT_TYPE&&e.setRosterContact(e.get("jid"))})}),Tc.listen.on("beforeTearDown",()=>xc.unregisterPresenceHandler()),Tc.waitUntil("rosterContactsFetched").then(()=>{xc.roster.on("add",e=>{const t=xc.chatboxes.findWhere({jid:e.get("jid")});t&&t.setRosterContact(e.get("jid"))})}),Tc.listen.on("streamResumptionFailed",()=>xc.session.set("roster_cached",!1)),Tc.listen.on("clearSession",async()=>{await s(),xc.shouldClearCache()&&(xc.rostergroups&&(await xc.rostergroups.clearStore(),delete xc.rostergroups),xc.roster&&(ut(xc,"roster.data.destroy"),await xc.roster.clearStore(),delete xc.roster))}),Tc.listen.on("statusInitialized",async e=>{if(e)!xc.connection.hasResumed()&&await s();else{xc.presences=new xc.Presences;const e="converse.presences-".concat(xc.bare_jid);xc.presences.browserStorage=xc.createStore(e,"session"),xc.presences.fetch()}Tc.trigger("presencesInitialized",e)}),Tc.listen.on("presencesInitialized",async e=>{e?Tc.trigger("rosterReadyAfterReconnection"):await async function(){await Tc.waitUntil("VCardsInitialized"),xc.roster=new xc.RosterContacts;let e="converse.contacts-".concat(xc.bare_jid);xc.roster.browserStorage=xc.createStore(e),xc.roster.data=new Vs,e="converse-roster-model-".concat(xc.bare_jid),xc.roster.data.id=e,xc.roster.data.browserStorage=xc.createStore(e),xc.roster.data.fetch(),e="converse.roster.groups".concat(xc.bare_jid),xc.rostergroups=new xc.RosterGroups,xc.rostergroups.browserStorage=xc.createStore(e),Tc.trigger("rosterInitialized")}(),xc.roster.onConnected(),xc.registerPresenceHandler(),xc.populateRoster(!xc.connection.restored)}),Object.assign(xc.api,{contacts:{async get(e){await Tc.waitUntil("rosterContactsFetched");const t=e=>xc.roster.get(Wd.getBareJidFromJid(e));if(void 0===e)e=xc.roster.pluck("jid");else if("string"==typeof e)return t(e);return e.map(t)},async add(e,t){if(await Tc.waitUntil("rosterContactsFetched"),"string"!=typeof e||!e.includes("@"))throw new TypeError("contacts.add: invalid jid");return xc.roster.addAndSubscribe(e,t)}}})}});
/**
* @module converse-smacks
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Converse.js plugin which adds support for XEP-0198: Stream Management
*/
const{Strophe:Zd}=zc.env,eh=zc.env.utils;function th(){return!(Tc.connection.isType("bosh")&&!xc.isTestEnv())&&Tc.disco.stream.getFeature("sm",Zd.NS.SM)}function nh(e){if(!xc.session.get("smacks_enabled"))return!0;const t=parseInt(e.getAttribute("h"),10),n=xc.session.get("num_stanzas_handled_by_server"),r=t-n;if(r<0){const e="New reported stanza count lower than previous. "+"New: ".concat(t," - Previous: ").concat(n);Lr.error(e)}const i=xc.session.get("unacked_stanzas");if(r>i.length){const e="Higher reported acknowledge count than unacknowledged stanzas. "+"Reported Acknowledged Count: ".concat(r," -")+"Unacknowledged Stanza Count: ".concat(i.length," -")+"New: ".concat(t," - Previous: ").concat(n);Lr.error(e)}return xc.session.save({num_stanzas_handled_by_server:t,num_stanzas_since_last_ack:0,unacked_stanzas:i.slice(r)}),!0}function rh(){if(xc.session.get("smacks_enabled")){const e=xc.session.get("num_stanzas_handled"),t=eh.toStanza('<a xmlns="'.concat(Zd.NS.SM,'" h="').concat(e,'"/>'));Tc.send(t)}return!0}function ih(e){if(xc.session.get("smacks_enabled")&&(eh.isTagEqual(e,"iq")||eh.isTagEqual(e,"presence")||eh.isTagEqual(e,"message"))){const e=xc.session.get("num_stanzas_handled");xc.session.save("num_stanzas_handled",e+1)}return!0}function sh(){xc.session.save({smacks_enabled:xc.session.get("smacks_enabled")||!1,num_stanzas_handled:xc.session.get("num_stanzas_handled")||0,num_stanzas_handled_by_server:xc.session.get("num_stanzas_handled_by_server")||0,num_stanzas_since_last_ack:xc.session.get("num_stanzas_since_last_ack")||0,unacked_stanzas:xc.session.get("unacked_stanzas")||[]})}function oh(){xc.session&&xc.session.save({smacks_enabled:!1,num_stanzas_handled:0,num_stanzas_handled_by_server:0,num_stanzas_since_last_ack:0,unacked_stanzas:[]})}function ah(e){const t={smacks_enabled:!0};return["1","true"].includes(e.getAttribute("resume"))&&(t.smacks_stream_id=e.getAttribute("id")),xc.session.save(t),!0}function ch(e){return e.querySelector("item-not-found")?Lr.warn("Could not resume previous SMACKS session, session id not found. A new session will be established."):(Lr.error("Failed to enable stream management"),Lr.error(e.outerHTML)),oh(),Tc.trigger("streamResumptionFailed"),!0}function lh(e){ah(e),nh(e),function(){const e=xc.session.get("unacked_stanzas");xc.session.save("unacked_stanzas",[]),e.forEach(e=>Tc.send(e))}(),xc.connection.do_bind=!1,xc.connection.authenticated=!0,xc.connection.restored=!0,xc.connection._changeConnectStatus(Zd.Status.CONNECTED,null)}async function uh(){if(Tc.settings.get("enable_smacks")&&!xc.session.get("smacks_enabled")&&await th()){const e=eh.getResolveablePromise();xc.connection._addSysHandler(t=>e.resolve(ah(t)),Zd.NS.SM,"enabled"),xc.connection._addSysHandler(t=>e.resolve(ch(t)),Zd.NS.SM,"failed");const t=Tc.connection.isType("websocket")||xc.isTestEnv(),n=eh.toStanza('<enable xmlns="'.concat(Zd.NS.SM,'" resume="').concat(t,'"/>'));Tc.send(n),xc.connection.flush(),await e}}Zd.addNamespace("SM","urn:xmpp:sm:3");const dh=[];async function hh(){if(!Tc.settings.get("enable_smacks"))return;if(!await th())return;const e=xc.connection;for(;dh.length;)e.deleteHandler(dh.pop());dh.push(e.addHandler(ih)),dh.push(e.addHandler(rh,Zd.NS.SM,"r")),dh.push(e.addHandler(nh,Zd.NS.SM,"a")),xc.session.get("smacks_stream_id")?await async function(){const e=eh.getResolveablePromise();xc.connection._addSysHandler(t=>e.resolve(lh(t)),Zd.NS.SM,"resumed"),xc.connection._addSysHandler(t=>e.resolve(ch(t)),Zd.NS.SM,"failed");const t=xc.session.get("smacks_stream_id"),n=xc.session.get("num_stanzas_handled"),r=eh.toStanza('<resume xmlns="'.concat(Zd.NS.SM,'" h="').concat(n,'" previd="').concat(t,'"/>'));Tc.send(r),xc.connection.flush(),await e}():oh()}function fh(e){if(xc.session){if(xc.session.get("smacks_enabled")&&(eh.isTagEqual(e,"iq")||eh.isTagEqual(e,"presence")||eh.isTagEqual(e,"message"))){const t=Zd.serialize(e);xc.session.save("unacked_stanzas",(xc.session.get("unacked_stanzas")||[]).concat([t]));const n=Tc.settings.get("smacks_max_unacked_stanzas");if(n>0){const e=xc.session.get("num_stanzas_since_last_ack")+1;e%n==0&&Tc.send(eh.toStanza('<r xmlns="'.concat(Zd.NS.SM,'"/>'))),xc.session.save({num_stanzas_since_last_ack:e})}}}else Lr.warn("No _converse.session!")}zc.plugins.add("converse-smacks",{initialize(){Tc.settings.extend({enable_smacks:!0,smacks_max_unacked_stanzas:5}),Tc.listen.on("afterResourceBinding",uh),Tc.listen.on("beforeResourceBinding",hh),Tc.listen.on("send",fh),Tc.listen.on("userSessionInitialized",sh)}});
/**
* @module converse-vcard
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:ph,$iq:mh,dayjs:gh}=zc.env,vh=zc.env.utils;zc.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(){function e(e,t,n){const r=mh(t?{type:e,to:t}:{type:e});return n?r.cnode(n):r.c("vCard",{xmlns:ph.NS.VCARD}),r}async function t(t,n){const r=ph.getBareJidFromJid(n)===t.bare_jid?null:n;let i;try{i=await Tc.sendIQ(e("get",r))}catch(i){return{stanza:i,jid:n,vcard_error:(new Date).toISOString()}}return async function(e,t){const n=t.querySelector("vCard");let r={};var i,s,o,a,c,l,u;if(null!==n&&(r={stanza:t,fullname:null===(i=n.querySelector("FN"))||void 0===i?void 0:i.textContent,nickname:null===(s=n.querySelector("NICKNAME"))||void 0===s?void 0:s.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===(u=n.querySelector("EMAIL USERID"))||void 0===u?void 0:u.textContent,vcard_updated:(new Date).toISOString(),vcard_error:void 0}),r.image){const e=vh.base64ToArrayBuffer(r.image),t=await crypto.subtle.digest("SHA-1",e);r.image_hash=vh.arrayBufferToHex(t)}return r}(0,i)}async function n(e){let t;if(e instanceof xc.Message){if("error"===e.get("type"))return;t=e.get("from")}else t=e.get("jid");await Tc.waitUntil("VCardsInitialized"),e.vcard=xc.vcards.findWhere({jid:t}),e.vcard||(e.vcard=xc.vcards.create({jid:t})),e.vcard.on("change",()=>e.trigger("vcard:change"))}async function r(e){await Tc.waitUntil("VCardsInitialized"),["error","info"].includes(e.get("type"))||(e.vcard=function(e){var t;const n=null==e||null===(t=e.collection)||void 0===t?void 0:t.chatbox,r=ph.getResourceFromJid(e.get("from"));if(n&&n.get("nick")===r)return xc.xmppstatus.vcard;{const t=e.occupant&&e.occupant.get("jid")||e.get("from");return t?xc.vcards.findWhere({jid:t})||xc.vcards.create({jid:t}):void Lr.error("Could not assign VCard for message because no JID found! msgid: ".concat(e.get("msgid")))}}(e))}Tc.promises.add("VCardsInitialized"),xc.VCard=Vs.extend({defaults:{image:xc.DEFAULT_IMAGE,image_type:xc.DEFAULT_IMAGE_TYPE},set(e,t,n){let r;return"object"==typeof e?(r=e,n=t):(r={})[e]=t,"image"in r&&!r.image?(r.image=xc.DEFAULT_IMAGE,r.image_type=xc.DEFAULT_IMAGE_TYPE,Vs.prototype.set.call(this,r,n)):Vs.prototype.set.apply(this,arguments)},getDisplayName(){return this.get("nickname")||this.get("fullname")||this.get("jid")}}),xc.VCards=Fo.extend({model:xc.VCard,initialize(){this.on("add",e=>e.get("jid")&&Tc.vcard.update(e))}}),xc.initVCardCollection=async function(){xc.vcards=new xc.VCards,xc.vcards.browserStorage=xc.createStore("".concat(xc.bare_jid,"-converse.vcards")),await new Promise(e=>{xc.vcards.fetch({success:e,error:e},{silent:!0})});const e=xc.vcards;if(xc.session){const t=xc.session.get("bare_jid");xc.xmppstatus.vcard=e.findWhere({jid:t})||e.create({jid:t})}Tc.trigger("VCardsInitialized")},Tc.listen.on("chatBoxInitialized",e=>n(e)),Tc.listen.on("chatRoomInitialized",e=>n(e)),Tc.listen.on("chatRoomMessageInitialized",e=>r(e)),Tc.listen.on("addClientFeatures",()=>Tc.disco.own.features.add(ph.NS.VCARD)),Tc.listen.on("clearSession",()=>{xc.shouldClearCache()&&(Tc.promises.add("VCardsInitialized"),xc.vcards&&(xc.vcards.clearStore(),delete xc.vcards))}),Tc.listen.on("messageInitialized",e=>n(e)),Tc.listen.on("rosterContactInitialized",e=>n(e)),Tc.listen.on("statusInitialized",xc.initVCardCollection),Object.assign(xc.api,{vcard:{async set(t,n){if(!t)throw Error("No jid provided for the VCard data");const r=document.createElement("div"),i=vh.toStanza('\n <vCard xmlns="vcard-temp">\n <FN>'.concat(n.fn,"</FN>\n <NICKNAME>").concat(n.nickname,"</NICKNAME>\n <URL>").concat(n.url,"</URL>\n <ROLE>").concat(n.role,"</ROLE>\n <EMAIL><INTERNET/><PREF/><USERID>").concat(n.email,"</USERID></EMAIL>\n <PHOTO>\n <TYPE>").concat(n.image_type,"</TYPE>\n <BINVAL>").concat(n.image,"</BINVAL>\n </PHOTO>\n </vCard>"),r);let s;try{s=await Tc.sendIQ(e("set",t,i))}catch(e){throw e}return await Tc.vcard.update(t,!0),s},get(e,n){if("string"==typeof e)return t(xc,e);if(!n&&e.get("vcard_updated")&&gh(e.get("vcard_error")).isSame(new Date,"day"))return Promise.resolve({});{const n=e.get("jid");return n||Lr.error("No JID to get vcard for"),t(xc,n)}},async update(e,t){const n=await this.get(e,t);(e="string"==typeof e?xc.vcards.findWhere({jid:e}):e)?(delete n.stanza,e.save(n)):Lr.error("Could not find a VCard model for ".concat(e))}}})}});const _h={};function bh(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <form class="converse-form chatroom-form" @submit=',">\n <legend>",'</legend>\n <fieldset class="form-group">\n <label for="converse_muc_bookmark_name">','</label>\n <input class="form-control" type="text" value="','" name="name" required="required" id="converse_muc_bookmark_name"/>\n </fieldset>\n <fieldset class="form-group">\n <label for="converse_muc_bookmark_nick">','</label>\n <input class="form-control" type="text" name="nick" value="','" id="converse_muc_bookmark_nick"/>\n </fieldset>\n <fieldset class="form-group form-check">\n <input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" name="autojoin"/>\n <label class="form-check-label" for="converse_muc_bookmark_autojoin">','</label>\n </fieldset>\n <fieldset class="form-group">\n <input class="btn btn-primary" type="submit" value="','">\n <input class="btn btn-secondary button-cancel" type="button" value="','" @click=',">\n </fieldset>\n </form>\n "]);return bh=function(){return e},e}Tc.elements={registry:_h,define:function(e,t){this.registry[e]=t},register:function(){Object.keys(_h).forEach(e=>{customElements.get(e)||customElements.define(e,_h[e])})}};const yh=/^\s*</,wh=("undefined"!=typeof Element&&Element.prototype,function(e){this.cid=Li("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),Ht(this,it(e,xh)),this._ensureElement(),this.initialize.apply(this,arguments)});wh.extend=Si;const Sh=/^(\S+)\s*(.*)$/,xh=["model","collection","el","id","attributes","className","tagName","events"];Object.assign(wh.prototype,zi,{tagName:"div",$:function(e){return this.el.querySelectorAll(e)},preinitialize:function(){},initialize:function(){},render:function(){return S(this.beforeRender)&&this.beforeRender(),S(this.toHTML)&&za(this.toHTML(),this.el),S(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(yh.test(e)){const t=document.createElement("div");t.innerHTML=e,this.el=t.firstChild}else this.el=document.querySelector(e);else e&&!Ir(e)&&e.length?this.el=e[0]:this.el=e},delegateEvents:function(e){if(e||(e=wi(this,"events")),!e)return this;this.undelegateEvents();for(const t in e){let n=e[t];if(S(n)||(n=this[n]),!n)continue;const r=t.match(Sh);this.delegate(r[1],r[2],n.bind(this))}return this},delegate:function(e,t,n){const r=this.el;if(!r)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const r=this.el.querySelectorAll(t);for(let t=0,i=r.length;t<i;t++){const i=r[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=r;i=i.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.el.addEventListener(e,i,!1),this._domEvents.push({el:this.el,eventName:e,handler:i,listener:n,selector:t}),this},undelegateEvents:function(){if(this.el){for(let e=0,t=this._domEvents.length;e<t;e++){const t=this._domEvents[e];t.el.removeEventListener(t.eventName,t.handler,!1)}this._domEvents.length=0}return this},undelegate:function(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el){const r=this._domEvents.slice();let i=r.length;for(;i--;){const s=r[i];!(s.eventName!==e||n&&s.listener!==n||t&&s.selector!==t)&&(s.el.removeEventListener(s.eventName,s.handler,!1),this._domEvents.splice(i,1))}}return this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(wi(this,"el"));else{const e=Ht({},wi(this,"attributes"));this.id&&(e.id=wi(this,"id")),this.className&&(e.class=wi(this,"className")),this.setElement(this._createElement(wi(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 Eh=wh.extend({className:"muc-bookmark-form chatroom-form-container",initialize(e){this.chatroomview=e.chatroomview,this.render()},toHTML(){return(e=>{const t=Pu("Bookmark this groupchat"),n=Pu("Would you like this groupchat to be automatically joined upon startup?"),r=Pu("Cancel"),i=Pu("The name for this bookmark:"),s=Pu("What should your nickname for this groupchat be?"),o=Pu("Save");return Fa(bh(),e.onSubmit,t,i,e.name,s,e.nick||"",n,o,r,e.onCancel)})(Object.assign(this.model.toJSON(),{onCancel:e=>this.closeBookmarkForm(e),onSubmit:e=>this.onBookmarkFormSubmitted(e)}))},onBookmarkFormSubmitted(e){var t,n,r;e.preventDefault(),xc.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===(r=e.target.querySelector("input[name=nick]"))||void 0===r?void 0:r.value}),this.closeBookmarkForm(e)},closeBookmarkForm(e){e.preventDefault(),this.chatroomview.closeForm()}});function Ah(){const e=Th(['\n <div class="list-container list-container--bookmarks ','">\n <a class="list-toggle bookmarks-toggle controlbox-padded"\n title="','"\n @click=','>\n\n <span class="fa ','">\n </span> ','</a>\n <div class="items-list bookmarks rooms-list ','">\n ',"\n </div>\n </div>\n "]);return Ah=function(){return e},e}function Ch(){const e=Th(['\n <div class="list-item controlbox-padded room-item available-chatroom d-flex flex-row ','" data-room-jid="','">\n <a class="list-item-link open-room w-100" data-room-jid="','"\n title="','"\n @click=',">",'</a>\n\n <a class="list-item-action remove-bookmark fa fa-bookmark align-self-center ','"\n data-room-jid="','"\n data-bookmark-name="','"\n title="','"\n @click=',"></a>\n </div>\n "]);return Ch=function(){return e},e}function Th(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Oh=e=>{const t=Pu("Click to toggle the bookmarks list"),n=Pu("Bookmarks");return Fa(Ah(),e.hidden?"":"hidden",t,e.toggleBookmarksList,e.toggle_state===e._converse.OPENED?"fa-caret-down":"fa-caret-right",n,e.toggle_state!==e._converse.OPENED?"hidden":"",e.bookmarks.map(t=>(e=>{const t=Pu("Unbookmark this groupchat"),n=Pu("Click to open this groupchat");return Fa(Ch(),e.is_hidden(e.bm)?"hidden":"",e.bm.get("jid"),e.bm.get("jid"),n,e.openRoom,e.bm.getDisplayName(),e.bm.get("bookmarked")?"button-on":"",e.bm.get("jid"),e.bm.getDisplayName(),t,e.removeBookmark)})(Object.assign({bm:t},e))))};const{Strophe:jh}=zc.env,kh=zc.env.utils;var Nh=wh.extend({tagName:"span",initialize(){this.listenTo(this.model,"add",this.render),this.listenTo(this.model,"remove",this.render),this.listenTo(xc.chatboxes,"add",this.render),this.listenTo(xc.chatboxes,"remove",this.render);const e="converse.room-bookmarks".concat(xc.bare_jid,"-list-model");this.list_model=new xc.BookmarksList({id:e}),this.list_model.browserStorage=xc.createStore(e);const t=()=>{this.render(),this.insertIntoControlBox()};this.list_model.fetch({success:t,error:t})},toHTML(){return Oh({_converse:xc,bookmarks:this.model,hidden:this.model.getUnopenedBookmarks().length&&!0,is_hidden:e=>!(!Tc.settings.get("hide_open_bookmarks")||!xc.chatboxes.get(e.get("jid"))),openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),toggleBookmarksList:e=>this.toggleBookmarksList(e),toggle_state:this.list_model.get("toggle-state")})},insertIntoControlBox(){const e=xc.chatboxviews.get("controlbox");if(void 0!==e&&!kh.rootContains(xc.root,this.el)){const t=e.el.querySelector(".list-container--bookmarks");t&&t.parentNode.replaceChild(this.el,t)}},openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),r={name:t||jh.unescapeNode(jh.getNodeFromJid(n))||n};Tc.rooms.open(n,r,!0)},removeBookmark(e){xc.removeBookmarkViaEvent(e)},toggleBookmarksList(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");kh.hasClass("fa-caret-down",t)?(kh.slideIn(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":xc.CLOSED}),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")):(t.classList.remove("fa-caret-right"),t.classList.add("fa-caret-down"),kh.slideOut(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":xc.OPENED}))}}),Mh=lt((function(e,t,n){var r=-1,i="function"==typeof t,s=St(e)?Array(e.length):[];return Ks(e,(function(e){s[++r]=i?Xe(t,e,n):ct(e,t,n)})),s}));const{u:Ih}=zc.env,Rh={setBookmarkState(){if(void 0!==xc.bookmarks){xc.bookmarks.where({jid:this.model.get("jid")}).length?this.model.save("bookmarked",!0):this.model.save("bookmarked",!1)}},renderBookmarkForm(){if(this.hideChatRoomContents(),!this.bookmark_form){this.bookmark_form=new xc.MUCBookmarkForm({model:this.model,chatroomview:this}),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)}Ih.showElement(this.bookmark_form.el)},toggleBookmark(e){null==e||e.preventDefault();const t=xc.bookmarks.where({jid:this.model.get("jid")});t.length?t.forEach(e=>e.destroy()):this.renderBookmarkForm()}},Dh={removeBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-bookmark-name"),n=e.target.getAttribute("data-room-jid");confirm(Pu('Are you sure you want to remove the bookmark "%1$s"?',t))&&Mh(xc.bookmarks.where({jid:n}),Vs.prototype.destroy)},addBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid");Tc.rooms.open(t,{bring_to_foreground:!0}),xc.chatboxviews.get(t).renderBookmarkForm()}},Lh=async function(){await Tc.waitUntil("roomsPanelRendered"),xc.bookmarksview=new xc.BookmarksView({model:xc.bookmarks}),Tc.trigger("bookmarkViewsInitialized")};zc.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Tc.settings.extend({hide_open_bookmarks:!0}),Object.assign(xc,Dh),Object.assign(xc.ChatRoomView.prototype,Rh),xc.MUCBookmarkForm=Eh,xc.BookmarksView=Nh,Tc.listen.on("getHeadingButtons",(e,t)=>{if(xc.allow_bookmarks&&e.model.get("type")===xc.CHATROOMS_TYPE){const n=e.model.get("bookmarked"),r={i18n_title:Pu(n?"Unbookmark this groupchat":"Bookmark this groupchat"),i18n_text:Pu(n?"Unbookmark":"Bookmark"),handler:t=>e.toggleBookmark(t),a_class:"toggle-bookmark",icon_class:"fa-bookmark",name:"bookmark"},i=t.map(e=>e.name).indexOf("details"),s=$u().then(e=>e?r:"");return i>-1?[...t.slice(0,i),s,...t.slice(i)]:[s,...t]}return t}),Tc.listen.on("bookmarksInitialized",Lh),Tc.listen.on("chatRoomViewInitialized",e=>e.setBookmarkState())}});var zh=n(32),Ph=n.n(zh);function Fh(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <audio controls src="','"></audio>\n <a target="_blank" rel="noopener" href="','">',"</a>\n"]);return Fh=function(){return e},e}function Bh(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<a target="_blank" rel="noopener" href="','">',"</a>"]);return Bh=function(){return e},e}var Hh=e=>Fa(Bh(),e.url,e.label_download);function qh(){const e=Vh(["<label>","</label>"]);return qh=function(){return e},e}function Uh(){const e=Vh(['\n <fieldset class="form-group">\n ','\n <img src="data:',";base64,",'">\n <input name="','" type="text" ?required="','" />\n </fieldset>\n']);return Uh=function(){return e},e}function Vh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function $h(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <fieldset class="form-group">\n <input id="','" name="','" type="checkbox" ?checked='," ?required=",' />\n <label class="form-check-label" for="','">',"</label>\n </fieldset>"]);return $h=function(){return e},e}function Gh(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<p class="form-help">',"</p>"]);return Gh=function(){return e},e}function Wh(){const e=Qh(['\n <input class="hidden-username" type="text" autocomplete="username" value="','"></input>\n ']);return Wh=function(){return e},e}function Jh(){const e=Qh(['<label for="','">',"</label>"]);return Jh=function(){return e},e}function Xh(){const e=Qh(['\n <div class="form-group">\n ',"\n\n \x3c!-- This is a hack to prevent Chrome from auto-filling the username in\n any of the other input fields in the MUC configuration form. --\x3e\n ",'\n\n <input\n autocomplete="','"\n class="form-control"\n id="','"\n name="','"\n placeholder="','"\n type="','"\n value="','"\n ?required='," />\n </div>"]);return Xh=function(){return e},e}function Qh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Yh=e=>Fa(Xh(),"hidden"!==e.type?Fa(Jh(),e.id,e.label):"","password"===e.type&&e.fixed_username?Fa(Wh(),e.fixed_username):"",e.autocomplete||"",e.id,e.name,e.placeholder||"",e.type,e.value||"",e.required);function Kh(){const e=ef(['\n <div class="form-group">\n <label for="','">','</label>\n <select class="form-control" id="','" name="','" ?multiple="','">\n ',"\n </select>\n </div>"]);return Kh=function(){return e},e}function Zh(){const e=ef(['<option value="','" ?selected="','">',"</option>"]);return Zh=function(){return e},e}function ef(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var tf=e=>{var t;return Fa(Kh(),e.id,e.label,e.id,e.name,e.multiple,null===(t=e.options)||void 0===t?void 0:t.map(e=>(e=>Fa(Zh(),e.value,e.selected,e.label))(e)))};function nf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <label class="label-ta">','</label>\n <textarea name="','">',"</textarea>\n"]);return nf=function(){return e},e}function rf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n <label>",'\n <a class="form-url" target="_blank" rel="noopener" href="','">',"</a>\n </label>"]);return rf=function(){return e},e}var sf=e=>Fa(rf(),e.label,e.value,e.value);function of(){const e=cf(["<label>","</label>"]);return of=function(){return e},e}function af(){const e=cf(['\n <div class="form-group">\n ','\n <div class="input-group">\n <div class="input-group-prepend">\n <input name="','"\n type="','"\n value="','"\n ?required="','" />\n <div class="input-group-text col" title="','">',"</div>\n </div>\n </div>\n </div>"]);return af=function(){return e},e}function cf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var lf=e=>Fa(af(),e.label?Fa(of(),e.label):"",e.name,e.type,e.value||"",e.required,e.domain,e.domain);function uf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<a href="','"\n class="chat-image__link"\n target="_blank"\n rel="noopener"\n ><img class="chat-image img-thumbnail" src="','" @click='," @error="," @load=","/></a>"]);return uf=function(){return e},e}const df=ga((e,t,n,r)=>i=>{i.setValue(Fa(uf(),t,e,r,(function(){const s=zc.env.utils;s.isURLWithImageExtension(e)?(i.setValue(s.convertUrlToHyperlink(t)),i.commit()):(i.setValue(df("".concat(e,".png"),t,n,r)),i.commit())}),n))});function hf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["",""]);return hf=function(){return e},e}function ff(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<video controls preload="metadata" src="','" style="max-height: 50vh"></video>']);return ff=function(){return e},e}function pf(){const e=gf(['<a target="_blank" rel="noopener" href="','">',"</a>"]);return pf=function(){return e},e}function mf(){const e=gf(['\n <a target="_blank"\n rel="noopener"\n @click=','\n href="','">',"</a>"]);return mf=function(){return e},e}function gf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the DOM/HTML utilities module.
*/const{sizzle:vf}=zc.env,_f=["http","https","xmpp","mailto"];function bf(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":(null==t?void 0:t.new_password)?"new-password":"current-password"}[e]}const yf={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"};function wf(e){try{return e instanceof Ph.a?e:new Ph.a(e)}catch(e){return Lr.debug(e),null}}function Sf(e,t){const n=wf(t);if(null===n||!function(e){return"http:"===window.location.protocol||"https:"===window.location.protocol&&"https"===e.protocol().toLowerCase()}(n))return!1;const r=n.filename().toLowerCase();return!!e.filter(e=>r.endsWith(e)).length}function xf(e){try{return decodeURI(e.filename())}catch(t){return Lr.debug(t),e.filename()}}function Ef(e,t){const{__:n}=e;return r={url:t.toString(),label_download:n('Download audio file "%1$s"',xf(t))},Fa(Fh(),r.url,r.url,r.label_download);var r}function Af(e){e.preventDefault(),Tc.rooms.open(e.target.href)}function Cf(e,t){e.classList.remove("visible"),S(t)&&t()}Xs.isAudioURL=e=>Sf([".ogg",".mp3",".m4a"],e),Xs.isVideoURL=e=>Sf([".mp4",".webm"],e),Xs.isURLWithImageExtension=e=>Sf([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".svg"],e),Xs.isImageURL=e=>{const t=Tc.settings.get("image_urls_regex");return(null==t?void 0:t.test(e))||Xs.isURLWithImageExtension(e)},Xs.isImageDomainAllowed=e=>{const t=Tc.settings.get("show_images_inline");if(!Array.isArray(t))return!0;try{const n=wf(e).domain();return t.includes(n)}catch(e){return Lr.debug(e),!0}},Xs.getOOBURLMarkup=function(e,t){const n=wf(t);return null===n?t:Xs.isVideoURL(n)?(r={url:t},Fa(ff(),r.url)):Xs.isAudioURL(n)?Ef(e,n):Xs.isImageURL(n)?function(e,t){const{__:n}=e;return Hh({url:t.toString(),label_download:n('Download image file "%1$s"',xf(t))})}(e,n):function(e,t){const{__:n}=e;return Hh({url:t.toString(),label_download:n('Download file "%1$s"',xf(t))})}(e,n);var r},Xs.calculateElementHeight=function(e){return Array.from(e.children).reduce((e,t)=>e+t.offsetHeight,0)},Xs.getNextElement=function(e,t="*"){let n=e.nextElementSibling;for(;null!==n&&!vf.matchesSelector(n,t);)n=n.nextElementSibling;return n},Xs.getPreviousElement=function(e,t="*"){let n=e.previousElementSibling;for(;null!==n&&!vf.matchesSelector(n,t);)n=n.previousElementSibling;return n},Xs.getFirstChildElement=function(e,t="*"){let n=e.firstElementChild;for(;null!==n&&!vf.matchesSelector(n,t);)n=n.nextElementSibling;return n},Xs.getLastChildElement=function(e,t="*"){let n=e.lastElementChild;for(;null!==n&&!vf.matchesSelector(n,t);)n=n.previousElementSibling;return n},Xs.hasClass=function(e,t){return t instanceof Element&&t.classList.contains(e)},Xs.toggleClass=function(e,t){Xs.hasClass(e,t)?Xs.removeClass(e,t):Xs.addClass(e,t)},Xs.addClass=function(e,t){return t instanceof Element&&t.classList.add(e),t},Xs.removeClass=function(e,t){return t instanceof Element&&t.classList.remove(e),t},Xs.removeElement=function(e){return e instanceof Element&&e.parentNode&&e.parentNode.removeChild(e),e},Xs.getElementFromTemplateResult=function(e){const t=document.createElement("div");return za(e,t),t.firstElementChild},Xs.showElement=e=>{Xs.removeClass("collapsed",e),Xs.removeClass("hidden",e)},Xs.hideElement=function(e){return e instanceof Element&&e.classList.add("hidden"),e},Xs.ancestor=function(e,t){let n=e;for(;null!==n&&!vf.matchesSelector(n,t);)n=n.parentElement;return n},Xs.nextUntil=function(e,t){const n=[];let r=e.nextElementSibling;for(;null!==r&&!r.matches(t);)n.push(r),r=r.nextElementSibling;return n},Xs.unescapeHTML=function(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText},Xs.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},Xs.convertToImageTag=function(e,t,n){return r={url:e,onClick:n,onLoad:t},Fa(hf(),df(r.url,r.url,r.onLoad,r.onClick));var r},Xs.convertURIoHyperlink=function(e,t){let n=e.normalize()._string;const r=e._parts.urn?n:e.readable(),i=t||r;return e._parts.protocol||n.startsWith("http://")||n.startsWith("https://")||(n="http://"+n),"xmpp"===e._parts.protocol&&"join"===e._parts.query?Fa(mf(),Af,n,i):Fa(pf(),n,i)},Xs.convertUrlToHyperlink=function(e){const t=RegExp("^w{3}.","ig").test(e)?"http://".concat(e):e,n=wf(e);return null===n||!function(e){try{return!!new URL(e)}catch(e){return!1}}(t)||!function(e,t=_f){return!!t.includes(e)}(n._parts.protocol)&&n._parts.protocol?e:this.convertURIoHyperlink(n,e)},Xs.filterQueryParamsFromURL=function(e){const t=Tc.settings.get("filter_url_query_params");return t?wf(e).removeQuery(t).toString():e},Xs.addHyperlinks=function(e){const t=[],n={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi};try{Ph.a.withinString(e,(e,n,r)=>(t.push({url:e,start:n,end:r}),e),n)}catch(t){return Lr.debug(t),[e]}let r=[e];return t.length?t.sort((e,t)=>t.start-e.start).forEach(e=>{const t=r.shift(),n=t.slice(e.start,e.end);r=[t.slice(0,e.start),Xs.convertUrlToHyperlink(n),t.slice(e.end),...r]}):r=[e],r},Xs.httpToGeoUri=function(e,t){return e.replace(t.api.settings.get("geouri_regex"),"geo:$1,$2")},Xs.slideInAllElements=function(e,t=300){return Promise.all(Array.from(e).map(e=>Xs.slideIn(e,t)))},Xs.slideToggleElement=function(e,t){return Xs.hasClass("collapsed",e)||Xs.hasClass("hidden",e)?Xs.slideOut(e,t):Xs.slideIn(e,t)},Xs.slideOut=function(e,t=200){return new Promise((n,r)=>{if(!e){const e="An element needs to be passed in to slideOut";return Lr.warn(e),void r(new Error(e))}const i=e.getAttribute("data-slider-marker");i&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(i));const s=Xs.calculateElementHeight(e);if(window.converse_disable_effects)return e.style.height=s+"px",function(e){e.removeAttribute("data-slider-marker"),e.classList.remove("collapsed"),e.style.overflow="",e.style.height=""}(e),void n();if(!Xs.hasClass("collapsed",e)&&!Xs.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+=s/o,a<s?(e.style.height=a+"px",e.setAttribute("data-slider-marker",window.requestAnimationFrame(t))):(e.removeAttribute("data-slider-marker"),e.style.height=Xs.calculateElementHeight(e)+"px",e.style.overflow="",e.style.height="",n())})))})},Xs.slideIn=function(e,t=200){return new Promise((n,r)=>{if(!e){const e="An element needs to be passed in to slideIn";return Lr.warn(e),r(new Error(e))}if(Xs.hasClass("collapsed",e))return n(e);if(window.converse_disable_effects)return e.classList.add("collapsed"),e.style.height="",n(e);const i=e.getAttribute("data-slider-marker");i&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(i));const s=e.offsetHeight,o=t/17;let a=s;e.style.overflow="hidden",e.setAttribute("data-slider-marker",window.requestAnimationFrame((function t(){a-=s/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))})))})},Xs.isInDOM=function(e){return document.querySelector("body").contains(e)},Xs.isVisible=function(e){return null!==e&&(!Xs.hasClass("hidden",e)&&(e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0))},Xs.fadeIn=function(e,t){if(e||Lr.warn("An element needs to be passed in to fadeIn"),window.converse_disable_effects)return e.classList.remove("hidden"),Cf(e,t);Xs.hasClass("hidden",e)?(e.classList.add("visible"),e.classList.remove("hidden"),e.addEventListener("webkitAnimationEnd",()=>Cf(e,t)),e.addEventListener("animationend",()=>Cf(e,t)),e.addEventListener("oanimationend",()=>Cf(e,t))):Cf(e,t)},Xs.xForm2TemplateResult=function(e,t,n){if("list-single"===e.getAttribute("type")||"list-multi"===e.getAttribute("type")){const t=Xs.queryChildren(e,"value").map(e=>null==e?void 0:e.textContent),n=Xs.queryChildren(e,"option").map(n=>{var r;const i=null===(r=n.querySelector("value"))||void 0===r?void 0:r.textContent;return{value:i,label:n.getAttribute("label"),selected:t.includes(i),required:!!e.querySelector("required")}});return tf({options:n,id:Xs.getUniqueId(),label:e.getAttribute("label"),multiple:"list-multi"===e.getAttribute("type"),name:e.getAttribute("var"),required:!!e.querySelector("required")})}if("fixed"===e.getAttribute("type")){var r;const t=null===(r=e.querySelector("value"))||void 0===r?void 0:r.textContent;return a={text:t},Fa(Gh(),a.text)}var i,s,o,a;if("jid-multi"===e.getAttribute("type"))return(e=>Fa(nf(),e.label,e.name,e.value))({name:e.getAttribute("var"),label:e.getAttribute("label")||"",value:null===(i=e.querySelector("value"))||void 0===i?void 0:i.textContent,required:!!e.querySelector("required")});if("boolean"===e.getAttribute("type")){var c;const t=null===(c=e.querySelector("value"))||void 0===c?void 0:c.textContent;return(e=>Fa($h(),e.id,e.name,e.checked,e.required,e.id,e.label))({id:Xs.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 sf({label:e.getAttribute("label")||"",value:null===(s=e.querySelector("value"))||void 0===s?void 0:s.textContent});if("username"===e.getAttribute("var"))return lf({domain:" @"+n.domain,name:e.getAttribute("var"),type:yf[e.getAttribute("type")],label:e.getAttribute("label")||"",value:null===(o=e.querySelector("value"))||void 0===o?void 0:o.textContent,required:!!e.querySelector("required")});if("ocr"===e.getAttribute("var")){const n=e.querySelector("uri"),r=vf('data[cid="'+n.textContent.replace(/^cid:/,"")+'"]',t)[0];return(e=>Fa(Uh(),e.label?Fa(qh(),e.label):"",e.type,e.data,e.name,e.required))({label:e.getAttribute("label"),name:e.getAttribute("var"),data:null==r?void 0:r.textContent,type:n.getAttribute("type"),required:!!e.querySelector("required")})}{var l;const t=e.getAttribute("var");return Yh({id:Xs.getUniqueId(),label:e.getAttribute("label")||"",name:t,fixed_username:null==n?void 0:n.fixed_username,autocomplete:bf(t,n),placeholder:null,required:!!e.querySelector("required"),type:yf[e.getAttribute("type")],value:null===(l=e.querySelector("value"))||void 0===l?void 0:l.textContent})}};var Tf=Xs;const{keycodes:Of}=zc;function jf(e){let t=0;do{isNaN(e.offsetTop)||(t+=e.offsetTop)}while(e=e.offsetParent);return t}function kf(e){let t=0;do{isNaN(e.offsetLeft)||(t+=e.offsetLeft)}while(e=e.offsetParent);return t}class Nf{static get DIRECTION(){return{down:"down",end:"end",home:"home",left:"left",right:"right",up:"up"}}static get DEFAULTS(){return{home:["".concat(Of.SHIFT,"+").concat(Of.UP_ARROW)],end:["".concat(Of.SHIFT,"+").concat(Of.DOWN_ARROW)],up:[Of.UP_ARROW],down:[Of.DOWN_ARROW],left:[Of.LEFT_ARROW,"".concat(Of.SHIFT,"+").concat(Of.TAB)],right:[Of.RIGHT_ARROW,Of.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 r=t(n);return r<e.distance?{distance:r,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({},Nf.DEFAULTS,t),this.init()}init(){this.selected=null,this.keydownHandler=null,this.elements={},this.keys={},this.options.down.forEach(e=>this.keys[e]=Nf.DIRECTION.down),this.options.end.forEach(e=>this.keys[e]=Nf.DIRECTION.end),this.options.home.forEach(e=>this.keys[e]=Nf.DIRECTION.home),this.options.left.forEach(e=>this.keys[e]=Nf.DIRECTION.left),this.options.right.forEach(e=>this.keys[e]=Nf.DIRECTION.right),this.options.up.forEach(e=>this.keys[e]=Nf.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===Nf.DIRECTION.home)t=this.getElements(e)[0];else if(e===Nf.DIRECTION.end)t=Array.from(this.getElements(e)).pop();else if(this.selected)if(e===Nf.DIRECTION.right){const n=this.getElements(e);t=n.slice(n.indexOf(this.selected))[1]}else if(e==Nf.DIRECTION.left){const n=this.getElements(e);t=n.slice(0,n.indexOf(this.selected)).pop()||this.selected}else if(e==Nf.DIRECTION.down){const e=this.selected.offsetLeft,n=this.selected.offsetTop+this.selected.offsetHeight,r=this.elementsAfter(0,n),i=t=>Math.abs(t.offsetLeft-e)+Math.abs(t.offsetTop-n);t=Nf.getClosestElement(r,i)}else{if(e!=Nf.DIRECTION.up)throw new Error("getNextElement: invalid direction value");{const e=this.selected.offsetLeft,n=this.selected.offsetTop-1,r=this.elementsBefore(1/0,n),i=t=>Math.abs(e-t.offsetLeft)+Math.abs(n-t.offsetTop);t=Nf.getClosestElement(r,i)}}else t=e===Nf.DIRECTION.right||e===Nf.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():Tf.addClass(this.options.selected,e),this.selected=e,this.options.onSelected&&this.options.onSelected(e))}unselect(){this.selected&&(Tf.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 Nf.DIRECTION.left:document.body.scrollLeft=kf(e)-document.body.offsetLeft;break;case Nf.DIRECTION.up:document.body.scrollTop=jf(e)-document.body.offsetTop;break;case Nf.DIRECTION.right:document.body.scrollLeft=kf(e)-document.body.offsetLeft-(document.documentElement.clientWidth-e.offsetWidth);break;case Nf.DIRECTION.down:document.body.scrollTop=jf(e)-document.body.offsetTop-(document.documentElement.clientHeight-e.offsetHeight)}}else{const n=this.scroll_container;if(!n.contains(e))return;switch(t){case Nf.DIRECTION.left:n.scrollLeft=e.offsetLeft-n.offsetLeft,n.scrollTop=e.offsetTop-n.offsetTop;break;case Nf.DIRECTION.up:n.scrollTop=e.offsetTop-n.offsetTop;break;case Nf.DIRECTION.right:n.scrollLeft=e.offsetLeft-n.offsetLeft-(n.offsetWidth-e.offsetWidth),n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight);break;case Nf.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(Nf.DIRECTION.down).filter(n=>n.offsetLeft>=e&&n.offsetTop>=t)}elementsBefore(e,t){return this.getElements(Nf.DIRECTION.up).filter(n=>n.offsetLeft<=e&&n.offsetTop<=t)}handleKeydown(e){const t=Of,n=e.shiftKey?this.keys["".concat(t.SHIFT,"+").concat(e.which)]:this.keys[e.which];if(n){e.preventDefault(),e.stopPropagation();const t=this.getNextElement(n,e);this.select(t,n)}}}var Mf=Nf;
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/const If=new WeakMap,Rf=ga((...e)=>t=>{let n=If.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},If.set(t,n));const r=n.values;let i=r.length;n.values=e;for(let s=0;s<e.length&&!(s>n.lastRenderedIndex);s++){const o=e[s];if(xa(o)||"function"!=typeof o.then){t.setValue(o),n.lastRenderedIndex=s;break}s<i&&o===r[s]||(n.lastRenderedIndex=2147483647,i=0,Promise.resolve(o).then(e=>{const r=n.values.indexOf(o);r>-1&&r<n.lastRenderedIndex&&(n.lastRenderedIndex=r,t.setValue(e),t.commit())}))}});function Df(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="dropleft">\n <button type="button" class="btn btn--transparent btn--standalone" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n <i class="',' only-icon"></i>\n </button>\n <div class="dropdown-menu">\n ',"\n </div>\n </div>\n "]);return Df=function(){return e},e}const Lf=zc.env.utils;class zf extends rc{firstUpdated(){this.menu=this.querySelector(".dropdown-menu"),this.dropdown=this.firstElementChild,this.button=this.dropdown.querySelector("button"),this.dropdown.addEventListener("click",e=>this.toggleMenu(e)),this.dropdown.addEventListener("keyup",e=>this.handleKeyUp(e)),document.addEventListener("click",e=>!this.contains(e.composedPath()[0])&&this.hideMenu(e))}hideMenu(){var e,t;Lf.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(){Lf.addClass("show",this.menu),this.button.setAttribute("aria-expanded",!0)}toggleMenu(e){e.preventDefault(),Lf.hasClass("show",this.menu)?this.hideMenu():this.showMenu()}handleKeyUp(e){e.keyCode===zc.keycodes.ESCAPE?this.hideMenu():e.keyCode===zc.keycodes.DOWN_ARROW&&this.navigator&&!this.navigator.enabled&&this.enableArrowNavigation(e)}}function Pf(){const e=Hf(['<converse-dropdown class="chat-msg__actions" .items=',"></converse-dropdown>"]);return Pf=function(){return e},e}function Ff(){const e=Hf(['\n <button class="chat-msg__action ','" @click=','>\n <converse-icon class="','"\n path-prefix="','"\n color="var(--text-color-lighten-15-percent)"\n size="1em"></converse-icon>\n ',"\n </button>\n "]);return Ff=function(){return e},e}function Bf(){const e=Hf(["",""]);return Bf=function(){return e},e}function Hf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-dropdown",class extends zf{static get properties(){return{icon_classes:{type:String},items:{type:Array}}}render(){const e=this.icon_classes||"fa fa-bars";return Fa(Df(),e,this.items.map(e=>Rf(e,"")))}hideMenu(){super.hideMenu(),this.navigator.disable()}firstUpdated(){super.firstUpdated(),this.initArrowNavigation()}initArrowNavigation(){if(!this.navigator){const e={selector:".dropdown-item",onSelected:e=>e.focus()};this.navigator=new Mf(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!==zc.keycodes.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}});class qf extends rc{static get properties(){return{chatview:{type:Object},model:{type:Object},editable:{type:Boolean},correcting:{type:Boolean},message_type:{type:String},is_retracted:{type:Boolean}}}render(){return Fa(Bf(),Rf(this.renderActions(),""))}static getActionsDropdownItem(e){return Fa(Ff(),e.button_class,e.handler,e.icon_class,Tc.settings.get("assets_path"),e.i18n_text)}onMessageEditButtonClicked(e){e.preventDefault(),this.chatview.onMessageEditButtonClicked(this.model)}onMessageRetractButtonClicked(e){e.preventDefault(),this.chatview.onMessageRetractButtonClicked(this.model)}async getActionButtons(){const e=[];this.editable&&e.push({i18n_text:this.correcting?Pu("Cancel Editing"):Pu("Edit"),handler:e=>this.onMessageEditButtonClicked(e),button_class:"chat-msg__action-edit",icon_class:"fa fa-pencil-alt",name:"edit"});const t="groupchat"===this.model.get("type")&&await this.model.mayBeModerated();return!this.is_retracted&&(this.model.mayBeRetracted()||t)&&e.push({i18n_text:Pu("Retract"),handler:e=>this.onMessageRetractButtonClicked(e),button_class:"chat-msg__action-retract",icon_class:"fas fa-trash-alt",name:"retract"}),Tc.hook("getMessageActionButtons",this,e)}async renderActions(){const e=(await this.getActionButtons()).map(e=>qf.getActionsDropdownItem(e));return e.length?Fa(Pf(),e):""}}Tc.elements.define("converse-message-actions",qf);var Uf=n(31),Vf=n.n(Uf);function $f(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<div class="alert ','" role="alert"><p>',"</p></div>"]);return $f=function(){return e},e}const{sizzle:Gf}=zc.env,Wf=zc.env.utils;var Jf=wh.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=Vf.a.Modal;this.modal=new n(this.el,{backdrop:!0,keyboard:!0}),this.el.addEventListener("hide.bs.modal",()=>this.onHide(),!1)},onHide(){Wf.removeClass("selected",this.trigger_el),!this.persistent&&Tc.modal.remove(this)},insertIntoDOM(){xc.chatboxviews.el.querySelector("#converse-modals").insertAdjacentElement("beforeEnd",this.el)},switchTab(e){e.stopPropagation(),e.preventDefault(),Gf(".nav-link.active",this.el).forEach(e=>{Wf.removeClass("active",this.el.querySelector(e.getAttribute("href"))),Wf.removeClass("active",e)}),Wf.addClass("active",e.target),Wf.addClass("active",this.el.querySelector(e.target.getAttribute("href")))},alert(e,t="primary"){const n=this.el.querySelector(".modal-alert");if(null===n)return void Lr.error("Could not find a .modal-alert element in the modal to show an alert message in!");var r;za((r={type:"alert-".concat(t),message:e},Fa($f(),r.type,r.message)),n);const i=n.firstElementChild;setTimeout(()=>{Wf.addClass("fade-out",i),setTimeout(()=>Wf.removeElement(i),600)},5e3)},show(e){e&&(e.preventDefault(),this.trigger_el=e.target,this.trigger_el.classList.add("selected")),this.modal.show()}});function Xf(){const e=Yf(['<button type="button" class="close" data-dismiss="modal" aria-label="','"><span aria-hidden="true">×</span></button>']);return Xf=function(){return e},e}function Qf(){const e=Yf(['<button type="button" class="btn btn-secondary" data-dismiss="modal">',"</button>"]);return Qf=function(){return e},e}function Yf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Kf=Fa(Qf(),Pu("Close")),Zf=Fa(Xf(),Pu("Close"));function ep(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="modal-dialog fit-content" role="document">\n <div class="modal-content fit-content">\n <div class="modal-header">\n <h4 class="modal-title" id="message-versions-modal-label">','<a target="_blank" rel="noopener" href="','">',"</a></h4>\n ",'\n </div>\n <div class="modal-body modal-body--image fit-content">\n <img class="chat-image" src="','" @load=','>\n </div>\n <div class="modal-footer">',"</div>\n </div>\n </div>"]);return ep=function(){return e},e}var tp=Jf.extend({id:"image-modal",toHTML(){return e={src:this.src,onload:e=>e.target.parentElement.style.height="".concat(e.target.height,"px")},Fa(ep(),Pu("Image: "),e.src,e.src,Zf,e.src,e.onload,Kf);var e}});function np(){const e=ip(["",""]);return np=function(){return e},e}function rp(){const e=ip(["",""]);return rp=function(){return e},e}function ip(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const sp=ga((e,t,n)=>r=>r.setValue(function(e,t,n){const r=new Tp(e,t,n,!1);return Fa(rp(),Rf(async function(e){return await e.addTemplates(),e.payload}(r),Fa(np(),r)))}(e,t,n)));function op(){const e=hp(['<span class="styling-directive">*</span><b>','</b><span class="styling-directive">*</span>']);return op=function(){return e},e}function ap(){const e=hp(['<span class="styling-directive">~</span><del>','</del><span class="styling-directive">~</span>']);return ap=function(){return e},e}function cp(){const e=hp(["<blockquote>","</blockquote>"]);return cp=function(){return e},e}function lp(){const e=hp(['<div class="styling-directive">```</div><code class="block">','</code><div class="styling-directive">```</div>'],['<div class="styling-directive">\\`\\`\\`</div><code class="block">','</code><div class="styling-directive">\\`\\`\\`</div>']);return lp=function(){return e},e}function up(){const e=hp(['<span class="styling-directive">`</span><code>','</code><span class="styling-directive">`</span>'],['<span class="styling-directive">\\`</span><code>','</code><span class="styling-directive">\\`</span>']);return up=function(){return e},e}function dp(){const e=hp(['<span class="styling-directive">_</span><i>','</i><span class="styling-directive">_</span>']);return dp=function(){return e},e}function hp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Utility functions to help with parsing XEP-393 message styling hints
* @todo Other parsing helpers can be made more abstract and placed here.
*/const fp=["*","_","~","`","```",">"],pp={"*":{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"}},mp=["_",">","`","~"],gp={emphasis:(e,t,n)=>Fa(dp(),sp(e,t,n)),preformatted:e=>Fa(up(),e),preformatted_block:e=>Fa(lp(),e),quote:(e,t,n)=>Fa(cp(),sp(e,t,n)),strike:(e,t,n)=>Fa(ap(),sp(e,t,n)),strong:(e,t,n)=>Fa(op(),sp(e,t,n))};function vp(e,t,n=!0){let r;if(!/(^```\s*\n|^```\s*$)/.test(e.slice(t))||0!==t&&"\n"!==e[t-1]&&">"!==e[t-1]){if(!fp.includes(e.slice(t,t+1)))return null;if(r=e.slice(t,t+1),!function(e,t,n,r){if(r){const r=RegExp(mp.includes(e)?"^(\\p{L}|\\p{N})".concat(e):"^(\\p{L}|\\p{N})\\".concat(e),"u");if(n>1&&r.test(t.slice(n-1)))return!1;const i=yp(e);if(i&&n>0&&"\n"!==t[n-1])return!1;if(!i&&e===t[n+1])return!1}else{const r=RegExp(mp.includes(e)?"^".concat(e,"(\\p{L}|\\p{N})"):"^\\".concat(e,"(\\p{L}|\\p{N})"),"u");if(n<t.length-1&&r.test(t.slice(n)))return!1}return!0}(r,e,t,n))return null}else r=e.slice(t,t+3);return r}function _p(e,t,n){const r=pp[e].type;return t===n.length||vp(n,t,!1)===e||"span"===r&&"\n"===n[t]}function bp(e,t){const n=vp(e,t),r=n?function(e,t,n){if(!e)return 0;const r=n;if(n+=e.length,yp(e))return(n+=t.slice(n).split(/\n[^>]/).shift().length)-r;if("span"===pp[e].type){const r=t.slice(n+1).split("\n").shift();let i=0,s=r.indexOf(e);for(;-1!==s;){if(_p(e,n+1+s,t))return s+1+2*e.length;s=r.indexOf(e,i++)}return 0}{const r=t.slice(n+1);let i,s=r.indexOf(e);for(;-1!==s;){if(_p(e,n+1+s,t))return s+1+2*e.length;s=r.indexOf(e,i++)}return 0}}(n,e,t):0;return r>0?{d:n,length:r}:{}}const yp=e=>[">","&gt;"].includes(e);function wp(e,t,n,r){const i=gp[pp[e].name];if(yp(e)){return i(t.replace(/\n>/g,"\n").replace(/\n$/,""),n,r)}return i(t,n,r)}function Sp(){const e=Ep(['<span class="mention">',"</span>"]);return Sp=function(){return e},e}function xp(){const e=Ep(['<span class="mention mention--self badge badge-info">',"</span>"]);return xp=function(){return e},e}function Ep(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Ap=zc.env.utils,Cp=e=>"string"==typeof e;class Tp extends String{constructor(e,t,n=0,r,i,s){super(e),this.model=t,this.offset=n,this.onImgClick=s,this.onImgLoad=i,this.references=[],this.show_images=r,this.payload=[]}addHyperlinks(e,t){const n=[];try{const t={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi};Ph.a.withinString(e,(e,t,r)=>(n.push({url:e,start:t,end:r}),e),t)}catch(e){return void Lr.debug(e)}n.forEach(n=>{const r=e.slice(n.start,n.end),i=Ap.filterQueryParamsFromURL(r);this.addTemplateResult(n.start+t,n.end+t,this.show_images&&Ap.isImageURL(r)&&Ap.isImageDomainAllowed(r)?Ap.convertToImageTag(i,this.onImgLoad,this.onImgClick):Ap.convertUrlToHyperlink(i))})}addMapURLs(e,t){const n=/geo:([\-0-9.]+),([\-0-9.]+)(?:,([\-0-9.]+))?(?:\?(.*))?/g,r=e.matchAll(n);for(const e of r)this.addTemplateResult(e.index+t,e.index+e[0].length+t,Ap.convertUrlToHyperlink(e[0].replace(n,xc.geouri_replacement)))}addEmojis(e,t){[...Jl(e.toString()),...Xl(e.toString())].forEach(e=>{this.addTemplateResult(e.begin+t,e.end+t,Wl(e,{add_title_wrapper:!0}))})}addMentions(e,t){var n;const r=t+this.offset;if(!this.model.collection)return void Lr.debug("addMentions: ignoring dangling model");const i=this.model.collection.chatbox.get("nick");null===(n=this.model.get("references"))||void 0===n||n.forEach(n=>{const s=Number(n.begin)-r;if(s<0||s>=r+e.length)return;const o=Number(n.end)-r,a=e.slice(s,o);var c;a===i?this.addTemplateResult(s+t,o+t,(c={mention:a},Fa(xp(),c.mention))):this.addTemplateResult(s+t,o+t,(e=>Fa(Sp(),e.mention))({mention:a}))})}addStyling(){if(this.model.get("is_unstyled")||!Tc.settings.get("allow_message_styling"))return;let e=0;const t=[];if(function(e){for(let t=0;t<fp.length;t++)if(e.includes(fp[t]))return!0}(this))for(;e<this.length;){const{d:n,length:r}=bp(this,e);if(n&&r){const i=yp(n),s=e+r,o=i?s:s-n.length;let a="```"===n?e+n.length+1:e+n.length;i&&" "===this[a]&&(a+=1);const c=a,l=this.slice(a,o);t.push({begin:e,template:wp(n,l,this.model,c),end:s}),e=s}e++}t.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 r of t)r&&(Cp(r)?(e.call(this,r,n),n+=r.length):n=r.end)}async addTemplates(){await Tc.trigger("beforeMessageBodyTransformed",this,{Synchronous:!0}),this.addStyling(),this.addAnnotations(this.addMentions),this.addAnnotations(this.addHyperlinks),this.addAnnotations(this.addMapURLs),await Tc.emojis.initialize(),this.addAnnotations(this.addEmojis),await Tc.trigger("afterMessageBodyTransformed",this,{Synchronous:!0}),this.payload=this.marshall(),this.trimMeMessage(),this.payload=this.payload.map(e=>Cp(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 ")}static replaceText(e){return Gl(e.replace(/\n\n+/g,"\n\n"))}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)=>Cp(t)?[...e,Tp.replaceText(t)]:[...e,t],[])}}function Op(){const e=kp(["",""]);return Op=function(){return e},e}function jp(){const e=kp(["",""]);return jp=function(){return e},e}function kp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Np=zc.env.utils;class Mp{constructor(e){var t;this.model=e.model,this.component=e,this.chatview=null===(t=Np.ancestor(this.component,"converse-chat-message"))||void 0===t?void 0:t.chatview,this.was_scrolled_up=this.chatview.model.get("scrolled"),this.text=this.component.model.getMessageText()}scrollDownOnImageLoad(){this.was_scrolled_up||this.chatview.scrollDown()}async transform(){const e=Tc.settings.get("show_images_inline"),t=new Tp(this.text,this.model,0,e,()=>this.scrollDownOnImageLoad(),e=>this.component.showImageModal(e));return await t.addTemplates(),t.payload}render(){return Fa(jp(),Rf(this.transform(),Fa(Op(),this.text)))}}const Ip=ga(e=>t=>{var n;const r=new Mp(e);t.setValue(r.render());const i=e.model;null===(n=i.collection)||void 0===n||n.trigger("rendered",i)});function Rp(){const e=Lp(['<p class="older-msg"><time>',"</time>: ","</p>"]);return Rp=function(){return e},e}function Dp(){const e=Lp(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h4 class="modal-title" id="message-versions-modal-label">',"</h4>\n ",'\n </div>\n <div class="modal-body">\n <h4>Older versions</h4>\n ',"\n <hr/>\n <h4>Current version</h4>\n <p>",'</p>\n </div>\n <div class="modal-footer">',"</div>\n </div>\n </div>\n"]);return Dp=function(){return e},e}function Lp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-chat-message-body",class extends rc{static get properties(){return{model:{type:Object},is_me_message:{type:Boolean},text:{type:String}}}showImageModal(e){e.preventDefault(),Tc.modal.create(tp,{src:e.target.src},e).show(e)}render(){return Ip(this)}});var zp=Jf.extend({id:"message-versions-modal",toHTML(){return e=this.model.toJSON(),Fa(Dp(),Pu("Message versions"),Zf,Object.keys(e.older_versions).map(t=>Fa(Rp(),Sr()(t).format("MMM D, YYYY, HH:mm:ss"),e.older_versions[t])),e.message,Kf);var e}}),Pp=n(171),Fp=n.n(Pp);function Bp(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <svg xmlns="http://www.w3.org/2000/svg" class="avatar ','" width="','" height="','">\n <image width="','" height="','" preserveAspectRatio="xMidYMid meet" href="','"/>\n </svg>']);return Bp=function(){return e},e}var Hp=e=>{return Fa(Bp(),e.classes,e.width,e.height,e.width,e.height,(t=e.image,n=e.image_type,t.startsWith("data:")?t:"data:".concat(n,";base64,").concat(t)));var t,n};const qp=ga(e=>t=>{const n={classes:e.classes?"".concat(e.classes," avatar"):"avatar",height:e.width||36,image:e.image,image_type:e.image_type,width:e.height||36};t.setValue(Hp(n))});function Up(){const e=Jp(['\n <time timestamp="','" class="chat-msg__time">','</time>&nbsp;\n <span class="chat-msg__author">',"","</span>&nbsp;"]);return Up=function(){return e},e}function Vp(){const e=Jp(['<span class="fa fa-lock"></span>']);return Vp=function(){return e},e}function $p(){const e=Jp(['\n <span class="chat-msg__heading">\n <span class="chat-msg__author"><a class="show-msg-author-modal" @click=',">","</a></span>\n ","\n ","\n </span>"]);return $p=function(){return e},e}function Gp(){const e=Jp(['<div class="message separator"><hr class="separator"><span class="separator-text">',"</span></div>"]);return Gp=function(){return e},e}function Wp(){const e=Jp(["\n ",'\n <div class="message chat-msg ','"\n data-isodate="','"\n data-msgid="','"\n data-from="','"\n data-encrypted="','">\n\n \x3c!-- Anchor to allow us to scroll the message into view --\x3e\n <a id="','"></a>\n\n <a class="show-msg-author-modal" @click=',">",'</a>\n <div class="chat-msg__content chat-msg__content--'," ",'">\n\n ','\n <div class="chat-msg__body chat-msg__body--'," "," ",'">\n <div class="chat-msg__message">\n ',"\n ","\n </div>\n <converse-message-actions\n .chatview=","\n .model=",'\n ?correcting="','"\n ?editable="','"\n ?is_retracted="','"\n message_type="','"></converse-message-actions>\n </div>\n </div>\n </div>']);return Wp=function(){return e},e}function Jp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Xp(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<span class="spinner fa fa-spinner centered ','"/>']);return Xp=function(){return e},e}var Qp=(e={})=>Fa(Xp(),e.classes||"");function Yp(){const e=hm(['<span class="badge badge-secondary">',"</span>"]);return Yp=function(){return e},e}function Kp(){const e=hm(["\n ",'\n <time timestamp="','" class="chat-msg__time">',"</time>\n "]);return Kp=function(){return e},e}function Zp(){const e=hm(['<div class="chat-msg__media">',"</div>"]);return Zp=function(){return e},e}function em(){const e=hm(['<i title="','" class="fa fa-edit chat-msg__edit-modal" @click=',"></i>"]);return em=function(){return e},e}function tm(){const e=hm(['<span class="fa fa-check chat-msg__receipt"></span>']);return tm=function(){return e},e}function nm(){const e=hm(['<div class="chat-msg__subject">',"</div>"]);return nm=function(){return e},e}function rm(){const e=hm(["\n ","\n ",'\n <span>\n <converse-chat-message-body\n class="chat-msg__text '," ",'"\n .model="','"\n ?is_me_message="','"\n ?is_only_emojis="','"\n ?is_spoiler="','"\n ?is_spoiler_visible="','"\n text="','"></converse-chat-message-body>\n ',"\n ","\n </span>\n ",'\n <div class="chat-msg__error">',"</div>\n "]);return rm=function(){return e},e}function im(){const e=hm(['\n <div class="chat-msg__spoiler-hint">\n <span class="spoiler-hint">','</span>\n <a class="badge badge-info spoiler-toggle" href="#" @click=','>\n <i class="fa ','"></i>\n ',"\n </a>\n </div>\n "]);return im=function(){return e},e}function sm(){const e=hm(['<q class="chat-msg--retracted__reason">',"</q>"]);return sm=function(){return e},e}function om(){const e=hm(["\n <div>","</div>\n ","\n "]);return om=function(){return e},e}function am(){const e=hm(['\n <div class="message chat-msg">\n ','\n <div class="chat-msg__content">\n <span class="chat-msg__text">'," <strong>","</strong>, ",'</span>\n <progress value="','"/>\n </div>\n </div>']);return am=function(){return e},e}function cm(){const e=hm(['<a class="retry" @click=',">","</a>"]);return cm=function(){return e},e}function lm(){const e=hm(['<q class="reason">',"</q>"]);return lm=function(){return e},e}function um(){const e=hm(['<q class="reason">',"</q>"]);return um=function(){return e},e}function dm(){const e=hm(['\n <div class="message chat-info chat-','"\n data-isodate="','"\n data-type="','"\n data-value="','">\n\n <div class="chat-info__message">\n ',"\n </div>\n ","\n ","\n ","\n </div>\n "]);return dm=function(){return e},e}function hm(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const{Strophe:fm}=zc.env,pm=zc.env.utils;class mm extends rc{static get properties(){return{chatview:{type:Object},correcting:{type:Boolean},editable:{type:Boolean},edited:{type:String},error:{type:String},error_text:{type:String},from:{type:String},has_mentions:{type:Boolean},hats:{type:Array},is_delayed:{type:Boolean},is_encrypted:{type:Boolean},is_first_unread:{type:Boolean},is_me_message:{type:Boolean},is_only_emojis:{type:Boolean},is_retracted:{type:Boolean},is_spoiler:{type:Boolean},is_spoiler_visible:{type:Boolean},message_type:{type:String},model:{type:Object},moderated_by:{type:String},moderation_reason:{type:String},msgid:{type:String},occupant_affiliation:{type:String},occupant_role:{type:String},oob_url:{type:String},progress:{type:Number},reason:{type:String},received:{type:String},retractable:{type:Boolean},retry_event_id:{type:String},sender:{type:String},show_spinner:{type:Boolean},spoiler_hint:{type:String},subject:{type:String},time:{type:String},username:{type:String}}}render(){const e=Tc.settings.get("time_format");return this.pretty_time=Sr()(this.edited||this.time).format(e),this.show_spinner?Qp():this.model.get("file")&&!this.model.get("oob_url")?this.renderFileProgress():["error","info"].includes(this.message_type)?this.renderInfoMessage():this.renderChatMessage()}connectedCallback(){super.connectedCallback(),this.listenTo(this.model,"change",e=>{const t=this.model.collection.chatbox;Object.assign(this,Nm(t,this.model)),Object.keys(e.changed).filter(e=>Object.keys(mm.properties).includes(e)).forEach(t=>this[t]=e.changed[t])});const e=this.model.vcard;e&&this.listenTo(e,"change",()=>this.requestUpdate())}updated(){var e;(this.show_spinner||this.model.get("file")&&!this.model.get("oob_url")||["error","info"].includes(this.message_type))&&(null===(e=this.model.collection)||void 0===e||e.trigger("rendered",this.model))}renderInfoMessage(){const e=Sr()(this.model.get("time")).toISOString(),t=Pu("Retry");return Fa(dm(),this.message_type,e,this.data_name,this.data_value,this.model.getMessageText(),this.reason?Fa(um(),this.reason):"",this.error_text?Fa(lm(),this.error_text):"",this.retry_event_id?Fa(cm(),this.onRetryClicked,t):"")}renderFileProgress(){const e=Pu("Uploading file:"),t=this.model.file.name,n=Fp()(this.model.file.size);return Fa(am(),qp(this.getAvatarData()),e,t,n,this.progress)}renderChatMessage(){return(e=>{const t=Pu("New messages");return Fa(Wp(),e.is_first_unread?Fa(Gp(),t):"",e.getExtraMessageClasses(),e.time,e.msgid,e.from,e.is_encrypted,e.msgid,e.showUserModal,e.shouldShowAvatar()?qp(e.getAvatarData()):"",e.sender,e.is_me_message?"chat-msg__content--action":"",e.is_me_message?"":Fa($p(),e.showUserModal,e.username,e.renderAvatarByline(),e.is_encrypted?Fa(Vp()):""),e.message_type,e.received?"chat-msg__body--received":"",e.is_delayed?"chat-msg__body--delayed":"",e.is_me_message?Fa(Up(),e.edited||e.time,e.pretty_time,e.is_me_message?"**":"",e.username):"",e.is_retracted?e.renderRetraction():e.renderMessageText(),e.chatview,e.model,e.correcting,e.editable,e.is_retracted,e.message_type)})(this)}shouldShowAvatar(){return Tc.settings.get("show_message_avatar")&&!this.is_me_message&&"headline"!==this.type}getAvatarData(){var e,t;return{classes:"chat-msg__avatar",height:36,width:36,image:"data:"+((null===(e=this.model.vcard)||void 0===e?void 0:e.get("image_type"))||xc.DEFAULT_IMAGE_TYPE)+";base64,"+((null===(t=this.model.vcard)||void 0===t?void 0:t.get("image"))||xc.DEFAULT_IMAGE)}}async onRetryClicked(){this.show_spinner=!0,await Tc.trigger(this.retry_event_id,{synchronous:!0}),this.model.destroy(),this.parentElement.removeChild(this)}isFollowup(){const e=this.model.collection.models,t=e.indexOf(this.model),n=t?e[t-1]:null;if(null===n)return!1;const r=Sr()(this.time);return this.from===n.get("from")&&!this.is_me_message&&!n.isMeCommand()&&"info"!==this.message_type&&"info"!==n.get("type")&&r.isBefore(Sr()(n.get("time")).add(10,"minutes"))&&!!this.is_encrypted==!!n.get("is_encrypted")}getExtraMessageClasses(){const e=[this.isFollowup()?"chat-msg--followup":null,this.is_delayed?"delayed":null,this.is_me_message?"chat-msg--action":null,this.is_retracted?"chat-msg--retracted":null,this.message_type,this.shouldShowAvatar()?"chat-msg--with-avatar":null].map(e=>e);return"groupchat"===this.message_type&&(this.occupant_role&&e.push(this.occupant_role),this.occupant_affiliation&&e.push(this.occupant_affiliation),"them"===this.sender&&this.has_mentions&&e.push("mentioned")),this.correcting&&e.push("correcting"),e.filter(e=>e).join(" ")}getRetractionText(){if("groupchat"===this.message_type&&this.moderated_by){const e=this.moderated_by,t=this.model.collection.chatbox;this.model.mod||(this.model.mod=t.occupants.findOccupant({jid:e})||t.occupants.findOccupant({nick:fm.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return Pu("%1$s has removed this message",n)}return Pu("%1$s has removed this message",this.model.getDisplayName())}renderRetraction(){const e=this.is_retracted?this.getRetractionText():null;return Fa(om(),e,this.moderation_reason?Fa(sm(),this.moderation_reason):"")}renderMessageText(){const e=Pu("This message has been edited"),t=Pu("Show more"),n="groupchat"===this.message_type,r=Pu("Show less"),i=Fa(im(),this.spoiler_hint,this.toggleSpoilerMessage,this.is_spoiler_visible?"fa-eye-slash":"fa-eye",this.is_spoiler_visible?r:t),s=this.is_spoiler?"spoiler ".concat(this.is_spoiler_visible?"":"hidden"):"";return Fa(rm(),this.is_spoiler?i:"",this.subject?Fa(nm(),this.subject):"",this.is_only_emojis?"chat-msg__text--larger":"",s,this.model,this.is_me_message,this.is_only_emojis,this.is_spoiler,this.is_spoiler_visible,this.model.getMessageText(),!this.received||this.is_me_message||n?"":Fa(tm()),this.edited?Fa(em(),e,this.showMessageVersionsModal):"",this.oob_url?Fa(Zp(),pm.getOOBURLMarkup(xc,this.oob_url)):"",this.error_text||this.error)}renderAvatarByline(){return Fa(Kp(),this.hats.map(e=>Fa(Yp(),e.title)),this.edited||this.time,this.pretty_time)}showUserModal(e){"me"===this.model.get("sender")?xc.xmppstatusview.showProfileModal(e):"groupchat"===this.message_type?this.chatview.showOccupantDetailsModal(e,this.model):this.chatview.showUserDetailsModal(e,this.model)}showMessageVersionsModal(e){e.preventDefault(),Tc.modal.show(zp,{model:this.model},e)}toggleSpoilerMessage(e){null==e||e.preventDefault(),this.model.save({is_spoiler_visible:!this.model.get("is_spoiler_visible")})}}function gm(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="message date-separator" data-isodate="','">\n <hr class="separator"/>\n <time class="separator-text" datetime="','"><span>',"</span></time>\n </div>\n"]);return gm=function(){return e},e}Tc.elements.define("converse-chat-message",mm);
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
const vm=(e,t)=>{const n=e.startNode.parentNode,r=void 0===t?e.endNode:t.startNode,i=n.insertBefore(ua(),r);n.insertBefore(ua(),r);const s=new Ta(e.options);return s.insertAfterNode(i),s},_m=(e,t)=>(e.setValue(t),e.commit(),e),bm=(e,t,n)=>{const r=e.startNode.parentNode,i=n?n.startNode:e.endNode,s=t.endNode.nextSibling;s!==i&&na(r,t.startNode,s,i)},ym=e=>{ra(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},wm=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},Sm=new WeakMap,xm=new WeakMap,Em=ga((e,t,n)=>{let r;return void 0===n?n=t:void 0!==t&&(r=t),t=>{if(!(t instanceof Ta))throw new Error("repeat can only be used in text bindings");const i=Sm.get(t)||[],s=xm.get(t)||[],o=[],a=[],c=[];let l,u,d=0;for(const t of e)c[d]=r?r(t,d):d,a[d]=n(t,d),d++;let h=0,f=i.length-1,p=0,m=a.length-1;for(;h<=f&&p<=m;)if(null===i[h])h++;else if(null===i[f])f--;else if(s[h]===c[p])o[p]=_m(i[h],a[p]),h++,p++;else if(s[f]===c[m])o[m]=_m(i[f],a[m]),f--,m--;else if(s[h]===c[m])o[m]=_m(i[h],a[m]),bm(t,i[h],o[m+1]),h++,m--;else if(s[f]===c[p])o[p]=_m(i[f],a[p]),bm(t,i[f],i[h]),f--,p++;else if(void 0===l&&(l=wm(c,p,m),u=wm(s,h,f)),l.has(s[h]))if(l.has(s[f])){const e=u.get(c[p]),n=void 0!==e?i[e]:null;if(null===n){const e=vm(t,i[h]);_m(e,a[p]),o[p]=e}else o[p]=_m(n,a[p]),bm(t,n,i[h]),i[e]=null;p++}else ym(i[f]),f--;else ym(i[h]),h++;for(;p<=m;){const e=vm(t,o[m+1]);_m(e,a[p]),o[p++]=e}for(;h<=f;){const e=i[h++];null!==e&&ym(e)}Sm.set(t,o),xm.set(t,c)}});function Am(){const e=Om(['<div class="empty-history-feedback form-help"><span>',"</span></div>"]);return Am=function(){return e},e}function Cm(){const e=Om(["",""]);return Cm=function(){return e},e}function Tm(){const e=Om(["\n <converse-chat-message\n .chatview=","\n .hats=","\n .model=","\n ?correcting=","\n ?editable=","\n ?has_mentions=","\n ?is_delayed=","\n ?is_encrypted=","\n ?is_first_unread=","\n ?is_me_message=","\n ?is_only_emojis=","\n ?is_retracted=","\n ?is_spoiler=","\n ?is_spoiler_visible=","\n ?retractable=","\n edited=","\n error=","\n error_text=","\n filename=","\n filesize=","\n from=","\n message_type=","\n moderated_by=","\n moderation_reason=","\n msgid=","\n occupant_affiliation=","\n occupant_role=","\n oob_url=","\n pretty_type=","\n progress=","\n reason=","\n received=","\n retry_event_id=","\n sender=","\n spoiler_hint=","\n subject=","\n time=","\n username=","></converse-chat-message>\n"]);return Tm=function(){return e},e}function Om(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const jm=Pu("No message history available.");function km(e){const t=e.collection.models,n=t.indexOf(e),r=t[n-1];if(!r||Sr()(e.get("time")).isAfter(Sr()(r.get("time")),"day")){const t=Sr()(e.get("time")).startOf("day");return i={type:"date",time:t.toISOString(),datestring:t.format("dddd MMM Do YYYY")},Fa(gm(),i.time,i.time,i.datestring)}var i}function Nm(e,t){return{has_mentions:"groupchat"===t.get("type")&&"them"===t.get("sender")&&e.isUserMentioned(t),hats:xc.getHats(t),is_first_unread:e.get("first_unread_id")===t.get("id"),is_me_message:t.isMeCommand(),is_retracted:t.get("retracted")||"retracted"===t.get("moderated"),username:t.getDisplayName()}}xc.getHats=function(e){if("groupchat"===e.get("type")){var t;const n=Tc.settings.get("muc_hats").filter(e=>e).map(e=>e.toLowerCase());let r=[];n.includes("vcard_roles")&&(r=e.vcard?e.vcard.get("role"):null,r=r?r.split(",").filter(e=>e).map(e=>({title:e})):[]);const i=[...e.occupant?[e.occupant.get("role")]:[],...e.occupant?[e.occupant.get("affiliation")]:[]].filter(e=>e).filter(e=>n.includes(e.toLowerCase())).map(e=>({title:e}));return[...n.includes("xep317")&&(null===(t=e.occupant)||void 0===t?void 0:t.get("hats"))||[],...r,...i]}return[]};Tc.elements.define("converse-message-history",class extends rc{static get properties(){return{chatview:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?Fa(Cm(),Em(e,e=>e.get("id"),e=>this.renderMessage(e))):Fa(Am(),jm)}renderMessage(e){if(e.get("dangling_retraction")||e.get("is_only_key"))return"";const t=km(e);var n;return[...t?[t]:[],(n=Object.assign(e.toJSON(),Nm(this.chatview.model,e),{chatview:this.chatview,model:e}),Fa(Tm(),n.chatview,n.hats,n.model,n.correcting,n.editable,n.has_mentions,n.is_delayed,!!n.is_encrypted,n.is_first_unread,n.is_me_message,n.is_only_emojis,n.is_retracted,n.is_spoiler,n.is_spoiler_visible,n.retractable,n.edited||"",n.error||"",n.error_text||"",n.filename||"",n.filesize||"",n.from,n.type||"",n.moderated_by||"",n.moderation_reason||"",n.msgid,n.model.occupant?n.model.occupant.get("affiliation"):"",n.model.occupant?n.model.occupant.get("role"):"",n.oob_url||"",n.pretty_type,n.progress||0,n.reason||"",n.received||"",n.retry_event_id||"",n.sender,n.spoiler_hint||"",n.subject||"",n.time,n.username))]}});var Mm=n(16),Im=n.n(Mm);
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
const Rm=new WeakMap,Dm=ga(e=>t=>{if(!(t instanceof Ta))throw new Error("unsafeHTML can only be used in text bindings");const n=Rm.get(t);if(void 0!==n&&xa(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template");r.innerHTML=e;const i=document.importNode(r.content,!0);t.setValue(i),Rm.set(t,{value:e,fragment:i})});function Lm(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n <converse-message-history\n .chatview=","\n .messages=",'>\n </converse-message-history>\n <div class="chat-content__notifications">',"</div>\n "]);return Lm=function(){return e},e}function zm(){const e=Fm(['<svg .style="','"> <use href="','"> </use> </svg>']);return zm=function(){return e},e}function Pm(){const e=Fm(["\n :host {\n display: inline-block;\n padding: 0;\n margin: 0;\n }\n "]);return Pm=function(){return e},e}function Fm(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @module icons.js
* @copyright Alfredo Medrano Sánchez and the Converse.js contributors
* @description
* Component inspired by the one from fa-icons
* https://github.com/obsidiansoft-io/fa-icons/blob/master/LICENSE
* @license Mozilla Public License (MPLv2)
*/Tc.elements.define("converse-chat-content",class extends rc{static get properties(){return{chatview:{type:Object},messages:{type:Array},notifications:{type:String}}}render(){const e=Im.a.filterXSS(this.notifications,{whiteList:{}});return Fa(Lm(),this.chatview,this.messages,Dm(e))}});function Bm(){const e=qm(['<div class="message chat-','" data-isodate="','">',"</div>"]);return Bm=function(){return e},e}function Hm(){const e=qm(['<converse-icon class="fas fa-times close-chat-help"\n @click=','\n path-prefix="','"\n size="1em"></converse-icon>']);return Hm=function(){return e},e}function qm(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}customElements.define("converse-icon",class extends rc{static get properties(){return{color:String,class_name:{attribute:"class"},style:String,size:String}}static get styles(){return ec(Pm())}constructor(){super(),this.class_name="",this.style="",this.size="",this.color=""}getSource(){return"#icon-".concat(this.class_name.split(" ")[1].replace("fa-",""))}getStyles(){return"\n ".concat(this.size?"width: ".concat(this.size,";"):"","\n ").concat(this.size?"height: ".concat(this.size,";"):"","\n ").concat(this.color?"fill: ".concat(this.color,";"):"","\n ").concat(this.style,"\n ")}render(){return Fa(zm(),this.getStyles(),this.getSource())}});function Um(){const e=Km(["<converse-emoji-picker-content\n .chatview=","\n .model=",'\n .search_results="','"\n current_skintone="','"\n query="','"></converse-emoji-picker-content>']);return Um=function(){return e},e}function Vm(){const e=Km(['\n <div class="emoji-picker__header">\n <input class="form-control emoji-search" name="emoji-search" placeholder="','"\n .value=',"\n @keydown=","\n @blur=","\n @focus=",">\n ","\n </div>\n ",'\n\n <div class="emoji-skintone-picker">\n <label>Skin tone</label>\n <ul>',"</ul>\n </div>"]);return Vm=function(){return e},e}function $m(){const e=Km(['\n <li data-skintone="','" class="emoji-skintone ','">\n <a class="pick-skintone" href="#" data-skintone="','" @click=',">","</a>\n </li>"]);return $m=function(){return e},e}function Gm(){const e=Km(["\n <span ?hidden=",' class="emoji-lists__container emoji-lists__container--browse">\n ',"\n </span>"]);return Gm=function(){return e},e}function Wm(){const e=Km(['\n <a id="emoji-picker-','" class="emoji-category__heading" data-category="','">','</a>\n <ul class="emoji-picker" data-category="','">\n ',"\n </ul>"]);return Wm=function(){return e},e}function Jm(){const e=Km(["\n <span ?hidden=",' class="emoji-lists__container emojis-lists__container--search">\n <a id="emoji-picker-search-results" class="emoji-category__heading">','</a>\n <ul class="emoji-picker">\n ',"\n </ul>\n </span>\n "]);return Jm=function(){return e},e}function Xm(){const e=Km(['\n <li class="emoji insert-emoji ','" data-emoji="','" title="','">\n <a href="#" @click=',' data-emoji="','">',"</a>\n </li>\n "]);return Xm=function(){return e},e}function Qm(){const e=Km(["<ul>","</ul>"]);return Qm=function(){return e},e}function Ym(){const e=Km(['\n <li data-category="','"\n class="emoji-category '," ",'"\n title="','">\n\n <a class="pick-category"\n @click=','\n href="#emoji-picker-','"\n data-category="','">'," </a>\n </li>\n "]);return Ym=function(){return e},e}function Km(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-chat-help",class extends rc{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[Fa(Hm(),this.close,Tc.settings.get("assets_path")),...this.messages.map(t=>this.renderHelpMessage({isodate:e,markup:Im.a.filterXSS(t,{whiteList:{strong:[]}})}))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return Fa(Bm(),this.type,e.isodate,Dm(e.markup))}});const Zm=zc.env.utils,eg=e=>{const t=Tc.settings.get("emoji_categories");return Fa(Qm(),Object.keys(t).map(n=>t[n]?(e=>Fa(Ym(),e.category,e.category,e.current_category===e.category?"picked":"",Pu(xc.emoji_category_labels[e.category]),e.onCategoryPicked,e.category,e.category,e.emoji))(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):""))},tg=e=>Fa(Xm(),e.shouldBeHidden(e.emoji.sn)?"hidden":"",e.emoji.sn,e.emoji.sn,e.insertEmoji,e.emoji.sn,Zm.shortnamesToEmojis(e.emoji.sn)),ng=e=>{const t=Tc.settings.get("emoji_categories");return Fa(Gm(),e.query,Object.keys(t).map(n=>t[n]?(e=>Fa(Wm(),e.category,e.category,Pu(Tc.settings.get("emoji_category_labels")[e.category]),e.category,Object.values(zc.emojis.json[e.category]).map(t=>tg(Object.assign({emoji:t},e)))))(Object.assign({category:n},e)):""))},rg=e=>{const t=Pu("Search");return Fa(Vm(),t,e.query||"",e.onSearchInputKeyDown,e.onSearchInputBlurred,e.onSearchInputFocus,e.query?"":eg(e),e.render_emojis?Fa(Um(),e.chatview,e.model,e.search_results,e.current_skintone,e.query):"",["tone1","tone2","tone3","tone4","tone5"].map(t=>(e=>Fa($m(),e.skintone,e.current_skintone===e.skintone?"picked":"",e.skintone,e.onSkintonePicked,Zm.shortnamesToEmojis(":"+e.skintone+":")))(Object.assign({skintone:t},e))))};function ig(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="emoji-picker__lists">\n ',"\n ","\n </div>\n "]);return ig=function(){return e},e}const{sizzle:sg}=zc.env;function og(){const e=cg(["\n <converse-emoji-picker\n .chatview=","\n .model=","\n ?render_emojis=",'\n current_category="','"\n current_skintone="','"\n query="','"\n ></converse-emoji-picker>']);return og=function(){return e},e}function ag(){const e=cg(['\n <div class="dropup">\n <button class="toggle-emojis"\n title="','"\n data-toggle="dropdown"\n aria-haspopup="true"\n aria-expanded="false">\n <converse-icon\n class="fa fa-smile "\n path-prefix="','"\n size="1em"></converse-icon>\n </button>\n <div class="dropdown-menu">\n ',"\n </div>\n </div>"]);return ag=function(){return e},e}function cg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-emoji-picker-content",class extends rc{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 Fa(ig(),(e=>{const t=Pu("Search results");return Fa(Jm(),!e.query,t,e.search_results.map(t=>tg(Object.assign({emoji:t},e))))})(e),ng(e))}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)}sg(".emoji-picker",this).forEach(e=>this.observer.observe(e))}}setCategoryOnVisibilityChange(e){const t=this.parentElement.navigator.selected,n=e.filter(e=>e.target.contains(t)).pop();let r;if(r=n||e.reduce((e,t)=>t.intersectionRatio>=((null==e?void 0:e.intersectionRatio)||0)?t:e,null),r&&r.isIntersecting){const e=r.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&&zc.emojis.toned.includes(e))return!0;return!(!this.query||xc.FILTER_CONTAINS(e,this.query))}});const lg=zc.env.utils;function ug(){const e=wg(["",""]);return ug=function(){return e},e}function dg(){const e=wg(['\n <button class="toggle-compose-spoiler"\n title="','"\n @click=','>\n <converse-icon class="fa ','"\n path-prefix="','"\n size="1em"></converse-icon>\n </button>']);return dg=function(){return e},e}function hg(){const e=wg(['\n <button title="','" @click=','>\n <converse-icon class="fa fa-paperclip"\n path-prefix="','"\n size="1em"></converse-icon>\n </button>\n <input type="file" @change=',' class="fileupload" multiple="" style="display:none"/>']);return hg=function(){return e},e}function fg(){const e=wg(['\n <button class="toggle_occupants right"\n title="','"\n @click=','>\n <converse-icon class="fa ','"\n path-prefix="','" size="1em"></converse-icon>\n </button>']);return fg=function(){return e},e}function pg(){const e=wg(["",""]);return pg=function(){return e},e}function mg(){const e=wg(['<span class="right message-limit" title="','">',"</span>"]);return mg=function(){return e},e}function gg(){const e=wg(['\n <button class="toggle-call" @click=',' title="','">\n <converse-icon class="fa fa-phone" path-prefix="/dist" size="1em"></converse-icon>\n </button>']);return gg=function(){return e},e}function vg(){const e=wg(["<converse-emoji-dropdown .chatview=","></converse-dropdown>"]);return vg=function(){return e},e}function _g(){const e=wg(['<button type="submit" class="btn send-button fa fa-paper-plane" title="','"></button>']);return _g=function(){return e},e}function bg(){const e=wg(['<span class="toolbar-buttons">',"</span>"]);return bg=function(){return e},e}function yg(){const e=wg(["\n ","\n ","\n "]);return yg=function(){return e},e}function wg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-emoji-dropdown",class extends zf{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await Tc.emojis.initialize();const e="converse.emoji-".concat(xc.bare_jid,"-").concat(this.chatview.model.get("jid"));this.model=new xc.EmojiPicker({id:e}),this.model.browserStorage=xc.createStore(e),await new Promise(e=>this.model.fetch({success:e,error:e})),this.model.set({autocompleting:null,ac_position:null})})()),this.init_promise}render(){return Fa(ag(),Pu("Insert emojis"),Tc.settings.get("assets_path"),Rf(this.initModel().then(()=>Fa(og(),this.chatview,this.model,this.render_emojis,this.model.get("current_category")||"",this.model.get("current_skintone")||"",this.model.get("query")||"")),""))}connectedCallback(){super.connectedCallback(),this.render_emojis=!1}toggleMenu(e){e.stopPropagation(),e.preventDefault(),lg.hasClass("show",this.menu)?lg.ancestor(e.target,".toggle-emojis")&&this.hideMenu():this.showMenu()}async showMenu(){await this.initModel(),this.render_emojis||(this.render_emojis=!0,await this.requestUpdate()),super.showMenu(),setTimeout(()=>{var e;return null===(e=this.querySelector(".emoji-search"))||void 0===e?void 0:e.focus()})}}),Tc.elements.define("converse-emoji-picker",class extends rc{static get properties(){return{chatview:{type:Object},current_category:{type:String,reflect:!0},current_skintone:{type:String,reflect:!0},model:{type:Object},query:{type:String,reflet:!0},render_emojis:{type:Boolean}}}firstUpdated(){this.listenTo(this.model,"change",e=>this.onModelChanged(e.changed)),this.initArrowNavigation()}constructor(){super(),this._search_results=[],this.debouncedFilter=Xo()(e=>this.model.set({query:e.value}),250),this.registerEvents()}get search_results(){return this._search_results}set search_results(e){this._search_results=e,this.requestUpdate()}render(){return rg({chatview:this.chatview,current_category:this.current_category,current_skintone:this.current_skintone,model:this.model,onCategoryPicked:e=>this.chooseCategory(e),onSearchInputBlurred:e=>this.chatview.emitFocused(e),onSearchInputFocus:e=>this.onSearchInputFocus(e),onSearchInputKeyDown:e=>this.onKeyDown(e),onSkintonePicked:e=>this.chooseSkinTone(e),query:this.query,search_results:this.search_results,render_emojis:this.render_emojis,sn2Emoji:e=>lg.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-".concat(this.current_category));t&&(e.scrollTop=t.offsetTop-3*t.offsetHeight+4)}updateSearchResults(e){const t=e.get("query"),n=xc.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=zc.emojis.list.filter(e=>n(e.sn,this.query))}else this.search_results.length&&(this.search_results=[]);this.requestUpdate()}registerEvents(){this.onGlobalKeyDown=e=>this._onGlobalKeyDown(e),document.querySelector("body").addEventListener("keydown",this.onGlobalKeyDown)}connectedCallback(){super.connectedCallback(),this.registerEvents()}disconnectedCallback(){document.querySelector("body").removeEventListener("keydown",this.onGlobalKeyDown),super.disconnectedCallback()}_onGlobalKeyDown(e){this.navigator&&(e.keyCode===zc.keycodes.ENTER&&this.navigator.selected&&lg.isVisible(this)?this.onEnterPressed(e):e.keyCode===zc.keycodes.DOWN_ARROW&&!this.navigator.enabled&&lg.isVisible(this)&&this.enableArrowNavigation(e))}setCategoryForElement(e){const t=this.current_category,n=(null==e?void 0:e.getAttribute("data-category"))||t;t!==n&&this.model.save({current_category:n})}insertIntoTextArea(e){this.chatview.onEmojiReceivedFromPicker(e),this.model.set({autocompleting:null,query:"",ac_position:null})}chooseSkinTone(e){e.preventDefault(),e.stopPropagation();const t=("IMG"===e.target.nodeName?e.target.parentElement:e.target).getAttribute("data-skintone").trim();this.current_skintone===t?this.model.save({current_skintone:""}):this.model.save({current_skintone:t})}chooseCategory(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation();const t=e.target.matches("li")?e.target:lg.ancestor(e.target,"li");this.setCategoryForElement(t),this.navigator.select(t),!this.navigator.enabled&&this.navigator.enable()}onKeyDown(e){if(e.keyCode===zc.keycodes.TAB)if(e.target.value){e.preventDefault();const t=zc.emojis.shortnames.find(t=>xc.FILTER_CONTAINS(t,e.target.value));t&&this.model.set({query:t})}else this.navigator.enabled||this.enableArrowNavigation(e);else e.keyCode!==zc.keycodes.DOWN_ARROW||this.navigator.enabled?e.keyCode===zc.keycodes.ENTER?this.onEnterPressed(e):e.keyCode===zc.keycodes.ESCAPE?(lg.ancestor(this,"converse-emoji-dropdown").hideMenu(),this.chatview.el.querySelector(".chat-textarea").focus(),e.stopPropagation(),e.preventDefault()):e.keyCode!==zc.keycodes.ENTER&&e.keyCode!==zc.keycodes.DOWN_ARROW&&this.debouncedFilter(e.target):this.enableArrowNavigation(e)}onEnterPressed(e){e.emoji_keypress_handled||(e.preventDefault(),e.stopPropagation(),e.emoji_keypress_handled=!0,zc.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 zc.emojis.toned.includes(e)&&this.current_skintone?"".concat(e.slice(0,e.length-1),"_").concat(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:Mf.DIRECTION.down,picked_selector:".picked",scroll_container:this.querySelector(".emoji-picker__lists"),getSelector:t=>{if(t===Mf.DIRECTION.down){const t=this.navigator.selected&&this.navigator.selected.getAttribute("data-category");return t?'ul[data-category="'.concat(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 Mf(this,t)}}disableArrowNavigation(){this.navigator.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)}});const Sg=zc.env.Strophe;window.customElements.define("converse-chat-toolbar",class extends rc{static get properties(){return{chatview:{type:Object},composing_spoiler:{type:Boolean},hidden_occupants:{type:Boolean},is_groupchat:{type:Boolean},message_limit:{type:Number},model:{type:Object},show_call_button:{type:Boolean},show_emoji_button:{type:Boolean},show_occupants_toggle:{type:Boolean},show_send_button:{type:Boolean},show_spoiler_button:{type:Boolean},show_toolbar:{type:Boolean}}}render(){const e=Pu("Send the message");return Fa(yg(),this.show_toolbar?Fa(bg(),Rf(this.getButtons(),"")):"",this.show_send_button?Fa(_g(),e):"")}getButtons(){const e=[];if(this.show_emoji_button&&e.push(Fa(vg(),this.chatview)),this.show_call_button){const t=Pu("Start a call");e.push(Fa(gg(),this.toggleCall,t))}const t=Pu("Message characters remaining");Tc.settings.get("message_limit")&&e.push(Fa(mg(),t,this.message_limit)),this.show_spoiler_button&&e.push(this.getSpoilerButton());const n=Tc.disco.supports(Sg.NS.HTTPUPLOAD,xc.domain);if(e.push(Fa(pg(),Rf(n.then(e=>this.getHTTPUploadButton(e)),""))),this.show_occupants_toggle){const t=Pu("Hide participants"),n=Pu("Show participants");e.push(Fa(fg(),this.hidden_occupants?n:t,this.toggleOccupants,this.hidden_occupants?"fa-angle-double-left":"fa-angle-double-right",Tc.settings.get("assets_path")))}return xc.api.hook("getToolbarButtons",this,e)}getHTTPUploadButton(e){if(e){const e=Pu("Choose a file to send");return Fa(hg(),e,this.toggleFileUpload,Tc.settings.get("assets_path"),this.onFileSelection)}return""}getSpoilerButton(){const e=this.model;if(!this.is_groupchat&&0===e.presence.resources.length)return;let t;t=this.composing_spoiler?Pu("Click to write as a normal (non-spoiler) message"):Pu("Click to write your message as a spoiler");const n=Fa(dg(),t,this.toggleComposeSpoilerMessage,this.composing_spoiler?"fa-eye-slash":"fa-eye",Tc.settings.get("assets_path"));if(this.is_groupchat)return n;{const t=e.get("jid"),r=Promise.all(e.presence.resources.map(e=>Tc.disco.supports(Sg.NS.SPOILER,"".concat(t,"/").concat(e.get("name"))))).then(e=>e.reduce((e,t)=>e&&t,!0));return Fa(ug(),Rf(r.then(()=>n),""))}}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),Tc.trigger("callButtonClicked",{connection:xc.connection,model:this.model})}});class xg extends HTMLElement{async connectedCallback(){await Tc.waitUntil("initialized"),zc.insertInto(this)}}customElements.define("converse-root",xg);const Eg=zc.env.utils;var Ag=wh.extend({renderAvatar(e){const t=(e=e||this.el).querySelector("canvas.avatar, svg.avatar");if(null!==t&&this.model.vcard){const e={classes:t.getAttribute("class"),width:t.getAttribute("width"),height:t.getAttribute("height"),image_type:this.model.vcard.get("image_type"),image:this.model.vcard.get("image")};t.outerHTML=Eg.getElementFromTemplateResult(Hp(e)).outerHTML}}});function Cg(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="inner-content converse-brand row">\n <div class="converse-brand__padding"></div>\n <div class="converse-brand__heading">\n <svg height="200px"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n viewBox="0 0 364 364"\n version="1.1">\n <title>Logo Converse</title>\n <defs>\n <linearGradient id="gradient" x1="92.14" y1="27.64" x2="267.65" y2="331.62" gradientUnits="userSpaceOnUse">\n <stop offset="0" stop-color="#fff1d1"/>\n <stop offset="0.05" stop-color="#fae8c1"/>\n <stop offset="0.15" stop-color="#f0d5a1"/>\n <stop offset="0.27" stop-color="#e7c687"/>\n <stop offset="0.4" stop-color="#e1bb72"/>\n <stop offset="0.54" stop-color="#dcb264"/>\n <stop offset="0.71" stop-color="#daad5c"/>\n <stop offset="1" stop-color="#d9ac59"/>\n </linearGradient>\n <filter id="shadow">\n <feGaussianBlur in="SourceAlpha" stdDeviation="2.3" result="blur1"/>\n <feOffset in="blur1" dx="3" dy="3" result="blur2"/>\n <feColorMatrix in="blur2" type="matrix" result="blur3"\n values="1 0 0 0 0.1\n 0 1 0 0 0.1\n 0 0 1 0 0.1\n 0 0 0 1 0"/>\n <feMerge>\n <feMergeNode in="blur3"/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n </defs>\n <g filter="url(#shadow)">\n <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"/>\n <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)"/>\n </g>\n </svg>\n <span class="converse-brand__text">\n <span>converse<span class="subdued">.js</span></span>\n <p class="byline">messaging freedom</p>\n </span>\n </div>\n </div>']);return Cg=function(){return e},e}function Tg(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <?xml version="1.0" encoding="UTF-8"?>\n \x3c!--\n Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com\n License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)\n --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">\n <symbol id="icon-address-book" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-angle-double-down" viewBox="0 0 320 512">\n <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>\n </symbol>\n <symbol id="icon-angle-double-left" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-angle-double-right" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-angle-double-up" viewBox="0 0 320 512">\n <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>\n </symbol>\n <symbol id="icon-angle-down" viewBox="0 0 320 512">\n <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>\n </symbol>\n <symbol id="icon-angle-left" viewBox="0 0 256 512">\n <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>\n </symbol>\n <symbol id="icon-angle-right" viewBox="0 0 256 512">\n <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>\n </symbol>\n <symbol id="icon-angle-up" viewBox="0 0 320 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-alt-circle-down" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-alt-circle-left" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-alt-circle-right" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-alt-circle-up" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-circle-down" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-circle-left" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-circle-right" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-circle-up" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-down" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-left" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-right" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-arrow-up" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-arrows-alt" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrows-alt-h" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-arrows-alt-v" viewBox="0 0 256 512">\n <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>\n </symbol>\n <symbol id="icon-bars" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-bookmark" viewBox="0 0 384 512">\n <path d="M0 512V48C0 21.49 21.49 0 48 0h288c26.51 0 48 21.49 48 48v464L192 400 0 512z"></path>\n </symbol>\n <symbol id="icon-caret-down" viewBox="0 0 320 512">\n <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>\n </symbol>\n <symbol id="icon-caret-right" viewBox="0 0 192 512">\n <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>\n </symbol>\n <symbol id="icon-check" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-circle" viewBox="0 0 512 512">\n <path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"></path>\n </symbol>\n <symbol id="icon-cog" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-database" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-edit" viewBox="0 0 576 512">\n <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>\n </symbol>\n <symbol id="icon-eye" viewBox="0 0 576 512">\n <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>\n </symbol>\n <symbol id="icon-eye-slash" viewBox="0 0 640 512">\n <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>\n </symbol>\n <symbol id="icon-gavel" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-globe" viewBox="0 0 496 512">\n <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>\n </symbol>\n <symbol id="icon-id-card" viewBox="0 0 576 512">\n <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>\n </symbol>\n <symbol id="icon-id-card-alt" viewBox="0 0 576 512">\n <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>\n </symbol>\n <symbol id="icon-info" viewBox="0 0 192 512">\n <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>\n </symbol>\n <symbol id="icon-info-circle" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-list-ul" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-lock" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-lock-open" viewBox="0 0 576 512">\n <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>\n </symbol>\n <symbol id="icon-minus" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-minus-circle" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-minus-square" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-paper-plane" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-paperclip" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-pencil-alt" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-phone" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-plus" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-plus-circle" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-plus-square" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-save" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-sign-out-alt" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-smile" viewBox="0 0 496 512">\n <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>\n </symbol>\n <symbol id="icon-snowflake" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-spinner" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-sync" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-times" viewBox="0 0 352 512">\n <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>\n </symbol>\n <symbol id="icon-times-circle" viewBox="0 0 512 512">\n <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>\n </symbol>\n <symbol id="icon-trash" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-trash-alt" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-unlock" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-user" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-user-cog" viewBox="0 0 640 512">\n <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>\n </symbol>\n <symbol id="icon-user-plus" viewBox="0 0 640 512">\n <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>\n </symbol>\n <symbol id="icon-user-secret" viewBox="0 0 448 512">\n <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>\n </symbol>\n <symbol id="icon-users" viewBox="0 0 640 512">\n <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>\n </symbol>\n <symbol id="icon-wrench" viewBox="0 0 512 512">\n <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>\n </symbol>\n </svg>\n']);return Tg=function(){return e},e}function Og(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="converse-chatboxes row no-gutters"></div>\n <div id="converse-modals" class="modals"></div>\n <converse-fontawesome></converse-fontawesome>\n']);return Og=function(){return e},e}window.customElements.define("converse-fontawesome",class extends rc{render(){return Fa(Tg())}});var jg=function(e,t,n){var r=null==e?0:e.length;return r?(t=n||void 0===t?1:Mi(t),ot(e,t<0?0:t,r)):[]};var kg=function(e,t){var n=[];return Ks(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n};var Ng=function(e,t){return(r(e)?an:kg)(e,Fs(t,3))};var Mg=function(e){return e&&e.length?e[0]:void 0};var Ig=function(e){return"function"==typeof e?e:Ze};var Rg=function(e,t){return(r(e)?Qt:Ks)(e,Ig(t))};var Dg=function(e,t){return _e(t,(function(t){return e[t]}))};var Lg=function(e){return null==e?[]:Dg(e,tn(e))},zg=Math.max;var Pg=function(e,t,n,r){e=St(e)?e:Lg(e),n=n&&!r?Mi(n):0;var i=e.length;return n<0&&(n=zg(i+n,0)),er(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&oo(e,t,n)>-1};var Fg=function(e){return(null==e?0:e.length)?ot(e,0,-1):[]};var Bg=function(e,t){return(r(e)?_e:Mo)(e,Fs(t,3))};var Hg=function(e,t,n){for(var r=-1,i=e.length;++r<i;){var s=e[r],o=t(s);if(null!=o&&(void 0===a?o==o&&!g(o):n(o,a)))var a=o,c=s}return c};var qg=function(e,t){return e>t};var Ug=function(e){return e&&e.length?Hg(e,Ze,qg):void 0};var Vg=function(e,t){return e<t};var $g=function(e){return e&&e.length?Hg(e,Ze,Vg):void 0};var Gg=function(e,t,n,r){var i=-1,s=null==e?0:e.length;for(r&&s&&(n=e[++i]);++i<s;)n=t(n,e[i],i,e);return n};var Wg=function(e,t,n,r,i){return i(e,(function(e,i,s){n=r?(r=!1,e):t(n,e,i,s)})),n};var Jg=function(e,t,n){var i=r(e)?Gg:Wg,s=arguments.length<3;return i(e,Fs(t,4),n,s,Ks)};var Xg=function(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n},Qg=is(!0);var Yg=Ys((function(e,t){return e&&Qg(e,t,tn)}),!0);var Kg=function(e,t,n){var i=r(e)?Xg:Wg,s=arguments.length<3;return i(e,Fs(t,4),n,s,Yg)};var Zg=function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}};var ev=function(e,t){return(r(e)?an:kg)(e,Zg(Fs(t,3)))};var tv=function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=void 0===t?t:Mi(t),lt(e,t)},nv=Math.floor,rv=Math.random;var iv=function(e,t){return e+nv(rv()*(t-e+1))};var sv=function(e){var t=e.length;return t?e[iv(0,t-1)]:void 0};var ov=function(e){return sv(Lg(e))};var av=function(e){return(r(e)?sv:ov)(e)};var cv=function(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var s=iv(n,i),o=e[s];e[s]=e[n],e[n]=o}return e.length=t,e};var lv=function(e){return cv(on(e))};var uv=function(e){return cv(Lg(e))};var dv=function(e){return(r(e)?lv:uv)(e)},hv=Ls("length"),fv=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var pv=function(e){return fv.test(e)},mv="[\\ud800-\\udfff]",gv="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",vv="\\ud83c[\\udffb-\\udfff]",_v="[^\\ud800-\\udfff]",bv="(?:\\ud83c[\\udde6-\\uddff]){2}",yv="[\\ud800-\\udbff][\\udc00-\\udfff]",wv="(?:"+gv+"|"+vv+")"+"?",Sv="[\\ufe0e\\ufe0f]?"+wv+("(?:\\u200d(?:"+[_v,bv,yv].join("|")+")[\\ufe0e\\ufe0f]?"+wv+")*"),xv="(?:"+[_v+gv+"?",gv,bv,yv,mv].join("|")+")",Ev=RegExp(vv+"(?="+vv+")|"+xv+Sv,"g");var Av=function(e){for(var t=Ev.lastIndex=0;Ev.test(e);)++t;return t};var Cv=function(e){return pv(e)?Av(e):hv(e)};var Tv=function(e){if(null==e)return 0;if(St(e))return er(e)?Cv(e):e.length;var t=jn(e);return"[object Map]"==t||"[object Set]"==t?e.size:en(e).length};var Ov=function(e){var t=null==e?0:e.length;return t?ot(e,1,t):[]};var jv=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:Mi(t),ot(e,0,t<0?0:t)):[]};var kv=function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n};var Nv=function(e){return e.split("")},Mv="[\\ud800-\\udfff]",Iv="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Rv="[^\\ud800-\\udfff]",Dv="(?:\\ud83c[\\udde6-\\uddff]){2}",Lv="[\\ud800-\\udbff][\\udc00-\\udfff]",zv="(?:"+Iv+"|\\ud83c[\\udffb-\\udfff])"+"?",Pv="[\\ufe0e\\ufe0f]?"+zv+("(?:\\u200d(?:"+[Rv,Dv,Lv].join("|")+")[\\ufe0e\\ufe0f]?"+zv+")*"),Fv="(?:"+[Rv+Iv+"?",Iv,Dv,Lv,Mv].join("|")+")",Bv=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+Fv+Pv,"g");var Hv=function(e){return e.match(Bv)||[]};var qv=function(e){return pv(e)?Hv(e):Nv(e)},Uv=s?s.iterator:void 0;var Vv=function(e){if(!e)return[];if(St(e))return er(e)?qv(e):on(e);if(Uv&&e[Uv])return kv(e[Uv]());var t=jn(e);return("[object Map]"==t?_s:"[object Set]"==t?bs:Lg)(e)},$v=lt((function(e,t){return uo(e)?lo(e,t):[]}));
/*!
* Copyright (c) JC Brand <jc@opkode.com>
*/
const Gv=function(e){this.views={},this.keys=()=>Object.keys(this.views),this.getAll=()=>this.views,this.get=e=>this.views[e],this.xget=e=>this.keys().filter(t=>t!==e).reduce((e,t)=>(e[t]=this.views[t],e),{}),this.add=(e,t)=>(this.views[e]=t,t),this.remove=e=>{void 0===e&&(new wh).remove.apply(this);const t=this.views[e];if(t)return delete this.views[e],t.remove(),t},this.removeAll=()=>(this.keys().forEach(e=>this.remove(e)),this),wh.apply(this,Array.prototype.slice.apply(arguments))},Wv={includes:Pg,difference:ho,drop:jg,every:mo,filter:Ng,find:fl,first:Mg,forEach:Rg,head:Mg,indexOf:Eo,initial:Fg,invoke:ut,isEmpty:ki,last:st,lastIndexOf:jo,map:Bg,max:Ug,min:$g,reduce:Jg,reduceRight:Kg,reject:ev,rest:tv,sample:av,shuffle:dv,size:Tv,some:No,sortBy:zo,tail:Ov,take:jv,toArray:Vv,without:$v};Object.keys(Wv).forEach(e=>{Gv.prototype[e]=function(){const t=Array.prototype.slice.call(arguments);return t.unshift(this.views),Wv[e].apply(this,t)}}),Object.assign(Gv.prototype,wh.prototype),Gv.extend=wh.extend;const Jv=Gv.extend({listItems:"model",sortEvent:"change",sortImmediatelyOnAdd:!1,listSelector:".ordered-items",ItemView:void 0,subviewIndex:"id",initialize(){this.sortEventually=yt(()=>this.sortAndPositionAllItems(),100),this.items=Rs(this,this.listItems),this.items.on("remove",this.removeView,this),this.items.on("reset",this.removeAll,this),this.items.on("add",(e,t)=>{this.sortImmediatelyOnAdd?this.sortAndPositionAllItems():this.sortEventually()}),this.sortEvent&&this.items.on(this.sortEvent,this.sortEventually,this)},createItemView(e){let t=this.get(e.get(this.subviewIndex));return t?(t.model=e,t.initialize()):(t=new this.ItemView({model:e}),this.add(e.get(this.subviewIndex),t)),t.render(),t},removeView(e){this.remove(e.get(this.subviewIndex))},sortAndPositionAllItems(){if(!this.items.length)return;this.items.sort();const e=this.el.querySelector(this.listSelector),t=document.createElement("div");e.parentNode.replaceChild(t,e),this.items.forEach(t=>{let n=this.get(t.get(this.subviewIndex));n||(n=this.createItemView(t)),e.insertAdjacentElement("beforeend",n.el)}),t.parentNode.replaceChild(e,t)}}),Xv=zc.env.utils;var Qv=Gv.extend({_ensureElement(){if(this.el)this.setElement(wi(this,"el"),!1);else{let e=xc.root.querySelector("#conversejs");if(null===e){e=document.createElement("div"),e.setAttribute("id","conversejs"),Xv.addClass("theme-".concat(Tc.settings.get("theme")),e);const t=xc.root.querySelector("body");t?t.appendChild(e):xc.root.appendChild(e)}this.setElement(e,!1)}},initialize(){this.listenTo(this.model,"destroy",this.removeChat);const e=document.getElementById("conversejs-bg");e&&!e.innerHTML.trim()&&za(Fa(Cg()),e),document.querySelector("body").classList.add("converse-".concat(Tc.settings.get("view_mode"))),this.el.classList.add("converse-".concat(Tc.settings.get("view_mode"))),Tc.settings.get("singleton")&&this.el.classList.add("converse-singleton"),this.render()},render(){this._ensureElement(),za(Fa(Og()),this.el),this.row_el=this.el.querySelector(".row")},insertRowColumn(e){this.row_el.insertAdjacentElement("afterBegin",e)},removeChat(e){this.remove(e.get("id"))},closeAllChatBoxes(){return Promise.all(this.map(e=>e.close({name:"closeAllChatBoxes"})))}});
/**
* @module converse-chatboxviews
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/function Yv(){xc.chatboxviews=new xc.ChatBoxViews({model:xc.chatboxes}),Tc.trigger("chatBoxViewsInitialized")}function Kv(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(e,"px"))}function Zv(){const e=t_(["<p>","</p>"]);return Zv=function(){return e},e}function e_(){const e=t_(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header ','">\n <h5 class="modal-title">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n ',"\n </div>\n </div>\n </div>\n"]);return e_=function(){return e},e}function t_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}zc.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Tc.elements.register(),Tc.promises.add(["chatBoxViewsInitialized"]),Tc.settings.extend({animate:!0,theme:"default"}),xc.ViewWithAvatar=Ag,xc.ChatBoxViews=Qv,Tc.listen.on("chatBoxesInitialized",Yv),Tc.listen.on("cleanup",()=>delete xc.chatboxviews),Tc.listen.on("clearSession",()=>xc.chatboxviews.closeAllChatBoxes()),Tc.listen.on("chatBoxViewsInitialized",Kv),window.addEventListener("resize",Kv),Object.assign(zc,{insertInto(e){var t;const n=null===(t=xc.chatboxviews)||void 0===t?void 0:t.el;if(n&&!e.contains(n))e.insertAdjacentElement("afterBegin",n),Tc.chatviews.get().filter(e=>"controlbox"!==e.model.get("id")).forEach(e=>e.maintainScrollTop());else if(!n)throw new Error("Cannot insert non-existing #conversejs element into the DOM")}})}});var n_=Jf.extend({id:"alert-modal",initialize(){Jf.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){return e=Object.assign({__:Pu},this.model.toJSON()),Fa(e_(),e.level,e.title,Zf,e.messages.map(e=>Fa(Zv(),e)));var e}});function r_(){const e=o_(["<p>","</p>"]);return r_=function(){return e},e}function i_(){const e=o_(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header ','">\n <h5 class="modal-title">','</h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close">\n <span aria-hidden="true">×</span>\n </button>\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <form class="converse-form converse-form--modal confirm" action="#">\n <div class="form-group">\n ',"\n </div>\n ",'\n <div class="form-group">\n <button type="submit" class="btn btn-primary">','</button>\n <input type="button" class="btn btn-secondary" data-dismiss="modal" value="','"/>\n </div>\n </form>\n </div>\n </div>\n </div>\n']);return i_=function(){return e},e}function s_(){const e=o_(['\n <div class="form-group">\n <label>\n ','\n <input type="text"\n name="','"\n class="',' form-control form-control--labeled"\n ?required="','"\n placeholder="','" />\n </label>\n </div>\n']);return s_=function(){return e},e}function o_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var a_=e=>Fa(i_(),e.level||"",e.title,e.messages.map(e=>Fa(r_(),e)),e.fields.map(e=>(e=>Fa(s_(),e.label||"",e.name,e.challenge_failed?"error":"",e.required,e.placeholder))(e)),Pu("OK"),Pu("Cancel"));const c_=zc.env.utils;var l_=Jf.extend({id:"confirm-modal",events:{"submit .confirm":"onConfimation"},initialize(){this.confirmation=c_.getResolveablePromise(),Jf.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.el.addEventListener("closed.bs.modal",()=>this.confirmation.reject(),!1)},toHTML(){return a_(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()}});
/**
* @module converse-modal
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/zc.env.BootstrapModal=Jf;let u_=[];const d_={modal:{show(e,t,n){const r=this.get(e.id)||this.create(e,t);return r.show(n),r},get:e=>u_.filter(t=>t.id==e).pop(),create(e,t){const n=new e(t);return u_.push(n),n},remove(e){u_=u_.filter(t=>t!==e),e.remove()},removeAll(){u_.forEach(e=>e.remove()),u_=[]}},async confirm(e,t=[],n=[]){"string"==typeof t&&(t=[t]);const r=new Vs({title:e,messages:t,fields:n,type:"confirm"}),i=new l_({model:r});let s;i.show();try{s=await i.confirmation}catch(e){s=!1}return i.remove(),s},async prompt(e,t=[],n=""){"string"==typeof t&&(t=[t]);const r=new Vs({title:e,messages:t,fields:[{name:"reason",placeholder:n}],type:"prompt"}),i=new l_({model:r});let s;i.show();try{var o;s=null===(o=(await i.confirmation).pop())||void 0===o?void 0:o.value}catch(e){s=!1}return i.remove(),s},alert(e,t,n){let r;"string"==typeof n&&(n=[n]),"error"===e?r="alert-danger":"info"===e?r="alert-info":"warn"===e&&(r="alert-warning");const i=new Vs({title:t,messages:n,level:r,type:"alert"});Tc.modal.show(n_,{model:i})}};function h_(){const e=x_(["<p><label>",":</label> ","</p>"]);return h_=function(){return e},e}function f_(){const e=x_(["<p><label>",':</label> <a href="mailto:','">',"</a></p>"]);return f_=function(){return e},e}function p_(){const e=x_(["<p><label>",':</label> <a target="_blank" rel="noopener" href="','">',"</a></p>"]);return p_=function(){return e},e}function m_(){const e=x_(["<p><label>",":</label> ","</p>"]);return m_=function(){return e},e}function g_(){const e=x_(["<p><label>",":</label> ","</p>"]);return g_=function(){return e},e}function v_(){const e=x_(['<div class="mb-4">',"</div>"]);return v_=function(){return e},e}function __(){const e=x_(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="user-details-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n ',"\n ","\n <p><label>",':</label> <a href="xmpp:','">',"</a></p>\n ","\n ","\n ","\n ","\n\n ",'\n </div>\n <div class="modal-footer">\n ','\n <button type="button" class="btn btn-info refresh-contact"><i class="fa fa-refresh"> </i>',"</button>\n ","\n\n </div>\n </div>\n </div>\n "]);return __=function(){return e},e}function b_(){const e=x_(['\n <button type="button" @click="','" class="btn btn-danger remove-contact">\n <i class="far fa-trash-alt"></i>',"\n </button>\n "]);return b_=function(){return e},e}function y_(){const e=x_(['<li class="list-group-item"> '," </li>"]);return y_=function(){return e},e}function w_(){const e=x_(['\n <hr/>\n <ul class="list-group fingerprints">\n <li class="list-group-item active">',"</li>\n ","\n </ul>\n "]);return w_=function(){return e},e}function S_(){const e=x_(['\n <li class="list-group-item">\n <form class="fingerprint-trust">\n <div class="btn-group btn-group-toggle">\n <label class="btn btn--small ','">\n <input type="radio" name="','" value="1" ?checked=',">",'\n </label>\n <label class="btn btn--small ','">\n <input type="radio" name="','" value="-1" ?checked=',">",'\n </label>\n </div>\n <code class="fingerprint">',"</code>\n </form>\n </li>\n "]);return S_=function(){return e},e}function x_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}zc.plugins.add("converse-modal",{initialize(){Tc.listen.on("disconnect",()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")}),Tc.listen.on("clearSession",()=>Tc.modal.removeAll()),Object.assign(xc.api,d_)}});const E_=e=>{const t=Pu("OMEMO Fingerprints"),n=Pu("No OMEMO-enabled devices found"),r=e.view.devicelist.devices;return Fa(w_(),t,r.length?r.map(t=>(e=>{const t=Pu("Trusted"),n=Pu("Untrusted");return e.device.get("bundle")&&e.device.get("bundle").fingerprint?Fa(S_(),-1!==e.device.get("trusted")?"btn-primary active":"btn-secondary",e.device.get("id"),-1!==e.device.get("trusted"),t,-1!==e.device.get("trusted")?"btn-primary active":"btn-secondary",e.device.get("id"),-1===e.device.get("trusted"),n,e.utils.formatFingerprint(e.device.get("bundle").fingerprint)):""})(Object.assign({device:t},e))):Fa(y_(),n))};var A_=e=>{const t=Pu("XMPP Address"),n=Pu("Email"),r=Pu("Full Name"),i=Pu("Nickname"),s=Pu("The User's Profile Image"),o=Pu("Refresh"),a=Pu("Role"),c=Pu("URL"),l={alt_text:s,extra_classes:"mb-3",height:"120",width:"120"};return Fa(__(),e.display_name,Zf,e.image?Fa(v_(),Hp(Object.assign(e,l))):"",e.fullname?Fa(g_(),r,e.fullname):"",t,e.jid,e.jid,e.nickname?Fa(m_(),i,e.nickname):"",e.url?Fa(p_(),c,e.url,e.url):"",e.email?Fa(f_(),n,e.email,e.email):"",e.role?Fa(h_(),a,e.role):"",e._converse.pluggable.plugins["converse-omemo"].enabled(e._converse)?E_(e):"",Kf,o,e.allow_contact_removal&&e.is_roster_contact?(e=>{const t=Pu("Remove as contact");return Fa(b_(),e.removeContact,t)})(e):"")};const C_=zc.env.utils;const T_=Jf.extend({id:"user-details-modal",persistent:!0,events:{"click button.refresh-contact":"refreshContact","click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){Jf.prototype.initialize.apply(this,arguments),this.model.rosterContactAdded.then(()=>this.registerContactEventHandlers()),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),Tc.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 A_(Object.assign(this.model.toJSON(),n,{_converse:xc,allow_contact_removal:Tc.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:C_}))},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");C_.addClass("fa-spin",t);try{await Tc.vcard.update(this.model.contact.vcard,!0)}catch(e){Lr.fatal(e),this.alert(Pu("Sorry, something went wrong while trying to refresh"),"danger")}C_.removeClass("fa-spin",t)},removeContact(e){if(e&&e.preventDefault&&e.preventDefault(),!Tc.settings.get("allow_contact_removal"))return;!0===confirm(Pu("Are you sure you want to remove this contact?"))&&(setTimeout(()=>{var e;(e=this.model.contact).removeFromRoster(()=>e.destroy(),t=>{t&&Lr.error(t),Tc.alert("error",Pu("Error"),[Pu("Sorry, there was an error while trying to remove %1$s as a contact.",e.getDisplayName())])})},1),this.modal.hide())}});xc.UserDetailsModal=T_;var O_=T_;function j_(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="flyout box-flyout">\n <div class="chat-head chat-head-chatbox row no-gutters"></div>\n <div class="chat-body">\n <div class="chat-content ','" aria-live="polite">\n <div class="chat-content__messages" @scroll=','></div>\n <div class="chat-content__help"></div>\n </div>\n <div class="bottom-panel">\n <div class="message-form-container">\n </div>\n </div>\n </div>\n']);return j_=function(){return e},e}var k_=e=>Fa(j_(),e.show_send_button?"chat-content-sendbutton":"",e.markScrolled);function N_(){const e=P_(['<p class="chat-head__desc">',"</p>"]);return N_=function(){return e},e}function M_(){const e=P_(["<converse-dropdown .items=","></converse-dropdown>"]);return M_=function(){return e},e}function I_(){const e=P_(['<a class="user show-msg-author-modal" @click=',">","</a>"]);return I_=function(){return e},e}function R_(){const e=P_(['<a class="show-msg-author-modal" @click=',">","</a>"]);return R_=function(){return e},e}function D_(){const e=P_(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']);return D_=function(){return e},e}function L_(){const e=P_(['\n <div class="chatbox-title ','">\n <div class="chatbox-title--row">\n ',"\n ",'\n <div class="chatbox-title__text" title="','">\n ','\n </div>\n </div>\n <div class="chatbox-title__buttons row no-gutters">\n ',"\n ","\n </div>\n </div>\n ","\n "]);return L_=function(){return e},e}function z_(){const e=P_(['<span class="mr-2">',"</span>"]);return z_=function(){return e},e}function P_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function F_(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="new-msgs-indicator hidden">▼ ',' ▼</div>\n <form class="setNicknameButtonForm hidden">\n <input type="submit" class="btn btn-primary" name="join" value="Join"/>\n </form>\n <form class="sendXMPPMessage">\n <span class="chat-toolbar no-text-select"></span>\n <input type="text" placeholder="','" value="','" class="',' spoiler-hint"/>\n\n <div class="suggestion-box">\n <ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>\n <textarea\n type="text"\n class="chat-textarea suggestion-box__input\n ',"\n ",'"\n placeholder="','">','</textarea>\n <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>\n </div>\n </form>\n']);return F_=function(){return e},e}function B_(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n <converse-chat-toolbar\n .chatview=","\n .model=",'\n ?composing_spoiler="','"\n ?hidden_occupants="','"\n ?is_groupchat="','"\n ?show_call_button="','"\n ?show_emoji_button="','"\n ?show_occupants_toggle="','"\n ?show_send_button="','"\n ?show_spoiler_button="','"\n ?show_toolbar="','"\n message_limit="','"\n ></converse-chat-toolbar>\n ']);return B_=function(){return e},e}function H_(){const e=$_(['\n <a href="#" class="dropdown-item ','" @click=',' title="','"\n ><i class="fa ','"></i>',"</a\n >\n "]);return H_=function(){return e},e}function q_(){const e=$_(['\n <a\n href="#"\n class="chatbox-btn '," fa ",'"\n @click=','\n title="','"\n ></a>\n ']);return q_=function(){return e},e}function U_(){const e=$_(["\n <converse-chat-content .chatview="," .messages="," notifications=",">\n </converse-chat-content>\n "]);return U_=function(){return e},e}function V_(){const e=$_(["\n <converse-chat-help\n .model=","\n .messages=","\n ?hidden=",'\n type="info"\n chat_type="','"\n ></converse-chat-help>\n ']);return V_=function(){return e},e}function $_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const G_=zc.env.utils,{dayjs:W_}=zc.env;var J_=wh.extend({length:200,className:"chatbox hidden",is_chatroom:!1,events:{"click .chatbox-navback":"showControlBox","click .new-msgs-indicator":"viewUnreadMessages","click .send-button":"onFormSubmitted","click .toggle-clear":"clearMessages","input .chat-textarea":"inputChanged","keydown .chat-textarea":"onKeyDown","keyup .chat-textarea":"onKeyUp","paste .chat-textarea":"onPaste"},async initialize(){this.initDebounced(),this.listenTo(this.model,"change:composing_spoiler",this.renderMessageForm),this.listenTo(this.model,"change:hidden",e=>e.get("hidden")?this.hide():this.show()),this.listenTo(this.model,"change:status",this.onStatusMessageChanged),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"show",this.show),this.listenTo(this.model,"vcard:change",this.renderHeading),this.model.contact&&this.listenTo(this.model.contact,"destroy",this.renderHeading),this.model.rosterContactAdded&&this.model.rosterContactAdded.then(()=>{this.listenTo(this.model.contact,"change:nickname",this.renderHeading),this.renderHeading()}),this.listenTo(this.model.presence,"change:show",this.onPresenceChanged),this.render(),this.listenTo(this.model.messages,"add",this.onMessageAdded),this.listenTo(this.model.messages,"remove",this.renderChatHistory),this.listenTo(this.model.messages,"rendered",this.maybeScrollDown),this.listenTo(this.model.messages,"reset",this.renderChatHistory),this.listenTo(this.model.notifications,"change",this.renderNotifications),this.listenTo(this.model,"change:show_help_messages",this.renderHelpMessages),await this.model.messages.fetched,this.insertIntoDOM(),this.model.maybeShow(),this.scrollDown(),Tc.trigger("chatBoxViewInitialized",this)},initDebounced(){this.markScrolled=yt(this._markScrolled,100),this.debouncedScrollDown=yt(this.scrollDown,100),Tc.settings.get("debounced_content_rendering")?(this.renderChatHistory=yt(()=>this.renderChatContent(!1),100),this.renderNotifications=yt(()=>this.renderChatContent(!0),100)):(this.renderChatHistory=()=>this.renderChatContent(!1),this.renderNotifications=()=>this.renderChatContent(!0))},render(){const e=k_(Object.assign(this.model.toJSON(),{markScrolled:e=>this.markScrolled(e)}));return za(e,this.el),this.content=this.el.querySelector(".chat-content"),this.notifications=this.el.querySelector(".chat-content__notifications"),this.msgs_container=this.el.querySelector(".chat-content__messages"),this.help_container=this.el.querySelector(".chat-content__help"),this.renderChatContent(),this.renderMessageForm(),this.renderHeading(),this},onMessageAdded(e){this.renderChatHistory(),G_.isNewMessage(e)&&("me"===e.get("sender")?this.model.set("scrolled",!1):this.model.get("scrolled",!0)&&this.showNewMessagesIndicator())},getNotifications(){return this.model.notifications.get("chat_state")===xc.COMPOSING?Pu("%1$s is typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===xc.PAUSED?Pu("%1$s has stopped typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===xc.GONE?Pu("%1$s has gone away",this.model.getDisplayName()):""},getHelpMessages:()=>["<strong>/clear</strong>: ".concat(Pu("Remove messages")),"<strong>/close</strong>: ".concat(Pu("Close this chat")),"<strong>/me</strong>: ".concat(Pu("Write in the third person")),"<strong>/help</strong>: ".concat(Pu("Show this menu"))],renderHelpMessages(){za(Fa(V_(),this.model,this.getHelpMessages(),!this.model.get("show_help_messages"),this.model.get("type")),this.help_container)},renderChatContent(e=!1){this.tpl_chat_content||(this.tpl_chat_content=e=>Fa(U_(),this,e.messages,e.notifications));const t=this.model.messages.models,n=e?t:Array.from(t);za(this.tpl_chat_content({messages:n,notifications:this.getNotifications()}),this.msgs_container)},renderToolbar(){if(!Tc.settings.get("show_toolbar"))return this;const e=Object.assign({model:this.model,chatview:this},this.model.toJSON(),this.getToolbarOptions());return za((e=>{const t=Tc.settings.get("message_limit"),n=Tc.settings.get("visible_toolbar_buttons").call,r=Tc.settings.get("visible_toolbar_buttons").emoji,i=Tc.settings.get("show_send_button"),s=Tc.settings.get("visible_toolbar_buttons").spoiler,o=Tc.settings.get("show_toolbar");return Fa(B_(),e.chatview,e.model,e.composing_spoiler,e.hidden_occupants,e.is_groupchat,n,r,e.show_occupants_toggle,i,s,o,t)})(e),this.el.querySelector(".chat-toolbar")),Tc.trigger("renderToolbar",this),this},renderMessageForm(){var e,t;const n=this.el.querySelector(".message-form-container");var r;za((r=Object.assign(this.model.toJSON(),{hint_value:null===(e=this.el.querySelector(".spoiler-hint"))||void 0===e?void 0:e.value,label_message:this.model.get("composing_spoiler")?Pu("Hidden message"):Pu("Message"),label_spoiler_hint:Pu("Optional hint"),message_value:null===(t=this.el.querySelector(".chat-textarea"))||void 0===t?void 0:t.value,show_send_button:Tc.settings.get("show_send_button"),show_toolbar:Tc.settings.get("show_toolbar"),unread_msgs:Pu("You have unread messages")}),Fa(F_(),r.unread_msgs,r.label_spoiler_hint||"",r.hint_value||"",r.composing_spoiler?"":"hidden",r.show_send_button?"chat-textarea-send-button":"",r.composing_spoile?"spoiler":"",r.label_message,r.message_value||"")),n),this.el.addEventListener("focusin",e=>this.emitFocused(e)),this.el.addEventListener("focusout",e=>this.emitBlurred(e)),this.renderToolbar()},showControlBox(){var e;null===(e=xc.chatboxviews.get("controlbox"))||void 0===e||e.show(),this.hide()},showUserDetailsModal(e){e.preventDefault(),Tc.modal.show(O_,{model:this.model},e)},onDragOver(e){e.preventDefault()},onDrop(e){0!=e.dataTransfer.files.length&&(e.preventDefault(),this.model.sendFiles(e.dataTransfer.files))},async renderHeading(){const e=await this.generateHeadingTemplate();za(e,this.el.querySelector(".chat-head-chatbox"))},async getHeadingStandaloneButton(e){const t=await e;return Fa(q_(),t.a_class,t.icon_class,t.handler,t.i18n_title)},async getHeadingDropdownItem(e){const t=await e;return Fa(H_(),t.a_class,t.handler,t.i18n_title,t.icon_class,t.i18n_text)},async generateHeadingTemplate(){var e;const t=null===(e=this.model)||void 0===e?void 0:e.vcard,n=t?t.toJSON():{},r=Pu("The User's Profile Image"),i=Object.assign({alt_text:r,extra_classes:"",height:40,width:40},n),s=await this.getHeadingButtons(),o=s.filter(e=>e.standalone),a=s.filter(e=>!e.standalone);return(e=>{const t=Fa(z_(),qp(e.avatar_data));return Fa(L_(),e.status?"":"chatbox-title--no-desc",xc.api.settings.get("singleton")?"":Fa(D_()),e.type!==xc.HEADLINES_TYPE?Fa(R_(),e.showUserDetailsModal,t):"",e.jid,e.type!==xc.HEADLINES_TYPE?Fa(I_(),e.showUserDetailsModal,e.display_name):e.display_name,e.dropdown_btns.length?Fa(M_(),e.dropdown_btns):"",e.standalone_btns.length?(e=>e.standalone_btns.reverse().map(e=>Rf(e,"")))(e):"",e.status?Fa(N_(),e.status):"")})(Object.assign(this.model.toJSON(),{avatar_data:i,display_name:this.model.getDisplayName(),dropdown_btns:a.map(e=>this.getHeadingDropdownItem(e)),showUserDetailsModal:e=>this.showUserDetailsModal(e),standalone_btns:o.map(e=>this.getHeadingStandaloneButton(e))}))},getHeadingButtons(){const e=[{a_class:"show-user-details-modal",handler:e=>this.showUserDetailsModal(e),i18n_text:Pu("Details"),i18n_title:Pu("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===Tc.settings.get("view_mode")}];return Tc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Pu("Close"),i18n_title:Pu("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Tc.settings.get("view_mode")}),xc.api.hook("getHeadingButtons",this,e)},getToolbarOptions:()=>({}),maybeScrollDown(e){!(!(null==e?void 0:e.get("is_archived"))&&"me"===(null==e?void 0:e.get("sender")))&&this.model.get("scrolled")||this.model.isHidden()||this.debouncedScrollDown()},scrollDown(e){var t,n;if(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.get("scrolled")&&G_.safeSave(this.model,{scrolled:!1,scrollTop:null}),this.msgs_container.scrollTo){const e=this.msgs_container.scrollTop?"smooth":"auto";this.msgs_container.scrollTo({top:this.msgs_container.scrollHeight,behavior:e})}else this.msgs_container.scrollTop=this.msgs_container.scrollHeight;this.onScrolledDown()},maintainScrollTop(){const e=this.model.get("scrollTop");e?this.msgs_container.scrollTop=e:this.scrollDown()},insertIntoDOM(){return xc.chatboxviews.insertRowColumn(this.el),Tc.trigger("chatBoxInsertedIntoDOM",this),this},addSpinner(e=!1){if(null===this.el.querySelector(".spinner")){const t=G_.getElementFromTemplateResult(Qp());e?(this.content.insertAdjacentElement("beforeend",t),this.scrollDown()):this.content.insertAdjacentElement("afterbegin",t)}},clearSpinner(){this.content.querySelectorAll(".spinner").forEach(G_.removeElement)},onStatusMessageChanged(e){this.renderHeading(),Tc.trigger("contactStatusMessageChanged",{contact:e.attributes,message:e.get("status")})},markFollowups(e){const t=e.getAttribute("data-from"),n=e.previousElementSibling,r=W_(e.getAttribute("data-isodate")),i=e.nextElementSibling;G_.hasClass("chat-msg--action",e)||G_.hasClass("chat-msg--action",n)||G_.hasClass("chat-info",e)||G_.hasClass("chat-info",n)||n.getAttribute("data-from")!==t||!r.isBefore(W_(n.getAttribute("data-isodate")).add(10,"minutes"))||e.getAttribute("data-encrypted")!==n.getAttribute("data-encrypted")||G_.addClass("chat-msg--followup",e),i&&(!G_.hasClass("chat-msg--action",e)&&G_.hasClass("chat-info",e)&&i.getAttribute("data-from")===t&&W_(i.getAttribute("data-isodate")).isBefore(r.add(10,"minutes"))&&e.getAttribute("data-encrypted")===i.getAttribute("data-encrypted")?G_.addClass("chat-msg--followup",i):G_.removeClass("chat-msg--followup",i))},parseMessageForCommands(e){const t=e.replace(/^\s*/,"").match(/^\/(.*)\s*$/);if(t){if("clear"===t[1])return this.clearMessages(),!0;if("close"===t[1])return this.close(),!0;if("help"===t[1])return this.model.set({show_help_messages:!0}),!0}},async onFormSubmitted(e){var t;e.preventDefault();const n=this.el.querySelector(".chat-textarea"),r=n.value.trim();if(Tc.settings.get("message_limit")&&r.length>Tc.settings.get("message_limit")||!r.replace(/\s/g,"").length)return;if(!xc.connection.authenticated){const e=Pu("Sorry, the connection has been lost, and your message could not be sent");return Tc.alert("error",Pu("Error"),e),void Tc.connection.reconnect()}let i,s={};this.model.get("composing_spoiler")&&(s=this.el.querySelector("form.sendXMPPMessage input.spoiler-hint"),i=s.value),G_.addClass("disabled",n),n.setAttribute("disabled","disabled"),null===(t=this.el.querySelector("converse-emoji-dropdown"))||void 0===t||t.hideMenu();const o=this.parseMessageForCommands(r),a=o?null:await this.model.sendMessage(r,i);(o||a)&&(s.value="",n.value="",G_.removeClass("correcting",n),n.style.height="auto",this.updateCharCounter(n.value)),a&&Tc.trigger("messageSend",a),"overlayed"===Tc.settings.get("view_mode")&&(this.msgs_container.parentElement.style.display="none"),n.removeAttribute("disabled"),G_.removeClass("disabled",n),"overlayed"===Tc.settings.get("view_mode")&&(this.msgs_container.parentElement.style.display=""),this.model.setChatState(xc.ACTIVE,{silent:!0}),n.focus()},updateCharCounter(e){if(Tc.settings.get("message_limit")){const t=this.el.querySelector(".message-limit"),n=Tc.settings.get("message_limit")-e.length;t.textContent=n,n<1?G_.addClass("error",t):G_.removeClass("error",t)}},onPaste(e){if(0!==e.clipboardData.files.length)return e.preventDefault(),void this.model.sendFiles(Array.from(e.clipboardData.files));this.updateCharCounter(e.clipboardData.getData("text/plain"))},autocompleteInPicker(e,t){const n=this.el.querySelector("converse-emoji-dropdown"),r=this.el.querySelector("converse-emoji-picker");if(r&&n)return r.model.set({ac_position:e.selectionStart,autocompleting:t,query:t}),n.showMenu(),!0},onEmojiReceivedFromPicker(e){const t=this.el.querySelector("converse-emoji-picker").model,n=t.get("autocompleting"),r=t.get("ac_position");this.insertIntoTextArea(e,n,!1,r)},onKeyUp(e){this.updateCharCounter(e.target.value)},onKeyDown(e){if(!e.ctrlKey){if(!e.shiftKey&&!e.altKey&&!e.metaKey)if(e.keyCode===zc.keycodes.TAB){const t=G_.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&this.autocompleteInPicker(e.target,t)&&(e.preventDefault(),e.stopPropagation())}else{if(e.keyCode===zc.keycodes.FORWARD_SLASH)return;if(e.keyCode===zc.keycodes.ESCAPE)return this.onEscapePressed(e);if(e.keyCode===zc.keycodes.ENTER)return this.onEnterPressed(e);if(e.keyCode!==zc.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===zc.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&G_.hasClass("correcting",this.el.querySelector(".chat-textarea")))return this.editLaterMessage()}else{const e=this.el.querySelector(".chat-textarea");if(!e.value||G_.hasClass("correcting",e))return this.editEarlierMessage()}}[zc.keycodes.SHIFT,zc.keycodes.META,zc.keycodes.META_RIGHT,zc.keycodes.ESCAPE,zc.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==xc.COMPOSING&&this.model.setChatState(xc.COMPOSING)}},getOwnMessages(){return this.model.messages.filter({sender:"me"})},onEnterPressed(e){return this.onFormSubmitted(e)},onEscapePressed(e){e.preventDefault();const t=this.model.messages.findLastIndex("correcting"),n=t>=0?this.model.messages.at(t):null;n&&n.save("correcting",!1),this.insertIntoTextArea("",!0,!1)},async onMessageRetractButtonClicked(e){if("me"!==e.get("sender"))return Lr.error("onMessageRetractButtonClicked called for someone else's message!");const t=Pu("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),n=[Pu("Are you sure you want to retract this message?")];Tc.settings.get("show_retraction_warning")&&(n[1]=t),await Tc.confirm(Pu("Confirm"),n)&&this.model.retractOwnMessage(e)},onMessageEditButtonClicked(e){var t;const n=this.model.messages.findWhere("correcting"),r=null===(t=this.el.querySelector(".chat-textarea"))||void 0===t?void 0:t.value;(!r||n&&n.get("message")===r||confirm(Pu("You have an unsent message which will be lost if you continue. Are you sure?")))&&(n!==e?(null==n||n.save("correcting",!1),e.save("correcting",!0),this.insertIntoTextArea(G_.prefixMentions(e),!0,!0)):(e.save("correcting",!1),this.insertIntoTextArea("",!0,!1)))},editLaterMessage(){let e,t=this.model.messages.findLastIndex("correcting");if(t>=0)for(this.model.messages.at(t).save("correcting",!1);t<this.model.messages.length-1;){t+=1;const n=this.model.messages.at(t);if(n.get("editable")){e=n;break}}e?(this.insertIntoTextArea(G_.prefixMentions(e),!0,!0),e.save("correcting",!0)):this.insertIntoTextArea("",!0,!1)},editEarlierMessage(){let e,t=this.model.messages.findLastIndex("correcting");if(t>=0)for(this.model.messages.at(t).save("correcting",!1);t>0;){t-=1;const n=this.model.messages.at(t);if(n.get("editable")){e=n;break}}e=e||this.getOwnMessages().reverse().find(e=>e.get("editable")),e&&(this.insertIntoTextArea(G_.prefixMentions(e),!0,!0),e.save("correcting",!0))},inputChanged(e){const t=e.target.scrollHeight+"px";e.target.style.height!=t&&(e.target.style.height="auto",e.target.style.height=t)},async clearMessages(e){return e&&e.preventDefault&&e.preventDefault(),!0===confirm(Pu("Are you sure you want to clear the messages from this conversation?"))&&await this.model.clearMessages(),this},insertIntoTextArea(e,t=!1,n=!1,r){const i=this.el.querySelector(".chat-textarea");if(n?G_.addClass("correcting",i):G_.removeClass("correcting",i),t)i.value=r&&"string"==typeof t?i.value.replace(new RegExp(t,"g"),(n,i)=>i==r-t.length?e+" ":n):e;else{let t=i.value;t&&" "!==t[t.length-1]&&(t+=" "),i.value=t+e+" "}this.updateCharCounter(i.value),G_.placeCaretAtEnd(i)},onPresenceChanged(e){const t=e.get("show"),n=this.model.getDisplayName();let r;G_.isVisible(this.el)&&("offline"===t?r=Pu("%1$s has gone offline",n):"away"===t?r=Pu("%1$s has gone away",n):"dnd"===t?r=Pu("%1$s is busy",n):"online"===t&&(r=Pu("%1$s is online",n)),r&&this.model.createMessage({message:r,type:"info"}))},async close(e){return e&&e.preventDefault&&e.preventDefault(),xc.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&xc.router.navigate(""),Tc.connection.connected()&&(this.model.setChatState(xc.INACTIVE),this.model.sendChatState()),await this.model.close(e),this.remove(),Tc.trigger("chatBoxClosed",this),this},emitBlurred(e){this.el.contains(document.activeElement)||this.el.contains(e.relatedTarget)||Tc.trigger("chatBoxBlurred",this,e)},emitFocused(e){this.el.contains(e.relatedTarget)||Tc.trigger("chatBoxFocused",this,e)},focus(){const e=this.el.getElementsByClassName("chat-textarea")[0];return e&&document.activeElement!==e&&e.focus(),this},maybeFocus(){Tc.settings.get("auto_focus")&&this.focus()},hide(){return this.el.classList.add("hidden"),this},afterShown(){this.model.clearUnreadMsgCounter(),this.model.setChatState(xc.ACTIVE),this.scrollDown(),this.maybeFocus()},show(){this.model.get("hidden")?Lr.debug("Not showing chat ".concat(this.model.get("jid")," because it's set as hidden")):G_.isVisible(this.el)?this.maybeFocus():Tc.settings.get("animate")?G_.fadeIn(this.el,()=>this.afterShown()):(G_.showElement(this.el),this.afterShown())},showNewMessagesIndicator(){G_.showElement(this.el.querySelector(".new-msgs-indicator"))},hideNewMessagesIndicator(){const e=this.el.querySelector(".new-msgs-indicator");null!==e&&e.classList.add("hidden")},_markScrolled:function(e){let t=!0,n=null;this.msgs_container.scrollTop+this.msgs_container.clientHeight>=this.msgs_container.scrollHeight-62?(t=!1,this.onScrolledDown()):0===this.msgs_container.scrollTop?Tc.trigger("chatBoxScrolledUp",this):n=e.target.scrollTop,G_.safeSave(this.model,{scrolled:t,scrollTop:n})},viewUnreadMessages(){this.model.save({scrolled:!1,scrollTop:null}),this.scrollDown()},onScrolledDown(){if(this.hideNewMessagesIndicator(),!this.model.isHidden()){this.model.clearUnreadMsgCounter();const e=window.location.hash;e&&this.model.messages.get(e.slice(1))&&xc.router.history.navigate()}Tc.trigger("chatBoxScrolledDown",{chatbox:this.model})},onWindowStateChanged(e){"visible"===e?!this.model.isHidden()&&this.model.get("num_unread",0)&&this.model.clearUnreadMsgCounter():"hidden"===e&&(this.model.setChatState(xc.INACTIVE,{silent:!0}),this.model.sendChatState())}}),X_={chatviews:{get:e=>void 0===e?Object.values(xc.chatboxviews.getAll()):"string"==typeof e?xc.chatboxviews.get(e):e.map(e=>xc.chatboxviews.get(e))}};
/**
* @module converse-chatview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Q_}=zc.env;function Y_(e){xc.chatboxviews&&xc.chatboxviews.forEach(t=>{"controlbox"!==t.model.get("id")&&t.onWindowStateChanged(e.state)})}function K_(){const e=xc.chatboxviews;xc.chatboxes.on("add",async t=>{e.get(t.get("id"))||t.get("type")!==xc.PRIVATE_CHAT_TYPE||(await t.initialized,e.add(t.get("id"),new xc.ChatBoxView({model:t})))})}let Z_;zc.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){Tc.settings.extend({auto_focus:!0,debounced_content_rendering:!0,filter_url_query_params:null,image_urls_regex:null,message_limit:0,muc_hats:["xep317"],show_images_inline:!0,show_message_avatar:!0,show_retraction_warning:!0,show_send_button:!0,show_toolbar:!0,time_format:"HH:mm",use_system_emojis:!0,visible_toolbar_buttons:{call:!1,clear:!0,emoji:!0,spoiler:!0}}),Object.assign(Tc,X_),xc.ChatBoxView=J_,Tc.listen.on("chatBoxViewsInitialized",K_),Tc.listen.on("windowStateChanged",Y_),Tc.listen.on("connected",()=>Tc.disco.own.features.add(Q_.NS.SPOILER))}});let eb=0;function tb(e){Z_=e}function nb(){Z_=null,eb=0}const rb=Symbol("haunted.phase"),ib=Symbol("haunted.hook"),sb=Symbol("haunted.update"),ob=Symbol("haunted.commit"),ab=Symbol("haunted.effects"),cb=Symbol("haunted.layoutEffects");class lb{constructor(e,t){this.update=e,this.host=t,this[ib]=new Map,this[ab]=[],this[cb]=[]}run(e){tb(this);let t=e();return nb(),t}_runEffects(e){let t=this[e];tb(this);for(let e of t)e.call(this);nb()}runEffects(){this._runEffects(ab)}runLayoutEffects(){this._runEffects(cb)}teardown(){this[ib].forEach(e=>{"function"==typeof e.teardown&&e.teardown()})}}const ub=Promise.resolve().then.bind(Promise.resolve());function db(){let e,t=[];function n(){e=null;let n=t;t=[];for(var r=0,i=n.length;r<i;r++)n[r]()}return function(r){t.push(r),null==e&&(e=ub(n))}}const hb=db(),fb=db();class pb{constructor(e,t){this.renderer=e,this.host=t,this.state=new lb(this.update.bind(this),t),this[rb]=null,this._updateQueued=!1}update(){this._updateQueued||(hb(()=>{let e=this.handlePhase(sb);fb(()=>{this.handlePhase(ob,e),fb(()=>{this.handlePhase(ab)})}),this._updateQueued=!1}),this._updateQueued=!0)}handlePhase(e,t){switch(this[rb]=e,e){case ob:return this.commit(t),void this.runEffects(cb);case sb:return this.render();case ab:return this.runEffects(ab)}this[rb]=null}render(){return this.state.run(()=>this.renderer.call(this.host,this.host))}runEffects(e){this.state._runEffects(e)}teardown(){this.state.teardown()}}function mb(e){class t extends pb{constructor(e,t,n){super(e,n||t),this.frag=t}commit(t){e(t,this.frag)}}return function(e,n,r){const i=(r||n||{}).baseElement||HTMLElement,{observedAttributes:s=[],useShadowDOM:o=!0,shadowRootInit:a={}}=r||n||{};class c extends i{constructor(){super(),!1===o?this._scheduler=new t(e,this):(this.attachShadow({mode:"open",...a}),this._scheduler=new t(e,this.shadowRoot,this))}static get observedAttributes(){return e.observedAttributes||s||[]}connectedCallback(){this._scheduler.update()}disconnectedCallback(){this._scheduler.teardown()}attributeChangedCallback(e,t,n){if(t===n)return;let r=""===n||n;Reflect.set(this,((e="")=>e.replace(/-+([a-z])?/g,(e,t)=>t?t.toUpperCase():""))(e),r)}}const l=new Proxy(i.prototype,{getPrototypeOf:e=>e,set(e,t,n,r){let i;if(t in e){if(i=Object.getOwnPropertyDescriptor(e,t),i&&i.set)return i.set.call(r,n),!0;Reflect.set(e,t,n)}return i="symbol"==typeof t||"_"===t[0]?{enumerable:!0,configurable:!0,writable:!0,value:n}:function(e){let t=e;return Object.freeze({enumerable:!0,configurable:!0,get:()=>t,set(e){t=e,this._scheduler.update()}})}(n),Object.defineProperty(r,t,i),i.set&&i.set.call(r,n),!0}});return Object.setPrototypeOf(c.prototype,l),c}}class gb{constructor(e,t){this.id=e,this.state=t}}function vb(e,...t){let n=eb++,r=Z_[ib],i=r.get(n);return i||(i=new e(n,Z_,...t),r.set(n,i)),i.update(...t)}function _b(e){return vb.bind(null,e)}function bb(e){return _b(class extends gb{constructor(t,n,r,i){super(t,n),e(n,this)}update(e,t){this.callback=e,this.lastValues=this.values,this.values=t}call(){this.values&&!this.hasChanged()||this.run()}run(){this.teardown(),this._teardown=this.callback.call(this.state)}teardown(){"function"==typeof this._teardown&&this._teardown()}hasChanged(){return!this.lastValues||this.values.some((e,t)=>this.lastValues[t]!==e)}})}function yb(e,t){e[ab].push(t)}bb(yb);const wb=_b(class extends gb{constructor(e,t,n){super(e,t),this._updater=this._updater.bind(this),this._ranEffect=!1,this._unsubscribe=null,yb(t,this)}update(e){if(this.state.virtual)throw new Error("can't be used with virtual components");return this.Context!==e&&(this._subscribe(e),this.Context=e),this.value}call(){this._ranEffect||(this._ranEffect=!0,this._unsubscribe&&this._unsubscribe(),this._subscribe(this.Context),this.state.update())}_updater(e){this.value=e,this.state.update()}_subscribe(e){const t={Context:e,callback:this._updater};this.state.host.dispatchEvent(new CustomEvent("haunted.context",{detail:t,bubbles:!0,cancelable:!0,composed:!0}));const{unsubscribe:n,value:r}=t;this.value=n?r:e.defaultValue,this._unsubscribe=n}teardown(){this._unsubscribe&&this._unsubscribe()}});_b(class extends gb{constructor(e,t,n,r){super(e,t),this.value=n(),this.values=r}update(e,t){return this.hasChanged(t)&&(this.values=t,this.value=e()),this.value}hasChanged(e=[]){return e.some((e,t)=>this.values[t]!==e)}});bb((function(e,t){e[cb].push(t)})),_b(class extends gb{constructor(e,t,n){super(e,t),this.updater=this.updater.bind(this),"function"==typeof n&&(n=n()),this.makeArgs(n)}update(){return this.args}updater(e){if("function"==typeof e){const t=e,[n]=this.args;e=t(n)}this.makeArgs(e),this.state.update()}makeArgs(e){this.args=Object.freeze([e,this.updater])}}),_b(class extends gb{constructor(e,t,n,r,i){super(e,t),this.dispatch=this.dispatch.bind(this),this.currentState=void 0!==i?i(r):r}update(e){return this.reducer=e,[this.currentState,this.dispatch]}dispatch(e){this.currentState=this.reducer(this.currentState,e),this.state.update()}});const Sb=Array.prototype.includes;const{component:xb,createContext:Eb}=function({render:e}){const t=mb(e),n=function(e){return t=>{const n={Provider:class extends HTMLElement{constructor(){super(),this.listeners=new Set,this.addEventListener("haunted.context",this)}disconnectedCallback(){this.removeEventListener("haunted.context",this)}handleEvent(e){const{detail:t}=e;t.Context===n&&(t.value=this.value,t.unsubscribe=this.unsubscribe.bind(this,t.callback),this.listeners.add(t.callback),e.stopPropagation())}unsubscribe(e){this.listeners.delete(e)}set value(e){this._value=e;for(let t of this.listeners)t(e)}get value(){return this._value}},Consumer:e((function({render:e}){return e(wb(n))})),defaultValue:t};return n}}(t);return{component:t,createContext:n}}({render:za});!function(){const e=new WeakMap,t=new WeakMap;class n extends pb{constructor(e,t){super(e,t),this.state.virtual=!0}render(){return this.state.run(()=>this.renderer.apply(this.host,this.args))}commit(e){this.host.setValue(e),this.host.commit()}teardown(){super.teardown();let n=t.get(this);e.delete(n)}}}();function Ab(){const e=Tb(['\n <p class="brand-subtitle">','</p>\n <p class="brand-subtitle">\n <a target="_blank" rel="nofollow" href="https://conversejs.org">Open Source</a> XMPP chat client\n brought to you by <a target="_blank" rel="nofollow" href="https://opkode.com">Opkode</a>\n </p>\n <p class="brand-subtitle">\n <a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages"\n >Translate</a\n >\n it into your own language\n </p>\n ']);return Ab=function(){return e},e}function Cb(){const e=Tb(["\n ","\n "]);return Cb=function(){return e},e}function Tb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Ob(){const e=kb(['\n <p class="byline">messaging freedom</p>\n ']);return Ob=function(){return e},e}function jb(){const e=kb(['\n <a class="brand-heading" href="https://conversejs.org" target="_blank" rel="noopener">\n <span class="brand-name-wrapper ','">\n <svg\n class="converse-svg-logo"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n viewBox="0 0 364 364"\n >\n <title>Converse</title>\n <g class="cls-1" id="g904">\n <g data-name="Layer 2">\n <g data-name="Layer 7">\n <path\n class="cls-3"\n 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"\n />\n <path\n class="cls-4"\n 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"\n />\n </g>\n </g>\n </g>\n </svg>\n <span class="brand-name">\n <span class="brand-name__text">converse<span class="subdued">.js</span></span>\n ',"\n </span>\n </span>\n </a>\n "]);return jb=function(){return e},e}function kb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-brand-byline",xb(()=>{const e="fullscreen"===Tc.settings.get("view_mode");return Fa(Cb(),e?Fa(Ab(),xc.VERSION_NAME):"")},{useShadowDOM:!1}));function Nb(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n <converse-brand-logo></converse-brand-logo>\n <converse-brand-byline></converse-brand-byline>\n "]);return Nb=function(){return e},e}Tc.elements.define("converse-brand-logo",xb(()=>{const e="fullscreen"===Tc.settings.get("view_mode");return Fa(jb(),e?"brand-name-wrapper--fullscreen":"",e?Fa(Ob()):"")},{useShadowDOM:!1}));Tc.elements.define("converse-brand-heading",xb(()=>Fa(Nb()),{useShadowDOM:!1}));const{dayjs:Mb}=zc.env;var Ib={defaults(){return{bookmarked:!1,box_id:"controlbox",chat_state:void 0,closed:!Tc.settings.get("show_controlbox_by_default"),num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:xc.CONTROLBOX_TYPE,url:""}},initialize(){"controlbox"===this.get("id")?this.set({time_opened:Mb(0).valueOf()}):xc.ChatBox.prototype.initialize.apply(this,arguments)},validate(e){return e.type===xc.CONTROLBOX_TYPE?"embedded"===Tc.settings.get("view_mode")&&Tc.settings.get("singleton")?"Controlbox not relevant in embedded view mode":void 0:xc.ChatBox.prototype.validate.call(this,e)},maybeShow(e){return e||"controlbox"!==this.get("id")?xc.ChatBox.prototype.maybeShow.call(this,e):this},onReconnection:function(){}};var Rb=wh.extend({tagName:"div",className:"controlbox-pane",initialize(){Tc.trigger("controlBoxPaneInitialized",this)}});function Db(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<span class="toggle-feedback">',"</span>"]);return Db=function(){return e},e}function Lb(){const e=new xc.ControlBox({id:"controlbox"});return xc.chatboxes.add(e)}const zb=zc.env.utils;var Pb=wh.extend({tagName:"a",className:"toggle-controlbox hidden",id:"toggle-controlbox",events:{click:"onClick"},attributes:{href:"#"},initialize(){xc.chatboxviews.insertRowColumn(this.render().el),Tc.waitUntil("initialized").then(this.render.bind(this)).catch(e=>Lr.fatal(e))},render(){return za((()=>{const e=Tc.connection.connected()?Pu("Chat Contacts"):Pu("Toggle chat");return Fa(Db(),e)})(),this.el),this},hide(e){zb.isVisible(this.el)&&(zb.hideElement(this.el),e())},show(e){zb.isVisible(this.el)||zb.fadeIn(this.el,e)},showControlBox(){let e=xc.chatboxes.get("controlbox");e||(e=Lb()),Tc.connection.connected()?e.save({closed:!1}):e.trigger("show")},onClick(e){if(e.preventDefault(),zb.isVisible(xc.root.querySelector("#controlbox"))){const e=xc.chatboxes.get("controlbox");Tc.connection.connected?e.save({closed:!0}):e.trigger("hide")}else this.showControlBox()}});function Fb(){const e=Hb(['<a class="chatbox-btn close-chatbox-button fa fa-times"></a>']);return Fb=function(){return e},e}function Bb(){const e=Hb(['\n <div class="flyout box-flyout">\n <div class="chat-head controlbox-head">\n ','\n </div>\n <div class="controlbox-panes"></div>\n </div>']);return Bb=function(){return e},e}function Hb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const qb=zc.env.utils;var Ub={tagName:"div",className:"chatbox",id:"controlbox",events:{"click a.close-chatbox-button":"close"},initialize(){void 0===xc.controlboxtoggle&&(xc.controlboxtoggle=new xc.ControlBoxToggle),xc.controlboxtoggle.el.insertAdjacentElement("afterend",this.el),this.listenTo(this.model,"change:connected",this.onConnected),this.listenTo(this.model,"destroy",this.hide),this.listenTo(this.model,"hide",this.hide),this.listenTo(this.model,"show",this.show),this.listenTo(this.model,"change:closed",this.ensureClosedState),this.render(),Tc.trigger("controlBoxInitialized",this)},render(){this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!Tc.settings.get("show_controlbox_by_default"));const e=(t={sticky_controlbox:Tc.settings.get("sticky_controlbox"),...this.model.toJSON()},Fa(Bb(),t.sticky_controlbox?"":Fa(Fb())));var t;za(e,this.el),this.model.get("closed")?this.hide():this.show();const n=(null==xc?void 0:xc.connection)||{};return n.connected&&n.authenticated&&!n.disconnecting?this.model.get("connected")&&this.renderControlBoxPane():this.renderLoginPanel(),this},onConnected(){this.model.get("connected")&&this.render()},renderLoginPanel(){if(this.el.classList.add("logged-out"),this.loginpanel)this.loginpanel.render();else{this.loginpanel=new xc.LoginPanel({model:new xc.LoginPanelModel});const e=this.el.querySelector(".controlbox-panes");e.innerHTML="",e.appendChild(this.loginpanel.render().el)}return this.loginpanel.initPopovers(),this},renderControlBoxPane(){this.loginpanel&&(this.loginpanel.remove(),delete this.loginpanel),this.controlbox_pane&&qb.isVisible(this.controlbox_pane.el)||(this.el.classList.remove("logged-out"),this.controlbox_pane=new xc.ControlBoxPane,this.el.querySelector(".controlbox-panes").insertAdjacentElement("afterBegin",this.controlbox_pane.el))},async close(e){if(e&&e.preventDefault&&e.preventDefault(),"closeAllChatBoxes"===(null==e?void 0:e.name)&&(xc.disconnection_cause!==xc.LOGOUT||Tc.settings.get("show_controlbox_by_default")))return;if(Tc.settings.get("sticky_controlbox"))return;const t=(null==xc?void 0:xc.connection)||{};return t.connected&&!t.disconnecting?await new Promise((e,t)=>this.model.save({closed:!0},{success:e,error:t,wait:!0})):this.model.trigger("hide"),Tc.trigger("controlBoxClosed",this),this},ensureClosedState(){this.model.get("closed")?this.hide():this.show()},hide(e){if(!Tc.settings.get("sticky_controlbox"))return qb.addClass("hidden",this.el),Tc.trigger("chatBoxClosed",this),Tc.connection.connected()||xc.controlboxtoggle.render(),xc.controlboxtoggle.show(e),this},onControlBoxToggleHidden(){this.model.set("closed",!1),this.el.classList.remove("hidden"),Tc.trigger("controlBoxOpened",this)},show(){return xc.controlboxtoggle.hide(()=>this.onControlBoxToggleHidden()),this},showHelpMessages(){}};function Vb(){const e=Kb(['\n <converse-brand-heading></converse-brand-heading>\n <form id="converse-login" class="converse-form" method="post">\n <div class="conn-feedback fade-in ','">\n <p class="feedback-subject">','</p>\n <p class="feedback-message ','">',"</p>\n </div>\n ","\n </form>\n"]);return Vb=function(){return e},e}function $b(){const e=Kb(["<p>","</p>"]);return $b=function(){return e},e}function Gb(){const e=Kb(['<input class="btn btn-primary login-anon" type="submit" value="','">']);return Gb=function(){return e},e}function Wb(){const e=Kb(["\n ","\n ","\n ","\n "]);return Wb=function(){return e},e}function Jb(){const e=Kb(['\n <div class="form-group">\n <label for="converse-login-jid">',':</label>\n <input id="converse-login-jid"\n ?autofocus=','\n required\n class="form-control"\n type="text"\n name="jid"\n placeholder="','"/>\n </div>\n ',"\n ",'\n <fieldset class="buttons">\n <input class="btn btn-primary" type="submit" value="','"/>\n </fieldset>\n ',"\n "]);return Jb=function(){return e},e}function Xb(){const e=Kb(['\n <fieldset class="switch-form">\n <p>','</p>\n <p><a class="register-account toggle-register-login" href="#converse/register">',"</a></p>\n </fieldset>\n "]);return Xb=function(){return e},e}function Qb(){const e=Kb(['\n <div class="form-group">\n <label for="converse-login-password">','</label>\n <input id="converse-login-password" class="form-control" required="required" type="password" name="password" placeholder="','"/>\n </div>\n ']);return Qb=function(){return e},e}function Yb(){const e=Kb(['\n <div class="form-group form-check login-trusted">\n <input id="converse-login-trusted" type="checkbox" class="form-check-input" name="trusted" ?checked=','>\n <label for="converse-login-trusted" class="form-check-label login-trusted__desc">','</label>\n <i class="fa fa-info-circle" data-toggle="popover"\n data-title="Trusted device?"\n data-content="','"></i>\n </div>\n ']);return Yb=function(){return e},e}function Kb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Zb=e=>{const t=Pu("Log in"),n=Pu("XMPP Address");return Fa(Jb(),n,!!Tc.settings.get("auto_focus"),e.placeholder_username,e.authentication!==e.EXTERNAL?(()=>{const e=Pu("Password");return Fa(Qb(),e,e)})():"",e.show_trust_checkbox?(e=>{const t=Pu("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=Pu("This is a trusted device");return Fa(Yb(),e,n,t)})("off"!==e.show_trust_checkbox):"",t,xc.allow_registration&&!Tc.settings.get("auto_login")&&xc.pluggable.plugins["converse-register"].enabled(xc)?(()=>{const e=Pu("Create an account"),t=Pu("Don't have a chat account?");return Fa(Xb(),t,e)})():"")};var ey=e=>Fa(Vb(),e.conn_feedback_subject?e.conn_feedback_class:"hidden",e.conn_feedback_subject,e.conn_feedback_message?"":"hidden",e.conn_feedback_message,"CONNECTING"===xc.CONNECTION_STATUS[e.connection_status]?Qp({classes:"hor_centered"}):(e=>{const t=Pu("Disconnected"),n=Pu("Click here to log in anonymously");return Fa(Wb(),e.authentication==e.LOGIN||e.authentication==e.EXTERNAL?Zb(e):"",e.authentication==e.ANONYMOUS?Fa(Gb(),n):"",e.authentication==e.PREBIND?Fa($b(),t):"")})(e));const ty=zc.env.utils,{Strophe:ny}=zc.env,ry=[0,1,2,3,4,7,10],iy={0:"Error",1:"Connecting",2:"Connection failure",3:"Authenticating",4:"Authentication failure",5:"Connected",6:"Disconnected",7:"Disconnecting",8:"Attached",9:"Redirect",10:"Reconnecting"},sy={Error:"error",Connecting:"info","Connection failure":"error",Authenticating:"info","Authentication failure":"error",Connected:"info",Disconnected:"error",Disconnecting:"warn",Attached:"info",Redirect:"info",Reconnecting:"warn"},oy=Vs.extend({defaults:{errors:[]}}),ay=wh.extend({tagName:"div",id:"converse-login-panel",className:"controlbox-pane fade-in row no-gutters",events:{"submit form#converse-login":"authenticate","change input":"validate"},initialize(){this.listenTo(this.model,"change",this.render),this.listenTo(xc.connfeedback,"change",this.render),this.render()},toHTML(){const e=xc.connfeedback.get("connection_status");let t,n;return ry.includes(e)&&(n=iy[e],t=sy[n]),ey(Object.assign(this.model.toJSON(),{_converse:xc,ANONYMOUS:xc.ANONYMOUS,EXTERNAL:xc.EXTERNAL,LOGIN:xc.LOGIN,PREBIND:xc.PREBIND,auto_login:Tc.settings.get("auto_login"),authentication:Tc.settings.get("authentication"),connection_status:e,conn_feedback_class:t,conn_feedback_subject:n,conn_feedback_message:xc.connfeedback.get("message"),placeholder_username:(Tc.settings.get("locked_domain")||Tc.settings.get("default_domain"))&&Pu("Username")||Pu("user@domain"),show_trust_checkbox:Tc.settings.get("allow_user_trust_override")}))},initPopovers(){Array.from(this.el.querySelectorAll("[data-title]")).forEach(e=>{new Vf.a.Popover(e,{trigger:"mobile"===Tc.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===Tc.settings.get("view_mode"),container:this.el.parentElement.parentElement.parentElement})})},validate(){const e=this.el.querySelector("form").querySelector("input[name=jid]");return!e.value||Tc.settings.get("locked_domain")||Tc.settings.get("default_domain")||ty.isValidJID(e.value)?(e.setCustomValidity(""),!0):(e.setCustomValidity(Pu("Please enter a valid XMPP address")),!1)},authenticate(e){if(e&&e.preventDefault&&e.preventDefault(),Tc.settings.get("authentication")===xc.ANONYMOUS)return this.connect(xc.jid,null);if(!this.validate())return;const t=new FormData(e.target);xc.config.save({trusted:!!t.get("trusted")});let n=t.get("jid");if(Tc.settings.get("locked_domain")){const e="@"+Tc.settings.get("locked_domain");n.endsWith(e)&&(n=n.substr(0,n.length-e.length)),n=ny.escapeNode(n)+e}else Tc.settings.get("default_domain")&&!n.includes("@")&&(n=n+"@"+Tc.settings.get("default_domain"));this.connect(n,t.get("password"))},connect(e,t){["converse/login","converse/register"].includes(xc.router.history.getFragment())&&xc.router.navigate("",{replace:!0}),xc.connection&&xc.connection.reset(),Tc.user.login(e,t)}});var cy={controlbox:{async open(){await Tc.waitUntil("chatBoxesFetched");const e=await Tc.chatboxes.get("controlbox")||Tc.chatboxes.create("controlbox",{},xc.Controlbox);return e.trigger("show"),e},get:()=>xc.chatboxviews.get("controlbox")}};
/**
* @module converse-controlbox
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const ly=zc.env.utils;function uy(){xc.chatboxes.on("add",e=>{if(e.get("type")===xc.CONTROLBOX_TYPE){const t=xc.chatboxviews,n=t.get(e.get("id"));n?(n.model=e,n.initialize()):t.add(e.get("id"),new xc.ControlBoxView({model:e}))}})}function dy(){const e=xc.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e}function hy(){const e=null==xc?void 0:xc.chatboxviews,t=e&&e.get("controlbox");t&&(ly.safeSave(t.model,{connected:!1}),(null==t?void 0:t.controlbox_pane)&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}function fy(){(xc.chatboxes.get("controlbox")||Lb()).save({connected:!0})}function py(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="dragresize dragresize-top"></div>\n <div class="dragresize dragresize-topleft"></div>\n <div class="dragresize dragresize-left"></div>\n']);return py=function(){return e},e}zc.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){const{_converse:n}=this.__super__;return e&&"controlbox"==e.id?new n.ControlBox(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){Tc.settings.extend({allow_logout:!0,allow_user_trust_override:!0,default_domain:void 0,locked_domain:void 0,show_controlbox_by_default:!1,sticky_controlbox:!1}),Tc.promises.add("controlBoxInitialized"),Object.assign(Tc,cy),xc.ControlBox=xc.ChatBox.extend(Ib),xc.ControlBoxView=xc.ChatBoxView.extend(Ub),xc.LoginPanelModel=oy,xc.LoginPanel=ay,xc.ControlBoxPane=Rb,xc.ControlBoxToggle=Pb,Tc.listen.on("chatBoxViewsInitialized",uy),Tc.listen.on("chatBoxesFetched",fy),Tc.listen.on("cleanup",()=>delete xc.controlboxtoggle),Tc.listen.on("clearSession",hy),Tc.listen.on("disconnected",()=>dy().renderLoginPanel()),Tc.listen.on("will-reconnect",dy),Tc.waitUntil("chatBoxViewsInitialized").then(Lb).catch(e=>Lr.fatal(e))}});function my(e,t){if(void 0===e)return;if(void 0===t)return e;return e!==t&&Math.abs(e-t)<10?t:e}function gy(e,t){const n=t.el.querySelector(".box-flyout"),r=document.createElement("div");za(Fa(py()),r),n.insertBefore(r,n.firstChild)}function vy(e){if(!xc.resizing||!Tc.settings.get("allow_dragresize"))return!0;e.preventDefault(),xc.resizing.chatbox.resizeChatBox(e)}function _y(e){if(!xc.resizing||!Tc.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=my(xc.resizing.chatbox.height,xc.resizing.chatbox.model.get("default_height")),n=my(xc.resizing.chatbox.width,xc.resizing.chatbox.model.get("default_width"));Tc.connection.connected()?(xc.resizing.chatbox.model.save({height:t}),xc.resizing.chatbox.model.save({width:n})):(xc.resizing.chatbox.model.set({height:t}),xc.resizing.chatbox.model.set({width:n})),xc.resizing=null}var by={initDragResize(){var e;const t=this,n=yt(()=>t.setDimensions());window.addEventListener("resize",t.debouncedSetDimensions),this.listenTo(this.model,"destroy",()=>window.removeEventListener("resize",n));const r=this.el.querySelector(".box-flyout"),i=window.getComputedStyle(r);if(void 0===this.model.get("height")){const e=parseInt(i.height.replace(/px$/,""),10),t=parseInt(i.width.replace(/px$/,""),10);this.model.set("height",e),this.model.set("default_height",e),this.model.set("width",t),this.model.set("default_width",t)}const s=i["min-width"],o=i["min-height"];return this.model.set("min_width",s.endsWith("px")?Number(s.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=xc.connection)||void 0===e?void 0:e.connected)&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===xc.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))),xc.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)))},setWidth(){this.model.get("width")&&(this.el.style.width=this.model.get("width"))},setDimensions(){this.adjustToViewport(),this.setChatBoxHeight(this.model.get("height")),this.setChatBoxWidth(this.model.get("width"))},setChatBoxHeight(e){e=e?my(e,this.model.get("default_height"))+"px":"";const t=this.el.querySelector(".box-flyout");null!==t&&(t.style.height=e)},setChatBoxWidth(e){e=e?my(e,this.model.get("default_width"))+"px":"",this.el.style.width=e;const t=this.el.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)},onStartVerticalResize(e,t=!0){if(!Tc.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=this.el.querySelector(".box-flyout"),r=window.getComputedStyle(n);this.height=parseInt(r.height.replace(/px$/,""),10),xc.resizing={chatbox:this,direction:"top"},this.prev_pageY=e.pageY,t&&Tc.trigger("startVerticalResize",this)},onStartHorizontalResize(e,t=!0){if(!Tc.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=this.el.querySelector(".box-flyout"),r=window.getComputedStyle(n);this.width=parseInt(r.width.replace(/px$/,""),10),xc.resizing={chatbox:this,direction:"left"},this.prev_pageX=e.pageX,t&&Tc.trigger("startHorizontalResize",this)},onStartDiagonalResize(e){this.onStartHorizontalResize(e,!1),this.onStartVerticalResize(e,!1),xc.resizing.direction="topleft",Tc.trigger("startDiagonalResize",this)}};
/**
* @module converse-dragresize
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
/**
* @description UI code XEP-0313 Message Archive Management
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
async function yy(e){if(e.model.messages.length){const t=e.model.get("type")===xc.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const r=t?e.model.get("jid"):xc.bare_jid,i=n&&n.get("stanza_id ".concat(r));e.addSpinner(),i?await kd(e.model,{before:i}):await kd(e.model,{end:n.get("time")}),e.clearSpinner(),xc.router.history.navigate("#".concat(n.get("msgid")))}}}function wy(){const e=xy(['<span class="message-count badge badge-light">',"</span>"]);return wy=function(){return e},e}function Sy(){const e=xy(['\n <div class="chat-head-',' chat-head row no-gutters">\n <a class="restore-chat w-100 align-self-center" title="','" @click=',">\n ","\n ",'\n </a>\n <a class="chatbox-btn close-chatbox-button fa fa-times" @click=',"></a>\n </div>"]);return Sy=function(){return e},e}function xy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}zc.plugins.add("converse-dragresize",{dependencies:["converse-chatview","converse-headlines-view","converse-muc-views"],enabled:e=>"overlayed"==e.api.settings.get("view_mode"),overrides:{ChatBox:{initialize(){const e=this.__super__.initialize.apply(this,arguments),t=this.get("height"),n=this.get("width");return("controlbox"===this.get("id")?e=>this.set(e):e=>this.save(e))({height:my(t,this.get("default_height")),width:my(n,this.get("default_width"))}),e}},ChatBoxView:{events:{"mousedown .dragresize-top":"onStartVerticalResize","mousedown .dragresize-left":"onStartHorizontalResize","mousedown .dragresize-topleft":"onStartDiagonalResize"},render(){const e=this.__super__.render.apply(this,arguments);return gy(this.__super__._converse,this),this.setWidth(),e}},HeadlinesBoxView:{events:{"mousedown .dragresize-top":"onStartVerticalResize","mousedown .dragresize-left":"onStartHorizontalResize","mousedown .dragresize-topleft":"onStartDiagonalResize"},render(){const e=this.__super__.render.apply(this,arguments);return gy(this.__super__._converse,this),this.setWidth(),e}},ControlBoxView:{events:{"mousedown .dragresize-top":"onStartVerticalResize","mousedown .dragresize-left":"onStartHorizontalResize","mousedown .dragresize-topleft":"onStartDiagonalResize"},render(){const e=this.__super__.render.apply(this,arguments);return gy(this.__super__._converse,this),this.setWidth(),e},renderLoginPanel(){const e=this.__super__.renderLoginPanel.apply(this,arguments);return this.initDragResize().setDimensions(),e},renderControlBoxPane(){const e=this.__super__.renderControlBoxPane.apply(this,arguments);return this.initDragResize().setDimensions(),e}},ChatRoomView:{events:{"mousedown .dragresize-top":"onStartVerticalResize","mousedown .dragresize-left":"onStartHorizontalResize","mousedown .dragresize-topleft":"onStartDiagonalResize"},render(){const e=this.__super__.render.apply(this,arguments);return gy(this.__super__._converse,this),this.setWidth(),e}}},initialize(){Tc.settings.extend({allow_dragresize:!0}),Object.assign(xc.ChatBoxView.prototype,by),Tc.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",vy),document.addEventListener("mouseup",_y)})),Tc.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",vy),document.removeEventListener("mouseup",_y)})),Tc.listen.on("beforeShowingChatView",e=>e.initDragResize().setDimensions())}}),
/**
* @module converse-singleton
* @copyright JC Brand
* @license Mozilla Public License (MPLv2)
* @description A plugin which restricts Converse to only one chat.
*/
zc.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){if(Tc.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0}),!Array.isArray(Tc.settings.get("auto_join_rooms"))&&!Array.isArray(Tc.settings.get("auto_join_private_chats")))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(Tc.settings.get("auto_join_rooms").length>1||Tc.settings.get("auto_join_private_chats").length>1)throw new Error("It doesn't make sense to have singleton set to true and auto_join_rooms or auto_join_private_chats set to more then one, since only one chat room may be open at any time.")}}),
/**
* @module converse-fullscreen
* @license Mozilla Public License (MPLv2)
* @copyright 2020, the Converse.js contributors
*/
zc.plugins.add("converse-fullscreen",{enabled:e=>e.isUniView(),initialize(){Tc.settings.extend({chatview_avatar_height:50,chatview_avatar_width:50,hide_open_bookmarks:!0,show_controlbox_by_default:!0,sticky_controlbox:!0})}}),zc.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Tc.listen.on("chatBoxScrolledUp",yy)}});function Ey(){const e=Cy(["<converse-minimized-chat\n .model=","\n title=","\n type=","\n num_unread=","></converse-minimized-chat>"]);return Ey=function(){return e},e}function Ay(){const e=Cy(['<div id="minimized-chats" class="','">\n <a id="toggle-minimized-chats" class="row no-gutters" @click=',">\n "," ",'\n <span class="unread-message-count ','" href="#">','</span>\n </a>\n <div class="flyout minimized-chats-flyout row no-gutters ','">\n ',"\n </div>\n </div>"]);return Ay=function(){return e},e}function Cy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-minimized-chat",class extends rc{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=Pu("Click to restore this chat");return Fa(Sy(),e.type,t,e.restore,e.num_unread?Fa(wy(),e.num_unread):"",e.title,e.close)})({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();const t=xc.chatboxviews.get(this.model.get("id"));t?t.close():(this.model.destroy(),Tc.trigger("chatBoxClosed",this))}restore(e){null==e||e.preventDefault(),this.model.maximize()}});
/**
* @module converse-minimize
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{dayjs:Ty}=zc.env,Oy=zc.env.utils;zc.plugins.add("converse-minimize",{dependencies:["converse-chatview","converse-controlbox","converse-muc-views","converse-headlines-view","converse-dragresize"],enabled:e=>"overlayed"===e.api.settings.get("view_mode"),overrides:{ChatBox:{initialize(){this.__super__.initialize.apply(this,arguments),this.on("show",this.maximize,this),"controlbox"!==this.get("id")&&this.save({minimized:this.get("minimized")||!1,time_minimized:this.get("time_minimized")||Ty()})},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:{show(){const{_converse:e}=this.__super__;return"overlayed"===e.api.settings.get("view_mode")&&this.model.get("minimized")?(this.model.minimize(),this):this.__super__.show.apply(this,arguments)},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(){Tc.settings.extend({no_trimming:!1});const e={maximize(){Oy.safeSave(this,{minimized:!1,time_opened:(new Date).getTime()})},minimize(){Oy.safeSave(this,{minimized:!0,time_minimized:(new Date).toISOString()})}};Object.assign(xc.ChatBox.prototype,e);const t={onMaximized(){const{_converse:e}=this.__super__;return this.insertIntoDOM(),this.model.isScrolledUp()||this.model.clearUnreadMsgCounter(),this.model.setChatState(e.ACTIVE),this.show(),Tc.trigger("chatBoxMaximized",this),this},onMinimized(e){const{_converse:t}=this.__super__;return e&&e.preventDefault&&e.preventDefault(),this.model.collection&&this.model.collection.browserStorage?this.model.save({scroll:this.content.scrollTop}):this.model.set({scroll:this.content.scrollTop}),this.model.setChatState(t.INACTIVE),this.hide(),Tc.trigger("chatBoxMinimized",this),this},minimize(e){return e&&e.preventDefault&&e.preventDefault(),this.model.minimize(),this},onMinimizedChanged(e){e.get("minimized")?this.onMinimized():this.onMaximized()}};Object.assign(xc.ChatBoxView.prototype,t);const n={getChatBoxWidth(e){if("controlbox"===e.model.get("id")){const e=this.get("controlbox");return e&&Oy.isVisible(e.el)?Oy.getOuterWidth(e.el,!0):Oy.getOuterWidth(xc.controlboxtoggle.el,!0)}return!e.model.get("minimized")&&Oy.isVisible(e.el)?Oy.getOuterWidth(e.el,!0):0},getShownChats(){return this.filter(e=>!e.model.get("minimized")&&!e.model.get("closed")&&Oy.isVisible(e.el))},getMinimizedWidth(){var e;const t=null===(e=xc.minimized_chats)||void 0===e?void 0:e.el;return this.model.pluck("minimized").includes(!0)?Oy.getOuterWidth(t,!0):0},getBoxesWidth(e){const t=e?e.model.get("id"):null,n=e?Oy.getOuterWidth(e.el,!0):0;return Object.values(this.xget(t)).reduce((e,t)=>e+this.getChatBoxWidth(t),n)},async trimChats(e){var t;if(Tc.settings.get("no_trimming")||!Tc.connection.connected()||"overlayed"!==Tc.settings.get("view_mode"))return;const n=this.getShownChats();if(n.length<=1)return;const r=Oy.getOuterWidth(document.querySelector("body"),!0);if(this.getChatBoxWidth(n[0])!==r&&(await Tc.waitUntil("minimizedChatsInitialized"),null===(t=xc.minimized_chats)||void 0===t?void 0:t.el))for(;this.getMinimizedWidth()+this.getBoxesWidth(e)>r;){const t=e?e.model.get("id"):null,n=this.getOldestMaximizedChat([t]);if(!n)break;{const e=this.get(n.get("id"));e&&e.hide(),n.minimize()}}},getOldestMaximizedChat(e){e.push("controlbox");let t=0,n=this.model.sort().at(t);for(;e.includes(n.get("id"))||!0===n.get("minimized");)if(t++,n=this.model.at(t),!n)return null;return n}};Object.assign(xc.ChatBoxViews.prototype,n),Tc.promises.add("minimizedChatsInitialized"),xc.MinimizedChatsToggle=Vs.extend({defaults:{collapsed:!1}}),xc.MinimizedChats=wh.extend({tagName:"span",async initialize(){await this.initToggle(),this.render(),this.listenTo(this.minchats,"change:collapsed",this.render),this.listenTo(this.model,"add",this.render),this.listenTo(this.model,"change:fullname",this.render),this.listenTo(this.model,"change:jid",this.render),this.listenTo(this.model,"change:minimized",this.render),this.listenTo(this.model,"change:name",this.render),this.listenTo(this.model,"change:num_unread",this.render),this.listenTo(this.model,"remove",this.render)},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),r={chats:e,num_unread:t,num_minimized:n,collapsed:this.minchats.get("collapsed")};var i;r.toggle=e=>this.toggle(e),za((i=r,Fa(Ay(),i.chats.length?"":"hidden",i.toggle,i.num_minimized,Pu("Minimized"),i.num_unread?"":"unread-message-count-hidden",i.num_unread,i.collapsed?"hidden":"",i.chats.map(e=>Fa(Ey(),e,e.getDisplayName(),e.get("type"),e.get("num_unread"))))),this.el),this.el.parentElement||xc.chatboxviews.insertRowColumn(this.el)},async initToggle(){const e="converse.minchatstoggle-".concat(xc.bare_jid);this.minchats=new xc.MinimizedChatsToggle({id:e}),this.minchats.browserStorage=xc.createStore(e),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")})}}),Tc.listen.on("chatBoxInsertedIntoDOM",e=>xc.chatboxviews.trimChats(e)),Tc.listen.on("connected",()=>{return null===(e=xc.minimized_chats)||void 0===e||e.remove(),xc.minimized_chats=new xc.MinimizedChats({model:xc.chatboxes}),void Tc.trigger("minimizedChatsInitialized");var e}),Tc.listen.on("controlBoxOpened",e=>xc.chatboxviews.trimChats(e)),Tc.listen.on("chatBoxViewInitialized",e=>e.listenTo(e.model,"change:minimized",e.onMinimizedChanged)),Tc.listen.on("chatRoomViewInitialized",e=>{e.listenTo(e.model,"change:minimized",e.onMinimizedChanged),e.model.get("minimized")&&e.hide()}),Tc.listen.on("getHeadingButtons",(e,t)=>e.model.get("type")===xc.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>e.minimize(t),i18n_text:Pu("Minimize"),i18n_title:Pu("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===xc.api.settings.get("view_mode")},r=t.map(e=>e.name).indexOf("signout");return r>-1?[...t.slice(0,r),n,...t.slice(r)]:[n,...t]}(e,t):function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>e.minimize(t),i18n_text:Pu("Minimize"),i18n_title:Pu("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===xc.api.settings.get("view_mode")},r=t.map(e=>e.name).indexOf("close");return r>-1?[...t.slice(0,r),n,...t.slice(r)]:[n,...t]}(e,t));const r=yt(()=>xc.chatboxviews.trimChats(),250);Tc.listen.on("registeredGlobalEventHandlers",()=>window.addEventListener("resize",r)),Tc.listen.on("unregisteredGlobalEventHandlers",()=>window.removeEventListener("resize",r))}});const jy=zc.env.utils,ky={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 r=t[n];n.split(/\s+/).forEach(t=>e.addEventListener(t,r))}},unbind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=t[n];n.split(/\s+/).forEach(t=>e.removeEventListener(t,r))}},regExpEscape:e=>e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),isMention:(e,t)=>t.includes(e[0])||jy.isMentionBoundary(e[0])&&t.includes(e[1])},Ny=function(e,t){return RegExp(ky.regExpEscape(t.trim()),"i").test(e)},My=function(e,t){return RegExp("^"+ky.regExpEscape(t.trim()),"i").test(e)},Iy=function(e,t){const n=e.query.toLowerCase(),r=e.label.toLowerCase().indexOf(n),i=t.label.toLowerCase().indexOf(n);return r===i?function(e,t){return e.length!==t.length?e.length-t.length:e<t?-1:1}(e,t):(-1===r?1/0:r)<(-1===i?1/0:i)?-1:1},Ry=(e,t)=>{t=t.trim();const n=document.createElement("li");n.setAttribute("aria-selected","false");const r=new RegExp("("+t+")","ig");return(t?e.split(r):[e]).forEach(e=>{if(t&&e.match(r)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))}),n};var Dy=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()}};
/**
* @copyright Lea Verou and the Converse.js contributors
* @description
* Started as a fork of Lea Verou's "Awesomplete"
* https://leaverou.github.io/awesomplete/
* @license Mozilla Public License (MPLv2)
*/const Ly=zc.env.utils;class zy{constructor(e,t={}){this.suggestions=[],this.is_opened=!1,Ly.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:Ny,sort:!1!==t.sort&&Iy,item:Ry},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)}},ky.bind(this.input,this._events.input),ky.bind(this.input.form,this._events.form),ky.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=ky.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,r=e.label||t;return""!==n?{label:r,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?Ly.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(){ky.unbind(this.input,this._events.input),ky.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=Ly.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=Ly.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=Ly.ancestor(e.target,"li");t&&(e.preventDefault(),this.select(t,e.target))}onKeyDown(e){if(this.opened){if([zc.keycodes.ENTER,zc.keycodes.TAB].includes(e.keyCode)&&this.selected)return e.preventDefault(),e.stopPropagation(),this.select(),!0;if(e.keyCode===zc.keycodes.ESCAPE)return this.close({reason:"esc"}),!0;if([zc.keycodes.UP_ARROW,zc.keycodes.DOWN_ARROW].includes(e.keyCode))return e.preventDefault(),e.stopPropagation(),this[e.keyCode===zc.keycodes.UP_ARROW?"previous":"next"](),!0}if(![zc.keycodes.SHIFT,zc.keycodes.META,zc.keycodes.META_RIGHT,zc.keycodes.ESCAPE,zc.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=Ly.getCurrentWord(e.target,e.target.selectionEnd-1);ky.isMention(t,this.ac_triggers)&&(this.auto_completing=!0)}}async evaluate(e){const t=this.selected&&e&&(e.keyCode===zc.keycodes.UP_ARROW||e.keyCode===zc.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 r=this.match_current_word?Ly.getCurrentWord(this.input):this.input.value;const i=ky.isMention(r,this.ac_triggers);i&&(this.auto_completing=!0,this.include_triggers.includes(e.key)||(r=Ly.isMentionBoundary(r[0])?r.slice("2"):r.slice("1"))),(i||r.length)&&r.length>=this.min_chars?(this.index=-1,this.ul.innerHTML="",this.suggestions=n.map(e=>new Dy(this.data(e,r),r)).filter(e=>this.filter(e,r)),!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,r))),0===this.ul.children.length?this.close({reason:"nomatches"}):this.open()):(this.close({reason:"nomatches"}),i||(this.auto_completing=!1))}}Object.assign(zy.prototype,zi);var Py=zy;function Fy(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="suggestion-box suggestion-box__name">\n <ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>\n <input\n type="text"\n name="','"\n autocomplete="off"\n @keydown=',"\n @keyup=",'\n class="form-control suggestion-box__input"\n placeholder="','"\n />\n <span\n class="suggestion-box__additions visually-hidden"\n role="status"\n aria-live="assertive"\n aria-relevant="additions"\n ></span>\n </div>\n ']);return Fy=function(){return e},e}function By(){const e=Gy(['<span class="badge badge-secondary">',"</span>"]);return By=function(){return e},e}function Hy(){const e=Gy(['<span class="badge badge-info">',"</span>"]);return Hy=function(){return e},e}function qy(){const e=Gy(['<span class="badge badge-info">',"</span>"]);return qy=function(){return e},e}function Uy(){const e=Gy(['<span class="badge badge-info">',"</span>"]);return Uy=function(){return e},e}function Vy(){const e=Gy(['<span class="badge badge-groupchat">',"</span>"]);return Vy=function(){return e},e}function $y(){const e=Gy(['\n <li class="occupant" id="','" title="','">\n <div class="row no-gutters">\n <div class="col-auto">\n <div class="occupant-status occupant-',' circle" title="','"></div>\n </div>\n <div class="col occupant-nick-badge">\n <span class="occupant-nick">','</span>\n <span class="occupant-badges">\n ',"\n ","\n ","\n ","\n ","\n </span>\n </div>\n </div>\n </li>\n "]);return $y=function(){return e},e}function Gy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-autocomplete",class extends rc{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 Fa(Fy(),this.name,this.onKeyDown,this.onKeyUp,this.placeholder)}firstUpdated(){this.auto_complete=new Py(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?Ny:My,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)}}),xc.FILTER_CONTAINS=Ny,xc.FILTER_STARTSWITH=My,xc.AutoComplete=Py;var Wy=e=>{const t=Pu("Owner"),n=Pu("Admin"),r=Pu("Member"),i=Pu("Moderator"),s=Pu("Visitor");return Fa($y(),e.id,(e=>{const t=Pu("This user is a moderator."),n=Pu("This user can send messages in this groupchat."),r=Pu("This user can NOT send messages in this groupchat."),i="".concat(e.jid," ")||!1;return"moderator"===e.role?"".concat(i).concat(t," ").concat(e.hint_occupant):"participant"===e.role?"".concat(i).concat(n," ").concat(e.hint_occupant):"visitor"===e.role?"".concat(i).concat(r," ").concat(e.hint_occupant):["visitor","participant","moderator"].includes(e.role)?void 0:"".concat(i).concat(e.hint_occupant)})(e),e.show,e.hint_show,e.nick||e.jid,"owner"===e.affiliation?Fa(Vy(),t):"","admin"===e.affiliation?Fa(Uy(),n):"","member"===e.affiliation?Fa(qy(),r):"","moderator"===e.role?Fa(Hy(),i):"","visitor"===e.role?Fa(By(),s):"")};function Jy(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="occupants-header">\n <i class="hide-occupants fa fa-times"></i>\n <div class="occupants-header--title">\n <span class="occupants-heading">','</span>\n </div>\n </div>\n <div class="dragresize dragresize-occupants-left"></div>\n <ul class="occupant-list">',"</ul>\n "]);return Jy=function(){return e},e}const Xy={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"};const Qy=zc.env.utils;function Yy(){const e=Zy(['<p class="form-help">',"</p>"]);return Yy=function(){return e},e}function Ky(){const e=Zy(['\n <form class="converse-form chatroom-form" autocomplete="off" @submit=','>\n <fieldset class="form-group">\n <legend>',"</legend>\n ","\n ",'\n </fieldset>\n <fieldset>\n <input type="submit" class="btn btn-primary" value="','">\n <input type="button" class="btn btn-secondary button-cancel" value="','" @click=',">\n </fieldset>\n </form>\n "]);return Ky=function(){return e},e}function Zy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-muc-sidebar",class extends rc{static get properties(){return{chatroom:{type:Object},occupants:{type:Object}}}connectedCallback(){super.connectedCallback(),this.listenTo(this.occupants,"add",this.requestUpdate),this.listenTo(this.occupants,"remove",this.requestUpdate),this.listenTo(this.occupants,"change",this.requestUpdate)}render(){return(e=>{const t=e=>Pu("Click to mention %1$s in your message.",e.get("nick")),n=Pu("Participants"),r=e.occupants.map(e=>Wy(Object.assign({jid:"",hint_show:Xy[e.get("show")],hint_occupant:t(e)},e.toJSON())));return Fa(Jy(),n,r)})(Object.assign(this.chatroom.toJSON(),{occupants:[...this.occupants.models]}))}shouldShow(){return!this.chatroom.get("hidden_occupants")&&this.chatroom.session.get("connection_status")===zc.ROOMSTATUS.ENTERED}setVisibility(){this.shouldShow()?Qy.showElement(this):Qy.hideElement(this)}});const{sizzle:ew}=zc.env,tw=zc.env.utils;var nw=wh.extend({className:"chatroom-form-container muc-config-form",initialize(e){this.chatroomview=e.chatroomview,this.listenTo(this.chatroomview.model.features,"change:passwordprotected",this.render),this.listenTo(this.chatroomview.model.features,"change:config_stanza",this.render),this.render()},toHTML(){var e,t;const n=tw.toStanza(this.model.get("config_stanza")),r=Tc.settings.get("roomconfig_whitelist");let i=ew("field",n);r.length&&(i=i.filter(e=>r.includes(e.getAttribute("var"))));const s={new_password:!this.model.features.get("passwordprotected"),fixed_username:this.model.get("jid")};return(e=>{const t=Pu("Save"),n=Pu("Cancel");return Fa(Ky(),e.submitConfigForm,e.title,e.title!==e.instructions?Fa(Yy(),e.instructions):"",e.fields,t,n,e.closeConfigForm)})({closeConfigForm:e=>this.closeConfigForm(e),fields:i.map(e=>tw.xForm2TemplateResult(e,n,s)),instructions:null===(e=n.querySelector("instructions"))||void 0===e?void 0:e.textContent,submitConfigForm:e=>this.submitConfigForm(e),title:null===(t=n.querySelector("title"))||void 0===t?void 0:t.textContent})},async submitConfigForm(e){e.preventDefault();const t=ew(":input:not([type=button]):not([type=submit])",e.target).map(tw.webForm2xForm).filter(e=>e);try{await this.model.sendConfiguration(t)}catch(e){Lr.error(e);const t=Pu("Sorry, an error occurred while trying to submit the config form.")+" "+Pu("Check your browser's developer console for details.");Tc.alert("error",Pu("Error"),t)}await this.model.refreshDiscoInfo(),this.chatroomview.closeForm()},closeConfigForm(e){e.preventDefault(),this.chatroomview.closeForm()}});function rw(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <form class="converse-form chatroom-form converse-centered-form" @submit=','>\n <fieldset class="form-group">\n <label>','</label>\n <p class="validation-message">','</p>\n <input class="hidden-username" type="text" autocomplete="username" value="','"></input>\n <input type="password"\n name="password"\n required="required"\n class="form-control ','"\n placeholder="','"/>\n </fieldset>\n <fieldset class="form-group">\n <input class="btn btn-primary" type="submit" value="','"/>\n </fieldset>\n </form>\n ']);return rw=function(){return e},e}var iw=wh.extend({className:"chatroom-form-container muc-password-form",initialize(e){this.chatroomview=e.chatroomview,this.listenTo(this.model,"change:validation_message",this.render),this.render()},toHTML(){return(e=>{const t=Pu("This groupchat requires a password"),n=Pu("Password: "),r=Pu("Submit");return Fa(rw(),e.submitPassword,t,e.validation_message,e.jid,e.validation_message?"error":"",n,r)})({jid:this.model.get("jid"),submitPassword:e=>this.submitPassword(e),validation_message:this.model.get("validation_message")})},submitPassword(e){e.preventDefault();const t=this.el.querySelector("input[type=password]").value;this.chatroomview.model.join(this.chatroomview.model.get("nick"),t),this.model.set("validation_message",null)}});function sw(){const e=aw(['<div class="error error-feedback">',"</div>"]);return sw=function(){return e},e}function ow(){const e=aw(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="add-chatroom-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <div class="suggestion-box room-invite">\n <form @submit=','>\n <div class="form-group">\n <label class="clearfix" for="invitee_jids">',":</label>\n ",'\n <input class="form-control suggestion-box__input"\n required="required"\n name="invitee_jids"\n id="invitee_jids"\n placeholder="','"\n type="text"/>\n <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>\n <ul class="suggestion-box__results suggestion-box__results--below" hidden=""></ul>\n </div>\n <div class="form-group">\n <label>',':</label>\n <textarea class="form-control" name="reason"></textarea>\n </div>\n <div class="form-group">\n <button type="submit" class="btn btn-primary">',"</button>\n </div>\n </form>\n </div>\n </div>\n </div>\n </div>\n "]);return ow=function(){return e},e}function aw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const cw=zc.env.utils;var lw=Jf.extend({id:"muc-invite-modal",initialize(){Jf.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.initInviteWidget()},toHTML(){return(e=>{const t=Pu("Invite"),n=Pu("Invite someone to this groupchat"),r=Pu("user@example.org"),i=Pu("Please enter a valid XMPP address"),s=Pu("XMPP Address"),o=Pu("Optional reason for the invitation");return Fa(ow(),n,Zf,e.submitInviteForm,s,e.invalid_invite_jid?Fa(sw(),i):"",r,o,t)})(Object.assign(this.model.toJSON(),{submitInviteForm:e=>this.submitInviteForm(e)}))},initInviteWidget(){this.invite_auto_complete&&this.invite_auto_complete.destroy();const e=xc.roster.map(e=>({label:e.getDisplayName(),value:e.get("jid")})),t=this.el.querySelector(".suggestion-box").parentElement;this.invite_auto_complete=new xc.AutoComplete(t,{min_chars:1,list:e})},submitInviteForm(e){e.preventDefault();const t=new FormData(e.target),n=t.get("invitee_jids"),r=t.get("reason");cw.isValidJID(n)?(this.chatroomview.model.directInvite(n,r),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}});function uw(){const e=Nw(['<li class="list-group-item">',"</li>"]);return uw=function(){return e},e}function dw(){const e=Nw(['<li class="list-group-item"> '," </li>"]);return dw=function(){return e},e}function hw(){const e=Nw(['<div class="row"><div class="col pt-2"><p class="helptext pb-3">',"</p></div></div>"]);return hw=function(){return e},e}function fw(){const e=Nw(['<input class="form-control" .value="','" @keyup=',' type="text" name="filter" placeholder="','"/>']);return fw=function(){return e},e}function pw(){const e=Nw(['<li class="list-group-item">',"</li>"]);return pw=function(){return e},e}function mw(){const e=Nw(['<li class="list-group-item">',"</li>"]);return mw=function(){return e},e}function gw(){const e=Nw(['<li class="list-group-item"> '," </li>"]);return gw=function(){return e},e}function vw(){const e=Nw(['<div class="row"><div class="col pt-2"><p class="helptext pb-3">',"</p></div></div>"]);return vw=function(){return e},e}function _w(){const e=Nw(['<input class="form-control" .value="','" @keyup=',' type="text" name="filter" placeholder="','"/>']);return _w=function(){return e},e}function bw(){const e=Nw(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="converse-modtools-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body d-flex flex-column">\n <span class="modal-alert"></span>\n\n ','\n\n <div class="tab-content">\n <div class="tab-pane tab-pane--columns ','" id="affiliations-tabpanel" role="tabpanel" aria-labelledby="affiliations-tab">\n <form class="converse-form query-affiliation" @submit=','>\n <p class="helptext pb-3">','</p>\n <div class="form-group">\n <label for="affiliation">\n <strong>',':</strong>\n </label>\n <div class="row">\n <div class="col">\n <select class="custom-select select-affiliation" name="affiliation">\n ','\n </select>\n </div>\n <div class="col">\n <input type="submit" class="btn btn-primary" name="users_with_affiliation" value="','"/>\n </div>\n </div>\n <div class="row">\n <div class="col mt-3">\n ',"\n </div>\n </div>\n\n ",'\n </div>\n </form>\n <div class="scrollable-container">\n <ul class="list-group list-group--users">\n ',"\n ","\n\n ",'\n </ul>\n </div>\n </div>\n\n <div class="tab-pane tab-pane--columns ','" id="roles-tabpanel" role="tabpanel" aria-labelledby="roles-tab">\n <form class="converse-form query-role" @submit=','>\n <p class="helptext pb-3">','</p>\n <div class="form-group">\n <label for="role"><strong>',':</strong></label>\n <div class="row">\n <div class="col">\n <select class="custom-select select-role" name="role">\n ','\n </select>\n </div>\n <div class="col">\n <input type="submit" class="btn btn-primary" name="users_with_role" value="','"/>\n </div>\n </div>\n <div class="row">\n <div class="col mt-3">\n ',"\n </div>\n </div>\n\n ",'\n </div>\n </form>\n <div class="scrollable-container">\n <ul class="list-group list-group--users">\n ',"\n ","\n ","\n </ul>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>"]);return bw=function(){return e},e}function yw(){const e=Nw(['\n <ul class="nav nav-pills justify-content-center">\n <li role="presentation" class="nav-item">\n <a class="nav-link active" id="affiliations-tab" href="#affiliations-tabpanel" aria-controls="affiliations-tabpanel" role="tab" data-toggle="tab" @click=','>Affiliations</a>\n </li>\n <li role="presentation" class="nav-item">\n <a class="nav-link" id="roles-tab" href="#roles-tabpanel" aria-controls="roles-tabpanel" role="tab" data-toggle="tab" @click=',">Roles</a>\n </li>\n </ul>\n"]);return yw=function(){return e},e}function ww(){const e=Nw(['<a href="#" data-form="affiliation-form" class="toggle-form right fa fa-wrench" @click=',"></a>"]);return ww=function(){return e},e}function Sw(){const e=Nw(['\n <li class="list-group-item" data-nick="','">\n <ul class="list-group">\n <li class="list-group-item active">\n <div><strong>JID:</strong> ','</div>\n </li>\n <li class="list-group-item">\n <div><strong>Nickname:</strong> ','</div>\n </li>\n <li class="list-group-item">\n <div><strong>Affiliation:</strong> '," ","</div>\n ","\n </li>\n </ul>\n </li>\n"]);return Sw=function(){return e},e}function xw(){const e=Nw(['<option value="','" ?selected=',">","</option>"]);return xw=function(){return e},e}function Ew(){const e=Nw(['\n <form class="affiliation-form hidden" @submit=','>\n <div class="form-group">\n <input type="hidden" name="jid" value="','"/>\n <input type="hidden" name="nick" value="','"/>\n <div class="row">\n <div class="col">\n <label><strong>',':</strong></label>\n <select class="custom-select select-affiliation" name="affiliation">\n ','\n </select>\n </div>\n <div class="col">\n <label><strong>',':</strong></label>\n <input class="form-control" type="text" name="reason"/>\n </div>\n </div>\n </div>\n <div class="form-group">\n <input type="submit" class="btn btn-primary" name="change" value="','"/>\n </div>\n </form>\n ']);return Ew=function(){return e},e}function Aw(){const e=Nw(['<a href="#" data-form="role-form" class="toggle-form right fa fa-wrench" @click=',"></a>"]);return Aw=function(){return e},e}function Cw(){const e=Nw(['\n <li class="list-group-item" data-nick="','">\n <ul class="list-group">\n <li class="list-group-item active">\n <div><strong>JID:</strong> ','</div>\n </li>\n <li class="list-group-item">\n <div><strong>Nickname:</strong> ','</div>\n </li>\n <li class="list-group-item">\n <div><strong>Role:</strong> '," ","</div>\n ","\n </li>\n </ul>\n </li>\n"]);return Cw=function(){return e},e}function Tw(){const e=Nw(['<option value="','" ?selected=',">","</option>"]);return Tw=function(){return e},e}function Ow(){const e=Nw(['\n <form class="role-form hidden" @submit=','>\n <div class="form-group">\n <input type="hidden" name="jid" value="','"/>\n <input type="hidden" name="nick" value="','"/>\n <div class="row">\n <div class="col">\n <label><strong>',':</strong></label>\n <select class="custom-select select-role" name="role">\n ','\n </select>\n </div>\n <div class="col">\n <label><strong>',':</strong></label>\n <input class="form-control" type="text" name="reason"/>\n </div>\n </div>\n </div>\n <div class="form-group">\n <input type="submit" class="btn btn-primary" value="','"/>\n </div>\n </form>\n ']);return Ow=function(){return e},e}function jw(){const e=Nw(['\n <option value="','"\n ?selected=','\n title="','">',"</option>\n"]);return jw=function(){return e},e}function kw(){const e=Nw(['\n <option value="','"\n ?selected=','\n title="','">',"</option>\n"]);return kw=function(){return e},e}function Nw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Mw(e){return"moderator"===e?Pu("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations."):"participant"===e?Pu("The default role, implies that you can read and write messages."):"visitor"==e?Pu("Visitors aren't allowed to write messages in a moderated multi-user chat."):void 0}function Iw(e){return"owner"===e?Pu("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users."):"admin"===e?Pu("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners."):"outcast"===e?Pu('To ban a user, you give them the affiliation of "outcast".'):void 0}const Rw=e=>Fa(Cw(),e.item.nick,e.item.jid,e.item.nick,e.item.role,e.assignable_roles.length?Fa(Aw(),e.toggleForm):"",e.assignable_roles.length?(e=>{const t=Pu("Change role"),n=Pu("New Role"),r=Pu("Reason");return Fa(Ow(),e.assignRole,e.item.jid,e.item.nick,n,e.assignable_roles.map(t=>Fa(Tw(),t,t===e.item.role,t)),r,t)})(e):""),Dw=e=>Fa(Sw(),e.item.nick,e.item.jid,e.item.nick,e.item.affiliation,e.assignable_affiliations.length?Fa(ww(),e.toggleForm):"",e.assignable_affiliations.length?(e=>{const t=Pu("Change affiliation"),n=Pu("New affiliation"),r=Pu("Reason");return Fa(Ew(),e.assignAffiliation,e.item.jid,e.item.nick,n,e.assignable_affiliations.map(t=>Fa(xw(),t,t===e.item.affiliation,t)),r,t)})(e):"");var Lw=e=>{const t=Pu("Affiliation"),n=Pu("Moderator Tools"),r=Pu("No users with that affiliation found."),i=Pu("No users with that role found."),s=Pu("Type here to filter the search results"),o=Pu("Role"),a=Pu("Show users"),c=Pu("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."),l=Pu("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."),u=e.queryable_roles.length&&e.queryable_affiliations.length;return Fa(bw(),n,Zf,u?(e=>Fa(yw(),e.switchTab,e.switchTab))(e):"",e.queryable_affiliations.length?"active":"",e.queryAffiliation,l,t,e.queryable_affiliations.map(t=>(e=>Fa(jw(),e.item||"",e.item===e.affiliation,Iw(e.item),e.item))(Object.assign({item:t},e))),a,Array.isArray(e.users_with_affiliation)&&e.users_with_affiliation.length>5?Fa(_w(),e.affiliations_filter,e.filterAffiliationResults,s):"",Iw(e.affiliation)?Fa(vw(),Iw(e.affiliation)):"",e.loading_users_with_affiliation?Fa(gw(),Qp()):"",Array.isArray(e.users_with_affiliation)&&0===e.users_with_affiliation.length?Fa(mw(),r):"",e.users_with_affiliation instanceof Error?Fa(pw(),e.users_with_affiliation.message):(e.users_with_affiliation||[]).map(t=>(t.nick||t.jid).match(new RegExp(e.affiliations_filter,"i"))?Dw(Object.assign({item:t},e)):""),!u&&e.queryable_roles.length?"active":"",e.queryRole,c,o,e.queryable_roles.map(t=>(e=>Fa(kw(),e.item||"",e.item===e.role,Mw(e.item),e.item))(Object.assign({item:t},e))),a,Array.isArray(e.users_with_role)&&e.users_with_role.length>5?Fa(fw(),e.roles_filter,e.filterRoleResults,s):"",Mw(e.role)?Fa(hw(),Mw(e.role)):"",e.loading_users_with_role?Fa(dw(),Qp()):"",e.users_with_role&&0===e.users_with_role.length?Fa(uw(),i):"",(e.users_with_role||[]).map(t=>t.nick.match(e.roles_filter)?Rw(Object.assign({item:t},e)):""))};const{Strophe:zw,sizzle:Pw}=zc.env,Fw=zc.env.utils;let Bw;var Hw=Jf.extend({id:"converse-modtools-modal",persistent:!0,initialize(e){Bw=e._converse,this.chatroomview=e.chatroomview,Jf.prototype.initialize.apply(this,arguments),this.affiliations_filter="",this.roles_filter="",this.listenTo(this.model,"change:role",()=>{this.users_with_role=this.chatroomview.model.getOccupantsWithRole(this.model.get("role")),this.render()}),this.listenTo(this.model,"change:affiliation",async()=>{this.loading_users_with_affiliation=!0,this.users_with_affiliation=null,this.render();const e=this.chatroomview.model,t=this.model.get("affiliation");this.shouldFetchAffiliationsList()?this.users_with_affiliation=await e.getAffiliationList(t):this.users_with_affiliation=e.getOccupantsWithAffiliation(t),this.loading_users_with_affiliation=!1,this.render()})},toHTML(){const e=this.chatroomview.model.occupants.findWhere({jid:Bw.bare_jid});return Lw(Object.assign(this.model.toJSON(),{affiliations_filter:this.affiliations_filter,assignAffiliation:e=>this.assignAffiliation(e),assignRole:e=>this.assignRole(e),assignable_affiliations:this.getAssignableAffiliations(e),assignable_roles:this.getAssignableRoles(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:Su.filter(e=>!Bw.modtools_disable_query.includes(e)),queryable_roles:wu.filter(e=>!Bw.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}))},getAssignableAffiliations(e){let t=Tc.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Su:[]),"owner"===e.get("affiliation")?Su.filter(e=>!t.includes(e)):"admin"===e.get("affiliation")?Su.filter(e=>!["owner","admin",...t].includes(e)):[]},getAssignableRoles(e){let t=Tc.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?wu:[]),"moderator"===e.get("role")?wu.filter(e=>!t.includes(e)):[]},shouldFetchAffiliationsList(){const e=this.model.get("affiliation");return"none"!==e&&!this.chatroomview.model.occupants.getAutoFetchedAffiliationLists().includes(e)},toggleForm(e){e.stopPropagation(),e.preventDefault();const t=e.target.getAttribute("data-form"),n=Fw.ancestor(e.target,".list-group-item").querySelector(".".concat(t));Fw.hasClass("hidden",n)?Fw.removeClass("hidden",n):Fw.addClass("hidden",n)},filterRoleResults(e){this.roles_filter=e.target.value,this.render()},filterAffiliationResults(e){this.affiliations_filter=e.target.value,this.render()},queryRole(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target).get("role");this.model.set({role:null},{silent:!0}),this.model.set({role:t})},queryAffiliation(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target).get("affiliation");this.model.set({affiliation:null},{silent:!0}),this.model.set({affiliation:t})},async assignAffiliation(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target),n=t.get("affiliation"),r={jid:t.get("jid"),reason:t.get("reason")},i=this.model.get("affiliation");try{await this.chatroomview.model.setAffiliation(n,[r])}catch(e){return null===e?this.alert(Pu("Timeout error while trying to set the affiliation"),"danger"):Pw('not-allowed[xmlns="'.concat(zw.NS.STANZAS,'"]'),e).length?this.alert(Pu("Sorry, you're not allowed to make that change"),"danger"):this.alert(Pu("Sorry, something went wrong while trying to set the affiliation"),"danger"),void Lr.error(e)}this.alert(Pu("Affiliation changed"),"primary"),await this.chatroomview.model.occupants.fetchMembers(),this.model.set({affiliation:null},{silent:!0}),this.model.set({affiliation:i})},assignRole(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target),n=this.chatroomview.model.getOccupant(t.get("jid")||t.get("nick")),r=t.get("role"),i=t.get("reason"),s=this.model.get("role");this.chatroomview.model.setRole(n,r,i,()=>{this.alert(Pu("Role changed"),"primary"),this.model.set({role:null},{silent:!0}),this.model.set({role:s})},e=>{Pw('not-allowed[xmlns="'.concat(zw.NS.STANZAS,'"]'),e).length?this.alert(Pu("You're not allowed to make that change"),"danger"):(this.alert(Pu("Sorry, something went wrong while trying to set the role"),"danger"),Fw.isErrorObject(e)&&Lr.error(e))})}});function qw(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="user-details-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n ','\n </div>\n <div class="modal-footer">\n ',"\n </div>\n </div>\n </div>\n "]);return qw=function(){return e},e}const Uw=Jf.extend({initialize(){Jf.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),Tc.trigger("occupantModalInitialized",this.model)},toHTML(){return e=Object.assign(this.model.toJSON(),{avatar_data:this.getAvatarData(),display_name:this.model.getDisplayName()}),Fa(qw(),e.display_name,Zf,qp(e.avatar_data),Kf);var e},getAvatarData(){const e=xc.vcards.findWhere({jid:this.model.get("jid")});return{classes:"chat-msg__avatar",height:120,width:120,image:"data:"+((null==e?void 0:e.get("image_type"))||xc.DEFAULT_IMAGE_TYPE)+";base64,"+((null==e?void 0:e.get("image"))||xc.DEFAULT_IMAGE)}}});xc.OccupantModal=Uw;var Vw=Uw;function $w(){const e=oS(['<li class="feature" ><span class="fa fa-database"></span>'," - <em>","</em></li>"]);return $w=function(){return e},e}function Gw(){const e=oS(['<li class="feature" ><span class="fa fa-info-circle"></span>'," - <em>","</em></li>"]);return Gw=function(){return e},e}function Ww(){const e=oS(['<li class="feature" ><span class="fa fa-gavel"></span>'," - <em>","</em></li>"]);return Ww=function(){return e},e}function Jw(){const e=oS(['<li class="feature" ><span class="fa fa-user-secret"></span>'," - <em>","</em></li>"]);return Jw=function(){return e},e}function Xw(){const e=oS(['<li class="feature" ><span class="fa fa-id-card"></span>'," - <em>","</em></li>"]);return Xw=function(){return e},e}function Qw(){const e=oS(['<li class="feature" ><span class="fa fa-snowflake-o"></span>'," - <em>","</em></li>"]);return Qw=function(){return e},e}function Yw(){const e=oS(['<li class="feature" ><span class="fa fa-save"></span>'," - <em>","</em></li>"]);return Yw=function(){return e},e}function Kw(){const e=oS(['<li class="feature" ><span class="fa fa-globe"></span>'," - <em>","</em></li>"]);return Kw=function(){return e},e}function Zw(){const e=oS(['<li class="feature" ><span class="fa fa-address-book"></span>'," - <em>","</em></li>"]);return Zw=function(){return e},e}function eS(){const e=oS(['<li class="feature" ><span class="fa fa-eye"></span>'," - <em>","</em></li>"]);return eS=function(){return e},e}function tS(){const e=oS(['<li class="feature" ><span class="fa fa-eye-slash"></span>'," - <em>","</em></li>"]);return tS=function(){return e},e}function nS(){const e=oS(['<li class="feature" ><span class="fa fa-unlock"></span>'," - <em>","</em></li>"]);return nS=function(){return e},e}function rS(){const e=oS(['<li class="feature" ><span class="fa fa-lock"></span>'," - <em>","</em></li>"]);return rS=function(){return e},e}function iS(){const e=oS(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="muc-details-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <div class="room-info">\n <p class="room-info"><strong>',"</strong>: ",'</p>\n <p class="room-info"><strong>',"</strong>: ",'</p>\n <p class="room-info"><strong>',"</strong>: ","</p>\n ",'\n <p class="room-info"><strong>',"</strong>: ",'</p>\n <p class="room-info"><strong>','</strong>:\n <div class="chatroom-features">\n <ul class="features-list">\n ',"\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ",'\n </ul>\n </div>\n </p>\n </div>\n </div>\n <div class="modal-footer">',"</div>\n </div>\n </div>\n "]);return iS=function(){return e},e}function sS(){const e=oS(['\n <p class="room-info"><strong>',"</strong>: ",'</p>\n <p class="room-info"><strong>',"</strong>: ","</p>\n "]);return sS=function(){return e},e}function oS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var aS=e=>{const t=Pu("Groupchat address (JID)"),n=Pu("Message archiving"),r=Pu("Messages are archived on the server"),i=Pu("Description"),s=Pu("Features"),o=Pu("Hidden"),a=Pu("This groupchat is not publicly searchable"),c=Pu("This groupchat is restricted to members only"),l=Pu("Members only"),u=Pu("Moderated"),d=Pu("Participants entering this groupchat need to request permission to write"),h=Pu("Name"),f=Pu("This groupchat does not require a password upon entry"),p=Pu("No password required"),m=Pu("Not anonymous"),g=Pu("All other groupchat participants can see your XMPP address"),v=Pu("Not moderated"),_=Pu("Participants entering this groupchat can write right away"),b=Pu("Online users"),y=Pu("Open"),w=Pu("Anyone can join this groupchat"),S=Pu("This groupchat requires a password before entry"),x=Pu("Password protected"),E=Pu("Persistent"),A=Pu("This groupchat persists even if it's unoccupied"),C=Pu("Public"),T=Pu("Semi-anonymous"),O=Pu("Only moderators can see your XMPP address"),j=Pu("Temporary"),k=Pu("This groupchat will disappear once the last person leaves");return Fa(iS(),e.display_name,Zf,h,e.name,t,e.jid,i,e.config.description,e.subject?(e=>{const t=Pu("Topic"),n=Pu("Topic author");return Fa(sS(),t,Dm(Im.a.filterXSS(e.subject.text,{whiteList:{}})),n,e.subject&&e.subject.author)})(e):"",b,e.num_occupants,s,e.features.passwordprotected?Fa(rS(),x,S):"",e.features.unsecured?Fa(nS(),p,f):"",e.features.hidden?Fa(tS(),o,a):"",e.features.public_room?Fa(eS(),C,e.__("This groupchat is publicly searchable")):"",e.features.membersonly?Fa(Zw(),l,c):"",e.features.open?Fa(Kw(),y,w):"",e.features.persistent?Fa(Yw(),E,A):"",e.features.temporary?Fa(Qw(),j,k):"",e.features.nonanonymous?Fa(Xw(),m,g):"",e.features.semianonymous?Fa(Jw(),T,O):"",e.features.moderated?Fa(Ww(),u,d):"",e.features.unmoderated?Fa(Gw(),v,_):"",e.features.mam_enabled?Fa($w(),n,r):"",Kf)},cS=Jf.extend({id:"muc-details-modal",initialize(){Jf.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 aS(Object.assign(this.model.toJSON(),{config:this.model.config.toJSON(),display_name:Pu("Groupchat info for %1$s",this.model.getDisplayName()),features:this.model.features.toJSON(),num_occupants:this.model.occupants.length}))}});function lS(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="flyout box-flyout">\n <div class="chat-head chat-head-chatroom row no-gutters"></div>\n <div class="chat-body chatroom-body row no-gutters">\n <div class="chat-area col">\n <div class="chat-content ','" aria-live="polite">\n <div class="chat-content__messages" @scroll=','></div>\n <div class="chat-content__help"></div>\n </div>\n <div class="bottom-panel"></div>\n </div>\n <div class="disconnect-container hidden"></div>\n <converse-muc-sidebar class="occupants col-md-3 col-4 ','"\n .occupants=',"\n .chatroom=","></converse-muc-sidebar>\n </div>\n </div>\n"]);return lS=function(){return e},e}function uS(){const e=mS(['<p class="chat-head__desc" title="','">',"</p>"]);return uS=function(){return e},e}function dS(){const e=mS(["<converse-dropdown .items=","></converse-dropdown>"]);return dS=function(){return e},e}function hS(){const e=mS(['<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="','"></i>']);return hS=function(){return e},e}function fS(){const e=mS(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']);return fS=function(){return e},e}function pS(){const e=mS(['\n <div class="chatbox-title ','">\n ','\n <div class="chatbox-title__text" title="','">',"\n ",'\n </div>\n <div class="chatbox-title__buttons row no-gutters">\n ',"\n ","\n </div>\n </div>\n ","\n "]);return pS=function(){return e},e}function mS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const gS=zc.env.utils;var vS=e=>{const t=Pu("Hide the groupchat topic"),n=Pu("This groupchat is bookmarked"),r=e.subject?gS.addHyperlinks(e.subject.text):"",i=r&&!e.subject_hidden;return Fa(pS(),i?"":"chatbox-title--no-desc",e._converse.api.settings.get("singleton")?"":Fa(fS()),"hidden"!==e._converse.locked_muc_domain?e.jid:"",e.title,e.bookmarked?Fa(hS(),n):"",e.standalone_btns.length?(e=>e.standalone_btns.reverse().map(e=>Rf(e,"")))(e):"",e.dropdown_btns.length?Fa(dS(),e.dropdown_btns):"",i?Fa(uS(),t,r):"")};function _S(){const e=wS(['<div class="muc-bottom-panel"></div>']);return _S=function(){return e},e}function bS(){const e=wS(['<div class="muc-bottom-panel">',"</div>"]);return bS=function(){return e},e}function yS(){const e=wS(['\n <div class="emoji-picker__container dropup"></div>\n <div class="message-form-container">']);return yS=function(){return e},e}function wS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var SS=e=>{const t=Pu("You're not allowed to send messages in this room");return e.entered?e.can_edit?Fa(yS()):Fa(bS(),t):Fa(_S())};function xS(){const e=CS(['<p class="destroyed-reason">"','"</p>']);return xS=function(){return e},e}function ES(){const e=CS(['\n <div class="alert alert-danger">\n <h3 class="alert-heading disconnect-msg">',"</h3>\n ","\n ","\n </div>"]);return ES=function(){return e},e}function AS(){const e=CS(['\n <p class="moved-label">','</p>\n <p class="moved-link"><a class="switch-chat" href="#">',"</a></p>"]);return AS=function(){return e},e}function CS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var TS=(e,t)=>{const n=Pu("This groupchat no longer exists");return Fa(ES(),n,t?Fa(xS(),t):"",e?(e=>{const t=Pu("The conversation has moved. Click below to enter.");return Fa(AS(),t,e)})(e):"")};function OS(){const e=kS(['<p class="disconnect-msg">',"</p>"]);return OS=function(){return e},e}function jS(){const e=kS(['\n <div class="alert alert-danger">\n <h3 class="alert-heading disconnect-msg">',"</h3>\n ","\n </div>"]);return jS=function(){return e},e}function kS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var NS=n(34);function MS(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="chatroom-form-container muc-nickname-form">\n <form class="converse-form chatroom-form converse-centered-form">\n <fieldset class="form-group">\n <label>','</label>\n <p class="validation-message">','</p>\n <input type="text"\n required="required"\n name="nick"\n value="','"\n class="form-control ','"\n placeholder="','"/>\n </fieldset>\n <fieldset class="form-group">\n <input type="submit" class="btn btn-primary" name="join" value="','"/>\n </fieldset>\n </form>\n </div>']);return MS=function(){return e},e}const{sizzle:IS}=zc.env,RS=zc.env.utils,DS=["owner"],LS=["admin","ban","deop","destroy","member","op","revoke"],zS=["kick","mute","voice","modtools"],PS=["nick"],FS={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"},BS={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"};var HS={length:300,tagName:"div",className:"chatbox chatroom hidden",is_chatroom:!0,events:{"click .chatbox-navback":"showControlBox","click .hide-occupants":"hideOccupants","click .new-msgs-indicator":"viewUnreadMessages","click .occupant-nick":function(e){this.insertIntoTextArea(e.target.textContent)},"click .send-button":"onFormSubmitted","dragover .chat-textarea":"onDragOver","drop .chat-textarea":"onDrop","input .chat-textarea":"inputChanged","keydown .chat-textarea":"onKeyDown","keyup .chat-textarea":"onKeyUp","mousedown .dragresize-occupants-left":"onStartResizeOccupants","paste .chat-textarea":"onPaste","submit .muc-nickname-form":"submitNickname"},async initialize(){this.initDebounced(),this.listenTo(this.model,"change",yt(()=>this.renderHeading(),250)),this.listenTo(this.model,"change:composing_spoiler",this.renderMessageForm),this.listenTo(this.model,"change:hidden",e=>e.get("hidden")?this.hide():this.show()),this.listenTo(this.model,"change:hidden_occupants",this.onSidebarToggle),this.listenTo(this.model,"configurationNeeded",this.getAndRenderConfigurationForm),this.listenTo(this.model,"destroy",this.hide),this.listenTo(this.model,"show",this.show),this.listenTo(this.model.features,"change:moderated",this.renderBottomPanel),this.listenTo(this.model.features,"change:open",this.renderHeading),this.listenTo(this.model.messages,"rendered",this.maybeScrollDown),this.listenTo(this.model.session,"change:connection_status",this.onConnectionStatusChanged),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),await this.render(),this.listenTo(this.model,"change:show_help_messages",this.renderHelpMessages),this.listenTo(this.model.messages,"add",this.onMessageAdded),this.listenTo(this.model.messages,"change",this.renderChatHistory),this.listenTo(this.model.messages,"remove",this.renderChatHistory),this.listenTo(this.model.messages,"reset",this.renderChatHistory),this.listenTo(this.model.notifications,"change",this.renderNotifications),this.model.occupants.forEach(e=>this.onOccupantAdded(e)),this.listenTo(this.model.occupants,"add",this.onOccupantAdded),this.listenTo(this.model.occupants,"change",this.renderChatHistory),this.listenTo(this.model.occupants,"change:affiliation",this.onOccupantAffiliationChanged),this.listenTo(this.model.occupants,"change:role",this.onOccupantRoleChanged),this.listenTo(this.model.occupants,"change:show",this.showJoinOrLeaveNotification),this.listenTo(this.model.occupants,"remove",this.onOccupantRemoved),this.renderChatContent(),this.insertIntoDOM();const e=await xc.api.user.settings.getModel();this.listenTo(e,"change:mucs_with_hidden_subject",this.renderHeading),this.onConnectionStatusChanged(),this.model.maybeShow(),this.scrollDown(),Tc.trigger("chatRoomViewInitialized",this)},async render(){const e=!this.shouldShowSidebar();var t;this.el.setAttribute("id",this.model.get("box_id")),za((t={sidebar_hidden:e,model:this.model,occupants:this.model.occupants,show_sidebar:!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===zc.ROOMSTATUS.ENTERED,markScrolled:e=>this.markScrolled(e),muc_show_logs_before_join:Tc.settings.get("muc_show_logs_before_join"),show_send_button:xc.show_send_button},Fa(lS(),t.show_send_button?"chat-content-sendbutton":"",t.markScrolled,t.sidebar_hidden?"hidden":"",t.occupants,t.model)),this.el),this.notifications=this.el.querySelector(".chat-content__notifications"),this.content=this.el.querySelector(".chat-content"),this.msgs_container=this.el.querySelector(".chat-content__messages"),this.help_container=this.el.querySelector(".chat-content__help"),this.renderBottomPanel(),Tc.settings.get("muc_show_logs_before_join")||this.model.session.get("connection_status")===zc.ROOMSTATUS.ENTERED||this.showSpinner(),await this.renderHeading(),!this.model.get("hidden")&&this.show()},getNotifications(){const e=this.model.notifications.toJSON(),t=Tc.settings.get("muc_show_info_messages").filter(e=>zc.MUC_ROLE_CHANGES_LIST.includes(e)),n=Tc.settings.get("muc_show_info_messages").filter(e=>zc.MUC_TRAFFIC_STATES_LIST.includes(e));return[...zc.CHAT_STATES,...n,...t].reduce((t,n)=>{const r=e[n];if(!(null==r?void 0:r.length))return t;const i=r.map(e=>{var t;return(null===(t=this.model.getOccupant(e))||void 0===t?void 0:t.getDisplayName())||e});if(1===i.length){if("composing"===n)return"".concat(t).concat(Pu("%1$s is typing",i[0]),"\n");if("paused"===n)return"".concat(t).concat(Pu("%1$s has stopped typing",i[0]),"\n");if(n===xc.GONE)return"".concat(t).concat(Pu("%1$s has gone away",i[0]),"\n");if("entered"===n)return"".concat(t).concat(Pu("%1$s has entered the groupchat",i[0]),"\n");if("exited"===n)return"".concat(t).concat(Pu("%1$s has left the groupchat",i[0]),"\n");if("op"===n)return"".concat(t).concat(Pu("%1$s is now a moderator",i[0]),"\n");if("deop"===n)return"".concat(t).concat(Pu("%1$s is no longer a moderator",i[0]),"\n");if("voice"===n)return"".concat(t).concat(Pu("%1$s has been given a voice",i[0]),"\n");if("mute"===n)return"".concat(t).concat(Pu("%1$s has been muted",i[0]),"\n")}else if(i.length>1){let e;if(i.length>3)e="".concat(Array.from(i).slice(0,2).join(", ")," and others");else{const t=i.pop();e=Pu("%1$s and %2$s",i.join(", "),t)}if("composing"===n)return"".concat(t).concat(Pu("%1$s are typing",e),"\n");if("paused"===n)return"".concat(t).concat(Pu("%1$s have stopped typing",e),"\n");if(n===xc.GONE)return"".concat(t).concat(Pu("%1$s have gone away",e),"\n");if("entered"===n)return"".concat(t).concat(Pu("%1$s have entered the groupchat",e),"\n");if("exited"===n)return"".concat(t).concat(Pu("%1$s have left the groupchat",e),"\n");if("op"===n)return"".concat(t).concat(Pu("%1$s are now moderators",i[0]),"\n");if("deop"===n)return"".concat(t).concat(Pu("%1$s are no longer moderators",i[0]),"\n");if("voice"===n)return"".concat(t).concat(Pu("%1$s have been given voices",i[0]),"\n");if("mute"===n)return"".concat(t).concat(Pu("%1$s have been muted",i[0]),"\n")}return t},"")},getHelpMessages(){const e=Tc.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return["<strong>/admin</strong>: ".concat(Pu("Change user's affiliation to admin")),"<strong>/ban</strong>: ".concat(Pu("Ban user by changing their affiliation to outcast")),"<strong>/clear</strong>: ".concat(Pu("Clear the chat area")),"<strong>/close</strong>: ".concat(Pu("Close this groupchat")),"<strong>/deop</strong>: ".concat(Pu("Change user role to participant")),"<strong>/destroy</strong>: ".concat(Pu("Remove this groupchat")),"<strong>/help</strong>: ".concat(Pu("Show this menu")),"<strong>/kick</strong>: ".concat(Pu("Kick user from groupchat")),"<strong>/me</strong>: ".concat(Pu("Write in 3rd person")),"<strong>/member</strong>: ".concat(Pu("Grant membership to a user")),"<strong>/modtools</strong>: ".concat(Pu("Opens up the moderator tools GUI")),"<strong>/mute</strong>: ".concat(Pu("Remove user's ability to post messages")),"<strong>/nick</strong>: ".concat(Pu("Change your nickname")),"<strong>/op</strong>: ".concat(Pu("Grant moderator role to user")),"<strong>/owner</strong>: ".concat(Pu("Grant ownership of this groupchat")),"<strong>/register</strong>: ".concat(Pu("Register your nickname")),"<strong>/revoke</strong>: ".concat(Pu("Revoke the user's current affiliation")),"<strong>/subject</strong>: ".concat(Pu("Set groupchat subject")),"<strong>/topic</strong>: ".concat(Pu("Set groupchat subject (alias for /subject)")),"<strong>/voice</strong>: ".concat(Pu("Allow muted user to post messages"))].filter(e=>t.every(t=>!e.startsWith(t+"<",9))).filter(e=>this.getAllowedCommands().some(t=>e.startsWith(t+"<",9)))},async renderHeading(){const e=await this.generateHeadingTemplate();za(e,this.el.querySelector(".chat-head-chatroom"))},renderBottomPanel(){const e=this.el.querySelector(".bottom-panel"),t=this.model.session.get("connection_status")===zc.ROOMSTATUS.ENTERED,n=t&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());za(SS({can_edit:n,entered:t}),e),t&&n&&(this.renderMessageForm(),this.initMentionAutoComplete())},onStartResizeOccupants(e){this.resizing=!0,this.el.addEventListener("mousemove",this.onMouseMove),this.el.addEventListener("mouseup",this.onMouseUp);const t=this.el.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.el.removeEventListener("mousemove",this.onMouseMove),this.el.removeEventListener("mouseup",this.onMouseUp);const t=this.el.querySelector("converse-muc-sidebar").getBoundingClientRect(),n={occupants_width:this.calculateSidebarWidth(t,0)};xc.connection.connected?this.model.save(n):this.model.set(n)}},resizeSidebarView(e,t){const n=this.el.querySelector("converse-muc-sidebar"),r=n.getBoundingClientRect();if(this.is_minimum)this.is_minimum=r.left<t;else if(this.is_maximum)this.is_maximum=r.left>t;else{const t=this.calculateSidebarWidth(r,e);n.style.flex="0 0 "+t+"px"}},calculateSidebarWidth(e,t){let n=e.width+t;const r=this.el.clientWidth;return n<.2*r?(n=.2*r,this.is_minimum=!0):n>.75*r?(n=.75*r,this.is_maximum=!0):r-n<250?(n=r-250,this.is_maximum=!0):(this.is_maximum=!1,this.is_minimum=!1),n},getAutoCompleteList(){return this.model.getAllKnownNicknames().map(e=>({label:e,value:"@".concat(e)}))},getAutoCompleteListItem(e,t){t=t.trim();const n=document.createElement("li");if(n.setAttribute("aria-selected","false"),Tc.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let r="data:"+xc.DEFAULT_IMAGE_TYPE+";base64,"+xc.DEFAULT_IMAGE;if(xc.vcards){const t=xc.vcards.findWhere({nickname:e});t&&(r="data:"+t.get("image_type")+";base64,"+t.get("image"))}t.setAttribute("src",r),t.setAttribute("width","22"),t.setAttribute("class","avatar avatar-autocomplete"),n.appendChild(t)}const r=new RegExp("("+t+")","ig");return(t?e.split(r):[e]).forEach(e=>{if(t&&e.match(r)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))}),n},initMentionAutoComplete(){this.mention_auto_complete=new xc.AutoComplete(this.el,{auto_first:!0,auto_evaluate:!1,min_chars:Tc.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==Tc.settings.get("muc_mention_autocomplete_filter")?xc.FILTER_CONTAINS:xc.FILTER_STARTSWITH,ac_triggers:["Tab","@"],include_triggers:[],item:this.getAutoCompleteListItem}),this.mention_auto_complete.on("suggestion-box-selectcomplete",()=>this.auto_completing=!1)},submitNickname(e){e.preventDefault();const t=e.target.nick.value.trim();t&&this.model.join(t)},onKeyDown(e){if(!this.mention_auto_complete.onKeyDown(e))return xc.ChatBoxView.prototype.onKeyDown.call(this,e)},onKeyUp(e){return this.mention_auto_complete.evaluate(e),xc.ChatBoxView.prototype.onKeyUp.call(this,e)},async onMessageRetractButtonClicked(e){const t=Pu("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere.");if(e.mayBeRetracted()){const n=[Pu("Are you sure you want to retract this message?")];Tc.settings.get("show_retraction_warning")&&(n[1]=t),await Tc.confirm(Pu("Confirm"),n)&&this.model.retractOwnMessage(e)}else if(await e.mayBeModerated())if("me"===e.get("sender")){let n=[Pu("Are you sure you want to retract this message?")];Tc.settings.get("show_retraction_warning")&&(n=[n[0],t,n[1]]),await Tc.confirm(Pu("Confirm"),n)&&this.retractOtherMessage(e)}else{let n=[Pu("You are about to retract this message."),Pu("You may optionally include a message, explaining the reason for the retraction.")];Tc.settings.get("show_retraction_warning")&&(n=[n[0],t,n[1]]);const r=await Tc.prompt(Pu("Message Retraction"),n,Pu("Optional reason"));!1!==r&&this.retractOtherMessage(e,r)}else{const e=Pu("Sorry, you're not allowed to retract this message");Tc.alert("error",Pu("Error"),e)}},async retractOtherMessage(e,t){const n=await this.model.retractOtherMessage(e,t);if(null===n){const e=Pu("A timeout occurred while trying to retract the message");Tc.alert("error",Pu("Error"),e),Lr(e,NS.b.LogLevel.WARN)}else if(RS.isErrorStanza(n)){const e=Pu("Sorry, you're not allowed to retract this message.");Tc.alert("error",Pu("Error"),e),Lr(e,NS.b.LogLevel.WARN),Lr(n,NS.b.LogLevel.WARN)}},showModeratorToolsModal(e){if(!this.verifyRoles(["moderator"]))return;let t=Tc.modal.get(Hw.id);if(t)t.model.set("affiliation",e);else{const n=new Vs({affiliation:e});t=Tc.modal.create(Hw,{model:n,_converse:xc,chatroomview:this})}t.show()},showRoomDetailsModal(e){e.preventDefault(),Tc.modal.show(cS,{model:this.model},e)},showOccupantDetailsModal(e,t){e.preventDefault(),Tc.modal.show(Vw,{model:t.occupant},e)},showChatStateNotification(e){if("me"!==e.get("sender"))return xc.ChatBoxView.prototype.showChatStateNotification.apply(this,arguments)},shouldShowSidebar(){return!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===zc.ROOMSTATUS.ENTERED},onSidebarToggle(){var e;this.renderToolbar(),null===(e=this.el.querySelector(".occupants"))||void 0===e||e.setVisibility()},onOccupantAffiliationChanged(e){e.get("jid")===xc.bare_jid&&this.renderHeading()},onOccupantRoleChanged(e){e.get("jid")===xc.bare_jid&&this.renderBottomPanel()},getHeadingButtons(e){const t=[];t.push({i18n_text:Pu("Details"),i18n_title:Pu("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:Pu("Configure"),i18n_title:Pu("Configure this groupchat"),handler:e=>this.getAndRenderConfigurationForm(e),a_class:"configure-chatroom-button",icon_class:"fa-wrench",name:"configure"}),this.model.invitesAllowed()&&t.push({i18n_text:Pu("Invite"),i18n_title:Pu("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:Pu(e?"Show topic":"Hide topic"),i18n_title:Pu(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")===zc.ROOMSTATUS.ENTERED){const e=this.getAllowedCommands();e.includes("modtools")&&t.push({i18n_text:Pu("Moderate"),i18n_title:Pu("Moderate this groupchat"),handler:()=>this.showModeratorToolsModal(),a_class:"moderate-chatroom-button",icon_class:"fa-user-cog",name:"moderate"}),e.includes("destroy")&&t.push({i18n_text:Pu("Destroy"),i18n_title:Pu("Remove this groupchat"),handler:e=>this.destroy(e),a_class:"destroy-chatroom-button",icon_class:"fa-trash",name:"destroy"})}return Tc.settings.get("singleton")||t.push({i18n_text:Pu("Leave"),i18n_title:Pu("Leave and close this groupchat"),handler:async e=>{e.stopPropagation();const t=[Pu("Are you sure you want to leave this groupchat?")];await Tc.confirm(Pu("Confirm"),t)&&this.close(e)},a_class:"close-chatbox-button",standalone:"overlayed"===Tc.settings.get("view_mode"),icon_class:"fa-sign-out-alt",name:"signout"}),xc.api.hook("getHeadingButtons",this,t)},async generateHeadingTemplate(){const e=await this.model.isSubjectHidden(),t=await this.getHeadingButtons(e),n=t.filter(e=>e.standalone),r=t.filter(e=>!e.standalone);return vS(Object.assign(this.model.toJSON(),{_converse:xc,subject_hidden:e,dropdown_btns:r.map(e=>this.getHeadingDropdownItem(e)),standalone_btns:n.map(e=>this.getHeadingStandaloneButton(e)),title:this.model.getDisplayName()}))},toggleTopic(){this.model.toggleSubjectHiddenState()},showInviteModal(e){e.preventDefault(),Tc.modal.show(lw,{model:new Vs,chatroomview:this},e)},afterShown(){this.model.clearUnreadMsgCounter(),this.scrollDown()},onConnectionStatusChanged(){const e=this.model.session.get("connection_status");e===zc.ROOMSTATUS.NICKNAME_REQUIRED?this.renderNicknameForm():e===zc.ROOMSTATUS.PASSWORD_REQUIRED?this.renderPasswordForm():e===zc.ROOMSTATUS.CONNECTING?this.showSpinner():e===zc.ROOMSTATUS.ENTERED?(this.renderBottomPanel(),this.hideSpinner(),this.maybeFocus()):e===zc.ROOMSTATUS.DISCONNECTED?this.showDisconnectMessage():e===zc.ROOMSTATUS.DESTROYED&&this.showDestroyedMessage()},getToolbarOptions(){return Object.assign(xc.ChatBoxView.prototype.getToolbarOptions.apply(this,arguments),{is_groupchat:!0,label_hide_occupants:Pu("Hide the list of participants"),show_occupants_toggle:xc.visible_toolbar_buttons.toggle_occupants})},close(){return this.hide(),xc.router.history.getFragment()==="converse/room?jid="+this.model.get("jid")&&xc.router.navigate(""),xc.ChatBoxView.prototype.close.apply(this,arguments)},hideOccupants(e){e&&(e.preventDefault(),e.stopPropagation()),this.model.save({hidden_occupants:!0}),this.scrollDown()},verifyRoles(e,t,n=!0){if(!Array.isArray(e))throw new TypeError("roles must be an Array");if(!e.length)return!0;if(t=t||this.model.occupants.findWhere({jid:xc.bare_jid})){const n=t.get("role");if(e.includes(n))return!0}if(n){const e=Pu("Forbidden: you do not have the necessary role in order to do that.");this.model.createMessage({message:e,type:"error"})}return!1},verifyAffiliations(e,t,n=!0){if(!Array.isArray(e))throw new TypeError("affiliations must be an Array");if(!e.length)return!0;if(t=t||this.model.occupants.findWhere({jid:xc.bare_jid})){const n=t.get("affiliation");if(e.includes(n))return!0}if(n){const e=Pu("Forbidden: you do not have the necessary affiliation in order to do that.");this.model.createMessage({message:e,type:"error"})}return!1},validateRoleOrAffiliationChangeArgs(e,t){if(!t){const t=Pu('Error: the "%1$s" command takes two arguments, the user\'s nickname and optionally a reason.',e);return this.model.createMessage({message:t,type:"error"}),!1}return!0},getNickOrJIDFromCommandArgs(e){if(RS.isValidJID(e.trim()))return e.trim();e.startsWith("@")||(e="@"+e);const[t,n]=this.model.parseTextForReferences(e);if(!n.length){const e=Pu("Error: couldn't find a groupchat participant based on your arguments");return void this.model.createMessage({message:e,type:"error"})}if(n.length>1){const e=Pu("Error: found multiple groupchat participant based on your arguments");return void this.model.createMessage({message:e,type:"error"})}const r=n.pop().value,i=e.split(r,2)[1];if(!i||i.startsWith(" "))return r;{const e=Pu("Error: couldn't find a groupchat participant based on your arguments");this.model.createMessage({message:e,type:"error"})}},setAffiliation(e,t,n){const r=BS[e];if(!r)throw Error("ChatRoomView#setAffiliation called with invalid command: ".concat(e));if(!this.verifyAffiliations(n))return!1;if(!this.validateRoleOrAffiliationChangeArgs(e,t))return!1;const i=this.getNickOrJIDFromCommandArgs(t);if(!i)return!1;let s;const o=t.split(i,2)[1].trim(),a=this.model.getOccupant(i);if(a)s=a.get("jid");else{if(!RS.isValidJID(i)){const e=Pu("Couldn't find a participant with that nickname. They might have left the groupchat.");return void this.model.createMessage({message:e,type:"error"})}s=i}const c={jid:s,reason:o};a&&Tc.settings.get("auto_register_muc_nickname")&&(c.nick=a.get("nick")),this.model.setAffiliation(r,[c]).then(()=>this.model.occupants.fetchMembers()).catch(e=>this.onCommandError(e))},getReason:e=>e.includes(",")?e.slice(e.indexOf(",")+1).trim():null,setRole(e,t,n=[],r=[]){const i=FS[e];if(!i)throw Error("ChatRoomView#setRole called with invalid command: ".concat(e));if(!this.verifyAffiliations(n)||!this.verifyRoles(r))return!1;if(!this.validateRoleOrAffiliationChangeArgs(e,t))return!1;const s=this.getNickOrJIDFromCommandArgs(t);if(!s)return!1;const o=t.split(s,2)[1].trim(),a=this.model.getOccupant(s);return this.model.setRole(a,i,o,void 0,this.onCommandError.bind(this)),!0},onCommandError(e){Lr.fatal(e);const t=Pu("Sorry, an error happened while running the command.")+" "+Pu("Check your browser's developer console for details.");this.model.createMessage({message:t,type:"error"})},getAllowedCommands(){let e=["clear","help","me","nick","register"];(this.model.config.get("changesubject")||["owner","admin"].includes(this.model.getOwnAffiliation()))&&(e=[...e,"subject","topic"]);const t=this.model.occupants.findWhere({jid:xc.bare_jid});return this.verifyAffiliations(["owner"],t,!1)?e=e.concat(DS).concat(LS):this.verifyAffiliations(["admin"],t,!1)&&(e=e.concat(LS)),this.verifyRoles(["moderator"],t,!1)?e=e.concat(zS).concat(PS):this.verifyRoles(["visitor","participant","moderator"],t,!1)||(e=e.concat(PS)),e.sort(),Array.isArray(Tc.settings.get("muc_disable_slash_commands"))?e.filter(e=>!Tc.settings.get("muc_disable_slash_commands").includes(e)):e},async destroy(){const e=[Pu("Are you sure you want to destroy this groupchat?")];let t=[{name:"challenge",label:Pu("Please enter the XMPP address of this groupchat to confirm"),challenge:this.model.get("jid"),placeholder:Pu("name@example.org"),required:!0},{name:"reason",label:Pu("Optional reason for destroying this groupchat"),placeholder:Pu("Reason")},{name:"newjid",label:Pu("Optional XMPP address for a new groupchat that replaces this one"),placeholder:Pu("replacement@example.org")}];try{var n,r;t=await Tc.confirm(Pu("Confirm"),e,t);const i=null===(n=t.filter(e=>"reason"===e.name).pop())||void 0===n?void 0:n.value,s=null===(r=t.filter(e=>"newjid"===e.name).pop())||void 0===r?void 0:r.value;return this.model.sendDestroyIQ(i,s).then(()=>this.close())}catch(e){Lr.error(e)}},parseMessageForCommands(e){if(Tc.settings.get("muc_disable_slash_commands")&&!Array.isArray(Tc.settings.get("muc_disable_slash_commands")))return xc.ChatBoxView.prototype.parseMessageForCommands.apply(this,arguments);const t=((e=e.replace(/^\s*/,"")).match(/^\/([a-zA-Z]*) ?/)||[""]).pop().toLowerCase();if(!t)return!1;const n=e.slice(("/"+t).length+1).trim();if(!this.getAllowedCommands().includes(t))return!1;switch(t){case"admin":this.setAffiliation(t,n,["owner"]);break;case"ban":this.setAffiliation(t,n,["admin","owner"]);break;case"modtools":this.showModeratorToolsModal(n);break;case"deop":this.setRole(t,n,["admin","owner"]);break;case"destroy":if(!this.verifyAffiliations(["owner"]))break;this.destroy().catch(e=>this.onCommandError(e));break;case"help":this.model.set({show_help_messages:!0});break;case"kick":case"mute":this.setRole(t,n,[],["moderator"]);break;case"member":this.setAffiliation(t,n,["admin","owner"]);break;case"nick":if(!this.verifyRoles(["visitor","participant","moderator"]))break;if(0===n.length){const e=Pu('Your nickname is "%1$s"',this.model.get("nick"));this.model.createMessage({message:e,type:"error"})}else{const e=NS.b.getBareJidFromJid(this.model.get("jid"));Tc.send(Object(NS.a)({from:xc.connection.jid,to:"".concat(e,"/").concat(n),id:RS.getUniqueId()}).tree())}break;case"owner":this.setAffiliation(t,n,["owner"]);break;case"op":this.setRole(t,n,["admin","owner"]);break;case"register":n.length>1?this.model.createMessage({message:Pu("Error: invalid number of arguments"),type:"error"}):this.model.registerNickname().then(e=>{e&&this.model.createMessage({message:e,type:"error"})});break;case"revoke":this.setAffiliation(t,n,["admin","owner"]);break;case"topic":case"subject":this.model.setSubject(n);break;case"voice":this.setRole(t,n,[],["moderator"]);break;default:return xc.ChatBoxView.prototype.parseMessageForCommands.apply(this,arguments)}return!0},renderConfigurationForm(e){if(this.hideChatRoomContents(),this.model.save("config_stanza",e.outerHTML),!this.config_form){this.config_form=new xc.MUCConfigForm({model:this.model,chatroomview:this}),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.config_form.el)}RS.showElement(this.config_form.el)},renderNicknameForm(){const e=(e=>{const t=Pu("Nickname"),n=Pu("Enter groupchat"),r=Tc.settings.get("muc_show_logs_before_join")?Pu("Choose a nickname to enter"):Pu("Please choose your nickname");return Fa(MS(),r,e.nickname_validation_message,e.nick||"",e.nickname_validation_message?"error":"",t,n)})(this.model.toJSON());if(Tc.settings.get("muc_show_logs_before_join")){const t=this.el.querySelector(".muc-bottom-panel");za(e,t),RS.addClass("muc-bottom-panel--nickname",t)}else{const t=this.el.querySelector(".muc-nickname-form"),n=RS.getElementFromTemplateResult(e);if(t)IS(".spinner",this.el).forEach(RS.removeElement),t.outerHTML=n.outerHTML;else{this.hideChatRoomContents(),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",n)}}RS.safeSave(this.model.session,{connection_status:zc.ROOMSTATUS.NICKNAME_REQUIRED})},closeForm(){IS(".chatroom-form-container",this.el).forEach(e=>RS.addClass("hidden",e)),this.renderAfterTransition()},getAndRenderConfigurationForm(){this.config_form&&RS.isVisible(this.config_form.el)?this.closeForm():(this.showSpinner(),this.model.fetchRoomConfiguration().then(e=>this.renderConfigurationForm(e)).catch(e=>Lr.error(e)))},hideChatRoomContents(){const e=this.el.querySelector(".chatroom-body");null!==e&&[].forEach.call(e.children,e=>e.classList.add("hidden"))},renderPasswordForm(){this.hideChatRoomContents();const e=this.model.get("password_validation_message");if(this.model.save("password_validation_message",void 0),this.password_form)this.password_form.model.set("validation_message",e);else{this.password_form=new xc.MUCPasswordForm({model:new Vs({validation_message:e}),chatroomview:this}),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.password_form.el)}RS.showElement(this.password_form.el),this.model.session.save("connection_status",zc.ROOMSTATUS.PASSWORD_REQUIRED)},showDestroyedMessage(){RS.hideElement(this.el.querySelector(".chat-area")),RS.hideElement(this.el.querySelector(".occupants")),IS(".spinner",this.el).forEach(RS.removeElement);const e=this.model.get("destroyed_reason"),t=this.model.get("moved_jid");this.model.save({destroyed_reason:void 0,moved_jid:void 0});const n=this.el.querySelector(".disconnect-container");za(TS(t,e),n);const r=n.querySelector("a.switch-chat");r&&r.addEventListener("click",async e=>{e.preventDefault(),(await Tc.rooms.get(t,null,!0)).maybeShow(!0),this.model.destroy()}),RS.showElement(n)},showDisconnectMessage(){const e=this.model.get("disconnection_message");if(!e)return;RS.hideElement(this.el.querySelector(".chat-area")),RS.hideElement(this.el.querySelector(".occupants")),IS(".spinner",this.el).forEach(RS.removeElement);const t=[e],n=this.model.get("disconnection_actor");n&&t.push(Pu("This action was done by %1$s.",n));const r=this.model.get("disconnection_reason");r&&t.push(Pu('The reason given is: "%1$s".',r)),this.model.save({disconnection_message:void 0,disconnection_reason:void 0,disconnection_actor:void 0});const i=this.el.querySelector(".disconnect-container");za((e=>Fa(jS(),e[0],e.slice(1).map(e=>Fa(OS(),e))))(t),i),RS.showElement(i)},onOccupantAdded(e){e.get("jid")===xc.bare_jid&&(this.renderHeading(),this.renderBottomPanel())},getPreviousJoinOrLeaveNotification(e,t){const n=(new Date).toISOString().split("T")[0];for(;null!==e;){var r;if(!e.classList.contains("chat-info"))return;const i=e.getAttribute("data-isodate");if(i&&i.split("T")[0]!==n)return;const s=(null===(r=e)||void 0===r?void 0:r.dataset)||{};if(s.join===t||s.leave===t||s.leavejoin===t||s.joinleave===t)return e;e=e.previousElementSibling}},renderAfterTransition(){const e=this.model.session.get("connection_status");if(e==zc.ROOMSTATUS.NICKNAME_REQUIRED)this.renderNicknameForm();else if(e==zc.ROOMSTATUS.PASSWORD_REQUIRED)this.renderPasswordForm();else if(e==zc.ROOMSTATUS.ENTERED){var t;this.hideChatRoomContents(),RS.showElement(this.el.querySelector(".chat-area")),null===(t=this.el.querySelector(".occupants"))||void 0===t||t.setVisibility(),this.scrollDown()}},showSpinner(){IS(".spinner",this.el).forEach(RS.removeElement),this.hideChatRoomContents(),this.el.querySelector(".chatroom-body").insertAdjacentElement("afterbegin",RS.getElementFromTemplateResult(Qp()))},hideSpinner(){const e=this.el.querySelector(".spinner");return null!==e&&(RS.removeElement(e),this.renderAfterTransition()),this}},qS={roomviews:{get(e){if(Array.isArray(e)){return Tc.chatviews.get(e).filter(e=>e.model.get("type")===xc.CHATROOMS_TYPE)}{const t=Tc.chatviews.get(e);return t.model.get("type")===xc.CHATROOMS_TYPE?t:null}},close(e){let t;return void 0===e?t=xc.chatboxviews:"string"==typeof e?t=[xc.chatboxviews.get(e)].filter(e=>e):Array.isArray(e)&&(t=e.map(e=>xc.chatboxviews.get(e))),Promise.all(t.map(e=>e.is_chatroom&&e.model&&e.close()))}}};function US(){const e=WS(['<div class="form-group">',"</div>"]);return US=function(){return e},e}function VS(){const e=WS(['<label class="roomid-policy-error">',"</label>"]);return VS=function(){return e},e}function $S(){const e=WS(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="add-chatroom-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <form class="converse-form add-chatroom">\n <div class="form-group">\n <label for="chatroom">',":</label>\n ",'\n <input type="text" required="required" name="chatroom" class="form-control roomjid-input" placeholder="','"/>\n </div>\n ',"\n ",'\n <input type="submit" class="btn btn-primary" name="join" value="','" ?disabled=',">\n </form>\n </div>\n </div>\n </div>\n "]);return $S=function(){return e},e}function GS(){const e=WS(['\n <div class="form-group" >\n <label for="nickname">',':</label>\n <input type="text" title="','" required="required" name="nickname" value="','" class="form-control"/>\n </div>\n ']);return GS=function(){return e},e}function WS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var JS=e=>{const t=Pu("Join"),n=Pu("Enter a new Groupchat");return Fa($S(),n,Zf,e.label_room_address,e.muc_roomid_policy_error_msg?Fa(VS(),e.muc_roomid_policy_error_msg):"",e.chatroom_placeholder,e.muc_roomid_policy_hint?Fa(US(),Dm(Im.a.filterXSS(e.muc_roomid_policy_hint,{whiteList:{b:[],br:[],em:[]}}))):"",e._converse.locked_muc_nickname?"":(e=>{const t=Pu("Nickname"),n=Pu("This field is required");return Fa(GS(),t,n,e.nick||"")})(e),t||"",e.muc_roomid_policy_error_msg)};const XS=zc.env.utils,{Strophe:QS}=zc.env;var YS=Jf.extend({persistent:!0,id:"add-chatroom-modal",events:{"submit form.add-chatroom":"openChatRoom","keyup .roomjid-input":"checkRoomidPolicy","change .roomjid-input":"checkRoomidPolicy"},initialize(){Jf.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(!Tc.settings.get("locked_muc_domain")){const t=this.model.get("muc_domain")||Tc.settings.get("muc_domain");e=t?"name@".concat(t):Pu("name@conference.example.org")}return JS(Object.assign(this.model.toJSON(),{_converse:xc,label_room_address:Tc.settings.get("muc_domain")?Pu("Groupchat name"):Pu("Groupchat address"),chatroom_placeholder:e,muc_roomid_policy_error_msg:this.muc_roomid_policy_error_msg,muc_roomid_policy_hint:Tc.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 r;if(Tc.settings.get("locked_muc_nickname")){if(r=xc.getDefaultMUCNickname(),!r)throw new Error("Using locked_muc_nickname but no nickname found!")}else r=t.get("nickname").trim();return{jid:n,nick:r}},openChatRoom(e){e.preventDefault();const t=this.parseRoomDataFromEvent(e.target);let n;""===t.nick&&(t.nick=void 0),Tc.settings.get("locked_muc_domain")||Tc.settings.get("muc_domain")&&!XS.isValidJID(t.jid)?n="".concat(QS.escapeNode(t.jid),"@").concat(Tc.settings.get("muc_domain")):(n=t.jid,this.model.setDomain(n)),Tc.rooms.open(n,Object.assign(t,{jid:n}),!0),this.modal.hide(),e.target.reset()},checkRoomidPolicy(){if(Tc.settings.get("muc_roomid_policy")&&Tc.settings.get("muc_domain")){let e=this.el.querySelector(".roomjid-input").value;!zc.locked_muc_domain&&XS.isValidJID(e)||(e="".concat(QS.escapeNode(e),"@").concat(Tc.settings.get("muc_domain")));const t=QS.getNodeFromJid(e),n=QS.getDomainFromJid(e);Tc.settings.get("muc_domain")!==n||Tc.settings.get("muc_roomid_policy").test(t)?this.muc_roomid_policy_error_msg=null:this.muc_roomid_policy_error_msg=Pu("Groupchat id is invalid."),this.render()}}});function KS(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="d-flex controlbox-padded">\n <span class="w-100 controlbox-heading controlbox-heading--groupchats">','</span>\n <a class="controlbox-heading__btn show-list-muc-modal fa fa-list-ul" title="','" data-toggle="modal" data-target="#muc-list-modal"></a>\n <a class="controlbox-heading__btn show-add-muc-modal fa fa-plus" title="','" data-toggle="modal" data-target="#add-chatrooms-modal"></a>\n </div>\n <div class="list-container list-container--openrooms hidden"></div>\n <div class="list-container list-container--bookmarks hidden"></div>']);return KS=function(){return e},e}function ZS(){const e=ix(['<li class="list-group-item active">',"</li>"]);return ZS=function(){return e},e}function ex(){const e=ix(['<li class="list-group-item"> '," </li>"]);return ex=function(){return e},e}function tx(){const e=ix(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="muc-list-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body d-flex flex-column">\n <span class="modal-alert"></span>\n ','\n <ul class="available-chatrooms list-group">\n ',"\n ","\n ",'\n </ul>\n </div>\n <div class="modal-footer">',"</div>\n </div>\n </div>\n "]);return tx=function(){return e},e}function nx(){const e=ix(['\n <li class="room-item list-group-item">\n <div class="available-chatroom d-flex flex-row">\n <a class="open-room available-room w-100"\n @click=','\n data-room-jid="','"\n data-room-name="','"\n title="','"\n href="#">','</a>\n <a class="right room-info icon-room-info"\n @click=','\n data-room-jid="','"\n title="','"\n href="#"></a>\n </div>\n </li>\n ']);return nx=function(){return e},e}function rx(){const e=ix(['\n <form class="converse-form list-chatrooms"\n @submit=','>\n <div class="form-group">\n <label for="chatroom">',':</label>\n <input type="text"\n @change=','\n value="','"\n required="required"\n name="server"\n class="form-control"\n placeholder="','"/>\n </div>\n <input type="submit" class="btn btn-primary" name="list" value="','"/>\n </form>\n ']);return rx=function(){return e},e}function ix(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var sx=e=>{const t=Pu("Query for Groupchats");return Fa(tx(),t,Zf,e.show_form?(e=>{const t=Pu("Show groupchats"),n=Pu("Server address");return Fa(rx(),e.submitForm,n,e.setDomainFromEvent,e.muc_domain||"",e.server_placeholder,t)})(e):"",e.loading_items?Fa(ex(),Qp()):"",e.feedback_text?Fa(ZS(),e.feedback_text):"",Em(e.items,e=>e.jid,t=>((e,t)=>{const n=Pu("Show more information on this groupchat"),r=Pu("Click to open this groupchat");return Fa(nx(),e.openRoom,t.jid,t.name,r,t.name||t.jid,e.toggleRoomInfo,t.jid,n)})(e,t)),Kf)};function ox(){const e=_x(['<li class="room-info">',"</li>"]);return ox=function(){return e},e}function ax(){const e=_x(['<li class="room-info">',"</li>"]);return ax=function(){return e},e}function cx(){const e=_x(['<li class="room-info">',"</li>"]);return cx=function(){return e},e}function lx(){const e=_x(['<li class="room-info">',"</li>"]);return lx=function(){return e},e}function ux(){const e=_x(['<li class="room-info">',"</li>"]);return ux=function(){return e},e}function dx(){const e=_x(['<li class="room-info">',"</li>"]);return dx=function(){return e},e}function hx(){const e=_x(['<li class="room-info">',"</li>"]);return hx=function(){return e},e}function fx(){const e=_x(['<li class="room-info">',"</li>"]);return fx=function(){return e},e}function px(){const e=_x(['<li class="room-info">',"</li>"]);return px=function(){return e},e}function mx(){const e=_x(['<li class="room-info">',"</li>"]);return mx=function(){return e},e}function gx(){const e=_x(['<li class="room-info locked">',"</li>"]);return gx=function(){return e},e}function vx(){const e=_x(['\n <div class="room-info">\n <p class="room-info"><strong>',"</strong> ",'</p>\n <p class="room-info"><strong>',"</strong> ",'</p>\n <p class="room-info"><strong>',"</strong> ",'</p>\n <p class="room-info"><strong>',"</strong>\n <ul>\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n </ul>\n </p>\n </div>\n"]);return vx=function(){return e},e}function _x(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const{Strophe:bx,$iq:yx,sizzle:wx}=zc.env,Sx=zc.env.utils;function xx(e,t){var n,r;e.querySelector("span.spinner").remove(),e.querySelector("a.room-info").classList.add("selected"),e.insertAdjacentHTML("beforeEnd",Sx.getElementFromTemplateResult((e=>{const t=Pu("Description:"),n=Pu("Groupchat Address (JID):"),r=Pu("Participants:"),i=Pu("Features:"),s=Pu("Requires authentication"),o=Pu("Hidden"),a=Pu("Requires an invitation"),c=Pu("Moderated"),l=Pu("Non-anonymous"),u=Pu("Open"),d=Pu("Permanent"),h=Pu("Public"),f=Pu("Semi-anonymous"),p=Pu("Temporary"),m=Pu("Unmoderated");return Fa(vx(),n,e.jid,t,e.desc,r,e.occ,i,e.passwordprotected?Fa(gx(),s):"",e.hidden?Fa(mx(),o):"",e.membersonly?Fa(px(),a):"",e.moderated?Fa(fx(),c):"",e.nonanonymous?Fa(hx(),l):"",e.open?Fa(dx(),u):"",e.persistent?Fa(ux(),d):"",e.publicroom?Fa(lx(),h):"",e.semianonymous?Fa(cx(),f):"",e.temporary?Fa(ax(),p):"",e.unmoderated?Fa(ox(),m):"")})({jid:t.getAttribute("from"),desc:null===(n=Mg(wx('field[var="muc#roominfo_description"] value',t)))||void 0===n?void 0:n.textContent,occ:null===(r=Mg(wx('field[var="muc#roominfo_occupants"] value',t)))||void 0===r?void 0:r.textContent,hidden:wx('feature[var="muc_hidden"]',t).length,membersonly:wx('feature[var="muc_membersonly"]',t).length,moderated:wx('feature[var="muc_moderated"]',t).length,nonanonymous:wx('feature[var="muc_nonanonymous"]',t).length,open:wx('feature[var="muc_open"]',t).length,passwordprotected:wx('feature[var="muc_passwordprotected"]',t).length,persistent:wx('feature[var="muc_persistent"]',t).length,publicroom:wx('feature[var="muc_publicroom"]',t).length,semianonymous:wx('feature[var="muc_semianonymous"]',t).length,temporary:wx('feature[var="muc_temporary"]',t).length,unmoderated:wx('feature[var="muc_unmoderated"]',t).length})))}var Ex=Jf.extend({id:"muc-list-modal",persistent:!0,initialize(){this.items=[],this.loading_items=!1,Jf.prototype.initialize.apply(this,arguments),Tc.settings.get("muc_domain")&&!this.model.get("muc_domain")&&this.model.save("muc_domain",Tc.settings.get("muc_domain")),this.listenTo(this.model,"change:muc_domain",this.onDomainChange),this.el.addEventListener("shown.bs.modal",()=>Tc.settings.get("locked_muc_domain")?this.updateRoomsList():this.el.querySelector('input[name="server"]').focus())},toHTML(){const e=this.model.get("muc_domain")||Tc.settings.get("muc_domain");return sx(Object.assign(this.model.toJSON(),{show_form:!Tc.settings.get("locked_muc_domain"),server_placeholder:e||Pu("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(),Tc.rooms.open(t,{name:n},!0)},toggleRoomInfo(e){e.preventDefault(),function(e){const t=Sx.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(Sx.slideIn(n).then(Sx.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",Sx.getElementFromTemplateResult(Qp())),Tc.disco.info(e.target.getAttribute("data-room-jid"),null).then(e=>xx(t,e)).catch(e=>Lr.error(e)))}(e)},onDomainChange(){Tc.settings.get("auto_list_rooms")&&this.updateRoomsList()},onRoomsFound(e){this.loading_items=!1;const t=e?wx("query item",e):[];return t.length?(this.model.set({feedback_text:Pu("Groupchats found")},{silent:!0}),this.items=t.map(al)):(this.items=[],this.model.set({feedback_text:Pu("No groupchats found")},{silent:!0})),this.render(),!0},updateRoomsList(){const e=yx({to:this.model.get("muc_domain"),from:xc.connection.jid,type:"get"}).c("query",{xmlns:bx.NS.DISCO_ITEMS});Tc.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})}});const Ax=zc.env.utils,Cx=wh.extend({tagName:"div",className:"controlbox-section",id:"chatrooms",events:{"click a.controlbox-heading__btn.show-add-muc-modal":"showAddRoomModal","click a.controlbox-heading__btn.show-list-muc-modal":"showMUCListModal"},toHTML(){return e={heading_chatrooms:Pu("Groupchats"),title_new_room:Pu("Add a new groupchat"),title_list_rooms:Pu("Query for groupchats")},Fa(KS(),e.heading_chatrooms,e.title_list_rooms,e.title_new_room);var e},showAddRoomModal(e){Tc.modal.show(YS,{model:this.model},e)},showMUCListModal(e){Tc.modal.show(Ex,{model:this.model},e)}}),Tx={renderRoomsPanel(){if(this.roomspanel&&Ax.isInDOM(this.roomspanel.el))return this.roomspanel;const e="converse.roomspanel".concat(xc.bare_jid);return this.roomspanel=new xc.RoomsPanel({model:new(xc.RoomsPanelModel.extend({id:e,browserStorage:xc.createStore(e)}))}),this.roomspanel.model.fetch(),this.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd",this.roomspanel.render().el),Tc.trigger("roomsPanelRendered"),this.roomspanel},getRoomsPanel(){return this.roomspanel&&Ax.isInDOM(this.roomspanel.el)?this.roomspanel:this.renderRoomsPanel()}},{Strophe:Ox}=zc.env;function jx(e,t){t.getRoomsPanel().model.save("muc_domain",Ox.getDomainFromJid(e))}function kx(e){e.model.get("connected")&&(e.getRoomsPanel().model.get("muc_domain")||(void 0===Tc.settings.get("muc_domain")?function(e){function t(t){t&&t.get("var")===Ox.NS.MUC&&t.entity.getIdentity("conference","text").then(n=>{n&&jx(t.get("from"),e)})}Tc.waitUntil("discoInitialized").then(()=>{Tc.listen.on("serviceDiscovered",t),xc.disco_entities.each(e=>t(e.features.findWhere({var:Ox.NS.MUC})))}).catch(e=>Lr.error(e))}(e):jx(Tc.settings.get("muc_domain"),e)))}function Nx(e){e.preventDefault(),Tc.rooms.open(e.target.href)}async function Mx(e){const t=xc.chatboxviews;if(!t.get(e.get("id"))&&e.get("type")===xc.CHATROOMS_TYPE&&e.isValid())return await e.initialized,t.add(e.get("id"),new xc.ChatRoomView({model:e}))}zc.plugins.add("converse-muc-views",{dependencies:["converse-modal","converse-controlbox","converse-chatview"],overrides:{ControlBoxView:{renderControlBoxPane(){this.__super__.renderControlBoxPane.apply(this,arguments),Tc.settings.get("allow_muc")&&this.renderRoomsPanel()}}},initialize(){const{_converse:e}=this;Tc.promises.add(["roomsPanelRendered"]),Tc.settings.extend({auto_list_rooms:!1,cache_muc_messages:!0,locked_muc_nickname:!1,modtools_disable_query:[],modtools_disable_assign:!1,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.MUCConfigForm=nw,e.MUCPasswordForm=iw,e.ChatRoomView=e.ChatBoxView.extend(HS),e.RoomsPanel=Cx,e.ControlBoxView&&Object.assign(e.ControlBoxView.prototype,Tx),Object.assign(e.api,qS),Tc.listen.on("chatBoxViewsInitialized",()=>{e.chatboxviews.delegate("click","a.open-chatroom",Nx),e.chatboxes.on("add",Mx)}),Tc.listen.on("clearSession",()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)}),Tc.listen.on("controlBoxInitialized",e=>{Tc.settings.get("allow_muc")&&(kx(e),e.model.on("change:connected",()=>kx(e)))})}});var Ix={className:"chatbox headlines hidden",events:{"click .close-chatbox-button":"close","click .toggle-chatbox-button":"minimize","keypress textarea.chat-textarea":"onKeyDown"},async initialize(){this.initDebounced(),this.model.disable_mam=!0,this.listenTo(this.model,"change:hidden",e=>e.get("hidden")?this.hide():this.show()),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"show",this.show),this.render(),this.listenTo(this.model.messages,"add",this.onMessageAdded),this.listenTo(this.model.messages,"remove",this.renderChatHistory),this.listenTo(this.model.messages,"rendered",this.maybeScrollDown),this.listenTo(this.model.messages,"reset",this.renderChatHistory),await this.model.messages.fetched,this.insertIntoDOM(),this.model.maybeShow(),this.scrollDown(),Tc.trigger("headlinesBoxViewInitialized",this)},render(){this.el.setAttribute("id",this.model.get("box_id"));const e=k_(Object.assign(this.model.toJSON(),{info_close:"",label_personal_message:"",show_send_button:!1,show_toolbar:!1,unread_msgs:""}));return za(e,this.el),this.content=this.el.querySelector(".chat-content"),this.msgs_container=this.el.querySelector(".chat-content__messages"),this.renderChatContent(),this.renderHeading(),this},getNotifications:()=>[],getHeadingButtons(){const e=[];return Tc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Pu("Close"),i18n_title:Pu("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Tc.settings.get("view_mode")}),xc.api.hook("getHeadingButtons",this,e)},renderMessageForm:function(){},afterShown:function(){}};function Rx(){const e=Lx(['\n <div class="list-container list-container--headline ','">\n <div class="items-list rooms-list headline-list">\n ',"\n </div>\n </div>\n"]);return Rx=function(){return e},e}function Dx(){const e=Lx(['\n <div class="list-item controlbox-padded d-flex flex-row"\n data-headline-jid="','">\n <a class="list-item-link open-headline available-room w-100"\n data-headline-jid="','"\n title="','" href="#">',"</a>\n </div>\n"]);return Dx=function(){return e},e}function Lx(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var zx=e=>Fa(Rx(),e.headlineboxes.length?"":"hidden",e.headlineboxes.map(t=>(e=>Fa(Dx(),e.headlinebox.get("jid"),e.headlinebox.get("jid"),e.open_title,e.headlinebox.get("jid")))(Object.assign({headlinebox:t},e))));function Px(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="d-flex controlbox-padded ','">\n <span class="w-100 controlbox-heading controlbox-heading--headline">',"</span>\n </div>\n ","\n"]);return Px=function(){return e},e}const Fx=zc.env.utils,Bx=wh.extend({tagName:"div",className:"controlbox-section",id:"headline",events:{"click .open-headline":"openHeadline"},initialize(){this.listenTo(this.model,"add",this.renderIfHeadline),this.listenTo(this.model,"remove",this.renderIfHeadline),this.listenTo(this.model,"destroy",this.renderIfHeadline),this.render(),this.insertIntoDOM()},toHTML(){return e={heading_headline:Pu("Announcements"),headlineboxes:this.model.filter(e=>e.get("type")===xc.HEADLINES_TYPE),open_title:Pu("Click to open this server message")},Fa(Px(),e.headlineboxes.length?"":"hidden",e.heading_headline,zx(e));var e},renderIfHeadline(e){return e&&e.get("type")===xc.HEADLINES_TYPE&&this.render()},openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");xc.chatboxes.get(t).maybeShow(!0)},insertIntoDOM(){const e=xc.chatboxviews.get("controlbox");e&&e.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd",this.el)}}),Hx={renderHeadlinesPanel(){return this.headlinepanel&&Fx.isInDOM(this.headlinepanel.el)||(this.headlinepanel=new xc.HeadlinesPanel({model:xc.chatboxes}),Tc.trigger("headlinesPanelRendered")),this.headlinepanel}};
/**
* @module converse-headlines-view
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
function qx(){const e=xc.chatboxviews;xc.chatboxes.on("add",t=>{e.get(t.get("id"))||t.get("type")!==xc.HEADLINES_TYPE||e.add(t.get("id"),new xc.HeadlinesBoxView({model:t}))})}zc.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],overrides:{ControlBoxView:{renderControlBoxPane(){this.__super__.renderControlBoxPane.apply(this,arguments),this.renderHeadlinesPanel()}}},initialize(){xc.ControlBoxView&&Object.assign(xc.ControlBoxView.prototype,Hx),xc.HeadlinesBoxView=xc.ChatBoxView.extend(Ix),xc.HeadlinesPanel=Bx,Tc.listen.on("chatBoxViewsInitialized",qx)}});var Ux=n(172),Vx=n.n(Ux);
/**
* @module converse-notification
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:$x}=zc.env,Gx=zc.env.utils,Wx="Notification"in window;let Jx;function Xx(){if(Tc.settings.get("show_tab_notifications")){var e;Jx=null!==(e=Jx)&&void 0!==e?e:new zc.env.Favico({type:"circle",animation:"pop"});const t=xc.chatboxes.models.reduce((e,t)=>e+(t.get("num_unread")||0),0);Jx.badge(t)}}zc.env.Favico=Vx.a,zc.plugins.add("converse-notification",{dependencies:["converse-chatboxes"],initialize(){Tc.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:Tc.settings.get("assets_path")+"/sounds/"}),xc.shouldNotifyOfGroupMessage=function(e){if(!(null==e?void 0:e.body))return!1;const t=e.from,n=e.from_muc,r=Tc.settings.get("notify_all_room_messages"),i=xc.chatboxes.get(n),s=$x.getResourceFromJid(t),o=s&&$x.unescapeNode(s)||"";let a=!1;const c=i.get("nick");Tc.settings.get("notify_nicknames_without_references")&&(a=new RegExp("\\b".concat(c,"\\b")).test(e.body));const l=e.references.reduce((e,t)=>e||(e=>{const t=e.uri.replace(/^xmpp:/,"");return t==xc.bare_jid||t==="".concat(n,"/").concat(c)})(t),!1),u=o!==c,d=!0===r||Array.isArray(r)&&r.includes(n)||l||a;return u&&!!d},xc.isMessageToHiddenChat=function(e){var t,n;return null!==(t=null===(n=xc.chatboxes.get(e.from))||void 0===n?void 0:n.isHidden())&&void 0!==t&&t},xc.shouldNotifyOfMessage=function(e){const{attrs:t,stanza:n}=e;if(!t||null!==n.querySelector("forwarded"))return!1;if("groupchat"===t.type)return xc.shouldNotifyOfGroupMessage(t);if(t.is_headline)return xc.isMessageToHiddenChat(t);const r=$x.getBareJidFromJid(t.from)===xc.bare_jid;return!Gx.isOnlyChatStateNotification(n)&&!Gx.isOnlyMessageDeliveryReceipt(n)&&!r&&("all"===Tc.settings.get("show_desktop_notifications")||xc.isMessageToHiddenChat(t))},xc.playSoundNotification=function(){if(Tc.settings.get("play_sounds")&&void 0!==window.Audio){const e=new Audio(Tc.settings.get("sounds_path")+"msg_received.ogg"),t=e.canPlayType("audio/ogg");if("probably"===t)return e.play();const n=new Audio(Tc.settings.get("sounds_path")+"msg_received.mp3"),r=n.canPlayType("audio/mp3");"probably"===r?n.play():"maybe"===t?e.play():"maybe"===r&&n.play()}},xc.areDesktopNotificationsEnabled=function(){return Wx&&Tc.settings.get("show_desktop_notifications")&&"granted"===Notification.permission},xc.showMessageNotification=function(e){const{attrs:t}=e;if(t.is_error)return;if(!xc.areDesktopNotificationsEnabled())return;let n,r;const i=t.from,s=$x.getBareJidFromJid(i);if("headline"===t.type){if(s.includes("@")&&!Tc.settings.get("allow_non_roster_messaging"))return;n=Pu("Notification from %1$s",s)}else if(s.includes("@"))if("groupchat"===t.type)n=Pu("%1$s says",$x.getResourceFromJid(i));else{if(void 0===xc.roster)return void Lr.error("Could not send notification, because roster is undefined");if(r=xc.roster.get(s),void 0!==r)n=Pu("%1$s says",r.getDisplayName());else{if(!Tc.settings.get("allow_non_roster_messaging"))return;n=Pu("%1$s says",s)}}else n=Pu("Notification from %1$s",s);const o=t.is_encrypted?Pu("Encrypted message received"):t.body;if(!o)return;const a=new Notification(n,{body:o,lang:xc.locale,icon:Tc.settings.get("notification_icon"),requireInteraction:!xc.notification_delay});Tc.settings.get("notification_delay")&&setTimeout(a.close.bind(a),Tc.settings.get("notification_delay")),a.onclick=function(e){e.preventDefault(),window.focus(),xc.chatboxes.get(s).maybeShow(!0)},a.onclick.bind(xc)},xc.showChatStateNotification=function(e){if(xc.chatstate_notification_blacklist.includes(e.jid))return;const t=e.chat_status;let n=null;if("offline"===t?n=Pu("has gone offline"):"away"===t?n=Pu("has gone away"):"dnd"===t?n=Pu("is busy"):"online"===t&&(n=Pu("has come online")),null===n)return;const r=new Notification(e.getDisplayName(),{body:n,lang:xc.locale,icon:xc.notification_icon});setTimeout(r.close.bind(r),5e3)},xc.showContactRequestNotification=function(e){const t=new Notification(e.getDisplayName(),{body:Pu("wants to be your contact"),lang:xc.locale,icon:xc.notification_icon});setTimeout(t.close.bind(t),5e3)},xc.showFeedbackNotification=function(e){if("error"===e.klass||"warn"===e.klass){const t=new Notification(e.subject,{body:e.message,lang:xc.locale,icon:xc.notification_icon});setTimeout(t.close.bind(t),5e3)}},xc.handleChatStateNotification=function(e){xc.areDesktopNotificationsEnabled()&&Tc.settings.get("show_chat_state_notifications")&&xc.showChatStateNotification(e)},xc.handleMessageNotification=function(e){if(!xc.shouldNotifyOfMessage(e))return!1;Tc.trigger("messageNotification",e),xc.playSoundNotification(),xc.showMessageNotification(e)},xc.handleContactRequestNotification=function(e){xc.areDesktopNotificationsEnabled(!0)&&xc.showContactRequestNotification(e)},xc.handleFeedback=function(e){xc.areDesktopNotificationsEnabled(!0)&&xc.showFeedbackNotification(e)},xc.requestPermission=function(){Wx&&!["denied","granted"].includes(Notification.permission)&&Notification.requestPermission()},Tc.listen.on("clearSession",()=>Jx=null),Tc.waitUntil("chatBoxesInitialized").then(()=>xc.chatboxes.on("change:num_unread",Xx)),Tc.listen.on("pluginsInitialized",(function(){Tc.listen.on("contactRequest",xc.handleContactRequestNotification),Tc.listen.on("contactPresenceChanged",xc.handleChatStateNotification),Tc.listen.on("message",xc.handleMessageNotification),Tc.listen.on("feedback",xc.handleFeedback),Tc.listen.on("connected",xc.requestPermission)}))}});var Qx=Math.ceil,Yx=Math.max;var Kx=function(e,t,n,r){for(var i=-1,s=Yx(Qx((t-e)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=e,e+=n;return o};var Zx=function(e){return function(t,n,r){return r&&"number"!=typeof r&&xt(t,n,r)&&(n=r=void 0),t=Ni(t),void 0===n?(n=t,t=0):n=Ni(n),r=void 0===r?t<n?1:-1:Ni(r),Kx(t,n,r,e)}}();var eE=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 Ve(r(n)?on(n):[n],We(t,1))};function tE(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="changeStatusModalLabel">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <form class="converse-form set-xmpp-status" id="set-xmpp-status">\n <div class="form-group">\n <div class="custom-control custom-radio">\n <input ?checked=','\n type="radio" id="radio-online" value="online" name="chat_status" class="custom-control-input"/>\n <label class="custom-control-label" for="radio-online">\n <span class="fa fa-circle chat-status chat-status--online"></span>','</label>\n </div>\n <div class="custom-control custom-radio">\n <input ?checked=','\n type="radio" id="radio-busy" value="dnd" name="chat_status" class="custom-control-input"/>\n <label class="custom-control-label" for="radio-busy">\n <span class="fa fa-minus-circle chat-status chat-status--busy"></span>','</label>\n </div>\n <div class="custom-control custom-radio">\n <input ?checked=','\n type="radio" id="radio-away" value="away" name="chat_status" class="custom-control-input"/>\n <label class="custom-control-label" for="radio-away">\n <span class="fa fa-circle chat-status chat-status--away"></span>','</label>\n </div>\n <div class="custom-control custom-radio">\n <input ?checked=','\n type="radio" id="radio-xa" value="xa" name="chat_status" class="custom-control-input"/>\n <label class="custom-control-label" for="radio-xa">\n <span class="far fa-circle chat-status chat-status--xa"></span>','</label>\n </div>\n </div>\n <div class="form-group">\n <div class="btn-group w-100">\n <input name="status_message" type="text" class="form-control"\n value="','" placeholder="','"/>\n <span class="clear-input fa fa-times ','"></span>\n </div>\n </div>\n <button type="submit" class="btn btn-primary">',"</button>\n </form>\n </div>\n </div>\n </div>\n"]);return tE=function(){return e},e}const nE=zc.env.utils,rE=Jf.extend({id:"modal-status-change",events:{"submit form#set-xmpp-status":"onFormSubmitted","click .clear-input":"clearStatusMessage"},toHTML(){return e=Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{label_away:Pu("Away"),label_busy:Pu("Busy"),label_cancel:Pu("Cancel"),label_close:Pu("Close"),label_custom_status:Pu("Custom status"),label_offline:Pu("Offline"),label_online:Pu("Online"),label_save:Pu("Save"),label_xa:Pu("Away for long"),modal_title:Pu("Change chat status"),placeholder_status_message:Pu("Personal status message")}),Fa(tE(),e.modal_title,Zf,"online"===e.status,e.label_online,"busy"===e.status,e.label_busy,"away"===e.status,e.label_away,"xa"===e.status,e.label_xa,e.status_message||"",e.placeholder_status_message,e.status_message?"":"hidden",e.label_save);var e},afterRender(){this.el.addEventListener("shown.bs.modal",()=>{this.el.querySelector('input[name="status_message"]').focus()},!1)},clearStatusMessage(e){e&&e.preventDefault&&(e.preventDefault(),nE.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()}});xc.ChatStatusModal=rE;function iE(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <a class="change-avatar" @click=',' title="','">\n ',"\n </a>\n <input @change=",' class="hidden" name="image" type="file"/>\n ']);return iE=function(){return e},e}const sE=Pu("Your avatar image");function oE(){const e=pE(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="user-profile-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n ','\n <div class="tab-content">\n <div class="tab-pane active" id="profile-tabpanel" role="tabpanel" aria-labelledby="profile-tab">\n <form class="converse-form converse-form--modal profile-form" action="#">\n <div class="row">\n <div class="col-auto">\n <converse-image-picker image="','" width="','" height="','"></converse-image-picker>\n </div>\n <div class="col">\n <div class="form-group">\n <label class="col-form-label">',":</label>\n <div>",'</div>\n </div>\n </div>\n </div>\n <div class="form-group">\n <label for="vcard-fullname" class="col-form-label">',':</label>\n <input id="vcard-fullname" type="text" class="form-control" name="fn" value="','"/>\n </div>\n <div class="form-group">\n <label for="vcard-nickname" class="col-form-label">',':</label>\n <input id="vcard-nickname" type="text" class="form-control" name="nickname" value="','"/>\n </div>\n <div class="form-group">\n <label for="vcard-url" class="col-form-label">',':</label>\n <input id="vcard-url" type="url" class="form-control" name="url" value="','"/>\n </div>\n <div class="form-group">\n <label for="vcard-email" class="col-form-label">',':</label>\n <input id="vcard-email" type="email" class="form-control" name="email" value="','"/>\n </div>\n <div class="form-group">\n <label for="vcard-role" class="col-form-label">',':</label>\n <input id="vcard-role" type="text" class="form-control" name="role" value="','" aria-describedby="vcard-role-help"/>\n <small id="vcard-role-help" class="form-text text-muted">','</small>\n </div>\n <hr/>\n <div class="form-group">\n <button type="submit" class="save-form btn btn-primary">',"</button>\n </div>\n </form>\n </div>\n ","\n </div>\n </div>\n </div>\n </div>\n "]);return oE=function(){return e},e}function aE(){const e=pE(['\n <ul class="nav nav-pills justify-content-center">\n <li role="presentation" class="nav-item">\n <a class="nav-link active" id="profile-tab" href="#profile-tabpanel" aria-controls="profile-tabpanel" role="tab" data-toggle="tab">','</a>\n </li>\n <li role="presentation" class="nav-item">\n <a class="nav-link" id="omemo-tab" href="#omemo-tabpanel" aria-controls="omemo-tabpanel" role="tab" data-toggle="tab">',"</a>\n </li>\n </ul>"]);return aE=function(){return e},e}function cE(){const e=pE(['\n <div class="tab-pane" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">\n <form class="converse-form fingerprint-removal">\n <ul class="list-group fingerprints">\n <li class="list-group-item active">','</li>\n <li class="list-group-item">\n ','\n </li>\n </ul>\n <div class="form-group">\n <button type="button" class="generate-bundle btn btn-danger">',"</button>\n </div>\n ","\n </form>\n </div>"]);return cE=function(){return e},e}function lE(){const e=pE(['\n <ul class="list-group fingerprints">\n <li class="list-group-item nopadding active">\n <label>\n <input type="checkbox" class="select-all" title="','" aria-label="','"/>\n ',"\n </label>\n </li>\n ",'\n </ul>\n <div class="form-group"><button type="submit" class="save-form btn btn-primary">',"</button></div>\n "]);return lE=function(){return e},e}function uE(){const e=pE(["\n ","\n"]);return uE=function(){return e},e}function dE(){const e=pE(['\n <li class="fingerprint-removal-item list-group-item nopadding">\n <label>\n <input type="checkbox" value="','"\n aria-label="','"/>\n <span>',"</span>\n </label>\n </li>\n "]);return dE=function(){return e},e}function hE(){const e=pE(['\n <li class="fingerprint-removal-item list-group-item nopadding">\n <label>\n <input type="checkbox" value="','"\n aria-label="','"/>\n <span class="fingerprint">',"</span>\n </label>\n </li>\n "]);return hE=function(){return e},e}function fE(){const e=pE(['\n <span class="fingerprint">',"</span>"]);return fE=function(){return e},e}function pE(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-image-picker",class extends rc{static get properties(){return{height:{type:Number},image:{type:String},width:{type:Number}}}render(){const e={height:this.height,image:this.image,width:this.width};return Fa(iE(),this.openFileSelection,sE,qp(e),this.updateFilePreview)}openFileSelection(e){e.preventDefault(),this.querySelector('input[type="file"]').click()}updateFilePreview(e){const t=e.target.files[0],n=new FileReader;n.onloadend=()=>this.image=n.result,n.readAsDataURL(t)}});const mE=zc.env.utils,gE=e=>Fa(uE(),e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=Pu("Checkbox for selecting the following fingerprint");return Fa(hE(),e.device.get("id"),t,mE.formatFingerprint(e.device.get("bundle").fingerprint))})(e):(e=>{const t=Pu("Device without a fingerprint"),n=Pu("Checkbox for selecting the following device");return Fa(dE(),e.device.get("id"),n,t)})(e)),vE=e=>{const t=Pu("This device's OMEMO fingerprint"),n=Pu("Generate new keys and fingerprint");return Fa(cE(),t,e.view.current_device&&e.view.current_device.get("bundle")&&e.view.current_device.get("bundle").fingerprint?(e=>Fa(fE(),mE.formatFingerprint(e.view.current_device.get("bundle").fingerprint)))(e):Qp(),n,e.view.other_devices.length?(e=>{const t=Pu("Other OMEMO-enabled devices"),n=Pu("Checkbox to select fingerprints of all other OMEMO devices"),r=Pu("Remove checked devices and close"),i=Pu("Select all");return Fa(lE(),i,n,t,e.view.other_devices.map(t=>gE(Object.assign({device:t},e))),r)})(e):"")};const{sizzle:_E}=converse.env,bE=Jf.extend({id:"user-profile-modal",events:{"submit .profile-form":"onFormSubmitted"},initialize(){this.listenTo(this.model,"change",this.render),Jf.prototype.initialize.apply(this,arguments),Tc.trigger("profileModalInitialized",this.model)},toHTML(){return(e=>{const t=Pu("Your Profile"),n=Pu("Email"),r=Pu("Full Name"),i=Pu("XMPP Address (JID)"),s=Pu("Nickname"),o=Pu("Role"),a=Pu("Save and close"),c=Pu("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),l=Pu("URL"),u=Pu("OMEMO"),d=Pu("Profile"),h=Fa(aE(),d,u);return Fa(oE(),t,Zf,xc.pluggable.plugins["converse-omemo"].enabled(xc)&&h||"",e.image,e.width,e.height,i,e.jid,r,e.fullname||"",s,e.nickname||"",l,e.url||"",n,e.email||"",o,e.role||"",c,a,xc.pluggable.plugins["converse-omemo"].enabled(xc)&&vE(e)||"")})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),this.getAvatarData(),{view:this}))},getAvatarData(){return{height:128,width:128,image:"data:"+this.model.vcard.get("image_type")+";base64,"+this.model.vcard.get("image")}},afterRender(){this.tabs=_E(".nav-item .nav-link",this.el).map(e=>new Vf.a.Tab(e))},async setVCard(e){try{await Tc.vcard.set(xc.bare_jid,e)}catch(e){return Lr.fatal(e),void this.alert([Pu("Sorry, an error happened while trying to save your profile data."),Pu("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),r=n.get("image"),i={fn:n.get("fn"),nickname:n.get("nickname"),role:n.get("role"),email:n.get("email"),url:n.get("url")};r.size?(t.onloadend=()=>{Object.assign(i,{image:btoa(t.result),image_type:r.type}),this.setVCard(i)},t.readAsBinaryString(r)):(Object.assign(i,{image:this.model.vcard.get("image"),image_type:this.model.vcard.get("image_type")}),this.setVCard(i))}});xc.ProfileModal=bE;function yE(){const e=CE(['\n <fieldset class="form-group">\n <ul class="list-group">\n <li class="list-group-item active">',":</li>\n ","\n </ul>\n </fieldset>"]);return yE=function(){return e},e}function wE(){const e=CE(['<div class="alert alert-','" role="alert">',"</div>"]);return wE=function(){return e},e}function SE(){const e=CE(["\n ",'\n <form class="converse-form" @submit=','>\n <fieldset class="form-group">\n <label>\n ','\n <p class="form-help">','</p>\n <converse-autocomplete\n .getAutoCompleteList="','"\n placeholder="','"\n name="jid"/>\n </label>\n </fieldset>\n <fieldset class="form-group">\n <input type="submit" class="btn btn-primary" value="','">\n </fieldset>\n ',"\n\n </form>\n "]);return SE=function(){return e},e}function xE(){const e=CE(['\n <li class="room-item list-group-item">\n <div class="available-chatroom d-flex flex-row">\n <a class="open-room available-room w-100"\n @click=','\n data-command-node="','"\n data-command-jid="','"\n data-command-name="','"\n title="','"\n href="#">',"</a>\n </div>\n ","\n </li>\n"]);return xE=function(){return e},e}function EE(){const e=CE(['<div class="alert alert-','" role="alert">',"</div>"]);return EE=function(){return e},e}function AE(){const e=CE(["\n <form @submit=",">\n ",'\n <fieldset class="form-group">\n <input type="hidden" name="command_node" value="','"/>\n <input type="hidden" name="command_jid" value="','"/>\n\n <p class="form-help">',"</p>\n ",'\n </fieldset>\n <fieldset>\n <input type="submit" class="btn btn-primary" value="','">\n <input type="button" class="btn btn-secondary button-cancel" value="','" @click=',">\n </fieldset>\n </form>\n "]);return AE=function(){return e},e}function CE(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const{Strophe:TE,$iq:OE,sizzle:jE}=zc.env,kE=zc.env.utils,NE=(e,t)=>Fa(xE(),e.toggleCommandForm,t.node,t.jid,t.name,t.name,t.name||t.jid,t.node===e.showform?((e,t)=>{const n=Pu("Hide"),r=Pu("Execute");return Fa(AE(),e.runCommand,t.alert?Fa(EE(),t.alert_type,t.alert):"",t.node,t.jid,t.instructions,t.fields,r,n,e.hideCommandForm)})(e,t):"");async function ME(){const e=[...await Tc.rooms.get(),...await Tc.contacts.get()];return[...new Set(e.map(e=>TE.getDomainFromJid(e.get("jid"))))]}function IE(){const e=DE(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="converse-modtools-modal-label">',"</h5>\n ",'\n </div>\n <div class="modal-body">\n ','\n\n <div class="tab-content">\n <div class="tab-pane tab-pane--columns ','"\n id="about-tabpanel" role="tabpanel" aria-labelledby="about-tab">\n\n <span class="modal-alert"></span>\n <br/>\n <div class="container">\n <h6 class="brand-heading">Converse</h6>\n <p class="brand-subtitle">','</p>\n <p class="brand-subtitle">','</p>\n <p class="brand-subtitle">','</p>\n </div>\n </div>\n\n <div class="tab-pane tab-pane--columns ','"\n id="commands-tabpanel"\n role="tabpanel"\n aria-labelledby="commands-tab">\n <converse-adhoc-commands/>\n </div>\n </div>\n </div>\n </div>\n </div>\n']);return IE=function(){return e},e}function RE(){const e=DE(['\n <ul class="nav nav-pills justify-content-center">\n <li role="presentation" class="nav-item">\n <a class="nav-link active" id="about-tab" href="#about-tabpanel" aria-controls="about-tabpanel" role="tab" data-toggle="tab" @click=',">",'</a>\n </li>\n <li role="presentation" class="nav-item">\n <a class="nav-link" id="commands-tab" href="#commands-tabpanel" aria-controls="commands-tabpanel" role="tab" data-toggle="tab" @click=',">","</a>\n </li>\n </ul>\n "]);return RE=function(){return e},e}function DE(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Tc.elements.define("converse-adhoc-commands",class extends rc{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(e=>{const t=Pu("On which entity do you want to run commands?"),n=Pu("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."),r=Pu("Commands found"),i=Pu("List available commands"),s=Pu("XMPP Address"),o=Pu("No commands found");return Fa(SE(),e.alert?Fa(wE(),e.alert_type,e.alert):"",e.fetchCommands,t,n,ME,s,i,"list-commands"===e.view?Fa(yE(),e.commands.length?r:o,e.commands.map(t=>NE(e,t))):"")})({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 Tc.disco.supports(TE.NS.ADHOC,t)}catch(e){Lr.error(e)}if(n)try{this.commands=await Tc.adhoc.getCommands(t),this.view="list-commands"}catch(e){return Lr.error(e),this.alert_type="danger",this.alert=Pu("Sorry, an error occurred while looking for commands on that entity."),this.commands=[],void Lr.error(e)}else this.alert_type="danger",this.alert=Pu("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,r=OE({type:"set",to:n}).c("command",{xmlns:TE.NS.ADHOC,node:t,action:"execute"});try{var i;const t=await Tc.sendIQ(r),n=jE('command[xmlns="'.concat(TE.NS.ADHOC,'"]'),t).pop();e.sessionid=n.getAttribute("sessionid"),e.instructions=null===(i=jE('x[type="form"][xmlns="jabber:x:data"] instructions',n).pop())||void 0===i?void 0:i.textContent,e.fields=jE('x[type="form"][xmlns="jabber:x:data"] field',n).map(e=>kE.xForm2TemplateResult(e,n))}catch(t){null===t?Lr.error("Error: timeout while trying to execute command for ".concat(n)):(Lr.error("Error while trying to execute command for ".concat(n)),Lr.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(),r=t.get("command_node").trim(),i=this.commands.filter(e=>e.node===r)[0];i.alert=null,this.nonce=kE.getUniqueId();const s=jE(":input:not([type=button]):not([type=submit])",e.target).filter(e=>!["command_jid","command_node"].includes(e.getAttribute("name"))).map(kE.webForm2xForm).filter(e=>e),o=OE({to:n,type:"set"}).c("command",{sessionid:i.sessionid,node:i.node,xmlns:TE.NS.ADHOC}).c("x",{xmlns:TE.NS.XFORM,type:"submit"});let a;s.forEach(e=>o.cnode(e).up());try{a=await Tc.sendIQ(o)}catch(e){i.alert_type="danger",i.alert=Pu("Sorry, an error occurred while trying to execute the command. See the developer console for details"),Lr.error("Error while trying to execute an ad-hoc command"),Lr.error(e)}var c;a?i.alert=null===(c=a.querySelector("note"))||void 0===c?void 0:c.textContent:i.alert="Done";i.alert_type="primary",this.nonce=kE.getUniqueId()}});var LE=e=>{const t=Pu("Settings"),n=Pu("%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">'),r=Pu("%1$s Translate %2$s it into your own language",'<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">',"</a>"),i=Tc.settings.get("show_client_info"),s=Tc.settings.get("allow_adhoc_commands"),o=i&&s;return Fa(IE(),t,Zf,o?(e=>{const t=Pu("About"),n=Pu("Commands");return Fa(RE(),e.switchTab,t,e.switchTab,n)})(e):"",i?"active":"",e.version_name,Dm(Im.a.filterXSS(n,{whiteList:{a:[]}})),Dm(Im.a.filterXSS(r,{whiteList:{a:[]}})),!i&&s?"active":"")};let zE;var PE=Jf.extend({id:"converse-client-info-modal",initialize(e){zE=e._converse,Jf.prototype.initialize.apply(this,arguments)},toHTML(){return LE(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{version_name:zE.VERSION_NAME}))}});function FE(){const e=qE(['<a class="controlbox-heading__btn logout fa fa-sign-out-alt align-self-center" title="','"></a>']);return FE=function(){return e},e}function BE(){const e=qE(['<a class="controlbox-heading__btn show-client-info fa fa-cog align-self-center" title="','" @click=',"></a>"]);return BE=function(){return e},e}function HE(){const e=qE(['\n <div class="userinfo controlbox-padded">\n <div class="controlbox-section profile d-flex">\n <a class="show-profile" href="#">\n <canvas class="avatar align-self-center" height="40" width="40"></canvas>\n </a>\n <span class="username w-100 align-self-center">',"</span>\n ","\n ",'\n </div>\n <div class="d-flex xmpp-status">\n <a class="change-status" title="','" data-toggle="modal" data-target="#changeStatusModal">\n <span class="',' w-100 align-self-center" data-value="','">\n <span class="\n ',"\n ","\n ","\n ","\n ",'"></span> ',"</span>\n </a>\n </div>\n </div>\n"]);return HE=function(){return e},e}function qE(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function UE(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @module converse-omemo
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/(['\n <button class="toggle-omemo"\n title="','"\n ?disabled=',"\n @click=",'>\n <converse-icon class="fa ','"\n path-prefix="','" size="1em"\n color="','"\n ></converse-icon>\n </button>']);return UE=function(){return e},e}
/**
* @module converse-profile
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
zc.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews"],initialize(){Tc.settings.extend({allow_adhoc_commands:!0,show_client_info:!0}),xc.XMPPStatusView=xc.ViewWithAvatar.extend({tagName:"div",events:{"click a.show-profile":"showProfileModal","click a.change-status":"showStatusChangeModal","click .logout":"logOut"},initialize(){this.listenTo(this.model,"change",this.render),this.listenTo(this.model.vcard,"change",this.render)},toHTML(){const e=this.model.get("status")||"offline";return(e=>{const t=Pu("Log out"),n=Pu("Click to change your chat status"),r=Pu("Show details about this chat client"),i=Tc.settings.get("show_client_info")||Tc.settings.get("allow_adhoc_commands");return Fa(HE(),e.fullname,i?Fa(BE(),r,e.showUserSettingsModal):"",Tc.settings.get("allow_logout")?Fa(FE(),t):"",n,e.chat_status,e.chat_status,"online"===e.chat_status&&"fa fa-circle chat-status chat-status--online","dnd"===e.chat_status&&"fa fa-minus-circle chat-status chat-status--busy","away"===e.chat_status&&"fa fa-circle chat-status chat-status--away","xa"===e.chat_status&&"far fa-circle chat-status chat-status--xa ","offline"===e.chat_status&&"fa fa-circle chat-status chat-status--offline",e.status_message)})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{chat_status:e,fullname:this.model.vcard.get("fullname")||xc.bare_jid,showUserSettingsModal:e=>this.showUserSettingsModal(e),status_message:this.model.get("status_message")||Pu("I am %1$s",this.getPrettyStatus(e))}))},afterRender(){this.renderAvatar()},showProfileModal(e){e.preventDefault(),Tc.modal.show(xc.ProfileModal,{model:this.model},e)},showStatusChangeModal(e){e.preventDefault(),Tc.modal.show(xc.ChatStatusModal,{model:this.model},e)},showUserSettingsModal(e){e.preventDefault(),Tc.modal.show(PE,{model:this.model,_converse:xc},e)},logOut(e){e.preventDefault(),!0===confirm(Pu("Are you sure you want to log out?"))&&Tc.user.logout()},getPrettyStatus:e=>"chat"===e?Pu("online"):"dnd"===e?Pu("busy"):"xa"===e?Pu("away for long"):"away"===e?Pu("away"):"offline"===e?Pu("offline"):Pu(e)||Pu("online")}),Tc.listen.on("controlBoxPaneInitialized",async e=>{await Tc.waitUntil("VCardsInitialized"),xc.xmppstatusview=new xc.XMPPStatusView({model:xc.xmppstatus}),e.el.insertAdjacentElement("afterBegin",xc.xmppstatusview.render().el)})}});const{Strophe:VE,sizzle:$E,$build:GE,$iq:WE,$msg:JE}=zc.env,XE=zc.env.utils;VE.addNamespace("OMEMO_DEVICELIST",VE.NS.OMEMO+".devicelist"),VE.addNamespace("OMEMO_VERIFICATION",VE.NS.OMEMO+".verification"),VE.addNamespace("OMEMO_WHITELISTED",VE.NS.OMEMO+".whitelisted"),VE.addNamespace("OMEMO_BUNDLES",VE.NS.OMEMO+".bundles");const QE={name:"AES-GCM",length:128};class YE extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}function KE(e,t){return t.is_encrypted&&t.encrypted.key?!0===t.encrypted.prekey?async function(e){const t=nA(e.from,parseInt(e.encrypted.device_id,10)),n=XE.base64ToArrayBuffer(e.encrypted.key);let r;try{r=await t.decryptPreKeyWhisperMessage(n,"binary")}catch(t){return Lr.error("".concat(t.name," ").concat(t.message)),Object.assign(e,iA(t))}try{const t=await rA(e,r);return await xc.omemo_store.generateMissingPreKeys(),await xc.omemo_store.publishBundle(),t?Object.assign(e,{plaintext:t}):Object.assign(e,{is_only_key:!0})}catch(t){return Lr.error("".concat(t.name," ").concat(t.message)),Object.assign(e,iA(t))}}(t):async function(e){const t=e.from_muc?e.from_real_jid:e.from;t||Object.assign(e,{error_text:Pu("Sorry, could not decrypt a received OMEMO because we don't have the JID for that user."),error_type:"Decryption",is_ephemeral:!1,is_error:!0,type:"error"});const n=nA(t,parseInt(e.encrypted.device_id,10)),r=XE.base64ToArrayBuffer(e.encrypted.key);try{const t=await n.decryptWhisperMessage(r,"binary"),i=await rA(e,t);return Object.assign(e,{plaintext:i})}catch(t){return Lr.error("".concat(t.name," ").concat(t.message)),Object.assign(e,iA(t))}}(t):t}function ZE(){xc.chatboxes.on("add",e=>{fA(e),e.get("type")===xc.CHATROOMS_TYPE&&(e.occupants.on("add",t=>async function(e,t){if(t.isSelf()||!e.features.get("nonanonymous")||!e.features.get("membersonly"))return;if(e.get("omemo_active")){await xc.contactHasOMEMOSupport(t.get("jid"))||(e.createMessage({message:Pu("%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",()=>fA(e)))})}function eA(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.el.querySelector("converse-chat-toolbar"))||void 0===t||t.requestUpdate()}),e.listenTo(e.model,"change:omemo_active",()=>{e.el.querySelector("converse-chat-toolbar").requestUpdate()})}const tA=zc.env.omemo={async encryptMessage(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(QE,!0,["encrypt","decrypt"]),r={name:"AES-GCM",iv:t,tagLength:128},i=await crypto.subtle.encrypt(r,n,XE.stringToArrayBuffer(e)),s=i.byteLength-16,o=i.slice(0,s),a=i.slice(s),c=await crypto.subtle.exportKey("raw",n);return{key:c,tag:a,key_and_tag:XE.appendArrayBuffer(c,a),payload:XE.arrayBufferToBase64(o),iv:XE.arrayBufferToBase64(t)}},async decryptMessage(e){const t=await crypto.subtle.importKey("raw",e.key,QE,!0,["encrypt","decrypt"]),n=XE.appendArrayBuffer(XE.base64ToArrayBuffer(e.payload),e.tag),r={name:"AES-GCM",iv:XE.base64ToArrayBuffer(e.iv),tagLength:128};return XE.arrayBufferToString(await crypto.subtle.decrypt(r,t,n))}};function nA(e,t){const n=new libsignal.SignalProtocolAddress(e,t);return new window.libsignal.SessionCipher(xc.omemo_store,n)}async function rA(e,t){const n=e.encrypted,r=xc.devicelists.getDeviceList(e.from);await r._devices_promise;let i=r.get(n.device_id);if(i||(i=await r.devices.create({id:n.device_id,jid:e.from},{promise:!0})),n.payload){const e=t.slice(0,16),r=t.slice(16),s=await tA.decryptMessage(Object.assign(n,{key:e,tag:r}));return i.save("active",!0),s}}function iA(e){return"debug"===Tc.settings.get("loglevel")?{error_text:Pu("Sorry, could not decrypt a received OMEMO message due to an error.")+" ".concat(e.name," ").concat(e.message),error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"}:{}}function sA(e){const t=e.querySelector("signedPreKeyPublic"),n=e.querySelector("signedPreKeySignature"),r=$E("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:r}}async function oA(e){var t;if(null===(t=e.get("bundle"))||void 0===t?void 0:t.fingerprint)return;const n=await e.getBundle();n.fingerprint=XE.arrayBufferToHex(XE.base64ToArrayBuffer(n.identity_key)),e.save("bundle",n),e.trigger("change:bundle")}async function aA(e){await Tc.waitUntil("OMEMOInitialized");const t=xc.devicelists.get(e)||xc.devicelists.create({jid:e});return await t.fetchDevices(),t.devices}async function cA(e){if(!e.get("bundle"))return Lr.error("Could not build an OMEMO session for device ".concat(e.get("id")," because we don't have its bundle")),null;const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=await xc.omemo_store.loadSession(t.toString());if(n)return n;try{return await async function(e){const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=new libsignal.SessionBuilder(xc.omemo_store,t),r=e.getRandomPreKey(),i=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:XE.base64ToArrayBuffer(i.identity_key),signedPreKey:{keyId:i.signed_prekey.id,publicKey:XE.base64ToArrayBuffer(i.signed_prekey.public_key),signature:XE.base64ToArrayBuffer(i.signed_prekey.signature)},preKey:{keyId:r.id,publicKey:XE.base64ToArrayBuffer(r.key)}})}(e)}catch(t){return Lr.error("Could not build an OMEMO session for device ".concat(e.get("id"))),Lr.error(t),null}}function lA(){xc.connection.addHandler(e=>{try{$E('event[xmlns="'.concat(VE.NS.PUBSUB,'#event"]'),e).length&&(function(e){const t=$E('items[node="'.concat(VE.NS.OMEMO_DEVICELIST,'"]'),e).pop();if(!t)return;const n='item list[xmlns="'.concat(VE.NS.OMEMO,'"] device'),r=$E(n,t).map(e=>e.getAttribute("id")),i=e.getAttribute("from"),s=xc.devicelists.getDeviceList(i),o=s.devices;ho(o.pluck("id"),r).forEach(e=>{i===xc.bare_jid&&e===xc.omemo_store.get("device_id")||o.get(e).save("active",!1)}),r.forEach(e=>{const t=o.get(e);t?t.save("active",!0):o.create({id:e,jid:i})}),XE.isSameBareJID(i,xc.bare_jid)&&s.publishCurrentDevice(r)}(e),function(e){const t=$E("items",e).pop();if(!t||!t.getAttribute("node").startsWith(VE.NS.OMEMO_BUNDLES))return;const n=t.getAttribute("node").split(":")[1],r=e.getAttribute("from"),i=$E("item > bundle",t).pop(),s=xc.devicelists.getDeviceList(r);(s.devices.get(n)||s.devices.create({id:n,jid:r})).save({bundle:sA(i)})}(e))}catch(e){Lr.error(e.message)}return!0},null,"message","headline")}function uA(){if(void 0===xc.omemo_store){const e="converse.omemosession-".concat(xc.bare_jid);xc.omemo_store=new xc.OMEMOStore({id:e}),xc.omemo_store.browserStorage=xc.createStore(e)}return xc.omemo_store.fetchSession()}async function dA(){await new Promise((e,t)=>xc.devicelists.fetch({success:e,error:(e,n)=>t(n)}));let e=xc.devicelists.get(xc.bare_jid);return e?e.fetchDevices():e=await xc.devicelists.create({jid:xc.bare_jid},{promise:!0}),e._devices_promise}async function hA(){if(!xc.config.get("trusted")||Tc.settings.get("clear_cache_on_logout"))return void Lr.warn("Not initializing OMEMO, since this browser is not trusted or clear_cache_on_logout is set to true");xc.devicelists=new xc.DeviceLists;const e="converse.devicelists-".concat(xc.bare_jid);xc.devicelists.browserStorage=xc.createStore(e);try{await dA(),await uA(),await xc.omemo_store.publishBundle()}catch(e){return Lr.error("Could not initialize OMEMO support"),void Lr.error(e)}Tc.trigger("OMEMOInitialized")}async function fA(e){let t;e.get("type")===xc.CHATROOMS_TYPE?(await Tc.waitUntil("OMEMOInitialized"),t=e.features.get("nonanonymous")&&e.features.get("membersonly")):e.get("type")===xc.PRIVATE_CHAT_TYPE&&(t=await xc.contactHasOMEMOSupport(e.get("jid"))),e.set("omemo_supported",t),t&&Tc.settings.get("omemo_default")&&e.set("omemo_active",!0)}function pA(e){e.stopPropagation(),e.preventDefault();const t=XE.ancestor(e.target,"converse-chat-toolbar");if(!t.model.get("omemo_supported")){let e;return e=t.model.get("type")===xc.CHATROOMS_TYPE?[Pu("Cannot use end-to-end encryption in this groupchat, either the groupchat has some anonymity or not all participants support OMEMO.")]:[Pu("Cannot use end-to-end encryption because %1$s uses a client that doesn't support OMEMO.",t.model.contact.getDisplayName())],Tc.alert("error",Pu("Error"),e)}t.model.save({omemo_active:!t.model.get("omemo_active")})}function mA(e,t){const n=e.model;let r;if(n.get("type")===xc.CHATROOMS_TYPE&&n.get("omemo_supported")){const e=Pu("Messages are being sent in plaintext"),t=Pu("Messages are sent encrypted");r=n.get("omemo_active")?t:e}else r=Pu("This groupchat needs to be members-only and non-anonymous in order to support OMEMO encrypted messages");return t.push(Fa(UE(),r,!n.get("omemo_supported"),pA,n.get("omemo_active")?"fa-lock":"fa-unlock",Tc.settings.get("assets_path"),n.get("omemo_active")?"var(--info-color)":"var(--error-color)")),t}const gA={encryptKey:(e,t)=>nA(t.get("jid"),t.get("id")).encrypt(e).then(e=>({payload:e,device:t})),handleMessageSendError(e){if("IQError"===e.name){this.save("omemo_supported",!1);const t=[];$E('presence-subscription-required[xmlns="'.concat(VE.NS.PUBSUB_ERROR,'"]'),e.iq).length?t.push(Pu("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"))):$E('remote-server-not-found[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]',e.iq).length?t.push(Pu("Sorry, we're unable to send an encrypted message because the remote server for %1$s could not be found",e.iq.getAttribute("from"))):(t.push(Pu("Unable to send an encrypted message due to an unexpected error.")),t.push(e.iq.outerHTML)),Tc.alert("error",Pu("Error"),t),Lr.error(e)}else{if(!e.user_facing)throw e;Tc.alert("error",Pu("Error"),[e.message]),Lr.error(e)}}};zc.plugins.add("converse-omemo",{enabled:e=>window.libsignal&&e.config.get("trusted")&&!Tc.settings.get("clear_cache_on_logout")&&!e.api.settings.get("blacklisted_plugins").includes("converse-omemo"),dependencies:["converse-chatview","converse-pubsub","converse-profile"],overrides:{ProfileModal:{events:{"change input.select-all":"selectAll","click .generate-bundle":"generateOMEMODeviceBundle","submit .fingerprint-removal":"removeSelectedFingerprints"},initialize(){return this.debouncedRender=yt(this.render,50),this.devicelist=xc.devicelists.get(xc.bare_jid),this.listenTo(this.devicelist.devices,"change:bundle",this.debouncedRender),this.listenTo(this.devicelist.devices,"reset",this.debouncedRender),this.listenTo(this.devicelist.devices,"reset",this.debouncedRender),this.listenTo(this.devicelist.devices,"remove",this.debouncedRender),this.listenTo(this.devicelist.devices,"add",this.debouncedRender),this.__super__.initialize.apply(this,arguments)},beforeRender(){const e=xc.omemo_store.get("device_id");if(e&&(this.current_device=this.devicelist.devices.get(e)),this.other_devices=this.devicelist.devices.filter(t=>t.get("id")!==e),this.__super__.beforeRender)return this.__super__.beforeRender.apply(this,arguments)},selectAll(e){let t=XE.ancestor(e.target,"li");for(;t;)t.querySelector('input[type="checkbox"]').checked=e.target.checked,t=t.nextElementSibling},removeSelectedFingerprints(e){e.preventDefault(),e.stopPropagation(),e.target.querySelector(".select-all").checked=!1;const t=$E('.fingerprint-removal-item input[type="checkbox"]:checked',e.target).map(e=>e.value);this.devicelist.removeOwnDevices(t).then(this.modal.hide).catch(e=>{Lr.error(e),xc.api.alert(VE.LogLevel.ERROR,Pu("Error"),[Pu("Sorry, an error occurred while trying to remove the devices.")])})},generateOMEMODeviceBundle(e){e.preventDefault(),confirm(Pu("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."))&&Tc.omemo.bundle.generate()}},UserDetailsModal:{events:{"click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){const e=this.model.get("jid");return this.devicelist=xc.devicelists.getDeviceList(e),this.listenTo(this.devicelist.devices,"change:bundle",this.render),this.listenTo(this.devicelist.devices,"change:trusted",this.render),this.listenTo(this.devicelist.devices,"remove",this.render),this.listenTo(this.devicelist.devices,"add",this.render),this.listenTo(this.devicelist.devices,"reset",this.render),this.__super__.initialize.apply(this,arguments)},toggleDeviceTrust(e){const t=e.target;this.devicelist.devices.get(t.getAttribute("name")).save("trusted",parseInt(t.value,10))}},ChatBox:{async sendMessage(e,t){if(this.get("omemo_active")&&e){const n=this.getOutgoingMessageAttributes(e,t);let r,i;n.is_encrypted=!0,n.plaintext=n.message;try{const e=await xc.getBundlesAndBuildSessions(this);r=await this.createMessage(n),i=await xc.createOMEMOMessageStanza(this,r,e)}catch(e){return this.handleMessageSendError(e),null}return xc.api.send(i),r}return this.__super__.sendMessage.apply(this,arguments)}}},initialize(){Tc.settings.extend({omemo_default:!1}),Tc.promises.add(["OMEMOInitialized"]),xc.NUM_PREKEYS=100,Object.assign(xc.ChatBox.prototype,gA),xc.generateFingerprints=async function(e){const t=await aA(e);return Promise.all(t.map(e=>oA(e)))},xc.getDeviceForContact=function(e,t){return aA(e).then(e=>e.get(t))},xc.contactHasOMEMOSupport=async function(e){return(await aA(e)).length>0},xc.getBundlesAndBuildSessions=async function(e){const t=Pu("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===xc.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map(e=>aA(e.get("jid"))));n=t.reduce((e,t)=>eE(e,t.models),[])}else if(e.get("type")===xc.PRIVATE_CHAT_TYPE){const r=await aA(e.get("jid"));if(0===r.length){const e=new Error(t);throw e.user_facing=!0,e}const i=xc.devicelists.get(xc.bare_jid).devices;n=[...i.models,...r.models]}const r=xc.omemo_store.get("device_id");n=n.filter(e=>e.get("id")!==r),await Promise.all(n.map(e=>e.getBundle()));const i=n.filter(e=>e).map(e=>cA(e));if(await Promise.all(i),i.includes(null)&&(n=n.filter(e=>i[n.indexOf(e)]),0===n.length)){const e=new Error(t);throw e.user_facing=!0,e}return n},xc.createOMEMOMessageStanza=function(e,t,n){const r=Pu("This is an OMEMO encrypted message which your client doesnt seem to support. Find more information on https://conversations.im/omemo");if(!t.get("message"))throw new Error("No message body to encrypt!");const i=JE({from:xc.connection.jid,to:e.get("jid"),type:e.get("message_type"),id:t.get("msgid")}).c("body").t(r).up();return"chat"===t.get("type")&&i.c("request",{xmlns:VE.NS.RECEIPTS}).up(),i.c("encrypted",{xmlns:VE.NS.OMEMO}).c("header",{sid:xc.omemo_store.get("device_id")}),tA.encryptMessage(t.get("message")).then(t=>{const r=n.filter(e=>-1!=e.get("trusted")&&e.get("active")).map(n=>e.encryptKey(t.key_and_tag,n));return Promise.all(r).then(e=>function(e,t,n){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const i=t[r].payload,s=t[r].device,o=3==parseInt(i.type,10);e.c("key",{rid:s.get("id")}).t(btoa(i.body)),o&&e.attrs({prekey:o}),e.up(),r==t.length-1&&e.c("iv").t(n).up().up()}return Promise.resolve(e)}(i,e,t.iv)).then(e=>(e.c("payload").t(t.payload).up().up(),e.c("store",{xmlns:VE.NS.HINTS}),e))})},xc.OMEMOStore=Vs.extend({Direction:{SENDING:1,RECEIVING:2},getIdentityKeyPair(){const e=this.get("identity_keypair");return Promise.resolve({privKey:XE.base64ToArrayBuffer(e.privKey),pubKey:XE.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 r=this.get("identity_key"+e);return void 0===r?Promise.resolve(!0):Promise.resolve(XE.arrayBufferToBase64(t)===r)},loadIdentityKey(e){if(null==e)throw new Error("Can't load identity_key for invalid identifier");return Promise.resolve(XE.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),r=this.get("identity_key"+n.getName()),i=XE.arrayBufferToBase64(t);return this.save("identity_key"+n.getName(),i),r&&i!==r?Promise.resolve(!0):Promise.resolve(!1)},getPreKeys(){return this.get("prekeys")||{}},loadPreKey(e){const t=this.getPreKeys()[e];return t?Promise.resolve({privKey:XE.base64ToArrayBuffer(t.privKey),pubKey:XE.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storePreKey(e,t){const n={};return n[e]={pubKey:XE.arrayBufferToBase64(t.pubKey),privKey:XE.arrayBufferToBase64(t.privKey)},this.save("prekeys",Object.assign(this.getPreKeys(),n)),Promise.resolve()},removePreKey(e){return this.save("prekeys",Us(this.getPreKeys(),e)),Promise.resolve()},loadSignedPreKey(e){const t=this.get("signed_prekey");return t?Promise.resolve({privKey:XE.base64ToArrayBuffer(t.privKey),pubKey:XE.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:XE.arrayBufferToBase64(e.keyPair.privKey),pubKey:XE.arrayBufferToBase64(e.keyPair.pubKey),signature:XE.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="".concat(VE.NS.OMEMO_BUNDLES,":").concat(this.get("device_id")),n=GE("item").c("bundle",{xmlns:VE.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");Object.values(this.get("prekeys")).forEach((e,t)=>n.c("preKeyPublic",{preKeyId:t}).t(e.pubKey).up());return Tc.pubsub.publish(null,t,n,{"pubsub#access_model":"open"},!1)},async generateMissingPreKeys(){const e=ho(Mh(Zx(0,xc.NUM_PREKEYS),Number.prototype.toString),Object.keys(this.getPreKeys()));if(e.length<1)return Lr.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:XE.arrayBufferToBase64(e.pubKey)})),n=xc.devicelists.get(xc.bare_jid).devices.get(this.get("device_id")),r=await n.getBundle();n.save("bundle",Object.assign(r,{prekeys:t}))},async generateBundle(){const e=await libsignal.KeyHelper.generateIdentityKeyPair(),t={},n=XE.arrayBufferToBase64(e.pubKey),r=function(){const e=xc.devicelists.get(xc.bare_jid).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=r,this.save({device_id:r,identity_keypair:{privKey:XE.arrayBufferToBase64(e.privKey),pubKey:n},identity_key:n});const i=await libsignal.KeyHelper.generateSignedPreKey(e,0);xc.omemo_store.storeSignedPreKey(i),t.signed_prekey={id:i.keyId,public_key:XE.arrayBufferToBase64(i.keyPair.privKey),signature:XE.arrayBufferToBase64(i.signature)};const s=await Promise.all(Zx(0,xc.NUM_PREKEYS).map(e=>libsignal.KeyHelper.generatePreKey(e)));s.forEach(e=>xc.omemo_store.storePreKey(e.keyId,e.keyPair));const o=xc.devicelists.get(xc.bare_jid),a=await o.devices.create({id:t.device_id,jid:xc.bare_jid},{promise:!0}),c=s.map(e=>({id:e.keyId,key:XE.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:()=>{xc.omemo_store.get("device_id")?e():this.generateBundle().then(e).catch(t)},error:(n,r)=>{Lr.warn("Could not fetch OMEMO session from cache, we'll generate a new one."),Lr.warn(r),this.generateBundle().then(e).catch(t)}})})),this._setup_promise}}),xc.Device=Vs.extend({defaults:{trusted:0,active:!0},getRandomPreKey(){const e=this.get("bundle");return e.prekeys[XE.getRandomInt(e.prekeys.length)]},async fetchBundleFromServer(){const e=WE({type:"get",from:xc.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:VE.NS.PUBSUB}).c("items",{node:"".concat(VE.NS.OMEMO_BUNDLES,":").concat(this.get("id"))});let t;try{t=await Tc.sendIQ(e)}catch(t){return Lr.error("Could not fetch bundle for device ".concat(this.get("id")," from ").concat(this.get("jid"))),Lr.error(t),null}if(t.querySelector("error"))throw new YE("Could not fetch bundle",t);const n=$E('items[node="'.concat(VE.NS.OMEMO_BUNDLES,":").concat(this.get("id"),'"]'),t).pop(),r=sA($E('bundle[xmlns="'.concat(VE.NS.OMEMO,'"]'),n).pop());return this.save("bundle",r),r},getBundle(){return this.get("bundle")?Promise.resolve(this.get("bundle"),this):this.fetchBundleFromServer()}}),xc.Devices=Fo.extend({model:xc.Device}),xc.DeviceList=Vs.extend({idAttribute:"jid",initialize(){this.devices=new xc.Devices;const e="converse.devicelist-".concat(xc.bare_jid,"-").concat(this.get("jid"));this.devices.browserStorage=xc.createStore(e),this.fetchDevices()},async onDevicesFound(e){if(0===e.length){let e;try{e=await this.fetchDevicesFromServer()}catch(e){null===e?Lr.error("Timeout error while fetching devices for ".concat(this.get("jid"))):(Lr.error("Could not fetch devices for ".concat(this.get("jid"))),Lr.error(e)),this.destroy()}this.get("jid")===xc.bare_jid&&await 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)=>{Lr.error(n),e()}})})),this._devices_promise},async getOwnDeviceId(){let e=xc.omemo_store.get("device_id");return this.devices.findWhere({id:e})||(await xc.omemo_store.generateBundle(),e=xc.omemo_store.get("device_id")),e},async publishCurrentDevice(e){if(this.get("jid")===xc.bare_jid){if(await uA(),xc.omemo_store)return e.includes(await this.getOwnDeviceId())?void 0:this.publishDevices();Lr.warn("publishCurrentDevice: omemo_store is not defined, likely a timing issue")}},async fetchDevicesFromServer(){const e=WE({type:"get",from:xc.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:VE.NS.PUBSUB}).c("items",{node:VE.NS.OMEMO_DEVICELIST});let t;try{t=await Tc.sendIQ(e)}catch(e){return Lr.error(e),[]}const n='list[xmlns="'.concat(VE.NS.OMEMO,'"] device'),r=$E(n,t).map(e=>e.getAttribute("id"));return await Promise.all(r.map(e=>this.devices.create({id:e,jid:this.get("jid")},{promise:!0}))),r},publishDevices(){const e=GE("item",{id:"current"}).c("list",{xmlns:VE.NS.OMEMO});this.devices.filter(e=>e.get("active")).forEach(t=>e.c("device",{id:t.get("id")}).up());return Tc.pubsub.publish(null,VE.NS.OMEMO_DEVICELIST,e,{"pubsub#access_model":"open"},!1)},removeOwnDevices(e){if(this.get("jid")!==xc.bare_jid)throw new Error("Cannot remove devices from someone else's device list");return e.forEach(e=>this.devices.get(e).destroy()),this.publishDevices()}}),xc.DeviceLists=Fo.extend({model:xc.DeviceList,getDeviceList(e){return this.get(e)||this.create({jid:e})}}),Tc.waitUntil("chatBoxesInitialized").then(ZE),Tc.listen.on("parseMessage",KE),Tc.listen.on("parseMUCMessage",KE),Tc.listen.on("chatBoxViewInitialized",eA),Tc.listen.on("chatRoomViewInitialized",eA),Tc.listen.on("connected",lA),Tc.listen.on("getToolbarButtons",mA),Tc.listen.on("statusInitialized",hA),Tc.listen.on("addClientFeatures",()=>Tc.disco.own.features.add("".concat(VE.NS.OMEMO_DEVICELIST,"+notify"))),Tc.listen.on("userDetailsModalInitialized",e=>{const t=e.get("jid");xc.generateFingerprints(t).catch(e=>Lr.error(e))}),Tc.listen.on("profileModalInitialized",()=>{xc.generateFingerprints(xc.bare_jid).catch(e=>Lr.error(e))}),Tc.listen.on("afterTearDown",()=>delete xc.omemo_store),Tc.listen.on("clearSession",()=>{xc.shouldClearCache()&&xc.devicelists&&(xc.devicelists.clearStore(),delete xc.devicelists)}),Object.assign(xc.api,{omemo:{bundle:{generate:async()=>{const e=xc.devicelists.get(xc.bare_jid),t=xc.omemo_store.get("device_id");if(t){const n=e.devices.get(t);xc.omemo_store.unset(t),n&&await new Promise(e=>n.destroy({success:e,error:e})),e.devices.trigger("remove")}await xc.omemo_store.generateBundle(),await e.publishDevices();const n=oA(e.devices.get(xc.omemo_store.get("device_id")));return await xc.omemo_store.publishBundle(),n}}}})}});
/**
* @module converse-push
* @description
* Converse.js plugin which add support for registering
* an "App Server" as defined in XEP-0357
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:vA,$iq:_A}=zc.env;vA.addNamespace("PUSH","urn:xmpp:push:0"),zc.plugins.add("converse-push",{initialize(){async function e(e){e=e||xc.bare_jid;const t=xc.session.get("push_enabled")||[];if(t.includes(e))return;const n=Tc.settings.get("push_app_servers").filter(e=>!e.disable),r=Tc.settings.get("push_app_servers").filter(e=>e.disable),i=n.map(t=>async function(e,t){if(!t.jid||!t.node)return;if(!await Tc.disco.getIdentity("pubsub","push",t.jid))return Lr.warn('Not enabling push the service "'.concat(t.jid,"\", it doesn't have the right disco identtiy."));const n=await Promise.all([Tc.disco.supports(vA.NS.PUSH,t.jid),Tc.disco.supports(vA.NS.PUSH,e)]);if(!n[0]&&!n[1])return void Lr.warn('Not enabling push app server "'.concat(t.jid,'", no disco support from your server.'));const r=_A({type:"set"});return e!==xc.bare_jid&&r.attrs({to:e}),r.c("enable",{xmlns:vA.NS.PUSH,jid:t.jid,node:t.node}),t.secret&&r.c("x",{xmlns:vA.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t("".concat(vA.NS.PUBSUB,"#publish-options")).up().up().c("field",{var:"secret"}).c("value").t(t.secret),Tc.sendIQ(r)}(e,t)),s=r.map(t=>async function(e,t){if(!t.jid)return;if(!await Tc.disco.supports(vA.NS.PUSH,e||xc.bare_jid))return void Lr.warn('Not disabling push app server "'.concat(t.jid,'", no disco support from your server.'));const n=_A({type:"set"});e!==xc.bare_jid&&n.attrs({to:e}),n.c("disable",{xmlns:vA.NS.PUSH,jid:t.jid}),t.node&&n.attrs({node:t.node}),Tc.sendIQ(n).catch(e=>{Lr.error("Could not disable push app server for ".concat(t.jid)),Lr.error(e)})}(e,t));try{await Promise.all(i.concat(s))}catch(e){Lr.error("Could not enable or disable push App Server"),e&&Lr.error(e)}finally{t.push(e)}xc.session.save("push_enabled",t)}function t(t){t.get("type")==xc.CHATROOMS_TYPE&&e(vA.getDomainFromJid(t.get("jid")))}Tc.settings.extend({push_app_servers:[],enable_muc_push:!1}),Tc.listen.on("statusInitialized",()=>e()),Tc.settings.get("enable_muc_push")&&Tc.listen.on("chatBoxesInitialized",()=>xc.chatboxes.on("add",t))}});var bA={showLoginOrRegisterForm(){this.registerpanel&&("register"==this.model.get("active-form")?(this.loginpanel.el.classList.add("hidden"),this.registerpanel.el.classList.remove("hidden")):(this.loginpanel.el.classList.remove("hidden"),this.registerpanel.el.classList.add("hidden")))},renderRegistrationPanel(){if(Tc.settings.get("allow_registration")){this.registerpanel=new xc.RegisterPanel({model:this.model}),this.registerpanel.render(),this.registerpanel.el.classList.add("hidden");const e=this.el.querySelector("#converse-login-panel");e&&e.insertAdjacentElement("afterend",this.registerpanel.el),this.showLoginOrRegisterForm()}return this}};function yA(){const e=xA(['\n <input\n type="button"\n class="btn btn-secondary button-cancel"\n value="','"\n />\n ']);return yA=function(){return e},e}function wA(){const e=xA(['\n <input type="submit" class="btn btn-primary" value="','" />\n ']);return wA=function(){return e},e}function SA(){const e=xA(['\n <form id="converse-register" class="converse-form">\n <legend class="col-form-label">'," ",'</legend>\n <p class="title">','</p>\n <p class="form-help instructions">','</p>\n <div class="form-errors hidden"></div>\n ','\n\n <fieldset class="buttons form-group">\n ',"\n ",'\n <div class="switch-form">\n <p>','</p>\n <p><a class="login-here toggle-register-login" href="#converse/login">',"</a></p>\n </div>\n </fieldset>\n </form>\n "]);return SA=function(){return e},e}function xA(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function EA(){const e=kA(["\n <converse-brand-logo></converse-brand-logo>\n ","\n ","\n ","\n "]);return EA=function(){return e},e}function AA(){const e=kA(['\n <form id="converse-register" class="converse-form">\n <legend class="col-form-label">','</legend>\n <div class="form-group">\n <label>','</label>\n <div class="form-errors hidden"></div>\n ',"\n </div>\n ","\n </form>\n "]);return AA=function(){return e},e}function CA(){const e=kA(['\n <fieldset class="buttons">\n <input class="btn btn-primary" type="submit" value="','" />\n <div class="switch-form">\n <p>','</p>\n <p><a class="login-here toggle-register-login" href="#converse/login">',"</a></p>\n </div>\n </fieldset>\n "]);return CA=function(){return e},e}function TA(){const e=kA(['\n <input class="form-control" required="required" type="text" name="domain" placeholder="','" />\n <p class="form-text text-muted">\n ','\n <a href="','" class="url" target="_blank" rel="noopener">',"</a>.\n </p>\n "]);return TA=function(){return e},e}function OA(){const e=kA(['\n <button class="btn btn-secondary button-cancel hor_centered">',"</button>\n "]);return OA=function(){return e},e}function jA(){const e=kA(['\n <form id="converse-register" class="converse-form no-scrolling">\n ','\n <p class="info">',"</p>\n ","\n </form>\n "]);return jA=function(){return e},e}function kA(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const NA=()=>{const e=Tc.settings.get("registration_domain"),t=Pu("Create your account"),n=Pu("Please enter the XMPP provider to register with:");return Fa(AA(),t,n,e||(()=>{const e=Tc.settings.get("domain_placeholder"),t=Pu("Tip: A list of public XMPP providers is available"),n=Pu("here"),r=Tc.settings.get("providers_link");return Fa(TA(),e,t,r,n)})(),e?"":(()=>{const e=Pu("Fetch registration form"),t=Pu("Already have a chat account?"),n=Pu("Log in here");return Fa(CA(),e,t,n)})())};var MA=e=>Fa(EA(),0===e.model.get("registration_status")?NA():"",1===e.model.get("registration_status")?(()=>{const e=Tc.settings.get("registration_domain"),t=Pu("Hold tight, we're fetching the registration form…"),n=Pu("Cancel");return Fa(jA(),Qp({classes:"hor_centered"}),t,e?"":Fa(OA(),n))})():"",2===e.model.get("registration_status")?(e=>{const t=Pu("Choose a different provider"),n=Pu("Already have a chat account?"),r=Pu("Account Registration:"),i=Pu("Log in here"),s=Pu("Register"),o=Tc.settings.get("registration_domain");return Fa(SA(),r,e.domain,e.title,e.instructions,e.form_fields,e.fields?Fa(wA(),s):"",o?"":Fa(yA(),t),n,i)})(e):"");const{Strophe:IA,sizzle:RA,$iq:DA}=zc.env,LA=zc.env.utils,zA=1,PA=2;var FA=wh.extend({tagName:"div",id:"converse-register-panel",className:"controlbox-pane fade-in",events:{"submit form#converse-register":"onFormSubmission","click .button-cancel":"renderProviderChoiceForm"},initialize(){this.reset(),Tc.listen.on("connectionInitialized",()=>this.registerHooks()),this.listenTo(this.model,"change:registration_status",this.render);const e=Tc.settings.get("registration_domain");e?this.fetchRegistrationForm(e):this.model.set("registration_status",0)},render(){return za(MA({domain:this.domain,fields:this.fields,form_fields:this.form_fields,instructions:this.instructions,model:this.model,title:this.title}),this.el),this},registerHooks(){const e=xc.connection,t=e._connect_cb.bind(e);e._connect_cb=(e,n,r)=>{this._registering?this.getRegistrationFields(e,n)&&(this._registering=!1):t(e,n,r)}},getRegistrationFields(e,t){const n=xc.connection;n.connected=!0;const r=n._proto._reqToData(e);if(!r)return;if(n._proto._connect_cb(r)===IA.Status.CONNFAIL)return this.showValidationError(Pu("Sorry, we're unable to connect to your chosen provider.")),!1;const i=r.getElementsByTagName("register"),s=r.getElementsByTagName("mechanism");if(0===i.length&&0===s.length)return n._proto._no_auth_received(t),!1;if(0===i.length)return n._changeConnectStatus(IA.Status.REGIFAIL),this.showValidationError(Pu("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=DA({type:"get"}).c("query",{xmlns:IA.NS.REGISTER}).tree();return o.setAttribute("id",n.getUniqueId("sendIQ")),n.send(o),n.connected=!1,!0},onRegistrationFields(e){return"error"===e.getAttribute("type")?(xc.connection._changeConnectStatus(IA.Status.REGIFAIL,Pu('Something went wrong while establishing a connection with "%1$s". Are you sure it exists?',this.domain)),!1):1!==e.getElementsByTagName("query").length?(xc.connection._changeConnectStatus(IA.Status.REGIFAIL,"unknown"),!1):(this.setFields(e),this.model.get("registration_status")===zA&&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,it(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",zA),this.reset({domain:IA.getDomainFromJid(e),_registering:!0}),await xc.initConnection(this.domain),null===(t=xc.connection)||void 0===t||t.connect(this.domain,"",e=>this.onConnectStatusChanged(e)),!1},giveFeedback(e,t){let n=this.el.querySelector(".reg-feedback");null!==n&&n.parentNode.removeChild(n);const r=this.el.querySelector("form");r.insertAdjacentHTML("afterbegin",'<span class="reg-feedback"></span>'),n=r.querySelector(".reg-feedback"),n.textContent=e,t&&n.classList.add(t)},showSpinner(){const e=this.el.querySelector("form");return za(Qp(),e),this},onConnectStatusChanged(e){Lr.debug("converse-register: onConnectStatusChanged"),[IA.Status.DISCONNECTED,IA.Status.CONNFAIL,IA.Status.REGIFAIL,IA.Status.NOTACCEPTABLE,IA.Status.CONFLICT].includes(e)?(Lr.error("Problem during registration: Strophe.Status is ".concat(xc.CONNECTION_STATUS[e])),this.abortRegistration()):e===IA.Status.REGISTERED&&(Lr.debug("Registered successfully."),xc.connection.reset(),this.showSpinner(),["converse/login","converse/register"].includes(xc.router.history.getFragment())&&xc.router.navigate("",{replace:!0}),this.fields.password&&this.fields.username?(xc.connection.connect(this.fields.username.toLowerCase()+"@"+this.domain.toLowerCase(),this.fields.password,xc.onConnectStatusChanged),this.giveFeedback(Pu("Now logging you in"),"info")):(xc.chatboxviews.get("controlbox").renderLoginPanel(),xc.giveFeedback(Pu("Registered successfully"))),this.reset())},getLegacyFormFields(){return[...Object.keys(this.fields).map(e=>"username"===e?lf({domain:" @".concat(this.domain),name:e,type:"text",label:e,value:"",required:!0}):Yh({label:e,name:e,placeholder:e,required:!0,type:"password"===e||"email"===e?e:"text",value:""})),...this.urls.map(e=>sf({label:"",value:e}))]},getFormFields(e){return"xform"===this.form_type?Array.from(e.querySelectorAll("field")).map(t=>cu.xForm2TemplateResult(t,e,{domain:this.domain})):this.getLegacyFormFields()},renderRegistrationForm(e){this.form_fields=this.getFormFields(e),this.model.set("registration_status",PA)},showValidationError(e){const t=this.el.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=Pu("The provider rejected your registration attempt. Please check the values you entered for correctness.");this.showValidationError(e)}},renderProviderChoiceForm(e){e&&e.preventDefault&&e.preventDefault(),xc.connection._proto._abortAllRequests(),xc.connection.reset(),this.render()},abortRegistration(){xc.connection._proto._abortAllRequests(),xc.connection.reset(),[zA,PA].includes(this.model.get("registration_status"))?Tc.settings.get("registration_domain")&&this.fetchRegistrationForm(Tc.settings.get("registration_domain")):this.render()},submitRegistrationForm(e){if(Array.from(this.el.querySelectorAll("input.required")).reduce((e,t)=>""===t.value?(t.classList.add("error"),e+1):e,0))return;const t=RA(":input:not([type=button]):not([type=submit])",e),n=DA({type:"set",id:LA.getUniqueId()}).c("query",{xmlns:IA.NS.REGISTER});if("xform"===this.form_type){n.c("x",{xmlns:IA.NS.XFORM,type:"submit"}),t.map(e=>cu.webForm2xForm(e)).filter(e=>e).forEach(e=>n.cnode(e).up())}else t.forEach(e=>n.c(e.getAttribute("name"),{},e.value));xc.connection._addSysHandler(this._onRegisterIQ.bind(this),null,"iq",null,null),xc.connection.send(n),this.setFields(n.tree())},setFields(e){const t=e.querySelector("query"),n=RA('x[xmlns="'.concat(IA.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()]=IA.getText(e):"jabber:x:oob"===e.getAttribute("xmlns")&&this.urls.concat(RA("url",e).map(e=>e.textContent)):this.instructions=IA.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,r;t?this.fields[t.toLowerCase()]=null!==(n=null===(r=e.querySelector("value"))||void 0===r?void 0:r.textContent)&&void 0!==n?n:"":Lr.warn("Found field we couldn't parse")}),this.form_type="xform"},_onRegisterIQ(e){if("error"===e.getAttribute("type")){Lr.error("Registration failed."),this.reportErrors(e);let t=e.getElementsByTagName("error");if(1!==t.length)return xc.connection._changeConnectStatus(IA.Status.REGIFAIL,"unknown"),!1;t=t[0].firstElementChild.tagName.toLowerCase(),"conflict"===t?xc.connection._changeConnectStatus(IA.Status.CONFLICT,t):"not-acceptable"===t?xc.connection._changeConnectStatus(IA.Status.NOTACCEPTABLE,t):xc.connection._changeConnectStatus(IA.Status.REGIFAIL,t)}else xc.connection._changeConnectStatus(IA.Status.REGISTERED,null);return!1}});
/**
* @module converse-register
* @description
* This is a Converse.js plugin which add support for in-band registration
* as specified in XEP-0077.
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:BA}=zc.env;BA.addNamespace("REGISTER","jabber:iq:register");const HA=Object.keys(BA.Status).reduce((e,t)=>Math.max(e,BA.Status[t]),0);BA.Status.REGIFAIL=HA+1,BA.Status.REGISTERED=HA+2,BA.Status.CONFLICT=HA+3,BA.Status.NOTACCEPTABLE=HA+5,zc.plugins.add("converse-register",{enabled:()=>!0,overrides:{ControlBoxView:{renderLoginPanel(){return this.__super__.renderLoginPanel.apply(this,arguments),this.renderRegistrationPanel(),this}}},initialize(){function e(e){Tc.waitUntil("controlBoxInitialized").then(()=>{xc.chatboxes.get("controlbox").set({"active-form":e})}).catch(e=>Lr.fatal(e))}xc.CONNECTION_STATUS[BA.Status.REGIFAIL]="REGIFAIL",xc.CONNECTION_STATUS[BA.Status.REGISTERED]="REGISTERED",xc.CONNECTION_STATUS[BA.Status.CONFLICT]="CONFLICT",xc.CONNECTION_STATUS[BA.Status.NOTACCEPTABLE]="NOTACCEPTABLE",Tc.settings.extend({allow_registration:!0,domain_placeholder:Pu(" e.g. conversejs.org"),providers_link:"https://compliance.conversations.im/",registration_domain:""}),Object.assign(xc.ControlBoxView.prototype,bA),xc.RegisterPanel=FA,xc.router.route("converse/login",()=>e("login")),xc.router.route("converse/register",()=>e("register")),Tc.listen.on("controlBoxInitialized",e=>{e.model.on("change:active-form",e.showLoginOrRegisterForm,e)})}});var qA=Vs.extend({defaults:{"toggle-state":xc.OPENED}});function UA(){const e=XA(['\n <div class="list-container list-container--openrooms ','">\n <a class="list-toggle open-rooms-toggle controlbox-padded" title="','" @click=','>\n <span class="fa ','"></span> ','</a>\n <div class="items-list rooms-list open-rooms-list ','">\n ',"\n </div>\n </div>"]);return UA=function(){return e},e}function VA(){const e=XA(['\n <div class="list-item controlbox-padded available-chatroom d-flex flex-row '," ",'"\n data-room-jid="','">\n\n ','\n\n <a class="list-item-link open-room available-room w-100"\n data-room-jid="','"\n title="','"\n @click=',">","</a>\n\n ",'\n\n <a class="list-item-action room-info fa fa-info-circle"\n data-room-jid="','"\n title="','"\n @click=','></a>\n\n <a class="list-item-action fa fa-sign-out-alt close-room"\n data-room-jid="','"\n data-room-name="','"\n title="','"\n @click=',"></a>\n </div>"]);return VA=function(){return e},e}function $A(){const e=XA(['<span class="list-item-badge badge badge--muc msgs-indicator"></span>']);return $A=function(){return e},e}function GA(){const e=XA(['<span class="list-item-badge badge badge--muc msgs-indicator">',"</span>"]);return GA=function(){return e},e}function WA(){const e=XA(['\n <a class="list-item-action fa fa-bookmark add-bookmark"\n data-room-jid="','"\n data-bookmark-name="','"\n @click=','\n title="','"></a>']);return WA=function(){return e},e}function JA(){const e=XA(['\n <a class="list-item-action fa fa-bookmark remove-bookmark button-on"\n data-room-jid="','"\n data-bookmark-name="','"\n @click=','\n title="','"></a>']);return JA=function(){return e},e}function XA(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const QA=e=>{const t=Pu("Leave this groupchat"),n=e.room.get("num_unread_general")||e.room.get("has_activity");return Fa(VA(),e.currently_open(e.room)?"open":"",n?"unread-msgs":"",e.room.get("jid"),e.room.get("num_unread")?(e=>Fa(GA(),e.room.get("num_unread")))(e):e.room.get("has_activity")?Fa($A()):"",e.room.get("jid"),Pu("Click to open this groupchat"),e.openRoom,e.room.getDisplayName(),e.allow_bookmarks?(e=>{const t=Pu("Bookmark this groupchat"),n=Pu("Unbookmark this groupchat");return e.bookmarked?Fa(JA(),e.room.get("jid"),e.room.getDisplayName(),e.removeBookmark,e.bookmarked?n:t):Fa(WA(),e.room.get("jid"),e.room.getDisplayName(),e.addBookmark,e.bookmarked?n:t)})(e):"",e.room.get("jid"),Pu("Show more information on this groupchat"),e.showRoomDetailsModal,e.room.get("jid"),e.room.getDisplayName(),t,e.closeRoom)};const{Strophe:YA}=zc.env,KA=zc.env.utils;var ZA=wh.extend({tagName:"span",initialize(){this.listenTo(this.model,"add",this.renderIfChatRoom),this.listenTo(this.model,"remove",this.renderIfChatRoom),this.listenTo(this.model,"destroy",this.renderIfChatRoom),this.listenTo(this.model,"change",this.renderIfRelevantChange);const e="converse.roomslist".concat(xc.bare_jid);this.list_model=new xc.RoomsList({id:e}),this.list_model.browserStorage=xc.createStore(e),this.list_model.fetch(),this.render(),this.insertIntoControlBox()},renderIfChatRoom(e){KA.isChatRoom(e)&&this.render()},renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general","has_activity"],n=e.changed||{};KA.isChatRoom(e)&&Object.keys(n).filter(e=>t.includes(e)).length&&this.render()},toHTML(){return(e=>{const t=Pu("Click to toggle the list of open groupchats");return Fa(UA(),e.rooms.length?"":"hidden",t,e.toggleRoomsList,e.toggle_state===e._converse.OPENED?"fa-caret-down":"fa-caret-right",Pu("Open Groupchats"),e.collapsed&&"collapsed",e.rooms.map(t=>QA(Object.assign({room:t},e))))})({_converse:xc,addBookmark:e=>this.addBookmark(e),allow_bookmarks:xc.allow_bookmarks&&xc.bookmarks,closeRoom:e=>this.closeRoom(e),collapsed:this.list_model.get("toggle-state")!==xc.OPENED,currently_open:e=>xc.isUniView()&&!e.get("hidden"),openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),rooms:this.model.filter(e=>e.get("type")===xc.CHATROOMS_TYPE),showRoomDetailsModal:e=>this.showRoomDetailsModal(e),toggleRoomsList:e=>this.toggleRoomsList(e),toggle_state:this.list_model.get("toggle-state")})},insertIntoControlBox(){const e=xc.chatboxviews.get("controlbox");if(void 0!==e&&!KA.rootContains(xc.root,this.el)){const t=e.el.querySelector(".list-container--openrooms");t&&t.parentNode.replaceChild(this.el,t)}},showRoomDetailsModal(e){const t=e.target.getAttribute("data-room-jid"),n=xc.chatboxes.get(t);e.preventDefault(),Tc.modal.show(cS,{model:n},e)},async openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),r={name:t||YA.unescapeNode(YA.getNodeFromJid(n))||n};await Tc.rooms.open(n,r,!0),Tc.chatviews.get(n).maybeFocus()},closeRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-name"),n=e.target.getAttribute("data-room-jid");confirm(Pu("Are you sure you want to leave the groupchat %1$s?",t))&&xc.chatboxviews.get(n).close()},removeBookmark(e){xc.removeBookmarkViaEvent(e)},addBookmark(e){xc.addBookmarkViaEvent(e)},toggleRoomsList(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");t.classList.contains("fa-caret-down")?KA.slideIn(this.el.querySelector(".open-rooms-list")).then(()=>{this.list_model.save({"toggle-state":xc.CLOSED}),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")}):KA.slideOut(this.el.querySelector(".open-rooms-list")).then(()=>{this.list_model.save({"toggle-state":xc.OPENED}),t.classList.remove("fa-caret-right"),t.classList.add("fa-caret-down")})}});
/**
* @description
* Converse.js plugin which shows a list of currently open
* rooms in the "Rooms Panel" of the ControlBox.
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const eC=function(){xc.rooms_list_view=new xc.RoomsListView({model:xc.chatboxes}),Tc.trigger("roomsListInitialized")};function tC(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="addContactModalLabel">',"</h5>\n ",'\n </div>\n <form class="converse-form add-xmpp-contact">\n <div class="modal-body">\n <span class="modal-alert"></span>\n <div class="form-group add-xmpp-contact__jid">\n <label class="clearfix" for="jid">',':</label>\n <div class="suggestion-box suggestion-box__jid">\n <ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>\n <input type="text" name="jid" ?required=','\n value="','"\n class="form-control suggestion-box__input"\n placeholder="','"/>\n <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>\n </div>\n </div>\n <div class="form-group add-xmpp-contact__name">\n <label class="clearfix" for="name">',':</label>\n <div class="suggestion-box suggestion-box__name">\n <ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>\n <input type="text" name="name" value="','"\n class="form-control suggestion-box__input"\n placeholder="','"/>\n <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>\n </div>\n </div>\n <div class="form-group">\n <div class="invalid-feedback">','</div>\n </div>\n <button type="submit" class="btn btn-primary">',"</button>\n </div>\n </form>\n </div>\n </div>\n "]);return tC=function(){return e},e}zc.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){Tc.promises.add("roomsListInitialized"),xc.RoomsList=qA,xc.RoomsListView=ZA,Tc.listen.on("connected",async()=>{xc.allow_bookmarks?await Tc.waitUntil("bookmarksInitialized"):await Promise.all([Tc.waitUntil("chatBoxesFetched"),Tc.waitUntil("roomsPanelRendered")]),eC()}),Tc.listen.on("reconnected",eC)}});const{Strophe:nC}=zc.env,rC=zc.env.utils,iC=Jf.extend({id:"add-contact-modal",events:{"submit form":"addContactFromForm"},initialize(){Jf.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){const e=Tc.settings.get("xhr_user_search_url")?Pu("Contact name"):Pu("Optional nickname");return(e=>{const t=Pu("name@example.org"),n=Pu("Add"),r=Pu("Please enter a valid XMPP address"),i=Pu("Add a Contact"),s=Pu("XMPP Address"),o=Pu("Nickname");return Fa(tC(),i,Zf,s,!e._converse.xhr_user_search_url,e.jid||"",t,o,e.nickname||"",o,r,n)})(Object.assign(this.model.toJSON(),{_converse:xc,label_nickname:e}))},afterRender(){"string"==typeof Tc.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(!Tc.settings.get("autocomplete_add_contact"))return;const e=this.el.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new xc.AutoComplete(e,{data:(e,t)=>"".concat(t.slice(0,t.indexOf("@")),"@").concat(e),filter:xc.FILTER_STARTSWITH,list:[...new Set(xc.roster.map(e=>nC.getDomainFromJid(e.get("jid"))))]})},initXHRAutoComplete(){if(!Tc.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.el.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new xc.AutoComplete(e,{auto_evaluate:!1,filter:xc.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",yt(()=>{t.open("GET","".concat(Tc.settings.get("xhr_user_search_url"),"q=").concat(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=Pu("Sorry, could not find a contact with that name"),void rC.addClass("d-block",e)}const n=t[0].value;if(this.validateSubmission(n)){const e=this.el.querySelector("form"),r=t[0].label;this.afterSubmission(e,n,r)}}}},validateSubmission(e){const t=this.el.querySelector(".invalid-feedback");return!e||mi(e.split("@")).length<2?(rC.addClass("is-invalid",this.el.querySelector('input[name="jid"]')),rC.addClass("d-block",t),!1):xc.roster.get(nC.getBareJidFromJid(e))?(t.textContent=Pu("This contact has already been added"),rC.addClass("d-block",t),!1):(rC.removeClass("d-block",t),!0)},afterSubmission(e,t,n){xc.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 Tc.settings.get("xhr_user_search_url")){const e=this.el.querySelector('input[name="name"]');return this.xhr.open("GET","".concat(Tc.settings.get("xhr_user_search_url"),"q=").concat(encodeURIComponent(e.value)),!0),void this.xhr.send()}this.validateSubmission(n)&&this.afterSubmission(e.target,n,t.get("name"))}});xc.AddContactModal=iC;function sC(){const e=cC(['<a class="list-item-link open-chat w-100" href="#">',"</a>"]);return sC=function(){return e},e}function oC(){const e=cC(["\n ",';\n <a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="','" href="#"></a>']);return oC=function(){return e},e}function aC(){const e=cC(['<span class="pending-contact-name" title="JID: ','">',"</span>"]);return aC=function(){return e},e}function cC(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const lC=e=>Fa(aC(),e.jid,e.display_name);function uC(){const e=fC(['<a class="open-chat w-100" href="#">',"</a>"]);return uC=function(){return e},e}function dC(){const e=fC(["\n ",'\n <a class="accept-xmpp-request list-item-action list-item-action--visible fa fa-check"\n aria-label="','" title="','" href="#"></a>\n <a class="decline-xmpp-request list-item-action list-item-action--visible fa fa-times"\n aria-label="','" title="','" href="#"></a>']);return dC=function(){return e},e}function hC(){const e=fC(['<span class="req-contact-name w-100" title="JID: ','">',"</span>"]);return hC=function(){return e},e}function fC(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const pC=e=>Fa(hC(),e.jid,e.display_name);function mC(){const e=_C(['<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="','" href="#"></a>']);return mC=function(){return e},e}function gC(){const e=_C(['<span class="msgs-indicator">',"</span>"]);return gC=function(){return e},e}function vC(){const e=_C(['\n <a class="list-item-link cbox-list-item open-chat w-100 ','" title="','" href="#">\n <canvas class="avatar" height="30" width="30"></canvas>\n <span class="','" title="','"></span>\n ','\n <span class="contact-name contact-name--'," ",'">',"</span>\n </a>\n ",""]);return vC=function(){return e},e}function _C(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const bC=zc.env.utils,yC={dnd:Pu("This contact is busy"),online:Pu("This contact is online"),offline:Pu("This contact is offline"),unavailable:Pu("This contact is unavailable"),xa:Pu("This contact is away for an extended period"),away:Pu("This contact is away")};var wC=Ag.extend({tagName:"li",className:"list-item d-flex hidden controlbox-padded",events:{"click .accept-xmpp-request":"acceptRequest","click .decline-xmpp-request":"declineRequest","click .open-chat":"openChat","click .remove-xmpp-contact":"removeContact"},async initialize(){await this.model.initialized,this.debouncedRender=yt(this.render,50),this.listenTo(this.model,"change",this.debouncedRender),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"highlight",this.highlight),this.listenTo(this.model,"remove",this.remove),this.listenTo(this.model,"vcard:change",this.debouncedRender),this.listenTo(this.model.presence,"change:show",this.debouncedRender),this.render()},render(){if(!this.mayBeShown())return bC.hideElement(this.el),this;const e=this.model.get("ask"),t=this.model.presence.get("show"),n=this.model.get("requesting"),r=this.model.get("subscription"),i=this.model.get("jid");if(["current-xmpp-contact","pending-xmpp-contact","requesting-xmpp-contact"].concat(Object.keys(yC)).forEach(e=>bC.removeClass(e,this.el)),this.el.classList.add(t),this.el.setAttribute("data-status",t),this.highlight(),xc.isUniView()){const e=xc.chatboxes.get(this.model.get("jid"));e&&(e.get("hidden")?this.el.classList.remove("open"):this.el.classList.add("open"))}if("subscribe"===e||"from"===r){const e=this.model.getDisplayName();this.el.classList.add("pending-xmpp-contact"),za((e=>{const t=Pu("Click to remove %1$s as a contact",e.display_name);return Fa(oC(),Tc.settings.get("allow_chat_pending_contacts")?Fa(sC(),lC(e)):lC(e),t)})(Object.assign(this.model.toJSON(),{display_name:e})),this.el)}else if(!0===n){const e=this.model.getDisplayName();this.el.classList.add("requesting-xmpp-contact"),za((s=Object.assign(this.model.toJSON(),{display_name:e,desc_accept:Pu("Click to accept the contact request from %1$s",e),desc_decline:Pu("Click to decline the contact request from %1$s",e),allow_chat_pending_contacts:Tc.settings.get("allow_chat_pending_contacts")}),Fa(dC(),Tc.settings.get("allow_chat_pending_contacts")?Fa(uC(),pC(s)):pC(s),s.desc_accept,s.desc_accept,s.desc_decline,s.desc_decline)),this.el)}else("both"===r||"to"===r||xc.rosterview.isSelf(i))&&(this.el.classList.add("current-xmpp-contact"),this.el.classList.remove($v(["both","to"],r)[0]),this.el.classList.add(r),this.renderRosterItem(this.model));var s;return this},highlight(){if(xc.isUniView()){const e=xc.chatboxes.get(this.model.get("jid"));e&&e.get("hidden")||!e?this.el.classList.remove("open"):this.el.classList.add("open")}},renderRosterItem(e){const t=e.presence.get("show")||"offline";let n;n="online"===t?"fa fa-circle chat-status chat-status--online":"away"===t?"fa fa-circle chat-status chat-status--away":"xa"===t?"far fa-circle chat-status chat-status-xa":"dnd"===t?"fa fa-minus-circle chat-status chat-status--busy":"fa fa-times-circle chat-status chat-status--offline";const r=e.getDisplayName();return za((e=>{const t=Pu("Click to chat with %1$s (XMPP address: %2$s)",e.display_name,e.jid),n=Pu("Click to remove %1$s as a contact",e.display_name);return Fa(vC(),e.num_unread?"unread-msgs":"",t,e.status_icon,e.desc_status,e.num_unread?Fa(gC(),e.num_unread):"",e.show,e.num_unread?"unread-msgs":"",e.display_name,Tc.settings.get("allow_contact_removal")?Fa(mC(),n):"")})(Object.assign(e.toJSON(),{show:t,display_name:r,status_icon:n,desc_status:yC[t],num_unread:e.get("num_unread")||0,classes:""})),this.el),this.renderAvatar(),this},mayBeShown(){const e=this.model.presence.get("show");return!Tc.settings.get("hide_offline_users")||"offline"!==e||("subscribe"===this.model.get("ask")||"from"===this.model.get("subscription")||!0===this.model.get("requesting"))},openChat(e){e&&e.preventDefault&&e.preventDefault(),this.model.openChat()},async removeContact(e){if(e&&e.preventDefault&&e.preventDefault(),Tc.settings.get("allow_contact_removal")&&confirm(Pu("Are you sure you want to remove this contact?")))try{await this.model.removeFromRoster(),this.remove(),this.model.collection&&this.model.destroy()}catch(e){Lr.error(e),Tc.alert("error",Pu("Error"),[Pu("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.getDisplayName())])}},async acceptRequest(e){e&&e.preventDefault&&e.preventDefault(),await xc.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()},declineRequest(e){return e&&e.preventDefault&&e.preventDefault(),!0===confirm(Pu("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}});function SC(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <a href="#" class="list-toggle group-toggle controlbox-padded" title="','">\n <span class="fa ','">\n </span> ','</a>\n <ul class="items-list roster-group-contacts ','"></ul>\n']);return SC=function(){return e},e}const xC=zc.env.utils;var EC=Jv.extend({tagName:"div",className:"roster-group hidden",events:{"click a.group-toggle":"toggle"},sortImmediatelyOnAdd:!0,ItemView:wC,listItems:"model.contacts",listSelector:".roster-group-contacts",sortEvent:"presenceChanged",initialize(){Jv.prototype.initialize.apply(this,arguments),this.model.get("name")===xc.HEADER_UNREAD&&this.listenTo(this.model.contacts,"change:num_unread",e=>!this.model.get("unread_messages")&&this.removeContact(e)),this.model.get("name")===xc.HEADER_REQUESTING_CONTACTS&&this.listenTo(this.model.contacts,"change:requesting",e=>!e.get("requesting")&&this.removeContact(e)),this.model.get("name")===xc.HEADER_PENDING_CONTACTS&&this.listenTo(this.model.contacts,"change:subscription",e=>"from"!==e.get("subscription")&&this.removeContact(e)),this.listenTo(this.model.contacts,"remove",this.onRemove),this.listenTo(xc.roster,"change:groups",this.onContactGroupChange),Tc.listen.on("rosterContactsFetchedAndProcessed",()=>this.sortAndPositionAllItems())},render(){var e;return this.el.setAttribute("data-group",this.model.get("name")),za((e={label_group:this.model.get("name"),desc_group_toggle:this.model.get("description"),toggle_state:this.model.get("state")},Fa(SC(),e.desc_group_toggle,e.toggle_state===xc.OPENED?"fa-caret-down":"fa-caret-right",e.label_group,e.toggle_state===xc.CLOSED?"collapsed":"")),this.el),this.contacts_el=this.el.querySelector(".roster-group-contacts"),this},show(){return xC.showElement(this.el),this.model.get("state")===xc.OPENED&&Object.values(this.getAll()).filter(e=>e.mayBeShown()).forEach(e=>xC.showElement(e.el)),this},collapse(){return xC.slideIn(this.contacts_el)},filterOutContacts(e=[]){let t=0;this.model.contacts.forEach(n=>{const r=this.get(n.get("id"));e.includes(n)?xC.hideElement(r.el):r.mayBeShown()&&(xC.showElement(r.el),t+=1)}),t?xC.showElement(this.el):xC.hideElement(this.el)},getFilterMatches(e,t){if(0===e.length)return[];e=e.toLowerCase();const n=this.model.contacts;if("state"===t){return[xc.HEADER_REQUESTING_CONTACTS,xc.HEADER_UNREAD].includes(this.model.get("name"))?[]:"unread_messages"===e?n.filter({num_unread:0}):"online"===e?n.filter(e=>["offline","unavailable"].includes(e.presence.get("show"))):n.filter(t=>!t.presence.get("show").includes(e))}return n.filter(t=>!t.getFilterCriteria().includes(e))},filter(e,t){null==e&&(e="state"===(t=t||xc.rosterview.filter_view.model.get("filter_type"))?xc.rosterview.filter_view.model.get("chat_state"):xc.rosterview.filter_view.model.get("filter_text")),this.filterOutContacts(this.getFilterMatches(e,t))},async toggle(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");xC.hasClass("fa-caret-down",t)?(this.model.save({state:xc.CLOSED}),await this.collapse(),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")):(t.classList.remove("fa-caret-right"),t.classList.add("fa-caret-down"),this.model.save({state:xc.OPENED}),this.filter(),xC.showElement(this.el),xC.slideOut(this.contacts_el))},onContactGroupChange(e){const t=e.get("groups").includes(this.model.get("name")),n=e.get("id"),r=!this.get(n);t&&!r?this.items.trigger("add",e):t||this.removeContact(e)},removeContact(e){this.model.contacts.remove(e,{silent:!0}),this.onRemove(e)},onRemove(e){this.remove(e.get("jid")),0===this.model.contacts.length&&this.remove()}});function AC(){const e=TC(['\n <a class="controlbox-heading__btn add-contact fa fa-user-plus"\n title="','"\n data-toggle="modal"\n data-target="#add-contact-modal"></a>']);return AC=function(){return e},e}function CC(){const e=TC(['\n <div class="d-flex controlbox-padded">\n <span class="w-100 controlbox-heading controlbox-heading--contacts">','</span>\n <a class="controlbox-heading__btn sync-contacts fa fa-sync" title="','"></a>\n ','\n </div>\n <converse-roster-filter></converse-roster-filter>\n <div class="list-container roster-contacts"></div>\n']);return CC=function(){return e},e}function TC(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const OC=zc.env.utils;var jC=Jv.extend({tagName:"div",id:"converse-roster",className:"controlbox-section",ItemView:EC,listItems:"model",listSelector:".roster-contacts",sortEvent:null,subviewIndex:"name",sortImmediatelyOnAdd:!0,events:{"click a.controlbox-heading__btn.add-contact":"showAddContactModal","click a.controlbox-heading__btn.sync-contacts":"syncContacts"},initialize(){Jv.prototype.initialize.apply(this,arguments),this.listenTo(xc.roster,"add",this.onContactAdded),this.listenTo(xc.roster,"change:groups",this.onContactAdded),this.listenTo(xc.roster,"change",this.onContactChange),this.listenTo(xc.roster,"destroy",this.update),this.listenTo(xc.roster,"remove",this.update),xc.presences.on("change:show",()=>{this.update(),this.updateFilter()}),this.listenTo(this.model,"reset",this.reset),Tc.listen.on("rosterGroupsFetched",this.sortAndPositionAllItems.bind(this)),Tc.listen.on("rosterContactsFetched",()=>{xc.roster.each(e=>this.addRosterContact(e,{silent:!0})),this.update(),this.updateFilter(),Tc.trigger("rosterContactsFetchedAndProcessed")}),this.render(),this.listenToRosterFilter()},render(){var e;return za((e={heading_contacts:Pu("Contacts"),title_add_contact:Pu("Add a contact"),title_sync_contacts:Pu("Re-sync your contacts")},Fa(CC(),e.heading_contacts,e.title_sync_contacts,Tc.settings.get("allow_contact_requests")?Fa(AC(),e.title_add_contact):"")),this.el),this.roster_el=this.el.querySelector(".roster-contacts"),this},showAddContactModal(e){Tc.modal.show(xc.AddContactModal,{model:new Vs},e)},listenToRosterFilter(){this.filter_view=this.el.querySelector("converse-roster-filter"),this.filter_view.addEventListener("update",()=>this.updateFilter())},updateFilter:yt((function(){this.filter_view=this.el.querySelector("converse-roster-filter");const e=this.filter_view.model.get("filter_type");"state"===e?this.filter(this.filter_view.model.get("chat_state"),e):this.filter(this.filter_view.model.get("filter_text"),e)}),100),update(){return OC.isVisible(this.roster_el)||OC.showElement(this.roster_el),this},filter(e,t){const n=Object.values(this.getAll());n.forEach(e=>e.model.contacts.length>0&&e.show().filter("")),e=e.toLowerCase(),"groups"===t?n.forEach(t=>{t.model.get("name").toLowerCase().includes(e)?t.model.contacts.length>0&&OC.slideOut(t.el):OC.slideIn(t.el)}):n.forEach(n=>n.filter(e,t))},async syncContacts(e){e.preventDefault(),OC.addClass("fa-spin",e.target),xc.roster.data.save("version",null),await xc.roster.fetchFromServer(),Tc.user.presence.send(),OC.removeClass("fa-spin",e.target)},reset(){return this.removeAll(),this.render().update(),this},onContactAdded(e){this.addRosterContact(e),this.update(),this.updateFilter()},onContactChange(e){this.update(),yi(e.changed,"subscription")&&("from"===e.changed.subscription?this.addContactToGroup(e,xc.HEADER_PENDING_CONTACTS):["both","to"].includes(e.get("subscription"))&&this.addExistingContact(e)),yi(e.changed,"num_unread")&&e.get("num_unread")&&this.addContactToGroup(e,xc.HEADER_UNREAD),yi(e.changed,"ask")&&"subscribe"===e.changed.ask&&this.addContactToGroup(e,xc.HEADER_PENDING_CONTACTS),yi(e.changed,"subscription")&&"true"===e.changed.requesting&&this.addContactToGroup(e,xc.HEADER_REQUESTING_CONTACTS),this.updateFilter()},getGroup(e){const t=this.get(e);return t?t.model:this.model.create({name:e})},addContactToGroup(e,t,n){this.getGroup(t).contacts.add(e,n),this.sortAndPositionAllItems()},addExistingContact(e,t){let n;Tc.settings.get("roster_groups")?(n=e.get("groups"),n=0===n.length?[xc.HEADER_UNGROUPED]:n):n=[xc.HEADER_CURRENT_CONTACTS],e.get("num_unread")&&n.push(xc.HEADER_UNREAD),n.forEach(n=>this.addContactToGroup(e,n,t))},isSelf:e=>OC.isSameBareJID(e,xc.connection.jid),addRosterContact(e,t){const n=e.get("jid");if("both"===e.get("subscription")||"to"===e.get("subscription")||this.isSelf(n))this.addExistingContact(e,t);else{if(!Tc.settings.get("allow_contact_requests"))return void Lr.debug("Not adding requesting or pending contact ".concat(n," ")+"because allow_contact_requests is false");"subscribe"===e.get("ask")||"from"===e.get("subscription")?this.addContactToGroup(e,xc.HEADER_PENDING_CONTACTS,t):!0===e.get("requesting")&&this.addContactToGroup(e,xc.HEADER_REQUESTING_CONTACTS,t)}return this}});function kC(){Tc.settings.get("authentication")!==xc.ANONYMOUS&&(xc.rosterview=new xc.RosterView({model:xc.rostergroups}),xc.rosterview.render(),Tc.trigger("rosterViewInitialized"))}function NC(e){var t,n;null===(t=xc.roster)||void 0===t||null===(n=t.findWhere({jid:e.get("jid")}))||void 0===n||n.trigger("highlight")}function MC(e){e.model.get("connected")&&Tc.settings.get("authentication")!==xc.ANONYMOUS&&Tc.waitUntil("rosterViewInitialized").then(()=>e.controlbox_pane.el.insertAdjacentElement("beforeEnd",xc.rosterview.el)).catch(e=>Lr.fatal(e))}function IC(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <form class="controlbox-padded roster-filter-form input-button-group ','"\n @submit=','>\n <div class="form-inline flex-nowrap">\n <div class="filter-by d-flex flex-nowrap">\n <span @click=',' class="fa fa-user ','" data-type="contacts" title="','"></span>\n <span @click=',' class="fa fa-users ','" data-type="groups" title="','"></span>\n <span @click=',' class="fa fa-circle ','" data-type="state" title="','"></span>\n </div>\n <div class="btn-group">\n <input .value="','"\n @keydown=','\n class="roster-filter form-control ','"\n placeholder="','"/>\n <span class="clear-input fa fa-times ','"\n @click=','>\n </span>\n </div>\n <select class="form-control state-type ','"\n @change=','>\n <option value="">',"</option>\n <option ?selected=",' value="unread_messages">',"</option>\n <option ?selected=",' value="online">',"</option>\n <option ?selected=",' value="chat">',"</option>\n <option ?selected=",' value="dnd">',"</option>\n <option ?selected=",' value="away">',"</option>\n <option ?selected=",' value="xa">',"</option>\n <option ?selected=",' value="offline">',"</option>\n </select>\n </div>\n </form>"]);return IC=function(){return e},e}"undefined"!=typeof Element&&Element.prototype;const RC=/^(\S+)\s*(.*)$/,DC=["model","collection","events"];class LC extends HTMLElement{constructor(e){super(),this.cid=Li("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),Ht(this,it(e,DC)),this.initialize.apply(this,arguments)}get events(){return null}preinitialize(){}initialize(){}render(){return S(this.beforeRender)&&this.beforeRender(),S(this.toHTML)&&za(this.toHTML(),this.el),S(this.afterRender)&&this.afterRender(),this}remove(){return this._removeElement(),this.stopListening(),this}_removeElement(){var e;this.undelegateEvents(),null===(e=this.el.parentNode)||void 0===e||e.removeChild(this.el)}delegateEvents(){if(!this.events)return this;this.undelegateEvents();for(const e in this.events){let t=this.events[e];if(S(t)||(t=this[t]),!t)continue;const n=e.match(RC);this.delegate(n[1],n[2],t.bind(this))}return this}delegate(e,t,n){const r=this.el;if(!r)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const r=this.el.querySelectorAll(t);for(let t=0,i=r.length;t<i;t++){const i=r[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=r;i=i.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.el.addEventListener(e,i,!1),this._domEvents.push({el:this.el,eventName:e,handler:i,listener:n,selector:t}),this}undelegateEvents(){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(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el){const r=this._domEvents.slice();let i=r.length;for(;i--;){const s=r[i];!(s.eventName!==e||n&&s.listener!==n||t&&s.selector!==t)&&(s.el.removeEventListener(s.eventName,s.handler,!1),this._domEvents.splice(i,1))}}return this}}Object.assign(LC.prototype,zi);const zC=Vs.extend({initialize(){this.set({filter_text:"",filter_type:"contacts",chat_state:"online"})}});class PC extends LC{constructor(...e){var t,n,r;super(...e),r="span",(n="tagName")in(t=this)?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r}initialize(){const e=new xc.RosterFilter;e.id="_converse.rosterfilter-".concat(xc.bare_jid),e.browserStorage=xc.createStore(e.id),this.model=e,this.liveFilter=yt(()=>{this.model.save({filter_text:this.querySelector(".roster-filter").value})},250),this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"change",()=>this.dispatchEvent(new CustomEvent("update",{detail:this.model.changed}))),this.listenTo(xc.roster,"add",this.render),this.listenTo(xc.roster,"destroy",this.render),this.listenTo(xc.roster,"remove",this.render),xc.presences.on("change:show",this.render,this),Tc.listen.on("rosterContactsFetchedAndProcessed",()=>this.render()),this.model.fetch(),this.render()}render(){return za((e=>{const t=Pu("Filter"),n=Pu("Filter by contact name"),r=Pu("Filter by group name"),i=Pu("Filter by status"),s=Pu("Any"),o=Pu("Unread"),a=Pu("Online"),c=Pu("Chatty"),l=Pu("Busy"),u=Pu("Away"),d=Pu("Extended Away"),h=Pu("Offline");return Fa(IC(),e.visible?"fade-in":"hidden",e.submitFilter,e.changeTypeFilter,"contacts"===e.filter_type?"selected":"",n,e.changeTypeFilter,"groups"===e.filter_type?"selected":"",r,e.changeTypeFilter,"state"===e.filter_type?"selected":"",i,e.filter_text||"",e.liveFilter,"state"===e.filter_type?"hidden":"",t,e.filter_text&&"state"!==e.filter_type?"":"hidden",e.clearFilter,"state"!==e.filter_type?"hidden":"",e.changeChatStateFilter,s,"unread_messages"===e.chat_state,o,"online"===e.chat_state,a,"chat"===e.chat_state,c,"dnd"===e.chat_state,l,"away"===e.chat_state,u,"xa"===e.chat_state,d,"offline"===e.chat_state,h)})(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)})),this),this}changeChatStateFilter(e){e&&e.preventDefault(),this.model.save({chat_state:this.querySelector(".state-type").value})}changeTypeFilter(e){e&&e.preventDefault();const t=e.target.dataset.type;"state"===t?this.model.save({filter_type:t,chat_state:this.querySelector(".state-type").value}):this.model.save({filter_type:t,filter_text:this.querySelector(".roster-filter").value})}submitFilter(e){e&&e.preventDefault(),this.liveFilter()}isActive(){return"state"===this.model.get("filter_type")||this.model.get("filter_text")}shouldBeVisible(){return xc.roster&&xc.roster.length>=5||this.isActive()}clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}Tc.elements.define("converse-roster-filter",PC),
/**
* @module converse-rosterview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
zc.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Tc.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}),Tc.promises.add("rosterViewInitialized"),xc.RosterFilter=zC,xc.RosterFilterView=PC,xc.RosterContactView=wC,xc.RosterGroupView=EC,xc.RosterView=jC,Tc.listen.on("chatBoxesInitialized",()=>{xc.chatboxes.on("destroy",e=>NC(e)),xc.chatboxes.on("change:hidden",e=>NC(e))}),Tc.listen.on("controlBoxInitialized",e=>{MC(e),e.model.on("change:connected",()=>MC(e))}),Tc.listen.on("rosterInitialized",kC),Tc.listen.on("rosterReadyAfterReconnection",kC),Tc.listen.on("afterTearDown",()=>{zc.rosterview&&(zc.rosterview.model.off().reset(),zc.rosterview.each(e=>e.removeAll().remove()),zc.rosterview.removeAll().remove(),delete zc.rosterview)})}});n(486);
/**
* @description Converse.js (A browser based XMPP chat client)
* @copyright 2020, The Converse developers
* @license Mozilla Public License (MPLv2)
*/const FC=["converse-bookmark-views","converse-chatboxviews","converse-chatview","converse-controlbox","converse-dragresize","converse-fullscreen","converse-mam-views","converse-minimize","converse-modal","converse-muc-views","converse-headlines-view","converse-notification","converse-omemo","converse-profile","converse-push","converse-register","converse-roomslist","converse-rosterview","converse-singleton"],BC=zc.initialize;zc.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(FC):e.whitelisted_plugins=FC,BC(e,t)};t.default=zc}]);
//# sourceMappingURL=converse.min.js.map