You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
94 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

(()=>{var t,e={8432:t=>{!function(e,r){const n="*",s=Object.defineProperties,i=Object.entries,o=(t,e)=>(r,n)=>(t.has(r)?t.get(r).add(n):t.set(r,(new Set).add(n)),e),a=(t,e)=>(r,s)=>(r!==n||s?((t,e,r,n)=>{if(n){const e=t.get(r);e&&(e.delete(n),0===e.size&&t.delete(r))}else t.delete(r)})(t,0,r,s):t.clear(),e),c=(t,e)=>(t,r)=>e.on(t,(function n(...s){e.off(t,n),r.apply(e,s)})),u=(t,e)=>(r,...s)=>{const i=t.get(r);return i&&i.forEach((t=>t.apply(e,s))),t.get(n)&&r!==n&&e.trigger(n,r,...s),e};t.exports=function(t){const e=new Map;return s(t=t||{},i({on:o,off:a,one:c,trigger:u}).reduce(((r,[n,s])=>(r[n]={value:s(e,t),enumerable:!1,writable:!1,configurable:!1},r)),{})),t}}("undefined"!=typeof window&&window)},8930:(t,e,r)=>{"use strict";const{EventEmitter:n}=r(9132),s=r(7715),i=r(4180),o="jabber:iq:roster";function a(t){return Object.assign({},t.attrs,{groups:t.getChildren("group").map((t=>t.text())),approved:"true"===t.attrs.approved,ask:"subscribe"===t.attrs.ask,name:t.attrs.name||"",subscription:t.attrs.subscription||"none",jid:new i(t.attrs.jid)})}class c extends n{constructor(t){super(),this.client=t,this.start()}get(t){const{iqCaller:e}=this.client;return e.request(s("iq",{type:"get"},s("query",{xmlns:o,ver:t}))).then((t=>{if(0===t.children.length)return null;const e=t.getChild("query");return{items:e.getChildren("item").map((t=>a(t))),version:e.attrs.ver}}))}set(t){const{iqCaller:e}=this.client;("string"==typeof t||t instanceof i.JID)&&(t={jid:t});const r=t.groups||[];return delete t.groups,e.request(s("iq",{type:"set"},s("query",{xmlns:o},s("item",t,r.map((t=>s("group",{},t))))))).then((()=>{}))}remove(t){const{iqCaller:e}=this.client;return e.request(s("iq",{type:"set"},s("query",{xmlns:o},s("item",{jid:t,subscription:"remove"})))).then((()=>{}))}start(){const{iqCallee:t}=this.client;t.set(o,"query",(t=>{if(null!==t.from){const e=t.entity.jid.bare();if(!new i(t.from).bare().equals(e))return!1}const e=t.element,r=a(e.getChild("item"));return"remove"===r.subscription?this.emit("remove",{jid:r.jid,version:e.attrs.ver}):this.emit("set",{item:r,version:e.attrs.ver}),!0}))}}t.exports=function(t){return new c(t)}},9132:(t,e,r)=>{"use strict";const n=r(2979),s=r(4850),i=r(1412),o=r(3542),a=r(7187),c=r(6828);e.EventEmitter=a,e.timeout=n,e.delay=s,e.TimeoutError=i,e.promise=o,e.Deferred=c},6828:t=>{"use strict";t.exports=function(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}},1412:t=>{"use strict";t.exports=class extends Error{constructor(t){super(t),this.name="TimeoutError"}}},4850:t=>{"use strict";t.exports=function(t){let e;const r=new Promise((r=>{e=setTimeout(r,t)}));return r.timeout=e,r}},3542:(t,e,r)=>{"use strict";const n=r(1412);t.exports=function(t,e,r="error",s){return new Promise(((i,o)=>{let a;const c=()=>{clearTimeout(a),t.removeListener(e,l),t.removeListener(r,u)};function u(t){o(t),c()}function l(t){i(t),c()}t.once(e,l),r&&t.once(r,u),s&&(a=setTimeout((()=>{c(),o(new n)}),s))}))}},2979:(t,e,r)=>{"use strict";const n=r(1412),s=r(4850);t.exports=function(t,e){const r=s(e);return Promise.race([t.finally((function(){clearTimeout(r.timeout)})),r.then((()=>{throw new n}))])}},4180:(t,e,r)=>{"use strict";const n=r(8314),s=r(909),i=r(5292);function o(...t){return t[1]||t[2]?new n(...t):i(...t)}(e=t.exports=o.bind()).jid=o,e.JID=n,e.equal=function(t,e){return t.equals(e)},e.detectEscape=s.detect,e.escapeLocal=s.escape,e.unescapeLocal=s.unescape,e.parse=i},8314:(t,e,r)=>{"use strict";const n=r(909);class s{constructor(t,e,r){if("string"!=typeof e||!e)throw new TypeError("Invalid domain.");this.setDomain(e),this.setLocal("string"==typeof t?t:""),this.setResource("string"==typeof r?r:"")}[Symbol.toPrimitive](t){return"number"===t?NaN:this.toString()}toString(t){let e=this._domain;return this._local&&(e=this.getLocal(t)+"@"+e),this._resource&&(e=e+"/"+this._resource),e}bare(){return this._resource?new s(this._local,this._domain,null):this}equals(t){return this._local===t._local&&this._domain===t._domain&&this._resource===t._resource}setLocal(t,e){return(e=e||n.detect(t))&&(t=n.escape(t)),this._local=t&&t.toLowerCase(),this}getLocal(t){let e=null;return e=(t=t||!1)?n.unescape(this._local):this._local,e}setDomain(t){return this._domain=t.toLowerCase(),this}getDomain(){return this._domain}setResource(t){return this._resource=t,this}getResource(){return this._resource}}Object.defineProperty(s.prototype,"local",{get:s.prototype.getLocal,set:s.prototype.setLocal}),Object.defineProperty(s.prototype,"domain",{get:s.prototype.getDomain,set:s.prototype.setDomain}),Object.defineProperty(s.prototype,"resource",{get:s.prototype.getResource,set:s.prototype.setResource}),t.exports=s},909:t=>{"use strict";t.exports.detect=function(t){if(!t)return!1;return-1!==t.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,"").search(/\\| |"|&|'|\/|:|<|>|@/g)},t.exports.escape=function(t){return null===t?null:t.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").replace(/\3a/g,"c3a")},t.exports.unescape=function(t){return null===t?null:t.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,"\\")}},5292:(t,e,r)=>{"use strict";const n=r(8314);t.exports=function(t){let e,r;const s=t.indexOf("/");-1!==s&&(r=t.slice(s+1),t=t.slice(0,s));const i=t.indexOf("@");return-1!==i&&(e=t.slice(0,i),t=t.slice(i+1)),new n(e,t,r)}},7715:(t,e,r)=>{"use strict";const n=r(1516),s=r(5409),i=r(9592),{escapeXML:o,unescapeXML:a,escapeXMLText:c,unescapeXMLText:u}=r(2439),l=r(7243);e=t.exports=function(...t){return n(...t)},Object.assign(e,{x:n,Element:s,Parser:i,escapeXML:o,unescapeXML:a,escapeXMLText:c,unescapeXMLText:u,XMLError:l})},5409:(t,e,r)=>{"use strict";const n=r(6219);t.exports=class extends n{setAttrs(t){"string"==typeof t?this.attrs.xmlns=t:t&&Object.keys(t).forEach((function(e){if("__source"===e||"__self"===e)return;const r=t[e];null!=r&&(this.attrs[e.toString()]=r.toString())}),this)}append(t){return(t=Array.isArray(t)?t:[t]).forEach((t=>{this.children.push(t),"object"==typeof t&&(t.parent=this)})),this}prepend(t){return(t=Array.isArray(t)?t:[t]).forEach((t=>{this.children.unshift(t),"object"==typeof t&&(t.parent=this)})),this}}},9592:(t,e,r)=>{"use strict";const n=r(3075),s=r(5409),i=r(7187),o=r(7243);class a extends i{constructor(){super();const t=new n;this.root=null,this.cursor=null,t.on("startElement",this.onStartElement.bind(this)),t.on("endElement",this.onEndElement.bind(this)),t.on("text",this.onText.bind(this)),this.parser=t}onStartElement(t,e){const r=new s(t,e),{root:n,cursor:i}=this;n?i!==n&&i.append(r):(this.root=r,this.emit("start",r)),this.cursor=r}onEndElement(t){const{root:e,cursor:r}=this;if(t===r.name){if(r!==e)return r.parent?void(this.cursor=r.parent):(r.parent=e,this.emit("element",r),void(this.cursor=e));this.emit("end",e)}else this.emit("error",new o(`${r.name} must be closed.`))}onText(t){const{cursor:e}=this;e?e.t(t):this.emit("error",new o(`${t} must be a child.`))}write(t){this.parser.write(t)}end(t){t&&this.parser.write(t)}}a.XMLError=o,t.exports=a},7243:t=>{"use strict";t.exports=class extends Error{constructor(...t){super(...t),this.name="XMLError"}}},1516:(t,e,r)=>{"use strict";const n=r(5409);function s(t,e){!1!==e&&null!=e&&(e instanceof n?t.append(e):Array.isArray(e)?e.forEach((e=>s(t,e))):t.append(String(e)))}t.exports=function(t,e,...r){const i=new n(t,e);for(let t=0;t<r.length;t++)s(i,r[t]);return i}},6219:(t,e,r)=>{"use strict";var n=r(2439),s=n.escapeXML,i=n.escapeXMLText,o=r(2930),a=o.equal,c=o.name,u=o.attrs,l=o.children,p=r(924);function h(t,e){this.name=t,this.parent=null,this.children=[],this.attrs={},this.setAttrs(e)}h.prototype.is=function(t,e){return this.getName()===t&&(!e||this.getNS()===e)},h.prototype.getName=function(){return this.name.indexOf(":")>=0?this.name.substr(this.name.indexOf(":")+1):this.name},h.prototype.getNS=function(){if(this.name.indexOf(":")>=0){var t=this.name.substr(0,this.name.indexOf(":"));return this.findNS(t)}return this.findNS()},h.prototype.findNS=function(t){if(t){var e="xmlns:"+t;if(this.attrs[e])return this.attrs[e];if(this.parent)return this.parent.findNS(t)}else{if(this.attrs.xmlns)return this.attrs.xmlns;if(this.parent)return this.parent.findNS()}},h.prototype.getXmlns=function(){var t={};for(var e in this.parent&&(t=this.parent.getXmlns()),this.attrs){var r=e.match("xmlns:?(.*)");this.attrs.hasOwnProperty(e)&&r&&(t[this.attrs[e]]=r[1])}return t},h.prototype.setAttrs=function(t){"string"==typeof t?this.attrs.xmlns=t:t&&Object.keys(t).forEach((function(e){this.attrs[e]=t[e]}),this)},h.prototype.getAttr=function(t,e){if(!e)return this.attrs[t];var r=this.getXmlns();return r[e]?this.attrs[[r[e],t].join(":")]:null},h.prototype.getChild=function(t,e){return this.getChildren(t,e)[0]},h.prototype.getChildren=function(t,e){for(var r=[],n=0;n<this.children.length;n++){var s=this.children[n];!s.getName||s.getName()!==t||e&&s.getNS()!==e||r.push(s)}return r},h.prototype.getChildByAttr=function(t,e,r,n){return this.getChildrenByAttr(t,e,r,n)[0]},h.prototype.getChildrenByAttr=function(t,e,r,n){for(var s=[],i=0;i<this.children.length;i++){var o=this.children[i];!o.attrs||o.attrs[t]!==e||r&&o.getNS()!==r||s.push(o),n&&o.getChildrenByAttr&&s.push(o.getChildrenByAttr(t,e,r,!0))}return n&&(s=[].concat.apply([],s)),s},h.prototype.getChildrenByFilter=function(t,e){for(var r=[],n=0;n<this.children.length;n++){var s=this.children[n];t(s)&&r.push(s),e&&s.getChildrenByFilter&&r.push(s.getChildrenByFilter(t,!0))}return e&&(r=[].concat.apply([],r)),r},h.prototype.getText=function(){for(var t="",e=0;e<this.children.length;e++){var r=this.children[e];"string"!=typeof r&&"number"!=typeof r||(t+=r)}return t},h.prototype.getChildText=function(t,e){var r=this.getChild(t,e);return r?r.getText():null},h.prototype.getChildElements=function(){return this.getChildrenByFilter((function(t){return t instanceof h}))},h.prototype.root=function(){return this.parent?this.parent.root():this},h.prototype.tree=h.prototype.root,h.prototype.up=function(){return this.parent?this.parent:this},h.prototype.c=function(t,e){return this.cnode(new h(t,e))},h.prototype.cnode=function(t){return this.children.push(t),"object"==typeof t&&(t.parent=this),t},h.prototype.t=function(t){return this.children.push(t),this},h.prototype.remove=function(t,e){var r;return r="string"==typeof t?function(r){return!(r.is&&r.is(t,e))}:function(e){return e!==t},this.children=this.children.filter(r),this},h.prototype.clone=function(){return p(this)},h.prototype.text=function(t){return t&&1===this.children.length?(this.children[0]=t,this):this.getText()},h.prototype.attr=function(t,e){return void 0!==e||null===e?(this.attrs||(this.attrs={}),this.attrs[t]=e,this):this.attrs[t]},h.prototype.toString=function(){var t="";return this.write((function(e){t+=e})),t},h.prototype.toJSON=function(){return{name:this.name,attrs:this.attrs,children:this.children.map((function(t){return t&&t.toJSON?t.toJSON():t}))}},h.prototype._addChildren=function(t){t(">");for(var e=0;e<this.children.length;e++){var r=this.children[e];(r||0===r)&&(r.write?r.write(t):"string"==typeof r?t(i(r)):r.toString&&t(i(r.toString(10))))}t("</"),t(this.name),t(">")},h.prototype.write=function(t){for(var e in t("<"),t(this.name),this.attrs){var r=this.attrs[e];null!=r&&(t(" "),t(e),t('="'),"string"!=typeof r&&(r=r.toString()),t(s(r)),t('"'))}0===this.children.length?t("/>"):this._addChildren(t)},h.prototype.nameEquals=function(t){return c(this,t)},h.prototype.attrsEquals=function(t){return u(this,t)},h.prototype.childrenEquals=function(t){return l(this,t)},h.prototype.equals=function(t){return a(this,t)},t.exports=h},924:t=>{"use strict";t.exports=function(t){for(var e=new t.constructor(t.name,t.attrs),r=0;r<t.children.length;r++){var n=t.children[r];e.cnode(n.clone?n.clone():n)}return e}},2930:t=>{"use strict";function e(t,e){return t.name===e.name}function r(t,e){var r=t.attrs,n=Object.keys(r),s=n.length;if(s!==Object.keys(e.attrs).length)return!1;for(var i=0,o=s;i<o;i++){var a=n[i],c=r[a];if(null==c||null==e.attrs[a]){if(c!==e.attrs[a])return!1}else if(c.toString()!==e.attrs[a].toString())return!1}return!0}function n(t,e){var r=t.children,n=r.length;if(n!==e.children.length)return!1;for(var s=0,i=n;s<i;s++){var o=r[s];if("string"==typeof o){if(o!==e.children[s])return!1}else if(!o.equals(e.children[s]))return!1}return!0}t.exports.name=e,t.exports.attrs=r,t.exports.children=n,t.exports.equal=function(t,s){return!!e(t,s)&&(!!r(t,s)&&!!n(t,s))}},2439:(t,e)=>{"use strict";var r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;"};function n(t){return r[t]}var s={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'"};function i(t){if("#"===t[1]){var e;if(9===(e="x"===t[2]?parseInt(t.slice(3),16):parseInt(t.slice(2),10))||10===e||13===e||e>=32&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111)return String.fromCodePoint(e);throw new Error("Illegal XML character 0x"+e.toString(16))}if(s[t])return s[t]||t;throw new Error("Illegal XML entity "+t)}e.escapeXML=function(t){return t.replace(/&|<|>|"|'/g,n)},e.unescapeXML=function(t){for(var e="",r=-1,n=-1,s=0;-1!==(r=t.indexOf("&",s))&&-1!==(n=t.indexOf(";",r+1));)e=e+t.substring(s,r)+i(t.substring(r,n+1)),s=n+1;return 0===s?t:e+=t.substring(s)},e.escapeXMLText=function(t){return t.replace(/&|<|>/g,n)},e.unescapeXMLText=function(t){return t.replace(/&(amp|#38|lt|#60|gt|#62);/g,i)}},3075:(t,e,r)=>{"use strict";var n=r(5717),s=r(7187).EventEmitter,i=r(2439).unescapeXML,o=t.exports=function(){s.call(this);var t,e,r,n,o,a,c,u,l=0,p=0;this._handleTagOpening=function(t,e,r){t?this.emit("endElement",e):(this.emit("startElement",e,r),o&&this.emit("endElement",e))},this.write=function(s){"string"!=typeof s&&(s=s.toString());var h=0;function d(){if("number"==typeof p){var t=s.substring(p,h);return p=void 0,t}}for(t&&(s=t+s,h+=t.length,t=null);h<s.length;h++){if(0===l){var f=s.indexOf("<",h);-1!==f&&h!==f&&(h=f)}else if(8===l){var m=s.indexOf(c,h);-1!==m&&(h=m)}else if(1===l){var g=s.indexOf("--\x3e",h);-1!==g&&(h=g+2)}else if(10===l){var y=s.indexOf("]]>",h);-1!==y&&(h=y+2)}var v=s.charCodeAt(h);switch(l){case 0:if(60===v){var x=d();x&&this.emit("text",i(x)),l=3,p=h+1,r={}}break;case 9:if(93===v&&"]>"===s.substr(h+1,2)){var b=d();b&&this.emit("text",b),l=0}break;case 3:47===v&&p===h?(p=h+1,n=!0):33===v?"[CDATA["===s.substr(h+1,7)?(p=h+8,l=9):(p=void 0,l=1):63===v?(p=void 0,l=2):(v<=32||47===v||62===v)&&(e=d(),h--,l=4);break;case 1:if(62===v){var w=s.charCodeAt(h-1),E=s.charCodeAt(h-2);(45===w&&45===E||93===w&&93===E)&&(l=0)}break;case 2:if(62===v)63===s.charCodeAt(h-1)&&(l=0);break;case 4:62===v?(this._handleTagOpening(n,e,r),e=void 0,r=void 0,n=void 0,o=void 0,l=0,p=h+1):47===v?o=!0:v>32&&(p=h,l=5);break;case 5:(v<=32||61===v)&&(u=d(),h--,l=6);break;case 6:61===v&&(l=7);break;case 7:34!==v&&39!==v||(a=v,c=34===v?'"':"'",l=8,p=h+1);break;case 8:if(v===a){var _=i(d());r[u]=_,u=void 0,l=4}}}"number"==typeof p&&p<=s.length&&(t=s.slice(p),p=0)}};n(o,s),o.prototype.end=function(t){t&&this.write(t),this.write=function(){}}},5329:(t,e,r)=>{"use strict";t.exports.encode=function(t){return r.g.btoa(t)},t.exports.decode=function(t){return r.g.atob(t)}},8678:(t,e,r)=>{"use strict";const n=r(4885),s=r(9138),i=r(7847);t.exports.Client=n,t.exports.xml=s,t.exports.jid=i},4885:(t,e,r)=>{"use strict";const n=r(6636);class s extends n{constructor(t){super(t),this.transports=[]}send(t,...e){return this.Transport.prototype.send.call(this,t,...e)}sendMany(...t){return this.Transport.prototype.sendMany.call(this,...t)}_findTransport(t){return this.transports.find((e=>{try{return void 0!==e.prototype.socketParameters(t)}catch{return!1}}))}connect(t){const e=this._findTransport(t);if(!e)throw new Error("No compatible connection method found.");return this.Transport=e,this.Socket=e.prototype.Socket,this.Parser=e.prototype.Parser,super.connect(t)}socketParameters(...t){return this.Transport.prototype.socketParameters(...t)}header(...t){return this.Transport.prototype.header(...t)}headerElement(...t){return this.Transport.prototype.headerElement(...t)}footer(...t){return this.Transport.prototype.footer(...t)}footerElement(...t){return this.Transport.prototype.footerElement(...t)}}s.prototype.NS="jabber:client",t.exports=s},2579:(t,e,r)=>{"use strict";const{xml:n,jid:s,Client:i}=r(8678),o=r(4781),a=r(4950),c=r(8117),u=r(5045),l=r(907),p=r(2779),h=r(8777),d=r(2522),f=r(8653),m=r(7405),g=r(3291),y=r(9834),v=r(7053),x=r(9961);t.exports.Lp=function(t={}){const{resource:e,credentials:r,username:n,password:s,...b}=t,{domain:w,service:E}=b;!w&&E&&(b.domain=o(E));const _=new i(b),O=a({entity:_}),S=c({entity:_}),L=u({entity:_}),N=l({middleware:L}),T=p({middleware:L,entity:_}),j=h({middleware:L,entity:_}),A=d({entity:_}),M=f({streamFeatures:N},r||{username:n,password:s}),C=y({streamFeatures:N,entity:_,middleware:L}),k=m({iqCaller:T,streamFeatures:N},e),P=g({iqCaller:T,streamFeatures:N}),D=Object.entries({plain:x,anonymous:v}).map((([t,e])=>({[t]:e(M)})));return Object.assign(_,{entity:_,reconnect:O,websocket:S,middleware:L,streamFeatures:N,iqCaller:T,iqCallee:j,resolve:A,sasl:M,resourceBinding:k,sessionEstablishment:P,streamManagement:C,mechanisms:D})}},4781:t=>{"use strict";t.exports=function(t){return(t.split("://")[1]||t).split(":")[0].split("/")[0]}},6636:(t,e,r)=>{"use strict";const{EventEmitter:n,promise:s}=r(8086),i=r(7847),o=r(9138),a=r(3637),{parseHost:c,parseService:u}=r(9085);class l extends n{constructor(t={}){super(),this.jid=null,this.timeout=2e3,this.options=t,this.socketListeners=Object.create(null),this.parserListeners=Object.create(null),this.status="offline",this.socket=null,this.parser=null,this.root=null}_reset(){this.jid=null,this.status="offline",this._detachSocket(),this._detachParser()}async _streamError(t,e){try{await this.send(o("stream:error",{},[o(t,{xmlns:"urn:ietf:params:xml:ns:xmpp-streams"},e)]))}catch{}return this._end()}_onData(t){const e=t.toString("utf8");this.emit("input",e),this.parser.write(e)}_onParserError(t){this._streamError("bad-format"),this._detachParser(),this.emit("error",t)}_attachSocket(t){this.socket=t;const e=this.socketListeners;e.data=this._onData.bind(this),e.close=(t,e)=>{this._reset(),this._status("disconnect",{clean:!t,event:e})},e.connect=()=>{this._status("connect")},e.error=t=>{this.emit("error",t)},this.socket.on("close",e.close),this.socket.on("data",e.data),this.socket.on("error",e.error),this.socket.on("connect",e.connect)}_detachSocket(){const{socketListeners:t,socket:e}=this;for(const r of Object.getOwnPropertyNames(t))e.removeListener(r,t[r]),delete t[r];return this.socket=null,e}_onElement(t){const e=t.is("error","http://etherx.jabber.org/streams");e&&this._onStreamError(t),this.emit("element",t),this.emit(this.isStanza(t)?"stanza":"nonza",t),e&&this._end()}_onStreamError(t){const e=a.fromElement(t);if("see-other-host"===e.condition)return this._onSeeOtherHost(e);this.emit("error",e)}async _onSeeOtherHost(t){const{protocol:e}=u(this.options.service),r=t.element.getChildText("see-other-host"),{port:n}=c(r);let i;i=n?`${e||"xmpp:"}//${r}`:(e?`${e}//`:"")+r;try{await s(this,"disconnect");const{domain:t,lang:e}=this.options;await this.connect(i),await this.open({domain:t,lang:e})}catch(t){this.emit("error",t)}}_attachParser(t){this.parser=t;const e=this.parserListeners;e.element=this._onElement.bind(this),e.error=this._onParserError.bind(this),e.end=t=>{this._detachParser(),this._status("close",t)},e.start=t=>{this._status("open",t)},this.parser.on("error",e.error),this.parser.on("element",e.element),this.parser.on("end",e.end),this.parser.on("start",e.start)}_detachParser(){const t=this.parserListeners;for(const e of Object.getOwnPropertyNames(t))this.parser.removeListener(e,t[e]),delete t[e];this.parser=null}_jid(t){return this.jid=i(t),this.jid}_status(t,...e){this.status=t,this.emit("status",t,...e),this.emit(t,...e)}async _end(){let t;try{t=await this.close()}catch{}try{await this.disconnect()}catch{}return t}async start(){if("offline"!==this.status)throw new Error("Connection is not offline");const{service:t,domain:e,lang:r}=this.options;await this.connect(t);const n=s(this,"online");return await this.open({domain:e,lang:r}),n}async connect(t){this._status("connecting",t);const e=new this.Socket;return this._attachSocket(e),e.connect(this.socketParameters(t)),s(e,"connect")}async disconnect(t=this.timeout){this.socket&&this._status("disconnecting"),this.socket.end(),await s(this.socket,"close","error",t)}async open(t){this._status("opening"),"string"==typeof t&&(t={domain:t});const{domain:e,lang:r,timeout:n=this.timeout}=t,i=this.headerElement();return i.attrs.to=e,i.attrs["xml:lang"]=r,this.root=i,this._attachParser(new this.Parser),await this.write(this.header(i)),s(this,"open","error",n)}async stop(){const t=await this._end();return"offline"!==this.status&&this._status("offline",t),t}async close(t=this.timeout){const e=this.footer(this.footerElement()),r=Promise.all([s(this.parser,"end","error",t),this.write(e)]);this.parser&&this.socket&&this._status("closing");const[n]=await r;return this.root=null,n}async restart(){this._detachParser();const{domain:t,lang:e}=this.options;return this.open({domain:t,lang:e})}async send(t){t.parent=this.root,await this.write(t.toString()),this.emit("send",t)}sendReceive(t,e=this.timeout){return Promise.all([this.send(t),s(this,"element","error",e)]).then((([,t])=>t))}write(t){return new Promise(((e,r)=>{"closing"!==this.status?this.socket.write(t,(n=>{if(n)return r(n);this.emit("output",t),e()})):r(new Error("Connection is closing"))}))}isStanza(t){const{name:e}=t;return"iq"===e||"message"===e||"presence"===e}isNonza(t){return!this.isStanza(t)}header(t){return t.toString()}headerElement(){return new o.Element("",{version:"1.0",xmlns:this.NS})}footer(t){return t.toString()}footerElement(){}socketParameters(){}}l.prototype.NS="",l.prototype.Socket=null,l.prototype.Parser=null,t.exports=l},3637:(t,e,r)=>{"use strict";const n=r(8970);t.exports=class extends n{constructor(...t){super(...t),this.name="StreamError"}}},9085:t=>{"use strict";function e(t){let{port:e,hostname:r,protocol:n}=new URL(t);return"[::1]"===r&&(r="::1"),{port:e,hostname:r,protocol:n}}function r(t){const{port:r,hostname:n}=e(`http://${t}`);return{port:r,hostname:n}}Object.assign(t.exports,{parseURI:e,parseHost:r,parseService:function(t){return t.includes("://")?e(t):r(t)}})},8970:t=>{"use strict";class e extends Error{constructor(t,e,r){super(t+(e?` - ${e}`:"")),this.name="XMPPError",this.condition=t,this.text=e,this.application=r}static fromElement(t){const[e,r,n]=t.children;let s,i;r&&(r.is("text")?s=r:r&&(i=r),n&&(i=n));const o=new this(e.name,s?s.text():"",i);return o.element=t,o}}t.exports=e},8086:(t,e,r)=>{"use strict";const n=r(3708),s=r(9902),i=r(9353),o=r(2471),a=r(7187),c=r(5276);e.EventEmitter=a,e.timeout=n,e.delay=s,e.TimeoutError=i,e.promise=o,e.Deferred=c},5276:t=>{"use strict";t.exports=function(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}},9353:t=>{"use strict";t.exports=class extends Error{constructor(t){super(t),this.name="TimeoutError"}}},9902:t=>{"use strict";t.exports=function(t){let e;const r=new Promise((r=>{e=setTimeout(r,t)}));return r.timeout=e,r}},2471:(t,e,r)=>{"use strict";const n=r(9353);t.exports=function(t,e,r="error",s){return new Promise(((i,o)=>{let a;const c=()=>{clearTimeout(a),t.removeListener(e,l),t.removeListener(r,u)};function u(t){o(t),c()}function l(t){i(t),c()}t.once(e,l),r&&t.once(r,u),s&&(a=setTimeout((()=>{c(),o(new n)}),s))}))}},3708:(t,e,r)=>{"use strict";const n=r(9353),s=r(9902);t.exports=function(t,e){const r=s(e);return Promise.race([t.finally((function(){clearTimeout(r.timeout)})),r.then((()=>{throw new n}))])}},3445:t=>{"use strict";t.exports=function(){let t;for(;!t;)t=Math.random().toString(36).slice(2,12);return t}},8777:(t,e,r)=>{"use strict";const n=r(9138);function s({stanza:t}){return n("iq",{to:t.attrs.from,from:t.attrs.to,id:t.attrs.id})}function i(t,e,r){const n=s(t);return n.attrs.type="error",r&&n.append(r),n.append(e),n}function o(t,e){return n("error",{type:t},n(e,"urn:ietf:params:xml:ns:xmpp-stanzas"))}function a(t){return async function(e,r){if(!function({name:t,type:e}){return"iq"===t&&"error"!==e&&"result"!==e}(e))return r();const{stanza:a}=e,c=a.getChildElements(),[u]=c;if(!function({type:t},e,r){return("get"===t||"set"===t)&&1===e.length&&!!r}(e,c,u))return i(e,o("modify","bad-request"),u);let l;e.element=u;try{l=await r()}catch(e){t.emit("error",e),l=o("cancel","internal-server-error")}return l||(l=o("cancel","service-unavailable")),l instanceof n.Element&&l.is("error")?i(e,l,u):function(t,e){const r=s(t);return r.attrs.type="result",e&&r.append(e),r}(e,l instanceof n.Element?l:void 0)}}function c(t,e,r,n){return(s,i)=>s.type!==t|!s.element||!s.element.is(r,e)?i():n(s,i)}t.exports=function({middleware:t,entity:e}){return t.use(a(e)),{get(e,r,n){t.use(c("get",e,r,n))},set(e,r,n){t.use(c("set",e,r,n))}}}},2779:(t,e,r)=>{"use strict";const n=r(3445),s=r(7860),{Deferred:i}=r(8086),o=r(8086).timeout,a=r(9138);class c{constructor({entity:t,middleware:e}){this.handlers=new Map,this.entity=t,this.middleware=e}start(){this.middleware.use(this._route.bind(this))}_route({type:t,name:e,id:r,stanza:n},i){if(!function({name:t,type:e}){return"iq"===t&&("error"===e||"result"===e)}({name:e,type:t}))return i();const o=this.handlers.get(r);if(!o)return i();"error"===t?o.reject(s.fromElement(n.getChild("error"))):o.resolve(n),this.handlers.delete(r)}async request(t,e=3e4){t.attrs.id||(t.attrs.id=n());const r=new i;this.handlers.set(t.attrs.id,r);try{await this.entity.send(t),await o(r.promise,e)}catch(e){throw this.handlers.delete(t.attrs.id),e}return r.promise}_childRequest(t,e,r,...n){const{name:s,attrs:{xmlns:i}}=e;return this.request(a("iq",{type:t,to:r},e),...n).then((t=>t.getChild(s,i)))}async get(...t){return this._childRequest("get",...t)}async set(...t){return this._childRequest("set",...t)}}t.exports=function(...t){const e=new c(...t);return e.start(),e}},7847:(t,e,r)=>{"use strict";const n=r(1075),s=r(7587),i=r(1052);function o(...t){return t[1]||t[2]?new n(...t):i(...t)}t.exports=o.bind(),t.exports.jid=o,t.exports.JID=n,t.exports.equal=function(t,e){return t.equals(e)},t.exports.detectEscape=s.detect,t.exports.escapeLocal=s.escape,t.exports.unescapeLocal=s.unescape,t.exports.parse=i},1075:(t,e,r)=>{"use strict";const n=r(7587);class s{constructor(t,e,r){if("string"!=typeof e||!e)throw new TypeError("Invalid domain.");this.setDomain(e),this.setLocal("string"==typeof t?t:""),this.setResource("string"==typeof r?r:"")}[Symbol.toPrimitive](t){return"number"===t?NaN:this.toString()}toString(t){let e=this._domain;return this._local&&(e=this.getLocal(t)+"@"+e),this._resource&&(e=e+"/"+this._resource),e}bare(){return this._resource?new s(this._local,this._domain,null):this}equals(t){return this._local===t._local&&this._domain===t._domain&&this._resource===t._resource}setLocal(t,e){return(e=e||n.detect(t))&&(t=n.escape(t)),this._local=t&&t.toLowerCase(),this}getLocal(t=!1){let e=null;return e=t?n.unescape(this._local):this._local,e}setDomain(t){return this._domain=t.toLowerCase(),this}getDomain(){return this._domain}setResource(t){return this._resource=t,this}getResource(){return this._resource}}Object.defineProperty(s.prototype,"local",{get:s.prototype.getLocal,set:s.prototype.setLocal}),Object.defineProperty(s.prototype,"domain",{get:s.prototype.getDomain,set:s.prototype.setDomain}),Object.defineProperty(s.prototype,"resource",{get:s.prototype.getResource,set:s.prototype.setResource}),t.exports=s},7587:t=>{"use strict";t.exports.detect=function(t){if(!t)return!1;return-1!==t.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,"").search(/[ "&'/:<>@\\]/g)},t.exports.escape=function(t){return null===t?null:t.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")},t.exports.unescape=function(t){return null===t?null:t.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,"\\")}},1052:(t,e,r)=>{"use strict";const n=r(1075);t.exports=function(t){let e,r;const s=t.indexOf("/");-1!==s&&(r=t.slice(s+1),t=t.slice(0,s));const i=t.indexOf("@");return-1!==i&&(e=t.slice(0,i),t=t.slice(i+1)),new n(e,t,r)}},5045:(t,e,r)=>{"use strict";const n=r(4127),s=r(9240),i=r(3606);function o(t,e,r){return s=>{const i=new r(t,s);return n(e)(i)}}function a(t){return(e,r)=>{r().then((e=>e&&t.send(e))).catch((e=>t.emit("error",e)))}}t.exports=function({entity:t}){const e=[a(t)],r=[],n=o(t,e,s),c=o(t,r,i);return t.on("element",n),t.hookOutgoing=c,{use:t=>(e.push(t),t),filter:t=>(r.push(t),t)}}},2521:t=>{"use strict";t.exports=class{constructor(t,e){this.stanza=e,this.entity=t;const{name:r,attrs:n}=e,{type:s,id:i}=n;this.name=r,this.id=i||"",this.type="message"===r?s||"normal":"presence"===r?s||"available":s||"",this.from=null,this.to=null,this.local="",this.domain="",this.resource=""}}},9240:(t,e,r)=>{"use strict";const n=r(2521),s=r(7847);t.exports=class extends n{constructor(t,e){super(t,e);const{jid:r,domain:n}=t,i=e.attrs.to||r&&r.toString(),o=e.attrs.from||n;i&&(this.to=new s(i)),o&&(this.from=new s(o),this.local=this.from.local,this.domain=this.from.domain,this.resource=this.from.resource)}}},3606:(t,e,r)=>{"use strict";const n=r(2521),s=r(7847);t.exports=class extends n{constructor(t,e){super(t,e);const{jid:r,domain:n}=t,i=e.attrs.from||r&&r.toString(),o=e.attrs.to||n;i&&(this.from=new s(i)),o&&(this.to=new s(o),this.local=this.to.local,this.domain=this.to.domain,this.resource=this.to.resource)}}},7860:(t,e,r)=>{"use strict";const n=r(8970);t.exports=class extends n{constructor(t,e,r,n){super(t,e,r),this.type=n,this.name="StanzaError"}static fromElement(t){const e=super.fromElement(t);return e.type=t.attrs.type,e}}},4950:(t,e,r)=>{"use strict";const{EventEmitter:n}=r(8086);class s extends n{constructor(t){super(),this.delay=1e3,this.entity=t,this._timeout=null}scheduleReconnect(){const{entity:t,delay:e,_timeout:r}=this;clearTimeout(r),this._timeout=setTimeout((async()=>{if("disconnect"===t.status)try{await this.reconnect()}catch{}}),e)}async reconnect(){const{entity:t}=this;this.emit("reconnecting");const{service:e,domain:r,lang:n}=t.options;await t.connect(e),await t.open({domain:r,lang:n}),this.emit("reconnected")}start(){const{entity:t}=this,e={};e.disconnect=()=>{this.scheduleReconnect()},this.listeners=e,t.on("disconnect",e.disconnect)}stop(){const{entity:t,listeners:e,_timeout:r}=this;t.removeListener("disconnect",e.disconnect),clearTimeout(r)}}t.exports=function({entity:t}){const e=new s(t);return e.start(),e}},2522:(t,e,r)=>{"use strict";const n=r(8697),{promise:s}=r(8086);async function i(t){const e=await n(t,{srv:[{service:"xmpps-client",protocol:"tcp"},{service:"xmpp-client",protocol:"tcp"}]});return[...new Set(e.map((t=>t.uri)))]}async function o(t,e){if(0===e.length)throw new Error("Couldn't connect");const r=e.shift(),n=t._findTransport(r);if(!n)return o(t,e);t._status("connecting",r);const i=n.prototype.socketParameters(r),a=new n.prototype.Socket;try{a.connect(i),await s(a,"connect")}catch{return o(t,e)}t._attachSocket(a),a.emit("connect"),t.Transport=n,t.Socket=n.prototype.Socket,t.Parser=n.prototype.Parser}t.exports=function({entity:t}){const e=t.connect;t.connect=async function(r){if(!r||/:\/\//.test(r))return e.call(this,r);const n=function(t,e){return e.filter((e=>t._findTransport(e)))}(t,await i(r));if(0===n.length)throw new Error("No compatible transport found.");try{await o(t,n)}catch(e){throw t._reset(),t._status("disconnect"),e}}}},4073:t=>{"use strict";function e(t){return t.startsWith("https")||t.startsWith("wss")}t.exports.q=function(t,r){let n,s;return n=e(t.uri)&&!e(r.uri)?-1:!e(t.uri)&&e(r.uri)?1:0,0!==n?n:(s=t.method===r.method?0:"websocket"===t.method?-1:"websocket"===r.method?1:"xbosh"===t.method?-1:"xbosh"===r.method?1:"httppoll"===t.method?-1:"httppoll"===r.method?1:0,0!==s?s:0)}},8977:(t,e,r)=>{"use strict";const n=r.g.fetch||r(2754),s=r(5946),i=r(4073).q;t.exports.resolve=function(t){return n(`https://${t}/.well-known/host-meta`).then((t=>t.text())).then((t=>s(t).getChildren("Link").filter((t=>["urn:xmpp:alt-connections:websocket","urn:xmpp:alt-connections:httppoll","urn:xmpp:alt-connections:xbosh"].includes(t.attrs.rel))).map((({attrs:t})=>({rel:t.rel,href:t.href,method:t.rel.split(":").pop(),uri:t.href}))).sort(i))).catch((()=>[]))}},8697:(t,e,r)=>{"use strict";const n=r(6739),s=r(8977);t.exports=function(...t){return Promise.all([n.resolve?n.resolve(...t):Promise.resolve([]),s.resolve(...t)]).then((([t,e])=>[...t,...e]))},n.resolve&&(t.exports.dns=n),t.exports.http=s},7405:(t,e,r)=>{"use strict";const n=r(9138),s="urn:ietf:params:xml:ns:xmpp-bind";async function i(t,e,r){const i=await e.set(function(t){return n("bind",{xmlns:s},t&&n("resource",{},t))}(r)),o=i.getChildText("jid");return t._jid(o),o}t.exports=function({streamFeatures:t,iqCaller:e},r){t.use("bind",s,function({iqCaller:t},e){return async({entity:r},n)=>{await("function"==typeof e?e((e=>i(r,t,e))):i(r,t,e)),n()}}({iqCaller:e},r))}},7053:(t,e,r)=>{"use strict";const n=r(3375);t.exports=function(t){t.use(n)}},9961:(t,e,r)=>{"use strict";const n=r(3342);t.exports=function(t){t.use(n)}},8653:(t,e,r)=>{"use strict";const{encode:n,decode:s}=r(5329),i=r(5252),o=r(9138),a=r(2801),c="urn:ietf:params:xml:ns:xmpp-sasl";async function u(t,e,r,a){const u=t.create([r]);if(!u)throw new Error("No compatible mechanism");const{domain:l}=e.options,p={username:null,password:null,server:l,host:l,realm:l,serviceType:"xmpp",serviceName:l,...a};return new Promise(((t,r)=>{const a=l=>{if(l.attrs.xmlns===c)if("challenge"!==l.name)"failure"===l.name?r(i.fromElement(l)):"success"===l.name&&t(),e.removeListener("nonza",a);else{u.challenge(s(l.text()));const t=u.response(p);e.send(o("response",{xmlns:c,mechanism:u.name},"string"==typeof t?n(t):""))}};e.on("nonza",a),u.clientFirst&&e.send(o("auth",{xmlns:c,mechanism:u.name},n(u.response(p))))}))}t.exports=function({streamFeatures:t},e){const r=new a;return t.use("mechanisms",c,(async({stanza:t,entity:n})=>{const s=t.getChild("mechanisms",c).children.map((t=>t.text()));const i=r._mechs.map((({name:t})=>t)).filter((t=>s.includes(t)));let o=i[0];"function"==typeof e?await e((t=>u(r,n,o,t)),o):(e.username||e.password||(o="ANONYMOUS"),await u(r,n,o,e)),await n.restart()})),{use:(...t)=>r.use(...t)}}},5252:(t,e,r)=>{"use strict";const n=r(8970);t.exports=class extends n{constructor(...t){super(...t),this.name="SASLError"}}},3291:(t,e,r)=>{"use strict";const n=r(9138),s="urn:ietf:params:xml:ns:xmpp-session";t.exports=function({iqCaller:t,streamFeatures:e}){e.use("session",s,(async(e,r,i)=>(i.getChild("optional")||await t.set(n("session",s)),r())))}},907:(t,e,r)=>{"use strict";const n=r(8393);t.exports=function({middleware:t}){return t.use(n()),{use:function(e,r,n){return t.use(((t,s)=>{const{stanza:i}=t;if(!i.is("features","http://etherx.jabber.org/streams"))return s();const o=i.getChild(e,r);return o?n(t,s,o):s()}))}}}},8393:t=>{"use strict";t.exports=function(){return async({stanza:t,entity:e},r)=>{if(!t.is("features","http://etherx.jabber.org/streams"))return r();!await r()&&e.jid&&e._status("online",e.jid)}}},9834:(t,e,r)=>{"use strict";const n=r(9138),s="urn:xmpp:sm:3";t.exports=function({streamFeatures:t,entity:e,middleware:r}){let i=null;const o={allowResume:!0,preferredMaximum:null,enabled:!1,id:"",outbound:0,inbound:0,max:null};return e.on("online",(t=>{i=t,o.outbound=0,o.inbound=0})),e.on("offline",(()=>{o.outbound=0,o.inbound=0,o.enabled=!1,o.id=""})),r.use(((t,r)=>{const{stanza:i}=t;return["presence","message","iq"].includes(i.name)?o.inbound+=1:i.is("r",s)?e.send(n("a",{xmlns:s,h:o.inbound})).catch((()=>{})):i.is("a",s)&&(o.outbound=i.attrs.h),r()})),t.use("sm",s,(async(t,r)=>{if(o.id)try{return await async function(t,e,r){const i=await t.sendReceive(n("resume",{xmlns:s,h:e,previd:r}));if(!i.is("resumed",s))throw i;return i}(e,o.inbound,o.id),o.enabled=!0,e.jid=i,e.status="online",!0}catch{o.id="",o.enabled=!1,o.outbound=0}await r();const a=async function(t,e,r){return t.send(n("enable",{xmlns:s,max:r,resume:e?"true":void 0})),new Promise(((e,r)=>{t.on("nonza",(function n(i){if(i.is("enabled",s))e(i);else{if(!i.is("failed",s))return;r(i)}t.removeListener("nonza",n)}))}))}(e,o.allowResume,o.preferredMaximum);o.outbound=0;try{const t=await a;o.enabled=!0,o.id=t.attrs.id,o.max=t.attrs.max}catch{o.enabled=!1}o.inbound=0})),o}},8117:(t,e,r)=>{"use strict";const n=r(8216);t.exports=function({entity:t}){t.transports.push(n)}},8216:(t,e,r)=>{"use strict";const n=r(4383),s=r(6636),i=r(9138),o=r(4405),a="urn:ietf:params:xml:ns:xmpp-framing";class c extends s{send(t,...e){return!t.attrs.xmlns&&super.isStanza(t)&&(t.attrs.xmlns="jabber:client"),super.send(t,...e)}async sendMany(t){for(const e of t)await this.send(e)}footerElement(){return new i.Element("close",{xmlns:a})}headerElement(){const t=super.headerElement();return t.name="open",t.attrs.xmlns=a,t}socketParameters(t){return/^wss?:\/\//.test(t)?t:void 0}}c.prototype.Socket=n,c.prototype.NS="jabber:client",c.prototype.Parser=o,t.exports=c},4405:(t,e,r)=>{"use strict";const{Parser:n,Element:s,XMLError:i}=r(9138);t.exports=class extends n{onStartElement(t,e){const r=new s(t,e),{cursor:n}=this;n&&n.append(r),this.cursor=r}onEndElement(t){const{cursor:e}=this;t===e.name?e.parent?this.cursor=e.parent:(e.is("open","urn:ietf:params:xml:ns:xmpp-framing")?this.emit("start",e):e.is("close","urn:ietf:params:xml:ns:xmpp-framing")?this.emit("end",e):this.emit("element",e),this.cursor=null):this.emit("error",new i(`${e.name} must be closed.`))}}},4383:(t,e,r)=>{"use strict";const n=r(2993),s=r.g.WebSocket||n,i=r(7187),o="ECONNERROR";t.exports=class extends i{constructor(){super(),this.listeners=Object.create(null)}connect(t){this.url=t,this._attachSocket(new s(t,["xmpp"]))}_attachSocket(t){this.socket=t;const{listeners:e}=this;e.open=()=>{this.emit("connect")},e.message=({data:t})=>this.emit("data",t),e.error=t=>{const{url:e}=this;let{error:r}=t;r||(r=new Error(`WebSocket ${o} ${e}`),r.errno=o,r.code=o),r.event=t,r.url=e,this.emit("error",r)},e.close=t=>{this._detachSocket(),this.emit("close",!t.wasClean,t)},this.socket.addEventListener("open",e.open),this.socket.addEventListener("message",e.message),this.socket.addEventListener("error",e.error),this.socket.addEventListener("close",e.close)}_detachSocket(){delete this.url;const{socket:t,listeners:e}=this;for(const r of Object.getOwnPropertyNames(e))t.removeEventListener(r,e[r]),delete e[r];delete this.socket}end(){this.socket.close()}write(t,e){s===n?this.socket.send(t,e):(this.socket.send(t),e())}}},9138:(t,e,r)=>{"use strict";const n=r(8729),s=r(7889),i=r(4970),{escapeXML:o,unescapeXML:a,escapeXMLText:c,unescapeXMLText:u}=r(4203),l=r(4959);t.exports=function(...t){return s(...t)},Object.assign(t.exports,{Element:n,createElement:s,Parser:i,escapeXML:o,unescapeXML:a,escapeXMLText:c,unescapeXMLText:u,XMLError:l})},4970:(t,e,r)=>{"use strict";const n=r(9354),s=r(8729),i=r(7187),o=r(4959);class a extends i{constructor(){super();const t=new n;this.root=null,this.cursor=null,t.on("startElement",this.onStartElement.bind(this)),t.on("endElement",this.onEndElement.bind(this)),t.on("text",this.onText.bind(this)),this.parser=t}onStartElement(t,e){const r=new s(t,e),{root:n,cursor:i}=this;n?i!==n&&i.append(r):(this.root=r,this.emit("start",r)),this.cursor=r}onEndElement(t){const{root:e,cursor:r}=this;if(t===r.name){if(r!==e)return r.parent?void(this.cursor=r.parent):(r.parent=e,this.emit("element",r),void(this.cursor=e));this.emit("end",e)}else this.emit("error",new o(`${r.name} must be closed.`))}onText(t){const{cursor:e}=this;e?e.t(t):this.emit("error",new o(`${t} must be a child.`))}write(t){this.parser.write(t)}end(t){t&&this.parser.write(t)}}a.XMLError=o,t.exports=a},4959:t=>{"use strict";t.exports=class extends Error{constructor(...t){super(...t),this.name="XMLError"}}},5946:(t,e,r)=>{"use strict";const n=r(4970);t.exports=function(t){const e=new n;let r=null,s=null;if(e.on("start",(t=>{r=t})),e.on("element",(t=>{r.append(t)})),e.on("error",(t=>{s=t})),e.write(t),e.end(),s)throw s;return r}},5065:(t,e,r)=>{"use strict";function n(t){return t.replace(/-(\w)/g,((t,e)=>e.toUpperCase()))}function s(t,e){t.firstChild&&(e.appendChild(t.firstChild),s(t,e))}function i(t){o(t.childNodes)}function o(t){Array.from(t).forEach(a)}const a=t=>t&&t.parentNode&&t.parentNode.removeChild(t),c=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),u=new Map,l=Symbol("riot-component"),p=new Set,h="is",d="mount",f="update",m="unmount",g="shouldUpdate",y="onBeforeMount",v="onMounted",x="onBeforeUpdate",b="onUpdated",w="onBeforeUnmount",E="onUnmounted",_="props",O="state",S="slots",L="root",N=Symbol("pure"),T=Symbol("is_updating"),j=Symbol("parent"),A=Symbol("attributes"),M=Symbol("template");var C=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:u,DOM_COMPONENT_INSTANCE_PROPERTY:l,PLUGINS_SET:p,IS_DIRECTIVE:h,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:d,UPDATE_METHOD_KEY:f,UNMOUNT_METHOD_KEY:m,SHOULD_UPDATE_KEY:g,ON_BEFORE_MOUNT_KEY:y,ON_MOUNTED_KEY:v,ON_BEFORE_UPDATE_KEY:x,ON_UPDATED_KEY:b,ON_BEFORE_UNMOUNT_KEY:w,ON_UNMOUNTED_KEY:E,PROPS_KEY:_,STATE_KEY:O,SLOTS_KEY:S,ROOT_KEY:L,IS_PURE_SYMBOL:N,IS_COMPONENT_UPDATING:T,PARENT_KEY_SYMBOL:j,ATTRIBUTES_KEY_SYMBOL:A,TEMPLATE_KEY_SYMBOL:M});var k={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};var P={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const D=Symbol("head"),q=Symbol("tail");function R(t){const e=t.dom.cloneNode(!0),{head:r,tail:n}=function(){const t=document.createTextNode(""),e=document.createTextNode("");return t[D]=!0,e[q]=!0,{head:t,tail:e}}();return{avoidDOMInjection:!0,fragment:e,head:r,tail:n,children:[r,...Array.from(e.childNodes),n]}}function F(t,e,r,n){return void 0===n&&(n={}),Object.defineProperty(t,e,Object.assign({value:r,enumerable:!1,writable:!1,configurable:!0},n)),t}function I(t,e,r){return Object.entries(e).forEach((e=>{let[n,s]=e;F(t,n,s,r)})),t}function z(t,e){return Object.entries(e).forEach((e=>{let[r,n]=e;t[r]||(t[r]=n)})),t}function X(t,e){return typeof t===e}function U(t){const e=t.ownerSVGElement;return!!e||null===e}function B(t){return"template"===t.tagName.toLowerCase()}function V(t){return X(t,"function")}function $(t){return!K(t)&&t.constructor===Object}function K(t){return null==t}const Y=Symbol("unmount"),H={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:r,nodes:n,childrenMap:s}=this,i=t===Y?null:this.evaluate(t),o=i?Array.from(i):[],{newChildrenMap:u,batches:l,futureNodes:p}=function(t,e,r,n){const{condition:s,template:i,childrenMap:o,itemName:a,getKey:c,indexName:u,root:l,isTemplateTag:p}=n,h=new Map,d=[],f=[];return t.forEach(((t,n)=>{const m=function(t,e){let{itemName:r,indexName:n,index:s,item:i}=e;F(t,r,i),n&&F(t,n,s);return t}(Object.create(e),{itemName:a,indexName:u,index:n,item:t}),g=c?c(m):n,y=o.get(g),v=[];if(function(t,e){return!!t&&!t(e)}(s,m))return;const x=!y,b=y?y.template:i.clone(),w=b.el||l.cloneNode(),E=p&&x?R(b):b.meta;x?d.push((()=>b.mount(w,m,r,E))):d.push((()=>b.update(m,r))),p?v.push(...E.children):v.push(w),o.delete(g),f.push(...v),h.set(g,{nodes:v,template:b,context:m,index:n})})),{newChildrenMap:h,batches:d,futureNodes:f}}(o,t,e,this);return((t,e,r,n)=>{const s=e.length;let i=t.length,o=s,u=0,l=0,p=null;for(;u<i||l<o;)if(i===u){const t=o<s?l?r(e[l-1],-0).nextSibling:r(e[o-l],0):n;for(;l<o;)c(r(e[l++],1),t)}else if(o===l)for(;u<i;)p&&p.has(t[u])||a(r(t[u],-1)),u++;else if(t[u]===e[l])u++,l++;else if(t[i-1]===e[o-1])i--,o--;else if(t[u]===e[o-1]&&e[l]===t[i-1]){const n=r(t[--i],-1).nextSibling;c(r(e[l++],1),r(t[u++],-1).nextSibling),c(r(e[--o],1),n),t[i]=e[o]}else{if(!p){p=new Map;let t=l;for(;t<o;)p.set(e[t],t++)}if(p.has(t[u])){const n=p.get(t[u]);if(l<n&&n<o){let s=u,a=1;for(;++s<i&&s<o&&p.get(t[s])===n+a;)a++;if(a>n-l){const s=r(t[u],0);for(;l<n;)c(r(e[l++],1),s)}else h=r(e[l++],1),(d=r(t[u++],-1))&&d.parentNode&&d.parentNode.replaceChild(h,d)}else u++}else a(r(t[u++],-1))}var h,d})(n,p,function(t,e){return(r,n)=>{if(n<0){const r=t[t.length-1];if(r){const{template:n,nodes:s,context:i}=r;s.pop(),s.length||(t.pop(),n.unmount(i,e,null))}}return r}}(Array.from(s.values()),e),r),l.forEach((t=>t())),this.childrenMap=u,this.nodes=p,this},unmount(t,e){return this.update(Y,e),this}};const G={mount(t,e){return this.update(t,e)},update(t,e){const r=!!this.evaluate(t),n=!this.value&&r,s=this.value&&!r,i=()=>{const r=this.node.cloneNode();c(r,this.placeholder),this.template=this.template.clone(),this.template.mount(r,t,e)};switch(!0){case n:i();break;case s:this.unmount(t);break;default:r&&this.template.update(t,e)}return this.value=r,this},unmount(t,e){return this.template.unmount(t,e,!0),this}};function J(t){throw new Error(t)}function W(t){const e=new Map,r=r=>(e.has(r)||e.set(r,t.call(this,r)))&&e.get(r);return r.cache=e,r}function Z(t){return t.reduce(((t,e)=>{const{value:r,type:s}=e;switch(!0){case!e.name&&0===s:return Object.assign({},t,r);case 3===s:t.value=e.value;break;default:t[n(e.name)]=e.value}return t}),{})}const Q="undefined"==typeof Element?{}:Element.prototype,tt=W((t=>Q.hasOwnProperty(t)));function et(t,e,r,n){let{name:s}=e;if(!s)return n&&function(t,e,r){const n=e?Object.keys(e):[];Object.keys(r).filter((t=>!n.includes(t))).forEach((e=>t.removeAttribute(e)))}(t,r,n),void(r&&function(t,e){Object.entries(e).forEach((e=>{let[r,n]=e;return et(t,{name:r},n)}))}(t,r));!tt(s)&&(function(t){return X(t,"boolean")}(r)||$(r)||V(r))&&(t[s]=r),!function(t){return!t&&0!==t}(r)?function(t){return!0===t||["string","number"].includes(typeof t)}(r)&&t.setAttribute(s,function(t,e){return!0===e?t:e}(s,r)):t.removeAttribute(s)}const rt=/^on/,nt={handleEvent(t){this[t.type](t)}},st=new WeakMap;function it(t){return K(t)?"":t}const ot=(t,e)=>{const r=t.childNodes[e];if(r.nodeType===Node.COMMENT_NODE){const e=document.createTextNode("");return t.replaceChild(e,r),e}return r};var at={0:et,1:function(t,e,r){let{name:n}=e;const s=n.replace(rt,""),i=st.get(t)||(t=>{const e=Object.create(nt);return st.set(t,e),e})(t),[o,a]=(t=>Array.isArray(t)?t:[t,!1])(r),c=i[s],u=o&&!c;c&&!o&&t.removeEventListener(s,i),u&&t.addEventListener(s,i,a),i[s]=o},2:function(t,e,r){t.data=it(r)},3:function(t,e,r){t.value=it(r)}};const ct={mount(t){return this.value=this.evaluate(t),ut(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(ut(this,e),this.value=e),this},unmount(){return 1===this.type&&ut(this,null),this}};function ut(t,e){return at[t.type](t.node,t,e,t.value)}function lt(t,e){return Object.assign({},ct,e,{node:2===e.type?ot(t,e.childNodeIndex):t})}const pt=(t,e)=>t[j]||e,ht={attributes:[],getTemplateScope(t,e){return function(t,e,r){if(!t||!t.length)return r;const n=t.map((t=>Object.assign({},t,{value:t.evaluate(e)})));return Object.assign(Object.create(r||null),Z(n))}(this.attributes,t,e)},mount(t,e){const r=!!t.slots&&t.slots.find((t=>{let{id:e}=t;return e===this.name})),{parentNode:n}=this.node,s=pt(t,e);return this.template=r&&Et(r.html,r.bindings).createDOM(n),this.template&&(i(this.node),this.template.mount(this.node,this.getTemplateScope(t,s),s),this.template.children=Array.from(this.node.childNodes)),dt(this.node),a(this.node),this},update(t,e){if(this.template){const r=pt(t,e);this.template.update(this.getTemplateScope(t,r),r)}return this},unmount(t,e,r){return this.template&&this.template.unmount(this.getTemplateScope(t,e),null,r),this}};function dt(t){const e=t&&t.firstChild;e&&(c(e,t),dt(t))}function ft(t){return t.reduce(((t,e)=>{let{bindings:r}=e;return t.concat(r)}),[])}const mt={mount(t){return this.update(t)},update(t,e){const r=this.evaluate(t);return r&&r===this.name?this.tag.update(t):(this.unmount(t,e,!0),this.name=r,this.tag=function(t,e,r){return void 0===e&&(e=[]),void 0===r&&(r=[]),t?t({slots:e,attributes:r}):Et(function(t){return t.reduce(((t,e)=>t+e.html),"")}(e),[...ft(e),{expressions:r.map((t=>Object.assign({type:0},t)))}])}(this.getComponent(r),this.slots,this.attributes),this.tag.mount(this.node,t)),this},unmount(t,e,r){return this.tag&&this.tag.unmount(r),this}};var gt={1:function(t,e){let{evaluate:r,template:n}=e;const s=document.createTextNode("");return c(s,t),a(t),Object.assign({},G,{node:t,evaluate:r,placeholder:s,template:n.createDOM(t)})},2:function(t,e){let{expressions:r}=e;return Object.assign({},(n=r.map((e=>lt(t,e))),["mount","update","unmount"].reduce(((t,e)=>Object.assign({},t,{[e]:t=>n.map((r=>r[e](t)))&&s})),{})));var n,s},0:function(t,e){let{evaluate:r,condition:n,itemName:s,indexName:i,getKey:o,template:u}=e;const l=document.createTextNode(""),p=t.cloneNode();return c(l,t),a(t),Object.assign({},H,{childrenMap:new Map,node:t,root:p,condition:n,evaluate:r,isTemplateTag:B(p),template:u.createDOM(t),getKey:o,indexName:i,itemName:s,placeholder:l})},3:function(t,e){let{evaluate:r,getComponent:n,slots:s,attributes:i}=e;return Object.assign({},mt,{node:t,evaluate:r,slots:s,attributes:i,getComponent:n})},4:function(t,e){let{name:r,attributes:n}=e;return Object.assign({},ht,{attributes:n,node:t,name:r})}};function yt(t,e){return t.map((t=>2===t.type?Object.assign({},t,{childNodeIndex:t.childNodeIndex+e}):t))}function vt(t,e,r){const{selector:n,type:s,redundantAttribute:i,expressions:o}=e,a=n?t.querySelector(n):t;i&&a.removeAttribute(i);const c=o||[];return(gt[s]||gt[2])(a,Object.assign({},e,{expressions:r&&!n?yt(c,r):c}))}function xt(t,e){return U(t)?function(t,e){return e.ownerDocument.importNode((new window.DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"application/xml").documentElement,!0)}(e,t):function(t,e){const r=B(e)?e:document.createElement("template");return r.innerHTML=t,r.content}(e,t)}function bt(t,e){switch(!0){case U(t):s(e,t);break;case B(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const wt=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?xt(t,e):e)}(t,this.html)||document.createDocumentFragment(),this},mount(t,e,r,n){if(void 0===n&&(n={}),!t)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);const{fragment:s,children:i,avoidDOMInjection:o}=n,{parentNode:a}=i?i[0]:t,c=B(t),u=c?function(t,e,r){const n=Array.from(t.childNodes);return Math.max(n.indexOf(e),n.indexOf(r.head)+1,0)}(a,t,n):null;this.createDOM(t);const l=s||this.dom.cloneNode(!0);return this.el=c?a:t,this.children=c?i||Array.from(l.childNodes):null,!o&&l&&bt(t,l),this.bindings=this.bindingsData.map((t=>vt(this.el,t,u))),this.bindings.forEach((t=>t.mount(e,r))),this.meta=n,this},update(t,e){return this.bindings.forEach((r=>r.update(t,e))),this},unmount(t,e,r){void 0===r&&(r=!1);const n=this.el;if(!n)return this;switch(this.bindings.forEach((n=>n.unmount(t,e,r))),!0){case n[N]||null===r:break;case Array.isArray(this.children):o(this.children);break;case!r:i(n);break;case!!r:a(n)}return this.el=null,this},clone(){return Object.assign({},this,{meta:{},el:null})}});function Et(t,e){return void 0===e&&(e=[]),Object.assign({},wt,{html:t,bindingsData:e})}function _t(){return this}function Ot(t){return V(t)?t.prototype&&t.prototype.constructor?new t:t():t}function St(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function Lt(t,e){return St("string"==typeof t?(e||document).querySelectorAll(t):t)}const Nt=t=>1===t.length?t[0]:t;function Tt(t,e,r){const n="object"==typeof e?e:{[e]:r},s=Object.keys(n);return St(t).forEach((t=>{s.forEach((e=>t.setAttribute(e,n[e])))})),t}function jt(t,e){return function(t,e,r){const n="string"==typeof e?[e]:e;return Nt(St(t).map((t=>Nt(n.map((e=>t[r](e)))))))}(t,e,"getAttribute")}const At=new Map,Mt=()=>Ct||(Tt(Ct=Lt("style[riot]")[0]||document.createElement("style"),"type","text/css"),Ct.parentNode||document.head.appendChild(Ct),Ct);var Ct,kt={CSS_BY_NAME:At,add(t,e){return At.has(t)||(At.set(t,e),this.inject()),this},inject(){return Mt().innerHTML=[...At.values()].join("\n"),this},remove(t){return At.has(t)&&(At.delete(t),this.inject()),this}};function Pt(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return function(){for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];return(n=[...r,...n]).length<t.length?Pt(t,...n):t(...n)}}function Dt(t){return jt(t,h)||t.tagName.toLowerCase()}const qt=Object.freeze({$(t){return Lt(t,this.root)[0]},$$(t){return Lt(t,this.root)}}),Rt=Object.freeze({[d]:_t,[f]:_t,[m]:_t}),Ft=Object.freeze({[g]:_t,[y]:_t,[v]:_t,[x]:_t,[b]:_t,[w]:_t,[E]:_t}),It=Object.assign({},Rt,{clone:_t,createDOM:_t}),zt=W($t);function Xt(t,e){return void 0===e&&(e={}),Object.assign({},function(t){return Array.from(t.attributes).reduce(((t,e)=>(t[n(e.name)]=e.value,t)),{})}(t),Ot(e))}const Ut=(t,e)=>t[l]=e;function Bt(t){return[d,f,m].reduce(((e,r)=>(e[r]=t(r),e)),{})}function Vt(t,e){const r=function(t){void 0===t&&(t={});return Object.entries(Ot(t)).reduce(((t,e)=>{let[r,n]=e;
/* Riot v6.1.2, @license MIT */
var s;return t[(s=r,s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=$t(n),t}),{})}(e.exports?e.exports.components:{});return t(Et,P,k,(t=>t===e.name?zt(e):r[t]||u.get(t)))}function $t(t){const{css:e,template:r,exports:n,name:s}=t,i=r?Vt(r,t):It;return t=>{let{slots:o,attributes:a,props:c}=t;if(n&&n[N])return function(t,e){let{slots:r,attributes:n,props:s,css:i,template:o}=e;o&&J("Pure components can not have html"),i&&J("Pure components do not have css");const a=z(t({slots:r,attributes:n,props:s}),Rt);return Bt((t=>function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];if(t===d){const[t]=r;F(t,N,!0),Ut(t,a)}return a[t](...r),a}))}(n,{slots:o,attributes:a,props:c,css:e,template:r});const u=Ot(n)||{},l=Kt({css:e,template:i,componentAPI:u,name:s})({slots:o,attributes:a,props:c});return{mount:(t,e,r)=>l.mount(t,r,e),update:(t,e)=>l.update(e,t),unmount:t=>l.unmount(t)}}}function Kt(t){let{css:e,template:r,componentAPI:n,name:s}=t;return e&&s&&kt.add(s,e),Pt(Ht)(I(z(n,Object.assign({},Ft,{[_]:{},[O]:{}})),Object.assign({[S]:null,[L]:null},qt,{name:s,css:e,template:r})))}function Yt(t,e){return Object.assign({},t,Ot(e))}function Ht(t,e){let{slots:r,attributes:n,props:s}=e;return i=function(t){return[...p].reduce(((t,e)=>e(t)||t),t)}(I($(t)?Object.create(t):t,{mount(e,i,o){return void 0===i&&(i={}),F(e,N,!1),this[j]=o,this[A]=function(t,e){void 0===e&&(e=[]);const r=e.map((e=>lt(t,e))),n={};return Object.assign(n,Object.assign({expressions:r},Bt((t=>e=>(r.forEach((r=>r[t](e))),n)))))}(e,n).mount(o),F(this,_,Object.freeze(Object.assign({},Xt(e,s),Z(this[A].expressions)))),this.state=Yt(this.state,i),this[M]=this.template.createDOM(e).clone(),Ut(e,this),t.name&&function(t,e){Dt(t)!==e&&Tt(t,h,e)}(e,t.name),F(this,L,e),F(this,S,r),this.onBeforeMount(this.props,this.state),this[M].mount(e,this,o),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[j]=e,this[A].update(e));const r=Z(this[A].expressions);if(!1!==this.shouldUpdate(r,this.props))return F(this,_,Object.freeze(Object.assign({},this.props,r))),this.state=Yt(this.state,t),this.onBeforeUpdate(this.props,this.state),this[T]||(this[T]=!0,this[M].update(this,this[j])),this.onUpdated(this.props,this.state),this[T]=!1,this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[A].unmount(),this[M].unmount(this,this[j],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>V(t[e]))).forEach((t=>{i[t]=i[t].bind(i)})),i;var i}const{DOM_COMPONENT_INSTANCE_PROPERTY:Gt,COMPONENTS_IMPLEMENTATION_MAP:Jt,PLUGINS_SET:Wt}=C;function Zt(t,e){let{css:r,template:n,exports:s}=e;return Jt.has(t)&&J(`The component "${t}" was already registered`),Jt.set(t,$t({name:t,css:r,template:n,exports:s})),Jt}function Qt(t,e,r){return Lt(t).map((t=>function(t,e,r){const n=r||Dt(t);return u.has(n)||J(`The component named "${n}" was never registered`),u.get(n)({props:e}).mount(t)}(t,e,r)))}var te=r(9765),ee=r.n(te),re=r(7422),ne=r.n(re);const se=class{constructor(t,e,r=!1){this.constraits=e,this.formElement=t,this.formElement||console.error("FormValidator: form not found!"),this.elements=this.formElement.querySelectorAll("field-error"),this.formElement.addEventListener("field-update",(t=>{this._onFieldUpdate(t)})),r&&this.formElement.addEventListener("submit",(t=>{this._onSubmit(t)}))}submit(t){this._onSubmit(t)}onError(t){this._onError=t}onSuccess(t){this._onSuccess=t}onBeforeSubmit(t){this._onBeforeSubmit=t}_onSubmit(t){const e=ne()(t.target,{hash:!0});this._onBeforeSubmit&&this._onBeforeSubmit(),ee().async(e,this.constraits,{fullMessages:!1}).then((()=>{this._onSuccess(t,e)}),(r=>{t.preventDefault(),this._onError&&this._onError(t,r,e),this.elements.forEach((t=>{let e=!1;r[t.attributes.name.nodeValue]&&(e=r[t.attributes.name.nodeValue]),this._dispatchCustomEvent(e,t)}))}))}_onFieldUpdate(t){""==t.detail.value&&(t.detail.value=void 0);let e=ee().single(t.detail.value,this.constraits[t.detail.name]);this.elements.forEach((r=>{r.attributes.name.nodeValue==t.detail.name&&this._dispatchCustomEvent(e,r)}))}_dispatchCustomEvent(t,e){let r=!1;t&&(r=t);const n=new CustomEvent("form-validation",{detail:r});e.dispatchEvent(n)}},ie={css:null,exports:{state:{errors:[],closest:".field-group"},onBeforeMounted(t,e){t.closest&&(e.closest=t.closest)},onMounted(t,e){const r=this.root.closest(e.closest),n=r.querySelector('[name="'+t.name+'"]'),s=n.closest("form");n&&s&&!t.nofieldupdate&&n.addEventListener("input",(e=>{this.dispatchCustomEvent(e,s,t.name)})),this.root.addEventListener("form-validation",(t=>{this.onFormValidation(t,r)}))},onFormValidation(t,e){t.detail?(this.state.errors=t.detail,e.classList.add("field--error"),e.classList.remove("field--valid")):(this.state.errors=[],e.classList.remove("field--error"),e.classList.add("field--valid")),this.update()},dispatchCustomEvent(t,e,r){const n=new CustomEvent("field-update",{detail:{name:r,value:t.target.value}});e.dispatchEvent(n)}},template:(t,e,r,n)=>t('<div expr10="expr10" class="field-error"></div>',[{type:r.IF,evaluate:t=>t.state.errors.length>0,redundantAttribute:"expr10",selector:"[expr10]",template:t('<ul><li expr11="expr11"></li></ul>',[{type:r.EACH,getKey:null,condition:null,template:t(" ",[{expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>[t.error].join("")}]}]),redundantAttribute:"expr11",selector:"[expr11]",itemName:"error",indexName:null,evaluate:t=>t.state.errors}])}]),name:"field-error"};var oe=r(2579),ae=r(8432);const ce=r.n(ae)()({login:function(t,e,r){var n=this;this.xmpp||(this.xmpp=(0,oe.Lp)({service:r,username:t,password:e}),this.xmpp.on("error",(function(t){n.xmpp=!1,n.trigger("error",t)})),this.xmpp.on("online",(function(t){n.trigger("online",t)})),this.xmpp.on("offline",(function(){n.xmpp=!1,n.trigger("offline")})),this.xmpp.start())},logout:function(){this.xmpp.stop()}});Zt("field-error",ie);const ue={css:null,exports:{state:{isLoading:!1,isOnline:!1,validator:!1},onMounted(){this.createForm(),ce.on("error",(t=>{console.log(t)})),ce.on("online",(()=>{this.isLoading=!1,this.state.isOnline=!0,this.state.validator=!1,this.update()})),ce.on("offline",(()=>{this.isLoading=!1,this.state.isOnline=!1,this.update(),this.createForm()}))},createForm(){this.state.validator=new se(this.$("form"),{service:{presence:!0},username:{presence:!0},password:{presence:!0}},!0),this.state.validator.onError((t=>{this.isLoading=!1,this.update()})),this.state.validator.onSuccess(((t,e)=>{t.preventDefault(),this.isLoading=!0,this.update(),ce.login(e.username,e.password,e.service)}))},handleLogout(){ce.logout()}},template:(t,e,r,n)=>t('<div class="panel m-top-6"><div class="bar"><div class="bar__start">\n Account\n </div></div><div class="panel__body"><form expr2="expr2"></form><div expr8="expr8"></div></div></div>',[{type:r.IF,evaluate:t=>!t.state.isOnline,redundantAttribute:"expr2",selector:"[expr2]",template:t('<div class="field-group"><label class="field-label">\n Service\n <input type="text" class="field-text" name="service"/><field-error expr3="expr3" name="service"></field-error></label></div><div class="field-group"><label class="field-label">\n Username\n <input type="text" class="field-text" name="username"/><field-error expr4="expr4" name="username"></field-error></label></div><div class="field-group"><label class="field-label">\n Password\n <input type="password" class="field-text" name="password"/><field-error expr5="expr5" name="password"></field-error></label></div><div expr6="expr6" class="loading"></div><div class="m-top-4"><button expr7="expr7" class="button button--full button--success center w-100" type="submit">\n Send\n </button></div>',[{expressions:[{type:e.EVENT,name:"onsubmit",evaluate:t=>e=>{t.state.validator.submit(e)}}]},{type:r.TAG,getComponent:n,evaluate:t=>"field-error",slots:[],attributes:[],redundantAttribute:"expr3",selector:"[expr3]"},{type:r.TAG,getComponent:n,evaluate:t=>"field-error",slots:[],attributes:[],redundantAttribute:"expr4",selector:"[expr4]"},{type:r.TAG,getComponent:n,evaluate:t=>"field-error",slots:[],attributes:[],redundantAttribute:"expr5",selector:"[expr5]"},{type:r.IF,evaluate:t=>t.state.isLoading,redundantAttribute:"expr6",selector:"[expr6]",template:t("<span></span><span></span><span></span>",[])},{redundantAttribute:"expr7",selector:"[expr7]",expressions:[{type:e.ATTRIBUTE,name:"disabled",evaluate:t=>t.state.isLoading}]}])},{type:r.IF,evaluate:t=>t.state.isOnline,redundantAttribute:"expr8",selector:"[expr8]",template:t('<button expr9="expr9" class="button button--full button--danger center w-100 m-bottom-0" type="button">\n Logout\n </button>',[{redundantAttribute:"expr9",selector:"[expr9]",expressions:[{type:e.EVENT,name:"onclick",evaluate:t=>e=>{t.handleLogout(e)}}]}])}]),name:"xmpp-login"};var le=r(8930),pe=r.n(le);const he={css:null,exports:{state:{contacts:[]},onMounted(){ce.on("online",(t=>{pe()(ce.xmpp).get().then((t=>{if(!t)return;const{version:e,items:r}=t;this.state.contacts=r,this.update()}))})),ce.on("offline",(t=>{this.state.contacts=[],this.update()}))}},template:(t,e,r,n)=>t('<div expr0="expr0" class="panel m-top-6"></div>',[{type:r.IF,evaluate:t=>t.state.contacts.length>0,redundantAttribute:"expr0",selector:"[expr0]",template:t('<div class="bar"><div class="bar__main">\n Contacts\n </div></div><div class="panel__body"><ul><li expr1="expr1"></li></ul></div>',[{type:r.EACH,getKey:null,condition:null,template:t(" ",[{expressions:[{type:e.TEXT,childNodeIndex:0,evaluate:t=>[t.contact.name].join("")}]}]),redundantAttribute:"expr1",selector:"[expr1]",itemName:"contact",indexName:null,evaluate:t=>t.state.contacts}])}]),name:"xmpp-contacts"};Zt("xmpp-login",ue),Zt("xmpp-contacts",he),Qt("xmpp-login"),Qt("xmpp-contacts")},7187:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(r,n){function s(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",s),r([].slice.call(arguments))}m(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&m(t,"error",e,r)}(t,s,{once:!0})}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function u(t,e,r,n){var s,i,o,u;if(a(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),o=i[e]),void 0===o)o=i[e]=r,++t._eventsCount;else if("function"==typeof o?o=i[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(s=c(t))>0&&o.length>s&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=l.bind(n);return s.listener=r,n.wrapFn=s,s}function h(t,e,r){var n=t._events;if(void 0===n)return[];var s=n[e];return void 0===s?[]:"function"==typeof s?r?[s.listener||s]:[s]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(s):f(s,s.length)}function d(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function m(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function s(i){n.once&&t.removeEventListener(e,s),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");o=t}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var s="error"===t,i=this._events;if(void 0!==i)s=s&&void 0===i.error;else if(!s)return!1;if(s){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)n(c,this,e);else{var u=c.length,l=f(c,u);for(r=0;r<u;++r)n(l[r],this,e)}return!0},i.prototype.addListener=function(t,e){return u(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return u(this,t,e,!0)},i.prototype.once=function(t,e){return a(e),this.on(t,p(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,p(this,t,e)),this},i.prototype.removeListener=function(t,e){var r,n,s,i,o;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(s=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){o=r[i].listener,s=i;break}if(s<0)return this;0===s?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,s),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,o||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var s,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(s=i[n])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},i.prototype.listeners=function(t){return h(this,t,!0)},i.prototype.rawListeners=function(t){return h(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},i.prototype.listenerCount=d,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},7422:t=>{var e=/^(?:submit|button|image|reset|file)$/i,r=/^(?:input|select|textarea|keygen)/i,n=/(\[[^\[\]]*\])/g;function s(t,e,r){if(0===e.length)return t=r;var n=e.shift(),i=n.match(/^\[(.+?)\]$/);if("[]"===n)return t=t||[],Array.isArray(t)?t.push(s(null,e,r)):(t._values=t._values||[],t._values.push(s(null,e,r))),t;if(i){var o=i[1],a=+o;isNaN(a)?(t=t||{})[o]=s(t[o],e,r):(t=t||[])[a]=s(t[a],e,r)}else t[n]=s(t[n],e,r);return t}function i(t,e,r){if(e.match(n)){s(t,function(t){var e=[],r=new RegExp(n),s=/^([^\[\]]*)/.exec(t);for(s[1]&&e.push(s[1]);null!==(s=r.exec(t));)e.push(s[1]);return e}(e),r)}else{var i=t[e];i?(Array.isArray(i)||(t[e]=[i]),t[e].push(r)):t[e]=r}return t}function o(t,e,r){return r=r.replace(/(\r)?\n/g,"\r\n"),r=(r=encodeURIComponent(r)).replace(/%20/g,"+"),t+(t?"&":"")+encodeURIComponent(e)+"="+r}t.exports=function(t,n){"object"!=typeof n?n={hash:!!n}:void 0===n.hash&&(n.hash=!0);for(var s=n.hash?{}:"",a=n.serializer||(n.hash?i:o),c=t&&t.elements?t.elements:[],u=Object.create(null),l=0;l<c.length;++l){var p=c[l];if((n.disabled||!p.disabled)&&p.name&&(r.test(p.nodeName)&&!e.test(p.type))){var h=p.name,d=p.value;if("checkbox"!==p.type&&"radio"!==p.type||p.checked||(d=void 0),n.empty){if("checkbox"!==p.type||p.checked||(d=""),"radio"===p.type&&(u[p.name]||p.checked?p.checked&&(u[p.name]=!0):u[p.name]=!1),null==d&&"radio"==p.type)continue}else if(!d)continue;if("select-multiple"!==p.type)s=a(s,h,d);else{d=[];for(var f=p.options,m=!1,g=0;g<f.length;++g){var y=f[g],v=n.empty&&!y.value,x=y.value||v;y.selected&&x&&(m=!0,s=n.hash&&"[]"!==h.slice(h.length-2)?a(s,h+"[]",y.value):a(s,h,y.value))}!m&&n.empty&&(s=a(s,h,""))}}}if(n.empty)for(var h in u)u[h]||(s=a(s,h,""));return s}},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},4127:t=>{"use strict";t.exports=function(t){if(!Array.isArray(t))throw new TypeError("Middleware stack must be an array!");for(const e of t)if("function"!=typeof e)throw new TypeError("Middleware must be composed of functions!");return function(e,r){let n=-1;return function s(i){if(i<=n)return Promise.reject(new Error("next() called multiple times"));n=i;let o=t[i];i===t.length&&(o=r);if(!o)return Promise.resolve();try{return Promise.resolve(o(e,s.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}}},3828:()=>{},7576:function(t,e,r){!function(t,e){function r(){}r.prototype.name="ANONYMOUS",r.prototype.clientFirst=!0,r.prototype.response=function(t){return t.trace||""},r.prototype.challenge=function(t){},e.exports=r}(0,t=r.nmd(t))},3375:function(t,e,r){!function(t,e,r){(e.exports=r).Mechanism=r}(0,t=r.nmd(t),r(7576))},8711:function(t,e,r){!function(t,e){function r(){}r.prototype.name="PLAIN",r.prototype.clientFirst=!0,r.prototype.response=function(t){var e="";return e+=t.authzid||"",e+="\0",e+=t.username,e+="\0",e+=t.password},r.prototype.challenge=function(t){return this},e.exports=r}(0,t=r.nmd(t))},3342:function(t,e,r){!function(t,e,r){(e.exports=r).Mechanism=r}(0,t=r.nmd(t),r(8711))},9738:function(t,e,r){!function(t,e){function r(){this._mechs=[]}r.prototype.use=function(t,e){return e||(t=(e=t).prototype.name),this._mechs.push({name:t,mech:e}),this},r.prototype.create=function(t){for(var e=0,r=this._mechs.length;e<r;e++)for(var n=0,s=t.length;n<s;n++){var i=this._mechs[e];if(i.name==t[n])return new i.mech}return null},e.exports=r}(0,t=r.nmd(t))},2801:function(t,e,r){!function(t,e,r){(e.exports=r).Factory=r}(0,t=r.nmd(t),r(9738))},9765:function(t,e,r){t=r.nmd(t),
/*!
* validate.js 0.13.1
*
* (c) 2013-2019 Nicklas Ansman, 2013 Wrapp
* Validate.js may be freely distributed under the MIT license.
* For all details and documentation:
* http://validatejs.org/
*/
function(t,e,n){"use strict";var s=function(t,e,r){r=i.extend({},i.options,r);var n=i.runValidations(t,e,r);if(n.some((function(t){return i.isPromise(t.error)})))throw new Error("Use validate.async if you want support for promises");return s.processValidationResults(n,r)},i=s;i.extend=function(t){return[].slice.call(arguments,1).forEach((function(e){for(var r in e)t[r]=e[r]})),t},i.extend(s,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var t=i.format("%{major}.%{minor}.%{patch}",i.version);return i.isEmpty(i.version.metadata)||(t+="+"+i.version.metadata),t}},Promise:"undefined"!=typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(t,e,r){var n,s,o,a,c,u,l,p=[];for(n in(i.isDomElement(t)||i.isJqueryElement(t))&&(t=i.collectFormValues(t)),e)for(s in o=i.getDeepObjectValue(t,n),a=i.result(e[n],o,t,n,r,e)){if(!(c=i.validators[s]))throw l=i.format("Unknown validator %{name}",{name:s}),new Error(l);u=a[s],(u=i.result(u,o,t,n,r,e))&&p.push({attribute:n,value:o,validator:s,globalOptions:r,attributes:t,options:u,error:c.call(c,o,u,n,t,r)})}return p},processValidationResults:function(t,e){t=i.pruneEmptyErrors(t,e),t=i.expandMultipleErrors(t,e),t=i.convertErrorMessages(t,e);var r=e.format||"grouped";if("function"!=typeof i.formatters[r])throw new Error(i.format("Unknown format %{format}",e));return t=i.formatters[r](t),i.isEmpty(t)?void 0:t},async:function(t,e,r){var n=(r=i.extend({},i.async.options,r)).wrapErrors||function(t){return t};!1!==r.cleanAttributes&&(t=i.cleanAttributes(t,e));var s=i.runValidations(t,e,r);return new i.Promise((function(o,a){i.waitForResults(s).then((function(){var c=i.processValidationResults(s,r);c?a(new n(c,r,t,e)):o(t)}),(function(t){a(t)}))}))},single:function(t,e,r){return r=i.extend({},i.single.options,r,{format:"flat",fullMessages:!1}),i({single:t},{single:e},r)},waitForResults:function(t){return t.reduce((function(t,e){return i.isPromise(e.error)?t.then((function(){return e.error.then((function(t){e.error=t||null}))})):t}),new i.Promise((function(t){t()})))},result:function(t){var e=[].slice.call(arguments,1);return"function"==typeof t&&(t=t.apply(null,e)),t},isNumber:function(t){return"number"==typeof t&&!isNaN(t)},isFunction:function(t){return"function"==typeof t},isInteger:function(t){return i.isNumber(t)&&t%1==0},isBoolean:function(t){return"boolean"==typeof t},isObject:function(t){return t===Object(t)},isDate:function(t){return t instanceof Date},isDefined:function(t){return null!=t},isPromise:function(t){return!!t&&i.isFunction(t.then)},isJqueryElement:function(t){return t&&i.isString(t.jquery)},isDomElement:function(t){return!!t&&(!(!t.querySelectorAll||!t.querySelector)&&(!(!i.isObject(document)||t!==document)||("object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName)))},isEmpty:function(t){var e;if(!i.isDefined(t))return!0;if(i.isFunction(t))return!1;if(i.isString(t))return i.EMPTY_STRING_REGEXP.test(t);if(i.isArray(t))return 0===t.length;if(i.isDate(t))return!1;if(i.isObject(t)){for(e in t)return!1;return!0}return!1},format:i.extend((function(t,e){return i.isString(t)?t.replace(i.format.FORMAT_REGEXP,(function(t,r,n){return"%"===r?"%{"+n+"}":String(e[n])})):t}),{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(t){return i.isNumber(t)?100*t%1==0?""+t:parseFloat(Math.round(100*t)/100).toFixed(2):i.isArray(t)?t.map((function(t){return i.prettify(t)})).join(", "):i.isObject(t)?i.isDefined(t.toString)?t.toString():JSON.stringify(t):(t=""+t).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,(function(t,e,r){return e+" "+r.toLowerCase()})).toLowerCase()},stringifyValue:function(t,e){return(e&&e.prettify||i.prettify)(t)},isString:function(t){return"string"==typeof t},isArray:function(t){return"[object Array]"==={}.toString.call(t)},isHash:function(t){return i.isObject(t)&&!i.isArray(t)&&!i.isFunction(t)},contains:function(t,e){return!!i.isDefined(t)&&(i.isArray(t)?-1!==t.indexOf(e):e in t)},unique:function(t){return i.isArray(t)?t.filter((function(t,e,r){return r.indexOf(t)==e})):t},forEachKeyInKeypath:function(t,e,r){if(i.isString(e)){var n,s="",o=!1;for(n=0;n<e.length;++n)switch(e[n]){case".":o?(o=!1,s+="."):(t=r(t,s,!1),s="");break;case"\\":o?(o=!1,s+="\\"):o=!0;break;default:o=!1,s+=e[n]}return r(t,s,!0)}},getDeepObjectValue:function(t,e){if(i.isObject(t))return i.forEachKeyInKeypath(t,e,(function(t,e){if(i.isObject(t))return t[e]}))},collectFormValues:function(t,e){var r,n,s,o,a,c,u={};if(i.isJqueryElement(t)&&(t=t[0]),!t)return u;for(e=e||{},o=t.querySelectorAll("input[name], textarea[name]"),r=0;r<o.length;++r)if(s=o.item(r),!i.isDefined(s.getAttribute("data-ignored"))){var l=s.name.replace(/\./g,"\\\\.");c=i.sanitizeFormValue(s.value,e),"number"===s.type?c=c?+c:null:"checkbox"===s.type?s.attributes.value?s.checked||(c=u[l]||null):c=s.checked:"radio"===s.type&&(s.checked||(c=u[l]||null)),u[l]=c}for(o=t.querySelectorAll("select[name]"),r=0;r<o.length;++r)if(s=o.item(r),!i.isDefined(s.getAttribute("data-ignored"))){if(s.multiple)for(n in c=[],s.options)(a=s.options[n])&&a.selected&&c.push(i.sanitizeFormValue(a.value,e));else{var p=void 0!==s.options[s.selectedIndex]?s.options[s.selectedIndex].value:"";c=i.sanitizeFormValue(p,e)}u[s.name]=c}return u},sanitizeFormValue:function(t,e){return e.trim&&i.isString(t)&&(t=t.trim()),!1!==e.nullify&&""===t?null:t},capitalize:function(t){return i.isString(t)?t[0].toUpperCase()+t.slice(1):t},pruneEmptyErrors:function(t){return t.filter((function(t){return!i.isEmpty(t.error)}))},expandMultipleErrors:function(t){var e=[];return t.forEach((function(t){i.isArray(t.error)?t.error.forEach((function(r){e.push(i.extend({},t,{error:r}))})):e.push(t)})),e},convertErrorMessages:function(t,e){var r=[],n=(e=e||{}).prettify||i.prettify;return t.forEach((function(t){var s=i.result(t.error,t.value,t.attribute,t.options,t.attributes,t.globalOptions);i.isString(s)?("^"===s[0]?s=s.slice(1):!1!==e.fullMessages&&(s=i.capitalize(n(t.attribute))+" "+s),s=s.replace(/\\\^/g,"^"),s=i.format(s,{value:i.stringifyValue(t.value,e)}),r.push(i.extend({},t,{error:s}))):r.push(t)})),r},groupErrorsByAttribute:function(t){var e={};return t.forEach((function(t){var r=e[t.attribute];r?r.push(t):e[t.attribute]=[t]})),e},flattenErrorsToArray:function(t){return t.map((function(t){return t.error})).filter((function(t,e,r){return r.indexOf(t)===e}))},cleanAttributes:function(t,e){function r(t,e,r){return i.isObject(t[e])?t[e]:t[e]=!!r||{}}return i.isObject(e)&&i.isObject(t)?function t(e,r){if(!i.isObject(e))return e;var n,s,o=i.extend({},e);for(s in e)n=r[s],i.isObject(n)?o[s]=t(o[s],n):n||delete o[s];return o}(t,e=function(t){var e,n={};for(e in t)t[e]&&i.forEachKeyInKeypath(n,e,r);return n}(e)):{}},exposeModule:function(t,e,r,n,s){r?(n&&n.exports&&(r=n.exports=t),r.validate=t):(e.validate=t,t.isFunction(s)&&s.amd&&s([],(function(){return t})))},warn:function(t){"undefined"!=typeof console&&console.warn&&console.warn("[validate.js] "+t)},error:function(t){"undefined"!=typeof console&&console.error&&console.error("[validate.js] "+t)}}),s.validators={presence:function(t,e){if(!1!==(e=i.extend({},this.options,e)).allowEmpty?!i.isDefined(t):i.isEmpty(t))return e.message||this.message||"can't be blank"},length:function(t,e,r){if(i.isDefined(t)){var n,s=(e=i.extend({},this.options,e)).is,o=e.maximum,a=e.minimum,c=[],u=(t=(e.tokenizer||function(t){return t})(t)).length;return i.isNumber(u)?(i.isNumber(s)&&u!==s&&(n=e.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",c.push(i.format(n,{count:s}))),i.isNumber(a)&&u<a&&(n=e.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",c.push(i.format(n,{count:a}))),i.isNumber(o)&&u>o&&(n=e.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",c.push(i.format(n,{count:o}))),c.length>0?e.message||c:void 0):e.message||this.notValid||"has an incorrect length"}},numericality:function(t,e,r,n,s){if(i.isDefined(t)){var o,a,c=[],u={greaterThan:function(t,e){return t>e},greaterThanOrEqualTo:function(t,e){return t>=e},equalTo:function(t,e){return t===e},lessThan:function(t,e){return t<e},lessThanOrEqualTo:function(t,e){return t<=e},divisibleBy:function(t,e){return t%e==0}},l=(e=i.extend({},this.options,e)).prettify||s&&s.prettify||i.prettify;if(i.isString(t)&&e.strict){var p="^-?(0|[1-9]\\d*)";if(e.onlyInteger||(p+="(\\.\\d+)?"),p+="$",!new RegExp(p).test(t))return e.message||e.notValid||this.notValid||this.message||"must be a valid number"}if(!0!==e.noStrings&&i.isString(t)&&!i.isEmpty(t)&&(t=+t),!i.isNumber(t))return e.message||e.notValid||this.notValid||this.message||"is not a number";if(e.onlyInteger&&!i.isInteger(t))return e.message||e.notInteger||this.notInteger||this.message||"must be an integer";for(o in u)if(a=e[o],i.isNumber(a)&&!u[o](t,a)){var h="not"+i.capitalize(o),d=e[h]||this[h]||this.message||"must be %{type} %{count}";c.push(i.format(d,{count:a,type:l(o)}))}return e.odd&&t%2!=1&&c.push(e.notOdd||this.notOdd||this.message||"must be odd"),e.even&&t%2!=0&&c.push(e.notEven||this.notEven||this.message||"must be even"),c.length?e.message||c:void 0}},datetime:i.extend((function(t,e){if(!i.isFunction(this.parse)||!i.isFunction(this.format))throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(i.isDefined(t)){var r,n=[],s=(e=i.extend({},this.options,e)).earliest?this.parse(e.earliest,e):NaN,o=e.latest?this.parse(e.latest,e):NaN;return t=this.parse(t,e),isNaN(t)||e.dateOnly&&t%864e5!=0?(r=e.notValid||e.message||this.notValid||"must be a valid date",i.format(r,{value:arguments[0]})):(!isNaN(s)&&t<s&&(r=e.tooEarly||e.message||this.tooEarly||"must be no earlier than %{date}",r=i.format(r,{value:this.format(t,e),date:this.format(s,e)}),n.push(r)),!isNaN(o)&&t>o&&(r=e.tooLate||e.message||this.tooLate||"must be no later than %{date}",r=i.format(r,{date:this.format(o,e),value:this.format(t,e)}),n.push(r)),n.length?i.unique(n):void 0)}}),{parse:null,format:null}),date:function(t,e){return e=i.extend({},e,{dateOnly:!0}),i.validators.datetime.call(i.validators.datetime,t,e)},format:function(t,e){(i.isString(e)||e instanceof RegExp)&&(e={pattern:e});var r,n=(e=i.extend({},this.options,e)).message||this.message||"is invalid",s=e.pattern;if(i.isDefined(t))return i.isString(t)?(i.isString(s)&&(s=new RegExp(e.pattern,e.flags)),(r=s.exec(t))&&r[0].length==t.length?void 0:n):n},inclusion:function(t,e){if(i.isDefined(t)&&(i.isArray(e)&&(e={within:e}),e=i.extend({},this.options,e),!i.contains(e.within,t))){var r=e.message||this.message||"^%{value} is not included in the list";return i.format(r,{value:t})}},exclusion:function(t,e){if(i.isDefined(t)&&(i.isArray(e)&&(e={within:e}),e=i.extend({},this.options,e),i.contains(e.within,t))){var r=e.message||this.message||"^%{value} is restricted";return i.isString(e.within[t])&&(t=e.within[t]),i.format(r,{value:t})}},email:i.extend((function(t,e){var r=(e=i.extend({},this.options,e)).message||this.message||"is not a valid email";if(i.isDefined(t))return i.isString(t)&&this.PATTERN.exec(t)?void 0:r}),{PATTERN:/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i}),equality:function(t,e,r,n,s){if(i.isDefined(t)){i.isString(e)&&(e={attribute:e});var o=(e=i.extend({},this.options,e)).message||this.message||"is not equal to %{attribute}";if(i.isEmpty(e.attribute)||!i.isString(e.attribute))throw new Error("The attribute must be a non empty string");var a=i.getDeepObjectValue(n,e.attribute),c=e.comparator||function(t,e){return t===e},u=e.prettify||s&&s.prettify||i.prettify;return c(t,a,e,r,n)?void 0:i.format(o,{attribute:u(e.attribute)})}},url:function(t,e){if(i.isDefined(t)){var r=(e=i.extend({},this.options,e)).message||this.message||"is not a valid url",n=e.schemes||this.schemes||["http","https"],s=e.allowLocal||this.allowLocal||!1,o=e.allowDataUrl||this.allowDataUrl||!1;if(!i.isString(t))return r;var a="^(?:(?:"+n.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",c="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";if(s?c+="?":a+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",a+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+c+")(?::\\d{2,5})?(?:[/?#]\\S*)?$",o){a="(?:"+a+")|(?:^data:(?:\\w+\\/[-+.\\w]+(?:;[\\w=]+)*)?(?:;base64)?,[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*$)"}return new RegExp(a,"i").exec(t)?void 0:r}},type:i.extend((function(t,e,r,n,s){if(i.isString(e)&&(e={type:e}),i.isDefined(t)){var o,a=i.extend({},this.options,e),c=a.type;if(!i.isDefined(c))throw new Error("No type was specified");if(o=i.isFunction(c)?c:this.types[c],!i.isFunction(o))throw new Error("validate.validators.type.types."+c+" must be a function.");if(!o(t,a,r,n,s)){var u=e.message||this.messages[c]||this.message||a.message||(i.isFunction(c)?"must be of the correct type":"must be of type %{type}");return i.isFunction(u)&&(u=u(t,e,r,n,s)),i.format(u,{attribute:i.prettify(r),type:c})}}}),{types:{object:function(t){return i.isObject(t)&&!i.isArray(t)},array:i.isArray,integer:i.isInteger,number:i.isNumber,string:i.isString,date:i.isDate,boolean:i.isBoolean},messages:{}})},s.formatters={detailed:function(t){return t},flat:i.flattenErrorsToArray,grouped:function(t){var e;for(e in t=i.groupErrorsByAttribute(t))t[e]=i.flattenErrorsToArray(t[e]);return t},constraint:function(t){var e;for(e in t=i.groupErrorsByAttribute(t))t[e]=t[e].map((function(t){return t.validator})).sort();return t}},s.exposeModule(s,this,t,e,r.amdD)}.call(this,e,t,r.amdD)},2754:()=>{},6739:()=>{},2993:()=>{},8729:(t,e,r)=>{"use strict";var n=r(4203);class s{constructor(t,e){this.name=t,this.parent=null,this.children=[],this.attrs={},this.setAttrs(e)}is(t,e){return this.getName()===t&&(!e||this.getNS()===e)}getName(){const t=this.name.indexOf(":");return t>=0?this.name.slice(t+1):this.name}getNS(){const t=this.name.indexOf(":");if(t>=0){const e=this.name.slice(0,t);return this.findNS(e)}return this.findNS()}findNS(t){if(t){const e="xmlns:"+t;if(this.attrs[e])return this.attrs[e];if(this.parent)return this.parent.findNS(t)}else{if(this.attrs.xmlns)return this.attrs.xmlns;if(this.parent)return this.parent.findNS()}}getXmlns(){let t={};this.parent&&(t=this.parent.getXmlns());for(const e in this.attrs){const r=e.match("xmlns:?(.*)");this.attrs.hasOwnProperty(e)&&r&&(t[this.attrs[e]]=r[1])}return t}setAttrs(t){"string"==typeof t?this.attrs.xmlns=t:t&&Object.assign(this.attrs,t)}getAttr(t,e){if(!e)return this.attrs[t];const r=this.getXmlns();return r[e]?this.attrs[[r[e],t].join(":")]:null}getChild(t,e){return this.getChildren(t,e)[0]}getChildren(t,e){const r=[];for(const n of this.children)!n.getName||n.getName()!==t||e&&n.getNS()!==e||r.push(n);return r}getChildByAttr(t,e,r,n){return this.getChildrenByAttr(t,e,r,n)[0]}getChildrenByAttr(t,e,r,n){let s=[];for(const i of this.children)!i.attrs||i.attrs[t]!==e||r&&i.getNS()!==r||s.push(i),n&&i.getChildrenByAttr&&s.push(i.getChildrenByAttr(t,e,r,!0));return n&&(s=s.flat()),s}getChildrenByFilter(t,e){let r=[];for(const n of this.children)t(n)&&r.push(n),e&&n.getChildrenByFilter&&r.push(n.getChildrenByFilter(t,!0));return e&&(r=r.flat()),r}getText(){let t="";for(const e of this.children)"string"!=typeof e&&"number"!=typeof e||(t+=e);return t}getChildText(t,e){const r=this.getChild(t,e);return r?r.getText():null}getChildElements(){return this.getChildrenByFilter((t=>t instanceof s))}root(){return this.parent?this.parent.root():this}up(){return this.parent?this.parent:this}c(t,e){return this.cnode(new s(t,e))}cnode(t){return this.children.push(t),"object"==typeof t&&(t.parent=this),t}append(...t){for(const e of t)this.children.push(e),"object"==typeof e&&(e.parent=this)}prepend(...t){for(const e of t)this.children.unshift(e),"object"==typeof e&&(e.parent=this)}t(t){return this.children.push(t),this}remove(t,e){const r="string"==typeof t?r=>!(r.is&&r.is(t,e)):e=>e!==t;return this.children=this.children.filter(r),this}text(t){return t&&1===this.children.length?(this.children[0]=t,this):this.getText()}attr(t,e){return void 0!==e||null===e?(this.attrs||(this.attrs={}),this.attrs[t]=e,this):this.attrs[t]}toString(){let t="";return this.write((e=>{t+=e})),t}_addChildren(t){t(">");for(const e of this.children)null!=e&&(e.write?e.write(t):"string"==typeof e?t(n.escapeXMLText(e)):e.toString&&t(n.escapeXMLText(e.toString(10))));t("</"),t(this.name),t(">")}write(t){t("<"),t(this.name);for(const e in this.attrs){const r=this.attrs[e];null!=r&&(t(" "),t(e),t('="'),t(n.escapeXML("string"==typeof r?r:r.toString(10))),t('"'))}0===this.children.length?t("/>"):this._addChildren(t)}}s.prototype.tree=s.prototype.root,t.exports=s},7889:(t,e,r)=>{"use strict";var n=r(8729);function s(t,e){if(Array.isArray(e))for(const r of e)s(t,r);else""!==e&&null!=e&&!0!==e&&!1!==e&&t.cnode(e)}t.exports=function(t,e,...r){if("object"==typeof e&&null!==e){delete e.__source,delete e.__self;for(const[t,r]of Object.entries(e))null==r?delete e[t]:e[t]=r.toString(10)}const i=new n(t,e);for(const t of r)s(i,t);return i}},4203:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;"};function n(t){return r[t]}const s={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'"};function i(t){if("#"===t[1]){const e="x"===t[2]?parseInt(t.slice(3),16):parseInt(t.slice(2),10);if(9===e||10===e||13===e||e>=32&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111)return String.fromCodePoint(e);throw new Error("Illegal XML character 0x"+e.toString(16))}if(s[t])return s[t]||t;throw new Error("Illegal XML entity "+t)}e.escapeXML=function(t){return t.replace(/["&'<>]/g,n)},e.escapeXMLText=function(t){return t.replace(/[&<>]/g,n)},e.unescapeXML=function(t){let e="",r=-1,n=-1,s=0;for(;-1!==(r=t.indexOf("&",s))&&-1!==(n=t.indexOf(";",r+1));)e=e+t.slice(s,r)+i(t.slice(r,n+1)),s=n+1;return 0===s?t:(e+=t.substring(s),e)},e.unescapeXMLText=function(t){return t.replace(/&(amp|#38|lt|#60|gt|#62);/g,i)}},9354:(t,e,r)=>{"use strict";var n=r(7187),s=r(4203);class i extends n.EventEmitter{constructor(){super();let t,e,r,n,i,o,a,c,u,l=0,p=0;this._handleTagOpening=function(t,e,r){t?this.emit("endElement",e):(this.emit("startElement",e,r),o&&this.emit("endElement",e))},this.write=function(h){"string"!=typeof h&&(h=h.toString());let d=0;function f(){if("number"==typeof p){const t=h.slice(p,d);return p=void 0,t}}for(t&&(h=t+h,d+=e?0:t.length,e=!1,t=null);d<h.length;d++){switch(l){case 0:{const t=h.indexOf("<",d);-1!==t&&d!==t&&(d=t);break}case 8:{const t=h.indexOf(c,d);-1!==t&&(d=t);break}case 1:{const t=h.indexOf("--\x3e",d);-1!==t&&(d=t+2);break}case 10:{const t=h.indexOf("]]>",d);-1!==t&&(d=t+2);break}}const t=h.charCodeAt(d);switch(l){case 0:if(60===t){const t=f();t&&this.emit("text",s.unescapeXML(t)),l=3,p=d+1,n={}}break;case 9:if(93===t)if("]>"===h.substr(d+1,2)){const t=f();t&&this.emit("text",t),l=0}else h.length<d+2&&(e=!0,d=h.length);break;case 3:47===t&&p===d?(p=d+1,i=!0):33===t?"[CDATA["===h.substr(d+1,7)?(p=d+8,l=9):h.length<d+8&&"[CDATA[".startsWith(h.slice(d+1))?(e=!0,d=h.length):(p=void 0,l=1):63===t?(p=void 0,l=2):(t<=32||47===t||62===t)&&(r=f(),d--,l=4);break;case 1:if(62===t){const t=h.charCodeAt(d-1),e=h.charCodeAt(d-2);(45===t&&45===e||93===t&&93===e)&&(l=0)}break;case 2:if(62===t){63===h.charCodeAt(d-1)&&(l=0)}break;case 4:62===t?(this._handleTagOpening(i,r,n),r=void 0,n=void 0,i=void 0,o=void 0,l=0,p=d+1):47===t?o=!0:t>32&&(p=d,l=5);break;case 5:(t<=32||61===t)&&(u=f(),d--,l=6);break;case 6:61===t&&(l=7);break;case 7:34!==t&&39!==t||(a=t,c=34===t?'"':"'",l=8,p=d+1);break;case 8:if(t===a){const t=s.unescapeXML(f());n[u]=t,u=void 0,l=4}}}"number"==typeof p&&p<=h.length&&(t=h.slice(p),p=0)}}end(t){t&&this.write(t),this.write=function(){}}}t.exports=i}},r={};function n(t){var s=r[t];if(void 0!==s)return s.exports;var i=r[t]={id:t,loaded:!1,exports:{}};return e[t].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=e,n.amdD=function(){throw new Error("define cannot be used indirect")},t=[],n.O=(e,r,s,i)=>{if(!r){var o=1/0;for(l=0;l<t.length;l++){for(var[r,s,i]=t[l],a=!0,c=0;c<r.length;c++)(!1&i||o>=i)&&Object.keys(n.O).every((t=>n.O[t](r[c])))?r.splice(c--,1):(a=!1,i<o&&(o=i));if(a){t.splice(l--,1);var u=s();void 0!==u&&(e=u)}}return e}i=i||0;for(var l=t.length;l>0&&t[l-1][2]>i;l--)t[l]=t[l-1];t[l]=[r,s,i]},n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t={587:0,493:0};n.O.j=e=>0===t[e];var e=(e,r)=>{var s,i,[o,a,c]=r,u=0;if(o.some((e=>0!==t[e]))){for(s in a)n.o(a,s)&&(n.m[s]=a[s]);if(c)var l=c(n)}for(e&&e(r);u<o.length;u++)i=o[u],n.o(t,i)&&t[i]&&t[i][0](),t[i]=0;return n.O(l)},r=self.webpackChunk=self.webpackChunk||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})(),n.O(void 0,[493],(()=>n(5065)));var s=n.O(void 0,[493],(()=>n(3828)));s=n.O(s)})();