var XMPP=function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n,r,s,i={};function o(){if(n)return i;n=1;const t={"&":"&","<":"<",">":">",'"':""","'":"'"};function e(e){return t[e]}const r={"&":"&","<":"<",">":">",""":'"',"'":"'"};function s(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(r[t])return r[t]||t;throw new Error("Illegal XML entity "+t)}return i.escapeXML=function(t){return t.replace(/["&'<>]/g,e)},i.escapeXMLText=function(t){return t.replace(/[&<>]/g,e)},i.unescapeXML=function(t){let e="",n=-1,r=-1,i=0;for(;-1!==(n=t.indexOf("&",i))&&-1!==(r=t.indexOf(";",n+1));)e=e+t.slice(i,n)+s(t.slice(n,r+1)),i=r+1;return 0===i?t:(e+=t.substring(i),e)},i.unescapeXMLText=function(t){return t.replace(/&(amp|#38|lt|#60|gt|#62);/g,s)},i}function a(){if(s)return r;s=1;var t=o();class e{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 n=e.match("xmlns:?(.*)");this.attrs.hasOwnProperty(e)&&n&&(t[this.attrs[e]]=n[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 n=this.getXmlns();return n[e]?this.attrs[[n[e],t].join(":")]:null}getChild(t,e){return this.getChildren(t,e)[0]}getChildren(t,e){const n=[];for(const r of this.children)!r.getName||r.getName()!==t||e&&r.getNS()!==e||n.push(r);return n}getChildByAttr(t,e,n,r){return this.getChildrenByAttr(t,e,n,r)[0]}getChildrenByAttr(t,e,n,r){let s=[];for(const i of this.children)!i.attrs||i.attrs[t]!==e||n&&i.getNS()!==n||s.push(i),r&&i.getChildrenByAttr&&s.push(i.getChildrenByAttr(t,e,n,!0));return r&&(s=s.flat()),s}getChildrenByFilter(t,e){let n=[];for(const r of this.children)t(r)&&n.push(r),e&&r.getChildrenByFilter&&n.push(r.getChildrenByFilter(t,!0));return e&&(n=n.flat()),n}getText(){let t="";for(const e of this.children)"string"!=typeof e&&"number"!=typeof e||(t+=e);return t}getChildText(t,e){const n=this.getChild(t,e);return n?n.getText():null}getChildElements(){return this.getChildrenByFilter(t=>t instanceof e)}root(){return this.parent?this.parent.root():this}up(){return this.parent?this.parent:this}c(t,n){return this.cnode(new e(t,n))}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 n="string"==typeof t?n=>!(n.is&&n.is(t,e)):e=>e!==t;return this.children=this.children.filter(n),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(e){e(">");for(const n of this.children)null!=n&&(n.write?n.write(e):"string"==typeof n?e(t.escapeXMLText(n)):n.toString&&e(t.escapeXMLText(n.toString(10))));e("")}write(e){e("<"),e(this.name);for(const n in this.attrs){const r=this.attrs[n];null!=r&&(e(" "),e(n),e('="'),e(t.escapeXML("string"==typeof r?r:r.toString(10))),e('"'))}0===this.children.length?e("/>"):this._addChildren(e)}}return e.prototype.tree=e.prototype.root,r=e}var c,u,l=e(a());var h,m,p,f=function(){if(u)return c;u=1;var t=a();function e(t,n){if(Array.isArray(n))for(const r of n)e(t,r);else""!==n&&null!=n&&!0!==n&&!1!==n&&t.cnode(n)}return c=function(n,r,...s){if("object"==typeof r&&null!==r){delete r.__source,delete r.__self;for(const[t,e]of Object.entries(r))null==e?delete r[t]:r[t]=e.toString(10)}const i=new t(n,r);for(const t of s)e(i,t);return i}}(),d=e(f),y=o(),w={exports:{}};function g(){if(h)return w.exports;h=1;var t,e="object"==typeof Reflect?Reflect:null,n=e&&"function"==typeof e.apply?e.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};t=e&&"function"==typeof e.ownKeys?e.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var r=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}w.exports=s,w.exports.once=function(t,e){return new Promise(function(n,r){function s(n){t.removeListener(e,i),r(n)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",s),n([].slice.call(arguments))}d(t,e,i,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&d(t,"error",e,n)}(t,s,{once:!0})})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var i=10;function o(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function a(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var s,i,c,u;if(o(n),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),c=i[e]),void 0===c)c=i[e]=n,++t._eventsCount;else if("function"==typeof c?c=i[e]=r?[n,c]:[c,n]:r?c.unshift(n):c.push(n),(s=a(t))>0&&c.length>s&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=c.length,u=l,console&&console.warn&&console.warn(u)}return t}function u(){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 l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},s=u.bind(r);return s.listener=n,r.wrapFn=s,s}function m(t,e,n){var r=t._events;if(void 0===r)return[];var s=r[e];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(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=0;i--)if(n[i]===e||n[i].listener===e){a=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return m(this,t,!0)},s.prototype.rawListeners=function(t){return m(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]},w.exports}var v=function(){if(p)return m;p=1;var t=g(),e=o();class n extends t.EventEmitter{constructor(){super();let t,n,r,s,i,o,a,c,u,l=0,h=0;this._handleTagOpening=function(t,e,n){t?this.emit("endElement",e,!1):(this.emit("startElement",e,n),o&&this.emit("endElement",e,!0))},this.write=function(m){"string"!=typeof m&&(m=m.toString());let p=0;function f(){if("number"==typeof h){const t=m.slice(h,p);return h=void 0,t}}for(t&&(m=t+m,p+=n?0:t.length,n=!1,t=null);p",p);-1!==t&&(p=t+2);break}}const t=m.charCodeAt(p);switch(l){case 0:if(60===t){const t=f();t&&this.emit("text",e.unescapeXML(t)),l=3,h=p+1,s={}}break;case 9:if(93===t)if("]>"===m.substr(p+1,2)){const t=f();t&&this.emit("text",t),l=0}else m.length32&&(h=p,l=5);break;case 5:(t<=32||61===t)&&(u=f(),p--,l=6);break;case 6:61===t&&(l=7);break;case 7:34!==t&&39!==t||(a=t,c=34===t?'"':"'",l=8,h=p+1);break;case 8:if(t===a){const t=e.unescapeXML(f());s[u]=t,u=void 0,l=4}}}"number"==typeof h&&h<=m.length&&(t=m.slice(h),h=0)}}end(t){t&&this.write(t),this.write=function(){}}}return m=n}(),b=e(v),x=g();class S extends Error{constructor(t){super(t),this.name="TimeoutError"}}function _(t,e){const n=function(t){let e;const n=new Promise(n=>{e=setTimeout(n,t)});return n.timeout=e,n}(e);const r=new S;return Promise.race([t.finally(function(){clearTimeout(n.timeout)}),n.then(()=>{throw r})])}const E=new WeakMap;function k(t){let e=E.get(t);if(!e){e={on:(t.addEventListener??t.addListener).bind(t),off:(t.removeEventListener??t.removeListener).bind(t),once:(t.once??((e,n)=>t.addEventListener(e,n,{once:!0}))).bind(t)},E.set(t,e)}return e}function L(t,e,n="error",r){return new Promise((s,i)=>{let o;const{off:a,once:c}=k(t),u=()=>{clearTimeout(o),a(e,h),a(n,l)};function l(t){i(t),u()}function h(t){s(t),u()}if(c(e,h),n&&c(n,l),r){const t=new S;o=setTimeout(()=>{u(),i(t)},r)}})}function A(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}function T(t,e=null,n){return new Promise((r,s)=>{function i(e){t.removeListener("nonza",a),s(e)}function o(...e){t.removeListener("nonza",a),r(...e)}async function a(t){try{await n(t,o)}catch(t){i(t)}}e&&t.send(e).catch(i),t.on("nonza",a)})}function C(t){return{subscribe(e){const{on:n}=k(e);for(const[e,r]of Object.entries(t))n(e,r)},unsubscribe(e){const{off:n}=k(e);for(const[e,r]of Object.entries(t))n(e,r)}}}class P extends Error{constructor(...t){super(...t),this.name="XMLError"}}class M extends x.EventEmitter{constructor(){super();const t=new b;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 n=new l(t,e),{root:r,cursor:s}=this;r?s!==r&&s.append(n):(this.root=n,this.emit("start",n)),this.cursor=n}onEndElement(t){const{root:e,cursor:n}=this;if(t===n.name){if(n!==e)return n.parent?void(this.cursor=n.parent):(n.parent=e,this.emit("element",n),void(this.cursor=e));this.emit("end",e)}else this.emit("error",new P(`${n.name} must be closed.`))}onText(t){const{cursor:e}=this;e?e.t(t):this.emit("error",new P(`${t} must be a child.`))}write(t){this.parser.write(t)}end(t){t&&this.parser.write(t)}}function O(...t){return d(...t)}function j(t){if(!t)return!1;return-1!==t.replaceAll(String.raw`\20`,"").replaceAll(String.raw`\22`,"").replaceAll(String.raw`\26`,"").replaceAll(String.raw`\27`,"").replaceAll(String.raw`\2f`,"").replaceAll(String.raw`\3a`,"").replaceAll(String.raw`\3c`,"").replaceAll(String.raw`\3e`,"").replaceAll(String.raw`\40`,"").replaceAll(String.raw`\5c`,"").search(/[ "&'/:<>@\\]/g)}function N(t){return null===t?null:t.replaceAll(/^\s+|\s+$/g,"").replaceAll("\\",String.raw`\5c`).replaceAll(" ",String.raw`\20`).replaceAll('"',String.raw`\22`).replaceAll("&",String.raw`\26`).replaceAll("'",String.raw`\27`).replaceAll("/",String.raw`\2f`).replaceAll(":",String.raw`\3a`).replaceAll("<",String.raw`\3c`).replaceAll(">",String.raw`\3e`).replaceAll("@",String.raw`\40`)}function F(t){return null===t?null:t.replaceAll(String.raw`\20`," ").replaceAll(String.raw`\22`,'"').replaceAll(String.raw`\26`,"&").replaceAll(String.raw`\27`,"'").replaceAll(String.raw`\2f`,"/").replaceAll(String.raw`\3a`,":").replaceAll(String.raw`\3c`,"<").replaceAll(String.raw`\3e`,">").replaceAll(String.raw`\40`,"@").replaceAll(String.raw`\5c`,"\\")}M.XMLError=P,Object.assign(O,{Element:l,createElement:d,Parser:M,escapeXML:y.escapeXML,unescapeXML:y.unescapeXML,escapeXMLText:y.escapeXMLText,unescapeXMLText:y.unescapeXMLText,XMLError:P,xml:O});class q{constructor(t,e,n){if("string"!=typeof e||!e)throw new TypeError("Invalid domain.");this.setDomain(e),this.setLocal("string"==typeof t?t:""),this.setResource("string"==typeof n?n:"")}[Symbol.toPrimitive](t){return"number"===t?Number.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 q(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||j(t))&&(t=N(t)),this._local=t&&t.toLowerCase(),this}getLocal(t=!1){let e=null;return e=t?F(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}}function X(t){let e,n;const r=t.indexOf("/");-1!==r&&(n=t.slice(r+1),t=t.slice(0,r));const s=t.indexOf("@");return-1!==s&&(e=t.slice(0,s),t=t.slice(s+1)),new q(e,t,n)}function z(...t){return t[1]||t[2]?new q(...t):X(...t)}Object.defineProperty(q.prototype,"local",{get:q.prototype.getLocal,set:q.prototype.setLocal}),Object.defineProperty(q.prototype,"domain",{get:q.prototype.getDomain,set:q.prototype.setDomain}),Object.defineProperty(q.prototype,"resource",{get:q.prototype.getResource,set:q.prototype.setResource});const R=z.bind();R.jid=z,R.JID=q,R.parse=X,R.equal=function(t,e){return t.equals(e)},R.detectEscape=j,R.escapeLocal=N,R.unescapeLocal=F;class D extends Error{constructor(t,e,n){super(t+(e?` - ${e}`:"")),this.name="XMPPError",this.condition=t,this.text=e,this.application=n}static fromElement(t){const[e,n,r]=t.getChildElements();let s,i;n&&(n.is("text")?s=n:n&&(i=n),r&&(i=r));const o=new this(e.name,s?s.text():"",i);return o.element=t,o}}class $ extends D{constructor(...t){super(...t),this.name="StreamError"}}function H(t){let{port:e,hostname:n,protocol:r}=new URL(t);return"[::1]"===n&&(n="::1"),{port:e,hostname:n,protocol:r}}function I(t){const{port:e,hostname:n}=H(`http://${t}`);return{port:e,hostname:n}}class B extends x.EventEmitter{#t=null;#e=null;constructor(t={}){super(),"string"==typeof t&&(t={domain:t}),this.jid=null,this.timeout=t.timeout||2e3,this.options=t,this.status="offline",this.socket=null,this.parser=null,this.root=null}isSecure(){return!0===this.socket?.secure}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.disconnect()}_onData(t){const e=t.toString("utf8");this.parser.write(e)}#n(t){this._streamError("bad-format"),this._detachParser(),this.emit("error",t)}#r(t,e){this._detachSocket(),this._status("disconnect",{clean:!t,reason:e})}#s(t,e){this._detachParser(),this._status("close",{clean:!t,reason:e})}_attachSocket(t){this.socket=t,this.#t??=C({data:this._onData.bind(this),close:this.#r.bind(this),connect:()=>this._status("connect"),error:t=>this.emit("error",t)}),this.#t.subscribe(this.socket)}_detachSocket(){this.socket&&this.#t?.unsubscribe(this.socket),this.socket=null}_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.disconnect()}_onStreamError(t){const e=$.fromElement(t);if("see-other-host"===e.condition)return this._onSeeOtherHost(e);this.emit("error",e)}async _onSeeOtherHost(t){const{protocol:e}=function(t){return t.includes("://")?H(t):I(t)}(this.options.service),n=t.element.getChildText("see-other-host"),{port:r}=I(n);let s;s=r?`${e||"xmpp:"}//${n}`:(e?`${e}//`:"")+n;try{await L(this,"disconnect");const{domain:t,lang:e}=this.options;await this.connect(s),await this.open({domain:t,lang:e})}catch(t){this.emit("error",t)}}_attachParser(t){this.parser=t,this.#e??=C({element:this._onElement.bind(this),error:this.#n.bind(this),end:this.#s.bind(this),start:t=>this._status("open",t)}),this.#e.subscribe(this.parser)}_detachParser(){this.parser&&this.#e?.unsubscribe(this.parser),this.parser=null,this.root=null}_jid(t){return this.jid=R(t),this.jid}_status(t,...e){this.status!==t&&(this.status=t,this.emit("status",t,...e),this.emit(t,...e))}_ready(t=!1){t?this.status="online":this._status("online",this.jid)}async disconnect(){let t;try{t=await this._closeStream()}catch(t){this.#s(t)}try{await this._closeSocket()}catch(t){this.#r(!0,t)}return t}async start(){if("offline"!==this.status)throw new Error("Connection is not offline");const{service:t,domain:e,lang:n}=this.options;await this.connect(t);const r=L(this,"online");return await this.open({domain:e,lang:n}),r}async connect(t){this._status("connecting",t);const e=new this.Socket;return this._attachSocket(e),e.connect(this.socketParameters(t)),L(e,"connect")}async _closeSocket(t=this.timeout){this._status("disconnecting"),this.socket.end(),await L(this.socket,"close","error",t)}async open(t){this._status("opening");const{domain:e,lang:n}=t,r=this.headerElement();return r.attrs.to=e,r.attrs["xml:lang"]=n,this.root=r,this._attachParser(new this.Parser),await this.write(this.header(r)),L(this,"open","error",this.timeout)}async stop(){const t=await this.disconnect();return this._status("offline",t),t}async _closeStream(t=this.timeout){await this.#i("close");const e=this.footer(this.footerElement());return await this.write(e),this._status("closing"),L(this.parser,"end","error",t)}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),L(this,"element","error",e)]).then(([,t])=>t)}async write(t){if("closing"===this.status)throw new Error("Connection is closing");return new Promise((e,n)=>{this.socket.write(t,t=>t?n(t):e())})}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(){}#o=new Map;#a=new Set(["close"]);hook(t,e){this.#c(t),this.#o.has(t)||this.#o.set(t,new Set),this.#o.get(t).add([e])}#c(t){if(!this.#a.has(t))throw new Error(`Hook event name "${t}" is unknown.`)}unhook(t,e){this.#c(t);const n=this.#o.get("event"),r=[...n].find(t=>t.handler===e);n.remove(r)}async#i(t,...e){this.#c(t);const n=this.#o.get(t);n&&await Promise.all([...n].map(async([t])=>{try{await t(...e)}catch(t){this.emit("error",t)}}))}}B.prototype.NS="",B.prototype.Socket=null,B.prototype.Parser=null;class U extends B{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,...e){const n=this.isSecure()&&this.jid?.bare().toString();return n&&(t.attrs.from=n),this.Transport.prototype.header(t,...e)}headerElement(...t){return this.Transport.prototype.headerElement(...t)}footer(...t){return this.Transport.prototype.footer(...t)}footerElement(...t){return this.Transport.prototype.footerElement(...t)}}U.prototype.NS="jabber:client";class W extends x.EventEmitter{constructor(t){super(),this.delay=1e3,this.entity=t,this._timeout=null}#u=()=>{this.scheduleReconnect()};scheduleReconnect(){const{entity:t,delay:e,_timeout:n}=this;clearTimeout(n),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:n,lang:r}=t.options;await t.connect(e),await t.open({domain:n,lang:r}),this.emit("reconnected")}start(){const{entity:t}=this;t.on("disconnect",this.#u)}stop(){const{entity:t,_timeout:e}=this;t.removeListener("disconnect",this.#u),clearTimeout(e)}}const K="ECONNERROR";class Y extends x.EventEmitter{#l=null;socket=null;url=null;secure=!1;connect(t){this.url=t,this.secure=function(t){const e=H(t);return"wss:"===e.protocol||!!["localhost","127.0.0.1","::1"].includes(e.hostname)}(t),this._attachSocket(new WebSocket(t,["xmpp"]))}_attachSocket(t){this.socket=t,this.#l??=C({open:()=>this.emit("connect"),message:({data:t})=>this.emit("data",t),error:t=>{const{url:e}=this;let{error:n}=t;n||(n=new Error(t.message||`WebSocket ${K} ${e}`),n.errno=K,n.code=K),n.event=t,n.url=e,this.emit("error",n)},close:t=>{this._detachSocket(),this.emit("close",!t.wasClean,t)}}),this.#l.subscribe(this.socket)}_detachSocket(){this.url=null,this.secure=!1,this.socket&&this.#l?.unsubscribe(this.socket),this.socket=null}end(){this.socket.close()}write(t,e){function n(t){e&&Promise.resolve().then(()=>e(t))}try{this.socket.send(t)}catch(t){return void n(t)}n()}}const J="urn:ietf:params:xml:ns:xmpp-framing";class Z extends B{send(t,...e){return t.attrs.xmlns??=this.NS,super.send(t,...e)}async sendMany(t){for(const e of t)e.attrs.xmlns??=this.NS,e.parent=this.root,this.socket.write(e.toString()),this.emit("send",e)}footerElement(){return new O.Element("close",{xmlns:J})}headerElement(){const t=super.headerElement();return t.name="open",t.attrs.xmlns=J,t}socketParameters(t){return/^wss?:\/\//.test(t)?t:void 0}}Z.prototype.Socket=Y,Z.prototype.NS="jabber:client",Z.prototype.Parser=class extends M{onStartElement(t,e){const n=new l(t,e),{cursor:r}=this;r&&r.append(n),this.cursor=n}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 P(`${e.name} must be closed.`))}};var G,Q,V={};var tt=(Q||(Q=1,G=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,n){let r=-1;return function s(i){if(i<=r)return Promise.reject(new Error("next() called multiple times"));r=i;let o=t[i];if(i===t.length&&(o=n),!o)return Promise.resolve();try{return Promise.resolve(o(e,s.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}}),G),et=e(tt);class nt{constructor(t,e){this.stanza=e,this.entity=t;const{name:n,attrs:r}=e,{type:s,id:i}=r;this.name=n,this.id=i||"",this.type="message"===n?s||"normal":"presence"===n?s||"available":s||"",this.from=null,this.to=null,this.local="",this.domain="",this.resource=""}}class rt extends nt{constructor(t,e){super(t,e);const{jid:n}=t,{domain:r}=t.options??{},s=e.attrs.to||n?.toString(),i=e.attrs.from||r;s&&(this.to=new R(s)),i&&(this.from=new R(i),this.local=this.from.local,this.domain=this.from.domain,this.resource=this.from.resource)}}class st extends nt{constructor(t,e){super(t,e);const{jid:n}=t,{domain:r}=t.options??{},s=e.attrs.from||n?.toString(),i=e.attrs.to||r;s&&(this.from=new R(s)),i&&(this.to=new R(i),this.local=this.to.local,this.domain=this.to.domain,this.resource=this.to.resource)}}function it(t,e,n){return r=>{const s=new n(t,r);return et(e)(s)}}function ot(t){return(e,n)=>{n().then(e=>e&&t.send(e)).catch(e=>t.emit("error",e))}}class at extends D{constructor(t,e,n,r){super(t,e,n),this.type=r,this.name="StanzaError"}static fromElement(t){const e=super.fromElement(t);return e.type=t.attrs.type,e}}class ct{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:n,stanza:r},s){if(!function({name:t,type:e}){return"iq"===t&&("error"===e||"result"===e)}({name:e,type:t}))return s();const i=this.handlers.get(n);if(!i)return s();"error"===t?i.reject(at.fromElement(r.getChild("error"))):i.resolve(r),this.handlers.delete(n)}async request(t,e=3e4){t.attrs.id||(t.attrs.id=function(){let t;for(;!t;)t=Math.random().toString(36).slice(2,12);return t}());const n=new A;this.handlers.set(t.attrs.id,n);try{await this.entity.send(t),await _(n.promise,e)}catch(e){throw this.handlers.delete(t.attrs.id),e}return n.promise}_childRequest(t,e,n,...r){const{name:s,attrs:{xmlns:i}}=e;return this.request(O("iq",{type:t,to:n},e),...r).then(t=>t.getChild(s,i))}async get(...t){return this._childRequest("get",...t)}async set(...t){return this._childRequest("set",...t)}}function ut({stanza:t}){return O("iq",{to:t.attrs.from,from:t.attrs.to,id:t.attrs.id})}function lt(t,e,n){const r=ut(t);return r.attrs.type="error",n&&r.append(n),r.append(e),r}function ht(t,e){return O("error",{type:t},O(e,"urn:ietf:params:xml:ns:xmpp-stanzas"))}function mt(t){return async function(e,n){if(!function({name:t,type:e}){return"iq"===t&&"error"!==e&&"result"!==e}(e))return n();const{stanza:r}=e,s=r.getChildElements(),[i]=s;if(!function({type:t},e,n){return("get"===t||"set"===t)&&1===e.length&&!!n}(e,s,i))return lt(e,ht("modify","bad-request"),i);let o;e.element=i;try{o=await n()}catch(e){t.emit("error",e),o=ht("cancel","internal-server-error")}return o||(o=ht("cancel","service-unavailable")),o instanceof O.Element&&o.is("error")?lt(e,o,i):function(t,e){const n=ut(t);return n.attrs.type="result",e&&n.append(e),n}(e,o instanceof O.Element?o:void 0)}}function pt(t,e,n,r){return(s,i)=>s.type!==t|!s.element||!s.element.is(n,e)?i():r(s,i)}function ft(t){return t.startsWith("https")||t.startsWith("wss")}function dt(t,e){let n,r;return n=ft(t.uri)&&!ft(e.uri)?-1:!ft(t.uri)&&ft(e.uri)?1:0,0!==n?n:(r=t.method===e.method?0:"websocket"===t.method?-1:"websocket"===e.method?1:"xbosh"===t.method?-1:"xbosh"===e.method?1:"httppoll"===t.method?-1:"httppoll"===e.method?1:0,0!==r?r:0)}function yt(t){return fetch(`https://${t}/.well-known/host-meta`).then(t=>t.text()).then(t=>function(t){const e=new M;let n=null,r=null;if(e.on("start",t=>{n=t}),e.on("element",t=>{n.append(t)}),e.on("error",t=>{r=t}),e.write(t),e.end(),r)throw r;return n}(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})).toSorted(dt)).catch(()=>[])}async function wt(t){const e=await function(...t){return Promise.all([Promise.resolve([]),yt(...t)]).then(([t,e])=>[...t,...e])}(t,{srv:[{service:"xmpps-client",protocol:"tcp"},{service:"xmpp-client",protocol:"tcp"}]});return[...new Set(e.map(t=>t.uri))]}async function gt(t,e){if(0===e.length)throw new Error("Couldn't connect");const n=e.shift(),r=t._findTransport(n);if(!r)return gt(t,e);t._status("connecting",n);const s=r.prototype.socketParameters(n),i=new r.prototype.Socket;try{i.connect(s),await L(i,"connect")}catch{return gt(t,e)}t._attachSocket(i),i.emit("connect"),t.Transport=r,t.Socket=r.prototype.Socket,t.Parser=r.prototype.Parser}function vt({entity:t}){const e=t.connect;t.connect=async function(n){if(!n||/:\/\//.test(n))return e.call(this,n);const r=function(t,e){return e.filter(e=>t._findTransport(e))}(t,await wt(n));if(0===r.length)throw new Error("No compatible transport found.");try{await gt(t,r)}catch(e){throw await t.disconnect(),t._status("disconnect"),e}}}function bt(t){return globalThis.btoa(t)}function xt(t){return globalThis.atob(t)}class St extends D{constructor(...t){super(...t),this.name="SASLError"}}const _t="urn:ietf:params:xml:ns:xmpp-sasl";function Et(t,e,n){const r=new Set(t.getChildren("mechanism",e).map(t=>t.text()));return n._mechs.map(({name:t})=>t).filter(t=>r.has(t))}function kt({streamFeatures:t,saslFactory:e},n){t.use("mechanisms",_t,async({entity:t},r,s)=>{const i=Et(s,_t,e);if(0===i.length)throw new St("SASL: No compatible mechanism available.");await n(async function(n,r){await async function({saslFactory:t,entity:e,mechanism:n,credentials:r}){const s=t.create([n]);if(!s)throw new Error(`SASL: Mechanism ${n} not found.`);const{domain:i}=e.options,o={username:null,password:null,server:i,host:i,realm:i,serviceType:"xmpp",serviceName:i,...r};await T(e,s.clientFirst&&O("auth",{xmlns:_t,mechanism:s.name},bt(await s.response(o))),async(t,n)=>{if(t.getNS()===_t){if("challenge"===t.name){await s.challenge(xt(t.text()));const n=await s.response(o);return void await e.send(O("response",{xmlns:_t,mechanism:s.name},"string"==typeof n?bt(n):""))}if("failure"===t.name)throw St.fromElement(t);return"success"===t.name?n():void 0}})}({saslFactory:e,entity:t,mechanism:r,credentials:n})},i,null,t),await t.restart()})}const Lt="urn:xmpp:sasl:2";async function At({saslFactory:t,entity:e,mechanism:n,credentials:r,userAgent:s,streamFeatures:i,features:o}){const a=t.create([n]);if(!a)throw new Error(`SASL: Mechanism ${n} not found.`);const{domain:c}=e.options,u={username:null,password:null,server:c,host:c,realm:c,serviceType:"xmpp",serviceName:c,...r};await T(e,O("authenticate",{xmlns:Lt,mechanism:a.name},[a.clientFirst&&O("initial-response",{},bt(await a.response(u))),s,...i]),async(t,n)=>{if(t.getNS()===Lt){if("challenge"===t.name){await a.challenge(xt(t.text()));const n=await a.response(u);return void await e.send(O("response",{xmlns:Lt,mechanism:a.name},"string"==typeof n?bt(n):""))}if("failure"===t.name)throw St.fromElement(t);if("continue"===t.name)throw new Error("SASL continue is not supported yet");if("success"===t.name){const r=t.getChild("additional-data")?.text();r&&a.final&&await a.final(xt(r));const s=t.getChildText("authorization-identifier");s&&e._jid(s);for(const e of t.getChildElements()){const t=o.get(e.getNS());t?.[1]?.(e)}return n()}}})}function Tt({streamFeatures:t,saslFactory:e},n){const r=new Map;let s;return t.use("authentication",Lt,async({entity:t},i,o)=>{const a=Et(o,Lt,e),c=await async function({element:t,features:e}){const n=[],r=t.getChild("inline");if(!r)return n;for(const t of r.getChildElements()){const r=t.getNS(),s=e.get(r);s&&n.push(s[0](t))}return Promise.all(n)}({element:o,features:r}),u=!!s?.mechanism;if(0===a.length&&!u)throw new St("SASL: No compatible mechanism available.");await n(async function(n,i,o){if(await s.auth({authenticate:At,entity:t,userAgent:o,streamFeatures:c,features:r,credentials:n}))return;await At({entity:t,userAgent:o,streamFeatures:c,features:r,saslFactory:e,mechanism:i,credentials:n})},a,u?s:null,t)}),{use(t,e,n){r.set(t,[e,n])},setup({fast:t}){s=t}}}const Ct="urn:ietf:params:xml:ns:xmpp-bind";async function Pt(t,e,n){const r=await e.set(function(t){return O("bind",{xmlns:Ct},t&&O("resource",{},t))}(n)),s=r.getChildText("jid");return t._jid(s),t._ready(!1),s}function Mt({streamFeatures:t,iqCaller:e},n){t.use("bind",Ct,function({iqCaller:t},e){return async({entity:n},r)=>{e="function"==typeof e?await e():e,await Pt(n,t,e),r()}}({iqCaller:e},n))}function Ot(t=new Date){return"string"==typeof t&&(t=new Date(t)),new Date(t).toISOString().split(".")[0]+"Z"}function jt({streamFeatures:t,sm:e,entity:n,resumed:r,failed:s,enabled:i}){t.use("sm",Nt,async(t,o)=>{if(e.id)try{const t=await async function(t,e){return T(t,qt({sm:e}),(t,e)=>{if(t.is("resumed",Nt))return e(t);if(t.is("failed",Nt))throw D.fromElement(t)})}(n,e);return void await r(t)}catch{s()}await o();const a=function(t,e){return T(t,Ft({sm:e}),(t,e)=>{if(t.is("enabled",Nt))return e(t);if(t.is("failed",Nt))throw D.fromElement(t)})}(n,e);if(e.outbound_q.length>0)throw new Error("Stream Management assertion failure, queue should be empty after enable");e.outbound=0;try{const t=await a;i(t.attrs)}catch{e.enabled=!1,e.enableSent=!1}})}const Nt="urn:xmpp:sm:3";function Ft({sm:t}){return O("enable",{xmlns:Nt,max:t.preferredMaximum,resume:"true"})}function qt({sm:t}){return O("resume",{xmlns:Nt,h:t.inbound,previd:t.id})}function Xt({streamFeatures:t,entity:e,middleware:n,bind2:r,sasl2:s}){let i=null,o=null,a=null;const c=new x.EventEmitter;async function u(){try{await e.send(O("a",{xmlns:Nt,h:c.inbound}))}catch{}}async function l(t){c.enabled=!0,m(+t.attrs.h);let n=c.outbound_q;c.outbound_q=[],await e.sendMany(n.map(t=>function({entity:t,item:e}){const{stanza:n,stamp:r}=e;"message"!==n.name||n.getChild("delay","urn:xmpp:delay")||n.append(O("delay",{xmlns:"urn:xmpp:delay",from:t.jid.toString(),stamp:r}));return n}({entity:e,item:t}))),c.emit("resumed"),e._ready(!0),d()}function h(){c.enabled=!1,c.enableSent=!1,c.id="",p()}function m(t){const e=c.outbound;for(let n=0;n<+t-e;n++){const t=c.outbound_q.shift();c.outbound++,c.emit("ack",t.stanza)}}function p(){let t;for(;t=c.outbound_q.shift();)c.emit("fail",t.stanza);c.outbound=0}function f({id:t,max:e}){c.enabled=!0,c.id=t,c.max=e,c.inbound=0,d()}function d(t=c.requestAckInterval){clearTimeout(o),c.enabled&&t&&(o=setTimeout(y,t))}function y(){clearTimeout(i),clearTimeout(o),clearTimeout(a),c.enabled&&(c.timeout&&(i=setTimeout(()=>e.disconnect().catch(()=>{}),c.timeout)),e.send(O("r",{xmlns:Nt})).catch(()=>{}),d())}return Object.assign(c,{preferredMaximum:null,enabled:!1,enableSent:!1,id:"",outbound_q:[],outbound:0,inbound:0,max:null,timeout:6e4,requestAckInterval:3e4,requestAckDebounce:250}),e.on("disconnect",()=>{clearTimeout(i),clearTimeout(o),clearTimeout(a),c.enabled=!1,c.enableSent=!1}),e.hook("close",async()=>{c.enabled&&await u()}),e.on("offline",()=>{p(),c.inbound=0,c.enabled=!1,c.enableSent=!1,c.id=""}),n.use(async(t,e)=>{const{stanza:n}=t;return clearTimeout(i),["presence","message","iq"].includes(n.name)?c.inbound+=1:n.is("r",Nt)?await u():n.is("a",Nt)&&m(+n.attrs.h),d(),e()}),r&&function({bind2:t,sm:e,failed:n,enabled:r}){t.use(Nt,t=>Ft({sm:e}),async t=>{t.is("enabled")?r(t.attrs):t.is("failed")&&n()})}({bind2:r,sm:c,failed:h,enabled:f}),s&&function({sasl2:t,sm:e,failed:n,resumed:r}){t.use(Nt,t=>{if(t.is("sm"))return e.id?qt({sm:e}):void 0},t=>{t.is("resumed")?r(t):t.is("failed")&&n()})}({sasl2:s,sm:c,failed:h,resumed:l}),n.filter((t,e)=>{const{stanza:n}=t;return n.is("enable",Nt)&&(c.enableSent=!0),(c.enabled||c.enableSent)&&["presence","message","iq"].includes(n.name)?(c.outbound_q.push({stanza:n,stamp:Ot()}),clearTimeout(o),clearTimeout(a),a=setTimeout(y,c.requestAckDebounce),e()):e()}),t&&jt({streamFeatures:t,sm:c,entity:e,resumed:l,failed:h,enabled:f}),c}const zt="urn:xmpp:bind:0";function Rt({sasl2:t,entity:e},n){const r=new Map;return t.use(zt,async t=>{if(!t.is("bind",zt))return;n="function"==typeof n?await n():n;const e=await function({element:t,features:e}){const n=[],r=t.getChild("inline");if(!r)return n;for(const t of r.getChildElements()){const r=t.attrs.var,s=e.get(r);s&&n.push(s[0](t))}return Promise.all(n)}({element:t,features:r});return O("bind",{xmlns:"urn:xmpp:bind:0"},n&&O("tag",null,n),...e)},t=>{if(t.is("bound")){e._ready(!1);for(const e of t.getChildElements()){const t=r.get(e.getNS());t?.[1]?.(e)}}}),{use(t,e,n){r.set(t,[e,n])}}}var Dt,$t={exports:{}},Ht={exports:{}};var It;var Bt,Ut,Wt=(It||(It=1,Bt=$t,Dt||(Dt=1,function(t,e){function n(){this._mechs=[]}n.prototype.use=function(t,e){return e||(t=(e=t).prototype.name),this._mechs.push({name:t,mech:e}),this},n.prototype.create=function(t){for(var e=0,n=this._mechs.length;er,async deleteToken(){r=null},async save(t){try{await this.saveToken(t)}catch(t){e.emit("error",t)}},async fetch(){try{return this.fetchToken()}catch(t){e.emit("error",t)}},async delete(){try{await this.deleteToken()}catch(t){e.emit("error",t)}},saslFactory:n,async auth({authenticate:t,entity:e,userAgent:n,credentials:r,streamFeatures:i,features:o}){if(!s.mechanism)return!1;const{token:a}=r;if(!function(t,e){if(!t)return!1;if(!e.includes(t.mechanism))return!1;if(new Date(t.expiry)<=new Date)return!1;return!0}(a,s.mechanisms))return c();try{return await t({saslFactory:s.saslFactory,mechanism:a.mechanism,credentials:{...r,password:a.token},streamFeatures:[...i,O("fast",{xmlns:Yt})],entity:e,userAgent:n,features:o}),!0}catch(t){return t instanceof St&&["not-authorized","credentials-expired"].includes(t.condition)?c():(e.emit("error",t),!1)}async function c(){return await s.delete(),function(t){t.push(O("request-token",{xmlns:Yt,mechanism:s.mechanism}))}(i),!1}}}),i(),t.use(Yt,async t=>{if(!t.is("fast",Yt))return i();s.available=!0;const e=Et(t,Yt,n),r=e[0];if(!r)return i();s.mechanisms=e,s.mechanism=r},async t=>{t.is("token",Yt)&&await s.save({mechanism:s.mechanism,token:t.attrs.token,expiry:t.attrs.expiry})}),s}var Zt,Gt={exports:{}},Qt={exports:{}};var Vt;var te=(Vt||(Vt=1,function(t){!function(t,e,n){(e.exports=n).Mechanism=n}(0,t,(Zt||(Zt=1,function(t){!function(t,e){function n(){}n.prototype.name="PLAIN",n.prototype.clientFirst=!0,n.prototype.response=function(t){var e="";return e+=t.authzid||"",e+="\0",e+=t.username,(e+="\0")+t.password},n.prototype.challenge=function(t){return this},e.exports=n}(0,t)}(Qt)),Qt.exports))}(Gt)),Gt.exports),ee=e(te);function ne(t){t.use(ee)}var re,se={exports:{}},ie={exports:{}};var oe;var ae=(oe||(oe=1,function(t){!function(t,e,n){(e.exports=n).Mechanism=n}(0,t,(re||(re=1,function(t){!function(t,e){function n(){}n.prototype.name="ANONYMOUS",n.prototype.clientFirst=!0,n.prototype.response=function(t){return t.trace||""},n.prototype.challenge=function(t){},e.exports=n}(0,t)}(ie)),ie.exports))}(se)),se.exports),ce=e(ae);function ue(t){t.use(ce)}function le(){}le.prototype.Mechanism=le,le.prototype.name="HT-SHA-256-NONE",le.prototype.clientFirst=!0,le.prototype.response=async function({username:t,password:e}){this.key=await crypto.subtle.importKey("raw",(new TextEncoder).encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);const n=await crypto.subtle.sign("HMAC",this.key,(new TextEncoder).encode("Initiator"));return`${t}\0${String.fromCodePoint(...new Uint8Array(n))}`},le.prototype.final=async function(t){const e=Uint8Array.from(t,t=>t.codePointAt(0));if(!0!==await crypto.subtle.verify("HMAC",this.key,e,(new TextEncoder).encode("Responder")))throw new Error("Responder message from server was wrong")};const he="ANONYMOUS",me="PLAIN";function pe(t,e){return async function(...n){if("function"==typeof t)return void await t(...n);const[r,s,i,o]=n;t.token??=await(i?.fetch());const a=function({mechanisms:t,entity:e,credentials:n}){if(!n?.username&&!n?.password&&!n?.token&&t.includes(he))return he;return e.isSecure()?t[0]:t.find(t=>t!==me)}({mechanisms:s,entity:o,credentials:t});await r(t,a,e)}}function fe(t,...e){if("function"==typeof t)return t(...e)}return t.client=function(t={}){let{resource:e,credentials:n,username:r,password:s,userAgent:i,...o}=t;const{domain:a,service:c}=o;!a&&c&&(o.domain=function(t){return(t.split("://")[1]||t).split(":")[0].split("/")[0]}(c));const u=new U(o);r&&o.domain&&(u.jid=R(r,o.domain));const l=function({entity:t}){const e=new W(t);return e.start(),e}({entity:u}),h=function({entity:t}){t.transports.push(Z)}({entity:u}),m=fe(V,{entity:u}),p=fe(V,{entity:u}),f=function({entity:t}){const e=[ot(t)],n=[],r=it(t,e,rt),s=it(t,n,st);return t.on("element",r),t.on("send",s),{use:t=>(e.push(t),t),filter:t=>(n.push(t),t)}}({entity:u}),d=function({middleware:t}){return{use:function(e,n,r){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,n);return o?r(t,s,o):s()})}}}({middleware:f}),y=function(...t){const e=new ct(...t);return e.start(),e}({middleware:f,entity:u}),w=function({middleware:t,entity:e}){return t.use(mt(e)),{get(e,n,r){t.use(pt("get",e,n,r))},set(e,n,r){t.use(pt("set",e,n,r))}}}({middleware:f,entity:u}),g=vt({entity:u}),v=new Kt,b=Object.entries({plain:ne,anonymous:ue}).map(([t,e])=>({[t]:e(v)}));i??=O("user-agent",{id:globalThis.crypto.randomUUID()});const x=fe(V,{streamFeatures:d}),S=Tt({streamFeatures:d,saslFactory:v},pe(n??{username:r,password:s},i)),_=Jt({sasl2:S,entity:u});S.setup({fast:_});const E=Rt({sasl2:S,entity:u},e);!function(t){t.use(le)}(_.saslFactory);const k=kt({streamFeatures:d,saslFactory:v},pe(n??{username:r,password:s},i)),L=Xt({streamFeatures:d,entity:u,middleware:f,bind2:E,sasl2:S}),A=Mt({iqCaller:y,streamFeatures:d},e);return w?.get("urn:xmpp:ping","ping",()=>({})),Object.assign(u,{entity:u,reconnect:l,tcp:m,websocket:h,tls:p,middleware:f,streamFeatures:d,iqCaller:y,iqCallee:w,resolve:g,starttls:x,saslFactory:v,sasl2:S,sasl:k,resourceBinding:A,streamManagement:L,mechanisms:b,bind2:E,fast:_})},t.jid=R,t.xml=O,t}({});//# sourceMappingURL=xmpp.min.js.map