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

2161 lines
No EOL
1 MiB
Raw Blame History

This file contains invisible Unicode characters

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

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

!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={178: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:"icons",139:"locales/af-LC_MESSAGES-converse-po",140:"locales/ar-LC_MESSAGES-converse-po",141:"locales/bg-LC_MESSAGES-converse-po",142:"locales/ca-LC_MESSAGES-converse-po",143:"locales/cs-LC_MESSAGES-converse-po",144:"locales/da-LC_MESSAGES-converse-po",145:"locales/dayjs/index-d-ts",146:"locales/dayjs/types-d-ts",147:"locales/de-LC_MESSAGES-converse-po",148:"locales/eo-LC_MESSAGES-converse-po",149:"locales/es-LC_MESSAGES-converse-po",150:"locales/eu-LC_MESSAGES-converse-po",151:"locales/fi-LC_MESSAGES-converse-po",152:"locales/fr-LC_MESSAGES-converse-po",153:"locales/gl-LC_MESSAGES-converse-po",154:"locales/he-LC_MESSAGES-converse-po",155:"locales/hi-LC_MESSAGES-converse-po",156:"locales/hu-LC_MESSAGES-converse-po",157:"locales/id-LC_MESSAGES-converse-po",158:"locales/it-LC_MESSAGES-converse-po",159:"locales/ja-LC_MESSAGES-converse-po",160:"locales/lt-LC_MESSAGES-converse-po",161:"locales/mr-LC_MESSAGES-converse-po",162:"locales/nb-LC_MESSAGES-converse-po",163:"locales/nl-LC_MESSAGES-converse-po",164:"locales/nl_BE-LC_MESSAGES-converse-po",165:"locales/oc-LC_MESSAGES-converse-po",166:"locales/pl-LC_MESSAGES-converse-po",167:"locales/pt-LC_MESSAGES-converse-po",168:"locales/pt_BR-LC_MESSAGES-converse-po",169:"locales/ro-LC_MESSAGES-converse-po",170:"locales/ru-LC_MESSAGES-converse-po",171:"locales/sv-LC_MESSAGES-converse-po",172:"locales/th-LC_MESSAGES-converse-po",173:"locales/tr-LC_MESSAGES-converse-po",174:"locales/uk-LC_MESSAGES-converse-po",175:"locales/vi-LC_MESSAGES-converse-po",176:"locales/zh_CN-LC_MESSAGES-converse-po",177:"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="https://cdn.conversejs.org/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=321)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return _})),n.d(t,"c",(function(){return b})),n.d(t,"b",(function(){return y})),n.d(t,"d",(function(){return w})),n.d(t,"f",(function(){return S})),n.d(t,"e",(function(){return m.a}));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))}};class f{constructor(e,t,n){this.mechname=e,this.isClientFirst=t,this.priority=n}test(){return!0}onStart(e){this._connection=e}onChallenge(e,t){throw new Error("You should implement challenge handling!")}clientChallenge(e){if(!this.isClientFirst)throw new Error("clientChallenge should not be called if isClientFirst is false!");return this.onChallenge(e)}onFailure(){this._connection=null}onSuccess(){this._connection=null}}const 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},g=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 m=n(6);var v=n(40);function _(e,t){return new S.Builder(e,t)}function b(e){return new S.Builder("message",e)}function y(e){return new S.Builder("iq",e)}function w(e){return new S.Builder("presence",e)}const S={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<S.XHTML.tags.length;t++)if(e===S.XHTML.tags[t])return!0;return!1},validAttribute(e,t){if(void 0!==S.XHTML.attributes[e]&&S.XHTML.attributes[e].length>0)for(let n=0;n<S.XHTML.attributes[e].length;n++)if(t===S.XHTML.attributes[e][n])return!0;return!1},validCSS(e){for(let t=0;t<S.XHTML.css.length;t++)if(e===S.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){S.NS[e]=t},forEachChild(e,t,n){for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];i.nodeType!==S.ElementType.NORMAL||t&&!this.isTagEqual(i,t)||n(i)}},isTagEqual:(e,t)=>e.tagName===t,_xmlGenerator:null,xmlGenerator:()=>(S._xmlGenerator||(S._xmlGenerator=r.c()),S._xmlGenerator),xmlElement(e){if(!e)return null;const t=S.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(S.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=>S.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===S.ElementType.TEXT&&(t+=e.nodeValue);for(let n=0;n<e.childNodes.length;n++)e.childNodes[n].nodeType===S.ElementType.TEXT&&(t+=e.childNodes[n].nodeValue);return S.xmlescape(t)},copyElement(e){let t;if(e.nodeType===S.ElementType.NORMAL){t=S.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(S.copyElement(e.childNodes[n]))}else e.nodeType===S.ElementType.TEXT&&(t=S.xmlGenerator().createTextNode(e.nodeValue));return t},createHtml(e){let t;if(e.nodeType===S.ElementType.NORMAL){const n=e.nodeName.toLowerCase();if(S.XHTML.validTag(n))try{t=S.xmlElement(n);for(let r=0;r<S.XHTML.attributes[n].length;r++){const i=S.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(S.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(S.createHtml(e.childNodes[n]))}catch(e){t=S.xmlTextNode("")}else{t=S.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(S.createHtml(e.childNodes[n]))}}else if(e.nodeType===S.ElementType.FRAGMENT){t=S.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(S.createHtml(e.childNodes[n]))}else e.nodeType===S.ElementType.TEXT&&(t=S.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=S.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&&S.fatal(e.stack),e.sourceURL?S.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?S.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):S.fatal("error: "+e.message)},log(e,t){var n;e===this.LogLevel.FATAL&&(null===(n=console)||void 0===n||n.error(t))},debug(e){this.log(this.LogLevel.DEBUG,e)},info(e){this.log(this.LogLevel.INFO,e)},warn(e){this.log(this.LogLevel.WARN,e)},error(e){this.log(this.LogLevel.ERROR,e)},fatal(e){this.log(this.LogLevel.FATAL,e)},serialize(e){if(!e)return null;"function"==typeof e.tree&&(e=e.tree());const t=[...Array(e.attributes.length).keys()].map(t=>e.attributes[t].nodeName);t.sort();let n=t.reduce((t,n)=>`${t} ${n}="${S.xmlescape(e.attributes.getNamedItem(n).value)}"`,"<"+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 S.ElementType.NORMAL:n+=S.serialize(r);break;case S.ElementType.TEXT:n+=S.xmlescape(r.nodeValue);break;case S.ElementType.CDATA:n+="<![CDATA["+r.nodeValue+"]]>"}}n+="</"+e.nodeName+">"}else n+="/>";return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin(e,t){S._connectionPlugins[e]=t},Builder:class{constructor(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=S.NS.CLIENT:t||(t={xmlns:S.NS.CLIENT})),this.nodeTree=S.xmlElement(e,t),this.node=this.nodeTree}tree(){return this.nodeTree}toString(){return S.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=S.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=S.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}const r=t?n.importNode(e,!0):S.copyElement(e);return this.node.appendChild(r),this.node=r,this}t(e){const t=S.xmlTextNode(e);return this.node.appendChild(t),this}h(e){const t=S.xmlGenerator().createElement("body");t.innerHTML=e;const n=S.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&&(S.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?S.getBareJidFromJid(s):null:this.from=s,this.user=!0}};S.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||(S.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=S.getBareJidFromJid(t));const n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!S.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 S._handleError(e),e}return t},toString(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},S.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+")}"}},S.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),g(this.options.cookies),this.registerSASLMechanisms(this.options.mechanisms);for(const e in S._connectionPlugins)if(Object.prototype.hasOwnProperty.call(S._connectionPlugins,e)){const t=function(){};t.prototype=S._connectionPlugins[e],this[e]=new t,this[e].init(this)}}setProtocol(){const e=this.options.protocol||"";this.options.worker?this._proto=new S.WorkerWebsocket(this):0===this.service.indexOf("ws:")||0===this.service.indexOf("wss:")||0===e.indexOf("ws")?this._proto=new S.Websocket(this):this._proto=new S.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=S.getBareJidFromJid(this.jid),this.authcid=o||S.getNodeFromJid(this.jid),this.pass=t,this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=S.getDomainFromJid(this.jid),this._changeConnectStatus(S.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 S.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 "+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 S.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 S.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||[S.SASLAnonymous,S.SASLExternal,S.SASLOAuthBearer,S.SASLXOAuth2,S.SASLPlain,S.SASLSHA1]).forEach(e=>this.registerSASLMechanism(e))}registerSASLMechanism(e){const t=new e;this.mechanisms[t.mechname]=t}disconnect(e){if(this._changeConnectStatus(S.Status.DISCONNECTING,e),e?S.warn("Disconnect was called because: "+e):S.info("Disconnect was called"),this.connected){let e=!1;this.disconnecting=!0,this.authenticated&&(e=w({xmlns:S.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(e)}else S.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()}_changeConnectStatus(e,t,n){for(const n in S._connectionPlugins)if(Object.prototype.hasOwnProperty.call(S._connectionPlugins,n)){const r=this[n];if(r.statusChanged)try{r.statusChanged(e,t)}catch(e){S.error(`${n} plugin caused an exception changing status: ${e}`)}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){S._handleError(e),S.error("User connection callback caused an exception: "+e)}}_doDisconnect(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),S.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(S.Status.DISCONNECTED,e),this.connected=!1}_dataRecv(e,t){const n=this._proto._reqToData(e);if(null===n)return;for(this.xmlInput!==S.Connection.prototype.xmlInput&&(n.nodeName===this._proto.strip&&n.childNodes.length?this.xmlInput(n.childNodes[0]):this.xmlInput(n)),this.rawInput!==S.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(S.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(S.Status.CONNFAIL,e)):this._changeConnectStatus(S.Status.CONNFAIL,S.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(e)}S.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){S.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}})}_connect_cb(e,t,n){let r;S.debug("_connect_cb was called"),this.connected=!0;try{r=this._proto._reqToData(e)}catch(e){if(e.name!==S.ErrorCondition.BAD_FORMAT)throw e;this._changeConnectStatus(S.Status.CONNFAIL,S.ErrorCondition.BAD_FORMAT),this._doDisconnect(S.ErrorCondition.BAD_FORMAT)}if(!r)return;this.xmlInput!==S.Connection.prototype.xmlInput&&(r.nodeName===this._proto.strip&&r.childNodes.length?this.xmlInput(r.childNodes[0]):this.xmlInput(r)),this.rawInput!==S.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(S.serialize(r)));if(this._proto._connect_cb(r)===S.Status.CONNFAIL)return;let i;if(i=r.getElementsByTagNameNS?r.getElementsByTagNameNS(S.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=_("auth",{xmlns:S.NS.SASL,mechanism:this._sasl_mechanism.mechname});if(this._sasl_mechanism.isClientFirst){const e=this._sasl_mechanism.clientChallenge(this);r.t(Object(v.btoa)(e))}this.send(r.tree()),t=!0;break}return t}_sasl_challenge_cb(e){const t=Object(v.atob)(S.getText(e)),n=this._sasl_mechanism.onChallenge(this,t),r=_("response",{xmlns:S.NS.SASL});return""!==n&&r.t(Object(v.btoa)(n)),this.send(r.tree()),!0}_attemptLegacyAuth(){null===S.getNodeFromJid(this.jid)?(this._changeConnectStatus(S.Status.CONNFAIL,S.ErrorCondition.MISSING_JID_NODE),this.disconnect(S.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(S.Status.AUTHENTICATING,null),this._addSysHandler(this._onLegacyAuthIQResult.bind(this),null,null,null,"_auth_1"),this.send(y({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:S.NS.AUTH}).c("username",{}).t(S.getNodeFromJid(this.jid)).tree()))}_onLegacyAuthIQResult(e){const t=y({type:"set",id:"_auth_2"}).c("query",{xmlns:S.NS.AUTH}).c("username",{}).t(S.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return S.getResourceFromJid(this.jid)||(this.jid=S.getBareJidFromJid(this.jid)+"/strophe"),t.up().c("resource",{}).t(S.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(v.atob)(S.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)}S.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),S.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(S.Status.BINDREQUIRED,null):this.bind(),!1):(this._changeConnectStatus(S.Status.AUTHFAIL,null),!1)}bind(){if(!this.do_bind)return void S.log(S.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=S.getResourceFromJid(this.jid);e?this.send(y({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:S.NS.BIND}).c("resource",{}).t(e).tree()):this.send(y({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:S.NS.BIND}).tree())}_onResourceBindResultIQ(e){if("error"===e.getAttribute("type")){S.warn("Resource binding failed.");let t;return e.getElementsByTagName("conflict").length>0&&(t=S.ErrorCondition.CONFLICT),this._changeConnectStatus(S.Status.AUTHFAIL,t,e),!1}const t=e.getElementsByTagName("bind");if(!(t.length>0))return S.warn("Resource binding failed."),this._changeConnectStatus(S.Status.AUTHFAIL,null,e),!1;{const e=t[0].getElementsByTagName("jid");e.length>0&&(this.authenticated=!0,this.jid=S.getText(e[0]),this.do_session?this._establishSession():this._changeConnectStatus(S.Status.CONNECTED,null))}}_establishSession(){if(!this.do_session)throw new Error(`Strophe.Connection.prototype._establishSession called but apparently ${S.NS.SESSION} wasn't advertised by the server`);this._addSysHandler(this._onSessionResultIQ.bind(this),null,null,null,"_session_auth_2"),this.send(y({type:"set",id:"_session_auth_2"}).c("session",{xmlns:S.NS.SESSION}).tree())}_onSessionResultIQ(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(S.Status.CONNECTED,null);else if("error"===e.getAttribute("type"))return this.authenticated=!1,S.warn("Session creation failed."),this._changeConnectStatus(S.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(S.Status.AUTHFAIL,null,e),!1}_auth2_cb(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(S.Status.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(S.Status.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1}_addSysTimedHandler(e,t){const n=new S.TimedHandler(e,t);return n.user=!1,this.addTimeds.push(n),n}_addSysHandler(e,t,n,r,i){const s=new S.Handler(e,t,n,r,i);return s.user=!1,this.addHandlers.push(s),s}_onDisconnectTimeout(){return S.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(S.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))}},S.SASLMechanism=f,S.SASLAnonymous=class extends f{constructor(e="ANONYMOUS",t=!1,n=20){super(e,t,n)}test(e){return null===e.authcid}},S.SASLPlain=class extends f{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!==`${t}@${r}`?n:"";return s+="\0",s+=t,s+="\0",s+=i,p(s)}},S.SASLSHA1=class extends f{constructor(e="SCRAM-SHA-1",t=!0,n=60){super(e,t,n)}test(e){return null!==e.authcid}onChallenge(e,t){let n,r,i,s,o,a,c,l,u="c=biws,",d=`${e._sasl_data["client-first-message-bare"]},${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=atob(r),r+="\0\0\0";const g=p(e.pass);for(s=a=m.a.core_hmac_sha1(g,r),c=1;c<i;c++){for(o=m.a.core_hmac_sha1(g,m.a.binb2str(a)),l=0;l<5;l++)s[l]^=o[l];a=o}s=m.a.binb2str(s);const v=m.a.core_hmac_sha1(s,"Client Key"),_=m.a.str_hmac_sha1(s,"Server Key"),b=m.a.core_hmac_sha1(m.a.str_sha1(m.a.binb2str(v)),d);for(e._sasl_data["server-signature"]=m.a.b64_hmac_sha1(_,d),l=0;l<5;l++)v[l]^=b[l];return u+=",p="+btoa(m.a.binb2str(v)),u}clientChallenge(e,t){const n=t||h.hexdigest(""+1234567890*Math.random());let r="n="+p(e.authcid);return r+=",r=",r+=n,e._sasl_data.cnonce=n,e._sasl_data["client-first-message-bare"]=r,r="n,,"+r,r}},S.SASLOAuthBearer=class extends f{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+="",p(t)}},S.SASLExternal=class extends f{constructor(e="EXTERNAL",t=!0,n=10){super(e,t,n)}onChallenge(e){return e.authcid===e.authzid?"":e.authzid}},S.SASLXOAuth2=class extends f{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,p(t)}};t.g={Strophe:S,$build:_,$iq:y,$msg:b,$pres:w,SHA1:m.a,MD5:h,b64_hmac_sha1:m.a.b64_hmac_sha1,b64_sha1:m.a.b64_sha1,str_hmac_sha1:m.a.str_hmac_sha1,str_sha1:m.a.str_sha1}},function(e,t,n){"use strict";(function(e){n(152),n(65),n(491);var r=n(0);n.d(t,"e",(function(){return r.f})),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.g.$build,e.$iq=r.g.$iq,e.$msg=r.g.$msg,e.$pres=r.g.$pres,e.Strophe=r.g.Strophe;const{b64_sha1:i}=r.e}).call(this,n(16))},function(e,t,n){var r;
/*!
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
*/!function(i){var s,o,a,c,l,u,d,h,f,p,g,m,v,_,b,y,w,S,x,E="sizzle"+1*new Date,A=i.document,C=0,k=0,j=he(),T=he(),O=he(),N=he(),I=function(e,t){return e===t&&(g=!0),0},M={}.hasOwnProperty,R=[],$=R.pop,D=R.push,P=R.push,L=R.slice,z=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},F="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",B="[\\x20\\t\\r\\n\\f]",q="(?:\\\\[\\da-fA-F]{1,6}"+B+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",U="\\["+B+"*("+q+")(?:"+B+"*([*^$|!~]?=)"+B+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+q+"))|)"+B+"*\\]",H=":("+q+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+U+")*)|.*)\\)|)",V=new RegExp(B+"+","g"),W=new RegExp("^"+B+"+|((?:^|[^\\\\])(?:\\\\.)*)"+B+"+$","g"),G=new RegExp("^"+B+"*,"+B+"*"),J=new RegExp("^"+B+"*([>+~]|"+B+")"+B+"*"),Q=new RegExp(B+"|>"),Y=new RegExp(H),K=new RegExp("^"+q+"$"),X={ID:new RegExp("^#("+q+")"),CLASS:new RegExp("^\\.("+q+")"),TAG:new RegExp("^("+q+"|[*])"),ATTR:new RegExp("^"+U),PSEUDO:new RegExp("^"+H),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+B+"*(even|odd|(([+-]|)(\\d*)n|)"+B+"*(?:([+-]|)"+B+"*(\\d+)|))"+B+"*\\)|)","i"),bool:new RegExp("^(?:"+F+")$","i"),needsContext:new RegExp("^"+B+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+B+"*((?:-\\d)?\\d*)"+B+"*\\)|)(?=[^-]|$)","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}"+B+"?|\\\\([^\\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(){m()},ue=Ee((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{P.apply(R=L.call(A.childNodes),A.childNodes),R[A.childNodes.length].nodeType}catch(e){P={apply:R.length?function(e,t){D.apply(e,L.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,g=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==g&&9!==g&&11!==g)return n;if(!r&&(m(t),t=t||v,b)){if(11!==g&&(l=re.exec(e)))if(i=l[1]){if(9===g){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 P.apply(n,t.getElementsByTagName(e)),n;if((i=l[3])&&o.getElementsByClassName&&t.getElementsByClassName)return P.apply(n,t.getElementsByClassName(i)),n}if(o.qsa&&!N[e+" "]&&(!y||!y.test(e))&&(1!==g||"object"!==t.nodeName.toLowerCase())){if(f=e,p=t,1===g&&(Q.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 P.apply(n,p.querySelectorAll(f)),n}catch(t){N(e,!0)}finally{c===E&&t.removeAttribute("id")}}}return h(e.replace(W,"$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 ge(e,t){for(var n=e.split("|"),r=n.length;r--;)a.attrHandle[n[r]]=t}function me(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&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Z.test(t||n&&n.nodeName||"HTML")},m=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("[*^$]="+B+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+B+"*(?:value|"+F+")"),e.querySelectorAll("[id~="+E+"-]").length||y.push("~="),(t=v.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+B+"*name"+B+"*="+B+"*(?:''|\"\")"),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"+B+"*[*^$|!~]?="),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("!=",H)})),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},I=t?function(e,t){if(e===t)return g=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!o.sortDetached&&t.compareDocumentPosition(e)===n?e==v||e.ownerDocument==A&&x(A,e)?-1:t==v||t.ownerDocument==A&&x(A,t)?1:p?z(p,e)-z(p,t):0:4&n?-1:1)}:function(e,t){if(e===t)return g=!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?z(p,e)-z(p,t):0;if(i===s)return me(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?me(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(m(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&&m(e),x(e,t)},de.attr=function(e,t){(e.ownerDocument||e)!=v&&m(e);var n=a.attrHandle[t.toLowerCase()],r=n&&M.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(g=!o.detectDuplicates,p=!o.sortStable&&e.slice(0),e.sort(I),g){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:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(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 X.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Y.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=j[e+" "];return t||(t=new RegExp("(^|"+B+")"+e+"("+B+"|$)"))&&j(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(V," ")+" ").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,g=s!==o?"nextSibling":"previousSibling",m=t.parentNode,v=a&&t.nodeName.toLowerCase(),_=!c&&!a,b=!1;if(m){if(s){for(;g;){for(h=t;h=h[g];)if(a?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;p=g="only"===e&&!p&&"nextSibling"}return!0}if(p=[o?m.firstChild:m.lastChild],o&&_){for(b=(f=(l=(u=(d=(h=m)[E]||(h[E]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===C&&l[1])&&l[2],h=f&&m.childNodes[f];h=++f&&h&&h[g]||(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[g]||(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=z(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(W,"$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 K.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=k++;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 ke(e,t,n,r,i,s){return r&&!r[E]&&(r=ke(r)),i&&!i[E]&&(i=ke(i,s)),fe((function(s,o,a,c){var l,u,d,h=[],f=[],p=o.length,g=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,[]),m=!e||!s&&t?g:Ce(g,h,e,a,c),v=n?i||(s?e:p||r)?[]:o:m;if(n&&n(m,v,a,c),r)for(l=Ce(v,f),r(l,[],a,c),u=l.length;u--;)(d=l[u])&&(v[f[u]]=!(m[f[u]]=d));if(s){if(i||e){if(i){for(l=[],u=v.length;u--;)(d=v[u])&&l.push(m[u]=d);i(null,v=[],l,c)}for(u=v.length;u--;)(d=v[u])&&(l=i?z(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):P.apply(o,v)}))}function je(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 z(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 ke(c>1&&Ae(d),c>1&&xe(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(W,"$1"),n,c<r&&je(e.slice(c,r)),r<i&&je(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=T[e+" "];if(u)return t?0:u.slice(0);for(o=e,c=[],l=a.preFilter;o;){for(s in n&&!(r=G.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(W," ")}),o=o.slice(n.length)),a.filter)!(r=X[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):T(e,c).slice(0)},d=de.compile=function(e,t){var n,r=[],i=[],s=O[e+" "];if(!s){for(t||(t=u(e)),n=t.length;n--;)(s=je(t[n]))[E]?r.push(s):i.push(s);(s=O(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,g="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);g!==E&&null!=(u=S[g]);g++){if(r&&u){for(d=0,s||u.ownerDocument==v||(m(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+=g,n&&g!==p){for(d=0;h=t[d++];)h(_,y,s,o);if(i){if(p>0)for(;g--;)_[g]||y[g]||(y[g]=$.call(c));y=Ce(y)}P.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=X.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 P.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(I).join("")===E,o.detectDuplicates=!!g,m(),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")}))||ge("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")}))||ge("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),pe((function(e){return null==e.getAttribute("disabled")}))||ge(F,(function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}));var Te=i.Sizzle;de.noConflict=function(){return i.Sizzle===de&&(i.Sizzle=Te),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",g={};g[p]=f;var m=function(e){return e instanceof y},v=function(e,t,n){var r;if(!e)return p;if("string"==typeof e)g[e]&&(r=e),t&&(g[e]=t,r=e);else{var i=e.name;g[i]=e,r=i}return!n&&r&&(p=r),r||!n&&p},_=function(e,t){if(m(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=m,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,g=this.$M,m=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,g):h(0,g+1);case s:var _=this.$locale().weekStart||0,y=(p<_?p+7:p)-_;return h(u?m-y:m+(6-y),g);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,g=b.m(this,h);return g=(u={},u[c]=g/12,u[o]=g,u[a]=g/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?g:b.a(g)},h.daysInMonth=function(){return this.endOf(o).$D},h.$locale=function(){return g[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=m,_.unix=function(e){return _(1e3*e)},_.en=g[p],_.Ls=g,_}()},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),g=1732584193,m=-271733879,v=-1732584194,_=271733878,b=-1009589776;for(n=0;n<e.length;n+=16){for(l=g,u=m,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(g,5),i(r,m,v,_)),a(a(b,p[r]),s(r))),b=_,_=v,v=c(m,30),m=g,g=o;g=a(g,l),m=a(m,u),v=a(v,d),_=a(_,h),b=a(b,f)}return[g,m,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(494),i=n(135),s=/[&<>"']/g,o=RegExp(s.source);e.exports=function(e){return(e=i(e))&&o.test(e)?e.replace(s,r):e}},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(323)}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(92).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(92).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(16))},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){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(66)(e))},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){var r=n(142)("wks"),i=n(143),s=n(10).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,g=/&newline;?/gim,m=/((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(g," ")}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(m.lastIndex=0,m.test(n))return""}else if("style"===t){if(v.lastIndex=0,v.test(n))return"";if(_.lastIndex=0,_.test(n)&&(m.lastIndex=0,m.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,g=e.charAt(l-p);" "===g||"="===g;){if("="===g){c=f;continue e}g=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 g=!1;if(t.stripIgnoreTagBody){g=i.StripTagBody(t.stripIgnoreTagBody,s);s=g.onIgnoreTag}var m=o(e,(function(e,t,i,o,g){var m,v={sourcePosition:e,position:t,isClosing:g,isWhite:n.hasOwnProperty(i)};if(!l(m=r(i,o,v)))return m;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(m=s(i,o,v))?f(o):m}),f);return g&&(m=g.remove(m)),m},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){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},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){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";(function(e){var r=n(4),i=n(156),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(66)(e))},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){var r=n(45),i=n(333),s=n(334),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(351),i=n(354);e.exports=function(e,t){var n=i(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(37);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 g(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 m(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);g(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),m(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){g(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;g(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,m(n._dbInfo)}})).catch((function(t){throw(v(e,t)||o.resolve()).catch((function(){})),t}))}})):l.then((function(t){g(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++)m(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}},k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j=/^~~local_forage_type~([^~]+)~/,T="__lfsc__:".length,O=T+"arbf".length,N=Object.prototype.toString;function I(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=k.indexOf(e[t]),r=k.indexOf(e[t+1]),i=k.indexOf(e[t+2]),s=k.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 M(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=k[n[t]>>2],r+=k[(3&n[t])<<4|n[t+1]>>4],r+=k[(15&n[t+1])<<2|n[t+2]>>6],r+=k[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+M(r))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n="~~local_forage_type~"+e.type+"~"+M(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,T))return JSON.parse(e);var t,n=e.substring(O),r=e.substring(T,O);if("blob"===r&&j.test(n)){var i=n.match(j);t=i[1],n=n.substring(i[0].length)}var o=I(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:I,bufferToString:M};function $(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function D(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):$(e,t,(function(){e.executeSql(n,r,i,s)}),s)}),s):s(e,o)}),s)}function P(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){D(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(P.apply(i,[e,a,n,r-1]));o(t)}}))}))})).catch(o)}));return a(s,n),s}function L(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 z={_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){$(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){D(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){D(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 P.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){D(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){D(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){D(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){D(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){D(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(L(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 F(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function B(){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=F(e,this._defaultConfig),B()?(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(F(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},H=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},V={},W={},G={INDEXEDDB:C,WEBSQL:z,LOCALSTORAGE:q},J=[G.INDEXEDDB._driver,G.WEBSQL._driver,G.LOCALSTORAGE._driver],Q=["dropInstance"],Y=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Q),K={description:"",driver:J.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function X(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)&&(H(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),G)if(G.hasOwnProperty(n)){var r=G[n],i=r._driver;this[n]=i,V[i]||this.defineDriver(r)}this._defaultConfig=Z({},K),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=Y.concat("_initStorage"),c=0,l=s.length;c<l;c++){var u=s[c];if((!U(Q,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=Q.length;n<r;n++){var i=Q[n];e[i]||(e[i]=t(i))}}();var d=function(n){V[r]&&console.info("Redefining LocalForage driver: "+r),V[r]=e,W[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=V[e]?o.resolve(V[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;H(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!!W[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=Y.length;e<t;e++)X(this,Y[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ee},{3:3}]},{},[4])(4)}).call(this,n(16))},,function(e,t,n){var r=n(58),i=n(68);e.exports=function(e){return null!=e&&i(e.length)&&!r(e)}},function(e,t,n){var r=n(10),i=n(15),s=n(54),o=n(27),a=n(56),c=function(e,t,n){var l,u,d,h=e&c.F,f=e&c.G,p=e&c.S,g=e&c.P,m=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]:m&&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):g&&"function"==typeof d?s(Function.call,d):d,g&&((_.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(36),i=n(138);e.exports=n(28)?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(100),s=n(25);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",g="length",m="style",v="push",_="active",b="left",y="top",w=/\b(top|bottom|left|right)+/,S=0,x="WebkitTransition"in r[m]||"Transition".toLowerCase()in r[m],E="WebkitTransition"in r[m]?"Webkit".toLowerCase()+"TransitionEnd":"Transition".toLowerCase()+"end",A="WebkitDuration"in r[m]?"Webkit".toLowerCase()+"TransitionDuration":"Transition".toLowerCase()+"Duration",C=function(e){e.focus?e.focus():e.setActive()},k=function(e,t){e.classList.add(t)},j=function(e,t){e.classList.remove(t)},T=function(e,t){return e.classList.contains(t)},O=function(e,t){return[].slice.call(e.getElementsByClassName(t))},N=function(e,n){return"object"==typeof e?e:(n||t).querySelector(e)},I=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])&&T(e,i))return e}else if("#"===r)for(;e&&e!==t;e=e[p])if(e.id===i)return e;return!1},M=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)},$=function(e,t,n,r){M(e,t,(function i(s){n(s),R(e,t,i,r)}),r)},D=!!function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});$(e,"testPassive",null,n)}catch(e){}return t}()&&{passive:!0},P=function(t){var n=x?e.getComputedStyle(t)[A]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n},L=function(e,t){var n=0;P(e)?$(e,E,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},z=function(e,t,n){var r=new CustomEvent(e+".bs."+t);r.relatedTarget=n,this.dispatchEvent(r)},F=function(n,s,o,a){var c,l,u,d,h,f,p=s.offsetWidth,g=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=T(s,"popover"),k=N(".arrow",s),j=S.top+A/2-g/2<0,O=S[b]+E/2-p/2<0,I=S[b]+p/2+E/2>=v,M=S.top+g/2+A/2>=_,R=S.top-g<0,$=S[b]-p<0,D=S.top+g+A>=_,P=S[b]+p+E>=v;o="right"===(o=(o="bottom"===(o=(o=(o===b||"right"===o)&&$&&P?y:o)===y&&R?"bottom":o)&&D?y:o)===b&&$?"right":o)&&P?b:o,-1===s.className.indexOf(o)&&(s.className=s.className.replace(w,o)),h=k.offsetWidth,f=k.offsetHeight,o===b||"right"===o?(l=o===b?S[b]+x.x-p-(C?h:0):S[b]+x.x+E,j?(c=S.top+x.y,u=A/2-h):M?(c=S.top+x.y-g+A,u=g-A/2-h):(c=S.top+x.y-g/2+A/2,u=g/2-(C?.9*f:f/2))):o!==y&&"bottom"!==o||(c=o===y?S.top+x.y-g-(C?f:0):S.top+x.y+A,O?(l=0,d=S[b]+E/2-h):I?(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[m].top=c+"px",s[m][b]=l+"px",u&&(k[m].top=u+"px"),d&&(k[m][b]=d+"px")};s.version="2.0.27";var B=function(e){e=N(e);var t=this,n=I(e,".alert"),r=function(r){n=I(r[l],".alert"),(e=N('[data-dismiss="alert"]',n))&&n&&(e===r[l]||e.contains(r[l]))&&t.close()},i=function(){z.call(n,"closed","alert"),R(e,"click",r),n[p].removeChild(n)};this.close=function(){n&&e&&T(n,"show")&&(z.call(n,"close","alert"),j(n,"show"),n&&(T(n,"fade")?L(n,i):i()))},"Alert"in e||M(e,"click",r),e.Alert=t};o[v](["Alert",B,'[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=O(i[p],"btn"),o=i.getElementsByTagName("INPUT")[0];if(o){if("checkbox"===o.type&&(o[r]?(j(i,_),o[h](r),o.removeAttribute(r),o[r]=!1):(k(i,_),o[h](r),o[f](r,r),o[r]=!0),n||(n=!0,z.call(o,"change","button"),z.call(e,"change","button"))),"radio"===o.type&&!n&&(!o[r]||0===t.screenX&&0==t.screenY)){k(i,_),k(i,"focus"),o[f](r,r),o[r]=!0,z.call(o,"change","button"),z.call(e,"change","button"),n=!0;for(var a=0,c=s[g];a<c;a++){var u=s[a],d=u.getElementsByTagName("INPUT")[0];u!==i&&T(u,_)&&(j(u,_),d.removeAttribute(r),d[r]=!1,z.call(d,"change","button"))}}setTimeout((function(){n=!1}),50)}}},s=function(e){k(e[l][p],"focus")},o=function(e){j(e[l][p],"focus")};if(!("Button"in e)){M(e,"click",i),M(e,"keyup",(function(e){32===(e.which||e.keyCode)&&e[l]===t.activeElement&&i(e)})),M(e,"keydown",(function(e){32===(e.which||e.keyCode)&&e.preventDefault()}));for(var a=O(e,"btn"),c=0;c<a.length;c++){var u=a[c].getElementsByTagName("INPUT")[0];M(u,"focus",s),M(u,"blur",o)}}var d=O(e,"btn"),m=d[g];for(c=0;c<m;c++)!T(d[c],_)&&N("input:checked",d[c])&&k(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){z.call(e,"hide","collapse"),e.isAnimating=!0,e[m].height=e.scrollHeight+"px",j(e,"collapse"),j(e,"show"),k(e,"collapsing"),e.offsetWidth,e[m].height="0px",L(e,(function(){e.isAnimating=!1,e[f]("aria-expanded","false"),t[f]("aria-expanded","false"),j(e,"collapsing"),k(e,"collapse"),e[m].height="",z.call(e,"hidden","collapse")}))};this.toggle=function(e){e.preventDefault(),T(c,"show")?l.hide():l.show()},this.hide=function(){c.isAnimating||(d(c,e),k(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),k(r,"collapsed")),i=e,z.call(t=c,"show","collapse"),t.isAnimating=!0,k(t,"collapsing"),j(t,"collapse"),t[m].height=t.scrollHeight+"px",L(t,(function(){t.isAnimating=!1,t[f]("aria-expanded","true"),i[f]("aria-expanded","true"),j(t,"collapsing"),k(t,"collapse"),k(t,"show"),t[m].height="",z.call(t,"shown","collapse")})),j(e,"collapsed"))},"Collapse"in e||M(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&&I(e,u),e.Collapse=l};o[v](["Collapse",U,"["+a+'="collapse"]']);var H=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[g];n++)e[n].children[g]&&"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?M:R;n(t,"click",m),n(t,"keydown",b),n(t,"keyup",y),n(t,"focus",m,!0)},m=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[g]-1?l+1:l,c[l]&&C(c[l])),(c[g]&&h||!c[g]&&(d||u)||!d)&&e.open&&27===i&&(r.toggle(),s=null)},w=function(){z.call(i,"show","dropdown",s),k(o,"show"),k(i,"show"),e[f]("aria-expanded",!0),z.call(i,"shown","dropdown",s),e.open=!0,R(e,"click",_),setTimeout((function(){C(o.getElementsByTagName("INPUT")[0]||e),d()}),1)},S=function(){z.call(i,"hide","dropdown",s),j(o,"show"),j(i,"show"),e[f]("aria-expanded",!1),z.call(i,"hidden","dropdown",s),e.open=!1,d(),C(e),setTimeout((function(){M(e,"click",_)}),1)};e.open=!1,this.toggle=function(){T(i,"show")&&e.open?S():w()},"Dropdown"in e||(!1 in o&&o[f]("tabindex","0"),M(e,"click",_)),e.Dropdown=r};o[v](["Dropdown",H,"["+a+'="dropdown"]']);var V=function(n,s){var o=(n=N(n))[h]("data-target")||n[h]("href"),a=N(o),c=T(n,"modal")?n:a;if(T(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]=!!T(c,"fade"),this.content=s.content,c.isAnimating=!1;var d,v,_,y,w,E=this,A=null,I=O(r,"fixed-top").concat(O(r,"fixed-bottom")),$=function(){var n,r=e.getComputedStyle(t[i]),s=parseInt(r.paddingRight,10);if(d&&(t[i][m].paddingRight=s+v+"px",c[m].paddingRight=v+"px",I[g]))for(var o=0;o<I[g];o++)n=e.getComputedStyle(I[o]).paddingRight,I[o][m].paddingRight=parseInt(n)+v+"px"},F=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},B=function(){(_=N(".modal-backdrop"))&&null!==_&&"object"==typeof _&&(S=0,t[i].removeChild(_),_=null)},q=function(){C(c),c.isAnimating=!1,z.call(c,"shown","modal",A),M(e,"resize",E.update,D),M(c,"click",V),M(t,"keydown",H)},U=function(){c[m].display="",n&&C(n),z.call(c,"hidden","modal"),O(t,"modal show")[0]||(function(){if(t[i][m].paddingRight="",c[m].paddingRight="",I[g])for(var e=0;e<I[g];e++)I[e][m].paddingRight=""}(),j(t[i],"modal-open"),_&&T(_,"fade")?(j(_,"show"),L(_,B)):B(),R(e,"resize",E.update,D),R(c,"click",V),R(t,"keydown",H)),c.isAnimating=!1},H=function(e){c.isAnimating||E.keyboard&&27==e.which&&T(c,"show")&&E.hide()},V=function(e){if(!c.isAnimating){var t=e[l];T(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(){T(c,"show")?this.hide():this.show()},this.show=function(){T(c,"show")||c.isAnimating||(clearTimeout(w),w=setTimeout((function(){c.isAnimating=!0,z.call(c,"show","modal",A);var e,n=O(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),_&&!T(_,"show")&&(_.offsetWidth,y=P(_),k(_,"show")),setTimeout((function(){c[m].display="block",F(),$(),k(t[i],"modal-open"),k(c,"show"),c[f]("aria-hidden",!1),T(c,"fade")?L(c,q):q()}),x&&_&&y?y:1)}),1))},this.hide=function(){!c.isAnimating&&T(c,"show")&&(clearTimeout(w),w=setTimeout((function(){c.isAnimating=!0,z.call(c,"hide","modal"),_=N(".modal-backdrop"),y=_&&P(_),j(c,"show"),c[f]("aria-hidden",!0),setTimeout((function(){T(c,"fade")?L(c,U):U()}),x&&_&&y?y:2)}),2))},this.setContent=function(e){N(".modal-content",c).innerHTML=e},this.update=function(){T(c,"show")&&(F(),$())},n&&!("Modal"in n)&&M(n,"click",(function(e){if(!c.isAnimating){var t=e[l];(t=t.hasAttribute("data-target")||t.hasAttribute("href")?t:t[p])!==n||T(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",V,"["+a+'="modal"]']);var W=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"),g=n[h]("data-delay"),v=n[h]("data-container"),_='<button type="button" class="close">×</button>',b=N(r.container),w=N(v),S=I(n,".modal"),x=I(n,".fixed-top"),E=I(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]||g)||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,O=r.content||n[h]("data-content")||null;if(O||this.template){var $=null,P=0,B=this.placement,q=function(e){null!==$&&e[l]===N(".close",$)&&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,D)},H=function(){U(M),z.call(n,"shown","popover")},V=function(){U(R),A.container.removeChild($),P=null,$=null,z.call(n,"hidden","popover")};this.toggle=function(){null===$?A.show():A.hide()},this.show=function(){clearTimeout(P),P=setTimeout((function(){null===$&&(B=A.placement,function(){C=r.title||n[h]("data-title"),O=(O=r.content||n[h]("data-content"))?O.trim():null,$=t.createElement("div");var e=t.createElement("div");if(e[f]("class","arrow"),$.appendChild(e),null!==O&&null===A.template){if($[f]("role","tooltip"),null!==C){var i=t.createElement("h3");i[f]("class","popover-header"),i.innerHTML=A.dismissible?C+_:C,$.appendChild(i)}var s=t.createElement("div");s[f]("class","popover-body"),s.innerHTML=A.dismissible&&null===C?O+_:O,$.appendChild(s)}else{var o=t.createElement("div");A.template=A.template.trim(),o.innerHTML=A.template,$.innerHTML=o.firstChild.innerHTML}A.container.appendChild($),$[m].display="block",$[f]("class","popover bs-popover-"+B+" "+A[u])}(),F(n,$,B,A.container),!T($,"show")&&k($,"show"),z.call(n,"show","popover"),A[u]?L($,H):H())}),20)},this.hide=function(){clearTimeout(P),P=setTimeout((function(){$&&null!==$&&T($,"show")&&(z.call(n,"hide","popover"),j($,"show"),A[u]?L($,V):V())}),A[c])},"Popover"in n||("hover"===A.trigger?(M(n,d[0],A.show),A.dismissible||M(n,d[1],A.hide)):"click"!=A.trigger&&"focus"!=A.trigger||M(n,A.trigger,A.toggle)),n.Popover=A}};o[v](["Popover",W,"["+a+'="popover"]']);var G=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=I(e,".nav"),v=!1,y=d&&N(".dropdown-toggle",d),w=function(){v[m].height="",j(v,"collapsing"),d.isAnimating=!1},S=function(){v?c?w():setTimeout((function(){v[m].height=l+"px",v.offsetWidth,L(v,w)}),50):d.isAnimating=!1,z.call(r,"shown","tab",i)},E=function(){v&&(s[m].float=b,o[m].float=b,a=s.scrollHeight),k(o,_),z.call(r,"show","tab",i),j(s,_),z.call(i,"hidden","tab",r),v&&(l=o.scrollHeight,c=l===a,k(v,"collapsing"),v[m].height=a+"px",v.offsetHeight,s[m].float="",o[m].float=""),T(o,"fade")?setTimeout((function(){k(o,"show"),L(o,S)}),20):S()};if(d){d.isAnimating=!1;var A=function(){var e,t=O(d,_);return 1!==t[g]||T(t[0][p],"dropdown")?t[g]>1&&(e=t[t[g]-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,j(i,_),i[f]("aria-selected","false"),k(r,_),r[f]("aria-selected","true"),y&&(T(e[p],"dropdown-menu")?T(y,_)||k(y,_):T(y,_)&&j(y,_)),z.call(i,"hide","tab",r),T(s,"fade")?(j(s,"show"),L(s,E)):E()},"Tab"in e||M(e,"click",(function(e){e.preventDefault(),r=e.currentTarget,!d.isAnimating&&!T(r,_)&&u.show()})),u.height&&(v=C()[p]),e.Tab=u}};o[v](["Tab",G,"["+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=I(e,".toast"),l=function(){j(a,"showing"),k(a,"show"),z.call(a,"shown","toast"),s.autohide&&s.hide()},u=function(){k(a,"hide"),z.call(a,"hidden","toast")},d=function(){j(a,"show"),s.animation?L(a,u):u()},f=function(){clearTimeout(o),o=null,k(a,"hide"),R(e,"click",s.hide),e.Toast=null,e=null,a=null};this.show=function(){a&&(z.call(a,"show","toast"),s.animation&&k(a,"fade"),j(a,"hide"),k(a,"showing"),s.animation?L(a,l):l())},this.hide=function(e){a&&T(a,"show")&&(z.call(a,"hide","toast"),e?d():o=setTimeout(d,s[c]))},this.dispose=function(){a&&T(a,"show")&&(j(a,"show"),s.animation?L(a,f):f())},"Toast"in e||M(e,"click",s.hide),e.Toast=s};o[v](["Toast",J,'[data-dismiss="toast"]']);var Q=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),g=N(l),v=I(n,".modal"),_=I(n,".fixed-top"),w=I(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||g||_||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 O=function(){M(e,"resize",S.hide,D),z.call(n,"shown","tooltip")},$=function(){R(e,"resize",S.hide,D),S.container.removeChild(A),A=null,x=null,z.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[m][b]="0",A[m].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])}}()&&(F(n,A,E,S.container),!T(A,"show")&&k(A,"show"),z.call(n,"show","tooltip"),S[u]?L(A,O):O()))}),20)},this.hide=function(){clearTimeout(x),x=setTimeout((function(){A&&T(A,"show")&&(z.call(n,"hide","tooltip"),j(A,"show"),S[u]?L(A,$):$())}),S[c])},this.toggle=function(){A?S.hide():S.show()},"Tooltip"in n||(n[f]("data-original-title",C),n.removeAttribute("title"),M(n,d[0],S.show),M(n,d[1],S.hide)),n.Tooltip=S}};o[v](["Tooltip",Q,"["+a+'="tooltip"]']);var Y=function(e,t){for(var n=0,r=t[g];n<r;n++)new e(t[n])},K=s.initCallback=function(e){e=e||t;for(var n=0,r=o[g];n<r;n++)Y(o[n][1],e.querySelectorAll(o[n][2]))};return t[i]?K():M(t,"DOMContentLoaded",(function(){K()})),{Alert:B,Button:q,Collapse:U,Dropdown:H,Modal:V,Popover:W,Tab:G,Toast:J,Tooltip:Q}})?r.apply(t,i):r)||(e.exports=s)}).call(this,n(16))},function(e,t,n){var r,i,s;
/*!
* URI.js - Mutating URLs
*
* Version: 1.19.6
*
* 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(153),n(154),n(155)):(i=[n(153),n(154),n(155)],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.6";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 g(e){return escape(e)}function m(e){return encodeURIComponent(e).replace(/[!'()*]/g,g).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=m,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=m,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).replace(/\\/g,"/")?(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=e;-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/"));var r,i=e.indexOf("/"),o=e.lastIndexOf("@",i>-1?i:e.length-1);return o>-1&&(-1===i||o<i)?(r=e.substring(0,o).split(":"),t.username=r[0]?s.decode(r[0]):null,r.shift(),t.password=r[0]?s.decode(r.join(":")):null,e=n.substring(o+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 g=a.exec(f);if(!g)break;var m=g.index+g[0].length;p=Math.max(p,m)}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=m,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(111),i=n(25),s=n(112),o=n(67),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){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(22),i=n(449),s=n(450),o=Object.defineProperty;t.f=n(28)?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){(function(e,r){var i;
/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/(function(){var s="Expected a function",o="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],c="[object Arguments]",l="[object Array]",u="[object Boolean]",d="[object Date]",h="[object Error]",f="[object Function]",p="[object GeneratorFunction]",g="[object Map]",m="[object Number]",v="[object Object]",_="[object RegExp]",b="[object Set]",y="[object String]",w="[object Symbol]",S="[object WeakMap]",x="[object ArrayBuffer]",E="[object DataView]",A="[object Float32Array]",C="[object Float64Array]",k="[object Int8Array]",j="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",N="[object Uint16Array]",I="[object Uint32Array]",M=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,D=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,L=RegExp(D.source),z=RegExp(P.source),F=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,q=/<%=([\s\S]+?)%>/g,U=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,W=/[\\^$.*+?()[\]{}|]/g,G=RegExp(W.source),J=/^\s+/,Q=/\s/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,K=/\{\n\/\* \[wrapped with (.+)\] \*/,X=/,? & /,Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ee=/[()=,{}\[\]\/\s]/,te=/\\(\\)?/g,ne=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,re=/\w*$/,ie=/^[-+]0x[0-9a-f]+$/i,se=/^0b[01]+$/i,oe=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,ce=/^(?:0|[1-9]\d*)$/,le=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ue=/($^)/,de=/['\n\r\u2028\u2029\\]/g,he="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",fe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pe="[\\ud800-\\udfff]",ge="["+fe+"]",me="["+he+"]",ve="\\d+",_e="[\\u2700-\\u27bf]",be="[a-z\\xdf-\\xf6\\xf8-\\xff]",ye="[^\\ud800-\\udfff"+fe+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",we="\\ud83c[\\udffb-\\udfff]",Se="[^\\ud800-\\udfff]",xe="(?:\\ud83c[\\udde6-\\uddff]){2}",Ee="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ce="(?:"+be+"|"+ye+")",ke="(?:"+Ae+"|"+ye+")",je="(?:"+me+"|"+we+")"+"?",Te="[\\ufe0e\\ufe0f]?"+je+("(?:\\u200d(?:"+[Se,xe,Ee].join("|")+")[\\ufe0e\\ufe0f]?"+je+")*"),Oe="(?:"+[_e,xe,Ee].join("|")+")"+Te,Ne="(?:"+[Se+me+"?",me,xe,Ee,pe].join("|")+")",Ie=RegExp("[']","g"),Me=RegExp(me,"g"),Re=RegExp(we+"(?="+we+")|"+Ne+Te,"g"),$e=RegExp([Ae+"?"+be+"+(?:['](?:d|ll|m|re|s|t|ve))?(?="+[ge,Ae,"$"].join("|")+")",ke+"+(?:['](?:D|LL|M|RE|S|T|VE))?(?="+[ge,Ae+Ce,"$"].join("|")+")",Ae+"?"+Ce+"+(?:['](?:d|ll|m|re|s|t|ve))?",Ae+"+(?:['](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,Oe].join("|"),"g"),De=RegExp("[\\u200d\\ud800-\\udfff"+he+"\\ufe0e\\ufe0f]"),Pe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Le=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ze=-1,Fe={};Fe[A]=Fe[C]=Fe[k]=Fe[j]=Fe[T]=Fe[O]=Fe["[object Uint8ClampedArray]"]=Fe[N]=Fe[I]=!0,Fe[c]=Fe[l]=Fe[x]=Fe[u]=Fe[E]=Fe[d]=Fe[h]=Fe[f]=Fe[g]=Fe[m]=Fe[v]=Fe[_]=Fe[b]=Fe[y]=Fe[S]=!1;var Be={};Be[c]=Be[l]=Be[x]=Be[E]=Be[u]=Be[d]=Be[A]=Be[C]=Be[k]=Be[j]=Be[T]=Be[g]=Be[m]=Be[v]=Be[_]=Be[b]=Be[y]=Be[w]=Be[O]=Be["[object Uint8ClampedArray]"]=Be[N]=Be[I]=!0,Be[h]=Be[f]=Be[S]=!1;var qe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,Ve="object"==typeof e&&e&&e.Object===Object&&e,We="object"==typeof self&&self&&self.Object===Object&&self,Ge=Ve||We||Function("return this")(),Je=t&&!t.nodeType&&t,Qe=Je&&"object"==typeof r&&r&&!r.nodeType&&r,Ye=Qe&&Qe.exports===Je,Ke=Ye&&Ve.process,Xe=function(){try{var e=Qe&&Qe.require&&Qe.require("util").types;return e||Ke&&Ke.binding&&Ke.binding("util")}catch(e){}}(),Ze=Xe&&Xe.isArrayBuffer,et=Xe&&Xe.isDate,tt=Xe&&Xe.isMap,nt=Xe&&Xe.isRegExp,rt=Xe&&Xe.isSet,it=Xe&&Xe.isTypedArray;function st(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 ot(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}function at(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function ct(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function ut(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 dt(e,t){return!!(null==e?0:e.length)&&wt(e,t,0)>-1}function ht(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function ft(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 pt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function gt(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}function mt(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}function vt(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 _t=At("length");function bt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function yt(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 wt(e,t,n){return t==t?function(e,t,n){var r=n-1,i=e.length;for(;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):yt(e,xt,n)}function St(e,t,n,r){for(var i=n-1,s=e.length;++i<s;)if(r(e[i],t))return i;return-1}function xt(e){return e!=e}function Et(e,t){var n=null==e?0:e.length;return n?jt(e,t)/n:NaN}function At(e){return function(t){return null==t?void 0:t[e]}}function Ct(e){return function(t){return null==e?void 0:e[t]}}function kt(e,t,n,r,i){return i(e,(function(e,i,s){n=r?(r=!1,e):t(n,e,i,s)})),n}function jt(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}function Tt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Ot(e){return e?e.slice(0,Jt(e)+1).replace(J,""):e}function Nt(e){return function(t){return e(t)}}function It(e,t){return ft(t,(function(t){return e[t]}))}function Mt(e,t){return e.has(t)}function Rt(e,t){for(var n=-1,r=e.length;++n<r&&wt(t,e[n],0)>-1;);return n}function $t(e,t){for(var n=e.length;n--&&wt(t,e[n],0)>-1;);return n}function Dt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Pt=Ct({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Lt=Ct({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function zt(e){return"\\"+qe[e]}function Ft(e){return De.test(e)}function Bt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function qt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,r=e.length,i=0,s=[];++n<r;){var a=e[n];a!==t&&a!==o||(e[n]=o,s[i++]=n)}return s}function Ht(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function Vt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function Wt(e){return Ft(e)?function(e){var t=Re.lastIndex=0;for(;Re.test(e);)++t;return t}(e):_t(e)}function Gt(e){return Ft(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.split("")}(e)}function Jt(e){for(var t=e.length;t--&&Q.test(e.charAt(t)););return t}var Qt=Ct({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Yt=function e(t){var n,r=(t=null==t?Ge:Yt.defaults(Ge.Object(),t,Yt.pick(Ge,Le))).Array,i=t.Date,Q=t.Error,he=t.Function,fe=t.Math,pe=t.Object,ge=t.RegExp,me=t.String,ve=t.TypeError,_e=r.prototype,be=he.prototype,ye=pe.prototype,we=t["__core-js_shared__"],Se=be.toString,xe=ye.hasOwnProperty,Ee=0,Ae=(n=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ce=ye.toString,ke=Se.call(pe),je=Ge._,Te=ge("^"+Se.call(xe).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=Ye?t.Buffer:void 0,Ne=t.Symbol,Re=t.Uint8Array,De=Oe?Oe.allocUnsafe:void 0,qe=qt(pe.getPrototypeOf,pe),Ve=pe.create,We=ye.propertyIsEnumerable,Je=_e.splice,Qe=Ne?Ne.isConcatSpreadable:void 0,Ke=Ne?Ne.iterator:void 0,Xe=Ne?Ne.toStringTag:void 0,_t=function(){try{var e=es(pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ct=t.clearTimeout!==Ge.clearTimeout&&t.clearTimeout,Kt=i&&i.now!==Ge.Date.now&&i.now,Xt=t.setTimeout!==Ge.setTimeout&&t.setTimeout,Zt=fe.ceil,en=fe.floor,tn=pe.getOwnPropertySymbols,nn=Oe?Oe.isBuffer:void 0,rn=t.isFinite,sn=_e.join,on=qt(pe.keys,pe),an=fe.max,cn=fe.min,ln=i.now,un=t.parseInt,dn=fe.random,hn=_e.reverse,fn=es(t,"DataView"),pn=es(t,"Map"),gn=es(t,"Promise"),mn=es(t,"Set"),vn=es(t,"WeakMap"),_n=es(pe,"create"),bn=vn&&new vn,yn={},wn=ks(fn),Sn=ks(pn),xn=ks(gn),En=ks(mn),An=ks(vn),Cn=Ne?Ne.prototype:void 0,kn=Cn?Cn.valueOf:void 0,jn=Cn?Cn.toString:void 0;function Tn(e){if(Vo(e)&&!Ro(e)&&!(e instanceof Mn)){if(e instanceof In)return e;if(xe.call(e,"__wrapped__"))return js(e)}return new In(e)}var On=function(){function e(){}return function(t){if(!Ho(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Nn(){}function In(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Mn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Rn(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])}}function $n(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])}}function Dn(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])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Dn;++t<n;)this.add(e[t])}function Ln(e){var t=this.__data__=new $n(e);this.size=t.size}function zn(e,t){var n=Ro(e),r=!n&&Mo(e),i=!n&&!r&&Lo(e),s=!n&&!r&&!i&&Zo(e),o=n||r||i||s,a=o?Tt(e.length,me):[],c=a.length;for(var l in e)!t&&!xe.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||as(l,c))||a.push(l);return a}function Fn(e){var t=e.length;return t?e[Pr(0,t-1)]:void 0}function Bn(e,t){return Es(_i(e),Yn(t,0,e.length))}function qn(e){return Es(_i(e))}function Un(e,t,n){(void 0!==n&&!Oo(e[t],n)||void 0===n&&!(t in e))&&Jn(e,t,n)}function Hn(e,t,n){var r=e[t];xe.call(e,t)&&Oo(r,n)&&(void 0!==n||t in e)||Jn(e,t,n)}function Vn(e,t){for(var n=e.length;n--;)if(Oo(e[n][0],t))return n;return-1}function Wn(e,t,n,r){return tr(e,(function(e,i,s){t(r,e,n(e),s)})),r}function Gn(e,t){return e&&bi(t,wa(t),e)}function Jn(e,t,n){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Qn(e,t){for(var n=-1,i=t.length,s=r(i),o=null==e;++n<i;)s[n]=o?void 0:ma(e,t[n]);return s}function Yn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Kn(e,t,n,r,i,s){var o,a=1&t,l=2&t,h=4&t;if(n&&(o=i?n(e,r,i,s):n(e)),void 0!==o)return o;if(!Ho(e))return e;var S=Ro(e);if(S){if(o=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&xe.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!a)return _i(e,o)}else{var M=rs(e),R=M==f||M==p;if(Lo(e))return hi(e,a);if(M==v||M==c||R&&!i){if(o=l||R?{}:ss(e),!a)return l?function(e,t){return bi(e,ns(e),t)}(e,function(e,t){return e&&bi(t,Sa(t),e)}(o,e)):function(e,t){return bi(e,ts(e),t)}(e,Gn(o,e))}else{if(!Be[M])return i?e:{};o=function(e,t,n){var r=e.constructor;switch(t){case x:return fi(e);case u:case d:return new r(+e);case E:return function(e,t){var n=t?fi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case A:case C:case k:case j:case T:case O:case"[object Uint8ClampedArray]":case N:case I:return pi(e,n);case g:return new r;case m:case y:return new r(e);case _:return function(e){var t=new e.constructor(e.source,re.exec(e));return t.lastIndex=e.lastIndex,t}(e);case b:return new r;case w:return i=e,kn?pe(kn.call(i)):{}}var i}(e,M,a)}}s||(s=new Ln);var $=s.get(e);if($)return $;s.set(e,o),Yo(e)?e.forEach((function(r){o.add(Kn(r,t,n,r,e,s))})):Wo(e)&&e.forEach((function(r,i){o.set(i,Kn(r,t,n,i,e,s))}));var D=S?void 0:(h?l?Gi:Wi:l?Sa:wa)(e);return at(D||e,(function(r,i){D&&(r=e[i=r]),Hn(o,i,Kn(r,t,n,i,e,s))})),o}function Xn(e,t,n){var r=n.length;if(null==e)return!r;for(e=pe(e);r--;){var i=n[r],s=t[i],o=e[i];if(void 0===o&&!(i in e)||!s(o))return!1}return!0}function Zn(e,t,n){if("function"!=typeof e)throw new ve(s);return ys((function(){e.apply(void 0,n)}),t)}function er(e,t,n,r){var i=-1,s=dt,o=!0,a=e.length,c=[],l=t.length;if(!a)return c;n&&(t=ft(t,Nt(n))),r?(s=ht,o=!1):t.length>=200&&(s=Mt,o=!1,t=new Pn(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}Tn.templateSettings={escape:F,evaluate:B,interpolate:q,variable:"",imports:{_:Tn}},Tn.prototype=Nn.prototype,Tn.prototype.constructor=Tn,In.prototype=On(Nn.prototype),In.prototype.constructor=In,Mn.prototype=On(Nn.prototype),Mn.prototype.constructor=Mn,Rn.prototype.clear=function(){this.__data__=_n?_n(null):{},this.size=0},Rn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Rn.prototype.get=function(e){var t=this.__data__;if(_n){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return xe.call(t,e)?t[e]:void 0},Rn.prototype.has=function(e){var t=this.__data__;return _n?void 0!==t[e]:xe.call(t,e)},Rn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=_n&&void 0===t?"__lodash_hash_undefined__":t,this},$n.prototype.clear=function(){this.__data__=[],this.size=0},$n.prototype.delete=function(e){var t=this.__data__,n=Vn(t,e);return!(n<0)&&(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,!0)},$n.prototype.get=function(e){var t=this.__data__,n=Vn(t,e);return n<0?void 0:t[n][1]},$n.prototype.has=function(e){return Vn(this.__data__,e)>-1},$n.prototype.set=function(e,t){var n=this.__data__,r=Vn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Dn.prototype.clear=function(){this.size=0,this.__data__={hash:new Rn,map:new(pn||$n),string:new Rn}},Dn.prototype.delete=function(e){var t=Xi(this,e).delete(e);return this.size-=t?1:0,t},Dn.prototype.get=function(e){return Xi(this,e).get(e)},Dn.prototype.has=function(e){return Xi(this,e).has(e)},Dn.prototype.set=function(e,t){var n=Xi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Pn.prototype.add=Pn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Pn.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.clear=function(){this.__data__=new $n,this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ln.prototype.get=function(e){return this.__data__.get(e)},Ln.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!pn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Dn(r)}return n.set(e,t),this.size=n.size,this};var tr=Si(lr),nr=Si(ur,!0);function rr(e,t){var n=!0;return tr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function ir(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&&!Xo(o):n(o,a)))var a=o,c=s}return c}function sr(e,t){var n=[];return tr(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function or(e,t,n,r,i){var s=-1,o=e.length;for(n||(n=os),i||(i=[]);++s<o;){var a=e[s];t>0&&n(a)?t>1?or(a,t-1,n,r,i):pt(i,a):r||(i[i.length]=a)}return i}var ar=xi(),cr=xi(!0);function lr(e,t){return e&&ar(e,t,wa)}function ur(e,t){return e&&cr(e,t,wa)}function dr(e,t){return ut(t,(function(t){return Bo(e[t])}))}function hr(e,t){for(var n=0,r=(t=ci(t,e)).length;null!=e&&n<r;)e=e[Cs(t[n++])];return n&&n==r?e:void 0}function fr(e,t,n){var r=t(e);return Ro(e)?r:pt(r,n(e))}function pr(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Xe&&Xe in pe(e)?function(e){var t=xe.call(e,Xe),n=e[Xe];try{e[Xe]=void 0;var r=!0}catch(e){}var i=Ce.call(e);r&&(t?e[Xe]=n:delete e[Xe]);return i}(e):function(e){return Ce.call(e)}(e)}function gr(e,t){return e>t}function mr(e,t){return null!=e&&xe.call(e,t)}function vr(e,t){return null!=e&&t in pe(e)}function _r(e,t,n){for(var i=n?ht:dt,s=e[0].length,o=e.length,a=o,c=r(o),l=1/0,u=[];a--;){var d=e[a];a&&t&&(d=ft(d,Nt(t))),l=cn(d.length,l),c[a]=!n&&(t||s>=120&&d.length>=120)?new Pn(a&&d):void 0}d=e[0];var h=-1,f=c[0];e:for(;++h<s&&u.length<l;){var p=d[h],g=t?t(p):p;if(p=n||0!==p?p:0,!(f?Mt(f,g):i(u,g,n))){for(a=o;--a;){var m=c[a];if(!(m?Mt(m,g):i(e[a],g,n)))continue e}f&&f.push(g),u.push(p)}}return u}function br(e,t,n){var r=null==(e=ms(e,t=ci(t,e)))?e:e[Cs(zs(t))];return null==r?void 0:st(r,e,n)}function yr(e){return Vo(e)&&pr(e)==c}function wr(e,t,n,r,i){return e===t||(null==e||null==t||!Vo(e)&&!Vo(t)?e!=e&&t!=t:function(e,t,n,r,i,s){var o=Ro(e),a=Ro(t),f=o?l:rs(e),p=a?l:rs(t),S=(f=f==c?v:f)==v,A=(p=p==c?v:p)==v,C=f==p;if(C&&Lo(e)){if(!Lo(t))return!1;o=!0,S=!1}if(C&&!S)return s||(s=new Ln),o||Zo(e)?Hi(e,t,n,r,i,s):function(e,t,n,r,i,s,o){switch(n){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!s(new Re(e),new Re(t)));case u:case d:case m:return Oo(+e,+t);case h:return e.name==t.name&&e.message==t.message;case _:case y:return e==t+"";case g:var a=Bt;case b:var c=1&r;if(a||(a=Ht),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var f=Hi(a(e),a(t),r,i,s,o);return o.delete(e),f;case w:if(kn)return kn.call(e)==kn.call(t)}return!1}(e,t,f,n,r,i,s);if(!(1&n)){var k=S&&xe.call(e,"__wrapped__"),j=A&&xe.call(t,"__wrapped__");if(k||j){var T=k?e.value():e,O=j?t.value():t;return s||(s=new Ln),i(T,O,n,r,s)}}if(!C)return!1;return s||(s=new Ln),function(e,t,n,r,i,s){var o=1&n,a=Wi(e),c=a.length,l=Wi(t).length;if(c!=l&&!o)return!1;var u=c;for(;u--;){var d=a[u];if(!(o?d in t:xe.call(t,d)))return!1}var h=s.get(e),f=s.get(t);if(h&&f)return h==t&&f==e;var p=!0;s.set(e,t),s.set(t,e);var g=o;for(;++u<c;){d=a[u];var m=e[d],v=t[d];if(r)var _=o?r(v,m,d,t,e,s):r(m,v,d,e,t,s);if(!(void 0===_?m===v||i(m,v,n,r,s):_)){p=!1;break}g||(g="constructor"==d)}if(p&&!g){var b=e.constructor,y=t.constructor;b==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,n,r,i,s)}(e,t,n,r,wr,i))}function Sr(e,t,n,r){var i=n.length,s=i,o=!r;if(null==e)return!s;for(e=pe(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 Ln;if(r)var h=r(l,u,c,e,t,d);if(!(void 0===h?wr(u,l,3,r,d):h))return!1}}return!0}function xr(e){return!(!Ho(e)||(t=e,Ae&&Ae in t))&&(Bo(e)?Te:oe).test(ks(e));var t}function Er(e){return"function"==typeof e?e:null==e?Ga:"object"==typeof e?Ro(e)?Or(e[0],e[1]):Tr(e):nc(e)}function Ar(e){if(!hs(e))return on(e);var t=[];for(var n in pe(e))xe.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Cr(e){if(!Ho(e))return function(e){var t=[];if(null!=e)for(var n in pe(e))t.push(n);return t}(e);var t=hs(e),n=[];for(var r in e)("constructor"!=r||!t&&xe.call(e,r))&&n.push(r);return n}function kr(e,t){return e<t}function jr(e,t){var n=-1,i=Do(e)?r(e.length):[];return tr(e,(function(e,r,s){i[++n]=t(e,r,s)})),i}function Tr(e){var t=Zi(e);return 1==t.length&&t[0][2]?ps(t[0][0],t[0][1]):function(n){return n===e||Sr(n,e,t)}}function Or(e,t){return ls(e)&&fs(t)?ps(Cs(e),t):function(n){var r=ma(n,e);return void 0===r&&r===t?va(n,e):wr(t,r,3)}}function Nr(e,t,n,r,i){e!==t&&ar(t,(function(s,o){if(i||(i=new Ln),Ho(s))!function(e,t,n,r,i,s,o){var a=_s(e,n),c=_s(t,n),l=o.get(c);if(l)return void Un(e,n,l);var u=s?s(a,c,n+"",e,t,o):void 0,d=void 0===u;if(d){var h=Ro(c),f=!h&&Lo(c),p=!h&&!f&&Zo(c);u=c,h||f||p?Ro(a)?u=a:Po(a)?u=_i(a):f?(d=!1,u=hi(c,!0)):p?(d=!1,u=pi(c,!0)):u=[]:Jo(c)||Mo(c)?(u=a,Mo(a)?u=aa(a):Ho(a)&&!Bo(a)||(u=ss(c))):d=!1}d&&(o.set(c,u),i(u,c,r,s,o),o.delete(c));Un(e,n,u)}(e,t,o,n,Nr,r,i);else{var a=r?r(_s(e,o),s,o+"",e,t,i):void 0;void 0===a&&(a=s),Un(e,o,a)}}),Sa)}function Ir(e,t){var n=e.length;if(n)return as(t+=t<0?n:0,n)?e[t]:void 0}function Mr(e,t,n){t=t.length?ft(t,(function(e){return Ro(e)?function(t){return hr(t,1===e.length?e[0]:e)}:e})):[Ga];var r=-1;return t=ft(t,Nt(Ki())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(jr(e,(function(e,n,i){return{criteria:ft(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){var r=-1,i=e.criteria,s=t.criteria,o=i.length,a=n.length;for(;++r<o;){var c=gi(i[r],s[r]);if(c){if(r>=a)return c;var l=n[r];return c*("desc"==l?-1:1)}}return e.index-t.index}(e,t,n)}))}function Rr(e,t,n){for(var r=-1,i=t.length,s={};++r<i;){var o=t[r],a=hr(e,o);n(a,o)&&qr(s,ci(o,e),a)}return s}function $r(e,t,n,r){var i=r?St:wt,s=-1,o=t.length,a=e;for(e===t&&(t=_i(t)),n&&(a=ft(e,Nt(n)));++s<o;)for(var c=0,l=t[s],u=n?n(l):l;(c=i(a,u,c,r))>-1;)a!==e&&Je.call(a,c,1),Je.call(e,c,1);return e}function Dr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==s){var s=i;as(i)?Je.call(e,i,1):ei(e,i)}}return e}function Pr(e,t){return e+en(dn()*(t-e+1))}function Lr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=en(t/2))&&(e+=e)}while(t);return n}function zr(e,t){return ws(gs(e,t,Ga),e+"")}function Fr(e){return Fn(Oa(e))}function Br(e,t){var n=Oa(e);return Es(n,Yn(t,0,n.length))}function qr(e,t,n,r){if(!Ho(e))return e;for(var i=-1,s=(t=ci(t,e)).length,o=s-1,a=e;null!=a&&++i<s;){var c=Cs(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=Ho(u)?u:as(t[i+1])?[]:{})}Hn(a,c,l),a=a[c]}return e}var Ur=bn?function(e,t){return bn.set(e,t),e}:Ga,Hr=_t?function(e,t){return _t(e,"toString",{configurable:!0,enumerable:!1,value:Ha(t),writable:!0})}:Ga;function Vr(e){return Es(Oa(e))}function Wr(e,t,n){var i=-1,s=e.length;t<0&&(t=-t>s?0:s+t),(n=n>s?s:n)<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var o=r(s);++i<s;)o[i]=e[i+t];return o}function Gr(e,t){var n;return tr(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function Jr(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var s=r+i>>>1,o=e[s];null!==o&&!Xo(o)&&(n?o<=t:o<t)?r=s+1:i=s}return i}return Qr(e,t,Ga,n)}function Qr(e,t,n,r){var i=0,s=null==e?0:e.length;if(0===s)return 0;for(var o=(t=n(t))!=t,a=null===t,c=Xo(t),l=void 0===t;i<s;){var u=en((i+s)/2),d=n(e[u]),h=void 0!==d,f=null===d,p=d==d,g=Xo(d);if(o)var m=r||p;else m=l?p&&(r||h):a?p&&h&&(r||!f):c?p&&h&&!f&&(r||!g):!f&&!g&&(r?d<=t:d<t);m?i=u+1:s=u}return cn(s,4294967294)}function Yr(e,t){for(var n=-1,r=e.length,i=0,s=[];++n<r;){var o=e[n],a=t?t(o):o;if(!n||!Oo(a,c)){var c=a;s[i++]=0===o?0:o}}return s}function Kr(e){return"number"==typeof e?e:Xo(e)?NaN:+e}function Xr(e){if("string"==typeof e)return e;if(Ro(e))return ft(e,Xr)+"";if(Xo(e))return jn?jn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zr(e,t,n){var r=-1,i=dt,s=e.length,o=!0,a=[],c=a;if(n)o=!1,i=ht;else if(s>=200){var l=t?null:Li(e);if(l)return Ht(l);o=!1,i=Mt,c=new Pn}else c=t?[]:a;e:for(;++r<s;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,o&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;t&&c.push(d),a.push(u)}else i(c,d,n)||(c!==a&&c.push(d),a.push(u))}return a}function ei(e,t){return null==(e=ms(e,t=ci(t,e)))||delete e[Cs(zs(t))]}function ti(e,t,n,r){return qr(e,t,n(hr(e,t)),r)}function ni(e,t,n,r){for(var i=e.length,s=r?i:-1;(r?s--:++s<i)&&t(e[s],s,e););return n?Wr(e,r?0:s,r?s+1:i):Wr(e,r?s+1:0,r?i:s)}function ri(e,t){var n=e;return n instanceof Mn&&(n=n.value()),gt(t,(function(e,t){return t.func.apply(t.thisArg,pt([e],t.args))}),n)}function ii(e,t,n){var i=e.length;if(i<2)return i?Zr(e[0]):[];for(var s=-1,o=r(i);++s<i;)for(var a=e[s],c=-1;++c<i;)c!=s&&(o[s]=er(o[s]||a,e[c],t,n));return Zr(or(o,1),t,n)}function si(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}function oi(e){return Po(e)?e:[]}function ai(e){return"function"==typeof e?e:Ga}function ci(e,t){return Ro(e)?e:ls(e,t)?[e]:As(ca(e))}var li=zr;function ui(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:Wr(e,t,n)}var di=Ct||function(e){return Ge.clearTimeout(e)};function hi(e,t){if(t)return e.slice();var n=e.length,r=De?De(n):new e.constructor(n);return e.copy(r),r}function fi(e){var t=new e.constructor(e.byteLength);return new Re(t).set(new Re(e)),t}function pi(e,t){var n=t?fi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function gi(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,s=Xo(e),o=void 0!==t,a=null===t,c=t==t,l=Xo(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}function mi(e,t,n,i){for(var s=-1,o=e.length,a=n.length,c=-1,l=t.length,u=an(o-a,0),d=r(l+u),h=!i;++c<l;)d[c]=t[c];for(;++s<a;)(h||s<o)&&(d[n[s]]=e[s]);for(;u--;)d[c++]=e[s++];return d}function vi(e,t,n,i){for(var s=-1,o=e.length,a=-1,c=n.length,l=-1,u=t.length,d=an(o-c,0),h=r(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+n[a]]=e[s++]);return h}function _i(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function bi(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?Jn(n,a,c):Hn(n,a,c)}return n}function yi(e,t){return function(n,r){var i=Ro(n)?ot:Wn,s=t?t():{};return i(n,e,Ki(r,2),s)}}function wi(e){return zr((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&&cs(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),t=pe(t);++r<i;){var a=n[r];a&&e(t,a,r,s)}return t}))}function Si(e,t){return function(n,r){if(null==n)return n;if(!Do(n))return e(n,r);for(var i=n.length,s=t?i:-1,o=pe(n);(t?s--:++s<i)&&!1!==r(o[s],s,o););return n}}function xi(e){return function(t,n,r){for(var i=-1,s=pe(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 Ei(e){return function(t){var n=Ft(t=ca(t))?Gt(t):void 0,r=n?n[0]:t.charAt(0),i=n?ui(n,1).join(""):t.slice(1);return r[e]()+i}}function Ai(e){return function(t){return gt(Ba(Ma(t).replace(Ie,"")),e,"")}}function Ci(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=On(e.prototype),r=e.apply(n,t);return Ho(r)?r:n}}function ki(e){return function(t,n,r){var i=pe(t);if(!Do(t)){var s=Ki(n,3);t=wa(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}}function ji(e){return Vi((function(t){var n=t.length,r=n,i=In.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new ve(s);if(i&&!a&&"wrapper"==Qi(o))var a=new In([],!0)}for(r=a?r:n;++r<n;){var c=Qi(o=t[r]),l="wrapper"==c?Ji(o):void 0;a=l&&us(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[Qi(l[0])].apply(a,l[3]):1==o.length&&us(o)?a[c]():a.thru(o)}return function(){var e=arguments,r=e[0];if(a&&1==e.length&&Ro(r))return a.plant(r).value();for(var i=0,s=n?t[i].apply(this,e):r;++i<n;)s=t[i].call(this,s);return s}}))}function Ti(e,t,n,i,s,o,a,c,l,u){var d=128&t,h=1&t,f=2&t,p=24&t,g=512&t,m=f?void 0:Ci(e);return function v(){for(var _=arguments.length,b=r(_),y=_;y--;)b[y]=arguments[y];if(p)var w=Yi(v),S=Dt(b,w);if(i&&(b=mi(b,i,s,p)),o&&(b=vi(b,o,a,p)),_-=S,p&&_<u){var x=Ut(b,w);return Di(e,t,Ti,v.placeholder,n,b,x,c,l,u-_)}var E=h?n:this,A=f?E[e]:e;return _=b.length,c?b=vs(b,c):g&&_>1&&b.reverse(),d&&l<_&&(b.length=l),this&&this!==Ge&&this instanceof v&&(A=m||Ci(A)),A.apply(E,b)}}function Oi(e,t){return function(n,r){return function(e,t,n,r){return lr(e,(function(e,i,s){t(r,n(e),i,s)})),r}(n,e,t(r),{})}}function Ni(e,t){return function(n,r){var i;if(void 0===n&&void 0===r)return t;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Xr(n),r=Xr(r)):(n=Kr(n),r=Kr(r)),i=e(n,r)}return i}}function Ii(e){return Vi((function(t){return t=ft(t,Nt(Ki())),zr((function(n){var r=this;return e(t,(function(e){return st(e,r,n)}))}))}))}function Mi(e,t){var n=(t=void 0===t?" ":Xr(t)).length;if(n<2)return n?Lr(t,e):t;var r=Lr(t,Zt(e/Wt(t)));return Ft(t)?ui(Gt(r),0,e).join(""):r.slice(0,e)}function Ri(e){return function(t,n,i){return i&&"number"!=typeof i&&cs(t,n,i)&&(n=i=void 0),t=ra(t),void 0===n?(n=t,t=0):n=ra(n),function(e,t,n,i){for(var s=-1,o=an(Zt((t-e)/(n||1)),0),a=r(o);o--;)a[i?o:++s]=e,e+=n;return a}(t,n,i=void 0===i?t<n?1:-1:ra(i),e)}}function $i(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=oa(t),n=oa(n)),e(t,n)}}function Di(e,t,n,r,i,s,o,a,c,l){var u=8&t;t|=u?32:64,4&(t&=~(u?64:32))||(t&=-4);var d=[e,t,i,u?s:void 0,u?o:void 0,u?void 0:s,u?void 0:o,a,c,l],h=n.apply(void 0,d);return us(e)&&bs(h,d),h.placeholder=r,Ss(h,e,t)}function Pi(e){var t=fe[e];return function(e,n){if(e=oa(e),(n=null==n?0:cn(ia(n),292))&&rn(e)){var r=(ca(e)+"e").split("e");return+((r=(ca(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Li=mn&&1/Ht(new mn([,-0]))[1]==1/0?function(e){return new mn(e)}:Xa;function zi(e){return function(t){var n=rs(t);return n==g?Bt(t):n==b?Vt(t):function(e,t){return ft(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Fi(e,t,n,i,a,c,l,u){var d=2&t;if(!d&&"function"!=typeof e)throw new ve(s);var h=i?i.length:0;if(h||(t&=-97,i=a=void 0),l=void 0===l?l:an(ia(l),0),u=void 0===u?u:ia(u),h-=a?a.length:0,64&t){var f=i,p=a;i=a=void 0}var g=d?void 0:Ji(e),m=[e,t,n,i,a,f,p,c,l,u];if(g&&function(e,t){var n=e[1],r=t[1],i=n|r,s=i<131,a=128==r&&8==n||128==r&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!s&&!a)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var c=t[3];if(c){var l=e[3];e[3]=l?mi(l,c,t[4]):c,e[4]=l?Ut(e[3],o):t[4]}(c=t[5])&&(l=e[5],e[5]=l?vi(l,c,t[6]):c,e[6]=l?Ut(e[5],o):t[6]);(c=t[7])&&(e[7]=c);128&r&&(e[8]=null==e[8]?t[8]:cn(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=i}(m,g),e=m[0],t=m[1],n=m[2],i=m[3],a=m[4],!(u=m[9]=void 0===m[9]?d?0:e.length:an(m[9]-h,0))&&24&t&&(t&=-25),t&&1!=t)v=8==t||16==t?function(e,t,n){var i=Ci(e);return function s(){for(var o=arguments.length,a=r(o),c=o,l=Yi(s);c--;)a[c]=arguments[c];var u=o<3&&a[0]!==l&&a[o-1]!==l?[]:Ut(a,l);if((o-=u.length)<n)return Di(e,t,Ti,s.placeholder,void 0,a,u,void 0,void 0,n-o);var d=this&&this!==Ge&&this instanceof s?i:e;return st(d,this,a)}}(e,t,u):32!=t&&33!=t||a.length?Ti.apply(void 0,m):function(e,t,n,i){var s=1&t,o=Ci(e);return function t(){for(var a=-1,c=arguments.length,l=-1,u=i.length,d=r(u+c),h=this&&this!==Ge&&this instanceof t?o:e;++l<u;)d[l]=i[l];for(;c--;)d[l++]=arguments[++a];return st(h,s?n:this,d)}}(e,t,n,i);else var v=function(e,t,n){var r=1&t,i=Ci(e);return function t(){var s=this&&this!==Ge&&this instanceof t?i:e;return s.apply(r?n:this,arguments)}}(e,t,n);return Ss((g?Ur:bs)(v,m),e,t)}function Bi(e,t,n,r){return void 0===e||Oo(e,ye[n])&&!xe.call(r,n)?t:e}function qi(e,t,n,r,i,s){return Ho(e)&&Ho(t)&&(s.set(t,e),Nr(e,t,void 0,qi,s),s.delete(t)),e}function Ui(e){return Jo(e)?void 0:e}function Hi(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 Pn:void 0;for(s.set(e,t),s.set(t,e);++d<a;){var p=e[d],g=t[d];if(r)var m=o?r(g,p,d,t,e,s):r(p,g,d,e,t,s);if(void 0!==m){if(m)continue;h=!1;break}if(f){if(!vt(t,(function(e,t){if(!Mt(f,t)&&(p===e||i(p,e,n,r,s)))return f.push(t)}))){h=!1;break}}else if(p!==g&&!i(p,g,n,r,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Vi(e){return ws(gs(e,void 0,Rs),e+"")}function Wi(e){return fr(e,wa,ts)}function Gi(e){return fr(e,Sa,ns)}var Ji=bn?function(e){return bn.get(e)}:Xa;function Qi(e){for(var t=e.name+"",n=yn[t],r=xe.call(yn,t)?n.length:0;r--;){var i=n[r],s=i.func;if(null==s||s==e)return i.name}return t}function Yi(e){return(xe.call(Tn,"placeholder")?Tn:e).placeholder}function Ki(){var e=Tn.iteratee||Ja;return e=e===Ja?Er:e,arguments.length?e(arguments[0],arguments[1]):e}function Xi(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Zi(e){for(var t=wa(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,fs(i)]}return t}function es(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return xr(n)?n:void 0}var ts=tn?function(e){return null==e?[]:(e=pe(e),ut(tn(e),(function(t){return We.call(e,t)})))}:sc,ns=tn?function(e){for(var t=[];e;)pt(t,ts(e)),e=qe(e);return t}:sc,rs=pr;function is(e,t,n){for(var r=-1,i=(t=ci(t,e)).length,s=!1;++r<i;){var o=Cs(t[r]);if(!(s=null!=e&&n(e,o)))break;e=e[o]}return s||++r!=i?s:!!(i=null==e?0:e.length)&&Uo(i)&&as(o,i)&&(Ro(e)||Mo(e))}function ss(e){return"function"!=typeof e.constructor||hs(e)?{}:On(qe(e))}function os(e){return Ro(e)||Mo(e)||!!(Qe&&e&&e[Qe])}function as(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ce.test(e))&&e>-1&&e%1==0&&e<t}function cs(e,t,n){if(!Ho(n))return!1;var r=typeof t;return!!("number"==r?Do(n)&&as(t,n.length):"string"==r&&t in n)&&Oo(n[t],e)}function ls(e,t){if(Ro(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xo(e))||(H.test(e)||!U.test(e)||null!=t&&e in pe(t))}function us(e){var t=Qi(e),n=Tn[t];if("function"!=typeof n||!(t in Mn.prototype))return!1;if(e===n)return!0;var r=Ji(n);return!!r&&e===r[0]}(fn&&rs(new fn(new ArrayBuffer(1)))!=E||pn&&rs(new pn)!=g||gn&&"[object Promise]"!=rs(gn.resolve())||mn&&rs(new mn)!=b||vn&&rs(new vn)!=S)&&(rs=function(e){var t=pr(e),n=t==v?e.constructor:void 0,r=n?ks(n):"";if(r)switch(r){case wn:return E;case Sn:return g;case xn:return"[object Promise]";case En:return b;case An:return S}return t});var ds=we?Bo:oc;function hs(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ye)}function fs(e){return e==e&&!Ho(e)}function ps(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in pe(n)))}}function gs(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,o=an(i.length-t,0),a=r(o);++s<o;)a[s]=i[t+s];s=-1;for(var c=r(t+1);++s<t;)c[s]=i[s];return c[t]=n(a),st(e,this,c)}}function ms(e,t){return t.length<2?e:hr(e,Wr(t,0,-1))}function vs(e,t){for(var n=e.length,r=cn(t.length,n),i=_i(e);r--;){var s=t[r];e[r]=as(s,n)?i[s]:void 0}return e}function _s(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var bs=xs(Ur),ys=Xt||function(e,t){return Ge.setTimeout(e,t)},ws=xs(Hr);function Ss(e,t,n){var r=t+"";return ws(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Y,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return at(a,(function(n){var r="_."+n[0];t&n[1]&&!dt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(K);return t?t[1].split(X):[]}(r),n)))}function xs(e){var t=0,n=0;return function(){var r=ln(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Es(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var s=Pr(n,i),o=e[s];e[s]=e[n],e[n]=o}return e.length=t,e}var As=function(e){var t=Eo(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(V,(function(e,n,r,i){t.push(r?i.replace(te,"$1"):n||e)})),t}));function Cs(e){if("string"==typeof e||Xo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ks(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function js(e){if(e instanceof Mn)return e.clone();var t=new In(e.__wrapped__,e.__chain__);return t.__actions__=_i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ts=zr((function(e,t){return Po(e)?er(e,or(t,1,Po,!0)):[]})),Os=zr((function(e,t){var n=zs(t);return Po(n)&&(n=void 0),Po(e)?er(e,or(t,1,Po,!0),Ki(n,2)):[]})),Ns=zr((function(e,t){var n=zs(t);return Po(n)&&(n=void 0),Po(e)?er(e,or(t,1,Po,!0),void 0,n):[]}));function Is(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ia(n);return i<0&&(i=an(r+i,0)),yt(e,Ki(t,3),i)}function Ms(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=ia(n),i=n<0?an(r+i,0):cn(i,r-1)),yt(e,Ki(t,3),i,!0)}function Rs(e){return(null==e?0:e.length)?or(e,1):[]}function $s(e){return e&&e.length?e[0]:void 0}var Ds=zr((function(e){var t=ft(e,oi);return t.length&&t[0]===e[0]?_r(t):[]})),Ps=zr((function(e){var t=zs(e),n=ft(e,oi);return t===zs(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?_r(n,Ki(t,2)):[]})),Ls=zr((function(e){var t=zs(e),n=ft(e,oi);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?_r(n,void 0,t):[]}));function zs(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Fs=zr(Bs);function Bs(e,t){return e&&e.length&&t&&t.length?$r(e,t):e}var qs=Vi((function(e,t){var n=null==e?0:e.length,r=Qn(e,t);return Dr(e,ft(t,(function(e){return as(e,n)?+e:e})).sort(gi)),r}));function Us(e){return null==e?e:hn.call(e)}var Hs=zr((function(e){return Zr(or(e,1,Po,!0))})),Vs=zr((function(e){var t=zs(e);return Po(t)&&(t=void 0),Zr(or(e,1,Po,!0),Ki(t,2))})),Ws=zr((function(e){var t=zs(e);return t="function"==typeof t?t:void 0,Zr(or(e,1,Po,!0),void 0,t)}));function Gs(e){if(!e||!e.length)return[];var t=0;return e=ut(e,(function(e){if(Po(e))return t=an(e.length,t),!0})),Tt(t,(function(t){return ft(e,At(t))}))}function Js(e,t){if(!e||!e.length)return[];var n=Gs(e);return null==t?n:ft(n,(function(e){return st(t,void 0,e)}))}var Qs=zr((function(e,t){return Po(e)?er(e,t):[]})),Ys=zr((function(e){return ii(ut(e,Po))})),Ks=zr((function(e){var t=zs(e);return Po(t)&&(t=void 0),ii(ut(e,Po),Ki(t,2))})),Xs=zr((function(e){var t=zs(e);return t="function"==typeof t?t:void 0,ii(ut(e,Po),void 0,t)})),Zs=zr(Gs);var eo=zr((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Js(e,n)}));function to(e){var t=Tn(e);return t.__chain__=!0,t}function no(e,t){return t(e)}var ro=Vi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return Qn(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Mn&&as(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[i],thisArg:void 0}),new In(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(i)}));var io=yi((function(e,t,n){xe.call(e,n)?++e[n]:Jn(e,n,1)}));var so=ki(Is),oo=ki(Ms);function ao(e,t){return(Ro(e)?at:tr)(e,Ki(t,3))}function co(e,t){return(Ro(e)?ct:nr)(e,Ki(t,3))}var lo=yi((function(e,t,n){xe.call(e,n)?e[n].push(t):Jn(e,n,[t])}));var uo=zr((function(e,t,n){var i=-1,s="function"==typeof t,o=Do(e)?r(e.length):[];return tr(e,(function(e){o[++i]=s?st(t,e,n):br(e,t,n)})),o})),ho=yi((function(e,t,n){Jn(e,n,t)}));function fo(e,t){return(Ro(e)?ft:jr)(e,Ki(t,3))}var po=yi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var go=zr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&cs(e,t[0],t[1])?t=[]:n>2&&cs(t[0],t[1],t[2])&&(t=[t[0]]),Mr(e,or(t,1),[])})),mo=Kt||function(){return Ge.Date.now()};function vo(e,t,n){return t=n?void 0:t,Fi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function _o(e,t){var n;if("function"!=typeof t)throw new ve(s);return e=ia(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var bo=zr((function(e,t,n){var r=1;if(n.length){var i=Ut(n,Yi(bo));r|=32}return Fi(e,r,t,n,i)})),yo=zr((function(e,t,n){var r=3;if(n.length){var i=Ut(n,Yi(yo));r|=32}return Fi(t,r,e,n,i)}));function wo(e,t,n){var r,i,o,a,c,l,u=0,d=!1,h=!1,f=!0;if("function"!=typeof e)throw new ve(s);function p(t){var n=r,s=i;return r=i=void 0,u=t,a=e.apply(s,n)}function g(e){return u=e,c=ys(v,t),d?p(e):a}function m(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-u>=o}function v(){var e=mo();if(m(e))return _(e);c=ys(v,function(e){var n=t-(e-l);return h?cn(n,o-(e-u)):n}(e))}function _(e){return c=void 0,f&&r?p(e):(r=i=void 0,a)}function b(){var e=mo(),n=m(e);if(r=arguments,i=this,l=e,n){if(void 0===c)return g(l);if(h)return di(c),c=ys(v,t),p(l)}return void 0===c&&(c=ys(v,t)),a}return t=oa(t)||0,Ho(n)&&(d=!!n.leading,o=(h="maxWait"in n)?an(oa(n.maxWait)||0,t):o,f="trailing"in n?!!n.trailing:f),b.cancel=function(){void 0!==c&&di(c),u=0,r=l=i=c=void 0},b.flush=function(){return void 0===c?a:_(mo())},b}var So=zr((function(e,t){return Zn(e,1,t)})),xo=zr((function(e,t,n){return Zn(e,oa(t)||0,n)}));function Eo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ve(s);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(Eo.Cache||Dn),n}function Ao(e){if("function"!=typeof e)throw new ve(s);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)}}Eo.Cache=Dn;var Co=li((function(e,t){var n=(t=1==t.length&&Ro(t[0])?ft(t[0],Nt(Ki())):ft(or(t,1),Nt(Ki()))).length;return zr((function(r){for(var i=-1,s=cn(r.length,n);++i<s;)r[i]=t[i].call(this,r[i]);return st(e,this,r)}))})),ko=zr((function(e,t){return Fi(e,32,void 0,t,Ut(t,Yi(ko)))})),jo=zr((function(e,t){return Fi(e,64,void 0,t,Ut(t,Yi(jo)))})),To=Vi((function(e,t){return Fi(e,256,void 0,void 0,void 0,t)}));function Oo(e,t){return e===t||e!=e&&t!=t}var No=$i(gr),Io=$i((function(e,t){return e>=t})),Mo=yr(function(){return arguments}())?yr:function(e){return Vo(e)&&xe.call(e,"callee")&&!We.call(e,"callee")},Ro=r.isArray,$o=Ze?Nt(Ze):function(e){return Vo(e)&&pr(e)==x};function Do(e){return null!=e&&Uo(e.length)&&!Bo(e)}function Po(e){return Vo(e)&&Do(e)}var Lo=nn||oc,zo=et?Nt(et):function(e){return Vo(e)&&pr(e)==d};function Fo(e){if(!Vo(e))return!1;var t=pr(e);return t==h||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Jo(e)}function Bo(e){if(!Ho(e))return!1;var t=pr(e);return t==f||t==p||"[object AsyncFunction]"==t||"[object Proxy]"==t}function qo(e){return"number"==typeof e&&e==ia(e)}function Uo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ho(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Vo(e){return null!=e&&"object"==typeof e}var Wo=tt?Nt(tt):function(e){return Vo(e)&&rs(e)==g};function Go(e){return"number"==typeof e||Vo(e)&&pr(e)==m}function Jo(e){if(!Vo(e)||pr(e)!=v)return!1;var t=qe(e);if(null===t)return!0;var n=xe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==ke}var Qo=nt?Nt(nt):function(e){return Vo(e)&&pr(e)==_};var Yo=rt?Nt(rt):function(e){return Vo(e)&&rs(e)==b};function Ko(e){return"string"==typeof e||!Ro(e)&&Vo(e)&&pr(e)==y}function Xo(e){return"symbol"==typeof e||Vo(e)&&pr(e)==w}var Zo=it?Nt(it):function(e){return Vo(e)&&Uo(e.length)&&!!Fe[pr(e)]};var ea=$i(kr),ta=$i((function(e,t){return e<=t}));function na(e){if(!e)return[];if(Do(e))return Ko(e)?Gt(e):_i(e);if(Ke&&e[Ke])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ke]());var t=rs(e);return(t==g?Bt:t==b?Ht:Oa)(e)}function ra(e){return e?(e=oa(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ia(e){var t=ra(e),n=t%1;return t==t?n?t-n:t:0}function sa(e){return e?Yn(ia(e),0,4294967295):0}function oa(e){if("number"==typeof e)return e;if(Xo(e))return NaN;if(Ho(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ho(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ot(e);var n=se.test(e);return n||ae.test(e)?He(e.slice(2),n?2:8):ie.test(e)?NaN:+e}function aa(e){return bi(e,Sa(e))}function ca(e){return null==e?"":Xr(e)}var la=wi((function(e,t){if(hs(t)||Do(t))bi(t,wa(t),e);else for(var n in t)xe.call(t,n)&&Hn(e,n,t[n])})),ua=wi((function(e,t){bi(t,Sa(t),e)})),da=wi((function(e,t,n,r){bi(t,Sa(t),e,r)})),ha=wi((function(e,t,n,r){bi(t,wa(t),e,r)})),fa=Vi(Qn);var pa=zr((function(e,t){e=pe(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&cs(t[0],t[1],i)&&(r=1);++n<r;)for(var s=t[n],o=Sa(s),a=-1,c=o.length;++a<c;){var l=o[a],u=e[l];(void 0===u||Oo(u,ye[l])&&!xe.call(e,l))&&(e[l]=s[l])}return e})),ga=zr((function(e){return e.push(void 0,qi),st(Ea,void 0,e)}));function ma(e,t,n){var r=null==e?void 0:hr(e,t);return void 0===r?n:r}function va(e,t){return null!=e&&is(e,t,vr)}var _a=Oi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ce.call(t)),e[t]=n}),Ha(Ga)),ba=Oi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ce.call(t)),xe.call(e,t)?e[t].push(n):e[t]=[n]}),Ki),ya=zr(br);function wa(e){return Do(e)?zn(e):Ar(e)}function Sa(e){return Do(e)?zn(e,!0):Cr(e)}var xa=wi((function(e,t,n){Nr(e,t,n)})),Ea=wi((function(e,t,n,r){Nr(e,t,n,r)})),Aa=Vi((function(e,t){var n={};if(null==e)return n;var r=!1;t=ft(t,(function(t){return t=ci(t,e),r||(r=t.length>1),t})),bi(e,Gi(e),n),r&&(n=Kn(n,7,Ui));for(var i=t.length;i--;)ei(n,t[i]);return n}));var Ca=Vi((function(e,t){return null==e?{}:function(e,t){return Rr(e,t,(function(t,n){return va(e,n)}))}(e,t)}));function ka(e,t){if(null==e)return{};var n=ft(Gi(e),(function(e){return[e]}));return t=Ki(t),Rr(e,n,(function(e,n){return t(e,n[0])}))}var ja=zi(wa),Ta=zi(Sa);function Oa(e){return null==e?[]:It(e,wa(e))}var Na=Ai((function(e,t,n){return t=t.toLowerCase(),e+(n?Ia(t):t)}));function Ia(e){return Fa(ca(e).toLowerCase())}function Ma(e){return(e=ca(e))&&e.replace(le,Pt).replace(Me,"")}var Ra=Ai((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$a=Ai((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Da=Ei("toLowerCase");var Pa=Ai((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var La=Ai((function(e,t,n){return e+(n?" ":"")+Fa(t)}));var za=Ai((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Fa=Ei("toUpperCase");function Ba(e,t,n){return e=ca(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match($e)||[]}(e):function(e){return e.match(Z)||[]}(e):e.match(t)||[]}var qa=zr((function(e,t){try{return st(e,void 0,t)}catch(e){return Fo(e)?e:new Q(e)}})),Ua=Vi((function(e,t){return at(t,(function(t){t=Cs(t),Jn(e,t,bo(e[t],e))})),e}));function Ha(e){return function(){return e}}var Va=ji(),Wa=ji(!0);function Ga(e){return e}function Ja(e){return Er("function"==typeof e?e:Kn(e,1))}var Qa=zr((function(e,t){return function(n){return br(n,e,t)}})),Ya=zr((function(e,t){return function(n){return br(e,n,t)}}));function Ka(e,t,n){var r=wa(t),i=dr(t,r);null!=n||Ho(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=dr(t,wa(t)));var s=!(Ho(n)&&"chain"in n&&!n.chain),o=Bo(e);return at(i,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(s||t){var n=e(this.__wrapped__),i=n.__actions__=_i(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,pt([this.value()],arguments))})})),e}function Xa(){}var Za=Ii(ft),ec=Ii(lt),tc=Ii(vt);function nc(e){return ls(e)?At(Cs(e)):function(e){return function(t){return hr(t,e)}}(e)}var rc=Ri(),ic=Ri(!0);function sc(){return[]}function oc(){return!1}var ac=Ni((function(e,t){return e+t}),0),cc=Pi("ceil"),lc=Ni((function(e,t){return e/t}),1),uc=Pi("floor");var dc,hc=Ni((function(e,t){return e*t}),1),fc=Pi("round"),pc=Ni((function(e,t){return e-t}),0);return Tn.after=function(e,t){if("function"!=typeof t)throw new ve(s);return e=ia(e),function(){if(--e<1)return t.apply(this,arguments)}},Tn.ary=vo,Tn.assign=la,Tn.assignIn=ua,Tn.assignInWith=da,Tn.assignWith=ha,Tn.at=fa,Tn.before=_o,Tn.bind=bo,Tn.bindAll=Ua,Tn.bindKey=yo,Tn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ro(e)?e:[e]},Tn.chain=to,Tn.chunk=function(e,t,n){t=(n?cs(e,t,n):void 0===t)?1:an(ia(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var s=0,o=0,a=r(Zt(i/t));s<i;)a[o++]=Wr(e,s,s+=t);return a},Tn.compact=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},Tn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return pt(Ro(n)?_i(n):[n],or(t,1))},Tn.cond=function(e){var t=null==e?0:e.length,n=Ki();return e=t?ft(e,(function(e){if("function"!=typeof e[1])throw new ve(s);return[n(e[0]),e[1]]})):[],zr((function(n){for(var r=-1;++r<t;){var i=e[r];if(st(i[0],this,n))return st(i[1],this,n)}}))},Tn.conforms=function(e){return function(e){var t=wa(e);return function(n){return Xn(n,e,t)}}(Kn(e,1))},Tn.constant=Ha,Tn.countBy=io,Tn.create=function(e,t){var n=On(e);return null==t?n:Gn(n,t)},Tn.curry=function e(t,n,r){var i=Fi(t,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},Tn.curryRight=function e(t,n,r){var i=Fi(t,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},Tn.debounce=wo,Tn.defaults=pa,Tn.defaultsDeep=ga,Tn.defer=So,Tn.delay=xo,Tn.difference=Ts,Tn.differenceBy=Os,Tn.differenceWith=Ns,Tn.drop=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,(t=n||void 0===t?1:ia(t))<0?0:t,r):[]},Tn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,0,(t=r-(t=n||void 0===t?1:ia(t)))<0?0:t):[]},Tn.dropRightWhile=function(e,t){return e&&e.length?ni(e,Ki(t,3),!0,!0):[]},Tn.dropWhile=function(e,t){return e&&e.length?ni(e,Ki(t,3),!0):[]},Tn.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&cs(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=ia(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:ia(r))<0&&(r+=i),r=n>r?0:sa(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},Tn.filter=function(e,t){return(Ro(e)?ut:sr)(e,Ki(t,3))},Tn.flatMap=function(e,t){return or(fo(e,t),1)},Tn.flatMapDeep=function(e,t){return or(fo(e,t),1/0)},Tn.flatMapDepth=function(e,t,n){return n=void 0===n?1:ia(n),or(fo(e,t),n)},Tn.flatten=Rs,Tn.flattenDeep=function(e){return(null==e?0:e.length)?or(e,1/0):[]},Tn.flattenDepth=function(e,t){return(null==e?0:e.length)?or(e,t=void 0===t?1:ia(t)):[]},Tn.flip=function(e){return Fi(e,512)},Tn.flow=Va,Tn.flowRight=Wa,Tn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Tn.functions=function(e){return null==e?[]:dr(e,wa(e))},Tn.functionsIn=function(e){return null==e?[]:dr(e,Sa(e))},Tn.groupBy=lo,Tn.initial=function(e){return(null==e?0:e.length)?Wr(e,0,-1):[]},Tn.intersection=Ds,Tn.intersectionBy=Ps,Tn.intersectionWith=Ls,Tn.invert=_a,Tn.invertBy=ba,Tn.invokeMap=uo,Tn.iteratee=Ja,Tn.keyBy=ho,Tn.keys=wa,Tn.keysIn=Sa,Tn.map=fo,Tn.mapKeys=function(e,t){var n={};return t=Ki(t,3),lr(e,(function(e,r,i){Jn(n,t(e,r,i),e)})),n},Tn.mapValues=function(e,t){var n={};return t=Ki(t,3),lr(e,(function(e,r,i){Jn(n,r,t(e,r,i))})),n},Tn.matches=function(e){return Tr(Kn(e,1))},Tn.matchesProperty=function(e,t){return Or(e,Kn(t,1))},Tn.memoize=Eo,Tn.merge=xa,Tn.mergeWith=Ea,Tn.method=Qa,Tn.methodOf=Ya,Tn.mixin=Ka,Tn.negate=Ao,Tn.nthArg=function(e){return e=ia(e),zr((function(t){return Ir(t,e)}))},Tn.omit=Aa,Tn.omitBy=function(e,t){return ka(e,Ao(Ki(t)))},Tn.once=function(e){return _o(2,e)},Tn.orderBy=function(e,t,n,r){return null==e?[]:(Ro(t)||(t=null==t?[]:[t]),Ro(n=r?void 0:n)||(n=null==n?[]:[n]),Mr(e,t,n))},Tn.over=Za,Tn.overArgs=Co,Tn.overEvery=ec,Tn.overSome=tc,Tn.partial=ko,Tn.partialRight=jo,Tn.partition=po,Tn.pick=Ca,Tn.pickBy=ka,Tn.property=nc,Tn.propertyOf=function(e){return function(t){return null==e?void 0:hr(e,t)}},Tn.pull=Fs,Tn.pullAll=Bs,Tn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?$r(e,t,Ki(n,2)):e},Tn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?$r(e,t,void 0,n):e},Tn.pullAt=qs,Tn.range=rc,Tn.rangeRight=ic,Tn.rearg=To,Tn.reject=function(e,t){return(Ro(e)?ut:sr)(e,Ao(Ki(t,3)))},Tn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],s=e.length;for(t=Ki(t,3);++r<s;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return Dr(e,i),n},Tn.rest=function(e,t){if("function"!=typeof e)throw new ve(s);return zr(e,t=void 0===t?t:ia(t))},Tn.reverse=Us,Tn.sampleSize=function(e,t,n){return t=(n?cs(e,t,n):void 0===t)?1:ia(t),(Ro(e)?Bn:Br)(e,t)},Tn.set=function(e,t,n){return null==e?e:qr(e,t,n)},Tn.setWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:qr(e,t,n,r)},Tn.shuffle=function(e){return(Ro(e)?qn:Vr)(e)},Tn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&cs(e,t,n)?(t=0,n=r):(t=null==t?0:ia(t),n=void 0===n?r:ia(n)),Wr(e,t,n)):[]},Tn.sortBy=go,Tn.sortedUniq=function(e){return e&&e.length?Yr(e):[]},Tn.sortedUniqBy=function(e,t){return e&&e.length?Yr(e,Ki(t,2)):[]},Tn.split=function(e,t,n){return n&&"number"!=typeof n&&cs(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ca(e))&&("string"==typeof t||null!=t&&!Qo(t))&&!(t=Xr(t))&&Ft(e)?ui(Gt(e),0,n):e.split(t,n):[]},Tn.spread=function(e,t){if("function"!=typeof e)throw new ve(s);return t=null==t?0:an(ia(t),0),zr((function(n){var r=n[t],i=ui(n,0,t);return r&&pt(i,r),st(e,this,i)}))},Tn.tail=function(e){var t=null==e?0:e.length;return t?Wr(e,1,t):[]},Tn.take=function(e,t,n){return e&&e.length?Wr(e,0,(t=n||void 0===t?1:ia(t))<0?0:t):[]},Tn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,(t=r-(t=n||void 0===t?1:ia(t)))<0?0:t,r):[]},Tn.takeRightWhile=function(e,t){return e&&e.length?ni(e,Ki(t,3),!1,!0):[]},Tn.takeWhile=function(e,t){return e&&e.length?ni(e,Ki(t,3)):[]},Tn.tap=function(e,t){return t(e),e},Tn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new ve(s);return Ho(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),wo(e,t,{leading:r,maxWait:t,trailing:i})},Tn.thru=no,Tn.toArray=na,Tn.toPairs=ja,Tn.toPairsIn=Ta,Tn.toPath=function(e){return Ro(e)?ft(e,Cs):Xo(e)?[e]:_i(As(ca(e)))},Tn.toPlainObject=aa,Tn.transform=function(e,t,n){var r=Ro(e),i=r||Lo(e)||Zo(e);if(t=Ki(t,4),null==n){var s=e&&e.constructor;n=i?r?new s:[]:Ho(e)&&Bo(s)?On(qe(e)):{}}return(i?at:lr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Tn.unary=function(e){return vo(e,1)},Tn.union=Hs,Tn.unionBy=Vs,Tn.unionWith=Ws,Tn.uniq=function(e){return e&&e.length?Zr(e):[]},Tn.uniqBy=function(e,t){return e&&e.length?Zr(e,Ki(t,2)):[]},Tn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zr(e,void 0,t):[]},Tn.unset=function(e,t){return null==e||ei(e,t)},Tn.unzip=Gs,Tn.unzipWith=Js,Tn.update=function(e,t,n){return null==e?e:ti(e,t,ai(n))},Tn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:ti(e,t,ai(n),r)},Tn.values=Oa,Tn.valuesIn=function(e){return null==e?[]:It(e,Sa(e))},Tn.without=Qs,Tn.words=Ba,Tn.wrap=function(e,t){return ko(ai(t),e)},Tn.xor=Ys,Tn.xorBy=Ks,Tn.xorWith=Xs,Tn.zip=Zs,Tn.zipObject=function(e,t){return si(e||[],t||[],Hn)},Tn.zipObjectDeep=function(e,t){return si(e||[],t||[],qr)},Tn.zipWith=eo,Tn.entries=ja,Tn.entriesIn=Ta,Tn.extend=ua,Tn.extendWith=da,Ka(Tn,Tn),Tn.add=ac,Tn.attempt=qa,Tn.camelCase=Na,Tn.capitalize=Ia,Tn.ceil=cc,Tn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=oa(n))==n?n:0),void 0!==t&&(t=(t=oa(t))==t?t:0),Yn(oa(e),t,n)},Tn.clone=function(e){return Kn(e,4)},Tn.cloneDeep=function(e){return Kn(e,5)},Tn.cloneDeepWith=function(e,t){return Kn(e,5,t="function"==typeof t?t:void 0)},Tn.cloneWith=function(e,t){return Kn(e,4,t="function"==typeof t?t:void 0)},Tn.conformsTo=function(e,t){return null==t||Xn(e,t,wa(t))},Tn.deburr=Ma,Tn.defaultTo=function(e,t){return null==e||e!=e?t:e},Tn.divide=lc,Tn.endsWith=function(e,t,n){e=ca(e),t=Xr(t);var r=e.length,i=n=void 0===n?r:Yn(ia(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},Tn.eq=Oo,Tn.escape=function(e){return(e=ca(e))&&z.test(e)?e.replace(P,Lt):e},Tn.escapeRegExp=function(e){return(e=ca(e))&&G.test(e)?e.replace(W,"\\$&"):e},Tn.every=function(e,t,n){var r=Ro(e)?lt:rr;return n&&cs(e,t,n)&&(t=void 0),r(e,Ki(t,3))},Tn.find=so,Tn.findIndex=Is,Tn.findKey=function(e,t){return bt(e,Ki(t,3),lr)},Tn.findLast=oo,Tn.findLastIndex=Ms,Tn.findLastKey=function(e,t){return bt(e,Ki(t,3),ur)},Tn.floor=uc,Tn.forEach=ao,Tn.forEachRight=co,Tn.forIn=function(e,t){return null==e?e:ar(e,Ki(t,3),Sa)},Tn.forInRight=function(e,t){return null==e?e:cr(e,Ki(t,3),Sa)},Tn.forOwn=function(e,t){return e&&lr(e,Ki(t,3))},Tn.forOwnRight=function(e,t){return e&&ur(e,Ki(t,3))},Tn.get=ma,Tn.gt=No,Tn.gte=Io,Tn.has=function(e,t){return null!=e&&is(e,t,mr)},Tn.hasIn=va,Tn.head=$s,Tn.identity=Ga,Tn.includes=function(e,t,n,r){e=Do(e)?e:Oa(e),n=n&&!r?ia(n):0;var i=e.length;return n<0&&(n=an(i+n,0)),Ko(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&wt(e,t,n)>-1},Tn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ia(n);return i<0&&(i=an(r+i,0)),wt(e,t,i)},Tn.inRange=function(e,t,n){return t=ra(t),void 0===n?(n=t,t=0):n=ra(n),function(e,t,n){return e>=cn(t,n)&&e<an(t,n)}(e=oa(e),t,n)},Tn.invoke=ya,Tn.isArguments=Mo,Tn.isArray=Ro,Tn.isArrayBuffer=$o,Tn.isArrayLike=Do,Tn.isArrayLikeObject=Po,Tn.isBoolean=function(e){return!0===e||!1===e||Vo(e)&&pr(e)==u},Tn.isBuffer=Lo,Tn.isDate=zo,Tn.isElement=function(e){return Vo(e)&&1===e.nodeType&&!Jo(e)},Tn.isEmpty=function(e){if(null==e)return!0;if(Do(e)&&(Ro(e)||"string"==typeof e||"function"==typeof e.splice||Lo(e)||Zo(e)||Mo(e)))return!e.length;var t=rs(e);if(t==g||t==b)return!e.size;if(hs(e))return!Ar(e).length;for(var n in e)if(xe.call(e,n))return!1;return!0},Tn.isEqual=function(e,t){return wr(e,t)},Tn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?wr(e,t,void 0,n):!!r},Tn.isError=Fo,Tn.isFinite=function(e){return"number"==typeof e&&rn(e)},Tn.isFunction=Bo,Tn.isInteger=qo,Tn.isLength=Uo,Tn.isMap=Wo,Tn.isMatch=function(e,t){return e===t||Sr(e,t,Zi(t))},Tn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Sr(e,t,Zi(t),n)},Tn.isNaN=function(e){return Go(e)&&e!=+e},Tn.isNative=function(e){if(ds(e))throw new Q("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return xr(e)},Tn.isNil=function(e){return null==e},Tn.isNull=function(e){return null===e},Tn.isNumber=Go,Tn.isObject=Ho,Tn.isObjectLike=Vo,Tn.isPlainObject=Jo,Tn.isRegExp=Qo,Tn.isSafeInteger=function(e){return qo(e)&&e>=-9007199254740991&&e<=9007199254740991},Tn.isSet=Yo,Tn.isString=Ko,Tn.isSymbol=Xo,Tn.isTypedArray=Zo,Tn.isUndefined=function(e){return void 0===e},Tn.isWeakMap=function(e){return Vo(e)&&rs(e)==S},Tn.isWeakSet=function(e){return Vo(e)&&"[object WeakSet]"==pr(e)},Tn.join=function(e,t){return null==e?"":sn.call(e,t)},Tn.kebabCase=Ra,Tn.last=zs,Tn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=ia(n))<0?an(r+i,0):cn(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):yt(e,xt,i,!0)},Tn.lowerCase=$a,Tn.lowerFirst=Da,Tn.lt=ea,Tn.lte=ta,Tn.max=function(e){return e&&e.length?ir(e,Ga,gr):void 0},Tn.maxBy=function(e,t){return e&&e.length?ir(e,Ki(t,2),gr):void 0},Tn.mean=function(e){return Et(e,Ga)},Tn.meanBy=function(e,t){return Et(e,Ki(t,2))},Tn.min=function(e){return e&&e.length?ir(e,Ga,kr):void 0},Tn.minBy=function(e,t){return e&&e.length?ir(e,Ki(t,2),kr):void 0},Tn.stubArray=sc,Tn.stubFalse=oc,Tn.stubObject=function(){return{}},Tn.stubString=function(){return""},Tn.stubTrue=function(){return!0},Tn.multiply=hc,Tn.nth=function(e,t){return e&&e.length?Ir(e,ia(t)):void 0},Tn.noConflict=function(){return Ge._===this&&(Ge._=je),this},Tn.noop=Xa,Tn.now=mo,Tn.pad=function(e,t,n){e=ca(e);var r=(t=ia(t))?Wt(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Mi(en(i),n)+e+Mi(Zt(i),n)},Tn.padEnd=function(e,t,n){e=ca(e);var r=(t=ia(t))?Wt(e):0;return t&&r<t?e+Mi(t-r,n):e},Tn.padStart=function(e,t,n){e=ca(e);var r=(t=ia(t))?Wt(e):0;return t&&r<t?Mi(t-r,n)+e:e},Tn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(ca(e).replace(J,""),t||0)},Tn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&cs(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=ra(e),void 0===t?(t=e,e=0):t=ra(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=dn();return cn(e+i*(t-e+Ue("1e-"+((i+"").length-1))),t)}return Pr(e,t)},Tn.reduce=function(e,t,n){var r=Ro(e)?gt:kt,i=arguments.length<3;return r(e,Ki(t,4),n,i,tr)},Tn.reduceRight=function(e,t,n){var r=Ro(e)?mt:kt,i=arguments.length<3;return r(e,Ki(t,4),n,i,nr)},Tn.repeat=function(e,t,n){return t=(n?cs(e,t,n):void 0===t)?1:ia(t),Lr(ca(e),t)},Tn.replace=function(){var e=arguments,t=ca(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Tn.result=function(e,t,n){var r=-1,i=(t=ci(t,e)).length;for(i||(i=1,e=void 0);++r<i;){var s=null==e?void 0:e[Cs(t[r])];void 0===s&&(r=i,s=n),e=Bo(s)?s.call(e):s}return e},Tn.round=fc,Tn.runInContext=e,Tn.sample=function(e){return(Ro(e)?Fn:Fr)(e)},Tn.size=function(e){if(null==e)return 0;if(Do(e))return Ko(e)?Wt(e):e.length;var t=rs(e);return t==g||t==b?e.size:Ar(e).length},Tn.snakeCase=Pa,Tn.some=function(e,t,n){var r=Ro(e)?vt:Gr;return n&&cs(e,t,n)&&(t=void 0),r(e,Ki(t,3))},Tn.sortedIndex=function(e,t){return Jr(e,t)},Tn.sortedIndexBy=function(e,t,n){return Qr(e,t,Ki(n,2))},Tn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=Jr(e,t);if(r<n&&Oo(e[r],t))return r}return-1},Tn.sortedLastIndex=function(e,t){return Jr(e,t,!0)},Tn.sortedLastIndexBy=function(e,t,n){return Qr(e,t,Ki(n,2),!0)},Tn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=Jr(e,t,!0)-1;if(Oo(e[n],t))return n}return-1},Tn.startCase=La,Tn.startsWith=function(e,t,n){return e=ca(e),n=null==n?0:Yn(ia(n),0,e.length),t=Xr(t),e.slice(n,n+t.length)==t},Tn.subtract=pc,Tn.sum=function(e){return e&&e.length?jt(e,Ga):0},Tn.sumBy=function(e,t){return e&&e.length?jt(e,Ki(t,2)):0},Tn.template=function(e,t,n){var r=Tn.templateSettings;n&&cs(e,t,n)&&(t=void 0),e=ca(e),t=da({},t,r,Bi);var i,s,o=da({},t.imports,r.imports,Bi),a=wa(o),c=It(o,a),l=0,u=t.interpolate||ue,d="__p += '",h=ge((t.escape||ue).source+"|"+u.source+"|"+(u===q?ne:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),f="//# sourceURL="+(xe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ze+"]")+"\n";e.replace(h,(function(t,n,r,o,a,c){return r||(r=o),d+=e.slice(l,c).replace(de,zt),n&&(i=!0,d+="' +\n__e("+n+") +\n'"),a&&(s=!0,d+="';\n"+a+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),d+="';\n";var p=xe.call(t,"variable")&&t.variable;if(p){if(ee.test(p))throw new Q("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(M,""):d).replace(R,"$1").replace($,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=qa((function(){return he(a,f+"return "+d).apply(void 0,c)}));if(g.source=d,Fo(g))throw g;return g},Tn.times=function(e,t){if((e=ia(e))<1||e>9007199254740991)return[];var n=4294967295,r=cn(e,4294967295);e-=4294967295;for(var i=Tt(r,t=Ki(t));++n<e;)t(n);return i},Tn.toFinite=ra,Tn.toInteger=ia,Tn.toLength=sa,Tn.toLower=function(e){return ca(e).toLowerCase()},Tn.toNumber=oa,Tn.toSafeInteger=function(e){return e?Yn(ia(e),-9007199254740991,9007199254740991):0===e?e:0},Tn.toString=ca,Tn.toUpper=function(e){return ca(e).toUpperCase()},Tn.trim=function(e,t,n){if((e=ca(e))&&(n||void 0===t))return Ot(e);if(!e||!(t=Xr(t)))return e;var r=Gt(e),i=Gt(t);return ui(r,Rt(r,i),$t(r,i)+1).join("")},Tn.trimEnd=function(e,t,n){if((e=ca(e))&&(n||void 0===t))return e.slice(0,Jt(e)+1);if(!e||!(t=Xr(t)))return e;var r=Gt(e);return ui(r,0,$t(r,Gt(t))+1).join("")},Tn.trimStart=function(e,t,n){if((e=ca(e))&&(n||void 0===t))return e.replace(J,"");if(!e||!(t=Xr(t)))return e;var r=Gt(e);return ui(r,Rt(r,Gt(t))).join("")},Tn.truncate=function(e,t){var n=30,r="...";if(Ho(t)){var i="separator"in t?t.separator:i;n="length"in t?ia(t.length):n,r="omission"in t?Xr(t.omission):r}var s=(e=ca(e)).length;if(Ft(e)){var o=Gt(e);s=o.length}if(n>=s)return e;var a=n-Wt(r);if(a<1)return r;var c=o?ui(o,0,a).join(""):e.slice(0,a);if(void 0===i)return c+r;if(o&&(a+=c.length-a),Qo(i)){if(e.slice(a).search(i)){var l,u=c;for(i.global||(i=ge(i.source,ca(re.exec(i))+"g")),i.lastIndex=0;l=i.exec(u);)var d=l.index;c=c.slice(0,void 0===d?a:d)}}else if(e.indexOf(Xr(i),a)!=a){var h=c.lastIndexOf(i);h>-1&&(c=c.slice(0,h))}return c+r},Tn.unescape=function(e){return(e=ca(e))&&L.test(e)?e.replace(D,Qt):e},Tn.uniqueId=function(e){var t=++Ee;return ca(e)+t},Tn.upperCase=za,Tn.upperFirst=Fa,Tn.each=ao,Tn.eachRight=co,Tn.first=$s,Ka(Tn,(dc={},lr(Tn,(function(e,t){xe.call(Tn.prototype,t)||(dc[t]=e)})),dc),{chain:!1}),Tn.VERSION="4.17.21",at(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Tn[e].placeholder=Tn})),at(["drop","take"],(function(e,t){Mn.prototype[e]=function(n){n=void 0===n?1:an(ia(n),0);var r=this.__filtered__&&!t?new Mn(this):this.clone();return r.__filtered__?r.__takeCount__=cn(n,r.__takeCount__):r.__views__.push({size:cn(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},Mn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),at(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Mn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ki(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),at(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Mn.prototype[e]=function(){return this[n](1).value()[0]}})),at(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Mn.prototype[e]=function(){return this.__filtered__?new Mn(this):this[n](1)}})),Mn.prototype.compact=function(){return this.filter(Ga)},Mn.prototype.find=function(e){return this.filter(e).head()},Mn.prototype.findLast=function(e){return this.reverse().find(e)},Mn.prototype.invokeMap=zr((function(e,t){return"function"==typeof e?new Mn(this):this.map((function(n){return br(n,e,t)}))})),Mn.prototype.reject=function(e){return this.filter(Ao(Ki(e)))},Mn.prototype.slice=function(e,t){e=ia(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Mn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ia(t))<0?n.dropRight(-t):n.take(t-e)),n)},Mn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Mn.prototype.toArray=function(){return this.take(4294967295)},lr(Mn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=Tn[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);i&&(Tn.prototype[t]=function(){var t=this.__wrapped__,o=r?[1]:arguments,a=t instanceof Mn,c=o[0],l=a||Ro(t),u=function(e){var t=i.apply(Tn,pt([e],o));return r&&d?t[0]:t};l&&n&&"function"==typeof c&&1!=c.length&&(a=l=!1);var d=this.__chain__,h=!!this.__actions__.length,f=s&&!d,p=a&&!h;if(!s&&l){t=p?t:new Mn(this);var g=e.apply(t,o);return g.__actions__.push({func:no,args:[u],thisArg:void 0}),new In(g,d)}return f&&p?e.apply(this,o):(g=this.thru(u),f?r?g.value()[0]:g.value():g)})})),at(["pop","push","shift","sort","splice","unshift"],(function(e){var t=_e[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Tn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ro(i)?i:[],e)}return this[n]((function(n){return t.apply(Ro(n)?n:[],e)}))}})),lr(Mn.prototype,(function(e,t){var n=Tn[t];if(n){var r=n.name+"";xe.call(yn,r)||(yn[r]=[]),yn[r].push({name:t,func:n})}})),yn[Ti(void 0,2).name]=[{name:"wrapper",func:void 0}],Mn.prototype.clone=function(){var e=new Mn(this.__wrapped__);return e.__actions__=_i(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=_i(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=_i(this.__views__),e},Mn.prototype.reverse=function(){if(this.__filtered__){var e=new Mn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Mn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ro(e),r=t<0,i=n?e.length:0,s=function(e,t,n){var r=-1,i=n.length;for(;++r<i;){var s=n[r],o=s.size;switch(s.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=cn(t,e+o);break;case"takeRight":e=an(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=s.start,a=s.end,c=a-o,l=r?a:o-1,u=this.__iteratees__,d=u.length,h=0,f=cn(c,this.__takeCount__);if(!n||!r&&i==c&&f==c)return ri(e,this.__actions__);var p=[];e:for(;c--&&h<f;){for(var g=-1,m=e[l+=t];++g<d;){var v=u[g],_=v.iteratee,b=v.type,y=_(m);if(2==b)m=y;else if(!y){if(1==b)continue e;break e}}p[h++]=m}return p},Tn.prototype.at=ro,Tn.prototype.chain=function(){return to(this)},Tn.prototype.commit=function(){return new In(this.value(),this.__chain__)},Tn.prototype.next=function(){void 0===this.__values__&&(this.__values__=na(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Tn.prototype.plant=function(e){for(var t,n=this;n instanceof Nn;){var r=js(n);r.__index__=0,r.__values__=void 0,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},Tn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Mn){var t=e;return this.__actions__.length&&(t=new Mn(this)),(t=t.reverse()).__actions__.push({func:no,args:[Us],thisArg:void 0}),new In(t,this.__chain__)}return this.thru(Us)},Tn.prototype.toJSON=Tn.prototype.valueOf=Tn.prototype.value=function(){return ri(this.__wrapped__,this.__actions__)},Tn.prototype.first=Tn.prototype.head,Ke&&(Tn.prototype[Ke]=function(){return this}),Tn}();Ge._=Yt,void 0===(i=function(){return Yt}.call(t,n,t,r))||(r.exports=i)}).call(this)}).call(this,n(16),n(43)(e))},function(e,t,n){"use strict";const r=n(326),i=n(327);e.exports={atob:r,btoa:i}},function(e,t,n){e.exports=n(335)},function(e,t,n){e.exports=n(349)},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,n){var r=n(20),i=n(19);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(9).Symbol;e.exports=r},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(71),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(386),i=n(387),s=n(388),o=n(389),a=n(390);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(46);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(21)(Object,"create");e.exports=r},function(e,t,n){var r=n(404);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(12),i=n(78),s=n(427),o=n(135);e.exports=function(e,t){return r(e)?e:i(e,t)?[e]:s(o(e))}},function(e,t,n){var r=n(55);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){var r=n(20),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(16))},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,g,m,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||{},g=void 0!==b.separator?b.separator:"",m=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<g.length&&(y[0]=y[0].toString().replace(".",g)),"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(m)))}s.partial=function(e){return function(t){return s(t,e)}},e.exports=s}("undefined"!=typeof window&&window)}).call(this,n(16))},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/form_input.html --\x3e\n<div class="form-group">\n ',"hidden"!==e.type&&(t+='\n <label for="'+n(e.id)+'">'+n(e.label)+"</label>\n "),t+="\n ","password"===e.type&&e.fixed_username&&(t+='\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 <input class="hidden-username" type="text" autocomplete="username" value="'+n(e.fixed_username)+'"></input>\n '),t+='\n <input \n class="form-control" name="'+n(e.name)+'" type="'+n(e.type)+'" id="'+n(e.id)+'"\n ',e.autocomplete&&(t+=' autocomplete="'+n(e.autocomplete)+'" '),t+="\n ",e.placeholder&&(t+=' placeholder="'+n(e.placeholder)+'" '),t+="\n ",e.value&&(t+=' value="'+n(e.value)+'" '),t+="\n ",e.required&&(t+=' required="required" '),t+=" />\n</div>\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/form_username.html --\x3e\n<div class="form-group">\n ',e.label&&(t+="\n <label>\n "+n(e.label)+"\n </label>\n "),t+='\n <div class="input-group">\n <div class="input-group-prepend">\n <input name="'+n(e.name)+'" type="'+n(e.type)+'"\n ',e.value&&(t+=' value="'+n(e.value)+'" '),t+="\n ",e.required&&(t+=' required="required" '),t+=' />\n <div class="input-group-text col" title="'+n(e.domain)+'">'+n(e.domain)+"</div>\n </div>\n </div>\n</div>\n"}},function(e,t,n){var r,i;r=[n(39)],void 0===(i=function(e){return e.noConflict()}.apply(t,r))||(e.exports=i)},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)[""],g=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(g)(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(g)(i)]),a[h()(i)]):(a=o[c])||(a=[n,r])[h()(i)]}});var p,g,m=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 m('[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 m("[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),m.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)):m.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,g,m,v,_,b,y,w,S={};;){if(p=n[n.length-1],this.defaultActions[p]?g=this.defaultActions[p]:(null==h&&(h=d()),g=s[p]&&s[p][h]),void 0===g||!g.length||!g[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,g=s[p=n[n.length-1]]&&s[p][2],l=3}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+h);switch(g[0]){case 1:n.push(h),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(g[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_[g[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!==(m=this.performAction.call(S,o,c,a,this.yy,g[1],r,i)))return m;_&&(n=n.slice(0,-1*_*2),r=r.slice(0,-1*_),i=i.slice(0,-1*_)),n.push(this.productions_[g[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}},g=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=g,p),e.exports&&(t=e.exports=d),t.Jed=d}()},function(e,t,n){"use strict";var r=n(8),i=n(0);i.f.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.f.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(e,t){let n;if(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(i.f.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.f.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.f.Status.CONNFAIL))return i.f.Status.CONNFAIL}_handleStreamStart(e){let t=!1;const n=e.getAttribute("xmlns");"string"!=typeof n?t="Missing xmlns in <open />":n!==i.f.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.f.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.f.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=n,this._connect())}else this._conn._changeConnectStatus(i.f.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.f.NS.FRAMING});this._conn.xmlOutput(t.tree());const n=i.f.serialize(t);this._conn.rawOutput(n);try{this.socket.send(n)}catch(e){i.f.warn("Couldn't send <close /> tag.")}}setTimeout(()=>this._conn._doDisconnect,0)}_doDisconnect(){i.f.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.f.debug(e.message)}this.socket=null}_emptyQueue(){return!0}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(i.f.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected&&this.socket?(i.f.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(i.f.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):i.f.debug("Websocket closed")}_no_auth_received(e){i.f.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(i.f.Status.CONNFAIL,i.f.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(e){i.f.error("Websocket error "+e),this._conn._changeConnectStatus(i.f.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.f.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.f.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.f.serialize(t))):void this._conn._dataRecv(t,e.data)}_onOpen(){i.f.debug("Websocket open");const e=this._buildStream();this._conn.xmlOutput(e.tree());const t=i.f.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){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(329);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},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){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(71),i=n(73);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(21)(n(9),"Map");e.exports=r},function(e,t,n){var r=n(396),i=n(403),s=n(405),o=n(406),a=n(407);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(53),i=n(35);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(12),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(37),i=n(10).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(455),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(463),__esModule:!0}},function(e,t,n){var r=n(36).f,i=n(56),s=n(13)("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(55);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(365),i=n(29);e.exports=function(e){return null==e?[]:r(e,i(e))}},function(e,t,n){var r=n(107),i=n(366),s=n(74),o=n(48),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;!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,g="";for(r=0;r<p;r++)if("string"==typeof e[r])g+=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)?g+=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):"",g+=a.align?h+n+c:"0"===l?h+c+n:c+h+n)}return g}var c=Object.create(null);function l(e){if(c[e])return c[e];for(var t,n=e,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){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 d,s=n.domBuilder||new i,a=n.errorHandler,c=n.locator,u=n.xmlns||{},h=/\/x?html?$/.test(t),f=h?l.entityMap:{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,h&&(u[""]="http://www.w3.org/1999/xhtml"),u.xml=u.xml||"http://www.w3.org/XML/1998/namespace",e&&"string"==typeof e?r.parse(e,u,f):r.errorHandler.error("invalid doc source"),s.doc},i.prototype={startDocument:function(){this.doc=(new f).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 new h(e,this.locator)}},"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(324),u=n(325),d=u.XMLReader,h=u.ParseError,f=t.DOMImplementation=n(93).DOMImplementation;t.XMLSerializer=n(93).XMLSerializer,t.DOMParser=r,t.__DOMHandler=i},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(!(r instanceof t)){function i(){}i.prototype=t.prototype,n(r,i=new i),e.prototype=r=i}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,g=i.DOCUMENT_FRAGMENT_NODE=11,m=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 k(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function j(e,t,n,r){if(r?t[k(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var i=e.ownerDocument;i&&(r&&$(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 T(e,t,n){var r=k(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&&($(s,e,n),n.ownerElement=null)}}function O(e){if(this._features={},e)for(var t in e)this._features=e[t]}function N(){}function I(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function M(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(M(e,t))return!0}while(e=e.nextSibling)}function R(){}function $(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function D(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 P(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,D(e.ownerDocument,e),t}function L(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===g){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 D(e.ownerDocument||e,e),t.nodeType==g&&(t.firstChild=t.lastChild=null),t}function z(){this._nsMap={}}function F(){}function B(){}function q(){}function U(){}function H(){}function V(){}function W(){}function G(){}function J(){}function Q(){}function Y(){}function K(){}function X(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,m=u.length,v=e.firstChild,_=e.tagName;n="http://www.w3.org/1999/xhtml"===e.namespaceURI||n,t.push("<",_);for(var b=0;b<m;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<m;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 g: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,I),'"');case a:return t.push(e.data.replace(/[<&]/g,I).replace(/]]>/g,"]]&gt;"));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 j(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),j(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return T(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return T(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}},O.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 V;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 L(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return P(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==g){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),L(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),P(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 g: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 M(this.documentElement,(function(n){if(n.nodeType==s&&n.getAttribute("id")==e)return t=n,!0})),t},getElementsByClassName:function(e){var t=new RegExp("(^|\\s)"+e+"(\\s|$)");return new E(this,(function(e){var n=[];return M(e.documentElement,(function(r){r!==e&&r.nodeType==s&&t.test(r.getAttribute("class"))&&n.push(r)})),n}))},createElement:function(e){var t=new z;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 Q;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 H;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new Y;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new F;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 z,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 F,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),z.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===g?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,D(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 M(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 M(n,(function(i){i===n||i.nodeType!==s||"*"!==e&&i.namespaceURI!==e||"*"!==t&&i.localName!=t||r.push(i)})),r}))}},R.prototype.getElementsByTagName=z.prototype.getElementsByTagName,R.prototype.getElementsByTagNameNS=z.prototype.getElementsByTagNameNS,r(z,N),F.prototype.nodeType=o,r(F,N),B.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(B,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,B),U.prototype={nodeName:"#comment",nodeType:h},r(U,B),H.prototype={nodeName:"#cdata-section",nodeType:c},r(H,B),V.prototype.nodeType=p,r(V,N),W.prototype.nodeType=m,r(W,N),G.prototype.nodeType=u,r(G,N),J.prototype.nodeType=l,r(J,N),Q.prototype.nodeName="#document-fragment",Q.prototype.nodeType=g,r(Q,N),Y.prototype.nodeType=d,r(Y,N),K.prototype.serializeToString=function(e,t,n){return X.call(e,t,n)},N.prototype.toString=X;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 g: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 g: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.Node=N,t.DOMException=S,t.DOMImplementation=O,t.XMLSerializer=K},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(16))},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(340),i=n(97),s=n(12),o=n(98),a=n(33),c=n(99),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):[],g=p.length;for(var m in e)!t&&!l.call(e,m)||f&&("length"==m||d&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,g))||p.push(m);return p}},function(e,t,n){var r=n(341),i=n(19),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,n){(function(e){var r=n(9),i=n(342),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(43)(e))},function(e,t,n){var r=n(343),i=n(344),s=n(345),o=s&&s.isTypedArray,a=o?i(o):r;e.exports=a},function(e,t,n){var r=n(101),i=n(346),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(104),i=n(46),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(105);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(21),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(34),i=n(356),s=n(108);e.exports=function(e,t){return s(i(e,t,r),e+"")}},function(e,t,n){var r=n(357),i=n(109)(r);e.exports=i},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(360),s=n(25);e.exports=function(e){return s(e)?r(e,!0):i(e)}},function(e,t,n){var r=n(362),i=n(363),s=n(364);e.exports=function(e,t,n){return t==t?s(e,t,n):r(e,i,n)}},function(e,t,n){var r=n(20),i=n(12),s=n(19);e.exports=function(e){return"string"==typeof e||!i(e)&&s(e)&&"[object String]"==r(e)}},function(e,t,n){var r=n(34),i=n(114),s=i?function(e,t){return i.set(e,t),e}:r;e.exports=s},function(e,t,n){var r=n(115),i=r&&new r;e.exports=i},function(e,t,n){var r=n(21)(n(9),"WeakMap");e.exports=r},function(e,t,n){var r=n(117),i=n(118),s=n(369),o=n(47),a=n(119),c=n(74),l=n(380),u=n(48),d=n(9);e.exports=function e(t,n,h,f,p,g,m,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 k=arguments.length,j=Array(k),T=k;T--;)j[T]=arguments[T];if(x)var O=c(C),N=s(j,O);if(f&&(j=r(j,f,p,x)),g&&(j=i(j,g,m,x)),k-=N,x&&k<b){var I=u(j,O);return a(t,n,e,C.placeholder,h,j,I,v,_,b-k)}var M=w?h:this,R=S?M[t]:t;return k=j.length,v?j=l(j,v):E&&k>1&&j.reverse(),y&&_<k&&(j.length=_),this&&this!==d&&this instanceof C&&(R=A||o(R)),R.apply(M,j)}}},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(370),i=n(123),s=n(124);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],g=n.apply(void 0,p);return r(e)&&i(g,p),g.placeholder=o,s(g,e,t)}},function(e,t,n){var r=n(114),i=n(371),s=r?function(e){return r.get(e)}:i;e.exports=s},function(e,t,n){var r=n(71),i=n(73);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(113),i=n(109)(r);e.exports=i},function(e,t,n){var r=n(376),i=n(377),s=n(108),o=n(378);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(49),i=n(391),s=n(392),o=n(393),a=n(394),c=n(395);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(408),i=n(19);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(409),i=n(412),s=n(413);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,g=!0,m=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;g=!1;break}if(m){if(!i(t,(function(e,t){if(!s(m,t)&&(v===e||a(v,e,n,o,c)))return m.push(t)}))){g=!1;break}}else if(v!==_&&!a(v,_,n,o,c)){g=!1;break}}return c.delete(e),c.delete(t),g}},function(e,t,n){var r=n(129),i=n(12);e.exports=function(e,t,n){var s=t(e);return i(e)?s:r(s,n(e))}},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(420),i=n(131),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(421),i=n(75),s=n(422),o=n(423),a=n(115),c=n(20),l=n(106),u=l(r),d=l(i),h=l(s),f=l(o),p=l(a),g=c;(r&&"[object DataView]"!=g(new r(new ArrayBuffer(1)))||i&&"[object Map]"!=g(new i)||s&&"[object Promise]"!=g(s.resolve())||o&&"[object Set]"!=g(new o)||a&&"[object WeakMap]"!=g(new a))&&(g=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=g},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(430);e.exports=function(e){return null==e?"":r(e)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(445)),i=l(n(451)),s=l(n(459)),o=l(n(462)),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(490);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(454),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(15),i=n(10),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(26),s=n(467),o=n(27),a=n(38),c=n(468),l=n(87),u=n(471),d=n(13)("iterator"),h=!([].keys&&"next"in[].keys()),f=function(){return this};e.exports=function(e,t,n,p,g,m,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"==g,E=!1,A=e.prototype,C=A[d]||A["@@iterator"]||g&&A[g],k=C||w(g),j=g?x?w("entries"):k:void 0,T="Array"==t&&A.entries||C;if(T&&(y=u(T.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,k=function(){return C.call(this)}),r&&!v||!h&&!E&&A[d]||o(A,d,k),a[t]=k,a[S]=f,g)if(_={values:x?k:w("values"),keys:m?k:w("keys"),entries:j},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(10).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(57),i=n(13)("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(22),i=n(55),s=n(13)("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(54),a=n(482),c=n(146),l=n(80),u=n(10),d=u.process,h=u.setImmediate,f=u.clearImmediate,p=u.MessageChannel,g=u.Dispatch,m=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[++m]=function(){a("function"==typeof e?e:Function(e),t)},r(m),m},f=function(e){delete v[e]},"process"==n(57)(d)?r=function(e){d.nextTick(o(_,e,1))}:g&&g.now?r=function(e){g.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(22),i=n(37),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(8),i=n(0);i.f.Request=class{constructor(e,t,n,r){this.id=++i.f._requestId,this.xmlData=e,this.data=i.f.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.f.error("invalid response received"),i.f.error("responseText: "+this.xhr.responseText),i.f.error("responseXML: "+i.f.serialize(this.xhr.responseXML)),new Error("parsererror")}else if(this.xhr.responseText){if(i.f.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.f.error("invalid response received: "+e.querySelector("parsererror").textContent),i.f.error("responseText: "+this.xhr.responseText);const t=new Error;throw t.name=i.f.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.f.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.f.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.f.NS.BOSH});n&&r.attrs({route:n});const s=this._conn._connect_cb;this._requests.push(new i.f.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.f.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.f.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.f.getBareJidFromJid(o.jid)===i.f.getBareJidFromJid(e)||null===i.f.getNodeFromJid(e)&&i.f.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.f.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.f.Status.CONNFAIL,t)):this._conn._changeConnectStatus(i.f.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(t),i.f.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.f.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(e){i.f.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.f.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.f.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.f.NS.BOSH}):t.cnode(e[n]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new i.f.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.f.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(i.f.TIMEOUT*this.wait)&&(i.f.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(i.f.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.f.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.f.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.f.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.f.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),i.f.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0}else 0===r||r>=400&&r<600||r>=12e3?(i.f.error("request id "+n.id+"."+n.sends+" error "+r+" happened"),this._hitError(r),this._callProtocolErrorHandlers(n),r>=400&&r<500&&(this._conn._changeConnectStatus(i.f.Status.DISCONNECTING,null),this._conn._doDisconnect())):i.f.error("request id "+n.id+"."+n.sends+" error "+r+" happened");s||o?o&&!this._conn.connected&&this._conn._changeConnectStatus(i.f.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.f.TIMEOUT*this.wait),a=null!==n.dead&&n.timeDead()>Math.floor(i.f.SECONDARY_TIMEOUT*this.wait),c=4===n.xhr.readyState&&(r<1||r>=500);if((o||a||c)&&(a&&i.f.error(`Request ${this._requests[t].id} timed out (secondary), restarting`),n.abort=!0,n.xhr.abort(),n.xhr.onreadystatechange=function(){},this._requests[t]=new i.f.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[t]),0===n.xhr.readyState){i.f.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.f.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(i.f.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.f.TIMEOUT*this.wait),Math.pow(n.sends,3));setTimeout((function(){e()}),t)}else e();n.sends++,this._conn.xmlOutput!==i.f.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.f.Connection.prototype.rawOutput&&this._conn.rawOutput(n.data)}else i.f.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+n.xhr.readyState)}_removeRequest(e){i.f.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.f.debug("_sendTerminate was called");const t=this._buildBody().attrs({type:"terminate"});e&&t.cnode(e.tree());const n=new i.f.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.f.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):i.f.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.f.Bosh.prototype.strip=null},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 g(e){throw new RangeError(h[e])}function m(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+m((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 m(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=[],m=e.length,v=0,_=128,y=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&g("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<m;){for(s=v,o=1,a=36;i>=m&&g("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))&&g("overflow"),v+=l*o,!(l<(u=a<=y?1:a>=y+26?26:a-y));a+=36)o>f(c/(d=36-u))&&g("overflow"),o*=d;y=w(v-s,t=p.length+1,0==s),f(v/t)>c-_&&g("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,m,v,b,S,x=[];for(m=(e=_(e)).length,t=128,n=0,s=72,o=0;o<m;++o)(h=e[o])<128&&x.push(p(h));for(r=i=x.length,i&&x.push("-");r<m;){for(a=c,o=0;o<m;++o)(h=e[o])>=t&&h<a&&(a=h);for(a-t>f((c-n)/(v=r+1))&&g("overflow"),n+=(a-t)*v,t=a,o=0;o<m;++o)if((h=e[o])<t&&++n>c&&g("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(43)(e),n(16))},function(e,t,n){var r,i;
/*!
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.19.6
*
* 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.6
*
* 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";t.a=function(){return!1}},function(e,t,n){"use strict";(function(e){var r=n(4),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(66)(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(328),i=n(67);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(20),i=n(19);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(70),i=n(383),s=n(436),o=n(438);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(100),i=n(132),s=n(25),o=n(112),a=n(441);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){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+="\x3c!-- src/templates/form_captcha.html --\x3e\n",e.label&&(t+="\n<label>\n "+n(e.label)+"\n</label>\n"),t+='\n<img src="data:'+n(e.type)+";base64,"+n(e.data)+'">\n<input name="'+n(e.name)+'" type="text" ',e.required&&(t+=' required="required" '),t+=" />\n\n\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/form_checkbox.html --\x3e\n<div class="form-group">\n <input id="'+n(e.id)+'" name="'+n(e.name)+'" type="checkbox" '+n(e.checked)+" ",e.required&&(t+=" required "),t+=' />\n <label class="form-check-label" for="'+n(e.id)+'">'+n(e.label)+"</label>\n</div>\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t,n="",i=r.escape;Array.prototype.join;return n+='\x3c!-- src/templates/form_select.html --\x3e\n<div class="form-group">\n <label for="'+i(e.id)+'">'+i(e.label)+'</label>\n <select class="form-control" id="'+i(e.id)+'" name="'+i(e.name)+'" ',e.multiple&&(n+=' multiple="multiple" '),n+=">"+(null==(t=e.options)?"":t)+"</select>\n</div>\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;return t+='\x3c!-- src/templates/form_textarea.html --\x3e\n<label class="label-ta">'+n(e.label)+'</label>\n<textarea name="'+n(e.name)+'">'+n(e.value)+"</textarea>\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;return t+="\x3c!-- src/templates/form_url.html --\x3e\n<label>\n "+n(e.label)+'\n <a class="form-url" target="_blank" rel="noopener" href="'+n(e.value)+'">'+n(e.value)+"</a>\n</label>\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/select_option.html --\x3e\n<option value="'+n(e.value)+'" ',e.selected&&(t+=' selected="selected" '),t+=" >"+n(e.label)+"</option>\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="";return t+='\x3c!-- src/templates/controlbox_toggle.html --\x3e\n<span class="toggle-feedback">'+(0,r.escape)(e.label_toggle)+"</span>\n"}},function(e,t,n){n(7);e.exports=function(e){return'\x3c!-- src/templates/dragresize.html --\x3e\n<div class="dragresize dragresize-top"></div>\n<div class="dragresize dragresize-topleft"></div>\n<div class="dragresize dragresize-left"></div>\n','\x3c!-- src/templates/dragresize.html --\x3e\n<div class="dragresize dragresize-top"></div>\n<div class="dragresize dragresize-topleft"></div>\n<div class="dragresize dragresize-left"></div>\n'}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/room_description.html --\x3e\n\x3c!-- FIXME: check markup in mockup --\x3e\n<div class="room-info">\n<p class="room-info"><strong>'+n(e.label_jid)+"</strong> "+n(e.jid)+'</p>\n<p class="room-info"><strong>'+n(e.label_desc)+"</strong> "+n(e.desc)+'</p>\n<p class="room-info"><strong>'+n(e.label_occ)+"</strong> "+n(e.occ)+'</p>\n<p class="room-info"><strong>'+n(e.label_features)+"</strong>\n <ul>\n ",e.passwordprotected&&(t+='\n <li class="room-info locked">'+n(e.label_requires_auth)+"</li>\n "),t+="\n ",e.hidden&&(t+='\n <li class="room-info">'+n(e.label_hidden)+"</li>\n "),t+="\n ",e.membersonly&&(t+='\n <li class="room-info">'+n(e.label_requires_invite)+"</li>\n "),t+="\n ",e.moderated&&(t+='\n <li class="room-info">'+n(e.label_moderated)+"</li>\n "),t+="\n ",e.nonanonymous&&(t+='\n <li class="room-info">'+n(e.label_non_anon)+"</li>\n "),t+="\n ",e.open&&(t+='\n <li class="room-info">'+n(e.label_open_room)+"</li>\n "),t+="\n ",e.persistent&&(t+='\n <li class="room-info">'+n(e.label_permanent_room)+"</li>\n "),t+="\n ",e.publicroom&&(t+='\n <li class="room-info">'+n(e.label_public)+"</li>\n "),t+="\n ",e.semianonymous&&(t+='\n <li class="room-info">'+n(e.label_semi_anon)+"</li>\n "),t+="\n ",e.temporary&&(t+='\n <li class="room-info">'+n(e.label_temp_room)+"</li>\n "),t+="\n ",e.unmoderated&&(t+='\n <li class="room-info">'+n(e.label_unmoderated)+"</li>\n "),t+="\n </ul>\n</p>\n</div>\n"}},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,g={bgColor:"#d00",textColor:"#fff",fontFamily:"sans-serif",fontStyle:"bold",type:"circle",position:"down",animation:"slide",elementId:!1,element:null,dataUrl:!1,win:window};(h={}).ff="undefined"!=typeof InstallTrigger,h.chrome=!!window.chrome,h.opera=!!window.opera||navigator.userAgent.indexOf("Opera")>=0,h.ie=/*@cc_on!@*/!1,h.safari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,h.supported=h.chrome||h.ff||h.opera;var m=[];d=function(){},c=!1;var v={ready:function(){c=!0,v.reset(),d()},reset:function(){c&&(m=[],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&&m.length>0){u=!0;var e=function(){["type","animation","bgColor","textColor","fontFamily","fontStyle"].forEach((function(e){e in m[0].options&&(t[e]=m[0].options[e])})),x.run(m[0].options,(function(){l=m[0],u=!1,m.length>0&&(m.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(g,e)).bgColor=w(t.bgColor),t.textColor=w(t.textColor),t.position=t.position.toLowerCase(),t.animation=x.types[""+t.animation]?t.animation:g.animation,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:g.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])})),m.push(n),m.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]];m.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){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/register_panel.html --\x3e\n<div>\n <form id="converse-register" class="converse-form">\n <legend class="col-form-label">'+n(e.__("Create your account"))+'</legend>\n\n <div class="form-group">\n <label>'+n(e.__("Please enter the XMPP provider to register with:"))+'</label>\n <div class="form-errors hidden"></div>\n\n ',e.default_domain?t+="\n "+n(e.default_domain)+"\n </div>\n ":t+='\n <input class="form-control" required="required" type="text" name="domain" placeholder="'+n(e.domain_placeholder)+'"/>\n <p class="form-text text-muted">'+n(e.help_providers)+' <a href="'+n(e.href_providers)+'" class="url" target="_blank" rel="noopener">'+n(e.help_providers_link)+'</a>.</p>\n </div>\n <fieldset class="buttons">\n <input class="btn btn-primary" type="submit" value="'+n(e.label_register)+'"/>\n <div class="switch-form">\n <p>'+n(e.__("Already have a chat account?"))+'</p>\n <p><a class="login-here toggle-register-login" href="#converse/login">'+n(e.__("Log in here"))+"</a></p>\n </div>\n </fieldset>\n ",t+="\n \x3c!--</div>--\x3e\n </form>\n</div>\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/registration_form.html --\x3e\n<legend class="col-form-label">'+n(e.__("Account Registration:"))+" "+n(e.domain)+'</legend>\n<p class="title">'+n(e.title)+'</p>\n<p class="form-help instructions">'+n(e.instructions)+'</p>\n<div class="form-errors hidden"></div>\n\n<fieldset class="buttons">\n <input type="submit" class="btn btn-primary" value="'+n(e.__("Register"))+'"/>\n ',e.registration_domain||(t+='\n <input type="button" class="btn btn-secondary button-cancel" value="'+n(e.__("Choose a different provider"))+'"/>\n '),t+='\n <div class="switch-form">\n <p>'+n(e.__("Already have a chat account?"))+'</p>\n <p><a class="login-here toggle-register-login" href="#converse/login">'+n(e.__("Log in here"))+"</a></p>\n </div>\n</fieldset>\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/registration_request.html --\x3e\n<span class="spinner login-submit fa fa-spinner"></span>\n<p class="info">'+n(e.__("Hold tight, we're fetching the registration form…"))+"</p>\n",e.cancel&&(t+='\n <button class="btn btn-secondary button-cancel hor_centered">'+n(e.__("Cancel"))+"</button>\n"),t+="\n"}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/group_header.html --\x3e\n<a href="#" class="list-toggle group-toggle controlbox-padded" title="'+n(e.desc_group_toggle)+'">\n <span class="fa ',e.toggle_state===e._converse.OPENED?t+=" fa-caret-down ":t+=" fa-caret-right ",t+='">\n </span> '+n(e.label_group)+'</a>\n<ul class="items-list roster-group-contacts ',e.toggle_state===e._converse.CLOSED&&(t+=" collapsed "),t+='"></ul>\n'}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+="\x3c!-- src/templates/pending_contact.html --\x3e\n",e.allow_chat_pending_contacts&&(t+='\n<a class="list-item-link open-chat w-100" href="#">\n'),t+='\n<span class="pending-contact-name" title="JID: '+n(e.jid)+'">'+n(e.display_name)+"</span> \n",e.allow_chat_pending_contacts&&(t+="</a>"),t+='\n<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="'+n(e.desc_remove)+'" href="#"></a>\n'}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+="\x3c!-- src/templates/requesting_contact.html --\x3e\n",e.allow_chat_pending_contacts&&(t+='\n<a class="open-chat w-100"href="#">\n'),t+='\n<span class="req-contact-name w-100" title="JID: '+n(e.jid)+'">'+n(e.display_name)+"</span>\n",e.allow_chat_pending_contacts&&(t+="\n</a>\n"),t+='\n<a class="accept-xmpp-request list-item-action list-item-action--visible fa fa-check"\n aria-label="'+n(e.desc_accept)+'" title="'+n(e.desc_accept)+'" href="#"></a>\n<a class="decline-xmpp-request list-item-action list-item-action--visible fa fa-times"\n aria-label="'+n(e.desc_decline)+'" title="'+n(e.desc_decline)+'" href="#"></a>\n'}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/roster.html --\x3e\n<div class="d-flex controlbox-padded">\n <span class="w-100 controlbox-heading controlbox-heading--contacts">'+n(e.heading_contacts)+'</span>\n <a class="controlbox-heading__btn sync-contacts fa fa-sync" title="'+n(e.title_sync_contacts)+'"></a>\n ',e.allow_contact_requests&&(t+='\n <a class="controlbox-heading__btn add-contact fa fa-user-plus"\n title="'+n(e.title_add_contact)+'"\n data-toggle="modal"\n data-target="#add-contact-modal"></a>\n '),t+='\n</div>\n\n<form class="roster-filter-form"></form>\n\n<div class="list-container roster-contacts"></div>\n'}},function(e,t,n){var r={escape:n(7)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/roster_item.html --\x3e\n<a class="list-item-link cbox-list-item open-chat w-100 ',e.num_unread&&(t+=" unread-msgs "),t+='"\n title="'+n(e.desc_chat)+'" href="#">\n\n <canvas class="avatar" height="30" width="30"></canvas>\n <span class="'+n(e.status_icon)+'" title="'+n(e.desc_status)+'"></span>\n ',e.num_unread&&(t+=' <span class="msgs-indicator">'+n(e.num_unread)+"</span> "),t+='\n <span class="contact-name contact-name--'+n(e.show)+" ",e.num_unread&&(t+=" unread-msgs "),t+='">'+n(e.display_name)+"</span>\n</a>\n",e.allow_contact_removal&&(t+='\n<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="'+n(e.desc_remove)+'" href="#"></a>\n'),t+="\n"}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,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 "${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(501),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,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){t.entityMap={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"",lowast:"",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"",cap:"∩",cup:"",int:"∫",there4:"∴",sim:"",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:"",emsp:"",thinsp:"",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"",mdash:"—",lsquo:"",rsquo:"",sbquo:"",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"",Prime:"″",lsaquo:"",rsaquo:"",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}},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(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,s)}function o(){}function a(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function c(e,t,n,r,i,s){function o(e,t,r){e in n.attributeNames&&s.fatalError("Attribute "+e+" redefined"),n.addValue(e,t,r)}for(var a,c=++t,l=0;;){var u=e.charAt(c);switch(u){case"=":if(1===l)a=e.slice(t,c),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(s.warning('attribute value must after "="'),a=e.slice(t,c)),t=c+1,!((c=e.indexOf(u,t))>0))throw new Error("attribute value no end '"+u+"' match");o(a,d=e.slice(t,c).replace(/&#?\w+;/g,i),t-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');o(a,d=e.slice(t,c).replace(/&#?\w+;/g,i),t),s.warning('attribute "'+a+'" missed start quot('+u+")!!"),t=c+1,l=5}break;case"/":switch(l){case 0:n.setTagName(e.slice(t,c));case 5:case 6:case 7:l=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==l&&n.setTagName(e.slice(t,c)),c;case">":switch(l){case 0:n.setTagName(e.slice(t,c));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=e.slice(t,c)).slice(-1)&&(n.closed=!0,d=d.slice(0,-1));case 2:2===l&&(d=a),4==l?(s.warning('attribute "'+d+'" missed quot(")!'),o(a,d.replace(/&#?\w+;/g,i),t)):("http://www.w3.org/1999/xhtml"===r[""]&&d.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),o(d,d,t));break;case 3:throw new Error("attribute value missed!!")}return c;case"€":u=" ";default:if(u<=" ")switch(l){case 0:n.setTagName(e.slice(t,c)),l=6;break;case 1:a=e.slice(t,c),l=2;break;case 4:var d=e.slice(t,c).replace(/&#?\w+;/g,i);s.warning('attribute "'+d+'" missed quot(")!!'),o(a,d,t);case 5:l=6}else switch(l){case 2:n.tagName;"http://www.w3.org/1999/xhtml"===r[""]&&a.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),o(a,a,t),t=c,l=1;break;case 5:s.warning('attribute space is required"'+a+'"!!');case 6:l=1,t=c;break;case 3:l=4,t=c;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function l(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),d="xmlns"===l&&u;else u=a,l=null,d="xmlns"===a&&"";o.localName=u,!1!==d&&(null==i&&(i={},h(n,n={})),n[d]=i[d]=c,o.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(d,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 u(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 d(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 h(e,t){for(var n in e)t[n]=e[n]}function f(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=!1,l=!1;o>3&&(/^public$/i.test(s[2][0])?(c=s[3][0],l=o>4&&s[4][0]):/^system$/i.test(s[2][0])&&(l=s[3][0]));var u=s[o-1];return n.startDTD(a,c,l),n.endDTD(),u.index+u[0].length}}return-1}function p(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 g(){this.attributeNames={}}s.prototype=new Error,s.prototype.name=s.name,o.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),h(t,t={}),function(e,t,n,r,i){function o(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function h(t){if(t>x){var n=e.substring(x,t).replace(/&#?\w+;/g,o);y&&m(x),r.characters(n,0,t-x),x=t}}function m(t,n){for(;t>=_&&(n=b.exec(e));)v=n.index,_=v+n[0].length,y.lineNumber++;y.columnNumber=t-v+1}var v=0,_=0,b=/.*(?:\r\n?|\n)|.*$/g,y=r.locator,w=[{currentNSMap:t}],S={},x=0;for(;;){try{var E=e.indexOf("<",x);if(E<0){if(!e.substr(x).match(/^\s*$/)){var A=r.doc,C=A.createTextNode(e.substr(x));A.appendChild(C),r.currentElement=C}return}switch(E>x&&h(E),e.charAt(E+1)){case"/":var k=e.indexOf(">",E+3),j=e.substring(E+2,k),T=w.pop();k<0?(j=e.substring(E+2).replace(/[\s<].*/,""),i.error("end tag name: "+j+" is not complete:"+T.tagName),k=E+1+j.length):j.match(/\s</)&&(j=j.replace(/[\s<].*/,""),i.error("end tag name: "+j+" maybe not complete"),k=E+1+j.length);var O=T.localNSMap,N=T.tagName==j;if(N||T.tagName&&T.tagName.toLowerCase()==j.toLowerCase()){if(r.endElement(T.uri,T.localName,j),O)for(var I in O)r.endPrefixMapping(I);N||i.fatalError("end tag name: "+j+" is not match the current start tagName:"+T.tagName)}else w.push(T);k++;break;case"?":y&&m(E),k=p(e,E,r);break;case"!":y&&m(E),k=f(e,E,r,i);break;default:y&&m(E);var M=new g,R=w[w.length-1].currentNSMap,$=(k=c(e,E,M,R,o,i),M.length);if(!M.closed&&d(e,k,M.tagName,S)&&(M.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),y&&$){for(var D=a(y,{}),P=0;P<$;P++){var L=M[P];m(L.offset),L.locator=a(y,{})}r.locator=D,l(M,r,R)&&w.push(M),r.locator=y}else l(M,r,R)&&w.push(M);"http://www.w3.org/1999/xhtml"!==M.uri||M.closed?k++:k=u(e,k,M.tagName,o,r)}}catch(e){if(e instanceof s)throw e;i.error("element parse error: "+e),k=-1}k>x?x=k:h(Math.max(E,x)+1)}}(e,t,n,r,this.errorHandler),r.endDocument()}},g.prototype={setTagName:function(e){if(!i.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,n){if(!i.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},t.XMLReader=o,t.ParseError=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){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(330);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(331),i=n(17),s=n(44),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(s(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);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){var r=n(332),i=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(i,""):e}},function(e,t){var n=/\s/;e.exports=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}},function(e,t,n){var r=n(45),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(336),s=n(348),o=n(12);e.exports=function(e,t){return(o(e)?r:i)(e,s(t))}},function(e,t,n){var r=n(337),i=n(347)(r);e.exports=i},function(e,t,n){var r=n(338),i=n(29);e.exports=function(e,t){return e&&r(e,t,i)}},function(e,t,n){var r=n(339)();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(20),i=n(19);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(20),i=n(68),s=n(19),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(43)(e))},function(e,t,n){var r=n(102)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(25);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(34);e.exports=function(e){return"function"==typeof e?e:r}},function(e,t,n){var r=n(350),i=n(355),s=n(110),o=i((function(e,t){r(t,s(t),e)}));e.exports=o},function(e,t,n){var r=n(103),i=n(104);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(352),s=n(17),o=n(106),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(353),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(9)["__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(107),i=n(359);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(69),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,n){var r=n(358),i=n(105),s=n(34),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(46),i=n(25),s=n(33),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(101),s=n(361),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(70);e.exports=function(e,t){return r(t,(function(t){return e[t]}))}},function(e,t,n){var r=n(113),i=n(367),s=n(368),o=n(116),a=n(381),c=n(120),l=n(382),u=n(123),d=n(124),h=n(67),f=Math.max;e.exports=function(e,t,n,p,g,m,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=g=void 0),v=void 0===v?v:f(h(v),0),_=void 0===_?_:h(_),y-=g?g.length:0,64&t){var w=p,S=g;p=g=void 0}var x=b?void 0:c(e),E=[e,t,n,p,g,w,S,m,v,_];if(x&&l(E,x),e=E[0],t=E[1],n=E[2],p=E[3],g=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||g.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(47),i=n(9);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(69),i=n(47),s=n(116),o=n(119),a=n(74),c=n(48),l=n(9);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 g=d<3&&h[0]!==p&&h[d-1]!==p?[]:c(h,p);if((d-=g.length)<n)return o(e,t,s,i.placeholder,void 0,h,g,void 0,void 0,n-d);var m=this&&this!==l&&this instanceof i?u:e;return r(m,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(72),i=n(120),s=n(372),o=n(374);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(373),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(72),i=n(121),s=n(73),o=n(12),a=n(19),c=n(375),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(72),i=n(121),s=n(122);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(379),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(111);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},function(e,t,n){var r=n(122),i=n(33),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(69),i=n(47),s=n(9);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(117),i=n(118),s=n(48),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(384),i=n(425),s=n(34),o=n(12),a=n(434);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(385),i=n(424),s=n(134);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(125),i=n(126);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(50),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(50);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(50);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(50);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(49);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(49),i=n(75),s=n(76);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(397),i=n(49),s=n(75);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(398),i=n(399),s=n(400),o=n(401),a=n(402);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(51);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(51),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(51),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(51);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(52);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(52);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(52);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(52);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(125),i=n(127),s=n(414),o=n(418),a=n(132),c=n(12),l=n(98),u=n(99),d="[object Object]",h=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,f,p,g){var m=c(e),v=c(t),_=m?"[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;m=!0,y=!1}if(S&&!y)return g||(g=new r),m||u(e)?i(e,t,n,f,p,g):s(e,t,_,n,f,p,g);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 g||(g=new r),p(A,C,n,f,g)}}return!!S&&(g||(g=new r),o(e,t,n,f,p,g))}},function(e,t,n){var r=n(76),i=n(410),s=n(411);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(45),i=n(415),s=n(46),o=n(127),a=n(416),c=n(417),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 g=h.get(e);if(g)return g==t;r|=2,h.set(e,t);var m=o(f(e),f(t),r,l,d,h);return h.delete(e),m;case"[object Symbol]":if(u)return u.call(e)==u.call(t)}return!1}},function(e,t,n){var r=n(9).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(419),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 g=!0;a.set(e,t),a.set(t,e);for(var m=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)){g=!1;break}m||(m="constructor"==h)}if(g&&!m){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||(g=!1)}return a.delete(e),a.delete(t),g}},function(e,t,n){var r=n(128),i=n(130),s=n(29);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(21)(n(9),"DataView");e.exports=r},function(e,t,n){var r=n(21)(n(9),"Promise");e.exports=r},function(e,t,n){var r=n(21)(n(9),"Set");e.exports=r},function(e,t,n){var r=n(133),i=n(29);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(126),i=n(426),s=n(431),o=n(78),a=n(133),c=n(134),l=n(35);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(428),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(429);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(76);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(45),i=n(70),s=n(12),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,n){var r=n(432),i=n(433);e.exports=function(e,t){return null!=e&&i(e,t,r)}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},function(e,t,n){var r=n(53),i=n(97),s=n(12),o=n(33),a=n(68),c=n(35);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(136),i=n(435),s=n(78),o=n(35);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(77),i=n(437),s=n(53);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(103),i=n(53),s=n(33),o=n(17),a=n(35);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 g=h[f];void 0===(p=c?c(g,f,h):void 0)&&(p=o(g)?g:s(t[l+1])?[]:{})}r(h,f,p),h=h[f]}return e}},function(e,t,n){var r=n(128),i=n(439),s=n(110);e.exports=function(e){return r(e,s,i)}},function(e,t,n){var r=n(129),i=n(440),s=n(130),o=n(131),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(102)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){var r=n(442),i=n(443),s=n(444);e.exports=function(e){return i(e)?s(e):r(e)}},function(e,t,n){var r=n(136)("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(446),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(447),__esModule:!0}},function(e,t,n){n(448);var r=n(15).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){var r=n(26);r(r.S+r.F*!n(28),"Object",{defineProperty:n(36).f})},function(e,t,n){e.exports=!n(28)&&!n(79)((function(){return 7!=Object.defineProperty(n(80)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(37);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(452),__esModule:!0}},function(e,t,n){n(453),e.exports=n(15).Object.keys},function(e,t,n){var r=n(139),i=n(140);n(458)("keys",(function(){return function(e){return i(r(e))}}))},function(e,t,n){var r=n(56),i=n(82),s=n(456)(!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(57);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(457);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(26),i=n(15),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(460)},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(461),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=g;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(g(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 g(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 k()}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=m(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 m(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=m(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=m(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:k}}function k(){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(464),n(465),n(472),n(476),n(488),n(489),e.exports=n(15).Promise},function(e,t){},function(e,t,n){"use strict";var r=n(466)(!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(27)},function(e,t,n){"use strict";var r=n(469),i=n(138),s=n(87),o={};n(27)(o,n(13)("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(22),i=n(470),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(36),i=n(22),s=n(140);e.exports=n(28)?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(56),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(473);for(var r=n(10),i=n(27),s=n(38),o=n(13)("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(474),i=n(475),s=n(38),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(10),l=n(54),u=n(147),d=n(26),h=n(37),f=n(55),p=n(477),g=n(478),m=n(148),v=n(149).set,_=n(483)(),b=n(88),y=n(150),w=n(484),S=n(151),x=c.TypeError,E=c.process,A=E&&E.versions,C=A&&A.v8||"",k=c.Promise,j="process"==u(E),T=function(){},O=i=b.f,N=!!function(){try{var e=k.resolve(1),t=(e.constructor={})[n(13)("species")]=function(e){e(T,T)};return(j||"function"==typeof PromiseRejectionEvent)&&e.then(T)instanceof t&&0!==C.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(e){}}(),I=function(e){var t;return!(!h(e)||"function"!=typeof(t=e.then))&&t},M=function(e,t){if(!e._n){e._n=!0;var n=e._c;_((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&&D(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=I(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=$(e);if(s&&(t=y((function(){j?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=j||$(e)?2:1),e._a=void 0,s&&t.e)throw t.v}))},$=function(e){return 1!==e._h&&0===(e._a||e._c).length},D=function(e){v.call(c,(function(){var t;j?E.emit("rejectionHandled",e):(t=c.onrejectionhandled)&&t({promise:e,reason:e._v})}))},P=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),M(t,!0))},L=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=I(e))?_((function(){var r={_w:n,_d:!1};try{t.call(e,l(L,r,1),l(P,r,1))}catch(e){P.call(r,e)}})):(n._v=e,n._s=1,M(n,!1))}catch(e){P.call({_w:n,_d:!1},e)}}};N||(k=function(e){p(this,k,"Promise","_h"),f(e),r.call(this);try{e(l(L,this,1),l(P,this,1))}catch(e){P.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(485)(k.prototype,{then:function(e,t){var n=O(m(this,k));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=j?E.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&M(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),s=function(){var e=new r;this.promise=e,this.resolve=l(L,e,1),this.reject=l(P,e,1)},b.f=O=function(e){return e===k||e===o?new s(e):i(e)}),d(d.G+d.W+d.F*!N,{Promise:k}),n(87)(k,"Promise"),n(486)("Promise"),o=n(15).Promise,d(d.S+d.F*!N,"Promise",{reject:function(e){var t=O(this);return(0,t.reject)(e),t.promise}}),d(d.S+d.F*(a||!N),"Promise",{resolve:function(e){return S(a&&this===o?k:this,e)}}),d(d.S+d.F*!(N&&n(487)((function(e){k.all(e).catch(T)}))),"Promise",{all:function(e){var t=this,n=O(t),r=n.resolve,i=n.reject,s=y((function(){var n=[],s=0,o=1;g(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=O(t),r=n.reject,i=y((function(){g(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(54),i=n(479),s=n(480),o=n(22),a=n(141),c=n(481),l={},u={};(t=e.exports=function(e,t,n,d,h){var f,p,g,m,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((m=t?_(o(p=e[b])[0],p[1]):_(e[b]))===l||m===u)return m}else for(g=v.call(e);!(p=g.next()).done;)if((m=i(g,_,p.value,t))===l||m===u)return m}).BREAK=l,t.RETURN=u},function(e,t,n){var r=n(22);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(38),i=n(13)("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(13)("iterator"),s=n(38);e.exports=n(15).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(10),i=n(149).set,s=r.MutationObserver||r.WebKitMutationObserver,o=r.process,a=r.Promise,c="process"==n(57)(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(10).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){var r=n(27);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(10),i=n(15),s=n(36),o=n(28),a=n(13)("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(13)("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(26),i=n(15),s=n(10),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(26),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";n(65);var r=n(0);const i={};i.debug=r.f.LogLevel.DEBUG,i.info=r.f.LogLevel.INFO,i.warn=r.f.LogLevel.WARN,i.error=r.f.LogLevel.ERROR,i.fatal=r.f.LogLevel.FATAL,r.f.WorkerWebsocket=class extends r.f.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.f.log(r.f.LogLevel.ERROR,"Shared Worker Error: "+e)}}get socket(){return{send:e=>this.worker.port.postMessage(["send",e])}}_connect(){this._messageHandler=e=>this._onInitialMessage(e),this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_connect",this._conn.service,this._conn.jid])}_attach(e){this._messageHandler=e=>this._onMessage(e),this._conn.connect_callback=e,this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_attach",this._conn.service])}_attachCallback(e,t){e===r.f.Status.ATTACHED?(this._conn.jid=t,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(r.f.Status.ATTACHED)):e===r.f.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(r.f.Status.ATTACHFAIL))}_disconnect(e,t){t&&this._conn.send(t);const n=Object(r.a)("close",{xmlns:r.f.NS.FRAMING});this._conn.xmlOutput(n.tree());const i=r.f.serialize(n);this._conn.rawOutput(i),this.worker.port.postMessage(["send",i]),this._conn._doDisconnect()}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(r.f.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected?(r.f.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(r.f.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):r.f.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.f.log(r.f.LogLevel.ERROR,e)}else if("log"===n){const e=t[1],n=t[2];r.f.log(i[e],n)}else r.f.log(r.f.LogLevel.ERROR,"Found unhandled service worker message: "+t)}}},function(e,t,n){var r={"./af/LC_MESSAGES/converse.po":[502,139],"./ar/LC_MESSAGES/converse.po":[503,140],"./bg/LC_MESSAGES/converse.po":[504,141],"./ca/LC_MESSAGES/converse.po":[505,142],"./cs/LC_MESSAGES/converse.po":[506,143],"./da/LC_MESSAGES/converse.po":[507,144],"./de/LC_MESSAGES/converse.po":[508,147],"./eo/LC_MESSAGES/converse.po":[509,148],"./es/LC_MESSAGES/converse.po":[510,149],"./eu/LC_MESSAGES/converse.po":[511,150],"./fi/LC_MESSAGES/converse.po":[512,151],"./fr/LC_MESSAGES/converse.po":[513,152],"./gl/LC_MESSAGES/converse.po":[514,153],"./he/LC_MESSAGES/converse.po":[515,154],"./hi/LC_MESSAGES/converse.po":[516,155],"./hu/LC_MESSAGES/converse.po":[517,156],"./id/LC_MESSAGES/converse.po":[518,157],"./it/LC_MESSAGES/converse.po":[519,158],"./ja/LC_MESSAGES/converse.po":[520,159],"./lt/LC_MESSAGES/converse.po":[521,160],"./mr/LC_MESSAGES/converse.po":[522,161],"./nb/LC_MESSAGES/converse.po":[523,162],"./nl/LC_MESSAGES/converse.po":[524,163],"./nl_BE/LC_MESSAGES/converse.po":[525,164],"./oc/LC_MESSAGES/converse.po":[526,165],"./pl/LC_MESSAGES/converse.po":[527,166],"./pt/LC_MESSAGES/converse.po":[528,167],"./pt_BR/LC_MESSAGES/converse.po":[529,168],"./ro/LC_MESSAGES/converse.po":[530,169],"./ru/LC_MESSAGES/converse.po":[531,170],"./sv/LC_MESSAGES/converse.po":[532,171],"./th/LC_MESSAGES/converse.po":[533,172],"./tr/LC_MESSAGES/converse.po":[534,173],"./uk/LC_MESSAGES/converse.po":[535,174],"./vi/LC_MESSAGES/converse.po":[536,175],"./zh_CN/LC_MESSAGES/converse.po":[537,176],"./zh_TW/LC_MESSAGES/converse.po":[538,177]};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=492,e.exports=i},function(e,t,n){var r={"./af":[184,0],"./af.js":[184,0],"./ar":[191,1],"./ar-dz":[185,2],"./ar-dz.js":[185,2],"./ar-kw":[186,3],"./ar-kw.js":[186,3],"./ar-ly":[187,4],"./ar-ly.js":[187,4],"./ar-ma":[188,5],"./ar-ma.js":[188,5],"./ar-sa":[189,6],"./ar-sa.js":[189,6],"./ar-tn":[190,7],"./ar-tn.js":[190,7],"./ar.js":[191,1],"./az":[192,8],"./az.js":[192,8],"./be":[193,9],"./be.js":[193,9],"./bg":[194,10],"./bg.js":[194,10],"./bi":[195,11],"./bi.js":[195,11],"./bm":[196,12],"./bm.js":[196,12],"./bn":[197,13],"./bn.js":[197,13],"./bo":[198,14],"./bo.js":[198,14],"./br":[199,15],"./br.js":[199,15],"./bs":[200,16],"./bs.js":[200,16],"./ca":[201,17],"./ca.js":[201,17],"./cs":[202,18],"./cs.js":[202,18],"./cv":[203,19],"./cv.js":[203,19],"./cy":[204,20],"./cy.js":[204,20],"./da":[205,21],"./da.js":[205,21],"./de":[208,22],"./de-at":[206,23],"./de-at.js":[206,23],"./de-ch":[207,24],"./de-ch.js":[207,24],"./de.js":[208,22],"./dv":[209,25],"./dv.js":[209,25],"./el":[210,26],"./el.js":[210,26],"./en":[220,27],"./en-SG":[211,28],"./en-SG.js":[211,28],"./en-au":[212,29],"./en-au.js":[212,29],"./en-ca":[213,30],"./en-ca.js":[213,30],"./en-gb":[214,31],"./en-gb.js":[214,31],"./en-ie":[215,32],"./en-ie.js":[215,32],"./en-il":[216,33],"./en-il.js":[216,33],"./en-in":[217,34],"./en-in.js":[217,34],"./en-nz":[218,35],"./en-nz.js":[218,35],"./en-tt":[219,36],"./en-tt.js":[219,36],"./en.js":[220,27],"./eo":[221,37],"./eo.js":[221,37],"./es":[225,38],"./es-do":[222,39],"./es-do.js":[222,39],"./es-pr":[223,40],"./es-pr.js":[223,40],"./es-us":[224,41],"./es-us.js":[224,41],"./es.js":[225,38],"./et":[226,42],"./et.js":[226,42],"./eu":[227,43],"./eu.js":[227,43],"./fa":[228,44],"./fa.js":[228,44],"./fi":[229,45],"./fi.js":[229,45],"./fo":[230,46],"./fo.js":[230,46],"./fr":[233,47],"./fr-ca":[231,48],"./fr-ca.js":[231,48],"./fr-ch":[232,49],"./fr-ch.js":[232,49],"./fr.js":[233,47],"./fy":[234,50],"./fy.js":[234,50],"./ga":[235,51],"./ga.js":[235,51],"./gd":[236,52],"./gd.js":[236,52],"./gl":[237,53],"./gl.js":[237,53],"./gom-latn":[238,54],"./gom-latn.js":[238,54],"./gu":[239,55],"./gu.js":[239,55],"./he":[240,56],"./he.js":[240,56],"./hi":[241,57],"./hi.js":[241,57],"./hr":[242,58],"./hr.js":[242,58],"./ht":[243,59],"./ht.js":[243,59],"./hu":[244,60],"./hu.js":[244,60],"./hy-am":[245,61],"./hy-am.js":[245,61],"./id":[246,62],"./id.js":[246,62],"./index.d.ts":[539,145],"./is":[247,63],"./is.js":[247,63],"./it":[249,64],"./it-ch":[248,65],"./it-ch.js":[248,65],"./it.js":[249,64],"./ja":[250,66],"./ja.js":[250,66],"./jv":[251,67],"./jv.js":[251,67],"./ka":[252,68],"./ka.js":[252,68],"./kk":[253,69],"./kk.js":[253,69],"./km":[254,70],"./km.js":[254,70],"./kn":[255,71],"./kn.js":[255,71],"./ko":[256,72],"./ko.js":[256,72],"./ku":[257,73],"./ku.js":[257,73],"./ky":[258,74],"./ky.js":[258,74],"./lb":[259,75],"./lb.js":[259,75],"./lo":[260,76],"./lo.js":[260,76],"./lt":[261,77],"./lt.js":[261,77],"./lv":[262,78],"./lv.js":[262,78],"./me":[263,79],"./me.js":[263,79],"./mi":[264,80],"./mi.js":[264,80],"./mk":[265,81],"./mk.js":[265,81],"./ml":[266,82],"./ml.js":[266,82],"./mn":[267,83],"./mn.js":[267,83],"./mr":[268,84],"./mr.js":[268,84],"./ms":[270,85],"./ms-my":[269,86],"./ms-my.js":[269,86],"./ms.js":[270,85],"./mt":[271,87],"./mt.js":[271,87],"./my":[272,88],"./my.js":[272,88],"./nb":[273,89],"./nb.js":[273,89],"./ne":[274,90],"./ne.js":[274,90],"./nl":[276,91],"./nl-be":[275,92],"./nl-be.js":[275,92],"./nl.js":[276,91],"./nn":[277,93],"./nn.js":[277,93],"./oc-lnc":[278,94],"./oc-lnc.js":[278,94],"./pa-in":[279,95],"./pa-in.js":[279,95],"./pl":[280,96],"./pl.js":[280,96],"./pt":[282,97],"./pt-br":[281,98],"./pt-br.js":[281,98],"./pt.js":[282,97],"./ro":[283,99],"./ro.js":[283,99],"./ru":[284,100],"./ru.js":[284,100],"./rw":[285,101],"./rw.js":[285,101],"./sd":[286,102],"./sd.js":[286,102],"./se":[287,103],"./se.js":[287,103],"./si":[288,104],"./si.js":[288,104],"./sk":[289,105],"./sk.js":[289,105],"./sl":[290,106],"./sl.js":[290,106],"./sq":[291,107],"./sq.js":[291,107],"./sr":[293,108],"./sr-cyrl":[292,109],"./sr-cyrl.js":[292,109],"./sr.js":[293,108],"./ss":[294,110],"./ss.js":[294,110],"./sv":[295,111],"./sv.js":[295,111],"./sw":[296,112],"./sw.js":[296,112],"./ta":[297,113],"./ta.js":[297,113],"./te":[298,114],"./te.js":[298,114],"./tet":[299,115],"./tet.js":[299,115],"./tg":[300,116],"./tg.js":[300,116],"./th":[301,117],"./th.js":[301,117],"./tk":[302,118],"./tk.js":[302,118],"./tl-ph":[303,119],"./tl-ph.js":[303,119],"./tlh":[304,120],"./tlh.js":[304,120],"./tr":[305,121],"./tr.js":[305,121],"./types.d.ts":[540,146],"./tzl":[306,122],"./tzl.js":[306,122],"./tzm":[308,123],"./tzm-latn":[307,124],"./tzm-latn.js":[307,124],"./tzm.js":[308,123],"./ug-cn":[309,125],"./ug-cn.js":[309,125],"./uk":[310,126],"./uk.js":[310,126],"./ur":[311,127],"./ur.js":[311,127],"./uz":[313,128],"./uz-latn":[312,129],"./uz-latn.js":[312,129],"./uz.js":[313,128],"./vi":[314,130],"./vi.js":[314,130],"./x-pseudo":[315,131],"./x-pseudo.js":[315,131],"./yo":[316,132],"./yo.js":[316,132],"./zh":[320,133],"./zh-cn":[317,134],"./zh-cn.js":[317,134],"./zh-hk":[318,135],"./zh-hk.js":[318,135],"./zh-tw":[319,136],"./zh-tw.js":[319,136],"./zh.js":[320,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=493,e.exports=i},function(e,t,n){var r=n(495)({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});e.exports=r},function(e,t){e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},function(e,t,n){var r=n(497);"string"==typeof r&&(r=[[e.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(499)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=n(498)(!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(500);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 g(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 m(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),g(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),g(e,t),t}(t),r=E.bind(null,n,t),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),r=x.bind(null,n),i=function(){m(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=n(63),i=n.n(r),s=(n(322),n(65),n(23));var o=function(){this.__data__=[],this.size=0};var a=function(e,t){return e===t||e!=e&&t!=t};var c=function(e,t){for(var n=e.length;n--;)if(a(e[n][0],t))return n;return-1},l=Array.prototype.splice;var u=function(e){var t=this.__data__,n=c(t,e);return!(n<0)&&(n==t.length-1?t.pop():l.call(t,n,1),--this.size,!0)};var d=function(e){var t=this.__data__,n=c(t,e);return n<0?void 0:t[n][1]};var h=function(e){return c(this.__data__,e)>-1};var f=function(e,t){var n=this.__data__,r=c(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function p(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])}}p.prototype.clear=o,p.prototype.delete=u,p.prototype.get=d,p.prototype.has=h,p.prototype.set=f;var g=p;var m=function(){this.__data__=new g,this.size=0};var v=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var _=function(e){return this.__data__.get(e)};var b=function(e){return this.__data__.has(e)},y=n(4),w=y.a.Symbol,S=Object.prototype,x=S.hasOwnProperty,E=S.toString,A=w?w.toStringTag:void 0;var C=function(e){var t=x.call(e,A),n=e[A];try{e[A]=void 0;var r=!0}catch(e){}var i=E.call(e);return r&&(t?e[A]=n:delete e[A]),i},k=Object.prototype.toString;var j=function(e){return k.call(e)},T=w?w.toStringTag:void 0;var O=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?C(e):j(e)};var N=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var I,M=function(e){if(!N(e))return!1;var t=O(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},R=y.a["__core-js_shared__"],$=(I=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var D=function(e){return!!$&&$ in e},P=Function.prototype.toString;var L=function(e){if(null!=e){try{return P.call(e)}catch(e){}try{return e+""}catch(e){}}return""},z=/^\[object .+?Constructor\]$/,F=Function.prototype,B=Object.prototype,q=F.toString,U=B.hasOwnProperty,H=RegExp("^"+q.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var V=function(e){return!(!N(e)||D(e))&&(M(e)?H:z).test(L(e))};var W=function(e,t){return null==e?void 0:e[t]};var G=function(e,t){var n=W(e,t);return V(n)?n:void 0},J=G(y.a,"Map"),Q=G(Object,"create");var Y=function(){this.__data__=Q?Q(null):{},this.size=0};var K=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},X=Object.prototype.hasOwnProperty;var Z=function(e){var t=this.__data__;if(Q){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return X.call(t,e)?t[e]:void 0},ee=Object.prototype.hasOwnProperty;var te=function(e){var t=this.__data__;return Q?void 0!==t[e]:ee.call(t,e)};var ne=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Q&&void 0===t?"__lodash_hash_undefined__":t,this};function re(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])}}re.prototype.clear=Y,re.prototype.delete=K,re.prototype.get=Z,re.prototype.has=te,re.prototype.set=ne;var ie=re;var se=function(){this.size=0,this.__data__={hash:new ie,map:new(J||g),string:new ie}};var oe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ae=function(e,t){var n=e.__data__;return oe(t)?n["string"==typeof t?"string":"hash"]:n.map};var ce=function(e){var t=ae(this,e).delete(e);return this.size-=t?1:0,t};var le=function(e){return ae(this,e).get(e)};var ue=function(e){return ae(this,e).has(e)};var de=function(e,t){var n=ae(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function he(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])}}he.prototype.clear=se,he.prototype.delete=ce,he.prototype.get=le,he.prototype.has=ue,he.prototype.set=de;var fe=he;var pe=function(e,t){var n=this.__data__;if(n instanceof g){var r=n.__data__;if(!J||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new fe(r)}return n.set(e,t),this.size=n.size,this};function ge(e){var t=this.__data__=new g(e);this.size=t.size}ge.prototype.clear=m,ge.prototype.delete=v,ge.prototype.get=_,ge.prototype.has=b,ge.prototype.set=pe;var me=ge;var ve=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e},_e=function(){try{var e=G(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var be=function(e,t,n){"__proto__"==t&&_e?_e(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},ye=Object.prototype.hasOwnProperty;var we=function(e,t,n){var r=e[t];ye.call(e,t)&&a(r,n)&&(void 0!==n||t in e)||be(e,t,n)};var Se=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?be(n,a,c):we(n,a,c)}return n};var xe=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var Ee=function(e){return null!=e&&"object"==typeof e};var Ae=function(e){return Ee(e)&&"[object Arguments]"==O(e)},Ce=Object.prototype,ke=Ce.hasOwnProperty,je=Ce.propertyIsEnumerable,Te=Ae(function(){return arguments}())?Ae:function(e){return Ee(e)&&ke.call(e,"callee")&&!je.call(e,"callee")},Oe=Array.isArray,Ne=n(18),Ie=/^(?:0|[1-9]\d*)$/;var Me=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ie.test(e))&&e>-1&&e%1==0&&e<t};var Re=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},$e={};$e["[object Float32Array]"]=$e["[object Float64Array]"]=$e["[object Int8Array]"]=$e["[object Int16Array]"]=$e["[object Int32Array]"]=$e["[object Uint8Array]"]=$e["[object Uint8ClampedArray]"]=$e["[object Uint16Array]"]=$e["[object Uint32Array]"]=!0,$e["[object Arguments]"]=$e["[object Array]"]=$e["[object ArrayBuffer]"]=$e["[object Boolean]"]=$e["[object DataView]"]=$e["[object Date]"]=$e["[object Error]"]=$e["[object Function]"]=$e["[object Map]"]=$e["[object Number]"]=$e["[object Object]"]=$e["[object RegExp]"]=$e["[object Set]"]=$e["[object String]"]=$e["[object WeakMap]"]=!1;var De=function(e){return Ee(e)&&Re(e.length)&&!!$e[O(e)]};var Pe=function(e){return function(t){return e(t)}},Le=n(11),ze=Le.a&&Le.a.isTypedArray,Fe=ze?Pe(ze):De,Be=Object.prototype.hasOwnProperty;var qe=function(e,t){var n=Oe(e),r=!n&&Te(e),i=!n&&!r&&Object(Ne.a)(e),s=!n&&!r&&!i&&Fe(e),o=n||r||i||s,a=o?xe(e.length,String):[],c=a.length;for(var l in e)!t&&!Be.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Me(l,c))||a.push(l);return a},Ue=Object.prototype;var He=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ue)};var Ve=function(e,t){return function(n){return e(t(n))}},We=Ve(Object.keys,Object),Ge=Object.prototype.hasOwnProperty;var Je=function(e){if(!He(e))return We(e);var t=[];for(var n in Object(e))Ge.call(e,n)&&"constructor"!=n&&t.push(n);return t};var Qe=function(e){return null!=e&&Re(e.length)&&!M(e)};var Ye=function(e){return Qe(e)?qe(e):Je(e)};var Ke=function(e,t){return e&&Se(t,Ye(t),e)};var Xe=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},Ze=Object.prototype.hasOwnProperty;var et=function(e){if(!N(e))return Xe(e);var t=He(e),n=[];for(var r in e)("constructor"!=r||!t&&Ze.call(e,r))&&n.push(r);return n};var tt=function(e){return Qe(e)?qe(e,!0):et(e)};var nt=function(e,t){return e&&Se(t,tt(t),e)},rt=n(157);var it=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var st=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 ot=function(){return[]},at=Object.prototype.propertyIsEnumerable,ct=Object.getOwnPropertySymbols,lt=ct?function(e){return null==e?[]:(e=Object(e),st(ct(e),(function(t){return at.call(e,t)})))}:ot;var ut=function(e,t){return Se(e,lt(e),t)};var dt=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},ht=Ve(Object.getPrototypeOf,Object),ft=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)dt(t,lt(e)),e=ht(e);return t}:ot;var pt=function(e,t){return Se(e,ft(e),t)};var gt=function(e,t,n){var r=t(e);return Oe(e)?r:dt(r,n(e))};var mt=function(e){return gt(e,Ye,lt)};var vt=function(e){return gt(e,tt,ft)},_t=G(y.a,"DataView"),bt=G(y.a,"Promise"),yt=G(y.a,"Set"),wt=G(y.a,"WeakMap"),St=L(_t),xt=L(J),Et=L(bt),At=L(yt),Ct=L(wt),kt=O;(_t&&"[object DataView]"!=kt(new _t(new ArrayBuffer(1)))||J&&"[object Map]"!=kt(new J)||bt&&"[object Promise]"!=kt(bt.resolve())||yt&&"[object Set]"!=kt(new yt)||wt&&"[object WeakMap]"!=kt(new wt))&&(kt=function(e){var t=O(e),n="[object Object]"==t?e.constructor:void 0,r=n?L(n):"";if(r)switch(r){case St:return"[object DataView]";case xt:return"[object Map]";case Et:return"[object Promise]";case At:return"[object Set]";case Ct:return"[object WeakMap]"}return t});var jt=kt,Tt=Object.prototype.hasOwnProperty;var Ot=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Tt.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Nt=y.a.Uint8Array;var It=function(e){var t=new e.constructor(e.byteLength);return new Nt(t).set(new Nt(e)),t};var Mt=function(e,t){var n=t?It(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Rt=/\w*$/;var $t=function(e){var t=new e.constructor(e.source,Rt.exec(e));return t.lastIndex=e.lastIndex,t},Dt=w?w.prototype:void 0,Pt=Dt?Dt.valueOf:void 0;var Lt=function(e){return Pt?Object(Pt.call(e)):{}};var zt=function(e,t){var n=t?It(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var Ft=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return It(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return Mt(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 zt(e,n);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return $t(e);case"[object Set]":return new r;case"[object Symbol]":return Lt(e)}},Bt=Object.create,qt=function(){function e(){}return function(t){if(!N(t))return{};if(Bt)return Bt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Ut=function(e){return"function"!=typeof e.constructor||He(e)?{}:qt(ht(e))};var Ht=function(e){return Ee(e)&&"[object Map]"==jt(e)},Vt=Le.a&&Le.a.isMap,Wt=Vt?Pe(Vt):Ht;var Gt=function(e){return Ee(e)&&"[object Set]"==jt(e)},Jt=Le.a&&Le.a.isSet,Qt=Jt?Pe(Jt):Gt,Yt={};Yt["[object Arguments]"]=Yt["[object Array]"]=Yt["[object ArrayBuffer]"]=Yt["[object DataView]"]=Yt["[object Boolean]"]=Yt["[object Date]"]=Yt["[object Float32Array]"]=Yt["[object Float64Array]"]=Yt["[object Int8Array]"]=Yt["[object Int16Array]"]=Yt["[object Int32Array]"]=Yt["[object Map]"]=Yt["[object Number]"]=Yt["[object Object]"]=Yt["[object RegExp]"]=Yt["[object Set]"]=Yt["[object String]"]=Yt["[object Symbol]"]=Yt["[object Uint8Array]"]=Yt["[object Uint8ClampedArray]"]=Yt["[object Uint16Array]"]=Yt["[object Uint32Array]"]=!0,Yt["[object Error]"]=Yt["[object Function]"]=Yt["[object WeakMap]"]=!1;var Kt=function e(t,n,r,i,s,o){var a,c=1&n,l=2&n,u=4&n;if(r&&(a=s?r(t,i,s,o):r(t)),void 0!==a)return a;if(!N(t))return t;var d=Oe(t);if(d){if(a=Ot(t),!c)return it(t,a)}else{var h=jt(t),f="[object Function]"==h||"[object GeneratorFunction]"==h;if(Object(Ne.a)(t))return Object(rt.a)(t,c);if("[object Object]"==h||"[object Arguments]"==h||f&&!s){if(a=l||f?{}:Ut(t),!c)return l?pt(t,nt(a,t)):ut(t,Ke(a,t))}else{if(!Yt[h])return s?t:{};a=Ft(t,h,c)}}o||(o=new me);var p=o.get(t);if(p)return p;o.set(t,a),Qt(t)?t.forEach((function(i){a.add(e(i,n,r,i,t,o))})):Wt(t)&&t.forEach((function(i,s){a.set(s,e(i,n,r,s,t,o))}));var g=d?void 0:(u?l?vt:mt:l?tt:Ye)(t);return ve(g||t,(function(i,s){g&&(i=t[s=i]),we(a,s,e(i,n,r,s,t,o))})),a};var Xt=function(e){return Kt(e,5)};var Zt=function(e){return"string"==typeof e||!Oe(e)&&Ee(e)&&"[object String]"==O(e)};var en=function(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))};function tn(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function nn(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var rn=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)}},sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",on=/^~~local_forage_type~([^~]+)~/,an="__lfsc__:".length,cn=an+"arbf".length,ln=Object.prototype.toString;function un(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=sn.indexOf(e[t]),r=sn.indexOf(e[t+1]),i=sn.indexOf(e[t+2]),s=sn.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 dn(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=sn[n[t]>>2],r+=sn[(3&n[t])<<4|n[t+1]>>4],r+=sn[(15&n[t+1])<<2|n[t+2]>>6],r+=sn[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 hn={serialize:function(e,t){var n="";if(e&&(n=ln.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===ln.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+dn(r))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n="~~local_forage_type~"+e.type+"~"+dn(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,an))return JSON.parse(e);var t,n=e.substring(cn),r=e.substring(an,cn);if("blob"===r&&on.test(n)){var i=n.match(on);t=i[1],n=n.substring(i[0].length)}var s=un(n);switch(r){case"arbf":return s;case"blob":return rn([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:un,bufferToString:dn};function fn(e,t){let n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}const pn={serializer:{serialize:hn.serialize,deserialize:hn.deserialize}};var gn={_driver:"sessionStorageWrapper",_initStorage:function(e){if(pn.keyPrefix=fn(e,this._defaultConfig),e)for(const t in e)pn[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=pn.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=pn.serializer.deserialize(o)),o=e(o,r.substring(n),i++),void 0!==o)return o}}));return en(n,t),n},getItem:function(e,t){e=nn(e);const n=this.ready().then((function(){let t=sessionStorage.getItem(pn.keyPrefix+e);return t&&(t=pn.serializer.deserialize(t)),t}));return en(n,t),n},setItem:function(e,t,n){e=nn(e);const r=this.ready().then((function(){void 0===t&&(t=null);const n=t;return new Promise((function(r,i){pn.serializer.serialize(t,(function(t,s){if(s)i(s);else try{sessionStorage.setItem(pn.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}}))}))}));return en(r,n),r},removeItem:function(e,t){e=nn(e);const n=this.ready().then((function(){sessionStorage.removeItem(pn.keyPrefix+e)}));return en(n,t),n},clear:function(e){const t=this.ready().then((function(){const e=pn.keyPrefix;for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}}));return en(t,e),t},length:function(e){const t=this.keys().then((function(e){return e.length}));return en(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(pn.keyPrefix.length)),t}));return en(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(pn.keyPrefix)&&t.push(e.substring(pn.keyPrefix.length))}return t}));return en(t,e),t},dropInstance:function(e,t){if(t=tn.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(fn(e,n._defaultConfig)):t(e.name+"/")})).then((function(e){for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}})):Promise.reject(new Error("Invalid arguments")),en(r,t),r}};function mn(){return(65536*(1+Math.random())|0).toString(16).substring(1)}class vn{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.");Zt(t)?this.storeInitialized=this.initStore(t):(this.store=t,this.storeInitialized=Promise.resolve()),this.name=e}async initStore(e){if("session"===e)s.setDriver(gn._driver);else if("local"===e)await s.config({driver:s.LOCALSTORAGE});else if("indexed"!==e)throw new Error("Skeletor.storage: No storage type was specified");this.store=s}async clear(){await this.store.removeItem(this.name).catch(e=>console.error(e));const e=new RegExp(`^${this.name}-`),t=(await this.store.keys()).filter(t=>e.test(t));await Promise.all(t.map(e=>this.store.removeItem(e).catch(e=>console.error(e))))}sync(e){const t=this;async function n(e,n,r){let i,s,o,a;const c=n.collection;["patch","update"].includes(e)&&(a=Xt(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=mn()+mn()+"-"+mn()+"-"+mn()+"-"+mn()+"-"+mn()+mn()+mn(),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}}vn.sessionStorageInitialized=s.defineDriver(gn),vn.localForage=s;var _n=vn,bn=n(158),yn=n.n(bn),wn=n(3),Sn=n.n(wn),xn=Function.prototype,En=Object.prototype,An=xn.toString,Cn=En.hasOwnProperty,kn=An.call(Object);var jn=function(e){if(!Ee(e)||"[object Object]"!=O(e))return!1;var t=ht(e);if(null===t)return!0;var n=Cn.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&An.call(n)==kn};var Tn,On,Nn,In,Mn=function(e){return Ee(e)&&1===e.nodeType&&!jn(e)};const Rn={debug:0,info:1,warn:2,error:3,fatal:4},$n=Object.assign({debug:null!==(Tn=console)&&void 0!==Tn&&Tn.log?console.log.bind(console):function(){},error:null!==(On=console)&&void 0!==On&&On.log?console.log.bind(console):function(){},info:null!==(Nn=console)&&void 0!==Nn&&Nn.log?console.log.bind(console):function(){},warn:null!==(In=console)&&void 0!==In&&In.log?console.log.bind(console):function(){}},console);var Dn={setLogLevel(e){if(!["debug","info","warn","error","fatal"].includes(e))throw new Error("Invalid loglevel: "+e);this.loglevel=e},log(e,t,n=""){if(Rn[t]<Rn[this.loglevel])return;"error"===t||"fatal"===t?n=n||"color: maroon":"debug"===t&&(n=n||"color: green"),e instanceof Error?e=e.stack:Mn(e)&&(e=e.outerHTML);const r=n?"%c":"";"error"===t?$n.error(`${r} ERROR: ${e}`,n):"warn"===t?$n.warn(`${r} ${(new Date).toISOString()} WARNING: ${e}`,n):"fatal"===t?$n.error(`${r} FATAL: ${e}`,n):"debug"===t?$n.debug(`${r} ${(new Date).toISOString()} DEBUG: ${e}`,n):$n.info(`${r} ${(new Date).toISOString()} INFO: ${e}`,n)},debug(e,t){this.log(e,"debug",t)},error(e,t){this.log(e,"error",t)},info(e,t){this.log(e,"info",t)},warn(e,t){this.log(e,"warn",t)},fatal(e,t){this.log(e,"fatal",t)}},Pn=n(159),Ln=n.n(Pn),zn=n(41),Fn=n.n(zn),Bn=n(42),qn=n.n(Bn),Un=n(32),Hn=n.n(Un),Vn=n(160),Wn=n.n(Vn),Gn=n(58),Jn=n.n(Gn),Qn=n(161),Yn=n.n(Qn),Kn=n(29),Xn=n.n(Kn),Zn=n(90),er=n.n(Zn),tr=n(162),nr=n.n(tr),rr=n(163),ir=n.n(rr),sr=n(89),or=n.n(sr);function ar(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=[]}qn()(ar.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,Ln()(arguments,4))},_overrideAttribute:function(e,t){let n=t.overrides[e];if("function"==typeof n){let t={};t[this.name]=this.plugged;let r=er()(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;Fn()(t,(function(t,r){if("events"===r)e.prototype[r]=qn()(t,e.prototype[r]);else if("function"==typeof t){let i={};i[n.name]=n.plugged;let s=er()(n.wrappedOverride,r,t,e.prototype[r],i);e.prototype[r]=s}else e.prototype[r]=t}))},loadPluginDependencies:function(e){Fn()(e.dependencies,t=>{let n=this.plugins[t];if(n){if(Hn()(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){Fn()(Object.keys(e.overrides||{}),t=>{let n=e.overrides[t];"object"==typeof n?void 0===this.plugged[t]?this.throwUndefinedDependencyError(`Plugin "${e.__name__}" tried to override "${t}" but it's not found.`):this._extendObject(this.plugged[t],n):this._overrideAttribute(t,e)})},initializePlugin:function(e){Hn()(Xn()(this.allowed_plugins),e.__name__)&&(Hn()(this.initialized_plugins,e.__name__)||(Wn()(e.enabled)&&e.enabled||Jn()(e.enabled)&&e.enabled(this.plugged)||Yn()(e.enabled))&&(qn()(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=[]){ir()(this.plugins)&&(this.properties=e,this.allowed_plugins=nr()(this.plugins,(function(e,r){return(!t.length||t.length&&Hn()(t,r))&&!Hn()(n,r)})),Fn()(or()(this.allowed_plugins),this.initializePlugin.bind(this)))}});var cr={enable:function(e,t,n){void 0===n&&(n="pluginSocket"),void 0===t&&(t="plugged");let r={};return r[n]=new ar(e,t),qn()(e,r)}},lr=n(164),ur=n.n(lr),dr=n(165),hr=n.n(dr),fr=n(2),pr=n.n(fr),gr=n(0);var mr=function(e,t){var n=qt(e);return null==t?n:Ke(n,t)};var vr=function(e){return e};var _r=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)},br=Math.max;var yr=function(e,t,n){return t=br(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=br(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),_r(e,this,a)}};var wr=function(e){return function(){return e}},Sr=_e?function(e,t){return _e(e,"toString",{configurable:!0,enumerable:!1,value:wr(t),writable:!0})}:vr,xr=Date.now;var Er=function(e){var t=0,n=0;return function(){var r=xr(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Sr);var Ar=function(e,t){return Er(yr(e,t,vr),e+"")};var Cr=function(e,t,n){if(!N(n))return!1;var r=typeof t;return!!("number"==r?Qe(n)&&Me(t,n.length):"string"==r&&t in n)&&a(n[t],e)};var kr=function(e){return Ar((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&&Cr(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}))}((function(e,t){Se(t,tt(t),e)})),jr=Object.prototype.hasOwnProperty;var Tr=function(e,t){return null!=e&&jr.call(e,t)};var Or=function(e){return"symbol"==typeof e||Ee(e)&&"[object Symbol]"==O(e)},Nr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ir=/^\w*$/;var Mr=function(e,t){if(Oe(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Or(e))||(Ir.test(e)||!Nr.test(e)||null!=t&&e in Object(t))};function Rr(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(Rr.Cache||fe),n}Rr.Cache=fe;var $r=Rr;var Dr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Pr=/\\(\\)?/g,Lr=function(e){var t=$r(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(Dr,(function(e,n,r,i){t.push(r?i.replace(Pr,"$1"):n||e)})),t}));var zr=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},Fr=w?w.prototype:void 0,Br=Fr?Fr.toString:void 0;var qr=function e(t){if("string"==typeof t)return t;if(Oe(t))return zr(t,e)+"";if(Or(t))return Br?Br.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var Ur=function(e){return null==e?"":qr(e)};var Hr=function(e,t){return Oe(e)?e:Mr(e,t)?[e]:Lr(Ur(e))};var Vr=function(e){if("string"==typeof e||Or(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Wr=function(e,t,n){for(var r=-1,i=(t=Hr(t,e)).length,s=!1;++r<i;){var o=Vr(t[r]);if(!(s=null!=e&&n(e,o)))break;e=e[o]}return s||++r!=i?s:!!(i=null==e?0:e.length)&&Re(i)&&Me(o,i)&&(Oe(e)||Te(e))};var Gr=function(e,t){return null!=e&&Wr(e,t,Tr)};var Jr=function(e,t,n){var r=-1,i=(t=Hr(t,e)).length;for(i||(i=1,e=void 0);++r<i;){var s=null==e?void 0:e[Vr(t[r])];void 0===s&&(r=i,s=n),e=M(s)?s.call(e):s}return e};Error;function Qr(e,t){const n=this;let r;return r=e&&Gr(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},kr(r,n,t),r.prototype=mr(n.prototype,e),r.prototype.constructor=r,r.__super__=n.prototype,r}function Yr(){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 Kr(){throw new Error('A "url" property or function must be specified')}function Xr(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 Zr={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};function ei(e){const t=Jr(e,"browserStorage")||Jr(e.collection,"browserStorage");return t?t.sync():ti}function ti(e,t,n={}){const r={type:Zr[e],dataType:"json"};n.url||(r.url=Jr(t,"url")||Kr()),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)}(kr(r,n));return t.trigger("request",t,s,n),s}var ni=Object.prototype.hasOwnProperty;var ri=function(e){if(null==e)return!0;if(Qe(e)&&(Oe(e)||"string"==typeof e||"function"==typeof e.splice||Object(Ne.a)(e)||Fe(e)||Te(e)))return!e.length;var t=jt(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(He(e))return!Je(e).length;for(var n in e)if(ni.call(e,n))return!1;return!0},ii=/\s/;var si=function(e){for(var t=e.length;t--&&ii.test(e.charAt(t)););return t},oi=/^\s+/;var ai=function(e){return e?e.slice(0,si(e)+1).replace(oi,""):e},ci=/^[-+]0x[0-9a-f]+$/i,li=/^0b[01]+$/i,ui=/^0o[0-7]+$/i,di=parseInt;var hi=function(e){if("number"==typeof e)return e;if(Or(e))return NaN;if(N(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=N(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=ai(e);var n=li.test(e);return n||ui.test(e)?di(e.slice(2),n?2:8):ci.test(e)?NaN:+e};var fi=function(e){return e?(e=hi(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var pi=function(e){var t=fi(e),n=t%1;return t==t?n?t-n:t:0};var gi=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=pi(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}};var mi=function(e){return gi(2,e)},vi=0;var _i=function(e){var t=++vi;return Ur(e)+t};const bi={},yi=/\s+/;let wi;const Si=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=Ye(n);o<s.length;o++)t=Si(e,t,s[o],n[s[o]],i)}else if(n&&yi.test(n))for(s=n.split(yi);o<s.length;o++)t=e(t,s[o],r,i);else t=e(t,n,r,i);return t};bi.on=function(e,t,n){if(this._events=Si(xi,this._events||{},e,t,{context:n,ctx:this,listening:wi}),wi){(this._listeners||(this._listeners={}))[wi.id]=wi,wi.interop=!1}return this},bi.listenTo=function(e,t,n){if(!e)return this;const r=e._listenId||(e._listenId=_i("l")),i=this._listeningTo||(this._listeningTo={});let s=wi=i[r];s||(this._listenId||(this._listenId=_i("l")),s=wi=i[r]=new Ti(this,e));const o=Ei(e,t,n,this);if(wi=void 0,o)throw o;return s.interop&&s.on(t,n),this};const xi=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},Ei=function(e,t,n,r){try{e.on(t,n,r)}catch(e){return e}};bi.off=function(e,t,n){return this._events?(this._events=Si(Ai,this._events,e,t,{context:n,listeners:this._listeners}),this):this},bi.stopListening=function(e,t,n){const r=this._listeningTo;if(!r)return this;const i=e?[e._listenId]:Ye(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 ri(r)&&(this._listeningTo=void 0),this};const Ai=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]:Ye(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=Ye(s);a<o.length;a++)s[o[a]].cleanup()};bi.once=function(e,t,n){const r=Si(Ci,{},e,t,this.off.bind(this));return"string"==typeof e&&null==n&&(t=void 0),this.on(r,t,n)},bi.listenToOnce=function(e,t,n){const r=Si(Ci,{},t,n,this.stopListening.bind(this,e));return this.listenTo(e,r)};const Ci=function(e,t,n,r){if(n){const i=e[t]=mi((function(){r(t,i),n.apply(this,arguments)}));i._callback=n}return e};bi.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 Si(ki,this._events,e,void 0,n),this};const ki=function(e,t,n,r){if(e){const n=e[t];let i=e.all;n&&i&&(i=i.slice()),n&&ji(n,r),i&&ji(i,[t].concat(r))}return e},ji=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}},Ti=function(e,t){this.id=e._listenId,this.listener=e,this.obj=t,this.interop=!0,this.count=0,this._events=void 0};Ti.prototype.on=bi.on,Ti.prototype.off=function(e,t){let n;this.interop?(this._events=Si(Ai,this._events,e,t,{context:void 0,listeners:void 0}),n=!this._events):(this.count--,n=0===this.count),n&&this.cleanup()},Ti.prototype.cleanup=function(){delete this.listener._listeningTo[this.obj._listenId],this.interop||delete this.obj._listeners[this.id]},bi.bind=bi.on,bi.unbind=bi.off;var Oi=function(e){return Kt(e,4)},Ni=Object.prototype,Ii=Ni.hasOwnProperty,Mi=Ar((function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&Cr(t[0],t[1],i)&&(r=1);++n<r;)for(var s=t[n],o=tt(s),c=-1,l=o.length;++c<l;){var u=o[c],d=e[u];(void 0===d||a(d,Ni[u])&&!Ii.call(e,u))&&(e[u]=s[u])}return e}));var Ri=function(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)},$i=Ar((function(e,t){return Ri(e,1,t)}));var Di=function(e){return function(t){return null==e?void 0:e[t]}}({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),Pi=/[&<>"']/g,Li=RegExp(Pi.source);var zi=function(e){return(e=Ur(e))&&Li.test(e)?e.replace(Pi,Di):e};var Fi=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}},Bi=Fi();var qi=function(e,t){return e&&Bi(e,t,Ye)};var Ui=function(e,t,n,r){return qi(e,(function(e,i,s){t(r,n(e),i,s)})),r};var Hi=function(e,t){return function(n,r){return Ui(n,e,t(r),{})}},Vi=Object.prototype.toString,Wi=Hi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Vi.call(t)),e[t]=n}),wr(vr));var Gi=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Ji=function(e){return this.__data__.has(e)};function Qi(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new fe;++t<n;)this.add(e[t])}Qi.prototype.add=Qi.prototype.push=Gi,Qi.prototype.has=Ji;var Yi=Qi;var Ki=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 Xi=function(e,t){return e.has(t)};var Zi=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 Yi:void 0;for(s.set(e,t),s.set(t,e);++d<a;){var p=e[d],g=t[d];if(r)var m=o?r(g,p,d,t,e,s):r(p,g,d,e,t,s);if(void 0!==m){if(m)continue;h=!1;break}if(f){if(!Ki(t,(function(e,t){if(!Xi(f,t)&&(p===e||i(p,e,n,r,s)))return f.push(t)}))){h=!1;break}}else if(p!==g&&!i(p,g,n,r,s)){h=!1;break}}return s.delete(e),s.delete(t),h};var es=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n};var ts=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},ns=w?w.prototype:void 0,rs=ns?ns.valueOf:void 0;var is=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 Nt(e),new Nt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+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 c=es;case"[object Set]":var l=1&r;if(c||(c=ts),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;r|=2,o.set(e,t);var d=Zi(c(e),c(t),r,i,s,o);return o.delete(e),d;case"[object Symbol]":if(rs)return rs.call(e)==rs.call(t)}return!1},ss=Object.prototype.hasOwnProperty;var os=function(e,t,n,r,i,s){var o=1&n,a=mt(e),c=a.length;if(c!=mt(t).length&&!o)return!1;for(var l=c;l--;){var u=a[l];if(!(o?u in t:ss.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 g=e[u=a[l]],m=t[u];if(r)var v=o?r(m,g,u,t,e,s):r(g,m,u,e,t,s);if(!(void 0===v?g===m||i(g,m,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,r,i,s){var o=Oe(e),a=Oe(t),c=o?"[object Array]":jt(e),l=a?"[object Array]":jt(t),u="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),d="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l),h=c==l;if(h&&Object(Ne.a)(e)){if(!Object(Ne.a)(t))return!1;o=!0,u=!1}if(h&&!u)return s||(s=new me),o||Fe(e)?Zi(e,t,n,r,i,s):is(e,t,c,n,r,i,s);if(!(1&n)){var f=u&&as.call(e,"__wrapped__"),p=d&&as.call(t,"__wrapped__");if(f||p){var g=f?e.value():e,m=p?t.value():t;return s||(s=new me),i(g,m,n,r,s)}}return!!h&&(s||(s=new me),os(e,t,n,r,i,s))};var ls=function e(t,n,r,i,s){return t===n||(null==t||null==n||!Ee(t)&&!Ee(n)?t!=t&&n!=n:cs(t,n,r,i,e,s))};var us=function(e,t){return ls(e,t)};var ds=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 me;if(r)var h=r(l,u,c,e,t,d);if(!(void 0===h?ls(u,l,3,r,d):h))return!1}}return!0};var hs=function(e){return e==e&&!N(e)};var fs=function(e){for(var t=Ye(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,hs(i)]}return t};var ps=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}};var gs=function(e){var t=fs(e);return 1==t.length&&t[0][2]?ps(t[0][0],t[0][1]):function(n){return n===e||ds(n,e,t)}};var ms=function(e,t){for(var n=0,r=(t=Hr(t,e)).length;null!=e&&n<r;)e=e[Vr(t[n++])];return n&&n==r?e:void 0};var vs=function(e,t,n){var r=null==e?void 0:ms(e,t);return void 0===r?n:r};var _s=function(e,t){return null!=e&&t in Object(e)};var bs=function(e,t){return null!=e&&Wr(e,t,_s)};var ys=function(e,t){return Mr(e)&&hs(t)?ps(Vr(e),t):function(n){var r=vs(n,e);return void 0===r&&r===t?bs(n,e):ls(t,r,3)}};var ws=function(e){return function(t){return null==t?void 0:t[e]}};var Ss=function(e){return function(t){return ms(t,e)}};var xs=function(e){return Mr(e)?ws(Vr(e)):Ss(e)};var Es=function(e){return"function"==typeof e?e:null==e?vr:"object"==typeof e?Oe(e)?ys(e[0],e[1]):gs(e):xs(e)};var As=function(e){return Es("function"==typeof e?e:Kt(e,1))};var Cs=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var ks=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 js=function(e,t){return t.length<2?e:ms(e,ks(t,0,-1))};var Ts=function(e,t){return t=Hr(t,e),null==(e=js(e,t))||delete e[Vr(Cs(t))]};var Os=function(e){return jn(e)?void 0:e},Ns=w?w.isConcatSpreadable:void 0;var Is=function(e){return Oe(e)||Te(e)||!!(Ns&&e&&e[Ns])};var Ms=function e(t,n,r,i,s){var o=-1,a=t.length;for(r||(r=Is),s||(s=[]);++o<a;){var c=t[o];n>0&&r(c)?n>1?e(c,n-1,r,i,s):dt(s,c):i||(s[s.length]=c)}return s};var Rs=function(e){return(null==e?0:e.length)?Ms(e,1):[]};var $s=function(e){return Er(yr(e,void 0,Rs),e+"")},Ds=$s((function(e,t){var n={};if(null==e)return n;var r=!1;t=zr(t,(function(t){return t=Hr(t,e),r||(r=t.length>1),t})),Se(e,vt(e),n),r&&(n=Kt(n,7,Os));for(var i=t.length;i--;)Ts(n,t[i]);return n}));var Ps=function(e,t,n,r){if(!N(e))return e;for(var i=-1,s=(t=Hr(t,e)).length,o=s-1,a=e;null!=a&&++i<s;){var c=Vr(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=N(u)?u:Me(t[i+1])?[]:{})}we(a,c,l),a=a[c]}return e};var Ls=function(e,t,n){for(var r=-1,i=t.length,s={};++r<i;){var o=t[r],a=ms(e,o);n(a,o)&&Ps(s,Hr(o,e),a)}return s};var zs=function(e,t){return Ls(e,t,(function(t,n){return bs(e,n)}))},Fs=$s((function(e,t){return null==e?{}:zs(e,t)}));const Bs=function(e,t){let n=e||{};t||(t={}),this.preinitialize.apply(this,arguments),this.cid=_i(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{});const r=Jr(this,"defaults");n=Mi(kr({},r,n),r),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};Bs.extend=Qr,Object.assign(Bs.prototype,bi,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",preinitialize:function(){},initialize:function(){},toJSON:function(e){return Oi(this.attributes)},sync:function(e,t,n){return ei(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 Wi(this.attributes)},pick:function(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),Fs(this.attributes,e)},omit:function(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),Ds(this.attributes,e)},isEmpty:function(){return ri(this.attributes)},escape:function(e){return zi(this.get(e))},has:function(e){return null!=this.get(e)},matches:function(e){return!!As(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=Oi(this.attributes),this.changed={});const c=this.attributes,l=this.changed,u=this._previousAttributes;for(const e in r)t=r[e],us(c[e],t)||o.push(e),us(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,kr({},t,{unset:!0}))},clear:function(e){const t={};for(const e in this.attributes)t[e]=void 0;return this.set(t,kr({},e,{unset:!0}))},hasChanged:function(e){return null==e?!ri(this.changed):Gr(this.changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&Oi(this.changed);const t=this._changing?this._previousAttributes:this.attributes,n={};let r;for(const i in e){const s=e[i];us(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 Oi(this._previousAttributes)},fetch:function(e){e=kr({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)},Xr(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=kr({validate:!0,parse:!0},n)).wait,s=n.promise,o=s&&Yr();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=kr({},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)},Xr(this,n),r&&i&&(this.attributes=kr({},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?Oi(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()?$i(e.success):(Xr(this,e),s=this.sync("delete",this,e)),r||i(),s},url:function(){const e=Jr(this,"urlRoot")||Jr(this.collection,"url")||Kr();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({},kr({},e,{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=kr({},this.attributes,e);const n=this.validationError=this.validate(e,t)||null;return!n||(this.trigger("invalid",this,n,kr(t,{validationError:n})),!1)}});var qs=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};
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the core utilities module.
*/const Us=gr.g.Strophe,Hs={isTagEqual:function(e,t){if(e.nodeTree)return Hs.isTagEqual(e.nodeTree,t);if(e instanceof Element)return Us.isTagEqual(e,t);throw Error("isTagEqual called with value which isn't an element or Strophe.Builder instance")}},Vs=new DOMParser,Ws=Vs.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 Gs(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
*/Hs.getJIDFromURI=function(e){return e.startsWith("xmpp:")&&e.endsWith("?join")?e.replace(/^xmpp:/,"").replace(/\?join$/,""):e},Hs.toStanza=function(e){const t=Vs.parseFromString(e,"text/xml");if(t.getElementsByTagNameNS(Ws,"parsererror").length)throw new Error("Parser Error: "+e);return t.firstElementChild},Hs.getLongestSubstring=function(e,t){return t.reduce((function(t,n){return e.startsWith(n)&&n.length>t.length?n:t}),"")},Hs.prefixMentions=function(e){let t=e.get("message");return(e.get("references")||[]).sort((e,t)=>t.begin-e.begin).forEach(e=>{t=`${t.slice(0,e.begin)}@${t.slice(e.begin)}`}),t},Hs.isValidJID=function(e){return"string"==typeof e&&(2===qs(e.split("@")).length&&!e.startsWith("@")&&!e.endsWith("@"))},Hs.isValidMUCJID=function(e){return!e.startsWith("@")&&!e.endsWith("@")},Hs.isSameBareJID=function(e,t){return"string"==typeof e&&"string"==typeof t&&Us.getBareJidFromJid(e).toLowerCase()===Us.getBareJidFromJid(t).toLowerCase()},Hs.isSameDomain=function(e,t){return"string"==typeof e&&"string"==typeof t&&Us.getDomainFromJid(e).toLowerCase()===Us.getDomainFromJid(t).toLowerCase()},Hs.isNewMessage=function(e){return e instanceof Element?!(pr()(`result[xmlns="${Us.NS.MAM}"]`,e).length&&pr()(`delay[xmlns="${Us.NS.DELAY}"]`,e).length):(e instanceof Bs&&(e=e.attributes),!(e.is_delayed&&e.is_archived))},Hs.shouldCreateMessage=function(e){return e.retracted||!Hs.isEmptyMessage(e)},Hs.shouldCreateGroupchatMessage=function(e){return e.nick&&(Hs.shouldCreateMessage(e)||e.is_tombstone)},Hs.isEmptyMessage=function(e){return e instanceof Bs&&(e=e.attributes),!(e.oob_url||e.file||e.is_encrypted&&e.plaintext||e.message)},Hs.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 Bs&&(e=e.attributes),e.chat_state&&Hs.isEmptyMessage(e))},Hs.isOnlyMessageDeliveryReceipt=function(e){return e instanceof Element?null===e.querySelector("body")&&null!==e.querySelector("received"):(e instanceof Bs&&(e=e.attributes),e.received&&Hs.isEmptyMessage(e))},Hs.isChatRoom=function(e){return e&&"chatroom"===e.get("type")},Hs.isErrorObject=function(e){return e instanceof Error},Hs.isErrorStanza=function(e){return!!Mn(e)&&"error"===e.getAttribute("type")},Hs.isForbiddenError=function(e){return!!Mn(e)&&pr()(`error[type="auth"] forbidden[xmlns="${Us.NS.STANZAS}"]`,e).length>0},Hs.isServiceUnavailableError=function(e){return!!Mn(e)&&pr()(`error[type="cancel"] service-unavailable[xmlns="${Us.NS.STANZAS}"]`,e).length>0},Hs.merge=function e(t,n){for(const r in n)N(t[r])?e(t[r],n[r]):t[r]=n[r]},Hs.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},Hs.stringToElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},Hs.matchesSelector=function(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return!!n&&n.call(e,t)},Hs.queryChildren=function(e,t){return Array.from(e.childNodes).filter(e=>Hs.matchesSelector(e,t))},Hs.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.")}},Hs.isOfType=function(e,t){return t.get("type")==e},Hs.isInstance=function(e,t){return t instanceof e},Hs.getAttribute=function(e,t){return t.get(e)},Hs.contains.not=function(e,t){return function(n){return!Hs.contains(e,t)(n)}},Hs.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)},Hs.createFragmentFromText=function(e){var t,n=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=e;t=r.firstChild;)n.appendChild(t);return n},Hs.isPersistableModel=function(e){return e.collection&&e.collection.browserStorage},Hs.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},Hs.interpolate=function(e,t){return e.replace(/{{{([^{}]*)}}}/g,(e,n)=>{var r=t[n];return"string"==typeof r||"number"==typeof r?r:e})},Hs.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))},Hs.safeSave=function(e,t,n){Hs.isPersistableModel(e)?e.save(t,n):e.set(t,n)},Hs.siblingIndex=function(e){for(var t=0;e=e.previousElementSibling;t++);return t},Hs.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},Hs.replaceCurrentWord=function(e,t){const n=e.selectionEnd||void 0,r=Cs(e.value.slice(0,n).split(" ")),i=e.value;e.value=i.slice(0,n-r.length)+(t+" ")+i.slice(n),e.selectionEnd=n-r.length+t.length+1},Hs.triggerEvent=function(e,t,n="Event",r=!0,i=!0){const s=document.createEvent(n);s.initEvent(t,r,i),e.dispatchEvent(s)},Hs.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},Hs.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},Hs.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},Hs.arrayBufferToHex=function(e){return Array.prototype.map.call(new Uint8Array(e),e=>("00"+e.toString(16)).slice(-2)).join("")},Hs.arrayBufferToString=function(e){return new TextDecoder("utf-8").decode(e)},Hs.stringToArrayBuffer=function(e){return new TextEncoder("utf-8").encode(e).buffer},Hs.arrayBufferToBase64=function(e){return btoa(new Uint8Array(e).reduce((e,t)=>e+String.fromCharCode(t),""))},Hs.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},Hs.getRandomInt=function(e){return Math.floor(Math.random()*Math.floor(e))},Hs.placeCaretAtEnd=function(e){e!==document.activeElement&&e.focus();const t=2*e.value.length;setTimeout(()=>e.setSelectionRange(t,t),1),this.scrollTop=999999},Hs.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},Hs.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=Hs.getResolveablePromise(),i=new Error;const s=setInterval((function(){try{const t=e();t&&(Gs(o,s),r.resolve(t))}catch(e){Gs(o,s),r.reject(e)}}),n);const o=setTimeout((function(){Gs(o,s);const e="Wait until promise timed out: \n\n"+i.stack;console.trace(),Dn.error(e),r.reject(new Error(e))}),t);return r};var Js=Hs;const Qs=gr.g.Strophe,Ys=gr.g.$msg,{NS:Ks}=Qs;function Xs(e){const t=pr()(`spoiler[xmlns="${Qs.NS.SPOILER}"]`,e).pop();return{is_spoiler:!!t,spoiler_hint:null==t?void 0:t.textContent}}function Zs(e){const t=pr()(`x[xmlns="${Qs.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 eo(e,t){const n=pr()(`replace[xmlns="${Qs.NS.MESSAGE_CORRECT}"]`,e).pop();if(n){const e=n.getAttribute("id"),r=e;if(e){const n=pr()(`delay[xmlns="${Qs.NS.DELAY}"]`,t).pop();return{msgid:r,replace_id:e,edited:n?Sn()(n.getAttribute("stamp")).toISOString():(new Date).toISOString()}}}return{}}function to(e,t){var n;const r=pr()(`encrypted[xmlns="${Qs.NS.OMEMO}"]`,e).pop(),i={is_encrypted:!!r};if(!r||Qc.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&&pr()(`key[rid="${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 no(e,t){return"me"!==t.sender&&!t.is_carbon&&!t.is_archived&&pr()(`request[xmlns="${Qs.NS.RECEIPTS}"]`,e).length}function ro(e){const t=pr()(`received[xmlns="${Qs.NS.RECEIPTS}"]`,e).pop();return null==t?void 0:t.getAttribute("id")}function io(e){var t;return null===(t=pr()(`\n composing[xmlns="${Ks.CHATSTATES}"],\n paused[xmlns="${Ks.CHATSTATES}"],\n inactive[xmlns="${Ks.CHATSTATES}"],\n active[xmlns="${Ks.CHATSTATES}"],\n gone[xmlns="${Ks.CHATSTATES}"]`,e).pop())||void 0===t?void 0:t.nodeName}function so(e){const t=Qs.NS.CARBONS;return pr()(`message > received[xmlns="${t}"]`,e).length>0||pr()(`message > sent[xmlns="${t}"]`,e).length>0}function oo(e,t){const n={},r=pr()(`stanza-id[xmlns="${Qs.NS.SID}"]`,e).reduce((e,t)=>(e["stanza_id "+t.getAttribute("by")]=t.getAttribute("id"),e),{});Object.assign(n,r);const i=pr()(`message > result[xmlns="${Qs.NS.MAM}"]`,t).pop();if(i){n["stanza_id "+(t.getAttribute("from")||Vc.bare_jid)]=i.getAttribute("id")}const s=pr()(`origin-id[xmlns="${Qs.NS.SID}"]`,e).pop();return s&&(n.origin_id=s.getAttribute("id")),n}function ao(e,t){const n=pr()(`> apply-to[xmlns="${Qs.NS.FASTEN}"]`,e).pop();if(n){const e=n.getAttribute("id");if(pr()(`> retract[xmlns="${Qs.NS.RETRACT}"]`,n).pop()){const n=pr()(`delay[xmlns="${Qs.NS.DELAY}"]`,t).pop();return{editable:!1,retracted:n?Sn()(n.getAttribute("stamp")).toISOString():(new Date).toISOString(),retracted_id:e}}}else{const t=pr()(`> retracted[xmlns="${Qs.NS.RETRACT}"]`,e).pop();if(t)return{editable:!1,is_tombstone:!0,retracted:t.getAttribute("stamp")}}return{}}function co(e){var t;const n=null===(t=e.querySelector("body"))||void 0===t?void 0:t.textContent;return pr()(`reference[xmlns="${Qs.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 lo(e,t){Qc.send(Ys({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)),Dn.warn("Rejecting message stanza with the following reason: "+t),Dn.warn(e)}function uo(e){if("error"===e.getAttribute("type")){const t=e.querySelector("error"),n=pr()(`text[xmlns="${Qs.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{}}class ho extends Error{constructor(e,t){super(e,t),this.name="StanzaParseError",this.stanza=t}}function fo(e){if(pr()(`message > forwarded[xmlns="${Qs.NS.FORWARD}"]`,e).length){lo(e,"Forwarded messages not part of an encapsulating protocol are not supported");const t=e.getAttribute("from");return new ho("Ignoring unencapsulated forwarded message from "+t,e)}}const po={isHeadline:e=>"headline"===e.getAttribute("type"),isServerMessage(e){const t=e.getAttribute("from");return!("error"===e.getAttribute("type")||!t||t.includes("@"))},getChatMarker:e=>pr()(`\n acknowledged[xmlns="${Qs.NS.MARKERS}"],\n displayed[xmlns="${Qs.NS.MARKERS}"],\n received[xmlns="${Qs.NS.MARKERS}"]`,e).pop(),isArchived:e=>!!pr()(`message > result[xmlns="${Qs.NS.MAM}"]`,e).pop(),getAttributes:e=>e.getAttributeNames().reduce((t,n)=>(t[n]=Qs.xmlunescape(e.getAttribute(n)),t),{}),async parseMessage(e,t){var n,r,i,s,o,a;const c=fo(e);if(c)return c;let l=e.getAttribute("to");const u=Qs.getResourceFromJid(l);if(Qc.settings.get("filter_by_resource")&&u&&u!==t.resource)return new ho("Ignoring incoming message intended for a different resource: "+l,e);const d=e;let h=e.getAttribute("from")||t.bare_jid;if(so(e)){if(h!==t.bare_jid)return lo(e,"Rejecting carbon from invalid JID"),new ho("Rejecting carbon from invalid JID "+l,e);{const t=`[xmlns="${Qs.NS.CARBONS}"] > forwarded[xmlns="${Qs.NS.FORWARD}"] > message`;l=(e=pr()(t,e).pop()).getAttribute("to"),h=e.getAttribute("from")}}const f=po.isArchived(e);if(f){if(h!==t.bare_jid)return new ho("Invalid Stanza: alleged MAM message from "+e.getAttribute("from"),e);{const t=`[xmlns="${Qs.NS.MAM}"] > forwarded[xmlns="${Qs.NS.FORWARD}"] > message`;l=(e=pr()(t,e).pop()).getAttribute("to"),h=e.getAttribute("from")}}const p=Qs.getBareJidFromJid(h),g=p===t.bare_jid;if(g&&null===l)return new ho("Don't know how to handle message stanza without 'to' attribute. "+e.outerHTML,e);const m=po.isHeadline(e),v=po.isServerMessage(e);let _,b;if(!m&&!v&&(b=g?Qs.getBareJidFromJid(l):p,_=await Qc.contacts.get(b),void 0===_&&!Qc.settings.get("allow_non_roster_messaging")))return Dn.error(e),new ho("Blocking messaging with a JID not in our roster because allow_non_roster_messaging is false.",e);const y=pr()(`delay[xmlns="${Qs.NS.DELAY}"]`,d).pop(),w=po.getChatMarker(e),S=(new Date).toISOString();let x=Object.assign({contact_jid:b,is_archived:f,is_headline:m,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:io(e),from:Qs.getBareJidFromJid(e.getAttribute("from")),is_carbon:so(d),is_delayed:!!y,is_markable:!!pr()(`markable[xmlns="${Qs.NS.MARKERS}"]`,e).length,is_marker:!!w,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:ro(e),received:(new Date).toISOString(),references:co(e),sender:g?"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?Sn()(y.getAttribute("stamp")).toISOString():S,to:e.getAttribute("to"),type:e.getAttribute("type")},uo(e),Zs(e),Xs(e),eo(e,d),oo(e,d),ao(e,d),to(e,t));if(x.is_archived){const n=d.getAttribute("from");if(n&&n!==t.bare_jid)return new ho("Invalid Stanza: Forged MAM message from "+n,e)}return await Qc.emojis.initialize(),x=Object.assign({message:x.body||x.error,is_only_emojis:!!x.body&&Js.isOnlyEmojis(x.body),is_valid_receipt_request:no(e,x)},x),x.id=x.origin_id||x["stanza_id "+x.from]||Js.getUniqueId(),Qc.hook("parseMessage",e,x)},async parseMUCMessage(e,t,n){var r,i,s,o,a;const c=fo(e);if(c)return c;const l=`[xmlns="${Ks.MAM}"] > forwarded[xmlns="${Ks.FORWARD}"] > message`,u=e;if(e=pr()(l,e).pop()||e,pr()(`message > forwarded[xmlns="${Qs.NS.FORWARD}"]`,e).length)return new ho("Invalid Stanza: Forged MAM groupchat message from "+e.getAttribute("from"),e);const d=pr()(`delay[xmlns="${Qs.NS.DELAY}"]`,u).pop(),h=e.getAttribute("from"),f=Qs.unescapeNode(Qs.getResourceFromJid(h)),p=po.getChatMarker(e),g=(new Date).toISOString();let m=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:io(e),from_muc:Qs.getBareJidFromJid(h),from_real_jid:null===(s=t.occupants.findOccupant({nick:f}))||void 0===s?void 0:s.get("jid"),is_archived:po.isArchived(u),is_carbon:so(u),is_delayed:!!d,is_headline:po.isHeadline(e),is_markable:!!pr()(`markable[xmlns="${Qs.NS.MARKERS}"]`,e).length,is_marker:!!p,marker_id:p&&p.getAttribute("id"),msgid:e.getAttribute("id")||u.getAttribute("id"),receipt_id:ro(e),received:(new Date).toISOString(),references:co(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?Sn()(d.getAttribute("stamp")).toISOString():g,to:e.getAttribute("to"),type:e.getAttribute("type")},uo(e),Zs(e),Xs(e),eo(e,u),oo(e,u),ao(e,u),function(e){const t=pr()(`apply-to[xmlns="${Qs.NS.FASTEN}"]`,e).pop();if(t){const e=t.getAttribute("id"),r=pr()(`moderated[xmlns="${Qs.NS.MODERATE}"]`,t).pop();if(r){var n;if(pr()(`retract[xmlns="${Qs.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=pr()(`> moderated[xmlns="${Qs.NS.MODERATE}"]`,e).pop();if(t){var r;if(pr()(`retracted[xmlns="${Qs.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),to(e,n));return await Qc.emojis.initialize(),m=Object.assign({is_only_emojis:!!m.body&&Js.isOnlyEmojis(m.body),is_valid_receipt_request:no(e,m),message:m.body||m.error,sender:m.nick===t.get("nick")?"me":"them"},m),m.is_archived&&u.getAttribute("from")!==m.from_muc?new ho("Invalid Stanza: Forged MAM message from "+u.getAttribute("from"),e):m.is_archived&&u.getAttribute("from")!==t.get("jid")?new ho("Invalid Stanza: Forged MAM groupchat message from "+e.getAttribute("from"),e):m.is_carbon?new ho("Invalid Stanza: MUC messages SHOULD NOT be XEP-0280 carbon copied",e):(m.id=m.origin_id||m["stanza_id "+(m.from_muc||m.from)]||Js.getUniqueId(),Qc.hook("parseMUCMessage",e,m))},parseMUCPresence(e){const t=e.getAttribute("from"),n=e.getAttribute("type"),r={from:t,nick:Qs.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")===Qs.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")===Qs.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")===Qs.NS.MUC_HATS&&(r.hats=Array.from(e.children).map(e=>e.matches("hat")&&{title:e.getAttribute("title"),uri:e.getAttribute("uri")}))}),r}};var go=po;var mo=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 vo=function(e,t){return function(n,r){if(null==n)return n;if(!Qe(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}},_o=vo(qi);var bo=function(e,t,n,r){return _o(e,(function(e,i,s){t(r,e,n(e),s)})),r};var yo=function(e,t){return function(n,r){var i=Oe(n)?mo:bo,s=t?t():{};return i(n,e,Es(r,2),s)}},wo=Object.prototype.hasOwnProperty,So=yo((function(e,t,n){wo.call(e,n)?++e[n]:be(e,n,1)}));var xo=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 Eo=function(e){return e!=e};var Ao=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1};var Co=function(e,t,n){return t==t?Ao(e,t,n):xo(e,Eo,n)};var ko=function(e,t){return!!(null==e?0:e.length)&&Co(e,t,0)>-1};var jo=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 To=function(e,t,n,r){var i=-1,s=ko,o=!0,a=e.length,c=[],l=t.length;if(!a)return c;n&&(t=zr(t,Pe(n))),r?(s=jo,o=!1):t.length>=200&&(s=Xi,o=!1,t=new Yi(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 Oo=function(e){return Ee(e)&&Qe(e)},No=Ar((function(e,t){return Oo(e)?To(e,Ms(t,1,Oo,!0)):[]}));var Io=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 Mo=function(e,t){var n=!0;return _o(e,(function(e,r,i){return n=!!t(e,r,i)})),n};var Ro=function(e,t,n){var r=Oe(e)?Io:Mo;return n&&Cr(e,t,n)&&(t=void 0),r(e,Es(t,3))},$o=Math.max;var Do=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:pi(n);return i<0&&(i=$o(r+i,0)),xo(e,Es(t,3),i)},Po=Math.max,Lo=Math.min;var zo=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=pi(n),i=n<0?Po(r+i,0):Lo(i,r-1)),xo(e,Es(t,3),i,!0)},Fo=Object.prototype.hasOwnProperty,Bo=yo((function(e,t,n){Fo.call(e,n)?e[n].push(t):be(e,n,[t])})),qo=Math.max;var Uo=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:pi(n);return i<0&&(i=qo(r+i,0)),Co(e,t,i)},Ho=yo((function(e,t,n){be(e,n,t)}));var Vo=function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r},Wo=Math.max,Go=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=pi(n))<0?Wo(r+i,0):Go(i,r-1)),t==t?Vo(e,t,i):xo(e,Eo,i,!0)};var Qo=function(e,t){var n;return _o(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n};var Yo=function(e,t,n){var r=Oe(e)?Ki:Qo;return n&&Cr(e,t,n)&&(t=void 0),r(e,Es(t,3))};var Ko=function(e,t){var n=-1,r=Qe(e)?Array(e.length):[];return _o(e,(function(e,i,s){r[++n]=t(e,i,s)})),r};var Xo=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e};var Zo=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,s=Or(e),o=void 0!==t,a=null===t,c=t==t,l=Or(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 ea=function(e,t,n){for(var r=-1,i=e.criteria,s=t.criteria,o=i.length,a=n.length;++r<o;){var c=Zo(i[r],s[r]);if(c)return r>=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index};var ta=function(e,t,n){t=t.length?zr(t,(function(e){return Oe(e)?function(t){return ms(t,1===e.length?e[0]:e)}:e})):[vr];var r=-1;t=zr(t,Pe(Es));var i=Ko(e,(function(e,n,i){return{criteria:zr(t,(function(t){return t(e)})),index:++r,value:e}}));return Xo(i,(function(e,t){return ea(e,t,n)}))},na=Ar((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Cr(e,t[0],t[1])?t=[]:n>2&&Cr(t[0],t[1],t[2])&&(t=[t[0]]),ta(e,Ms(t,1),[])}));const ra=Array.prototype.slice,ia=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,kr({silent:!0},t))};ia.extend=Qr;const sa={add:!0,remove:!0,merge:!0},oa={add:!0,remove:!1},aa=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(ia.prototype,bi,{model:Bs,preinitialize:function(){},initialize:function(){},toJSON:function(e){return this.map((function(t){return t.toJSON(e)}))},sync:function(e,t,n){return ei(this)(e,t,n)},add:function(e,t){return this.set(e,kr({merge:!1},t,oa))},remove:function(e,t){t=kr({},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=kr({},sa,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=Zt(this.comparator)?this.comparator:null;let g,m;for(m=0;m<e.length;m++){g=e[m];const n=this.get(g);if(n){if(u&&g!==n){let e=this._isModel(g)?g.attributes:g;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[m]=n}else l&&(g=e[m]=this._prepareModel(g,t),g&&(s.push(g),this._addReference(g,t),c[g.cid]=!0,i.push(g)))}if(d){for(m=0;m<this.length;m++)g=this.models[m],c[g.cid]||a.push(g);a.length&&this._removeModels(a,t)}let v=!1;const _=!f&&l&&d;if(i.length&&_?(v=this.length!==i.length||Yo(this.models,(e,t)=>e!==i[t]),this.models.length=0,aa(this.models,i,0),this.length=this.models.length):s.length&&(f&&(h=!0),aa(this.models,s,null==r?this.length:r),this.length=this.models.length),h&&this.sort({silent:!0}),!t.silent){for(m=0;m<s.length;m++)null!=r&&(t.index=r+m),g=s[m],g.trigger("add",g,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?Oi(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,kr({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,kr({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,kr({at:0},t))},shift:function(e){const t=this.at(0);return this.remove(t,e)},slice:function(){return ra.apply(this.models,arguments)},filter:function(e,t){return this.models.filter(M(e)?e:t=>t.matches(e),t)},every:function(e){return Ro(this.models.map(e=>e.attributes),e)},difference:function(e){return No(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 Yo(this.models.map(e=>e.attributes),e)},sortBy:function(e){return na(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e))},isEmpty:function(){return ri(this.models)},keyBy:function(e){return Ho(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 So(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e))},groupBy:function(e){return Bo(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e))},indexOf:function(e){return Uo(this.models,e)},findLastIndex:function(e,t){return zo(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e),t)},lastIndexOf:function(e){return Jo(this.models,e)},findIndex:function(e){return Do(this.models,M(e)?e:t=>Zt(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(M(e)?e:t=>Zt(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=M(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 M(t)&&(t=t.bind(this)),1===n||Zt(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=kr({parse:!0},e)).success,n=this,r=e.promise&&Yr();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)},Xr(this,e),r||this.sync("read",this,e)},create:function(e,t){const n=(t=t?Oi(t):{}).wait,r=t.promise,i=r&&Yr();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 la(this,ua)},keys:function(){return new la(this,da)},entries:function(){return new la(this,ha)},_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?Oi(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 Bs},_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 ca="function"==typeof Symbol&&Symbol.iterator;ca&&(ia.prototype[ca]=ia.prototype.values);const la=function(e,t){this._collection=e,this._kind=t,this._index=0},ua=1,da=2,ha=3;ca&&(la.prototype[ca]=function(){return this}),la.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===ua)t=e;else{const n=this._collection.modelId(e.attributes);t=this._kind===da?n:[n,e]}return{value:t,done:!1}}this._collection=void 0}return{value:void 0,done:!0}};var fa=n(39);class pa extends gr.f.Connection{constructor(e,t){super(e,t),this.debouncedReconnect=Object(fa.debounce)(this.reconnect,2e3)}static generateResource(){return"/converse.js-"+Math.floor(139749528*Math.random()).toString()}async bind(){await Qc.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 Dn.warn("Could not discover XEP-0156 connection methods");const r=pr()('Link[rel="urn:xmpp:alt-connections:xbosh"]',n),i=pr()('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?Dn.warn("Neither BOSH nor WebSocket connection methods have been specified with XEP-0156."):(Qc.settings.set("websocket_url",o.pop()),Qc.settings.set("bosh_service_url",s.pop()),this.service=Qc.settings.get("websocket_url")||Qc.settings.get("bosh_service_url"),this.setProtocol())}async discoverConnectionMethods(e){const t={mode:"cors",headers:{Accept:"application/xrd+xml, text/xml"}},n=`https://${e}/.well-known/host-meta`;let r;try{r=await fetch(n,t)}catch(e){return Dn.error("Failed to discover alternative connection methods at "+n),void Dn.error(e)}r.status>=200&&r.status<400?await this.onDomainDiscovered(r):Dn.warn("Could not discover XEP-0156 connection methods")}async connect(e,t,n){if(Qc.settings.get("discover_connection_methods")){const t=gr.f.getDomainFromJid(e);await this.discoverConnectionMethods(t)}super.connect(e,t,n||this.onConnectStatusChanged,59)}async reconnect(){const{__:e}=Vc;return Dn.debug("RECONNECTING: the connection has dropped, attempting to reconnect."),this.setConnectionStatus(gr.f.Status.RECONNECTING,e("The connection has dropped, attempting to reconnect.")),Qc.trigger("will-reconnect"),this.reconnecting=!0,await Xc(),Qc.user.login()}async onConnected(e){delete this.reconnecting,this.flush(),await Vc.setUserJID(this.jid),await Qc.trigger("afterResourceBinding",e,{synchronous:!0}),e?Qc.trigger("reconnected"):Qc.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,Vc.connfeedback.set({connection_status:e,message:t})}async finishDisconnection(){Dn.debug("DISCONNECTED"),delete this.reconnecting,this.reset(),Xc(),await el(),delete Vc.connection,Qc.trigger("disconnected")}onDisconnected(){if(!Qc.settings.get("auto_reconnect"))return this.finishDisconnection();{const e=this.disconnection_reason;if(this.disconnection_cause===gr.f.Status.AUTHFAIL)return Qc.settings.get("credentials_url")||Qc.settings.get("authentication")===Vc.ANONYMOUS?Qc.connection.reconnect():this.finishDisconnection();if(this.disconnection_cause===Vc.LOGOUT||e===gr.f.ErrorCondition.NO_AUTH_MECH||"host-unknown"===e||"remote-connection-failed"===e)return this.finishDisconnection();Qc.connection.reconnect()}}onConnectStatusChanged(e,t){const{__:n}=Vc;var r;if(Dn.debug("Status changed to: "+Vc.CONNECTION_STATUS[e]),e===gr.f.Status.ATTACHFAIL)this.setConnectionStatus(e),null===(r=this.worker_attach_promise)||void 0===r||r.resolve(!1);else if(e===gr.f.Status.CONNECTED||e===gr.f.Status.ATTACHED){var i,s;if(null!==(i=this.worker_attach_promise)&&void 0!==i&&i.isResolved&&this.status===gr.f.Status.ATTACHED)return;this.setConnectionStatus(e),null===(s=this.worker_attach_promise)||void 0===s||s.resolve(!0),Vc.send_initial_presence=!0,this.setDisconnectionCause(),this.reconnecting?(Dn.debug(e===gr.f.Status.CONNECTED?"Reconnected":"Reattached"),this.onConnected(!0)):(Dn.debug(e===gr.f.Status.CONNECTED?"Connected":"Attached"),this.restored&&(Vc.send_initial_presence=!1),this.onConnected())}else if(e===gr.f.Status.DISCONNECTED)this.setDisconnectionCause(e,t),this.onDisconnected();else if(e===gr.f.Status.BINDREQUIRED)this.bind();else if(e===gr.f.Status.ERROR)this.setConnectionStatus(e,n("An error occurred while connecting to the chat server."));else if(e===gr.f.Status.CONNECTING)this.setConnectionStatus(e);else if(e===gr.f.Status.AUTHENTICATING)this.setConnectionStatus(e);else if(e===gr.f.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===gr.f.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",`"${gr.f.getDomainFromJid(this.jid)}"`):void 0!==t&&t===(null===gr.f||void 0===gr.f||null===(o=gr.f.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===gr.f.Status.DISCONNECTING&&this.setDisconnectionCause(e,t)}isType(e){return"websocket"===e.toLowerCase()?this._proto instanceof gr.f.Websocket:"bosh"===e.toLowerCase()?gr.f.Bosh&&this._proto instanceof gr.f.Bosh:void 0}hasResumed(){var e;return null!==(e=Qc.settings.get("connection_options"))&&void 0!==e&&e.worker||this.isType("bosh")?Vc.connfeedback.get("connection_status")===gr.f.Status.ATTACHED:!this.do_bind}restoreWorkerSession(){return this.attach(this.onConnectStatusChanged),this.worker_attach_promise=Js.getResolveablePromise(),this.worker_attach_promise}}class ga extends pa{constructor(e,t){super(e,t),this.sent_stanzas=[],this.IQ_stanzas=[],this.IQ_ids=[],this.features=gr.f.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(gr.f.Status.BINDREQUIRED)}}_processRequest(){}sendIQ(e,t,n){Object(fa.isElement)(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 Object(fa.isElement)(e)?this.sent_stanzas.push(e):this.sent_stanzas.push(e.nodeTree),super.send(e)}async bind(){await Qc.trigger("beforeResourceBinding",{synchronous:!0}),this.authenticated=!0,Vc.no_connection_on_bind||this._changeConnectStatus(gr.f.Status.CONNECTED)}}const ma=function(){this.handlers=[],this.checkUrl=this.checkUrl.bind(this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)};ma.extend=Qr;const va=/^[#\/]|\s+$/g,_a=/^\/+|\/+$/g,ba=/#.*$/;ma.started=!1,Object.assign(ma.prototype,bi,{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(va,"")},start:function(e){if(ma.started)throw new Error("history has already been started");if(ma.started=!0,this.options=kr({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(_a,"/"),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),ma.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),Yo(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!ma.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(ba,"");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 ya=ma;var wa=function(e){return Ee(e)&&"[object RegExp]"==O(e)},Sa=Le.a&&Le.a.isRegExp,xa=Sa?Pe(Sa):wa;const Ea=function(e={}){this.history=e.history||new ya,this.preinitialize.apply(this,arguments),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};Ea.extend=Qr;const Aa=/\((.*?)\)/g,Ca=/(\(\?)?:\w+/g,ka=/\*\w+/g,ja=/[\-{}\[\]+?.,\\\^$|#\s]/g;Object.assign(Ea.prototype,bi,{preinitialize:function(){},initialize:function(){},route:function(e,t,n){return xa(e)||(e=this._routeToRegExp(e)),M(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=Jr(this,"routes");const t=Ye(this.routes);for(;null!=(e=t.pop());)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(ja,"\\$&").replace(Aa,"(?:$1)?").replace(Ca,(function(e,t){return t?e:"([^/?]+)"})).replace(ka,"([^?]*?)"),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 Ta=n(1),Oa=function(){return y.a.Date.now()},Na=Math.max,Ia=Math.min;var Ma=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(m,t),u?f(e):o}function g(e){var n=e-c;return void 0===c||n>=t||n<0||d&&e-l>=s}function m(){var e=Oa();if(g(e))return v(e);a=setTimeout(m,function(e){var n=t-(e-c);return d?Ia(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=Oa(),n=g(e);if(r=arguments,i=this,c=e,n){if(void 0===a)return p(c);if(d)return clearTimeout(a),a=setTimeout(m,t),f(c)}return void 0===a&&(a=setTimeout(m,t)),o}return t=hi(t)||0,N(n)&&(u=!!n.leading,s=(d="maxWait"in n)?Na(hi(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(Oa())},_};var Ra=function(e,t,n){t=Hr(t,e);var r=null==(e=js(e,t))?e:e[Vr(Cs(t))];return null==r?void 0:_r(r,e,n)},$a=Ar(Ra);
/**
* @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 Da="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,Pa=(e,t,n=null,r=null)=>{for(;t!==n;){const n=t.nextSibling;e.insertBefore(t,r),t=n}},La=(e,t,n=null)=>{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}},za=`{{lit-${String(Math.random()).slice(2)}}}`,Fa=`\x3c!--${za}--\x3e`,Ba=new RegExp(`${za}|${Fa}`);class qa{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++)Ua(t[e].name,"$lit$")&&r++;for(;r-- >0;){const t=c[a],n=Wa.exec(t)[2],r=n.toLowerCase()+"$lit$",i=e.getAttribute(r);e.removeAttribute(r);const s=i.split(Ba);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(za)>=0){const r=e.parentNode,i=t.split(Ba),s=i.length-1;for(let t=0;t<s;t++){let n,s=i[t];if(""===s)n=Va();else{const e=Wa.exec(s);null!==e&&Ua(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(Va(),e),n.push(e)):e.data=i[s],a+=s}}else if(8===e.nodeType)if(e.data===za){const t=e.parentNode;null!==e.previousSibling&&o!==s||(o++,t.insertBefore(Va(),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(za,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 Ua=(e,t)=>{const n=e.length-t.length;return n>=0&&e.slice(n)===t},Ha=e=>-1!==e.index,Va=()=>document.createComment(""),Wa=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Ga(e,t){const{element:{content:n},parts:r}=e,i=document.createTreeWalker(n,133,null,!1);let s=Qa(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=Qa(r,s),o=r[s]}l.forEach(e=>e.parentNode.removeChild(e))}const Ja=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,133,null,!1);for(;n.nextNode();)t++;return t},Qa=(e,t=-1)=>{for(let n=t+1;n<e.length;n++){const t=e[n];if(Ha(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 Ya=new WeakMap,Ka=e=>(...t)=>{const n=e(...t);return Ya.set(n,!0),n},Xa=e=>"function"==typeof e&&Ya.has(e),Za={},ec={};
/**
* @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 tc{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=Da?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],Ha(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 Da&&(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 nc=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),rc=` ${za} `;class ic{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=Wa.exec(e);t+=null===s?e+(n?rc:Fa):e.substr(0,s.index)+s[1]+s[2]+"$lit$"+s[3]+za}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==nc&&(t=nc.createHTML(t)),e.innerHTML=t,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 sc=e=>null===e||!("object"==typeof e||"function"==typeof e),oc=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class ac{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 cc(this)}_getValue(){const e=this.strings,t=e.length-1,n=this.parts;if(1===t&&""===e[0]&&""===e[1]){const e=n[0].value;if("symbol"==typeof e)return String(e);if("string"==typeof e||!oc(e))return e}let r="";for(let i=0;i<t;i++){r+=e[i];const t=n[i];if(void 0!==t){const e=t.value;if(sc(e)||!oc(e))r+="string"==typeof e?e:String(e);else for(const t of e)r+="string"==typeof t?t:String(t)}}return r+=e[t],r}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class cc{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===Za||sc(e)&&e===this.value||(this.value=e,Xa(e)||(this.committer.dirty=!0))}commit(){for(;Xa(this.value);){const e=this.value;this.value=Za,e(this)}this.value!==Za&&this.committer.commit()}}class lc{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Va()),this.endNode=e.appendChild(Va())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Va()),e.__insert(this.endNode=Va())}insertAfterPart(e){e.__insert(this.startNode=Va()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;Xa(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Za,e(this)}const e=this.__pendingValue;e!==Za&&(sc(e)?e!==this.value&&this.__commitText(e):e instanceof ic?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):oc(e)?this.__commitIterable(e):e===ec?(this.value=ec,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 tc&&this.value.template===t)this.value.update(e.values);else{const n=new tc(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 lc(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){La(this.startNode.parentNode,e.nextSibling,this.endNode)}}class uc{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(;Xa(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Za,e(this)}if(this.__pendingValue===Za)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=Za}}class dc extends ac{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new hc(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class hc extends cc{}let fc=!1;(()=>{try{const e={get capture(){return fc=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class pc{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(;Xa(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Za,e(this)}if(this.__pendingValue===Za)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=gc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=Za}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const gc=e=>e&&(fc?{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 mc(e){let t=vc.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},vc.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const r=e.strings.join(za);return n=t.keyString.get(r),void 0===n&&(n=new qa(e,e.getTemplateElement()),t.keyString.set(r,n)),t.stringsArray.set(e.strings,n),n}const vc=new Map,_c=new WeakMap,bc=(e,t,n)=>{let r=_c.get(t);void 0===r&&(La(t,t.firstChild),_c.set(t,r=new lc(Object.assign({templateFactory:mc},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 yc=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 dc(e,t.slice(1),n).parts}if("@"===i)return[new pc(e,t.slice(1),r.eventContext)];if("?"===i)return[new uc(e,t.slice(1),n)];return new ac(e,t,n).parts}handleTextExpression(e){return new lc(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.3.0");const wc=(e,...t)=>new ic(e,t,"html",yc),Sc=(e,t)=>`${e}--${t}`;let xc=!0;void 0===window.ShadyCSS?xc=!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."),xc=!1);const Ec=e=>t=>{const n=Sc(t.type,e);let r=vc.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},vc.set(n,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const s=t.strings.join(za);if(i=r.keyString.get(s),void 0===i){const n=t.getTemplateElement();xc&&window.ShadyCSS.prepareTemplateDom(n,e),i=new qa(t,n),r.keyString.set(s,i)}return r.stringsArray.set(t.strings,i),i},Ac=["html","svg"],Cc=new Set,kc=(e,t,n)=>{Cc.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=>{Ac.forEach(t=>{const n=vc.get(Sc(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)}),Ga(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=Qa(i),a=0,c=-1;for(;s.nextNode();){c++;for(s.currentNode===n&&(a=Ja(t),n.parentNode.insertBefore(t,n));-1!==o&&i[o].index===c;){if(a>0){for(;-1!==o;)i[o].index+=a,o=Qa(i,o);return}o=Qa(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),Ga(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const jc={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}},Tc=(e,t)=>t!==e&&(t==t||e==e),Oc={attribute:!0,type:String,converter:jc,reflect:!1,hasChanged:Tc};class Nc 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=Oc){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)||Oc}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=Tc){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,r=t.converter||jc,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||jc.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=Oc){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){}}Nc.finalized=!0;const Ic=Element.prototype;Ic.msMatchesSelector||Ic.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 Mc=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Rc=Symbol();class $c{constructor(e,t){if(t!==Rc)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(Mc?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const Dc=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof $c)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 $c(n,Rc)};
/**
* @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 Pc={};class Lc extends Nc{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&&!Mc){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return new $c(String(t),Rc)}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?Mc?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!==Pc&&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 Pc}}Lc.finalized=!0,Lc.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=_c.has(t),s=xc&&11===t.nodeType&&!!t.host,o=s&&!Cc.has(r),a=o?document.createDocumentFragment():t;if(bc(e,a,Object.assign({templateFactory:Ec(r)},n)),o){const e=_c.get(a);_c.delete(a);const n=e.value instanceof tc?e.value.template:void 0;kc(r,a,n),La(t,t.firstChild),t.appendChild(a),_c.set(t,e)}!i&&s&&window.ShadyCSS.styleElement(t.host)};var zc=n(91);
/**
* @module converse-core
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/Sn.a.extend(yn.a),Ta.e.addNamespace("CARBONS","urn:xmpp:carbons:2"),Ta.e.addNamespace("CHATSTATES","http://jabber.org/protocol/chatstates"),Ta.e.addNamespace("CSI","urn:xmpp:csi:0"),Ta.e.addNamespace("DELAY","urn:xmpp:delay"),Ta.e.addNamespace("FASTEN","urn:xmpp:fasten:0"),Ta.e.addNamespace("FORWARD","urn:xmpp:forward:0"),Ta.e.addNamespace("HINTS","urn:xmpp:hints"),Ta.e.addNamespace("HTTPUPLOAD","urn:xmpp:http:upload:0"),Ta.e.addNamespace("IDLE","urn:xmpp:idle:1"),Ta.e.addNamespace("MAM","urn:xmpp:mam:2"),Ta.e.addNamespace("MODERATE","urn:xmpp:message-moderate:0"),Ta.e.addNamespace("NICK","http://jabber.org/protocol/nick"),Ta.e.addNamespace("OMEMO","eu.siacs.conversations.axolotl"),Ta.e.addNamespace("OUTOFBAND","jabber:x:oob"),Ta.e.addNamespace("PUBSUB","http://jabber.org/protocol/pubsub"),Ta.e.addNamespace("REGISTER","jabber:iq:register"),Ta.e.addNamespace("RETRACT","urn:xmpp:message-retract:0"),Ta.e.addNamespace("ROSTERX","http://jabber.org/protocol/rosterx"),Ta.e.addNamespace("RSM","http://jabber.org/protocol/rsm"),Ta.e.addNamespace("SID","urn:xmpp:sid:0"),Ta.e.addNamespace("SPOILER","urn:xmpp:spoiler:0"),Ta.e.addNamespace("STANZAS","urn:ietf:params:xml:ns:xmpp-stanzas"),Ta.e.addNamespace("VCARD","vcard-temp"),Ta.e.addNamespace("VCARDUPDATE","vcard-temp:x:update"),Ta.e.addNamespace("XFORM","jabber:x:data");class Fc 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"],qc={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:void 0,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:[]},Uc={};Uc[Ta.e.Status.ATTACHED]="ATTACHED",Uc[Ta.e.Status.AUTHENTICATING]="AUTHENTICATING",Uc[Ta.e.Status.AUTHFAIL]="AUTHFAIL",Uc[Ta.e.Status.CONNECTED]="CONNECTED",Uc[Ta.e.Status.CONNECTING]="CONNECTING",Uc[Ta.e.Status.CONNFAIL]="CONNFAIL",Uc[Ta.e.Status.DISCONNECTED]="DISCONNECTED",Uc[Ta.e.Status.DISCONNECTING]="DISCONNECTING",Uc[Ta.e.Status.ERROR]="ERROR",Uc[Ta.e.Status.RECONNECTING]="RECONNECTING",Uc[Ta.e.Status.REDIRECT]="REDIRECT";const Hc={initialize(){},__:(...e)=>Object(zc.sprintf)(...e)},Vc={log:Dn,CONNECTION_STATUS:Uc,templates:{},promises:{initialized:Js.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 Ea,TimeoutError:Fc,isTestEnv:()=>"montague.lit/http-bind"===Gc.bosh_service_url,__:(...e)=>Hc.__(...e),___:e=>e};let Wc;Vc.VERSION_NAME="v7.0.5",Object.assign(Vc,bi),cr.enable(Vc,"_converse","pluggable");let Gc={};function Jc(){var e;if(!Vc.bare_jid){const e="No JID to fetch user settings for";throw Dn.error(e),Error(e)}if(null===(e=Wc)||void 0===e||!e.fetched){const e="converse.user-settings."+Vc.bare_jid;Wc=new Bs({id:e}),Wc.browserStorage=Kc(e),Wc.fetched=Wc.fetch({promise:!0})}return Wc.fetched}const Qc=Vc.api={connection:{connected(){var e;return(null==Vc||null===(e=Vc.connection)||void 0===e?void 0:e.connected)&&!0},disconnect(){Vc.connection&&Vc.connection.disconnect()},async reconnect(){const e=Vc.connfeedback.get("connection_status");if(Qc.settings.get("authentication")===Vc.ANONYMOUS&&(await Xc(),await el()),e===Ta.e.Status.CONNFAIL?Qc.connection.isType("websocket")&&Qc.settings.get("bosh_service_url")?(await Vc.setUserJID(Vc.bare_jid),Vc.connection._proto._doDisconnect(),Vc.connection._proto=new Ta.e.Bosh(Vc.connection),Vc.connection.service=Qc.settings.get("bosh_service_url")):Qc.connection.isType("bosh")&&Qc.settings.get("websocket_url")&&(Qc.settings.get("authentication")===Vc.ANONYMOUS?await Vc.setUserJID(Qc.settings.get("jid")):await Vc.setUserJID(Vc.bare_jid),Vc.connection._proto._doDisconnect(),Vc.connection._proto=new Ta.e.Websocket(Vc.connection),Vc.connection.service=Qc.settings.get("websocket_url")):e===Ta.e.Status.AUTHFAIL&&Qc.settings.get("authentication")===Vc.ANONYMOUS&&await Vc.setUserJID(Qc.settings.get("jid")),!Vc.connection.reconnecting)return Vc.connection.reconnect();Vc.connection.debouncedReconnect()},isType:e=>Vc.connection.isType(e)},async trigger(e){if(!Vc._events)return;const t=Array.from(arguments),n=t.pop();if(n&&n.synchronous){const n=Vc._events[e]||[];await Promise.all(n.map(e=>e.callback.apply(e.ctx,t.splice(1))))}else Vc.trigger.apply(Vc,arguments);const r=Vc.promises[e];void 0!==r&&r.resolve()},hook(e,t,n){const r=Vc._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 Dn.error(e),e}),e}return n},user:{jid:()=>Vc.connection.jid,async login(e,t,n=!1){var r,i;if(e=e||Vc.jid,(null===(r=Vc.connection)||void 0===r||!r.jid||e&&!Js.isSameDomain(Vc.connection.jid,e))&&await Vc.initConnection(),null!==(i=Qc.settings.get("connection_options"))&&void 0!==i&&i.worker&&await Vc.connection.restoreWorkerSession())return;e&&(e=await Vc.setUserJID(e));const s=Vc.pluggable.plugins["converse-bosh"];if(s&&s.enabled()){if(await Vc.restoreBOSHSession())return;if(Qc.settings.get("authentication")===Vc.PREBIND&&(!n||Qc.settings.get("auto_login")))return Vc.startNewPreboundBOSHSession()}t=t||Qc.settings.get("password");!async function(e,t){const{api:n}=Vc;n.settings.get("authentication")===Vc.LOGIN?e?Zc(e):Vc.api.settings.get("credentials_url")?Zc(await async function(){let e,t=0;for(;!e;){try{e=await il(t)}catch(e){Dn.error("Could not fetch login credentials"),Dn.error(e)}t=2e3}return e}()):Vc.jid&&(Vc.api.settings.get("password")||Vc.connection.pass)?Zc():!Vc.isTestEnv()&&"credentials"in navigator?Zc(await async function(){try{const e=await navigator.credentials.get({password:!0});if(e&&"password"==e.type&&Js.isValidJID(e.id))return await Vc.setUserJID(e.id),{jid:e.id,password:e.password}}catch(e){Dn.error(e)}}()):!Vc.isTestEnv()&&Dn.warn("attemptNonPreboundSession: Couldn't find credentials to log in with"):![Vc.ANONYMOUS,Vc.EXTERNAL].includes(Vc.api.settings.get("authentication"))||t&&!Vc.api.settings.get("auto_login")||Zc()}(e&&t?{jid:e,password:t}:null,n)},logout(){const e=Js.getResolveablePromise(),t=()=>{Object.keys(Vc.promises).forEach(Yc),delete Vc.jid,Qc.trigger("logout"),e.resolve()};return Vc.connection.setDisconnectionCause(Vc.LOGOUT,void 0,!0),void 0!==Vc.connection?(Qc.listen.once("disconnected",()=>t()),Vc.connection.disconnect()):t(),e},settings:{getModel:async()=>(await Jc(),Wc),get:async(e,t)=>(await Jc(),void 0===Wc.get(e)?t:Wc.get(e)),async set(e,t){if(await Jc(),N(e))return Wc.save(e,{promise:!0});{const n={};return n[e]=t,Wc.save(n,{promise:!0})}},async clear(){await Jc(),Wc.clear()}}},settings:{extend(e){Js.merge(qc,e);const t=Object.keys(Fs(e,Object.keys(qc))),n=Fs(Gc,t),r=kr(Fs(e,t),n);Js.merge(Vc.settings,r),Js.merge(Vc,r)},update(e){return Dn.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(qc).includes(e))return Vc[e]},set(e,t){const n={};N(e)?(kr(Vc,Fs(e,Object.keys(qc))),kr(Vc.settings,Fs(e,Object.keys(qc)))):"string"==typeof e&&(n[e]=t,kr(Vc,Fs(n,Object.keys(qc))),kr(Vc.settings,Fs(n,Object.keys(qc))))}},promises:{add(e,t=!0){(e=Array.isArray(e)?e:[e]).forEach(e=>{const n=Js.getResolveablePromise();n.replace=t,Vc.promises[e]=n})}},listen:{once:Vc.once.bind(Vc),on:Vc.on.bind(Vc),not:Vc.off.bind(Vc),stanza(e,t,n){M(t)?(n=t,t={}):t=t||{},Vc.connection.addHandler(n,t.ns,e,t.type,t.id,t.from,t)}},waitUntil(e){if(M(e))return Js.waitUntil(e);{const t=Vc.promises[e];return void 0===t?null:t}},send:e=>Qc.connection.connected()?("string"==typeof e&&(e=Js.toStanza(e)),"iq"===e.tagName?Qc.sendIQ(e):(Vc.connection.send(e),void Qc.trigger("send",e))):(Dn.warn("Not sending stanza because we're not connected!"),void Dn.warn(Ta.e.serialize(e))),sendIQ(e,t=Vc.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||Vc.STANZA_TIMEOUT,n?(s=new Promise((n,r)=>Vc.connection.sendIQ(e,n,r,t)),s.catch(n=>{if(null===n)throw new Fc(`Timeout error after ${t}ms for the following IQ stanza: ${Ta.e.serialize(e)}`)})):s=new Promise(n=>Vc.connection.sendIQ(e,n,n,t))):(Vc.connection.sendIQ(e),s=Promise.resolve()),Qc.trigger("send",e),s}};function Yc(e){const t=Vc.promises[e];if(!t)throw new Error("Tried to replace non-existing promise: "+e);if(t.replace){const n=Js.getResolveablePromise();n.replace=t.replace,Vc.promises[e]=n}else Dn.debug(`Not replacing promise "${e}"`)}function Kc(e,t){const n=Vc.storage[t||Vc.getDefaultStore()];return new _n(e,n)}async function Xc(){return await Vc.api.trigger("beforeTearDown",{synchronous:!0}),window.removeEventListener("click",Vc.onUserActivity),window.removeEventListener("focus",Vc.onUserActivity),window.removeEventListener("keypress",Vc.onUserActivity),window.removeEventListener("mousemove",Vc.onUserActivity),window.removeEventListener(Vc.unloadevent,Vc.onUserActivity),window.clearInterval(Vc.everySecondTrigger),Vc.api.trigger("afterTearDown"),Vc}function Zc(e){if([Vc.ANONYMOUS,Vc.EXTERNAL].includes(Vc.api.settings.get("authentication"))){if(!Vc.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.");Vc.connection.reconnecting||Vc.connection.reset(),Vc.connection.connect(Vc.jid.toLowerCase())}else if(Vc.api.settings.get("authentication")===Vc.LOGIN){var t;const n=e?e.password:(null===(t=Vc.connection)||void 0===t?void 0:t.pass)||Vc.api.settings.get("password");if(!n){if(Vc.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 Vc.connection.setDisconnectionCause(Ta.e.Status.AUTHFAIL,void 0,!0),void Vc.api.connection.disconnect()}Vc.connection.reconnecting||Vc.connection.reset(),Vc.connection.connect(Vc.jid,n)}}function el(){var e;return null===(e=Vc.session)||void 0===e||e.destroy(),delete Vc.session,Vc.shouldClearCache()&&Vc.api.user.settings.clear(),Vc.api.trigger("clearSession",{synchronous:!0})}async function tl(e){var t;const n=Qc.settings.get("connection_options").worker,r="converse.session-"+Ta.e.getBareJidFromJid(e).toLowerCase();(null===(t=Vc.session)||void 0===t?void 0:t.get("id"))!==r?(Vc.session=new Bs({id:r}),Vc.session.browserStorage=Kc(r,n?"persistent":"session"),await new Promise(e=>Vc.session.fetch({success:e,error:e})),!n&&Vc.session.get("active")&&(Vc.session.clear(),Vc.session.save({id:r})),nl(e),function(){if("sessionStorage"===Qc.settings.get("persistent_store"))return;if("BrowserExtLocal"===Vc.api.settings.get("persistent_store"))return _n.localForage.defineDriver(hr.a).then(()=>_n.localForage.setDriver("webExtensionLocalStorage")),void(Vc.storage.persistent=_n.localForage);if("BrowserExtSync"===Vc.api.settings.get("persistent_store"))return _n.localForage.defineDriver(ur.a).then(()=>_n.localForage.setDriver("webExtensionSyncStorage")),void(Vc.storage.persistent=_n.localForage);const e={name:Vc.isTestEnv()?"converse-test-persistent":"converse-persistent",storeName:Vc.bare_jid};"localStorage"===Vc.api.settings.get("persistent_store")?(e.description="localStorage instance",e.driver=[_n.localForage.LOCALSTORAGE]):"IndexedDB"===Vc.api.settings.get("persistent_store")&&(e.description="indexedDB instance",e.driver=[_n.localForage.INDEXEDDB]),Vc.storage.persistent=_n.localForage.createInstance(e)}(),Vc.api.trigger("userSessionInitialized")):nl(e)}function nl(e){e=Vc.session.get("jid")||e,Vc.api.settings.get("authentication")===Vc.ANONYMOUS||Ta.e.getResourceFromJid(e)||(e=e.toLowerCase()+pa.generateResource()),Vc.jid=e,Vc.bare_jid=Ta.e.getBareJidFromJid(e),Vc.resource=Ta.e.getResourceFromJid(e),Vc.domain=Ta.e.getDomainFromJid(e),Vc.session.save({jid:e,bare_jid:Vc.bare_jid,resource:Vc.resource,domain:Vc.domain,active:!0}),Vc.connection.jid=e}async function rl(){var e;await Qc.trigger("cleanup",{synchronous:!0}),Vc.router.history.stop(),document.removeEventListener("visibilitychange",Vc.saveWindowState),Qc.trigger("unregisteredGlobalEventHandlers"),null===(e=Vc.connection)||void 0===e||e.reset(),Vc.stopListening(),Vc.off(),Vc.promises.initialized.isResolved&&Qc.promises.add("initialized")}function il(e=0){return new Promise(Ma((e,t)=>{const n=new XMLHttpRequest;n.open("GET",Qc.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);Vc.setUserJID(t.jid).then(()=>{e({jid:t.jid,password:t.password})})}else t(new Error(`${n.status}: ${n.responseText}`))},n.onerror=t,n.send()},e))}Vc.isUniView=function(){return["mobile","fullscreen","embedded"].includes(Qc.settings.get("view_mode"))},Vc.getDefaultStore=function(){if(Vc.config.get("trusted")){return"sessionStorage"===Qc.settings.get("persistent_store")?"session":"persistent"}return"session"},Vc.createStore=Kc,Vc.shouldClearCache=()=>!Vc.config.get("trusted")||Qc.settings.get("clear_cache_on_logout")||Vc.isTestEnv(),Vc.initConnection=function(){const e=Vc.api;if(!e.settings.get("bosh_service_url")){if(e.settings.get("authentication")===Vc.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=Vc.isTestEnv()?ga:pa;if(("WebSocket"in window||"MozWebSocket"in window)&&e.settings.get("websocket_url"))Vc.connection=new t(e.settings.get("websocket_url"),Object.assign(Vc.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.");Vc.connection=new t(e.settings.get("bosh_service_url"),Object.assign(Vc.default_connection_options,e.settings.get("connection_options"),{keepalive:e.settings.get("keepalive")}))}!function(){const e={};e[Ta.e.LogLevel.DEBUG]="debug",e[Ta.e.LogLevel.INFO]="info",e[Ta.e.LogLevel.WARN]="warn",e[Ta.e.LogLevel.ERROR]="error",e[Ta.e.LogLevel.FATAL]="fatal",Ta.e.log=(t,n)=>Dn.log(n,e[t]),Ta.e.error=e=>Dn.error(e),Vc.connection.xmlInput=e=>Dn.debug(e.outerHTML,"color: darkgoldenrod"),Vc.connection.xmlOutput=e=>Dn.debug(e.outerHTML,"color: darkcyan")}(),e.trigger("connectionInitialized")},Vc.setUserJID=async function(e){return await tl(e),Vc.api.trigger("setUserJID"),e},Vc.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",Vc.windowState=t,Qc.trigger("windowStateChanged",{state:t})},Vc.ConnectionFeedback=Bs.extend({defaults:{connection_status:Ta.e.Status.DISCONNECTED,message:""},initialize(){this.on("change",()=>Qc.trigger("connfeedback",Vc.connfeedback))}});const sl=window.converse||{};Object.assign(sl,{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 rl(),"onpagehide"in window?Vc.unloadevent="pagehide":"onbeforeunload"in window?Vc.unloadevent="beforeunload":"onunload"in window&&(Vc.unloadevent="unload"),function(e){Vc.settings={},Gc=e;const t=Fs(e,Object.keys(qc));kr(Vc.settings,qc,t),kr(Vc,qc,t)}(e),Vc.strict_plugin_dependencies=e.strict_plugin_dependencies,Dn.setLogLevel(Qc.settings.get("loglevel")),Qc.settings.get("authentication")===Vc.ANONYMOUS&&Qc.settings.get("auto_login")&&!Qc.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.");Vc.router.route(/^converse\?loglevel=(debug|info|warn|error|fatal)$/,"loglevel",e=>Dn.setLogLevel(e)),Vc.connfeedback=new Vc.ConnectionFeedback,Vc.send_initial_presence=!0,await async function(){await _n.sessionStorageInitialized,Vc.storage={session:_n.localForage.createInstance({name:Vc.isTestEnv()?"converse-test-session":"converse-session",description:"sessionStorage instance",driver:["sessionStorageWrapper"]})}}(),await async function(){const e="converse.client-config";Vc.config=new Bs({id:e,trusted:!0}),Vc.config.browserStorage=Kc(e,"session"),await new Promise(e=>Vc.config.fetch({success:e,error:e})),Vc.api.trigger("clientConfigInitialized")}(),await Hc.initialize(),function(){Vc.pluggable.initialized_plugins=[];const e=Bc.concat(Vc.api.settings.get("whitelisted_plugins"));Vc.api.settings.get("singleton")&&["converse-bookmarks","converse-controlbox","converse-headline","converse-register"].forEach(e=>Vc.api.settings.get("blacklisted_plugins").push(e)),Vc.pluggable.initializePlugins({_converse:Vc},e,Vc.api.settings.get("blacklisted_plugins")),Vc.api.trigger("pluginsInitialized")}(),document.addEventListener("visibilitychange",Vc.saveWindowState),Vc.saveWindowState({type:document.hidden?"blur":"focus"}),Qc.trigger("registeredGlobalEventHandlers"),!History.started&&Vc.router.history.start(),Qc.settings.get("idle_presence_timeout")>0&&Qc.listen.on("addClientFeatures",()=>Qc.disco.own.features.add(Ta.e.NS.IDLE));const t=Vc.pluggable.plugins;if((Qc.settings.get("auto_login")||Qc.settings.get("keepalive")&&$a(t["converse-bosh"],"enabled"))&&await Qc.user.login(null,null,!0),Qc.trigger("initialized"),Vc.isTestEnv())return Vc},plugins:{add(e,t){if(t.__name__=e,void 0!==Vc.pluggable.plugins[e])throw new TypeError(`Error: plugin with name "${e}" has already been registered!`);Vc.pluggable.plugins[e]=t}},env:{$build:Ta.a,$iq:Ta.b,$msg:Ta.c,$pres:Ta.d,utils:Js,Collection:ia,Model:Bs,Promise:Promise,Strophe:Ta.e,dayjs:Sn.a,html:wc,log:Dn,sizzle:pr.a,sprintf:zc.sprintf,stanza_utils:go,u:Js}});const ol=new CustomEvent("converse-loaded",{detail:{converse:sl}});window.dispatchEvent(ol);const{Strophe:al}=sl.env;let cl,ll;al.addNamespace("ADHOC","http://jabber.org/protocol/commands");const ul={adhoc:{async getCommands(e){let t=[];try{n=await ll.disco.items(e,al.NS.ADHOC),t=pr()(`query[xmlns="${al.NS.DISCO_ITEMS}"][node="${al.NS.ADHOC}"] item`,n).map(go.getAttributes)}catch(t){null===t?Dn.error("Error: timeout while fetching ad-hoc commands for "+e):(Dn.error("Error while fetching ad-hoc commands for "+e),Dn.error(t))}var n;return t}}};sl.plugins.add("converse-adhoc",{dependencies:["converse-disco"],initialize(){cl=this._converse,ll=cl.api,Object.assign(ll,ul)}});var dl=n(60),hl=n.n(dl);var fl=function(e){return function(t,n,r){var i=Object(t);if(!Qe(t)){var s=Es(n,3);t=Ye(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}}(Do);var pl=function(e,t){return e===t||ds(e,t,fs(t))};
/**
* @module converse-chat
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{$msg:gl,Strophe:ml,sizzle:vl,utils:_l}=sl.env,bl=sl.env.utils;sl.plugins.add("converse-chat",{dependencies:["converse-chatboxes","converse-disco"],initialize(){const{__:e}=Vc;Qc.settings.extend({allow_message_corrections:"all",allow_message_retraction:"all",auto_join_private_chats:[],clear_messages_on_reconnection:!1,filter_by_resource:!1,send_chat_state_notifications:!0});const t=Bs.extend({initialize(){this.rosterContactAdded=bl.getResolveablePromise()},async setRosterContact(e){const t=await Qc.contacts.get(e);t&&(this.contact=t,this.set("nickname",t.get("nickname")),this.rosterContactAdded.resolve())}});Vc.Message=t.extend({defaults:()=>({msgid:bl.getUniqueId(),time:(new Date).toISOString(),is_ephemeral:!1}),async initialize(){this.checkValidity()&&(this.initialized=bl.getResolveablePromise(),"chat"===this.get("type")&&(t.prototype.initialize.apply(this,arguments),this.setRosterContact(ml.getBareJidFromJid(this.get("from")))),this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage(),await Qc.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(Qc.settings.get("allow_message_retraction"))},safeDestroy(){try{this.destroy()}catch(e){Dn.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(){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=sl.env.$iq({from:Vc.jid,to:this.get("slot_request_url"),type:"get"}).c("request",{xmlns:ml.NS.HTTPUPLOAD,filename:this.file.name,size:this.file.size,"content-type":this.file.type});return Qc.sendIQ(e)},async getRequestSlotURL(){let t;try{t=await this.sendSlotRequestStanza()}catch(t){return Dn.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 t=new XMLHttpRequest;t.onreadystatechange=()=>{t.readyState===XMLHttpRequest.DONE&&(Dn.info("Status: "+t.status),200===t.status||201===t.status?this.save({upload:Vc.SUCCESS,oob_url:this.get("get"),message:this.get("get")}):t.onerror())},t.upload.addEventListener("progress",e=>{e.lengthComputable&&this.set("progress",e.loaded/e.total)},!1),t.onerror=()=>{let n;n=t.responseText?e('Sorry, could not succesfully upload your file. Your servers response: "%1$s"',t.responseText):e("Sorry, could not succesfully upload your file."),this.save({type:"error",upload:Vc.FAILURE,message:n,is_ephemeral:!0})},t.open("PUT",this.get("put"),!0),t.setRequestHeader("Content-type",this.file.type),t.send(this.file)}}),Vc.Messages=ia.extend({model:Vc.Message,comparator:"time"}),Vc.ChatBox=t.extend({messagesCollection:Vc.Messages,defaults(){return{bookmarked:!1,chat_state:void 0,hidden:Vc.isUniView()&&!Qc.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:Vc.PRIVATE_CHAT_TYPE,url:""}},async initialize(){this.initialized=bl.getResolveablePromise(),t.prototype.initialize.apply(this,arguments);const e=this.get("jid");e&&(this.set({box_id:"box-"+e}),this.initNotifications(),this.initMessages(),this.get("type")===Vc.PRIVATE_CHAT_TYPE&&(this.presence=Vc.presences.findWhere({jid:e})||Vc.presences.create({jid:e}),await this.setRosterContact(e)),this.on("change:chat_state",this.sendChatState,this),await this.fetchMessages(),await Qc.trigger("chatBoxInitialized",this,{Synchronous:!0}),this.initialized.resolve())},getMessagesCacheKey(){return`converse.messages-${this.get("jid")}-${Vc.bare_jid}`},initMessages(){this.messages=new this.messagesCollection,this.messages.fetched=bl.getResolveablePromise(),this.messages.fetched.then(()=>{Qc.trigger("afterMessagesFetched",this)}),this.messages.chatbox=this,this.messages.browserStorage=Vc.createStore(this.getMessagesCacheKey()),this.listenTo(this.messages,"change:upload",e=>{e.get("upload")===Vc.SUCCESS&&Qc.send(this.createMessageStanza(e))})},initNotifications(){this.notifications=new Bs},afterMessagesFetched(){Qc.trigger("afterMessagesFetched",this)},fetchMessages(){if(this.messages.fetched_flag)return void Dn.info("Not re-fetching messages for "+this.get("jid"));this.messages.fetched_flag=!0;const e=this.messages.fetched.resolve;return this.messages.fetch({add:!0,success:()=>{this.afterMessagesFetched(),e()},error:()=>{this.afterMessagesFetched(),e()}}),this.messages.fetched},async handleErrorMessageStanza(t){const n=await go.parseMessage(t,Vc);if(!await this.shouldShowErrorMessage(n))return;const r=this.getMessageReferencedByError(n);if(r){const t={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")?(t.retraction_id=void 0,n.error||("forbidden"===n.error_condition?t.error=e("You're not allowed to retract your message."):t.error=e("Sorry, an error occurred while trying to retract your message."))):n.error||("forbidden"===n.error_condition?t.error=e("You're not allowed to send a message."):t.error=e("Sorry, an error occurred while trying to send your message.")),r.save(t)}else this.createMessage(n)},queueMessage(e){return this.msg_chain=(this.msg_chain||this.messages.fetched).then(()=>this.onMessage(e)).catch(e=>Dn.error(e)),this.msg_chain},async onMessage(e){if(e=await e,bl.isErrorObject(e))return e.stanza&&Dn.error(e.stanza),Dn.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),bl.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"),Dn.error(e)}finally{delete this.msg_chain,delete this.messages.fetched_flag,this.messages.fetched=bl.getResolveablePromise()}},async close(){try{await new Promise((e,t)=>this.destroy({success:e,error:(e,n)=>t(n)}))}catch(e){Dn.error(e)}finally{Qc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()}},announceReconnection(){Qc.trigger("chatReconnected",this)},async onReconnection(){Qc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages(),this.announceReconnection()},validate(e){if(!e.jid)return"Ignored ChatBox without JID";const t=Vc.auto_join_rooms.map(e=>N(e)?e.jid:e),n=Qc.settings.get("auto_join_private_chats").concat(t);if(Qc.settings.get("singleton")&&!n.includes(e.jid)&&!Qc.settings.get("auto_join_on_invite")){const t=e.jid+" is not allowed because singleton is true and it's not being auto_joined";return Dn.warn(t),t}},getDisplayName(){return this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("jid")},async createMessageFromError(e){if(e instanceof Vc.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===Vc.COMPOSING?this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),Vc.TIMEOUTS.PAUSED,Vc.PAUSED):e===Vc.PAUSED&&(this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),Vc.TIMEOUTS.INACTIVE,Vc.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)=>bl.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(Fs(e,t)),!0):(e.dangling_retraction=!0,await this.createMessage(e),!0)}{const n=this.findDanglingRetraction(e);if(n){const r=Fs(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||pl(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={};return n["stanza_id "+t.replace(/^stanza_id /,"")]=e[t],n}),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=gl({id:bl.getUniqueId(),to:this.get("jid"),type:"chat"}).c("store",{xmlns:ml.NS.HINTS}).up().c("apply-to",{id:t,xmlns:ml.NS.FASTEN}).c("retract",{xmlns:ml.NS.RETRACT});return Vc.connection.send(n)},sendMarkerForMessage(e){if(null!=e&&e.get("is_markable")){const t=ml.getBareJidFromJid(e.get("from"));this.sendMarker(t,e.get("msgid"),"displayed",e.get("type"))}},sendMarker(e,t,n,r){const i=gl({from:Vc.connection.jid,id:bl.getUniqueId(),to:e,type:r||"chat"}).c(n,{xmlns:ml.NS.MARKERS,id:t});Qc.send(i)},handleChatMarker(e){if(ml.getBareJidFromJid(e.to)!==Vc.bare_jid)return!1;if(e.is_markable)return!this.contact||e.is_archived||e.is_carbon||this.sendMarker(e.from,e.msgid,"received"),!1;if(e.marker_id){const t=this.messages.findWhere({msgid:e.marker_id}),n="marker_"+e.marker;return t&&!t.get(n)&&t.save({field_name:(new Date).toISOString()}),!0}},sendReceiptStanza(e,t){const n=gl({from:Vc.connection.jid,id:bl.getUniqueId(),to:e,type:"chat"}).c("received",{xmlns:ml.NS.RECEIPTS,id:t}).up().c("store",{xmlns:ml.NS.HINTS}).up();Qc.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=gl({from:Vc.connection.jid,to:this.get("jid"),type:this.get("message_type"),id:e.get("edited")&&bl.getUniqueId()||e.get("msgid")}).c("body").t(e.get("message")).up().c(Vc.ACTIVE,{xmlns:ml.NS.CHATSTATES}).root();return"chat"===e.get("type")&&t.c("request",{xmlns:ml.NS.RECEIPTS}).root(),e.get("is_spoiler")&&(e.get("spoiler_hint")?t.c("spoiler",{xmlns:ml.NS.SPOILER},e.get("spoiler_hint")).root():t.c("spoiler",{xmlns:ml.NS.SPOILER}).root()),(e.get("references")||[]).forEach(e=>{const n={xmlns:ml.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:ml.NS.OUTOFBAND}).c("url").t(e.get("oob_url")).root(),e.get("edited")&&t.c("replace",{xmlns:ml.NS.MESSAGE_CORRECT,id:e.get("msgid")}).root(),e.get("origin_id")&&t.c("origin-id",{xmlns:ml.NS.SID,id:e.get("origin_id")}).root(),t},getOutgoingMessageAttributes(e,t){const n=this.get("composing_spoiler"),r=bl.getUniqueId(),i=e?bl.httpToGeoUri(bl.shortnamesToUnicode(e),Vc):void 0;return{from:Vc.bare_jid,fullname:Vc.xmppstatus.get("fullname"),id:r,is_only_emojis:!!e&&bl.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&&!bl.isEmptyMessage(e)&&"me"===e.sender)if("all"===Qc.settings.get("allow_message_corrections"))e.editable=!(e.file||e.retracted||"oob_url"in e);else if("last"===Qc.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){e.time=e.time||(new Date).toISOString(),await this.messages.fetched;return 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:bl.getUniqueId(),received:void 0})}else this.setEditable(n,(new Date).toISOString()),r=await this.createMessage(n);return Qc.send(this.createMessageStanza(r)),Qc.trigger("sendMessage",{chatbox:this,message:r}),r},sendChatState(){if(Qc.settings.get("send_chat_state_notifications")&&this.get("chat_state")){const e=Qc.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;Qc.send(gl({id:bl.getUniqueId(),to:this.get("jid"),type:"chat"}).c(this.get("chat_state"),{xmlns:ml.NS.CHATSTATES}).up().c("no-store",{xmlns:ml.NS.HINTS}).up().c("no-permanent-store",{xmlns:ml.NS.HINTS}))}},async sendFiles(t){var n;const r=(await Qc.disco.features.get(ml.NS.HTTPUPLOAD,Vc.domain)).pop();if(!r)return void this.createMessage({message:e("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0});const i=r.dataforms.where({FORM_TYPE:{value:ml.NS.HTTPUPLOAD,type:"hidden"}}).pop(),s=window.parseInt(null===(n=((null==i?void 0:i.attributes)||{})["max-file-size"])||void 0===n?void 0:n.value),o=null==r?void 0:r.id;o?Array.from(t).forEach(async t=>{if(!window.isNaN(s)&&window.parseInt(t.size)>s)return this.createMessage({message:e("The size of your file, %1$s, exceeds the maximum allowed by your server, which is %2$s.",t.name,hl()(s)),type:"error",is_ephemeral:!0});{const e=Object.assign(this.getOutgoingMessageAttributes(),{file:!0,progress:0,slot_request_url:o});this.setEditable(e,(new Date).toISOString());const n=await this.createMessage(e,{silent:!0});n.file=t,this.messages.trigger("add",n),n.getRequestSlotURL()}}):this.createMessage({message:e("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0})},maybeShow(e){if(e){if(Vc.isUniView()){const e=e=>!e.get("hidden")&&e.get("jid")!==this.get("jid")&&"controlbox"!==e.get("id");Vc.chatboxes.filter(e).forEach(e=>bl.safeSave(e,{hidden:!0}))}bl.safeSave(this,{hidden:!1})}return Vc.isUniView()&&this.get("hidden")?void 0:this.trigger("show")},isHidden(){return Vc.isUniView()&&this.get("hidden")||this.isScrolledUp()||"hidden"===Vc.windowState},handleUnreadMessage(e){if(null!=e&&e.get("body")&&_l.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()),bl.safeSave(this,{num_unread:0})},isScrolledUp(){return this.get("scrolled",!0)}}),Vc.handleMessageStanza=async function(e){if(go.isServerMessage(e)){const t=e.getAttribute("from");return Dn.info("handleMessageStanza: Ignoring incoming server message from JID: "+t)}const t=await go.parseMessage(e,Vc);if(bl.isErrorObject(t))return t.stanza&&Dn.error(t.stanza),Dn.error(t.message);const n=!!vl(`body, encrypted[xmlns="${ml.NS.OMEMO}"]`,e).length,r=await Qc.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};Qc.trigger("message",i)},Vc.router.route("converse/chat?jid=:jid",(function(e){if(!_l.isValidJID(e))return Dn.warn(`Invalid JID "${e}" provided in URL fragment`);Qc.chats.open(e)})),Qc.listen.on("chatBoxesFetched",(function(){Qc.settings.get("auto_join_private_chats").forEach(e=>{Vc.chatboxes.where({jid:e}).length||("string"==typeof e?Qc.chats.open(e):Dn.error('Invalid jid criteria specified for "auto_join_private_chats"'))}),Qc.trigger("privateChatsAutoJoined")})),Qc.listen.on("presencesInitialized",(function(){Vc.connection.addHandler(e=>vl(`message > result[xmlns="${ml.NS.MAM}"]`,e).pop()?(Dn.warn('Received a MAM message with type "chat".'),!0):(Vc.handleMessageStanza(e),!0),null,"message","chat"),Vc.connection.addHandler(e=>(null!==e.getAttribute("type")||Vc.handleMessageStanza(e),!0),ml.NS.RECEIPTS,"message"),Vc.connection.addHandler(e=>(async function(e){const t=ml.getBareJidFromJid(e.getAttribute("from"));if(_l.isSameBareJID(t,Vc.bare_jid))return;const n=await Qc.chatboxes.get(t);null==n||n.handleErrorMessageStanza(e)}(e),!0),null,"message","error")})),Qc.listen.on("clearSession",async()=>{if(Vc.shouldClearCache()){await Promise.all(Vc.chatboxes.map(e=>e.messages&&e.messages.clearStore({silent:!0})));const e=e=>e.get("type")!==Vc.CONTROLBOX_TYPE;Vc.chatboxes.clearStore({silent:!0},e)}}),Object.assign(Qc,{chats:{async create(e,t){if("string"==typeof e){if(t&&(null==t||!t.fullname)){var n;const r=await Qc.contacts.get(e);t.fullname=null==r||null===(n=r.attributes)||void 0===n?void 0:n.fullname}const r=Qc.chats.get(e,t,!0);return r||void Dn.error("Could not open chatbox for JID: "+e)}return Array.isArray(e)?Promise.all(e.forEach(async n=>{var r;const i=await Qc.contacts.get(e);return t.fullname=null==i||null===(r=i.attributes)||void 0===r?void 0:r.fullname,Qc.chats.get(n,t,!0).maybeShow()})):(Dn.error("chats.create: You need to provide at least one JID"),null)},async open(e,t,n){if("string"==typeof e){const r=await Qc.chats.get(e,t,!0);return r?r.maybeShow(n):r}if(Array.isArray(e))return Promise.all(e.map(e=>Qc.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 Dn.error(r),new Error(r)},async get(e,t={},n=!1){async function r(e){let r=await Qc.chatboxes.get(e);return!r&&n?r=await Qc.chatboxes.create(e,t,Vc.ChatBox):(r=r&&r.get("type")===Vc.PRIVATE_CHAT_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Qc.chatboxes.get()).filter(e=>e.get("type")===Vc.PRIVATE_CHAT_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(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:yl,$iq:wl,utils:Sl}=sl.env;sl.plugins.add("converse-disco",{initialize(){function e(){if(!Vc.stream_features){const e="converse.stream-features-"+yl.getBareJidFromJid(Vc.jid);Qc.promises.add("streamFeaturesAdded"),Vc.stream_features=new ia,Vc.stream_features.browserStorage=Vc.createStore(e,"session")}}function t(){Qc.trigger("streamFeaturesAdded")}Qc.promises.add("discoInitialized"),Qc.promises.add("streamFeaturesAdded"),Vc.DiscoEntity=Bs.extend({idAttribute:"jid",initialize(e,t){this.waitUntilFeaturesDiscovered=Sl.getResolveablePromise(),this.dataforms=new ia;let n="converse.dataforms-"+this.get("jid");this.dataforms.browserStorage=Vc.createStore(n,"session"),this.features=new ia,n="converse.features-"+this.get("jid"),this.features.browserStorage=Vc.createStore(n,"session"),this.listenTo(this.features,"add",this.onFeatureAdded),this.fields=new ia,n="converse.fields-"+this.get("jid"),this.fields.browserStorage=Vc.createStore(n,"session"),this.listenTo(this.fields,"add",this.onFieldAdded),this.identities=new ia,n="converse.identities-"+this.get("jid"),this.identities.browserStorage=Vc.createStore(n,"session"),this.fetchFeatures(t),this.items=new Vc.DiscoEntities,n="converse.disco-items-"+this.get("jid"),this.items.browserStorage=Vc.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,Qc.trigger("serviceDiscovered",e)},onFieldAdded(e){e.entity=this,Qc.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 Qc.disco.info(this.get("jid"),null)}catch(e){return null===e?Dn.error("Timeout for disco#info query for "+this.get("jid")):Dn.error(e),void this.waitUntilFeaturesDiscovered.resolve(this)}this.onInfo(e)},onDiscoItems(e){pr()(`query[xmlns="${yl.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=Vc.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 Qc.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")})}),pr()(`x[type="result"][xmlns="${yl.NS.XFORM}"]`,e).forEach(e=>{const t={};pr()("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="${yl.NS.DISCO_ITEMS}"]`)&&this.queryForItems(),Array.from(e.querySelectorAll("feature")).forEach(t=>{this.features.create({var:t.getAttribute("var"),from:e.getAttribute("from")})}),pr()('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")}}),Vc.DiscoEntities=ia.extend({model:Vc.DiscoEntity,fetchEntities(){return new Promise((e,t)=>{this.fetch({add:!0,success:e,error(e,n){Dn.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:yl.NS.DISCO_INFO};t&&(r.node=t);const i=wl({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()),Qc.send(i.tree()),!0}async function i(){Qc.disco.own.identities.add("client","web","Converse"),Qc.disco.own.features.add(yl.NS.CHATSTATES),Qc.disco.own.features.add(yl.NS.DISCO_INFO),Qc.disco.own.features.add(yl.NS.ROSTERX),Qc.settings.get("message_carbons")&&Qc.disco.own.features.add(yl.NS.CARBONS),Qc.trigger("addClientFeatures"),Vc.connection.addHandler(r,yl.NS.DISCO_INFO,"iq","get",null,null),Vc.disco_entities=new Vc.DiscoEntities;const e="converse.disco-entities-"+Vc.bare_jid;Vc.disco_entities.browserStorage=Vc.createStore(e,"session");const t=await Vc.disco_entities.fetchEntities();0!==t.length&&t.get(Vc.domain)||Vc.disco_entities.create({jid:Vc.domain}),Qc.trigger("discoInitialized")}n._identities=[],n._features=[],Qc.listen.on("userSessionInitialized",async()=>{e(),Vc.connfeedback.get("connection_status")===yl.Status.ATTACHED&&(await new Promise((e,t)=>Vc.stream_features.fetch({success:e,error:t})),t())}),Qc.listen.on("beforeResourceBinding",(function(){e(),Array.from(Vc.connection.features.childNodes).forEach(e=>{Vc.stream_features.create({name:e.nodeName,xmlns:e.getAttribute("xmlns")})}),t()})),Qc.listen.on("reconnected",i),Qc.listen.on("connected",i),Qc.listen.on("beforeTearDown",async()=>{Qc.promises.add("streamFeaturesAdded"),Vc.stream_features&&(await Vc.stream_features.clearStore(),delete Vc.stream_features)}),Qc.listen.on("clearSession",()=>{Vc.shouldClearCache()&&Vc.disco_entities&&(Array.from(Vc.disco_entities.models).forEach(e=>e.features.clearStore()),Array.from(Vc.disco_entities.models).forEach(e=>e.identities.clearStore()),Array.from(Vc.disco_entities.models).forEach(e=>e.dataforms.clearStore()),Array.from(Vc.disco_entities.models).forEach(e=>e.fields.clearStore()),Vc.disco_entities.clearStore(),delete Vc.disco_entities)}),Object.assign(Qc,{disco:{stream:{async getFeature(e,t){if(await Qc.waitUntil("streamFeaturesAdded"),!e||!t)throw new Error("name and xmlns need to be provided when calling disco.stream.getFeature");if(void 0!==Vc.stream_features||Qc.connection.connected())return Vc.stream_features.findWhere({name:e,xmlns:t});{const n=`Tried to get feature ${e} ${t} but _converse.stream_features has been torn down`;Dn.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:yl.NS.DISCO_INFO};t&&(n.node=t);const r=wl({from:Vc.connection.jid,to:e,type:"get"}).c("query",n);return Qc.sendIQ(r)},items(e,t){const n={xmlns:yl.NS.DISCO_ITEMS};return t&&(n.node=t),Qc.sendIQ(wl({from:Vc.connection.jid,to:e,type:"get"}).c("query",n))},entities:{async get(e,t=!1){if(await Qc.waitUntil("discoInitialized"),!e)return Vc.disco_entities;if(void 0===Vc.disco_entities&&!Qc.connection.connected()){const t=`Tried to look up entity ${e} but _converse.disco_entities has been torn down`;return void Dn.warn(t)}const n=Vc.disco_entities.get(e);return n||!t?n:Qc.disco.entities.create(e)},create:(e,t)=>Vc.disco_entities.create({jid:e},t)},features:{async get(e,t){if(!t)throw new TypeError("You need to provide an entity JID");await Qc.waitUntil("discoInitialized");let n=await Qc.disco.entities.get(t,!0);if(void 0===Vc.disco_entities&&!Qc.connection.connected()){const n=`Tried to get feature ${e} for ${t} but _converse.disco_entities has been torn down`;return void Dn.warn(n)}n=await n.waitUntilFeaturesDiscovered;const r=[...n.items.map(t=>t.hasFeature(e)),n.hasFeature(e)];return(await Promise.all(r)).filter(N)}},supports:async(e,t)=>(await Qc.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 Qc.waitUntil("discoInitialized");let t=await Qc.disco.entities.get(e);return t?(t.features.reset(),t.fields.reset(),t.identities.reset(),t.waitUntilFeaturesDiscovered.isPending||(t.waitUntilFeaturesDiscovered=Sl.getResolveablePromise()),t.queryInfo()):t=await Qc.disco.entities.create(e,{ignore_cache:!0}),t.waitUntilFeaturesDiscovered},refreshFeatures:e=>Qc.refresh(e),async getFeatures(e){if(!e)throw new TypeError("api.disco.getFeatures: You need to provide an entity JID");await Qc.waitUntil("discoInitialized");let t=await Qc.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 Qc.waitUntil("discoInitialized");let t=await Qc.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.fields},async getIdentity(e,t,n){const r=await Qc.disco.entities.get(n,!0);if(void 0!==r||Qc.connection.connected())return r.getIdentity(e,t);{const t=`Tried to look up category ${e} for ${n} but _converse.disco_entities has been torn down`;Dn.warn(t)}}}})}});const xl=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"),El=/(?:\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,Al=sl.env.utils;sl.emojis={initialized:!1,initialized_promise:Al.getResolveablePromise()};const Cl={"*\\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 kl(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 jl(){var e;return sl.emojis.toned||(sl.emojis.toned=(e=Object.values(sl.emojis.json.people).filter(e=>e.sn.includes("_tone")).map(e=>e.sn.replace(/_tone[1-5]/,"")),[...new Set(e)])),sl.emojis.toned}function Tl(e){return e.replace(xl,(e,t,n,r)=>{if(void 0===r||""===r||!(Al.unescapeHTML(r)in Cl))return e;r=Al.unescapeHTML(r);return n+kl(Cl[r].toUpperCase())})}function Ol(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(Qc.settings.get("use_system_emojis"))return t.add_title_wrapper&&r?wc`<span title="${r}">${n}</span>`:n;{const t=Qc.settings.get("emoji_image_path");return wc`<img class="emoji"
draggable="false"
title="${r}"
alt="${n}"
src="${t}/72x72/${e.cp}.png"/>`}}return t.unicode_only?r:wc`<img class="emoji"
draggable="false"
title="${r}"
alt="${r}"
src="${sl.emojis.by_sn[r].url}">`}function Nl(e){if(!sl.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(sl.emojis.shortnames_regex)].filter(e=>e[0].length>0).map(e=>{const t=sl.emojis.by_sn[e[0]].cp;return{cp:t,begin:e.index,end:e.index+e[0].length,shortname:e[0],emoji:t?kl(t):null}})}function Il(e){const t=[];return function(e,t){const n=/\uFE0F/g,r=String.fromCharCode(8205);String(e).replace(El,(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=Al.getEmojisByAtrribute("cp")[e])||void 0===i?void 0:i.sn)||""})}),t}sl.plugins.add("converse-emoji",{initialize(){const{___:e}=Vc;Qc.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")}}),Vc.EmojiPicker=Bs.extend({defaults:{current_category:"smileys",current_skintone:"",scroll_position:0}});const t={};Object.assign(Al,{shortnamesToEmojis:(e,t={unicode_only:!1,add_title_wrapper:!1})=>function(e,t){let n=[e];return[...Nl(e),...Il(e)].sort((e,t)=>t.begin-e.begin).forEach(e=>{const r=n.shift(),i=Ol(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=Tl(e),t),shortnamesToUnicode:e=>Al.shortnamesToEmojis(e,{unicode_only:!0})[0],isOnlyEmojis(e){const t=e.trim().split(/\s+/);if(0===t.length||t.length>3)return!1;return t.filter(e=>{const t=Il(Al.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 sl.emojis.json;const n=sl.emojis.list.map(t=>t[e]).filter((e,t,n)=>n.indexOf(e)==t);return t[e]={},n.forEach(n=>t[e][n]=sl.emojis.list.find(t=>t[e]===n)),t[e]}}),Object.assign(Qc,{emojis:{async initialize(){if(!sl.emojis.initialized){sl.emojis.initialized=!0;const{default:e}=await n.e(137).then(n.t.bind(null,542,3));sl.emojis.json=e,sl.emojis.by_sn=Object.keys(e).reduce((t,n)=>Object.assign(t,e[n]),{}),sl.emojis.list=Object.values(sl.emojis.by_sn),sl.emojis.list.sort((e,t)=>e.sn<t.sn?-1:e.sn>t.sn?1:0),sl.emojis.shortnames=sl.emojis.list.map(e=>e.sn);const t=()=>sl.emojis.shortnames.map(e=>e.replace(/[+]/g,"\\$&")).join("|");sl.emojis.shortnames_regex=new RegExp(t(),"gi"),sl.emojis.toned=jl(),sl.emojis.initialized_promise.resolve()}return sl.emojis.initialized_promise}}})}});var Ml=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 Rl=function(e,t){return Ml(e||[],t||[],we)},$l=Math.min;var Dl=function(e,t,n){for(var r=n?jo:ko,i=e[0].length,s=e.length,o=s,a=Array(s),c=1/0,l=[];o--;){var u=e[o];o&&t&&(u=zr(u,Pe(t))),c=$l(u.length,c),a[o]=!n&&(t||i>=120&&u.length>=120)?new Yi(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?Xi(h,p):r(l,p,n))){for(o=s;--o;){var g=a[o];if(!(g?Xi(g,p):r(e[o],p,n)))continue e}h&&h.push(p),l.push(f)}}return l};var Pl=function(e){return Oo(e)?e:[]},Ll=Ar((function(e){var t=zr(e,Pl);return t.length&&t[0]===e[0]?Dl(t):[]}));
/**
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the MUC utilities module.
*/
const{Strophe:zl,sizzle:Fl}=sl.env;var Bl={computeAffiliationsDelta(e,t,n,r){const i=n.map(e=>e.jid),s=r.map(e=>e.jid);let o=No(i,s).map(e=>n[Uo(i,e)]);return e||(o=o.concat(n.filter(e=>{const t=Uo(s,e.jid);return t>=0&&e.affiliation!==r[t].affiliation}))),t&&(o=o.concat(No(s,i).map(e=>({jid:e,affiliation:"none"})))),o},parseMemberListIQ:e=>Fl(`query[xmlns="${zl.NS.MUC_ADMIN}"] item`,e).map(e=>{const t={affiliation:e.getAttribute("affiliation")},n=e.getAttribute("jid");Js.isValidJID(n)?t.jid=n:t.nick=n;const r=e.getAttribute("nick");r&&(t.nick=r);return e.getAttribute("role")&&(t.role=r),t})};
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the form utilities module.
*/Js.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?Js.getSelectValues(e):e.value,Js.toStanza(`\n <field var="${t}">\n ${n.constructor===Array?n.map(e=>`<value>${e}</value>`):`<value>${n}</value>`}\n </field>`)};var ql=Js;
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Pure functions to help funcitonally parse messages.
* @todo Other parsing helpers can be made more abstract and placed here.
*/const Ul={mention_regex:/(?:\s|^)([@][\w_-]+(?:\.\w+)*)/gi,matchRegexInText:e=>t=>e.matchAll(t)},Hl=(e,t)=>e.replace(RegExp("\\"+t,"ig"),"\\"+t);Ul.escapeCharacters=e=>t=>e.split("").reduce(Hl,t),Ul.escapeRegexString=Ul.escapeCharacters("[\\^$.?*+(){}"),Ul.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 Vl=([e,t],n,r)=>{let i=e,{begin:s,end:o}=n;const{value:a}=n;return s-=r,o=o-r-1,i=`${i.slice(0,s)}${a}${i.slice(o+1)}`,[i,[...t,{...n,begin:s,end:o}]]};Ul.reduceTextFromReferences=(e,t)=>t.reduce(Vl,[e,[]]);var Wl=Ul;
/**
* @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 Gl=["moderator","participant","visitor"],Jl=["owner","admin","member","outcast","none"];sl.MUC_TRAFFIC_STATES=["entered","exited"],sl.MUC_ROLE_CHANGES=["op","deop","voice","mute"];const Ql=["301","303","333","307","321","322"],Yl={moderator:1,participant:2,visitor:3,none:2},{Strophe:Kl,$iq:Xl,$build:Zl,$msg:eu,$pres:tu,sizzle:nu}=sl.env;Kl.addNamespace("MUC_ADMIN",Kl.NS.MUC+"#admin"),Kl.addNamespace("MUC_OWNER",Kl.NS.MUC+"#owner"),Kl.addNamespace("MUC_REGISTER","jabber:iq:register"),Kl.addNamespace("MUC_ROOMCONF",Kl.NS.MUC+"#roomconfig"),Kl.addNamespace("MUC_USER",Kl.NS.MUC+"#user"),Kl.addNamespace("MUC_HATS","xmpp:prosody.im/protocol/hats:1"),sl.MUC_NICK_CHANGED_CODE="303",sl.ROOM_FEATURES=["passwordprotected","unsecured","hidden","publicroom","membersonly","open","persistent","temporary","nonanonymous","semianonymous","moderated","unmoderated","mam_enabled"],sl.ROOMSTATUS={CONNECTED:0,CONNECTING:1,NICKNAME_REQUIRED:2,PASSWORD_REQUIRED:3,DISCONNECTED:4,ENTERED:5,DESTROYED:6},sl.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}=Vc;if(Qc.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_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_join_leave:!0,muc_show_logs_before_join:!1}),Qc.promises.add(["roomsAutoJoined"]),Qc.settings.get("locked_muc_domain")&&"string"!=typeof Qc.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");Vc.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")}},Vc.router.route("converse/room?jid=:jid",(async function(e){if(!ql.isValidMUCJID(e))return Dn.warn(`invalid jid "${e}" provided in url fragment`);await Qc.waitUntil("roomsAutoJoined"),Qc.settings.get("allow_bookmarks")&&await Qc.waitUntil("bookmarksInitialized"),Qc.rooms.open(e)})),Vc.getDefaultMUCNickname=function(){if(!Vc.xmppstatus)throw new Error("Can't call _converse.getDefaultMUCNickname before the statusInitialized has been fired.");const e=Vc.xmppstatus.getNickname();return e||(Qc.settings.get("muc_nickname_from_jid")?Kl.unescapeNode(Kl.getNodeFromJid(Vc.bare_jid)):void 0)},Vc.ChatRoomMessage=Vc.Message.extend({initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage()||this.setOccupant(),Qc.trigger("chatRoomMessageInitialized",this))},mayBeModerated(){return["all","moderator"].includes(Qc.settings.get("allow_message_retraction"))&&this.collection.chatbox.canModerateMessages()},checkValidity(){const e=Vc.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 Dn.error("Could not get collection.chatbox for message: "+JSON.stringify(this.toJSON()));this.listenTo(t.occupants,"add",this.onOccupantAdded)},onOccupantAdded(e){if(e.get("nick")===Kl.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 Dn.error("Could not get collection.chatbox for message: "+JSON.stringify(this.toJSON()));this.stopListening(n.occupants,"add",this.onOccupantAdded)}},setOccupant(){var e;if("groupchat"!==this.get("type"))return;const t=null==this||null===(e=this.collection)||void 0===e?void 0:e.chatbox;if(!t)return Dn.error("Could not get collection.chatbox for message: "+JSON.stringify(this.toJSON()));const n=Kl.getResourceFromJid(this.get("from"));if(this.occupant=t.occupants.findWhere({nick:n}),!this.occupant&&Qc.settings.get("muc_send_probes")){this.occupant=t.occupants.create({nick:n,type:"unavailable"});const e=`${t.get("jid")}/${n}`;Qc.user.presence.send("probe",e)}this.occupant?this.listenTo(this.occupant,"destroy",this.onOccupantRemoved):this.listenTo(t.occupants,"add",this.onOccupantAdded)}});const n=Bs.extend({defaults:()=>({connection_status:sl.ROOMSTATUS.DISCONNECTED})});if(Vc.ChatRoomMessages=ia.extend({model:Vc.ChatRoomMessage,comparator:"time"}),Vc.ChatRoom=Vc.ChatBox.extend({messagesCollection:Vc.ChatRoomMessages,defaults(){return{num_unread_general:0,bookmarked:!1,chat_state:void 0,hidden:Vc.isUniView()&&!Qc.settings.get("singleton"),hidden_occupants:!!Qc.settings.get("hide_muc_participants"),message_type:"groupchat",name:"",num_unread:0,roomconfig:{},time_opened:this.get("time_opened")||(new Date).getTime(),time_sent:new Date(0).toISOString(),type:Vc.CHATROOMS_TYPE}},async initialize(){this.initialized=ql.getResolveablePromise(),this.debouncedRejoin=Ma(this.rejoin,250),this.set("box_id","box-"+this.get("jid")),this.initNotifications(),this.initMessages(),this.initOccupants(),this.initDiscoModels(),this.registerHandlers(),this.on("change:chat_state",this.sendChatState,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 Qc.trigger("chatRoomInitialized",this,{Synchronous:!0}),this.initialized.resolve()},async restoreFromCache(){return this.session.get("connection_status")===sl.ROOMSTATUS.ENTERED&&await this.isJoined()?(await new Promise(e=>this.features.fetch({success:e,error:e})),await this.fetchOccupants().catch(e=>Dn.error(e)),await this.fetchMessages().catch(e=>Dn.error(e)),!0):(await this.clearCache(),!1)},async join(e,t){if(this.session.get("connection_status")===sl.ROOMSTATUS.ENTERED)return this;if(await this.refreshDiscoInfo(),!(e=await this.getAndPersistNickname(e)))return ql.safeSave(this.session,{connection_status:sl.ROOMSTATUS.NICKNAME_REQUIRED}),Qc.settings.get("muc_show_logs_before_join")&&await this.fetchMessages(),this;const n=tu({from:Vc.connection.jid,to:this.getRoomJIDAndNick()}).c("x",{xmlns:Kl.NS.MUC}).c("history",{maxstanzas:this.features.get("mam_enabled")?0:Qc.settings.get("muc_history_max_stanzas")}).up();return(t=t||this.get("password"))&&n.cnode(Kl.xmlElement("password",[],t)),this.session.save("connection_status",sl.ROOMSTATUS.CONNECTING),Qc.send(n),this},async clearCache(){this.session.save("connection_status",sl.ROOMSTATUS.DISCONNECTED),this.occupants.length?this.occupants.filter(e=>!e.isMember()).forEach(e=>e.destroy()):this.occupants.clearStore(),Qc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()},onOccupantAdded(e){Qc.settings.get("muc_show_join_leave")&&this.session.get("connection_status")===sl.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),"entered")},onOccupantRemoved(e){Qc.settings.get("muc_show_join_leave")&&this.session.get("connection_status")===sl.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),"exited")},onOccupantShowChanged(e){!e.get("states").includes("303")&&Qc.settings.get("muc_show_join_leave")&&("offline"===e.get("show")?this.updateNotifications(e.get("nick"),"exited"):"online"===e.get("show")&&this.updateNotifications(e.get("nick"),"entered"))},rejoin(){return this.clearCache(),this.join()},async onConnectionStatusChanged(){this.session.get("connection_status")===sl.ROOMSTATUS.ENTERED&&(await this.occupants.fetchMembers(),await this.fetchMessages(),Qc.trigger("enteredNewRoom",this),Qc.settings.get("auto_register_muc_nickname")&&await Qc.disco.supports(Kl.NS.MUC_REGISTER,this.get("jid"))&&this.registerNickname())},async onReconnection(){this.registerHandlers(),await this.rejoin(),this.announceReconnection()},restoreSession(){const e=`muc.session-${Vc.bare_jid}-${this.get("jid")}`;return this.session=new n({id:e}),this.session.browserStorage=Vc.createStore(e,"session"),new Promise(e=>this.session.fetch({success:e,error:e}))},initDiscoModels(){let e=`converse.muc-features-${Vc.bare_jid}-${this.get("jid")}`;this.features=new Bs(Object.assign({id:e},Rl(sl.ROOM_FEATURES,sl.ROOM_FEATURES.map(()=>!1)))),this.features.browserStorage=Vc.createStore(e,"session"),e="converse.muc-config-{_converse.bare_jid}-"+this.get("jid"),this.config=new Bs,this.config.browserStorage=Vc.createStore(e,"session")},initOccupants(){this.occupants=new Vc.ChatRoomOccupants;const e=`converse.occupants-${Vc.bare_jid}${this.get("jid")}`;this.occupants.browserStorage=Vc.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=nu(`x[xmlns="${Kl.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:Kl.getNodeFromJid(s),states:[],show:"unavailable"==r?"offline":"online",role:t.getAttribute("role"),jid:Kl.getBareJidFromJid(s),resource:Kl.getResourceFromJid(s)},a=this.occupants.findOccupant({jid:o.jid});a?a.save(o):this.occupants.create(o)}},async handleErrorMessageStanza(t){const n=await go.parseMUCMessage(t,this,Vc);if(!await this.shouldShowErrorMessage(n))return;const r=this.getMessageReferencedByError(n);if(r){const t={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")?(t.retraction_id=void 0,n.error||("forbidden"===n.error_condition?t.error=e("You're not allowed to retract your message."):"not-acceptable"===n.error_condition?t.error=e("Your retraction was not delivered because you're not present in the groupchat."):t.error=e("Sorry, an error occurred while trying to retract your message."))):n.error||("forbidden"===n.error_condition?t.error=e("Your message was not delivered because you weren't allowed to send it."):"not-acceptable"===n.error_condition?t.error=e("Your message was not delivered because you're not present in the groupchat."):t.error=e("Sorry, an error occurred while trying to send your message.")),r.save(t)}else this.createMessage(n)},async handleMessageStanza(e){if(go.isArchived(e))return Dn.warn('Received a MAM message with type "groupchat"');this.createInfoMessages(e),this.fetchFeaturesIfConfigurationChanged(e);const t=await go.parseMUCMessage(e,this,Vc),n={stanza:e,attrs:t,chatbox:this};return Qc.trigger("message",n),t&&this.queueMessage(t)},registerHandlers(){const e=this.get("jid");this.removeHandlers(),this.presence_handler=Vc.connection.addHandler(e=>this.onPresence(e)||!0,null,"presence",null,null,e,{ignoreNamespaceFragment:!0,matchBareFromJid:!0}),this.message_handler=Vc.connection.addHandler(e=>!!this.handleMessageStanza(e)||!0,null,"message","groupchat",null,e,{matchBareFromJid:!0}),this.affiliation_message_handler=Vc.connection.addHandler(e=>this.handleAffiliationChangedMessage(e)||!0,Kl.NS.MUC_USER,"message",null,null,e)},removeHandlers(){return this.message_handler&&(Vc.connection&&Vc.connection.deleteHandler(this.message_handler),delete this.message_handler),this.presence_handler&&(Vc.connection&&Vc.connection.deleteHandler(this.presence_handler),delete this.presence_handler),this.affiliation_message_handler&&(Vc.connection&&Vc.connection.deleteHandler(this.affiliation_message_handler),delete this.affiliation_message_handler),this},invitesAllowed(){return Qc.settings.get("allow_muc_invitations")&&(this.features.get("open")||"owner"===this.getOwnAffiliation())},getDisplayName(){const e=this.get("name");return e||("hidden"===Qc.settings.get("locked_muc_domain")?Kl.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=ql.getResolveablePromise(),r=Vc.connection.addTimedHandler(Vc.STANZA_TIMEOUT,()=>(Vc.connection.deleteHandler(i),n.reject(new Vc.TimeoutError("Timeout Error: No response from server")),!1)),i=Vc.connection.addHandler(e=>{r&&Vc.connection.deleteTimedHandler(r),"groupchat"===e.getAttribute("type")?n.resolve(e):n.reject(e)},null,"message",["error","groupchat"],t);return Qc.send(e),n},async retractOwnMessage(t){const n=t.get("origin_id");if(!n)throw new Error("Can't retract message without a XEP-0359 Origin ID");const r=t.get("editable"),i=eu({id:ql.getUniqueId(),to:this.get("jid"),type:"groupchat"}).c("store",{xmlns:Kl.NS.HINTS}).up().c("apply-to",{id:n,xmlns:Kl.NS.FASTEN}).c("retract",{xmlns:Kl.NS.RETRACT});t.set({retracted:(new Date).toISOString(),retracted_id:n,retraction_id:i.nodeTree.getAttribute("id"),editable:!1});try{await this.sendTimedMessage(i)}catch(n){throw t.save({editable:r,error_type:"timeout",error:e("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:Vc.bare_jid,moderated_id:e.get("msgid"),moderation_reason:t,editable:!1});const r=await this.sendRetractionIQ(e,t);return(null===r||ql.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=Xl({to:this.get("jid"),type:"set"}).c("apply-to",{id:e.get("stanza_id "+this.get("jid")),xmlns:Kl.NS.FASTEN}).c("moderate",{xmlns:Kl.NS.MODERATE}).c("retract",{xmlns:Kl.NS.RETRACT}).up().c("reason").t(t||"");return Qc.sendIQ(n,null,!1)},sendDestroyIQ(e,t){const n=Zl("destroy");t&&n.attrs({jid:t});const r=Xl({to:this.get("jid"),type:"set"}).c("query",{xmlns:Kl.NS.MUC_OWNER}).cnode(n.node);return e&&e.length>0&&r.c("reason",e),Qc.sendIQ(r)},async leave(e){if(this.features.destroy(),this.occupants.clearStore(),Vc.disco_entities){const e=Vc.disco_entities.get(this.get("jid"));e&&await new Promise((t,n)=>e.destroy({success:t,error:n}))}Qc.connection.connected()&&Qc.user.presence.send("unavailable",this.getRoomJIDAndNick(),e),ql.safeSave(this.session,{connection_status:sl.ROOMSTATUS.DISCONNECTED}),this.removeHandlers()},async close(){return await new Promise(e=>this.session.destroy({success:e,error:(t,n)=>{Dn.error(n),e()}})),await new Promise(e=>this.features.destroy({success:e,error:(t,n)=>{Dn.error(n),e()}})),Vc.ChatBox.prototype.close.call(this)},canModerateMessages(){const e=this.getOwnOccupant();return e&&e.isModerator()&&Qc.disco.supports(Kl.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=Wl.escapeRegexString(e);return RegExp(`(?:\\s|^)@(${t})(?![\\w@-])`,"ig")},getOccupantByJID(e){return this.occupants.findOccupant({jid:e})},getOccupantByNickname(e){return this.occupants.findOccupant({nick:e})},parseTextForReferences(e){if(!e)return["",[]];const t=Wl.matchRegexInText(e);if(!t(Wl.mention_regex))return[e,[]];const n=this.getAllKnownNicknames(),r=Wl.findFirstMatchInArray(n),i=e=>{const t=this.get("jid"),n=this.getOccupant(e)||this.getOccupant(t),r=n&&n.get("jid")||`${t}/${e}`;return encodeURI("xmpp:"+r)},s=[...t(this.getAllKnownNicknamesRegex())].map(e=>{const t=e[0].indexOf("@"),n=e.index+t,s=n+e[0].length-t,o=r(e[1]);return{begin:n,end:s,value:o,type:"mention",uri:i(o)}}),[o,a]=Wl.reduceTextFromReferences(e,s);return[o,a]},getOutgoingMessageAttributes(e,t){const n=this.get("composing_spoiler"),[r,i]=this.parseTextForReferences(e),s=ql.getUniqueId(),o=r?ql.httpToGeoUri(ql.shortnamesToUnicode(r),Vc):void 0;return{body:o,is_spoiler:n,origin_id:s,references:i,id:s,msgid:s,from:`${this.get("jid")}/${this.get("nick")}`,fullname:this.get("nick"),is_only_emojis:!!r&&ql.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 Kl.getBareJidFromJid(this.get("jid"))+(null!==e?"/"+e:"")},sendChatState(){if(!Qc.settings.get("send_chat_state_notifications")||!this.get("chat_state")||this.session.get("connection_status")!==sl.ROOMSTATUS.ENTERED||this.features.get("moderated")&&"visitor"===this.getOwnRole())return;const e=Qc.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;const t=this.get("chat_state");t!==Vc.GONE&&Qc.send(eu({to:this.get("jid"),type:"groupchat"}).c(t,{xmlns:Kl.NS.CHATSTATES}).up().c("no-store",{xmlns:Kl.NS.HINTS}).up().c("no-permanent-store",{xmlns:Kl.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=eu({from:Vc.connection.jid,to:e,id:ql.getUniqueId()}).c("x",n);Qc.send(r),Qc.trigger("roomInviteSent",{room:this,recipient:e,reason:t})},refreshDiscoInfo(){return Qc.disco.refresh(this.get("jid")).then(()=>this.getDiscoInfo()).catch(e=>Dn.error(e))},getDiscoInfo(){return Qc.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=>Dn.error(e))},async getDiscoInfoFields(){const e=(await Qc.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 Qc.disco.getFeatures(this.get("jid")),t=Object.assign(Rl(sl.ROOM_FEATURES,sl.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===Kl.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=>Zl("value").t(e)).join("")}return e},async autoConfigureChatRoom(){const e=await this.fetchRoomConfiguration(),t=nu("field",e).map(e=>this.addFieldValue(e));if(t.length)return this.sendConfiguration(t)},fetchRoomConfiguration(){return Qc.sendIQ(Xl({to:this.get("jid"),type:"get"}).c("query",{xmlns:Kl.NS.MUC_OWNER}))},sendConfiguration(e=[]){const t=Xl({to:this.get("jid"),type:"set"}).c("query",{xmlns:Kl.NS.MUC_OWNER}).c("x",{xmlns:Kl.NS.XFORM,type:"submit"});return e.forEach(e=>t.cnode(e).up()),Qc.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},getOwnOccupant(){return this.occupants.findWhere({jid:Vc.bare_jid})},sendAffiliationIQ(e,t){const n=Xl({to:this.get("jid"),type:"set"}).c("query",{xmlns:Kl.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),Qc.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=Zl("item",{nick:e.get("nick"),role:t}),o=Xl({to:this.get("jid"),type:"set"}).c("query",{xmlns:Kl.NS.MUC_ADMIN}).cnode(s.node);return null!==n&&o.c("reason",n),Qc.sendIQ(o).then(r).catch(i)},getOccupant(e){return ql.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=Xl({to:this.get("jid"),type:"get"}).c("query",{xmlns:Kl.NS.MUC_ADMIN}).c("item",{affiliation:e}),n=await Qc.sendIQ(t,null,!1);if(null===n){const t=`Error: timeout while fetching ${e} list for MUC ${this.get("jid")}`,r=new Error(t);return Dn.warn(t),Dn.warn(n),r}if(ql.isErrorStanza(n)){const t=`Error: not allowed to fetch ${e} list for MUC ${this.get("jid")}`,r=new Error(t);return Dn.warn(t),Dn.warn(n),r}return Bl.parseMemberListIQ(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)=>ql.isErrorObject(t)?e:[...t,...e],[]);await this.setAffiliations(Bl.computeAffiliationsDelta(!0,!1,e,t)),await this.occupants.fetchMembers()},async getAndPersistNickname(e){return(e=e||this.get("nick")||await this.getReservedNick()||Vc.getDefaultMUCNickname())&&this.save({nick:e},{silent:!0}),e},async getReservedNick(){const e=Xl({to:this.get("jid"),from:Vc.connection.jid,type:"get"}).c("query",{xmlns:Kl.NS.DISCO_INFO,node:"x-roomuser-item"}),t=await Qc.sendIQ(e,null,!1);if(ql.isErrorObject(t))throw t;const n=t.querySelector('query[node="x-roomuser-item"] identity');return n?n.getAttribute("name"):null},async registerNickname(){const t=this.get("nick"),n=this.get("jid");let r,i;try{r=await Qc.sendIQ(Xl({to:n,from:Vc.connection.jid,type:"get"}).c("query",{xmlns:Kl.NS.MUC_REGISTER}))}catch(t){return nu(`not-allowed[xmlns="${Kl.NS.STANZAS}"]`,t).length?i=e("You're not allowed to register yourself in this groupchat."):nu(`registration-required[xmlns="${Kl.NS.STANZAS}"]`,t).length&&(i=e("You're not allowed to register in this groupchat because it's members-only.")),Dn.error(t),i}const s=nu("field required",r).map(e=>e.parentElement);if(s.length>1&&"muc#register_roomnick"!==s[0].getAttribute("var"))return Dn.error(`Can't register the user register in the groupchat ${n} due to the required fields`);try{await Qc.sendIQ(Xl({to:n,from:Vc.connection.jid,type:"set"}).c("query",{xmlns:Kl.NS.MUC_REGISTER}).c("x",{xmlns:Kl.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 nu(`service-unavailable[xmlns="${Kl.NS.STANZAS}"]`,t).length?i=e("Can't register your nickname in this groupchat, it doesn't support registration."):nu(`bad-request[xmlns="${Kl.NS.STANZAS}"]`,t).length&&(i=e("Can't register your nickname in this groupchat, invalid data form supplied.")),Dn.error(i),Dn.error(t),i}},updateOccupantsOnPresence(e){var t,n;const r=go.parseMUCPresence(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(sl.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:Kl.getBareJidFromJid(s)||(null==i||null===(t=i.attributes)||void 0===t?void 0:t.jid),resource:Kl.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"];nu("status",e).filter(e=>t.includes(e.getAttribute("status"))).length&&this.refreshDiscoInfo()},isSameUser(e,t){const n=Kl.getBareJidFromJid(e),r=Kl.getBareJidFromJid(t),i=Kl.getResourceFromJid(e),s=Kl.getResourceFromJid(t);if(ql.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 Qc.user.settings.get("mucs_with_hidden_subject",[])).includes(this.get("jid"))},async toggleSubjectHiddenState(){const e=this.get("jid"),t=await Qc.user.settings.get("mucs_with_hidden_subject",[]);t.includes(this.get("jid"))?Qc.user.settings.set("mucs_with_hidden_subject",t.filter(t=>t!==e)):Qc.user.settings.set("mucs_with_hidden_subject",[...t,e])},async handleSubjectChange(t){if("string"==typeof t.subject&&!t.thread&&!t.message){const n=t.subject,r=t.nick;if(ql.safeSave(this,{subject:{author:r,text:t.subject||""}}),!t.is_delayed&&r){const i=e(n?"Topic set by %1$s":"Topic cleared by %1$s",r),s=this.messages.last();(null==s?void 0:s.get("nick"))===t.nick&&"info"===(null==s?void 0:s.get("type"))&&(null==s?void 0:s.get("message"))===i||this.createMessage({message:i,nick:t.nick,type:"info"}),await this.isSubjectHidden()&&this.toggleSubjectHiddenState()}return!0}return!1},setSubject(e=""){Qc.send(eu({to:this.get("jid"),from:Vc.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=Mn(e)?e.getAttribute("from"):e instanceof Vc.Message?e.get("from"):e.from,Kl.getResourceFromJid(t)==this.get("nick")},getUpdatedMessageAttributes(e,t){const n=Vc.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,Fs(t,r)),e.get("received")||(n.received=(new Date).toISOString())}return n},async isJoined(){const e=this.get("jid"),t=Xl({to:`${e}/${this.get("nick")}`,type:"get"}).c("ping",{xmlns:Kl.NS.PING});try{await Qc.sendIQ(t)}catch(t){return null===t?Dn.warn("isJoined: Timeout error while checking whether we're joined to MUC: "+e):Dn.warn("isJoined: Apparently we're no longer connected to MUC: "+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())&&Vc.ChatBox.prototype.shouldShowErrorMessage.call(this,e)},findDanglingModeration(e){if(!this.messages.length)return null;if(this.messages.last().get("time")>e.time){const t=Array.from(this.messages.models),n=e["stanza_id "+this.get("jid")];return n?(t.reverse(),t.find(({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 "+this.get("jid")]=e.moderated_id;const r=this.messages.findWhere(n);return r?(r.save(Fs(e,t)),!0):(e.dangling_moderation=!0,await this.createMessage(e),!0)}{const n=this.findDanglingModeration(e);if(n){const r=Fs(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=sl.CHAT_STATES.reduce(i,{}),o=sl.MUC_TRAFFIC_STATES.reduce(i,{}),a=sl.MUC_ROLE_CHANGES.reduce(i,{});this.notifications.set(Object.assign(s,o,a)),window.setTimeout(()=>this.removeNotification(e,t),1e4)},async onMessage(e){if(e=await e,ql.isErrorObject(e))return e.stanza&&Dn.error(e.stanza),Dn.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),ql.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")===sl.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=nu(`x[xmlns="${Kl.NS.MUC_USER}"]`,e).pop();if(!r)return;const i=nu("status",r).map(e=>e.getAttribute("code")),s=Ll(i,Object.keys(Vc.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?$a(o.querySelector("actor"),"getAttribute","nick"):void 0,l=Vc.muc.disconnect_messages[s[0]];this.setDisconnectionMessage(l,a,c)},getActionInfoMessage:(t,n,r)=>"301"===t?r?e("%1$s has been banned by %2$s",n,r):e("%1$s has been banned",n):"303"===t?e("%1$s's nickname has changed",n):"307"===t?r?e("%1$s has been kicked out by %2$s",n,r):e("%1$s has been kicked out",n):"321"===t?e("%1$s has been removed because of an affiliation change",n):"322"===t?e("%1$s has been removed for not being a member",n):void 0,createAffiliationChangeMessage(t){const n=t._previousAttributes.affiliation;if(!n)return;const r=t.get("affiliation");"admin"===n?this.createMessage({type:"info",message:e("%1$s is no longer an admin of this groupchat",t.get("nick"))}):"owner"===n?this.createMessage({type:"info",message:e("%1$s is no longer an owner of this groupchat",t.get("nick"))}):"outcast"===n&&this.createMessage({type:"info",message:e("%1$s is no longer banned from this groupchat",t.get("nick"))}),"none"===r&&"member"===n&&this.createMessage({type:"info",message:e("%1$s is no longer a member of this groupchat",t.get("nick"))}),"member"===r?this.createMessage({type:"info",message:e("%1$s is now a member of this groupchat",t.get("nick"))}):"admin"!==r&&"owner"!=r||this.createMessage({type:"info",message:e("%1$s is now an %2$s of this groupchat",t.get("nick"),r)})},createRoleChangeMessage(e,t){if("none"===t||e.changed.affiliation)return;const n=e._previousAttributes.role;"moderator"===n?this.updateNotifications(e.get("nick"),"deop"):"visitor"===n&&this.updateNotifications(e.get("nick"),"voice"),"visitor"===e.get("role")?this.updateNotifications(e.get("nick"),"mute"):"moderator"===e.get("role")&&(["owner","admin"].includes(e.get("affiliation"))||this.updateNotifications(e.get("nick"),"op"))},createInfoMessage(t,n,r){const i={type:"info"};if("110"!==t&&("100"!==t||r)){if(t in Vc.muc.info_messages)i.message=Vc.muc.info_messages[t];else if(!r&&Ql.includes(t)){var s,o;const e=Kl.getResourceFromJid(n.getAttribute("from")),r=n.querySelector(`x[xmlns="${Kl.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(t,e,i.actor)}else if(r&&t in Vc.muc.new_nickname_messages){let s;r&&"210"===t?s=Kl.getResourceFromJid(n.getAttribute("from")):r&&"303"===t&&(s=n.querySelector(`x[xmlns="${Kl.NS.MUC_USER}"] item`).getAttribute("nick")),this.save("nick",s),i.message=e(Vc.muc.new_nickname_messages[t],s)}if(i.message){if("201"===t&&this.messages.findWhere(i))return;if(t in Vc.muc.info_messages&&this.messages.length&&this.messages.pop().get("message")===i.message)return;this.createMessage(i)}}},createInfoMessages(e){const t=nu(`x[xmlns="${Kl.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:sl.ROOMSTATUS.DISCONNECTED})},onNicknameClash(t){if(Qc.settings.get("muc_nickname_from_jid")){const e=t.getAttribute("from").split("/")[1];if(e===Vc.getDefaultMUCNickname())this.join(e+"-2");else{const t=e.lastIndexOf("-"),n=e.substring(t+1,e.length);this.join(e.substring(0,t+1)+String(Number(n)+1))}}else this.save({nickname_validation_message:e("The nickname you chose is reserved or currently in use, please choose a different one.")}),this.session.save({connection_status:sl.ROOMSTATUS.NICKNAME_REQUIRED})},onErrorPresence(t){var n;const r=t.querySelector("error"),i=r.getAttribute("type"),s=null===(n=nu(`text[xmlns="${Kl.NS.STANZAS}"]`,r).pop())||void 0===n?void 0:n.textContent;if("modify"===i)this.handleModifyError(t);else if("auth"===i){if(nu(`not-authorized[xmlns="${Kl.NS.STANZAS}"]`,r).length&&(this.save({password_validation_message:s||e("Password incorrect")}),this.session.save({connection_status:sl.ROOMSTATUS.PASSWORD_REQUIRED})),r.querySelector("registration-required")){const t=e("You are not on the member list of this groupchat.");this.setDisconnectionMessage(t,s)}else if(r.querySelector("forbidden")){const t=e("You have been banned from this groupchat.");this.setDisconnectionMessage(t,s)}}else if("cancel"===i)if(r.querySelector("not-allowed")){const t=e("You are not allowed to create new groupchats.");this.setDisconnectionMessage(t,s)}else if(r.querySelector("not-acceptable")){const t=e("Your nickname doesn't conform to this groupchat's policies.");this.setDisconnectionMessage(t,s)}else if(nu(`gone[xmlns="${Kl.NS.STANZAS}"]`,r).length){var o;const e=null===(o=nu(`gone[xmlns="${Kl.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:sl.ROOMSTATUS.DESTROYED})}else if(r.querySelector("conflict"))this.onNicknameClash(t);else if(r.querySelector("item-not-found")){const t=e("This groupchat does not (yet) exist.");this.setDisconnectionMessage(t,s)}else if(r.querySelector("service-unavailable")){const t=e("This groupchat has reached its maximum number of participants.");this.setDisconnectionMessage(t,s)}else if(r.querySelector("remote-server-not-found")){const t=e("Remote server not found"),n=s?e('The explanation given is: "%1$s".',s):void 0;this.setDisconnectionMessage(t,n)}},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")===sl.ROOMSTATUS.CONNECTING&&this.session.save("connection_status",sl.ROOMSTATUS.CONNECTED)):this.updateOccupantsOnPresence(e)},onOwnPresence(e){if("unavailable"!==e.getAttribute("type")){const t=this.session.get("connection_status");t!==sl.ROOMSTATUS.ENTERED?(this.session.save("connection_status",sl.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"))this.handleDisconnection(e);else{if(e.querySelector("status[code='201']"))if(this.get("auto_configure"))this.autoConfigureChatRoom().then(()=>this.refreshDiscoInfo());else{if(!Qc.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:sl.ROOMSTATUS.ENTERED})},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${t}\\b`).test(e.get("message"))},handleUnreadMessage(e){if(null!=e&&e.get("body")&&ql.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.sendMarkerForMessage(this.messages.last()),ql.safeSave(this,{num_unread:0,num_unread_general:0})}}),Vc.ChatRoomOccupant=Bs.extend({defaults:{hats:[],show:"offline",states:[]},initialize(e){this.set(Object.assign({id:ql.getUniqueId()},e)),this.on("change:image_hash",this.onAvatarChanged,this)},onAvatarChanged(){const e=this.get("image_hash"),t=[];this.get("jid")&&t.push(Vc.vcards.findWhere({jid:this.get("jid")})),t.push(Vc.vcards.findWhere({jid:this.get("from")})),t.filter(e=>e).forEach(t=>{e&&t.get("image_hash")!==e&&Qc.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")}}),Vc.ChatRoomOccupants=ia.extend({model:Vc.ChatRoomOccupant,comparator(e,t){const n=e.get("role")||"none",r=t.get("role")||"none";if(Yl[n]===Yl[r]){const n=e.getDisplayName().toLowerCase(),r=t.getDisplayName().toLowerCase();return n<r?-1:n>r?1:0}return Yl[n]<Yl[r]?-1:1},getAutoFetchedAffiliationLists(){const e=Qc.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)=>ql.isErrorObject(t)?e:[...t,...e],[]),r=e.filter(n=>!ql.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")!==Vc.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)}),Qc.trigger("membersFetched")},findOccupant(e){const t=Kl.getBareJidFromJid(e.jid);return t&&this.findWhere({jid:t})||this.findWhere({nick:e.nick})}}),Vc.RoomsPanelModel=Bs.extend({defaults:function(){return{muc_domain:Qc.settings.get("muc_domain"),nick:Vc.getDefaultMUCNickname()}},setDomain(e){Qc.settings.get("locked_muc_domain")||this.save("muc_domain",Kl.getDomainFromJid(e))}}),Vc.onDirectMUCInvitation=async function(t){const n=nu('x[xmlns="jabber:x:conference"]',t).pop(),r=Kl.getBareJidFromJid(t.getAttribute("from")),i=n.getAttribute("jid"),s=n.getAttribute("reason");let o;if(Qc.settings.get("auto_join_on_invite"))o=!0;else{let t=Vc.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=Vc.CHATROOMS_TYPE,t.id=e;const n=await Qc.rooms.get(e,t,!0);return n.maybeShow(!0),n}(i,{password:n.getAttribute("password")})).session.get("connection_status")===sl.ROOMSTATUS.DISCONNECTED&&Vc.chatboxes.get(i).rejoin()}},Qc.settings.get("allow_muc_invitations")){const e=function(){Vc.connection.addHandler(e=>(Vc.onDirectMUCInvitation(e),!0),"jabber:x:conference","message")};Qc.listen.on("connected",e),Qc.listen.on("reconnected",e)}function r(){return Vc.chatboxes.filter(e=>e.get("type")===Vc.CHATROOMS_TYPE).forEach(e=>e.session.save({connection_status:sl.ROOMSTATUS.DISCONNECTED}))}Qc.listen.on("beforeTearDown",()=>{Vc.chatboxes.where({type:Vc.CHATROOMS_TYPE}).forEach(e=>ql.safeSave(e.session,{connection_status:sl.ROOMSTATUS.DISCONNECTED}))}),Qc.listen.on("windowStateChanged",(async function(e){if("visible"===e.state&&Qc.connection.connected()){(await Qc.rooms.get()).forEach(e=>e.rejoinIfNecessary())}})),Qc.listen.on("addClientFeatures",()=>{Qc.settings.get("allow_muc")&&Qc.disco.own.features.add(Kl.NS.MUC),Qc.settings.get("allow_muc_invitations")&&Qc.disco.own.features.add("jabber:x:conference")}),Qc.listen.on("chatBoxesFetched",(async function(){await Promise.all(Qc.settings.get("auto_join_rooms").map(e=>"string"==typeof e?Vc.chatboxes.where({jid:e}).length?Promise.resolve():Qc.rooms.open(e):N(e)?Qc.rooms.open(e.jid,{...e}):(Dn.error('Invalid muc criteria specified for "auto_join_rooms"'),Promise.resolve()))),Qc.trigger("roomsAutoJoined")})),Qc.listen.on("beforeResourceBinding",()=>{Vc.connection.addHandler(e=>{const t=Kl.getBareJidFromJid(e.getAttribute("from"));return Vc.chatboxes.get(t)||Qc.waitUntil("chatBoxesFetched").then(async()=>{const n=Vc.chatboxes.get(t);n&&(await n.initialized,n.message_handler.run(e))}),!0},null,"message","groupchat")}),Qc.listen.on("disconnected",r),Qc.listen.on("statusInitialized",()=>{window.addEventListener(Vc.unloadevent,()=>{!Qc.connection.isType("websocket")||Qc.settings.get("enable_smacks")&&Vc.session.get("smacks_stream_id")||r()})}),sl.env.muc_utils=Bl,Object.assign(Qc,{rooms:{create(e,t={}){if(!(t="string"==typeof t?{nick:t}:t||{}).nick&&Qc.settings.get("muc_nickname_from_jid")&&(t.nick=Kl.getNodeFromJid(Vc.bare_jid)),void 0===e)throw new TypeError("rooms.create: You need to provide at least one JID");return"string"==typeof e?Qc.rooms.get(ql.getJIDFromURI(e),t,!0):e.map(e=>Qc.rooms.get(ql.getJIDFromURI(e),t,!0))},async open(e,t={},n=!1){if(await Qc.waitUntil("chatBoxesFetched"),void 0===e){const e="rooms.open: You need to provide at least one JID";throw Dn.error(e),new TypeError(e)}if("string"==typeof e){const r=await Qc.rooms.get(e,t,!0);return r&&r.maybeShow(n),r}{const r=await Promise.all(e.map(e=>Qc.rooms.get(e,t,!0)));return r.forEach(e=>e.maybeShow(n)),r}},async get(e,t={},n=!1){async function r(e){e=ql.getJIDFromURI(e);let r=await Qc.chatboxes.get(e);return!r&&n?r=await Qc.chatboxes.create(e,t,Vc.ChatRoom):(r=r&&r.get("type")===Vc.CHATROOMS_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Qc.chatboxes.get()).filter(e=>e.get("type")===Vc.CHATROOMS_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}})}});
/**
* @module converse-bookmarks
* @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:ru,$iq:iu,sizzle:su}=sl.env,ou=sl.env.utils;function au(e){return su(`event[xmlns="${ru.NS.PUBSUB}#event"] items[node="${ru.NS.BOOKMARKS}"]`,e).length&&Qc.waitUntil("bookmarksInitialized").then(()=>Vc.bookmarks.createBookmarksFromStanza(e)).catch(e=>Dn.fatal(e)),!0}ru.addNamespace("BOOKMARKS","storage:bookmarks"),sl.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){const{_converse:t}=this.__super__;return e=e||t.getNicknameFromBookmark(this.get("jid")),this.__super__.getAndPersistNickname.call(this,e)}}},initialize(){const{__:e}=Vc;Qc.settings.extend({allow_bookmarks:!0,allow_public_bookmarks:!1,muc_respect_autojoin:!0}),Qc.promises.add("bookmarksInitialized"),Vc.getNicknameFromBookmark=function(e){if(!Vc.bookmarks||!Qc.settings.get("allow_bookmarks"))return null;const t=Vc.bookmarks.findWhere({jid:e});return t?t.get("nick"):void 0},Vc.Bookmark=Bs.extend({idAttribute:"jid",getDisplayName(){return ru.xmlunescape(this.get("name"))}}),Vc.Bookmarks=ia.extend({model:Vc.Bookmark,comparator:e=>e.get("name").toLowerCase(),initialize(){this.on("add",e=>this.openBookmarkedRoom(e).then(e=>this.markRoomAsBookmarked(e)).catch(e=>Dn.fatal(e))),this.on("remove",this.markRoomAsUnbookmarked,this),this.on("remove",this.sendBookmarkStanza,this);const e="converse.room-bookmarks"+Vc.bare_jid;this.fetched_flag=e+"fetched",this.browserStorage=Vc.createStore(e)},async openBookmarkedRoom(e){if(Qc.settings.get("muc_respect_autojoin")&&e.get("autojoin")){(await Qc.rooms.create(e.get("jid"),{nick:e.get("nick")})).maybeShow()}return e},fetchBookmarks(){const e=ou.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=iu({type:"set",from:Vc.connection.jid}).c("pubsub",{xmlns:ru.NS.PUBSUB}).c("publish",{node:ru.NS.BOOKMARKS}).c("item",{id:"current"}).c("storage",{xmlns:ru.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:ru.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"),Qc.sendIQ(e)},onBookmarkError(t,n){Dn.error("Error while trying to add bookmark"),Dn.error(t),Qc.alert("error",e("Error"),[e("Sorry, something went wrong while trying to save your bookmark.")]),this.findWhere({jid:n.jid}).destroy()},fetchBookmarksFromServer(e){const t=iu({from:Vc.connection.jid,type:"get"}).c("pubsub",{xmlns:ru.NS.PUBSUB}).c("items",{node:ru.NS.BOOKMARKS});Qc.sendIQ(t).then(t=>this.onBookmarksReceived(e,t)).catch(t=>this.onBookmarksReceivedError(e,t))},markRoomAsBookmarked(e){const t=Vc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!0)},markRoomAsUnbookmarked(e){const t=Vc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!1)},createBookmarksFromStanza(e){const t=ru.NS.BOOKMARKS;su(`items[node="${t}"] item storage[xmlns="${t}"] conference`,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(t,n){if(null===n)Dn.error("Error: timeout while fetching bookmarks"),Qc.alert("error",e("Timeout Error"),[e("The server did not return your bookmarks within the allowed time. You can reload the page to request them again.")]);else{if(t)return n.querySelector('error[type="cancel"] item-not-found')?(window.sessionStorage.setItem(this.fetched_flag,!0),t.resolve()):(Dn.error("Error while fetching bookmarks"),Dn.error(n),t.reject(new Error("Could not fetch bookmarks")));Dn.error("Error while fetching bookmarks"),Dn.error(n)}},getUnopenedBookmarks(){return this.filter(e=>!Vc.chatboxes.get(e.get("jid")))}}),Vc.BookmarksList=Bs.extend({defaults:{"toggle-state":Vc.OPENED}}),Vc.checkBookmarksSupport=async function(){const e=await Qc.disco.getIdentity("pubsub","pep",Vc.bare_jid);return Vc.allow_public_bookmarks?!!e:Qc.disco.supports(ru.NS.PUBSUB+"#publish-options",Vc.bare_jid)};const t=async function(){Qc.settings.get("allow_bookmarks")&&await Vc.checkBookmarksSupport()&&(Vc.bookmarks=new Vc.Bookmarks,await Vc.bookmarks.fetchBookmarks(),Qc.trigger("bookmarksInitialized"))};Qc.listen.on("addClientFeatures",()=>{Qc.settings.get("allow_bookmarks")&&Qc.disco.own.features.add(ru.NS.BOOKMARKS+"+notify")}),Qc.listen.on("clearSession",()=>{void 0!==Vc.bookmarks&&(Vc.bookmarks.clearStore({silent:!0}),window.sessionStorage.removeItem(Vc.bookmarks.fetched_flag),delete Vc.bookmarks)}),Qc.listen.on("reconnected",t),Qc.listen.on("connected",async()=>{const{connection:e}=Vc;e.addHandler(au,null,"message","headline",null,Vc.bare_jid),await Promise.all([Qc.waitUntil("chatBoxesFetched")]),t()})}});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:cu}=sl.env;sl.plugins.add("converse-bosh",{enabled:()=>!Vc.api.settings.get("blacklisted_plugins").includes("converse-bosh"),initialize(){Qc.settings.extend({bosh_service_url:void 0,prebind_url:null}),Vc.startNewPreboundBOSHSession=function(){if(!Qc.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",Qc.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 Vc.setUserJID(t.jid);Vc.connection.attach(n,t.sid,t.rid,Vc.connection.onConnectStatusChanged)}else e.onerror()},e.onerror=function(){delete Vc.connection,Qc.trigger("noResumeableBOSHSession",Vc)},e.send()},Vc.restoreBOSHSession=async function(){const e=(await async function(){const e="converse.bosh-session";if(Vc.bosh_session||(Vc.bosh_session=new Bs({id:e}),Vc.bosh_session.browserStorage=Vc.createStore(e,"session"),await new Promise(e=>Vc.bosh_session.fetch({success:e,error:e}))),Vc.jid){if(Vc.bosh_session.get("jid")!==Vc.jid){const e=await Vc.setUserJID(Vc.jid);Vc.bosh_session.clear({silent:!0}),Vc.bosh_session.save({jid:e})}}else{const e=Vc.bosh_session.get("jid");e&&await Vc.setUserJID(e)}return Vc.bosh_session}()).get("jid");if(e&&Vc.connection._proto instanceof cu.Bosh)try{return Vc.connection.restore(e,Vc.connection.onConnectStatusChanged),!0}catch(t){return!Vc.isTestEnv()&&Dn.warn("Could not restore session for jid: "+e+" Error message: "+t.message),!1}return!1},Qc.listen.on("clearSession",()=>{if(void 0===Vc.bosh_session){const e="converse.bosh-session";sessionStorage.removeItem(e),sessionStorage.removeItem(`${e}-${e}`)}else Vc.bosh_session.destroy(),delete Vc.bosh_session}),Qc.listen.on("setUserJID",()=>{void 0!==Vc.bosh_session&&Vc.bosh_session.save({jid:Vc.jid})}),Qc.listen.on("addClientFeatures",()=>Qc.disco.own.features.add(cu.NS.BOSH)),Object.assign(Qc,{tokens:{get:e=>void 0===Vc.connection?null:"rid"===e.toLowerCase()?Vc.connection.rid||Vc.connection._proto.rid:"sid"===e.toLowerCase()?Vc.connection.sid||Vc.connection._proto.sid:void 0}})}});var lu=n(6);
/**
* @module converse-caps
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:uu,$build:du}=sl.env;function hu(e,t){return e.sort((e,n)=>e[t]>n[t]?-1:1)}function fu(e){const t=e.api.disco.own.identities.get(),n=e.api.disco.own.features.get();t.length>1&&(hu(t,"category"),hu(t,"type"),hu(t,"lang"));let r=t.reduce((e,t)=>{var n;return`${e}${t.category}/${t.type}/${null!==(n=null==t?void 0:t.lang)&&void 0!==n?n:""}/${t.name}<`},"");return n.sort(),r=n.reduce((e,t)=>`${e}${t}<`,r),lu.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 pu(e){var t,n;e&&(null===(n=Vc.session)||void 0===n||n.set({carbons_enabled:!1}));if(!Qc.settings.get("message_carbons")||null!==(t=Vc.session)&&void 0!==t&&t.get("carbons_enabled"))return;const r=new Ta.e.Builder("iq",{from:Vc.connection.jid,id:"enablecarbons",type:"set"}).c("enable",{xmlns:Ta.e.NS.CARBONS});Vc.connection.addHandler(e=>{e.querySelectorAll("error").length>0?Dn.warn("An error occurred while trying to enable message carbons."):(Vc.session.set({carbons_enabled:!0}),Dn.debug("Message carbons have been enabled.")),Vc.session.save()},null,"iq",null,"enablecarbons"),Vc.connection.send(r)}uu.addNamespace("CAPS","http://jabber.org/protocol/caps"),sl.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,du("c",{xmlns:uu.NS.CAPS,hash:"sha-1",node:"https://conversejs.org",ver:fu(t)}).nodeTree)),e}}}}),sl.plugins.add("converse-carbons",{initialize(){Qc.settings.extend({message_carbons:!0}),Qc.listen.on("afterResourceBinding",pu)}});
/**
* @module converse-chatboxes
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:gu}=sl.env;gu.addNamespace("MESSAGE_CORRECT","urn:xmpp:message-correct:0"),gu.addNamespace("RECEIPTS","urn:xmpp:receipts"),gu.addNamespace("REFERENCE","urn:xmpp:reference:0"),gu.addNamespace("MARKERS","urn:xmpp:chat-markers:0"),sl.plugins.add("converse-chatboxes",{dependencies:["converse-emoji","converse-roster","converse-vcard"],initialize(){async function e(e,t,n){let r;e=gu.getBareJidFromJid(e.toLowerCase()),Object.assign(t,{jid:e,id:e});try{r=new n(t,{collection:Vc.chatboxes})}catch(e){return Dn.error(e),null}return await r.initialized,r.isValid()?(Vc.chatboxes.add(r),r):(r.destroy(),null)}Qc.promises.add(["chatBoxesFetched","chatBoxesInitialized","privateChatsAutoJoined"]),Vc.ChatBoxes=ia.extend({comparator:"time_opened",model:(e,t)=>new Vc.ChatBox(e,t),onChatBoxesFetched(e){e.filter(e=>!e.isValid()).forEach(e=>e.destroy()),Qc.trigger("chatBoxesFetched")},onConnected(e){e||(this.browserStorage=Vc.createStore("converse.chatboxes-"+Vc.bare_jid),this.fetch({add:!0,success:e=>this.onChatBoxesFetched(e)}))}}),Qc.listen.on("addClientFeatures",()=>{Qc.disco.own.features.add(gu.NS.MESSAGE_CORRECT),Qc.disco.own.features.add(gu.NS.HTTPUPLOAD),Qc.disco.own.features.add(gu.NS.OUTOFBAND)}),Qc.listen.on("pluginsInitialized",()=>{Vc.chatboxes=new Vc.ChatBoxes,Qc.trigger("chatBoxesInitialized")}),Qc.listen.on("presencesInitialized",e=>Vc.chatboxes.onConnected(e)),Qc.listen.on("reconnected",()=>Vc.chatboxes.forEach(e=>e.onReconnection())),Object.assign(Qc,{chatboxes:{create:async(t=[],n={},r)=>(await Qc.waitUntil("chatBoxesFetched"),"string"==typeof t?e(t,n,r):Promise.all(t.map(t=>e(t,n,r)))),get:async e=>(await Qc.waitUntil("chatBoxesFetched"),void 0===e?Vc.chatboxes.models:"string"==typeof e?Vc.chatboxes.get(e.toLowerCase()):(e=e.map(e=>e.toLowerCase()),Vc.chatboxes.models.filter(t=>e.includes(t.get("jid")))))}})}}),sl.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(){Vc.connection.addHandler(e=>async function(e){if(go.isHeadline(e)||go.isServerMessage(e)){const t=e.getAttribute("from");if(t.includes("@")&&!Vc.roster.get(t)&&!Qc.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const n=Vc.chatboxes.create({id:t,jid:t,type:Vc.HEADLINES_TYPE,from:t}),r=await go.parseMessage(e,Vc);await n.createMessage(r),Qc.trigger("message",{chatbox:n,stanza:e,attrs:r})}}(e)||!0,null,"message")}Vc.HeadlinesBox=Vc.ChatBox.extend({defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(Qc.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:Vc.HEADLINES_TYPE}},async initialize(){this.set({box_id:"box-"+this.get("jid")}),this.initMessages(),await this.fetchMessages(),Qc.trigger("headlinesBoxInitialized",this)}}),Qc.listen.on("connected",e),Qc.listen.on("reconnected",e),Object.assign(Qc,{headlines:{async get(e,t={},n=!1){async function r(e){let r=await Qc.chatboxes.get(e);return!r&&n?r=await Qc.chatboxes.create(e,t,Vc.HeadlinesBox):(r=r&&r.get("type")===Vc.HEADLINES_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Qc.chatboxes.get()).filter(e=>e.get("type")===Vc.HEADLINES_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}})}});
/**
* @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:mu,$build:vu}=sl.env;mu.addNamespace("RSM","http://jabber.org/protocol/rsm");const _u=["after","before","index","max"],bu=e=>Number(e),yu=e=>e.toString(),wu={after:yu,before:yu,count:bu,first:yu,index:bu,last:yu,max:bu},Su=e=>void 0===e,xu=Object.keys(wu);class Eu{static getQueryParameters(e={}){return Fs(e,_u)}static parseXMLResult(e){const t={};for(var n=0;n<xu.length;n++){const r=xu[n],i=e.getElementsByTagName(r)[0];Su(i)||null===i||(t[r]=wu[r](mu.getText(i)),"first"==r&&(t.index=wu.index(i.getAttribute("index"))))}return t}constructor(e={}){this.query=Eu.getQueryParameters(e),this.result=e.xml?Eu.parseXMLResult(e.xml):{}}toXML(){const e=vu("set",{xmlns:mu.NS.RSM});return _u.reduce((e,t)=>Su(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 Eu(n)}previous(e,t){const n=Object.assign({},this.query,{after:t,before:this.result.first,max:e});return new Eu(n)}}Vc.RSM_ATTRIBUTES=xu,Vc.RSM=Eu;
/**
* @module converse-mam
* @description XEP-0313 Message Archive Management
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Au,$iq:Cu,dayjs:ku}=sl.env,{NS:ju}=Au,Tu=sl.env.utils,Ou={fetchNewestMessages(){if(this.disable_mam)return;const e=this.getMostRecentMessage();if(e&&!Qc.settings.get("clear_messages_on_reconnection")){const t=e.get("stanza_id "+this.get("jid"));t?this.fetchArchivedMessages({after:t},"forwards"):this.fetchArchivedMessages({start:e.get("time")},"forwards")}else this.fetchArchivedMessages({before:""})},async handleMAMResult(e,t,n,r){await Qc.emojis.initialize();const i=this.get("type")===Vc.CHATROOMS_TYPE;e.messages=e.messages.map(e=>i?go.parseMUCMessage(e,this,Vc):go.parseMessage(e,Vc));const s={query:t,chatbox:this,messages:e.messages};if(await Qc.trigger("MAMResult",s,{synchronous:!0}),e.messages.forEach(e=>this.queueMessage(e)),e.error){const t=e.error.retry_event_id=Tu.getUniqueId();Qc.listen.once(t,()=>this.fetchArchivedMessages(n,r)),this.createMessageFromError(e.error)}},async fetchArchivedMessages(e={},t){if(this.disable_mam)return;const n=this.get("type")===Vc.CHATROOMS_TYPE,r=n?this.get("jid"):Vc.bare_jid;if(!await Qc.disco.supports(ju.MAM,r))return;const i=Qc.settings.get("archived_messages_page_size"),s=Object.assign({groupchat:n,max:i,with:this.get("jid")},e),o=await Qc.archive.query(s);return await this.handleMAMResult(o,s,e,t),t&&o.rsm&&!o.complete?("forwards"===t?e=o.rsm.next(i,e.before).query:"backwards"===t&&(e=o.rsm.previous(i,e.after).query),this.fetchArchivedMessages(e,t)):void 0}};sl.plugins.add("converse-mam",{dependencies:["converse-disco","converse-muc"],initialize(){function e(e){Qc.settings.get("muc_show_logs_before_join")&&e.features.get("mam_enabled")&&!e.get("prejoin_mam_fetched")&&(e.fetchNewestMessages(),e.save({prejoin_mam_fetched:!0}))}Qc.settings.extend({archived_messages_page_size:"50",message_archiving:void 0,message_archiving_timeout:2e4}),Object.assign(Vc.ChatBox.prototype,Ou),Vc.onMAMError=function(e){null!=e&&e.querySelectorAll("feature-not-implemented").length?Dn.warn("Message Archive Management (XEP-0313) not supported by "+e.getAttribute("from")):(Dn.error(`Error while trying to set archiving preferences for ${e.getAttribute("from")}.`),Dn.error(e))},Vc.onMAMPreferences=function(e,t){const n=pr()(`prefs[xmlns="${ju.MAM}"]`,e).pop();if(n.getAttribute("default")!==Qc.settings.get("message_archiving")){const e=Cu({type:"set"}).c("prefs",{xmlns:ju.MAM,default:Qc.settings.get("message_archiving")});Array.from(n.children).forEach(t=>e.cnode(t).up()),Qc.sendIQ(e).then(()=>t.save({preferences:{default:Qc.settings.get("message_archiving")}})).catch(Vc.onMAMError)}else t.save({preferences:{default:Qc.settings.get("message_archiving")}})},Qc.listen.on("addClientFeatures",()=>Qc.disco.own.features.add(ju.MAM)),Qc.listen.on("serviceDiscovered",(function(e){const t=e.get("preferences")||{};e.get("var")===ju.MAM&&void 0!==Qc.settings.get("message_archiving")&&t.default!==Qc.settings.get("message_archiving")&&Qc.sendIQ(Cu({type:"get"}).c("prefs",{xmlns:ju.MAM})).then(t=>Vc.onMAMPreferences(t,e)).catch(Vc.onMAMError)})),Qc.listen.on("chatRoomViewInitialized",t=>{Qc.settings.get("muc_show_logs_before_join")&&(e(t.model),t.model.features.on("change:mam_enabled",()=>e(t.model)))}),Qc.listen.on("enteredNewRoom",e=>e.features.get("mam_enabled")&&e.fetchNewestMessages()),Qc.listen.on("chatReconnected",e=>{e.get("type")===Vc.PRIVATE_CHAT_TYPE&&e.fetchNewestMessages()}),Qc.listen.on("afterMessagesFetched",e=>{e.get("type")!==Vc.PRIVATE_CHAT_TYPE||Vc.connection.restored||e.fetchNewestMessages()}),Object.assign(Qc,{archive:{async query(e){if(!Qc.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||Vc.bare_jid;if(!await Qc.disco.supports(ju.MAM,n))return Dn.warn(`Did not fetch MAM archive for ${n} because it doesn't support ${ju.MAM}`),{messages:[]};const r=Tu.getUniqueId(),i=Cu(t).c("query",{xmlns:ju.MAM,queryid:r});if(e){i.c("x",{xmlns:ju.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(ju.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=ku(e[t]);if(!n.isValid())throw new TypeError("archive.query: invalid date provided for: "+t);i.c("field",{var:t}).c("value").t(n.toISOString()).up().up()}}),i.up();const t=new Eu(e);Object.keys(t.query).length&&i.cnode(t.toXML())}const s=[],o=Vc.connection.addHandler(t=>{const n=pr()(`message > result[xmlns="${ju.MAM}"]`,t).pop();if(void 0===n||n.getAttribute("queryid")!==r)return!0;const i=t.getAttribute("from")||Vc.bare_jid;if(e.groupchat){if(i!==e.with)return Dn.warn("Ignoring alleged groupchat MAM message from "+t.getAttribute("from")),!0}else if(i!==Vc.bare_jid)return Dn.warn("Ignoring alleged MAM message from "+t.getAttribute("from")),!0;return s.push(t),!0},ju.MAM);let a;const c=await Qc.sendIQ(i,Qc.settings.get("message_archiving_timeout"),!1);if(null===c){const{__:e}=Vc,t=e("Timeout while trying to fetch archived messages.");return Dn.error(t),a=new Vc.TimeoutError(t),{messages:s,error:a}}if(Tu.isErrorStanza(c)){const{__:e}=Vc,t=e("An error occurred while querying for archived messages.");return Dn.error(t),Dn.error(c),a=new Error(t),{messages:s,error:a}}let l;Vc.connection.deleteHandler(o);const u=c&&pr()(`fin[xmlns="${ju.MAM}"]`,c).pop(),d="true"===(null==u?void 0:u.getAttribute("complete")),h=pr()(`set[xmlns="${ju.RSM}"]`,u).pop();return h&&(l=new Eu({...e,xml:h})),{messages:s,rsm:l,complete:d}}}})}});
/**
* @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:Nu,$iq:Iu}=sl.env,Mu=sl.env.utils;Nu.addNamespace("PING","urn:xmpp:ping"),sl.plugins.add("converse-ping",{initialize(){let e;function t(t){e=new Date;const n=t.getAttribute("from"),r=t.getAttribute("id"),i=Iu({type:"result",to:n,id:r});return Vc.connection.sendIQ(i),!0}Qc.settings.extend({ping_interval:60}),setTimeout(()=>{if(Qc.settings.get("ping_interval")>0){const t=new Date;return e||(e=t),!((t-e)/1e3>Qc.settings.get("ping_interval"))||Qc.ping()}},1e3);const n=function(){void 0!==Vc.connection.disco&&Qc.disco.own.features.add(Nu.NS.PING),Vc.connection.addHandler(t,Nu.NS.PING,"iq","get"),Vc.connection.addHandler(()=>{if(Qc.settings.get("ping_interval")>0)return e=new Date,!0})};Qc.listen.on("connected",n),Qc.listen.on("reconnected",n),Qc.listen.on("windowStateChanged",(function(e){"visible"===e.state&&Qc.connection.connected()&&Qc.ping(null,5e3)})),Object.assign(Qc,{async ping(t,n){if(e=new Date,t=t||Nu.getDomainFromJid(Vc.bare_jid),Vc.connection){const e=Iu({type:"get",to:t,id:Mu.getUniqueId("ping")}).c("ping",{xmlns:Nu.NS.PING}),r=await Qc.sendIQ(e,n||1e4,!1);return null===r?(Dn.warn("Timeout while pinging "+t),t===Nu.getDomainFromJid(Vc.bare_jid)&&Qc.connection.reconnect()):Mu.isErrorStanza(r)&&(Dn.error("Error while pinging "+t),Dn.error(r)),!0}return!1}})}});
/**
* @module converse-pubsub
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Ru,$iq:$u}=sl.env;Ru.addNamespace("PUBSUB_ERROR",Ru.NS.PUBSUB+"#errors"),sl.plugins.add("converse-pubsub",{dependencies:["converse-disco"],initialize(){Object.assign(Vc.api,{pubsub:{async publish(e,t,n,r,i=!0){const s=$u({from:Vc.bare_jid,type:"set",to:e}).c("pubsub",{xmlns:Ru.NS.PUBSUB}).c("publish",{node:t}).cnode(n.tree()).up().up();r&&(e=e||Vc.bare_jid,await Qc.disco.supports(Ru.NS.PUBSUB+"#publish-options",e)?(s.c("publish-options").c("x",{xmlns:Ru.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(Ru.NS.PUBSUB+"#publish-options").up().up(),Object.keys(r).forEach(e=>s.c("field",{var:e}).c("value").t(r[e]).up().up())):Dn.warn(`_converse.api.publish: ${e} does not support #publish-options, so we didn't set them even though they were provided.`));try{await Qc.sendIQ(s)}catch(e){if(!(e instanceof Element&&i&&e.querySelector(`precondition-not-met[xmlns="${Ru.NS.PUBSUB_ERROR}"]`)))throw e;{const e=s.nodeTree;e.querySelector("publish-options").outerHTML="",Dn.warn("PubSub: Republishing without publish options. "+e.outerHTML),await Qc.sendIQ(e)}}}}})}});var Du=function(e){return"number"==typeof e||Ee(e)&&"[object Number]"==O(e)};var Pu=function(e){return Du(e)&&e!=+e};
/**
* @module converse-status
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Lu,$build:zu,$pres:Fu}=sl.env;sl.plugins.add("converse-status",{initialize(){function e(e){Qc.trigger("statusInitialized",e)}function t(t){if(t=void 0!==Vc.xmppstatus&&t)e(t);else{const n="converse.xmppstatus-"+Vc.bare_jid;Vc.xmppstatus=new Vc.XMPPStatus({id:n}),Vc.xmppstatus.browserStorage=Vc.createStore(n,"session"),Vc.xmppstatus.fetch({success:()=>e(t),error:()=>e(t),silent:!0})}}Qc.settings.extend({auto_away:0,auto_xa:0,csi_waiting_time:0,default_state:"online",priority:0}),Qc.promises.add(["statusInitialized"]),Vc.XMPPStatus=Bs.extend({defaults:()=>({status:Qc.settings.get("default_state")}),initialize(){this.on("change",e=>{N(e.changed)&&("status"in e.changed||"status_message"in e.changed)&&Qc.user.presence.send(this.get("status"),null,this.get("status_message"))})},getNickname:()=>Vc.nickname,getFullname:()=>"",constructPresence(e,t=null,n){let r;e="string"==typeof e?e:this.get("status")||Qc.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=Fu(i)):"offline"===e?(i.type="unavailable",r=Fu(i)):r="online"===e?Fu(i):Fu(i).c("show").t(e).up(),n&&r.c("status").t(n).up();const s=Qc.settings.get("priority");if(r.c("priority").t(Pu(Number(s))?0:s).up(),Vc.idle){const e=new Date;e.setSeconds(e.getSeconds()-Vc.idle_seconds),r.c("idle",{xmlns:Lu.NS.IDLE,since:e.toISOString()})}return r}}),Vc.sendCSI=function(e){Qc.send(zu(e,{xmlns:Lu.NS.CSI})),Vc.inactive=e===Vc.INACTIVE},Vc.onUserActivity=function(){var e;Vc.idle_seconds>0&&(Vc.idle_seconds=0),null!==(e=Vc.connection)&&void 0!==e&&e.authenticated&&(Vc.inactive&&Vc.sendCSI(Vc.ACTIVE),Vc.idle&&(Vc.idle=!1,Qc.user.presence.send()),!0===Vc.auto_changed_status&&(Vc.auto_changed_status=!1,Vc.xmppstatus.set("status",Qc.settings.get("default_state"))))},Vc.onEverySecond=function(){var e;if(null===(e=Vc.connection)||void 0===e||!e.authenticated)return;const t=Vc.xmppstatus.get("status");Vc.idle_seconds++,Qc.settings.get("csi_waiting_time")>0&&Vc.idle_seconds>Qc.settings.get("csi_waiting_time")&&!Vc.inactive&&Vc.sendCSI(Vc.INACTIVE),Qc.settings.get("idle_presence_timeout")>0&&Vc.idle_seconds>Qc.settings.get("idle_presence_timeout")&&!Vc.idle&&(Vc.idle=!0,Qc.user.presence.send()),Qc.settings.get("auto_away")>0&&Vc.idle_seconds>Qc.settings.get("auto_away")&&"away"!==t&&"xa"!==t&&"dnd"!==t?(Vc.auto_changed_status=!0,Vc.xmppstatus.set("status","away")):Qc.settings.get("auto_xa")>0&&Vc.idle_seconds>Qc.settings.get("auto_xa")&&"xa"!==t&&"dnd"!==t&&(Vc.auto_changed_status=!0,Vc.xmppstatus.set("status","xa"))},Vc.registerIntervalHandler=function(){if(Qc.settings.get("auto_away")<1&&Qc.settings.get("auto_xa")<1&&Qc.settings.get("csi_waiting_time")<1&&Qc.settings.get("idle_presence_timeout")<1)return;Vc.idle_seconds=0,Vc.auto_changed_status=!1;const{unloadevent:e}=Vc;window.addEventListener("click",Vc.onUserActivity),window.addEventListener("focus",Vc.onUserActivity),window.addEventListener("keypress",Vc.onUserActivity),window.addEventListener("mousemove",Vc.onUserActivity),window.addEventListener(e,Vc.onUserActivity,{once:!0,passive:!0}),window.addEventListener(e,()=>{var e;return null===(e=Vc.session)||void 0===e?void 0:e.save("active",!1)}),Vc.everySecondTrigger=window.setInterval(Vc.onEverySecond,1e3)},Qc.listen.on("presencesInitialized",e=>{e||Vc.registerIntervalHandler()}),Qc.listen.on("clearSession",()=>{Vc.shouldClearCache()&&Vc.xmppstatus&&(Vc.xmppstatus.destroy(),delete Vc.xmppstatus,Qc.promises.add(["statusInitialized"]))}),Qc.listen.on("connected",()=>t(!1)),Qc.listen.on("reconnected",()=>t(!0)),Object.assign(Vc.api.user,{presence:{async send(e,t,n){await Qc.waitUntil("statusInitialized"),Qc.send(Vc.xmppstatus.constructPresence(e,t,n))}},status:{get:async()=>(await Qc.waitUntil("statusInitialized"),Vc.xmppstatus.get("status")),async set(e,t){const n={status:e};if(!Object.keys(Vc.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 Qc.waitUntil("statusInitialized"),Vc.xmppstatus.save(n)},message:{get:async()=>(await Qc.waitUntil("statusInitialized"),Vc.xmppstatus.get("status_message")),async set(e){await Qc.waitUntil("statusInitialized"),Vc.xmppstatus.save({status_message:e})}}}})}});var Bu=function(e){return function(t){return null==e?void 0:ms(e,t)}};var qu=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 Uu=function(e){return e&&e.length?qu(e,vr):0};
/**
* @module converse-roster
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Hu,$iq:Vu,$pres:Wu,dayjs:Gu,sizzle:Ju}=sl.env,Qu=sl.env.utils;sl.plugins.add("converse-roster",{dependencies:["converse-status"],initialize(){const{__:e}=Vc;Qc.settings.extend({allow_contact_requests:!0,auto_subscribe:!1,synchronize_availability:!0}),Qc.promises.add(["cachedRoster","roster","rosterContactsFetched","rosterGroupsFetched","rosterInitialized"]),Vc.HEADER_CURRENT_CONTACTS=e("My contacts"),Vc.HEADER_PENDING_CONTACTS=e("Pending contacts"),Vc.HEADER_REQUESTING_CONTACTS=e("Contact requests"),Vc.HEADER_UNGROUPED=e("Ungrouped"),Vc.HEADER_UNREAD=e("New messages");const t={};t[Vc.HEADER_UNREAD]=0,t[Vc.HEADER_REQUESTING_CONTACTS]=1,t[Vc.HEADER_CURRENT_CONTACTS]=2,t[Vc.HEADER_UNGROUPED]=3,t[Vc.HEADER_PENDING_CONTACTS]=4,Vc.registerPresenceHandler=function(){Vc.unregisterPresenceHandler(),Vc.presence_ref=Vc.connection.addHandler(e=>(Vc.roster.presenceHandler(e),!0),null,"presence",null)},Vc.rejectPresenceSubscription=function(e,t){const n=Wu({to:e,type:"unsubscribed"});t&&""!==t&&n.c("status").t(t),Qc.send(n)},Vc.sendInitialPresence=function(){Vc.send_initial_presence&&Qc.user.presence.send()},Vc.populateRoster=async function(e=!1){e&&(Vc.send_initial_presence=!0);try{await Vc.rostergroups.fetchRosterGroups(),Qc.trigger("rosterGroupsFetched"),await Vc.roster.fetchRosterContacts(),Qc.trigger("rosterContactsFetched")}catch(e){Dn.error(e)}finally{Vc.sendInitialPresence()}};const n=Bs.extend({idAttribute:"name"}),r=ia.extend({model:n});function i(e){const t=Vc.roster&&Vc.roster.findWhere({jid:e.get("jid")});void 0!==t&&t.save({num_unread:e.get("num_unread")})}async function s(){Vc.presences&&await Vc.presences.clearStore()}Vc.Presence=Bs.extend({defaults:{show:"offline"},initialize(){this.resources=new r;const e="converse.identities-"+this.get("jid");this.resources.browserStorage=Vc.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=>`${e.get("priority")}-${e.get("timestamp")}`).reverse()[0]},addResource(e){const t=e.getAttribute("from"),n=Hu.getResourceFromJid(t),r=Ju(`delay[xmlns="${Hu.NS.DELAY}"]`,e).pop(),i=Bu(e.querySelector("priority"))("textContent")||0,s=this.resources.get(n),o={name:n,priority:Pu(parseInt(i,10))?0:parseInt(i,10),show:Bu(e.querySelector("show"))("textContent")||"online",timestamp:r?Gu(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()}}),Vc.Presences=ia.extend({model:Vc.Presence}),Vc.RosterContact=Bs.extend({defaults:{chat_state:void 0,image:Vc.DEFAULT_IMAGE,image_type:Vc.DEFAULT_IMAGE_TYPE,num_unread:0,status:void 0},async initialize(e){this.initialized=Qu.getResolveablePromise(),this.setPresence();const{jid:t}=e,n=Hu.getBareJidFromJid(t).toLowerCase();e.jid=n,this.set(Object.assign({groups:[],id:n,jid:n,user_id:Hu.getNodeFromJid(t)},e)),this.listenTo(this.presence,"change:show",()=>Qc.trigger("contactPresenceChanged",this)),this.listenTo(this.presence,"change:show",()=>this.trigger("presenceChanged")),await Qc.trigger("rosterContactInitialized",this,{Synchronous:!0}),this.initialized.resolve()},setPresence(){const e=this.get("jid");this.presence=Vc.presences.findWhere({jid:e})||Vc.presences.create({jid:e})},openChat(){const e=this.attributes;Qc.chats.open(e.jid,e,!0)},getFilterCriteria(){const e=this.get("nickname"),t=this.get("jid");let n=this.getDisplayName();return n=n.includes(t)?n:n.concat(" "+t),n=n.includes(e)?n:n.concat(" "+e),n.toLowerCase()},getDisplayName(){return this.get("nickname")?this.get("nickname"):this.get("jid")},getFullname(){return this.get("jid")},subscribe(e){const t=Wu({to:this.get("jid"),type:"subscribe"});e&&""!==e&&t.c("status").t(e).up();const n=Vc.xmppstatus.getNickname()||Vc.xmppstatus.getFullname();return n&&t.c("nick",{xmlns:Hu.NS.NICK}).t(n).up(),Qc.send(t),this.save("ask","subscribe"),this},ackSubscribe(){Qc.send(Wu({type:"subscribe",to:this.get("jid")}))},ackUnsubscribe(){Qc.send(Wu({type:"unsubscribe",to:this.get("jid")})),this.removeFromRoster(),this.destroy()},unauthorize(e){return Vc.rejectPresenceSubscription(this.get("jid"),e),this},authorize(e){const t=Wu({to:this.get("jid"),type:"subscribed"});return e&&""!==e&&t.c("status").t(e),Qc.send(t),this},removeFromRoster(){const e=Vu({type:"set"}).c("query",{xmlns:Hu.NS.ROSTER}).c("item",{jid:this.get("jid"),subscription:"remove"});return Qc.sendIQ(e)}}),Vc.RosterContacts=ia.extend({model:Vc.RosterContact,comparator(e,t){const n=e.presence.get("show")||"offline",r=t.presence.get("show")||"offline";if(Vc.STATUS_WEIGHTS[n]===Vc.STATUS_WEIGHTS[r]){const n=e.getDisplayName().toLowerCase(),r=t.getDisplayName().toLowerCase();return n<r?-1:n>r?1:0}return Vc.STATUS_WEIGHTS[n]<Vc.STATUS_WEIGHTS[r]?-1:1},onConnected(){this.registerRosterHandler(),this.registerRosterXHandler()},registerRosterHandler(){Vc.connection.addHandler(e=>(Vc.roster.onRosterPush(e),!0),Hu.NS.ROSTER,"iq","set")},registerRosterXHandler(){let e=0;Vc.connection.addHandler((function(t){return window.setTimeout((function(){Vc.connection.flush(),Vc.roster.subscribeToSuggestedItems.bind(Vc.roster)(t)}),e),e+=250*t.querySelectorAll("item").length,!0}),Hu.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(Qu.isErrorObject(e)&&(Dn.error(e),Vc.session.set("roster_cached",!1),this.data.save("version",void 0)),!Vc.session.get("roster_cached"))return Vc.send_initial_presence=!0,Vc.roster.fetchFromServer();Qc.trigger("cachedRoster",e)},subscribeToSuggestedItems:e=>(Array.from(e.querySelectorAll("item")).forEach(e=>{"add"===e.getAttribute("action")&&Vc.roster.addAndSubscribe(e.getAttribute("jid"),Vc.xmppstatus.getNickname()||Vc.xmppstatus.getFullname())}),!0),isSelf:e=>Qu.isSameBareJID(e,Vc.connection.jid),async addAndSubscribe(e,t,n,r,i){const s=await this.addContactToRoster(e,t,n,i);s instanceof Vc.RosterContact&&s.subscribe(r)},sendContactAddIQ(e,t,n){t=t||null;const r=Vu({type:"set"}).c("query",{xmlns:Hu.NS.ROSTER}).c("item",{jid:e,name:t});return n.forEach(e=>r.c("group").t(e).up()),Qc.sendIQ(r)},async addContactToRoster(t,n,r,i){await Qc.waitUntil("rosterContactsFetched"),r=r||[];try{await this.sendContactAddIQ(t,n,r)}catch(r){return Dn.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 Vc.RosterContact)n.authorize().subscribe();else{var r;const n=(null===(r=Ju(`nick[xmlns="${Hu.NS.NICK}"]`,t).pop())||void 0===r?void 0:r.textContent)||null,i=await this.addContactToRoster(e,n,[],{subscription:"from"});i instanceof Vc.RosterContact&&i.authorize().subscribe()}},getNumOnlineContacts(){const e=["offline","unavailable"];return Uu(this.models.filter(t=>!e.includes(t.presence.get("show"))))},onRosterPush(e){const t=e.getAttribute("id"),n=e.getAttribute("from");if(n&&n!==Vc.bare_jid)return void Dn.warn("Ignoring roster illegitimate roster push message from "+e.getAttribute("from"));Qc.send(Vu({type:"result",id:t,from:Vc.connection.jid}));const r=Ju(`query[xmlns="${Hu.NS.ROSTER}"]`,e).pop();this.data.save("version",r.getAttribute("ver"));const i=Ju("item",r);if(i.length>1)throw Dn.error(e),new Error('Roster push query may not contain more than one "item" element.');if(0===i.length)return Dn.warn(e),void Dn.warn('Received a roster push stanza without an "item" element.');this.updateContact(i.pop()),Qc.trigger("rosterPush",e)},rosterVersioningSupported(){return Qc.disco.stream.getFeature("ver","urn:xmpp:features:rosterver")&&this.data.get("version")},async fetchFromServer(){const e=Vu({type:"get",id:Qu.getUniqueId("roster")}).c("query",{xmlns:Hu.NS.ROSTER});this.rosterVersioningSupported()&&e.attrs({ver:this.data.get("version")});const t=await Qc.sendIQ(e,null,!1);if("error"!==t.getAttribute("type")){const e=Ju(`query[xmlns="${Hu.NS.ROSTER}"]`,t).pop();if(e){Ju("item",e).forEach(e=>this.updateContact(e)),this.data.save("version",e.getAttribute("ver"))}}else if(!Qu.isServiceUnavailableError(t))return Dn.error(t),void Dn.error("Error while trying to fetch roster from the server");Vc.session.save("roster_cached",!0),Qc.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:Hu.getBareJidFromJid(e.getAttribute("from")),subscription:"none",ask:null,requesting:!0,nickname:(null===(t=Ju(`nick[xmlns="${Hu.NS.NICK}"]`,e).pop())||void 0===t?void 0:t.textContent)||null};Qc.trigger("contactRequest",this.create(n))},handleIncomingSubscription(t){const n=t.getAttribute("from"),r=Hu.getBareJidFromJid(n),i=this.get(r);Qc.settings.get("allow_contact_requests")||Vc.rejectPresenceSubscription(n,e("This client does not allow presence subscriptions")),Qc.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=Hu.getResourceFromJid(t),r=e.getAttribute("type");if(Vc.connection.jid!==t&&"unavailable"!==r&&(!0===Qc.settings.get("synchronize_availability")||Qc.settings.get("synchronize_availability")===n)){const t=Bu(e.querySelector("show"))("textContent")||"online";Vc.xmppstatus.save({status:t},{silent:!0});const n=Bu(e.querySelector("status"))("textContent");n&&Vc.xmppstatus.save({status_message:n})}Vc.jid===t&&"unavailable"===r&&Qc.user.presence.send()},presenceHandler(e){const t=e.getAttribute("type");if("error"===t)return!0;const n=e.getAttribute("from"),r=Hu.getBareJidFromJid(n);if(this.isSelf(r))return this.handleOwnPresence(e);if(Ju(`query[xmlns="${Hu.NS.MUC}"]`,e).length)return;const i=Bu(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=Hu.getResourceFromJid(n);s.presence.removeResource(e)}else s&&s.presence.addResource(e)}}}),Vc.RosterGroup=Bs.extend({initialize(t){this.set(Object.assign({description:e("Click to hide these contacts"),state:Vc.OPENED},t)),this.contacts=new Vc.RosterContacts}}),Vc.RosterGroups=ia.extend({model:Vc.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=Vc.HEADER_CURRENT_CONTACTS;return r[e]<r[n]?-1:r[e]>r[n]?1:0}if(s&&!o){const t=Vc.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})})}}),Vc.unregisterPresenceHandler=function(){void 0!==Vc.presence_ref&&(Vc.connection.deleteHandler(Vc.presence_ref),delete Vc.presence_ref)},Qc.listen.on("chatBoxesInitialized",()=>{Vc.chatboxes.on("change:num_unread",i),Vc.chatboxes.on("add",e=>{e.get("type")===Vc.PRIVATE_CHAT_TYPE&&e.setRosterContact(e.get("jid"))})}),Qc.listen.on("beforeTearDown",()=>Vc.unregisterPresenceHandler()),Qc.waitUntil("rosterContactsFetched").then(()=>{Vc.roster.on("add",e=>{const t=Vc.chatboxes.findWhere({jid:e.get("jid")});t&&t.setRosterContact(e.get("jid"))})}),Qc.listen.on("streamResumptionFailed",()=>Vc.session.set("roster_cached",!1)),Qc.listen.on("clearSession",async()=>{await s(),Vc.shouldClearCache()&&(Vc.rostergroups&&(await Vc.rostergroups.clearStore(),delete Vc.rostergroups),Vc.roster&&($a(Vc,"roster.data.destroy"),await Vc.roster.clearStore(),delete Vc.roster))}),Qc.listen.on("statusInitialized",async e=>{if(e)!Vc.connection.hasResumed()&&await s();else{Vc.presences=new Vc.Presences;const e="converse.presences-"+Vc.bare_jid;Vc.presences.browserStorage=Vc.createStore(e,"session"),Vc.presences.fetch()}Qc.trigger("presencesInitialized",e)}),Qc.listen.on("presencesInitialized",async e=>{e?Qc.trigger("rosterReadyAfterReconnection"):await async function(){await Qc.waitUntil("VCardsInitialized"),Vc.roster=new Vc.RosterContacts;let e="converse.contacts-"+Vc.bare_jid;Vc.roster.browserStorage=Vc.createStore(e),Vc.roster.data=new Bs,e="converse-roster-model-"+Vc.bare_jid,Vc.roster.data.id=e,Vc.roster.data.browserStorage=Vc.createStore(e),Vc.roster.data.fetch(),e="converse.roster.groups"+Vc.bare_jid,Vc.rostergroups=new Vc.RosterGroups,Vc.rostergroups.browserStorage=Vc.createStore(e),Qc.trigger("rosterInitialized")}(),Vc.roster.onConnected(),Vc.registerPresenceHandler(),Vc.populateRoster(!Vc.connection.restored)}),Object.assign(Vc.api,{contacts:{async get(e){await Qc.waitUntil("rosterContactsFetched");const t=e=>Vc.roster.get(Hu.getBareJidFromJid(e));if(void 0===e)e=Vc.roster.pluck("jid");else if("string"==typeof e)return t(e);return e.map(t)},async add(e,t){if(await Qc.waitUntil("rosterContactsFetched"),"string"!=typeof e||!e.includes("@"))throw new TypeError("contacts.add: invalid jid");return Vc.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:Yu}=sl.env,Ku=sl.env.utils;function Xu(){return!(Qc.connection.isType("bosh")&&!Vc.isTestEnv())&&Qc.disco.stream.getFeature("sm",Yu.NS.SM)}function Zu(e){if(!Vc.session.get("smacks_enabled"))return!0;const t=parseInt(e.getAttribute("h"),10),n=Vc.session.get("num_stanzas_handled_by_server"),r=t-n;if(r<0){const e=`New reported stanza count lower than previous. New: ${t} - Previous: ${n}`;Dn.error(e)}const i=Vc.session.get("unacked_stanzas");if(r>i.length){const e=`Higher reported acknowledge count than unacknowledged stanzas. Reported Acknowledged Count: ${r} -Unacknowledged Stanza Count: ${i.length} -New: ${t} - Previous: ${n}`;Dn.error(e)}return Vc.session.save({num_stanzas_handled_by_server:t,num_stanzas_since_last_ack:0,unacked_stanzas:i.slice(r)}),!0}function ed(){if(Vc.session.get("smacks_enabled")){const e=Vc.session.get("num_stanzas_handled"),t=Ku.toStanza(`<a xmlns="${Yu.NS.SM}" h="${e}"/>`);Qc.send(t)}return!0}function td(e){if(Vc.session.get("smacks_enabled")&&(Ku.isTagEqual(e,"iq")||Ku.isTagEqual(e,"presence")||Ku.isTagEqual(e,"message"))){const e=Vc.session.get("num_stanzas_handled");Vc.session.save("num_stanzas_handled",e+1)}return!0}function nd(){Vc.session.save({smacks_enabled:Vc.session.get("smacks_enabled")||!1,num_stanzas_handled:Vc.session.get("num_stanzas_handled")||0,num_stanzas_handled_by_server:Vc.session.get("num_stanzas_handled_by_server")||0,num_stanzas_since_last_ack:Vc.session.get("num_stanzas_since_last_ack")||0,unacked_stanzas:Vc.session.get("unacked_stanzas")||[]})}function rd(){Vc.session&&Vc.session.save({smacks_enabled:!1,num_stanzas_handled:0,num_stanzas_handled_by_server:0,num_stanzas_since_last_ack:0,unacked_stanzas:[]})}function id(e){const t={smacks_enabled:!0};return["1","true"].includes(e.getAttribute("resume"))&&(t.smacks_stream_id=e.getAttribute("id")),Vc.session.save(t),!0}function sd(e){return e.querySelector("item-not-found")?Dn.warn("Could not resume previous SMACKS session, session id not found. A new session will be established."):(Dn.error("Failed to enable stream management"),Dn.error(e.outerHTML)),rd(),Qc.trigger("streamResumptionFailed"),!0}function od(e){id(e),Zu(e),function(){const e=Vc.session.get("unacked_stanzas");Vc.session.save("unacked_stanzas",[]),e.forEach(e=>Qc.send(e))}(),Vc.connection.do_bind=!1,Vc.connection.authenticated=!0,Vc.connection.restored=!0,Vc.connection._changeConnectStatus(Yu.Status.CONNECTED,null)}async function ad(){if(Qc.settings.get("enable_smacks")&&!Vc.session.get("smacks_enabled")&&await Xu()){const e=Ku.getResolveablePromise();Vc.connection._addSysHandler(t=>e.resolve(id(t)),Yu.NS.SM,"enabled"),Vc.connection._addSysHandler(t=>e.resolve(sd(t)),Yu.NS.SM,"failed");const t=Qc.connection.isType("websocket")||Vc.isTestEnv(),n=Ku.toStanza(`<enable xmlns="${Yu.NS.SM}" resume="${t}"/>`);Qc.send(n),Vc.connection.flush(),await e}}Yu.addNamespace("SM","urn:xmpp:sm:3");const cd=[];async function ld(){if(!Qc.settings.get("enable_smacks"))return;if(!await Xu())return;const e=Vc.connection;for(;cd.length;)e.deleteHandler(cd.pop());cd.push(e.addHandler(td)),cd.push(e.addHandler(ed,Yu.NS.SM,"r")),cd.push(e.addHandler(Zu,Yu.NS.SM,"a")),Vc.session.get("smacks_stream_id")?await async function(){const e=Ku.getResolveablePromise();Vc.connection._addSysHandler(t=>e.resolve(od(t)),Yu.NS.SM,"resumed"),Vc.connection._addSysHandler(t=>e.resolve(sd(t)),Yu.NS.SM,"failed");const t=Vc.session.get("smacks_stream_id"),n=Vc.session.get("num_stanzas_handled"),r=Ku.toStanza(`<resume xmlns="${Yu.NS.SM}" h="${n}" previd="${t}"/>`);Qc.send(r),Vc.connection.flush(),await e}():rd()}function ud(e){if(Vc.session){if(Vc.session.get("smacks_enabled")&&(Ku.isTagEqual(e,"iq")||Ku.isTagEqual(e,"presence")||Ku.isTagEqual(e,"message"))){const t=Yu.serialize(e);Vc.session.save("unacked_stanzas",(Vc.session.get("unacked_stanzas")||[]).concat([t]));const n=Qc.settings.get("smacks_max_unacked_stanzas");if(n>0){const e=Vc.session.get("num_stanzas_since_last_ack")+1;e%n==0&&Qc.send(Ku.toStanza(`<r xmlns="${Yu.NS.SM}"/>`)),Vc.session.save({num_stanzas_since_last_ack:e})}}}else Dn.warn("No _converse.session!")}sl.plugins.add("converse-smacks",{initialize(){Qc.settings.extend({enable_smacks:!0,smacks_max_unacked_stanzas:5}),Qc.listen.on("afterResourceBinding",ad),Qc.listen.on("beforeResourceBinding",ld),Qc.listen.on("send",ud),Qc.listen.on("userSessionInitialized",nd)}});
/**
* @module converse-vcard
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:dd,$iq:hd,dayjs:fd}=sl.env,pd=sl.env.utils;sl.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=hd(t?{type:e,to:t}:{type:e});return n?r.cnode(n):r.c("vCard",{xmlns:dd.NS.VCARD}),r}async function t(t,n){const r=dd.getBareJidFromJid(n)===t.bare_jid?null:n;let i;try{i=await Qc.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=pd.base64ToArrayBuffer(r.image),t=await crypto.subtle.digest("SHA-1",e);r.image_hash=pd.arrayBufferToHex(t)}return r}(0,i)}async function n(e){let t;if(e instanceof Vc.Message){if("error"===e.get("type"))return;t=e.get("from")}else t=e.get("jid");await Qc.waitUntil("VCardsInitialized"),e.vcard=Vc.vcards.findWhere({jid:t}),e.vcard||(e.vcard=Vc.vcards.create({jid:t})),e.vcard.on("change",()=>e.trigger("vcard:change"))}async function r(e){await Qc.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=dd.getResourceFromJid(e.get("from"));if(n&&n.get("nick")===r)return Vc.xmppstatus.vcard;{const t=e.occupant&&e.occupant.get("jid")||e.get("from");return t?Vc.vcards.findWhere({jid:t})||Vc.vcards.create({jid:t}):void Dn.error("Could not assign VCard for message because no JID found! msgid: "+e.get("msgid"))}}(e))}Qc.promises.add("VCardsInitialized"),Vc.VCard=Bs.extend({defaults:{image:Vc.DEFAULT_IMAGE,image_type:Vc.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=Vc.DEFAULT_IMAGE,r.image_type=Vc.DEFAULT_IMAGE_TYPE,Bs.prototype.set.call(this,r,n)):Bs.prototype.set.apply(this,arguments)},getDisplayName(){return this.get("nickname")||this.get("fullname")||this.get("jid")}}),Vc.VCards=ia.extend({model:Vc.VCard,initialize(){this.on("add",e=>e.get("jid")&&Qc.vcard.update(e))}}),Vc.initVCardCollection=async function(){Vc.vcards=new Vc.VCards,Vc.vcards.browserStorage=Vc.createStore(Vc.bare_jid+"-converse.vcards"),await new Promise(e=>{Vc.vcards.fetch({success:e,error:e},{silent:!0})});const e=Vc.vcards;if(Vc.session){const t=Vc.session.get("bare_jid");Vc.xmppstatus.vcard=e.findWhere({jid:t})||e.create({jid:t})}Qc.trigger("VCardsInitialized")},Qc.listen.on("chatBoxInitialized",e=>n(e)),Qc.listen.on("chatRoomInitialized",e=>n(e)),Qc.listen.on("chatRoomMessageInitialized",e=>r(e)),Qc.listen.on("addClientFeatures",()=>Qc.disco.own.features.add(dd.NS.VCARD)),Qc.listen.on("clearSession",()=>{Vc.shouldClearCache()&&(Qc.promises.add("VCardsInitialized"),Vc.vcards&&(Vc.vcards.clearStore(),delete Vc.vcards))}),Qc.listen.on("messageInitialized",e=>n(e)),Qc.listen.on("rosterContactInitialized",e=>n(e)),Qc.listen.on("statusInitialized",Vc.initVCardCollection),Object.assign(Vc.api,{vcard:{async set(t,n){if(!t)throw Error("No jid provided for the VCard data");const r=document.createElement("div"),i=pd.toStanza(`\n <vCard xmlns="vcard-temp">\n <FN>${n.fn}</FN>\n <NICKNAME>${n.nickname}</NICKNAME>\n <URL>${n.url}</URL>\n <ROLE>${n.role}</ROLE>\n <EMAIL><INTERNET/><PREF/><USERID>${n.email}</USERID></EMAIL>\n <PHOTO>\n <TYPE>${n.image_type}</TYPE>\n <BINVAL>${n.image}</BINVAL>\n </PHOTO>\n </vCard>`,r);let s;try{s=await Qc.sendIQ(e("set",t,i))}catch(e){throw e}return await Qc.vcard.update(t,!0),s},get(e,n){if("string"==typeof e)return t(Vc,e);if(!n&&e.get("vcard_updated")&&fd(e.get("vcard_error")).isSame(new Date,"day"))return Promise.resolve({});{const n=e.get("jid");return n||Dn.error("No JID to get vcard for"),t(Vc,n)}},async update(e,t){const n=await this.get(e,t);(e="string"==typeof e?Vc.vcards.findWhere({jid:e}):e)?(delete n.stanza,e.save(n)):Dn.error("Could not find a VCard model for "+e)}}})}});var gd=n(64),md=n.n(gd);function vd(e,t){return"string"==typeof e&&t.includes(e)}function _d(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){let t;if(window.navigator.userLanguage&&(t=bd(window.navigator.userLanguage,e)),window.navigator.languages&&!t)for(let n=0;n<window.navigator.languages.length&&!t;n++)t=bd(window.navigator.languages[n],e);return window.navigator.browserLanguage&&!t&&(t=bd(window.navigator.browserLanguage,e)),window.navigator.language&&!t&&(t=bd(window.navigator.language,e)),window.navigator.systemLanguage&&!t&&(t=bd(window.navigator.systemLanguage,e)),t||"en"}(t)||"en":e}function bd(e,t){if(t(e))return e;var n=e.split("-")[0];return n!==e&&t(n)?n:void 0}let yd;Object.assign(Hc,{getLocale:(e,t)=>_d(e,e=>vd(e,t)),translate(e){if(!yd)return md.a.sprintf.apply(md.a,arguments);const t=yd.translate(e);return arguments.length>1?t.fetch.apply(t,[].slice.call(arguments,1)):t.fetch()},async initialize(){if(Vc.isTestEnv())Vc.locale="en";else try{const e=Qc.settings.get("i18n");Vc.locale=Hc.getLocale(e,Qc.settings.get("locales")),await async function(e){const{api:t,locale:r}=e,i=r.toLowerCase().replace("_","-");if(!vd(r,t.settings.get("locales"))||"en"===r)return;const{default:s}=await n(492)(`./${r}/LC_MESSAGES/converse.po`);await n(493)("./"+i),Sn.a.locale(_d(i,e=>Sn.a.locale(e))),yd=new md.a(s)}(Vc)}catch(e){Dn.fatal(e.message),Vc.locale="en"}},__:(...e)=>Hc.translate(...e)});const wd=Hc.__,Sd={};Qc.elements={registry:Sd,define:function(e,t){this.registry[e]=t},register:function(){Object.keys(Sd).forEach(e=>{customElements.get(e)||customElements.define(e,Sd[e])})}};
/**
* @module converse-autocomplete
* @copyright Lea Verou and the Converse.js contributors
* @description
* Converse.js plugin which started as a fork of Lea Verou's Awesomplete
* https://leaverou.github.io/awesomplete/
* @license Mozilla Public License (MPLv2)
*/
const xd=sl.env.utils,Ed=function(e,t){return RegExp(jd.regExpEscape(t.trim()),"i").test(e)},Ad=function(e,t){return RegExp("^"+jd.regExpEscape(t.trim()),"i").test(e)},Cd=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},kd=(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},jd={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,"\\$&")};class Td 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()}}class Od{constructor(e,t={}){this.is_opened=!1,xd.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:Ed,sort:!1!==t.sort&&Cd,item:kd},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)}},jd.bind(this.input,this._events.input),jd.bind(this.input.form,this._events.form),jd.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=jd.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?xd.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(){jd.unbind(this.input,this._events.input),jd.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=xd.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=xd.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=xd.ancestor(e.target,"li");t&&(e.preventDefault(),this.select(t,e.target))}onKeyDown(e){if(this.opened){if([sl.keycodes.ENTER,sl.keycodes.TAB].includes(e.keyCode)&&this.selected)return e.preventDefault(),e.stopPropagation(),this.select(),!0;if(e.keyCode===sl.keycodes.ESCAPE)return this.close({reason:"esc"}),!0;if([sl.keycodes.UP_ARROW,sl.keycodes.DOWN_ARROW].includes(e.keyCode))return e.preventDefault(),e.stopPropagation(),this[e.keyCode===sl.keycodes.UP_ARROW?"previous":"next"](),!0}if(![sl.keycodes.SHIFT,sl.keycodes.META,sl.keycodes.META_RIGHT,sl.keycodes.ESCAPE,sl.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=xd.getCurrentWord(e.target,e.target.selectionEnd-1);this.ac_triggers.includes(t[0])&&(this.auto_completing=!0)}}async evaluate(e){const t=this.selected&&e&&(e.keyCode===sl.keycodes.UP_ARROW||e.keyCode===sl.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?xd.getCurrentWord(this.input):this.input.value;const i=this.ac_triggers.includes(r[0]);i&&(this.auto_completing=!0,this.include_triggers.includes(e.key)||(r=r.slice("1"))),(i||r.length)&&r.length>=this.min_chars?(this.index=-1,this.ul.innerHTML="",this.suggestions=n.map(e=>new Td(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(Od.prototype,bi),sl.plugins.add("converse-autocomplete",{initialize(){const e=this._converse;e.FILTER_CONTAINS=Ed,e.FILTER_STARTSWITH=Ad,e.AutoComplete=Od}});var Nd=e=>{const t=wd("Click to toggle the bookmarks list"),n=wd("Bookmarks");return wc`
<div class="list-container list-container--bookmarks ${e.hidden?"":"hidden"}">
<a class="list-toggle bookmarks-toggle controlbox-padded"
title="${t}"
@click=${e.toggleBookmarksList}>
<span class="fa ${e.toggle_state===e._converse.OPENED?"fa-caret-down":"fa-caret-right"}">
</span> ${n}</a>
<div class="items-list bookmarks rooms-list ${e.toggle_state!==e._converse.OPENED?"hidden":""}">
${e.bookmarks.map(t=>(e=>{const t=wd("Unbookmark this groupchat"),n=wd("Click to open this groupchat");return wc`
<div class="list-item controlbox-padded room-item available-chatroom d-flex flex-row ${e.is_hidden(e.bm)?"hidden":""}" data-room-jid="${e.bm.get("jid")}">
<a class="list-item-link open-room w-100" data-room-jid="${e.bm.get("jid")}"
title="${n}"
@click=${e.openRoom}>${e.bm.getDisplayName()}</a>
<a class="list-item-action remove-bookmark fa fa-bookmark align-self-center ${e.bm.get("bookmarked")?"button-on":""}"
data-room-jid="${e.bm.get("jid")}"
data-bookmark-name="${e.bm.getDisplayName()}"
title="${t}"
@click=${e.removeBookmark}></a>
</div>
`})(Object.assign({bm:t},e)))}
</div>
</div>
`};const Id=/^\s*</,Md=("undefined"!=typeof Element&&Element.prototype,function(e){this.cid=_i("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),kr(this,Fs(e,$d)),this._ensureElement(),this.initialize.apply(this,arguments)});Md.extend=Qr;const Rd=/^(\S+)\s*(.*)$/,$d=["model","collection","el","id","attributes","className","tagName","events"];Object.assign(Md.prototype,bi,{tagName:"div",$:function(e){return this.el.querySelectorAll(e)},preinitialize:function(){},initialize:function(){},render:function(){return M(this.beforeRender)&&this.beforeRender(),M(this.toHTML)&&bc(this.toHTML(),this.el),M(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(Id.test(e)){const t=document.createElement("div");t.innerHTML=e,this.el=t.firstChild}else this.el=document.querySelector(e);else e&&!Mn(e)&&e.length?this.el=e[0]:this.el=e},delegateEvents:function(e){if(e||(e=Jr(this,"events")),!e)return this;this.undelegateEvents();for(const t in e){let n=e[t];if(M(n)||(n=this[n]),!n)continue;const r=t.match(Rd);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(Jr(this,"el"));else{const e=kr({},Jr(this,"attributes"));this.id&&(e.id=Jr(this,"id")),this.className&&(e.class=Jr(this,"className")),this.setElement(this._createElement(Jr(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 Dd=Ar((function(e,t,n){var r=-1,i="function"==typeof t,s=Qe(e)?Array(e.length):[];return _o(e,(function(e){s[++r]=i?_r(t,e,n):Ra(e,t,n)})),s}));
/**
* @module converse-bookmark-views
* @description Converse.js plugin which adds views for XEP-0048 bookmarks
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Pd}=sl.env,Ld=sl.env.utils;sl.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Qc.settings.extend({hide_open_bookmarks:!0}),Object.assign(Vc,{removeBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-bookmark-name"),n=e.target.getAttribute("data-room-jid");confirm(wd('Are you sure you want to remove the bookmark "%1$s"?',t))&&Dd(Vc.bookmarks.where({jid:n}),Bs.prototype.destroy)},addBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid");Qc.rooms.open(t,{bring_to_foreground:!0}),Vc.chatboxviews.get(t).renderBookmarkForm()}});const e={setBookmarkState(){if(void 0!==Vc.bookmarks){Vc.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 Vc.MUCBookmarkForm({model:this.model,chatroomview:this});this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)}Ld.showElement(this.bookmark_form.el)},toggleBookmark(e){null==e||e.preventDefault();const t=Vc.bookmarks.where({jid:this.model.get("jid")});t.length?t.forEach(e=>e.destroy()):this.renderBookmarkForm()}};Object.assign(Vc.ChatRoomView.prototype,e),Vc.MUCBookmarkForm=Md.extend({className:"muc-bookmark-form chatroom-form-container",initialize(e){this.chatroomview=e.chatroomview,this.render()},toHTML(){return(e=>{const t=wd("Bookmark this groupchat"),n=wd("Would you like this groupchat to be automatically joined upon startup?"),r=wd("Cancel"),i=wd("The name for this bookmark:"),s=wd("What should your nickname for this groupchat be?"),o=wd("Save");return wc`
<form class="converse-form chatroom-form" @submit=${e.onSubmit}>
<legend>${t}</legend>
<fieldset class="form-group">
<label for="converse_muc_bookmark_name">${i}</label>
<input class="form-control" type="text" value="${e.name}" name="name" required="required" id="converse_muc_bookmark_name"/>
</fieldset>
<fieldset class="form-group">
<label for="converse_muc_bookmark_nick">${s}</label>
<input class="form-control" type="text" name="nick" value="${e.nick||""}" id="converse_muc_bookmark_nick"/>
</fieldset>
<fieldset class="form-group form-check">
<input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" name="autojoin"/>
<label class="form-check-label" for="converse_muc_bookmark_autojoin">${n}</label>
</fieldset>
<fieldset class="form-group">
<input class="btn btn-primary" type="submit" value="${o}">
<input class="btn btn-secondary button-cancel" type="button" value="${r}" @click=${e.onCancel}>
</fieldset>
</form>
`})(Object.assign(this.model.toJSON(),{onCancel:e=>this.closeBookmarkForm(e),onSubmit:e=>this.onBookmarkFormSubmitted(e)}))},onBookmarkFormSubmitted(e){var t,n,r;e.preventDefault(),Vc.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()}}),Vc.BookmarksView=Md.extend({tagName:"span",initialize(){this.listenTo(this.model,"add",this.render),this.listenTo(this.model,"remove",this.render),this.listenTo(Vc.chatboxes,"add",this.render),this.listenTo(Vc.chatboxes,"remove",this.render);const e=`converse.room-bookmarks${Vc.bare_jid}-list-model`;this.list_model=new Vc.BookmarksList({id:e}),this.list_model.browserStorage=Vc.createStore(e);const t=()=>{this.render(),this.insertIntoControlBox()};this.list_model.fetch({success:t,error:t})},toHTML(){return Nd({_converse:Vc,bookmarks:this.model,hidden:this.model.getUnopenedBookmarks().length&&!0,is_hidden:e=>!(!Qc.settings.get("hide_open_bookmarks")||!Vc.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=Vc.chatboxviews.get("controlbox");if(void 0!==e&&!Ld.rootContains(Vc.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||Pd.unescapeNode(Pd.getNodeFromJid(n))||n};Qc.rooms.open(n,r,!0)},removeBookmark:Vc.removeBookmarkViaEvent,toggleBookmarksList(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");Ld.hasClass("fa-caret-down",t)?(Ld.slideIn(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":Vc.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"),Ld.slideOut(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":Vc.OPENED}))}});Qc.listen.on("getHeadingButtons",(e,t)=>{if(Vc.allow_bookmarks&&e.model.get("type")===Vc.CHATROOMS_TYPE){const n=e.model.get("bookmarked"),r={i18n_title:wd(n?"Unbookmark this groupchat":"Bookmark this groupchat"),i18n_text:wd(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=Vc.checkBookmarksSupport().then(e=>e?r:"");return i>-1?[...t.slice(0,i),s,...t.slice(i)]:[s,...t]}return t}),Qc.listen.on("bookmarksInitialized",(async function(){await Qc.waitUntil("roomsPanelRendered"),Vc.bookmarksview=new Vc.BookmarksView({model:Vc.bookmarks}),Qc.trigger("bookmarkViewsInitialized")})),Qc.listen.on("chatRoomViewInitialized",e=>e.setBookmarkState())}});var zd=n(30),Fd=n.n(zd);const Bd=wc`<button type="button" class="btn btn-secondary" data-dismiss="modal">${wd("Close")}</button>`,qd=wc`<button type="button" class="close" data-dismiss="modal" aria-label="${wd("Close")}"><span aria-hidden="true">×</span></button>`;var Ud=e=>wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header ${e.level||""}">
<h5 class="modal-title">${e.title}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form converse-form--modal confirm" action="#">
<div class="form-group">
${e.messages.map(e=>wc`<p>${e}</p>`)}
</div>
${e.fields.map(e=>(e=>wc`
<div class="form-group">
<label>
${e.label||""}
<input type="text"
name="${e.name}"
class="${e.challenge_failed?"error":""} form-control form-control--labeled"
?required="${e.required}"
placeholder="${e.placeholder}" />
</label>
</div>
`)(e))}
<div class="form-group">
<button type="submit" class="btn btn-primary">${wd("OK")}</button>
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${wd("Cancel")}"/>
</div>
</form>
</div>
</div>
</div>
`;
/**
* @module converse-modal
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{sizzle:Hd}=sl.env,Vd=sl.env.utils;let Wd;const Gd=Md.extend({className:"modal",events:{"click .nav-item .nav-link":"switchTab"},initialize(){this.render(),this.el.setAttribute("tabindex","-1"),this.el.setAttribute("role","dialog"),this.el.setAttribute("aria-hidden","true");const e=this.el.querySelector(".modal-title").getAttribute("id");e&&this.el.setAttribute("aria-labelledby",e),this.insertIntoDOM();const t=Fd.a.Modal;this.modal=new t(this.el,{backdrop:!0,keyboard:!0}),this.el.addEventListener("hide.bs.modal",()=>Vd.removeClass("selected",this.trigger_el),!1)},insertIntoDOM(){Wd.chatboxviews.el.querySelector("#converse-modals").insertAdjacentElement("beforeEnd",this.el)},switchTab(e){e.stopPropagation(),e.preventDefault(),Hd(".nav-link.active",this.el).forEach(e=>{Vd.removeClass("active",this.el.querySelector(e.getAttribute("href"))),Vd.removeClass("active",e)}),Vd.addClass("active",e.target),Vd.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 Dn.error("Could not find a .modal-alert element in the modal to show an alert message in!");var r;bc(wc`<div class="alert ${(r={type:"alert-"+t,message:e}).type}" role="alert"><p>${r.message}</p></div>`,n);const i=n.firstElementChild;setTimeout(()=>{Vd.addClass("fade-out",i),setTimeout(()=>Vd.removeElement(i),600)},5e3)},show(e){e&&(e.preventDefault(),this.trigger_el=e.target,this.trigger_el.classList.add("selected")),this.modal.show()}});sl.env.BootstrapModal=Gd;const Jd=Gd.extend({events:{"submit .confirm":"onConfimation"},initialize(){this.confirmation=Vd.getResolveablePromise(),Gd.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.el.addEventListener("closed.bs.modal",()=>this.confirmation.reject(),!1)},toHTML(){return Ud(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()}}),Qd=Gd.extend({initialize(){Gd.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){return e=Object.assign({__:wd},this.model.toJSON()),wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header ${e.level}">
<h5 class="modal-title">${e.title}</h5>
${qd}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
${e.messages.map(e=>wc`<p>${e}</p>`)}
</div>
</div>
</div>
`;var e}});sl.plugins.add("converse-modal",{initialize(){let e;Wd=this._converse,Wd.api.listen.on("disconnect",()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")}),Object.assign(Wd.api,{async confirm(e,t=[],n=[]){"string"==typeof t&&(t=[t]);const r=new Bs({title:e,messages:t,fields:n,type:"confirm"}),i=new Jd({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 Bs({title:e,messages:t,fields:[{name:"reason",placeholder:n}],type:"prompt"}),i=new Jd({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(t,n,r){let i;if("string"==typeof r&&(r=[r]),"error"===t?i="alert-danger":"info"===t?i="alert-info":"warn"===t&&(i="alert-warning"),void 0===e){const t=new Bs({title:n,messages:r,level:i,type:"alert"});e=new Qd({model:t})}else e.model.set({title:n,messages:r,level:i});e.show()}})}});var Yd=Gd.extend({toHTML(){return e={src:this.src,onload:e=>e.target.parentElement.style.height=e.target.height+"px"},wc`
<div class="modal-dialog fit-content" role="document">
<div class="modal-content fit-content">
<div class="modal-header">
<h4 class="modal-title" id="message-versions-modal-label">${wd("Image: ")}<a target="_blank" rel="noopener" href="${e.src}">${e.src}</a></h4>
${qd}
</div>
<div class="modal-body modal-body--image fit-content">
<img class="chat-image" src="${e.src}" @load=${e.onload}>
</div>
<div class="modal-footer">${Bd}</div>
</div>
</div>`;var e}});class Kd extends Lc{constructor(){super(),Object.assign(this,bi)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.stopListening()}}var Xd=n(31),Zd=n.n(Xd);
/**
* @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 eh=new WeakMap,th=Ka((...e)=>t=>{let n=eh.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},eh.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(sc(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())}))}}),nh=sl.env.utils;class rh extends String{constructor(e){super(e),this.references=[]}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 Tl(e.replace(/\n\n+/g,"\n\n"))}marshall(){let e=[this.toString()];this.references.sort((e,t)=>t.begin-e.begin).forEach(t=>{const n=e.shift();e=[n.slice(0,t.begin),t.template,n.slice(t.end),...e]}),this.isMeCommand()&&(e[0]=e[0].substring(4));return e.reduce((e,t)=>"string"==typeof t?[...e,rh.replaceText(t)]:[...e,t],[])}}function ih(e,t){var n;if(!t.collection)return void Dn.debug("addReferences: ignoring dangling model");const r=t.collection.chatbox.get("nick");null===(n=t.get("references"))||void 0===n||n.forEach(t=>{const n=e.slice(t.begin,t.end);n===r?e.addTemplateResult(t.begin,t.end,wc`<span class="mention mention--self badge badge-info">${{mention:n}.mention}</span>`):e.addTemplateResult(t.begin,t.end,(e=>wc`<span class="mention">${e.mention}</span>`)({mention:n}))})}class sh{constructor(e){var t;this.model=e.model,this.component=e,this.chatview=null===(t=nh.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=new rh(this.text);return await Qc.trigger("beforeMessageBodyTransformed",this.model,e,{Synchronous:!0}),function(e,t,n){const r=[];try{const t={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi};Zd.a.withinString(e,(e,t,n)=>(r.push({url:e,start:t,end:n}),e),t)}catch(e){return void Dn.debug(e)}const i=Qc.settings.get("show_images_inline");r.forEach(r=>{const s=e.slice(r.start,r.end),o=nh.filterQueryParamsFromURL(s);e.addTemplateResult(r.start,r.end,i&&nh.isImageURL(s)&&nh.isImageDomainAllowed(s)?nh.convertToImageTag(o,t,n):nh.convertUrlToHyperlink(o))})}(e,()=>this.scrollDownOnImageLoad(),e=>this.component.showImageModal(e)),function(e){const t=/geo:([\-0-9.]+),([\-0-9.]+)(?:,([\-0-9.]+))?(?:\?(.*))?/g,n=e.matchAll(t);for(const r of n)e.addTemplateResult(r.index,r.index+r.input.length,nh.convertUrlToHyperlink(r.input.replace(t,Vc.geouri_replacement)))}(e),await async function(e){await Qc.emojis.initialize(),[...Nl(e.toString()),...Il(e.toString())].forEach(t=>{e.addTemplateResult(t.begin,t.end,Ol(t,{add_title_wrapper:!0}))})}(e),ih(e,this.model),await Qc.trigger("afterMessageBodyTransformed",this.model,e,{Synchronous:!0}),e.marshall()}render(){return wc`${th(this.transform(),wc`${this.text}`)}`}}const oh=Ka(e=>t=>{var n;const r=new sh(e);t.setValue(r.render());const i=e.model;null===(n=i.collection)||void 0===n||n.trigger("rendered",i)});Qc.elements.define("converse-chat-message-body",class extends Kd{static get properties(){return{model:{type:Object},is_me_message:{type:Boolean},text:{type:String}}}showImageModal(e){e.preventDefault(),void 0===this.image_modal&&(this.image_modal=new Yd),this.image_modal.src=e.target.src,this.image_modal.render(),this.image_modal.show(e)}render(){return oh(this)}});var ah=e=>wc`<a target="_blank" rel="noopener" href="${e.url}">${e.label_download}</a>`,ch=n(166),lh=n.n(ch),uh=n(167),dh=n.n(uh),hh=n(61),fh=n.n(hh),ph=n(168),gh=n.n(ph),mh=n(169),vh=n.n(mh),_h=n(170),bh=n.n(_h),yh=n(62),wh=n.n(yh);const Sh=Ka((e,t,n,r)=>i=>{i.setValue(wc`<a href="${t}"
class="chat-image__link"
target="_blank"
rel="noopener"
><img class="chat-image img-thumbnail" src="${e}" @click=${r} @error=${function(){const s=sl.env.utils;s.isURLWithImageExtension(e)?(i.setValue(s.convertUrlToHyperlink(t)),i.commit()):(i.setValue(Sh(e+".png",t,n,r)),i.commit())}} @load=${n}/></a>`)});var xh=n(171),Eh=n.n(xh);
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the DOM/HTML utilities module.
*/
const{sizzle:Ah}=sl.env,Ch=["http","https","xmpp","mailto"];function kh(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":null!=t&&t.new_password?"new-password":"current-password"}[e]}const jh={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"};function Th(e){try{return e instanceof Zd.a?e:new Zd.a(e)}catch(e){return Dn.debug(e),null}}function Oh(e,t){const n=Th(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 Nh(e){try{return decodeURI(e.filename())}catch(t){return Dn.debug(t),e.filename()}}function Ih(e,t){const{__:n}=e;return r={url:t.toString(),label_download:n('Download audio file "%1$s"',Nh(t))},wc`
<audio controls src="${r.url}"></audio>
<a target="_blank" rel="noopener" href="${r.url}">${r.label_download}</a>
`;var r}function Mh(e,t){e.classList.remove("visible"),M(t)&&t()}Js.isAudioURL=e=>Oh([".ogg",".mp3",".m4a"],e),Js.isVideoURL=e=>Oh([".mp4",".webm"],e),Js.isURLWithImageExtension=e=>Oh([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".svg"],e),Js.isImageURL=e=>{const t=Qc.settings.get("image_urls_regex");return(null==t?void 0:t.test(e))||Js.isURLWithImageExtension(e)},Js.isImageDomainAllowed=e=>{const t=Qc.settings.get("show_images_inline");if(!Array.isArray(t))return!0;try{const n=Th(e).domain();return t.includes(n)}catch(e){return Dn.debug(e),!0}},Js.getOOBURLMarkup=function(e,t){const n=Th(t);return null===n?t:Js.isVideoURL(n)?wc`<video controls preload="metadata" src="${{url:t}.url}" style="max-height: 50vh"></video>`:Js.isAudioURL(n)?Ih(e,n):Js.isImageURL(n)?function(e,t){const{__:n}=e;return ah({url:t.toString(),label_download:n('Download image file "%1$s"',Nh(t))})}(e,n):function(e,t){const{__:n}=e;return ah({url:t.toString(),label_download:n('Download file "%1$s"',Nh(t))})}(e,n)},Js.applyDragResistance=function(e,t){if(void 0===e)return;if(void 0===t)return e;return e!==t&&Math.abs(e-t)<10?t:e},Js.calculateElementHeight=function(e){return Array.from(e.children).reduce((e,t)=>e+t.offsetHeight,0)},Js.getNextElement=function(e,t="*"){let n=e.nextElementSibling;for(;null!==n&&!Ah.matchesSelector(n,t);)n=n.nextElementSibling;return n},Js.getPreviousElement=function(e,t="*"){let n=e.previousElementSibling;for(;null!==n&&!Ah.matchesSelector(n,t);)n=n.previousElementSibling;return n},Js.getFirstChildElement=function(e,t="*"){let n=e.firstElementChild;for(;null!==n&&!Ah.matchesSelector(n,t);)n=n.nextElementSibling;return n},Js.getLastChildElement=function(e,t="*"){let n=e.lastElementChild;for(;null!==n&&!Ah.matchesSelector(n,t);)n=n.previousElementSibling;return n},Js.hasClass=function(e,t){return t instanceof Element&&t.classList.contains(e)},Js.toggleClass=function(e,t){Js.hasClass(e,t)?Js.removeClass(e,t):Js.addClass(e,t)},Js.addClass=function(e,t){return t instanceof Element&&t.classList.add(e),t},Js.removeClass=function(e,t){return t instanceof Element&&t.classList.remove(e),t},Js.removeElement=function(e){return e instanceof Element&&e.parentNode&&e.parentNode.removeChild(e),e},Js.getElementFromTemplateResult=function(e){const t=document.createElement("div");return bc(e,t),t.firstElementChild},Js.showElement=e=>{Js.removeClass("collapsed",e),Js.removeClass("hidden",e)},Js.hideElement=function(e){return e instanceof Element&&e.classList.add("hidden"),e},Js.ancestor=function(e,t){let n=e;for(;null!==n&&!Ah.matchesSelector(n,t);)n=n.parentElement;return n},Js.nextUntil=function(e,t){const n=[];let r=e.nextElementSibling;for(;null!==r&&!r.matches(t);)n.push(r),r=r.nextElementSibling;return n},Js.unescapeHTML=function(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText},Js.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},Js.convertToImageTag=function(e,t,n){return wc`${Sh((r={url:e,onClick:n,onLoad:t}).url,r.url,r.onLoad,r.onClick)}`;var r},Js.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?wc`
<a target="_blank"
rel="noopener"
@click=${e=>Qc.rooms.open(e.target.href)}
href="${n}">${i}</a>`:wc`<a target="_blank" rel="noopener" href="${n}">${i}</a>`},Js.convertUrlToHyperlink=function(e){const t=RegExp("^w{3}.","ig").test(e)?"http://"+e:e,n=Th(e);return null===n||!function(e){try{return!!new URL(e)}catch(e){return!1}}(t)||!function(e,t=Ch){return!!t.includes(e)}(n._parts.protocol)&&n._parts.protocol?e:this.convertURIoHyperlink(n,e)},Js.filterQueryParamsFromURL=function(e){const t=Qc.settings.get("filter_url_query_params");if(!t)return e;return Th(e).removeQuery(t).toString()},Js.addHyperlinks=function(e){const t=[],n={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi};try{Zd.a.withinString(e,(e,n,r)=>(t.push({url:e,start:n,end:r}),e),n)}catch(t){return Dn.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),Js.convertUrlToHyperlink(n),t.slice(e.end),...r]}):r=[e],r},Js.httpToGeoUri=function(e,t){return e.replace(t.api.settings.get("geouri_regex"),"geo:$1,$2")},Js.slideInAllElements=function(e,t=300){return Promise.all(Array.from(e).map(e=>Js.slideIn(e,t)))},Js.slideToggleElement=function(e,t){return Js.hasClass("collapsed",e)||Js.hasClass("hidden",e)?Js.slideOut(e,t):Js.slideIn(e,t)},Js.slideOut=function(e,t=200){return new Promise((n,r)=>{if(!e){const e="An element needs to be passed in to slideOut";return Dn.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=Js.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(!Js.hasClass("collapsed",e)&&!Js.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=Js.calculateElementHeight(e)+"px",e.style.overflow="",e.style.height="",n())})))})},Js.slideIn=function(e,t=200){return new Promise((n,r)=>{if(!e){const e="An element needs to be passed in to slideIn";return Dn.warn(e),r(new Error(e))}if(Js.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))})))})},Js.isInDOM=function(e){return document.querySelector("body").contains(e)},Js.isVisible=function(e){return null!==e&&(!Js.hasClass("hidden",e)&&(e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0))},Js.fadeIn=function(e,t){if(e||Dn.warn("An element needs to be passed in to fadeIn"),window.converse_disable_effects)return e.classList.remove("hidden"),Mh(e,t);Js.hasClass("hidden",e)?(e.classList.add("visible"),e.classList.remove("hidden"),e.addEventListener("webkitAnimationEnd",()=>Mh(e,t)),e.addEventListener("animationend",()=>Mh(e,t)),e.addEventListener("oanimationend",()=>Mh(e,t))):Mh(e,t)},Js.xForm2webForm=function(e,t,n){if("list-single"===e.getAttribute("type")||"list-multi"===e.getAttribute("type")){const t=Js.queryChildren(e,"value").map(e=>null==e?void 0:e.textContent),n=Js.queryChildren(e,"option").map(n=>{var r;const i=null===(r=n.querySelector("value"))||void 0===r?void 0:r.textContent;return Eh()({value:i,label:n.getAttribute("label"),selected:t.includes(i),required:!!e.querySelector("required")})});return gh()({id:Js.getUniqueId(),name:e.getAttribute("var"),label:e.getAttribute("label"),options:n.join(""),multiple:"list-multi"===e.getAttribute("type"),required:!!e.querySelector("required")})}if("fixed"===e.getAttribute("type")){var r;return'<p class="form-help">'+(null===(r=e.querySelector("value"))||void 0===r?void 0:r.textContent)+"</p>"}var i,s,o;if("jid-multi"===e.getAttribute("type"))return vh()({name:e.getAttribute("var"),label:e.getAttribute("label")||"",value:null===(i=e.querySelector("value"))||void 0===i?void 0:i.textContent,required:!!e.querySelector("required")});if("boolean"===e.getAttribute("type")){var a;const t=null===(a=e.querySelector("value"))||void 0===a?void 0:a.textContent;return dh()({id:Js.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 bh()({label:e.getAttribute("label")||"",value:null===(s=e.querySelector("value"))||void 0===s?void 0:s.textContent});if("username"===e.getAttribute("var"))return wh()({domain:" @"+n.domain,name:e.getAttribute("var"),type:jh[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=Ah('data[cid="'+n.textContent.replace(/^cid:/,"")+'"]',t)[0];return lh()({label:e.getAttribute("label"),name:e.getAttribute("var"),data:null==r?void 0:r.textContent,type:n.getAttribute("type"),required:!!e.querySelector("required")})}{var c;const t=e.getAttribute("var");return fh()({id:Js.getUniqueId(),label:e.getAttribute("label")||"",name:t,fixed_username:null==n?void 0:n.fixed_username,autocomplete:kh(t,n),placeholder:null,required:!!e.querySelector("required"),type:jh[e.getAttribute("type")],value:null===(c=e.querySelector("value"))||void 0===c?void 0:c.textContent})}};var Rh=Js;const{keycodes:$h}=sl;function Dh(e){let t=0;do{isNaN(e.offsetTop)||(t+=e.offsetTop)}while(e=e.offsetParent);return t}function Ph(e){let t=0;do{isNaN(e.offsetLeft)||(t+=e.offsetLeft)}while(e=e.offsetParent);return t}class Lh{static get DIRECTION(){return{down:"down",end:"end",home:"home",left:"left",right:"right",up:"up"}}static get DEFAULTS(){return{home:[`${$h.SHIFT}+${$h.UP_ARROW}`],end:[`${$h.SHIFT}+${$h.DOWN_ARROW}`],up:[$h.UP_ARROW],down:[$h.DOWN_ARROW],left:[$h.LEFT_ARROW,`${$h.SHIFT}+${$h.TAB}`],right:[$h.RIGHT_ARROW,$h.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({},Lh.DEFAULTS,t),this.init()}init(){this.selected=null,this.keydownHandler=null,this.elements={},this.keys={},this.options.down.forEach(e=>this.keys[e]=Lh.DIRECTION.down),this.options.end.forEach(e=>this.keys[e]=Lh.DIRECTION.end),this.options.home.forEach(e=>this.keys[e]=Lh.DIRECTION.home),this.options.left.forEach(e=>this.keys[e]=Lh.DIRECTION.left),this.options.right.forEach(e=>this.keys[e]=Lh.DIRECTION.right),this.options.up.forEach(e=>this.keys[e]=Lh.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===Lh.DIRECTION.home)t=this.getElements(e)[0];else if(e===Lh.DIRECTION.end)t=Array.from(this.getElements(e)).pop();else if(this.selected)if(e===Lh.DIRECTION.right){const n=this.getElements(e);t=n.slice(n.indexOf(this.selected))[1]}else if(e==Lh.DIRECTION.left){const n=this.getElements(e);t=n.slice(0,n.indexOf(this.selected)).pop()||this.selected}else if(e==Lh.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=Lh.getClosestElement(r,i)}else{if(e!=Lh.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=Lh.getClosestElement(r,i)}}else t=e===Lh.DIRECTION.right||e===Lh.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():Rh.addClass(this.options.selected,e),this.selected=e,this.options.onSelected&&this.options.onSelected(e))}unselect(){this.selected&&(Rh.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 Lh.DIRECTION.left:document.body.scrollLeft=Ph(e)-document.body.offsetLeft;break;case Lh.DIRECTION.up:document.body.scrollTop=Dh(e)-document.body.offsetTop;break;case Lh.DIRECTION.right:document.body.scrollLeft=Ph(e)-document.body.offsetLeft-(document.documentElement.clientWidth-e.offsetWidth);break;case Lh.DIRECTION.down:document.body.scrollTop=Dh(e)-document.body.offsetTop-(document.documentElement.clientHeight-e.offsetHeight)}}else{const n=this.scroll_container;if(!n.contains(e))return;switch(t){case Lh.DIRECTION.left:n.scrollLeft=e.offsetLeft-n.offsetLeft,n.scrollTop=e.offsetTop-n.offsetTop;break;case Lh.DIRECTION.up:n.scrollTop=e.offsetTop-n.offsetTop;break;case Lh.DIRECTION.right:n.scrollLeft=e.offsetLeft-n.offsetLeft-(n.offsetWidth-e.offsetWidth),n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight);break;case Lh.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(Lh.DIRECTION.down).filter(n=>n.offsetLeft>=e&&n.offsetTop>=t)}elementsBefore(e,t){return this.getElements(Lh.DIRECTION.up).filter(n=>n.offsetLeft<=e&&n.offsetTop<=t)}handleKeydown(e){const t=$h,n=e.shiftKey?this.keys[`${t.SHIFT}+${e.which}`]:this.keys[e.which];if(n){e.preventDefault(),e.stopPropagation();const t=this.getNextElement(n,e);this.select(t,n)}}}var zh=Lh;const Fh=sl.env.utils;class Bh extends Kd{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;Fh.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(){Fh.addClass("show",this.menu),this.button.setAttribute("aria-expanded",!0)}toggleMenu(e){e.preventDefault(),Fh.hasClass("show",this.menu)?this.hideMenu():this.showMenu()}handleKeyUp(e){e.keyCode===sl.keycodes.ESCAPE?this.hideMenu():e.keyCode===sl.keycodes.DOWN_ARROW&&this.navigator&&!this.navigator.enabled&&this.enableArrowNavigation(e)}}Qc.elements.define("converse-dropdown",class extends Bh{static get properties(){return{icon_classes:{type:String},items:{type:Array}}}render(){const e=this.icon_classes||"fa fa-bars";return wc`
<div class="dropleft">
<button type="button" class="btn btn--transparent btn--standalone" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="${e} only-icon"></i>
</button>
<div class="dropdown-menu">
${this.items.map(e=>th(e,""))}
</div>
</div>
`}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 zh(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!==sl.keycodes.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}});class qh extends Kd{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 wc`${th(this.renderActions(),"")}`}static getActionsDropdownItem(e){return wc`
<button class="chat-msg__action ${e.button_class}" @click=${e.handler}>
<converse-icon class="${e.icon_class}"
path-prefix="${Qc.settings.get("assets_path")}"
color="var(--text-color-lighten-15-percent)"
size="1em"></converse-icon>
${e.i18n_text}
</button>
`}onMessageEditButtonClicked(e){e.preventDefault(),this.chatview.onMessageEditButtonClicked(this.model)}onMessageRetractButtonClicked(e){e.preventDefault(),this.chatview.onMessageRetractButtonClicked(this.model)}async renderActions(){const e=[];this.editable&&e.push({i18n_text:this.correcting?wd("Cancel Editing"):wd("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();!this.is_retracted&&(this.model.mayBeRetracted()||t)&&e.push({i18n_text:wd("Retract"),handler:e=>this.onMessageRetractButtonClicked(e),button_class:"chat-msg__action-retract",icon_class:"fas fa-trash-alt",name:"retract"});const n=e.map(e=>qh.getActionsDropdownItem(e));return n.length?wc`<converse-dropdown class="chat-msg__actions" .items=${n}></converse-dropdown>`:""}}Qc.elements.define("converse-message-actions",qh);var Uh=Gd.extend({id:"message-versions-modal",toHTML(){return e=this.model.toJSON(),wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="message-versions-modal-label">${wd("Message versions")}</h4>
${qd}
</div>
<div class="modal-body">
<h4>Older versions</h4>
${Object.keys(e.older_versions).map(t=>wc`<p class="older-msg"><time>${Sn()(t).format("MMM D, YYYY, HH:mm:ss")}</time>: ${e.older_versions[t]}</p>`)}
<hr/>
<h4>Current version</h4>
<p>${e.message}</p>
</div>
<div class="modal-footer">${Bd}</div>
</div>
</div>
`;var e}});var Hh=e=>{return wc`
<svg xmlns="http://www.w3.org/2000/svg" class="avatar ${e.classes}" width="${e.width}" height="${e.height}">
<image width="${e.width}" height="${e.height}" preserveAspectRatio="xMidYMid meet" href="${t=e.image,n=e.image_type,t.startsWith("data:")?t:`data:${n};base64,${t}`}"/>
</svg>`;var t,n};const Vh=Ka(e=>t=>{const n={classes:e.classes?e.classes+" avatar":"avatar",height:e.width||36,image:e.image,image_type:e.image_type,width:e.height||36};t.setValue(Hh(n))});var Wh=(e={})=>wc`<span class="spinner fa fa-spinner centered ${e.classes||""}"/>`;const{Strophe:Gh}=sl.env,Jh=sl.env.utils;class Qh extends Kd{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=Qc.settings.get("time_format");return this.pretty_time=Sn()(this.edited||this.time).format(e),this.show_spinner?Wh():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,af(t,this.model)),Object.keys(e.changed).filter(e=>Object.keys(Qh.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=Sn()(this.model.get("time")).toISOString(),t=wd("Retry");return wc`
<div class="message chat-info chat-${this.message_type}"
data-isodate="${e}"
data-type="${this.data_name}"
data-value="${this.data_value}">
<div class="chat-info__message">
${this.model.getMessageText()}
</div>
${this.reason?wc`<q class="reason">${this.reason}</q>`:""}
${this.error_text?wc`<q class="reason">${this.error_text}</q>`:""}
${this.retry_event_id?wc`<a class="retry" @click=${this.onRetryClicked}>${t}</a>`:""}
</div>
`}renderFileProgress(){const e=wd("Uploading file:"),t=this.model.file.name,n=hl()(this.model.file.size);return wc`
<div class="message chat-msg">
${Vh(this.getAvatarData())}
<div class="chat-msg__content">
<span class="chat-msg__text">${e} <strong>${t}</strong>, ${n}</span>
<progress value="${this.progress}"/>
</div>
</div>`}renderChatMessage(){return(e=>{const t=wd("New messages");return wc`
${e.is_first_unread?wc`<div class="message separator"><hr class="separator"><span class="separator-text">${t}</span></div>`:""}
<div class="message chat-msg ${e.getExtraMessageClasses()}"
data-isodate="${e.time}"
data-msgid="${e.msgid}"
data-from="${e.from}"
data-encrypted="${e.is_encrypted}">
<!-- Anchor to allow us to scroll the message into view -->
<a id="${e.msgid}"></a>
${e.shouldShowAvatar()?Vh(e.getAvatarData()):""}
<div class="chat-msg__content chat-msg__content--${e.sender} ${e.is_me_message?"chat-msg__content--action":""}">
${e.is_me_message?"":wc`
<span class="chat-msg__heading">
<span class="chat-msg__author">${e.username}</span>
${e.renderAvatarByline()}
${e.is_encrypted?wc`<span class="fa fa-lock"></span>`:""}
</span>`}
<div class="chat-msg__body chat-msg__body--${e.message_type} ${e.received?"chat-msg__body--received":""} ${e.is_delayed?"chat-msg__body--delayed":""}">
<div class="chat-msg__message">
${e.is_me_message?wc`
<time timestamp="${e.edited||e.time}" class="chat-msg__time">${e.pretty_time}</time>&nbsp;
<span class="chat-msg__author">${e.is_me_message?"**":""}${e.username}</span>&nbsp;`:""}
${e.is_retracted?e.renderRetraction():e.renderMessageText()}
</div>
<converse-message-actions
.chatview=${e.chatview}
.model=${e.model}
?correcting="${e.correcting}"
?editable="${e.editable}"
?is_retracted="${e.is_retracted}"
message_type="${e.message_type}"></converse-message-actions>
</div>
</div>
</div>`})(this)}shouldShowAvatar(){return Qc.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"))||Vc.DEFAULT_IMAGE_TYPE)+";base64,"+((null===(t=this.model.vcard)||void 0===t?void 0:t.get("image"))||Vc.DEFAULT_IMAGE)}}async onRetryClicked(){this.show_spinner=!0,await Qc.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=Sn()(this.time);return this.from===n.get("from")&&!this.is_me_message&&!n.isMeCommand()&&"info"!==this.message_type&&"info"!==n.get("type")&&r.isBefore(Sn()(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:Gh.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return wd("%1$s has removed this message",n)}return wd("%1$s has removed this message",this.model.getDisplayName())}renderRetraction(){const e=this.is_retracted?this.getRetractionText():null;return wc`
<div>${e}</div>
${this.moderation_reason?wc`<q class="chat-msg--retracted__reason">${this.moderation_reason}</q>`:""}
`}renderMessageText(){const e=wd("This message has been edited"),t=wd("Show more"),n="groupchat"===this.message_type,r=wd("Show less"),i=wc`
<div class="chat-msg__spoiler-hint">
<span class="spoiler-hint">${this.spoiler_hint}</span>
<a class="badge badge-info spoiler-toggle" href="#" @click=${this.toggleSpoilerMessage}>
<i class="fa ${this.is_spoiler_visible?"fa-eye-slash":"fa-eye"}"></i>
${this.is_spoiler_visible?r:t}
</a>
</div>
`,s=this.is_spoiler?"spoiler "+(this.is_spoiler_visible?"":"hidden"):"";return wc`
${this.is_spoiler?i:""}
${this.subject?wc`<div class="chat-msg__subject">${this.subject}</div>`:""}
<span>
<converse-chat-message-body
class="chat-msg__text ${this.is_only_emojis?"chat-msg__text--larger":""} ${s}"
.model="${this.model}"
?is_me_message="${this.is_me_message}"
?is_only_emojis="${this.is_only_emojis}"
?is_spoiler="${this.is_spoiler}"
?is_spoiler_visible="${this.is_spoiler_visible}"
text="${this.model.getMessageText()}"></converse-chat-message-body>
${!this.received||this.is_me_message||n?"":wc`<span class="fa fa-check chat-msg__receipt"></span>`}
${this.edited?wc`<i title="${e}" class="fa fa-edit chat-msg__edit-modal" @click=${this.showMessageVersionsModal}></i>`:""}
</span>
${this.oob_url?wc`<div class="chat-msg__media">${Jh.getOOBURLMarkup(Vc,this.oob_url)}</div>`:""}
<div class="chat-msg__error">${this.error_text||this.error}</div>
`}renderAvatarByline(){return wc`
${this.hats.map(e=>wc`<span class="badge badge-secondary">${e.title}</span>`)}
<time timestamp="${this.edited||this.time}" class="chat-msg__time">${this.pretty_time}</time>
`}showMessageVersionsModal(e){e.preventDefault(),void 0===this.message_versions_modal&&(this.message_versions_modal=new Uh({model:this.model})),this.message_versions_modal.show(e)}toggleSpoilerMessage(e){null==e||e.preventDefault(),this.model.save({is_spoiler_visible:!this.model.get("is_spoiler_visible")})}}Qc.elements.define("converse-chat-message",Qh);
/**
* @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 Yh=(e,t)=>{const n=e.startNode.parentNode,r=void 0===t?e.endNode:t.startNode,i=n.insertBefore(Va(),r);n.insertBefore(Va(),r);const s=new lc(e.options);return s.insertAfterNode(i),s},Kh=(e,t)=>(e.setValue(t),e.commit(),e),Xh=(e,t,n)=>{const r=e.startNode.parentNode,i=n?n.startNode:e.endNode,s=t.endNode.nextSibling;s!==i&&Pa(r,t.startNode,s,i)},Zh=e=>{La(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},ef=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},tf=new WeakMap,nf=new WeakMap,rf=Ka((e,t,n)=>{let r;return void 0===n?n=t:void 0!==t&&(r=t),t=>{if(!(t instanceof lc))throw new Error("repeat can only be used in text bindings");const i=tf.get(t)||[],s=nf.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,g=a.length-1;for(;h<=f&&p<=g;)if(null===i[h])h++;else if(null===i[f])f--;else if(s[h]===c[p])o[p]=Kh(i[h],a[p]),h++,p++;else if(s[f]===c[g])o[g]=Kh(i[f],a[g]),f--,g--;else if(s[h]===c[g])o[g]=Kh(i[h],a[g]),Xh(t,i[h],o[g+1]),h++,g--;else if(s[f]===c[p])o[p]=Kh(i[f],a[p]),Xh(t,i[f],i[h]),f--,p++;else if(void 0===l&&(l=ef(c,p,g),u=ef(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=Yh(t,i[h]);Kh(e,a[p]),o[p]=e}else o[p]=Kh(n,a[p]),Xh(t,n,i[h]),i[e]=null;p++}else Zh(i[f]),f--;else Zh(i[h]),h++;for(;p<=g;){const e=Yh(t,o[g+1]);Kh(e,a[p]),o[p++]=e}for(;h<=f;){const e=i[h++];null!==e&&Zh(e)}tf.set(t,o),nf.set(t,c)}}),sf=wd("No message history available.");function of(e){const t=e.collection.models,n=t.indexOf(e),r=t[n-1];if(!r||Sn()(e.get("time")).isAfter(Sn()(r.get("time")),"day")){const t=Sn()(e.get("time")).startOf("day");return i={type:"date",time:t.toISOString(),datestring:t.format("dddd MMM Do YYYY")},wc`
<div class="message date-separator" data-isodate="${i.time}">
<hr class="separator"/>
<time class="separator-text" datetime="${i.time}"><span>${i.datestring}</span></time>
</div>
`}var i}function af(e,t){return{has_mentions:"groupchat"===t.get("type")&&"them"===t.get("sender")&&e.isUserMentioned(t),hats:Vc.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()}}Vc.getHats=function(e){if("groupchat"===e.get("type")){var t;const n=Qc.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[]};Qc.elements.define("converse-message-history",class extends Kd{static get properties(){return{chatview:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?wc`${rf(e,e=>e.get("id"),e=>this.renderMessage(e))}`:wc`<div class="empty-history-feedback form-help"><span>${sf}</span></div>`}renderMessage(e){if(e.get("dangling_retraction")||e.get("is_only_key"))return"";const t=of(e);var n;return[...t?[t]:[],(n=Object.assign(e.toJSON(),af(this.chatview.model,e),{chatview:this.chatview,model:e}),wc`
<converse-chat-message
.chatview=${n.chatview}
.hats=${n.hats}
.model=${n.model}
?correcting=${n.correcting}
?editable=${n.editable}
?has_mentions=${n.has_mentions}
?is_delayed=${n.is_delayed}
?is_encrypted=${!!n.is_encrypted}
?is_first_unread=${n.is_first_unread}
?is_me_message=${n.is_me_message}
?is_only_emojis=${n.is_only_emojis}
?is_retracted=${n.is_retracted}
?is_spoiler=${n.is_spoiler}
?is_spoiler_visible=${n.is_spoiler_visible}
?retractable=${n.retractable}
edited=${n.edited||""}
error=${n.error||""}
error_text=${n.error_text||""}
filename=${n.filename||""}
filesize=${n.filesize||""}
from=${n.from}
message_type=${n.type||""}
moderated_by=${n.moderated_by||""}
moderation_reason=${n.moderation_reason||""}
msgid=${n.msgid}
occupant_affiliation=${n.model.occupant?n.model.occupant.get("affiliation"):""}
occupant_role=${n.model.occupant?n.model.occupant.get("role"):""}
oob_url=${n.oob_url||""}
pretty_type=${n.pretty_type}
progress=${n.progress||0}
reason=${n.reason||""}
received=${n.received||""}
retry_event_id=${n.retry_event_id||""}
sender=${n.sender}
spoiler_hint=${n.spoiler_hint||""}
subject=${n.subject||""}
time=${n.time}
username=${n.username}></converse-chat-message>
`)]}});var cf=n(14),lf=n.n(cf);
/**
* @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 uf=new WeakMap,df=Ka(e=>t=>{if(!(t instanceof lc))throw new Error("unsafeHTML can only be used in text bindings");const n=uf.get(t);if(void 0!==n&&sc(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),uf.set(t,{value:e,fragment:i})});Qc.elements.define("converse-chat-content",class extends Kd{static get properties(){return{chatview:{type:Object},messages:{type:Array},notifications:{type:String}}}render(){const e=lf.a.filterXSS(this.notifications,{whiteList:{}});return wc`
<converse-message-history
.chatview=${this.chatview}
.messages=${this.messages}>
</converse-message-history>
<div class="chat-content__notifications">${df(e)}</div>
`}});customElements.define("converse-icon",
/**
* @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)
*/
class extends Kd{static get properties(){return{color:String,class_name:{attribute:"class"},style:String,size:String}}static get styles(){return Dc`
:host {
display: inline-block;
padding: 0;
margin: 0;
}
`}constructor(){super(),this.class_name="",this.style="",this.size="",this.color=""}getSource(){return"#icon-"+this.class_name.split(" ")[1].replace("fa-","")}getStyles(){return`\n ${this.size?`width: ${this.size};`:""}\n ${this.size?`height: ${this.size};`:""}\n ${this.color?`fill: ${this.color};`:""}\n ${this.style}\n `}render(){return wc`<svg .style="${this.getStyles()}"> <use href="${this.getSource()}"> </use> </svg>`}});Qc.elements.define("converse-chat-help",class extends Kd{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[wc`<converse-icon class="fas fa-times close-chat-help"
@click=${this.close}
path-prefix="${Qc.settings.get("assets_path")}"
size="1em"></converse-icon>`,...this.messages.map(t=>this.renderHelpMessage({isodate:e,markup:lf.a.filterXSS(t,{whiteList:{strong:[]}})}))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return wc`<div class="message chat-${this.type}" data-isodate="${e.isodate}">${df(e.markup)}</div>`}});const hf=sl.env.utils,ff=e=>{const t=Qc.settings.get("emoji_categories");return wc`<ul>${Object.keys(t).map(n=>t[n]?(e=>wc`
<li data-category="${e.category}"
class="emoji-category ${e.category} ${e.current_category===e.category?"picked":""}"
title="${wd(Vc.emoji_category_labels[e.category])}">
<a class="pick-category"
@click=${e.onCategoryPicked}
href="#emoji-picker-${e.category}"
data-category="${e.category}">${e.emoji} </a>
</li>
`)(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):"")}</ul>`},pf=e=>wc`
<li class="emoji insert-emoji ${e.shouldBeHidden(e.emoji.sn)?"hidden":""}" data-emoji="${e.emoji.sn}" title="${e.emoji.sn}">
<a href="#" @click=${e.insertEmoji} data-emoji="${e.emoji.sn}">${hf.shortnamesToEmojis(e.emoji.sn)}</a>
</li>
`,gf=e=>{const t=Qc.settings.get("emoji_categories");return wc`
<span ?hidden=${e.query} class="emoji-lists__container emoji-lists__container--browse">
${Object.keys(t).map(n=>t[n]?(e=>wc`
<a id="emoji-picker-${e.category}" class="emoji-category__heading" data-category="${e.category}">${wd(Qc.settings.get("emoji_category_labels")[e.category])}</a>
<ul class="emoji-picker" data-category="${e.category}">
${Object.values(sl.emojis.json[e.category]).map(t=>pf(Object.assign({emoji:t},e)))}
</ul>`)(Object.assign({category:n},e)):"")}
</span>`},mf=e=>{const t=wd("Search");return wc`
<div class="emoji-picker__header">
<input class="form-control emoji-search" name="emoji-search" placeholder="${t}"
.value=${e.query||""}
@keydown=${e.onSearchInputKeyDown}
@blur=${e.onSearchInputBlurred}
@focus=${e.onSearchInputFocus}>
${e.query?"":ff(e)}
</div>
${e.render_emojis?wc`<converse-emoji-picker-content
.chatview=${e.chatview}
.model=${e.model}
.search_results="${e.search_results}"
current_skintone="${e.current_skintone}"
query="${e.query}"></converse-emoji-picker-content>`:""}
<div class="emoji-skintone-picker">
<label>Skin tone</label>
<ul>${["tone1","tone2","tone3","tone4","tone5"].map(t=>(e=>wc`
<li data-skintone="${e.skintone}" class="emoji-skintone ${e.current_skintone===e.skintone?"picked":""}">
<a class="pick-skintone" href="#" data-skintone="${e.skintone}" @click=${e.onSkintonePicked}>${hf.shortnamesToEmojis(":"+e.skintone+":")}</a>
</li>`)(Object.assign({skintone:t},e)))}</ul>
</div>`},{sizzle:vf}=sl.env;Qc.elements.define("converse-emoji-picker-content",class extends Kd{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 wc`
<div class="emoji-picker__lists">
${(e=>{const t=wd("Search results");return wc`
<span ?hidden=${!e.query} class="emoji-lists__container emojis-lists__container--search">
<a id="emoji-picker-search-results" class="emoji-category__heading">${t}</a>
<ul class="emoji-picker">
${e.search_results.map(t=>pf(Object.assign({emoji:t},e)))}
</ul>
</span>
`})(e)}
${gf(e)}
</div>
`}firstUpdated(){this.initIntersectionObserver()}initIntersectionObserver(){if(window.IntersectionObserver){if(this.observer)this.observer.disconnect();else{const e={root:this.querySelector(".emoji-picker__lists"),threshold:[.1]},t=e=>this.setCategoryOnVisibilityChange(e);this.observer=new IntersectionObserver(t,e)}vf(".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&&sl.emojis.toned.includes(e))return!0;return!(!this.query||Vc.FILTER_CONTAINS(e,this.query))}});const _f=sl.env.utils;Qc.elements.define("converse-emoji-dropdown",class extends Bh{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await Qc.emojis.initialize();const e=`converse.emoji-${Vc.bare_jid}-${this.chatview.model.get("jid")}`;this.model=new Vc.EmojiPicker({id:e}),this.model.browserStorage=Vc.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 wc`
<div class="dropup">
<button class="toggle-emojis"
title="${wd("Insert emojis")}"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<converse-icon
class="fa fa-smile "
path-prefix="${Qc.settings.get("assets_path")}"
size="1em"></converse-icon>
</button>
<div class="dropdown-menu">
${th(this.initModel().then(()=>wc`
<converse-emoji-picker
.chatview=${this.chatview}
.model=${this.model}
?render_emojis=${this.render_emojis}
current_category="${this.model.get("current_category")||""}"
current_skintone="${this.model.get("current_skintone")||""}"
query="${this.model.get("query")||""}"
></converse-emoji-picker>`),"")}
</div>
</div>`}connectedCallback(){super.connectedCallback(),this.render_emojis=!1}toggleMenu(e){e.stopPropagation(),e.preventDefault(),_f.hasClass("show",this.menu)?_f.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()})}}),Qc.elements.define("converse-emoji-picker",class extends Kd{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=Ma(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 mf({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=>_f.shortnamesToEmojis(this.getTonedShortname(e))})}updated(e){e.has("query")&&this.updateSearchResults(e),e.has("current_category")&&this.setScrollPosition()}onModelChanged(e){"current_category"in e&&(this.current_category=e.current_category),"current_skintone"in e&&(this.current_skintone=e.current_skintone),"query"in e&&(this.query=e.query)}setScrollPosition(){if(this.preserve_scroll)return void(this.preserve_scroll=!1);const e=this.querySelector(".emoji-lists__container--browse"),t=this.querySelector("#emoji-picker-"+this.current_category);t&&(e.scrollTop=t.offsetTop-3*t.offsetHeight+4)}updateSearchResults(e){const t=e.get("query"),n=Vc.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=sl.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===sl.keycodes.ENTER&&this.navigator.selected&&_f.isVisible(this)?this.onEnterPressed(e):e.keyCode===sl.keycodes.DOWN_ARROW&&!this.navigator.enabled&&_f.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:_f.ancestor(e.target,"li");this.setCategoryForElement(t),this.navigator.select(t),!this.navigator.enabled&&this.navigator.enable()}onKeyDown(e){if(e.keyCode===sl.keycodes.TAB)if(e.target.value){e.preventDefault();const t=sl.emojis.shortnames.find(t=>Vc.FILTER_CONTAINS(t,e.target.value));t&&this.model.set({query:t})}else this.navigator.enabled||this.enableArrowNavigation(e);else e.keyCode!==sl.keycodes.DOWN_ARROW||this.navigator.enabled?e.keyCode===sl.keycodes.ENTER?this.onEnterPressed(e):e.keyCode===sl.keycodes.ESCAPE?(_f.ancestor(this,"converse-emoji-dropdown").hideMenu(),this.chatview.el.querySelector(".chat-textarea").focus(),e.stopPropagation(),e.preventDefault()):e.keyCode!==sl.keycodes.ENTER&&e.keyCode!==sl.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,sl.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 sl.emojis.toned.includes(e)&&this.current_skintone?`${e.slice(0,e.length-1)}_${this.current_skintone}:`:e}initArrowNavigation(){if(!this.navigator){const e="li:not(.hidden):not(.emoji-skintone), .emoji-search",t={jump_to_picked:".emoji-category",jump_to_picked_selector:".emoji-category.picked",jump_to_picked_direction:zh.DIRECTION.down,picked_selector:".picked",scroll_container:this.querySelector(".emoji-picker__lists"),getSelector:t=>{if(t===zh.DIRECTION.down){const t=this.navigator.selected&&this.navigator.selected.getAttribute("data-category");return t?`ul[data-category="${t}"] li:not(.hidden):not(.emoji-skintone), .emoji-search`:e}return e},onSelected:e=>{e.matches(".insert-emoji")&&this.setCategoryForElement(e.parentElement),e.matches(".insert-emoji, .emoji-category")&&e.firstElementChild.focus(),e.matches(".emoji-search")&&e.focus()}};this.navigator=new zh(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 bf=sl.env.Strophe;window.customElements.define("converse-chat-toolbar",class extends Kd{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=wd("Send the message");return wc`
${this.show_toolbar?wc`<span class="toolbar-buttons">${th(this.getButtons(),"")}</span>`:""}
${this.show_send_button?wc`<button type="submit" class="btn send-button fa fa-paper-plane" title="${e}"></button>`:""}
`}getButtons(){const e=[];if(this.show_emoji_button&&e.push(wc`<converse-emoji-dropdown .chatview=${this.chatview}></converse-dropdown>`),this.show_call_button){const t=wd("Start a call");e.push(wc`
<button class="toggle-call" @click=${this.toggleCall} title="${t}">
<converse-icon class="fa fa-phone" path-prefix="/dist" size="1em"></converse-icon>
</button>`)}const t=wd("Message characters remaining");Qc.settings.get("message_limit")&&e.push(wc`<span class="right message-limit" title="${t}">${this.message_limit}</span>`),this.show_spoiler_button&&e.push(this.getSpoilerButton());const n=Qc.disco.supports(bf.NS.HTTPUPLOAD,Vc.domain);if(e.push(wc`${th(n.then(e=>this.getHTTPUploadButton(e)),"")}`),this.show_occupants_toggle){const t=wd("Hide participants"),n=wd("Show participants");e.push(wc`
<button class="toggle_occupants right"
title="${this.hidden_occupants?n:t}"
@click=${this.toggleOccupants}>
<converse-icon class="fa ${this.hidden_occupants?"fa-angle-double-left":"fa-angle-double-right"}"
path-prefix="${Qc.settings.get("assets_path")}" size="1em"></converse-icon>
</button>`)}return Vc.api.hook("getToolbarButtons",this,e)}getHTTPUploadButton(e){if(e){const e=wd("Choose a file to send");return wc`
<button title="${e}" @click=${this.toggleFileUpload}>
<converse-icon class="fa fa-paperclip"
path-prefix="${Qc.settings.get("assets_path")}"
size="1em"></converse-icon>
</button>
<input type="file" @change=${this.onFileSelection} class="fileupload" multiple="" style="display:none"/>`}return""}getSpoilerButton(){const e=this.model;if(!this.is_groupchat&&0===e.presence.resources.length)return;let t;t=this.composing_spoiler?wd("Click to write as a normal (non-spoiler) message"):wd("Click to write your message as a spoiler");const n=wc`
<button class="toggle-compose-spoiler"
title="${t}"
@click=${this.toggleComposeSpoilerMessage}>
<converse-icon class="fa ${this.composing_spoiler?"fa-eye-slash":"fa-eye"}"
path-prefix="${Qc.settings.get("assets_path")}"
size="1em"></converse-icon>
</button>`;if(this.is_groupchat)return n;{const t=e.get("jid"),r=Promise.all(e.presence.resources.map(e=>Qc.disco.supports(bf.NS.SPOILER,`${t}/${e.get("name")}`))).then(e=>e.reduce((e,t)=>e&&t,!0));return wc`${th(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),Qc.trigger("callButtonClicked",{connection:Vc.connection,model:this.model})}});class yf extends HTMLElement{async connectedCallback(){await Qc.waitUntil("initialized"),sl.insertInto(this)}}customElements.define("converse-root",yf);
/**
* @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 wf=new WeakMap,Sf=window.navigator.userAgent.indexOf("Trident/")>0,xf=Ka(e=>t=>{if(!(t instanceof lc))throw new Error("unsafeSVG can only be used in text bindings");const n=wf.get(t);if(void 0!==n&&sc(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template"),i=r.content;let s;Sf?(r.innerHTML=`<svg>${e}</svg>`,s=i.firstChild):(s=document.createElementNS("http://www.w3.org/2000/svg","svg"),i.appendChild(s),s.innerHTML=e),i.removeChild(s),Pa(i,s.firstChild);const o=document.importNode(i,!0);t.setValue(o),wf.set(t,{value:e,fragment:o})});window.customElements.define("converse-fontawesome",class extends Kd{constructor(){super();const e=n.e(138).then(n.t.bind(null,543,7));this.data=e.then(e=>wc`${xf(e.default())}`)}render(){return wc`${th(this.data,"")}`}});var Ef=function(e,t,n){var r=null==e?0:e.length;return r?(t=n||void 0===t?1:pi(t),ks(e,t<0?0:t,r)):[]};var Af=function(e,t){var n=[];return _o(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n};var Cf=function(e,t){return(Oe(e)?st:Af)(e,Es(t,3))};var kf=function(e){return e&&e.length?e[0]:void 0};var jf=function(e){return"function"==typeof e?e:vr};var Tf=function(e,t){return(Oe(e)?ve:_o)(e,jf(t))};var Of=function(e,t){return zr(t,(function(t){return e[t]}))};var Nf=function(e){return null==e?[]:Of(e,Ye(e))},If=Math.max;var Mf=function(e,t,n,r){e=Qe(e)?e:Nf(e),n=n&&!r?pi(n):0;var i=e.length;return n<0&&(n=If(i+n,0)),Zt(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Co(e,t,n)>-1};var Rf=function(e){return(null==e?0:e.length)?ks(e,0,-1):[]};var $f=function(e,t){return(Oe(e)?zr:Ko)(e,Es(t,3))};var Df=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&&!Or(o):n(o,a)))var a=o,c=s}return c};var Pf=function(e,t){return e>t};var Lf=function(e){return e&&e.length?Df(e,vr,Pf):void 0};var zf=function(e,t){return e<t};var Ff=function(e){return e&&e.length?Df(e,vr,zf):void 0};var Bf=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 qf=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 Uf=function(e,t,n){var r=Oe(e)?Bf:qf,i=arguments.length<3;return r(e,Es(t,4),n,i,_o)};var Hf=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},Vf=Fi(!0);var Wf=vo((function(e,t){return e&&Vf(e,t,Ye)}),!0);var Gf=function(e,t,n){var r=Oe(e)?Hf:qf,i=arguments.length<3;return r(e,Es(t,4),n,i,Wf)};var Jf=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 Qf=function(e,t){return(Oe(e)?st:Af)(e,Jf(Es(t,3)))};var Yf=function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=void 0===t?t:pi(t),Ar(e,t)},Kf=Math.floor,Xf=Math.random;var Zf=function(e,t){return e+Kf(Xf()*(t-e+1))};var ep=function(e){var t=e.length;return t?e[Zf(0,t-1)]:void 0};var tp=function(e){return ep(Nf(e))};var np=function(e){return(Oe(e)?ep:tp)(e)};var rp=function(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var s=Zf(n,i),o=e[s];e[s]=e[n],e[n]=o}return e.length=t,e};var ip=function(e){return rp(it(e))};var sp=function(e){return rp(Nf(e))};var op=function(e){return(Oe(e)?ip:sp)(e)},ap=ws("length"),cp=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var lp=function(e){return cp.test(e)},up="[\\ud800-\\udfff]",dp="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",hp="\\ud83c[\\udffb-\\udfff]",fp="[^\\ud800-\\udfff]",pp="(?:\\ud83c[\\udde6-\\uddff]){2}",gp="[\\ud800-\\udbff][\\udc00-\\udfff]",mp="(?:"+dp+"|"+hp+")"+"?",vp="[\\ufe0e\\ufe0f]?"+mp+("(?:\\u200d(?:"+[fp,pp,gp].join("|")+")[\\ufe0e\\ufe0f]?"+mp+")*"),_p="(?:"+[fp+dp+"?",dp,pp,gp,up].join("|")+")",bp=RegExp(hp+"(?="+hp+")|"+_p+vp,"g");var yp=function(e){for(var t=bp.lastIndex=0;bp.test(e);)++t;return t};var wp=function(e){return lp(e)?yp(e):ap(e)};var Sp=function(e){if(null==e)return 0;if(Qe(e))return Zt(e)?wp(e):e.length;var t=jt(e);return"[object Map]"==t||"[object Set]"==t?e.size:Je(e).length};var xp=function(e){var t=null==e?0:e.length;return t?ks(e,1,t):[]};var Ep=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:pi(t),ks(e,0,t<0?0:t)):[]};var Ap=function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n};var Cp=function(e){return e.split("")},kp="[\\ud800-\\udfff]",jp="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Tp="[^\\ud800-\\udfff]",Op="(?:\\ud83c[\\udde6-\\uddff]){2}",Np="[\\ud800-\\udbff][\\udc00-\\udfff]",Ip="(?:"+jp+"|\\ud83c[\\udffb-\\udfff])"+"?",Mp="[\\ufe0e\\ufe0f]?"+Ip+("(?:\\u200d(?:"+[Tp,Op,Np].join("|")+")[\\ufe0e\\ufe0f]?"+Ip+")*"),Rp="(?:"+[Tp+jp+"?",jp,Op,Np,kp].join("|")+")",$p=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+Rp+Mp,"g");var Dp=function(e){return e.match($p)||[]};var Pp=function(e){return lp(e)?Dp(e):Cp(e)},Lp=w?w.iterator:void 0;var zp=function(e){if(!e)return[];if(Qe(e))return Zt(e)?Pp(e):it(e);if(Lp&&e[Lp])return Ap(e[Lp]());var t=jt(e);return("[object Map]"==t?es:"[object Set]"==t?ts:Nf)(e)},Fp=Ar((function(e,t){return Oo(e)?To(e,t):[]}));
/*!
* Copyright (c) JC Brand <jc@opkode.com>
*/
const Bp=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 Md).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),Md.apply(this,Array.prototype.slice.apply(arguments))},qp={includes:Mf,difference:No,drop:Ef,every:Ro,filter:Cf,find:fl,first:kf,forEach:Tf,head:kf,indexOf:Uo,initial:Rf,invoke:$a,isEmpty:ri,last:Cs,lastIndexOf:Jo,map:$f,max:Lf,min:Ff,reduce:Uf,reduceRight:Gf,reject:Qf,rest:Yf,sample:np,shuffle:op,size:Sp,some:Yo,sortBy:na,tail:xp,take:Ep,toArray:zp,without:Fp};Object.keys(qp).forEach(e=>{Bp.prototype[e]=function(){const t=Array.prototype.slice.call(arguments);return t.unshift(this.views),qp[e].apply(this,t)}}),Object.assign(Bp.prototype,Md.prototype),Bp.extend=Md.extend;const Up=Bp.extend({listItems:"model",sortEvent:"change",sortImmediatelyOnAdd:!1,listSelector:".ordered-items",ItemView:void 0,subviewIndex:"id",initialize(){this.sortEventually=Ma(()=>this.sortAndPositionAllItems(),100),this.items=vs(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)}}),Hp=sl.env.utils,Vp=Md.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=Hp.getElementFromTemplateResult(Hh(e)).outerHTML}}}),Wp=Bp.extend({_ensureElement(){if(this.el)this.setElement(Jr(this,"el"),!1);else{let e=Vc.root.querySelector("#conversejs");if(null===e){e=document.createElement("div"),e.setAttribute("id","conversejs"),Hp.addClass("theme-"+Qc.settings.get("theme"),e);const t=Vc.root.querySelector("body");t?t.appendChild(e):Vc.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()&&bc(wc`
<div class="inner-content converse-brand row">
<div class="converse-brand__padding"></div>
<div class="converse-brand__heading">
<svg height="200px"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 364 364"
version="1.1">
<title>Logo Converse</title>
<defs>
<linearGradient id="gradient" x1="92.14" y1="27.64" x2="267.65" y2="331.62" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff1d1"/>
<stop offset="0.05" stop-color="#fae8c1"/>
<stop offset="0.15" stop-color="#f0d5a1"/>
<stop offset="0.27" stop-color="#e7c687"/>
<stop offset="0.4" stop-color="#e1bb72"/>
<stop offset="0.54" stop-color="#dcb264"/>
<stop offset="0.71" stop-color="#daad5c"/>
<stop offset="1" stop-color="#d9ac59"/>
</linearGradient>
<filter id="shadow">
<feGaussianBlur in="SourceAlpha" stdDeviation="2.3" result="blur1"/>
<feOffset in="blur1" dx="3" dy="3" result="blur2"/>
<feColorMatrix in="blur2" type="matrix" result="blur3"
values="1 0 0 0 0.1
0 1 0 0 0.1
0 0 1 0 0.1
0 0 0 1 0"/>
<feMerge>
<feMergeNode in="blur3"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</defs>
<g filter="url(#shadow)">
<path d="M221.46,103.71c0,18.83-29.36,18.83-29.12,0C192.1,84.88,221.46,84.88,221.46,103.71Z" fill="#d9ac59"/>
<path d="M179.9,4.15A175.48,175.48,0,1,0,355.38,179.63,175.48,175.48,0,0,0,179.9,4.15Zm-40.79,264.5c-.23-17.82,27.58-17.82,27.58,0S138.88,286.48,139.11,268.65ZM218.6,168.24A79.65,79.65,0,0,1,205.15,174a12.76,12.76,0,0,0-6.29,4.65L167.54,222a1.36,1.36,0,0,1-2.46-.8v-35.8a2.58,2.58,0,0,0-3.06-2.53c-15.43,3-30.23,7.7-42.73,19.94-38.8,38-29.42,105.69,16.09,133.16a162.25,162.25,0,0,1-91.47-67.27C-3.86,182.26,34.5,47.25,138.37,25.66c46.89-9.75,118.25,5.16,123.73,62.83C265.15,120.64,246.56,152.89,218.6,168.24Z" fill="url(#gradient)"/>
</g>
</svg>
<span class="converse-brand__text">
<span>converse<span class="subdued">.js</span></span>
<p class="byline">messaging freedom</p>
</span>
</div>
</div>`,e);document.querySelector("body").classList.add("converse-"+Qc.settings.get("view_mode")),this.el.classList.add("converse-"+Qc.settings.get("view_mode")),Qc.settings.get("singleton")&&this.el.classList.add("converse-singleton"),this.render()},render(){this._ensureElement(),bc(wc`
<div class="converse-chatboxes row no-gutters"></div>
<div id="converse-modals" class="modals"></div>
<converse-fontawesome></converse-fontawesome>
`,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 Gp(){Vc.chatboxviews=new Vc.ChatBoxViews({model:Vc.chatboxes}),Qc.trigger("chatBoxViewsInitialized")}function Jp(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",e+"px")}sl.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Qc.elements.register(),Qc.promises.add(["chatBoxViewsInitialized"]),Qc.settings.extend({animate:!0,theme:"default"}),Vc.ViewWithAvatar=Vp,Vc.ChatBoxViews=Wp,Qc.listen.on("chatBoxesInitialized",Gp),Qc.listen.on("cleanup",()=>delete Vc.chatboxviews),Qc.listen.on("clearSession",()=>Vc.chatboxviews.closeAllChatBoxes()),Qc.listen.on("chatBoxViewsInitialized",Jp),window.addEventListener("resize",Jp),Object.assign(sl,{insertInto(e){var t;const n=null===(t=Vc.chatboxviews)||void 0===t?void 0:t.el;if(n&&!e.contains(n))e.insertAdjacentElement("afterBegin",n),Qc.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 Qp=e=>wc`
<div class="flyout box-flyout">
<div class="chat-head chat-head-chatbox row no-gutters"></div>
<div class="chat-body">
<div class="chat-content ${e.show_send_button?"chat-content-sendbutton":""}" aria-live="polite">
<div class="chat-content__messages" @scroll=${e.markScrolled}></div>
<div class="chat-content__help"></div>
</div>
<div class="bottom-panel">
<div class="message-form-container">
</div>
</div>
</div>
`;const Yp=e=>{const t=wd("OMEMO Fingerprints"),n=wd("No OMEMO-enabled devices found"),r=e.view.devicelist.devices;return wc`
<hr/>
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
${r.length?r.map(t=>(e=>{const t=wd("Trusted"),n=wd("Untrusted");return e.device.get("bundle")&&e.device.get("bundle").fingerprint?wc`
<li class="list-group-item">
<form class="fingerprint-trust">
<div class="btn-group btn-group-toggle">
<label class="btn btn--small ${-1!==e.device.get("trusted")?"btn-primary active":"btn-secondary"}">
<input type="radio" name="${e.device.get("id")}" value="1" ?checked=${-1!==e.device.get("trusted")}>${t}
</label>
<label class="btn btn--small ${-1!==e.device.get("trusted")?"btn-primary active":"btn-secondary"}">
<input type="radio" name="${e.device.get("id")}" value="-1" ?checked=${-1===e.device.get("trusted")}>${n}
</label>
</div>
<code class="fingerprint">${e.utils.formatFingerprint(e.device.get("bundle").fingerprint)}</code>
</form>
</li>
`:""})(Object.assign({device:t},e))):wc`<li class="list-group-item"> ${n} </li>`}
</ul>
`};var Kp=e=>{const t=wd("XMPP Address"),n=wd("Email"),r=wd("Full Name"),i=wd("Nickname"),s=wd("The User's Profile Image"),o=wd("Refresh"),a=wd("Role"),c=wd("URL"),l={alt_text:s,extra_classes:"mb-3",height:"120",width:"120"};return wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="user-details-modal-label">${e.display_name}</h5>
${qd}
</div>
<div class="modal-body">
${e.image?wc`<div class="mb-4">${Hh(Object.assign(e,l))}</div>`:""}
${e.fullname?wc`<p><label>${r}:</label> ${e.fullname}</p>`:""}
<p><label>${t}:</label> <a href="xmpp:${e.jid}">${e.jid}</a></p>
${e.nickname?wc`<p><label>${i}:</label> ${e.nickname}</p>`:""}
${e.url?wc`<p><label>${c}:</label> <a target="_blank" rel="noopener" href="${e.url}">${e.url}</a></p>`:""}
${e.email?wc`<p><label>${n}:</label> <a href="mailto:${e.email}">${e.email}</a></p>`:""}
${e.role?wc`<p><label>${a}:</label> ${e.role}</p>`:""}
${e._converse.pluggable.plugins["converse-omemo"].enabled(e._converse)?Yp(e):""}
</div>
<div class="modal-footer">
${Bd}
<button type="button" class="btn btn-info refresh-contact"><i class="fa fa-refresh"> </i>${o}</button>
${e.allow_contact_removal&&e.is_roster_contact?(e=>{const t=wd("Remove as contact");return wc`
<button type="button" @click="${e.removeContact}" class="btn btn-danger remove-contact">
<i class="far fa-trash-alt"></i>${t}
</button>
`})(e):""}
</div>
</div>
</div>
`};
/**
* @module converse-chatview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Xp,dayjs:Zp}=sl.env,eg=sl.env.utils,tg=Md.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(),Qc.trigger("chatBoxViewInitialized",this)},initDebounced(){this.markScrolled=Ma(this._markScrolled,100),this.debouncedScrollDown=Ma(this.scrollDown,100),Qc.settings.get("debounced_content_rendering")?(this.renderChatHistory=Ma(()=>this.renderChatContent(!1),100),this.renderNotifications=Ma(()=>this.renderChatContent(!0),100)):(this.renderChatHistory=()=>this.renderChatContent(!1),this.renderNotifications=()=>this.renderChatContent(!0))},render(){const e=Qp(Object.assign(this.model.toJSON(),{markScrolled:e=>this.markScrolled(e)}));return bc(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(),eg.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")===Vc.COMPOSING?wd("%1$s is typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===Vc.PAUSED?wd("%1$s has stopped typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===Vc.GONE?wd("%1$s has gone away",this.model.getDisplayName()):""},getHelpMessages:()=>["<strong>/clear</strong>: "+wd("Remove messages"),"<strong>/close</strong>: "+wd("Close this chat"),"<strong>/me</strong>: "+wd("Write in the third person"),"<strong>/help</strong>: "+wd("Show this menu")],renderHelpMessages(){bc(wc`<converse-chat-help
.model=${this.model}
.messages=${this.getHelpMessages()}
?hidden=${!this.model.get("show_help_messages")}
type="info"
chat_type="${this.model.get("type")}"></converse-chat-help>`,this.help_container)},renderChatContent(e=!1){this.tpl_chat_content||(this.tpl_chat_content=e=>wc`
<converse-chat-content
.chatview=${this}
.messages=${e.messages}
notifications=${e.notifications}>
</converse-chat-content>`);const t=this.model.messages.models,n=e?t:Array.from(t);bc(this.tpl_chat_content({messages:n,notifications:this.getNotifications()}),this.msgs_container)},renderToolbar(){if(!Qc.settings.get("show_toolbar"))return this;const e=Object.assign({model:this.model,chatview:this},this.model.toJSON(),this.getToolbarOptions());return bc((e=>{const t=Qc.settings.get("message_limit"),n=Qc.settings.get("visible_toolbar_buttons").call,r=Qc.settings.get("visible_toolbar_buttons").emoji,i=Qc.settings.get("show_send_button"),s=Qc.settings.get("visible_toolbar_buttons").spoiler,o=Qc.settings.get("show_toolbar");return wc`
<converse-chat-toolbar
.chatview=${e.chatview}
.model=${e.model}
?composing_spoiler="${e.composing_spoiler}"
?hidden_occupants="${e.hidden_occupants}"
?is_groupchat="${e.is_groupchat}"
?show_call_button="${n}"
?show_emoji_button="${r}"
?show_occupants_toggle="${e.show_occupants_toggle}"
?show_send_button="${i}"
?show_spoiler_button="${s}"
?show_toolbar="${o}"
message_limit="${t}"
></converse-chat-toolbar>
`})(e),this.el.querySelector(".chat-toolbar")),Qc.trigger("renderToolbar",this),this},renderMessageForm(){var e,t;const n=this.el.querySelector(".message-form-container");var r;bc((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")?wd("Hidden message"):wd("Message"),label_spoiler_hint:wd("Optional hint"),message_value:null===(t=this.el.querySelector(".chat-textarea"))||void 0===t?void 0:t.value,show_send_button:Qc.settings.get("show_send_button"),show_toolbar:Qc.settings.get("show_toolbar"),unread_msgs:wd("You have unread messages")}),wc`
<div class="new-msgs-indicator hidden">▼ ${r.unread_msgs} ▼</div>
<form class="setNicknameButtonForm hidden">
<input type="submit" class="btn btn-primary" name="join" value="Join"/>
</form>
<form class="sendXMPPMessage">
<span class="chat-toolbar no-text-select"></span>
<input type="text" placeholder="${r.label_spoiler_hint||""}" value="${r.hint_value||""}" class="${r.composing_spoiler?"":"hidden"} spoiler-hint"/>
<div class="suggestion-box">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<textarea
type="text"
class="chat-textarea suggestion-box__input
${r.show_send_button?"chat-textarea-send-button":""}
${r.composing_spoile?"spoiler":""}"
placeholder="${r.label_message}">${r.message_value||""}</textarea>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</form>
`),n),this.el.addEventListener("focusin",e=>this.emitFocused(e)),this.el.addEventListener("focusout",e=>this.emitBlurred(e)),this.renderToolbar()},showControlBox(){var e;null===(e=Vc.chatboxviews.get("controlbox"))||void 0===e||e.show(),this.hide()},showUserDetailsModal(e){e.preventDefault(),void 0===this.user_details_modal&&(this.user_details_modal=new Vc.UserDetailsModal({model:this.model})),this.user_details_modal.show(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();bc(e,this.el.querySelector(".chat-head-chatbox"))},async getHeadingStandaloneButton(e){const t=await e;return wc`<a href="#"
class="chatbox-btn ${t.a_class} fa ${t.icon_class}"
@click=${t.handler}
title="${t.i18n_title}"></a>`},async getHeadingDropdownItem(e){const t=await e;return wc`<a href="#"
class="dropdown-item ${t.a_class}"
@click=${t.handler}
title="${t.i18n_title}"><i class="fa ${t.icon_class}"></i>${t.i18n_text}</a>`},async generateHeadingTemplate(){var e;const t=null===(e=this.model)||void 0===e?void 0:e.vcard,n=t?t.toJSON():{},r=await this.getHeadingButtons(),i=r.filter(e=>e.standalone),s=r.filter(e=>!e.standalone);return(e=>{const t={alt_text:wd("The User's Profile Image"),extra_classes:"",height:40,width:40};return wc`
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
${e._converse.api.settings.get("singleton")?"":wc`<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>`}
${e.type!==e._converse.HEADLINES_TYPE?wc`<span class="mr-2">${Hh(Object.assign({},e,t))}</span>`:""}
<div class="chatbox-title__text" title="${e.jid}">
${e.url?wc`<a href="${e.url}" target="_blank" rel="noopener" class="user">${e.display_name}</a>`:e.display_name}
</div>
</div>
<div class="chatbox-title__buttons row no-gutters">
${e.dropdown_btns.length?wc`<converse-dropdown .items=${e.dropdown_btns}></converse-dropdown>`:""}
${e.standalone_btns.length?(e=>e.standalone_btns.reverse().map(e=>th(e,"")))(e):""}
</div>
</div>
${e.status?wc`<p class="chat-head__desc">${e.status}</p>`:""}
`})(Object.assign(n,this.model.toJSON(),{_converse:Vc,dropdown_btns:s.map(e=>this.getHeadingDropdownItem(e)),standalone_btns:i.map(e=>this.getHeadingStandaloneButton(e)),display_name:this.model.getDisplayName()}))},getHeadingButtons(){const e=[{a_class:"show-user-details-modal",handler:e=>this.showUserDetailsModal(e),i18n_text:wd("Details"),i18n_title:wd("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===Qc.settings.get("view_mode")}];return Qc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:wd("Close"),i18n_title:wd("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Qc.settings.get("view_mode")}),Vc.api.hook("getHeadingButtons",this,e)},getToolbarOptions:()=>({}),maybeScrollDown(e){!(!(null!=e&&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")&&eg.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 Vc.chatboxviews.insertRowColumn(this.el),Qc.trigger("chatBoxInsertedIntoDOM",this),this},addSpinner(e=!1){if(null===this.el.querySelector(".spinner")){const t=eg.getElementFromTemplateResult(Wh());e?(this.content.insertAdjacentElement("beforeend",t),this.scrollDown()):this.content.insertAdjacentElement("afterbegin",t)}},clearSpinner(){this.content.querySelectorAll(".spinner").forEach(eg.removeElement)},onStatusMessageChanged(e){this.renderHeading(),Qc.trigger("contactStatusMessageChanged",{contact:e.attributes,message:e.get("status")})},markFollowups(e){const t=e.getAttribute("data-from"),n=e.previousElementSibling,r=Zp(e.getAttribute("data-isodate")),i=e.nextElementSibling;eg.hasClass("chat-msg--action",e)||eg.hasClass("chat-msg--action",n)||eg.hasClass("chat-info",e)||eg.hasClass("chat-info",n)||n.getAttribute("data-from")!==t||!r.isBefore(Zp(n.getAttribute("data-isodate")).add(10,"minutes"))||e.getAttribute("data-encrypted")!==n.getAttribute("data-encrypted")||eg.addClass("chat-msg--followup",e),i&&(!eg.hasClass("chat-msg--action",e)&&eg.hasClass("chat-info",e)&&i.getAttribute("data-from")===t&&Zp(i.getAttribute("data-isodate")).isBefore(r.add(10,"minutes"))&&e.getAttribute("data-encrypted")===i.getAttribute("data-encrypted")?eg.addClass("chat-msg--followup",i):eg.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(Qc.settings.get("message_limit")&&r.length>Qc.settings.get("message_limit")||!r.replace(/\s/g,"").length)return;if(!Vc.connection.authenticated){const e=wd("Sorry, the connection has been lost, and your message could not be sent");return Qc.alert("error",wd("Error"),e),void Qc.connection.reconnect()}let i,s={};this.model.get("composing_spoiler")&&(s=this.el.querySelector("form.sendXMPPMessage input.spoiler-hint"),i=s.value),eg.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="",eg.removeClass("correcting",n),n.style.height="auto",this.updateCharCounter(n.value)),a&&Qc.trigger("messageSend",a),"overlayed"===Qc.settings.get("view_mode")&&(this.msgs_container.parentElement.style.display="none"),n.removeAttribute("disabled"),eg.removeClass("disabled",n),"overlayed"===Qc.settings.get("view_mode")&&(this.msgs_container.parentElement.style.display=""),this.model.setChatState(Vc.ACTIVE,{silent:!0}),n.focus()},updateCharCounter(e){if(Qc.settings.get("message_limit")){const t=this.el.querySelector(".message-limit"),n=Qc.settings.get("message_limit")-e.length;t.textContent=n,n<1?eg.addClass("error",t):eg.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===sl.keycodes.TAB){const t=eg.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&this.autocompleteInPicker(e.target,t)&&(e.preventDefault(),e.stopPropagation())}else{if(e.keyCode===sl.keycodes.FORWARD_SLASH)return;if(e.keyCode===sl.keycodes.ESCAPE)return this.onEscapePressed(e);if(e.keyCode===sl.keycodes.ENTER)return this.onEnterPressed(e);if(e.keyCode!==sl.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===sl.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&eg.hasClass("correcting",this.el.querySelector(".chat-textarea")))return this.editLaterMessage()}else{const e=this.el.querySelector(".chat-textarea");if(!e.value||eg.hasClass("correcting",e))return this.editEarlierMessage()}}[sl.keycodes.SHIFT,sl.keycodes.META,sl.keycodes.META_RIGHT,sl.keycodes.ESCAPE,sl.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==Vc.COMPOSING&&this.model.setChatState(Vc.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 Dn.error("onMessageRetractButtonClicked called for someone else's message!");const t=wd("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),n=[wd("Are you sure you want to retract this message?")];Qc.settings.get("show_retraction_warning")&&(n[1]=t);await Qc.confirm(wd("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(wd("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(eg.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(eg.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(eg.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){e&&e.preventDefault&&e.preventDefault();return!0===confirm(wd("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?eg.addClass("correcting",i):eg.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),eg.placeCaretAtEnd(i)},onPresenceChanged(e){const t=e.get("show"),n=this.model.getDisplayName();let r;eg.isVisible(this.el)&&("offline"===t?r=wd("%1$s has gone offline",n):"away"===t?r=wd("%1$s has gone away",n):"dnd"===t?r=wd("%1$s is busy",n):"online"===t&&(r=wd("%1$s is online",n)),r&&this.model.createMessage({message:r,type:"info"}))},async close(e){return e&&e.preventDefault&&e.preventDefault(),Vc.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&Vc.router.navigate(""),Qc.connection.connected()&&(this.model.setChatState(Vc.INACTIVE),this.model.sendChatState()),await this.model.close(),this.remove(),Qc.trigger("chatBoxClosed",this),this},emitBlurred(e){this.el.contains(document.activeElement)||this.el.contains(e.relatedTarget)||Qc.trigger("chatBoxBlurred",this,e)},emitFocused(e){this.el.contains(e.relatedTarget)||Qc.trigger("chatBoxFocused",this,e)},focus(){const e=this.el.getElementsByClassName("chat-textarea")[0];return e&&document.activeElement!==e&&e.focus(),this},maybeFocus(){Qc.settings.get("auto_focus")&&this.focus()},hide(){return this.el.classList.add("hidden"),this},afterShown(){this.model.clearUnreadMsgCounter(),this.model.setChatState(Vc.ACTIVE),this.scrollDown(),this.maybeFocus()},show(){this.model.get("hidden")?Dn.debug(`Not showing chat ${this.model.get("jid")} because it's set as hidden`):eg.isVisible(this.el)?this.maybeFocus():Qc.settings.get("animate")?eg.fadeIn(this.el,()=>this.afterShown()):(eg.showElement(this.el),this.afterShown())},showNewMessagesIndicator(){eg.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?Qc.trigger("chatBoxScrolledUp",this):n=e.target.scrollTop,eg.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))&&Vc.router.history.navigate()}Qc.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(Vc.INACTIVE,{silent:!0}),this.model.sendChatState())}});let ng;sl.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){Qc.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}}),Vc.ChatBoxView=tg,Vc.UserDetailsModal=Gd.extend({id:"user-details-modal",events:{"click button.refresh-contact":"refreshContact","click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){Gd.prototype.initialize.apply(this,arguments),this.model.rosterContactAdded.then(()=>this.registerContactEventHandlers()),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),Qc.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 Kp(Object.assign(this.model.toJSON(),n,{_converse:Vc,allow_contact_removal:Qc.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:eg}))},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");eg.addClass("fa-spin",t);try{await Qc.vcard.update(this.model.contact.vcard,!0)}catch(e){Dn.fatal(e),this.alert(wd("Sorry, something went wrong while trying to refresh"),"danger")}eg.removeClass("fa-spin",t)},removeContact(e){if(e&&e.preventDefault&&e.preventDefault(),!Qc.settings.get("allow_contact_removal"))return;!0===confirm(wd("Are you sure you want to remove this contact?"))&&(this.modal.hide(),setTimeout(()=>{this.model.contact.removeFromRoster(()=>this.model.contact.destroy(),e=>{Dn.error(e),Qc.alert("error",wd("Error"),[wd("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.contact.getDisplayName())])})},1))}}),Qc.listen.on("chatBoxViewsInitialized",()=>{const e=Vc.chatboxviews;Vc.chatboxes.on("add",async t=>{e.get(t.get("id"))||t.get("type")!==Vc.PRIVATE_CHAT_TYPE||(await t.initialized,e.add(t.get("id"),new Vc.ChatBoxView({model:t})))})}),Qc.listen.on("windowStateChanged",(function(e){Vc.chatboxviews&&Vc.chatboxviews.forEach(t=>{"controlbox"!==t.model.get("id")&&t.onWindowStateChanged(e.state)})})),Qc.listen.on("connected",()=>Qc.disco.own.features.add(Xp.NS.SPOILER)),Object.assign(Qc,{chatviews:{get:e=>void 0===e?Object.values(Vc.chatboxviews.getAll()):"string"==typeof e?Vc.chatboxviews.get(e):e.map(e=>Vc.chatboxviews.get(e))}})}});let rg=0;function ig(e){ng=e}function sg(){ng=null,rg=0}const og=Symbol("haunted.phase"),ag=Symbol("haunted.hook"),cg=Symbol("haunted.update"),lg=Symbol("haunted.commit"),ug=Symbol("haunted.effects"),dg=Symbol("haunted.layoutEffects");class hg{constructor(e,t){this.update=e,this.host=t,this[ag]=new Map,this[ug]=[],this[dg]=[]}run(e){ig(this);let t=e();return sg(),t}_runEffects(e){let t=this[e];ig(this);for(let e of t)e.call(this);sg()}runEffects(){this._runEffects(ug)}runLayoutEffects(){this._runEffects(dg)}teardown(){this[ag].forEach(e=>{"function"==typeof e.teardown&&e.teardown()})}}const fg=Promise.resolve().then.bind(Promise.resolve());function pg(){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=fg(n))}}const gg=pg(),mg=pg();class vg{constructor(e,t){this.renderer=e,this.host=t,this.state=new hg(this.update.bind(this),t),this[og]=null,this._updateQueued=!1}update(){this._updateQueued||(gg(()=>{let e=this.handlePhase(cg);mg(()=>{this.handlePhase(lg,e),mg(()=>{this.handlePhase(ug)})}),this._updateQueued=!1}),this._updateQueued=!0)}handlePhase(e,t){switch(this[og]=e,e){case lg:return this.commit(t),void this.runEffects(dg);case cg:return this.render();case ug:return this.runEffects(ug)}this[og]=null}render(){return this.state.run(()=>this.renderer.call(this.host,this.host))}runEffects(e){this.state._runEffects(e)}teardown(){this.state.teardown()}}function _g(e){class t extends vg{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;return t in e?(i=Object.getOwnPropertyDescriptor(e,t),i&&i.set?(i.set.call(r,n),!0):(Reflect.set(e,t,n,r),!0)):(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 bg{constructor(e,t){this.id=e,this.state=t}}function yg(e,...t){let n=rg++,r=ng[ag],i=r.get(n);return i||(i=new e(n,ng,...t),r.set(n,i)),i.update(...t)}function wg(e){return yg.bind(null,e)}function Sg(e){return wg(class extends bg{constructor(t,n,r,i){super(t,n),e(n,this)}update(e,t){this.callback=e,this.values=t}call(){this.values&&!this.hasChanged()||this.run(),this.lastValues=this.values}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 xg(e,t){e[ug].push(t)}Sg(xg);const Eg=wg(class extends bg{constructor(e,t,n){super(e,t),this._updater=this._updater.bind(this),this._ranEffect=!1,this._unsubscribe=null,xg(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()}});wg(class extends bg{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)}});Sg((function(e,t){e[dg].push(t)})),wg(class extends bg{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])}}),wg(class extends bg{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 Ag=Array.prototype.includes;const{component:Cg,createContext:kg}=function({render:e}){const t=_g(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(Eg(n))})),defaultValue:t};return n}}(t);return{component:t,createContext:n}}({render:bc});!function(){const e=new WeakMap,t=new WeakMap;class n extends vg{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)}}}();Qc.elements.define("converse-brand-heading",Cg(e=>{const t="fullscreen"===Qc.settings.get("view_mode");return wc`
<a class="brand-heading" href="https://conversejs.org" target="_blank" rel="noopener">
<span class="brand-name-wrapper ${t?"brand-name-wrapper--fullscreen":""}">
<svg class="converse-svg-logo"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 364 364">
<title>Converse</title>
<g class="cls-1" id="g904">
<g data-name="Layer 2">
<g data-name="Layer 7">
<path
class="cls-3"
d="M221.46,103.71c0,18.83-29.36,18.83-29.12,0C192.1,84.88,221.46,84.88,221.46,103.71Z" />
<path
class="cls-4"
d="M179.9,4.15A175.48,175.48,0,1,0,355.38,179.63,175.48,175.48,0,0,0,179.9,4.15Zm-40.79,264.5c-.23-17.82,27.58-17.82,27.58,0S138.88,286.48,139.11,268.65ZM218.6,168.24A79.65,79.65,0,0,1,205.15,174a12.76,12.76,0,0,0-6.29,4.65L167.54,222a1.36,1.36,0,0,1-2.46-.8v-35.8a2.58,2.58,0,0,0-3.06-2.53c-15.43,3-30.23,7.7-42.73,19.94-38.8,38-29.42,105.69,16.09,133.16a162.25,162.25,0,0,1-91.47-67.27C-3.86,182.26,34.5,47.25,138.37,25.66c46.89-9.75,118.25,5.16,123.73,62.83C265.15,120.64,246.56,152.89,218.6,168.24Z" />
</g>
</g>
</g>
</svg>
<span class="brand-name">
<span class="brand-name__text">converse<span class="subdued">.js</span></span>
${t?wc`<p class="byline">messaging freedom</p>`:""}
</span>
</span>
</a>
${t?wc`
<p class="brand-subtitle">${e.version_name}</p>
<p class="brand-subtitle"><a target="_blank" rel="nofollow" href="https://conversejs.org">Open Source</a> XMPP chat client brought to you by <a target="_blank" rel="nofollow" href="https://opkode.com">Opkode</a> </p>
<p class="brand-subtitle"><a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">Translate</a> it into your own language</p>`:""}
`},{useShadowDOM:!1}));var jg=n(172),Tg=n.n(jg);const Og=e=>{const t=wd("Log in"),n=wd("XMPP Address");return wc`
<div class="form-group">
<label for="converse-login-jid">${n}:</label>
<input id="converse-login-jid"
?autofocus=${!!Qc.settings.get("auto_focus")}
required
class="form-control"
type="text"
name="jid"
placeholder="${e.placeholder_username}"/>
</div>
${e.authentication!==e.EXTERNAL?(()=>{const e=wd("Password");return wc`
<div class="form-group">
<label for="converse-login-password">${e}</label>
<input id="converse-login-password" class="form-control" required="required" type="password" name="password" placeholder="${e}"/>
</div>
`})():""}
${e.show_trust_checkbox?(e=>{const t=wd("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=wd("This is a trusted device");return wc`
<div class="form-group form-check login-trusted">
<input id="converse-login-trusted" type="checkbox" class="form-check-input" name="trusted" ?checked=${e}>
<label for="converse-login-trusted" class="form-check-label login-trusted__desc">${n}</label>
<i class="fa fa-info-circle" data-toggle="popover"
data-title="Trusted device?"
data-content="${t}"></i>
</div>
`})("off"!==e.show_trust_checkbox):""}
<fieldset class="buttons">
<input class="btn btn-primary" type="submit" value="${t}"/>
</fieldset>
${Vc.allow_registration&&!Qc.settings.get("auto_login")&&Vc.pluggable.plugins["converse-register"].enabled(Vc)?(()=>{const e=wd("Create an account"),t=wd("Don't have a chat account?");return wc`
<fieldset class="switch-form">
<p>${t}</p>
<p><a class="register-account toggle-register-login" href="#converse/register">${e}</a></p>
</fieldset>
`})():""}
`};var Ng=e=>wc`
<converse-brand-heading></converse-brand-heading>
<form id="converse-login" class="converse-form" method="post">
<div class="conn-feedback fade-in ${e.conn_feedback_subject?e.conn_feedback_class:"hidden"}">
<p class="feedback-subject">${e.conn_feedback_subject}</p>
<p class="feedback-message ${e.conn_feedback_message?"":"hidden"}">${e.conn_feedback_message}</p>
</div>
${"CONNECTING"===Vc.CONNECTION_STATUS[e.connection_status]?Wh({classes:"hor_centered"}):(e=>{const t=wd("Disconnected"),n=wd("Click here to log in anonymously");return wc`
${e.authentication==e.LOGIN||e.authentication==e.EXTERNAL?Og(e):""}
${e.authentication==e.ANONYMOUS?wc`<input class="btn btn-primary login-anon" type="submit" value="${n}">`:""}
${e.authentication==e.PREBIND?wc`<p>${t}</p>`:""}
`})(e)}
</form>
`;
/**
* @module converse-controlbox
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Ig,dayjs:Mg}=sl.env,Rg=sl.env.utils,$g={Error:"error",Connecting:"info","Connection failure":"error",Authenticating:"info","Authentication failure":"error",Connected:"info",Disconnected:"error",Disconnecting:"warn",Attached:"info",Redirect:"info",Reconnecting:"warn"},Dg={0:"Error",1:"Connecting",2:"Connection failure",3:"Authenticating",4:"Authentication failure",5:"Connected",6:"Disconnected",7:"Disconnecting",8:"Attached",9:"Redirect",10:"Reconnecting"},Pg=[0,1,2,3,4,7,10];sl.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(){function e(){const e=new Vc.ControlBox({id:"controlbox"});return Vc.chatboxes.add(e)}Qc.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}),Qc.promises.add("controlBoxInitialized"),Vc.ControlBox=Vc.ChatBox.extend({defaults(){return{bookmarked:!1,box_id:"controlbox",chat_state:void 0,closed:!Qc.settings.get("show_controlbox_by_default"),num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:Vc.CONTROLBOX_TYPE,url:""}},initialize(){"controlbox"===this.get("id")?this.set({time_opened:Mg(0).valueOf()}):Vc.ChatBox.prototype.initialize.apply(this,arguments)},validate(e){return e.type===Vc.CONTROLBOX_TYPE?"embedded"===Qc.settings.get("view_mode")&&Qc.settings.get("singleton")?"Controlbox not relevant in embedded view mode":void 0:Vc.ChatBox.prototype.validate.call(this,e)},maybeShow(e){return e||"controlbox"!==this.get("id")?Vc.ChatBox.prototype.maybeShow.call(this,e):this},onReconnection:function(){}}),Vc.ControlBoxView=Vc.ChatBoxView.extend({tagName:"div",className:"chatbox",id:"controlbox",events:{"click a.close-chatbox-button":"close"},initialize(){void 0===Vc.controlboxtoggle&&(Vc.controlboxtoggle=new Vc.ControlBoxToggle),Vc.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(),Qc.trigger("controlBoxInitialized",this)},render(){this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!Qc.settings.get("show_controlbox_by_default"));const e=(t={sticky_controlbox:Qc.settings.get("sticky_controlbox"),...this.model.toJSON()},wc`
<div class="flyout box-flyout">
<div class="chat-head controlbox-head">
${t.sticky_controlbox?"":wc`<a class="chatbox-btn close-chatbox-button fa fa-times"></a>`}
</div>
<div class="controlbox-panes"></div>
</div>`);var t;bc(e,this.el),this.model.get("closed")?this.hide():this.show();const n=(null==Vc?void 0:Vc.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 Vc.LoginPanel({model:new Vc.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&&Rg.isVisible(this.controlbox_pane.el)||(this.el.classList.remove("logged-out"),this.controlbox_pane=new Vc.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)&&(Vc.disconnection_cause!==Vc.LOGOUT||Qc.settings.get("show_controlbox_by_default")))return;if(Qc.settings.get("sticky_controlbox"))return;const t=(null==Vc?void 0:Vc.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"),Qc.trigger("controlBoxClosed",this),this},ensureClosedState(){this.model.get("closed")?this.hide():this.show()},hide(e){if(!Qc.settings.get("sticky_controlbox"))return Rg.addClass("hidden",this.el),Qc.trigger("chatBoxClosed",this),Qc.connection.connected()||Vc.controlboxtoggle.render(),Vc.controlboxtoggle.show(e),this},onControlBoxToggleHidden(){this.model.set("closed",!1),this.el.classList.remove("hidden"),Qc.trigger("controlBoxOpened",this)},show(){return Vc.controlboxtoggle.hide(()=>this.onControlBoxToggleHidden()),this},showHelpMessages(){}}),Vc.LoginPanelModel=Bs.extend({defaults:{errors:[]}}),Vc.LoginPanel=Md.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(Vc.connfeedback,"change",this.render),this.render()},toHTML(){const e=Vc.connfeedback.get("connection_status");let t,n;return Pg.includes(e)&&(n=Dg[e],t=$g[n]),Ng(Object.assign(this.model.toJSON(),{_converse:Vc,ANONYMOUS:Vc.ANONYMOUS,EXTERNAL:Vc.EXTERNAL,LOGIN:Vc.LOGIN,PREBIND:Vc.PREBIND,auto_login:Qc.settings.get("auto_login"),authentication:Qc.settings.get("authentication"),connection_status:e,conn_feedback_class:t,conn_feedback_subject:n,conn_feedback_message:Vc.connfeedback.get("message"),placeholder_username:(Qc.settings.get("locked_domain")||Qc.settings.get("default_domain"))&&wd("Username")||wd("user@domain"),show_trust_checkbox:Qc.settings.get("allow_user_trust_override")}))},initPopovers(){Array.from(this.el.querySelectorAll("[data-title]")).forEach(e=>{new Fd.a.Popover(e,{trigger:"mobile"===Qc.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===Qc.settings.get("view_mode"),container:this.el.parentElement.parentElement.parentElement})})},validate(){const e=this.el.querySelector("form").querySelector("input[name=jid]");return!e.value||Qc.settings.get("locked_domain")||Qc.settings.get("default_domain")||Rg.isValidJID(e.value)?(e.setCustomValidity(""),!0):(e.setCustomValidity(wd("Please enter a valid XMPP address")),!1)},authenticate(e){if(e&&e.preventDefault&&e.preventDefault(),Qc.settings.get("authentication")===Vc.ANONYMOUS)return this.connect(Vc.jid,null);if(!this.validate())return;const t=new FormData(e.target);Vc.config.save({trusted:!!t.get("trusted")});let n=t.get("jid");if(Qc.settings.get("locked_domain")){const e="@"+Qc.settings.get("locked_domain");n.endsWith(e)&&(n=n.substr(0,n.length-e.length)),n=Ig.escapeNode(n)+e}else Qc.settings.get("default_domain")&&!n.includes("@")&&(n=n+"@"+Qc.settings.get("default_domain"));this.connect(n,t.get("password"))},connect(e,t){["converse/login","converse/register"].includes(Vc.router.history.getFragment())&&Vc.router.navigate("",{replace:!0}),Vc.connection&&Vc.connection.reset(),Qc.user.login(e,t)}}),Vc.ControlBoxPane=Md.extend({tagName:"div",className:"controlbox-pane",initialize(){Qc.trigger("controlBoxPaneInitialized",this)}}),Vc.ControlBoxToggle=Md.extend({tagName:"a",className:"toggle-controlbox hidden",id:"toggle-controlbox",events:{click:"onClick"},attributes:{href:"#"},initialize(){Vc.chatboxviews.insertRowColumn(this.render().el),Qc.waitUntil("initialized").then(this.render.bind(this)).catch(e=>Dn.fatal(e))},render(){return this.el.innerHTML=Tg()({label_toggle:Qc.connection.connected()?wd("Chat Contacts"):wd("Toggle chat")}),this},hide(e){Rg.isVisible(this.el)&&(Rg.hideElement(this.el),e())},show(e){Rg.isVisible(this.el)||Rg.fadeIn(this.el,e)},showControlBox(){let t=Vc.chatboxes.get("controlbox");t||(t=e()),Qc.connection.connected()?t.save({closed:!1}):t.trigger("show")},onClick(e){if(e.preventDefault(),Rg.isVisible(Vc.root.querySelector("#controlbox"))){const e=Vc.chatboxes.get("controlbox");Qc.connection.connected?e.save({closed:!0}):e.trigger("hide")}else this.showControlBox()}}),Qc.listen.on("cleanup",()=>delete Vc.controlboxtoggle),Qc.listen.on("chatBoxViewsInitialized",()=>{Vc.chatboxes.on("add",e=>{if(e.get("type")===Vc.CONTROLBOX_TYPE){const t=Vc.chatboxviews,n=t.get(e.get("id"));n?(n.model=e,n.initialize()):t.add(e.get("id"),new Vc.ControlBoxView({model:e}))}})}),Qc.listen.on("clearSession",()=>{const e=null==Vc?void 0:Vc.chatboxviews,t=e&&e.get("controlbox");t&&(Rg.safeSave(t.model,{connected:!1}),null!=t&&t.controlbox_pane&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}),Qc.waitUntil("chatBoxViewsInitialized").then(e).catch(e=>Dn.fatal(e)),Qc.listen.on("chatBoxesFetched",()=>{(Vc.chatboxes.get("controlbox")||e()).save({connected:!0})});const t=function(){const e=Vc.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e};Qc.listen.on("disconnected",()=>t().renderLoginPanel()),Qc.listen.on("will-reconnect",t),Object.assign(Qc,{controlbox:{async open(){await Qc.waitUntil("chatBoxesFetched");const e=await Qc.chatboxes.get("controlbox")||Qc.chatboxes.create("controlbox",{},Vc.Controlbox);return e.trigger("show"),e},get:()=>Vc.chatboxviews.get("controlbox")}})}});var Lg=n(173),zg=n.n(Lg);
/**
* @module converse-dragresize
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const Fg=sl.env.utils;function Bg(e,t){const n=t.el.querySelector(".box-flyout"),r=document.createElement("div");r.innerHTML=zg()(),n.insertBefore(r,n.firstChild)}sl.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:Fg.applyDragResistance(t,this.get("default_height")),width:Fg.applyDragResistance(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 Bg(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 Bg(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 Bg(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 Bg(this.__super__._converse,this),this.setWidth(),e}}},initialize(){Qc.settings.extend({allow_dragresize:!0});const e={initDragResize(){var e;const t=this,n=Ma(()=>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=Vc.connection)&&void 0!==e&&e.connected&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===Vc.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))),Vc.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?Fg.applyDragResistance(e,this.model.get("default_height"))+"px":"";const t=this.el.querySelector(".box-flyout");null!==t&&(t.style.height=e)},setChatBoxWidth(e){e=e?Fg.applyDragResistance(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(!Qc.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),Vc.resizing={chatbox:this,direction:"top"},this.prev_pageY=e.pageY,t&&Qc.trigger("startVerticalResize",this)},onStartHorizontalResize(e,t=!0){if(!Qc.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),Vc.resizing={chatbox:this,direction:"left"},this.prev_pageX=e.pageX,t&&Qc.trigger("startHorizontalResize",this)},onStartDiagonalResize(e){this.onStartHorizontalResize(e,!1),this.onStartVerticalResize(e,!1),Vc.resizing.direction="topleft",Qc.trigger("startDiagonalResize",this)}};function t(e){if(!Vc.resizing||!Qc.settings.get("allow_dragresize"))return!0;e.preventDefault(),Vc.resizing.chatbox.resizeChatBox(e)}function n(e){if(!Vc.resizing||!Qc.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=Fg.applyDragResistance(Vc.resizing.chatbox.height,Vc.resizing.chatbox.model.get("default_height")),n=Fg.applyDragResistance(Vc.resizing.chatbox.width,Vc.resizing.chatbox.model.get("default_width"));Qc.connection.connected()?(Vc.resizing.chatbox.model.save({height:t}),Vc.resizing.chatbox.model.save({width:n})):(Vc.resizing.chatbox.model.set({height:t}),Vc.resizing.chatbox.model.set({width:n})),Vc.resizing=null}Object.assign(Vc.ChatBoxView.prototype,e),Fg.applyDragResistance=function(e,t){if(void 0===e)return;if(void 0===t)return e;return e!==t&&Math.abs(e-t)<10?t:e},Qc.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",t),document.addEventListener("mouseup",n)})),Qc.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)})),Qc.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.
*/
sl.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){if(Qc.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0}),!Array.isArray(Qc.settings.get("auto_join_rooms"))&&!Array.isArray(Qc.settings.get("auto_join_private_chats")))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(Qc.settings.get("auto_join_rooms").length>1||Qc.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
*/
sl.plugins.add("converse-fullscreen",{enabled:e=>e.isUniView(),initialize(){Qc.settings.extend({chatview_avatar_height:50,chatview_avatar_width:50,hide_open_bookmarks:!0,show_controlbox_by_default:!0,sticky_controlbox:!0})}}),
/**
* @module converse-mam-views
* @description
* Views for XEP-0313 Message Archive Management
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
sl.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Qc.listen.on("chatBoxScrolledUp",async e=>{if(e.model.messages.length){const t=e.model.get("type")===Vc.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const r=t?e.model.get("jid"):Vc.bare_jid,i=n&&n.get("stanza_id "+r);e.addSpinner(),i?await e.model.fetchArchivedMessages({before:i}):await e.model.fetchArchivedMessages({end:n.get("time")}),e.clearSpinner(),Vc.router.history.navigate("#"+n.get("msgid"))}}})}});Qc.elements.define("converse-minimized-chat",class extends Kd{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=wd("Click to restore this chat");return wc`
<div class="chat-head-${e.type} chat-head row no-gutters">
<a class="restore-chat w-100 align-self-center" title="${t}" @click=${e.restore}>
${e.num_unread?wc`<span class="message-count badge badge-light">${e.num_unread}</span>`:""}
${e.title}
</a>
<a class="chatbox-btn close-chatbox-button fa fa-times" @click=${e.close}></a>
</div>`})({close:e=>this.close(e),num_unread:this.num_unread,restore:e=>this.restore(e),title:this.title,type:this.type})}close(e){null==e||e.preventDefault();const t=Vc.chatboxviews.get(this.model.get("id"));t?t.close():(this.model.destroy(),Qc.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:qg}=sl.env,Ug=sl.env.utils;sl.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")||qg()})},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(){Qc.settings.extend({no_trimming:!1});const e={maximize(){Ug.safeSave(this,{minimized:!1,time_opened:(new Date).getTime()})},minimize(){Ug.safeSave(this,{minimized:!0,time_minimized:(new Date).toISOString()})}};Object.assign(Vc.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(),Qc.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(),Qc.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(Vc.ChatBoxView.prototype,t);const n={getChatBoxWidth(e){if("controlbox"===e.model.get("id")){const e=this.get("controlbox");return e&&Ug.isVisible(e.el)?Ug.getOuterWidth(e.el,!0):Ug.getOuterWidth(Vc.controlboxtoggle.el,!0)}return!e.model.get("minimized")&&Ug.isVisible(e.el)?Ug.getOuterWidth(e.el,!0):0},getShownChats(){return this.filter(e=>!e.model.get("minimized")&&!e.model.get("closed")&&Ug.isVisible(e.el))},getMinimizedWidth(){var e;const t=null===(e=Vc.minimized_chats)||void 0===e?void 0:e.el;return this.model.pluck("minimized").includes(!0)?Ug.getOuterWidth(t,!0):0},getBoxesWidth(e){const t=e?e.model.get("id"):null,n=e?Ug.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(Qc.settings.get("no_trimming")||!Qc.connection.connected()||"overlayed"!==Qc.settings.get("view_mode"))return;const n=this.getShownChats();if(n.length<=1)return;const r=Ug.getOuterWidth(document.querySelector("body"),!0);if(this.getChatBoxWidth(n[0])===r)return;await Qc.waitUntil("minimizedChatsInitialized");if(null===(t=Vc.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(Vc.ChatBoxViews.prototype,n),Qc.promises.add("minimizedChatsInitialized"),Vc.MinimizedChatsToggle=Bs.extend({defaults:{collapsed:!1}}),Vc.MinimizedChats=Md.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),bc(wc`<div id="minimized-chats" class="${(i=r).chats.length?"":"hidden"}">
<a id="toggle-minimized-chats" class="row no-gutters" @click=${i.toggle}>
${i.num_minimized} ${wd("Minimized")}
<span class="unread-message-count ${i.num_unread?"":"unread-message-count-hidden"}" href="#">${i.num_unread}</span>
</a>
<div class="flyout minimized-chats-flyout row no-gutters ${i.collapsed?"hidden":""}">
${i.chats.map(e=>wc`<converse-minimized-chat
.model=${e}
title=${e.getDisplayName()}
type=${e.get("type")}
num_unread=${e.get("num_unread")}></converse-minimized-chat>`)}
</div>
</div>`,this.el),this.el.parentElement||Vc.chatboxviews.insertRowColumn(this.el)},async initToggle(){const e="converse.minchatstoggle-"+Vc.bare_jid;this.minchats=new Vc.MinimizedChatsToggle({id:e}),this.minchats.browserStorage=Vc.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")})}}),Qc.listen.on("chatBoxInsertedIntoDOM",e=>Vc.chatboxviews.trimChats(e)),Qc.listen.on("connected",()=>{return null===(e=Vc.minimized_chats)||void 0===e||e.remove(),Vc.minimized_chats=new Vc.MinimizedChats({model:Vc.chatboxes}),void Qc.trigger("minimizedChatsInitialized");var e}),Qc.listen.on("controlBoxOpened",e=>Vc.chatboxviews.trimChats(e)),Qc.listen.on("chatBoxViewInitialized",e=>e.listenTo(e.model,"change:minimized",e.onMinimizedChanged)),Qc.listen.on("chatRoomViewInitialized",e=>{e.listenTo(e.model,"change:minimized",e.onMinimizedChanged),e.model.get("minimized")&&e.hide()}),Qc.listen.on("getHeadingButtons",(e,t)=>e.model.get("type")===Vc.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>e.minimize(t),i18n_text:wd("Minimize"),i18n_title:wd("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===Vc.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:wd("Minimize"),i18n_title:wd("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===Vc.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=Ma(()=>Vc.chatboxviews.trimChats(),250);Qc.listen.on("registeredGlobalEventHandlers",()=>window.addEventListener("resize",r)),Qc.listen.on("unregisteredGlobalEventHandlers",()=>window.removeEventListener("resize",r))}});Qc.elements.define("converse-autocomplete",class extends Kd{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 wc`
<div class="suggestion-box suggestion-box__name">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<input type="text" name="${this.name}"
autocomplete="off"
@keydown=${this.onKeyDown}
@keyup=${this.onKeyUp}
class="form-control suggestion-box__input"
placeholder="${this.placeholder}"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
`}firstUpdated(){this.auto_complete=new Od(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?Ed:Ad,include_triggers:[],list:()=>this.getAutoCompleteList(),match_current_word:!0,max_items:this.max_items,min_chars:this.min_chars}),this.auto_complete.on("suggestion-box-selectcomplete",()=>this.auto_completing=!1)}onKeyDown(e){this.auto_complete.onKeyDown(e)}onKeyUp(e){this.auto_complete.evaluate(e)}});var Hg=e=>{const t=wd("Owner"),n=wd("Admin"),r=wd("Member"),i=wd("Moderator"),s=wd("Visitor");return wc`
<li class="occupant" id="${e.id}" title="${(e=>{const t=wd("This user is a moderator."),n=wd("This user can send messages in this groupchat."),r=wd("This user can NOT send messages in this groupchat."),i=e.jid+" "||"";return"moderator"===e.role?`${i}${t} ${e.hint_occupant}`:"participant"===e.role?`${i}${n} ${e.hint_occupant}`:"visitor"===e.role?`${i}${r} ${e.hint_occupant}`:["visitor","participant","moderator"].includes(e.role)?void 0:`${i}${e.hint_occupant}`})(e)}">
<div class="row no-gutters">
<div class="col-auto">
<div class="occupant-status occupant-${e.show} circle" title="${e.hint_show}"></div>
</div>
<div class="col occupant-nick-badge">
<span class="occupant-nick">${e.nick||e.jid}</span>
<span class="occupant-badges">
${"owner"===e.affiliation?wc`<span class="badge badge-groupchat">${t}</span>`:""}
${"admin"===e.affiliation?wc`<span class="badge badge-info">${n}</span>`:""}
${"member"===e.affiliation?wc`<span class="badge badge-info">${r}</span>`:""}
${"moderator"===e.role?wc`<span class="badge badge-info">${i}</span>`:""}
${"visitor"===e.role?wc`<span class="badge badge-secondary">${s}</span>`:""}
</span>
</div>
</div>
</li>
`};const Vg={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"};const Wg=sl.env.utils;Qc.elements.define("converse-muc-sidebar",class extends Kd{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=>wd("Click to mention %1$s in your message.",e.get("nick")),n=wd("Participants"),r=e.occupants.map(e=>Hg(Object.assign({jid:"",hint_show:Vg[e.get("show")],hint_occupant:t(e)},e.toJSON())));return wc`
<div class="occupants-header">
<i class="hide-occupants fa fa-times"></i>
<div class="occupants-header--title">
<span class="occupants-heading">${n}</span>
</div>
</div>
<div class="dragresize dragresize-occupants-left"></div>
<ul class="occupant-list">${r}</ul>
`})(Object.assign(this.chatroom.toJSON(),{occupants:[...this.occupants.models]}))}shouldShow(){return!this.chatroom.get("hidden_occupants")&&this.chatroom.session.get("connection_status")===sl.ROOMSTATUS.ENTERED}setVisibility(){this.shouldShow()?Wg.showElement(this):Wg.hideElement(this)}});var Gg=e=>{const t=wd("Join"),n=wd("Enter a new Groupchat");return wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="add-chatroom-modal-label">${n}</h5>
${qd}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form add-chatroom">
<div class="form-group">
<label for="chatroom">${e.label_room_address}:</label>
${e.muc_roomid_policy_error_msg?wc`<label class="roomid-policy-error">${e.muc_roomid_policy_error_msg}</label>`:""}
<input type="text" required="required" name="chatroom" class="form-control roomjid-input" placeholder="${e.chatroom_placeholder}"/>
</div>
${e.muc_roomid_policy_hint?wc`<div class="form-group">${df(lf.a.filterXSS(e.muc_roomid_policy_hint,{whiteList:{b:[],br:[],em:[]}}))}</div>`:""}
${e._converse.locked_muc_nickname?"":(e=>{const t=wd("Nickname"),n=wd("This field is required");return wc`
<div class="form-group" >
<label for="nickname">${t}:</label>
<input type="text" title="${n}" required="required" name="nickname" value="${e.nick||""}" class="form-control"/>
</div>
`})(e)}
<input type="submit" class="btn btn-primary" name="join" value="${t||""}" ?disabled=${e.muc_roomid_policy_error_msg}>
</form>
</div>
</div>
</div>
`};const{u:Jg,Strophe:Qg}=sl.env;var Yg=Gd.extend({id:"add-chatroom-modal",events:{"submit form.add-chatroom":"openChatRoom","keyup .roomjid-input":"checkRoomidPolicy","change .roomjid-input":"checkRoomidPolicy"},initialize(){Gd.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(!Qc.settings.get("locked_muc_domain")){const t=this.model.get("muc_domain")||Qc.settings.get("muc_domain");e=t?"name@"+t:wd("name@conference.example.org")}return Gg(Object.assign(this.model.toJSON(),{_converse:Vc,label_room_address:Qc.settings.get("muc_domain")?wd("Groupchat name"):wd("Groupchat address"),chatroom_placeholder:e,muc_roomid_policy_error_msg:this.muc_roomid_policy_error_msg,muc_roomid_policy_hint:Qc.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(Qc.settings.get("locked_muc_nickname")){if(r=Vc.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),Qc.settings.get("locked_muc_domain")||Qc.settings.get("muc_domain")&&!Jg.isValidJID(t.jid)?n=`${Qg.escapeNode(t.jid)}@${Qc.settings.get("muc_domain")}`:(n=t.jid,this.model.setDomain(n)),Qc.rooms.open(n,Object.assign(t,{jid:n}),!0),this.modal.hide(),e.target.reset()},checkRoomidPolicy(){if(Qc.settings.get("muc_roomid_policy")&&Qc.settings.get("muc_domain")){let e=this.el.querySelector(".roomjid-input").value;!sl.locked_muc_domain&&Jg.isValidJID(e)||(e=`${Qg.escapeNode(e)}@${Qc.settings.get("muc_domain")}`);const t=Qg.getNodeFromJid(e),n=Qg.getDomainFromJid(e);Qc.settings.get("muc_domain")!==n||Qc.settings.get("muc_roomid_policy").test(t)?this.muc_roomid_policy_error_msg=null:this.muc_roomid_policy_error_msg=wd("Groupchat id is invalid."),this.render()}}});const Kg=sl.env.utils;var Xg=Gd.extend({id:"muc-invite-modal",initialize(){Gd.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.initInviteWidget()},toHTML(){return(e=>{const t=wd("Invite"),n=wd("Invite someone to this groupchat"),r=wd("user@example.org"),i=wd("Please enter a valid XMPP address"),s=wd("XMPP Address"),o=wd("Optional reason for the invitation");return wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="add-chatroom-modal-label">${n}</h5>
${qd}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<div class="suggestion-box room-invite">
<form @submit=${e.submitInviteForm}>
<div class="form-group">
<label class="clearfix" for="invitee_jids">${s}:</label>
${e.invalid_invite_jid?wc`<div class="error error-feedback">${i}</div>`:""}
<input class="form-control suggestion-box__input"
required="required"
name="invitee_jids"
id="invitee_jids"
placeholder="${r}"
type="text"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
<ul class="suggestion-box__results suggestion-box__results--below" hidden=""></ul>
</div>
<div class="form-group">
<label>${o}:</label>
<textarea class="form-control" name="reason"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">${t}</button>
</div>
</form>
</div>
</div>
</div>
</div>
`})(Object.assign(this.model.toJSON(),{submitInviteForm:e=>this.submitInviteForm(e)}))},initInviteWidget(){this.invite_auto_complete&&this.invite_auto_complete.destroy();const e=Vc.roster.map(e=>({label:e.getDisplayName(),value:e.get("jid")})),t=this.el.querySelector(".suggestion-box").parentElement;this.invite_auto_complete=new Vc.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");Kg.isValidJID(n)?(this.chatroomview.model.directInvite(n,r),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}});var Zg=e=>{const t=wd("Query for Groupchats");return wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="list-chatrooms-modal-label">${t}</h5>
${qd}
</div>
<div class="modal-body d-flex flex-column">
<span class="modal-alert"></span>
${e.show_form?(e=>{const t=wd("Show groupchats"),n=wd("Server address");return wc`
<form class="converse-form list-chatrooms"
@submit=${e.submitForm}>
<div class="form-group">
<label for="chatroom">${n}:</label>
<input type="text"
@change=${e.setDomainFromEvent}
value="${e.muc_domain||""}"
required="required"
name="server"
class="form-control"
placeholder="${e.server_placeholder}"/>
</div>
<input type="submit" class="btn btn-primary" name="list" value="${t}"/>
</form>
`})(e):""}
<ul class="available-chatrooms list-group">
${e.loading_items?wc`<li class="list-group-item"> ${Wh()} </li>`:""}
${e.feedback_text?wc`<li class="list-group-item active">${e.feedback_text}</li>`:""}
${rf(e.items,e=>e.jid,t=>((e,t)=>{const n=wd("Show more information on this groupchat"),r=wd("Click to open this groupchat");return wc`
<li class="room-item list-group-item">
<div class="available-chatroom d-flex flex-row">
<a class="open-room available-room w-100"
@click=${e.openRoom}
data-room-jid="${t.jid}"
data-room-name="${t.name}"
title="${r}"
href="#">${t.name||t.jid}</a>
<a class="right room-info icon-room-info"
@click=${e.toggleRoomInfo}
data-room-jid="${t.jid}"
title="${n}"
href="#"></a>
</div>
</li>
`})(e,t))}
</ul>
</div>
<div class="modal-footer">${Bd}</div>
</div>
</div>
`},em=n(174),tm=n.n(em);const{u:nm,Strophe:rm,$iq:im,sizzle:sm}=sl.env;function om(e){const t=nm.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(nm.slideIn(n).then(nm.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",nm.getElementFromTemplateResult(Wh())),Qc.disco.info(e.target.getAttribute("data-room-jid"),null).then(e=>function(e,t){var n,r;e.querySelector("span.spinner").remove(),e.querySelector("a.room-info").classList.add("selected"),e.insertAdjacentHTML("beforeEnd",tm()({jid:t.getAttribute("from"),desc:null===(n=kf(sm('field[var="muc#roominfo_description"] value',t)))||void 0===n?void 0:n.textContent,occ:null===(r=kf(sm('field[var="muc#roominfo_occupants"] value',t)))||void 0===r?void 0:r.textContent,hidden:sm('feature[var="muc_hidden"]',t).length,membersonly:sm('feature[var="muc_membersonly"]',t).length,moderated:sm('feature[var="muc_moderated"]',t).length,nonanonymous:sm('feature[var="muc_nonanonymous"]',t).length,open:sm('feature[var="muc_open"]',t).length,passwordprotected:sm('feature[var="muc_passwordprotected"]',t).length,persistent:sm('feature[var="muc_persistent"]',t).length,publicroom:sm('feature[var="muc_publicroom"]',t).length,semianonymous:sm('feature[var="muc_semianonymous"]',t).length,temporary:sm('feature[var="muc_temporary"]',t).length,unmoderated:sm('feature[var="muc_unmoderated"]',t).length,label_desc:wd("Description:"),label_jid:wd("Groupchat Address (JID):"),label_occ:wd("Participants:"),label_features:wd("Features:"),label_requires_auth:wd("Requires authentication"),label_hidden:wd("Hidden"),label_requires_invite:wd("Requires an invitation"),label_moderated:wd("Moderated"),label_non_anon:wd("Non-anonymous"),label_open_room:wd("Open"),label_permanent_room:wd("Permanent"),label_public:wd("Public"),label_semi_anon:wd("Semi-anonymous"),label_temp_room:wd("Temporary"),label_unmoderated:wd("Unmoderated")}))}(t,e)).catch(e=>Dn.error(e)))}var am=Gd.extend({id:"list-chatrooms-modal",initialize(){this.items=[],this.loading_items=!1,Gd.prototype.initialize.apply(this,arguments),Qc.settings.get("muc_domain")&&!this.model.get("muc_domain")&&this.model.save("muc_domain",Qc.settings.get("muc_domain")),this.listenTo(this.model,"change:muc_domain",this.onDomainChange),this.el.addEventListener("shown.bs.modal",()=>Qc.settings.get("locked_muc_domain")?this.updateRoomsList():this.el.querySelector('input[name="server"]').focus())},toHTML(){const e=this.model.get("muc_domain")||Qc.settings.get("muc_domain");return Zg(Object.assign(this.model.toJSON(),{show_form:!Qc.settings.get("locked_muc_domain"),server_placeholder:e||wd("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(),Qc.rooms.open(t,{name:n},!0)},toggleRoomInfo(e){e.preventDefault(),om(e)},onDomainChange(){Qc.settings.get("auto_list_rooms")&&this.updateRoomsList()},onRoomsFound(e){this.loading_items=!1;const t=e?sm("query item",e):[];return t.length?(this.model.set({feedback_text:wd("Groupchats found")},{silent:!0}),this.items=t.map(go.getAttributes)):(this.items=[],this.model.set({feedback_text:wd("No groupchats found")},{silent:!0})),this.render(),!0},updateRoomsList(){const e=im({to:this.model.get("muc_domain"),from:Vc.connection.jid,type:"get"}).c("query",{xmlns:rm.NS.DISCO_ITEMS});Qc.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})}});function cm(e){return"moderator"===e?wd("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations."):"participant"===e?wd("The default role, implies that you can read and write messages."):"visitor"==e?wd("Visitors aren't allowed to write messages in a moderated multi-user chat."):void 0}function lm(e){return"owner"===e?wd("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users."):"admin"===e?wd("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners."):"outcast"===e?wd('To ban a user, you give them the affiliation of "outcast".'):void 0}const um=e=>wc`
<li class="list-group-item" data-nick="${e.item.nick}">
<ul class="list-group">
<li class="list-group-item active">
<div><strong>JID:</strong> ${e.item.jid}</div>
</li>
<li class="list-group-item">
<div><strong>Nickname:</strong> ${e.item.nick}</div>
</li>
<li class="list-group-item">
<div><strong>Role:</strong> ${e.item.role} ${e.assignable_roles.length?wc`<a href="#" data-form="role-form" class="toggle-form right fa fa-wrench" @click=${e.toggleForm}></a>`:""}</div>
${e.assignable_roles.length?(e=>{const t=wd("Change role"),n=wd("New Role"),r=wd("Reason");return wc`
<form class="role-form hidden" @submit=${e.assignRole}>
<div class="form-group">
<input type="hidden" name="jid" value="${e.item.jid}"/>
<input type="hidden" name="nick" value="${e.item.nick}"/>
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
<select class="custom-select select-role" name="role">
${e.assignable_roles.map(t=>wc`<option value="${t}" ?selected=${t===e.item.role}>${t}</option>`)}
</select>
</div>
<div class="col">
<label><strong>${r}:</strong></label>
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="${t}"/>
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
`,dm=e=>wc`
<li class="list-group-item" data-nick="${e.item.nick}">
<ul class="list-group">
<li class="list-group-item active">
<div><strong>JID:</strong> ${e.item.jid}</div>
</li>
<li class="list-group-item">
<div><strong>Nickname:</strong> ${e.item.nick}</div>
</li>
<li class="list-group-item">
<div><strong>Affiliation:</strong> ${e.item.affiliation} ${e.assignable_affiliations.length?wc`<a href="#" data-form="affiliation-form" class="toggle-form right fa fa-wrench" @click=${e.toggleForm}></a>`:""}</div>
${e.assignable_affiliations.length?(e=>{const t=wd("Change affiliation"),n=wd("New affiliation"),r=wd("Reason");return wc`
<form class="affiliation-form hidden" @submit=${e.assignAffiliation}>
<div class="form-group">
<input type="hidden" name="jid" value="${e.item.jid}"/>
<input type="hidden" name="nick" value="${e.item.nick}"/>
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
<select class="custom-select select-affiliation" name="affiliation">
${e.assignable_affiliations.map(t=>wc`<option value="${t}" ?selected=${t===e.item.affiliation}>${t}</option>`)}
</select>
</div>
<div class="col">
<label><strong>${r}:</strong></label>
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" name="change" value="${t}"/>
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
`;var hm=e=>{const t=wd("Affiliation"),n=wd("Moderator Tools"),r=wd("No users with that affiliation found."),i=wd("No users with that role found."),s=wd("Type here to filter the search results"),o=wd("Role"),a=wd("Show users"),c=wd("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=wd("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 wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="converse-modtools-modal-label">${n}</h5>
${qd}
</div>
<div class="modal-body d-flex flex-column">
<span class="modal-alert"></span>
${u?(e=>wc`
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="affiliations-tab" href="#affiliations-tabpanel" aria-controls="affiliations-tabpanel" role="tab" data-toggle="tab" @click=${e.switchTab}>Affiliations</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link" id="roles-tab" href="#roles-tabpanel" aria-controls="roles-tabpanel" role="tab" data-toggle="tab" @click=${e.switchTab}>Roles</a>
</li>
</ul>
`)(e):""}
<div class="tab-content">
<div class="tab-pane tab-pane--columns ${e.queryable_affiliations.length?"active":""}" id="affiliations-tabpanel" role="tabpanel" aria-labelledby="affiliations-tab">
<form class="converse-form query-affiliation" @submit=${e.queryAffiliation}>
<p class="helptext pb-3">${l}</p>
<div class="form-group">
<label for="affiliation">
<strong>${t}:</strong>
</label>
<div class="row">
<div class="col">
<select class="custom-select select-affiliation" name="affiliation">
${e.queryable_affiliations.map(t=>(e=>wc`
<option value="${e.item||""}"
?selected=${e.item===e.affiliation}
title="${lm(e.item)}">${e.item}</option>
`)(Object.assign({item:t},e)))}
</select>
</div>
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_affiliation" value="${a}"/>
</div>
</div>
<div class="row">
<div class="col mt-3">
${Array.isArray(e.users_with_affiliation)&&e.users_with_affiliation.length>5?wc`<input class="form-control" .value="${e.affiliations_filter}" @keyup=${e.filterAffiliationResults} type="text" name="filter" placeholder="${s}"/>`:""}
</div>
</div>
${lm(e.affiliation)?wc`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${lm(e.affiliation)}</p></div></div>`:""}
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
${e.loading_users_with_affiliation?wc`<li class="list-group-item"> ${Wh()} </li>`:""}
${Array.isArray(e.users_with_affiliation)&&0===e.users_with_affiliation.length?wc`<li class="list-group-item">${r}</li>`:""}
${e.users_with_affiliation instanceof Error?wc`<li class="list-group-item">${e.users_with_affiliation.message}</li>`:(e.users_with_affiliation||[]).map(t=>(t.nick||t.jid).match(new RegExp(e.affiliations_filter,"i"))?dm(Object.assign({item:t},e)):"")}
</ul>
</div>
</div>
<div class="tab-pane tab-pane--columns ${!u&&e.queryable_roles.length?"active":""}" id="roles-tabpanel" role="tabpanel" aria-labelledby="roles-tab">
<form class="converse-form query-role" @submit=${e.queryRole}>
<p class="helptext pb-3">${c}</p>
<div class="form-group">
<label for="role"><strong>${o}:</strong></label>
<div class="row">
<div class="col">
<select class="custom-select select-role" name="role">
${e.queryable_roles.map(t=>(e=>wc`
<option value="${e.item||""}"
?selected=${e.item===e.role}
title="${cm(e.item)}">${e.item}</option>
`)(Object.assign({item:t},e)))}
</select>
</div>
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_role" value="${a}"/>
</div>
</div>
<div class="row">
<div class="col mt-3">
${Array.isArray(e.users_with_role)&&e.users_with_role.length>5?wc`<input class="form-control" .value="${e.roles_filter}" @keyup=${e.filterRoleResults} type="text" name="filter" placeholder="${s}"/>`:""}
</div>
</div>
${cm(e.role)?wc`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${cm(e.role)}</p></div></div>`:""}
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
${e.loading_users_with_role?wc`<li class="list-group-item"> ${Wh()} </li>`:""}
${e.users_with_role&&0===e.users_with_role.length?wc`<li class="list-group-item">${i}</li>`:""}
${(e.users_with_role||[]).map(t=>t.nick.match(e.roles_filter)?um(Object.assign({item:t},e)):"")}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>`};const{Strophe:fm,sizzle:pm,u:gm}=sl.env;let mm;var vm=Gd.extend({id:"converse-modtools-modal",initialize(e){mm=e._converse,this.chatroomview=e.chatroomview,Gd.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:mm.bare_jid});return hm(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:Jl.filter(e=>!mm.modtools_disable_query.includes(e)),queryable_roles:Gl.filter(e=>!mm.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=Qc.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Jl:[]),"owner"===e.get("affiliation")?Jl.filter(e=>!t.includes(e)):"admin"===e.get("affiliation")?Jl.filter(e=>!["owner","admin",...t].includes(e)):[]},getAssignableRoles(e){let t=Qc.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Gl:[]),"moderator"===e.get("role")?Gl.filter(e=>!t.includes(e)):[]},shouldFetchAffiliationsList(){const e=this.model.get("affiliation");if("none"===e)return!1;return!this.chatroomview.model.occupants.getAutoFetchedAffiliationLists().includes(e)},toggleForm(e){e.stopPropagation(),e.preventDefault();const t=e.target.getAttribute("data-form"),n=gm.ancestor(e.target,".list-group-item").querySelector("."+t);gm.hasClass("hidden",n)?gm.removeClass("hidden",n):gm.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(wd("Timeout error while trying to set the affiliation"),"danger"):pm(`not-allowed[xmlns="${fm.NS.STANZAS}"]`,e).length?this.alert(wd("Sorry, you're not allowed to make that change"),"danger"):this.alert(wd("Sorry, something went wrong while trying to set the affiliation"),"danger"),void Dn.error(e)}this.alert(wd("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(wd("Role changed"),"primary"),this.model.set({role:null},{silent:!0}),this.model.set({role:s})},e=>{pm(`not-allowed[xmlns="${fm.NS.STANZAS}"]`,e).length?this.alert(wd("You're not allowed to make that change"),"danger"):(this.alert(wd("Sorry, something went wrong while trying to set the role"),"danger"),gm.isErrorObject(e)&&Dn.error(e))})}});var _m=e=>{const t=wd("Groupchat address (JID)"),n=wd("Message archiving"),r=wd("Messages are archived on the server"),i=wd("Description"),s=wd("Features"),o=wd("Hidden"),a=wd("This groupchat is not publicly searchable"),c=wd("This groupchat is restricted to members only"),l=wd("Members only"),u=wd("Moderated"),d=wd("Participants entering this groupchat need to request permission to write"),h=wd("Name"),f=wd("This groupchat does not require a password upon entry"),p=wd("No password required"),g=wd("Not anonymous"),m=wd("All other groupchat participants can see your XMPP address"),v=wd("Not moderated"),_=wd("Participants entering this groupchat can write right away"),b=wd("Online users"),y=wd("Open"),w=wd("Anyone can join this groupchat"),S=wd("This groupchat requires a password before entry"),x=wd("Password protected"),E=wd("Persistent"),A=wd("This groupchat persists even if it's unoccupied"),C=wd("Public"),k=wd("Semi-anonymous"),j=wd("Only moderators can see your XMPP address"),T=wd("Temporary"),O=wd("This groupchat will disappear once the last person leaves");return wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="room-details-modal-label">${e.display_name}</h5>
${qd}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<div class="room-info">
<p class="room-info"><strong>${h}</strong>: ${e.name}</p>
<p class="room-info"><strong>${t}</strong>: ${e.jid}</p>
<p class="room-info"><strong>${i}</strong>: ${e.config.description}</p>
${e.subject?(e=>{const t=wd("Topic"),n=wd("Topic author");return wc`
<p class="room-info"><strong>${t}</strong>: ${df(lf.a.filterXSS(e.subject.text,{whiteList:{}}))}</p>
<p class="room-info"><strong>${n}</strong>: ${e.subject&&e.subject.author}</p>
`})(e):""}
<p class="room-info"><strong>${b}</strong>: ${e.num_occupants}</p>
<p class="room-info"><strong>${s}</strong>:
<div class="chatroom-features">
<ul class="features-list">
${e.features.passwordprotected?wc`<li class="feature" ><span class="fa fa-lock"></span>${x} - <em>${S}</em></li>`:""}
${e.features.unsecured?wc`<li class="feature" ><span class="fa fa-unlock"></span>${p} - <em>${f}</em></li>`:""}
${e.features.hidden?wc`<li class="feature" ><span class="fa fa-eye-slash"></span>${o} - <em>${a}</em></li>`:""}
${e.features.public_room?wc`<li class="feature" ><span class="fa fa-eye"></span>${C} - <em>${e.__("This groupchat is publicly searchable")}</em></li>`:""}
${e.features.membersonly?wc`<li class="feature" ><span class="fa fa-address-book"></span>${l} - <em>${c}</em></li>`:""}
${e.features.open?wc`<li class="feature" ><span class="fa fa-globe"></span>${y} - <em>${w}</em></li>`:""}
${e.features.persistent?wc`<li class="feature" ><span class="fa fa-save"></span>${E} - <em>${A}</em></li>`:""}
${e.features.temporary?wc`<li class="feature" ><span class="fa fa-snowflake-o"></span>${T} - <em>${O}</em></li>`:""}
${e.features.nonanonymous?wc`<li class="feature" ><span class="fa fa-id-card"></span>${g} - <em>${m}</em></li>`:""}
${e.features.semianonymous?wc`<li class="feature" ><span class="fa fa-user-secret"></span>${k} - <em>${j}</em></li>`:""}
${e.features.moderated?wc`<li class="feature" ><span class="fa fa-gavel"></span>${u} - <em>${d}</em></li>`:""}
${e.features.unmoderated?wc`<li class="feature" ><span class="fa fa-info-circle"></span>${v} - <em>${_}</em></li>`:""}
${e.features.mam_enabled?wc`<li class="feature" ><span class="fa fa-database"></span>${n} - <em>${r}</em></li>`:""}
</ul>
</div>
</p>
</div>
</div>
<div class="modal-footer">${Bd}</div>
</div>
</div>
`},bm=Gd.extend({id:"room-details-modal",initialize(){Gd.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 _m(Object.assign(this.model.toJSON(),{config:this.model.config.toJSON(),display_name:wd("Groupchat info for %1$s",this.model.getDisplayName()),features:this.model.features.toJSON(),num_occupants:this.model.occupants.length}))}});var ym=e=>{const t=wd("You're not allowed to send messages in this room");return e.entered?e.can_edit?wc`
<div class="emoji-picker__container dropup"></div>
<div class="message-form-container">`:wc`<div class="muc-bottom-panel">${t}</div>`:wc`<div class="muc-bottom-panel"></div>`};var wm=(e,t)=>{const n=wd("This groupchat no longer exists");return wc`
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${n}</h3>
${t?wc`<p class="destroyed-reason">"${t}"</p>`:""}
${e?(e=>{const t=wd("The conversation has moved. Click below to enter.");return wc`
<p class="moved-label">${t}</p>
<p class="moved-link"><a class="switch-chat" href="#">${e}</a></p>`})(e):""}
</div>`};const Sm=sl.env.utils;var xm=e=>{const t=wd("Hide the groupchat topic"),n=wd("This groupchat is bookmarked"),r=e.subject?Sm.addHyperlinks(e.subject.text):"",i=r&&!e.subject_hidden;return wc`
<div class="chatbox-title ${i?"":"chatbox-title--no-desc"}">
${e._converse.api.settings.get("singleton")?"":wc`<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>`}
<div class="chatbox-title__text" title="${"hidden"!==e._converse.locked_muc_domain?e.jid:""}">${e.title}
${e.bookmarked?wc`<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="${n}"></i>`:""}
</div>
<div class="chatbox-title__buttons row no-gutters">
${e.standalone_btns.length?(e=>e.standalone_btns.reverse().map(e=>th(e,"")))(e):""}
${e.dropdown_btns.length?wc`<converse-dropdown .items=${e.dropdown_btns}></converse-dropdown>`:""}
</div>
</div>
${i?wc`<p class="chat-head__desc" title="${t}">${r}</p>`:""}
`};
/**
* @module converse-muc-views
* @copyright 2020, the Converse.js contributors
* @description XEP-0045 Multi-User Chat Views
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Em,sizzle:Am,$pres:Cm}=sl.env,km=sl.env.utils,jm=["owner"],Tm=["admin","ban","deop","destroy","member","op","revoke"],Om=["kick","mute","voice","modtools"],Nm=["nick"],Im={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"},Mm={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"},Rm=tg.extend({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",Ma(()=>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 Vc.api.user.settings.getModel();this.listenTo(e,"change:mucs_with_hidden_subject",this.renderHeading),this.onConnectionStatusChanged(),this.model.maybeShow(),this.scrollDown(),Qc.trigger("chatRoomViewInitialized",this)},async render(){const e=!this.shouldShowSidebar();var t;this.el.setAttribute("id",this.model.get("box_id")),bc((t={sidebar_hidden:e,model:this.model,occupants:this.model.occupants,show_sidebar:!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===sl.ROOMSTATUS.ENTERED,markScrolled:e=>this.markScrolled(e),muc_show_logs_before_join:Qc.settings.get("muc_show_logs_before_join"),show_send_button:Vc.show_send_button},wc`
<div class="flyout box-flyout">
<div class="chat-head chat-head-chatroom row no-gutters"></div>
<div class="chat-body chatroom-body row no-gutters">
<div class="chat-area col">
<div class="chat-content ${t.show_send_button?"chat-content-sendbutton":""}" aria-live="polite">
<div class="chat-content__messages" @scroll=${t.markScrolled}></div>
<div class="chat-content__help"></div>
</div>
<div class="bottom-panel"></div>
</div>
<div class="disconnect-container hidden"></div>
<converse-muc-sidebar class="occupants col-md-3 col-4 ${t.sidebar_hidden?"hidden":""}"
.occupants=${t.occupants}
.chatroom=${t.model}></converse-muc-sidebar>
</div>
</div>
`),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(),Qc.settings.get("muc_show_logs_before_join")||this.model.session.get("connection_status")===sl.ROOMSTATUS.ENTERED||this.showSpinner(),await this.renderHeading(),!this.model.get("hidden")&&this.show()},getNotifications(){const e=this.model.notifications.toJSON();return(Qc.settings.get("muc_show_join_leave")?[...sl.CHAT_STATES,...sl.MUC_TRAFFIC_STATES,...sl.MUC_ROLE_CHANGES]:sl.CHAT_STATES).reduce((t,n)=>{const r=e[n];if(null==r||!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`${t}${wd("%1$s is typing",i[0])}\n`;if("paused"===n)return`${t}${wd("%1$s has stopped typing",i[0])}\n`;if(n===Vc.GONE)return`${t}${wd("%1$s has gone away",i[0])}\n`;if("entered"===n)return`${t}${wd("%1$s has entered the groupchat",i[0])}\n`;if("exited"===n)return`${t}${wd("%1$s has left the groupchat",i[0])}\n`;if("op"===n)return`${t}${wd("%1$s is now a moderator",i[0])}\n`;if("deop"===n)return`${t}${wd("%1$s is no longer a moderator",i[0])}\n`;if("voice"===n)return`${t}${wd("%1$s has been given a voice",i[0])}\n`;if("mute"===n)return`${t}${wd("%1$s has been muted",i[0])}\n`}else if(i.length>1){let e;if(i.length>3)e=Array.from(i).slice(0,2).join(", ")+" and others";else{const t=i.pop();e=wd("%1$s and %2$s",i.join(", "),t)}if("composing"===n)return`${t}${wd("%1$s are typing",e)}\n`;if("paused"===n)return`${t}${wd("%1$s have stopped typing",e)}\n`;if(n===Vc.GONE)return`${t}${wd("%1$s have gone away",e)}\n`;if("entered"===n)return`${t}${wd("%1$s have entered the groupchat",e)}\n`;if("exited"===n)return`${t}${wd("%1$s have left the groupchat",e)}\n`;if("op"===n)return`${t}${wd("%1$s are now moderators",i[0])}\n`;if("deop"===n)return`${t}${wd("%1$s are no longer moderators",i[0])}\n`;if("voice"===n)return`${t}${wd("%1$s have been given voices",i[0])}\n`;if("mute"===n)return`${t}${wd("%1$s have been muted",i[0])}\n`}return t},"")},getHelpMessages(){const e=Qc.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return["<strong>/admin</strong>: "+wd("Change user's affiliation to admin"),"<strong>/ban</strong>: "+wd("Ban user by changing their affiliation to outcast"),"<strong>/clear</strong>: "+wd("Clear the chat area"),"<strong>/close</strong>: "+wd("Close this groupchat"),"<strong>/deop</strong>: "+wd("Change user role to participant"),"<strong>/destroy</strong>: "+wd("Remove this groupchat"),"<strong>/help</strong>: "+wd("Show this menu"),"<strong>/kick</strong>: "+wd("Kick user from groupchat"),"<strong>/me</strong>: "+wd("Write in 3rd person"),"<strong>/member</strong>: "+wd("Grant membership to a user"),"<strong>/modtools</strong>: "+wd("Opens up the moderator tools GUI"),"<strong>/mute</strong>: "+wd("Remove user's ability to post messages"),"<strong>/nick</strong>: "+wd("Change your nickname"),"<strong>/op</strong>: "+wd("Grant moderator role to user"),"<strong>/owner</strong>: "+wd("Grant ownership of this groupchat"),"<strong>/register</strong>: "+wd("Register your nickname"),"<strong>/revoke</strong>: "+wd("Revoke the user's current affiliation"),"<strong>/subject</strong>: "+wd("Set groupchat subject"),"<strong>/topic</strong>: "+wd("Set groupchat subject (alias for /subject)"),"<strong>/voice</strong>: "+wd("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();bc(e,this.el.querySelector(".chat-head-chatroom"))},renderBottomPanel(){const e=this.el.querySelector(".bottom-panel"),t=this.model.session.get("connection_status")===sl.ROOMSTATUS.ENTERED,n=t&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());bc(ym({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)};Vc.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:"@"+e}))},getAutoCompleteListItem(e,t){t=t.trim();const n=document.createElement("li");if(n.setAttribute("aria-selected","false"),Qc.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let r="data:"+Vc.DEFAULT_IMAGE_TYPE+";base64,"+Vc.DEFAULT_IMAGE;if(Vc.vcards){const t=Vc.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 Vc.AutoComplete(this.el,{auto_first:!0,auto_evaluate:!1,min_chars:Qc.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==Qc.settings.get("muc_mention_autocomplete_filter")?Vc.FILTER_CONTAINS:Vc.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 Vc.ChatBoxView.prototype.onKeyDown.call(this,e)},onKeyUp(e){return this.mention_auto_complete.evaluate(e),Vc.ChatBoxView.prototype.onKeyUp.call(this,e)},async onMessageRetractButtonClicked(e){const t=wd("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=[wd("Are you sure you want to retract this message?")];Qc.settings.get("show_retraction_warning")&&(n[1]=t),await Qc.confirm(wd("Confirm"),n)&&this.model.retractOwnMessage(e)}else if(await e.mayBeModerated())if("me"===e.get("sender")){let n=[wd("Are you sure you want to retract this message?")];Qc.settings.get("show_retraction_warning")&&(n=[n[0],t,n[1]]),await Qc.confirm(wd("Confirm"),n)&&this.retractOtherMessage(e)}else{let n=[wd("You are about to retract this message."),wd("You may optionally include a message, explaining the reason for the retraction.")];Qc.settings.get("show_retraction_warning")&&(n=[n[0],t,n[1]]);const r=await Qc.prompt(wd("Message Retraction"),n,wd("Optional reason"));!1!==r&&this.retractOtherMessage(e,r)}else{const e=wd("Sorry, you're not allowed to retract this message");Qc.alert("error",wd("Error"),e)}},async retractOtherMessage(e,t){const n=await this.model.retractOtherMessage(e,t);if(null===n){const e=wd("A timeout occurred while trying to retract the message");Qc.alert("error",wd("Error"),e),Dn(e,Em.LogLevel.WARN)}else if(km.isErrorStanza(n)){const e=wd("Sorry, you're not allowed to retract this message.");Qc.alert("error",wd("Error"),e),Dn(e,Em.LogLevel.WARN),Dn(n,Em.LogLevel.WARN)}},showModeratorToolsModal(e){if(this.verifyRoles(["moderator"])){if(void 0===this.model.modtools_modal){const t=new Bs({affiliation:e});this.modtools_modal=new vm({model:t,_converse:Vc,chatroomview:this})}else this.modtools_modal.set("affiliation",e);this.modtools_modal.show()}},showRoomDetailsModal(e){e.preventDefault(),void 0===this.model.room_details_modal&&(this.model.room_details_modal=new bm({model:this.model})),this.model.room_details_modal.show(e)},showChatStateNotification(e){if("me"!==e.get("sender"))return Vc.ChatBoxView.prototype.showChatStateNotification.apply(this,arguments)},shouldShowSidebar(){return!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===sl.ROOMSTATUS.ENTERED},onSidebarToggle(){var e;this.renderToolbar(),null===(e=this.el.querySelector(".occupants"))||void 0===e||e.setVisibility()},onOccupantAffiliationChanged(e){e.get("jid")===Vc.bare_jid&&this.renderHeading()},onOccupantRoleChanged(e){e.get("jid")===Vc.bare_jid&&this.renderBottomPanel()},getHeadingButtons(e){const t=[];t.push({i18n_text:wd("Details"),i18n_title:wd("Show more information about this groupchat"),handler:e=>this.showRoomDetailsModal(e),a_class:"show-room-details-modal",icon_class:"fa-info-circle",name:"details"}),"owner"===this.model.getOwnAffiliation()&&t.push({i18n_text:wd("Configure"),i18n_title:wd("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:wd("Invite"),i18n_title:wd("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");n&&n.text&&t.push({i18n_text:wd(e?"Show topic":"Hide topic"),i18n_title:wd(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"});if(this.model.session.get("connection_status")===sl.ROOMSTATUS.ENTERED){const e=this.getAllowedCommands();e.includes("modtools")&&t.push({i18n_text:wd("Moderate"),i18n_title:wd("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:wd("Destroy"),i18n_title:wd("Remove this groupchat"),handler:e=>this.destroy(e),a_class:"destroy-chatroom-button",icon_class:"fa-trash",name:"destroy"})}return Qc.settings.get("singleton")||t.push({i18n_text:wd("Leave"),i18n_title:wd("Leave and close this groupchat"),handler:async e=>{e.stopPropagation();const t=[wd("Are you sure you want to leave this groupchat?")];await Qc.confirm(wd("Confirm"),t)&&this.close(e)},a_class:"close-chatbox-button",standalone:"overlayed"===Qc.settings.get("view_mode"),icon_class:"fa-sign-out-alt",name:"signout"}),Vc.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 xm(Object.assign(this.model.toJSON(),{_converse:Vc,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(),void 0===this.muc_invite_modal&&(this.muc_invite_modal=new Xg({model:new Bs}),this.muc_invite_modal.chatroomview=this),this.muc_invite_modal.show(e)},afterShown(){km.isPersistableModel(this.model)&&this.model.clearUnreadMsgCounter(),this.scrollDown()},onConnectionStatusChanged(){const e=this.model.session.get("connection_status");e===sl.ROOMSTATUS.NICKNAME_REQUIRED?this.renderNicknameForm():e===sl.ROOMSTATUS.PASSWORD_REQUIRED?this.renderPasswordForm():e===sl.ROOMSTATUS.CONNECTING?this.showSpinner():e===sl.ROOMSTATUS.ENTERED?(this.renderBottomPanel(),this.hideSpinner(),this.maybeFocus()):e===sl.ROOMSTATUS.DISCONNECTED?this.showDisconnectMessage():e===sl.ROOMSTATUS.DESTROYED&&this.showDestroyedMessage()},getToolbarOptions(){return Object.assign(Vc.ChatBoxView.prototype.getToolbarOptions.apply(this,arguments),{is_groupchat:!0,label_hide_occupants:wd("Hide the list of participants"),show_occupants_toggle:Vc.visible_toolbar_buttons.toggle_occupants})},async close(){return this.hide(),Vc.router.history.getFragment()==="converse/room?jid="+this.model.get("jid")&&Vc.router.navigate(""),await this.model.leave(),Vc.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:Vc.bare_jid})){const n=t.get("role");if(e.includes(n))return!0}if(n){const e=wd("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:Vc.bare_jid})){const n=t.get("affiliation");if(e.includes(n))return!0}if(n){const e=wd("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=wd('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(km.isValidJID(e.trim()))return e.trim();e.startsWith("@")||(e="@"+e);const[t,n]=this.model.parseTextForReferences(e);if(!n.length){const e=wd("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=wd("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=wd("Error: couldn't find a groupchat participant based on your arguments");this.model.createMessage({message:e,type:"error"})}},setAffiliation(e,t,n){const r=Mm[e];if(!r)throw Error("ChatRoomView#setAffiliation called with invalid command: "+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(!km.isValidJID(i)){const e=wd("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&&Qc.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=Im[e];if(!i)throw Error("ChatRoomView#setRole called with invalid command: "+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){Dn.fatal(e);const t=wd("Sorry, an error happened while running the command.")+" "+wd("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:Vc.bare_jid});return this.verifyAffiliations(["owner"],t,!1)?e=e.concat(jm).concat(Tm):this.verifyAffiliations(["admin"],t,!1)&&(e=e.concat(Tm)),this.verifyRoles(["moderator"],t,!1)?e=e.concat(Om).concat(Nm):this.verifyRoles(["visitor","participant","moderator"],t,!1)||(e=e.concat(Nm)),e.sort(),Array.isArray(Qc.settings.get("muc_disable_slash_commands"))?e.filter(e=>!Qc.settings.get("muc_disable_slash_commands").includes(e)):e},async destroy(){const e=[wd("Are you sure you want to destroy this groupchat?")];let t=[{name:"challenge",label:wd("Please enter the XMPP address of this groupchat to confirm"),challenge:this.model.get("jid"),placeholder:wd("name@example.org"),required:!0},{name:"reason",label:wd("Optional reason for destroying this groupchat"),placeholder:wd("Reason")},{name:"newjid",label:wd("Optional XMPP address for a new groupchat that replaces this one"),placeholder:wd("replacement@example.org")}];try{var n,r;t=await Qc.confirm(wd("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){Dn.error(e)}},parseMessageForCommands(e){if(Qc.settings.get("muc_disable_slash_commands")&&!Array.isArray(Qc.settings.get("muc_disable_slash_commands")))return Vc.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=wd('Your nickname is "%1$s"',this.model.get("nick"));this.model.createMessage({message:e,type:"error"})}else{const e=Em.getBareJidFromJid(this.model.get("jid"));Qc.send(Cm({from:Vc.connection.jid,to:`${e}/${n}`,id:km.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:wd("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 Vc.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 Vc.MUCConfigForm({model:this.model,chatroomview:this});this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.config_form.el)}km.showElement(this.config_form.el)},renderNicknameForm(){const e=(e=>{const t=wd("Nickname"),n=wd("Enter groupchat"),r=Qc.settings.get("muc_show_logs_before_join")?wd("Choose a nickname to enter"):wd("Please choose your nickname");return wc`
<div class="chatroom-form-container muc-nickname-form">
<form class="converse-form chatroom-form converse-centered-form">
<fieldset class="form-group">
<label>${r}</label>
<p class="validation-message">${e.nickname_validation_message}</p>
<input type="text"
required="required"
name="nick"
value="${e.nick||""}"
class="form-control ${e.nickname_validation_message?"error":""}"
placeholder="${t}"/>
</fieldset>
<fieldset class="form-group">
<input type="submit" class="btn btn-primary" name="join" value="${n}"/>
</fieldset>
</form>
</div>`})(this.model.toJSON());if(Qc.settings.get("muc_show_logs_before_join")){const t=this.el.querySelector(".muc-bottom-panel");bc(e,t),km.addClass("muc-bottom-panel--nickname",t)}else{const t=this.el.querySelector(".muc-nickname-form"),n=km.getElementFromTemplateResult(e);if(t)Am(".spinner",this.el).forEach(km.removeElement),t.outerHTML=n.outerHTML;else{this.hideChatRoomContents();this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",n)}}km.safeSave(this.model.session,{connection_status:sl.ROOMSTATUS.NICKNAME_REQUIRED})},closeForm(){Am(".chatroom-form-container",this.el).forEach(e=>km.addClass("hidden",e)),this.renderAfterTransition()},getAndRenderConfigurationForm(){this.config_form&&km.isVisible(this.config_form.el)?this.closeForm():(this.showSpinner(),this.model.fetchRoomConfiguration().then(e=>this.renderConfigurationForm(e)).catch(e=>Dn.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 Vc.MUCPasswordForm({model:new Bs({validation_message:e}),chatroomview:this});this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.password_form.el)}km.showElement(this.password_form.el),this.model.session.save("connection_status",sl.ROOMSTATUS.PASSWORD_REQUIRED)},showDestroyedMessage(){km.hideElement(this.el.querySelector(".chat-area")),km.hideElement(this.el.querySelector(".occupants")),Am(".spinner",this.el).forEach(km.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");bc(wm(t,e),n);const r=n.querySelector("a.switch-chat");r&&r.addEventListener("click",async e=>{e.preventDefault();(await Qc.rooms.get(t,null,!0)).maybeShow(!0),this.model.destroy()}),km.showElement(n)},showDisconnectMessage(){const e=this.model.get("disconnection_message");if(!e)return;km.hideElement(this.el.querySelector(".chat-area")),km.hideElement(this.el.querySelector(".occupants")),Am(".spinner",this.el).forEach(km.removeElement);const t=[e],n=this.model.get("disconnection_actor");n&&t.push(wd("This action was done by %1$s.",n));const r=this.model.get("disconnection_reason");r&&t.push(wd('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");bc((e=>wc`
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${e[0]}</h3>
${e.slice(1).map(e=>wc`<p class="disconnect-msg">${e}</p>`)}
</div>`)(t),i),km.showElement(i)},onOccupantAdded(e){e.get("jid")===Vc.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==sl.ROOMSTATUS.NICKNAME_REQUIRED)this.renderNicknameForm();else if(e==sl.ROOMSTATUS.PASSWORD_REQUIRED)this.renderPasswordForm();else if(e==sl.ROOMSTATUS.ENTERED){var t;this.hideChatRoomContents(),km.showElement(this.el.querySelector(".chat-area")),null===(t=this.el.querySelector(".occupants"))||void 0===t||t.setVisibility(),this.scrollDown()}},showSpinner(){Am(".spinner",this.el).forEach(km.removeElement),this.hideChatRoomContents();this.el.querySelector(".chatroom-body").insertAdjacentElement("afterbegin",km.getElementFromTemplateResult(Wh()))},hideSpinner(){const e=this.el.querySelector(".spinner");return null!==e&&(km.removeElement(e),this.renderAfterTransition()),this}}),$m=Md.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:wd("Groupchats"),title_new_room:wd("Add a new groupchat"),title_list_rooms:wd("Query for groupchats")},wc`
<div class="d-flex controlbox-padded">
<span class="w-100 controlbox-heading controlbox-heading--groupchats">${e.heading_chatrooms}</span>
<a class="controlbox-heading__btn show-list-muc-modal fa fa-list-ul" title="${e.title_list_rooms}" data-toggle="modal" data-target="#list-chatrooms-modal"></a>
<a class="controlbox-heading__btn show-add-muc-modal fa fa-plus" title="${e.title_new_room}" data-toggle="modal" data-target="#add-chatrooms-modal"></a>
</div>
<div class="list-container list-container--openrooms hidden"></div>
<div class="list-container list-container--bookmarks hidden"></div>`;var e},showAddRoomModal(e){void 0===this.add_room_modal&&(this.add_room_modal=new Yg({model:this.model})),this.add_room_modal.show(e)},showMUCListModal(e){void 0===this.muc_list_modal&&(this.muc_list_modal=new am({model:this.model})),this.muc_list_modal.show(e)}});sl.plugins.add("converse-muc-views",{dependencies:["converse-autocomplete","converse-modal","converse-controlbox","converse-chatview"],overrides:{ControlBoxView:{renderControlBoxPane(){this.__super__.renderControlBoxPane.apply(this,arguments),Qc.settings.get("allow_muc")&&this.renderRoomsPanel()}}},initialize(){const{_converse:e}=this;Qc.promises.add(["roomsPanelRendered"]),Qc.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.ChatRoomView=Rm,e.RoomsPanel=$m;const t={renderRoomsPanel(){if(this.roomspanel&&km.isInDOM(this.roomspanel.el))return this.roomspanel;const t="converse.roomspanel"+e.bare_jid;return this.roomspanel=new e.RoomsPanel({model:new(e.RoomsPanelModel.extend({id:t,browserStorage:e.createStore(t)}))}),this.roomspanel.model.fetch(),this.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd",this.roomspanel.render().el),Qc.trigger("roomsPanelRendered"),this.roomspanel},getRoomsPanel(){return this.roomspanel&&km.isInDOM(this.roomspanel.el)?this.roomspanel:this.renderRoomsPanel()}};function n(e,t){t.getRoomsPanel().model.save("muc_domain",Em.getDomainFromJid(e))}function r(t){t.model.get("connected")&&(t.getRoomsPanel().model.get("muc_domain")||(void 0===Qc.settings.get("muc_domain")?function(t){function r(e){e&&e.get("var")===Em.NS.MUC&&e.entity.getIdentity("conference","text").then(r=>{r&&n(e.get("from"),t)})}Qc.waitUntil("discoInitialized").then(()=>{Qc.listen.on("serviceDiscovered",r),e.disco_entities.each(e=>r(e.features.findWhere({var:Em.NS.MUC})))}).catch(e=>Dn.error(e))}(t):n(Qc.settings.get("muc_domain"),t)))}e.ControlBoxView&&Object.assign(e.ControlBoxView.prototype,t),e.MUCConfigForm=Md.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=km.toStanza(this.model.get("config_stanza")),r=Qc.settings.get("roomconfig_whitelist");let i=Am("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=wd("Save"),n=wd("Cancel");return wc`
<form class="converse-form chatroom-form" autocomplete="off" @submit=${e.submitConfigForm}>
<fieldset class="form-group">
<legend>${e.title}</legend>
${e.title!==e.instructions?wc`<p class="form-help">${e.instructions}</p>`:""}
<!-- Fields are generated internally, with xForm2webForm -->
${e.fields.map(e=>df(e))}
</fieldset>
<fieldset>
<input type="submit" class="btn btn-primary" value="${t}">
<input type="button" class="btn btn-secondary button-cancel" value="${n}" @click=${e.closeConfigForm}>
</fieldset>
</form>
`})({closeConfigForm:e=>this.closeConfigForm(e),fields:i.map(e=>km.xForm2webForm(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=Am(":input:not([type=button]):not([type=submit])",e.target).map(km.webForm2xForm).filter(e=>e);try{await this.model.sendConfiguration(t)}catch(e){Dn.error(e);const t=wd("Sorry, an error occurred while trying to submit the config form.")+" "+wd("Check your browser's developer console for details.");Qc.alert("error",wd("Error"),t)}await this.model.refreshDiscoInfo(),this.chatroomview.closeForm()},closeConfigForm(e){e.preventDefault(),this.chatroomview.closeForm()}}),e.MUCPasswordForm=Md.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=wd("This groupchat requires a password"),n=wd("Password: "),r=wd("Submit");return wc`
<form class="converse-form chatroom-form converse-centered-form" @submit=${e.submitPassword}>
<fieldset class="form-group">
<label>${t}</label>
<p class="validation-message">${e.validation_message}</p>
<input class="hidden-username" type="text" autocomplete="username" value="${e.jid}"></input>
<input type="password"
name="password"
required="required"
class="form-control ${e.validation_message?"error":""}"
placeholder="${n}"/>
</fieldset>
<fieldset class="form-group">
<input class="btn btn-primary" type="submit" value="${r}"/>
</fieldset>
</form>
`})({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)}}),Qc.listen.on("chatBoxViewsInitialized",()=>{e.chatboxviews.delegate("click","a.open-chatroom",(function(e){e.preventDefault(),Qc.rooms.open(e.target.href)})),e.chatboxes.on("add",(async function(t){const n=e.chatboxviews;if(!n.get(t.get("id"))&&t.get("type")===e.CHATROOMS_TYPE&&t.isValid())return await t.initialized,n.add(t.get("id"),new e.ChatRoomView({model:t}))}))}),Qc.listen.on("clearSession",()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)}),Qc.listen.on("controlBoxInitialized",e=>{Qc.settings.get("allow_muc")&&(r(e),e.model.on("change:connected",()=>r(e)))}),Object.assign(e.api,{roomviews:{get(t){if(Array.isArray(t)){return Qc.chatviews.get(t).filter(t=>t.model.get("type")===e.CHATROOMS_TYPE)}{const n=Qc.chatviews.get(t);return n.model.get("type")===e.CHATROOMS_TYPE?n:null}},close(t){let n;return void 0===t?n=e.chatboxviews:"string"==typeof t?n=[e.chatboxviews.get(t)].filter(e=>e):Array.isArray(t)&&(n=t.map(t=>e.chatboxviews.get(t))),Promise.all(n.map(e=>e.is_chatroom&&e.model&&e.close()))}}})}});var Dm=e=>wc`
<div class="list-container list-container--headline ${e.headlineboxes.length?"":"hidden"}">
<div class="items-list rooms-list headline-list">
${e.headlineboxes.map(t=>(e=>wc`
<div class="list-item controlbox-padded d-flex flex-row"
data-headline-jid="${e.headlinebox.get("jid")}">
<a class="list-item-link open-headline available-room w-100"
data-headline-jid="${e.headlinebox.get("jid")}"
title="${e.open_title}" href="#">${e.headlinebox.get("jid")}</a>
</div>
`)(Object.assign({headlinebox:t},e)))}
</div>
</div>
`;
/**
* @module converse-headlines-view
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const Pm=sl.env.utils,Lm=tg.extend({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(),Qc.trigger("headlinesBoxViewInitialized",this)},render(){this.el.setAttribute("id",this.model.get("box_id"));const e=Qp(Object.assign(this.model.toJSON(),{info_close:"",label_personal_message:"",show_send_button:!1,show_toolbar:!1,unread_msgs:""}));return bc(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 Qc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:wd("Close"),i18n_title:wd("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Qc.settings.get("view_mode")}),Vc.api.hook("getHeadingButtons",this,e)},renderMessageForm:function(){},afterShown:function(){}}),zm=Md.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:wd("Announcements"),headlineboxes:this.model.filter(e=>e.get("type")===Vc.HEADLINES_TYPE),open_title:wd("Click to open this server message")},wc`
<div class="d-flex controlbox-padded ${e.headlineboxes.length?"":"hidden"}">
<span class="w-100 controlbox-heading controlbox-heading--headline">${e.heading_headline}</span>
</div>
${Dm(e)}
`;var e},renderIfHeadline(e){return e&&e.get("type")===Vc.HEADLINES_TYPE&&this.render()},openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");Vc.chatboxes.get(t).maybeShow(!0)},insertIntoDOM(){const e=Vc.chatboxviews.get("controlbox");e&&e.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd",this.el)}});sl.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],overrides:{ControlBoxView:{renderControlBoxPane(){this.__super__.renderControlBoxPane.apply(this,arguments),this.renderHeadlinesPanel()}}},initialize(){const e={renderHeadlinesPanel(){return this.headlinepanel&&Pm.isInDOM(this.headlinepanel.el)||(this.headlinepanel=new Vc.HeadlinesPanel({model:Vc.chatboxes}),Qc.trigger("headlinesPanelRendered")),this.headlinepanel}};Vc.ControlBoxView&&Object.assign(Vc.ControlBoxView.prototype,e),Vc.HeadlinesBoxView=Lm,Vc.HeadlinesPanel=zm,Qc.listen.on("chatBoxViewsInitialized",()=>{const e=Vc.chatboxviews;Vc.chatboxes.on("add",t=>{e.get(t.get("id"))||t.get("type")!==Vc.HEADLINES_TYPE||e.add(t.get("id"),new Vc.HeadlinesBoxView({model:t}))})})}});var Fm=n(175),Bm=n.n(Fm);
/**
* @module converse-notification
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:qm}=sl.env,Um=sl.env.utils,Hm="Notification"in window;let Vm;function Wm(){if(Qc.settings.get("update_title")){var e;Vm=null!==(e=Vm)&&void 0!==e?e:new sl.env.Favico({type:"circle",animation:"pop"});const t=Vc.chatboxes.models.reduce((e,t)=>e+(t.get("num_unread")||0),0);Vm.badge(t)}}sl.env.Favico=Bm.a,sl.plugins.add("converse-notification",{dependencies:["converse-chatboxes"],initialize(){Qc.settings.extend({update_title:!0,notify_all_room_messages:!1,show_desktop_notifications:!0,show_chat_state_notifications:!1,chatstate_notification_blacklist:[],play_sounds:!0,sounds_path:Qc.settings.get("assets_path")+"/sounds/",notification_icon:"logo/conversejs-filled.svg",notification_delay:5e3,notify_nicknames_without_references:!1}),Vc.shouldNotifyOfGroupMessage=function(e){if(null==e||!e.body)return!1;const t=e.from,n=e.from_muc,r=Qc.settings.get("notify_all_room_messages"),i=Vc.chatboxes.get(n),s=qm.getResourceFromJid(t),o=s&&qm.unescapeNode(s)||"";let a=!1;const c=i.get("nick");Qc.settings.get("notify_nicknames_without_references")&&(a=new RegExp(`\\b${c}\\b`).test(e.body));const l=e.references.map(e=>e.value).includes(c),u=o!==c,d=!0===r||Array.isArray(r)&&r.includes(n)||l||a;return u&&!!d},Vc.isMessageToHiddenChat=function(e){var t,n;return null!==(t=null===(n=Vc.chatboxes.get(e.from))||void 0===n?void 0:n.isHidden())&&void 0!==t&&t},Vc.shouldNotifyOfMessage=function(e){const{attrs:t,stanza:n}=e;if(!t||null!==n.querySelector("forwarded"))return!1;if("groupchat"===t.type)return Vc.shouldNotifyOfGroupMessage(t);if(t.is_headline)return Vc.isMessageToHiddenChat(t);const r=qm.getBareJidFromJid(t.from)===Vc.bare_jid;return!Um.isOnlyChatStateNotification(n)&&!Um.isOnlyMessageDeliveryReceipt(n)&&!r&&("all"===Qc.settings.get("show_desktop_notifications")||Vc.isMessageToHiddenChat(t))},Vc.playSoundNotification=function(){if(Qc.settings.get("play_sounds")&&void 0!==window.Audio){const e=new Audio(Qc.settings.get("sounds_path")+"msg_received.ogg"),t=e.canPlayType("audio/ogg");if("probably"===t)return e.play();const n=new Audio(Qc.settings.get("sounds_path")+"msg_received.mp3"),r=n.canPlayType("audio/mp3");"probably"===r?n.play():"maybe"===t?e.play():"maybe"===r&&n.play()}},Vc.areDesktopNotificationsEnabled=function(){return Hm&&Qc.settings.get("show_desktop_notifications")&&"granted"===Notification.permission},Vc.showMessageNotification=function(e){const{attrs:t}=e;if(t.is_error)return;if(!Vc.areDesktopNotificationsEnabled())return;let n,r;const i=t.from,s=qm.getBareJidFromJid(i);if("headline"===t.type){if(s.includes("@")&&!Qc.settings.get("allow_non_roster_messaging"))return;n=wd("Notification from %1$s",s)}else if(s.includes("@"))if("groupchat"===t.type)n=wd("%1$s says",qm.getResourceFromJid(i));else{if(void 0===Vc.roster)return void Dn.error("Could not send notification, because roster is undefined");if(r=Vc.roster.get(s),void 0!==r)n=wd("%1$s says",r.getDisplayName());else{if(!Qc.settings.get("allow_non_roster_messaging"))return;n=wd("%1$s says",s)}}else n=wd("Notification from %1$s",s);const o=t.is_encrypted?wd("Encrypted message received"):t.body;if(!o)return;const a=new Notification(n,{body:o,lang:Vc.locale,icon:Qc.settings.get("notification_icon"),requireInteraction:!Vc.notification_delay});Qc.settings.get("notification_delay")&&setTimeout(a.close.bind(a),Qc.settings.get("notification_delay")),a.onclick=function(e){e.preventDefault(),window.focus();Vc.chatboxes.get(s).maybeShow(!0)},a.onclick.bind(Vc)},Vc.showChatStateNotification=function(e){if(Vc.chatstate_notification_blacklist.includes(e.jid))return;const t=e.chat_status;let n=null;if("offline"===t?n=wd("has gone offline"):"away"===t?n=wd("has gone away"):"dnd"===t?n=wd("is busy"):"online"===t&&(n=wd("has come online")),null===n)return;const r=new Notification(e.getDisplayName(),{body:n,lang:Vc.locale,icon:Vc.notification_icon});setTimeout(r.close.bind(r),5e3)},Vc.showContactRequestNotification=function(e){const t=new Notification(e.getDisplayName(),{body:wd("wants to be your contact"),lang:Vc.locale,icon:Vc.notification_icon});setTimeout(t.close.bind(t),5e3)},Vc.showFeedbackNotification=function(e){if("error"===e.klass||"warn"===e.klass){const t=new Notification(e.subject,{body:e.message,lang:Vc.locale,icon:Vc.notification_icon});setTimeout(t.close.bind(t),5e3)}},Vc.handleChatStateNotification=function(e){Vc.areDesktopNotificationsEnabled()&&Qc.settings.get("show_chat_state_notifications")&&Vc.showChatStateNotification(e)},Vc.handleMessageNotification=function(e){if(!Vc.shouldNotifyOfMessage(e))return!1;Qc.trigger("messageNotification",e),Vc.playSoundNotification(),Vc.showMessageNotification(e)},Vc.handleContactRequestNotification=function(e){Vc.areDesktopNotificationsEnabled(!0)&&Vc.showContactRequestNotification(e)},Vc.handleFeedback=function(e){Vc.areDesktopNotificationsEnabled(!0)&&Vc.showFeedbackNotification(e)},Vc.requestPermission=function(){Hm&&!["denied","granted"].includes(Notification.permission)&&Notification.requestPermission()},Qc.listen.on("clearSession",()=>Vm=null),Qc.waitUntil("chatBoxesInitialized").then(()=>Vc.chatboxes.on("change:num_unread",Wm)),Qc.listen.on("pluginsInitialized",(function(){Qc.listen.on("contactRequest",Vc.handleContactRequestNotification),Qc.listen.on("contactPresenceChanged",Vc.handleChatStateNotification),Qc.listen.on("message",Vc.handleMessageNotification),Qc.listen.on("feedback",Vc.handleFeedback),Qc.listen.on("connected",Vc.requestPermission)}))}});const{Strophe:Gm,$iq:Jm,sizzle:Qm}=sl.env,Ym=sl.env.utils,Km=(e,t)=>wc`
<li class="room-item list-group-item">
<div class="available-chatroom d-flex flex-row">
<a class="open-room available-room w-100"
@click=${e.toggleCommandForm}
data-command-node="${t.node}"
data-command-jid="${t.jid}"
data-command-name="${t.name}"
title="${t.name}"
href="#">${t.name||t.jid}</a>
</div>
${t.node===e.showform?((e,t)=>{const n=wd("Hide"),r=wd("Execute");return wc`
<form @submit=${e.runCommand}>
${t.alert?wc`<div class="alert alert-${t.alert_type}" role="alert">${t.alert}</div>`:""}
<fieldset class="form-group">
<input type="hidden" name="command_node" value="${t.node}"/>
<input type="hidden" name="command_jid" value="${t.jid}"/>
<p class="form-help">${t.instructions}</p>
<!-- Fields are generated internally, with xForm2webForm -->
${t.fields.map(e=>df(e))}
</fieldset>
<fieldset>
<input type="submit" class="btn btn-primary" value="${r}">
<input type="button" class="btn btn-secondary button-cancel" value="${n}" @click=${e.hideCommandForm}>
</fieldset>
</form>
`})(e,t):""}
</li>
`;async function Xm(){const e=[...await Qc.rooms.get(),...await Qc.contacts.get()];return[...new Set(e.map(e=>Gm.getDomainFromJid(e.get("jid"))))]}const Zm=e=>{const t=wd("On which entity do you want to run commands?"),n=wd("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."),r=wd("Commands found"),i=wd("List available commands"),s=wd("XMPP Address"),o=wd("No commands found");return wc`
${e.alert?wc`<div class="alert alert-${e.alert_type}" role="alert">${e.alert}</div>`:""}
<form class="converse-form" @submit=${e.fetchCommands}>
<fieldset class="form-group">
<label>
${t}
<p class="form-help">${n}</p>
<converse-autocomplete
.getAutoCompleteList="${Xm}"
placeholder="${s}"
name="jid"/>
</label>
</fieldset>
<fieldset class="form-group">
<input type="submit" class="btn btn-primary" value="${i}">
</fieldset>
${"list-commands"===e.view?wc`
<fieldset class="form-group">
<ul class="list-group">
<li class="list-group-item active">${e.commands.length?r:o}:</li>
${e.commands.map(t=>Km(e,t))}
</ul>
</fieldset>`:""}
</form>
`};Qc.elements.define("converse-adhoc-commands",class extends Kd{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 Zm({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 Qc.disco.supports(Gm.NS.ADHOC,t)}catch(e){Dn.error(e)}if(n)try{this.commands=await Qc.adhoc.getCommands(t),this.view="list-commands"}catch(e){return Dn.error(e),this.alert_type="danger",this.alert=wd("Sorry, an error occurred while looking for commands on that entity."),this.commands=[],void Dn.error(e)}else this.alert_type="danger",this.alert=wd("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=Jm({type:"set",to:n}).c("command",{xmlns:Gm.NS.ADHOC,node:t,action:"execute"});try{var i;const t=await Qc.sendIQ(r),n=Qm(`command[xmlns="${Gm.NS.ADHOC}"]`,t).pop();e.sessionid=n.getAttribute("sessionid"),e.instructions=null===(i=Qm('x[type="form"][xmlns="jabber:x:data"] instructions',n).pop())||void 0===i?void 0:i.textContent,e.fields=Qm('x[type="form"][xmlns="jabber:x:data"] field',n).map(e=>Ym.xForm2webForm(e,n))}catch(t){null===t?Dn.error("Error: timeout while trying to execute command for "+n):(Dn.error("Error while trying to execute command for "+n),Dn.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],s=Qm(":input:not([type=button]):not([type=submit])",e.target).filter(e=>!["command_jid","command_node"].includes(e.getAttribute("name"))).map(Ym.webForm2xForm).filter(e=>e),o=Jm({to:n,type:"set"}).c("command",{sessionid:i.sessionid,node:i.node,xmlns:Gm.NS.ADHOC}).c("x",{xmlns:Gm.NS.XFORM,type:"submit"});let a;s.forEach(e=>o.cnode(e).up());try{a=await Qc.sendIQ(o)}catch(e){i.alert_type="danger",i.alert=wd("Sorry, an error occurred while trying to execute the command. See the developer console for details"),Dn.error("Error while trying to execute an ad-hoc command"),Dn.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=Ym.getUniqueId()}});var ev=e=>{const t=wd("Settings"),n=wd("%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=wd("%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=Qc.settings.get("show_client_info"),s=Qc.settings.get("allow_adhoc_commands");return wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="converse-modtools-modal-label">${t}</h5>
${qd}
</div>
<div class="modal-body">
${i&&s?(e=>{const t=wd("About"),n=wd("Commands");return wc`
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="about-tab" href="#about-tabpanel" aria-controls="about-tabpanel" role="tab" data-toggle="tab" @click=${e.switchTab}>${t}</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link" id="commands-tab" href="#commands-tabpanel" aria-controls="commands-tabpanel" role="tab" data-toggle="tab" @click=${e.switchTab}>${n}</a>
</li>
</ul>
`})(e):""}
<div class="tab-content">
<div class="tab-pane tab-pane--columns ${i?"active":""}"
id="about-tabpanel" role="tabpanel" aria-labelledby="about-tab">
<span class="modal-alert"></span>
<br/>
<div class="container">
<h6 class="brand-heading">Converse</h6>
<p class="brand-subtitle">${e.version_name}</p>
<p class="brand-subtitle">${df(lf.a.filterXSS(n,{whiteList:{a:[]}}))}</p>
<p class="brand-subtitle">${df(lf.a.filterXSS(r,{whiteList:{a:[]}}))}</p>
</div>
</div>
<div class="tab-pane tab-pane--columns ${!i&&s?"active":""}"
id="commands-tabpanel"
role="tabpanel"
aria-labelledby="commands-tab">
<converse-adhoc-commands/>
</div>
</div>
</div>
</div>
</div>
`};let tv;var nv=Gd.extend({id:"converse-client-info-modal",initialize(e){tv=e._converse,Gd.prototype.initialize.apply(this,arguments)},toHTML(){return ev(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{version_name:tv.VERSION_NAME}))}});const rv=wd("Your avatar image");Qc.elements.define("converse-image-picker",class extends Kd{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 wc`
<a class="change-avatar" @click=${this.openFileSelection} title="${rv}">
${Vh(e)}
</a>
<input @change=${this.updateFilePreview} class="hidden" name="image" type="file"/>
`}openFileSelection(e){e.preventDefault(),this.querySelector('input[type="file"]').click()}updateFilePreview(e){const t=e.target.files[0],n=new FileReader;n.onloadend=()=>this.image=n.result,n.readAsDataURL(t)}});const iv=sl.env.utils,sv=e=>wc`
${e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=wd("Checkbox for selecting the following fingerprint");return wc`
<li class="fingerprint-removal-item list-group-item nopadding">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${t}"/>
<span class="fingerprint">${iv.formatFingerprint(e.device.get("bundle").fingerprint)}</span>
</label>
</li>
`})(e):(e=>{const t=wd("Device without a fingerprint"),n=wd("Checkbox for selecting the following device");return wc`
<li class="fingerprint-removal-item list-group-item nopadding">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${n}"/>
<span>${t}</span>
</label>
</li>
`})(e)}
`,ov=e=>{const t=wd("This device's OMEMO fingerprint"),n=wd("Generate new keys and fingerprint");return wc`
<div class="tab-pane" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">
<form class="converse-form fingerprint-removal">
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
<li class="list-group-item">
${e.view.current_device&&e.view.current_device.get("bundle")&&e.view.current_device.get("bundle").fingerprint?(e=>wc`
<span class="fingerprint">${iv.formatFingerprint(e.view.current_device.get("bundle").fingerprint)}</span>`)(e):Wh()}
</li>
</ul>
<div class="form-group">
<button type="button" class="generate-bundle btn btn-danger">${n}</button>
</div>
${e.view.other_devices.length?(e=>{const t=wd("Other OMEMO-enabled devices"),n=wd("Checkbox to select fingerprints of all other OMEMO devices"),r=wd("Remove checked devices and close"),i=wd("Select all");return wc`
<ul class="list-group fingerprints">
<li class="list-group-item nopadding active">
<label>
<input type="checkbox" class="select-all" title="${i}" aria-label="${n}"/>
${t}
</label>
</li>
${e.view.other_devices.map(t=>sv(Object.assign({device:t},e)))}
</ul>
<div class="form-group"><button type="submit" class="save-form btn btn-primary">${r}</button></div>
`})(e):""}
</form>
</div>`};
/**
* @module converse-profile
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{sizzle:av,u:cv}=sl.env;sl.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews"],initialize(){Qc.settings.extend({allow_adhoc_commands:!0,show_client_info:!0}),Vc.ProfileModal=Gd.extend({id:"user-profile-modal",events:{"submit .profile-form":"onFormSubmitted"},initialize(){this.listenTo(this.model,"change",this.render),Gd.prototype.initialize.apply(this,arguments),Qc.trigger("profileModalInitialized",this.model)},toHTML(){return(e=>{const t=wd("Your Profile"),n=wd("Email"),r=wd("Full Name"),i=wd("XMPP Address (JID)"),s=wd("Nickname"),o=wd("Role"),a=wd("Save and close"),c=wd("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),l=wd("URL"),u=wd("OMEMO"),d=wd("Profile"),h=wc`
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="profile-tab" href="#profile-tabpanel" aria-controls="profile-tabpanel" role="tab" data-toggle="tab">${d}</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link" id="omemo-tab" href="#omemo-tabpanel" aria-controls="omemo-tabpanel" role="tab" data-toggle="tab">${u}</a>
</li>
</ul>`;return wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="user-profile-modal-label">${t}</h5>
${qd}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
${Vc.pluggable.plugins["converse-omemo"].enabled(Vc)&&h||""}
<div class="tab-content">
<div class="tab-pane active" id="profile-tabpanel" role="tabpanel" aria-labelledby="profile-tab">
<form class="converse-form converse-form--modal profile-form" action="#">
<div class="row">
<div class="col-auto">
<converse-image-picker image="${e.image}" width="${e.width}" height="${e.height}"></converse-image-picker>
</div>
<div class="col">
<div class="form-group">
<label class="col-form-label">${i}:</label>
<div>${e.jid}</div>
</div>
</div>
</div>
<div class="form-group">
<label for="vcard-fullname" class="col-form-label">${r}:</label>
<input id="vcard-fullname" type="text" class="form-control" name="fn" value="${e.fullname||""}"/>
</div>
<div class="form-group">
<label for="vcard-nickname" class="col-form-label">${s}:</label>
<input id="vcard-nickname" type="text" class="form-control" name="nickname" value="${e.nickname||""}"/>
</div>
<div class="form-group">
<label for="vcard-url" class="col-form-label">${l}:</label>
<input id="vcard-url" type="url" class="form-control" name="url" value="${e.url||""}"/>
</div>
<div class="form-group">
<label for="vcard-email" class="col-form-label">${n}:</label>
<input id="vcard-email" type="email" class="form-control" name="email" value="${e.email||""}"/>
</div>
<div class="form-group">
<label for="vcard-role" class="col-form-label">${o}:</label>
<input id="vcard-role" type="text" class="form-control" name="role" value="${e.role||""}" aria-describedby="vcard-role-help"/>
<small id="vcard-role-help" class="form-text text-muted">${c}</small>
</div>
<hr/>
<div class="form-group">
<button type="submit" class="save-form btn btn-primary">${a}</button>
</div>
</form>
</div>
${Vc.pluggable.plugins["converse-omemo"].enabled(Vc)&&ov(e)||""}
</div>
</div>
</div>
</div>
`})(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=av(".nav-item .nav-link",this.el).map(e=>new Fd.a.Tab(e))},async setVCard(e){try{await Qc.vcard.set(Vc.bare_jid,e)}catch(e){return Dn.fatal(e),void this.alert([wd("Sorry, an error happened while trying to save your profile data."),wd("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))}}),Vc.ChatStatusModal=Gd.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:wd("Away"),label_busy:wd("Busy"),label_cancel:wd("Cancel"),label_close:wd("Close"),label_custom_status:wd("Custom status"),label_offline:wd("Offline"),label_online:wd("Online"),label_save:wd("Save"),label_xa:wd("Away for long"),modal_title:wd("Change chat status"),placeholder_status_message:wd("Personal status message")}),wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="changeStatusModalLabel">${e.modal_title}</h5>
${qd}
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form set-xmpp-status" id="set-xmpp-status">
<div class="form-group">
<div class="custom-control custom-radio">
<input ?checked=${"online"===e.status}
type="radio" id="radio-online" value="online" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-online">
<span class="fa fa-circle chat-status chat-status--online"></span>${e.label_online}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"busy"===e.status}
type="radio" id="radio-busy" value="dnd" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-busy">
<span class="fa fa-minus-circle chat-status chat-status--busy"></span>${e.label_busy}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"away"===e.status}
type="radio" id="radio-away" value="away" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-away">
<span class="fa fa-circle chat-status chat-status--away"></span>${e.label_away}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"xa"===e.status}
type="radio" id="radio-xa" value="xa" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-xa">
<span class="far fa-circle chat-status chat-status--xa"></span>${e.label_xa}</label>
</div>
</div>
<div class="form-group">
<div class="btn-group w-100">
<input name="status_message" type="text" class="form-control"
value="${e.status_message||""}" placeholder="${e.placeholder_status_message}"/>
<span class="clear-input fa fa-times ${e.status_message?"":"hidden"}"></span>
</div>
</div>
<button type="submit" class="btn btn-primary">${e.label_save}</button>
</form>
</div>
</div>
</div>
`;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(),cv.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()}}),Vc.XMPPStatusView=Vc.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=wd("Log out"),n=wd("Click to change your chat status"),r=wd("Show details about this chat client"),i=Qc.settings.get("show_client_info")||Qc.settings.get("allow_adhoc_commands");return wc`
<div class="userinfo controlbox-padded">
<div class="controlbox-section profile d-flex">
<a class="show-profile" href="#">
<canvas class="avatar align-self-center" height="40" width="40"></canvas>
</a>
<span class="username w-100 align-self-center">${e.fullname}</span>
${i?wc`<a class="controlbox-heading__btn show-client-info fa fa-cog align-self-center" title="${r}" @click=${e.showUserSettingsModal}></a>`:""}
${Qc.settings.get("allow_logout")?wc`<a class="controlbox-heading__btn logout fa fa-sign-out-alt align-self-center" title="${t}"></a>`:""}
</div>
<div class="d-flex xmpp-status">
<a class="change-status" title="${n}" data-toggle="modal" data-target="#changeStatusModal">
<span class="${e.chat_status} w-100 align-self-center" data-value="${e.chat_status}">
<span class="
${"online"===e.chat_status&&"fa fa-circle chat-status chat-status--online"}
${"dnd"===e.chat_status&&"fa fa-minus-circle chat-status chat-status--busy"}
${"away"===e.chat_status&&"fa fa-circle chat-status chat-status--away"}
${"xa"===e.chat_status&&"far fa-circle chat-status chat-status--xa "}
${"offline"===e.chat_status&&"fa fa-circle chat-status chat-status--offline"}"></span> ${e.status_message}</span>
</a>
</div>
</div>
`})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{chat_status:e,fullname:this.model.vcard.get("fullname")||Vc.bare_jid,showUserSettingsModal:e=>this.showUserSettingsModal(e),status_message:this.model.get("status_message")||wd("I am %1$s",this.getPrettyStatus(e))}))},afterRender(){this.renderAvatar()},showProfileModal(e){e.preventDefault(),void 0===this.profile_modal&&(this.profile_modal=new Vc.ProfileModal({model:this.model})),this.profile_modal.show(e)},showStatusChangeModal(e){e.preventDefault(),void 0===this.status_modal&&(this.status_modal=new Vc.ChatStatusModal({model:this.model})),this.status_modal.show(e)},showUserSettingsModal(e){e.preventDefault(),void 0===this.user_settings_modal&&(this.user_settings_modal=new nv({model:this.model,_converse:Vc})),this.user_settings_modal.show(e)},logOut(e){e.preventDefault();!0===confirm(wd("Are you sure you want to log out?"))&&Qc.user.logout()},getPrettyStatus:e=>"chat"===e?wd("online"):"dnd"===e?wd("busy"):"xa"===e?wd("away for long"):"away"===e?wd("away"):"offline"===e?wd("offline"):wd(e)||wd("online")}),Qc.listen.on("controlBoxPaneInitialized",async e=>{await Qc.waitUntil("VCardsInitialized"),Vc.xmppstatusview=new Vc.XMPPStatusView({model:Vc.xmppstatus}),e.el.insertAdjacentElement("afterBegin",Vc.xmppstatusview.render().el)})}});var lv=function(){var e=arguments.length;if(!e)return[];for(var t=Array(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return dt(Oe(n)?it(n):[n],Ms(t,1))},uv=Math.ceil,dv=Math.max;var hv=function(e,t,n,r){for(var i=-1,s=dv(uv((t-e)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=e,e+=n;return o};var fv=function(e){return function(t,n,r){return r&&"number"!=typeof r&&Cr(t,n,r)&&(n=r=void 0),t=fi(t),void 0===n?(n=t,t=0):n=fi(n),r=void 0===r?t<n?1:-1:fi(r),hv(t,n,r,e)}}();
/**
* @module converse-omemo
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:pv,sizzle:gv,$build:mv,$iq:vv,$msg:_v}=sl.env,bv=sl.env.utils;pv.addNamespace("OMEMO_DEVICELIST",pv.NS.OMEMO+".devicelist"),pv.addNamespace("OMEMO_VERIFICATION",pv.NS.OMEMO+".verification"),pv.addNamespace("OMEMO_WHITELISTED",pv.NS.OMEMO+".whitelisted"),pv.addNamespace("OMEMO_BUNDLES",pv.NS.OMEMO+".bundles");const yv={name:"AES-GCM",length:128};class wv extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}function Sv(e,t){return t.is_encrypted&&t.encrypted.key?!0===t.encrypted.prekey?async function(e){const t=Cv(e.from,parseInt(e.encrypted.device_id,10)),n=bv.base64ToArrayBuffer(e.encrypted.key);let r;try{r=await t.decryptPreKeyWhisperMessage(n,"binary")}catch(t){return Dn.error(`${t.name} ${t.message}`),Object.assign(e,jv(t))}try{const t=await kv(e,r);return await Vc.omemo_store.generateMissingPreKeys(),await Vc.omemo_store.publishBundle(),t?Object.assign(e,{plaintext:t}):Object.assign(e,{is_only_key:!0})}catch(t){return Dn.error(`${t.name} ${t.message}`),Object.assign(e,jv(t))}}(t):async function(e){const t=e.from_muc?e.from_real_jid:e.from;t||Object.assign(e,{error_text:wd("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=Cv(t,parseInt(e.encrypted.device_id,10)),r=bv.base64ToArrayBuffer(e.encrypted.key);try{const t=await n.decryptWhisperMessage(r,"binary"),i=await kv(e,t);return Object.assign(e,{plaintext:i})}catch(t){return Dn.error(`${t.name} ${t.message}`),Object.assign(e,jv(t))}}(t):t}function xv(){Vc.chatboxes.on("add",e=>{Pv(e),e.get("type")===Vc.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 Vc.contactHasOMEMOSupport(t.get("jid"))||(e.createMessage({message:wd("%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",()=>Pv(e)))})}function Ev(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 Av=sl.env.omemo={async encryptMessage(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(yv,!0,["encrypt","decrypt"]),r={name:"AES-GCM",iv:t,tagLength:128},i=await crypto.subtle.encrypt(r,n,bv.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:bv.appendArrayBuffer(c,a),payload:bv.arrayBufferToBase64(o),iv:bv.arrayBufferToBase64(t)}},async decryptMessage(e){const t=await crypto.subtle.importKey("raw",e.key,yv,!0,["encrypt","decrypt"]),n=bv.appendArrayBuffer(bv.base64ToArrayBuffer(e.payload),e.tag),r={name:"AES-GCM",iv:bv.base64ToArrayBuffer(e.iv),tagLength:128};return bv.arrayBufferToString(await crypto.subtle.decrypt(r,t,n))}};function Cv(e,t){const n=new libsignal.SignalProtocolAddress(e,t);return new window.libsignal.SessionCipher(Vc.omemo_store,n)}async function kv(e,t){const n=e.encrypted,r=Vc.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 Av.decryptMessage(Object.assign(n,{key:e,tag:r}));return i.save("active",!0),s}}function jv(e){return"debug"===Qc.settings.get("loglevel")?{error_text:wd("Sorry, could not decrypt a received OMEMO message due to an error.")+` ${e.name} ${e.message}`,error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"}:{}}function Tv(e){const t=e.querySelector("signedPreKeyPublic"),n=e.querySelector("signedPreKeySignature"),r=gv("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 Ov(e){var t;if(null!==(t=e.get("bundle"))&&void 0!==t&&t.fingerprint)return;const n=await e.getBundle();n.fingerprint=bv.arrayBufferToHex(bv.base64ToArrayBuffer(n.identity_key)),e.save("bundle",n),e.trigger("change:bundle")}async function Nv(e){await Qc.waitUntil("OMEMOInitialized");const t=Vc.devicelists.get(e)||Vc.devicelists.create({jid:e});return await t.fetchDevices(),t.devices}async function Iv(e){if(!e.get("bundle"))return Dn.error(`Could not build an OMEMO session for device ${e.get("id")} because we don't have its bundle`),null;const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=await Vc.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(Vc.omemo_store,t),r=e.getRandomPreKey(),i=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:bv.base64ToArrayBuffer(i.identity_key),signedPreKey:{keyId:i.signed_prekey.id,publicKey:bv.base64ToArrayBuffer(i.signed_prekey.public_key),signature:bv.base64ToArrayBuffer(i.signed_prekey.signature)},preKey:{keyId:r.id,publicKey:bv.base64ToArrayBuffer(r.key)}})}(e)}catch(t){return Dn.error("Could not build an OMEMO session for device "+e.get("id")),Dn.error(t),null}}function Mv(){Vc.connection.addHandler(e=>{try{gv(`event[xmlns="${pv.NS.PUBSUB}#event"]`,e).length&&(function(e){const t=gv(`items[node="${pv.NS.OMEMO_DEVICELIST}"]`,e).pop();if(!t)return;const n=`item list[xmlns="${pv.NS.OMEMO}"] device`,r=gv(n,t).map(e=>e.getAttribute("id")),i=e.getAttribute("from"),s=Vc.devicelists.getDeviceList(i),o=s.devices;No(o.pluck("id"),r).forEach(e=>{i===Vc.bare_jid&&e===Vc.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})}),bv.isSameBareJID(i,Vc.bare_jid)&&s.publishCurrentDevice(r)}(e),function(e){const t=gv("items",e).pop();if(!t||!t.getAttribute("node").startsWith(pv.NS.OMEMO_BUNDLES))return;const n=t.getAttribute("node").split(":")[1],r=e.getAttribute("from"),i=gv("item > bundle",t).pop(),s=Vc.devicelists.getDeviceList(r);(s.devices.get(n)||s.devices.create({id:n,jid:r})).save({bundle:Tv(i)})}(e))}catch(e){Dn.error(e.message)}return!0},null,"message","headline")}function Rv(){if(void 0===Vc.omemo_store){const e="converse.omemosession-"+Vc.bare_jid;Vc.omemo_store=new Vc.OMEMOStore({id:e}),Vc.omemo_store.browserStorage=Vc.createStore(e)}return Vc.omemo_store.fetchSession()}async function $v(){await new Promise((e,t)=>Vc.devicelists.fetch({success:e,error:(e,n)=>t(n)}));let e=Vc.devicelists.get(Vc.bare_jid);return e?e.fetchDevices():e=await Vc.devicelists.create({jid:Vc.bare_jid},{promise:!0}),e._devices_promise}async function Dv(){if(!Vc.config.get("trusted")||Qc.settings.get("clear_cache_on_logout"))return void Dn.warn("Not initializing OMEMO, since this browser is not trusted or clear_cache_on_logout is set to true");Vc.devicelists=new Vc.DeviceLists;const e="converse.devicelists-"+Vc.bare_jid;Vc.devicelists.browserStorage=Vc.createStore(e);try{await $v(),await Rv(),await Vc.omemo_store.publishBundle()}catch(e){return Dn.error("Could not initialize OMEMO support"),void Dn.error(e)}Qc.trigger("OMEMOInitialized")}async function Pv(e){let t;e.get("type")===Vc.CHATROOMS_TYPE?(await Qc.waitUntil("OMEMOInitialized"),t=e.features.get("nonanonymous")&&e.features.get("membersonly")):e.get("type")===Vc.PRIVATE_CHAT_TYPE&&(t=await Vc.contactHasOMEMOSupport(e.get("jid"))),e.set("omemo_supported",t),t&&Qc.settings.get("omemo_default")&&e.set("omemo_active",!0)}function Lv(e){e.stopPropagation(),e.preventDefault();const t=bv.ancestor(e.target,"converse-chat-toolbar");if(!t.model.get("omemo_supported")){let e;return e=t.model.get("type")===Vc.CHATROOMS_TYPE?[wd("Cannot use end-to-end encryption in this groupchat, either the groupchat has some anonymity or not all participants support OMEMO.")]:[wd("Cannot use end-to-end encryption because %1$s uses a client that doesn't support OMEMO.",t.model.contact.getDisplayName())],Qc.alert("error",wd("Error"),e)}t.model.save({omemo_active:!t.model.get("omemo_active")})}function zv(e,t){const n=e.model;let r;if(n.get("type")===Vc.CHATROOMS_TYPE&&n.get("omemo_supported")){const e=wd("Messages are being sent in plaintext"),t=wd("Messages are sent encrypted");r=n.get("omemo_active")?t:e}else r=wd("This groupchat needs to be members-only and non-anonymous in order to support OMEMO encrypted messages");return t.push(wc`
<button class="toggle-omemo"
title="${r}"
?disabled=${!n.get("omemo_supported")}
@click=${Lv}>
<converse-icon class="fa ${n.get("omemo_active")?"fa-lock":"fa-unlock"}"
path-prefix="${Qc.settings.get("assets_path")}" size="1em"
color="${n.get("omemo_active")?"var(--info-color)":"var(--error-color)"}"
></converse-icon>
</button>`),t}const Fv={encryptKey:(e,t)=>Cv(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=[];gv(`presence-subscription-required[xmlns="${pv.NS.PUBSUB_ERROR}"]`,e.iq).length?t.push(wd("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"))):gv('remote-server-not-found[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]',e.iq).length?t.push(wd("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(wd("Unable to send an encrypted message due to an unexpected error.")),t.push(e.iq.outerHTML)),Qc.alert("error",wd("Error"),t),Dn.error(e)}else{if(!e.user_facing)throw e;Qc.alert("error",wd("Error"),[e.message]),Dn.error(e)}}};sl.plugins.add("converse-omemo",{enabled:e=>window.libsignal&&e.config.get("trusted")&&!Qc.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=Ma(this.render,50),this.devicelist=Vc.devicelists.get(Vc.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=Vc.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=bv.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=gv('.fingerprint-removal-item input[type="checkbox"]:checked',e.target).map(e=>e.value);this.devicelist.removeOwnDevices(t).then(this.modal.hide).catch(e=>{Dn.error(e),Vc.api.alert(pv.LogLevel.ERROR,wd("Error"),[wd("Sorry, an error occurred while trying to remove the devices.")])})},generateOMEMODeviceBundle(e){e.preventDefault(),confirm(wd("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."))&&Qc.omemo.bundle.generate()}},UserDetailsModal:{events:{"click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){const e=this.model.get("jid");return this.devicelist=Vc.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 Vc.getBundlesAndBuildSessions(this);r=await this.createMessage(n),i=await Vc.createOMEMOMessageStanza(this,r,e)}catch(e){return this.handleMessageSendError(e),null}return Vc.api.send(i),r}return this.__super__.sendMessage.apply(this,arguments)}}},initialize(){Qc.settings.extend({omemo_default:!1}),Qc.promises.add(["OMEMOInitialized"]),Vc.NUM_PREKEYS=100,Object.assign(Vc.ChatBox.prototype,Fv),Vc.generateFingerprints=async function(e){const t=await Nv(e);return Promise.all(t.map(e=>Ov(e)))},Vc.getDeviceForContact=function(e,t){return Nv(e).then(e=>e.get(t))},Vc.contactHasOMEMOSupport=async function(e){return(await Nv(e)).length>0},Vc.getBundlesAndBuildSessions=async function(e){const t=wd("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===Vc.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map(e=>Nv(e.get("jid"))));n=t.reduce((e,t)=>lv(e,t.models),[])}else if(e.get("type")===Vc.PRIVATE_CHAT_TYPE){const r=await Nv(e.get("jid"));if(0===r.length){const e=new Error(t);throw e.user_facing=!0,e}const i=Vc.devicelists.get(Vc.bare_jid).devices;n=[...i.models,...r.models]}const r=Vc.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=>Iv(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},Vc.createOMEMOMessageStanza=function(e,t,n){const r=wd("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=_v({from:Vc.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:pv.NS.RECEIPTS}).up(),i.c("encrypted",{xmlns:pv.NS.OMEMO}).c("header",{sid:Vc.omemo_store.get("device_id")}),Av.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:pv.NS.HINTS}),e))})},Vc.OMEMOStore=Bs.extend({Direction:{SENDING:1,RECEIVING:2},getIdentityKeyPair(){const e=this.get("identity_keypair");return Promise.resolve({privKey:bv.base64ToArrayBuffer(e.privKey),pubKey:bv.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(bv.arrayBufferToBase64(t)===r)},loadIdentityKey(e){if(null==e)throw new Error("Can't load identity_key for invalid identifier");return Promise.resolve(bv.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=bv.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:bv.base64ToArrayBuffer(t.privKey),pubKey:bv.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storePreKey(e,t){const n={};return n[e]={pubKey:bv.arrayBufferToBase64(t.pubKey),privKey:bv.arrayBufferToBase64(t.privKey)},this.save("prekeys",Object.assign(this.getPreKeys(),n)),Promise.resolve()},removePreKey(e){return this.save("prekeys",Ds(this.getPreKeys(),e)),Promise.resolve()},loadSignedPreKey(e){const t=this.get("signed_prekey");return t?Promise.resolve({privKey:bv.base64ToArrayBuffer(t.privKey),pubKey:bv.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:bv.arrayBufferToBase64(e.keyPair.privKey),pubKey:bv.arrayBufferToBase64(e.keyPair.pubKey),signature:bv.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=`${pv.NS.OMEMO_BUNDLES}:${this.get("device_id")}`,n=mv("item").c("bundle",{xmlns:pv.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 Qc.pubsub.publish(null,t,n,{"pubsub#access_model":"open"},!1)},async generateMissingPreKeys(){const e=No(Dd(fv(0,Vc.NUM_PREKEYS),Number.prototype.toString),Object.keys(this.getPreKeys()));if(e.length<1)return Dn.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:bv.arrayBufferToBase64(e.pubKey)})),n=Vc.devicelists.get(Vc.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=bv.arrayBufferToBase64(e.pubKey),r=function(){const e=Vc.devicelists.get(Vc.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:bv.arrayBufferToBase64(e.privKey),pubKey:n},identity_key:n});const i=await libsignal.KeyHelper.generateSignedPreKey(e,0);Vc.omemo_store.storeSignedPreKey(i),t.signed_prekey={id:i.keyId,public_key:bv.arrayBufferToBase64(i.keyPair.privKey),signature:bv.arrayBufferToBase64(i.signature)};const s=await Promise.all(fv(0,Vc.NUM_PREKEYS).map(e=>libsignal.KeyHelper.generatePreKey(e)));s.forEach(e=>Vc.omemo_store.storePreKey(e.keyId,e.keyPair));const o=Vc.devicelists.get(Vc.bare_jid),a=await o.devices.create({id:t.device_id,jid:Vc.bare_jid},{promise:!0}),c=s.map(e=>({id:e.keyId,key:bv.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:()=>{Vc.omemo_store.get("device_id")?e():this.generateBundle().then(e).catch(t)},error:(n,r)=>{Dn.warn("Could not fetch OMEMO session from cache, we'll generate a new one."),Dn.warn(r),this.generateBundle().then(e).catch(t)}})})),this._setup_promise}}),Vc.Device=Bs.extend({defaults:{trusted:0,active:!0},getRandomPreKey(){const e=this.get("bundle");return e.prekeys[bv.getRandomInt(e.prekeys.length)]},async fetchBundleFromServer(){const e=vv({type:"get",from:Vc.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:pv.NS.PUBSUB}).c("items",{node:`${pv.NS.OMEMO_BUNDLES}:${this.get("id")}`});let t;try{t=await Qc.sendIQ(e)}catch(t){return Dn.error(`Could not fetch bundle for device ${this.get("id")} from ${this.get("jid")}`),Dn.error(t),null}if(t.querySelector("error"))throw new wv("Could not fetch bundle",t);const n=gv(`items[node="${pv.NS.OMEMO_BUNDLES}:${this.get("id")}"]`,t).pop(),r=Tv(gv(`bundle[xmlns="${pv.NS.OMEMO}"]`,n).pop());return this.save("bundle",r),r},getBundle(){return this.get("bundle")?Promise.resolve(this.get("bundle"),this):this.fetchBundleFromServer()}}),Vc.Devices=ia.extend({model:Vc.Device}),Vc.DeviceList=Bs.extend({idAttribute:"jid",initialize(){this.devices=new Vc.Devices;const e=`converse.devicelist-${Vc.bare_jid}-${this.get("jid")}`;this.devices.browserStorage=Vc.createStore(e),this.fetchDevices()},async onDevicesFound(e){if(0===e.length){let e;try{e=await this.fetchDevicesFromServer()}catch(e){null===e?Dn.error("Timeout error while fetching devices for "+this.get("jid")):(Dn.error("Could not fetch devices for "+this.get("jid")),Dn.error(e)),this.destroy()}this.get("jid")===Vc.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)=>{Dn.error(n),e()}})})),this._devices_promise},async getOwnDeviceId(){let e=Vc.omemo_store.get("device_id");return this.devices.findWhere({id:e})||(await Vc.omemo_store.generateBundle(),e=Vc.omemo_store.get("device_id")),e},async publishCurrentDevice(e){if(this.get("jid")===Vc.bare_jid){if(await Rv(),Vc.omemo_store)return e.includes(await this.getOwnDeviceId())?void 0:this.publishDevices();Dn.warn("publishCurrentDevice: omemo_store is not defined, likely a timing issue")}},async fetchDevicesFromServer(){const e=vv({type:"get",from:Vc.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:pv.NS.PUBSUB}).c("items",{node:pv.NS.OMEMO_DEVICELIST});let t;try{t=await Qc.sendIQ(e)}catch(e){return Dn.error(e),[]}const n=`list[xmlns="${pv.NS.OMEMO}"] device`,r=gv(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=mv("item",{id:"current"}).c("list",{xmlns:pv.NS.OMEMO});this.devices.filter(e=>e.get("active")).forEach(t=>e.c("device",{id:t.get("id")}).up());return Qc.pubsub.publish(null,pv.NS.OMEMO_DEVICELIST,e,{"pubsub#access_model":"open"},!1)},removeOwnDevices(e){if(this.get("jid")!==Vc.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()}}),Vc.DeviceLists=ia.extend({model:Vc.DeviceList,getDeviceList(e){return this.get(e)||this.create({jid:e})}}),Qc.waitUntil("chatBoxesInitialized").then(xv),Qc.listen.on("parseMessage",Sv),Qc.listen.on("parseMUCMessage",Sv),Qc.listen.on("chatBoxViewInitialized",Ev),Qc.listen.on("chatRoomViewInitialized",Ev),Qc.listen.on("connected",Mv),Qc.listen.on("getToolbarButtons",zv),Qc.listen.on("statusInitialized",Dv),Qc.listen.on("addClientFeatures",()=>Qc.disco.own.features.add(pv.NS.OMEMO_DEVICELIST+"+notify")),Qc.listen.on("userDetailsModalInitialized",e=>{const t=e.get("jid");Vc.generateFingerprints(t).catch(e=>Dn.error(e))}),Qc.listen.on("profileModalInitialized",()=>{Vc.generateFingerprints(Vc.bare_jid).catch(e=>Dn.error(e))}),Qc.listen.on("afterTearDown",()=>delete Vc.omemo_store),Qc.listen.on("clearSession",()=>{Vc.shouldClearCache()&&Vc.devicelists&&(Vc.devicelists.clearStore(),delete Vc.devicelists)}),Object.assign(Vc.api,{omemo:{bundle:{generate:async()=>{const e=Vc.devicelists.get(Vc.bare_jid),t=Vc.omemo_store.get("device_id");if(t){const n=e.devices.get(t);Vc.omemo_store.unset(t),n&&await new Promise(e=>n.destroy({success:e,error:e})),e.devices.trigger("remove")}await Vc.omemo_store.generateBundle(),await e.publishDevices();const n=Ov(e.devices.get(Vc.omemo_store.get("device_id")));return await Vc.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:Bv,$iq:qv}=sl.env;Bv.addNamespace("PUSH","urn:xmpp:push:0"),sl.plugins.add("converse-push",{initialize(){async function e(e){e=e||Vc.bare_jid;const t=Vc.session.get("push_enabled")||[];if(t.includes(e))return;const n=Qc.settings.get("push_app_servers").filter(e=>!e.disable),r=Qc.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 Qc.disco.getIdentity("pubsub","push",t.jid))return Dn.warn(`Not enabling push the service "${t.jid}", it doesn't have the right disco identtiy.`);const n=await Promise.all([Qc.disco.supports(Bv.NS.PUSH,t.jid),Qc.disco.supports(Bv.NS.PUSH,e)]);if(!n[0]&&!n[1])return void Dn.warn(`Not enabling push app server "${t.jid}", no disco support from your server.`);const r=qv({type:"set"});return e!==Vc.bare_jid&&r.attrs({to:e}),r.c("enable",{xmlns:Bv.NS.PUSH,jid:t.jid,node:t.node}),t.secret&&r.c("x",{xmlns:Bv.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t(Bv.NS.PUBSUB+"#publish-options").up().up().c("field",{var:"secret"}).c("value").t(t.secret),Qc.sendIQ(r)}(e,t)),s=r.map(t=>async function(e,t){if(!t.jid)return;if(!await Qc.disco.supports(Bv.NS.PUSH,e||Vc.bare_jid))return void Dn.warn(`Not disabling push app server "${t.jid}", no disco support from your server.`);const n=qv({type:"set"});e!==Vc.bare_jid&&n.attrs({to:e}),n.c("disable",{xmlns:Bv.NS.PUSH,jid:t.jid}),t.node&&n.attrs({node:t.node}),Qc.sendIQ(n).catch(e=>{Dn.error("Could not disable push app server for "+t.jid),Dn.error(e)})}(e,t));try{await Promise.all(i.concat(s))}catch(e){Dn.error("Could not enable or disable push App Server"),e&&Dn.error(e)}finally{t.push(e)}Vc.session.save("push_enabled",t)}function t(t){t.get("type")==Vc.CHATROOMS_TYPE&&e(Bv.getDomainFromJid(t.get("jid")))}Qc.settings.extend({push_app_servers:[],enable_muc_push:!1}),Qc.listen.on("statusInitialized",()=>e()),Qc.settings.get("enable_muc_push")&&Qc.listen.on("chatBoxesInitialized",()=>Vc.chatboxes.on("add",t))}});var Uv=n(176),Hv=n.n(Uv),Vv=n(177),Wv=n.n(Vv),Gv=n(178),Jv=n.n(Gv);
/**
* @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:Qv,sizzle:Yv,$iq:Kv}=sl.env,Xv=sl.env.utils;Qv.addNamespace("REGISTER","jabber:iq:register");const Zv=Object.keys(Qv.Status).reduce((e,t)=>Math.max(e,Qv.Status[t]),0);Qv.Status.REGIFAIL=Zv+1,Qv.Status.REGISTERED=Zv+2,Qv.Status.CONFLICT=Zv+3,Qv.Status.NOTACCEPTABLE=Zv+5,sl.plugins.add("converse-register",{enabled:()=>!0,overrides:{ControlBoxView:{renderLoginPanel(){return this.__super__.renderLoginPanel.apply(this,arguments),this.renderRegistrationPanel(),this}}},initialize(){function e(e){Qc.waitUntil("controlBoxInitialized").then(()=>{Vc.chatboxes.get("controlbox").set({"active-form":e})}).catch(e=>Dn.fatal(e))}Vc.CONNECTION_STATUS[Qv.Status.REGIFAIL]="REGIFAIL",Vc.CONNECTION_STATUS[Qv.Status.REGISTERED]="REGISTERED",Vc.CONNECTION_STATUS[Qv.Status.CONFLICT]="CONFLICT",Vc.CONNECTION_STATUS[Qv.Status.NOTACCEPTABLE]="NOTACCEPTABLE",Qc.settings.extend({allow_registration:!0,domain_placeholder:wd(" e.g. conversejs.org"),providers_link:"https://compliance.conversations.im/",registration_domain:""}),Object.assign(Vc.ControlBoxView.prototype,{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(Qc.settings.get("allow_registration")){this.registerpanel=new Vc.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}}),Vc.router.route("converse/login",()=>e("login")),Vc.router.route("converse/register",()=>e("register")),Vc.RegisterPanel=Md.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(),Qc.listen.on("connectionInitialized",()=>this.registerHooks())},render(){return this.model.set("registration_form_rendered",!1),this.el.innerHTML=Hv()({__:wd,default_domain:Qc.settings.get("registration_domain"),label_register:wd("Fetch registration form"),help_providers:wd("Tip: A list of public XMPP providers is available"),help_providers_link:wd("here"),href_providers:Qc.settings.get("providers_link"),domain_placeholder:Qc.settings.get("domain_placeholder")}),Qc.settings.get("registration_domain")&&this.fetchRegistrationForm(Qc.settings.get("registration_domain")),this},registerHooks(){const e=Vc.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=Vc.connection;n.connected=!0;const r=n._proto._reqToData(e);if(!r)return;if(n._proto._connect_cb(r)===Qv.Status.CONNFAIL)return this.showValidationError(wd("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(Qv.Status.REGIFAIL),this.showValidationError(wd("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=Kv({type:"get"}).c("query",{xmlns:Qv.NS.REGISTER}).tree();return o.setAttribute("id",n.getUniqueId("sendIQ")),n.send(o),n.connected=!1,!0},onRegistrationFields(e){return"error"===e.getAttribute("type")?(Vc.connection._changeConnectStatus(Qv.Status.REGIFAIL,wd('Something went wrong while establishing a connection with "%1$s". Are you sure it exists?',this.domain)),!1):1!==e.getElementsByTagName("query").length?(Vc.connection._changeConnectStatus(Qv.Status.REGIFAIL,"unknown"),!1):(this.setFields(e),this.model.get("registration_form_rendered")||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,Fs(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.get("registration_form_rendered")||this.renderRegistrationRequest(),this.reset({domain:Qv.getDomainFromJid(e),_registering:!0}),await Vc.initConnection(this.domain),null===(t=Vc.connection)||void 0===t||t.connect(this.domain,"",e=>this.onConnectStatusChanged(e)),!1},renderRegistrationRequest(){this.clearRegistrationForm().insertAdjacentHTML("beforeend",Jv()({__:Vc.__,cancel:Qc.settings.get("registration_domain")}))},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)},clearRegistrationForm(){const e=this.el.querySelector("form");return e.innerHTML="",this.model.set("registration_form_rendered",!1),e},showSpinner(){const e=this.el.querySelector("form");return bc(Wh(),e),this.model.set("registration_form_rendered",!1),this},onConnectStatusChanged(e){Dn.debug("converse-register: onConnectStatusChanged"),[Qv.Status.DISCONNECTED,Qv.Status.CONNFAIL,Qv.Status.REGIFAIL,Qv.Status.NOTACCEPTABLE,Qv.Status.CONFLICT].includes(e)?(Dn.error("Problem during registration: Strophe.Status is "+Vc.CONNECTION_STATUS[e]),this.abortRegistration()):e===Qv.Status.REGISTERED&&(Dn.debug("Registered successfully."),Vc.connection.reset(),this.showSpinner(),["converse/login","converse/register"].includes(Vc.router.history.getFragment())&&Vc.router.navigate("",{replace:!0}),this.fields.password&&this.fields.username?(Vc.connection.connect(this.fields.username.toLowerCase()+"@"+this.domain.toLowerCase(),this.fields.password,Vc.onConnectStatusChanged),this.giveFeedback(wd("Now logging you in"),"info")):(Vc.chatboxviews.get("controlbox").renderLoginPanel(),Vc.giveFeedback(wd("Registered successfully"))),this.reset())},renderLegacyRegistrationForm(e){Object.keys(this.fields).forEach(t=>{"username"===t?e.insertAdjacentHTML("beforeend",wh()({domain:" @"+this.domain,name:t,type:"text",label:t,value:"",required:!0})):e.insertAdjacentHTML("beforeend",fh()({label:t,name:t,placeholder:t,required:!0,type:"password"===t||"email"===t?t:"text",value:""}))}),this.urls.forEach(t=>e.insertAdjacentHTML("afterend",'<a target="blank" rel="noopener" href="'+t+'">'+t+"</a>"))},renderRegistrationForm(e){const t=this.el.querySelector("form");t.innerHTML=Wv()({__:wd,domain:this.domain,title:this.title,instructions:this.instructions,registration_domain:Qc.settings.get("registration_domain")});const n=t.querySelector("fieldset.buttons");"xform"===this.form_type?e.querySelectorAll("field").forEach(t=>{n.insertAdjacentHTML("beforebegin",ql.xForm2webForm(t,e,{domain:this.domain}))}):this.renderLegacyRegistrationForm(t),this.fields||t.querySelector(".button-primary").classList.add("hidden"),t.classList.remove("hidden"),this.model.set("registration_form_rendered",!0)},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=wd("The provider rejected your registration attempt. Please check the values you entered for correctness.");this.showValidationError(e)}},renderProviderChoiceForm(e){e&&e.preventDefault&&e.preventDefault(),Vc.connection._proto._abortAllRequests(),Vc.connection.reset(),this.render()},abortRegistration(){Vc.connection._proto._abortAllRequests(),Vc.connection.reset(),this.model.get("registration_form_rendered")?Qc.settings.get("registration_domain")&&this.model.get("registration_form_rendered")&&this.fetchRegistrationForm(Qc.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=Yv(":input:not([type=button]):not([type=submit])",e),n=Kv({type:"set",id:Xv.getUniqueId()}).c("query",{xmlns:Qv.NS.REGISTER});if("xform"===this.form_type){n.c("x",{xmlns:Qv.NS.XFORM,type:"submit"});t.map(e=>ql.webForm2xForm(e)).filter(e=>e).forEach(e=>n.cnode(e).up())}else t.forEach(e=>n.c(e.getAttribute("name"),{},e.value));Vc.connection._addSysHandler(this._onRegisterIQ.bind(this),null,"iq",null,null),Vc.connection.send(n),this.setFields(n.tree())},setFields(e){const t=e.querySelector("query"),n=Yv(`x[xmlns="${Qv.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()]=Qv.getText(e):"jabber:x:oob"===e.getAttribute("xmlns")&&this.urls.concat(Yv("url",e).map(e=>e.textContent)):this.instructions=Qv.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:"":Dn.warn("Found field we couldn't parse")}),this.form_type="xform"},_onRegisterIQ(e){if("error"===e.getAttribute("type")){Dn.error("Registration failed."),this.reportErrors(e);let t=e.getElementsByTagName("error");if(1!==t.length)return Vc.connection._changeConnectStatus(Qv.Status.REGIFAIL,"unknown"),!1;t=t[0].firstElementChild.tagName.toLowerCase(),"conflict"===t?Vc.connection._changeConnectStatus(Qv.Status.CONFLICT,t):"not-acceptable"===t?Vc.connection._changeConnectStatus(Qv.Status.NOTACCEPTABLE,t):Vc.connection._changeConnectStatus(Qv.Status.REGIFAIL,t)}else Vc.connection._changeConnectStatus(Qv.Status.REGISTERED,null);return!1}}),Qc.listen.on("controlBoxInitialized",e=>{e.model.on("change:active-form",e.showLoginOrRegisterForm,e)})}});const e_=e=>{const t=wd("Leave this groupchat");return wc`
<div class="list-item controlbox-padded available-chatroom d-flex flex-row ${e.currently_open(e.room)?"open":""} ${e.room.get("num_unread_general")?"unread-msgs":""}"
data-room-jid="${e.room.get("jid")}">
${e.room.get("num_unread")?(e=>wc`<span class="list-item-badge badge badge--muc msgs-indicator">${e.room.get("num_unread")}</span>`)(e):""}
<a class="list-item-link open-room available-room w-100"
data-room-jid="${e.room.get("jid")}"
title="${wd("Click to open this groupchat")}"
@click=${e.openRoom}>${e.room.getDisplayName()}</a>
${e.allow_bookmarks?(e=>{const t=wd("Bookmark this groupchat"),n=wd("Unbookmark this groupchat");return e.bookmarked?wc`
<a class="list-item-action fa fa-bookmark remove-bookmark button-on"
data-room-jid="${e.room.get("jid")}"
data-bookmark-name="${e.room.getDisplayName()}"
@click=${e.removeBookmark}
title="${e.bookmarked?n:t}"></a>`:wc`
<a class="list-item-action fa fa-bookmark add-bookmark"
data-room-jid="${e.room.get("jid")}"
data-bookmark-name="${e.room.getDisplayName()}"
@click=${e.addBookmark}
title="${e.bookmarked?n:t}"></a>`})(e):""}
<a class="list-item-action room-info fa fa-info-circle"
data-room-jid="${e.room.get("jid")}"
title="${wd("Show more information on this groupchat")}"
@click=${e.showRoomDetailsModal}></a>
<a class="list-item-action fa fa-sign-out-alt close-room"
data-room-jid="${e.room.get("jid")}"
data-room-name="${e.room.getDisplayName()}"
title="${t}"
@click=${e.closeRoom}></a>
</div>`};
/**
* @module converse-roomslist
* @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{Strophe:t_}=sl.env,n_=sl.env.utils;sl.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){Qc.promises.add("roomsListInitialized"),Vc.RoomsList=Bs.extend({defaults:{"toggle-state":Vc.OPENED}}),Vc.RoomsListView=Md.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"+Vc.bare_jid;this.list_model=new Vc.RoomsList({id:e}),this.list_model.browserStorage=Vc.createStore(e),this.list_model.fetch(),this.render(),this.insertIntoControlBox()},renderIfChatRoom(e){n_.isChatRoom(e)&&this.render()},renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general"],n=e.changed||{};n_.isChatRoom(e)&&Object.keys(n).filter(e=>t.includes(e)).length&&this.render()},toHTML(){return(e=>{const t=wd("Click to toggle the list of open groupchats");return wc`
<div class="list-container list-container--openrooms ${e.rooms.length?"":"hidden"}">
<a class="list-toggle open-rooms-toggle controlbox-padded" title="${t}" @click=${e.toggleRoomsList}>
<span class="fa ${e.toggle_state===e._converse.OPENED?"fa-caret-down":"fa-caret-right"}"></span> ${wd("Open Groupchats")}</a>
<div class="items-list rooms-list open-rooms-list ${e.collapsed&&"collapsed"}">
${e.rooms.map(t=>e_(Object.assign({room:t},e)))}
</div>
</div>`})({_converse:Vc,addBookmark:e=>this.addBookmark(e),allow_bookmarks:Vc.allow_bookmarks&&Vc.bookmarks,closeRoom:e=>this.closeRoom(e),collapsed:this.list_model.get("toggle-state")!==Vc.OPENED,currently_open:e=>Vc.isUniView()&&!e.get("hidden"),openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),rooms:this.model.filter(e=>e.get("type")===Vc.CHATROOMS_TYPE),showRoomDetailsModal:e=>this.showRoomDetailsModal(e),toggleRoomsList:e=>this.toggleRoomsList(e),toggle_state:this.list_model.get("toggle-state")})},insertIntoControlBox(){const e=Vc.chatboxviews.get("controlbox");if(void 0!==e&&!n_.rootContains(Vc.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=Vc.chatboxes.get(t);e.preventDefault(),void 0===n.room_details_modal&&(n.room_details_modal=new bm({model:n})),n.room_details_modal.show(e)},async openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),r={name:t||t_.unescapeNode(t_.getNodeFromJid(n))||n};await Qc.rooms.open(n,r,!0),Qc.chatviews.get(n).maybeFocus()},closeRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-name"),n=e.target.getAttribute("data-room-jid");confirm(wd("Are you sure you want to leave the groupchat %1$s?",t))&&Vc.chatboxviews.get(n).close()},removeBookmark:Vc.removeBookmarkViaEvent,addBookmark:Vc.addBookmarkViaEvent,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")?n_.slideIn(this.el.querySelector(".open-rooms-list")).then(()=>{this.list_model.save({"toggle-state":Vc.CLOSED}),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")}):n_.slideOut(this.el.querySelector(".open-rooms-list")).then(()=>{this.list_model.save({"toggle-state":Vc.OPENED}),t.classList.remove("fa-caret-right"),t.classList.add("fa-caret-down")})}});const e=function(){Vc.rooms_list_view=new Vc.RoomsListView({model:Vc.chatboxes}),Qc.trigger("roomsListInitialized")};Qc.listen.on("connected",async()=>{Vc.allow_bookmarks?await Qc.waitUntil("bookmarksInitialized"):await Promise.all([Qc.waitUntil("chatBoxesFetched"),Qc.waitUntil("roomsPanelRendered")]),e()}),Qc.listen.on("reconnected",e)}});var r_=n(179),i_=n.n(r_),s_=n(180),o_=n.n(s_),a_=n(181),c_=n.n(a_),l_=n(182),u_=n.n(l_),d_=n(183),h_=n.n(d_);
/**
* @module converse-rosterview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:f_}=sl.env,p_=sl.env.utils;sl.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Qc.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}),Qc.promises.add("rosterViewInitialized");const e={dnd:wd("This contact is busy"),online:wd("This contact is online"),offline:wd("This contact is offline"),unavailable:wd("This contact is unavailable"),xa:wd("This contact is away for an extended period"),away:wd("This contact is away")};function t(){Qc.settings.get("authentication")!==Vc.ANONYMOUS&&(Vc.rosterview=new Vc.RosterView({model:Vc.rostergroups}),Vc.rosterview.render(),Qc.trigger("rosterViewInitialized"))}Vc.AddContactModal=Gd.extend({id:"add-contact-modal",events:{"submit form":"addContactFromForm"},initialize(){Gd.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){const e=Qc.settings.get("xhr_user_search_url")?wd("Contact name"):wd("Optional nickname");return(e=>{const t=wd("name@example.org"),n=wd("Add"),r=wd("Please enter a valid XMPP address"),i=wd("Add a Contact"),s=wd("XMPP Address"),o=wd("Nickname");return wc`
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addContactModalLabel">${i}</h5>
${qd}
</div>
<form class="converse-form add-xmpp-contact">
<div class="modal-body">
<span class="modal-alert"></span>
<div class="form-group add-xmpp-contact__jid">
<label class="clearfix" for="jid">${s}:</label>
<div class="suggestion-box suggestion-box__jid">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<input type="text" name="jid" ?required=${!e._converse.xhr_user_search_url}
value="${e.jid||""}"
class="form-control suggestion-box__input"
placeholder="${t}"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</div>
<div class="form-group add-xmpp-contact__name">
<label class="clearfix" for="name">${o}:</label>
<div class="suggestion-box suggestion-box__name">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<input type="text" name="name" value="${e.nickname||""}"
class="form-control suggestion-box__input"
placeholder="${o}"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</div>
<div class="form-group">
<div class="invalid-feedback">${r}</div>
</div>
<button type="submit" class="btn btn-primary">${n}</button>
</div>
</form>
</div>
</div>
`})(Object.assign(this.model.toJSON(),{_converse:Vc,label_nickname:e}))},afterRender(){"string"==typeof Qc.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(!Qc.settings.get("autocomplete_add_contact"))return;const e=this.el.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new Vc.AutoComplete(e,{data:(e,t)=>`${t.slice(0,t.indexOf("@"))}@${e}`,filter:Vc.FILTER_STARTSWITH,list:[...new Set(Vc.roster.map(e=>f_.getDomainFromJid(e.get("jid"))))]})},initXHRAutoComplete(){if(!Qc.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.el.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new Vc.AutoComplete(e,{auto_evaluate:!1,filter:Vc.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",Ma(()=>{t.open("GET",`${Qc.settings.get("xhr_user_search_url")}q=${encodeURIComponent(n.value)}`,!0),t.send()},300)),this.name_auto_complete.on("suggestion-box-selectcomplete",e=>{this.el.querySelector('input[name="name"]').value=e.text.label,this.el.querySelector('input[name="jid"]').value=e.text.value})},initXHRFetch(){this.xhr=new window.XMLHttpRequest,this.xhr.onload=()=>{if(this.xhr.responseText){const e=this.xhr.responseText,t=JSON.parse(e).map(e=>({label:e.fullname||e.jid,value:e.jid}));if(1!==t.length){const e=this.el.querySelector(".invalid-feedback");return e.textContent=wd("Sorry, could not find a contact with that name"),void p_.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||qs(e.split("@")).length<2?(p_.addClass("is-invalid",this.el.querySelector('input[name="jid"]')),p_.addClass("d-block",t),!1):Vc.roster.get(f_.getBareJidFromJid(e))?(t.textContent=wd("This contact has already been added"),p_.addClass("d-block",t),!1):(p_.removeClass("d-block",t),!0)},afterSubmission(e,t,n){Vc.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 Qc.settings.get("xhr_user_search_url")){const e=this.el.querySelector('input[name="name"]');return this.xhr.open("GET",`${Qc.settings.get("xhr_user_search_url")}q=${encodeURIComponent(e.value)}`,!0),void this.xhr.send()}this.validateSubmission(n)&&this.afterSubmission(e.target,n,t.get("name"))}}),Vc.RosterFilter=Bs.extend({initialize(){this.set({filter_text:"",filter_type:"contacts",chat_state:"online"})}}),Vc.RosterFilterView=Md.extend({tagName:"span",initialize(){this.listenTo(this.model,"change:filter_type",this.render),this.listenTo(this.model,"change:filter_text",this.render)},toHTML(){return e=Object.assign(this.model.toJSON(),{visible:this.shouldBeVisible(),placeholder:wd("Filter"),title_contact_filter:wd("Filter by contact name"),title_group_filter:wd("Filter by group name"),title_status_filter:wd("Filter by status"),label_any:wd("Any"),label_unread_messages:wd("Unread"),label_online:wd("Online"),label_chatty:wd("Chatty"),label_busy:wd("Busy"),label_away:wd("Away"),label_xa:wd("Extended Away"),label_offline:wd("Offline"),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)}),wc`
<form class="controlbox-padded roster-filter-form input-button-group ${e.visible?"fade-in":"hidden"}"
@submit=${e.submitFilter}>
<div class="form-inline flex-nowrap">
<div class="filter-by d-flex flex-nowrap">
<span @click=${e.changeTypeFilter} class="fa fa-user ${"contacts"===e.filter_type?"selected":""}" data-type="contacts" title="${e.title_contact_filter}"></span>
<span @click=${e.changeTypeFilter} class="fa fa-users ${"groups"===e.filter_type?"selected":""}" data-type="groups" title="${e.title_group_filter}"></span>
<span @click=${e.changeTypeFilter} class="fa fa-circle ${"state"===e.filter_type?"selected":""}" data-type="state" title="${e.title_status_filter}"></span>
</div>
<div class="btn-group">
<input .value="${e.filter_text||""}"
@keydown=${e.liveFilter}
class="roster-filter form-control ${"state"===e.filter_type?"hidden":""}"
placeholder="${e.placeholder}"/>
<span class="clear-input fa fa-times ${e.filter_text&&"state"!==e.filter_type?"":"hidden"}"
@click=${e.clearFilter}>
</span>
</div>
<select class="form-control state-type ${"state"!==e.filter_type?"hidden":""}"
@change=${e.changeChatStateFilter}>
<option value="">${e.label_any}</option>
<option ?selected=${"unread_messages"===e.chat_state} value="unread_messages">${e.label_unread_messages}</option>
<option ?selected=${"online"===e.chat_state} value="online">${e.label_online}</option>
<option ?selected=${"chat"===e.chat_state} value="chat">${e.label_chatty}</option>
<option ?selected=${"dnd"===e.chat_state} value="dnd">${e.label_busy}</option>
<option ?selected=${"away"===e.chat_state} value="away">${e.label_away}</option>
<option ?selected=${"xa"===e.chat_state} value="xa">${e.label_xa}</option>
<option ?selected=${"offline"===e.chat_state} value="offline">${e.label_offline}</option>
</select>
</div>
</form>
`;var e},changeChatStateFilter(e){e&&e.preventDefault(),this.model.save({chat_state:this.el.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.el.querySelector(".state-type").value}):this.model.save({filter_type:t,filter_text:this.el.querySelector(".roster-filter").value})},liveFilter:Ma((function(){this.model.save({filter_text:this.el.querySelector(".roster-filter").value})}),250),submitFilter(e){e&&e.preventDefault(),this.liveFilter()},isActive(){return"state"===this.model.get("filter_type")||this.model.get("filter_text")},shouldBeVisible(){return Vc.roster&&Vc.roster.length>=5||this.isActive()},clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}),Vc.RosterContactView=Vc.ViewWithAvatar.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=Ma(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 p_.hideElement(this.el),this;const t=this.model.get("ask"),n=this.model.presence.get("show"),r=this.model.get("requesting"),i=this.model.get("subscription"),s=this.model.get("jid");if(["current-xmpp-contact","pending-xmpp-contact","requesting-xmpp-contact"].concat(Object.keys(e)).forEach(e=>p_.removeClass(e,this.el)),this.el.classList.add(n),this.el.setAttribute("data-status",n),this.highlight(),Vc.isUniView()){const e=Vc.chatboxes.get(this.model.get("jid"));e&&(e.get("hidden")?this.el.classList.remove("open"):this.el.classList.add("open"))}if("subscribe"===t||"from"===i){const e=this.model.getDisplayName();this.el.classList.add("pending-xmpp-contact"),this.el.innerHTML=o_()(Object.assign(this.model.toJSON(),{display_name:e,desc_remove:wd("Click to remove %1$s as a contact",e),allow_chat_pending_contacts:Qc.settings.get("allow_chat_pending_contacts")}))}else if(!0===r){const e=this.model.getDisplayName();this.el.classList.add("requesting-xmpp-contact"),this.el.innerHTML=c_()(Object.assign(this.model.toJSON(),{display_name:e,desc_accept:wd("Click to accept the contact request from %1$s",e),desc_decline:wd("Click to decline the contact request from %1$s",e),allow_chat_pending_contacts:Qc.settings.get("allow_chat_pending_contacts")}))}else("both"===i||"to"===i||Vc.rosterview.isSelf(s))&&(this.el.classList.add("current-xmpp-contact"),this.el.classList.remove(Fp(["both","to"],i)[0]),this.el.classList.add(i),this.renderRosterItem(this.model));return this},highlight(){if(Vc.isUniView()){const e=Vc.chatboxes.get(this.model.get("jid"));e&&e.get("hidden")||!e?this.el.classList.remove("open"):this.el.classList.add("open")}},renderRosterItem(t){const n=t.presence.get("show")||"offline";let r;r="online"===n?"fa fa-circle chat-status chat-status--online":"away"===n?"fa fa-circle chat-status chat-status--away":"xa"===n?"far fa-circle chat-status chat-status-xa":"dnd"===n?"fa fa-minus-circle chat-status chat-status--busy":"fa fa-times-circle chat-status chat-status--offline";const i=t.getDisplayName();return this.el.innerHTML=h_()(Object.assign(t.toJSON(),{show:n,display_name:i,status_icon:r,desc_status:e[n],desc_chat:wd("Click to chat with %1$s (XMPP address: %2$s)",i,t.get("jid")),desc_remove:wd("Click to remove %1$s as a contact",i),allow_contact_removal:Qc.settings.get("allow_contact_removal"),num_unread:t.get("num_unread")||0,classes:""})),this.renderAvatar(),this},mayBeShown(){const e=this.model.presence.get("show");return!Qc.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(),Qc.settings.get("allow_contact_removal")&&confirm(wd("Are you sure you want to remove this contact?")))try{await this.model.removeFromRoster(),this.remove(),this.model.collection&&this.model.destroy()}catch(e){Dn.error(e),Qc.alert("error",wd("Error"),[wd("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 Vc.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()},declineRequest(e){e&&e.preventDefault&&e.preventDefault();return!0===confirm(wd("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}}),Vc.RosterGroupView=Up.extend({tagName:"div",className:"roster-group hidden",events:{"click a.group-toggle":"toggle"},sortImmediatelyOnAdd:!0,ItemView:Vc.RosterContactView,listItems:"model.contacts",listSelector:".roster-group-contacts",sortEvent:"presenceChanged",initialize(){Up.prototype.initialize.apply(this,arguments),this.model.get("name")===Vc.HEADER_UNREAD&&this.listenTo(this.model.contacts,"change:num_unread",e=>!this.model.get("unread_messages")&&this.removeContact(e)),this.model.get("name")===Vc.HEADER_REQUESTING_CONTACTS&&this.listenTo(this.model.contacts,"change:requesting",e=>!e.get("requesting")&&this.removeContact(e)),this.model.get("name")===Vc.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(Vc.roster,"change:groups",this.onContactGroupChange),Vc.rosterview.on("rosterContactsFetchedAndProcessed",()=>this.sortAndPositionAllItems())},render(){return this.el.setAttribute("data-group",this.model.get("name")),this.el.innerHTML=i_()({label_group:this.model.get("name"),desc_group_toggle:this.model.get("description"),toggle_state:this.model.get("state"),_converse:Vc}),this.contacts_el=this.el.querySelector(".roster-group-contacts"),this},show(){return p_.showElement(this.el),this.model.get("state")===Vc.OPENED&&Object.values(this.getAll()).filter(e=>e.mayBeShown()).forEach(e=>p_.showElement(e.el)),this},collapse(){return p_.slideIn(this.contacts_el)},filterOutContacts(e=[]){let t=0;this.model.contacts.forEach(n=>{const r=this.get(n.get("id"));e.includes(n)?p_.hideElement(r.el):r.mayBeShown()&&(p_.showElement(r.el),t+=1)}),t?p_.showElement(this.el):p_.hideElement(this.el)},getFilterMatches(e,t){if(0===e.length)return[];e=e.toLowerCase();const n=this.model.contacts;if("state"===t){return[Vc.HEADER_REQUESTING_CONTACTS,Vc.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||Vc.rosterview.filter_view.model.get("filter_type"))?Vc.rosterview.filter_view.model.get("chat_state"):Vc.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");p_.hasClass("fa-caret-down",t)?(this.model.save({state:Vc.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:Vc.OPENED}),this.filter(),p_.showElement(this.el),p_.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()}}),Vc.RosterView=Up.extend({tagName:"div",id:"converse-roster",className:"controlbox-section",ItemView:Vc.RosterGroupView,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(){Up.prototype.initialize.apply(this,arguments),this.listenTo(Vc.roster,"add",this.onContactAdded),this.listenTo(Vc.roster,"change:groups",this.onContactAdded),this.listenTo(Vc.roster,"change",this.onContactChange),this.listenTo(Vc.roster,"destroy",this.update),this.listenTo(Vc.roster,"remove",this.update),Vc.presences.on("change:show",()=>{this.update(),this.updateFilter()}),this.listenTo(this.model,"reset",this.reset),Qc.listen.on("rosterGroupsFetched",this.sortAndPositionAllItems.bind(this)),Qc.listen.on("rosterContactsFetched",()=>{Vc.roster.each(e=>this.addRosterContact(e,{silent:!0})),this.update(),this.updateFilter(),this.trigger("rosterContactsFetchedAndProcessed")}),this.createRosterFilter()},render(){this.el.innerHTML=u_()({allow_contact_requests:Vc.allow_contact_requests,heading_contacts:wd("Contacts"),title_add_contact:wd("Add a contact"),title_sync_contacts:wd("Re-sync your contacts")});const e=this.el.querySelector(".roster-filter-form");return this.el.replaceChild(this.filter_view.render().el,e),this.roster_el=this.el.querySelector(".roster-contacts"),this},showAddContactModal(e){void 0===this.add_contact_modal&&(this.add_contact_modal=new Vc.AddContactModal({model:new Bs})),this.add_contact_modal.show(e)},createRosterFilter(){const e=new Vc.RosterFilter;e.id="_converse.rosterfilter-"+Vc.bare_jid,e.browserStorage=Vc.createStore(e.id),this.filter_view=new Vc.RosterFilterView({model:e}),this.listenTo(this.filter_view.model,"change",this.updateFilter),this.filter_view.model.fetch()},updateFilter:Ma((function(){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 p_.isVisible(this.roster_el)||p_.showElement(this.roster_el),this.filter_view.render(),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&&p_.slideOut(t.el):p_.slideIn(t.el)}):n.forEach(n=>n.filter(e,t))},async syncContacts(e){e.preventDefault(),p_.addClass("fa-spin",e.target),Vc.roster.data.save("version",null),await Vc.roster.fetchFromServer(),Qc.user.presence.send(),p_.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(),Gr(e.changed,"subscription")&&("from"===e.changed.subscription?this.addContactToGroup(e,Vc.HEADER_PENDING_CONTACTS):["both","to"].includes(e.get("subscription"))&&this.addExistingContact(e)),Gr(e.changed,"num_unread")&&e.get("num_unread")&&this.addContactToGroup(e,Vc.HEADER_UNREAD),Gr(e.changed,"ask")&&"subscribe"===e.changed.ask&&this.addContactToGroup(e,Vc.HEADER_PENDING_CONTACTS),Gr(e.changed,"subscription")&&"true"===e.changed.requesting&&this.addContactToGroup(e,Vc.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;Qc.settings.get("roster_groups")?(n=e.get("groups"),n=0===n.length?[Vc.HEADER_UNGROUPED]:n):n=[Vc.HEADER_CURRENT_CONTACTS],e.get("num_unread")&&n.push(Vc.HEADER_UNREAD),n.forEach(n=>this.addContactToGroup(e,n,t))},isSelf:e=>p_.isSameBareJID(e,Vc.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(!Vc.allow_contact_requests)return void Dn.debug(`Not adding requesting or pending contact ${n} because allow_contact_requests is false`);"subscribe"===e.get("ask")||"from"===e.get("subscription")?this.addContactToGroup(e,Vc.HEADER_PENDING_CONTACTS,t):!0===e.get("requesting")&&this.addContactToGroup(e,Vc.HEADER_REQUESTING_CONTACTS,t)}return this}}),Qc.listen.on("chatBoxesInitialized",()=>{function e(e){const t=Vc.roster&&Vc.roster.findWhere({jid:e.get("jid")});void 0!==t&&t.trigger("highlight")}Vc.chatboxes.on("destroy",t=>e(t)),Vc.chatboxes.on("change:hidden",t=>e(t))}),Qc.listen.on("controlBoxInitialized",e=>{function t(){e.model.get("connected")&&Qc.settings.get("authentication")!==Vc.ANONYMOUS&&Qc.waitUntil("rosterViewInitialized").then(()=>e.controlbox_pane.el.insertAdjacentElement("beforeEnd",Vc.rosterview.el)).catch(e=>Dn.fatal(e))}t(),e.model.on("change:connected",t)}),Qc.listen.on("rosterInitialized",t),Qc.listen.on("rosterReadyAfterReconnection",t),Qc.listen.on("afterTearDown",()=>{sl.rosterview&&(sl.rosterview.model.off().reset(),sl.rosterview.each(e=>e.removeAll().remove()),sl.rosterview.removeAll().remove(),delete sl.rosterview)})}});n(496);
/**
* @description Converse.js (A browser based XMPP chat client)
* @copyright 2020, The Converse developers
* @license Mozilla Public License (MPLv2)
*/Vc.CustomElement=Kd;const g_=["converse-autocomplete","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"];i.a.templateSettings={escape:/\{\{\{([\s\S]+?)\}\}\}/g,evaluate:/\{\[([\s\S]+?)\]\}/g,interpolate:/\{\{([\s\S]+?)\}\}/g,imports:{_:i.a}},sl.env._=i.a;const m_=sl.initialize;sl.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(g_):e.whitelisted_plugins=g_,m_(e,t)};t.default=sl}]);
//# sourceMappingURL=converse.min.js.map