genesys-cloud-streaming-client 17.0.2-develop.85 → 17.0.2-develop.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.d.ts +7 -0
- package/dist/cjs/client.js +85 -8
- package/dist/cjs/types/interfaces.d.ts +6 -0
- package/dist/cjs/utils.d.ts +1 -0
- package/dist/cjs/utils.js +9 -3
- package/dist/deploy-info.json +2 -2
- package/dist/es/client.d.ts +7 -0
- package/dist/es/client.js +86 -9
- package/dist/es/index.bundle.js +15387 -18815
- package/dist/es/types/interfaces.d.ts +6 -0
- package/dist/es/utils.d.ts +1 -0
- package/dist/es/utils.js +7 -2
- package/dist/npm/CHANGELOG.md +6 -0
- package/dist/npm/client.d.ts +7 -0
- package/dist/npm/client.js +85 -8
- package/dist/npm/types/interfaces.d.ts +6 -0
- package/dist/npm/utils.d.ts +1 -0
- package/dist/npm/utils.js +9 -3
- package/dist/streaming-client.browser.ie.js +11 -4
- package/dist/streaming-client.browser.js +13 -21
- package/dist/v17/streaming-client.browser.ie.js +11 -4
- package/dist/v17/streaming-client.browser.js +13 -21
- package/dist/v17.0.2/streaming-client.browser.ie.js +11 -4
- package/dist/v17.0.2/streaming-client.browser.js +13 -21
- package/package.json +4 -4
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
window.GenesysCloudStreamingClient=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=65)}([function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return r})),n.d(t,"__assign",(function(){return s})),n.d(t,"__rest",(function(){return o})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return c})),n.d(t,"__metadata",(function(){return l})),n.d(t,"__awaiter",(function(){return u})),n.d(t,"__generator",(function(){return d})),n.d(t,"__createBinding",(function(){return p})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return f})),n.d(t,"__read",(function(){return m})),n.d(t,"__spread",(function(){return g})),n.d(t,"__spreadArrays",(function(){return v})),n.d(t,"__spreadArray",(function(){return b})),n.d(t,"__await",(function(){return y})),n.d(t,"__asyncGenerator",(function(){return _})),n.d(t,"__asyncDelegator",(function(){return S})),n.d(t,"__asyncValues",(function(){return w})),n.d(t,"__makeTemplateObject",(function(){return T})),n.d(t,"__importStar",(function(){return x})),n.d(t,"__importDefault",(function(){return j})),n.d(t,"__classPrivateFieldGet",(function(){return k})),n.d(t,"__classPrivateFieldSet",(function(){return E}));
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */
|
|
16
|
-
var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function o(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}function c(e,t){return function(n,i){t(n,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function d(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}var p=Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function h(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||p(t,e,n)}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e}function v(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i}function b(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function _(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof y?Promise.resolve(n.value.v).then(c,l):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function S(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:y(e[i](t)),done:"return"===i}:r?r(t):t}:r}}function w(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=f(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}}function T(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var I=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&p(t,e,n);return I(t,e),t}function j(e){return e&&e.__esModule?e:{default:e}}function k(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function E(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}},function(e,t,n){"use strict";(function(e){var i=n(29);const{toString:r}=Object.prototype,{getPrototypeOf:s}=Object,o=(a=Object.create(null),e=>{const t=r.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>o(t)===e),l=e=>t=>typeof t===e,{isArray:u}=Array,d=l("undefined");const p=c("ArrayBuffer");const h=l("string"),f=l("function"),m=l("number"),g=e=>null!==e&&"object"==typeof e,v=e=>{if("object"!==o(e))return!1;const t=s(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},b=c("Date"),y=c("File"),_=c("Blob"),S=c("FileList"),w=c("URLSearchParams");function T(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let i,r;if("object"!=typeof e&&(e=[e]),u(e))for(i=0,r=e.length;i<r;i++)t.call(null,e[i],i,e);else{const r=n?Object.getOwnPropertyNames(e):Object.keys(e),s=r.length;let o;for(i=0;i<s;i++)o=r[i],t.call(null,e[o],o,e)}}function I(e,t){t=t.toLowerCase();const n=Object.keys(e);let i,r=n.length;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:e,j=e=>!d(e)&&e!==x;const k=(E="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>E&&e instanceof E);var E;const C=c("HTMLFormElement"),N=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),O=c("RegExp"),R=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};T(n,(n,r)=>{let s;!1!==(s=t(n,r,e))&&(i[r]=s||n)}),Object.defineProperties(e,i)},A="abcdefghijklmnopqrstuvwxyz",P={DIGIT:"0123456789",ALPHA:A,ALPHA_DIGIT:A+A.toUpperCase()+"0123456789"};const L=c("AsyncFunction");t.a={isArray:u,isArrayBuffer:p,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=o(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t},isString:h,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:g,isPlainObject:v,isUndefined:d,isDate:b,isFile:y,isBlob:_,isRegExp:O,isFunction:f,isStream:e=>g(e)&&f(e.pipe),isURLSearchParams:w,isTypedArray:k,isFileList:S,forEach:T,merge:function e(){const{caseless:t}=j(this)&&this||{},n={},i=(i,r)=>{const s=t&&I(n,r)||r;v(n[s])&&v(i)?n[s]=e(n[s],i):v(i)?n[s]=e({},i):u(i)?n[s]=i.slice():n[s]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&T(arguments[e],i);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(T(t,(t,r)=>{n&&f(t)?e[r]=Object(i.a)(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,i)=>{let r,o,a;const c={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)a=r[o],i&&!i(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&s(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:c,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return-1!==i&&i===n},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=n.next())&&!i.done;){const n=i.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const i=[];for(;null!==(n=e.exec(t));)i.push(n);return i},isHTMLForm:C,hasOwnProperty:N,hasOwnProp:N,reduceDescriptors:R,freezeMethods:e=>{R(e,(t,n)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const i=e[n];f(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},i=e=>{e.forEach(e=>{n[e]=!0})};return u(e)?i(e):i(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:I,global:x,isContextDefined:j,ALPHABET:P,generateString:(e=16,t=P.ALPHA_DIGIT)=>{let n="";const{length:i}=t;for(;e--;)n+=t[Math.random()*i|0];return n},isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,i)=>{if(g(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const r=u(e)?[]:{};return T(e,(e,t)=>{const s=n(e,i+1);!d(s)&&(r[t]=s)}),t[i]=void 0,r}}return e};return n(e,0)},isAsyncFn:L,isThenable:e=>e&&(g(e)||f(e))&&f(e.then)&&f(e.catch)}}).call(this,n(6))},function(e,t,n){"use strict";var i=n(1);function r(e,t,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r)}i.a.inherits(r,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:i.a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const s=r.prototype,o={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{o[e]={value:e}}),Object.defineProperties(r,o),Object.defineProperty(s,"isAxiosError",{value:!0}),r.from=(e,t,n,o,a,c)=>{const l=Object.create(s);return i.a.toFlatObject(e,l,(function(e){return e!==Error.prototype}),e=>"isAxiosError"!==e),r.call(l,e.message,t,n,o,a),l.cause=e,l.name=e.name,c&&Object.assign(l,c),l},t.a=r},function(e,t,n){"use strict";const i={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},i.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},i.getDescription=function(e){const t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){const t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter(e=>0===e.indexOf(t))},i.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},i.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},i.parseIceOptions=function(e){return e.substr(14).split(" ")},i.parseRtpMap=function(e){let t=e.substr(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},i.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},i.parseExtmap=function(e){const t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},i.parseFmtp=function(e){const t={};let n;const i=e.substr(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)n=i[e].trim().split("="),t[n[0].trim()]=n[1];return t},i.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)}),t+="a=fmtp:"+n+" "+i.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){const t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},i.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(n.attribute=e.substr(t+1,i-t-1),n.value=e.substr(i+1)):n.attribute=e.substr(t+1),n},i.parseSsrcGroup=function(e){const t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},i.getMid=function(e){const t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},i.parseFingerprint=function(e){const t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},i.parseCryptoLine=function(e){const t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},i.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?i.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},i.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},i.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},i.getCryptoParameters=function(e,t){return i.matchPrefix(e+t,"a=crypto:").map(i.parseCryptoLine)},i.getIceParameters=function(e,t){const n=i.matchPrefix(e+t,"a=ice-ufrag:")[0],r=i.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&r?{usernameFragment:n.substr(12),password:r.substr(10)}:null},i.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},i.parseRtpParameters=function(e){const t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=i.splitLines(e)[0].split(" ");for(let r=3;r<n.length;r++){const s=n[r],o=i.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(o){const n=i.parseRtpMap(o),r=i.matchPrefix(e,"a=fmtp:"+s+" ");switch(n.parameters=r.length?i.parseFmtp(r[0]):{},n.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(i.parseRtcpFb),t.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(n.name.toUpperCase())}}}return i.matchPrefix(e,"a=extmap:").forEach(e=>{t.headerExtensions.push(i.parseExtmap(e))}),t},i.writeRtpDescription=function(e,t){let n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(e=>{n+=i.writeRtpMap(e),n+=i.writeFmtp(e),n+=i.writeRtcpFb(e)});let r=0;return t.codecs.forEach(e=>{e.maxptime>r&&(r=e.maxptime)}),r>0&&(n+="a=maxptime:"+r+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach(e=>{n+=i.writeExtmap(e)}),n},i.parseRtpEncodingParameters=function(e){const t=[],n=i.parseRtpParameters(e),r=-1!==n.fecMechanisms.indexOf("RED"),s=-1!==n.fecMechanisms.indexOf("ULPFEC"),o=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),a=o.length>0&&o[0].ssrc;let c;const l=i.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substr(17).split(" ").map(e=>parseInt(e,10)));l.length>0&&l[0].length>1&&l[0][0]===a&&(c=l[0][1]),n.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let n={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(n.rtx={ssrc:c}),t.push(n),r&&(n=JSON.parse(JSON.stringify(n)),n.fec={ssrc:a,mechanism:s?"red+ulpfec":"red"},t.push(n))}}),0===t.length&&a&&t.push({ssrc:a});let u=i.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substr(5),10)*.95-16e3:void 0,t.forEach(e=>{e.maxBitrate=u})),t},i.parseRtcpParameters=function(e){const t={},n=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);const r=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=r.length>0,t.compound=0===r.length;const s=i.matchPrefix(e,"a=rtcp-mux");return t.mux=s.length>0,t},i.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},i.parseMsid=function(e){let t;const n=i.matchPrefix(e,"a=msid:");if(1===n.length)return t=n[0].substr(7).split(" "),{stream:t[0],track:t[1]};const r=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return r.length>0?(t=r[0].value.split(" "),{stream:t[0],track:t[1]}):void 0},i.parseSctpDescription=function(e){const t=i.parseMLine(e),n=i.matchPrefix(e,"a=max-message-size:");let r;n.length>0&&(r=parseInt(n[0].substr(19),10)),isNaN(r)&&(r=65536);const s=i.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substr(12),10),protocol:t.fmt,maxMessageSize:r};const o=i.matchPrefix(e,"a=sctpmap:");if(o.length>0){const e=o[0].substr(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:r}}},i.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(e,t,n){let r;const s=void 0!==t?t:2;r=e||i.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+r+" "+s+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.getDirection=function(e,t){const n=i.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substr(2)}return t?i.getDirection(t):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substr(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){const t=i.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},i.parseOLine=function(e){const t=i.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const t=i.splitLines(e);for(let e=0;e<t.length;e++)if(t[e].length<2||"="!==t[e].charAt(1))return!1;return!0},e.exports=i},function(e,t,n){"use strict";var i,r="object"==typeof Reflect?Reflect:null,s=r&&"function"==typeof r.apply?r.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};i=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}v(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&v(e,"error",t,n)}(e,r,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function d(e,t,n,i){var r,s,o,a;if(l(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=u(e))>0&&o.length>r&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function p(){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 h(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=p.bind(i);return r.listener=n,i.wrapFn=r,r}function f(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):g(r,r.length)}function m(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function v(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(s){i.once&&e.removeEventListener(t,r),n(s)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.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},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=r[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var l=c.length,u=g(c,l);for(n=0;n<l;++n)s(u[n],this,t)}return!0},a.prototype.addListener=function(e,t){return d(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return d(this,e,t,!0)},a.prototype.once=function(e,t){return l(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,i,r,s,o;if(l(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,n){(function(e,i){var r;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof i&&i;o.global!==o&&o.window!==o&&o.self;var a,c=2147483647,l=/^xn--/,u=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,f=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function v(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+g((e=e.replace(d,".")).split("."),t).join(".")}function b(e){for(var t,n,i=[],r=0,s=e.length;r<s;)(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<s?56320==(64512&(n=e.charCodeAt(r++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),r--):i.push(t);return i}function y(e){return g(e,(function(e){var t="";return e>65535&&(t+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=f(e)})).join("")}function _(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var i=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;i+=36)e=h(e/35);return h(i+36*e/(e+38))}function w(e){var t,n,i,r,s,o,a,l,u,d,p,f=[],g=e.length,v=0,b=128,_=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&m("not-basic"),f.push(e.charCodeAt(i));for(r=n>0?n+1:0;r<g;){for(s=v,o=1,a=36;r>=g&&m("invalid-input"),((l=(p=e.charCodeAt(r++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||l>h((c-v)/o))&&m("overflow"),v+=l*o,!(l<(u=a<=_?1:a>=_+26?26:a-_));a+=36)o>h(c/(d=36-u))&&m("overflow"),o*=d;_=S(v-s,t=f.length+1,0==s),h(v/t)>c-b&&m("overflow"),b+=h(v/t),v%=t,f.splice(v++,0,b)}return y(f)}function T(e){var t,n,i,r,s,o,a,l,u,d,p,g,v,y,w,T=[];for(g=(e=b(e)).length,t=128,n=0,s=72,o=0;o<g;++o)(p=e[o])<128&&T.push(f(p));for(i=r=T.length,r&&T.push("-");i<g;){for(a=c,o=0;o<g;++o)(p=e[o])>=t&&p<a&&(a=p);for(a-t>h((c-n)/(v=i+1))&&m("overflow"),n+=(a-t)*v,t=a,o=0;o<g;++o)if((p=e[o])<t&&++n>c&&m("overflow"),p==t){for(l=n,u=36;!(l<(d=u<=s?1:u>=s+26?26:u-s));u+=36)w=l-d,y=36-d,T.push(f(_(d+w%y,0))),l=h(w/y);T.push(f(_(l,0))),s=S(n,v,i==r),n=0,++i}++n,++t}return T.join("")}a={version:"1.4.1",ucs2:{decode:b,encode:y},decode:w,encode:T,toASCII:function(e){return v(e,(function(e){return u.test(e)?"xn--"+T(e):e}))},toUnicode:function(e){return v(e,(function(e){return l.test(e)?w(e.slice(4).toLowerCase()):e}))}},void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r)}()}).call(this,n(85)(e),n(6))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(t=e.exports=n(51)).Stream=t,t.Readable=t,t.Writable=n(54),t.Duplex=n(15),t.Transform=n(56),t.PassThrough=n(106)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePayloadSize=t.parseJwt=t.retryPromise=t.isVideoJid=t.isSoftphoneJid=t.isScreenRecordingJid=t.isAcdJid=t.splitIntoIndividualTopics=t.timeoutPromise=void 0;const i=n(20),r=n(48);t.timeoutPromise=function(e,t,n,i){return new Promise((function(s,o){const a=setTimeout((function(){const e=new r.TimeoutError("Timeout: "+n);e.details=i,o(e)}),t);e((function(e){clearTimeout(a),s(e)}),o)}))},t.splitIntoIndividualTopics=function(e){const t=[];if(e.includes("?")){const n=e.split("?"),i=n[0],r=n[1]&&n[1].split("&");r&&r.length&&r.forEach(e=>{t.push(`${i}.${e}`)})}else t.push(e);return t};t.isAcdJid=function(e){return e.startsWith("acd-")};t.isScreenRecordingJid=function(e){return e.startsWith("screenrecording-")};t.isSoftphoneJid=function(e){return!!e&&!!e.match(/.*@.*gjoll.*/i)};t.isVideoJid=function(e){return!(!e||!e.match(/@conference/)||t.isAcdJid(e))},t.retryPromise=function(e,t,n=15e3,r=console){let s,o,a,c,l=!1;return{promise:new Promise((i,u)=>{c=async()=>{try{const t=await e();a(t)}catch(e){let i=n;const a=t(e);Number.isInteger(a)&&(i=a),!1!==a?(r.debug("Retrying promise",e),s=setTimeout(c,i)):o(e)}},a=e=>{clearTimeout(s),l=!0,i(e)},o=e=>{clearTimeout(s),l=!0,u(e)},c()}),cancel:o,complete:a,_id:i.v4(),hasCompleted:()=>l}};t.parseJwt=e=>{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(window.atob(t).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));return JSON.parse(n)},t.calculatePayloadSize=function(e){const t=JSON.stringify(e),n=encodeURIComponent(t).match(/%[89ABab]/g);return t.length+(n?n.length:0)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.directionToSenders=t.sendersToDirection=t.JINGLE_INFO_RECEIVED_5=t.JINGLE_INFO_CHECKSUM_5=t.JINGLE_INFO_RINGING=t.JINGLE_INFO_ACTIVE=t.JINGLE_INFO_UNHOLD=t.JINGLE_INFO_HOLD=t.JINGLE_INFO_UNMUTE=t.JINGLE_INFO_MUTE=t.JINGLE_INFO=t.USER_ACTIVITY_SPECIFIC=t.USER_ACTIVITY_GENERAL=t.USER_MOODS=t.JingleReasonCondition=t.JingleErrorCondition=t.JingleAction=t.JingleContentSenders=t.JingleApplicationDirection=t.JingleSessionRole=t.ChatState=t.PubsubErrorCondition=t.MUCStatusCode=t.MUCRole=t.MUCAffiliation=t.DataFormFieldType=t.DataFormType=t.RosterSubscription=t.PresenceShow=t.IQType=t.PresenceType=t.MessageType=t.StanzaErrorCondition=t.StreamErrorCondition=t.SASLFailureCondition=t.StreamType=t.VERSION=void 0;const i=n(13);t.VERSION="12.17.2";t.StreamType={Bosh:i.NS_BOSH,Client:i.NS_CLIENT,Component:i.NS_COMPONENT,Server:i.NS_SERVER},t.SASLFailureCondition={AccountDisabled:"account-disabled",CredentialsExpired:"credentials-expired",EncryptionRequired:"encryption-required",IncorrectEncoding:"incorrect-encoding",InvalidAuthzid:"invalid-authzid",InvalidMechanism:"invalid-mechanism",MalformedRequest:"malformed-request",MechanismTooWeak:"mechanism-too-weak",NotAuthorized:"not-authorized",TemporaryAuthFailure:"temporary-auth-failure"},t.StreamErrorCondition={BadFormat:"bad-format",BadNamespacePrefix:"bad-namespace-prefix",Conflict:"conflict",ConnectionTimeout:"connection-timeout",HostGone:"host-gone",HostUnknown:"host-unknown",ImproperAddressing:"improper-addressing",InternalServerError:"internal-server-error",InvalidFrom:"invalid-from",InvalidId:"invalid-id",InvalidNamespace:"invalid-namespace",InvalidXML:"invalid-xml",NotAuthorized:"not-authorized",NotWellFormed:"not-well-formed",PolicyViolation:"policy-violation",RemoteConnectionFailed:"remote-connection-failed",Reset:"reset",ResourceConstraint:"resource-constraint",RestrictedXML:"restricted-xml",SeeOtherHost:"see-other-host",SystemShutdown:"system-shutdown",UndefinedCondition:"undefined-condition",UnsupportedEncoding:"unsupported-encoding",UnsupportedStanzaType:"unsupported-stanza-type",UnsupportedVersion:"unsupported-version"},t.StanzaErrorCondition={BadRequest:"bad-request",Conflict:"conflict",FeatureNotImplemented:"feature-not-implemented",Forbidden:"forbidden",Gone:"gone",InternalServerError:"internal-server-error",ItemNotFound:"item-not-found",JIDMalformed:"jid-malformed",NotAcceptable:"not-acceptable",NotAllowed:"not-allowed",NotAuthorized:"not-authorized",PolicyViolation:"policy-violation",RecipientUnavailable:"recipient-unavailable",Redirect:"redirect",RegistrationRequired:"registration-required",RemoteServerNotFound:"remote-server-not-found",RemoteServerTimeout:"remote-server-timeout",ResourceConstraint:"resource-constraint",ServiceUnavailable:"service-unavailable",SubscriptionRequired:"subscription-required",UndefinedCondition:"undefined-condition",UnexpectedRequest:"unexpected-request"},t.MessageType={Chat:"chat",Error:"error",GroupChat:"groupchat",Headline:"headline",Normal:"normal"},t.PresenceType={Available:void 0,Error:"error",Probe:"probe",Subscribe:"subscribe",Subscribed:"subscribed",Unavailable:"unavailable",Unsubscribe:"unsubscribe",Unsubscribed:"unsubscribed"},t.IQType={Error:"error",Get:"get",Result:"result",Set:"set"},t.PresenceShow={Away:"away",Chat:"chat",DoNotDisturb:"dnd",ExtendedAway:"xa"},t.RosterSubscription={Both:"both",From:"from",None:"none",ReceivePresenceOnly:"to",Remove:"remove",SendAndReceivePresence:"both",SendPresenceOnly:"from",To:"to"},t.DataFormType={Cancel:"cancel",Form:"form",Result:"result",Submit:"submit"},t.DataFormFieldType={Boolean:"boolean",Fixed:"fixed",Hidden:"hidden",JID:"jid-single",JIDMultiple:"jid-multi",List:"list-single",ListMultiple:"list-multi",Password:"text-private",Text:"text-single",TextMultiple:"text-multi",TextPrivate:"text-private"},t.MUCAffiliation={Admin:"admin",Banned:"outcast",Member:"member",None:"none",Outcast:"outcast",Owner:"owner"},t.MUCRole={Moderator:"moderator",None:"none",Participant:"participant",Visitor:"visitor"},t.MUCStatusCode={AffiliationChanged:"101",AffiliationLost:"321",Banned:"301",Error:"333",Kicked:"307",LoggingDisabled:"171",LoggingEnabled:"170",MembershipLost:"322",NickChanged:"303",NickChangedByService:"210",NonAnonymous:"172",NonAnonymousRoom:"100",NonPrivacyConfigurationChange:"104",RoomCreated:"201",SelfPresence:"110",SemiAnonymous:"173",Shutdown:"332",UnavailableMembersListed:"102",UnavailableMembersNotListed:"103"},t.PubsubErrorCondition={ClosedNode:"closed-node",ConfigurationRequired:"configuration-required",InvalidJID:"invalid-jid",InvalidOptions:"invalid-options",InvalidPayload:"invalid-payload",InvalidSubscriptionId:"invalid-subid",ItemForbidden:"item-forbidden",ItemRequired:"item-required",JIDRequired:"jid-required",MaxItemsExceeded:"max-items-exceeded",MaxNodesExceeded:"max-nodes-exceeded",NodeIdRequired:"nodeid-required",NotInRosterGroup:"not-in-roster-group",NotSubscribed:"not-subscribed",PayloadRequired:"payload-required",PayloadTooBig:"payload-too-big",PendingSubscription:"pending-subscription",PresenceSubscriptionRequired:"presence-subscription-required",SubscriptionIdRequired:"subid-required",TooManySubscriptions:"too-many-subscriptions",Unsupported:"unsupported",UnsupportedAccessModel:"unsupported-access-model"},t.ChatState={Active:"active",Composing:"composing",Gone:"gone",Inactive:"inactive",Paused:"paused"},t.JingleSessionRole={Initiator:"initiator",Responder:"responder"},t.JingleApplicationDirection={Inactive:"inactive",Receive:"recvonly",Send:"sendonly",SendReceive:"sendrecv"},t.JingleContentSenders={Both:"both",Initiator:"initiator",None:"none",Responder:"responder"},t.JingleAction={ContentAccept:"content-accept",ContentAdd:"content-add",ContentModify:"content-modify",ContentReject:"content-reject",ContentRemove:"content-remove",DescriptionInfo:"description-info",SecurityInfo:"security-info",SessionAccept:"session-accept",SessionInfo:"session-info",SessionInitiate:"session-initiate",SessionTerminate:"session-terminate",TransportAccept:"transport-accept",TransportInfo:"transport-info",TransportReject:"transport-reject",TransportReplace:"transport-replace"},t.JingleErrorCondition={OutOfOrder:"out-of-order",TieBreak:"tie-break",UnknownContent:"unknown-content",UnknownSession:"unknown-session",UnsupportedInfo:"unsupported-info"},t.JingleReasonCondition={AlternativeSession:"alternative-session",Busy:"busy",Cancel:"cancel",ConnectivityError:"connectivity-error",Decline:"decline",Expired:"expired",FailedApplication:"failed-application",FailedTransport:"failed-transport",GeneralError:"general-error",Gone:"gone",IncompatibleParameters:"incompatible-parameters",MediaError:"media-error",SecurityError:"security-error",Success:"success",Timeout:"timeout",UnsupportedApplications:"unsupported-applications",UnsupportedTransports:"unsupported-transports"},t.USER_MOODS=["afraid","amazed","amorous","angry","annoyed","anxious","aroused","ashamed","bored","brave","calm","cautious","cold","confident","confused","contemplative","contented","cranky","crazy","creative","curious","dejected","depressed","disappointed","disgusted","dismayed","distracted","embarrassed","envious","excited","flirtatious","frustrated","grateful","grieving","grumpy","guilty","happy","hopeful","hot","humbled","humiliated","hungry","hurt","impressed","in_awe","in_love","indignant","interested","intoxicated","invincible","jealous","lonely","lost","lucky","mean","moody","nervous","neutral","offended","outraged","playful","proud","relaxed","relieved","remorseful","restless","sad","sarcastic","satisfied","serious","shocked","shy","sick","sleepy","spontaneous","stressed","strong","surprised","thankful","thirsty","tired","undefined","weak","worried"],t.USER_ACTIVITY_GENERAL=["doing_chores","drinking","eating","exercising","grooming","having_appointment","inactive","relaxing","talking","traveling","undefined","working"],t.USER_ACTIVITY_SPECIFIC=["at_the_spa","brushing_teeth","buying_groceries","cleaning","coding","commuting","cooking","cycling","cycling","dancing","day_off","doing_maintenance","doing_the_dishes","doing_the_laundry","driving","fishing","gaming","gardening","getting_a_haircut","going_out","hanging_out","having_a_beer","having_a_snack","having_breakfast","having_coffee","having_dinner","having_lunch","having_tea","hiding","hiking","in_a_car","in_a_meeting","in_real_life","jogging","on_a_bus","on_a_plane","on_a_train","on_a_trip","on_the_phone","on_vacation","on_video_phone","other","partying","playing_sports","praying","reading","rehearsing","running","running_an_errand","scheduled_holiday","shaving","shopping","skiing","sleeping","smoking","socializing","studying","sunbathing","swimming","taking_a_bath","taking_a_shower","thinking","walking","walking_the_dog","watching_a_movie","watching_tv","working_out","writing"];t.JINGLE_INFO=(e,t)=>`{${e}}${t}`,t.JINGLE_INFO_MUTE=t.JINGLE_INFO(i.NS_JINGLE_RTP_INFO_1,"mute"),t.JINGLE_INFO_UNMUTE=t.JINGLE_INFO(i.NS_JINGLE_RTP_INFO_1,"unmute"),t.JINGLE_INFO_HOLD=t.JINGLE_INFO(i.NS_JINGLE_RTP_INFO_1,"hold"),t.JINGLE_INFO_UNHOLD=t.JINGLE_INFO(i.NS_JINGLE_RTP_INFO_1,"unhold"),t.JINGLE_INFO_ACTIVE=t.JINGLE_INFO(i.NS_JINGLE_RTP_INFO_1,"active"),t.JINGLE_INFO_RINGING=t.JINGLE_INFO(i.NS_JINGLE_RTP_INFO_1,"ringing"),t.JINGLE_INFO_CHECKSUM_5=t.JINGLE_INFO(i.NS_JINGLE_FILE_TRANSFER_5,"checksum"),t.JINGLE_INFO_RECEIVED_5=t.JINGLE_INFO(i.NS_JINGLE_FILE_TRANSFER_5,"received"),t.sendersToDirection=function(e,n=t.JingleContentSenders.Both){const i=e===t.JingleSessionRole.Initiator;switch(n){case t.JingleContentSenders.Initiator:return i?t.JingleApplicationDirection.Send:t.JingleApplicationDirection.Receive;case t.JingleContentSenders.Responder:return i?t.JingleApplicationDirection.Receive:t.JingleApplicationDirection.Send;case t.JingleContentSenders.Both:return t.JingleApplicationDirection.SendReceive}return t.JingleApplicationDirection.Inactive},t.directionToSenders=function(e,n=t.JingleApplicationDirection.SendReceive){const i=e===t.JingleSessionRole.Initiator;switch(n){case t.JingleApplicationDirection.Send:return i?t.JingleContentSenders.Initiator:t.JingleContentSenders.Responder;case t.JingleApplicationDirection.Receive:return i?t.JingleContentSenders.Responder:t.JingleContentSenders.Initiator;case t.JingleApplicationDirection.SendReceive:return t.JingleContentSenders.Both}return t.JingleContentSenders.None}},function(e,t,n){"use strict";(function(e){var i=n(1),r=n(2),s=n(30);function o(e){return i.a.isPlainObject(e)||i.a.isArray(e)}function a(e){return i.a.endsWith(e,"[]")?e.slice(0,-2):e}function c(e,t,n){return e?e.concat(t).map((function(e,t){return e=a(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const l=i.a.toFlatObject(i.a,{},null,(function(e){return/^is[A-Z]/.test(e)}));t.a=function(t,n,u){if(!i.a.isObject(t))throw new TypeError("target must be an object");n=n||new(s.a||FormData);const d=(u=i.a.toFlatObject(u,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!i.a.isUndefined(t[e])}))).metaTokens,p=u.visitor||v,h=u.dots,f=u.indexes,m=(u.Blob||"undefined"!=typeof Blob&&Blob)&&i.a.isSpecCompliantForm(n);if(!i.a.isFunction(p))throw new TypeError("visitor must be a function");function g(t){if(null===t)return"";if(i.a.isDate(t))return t.toISOString();if(!m&&i.a.isBlob(t))throw new r.a("Blob is not supported. Use a Buffer instead.");return i.a.isArrayBuffer(t)||i.a.isTypedArray(t)?m&&"function"==typeof Blob?new Blob([t]):e.from(t):t}function v(e,t,r){let s=e;if(e&&!r&&"object"==typeof e)if(i.a.endsWith(t,"{}"))t=d?t:t.slice(0,-2),e=JSON.stringify(e);else if(i.a.isArray(e)&&function(e){return i.a.isArray(e)&&!e.some(o)}(e)||(i.a.isFileList(e)||i.a.endsWith(t,"[]"))&&(s=i.a.toArray(e)))return t=a(t),s.forEach((function(e,r){!i.a.isUndefined(e)&&null!==e&&n.append(!0===f?c([t],r,h):null===f?t:t+"[]",g(e))})),!1;return!!o(e)||(n.append(c(r,t,h),g(e)),!1)}const b=[],y=Object.assign(l,{defaultVisitor:v,convertValue:g,isVisitable:o});if(!i.a.isObject(t))throw new TypeError("data must be an object");return function e(t,r){if(!i.a.isUndefined(t)){if(-1!==b.indexOf(t))throw Error("Circular reference detected in "+r.join("."));b.push(t),i.a.forEach(t,(function(t,s){!0===(!(i.a.isUndefined(t)||null===t)&&p.call(n,t,i.a.isString(s)?s.trim():s,r,y))&&e(t,r?r.concat(s):[s])})),b.pop()}}(t),n}}).call(this,n(12).Buffer)},function(e,t){const n=e.exports={};function i(){}n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=i,n.addListener=i,n.once=i,n.off=i,n.removeListener=i,n.removeAllListeners=i,n.emit=i,n.prependListener=i,n.prependOnceListener=i,n.nextTick=(e,...t)=>window.queueMicrotask(()=>e(...t)),n.listeners=e=>[],n.cwd=()=>"/",n.umask=()=>0,n.binding=e=>{throw new Error("process.binding is not supported")},n.chdir=e=>{throw new Error("process.chdir is not supported")}},function(e,t,n){"use strict";(function(e){
|
|
1
|
+
window.GenesysCloudStreamingClient=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=172)}([function(e,t,n){"use strict";(function(e){var i=n(30);const{toString:r}=Object.prototype,{getPrototypeOf:s}=Object,o=(a=Object.create(null),e=>{const t=r.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>o(t)===e),u=e=>t=>typeof t===e,{isArray:l}=Array,d=u("undefined");const p=c("ArrayBuffer");const h=u("string"),f=u("function"),m=u("number"),g=e=>null!==e&&"object"==typeof e,y=e=>{if("object"!==o(e))return!1;const t=s(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},b=c("Date"),_=c("File"),v=c("Blob"),S=c("FileList"),w=c("URLSearchParams");function T(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let i,r;if("object"!=typeof e&&(e=[e]),l(e))for(i=0,r=e.length;i<r;i++)t.call(null,e[i],i,e);else{const r=n?Object.getOwnPropertyNames(e):Object.keys(e),s=r.length;let o;for(i=0;i<s;i++)o=r[i],t.call(null,e[o],o,e)}}function I(e,t){t=t.toLowerCase();const n=Object.keys(e);let i,r=n.length;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:e,A=e=>!d(e)&&e!==N;const E=(x="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>x&&e instanceof x);var x;const R=c("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),O=c("RegExp"),k=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};T(n,(n,r)=>{let s;!1!==(s=t(n,r,e))&&(i[r]=s||n)}),Object.defineProperties(e,i)},P="abcdefghijklmnopqrstuvwxyz",j={DIGIT:"0123456789",ALPHA:P,ALPHA_DIGIT:P+P.toUpperCase()+"0123456789"};const L=c("AsyncFunction");t.a={isArray:l,isArrayBuffer:p,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=o(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t},isString:h,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:g,isPlainObject:y,isUndefined:d,isDate:b,isFile:_,isBlob:v,isRegExp:O,isFunction:f,isStream:e=>g(e)&&f(e.pipe),isURLSearchParams:w,isTypedArray:E,isFileList:S,forEach:T,merge:function e(){const{caseless:t}=A(this)&&this||{},n={},i=(i,r)=>{const s=t&&I(n,r)||r;y(n[s])&&y(i)?n[s]=e(n[s],i):y(i)?n[s]=e({},i):l(i)?n[s]=i.slice():n[s]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&T(arguments[e],i);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(T(t,(t,r)=>{n&&f(t)?e[r]=Object(i.a)(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,i)=>{let r,o,a;const c={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)a=r[o],i&&!i(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&s(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:c,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return-1!==i&&i===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=n.next())&&!i.done;){const n=i.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const i=[];for(;null!==(n=e.exec(t));)i.push(n);return i},isHTMLForm:R,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:k,freezeMethods:e=>{k(e,(t,n)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const i=e[n];f(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},i=e=>{e.forEach(e=>{n[e]=!0})};return l(e)?i(e):i(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:I,global:N,isContextDefined:A,ALPHABET:j,generateString:(e=16,t=j.ALPHA_DIGIT)=>{let n="";const{length:i}=t;for(;e--;)n+=t[Math.random()*i|0];return n},isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,i)=>{if(g(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const r=l(e)?[]:{};return T(e,(e,t)=>{const s=n(e,i+1);!d(s)&&(r[t]=s)}),t[i]=void 0,r}}return e};return n(e,0)},isAsyncFn:L,isThenable:e=>e&&(g(e)||f(e))&&f(e.then)&&f(e.catch)}}).call(this,n(15))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NS_AVATAR_METADATA=t.NS_AVATAR_DATA=t.NS_ROSTER_DELIMITER=t.NS_GEOLOC=t.NS_AMP=t.NS_INBAND_REGISTRATION=t.NS_REGISTER=t.NS_XHTML_IM=t.NS_XHTML=t.NS_HTTP_AUTH=t.NS_OOB_TRANSFER=t.NS_OOB=t.NS_SOCKS5=t.NS_PUBSUB_OWNER=t.NS_PUBSUB_EVENT=t.NS_PUBSUB_ERRORS=t.NS_PUBSUB=t.NS_RSM=t.NS_SEARCH=t.NS_VCARD_TEMP=t.NS_ADHOC_COMMANDS=t.NS_PRIVATE=t.NS_BOOKMARKS=t.NS_IBB=t.NS_MUC_USER=t.NS_MUC_OWNER=t.NS_MUC_ADMIN=t.NS_MUC=t.NS_ADDRESS=t.NS_DISCO_ITEMS=t.NS_DISCO_INFO=t.NS_LEGACY_CHAT_EVENTS=t.NS_PRIVACY=t.NS_LAST_ACTIVITY=t.NS_RPC=t.NS_DATAFORM=t.NS_FRAMING=t.NS_SUBSCRIPTION_PREAPPROVAL=t.NS_ROSTER_VERSIONING=t.NS_ROSTER=t.NS_STARTTLS=t.NS_STREAMS=t.NS_STREAM=t.NS_STANZAS=t.NS_SESSION=t.NS_SERVER=t.NS_SASL=t.NS_CLIENT=t.NS_BIND=t.NS_ATOM=void 0,t.NS_JINGLE_FILE_TRANSFER_4=t.NS_JINGLE_FILE_TRANSFER_3=t.NS_SOFTWARE_INFO=t.NS_BOB=t.NS_ATTENTION_0=t.NS_DATAFORM_MEDIA=t.NS_DISCO_EXTERNAL_2=t.NS_DISCO_EXTERNAL_1=t.NS_BOSH_XMPP=t.NS_DELAY=t.NS_TIME=t.NS_PING=t.NS_SMACKS_3=t.NS_BLOCKING_ERRORS=t.NS_BLOCKING=t.NS_INVISIBLE_0=t.NS_RECEIPTS=t.NS_JINGLE_RAW_UDP_1=t.NS_JINGLE_ICE_UDP_1=t.NS_NICK=t.NS_LANG_TRANS_ITEMS=t.NS_LANG_TRANS=t.NS_JINGLE_RTP_VIDEO=t.NS_JINGLE_RTP_AUDIO=t.NS_JINGLE_RTP_INFO_1=t.NS_JINGLE_RTP_ERRORS_1=t.NS_JINGLE_RTP_1=t.NS_JINGLE_ERRORS_1=t.NS_JINGLE_1=t.NS_PEP_NOTIFY=t.NS_CAPTCHA=t.NS_ALT_CONNECTIONS_XBOSH=t.NS_ALT_CONNECTIONS_WEBSOCKET=t.NS_VCARD_TEMP_UPDATE=t.NS_REACH_0=t.NS_ROSTER_NOTES=t.NS_ROSTER_EXCHANGE=t.NS_DATAFORM_LAYOUT=t.NS_COMPRESSION=t.NS_COMPRESSION_FEATURE=t.NS_SHIM=t.NS_BOSH=t.NS_DATAFORM_VALIDATION=t.NS_TUNE=t.NS_DISCO_LEGACY_CAPS=t.NS_COMPONENT=t.NS_ACTIVITY=t.NS_MOOD=t.NS_VERSION=t.NS_CHAT_STATES=void 0,t.NS_OMEMO_AXOLOTL=t.NS_SPOILER_0=t.NS_EME_0=t.NS_REFERENCE_0=t.NS_JINGLE_ICE_0=t.NS_JINGLE_HTTP_UPLOAD_0=t.NS_JINGLE_HTTP_0=t.NS_HTTP_UPLOAD_0=t.NS_SID_0=t.NS_JINGLE_PUB_1=t.NS_PUSH_0=t.NS_DELEGATION_1=t.NS_JINGLE_MSG_INITIATE_0=t.NS_CSI_0=t.NS_JINGLE_DTLS_SCTP_1=t.NS_JINGLE_RTP_SSMA_0=t.NS_JINGLE_GROUPING_0=t.NS_JSON_0=t.NS_HINTS=t.NS_CHAT_MARKERS_0=t.NS_JINGLE_DTLS_0=t.NS_IDLE_1=t.NS_HATS_0=t.NS_MAM_2=t.NS_MAM_1=t.NS_MAM_0=t.NS_MAM_TMP=t.NS_PSA=t.NS_CORRECTION_0=t.NS_MUC_UNIQUE=t.NS_RTT_0=t.NS_HASH_NAME=t.NS_HASHES_2=t.NS_HASHES_1=t.NS_FORWARD_0=t.NS_JINGLE_RTP_HDREXT_0=t.NS_JINGLE_RTP_RTCP_FB_0=t.NS_CARBONS_2=t.NS_DECLOAKING_0=t.NS_THUMBS_1=t.NS_THUMBS_0=t.NS_JINGLE_RTP_ZRTP_1=t.NS_JINGLE_IBB_1=t.NS_JINGLE_SOCKS5_1=t.NS_SEC_LABEL_ESS_0=t.NS_SEC_LABEL_CATALOG_2=t.NS_SEC_LABEL_0=t.NS_MUC_DIRECT_INVITE=t.NS_JINGLE_XML_0=t.NS_JINGLE_FILE_TRANSFER_5=void 0,t.NS_JINGLE_RTP_MSID_0=t.NS_XRD=t.NS_JSON_MESSAGE_0=t.NS_OMEMO_AXOLOTL_BUNDLE=t.NS_OMEMO_AXOLOTL_BUNDLES=t.NS_OMEMO_AXOLOTL_DEVICELIST=void 0,t.NS_ATOM="http://www.w3.org/2005/Atom",t.NS_BIND="urn:ietf:params:xml:ns:xmpp-bind",t.NS_CLIENT="jabber:client",t.NS_SASL="urn:ietf:params:xml:ns:xmpp-sasl",t.NS_SERVER="jabber:server",t.NS_SESSION="urn:ietf:params:xml:ns:xmpp-session",t.NS_STANZAS="urn:ietf:params:xml:ns:xmpp-stanzas",t.NS_STREAM="http://etherx.jabber.org/streams",t.NS_STREAMS="urn:ietf:params:xml:ns:xmpp-streams",t.NS_STARTTLS="urn:ietf:params:xml:ns:xmpp-tls",t.NS_ROSTER="jabber:iq:roster",t.NS_ROSTER_VERSIONING="urn:xmpp:features:rosterver",t.NS_SUBSCRIPTION_PREAPPROVAL="urn:xmpp:features:pre-approval",t.NS_FRAMING="urn:ietf:params:xml:ns:xmpp-framing",t.NS_DATAFORM="jabber:x:data",t.NS_RPC="jabber:iq:rpc",t.NS_LAST_ACTIVITY="jabber:iq:last",t.NS_PRIVACY="jabber:iq:privacy",t.NS_LEGACY_CHAT_EVENTS="jabber:x:event",t.NS_DISCO_INFO="http://jabber.org/protocol/disco#info",t.NS_DISCO_ITEMS="http://jabber.org/protocol/disco#items",t.NS_ADDRESS="http://jabber.org/protocol/address",t.NS_MUC="http://jabber.org/protocol/muc",t.NS_MUC_ADMIN="http://jabber.org/protocol/muc#admin",t.NS_MUC_OWNER="http://jabber.org/protocol/muc#owner",t.NS_MUC_USER="http://jabber.org/protocol/muc#user",t.NS_IBB="http://jabber.org/protocol/ibb",t.NS_BOOKMARKS="storage:bookmarks",t.NS_PRIVATE="jabber:iq:private",t.NS_ADHOC_COMMANDS="http://jabber.org/protocol/commands",t.NS_VCARD_TEMP="vcard-temp",t.NS_SEARCH="jabber:iq:search",t.NS_RSM="http://jabber.org/protocol/rsm",t.NS_PUBSUB="http://jabber.org/protocol/pubsub",t.NS_PUBSUB_ERRORS="http://jabber.org/protocol/pubsub#errors",t.NS_PUBSUB_EVENT="http://jabber.org/protocol/pubsub#event",t.NS_PUBSUB_OWNER="http://jabber.org/protocol/pubsub#owner",t.NS_SOCKS5="http://jabber.org/protocol/bytestreams",t.NS_OOB="jabber:x:oob",t.NS_OOB_TRANSFER="jabber:iq:oob",t.NS_HTTP_AUTH="http://jabber.org/protocol/http-auth",t.NS_XHTML="http://www.w3.org/1999/xhtml",t.NS_XHTML_IM="http://jabber.org/protocol/xhtml-im",t.NS_REGISTER="jabber:iq:register",t.NS_INBAND_REGISTRATION="http://jabber.org/features/iq-register",t.NS_AMP="http://jabber.org/protocol/amp",t.NS_GEOLOC="http://jabber.org/protocol/geoloc",t.NS_ROSTER_DELIMITER="roster:delimiter",t.NS_AVATAR_DATA="urn:xmpp:avatar:data",t.NS_AVATAR_METADATA="urn:xmpp:avatar:metadata",t.NS_CHAT_STATES="http://jabber.org/protocol/chatstates",t.NS_VERSION="jabber:iq:version",t.NS_MOOD="http://jabber.org/protocol/mood",t.NS_ACTIVITY="http://jabber.org/protocol/activity",t.NS_COMPONENT="jabber:component:accept",t.NS_DISCO_LEGACY_CAPS="http://jabber.org/protocol/caps",t.NS_TUNE="http://jabber.org/protocol/tune",t.NS_DATAFORM_VALIDATION="http://jabber.org/protocol/xdata-validate",t.NS_BOSH="http://jabber.org/protocol/httpbind",t.NS_SHIM="http://jabber.org/protocol/shim",t.NS_COMPRESSION_FEATURE="http://jabber.org/features/compress",t.NS_COMPRESSION="http://jabber.org/protocol/compress",t.NS_DATAFORM_LAYOUT="http://jabber.org/protocol/xdata-layout",t.NS_ROSTER_EXCHANGE="http://jabber.org/protocol/rosterx",t.NS_ROSTER_NOTES="storage:rosternotes",t.NS_REACH_0="urn:xmpp:reach:0",t.NS_VCARD_TEMP_UPDATE="vcard-temp:x:update",t.NS_ALT_CONNECTIONS_WEBSOCKET="urn:xmpp:alt-connections:websocket",t.NS_ALT_CONNECTIONS_XBOSH="urn:xmpp:alt-connections:xbosh",t.NS_CAPTCHA="urn:xmpp:captcha";t.NS_PEP_NOTIFY=e=>e+"+notify",t.NS_JINGLE_1="urn:xmpp:jingle:1",t.NS_JINGLE_ERRORS_1="urn:xmpp:jingle:errors:1",t.NS_JINGLE_RTP_1="urn:xmpp:jingle:apps:rtp:1",t.NS_JINGLE_RTP_ERRORS_1="urn:xmpp:jingle:apps:rtp:errors:1",t.NS_JINGLE_RTP_INFO_1="urn:xmpp:jingle:apps:rtp:info:1",t.NS_JINGLE_RTP_AUDIO="urn:xmpp:jingle:apps:rtp:audio",t.NS_JINGLE_RTP_VIDEO="urn:xmpp:jingle:apps:rtp:video",t.NS_LANG_TRANS="urn:xmpp:langtrans",t.NS_LANG_TRANS_ITEMS="urn:xmpp:langtrans:items",t.NS_NICK="http://jabber.org/protocol/nick",t.NS_JINGLE_ICE_UDP_1="urn:xmpp:jingle:transports:ice-udp:1",t.NS_JINGLE_RAW_UDP_1="urn:xmpp:jingle:transports:raw-udp:1",t.NS_RECEIPTS="urn:xmpp:receipts",t.NS_INVISIBLE_0="urn:xmpp:invisible:0",t.NS_BLOCKING="urn:xmpp:blocking",t.NS_BLOCKING_ERRORS="urn:xmpp:blocking:errors",t.NS_SMACKS_3="urn:xmpp:sm:3",t.NS_PING="urn:xmpp:ping",t.NS_TIME="urn:xmpp:time",t.NS_DELAY="urn:xmpp:delay",t.NS_BOSH_XMPP="urn:xmpp:xbosh",t.NS_DISCO_EXTERNAL_1="urn:xmpp:extdisco:1",t.NS_DISCO_EXTERNAL_2="urn:xmpp:extdisco:2",t.NS_DATAFORM_MEDIA="urn:xmpp:media-element",t.NS_ATTENTION_0="urn:xmpp:attention:0",t.NS_BOB="urn:xmpp:bob",t.NS_SOFTWARE_INFO="urn:xmpp:dataforms:softwareinfo",t.NS_JINGLE_FILE_TRANSFER_3="urn:xmpp:jingle:apps:file-transfer:3",t.NS_JINGLE_FILE_TRANSFER_4="urn:xmpp:jingle:apps:file-transfer:4",t.NS_JINGLE_FILE_TRANSFER_5="urn:xmpp:jingle:apps:file-transfer:5",t.NS_JINGLE_XML_0="urn:xmpp:jingle:apps:xmlstream:0",t.NS_MUC_DIRECT_INVITE="jabber:x:conference",t.NS_SEC_LABEL_0="urn:xmpp:sec-label:0",t.NS_SEC_LABEL_CATALOG_2="urn:xmpp:sec-label:catalog:2",t.NS_SEC_LABEL_ESS_0="urn:xmpp:sec-label:ess:0",t.NS_JINGLE_SOCKS5_1="urn:xmpp:jingle:transports:s5b:1",t.NS_JINGLE_IBB_1="urn:xmpp:jingle:transports:ibb:1",t.NS_JINGLE_RTP_ZRTP_1="urn:xmpp:jingle:apps:rtp:zrtp:1",t.NS_THUMBS_0="urn:xmpp:thumbs:0",t.NS_THUMBS_1="urn:xmpp:thumbs:1",t.NS_DECLOAKING_0="urn:xmpp:decloaking:0",t.NS_CARBONS_2="urn:xmpp:carbons:2",t.NS_JINGLE_RTP_RTCP_FB_0="urn:xmpp:jingle:apps:rtp:rtcp-fb:0",t.NS_JINGLE_RTP_HDREXT_0="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",t.NS_FORWARD_0="urn:xmpp:forward:0",t.NS_HASHES_1="urn:xmpp:hashes:1",t.NS_HASHES_2="urn:xmpp:hashes:2";t.NS_HASH_NAME=e=>"urn:xmpp:hash-function-text-names:"+e,t.NS_RTT_0="urn:xmpp:rtt:0",t.NS_MUC_UNIQUE="http://jabber.org/protocol/muc#unique",t.NS_CORRECTION_0="urn:xmpp:message-correct:0",t.NS_PSA="urn:xmpp:psa",t.NS_MAM_TMP="urn:xmpp:mam:tmp",t.NS_MAM_0="urn:xmpp:mam:0",t.NS_MAM_1="urn:xmpp:mam:1",t.NS_MAM_2="urn:xmpp:mam:2",t.NS_HATS_0="urn:xmpp:hats:0",t.NS_IDLE_1="urn:xmpp:idle:1",t.NS_JINGLE_DTLS_0="urn:xmpp:jingle:apps:dtls:0",t.NS_CHAT_MARKERS_0="urn:xmpp:chat-markers:0",t.NS_HINTS="urn:xmpp:hints",t.NS_JSON_0="urn:xmpp:json:0",t.NS_JINGLE_GROUPING_0="urn:xmpp:jingle:apps:grouping:0",t.NS_JINGLE_RTP_SSMA_0="urn:xmpp:jingle:apps:rtp:ssma:0",t.NS_JINGLE_DTLS_SCTP_1="urn:xmpp:jingle:transports:dtls-sctp:1",t.NS_CSI_0="urn:xmpp:csi:0",t.NS_JINGLE_MSG_INITIATE_0="urn:xmpp:jingle:jingle-message:0",t.NS_DELEGATION_1="urn:xmpp:delegation:1",t.NS_PUSH_0="urn:xmpp:push:0",t.NS_JINGLE_PUB_1="urn:xmpp:jinglepub:1",t.NS_SID_0="urn:xmpp:sid:0",t.NS_HTTP_UPLOAD_0="urn:xmpp:http:upload:0",t.NS_JINGLE_HTTP_0="urn:xmpp:jingle:transports:http:0",t.NS_JINGLE_HTTP_UPLOAD_0="urn:xmpp:jingle:transports:http:upload:0",t.NS_JINGLE_ICE_0="urn:xmpp:jingle:transports:ice:0",t.NS_REFERENCE_0="urn:xmpp:reference:0",t.NS_EME_0="urn:xmpp:eme:0",t.NS_SPOILER_0="urn:xmpp:spoiler:0",t.NS_OMEMO_AXOLOTL="eu.siacs.conversations.axolotl",t.NS_OMEMO_AXOLOTL_DEVICELIST="eu.siacs.conversations.axolotl.devicelist",t.NS_OMEMO_AXOLOTL_BUNDLES="eu.siacs.conversations.axolotl.bundles";t.NS_OMEMO_AXOLOTL_BUNDLE=e=>`${t.NS_OMEMO_AXOLOTL_BUNDLES}:${e}`,t.NS_JSON_MESSAGE_0="urn:xmpp:json-msg:0",t.NS_XRD="http://docs.oasis-open.org/ns/xri/xrd-1.0",t.NS_JINGLE_RTP_MSID_0="urn:xmpp:jingle:apps:rtp:msid:0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.define=t.XMLElement=t.Translator=t.Registry=t.StreamParser=t.parse=t.Parser=void 0;const i=n(3),r=(0,i.__importDefault)(n(23));t.XMLElement=r.default;const s=(0,i.__importDefault)(n(199));t.Registry=s.default;const o=(0,i.__importDefault)(n(55));t.Translator=o.default,(0,i.__exportStar)(n(24),t),(0,i.__exportStar)(n(35),t),(0,i.__exportStar)(n(210),t);var a=n(37);Object.defineProperty(t,"Parser",{enumerable:!0,get:function(){return(0,i.__importDefault)(a).default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return a.parse}});var c=n(211);Object.defineProperty(t,"StreamParser",{enumerable:!0,get:function(){return(0,i.__importDefault)(c).default}}),t.define=function(e){return t=>{t.define(e)}}},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return r})),n.d(t,"__assign",(function(){return s})),n.d(t,"__rest",(function(){return o})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return c})),n.d(t,"__esDecorate",(function(){return u})),n.d(t,"__runInitializers",(function(){return l})),n.d(t,"__propKey",(function(){return d})),n.d(t,"__setFunctionName",(function(){return p})),n.d(t,"__metadata",(function(){return h})),n.d(t,"__awaiter",(function(){return f})),n.d(t,"__generator",(function(){return m})),n.d(t,"__createBinding",(function(){return g})),n.d(t,"__exportStar",(function(){return y})),n.d(t,"__values",(function(){return b})),n.d(t,"__read",(function(){return _})),n.d(t,"__spread",(function(){return v})),n.d(t,"__spreadArrays",(function(){return S})),n.d(t,"__spreadArray",(function(){return w})),n.d(t,"__await",(function(){return T})),n.d(t,"__asyncGenerator",(function(){return I})),n.d(t,"__asyncDelegator",(function(){return N})),n.d(t,"__asyncValues",(function(){return A})),n.d(t,"__makeTemplateObject",(function(){return E})),n.d(t,"__importStar",(function(){return R})),n.d(t,"__importDefault",(function(){return C})),n.d(t,"__classPrivateFieldGet",(function(){return O})),n.d(t,"__classPrivateFieldSet",(function(){return k})),n.d(t,"__classPrivateFieldIn",(function(){return P})),n.d(t,"__addDisposableResource",(function(){return j})),n.d(t,"__disposeResources",(function(){return M}));var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function o(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}function c(e,t){return function(n,i){t(n,i,e)}}function u(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=i.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?i.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,i.name):{}),p=!1,h=n.length-1;h>=0;h--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var g=(0,n[h])("accessor"===c?{get:d.get,set:d.set}:d[u],f);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(d.get=a),(a=o(g.set))&&(d.set=a),(a=o(g.init))&&r.unshift(a)}else(a=o(g))&&("field"===c?r.unshift(a):d[u]=a)}l&&Object.defineProperty(l,i.name,d),p=!0}function l(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function p(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function m(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var g=Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function y(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||g(t,e,n)}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(_(arguments[t]));return e}function S(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i}function w(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function T(e){return this instanceof T?(this.v=e,this):new T(e)}function I(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof T?Promise.resolve(n.value.v).then(c,u):l(s[0][2],n)}catch(e){l(s[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function N(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:T(e[i](t)),done:!1}:r?r(t):t}:r}}function A(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=b(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var x=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function R(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&g(t,e,n);return x(t,e),t}function C(e){return e&&e.__esModule?e:{default:e}}function O(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function k(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}function P(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function j(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t}var L="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i};function M(e){function t(t){e.error=e.hasError?new L(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var i=e.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}t.default={__extends:r,__assign:s,__rest:o,__decorate:a,__param:c,__metadata:h,__awaiter:f,__generator:m,__createBinding:g,__exportStar:y,__values:b,__read:_,__spread:v,__spreadArrays:S,__spreadArray:w,__await:T,__asyncGenerator:I,__asyncDelegator:N,__asyncValues:A,__makeTemplateObject:E,__importStar:R,__importDefault:C,__classPrivateFieldGet:O,__classPrivateFieldSet:k,__classPrivateFieldIn:P,__addDisposableResource:j,__disposeResources:M}},function(e,t,n){"use strict";var i=n(0);function r(e,t,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r)}i.a.inherits(r,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:i.a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const s=r.prototype,o={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{o[e]={value:e}}),Object.defineProperties(r,o),Object.defineProperty(s,"isAxiosError",{value:!0}),r.from=(e,t,n,o,a,c)=>{const u=Object.create(s);return i.a.toFlatObject(e,u,(function(e){return e!==Error.prototype}),e=>"isAxiosError"!==e),r.call(u,e.message,t,n,o,a),u.cause=e,u.name=e.name,c&&Object.assign(u,c),u},t.a=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.directionToSenders=t.sendersToDirection=t.JINGLE_INFO_RECEIVED_5=t.JINGLE_INFO_CHECKSUM_5=t.JINGLE_INFO_RINGING=t.JINGLE_INFO_ACTIVE=t.JINGLE_INFO_UNHOLD=t.JINGLE_INFO_HOLD=t.JINGLE_INFO_UNMUTE=t.JINGLE_INFO_MUTE=t.JINGLE_INFO=t.USER_ACTIVITY_SPECIFIC=t.USER_ACTIVITY_GENERAL=t.USER_MOODS=t.JingleReasonCondition=t.JingleErrorCondition=t.JingleAction=t.JingleContentSenders=t.JingleApplicationDirection=t.JingleSessionRole=t.ChatState=t.PubsubErrorCondition=t.MUCStatusCode=t.MUCRole=t.MUCAffiliation=t.DataFormFieldType=t.DataFormType=t.RosterSubscription=t.PresenceShow=t.IQType=t.PresenceType=t.MessageType=t.StanzaErrorCondition=t.StreamErrorCondition=t.SASLFailureCondition=t.StreamType=t.VERSION=void 0;const i=n(1);t.VERSION="12.20.0";t.StreamType={Bosh:i.NS_BOSH,Client:i.NS_CLIENT,Component:i.NS_COMPONENT,Server:i.NS_SERVER},t.SASLFailureCondition={AccountDisabled:"account-disabled",CredentialsExpired:"credentials-expired",EncryptionRequired:"encryption-required",IncorrectEncoding:"incorrect-encoding",InvalidAuthzid:"invalid-authzid",InvalidMechanism:"invalid-mechanism",MalformedRequest:"malformed-request",MechanismTooWeak:"mechanism-too-weak",NotAuthorized:"not-authorized",TemporaryAuthFailure:"temporary-auth-failure"},t.StreamErrorCondition={BadFormat:"bad-format",BadNamespacePrefix:"bad-namespace-prefix",Conflict:"conflict",ConnectionTimeout:"connection-timeout",HostGone:"host-gone",HostUnknown:"host-unknown",ImproperAddressing:"improper-addressing",InternalServerError:"internal-server-error",InvalidFrom:"invalid-from",InvalidId:"invalid-id",InvalidNamespace:"invalid-namespace",InvalidXML:"invalid-xml",NotAuthorized:"not-authorized",NotWellFormed:"not-well-formed",PolicyViolation:"policy-violation",RemoteConnectionFailed:"remote-connection-failed",Reset:"reset",ResourceConstraint:"resource-constraint",RestrictedXML:"restricted-xml",SeeOtherHost:"see-other-host",SystemShutdown:"system-shutdown",UndefinedCondition:"undefined-condition",UnsupportedEncoding:"unsupported-encoding",UnsupportedStanzaType:"unsupported-stanza-type",UnsupportedVersion:"unsupported-version"},t.StanzaErrorCondition={BadRequest:"bad-request",Conflict:"conflict",FeatureNotImplemented:"feature-not-implemented",Forbidden:"forbidden",Gone:"gone",InternalServerError:"internal-server-error",ItemNotFound:"item-not-found",JIDMalformed:"jid-malformed",NotAcceptable:"not-acceptable",NotAllowed:"not-allowed",NotAuthorized:"not-authorized",PolicyViolation:"policy-violation",RecipientUnavailable:"recipient-unavailable",Redirect:"redirect",RegistrationRequired:"registration-required",RemoteServerNotFound:"remote-server-not-found",RemoteServerTimeout:"remote-server-timeout",ResourceConstraint:"resource-constraint",ServiceUnavailable:"service-unavailable",SubscriptionRequired:"subscription-required",UndefinedCondition:"undefined-condition",UnexpectedRequest:"unexpected-request"},t.MessageType={Chat:"chat",Error:"error",GroupChat:"groupchat",Headline:"headline",Normal:"normal"},t.PresenceType={Available:void 0,Error:"error",Probe:"probe",Subscribe:"subscribe",Subscribed:"subscribed",Unavailable:"unavailable",Unsubscribe:"unsubscribe",Unsubscribed:"unsubscribed"},t.IQType={Error:"error",Get:"get",Result:"result",Set:"set"},t.PresenceShow={Away:"away",Chat:"chat",DoNotDisturb:"dnd",ExtendedAway:"xa"},t.RosterSubscription={Both:"both",From:"from",None:"none",ReceivePresenceOnly:"to",Remove:"remove",SendAndReceivePresence:"both",SendPresenceOnly:"from",To:"to"},t.DataFormType={Cancel:"cancel",Form:"form",Result:"result",Submit:"submit"},t.DataFormFieldType={Boolean:"boolean",Fixed:"fixed",Hidden:"hidden",JID:"jid-single",JIDMultiple:"jid-multi",List:"list-single",ListMultiple:"list-multi",Password:"text-private",Text:"text-single",TextMultiple:"text-multi",TextPrivate:"text-private"},t.MUCAffiliation={Admin:"admin",Banned:"outcast",Member:"member",None:"none",Outcast:"outcast",Owner:"owner"},t.MUCRole={Moderator:"moderator",None:"none",Participant:"participant",Visitor:"visitor"},t.MUCStatusCode={AffiliationChanged:"101",AffiliationLost:"321",Banned:"301",Error:"333",Kicked:"307",LoggingDisabled:"171",LoggingEnabled:"170",MembershipLost:"322",NickChanged:"303",NickChangedByService:"210",NonAnonymous:"172",NonAnonymousRoom:"100",NonPrivacyConfigurationChange:"104",RoomCreated:"201",SelfPresence:"110",SemiAnonymous:"173",Shutdown:"332",UnavailableMembersListed:"102",UnavailableMembersNotListed:"103"},t.PubsubErrorCondition={ClosedNode:"closed-node",ConfigurationRequired:"configuration-required",InvalidJID:"invalid-jid",InvalidOptions:"invalid-options",InvalidPayload:"invalid-payload",InvalidSubscriptionId:"invalid-subid",ItemForbidden:"item-forbidden",ItemRequired:"item-required",JIDRequired:"jid-required",MaxItemsExceeded:"max-items-exceeded",MaxNodesExceeded:"max-nodes-exceeded",NodeIdRequired:"nodeid-required",NotInRosterGroup:"not-in-roster-group",NotSubscribed:"not-subscribed",PayloadRequired:"payload-required",PayloadTooBig:"payload-too-big",PendingSubscription:"pending-subscription",PresenceSubscriptionRequired:"presence-subscription-required",SubscriptionIdRequired:"subid-required",TooManySubscriptions:"too-many-subscriptions",Unsupported:"unsupported",UnsupportedAccessModel:"unsupported-access-model"},t.ChatState={Active:"active",Composing:"composing",Gone:"gone",Inactive:"inactive",Paused:"paused"},t.JingleSessionRole={Initiator:"initiator",Responder:"responder"},t.JingleApplicationDirection={Inactive:"inactive",Receive:"recvonly",Send:"sendonly",SendReceive:"sendrecv"},t.JingleContentSenders={Both:"both",Initiator:"initiator",None:"none",Responder:"responder"},t.JingleAction={ContentAccept:"content-accept",ContentAdd:"content-add",ContentModify:"content-modify",ContentReject:"content-reject",ContentRemove:"content-remove",DescriptionInfo:"description-info",SecurityInfo:"security-info",SessionAccept:"session-accept",SessionInfo:"session-info",SessionInitiate:"session-initiate",SessionTerminate:"session-terminate",TransportAccept:"transport-accept",TransportInfo:"transport-info",TransportReject:"transport-reject",TransportReplace:"transport-replace"},t.JingleErrorCondition={OutOfOrder:"out-of-order",TieBreak:"tie-break",UnknownContent:"unknown-content",UnknownSession:"unknown-session",UnsupportedInfo:"unsupported-info"},t.JingleReasonCondition={AlternativeSession:"alternative-session",Busy:"busy",Cancel:"cancel",ConnectivityError:"connectivity-error",Decline:"decline",Expired:"expired",FailedApplication:"failed-application",FailedTransport:"failed-transport",GeneralError:"general-error",Gone:"gone",IncompatibleParameters:"incompatible-parameters",MediaError:"media-error",SecurityError:"security-error",Success:"success",Timeout:"timeout",UnsupportedApplications:"unsupported-applications",UnsupportedTransports:"unsupported-transports"},t.USER_MOODS=["afraid","amazed","amorous","angry","annoyed","anxious","aroused","ashamed","bored","brave","calm","cautious","cold","confident","confused","contemplative","contented","cranky","crazy","creative","curious","dejected","depressed","disappointed","disgusted","dismayed","distracted","embarrassed","envious","excited","flirtatious","frustrated","grateful","grieving","grumpy","guilty","happy","hopeful","hot","humbled","humiliated","hungry","hurt","impressed","in_awe","in_love","indignant","interested","intoxicated","invincible","jealous","lonely","lost","lucky","mean","moody","nervous","neutral","offended","outraged","playful","proud","relaxed","relieved","remorseful","restless","sad","sarcastic","satisfied","serious","shocked","shy","sick","sleepy","spontaneous","stressed","strong","surprised","thankful","thirsty","tired","undefined","weak","worried"],t.USER_ACTIVITY_GENERAL=["doing_chores","drinking","eating","exercising","grooming","having_appointment","inactive","relaxing","talking","traveling","undefined","working"],t.USER_ACTIVITY_SPECIFIC=["at_the_spa","brushing_teeth","buying_groceries","cleaning","coding","commuting","cooking","cycling","cycling","dancing","day_off","doing_maintenance","doing_the_dishes","doing_the_laundry","driving","fishing","gaming","gardening","getting_a_haircut","going_out","hanging_out","having_a_beer","having_a_snack","having_breakfast","having_coffee","having_dinner","having_lunch","having_tea","hiding","hiking","in_a_car","in_a_meeting","in_real_life","jogging","on_a_bus","on_a_plane","on_a_train","on_a_trip","on_the_phone","on_vacation","on_video_phone","other","partying","playing_sports","praying","reading","rehearsing","running","running_an_errand","scheduled_holiday","shaving","shopping","skiing","sleeping","smoking","socializing","studying","sunbathing","swimming","taking_a_bath","taking_a_shower","thinking","walking","walking_the_dog","watching_a_movie","watching_tv","working_out","writing"];t.JINGLE_INFO=(e,t)=>`{${e}}${t}`,t.JINGLE_INFO_MUTE=(0,t.JINGLE_INFO)(i.NS_JINGLE_RTP_INFO_1,"mute"),t.JINGLE_INFO_UNMUTE=(0,t.JINGLE_INFO)(i.NS_JINGLE_RTP_INFO_1,"unmute"),t.JINGLE_INFO_HOLD=(0,t.JINGLE_INFO)(i.NS_JINGLE_RTP_INFO_1,"hold"),t.JINGLE_INFO_UNHOLD=(0,t.JINGLE_INFO)(i.NS_JINGLE_RTP_INFO_1,"unhold"),t.JINGLE_INFO_ACTIVE=(0,t.JINGLE_INFO)(i.NS_JINGLE_RTP_INFO_1,"active"),t.JINGLE_INFO_RINGING=(0,t.JINGLE_INFO)(i.NS_JINGLE_RTP_INFO_1,"ringing"),t.JINGLE_INFO_CHECKSUM_5=(0,t.JINGLE_INFO)(i.NS_JINGLE_FILE_TRANSFER_5,"checksum"),t.JINGLE_INFO_RECEIVED_5=(0,t.JINGLE_INFO)(i.NS_JINGLE_FILE_TRANSFER_5,"received"),t.sendersToDirection=function(e,n=t.JingleContentSenders.Both){const i=e===t.JingleSessionRole.Initiator;switch(n){case t.JingleContentSenders.Initiator:return i?t.JingleApplicationDirection.Send:t.JingleApplicationDirection.Receive;case t.JingleContentSenders.Responder:return i?t.JingleApplicationDirection.Receive:t.JingleApplicationDirection.Send;case t.JingleContentSenders.Both:return t.JingleApplicationDirection.SendReceive}return t.JingleApplicationDirection.Inactive},t.directionToSenders=function(e,n=t.JingleApplicationDirection.SendReceive){const i=e===t.JingleSessionRole.Initiator;switch(n){case t.JingleApplicationDirection.Send:return i?t.JingleContentSenders.Initiator:t.JingleContentSenders.Responder;case t.JingleApplicationDirection.Receive:return i?t.JingleContentSenders.Responder:t.JingleContentSenders.Initiator;case t.JingleApplicationDirection.SendReceive:return t.JingleContentSenders.Both}return t.JingleContentSenders.None}},function(e,t,n){"use strict";var i,r="object"==typeof Reflect?Reflect:null,s=r&&"function"==typeof r.apply?r.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};i=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(e,"error",t,n)}(e,r,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function d(e,t,n,i){var r,s,o,a;if(u(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=l(e))>0&&o.length>r&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function p(){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 h(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=p.bind(i);return r.listener=n,i.wrapFn=r,r}function f(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):g(r,r.length)}function m(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function y(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(s){i.once&&e.removeEventListener(t,r),n(s)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.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},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=r[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var u=c.length,l=g(c,u);for(n=0;n<u;++n)s(l[n],this,t)}return!0},a.prototype.addListener=function(e,t){return d(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return d(this,e,t,!0)},a.prototype.once=function(e,t){return u(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,i,r,s,o;if(u(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PassThrough=t.Duplex=t.Transform=t.Writable=t.Readable=t.WebSocket=t.RTCPeerConnection=t.fetch=t.Hmac=t.Hash=t.createHash=t.Buffer=t.name=t.createResolver=t.createHmac=t.getHashes=t.randomBytes=void 0;const i=n(3),r=n(9);Object.defineProperty(t,"Buffer",{enumerable:!0,get:function(){return r.Buffer}});const s=(0,i.__importStar)(n(56));t.createHash=s.default,Object.defineProperty(t,"Hash",{enumerable:!0,get:function(){return s.Hash}});const o=(0,i.__importDefault)(n(209));t.Hmac=o.default;const a=n(36);Object.defineProperty(t,"Readable",{enumerable:!0,get:function(){return a.Readable}}),Object.defineProperty(t,"Writable",{enumerable:!0,get:function(){return a.Writable}}),Object.defineProperty(t,"Transform",{enumerable:!0,get:function(){return a.Transform}}),Object.defineProperty(t,"PassThrough",{enumerable:!0,get:function(){return a.PassThrough}}),Object.defineProperty(t,"Duplex",{enumerable:!0,get:function(){return a.Duplex}}),t.randomBytes=function(e){const t=new Uint8Array(e);return e>0&&(globalThis.crypto||globalThis.msCrypto).getRandomValues(t),r.Buffer.from(t.buffer)},t.getHashes=function(){return["sha-1","sha-256","sha-512","md5"]},t.createHmac=function(e,t){return new o.default(e.toLowerCase(),t)},t.createResolver=function(){};const c=globalThis.fetch.bind(globalThis);t.fetch=c;const u=globalThis.WebSocket;t.WebSocket=u;const l=globalThis.RTCPeerConnection;t.RTCPeerConnection=l,t.name="browser"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toURI=t.parseURI=t.toBare=t.getResource=t.getDomain=t.getLocal=t.isBare=t.isFull=t.equalBare=t.equal=t.allowedResponders=t.parse=t.createFull=t.create=t.prepare=t.unescapeLocal=t.escapeLocal=void 0;const i=(0,n(3).__importDefault)(n(33)),r=n(54);function s(e=""){return e.replace(/^\s+|\s+$/g,"").replace(/\\5c/g,"\\5c5c").replace(/\\20/g,"\\5c20").replace(/\\22/g,"\\5c22").replace(/\\26/g,"\\5c26").replace(/\\27/g,"\\5c27").replace(/\\2f/g,"\\5c2f").replace(/\\3a/g,"\\5c3a").replace(/\\3c/g,"\\5c3c").replace(/\\3e/g,"\\5c3e").replace(/\\40/g,"\\5c40").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")}function o(e){return e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")}function a(e){let t=e.local||"",n=e.domain,s=e.resource||"";return t&&(t=(0,r.nodeprep)(t)),s&&(s=(0,r.resourceprep)(s)),"."===n[n.length-1]&&(n=n.slice(0,n.length-1)),n=(0,r.nameprep)(n.split(".").map(i.default.toUnicode).join(".")),{domain:n,local:t,resource:s}}function c(e,t={}){let n=e.local;t.escaped||(n=s(e.local));const i=t.prepared?e:a({local:n,domain:e.domain,resource:e.resource}),r=n?`${n}@${i.domain}`:i.domain;return i.resource?`${r}/${i.resource}`:r}function u(e=""){let t="",n="",i="";const r=e.indexOf("/");r>0&&(i=e.slice(r+1),e=e.slice(0,r));const s=e.indexOf("@");s>0&&(t=e.slice(0,s),e=e.slice(s+1)),n=e;const u=a({domain:n,local:t,resource:i});return{bare:c({local:u.local,domain:u.domain},{escaped:!0,prepared:!0}),domain:u.domain,full:c(u,{escaped:!0,prepared:!0}),local:o(u.local),resource:u.resource}}function l(e){return!!u(e).resource}function d(e=""){return u(e).bare}t.escapeLocal=s,t.unescapeLocal=o,t.prepare=a,t.create=c,t.createFull=function(e,t){return t?`${d(e)}/${t}`:d(e)},t.parse=u,t.allowedResponders=function(e,t){const n=new Set;if(n.add(void 0),n.add(""),e){const t=u(e);n.add(t.full),n.add(t.bare),n.add(t.domain)}if(t){const e=u(t);n.add(e.domain),n.add(e.bare),n.add(e.full)}return n},t.equal=function(e,t){if(!e||!t)return!1;const n=u(e),i=u(t);return n.local===i.local&&n.domain===i.domain&&n.resource===i.resource},t.equalBare=function(e,t){if(!e||!t)return!1;const n=u(e),i=u(t);return n.local===i.local&&n.domain===i.domain},t.isFull=l,t.isBare=function(e){return!l(e)},t.getLocal=function(e=""){return u(e).local},t.getDomain=function(e=""){return u(e).domain},t.getResource=function(e=""){return u(e).resource},t.toBare=d,t.parseURI=function(e){const t=new URL(e);if("xmpp:"!==t.protocol)throw new Error("Invalid XMPP URI, wrong protocol: "+t.protocol);const n=t.hostname?t.username?c({domain:decodeURIComponent(t.hostname),local:decodeURIComponent(t.username)},{escaped:!0}):decodeURIComponent(t.hostname):void 0,i=u(decodeURIComponent(n?t.pathname.substr(1):t.pathname)).full,r=t.search&&t.search.indexOf(";")>=1,s=r?t.search.substr(t.search.indexOf(";")+1):"",o=t.search?decodeURIComponent(t.search.substr(1,r?t.search.indexOf(";")-1:void 0)):void 0,a={};for(const e of s.split(";")){const[t,n]=e.split("=").map(decodeURIComponent);if(a[t]){const e=a[t];Array.isArray(e)?e.push(n):a[t]=[e,n]}else a[t]=n}return{action:o,identity:n,jid:i,parameters:a}},t.toURI=function(e){const t=["xmpp:"],n=(e,n)=>{const i=u(e);i.local&&(t.push(encodeURIComponent(s(i.local))),t.push("@")),t.push(encodeURIComponent(i.domain)),n&&i.resource&&(t.push("/"),t.push(encodeURIComponent(i.resource)))};e.identity&&(t.push("//"),n(e.identity,!1),e.jid&&t.push("/")),e.jid&&n(e.jid,!0),e.action&&(t.push("?"),t.push(encodeURIComponent(e.action)));for(const[n,i]of Object.entries(e.parameters||{}))for(const e of Array.isArray(i)?i:[i])t.push(";"),t.push(encodeURIComponent(n)),void 0!==e&&(t.push("="),t.push(encodeURIComponent(e)));return t.join("")}},function(e,t,n){"use strict";
|
|
17
2
|
/*!
|
|
18
3
|
* The buffer module from node.js, for the browser.
|
|
19
4
|
*
|
|
20
|
-
* @author Feross Aboukhadijeh <
|
|
5
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
21
6
|
* @license MIT
|
|
22
|
-
*/
|
|
23
|
-
var i=n(78),r=n(79),s=n(80);function o(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return d(this,e)}return l(this,e,t,n)}function l(e,t,n,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,i){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,n):new Uint8Array(t,n,i);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=p(e,t);return e}(e,t,n,i):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|f(t,n),r=(e=a(e,i)).write(t,n);r!==i&&(e=e.slice(0,r));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|h(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?a(e,0):p(e,t);if("Buffer"===t.type&&s(t.data))return p(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function d(e,t){if(u(t),e=a(e,t<0?0:0|h(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function p(e,t){var n=t.length<0?0:0|h(t.length);e=a(e,n);for(var i=0;i<n;i+=1)e[i]=255&t[i];return e}function h(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(i)return B(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return x(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function v(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,i,r);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,i,r){var s,o=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){var u=-1;for(s=n;s<a;s++)if(l(e,s)===l(t,-1===u?0:s-u)){if(-1===u&&(u=s),s-u+1===c)return u*o}else-1!==u&&(s-=s-u),u=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var d=!0,p=0;p<c;p++)if(l(e,s+p)!==l(t,p)){d=!1;break}if(d)return s}return-1}function y(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[n+o]=a}return o}function _(e,t,n,i){return z(B(t,e.length-n),e,n,i)}function S(e,t,n,i){return z(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function w(e,t,n,i){return S(e,t,n,i)}function T(e,t,n,i){return z(U(t),e,n,i)}function I(e,t,n,i){return z(function(e,t){for(var n,i,r,s=[],o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function x(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function j(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var s,o,a,c,l=e[r],u=null,d=l>239?4:l>223?3:l>191?2:1;if(r+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(s=e[r+1]))&&(c=(31&l)<<6|63&s)>127&&(u=c);break;case 3:s=e[r+1],o=e[r+2],128==(192&s)&&128==(192&o)&&(c=(15&l)<<12|(63&s)<<6|63&o)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:s=e[r+1],o=e[r+2],a=e[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(c=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return n}(i)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=o(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return l(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,i){return u(t),t<=0?a(e,t):void 0!==n?"string"==typeof i?a(e,t).fill(n,i):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return d(null,e)},c.allocUnsafeSlow=function(e){return d(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=c.allocUnsafe(t),r=0;for(n=0;n<e.length;++n){var o=e[n];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,r),r+=o.length}return i},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?j(this,0,e):m.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,i,r){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(i,r),u=e.slice(t,n),d=0;d<a;++d)if(l[d]!==u[d]){s=l[d],o=u[d];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},c.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return w(this,e,t,n);case"base64":return T(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function E(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function C(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",s=t;s<n;++s)r+=D(e[s]);return r}function N(e,t,n){for(var i=e.slice(t,n),r="",s=0;s<i.length;s+=2)r+=String.fromCharCode(i[s]+256*i[s+1]);return r}function O(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,i,r,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<s)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function A(e,t,n,i){t<0&&(t=65535+t+1);for(var r=0,s=Math.min(e.length-n,2);r<s;++r)e[n+r]=(t&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function P(e,t,n,i){t<0&&(t=4294967295+t+1);for(var r=0,s=Math.min(e.length-n,4);r<s;++r)e[n+r]=t>>>8*(i?r:3-r)&255}function L(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function q(e,t,n,i,s){return s||L(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function F(e,t,n,i,s){return s||L(e,0,n,8),r.write(e,t,n,i,52,8),n+8}c.prototype.slice=function(e,t){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var r=t-e;n=new c(r,void 0);for(var s=0;s<r;++s)n[s]=this[s+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var i=this[e],r=1,s=0;++s<t&&(r*=256);)i+=this[e+s]*r;return i},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var i=this[e+--t],r=1;t>0&&(r*=256);)i+=this[e+--t]*r;return i},c.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var i=this[e],r=1,s=0;++s<t&&(r*=256);)i+=this[e+s]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var i=t,r=1,s=this[e+--i];i>0&&(r*=256);)s+=this[e+--i]*r;return s>=(r*=128)&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),r.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),r.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),r.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),r.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,i){(e=+e,t|=0,n|=0,i)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,s=0;for(this[t]=255&e;++s<n&&(r*=256);)this[t+s]=e/r&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,i){(e=+e,t|=0,n|=0,i)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):A(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):P(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}var s=0,o=1,a=0;for(this[t]=255&e;++s<n&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):A(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):P(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return q(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return q(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,i){if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var r,s=i-n;if(this===e&&n<t&&t<i)for(r=s-1;r>=0;--r)e[r+t]=this[r+n];else if(s<1e3||!c.TYPED_ARRAY_SUPPORT)for(r=0;r<s;++r)e[r+t]=this[r+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s},c.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var o=c.isBuffer(e)?e:B(new c(e,i).toString()),a=o.length;for(s=0;s<n-t;++s)this[s+t]=o[s%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function D(e){return e<16?"0"+e.toString(16):e.toString(16)}function B(e,t){var n;t=t||1/0;for(var i=e.length,r=null,s=[],o=0;o<i;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function U(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,i){for(var r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}}).call(this,n(6))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NS_AVATAR_METADATA=t.NS_AVATAR_DATA=t.NS_ROSTER_DELIMITER=t.NS_GEOLOC=t.NS_AMP=t.NS_INBAND_REGISTRATION=t.NS_REGISTER=t.NS_XHTML_IM=t.NS_XHTML=t.NS_HTTP_AUTH=t.NS_OOB_TRANSFER=t.NS_OOB=t.NS_SOCKS5=t.NS_PUBSUB_OWNER=t.NS_PUBSUB_EVENT=t.NS_PUBSUB_ERRORS=t.NS_PUBSUB=t.NS_RSM=t.NS_SEARCH=t.NS_VCARD_TEMP=t.NS_ADHOC_COMMANDS=t.NS_PRIVATE=t.NS_BOOKMARKS=t.NS_IBB=t.NS_MUC_USER=t.NS_MUC_OWNER=t.NS_MUC_ADMIN=t.NS_MUC=t.NS_ADDRESS=t.NS_DISCO_ITEMS=t.NS_DISCO_INFO=t.NS_LEGACY_CHAT_EVENTS=t.NS_PRIVACY=t.NS_LAST_ACTIVITY=t.NS_RPC=t.NS_DATAFORM=t.NS_FRAMING=t.NS_SUBSCRIPTION_PREAPPROVAL=t.NS_ROSTER_VERSIONING=t.NS_ROSTER=t.NS_STARTTLS=t.NS_STREAMS=t.NS_STREAM=t.NS_STANZAS=t.NS_SESSION=t.NS_SERVER=t.NS_SASL=t.NS_CLIENT=t.NS_BIND=t.NS_ATOM=void 0,t.NS_JINGLE_FILE_TRANSFER_4=t.NS_JINGLE_FILE_TRANSFER_3=t.NS_SOFTWARE_INFO=t.NS_BOB=t.NS_ATTENTION_0=t.NS_DATAFORM_MEDIA=t.NS_DISCO_EXTERNAL_2=t.NS_DISCO_EXTERNAL_1=t.NS_BOSH_XMPP=t.NS_DELAY=t.NS_TIME=t.NS_PING=t.NS_SMACKS_3=t.NS_BLOCKING_ERRORS=t.NS_BLOCKING=t.NS_INVISIBLE_0=t.NS_RECEIPTS=t.NS_JINGLE_RAW_UDP_1=t.NS_JINGLE_ICE_UDP_1=t.NS_NICK=t.NS_LANG_TRANS_ITEMS=t.NS_LANG_TRANS=t.NS_JINGLE_RTP_VIDEO=t.NS_JINGLE_RTP_AUDIO=t.NS_JINGLE_RTP_INFO_1=t.NS_JINGLE_RTP_ERRORS_1=t.NS_JINGLE_RTP_1=t.NS_JINGLE_ERRORS_1=t.NS_JINGLE_1=t.NS_PEP_NOTIFY=t.NS_CAPTCHA=t.NS_ALT_CONNECTIONS_XBOSH=t.NS_ALT_CONNECTIONS_WEBSOCKET=t.NS_VCARD_TEMP_UPDATE=t.NS_REACH_0=t.NS_ROSTER_NOTES=t.NS_ROSTER_EXCHANGE=t.NS_DATAFORM_LAYOUT=t.NS_COMPRESSION=t.NS_COMPRESSION_FEATURE=t.NS_SHIM=t.NS_BOSH=t.NS_DATAFORM_VALIDATION=t.NS_TUNE=t.NS_DISCO_LEGACY_CAPS=t.NS_COMPONENT=t.NS_ACTIVITY=t.NS_MOOD=t.NS_VERSION=t.NS_CHAT_STATES=void 0,t.NS_OMEMO_AXOLOTL=t.NS_SPOILER_0=t.NS_EME_0=t.NS_REFERENCE_0=t.NS_JINGLE_ICE_0=t.NS_JINGLE_HTTP_UPLOAD_0=t.NS_JINGLE_HTTP_0=t.NS_HTTP_UPLOAD_0=t.NS_SID_0=t.NS_JINGLE_PUB_1=t.NS_PUSH_0=t.NS_DELEGATION_1=t.NS_JINGLE_MSG_INITIATE_0=t.NS_CSI_0=t.NS_JINGLE_DTLS_SCTP_1=t.NS_JINGLE_RTP_SSMA_0=t.NS_JINGLE_GROUPING_0=t.NS_JSON_0=t.NS_HINTS=t.NS_CHAT_MARKERS_0=t.NS_JINGLE_DTLS_0=t.NS_IDLE_1=t.NS_HATS_0=t.NS_MAM_2=t.NS_MAM_1=t.NS_MAM_0=t.NS_MAM_TMP=t.NS_PSA=t.NS_CORRECTION_0=t.NS_MUC_UNIQUE=t.NS_RTT_0=t.NS_HASH_NAME=t.NS_HASHES_2=t.NS_HASHES_1=t.NS_FORWARD_0=t.NS_JINGLE_RTP_HDREXT_0=t.NS_JINGLE_RTP_RTCP_FB_0=t.NS_CARBONS_2=t.NS_DECLOAKING_0=t.NS_THUMBS_1=t.NS_THUMBS_0=t.NS_JINGLE_RTP_ZRTP_1=t.NS_JINGLE_IBB_1=t.NS_JINGLE_SOCKS5_1=t.NS_SEC_LABEL_ESS_0=t.NS_SEC_LABEL_CATALOG_2=t.NS_SEC_LABEL_0=t.NS_MUC_DIRECT_INVITE=t.NS_JINGLE_XML_0=t.NS_JINGLE_FILE_TRANSFER_5=void 0,t.NS_JINGLE_RTP_MSID_0=t.NS_XRD=t.NS_JSON_MESSAGE_0=t.NS_OMEMO_AXOLOTL_BUNDLE=t.NS_OMEMO_AXOLOTL_BUNDLES=t.NS_OMEMO_AXOLOTL_DEVICELIST=void 0,t.NS_ATOM="http://www.w3.org/2005/Atom",t.NS_BIND="urn:ietf:params:xml:ns:xmpp-bind",t.NS_CLIENT="jabber:client",t.NS_SASL="urn:ietf:params:xml:ns:xmpp-sasl",t.NS_SERVER="jabber:server",t.NS_SESSION="urn:ietf:params:xml:ns:xmpp-session",t.NS_STANZAS="urn:ietf:params:xml:ns:xmpp-stanzas",t.NS_STREAM="http://etherx.jabber.org/streams",t.NS_STREAMS="urn:ietf:params:xml:ns:xmpp-streams",t.NS_STARTTLS="urn:ietf:params:xml:ns:xmpp-tls",t.NS_ROSTER="jabber:iq:roster",t.NS_ROSTER_VERSIONING="urn:xmpp:features:rosterver",t.NS_SUBSCRIPTION_PREAPPROVAL="urn:xmpp:features:pre-approval",t.NS_FRAMING="urn:ietf:params:xml:ns:xmpp-framing",t.NS_DATAFORM="jabber:x:data",t.NS_RPC="jabber:iq:rpc",t.NS_LAST_ACTIVITY="jabber:iq:last",t.NS_PRIVACY="jabber:iq:privacy",t.NS_LEGACY_CHAT_EVENTS="jabber:x:event",t.NS_DISCO_INFO="http://jabber.org/protocol/disco#info",t.NS_DISCO_ITEMS="http://jabber.org/protocol/disco#items",t.NS_ADDRESS="http://jabber.org/protocol/address",t.NS_MUC="http://jabber.org/protocol/muc",t.NS_MUC_ADMIN="http://jabber.org/protocol/muc#admin",t.NS_MUC_OWNER="http://jabber.org/protocol/muc#owner",t.NS_MUC_USER="http://jabber.org/protocol/muc#user",t.NS_IBB="http://jabber.org/protocol/ibb",t.NS_BOOKMARKS="storage:bookmarks",t.NS_PRIVATE="jabber:iq:private",t.NS_ADHOC_COMMANDS="http://jabber.org/protocol/commands",t.NS_VCARD_TEMP="vcard-temp",t.NS_SEARCH="jabber:iq:search",t.NS_RSM="http://jabber.org/protocol/rsm",t.NS_PUBSUB="http://jabber.org/protocol/pubsub",t.NS_PUBSUB_ERRORS="http://jabber.org/protocol/pubsub#errors",t.NS_PUBSUB_EVENT="http://jabber.org/protocol/pubsub#event",t.NS_PUBSUB_OWNER="http://jabber.org/protocol/pubsub#owner",t.NS_SOCKS5="http://jabber.org/protocol/bytestreams",t.NS_OOB="jabber:x:oob",t.NS_OOB_TRANSFER="jabber:iq:oob",t.NS_HTTP_AUTH="http://jabber.org/protocol/http-auth",t.NS_XHTML="http://www.w3.org/1999/xhtml",t.NS_XHTML_IM="http://jabber.org/protocol/xhtml-im",t.NS_REGISTER="jabber:iq:register",t.NS_INBAND_REGISTRATION="http://jabber.org/features/iq-register",t.NS_AMP="http://jabber.org/protocol/amp",t.NS_GEOLOC="http://jabber.org/protocol/geoloc",t.NS_ROSTER_DELIMITER="roster:delimiter",t.NS_AVATAR_DATA="urn:xmpp:avatar:data",t.NS_AVATAR_METADATA="urn:xmpp:avatar:metadata",t.NS_CHAT_STATES="http://jabber.org/protocol/chatstates",t.NS_VERSION="jabber:iq:version",t.NS_MOOD="http://jabber.org/protocol/mood",t.NS_ACTIVITY="http://jabber.org/protocol/activity",t.NS_COMPONENT="jabber:component:accept",t.NS_DISCO_LEGACY_CAPS="http://jabber.org/protocol/caps",t.NS_TUNE="http://jabber.org/protocol/tune",t.NS_DATAFORM_VALIDATION="http://jabber.org/protocol/xdata-validate",t.NS_BOSH="http://jabber.org/protocol/httpbind",t.NS_SHIM="http://jabber.org/protocol/shim",t.NS_COMPRESSION_FEATURE="http://jabber.org/features/compress",t.NS_COMPRESSION="http://jabber.org/protocol/compress",t.NS_DATAFORM_LAYOUT="http://jabber.org/protocol/xdata-layout",t.NS_ROSTER_EXCHANGE="http://jabber.org/protocol/rosterx",t.NS_ROSTER_NOTES="storage:rosternotes",t.NS_REACH_0="urn:xmpp:reach:0",t.NS_VCARD_TEMP_UPDATE="vcard-temp:x:update",t.NS_ALT_CONNECTIONS_WEBSOCKET="urn:xmpp:alt-connections:websocket",t.NS_ALT_CONNECTIONS_XBOSH="urn:xmpp:alt-connections:xbosh",t.NS_CAPTCHA="urn:xmpp:captcha";t.NS_PEP_NOTIFY=e=>e+"+notify",t.NS_JINGLE_1="urn:xmpp:jingle:1",t.NS_JINGLE_ERRORS_1="urn:xmpp:jingle:errors:1",t.NS_JINGLE_RTP_1="urn:xmpp:jingle:apps:rtp:1",t.NS_JINGLE_RTP_ERRORS_1="urn:xmpp:jingle:apps:rtp:errors:1",t.NS_JINGLE_RTP_INFO_1="urn:xmpp:jingle:apps:rtp:info:1",t.NS_JINGLE_RTP_AUDIO="urn:xmpp:jingle:apps:rtp:audio",t.NS_JINGLE_RTP_VIDEO="urn:xmpp:jingle:apps:rtp:video",t.NS_LANG_TRANS="urn:xmpp:langtrans",t.NS_LANG_TRANS_ITEMS="urn:xmpp:langtrans:items",t.NS_NICK="http://jabber.org/protocol/nick",t.NS_JINGLE_ICE_UDP_1="urn:xmpp:jingle:transports:ice-udp:1",t.NS_JINGLE_RAW_UDP_1="urn:xmpp:jingle:transports:raw-udp:1",t.NS_RECEIPTS="urn:xmpp:receipts",t.NS_INVISIBLE_0="urn:xmpp:invisible:0",t.NS_BLOCKING="urn:xmpp:blocking",t.NS_BLOCKING_ERRORS="urn:xmpp:blocking:errors",t.NS_SMACKS_3="urn:xmpp:sm:3",t.NS_PING="urn:xmpp:ping",t.NS_TIME="urn:xmpp:time",t.NS_DELAY="urn:xmpp:delay",t.NS_BOSH_XMPP="urn:xmpp:xbosh",t.NS_DISCO_EXTERNAL_1="urn:xmpp:extdisco:1",t.NS_DISCO_EXTERNAL_2="urn:xmpp:extdisco:2",t.NS_DATAFORM_MEDIA="urn:xmpp:media-element",t.NS_ATTENTION_0="urn:xmpp:attention:0",t.NS_BOB="urn:xmpp:bob",t.NS_SOFTWARE_INFO="urn:xmpp:dataforms:softwareinfo",t.NS_JINGLE_FILE_TRANSFER_3="urn:xmpp:jingle:apps:file-transfer:3",t.NS_JINGLE_FILE_TRANSFER_4="urn:xmpp:jingle:apps:file-transfer:4",t.NS_JINGLE_FILE_TRANSFER_5="urn:xmpp:jingle:apps:file-transfer:5",t.NS_JINGLE_XML_0="urn:xmpp:jingle:apps:xmlstream:0",t.NS_MUC_DIRECT_INVITE="jabber:x:conference",t.NS_SEC_LABEL_0="urn:xmpp:sec-label:0",t.NS_SEC_LABEL_CATALOG_2="urn:xmpp:sec-label:catalog:2",t.NS_SEC_LABEL_ESS_0="urn:xmpp:sec-label:ess:0",t.NS_JINGLE_SOCKS5_1="urn:xmpp:jingle:transports:s5b:1",t.NS_JINGLE_IBB_1="urn:xmpp:jingle:transports:ibb:1",t.NS_JINGLE_RTP_ZRTP_1="urn:xmpp:jingle:apps:rtp:zrtp:1",t.NS_THUMBS_0="urn:xmpp:thumbs:0",t.NS_THUMBS_1="urn:xmpp:thumbs:1",t.NS_DECLOAKING_0="urn:xmpp:decloaking:0",t.NS_CARBONS_2="urn:xmpp:carbons:2",t.NS_JINGLE_RTP_RTCP_FB_0="urn:xmpp:jingle:apps:rtp:rtcp-fb:0",t.NS_JINGLE_RTP_HDREXT_0="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",t.NS_FORWARD_0="urn:xmpp:forward:0",t.NS_HASHES_1="urn:xmpp:hashes:1",t.NS_HASHES_2="urn:xmpp:hashes:2";t.NS_HASH_NAME=e=>"urn:xmpp:hash-function-text-names:"+e,t.NS_RTT_0="urn:xmpp:rtt:0",t.NS_MUC_UNIQUE="http://jabber.org/protocol/muc#unique",t.NS_CORRECTION_0="urn:xmpp:message-correct:0",t.NS_PSA="urn:xmpp:psa",t.NS_MAM_TMP="urn:xmpp:mam:tmp",t.NS_MAM_0="urn:xmpp:mam:0",t.NS_MAM_1="urn:xmpp:mam:1",t.NS_MAM_2="urn:xmpp:mam:2",t.NS_HATS_0="urn:xmpp:hats:0",t.NS_IDLE_1="urn:xmpp:idle:1",t.NS_JINGLE_DTLS_0="urn:xmpp:jingle:apps:dtls:0",t.NS_CHAT_MARKERS_0="urn:xmpp:chat-markers:0",t.NS_HINTS="urn:xmpp:hints",t.NS_JSON_0="urn:xmpp:json:0",t.NS_JINGLE_GROUPING_0="urn:xmpp:jingle:apps:grouping:0",t.NS_JINGLE_RTP_SSMA_0="urn:xmpp:jingle:apps:rtp:ssma:0",t.NS_JINGLE_DTLS_SCTP_1="urn:xmpp:jingle:transports:dtls-sctp:1",t.NS_CSI_0="urn:xmpp:csi:0",t.NS_JINGLE_MSG_INITIATE_0="urn:xmpp:jingle:jingle-message:0",t.NS_DELEGATION_1="urn:xmpp:delegation:1",t.NS_PUSH_0="urn:xmpp:push:0",t.NS_JINGLE_PUB_1="urn:xmpp:jinglepub:1",t.NS_SID_0="urn:xmpp:sid:0",t.NS_HTTP_UPLOAD_0="urn:xmpp:http:upload:0",t.NS_JINGLE_HTTP_0="urn:xmpp:jingle:transports:http:0",t.NS_JINGLE_HTTP_UPLOAD_0="urn:xmpp:jingle:transports:http:upload:0",t.NS_JINGLE_ICE_0="urn:xmpp:jingle:transports:ice:0",t.NS_REFERENCE_0="urn:xmpp:reference:0",t.NS_EME_0="urn:xmpp:eme:0",t.NS_SPOILER_0="urn:xmpp:spoiler:0",t.NS_OMEMO_AXOLOTL="eu.siacs.conversations.axolotl",t.NS_OMEMO_AXOLOTL_DEVICELIST="eu.siacs.conversations.axolotl.devicelist",t.NS_OMEMO_AXOLOTL_BUNDLES="eu.siacs.conversations.axolotl.bundles";t.NS_OMEMO_AXOLOTL_BUNDLE=e=>`${t.NS_OMEMO_AXOLOTL_BUNDLES}:${e}`,t.NS_JSON_MESSAGE_0="urn:xmpp:json-msg:0",t.NS_XRD="http://docs.oasis-open.org/ns/xri/xrd-1.0",t.NS_JINGLE_RTP_MSID_0="urn:xmpp:jingle:apps:rtp:msid:0"},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return r})),n.d(t,"__assign",(function(){return s})),n.d(t,"__rest",(function(){return o})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return c})),n.d(t,"__metadata",(function(){return l})),n.d(t,"__awaiter",(function(){return u})),n.d(t,"__generator",(function(){return d})),n.d(t,"__exportStar",(function(){return p})),n.d(t,"__values",(function(){return h})),n.d(t,"__read",(function(){return f})),n.d(t,"__spread",(function(){return m})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return v})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return y})),n.d(t,"__asyncValues",(function(){return _})),n.d(t,"__makeTemplateObject",(function(){return S})),n.d(t,"__importStar",(function(){return w})),n.d(t,"__importDefault",(function(){return T}));
|
|
7
|
+
*/const i=n(201),r=n(202),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},t.INSPECT_MAX_BYTES=50;function o(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|f(e,t);let i=o(n);const r=i.write(e,t);r!==n&&(i=i.slice(0,r));return i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(W(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(W(e,SharedArrayBuffer)||e&&W(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return a.from(i,t,n);const r=function(e){if(a.isBuffer(e)){const t=0|h(e.length),n=o(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||$(e.length)?o(0):d(e);if("Buffer"===e.type&&Array.isArray(e.data))return d(e.data)}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return u(e),o(e<0?0:0|h(e))}function d(e){const t=e.length<0?0:0|h(e.length),n=o(t);for(let i=0;i<t;i+=1)n[i]=255&e[i];return n}function p(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(i,a.prototype),i}function h(e){if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function f(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||W(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return i?-1:G(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return N(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function y(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),$(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=a.from(t,i)),a.isBuffer(t))return 0===t.length?-1:b(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,i,r){let s,o=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){let i=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===c)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){let n=!0;for(let i=0;i<c;i++)if(u(e,s+i)!==u(t,i)){n=!1;break}if(n)return s}return-1}function _(e,t,n,i){n=Number(n)||0;const r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(t.substr(2*o,2),16);if($(i))return o;e[n+o]=i}return o}function v(e,t,n,i){return V(G(t,e.length-n),e,n,i)}function S(e,t,n,i){return V(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function w(e,t,n,i){return V(H(t),e,n,i)}function T(e,t,n,i){return V(function(e,t){let n,i,r;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function I(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function N(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r<n;){const t=e[r];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(r+o<=n){let n,i,a,c;switch(o){case 1:t<128&&(s=t);break;case 2:n=e[r+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(s=c));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(c=(15&t)<<12|(63&n)<<6|63&i,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:n=e[r+1],i=e[r+2],a=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&a,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(e){const t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return n}(i)}t.kMaxLength=2147483647,a.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,n){return function(e,t,n){return u(e),e<=0?o(e):void 0!==t?"string"==typeof n?o(e).fill(t,n):o(e).fill(t):o(e)}(e,t,n)},a.allocUnsafe=function(e){return l(e)},a.allocUnsafeSlow=function(e){return l(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(W(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),W(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const i=a.allocUnsafe(t);let r=0;for(n=0;n<e.length;++n){let t=e[n];if(W(t,Uint8Array))r+t.length>i.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!a.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},a.byteLength=f,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},a.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},a.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},a.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?N(this,0,e):m.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,i,r){if(W(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0);const c=Math.min(s,o),u=this.slice(i,r),l=e.slice(t,n);for(let e=0;e<c;++e)if(u[e]!==l[e]){s=u[e],o=l[e];break}return s<o?-1:o<s?1:0},a.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},a.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},a.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function E(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function x(e,t,n){const i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=t;i<n;++i)r+=Q[e[i]];return r}function R(e,t,n){const i=e.slice(t,n);let r="";for(let e=0;e<i.length-1;e+=2)r+=String.fromCharCode(i[e]+256*i[e+1]);return r}function C(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,i,r,s){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<s)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function k(e,t,n,i,r){q(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function P(e,t,n,i,r){q(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function j(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,i,s){return t=+t,n>>>=0,s||j(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function M(e,t,n,i,s){return t=+t,n>>>=0,s||j(e,0,n,8),r.write(e,t,n,i,52,8),n+8}a.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,a.prototype),i},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return i},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=K((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||J(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,r=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))})),a.prototype.readBigUInt64BE=K((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||J(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],r=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)})),a.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*t)),i},a.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let i=t,r=1,s=this[e+--i];for(;i>0&&(r*=256);)s+=this[e+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=K((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||J(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),a.prototype.readBigInt64BE=K((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||J(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),a.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),r.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),r.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),r.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),r.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t>>>=0,n>>>=0,!i){O(this,e,t,n,Math.pow(2,8*n)-1,0)}let r=1,s=0;for(this[t]=255&e;++s<n&&(r*=256);)this[t+s]=e/r&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t>>>=0,n>>>=0,!i){O(this,e,t,n,Math.pow(2,8*n)-1,0)}let r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=K((function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=K((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}let r=0,s=1,o=0;for(this[t]=255&e;++r<n&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s>>0)-o&255;return t+n},a.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s>>0)-o&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=K((function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=K((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return M(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return M(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,i){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);const r=i-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),r},a.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let r;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r<n;++r)this[r]=e;else{const s=a.isBuffer(e)?e:a.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(r=0;r<n-t;++r)this[r+t]=s[r%o]}return this};const D={};function B(e,t,n){D[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function F(e){let t="",n=e.length;const i="-"===e[0]?1:0;for(;n>=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function q(e,t,n,i,r,s){if(e>n||e<t){const i="bigint"==typeof t?"n":"";let r;throw r=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new D.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||J(t,e.length-(n+1))}(i,r,s)}function U(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function J(e,t,n){if(Math.floor(e)!==e)throw U(e,n),new D.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}B("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"}),RangeError),B("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),B("ERR_OUT_OF_RANGE",(function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=F(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=F(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function G(e,t){let n;t=t||1/0;const i=e.length;let r=null;const s=[];for(let o=0;o<i;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function H(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,i){let r;for(r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function W(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}const Q=function(){const e=new Array(256);for(let t=0;t<16;++t){const n=16*t;for(let i=0;i<16;++i)e[n+i]="0123456789abcdef"[t]+"0123456789abcdef"[i]}return e}();function K(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reviveData=t.uuid=t.octetCompare=t.sleep=t.shuffle=t.promiseAny=t.timeoutPromise=void 0;const i=n(7),r=[];for(let e=0;e<256;++e)r[e]=(e+256).toString(16).substr(1);t.timeoutPromise=async function(e,t,n=(()=>{})){let i;const r=await Promise.race([e,new Promise((e,r)=>{i=setTimeout(()=>r(n()),t)})]);return clearTimeout(i),r},t.promiseAny=async function(e){try{const t=await Promise.all(e.map(e=>e.then(e=>Promise.reject(e),e=>Promise.resolve(e))));return Promise.reject(t)}catch(e){return Promise.resolve(e)}},t.shuffle=function(e){let t=e.length;for(;t>0;){const n=Math.floor(Math.random()*t);t-=1;const i=e[t];e[t]=e[n],e[n]=i}return e},t.sleep=async function(e){return new Promise(t=>{setTimeout(()=>t(),e)})},t.octetCompare=function(e,t){const n="string"==typeof e?i.Buffer.from(e,"utf8"):e,r="string"==typeof t?i.Buffer.from(t,"utf8"):t;return n.compare(r)},t.uuid=function(){const e=(0,i.randomBytes)(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t=0;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[15]]].join("")};const s=new Set(["date","expires","httpUploadRetry","idleSince","published","since","stamp","timestamp","updated","utc"]),o=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)(?:Z|((\+|-)([\d|:]*)))?$/;t.reviveData=function(e,t){return s.has(e)&&t&&"string"==typeof t&&o.test(t)?new Date(t):t&&"object"==typeof t&&"Buffer"===t.type&&Array.isArray(t.data)?i.Buffer.from(t):t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePayloadSize=t.parseJwt=t.retryPromise=t.isVideoJid=t.isSoftphoneJid=t.isScreenRecordingJid=t.isAcdJid=t.splitIntoIndividualTopics=t.delay=t.timeoutPromise=void 0;const i=n(18),r=n(53);t.timeoutPromise=function(e,t,n,i){return new Promise((function(s,o){const a=setTimeout((function(){const e=new r.TimeoutError("Timeout: "+n);e.details=i,o(e)}),t);e((function(e){clearTimeout(a),s(e)}),o)}))},t.delay=function(e){return new Promise(t=>{setTimeout(t,e)})},t.splitIntoIndividualTopics=function(e){const t=[];if(e.includes("?")){const n=e.split("?"),i=n[0],r=n[1]&&n[1].split("&");r&&r.length&&r.forEach(e=>{t.push(`${i}.${e}`)})}else t.push(e);return t};t.isAcdJid=function(e){return e.startsWith("acd-")&&!t.isSoftphoneJid(e)};t.isScreenRecordingJid=function(e){return e.startsWith("screenrecording-")&&!t.isSoftphoneJid(e)};t.isSoftphoneJid=function(e){return!!e&&!!e.match(/.*@.*gjoll.*/i)};t.isVideoJid=function(e){return!(!e||!e.match(/@conference/)||t.isAcdJid(e))},t.retryPromise=function(e,t,n=15e3,r=console){let s,o,a,c,u=!1;return{promise:new Promise((i,l)=>{c=async()=>{try{const t=await e();a(t)}catch(e){let i=n;const a=t(e);Number.isInteger(a)&&(i=a),!1!==a?(r.debug("Retrying promise",e),s=setTimeout(c,i)):o(e)}},a=e=>{clearTimeout(s),u=!0,i(e)},o=e=>{clearTimeout(s),u=!0,l(e)},c()}),cancel:o,complete:a,_id:i.v4(),hasCompleted:()=>u}};t.parseJwt=e=>{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(window.atob(t).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));return JSON.parse(n)},t.calculatePayloadSize=function(e){const t=JSON.stringify(e),n=encodeURIComponent(t).match(/%[89ABab]/g);return t.length+(n?n.length:0)}},function(e,t,n){"use strict";n.d(t,"b",(function(){return s}));var i=n(13);const r=[];for(let e=0;e<256;++e)r.push((e+256).toString(16).slice(1));function s(e,t=0){return r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+"-"+r[e[t+4]]+r[e[t+5]]+"-"+r[e[t+6]]+r[e[t+7]]+"-"+r[e[t+8]]+r[e[t+9]]+"-"+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]}t.a=function(e,t=0){const n=s(e,t);if(!Object(i.a)(n))throw TypeError("Stringified UUID is invalid");return n}},function(e,t,n){"use strict";var i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;t.a=function(e){return"string"==typeof e&&i.test(e)}},function(e,t,n){"use strict";(function(e){var i=n(0),r=n(4),s=n(31);function o(e){return i.a.isPlainObject(e)||i.a.isArray(e)}function a(e){return i.a.endsWith(e,"[]")?e.slice(0,-2):e}function c(e,t,n){return e?e.concat(t).map((function(e,t){return e=a(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const u=i.a.toFlatObject(i.a,{},null,(function(e){return/^is[A-Z]/.test(e)}));t.a=function(t,n,l){if(!i.a.isObject(t))throw new TypeError("target must be an object");n=n||new(s.a||FormData);const d=(l=i.a.toFlatObject(l,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!i.a.isUndefined(t[e])}))).metaTokens,p=l.visitor||y,h=l.dots,f=l.indexes,m=(l.Blob||"undefined"!=typeof Blob&&Blob)&&i.a.isSpecCompliantForm(n);if(!i.a.isFunction(p))throw new TypeError("visitor must be a function");function g(t){if(null===t)return"";if(i.a.isDate(t))return t.toISOString();if(!m&&i.a.isBlob(t))throw new r.a("Blob is not supported. Use a Buffer instead.");return i.a.isArrayBuffer(t)||i.a.isTypedArray(t)?m&&"function"==typeof Blob?new Blob([t]):e.from(t):t}function y(e,t,r){let s=e;if(e&&!r&&"object"==typeof e)if(i.a.endsWith(t,"{}"))t=d?t:t.slice(0,-2),e=JSON.stringify(e);else if(i.a.isArray(e)&&function(e){return i.a.isArray(e)&&!e.some(o)}(e)||(i.a.isFileList(e)||i.a.endsWith(t,"[]"))&&(s=i.a.toArray(e)))return t=a(t),s.forEach((function(e,r){!i.a.isUndefined(e)&&null!==e&&n.append(!0===f?c([t],r,h):null===f?t:t+"[]",g(e))})),!1;return!!o(e)||(n.append(c(r,t,h),g(e)),!1)}const b=[],_=Object.assign(u,{defaultVisitor:y,convertValue:g,isVisitable:o});if(!i.a.isObject(t))throw new TypeError("data must be an object");return function e(t,r){if(!i.a.isUndefined(t)){if(-1!==b.indexOf(t))throw Error("Circular reference detected in "+r.join("."));b.push(t),i.a.forEach(t,(function(t,s){!0===(!(i.a.isUndefined(t)||null===t)&&p.call(n,t,i.a.isString(s)?s.trim():s,r,_))&&e(t,r?r.concat(s):[s])})),b.pop()}}(t),n}}).call(this,n(183).Buffer)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return r})),n.d(t,"__assign",(function(){return s})),n.d(t,"__rest",(function(){return o})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return c})),n.d(t,"__metadata",(function(){return u})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return d})),n.d(t,"__exportStar",(function(){return p})),n.d(t,"__values",(function(){return h})),n.d(t,"__read",(function(){return f})),n.d(t,"__spread",(function(){return m})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return y})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return _})),n.d(t,"__asyncValues",(function(){return v})),n.d(t,"__makeTemplateObject",(function(){return S})),n.d(t,"__importStar",(function(){return w})),n.d(t,"__importDefault",(function(){return T}));
|
|
24
8
|
/*! *****************************************************************************
|
|
25
9
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
26
10
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -35,6 +19,14 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
35
19
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
36
20
|
and limitations under the License.
|
|
37
21
|
***************************************************************************** */
|
|
38
|
-
var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function r(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function o(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}function c(e,t){return function(n,i){t(n,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function d(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function p(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function h(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof v?Promise.resolve(n.value.v).then(c,l):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function y(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:v(e[i](t)),done:"return"===i}:r?r(t):t}:r}}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=h(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function T(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var i=n(23),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=d;var s=Object.create(n(17));s.inherits=n(18);var o=n(51),a=n(54);s.inherits(d,o);for(var c=r(a.prototype),l=0;l<c.length;l++){var u=c[l];d.prototype[u]||(d.prototype[u]=a.prototype[u])}function d(e){if(!(this instanceof d))return new d(e);o.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",p)}function p(){this.allowHalfOpen||this._writableState.ended||i.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),d.prototype._destroy=function(e,t){this.push(null),this.end(),i.nextTick(t,e)}},function(e,t,n){"use strict";function i(e,...t){return(...n)=>e(...t,...n)}function r(e){return function(...t){var n=t.pop();return e.call(this,t,n)}}n.r(t),n.d(t,"apply",(function(){return i})),n.d(t,"applyEach",(function(){return O})),n.d(t,"applyEachSeries",(function(){return P})),n.d(t,"asyncify",(function(){return d})),n.d(t,"auto",(function(){return F})),n.d(t,"autoInject",(function(){return z})),n.d(t,"cargo",(function(){return H})),n.d(t,"cargoQueue",(function(){return $})),n.d(t,"compose",(function(){return K})),n.d(t,"concat",(function(){return Z})),n.d(t,"concatLimit",(function(){return Y})),n.d(t,"concatSeries",(function(){return ee})),n.d(t,"constant",(function(){return te})),n.d(t,"detect",(function(){return ie})),n.d(t,"detectLimit",(function(){return re})),n.d(t,"detectSeries",(function(){return se})),n.d(t,"dir",(function(){return ae})),n.d(t,"doUntil",(function(){return le})),n.d(t,"doWhilst",(function(){return ce})),n.d(t,"each",(function(){return de})),n.d(t,"eachLimit",(function(){return pe})),n.d(t,"eachOf",(function(){return C})),n.d(t,"eachOfLimit",(function(){return j})),n.d(t,"eachOfSeries",(function(){return R})),n.d(t,"eachSeries",(function(){return he})),n.d(t,"ensureAsync",(function(){return fe})),n.d(t,"every",(function(){return me})),n.d(t,"everyLimit",(function(){return ge})),n.d(t,"everySeries",(function(){return ve})),n.d(t,"filter",(function(){return Se})),n.d(t,"filterLimit",(function(){return we})),n.d(t,"filterSeries",(function(){return Te})),n.d(t,"forever",(function(){return Ie})),n.d(t,"groupBy",(function(){return je})),n.d(t,"groupByLimit",(function(){return xe})),n.d(t,"groupBySeries",(function(){return ke})),n.d(t,"log",(function(){return Ee})),n.d(t,"map",(function(){return N})),n.d(t,"mapLimit",(function(){return X})),n.d(t,"mapSeries",(function(){return A})),n.d(t,"mapValues",(function(){return Ne})),n.d(t,"mapValuesLimit",(function(){return Ce})),n.d(t,"mapValuesSeries",(function(){return Oe})),n.d(t,"memoize",(function(){return Re})),n.d(t,"nextTick",(function(){return Ae})),n.d(t,"parallel",(function(){return Le})),n.d(t,"parallelLimit",(function(){return qe})),n.d(t,"priorityQueue",(function(){return Ue})),n.d(t,"queue",(function(){return Fe})),n.d(t,"race",(function(){return ze})),n.d(t,"reduce",(function(){return W})),n.d(t,"reduceRight",(function(){return Je})),n.d(t,"reflect",(function(){return Ge})),n.d(t,"reflectAll",(function(){return Ve})),n.d(t,"reject",(function(){return $e})),n.d(t,"rejectLimit",(function(){return We})),n.d(t,"rejectSeries",(function(){return Qe})),n.d(t,"retry",(function(){return Xe})),n.d(t,"retryable",(function(){return Ze})),n.d(t,"seq",(function(){return Q})),n.d(t,"series",(function(){return et})),n.d(t,"setImmediate",(function(){return u})),n.d(t,"some",(function(){return tt})),n.d(t,"someLimit",(function(){return nt})),n.d(t,"someSeries",(function(){return it})),n.d(t,"sortBy",(function(){return rt})),n.d(t,"timeout",(function(){return st})),n.d(t,"times",(function(){return at})),n.d(t,"timesLimit",(function(){return ot})),n.d(t,"timesSeries",(function(){return ct})),n.d(t,"transform",(function(){return lt})),n.d(t,"tryEach",(function(){return ut})),n.d(t,"unmemoize",(function(){return dt})),n.d(t,"until",(function(){return ht})),n.d(t,"waterfall",(function(){return ft})),n.d(t,"whilst",(function(){return pt})),n.d(t,"all",(function(){return me})),n.d(t,"allLimit",(function(){return ge})),n.d(t,"allSeries",(function(){return ve})),n.d(t,"any",(function(){return tt})),n.d(t,"anyLimit",(function(){return nt})),n.d(t,"anySeries",(function(){return it})),n.d(t,"find",(function(){return ie})),n.d(t,"findLimit",(function(){return re})),n.d(t,"findSeries",(function(){return se})),n.d(t,"flatMap",(function(){return Z})),n.d(t,"flatMapLimit",(function(){return Y})),n.d(t,"flatMapSeries",(function(){return ee})),n.d(t,"forEach",(function(){return de})),n.d(t,"forEachSeries",(function(){return he})),n.d(t,"forEachLimit",(function(){return pe})),n.d(t,"forEachOf",(function(){return C})),n.d(t,"forEachOfSeries",(function(){return R})),n.d(t,"forEachOfLimit",(function(){return j})),n.d(t,"inject",(function(){return W})),n.d(t,"foldl",(function(){return W})),n.d(t,"foldr",(function(){return Je})),n.d(t,"select",(function(){return Se})),n.d(t,"selectLimit",(function(){return we})),n.d(t,"selectSeries",(function(){return Te})),n.d(t,"wrapSync",(function(){return d})),n.d(t,"during",(function(){return pt})),n.d(t,"doDuring",(function(){return ce}));var s="function"==typeof queueMicrotask&&queueMicrotask,o="function"==typeof setImmediate&&setImmediate,a="object"==typeof process&&"function"==typeof process.nextTick;function c(e){setTimeout(e,0)}function l(e){return(t,...n)=>e(()=>t(...n))}var u=l(s?queueMicrotask:o?setImmediate:a?process.nextTick:c);function d(e){return f(e)?function(...t){const n=t.pop();return p(e.apply(this,t),n)}:r((function(t,n){var i;try{i=e.apply(this,t)}catch(e){return n(e)}if(i&&"function"==typeof i.then)return p(i,n);n(null,i)}))}function p(e,t){return e.then(e=>{h(t,null,e)},e=>{h(t,e&&e.message?e:new Error(e))})}function h(e,t,n){try{e(t,n)}catch(e){u(e=>{throw e},e)}}function f(e){return"AsyncFunction"===e[Symbol.toStringTag]}function m(e){if("function"!=typeof e)throw new Error("expected a function");return f(e)?d(e):e}function g(e,t=e.length){if(!t)throw new Error("arity is undefined");return function(...n){return"function"==typeof n[t-1]?e.apply(this,n):new Promise((i,r)=>{n[t-1]=(e,...t)=>{if(e)return r(e);i(t.length>1?t:t[0])},e.apply(this,n)})}}function v(e){return function(t,...n){return g((function(i){var r=this;return e(t,(e,t)=>{m(e).apply(r,n.concat(t))},i)}))}}function b(e,t,n,i){t=t||[];var r=[],s=0,o=m(n);return e(t,(e,t,n)=>{var i=s++;o(e,(e,t)=>{r[i]=t,n(e)})},e=>{i(e,r)})}function y(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}const _={};function S(e){function t(...t){if(null!==e){var n=e;e=null,n.apply(this,t)}}return Object.assign(t,e),t}function w(e){if(y(e))return function(e){var t=-1,n=e.length;return function(){return++t<n?{value:e[t],key:t}:null}}(e);var t,n,i,r,s=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return s?function(e){var t=-1;return function(){var n=e.next();return n.done?null:(t++,{value:n.value,key:t})}}(s):(n=(t=e)?Object.keys(t):[],i=-1,r=n.length,function e(){var s=n[++i];return"__proto__"===s?e():i<r?{value:t[s],key:s}:null})}function T(e){return function(...t){if(null===e)throw new Error("Callback was already called.");var n=e;e=null,n.apply(this,t)}}function I(e,t,n,i){let r=!1,s=!1,o=!1,a=0,c=0;function l(){a>=t||o||r||(o=!0,e.next().then(({value:e,done:t})=>{if(!s&&!r){if(o=!1,t)return r=!0,void(a<=0&&i(null));a++,n(e,c,u),c++,l()}}).catch(d))}function u(e,t){if(a-=1,!s)return e?d(e):!1===e?(r=!0,void(s=!0)):t===_||r&&a<=0?(r=!0,i(null)):void l()}function d(e){s||(o=!1,r=!0,i(e))}l()}var x=e=>(t,n,i)=>{if(i=S(i),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return i(null);if("AsyncGenerator"===t[Symbol.toStringTag])return I(t,e,n,i);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(t))return I(t[Symbol.asyncIterator](),e,n,i);var r=w(t),s=!1,o=!1,a=0,c=!1;function l(e,t){if(!o)if(a-=1,e)s=!0,i(e);else if(!1===e)s=!0,o=!0;else{if(t===_||s&&a<=0)return s=!0,i(null);c||u()}}function u(){for(c=!0;a<e&&!s;){var t=r();if(null===t)return s=!0,void(a<=0&&i(null));a+=1,n(t.value,t.key,T(l))}c=!1}u()};var j=g((function(e,t,n,i){return x(t)(e,m(n),i)}),4);function k(e,t,n){n=S(n);var i=0,r=0,{length:s}=e,o=!1;function a(e,t){!1===e&&(o=!0),!0!==o&&(e?n(e):++r!==s&&t!==_||n(null))}for(0===s&&n(null);i<s;i++)t(e[i],i,T(a))}function E(e,t,n){return j(e,1/0,t,n)}var C=g((function(e,t,n){return(y(e)?k:E)(e,m(t),n)}),3);var N=g((function(e,t,n){return b(C,e,t,n)}),3),O=v(N);var R=g((function(e,t,n){return j(e,1,t,n)}),3);var A=g((function(e,t,n){return b(R,e,t,n)}),3),P=v(A);const L=Symbol("promiseCallback");function q(){let e,t;function n(n,...i){if(n)return t(n);e(i.length>1?i:i[0])}return n[L]=new Promise((n,i)=>{e=n,t=i}),n}function F(e,t,n){"number"!=typeof t&&(n=t,t=null),n=S(n||q());var i=Object.keys(e).length;if(!i)return n(null);t||(t=i);var r={},s=0,o=!1,a=!1,c=Object.create(null),l=[],u=[],d={};function p(e,t){l.push(()=>function(e,t){if(a)return;var i=T((t,...i)=>{if(s--,!1!==t)if(i.length<2&&([i]=i),t){var l={};if(Object.keys(r).forEach(e=>{l[e]=r[e]}),l[e]=i,a=!0,c=Object.create(null),o)return;n(t,l)}else r[e]=i,(c[e]||[]).forEach(e=>e()),h();else o=!0});s++;var l=m(t[t.length-1]);t.length>1?l(r,i):l(i)}(e,t))}function h(){if(!o){if(0===l.length&&0===s)return n(null,r);for(;l.length&&s<t;){l.shift()()}}}function f(t){var n=[];return Object.keys(e).forEach(i=>{const r=e[i];Array.isArray(r)&&r.indexOf(t)>=0&&n.push(i)}),n}return Object.keys(e).forEach(t=>{var n=e[t];if(!Array.isArray(n))return p(t,[n]),void u.push(t);var i=n.slice(0,n.length-1),r=i.length;if(0===r)return p(t,n),void u.push(t);d[t]=r,i.forEach(s=>{if(!e[s])throw new Error("async.auto task `"+t+"` has a non-existent dependency `"+s+"` in "+i.join(", "));!function(e,t){var n=c[e];n||(n=c[e]=[]);n.push(t)}(s,()=>{0===--r&&p(t,n)})})}),function(){var e,t=0;for(;u.length;)e=u.pop(),t++,f(e).forEach(e=>{0==--d[e]&&u.push(e)});if(t!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),h(),n[L]}var M=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,D=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,B=/,/,U=/(=.+)?(\s*)$/;function z(e,t){var n={};return Object.keys(e).forEach(t=>{var i,r=e[t],s=f(r),o=!s&&1===r.length||s&&0===r.length;if(Array.isArray(r))i=[...r],r=i.pop(),n[t]=i.concat(i.length>0?a:r);else if(o)n[t]=r;else{if(i=function(e){const t=function(e){let t="",n=0,i=e.indexOf("*/");for(;n<e.length;)if("/"===e[n]&&"/"===e[n+1]){let t=e.indexOf("\n",n);n=-1===t?e.length:t}else if(-1!==i&&"/"===e[n]&&"*"===e[n+1]){let r=e.indexOf("*/",n);-1!==r?(n=r+2,i=e.indexOf("*/",n)):(t+=e[n],n++)}else t+=e[n],n++;return t}(e.toString());let n=t.match(M);if(n||(n=t.match(D)),!n)throw new Error("could not parse args in autoInject\nSource:\n"+t);let[,i]=n;return i.replace(/\s/g,"").split(B).map(e=>e.replace(U,"").trim())}(r),0===r.length&&!s&&0===i.length)throw new Error("autoInject task functions require explicit parameters.");s||i.pop(),n[t]=i.concat(a)}function a(e,t){var n=i.map(t=>e[t]);n.push(t),m(r)(...n)}}),F(n,t)}class J{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1}insertBefore(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):G(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):G(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var t=this.head;t;){var{next:n}=t;e(t)&&this.removeLink(t),t=n}return this}}function G(e,t){e.length=1,e.head=e.tail=t}function V(e,t,n){if(null==t)t=1;else if(0===t)throw new RangeError("Concurrency must not be zero");var i=m(e),r=0,s=[];const o={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function a(e,t){return e?t?void(o[e]=o[e].filter(e=>e!==t)):o[e]=[]:Object.keys(o).forEach(e=>o[e]=[])}function c(e,...t){o[e].forEach(e=>e(...t))}var l=!1;function d(e,t,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");var r,s;function o(e,...t){return e?n?s(e):r():t.length<=1?r(t[0]):void r(t)}v.started=!0;var a={data:e,callback:n?o:i||o};if(t?v._tasks.unshift(a):v._tasks.push(a),l||(l=!0,u(()=>{l=!1,v.process()})),n||!i)return new Promise((e,t)=>{r=e,s=t})}function p(e){return function(t,...n){r-=1;for(var i=0,o=e.length;i<o;i++){var a=e[i],l=s.indexOf(a);0===l?s.shift():l>0&&s.splice(l,1),a.callback(t,...n),null!=t&&c("error",t,a.data)}r<=v.concurrency-v.buffer&&c("unsaturated"),v.idle()&&c("drain"),v.process()}}function h(e){return!(0!==e.length||!v.idle())&&(u(()=>c("drain")),!0)}const f=e=>t=>{if(!t)return new Promise((t,n)=>{!function(e,t){const n=(...i)=>{a(e,n),t(...i)};o[e].push(n)}(e,(e,i)=>{if(e)return n(e);t(i)})});a(e),function(e,t){o[e].push(t)}(e,t)};var g=!1,v={_tasks:new J,*[Symbol.iterator](){yield*v._tasks[Symbol.iterator]()},concurrency:t,payload:n,buffer:t/4,started:!1,paused:!1,push(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!1,!1,t))}return d(e,!1,!1,t)},pushAsync(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!1,!0,t))}return d(e,!1,!0,t)},kill(){a(),v._tasks.empty()},unshift(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!0,!1,t))}return d(e,!0,!1,t)},unshiftAsync(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!0,!0,t))}return d(e,!0,!0,t)},remove(e){v._tasks.remove(e)},process(){if(!g){for(g=!0;!v.paused&&r<v.concurrency&&v._tasks.length;){var e=[],t=[],n=v._tasks.length;v.payload&&(n=Math.min(n,v.payload));for(var o=0;o<n;o++){var a=v._tasks.shift();e.push(a),s.push(a),t.push(a.data)}r+=1,0===v._tasks.length&&c("empty"),r===v.concurrency&&c("saturated");var l=T(p(e));i(t,l)}g=!1}},length:()=>v._tasks.length,running:()=>r,workersList:()=>s,idle:()=>v._tasks.length+r===0,pause(){v.paused=!0},resume(){!1!==v.paused&&(v.paused=!1,u(v.process))}};return Object.defineProperties(v,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),v}function H(e,t){return V(e,1,t)}function $(e,t,n){return V(e,t,n)}var W=g((function(e,t,n,i){i=S(i);var r=m(n);return R(e,(e,n,i)=>{r(t,e,(e,n)=>{t=n,i(e)})},e=>i(e,t))}),4);function Q(...e){var t=e.map(m);return function(...e){var n=this,i=e[e.length-1];return"function"==typeof i?e.pop():i=q(),W(t,e,(e,t,i)=>{t.apply(n,e.concat((e,...t)=>{i(e,t)}))},(e,t)=>i(e,...t)),i[L]}}function K(...e){return Q(...e.reverse())}var X=g((function(e,t,n,i){return b(x(t),e,n,i)}),4);var Y=g((function(e,t,n,i){var r=m(n);return X(e,t,(e,t)=>{r(e,(e,...n)=>e?t(e):t(e,n))},(e,t)=>{for(var n=[],r=0;r<t.length;r++)t[r]&&(n=n.concat(...t[r]));return i(e,n)})}),4);var Z=g((function(e,t,n){return Y(e,1/0,t,n)}),3);var ee=g((function(e,t,n){return Y(e,1,t,n)}),3);function te(...e){return function(...t){return t.pop()(null,...e)}}function ne(e,t){return(n,i,r,s)=>{var o,a=!1;const c=m(r);n(i,(n,i,r)=>{c(n,(i,s)=>i||!1===i?r(i):e(s)&&!o?(a=!0,o=t(!0,n),r(null,_)):void r())},e=>{if(e)return s(e);s(null,a?o:t(!1))})}}var ie=g((function(e,t,n){return ne(e=>e,(e,t)=>t)(C,e,t,n)}),3);var re=g((function(e,t,n,i){return ne(e=>e,(e,t)=>t)(x(t),e,n,i)}),4);var se=g((function(e,t,n){return ne(e=>e,(e,t)=>t)(x(1),e,t,n)}),3);function oe(e){return(t,...n)=>m(t)(...n,(t,...n)=>{"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&n.forEach(t=>console[e](t)))})}var ae=oe("dir");var ce=g((function(e,t,n){n=T(n);var i,r=m(e),s=m(t);function o(e,...t){if(e)return n(e);!1!==e&&(i=t,s(...t,a))}function a(e,t){return e?n(e):!1!==e?t?void r(o):n(null,...i):void 0}return a(null,!0)}),3);function le(e,t,n){const i=m(t);return ce(e,(...e)=>{const t=e.pop();i(...e,(e,n)=>t(e,!n))},n)}function ue(e){return(t,n,i)=>e(t,i)}var de=g((function(e,t,n){return C(e,ue(m(t)),n)}),3);var pe=g((function(e,t,n,i){return x(t)(e,ue(m(n)),i)}),4);var he=g((function(e,t,n){return pe(e,1,t,n)}),3);function fe(e){return f(e)?e:function(...t){var n=t.pop(),i=!0;t.push((...e)=>{i?u(()=>n(...e)):n(...e)}),e.apply(this,t),i=!1}}var me=g((function(e,t,n){return ne(e=>!e,e=>!e)(C,e,t,n)}),3);var ge=g((function(e,t,n,i){return ne(e=>!e,e=>!e)(x(t),e,n,i)}),4);var ve=g((function(e,t,n){return ne(e=>!e,e=>!e)(R,e,t,n)}),3);function be(e,t,n,i){var r=new Array(t.length);e(t,(e,t,i)=>{n(e,(e,n)=>{r[t]=!!n,i(e)})},e=>{if(e)return i(e);for(var n=[],s=0;s<t.length;s++)r[s]&&n.push(t[s]);i(null,n)})}function ye(e,t,n,i){var r=[];e(t,(e,t,i)=>{n(e,(n,s)=>{if(n)return i(n);s&&r.push({index:t,value:e}),i(n)})},e=>{if(e)return i(e);i(null,r.sort((e,t)=>e.index-t.index).map(e=>e.value))})}function _e(e,t,n,i){return(y(t)?be:ye)(e,t,m(n),i)}var Se=g((function(e,t,n){return _e(C,e,t,n)}),3);var we=g((function(e,t,n,i){return _e(x(t),e,n,i)}),4);var Te=g((function(e,t,n){return _e(R,e,t,n)}),3);var Ie=g((function(e,t){var n=T(t),i=m(fe(e));return function e(t){if(t)return n(t);!1!==t&&i(e)}()}),2);var xe=g((function(e,t,n,i){var r=m(n);return X(e,t,(e,t)=>{r(e,(n,i)=>n?t(n):t(n,{key:i,val:e}))},(e,t)=>{for(var n={},{hasOwnProperty:r}=Object.prototype,s=0;s<t.length;s++)if(t[s]){var{key:o}=t[s],{val:a}=t[s];r.call(n,o)?n[o].push(a):n[o]=[a]}return i(e,n)})}),4);function je(e,t,n){return xe(e,1/0,t,n)}function ke(e,t,n){return xe(e,1,t,n)}var Ee=oe("log");var Ce=g((function(e,t,n,i){i=S(i);var r={},s=m(n);return x(t)(e,(e,t,n)=>{s(e,t,(e,i)=>{if(e)return n(e);r[t]=i,n(e)})},e=>i(e,r))}),4);function Ne(e,t,n){return Ce(e,1/0,t,n)}function Oe(e,t,n){return Ce(e,1,t,n)}function Re(e,t=(e=>e)){var n=Object.create(null),i=Object.create(null),s=m(e),o=r((e,r)=>{var o=t(...e);o in n?u(()=>r(null,...n[o])):o in i?i[o].push(r):(i[o]=[r],s(...e,(e,...t)=>{e||(n[o]=t);var r=i[o];delete i[o];for(var s=0,a=r.length;s<a;s++)r[s](e,...t)}))});return o.memo=n,o.unmemoized=e,o}var Ae=l(a?process.nextTick:o?setImmediate:c),Pe=g((e,t,n)=>{var i=y(t)?[]:{};e(t,(e,t,n)=>{m(e)((e,...r)=>{r.length<2&&([r]=r),i[t]=r,n(e)})},e=>n(e,i))},3);function Le(e,t){return Pe(C,e,t)}function qe(e,t,n){return Pe(x(t),e,n)}function Fe(e,t){var n=m(e);return V((e,t)=>{n(e[0],t)},t,1)}class Me{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let t;for(;e>0&&Be(this.heap[e],this.heap[t=De(e)]);){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,e=t}}percDown(e){let t;for(;(t=1+(e<<1))<this.heap.length&&(t+1<this.heap.length&&Be(this.heap[t+1],this.heap[t])&&(t+=1),!Be(this.heap[e],this.heap[t]));){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,e=t}}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let t=0;for(let n=0;n<this.heap.length;n++)e(this.heap[n])||(this.heap[t]=this.heap[n],t++);this.heap.splice(t);for(let e=De(this.heap.length-1);e>=0;e--)this.percDown(e);return this}}function De(e){return(e+1>>1)-1}function Be(e,t){return e.priority!==t.priority?e.priority<t.priority:e.pushCount<t.pushCount}function Ue(e,t){var n=Fe(e,t),i=!1;return n._tasks=new Me,n.push=function(e,t=0,r=(()=>{})){if("function"!=typeof r)throw new Error("task callback must be a function");if(n.started=!0,Array.isArray(e)||(e=[e]),0===e.length&&n.idle())return u(()=>n.drain());for(var s=0,o=e.length;s<o;s++){var a={data:e[s],priority:t,callback:r};n._tasks.push(a)}i||(i=!0,u(()=>{i=!1,n.process()}))},delete n.unshift,n}var ze=g((function(e,t){if(t=S(t),!Array.isArray(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var n=0,i=e.length;n<i;n++)m(e[n])(t)}),2);function Je(e,t,n,i){var r=[...e].reverse();return W(r,t,n,i)}function Ge(e){var t=m(e);return r((function(e,n){return e.push((e,...t)=>{let i={};if(e&&(i.error=e),t.length>0){var r=t;t.length<=1&&([r]=t),i.value=r}n(null,i)}),t.apply(this,e)}))}function Ve(e){var t;return Array.isArray(e)?t=e.map(Ge):(t={},Object.keys(e).forEach(n=>{t[n]=Ge.call(this,e[n])})),t}function He(e,t,n,i){const r=m(n);return _e(e,t,(e,t)=>{r(e,(e,n)=>{t(e,!n)})},i)}var $e=g((function(e,t,n){return He(C,e,t,n)}),3);var We=g((function(e,t,n,i){return He(x(t),e,n,i)}),4);var Qe=g((function(e,t,n){return He(R,e,t,n)}),3);function Ke(e){return function(){return e}}function Xe(e,t,n){var i={times:5,intervalFunc:Ke(0)};if(arguments.length<3&&"function"==typeof e?(n=t||q(),t=e):(Ye(i,e),n=n||q()),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var r=m(t),s=1;function o(){r((e,...t)=>{!1!==e&&(e&&s++<i.times&&("function"!=typeof i.errorFilter||i.errorFilter(e))?setTimeout(o,i.intervalFunc(s-1)):n(e,...t))})}return o(),n[L]}function Ye(e,t){if("object"==typeof t)e.times=+t.times||5,e.intervalFunc="function"==typeof t.interval?t.interval:Ke(+t.interval||0),e.errorFilter=t.errorFilter;else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");e.times=+t||5}}function Ze(e,t){t||(t=e,e=null);let n=e&&e.arity||t.length;f(t)&&(n+=1);var i=m(t);return r((t,r)=>{function s(e){i(...t,e)}return(t.length<n-1||null==r)&&(t.push(r),r=q()),e?Xe(e,s,r):Xe(s,r),r[L]})}function et(e,t){return Pe(R,e,t)}var tt=g((function(e,t,n){return ne(Boolean,e=>e)(C,e,t,n)}),3);var nt=g((function(e,t,n,i){return ne(Boolean,e=>e)(x(t),e,n,i)}),4);var it=g((function(e,t,n){return ne(Boolean,e=>e)(R,e,t,n)}),3);var rt=g((function(e,t,n){var i=m(t);return N(e,(e,t)=>{i(e,(n,i)=>{if(n)return t(n);t(n,{value:e,criteria:i})})},(e,t)=>{if(e)return n(e);n(null,t.sort(r).map(e=>e.value))});function r(e,t){var n=e.criteria,i=t.criteria;return n<i?-1:n>i?1:0}}),3);function st(e,t,n){var i=m(e);return r((r,s)=>{var o,a=!1;r.push((...e)=>{a||(s(...e),clearTimeout(o))}),o=setTimeout((function(){var t=e.name||"anonymous",i=new Error('Callback function "'+t+'" timed out.');i.code="ETIMEDOUT",n&&(i.info=n),a=!0,s(i)}),t),i(...r)})}function ot(e,t,n,i){var r=m(n);return X(function(e){for(var t=Array(e);e--;)t[e]=e;return t}(e),t,r,i)}function at(e,t,n){return ot(e,1/0,t,n)}function ct(e,t,n){return ot(e,1,t,n)}function lt(e,t,n,i){arguments.length<=3&&"function"==typeof t&&(i=n,n=t,t=Array.isArray(e)?[]:{}),i=S(i||q());var r=m(n);return C(e,(e,n,i)=>{r(t,e,n,i)},e=>i(e,t)),i[L]}var ut=g((function(e,t){var n,i=null;return he(e,(e,t)=>{m(e)((e,...r)=>{if(!1===e)return t(e);r.length<2?[n]=r:n=r,i=e,t(e?null:{})})},()=>t(i,n))}));function dt(e){return(...t)=>(e.unmemoized||e)(...t)}var pt=g((function(e,t,n){n=T(n);var i=m(t),r=m(e),s=[];function o(e,...t){if(e)return n(e);s=t,!1!==e&&r(a)}function a(e,t){return e?n(e):!1!==e?t?void i(o):n(null,...s):void 0}return r(a)}),3);function ht(e,t,n){const i=m(e);return pt(e=>i((t,n)=>e(t,!n)),t,n)}var ft=g((function(e,t){if(t=S(t),!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var n=0;function i(t){m(e[n++])(...t,T(r))}function r(r,...s){if(!1!==r)return r||n===e.length?t(r,...s):void i(s)}i([])})),mt={apply:i,applyEach:O,applyEachSeries:P,asyncify:d,auto:F,autoInject:z,cargo:H,cargoQueue:$,compose:K,concat:Z,concatLimit:Y,concatSeries:ee,constant:te,detect:ie,detectLimit:re,detectSeries:se,dir:ae,doUntil:le,doWhilst:ce,each:de,eachLimit:pe,eachOf:C,eachOfLimit:j,eachOfSeries:R,eachSeries:he,ensureAsync:fe,every:me,everyLimit:ge,everySeries:ve,filter:Se,filterLimit:we,filterSeries:Te,forever:Ie,groupBy:je,groupByLimit:xe,groupBySeries:ke,log:Ee,map:N,mapLimit:X,mapSeries:A,mapValues:Ne,mapValuesLimit:Ce,mapValuesSeries:Oe,memoize:Re,nextTick:Ae,parallel:Le,parallelLimit:qe,priorityQueue:Ue,queue:Fe,race:ze,reduce:W,reduceRight:Je,reflect:Ge,reflectAll:Ve,reject:$e,rejectLimit:We,rejectSeries:Qe,retry:Xe,retryable:Ze,seq:Q,series:et,setImmediate:u,some:tt,someLimit:nt,someSeries:it,sortBy:rt,timeout:st,times:at,timesLimit:ot,timesSeries:ct,transform:lt,tryEach:ut,unmemoize:dt,until:ht,waterfall:ft,whilst:pt,all:me,allLimit:ge,allSeries:ve,any:tt,anyLimit:nt,anySeries:it,find:ie,findLimit:re,findSeries:se,flatMap:Z,flatMapLimit:Y,flatMapSeries:ee,forEach:de,forEachSeries:he,forEachLimit:pe,forEachOf:C,forEachOfSeries:R,forEachOfLimit:j,inject:W,foldl:W,foldr:Je,select:Se,selectLimit:we,selectSeries:Te,wrapSync:d,during:pt,doDuring:ce};t.default=mt},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(12).Buffer)},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionTypes=void 0,function(e){e.softphone="softphone",e.collaborateVideo="collaborateVideo",e.acdScreenShare="screenShare",e.screenRecording="screenRecording",e.unknown="unknown"}(t.SessionTypes||(t.SessionTypes={}))},function(e,t,n){"use strict";let i;n.r(t);const r=new Uint8Array(16);function s(){if(!i&&(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!i))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(r)}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;var a=function(e){return"string"==typeof e&&o.test(e)};const c=[];for(let e=0;e<256;++e)c.push((e+256).toString(16).slice(1));function l(e,t=0){return c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]}var u=function(e,t=0){const n=l(e,t);if(!a(n))throw TypeError("Stringified UUID is invalid");return n};let d,p,h=0,f=0;var m=function(e,t,n){let i=t&&n||0;const r=t||new Array(16);let o=(e=e||{}).node||d,a=void 0!==e.clockseq?e.clockseq:p;if(null==o||null==a){const t=e.random||(e.rng||s)();null==o&&(o=d=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==a&&(a=p=16383&(t[6]<<8|t[7]))}let c=void 0!==e.msecs?e.msecs:Date.now(),u=void 0!==e.nsecs?e.nsecs:f+1;const m=c-h+(u-f)/1e4;if(m<0&&void 0===e.clockseq&&(a=a+1&16383),(m<0||c>h)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=c,f=u,p=a,c+=122192928e5;const g=(1e4*(268435455&c)+u)%4294967296;r[i++]=g>>>24&255,r[i++]=g>>>16&255,r[i++]=g>>>8&255,r[i++]=255&g;const v=c/4294967296*1e4&268435455;r[i++]=v>>>8&255,r[i++]=255&v,r[i++]=v>>>24&15|16,r[i++]=v>>>16&255,r[i++]=a>>>8|128,r[i++]=255&a;for(let e=0;e<6;++e)r[i+e]=o[e];return t||l(r)};var g=function(e){if(!a(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};function v(e,t,n){function i(e,i,r,s){var o;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof i&&(i=g(i)),16!==(null===(o=i)||void 0===o?void 0:o.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let a=new Uint8Array(16+e.length);if(a.set(i),a.set(e,i.length),a=n(a),a[6]=15&a[6]|t,a[8]=63&a[8]|128,r){s=s||0;for(let e=0;e<16;++e)r[s+e]=a[e];return r}return l(a)}try{i.name=e}catch(e){}return i.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",i.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",i}function b(e){return 14+(e+64>>>9<<4)+1}function y(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function _(e,t,n,i,r,s){return y((o=y(y(t,e),y(i,s)))<<(a=r)|o>>>32-a,n);var o,a}function S(e,t,n,i,r,s,o){return _(t&n|~t&i,e,t,r,s,o)}function w(e,t,n,i,r,s,o){return _(t&i|n&~i,e,t,r,s,o)}function T(e,t,n,i,r,s,o){return _(t^n^i,e,t,r,s,o)}function I(e,t,n,i,r,s,o){return _(n^(t|~i),e,t,r,s,o)}var x=v("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length;for(let i=0;i<n;i+=8){const n=e[i>>5]>>>i%32&255,r=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);t.push(r)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[b(t)-1]=t;let n=1732584193,i=-271733879,r=-1732584194,s=271733878;for(let t=0;t<e.length;t+=16){const o=n,a=i,c=r,l=s;n=S(n,i,r,s,e[t],7,-680876936),s=S(s,n,i,r,e[t+1],12,-389564586),r=S(r,s,n,i,e[t+2],17,606105819),i=S(i,r,s,n,e[t+3],22,-1044525330),n=S(n,i,r,s,e[t+4],7,-176418897),s=S(s,n,i,r,e[t+5],12,1200080426),r=S(r,s,n,i,e[t+6],17,-1473231341),i=S(i,r,s,n,e[t+7],22,-45705983),n=S(n,i,r,s,e[t+8],7,1770035416),s=S(s,n,i,r,e[t+9],12,-1958414417),r=S(r,s,n,i,e[t+10],17,-42063),i=S(i,r,s,n,e[t+11],22,-1990404162),n=S(n,i,r,s,e[t+12],7,1804603682),s=S(s,n,i,r,e[t+13],12,-40341101),r=S(r,s,n,i,e[t+14],17,-1502002290),i=S(i,r,s,n,e[t+15],22,1236535329),n=w(n,i,r,s,e[t+1],5,-165796510),s=w(s,n,i,r,e[t+6],9,-1069501632),r=w(r,s,n,i,e[t+11],14,643717713),i=w(i,r,s,n,e[t],20,-373897302),n=w(n,i,r,s,e[t+5],5,-701558691),s=w(s,n,i,r,e[t+10],9,38016083),r=w(r,s,n,i,e[t+15],14,-660478335),i=w(i,r,s,n,e[t+4],20,-405537848),n=w(n,i,r,s,e[t+9],5,568446438),s=w(s,n,i,r,e[t+14],9,-1019803690),r=w(r,s,n,i,e[t+3],14,-187363961),i=w(i,r,s,n,e[t+8],20,1163531501),n=w(n,i,r,s,e[t+13],5,-1444681467),s=w(s,n,i,r,e[t+2],9,-51403784),r=w(r,s,n,i,e[t+7],14,1735328473),i=w(i,r,s,n,e[t+12],20,-1926607734),n=T(n,i,r,s,e[t+5],4,-378558),s=T(s,n,i,r,e[t+8],11,-2022574463),r=T(r,s,n,i,e[t+11],16,1839030562),i=T(i,r,s,n,e[t+14],23,-35309556),n=T(n,i,r,s,e[t+1],4,-1530992060),s=T(s,n,i,r,e[t+4],11,1272893353),r=T(r,s,n,i,e[t+7],16,-155497632),i=T(i,r,s,n,e[t+10],23,-1094730640),n=T(n,i,r,s,e[t+13],4,681279174),s=T(s,n,i,r,e[t],11,-358537222),r=T(r,s,n,i,e[t+3],16,-722521979),i=T(i,r,s,n,e[t+6],23,76029189),n=T(n,i,r,s,e[t+9],4,-640364487),s=T(s,n,i,r,e[t+12],11,-421815835),r=T(r,s,n,i,e[t+15],16,530742520),i=T(i,r,s,n,e[t+2],23,-995338651),n=I(n,i,r,s,e[t],6,-198630844),s=I(s,n,i,r,e[t+7],10,1126891415),r=I(r,s,n,i,e[t+14],15,-1416354905),i=I(i,r,s,n,e[t+5],21,-57434055),n=I(n,i,r,s,e[t+12],6,1700485571),s=I(s,n,i,r,e[t+3],10,-1894986606),r=I(r,s,n,i,e[t+10],15,-1051523),i=I(i,r,s,n,e[t+1],21,-2054922799),n=I(n,i,r,s,e[t+8],6,1873313359),s=I(s,n,i,r,e[t+15],10,-30611744),r=I(r,s,n,i,e[t+6],15,-1560198380),i=I(i,r,s,n,e[t+13],21,1309151649),n=I(n,i,r,s,e[t+4],6,-145523070),s=I(s,n,i,r,e[t+11],10,-1120210379),r=I(r,s,n,i,e[t+2],15,718787259),i=I(i,r,s,n,e[t+9],21,-343485551),n=y(n,o),i=y(i,a),r=y(r,c),s=y(s,l)}return[n,i,r,s]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(b(t));for(let i=0;i<t;i+=8)n[i>>5]|=(255&e[i/8])<<i%32;return n}(e),8*e.length))}));var j={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var k=function(e,t,n){if(j.randomUUID&&!t&&!e)return j.randomUUID();const i=(e=e||{}).random||(e.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=i[e];return t}return l(i)};function E(e,t,n,i){switch(e){case 0:return t&n^~t&i;case 1:return t^n^i;case 2:return t&n^t&i^n&i;case 3:return t^n^i}}function C(e,t){return e<<t|e>>>32-t}var N=v("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const i=e.length/4+2,r=Math.ceil(i/16),s=new Array(r);for(let t=0;t<r;++t){const n=new Uint32Array(16);for(let i=0;i<16;++i)n[i]=e[64*t+4*i]<<24|e[64*t+4*i+1]<<16|e[64*t+4*i+2]<<8|e[64*t+4*i+3];s[t]=n}s[r-1][14]=8*(e.length-1)/Math.pow(2,32),s[r-1][14]=Math.floor(s[r-1][14]),s[r-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<r;++e){const i=new Uint32Array(80);for(let t=0;t<16;++t)i[t]=s[e][t];for(let e=16;e<80;++e)i[e]=C(i[e-3]^i[e-8]^i[e-14]^i[e-16],1);let r=n[0],o=n[1],a=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=C(r,5)+E(n,o,a,c)+l+t[n]+i[e]>>>0;l=c,c=a,a=C(o,30)>>>0,o=r,r=s}n[0]=n[0]+r>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var O=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)};n.d(t,"v1",(function(){return m})),n.d(t,"v3",(function(){return x})),n.d(t,"v4",(function(){return k})),n.d(t,"v5",(function(){return N})),n.d(t,"NIL",(function(){return"00000000-0000-0000-0000-000000000000"})),n.d(t,"version",(function(){return O})),n.d(t,"validate",(function(){return a})),n.d(t,"stringify",(function(){return u})),n.d(t,"parse",(function(){return g}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(22);class r{constructor(e,t={},n=[]){this.name=e,this.attributes=t,this.children=[],this.optionalNamespaces={};for(const e of n)if("string"!=typeof e){const t=new r(e.name,e.attributes,e.children);t.parent=this,this.children.push(t)}else this.children.push(e)}getName(){return this.name.indexOf(":")>=0?this.name.substr(this.name.indexOf(":")+1):this.name}getNamespace(){if(this.name.indexOf(":")>=0){const e=this.name.substr(0,this.name.indexOf(":"));return this.findNamespaceForPrefix(e)}return this.findNamespaceForPrefix()}getNamespaceContext(){let e={};this.parent&&(e=this.parent.getNamespaceContext());for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")){const i=t.substr(6);e[n]=i}return e}getDefaultNamespace(){return this.attributes.xmlns?this.attributes.xmlns:this.parent?this.parent.getDefaultNamespace():""}getNamespaceRoot(e){if(this.parent){const t=this.parent.getNamespaceRoot(e);if(t)return t}for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")&&n===e)return this;if(this.optionalNamespaces[e])return this}getAttribute(e,t){if(!t)return this.attributes[e];const n=this.getNamespaceContext();return n[t]?this.attributes[[n[t],e].join(":")]:void 0}getChild(e,t){return this.getChildren(e,t)[0]}getChildren(e,t){const n=[];for(const i of this.children)"string"==typeof i||i.getName()!==e||t&&i.getNamespace()!==t||n.push(i);return n}getText(){let e="";for(const t of this.children)"string"==typeof t&&(e+=t);return e}appendChild(e){return this.children.push(e),"string"!=typeof e&&(e.parent=this),e}setAttribute(e,t,n=!1){this.attributes[e]=t||void 0,""===t&&n&&(this.attributes[e]=t)}addOptionalNamespace(e,t){this.optionalNamespaces[t]=e}useNamespace(e,t){return this.optionalNamespaces[t]&&(e=this.optionalNamespaces[t]),this.setAttribute("xmlns:"+e,t),e}toJSON(){const e=this.children.map(e=>"string"==typeof e?e:e?e.toJSON():void 0).filter(e=>!!e),t={};for(const[e,n]of Object.entries(this.attributes))null!=n&&(t[e]=n);return{attributes:t,children:e,name:this.name}}toString(){let e=this.openTag(!0);if(this.children.length){for(const t of this.children)"string"==typeof t?e+=i.escapeXMLText(t):t&&(e+=t.toString());e+=this.closeTag()}return e}openTag(e=!1){let t="";t+="<"+this.name;for(const[e,n]of Object.entries(this.attributes))void 0!==n&&(t+=` ${e}="${i.escapeXML(n.toString())}"`);return e&&0===this.children.length?t+="/>":t+=">",t}closeTag(){return`</${this.name}>`}findNamespaceForPrefix(e){if(e){const t="xmlns:"+e;if(this.attributes[t])return this.attributes[t];if(this.parent)return this.parent.findNamespaceForPrefix(e)}else{if(this.attributes.xmlns)return this.attributes.xmlns;if(this.parent)return this.parent.findNamespaceForPrefix()}return""}}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.basicLanguageResolver=t.escapeXMLText=t.unescapeXML=t.escapeXML=void 0;const i=n(0).__importDefault(n(31)),r={'"':""","&":"&","'":"'","<":"<",">":">"},s={"&":"&","'":"'",">":">","<":"<",""":'"'},o=/&([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);/g,a=/&|<|>|"|'/g,c=/&|<|>/g;function l(e){return r[e]}t.escapeXML=function(e){return e.replace(a,l)},t.unescapeXML=function(e){return e.replace(o,e=>function(e){if(s[e])return s[e];const t=e.startsWith("&#x"),n=parseInt(e.substring(t?3:2,e.length-1),t?16:10);if(9===n||10===n||13===n||32<=n&&n<=55295||57344<=n&&n<=65533||65536<=n&&n<=1114111)return String.fromCodePoint(n);throw i.default.restrictedXML("Prohibited entity: "+e)}(e))},t.escapeXMLText=function(e){return e.replace(c,l)},t.basicLanguageResolver=function(e,t=[],n=""){const i=new Set(e.map(e=>e.toLowerCase()));for(let e of t.map(e=>e.toLowerCase()))if("*"!==e)for(;e.length>0;){if(i.has(e))return e;e=e.substring(0,e.lastIndexOf("-")).toLowerCase(),e.lastIndexOf("-")===e.length-2&&(e=e.substring(0,e.lastIndexOf("-")))}return n}},function(e,t,n){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,i,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,n)}));case 3:return t.nextTick((function(){e.call(null,n,i)}));case 4:return t.nextTick((function(){e.call(null,n,i,r)}));default:for(s=new Array(a-1),o=0;o<s.length;)s[o++]=arguments[o];return t.nextTick((function(){e.apply(null,s)}))}}}:e.exports=t}).call(this,n(11))},function(e,t,n){var i=n(12),r=i.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=i:(s(i,t),t.Buffer=o),s(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exportToSDP=t.importFromSDP=void 0;const i=n(0).__importStar(n(3));t.importFromSDP=function(e){const t=i.getMediaSections(e),n=i.getDescription(e),r={groups:[],media:[]};i.matchPrefix(n,"a=ice-lite").length>0&&(r.iceLite=!0);for(const e of i.matchPrefix(n,"a=group:")){const t=e.split(" "),n=t.shift().substr(8);r.groups.push({mids:t,semantics:n})}for(const e of t){const t=i.getKind(e),s=i.isRejected(e),o=i.parseMLine(e),a={direction:i.getDirection(e,n),kind:t,mid:i.getMid(e),protocol:o.protocol};if(s||(a.iceParameters=i.getIceParameters(e,n),a.dtlsParameters=i.getDtlsParameters(e,n),a.setup=i.matchPrefix(e,"a=setup:")[0].substr(8),r.iceLite&&(a.iceParameters.iceLite=!0)),"audio"===t||"video"===t){a.rtpParameters=i.parseRtpParameters(e),a.rtpEncodingParameters=i.parseRtpEncodingParameters(e),a.rtcpParameters=i.parseRtcpParameters(e);const t=i.parseMsid(e);a.streams=t?[t]:[]}else"application"===t&&(a.sctp=i.parseSctpDescription(e));a.candidates=i.matchPrefix(e,"a=candidate:").map(i.parseCandidate),r.media.push(a)}return r},t.exportToSDP=function(e){const t=[];t.push(i.writeSessionBoilerplate(e.sessionId,e.sessionVersion),"a=msid-semantic:WMS *\r\n"),(e.iceLite||e.media.filter(e=>e.iceParameters&&e.iceParameters.iceLite).length>0)&&t.push("a=ice-lite\r\n");for(const n of e.groups||[])t.push(`a=group:${n.semantics} ${n.mids.join(" ")}\r\n`);for(const n of e.media||[]){const e=!(n.iceParameters&&n.dtlsParameters);if("application"===n.kind&&n.sctp)t.push(i.writeSctpDescription(n,n.sctp));else if(n.rtpParameters){let r=i.writeRtpDescription(n.kind,n.rtpParameters);e&&(r=r.replace(`m=${n.kind} 9 `,`m=${n.kind} 0 `)),t.push(r),t.push(`a=${n.direction||"sendrecv"}\r\n`);for(const e of n.streams||[])t.push(`a=msid:${e.stream} ${e.track}\r\n`);if(n.rtcpParameters&&(t.push(i.writeRtcpParameters(n.rtcpParameters)),n.rtcpParameters.cname&&n.rtpEncodingParameters&&n.rtpEncodingParameters[0].rtx)){const e=n.rtpEncodingParameters[0];t.push(`a=ssrc-group:FID ${e.ssrc} ${e.rtx.ssrc}\r\n`),t.push(`a=ssrc:${e.rtx.ssrc} cname:${n.rtcpParameters.cname}\r\n`)}}if(void 0!==n.mid&&t.push(`a=mid:${n.mid}\r\n`),n.iceParameters&&t.push(i.writeIceParameters({usernameFragment:n.iceParameters.usernameFragment,password:n.iceParameters.password})),n.dtlsParameters&&n.setup&&t.push(i.writeDtlsParameters(n.dtlsParameters,n.setup)),n.candidates&&n.candidates.length)for(const e of n.candidates)t.push(`a=${i.writeCandidate(e)}\r\n`)}return t.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpClient=void 0;const i=n(14).__importStar(n(61)),r=n(8);class s{constructor(){this._httpRetryingRequests=new Map}requestApiWithRetry(e,t,n){const i=r.retryPromise(this.requestApi.bind(this,e,t),e=>{var n,i,r;let o=!1;if(null==e?void 0:e.response){o=s.retryStatusCodes.has(e.response.status||0);const a=(null===(n=e.response.headers)||void 0===n?void 0:n["retry-after"])||(null===(r=(i=e.response).getResponseHeader)||void 0===r?void 0:r.call(i,"retry-after"));a&&((t.logger||console).debug("retry-after header found on response. setting retry delay",{retryAfter:a}),o=1e3*parseInt(a,10))}return o},n,t.logger);return this._httpRetryingRequests.set(i._id,i),i.promise.then(()=>this.cancelRetryRequest(i._id),()=>this.cancelRetryRequest(i._id)),i}requestApi(e,t){const n=t.logger||console,r=(new Date).getTime(),s=this._buildUri(t.host,e,t.version),o={method:t.method,url:s,data:t.data,responseType:t.responseType,timeout:t.requestTimeout||3e4,headers:{"content-type":t.contentType||"application/json"}};t.noAuthHeader||(o.headers.Authorization="Bearer "+t.authToken);const a=this.handleResponse.bind(this,n,r,o);return i.default(o).then(a,a)}handleResponse(e,t,n,r){var s,o,a;let c=(new Date).getTime(),l=c-t+"ms";if(r instanceof i.AxiosError){if((null===(o=null===(s=r.config)||void 0===s?void 0:s.headers)||void 0===o?void 0:o.Authorization)&&(r.config.headers.Authorization="redacted"),"ECONNABORTED"===r.code)return e.debug("request error: "+n.url,{message:r.message,now:c,elapsed:l},{skipServer:!0}),Promise.reject(r);const t=r.response||{};let i=t.status,u=t.headers&&t.headers["inin-correlation-id"],d=t.data,p={...r,text:null===(a=t.request)||void 0===a?void 0:a.response};return e.debug("request error: "+n.url,{message:r.message,now:c,elapsed:l,status:i,correlationId:u,body:d},{skipServer:!0}),Promise.reject(p)}let u=r.status,d=r.headers["inin-correlation-id"],p=JSON.stringify(r.data);return e.debug(`response: ${n.method.toUpperCase()} ${n.url}`,{now:c,status:u,elapsed:l,correlationId:d,body:p},{skipServer:!0}),Promise.resolve(r)}stopAllRetries(){Array.from(this._httpRetryingRequests.keys()).forEach(e=>this.cancelRetryRequest(e))}cancelRetryRequest(e){const t=this._httpRetryingRequests.get(e);return t&&(t.cancel(new Error("Retry request cancelled")),this._httpRetryingRequests.delete(e)),!0}formatRequestError(e){if(this.isSuperagentNetworkError(e))return{status:e.status,method:e.method,url:e.url,crossDomain:e.crossDomain,message:e.message,name:e.name,stack:e.stack};if(this.isSuperagentResponseError(e)){const t=e.response;return{status:e.status,correlationId:t.headers["inin-correlation-id"],message:"Error making HTTP request",method:t.req.method,name:t.error.name,stack:t.error.stack}}return e}isSuperagentNetworkError(e){return e&&e.hasOwnProperty("status")&&e.hasOwnProperty("method")&&e.hasOwnProperty("url")}isSuperagentResponseError(e){return!!(e&&e.response&&e.response.body&&e.response.req)}_buildUri(e,t,n="v2"){return t=t.replace(/^\/+|\/+$/g,""),0===e.indexOf("http")?`${e}/api/${n}/${t}`:`https://api.${e}/api/${n}/${t}`}}t.HttpClient=s,s.retryStatusCodes=new Set([408,413,429,500,502,503,504])},function(e,t){var n=Object.prototype.hasOwnProperty;function i(e){return"[Throws: "+(e?e.message:"?")+"]"}function r(e){var t=[];return function e(r){if(null===r||"object"!=typeof r)return r;if(-1!==t.indexOf(r))return"[Circular]";if(t.push(r),"function"==typeof r.toJSON)try{var s=e(r.toJSON());return t.pop(),s}catch(e){return i(e)}if(Array.isArray(r)){var o=r.map(e);return t.pop(),o}var a=Object.keys(r).reduce((function(t,s){return t[s]=e(function(e,t){if(n.call(e,t))try{return e[t]}catch(e){return i(e)}return e[t]}(r,s)),t}),{});return t.pop(),a}(e)}e.exports=function(e,t,n){return JSON.stringify(r(e),t,n)},e.exports.ensureProperties=r},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";function i(e,t){return function(){return e.apply(t,arguments)}}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";t.a=null},function(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.JXTErrorCondition=void 0,function(e){e.NotWellFormed="not-well-formed",e.RestrictedXML="restricted-xml",e.AlreadyClosed="already-closed",e.UnknownRoot="unknown-stream-root"}(i=t.JXTErrorCondition||(t.JXTErrorCondition={}));class r extends Error{constructor(e){super(e.text),this.isJXTError=!0,this.condition=e.condition,this.text=e.text}static notWellFormed(e){return new r({condition:i.NotWellFormed,text:e})}static restrictedXML(e){return new r({condition:i.RestrictedXML,text:e})}static alreadyClosed(e){return new r({condition:i.AlreadyClosed,text:e})}static unknownRoot(e){return new r({condition:i.UnknownRoot,text:e})}}t.default=r},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.childAlternateLanguageRawElement=t.childLanguageRawElement=t.childRawElement=t.staticValue=t.splicePath=t.multipleChildEnum=t.multipleChildAlternateLanguageText=t.childAlternateLanguageText=t.multipleChildIntegerAttribute=t.multipleChildAttribute=t.multipleChildText=t.childDoubleEnum=t.childEnum=t.deepMultipleChildText=t.deepChildBoolean=t.deepChildInteger=t.deepChildText=t.childBoolean=t.childTimezoneOffset=t.childJSON=t.childFloat=t.childInteger=t.childDate=t.childTextBuffer=t.childText=t.childLanguageAttribute=t.languageAttribute=t.textBuffer=t.textJSON=t.text=t.childDateAttribute=t.childFloatAttribute=t.childIntegerAttribute=t.childBooleanAttribute=t.childAttribute=t.namespacedDateAttribute=t.namespacedFloatAttribute=t.namespacedIntegerAttribute=t.namespacedBooleanAttribute=t.namespacedAttribute=t.dateAttribute=t.floatAttribute=t.integerAttribute=t.booleanAttribute=t.attribute=t.findOrCreate=t.findAll=t.getTargetLang=t.getLang=t.createElement=void 0,t.parameterMap=void 0;const i=n(0).__importDefault(n(21)),r=n(33);function s(e,t,n,r){if(r){e=e||r.getNamespace();const n=r.getNamespaceRoot(e);if(n){t=`${n.useNamespace("",e)}:${t}`}}const s=new i.default(t);return t.indexOf(":")<0&&(!n||e!==n)&&s.setAttribute("xmlns",e),s}function o(e,t){return(e.getAttribute("xml:lang")||t||"").toLowerCase()}function a(e,t){const n=[];for(const i of e)n.push(o(i,t.lang));let i;return i=t.resolveLanguage?t.resolveLanguage(n,t.acceptLanguages||[],t.lang):t.lang,i||""}function c(e,t,n,i){const r=e.getChildren(n,t),s=o(e);return r.length?i?r.filter(e=>{if(o(e,s)===i)return!0}):r:[]}function l(e,t,n,i){t=t||e.getNamespace();const r=c(e,t,n,i);if(r.length)return r[0];const a=s(t,n,e.getDefaultNamespace(),e),l=o(e,i);return i&&l!==i&&a.setAttribute("xml:lang",i),e.appendChild(a),a}function u(e){return{importer(t){const n=t.getAttribute(e.name,e.namespace);return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);if(i||e.emitEmpty)if(e.namespace&&e.prefix){let n;const r=t.getNamespaceRoot(e.namespace);if(r)n=r.useNamespace(e.prefix,e.namespace);else{const i=t.getNamespaceContext();i[e.namespace]||(n=t.useNamespace(e.prefix,e.namespace),i[e.namespace]=n)}t.setAttribute(`${n}:${e.name}`,i,e.emitEmpty)}else t.setAttribute(e.name,i,e.emitEmpty)}}}function d(e,t){return(n,i,r={})=>(r={staticDefault:i,...r},u({name:n,...e,...t?t(r):r}))}function p(e,t){return(n,i,r,s,o={})=>(o={staticDefault:s,...o},u({name:r,namespace:i,prefix:n,...e,...t?t(o):o}))}function h(e){const t=e.converter||u({...e,namespace:e.attributeNamespace});return{importer(n,i){const r=n.getChild(e.element,e.namespace||n.getNamespace());return r?t.importer(r,i):e.dynamicDefault?e.dynamicDefault():e.staticDefault},exporter(n,i,r){if(void 0!==i&&i!==e.staticDefault){const s=l(n,e.namespace||n.getNamespace(),e.element);t.exporter(s,i,r)}}}}function f(e,t){return(n,i,r,s,o={})=>(o={staticDefault:s,...o},h({element:i,name:r,namespace:n,...e,...t?t(o):o}))}function m(e){return{importer(t){const n=t.getText();return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(!n&&e.emitEmpty)return void t.children.push("");if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);i&&t.children.push(i)}}}function g(e){const t=m(e);return{importer(n,i){const r=c(n,e.namespace||n.getNamespace(),e.element),s=a(r,i);if(!r.length)return e.dynamicDefault?e.dynamicDefault():e.staticDefault;if(e.matchLanguage)for(const e of r)if(o(e,i.lang)===s)return t.importer(e,i);return t.importer(r[0],i)},exporter(n,i,r){if(i||!e.emitEmpty){if(void 0!==i&&i!==e.staticDefault){const s=l(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0);t.exporter(s,i,r)}}else l(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0)}}}t.createElement=s,t.getLang=o,t.getTargetLang=a,t.findAll=c,t.findOrCreate=l;const v={parseValue:e=>e,writeValue:e=>e},b={parseValue:e=>parseInt(e,10),writeValue:e=>e.toString()},y={parseValue:e=>parseFloat(e),writeValue:e=>e.toString()},_={parseValue:e=>"true"===e||"1"===e||"false"!==e&&"0"!==e&&void 0,writeValue:e=>e?"1":"0"},S={parseValue:e=>new Date(e),writeValue:e=>"string"==typeof e?e:e.toISOString()},w={parseValue:e=>JSON.parse(e),writeValue:e=>JSON.stringify(e)},T=(t="utf8")=>({parseValue:n=>("base64"===t&&"="===n&&(n=""),e.from(n.trim(),t)),writeValue:n=>{let i;return i="string"==typeof n?e.from(n).toString(t):n?n.toString(t):"","base64"===t&&(i=i||"="),i}}),I={parseValue:e=>{let t=-1;"-"===e.charAt(0)&&(t=1,e=e.slice(1));const n=e.split(":");return(60*parseInt(n[0],10)+parseInt(n[1],10))*t},writeValue:e=>{if("string"==typeof e)return e;{let t="-";e<0&&(e=-e,t="+");const n=e/60,i=e%60;return t+=(n<10?"0":"")+n+":"+(i<10?"0":"")+i,t}}};t.attribute=d(v,e=>({dynamicDefault:e.emitEmpty?t=>""===t?"":e.staticDefault:void 0,...e})),t.booleanAttribute=d(_),t.integerAttribute=d(b),t.floatAttribute=d(y),t.dateAttribute=d(S),t.namespacedAttribute=p(v),t.namespacedBooleanAttribute=p(_),t.namespacedIntegerAttribute=p(b),t.namespacedFloatAttribute=p(y),t.namespacedDateAttribute=p(S),t.childAttribute=f(v),t.childBooleanAttribute=f(_),t.childIntegerAttribute=f(b),t.childFloatAttribute=f(y),t.childDateAttribute=f(S);t.text=e=>m({staticDefault:e,...v});t.textJSON=()=>m({...w});function x(){return{importer:(e,t)=>o(e,t.lang),exporter(e,t,n){t&&t.toLowerCase()!==n.lang?e.setAttribute("xml:lang",t):e.setAttribute("xml:lang",void 0)}}}t.textBuffer=(e="utf8")=>m({...T(e)}),t.languageAttribute=x;t.childLanguageAttribute=(e,t)=>h({converter:x(),element:t,name:"xml:lang",namespace:e,...v});t.childText=(e,t,n,i=!1)=>g({element:t,emitEmpty:i,matchLanguage:!0,namespace:e,staticDefault:n,...v});t.childTextBuffer=(e,t,n="utf8")=>g({element:t,matchLanguage:!0,namespace:e,...T(n)});t.childDate=(e,t)=>g({element:t,namespace:e,...S});t.childInteger=(e,t,n)=>g({element:t,namespace:e,staticDefault:n,...b});t.childFloat=(e,t,n)=>g({element:t,namespace:e,staticDefault:n,...y});t.childJSON=(e,t)=>g({element:t,namespace:e,...w}),t.childTimezoneOffset=function(e,t){return g({element:t,namespace:e,staticDefault:0,...I})},t.childBoolean=function(e,t){return{importer(n){if(n.getChild(t,e||n.getNamespace()))return!0},exporter(n,i){i&&l(n,e||n.getNamespace(),t)}}};const j=(e,t,n)=>{if(!n)return;let i=t;for(const t of e)i=l(i,t.namespace||i.getNamespace(),t.element);i.children.push(n.toString())};t.deepChildText=function(e,t){return{importer(n){let i=n;for(const n of e)if(i=i.getChild(n.element,n.namespace||i.getNamespace()),!i)return t;return i.getText()||t},exporter(t,n){j(e,t,n)}}},t.deepChildInteger=function(e,t){return{importer(n){let i=n;for(const t of e)if(i=i.getChild(t.element,t.namespace||i.getNamespace()),!i)return;const r=i.getText();return r?parseInt(r,10):t||void 0},exporter(t,n){j(e,t,n)}}},t.deepChildBoolean=function(e){return{importer(t){let n=t;for(const t of e)if(n=n.getChild(t.element,t.namespace||n.getNamespace()),!n)return!1;return!0},exporter(t,n){if(!n)return;let i=t;for(const t of e)i=l(i,t.namespace||i.getNamespace(),t.element)}}},t.deepMultipleChildText=function(e){const t=e.pop();return{importer(n,i){let r=n;for(const t of e)if(r=r.getChild(t.element,t.namespace||r.getNamespace()),!r)return[];const s=[],l=c(r,t.namespace||r.getNamespace(),t.element),u=a(l,i);for(const e of l)o(e,i.lang)===u&&s.push(e.getText());return s},exporter(n,i,r){if(!i.length)return;let o=n;for(const t of e)o=l(o,t.namespace||o.getNamespace(),t.element);const{namespace:a,element:c}=t;for(const e of i){const t=s(a||o.getNamespace(),c,r.namespace,o);t.children.push(e),o.appendChild(t)}}}},t.childEnum=function(e,t,n){const i=new Map,r=new Map;for(const e of t)"string"==typeof e?(i.set(e,e),r.set(e,e)):(i.set(e[1],e[0]),r.set(e[0],e[1]));return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&i.has(n.getName()))return i.get(n.getName());return n},exporter(t,n){r.has(n)&&l(t,e,r.get(n))}}},t.childDoubleEnum=function(e,t,n,i){const r=new Set(t),s=new Set(n);return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&r.has(n.getName())){for(const i of n.children)if("string"!=typeof i&&i.getNamespace()===(e||t.getNamespace())&&s.has(i.getName()))return[n.getName(),i.getName()];return[n.getName()]}return i},exporter(t,n){const i=l(t,e,n[0]);n[1]&&l(i,e,n[1])}}},t.multipleChildText=function(e,t){return{importer(n,i){const r=[],s=c(n,e||n.getNamespace(),t),l=a(s,i);for(const e of s)o(e,i.lang)===l&&r.push(e.getText());return r},exporter(n,i,r){for(const o of i){const i=s(e||n.getNamespace(),t,r.namespace,n);i.children.push(o),n.appendChild(i)}}}},t.multipleChildAttribute=function(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(t)}return r},exporter(i,r,o){for(const a of r){const r=s(e||i.getNamespace(),t,o.namespace,i);r.setAttribute(n,a),i.appendChild(r)}}}},t.multipleChildIntegerAttribute=function(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(parseInt(t,10))}return r},exporter(i,r,o){for(const a of r){const r=s(e||i.getNamespace(),t,o.namespace,i);r.setAttribute(n,a.toString()),i.appendChild(r)}}}},t.childAlternateLanguageText=function(e,t){return{importer(n,i){const r=[],s=c(n,e||n.getNamespace(),t),a=new Set;for(const e of s){const t=e.getText();if(t){const n=o(e,i.lang);if(a.has(n))continue;r.push({lang:n,value:t}),a.add(n)}}return a.size>0?r:void 0},exporter(n,i,r){for(const o of i){const i=o.value;if(i){const a=s(e||n.getNamespace(),t,r.namespace,n);o.lang!==r.lang&&a.setAttribute("xml:lang",o.lang),a.children.push(i),n.appendChild(a)}}}}},t.multipleChildAlternateLanguageText=function(e,t){return{importer(n,i){const r=[],s=new Map;let a=!1;const l=c(n,e||n.getNamespace(),t);for(const e of l){const t=e.getText();if(t){const n=o(e,i.lang);let c=s.get(n);c||(c=[],s.set(n,c),r.push({lang:n,value:c})),c.push(t),a=!0}}return a?r:void 0},exporter(n,i,r){for(const o of i)for(const i of o.value){const a=s(e||n.getNamespace(),t,r.namespace,n);o.lang!==r.lang&&a.setAttribute("xml:lang",o.lang),a.children.push(i),n.appendChild(a)}}}},t.multipleChildEnum=function(e,t){const n=new Map,i=new Map;for(const e of t)"string"==typeof e?(n.set(e,e),i.set(e,e)):(n.set(e[1],e[0]),i.set(e[0],e[1]));return{importer(t){const i=[];for(const r of t.children)"string"!=typeof r&&r.getNamespace()===(e||t.getNamespace())&&n.has(r.getName())&&i.push(n.get(r.getName()));return i},exporter(t,n){for(const r of n)l(t,e,i.get(r))}}},t.splicePath=function(e,t,n,i=!1){return{importer(r,s){const o=r.getChild(t,e||r.getNamespace());if(!o)return;const a=[];for(const e of o.children)if("string"!=typeof e&&s.registry.getImportKey(e)===n){const t=s.registry.import(e);t&&a.push(t)}return i?a:a[0]},exporter(i,r,s){let o=[];o=Array.isArray(r)?r:[r];const a=[];for(const t of o){const r=s.registry.export(n,t,{...s,namespace:e||i.getNamespace()||void 0});r&&a.push(r)}if(a.length){const n=l(i,e||i.getNamespace(),t);for(const e of a)n.appendChild(e)}}}},t.staticValue=function(e){return{exporter:()=>{},importer:()=>e}},t.childRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=i.getChild(t,e||i.getNamespace());return s?n?r.sanitizers[n](s.toJSON()):s.toJSON():void 0},exporter(s,o,a){if("string"==typeof o){o=r.parse(`<${t} xmlns="${e||s.getNamespace()}">${o}</${t}>`).toJSON()}if(n){if(!a.sanitizers||!a.sanitizers[n])return;o=a.sanitizers[n](o)}o&&s.appendChild(new i.default(o.name,o.attributes,o.children))}}},t.childLanguageRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=c(i,e||i.getNamespace(),t),l=a(s,r);for(const e of s)if(o(e,r.lang)===l)return n?r.sanitizers[n](e.toJSON()):e.toJSON();return s[0]?n?r.sanitizers[n](s[0].toJSON()):s[0].toJSON():void 0},exporter(s,o,a){if("string"==typeof o){o=r.parse(`<${t} xmlns="${e||s.getNamespace()}">${o}</${t}>`).toJSON()}if(o&&n){if(!a.sanitizers||!a.sanitizers[n])return;o=a.sanitizers[n](o)}if(!o)return;const c=l(s,e||s.getNamespace(),t,a.lang);for(const e of o.children)"string"==typeof e?c.appendChild(e):e&&c.appendChild(new i.default(e.name,e.attributes,e.children))}}},t.childAlternateLanguageRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=[],a=new Set,l=c(i,e||i.getNamespace(),t);for(const e of l){let t=e.toJSON();if(n&&(t=r.sanitizers[n](t)),t){const n=o(e,r.lang);if(a.has(n))continue;s.push({lang:n,value:t}),a.add(n)}}return a.size>0?s:void 0},exporter(o,a,c){for(const l of a){let a=l.value;if("string"==typeof a){a=r.parse(`<${t} xmlns="${e||o.getNamespace()}">${a}</${t}>`).toJSON()}if(a&&n){if(!c.sanitizers||!c.sanitizers[n])continue;a=c.sanitizers[n](a)}if(a){const n=s(e||o.getNamespace(),t,c.namespace,o);o.appendChild(n),l.lang!==c.lang&&n.setAttribute("xml:lang",l.lang);for(const e of a.children)"string"==typeof e?n.appendChild(e):n.appendChild(new i.default(e.name,e.attributes,e.children))}}}}},t.parameterMap=function(e,n,i,r){return{importer(s,o){const a={},l=c(s,e,n),u=t.attribute(i).importer,d=t.attribute(r).importer;for(const e of l)a[u(e,o)]=d(e,o);return a},exporter(o,a,c){const l=t.attribute(i).exporter,u=t.attribute(r).exporter,d=e||o.getNamespace();for(const[e,t]of Object.entries(a)){const i=s(d,n,c.namespace,o);l(i,e,c),a[e]&&u(i,t,c),o.appendChild(i)}}}}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parse=void 0;const i=n(0),r=n(4),s=n(22),o=i.__importDefault(n(21)),a=i.__importDefault(n(31));function c(e){return 97<=e&&e<=122||65<=e&&e<=90||58===e||95===e}function l(e){return 192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=767||880<=e&&e<=893||895<=e&&e<=8191||8204<=e&&e<=8205||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||65008<=e&&e<=65533||65536<=e&&e<=983039}function u(e){return c(e)||l(e)}function d(e){return c(e)||45===e||46===e||48<=e&&e<=57||183===e||768<=e&&e<=879||8255<=e&&e<=8256||l(e)}function p(e){return 32===e||10===e||13===e||9===e}class h extends r.EventEmitter{constructor(e={}){super(),this.allowComments=!0,this.attributes={},this.state=34,this.tagName="",this.haveDeclaration=!1,this.recordBuffer=[],void 0!==e.allowComments&&(this.allowComments=e.allowComments)}write(e){for(const t of e){const e=t.codePointAt(0);switch(this.state){case 34:if(60===e){let e;try{e=s.unescapeXML(this.endRecord())}catch(e){return void this.emit("error",e)}e&&this.emit("text",e),this.transition(31);continue}this.record(t);continue;case 31:if(47===e){this.transition(7);continue}if(33===e){this.transition(24);continue}if(63===e){this.haveDeclaration&&this.restrictedXML(),this.transition(25);continue}if(u(e)){this.transition(30),this.startRecord(t);continue}return this.notWellFormed();case 30:if(d(e)){this.record(t);continue}if(p(e)){this.startTag(),this.transition(32);continue}if(47===e){this.startTag(),this.transition(29);continue}if(62===e){this.startTag(),this.transition(34),this.emit("startElement",this.tagName,this.attributes);continue}return this.notWellFormed();case 29:if(62===e){this.emit("startElement",this.tagName,this.attributes),this.emit("endElement",this.tagName),this.transition(34);continue}return this.notWellFormed();case 33:if(p(e)){this.transition(32);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 32:if(p(e))continue;if(u(e)){this.startRecord(t),this.transition(0);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 7:if(u(e)){this.startRecord(t),this.transition(6);continue}return this.notWellFormed();case 6:if(d(e)){this.record(t);continue}if(p(e)){this.transition(8);continue}if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 8:if(p(e))continue;if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 0:if(d(e)){this.record(t);continue}if(61===e){this.addAttribute(),this.transition(4);continue}if(p(e)){this.addAttribute(),this.transition(3);continue}return this.notWellFormed();case 3:if(61===e){this.transition(4);continue}if(p(e))continue;return this.notWellFormed();case 4:if(34===e){this.startRecord(),this.transition(1);continue}if(39===e){this.startRecord(),this.transition(2);continue}if(p(e))continue;return this.notWellFormed();case 1:case 2:if(34===e&&1===this.state||39===e&&2===this.state){const e=this.endRecord();this.attributes[this.attributeName]=s.unescapeXML(e),this.transition(33);continue}if(60===e)return this.notWellFormed();this.record(t);continue;case 24:if(45===e){this.allowComments||this.restrictedXML(),this.transition(23);continue}if(91===e){this.transition(21);continue}return this.notWellFormed();case 23:if(45===e){this.transition(14);continue}return this.notWellFormed();case 14:45===e&&this.transition(12);continue;case 12:45===e?this.transition(11):this.transition(14);continue;case 11:62===e?this.transition(34):this.transition(14);continue;case 25:if(88===e||120===e){this.transition(28);continue}return this.notWellFormed();case 28:if(77===e||109===e){this.transition(27);continue}return this.notWellFormed();case 27:if(76===e||108===e){this.transition(26);continue}return this.notWellFormed();case 26:if(p(e)){this.haveDeclaration=!0,this.transition(15);continue}return this.notWellFormed();case 13:if(62===e){this.transition(34);continue}return this.notWellFormed();case 15:63===e&&this.transition(13);continue;case 21:this.wait(e,67,20);continue;case 20:this.wait(e,68,19);continue;case 19:this.wait(e,65,18);continue;case 18:this.wait(e,84,17);continue;case 17:this.wait(e,65,16);continue;case 16:this.wait(e,91,5);continue;case 5:if(93===e){this.transition(10);continue}this.record(t);continue;case 10:93===e?this.transition(9):(this.record(String.fromCodePoint(93)),this.record(t),this.transition(5));continue;case 9:if(62===e){const e=this.endRecord();e&&this.emit("text",e),this.transition(34)}else this.record(String.fromCodePoint(93)),this.record(String.fromCodePoint(93)),this.record(t),this.transition(5);continue}}}end(e){e&&this.write(e),this.write=()=>{}}record(e){this.recordBuffer.push(e)}startRecord(e){this.recordBuffer=[],e&&this.recordBuffer.push(e)}endRecord(){const e=this.recordBuffer;return this.recordBuffer=[],e.join("")}startTag(){this.tagName=this.endRecord(),this.attributes={}}addAttribute(){const e=this.endRecord();if(void 0!==this.attributes[e])return this.notWellFormed();this.attributeName=e,this.attributes[e]=""}wait(e,t,n){if(e!==t)return this.notWellFormed();this.transition(n)}transition(e){this.state=e,34===e&&this.startRecord()}notWellFormed(e){this.emit("error",a.default.notWellFormed(e))}restrictedXML(e){this.emit("error",a.default.restrictedXML(e))}}t.parse=function(e,t={}){const n=new h(t);let i,r,s=null;if(n.on("text",e=>{r&&r.children.push(e)}),n.on("startElement",(e,t)=>{const n=new o.default(e,t);i||(i=n),r=r?r.appendChild(n):n}),n.on("endElement",e=>{r?e===r.name?r.parent&&(r=r.parent):n.emit("error",a.default.notWellFormed("b")):n.emit("error",a.default.notWellFormed("a"))}),n.on("error",e=>{s=e}),n.write(e),n.end(),s)throw s;return i},t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StanzaMediaSession=void 0;const i=n(14),r=i.__importDefault(n(4)),s=n(108),o=n(9),a=i.__importDefault(n(60)),c=n(19),l={"Discovered new ICE candidate":{skipMessage:!0}};class u extends s.MediaSession{constructor(e){super(e.options),this.iceCandidatesDiscovered=0,this.iceCandidatesReceivedFromPeer=0,this.reinvite=!1,this.logger=e.logger,this.conversationId=e.conversationId,this.peerConnection=this.pc,this.fromUserId=e.fromUserId,this.id=this.sid,this.originalRoomJid=e.originalRoomJid,this.sessionType=c.SessionTypes[e.sessionType],this.ignoreHostCandidatesFromRemote=!!e.ignoreHostCandidatesFromRemote,this.allowIPv6=!!e.allowIPv6,this.allowTCP=!!e.allowTCP;const t=new r.default;Object.keys(t.__proto__).forEach(e=>{this[e]=t[e]}),e.optOutOfWebrtcStatsTelemetry||this.setupStatsGatherer(),this.pc.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.pc.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this))}getLogDetails(){return{conversationId:this.conversationId,sessionId:this.id,sessionType:this.sessionType}}async onTransportInfo(e,t){var n,i;const r=null===(n=e.contents)||void 0===n?void 0:n[0].transport,s=null==r?void 0:r.candidates;if(this.ignoreHostCandidatesFromRemote){const e=null==s?void 0:s.filter(e=>"host"!==e.type);(null==e?void 0:e.length)!==(null===(i=null==r?void 0:r.candidates)||void 0===i?void 0:i.length)&&(this._log("info","Ignoring remote host ice candidates"),r.candidates=e)}if(s)for(const e of s)this._log("info","Received candidate from peer",{candidateType:e.type}),this.iceCandidatesReceivedFromPeer++;return super.onTransportInfo(e,t)}_log(e,t,...n){const i=l[t];if(null==i?void 0:i.skipMessage)return;let r;if(n.length){const e=n[0];"object"!=typeof e||Array.isArray(e)||null===e?r={...this.getLogDetails(),data:e}:(Object.assign(n[0],this.getLogDetails()),r=n)}else r=[...n,this.getLogDetails()];this.logger[e](t,r)}async end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),setTimeout(()=>{"connected"!==this.pc.connectionState&&"connecting"!==this.pc.connectionState||this.pc.close()},2e3),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}setupStatsGatherer(){this.statsGatherer=new a.default(this.pc),this.statsGatherer.on("stats",this.emit.bind(this,"stats"))}onIceStateChange(){const e=this.pc.iceConnectionState,t=this.id,n=this.conversationId,i=this.sessionType;this._log("info","ICE state changed: ",{iceState:e,sessionId:t,conversationId:n}),"disconnected"===e?"stable"===this.pc.signalingState&&(this.interruptionStart=new Date,this._log("info","Connection state is interrupted",{sessionId:t,conversationId:n,sessionType:i})):"connected"===e?(this._log("info","sending session-info: active"),this.send(o.JingleAction.SessionInfo,{info:{infoType:o.JINGLE_INFO_ACTIVE}}),this._setupDataChannel()):"failed"===e&&this._log("info","ICE connection failed",{candidatesDiscovered:this.iceCandidatesDiscovered,candidatesReceivedFromPeer:this.iceCandidatesReceivedFromPeer}),super.onIceStateChange()}onConnectionStateChange(){const e=this.pc.connectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this._log("info","Connection state changed: ",{connectionState:e,sessionId:t,conversationId:n,sessionType:i}),this.interruptionStart)if("connected"===e){const e=(new Date).getTime()-this.interruptionStart.getTime();this._log("info","Connection was interrupted but was successfully recovered/connected",{sessionId:t,conversationId:n,sessionType:i,timeToRecover:e}),this.interruptionStart=void 0}else"failed"===e&&this._log("info","Connection was interrupted and failed to recover",{sessionId:t,conversationId:n,sessionType:i})}onIceCandidateError(e){const t=e;this._log("error","IceCandidateError",{errorCode:t.errorCode,errorText:t.errorText,url:t.url}),console.error("IceCandidateError",t)}onIceCandidate(e){if(e.candidate){if(!this.allowTCP&&"tcp"===e.candidate.protocol)return;if(!this.allowIPv6){const t=/.+udp [^ ]+ ([^ ]+).*typ host/.exec(e.candidate.candidate),n=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;if(t&&!t[1].match(n))return void this._log("debug","Filtering out IPv6 candidate",e.candidate.candidate)}this._log("debug","Processing ice candidate",e.candidate.candidate),this._log("info","Discovered ice candidate to send to peer",{type:e.candidate.type}),this.iceCandidatesDiscovered++}return super.onIceCandidate(e)}onIceEndOfCandidates(){super.onIceEndOfCandidates(),this.emit("endOfCandidates")}addTrack(e,t){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",async()=>{const n=this.pc.getTransceivers().find(t=>{var n;return!t.sender.track&&(null===(n=t.receiver.track)||void 0===n?void 0:n.kind)===e.kind});if(n)return n.sender.replaceTrack(e);this.pc.addTrack(e,t)})}_setupDataChannel(){var e;this.dataChannel||(null===(e=this.pc.localDescription)||void 0===e?void 0:e.sdp.includes("webrtc-datachannel"))&&(this._log("info","creating data channel"),this.dataChannel=this.pc.createDataChannel("videoConferenceControl"),this.dataChannel.addEventListener("open",()=>{this._log("info","data channel opened")}),this.dataChannel.addEventListener("message",this._handleDataChannelMessage.bind(this)),this.dataChannel.addEventListener("close",()=>{this._log("info","closing data channel")}),this.dataChannel.addEventListener("error",e=>{this._log("error","Error occurred with the data channel",e)}))}_handleDataChannelMessage(e){try{const t=JSON.parse(e.data);this.emit("dataChannelMessage",t)}catch(e){this._log("error","Failed to parse data channel message",{error:e})}}}t.StanzaMediaSession=u},function(e,t,n){"use strict";n.r(t),function(e,i){n.d(t,"Hash",(function(){return s})),n.d(t,"Hmac",(function(){return F})),n.d(t,"RTCPeerConnection",(function(){return G})),n.d(t,"WebSocket",(function(){return J})),n.d(t,"createHash",(function(){return L})),n.d(t,"createHmac",(function(){return U})),n.d(t,"fetch",(function(){return z})),n.d(t,"getHashes",(function(){return B})),n.d(t,"randomBytes",(function(){return D}));var r=n(7);class s extends r.Transform{constructor(t,n,i="be"){super(),this._block=e.alloc(t),this._finalSize=n,this._blockSize=t,this._bigEndian="be"===i,this._len=0}_transform(e,t,n){let i=null;try{this.update(e,t)}catch(e){i=e}n(i)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(t,n){"string"==typeof t&&(n=n||"utf8",t=e.from(t,n));const i=this._block,r=this._blockSize,s=t.length;let o=this._len;for(let e=0;e<s;){const n=o%r,a=Math.min(s-e,r-n);for(let r=0;r<a;r++)i[n+r]=t[e+r];o+=a,e+=a,o%r==0&&this._update(i)}return this._len+=s,this}digest(e){const t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));const n=8*this._len;if(n<=4294967295)this._bigEndian?(this._block.writeUInt32BE(0,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)):(this._block.writeUInt32LE(n,this._blockSize-8),this._block.writeUInt32LE(0,this._blockSize-4));else{const e=(4294967295&n)>>>0,t=(n-e)/4294967296;this._bigEndian?(this._block.writeUInt32BE(t,this._blockSize-8),this._block.writeUInt32BE(e,this._blockSize-4)):(this._block.writeUInt32LE(e,this._blockSize-8),this._block.writeUInt32LE(t,this._blockSize-4))}this._update(this._block);const i=this._hash();return e?i.toString(e):i}_update(e){throw new Error("_update must be implemented by subclass")}_hash(){throw new Error("_update must be implemented by subclass")}}function o(e,t){return e<<t|e>>>32-t}function a(e,t,n,i,r,s,a){return o(e+(t&n|~t&i)+r+s|0,a)+t|0}function c(e,t,n,i,r,s,a){return o(e+(t&i|n&~i)+r+s|0,a)+t|0}function l(e,t,n,i,r,s,a){return o(e+(t^n^i)+r+s|0,a)+t|0}function u(e,t,n,i,r,s,a){return o(e+(n^(t|~i))+r+s|0,a)+t|0}const d=[1518500249,1859775393,-1894007588,-899497514];function p(e){return e<<5|e>>>27}function h(e){return e<<30|e>>>2}function f(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}class m extends s{constructor(){super(64,56),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this._w=new Array(80)}_update(e){const t=this._w;let n,i=0|this._a,r=0|this._b,s=0|this._c,o=0|this._d,a=0|this._e;for(n=0;n<16;++n)t[n]=e.readInt32BE(4*n);for(;n<80;++n)t[n]=(c=t[n-3]^t[n-8]^t[n-14]^t[n-16])<<1|c>>>31;var c;for(let e=0;e<80;++e){const n=~~(e/20),c=p(i)+f(n,r,s,o)+a+t[e]+d[n]|0;a=o,o=s,s=h(r),r=i,i=c}this._a=i+this._a|0,this._b=r+this._b|0,this._c=s+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0}_hash(){const t=e.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t}}const g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(e,t,n){return n^e&(t^n)}function b(e,t,n){return e&t|n&(e|t)}function y(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function _(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function S(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}class w extends s{constructor(){super(64,56),this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this._w=new Array(64)}_update(e){const t=this._w;let n,i=0|this._a,r=0|this._b,s=0|this._c,o=0|this._d,a=0|this._e,c=0|this._f,l=0|this._g,u=0|this._h;for(n=0;n<16;++n)t[n]=e.readInt32BE(4*n);for(;n<64;++n)t[n]=0|(((d=t[n-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10)+t[n-7]+S(t[n-15])+t[n-16];var d;for(let e=0;e<64;++e){const n=u+_(a)+v(a,c,l)+g[e]+t[e]|0,d=y(i)+b(i,r,s)|0;u=l,l=c,c=a,a=o+n|0,o=s,s=r,r=i,i=n+d|0}this._a=i+this._a|0,this._b=r+this._b|0,this._c=s+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=c+this._f|0,this._g=l+this._g|0,this._h=u+this._h|0}_hash(){const t=e.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t}}const T=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function I(e,t,n){return n^e&(t^n)}function x(e,t,n){return e&t|n&(e|t)}function j(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function k(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function E(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function C(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function N(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function O(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function R(e,t){return e>>>0<t>>>0?1:0}class A extends s{constructor(){super(128,112),this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this._w=new Array(160)}_update(e){const t=this._w;let n,i,r=0|this._ah,s=0|this._bh,o=0|this._ch,a=0|this._dh,c=0|this._eh,l=0|this._fh,u=0|this._gh,d=0|this._hh,p=0|this._al,h=0|this._bl,f=0|this._cl,m=0|this._dl,g=0|this._el,v=0|this._fl,b=0|this._gl,y=0|this._hl,_=0;for(_=0;_<32;_+=2)t[_]=e.readInt32BE(4*_),t[_+1]=e.readInt32BE(4*_+4);for(;_<160;_+=2){let e=t[_-30],r=t[_-30+1];const s=E(e,r),o=C(r,e);e=t[_-4],r=t[_-4+1];const a=N(e,r),c=O(r,e),l=t[_-14],u=t[_-14+1],d=t[_-32],p=t[_-32+1];i=o+u|0,n=s+l+R(i,o)|0,i=i+c|0,n=n+a+R(i,c)|0,i=i+p|0,n=n+d+R(i,p)|0,t[_]=n,t[_+1]=i}for(let e=0;e<160;e+=2){n=t[e],i=t[e+1];const _=x(r,s,o),S=x(p,h,f),w=j(r,p),E=j(p,r),C=k(c,g),N=k(g,c),O=T[e],A=T[e+1],P=I(c,l,u),L=I(g,v,b);let q=y+N|0,F=d+C+R(q,y)|0;q=q+L|0,F=F+P+R(q,L)|0,q=q+A|0,F=F+O+R(q,A)|0,q=q+i|0,F=F+n+R(q,i)|0;const M=E+S|0,D=w+_+R(M,E)|0;d=u,y=b,u=l,b=v,l=c,v=g,g=m+q|0,c=a+F+R(g,m)|0,a=o,m=f,o=s,f=h,s=r,h=p,p=q+M|0,r=F+D+R(p,q)|0}this._al=this._al+p|0,this._bl=this._bl+h|0,this._cl=this._cl+f|0,this._dl=this._dl+m|0,this._el=this._el+g|0,this._fl=this._fl+v|0,this._gl=this._gl+b|0,this._hl=this._hl+y|0,this._ah=this._ah+r+R(this._al,p)|0,this._bh=this._bh+s+R(this._bl,h)|0,this._ch=this._ch+o+R(this._cl,f)|0,this._dh=this._dh+a+R(this._dl,m)|0,this._eh=this._eh+c+R(this._el,g)|0,this._fh=this._fh+l+R(this._fl,v)|0,this._gh=this._gh+u+R(this._gl,b)|0,this._hh=this._hh+d+R(this._hl,y)|0}_hash(){const t=e.allocUnsafe(64);function n(e,n,i){t.writeInt32BE(e,i),t.writeInt32BE(n,i+4)}return n(this._ah,this._al,0),n(this._bh,this._bl,8),n(this._ch,this._cl,16),n(this._dh,this._dl,24),n(this._eh,this._el,32),n(this._fh,this._fl,40),n(this._gh,this._gl,48),n(this._hh,this._hl,56),t}}const P=new Map([["md5",class extends s{constructor(){super(64,56,"le"),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._m=new Array(16)}_update(e){const t=this._m;for(let n=0;n<16;++n)t[n]=e.readInt32LE(4*n);let n=this._a,i=this._b,r=this._c,s=this._d;n=a(n,i,r,s,t[0],3614090360,7),s=a(s,n,i,r,t[1],3905402710,12),r=a(r,s,n,i,t[2],606105819,17),i=a(i,r,s,n,t[3],3250441966,22),n=a(n,i,r,s,t[4],4118548399,7),s=a(s,n,i,r,t[5],1200080426,12),r=a(r,s,n,i,t[6],2821735955,17),i=a(i,r,s,n,t[7],4249261313,22),n=a(n,i,r,s,t[8],1770035416,7),s=a(s,n,i,r,t[9],2336552879,12),r=a(r,s,n,i,t[10],4294925233,17),i=a(i,r,s,n,t[11],2304563134,22),n=a(n,i,r,s,t[12],1804603682,7),s=a(s,n,i,r,t[13],4254626195,12),r=a(r,s,n,i,t[14],2792965006,17),i=a(i,r,s,n,t[15],1236535329,22),n=c(n,i,r,s,t[1],4129170786,5),s=c(s,n,i,r,t[6],3225465664,9),r=c(r,s,n,i,t[11],643717713,14),i=c(i,r,s,n,t[0],3921069994,20),n=c(n,i,r,s,t[5],3593408605,5),s=c(s,n,i,r,t[10],38016083,9),r=c(r,s,n,i,t[15],3634488961,14),i=c(i,r,s,n,t[4],3889429448,20),n=c(n,i,r,s,t[9],568446438,5),s=c(s,n,i,r,t[14],3275163606,9),r=c(r,s,n,i,t[3],4107603335,14),i=c(i,r,s,n,t[8],1163531501,20),n=c(n,i,r,s,t[13],2850285829,5),s=c(s,n,i,r,t[2],4243563512,9),r=c(r,s,n,i,t[7],1735328473,14),i=c(i,r,s,n,t[12],2368359562,20),n=l(n,i,r,s,t[5],4294588738,4),s=l(s,n,i,r,t[8],2272392833,11),r=l(r,s,n,i,t[11],1839030562,16),i=l(i,r,s,n,t[14],4259657740,23),n=l(n,i,r,s,t[1],2763975236,4),s=l(s,n,i,r,t[4],1272893353,11),r=l(r,s,n,i,t[7],4139469664,16),i=l(i,r,s,n,t[10],3200236656,23),n=l(n,i,r,s,t[13],681279174,4),s=l(s,n,i,r,t[0],3936430074,11),r=l(r,s,n,i,t[3],3572445317,16),i=l(i,r,s,n,t[6],76029189,23),n=l(n,i,r,s,t[9],3654602809,4),s=l(s,n,i,r,t[12],3873151461,11),r=l(r,s,n,i,t[15],530742520,16),i=l(i,r,s,n,t[2],3299628645,23),n=u(n,i,r,s,t[0],4096336452,6),s=u(s,n,i,r,t[7],1126891415,10),r=u(r,s,n,i,t[14],2878612391,15),i=u(i,r,s,n,t[5],4237533241,21),n=u(n,i,r,s,t[12],1700485571,6),s=u(s,n,i,r,t[3],2399980690,10),r=u(r,s,n,i,t[10],4293915773,15),i=u(i,r,s,n,t[1],2240044497,21),n=u(n,i,r,s,t[8],1873313359,6),s=u(s,n,i,r,t[15],4264355552,10),r=u(r,s,n,i,t[6],2734768916,15),i=u(i,r,s,n,t[13],1309151649,21),n=u(n,i,r,s,t[4],4149444226,6),s=u(s,n,i,r,t[11],3174756917,10),r=u(r,s,n,i,t[2],718787259,15),i=u(i,r,s,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+i|0,this._c=this._c+r|0,this._d=this._d+s|0}_hash(){const t=e.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t}}],["sha-1",m],["sha-256",w],["sha-512",A],["sha1",m],["sha256",w],["sha512",A]]);function L(e){e=e.toLowerCase();const t=P.get(e);if(t)return new t;throw new Error("Unsupported hash algorithm: "+e)}const q=e.alloc(128);class F extends r.Transform{constructor(t,n){super(),"string"==typeof n&&(n=e.from(n));const i="sha512"===t?128:64;this._alg=t,n.length>i?n=L(t).update(n).digest():n.length<i&&(n=e.concat([n,q],i)),this._ipad=e.alloc(i),this._opad=e.alloc(i);for(let e=0;e<i;e++)this._ipad[e]=54^n[e],this._opad[e]=92^n[e];this._hash=L(t).update(this._ipad)}_transform(e,t,n){let i;try{this.update(e,t)}catch(e){i=e}finally{n(i)}}_flush(e){let t;try{this.push(this._final())}catch(e){t=e}e(t)}_final(){const e=this._hash.digest();return L(this._alg).update(this._opad).update(e).digest()}update(e,t){return this._hash.update(e,t),this}digest(t){const n=this._final()||e.alloc(0);return t?n.toString(t):n}}let M;function D(t){const n=new Uint8Array(t);return t>0&&(M.crypto||M.msCrypto).getRandomValues(n),e.from(n.buffer)}function B(){return["sha-1","sha-256","sha-512","md5"]}function U(e,t){return new F(e.toLowerCase(),t)}"undefined"!=typeof window?M=window:void 0!==i&&(M=i);const z=fetch,J=WebSocket,G=M.RTCPeerConnection}.call(this,n(12).Buffer,n(6))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=i.__importStar(n(3)),s=n(9),o=n(13),a=n(25),c=n(37),l=i.__importDefault(n(38));class u extends l.default{constructor(e){super(e),this.bitrateLimit=0,this.candidateBuffer=[],this.transportType=o.NS_JINGLE_ICE_UDP_1,this.restartingIce=!1,this.usingRelay=!1,this.maxRelayBandwidth=e.maxRelayBandwidth,this.pc=this.parent.createPeerConnection(this,{...e.config,iceServers:e.iceServers}),this.pc.oniceconnectionstatechange=()=>{this.onIceStateChange()},this.pc.onicecandidate=e=>{e.candidate?this.onIceCandidate(e):this.onIceEndOfCandidates()},this.restrictRelayBandwidth()}end(e="success",t=!1){this.pc.close(),super.end(e,t)}async restartIce(){if(this.isInitiator){void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this.restartingIce=!0;try{await this.processLocal("restart-ice",async()=>{const e=await this.pc.createOffer({iceRestart:!0}),t=a.importFromSDP(e.sdp);this.send(s.JingleAction.TransportInfo,{contents:t.media.map(e=>({creator:s.JingleSessionRole.Initiator,name:e.mid,transport:c.convertIntermediateToTransport(e,this.transportType)})),sid:this.sid}),await this.pc.setLocalDescription(e)})}catch(e){this._log("error","Could not create WebRTC offer",e),this.end(s.JingleReasonCondition.FailedTransport,!0)}}}async setMaximumBitrate(e){this.maximumBitrate&&(e=Math.min(e,this.maximumBitrate)),this.currentBitrate=e;const t=this.pc.getSenders().find(e=>!!e.track&&"video"===e.track.kind);if(t&&t.getParameters)try{await this.processLocal("set-bitrate",async()=>{const n=t.getParameters();n.encodings&&n.encodings.length||(n.encodings=[{}]),0===e?delete n.encodings[0].maxBitrate:n.encodings[0].maxBitrate=e,await t.setParameters(n)})}catch(e){this._log("error","Set maximumBitrate failed",e)}}async onTransportInfo(e,t){if(e.contents&&e.contents[0]&&e.contents[0].transport.gatheringComplete){const n={sdpMid:e.contents[0].name,candidate:""};try{"stable"===this.pc.signalingState?await this.pc.addIceCandidate(n):this.candidateBuffer.push(n)}catch(e){this._log("debug","Could not add null end-of-candidate")}finally{t()}return}if(this.pc.remoteDescription){const n=this.pc.remoteDescription,i=a.importFromSDP(n.sdp),r=i.media.find(t=>t.mid===e.contents[0].name).iceParameters.usernameFragment,o=e.contents[0].transport.usernameFragment;if(o&&r!==o){for(const[t,n]of e.contents.entries()){const e=n.transport;i.media[t].iceParameters={password:e.password,usernameFragment:e.usernameFragment},i.media[t].candidates=[]}try{if(await this.pc.setRemoteDescription({type:n.type,sdp:a.exportToSDP(i)}),await this.processBufferedCandidates(),"offer"===n.type){const e=await this.pc.createAnswer();await this.pc.setLocalDescription(e);const t=a.importFromSDP(e.sdp);this.send(s.JingleAction.TransportInfo,{contents:t.media.map(e=>({creator:s.JingleSessionRole.Initiator,name:e.mid,transport:c.convertIntermediateToTransport(e,this.transportType)})),sid:this.sid})}else this.restartingIce=!1}catch(e){return this._log("error","Could not do remote ICE restart",e),t(e),void this.end(s.JingleReasonCondition.FailedTransport)}}}const n=(e.contents||[]).map(e=>{const t=e.name,n=(e.transport.candidates||[]).map(async e=>{const n=r.writeCandidate(c.convertCandidateToIntermediate(e));if(this.pc.remoteDescription&&"stable"===this.pc.signalingState)try{await this.pc.addIceCandidate({sdpMid:t,candidate:n})}catch(e){this._log("error","Could not add ICE candidate",e)}else this.candidateBuffer.push({sdpMid:t,candidate:n})});return Promise.all(n)});try{await Promise.all(n),t()}catch(e){this._log("error","Could not process transport-info: "+e),t(e)}}async onSessionAccept(e,t){this.state="active";const n=c.convertRequestToIntermediate(e,this.peerRole),i=a.exportToSDP(n);try{await this.pc.setRemoteDescription({type:"answer",sdp:i}),await this.processBufferedCandidates(),this.parent.emit("accepted",this,void 0),t()}catch(e){this._log("error","Could not process WebRTC answer: "+e),t({condition:"general-error"})}}onSessionTerminate(e,t){this._log("info","Terminating session"),this.pc.close(),super.end(e.reason,!0),t()}onIceCandidate(e){if(!e.candidate||!e.candidate.candidate)return;const t=r.parseCandidate(e.candidate.candidate),n={contents:[{creator:s.JingleSessionRole.Initiator,name:e.candidate.sdpMid,transport:{candidates:[c.convertIntermediateToCandidate(t)],transportType:this.transportType,usernameFragment:t.usernameFragment}}]};this._log("info","Discovered new ICE candidate",n),this.send(s.JingleAction.TransportInfo,n)}onIceEndOfCandidates(){this._log("info","ICE end of candidates");const e=a.importFromSDP(this.pc.localDescription.sdp).media[0];this.send(s.JingleAction.TransportInfo,{contents:[{creator:s.JingleSessionRole.Initiator,name:e.mid,transport:{gatheringComplete:!0,transportType:this.transportType,usernameFragment:e.iceParameters.usernameFragment}}]})}onIceStateChange(){switch(this.pc.iceConnectionState){case"checking":this.connectionState="connecting";break;case"completed":case"connected":this.connectionState="connected";break;case"disconnected":if("stable"===this.pc.signalingState?this.connectionState="interrupted":this.connectionState="disconnected",this.restartingIce)return void this.end(s.JingleReasonCondition.FailedTransport);this.maybeRestartIce();break;case"failed":if("failed"===this.connectionState||this.restartingIce)return void this.end(s.JingleReasonCondition.FailedTransport);this.connectionState="failed",this.restartIce();break;case"closed":this.connectionState="disconnected",this.restartingIce?this.end(s.JingleReasonCondition.FailedTransport):this.end()}}async processBufferedCandidates(){for(const e of this.candidateBuffer)try{await this.pc.addIceCandidate(e)}catch(e){this._log("error","Could not add ICE candidate",e)}this.candidateBuffer=[]}restrictRelayBandwidth(){this.pc.addEventListener("iceconnectionstatechange",async()=>{if("completed"!==this.pc.iceConnectionState&&"connected"!==this.pc.iceConnectionState)return;const e=await this.pc.getStats();let t;if(e.forEach(n=>{"transport"===n.type&&(t=e.get(n.selectedCandidatePairId))}),t||e.forEach(e=>{"candidate-pair"===e.type&&e.selected&&(t=e)}),!t)return;let n=!1,i="",r="";if(t.remoteCandidateId){const n=e.get(t.remoteCandidateId);n&&(r=n.candidateType)}if(t.localCandidateId){const n=e.get(t.localCandidateId);n&&(i=n.candidateType)}"relay"!==i&&"relay"!==r||(n=!0),this.usingRelay=n,this.parent.emit("iceConnectionType",this,{localCandidateType:i,relayed:n,remoteCandidateType:r}),n&&void 0!==this.maxRelayBandwidth&&(this.maximumBitrate=this.maxRelayBandwidth,this.currentBitrate?this.setMaximumBitrate(Math.min(this.currentBitrate,this.maximumBitrate)):this.setMaximumBitrate(this.maximumBitrate))})}maybeRestartIce(){this.isInitiator&&(void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this._maybeRestartingIce=setTimeout(()=>{this._maybeRestartingIce=void 0,"disconnected"===this.pc.iceConnectionState&&this.restartIce()},2e3))}}t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertRequestToIntermediate=t.convertContentToIntermediate=t.convertIntermediateToRequest=t.convertIntermediateToTransport=t.convertCandidateToIntermediate=t.convertIntermediateToCandidate=t.convertIntermediateToApplication=void 0;const i=n(9),r=n(13);function s(e,t){const n=e.rtpParameters,s=e.rtcpParameters||{},o=e.rtpEncodingParameters||[];let a=!1;o&&o.length&&(a=!!o[0].ssrc);const c={applicationType:r.NS_JINGLE_RTP_1,codecs:[],headerExtensions:[],media:e.kind,rtcpMux:s.mux,rtcpReducedSize:s.reducedSize,sourceGroups:[],sources:[],ssrc:a?o[0].ssrc.toString():void 0,streams:[]};for(const e of n.headerExtensions||[]){const n={id:e.id,uri:e.uri};e.direction&&"sendrecv"!==e.direction&&(n.senders=i.directionToSenders(t,e.direction)),c.headerExtensions.push(n)}s.ssrc&&s.cname&&(c.sources=[{parameters:{cname:s.cname},ssrc:s.ssrc.toString()}]),a&&o[0]&&o[0].rtx&&(c.sourceGroups=[{semantics:"FID",sources:[o[0].ssrc.toString(),o[0].rtx.ssrc.toString()]}]);for(const t of e.streams||[])c.streams.push({id:t.stream,track:t.track});for(const e of n.codecs||[]){const t={channels:e.channels,clockRate:e.clockRate,id:e.payloadType.toString(),name:e.name,parameters:e.parameters,rtcpFeedback:e.rtcpFeedback};e.maxptime&&(t.maxptime=e.maxptime),e.parameters&&e.parameters.ptime&&(t.ptime=parseInt(e.parameters.ptime,10)),c.codecs.push(t)}return c}function o(e){let t;return t="rtp"===e.component?1:"rtcp"===e.component?2:e.component,{component:t,foundation:e.foundation,generation:void 0,id:void 0,ip:e.ip,network:void 0,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function a(e){return{address:e.ip,component:1===e.component?"rtp":2===e.component?"rtcp":e.component,foundation:e.foundation,ip:e.ip,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function c(e,t){const n=e.iceParameters,i=e.dtlsParameters,r={candidates:[],transportType:t};n&&(r.usernameFragment=n.usernameFragment,r.password=n.password,n.iceLite&&(r.iceLite=!0)),i&&(r.fingerprints=i.fingerprints.map(t=>({algorithm:t.algorithm,setup:e.setup,value:t.value}))),e.sctp&&(r.sctp=e.sctp);for(const t of e.candidates||[])r.candidates.push(o(t));return r}function l(e,t){const n=e.application||{},s=e.transport,o=n&&n.applicationType===r.NS_JINGLE_RTP_1,c={direction:i.sendersToDirection(t,e.senders),kind:n.media||"application",mid:e.name,protocol:o?"UDP/TLS/RTP/SAVPF":"UDP/DTLS/SCTP"};if(o){if(c.rtcpParameters={compound:!n.rtcpReducedSize,mux:n.rtcpMux,reducedSize:n.rtcpReducedSize},n.sources&&n.sources.length){const e=n.sources[0];c.rtcpParameters.ssrc=parseInt(e.ssrc,10),e.parameters&&(c.rtcpParameters.cname=e.parameters.cname)}if(c.rtpParameters={codecs:[],fecMechanisms:[],headerExtensions:[],rtcp:[]},n.streams){c.streams=[];for(const e of n.streams)c.streams.push({stream:e.id,track:e.track})}if(n.ssrc&&(c.rtpEncodingParameters=[{ssrc:parseInt(n.ssrc,10)}],n.sourceGroups&&n.sourceGroups.length)){const e=n.sourceGroups[0];c.rtpEncodingParameters[0].rtx={ssrc:parseInt(e.sources[1],10)}}let e=!1,r=!1;for(const t of n.codecs||[]){const n=t.parameters||{},i=[];for(const e of t.rtcpFeedback||[])i.push({parameter:e.parameter,type:e.type});if("red"===t.name||"ulpfec"===t.name){e=e||"red"===t.name,r=r||"ulpfec"===t.name;const n=t.name.toUpperCase();c.rtpParameters.fecMechanisms.includes(n)||c.rtpParameters.fecMechanisms.push(n)}c.rtpParameters.codecs.push({channels:t.channels,clockRate:t.clockRate,name:t.name,numChannels:t.channels,parameters:n,payloadType:parseInt(t.id,10),rtcpFeedback:i})}for(const e of n.headerExtensions||[])c.rtpParameters.headerExtensions.push({direction:i.sendersToDirection(t,e.senders||"both"),id:e.id,uri:e.uri})}if(s){if(s.usernameFragment&&s.password&&(c.iceParameters={password:s.password,usernameFragment:s.usernameFragment},s.iceLite&&(c.iceParameters.iceLite=!0)),s.fingerprints&&s.fingerprints.length){c.dtlsParameters={fingerprints:[],role:"auto"};for(const e of s.fingerprints)c.dtlsParameters.fingerprints.push({algorithm:e.algorithm,value:e.value});s.sctp&&(c.sctp=s.sctp),c.setup=s.fingerprints[0].setup}c.candidates=(s.candidates||[]).map(a)}return c}t.convertIntermediateToApplication=s,t.convertIntermediateToCandidate=o,t.convertCandidateToIntermediate=a,t.convertIntermediateToTransport=c,t.convertIntermediateToRequest=function(e,t,n){return{contents:e.media.map(e=>({application:"audio"===e.kind||"video"===e.kind?s(e,t):{applicationType:"datachannel",protocol:e.protocol},creator:i.JingleSessionRole.Initiator,name:e.mid,senders:i.directionToSenders(t,e.direction),transport:c(e,n)})),groups:e.groups?e.groups.map(e=>({contents:e.mids,semantics:e.semantics})):[]}},t.convertContentToIntermediate=l,t.convertRequestToIntermediate=function(e,t){const n={groups:[],media:[]};for(const t of e.groups||[])n.groups.push({mids:t.contents,semantics:t.semantics});for(const i of e.contents||[])n.media.push(l(i,t));return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(16),r=n(9),s=n(58),o={condition:r.StanzaErrorCondition.BadRequest},a={condition:r.StanzaErrorCondition.FeatureNotImplemented,jingleError:r.JingleErrorCondition.UnsupportedInfo,type:"modify"};t.default=class{constructor(e){this.parent=e.parent,this.sid=e.sid||s.uuid(),this.peerID=e.peerID,this.role=e.initiator?r.JingleSessionRole.Initiator:r.JingleSessionRole.Responder,this._sessionState="starting",this._connectionState="starting",this.pendingApplicationTypes=e.applicationTypes||[],this.pendingAction=void 0,this.processingQueue=i.priorityQueue(async(e,t)=>{if("ended"===this.state)return"local"===e.type&&e.reject&&e.reject(new Error("Session ended")),void(t&&t());if("local"===e.type){this._log("debug","Processing local action:",e.name);try{const t=await e.handler();e.resolve(t)}catch(t){e.reject(t)}return void(t&&t())}const{action:n,changes:i,cb:s}=e;return this._log("debug","Processing remote action:",n),new Promise(e=>{const o=(n,i)=>{s(n,i),t&&t(),e()};switch(n){case r.JingleAction.ContentAccept:return this.onContentAccept(i,o);case r.JingleAction.ContentAdd:return this.onContentAdd(i,o);case r.JingleAction.ContentModify:return this.onContentModify(i,o);case r.JingleAction.ContentReject:return this.onContentReject(i,o);case r.JingleAction.ContentRemove:return this.onContentRemove(i,o);case r.JingleAction.DescriptionInfo:return this.onDescriptionInfo(i,o);case r.JingleAction.SecurityInfo:return this.onSecurityInfo(i,o);case r.JingleAction.SessionAccept:return this.onSessionAccept(i,o);case r.JingleAction.SessionInfo:return this.onSessionInfo(i,o);case r.JingleAction.SessionInitiate:return this.onSessionInitiate(i,o);case r.JingleAction.SessionTerminate:return this.onSessionTerminate(i,o);case r.JingleAction.TransportAccept:return this.onTransportAccept(i,o);case r.JingleAction.TransportInfo:return this.onTransportInfo(i,o);case r.JingleAction.TransportReject:return this.onTransportReject(i,o);case r.JingleAction.TransportReplace:return this.onTransportReplace(i,o);default:this._log("error","Invalid or unsupported action: "+n),o({condition:r.StanzaErrorCondition.BadRequest})}})},1)}get isInitiator(){return this.role===r.JingleSessionRole.Initiator}get peerRole(){return this.isInitiator?r.JingleSessionRole.Responder:r.JingleSessionRole.Initiator}get state(){return this._sessionState}set state(e){e!==this._sessionState&&(this._log("info","Changing session state to: "+e),this._sessionState=e,this.parent&&this.parent.emit("sessionState",this,e))}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this._log("info","Changing connection state to: "+e),this._connectionState=e,this.parent&&this.parent.emit("connectionState",this,e))}send(e,t){(t=t||{}).sid=this.sid,t.action=e;new Set([r.JingleAction.ContentAccept,r.JingleAction.ContentAdd,r.JingleAction.ContentModify,r.JingleAction.ContentReject,r.JingleAction.ContentRemove,r.JingleAction.SessionAccept,r.JingleAction.SessionInitiate,r.JingleAction.TransportAccept,r.JingleAction.TransportReject,r.JingleAction.TransportReplace]).has(e)?this.pendingAction=e:this.pendingAction=void 0,this.parent.signal(this,{id:s.uuid(),jingle:t,to:this.peerID,type:"set"})}processLocal(e,t){return new Promise((n,i)=>{this.processingQueue.push({handler:t,name:e,reject:i,resolve:n,type:"local"},1)})}process(e,t,n){this.processingQueue.push({action:e,cb:n,changes:t,type:"remote"},2)}start(e,t){this._log("error","Can not start base sessions"),this.end("unsupported-applications",!0)}accept(e,t){this._log("error","Can not accept base sessions"),this.end("unsupported-applications")}cancel(){this.end("cancel")}decline(){this.end("decline")}end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}_log(e,t,...n){this.parent&&(t=this.sid+": "+t,this.parent.emit("log",e,t,...n),this.parent.emit("log:"+e,t,...n))}onSessionInitiate(e,t){t()}onSessionAccept(e,t){t()}onSessionTerminate(e,t){this.end(e.reason,!0),t()}onSessionInfo(e,t){e.info?t(a):t()}onSecurityInfo(e,t){t(a)}onDescriptionInfo(e,t){t(a)}onTransportInfo(e,t){t(a)}onContentAdd(e,t){t(),this.send(r.JingleAction.ContentReject,{reason:{condition:r.JingleReasonCondition.FailedApplication,text:"content-add is not supported"}})}onContentAccept(e,t){t(o)}onContentReject(e,t){t(o)}onContentModify(e,t){t(o)}onContentRemove(e,t){t(o)}onTransportReplace(e,t){t(),this.send(r.JingleAction.TransportReject,{reason:{condition:r.JingleReasonCondition.FailedTransport,text:"transport-replace is not supported"}})}onTransportAccept(e,t){t(o)}onTransportReject(e,t){t(o)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GenesysCloudMediaSession=void 0;const i=n(14).__importDefault(n(60)),r=n(4),s=n(20),o=n(8),a=n(19);t.GenesysCloudMediaSession=class{constructor(e,t){this.webrtcExtension=e,this.iceCandidatesDiscovered=0,this.iceCandidatesReceivedFromPeer=0,this.state="pending",this.connectionState="starting",this.id=t.id,this.fromJid=t.fromJid,this.peerID=t.peerID,this.logger=t.logger,this.conversationId=t.conversationId,this.fromUserId=t.fromUserId,this.pc=this.peerConnection=new RTCPeerConnection({iceServers:t.iceServers,iceTransportPolicy:t.iceTransportPolicy}),this.originalRoomJid=t.originalRoomJid,this.sessionType=a.SessionTypes[t.sessionType],this.ignoreHostCandidatesFromRemote=!!t.ignoreHostCandidatesFromRemote,this.allowIPv6=!!t.allowIPv6,this.allowTCP=!!t.allowTCP,this.reinvite=!!t.reinvite;const n=new r.EventEmitter;Object.keys(n.__proto__).forEach(e=>{this[e]=n[e]}),t.optOutOfWebrtcStatsTelemetry||this.setupStatsGatherer(),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate.bind(this)),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceStateChange.bind(this)),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this))}async setRemoteDescription(e){return this.peerConnection.setRemoteDescription({sdp:e,type:"offer"})}getLogDetails(){return{conversationId:this.conversationId,sessionId:this.id,sessionType:this.sessionType}}log(e,t,n,i){n||(n={});const r={...n,...this.getLogDetails()};this.logger[e](t,r,i)}async sendGenesysWebrtc(e){e.id=e.id||s.v4(),e.jsonrpc=e.jsonrpc||"2.0";const t={type:"set",genesysWebrtc:e,from:this.webrtcExtension.jid,to:this.peerID};return this.webrtcExtension.sendIq(t)}async end(e="success",t=!1){this.state="ended";const n={sessionId:this.id,reason:e.condition||e};t||await o.timeoutPromise((e,t)=>this.sendGenesysWebrtc({jsonrpc:"2.0",method:"terminate",params:n}).then(e,t),2e3,"Timeout waiting for response to termination request",{sessionId:this.id,conversationId:this.conversationId,sessionType:this.sessionType}).catch(e=>this.logger.error(e)),this.onSessionTerminate(n.reason)}setupStatsGatherer(){this.statsGatherer=new i.default(this.peerConnection),this.statsGatherer.on("stats",this.emit.bind(this,"stats"))}async onIceStateChange(){const e=this.peerConnection.iceConnectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this.log("info","ICE state changed: ",{iceState:e,sessionId:t,conversationId:n}),"disconnected"===e)"stable"===this.peerConnection.signalingState&&(this.interruptionStart=new Date,this.log("info","Connection state is interrupted",{sessionId:t,conversationId:n,sessionType:i}));else if("connected"===e){this.log("info","sending session-info: active");const e={sessionId:this.id,status:"active"};await this.sendGenesysWebrtc({jsonrpc:"2.0",params:e,method:"info"}),this._setupDataChannel()}else"failed"===e&&this.log("info","ICE connection failed",{candidatesDiscovered:this.iceCandidatesDiscovered,candidatesReceivedFromPeer:this.iceCandidatesReceivedFromPeer})}onConnectionStateChange(){const e=this.connectionState=this.peerConnection.connectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this.log("info","Connection state changed: ",{connectionState:e,sessionId:t,conversationId:n,sessionType:i}),this.interruptionStart)if("connected"===e){const e=(new Date).getTime()-this.interruptionStart.getTime();this.log("info","Connection was interrupted but was successfully recovered/connected",{sessionId:t,conversationId:n,sessionType:i,timeToRecover:e}),this.interruptionStart=void 0}else"failed"===e&&this.log("info","Connection was interrupted and failed to recover",{sessionId:t,conversationId:n,sessionType:i})}onIceCandidateError(e){const t=e;this.log("error","IceCandidateError",{errorCode:t.errorCode,errorText:t.errorText,url:t.url})}createIceCandidate(e,t){return new RTCIceCandidate({sdpMid:e,candidate:t})}async addRemoteIceCandidate(e){const t=e.match(/m=([^\s]+)/)[1],n=e.match(/a=([^\\\r]+)/)[1],i=this.createIceCandidate(t,n);await this.peerConnection.addIceCandidate(i)}onIceCandidate(e){var t,n;let i,r=null===(t=e.candidate)||void 0===t?void 0:t.candidate,s=null===(n=e.candidate)||void 0===n?void 0:n.sdpMid;if(e.candidate){if(!this.allowTCP&&"tcp"===e.candidate.protocol)return;if(!this.allowIPv6){const t=/.+udp [^ ]+ ([^ ]+).*typ host/.exec(e.candidate.candidate),n=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;if(t&&!t[1].match(n))return void this.log("debug","Filtering out IPv6 candidate",e.candidate.candidate)}this.log("debug","Processing ice candidate",e.candidate),this.log("info","Discovered ice candidate to send to peer",{type:e.candidate.type}),this.iceCandidatesDiscovered++,i=`m=${s} 9 RTP/AVP 0\r\na=${r}`}else i="a=end-of-candidates",this.emit("endOfCandidates");return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"iceCandidate",params:{sessionId:this.id,sdp:i}})}onSessionTerminate(e){this.peerConnection&&this.peerConnection.close(),this.emit("terminated",{condition:e||"success"})}async addTrack(e,t){const n=this.peerConnection.getTransceivers().find(t=>{var n;return!t.sender.track&&(null===(n=t.receiver.track)||void 0===n?void 0:n.kind)===e.kind});if(n)return n.sender.replaceTrack(e);this.peerConnection.addTrack(e,t)}_setupDataChannel(){var e;this.dataChannel||(null===(e=this.peerConnection.remoteDescription)||void 0===e?void 0:e.sdp.includes("webrtc-datachannel"))&&(this.log("info","creating data channel"),this.dataChannel=this.peerConnection.createDataChannel("videoConferenceControl"),this.dataChannel.addEventListener("open",()=>{this.log("info","data channel opened")}),this.dataChannel.addEventListener("message",this._handleDataChannelMessage.bind(this)),this.dataChannel.addEventListener("close",()=>{this.log("info","closing data channel")}),this.dataChannel.addEventListener("error",e=>{this.log("error","Error occurred with the data channel",e)}))}_handleDataChannelMessage(e){try{const t=JSON.parse(e.data);this.emit("dataChannelMessage",t)}catch(e){this.log("error","Failed to parse data channel message",{error:e})}}async accept(){this.state="active";const e=await this.peerConnection.createAnswer();await this.peerConnection.setLocalDescription(e);const t={sdp:e.sdp,sessionId:this.id};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"answer",params:t})}async mute(e,t){const n={sessionId:this.id,type:t};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"mute",params:n})}async unmute(e,t){const n={sessionId:this.id,type:t};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"unmute",params:n})}async removeTrack(){throw new Error("Not Implemented")}async hold(){throw new Error("Not Implemented")}async resume(){throw new Error("Not Implemented")}toString(){return{connectionState:this.connectionState,state:this.state,sessionType:this.sessionType,fromJid:this.fromJid,conversationId:this.conversationId,id:this.id,peerConnection:this.peerConnection}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessengerExtension=void 0;const i=n(115),r=n(49),s=n(20);class o extends i.Emitter{constructor(e,t){super(),this.client=e,this.stanzaInstance=t}get bareJid(){return r.toBare(this.stanzaInstance.jid)}handleStanzaInstanceChange(e){this.stanzaInstance=e}isMediaMessage(e){return!!e.mediaMessage}handleMessage(e){if(!this.isMediaMessage(e))return;const t=e.from===this.stanzaInstance.jid,n=r.toBare(e.from)===this.bareJid;this.emit("mediaMessage",{...e,fromMyClient:t,fromMyUser:n})}async broadcastMessage(e){const t=s.v4();return e.id=t,e.from=this.stanzaInstance.jid,e.to||(e.to=this.bareJid),await this.stanzaInstance.send("message",e),t}get expose(){return{broadcastMessage:this.broadcastMessage.bind(this),on:this.on.bind(this),once:this.once.bind(this),off:this.off.bind(this),removeListener:this.removeListener.bind(this),addListener:this.addListener.bind(this)}}}t.MessengerExtension=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const i=n(14),r=n(66),s=n(116);n(81);const o=n(82),a=n(84),c=n(111),l=n(8),u=n(26),d=i.__importDefault(n(4)),p=n(112),h=n(42),f=i.__importDefault(n(114)),m=i.__importDefault(n(62)),g=n(48),v=n(40);let b={notifications:o.Notifications,webrtcSessions:a.WebrtcExtension,messenger:v.MessengerExtension};class y extends d.default{constructor(e){super(),this.connected=!1,this.connecting=!1,this.hardReconnectRequired=!0,this.isGuest=!1,this.backgroundAssistantMode=!1,this.autoReconnect=!0,this.extensions=[],this.channelReuses=0,this.http=new u.HttpClient,this.reconnectOnNoLongerSubscribed=!1!==e.reconnectOnNoLongerSubscribed,this.config={host:e.host,apiHost:e.apiHost||e.host.replace("wss://streaming.",""),authToken:e.authToken,jwt:e.jwt,jid:e.jid,jidResource:e.jidResource,channelId:null,appName:e.appName,appVersion:e.appVersion,appId:e.appId},this.backgroundAssistantMode=this.checkIsBackgroundAssistant(),this.isGuest=!this.backgroundAssistantMode&&!e.authToken;let t=e.authToken||"",n=`https://api.${this.config.apiHost}/api/v2/diagnostics/trace`;this.backgroundAssistantMode&&(t=e.jwt,n+="/backgroundassistant"),this.logger=new s.Logger({accessToken:t,url:n,uploadDebounceTime:1e3,initializeServerLogging:!this.isGuest&&!e.optOutOfWebrtcStatsTelemetry,appVersion:y.version,appName:"streaming-client",logLevel:this.config.logLevel||"info",logger:e.logger||console,formatters:e.logFormatters,originAppName:e.appName,originAppVersion:e.appVersion,originAppId:e.appId}),this.connectionManager=new p.ConnectionManager(this.logger,this.config),Object.keys(b).forEach(t=>{const n=new b[t](this,e);this.extensions.push(n),n.tokenBucket||(n.tokenBucket=new r.TokenBucket(20,25,1e3),n.tokenBucket.content=25),"function"==typeof n.on&&n.on("send",this.handleSendEventFromExtension.bind(this,n)),this[t]=n.expose,this["_"+t]=n})}handleSendEventFromExtension(e,t,n=!1){return e.tokenBucket.removeTokens(1,()=>{const e=this.activeStanzaInstance;return e?!0===n?e.sendMessage(t):e.sendIQ(t):this.logger.warn("cannot send message, no active stanza client",{data:t,message:n},{skipServer:!0})})}checkIsBackgroundAssistant(){if(this.config.jwt){const e=l.parseJwt(this.config.jwt);return e&&"urn:purecloud:screenrecording"===e.iss}return!1}addInateEventHandlers(e){this.removeStanzaBoundEventHandlers(),this.boundStanzaDisconnect=this.handleStanzaDisconnectedEvent.bind(this,e),this.boundStanzaNoLongerSubscribed=this.handleNoLongerSubscribed.bind(this,e),this.boundStanzaDuplicateId=this.handleDuplicateId.bind(this,e),this.on("stanzaDisconnected",this.boundStanzaDisconnect),this.on("notify:no_longer_subscribed",this.boundStanzaNoLongerSubscribed),this.on("notify:duplicate_id",this.boundStanzaDuplicateId),this.extensions.forEach(t=>{"function"==typeof t.handleIq&&e.on("iq",t.handleIq.bind(t)),"function"==typeof t.handleMessage&&e.on("message",t.handleMessage.bind(t))})}removeStanzaBoundEventHandlers(){this.boundStanzaDisconnect&&(this.off("stanzaDisconnected",this.boundStanzaDisconnect),this.boundStanzaDisconnect=void 0),this.boundStanzaNoLongerSubscribed&&(this.off("notify:no_longer_subscribed",this.boundStanzaNoLongerSubscribed),this.boundStanzaNoLongerSubscribed=void 0),this.boundStanzaDuplicateId&&(this.off("notify:duplicate_id",this.boundStanzaDuplicateId),this.boundStanzaDuplicateId=void 0)}proxyStanzaEvents(e){e.originalEmitter=e.emit,e.emit=(t,...n)=>{const i=e.originalEmitter(t,...n);return"connected"===t?i:("disconnected"===t&&(t="stanzaDisconnected"),this.emit(t,...n))}}async handleStanzaDisconnectedEvent(e){var t;if(this.logger.info("stanzaDisconnected event received",{stanzaInstanceId:e.id,channelId:e.channelId}),this.connected=!1,this.connecting=!1,null===(t=e.pinger)||void 0===t||t.stop(),this.removeAllListeners("stanzaDisconnected"),this.removeAllListeners("notify:no_longer_subscribed"),e.originalEmitter&&(e.emit=e.originalEmitter),this.activeStanzaInstance=void 0,this.emit("disconnected",{reconnecting:this.autoReconnect}),this.autoReconnect)return this.connect({keepTryingOnFailure:!0})}handleNoLongerSubscribed(e){var t;this.logger.warn("noLongerSubscribed event received",{stanzaInstanceId:e.id,channelId:e.channelId}),null===(t=e.pinger)||void 0===t||t.stop(),this.hardReconnectRequired=!0,this.reconnectOnNoLongerSubscribed||(this.autoReconnect=!1)}handleDuplicateId(e){var t;this.logger.warn("duplicate_id event received, forcing hard reconnect",{stanzaInstanceId:e.id,channelId:e.channelId}),null===(t=e.pinger)||void 0===t||t.stop(),this.hardReconnectRequired=!0}async disconnect(){if(this.logger.info("streamingClient.disconnect was called"),this.activeStanzaInstance)return l.timeoutPromise(e=>(this.autoReconnect=!1,this.http.stopAllRetries(),this.activeStanzaInstance.disconnect().then(e)),5e3,"disconnecting streaming service")}async connect(e){var t;if(this.connecting){const e=new Error("Already trying to connect streaming client");return this.logger.warn(e)}this.connecting=!0;const n=(null==e?void 0:e.maxDelayBetweenConnectionAttempts)||9e4;let i=(null==e?void 0:e.maxConnectionAttempts)||1;(null==e?void 0:e.keepTryingOnFailure)&&(i=1/0);try{await h.backOff(()=>this.makeConnectionAttempt(),{jitter:"full",maxDelay:n,numOfAttempts:i,startingDelay:2e3,retry:this.backoffConnectRetryHandler.bind(this,{maxConnectionAttempts:i})})}catch(e){let n=e;if(e){if("AxiosError"===e.name){const i=e,r=i.config||{url:void 0,method:void 0};n={config:{url:r.url,method:r.method},status:null===(t=i.response)||void 0===t?void 0:t.status,code:i.code,name:i.name,message:i.message}}}else n=new Error("Streaming client connection attempted received and undefined error");if(this.logger.error("Failed to connect streaming client",{error:n}),!e)throw n;throw e}}async backoffConnectRetryHandler(e,t,n){var i,r,s,o,a;if(n>=e.maxConnectionAttempts)return!1;const c={connectionAttempt:n,error:t};if(t){if("AxiosError"===t.name){const e=t,n=e.config||{url:void 0,method:void 0};let s={config:{url:n.url,method:n.method},status:null===(i=e.response)||void 0===i?void 0:i.status,code:e.code,name:e.name,message:e.message};if(c.error=s,[401,403].includes((null===(r=t.response)||void 0===r?void 0:r.status)||0))return this.logger.error("Streaming client received an error that it can't recover from and will not attempt to reconnect",c),!1}}else c.error=new Error("streaming client backoff handler received undefined error");if(t instanceof m.default&&(this.logger.info("hardReconnectRequired set to true due to sasl error"),this.hardReconnectRequired=!0,Object.assign(c,{channelId:t.channelId,stanzaInstanceId:t.stanzaInstanceId})),t instanceof g.TimeoutError){c.error=t.message;const e=t.details;e&&(c.details=e)}if(null==t?void 0:t.response){const e=(null===(s=t.response.headers)||void 0===s?void 0:s["retry-after"])||(null===(a=(o=t.response).getResponseHeader)||void 0===a?void 0:a.call(o,"retry-after"));if(e){let n=1e3*parseInt(e,10);return c.retryDelay=n,this.logger.error("Failed streaming client connection attempt, respecting retry-after header and will retry afterwards.",c,{skipServer:t instanceof f.default}),await new Promise(e=>{setTimeout(e,n)}),this.logger.debug("finished waiting for retry-after"),!0}}return this.logger.error("Failed streaming client connection attempt, retrying",c,{skipServer:t instanceof f.default}),!0}async makeConnectionAttempt(){var e;if(!navigator.onLine)throw new f.default("Browser is offline, skipping connection attempt");let t,n=this.connecting;try{await this.prepareForConnect(),t=await this.connectionManager.getNewStanzaConnection(),this.connected=!0,this.connecting=!1,this.addInateEventHandlers(t),this.proxyStanzaEvents(t);for(const e of this.extensions)e.configureNewStanzaInstance&&await e.configureNewStanzaInstance(t);for(const e of this.extensions)e.handleStanzaInstanceChange(t);this.activeStanzaInstance=t,t.pinger=new c.Ping(this,t),this.emit("connected")}catch(i){throw t&&(this.logger.error("Error occurred in connection attempt, but after websocket connected. Cleaning up connection so backoff is respected",{stanzaInstanceId:t.id,channelId:t.channelId}),this.removeStanzaBoundEventHandlers(),null===(e=t.pinger)||void 0===e||e.stop(),await t.disconnect(),this.connected=!1,this.connecting=n),i}}async prepareForConnect(){if(this.config.jwt)return this.hardReconnectRequired=!1,this.connectionManager.setConfig(this.config);if(this.hardReconnectRequired||(this.channelReuses++,this.channelReuses>10&&(this.logger.warn("Forcing a hard reconnect due to max channel reuses",{channelId:this.config.channelId,channelReuses:this.channelReuses}),this.channelReuses=0,this.hardReconnectRequired=!0)),this.hardReconnectRequired){let e;if(this.config.jid)e=Promise.resolve(this.config.jid);else{const t={method:"get",host:this.config.apiHost,authToken:this.config.authToken,logger:this.logger};e=this.http.requestApi("users/me",t).then(e=>e.data.chat.jabberId)}const t={method:"post",host:this.config.apiHost,authToken:this.config.authToken,logger:this.logger},n=this.http.requestApi("notifications/channels?connectionType=streaming",t).then(e=>e.data.id),[i,r]=await Promise.all([e,n]);this.config.jid=i,this.config.channelId=r,this.autoReconnect=!0,this.logger.info("attempting to connect streaming client on channel",{channelId:r}),this.connectionManager.setConfig(this.config),this.hardReconnectRequired=!1}}stopServerLogging(){this.logger.sendAllLogsInstantly(),this._webrtcSessions.flushStats(),this.logger.stopServerLogging()}startServerLogging(){this.logger.startServerLogging()}setAccessToken(e){this.config.authToken=e,this.logger.setAccessToken(e)}static extend(e,t){if(b[e])throw new Error("Cannot register already existing namespace "+e);b[e]=t}get version(){return y.version}static get version(){return"17.0.2"}}t.Client=y},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(71),o=n(72);t.backOff=function(e,t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return n=s.getSanitizedOptions(t),[4,new a(e,n).execute()];case 1:return[2,i.sent()]}}))}))};var a=function(){function e(e,t){this.request=e,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return i(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}}))}))},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,o.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}}))}))},e}()},function(e,t,n){"use strict";var i={};n.r(i),n.d(i,"hasBrowserEnv",(function(){return v})),n.d(i,"hasStandardBrowserWebWorkerEnv",(function(){return _})),n.d(i,"hasStandardBrowserEnv",(function(){return b}));var r=n(1),s=n(29),o=n(10);function a(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function c(e,t){this._pairs=[],e&&Object(o.a)(e,this,t)}const l=c.prototype;l.append=function(e,t){this._pairs.push([e,t])},l.toString=function(e){const t=e?function(t){return e.call(this,t,a)}:a;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var u=c;function d(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function p(e,t,n){if(!t)return e;const i=n&&n.encode||d,s=n&&n.serialize;let o;if(o=s?s(t,n):r.a.isURLSearchParams(t)?t.toString():new u(t,n).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}var h=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){r.a.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},f=n(2),m={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},g={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:u,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const v="undefined"!=typeof window&&"undefined"!=typeof document,b=(y="undefined"!=typeof navigator&&navigator.product,v&&["ReactNative","NativeScript","NS"].indexOf(y)<0);var y;const _="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var S={...i,...g};var w=function(e){function t(e,n,i,s){let o=e[s++];if("__proto__"===o)return!0;const a=Number.isFinite(+o),c=s>=e.length;if(o=!o&&r.a.isArray(i)?i.length:o,c)return r.a.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a;i[o]&&r.a.isObject(i[o])||(i[o]=[]);return t(e,n,i[o],s)&&r.a.isArray(i[o])&&(i[o]=function(e){const t={},n=Object.keys(e);let i;const r=n.length;let s;for(i=0;i<r;i++)s=n[i],t[s]=e[s];return t}(i[o])),!a}if(r.a.isFormData(e)&&r.a.isFunction(e.entries)){const n={};return r.a.forEachEntry(e,(e,i)=>{t(function(e){return r.a.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),i,n,0)}),n}return null};const T={transitional:m,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=r.a.isObject(e);s&&r.a.isHTMLForm(e)&&(e=new FormData(e));if(r.a.isFormData(e))return i&&i?JSON.stringify(w(e)):e;if(r.a.isArrayBuffer(e)||r.a.isBuffer(e)||r.a.isStream(e)||r.a.isFile(e)||r.a.isBlob(e))return e;if(r.a.isArrayBufferView(e))return e.buffer;if(r.a.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Object(o.a)(e,new S.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,i){return S.isNode&&r.a.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=r.a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Object(o.a)(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),function(e,t,n){if(r.a.isString(e))try{return(t||JSON.parse)(e),r.a.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||T.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&r.a.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw f.a.from(e,f.a.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:S.classes.FormData,Blob:S.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};r.a.forEach(["delete","get","head","post","put","patch"],e=>{T.headers[e]={}});var I=T;const x=r.a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const j=Symbol("internals");function k(e){return e&&String(e).trim().toLowerCase()}function E(e){return!1===e||null==e?e:r.a.isArray(e)?e.map(E):String(e)}function C(e,t,n,i,s){return r.a.isFunction(i)?i.call(this,t,n):(s&&(t=n),r.a.isString(t)?r.a.isString(i)?-1!==t.indexOf(i):r.a.isRegExp(i)?i.test(t):void 0:void 0)}class N{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function s(e,t,n){const s=k(t);if(!s)throw new Error("header name must be a non-empty string");const o=r.a.findKey(i,s);(!o||void 0===i[o]||!0===n||void 0===n&&!1!==i[o])&&(i[o||t]=E(e))}const o=(e,t)=>r.a.forEach(e,(e,n)=>s(e,n,t));return r.a.isPlainObject(e)||e instanceof this.constructor?o(e,t):r.a.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?o((e=>{const t={};let n,i,r;return e&&e.split("\n").forEach((function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),i=e.substring(r+1).trim(),!n||t[n]&&x[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=k(e)){const n=r.a.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(r.a.isFunction(t))return t.call(this,e,n);if(r.a.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=k(e)){const n=r.a.findKey(this,e);return!(!n||void 0===this[n]||t&&!C(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function s(e){if(e=k(e)){const s=r.a.findKey(n,e);!s||t&&!C(0,n[s],s,t)||(delete n[s],i=!0)}}return r.a.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const r=t[n];e&&!C(0,this[r],r,e,!0)||(delete this[r],i=!0)}return i}normalize(e){const t=this,n={};return r.a.forEach(this,(i,s)=>{const o=r.a.findKey(n,s);if(o)return t[o]=E(i),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();a!==s&&delete t[s],t[a]=E(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return r.a.forEach(this,(n,i)=>{null!=n&&!1!==n&&(t[i]=e&&r.a.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[j]=this[j]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=k(e);t[i]||(!function(e,t){const n=r.a.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{value:function(e,n,r){return this[i].call(this,t,e,n,r)},configurable:!0})})}(n,e),t[i]=!0)}return r.a.isArray(e)?e.forEach(i):i(e),this}}N.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),r.a.reduceDescriptors(N.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),r.a.freezeMethods(N);var O=N;function R(e,t){const n=this||I,i=t||n,s=O.from(i.headers);let o=i.data;return r.a.forEach(e,(function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)})),s.normalize(),o}function A(e){return!(!e||!e.__CANCEL__)}function P(e,t,n){f.a.call(this,null==e?"canceled":e,f.a.ERR_CANCELED,t,n),this.name="CanceledError"}r.a.inherits(P,f.a,{__CANCEL__:!0});var L=P,q=n(30);var F=S.hasStandardBrowserEnv?{write(e,t,n,i,s,o){const a=[e+"="+encodeURIComponent(t)];r.a.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.a.isString(i)&&a.push("path="+i),r.a.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function M(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var D=S.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function i(n){let i=n;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(e){const t=r.a.isString(e)?i(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};var B=function(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=i[o];r||(r=c),n[s]=a,i[s]=c;let u=o,d=0;for(;u!==s;)d+=n[u++],u%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-r<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}};function U(e,t){let n=0;const i=B(50,250);return r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,c=i(a);n=s;const l={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:r};l[t?"download":"upload"]=!0,e(l)}}var z="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let i=e.data;const s=O.from(e.headers).normalize();let o,a,{responseType:c,withXSRFToken:l}=e;function u(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}if(r.a.isFormData(i))if(S.hasStandardBrowserEnv||S.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if(!1!==(a=s.getContentType())){const[e,...t]=a?a.split(";").map(e=>e.trim()).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}let d=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const h=M(e.baseURL,e.url);function g(){if(!d)return;const i=O.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());!function(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new f.a("Request failed with status code "+n.status,[f.a.ERR_BAD_REQUEST,f.a.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),u()}),(function(e){n(e),u()}),{data:c&&"text"!==c&&"json"!==c?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:i,config:e,request:d}),d=null}if(d.open(e.method.toUpperCase(),p(h,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,"onloadend"in d?d.onloadend=g:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(g)},d.onabort=function(){d&&(n(new f.a("Request aborted",f.a.ECONNABORTED,e,d)),d=null)},d.onerror=function(){n(new f.a("Network Error",f.a.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||m;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new f.a(t,i.clarifyTimeoutError?f.a.ETIMEDOUT:f.a.ECONNABORTED,e,d)),d=null},S.hasStandardBrowserEnv&&(l&&r.a.isFunction(l)&&(l=l(e)),l||!1!==l&&D(h))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&F.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===i&&s.setContentType(null),"setRequestHeader"in d&&r.a.forEach(s.toJSON(),(function(e,t){d.setRequestHeader(t,e)})),r.a.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),c&&"json"!==c&&(d.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",U(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",U(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{d&&(n(!t||t.type?new L(null,e,d):t),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(h);v&&-1===S.protocols.indexOf(v)?n(new f.a("Unsupported protocol "+v+":",f.a.ERR_BAD_REQUEST,e)):d.send(i||null)}))};const J={http:q.a,xhr:z};r.a.forEach(J,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const G=e=>"- "+e,V=e=>r.a.isFunction(e)||null===e||!1===e;var H=e=>{e=r.a.isArray(e)?e:[e];const{length:t}=e;let n,i;const s={};for(let r=0;r<t;r++){let t;if(n=e[r],i=n,!V(n)&&(i=J[(t=String(n)).toLowerCase()],void 0===i))throw new f.a(`Unknown adapter '${t}'`);if(i)break;s[t||"#"+r]=i}if(!i){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let n=t?e.length>1?"since :\n"+e.map(G).join("\n"):" "+G(e[0]):"as no adapter specified";throw new f.a("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return i};function $(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new L(null,e)}function W(e){$(e),e.headers=O.from(e.headers),e.data=R.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return H(e.adapter||I.adapter)(e).then((function(t){return $(e),t.data=R.call(e,e.transformResponse,t),t.headers=O.from(t.headers),t}),(function(t){return A(t)||($(e),t&&t.response&&(t.response.data=R.call(e,e.transformResponse,t.response),t.response.headers=O.from(t.response.headers))),Promise.reject(t)}))}const Q=e=>e instanceof O?e.toJSON():e;function K(e,t){t=t||{};const n={};function i(e,t,n){return r.a.isPlainObject(e)&&r.a.isPlainObject(t)?r.a.merge.call({caseless:n},e,t):r.a.isPlainObject(t)?r.a.merge({},t):r.a.isArray(t)?t.slice():t}function s(e,t,n){return r.a.isUndefined(t)?r.a.isUndefined(e)?void 0:i(void 0,e,n):i(e,t,n)}function o(e,t){if(!r.a.isUndefined(t))return i(void 0,t)}function a(e,t){return r.a.isUndefined(t)?r.a.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function c(n,r,s){return s in t?i(n,r):s in e?i(void 0,n):void 0}const l={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(e,t)=>s(Q(e),Q(t),!0)};return r.a.forEach(Object.keys(Object.assign({},e,t)),(function(i){const o=l[i]||s,a=o(e[i],t[i],i);r.a.isUndefined(a)&&o!==c||(n[i]=a)})),n}const X={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{X[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Y={};X.transitional=function(e,t,n){function i(e,t){return"[Axios v1.6.5] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,s)=>{if(!1===e)throw new f.a(i(r," has been removed"+(t?" in "+t:"")),f.a.ERR_DEPRECATED);return t&&!Y[r]&&(Y[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}};var Z={assertOptions:function(e,t,n){if("object"!=typeof e)throw new f.a("options must be an object",f.a.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let r=i.length;for(;r-- >0;){const s=i[r],o=t[s];if(o){const t=e[s],n=void 0===t||o(t,s,e);if(!0!==n)throw new f.a("option "+s+" must be "+n,f.a.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new f.a("Unknown option "+s,f.a.ERR_BAD_OPTION)}},validators:X};const ee=Z.validators;class te{constructor(e){this.defaults=e,this.interceptors={request:new h,response:new h}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=K(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;void 0!==n&&Z.assertOptions(n,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1),null!=i&&(r.a.isFunction(i)?t.paramsSerializer={serialize:i}:Z.assertOptions(i,{encode:ee.function,serialize:ee.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&r.a.merge(s.common,s[t.method]);s&&r.a.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=O.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(c=c&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const l=[];let u;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let d,p=0;if(!c){const e=[W.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,l),d=e.length,u=Promise.resolve(t);p<d;)u=u.then(e[p++],e[p++]);return u}d=a.length;let h=t;for(p=0;p<d;){const e=a[p++],t=a[p++];try{h=e(h)}catch(e){t.call(this,e);break}}try{u=W.call(this,h)}catch(e){return Promise.reject(e)}for(p=0,d=l.length;p<d;)u=u.then(l[p++],l[p++]);return u}getUri(e){return p(M((e=K(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}r.a.forEach(["delete","get","head","options"],(function(e){te.prototype[e]=function(t,n){return this.request(K(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.a.forEach(["post","put","patch"],(function(e){function t(t){return function(n,i,r){return this.request(K(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}te.prototype[e]=t(),te.prototype[e+"Form"]=t(!0)}));var ne=te;class ie{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const i=new Promise(e=>{n.subscribe(e),t=e}).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e((function(e,i,r){n.reason||(n.reason=new L(e,i,r),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new ie((function(t){e=t})),cancel:e}}}var re=ie;const se={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(se).forEach(([e,t])=>{se[t]=e});var oe=se;const ae=function e(t){const n=new ne(t),i=Object(s.a)(ne.prototype.request,n);return r.a.extend(i,ne.prototype,n,{allOwnKeys:!0}),r.a.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(K(t,n))},i}(I);ae.Axios=ne,ae.CanceledError=L,ae.CancelToken=re,ae.isCancel=A,ae.VERSION="1.6.5",ae.toFormData=o.a,ae.AxiosError=f.a,ae.Cancel=ae.CanceledError,ae.all=function(e){return Promise.all(e)},ae.spread=function(e){return function(t){return e.apply(null,t)}},ae.isAxiosError=function(e){return r.a.isObject(e)&&!0===e.isAxiosError},ae.mergeConfig=K,ae.AxiosHeaders=O,ae.formToJSON=e=>w(r.a.isHTMLForm(e)?new FormData(e):e),ae.getAdapter=H,ae.HttpStatusCode=oe,ae.default=ae;t.a=ae},function(e,t,n){(function(t){var n=function(e,t,n,i){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof n)switch(n){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+n)}else this.interval=n;this.parentBucket=i,this.content=0,this.lastDrip=+new Date};n.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(e,n){var i=this;return this.bucketSize?e>this.bucketSize?(t.nextTick(n.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),e>this.content?r():this.parentBucket?this.parentBucket.removeTokens(e,(function(t,s){return t?n(t,null):e>i.content?r():(i.content-=e,void n(null,Math.min(s,i.content)))})):(this.content-=e,t.nextTick(n.bind(null,null,this.content)),!0)):(t.nextTick(n.bind(null,null,e,Number.POSITIVE_INFINITY)),!0);function r(){var t=Math.ceil((e-i.content)*(i.interval/i.tokensPerInterval));return setTimeout((function(){i.removeTokens(e,n)}),t),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var n=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+n,this.bucketSize)}else this.content=this.bucketSize}},e.exports=n}).call(this,n(11))},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var i=new Uint8Array(16);e.exports=function(){return n(i),i}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},function(e,t){for(var n=[],i=0;i<256;++i)n[i]=(i+256).toString(16).substr(1);e.exports=function(e,t){var i=t||0,r=n;return[r[e[i++]],r[e[i++]],r[e[i++]],r[e[i++]],"-",r[e[i++]],r[e[i++]],"-",r[e[i++]],r[e[i++]],"-",r[e[i++]],r[e[i++]],"-",r[e[i++]],r[e[i++]],r[e[i++]],r[e[i++]],r[e[i++]],r[e[i++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(74),r=function(){function e(e){this.options=e,this.attempt=0}return e.prototype.apply=function(){var e=this;return new Promise((function(t){return setTimeout(t,e.jitteredDelay)}))},e.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){return i.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,n=this.numOfDelayedAttempts,i=e*Math.pow(t,n);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();t.Delay=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimeoutError=void 0;class i extends Error{constructor(e){super(e)}}t.TimeoutError=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toURI=t.parseURI=t.toBare=t.getResource=t.getDomain=t.getLocal=t.isBare=t.isFull=t.equalBare=t.equal=t.allowedResponders=t.parse=t.createFull=t.create=t.prepare=t.unescapeLocal=t.escapeLocal=void 0;const i=n(0).__importDefault(n(5)),r=n(86);function s(e=""){return e.replace(/^\s+|\s+$/g,"").replace(/\\5c/g,"\\5c5c").replace(/\\20/g,"\\5c20").replace(/\\22/g,"\\5c22").replace(/\\26/g,"\\5c26").replace(/\\27/g,"\\5c27").replace(/\\2f/g,"\\5c2f").replace(/\\3a/g,"\\5c3a").replace(/\\3c/g,"\\5c3c").replace(/\\3e/g,"\\5c3e").replace(/\\40/g,"\\5c40").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")}function o(e){return e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")}function a(e){let t=e.local||"",n=e.domain,s=e.resource||"";return t&&(t=r.nodeprep(t)),s&&(s=r.resourceprep(s)),"."===n[n.length-1]&&(n=n.slice(0,n.length-1)),n=r.nameprep(n.split(".").map(i.default.toUnicode).join(".")),{domain:n,local:t,resource:s}}function c(e,t={}){let n=e.local;t.escaped||(n=s(e.local));const i=t.prepared?e:a({local:n,domain:e.domain,resource:e.resource}),r=n?`${n}@${i.domain}`:i.domain;return i.resource?`${r}/${i.resource}`:r}function l(e=""){let t="",n="",i="";const r=e.indexOf("/");r>0&&(i=e.slice(r+1),e=e.slice(0,r));const s=e.indexOf("@");s>0&&(t=e.slice(0,s),e=e.slice(s+1)),n=e;const l=a({domain:n,local:t,resource:i});return{bare:c({local:l.local,domain:l.domain},{escaped:!0,prepared:!0}),domain:l.domain,full:c(l,{escaped:!0,prepared:!0}),local:o(l.local),resource:l.resource}}function u(e){return!!l(e).resource}function d(e=""){return l(e).bare}t.escapeLocal=s,t.unescapeLocal=o,t.prepare=a,t.create=c,t.createFull=function(e,t){return t?`${d(e)}/${t}`:d(e)},t.parse=l,t.allowedResponders=function(e,t){const n=new Set;if(n.add(void 0),n.add(""),e){const t=l(e);n.add(t.full),n.add(t.bare),n.add(t.domain)}if(t){const e=l(t);n.add(e.domain),n.add(e.bare),n.add(e.full)}return n},t.equal=function(e,t){if(!e||!t)return!1;const n=l(e),i=l(t);return n.local===i.local&&n.domain===i.domain&&n.resource===i.resource},t.equalBare=function(e,t){if(!e||!t)return!1;const n=l(e),i=l(t);return n.local===i.local&&n.domain===i.domain},t.isFull=u,t.isBare=function(e){return!u(e)},t.getLocal=function(e=""){return l(e).local},t.getDomain=function(e=""){return l(e).domain},t.getResource=function(e=""){return l(e).resource},t.toBare=d,t.parseURI=function(e){const t=new URL(e);if("xmpp:"!==t.protocol)throw new Error("Invalid XMPP URI, wrong protocol: "+t.protocol);const n=t.hostname?t.username?c({domain:decodeURIComponent(t.hostname),local:decodeURIComponent(t.username)},{escaped:!0}):decodeURIComponent(t.hostname):void 0,i=l(decodeURIComponent(n?t.pathname.substr(1):t.pathname)).full,r=t.search&&t.search.indexOf(";")>=1,s=r?t.search.substr(t.search.indexOf(";")+1):"",o=t.search?decodeURIComponent(t.search.substr(1,r?t.search.indexOf(";")-1:void 0)):void 0,a={};for(const e of s.split(";")){const[t,n]=e.split("=").map(decodeURIComponent);if(a[t]){const e=a[t];Array.isArray(e)?e.push(n):a[t]=[e,n]}else a[t]=n}return{action:o,identity:n,jid:i,parameters:a}},t.toURI=function(e){const t=["xmpp:"],n=(e,n)=>{const i=l(e);i.local&&(t.push(encodeURIComponent(s(i.local))),t.push("@")),t.push(encodeURIComponent(i.domain)),n&&i.resource&&(t.push("/"),t.push(encodeURIComponent(i.resource)))};e.identity&&(t.push("//"),n(e.identity,!1),e.jid&&t.push("/")),e.jid&&n(e.jid,!0),e.action&&(t.push("?"),t.push(encodeURIComponent(e.action)));for(const[n,i]of Object.entries(e.parameters||{}))for(const e of Array.isArray(i)?i:[i])t.push(";"),t.push(encodeURIComponent(n)),void 0!==e&&(t.push("="),t.push(encodeURIComponent(e)));return t.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(32);t.default=class{constructor(){this.parents=new Set,this.placeholder=!1,this.typeField="",this.versionField="",this.defaultType="",this.defaultVersion="",this.languageField="lang",this.typeValues=new Map,this.typeOrders=new Map,this.importers=new Map,this.exporters=new Map,this.children=new Map,this.childrenIndex=new Map,this.implicitChildren=new Set,this.contexts=new Map}addChild(e,t,n=!1,i,r){const s={multiple:n||!1,name:e,selector:i,translator:t},o=this.children.get(e);if(!o){s.translator.parents.add(this),this.children.set(e,s);for(const[n]of t.importers)this.implicitChildren.has(n)||this.childrenIndex.set(n,e);return void(r&&this.implicitChildren.add(r))}const a=o.translator;o.multiple=n,i&&o.selector&&i!==o.selector&&(o.selector=void 0);for(const[n,i]of t.importers){const[r,s]=(a.typeValues.get(n)||"").split("__v__");a.updateDefinition({contexts:t.contexts,element:i.element,exporterOrdering:new Map,exporters:new Map,importerOrdering:i.fieldOrders,importers:i.fields,namespace:i.namespace,optionalNamespaces:new Map,type:r,version:s}),this.implicitChildren.has(n)||this.childrenIndex.set(n,e)}for(const[e,n]of t.exporters){const[i,r]=e.split("__v__");a.updateDefinition({contexts:t.contexts,element:n.element,exporterOrdering:n.fieldOrders,exporters:n.fields,importerOrdering:new Map,importers:new Map,namespace:n.namespace,optionalNamespaces:n.optionalNamespaces,type:i,version:r})}}addContext(e,t,n,i,r,s){t&&(e=`${e}[${t}]`);let o=this.contexts.get(e);o||(o={typeField:"",versionField:"",typeValues:new Map}),s&&(o.impliedType=r),o.typeField=n||"",o.typeValues.set(i,r),this.contexts.set(e,o)}getChild(e){const t=this.children.get(e);if(t)return t.translator}getImportKey(e){return this.childrenIndex.get(`{${e.getNamespace()}}${e.getName()}`)}updateDefinition(e){const t=`{${e.namespace}}${e.element}`,n=e.type||this.defaultType,i=e.version||this.defaultVersion,r=i?`${n}__v__${i}`:n,s=this.importers.get(t)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace};for(const[t,n]of e.importers)s.fields.set(t,n);for(const[t,n]of e.importerOrdering)s.fieldOrders.set(t,n);this.importers.set(t,s);const o=this.exporters.get(r)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace,optionalNamespaces:e.optionalNamespaces};for(const[t,n]of e.exporters)o.fields.set(t,n);for(const[t,n]of e.exporterOrdering)o.fieldOrders.set(t,n);for(const[t,n]of e.optionalNamespaces)o.optionalNamespaces.set(t,n);this.exporters.set(r,o);for(const[t,n]of e.contexts){const e=this.contexts.get(t)||{impliedType:void 0,typeField:n.typeField,versionField:n.versionField,typeValues:new Map};e.typeField||(e.typeField=n.typeField),e.versionField||(e.versionField=n.versionField),e.impliedType||(e.impliedType=n.impliedType);for(const[t,i]of n.typeValues)e.typeValues.set(t,i);this.contexts.set(t,e)}if(e.type)this.typeValues.set(t,r),e.typeOrder&&e.type&&this.typeOrders.set(e.type,e.typeOrder);else if(this.typeField&&!e.type){for(const[,t]of this.importers){for(const[n,i]of e.importers)t.fields.set(n,i);for(const[n,i]of e.importerOrdering)t.fieldOrders.set(n,i)}for(const[,t]of this.exporters){for(const[n,i]of e.exporters)t.fields.set(n,i);for(const[n,i]of e.exporterOrdering)t.fieldOrders.set(n,i)}}}replaceWith(e){for(const[t,n]of this.children)e.children.set(t,n);for(const[t,n]of this.childrenIndex)e.childrenIndex.set(t,n);for(const[t,n]of this.contexts)e.contexts.set(t,n);for(const t of this.implicitChildren)e.implicitChildren.add(t);for(const t of this.parents)for(const n of t.children.values())n.translator===this&&(n.translator=e);this.parents=new Set}import(e,t){const n=`{${e.getNamespace()}}${e.getName()}`,i={},r=this.importers.get(n);if(!r)return;const s=this.typeValues.get(n)||"",[o,a]=s.split("__v__"),c=t.path||"";let l;if(t.pathSelector&&(l=this.contexts.get(`${c}[${t.pathSelector}]`)),l||(l=this.contexts.get(c)),l){if(!l.impliedType){const e=l.typeValues.get(n)||"";e&&(i[l.typeField]=e)}}else this.typeField&&o&&o!==this.defaultType&&(i[this.typeField]=o);this.versionField&&a&&a!==this.defaultVersion&&(i[this.versionField]=a);const u={...t,data:i,importer:r,lang:(e.getAttribute("xml:lang")||t.lang||"").toLowerCase(),pathSelector:o,translator:this},d=[...r.fieldOrders.entries()].sort((e,t)=>e[1]>t[1]?-1:e[1]<t[1]?1:0),p=d.filter(e=>e[1]>=0),h=d.filter(e=>e[1]<0);for(const[n]of p){const s=r.fields.get(n);u.path=`${t.path}.${n}`;const o=s(e,u);null!=o&&(i[n]=o)}for(const n of e.children){if("string"==typeof n)continue;const e=`{${n.getNamespace()}}${n.getName()}`,r=this.childrenIndex.get(e);if(!r)continue;u.path=`${t.path}.${r}`;const{translator:s,multiple:a,selector:c}=this.children.get(r);if(!c||c===o){const e=s.import(n,u);void 0!==e&&(a?(i[r]||(i[r]=[]),i[r].push(e)):i[r]?i[r]=s.resolveCollision(i[r],e):i[r]=e)}}for(const[n]of h){const s=r.fields.get(n);u.path=`${t.path}.${n}`;const o=s(e,u);null!=o&&(i[n]=o)}return i}export(e,t){if(!e)return;let n=this.defaultType,r=this.defaultVersion;const s=t.path||"";let o;t.pathSelector&&(o=this.contexts.get(`${s}[${t.pathSelector}]`)),o||(o=this.contexts.get(s)),o?n=o.impliedType||e[o.typeField]||this.defaultType:this.typeField&&(n=e[this.typeField]||this.defaultType),this.versionField&&(r=e[this.versionField]||this.defaultVersion);const a=r?`${n}__v__${r}`:n,c=this.exporters.get(a);if(!c)return;const l=i.createElement(c.namespace,c.element,t.namespace,t.element);t.element&&(l.parent=t.element);for(const[e,t]of c.optionalNamespaces)l.addOptionalNamespace(e,t);const u={...t,data:e,element:l,exporter:c,lang:(e[this.languageField]||t.lang||"").toLowerCase(),namespace:l.getDefaultNamespace(),pathSelector:n,translator:this},d=c.fields.get(this.languageField);d&&d(l,e[this.languageField],t);const p=Object.keys(e);p.sort((e,t)=>(c.fieldOrders.get(e)||1e5)-(c.fieldOrders.get(t)||1e5));for(const i of p){if(i===this.languageField)continue;const r=e[i],s=c.fields.get(i);if(s){s(l,r,u);continue}const o=this.children.get(i);if(!o)continue;u.path=`${t.path?t.path+".":""}${i}`;const{translator:a,multiple:d,selector:p}=o;if(!p||p===n){let e;e=d?null!=r?r:[]:[r];for(const t of e){const e=a.export(t,u);e&&l.appendChild(e)}}}return l}resolveCollision(e,t){return(this.typeOrders.get(e[this.typeField]||this.defaultType)||0)<=(this.typeOrders.get(t[this.typeField]||this.defaultType)||0)?e:t}}},function(e,t,n){"use strict";(function(t,i){var r=n(23);e.exports=y;var s,o=n(99);y.ReadableState=b;n(4).EventEmitter;var a=function(e,t){return e.listeners(t).length},c=n(52),l=n(24).Buffer,u=t.Uint8Array||function(){};var d=Object.create(n(17));d.inherits=n(18);var p=n(100),h=void 0;h=p&&p.debuglog?p.debuglog("stream"):function(){};var f,m=n(101),g=n(53);d.inherits(y,c);var v=["error","close","destroy","pause","resume"];function b(e,t){e=e||{};var i=t instanceof(s=s||n(15));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(f||(f=n(55).StringDecoder),this.decoder=new f(e.encoding),this.encoding=e.encoding)}function y(e){if(s=s||n(15),!(this instanceof y))return new y(e);this._readableState=new b(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function _(e,t,n,i,r){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,T(e)}(e,o)):(r||(s=function(e,t){var n;i=t,l.isBuffer(i)||i instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var i;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),i?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):S(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?S(e,o,t,!1):x(e,o)):S(e,o,t,!1))):i||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(o)}function S(e,t,n,i){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&T(e)),x(e,t)}Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),y.prototype.destroy=g.destroy,y.prototype._undestroy=g.undestroy,y.prototype._destroy=function(e,t){this.push(null),t(e)},y.prototype.push=function(e,t){var n,i=this._readableState;return i.objectMode?n=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=l.from(e,t),t=""),n=!0),_(this,e,t,!1,n)},y.prototype.unshift=function(e){return _(this,e,null,!0,!1)},y.prototype.isPaused=function(){return!1===this._readableState.flowing},y.prototype.setEncoding=function(e){return f||(f=n(55).StringDecoder),this._readableState.decoder=new f(e),this._readableState.encoding=e,this};function w(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function T(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(h("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?r.nextTick(I,e):I(e))}function I(e){h("emit readable"),e.emit("readable"),C(e)}function x(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(j,e,t))}function j(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(h("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function k(e){h("readable nexttick read 0"),e.read(0)}function E(e,t){t.reading||(h("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),C(e),t.flowing&&!t.reading&&e.read(0)}function C(e){var t=e._readableState;for(h("flow",t.flowing);t.flowing&&null!==e.read(););}function N(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var i;e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):i=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,i=1,r=n.data;e-=r.length;for(;n=n.next;){var s=n.data,o=e>s.length?s.length:e;if(o===s.length?r+=s:r+=s.slice(0,e),0===(e-=o)){o===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++i}return t.length-=i,r}(e,t):function(e,t){var n=l.allocUnsafe(e),i=t.head,r=1;i.data.copy(n),e-=i.data.length;for(;i=i.next;){var s=i.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=s.slice(o));break}++r}return t.length-=r,n}(e,t);return i}(e,t.buffer,t.decoder),n);var n}function O(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,r.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function A(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}y.prototype.read=function(e){h("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return h("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):T(this),null;if(0===(e=w(e,t))&&t.ended)return 0===t.length&&O(this),null;var i,r=t.needReadable;return h("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&h("length less than watermark",r=!0),t.ended||t.reading?h("reading or ended",r=!1):r&&(h("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=w(n,t))),null===(i=e>0?N(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==i&&this.emit("data",i),i},y.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(e,t){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,h("pipe count=%d opts=%j",s.pipesCount,t);var c=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?u:y;function l(t,i){h("onunpipe"),t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,h("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",d),e.removeListener("error",g),e.removeListener("unpipe",l),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",m),p=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||d())}function u(){h("onend"),e.end()}s.endEmitted?r.nextTick(c):n.once("end",c),e.on("unpipe",l);var d=function(e){return function(){var t=e._readableState;h("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,C(e))}}(n);e.on("drain",d);var p=!1;var f=!1;function m(t){h("ondata"),f=!1,!1!==e.write(t)||f||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==A(s.pipes,e))&&!p&&(h("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,f=!0),n.pause())}function g(t){h("onerror",t),y(),e.removeListener("error",g),0===a(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),y()}function b(){h("onfinish"),e.removeListener("close",v),y()}function y(){h("unpipe"),n.unpipe(e)}return n.on("data",m),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",g),e.once("close",v),e.once("finish",b),e.emit("pipe",n),s.flowing||(h("pipe resume"),n.resume()),e},y.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<r;s++)i[s].emit("unpipe",this,n);return this}var o=A(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},y.prototype.on=function(e,t){var n=c.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&T(this):r.nextTick(k,this))}return n},y.prototype.addListener=y.prototype.on,y.prototype.resume=function(){var e=this._readableState;return e.flowing||(h("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(E,e,t))}(this,e)),this},y.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this},y.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;for(var r in e.on("end",(function(){if(h("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(r){(h("wrapped data"),n.decoder&&(r=n.decoder.write(r)),n.objectMode&&null==r)||(n.objectMode||r&&r.length)&&(t.push(r)||(i=!0,e.pause()))})),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var s=0;s<v.length;s++)e.on(v[s],this.emit.bind(this,v[s]));return this._read=function(t){h("wrapped _read",t),i&&(i=!1,e.resume())},this},Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),y._fromList=N}).call(this,n(6),n(11))},function(e,t,n){e.exports=n(4).EventEmitter},function(e,t,n){"use strict";var i=n(23);function r(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i.nextTick(r,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(i.nextTick(r,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";(function(t,i,r){var s=n(23);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var i=e.entry;e.entry=null;for(;i;){var r=i.callback;t.pendingcb--,r(n),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=b;var a,c=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?i:s.nextTick;b.WritableState=v;var l=Object.create(n(17));l.inherits=n(18);var u={deprecate:n(105)},d=n(52),p=n(24).Buffer,h=r.Uint8Array||function(){};var f,m=n(53);function g(){}function v(e,t){a=a||n(15),e=e||{};var i=t instanceof a;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,l=e.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(l||0===l)?l:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var d=!1===e.decodeStrings;this.decodeStrings=!d,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,i=n.sync,r=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,i,r){--t.pendingcb,n?(s.nextTick(r,i),s.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(r(i),e._writableState.errorEmitted=!0,e.emit("error",i),I(e,t))}(e,n,i,t,r);else{var o=w(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||S(e,n),i?c(_,e,n,o,r):_(e,n,o,r)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function b(e){if(a=a||n(15),!(f.call(b,this)||this instanceof a))return new b(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),d.call(this)}function y(e,t,n,i,r,s,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function _(e,t,n,i){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),I(e,t)}function S(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,r=new Array(i),s=t.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)r[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;r.allBuffers=c,y(e,t,!0,t.length,r,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,d=n.callback;if(y(e,t,!1,t.objectMode?1:l.length,l,u,d),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function w(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function T(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),I(e,t)}))}function I(e,t){var n=w(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(T,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(b,d),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:u.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(e){return!!f.call(this,e)||this===b&&(e&&e._writableState instanceof v)}})):f=function(e){return e instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(e,t,n){var i,r=this._writableState,o=!1,a=!r.objectMode&&(i=e,p.isBuffer(i)||i instanceof h);return a&&!p.isBuffer(e)&&(e=function(e){return p.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=g),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),s.nextTick(t,n)}(this,n):(a||function(e,t,n,i){var r=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),s.nextTick(i,o),r=!1),r}(this,r,e,n))&&(r.pendingcb++,o=function(e,t,n,i,r,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=p.from(t,n));return t}(t,i,r);i!==o&&(n=!0,r="buffer",i=o)}var a=t.objectMode?1:i.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:r,isBuf:n,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else y(e,t,!1,a,i,r,s);return c}(this,r,a,e,t,n)),o},b.prototype.cork=function(){this._writableState.corked++},b.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||S(this,e))},b.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(e,t,n){var i=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(e,t,n){t.ending=!0,I(e,t),n&&(t.finished?s.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),b.prototype.destroy=m.destroy,b.prototype._undestroy=m.undestroy,b.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(11),n(103).setImmediate,n(6))},function(e,t,n){"use strict";var i=n(24).Buffer,r=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=l,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=d,t=3;break;default:return this.write=p,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function u(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function p(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var r=o(t[i]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(e.lastNeed=r-2),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=o;var i=n(15),r=Object.create(n(17));function s(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),i(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function o(e){if(!(this instanceof o))return new o(e);i.call(this,e),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush((function(t,n){c(e,t,n)})):c(this,null,null)}function c(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}r.inherits=n(18),r.inherits(o,i),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},o.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},o.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},o.prototype._destroy=function(e,t){var n=this;i.prototype._destroy.call(this,e,(function(e){t(e),n.emit("close")}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Receiver=t.Sender=void 0;const i=n(0),r=n(4),s=i.__importStar(n(35)),o=n(9),a=n(13),c=i.__importDefault(n(36)),l=n(25),u=n(37);class d extends r.EventEmitter{constructor(e={}){super(),this.config={chunkSize:16384,hash:"sha-1",...e},this.file=void 0,this.channel=void 0,this.hash=s.createHash(this.config.hash)}send(e,t){if(this.file&&this.channel)return;this.file=e,this.channel=t,this.channel.binaryType="arraybuffer";const n=new FileReader;let i=0,r=!1;const s=()=>{if(r||i>=e.size)return;r=!0;const t=e.slice(i,i+this.config.chunkSize);n.readAsArrayBuffer(t)};t.bufferedAmountLowThreshold=8*this.config.chunkSize,t.onbufferedamountlow=()=>{s()},n.addEventListener("load",t=>{const n=t.target.result;r=!1,i+=n.byteLength,this.channel.send(n),this.hash.update(new Uint8Array(n)),this.emit("progress",i,e.size,n),i<e.size?this.channel.bufferedAmount<=this.channel.bufferedAmountLowThreshold&&s():(this.emit("progress",e.size,e.size,null),this.emit("sentFile",{algorithm:this.config.hash,name:e.name,size:e.size,value:this.hash.digest()}))}),s()}}t.Sender=d;class p extends r.EventEmitter{constructor(e={}){super(),this.config={hash:"sha-1",...e},this.receiveBuffer=[],this.received=0,this.channel=void 0,this.hash=s.createHash(this.config.hash)}receive(e,t){this.metadata=e,this.channel=t,this.channel.binaryType="arraybuffer",this.channel.onmessage=e=>{const t=e.data.byteLength;this.received+=t,this.receiveBuffer.push(e.data),e.data&&this.hash.update(new Uint8Array(e.data)),this.emit("progress",this.received,this.metadata.size,e.data),this.received===this.metadata.size?(this.metadata.actualhash=this.hash.digest("hex"),this.emit("receivedFile",new Blob(this.receiveBuffer),this.metadata),this.receiveBuffer=[]):this.received>this.metadata.size&&(console.error("received more than expected, discarding..."),this.receiveBuffer=[])}}}t.Receiver=p;class h extends c.default{constructor(e){super(e),this.sender=void 0,this.receiver=void 0,this.file=void 0}async start(e,t){if(t=t||(()=>{}),!e||"function"==typeof e)throw new Error("File object required");this.state="pending",this.role="initiator",this.file=e,this.sender=new d,this.sender.on("progress",(e,t)=>{this._log("info","Send progress "+e+"/"+t)}),this.sender.on("sentFile",e=>{this._log("info","Sent file",e.name),this.send(o.JingleAction.SessionInfo,{info:{creator:o.JingleSessionRole.Initiator,file:{hashes:[{algorithm:e.algorithm,value:e.value}]},infoType:o.JINGLE_INFO_CHECKSUM_5,name:this.contentName}}),this.parent.emit("sentFile",this,e)}),this.channel=this.pc.createDataChannel("filetransfer",{ordered:!0}),this.channel.onopen=()=>{this.sender.send(this.file,this.channel)};try{await this.processLocal(o.JingleAction.SessionInitiate,async()=>{const t=await this.pc.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1}),n=l.importFromSDP(t.sdp),i=u.convertIntermediateToRequest(n,this.role,this.transportType);this.contentName=i.contents[0].name,i.sid=this.sid,i.action=o.JingleAction.SessionInitiate,i.contents[0].application={applicationType:a.NS_JINGLE_FILE_TRANSFER_5,file:{date:e.lastModified?new Date(e.lastModified):void 0,hashesUsed:[{algorithm:"sha-1"}],name:e.name,size:e.size}},this.send("session-initiate",i),await this.pc.setLocalDescription(t)}),t()}catch(e){return this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}async accept(e){this._log("info","Accepted incoming session"),this.role="responder",this.state="active",e=e||(()=>{});try{await this.processLocal(o.JingleAction.SessionAccept,async()=>{const e=await this.pc.createAnswer(),t=l.importFromSDP(e.sdp),n=u.convertIntermediateToRequest(t,this.role,this.transportType);n.sid=this.sid,n.action="session-accept";for(const e of n.contents)e.creator="initiator";this.contentName=n.contents[0].name,this.send("session-accept",n),await this.pc.setLocalDescription(e),await this.processBufferedCandidates()}),e()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}async onSessionInitiate(e,t){this._log("info","Initiating incoming session"),this.role="responder",this.state="pending",this.transportType=e.contents[0].transport.transportType;const n=u.convertRequestToIntermediate(e,this.peerRole),i=l.exportToSDP(n),r=e.contents[0].application,s=r.file.hashesUsed?r.file.hashesUsed:r.file.hashes||[];this.receiver=new p({hash:s[0]&&s[0].algorithm}),this.receiver.on("progress",(e,t)=>{this._log("info","Receive progress "+e+"/"+t)}),this.receiver.on("receivedFile",e=>{this.receivedFile=e,this._maybeReceivedFile()}),this.receiver.metadata=r.file,this.pc.addEventListener("datachannel",e=>{this.channel=e.channel,this.receiver.receive(this.receiver.metadata,e.channel)});try{await this.pc.setRemoteDescription({type:"offer",sdp:i}),await this.processBufferedCandidates(),t()}catch(e){this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}onSessionInfo(e,t){const n=e.info;n&&n.file&&n.file.hashes&&(this.receiver.metadata.hashes=n.file.hashes,this.receiver.metadata.actualhash&&this._maybeReceivedFile(),t())}_maybeReceivedFile(){if(this.receiver.metadata.hashes&&this.receiver.metadata.hashes.length){for(const e of this.receiver.metadata.hashes||[])if(e.value&&e.value.toString("hex")===this.receiver.metadata.actualhash)return this._log("info","File hash matches"),this.parent.emit("receivedFile",this,this.receivedFile,this.receiver.metadata),void this.end("success");this._log("error","File hash does not match"),this.end("media-error")}}}t.default=h},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.reviveData=t.uuid=t.octetCompare=t.sleep=t.timeoutPromise=void 0;const i=n(35),r=[];for(let e=0;e<256;++e)r[e]=(e+256).toString(16).substr(1);t.timeoutPromise=async function(e,t,n=(()=>{})){let i;const r=await Promise.race([e,new Promise((e,r)=>{i=setTimeout(()=>r(n()),t)})]);return clearTimeout(i),r},t.sleep=async function(e){return new Promise(t=>{setTimeout(()=>t(),e)})},t.octetCompare=function(t,n){const i="string"==typeof t?e.from(t,"utf8"):t,r="string"==typeof n?e.from(n,"utf8"):n;return i.compare(r)},t.uuid=function(){const e=i.randomBytes(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t=0;return[r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],"-",r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[t++]],r[e[15]]].join("")};const s=new Set(["date","expires","httpUploadRetry","idleSince","published","since","stamp","timestamp","updated","utc"]),o=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)(?:Z|((\+|-)([\d|:]*)))?$/;t.reviveData=function(t,n){return s.has(t)&&n&&"string"==typeof n&&o.test(n)?new Date(n):n&&"object"==typeof n&&"Buffer"===n.type&&Array.isArray(n.data)?e.from(n):n}}).call(this,n(12).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(9),s=i.__importDefault(n(36)),o=n(25),a=n(37);function c(e){const t=e.application;if(t.streams&&t.streams.length&&t.sources&&t.sources.length){const e=t.streams[0];t.sources[0].parameters.msid=`${e.id} ${e.track}`,t.sourceGroups&&t.sourceGroups.length>0&&t.sources.push({parameters:{cname:t.sources[0].parameters.cname,msid:`${e.id} ${e.track}`},ssrc:t.sourceGroups[0].sources[1]})}}class l extends s.default{constructor(e){if(super(e),this.includesAudio=!1,this.includesVideo=!1,this._ringing=!1,this.pc.addEventListener("track",e=>{this.onAddTrack(e.track,e.streams[0])}),e.stream)for(const t of e.stream.getTracks())this.addTrack(t,e.stream)}get ringing(){return this._ringing}set ringing(e){e!==this._ringing&&(this._ringing=e)}get streams(){return"closed"!==this.pc.signalingState?this.pc.getRemoteStreams():[]}async start(e,t){this.state="pending",1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this.role="initiator",this.offerOptions=e;try{await this.processLocal(r.JingleAction.SessionInitiate,async()=>{const t=await this.pc.createOffer(e),n=o.importFromSDP(t.sdp),i=a.convertIntermediateToRequest(n,this.role,this.transportType);i.sid=this.sid,i.action=r.JingleAction.SessionInitiate;for(const e of i.contents||[])e.creator="initiator",c(e);await this.pc.setLocalDescription(t),this.send("session-initiate",i)}),t()}catch(e){this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}async accept(e,t){1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this._log("info","Accepted incoming session"),this.state="active",this.role="responder";try{await this.processLocal(r.JingleAction.SessionAccept,async()=>{const t=await this.pc.createAnswer(e),n=o.importFromSDP(t.sdp),i=a.convertIntermediateToRequest(n,this.role,this.transportType);i.sid=this.sid,i.action=r.JingleAction.SessionAccept;for(const e of i.contents||[])e.creator="initiator";await this.pc.setLocalDescription(t),await this.processBufferedCandidates(),this.send("session-accept",i)}),t()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}end(e="success",t=!1){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.end(e,t)}ring(){return this.processLocal("ring",async()=>{this._log("info","Ringing on incoming session"),this.ringing=!0,this.send(r.JingleAction.SessionInfo,{info:{infoType:r.JINGLE_INFO_RINGING}})})}mute(e,t){return this.processLocal("mute",async()=>{this._log("info","Muting",t),this.send(r.JingleAction.SessionInfo,{info:{creator:e,infoType:r.JINGLE_INFO_MUTE,name:t}})})}unmute(e,t){return this.processLocal("unmute",async()=>{this._log("info","Unmuting",t),this.send(r.JingleAction.SessionInfo,{info:{creator:e,infoType:r.JINGLE_INFO_UNMUTE,name:t}})})}hold(){return this.processLocal("hold",async()=>{this._log("info","Placing on hold"),this.send("session-info",{info:{infoType:r.JINGLE_INFO_HOLD}})})}resume(){return this.processLocal("resume",async()=>{this._log("info","Resuming from hold"),this.send("session-info",{info:{infoType:r.JINGLE_INFO_ACTIVE}})})}addTrack(e,t,n){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",async()=>{this.pc.addTrack?this.pc.addTrack(e,t):this.pc.addStream(t),n&&n()})}async removeTrack(e,t){return this.processLocal("removetrack",async()=>{if(this.pc.removeTrack(e),t)return t()})}onAddTrack(e,t){this._log("info","Track added"),this.parent.emit("peerTrackAdded",this,e,t)}onRemoveTrack(e){this._log("info","Track removed"),this.parent.emit("peerTrackRemoved",this,e)}async onSessionInitiate(e,t){this._log("info","Initiating incoming session"),this.state="pending",this.role="responder",this.transportType=e.contents[0].transport.transportType;const n=a.convertRequestToIntermediate(e,this.peerRole);for(const e of n.media)"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),e.streams||(e.streams=[{stream:"legacy",track:e.kind}]);const i=o.exportToSDP(n);try{return await this.pc.setRemoteDescription({type:"offer",sdp:i}),await this.processBufferedCandidates(),t()}catch(e){return this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}onSessionTerminate(e,t){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.onSessionTerminate(e,t)}onSessionInfo(e,t){const n=e.info||{infoType:""};switch(n.infoType){case r.JINGLE_INFO_RINGING:return this._log("info","Outgoing session is ringing"),this.ringing=!0,this.parent.emit("ringing",this),t();case r.JINGLE_INFO_HOLD:return this._log("info","On hold"),this.parent.emit("hold",this),t();case r.JINGLE_INFO_UNHOLD:case r.JINGLE_INFO_ACTIVE:return this._log("info","Resuming from hold"),this.parent.emit("resumed",this),t();case r.JINGLE_INFO_MUTE:return this._log("info","Muting",n),this.parent.emit("mute",this,n),t();case r.JINGLE_INFO_UNMUTE:return this._log("info","Unmuting",n),this.parent.emit("unmute",this,n),t()}return t()}}t.default=l},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)},a=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var l,u=n(4);o(n(110),t);var d=function(e){function t(t,n){void 0===n&&(n={});var i=e.call(this)||this;return i.peerConnection=t,i.haveConnectionMetrics=!1,i.statsArr=[],l="undefined"!=typeof window,i.session=n.session,i.initiator=n.initiator,i.conference=n.conference,i.statsInterval=1e3*(n.interval||5),i.logger=n.logger||console,["new","checking"].includes(t.iceConnectionState)&&("checking"===t.iceConnectionState&&(i.logger.warn("iceConnectionState is already in checking state so ice connect time may not be accurate"),i.handleIceStateChange()),t.addEventListener("iceconnectionstatechange",i.handleIceStateChange.bind(i))),t.addEventListener("connectionstatechange",i.handleConnectionStateChange.bind(i)),"connected"===t.connectionState&&i.pollForStats(),i}return r(t,e),t.prototype.handleIceStateChange=function(){var e=this,t=this.peerConnection.iceConnectionState;if("checking"===t&&l&&(this.iceStartTime=window.performance.now()),"connected"===t){if(this.haveConnectionMetrics)return;this.haveConnectionMetrics=!0;var n=void 0,i=void 0,r=void 0;l&&(this.iceConnectionTime=window.performance.now()-this.iceStartTime,n=window.navigator.userAgent,i=window.navigator.platform,r=window.navigator.hardwareConcurrency);var s={name:"connect",userAgent:n,platform:i,cores:r,session:this.session,conference:this.conference,connectTime:this.iceConnectionTime};return this.waitForSelectedCandidatePair().then((function(t){e.gatherSelectedCandidateInfo(t,s),e.emit("stats",s)}))}if("failed"===t)return l&&(this.iceFailedTime=window.performance.now()-this.iceStartTime),this.gatherStats().then((function(t){var n={name:"failure",session:e.session,initiator:e.initiator,conference:e.conference,failTime:e.iceFailedTime,iceRW:0,numLocalHostCandidates:0,numLocalSrflxCandidates:0,numLocalRelayCandidates:0,numRemoteHostCandidates:0,numRemoteSrflxCandidates:0,numRemoteRelayCandidates:0},i=e.peerConnection.localDescription.sdp.split("\r\n").filter((function(e){return e.indexOf("a=candidate:")>-1})),r=e.peerConnection.remoteDescription.sdp.split("\r\n").filter((function(e){return e.indexOf("a=candidate:")>-1}));["Host","Srflx","Relay"].forEach((function(e){n["numLocal"+e+"Candidates"]=i.filter((function(t){return t.split(" ")[7]===e.toLowerCase()})).length,n["numRemote"+e+"Candidates"]=r.filter((function(t){return t.split(" ")[7]===e.toLowerCase()})).length})),e.emit("stats",n)}))},t.prototype.waitForSelectedCandidatePair=function(e,t){var n=this;return void 0===e&&(e=300),void 0===t&&(t=1),this.gatherStats().then((function(i){return n.getSelectedCandidatePair(i)?i:t>3?Promise.reject(new Error("Max wait attempts for connected candidate info reached")):new Promise((function(i,r){setTimeout((function(){return n.waitForSelectedCandidatePair(e,t+1).then(i,r)}),e)}))}))},t.prototype.getSelectedCandidatePair=function(e){var t=null;return e.forEach((function(e){var n=e.value;"candidate-pair"===n.type&&n.nominated&&"succeeded"===n.state&&(t=n)})),t},t.prototype.gatherSelectedCandidateInfo=function(e,t){var n=this.getSelectedCandidatePair(e);if(n){var i,r,s=n.localCandidateId,o=n.remoteCandidateId;if(e.forEach((function(e){e.key;var n=e.value;s&&"local-candidate"===n.type&&n.id===s&&(i=n,t.localCandidateType=n.candidateType),o&&"remote-candidate"===n.type&&n.id===o&&(r=n,t.remoteCandidateType=n.candidateType)})),i&&r&&(t.candidatePair=i.candidateType+";"+r.candidateType,t.candidatePairDetails={local:i,remote:r,pair:n}),i){if(t.transport=i.transport||i.protocol,i.priority){var a=parseInt(i.priority,10);t.turnType={2:"udp",1:"tcp",0:"tls"}[a>>24],t.networkType=i.networkType}t.usingIPv6=i.ipAddress&&0===i.ipAddress.indexOf("[")}}},t.prototype.handleConnectionStateChange=function(){return a(this,void 0,void 0,(function(){var e,t=this;return c(this,(function(n){if("connected"===(e=this.peerConnection.connectionState))this.pollForStats();else{if("disconnected"===e)return"stable"!==this.peerConnection.signalingState?[2]:[2,this.gatherStats().then((function(e){var n=t.createStatsReport(e);n.type="disconnected",t.emit("stats",n)}))];"closed"===e&&this.pollingInterval&&(l&&window.clearInterval(this.pollingInterval),this.pollingInterval=null)}return[2]}))}))},t.prototype.pollForStats=function(){var e=this;if(!this.pollingInterval){var t=function(){return e.gatherStats().then((function(t){var n=e.createStatsReport(t,!0);(n.tracks.length>0||n.remoteTracks.length>0)&&e.checkBitrate(n)&&e.emit("stats",n)}))};l&&(window.setTimeout(t,0),this.pollingInterval=window.setInterval(t,this.statsInterval))}},t.prototype.checkBitrate=function(e){var t;return e.remoteTracks.length&&0!==(null===(t=e.remoteTracks[0])||void 0===t?void 0:t.bitrate)?(this.statsArr=[],!0):!(this.statsArr.length>=5)&&(this.statsArr.push(e),!0)},t.prototype.polyFillStats=function(e){if(!e)return[];if(Array.isArray(e))return e;var t=[];if(this.isNativeStatsReport(e))e.forEach((function(e,n){t.push({key:n,value:e})}));else{if(!(Object.keys(e).length>0))return this.logger.warn("Unknown stats results format, returning unmodified",e),[];Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})}))}return t},t.prototype.isNativeStatsReport=function(e){return void 0!==window.RTCStatsReport&&e instanceof window.RTCStatsReport},t.prototype.gatherStats=function(){return a(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.peerConnection.getStats(null).then(this.polyFillStats.bind(this))];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.logger.error("Failed to gather stats. Are you using RTCPeerConnection as your connection? {expect peerconnection.getStats}",{peerConnection:this.peerConnection,err:e}),[2,Promise.reject(e)];case 3:return[2]}}))}))},t.prototype.createStatsReport=function(e,t){var n=this;void 0===t&&(t=!0);var i={name:"getStats",session:this.session,initiator:this.initiator,conference:this.conference,tracks:[],remoteTracks:[]};e.filter((function(e){return["inbound-rtp","outbound-rtp"].indexOf(e.value.type)>-1})).forEach((function(t){n.processSource({source:t.value,event:i,results:e})}));var r=e.find((function(e){return"candidate-pair"===e.value.type&&"succeeded"===e.value.state&&!0===e.value.nominated}));return r&&this.processSelectedCandidatePair({report:r.value,event:i,results:e}),t&&(this.lastResult=e),i},t.prototype.processSource=function(e){var t,n,i,r,s,o,a,c=e.source,l=e.results,u=e.event,d=new Date(c.timestamp),h=this.lastResult&&this.lastResult.find((function(e){return e.key===c.id}));(h=h&&h.value)&&(t=(t=this.lastResult&&this.lastResult.find((function(e){return e.value.localId===h.id})))&&t.value),l.forEach((function(e){e.value.localId===c.id?n=e.value:e.key===c.transportId?i=e.value:e.key===c.trackId?s=e.value:e.key===c.mediaSourceId?o=e.value:e.key===c.codecId&&(a=e.value)})),i&&(r=(r=l.find((function(e){return e.key===i.selectedCandidatePairId})))&&r.value),r&&(u.candidatePairHadActiveSource=!0);var f=c.kind||c.mediaType,m="outbound-rtp"===c.type,g={track:s&&s.trackIdentifier,kind:f,jitter:p("jitter",c,n),roundTripTime:p("roundTripTime",c,n),packetsLost:p("packetsLost",c,n)||0,packetLoss:0,bytes:parseInt(m?c.bytesSent:c.bytesReceived,10)||0};if(a&&(g.codec=a.payloadType+" "+a.mimeType+" "+a.clockRate),h){var v=parseInt(m?h.bytesSent:h.bytesReceived,10)||0,b=d.getTime()-new Date(h.timestamp).getTime();g.bitrate=Math.floor(8*(g.bytes-v)/b)}var y=p("packetsLost",h,t);m?(g.packetsSent=c.packetsSent,g.packetLoss=g.packetsLost/(g.packetsSent||1)*100,h&&(g.intervalPacketsSent=g.packetsSent-(h.packetsSent||0),g.intervalPacketsLost=g.packetsLost-(y||0),g.intervalPacketLoss=g.intervalPacketsLost/(g.intervalPacketsSent||1)*100),g.retransmittedBytesSent=c.retransmittedBytesSent,g.retransmittedPacketsSent=c.retransmittedPacketsSent):(g.packetsReceived=c.packetsReceived,g.packetLoss=g.packetsLost/(g.packetsReceived||1)*100,h&&(g.intervalPacketsReceived=g.packetsReceived-h.packetsReceived,g.intervalPacketsLost=g.packetsLost-y,g.intervalPacketLoss=g.intervalPacketsLost/(g.intervalPacketsReceived||1)*100)),s&&"audio"===f&&(s.remoteSource?(g.audioLevel=s.audioLevel,g.totalAudioEnergy=s.totalAudioEnergy):(g.echoReturnLoss=s.echoReturnLoss,g.echoReturnLossEnhancement=s.echoReturnLossEnhancement)),"audio"!==f||!o||s&&s.remoteSource||(g.audioLevel=o.audioLevel,g.totalAudioEnergy=o.totalAudioEnergy),Object.keys(g).forEach((function(e){return void 0===g[e]&&delete g[e]})),m?u.tracks.push(g):u.remoteTracks.push(g)},t.prototype.processSelectedCandidatePair=function(e){var t=this,n=e.report,i=e.event,r=e.results,s=n.localCandidateId,o=n.remoteCandidateId;i.localCandidateChanged=!!this.lastActiveLocalCandidate&&s!==this.lastActiveLocalCandidate.id,i.remoteCandidateChanged=!!this.lastActiveRemoteCandidate&&o!==this.lastActiveRemoteCandidate.id,(!this.lastActiveLocalCandidate||i.localCandidateChanged||i.remoteCandidateChanged)&&r.forEach((function(e){t.checkLastActiveCandidate({localId:s,remoteId:o,key:e.key,report:e.value})})),this.lastActiveLocalCandidate&&(i.networkType=this.lastActiveLocalCandidate.networkType,this.lastActiveRemoteCandidate&&(i.candidatePair=this.lastActiveLocalCandidate.candidateType+";"+this.lastActiveRemoteCandidate.candidateType)),i.bytesSent=n.bytesSent,i.bytesReceived=n.bytesReceived,i.requestsReceived=n.requestsReceived,i.requestsSent=n.requestsSent,i.responsesReceived=n.responsesReceived,i.responsesSent=n.responsesSent,i.consentRequestsSent=n.consentRequestsSent,i.totalRoundTripTime=n.totalRoundTripTime},t.prototype.checkLastActiveCandidate=function(e){var t=e.localId,n=e.remoteId,i=(e.key,e.report);t&&"local-candidate"===i.type&&i.id===t&&(this.lastActiveLocalCandidate=i),n&&"remote-candidate"===i.type&&i.id===n&&(this.lastActiveRemoteCandidate=i)},t}(u.EventEmitter);function p(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=t.find((function(t){return t&&(t[e]||0===t[e])}));return i&&i[e]}t.default=d},function(e,t,n){"use strict";n.r(t),n.d(t,"Axios",(function(){return r})),n.d(t,"AxiosError",(function(){return s})),n.d(t,"CanceledError",(function(){return o})),n.d(t,"isCancel",(function(){return a})),n.d(t,"CancelToken",(function(){return c})),n.d(t,"VERSION",(function(){return l})),n.d(t,"all",(function(){return u})),n.d(t,"Cancel",(function(){return d})),n.d(t,"isAxiosError",(function(){return p})),n.d(t,"spread",(function(){return h})),n.d(t,"toFormData",(function(){return f})),n.d(t,"AxiosHeaders",(function(){return m})),n.d(t,"HttpStatusCode",(function(){return g})),n.d(t,"formToJSON",(function(){return v})),n.d(t,"getAdapter",(function(){return b})),n.d(t,"mergeConfig",(function(){return y}));var i=n(43);n.d(t,"default",(function(){return i.a}));const{Axios:r,AxiosError:s,CanceledError:o,isCancel:a,CancelToken:c,VERSION:l,all:u,Cancel:d,isAxiosError:p,spread:h,toFormData:f,AxiosHeaders:m,HttpStatusCode:g,formToJSON:v,getAdapter:b,mergeConfig:y}=i.a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{constructor(e,t,n){super(),this.condition=e,this.channelId=t,this.stanzaInstanceId=n,this.name="SaslError"}}t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){var i=n(69),r=n(70),s=r;s.v1=i,s.v4=r,e.exports=s},function(e,t,n){"use strict";n.r(t);var i=n(41),r=n(39);for(var s in r)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(s);var o=n(34);for(var s in o)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);var a=n(63);for(var s in a)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(s);var c=n(19);for(var s in c)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return c[e]}))}(s);var l=n(40);for(var s in l)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return l[e]}))}(s);var u=n(26);n.d(t,"HttpClient",(function(){return u.HttpClient}));var d=n(8);n.d(t,"parseJwt",(function(){return d.parseJwt})),t.default=i.Client},function(e,t,n){t.RateLimiter=n(67),t.TokenBucket=n(44)},function(e,t,n){(function(t){var i=n(44),r=n(68),s=function(e,t,n){this.tokenBucket=new i(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=n};s.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,n){if(e>this.tokenBucket.bucketSize)return t.nextTick(n.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var i=this,s=r();if((s<this.curIntervalStart||s-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=s,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)t.nextTick(n.bind(null,null,-1));else{var o=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-s);setTimeout((function(){i.tokenBucket.removeTokens(e,a)}),o)}return!1}return this.tokenBucket.removeTokens(e,a);function a(t,r){if(t)return n(t,null);i.tokensThisInterval+=e,n(null,r)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=r();if((t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var n=this.tokenBucket.tryRemoveTokens(e);return n&&(this.tokensThisInterval+=e),n},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},e.exports=s}).call(this,n(11))},function(e,t,n){(function(t){e.exports=function(){if(void 0!==t&&t.hrtime){var e=t.hrtime(),n=e[0],i=e[1];return 1e3*n+Math.floor(i/1e6)}return(new Date).getTime()}}).call(this,n(11))},function(e,t,n){var i,r,s=n(45),o=n(46),a=0,c=0;e.exports=function(e,t,n){var l=t&&n||0,u=t||[],d=(e=e||{}).node||i,p=void 0!==e.clockseq?e.clockseq:r;if(null==d||null==p){var h=s();null==d&&(d=i=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==p&&(p=r=16383&(h[6]<<8|h[7]))}var f=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:c+1,g=f-a+(m-c)/1e4;if(g<0&&void 0===e.clockseq&&(p=p+1&16383),(g<0||f>a)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=f,c=m,r=p;var v=(1e4*(268435455&(f+=122192928e5))+m)%4294967296;u[l++]=v>>>24&255,u[l++]=v>>>16&255,u[l++]=v>>>8&255,u[l++]=255&v;var b=f/4294967296*1e4&268435455;u[l++]=b>>>8&255,u[l++]=255&b,u[l++]=b>>>24&15|16,u[l++]=b>>>16&255,u[l++]=p>>>8|128,u[l++]=255&p;for(var y=0;y<6;++y)u[l+y]=d[y];return t||o(u)}},function(e,t,n){var i=n(45),r=n(46);e.exports=function(e,t,n){var s=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var a=0;a<16;++a)t[s+a]=o[a];return t||r(o)}},function(e,t,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var r={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};t.getSanitizedOptions=function(e){var t=i(i({},r),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(73),r=n(77);t.DelayFactory=function(e,t){var n=function(e){if(!e.delayFirstAttempt)return new i.SkipFirstDelay(e);return new r.AlwaysDelay(e)}(e);return n.setAttemptNumber(t),n}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.apply=function(){return s(this,void 0,void 0,(function(){return o(this,(function(t){return[2,!!this.isFirstAttempt||e.prototype.apply.call(this)]}))}))},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(n(47).Delay);t.SkipFirstDelay=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(75),r=n(76);t.JitterFactory=function(e){switch(e.jitter){case"full":return i.fullJitter;case"none":default:return r.noJitter}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noJitter=function(e){return e}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(n(47).Delay);t.AlwaysDelay=s},function(e,t,n){"use strict";t.byteLength=function(e){var t=l(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,i=l(e),o=i[0],a=i[1],c=new s(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),u=0,d=a>0?o-4:o;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[u++]=255&t);1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,s=[],o=0,a=n-r;o<a;o+=16383)s.push(u(e,o,o+16383>a?a:o+16383));1===r?(t=e[n-1],s.push(i[t>>2]+i[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],s.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return s.join("")};for(var i=[],r=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)i[a]=o[a],r[o.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,n){for(var r,s,o=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(i[(s=r)>>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(e,t){
|
|
22
|
+
var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function r(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function o(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}function c(e,t){return function(n,i){t(n,i,e)}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function d(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function p(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function h(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof y?Promise.resolve(n.value.v).then(c,u):l(s[0][2],n)}catch(e){l(s[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function _(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:y(e[i](t)),done:"return"===i}:r?r(t):t}:r}}function v(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=h(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function T(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var i=n(25),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=d;var s=Object.create(n(20)),o=n(57),a=n(59);s.inherits(d,o);for(var c=r(a.prototype),u=0;u<c.length;u++){var l=c[u];d.prototype[l]||(d.prototype[l]=a.prototype[l])}function d(e){if(!(this instanceof d))return new d(e);o.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",p)}function p(){this.allowHalfOpen||this._writableState.ended||i.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),d.prototype._destroy=function(e,t){this.push(null),this.end(),i.nextTick(t,e)}},function(e,t,n){"use strict";n.r(t);var i=n(32),r=n(12);let s,o,a=0,c=0;var u=function(e,t,n){let u=t&&n||0;const l=t||new Array(16);let d=(e=e||{}).node||s,p=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==p){const t=e.random||(e.rng||i.a)();null==d&&(d=s=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==p&&(p=o=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),f=void 0!==e.nsecs?e.nsecs:c+1;const m=h-a+(f-c)/1e4;if(m<0&&void 0===e.clockseq&&(p=p+1&16383),(m<0||h>a)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,c=f,o=p,h+=122192928e5;const g=(1e4*(268435455&h)+f)%4294967296;l[u++]=g>>>24&255,l[u++]=g>>>16&255,l[u++]=g>>>8&255,l[u++]=255&g;const y=h/4294967296*1e4&268435455;l[u++]=y>>>8&255,l[u++]=255&y,l[u++]=y>>>24&15|16,l[u++]=y>>>16&255,l[u++]=p>>>8|128,l[u++]=255&p;for(let e=0;e<6;++e)l[u+e]=d[e];return t||Object(r.b)(l)},l=n(13);var d=function(e){if(!Object(l.a)(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};function p(e,t,n){function i(e,i,s,o){var a;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof i&&(i=d(i)),16!==(null===(a=i)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+e.length);if(c.set(i),c.set(e,i.length),c=n(c),c[6]=15&c[6]|t,c[8]=63&c[8]|128,s){o=o||0;for(let e=0;e<16;++e)s[o+e]=c[e];return s}return Object(r.b)(c)}try{i.name=e}catch(e){}return i.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",i.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",i}function h(e){return 14+(e+64>>>9<<4)+1}function f(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t,n,i,r,s){return f((o=f(f(t,e),f(i,s)))<<(a=r)|o>>>32-a,n);var o,a}function g(e,t,n,i,r,s,o){return m(t&n|~t&i,e,t,r,s,o)}function y(e,t,n,i,r,s,o){return m(t&i|n&~i,e,t,r,s,o)}function b(e,t,n,i,r,s,o){return m(t^n^i,e,t,r,s,o)}function _(e,t,n,i,r,s,o){return m(n^(t|~i),e,t,r,s,o)}var v=p("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length;for(let i=0;i<n;i+=8){const n=e[i>>5]>>>i%32&255,r=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);t.push(r)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[h(t)-1]=t;let n=1732584193,i=-271733879,r=-1732584194,s=271733878;for(let t=0;t<e.length;t+=16){const o=n,a=i,c=r,u=s;n=g(n,i,r,s,e[t],7,-680876936),s=g(s,n,i,r,e[t+1],12,-389564586),r=g(r,s,n,i,e[t+2],17,606105819),i=g(i,r,s,n,e[t+3],22,-1044525330),n=g(n,i,r,s,e[t+4],7,-176418897),s=g(s,n,i,r,e[t+5],12,1200080426),r=g(r,s,n,i,e[t+6],17,-1473231341),i=g(i,r,s,n,e[t+7],22,-45705983),n=g(n,i,r,s,e[t+8],7,1770035416),s=g(s,n,i,r,e[t+9],12,-1958414417),r=g(r,s,n,i,e[t+10],17,-42063),i=g(i,r,s,n,e[t+11],22,-1990404162),n=g(n,i,r,s,e[t+12],7,1804603682),s=g(s,n,i,r,e[t+13],12,-40341101),r=g(r,s,n,i,e[t+14],17,-1502002290),i=g(i,r,s,n,e[t+15],22,1236535329),n=y(n,i,r,s,e[t+1],5,-165796510),s=y(s,n,i,r,e[t+6],9,-1069501632),r=y(r,s,n,i,e[t+11],14,643717713),i=y(i,r,s,n,e[t],20,-373897302),n=y(n,i,r,s,e[t+5],5,-701558691),s=y(s,n,i,r,e[t+10],9,38016083),r=y(r,s,n,i,e[t+15],14,-660478335),i=y(i,r,s,n,e[t+4],20,-405537848),n=y(n,i,r,s,e[t+9],5,568446438),s=y(s,n,i,r,e[t+14],9,-1019803690),r=y(r,s,n,i,e[t+3],14,-187363961),i=y(i,r,s,n,e[t+8],20,1163531501),n=y(n,i,r,s,e[t+13],5,-1444681467),s=y(s,n,i,r,e[t+2],9,-51403784),r=y(r,s,n,i,e[t+7],14,1735328473),i=y(i,r,s,n,e[t+12],20,-1926607734),n=b(n,i,r,s,e[t+5],4,-378558),s=b(s,n,i,r,e[t+8],11,-2022574463),r=b(r,s,n,i,e[t+11],16,1839030562),i=b(i,r,s,n,e[t+14],23,-35309556),n=b(n,i,r,s,e[t+1],4,-1530992060),s=b(s,n,i,r,e[t+4],11,1272893353),r=b(r,s,n,i,e[t+7],16,-155497632),i=b(i,r,s,n,e[t+10],23,-1094730640),n=b(n,i,r,s,e[t+13],4,681279174),s=b(s,n,i,r,e[t],11,-358537222),r=b(r,s,n,i,e[t+3],16,-722521979),i=b(i,r,s,n,e[t+6],23,76029189),n=b(n,i,r,s,e[t+9],4,-640364487),s=b(s,n,i,r,e[t+12],11,-421815835),r=b(r,s,n,i,e[t+15],16,530742520),i=b(i,r,s,n,e[t+2],23,-995338651),n=_(n,i,r,s,e[t],6,-198630844),s=_(s,n,i,r,e[t+7],10,1126891415),r=_(r,s,n,i,e[t+14],15,-1416354905),i=_(i,r,s,n,e[t+5],21,-57434055),n=_(n,i,r,s,e[t+12],6,1700485571),s=_(s,n,i,r,e[t+3],10,-1894986606),r=_(r,s,n,i,e[t+10],15,-1051523),i=_(i,r,s,n,e[t+1],21,-2054922799),n=_(n,i,r,s,e[t+8],6,1873313359),s=_(s,n,i,r,e[t+15],10,-30611744),r=_(r,s,n,i,e[t+6],15,-1560198380),i=_(i,r,s,n,e[t+13],21,1309151649),n=_(n,i,r,s,e[t+4],6,-145523070),s=_(s,n,i,r,e[t+11],10,-1120210379),r=_(r,s,n,i,e[t+2],15,718787259),i=_(i,r,s,n,e[t+9],21,-343485551),n=f(n,o),i=f(i,a),r=f(r,c),s=f(s,u)}return[n,i,r,s]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(h(t));for(let i=0;i<t;i+=8)n[i>>5]|=(255&e[i/8])<<i%32;return n}(e),8*e.length))})),S=n(171);function w(e,t,n,i){switch(e){case 0:return t&n^~t&i;case 1:return t^n^i;case 2:return t&n^t&i^n&i;case 3:return t^n^i}}function T(e,t){return e<<t|e>>>32-t}var I=p("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const i=e.length/4+2,r=Math.ceil(i/16),s=new Array(r);for(let t=0;t<r;++t){const n=new Uint32Array(16);for(let i=0;i<16;++i)n[i]=e[64*t+4*i]<<24|e[64*t+4*i+1]<<16|e[64*t+4*i+2]<<8|e[64*t+4*i+3];s[t]=n}s[r-1][14]=8*(e.length-1)/Math.pow(2,32),s[r-1][14]=Math.floor(s[r-1][14]),s[r-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<r;++e){const i=new Uint32Array(80);for(let t=0;t<16;++t)i[t]=s[e][t];for(let e=16;e<80;++e)i[e]=T(i[e-3]^i[e-8]^i[e-14]^i[e-16],1);let r=n[0],o=n[1],a=n[2],c=n[3],u=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=T(r,5)+w(n,o,a,c)+u+t[n]+i[e]>>>0;u=c,c=a,a=T(o,30)>>>0,o=r,r=s}n[0]=n[0]+r>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+u>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var N=function(e){if(!Object(l.a)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)};n.d(t,"v1",(function(){return u})),n.d(t,"v3",(function(){return v})),n.d(t,"v4",(function(){return S.a})),n.d(t,"v5",(function(){return I})),n.d(t,"NIL",(function(){return"00000000-0000-0000-0000-000000000000"})),n.d(t,"version",(function(){return N})),n.d(t,"validate",(function(){return l.a})),n.d(t,"stringify",(function(){return r.a})),n.d(t,"parse",(function(){return d}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9),r=n(36);class s extends r.Transform{constructor(e,t,n="be"){super(),this._block=i.Buffer.alloc(e),this._finalSize=t,this._blockSize=e,this._bigEndian="be"===n,this._len=0}_transform(e,t,n){let i=null;try{this.update(e,t)}catch(e){i=e}n(i)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){"string"==typeof e&&(t=t||"utf8",e=i.Buffer.from(e,t));const n=this._block,r=this._blockSize,s=e.length;let o=this._len;for(let t=0;t<s;){const i=o%r,a=Math.min(s-t,r-i);for(let r=0;r<a;r++)n[i+r]=e[t+r];o+=a,t+=a,o%r==0&&this._update(n)}return this._len+=s,this}digest(e){const t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));const n=8*this._len;if(n<=4294967295)this._bigEndian?(this._block.writeUInt32BE(0,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)):(this._block.writeUInt32LE(n,this._blockSize-8),this._block.writeUInt32LE(0,this._blockSize-4));else{const e=(4294967295&n)>>>0,t=(n-e)/4294967296;this._bigEndian?(this._block.writeUInt32BE(t,this._blockSize-8),this._block.writeUInt32BE(e,this._blockSize-4)):(this._block.writeUInt32LE(e,this._blockSize-8),this._block.writeUInt32LE(t,this._blockSize-4))}this._update(this._block);const i=this._hash();return e?i.toString(e):i}_update(e){throw new Error("_update must be implemented by subclass")}_hash(){throw new Error("_update must be implemented by subclass")}}t.default=s},function(e,t,n){"use strict";t.inherits=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionTypes=void 0,function(e){e.softphone="softphone",e.collaborateVideo="collaborateVideo",e.acdScreenShare="screenShare",e.screenRecording="screenRecording",e.unknown="unknown"}(t.SessionTypes||(t.SessionTypes={}))},function(e,t){const n=e.exports={};function i(){}n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=i,n.addListener=i,n.once=i,n.off=i,n.removeListener=i,n.removeAllListeners=i,n.emit=i,n.prependListener=i,n.prependOnceListener=i,n.nextTick=(e,...t)=>window.queueMicrotask(()=>e(...t)),n.listeners=e=>[],n.cwd=()=>"/",n.umask=()=>0,n.binding=e=>{throw new Error("process.binding is not supported")},n.chdir=e=>{throw new Error("process.chdir is not supported")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(24);class r{constructor(e,t={},n=[]){this.name=e,this.attributes=t,this.children=[],this.optionalNamespaces={};for(const e of n)if("string"!=typeof e){const t=new r(e.name,e.attributes,e.children);t.parent=this,this.children.push(t)}else this.children.push(e)}getName(){return this.name.indexOf(":")>=0?this.name.substr(this.name.indexOf(":")+1):this.name}getNamespace(){if(this.name.indexOf(":")>=0){const e=this.name.substr(0,this.name.indexOf(":"));return this.findNamespaceForPrefix(e)}return this.findNamespaceForPrefix()}getNamespaceContext(){let e={};this.parent&&(e=this.parent.getNamespaceContext());for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")){const i=t.substr(6);e[n]=i}return e}getDefaultNamespace(){return this.attributes.xmlns?this.attributes.xmlns:this.parent?this.parent.getDefaultNamespace():""}getNamespaceRoot(e){if(this.parent){const t=this.parent.getNamespaceRoot(e);if(t)return t}for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")&&n===e)return this;if(this.optionalNamespaces[e])return this}getAttribute(e,t){if(!t)return this.attributes[e];const n=this.getNamespaceContext();return n[t]?this.attributes[[n[t],e].join(":")]:void 0}getChild(e,t){return this.getChildren(e,t)[0]}getChildren(e,t){const n=[];for(const i of this.children)"string"==typeof i||i.getName()!==e||t&&i.getNamespace()!==t||n.push(i);return n}getText(){let e="";for(const t of this.children)"string"==typeof t&&(e+=t);return e}appendChild(e){return this.children.push(e),"string"!=typeof e&&(e.parent=this),e}setAttribute(e,t,n=!1){this.attributes[e]=t||void 0,""===t&&n&&(this.attributes[e]=t)}addOptionalNamespace(e,t){this.optionalNamespaces[t]=e}useNamespace(e,t){return this.optionalNamespaces[t]&&(e=this.optionalNamespaces[t]),this.setAttribute("xmlns:"+e,t),e}toJSON(){const e=this.children.map(e=>"string"==typeof e?e:e?e.toJSON():void 0).filter(e=>!!e),t={};for(const[e,n]of Object.entries(this.attributes))null!=n&&(t[e]=n);return{attributes:t,children:e,name:this.name}}toString(){let e=this.openTag(!0);if(this.children.length){for(const t of this.children)"string"==typeof t?e+=(0,i.escapeXMLText)(t):t&&(e+=t.toString());e+=this.closeTag()}return e}openTag(e=!1){let t="";t+="<"+this.name;for(const[e,n]of Object.entries(this.attributes))void 0!==n&&(t+=` ${e}="${(0,i.escapeXML)(n.toString())}"`);return e&&0===this.children.length?t+="/>":t+=">",t}closeTag(){return`</${this.name}>`}findNamespaceForPrefix(e){if(e){const t="xmlns:"+e;if(this.attributes[t])return this.attributes[t];if(this.parent)return this.parent.findNamespaceForPrefix(e)}else{if(this.attributes.xmlns)return this.attributes.xmlns;if(this.parent)return this.parent.findNamespaceForPrefix()}return""}}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.basicLanguageResolver=t.escapeXMLText=t.unescapeXML=t.escapeXML=void 0;const i=(0,n(3).__importDefault)(n(34)),r={'"':""","&":"&","'":"'","<":"<",">":">"},s={"&":"&","'":"'",">":">","<":"<",""":'"'},o=/&([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);/g,a=/&|<|>|"|'/g,c=/&|<|>/g;function u(e){return r[e]}t.escapeXML=function(e){return e.replace(a,u)},t.unescapeXML=function(e){return e.replace(o,e=>function(e){if(s[e])return s[e];const t=e.startsWith("&#x"),n=parseInt(e.substring(t?3:2,e.length-1),t?16:10);if(9===n||10===n||13===n||32<=n&&n<=55295||57344<=n&&n<=65533||65536<=n&&n<=1114111)return String.fromCodePoint(n);throw i.default.restrictedXML("Prohibited entity: "+e)}(e))},t.escapeXMLText=function(e){return e.replace(c,u)},t.basicLanguageResolver=function(e,t=[],n=""){const i=new Set(e.map(e=>e.toLowerCase()));for(let e of t.map(e=>e.toLowerCase()))if("*"!==e)for(;e.length>0;){if(i.has(e))return e;e=e.substring(0,e.lastIndexOf("-")).toLowerCase(),e.lastIndexOf("-")===e.length-2&&(e=e.substring(0,e.lastIndexOf("-")))}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nextTick=void 0,t.nextTick=function(e,...t){queueMicrotask(()=>e(...t))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exportToSDP=t.importFromSDP=void 0;const i=(0,n(3).__importStar)(n(63));t.importFromSDP=function(e){const t=i.getMediaSections(e),n=i.getDescription(e),r={groups:[],media:[]};i.matchPrefix(n,"a=ice-lite").length>0&&(r.iceLite=!0);for(const e of i.matchPrefix(n,"a=group:")){const t=e.split(" "),n=t.shift().substr(8);r.groups.push({mids:t,semantics:n})}for(const e of t){const t=i.getKind(e),s=i.isRejected(e),o=i.parseMLine(e),a={direction:i.getDirection(e,n),kind:t,mid:i.getMid(e),protocol:o.protocol};if(s||(a.iceParameters=i.getIceParameters(e,n),a.dtlsParameters=i.getDtlsParameters(e,n),a.setup=i.matchPrefix(e,"a=setup:")[0].substr(8),r.iceLite&&(a.iceParameters.iceLite=!0)),"audio"===t||"video"===t){a.rtpParameters=i.parseRtpParameters(e),a.rtpEncodingParameters=i.parseRtpEncodingParameters(e),a.rtcpParameters=i.parseRtcpParameters(e);const t=i.parseMsid(e);a.streams=t?[t]:[]}else"application"===t&&(a.sctp=i.parseSctpDescription(e));a.candidates=i.matchPrefix(e,"a=candidate:").map(i.parseCandidate),r.media.push(a)}return r},t.exportToSDP=function(e){const t=[];t.push(i.writeSessionBoilerplate(e.sessionId,e.sessionVersion),"a=msid-semantic:WMS *\r\n"),(e.iceLite||e.media.filter(e=>e.iceParameters&&e.iceParameters.iceLite).length>0)&&t.push("a=ice-lite\r\n");for(const n of e.groups||[])t.push(`a=group:${n.semantics} ${n.mids.join(" ")}\r\n`);for(const n of e.media||[]){const e=!(n.iceParameters&&n.dtlsParameters);if("application"===n.kind&&n.sctp)t.push(i.writeSctpDescription(n,n.sctp));else if(n.rtpParameters){let r=i.writeRtpDescription(n.kind,n.rtpParameters);e&&(r=r.replace(`m=${n.kind} 9 `,`m=${n.kind} 0 `)),t.push(r),t.push(`a=${n.direction||"sendrecv"}\r\n`);for(const e of n.streams||[])t.push(`a=msid:${e.stream} ${e.track}\r\n`);if(n.rtcpParameters&&(t.push(i.writeRtcpParameters(n.rtcpParameters)),n.rtcpParameters.cname&&n.rtpEncodingParameters&&n.rtpEncodingParameters[0].rtx)){const e=n.rtpEncodingParameters[0];t.push(`a=ssrc-group:FID ${e.ssrc} ${e.rtx.ssrc}\r\n`),t.push(`a=ssrc:${e.rtx.ssrc} cname:${n.rtcpParameters.cname}\r\n`)}}if(void 0!==n.mid&&t.push(`a=mid:${n.mid}\r\n`),n.iceParameters&&t.push(i.writeIceParameters({usernameFragment:n.iceParameters.usernameFragment,password:n.iceParameters.password})),n.dtlsParameters&&n.setup&&t.push(i.writeDtlsParameters(n.dtlsParameters,n.setup)),n.candidates&&n.candidates.length)for(const e of n.candidates)t.push(`a=${i.writeCandidate(e)}\r\n`)}return t.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpClient=void 0;const i=n(16).__importStar(n(66)),r=n(11);class s{constructor(){this._httpRetryingRequests=new Map}requestApiWithRetry(e,t,n){const i=r.retryPromise(this.requestApi.bind(this,e,t),e=>{var n,i,r;let o=!1;if(null==e?void 0:e.response){o=s.retryStatusCodes.has(e.response.status||0);const a=(null===(n=e.response.headers)||void 0===n?void 0:n["retry-after"])||(null===(r=(i=e.response).getResponseHeader)||void 0===r?void 0:r.call(i,"retry-after"));a&&((t.logger||console).debug("retry-after header found on response. setting retry delay",{retryAfter:a}),o=1e3*parseInt(a,10))}return o},n,t.logger);return this._httpRetryingRequests.set(i._id,i),i.promise.then(()=>this.cancelRetryRequest(i._id),()=>this.cancelRetryRequest(i._id)),i}requestApi(e,t){const n=t.logger||console,r=(new Date).getTime(),s=this._buildUri(t.host,e,t.version),o={method:t.method,url:s,data:t.data,responseType:t.responseType,timeout:t.requestTimeout||3e4,headers:{"content-type":t.contentType||"application/json"}};t.noAuthHeader||(o.headers.Authorization="Bearer "+t.authToken);const a=this.handleResponse.bind(this,n,r,o);return i.default(o).then(a,a)}handleResponse(e,t,n,r){var s,o,a;let c=(new Date).getTime(),u=c-t+"ms";if(r instanceof i.AxiosError){if((null===(o=null===(s=r.config)||void 0===s?void 0:s.headers)||void 0===o?void 0:o.Authorization)&&(r.config.headers.Authorization="redacted"),"ECONNABORTED"===r.code)return e.debug("request error: "+n.url,{message:r.message,now:c,elapsed:u},{skipServer:!0}),Promise.reject(r);const t=r.response||{};let i=t.status,l=t.headers&&t.headers["inin-correlation-id"],d=t.data,p={...r,text:null===(a=t.request)||void 0===a?void 0:a.response};return e.debug("request error: "+n.url,{message:r.message,now:c,elapsed:u,status:i,correlationId:l,body:d},{skipServer:!0}),Promise.reject(p)}let l=r.status,d=r.headers["inin-correlation-id"],p=JSON.stringify(r.data);return e.debug(`response: ${n.method.toUpperCase()} ${n.url}`,{now:c,status:l,elapsed:u,correlationId:d,body:p},{skipServer:!0}),Promise.resolve(r)}stopAllRetries(){Array.from(this._httpRetryingRequests.keys()).forEach(e=>this.cancelRetryRequest(e))}cancelRetryRequest(e){const t=this._httpRetryingRequests.get(e);return t&&(t.cancel(new Error("Retry request cancelled")),this._httpRetryingRequests.delete(e)),!0}formatRequestError(e){if(this.isSuperagentNetworkError(e))return{status:e.status,method:e.method,url:e.url,crossDomain:e.crossDomain,message:e.message,name:e.name,stack:e.stack};if(this.isSuperagentResponseError(e)){const t=e.response;return{status:e.status,correlationId:t.headers["inin-correlation-id"],message:"Error making HTTP request",method:t.req.method,name:t.error.name,stack:t.error.stack}}return e}isSuperagentNetworkError(e){return e&&e.hasOwnProperty("status")&&e.hasOwnProperty("method")&&e.hasOwnProperty("url")}isSuperagentResponseError(e){return!!(e&&e.response&&e.response.body&&e.response.req)}_buildUri(e,t,n="v2"){return t=t.replace(/^\/+|\/+$/g,""),0===e.indexOf("http")?`${e}/api/${n}/${t}`:`https://api.${e}/api/${n}/${t}`}}t.HttpClient=s,s.retryStatusCodes=new Set([408,413,429,500,502,503,504])},function(e,t){var n=Object.prototype.hasOwnProperty;function i(e){return"[Throws: "+(e?e.message:"?")+"]"}function r(e){var t=[];return function e(r){if(null===r||"object"!=typeof r)return r;if(-1!==t.indexOf(r))return"[Circular]";if(t.push(r),"function"==typeof r.toJSON)try{var s=e(r.toJSON());return t.pop(),s}catch(e){return i(e)}if(Array.isArray(r)){var o=r.map(e);return t.pop(),o}var a=Object.keys(r).reduce((function(t,s){return t[s]=e(function(e,t){if(n.call(e,t))try{return e[t]}catch(e){return i(e)}return e[t]}(r,s)),t}),{});return t.pop(),a}(e)}e.exports=function(e,t,n){return JSON.stringify(r(e),t,n)},e.exports.ensureProperties=r},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";function i(e,t){return function(){return e.apply(t,arguments)}}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";t.a=null},function(e,t,n){"use strict";let i;n.d(t,"a",(function(){return s}));const r=new Uint8Array(16);function s(){if(!i&&(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!i))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(r)}},function(e,t,n){(function(e,i){var r;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof i&&i;o.global!==o&&o.window!==o&&o.self;var a,c=2147483647,u=/^xn--/,l=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,f=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function y(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+g((e=e.replace(d,".")).split("."),t).join(".")}function b(e){for(var t,n,i=[],r=0,s=e.length;r<s;)(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<s?56320==(64512&(n=e.charCodeAt(r++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),r--):i.push(t);return i}function _(e){return g(e,(function(e){var t="";return e>65535&&(t+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=f(e)})).join("")}function v(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var i=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;i+=36)e=h(e/35);return h(i+36*e/(e+38))}function w(e){var t,n,i,r,s,o,a,u,l,d,p,f=[],g=e.length,y=0,b=128,v=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&m("not-basic"),f.push(e.charCodeAt(i));for(r=n>0?n+1:0;r<g;){for(s=y,o=1,a=36;r>=g&&m("invalid-input"),((u=(p=e.charCodeAt(r++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>h((c-y)/o))&&m("overflow"),y+=u*o,!(u<(l=a<=v?1:a>=v+26?26:a-v));a+=36)o>h(c/(d=36-l))&&m("overflow"),o*=d;v=S(y-s,t=f.length+1,0==s),h(y/t)>c-b&&m("overflow"),b+=h(y/t),y%=t,f.splice(y++,0,b)}return _(f)}function T(e){var t,n,i,r,s,o,a,u,l,d,p,g,y,_,w,T=[];for(g=(e=b(e)).length,t=128,n=0,s=72,o=0;o<g;++o)(p=e[o])<128&&T.push(f(p));for(i=r=T.length,r&&T.push("-");i<g;){for(a=c,o=0;o<g;++o)(p=e[o])>=t&&p<a&&(a=p);for(a-t>h((c-n)/(y=i+1))&&m("overflow"),n+=(a-t)*y,t=a,o=0;o<g;++o)if((p=e[o])<t&&++n>c&&m("overflow"),p==t){for(u=n,l=36;!(u<(d=l<=s?1:l>=s+26?26:l-s));l+=36)w=u-d,_=36-d,T.push(f(v(d+w%_,0))),u=h(w/_);T.push(f(v(u,0))),s=S(n,y,i==r),n=0,++i}++n,++t}return T.join("")}a={version:"1.4.1",ucs2:{decode:b,encode:_},decode:w,encode:T,toASCII:function(e){return y(e,(function(e){return l.test(e)?"xn--"+T(e):e}))},toUnicode:function(e){return y(e,(function(e){return u.test(e)?w(e.slice(4).toLowerCase()):e}))}},void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r)}()}).call(this,n(191)(e),n(15))},function(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.JXTErrorCondition=void 0,function(e){e.NotWellFormed="not-well-formed",e.RestrictedXML="restricted-xml",e.AlreadyClosed="already-closed",e.UnknownRoot="unknown-stream-root"}(i=t.JXTErrorCondition||(t.JXTErrorCondition={}));class r extends Error{constructor(e){super(e.text),this.isJXTError=!0,this.condition=e.condition,this.text=e.text}static notWellFormed(e){return new r({condition:i.NotWellFormed,text:e})}static restrictedXML(e){return new r({condition:i.RestrictedXML,text:e})}static alreadyClosed(e){return new r({condition:i.AlreadyClosed,text:e})}static unknownRoot(e){return new r({condition:i.UnknownRoot,text:e})}}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.childAlternateLanguageRawElement=t.childLanguageRawElement=t.childRawElement=t.staticValue=t.splicePath=t.multipleChildEnum=t.multipleChildAlternateLanguageText=t.childAlternateLanguageText=t.multipleChildIntegerAttribute=t.multipleChildAttribute=t.multipleChildText=t.childDoubleEnum=t.childEnum=t.deepMultipleChildText=t.deepChildBoolean=t.deepChildInteger=t.deepChildText=t.childBoolean=t.childTimezoneOffset=t.childJSON=t.childFloat=t.childInteger=t.childDate=t.childTextBuffer=t.childText=t.childLanguageAttribute=t.languageAttribute=t.textBuffer=t.textJSON=t.text=t.childDateAttribute=t.childFloatAttribute=t.childIntegerAttribute=t.childBooleanAttribute=t.childAttribute=t.namespacedDateAttribute=t.namespacedFloatAttribute=t.namespacedIntegerAttribute=t.namespacedBooleanAttribute=t.namespacedAttribute=t.dateAttribute=t.floatAttribute=t.integerAttribute=t.booleanAttribute=t.attribute=t.findOrCreate=t.findAll=t.getTargetLang=t.getLang=t.createElement=void 0,t.parameterMap=void 0;const i=n(3),r=n(7),s=(0,i.__importDefault)(n(23)),o=n(37);function a(e,t,n,i){if(i){e=e||i.getNamespace();const n=i.getNamespaceRoot(e);if(n){t=`${n.useNamespace("",e)}:${t}`}}const r=new s.default(t);return t.indexOf(":")<0&&(!n||e!==n)&&r.setAttribute("xmlns",e),r}function c(e,t){return(e.getAttribute("xml:lang")||t||"").toLowerCase()}function u(e,t){const n=[];for(const i of e)n.push(c(i,t.lang));let i;return i=t.resolveLanguage?t.resolveLanguage(n,t.acceptLanguages||[],t.lang):t.lang,i||""}function l(e,t,n,i){const r=e.getChildren(n,t),s=c(e);return r.length?i?r.filter(e=>{if(c(e,s)===i)return!0}):r:[]}function d(e,t,n,i){t=t||e.getNamespace();const r=l(e,t,n,i);if(r.length)return r[0];const s=a(t,n,e.getDefaultNamespace(),e),o=c(e,i);return i&&o!==i&&s.setAttribute("xml:lang",i),e.appendChild(s),s}function p(e){return{importer(t){const n=t.getAttribute(e.name,e.namespace);return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);if(i||e.emitEmpty)if(e.namespace&&e.prefix){let n;const r=t.getNamespaceRoot(e.namespace);if(r)n=r.useNamespace(e.prefix,e.namespace);else{const i=t.getNamespaceContext();i[e.namespace]||(n=t.useNamespace(e.prefix,e.namespace),i[e.namespace]=n)}t.setAttribute(`${n}:${e.name}`,i,e.emitEmpty)}else t.setAttribute(e.name,i,e.emitEmpty)}}}function h(e,t){return(n,i,r={})=>(r={staticDefault:i,...r},p({name:n,...e,...t?t(r):r}))}function f(e,t){return(n,i,r,s,o={})=>(o={staticDefault:s,...o},p({name:r,namespace:i,prefix:n,...e,...t?t(o):o}))}function m(e){const t=e.converter||p({...e,namespace:e.attributeNamespace});return{importer(n,i){const r=n.getChild(e.element,e.namespace||n.getNamespace());return r?t.importer(r,i):e.dynamicDefault?e.dynamicDefault():e.staticDefault},exporter(n,i,r){if(void 0!==i&&i!==e.staticDefault){const s=d(n,e.namespace||n.getNamespace(),e.element);t.exporter(s,i,r)}}}}function g(e,t){return(n,i,r,s,o={})=>(o={staticDefault:s,...o},m({element:i,name:r,namespace:n,...e,...t?t(o):o}))}function y(e){return{importer(t){const n=t.getText();return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(!n&&e.emitEmpty)return void t.children.push("");if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);i&&t.children.push(i)}}}function b(e){const t=y(e);return{importer(n,i){const r=l(n,e.namespace||n.getNamespace(),e.element),s=u(r,i);if(!r.length)return e.dynamicDefault?e.dynamicDefault():e.staticDefault;if(e.matchLanguage)for(const e of r)if(c(e,i.lang)===s)return t.importer(e,i);return t.importer(r[0],i)},exporter(n,i,r){if(i||!e.emitEmpty){if(void 0!==i&&i!==e.staticDefault){const s=d(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0);t.exporter(s,i,r)}}else d(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0)}}}t.createElement=a,t.getLang=c,t.getTargetLang=u,t.findAll=l,t.findOrCreate=d;const _={parseValue:e=>e,writeValue:e=>e},v={parseValue:e=>parseInt(e,10),writeValue:e=>e.toString()},S={parseValue:e=>parseFloat(e),writeValue:e=>e.toString()},w={parseValue:e=>"true"===e||"1"===e||"false"!==e&&"0"!==e&&void 0,writeValue:e=>e?"1":"0"},T={parseValue:e=>new Date(e),writeValue:e=>"string"==typeof e?e:e.toISOString()},I={parseValue:e=>JSON.parse(e),writeValue:e=>JSON.stringify(e)},N=(e="utf8")=>({parseValue:t=>("base64"===e&&"="===t&&(t=""),r.Buffer.from(t.trim(),e)),writeValue:t=>{let n;return n="string"==typeof t?r.Buffer.from(t).toString(e):t?t.toString(e):"","base64"===e&&(n=n||"="),n}}),A={parseValue:e=>{let t=-1;"-"===e.charAt(0)&&(t=1,e=e.slice(1));const n=e.split(":");return(60*parseInt(n[0],10)+parseInt(n[1],10))*t},writeValue:e=>{if("string"==typeof e)return e;{let t="-";e<0&&(e=-e,t="+");const n=e/60,i=e%60;return t+=(n<10?"0":"")+n+":"+(i<10?"0":"")+i,t}}};t.attribute=h(_,e=>({dynamicDefault:e.emitEmpty?t=>""===t?"":e.staticDefault:void 0,...e})),t.booleanAttribute=h(w),t.integerAttribute=h(v),t.floatAttribute=h(S),t.dateAttribute=h(T),t.namespacedAttribute=f(_),t.namespacedBooleanAttribute=f(w),t.namespacedIntegerAttribute=f(v),t.namespacedFloatAttribute=f(S),t.namespacedDateAttribute=f(T),t.childAttribute=g(_),t.childBooleanAttribute=g(w),t.childIntegerAttribute=g(v),t.childFloatAttribute=g(S),t.childDateAttribute=g(T);t.text=e=>y({staticDefault:e,..._});t.textJSON=()=>y({...I});function E(){return{importer:(e,t)=>c(e,t.lang),exporter(e,t,n){t&&t.toLowerCase()!==n.lang?e.setAttribute("xml:lang",t):e.setAttribute("xml:lang",void 0)}}}t.textBuffer=(e="utf8")=>y({...N(e)}),t.languageAttribute=E;t.childLanguageAttribute=(e,t)=>m({converter:E(),element:t,name:"xml:lang",namespace:e,..._});t.childText=(e,t,n,i=!1)=>b({element:t,emitEmpty:i,matchLanguage:!0,namespace:e,staticDefault:n,..._});t.childTextBuffer=(e,t,n="utf8")=>b({element:t,matchLanguage:!0,namespace:e,...N(n)});t.childDate=(e,t)=>b({element:t,namespace:e,...T});t.childInteger=(e,t,n)=>b({element:t,namespace:e,staticDefault:n,...v});t.childFloat=(e,t,n)=>b({element:t,namespace:e,staticDefault:n,...S});t.childJSON=(e,t)=>b({element:t,namespace:e,...I}),t.childTimezoneOffset=function(e,t){return b({element:t,namespace:e,staticDefault:0,...A})},t.childBoolean=function(e,t){return{importer(n){if(n.getChild(t,e||n.getNamespace()))return!0},exporter(n,i){i&&d(n,e||n.getNamespace(),t)}}};const x=(e,t,n)=>{if(!n)return;let i=t;for(const t of e)i=d(i,t.namespace||i.getNamespace(),t.element);i.children.push(n.toString())};t.deepChildText=function(e,t){return{importer(n){let i=n;for(const n of e)if(i=i.getChild(n.element,n.namespace||i.getNamespace()),!i)return t;return i.getText()||t},exporter(t,n){x(e,t,n)}}},t.deepChildInteger=function(e,t){return{importer(n){let i=n;for(const t of e)if(i=i.getChild(t.element,t.namespace||i.getNamespace()),!i)return;const r=i.getText();return r?parseInt(r,10):t||void 0},exporter(t,n){x(e,t,n)}}},t.deepChildBoolean=function(e){return{importer(t){let n=t;for(const t of e)if(n=n.getChild(t.element,t.namespace||n.getNamespace()),!n)return!1;return!0},exporter(t,n){if(!n)return;let i=t;for(const t of e)i=d(i,t.namespace||i.getNamespace(),t.element)}}},t.deepMultipleChildText=function(e){const t=e.pop();return{importer(n,i){let r=n;for(const t of e)if(r=r.getChild(t.element,t.namespace||r.getNamespace()),!r)return[];const s=[],o=l(r,t.namespace||r.getNamespace(),t.element),a=u(o,i);for(const e of o)c(e,i.lang)===a&&s.push(e.getText());return s},exporter(n,i,r){if(!i.length)return;let s=n;for(const t of e)s=d(s,t.namespace||s.getNamespace(),t.element);const{namespace:o,element:c}=t;for(const e of i){const t=a(o||s.getNamespace(),c,r.namespace,s);t.children.push(e),s.appendChild(t)}}}},t.childEnum=function(e,t,n){const i=new Map,r=new Map;for(const e of t)"string"==typeof e?(i.set(e,e),r.set(e,e)):(i.set(e[1],e[0]),r.set(e[0],e[1]));return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&i.has(n.getName()))return i.get(n.getName());return n},exporter(t,n){r.has(n)&&d(t,e,r.get(n))}}},t.childDoubleEnum=function(e,t,n,i){const r=new Set(t),s=new Set(n);return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&r.has(n.getName())){for(const i of n.children)if("string"!=typeof i&&i.getNamespace()===(e||t.getNamespace())&&s.has(i.getName()))return[n.getName(),i.getName()];return[n.getName()]}return i},exporter(t,n){const i=d(t,e,n[0]);n[1]&&d(i,e,n[1])}}},t.multipleChildText=function(e,t){return{importer(n,i){const r=[],s=l(n,e||n.getNamespace(),t),o=u(s,i);for(const e of s)c(e,i.lang)===o&&r.push(e.getText());return r},exporter(n,i,r){for(const s of i){const i=a(e||n.getNamespace(),t,r.namespace,n);i.children.push(s),n.appendChild(i)}}}},t.multipleChildAttribute=function(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(t)}return r},exporter(i,r,s){for(const o of r){const r=a(e||i.getNamespace(),t,s.namespace,i);r.setAttribute(n,o),i.appendChild(r)}}}},t.multipleChildIntegerAttribute=function(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(parseInt(t,10))}return r},exporter(i,r,s){for(const o of r){const r=a(e||i.getNamespace(),t,s.namespace,i);r.setAttribute(n,o.toString()),i.appendChild(r)}}}},t.childAlternateLanguageText=function(e,t){return{importer(n,i){const r=[],s=l(n,e||n.getNamespace(),t),o=new Set;for(const e of s){const t=e.getText();if(t){const n=c(e,i.lang);if(o.has(n))continue;r.push({lang:n,value:t}),o.add(n)}}return o.size>0?r:void 0},exporter(n,i,r){for(const s of i){const i=s.value;if(i){const o=a(e||n.getNamespace(),t,r.namespace,n);s.lang!==r.lang&&o.setAttribute("xml:lang",s.lang),o.children.push(i),n.appendChild(o)}}}}},t.multipleChildAlternateLanguageText=function(e,t){return{importer(n,i){const r=[],s=new Map;let o=!1;const a=l(n,e||n.getNamespace(),t);for(const e of a){const t=e.getText();if(t){const n=c(e,i.lang);let a=s.get(n);a||(a=[],s.set(n,a),r.push({lang:n,value:a})),a.push(t),o=!0}}return o?r:void 0},exporter(n,i,r){for(const s of i)for(const i of s.value){const o=a(e||n.getNamespace(),t,r.namespace,n);s.lang!==r.lang&&o.setAttribute("xml:lang",s.lang),o.children.push(i),n.appendChild(o)}}}},t.multipleChildEnum=function(e,t){const n=new Map,i=new Map;for(const e of t)"string"==typeof e?(n.set(e,e),i.set(e,e)):(n.set(e[1],e[0]),i.set(e[0],e[1]));return{importer(t){const i=[];for(const r of t.children)"string"!=typeof r&&r.getNamespace()===(e||t.getNamespace())&&n.has(r.getName())&&i.push(n.get(r.getName()));return i},exporter(t,n){for(const r of n)d(t,e,i.get(r))}}},t.splicePath=function(e,t,n,i=!1){return{importer(r,s){const o=r.getChild(t,e||r.getNamespace());if(!o)return;const a=[];for(const e of o.children)if("string"!=typeof e&&s.registry.getImportKey(e)===n){const t=s.registry.import(e);t&&a.push(t)}return i?a:a[0]},exporter(i,r,s){let o=[];o=Array.isArray(r)?r:[r];const a=[];for(const t of o){const r=s.registry.export(n,t,{...s,namespace:e||i.getNamespace()||void 0});r&&a.push(r)}if(a.length){const n=d(i,e||i.getNamespace(),t);for(const e of a)n.appendChild(e)}}}},t.staticValue=function(e){return{exporter:()=>{},importer:()=>e}},t.childRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=i.getChild(t,e||i.getNamespace());return s?n?r.sanitizers[n](s.toJSON()):s.toJSON():void 0},exporter(i,r,a){if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(n){if(!a.sanitizers||!a.sanitizers[n])return;r=a.sanitizers[n](r)}r&&i.appendChild(new s.default(r.name,r.attributes,r.children))}}},t.childLanguageRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=l(i,e||i.getNamespace(),t),o=u(s,r);for(const e of s)if(c(e,r.lang)===o)return n?r.sanitizers[n](e.toJSON()):e.toJSON();return s[0]?n?r.sanitizers[n](s[0].toJSON()):s[0].toJSON():void 0},exporter(i,r,a){if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(r&&n){if(!a.sanitizers||!a.sanitizers[n])return;r=a.sanitizers[n](r)}if(!r)return;const c=d(i,e||i.getNamespace(),t,a.lang);for(const e of r.children)"string"==typeof e?c.appendChild(e):e&&c.appendChild(new s.default(e.name,e.attributes,e.children))}}},t.childAlternateLanguageRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=[],o=new Set,a=l(i,e||i.getNamespace(),t);for(const e of a){let t=e.toJSON();if(n&&(t=r.sanitizers[n](t)),t){const n=c(e,r.lang);if(o.has(n))continue;s.push({lang:n,value:t}),o.add(n)}}return o.size>0?s:void 0},exporter(i,r,c){for(const u of r){let r=u.value;if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(r&&n){if(!c.sanitizers||!c.sanitizers[n])continue;r=c.sanitizers[n](r)}if(r){const n=a(e||i.getNamespace(),t,c.namespace,i);i.appendChild(n),u.lang!==c.lang&&n.setAttribute("xml:lang",u.lang);for(const e of r.children)"string"==typeof e?n.appendChild(e):n.appendChild(new s.default(e.name,e.attributes,e.children))}}}}},t.parameterMap=function(e,n,i,r){return{importer(s,o){const a={},c=l(s,e,n),u=(0,t.attribute)(i).importer,d=(0,t.attribute)(r).importer;for(const e of c)a[u(e,o)]=d(e,o);return a},exporter(s,o,c){const u=(0,t.attribute)(i).exporter,l=(0,t.attribute)(r).exporter,d=e||s.getNamespace();for(const[e,t]of Object.entries(o)){const i=a(d,n,c.namespace,s);u(i,e,c),o[e]&&l(i,t,c),s.appendChild(i)}}}}},function(e,t,n){"use strict";t.Readable=n(57),t.Writable=n(59),t.Duplex=n(17),t.Transform=n(61),t.PassThrough=n(204)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parse=void 0;const i=n(3),r=n(6),s=n(24),o=(0,i.__importDefault)(n(23)),a=(0,i.__importDefault)(n(34));function c(e){return 97<=e&&e<=122||65<=e&&e<=90||58===e||95===e}function u(e){return 192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=767||880<=e&&e<=893||895<=e&&e<=8191||8204<=e&&e<=8205||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||65008<=e&&e<=65533||65536<=e&&e<=983039}function l(e){return c(e)||u(e)}function d(e){return c(e)||45===e||46===e||48<=e&&e<=57||183===e||768<=e&&e<=879||8255<=e&&e<=8256||u(e)}function p(e){return 32===e||10===e||13===e||9===e}class h extends r.EventEmitter{constructor(e={}){super(),this.allowComments=!0,this.attributes={},this.state=34,this.tagName="",this.haveDeclaration=!1,this.recordBuffer=[],void 0!==e.allowComments&&(this.allowComments=e.allowComments)}write(e){for(const t of e){const e=t.codePointAt(0);switch(this.state){case 34:if(60===e){let e;try{e=(0,s.unescapeXML)(this.endRecord())}catch(e){return void this.emit("error",e)}e&&this.emit("text",e),this.transition(31);continue}this.record(t);continue;case 31:if(47===e){this.transition(7);continue}if(33===e){this.transition(24);continue}if(63===e){if(this.haveDeclaration)return this.restrictedXML();this.transition(25);continue}if(l(e)){this.transition(30),this.startRecord(t);continue}return this.notWellFormed();case 30:if(d(e)){this.record(t);continue}if(p(e)){this.startTag(),this.transition(32);continue}if(47===e){this.startTag(),this.transition(29);continue}if(62===e){this.startTag(),this.transition(34),this.emit("startElement",this.tagName,this.attributes);continue}return this.notWellFormed();case 29:if(62===e){this.emit("startElement",this.tagName,this.attributes),this.emit("endElement",this.tagName),this.transition(34);continue}return this.notWellFormed();case 33:if(p(e)){this.transition(32);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 32:if(p(e))continue;if(l(e)){this.startRecord(t),this.transition(0);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 7:if(l(e)){this.startRecord(t),this.transition(6);continue}return this.notWellFormed();case 6:if(d(e)){this.record(t);continue}if(p(e)){this.transition(8);continue}if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 8:if(p(e))continue;if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 0:if(d(e)){this.record(t);continue}if(61===e){this.addAttribute(),this.transition(4);continue}if(p(e)){this.addAttribute(),this.transition(3);continue}return this.notWellFormed();case 3:if(61===e){this.transition(4);continue}if(p(e))continue;return this.notWellFormed();case 4:if(34===e){this.startRecord(),this.transition(1);continue}if(39===e){this.startRecord(),this.transition(2);continue}if(p(e))continue;return this.notWellFormed();case 1:case 2:if(34===e&&1===this.state||39===e&&2===this.state){const e=this.endRecord();this.attributes[this.attributeName]=(0,s.unescapeXML)(e),this.transition(33);continue}if(60===e)return this.notWellFormed();this.record(t);continue;case 24:if(45===e){if(!this.allowComments)return this.restrictedXML();this.transition(23);continue}if(91===e){this.transition(21);continue}return this.notWellFormed();case 23:if(45===e){this.transition(14);continue}return this.notWellFormed();case 14:45===e&&this.transition(12);continue;case 12:45===e?this.transition(11):this.transition(14);continue;case 11:62===e?this.transition(34):this.transition(14);continue;case 25:if(88===e||120===e){this.transition(28);continue}return this.notWellFormed();case 28:if(77===e||109===e){this.transition(27);continue}return this.notWellFormed();case 27:if(76===e||108===e){this.transition(26);continue}return this.notWellFormed();case 26:if(p(e)){this.haveDeclaration=!0,this.transition(15);continue}return this.notWellFormed();case 13:if(62===e){this.transition(34);continue}return this.notWellFormed();case 15:63===e&&this.transition(13);continue;case 21:this.wait(e,67,20);continue;case 20:this.wait(e,68,19);continue;case 19:this.wait(e,65,18);continue;case 18:this.wait(e,84,17);continue;case 17:this.wait(e,65,16);continue;case 16:this.wait(e,91,5);continue;case 5:if(93===e){this.transition(10);continue}this.record(t);continue;case 10:93===e?this.transition(9):(this.record(String.fromCodePoint(93)),this.record(t),this.transition(5));continue;case 9:if(62===e){const e=this.endRecord();e&&this.emit("text",e),this.transition(34)}else this.record(String.fromCodePoint(93)),this.record(String.fromCodePoint(93)),this.record(t),this.transition(5);continue}}}end(e){e&&this.write(e),this.write=()=>{}}record(e){this.recordBuffer.push(e)}startRecord(e){this.recordBuffer=[],e&&this.recordBuffer.push(e)}endRecord(){const e=this.recordBuffer;return this.recordBuffer=[],e.join("")}startTag(){this.tagName=this.endRecord(),this.attributes={}}addAttribute(){const e=this.endRecord();if(void 0!==this.attributes[e])return this.notWellFormed();this.attributeName=e,this.attributes[e]=""}wait(e,t,n){if(e!==t)return this.notWellFormed();this.transition(n)}transition(e){this.state=e,34===e&&this.startRecord()}notWellFormed(e){this.emit("error",a.default.notWellFormed(e))}restrictedXML(e){this.emit("error",a.default.restrictedXML(e))}}t.parse=function(e,t={}){const n=new h(t);let i,r,s=null;if(n.on("text",e=>{r&&r.children.push(e)}),n.on("startElement",(e,t)=>{const n=new o.default(e,t);i||(i=n),r=r?r.appendChild(n):n}),n.on("endElement",e=>{r?e===r.name?r.parent&&(r=r.parent):n.emit("error",a.default.notWellFormed("b")):n.emit("error",a.default.notWellFormed("a"))}),n.on("error",e=>{s=e}),n.write(e),n.end(),s)throw s;return i},t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StanzaMediaSession=void 0;const i=n(16),r=i.__importDefault(n(6)),s=n(39),o=n(5),a=i.__importDefault(n(65)),c=n(21),u={"Discovered new ICE candidate":{skipMessage:!0}};class l extends s.MediaSession{constructor(e){super(e.options),this.iceCandidatesDiscovered=0,this.iceCandidatesReceivedFromPeer=0,this.reinvite=!1,this.logger=e.logger,this.conversationId=e.conversationId,this.peerConnection=this.pc,this.fromUserId=e.fromUserId,this.id=this.sid,this.originalRoomJid=e.originalRoomJid,this.sessionType=c.SessionTypes[e.sessionType],this.ignoreHostCandidatesFromRemote=!!e.ignoreHostCandidatesFromRemote,this.allowIPv6=!!e.allowIPv6,this.allowTCP=!!e.allowTCP;const t=new r.default;Object.keys(t.__proto__).forEach(e=>{this[e]=t[e]}),e.optOutOfWebrtcStatsTelemetry||this.setupStatsGatherer(),this.pc.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.pc.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this))}getLogDetails(){return{conversationId:this.conversationId,sessionId:this.id,sessionType:this.sessionType}}async onTransportInfo(e,t){var n,i;const r=null===(n=e.contents)||void 0===n?void 0:n[0].transport,s=null==r?void 0:r.candidates;if(this.ignoreHostCandidatesFromRemote){const e=null==s?void 0:s.filter(e=>"host"!==e.type);(null==e?void 0:e.length)!==(null===(i=null==r?void 0:r.candidates)||void 0===i?void 0:i.length)&&(this._log("info","Ignoring remote host ice candidates"),r.candidates=e)}if(s)for(const e of s)this._log("info","Received candidate from peer",{candidateType:e.type}),this.iceCandidatesReceivedFromPeer++;return super.onTransportInfo(e,t)}_log(e,t,...n){const i=u[t];if(null==i?void 0:i.skipMessage)return;let r;if(n.length){const e=n[0];"object"!=typeof e||Array.isArray(e)||null===e?r={...this.getLogDetails(),data:e}:(Object.assign(n[0],this.getLogDetails()),r=n)}else r=[...n,this.getLogDetails()];this.logger[e](t,r)}async end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),setTimeout(()=>{"connected"!==this.pc.connectionState&&"connecting"!==this.pc.connectionState||this.pc.close()},2e3),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}setupStatsGatherer(){this.statsGatherer=new a.default(this.pc),this.statsGatherer.on("stats",this.emit.bind(this,"stats"))}onIceStateChange(){const e=this.pc.iceConnectionState,t=this.id,n=this.conversationId,i=this.sessionType;this._log("info","ICE state changed: ",{iceState:e,sessionId:t,conversationId:n}),"disconnected"===e?"stable"===this.pc.signalingState&&(this.interruptionStart=new Date,this._log("info","Connection state is interrupted",{sessionId:t,conversationId:n,sessionType:i})):"connected"===e?(this._log("info","sending session-info: active"),this.send(o.JingleAction.SessionInfo,{info:{infoType:o.JINGLE_INFO_ACTIVE}}),this._setupDataChannel()):"failed"===e&&this._log("info","ICE connection failed",{candidatesDiscovered:this.iceCandidatesDiscovered,candidatesReceivedFromPeer:this.iceCandidatesReceivedFromPeer}),super.onIceStateChange()}onConnectionStateChange(){const e=this.pc.connectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this._log("info","Connection state changed: ",{connectionState:e,sessionId:t,conversationId:n,sessionType:i}),this.interruptionStart)if("connected"===e){const e=(new Date).getTime()-this.interruptionStart.getTime();this._log("info","Connection was interrupted but was successfully recovered/connected",{sessionId:t,conversationId:n,sessionType:i,timeToRecover:e}),this.interruptionStart=void 0}else"failed"===e&&this._log("info","Connection was interrupted and failed to recover",{sessionId:t,conversationId:n,sessionType:i})}onIceCandidateError(e){const t=e;this._log("error","IceCandidateError",{errorCode:t.errorCode,errorText:t.errorText,url:t.url}),console.error("IceCandidateError",t)}onIceCandidate(e){if(e.candidate){if(!this.allowTCP&&"tcp"===e.candidate.protocol)return;if(!this.allowIPv6){const t=/.+udp [^ ]+ ([^ ]+).*typ host/.exec(e.candidate.candidate),n=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;if(t&&!t[1].match(n))return void this._log("debug","Filtering out IPv6 candidate",e.candidate.candidate)}this._log("debug","Processing ice candidate",e.candidate.candidate),this._log("info","Discovered ice candidate to send to peer",{type:e.candidate.type}),this.iceCandidatesDiscovered++}return super.onIceCandidate(e)}onIceEndOfCandidates(){super.onIceEndOfCandidates(),this.emit("endOfCandidates")}addTrack(e,t){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",async()=>{const n=this.pc.getTransceivers().find(t=>{var n;return!t.sender.track&&(null===(n=t.receiver.track)||void 0===n?void 0:n.kind)===e.kind});if(n)return n.sender.replaceTrack(e);this.pc.addTrack(e,t)})}_setupDataChannel(){var e;this.dataChannel||(null===(e=this.pc.localDescription)||void 0===e?void 0:e.sdp.includes("webrtc-datachannel"))&&(this._log("info","creating data channel"),this.dataChannel=this.pc.createDataChannel("videoConferenceControl"),this.dataChannel.addEventListener("open",()=>{this._log("info","data channel opened")}),this.dataChannel.addEventListener("message",this._handleDataChannelMessage.bind(this)),this.dataChannel.addEventListener("close",()=>{this._log("info","closing data channel")}),this.dataChannel.addEventListener("error",e=>{this._log("error","Error occurred with the data channel",e)}))}_handleDataChannelMessage(e){try{const t=JSON.parse(e.data);this.emit("dataChannelMessage",t)}catch(e){this._log("error","Failed to parse data channel message",{error:e})}}}t.StanzaMediaSession=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=t.FileSession=t.MediaSession=t.ICESession=t.Session=t.exportToSDP=t.importFromSDP=void 0;const i=n(3),r=(0,i.__importDefault)(n(62));t.FileSession=r.default;const s=(0,i.__importDefault)(n(40));t.ICESession=s.default;const o=(0,i.__importDefault)(n(64));t.MediaSession=o.default;const a=(0,i.__importDefault)(n(42));t.Session=a.default;const c=(0,i.__importDefault)(n(213));t.SessionManager=c.default;var u=n(26);Object.defineProperty(t,"importFromSDP",{enumerable:!0,get:function(){return u.importFromSDP}}),Object.defineProperty(t,"exportToSDP",{enumerable:!0,get:function(){return u.exportToSDP}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=(0,i.__importStar)(n(63)),s=n(5),o=n(1),a=n(26),c=n(41),u=(0,i.__importDefault)(n(42));class l extends u.default{constructor(e){super(e),this.bitrateLimit=0,this.candidateBuffer=[],this.transportType=o.NS_JINGLE_ICE_UDP_1,this.restartingIce=!1,this.usingRelay=!1,this.maxRelayBandwidth=e.maxRelayBandwidth,this.pc=this.parent.createPeerConnection(this,{...e.config,iceServers:e.iceServers}),this.pc.oniceconnectionstatechange=()=>{this.onIceStateChange()},this.pc.onicecandidate=e=>{e.candidate?this.onIceCandidate(e):this.onIceEndOfCandidates()},this.restrictRelayBandwidth()}end(e="success",t=!1){this.pc.close(),super.end(e,t)}async restartIce(){if(this.isInitiator){void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this.restartingIce=!0;try{await this.processLocal("restart-ice",async()=>{const e=await this.pc.createOffer({iceRestart:!0}),t=(0,a.importFromSDP)(e.sdp);this.send(s.JingleAction.TransportInfo,{contents:t.media.map(e=>({creator:s.JingleSessionRole.Initiator,name:e.mid,transport:(0,c.convertIntermediateToTransport)(e,this.transportType)})),sid:this.sid}),await this.pc.setLocalDescription(e)})}catch(e){this._log("error","Could not create WebRTC offer",e),this.end(s.JingleReasonCondition.FailedTransport,!0)}}}async setMaximumBitrate(e){this.maximumBitrate&&(e=Math.min(e,this.maximumBitrate)),this.currentBitrate=e;const t=this.pc.getSenders().find(e=>!!e.track&&"video"===e.track.kind);if(t&&t.getParameters)try{await this.processLocal("set-bitrate",async()=>{const n=t.getParameters();n.encodings&&n.encodings.length||(n.encodings=[{}]),0===e?delete n.encodings[0].maxBitrate:n.encodings[0].maxBitrate=e,await t.setParameters(n)})}catch(e){this._log("error","Set maximumBitrate failed",e)}}async onTransportInfo(e,t){if(e.contents&&e.contents[0]&&e.contents[0].transport.gatheringComplete){const n={sdpMid:e.contents[0].name,candidate:""};try{"stable"===this.pc.signalingState?await this.pc.addIceCandidate(n):this.candidateBuffer.push(n)}catch(e){this._log("debug","Could not add null end-of-candidate")}finally{t()}return}if(this.pc.remoteDescription){const n=this.pc.remoteDescription,i=(0,a.importFromSDP)(n.sdp),r=i.media.find(t=>t.mid===e.contents[0].name).iceParameters.usernameFragment,o=e.contents[0].transport.usernameFragment;if(o&&r!==o){for(const[t,n]of e.contents.entries()){const e=n.transport;i.media[t].iceParameters={password:e.password,usernameFragment:e.usernameFragment},i.media[t].candidates=[]}try{if(await this.pc.setRemoteDescription({type:n.type,sdp:(0,a.exportToSDP)(i)}),await this.processBufferedCandidates(),"offer"===n.type){const e=await this.pc.createAnswer();await this.pc.setLocalDescription(e);const t=(0,a.importFromSDP)(e.sdp);this.send(s.JingleAction.TransportInfo,{contents:t.media.map(e=>({creator:s.JingleSessionRole.Initiator,name:e.mid,transport:(0,c.convertIntermediateToTransport)(e,this.transportType)})),sid:this.sid})}else this.restartingIce=!1}catch(e){return this._log("error","Could not do remote ICE restart",e),t(e),void this.end(s.JingleReasonCondition.FailedTransport)}}}const n=(e.contents||[]).map(e=>{const t=e.name,n=(e.transport.candidates||[]).map(async e=>{const n=r.writeCandidate((0,c.convertCandidateToIntermediate)(e));if(this.pc.remoteDescription&&"stable"===this.pc.signalingState)try{await this.pc.addIceCandidate({sdpMid:t,candidate:n})}catch(e){this._log("error","Could not add ICE candidate",e)}else this.candidateBuffer.push({sdpMid:t,candidate:n})});return Promise.all(n)});try{await Promise.all(n),t()}catch(e){this._log("error","Could not process transport-info: "+e),t(e)}}async onSessionAccept(e,t){this.state="active";const n=(0,c.convertRequestToIntermediate)(e,this.peerRole),i=(0,a.exportToSDP)(n);try{await this.pc.setRemoteDescription({type:"answer",sdp:i}),await this.processBufferedCandidates(),this.parent.emit("accepted",this,void 0),t()}catch(e){this._log("error","Could not process WebRTC answer: "+e),t({condition:"general-error"})}}onSessionTerminate(e,t){this._log("info","Terminating session"),this.pc.close(),super.end(e.reason,!0),t()}onIceCandidate(e){if(!e.candidate||!e.candidate.candidate)return;const t=r.parseCandidate(e.candidate.candidate),n={contents:[{creator:s.JingleSessionRole.Initiator,name:e.candidate.sdpMid,transport:{candidates:[(0,c.convertIntermediateToCandidate)(t)],transportType:this.transportType,usernameFragment:t.usernameFragment}}]};this._log("info","Discovered new ICE candidate",n),this.send(s.JingleAction.TransportInfo,n)}onIceEndOfCandidates(){this._log("info","ICE end of candidates");const e=(0,a.importFromSDP)(this.pc.localDescription.sdp).media[0];this.send(s.JingleAction.TransportInfo,{contents:[{creator:s.JingleSessionRole.Initiator,name:e.mid,transport:{gatheringComplete:!0,transportType:this.transportType,usernameFragment:e.iceParameters.usernameFragment}}]})}onIceStateChange(){switch(this.pc.iceConnectionState){case"checking":this.connectionState="connecting";break;case"completed":case"connected":this.connectionState="connected";break;case"disconnected":if("stable"===this.pc.signalingState?this.connectionState="interrupted":this.connectionState="disconnected",this.restartingIce)return void this.end(s.JingleReasonCondition.FailedTransport);this.maybeRestartIce();break;case"failed":if("failed"===this.connectionState||this.restartingIce)return void this.end(s.JingleReasonCondition.FailedTransport);this.connectionState="failed",this.restartIce();break;case"closed":this.connectionState="disconnected",this.restartingIce?this.end(s.JingleReasonCondition.FailedTransport):this.end()}}async processBufferedCandidates(){for(const e of this.candidateBuffer)try{await this.pc.addIceCandidate(e)}catch(e){this._log("error","Could not add ICE candidate",e)}this.candidateBuffer=[]}restrictRelayBandwidth(){this.pc.addEventListener("iceconnectionstatechange",async()=>{if("completed"!==this.pc.iceConnectionState&&"connected"!==this.pc.iceConnectionState)return;const e=await this.pc.getStats();let t;if(e.forEach(n=>{"transport"===n.type&&(t=e.get(n.selectedCandidatePairId))}),t||e.forEach(e=>{"candidate-pair"===e.type&&e.selected&&(t=e)}),!t)return;let n=!1,i="",r="";if(t.remoteCandidateId){const n=e.get(t.remoteCandidateId);n&&(r=n.candidateType)}if(t.localCandidateId){const n=e.get(t.localCandidateId);n&&(i=n.candidateType)}"relay"!==i&&"relay"!==r||(n=!0),this.usingRelay=n,this.parent.emit("iceConnectionType",this,{localCandidateType:i,relayed:n,remoteCandidateType:r}),n&&void 0!==this.maxRelayBandwidth&&(this.maximumBitrate=this.maxRelayBandwidth,this.currentBitrate?this.setMaximumBitrate(Math.min(this.currentBitrate,this.maximumBitrate)):this.setMaximumBitrate(this.maximumBitrate))})}maybeRestartIce(){this.isInitiator&&(void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this._maybeRestartingIce=setTimeout(()=>{this._maybeRestartingIce=void 0,"disconnected"===this.pc.iceConnectionState&&this.restartIce()},2e3))}}t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertRequestToIntermediate=t.convertContentToIntermediate=t.convertIntermediateToRequest=t.convertIntermediateToTransport=t.convertCandidateToIntermediate=t.convertIntermediateToCandidate=t.convertIntermediateToApplication=void 0;const i=n(5),r=n(1);function s(e,t){const n=e.rtpParameters,s=e.rtcpParameters||{},o=e.rtpEncodingParameters||[];let a=!1;o&&o.length&&(a=!!o[0].ssrc);const c={applicationType:r.NS_JINGLE_RTP_1,codecs:[],headerExtensions:[],media:e.kind,rtcpMux:s.mux,rtcpReducedSize:s.reducedSize,sourceGroups:[],sources:[],ssrc:a?o[0].ssrc.toString():void 0,streams:[]};for(const e of n.headerExtensions||[]){const n={id:e.id,uri:e.uri};e.direction&&"sendrecv"!==e.direction&&(n.senders=(0,i.directionToSenders)(t,e.direction)),c.headerExtensions.push(n)}s.ssrc&&s.cname&&(c.sources=[{parameters:{cname:s.cname},ssrc:s.ssrc.toString()}]),a&&o[0]&&o[0].rtx&&(c.sourceGroups=[{semantics:"FID",sources:[o[0].ssrc.toString(),o[0].rtx.ssrc.toString()]}]);for(const t of e.streams||[])c.streams.push({id:t.stream,track:t.track});for(const e of n.codecs||[]){const t={channels:e.channels,clockRate:e.clockRate,id:e.payloadType.toString(),name:e.name,parameters:e.parameters,rtcpFeedback:e.rtcpFeedback};e.maxptime&&(t.maxptime=e.maxptime),e.parameters&&e.parameters.ptime&&(t.ptime=parseInt(e.parameters.ptime,10)),c.codecs.push(t)}return c}function o(e){let t;return t="rtp"===e.component?1:"rtcp"===e.component?2:e.component,{component:t,foundation:e.foundation,generation:void 0,id:void 0,ip:e.ip,network:void 0,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function a(e){return{address:e.ip,component:1===e.component?"rtp":2===e.component?"rtcp":e.component,foundation:e.foundation,ip:e.ip,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function c(e,t){const n=e.iceParameters,i=e.dtlsParameters,r={candidates:[],transportType:t};n&&(r.usernameFragment=n.usernameFragment,r.password=n.password,n.iceLite&&(r.iceLite=!0)),i&&(r.fingerprints=i.fingerprints.map(t=>({algorithm:t.algorithm,setup:e.setup,value:t.value}))),e.sctp&&(r.sctp=e.sctp);for(const t of e.candidates||[])r.candidates.push(o(t));return r}function u(e,t){const n=e.application||{},s=e.transport,o=n&&n.applicationType===r.NS_JINGLE_RTP_1,c={direction:(0,i.sendersToDirection)(t,e.senders),kind:n.media||"application",mid:e.name,protocol:o?"UDP/TLS/RTP/SAVPF":"UDP/DTLS/SCTP"};if(o){if(c.rtcpParameters={compound:!n.rtcpReducedSize,mux:n.rtcpMux,reducedSize:n.rtcpReducedSize},n.sources&&n.sources.length){const e=n.sources[0];c.rtcpParameters.ssrc=parseInt(e.ssrc,10),e.parameters&&(c.rtcpParameters.cname=e.parameters.cname)}if(c.rtpParameters={codecs:[],fecMechanisms:[],headerExtensions:[],rtcp:[]},n.streams){c.streams=[];for(const e of n.streams)c.streams.push({stream:e.id,track:e.track})}if(n.ssrc&&(c.rtpEncodingParameters=[{ssrc:parseInt(n.ssrc,10)}],n.sourceGroups&&n.sourceGroups.length)){const e=n.sourceGroups[0];c.rtpEncodingParameters[0].rtx={ssrc:parseInt(e.sources[1],10)}}let e=!1,r=!1;for(const t of n.codecs||[]){const n=t.parameters||{},i=[];for(const e of t.rtcpFeedback||[])i.push({parameter:e.parameter,type:e.type});if("red"===t.name||"ulpfec"===t.name){e=e||"red"===t.name,r=r||"ulpfec"===t.name;const n=t.name.toUpperCase();c.rtpParameters.fecMechanisms.includes(n)||c.rtpParameters.fecMechanisms.push(n)}c.rtpParameters.codecs.push({channels:t.channels,clockRate:t.clockRate,name:t.name,numChannels:t.channels,parameters:n,payloadType:parseInt(t.id,10),rtcpFeedback:i})}for(const e of n.headerExtensions||[])c.rtpParameters.headerExtensions.push({direction:(0,i.sendersToDirection)(t,e.senders||"both"),id:e.id,uri:e.uri,attributes:void 0})}if(s){if(s.usernameFragment&&s.password&&(c.iceParameters={password:s.password,usernameFragment:s.usernameFragment},s.iceLite&&(c.iceParameters.iceLite=!0)),s.fingerprints&&s.fingerprints.length){c.dtlsParameters={fingerprints:[],role:"auto"};for(const e of s.fingerprints)c.dtlsParameters.fingerprints.push({algorithm:e.algorithm,value:e.value});s.sctp&&(c.sctp=s.sctp),c.setup=s.fingerprints[0].setup}c.candidates=(s.candidates||[]).map(a)}return c}t.convertIntermediateToApplication=s,t.convertIntermediateToCandidate=o,t.convertCandidateToIntermediate=a,t.convertIntermediateToTransport=c,t.convertIntermediateToRequest=function(e,t,n){return{contents:e.media.map(e=>({application:"audio"===e.kind||"video"===e.kind?s(e,t):{applicationType:"datachannel",protocol:e.protocol},creator:i.JingleSessionRole.Initiator,name:e.mid,senders:(0,i.directionToSenders)(t,e.direction),transport:c(e,n)})),groups:e.groups?e.groups.map(e=>({contents:e.mids,semantics:e.semantics})):[]}},t.convertContentToIntermediate=u,t.convertRequestToIntermediate=function(e,t){const n={groups:[],media:[]};for(const t of e.groups||[])n.groups.push({mids:t.contents,semantics:t.semantics});for(const i of e.contents||[])n.media.push(u(i,t));return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(43),r=n(5),s=n(10),o={condition:r.StanzaErrorCondition.BadRequest},a={condition:r.StanzaErrorCondition.FeatureNotImplemented,jingleError:r.JingleErrorCondition.UnsupportedInfo,type:"modify"};t.default=class{constructor(e){this.parent=e.parent,this.sid=e.sid||(0,s.uuid)(),this.peerID=e.peerID,this.role=e.initiator?r.JingleSessionRole.Initiator:r.JingleSessionRole.Responder,this._sessionState="starting",this._connectionState="starting",this.pendingApplicationTypes=e.applicationTypes||[],this.pendingAction=void 0,this.processingQueue=(0,i.priorityQueue)(async(e,t)=>{if("ended"===this.state)return"local"===e.type&&e.reject&&e.reject(new Error("Session ended")),void(t&&t());if("local"===e.type){this._log("debug","Processing local action:",e.name);try{const t=await e.handler();e.resolve(t)}catch(t){e.reject(t)}return void(t&&t())}const{action:n,changes:i,cb:s}=e;return this._log("debug","Processing remote action:",n),new Promise(e=>{const o=(n,i)=>{s(n,i),t&&t(),e()};switch(n){case r.JingleAction.ContentAccept:return this.onContentAccept(i,o);case r.JingleAction.ContentAdd:return this.onContentAdd(i,o);case r.JingleAction.ContentModify:return this.onContentModify(i,o);case r.JingleAction.ContentReject:return this.onContentReject(i,o);case r.JingleAction.ContentRemove:return this.onContentRemove(i,o);case r.JingleAction.DescriptionInfo:return this.onDescriptionInfo(i,o);case r.JingleAction.SecurityInfo:return this.onSecurityInfo(i,o);case r.JingleAction.SessionAccept:return this.onSessionAccept(i,o);case r.JingleAction.SessionInfo:return this.onSessionInfo(i,o);case r.JingleAction.SessionInitiate:return this.onSessionInitiate(i,o);case r.JingleAction.SessionTerminate:return this.onSessionTerminate(i,o);case r.JingleAction.TransportAccept:return this.onTransportAccept(i,o);case r.JingleAction.TransportInfo:return this.onTransportInfo(i,o);case r.JingleAction.TransportReject:return this.onTransportReject(i,o);case r.JingleAction.TransportReplace:return this.onTransportReplace(i,o);default:this._log("error","Invalid or unsupported action: "+n),o({condition:r.StanzaErrorCondition.BadRequest})}})},1)}get isInitiator(){return this.role===r.JingleSessionRole.Initiator}get peerRole(){return this.isInitiator?r.JingleSessionRole.Responder:r.JingleSessionRole.Initiator}get state(){return this._sessionState}set state(e){e!==this._sessionState&&(this._log("info","Changing session state to: "+e),this._sessionState=e,this.parent&&this.parent.emit("sessionState",this,e))}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this._log("info","Changing connection state to: "+e),this._connectionState=e,this.parent&&this.parent.emit("connectionState",this,e))}send(e,t){(t=t||{}).sid=this.sid,t.action=e;new Set([r.JingleAction.ContentAccept,r.JingleAction.ContentAdd,r.JingleAction.ContentModify,r.JingleAction.ContentReject,r.JingleAction.ContentRemove,r.JingleAction.SessionAccept,r.JingleAction.SessionInitiate,r.JingleAction.TransportAccept,r.JingleAction.TransportReject,r.JingleAction.TransportReplace]).has(e)?this.pendingAction=e:this.pendingAction=void 0,this.parent.signal(this,{id:(0,s.uuid)(),jingle:t,to:this.peerID,type:"set"})}processLocal(e,t){return new Promise((n,i)=>{this.processingQueue.push({handler:t,name:e,reject:i,resolve:n,type:"local"},1)})}process(e,t,n){this.processingQueue.push({action:e,cb:n,changes:t,type:"remote"},2)}start(e,t){this._log("error","Can not start base sessions"),this.end("unsupported-applications",!0)}accept(e,t){this._log("error","Can not accept base sessions"),this.end("unsupported-applications")}cancel(){this.end("cancel")}decline(){this.end("decline")}end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}_log(e,t,...n){this.parent&&(t=this.sid+": "+t,this.parent.emit("log",e,t,...n),this.parent.emit("log:"+e,t,...n))}onSessionInitiate(e,t){t()}onSessionAccept(e,t){t()}onSessionTerminate(e,t){this.end(e.reason,!0),t()}onSessionInfo(e,t){e.info?t(a):t()}onSecurityInfo(e,t){t(a)}onDescriptionInfo(e,t){t(a)}onTransportInfo(e,t){t(a)}onContentAdd(e,t){t(),this.send(r.JingleAction.ContentReject,{reason:{condition:r.JingleReasonCondition.FailedApplication,text:"content-add is not supported"}})}onContentAccept(e,t){t(o)}onContentReject(e,t){t(o)}onContentModify(e,t){t(o)}onContentRemove(e,t){t(o)}onTransportReplace(e,t){t(),this.send(r.JingleAction.TransportReject,{reason:{condition:r.JingleReasonCondition.FailedTransport,text:"transport-replace is not supported"}})}onTransportAccept(e,t){t(o)}onTransportReject(e,t){t(o)}}},function(e,t,n){"use strict";function i(e,...t){return(...n)=>e(...t,...n)}function r(e){return function(...t){var n=t.pop();return e.call(this,t,n)}}n.r(t),n.d(t,"all",(function(){return me})),n.d(t,"allLimit",(function(){return ge})),n.d(t,"allSeries",(function(){return ye})),n.d(t,"any",(function(){return tt})),n.d(t,"anyLimit",(function(){return nt})),n.d(t,"anySeries",(function(){return it})),n.d(t,"apply",(function(){return i})),n.d(t,"applyEach",(function(){return O})),n.d(t,"applyEachSeries",(function(){return j})),n.d(t,"asyncify",(function(){return d})),n.d(t,"auto",(function(){return D})),n.d(t,"autoInject",(function(){return J})),n.d(t,"cargo",(function(){return V})),n.d(t,"cargoQueue",(function(){return W})),n.d(t,"compose",(function(){return K})),n.d(t,"concat",(function(){return Z})),n.d(t,"concatLimit",(function(){return Y})),n.d(t,"concatSeries",(function(){return ee})),n.d(t,"constant",(function(){return te})),n.d(t,"default",(function(){return mt})),n.d(t,"detect",(function(){return ie})),n.d(t,"detectLimit",(function(){return re})),n.d(t,"detectSeries",(function(){return se})),n.d(t,"dir",(function(){return ae})),n.d(t,"doDuring",(function(){return ce})),n.d(t,"doUntil",(function(){return ue})),n.d(t,"doWhilst",(function(){return ce})),n.d(t,"during",(function(){return pt})),n.d(t,"each",(function(){return de})),n.d(t,"eachLimit",(function(){return pe})),n.d(t,"eachOf",(function(){return R})),n.d(t,"eachOfLimit",(function(){return A})),n.d(t,"eachOfSeries",(function(){return k})),n.d(t,"eachSeries",(function(){return he})),n.d(t,"ensureAsync",(function(){return fe})),n.d(t,"every",(function(){return me})),n.d(t,"everyLimit",(function(){return ge})),n.d(t,"everySeries",(function(){return ye})),n.d(t,"filter",(function(){return Se})),n.d(t,"filterLimit",(function(){return we})),n.d(t,"filterSeries",(function(){return Te})),n.d(t,"find",(function(){return ie})),n.d(t,"findLimit",(function(){return re})),n.d(t,"findSeries",(function(){return se})),n.d(t,"flatMap",(function(){return Z})),n.d(t,"flatMapLimit",(function(){return Y})),n.d(t,"flatMapSeries",(function(){return ee})),n.d(t,"foldl",(function(){return $})),n.d(t,"foldr",(function(){return ze})),n.d(t,"forEach",(function(){return de})),n.d(t,"forEachLimit",(function(){return pe})),n.d(t,"forEachOf",(function(){return R})),n.d(t,"forEachOfLimit",(function(){return A})),n.d(t,"forEachOfSeries",(function(){return k})),n.d(t,"forEachSeries",(function(){return he})),n.d(t,"forever",(function(){return Ie})),n.d(t,"groupBy",(function(){return Ae})),n.d(t,"groupByLimit",(function(){return Ne})),n.d(t,"groupBySeries",(function(){return Ee})),n.d(t,"inject",(function(){return $})),n.d(t,"log",(function(){return xe})),n.d(t,"map",(function(){return C})),n.d(t,"mapLimit",(function(){return X})),n.d(t,"mapSeries",(function(){return P})),n.d(t,"mapValues",(function(){return Ce})),n.d(t,"mapValuesLimit",(function(){return Re})),n.d(t,"mapValuesSeries",(function(){return Oe})),n.d(t,"memoize",(function(){return ke})),n.d(t,"nextTick",(function(){return Pe})),n.d(t,"parallel",(function(){return Le})),n.d(t,"parallelLimit",(function(){return Me})),n.d(t,"priorityQueue",(function(){return Ue})),n.d(t,"queue",(function(){return De})),n.d(t,"race",(function(){return Je})),n.d(t,"reduce",(function(){return $})),n.d(t,"reduceRight",(function(){return ze})),n.d(t,"reflect",(function(){return Ge})),n.d(t,"reflectAll",(function(){return He})),n.d(t,"reject",(function(){return We})),n.d(t,"rejectLimit",(function(){return $e})),n.d(t,"rejectSeries",(function(){return Qe})),n.d(t,"retry",(function(){return Xe})),n.d(t,"retryable",(function(){return Ze})),n.d(t,"select",(function(){return Se})),n.d(t,"selectLimit",(function(){return we})),n.d(t,"selectSeries",(function(){return Te})),n.d(t,"seq",(function(){return Q})),n.d(t,"series",(function(){return et})),n.d(t,"setImmediate",(function(){return l})),n.d(t,"some",(function(){return tt})),n.d(t,"someLimit",(function(){return nt})),n.d(t,"someSeries",(function(){return it})),n.d(t,"sortBy",(function(){return rt})),n.d(t,"timeout",(function(){return st})),n.d(t,"times",(function(){return at})),n.d(t,"timesLimit",(function(){return ot})),n.d(t,"timesSeries",(function(){return ct})),n.d(t,"transform",(function(){return ut})),n.d(t,"tryEach",(function(){return lt})),n.d(t,"unmemoize",(function(){return dt})),n.d(t,"until",(function(){return ht})),n.d(t,"waterfall",(function(){return ft})),n.d(t,"whilst",(function(){return pt})),n.d(t,"wrapSync",(function(){return d}));var s="function"==typeof queueMicrotask&&queueMicrotask,o="function"==typeof setImmediate&&setImmediate,a="object"==typeof process&&"function"==typeof process.nextTick;function c(e){setTimeout(e,0)}function u(e){return(t,...n)=>e(()=>t(...n))}var l=u(s?queueMicrotask:o?setImmediate:a?process.nextTick:c);function d(e){return f(e)?function(...t){const n=t.pop();return p(e.apply(this,t),n)}:r((function(t,n){var i;try{i=e.apply(this,t)}catch(e){return n(e)}if(i&&"function"==typeof i.then)return p(i,n);n(null,i)}))}function p(e,t){return e.then(e=>{h(t,null,e)},e=>{h(t,e&&(e instanceof Error||e.message)?e:new Error(e))})}function h(e,t,n){try{e(t,n)}catch(e){l(e=>{throw e},e)}}function f(e){return"AsyncFunction"===e[Symbol.toStringTag]}function m(e){if("function"!=typeof e)throw new Error("expected a function");return f(e)?d(e):e}function g(e,t){if(t||(t=e.length),!t)throw new Error("arity is undefined");return function(...n){return"function"==typeof n[t-1]?e.apply(this,n):new Promise((i,r)=>{n[t-1]=(e,...t)=>{if(e)return r(e);i(t.length>1?t:t[0])},e.apply(this,n)})}}function y(e){return function(t,...n){return g((function(i){var r=this;return e(t,(e,t)=>{m(e).apply(r,n.concat(t))},i)}))}}function b(e,t,n,i){t=t||[];var r=[],s=0,o=m(n);return e(t,(e,t,n)=>{var i=s++;o(e,(e,t)=>{r[i]=t,n(e)})},e=>{i(e,r)})}function _(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}var v={};function S(e){function t(...t){if(null!==e){var n=e;e=null,n.apply(this,t)}}return Object.assign(t,e),t}function w(e){if(_(e))return function(e){var t=-1,n=e.length;return function(){return++t<n?{value:e[t],key:t}:null}}(e);var t,n,i,r,s=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return s?function(e){var t=-1;return function(){var n=e.next();return n.done?null:(t++,{value:n.value,key:t})}}(s):(n=(t=e)?Object.keys(t):[],i=-1,r=n.length,function e(){var s=n[++i];return"__proto__"===s?e():i<r?{value:t[s],key:s}:null})}function T(e){return function(...t){if(null===e)throw new Error("Callback was already called.");var n=e;e=null,n.apply(this,t)}}function I(e,t,n,i){let r=!1,s=!1,o=!1,a=0,c=0;function u(){a>=t||o||r||(o=!0,e.next().then(({value:e,done:t})=>{if(!s&&!r){if(o=!1,t)return r=!0,void(a<=0&&i(null));a++,n(e,c,l),c++,u()}}).catch(d))}function l(e,t){if(a-=1,!s)return e?d(e):!1===e?(r=!0,void(s=!0)):t===v||r&&a<=0?(r=!0,i(null)):void u()}function d(e){s||(o=!1,r=!0,i(e))}u()}var N=e=>(t,n,i)=>{if(i=S(i),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return i(null);if("AsyncGenerator"===t[Symbol.toStringTag])return I(t,e,n,i);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(t))return I(t[Symbol.asyncIterator](),e,n,i);var r=w(t),s=!1,o=!1,a=0,c=!1;function u(e,t){if(!o)if(a-=1,e)s=!0,i(e);else if(!1===e)s=!0,o=!0;else{if(t===v||s&&a<=0)return s=!0,i(null);c||l()}}function l(){for(c=!0;a<e&&!s;){var t=r();if(null===t)return s=!0,void(a<=0&&i(null));a+=1,n(t.value,t.key,T(u))}c=!1}l()};var A=g((function(e,t,n,i){return N(t)(e,m(n),i)}),4);function E(e,t,n){n=S(n);var i=0,r=0,{length:s}=e,o=!1;function a(e,t){!1===e&&(o=!0),!0!==o&&(e?n(e):++r!==s&&t!==v||n(null))}for(0===s&&n(null);i<s;i++)t(e[i],i,T(a))}function x(e,t,n){return A(e,1/0,t,n)}var R=g((function(e,t,n){return(_(e)?E:x)(e,m(t),n)}),3);var C=g((function(e,t,n){return b(R,e,t,n)}),3),O=y(C);var k=g((function(e,t,n){return A(e,1,t,n)}),3);var P=g((function(e,t,n){return b(k,e,t,n)}),3),j=y(P);const L=Symbol("promiseCallback");function M(){let e,t;function n(n,...i){if(n)return t(n);e(i.length>1?i:i[0])}return n[L]=new Promise((n,i)=>{e=n,t=i}),n}function D(e,t,n){"number"!=typeof t&&(n=t,t=null),n=S(n||M());var i=Object.keys(e).length;if(!i)return n(null);t||(t=i);var r={},s=0,o=!1,a=!1,c=Object.create(null),u=[],l=[],d={};function p(e,t){u.push(()=>function(e,t){if(a)return;var i=T((t,...i)=>{if(s--,!1!==t)if(i.length<2&&([i]=i),t){var u={};if(Object.keys(r).forEach(e=>{u[e]=r[e]}),u[e]=i,a=!0,c=Object.create(null),o)return;n(t,u)}else r[e]=i,(c[e]||[]).forEach(e=>e()),h();else o=!0});s++;var u=m(t[t.length-1]);t.length>1?u(r,i):u(i)}(e,t))}function h(){if(!o){if(0===u.length&&0===s)return n(null,r);for(;u.length&&s<t;){u.shift()()}}}function f(t){var n=[];return Object.keys(e).forEach(i=>{const r=e[i];Array.isArray(r)&&r.indexOf(t)>=0&&n.push(i)}),n}return Object.keys(e).forEach(t=>{var n=e[t];if(!Array.isArray(n))return p(t,[n]),void l.push(t);var i=n.slice(0,n.length-1),r=i.length;if(0===r)return p(t,n),void l.push(t);d[t]=r,i.forEach(s=>{if(!e[s])throw new Error("async.auto task `"+t+"` has a non-existent dependency `"+s+"` in "+i.join(", "));!function(e,t){var n=c[e];n||(n=c[e]=[]);n.push(t)}(s,()=>{0===--r&&p(t,n)})})}),function(){var e,t=0;for(;l.length;)e=l.pop(),t++,f(e).forEach(e=>{0==--d[e]&&l.push(e)});if(t!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),h(),n[L]}var B=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,F=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,q=/,/,U=/(=.+)?(\s*)$/;function J(e,t){var n={};return Object.keys(e).forEach(t=>{var i,r=e[t],s=f(r),o=!s&&1===r.length||s&&0===r.length;if(Array.isArray(r))i=[...r],r=i.pop(),n[t]=i.concat(i.length>0?a:r);else if(o)n[t]=r;else{if(i=function(e){const t=function(e){let t="",n=0,i=e.indexOf("*/");for(;n<e.length;)if("/"===e[n]&&"/"===e[n+1]){let t=e.indexOf("\n",n);n=-1===t?e.length:t}else if(-1!==i&&"/"===e[n]&&"*"===e[n+1]){let r=e.indexOf("*/",n);-1!==r?(n=r+2,i=e.indexOf("*/",n)):(t+=e[n],n++)}else t+=e[n],n++;return t}(e.toString());let n=t.match(B);if(n||(n=t.match(F)),!n)throw new Error("could not parse args in autoInject\nSource:\n"+t);let[,i]=n;return i.replace(/\s/g,"").split(q).map(e=>e.replace(U,"").trim())}(r),0===r.length&&!s&&0===i.length)throw new Error("autoInject task functions require explicit parameters.");s||i.pop(),n[t]=i.concat(a)}function a(e,t){var n=i.map(t=>e[t]);n.push(t),m(r)(...n)}}),D(n,t)}class z{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1}insertBefore(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):G(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):G(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var t=this.head;t;){var{next:n}=t;e(t)&&this.removeLink(t),t=n}return this}}function G(e,t){e.length=1,e.head=e.tail=t}function H(e,t,n){if(null==t)t=1;else if(0===t)throw new RangeError("Concurrency must not be zero");var i=m(e),r=0,s=[];const o={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function a(e,t){return e?t?void(o[e]=o[e].filter(e=>e!==t)):o[e]=[]:Object.keys(o).forEach(e=>o[e]=[])}function c(e,...t){o[e].forEach(e=>e(...t))}var u=!1;function d(e,t,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");var r,s;function o(e,...t){return e?n?s(e):r():t.length<=1?r(t[0]):void r(t)}y.started=!0;var a=y._createTaskItem(e,n?o:i||o);if(t?y._tasks.unshift(a):y._tasks.push(a),u||(u=!0,l(()=>{u=!1,y.process()})),n||!i)return new Promise((e,t)=>{r=e,s=t})}function p(e){return function(t,...n){r-=1;for(var i=0,o=e.length;i<o;i++){var a=e[i],u=s.indexOf(a);0===u?s.shift():u>0&&s.splice(u,1),a.callback(t,...n),null!=t&&c("error",t,a.data)}r<=y.concurrency-y.buffer&&c("unsaturated"),y.idle()&&c("drain"),y.process()}}function h(e){return!(0!==e.length||!y.idle())&&(l(()=>c("drain")),!0)}const f=e=>t=>{if(!t)return new Promise((t,n)=>{!function(e,t){const n=(...i)=>{a(e,n),t(...i)};o[e].push(n)}(e,(e,i)=>{if(e)return n(e);t(i)})});a(e),function(e,t){o[e].push(t)}(e,t)};var g=!1,y={_tasks:new z,_createTaskItem:(e,t)=>({data:e,callback:t}),*[Symbol.iterator](){yield*y._tasks[Symbol.iterator]()},concurrency:t,payload:n,buffer:t/4,started:!1,paused:!1,push(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!1,!1,t))}return d(e,!1,!1,t)},pushAsync(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!1,!0,t))}return d(e,!1,!0,t)},kill(){a(),y._tasks.empty()},unshift(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!0,!1,t))}return d(e,!0,!1,t)},unshiftAsync(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!0,!0,t))}return d(e,!0,!0,t)},remove(e){y._tasks.remove(e)},process(){if(!g){for(g=!0;!y.paused&&r<y.concurrency&&y._tasks.length;){var e=[],t=[],n=y._tasks.length;y.payload&&(n=Math.min(n,y.payload));for(var o=0;o<n;o++){var a=y._tasks.shift();e.push(a),s.push(a),t.push(a.data)}r+=1,0===y._tasks.length&&c("empty"),r===y.concurrency&&c("saturated");var u=T(p(e));i(t,u)}g=!1}},length:()=>y._tasks.length,running:()=>r,workersList:()=>s,idle:()=>y._tasks.length+r===0,pause(){y.paused=!0},resume(){!1!==y.paused&&(y.paused=!1,l(y.process))}};return Object.defineProperties(y,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),y}function V(e,t){return H(e,1,t)}function W(e,t,n){return H(e,t,n)}var $=g((function(e,t,n,i){i=S(i);var r=m(n);return k(e,(e,n,i)=>{r(t,e,(e,n)=>{t=n,i(e)})},e=>i(e,t))}),4);function Q(...e){var t=e.map(m);return function(...e){var n=this,i=e[e.length-1];return"function"==typeof i?e.pop():i=M(),$(t,e,(e,t,i)=>{t.apply(n,e.concat((e,...t)=>{i(e,t)}))},(e,t)=>i(e,...t)),i[L]}}function K(...e){return Q(...e.reverse())}var X=g((function(e,t,n,i){return b(N(t),e,n,i)}),4);var Y=g((function(e,t,n,i){var r=m(n);return X(e,t,(e,t)=>{r(e,(e,...n)=>e?t(e):t(e,n))},(e,t)=>{for(var n=[],r=0;r<t.length;r++)t[r]&&(n=n.concat(...t[r]));return i(e,n)})}),4);var Z=g((function(e,t,n){return Y(e,1/0,t,n)}),3);var ee=g((function(e,t,n){return Y(e,1,t,n)}),3);function te(...e){return function(...t){return t.pop()(null,...e)}}function ne(e,t){return(n,i,r,s)=>{var o,a=!1;const c=m(r);n(i,(n,i,r)=>{c(n,(i,s)=>i||!1===i?r(i):e(s)&&!o?(a=!0,o=t(!0,n),r(null,v)):void r())},e=>{if(e)return s(e);s(null,a?o:t(!1))})}}var ie=g((function(e,t,n){return ne(e=>e,(e,t)=>t)(R,e,t,n)}),3);var re=g((function(e,t,n,i){return ne(e=>e,(e,t)=>t)(N(t),e,n,i)}),4);var se=g((function(e,t,n){return ne(e=>e,(e,t)=>t)(N(1),e,t,n)}),3);function oe(e){return(t,...n)=>m(t)(...n,(t,...n)=>{"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&n.forEach(t=>console[e](t)))})}var ae=oe("dir");var ce=g((function(e,t,n){n=T(n);var i,r=m(e),s=m(t);function o(e,...t){if(e)return n(e);!1!==e&&(i=t,s(...t,a))}function a(e,t){return e?n(e):!1!==e?t?void r(o):n(null,...i):void 0}return a(null,!0)}),3);function ue(e,t,n){const i=m(t);return ce(e,(...e)=>{const t=e.pop();i(...e,(e,n)=>t(e,!n))},n)}function le(e){return(t,n,i)=>e(t,i)}var de=g((function(e,t,n){return R(e,le(m(t)),n)}),3);var pe=g((function(e,t,n,i){return N(t)(e,le(m(n)),i)}),4);var he=g((function(e,t,n){return pe(e,1,t,n)}),3);function fe(e){return f(e)?e:function(...t){var n=t.pop(),i=!0;t.push((...e)=>{i?l(()=>n(...e)):n(...e)}),e.apply(this,t),i=!1}}var me=g((function(e,t,n){return ne(e=>!e,e=>!e)(R,e,t,n)}),3);var ge=g((function(e,t,n,i){return ne(e=>!e,e=>!e)(N(t),e,n,i)}),4);var ye=g((function(e,t,n){return ne(e=>!e,e=>!e)(k,e,t,n)}),3);function be(e,t,n,i){var r=new Array(t.length);e(t,(e,t,i)=>{n(e,(e,n)=>{r[t]=!!n,i(e)})},e=>{if(e)return i(e);for(var n=[],s=0;s<t.length;s++)r[s]&&n.push(t[s]);i(null,n)})}function _e(e,t,n,i){var r=[];e(t,(e,t,i)=>{n(e,(n,s)=>{if(n)return i(n);s&&r.push({index:t,value:e}),i(n)})},e=>{if(e)return i(e);i(null,r.sort((e,t)=>e.index-t.index).map(e=>e.value))})}function ve(e,t,n,i){return(_(t)?be:_e)(e,t,m(n),i)}var Se=g((function(e,t,n){return ve(R,e,t,n)}),3);var we=g((function(e,t,n,i){return ve(N(t),e,n,i)}),4);var Te=g((function(e,t,n){return ve(k,e,t,n)}),3);var Ie=g((function(e,t){var n=T(t),i=m(fe(e));return function e(t){if(t)return n(t);!1!==t&&i(e)}()}),2);var Ne=g((function(e,t,n,i){var r=m(n);return X(e,t,(e,t)=>{r(e,(n,i)=>n?t(n):t(n,{key:i,val:e}))},(e,t)=>{for(var n={},{hasOwnProperty:r}=Object.prototype,s=0;s<t.length;s++)if(t[s]){var{key:o}=t[s],{val:a}=t[s];r.call(n,o)?n[o].push(a):n[o]=[a]}return i(e,n)})}),4);function Ae(e,t,n){return Ne(e,1/0,t,n)}function Ee(e,t,n){return Ne(e,1,t,n)}var xe=oe("log");var Re=g((function(e,t,n,i){i=S(i);var r={},s=m(n);return N(t)(e,(e,t,n)=>{s(e,t,(e,i)=>{if(e)return n(e);r[t]=i,n(e)})},e=>i(e,r))}),4);function Ce(e,t,n){return Re(e,1/0,t,n)}function Oe(e,t,n){return Re(e,1,t,n)}function ke(e,t=(e=>e)){var n=Object.create(null),i=Object.create(null),s=m(e),o=r((e,r)=>{var o=t(...e);o in n?l(()=>r(null,...n[o])):o in i?i[o].push(r):(i[o]=[r],s(...e,(e,...t)=>{e||(n[o]=t);var r=i[o];delete i[o];for(var s=0,a=r.length;s<a;s++)r[s](e,...t)}))});return o.memo=n,o.unmemoized=e,o}var Pe=u(a?process.nextTick:o?setImmediate:c),je=g((e,t,n)=>{var i=_(t)?[]:{};e(t,(e,t,n)=>{m(e)((e,...r)=>{r.length<2&&([r]=r),i[t]=r,n(e)})},e=>n(e,i))},3);function Le(e,t){return je(R,e,t)}function Me(e,t,n){return je(N(t),e,n)}function De(e,t){var n=m(e);return H((e,t)=>{n(e[0],t)},t,1)}class Be{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let t;for(;e>0&&qe(this.heap[e],this.heap[t=Fe(e)]);){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,e=t}}percDown(e){let t;for(;(t=1+(e<<1))<this.heap.length&&(t+1<this.heap.length&&qe(this.heap[t+1],this.heap[t])&&(t+=1),!qe(this.heap[e],this.heap[t]));){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,e=t}}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let t=0;for(let n=0;n<this.heap.length;n++)e(this.heap[n])||(this.heap[t]=this.heap[n],t++);this.heap.splice(t);for(let e=Fe(this.heap.length-1);e>=0;e--)this.percDown(e);return this}}function Fe(e){return(e+1>>1)-1}function qe(e,t){return e.priority!==t.priority?e.priority<t.priority:e.pushCount<t.pushCount}function Ue(e,t){var n=De(e,t),{push:i,pushAsync:r}=n;function s(e,t){return Array.isArray(e)?e.map(e=>({data:e,priority:t})):{data:e,priority:t}}return n._tasks=new Be,n._createTaskItem=({data:e,priority:t},n)=>({data:e,priority:t,callback:n}),n.push=function(e,t=0,n){return i(s(e,t),n)},n.pushAsync=function(e,t=0,n){return r(s(e,t),n)},delete n.unshift,delete n.unshiftAsync,n}var Je=g((function(e,t){if(t=S(t),!Array.isArray(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var n=0,i=e.length;n<i;n++)m(e[n])(t)}),2);function ze(e,t,n,i){var r=[...e].reverse();return $(r,t,n,i)}function Ge(e){var t=m(e);return r((function(e,n){return e.push((e,...t)=>{let i={};if(e&&(i.error=e),t.length>0){var r=t;t.length<=1&&([r]=t),i.value=r}n(null,i)}),t.apply(this,e)}))}function He(e){var t;return Array.isArray(e)?t=e.map(Ge):(t={},Object.keys(e).forEach(n=>{t[n]=Ge.call(this,e[n])})),t}function Ve(e,t,n,i){const r=m(n);return ve(e,t,(e,t)=>{r(e,(e,n)=>{t(e,!n)})},i)}var We=g((function(e,t,n){return Ve(R,e,t,n)}),3);var $e=g((function(e,t,n,i){return Ve(N(t),e,n,i)}),4);var Qe=g((function(e,t,n){return Ve(k,e,t,n)}),3);function Ke(e){return function(){return e}}function Xe(e,t,n){var i={times:5,intervalFunc:Ke(0)};if(arguments.length<3&&"function"==typeof e?(n=t||M(),t=e):(Ye(i,e),n=n||M()),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var r=m(t),s=1;function o(){r((e,...t)=>{!1!==e&&(e&&s++<i.times&&("function"!=typeof i.errorFilter||i.errorFilter(e))?setTimeout(o,i.intervalFunc(s-1)):n(e,...t))})}return o(),n[L]}function Ye(e,t){if("object"==typeof t)e.times=+t.times||5,e.intervalFunc="function"==typeof t.interval?t.interval:Ke(+t.interval||0),e.errorFilter=t.errorFilter;else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");e.times=+t||5}}function Ze(e,t){t||(t=e,e=null);let n=e&&e.arity||t.length;f(t)&&(n+=1);var i=m(t);return r((t,r)=>{function s(e){i(...t,e)}return(t.length<n-1||null==r)&&(t.push(r),r=M()),e?Xe(e,s,r):Xe(s,r),r[L]})}function et(e,t){return je(k,e,t)}var tt=g((function(e,t,n){return ne(Boolean,e=>e)(R,e,t,n)}),3);var nt=g((function(e,t,n,i){return ne(Boolean,e=>e)(N(t),e,n,i)}),4);var it=g((function(e,t,n){return ne(Boolean,e=>e)(k,e,t,n)}),3);var rt=g((function(e,t,n){var i=m(t);return C(e,(e,t)=>{i(e,(n,i)=>{if(n)return t(n);t(n,{value:e,criteria:i})})},(e,t)=>{if(e)return n(e);n(null,t.sort(r).map(e=>e.value))});function r(e,t){var n=e.criteria,i=t.criteria;return n<i?-1:n>i?1:0}}),3);function st(e,t,n){var i=m(e);return r((r,s)=>{var o,a=!1;r.push((...e)=>{a||(s(...e),clearTimeout(o))}),o=setTimeout((function(){var t=e.name||"anonymous",i=new Error('Callback function "'+t+'" timed out.');i.code="ETIMEDOUT",n&&(i.info=n),a=!0,s(i)}),t),i(...r)})}function ot(e,t,n,i){var r=m(n);return X(function(e){for(var t=Array(e);e--;)t[e]=e;return t}(e),t,r,i)}function at(e,t,n){return ot(e,1/0,t,n)}function ct(e,t,n){return ot(e,1,t,n)}function ut(e,t,n,i){arguments.length<=3&&"function"==typeof t&&(i=n,n=t,t=Array.isArray(e)?[]:{}),i=S(i||M());var r=m(n);return R(e,(e,n,i)=>{r(t,e,n,i)},e=>i(e,t)),i[L]}var lt=g((function(e,t){var n,i=null;return he(e,(e,t)=>{m(e)((e,...r)=>{if(!1===e)return t(e);r.length<2?[n]=r:n=r,i=e,t(e?null:{})})},()=>t(i,n))}));function dt(e){return(...t)=>(e.unmemoized||e)(...t)}var pt=g((function(e,t,n){n=T(n);var i=m(t),r=m(e),s=[];function o(e,...t){if(e)return n(e);s=t,!1!==e&&r(a)}function a(e,t){return e?n(e):!1!==e?t?void i(o):n(null,...s):void 0}return r(a)}),3);function ht(e,t,n){const i=m(e);return pt(e=>i((t,n)=>e(t,!n)),t,n)}var ft=g((function(e,t){if(t=S(t),!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var n=0;function i(t){m(e[n++])(...t,T(r))}function r(r,...s){if(!1!==r)return r||n===e.length?t(r,...s):void i(s)}i([])})),mt={apply:i,applyEach:O,applyEachSeries:j,asyncify:d,auto:D,autoInject:J,cargo:V,cargoQueue:W,compose:K,concat:Z,concatLimit:Y,concatSeries:ee,constant:te,detect:ie,detectLimit:re,detectSeries:se,dir:ae,doUntil:ue,doWhilst:ce,each:de,eachLimit:pe,eachOf:R,eachOfLimit:A,eachOfSeries:k,eachSeries:he,ensureAsync:fe,every:me,everyLimit:ge,everySeries:ye,filter:Se,filterLimit:we,filterSeries:Te,forever:Ie,groupBy:Ae,groupByLimit:Ne,groupBySeries:Ee,log:xe,map:C,mapLimit:X,mapSeries:P,mapValues:Ce,mapValuesLimit:Re,mapValuesSeries:Oe,memoize:ke,nextTick:Pe,parallel:Le,parallelLimit:Me,priorityQueue:Ue,queue:De,race:Je,reduce:$,reduceRight:ze,reflect:Ge,reflectAll:He,reject:We,rejectLimit:$e,rejectSeries:Qe,retry:Xe,retryable:Ze,seq:Q,series:et,setImmediate:l,some:tt,someLimit:nt,someSeries:it,sortBy:rt,timeout:st,times:at,timesLimit:ot,timesSeries:ct,transform:ut,tryEach:lt,unmemoize:dt,until:ht,waterfall:ft,whilst:pt,all:me,allLimit:ge,allSeries:ye,any:tt,anyLimit:nt,anySeries:it,find:ie,findLimit:re,findSeries:se,flatMap:Z,flatMapLimit:Y,flatMapSeries:ee,forEach:de,forEachSeries:he,forEachLimit:pe,forEachOf:R,forEachOfSeries:k,forEachOfLimit:A,inject:$,foldl:$,foldr:ze,select:Se,selectLimit:we,selectSeries:Te,wrapSync:d,during:pt,doDuring:ce}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GenesysCloudMediaSession=void 0;const i=n(16).__importDefault(n(65)),r=n(6),s=n(18),o=n(11),a=n(21);t.GenesysCloudMediaSession=class{constructor(e,t){this.webrtcExtension=e,this.iceCandidatesDiscovered=0,this.iceCandidatesReceivedFromPeer=0,this.state="pending",this.connectionState="starting",this.id=t.id,this.fromJid=t.fromJid,this.peerID=t.peerID,this.logger=t.logger,this.conversationId=t.conversationId,this.fromUserId=t.fromUserId,this.pc=this.peerConnection=new RTCPeerConnection({iceServers:t.iceServers,iceTransportPolicy:t.iceTransportPolicy}),this.originalRoomJid=t.originalRoomJid,this.sessionType=a.SessionTypes[t.sessionType],this.ignoreHostCandidatesFromRemote=!!t.ignoreHostCandidatesFromRemote,this.allowIPv6=!!t.allowIPv6,this.allowTCP=!!t.allowTCP,this.reinvite=!!t.reinvite;const n=new r.EventEmitter;Object.keys(n.__proto__).forEach(e=>{this[e]=n[e]}),t.optOutOfWebrtcStatsTelemetry||this.setupStatsGatherer(),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate.bind(this)),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceStateChange.bind(this)),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this))}async setRemoteDescription(e){return this.peerConnection.setRemoteDescription({sdp:e,type:"offer"})}getLogDetails(){return{conversationId:this.conversationId,sessionId:this.id,sessionType:this.sessionType}}log(e,t,n,i){n||(n={});const r={...n,...this.getLogDetails()};this.logger[e](t,r,i)}async sendGenesysWebrtc(e){e.id=e.id||s.v4(),e.jsonrpc=e.jsonrpc||"2.0";const t={type:"set",genesysWebrtc:e,from:this.webrtcExtension.jid,to:this.peerID};return this.webrtcExtension.sendIq(t)}async end(e="success",t=!1){this.state="ended";const n={sessionId:this.id,reason:e.condition||e};t||await o.timeoutPromise((e,t)=>this.sendGenesysWebrtc({jsonrpc:"2.0",method:"terminate",params:n}).then(e,t),2e3,"Timeout waiting for response to termination request",{sessionId:this.id,conversationId:this.conversationId,sessionType:this.sessionType}).catch(e=>this.logger.error(e)),this.onSessionTerminate(n.reason)}setupStatsGatherer(){this.statsGatherer=new i.default(this.peerConnection),this.statsGatherer.on("stats",this.emit.bind(this,"stats"))}async onIceStateChange(){const e=this.peerConnection.iceConnectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this.log("info","ICE state changed: ",{iceState:e,sessionId:t,conversationId:n}),"disconnected"===e)"stable"===this.peerConnection.signalingState&&(this.interruptionStart=new Date,this.log("info","Connection state is interrupted",{sessionId:t,conversationId:n,sessionType:i}));else if("connected"===e){this.log("info","sending session-info: active");const e={sessionId:this.id,status:"active"};await this.sendGenesysWebrtc({jsonrpc:"2.0",params:e,method:"info"}),this._setupDataChannel()}else"failed"===e&&this.log("info","ICE connection failed",{candidatesDiscovered:this.iceCandidatesDiscovered,candidatesReceivedFromPeer:this.iceCandidatesReceivedFromPeer})}onConnectionStateChange(){const e=this.connectionState=this.peerConnection.connectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this.log("info","Connection state changed: ",{connectionState:e,sessionId:t,conversationId:n,sessionType:i}),this.interruptionStart)if("connected"===e){const e=(new Date).getTime()-this.interruptionStart.getTime();this.log("info","Connection was interrupted but was successfully recovered/connected",{sessionId:t,conversationId:n,sessionType:i,timeToRecover:e}),this.interruptionStart=void 0}else"failed"===e&&this.log("info","Connection was interrupted and failed to recover",{sessionId:t,conversationId:n,sessionType:i})}onIceCandidateError(e){const t=e;this.log("error","IceCandidateError",{errorCode:t.errorCode,errorText:t.errorText,url:t.url})}createIceCandidate(e,t){return new RTCIceCandidate({sdpMid:e,candidate:t})}async addRemoteIceCandidate(e){const t=e.match(/m=([^\s]+)/)[1],n=e.match(/a=([^\\\r]+)/)[1],i=this.createIceCandidate(t,n);await this.peerConnection.addIceCandidate(i)}onIceCandidate(e){var t,n;let i,r=null===(t=e.candidate)||void 0===t?void 0:t.candidate,s=null===(n=e.candidate)||void 0===n?void 0:n.sdpMid;if(e.candidate){if(!this.allowTCP&&"tcp"===e.candidate.protocol)return;if(!this.allowIPv6){const t=/.+udp [^ ]+ ([^ ]+).*typ host/.exec(e.candidate.candidate),n=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;if(t&&!t[1].match(n))return void this.log("debug","Filtering out IPv6 candidate",e.candidate.candidate)}this.log("debug","Processing ice candidate",e.candidate),this.log("info","Discovered ice candidate to send to peer",{type:e.candidate.type}),this.iceCandidatesDiscovered++,i=`m=${s} 9 RTP/AVP 0\r\na=${r}`}else i="a=end-of-candidates",this.emit("endOfCandidates");return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"iceCandidate",params:{sessionId:this.id,sdp:i}})}onSessionTerminate(e){this.peerConnection&&this.peerConnection.close(),this.emit("terminated",{condition:e||"success"})}async addTrack(e,t){const n=this.peerConnection.getTransceivers().find(t=>{var n;return!t.sender.track&&(null===(n=t.receiver.track)||void 0===n?void 0:n.kind)===e.kind});if(n)return n.sender.replaceTrack(e);this.peerConnection.addTrack(e,t)}_setupDataChannel(){var e;this.dataChannel||(null===(e=this.peerConnection.remoteDescription)||void 0===e?void 0:e.sdp.includes("webrtc-datachannel"))&&(this.log("info","creating data channel"),this.dataChannel=this.peerConnection.createDataChannel("videoConferenceControl"),this.dataChannel.addEventListener("open",()=>{this.log("info","data channel opened")}),this.dataChannel.addEventListener("message",this._handleDataChannelMessage.bind(this)),this.dataChannel.addEventListener("close",()=>{this.log("info","closing data channel")}),this.dataChannel.addEventListener("error",e=>{this.log("error","Error occurred with the data channel",e)}))}_handleDataChannelMessage(e){try{const t=JSON.parse(e.data);this.emit("dataChannelMessage",t)}catch(e){this.log("error","Failed to parse data channel message",{error:e})}}async accept(){this.state="active";const e=await this.peerConnection.createAnswer();await this.peerConnection.setLocalDescription(e);const t={sdp:e.sdp,sessionId:this.id};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"answer",params:t})}async mute(e,t){const n={sessionId:this.id,type:t};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"mute",params:n})}async unmute(e,t){const n={sessionId:this.id,type:t};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"unmute",params:n})}async removeTrack(){throw new Error("Not Implemented")}async hold(){throw new Error("Not Implemented")}async resume(){throw new Error("Not Implemented")}toString(){return{connectionState:this.connectionState,state:this.state,sessionType:this.sessionType,fromJid:this.fromJid,conversationId:this.conversationId,id:this.id,peerConnection:this.peerConnection}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.core=void 0;const i=n(3);(0,i.__exportStar)(n(69),t),(0,i.__exportStar)(n(70),t),(0,i.__exportStar)(n(71),t),(0,i.__exportStar)(n(72),t),(0,i.__exportStar)(n(73),t),(0,i.__exportStar)(n(74),t),(0,i.__exportStar)(n(75),t),(0,i.__exportStar)(n(76),t),(0,i.__exportStar)(n(77),t),(0,i.__exportStar)(n(78),t),(0,i.__exportStar)(n(79),t),(0,i.__exportStar)(n(81),t),(0,i.__exportStar)(n(82),t),(0,i.__exportStar)(n(83),t),(0,i.__exportStar)(n(84),t),(0,i.__exportStar)(n(85),t),(0,i.__exportStar)(n(86),t),(0,i.__exportStar)(n(87),t);const r=(0,i.__importDefault)(n(69)),s=(0,i.__importDefault)(n(70)),o=(0,i.__importDefault)(n(71)),a=(0,i.__importDefault)(n(72)),c=(0,i.__importDefault)(n(73)),u=(0,i.__importDefault)(n(74)),l=(0,i.__importDefault)(n(75)),d=(0,i.__importDefault)(n(76)),p=(0,i.__importDefault)(n(77)),h=(0,i.__importDefault)(n(78)),f=(0,i.__importDefault)(n(79)),m=(0,i.__importDefault)(n(81)),g=(0,i.__importDefault)(n(82)),y=(0,i.__importDefault)(n(83)),b=(0,i.__importDefault)(n(84)),_=(0,i.__importDefault)(n(85)),v=(0,i.__importDefault)(n(86)),S=(0,i.__importDefault)(n(87));t.core=function(e){e.use(d.default),e.use(u.default),e.use(o.default),e.use(c.default),e.use(p.default),e.use(v.default)},t.default=function(e){e.use(r.default),e.use(m.default),e.use(s.default),e.use(a.default),e.use(l.default),e.use(h.default),e.use(f.default),e.use(g.default),e.use(y.default),e.use(b.default),e.use(_.default),e.use(S.default)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"XRD",fields:{subject:(0,i.childText)(null,"Subject")},namespace:r.NS_XRD,path:"xrd"},{aliases:[{path:"xrd.links",multiple:!0}],element:"Link",fields:{href:(0,i.attribute)("href"),rel:(0,i.attribute)("rel"),type:(0,i.attribute)("type")},namespace:r.NS_XRD}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessengerExtension=void 0;const i=n(227),r=n(8),s=n(18);class o extends i.Emitter{constructor(e,t){super(),this.client=e,this.stanzaInstance=t}get bareJid(){return r.toBare(this.stanzaInstance.jid)}handleStanzaInstanceChange(e){this.stanzaInstance=e}isMediaMessage(e){return!!e.mediaMessage}handleMessage(e){if(!this.isMediaMessage(e))return;const t=e.from===this.stanzaInstance.jid,n=r.toBare(e.from)===this.bareJid;this.emit("mediaMessage",{...e,fromMyClient:t,fromMyUser:n})}async broadcastMessage(e){const t=s.v4();return e.id=t,e.from=this.stanzaInstance.jid,e.to||(e.to=this.bareJid),await this.stanzaInstance.send("message",e),t}get expose(){return{broadcastMessage:this.broadcastMessage.bind(this),on:this.on.bind(this),once:this.once.bind(this),off:this.off.bind(this),removeListener:this.removeListener.bind(this),addListener:this.addListener.bind(this)}}}t.MessengerExtension=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const i=n(16),r=n(173),s=n(228);n(187);const o=n(188),a=n(190),c=n(215),u=n(11),l=n(27),d=i.__importDefault(n(6)),p=n(216),h=n(49),f=i.__importDefault(n(226)),m=i.__importDefault(n(169)),g=n(53),y=n(47);let b={notifications:o.Notifications,webrtcSessions:a.WebrtcExtension,messenger:y.MessengerExtension};class _ extends d.default{constructor(e){super(),this.connected=!1,this.connecting=!1,this.hardReconnectRequired=!0,this.isGuest=!1,this.backgroundAssistantMode=!1,this.autoReconnect=!0,this.extensions=[],this.channelReuses=0,this.hasMadeInitialAttempt=!1,this.http=new l.HttpClient,this.reconnectOnNoLongerSubscribed=!1!==e.reconnectOnNoLongerSubscribed,this.config={host:e.host,apiHost:e.apiHost||e.host.replace("wss://streaming.",""),authToken:e.authToken,jwt:e.jwt,jid:e.jid,jidResource:e.jidResource,channelId:null,appName:e.appName,appVersion:e.appVersion,appId:e.appId},this.backgroundAssistantMode=this.checkIsBackgroundAssistant(),this.isGuest=!this.backgroundAssistantMode&&!e.authToken;let t=e.authToken||"",n=`https://api.${this.config.apiHost}/api/v2/diagnostics/trace`;this.backgroundAssistantMode&&(t=e.jwt,n+="/backgroundassistant"),this.logger=new s.Logger({accessToken:t,url:n,uploadDebounceTime:1e3,initializeServerLogging:!this.isGuest&&!e.optOutOfWebrtcStatsTelemetry,appVersion:_.version,appName:"streaming-client",logLevel:this.config.logLevel||"info",logger:e.logger||console,formatters:e.logFormatters,originAppName:e.appName,originAppVersion:e.appVersion,originAppId:e.appId}),this.connectionManager=new p.ConnectionManager(this.logger,this.config),Object.keys(b).forEach(t=>{const n=new b[t](this,e);this.extensions.push(n),n.tokenBucket||(n.tokenBucket=new r.TokenBucket(20,25,1e3),n.tokenBucket.content=25),"function"==typeof n.on&&n.on("send",this.handleSendEventFromExtension.bind(this,n)),this[t]=n.expose,this["_"+t]=n})}handleSendEventFromExtension(e,t,n=!1){return e.tokenBucket.removeTokens(1,()=>{const e=this.activeStanzaInstance;return e?!0===n?e.sendMessage(t):e.sendIQ(t):this.logger.warn("cannot send message, no active stanza client",{data:t,message:n},{skipServer:!0})})}checkIsBackgroundAssistant(){if(this.config.jwt){const e=u.parseJwt(this.config.jwt);return e&&"urn:purecloud:screenrecording"===e.iss}return!1}addInateEventHandlers(e){this.removeStanzaBoundEventHandlers(),this.boundStanzaDisconnect=this.handleStanzaDisconnectedEvent.bind(this,e),this.boundStanzaNoLongerSubscribed=this.handleNoLongerSubscribed.bind(this,e),this.boundStanzaDuplicateId=this.handleDuplicateId.bind(this,e),this.on("stanzaDisconnected",this.boundStanzaDisconnect),this.on("notify:no_longer_subscribed",this.boundStanzaNoLongerSubscribed),this.on("notify:duplicate_id",this.boundStanzaDuplicateId),this.extensions.forEach(t=>{"function"==typeof t.handleIq&&e.on("iq",t.handleIq.bind(t)),"function"==typeof t.handleMessage&&e.on("message",t.handleMessage.bind(t))})}removeStanzaBoundEventHandlers(){this.boundStanzaDisconnect&&(this.off("stanzaDisconnected",this.boundStanzaDisconnect),this.boundStanzaDisconnect=void 0),this.boundStanzaNoLongerSubscribed&&(this.off("notify:no_longer_subscribed",this.boundStanzaNoLongerSubscribed),this.boundStanzaNoLongerSubscribed=void 0),this.boundStanzaDuplicateId&&(this.off("notify:duplicate_id",this.boundStanzaDuplicateId),this.boundStanzaDuplicateId=void 0)}proxyStanzaEvents(e){e.originalEmitter=e.emit,e.emit=(t,...n)=>{const i=e.originalEmitter(t,...n);return"connected"===t?i:("disconnected"===t&&(t="stanzaDisconnected"),this.emit(t,...n))}}async handleStanzaDisconnectedEvent(e){var t;if(this.logger.info("stanzaDisconnected event received",{stanzaInstanceId:e.id,channelId:e.channelId}),this.connected=!1,this.connecting=!1,null===(t=e.pinger)||void 0===t||t.stop(),this.removeAllListeners("stanzaDisconnected"),this.removeAllListeners("notify:no_longer_subscribed"),e.originalEmitter&&(e.emit=e.originalEmitter),this.activeStanzaInstance=void 0,this.emit("disconnected",{reconnecting:this.autoReconnect}),this.autoReconnect)return this.connect({keepTryingOnFailure:!0})}handleNoLongerSubscribed(e){var t;this.logger.warn("noLongerSubscribed event received",{stanzaInstanceId:e.id,channelId:e.channelId}),null===(t=e.pinger)||void 0===t||t.stop(),this.hardReconnectRequired=!0,this.reconnectOnNoLongerSubscribed||(this.autoReconnect=!1)}handleDuplicateId(e){var t;this.logger.warn("duplicate_id event received, forcing hard reconnect",{stanzaInstanceId:e.id,channelId:e.channelId}),null===(t=e.pinger)||void 0===t||t.stop(),this.hardReconnectRequired=!0}async disconnect(){if(this.logger.info("streamingClient.disconnect was called"),this.activeStanzaInstance)return u.timeoutPromise(e=>(this.autoReconnect=!1,this.http.stopAllRetries(),this.activeStanzaInstance.disconnect().then(e)),5e3,"disconnecting streaming service")}getConnectionData(){const e=sessionStorage.getItem("sc_connectionData"),t={currentDelayMs:0};if(e)try{return JSON.parse(e)}catch(e){return this.logger.warn("failed to parse streaming client connection data"),t}return t}setConnectionData(e){sessionStorage.setItem("sc_connectionData",JSON.stringify(e))}increaseBackoff(){const e=this.getConnectionData(),t=Math.max(2*e.currentDelayMs,2e3);this.setConnectionData({currentDelayMs:t,delayMsAfterNextReduction:t/2,nextDelayReductionTime:(new Date).getTime()+5*t,timeOfTotalReset:(new Date).getTime()+36e5})}decreaseBackoff(e){const t=this.getConnectionData(),n=5*e,i={currentDelayMs:e,delayMsAfterNextReduction:e/2,nextDelayReductionTime:(new Date).getTime()+n,timeOfTotalReset:t.timeOfTotalReset};if(t.timeOfTotalReset&&t.timeOfTotalReset<(new Date).getTime()||e<2e3)return this.logger.debug("decreaseBackoff() called, but timeOfTotalReset has elasped or next delay is below 2s. Resetting backoff"),this.setConnectionData({currentDelayMs:0});this.setConnectionData(i),clearTimeout(this.backoffReductionTimer),this.logger.debug("Setting timer for next backoff reduction since we haven't reached total reset",{msUntilReduction:n,delayMsAfterNextReduction:i.delayMsAfterNextReduction}),this.backoffReductionTimer=setTimeout(()=>this.decreaseBackoff(i.delayMsAfterNextReduction),n)}getStartingDelay(e,t){const n=Math.max(e.currentDelayMs,2e3);return e.timeOfTotalReset&&e.timeOfTotalReset<(new Date).getTime()?2e3:Math.min(n,t)}async connect(e){var t;if(this.connecting){const e=new Error("Already trying to connect streaming client");return this.logger.warn(e)}this.connecting=!0;const n=(null==e?void 0:e.maxDelayBetweenConnectionAttempts)||9e4;let i=(null==e?void 0:e.maxConnectionAttempts)||1;(null==e?void 0:e.keepTryingOnFailure)&&(i=1/0),clearTimeout(this.backoffReductionTimer);const r=this.getConnectionData(),s=this.getStartingDelay(r,n),o=this.hasMadeInitialAttempt;this.hasMadeInitialAttempt=!0;try{await h.backOff(async()=>{const e=this.getConnectionData();if(await this.makeConnectionAttempt(),e.nextDelayReductionTime){const t=e.nextDelayReductionTime-(new Date).getTime();this.logger.debug("Setting timer for next backoff reduction",{msUntilReduction:t,delayMsAfterNextReduction:e.delayMsAfterNextReduction}),this.backoffReductionTimer=setTimeout(()=>this.decreaseBackoff(e.delayMsAfterNextReduction||0),t)}},{jitter:"none",maxDelay:n,numOfAttempts:i,startingDelay:s,delayFirstAttempt:o,retry:this.backoffConnectRetryHandler.bind(this,{maxConnectionAttempts:i})})}catch(e){let n=e;if(e){if("AxiosError"===e.name){const i=e,r=i.config||{url:void 0,method:void 0};n={config:{url:r.url,method:r.method},status:null===(t=i.response)||void 0===t?void 0:t.status,code:i.code,name:i.name,message:i.message}}}else n=new Error("Streaming client connection attempted received and undefined error");if(this.logger.error("Failed to connect streaming client",{error:n}),!e)throw n;throw e}}async backoffConnectRetryHandler(e,t,n){var i,r,s,o,a;if(n>=e.maxConnectionAttempts)return!1;const c={connectionAttempt:n,error:t};if(t){if("AxiosError"===t.name){const e=t,n=e.config||{url:void 0,method:void 0};let s={config:{url:n.url,method:n.method},status:null===(i=e.response)||void 0===i?void 0:i.status,code:e.code,name:e.name,message:e.message};if(c.error=s,[401,403].includes((null===(r=t.response)||void 0===r?void 0:r.status)||0))return this.logger.error("Streaming client received an error that it can't recover from and will not attempt to reconnect",c),!1}}else c.error=new Error("streaming client backoff handler received undefined error");if(t instanceof m.default&&(this.logger.info("hardReconnectRequired set to true due to sasl error"),this.hardReconnectRequired=!0,Object.assign(c,{channelId:t.channelId,stanzaInstanceId:t.stanzaInstanceId})),t instanceof g.TimeoutError){c.error=t.message;const e=t.details;e&&(c.details=e)}if(null==t?void 0:t.response){const e=(null===(s=t.response.headers)||void 0===s?void 0:s["retry-after"])||(null===(a=(o=t.response).getResponseHeader)||void 0===a?void 0:a.call(o,"retry-after"));if(e){let n=1e3*parseInt(e,10);return c.retryDelay=n,this.logger.error("Failed streaming client connection attempt, respecting retry-after header and will retry afterwards.",c,{skipServer:t instanceof f.default}),await u.delay(n),this.logger.debug("finished waiting for retry-after"),!0}}return this.logger.error("Failed streaming client connection attempt, retrying",c,{skipServer:t instanceof f.default}),this.increaseBackoff(),!0}async makeConnectionAttempt(){var e;if(!navigator.onLine)throw new f.default("Browser is offline, skipping connection attempt");let t,n=this.connecting;try{await this.prepareForConnect(),t=await this.connectionManager.getNewStanzaConnection(),this.connected=!0,this.connecting=!1,this.addInateEventHandlers(t),this.proxyStanzaEvents(t);for(const e of this.extensions)e.configureNewStanzaInstance&&await e.configureNewStanzaInstance(t);for(const e of this.extensions)e.handleStanzaInstanceChange(t);this.activeStanzaInstance=t,t.pinger=new c.Ping(this,t),this.emit("connected")}catch(i){throw t&&(this.logger.error("Error occurred in connection attempt, but after websocket connected. Cleaning up connection so backoff is respected",{stanzaInstanceId:t.id,channelId:t.channelId}),this.removeStanzaBoundEventHandlers(),null===(e=t.pinger)||void 0===e||e.stop(),await t.disconnect(),this.connected=!1,this.connecting=n),i}}async prepareForConnect(){if(this.config.jwt)return this.hardReconnectRequired=!1,this.connectionManager.setConfig(this.config);if(this.hardReconnectRequired||(this.channelReuses++,this.channelReuses>=10&&(this.logger.warn("Forcing a hard reconnect due to max channel reuses",{channelId:this.config.channelId,channelReuses:this.channelReuses}),this.channelReuses=0,this.hardReconnectRequired=!0)),this.hardReconnectRequired){let e;if(this.config.jid)e=Promise.resolve(this.config.jid);else{const t={method:"get",host:this.config.apiHost,authToken:this.config.authToken,logger:this.logger};e=this.http.requestApi("users/me",t).then(e=>e.data.chat.jabberId)}const t={method:"post",host:this.config.apiHost,authToken:this.config.authToken,logger:this.logger},n=this.http.requestApi("notifications/channels?connectionType=streaming",t).then(e=>e.data.id),[i,r]=await Promise.all([e,n]);this.config.jid=i,this.config.channelId=r,this.autoReconnect=!0,this.logger.info("attempting to connect streaming client on channel",{channelId:r}),this.connectionManager.setConfig(this.config),this.hardReconnectRequired=!1}}stopServerLogging(){this.logger.sendAllLogsInstantly(),this._webrtcSessions.flushStats(),this.logger.stopServerLogging()}startServerLogging(){this.logger.startServerLogging()}setAccessToken(e){this.config.authToken=e,this.logger.setAccessToken(e)}static extend(e,t){if(b[e])throw new Error("Cannot register already existing namespace "+e);b[e]=t}get version(){return _.version}static get version(){return"17.0.2"}}t.Client=_},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(176),o=n(177);t.backOff=function(e,t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return n=s.getSanitizedOptions(t),[4,new a(e,n).execute()];case 1:return[2,i.sent()]}}))}))};var a=function(){function e(e,t){this.request=e,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return i(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}}))}))},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,o.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}}))}))},e}()},function(e,t,n){"use strict";var i={};n.r(i),n.d(i,"hasBrowserEnv",(function(){return y})),n.d(i,"hasStandardBrowserWebWorkerEnv",(function(){return v})),n.d(i,"hasStandardBrowserEnv",(function(){return b}));var r=n(0),s=n(30),o=n(14);function a(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function c(e,t){this._pairs=[],e&&Object(o.a)(e,this,t)}const u=c.prototype;u.append=function(e,t){this._pairs.push([e,t])},u.toString=function(e){const t=e?function(t){return e.call(this,t,a)}:a;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var l=c;function d(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function p(e,t,n){if(!t)return e;const i=n&&n.encode||d,s=n&&n.serialize;let o;if(o=s?s(t,n):r.a.isURLSearchParams(t)?t.toString():new l(t,n).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}var h=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){r.a.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},f=n(4),m={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},g={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:l,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const y="undefined"!=typeof window&&"undefined"!=typeof document,b=(_="undefined"!=typeof navigator&&navigator.product,y&&["ReactNative","NativeScript","NS"].indexOf(_)<0);var _;const v="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var S={...i,...g};var w=function(e){function t(e,n,i,s){let o=e[s++];if("__proto__"===o)return!0;const a=Number.isFinite(+o),c=s>=e.length;if(o=!o&&r.a.isArray(i)?i.length:o,c)return r.a.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a;i[o]&&r.a.isObject(i[o])||(i[o]=[]);return t(e,n,i[o],s)&&r.a.isArray(i[o])&&(i[o]=function(e){const t={},n=Object.keys(e);let i;const r=n.length;let s;for(i=0;i<r;i++)s=n[i],t[s]=e[s];return t}(i[o])),!a}if(r.a.isFormData(e)&&r.a.isFunction(e.entries)){const n={};return r.a.forEachEntry(e,(e,i)=>{t(function(e){return r.a.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),i,n,0)}),n}return null};const T={transitional:m,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=r.a.isObject(e);s&&r.a.isHTMLForm(e)&&(e=new FormData(e));if(r.a.isFormData(e))return i&&i?JSON.stringify(w(e)):e;if(r.a.isArrayBuffer(e)||r.a.isBuffer(e)||r.a.isStream(e)||r.a.isFile(e)||r.a.isBlob(e))return e;if(r.a.isArrayBufferView(e))return e.buffer;if(r.a.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Object(o.a)(e,new S.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,i){return S.isNode&&r.a.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=r.a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Object(o.a)(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),function(e,t,n){if(r.a.isString(e))try{return(t||JSON.parse)(e),r.a.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||T.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&r.a.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw f.a.from(e,f.a.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:S.classes.FormData,Blob:S.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};r.a.forEach(["delete","get","head","post","put","patch"],e=>{T.headers[e]={}});var I=T;const N=r.a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const A=Symbol("internals");function E(e){return e&&String(e).trim().toLowerCase()}function x(e){return!1===e||null==e?e:r.a.isArray(e)?e.map(x):String(e)}function R(e,t,n,i,s){return r.a.isFunction(i)?i.call(this,t,n):(s&&(t=n),r.a.isString(t)?r.a.isString(i)?-1!==t.indexOf(i):r.a.isRegExp(i)?i.test(t):void 0:void 0)}class C{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function s(e,t,n){const s=E(t);if(!s)throw new Error("header name must be a non-empty string");const o=r.a.findKey(i,s);(!o||void 0===i[o]||!0===n||void 0===n&&!1!==i[o])&&(i[o||t]=x(e))}const o=(e,t)=>r.a.forEach(e,(e,n)=>s(e,n,t));return r.a.isPlainObject(e)||e instanceof this.constructor?o(e,t):r.a.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?o((e=>{const t={};let n,i,r;return e&&e.split("\n").forEach((function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),i=e.substring(r+1).trim(),!n||t[n]&&N[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=E(e)){const n=r.a.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(r.a.isFunction(t))return t.call(this,e,n);if(r.a.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=E(e)){const n=r.a.findKey(this,e);return!(!n||void 0===this[n]||t&&!R(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function s(e){if(e=E(e)){const s=r.a.findKey(n,e);!s||t&&!R(0,n[s],s,t)||(delete n[s],i=!0)}}return r.a.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const r=t[n];e&&!R(0,this[r],r,e,!0)||(delete this[r],i=!0)}return i}normalize(e){const t=this,n={};return r.a.forEach(this,(i,s)=>{const o=r.a.findKey(n,s);if(o)return t[o]=x(i),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();a!==s&&delete t[s],t[a]=x(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return r.a.forEach(this,(n,i)=>{null!=n&&!1!==n&&(t[i]=e&&r.a.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[A]=this[A]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=E(e);t[i]||(!function(e,t){const n=r.a.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{value:function(e,n,r){return this[i].call(this,t,e,n,r)},configurable:!0})})}(n,e),t[i]=!0)}return r.a.isArray(e)?e.forEach(i):i(e),this}}C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),r.a.reduceDescriptors(C.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),r.a.freezeMethods(C);var O=C;function k(e,t){const n=this||I,i=t||n,s=O.from(i.headers);let o=i.data;return r.a.forEach(e,(function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)})),s.normalize(),o}function P(e){return!(!e||!e.__CANCEL__)}function j(e,t,n){f.a.call(this,null==e?"canceled":e,f.a.ERR_CANCELED,t,n),this.name="CanceledError"}r.a.inherits(j,f.a,{__CANCEL__:!0});var L=j,M=n(31);var D=S.hasStandardBrowserEnv?{write(e,t,n,i,s,o){const a=[e+"="+encodeURIComponent(t)];r.a.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.a.isString(i)&&a.push("path="+i),r.a.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function B(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var F=S.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function i(n){let i=n;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(e){const t=r.a.isString(e)?i(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};var q=function(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=i[o];r||(r=c),n[s]=a,i[s]=c;let l=o,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-r<t)return;const p=u&&c-u;return p?Math.round(1e3*d/p):void 0}};function U(e,t){let n=0;const i=q(50,250);return r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,c=i(a);n=s;const u={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:r};u[t?"download":"upload"]=!0,e(u)}}var J="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let i=e.data;const s=O.from(e.headers).normalize();let o,a,{responseType:c,withXSRFToken:u}=e;function l(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}if(r.a.isFormData(i))if(S.hasStandardBrowserEnv||S.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if(!1!==(a=s.getContentType())){const[e,...t]=a?a.split(";").map(e=>e.trim()).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}let d=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const h=B(e.baseURL,e.url);function g(){if(!d)return;const i=O.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());!function(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new f.a("Request failed with status code "+n.status,[f.a.ERR_BAD_REQUEST,f.a.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),l()}),(function(e){n(e),l()}),{data:c&&"text"!==c&&"json"!==c?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:i,config:e,request:d}),d=null}if(d.open(e.method.toUpperCase(),p(h,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,"onloadend"in d?d.onloadend=g:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(g)},d.onabort=function(){d&&(n(new f.a("Request aborted",f.a.ECONNABORTED,e,d)),d=null)},d.onerror=function(){n(new f.a("Network Error",f.a.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||m;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new f.a(t,i.clarifyTimeoutError?f.a.ETIMEDOUT:f.a.ECONNABORTED,e,d)),d=null},S.hasStandardBrowserEnv&&(u&&r.a.isFunction(u)&&(u=u(e)),u||!1!==u&&F(h))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&D.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===i&&s.setContentType(null),"setRequestHeader"in d&&r.a.forEach(s.toJSON(),(function(e,t){d.setRequestHeader(t,e)})),r.a.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),c&&"json"!==c&&(d.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",U(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",U(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{d&&(n(!t||t.type?new L(null,e,d):t),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(h);y&&-1===S.protocols.indexOf(y)?n(new f.a("Unsupported protocol "+y+":",f.a.ERR_BAD_REQUEST,e)):d.send(i||null)}))};const z={http:M.a,xhr:J};r.a.forEach(z,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const G=e=>"- "+e,H=e=>r.a.isFunction(e)||null===e||!1===e;var V=e=>{e=r.a.isArray(e)?e:[e];const{length:t}=e;let n,i;const s={};for(let r=0;r<t;r++){let t;if(n=e[r],i=n,!H(n)&&(i=z[(t=String(n)).toLowerCase()],void 0===i))throw new f.a(`Unknown adapter '${t}'`);if(i)break;s[t||"#"+r]=i}if(!i){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let n=t?e.length>1?"since :\n"+e.map(G).join("\n"):" "+G(e[0]):"as no adapter specified";throw new f.a("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return i};function W(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new L(null,e)}function $(e){W(e),e.headers=O.from(e.headers),e.data=k.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return V(e.adapter||I.adapter)(e).then((function(t){return W(e),t.data=k.call(e,e.transformResponse,t),t.headers=O.from(t.headers),t}),(function(t){return P(t)||(W(e),t&&t.response&&(t.response.data=k.call(e,e.transformResponse,t.response),t.response.headers=O.from(t.response.headers))),Promise.reject(t)}))}const Q=e=>e instanceof O?e.toJSON():e;function K(e,t){t=t||{};const n={};function i(e,t,n){return r.a.isPlainObject(e)&&r.a.isPlainObject(t)?r.a.merge.call({caseless:n},e,t):r.a.isPlainObject(t)?r.a.merge({},t):r.a.isArray(t)?t.slice():t}function s(e,t,n){return r.a.isUndefined(t)?r.a.isUndefined(e)?void 0:i(void 0,e,n):i(e,t,n)}function o(e,t){if(!r.a.isUndefined(t))return i(void 0,t)}function a(e,t){return r.a.isUndefined(t)?r.a.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function c(n,r,s){return s in t?i(n,r):s in e?i(void 0,n):void 0}const u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(e,t)=>s(Q(e),Q(t),!0)};return r.a.forEach(Object.keys(Object.assign({},e,t)),(function(i){const o=u[i]||s,a=o(e[i],t[i],i);r.a.isUndefined(a)&&o!==c||(n[i]=a)})),n}const X={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{X[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Y={};X.transitional=function(e,t,n){function i(e,t){return"[Axios v1.6.5] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,s)=>{if(!1===e)throw new f.a(i(r," has been removed"+(t?" in "+t:"")),f.a.ERR_DEPRECATED);return t&&!Y[r]&&(Y[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}};var Z={assertOptions:function(e,t,n){if("object"!=typeof e)throw new f.a("options must be an object",f.a.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let r=i.length;for(;r-- >0;){const s=i[r],o=t[s];if(o){const t=e[s],n=void 0===t||o(t,s,e);if(!0!==n)throw new f.a("option "+s+" must be "+n,f.a.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new f.a("Unknown option "+s,f.a.ERR_BAD_OPTION)}},validators:X};const ee=Z.validators;class te{constructor(e){this.defaults=e,this.interceptors={request:new h,response:new h}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=K(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;void 0!==n&&Z.assertOptions(n,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1),null!=i&&(r.a.isFunction(i)?t.paramsSerializer={serialize:i}:Z.assertOptions(i,{encode:ee.function,serialize:ee.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&r.a.merge(s.common,s[t.method]);s&&r.a.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=O.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(c=c&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const u=[];let l;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let d,p=0;if(!c){const e=[$.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,u),d=e.length,l=Promise.resolve(t);p<d;)l=l.then(e[p++],e[p++]);return l}d=a.length;let h=t;for(p=0;p<d;){const e=a[p++],t=a[p++];try{h=e(h)}catch(e){t.call(this,e);break}}try{l=$.call(this,h)}catch(e){return Promise.reject(e)}for(p=0,d=u.length;p<d;)l=l.then(u[p++],u[p++]);return l}getUri(e){return p(B((e=K(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}r.a.forEach(["delete","get","head","options"],(function(e){te.prototype[e]=function(t,n){return this.request(K(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.a.forEach(["post","put","patch"],(function(e){function t(t){return function(n,i,r){return this.request(K(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}te.prototype[e]=t(),te.prototype[e+"Form"]=t(!0)}));var ne=te;class ie{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const i=new Promise(e=>{n.subscribe(e),t=e}).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e((function(e,i,r){n.reason||(n.reason=new L(e,i,r),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new ie((function(t){e=t})),cancel:e}}}var re=ie;const se={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(se).forEach(([e,t])=>{se[t]=e});var oe=se;const ae=function e(t){const n=new ne(t),i=Object(s.a)(ne.prototype.request,n);return r.a.extend(i,ne.prototype,n,{allOwnKeys:!0}),r.a.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(K(t,n))},i}(I);ae.Axios=ne,ae.CanceledError=L,ae.CancelToken=re,ae.isCancel=P,ae.VERSION="1.6.5",ae.toFormData=o.a,ae.AxiosError=f.a,ae.Cancel=ae.CanceledError,ae.all=function(e){return Promise.all(e)},ae.spread=function(e){return function(t){return e.apply(null,t)}},ae.isAxiosError=function(e){return r.a.isObject(e)&&!0===e.isAxiosError},ae.mergeConfig=K,ae.AxiosHeaders=O,ae.formToJSON=e=>w(r.a.isHTMLForm(e)?new FormData(e):e),ae.getAdapter=V,ae.HttpStatusCode=oe,ae.default=ae;t.a=ae},function(e,t,n){(function(t){var n=function(e,t,n,i){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof n)switch(n){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+n)}else this.interval=n;this.parentBucket=i,this.content=0,this.lastDrip=+new Date};n.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(e,n){var i=this;return this.bucketSize?e>this.bucketSize?(t.nextTick(n.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),e>this.content?r():this.parentBucket?this.parentBucket.removeTokens(e,(function(t,s){return t?n(t,null):e>i.content?r():(i.content-=e,void n(null,Math.min(s,i.content)))})):(this.content-=e,t.nextTick(n.bind(null,null,this.content)),!0)):(t.nextTick(n.bind(null,null,e,Number.POSITIVE_INFINITY)),!0);function r(){var t=Math.ceil((e-i.content)*(i.interval/i.tokensPerInterval));return setTimeout((function(){i.removeTokens(e,n)}),t),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var n=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+n,this.bucketSize)}else this.content=this.bucketSize}},e.exports=n}).call(this,n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(179),r=function(){function e(e){this.options=e,this.attempt=0}return e.prototype.apply=function(){var e=this;return new Promise((function(t){return setTimeout(t,e.jitteredDelay)}))},e.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){return i.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,n=this.numOfDelayedAttempts,i=e*Math.pow(t,n);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();t.Delay=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimeoutError=void 0;class i extends Error{constructor(e){super(e)}}t.TimeoutError=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.saslprep=t.resourceprep=t.nodeprep=t.NodePrepProhibited=t.nameprep=t.prepare=t.D2=t.D1=t.C9=t.C8=t.C7=t.C6=t.C5=t.C4=t.C3=t.C22=t.C21=t.C12=t.C11=t.B3=t.B2=t.B1=t.A1=t.Table=void 0;const i=(0,n(3).__importDefault)(n(33)),r=n(192);class s{constructor(e,t){this.singles=new Set,this.ranges=[],this.mappings=new Map;const n=r.TABLE_DATA[e];this.name=e,n?(n.s&&(this.singles=new Set(n.s.split("|").map(e=>parseInt(e,32)))),n.r&&(this.ranges=n.r.split("|").map(e=>{const[t,n]=e.split(":");return[parseInt(t,32),parseInt(n,32)]})),n.m&&(this.mappings=new Map(n.m.split("|").map(e=>{const[t,n]=e.split(":"),i=n.split(";").map(e=>parseInt(e,32));return[parseInt(t,32),i]})))):t&&(this.singles=new Set(t))}contains(e){if(this.singles.has(e))return!0;let t=0,n=this.ranges.length-1;for(;t<=n;){const i=Math.floor((t+n)/2),r=this.ranges[i];if(e<r[0])n=i-1;else{if(!(e>r[1]))return!0;t=i+1}}return!1}hasMapping(e){return this.mappings.has(e)||this.contains(e)}map(e){return this.contains(e)&&!this.mappings.has(e)?String.fromCodePoint(e).toLowerCase().codePointAt(0):this.mappings.get(e)||null}}function o(e,n,r=""){const s=i.default.ucs2.decode(r);let o=[];for(const t of s){if(!n&&e.unassigned.contains(t))throw new Error("Unassigned code point: x"+t.toString(16));let i=!1;for(const n of e.mappings){if(!n.hasMapping(t))continue;i=!0;const e=n.map(t);e&&(Array.isArray(e)?o=o.concat(e):o.push(e))}i||o.push(t)}let a=o;if(e.normalize){const e=i.default.ucs2.encode(o).normalize("NFKC");a=i.default.ucs2.decode(e)}let c=!1,u=!1;for(const i of a){for(const t of e.prohibited)if(t.contains(i))throw new Error("Prohibited code point: x"+i.toString(16));if(!n&&e.unassigned.contains(i))throw new Error("Prohibited code point: x"+i.toString(16));e.bidirectional&&(c=c||t.D1.contains(i),u=u||t.D2.contains(i))}if(e.bidirectional){if(c&&u)throw new Error("String contained both LCat and RandALCat code points");if(c&&(!t.D1.contains(a[0])||!t.D1.contains(a[a.length-1])))throw new Error("String containing RandALCat code points must start and end with RandALCat code points")}return i.default.ucs2.encode(a)}t.Table=s,t.A1=new s("A.1"),t.B1=new s("B.1"),t.B2=new s("B.2"),t.B3=new s("B.3"),t.C11=new s("C.1.1"),t.C12=new s("C.1.2"),t.C21=new s("C.2.1"),t.C22=new s("C.2.2"),t.C3=new s("C.3"),t.C4=new s("C.4"),t.C5=new s("C.5"),t.C6=new s("C.6"),t.C7=new s("C.7"),t.C8=new s("C.8"),t.C9=new s("C.9"),t.D1=new s("D.1"),t.D2=new s("D.2"),t.B1.map=()=>null,t.C11.contains=e=>32===e,t.C12.map=e=>t.C12.contains(e)?32:null,t.prepare=o;const a={bidirectional:!0,mappings:[t.B1,t.B2],normalize:!0,prohibited:[t.C12,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.nameprep=function(e,t=!0){return o(a,t,e)},t.NodePrepProhibited=new s("NodePrepProhibited",[34,38,39,47,58,60,62,64]);const c={bidirectional:!0,mappings:[t.B1,t.B2],normalize:!0,prohibited:[t.C11,t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9,t.NodePrepProhibited],unassigned:t.A1};t.nodeprep=function(e,t=!0){return o(c,t,e)};const u={bidirectional:!0,mappings:[t.B1],normalize:!0,prohibited:[t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.resourceprep=function(e,t=!0){return o(u,t,e)};const l={bidirectional:!0,mappings:[t.C12,t.B1],normalize:!0,prohibited:[t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.saslprep=function(e,t=!1){return o(l,t,e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(35);t.default=class{constructor(){this.parents=new Set,this.placeholder=!1,this.typeField="",this.versionField="",this.defaultType="",this.defaultVersion="",this.languageField="lang",this.typeValues=new Map,this.typeOrders=new Map,this.importers=new Map,this.exporters=new Map,this.children=new Map,this.childrenIndex=new Map,this.implicitChildren=new Set,this.contexts=new Map}addChild(e,t,n=!1,i,r){const s={multiple:n||!1,name:e,selector:i,translator:t},o=this.children.get(e);if(!o){s.translator.parents.add(this),this.children.set(e,s);for(const[n]of t.importers)this.implicitChildren.has(n)||this.childrenIndex.set(n,e);return void(r&&this.implicitChildren.add(r))}const a=o.translator;o.multiple=n,i&&o.selector&&i!==o.selector&&(o.selector=void 0);for(const[n,i]of t.importers){const[r,s]=(a.typeValues.get(n)||"").split("__v__");a.updateDefinition({contexts:t.contexts,element:i.element,exporterOrdering:new Map,exporters:new Map,importerOrdering:i.fieldOrders,importers:i.fields,namespace:i.namespace,optionalNamespaces:new Map,type:r,version:s}),this.implicitChildren.has(n)||this.childrenIndex.set(n,e)}for(const[e,n]of t.exporters){const[i,r]=e.split("__v__");a.updateDefinition({contexts:t.contexts,element:n.element,exporterOrdering:n.fieldOrders,exporters:n.fields,importerOrdering:new Map,importers:new Map,namespace:n.namespace,optionalNamespaces:n.optionalNamespaces,type:i,version:r})}}addContext(e,t,n,i,r,s){t&&(e=`${e}[${t}]`);let o=this.contexts.get(e);o||(o={typeField:"",versionField:"",typeValues:new Map}),s&&(o.impliedType=r),o.typeField=n||"",o.typeValues.set(i,r),this.contexts.set(e,o)}getChild(e){const t=this.children.get(e);if(t)return t.translator}getImportKey(e){return this.childrenIndex.get(`{${e.getNamespace()}}${e.getName()}`)}updateDefinition(e){const t=`{${e.namespace}}${e.element}`,n=e.type||this.defaultType,i=e.version||this.defaultVersion,r=i?`${n}__v__${i}`:n,s=this.importers.get(t)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace};for(const[t,n]of e.importers)s.fields.set(t,n);for(const[t,n]of e.importerOrdering)s.fieldOrders.set(t,n);this.importers.set(t,s);const o=this.exporters.get(r)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace,optionalNamespaces:e.optionalNamespaces};for(const[t,n]of e.exporters)o.fields.set(t,n);for(const[t,n]of e.exporterOrdering)o.fieldOrders.set(t,n);for(const[t,n]of e.optionalNamespaces)o.optionalNamespaces.set(t,n);this.exporters.set(r,o);for(const[t,n]of e.contexts){const e=this.contexts.get(t)||{impliedType:void 0,typeField:n.typeField,versionField:n.versionField,typeValues:new Map};e.typeField||(e.typeField=n.typeField),e.versionField||(e.versionField=n.versionField),e.impliedType||(e.impliedType=n.impliedType);for(const[t,i]of n.typeValues)e.typeValues.set(t,i);this.contexts.set(t,e)}if(e.type)this.typeValues.set(t,r),e.typeOrder&&e.type&&this.typeOrders.set(e.type,e.typeOrder);else if(this.typeField&&!e.type){for(const[,t]of this.importers){for(const[n,i]of e.importers)t.fields.set(n,i);for(const[n,i]of e.importerOrdering)t.fieldOrders.set(n,i)}for(const[,t]of this.exporters){for(const[n,i]of e.exporters)t.fields.set(n,i);for(const[n,i]of e.exporterOrdering)t.fieldOrders.set(n,i)}}}replaceWith(e){for(const[t,n]of this.children)e.children.set(t,n);for(const[t,n]of this.childrenIndex)e.childrenIndex.set(t,n);for(const[t,n]of this.contexts)e.contexts.set(t,n);for(const t of this.implicitChildren)e.implicitChildren.add(t);for(const t of this.parents)for(const n of t.children.values())n.translator===this&&(n.translator=e);this.parents=new Set}import(e,t){const n=`{${e.getNamespace()}}${e.getName()}`,i={},r=this.importers.get(n);if(!r)return;const s=this.typeValues.get(n)||"",[o,a]=s.split("__v__"),c=t.path||"";let u;if(t.pathSelector&&(u=this.contexts.get(`${c}[${t.pathSelector}]`)),u||(u=this.contexts.get(c)),u){if(!u.impliedType){const e=u.typeValues.get(n)||"";e&&(i[u.typeField]=e)}}else this.typeField&&o&&o!==this.defaultType&&(i[this.typeField]=o);this.versionField&&a&&a!==this.defaultVersion&&(i[this.versionField]=a);const l={...t,data:i,importer:r,lang:(e.getAttribute("xml:lang")||t.lang||"").toLowerCase(),pathSelector:o,translator:this},d=[...r.fieldOrders.entries()].sort((e,t)=>e[1]>t[1]?-1:e[1]<t[1]?1:0),p=d.filter(e=>e[1]>=0),h=d.filter(e=>e[1]<0);for(const[n]of p){const s=r.fields.get(n);l.path=`${t.path}.${n}`;const o=s(e,l);null!=o&&(i[n]=o)}for(const n of e.children){if("string"==typeof n)continue;const e=`{${n.getNamespace()}}${n.getName()}`,r=this.childrenIndex.get(e);if(!r)continue;l.path=`${t.path}.${r}`;const{translator:s,multiple:a,selector:c}=this.children.get(r);if(!c||c===o){const e=s.import(n,l);void 0!==e&&(a?(i[r]||(i[r]=[]),i[r].push(e)):i[r]?i[r]=s.resolveCollision(i[r],e):i[r]=e)}}for(const[n]of h){const s=r.fields.get(n);l.path=`${t.path}.${n}`;const o=s(e,l);null!=o&&(i[n]=o)}return i}export(e,t){if(!e)return;let n=this.defaultType,r=this.defaultVersion;const s=t.path||"";let o;t.pathSelector&&(o=this.contexts.get(`${s}[${t.pathSelector}]`)),o||(o=this.contexts.get(s)),o?n=o.impliedType||e[o.typeField]||this.defaultType:this.typeField&&(n=e[this.typeField]||this.defaultType),this.versionField&&(r=e[this.versionField]||this.defaultVersion);const a=r?`${n}__v__${r}`:n,c=this.exporters.get(a);if(!c)return;const u=(0,i.createElement)(c.namespace,c.element,t.namespace,t.element);t.element&&(u.parent=t.element);for(const[e,t]of c.optionalNamespaces)u.addOptionalNamespace(e,t);const l={...t,data:e,element:u,exporter:c,lang:(e[this.languageField]||t.lang||"").toLowerCase(),namespace:u.getDefaultNamespace(),pathSelector:n,translator:this},d=c.fields.get(this.languageField);d&&d(u,e[this.languageField],t);const p=Object.keys(e);p.sort((e,t)=>(c.fieldOrders.get(e)||1e5)-(c.fieldOrders.get(t)||1e5));for(const i of p){if(i===this.languageField)continue;const r=e[i],s=c.fields.get(i);if(s){s(u,r,l);continue}const o=this.children.get(i);if(!o)continue;l.path=`${t.path?t.path+".":""}${i}`;const{translator:a,multiple:d,selector:p}=o;if(!p||p===n){let e;e=d?null!=r?r:[]:[r];for(const t of e){const e=a.export(t,l);e&&u.appendChild(e)}}}return u}resolveCollision(e,t){return(this.typeOrders.get(e[this.typeField]||this.defaultType)||0)<=(this.typeOrders.get(t[this.typeField]||this.defaultType)||0)?e:t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=void 0;const i=n(3),r=(0,i.__importDefault)(n(19));t.Hash=r.default;const s=(0,i.__importDefault)(n(205)),o=(0,i.__importDefault)(n(206)),a=(0,i.__importDefault)(n(207)),c=(0,i.__importDefault)(n(208)),u=new Map([["md5",s.default],["sha-1",o.default],["sha-256",a.default],["sha-512",c.default],["sha1",o.default],["sha256",a.default],["sha512",c.default]]);t.default=function(e){e=e.toLowerCase();const t=u.get(e);if(t)return new t;throw new Error("Unsupported hash algorithm: "+e)}},function(e,t,n){"use strict";(function(t,i){var r,s=n(25);e.exports=g,g.ReadableState=m;n(6).EventEmitter;var o=function(e,t){return e.listeners(t).length},a=n(6).EventEmitter,c=n(9).Buffer,u=t.Uint8Array||function(){};var l,d=Object.create(n(20)),p=n(203).BufferList,h=n(58);d.inherits(g,a);var f=["error","close","destroy","pause","resume"];function m(e,t){e=e||{};var i=t instanceof(r=r||n(17));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var s=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=s||0===s?s:i&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=n(60).StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function g(e){if(r=r||n(17),!(this instanceof g))return new g(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function y(e,t,n,i,r){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,v(e)}(e,o)):(r||(s=function(e,t){var n;i=t,c.isBuffer(i)||i instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var i;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),i?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):b(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?b(e,o,t,!1):w(e,o)):b(e,o,t,!1))):i||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(o)}function b(e,t,n,i){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&v(e)),w(e,t)}Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),g.prototype.destroy=h.destroy,g.prototype._undestroy=h.undestroy,g.prototype._destroy=function(e,t){this.push(null),t(e)},g.prototype.push=function(e,t){var n,i=this._readableState;return i.objectMode?n=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=c.from(e,t),t=""),n=!0),y(this,e,t,!1,n)},g.prototype.unshift=function(e){return y(this,e,null,!0,!1)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(e){return l||(l=n(60).StringDecoder),this._readableState.decoder=new l(e),this._readableState.encoding=e,this};function _(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function v(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.flowing,t.emittedReadable=!0,t.sync?s.nextTick(S,e):S(e))}function S(e){e.emit("readable"),A(e)}function w(e,t){t.readingMore||(t.readingMore=!0,s.nextTick(T,e,t))}function T(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function I(e){e.read(0)}function N(e,t){t.reading||e.read(0),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(t.flowing;t.flowing&&null!==e.read(););}function E(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var i;e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):i=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,i=1,r=n.data;e-=r.length;for(;n=n.next;){var s=n.data,o=e>s.length?s.length:e;if(o===s.length?r+=s:r+=s.slice(0,e),0===(e-=o)){o===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++i}return t.length-=i,r}(e,t):function(e,t){var n=c.allocUnsafe(e),i=t.head,r=1;i.data.copy(n),e-=i.data.length;for(;i=i.next;){var s=i.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=s.slice(o));break}++r}return t.length-=r,n}(e,t);return i}(e,t.buffer,t.decoder),n);var n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,s.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}g.prototype.read=function(e){e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return t.length,t.ended,0===t.length&&t.ended?x(this):v(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&x(this),null;var i,r=t.needReadable;return(0===t.length||t.length-e<t.highWaterMark)&&(r=!0),t.ended||t.reading?r=!1:r&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(n,t))),null===(i=e>0?E(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},g.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,r.pipesCount;var a=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?u:y;function c(t,i){t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",l),e.removeListener("error",f),e.removeListener("unpipe",c),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",h),d=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){e.end()}r.endEmitted?s.nextTick(a):n.once("end",a),e.on("unpipe",c);var l=function(e){return function(){var t=e._readableState;t.awaitDrain,t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(n);e.on("drain",l);var d=!1;var p=!1;function h(t){p=!1,!1!==e.write(t)||p||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==C(r.pipes,e))&&!d&&(n._readableState.awaitDrain,n._readableState.awaitDrain++,p=!0),n.pause())}function f(t){y(),e.removeListener("error",f),0===o(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),y()}function g(){e.removeListener("close",m),y()}function y(){n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",m),e.once("finish",g),e.emit("pipe",n),r.flowing||n.resume(),e},g.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<r;s++)i[s].emit("unpipe",this,n);return this}var o=C(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},g.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&v(this):s.nextTick(I,this))}return n},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var e=this._readableState;return e.flowing||(e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,s.nextTick(N,e,t))}(this,e)),this},g.prototype.pause=function(){return this._readableState.flowing,!1!==this._readableState.flowing&&(this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;for(var r in e.on("end",(function(){if(n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(r){(n.decoder&&(r=n.decoder.write(r)),n.objectMode&&null==r)||(n.objectMode||r&&r.length)&&(t.push(r)||(i=!0,e.pause()))})),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var s=0;s<f.length;s++)e.on(f[s],this.emit.bind(this,f[s]));return this._read=function(t){i&&(i=!1,e.resume())},this},Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),g._fromList=E}).call(this,n(15),n(22))},function(e,t,n){"use strict";var i=n(25);function r(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i.nextTick(r,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(i.nextTick(r,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";(function(t){var i=n(25);function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var i=e.entry;e.entry=null;for(;i;){var r=i.callback;t.pendingcb--,r(n),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=m;var s,o=i.nextTick;m.WritableState=f;var a=Object.create(n(20)),c=n(6).EventEmitter,u=n(9).Buffer,l=t.Uint8Array||function(){};var d,p=n(58);function h(){}function f(e,t){s=s||n(17),e=e||{};var a=t instanceof s;this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var c=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:a&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var d=!1===e.decodeStrings;this.decodeStrings=!d,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,s=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,s){--t.pendingcb,n?(i.nextTick(s,r),i.nextTick(S,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(s(r),e._writableState.errorEmitted=!0,e.emit("error",r),S(e,t))}(e,n,r,t,s);else{var a=_(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||b(e,n),r?o(y,e,n,a,s):y(e,n,a,s)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function m(e){if(s=s||n(17),!(d.call(m,this)||this instanceof s))return new m(e);this._writableState=new f(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),c.call(this)}function g(e,t,n,i,r,s,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function y(e,t,n,i){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),S(e,t)}function b(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,s=new Array(i),o=t.corkedRequestsFree;o.entry=n;for(var a=0,c=!0;n;)s[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;s.allBuffers=c,g(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new r(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,d=n.callback;if(g(e,t,!1,t.objectMode?1:u.length,u,l,d),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function _(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function v(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),S(e,t)}))}function S(e,t){var n=_(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(v,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}a.inherits(m,c),f.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(f.prototype,"buffer",{get:function(){return this.getBuffer()}})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===m&&(e&&e._writableState instanceof f)}})):d=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,s=this._writableState,o=!1,a=!s.objectMode&&(r=e,u.isBuffer(r)||r instanceof l);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=s.defaultEncoding),"function"!=typeof n&&(n=h),s.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var s=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),i.nextTick(r,o),s=!1),s}(this,s,e,n))&&(s.pendingcb++,o=function(e,t,n,i,r,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,n));return t}(t,i,r);i!==o&&(n=!0,r="buffer",i=o)}var a=t.objectMode?1:i.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:r,isBuf:n,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else g(e,t,!1,a,i,r,s);return c}(this,s,a,e,t,n)),o},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||b(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,S(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=p.destroy,m.prototype._undestroy=p.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(15))},function(e,t,n){"use strict";var i=n(9).Buffer,r=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=p,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function p(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var r=o(t[i]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(e.lastNeed=r-2),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=s;var i=n(17);function r(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),i(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);i.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",o)}function o(){var e=this;"function"==typeof this._flush?this._flush((function(t,n){a(e,t,n)})):a(this,null,null)}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}Object.create(n(20)).inherits(s,i),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},s.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},s.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},s.prototype._destroy=function(e,t){var n=this;i.prototype._destroy.call(this,e,(function(e){t(e),n.emit("close")}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Receiver=t.Sender=void 0;const i=n(3),r=n(6),s=(0,i.__importStar)(n(7)),o=n(5),a=n(1),c=(0,i.__importDefault)(n(40)),u=n(26),l=n(41);class d extends r.EventEmitter{constructor(e={}){super(),this.config={chunkSize:16384,hash:"sha-1",...e},this.file=void 0,this.channel=void 0,this.hash=s.createHash(this.config.hash)}send(e,t){if(this.file&&this.channel)return;this.file=e,this.channel=t,this.channel.binaryType="arraybuffer";const n=new FileReader;let i=0,r=!1;const s=()=>{if(r||i>=e.size)return;r=!0;const t=e.slice(i,i+this.config.chunkSize);n.readAsArrayBuffer(t)};t.bufferedAmountLowThreshold=8*this.config.chunkSize,t.onbufferedamountlow=()=>{s()},n.addEventListener("load",t=>{const n=t.target.result;r=!1,i+=n.byteLength,this.channel.send(n),this.hash.update(new Uint8Array(n)),this.emit("progress",i,e.size,n),i<e.size?this.channel.bufferedAmount<=this.channel.bufferedAmountLowThreshold&&s():(this.emit("progress",e.size,e.size,null),this.emit("sentFile",{algorithm:this.config.hash,name:e.name,size:e.size,value:this.hash.digest()}))}),s()}}t.Sender=d;class p extends r.EventEmitter{constructor(e={}){super(),this.config={hash:"sha-1",...e},this.receiveBuffer=[],this.received=0,this.channel=void 0,this.hash=s.createHash(this.config.hash)}receive(e,t){this.metadata=e,this.channel=t,this.channel.binaryType="arraybuffer",this.channel.onmessage=e=>{const t=e.data.byteLength;this.received+=t,this.receiveBuffer.push(e.data),e.data&&this.hash.update(new Uint8Array(e.data)),this.emit("progress",this.received,this.metadata.size,e.data),this.received===this.metadata.size?(this.metadata.actualhash=this.hash.digest("hex"),this.emit("receivedFile",new Blob(this.receiveBuffer),this.metadata),this.receiveBuffer=[]):this.received>this.metadata.size&&(console.error("received more than expected, discarding..."),this.receiveBuffer=[])}}}t.Receiver=p;class h extends c.default{constructor(e){super(e),this.sender=void 0,this.receiver=void 0,this.file=void 0}async start(e,t){if(t=t||(()=>{}),!e||"function"==typeof e)throw new Error("File object required");this.state="pending",this.role="initiator",this.file=e,this.sender=new d,this.sender.on("progress",(e,t)=>{this._log("info","Send progress "+e+"/"+t)}),this.sender.on("sentFile",e=>{this._log("info","Sent file",e.name),this.send(o.JingleAction.SessionInfo,{info:{creator:o.JingleSessionRole.Initiator,file:{hashes:[{algorithm:e.algorithm,value:e.value}]},infoType:o.JINGLE_INFO_CHECKSUM_5,name:this.contentName}}),this.parent.emit("sentFile",this,e)}),this.channel=this.pc.createDataChannel("filetransfer",{ordered:!0}),this.channel.onopen=()=>{this.sender.send(this.file,this.channel)};try{await this.processLocal(o.JingleAction.SessionInitiate,async()=>{const t=await this.pc.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1}),n=(0,u.importFromSDP)(t.sdp),i=(0,l.convertIntermediateToRequest)(n,this.role,this.transportType);this.contentName=i.contents[0].name,i.sid=this.sid,i.action=o.JingleAction.SessionInitiate,i.contents[0].application={applicationType:a.NS_JINGLE_FILE_TRANSFER_5,file:{date:e.lastModified?new Date(e.lastModified):void 0,hashesUsed:[{algorithm:"sha-1"}],name:e.name,size:e.size}},this.send("session-initiate",i),await this.pc.setLocalDescription(t)}),t()}catch(e){return this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}async accept(e){this._log("info","Accepted incoming session"),this.role="responder",this.state="active",e=e||(()=>{});try{await this.processLocal(o.JingleAction.SessionAccept,async()=>{const e=await this.pc.createAnswer(),t=(0,u.importFromSDP)(e.sdp),n=(0,l.convertIntermediateToRequest)(t,this.role,this.transportType);n.sid=this.sid,n.action="session-accept";for(const e of n.contents)e.creator="initiator";this.contentName=n.contents[0].name,this.send("session-accept",n),await this.pc.setLocalDescription(e),await this.processBufferedCandidates()}),e()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}async onSessionInitiate(e,t){this._log("info","Initiating incoming session"),this.role="responder",this.state="pending",this.transportType=e.contents[0].transport.transportType;const n=(0,l.convertRequestToIntermediate)(e,this.peerRole),i=(0,u.exportToSDP)(n),r=e.contents[0].application,s=r.file.hashesUsed?r.file.hashesUsed:r.file.hashes||[];this.receiver=new p({hash:s[0]&&s[0].algorithm}),this.receiver.on("progress",(e,t)=>{this._log("info","Receive progress "+e+"/"+t)}),this.receiver.on("receivedFile",e=>{this.receivedFile=e,this._maybeReceivedFile()}),this.receiver.metadata=r.file,this.pc.addEventListener("datachannel",e=>{this.channel=e.channel,this.receiver.receive(this.receiver.metadata,e.channel)});try{await this.pc.setRemoteDescription({type:"offer",sdp:i}),await this.processBufferedCandidates(),t()}catch(e){this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}onSessionInfo(e,t){const n=e.info;n&&n.file&&n.file.hashes&&(this.receiver.metadata.hashes=n.file.hashes,this.receiver.metadata.actualhash&&this._maybeReceivedFile(),t())}_maybeReceivedFile(){if(this.receiver.metadata.hashes&&this.receiver.metadata.hashes.length){for(const e of this.receiver.metadata.hashes||[])if(e.value&&e.value.toString("hex")===this.receiver.metadata.actualhash)return this._log("info","File hash matches"),this.parent.emit("receivedFile",this,this.receivedFile,this.receiver.metadata),void this.end("success");this._log("error","File hash does not match"),this.end("media-error")}}}t.default=h},function(e,t,n){"use strict";const i={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},i.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},i.getDescription=function(e){const t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){const t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter(e=>0===e.indexOf(t))},i.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},i.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},i.parseIceOptions=function(e){return e.substring(14).split(" ")},i.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},i.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},i.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},i.parseFmtp=function(e){const t={};let n;const i=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)n=i[e].trim().split("="),t[n[0].trim()]=n[1];return t},i.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)}),t+="a=fmtp:"+n+" "+i.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},i.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(n.attribute=e.substring(t+1,i),n.value=e.substring(i+1)):n.attribute=e.substring(t+1),n},i.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},i.getMid=function(e){const t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substring(6)},i.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},i.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},i.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?i.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},i.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},i.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},i.getCryptoParameters=function(e,t){return i.matchPrefix(e+t,"a=crypto:").map(i.parseCryptoLine)},i.getIceParameters=function(e,t){const n=i.matchPrefix(e+t,"a=ice-ufrag:")[0],r=i.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&r?{usernameFragment:n.substring(12),password:r.substring(10)}:null},i.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},i.parseRtpParameters=function(e){const t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=i.splitLines(e)[0].split(" ");t.profile=n[2];for(let r=3;r<n.length;r++){const s=n[r],o=i.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(o){const n=i.parseRtpMap(o),r=i.matchPrefix(e,"a=fmtp:"+s+" ");switch(n.parameters=r.length?i.parseFmtp(r[0]):{},n.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(i.parseRtcpFb),t.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(n.name.toUpperCase())}}}i.matchPrefix(e,"a=extmap:").forEach(e=>{t.headerExtensions.push(i.parseExtmap(e))});const r=i.matchPrefix(e,"a=rtcp-fb:* ").map(i.parseRtcpFb);return t.codecs.forEach(e=>{r.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),t},i.writeRtpDescription=function(e,t){let n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" "+(t.profile||"UDP/TLS/RTP/SAVPF")+" ",n+=t.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(e=>{n+=i.writeRtpMap(e),n+=i.writeFmtp(e),n+=i.writeRtcpFb(e)});let r=0;return t.codecs.forEach(e=>{e.maxptime>r&&(r=e.maxptime)}),r>0&&(n+="a=maxptime:"+r+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach(e=>{n+=i.writeExtmap(e)}),n},i.parseRtpEncodingParameters=function(e){const t=[],n=i.parseRtpParameters(e),r=-1!==n.fecMechanisms.indexOf("RED"),s=-1!==n.fecMechanisms.indexOf("ULPFEC"),o=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),a=o.length>0&&o[0].ssrc;let c;const u=i.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),n.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let n={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(n.rtx={ssrc:c}),t.push(n),r&&(n=JSON.parse(JSON.stringify(n)),n.fec={ssrc:a,mechanism:s?"red+ulpfec":"red"},t.push(n))}}),0===t.length&&a&&t.push({ssrc:a});let l=i.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substring(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substring(5),10)*.95-16e3:void 0,t.forEach(e=>{e.maxBitrate=l})),t},i.parseRtcpParameters=function(e){const t={},n=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);const r=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=r.length>0,t.compound=0===r.length;const s=i.matchPrefix(e,"a=rtcp-mux");return t.mux=s.length>0,t},i.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},i.parseMsid=function(e){let t;const n=i.matchPrefix(e,"a=msid:");if(1===n.length)return t=n[0].substring(7).split(" "),{stream:t[0],track:t[1]};const r=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return r.length>0?(t=r[0].value.split(" "),{stream:t[0],track:t[1]}):void 0},i.parseSctpDescription=function(e){const t=i.parseMLine(e),n=i.matchPrefix(e,"a=max-message-size:");let r;n.length>0&&(r=parseInt(n[0].substring(19),10)),isNaN(r)&&(r=65536);const s=i.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:t.fmt,maxMessageSize:r};const o=i.matchPrefix(e,"a=sctpmap:");if(o.length>0){const e=o[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:r}}},i.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,22)},i.writeSessionBoilerplate=function(e,t,n){let r;const s=void 0!==t?t:2;r=e||i.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+r+" "+s+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.getDirection=function(e,t){const n=i.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2)}return t?i.getDirection(t):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substring(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){const t=i.splitLines(e)[0].substring(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},i.parseOLine=function(e){const t=i.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const t=i.splitLines(e);for(let e=0;e<t.length;e++)if(t[e].length<2||"="!==t[e].charAt(1))return!1;return!0},e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=(0,i.__importDefault)(n(40)),o=n(26),a=n(41);function c(e){const t=e.application;if(t.streams&&t.streams.length&&t.sources&&t.sources.length){const e=t.streams[0];t.sources[0].parameters.msid=`${e.id} ${e.track}`,t.sourceGroups&&t.sourceGroups.length>0&&t.sources.push({parameters:{cname:t.sources[0].parameters.cname,msid:`${e.id} ${e.track}`},ssrc:t.sourceGroups[0].sources[1]})}}class u extends s.default{constructor(e){if(super(e),this.includesAudio=!1,this.includesVideo=!1,this._ringing=!1,this.pc.addEventListener("track",e=>{this.onAddTrack(e.track,e.streams[0])}),e.stream)for(const t of e.stream.getTracks())this.addTrack(t,e.stream)}get ringing(){return this._ringing}set ringing(e){e!==this._ringing&&(this._ringing=e)}get streams(){return"closed"!==this.pc.signalingState?this.pc.getRemoteStreams():[]}async start(e,t){this.state="pending",1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this.role="initiator",this.offerOptions=e;try{await this.processLocal(r.JingleAction.SessionInitiate,async()=>{const t=await this.pc.createOffer(e),n=(0,o.importFromSDP)(t.sdp),i=(0,a.convertIntermediateToRequest)(n,this.role,this.transportType);i.sid=this.sid,i.action=r.JingleAction.SessionInitiate;for(const e of i.contents||[])e.creator="initiator",c(e);await this.pc.setLocalDescription(t),this.send("session-initiate",i)}),t()}catch(e){this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}async accept(e,t){1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this._log("info","Accepted incoming session"),this.state="active",this.role="responder";try{await this.processLocal(r.JingleAction.SessionAccept,async()=>{const t=await this.pc.createAnswer(e),n=(0,o.importFromSDP)(t.sdp),i=(0,a.convertIntermediateToRequest)(n,this.role,this.transportType);i.sid=this.sid,i.action=r.JingleAction.SessionAccept;for(const e of i.contents||[])e.creator="initiator";await this.pc.setLocalDescription(t),await this.processBufferedCandidates(),this.send("session-accept",i)}),t()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}end(e="success",t=!1){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.end(e,t)}ring(){return this.processLocal("ring",async()=>{this._log("info","Ringing on incoming session"),this.ringing=!0,this.send(r.JingleAction.SessionInfo,{info:{infoType:r.JINGLE_INFO_RINGING}})})}mute(e,t){return this.processLocal("mute",async()=>{this._log("info","Muting",t),this.send(r.JingleAction.SessionInfo,{info:{creator:e,infoType:r.JINGLE_INFO_MUTE,name:t}})})}unmute(e,t){return this.processLocal("unmute",async()=>{this._log("info","Unmuting",t),this.send(r.JingleAction.SessionInfo,{info:{creator:e,infoType:r.JINGLE_INFO_UNMUTE,name:t}})})}hold(){return this.processLocal("hold",async()=>{this._log("info","Placing on hold"),this.send("session-info",{info:{infoType:r.JINGLE_INFO_HOLD}})})}resume(){return this.processLocal("resume",async()=>{this._log("info","Resuming from hold"),this.send("session-info",{info:{infoType:r.JINGLE_INFO_ACTIVE}})})}addTrack(e,t,n){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",async()=>{this.pc.addTrack?this.pc.addTrack(e,t):this.pc.addStream(t),n&&n()})}async removeTrack(e,t){return this.processLocal("removetrack",async()=>{if(this.pc.removeTrack(e),t)return t()})}onAddTrack(e,t){this._log("info","Track added"),this.parent.emit("peerTrackAdded",this,e,t)}onRemoveTrack(e){this._log("info","Track removed"),this.parent.emit("peerTrackRemoved",this,e)}async onSessionInitiate(e,t){this._log("info","Initiating incoming session"),this.state="pending",this.role="responder",this.transportType=e.contents[0].transport.transportType;const n=(0,a.convertRequestToIntermediate)(e,this.peerRole);for(const e of n.media)"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),e.streams||(e.streams=[{stream:"legacy",track:e.kind}]);const i=(0,o.exportToSDP)(n);try{return await this.pc.setRemoteDescription({type:"offer",sdp:i}),await this.processBufferedCandidates(),t()}catch(e){return this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}onSessionTerminate(e,t){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.onSessionTerminate(e,t)}onSessionInfo(e,t){const n=e.info||{infoType:""};switch(n.infoType){case r.JINGLE_INFO_RINGING:return this._log("info","Outgoing session is ringing"),this.ringing=!0,this.parent.emit("ringing",this),t();case r.JINGLE_INFO_HOLD:return this._log("info","On hold"),this.parent.emit("hold",this),t();case r.JINGLE_INFO_UNHOLD:case r.JINGLE_INFO_ACTIVE:return this._log("info","Resuming from hold"),this.parent.emit("resumed",this),t();case r.JINGLE_INFO_MUTE:return this._log("info","Muting",n),this.parent.emit("mute",this,n),t();case r.JINGLE_INFO_UNMUTE:return this._log("info","Unmuting",n),this.parent.emit("unmute",this,n),t()}return t()}}t.default=u},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)},a=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var u,l=n(6);o(n(214),t);var d=function(e){function t(t,n){void 0===n&&(n={});var i=e.call(this)||this;return i.peerConnection=t,i.haveConnectionMetrics=!1,i.statsArr=[],u="undefined"!=typeof window,i.session=n.session,i.initiator=n.initiator,i.conference=n.conference,i.statsInterval=1e3*(n.interval||5),i.logger=n.logger||console,["new","checking"].includes(t.iceConnectionState)&&("checking"===t.iceConnectionState&&(i.logger.warn("iceConnectionState is already in checking state so ice connect time may not be accurate"),i.handleIceStateChange()),t.addEventListener("iceconnectionstatechange",i.handleIceStateChange.bind(i))),t.addEventListener("connectionstatechange",i.handleConnectionStateChange.bind(i)),"connected"===t.connectionState&&i.pollForStats(),i}return r(t,e),t.prototype.handleIceStateChange=function(){var e=this,t=this.peerConnection.iceConnectionState;if("checking"===t&&u&&(this.iceStartTime=window.performance.now()),"connected"===t){if(this.haveConnectionMetrics)return;this.haveConnectionMetrics=!0;var n=void 0,i=void 0,r=void 0;u&&(this.iceConnectionTime=window.performance.now()-this.iceStartTime,n=window.navigator.userAgent,i=window.navigator.platform,r=window.navigator.hardwareConcurrency);var s={name:"connect",userAgent:n,platform:i,cores:r,session:this.session,conference:this.conference,connectTime:this.iceConnectionTime};return this.waitForSelectedCandidatePair().then((function(t){e.gatherSelectedCandidateInfo(t,s),e.emit("stats",s)}))}if("failed"===t)return u&&(this.iceFailedTime=window.performance.now()-this.iceStartTime),this.gatherStats().then((function(t){var n={name:"failure",session:e.session,initiator:e.initiator,conference:e.conference,failTime:e.iceFailedTime,iceRW:0,numLocalHostCandidates:0,numLocalSrflxCandidates:0,numLocalRelayCandidates:0,numRemoteHostCandidates:0,numRemoteSrflxCandidates:0,numRemoteRelayCandidates:0},i=e.peerConnection.localDescription.sdp.split("\r\n").filter((function(e){return e.indexOf("a=candidate:")>-1})),r=e.peerConnection.remoteDescription.sdp.split("\r\n").filter((function(e){return e.indexOf("a=candidate:")>-1}));["Host","Srflx","Relay"].forEach((function(e){n["numLocal"+e+"Candidates"]=i.filter((function(t){return t.split(" ")[7]===e.toLowerCase()})).length,n["numRemote"+e+"Candidates"]=r.filter((function(t){return t.split(" ")[7]===e.toLowerCase()})).length})),e.emit("stats",n)}))},t.prototype.waitForSelectedCandidatePair=function(e,t){var n=this;return void 0===e&&(e=300),void 0===t&&(t=1),this.gatherStats().then((function(i){return n.getSelectedCandidatePair(i)?i:t>3?Promise.reject(new Error("Max wait attempts for connected candidate info reached")):new Promise((function(i,r){setTimeout((function(){return n.waitForSelectedCandidatePair(e,t+1).then(i,r)}),e)}))}))},t.prototype.getSelectedCandidatePair=function(e){var t=null;return e.forEach((function(e){var n=e.value;"candidate-pair"===n.type&&n.nominated&&"succeeded"===n.state&&(t=n)})),t},t.prototype.gatherSelectedCandidateInfo=function(e,t){var n=this.getSelectedCandidatePair(e);if(n){var i,r,s=n.localCandidateId,o=n.remoteCandidateId;if(e.forEach((function(e){e.key;var n=e.value;s&&"local-candidate"===n.type&&n.id===s&&(i=n,t.localCandidateType=n.candidateType),o&&"remote-candidate"===n.type&&n.id===o&&(r=n,t.remoteCandidateType=n.candidateType)})),i&&r&&(t.candidatePair=i.candidateType+";"+r.candidateType,t.candidatePairDetails={local:i,remote:r,pair:n}),i){if(t.transport=i.transport||i.protocol,i.priority){var a=parseInt(i.priority,10);t.turnType={2:"udp",1:"tcp",0:"tls"}[a>>24],t.networkType=i.networkType}t.usingIPv6=i.ipAddress&&0===i.ipAddress.indexOf("[")}}},t.prototype.handleConnectionStateChange=function(){return a(this,void 0,void 0,(function(){var e,t=this;return c(this,(function(n){if("connected"===(e=this.peerConnection.connectionState))this.pollForStats();else{if("disconnected"===e)return"stable"!==this.peerConnection.signalingState?[2]:[2,this.gatherStats().then((function(e){var n=t.createStatsReport(e);n.type="disconnected",t.emit("stats",n)}))];"closed"===e&&this.pollingInterval&&(u&&window.clearInterval(this.pollingInterval),this.pollingInterval=null)}return[2]}))}))},t.prototype.pollForStats=function(){var e=this;if(!this.pollingInterval){var t=function(){return e.gatherStats().then((function(t){var n=e.createStatsReport(t,!0);(n.tracks.length>0||n.remoteTracks.length>0)&&e.checkBitrate(n)&&e.emit("stats",n)}))};u&&(window.setTimeout(t,0),this.pollingInterval=window.setInterval(t,this.statsInterval))}},t.prototype.checkBitrate=function(e){var t;return e.remoteTracks.length&&0!==(null===(t=e.remoteTracks[0])||void 0===t?void 0:t.bitrate)?(this.statsArr=[],!0):!(this.statsArr.length>=5)&&(this.statsArr.push(e),!0)},t.prototype.polyFillStats=function(e){if(!e)return[];if(Array.isArray(e))return e;var t=[];if(this.isNativeStatsReport(e))e.forEach((function(e,n){t.push({key:n,value:e})}));else{if(!(Object.keys(e).length>0))return this.logger.warn("Unknown stats results format, returning unmodified",e),[];Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})}))}return t},t.prototype.isNativeStatsReport=function(e){return void 0!==window.RTCStatsReport&&e instanceof window.RTCStatsReport},t.prototype.gatherStats=function(){return a(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.peerConnection.getStats(null).then(this.polyFillStats.bind(this))];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.logger.error("Failed to gather stats. Are you using RTCPeerConnection as your connection? {expect peerconnection.getStats}",{peerConnection:this.peerConnection,err:e}),[2,Promise.reject(e)];case 3:return[2]}}))}))},t.prototype.createStatsReport=function(e,t){var n=this;void 0===t&&(t=!0);var i={name:"getStats",session:this.session,initiator:this.initiator,conference:this.conference,tracks:[],remoteTracks:[]};e.filter((function(e){return["inbound-rtp","outbound-rtp"].indexOf(e.value.type)>-1})).forEach((function(t){n.processSource({source:t.value,event:i,results:e})}));var r=e.find((function(e){return"candidate-pair"===e.value.type&&"succeeded"===e.value.state&&!0===e.value.nominated}));return r&&this.processSelectedCandidatePair({report:r.value,event:i,results:e}),t&&(this.lastResult=e),i},t.prototype.processSource=function(e){var t,n,i,r,s,o,a,c=e.source,u=e.results,l=e.event,d=new Date(c.timestamp),h=this.lastResult&&this.lastResult.find((function(e){return e.key===c.id}));(h=h&&h.value)&&(t=(t=this.lastResult&&this.lastResult.find((function(e){return e.value.localId===h.id})))&&t.value),u.forEach((function(e){e.value.localId===c.id?n=e.value:e.key===c.transportId?i=e.value:e.key===c.trackId?s=e.value:e.key===c.mediaSourceId?o=e.value:e.key===c.codecId&&(a=e.value)})),i&&(r=(r=u.find((function(e){return e.key===i.selectedCandidatePairId})))&&r.value),r&&(l.candidatePairHadActiveSource=!0);var f=c.kind||c.mediaType,m="outbound-rtp"===c.type,g={track:s&&s.trackIdentifier,kind:f,jitter:p("jitter",c,n),roundTripTime:p("roundTripTime",c,n),packetsLost:p("packetsLost",c,n)||0,packetLoss:0,bytes:parseInt(m?c.bytesSent:c.bytesReceived,10)||0};if(a&&(g.codec=a.payloadType+" "+a.mimeType+" "+a.clockRate),h){var y=parseInt(m?h.bytesSent:h.bytesReceived,10)||0,b=d.getTime()-new Date(h.timestamp).getTime();g.bitrate=Math.floor(8*(g.bytes-y)/b)}var _=p("packetsLost",h,t);m?(g.packetsSent=c.packetsSent,g.packetLoss=g.packetsLost/(g.packetsSent||1)*100,h&&(g.intervalPacketsSent=g.packetsSent-(h.packetsSent||0),g.intervalPacketsLost=g.packetsLost-(_||0),g.intervalPacketLoss=g.intervalPacketsLost/(g.intervalPacketsSent||1)*100),g.retransmittedBytesSent=c.retransmittedBytesSent,g.retransmittedPacketsSent=c.retransmittedPacketsSent):(g.packetsReceived=c.packetsReceived,g.packetLoss=g.packetsLost/(g.packetsReceived||1)*100,h&&(g.intervalPacketsReceived=g.packetsReceived-h.packetsReceived,g.intervalPacketsLost=g.packetsLost-_,g.intervalPacketLoss=g.intervalPacketsLost/(g.intervalPacketsReceived||1)*100)),s&&"audio"===f&&(s.remoteSource?(g.audioLevel=s.audioLevel,g.totalAudioEnergy=s.totalAudioEnergy):(g.echoReturnLoss=s.echoReturnLoss,g.echoReturnLossEnhancement=s.echoReturnLossEnhancement)),"audio"!==f||!o||s&&s.remoteSource||(g.audioLevel=o.audioLevel,g.totalAudioEnergy=o.totalAudioEnergy),Object.keys(g).forEach((function(e){return void 0===g[e]&&delete g[e]})),m?l.tracks.push(g):l.remoteTracks.push(g)},t.prototype.processSelectedCandidatePair=function(e){var t=this,n=e.report,i=e.event,r=e.results,s=n.localCandidateId,o=n.remoteCandidateId;i.localCandidateChanged=!!this.lastActiveLocalCandidate&&s!==this.lastActiveLocalCandidate.id,i.remoteCandidateChanged=!!this.lastActiveRemoteCandidate&&o!==this.lastActiveRemoteCandidate.id,(!this.lastActiveLocalCandidate||i.localCandidateChanged||i.remoteCandidateChanged)&&r.forEach((function(e){t.checkLastActiveCandidate({localId:s,remoteId:o,key:e.key,report:e.value})})),this.lastActiveLocalCandidate&&(i.networkType=this.lastActiveLocalCandidate.networkType,this.lastActiveRemoteCandidate&&(i.candidatePair=this.lastActiveLocalCandidate.candidateType+";"+this.lastActiveRemoteCandidate.candidateType)),i.bytesSent=n.bytesSent,i.bytesReceived=n.bytesReceived,i.requestsReceived=n.requestsReceived,i.requestsSent=n.requestsSent,i.responsesReceived=n.responsesReceived,i.responsesSent=n.responsesSent,i.consentRequestsSent=n.consentRequestsSent,i.totalRoundTripTime=n.totalRoundTripTime},t.prototype.checkLastActiveCandidate=function(e){var t=e.localId,n=e.remoteId,i=(e.key,e.report);t&&"local-candidate"===i.type&&i.id===t&&(this.lastActiveLocalCandidate=i),n&&"remote-candidate"===i.type&&i.id===n&&(this.lastActiveRemoteCandidate=i)},t}(l.EventEmitter);function p(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=t.find((function(t){return t&&(t[e]||0===t[e])}));return i&&i[e]}t.default=d},function(e,t,n){"use strict";n.r(t),n.d(t,"Axios",(function(){return r})),n.d(t,"AxiosError",(function(){return s})),n.d(t,"CanceledError",(function(){return o})),n.d(t,"isCancel",(function(){return a})),n.d(t,"CancelToken",(function(){return c})),n.d(t,"VERSION",(function(){return u})),n.d(t,"all",(function(){return l})),n.d(t,"Cancel",(function(){return d})),n.d(t,"isAxiosError",(function(){return p})),n.d(t,"spread",(function(){return h})),n.d(t,"toFormData",(function(){return f})),n.d(t,"AxiosHeaders",(function(){return m})),n.d(t,"HttpStatusCode",(function(){return g})),n.d(t,"formToJSON",(function(){return y})),n.d(t,"getAdapter",(function(){return b})),n.d(t,"mergeConfig",(function(){return _}));var i=n(50);n.d(t,"default",(function(){return i.a}));const{Axios:r,AxiosError:s,CanceledError:o,isCancel:a,CancelToken:c,VERSION:u,all:l,Cancel:d,isAxiosError:p,spread:h,toFormData:f,AxiosHeaders:m,HttpStatusCode:g,formToJSON:y,getAdapter:b,mergeConfig:_}=i.a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),r=Math.pow(2,32),s=(e,t)=>(e%t+t)%t;class o extends i.EventEmitter{constructor(){super(),this.allowResume=!0,this.lastAck=0,this.handled=0,this.unacked=[],this.inboundStarted=!1,this.outboundStarted=!1,this.id=void 0,this.jid=void 0,this.allowResume=!0,this.started=!1,this.cacheHandler=()=>{},this._reset()}get started(){return this.outboundStarted&&this.inboundStarted}set started(e){e||(this.outboundStarted=!1,this.inboundStarted=!1)}get resumable(){return this.started&&this.allowResume}load(e){var t;this.id=e.id,this.allowResume=null===(t=e.allowResume)||void 0===t||t,this.handled=e.handled,this.lastAck=e.lastAck,this.unacked=e.unacked,this.emit("prebound",e.jid)}cache(e){this.cacheHandler=e}async bind(e){this.jid=e,await this._cache()}async enable(){this.emit("send",{allowResumption:this.allowResume,type:"enable"})}async resume(){this.emit("send",{handled:this.handled,previousSession:this.id,type:"resume"})}async enabled(e){this.id=e.id,this.allowResume=e.resume||!1,this.handled=0,this.inboundStarted=!0,await this._cache()}async resumed(e){this.id=e.previousSession,this.inboundStarted=!0,await this.process(e,!0),await this._cache()}async failed(e){await this.process(e);for(const[e,t]of this.unacked)this.emit("failed",{kind:e,stanza:t});this._reset(),await this._cache()}ack(){this.emit("send",{handled:this.handled,type:"ack"})}request(){this.emit("send",{type:"request"})}async process(e,t=!1){if(void 0===e.handled)return;const n=s(e.handled-this.lastAck,r);for(let e=0;e<n&&this.unacked.length>0;e++){const[e,t]=this.unacked.shift();this.emit("acked",{kind:e,stanza:t})}if(this.lastAck=e.handled,t){const e=this.unacked;if(this.unacked=[],e.length){this.emit("begin-resend");for(const[t,n]of e)this.emit("resend",{kind:t,stanza:n});this.emit("end-resend")}}await this._cache()}async track(e,t){const n="enable"===t.type;return"sm"!==e||!n&&"resume"!==t.type?!!this.outboundStarted&&(("message"===e||"presence"===e||"iq"===e)&&(this.unacked.push([e,t]),await this._cache(),!0)):(n&&(this.handled=0),this.outboundStarted=!0,await this._cache(),!1)}async handle(){this.inboundStarted&&(this.handled=s(this.handled+1,r),await this._cache())}async hibernate(){if(!this.resumable)return this.shutdown();for(const[e,t]of this.unacked)this.emit("hibernated",{kind:e,stanza:t})}async shutdown(){return this.failed({type:"failed"})}async _cache(){try{await this.cacheHandler({allowResume:this.allowResume,handled:this.handled,id:this.id,jid:this.jid,lastAck:this.lastAck,unacked:this.unacked})}catch(e){console.error("Failed to cache stream state",e)}}_reset(){this.id="",this.inboundStarted=!1,this.outboundStarted=!1,this.lastAck=0,this.handled=0,this.unacked=[]}}t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SCRAM=t.DIGEST=t.OAUTH=t.PLAIN=t.EXTERNAL=t.ANONYMOUS=t.Hi=t.HMAC=t.H=t.XOR=t.createClientNonce=t.Factory=t.SimpleMech=void 0;const i=n(7),r=n(54);class s{constructor(e){this.authenticated=!1,this.mutuallyAuthenticated=!1,this.name=e}getCacheableCredentials(){return null}processChallenge(e){}processSuccess(e){this.authenticated=!0}finalize(){const e={authenticated:this.authenticated,mutuallyAuthenticated:this.mutuallyAuthenticated};return this.errorData&&(e.errorData=this.errorData),e}}t.SimpleMech=s;function o(e=32){return(0,i.randomBytes)(e).toString("hex")}function a(e,t){const n=[];for(let i=0;i<e.length;i++)n.push(e[i]^t[i]);return i.Buffer.from(n)}function c(e,t){return(0,i.createHash)(t).update(e).digest()}function u(e,t,n){return(0,i.createHmac)(n,e).update(t).digest()}function l(e,t,n,r){let s=u(e,i.Buffer.concat([t,i.Buffer.from("00000001","hex")]),r),o=s;for(let t=0;t<n-1;t++)s=u(e,s,r),o=a(o,s);return o}function d(e){const t={},n=e.toString().split(/,(?=(?:[^"]|"[^"]*")*$)/);for(let e=0,i=n.length;e<i;e++){const i=/(\w+)=["]?([^"]+)["]?$/.exec(n[e]);i&&(t[i[1]]=i[2])}return t}function p(e){const t=[];for(const n of e)","===n?t.push("=2C"):"="===n?t.push("=3D"):t.push(n);return t.join("")}t.Factory=class{constructor(){this.mechanisms=[]}register(e,t,n){this.mechanisms.push({constructor:t,name:e.toUpperCase(),priority:n}),this.mechanisms.sort((e,t)=>t.priority-e.priority)}disable(e){const t=e.toUpperCase();this.mechanisms=this.mechanisms.filter(e=>e.name!==t)}createMechanism(e){const t=e.map(e=>e.toUpperCase());for(const e of this.mechanisms)for(const n of t)if(n===e.name)return new e.constructor(e.name);return null}},t.createClientNonce=o,t.XOR=a,t.H=c,t.HMAC=u,t.Hi=l;t.ANONYMOUS=class extends s{getExpectedCredentials(){return{optional:["trace"],required:[]}}createResponse(e){return i.Buffer.from(e.trace||"")}};t.EXTERNAL=class extends s{getExpectedCredentials(){return{optional:["authzid"],required:[]}}createResponse(e){return i.Buffer.from(e.authzid||"")}};t.PLAIN=class extends s{getExpectedCredentials(){return{optional:["authzid"],required:["username","password"]}}createResponse(e){return i.Buffer.from((e.authzid||"")+"\0"+e.username+"\0"+(e.password||e.token))}};t.OAUTH=class extends s{constructor(e){super(e),this.failed=!1,this.name=e}getExpectedCredentials(){return{optional:["authzid"],required:["token"]}}createResponse(e){if(this.failed)return i.Buffer.from("");const t=`n,${p((0,r.saslprep)(e.authzid))},`,n=`auth=Bearer ${e.token}`;return i.Buffer.from(t+""+n+"","utf8")}processChallenge(e){this.failed=!0,this.errorData=JSON.parse(e.toString("utf8"))}};t.DIGEST=class extends s{constructor(e){super(e),this.providesMutualAuthentication=!1,this.state="INITIAL",this.name=e}processChallenge(e){this.state="CHALLENGE";const t=d(e);this.authenticated=!!t.rspauth,this.realm=t.realm,this.nonce=t.nonce,this.charset=t.charset}getExpectedCredentials(){return{optional:["authzid","clientNonce","realm"],required:["host","password","serviceName","serviceType","username"]}}createResponse(e){if("INITIAL"===this.state||this.authenticated)return null;let t=e.serviceType+"/"+e.host;e.serviceName&&e.host!==e.serviceName&&(t+="/"+e.serviceName);const n=e.realm||this.realm||"",r=e.clientNonce||o(16),s="00000001";let a="";a+='username="'+e.username+'"',n&&(a+=',realm="'+n+'"'),a+=',nonce="'+this.nonce+'"',a+=',cnonce="'+r+'"',a+=",nc="+s,a+=",qop=auth",a+=',digest-uri="'+t+'"';const c=(0,i.createHash)("md5").update(e.username).update(":").update(n).update(":").update(e.password).digest(),u=(0,i.createHash)("md5").update(c).update(":").update(this.nonce).update(":").update(r);e.authzid&&u.update(":").update(e.authzid);const l=u.digest("hex"),d=(0,i.createHash)("md5").update("AUTHENTICATE:").update(t).digest("hex");return a+=",response="+(0,i.createHash)("md5").update(l).update(":").update(this.nonce).update(":").update(s).update(":").update(r).update(":").update("auth").update(":").update(d).digest("hex"),"utf-8"===this.charset&&(a+=",charset=utf-8"),e.authzid&&(a+=',authzid="'+e.authzid+'"'),i.Buffer.from(a)}};t.SCRAM=class{constructor(e){this.providesMutualAuthentication=!0,this.name=e,this.state="INITIAL",this.useChannelBinding=this.name.toLowerCase().endsWith("-plus"),this.algorithm=this.name.toLowerCase().split("scram-")[1].split("-plus")[0]}getExpectedCredentials(){const e=["username","password"];return this.useChannelBinding&&e.push("tlsUnique"),{optional:["authzid","clientNonce"],required:e}}getCacheableCredentials(){return this.cache}createResponse(e){return"INITIAL"===this.state?this.initialResponse(e):this.challengeResponse(e)}processChallenge(e){const t=d(e);this.salt=i.Buffer.from(t.s||"","base64"),this.iterationCount=parseInt(t.i,10),this.nonce=t.r,this.verifier=t.v,this.error=t.e,this.challenge=e}processSuccess(e){this.processChallenge(e)}finalize(){return this.verifier?this.serverSignature.toString("base64")!==this.verifier?{authenticated:!1,error:"Mutual authentication failed",mutuallyAuthenticated:!1}:{authenticated:!0,mutuallyAuthenticated:!0}:{authenticated:!1,error:this.error,mutuallyAuthenticated:!1}}initialResponse(e){const t=p((0,r.saslprep)(e.authzid)),n=p((0,r.saslprep)(e.username));this.clientNonce=e.clientNonce||o();let s="n";e.tlsUnique&&(s=this.useChannelBinding?"p=tls-unique":"y"),this.gs2Header=i.Buffer.from(t?`${s},a=${t},`:s+",,"),this.clientFirstMessageBare=i.Buffer.from(`n=${n},r=${this.clientNonce}`);const a=i.Buffer.concat([this.gs2Header,this.clientFirstMessageBare]);return this.state="CHALLENGE",a}challengeResponse(e){const t=i.Buffer.from("Client Key"),n=i.Buffer.from("Server Key"),s=i.Buffer.concat([this.gs2Header,e.tlsUnique||i.Buffer.from("")]).toString("base64"),o=i.Buffer.from(`c=${s},r=${this.nonce}`);let d,p,h;const f=e.salt&&0===i.Buffer.compare(e.salt,this.salt);f&&e.clientKey&&e.serverKey?(p=i.Buffer.from(e.clientKey),h=i.Buffer.from(e.serverKey)):f&&e.saltedPassword?(d=i.Buffer.from(e.saltedPassword),p=u(d,t,this.algorithm),h=u(d,n,this.algorithm)):(d=l(i.Buffer.from((0,r.saslprep)(e.password)),this.salt,this.iterationCount,this.algorithm),p=u(d,t,this.algorithm),h=u(d,n,this.algorithm));const m=c(p,this.algorithm),g=i.Buffer.from(","),y=i.Buffer.concat([this.clientFirstMessageBare,g,this.challenge,g,o]),b=a(p,u(m,y,this.algorithm)).toString("base64");this.serverSignature=u(h,y,this.algorithm);const _=i.Buffer.concat([o,i.Buffer.from(",p="+b)]);return this.state="FINAL",this.cache={clientKey:p,salt:this.salt,saltedPassword:d,serverKey:h},_}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.getAccountInfo=async t=>(await e.sendIQ({account:{},to:t,type:"get"})).account,e.updateAccount=(t,n)=>e.sendIQ({account:n,to:t,type:"set"}),e.deleteAccount=t=>e.sendIQ({account:{remove:!0},to:t,type:"set"}),e.getPrivateData=async t=>(await e.sendIQ({privateStorage:{[t]:{}},type:"get"})).privateStorage[t],e.setPrivateData=async(t,n)=>e.sendIQ({privateStorage:{[t]:n},type:"set"}),e.getVCard=async t=>(await e.sendIQ({to:t,type:"get",vcard:{format:i.NS_VCARD_TEMP}})).vcard,e.publishVCard=async t=>{await e.sendIQ({type:"set",vcard:t})},e.enableNotifications=(t,n,i=[])=>e.sendIQ({push:{action:"enable",form:{fields:[{name:"FORM_TYPE",type:"hidden",value:"http://jabber.org/protocol/pubsub#publish-options"},...i],type:"submit"},jid:t,node:n},type:"set"}),e.disableNotifications=(t,n)=>e.sendIQ({push:{action:"disable",jid:t,node:n},type:"set"})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_AVATAR_METADATA)),e.on("pubsub:published",t=>{if(t.pubsub.items.node!==i.NS_AVATAR_METADATA)return;const n=t.pubsub.items.published[0].content;e.emit("avatar",{avatars:n.versions||[],jid:t.from,source:"pubsub"})}),e.on("presence",t=>{t.vcardAvatar&&"string"==typeof t.vcardAvatar&&e.emit("avatar",{avatars:[{id:t.vcardAvatar}],jid:t.from,source:"vcard"})}),e.publishAvatar=(t,n)=>e.publish("",i.NS_AVATAR_DATA,{data:n,itemType:i.NS_AVATAR_DATA},t),e.useAvatars=(t,n=[])=>e.publish("",i.NS_AVATAR_METADATA,{itemType:i.NS_AVATAR_METADATA,pointers:n,versions:t},"current"),e.getAvatar=(t,n)=>e.getItem(t,i.NS_AVATAR_DATA,n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.registerFeature("bind",300,async(t,n)=>{try{const i=await e.sendIQ({bind:{resource:e.config.resource},type:"set"});e.features.negotiated.bind=!0,e.emit("session:prebind",i.bind.jid);const r=!t.legacySession||t.legacySession&&t.legacySession.optional;return!e.sessionStarted&&r&&e.emit("session:started",e.jid),n()}catch(e){return console.error(e),n("disconnect","JID binding failed")}}),e.registerFeature("legacySession",1e3,async(t,n)=>{if(e.sessionStarted||t.legacySession&&t.legacySession.optional)return e.features.negotiated.session=!0,n();try{return await e.sendIQ({legacySession:!0,type:"set"}),e.features.negotiated.session=!0,e.sessionStarted||(e.sessionStarted=!0,e.emit("session:started",e.jid)),n()}catch(e){return n("disconnect","Session requeset failed")}}),e.on("session:started",()=>{e.sessionStarted=!0}),e.on("session:prebind",t=>{e.jid=t,e.emit("session:bound",e.jid)}),e.on("--reset-stream-features",()=>{e.sessionStarted=!1,e.features.negotiated.bind=!1,e.features.negotiated.session=!1})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature(i.NS_ADHOC_COMMANDS),e.disco.addItem({name:"Ad-Hoc Commands",node:i.NS_ADHOC_COMMANDS}),e.getCommands=t=>e.getDiscoItems(t,i.NS_ADHOC_COMMANDS)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r=n(10);function s(e,t){e.features.negotiated.clientStateIndication&&e.send("csi",{type:t})}t.default=function(e){e.disco.addFeature(i.NS_PING),e.on("iq:get:ping",t=>{e.sendIQResult(t)}),e.on("--reset-stream-features",()=>{e._stopKeepAliveInterval(),e.features.negotiated.streamManagement=!1,e.features.negotiated.clientStateIndication=!1}),e.markActive=()=>s(e,"active"),e.markInactive=()=>s(e,"inactive"),e.ping=async t=>{await e.sendIQ({ping:!0,to:t,type:"get"})},e.enableKeepAlive=(t={})=>{e._keepAliveOptions=t;const n=t.interval||300,i=t.timeout||e.config.timeout||15;clearInterval(e._keepAliveInterval),e._keepAliveInterval=setInterval((async function(){if(e.sessionStarted)try{await(0,r.timeoutPromise)(async function(e){if(e.sm.started)return new Promise(t=>{e.once("stream:management:ack",()=>t()),e.sm.request()});try{await e.ping()}catch(e){if(e.error&&"timeout"!==e.error.condition)return;throw e}}(e),1e3*i)}catch(t){e.emit("stream:error",{condition:"connection-timeout",text:"Server did not respond in "+i+" seconds"}),e.transport&&(e.transport.hasStream=!1,e.transport.disconnect(!1))}}),1e3*n)},e._stopKeepAliveInterval=()=>{e._keepAliveInterval&&(clearInterval(e._keepAliveInterval),delete e._keepAliveInterval)},e.disableKeepAlive=()=>{delete e._keepAliveOptions,e._stopKeepAliveInterval()},e.on("stream:management:resumed",()=>{e._keepAliveOptions&&e.enableKeepAlive(e._keepAliveOptions)}),e.on("stream:start",()=>{e._keepAliveOptions&&e.enableKeepAlive(e._keepAliveOptions)});const t=async(t,n)=>{if(!e.config.useStreamManagement)return n();const i=async t=>{switch(t.type){case"enabled":return await e.sm.enabled(t),e.features.negotiated.streamManagement=!0,e.off("sm",i),n();case"resumed":return await e.sm.resumed(t),e.features.negotiated.streamManagement=!0,e.features.negotiated.bind=!0,e.sessionStarted=!0,e.sessionStarting=!1,e.off("sm",i),e.emit("stream:management:resumed",t),n("break");case"failed":await e.sm.failed(t),e.off("sm",i),e.emit("session:end"),n()}};e.on("sm",i),e.sm.id?e.sm.id&&e.sm.allowResume?await e.sm.resume():(e.off("sm",i),n()):e.features.negotiated.bind?await e.sm.enable():(e.off("sm",i),n())};e.registerFeature("streamManagement",200,t),e.registerFeature("streamManagement",500,t),e.registerFeature("clientStateIndication",400,(t,n)=>{e.features.negotiated.clientStateIndication=!0,n()})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=(0,i.__importDefault)(n(219)),s=(0,i.__importStar)(n(8)),o=n(1);t.default=function(e){e.disco=new r.default,e.disco.addFeature(o.NS_DISCO_INFO),e.disco.addFeature(o.NS_DISCO_ITEMS),e.disco.addIdentity({category:"client",type:"web"}),e.registerFeature("caps",100,(t,n)=>{const i=s.getDomain(e.jid)||e.config.server;e.emit("disco:caps",{caps:t.legacyCapabilities||[],jid:i}),e.features.negotiated.caps=!0,n()}),e.getDiscoInfo=async(t,n)=>({extensions:[],features:[],identities:[],...(await e.sendIQ({disco:{node:n,type:"info"},to:t,type:"get"})).disco}),e.getDiscoItems=async(t,n)=>({items:[],...(await e.sendIQ({disco:{node:n,type:"items"},to:t,type:"get"})).disco}),e.updateCaps=()=>{const t=e.config.capsNode||"https://stanzajs.org";return e.disco.updateCaps(t)},e.getCurrentCaps=()=>{const t=e.disco.getCaps();if(!t)return;const n=`${t[0].node}#${t[0].value}`;return{info:e.disco.getNodeInfo(n),legacyCapabilities:t}},e.on("presence",t=>{t.legacyCapabilities&&e.emit("disco:caps",{caps:t.legacyCapabilities,jid:t.from})}),e.on("iq:get:disco",t=>{const{type:n,node:i}=t.disco;"info"===n&&e.sendIQResult(t,{disco:{...e.disco.getNodeInfo(i||""),node:i,type:"info"}}),"items"===n&&e.sendIQResult(t,{disco:{items:e.disco.items.get(i||"")||[],type:"items"}})})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=n(1),o=(0,i.__importStar)(n(7));t.default=function(e){e.disco.addFeature("jid\\20escaping"),e.disco.addFeature(s.NS_DELAY),e.disco.addFeature(s.NS_EME_0),e.disco.addFeature(s.NS_FORWARD_0),e.disco.addFeature(s.NS_HASHES_2),e.disco.addFeature(s.NS_HASHES_1),e.disco.addFeature(s.NS_IDLE_1),e.disco.addFeature(s.NS_JSON_0),e.disco.addFeature(s.NS_OOB),e.disco.addFeature(s.NS_PSA),e.disco.addFeature(s.NS_REFERENCE_0),e.disco.addFeature(s.NS_SHIM),e.disco.addFeature(s.NS_DATAFORM),e.disco.addFeature(s.NS_DATAFORM_MEDIA),e.disco.addFeature(s.NS_DATAFORM_VALIDATION),e.disco.addFeature(s.NS_DATAFORM_LAYOUT);const t=o.getHashes();for(const n of t)e.disco.addFeature((0,s.NS_HASH_NAME)(n));e.disco.addFeature(s.NS_TIME),e.disco.addFeature(s.NS_VERSION),e.on("iq:get:softwareVersion",t=>e.sendIQResult(t,{softwareVersion:e.config.softwareVersion||{name:"stanzajs.org",version:r.VERSION}})),e.on("iq:get:time",t=>{const n=new Date;e.sendIQResult(t,{time:{tzo:n.getTimezoneOffset(),utc:n}})}),e.getSoftwareVersion=async t=>(await e.sendIQ({softwareVersion:{},to:t,type:"get"})).softwareVersion,e.getTime=async t=>(await e.sendIQ({time:{},to:t,type:"get"})).time,e.getLastActivity=async t=>(await e.sendIQ({lastActivity:{},to:t,type:"get"})).lastActivity}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.features={handlers:Object.create(null),negotiated:Object.create(null),order:[]},e.registerFeature=function(t,n,i){this.features.order.push({name:t,priority:n}),this.features.order.sort((e,t)=>e.priority-t.priority),this.features.handlers[t]=i.bind(e)},e.on("features",async t=>{const n=e.features.negotiated,i=e.features.handlers,r=[];for(const{name:s}of e.features.order)t[s]&&i[s]&&!n[s]&&r.push(s);function s(e){return new Promise(n=>{i[e](t,(e,t)=>{n(e?{command:e,message:t}:null)})})}for(const t of r){if(n[t])continue;let i="",r="";try{const e=await s(t);e&&(i=e.command,r=e.message||"")}catch(e){i="disconnect",r=e.message,console.error(e)}if(i)return"restart"===i&&e.transport&&e.transport.restart(),void("disconnect"===i&&(e.emit("stream:error",{condition:"policy-violation",text:"Failed to negotiate stream features: "+r}),e.disconnect()))}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.discoverBindings=async t=>{const n=new Set,r=new Set,s=e.resolver.getHostMeta(t).then(e=>{var t;for(const s of null!==(t=e.links)&&void 0!==t?t:[])s.href&&s.rel===i.NS_ALT_CONNECTIONS_WEBSOCKET&&r.add(s.href),s.href&&s.rel===i.NS_ALT_CONNECTIONS_XBOSH&&n.add(s.href)}).catch(e=>console.error(e)),o=e.config.allowAlternateDNSDiscovery?e.resolver.resolveTXT("_xmppconnect."+t).then(e=>{for(const t of e)for(const e of t){if(e.startsWith("_xmpp-client-websocket=")){const t=e.substring(e.indexOf("=")+1);t&&r.add(t)}if(e.startsWith("_xmpp-client-xbosh=")){const t=e.substring(e.indexOf("=")+1);t&&n.add(t)}}}).catch(e=>console.error(e)):Promise.resolve();return await Promise.all([s,o]).catch(e=>console.error(e)),{bosh:[...n].filter(e=>e.startsWith("https://")),websocket:[...r].filter(e=>e.startsWith("wss://"))}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(7),s=(0,i.__importStar)(n(39)),o=n(1);t.default=function(e){const t=!!r.RTCPeerConnection,n={...{advertiseAudio:t,advertiseFileTransfer:t,advertiseVideo:t,bundlePolicy:"balanced",hasRTCPeerConnection:t,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require",trickleIce:!0},...e.config.jingle},i=e.jingle=new s.SessionManager(n),a=[o.NS_JINGLE_1];n.hasRTCPeerConnection&&(a.push(o.NS_JINGLE_ICE_0,o.NS_JINGLE_ICE_UDP_1,o.NS_JINGLE_DTLS_SCTP_1,o.NS_JINGLE_DTLS_0,"urn:ietf:rfc:5888"),!1===n.trickleIce&&a.push("urn:ietf:rfc:3264"),(n.advertiseAudio||n.advertiseVideo)&&a.push(o.NS_JINGLE_RTP_1,o.NS_JINGLE_RTP_RTCP_FB_0,o.NS_JINGLE_RTP_HDREXT_0,"urn:ietf:rfc:5576"),n.advertiseAudio&&a.push(o.NS_JINGLE_RTP_AUDIO),n.advertiseVideo&&a.push(o.NS_JINGLE_RTP_VIDEO),n.advertiseFileTransfer&&a.push(o.NS_JINGLE_FILE_TRANSFER_4,o.NS_JINGLE_FILE_TRANSFER_5));for(const t of a)e.disco.addFeature(t);const c=["outgoing","incoming","accepted","terminated","ringing","mute","unmute","hold","resumed"];for(const t of c)i.on(t,(n,i)=>{e.emit("jingle:"+t,n,i)});i.on("createdSession",t=>{e.emit("jingle:created",t)}),i.on("send",async t=>{try{if("set"===t.type){const n=await e.sendIQ(t);n.jingle||(n.jingle={}),n.jingle.sid=t.jingle.sid,i.process(n)}"result"===t.type&&e.sendIQResult({type:"set",id:t.id,from:t.to},t),"error"===t.type&&e.sendIQError({type:"set",id:t.id,from:t.to},t)}catch(e){e.jingle||(e.jingle=t.jingle),e.jingle.sid=t.jingle.sid,i.process(e)}}),e.on("session:bound",e=>{i.selfID=e}),e.on("iq:set:jingle",e=>{i.process(e)}),e.on("unavailable",e=>{i.endPeerSessions(e.from,void 0,!0)}),e.getServices=async(t,n,i)=>{const r=(await e.sendIQ({externalServices:{type:n,version:i},to:t,type:"get"})).externalServices;return r.services=r.services||[],r},e.getServiceCredentials=async(t,n,i,r,s)=>(await e.sendIQ({externalServiceCredentials:{host:n,port:r,type:i,version:s},to:t,type:"get"})).externalServiceCredentials,e.discoverICEServers=async(t={})=>{try{const n=(await e.getServices(e.config.server,void 0,t.version)).services||[],i=[];for(const t of n)e.jingle.addICEServer(t);return i}catch(e){return[]}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(80),s=(0,i.__importStar)(n(8)),o=n(1);t.default=function(e){e.getHistorySearchForm=async(t,n={})=>(await e.sendIQ({archive:{type:"query",version:n.version},to:t,type:"get"})).archive.form,e.searchHistory=async(t,n={})=>{const i=e.nextId();let a="";"string"==typeof t?a=t:(a=t.to||"",n=t),n.queryId=i;const c=n.form||{};c.type="submit";const u=c.fields||[],l=[{name:"FORM_TYPE",type:"hidden",value:o.NS_MAM_2}];n.with&&l.push({name:"with",type:"text-single",value:n.with}),n.start&&l.push({name:"start",type:"text-single",value:n.start.toISOString()}),n.end&&l.push({name:"end",type:"text-single",value:n.end.toISOString()}),c.fields=(0,r.mergeFields)(l,u),n.form=c;const d=s.allowedResponders(e.jid,a),p=[],h=e=>{d.has(e.from)&&e.archive&&e.archive.queryId===i&&p.push(e.archive)};e.on("mam:item",h);try{return{...(await e.sendIQ({archive:n,id:i,to:a,type:"set"})).archive,results:p}}finally{e.off("mam:item",h)}},e.getHistoryPreferences=async()=>(await e.sendIQ({archive:{type:"preferences"},type:"get"})).archive,e.setHistoryPreferences=t=>e.sendIQ({archive:{type:"preferences",...t},type:"set"}),e.on("message",t=>{t.archive&&e.emit("mam:item",t)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeFields=void 0,t.mergeFields=function(e,t){const n=[],i=new Map;for(const e of t)e.name&&i.set(e.name,e);const r=new Set;for(const t of e)t.name&&i.has(t.name)?(n.push({...t,...i.get(t.name)}),r.add(t.name)):n.push({...t});for(const e of t)(!e.name||e.name&&!r.has(e.name))&&n.push({...e});return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1),s=new Set(["chat","groupchat","headline","normal"]),o=new Set(["chat","groupchat","normal"]),a=new Map([["markable",0],["received",1],["displayed",2],["acknowledged",3]]),c=(e,t)=>{var n;return e.marker&&(a.get(e.marker.type)<a.get(t)||"markable"===(null===(n=e.marker)||void 0===n?void 0:n.type))};async function u(e,t){await e.sendIQ({carbons:{action:t},type:"set"})}t.default=function(e){e.disco.addFeature(r.NS_ATTENTION_0),e.disco.addFeature(r.NS_CHAT_MARKERS_0),e.disco.addFeature(r.NS_CHAT_STATES),e.disco.addFeature(r.NS_CORRECTION_0),e.disco.addFeature(r.NS_RECEIPTS),e.disco.addFeature(r.NS_RTT_0),e.enableCarbons=()=>u(e,"enable"),e.disableCarbons=()=>u(e,"disable"),e.markReceived=t=>e.sendMarker(t,"received"),e.markDisplayed=t=>e.sendMarker(t,"displayed"),e.markAcknowledged=t=>e.sendMarker(t,"acknowledged"),e.getAttention=(t,n={})=>e.sendMessage({...n,requestingAttention:!0,to:t,type:"headline"}),e.sendMarker=(t,n,r)=>{if(!c(t,n)&&!r)return;const s=!1!==e.config.groupchatMarkersUseStanzaID;let o=t.id;if("groupchat"===t.type&&t.stanzaIds&&s){const e=t.stanzaIds.find(e=>i.equalBare(e.by,t.from));e&&(o=e.id)}e.sendMessage({marker:{id:o,type:n},to:"groupchat"===t.type?i.toBare(t.from):t.from,type:t.type})},e.on("message",t=>{if(t.carbon&&i.equalBare(t.from,e.jid)){const n=t.carbon.forward.message;n.delay||(n.delay=t.carbon.forward.delay||{timestamp:new Date(Date.now())}),(e=>!!e.carbon&&"received"===e.carbon.type)(t)&&(e.emit("carbon:received",t),e.emit("message",n)),(e=>!!e.carbon&&"sent"===e.carbon.type)(t)&&(e.emit("carbon:sent",t),e.emit("message:sent",n,!0))}(e=>!!e.forms&&e.forms.length>0)(t)&&e.emit("dataform",t),t.requestingAttention&&e.emit("attention",t),(e=>!!e.rtt)(t)&&e.emit("rtt",t),(e=>!!e.replace)(t)&&e.emit("replace",t),(e=>!!e.chatState)(t)&&o.has(t.type||"normal")&&e.emit("chat:state",t);const n=!1!==e.config.sendReceipts,r=!1!==e.config.sendMUCReceipts,a=!1!==e.config.chatMarkers,u=!1!==e.config.groupchatMarkersUseStanzaID,l=(e=>{var t;return!!e.receipt&&"request"===e.receipt.type&&s.has(null!==(t=e.type)&&void 0!==t?t:"normal")})(t),d=c(t,"received"),p=l&&n&&("groupchat"!==t.type||r);if(p||a&&d){const n="groupchat"===t.type?i.toBare(t.from):t.from;let r=t.id;if("groupchat"===t.type&&t.stanzaIds&&u){const e=t.stanzaIds.find(e=>i.equalBare(e.by,t.from));e&&(r=e.id)}e.sendMessage({receipt:p?{id:t.id,type:"received"}:void 0,marker:a&&d?{id:r,type:"received"}:void 0,to:n,type:t.type})}t.receipt&&"received"===t.receipt.type&&e.emit("receipt",t),t.marker&&"markable"!==t.marker.type&&e.emit("marker:"+t.marker.type,t)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=(0,i.__importStar)(n(8)),o=n(1),a=n(10);t.default=function(e){e.disco.addFeature(o.NS_MUC),e.disco.addFeature(o.NS_MUC_DIRECT_INVITE),e.disco.addFeature(o.NS_HATS_0),e.joinedRooms=new Map,e.joiningRooms=new Map,e.leavingRooms=new Map,e.on("session:started",(function(){const t=e.joiningRooms;e.joiningRooms=new Map;for(const[n,i]of t)e.joinRoom(n,i);const n=e.joinedRooms;e.joinedRooms=new Map;for(const[t,i]of n)e.joinRoom(t,i)})),e.on("message",t=>{if("groupchat"!==t.type||!t.hasSubject||t.body){if(t.muc)if("direct-invite"===t.muc.type||!t.muc.invite&&t.legacyMUC){const n="direct-invite"===t.muc.type?t.muc:t.legacyMUC;e.emit("muc:invite",{from:t.from,password:n.password,reason:n.reason,room:n.jid,thread:n.thread,type:"direct"})}else t.muc.invite?e.emit("muc:invite",{from:t.muc.invite[0].from,password:t.muc.password,reason:t.muc.invite[0].reason,room:t.from,thread:t.muc.invite[0].thread,type:"mediated"}):t.muc.decline?e.emit("muc:declined",{from:t.muc.decline.from,reason:t.muc.decline.reason,room:t.from}):e.emit("muc:other",t)}else e.emit("muc:topic",{from:t.from,room:s.toBare(t.from),topic:t.subject||""})}),e.on("presence",t=>{const n=s.toBare(t.from);if(e.joiningRooms.has(n)&&"error"===t.type)return e.joiningRooms.delete(n),e.emit("muc:failed",t),void e.emit("muc:error",t);if(!function(e){return!!e.muc}(t))return;const i=t.muc.statusCodes&&t.muc.statusCodes.indexOf(r.MUCStatusCode.SelfPresence)>=0,o=t.muc.statusCodes&&t.muc.statusCodes.indexOf(r.MUCStatusCode.NickChanged)>=0;if("error"===t.type)return void e.emit("muc:error",t);if("unavailable"===t.type)return e.emit("muc:unavailable",t),i&&(o?e.joinedRooms.set(n,t.muc.nick):(e.emit("muc:leave",t),e.joinedRooms.delete(n),e.leavingRooms.delete(n))),void(t.muc.destroy&&e.emit("muc:destroyed",{newRoom:t.muc.destroy.jid,password:t.muc.destroy.password,reason:t.muc.destroy.reason,room:n}));e.emit("muc:available",t);const a=e.joiningRooms.has(n)||!e.joinedRooms.has(n);i&&(e.joinedRooms.set(n,s.getResource(t.from)),a&&(e.joiningRooms.delete(n),e.emit("muc:join",t)))}),e.joinRoom=async(t,n,i={})=>{if(t=s.toBare(t),e.joiningRooms.set(t,n||""),!n)try{n=await e.getReservedNick(t),e.joiningRooms.set(t,n)}catch(e){throw new Error("Room nick required")}return new Promise((r,o)=>{function a(n){s.equalBare(n.from,t)&&(e.off("muc:join",a),e.off("muc:failed",c),r(n))}function c(n){s.equalBare(n.from,t)&&(e.off("muc:join",a),e.off("muc:failed",c),o(n))}e.on("muc:join",a),e.on("muc:failed",c),e.sendPresence({...i,muc:{...i.muc,type:"join"},to:s.createFull(t,n)})})},e.leaveRoom=(t,n,i={})=>(t=s.toBare(t),n=n||e.joinedRooms.get(t),e.leavingRooms.set(t,n),new Promise((r,o)=>{const c=i.id||(0,a.uuid)(),u=s.allowedResponders(t);function l(n){s.equalBare(n.from,t)&&(e.off("muc:leave",l),e.off("presence:error",d),r(n))}function d(n){n.id===c&&u.has(n.from)&&(e.joinedRooms.has(t)||e.leavingRooms.delete(t),e.off("muc:leave",l),e.off("presence:error",d),o(n))}e.on("muc:leave",l),e.on("presence:error",d),e.sendPresence({...i,id:c,to:s.createFull(t,n),type:"unavailable"})})),e.ban=(t,n,i)=>e.setRoomAffiliation(t,n,"outcast",i),e.kick=(t,n,i)=>e.setRoomRole(t,n,"none",i),e.invite=(t,n=[])=>{Array.isArray(n)||(n=[n]),e.sendMessage({muc:{invite:n,type:"info"},to:t})},e.directInvite=(t,n,i={})=>{e.sendMessage({muc:{...i,jid:t,type:"direct-invite"},to:n})},e.declineInvite=(t,n,i)=>{e.sendMessage({muc:{decline:{reason:i,to:n},type:"info"},to:t})},e.changeNick=(t,n)=>{const i=(0,a.uuid)(),o=s.createFull(t,n),c=s.allowedResponders(t);return new Promise((t,n)=>{function a(n){c.has(s.toBare(n.from))&&n.muc.statusCodes&&n.muc.statusCodes.includes(r.MUCStatusCode.SelfPresence)&&(e.off("muc:available",a),e.off("presence:id:"+i,u),t(n))}function u(r){c.has(s.toBare(r.from))&&r.id===i&&(e.off("muc:available",a),e.off("presence:id:"+i,u),"error"===r.type?n(r):t(r))}e.on("muc:available",a),e.on("presence:id:"+i,u),e.sendPresence({id:i,to:o})})},e.setSubject=(t,n)=>{e.sendMessage({subject:n,to:t,type:"groupchat"})},e.getReservedNick=async t=>{try{const n=(await e.getDiscoInfo(t,"x-roomuser-item")).identities[0];if(n.name)return n.name;throw new Error("No nickname reserved")}catch(e){throw new Error("No nickname reserved")}},e.requestRoomVoice=t=>{e.sendMessage({forms:[{fields:[{name:"FORM_TYPE",type:"hidden",value:"http://jabber.org/protocol/muc#request"},{name:"muc#role",type:"text-single",value:"participant"}],type:"submit"}],to:t})},e.setRoomAffiliation=(t,n,i,r)=>e.sendIQ({muc:{type:"user-list",users:[{affiliation:i,jid:n,reason:r}]},to:t,type:"set"}),e.setRoomRole=(t,n,i,r)=>e.sendIQ({muc:{type:"user-list",users:[{nick:n,reason:r,role:i}]},to:t,type:"set"}),e.getRoomMembers=(t,n={affiliation:"member"})=>e.sendIQ({muc:{type:"user-list",users:[n]},to:t,type:"get"}),e.getRoomConfig=async t=>{const n=await e.sendIQ({muc:{type:"configure"},to:t,type:"get"});if(!n.muc.form)throw new Error("No configuration form returned");return n.muc.form},e.configureRoom=(t,n={})=>e.sendIQ({muc:{form:{...n,type:"submit"},type:"configure"},to:t,type:"set"}),e.destroyRoom=(t,n={})=>e.sendIQ({muc:{destroy:n,type:"configure"},to:t,type:"set"}),e.getUniqueRoomName=async function(e){const t=await this.sendIQ({muc:{type:"unique"},to:e,type:"get"});if(!t.muc.name)throw new Error("No unique name returned");return t.muc.name},e.getBookmarks=async()=>{const t=await e.getPrivateData("bookmarks");return t&&t.rooms?t.rooms:[]},e.setBookmarks=t=>e.setPrivateData("bookmarks",{rooms:t}),e.addBookmark=async t=>{const n=await e.getBookmarks(),i=[];let r=!1;for(const e of n)s.equalBare(e.jid,t.jid)?(i.push({...e,...t}),r=!0):i.push(e);return r||i.push(t),e.setBookmarks(i)},e.removeBookmark=async t=>{const n=(await e.getBookmarks()).filter(e=>!s.equalBare(e.jid,t));return e.setBookmarks(n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature(i.NS_ACTIVITY),e.disco.addFeature(i.NS_GEOLOC),e.disco.addFeature(i.NS_MOOD),e.disco.addFeature(i.NS_NICK),e.disco.addFeature(i.NS_TUNE),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_ACTIVITY)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_GEOLOC)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_MOOD)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_NICK)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_TUNE)),e.publishActivity=t=>e.publish("",i.NS_ACTIVITY,{itemType:i.NS_ACTIVITY,...t}),e.publishGeoLoc=t=>e.publish("",i.NS_GEOLOC,{itemType:i.NS_GEOLOC,...t}),e.publishMood=t=>e.publish("",i.NS_MOOD,{itemType:i.NS_MOOD,...t}),e.publishNick=t=>e.publish("",i.NS_NICK,{itemType:i.NS_NICK,nick:t}),e.publishTune=t=>e.publish("",i.NS_TUNE,{itemType:i.NS_TUNE,...t}),e.on("pubsub:published",t=>{const n=t.pubsub.items.published[0].content;switch(t.pubsub.items.node){case i.NS_ACTIVITY:return e.emit("activity",{activity:n,jid:t.from});case i.NS_GEOLOC:return e.emit("geoloc",{geoloc:n,jid:t.from});case i.NS_MOOD:return e.emit("mood",{jid:t.from,mood:n});case i.NS_NICK:return e.emit("nick",{jid:t.from,nick:n.nick});case i.NS_TUNE:return e.emit("tune",{jid:t.from,tune:t.pubsub.items.published[0].content})}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1);t.default=function(e){e.disco.addFeature(r.NS_SHIM+"#SubID",r.NS_SHIM),e.on("message",t=>{!function(e){return!!e.pubsub&&!(e.pubsub.context&&"user"!==e.pubsub.context||!e.pubsub.affiliations)}(t)?function(e){return!!e.pubsub}(t)&&(e.emit("pubsub:event",t),!function(e){return!!e.pubsub.items&&!!e.pubsub.items.published}(t)?!function(e){return!!e.pubsub.items&&!!e.pubsub.items.retracted}(t)?!function(e){return"purge"===e.pubsub.eventType}(t)?!function(e){return"delete"===e.pubsub.eventType}(t)?!function(e){return"subscription"===e.pubsub.eventType}(t)?function(e){return"configuration"===e.pubsub.eventType}(t)&&e.emit("pubsub:config",t):e.emit("pubsub:subscription",t):e.emit("pubsub:deleted",t):e.emit("pubsub:purged",t):e.emit("pubsub:retracted",t):e.emit("pubsub:published",t)):e.emit("pubsub:affiliations",t)}),e.subscribeToNode=async(t,n)=>{const r={};let s;"string"==typeof n?(r.node=n,r.jid=i.toBare(e.jid)):(r.node=n.node,r.jid=n.jid||(n.useBareJID?i.toBare(e.jid):e.jid),s=n.options);const o=await e.sendIQ({pubsub:{context:"user",subscribe:r,subscriptionOptions:s?{form:s}:void 0},to:t,type:"set"}),a=o.pubsub.subscription||{};return o.pubsub.subscriptionOptions&&(a.options=o.pubsub.subscriptionOptions.form),a},e.unsubscribeFromNode=async(t,n)=>{const r={};"string"==typeof n?(r.node=n,r.jid=i.toBare(e.jid)):(r.node=n.node,r.subid=n.subid,r.jid=n.jid||(n.useBareJID?i.toBare(e.jid):e.jid));const s=await e.sendIQ({pubsub:{context:"user",unsubscribe:r},to:t,type:"set"});return s.pubsub&&s.pubsub.subscription?s.pubsub.subscription:{...r,state:"none"}},e.publish=(t,n,i,r)=>e.sendIQ({pubsub:{context:"user",publish:{item:{content:i,id:r},node:n}},to:t,type:"set"}),e.getItem=async(t,n,i)=>(await e.sendIQ({pubsub:{context:"user",fetch:{items:[{id:i}],node:n}},to:t,type:"get"})).pubsub.fetch.items[0],e.getItems=async(t,n,i={})=>{const r=await e.sendIQ({pubsub:{context:"user",fetch:{max:i.max,node:n},paging:i},to:t,type:"get"}),s=r.pubsub.fetch;return s.paging=r.pubsub.paging,s},e.retract=(t,n,i,r)=>e.sendIQ({pubsub:{context:"user",retract:{id:i,node:n,notify:r}},to:t,type:"set"}),e.purgeNode=(t,n)=>e.sendIQ({pubsub:{context:"owner",purge:n},to:t,type:"set"}),e.deleteNode=(t,n,i)=>e.sendIQ({pubsub:{context:"owner",destroy:{node:n,redirect:i}},to:t,type:"set"}),e.createNode=async(t,n,i)=>{const r=await e.sendIQ({pubsub:{configure:i?{form:i}:void 0,context:"user",create:{node:n}},to:t,type:"set"});return r.pubsub&&r.pubsub.create?r.pubsub.create:{node:n}},e.getSubscriptions=async(t,n={})=>(await e.sendIQ({pubsub:{context:"user",subscriptions:n},to:t,type:"get"})).pubsub.subscriptions,e.getAffiliations=(t,n)=>e.sendIQ({pubsub:{affiliations:{node:n}},to:t,type:"get"}),e.getNodeSubscribers=(t,n,i={})=>("string"==typeof n?i.node=n:i={...i,...n},e.sendIQ({pubsub:{context:"owner",subscriptions:i},to:t,type:"get"})),e.updateNodeSubscriptions=(t,n,i)=>e.sendIQ({pubsub:{context:"owner",subscriptions:{items:i,node:n}},to:t,type:"set"}),e.getNodeAffiliations=async(t,n)=>(await e.sendIQ({pubsub:{affiliations:{node:n},context:"owner"},to:t,type:"get"})).pubsub.affiliations,e.updateNodeAffiliations=(t,n,i)=>e.sendIQ({pubsub:{affiliations:{items:i,node:n},context:"owner"},to:t,type:"set"}),e.getNodeConfig=async(t,n)=>(await e.sendIQ({pubsub:{configure:{node:n},context:"owner"},to:t,type:"get"})).pubsub.configure.form||{},e.getDefaultNodeConfig=async t=>(await e.sendIQ({pubsub:{context:"owner",defaultConfiguration:{}},to:t,type:"get"})).pubsub.defaultConfiguration.form||{},e.configureNode=async(t,n,i)=>e.sendIQ({pubsub:{configure:{form:i,node:n},context:"owner"},to:t,type:"set"}),e.getDefaultSubscriptionOptions=async t=>(await e.sendIQ({pubsub:{defaultSubscriptionOptions:{}},to:t,type:"get"})).pubsub.defaultSubscriptionOptions.form||{}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8));t.default=function(e){async function t(t,n){await e.sendIQ({blockList:{action:t,jids:[n]},type:"set"})}e.on("iq:set:roster",t=>{if(!i.allowedResponders(e.jid).has(t.from))return e.sendIQError(t,{error:{condition:"service-unavailable",type:"cancel"}});e.emit("roster:update",t),e.sendIQResult(t)}),e.on("iq:set:blockList",t=>{if(!i.allowedResponders(e.jid).has(t.from))return e.sendIQError(t,{error:{condition:"service-unavailable",type:"cancel"}});const n=t.blockList;e.emit(n.action,{jids:n.jids||[]}),e.sendIQResult(t)}),e.getRoster=async()=>{const t=await e.sendIQ({roster:{version:e.config.rosterVer},type:"get"});if(t.roster){const n=t.roster.version;return n&&(e.config.rosterVer=n,e.emit("roster:ver",n)),t.roster.items=t.roster.items||[],t.roster}return{items:[]}},e.updateRosterItem=async t=>{await e.sendIQ({roster:{items:[t]},type:"set"})},e.removeRosterItem=t=>e.updateRosterItem({jid:t,subscription:"remove"}),e.subscribe=t=>{e.sendPresence({type:"subscribe",to:t})},e.unsubscribe=t=>{e.sendPresence({type:"unsubscribe",to:t})},e.acceptSubscription=t=>{e.sendPresence({type:"subscribed",to:t})},e.denySubscription=t=>{e.sendPresence({type:"unsubscribed",to:t})},e.getBlocked=async()=>({jids:[],...(await e.sendIQ({blockList:{action:"list"},type:"get"})).blockList}),e.block=async e=>t("block",e),e.unblock=async e=>t("unblock",e),e.goInvisible=async(t=!1)=>{await e.sendIQ({type:"set",visiblity:{probe:t,type:"invisible"}})},e.goVisible=async()=>{await e.sendIQ({type:"set",visiblity:{type:"visible"}})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.registerFeature("sasl",100,async(t,n)=>{const i=e.sasl.createMechanism(t.sasl.mechanisms),r=async t=>{if(i)switch(t.type){case"success":return e.features.negotiated.sasl=!0,e.off("sasl",r),e.emit("auth:success",e.config.credentials),e.transport&&(e.transport.authenticated=!0),void n("restart");case"challenge":i.processChallenge(t.value);try{const t=await e.getCredentials(),n=i.createResponse(t);n||""===n?e.send("sasl",{type:"response",value:n}):e.send("sasl",{type:"response"});const r=i.getCacheableCredentials();r&&(e.config.credentials||(e.config.credentials={}),e.config.credentials={...e.config.credentials,...r},e.emit("credentials:update",e.config.credentials))}catch(t){console.error(t),e.send("sasl",{type:"abort"})}return;case"failure":case"abort":return e.off("sasl",r),e.emit("auth:failed"),void n("disconnect","authentication failed")}};if(!i)return e.off("sasl",r),e.emit("auth:failed"),n("disconnect","authentication failed");e.on("sasl",r),e.once("--reset-stream-features",()=>{e.features.negotiated.sasl=!1,e.off("sasl",r)});try{const t=await e.getCredentials();e.send("sasl",{mechanism:i.name,type:"auth",value:i.createResponse(t)})}catch(t){console.error(t),e.send("sasl",{type:"abort"})}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1);t.default=function(e){async function t(t){const n=await e.getDiscoInfo(t);if(!n.features||!n.features.includes(r.NS_HTTP_UPLOAD_0))return;let i;for(const e of n.extensions||[]){const n=e.fields||[];if(n.some(e=>"FORM_TYPE"===e.name&&e.value===r.NS_HTTP_UPLOAD_0)){const e=n.find(e=>"max-file-size"===e.name);return e&&(i=parseInt(e.value,10)),{jid:t,maxSize:i}}}}e.disco.addFeature(r.NS_BOB),e.getBits=async(t,n)=>(await e.sendIQ({bits:{cid:n},to:t,type:"get"})).bits,e.getUploadService=async(n=i.getDomain(e.jid))=>{const r=await t(n);if(r)return r;const s=await e.getDiscoItems(n);for(const e of s.items||[]){if(!e.jid)continue;const n=await t(e.jid);if(n)return n}throw new Error("No upload service discovered on: "+n)},e.getUploadSlot=async(t,n)=>(await e.sendIQ({httpUpload:{type:"request",...n},to:t,type:"get"})).httpUpload}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3);(0,i.__exportStar)(n(89),t),(0,i.__exportStar)(n(90),t),(0,i.__exportStar)(n(91),t),(0,i.__exportStar)(n(92),t),(0,i.__exportStar)(n(93),t),(0,i.__exportStar)(n(94),t),(0,i.__exportStar)(n(95),t),(0,i.__exportStar)(n(96),t),(0,i.__exportStar)(n(97),t),(0,i.__exportStar)(n(98),t),(0,i.__exportStar)(n(99),t),(0,i.__exportStar)(n(100),t),(0,i.__exportStar)(n(101),t),(0,i.__exportStar)(n(102),t),(0,i.__exportStar)(n(103),t),(0,i.__exportStar)(n(104),t),(0,i.__exportStar)(n(105),t),(0,i.__exportStar)(n(106),t),(0,i.__exportStar)(n(107),t),(0,i.__exportStar)(n(108),t),(0,i.__exportStar)(n(109),t),(0,i.__exportStar)(n(110),t),(0,i.__exportStar)(n(111),t),(0,i.__exportStar)(n(112),t),(0,i.__exportStar)(n(113),t),(0,i.__exportStar)(n(114),t),(0,i.__exportStar)(n(115),t),(0,i.__exportStar)(n(116),t),(0,i.__exportStar)(n(117),t),(0,i.__exportStar)(n(118),t),(0,i.__exportStar)(n(119),t),(0,i.__exportStar)(n(120),t),(0,i.__exportStar)(n(121),t),(0,i.__exportStar)(n(122),t),(0,i.__exportStar)(n(123),t),(0,i.__exportStar)(n(124),t),(0,i.__exportStar)(n(125),t),(0,i.__exportStar)(n(126),t),(0,i.__exportStar)(n(127),t),(0,i.__exportStar)(n(128),t),(0,i.__exportStar)(n(129),t),(0,i.__exportStar)(n(130),t),(0,i.__exportStar)(n(131),t),(0,i.__exportStar)(n(132),t),(0,i.__exportStar)(n(133),t),(0,i.__exportStar)(n(134),t),(0,i.__exportStar)(n(135),t),(0,i.__exportStar)(n(136),t),(0,i.__exportStar)(n(137),t),(0,i.__exportStar)(n(138),t),(0,i.__exportStar)(n(139),t),(0,i.__exportStar)(n(140),t),(0,i.__exportStar)(n(141),t),(0,i.__exportStar)(n(142),t),(0,i.__exportStar)(n(143),t),(0,i.__exportStar)(n(144),t),(0,i.__exportStar)(n(145),t),(0,i.__exportStar)(n(146),t),(0,i.__exportStar)(n(147),t),(0,i.__exportStar)(n(148),t),(0,i.__exportStar)(n(149),t),(0,i.__exportStar)(n(150),t),(0,i.__exportStar)(n(151),t),(0,i.__exportStar)(n(152),t),(0,i.__exportStar)(n(153),t),(0,i.__exportStar)(n(154),t),(0,i.__exportStar)(n(155),t),(0,i.__exportStar)(n(156),t),(0,i.__exportStar)(n(157),t),(0,i.__exportStar)(n(158),t),(0,i.__exportStar)(n(159),t),(0,i.__exportStar)(n(160),t),(0,i.__exportStar)(n(161),t),(0,i.__exportStar)(n(162),t),(0,i.__exportStar)(n(163),t),(0,i.__exportStar)(n(164),t),(0,i.__exportStar)(n(165),t),(0,i.__exportStar)(n(166),t),(0,i.__exportStar)(n(167),t),(0,i.__exportStar)(n(168),t),(0,i.__exportStar)(n(46),t);const r=(0,i.__importDefault)(n(89)),s=(0,i.__importDefault)(n(90)),o=(0,i.__importDefault)(n(91)),a=(0,i.__importDefault)(n(92)),c=(0,i.__importDefault)(n(93)),u=(0,i.__importDefault)(n(94)),l=(0,i.__importDefault)(n(95)),d=(0,i.__importDefault)(n(96)),p=(0,i.__importDefault)(n(97)),h=(0,i.__importDefault)(n(98)),f=(0,i.__importDefault)(n(99)),m=(0,i.__importDefault)(n(100)),g=(0,i.__importDefault)(n(101)),y=(0,i.__importDefault)(n(102)),b=(0,i.__importDefault)(n(103)),_=(0,i.__importDefault)(n(104)),v=(0,i.__importDefault)(n(105)),S=(0,i.__importDefault)(n(106)),w=(0,i.__importDefault)(n(107)),T=(0,i.__importDefault)(n(108)),I=(0,i.__importDefault)(n(109)),N=(0,i.__importDefault)(n(110)),A=(0,i.__importDefault)(n(111)),E=(0,i.__importDefault)(n(112)),x=(0,i.__importDefault)(n(113)),R=(0,i.__importDefault)(n(114)),C=(0,i.__importDefault)(n(115)),O=(0,i.__importDefault)(n(116)),k=(0,i.__importDefault)(n(117)),P=(0,i.__importDefault)(n(118)),j=(0,i.__importDefault)(n(119)),L=(0,i.__importDefault)(n(120)),M=(0,i.__importDefault)(n(122)),D=(0,i.__importDefault)(n(123)),B=(0,i.__importDefault)(n(124)),F=(0,i.__importDefault)(n(121)),q=(0,i.__importDefault)(n(125)),U=(0,i.__importDefault)(n(126)),J=(0,i.__importDefault)(n(127)),z=(0,i.__importDefault)(n(128)),G=(0,i.__importDefault)(n(129)),H=(0,i.__importDefault)(n(130)),V=(0,i.__importDefault)(n(131)),W=(0,i.__importDefault)(n(132)),$=(0,i.__importDefault)(n(133)),Q=(0,i.__importDefault)(n(134)),K=(0,i.__importDefault)(n(135)),X=(0,i.__importDefault)(n(136)),Y=(0,i.__importDefault)(n(137)),Z=(0,i.__importDefault)(n(138)),ee=(0,i.__importDefault)(n(139)),te=(0,i.__importDefault)(n(140)),ne=(0,i.__importDefault)(n(141)),ie=(0,i.__importDefault)(n(142)),re=(0,i.__importDefault)(n(143)),se=(0,i.__importDefault)(n(144)),oe=(0,i.__importDefault)(n(145)),ae=(0,i.__importDefault)(n(146)),ce=(0,i.__importDefault)(n(147)),ue=(0,i.__importDefault)(n(148)),le=(0,i.__importDefault)(n(149)),de=(0,i.__importDefault)(n(150)),pe=(0,i.__importDefault)(n(151)),he=(0,i.__importDefault)(n(152)),fe=(0,i.__importDefault)(n(153)),me=(0,i.__importDefault)(n(154)),ge=(0,i.__importDefault)(n(155)),ye=(0,i.__importDefault)(n(156)),be=(0,i.__importDefault)(n(157)),_e=(0,i.__importDefault)(n(158)),ve=(0,i.__importDefault)(n(159)),Se=(0,i.__importDefault)(n(160)),we=(0,i.__importDefault)(n(161)),Te=(0,i.__importDefault)(n(162)),Ie=(0,i.__importDefault)(n(163)),Ne=(0,i.__importDefault)(n(164)),Ae=(0,i.__importDefault)(n(165)),Ee=(0,i.__importDefault)(n(166)),xe=(0,i.__importDefault)(n(167)),Re=(0,i.__importDefault)(n(168)),Ce=(0,i.__importDefault)(n(46)),Oe=[r.default,s.default,o.default,a.default,c.default,u.default,l.default,d.default,p.default,h.default,f.default,m.default,g.default,y.default,b.default,_.default,v.default,S.default,w.default,T.default,I.default,N.default,A.default,E.default,x.default,R.default,C.default,O.default,k.default,P.default,j.default,L.default,M.default,D.default,B.default,F.default,q.default,U.default,J.default,z.default,G.default,H.default,V.default,W.default,$.default,Q.default,K.default,X.default,Y.default,Z.default,ee.default,te.default,ne.default,ie.default,re.default,se.default,oe.default,ae.default,ce.default,ue.default,le.default,de.default,pe.default,he.default,fe.default,me.default,ge.default,ye.default,be.default,_e.default,ve.default,Se.default,we.default,Te.default,Ie.default,Ne.default,Ae.default,Ee.default,xe.default,Re.default,Ce.default];t.default=Oe},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["features.legacySession","iq.legacySession"],element:"session",fields:{optional:(0,i.childBoolean)(null,"optional")},namespace:r.NS_SESSION};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["atomentry",...(0,i.pubsubItemContentAliases)()],element:"entry",fields:{id:(0,i.childText)(null,"id"),published:(0,i.childDate)(null,"published"),updated:(0,i.childDate)(null,"updated")},namespace:r.NS_ATOM,type:r.NS_ATOM,typeField:"itemType"},{element:"summary",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.summary"},{element:"title",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.title"},{aliases:[{path:"atomentry.links",multiple:!0}],element:"link",fields:{href:(0,i.attribute)("href"),mediaType:(0,i.attribute)("type"),rel:(0,i.attribute)("rel")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.authors",multiple:!0}],element:"author",fields:{name:(0,i.childText)(null,"name"),uri:(0,i.childText)(null,"uri"),email:(0,i.childText)(null,"email")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.contributors",multiple:!0}],element:"contributor",fields:{name:(0,i.childText)(null,"name"),uri:(0,i.childText)(null,"uri"),email:(0,i.childText)(null,"email")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.categories",multiple:!0}],element:"category",fields:{term:(0,i.attribute)("term"),scheme:(0,i.attribute)("scheme"),label:(0,i.attribute)("label")},namespace:r.NS_ATOM},{element:"content",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.content"},{element:"rights",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.rights"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={defaultType:"stream",element:"stream",fields:{from:(0,r.attribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.attribute)("to"),version:(0,r.attribute)("version")},namespace:s.NS_STREAM,path:"stream",type:"stream",typeField:"action"},a={element:"features",namespace:s.NS_STREAM,path:"features"},c={element:"error",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_STREAMS,"text"),condition:(0,r.childEnum)(s.NS_STREAMS,Object.values(i.StreamErrorCondition),i.StreamErrorCondition.UndefinedCondition),seeOtherHost:(0,r.childText)(s.NS_STREAMS,i.StreamErrorCondition.SeeOtherHost),text:(0,r.childText)(s.NS_STREAMS,"text")},namespace:s.NS_STREAM,path:"streamError"},u=Object.values(i.StreamType).map(e=>({aliases:["stanzaError","message.error","presence.error","iq.error"],defaultType:s.NS_CLIENT,element:"error",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_STANZAS,"text"),by:(0,r.JIDAttribute)("by"),condition:(0,r.childEnum)(s.NS_STANZAS,Object.values(i.StanzaErrorCondition),i.StanzaErrorCondition.UndefinedCondition),gone:(0,r.childText)(s.NS_STANZAS,i.StanzaErrorCondition.Gone),redirect:(0,r.childText)(s.NS_STANZAS,i.StanzaErrorCondition.Redirect),text:(0,r.childText)(s.NS_STANZAS,"text"),type:(0,r.attribute)("type")},namespace:e,type:e,typeField:"streamType"})),l=new Set(["from","id","lang","to","type","payloadType","error","streamType"]),d=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"iq",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),payloadType:{order:-1e4,importer(e,t){if("get"!==t.data.type&&"set"!==t.data.type)return;if(1!==e.children.filter(e=>"string"!=typeof e).length)return"invalid-payload-count";const n=Object.keys(t.data).filter(e=>!l.has(e));return 1!==n.length?"unknown-payload":n[0]}},to:(0,r.JIDAttribute)("to"),type:(0,r.attribute)("type")},namespace:e,path:"iq",type:e,typeField:"streamType"})),p=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"message",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.JIDAttribute)("to")},namespace:e,path:"message",type:e,typeField:"streamType"})),h=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"presence",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.JIDAttribute)("to")},namespace:e,path:"presence",type:e,typeField:"streamType"})),f=[o,a,c,...u,...[{element:"mechanisms",fields:{mechanisms:(0,r.multipleChildText)(null,"mechanism")},namespace:s.NS_SASL,path:"features.sasl"},{element:"abort",namespace:s.NS_SASL,path:"sasl",type:"abort",typeField:"type"},{element:"auth",fields:{mechanism:(0,r.attribute)("mechanism"),value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"auth",typeField:"type"},{element:"challenge",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"challenge",typeField:"type"},{element:"response",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"response",typeField:"type"},{element:"success",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"success",typeField:"type"},{element:"failure",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_SASL,"text"),condition:(0,r.childEnum)(s.NS_SASL,Object.values(i.SASLFailureCondition)),text:(0,r.childText)(s.NS_SASL,"text")},namespace:s.NS_SASL,path:"sasl",type:"failure",typeField:"type"}],...[{aliases:["features.tls"],defaultType:"start",element:"starttls",fields:{required:(0,r.childBoolean)(null,"required")},namespace:s.NS_STARTTLS,path:"tls",type:"start",typeField:"type"},{element:"proceed",namespace:s.NS_STARTTLS,path:"tls",type:"proceed",typeField:"type"},{element:"failure",namespace:s.NS_STARTTLS,path:"tls",type:"failure",typeField:"type"}],...d,...p,...h,{aliases:["features.bind","iq.bind"],element:"bind",fields:{jid:(0,r.childText)(null,"jid"),resource:(0,r.childText)(null,"resource")},namespace:s.NS_BIND}];t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({rosterPreApproval:(0,i.childBoolean)(r.NS_SUBSCRIPTION_PREAPPROVAL,"sub"),rosterVersioning:(0,i.childBoolean)(r.NS_ROSTER_VERSIONING,"ver")}),(0,i.extendMessage)({alternateLanguageBodies:(0,i.childAlternateLanguageText)(null,"body"),alternateLanguageSubjects:(0,i.childAlternateLanguageText)(null,"subject"),body:(0,i.childText)(null,"body"),hasSubject:(0,i.childBoolean)(null,"subject"),parentThread:(0,i.childAttribute)(null,"thread","parent"),subject:(0,i.childText)(null,"subject"),thread:(0,i.childText)(null,"thread"),type:(0,i.attribute)("type")}),(0,i.extendPresence)({alternateLanguageStatuses:(0,i.childAlternateLanguageText)(null,"status"),priority:(0,i.childInteger)(null,"priority",0),show:(0,i.childText)(null,"show"),status:(0,i.childText)(null,"status"),type:(0,i.attribute)("type")}),{element:"query",fields:{version:(0,i.attribute)("ver",void 0,{emitEmpty:!0})},namespace:r.NS_ROSTER,path:"iq.roster"},{aliases:[{path:"iq.roster.items",multiple:!0}],element:"item",fields:{groups:(0,i.multipleChildText)(null,"group"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),pending:(0,i.attribute)("ask"),preApproved:(0,i.booleanAttribute)("approved"),subscription:(0,i.attribute)("subscription")},namespace:r.NS_ROSTER}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"open",fields:{from:(0,i.attribute)("from"),id:(0,i.attribute)("id"),lang:(0,i.languageAttribute)(),to:(0,i.attribute)("to"),version:(0,i.attribute)("version")},namespace:r.NS_FRAMING,path:"stream",type:"open"},{element:"close",fields:{seeOtherURI:(0,i.attribute)("see-other-uri")},namespace:r.NS_FRAMING,path:"stream",type:"close"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o=[{aliases:[{path:"message.forms",multiple:!0}],element:"x",fields:{instructions:{...(0,r.multipleChildText)(null,"instructions"),exportOrder:2},reported:{...(0,r.splicePath)(null,"reported","dataformField",!0),exportOrder:3},title:{...(0,r.childText)(null,"title"),exportOrder:1},type:(0,r.attribute)("type")},namespace:s.NS_DATAFORM,optionalNamespaces:{xdv:s.NS_DATAFORM_VALIDATION},path:"dataform"},{aliases:[{path:"dataform.fields",multiple:!0},{path:"dataform.items.fields",multiple:!0}],element:"field",fields:{description:(0,r.childText)(null,"desc"),label:(0,r.attribute)("label"),name:(0,r.attribute)("var"),rawValues:{...(0,r.multipleChildText)(null,"value"),exporter:()=>null},required:(0,r.childBoolean)(null,"required"),type:(0,r.attribute)("type"),value:{importer(e,t){const n=e.getAttribute("type"),o=(0,r.multipleChildText)(s.NS_DATAFORM,"value").importer(e,t),a=o[0];switch(n){case i.DataFormFieldType.TextMultiple:case i.DataFormFieldType.ListMultiple:case i.DataFormFieldType.JIDMultiple:return o;case i.DataFormFieldType.Hidden:case i.DataFormFieldType.Fixed:return 1===o.length?a:o;case i.DataFormFieldType.Boolean:if(a)return"1"===a||"true"===a;break;default:return a}},exporter(e,t,n){const i=(0,r.multipleChildText)(null,"value");let o=[];const a=n.data&&n.data.rawValues?n.data.rawValues[0]:void 0;if("boolean"==typeof t)o="true"===a||"false"===a?[a]:[t?"1":"0"];else if(Array.isArray(t))for(const e of t)o.push(e.toString());else o=[t.toString()];i.exporter(e,o,Object.assign({},n,{namespace:s.NS_DATAFORM}))}}},namespace:s.NS_DATAFORM,path:"dataformField"},{aliases:[{path:"dataform.fields.options",multiple:!0}],element:"option",fields:{label:(0,r.attribute)("label"),value:(0,r.childText)(null,"value")},namespace:s.NS_DATAFORM},{aliases:[{path:"dataform.items",multiple:!0}],element:"item",namespace:s.NS_DATAFORM},{element:"validate",fields:{listMax:(0,r.childIntegerAttribute)(null,"list-range","max"),listMin:(0,r.childIntegerAttribute)(null,"list-range","min"),method:(0,r.childEnum)(null,["basic","open","range","regex"],"basic"),rangeMax:(0,r.childAttribute)(null,"range","max"),rangeMin:(0,r.childAttribute)(null,"range","min"),regex:(0,r.childText)(null,"regex"),type:(0,r.attribute)("datatype","xs:string")},namespace:s.NS_DATAFORM_VALIDATION,path:"dataform.fields.validation"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["presence.legacyLastActivity","iq.lastActivity"],element:"query",fields:{seconds:(0,i.integerAttribute)("seconds"),status:(0,i.text)()},namespace:r.NS_LAST_ACTIVITY}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"query",fields:{activeList:(0,i.childAttribute)(null,"active","name"),defaultList:(0,i.childAttribute)(null,"default","name")},namespace:r.NS_PRIVACY,path:"iq.privacy"},{aliases:[{path:"iq.privacy.lists",multiple:!0}],element:"list",fields:{name:(0,i.attribute)("name")},namespace:r.NS_PRIVACY},{aliases:[{path:"iq.privacy.lists.items",multiple:!0}],element:"item",fields:{action:(0,i.attribute)("action"),incomingPresence:(0,i.childBoolean)(null,"presence-in"),iq:(0,i.childBoolean)(null,"iq"),messages:(0,i.childBoolean)(null,"message"),order:(0,i.integerAttribute)("order"),outgoingPresence:(0,i.childBoolean)(null,"presence-out"),type:(0,i.attribute)("type"),value:(0,i.attribute)("value")},namespace:r.NS_PRIVACY}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["iq.disco","message.disco","features.disco"],childrenExportOrder:{identities:1,features:2,extensions:3},element:"query",fields:{features:(0,i.multipleChildAttribute)(null,"feature","var"),node:(0,i.attribute)("node")},namespace:r.NS_DISCO_INFO,path:"disco",type:"info",typeField:"type"},{aliases:[{path:"disco.identities",selector:"info",multiple:!0}],element:"identity",fields:{category:(0,i.attribute)("category"),lang:(0,i.languageAttribute)(),name:(0,i.attribute)("name"),type:(0,i.attribute)("type")},namespace:r.NS_DISCO_INFO},{aliases:[{path:"disco.items",multiple:!0,selector:"items"}],element:"item",fields:{jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),node:(0,i.attribute)("node")},namespace:r.NS_DISCO_ITEMS},{aliases:[{path:"disco.items",multiple:!0,selector:"info"}],element:"item",fields:{category:(0,i.JIDAttribute)("category"),lang:(0,i.languageAttribute)(),name:(0,i.attribute)("name"),type:(0,i.attribute)("type")},namespace:r.NS_DISCO_INFO},(0,i.addAlias)(r.NS_DATAFORM,"x",[{path:"disco.extensions",multiple:!0,selector:"info"}]),(0,i.addAlias)(r.NS_RSM,"set",[{path:"disco.paging",selector:"items"}]),{aliases:["iq.disco","message.disco","features.disco"],element:"query",fields:{node:(0,i.attribute)("node")},namespace:r.NS_DISCO_ITEMS,path:"disco",type:"items",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({addresses:(0,i.splicePath)(r.NS_ADDRESS,"addresses","extendedAddress",!0)}),(0,i.extendPresence)({addresses:(0,i.splicePath)(r.NS_ADDRESS,"addresses","extendedAddress",!0)}),{element:"address",fields:{alternateLanguageDescriptions:(0,i.childAlternateLanguageText)(null,"desc"),delivered:(0,i.booleanAttribute)("delivered"),description:(0,i.attribute)("desc"),jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node"),type:(0,i.attribute)("type"),uri:(0,i.attribute)("uri")},namespace:r.NS_ADDRESS,path:"extendedAddress"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",[{path:"iq.muc.form",selector:"configure"}]),{defaultType:"info",element:"x",fields:{password:(0,i.childText)(null,"password")},namespace:r.NS_MUC,path:"presence.muc",type:"join",typeField:"type"},{aliases:[{path:"presence.muc.history",selector:"join"}],element:"history",fields:{maxCharacters:(0,i.integerAttribute)("maxchars"),maxStanzas:(0,i.integerAttribute)("maxstanzas"),seconds:(0,i.integerAttribute)("seconds"),since:(0,i.dateAttribute)("since")},namespace:r.NS_MUC},{aliases:["presence.muc","message.muc"],defaultType:"info",element:"x",fields:{action:(0,i.childEnum)(null,["invite","decline","destroy"]),actor:(0,i.splicePath)(null,"item","mucactor"),affiliation:(0,i.childAttribute)(null,"item","affiliation"),jid:(0,i.childJIDAttribute)(null,"item","jid"),nick:(0,i.childAttribute)(null,"item","nick"),password:(0,i.childText)(null,"password"),reason:(0,i.deepChildText)([{namespace:null,element:"item"},{namespace:null,element:"reason"}]),role:(0,i.childAttribute)(null,"item","role"),statusCodes:(0,i.multipleChildAttribute)(null,"status","code")},namespace:r.NS_MUC_USER,type:"info",typeField:"type",typeOrder:1},{element:"actor",fields:{jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick")},namespace:r.NS_MUC_USER,path:"mucactor"},{element:"destroy",fields:{jid:(0,i.JIDAttribute)("jid"),password:(0,i.childText)(null,"password"),reason:(0,i.childText)(null,"reason")},namespace:r.NS_MUC_USER,path:"presence.muc.destroy"},{aliases:[{path:"message.muc.invite",multiple:!0}],element:"invite",fields:{continue:(0,i.childBoolean)(null,"continue"),from:(0,i.JIDAttribute)("from"),reason:(0,i.childText)(null,"reason"),thread:(0,i.childAttribute)(null,"continue","thread"),to:(0,i.JIDAttribute)("to")},namespace:r.NS_MUC_USER},{element:"decline",fields:{from:(0,i.JIDAttribute)("from"),reason:(0,i.childText)(null,"reason"),to:(0,i.JIDAttribute)("to")},namespace:r.NS_MUC_USER,path:"message.muc",type:"decline"},{element:"query",namespace:r.NS_MUC_ADMIN,path:"iq.muc",type:"user-list",typeField:"type"},{aliases:[{path:"iq.muc.users",multiple:!0,selector:"user-list"}],element:"item",fields:{affiliation:(0,i.attribute)("affiliation"),jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick"),reason:(0,i.childText)(null,"reason"),role:(0,i.attribute)("role")},namespace:r.NS_MUC_ADMIN},{aliases:["iq.muc.users.actor"],element:"actor",fields:{jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick")},namespace:r.NS_MUC_ADMIN},{element:"query",namespace:r.NS_MUC_OWNER,path:"iq.muc",type:"configure",typeField:"type"},{aliases:[{path:"iq.muc.destroy",selector:"configure"}],element:"destroy",fields:{jid:(0,i.JIDAttribute)("jid"),password:(0,i.childText)(null,"password"),reason:(0,i.childText)(null,"reason")},namespace:r.NS_MUC_OWNER},{element:"x",fields:{action:(0,i.staticValue)("invite"),continue:(0,i.booleanAttribute)("continue"),jid:(0,i.JIDAttribute)("jid"),legacyReason:(0,i.text)(),password:(0,i.attribute)("password"),reason:(0,i.attribute)("reason"),thread:(0,i.attribute)("thread")},namespace:r.NS_MUC_DIRECT_INVITE,path:"message.muc",type:"direct-invite",typeOrder:2},{element:"unique",fields:{name:(0,i.text)()},namespace:r.NS_MUC_UNIQUE,path:"iq.muc",type:"unique"},(0,i.extendMessage)({legacyMUC:{exporter(e,t,n){const i=n.registry?n.registry.export("message.muc",{...t,type:"direct-invite"}):void 0;i&&e.appendChild(i)},exportOrder:100001,importer(e,t){if(!(0,i.findAll)(e,r.NS_MUC_USER,"x")[0])return;const n=(0,i.findAll)(e,r.NS_MUC_DIRECT_INVITE,"x")[0];return n&&t.registry?t.registry.import(n,{...t,path:"message"}):void 0},importOrder:-1}})];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["iq.ibb","message.ibb"],element:"open",fields:{ack:{importer:(e,t)=>"message"!==(0,i.attribute)("stanza","iq").importer(e,t),exporter(e,t,n){(0,i.attribute)("stanza").exporter(e,t?"iq":"message",n)}},blockSize:(0,i.integerAttribute)("block-size"),sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"open",typeField:"action"},{aliases:["iq.ibb","message.ibb"],element:"close",fields:{sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"close",typeField:"action"},{aliases:["iq.ibb","message.ibb"],element:"data",fields:{data:(0,i.textBuffer)("base64"),seq:(0,i.integerAttribute)("seq"),sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"data",typeField:"action"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{path:"bookmarkStorage",impliedType:!0},{path:"iq.privateStorage.bookmarks",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"storage",namespace:r.NS_BOOKMARKS,type:r.NS_BOOKMARKS,typeField:"itemType"},{aliases:[{path:"bookmarkStorage.rooms",multiple:!0}],element:"conference",fields:{autoJoin:(0,i.booleanAttribute)("autojoin"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),nick:(0,i.childText)(null,"nick"),password:(0,i.childText)(null,"password")},namespace:r.NS_BOOKMARKS}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={element:"query",namespace:n(1).NS_PRIVATE,path:"iq.privateStorage"};t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.command.form"]),(0,i.extendStanzaError)({commandError:(0,i.childEnum)(r.NS_ADHOC_COMMANDS,["bad-action","bad-locale","bad-payload","bad-sessionid","malformed-action","session-expired"])}),{element:"command",fields:{action:(0,i.attribute)("action"),node:(0,i.attribute)("node"),sid:(0,i.attribute)("sessionid"),status:(0,i.attribute)("status")},namespace:r.NS_ADHOC_COMMANDS,path:"iq.command"},{element:"actions",fields:{complete:(0,i.childBoolean)(null,"complete"),execute:(0,i.attribute)("execute"),next:(0,i.childBoolean)(null,"next"),prev:(0,i.childBoolean)(null,"prev")},namespace:r.NS_ADHOC_COMMANDS,path:"iq.command.availableActions"},{aliases:[{path:"iq.command.notes",multiple:!0}],element:"note",fields:{type:(0,i.attribute)("type"),value:(0,i.text)()},namespace:r.NS_ADHOC_COMMANDS}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s="vcardTemp.records";function o(e,t){return{aliases:[{multiple:!0,path:s}],element:e,fields:{value:(0,i.text)()},namespace:r.NS_VCARD_TEMP,type:t,typeField:"type"}}const a=[{aliases:[{path:"iq.vcard"}],defaultType:r.NS_VCARD_TEMP,element:"vCard",fields:{fullName:(0,i.childText)(null,"FN")},namespace:r.NS_VCARD_TEMP,path:"vcardTemp",type:r.NS_VCARD_TEMP,typeField:"format"},{element:"N",fields:{additional:{...(0,i.childText)(null,"MIDDLE"),order:3},family:{...(0,i.childText)(null,"FAMILY"),order:1},given:{...(0,i.childText)(null,"GIVEN"),order:2},prefix:{...(0,i.childText)(null,"PREFIX"),order:4},suffix:{...(0,i.childText)(null,"SUFFIX"),order:5}},namespace:r.NS_VCARD_TEMP,path:"vcardTemp.name"},o("NICKNAME","nickname"),o("BDAY","birthday"),o("JABBERID","jid"),o("TZ","timezone"),o("TITLE","title"),o("ROLE","role"),o("URL","url"),o("NOTE","note"),o("SORT-STRING","sort"),o("UID","uid"),o("REV","revision"),o("PRODID","productId"),o("DESC","description"),{aliases:[{multiple:!0,path:s}],element:"EMAIL",fields:{preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["internet","INTERNET"]]),value:(0,i.childText)(null,"USERID")},namespace:r.NS_VCARD_TEMP,type:"email"},{aliases:[{path:s,multiple:!0}],element:"ORG",fields:{units:{...(0,i.multipleChildText)(null,"ORGUNIT"),order:2},value:{...(0,i.childText)(null,"ORGNAME"),order:1}},namespace:r.NS_VCARD_TEMP,type:"organization",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"ADR",fields:{city:(0,i.childText)(null,"LOCALITY"),code:(0,i.childText)(null,"PCODE"),country:(0,i.childText)(null,"CTRY"),pobox:(0,i.childText)(null,"POBOX"),preferred:(0,i.childBoolean)(null,"PREF"),region:(0,i.childText)(null,"REGION"),street:(0,i.childText)(null,"STREET"),street2:(0,i.childText)(null,"EXTADD"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["domestic","DOM"],["international","INTL"],["postal","POSTAL"],["parcel","PARCEL"]])},namespace:r.NS_VCARD_TEMP,type:"address",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"LABEL",fields:{lines:(0,i.multipleChildText)(null,"LINE"),preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"]])},namespace:r.NS_VCARD_TEMP,type:"addressLabel",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"TEL",fields:{preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["cell","CELL"],["fax","FAX"],["voice","VOICE"],["msg","MSG"]]),value:(0,i.childText)(null,"NUMBER","",!0)},namespace:r.NS_VCARD_TEMP,type:"tel",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"PHOTO",fields:{data:(0,i.childText)(null,"BINVAL"),mediaType:(0,i.childText)(null,"TYPE"),url:(0,i.childText)(null,"EXTVAL")},namespace:r.NS_VCARD_TEMP,type:"photo",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"LOGO",fields:{data:(0,i.childText)(null,"BINVAL"),mediaType:(0,i.childText)(null,"TYPE"),url:(0,i.childText)(null,"EXTVAL")},namespace:r.NS_VCARD_TEMP,type:"logo",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"CATEGORIES",fields:{value:(0,i.multipleChildText)(null,"KEYWORD")},namespace:r.NS_VCARD_TEMP,type:"categories",typeField:"type"}];t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.search.form"]),(0,i.addAlias)(r.NS_RSM,"set",["iq.search.paging"]),{element:"query",fields:{email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),givenName:(0,i.childText)(null,"first"),instructions:(0,i.childText)(null,"instructions"),nick:(0,i.childText)(null,"nick")},namespace:r.NS_SEARCH,path:"iq.search"},{aliases:[{path:"iq.search.items",multiple:!0}],element:"item",fields:{email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),givenName:(0,i.childText)(null,"first"),jid:(0,i.JIDAttribute)("jid"),nick:(0,i.childText)(null,"nick")},namespace:r.NS_SEARCH}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["iq.pubsub.paging"],element:"set",fields:{after:(0,i.childText)(null,"after"),before:(0,i.childText)(null,"before"),count:(0,i.childInteger)(null,"count"),first:(0,i.childText)(null,"first"),firstIndex:(0,i.childIntegerAttribute)(null,"first","index"),index:(0,i.childInteger)(null,"index"),last:(0,i.childText)(null,"last"),max:(0,i.childInteger)(null,"max")},namespace:r.NS_RSM,path:"paging"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={configurable:(0,r.childBoolean)(null,"subscribe-options"),configurationRequired:(0,r.deepChildBoolean)([{namespace:null,element:"subscribe-options"},{namespace:null,element:"required"}]),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),state:(0,r.attribute)("subscription"),subid:(0,r.attribute)("subid")},a={node:(0,r.attribute)("node")},c=[{aliases:["pubsub","iq.pubsub","message.pubsub"],childrenExportOrder:{configure:0,create:100,publish:100,subscribe:100,subscriptionOptions:0},defaultType:"user",element:"pubsub",fields:{publishOptions:(0,r.splicePath)(null,"publish-options","dataform")},namespace:s.NS_PUBSUB,type:"user",typeField:"context"},{aliases:["pubsub","iq.pubsub","message.pubsub"],defaultType:"user",element:"pubsub",fields:{purge:(0,r.childAttribute)(null,"purge","node")},namespace:s.NS_PUBSUB_OWNER,type:"owner",typeField:"context"},(0,r.addAlias)(s.NS_DATAFORM,"x",["iq.pubsub.configure.form","iq.pubsub.defaultConfiguration.form","iq.pubsub.defaultSubscriptionOptions.form","iq.pubsub.subscriptionOptions.form","message.pubsub.configuration.form"]),(0,r.addAlias)(s.NS_RSM,"set",["iq.pubsub.fetch.paging"]),(0,r.extendStanzaError)({pubsubError:(0,r.childEnum)(s.NS_PUBSUB_ERRORS,Object.values(i.PubsubErrorCondition)),pubsubUnsupportedFeature:(0,r.childAttribute)(s.NS_PUBSUB_ERRORS,"unsupported","feature")}),{element:"subscribe",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.subscribe"},{element:"unsubscribe",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid")},namespace:s.NS_PUBSUB,path:"iq.pubsub.unsubscribe"},{element:"options",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid")},namespace:s.NS_PUBSUB,path:"iq.pubsub.subscriptionOptions"},{aliases:[{path:"iq.pubsub.subscriptions",selector:"user",impliedType:!0}],element:"subscriptions",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,type:"user"},{aliases:[{path:"iq.pubsub.subscriptions",selector:"owner",impliedType:!0}],element:"subscriptions",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.subscription",selector:"owner"},{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"owner"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB},{aliases:[{path:"iq.pubsub.subscription",selector:"user"},{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"user"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB,type:"user"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"owner"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.affiliations",selector:"user",impliedType:!0},{path:"message.pubsub.affiliations",selector:"user",impliedType:!0}],element:"affiliations",fields:a,namespace:s.NS_PUBSUB,type:"user"},{aliases:[{path:"iq.pubsub.affiliations",selector:"owner",impliedType:!0}],element:"affiliations",fields:a,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.affiliations.items",selector:"user"},{impliedType:!0,multiple:!0,path:"message.pubsub.affiliations.items",selector:"user"}],element:"affiliation",fields:{affiliation:(0,r.attribute)("affiliation"),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,type:"user"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.affiliations.items",selector:"owner"}],element:"affiliation",fields:{affiliation:(0,r.attribute)("affiliation"),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB_OWNER,type:"owner"},{element:"create",fields:a,namespace:s.NS_PUBSUB,path:"iq.pubsub.create"},{aliases:[{path:"iq.pubsub.destroy",selector:"owner"}],element:"delete",fields:{node:(0,r.attribute)("node"),redirect:(0,r.childAttribute)(null,"redirect","uri")},namespace:s.NS_PUBSUB_OWNER},{aliases:[{path:"iq.pubsub.configure",selector:"owner",impliedType:!0}],element:"configure",fields:a,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.configure",selector:"user",impliedType:!0}],element:"configure",fields:a,namespace:s.NS_PUBSUB,type:"user"},{element:"default",fields:{node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.defaultSubscriptionOptions"},{element:"default",fields:{},namespace:s.NS_PUBSUB_OWNER,path:"iq.pubsub.defaultConfiguration"},{element:"publish",fields:a,namespace:s.NS_PUBSUB,path:"iq.pubsub.publish"},{element:"retract",fields:{id:(0,r.childAttribute)(null,"item","id"),node:(0,r.attribute)("node"),notify:(0,r.booleanAttribute)("notify")},namespace:s.NS_PUBSUB,path:"iq.pubsub.retract"},{element:"items",fields:{max:(0,r.integerAttribute)("max_items"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.fetch"},{aliases:["pubsubitem","iq.pubsub.publish.item",{multiple:!0,path:"iq.pubsub.fetch.items"}],element:"item",fields:{id:(0,r.attribute)("id"),publisher:(0,r.JIDAttribute)("publisher")},namespace:s.NS_PUBSUB},{element:"event",fields:{eventType:(0,r.childEnum)(null,["purge","delete","subscription","configuration","items"])},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub",type:"event",typeField:"context"},{aliases:[{path:"message.pubsub.items.published",multiple:!0}],element:"item",fields:{id:(0,r.attribute)("id"),publisher:(0,r.JIDAttribute)("publisher")},namespace:s.NS_PUBSUB_EVENT,path:"pubsubeventitem"},{element:"purge",fields:a,namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.purge"},{element:"delete",fields:{node:(0,r.attribute)("node"),redirect:(0,r.childAttribute)(null,"redirect","uri")},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.delete"},{aliases:[{path:"message.pubsub.subscription",selector:"event",impliedType:!0}],element:"subscription",fields:{expires:(u="expiry",{importer(e){const t=e.getAttribute(u);return"presence"===t?t:t?new Date(t):void 0},exporter(e,t){let n;n="string"==typeof t?t:t.toISOString(),e.setAttribute(u,n)}}),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid"),type:(0,r.attribute)("subscription")},namespace:s.NS_PUBSUB_EVENT,type:"event"},{element:"configuration",fields:a,namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.configuration"},{element:"items",fields:{node:(0,r.attribute)("node"),retracted:(0,r.multipleChildAttribute)(null,"retract","id")},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.items"}];var u;t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"query",fields:{activate:(0,i.childText)(null,"activate"),address:(0,i.attribute)("dstaddr"),candidateUsed:(0,i.childJIDAttribute)(null,"streamhost-used","jid"),mode:(0,i.attribute)("mode","tcp"),sid:(0,i.attribute)("sid"),udpSuccess:(0,i.childAttribute)(null,"udpsuccess","dstaddr")},namespace:r.NS_SOCKS5,path:"iq.socks5"},{aliases:[{multiple:!0,path:"iq.socks5.candidates"}],element:"streamhost",fields:{host:(0,i.attribute)("host"),jid:(0,i.JIDAttribute)("jid"),port:(0,i.integerAttribute)("port"),uri:(0,i.attribute)("uri")},namespace:r.NS_SOCKS5}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{multiple:!0,path:"message.links"}],element:"x",fields:{description:(0,i.childText)(null,"desc"),url:(0,i.childText)(null,"url")},namespace:r.NS_OOB},{element:"query",fields:{description:(0,i.childText)(null,"desc"),url:(0,i.childText)(null,"url")},namespace:r.NS_OOB_TRANSFER,path:"iq.transferLink"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"html",fields:{alternateLanguageBodies:(0,i.childAlternateLanguageRawElement)(r.NS_XHTML,"body","xhtmlim"),body:(0,i.childLanguageRawElement)(r.NS_XHTML,"body","xhtmlim")},namespace:r.NS_XHTML_IM,path:"message.html"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({inbandRegistration:(0,i.childBoolean)(r.NS_INBAND_REGISTRATION,"register")}),(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.account.form"]),(0,i.addAlias)(r.NS_OOB,"x",["iq.account.registrationLink"]),{element:"query",fields:{address:(0,i.childText)(null,"address"),date:(0,i.childDate)(null,"date"),email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),fullName:(0,i.childText)(null,"name"),givenName:(0,i.childText)(null,"first"),instructions:(0,i.childText)(null,"instructions"),key:(0,i.childText)(null,"key"),locality:(0,i.childText)(null,"city"),misc:(0,i.childText)(null,"misc"),nick:(0,i.childText)(null,"nick"),password:(0,i.childText)(null,"password"),phone:(0,i.childText)(null,"phone"),postalCode:(0,i.childText)(null,"zip"),region:(0,i.childText)(null,"state"),registered:(0,i.childBoolean)(null,"registered"),remove:(0,i.childBoolean)(null,"remove"),text:(0,i.childText)(null,"text"),uri:(0,i.childText)(null,"uri"),username:(0,i.childText)(null,"username")},namespace:r.NS_REGISTER,path:"iq.account"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"message.geoloc",impliedType:!0},{path:"dataform.fields.geoloc",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"geoloc",fields:{accuracy:(0,i.childFloat)(null,"accuracy"),altitude:(0,i.childFloat)(null,"alt"),altitudeAccuracy:(0,i.childFloat)(null,"altaccuracy"),area:(0,i.childText)(null,"area"),building:(0,i.childText)(null,"building"),country:(0,i.childText)(null,"country"),countryCode:(0,i.childText)(null,"countrycode"),datum:(0,i.childText)(null,"datum"),description:(0,i.childText)(null,"description"),error:(0,i.childFloat)(null,"error"),floor:(0,i.childText)(null,"floor"),heading:(0,i.childFloat)(null,"bearing"),lang:(0,i.languageAttribute)(),latitude:(0,i.childFloat)(null,"lat"),locality:(0,i.childText)(null,"locality"),longitude:(0,i.childFloat)(null,"lon"),postalCode:(0,i.childText)(null,"postalcode"),region:(0,i.childText)(null,"region"),room:(0,i.childText)(null,"room"),speed:(0,i.childFloat)(null,"speed"),street:(0,i.childText)(null,"street"),text:(0,i.childText)(null,"text"),timestamp:(0,i.childDate)(null,"timestamp"),tzo:(0,i.childTimezoneOffset)(null,"tzo"),uri:(0,i.childText)(null,"uri")},namespace:r.NS_GEOLOC,type:r.NS_GEOLOC};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:(0,i.pubsubItemContentAliases)(),element:"data",fields:{data:(0,i.textBuffer)("base64")},namespace:r.NS_AVATAR_DATA,path:"avatar",type:r.NS_AVATAR_DATA,typeField:"itemType"},{aliases:[{path:"avatar",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"metadata",namespace:r.NS_AVATAR_METADATA,type:r.NS_AVATAR_METADATA,typeField:"itemType",childrenExportOrder:{versions:1,pointers:2}},{aliases:[{multiple:!0,path:"avatar.versions",selector:r.NS_AVATAR_METADATA}],element:"info",fields:{bytes:(0,i.integerAttribute)("bytes"),height:(0,i.integerAttribute)("height"),id:(0,i.attribute)("id"),mediaType:(0,i.attribute)("type"),uri:(0,i.attribute)("url"),width:(0,i.integerAttribute)("width")},namespace:r.NS_AVATAR_METADATA},{aliases:[{multiple:!0,path:"avatar.pointers",selector:r.NS_AVATAR_METADATA}],element:"pointer",fields:{bytes:(0,i.integerAttribute)("bytes"),height:(0,i.integerAttribute)("height"),id:(0,i.attribute)("id"),mediaType:(0,i.attribute)("type"),width:(0,i.integerAttribute)("width")},namespace:r.NS_AVATAR_METADATA}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1);t.default=(0,r.extendMessage)({chatState:(0,r.childEnum)(s.NS_CHAT_STATES,Object.values(i.ChatState))})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"query",fields:{name:(0,i.childText)(null,"name"),os:(0,i.childText)(null,"os"),version:(0,i.childText)(null,"version")},namespace:r.NS_VERSION,path:"iq.softwareVersion"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={aliases:[{path:"message.mood",impliedType:!0},...(0,r.pubsubItemContentAliases)()],element:"mood",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(null,"text"),text:(0,r.childText)(null,"text"),value:(0,r.childEnum)(null,i.USER_MOODS)},namespace:s.NS_MOOD,type:s.NS_MOOD};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={aliases:[{path:"activity",impliedType:!0},...(0,r.pubsubItemContentAliases)()],element:"activity",fields:{activity:(0,r.childDoubleEnum)(null,i.USER_ACTIVITY_GENERAL,i.USER_ACTIVITY_SPECIFIC),alternateLanguageText:(0,r.childAlternateLanguageText)(null,"text"),text:(0,r.childText)(null,"text")},namespace:s.NS_ACTIVITY,type:s.NS_ACTIVITY};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"handshake",fields:{value:(0,i.textBuffer)("hex")},namespace:r.NS_COMPONENT,path:"handshake"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"presence.legacyCapabilities",multiple:!0},{path:"features.legacyCapabilities",multiple:!0}],element:"c",fields:{algorithm:(0,i.attribute)("hash"),legacy:(0,i.staticValue)(!0),node:(0,i.attribute)("node"),value:(0,i.attribute)("ver")},namespace:r.NS_DISCO_LEGACY_CAPS};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{impliedType:!0,path:"tune"},...(0,i.pubsubItemContentAliases)()],element:"tune",fields:{artist:(0,i.childText)(null,"artist"),length:(0,i.childInteger)(null,"length"),rating:(0,i.childInteger)(null,"rating"),source:(0,i.childText)(null,"source"),title:(0,i.childText)(null,"title"),track:(0,i.childText)(null,"track"),uri:(0,i.childText)(null,"uri")},namespace:r.NS_TUNE,type:r.NS_TUNE};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=["dataformLayout",{multiple:!0,path:"dataformLayout.contents"},{multiple:!0,path:"dataform.layout.contents"}],o=[{aliases:[{multiple:!0,path:"dataform.layout"}],element:"page",fields:{label:(0,i.attribute)("label")},namespace:r.NS_DATAFORM_LAYOUT},{aliases:s,element:"section",fields:{label:(0,i.attribute)("label")},namespace:r.NS_DATAFORM_LAYOUT,type:"section",typeField:"type"},{aliases:s,element:"text",fields:{value:(0,i.text)()},namespace:r.NS_DATAFORM_LAYOUT,type:"text",typeField:"type"},{aliases:s,element:"fieldref",fields:{field:(0,i.attribute)("var")},namespace:r.NS_DATAFORM_LAYOUT,type:"fieldref",typeField:"type"},{aliases:s,element:"reportedref",namespace:r.NS_DATAFORM_LAYOUT,type:"reportedref",typeField:"type"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"body",fields:{acceptMediaTypes:(0,i.attribute)("accept"),ack:(0,i.integerAttribute)("ack"),authId:(0,i.attribute)("authid"),characterSets:(0,i.attribute)("charsets"),condition:(0,i.attribute)("condition"),from:(0,i.JIDAttribute)("from"),key:(0,i.attribute)("key"),lang:(0,i.languageAttribute)(),maxClientRequests:(0,i.integerAttribute)("requests"),maxHoldOpen:(0,i.integerAttribute)("hold"),maxInactivityTime:(0,i.integerAttribute)("inactivity"),maxSessionPause:(0,i.integerAttribute)("maxpause"),maxWaitTime:(0,i.integerAttribute)("wait"),mediaType:(0,i.attribute)("content"),minPollingInterval:(0,i.integerAttribute)("polling"),newKey:(0,i.attribute)("newkey"),pauseSession:(0,i.integerAttribute)("pause"),report:(0,i.integerAttribute)("report"),rid:(0,i.integerAttribute)("rid"),route:(0,i.attribute)("string"),seeOtherURI:(0,i.childText)(null,"uri"),sid:(0,i.attribute)("sid"),stream:(0,i.attribute)("stream"),time:(0,i.integerAttribute)("time"),to:(0,i.JIDAttribute)("to"),type:(0,i.attribute)("type"),version:(0,i.attribute)("ver"),xmppRestart:(0,i.namespacedBooleanAttribute)("xmpp",r.NS_BOSH_XMPP,"restart",void 0,{writeValue:e=>e?"true":"false"}),xmppRestartLogic:(0,i.namespacedBooleanAttribute)("xmpp",r.NS_BOSH_XMPP,"restartlogic",void 0,{writeValue:e=>e?"true":"false"}),xmppVersion:(0,i.namespacedAttribute)("xmpp",r.NS_BOSH_XMPP,"version")},namespace:r.NS_BOSH,path:"bosh"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({headers:(0,i.splicePath)(r.NS_SHIM,"headers","header",!0)}),(0,i.extendPresence)({headers:(0,i.splicePath)(r.NS_SHIM,"headers","header",!0)}),{element:"header",fields:{name:(0,i.attribute)("name"),value:(0,i.text)()},namespace:r.NS_SHIM,path:"header"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"compression",fields:{methods:(0,i.multipleChildText)(null,"method")},namespace:r.NS_COMPRESSION_FEATURE,path:"features.compression"},{element:"compress",fields:{method:(0,i.childText)(null,"method")},namespace:r.NS_COMPRESSION,path:"compression",type:"start",typeField:"type"},{aliases:["error.compressionError"],element:"failure",fields:{condition:(0,i.childEnum)(null,["unsupported-method","setup-failed","processing-failed"])},namespace:r.NS_COMPRESSION,path:"compression",type:"failure",typeField:"type"},{element:"compressed",namespace:r.NS_COMPRESSION,path:"compression",type:"success",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({rosterExchange:(0,i.splicePath)(r.NS_ROSTER_EXCHANGE,"x","rosterExchange",!0)}),(0,i.extendIQ)({rosterExchange:(0,i.splicePath)(r.NS_ROSTER_EXCHANGE,"x","rosterExchange",!0)}),{element:"item",fields:{action:(0,i.attribute)("action"),groups:(0,i.multipleChildText)(null,"group"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name")},namespace:r.NS_ROSTER_EXCHANGE,path:"rosterExchange"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendPresence)({vcardAvatar:{importer(e){const t=(0,i.findAll)(e,r.NS_VCARD_TEMP_UPDATE,"x");if(!t.length)return;const n=(0,i.findAll)(t[0],r.NS_VCARD_TEMP_UPDATE,"photo");return!n.length||n[0].getText()},exporter(e,t){const n=(0,i.findOrCreate)(e,r.NS_VCARD_TEMP_UPDATE,"x");if(""===t)(0,i.findOrCreate)(n,r.NS_VCARD_TEMP_UPDATE,"photo");else{if(!0===t)return;if(t){(0,i.findOrCreate)(n,r.NS_VCARD_TEMP_UPDATE,"photo").children.push(t)}}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({captcha:(0,i.splicePath)(r.NS_CAPTCHA,"captcha","dataform")}),(0,i.extendIQ)({captcha:(0,i.splicePath)(r.NS_CAPTCHA,"captcha","dataform")})];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o=[(0,r.extendStanzaError)({jingleError:(0,r.childEnum)(s.NS_JINGLE_ERRORS_1,Object.values(i.JingleErrorCondition))}),{element:"jingle",fields:{action:(0,r.attribute)("action"),initiator:(0,r.JIDAttribute)("initiator"),responder:(0,r.JIDAttribute)("responder"),sid:(0,r.attribute)("sid")},namespace:s.NS_JINGLE_1,path:"iq.jingle"},{aliases:[{multiple:!0,path:"iq.jingle.contents"}],element:"content",fields:{creator:(0,r.attribute)("creator"),disposition:(0,r.attribute)("disposition","session"),name:(0,r.attribute)("name"),senders:(0,r.attribute)("senders","both")},namespace:s.NS_JINGLE_1},{element:"reason",fields:{alternativeSession:(0,r.childText)(null,"alternative-session"),condition:(0,r.childEnum)(null,Object.values(i.JingleReasonCondition)),text:(0,r.childText)(null,"text")},namespace:s.NS_JINGLE_1,path:"iq.jingle.reason"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1);function o(){return{importer(e,t){let n=(0,r.findAll)(e,s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb");const i=(0,r.attribute)("type").importer,o=(0,r.attribute)("subtype").importer,a=(0,r.attribute)("value").importer,c=[];for(const e of n){const n=i(e,t),r=o(e,t);c.push(r?{type:n,parameter:r}:{type:n})}n=(0,r.findAll)(e,s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb-trr-int");for(const e of n){const n=a(e,t);c.push(n?{type:"trr-int",parameter:n}:{type:"trr-int"})}return c},exporter(e,t,n){const i=(0,r.attribute)("type").exporter,o=(0,r.attribute)("subtype").exporter,a=(0,r.attribute)("value").exporter;for(const c of t){let t;"trr-int"===c.type?(t=(0,r.createElement)(s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb-trr-int",n.namespace,e),c.parameter&&a(t,c.parameter,n)):(t=(0,r.createElement)(s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb",n.namespace,e),i(t,c.type,n),c.parameter&&o(t,c.parameter,n)),e.appendChild(t)}}}}const a="iq.jingle.info",c=[{aliases:["iq.jingle.contents.application"],childrenExportOrder:{codecs:4,encryption:5,headerExtensions:6,sourceGroups:8,sources:7,streams:9},element:"description",fields:{media:(0,r.attribute)("media"),rtcpFeedback:{...o(),exportOrder:3},rtcpMux:{...(0,r.childBoolean)(null,"rtcp-mux"),exportOrder:1},rtcpReducedSize:{...(0,r.childBoolean)(null,"rtcp-reduced-size"),exportOrder:2},ssrc:(0,r.attribute)("ssrc")},namespace:s.NS_JINGLE_RTP_1,optionalNamespaces:{rtcpf:s.NS_JINGLE_RTP_RTCP_FB_0,rtph:s.NS_JINGLE_RTP_HDREXT_0},type:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.headerExtensions",selector:s.NS_JINGLE_RTP_1}],element:"rtp-hdrext",fields:{id:(0,r.integerAttribute)("id"),senders:(0,r.attribute)("senders"),uri:(0,r.attribute)("uri")},namespace:s.NS_JINGLE_RTP_HDREXT_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.codecs",selector:s.NS_JINGLE_RTP_1},"rtpcodec"],element:"payload-type",fields:{channels:(0,r.integerAttribute)("channels"),clockRate:(0,r.integerAttribute)("clockrate"),id:(0,r.attribute)("id"),maxptime:(0,r.integerAttribute)("maxptime"),name:(0,r.attribute)("name"),parameters:(0,r.parameterMap)(s.NS_JINGLE_RTP_1,"parameter","name","value"),ptime:(0,r.integerAttribute)("ptime"),rtcpFeedback:o()},namespace:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.sources",selector:s.NS_JINGLE_RTP_1}],element:"source",fields:{parameters:(0,r.parameterMap)(s.NS_JINGLE_RTP_SSMA_0,"parameter","name","value"),ssrc:(0,r.attribute)("ssrc")},namespace:s.NS_JINGLE_RTP_SSMA_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.sourceGroups",selector:s.NS_JINGLE_RTP_1}],element:"ssrc-group",fields:{semantics:(0,r.attribute)("semantics"),sources:(0,r.multipleChildAttribute)(null,"source","ssrc")},namespace:s.NS_JINGLE_RTP_SSMA_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.streams",selector:s.NS_JINGLE_RTP_1}],element:"stream",fields:{id:(0,r.attribute)("id"),track:(0,r.attribute)("track")},namespace:s.NS_JINGLE_RTP_MSID_0},{aliases:[{path:"iq.jingle.contents.application.encryption",selector:s.NS_JINGLE_RTP_1}],element:"encryption",fields:{required:(0,r.booleanAttribute)("required")},namespace:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.encryption.sdes",selector:s.NS_JINGLE_RTP_1}],element:"crypto",fields:{cryptoSuite:(0,r.attribute)("crypto-suite"),keyParameters:(0,r.attribute)("key-params"),sessionParameters:(0,r.attribute)("session-params"),tag:(0,r.integerAttribute)("tag")},namespace:s.NS_JINGLE_RTP_1},{aliases:[{path:"iq.jingle.contents.application.encryption.zrtp",selector:s.NS_JINGLE_RTP_1}],element:"zrtp-hash",fields:{value:(0,r.textBuffer)("hex"),version:(0,r.attribute)("version")},namespace:s.NS_JINGLE_RTP_1},{element:"mute",fields:{creator:(0,r.attribute)("creator"),name:(0,r.attribute)("name")},namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_MUTE},{element:"unmute",fields:{creator:(0,r.attribute)("creator"),name:(0,r.attribute)("name")},namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_UNMUTE},{element:"hold",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_HOLD},{element:"unhold",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_UNHOLD},{element:"active",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_ACTIVE},{element:"ringing",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_RINGING}];t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({nick:(0,i.childText)(r.NS_NICK,"nick")}),(0,i.extendPresence)({nick:(0,i.childText)(r.NS_NICK,"nick")}),{aliases:(0,i.pubsubItemContentAliases)(),element:"nick",fields:{nick:(0,i.text)()},namespace:r.NS_NICK,type:r.NS_NICK}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=e=>[{element:"transport",fields:{gatheringComplete:(0,i.childBoolean)(null,"gathering-complete"),password:(0,i.attribute)("pwd"),usernameFragment:(0,i.attribute)("ufrag")},namespace:e,path:"iq.jingle.contents.transport",type:e,typeField:"transportType"},{aliases:[{impliedType:!0,path:"iq.jingle.contents.transport.remoteCandidate",selector:e}],element:"remote-candidate",fields:{component:(0,i.integerAttribute)("component"),ip:(0,i.attribute)("ip"),port:(0,i.integerAttribute)("port")},namespace:e,type:e,typeField:"transportType"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:e}],element:"candidate",fields:{component:(0,i.integerAttribute)("component"),foundation:(0,i.attribute)("foundation"),generation:(0,i.integerAttribute)("generation"),id:(0,i.attribute)("id"),ip:(0,i.attribute)("ip"),network:(0,i.integerAttribute)("network"),port:(0,i.integerAttribute)("port"),priority:(0,i.integerAttribute)("priority"),protocol:(0,i.attribute)("protocol"),relatedAddress:(0,i.attribute)("rel-addr"),relatedPort:(0,i.attribute)("rel-port"),tcpType:(0,i.attribute)("tcptype"),type:(0,i.attribute)("type")},namespace:e,type:e,typeField:"transportType"}],o=[...s(r.NS_JINGLE_ICE_0),...s(r.NS_JINGLE_ICE_UDP_1)];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"transport",fields:{gatheringComplete:(0,i.childBoolean)(null,"gathering-complete"),password:(0,i.attribute)("pwd"),usernameFragment:(0,i.attribute)("ufrag")},namespace:r.NS_JINGLE_RAW_UDP_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_RAW_UDP_1,typeField:"transportType"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:r.NS_JINGLE_RAW_UDP_1}],element:"candidate",fields:{component:(0,i.integerAttribute)("component"),foundation:(0,i.attribute)("foundation"),generation:(0,i.integerAttribute)("generation"),id:(0,i.attribute)("id"),ip:(0,i.attribute)("ip"),port:(0,i.integerAttribute)("port"),type:(0,i.attribute)("type")},namespace:r.NS_JINGLE_RAW_UDP_1,type:r.NS_JINGLE_RAW_UDP_1,typeField:"transportType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"request",namespace:r.NS_RECEIPTS,path:"message.receipt",type:"request",typeField:"type"},{element:"received",fields:{id:(0,i.attribute)("id")},namespace:r.NS_RECEIPTS,path:"message.receipt",type:"received",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"invisible",fields:{probe:(0,i.booleanAttribute)("probe")},namespace:r.NS_INVISIBLE_0,path:"iq.visibility",type:"invisible",typeField:"type"},{element:"visible",namespace:r.NS_INVISIBLE_0,path:"iq.visibility",type:"visible"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStanzaError)({blocked:(0,i.childBoolean)(r.NS_BLOCKING_ERRORS,"blocked")}),{element:"blocklist",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"list",typeField:"action"},{element:"block",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"block",typeField:"action"},{element:"unblock",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"unblock",typeField:"action"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({streamManagement:(0,i.childBoolean)(r.NS_SMACKS_3,"sm")}),{element:"a",fields:{handled:(0,i.integerAttribute)("h")},namespace:r.NS_SMACKS_3,path:"sm",type:"ack",typeField:"type"},{element:"r",namespace:r.NS_SMACKS_3,path:"sm",type:"request",typeField:"type"},{element:"enable",fields:{allowResumption:(0,i.booleanAttribute)("resume")},namespace:r.NS_SMACKS_3,path:"sm",type:"enable",typeField:"type"},{element:"enabled",fields:{id:(0,i.attribute)("id"),resume:(0,i.booleanAttribute)("resume")},namespace:r.NS_SMACKS_3,path:"sm",type:"enabled",typeField:"type"},{element:"resume",fields:{handled:(0,i.integerAttribute)("h"),previousSession:(0,i.attribute)("previd")},namespace:r.NS_SMACKS_3,path:"sm",type:"resume",typeField:"type"},{element:"resumed",fields:{handled:(0,i.integerAttribute)("h"),previousSession:(0,i.attribute)("previd")},namespace:r.NS_SMACKS_3,path:"sm",type:"resumed",typeField:"type"},{element:"failed",fields:{handled:(0,i.integerAttribute)("h")},namespace:r.NS_SMACKS_3,path:"sm",type:"failed",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendIQ)({ping:(0,i.childBoolean)(r.NS_PING,"ping")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"time",fields:{tzo:(0,i.childTimezoneOffset)(null,"tzo"),utc:(0,i.childDate)(null,"utc")},namespace:r.NS_TIME,path:"iq.time"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["message.delay","presence.delay"],element:"delay",fields:{from:(0,i.JIDAttribute)("from"),reason:(0,i.text)(),timestamp:(0,i.dateAttribute)("stamp")},namespace:r.NS_DELAY};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={2:r.NS_DISCO_EXTERNAL_2,1:r.NS_DISCO_EXTERNAL_1},o=[];for(const[e,t]of Object.entries(s))o.push({aliases:["iq.externalServiceCredentials"],defaultType:"2",element:"credentials",fields:{expires:(0,i.childDateAttribute)(null,"service","expires"),host:(0,i.childAttribute)(null,"service","host"),name:(0,i.childAttribute)(null,"service","name"),password:(0,i.childAttribute)(null,"service","password"),port:(0,i.childIntegerAttribute)(null,"service","port"),restricted:(0,i.childBooleanAttribute)(null,"service","restricted"),transport:(0,i.childAttribute)(null,"service","transport"),type:(0,i.childAttribute)(null,"service","type"),username:(0,i.childAttribute)(null,"service","username")},namespace:t,type:e,typeField:"version"},{aliases:["iq.externalServices"],defaultType:"2",element:"services",fields:{type:(0,i.attribute)("type")},namespace:t,type:e,typeField:"version"},{aliases:[{path:"iq.externalServices.services",multiple:!0}],defaultType:"2",element:"service",fields:{expires:(0,i.dateAttribute)("expires"),host:(0,i.attribute)("host"),name:(0,i.attribute)("name"),password:(0,i.attribute)("password"),port:(0,i.integerAttribute)("port"),restricted:(0,i.booleanAttribute)("restricted"),transport:(0,i.attribute)("transport"),type:(0,i.attribute)("type"),username:(0,i.attribute)("username")},namespace:t,type:e,typeField:"version"});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"media",fields:{height:(0,i.integerAttribute)("height"),width:(0,i.integerAttribute)("width")},namespace:r.NS_DATAFORM_MEDIA,path:"dataform.fields.media"},{aliases:[{multiple:!0,path:"dataform.fields.media.sources"}],element:"uri",fields:{mediaType:(0,i.attribute)("type"),uri:(0,i.text)()},namespace:r.NS_DATAFORM_MEDIA}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({requestingAttention:(0,i.childBoolean)(r.NS_ATTENTION_0,"attention")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["iq.bits",{path:"message.bits",multiple:!0},{path:"presence.bits",multiple:!0},{path:"iq.jingle.bits",multiple:!0}],element:"data",fields:{cid:(0,i.attribute)("cid"),data:(0,i.textBuffer)("base64"),maxAge:(0,i.integerAttribute)("max-age"),mediaType:(0,i.attribute)("type")},namespace:r.NS_BOB};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);let s=[(0,i.addAlias)(r.NS_HASHES_2,"hash",[{path:"file.hashes",multiple:!0},{path:"file.range.hashes",multiple:!0}]),(0,i.addAlias)(r.NS_HASHES_1,"hash",[{path:"file.hashes",multiple:!0},{path:"file.range.hashes",multiple:!0}]),(0,i.addAlias)(r.NS_HASHES_2,"hash-used",[{path:"file.hashesUsed",multiple:!0}]),(0,i.addAlias)(r.NS_THUMBS_1,"thumbnail",[{path:"file.thumbnails",multiple:!0}])];for(const e of[r.NS_JINGLE_FILE_TRANSFER_4,r.NS_JINGLE_FILE_TRANSFER_5])s=s.concat([{aliases:["file",{impliedType:!0,path:"iq.jingle.contents.application.file",selector:e},{impliedType:!0,path:"iq.jingle.info.file",selector:`{${e}}checksum`}],defaultType:r.NS_JINGLE_FILE_TRANSFER_5,element:"file",fields:{date:(0,i.childDate)(null,"date"),description:(0,i.childText)(null,"desc"),mediaType:(0,i.childText)(null,"media-type"),name:(0,i.childText)(null,"name"),size:(0,i.childInteger)(null,"size")},namespace:e,type:e,typeField:"version"},{aliases:[{impliedType:!0,path:"file.range",selector:e}],defaultType:r.NS_JINGLE_FILE_TRANSFER_5,element:"range",fields:{length:(0,i.integerAttribute)("length"),offset:(0,i.integerAttribute)("offset",0)},namespace:e,type:e,typeField:"version"},{element:"description",namespace:e,path:"iq.jingle.contents.application",type:e,typeField:"applicationType"},{element:"received",fields:{creator:(0,i.attribute)("creator"),name:(0,i.attribute)("name")},namespace:e,path:"iq.jingle.info",type:`{${e}}received`,typeField:"infoType"},{element:"checksum",fields:{creator:(0,i.attribute)("creator"),name:(0,i.attribute)("name")},namespace:e,path:"iq.jingle.info",type:`{${e}}checksum`,typeField:"infoType"}]);t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r={element:"description",namespace:i.NS_JINGLE_XML_0,path:"iq.jingle.contents.application",type:i.NS_JINGLE_XML_0,typeField:"applicationType"};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"transport",fields:{activated:(0,i.childAttribute)(null,"activated","cid"),address:(0,i.attribute)("dstaddr"),candidateError:(0,i.childBoolean)(null,"candidate-error"),candidateUsed:(0,i.childAttribute)(null,"candidate-used","cid"),mode:(0,i.attribute)("mode","tcp"),proxyError:(0,i.childBoolean)(null,"proxy-error"),sid:(0,i.attribute)("sid")},namespace:r.NS_JINGLE_SOCKS5_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_SOCKS5_1,typeField:"transportType"},{aliases:[{multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:r.NS_JINGLE_SOCKS5_1}],element:"candidate",fields:{cid:(0,i.attribute)("cid"),host:(0,i.attribute)("host"),jid:(0,i.JIDAttribute)("jid"),port:(0,i.integerAttribute)("port"),priority:(0,i.integerAttribute)("priority"),type:(0,i.attribute)("type"),uri:(0,i.attribute)("uri")},namespace:r.NS_JINGLE_SOCKS5_1}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"transport",fields:{ack:{importer:(e,t)=>"message"!==(0,i.attribute)("stanza","iq").importer(e,t),exporter(e,t,n){!1===t&&(0,i.attribute)("stanza").exporter(e,"message",n)}},blockSize:(0,i.integerAttribute)("block-size"),sid:(0,i.attribute)("sid")},namespace:r.NS_JINGLE_IBB_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_IBB_1,typeField:"transportType"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_BOB,"data",[{path:"iq.jingle.bits",multiple:!0}]),{element:"thumbnail",fields:{height:(0,i.integerAttribute)("height"),mediaType:(0,i.attribute)("media-type"),uri:(0,i.attribute)("uri"),width:(0,i.integerAttribute)("width")},namespace:r.NS_THUMBS_1,path:"thumbnail"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_FORWARD_0,"forwarded",["message.carbon.forward"]),{element:"enable",namespace:r.NS_CARBONS_2,path:"iq.carbons",type:"enable",typeField:"action"},{element:"disable",namespace:r.NS_CARBONS_2,path:"iq.carbons",type:"disable",typeField:"action"},{element:"sent",namespace:r.NS_CARBONS_2,path:"message.carbon",type:"sent",typeField:"type"},{element:"received",namespace:r.NS_CARBONS_2,path:"message.carbon",type:"received",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(5),s=n(1),o=[...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"message",["forward.message"])),...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"presence",["forward.presence"])),...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"iq",["forward.iq"])),(0,i.addAlias)(s.NS_DELAY,"delay",["forward.delay"]),{aliases:["message.forward"],element:"forwarded",namespace:s.NS_FORWARD_0,path:"forward"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{defaultType:"2",element:"hash",fields:{algorithm:(0,i.attribute)("algo"),value:(0,i.textBuffer)("base64"),version:(0,i.staticValue)("2")},namespace:r.NS_HASHES_2,path:"hash",type:"2",typeField:"version"},{element:"hash-used",fields:{algorithm:(0,i.attribute)("algo"),version:(0,i.staticValue)("2")},namespace:r.NS_HASHES_2,path:"hashUsed"},{element:"hash",fields:{algorithm:(0,i.attribute)("algo"),value:(0,i.textBuffer)("hex"),version:(0,i.staticValue)("1")},namespace:r.NS_HASHES_1,path:"hash",type:"1",typeField:"version"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"rtt",fields:{event:(0,i.attribute)("event","edit"),id:(0,i.attribute)("id"),seq:(0,i.integerAttribute)("seq")},namespace:r.NS_RTT_0,path:"message.rtt"},{aliases:[{path:"message.rtt.actions",multiple:!0}],element:"t",fields:{position:(0,i.integerAttribute)("p"),text:(0,i.text)()},namespace:r.NS_RTT_0,type:"insert",typeField:"type"},{aliases:[{path:"message.rtt.actions",multiple:!0}],element:"e",fields:{length:(0,i.integerAttribute)("n",1),position:(0,i.integerAttribute)("p")},namespace:r.NS_RTT_0,type:"erase",typeField:"type"},{aliases:[{multiple:!0,path:"message.rtt.actions"}],element:"w",fields:{duration:(0,i.integerAttribute)("n",0)},namespace:r.NS_RTT_0,type:"wait",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({replace:(0,i.childAttribute)(r.NS_CORRECTION_0,"replace","id")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={2:r.NS_MAM_2,1:r.NS_MAM_1},o=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.archive.form"]),(0,i.addAlias)(r.NS_FORWARD_0,"forwarded",["message.archive.item"]),(0,i.addAlias)(r.NS_RSM,"set",["iq.archive.paging"])];for(const[e,t]of Object.entries(s))o.push({defaultType:"query",defaultVersion:"2",element:"query",fields:{node:(0,i.attribute)("node"),queryId:(0,i.attribute)("queryid")},namespace:t,path:"iq.archive",type:"query",typeField:"type",version:e,versionField:"version"},{element:"fin",fields:{complete:(0,i.booleanAttribute)("complete"),stable:(0,i.booleanAttribute)("stable")},namespace:t,path:"iq.archive",type:"result",version:e},{element:"prefs",fields:{default:(0,i.attribute)("default"),always:(0,i.deepMultipleChildText)([{namespace:null,element:"always"},{namespace:null,element:"jid"}]),never:(0,i.deepMultipleChildText)([{namespace:null,element:"never"},{namespace:null,element:"jid"}])},namespace:t,path:"iq.archive",type:"preferences",version:e},{element:"result",defaultType:"2",fields:{id:(0,i.attribute)("id"),queryId:(0,i.attribute)("queryid")},namespace:t,path:"message.archive",type:e,typeField:"version"});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendPresence)({hats:(0,i.splicePath)(r.NS_HATS_0,"hats","hat",!0)}),{element:"hat",fields:{id:(0,i.attribute)("name"),name:(0,i.attribute)("displayName")},namespace:r.NS_HATS_0,path:"hat"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendPresence)({idleSince:(0,i.childDate)(r.NS_IDLE_1,"since")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{multiple:!0,path:"iq.jingle.contents.transport.fingerprints",selector:r.NS_JINGLE_ICE_UDP_1},{multiple:!0,path:"iq.jingle.contents.transport.fingerprints",selector:r.NS_JINGLE_ICE_0},{multiple:!0,path:"iq.jingle.contents.application.encryption.dtls",selector:r.NS_JINGLE_RTP_1}],element:"fingerprint",fields:{algorithm:(0,i.attribute)("hash"),setup:(0,i.attribute)("setup"),value:(0,i.text)()},namespace:r.NS_JINGLE_DTLS_0};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s="message.marker",o=[{element:"markable",namespace:r.NS_CHAT_MARKERS_0,path:s,type:"markable",typeField:"type"},{element:"received",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"received"},{element:"displayed",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"displayed"},{element:"acknowledged",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"acknowledged"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({processingHints:{importer(e){const t={};let n=!1;for(const i of e.children)if("string"!=typeof i&&i.getNamespace()===r.NS_HINTS)switch(i.getName()){case"no-copy":t.noCopy=!0,n=!0;break;case"no-permanent-store":t.noPermanentStore=!0,n=!0;break;case"no-store":t.noStore=!0,n=!0;break;case"store":t.store=!0,n=!0}return n?t:void 0},exporter(e,t,n){t.noCopy&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-copy",n.namespace,e)),t.noPermanentStore&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-permanent-store",n.namespace,e)),t.noStore&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-store",n.namespace,e)),t.store&&e.appendChild((0,i.createElement)(r.NS_HINTS,"store",n.namespace,e))}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({json:(0,i.childJSON)(r.NS_JSON_0,"json")}),{aliases:(0,i.pubsubItemContentAliases)(),element:"json",fields:{json:(0,i.textJSON)()},namespace:r.NS_JSON_0,type:r.NS_JSON_0},{aliases:[{path:"message.jsonPayloads",multiple:!0}],element:"payload",fields:{type:(0,i.attribute)("datatype"),data:(0,i.childJSON)(r.NS_JSON_0,"json")},namespace:r.NS_JSON_MESSAGE_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{path:"iq.jingle.groups",multiple:!0}],element:"group",fields:{contents:(0,i.multipleChildAttribute)(null,"content","name"),semantics:(0,i.attribute)("semantics")},namespace:r.NS_JINGLE_GROUPING_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"iq.jingle.contents.transport.sctp",selector:r.NS_JINGLE_ICE_UDP_1},{path:"iq.jingle.contents.transport.sctp",selector:r.NS_JINGLE_ICE_0}],element:"sctpmap",fields:{port:(0,i.integerAttribute)("number"),protocol:(0,i.attribute)("protocol"),streams:(0,i.attribute)("streams")},namespace:r.NS_JINGLE_DTLS_SCTP_1};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r=[{element:"active",namespace:i.NS_CSI_0,path:"csi",type:"active",typeField:"state"},{element:"inactive",namespace:i.NS_CSI_0,path:"csi",type:"inactive",typeField:"state"}];t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.push.form","pushNotification.form"]),{element:"enable",fields:{jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node")},namespace:r.NS_PUSH_0,path:"iq.push",type:"enable",typeField:"action"},{element:"disable",fields:{jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node")},namespace:r.NS_PUSH_0,path:"iq.push",type:"disable",typeField:"action"},{aliases:(0,i.pubsubItemContentAliases)(),element:"notification",namespace:r.NS_PUSH_0,path:"pushNotification",type:r.NS_PUSH_0,typeField:"itemType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({originId:(0,i.childAttribute)(r.NS_SID_0,"origin-id","id")}),{aliases:[{path:"message.stanzaIds",multiple:!0}],element:"stanza-id",fields:{by:(0,i.JIDAttribute)("by"),id:(0,i.attribute)("id")},namespace:r.NS_SID_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStanzaError)({httpUploadError:(0,i.childEnum)(r.NS_HTTP_UPLOAD_0,["file-too-large","retry"]),httpUploadMaxFileSize:(0,i.deepChildInteger)([{namespace:r.NS_HTTP_UPLOAD_0,element:"file-too-large"},{namespace:r.NS_HTTP_UPLOAD_0,element:"max-file-size"}]),httpUploadRetry:(0,i.childDateAttribute)(r.NS_HTTP_UPLOAD_0,"retry","stamp")}),{element:"request",fields:{mediaType:(0,i.attribute)("content-type"),name:(0,i.attribute)("filename"),size:(0,i.integerAttribute)("size")},namespace:r.NS_HTTP_UPLOAD_0,path:"iq.httpUpload",type:"request",typeField:"type"},{element:"slot",fields:{download:(0,i.childAttribute)(null,"get","url")},namespace:r.NS_HTTP_UPLOAD_0,path:"iq.httpUpload",type:"slot"},{aliases:[{path:"iq.httpUpload.upload",selector:"slot"}],element:"put",fields:{url:(0,i.attribute)("url")},namespace:r.NS_HTTP_UPLOAD_0},{aliases:[{path:"iq.httpUpload.upload.headers",multiple:!0}],element:"header",fields:{name:(0,i.attribute)("name"),value:(0,i.text)()},namespace:r.NS_HTTP_UPLOAD_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"encryption",fields:{id:(0,i.attribute)("namespace"),name:(0,i.attribute)("name")},namespace:r.NS_EME_0,path:"message.encryptionMethod"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["message.omemo"],element:"encrypted",fields:{payload:(0,i.childTextBuffer)(null,"payload","base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemo"},{element:"header",fields:{iv:(0,i.childTextBuffer)(null,"iv","base64"),sid:(0,i.integerAttribute)("sid")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemo.header"},{aliases:[{path:"omemo.header.keys",multiple:!0}],element:"key",fields:{preKey:(0,i.booleanAttribute)("prekey"),rid:(0,i.integerAttribute)("rid"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL},{aliases:(0,i.pubsubItemContentAliases)(),element:"list",fields:{devices:(0,i.multipleChildIntegerAttribute)(null,"device","id")},namespace:r.NS_OMEMO_AXOLOTL,type:r.NS_OMEMO_AXOLOTL_DEVICELIST,typeField:"itemType"},{element:"preKeyPublic",fields:{id:(0,i.integerAttribute)("preKeyId"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoPreKey"},{element:"signedPreKeyPublic",fields:{id:(0,i.integerAttribute)("signedPreKeyId"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoDevice.signedPreKeyPublic"},{aliases:(0,i.pubsubItemContentAliases)(),element:"bundle",fields:{identityKey:(0,i.childTextBuffer)(null,"identityKey","base64"),preKeys:(0,i.splicePath)(null,"prekeys","omemoPreKey",!0),signedPreKeySignature:(0,i.childTextBuffer)(null,"signedPreKeySignature","base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoDevice",type:r.NS_OMEMO_AXOLOTL_BUNDLES,typeField:"itemType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{constructor(e,t,n){super(),this.condition=e,this.channelId=t,this.stanzaInstanceId=n,this.name="SaslError"}}t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";var i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},r=n(32),s=n(12);t.a=function(e,t,n){if(i.randomUUID&&!t&&!e)return i.randomUUID();const o=(e=e||{}).random||(e.rng||r.a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=o[e];return t}return Object(s.b)(o)}},function(e,t,n){"use strict";n.r(t);var i=n(48),r=n(44);for(var s in r)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(s);var o=n(38);for(var s in o)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);var a=n(170);for(var s in a)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(s);var c=n(21);for(var s in c)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return c[e]}))}(s);var u=n(47);for(var s in u)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return u[e]}))}(s);var l=n(27);n.d(t,"HttpClient",(function(){return l.HttpClient}));var d=n(11);n.d(t,"parseJwt",(function(){return d.parseJwt})),t.default=i.Client},function(e,t,n){t.RateLimiter=n(174),t.TokenBucket=n(51)},function(e,t,n){(function(t){var i=n(51),r=n(175),s=function(e,t,n){this.tokenBucket=new i(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=n};s.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,n){if(e>this.tokenBucket.bucketSize)return t.nextTick(n.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var i=this,s=r();if((s<this.curIntervalStart||s-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=s,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)t.nextTick(n.bind(null,null,-1));else{var o=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-s);setTimeout((function(){i.tokenBucket.removeTokens(e,a)}),o)}return!1}return this.tokenBucket.removeTokens(e,a);function a(t,r){if(t)return n(t,null);i.tokensThisInterval+=e,n(null,r)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=r();if((t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var n=this.tokenBucket.tryRemoveTokens(e);return n&&(this.tokensThisInterval+=e),n},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},e.exports=s}).call(this,n(22))},function(e,t,n){(function(t){e.exports=function(){if(void 0!==t&&t.hrtime){var e=t.hrtime(),n=e[0],i=e[1];return 1e3*n+Math.floor(i/1e6)}return(new Date).getTime()}}).call(this,n(22))},function(e,t,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var r={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};t.getSanitizedOptions=function(e){var t=i(i({},r),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(178),r=n(182);t.DelayFactory=function(e,t){var n=function(e){if(!e.delayFirstAttempt)return new i.SkipFirstDelay(e);return new r.AlwaysDelay(e)}(e);return n.setAttemptNumber(t),n}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.apply=function(){return s(this,void 0,void 0,(function(){return o(this,(function(t){return[2,!!this.isFirstAttempt||e.prototype.apply.call(this)]}))}))},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(n(52).Delay);t.SkipFirstDelay=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),r=n(181);t.JitterFactory=function(e){switch(e.jitter){case"full":return i.fullJitter;case"none":default:return r.noJitter}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noJitter=function(e){return e}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(n(52).Delay);t.AlwaysDelay=s},function(e,t,n){"use strict";(function(e){
|
|
23
|
+
/*!
|
|
24
|
+
* The buffer module from node.js, for the browser.
|
|
25
|
+
*
|
|
26
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
27
|
+
* @license MIT
|
|
28
|
+
*/
|
|
29
|
+
var i=n(184),r=n(185),s=n(186);function o(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return d(this,e)}return u(this,e,t,n)}function u(e,t,n,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,i){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,n):new Uint8Array(t,n,i);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=p(e,t);return e}(e,t,n,i):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|f(t,n),r=(e=a(e,i)).write(t,n);r!==i&&(e=e.slice(0,r));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|h(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?a(e,0):p(e,t);if("Buffer"===t.type&&s(t.data))return p(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function d(e,t){if(l(t),e=a(e,t<0?0:0|h(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function p(e,t){var n=t.length<0?0:0|h(t.length);e=a(e,n);for(var i=0;i<n;i+=1)e[i]=255&t[i];return e}function h(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(i)return q(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return x(this,t,n);case"base64":return N(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function y(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,i,r);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,i,r){var s,o=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){var l=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===c)return l*o}else-1!==l&&(s-=s-l),l=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var d=!0,p=0;p<c;p++)if(u(e,s+p)!==u(t,p)){d=!1;break}if(d)return s}return-1}function _(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[n+o]=a}return o}function v(e,t,n,i){return J(q(t,e.length-n),e,n,i)}function S(e,t,n,i){return J(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function w(e,t,n,i){return S(e,t,n,i)}function T(e,t,n,i){return J(U(t),e,n,i)}function I(e,t,n,i){return J(function(e,t){for(var n,i,r,s=[],o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function N(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var s,o,a,c,u=e[r],l=null,d=u>239?4:u>223?3:u>191?2:1;if(r+d<=n)switch(d){case 1:u<128&&(l=u);break;case 2:128==(192&(s=e[r+1]))&&(c=(31&u)<<6|63&s)>127&&(l=c);break;case 3:s=e[r+1],o=e[r+2],128==(192&s)&&128==(192&o)&&(c=(15&u)<<12|(63&s)<<6|63&o)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:s=e[r+1],o=e[r+2],a=e[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(c=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,d=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),r+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return n}(i)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=o(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return u(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,i){return l(t),t<=0?a(e,t):void 0!==n?"string"==typeof i?a(e,t).fill(n,i):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return d(null,e)},c.allocUnsafeSlow=function(e){return d(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=c.allocUnsafe(t),r=0;for(n=0;n<e.length;++n){var o=e[n];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,r),r+=o.length}return i},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):m.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,i,r){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),u=this.slice(i,r),l=e.slice(t,n),d=0;d<a;++d)if(u[d]!==l[d]){s=u[d],o=l[d];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},c.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return w(this,e,t,n);case"base64":return T(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function E(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function x(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function R(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",s=t;s<n;++s)r+=F(e[s]);return r}function C(e,t,n){for(var i=e.slice(t,n),r="",s=0;s<i.length;s+=2)r+=String.fromCharCode(i[s]+256*i[s+1]);return r}function O(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function k(e,t,n,i,r,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<s)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function P(e,t,n,i){t<0&&(t=65535+t+1);for(var r=0,s=Math.min(e.length-n,2);r<s;++r)e[n+r]=(t&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function j(e,t,n,i){t<0&&(t=4294967295+t+1);for(var r=0,s=Math.min(e.length-n,4);r<s;++r)e[n+r]=t>>>8*(i?r:3-r)&255}function L(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,i,s){return s||L(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function D(e,t,n,i,s){return s||L(e,0,n,8),r.write(e,t,n,i,52,8),n+8}c.prototype.slice=function(e,t){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var r=t-e;n=new c(r,void 0);for(var s=0;s<r;++s)n[s]=this[s+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var i=this[e],r=1,s=0;++s<t&&(r*=256);)i+=this[e+s]*r;return i},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var i=this[e+--t],r=1;t>0&&(r*=256);)i+=this[e+--t]*r;return i},c.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var i=this[e],r=1,s=0;++s<t&&(r*=256);)i+=this[e+s]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var i=t,r=1,s=this[e+--i];i>0&&(r*=256);)s+=this[e+--i]*r;return s>=(r*=128)&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),r.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),r.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),r.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),r.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,i){(e=+e,t|=0,n|=0,i)||k(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,s=0;for(this[t]=255&e;++s<n&&(r*=256);)this[t+s]=e/r&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,i){(e=+e,t|=0,n|=0,i)||k(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);k(this,e,t,n,r-1,-r)}var s=0,o=1,a=0;for(this[t]=255&e;++s<n&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t|=0,!i){var r=Math.pow(2,8*n-1);k(this,e,t,n,r-1,-r)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||k(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,i){if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var r,s=i-n;if(this===e&&n<t&&t<i)for(r=s-1;r>=0;--r)e[r+t]=this[r+n];else if(s<1e3||!c.TYPED_ARRAY_SUPPORT)for(r=0;r<s;++r)e[r+t]=this[r+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s},c.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var o=c.isBuffer(e)?e:q(new c(e,i).toString()),a=o.length;for(s=0;s<n-t;++s)this[s+t]=o[s%a]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function q(e,t){var n;t=t||1/0;for(var i=e.length,r=null,s=[],o=0;o<i;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function U(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function J(e,t,n,i){for(var r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}}).call(this,n(15))},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,i=u(e),o=i[0],a=i[1],c=new s(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),l=0,d=a>0?o-4:o;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,s=[],o=0,a=n-r;o<a;o+=16383)s.push(l(e,o,o+16383>a?a:o+16383));1===r?(t=e[n-1],s.push(i[t>>2]+i[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],s.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return s.join("")};for(var i=[],r=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)i[a]=o[a],r[o.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var r,s,o=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(i[(s=r)>>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(e,t){
|
|
39
30
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
40
|
-
t.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?r-1:0,p=n?-1:1,h=e[t+d];for(d+=p,s=h&(1<<-u)-1,h>>=-u,u+=a;u>0;s=256*s+e[t+d],d+=p,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=i;u>0;o=256*o+e[t+d],d+=p,u-=8);if(0===s)s=1-l;else{if(s===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=l}return(h?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var o,a,c,l=8*s-r-1,u=(1<<l)-1,d=u>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=u?(a=0,o=u):o+d>=1?(a=(t*c-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+h]=255&a,h+=f,a/=256,r-=8);for(o=o<<r|a,l+=r;l>0;e[n+h]=255&o,h+=f,o/=256,l-=8);e[n+h-f]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(e){e||Object.defineProperty(window,"crypto",{value:window.crypto||window.msCrypto,writable:!1,configurable:!1})}).call(this,n(6))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Notifications=void 0;const i=n(83),r=n(8);function s(e,t){return[...e,...t].filter((e,t,n)=>n.indexOf(e)===t)}t.Notifications=class{constructor(e){this.subscriptions={},this.bulkSubscriptions={},this.topicPriorities={},this.client=e,e.on("pubsub:event",this.pubsubEvent.bind(this)),e.on("connected",this.subscriptionsKeepAlive.bind(this)),this.debouncedResubscribe=i(this.resubscribe.bind(this),100)}get pubsubHost(){try{return"notifications."+this.client.config.apiHost.replace(/http(s?):\/\//,"")}catch(e){return"notifications.mypurecloud.com"}}handleStanzaInstanceChange(e){const t=this.stanzaInstance&&this.stanzaInstance.id!==e.id&&this.stanzaInstance.channelId!==e.channelId;this.stanzaInstance=e,t&&(this.client.logger.info("resubscribing due to hard reconnect"),this.debouncedResubscribe())}topicHandlers(e){return this.subscriptions[e]||(this.subscriptions[e]=[]),this.subscriptions[e]}pubsubEvent({pubsub:e}){let t=e.items.node;t.includes("no_longer_subscribed")?t="no_longer_subscribed":t.includes("duplicate_id")&&(t="duplicate_id");const n=e.items.published[0].content.json,i=this.topicHandlers(t);this.client.emit("notify",{topic:t,data:n}),this.client.emit("notify:"+t,n),i.forEach(e=>{e(n)})}async xmppSubscribe(e){if(0!==this.topicHandlers(e).length||this.bulkSubscriptions[e])return Promise.resolve();const t=()=>this.stanzaInstance.subscribeToNode(this.pubsubHost,e);return this.client.connected?t():new Promise((e,n)=>{this.client.once("connected",()=>t().then(e,n))})}xmppUnsubscribe(e){if(0!==this.topicHandlers(e).length||this.bulkSubscriptions[e])return Promise.resolve();const t=()=>this.stanzaInstance.unsubscribeFromNode(this.pubsubHost,e);return this.client.connected?t():new Promise((e,n)=>{this.client.once("connected",()=>t().then(e,n))})}mapCombineTopics(e){const t={},n=[],i=[];e.forEach(e=>{e.includes("?")?n.push({id:e}):i.push(e)}),i.map(e=>{const t=e.split("."),n=t.splice(t.length-1);return{prefix:t.join("."),postfix:n}}).forEach(e=>{t[e.prefix]?t[e.prefix].push(e.postfix):t[e.prefix]=[e.postfix]});let r=[];const s=(e,t)=>{const n=`${e}${1===t.length?".":"?"}${t.join("&")}`;n.length<200?r.push({id:n}):1===t.length?this.client.logger.error("Refusing to attempt topic with length > 200",n):(s(e,t.slice(0,t.length/2)),s(e,t.slice(t.length/2)))};Object.keys(t).forEach(e=>{const n=t[e];s(e,n)});const o=r.concat(n);return this.truncateTopicList(this.prioritizeTopicList(o))}prioritizeTopicList(e){return e.sort((e,t)=>this.getTopicPriority(t.id)-this.getTopicPriority(e.id)),e}getTopicPriority(e,t=!0){const{prefix:n,postfixes:i}=this.getTopicParts(e),r=this.topicPriorities[n],s=r&&Object.keys(r).filter(e=>i.includes(e)).map(e=>r[e]),o=s&&s.length&&s.reduce((e,t)=>t>e?t:e);return t?o||0:o}truncateTopicList(e){const t=e.slice(0,1e3);if(e.length>1e3){let t=e.slice(1e3);if(t.length>20){const e=t.length-20;t=t.slice(20),t.push(`...and ${e} more`)}this.client.logger.warn("Too many topics to subscribe to; truncating extra topics",{droppedTopics:t})}return t}makeBulkSubscribeRequest(e,t){const n={method:t.replace?"put":"post",host:this.client.config.apiHost,authToken:this.client.config.authToken,data:JSON.stringify(this.mapCombineTopics(e)),logger:this.client.logger},i=this.stanzaInstance.channelId;return this.client.http.requestApi(`notifications/channels/${i}/subscriptions`,n)}createSubscription(e,t){r.splitIntoIndividualTopics(e).forEach(e=>{let n=this.topicHandlers(e);n.includes(t)||n.push(t)})}removeSubscription(e,t){r.splitIntoIndividualTopics(e).forEach(e=>{let n=this.topicHandlers(e),i=n.indexOf(t);i>-1&&n.splice(i,1),n.length||delete this.subscriptions[e]})}removeTopicPriority(e){if(this.getTopicPriority(e,!1)){const{prefix:t,postfixes:n}=this.getTopicParts(e);n.forEach(e=>{delete this.topicPriorities[t][e]}),Object.keys(this.topicPriorities[t]).length||delete this.topicPriorities[t]}}getActiveIndividualTopics(){const e=[];return Object.keys(this.subscriptions).forEach(t=>{if("streaming-subscriptions-expiring"===t)return;this.topicHandlers(t).length>0&&e.push(t)}),e}resubscribe(){const e=Object.keys(this.bulkSubscriptions);return e.length+this.getActiveIndividualTopics().length===0?Promise.resolve():this.bulkSubscribe(e,{replace:!0})}subscriptionsKeepAlive(){const e="streaming-subscriptions-expiring";0===this.topicHandlers(e).length&&this.createSubscription(e,()=>{this.client.logger.info(e+" - Triggering resubscribe.",{channelId:this.client.config.channelId}),this.debouncedResubscribe().catch(e=>{const t="Error resubscribing to topics";this.client.logger.error(t,e),this.client.emit("pubsub:error",{msg:t,err:e})})})}getTopicParts(e){const t=e.includes("?"),n=t?"?":".",i=e.split(n),r=t?i[1]:i.splice(i.length-1),s=t?i[0]:i.join(".");let o=[];return o=t?r.split("&"):r,{prefix:s,postfixes:o}}setTopicPriorities(e={}){Object.keys(e).forEach(t=>{const n=this.getTopicParts(t),i=this.topicPriorities[n.prefix],r=e[t];if(i)n.postfixes.forEach(e=>{const t=i[e];(t&&t<r||!t)&&(i[e]=r)});else{const e=n.postfixes.reduce((e,t)=>(e[t]=r,e),{});this.topicPriorities[n.prefix]=e}})}subscribe(e,t,n,i){let r;return i&&this.setTopicPriorities({[e]:i}),r=n?this.xmppSubscribe(e):this.debouncedResubscribe(),t?this.createSubscription(e,t):this.bulkSubscriptions[e]=!0,r}unsubscribe(e,t,n){return t?this.removeSubscription(e,t):(delete this.bulkSubscriptions[e],delete this.subscriptions[e]),this.removeTopicPriority(e),n?this.xmppUnsubscribe(e):this.debouncedResubscribe()}async bulkSubscribe(e,t={replace:!1,force:!1},n={}){this.setTopicPriorities(n);let i=s(e,[]);t.replace&&!t.force?i=s(i,this.getActiveIndividualTopics()):t.force&&(this.subscriptions={}),await this.makeBulkSubscribeRequest(i,t),t.replace&&(this.bulkSubscriptions={}),e.forEach(e=>{this.bulkSubscriptions[e]=!0})}get expose(){return{subscribe:this.subscribe.bind(this),unsubscribe:this.unsubscribe.bind(this),bulkSubscribe:this.bulkSubscribe.bind(this)}}}},function(e,t,n){"use strict";function i(e){return"function"==typeof e?e():e}function r(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e}e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=void 0,o=void 0,a=void 0,c=[];return function(){var u=i(t),d=(new Date).getTime(),p=!s||d-s>u;s=d;for(var h=arguments.length,f=Array(h),m=0;m<h;m++)f[m]=arguments[m];if(p&&n.leading)return n.accumulate?Promise.resolve(e.call(this,[f])).then((function(e){return e[0]})):Promise.resolve(e.call.apply(e,[this].concat(f)));if(o?clearTimeout(a):o=r(),c.push(f),a=setTimeout(l.bind(this),u),n.accumulate){var g=c.length-1;return o.promise.then((function(e){return e[g]}))}return o.promise};function l(){var t=o;clearTimeout(a),Promise.resolve(n.accumulate?e.call(this,c):e.apply(this,c[c.length-1])).then(t.resolve,t.reject),c=[],o=null}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebrtcExtension=void 0;const i=n(14),r=n(4),s=n(49),o=i.__importDefault(n(88)),a=n(9),c=n(20),l=i.__importDefault(n(91)),u=n(92),d=n(93),p=n(8),h=n(41),f=n(107),m=n(19),g=n(34),v=n(39),b=n(26),y="requestIncomingRtcSession",_="cancelIncomingRtcSession",S="handledIncomingRtcSession",w="incomingRtcSession",T="outgoingRtcSession",I="rtcSessionError";class x extends r.EventEmitter{constructor(e,t){super(),this.ignoredSessions=new o.default({max:10,maxAge:216e3}),this.pendingSessions={},this.statsArr=[],this.throttleSendStatsInterval=25e3,this.currentMaxStatSize=15e3,this.statsSizeDecreaseAmount=3e3,this.statBuffer=0,this.discoRetries=0,this.iceServers=[],this.webrtcSessions=[],this.client=e,this.config={allowIPv6:!0===t.allowIPv6,optOutOfWebrtcStatsTelemetry:t.optOutOfWebrtcStatsTelemetry},this.logger=e.logger,this.addEventListeners(),this.throttledSendStats=l.default(this.sendStats.bind(this),this.throttleSendStatsInterval,{leading:!1,trailing:!0}),this.client.on("jingle:outgoing",e=>this.emit(T,e)),this.client.on("jingle:incoming",e=>this.emit(w,e)),this.client.on("jingle:created",e=>{e instanceof g.StanzaMediaSession||e.end("cancel",!0)}),window.addEventListener("offline",()=>this.onOnlineStatusChange(!1)),window.addEventListener("online",()=>this.onOnlineStatusChange(!0))}get jid(){var e;return null===(e=this.stanzaInstance)||void 0===e?void 0:e.jid}onOnlineStatusChange(e){this.addStatToQueue({actionName:"WebrtcStats",details:{_eventType:"onlineStatus",_eventTimestamp:(new Date).getTime(),online:e}})}async handleStanzaInstanceChange(e){this.stanzaInstance=e,this.refreshIceServersTimer&&(clearInterval(this.refreshIceServersTimer),this.refreshIceServersTimer=null),e.on("iq:set:genesysWebrtc",this.handleGenesysWebrtcStanza.bind(this)),this.refreshIceServersTimer=setInterval(this.refreshIceServers.bind(this),216e5),this.client.emit("sessionManagerChange",e)}async configureNewStanzaInstance(e){Object.assign(e.jingle.config.peerConnectionConfig,{sdpSemantics:"unified-plan"}),await this.configureStanzaIceServers(e),e.stanzas.define(d.definitions),e.jingle.prepareSession=this.prepareSession.bind(this),e.jingle.on("log",(e,t,n)=>{this.logger[e](t,n)});const t=["iceConnectionType","peerTrackAdded","peerTrackRemoved","mute","unmute","sessionState","connectionState","terminated","stats","endOfCandidates"];for(const n of t)e.jingle.on(n,(e,...t)=>{e instanceof g.StanzaMediaSession&&e.emit(n,...t)})}configureStanzaIceServers(e){return e.jingle.config.iceServers=[],this.setIceServers([],e),this._refreshIceServers(e)}async handleGenesysOffer(e){const t=e.genesysWebrtc.params,n="relay"===this.getIceTransportPolicy()&&u.isFirefox,i={id:t.sessionId,logger:this.logger,peerID:e.from,fromJid:e.from,sessionType:this.getSessionTypeByJid(e.from),conversationId:t.conversationId,ignoreHostCandidatesFromRemote:n,optOutOfWebrtcStatsTelemetry:!!this.config.optOutOfWebrtcStatsTelemetry,allowIPv6:this.config.allowIPv6,iceServers:this.iceServers,reinvite:!!t.reinvite,iceTransportPolicy:this.getIceTransportPolicy()};let r;const s=this.pendingSessions[t.sessionId];r=s?{...i,fromUserId:s.fromUserId,originalRoomJid:s.originalRoomJid}:i;const o=new v.GenesysCloudMediaSession(this,r);return await o.setRemoteDescription(t.sdp),this.proxyStatsForSession(o),o.on("sendIq",e=>{var t;return null===(t=this.stanzaInstance)||void 0===t?void 0:t.sendIQ(e)}),o.on("terminated",()=>{this.webrtcSessions=this.webrtcSessions.filter(e=>e.id!==o.id)}),this.webrtcSessions.push(o),this.emit(w,o)}async handleGenesysIceCandidate(e){const t=e.genesysWebrtc.params,n=this.getSessionById(t.sessionId);await n.addRemoteIceCandidate(t.sdp)}async handleGenesysTerminate(e){const t=e.genesysWebrtc.params;this.getSessionById(t.sessionId).onSessionTerminate(t.reason)}getSessionById(e){const t=this.getAllSessions().find(t=>t.id===e);if(!t){const t=new Error("Failed to find session by id");throw this.logger.error(t,{sessionId:e}),t}return t}async sendIq(e){if(!this.stanzaInstance)throw new Error("Failed to send iq because there was no stanza instance");return this.stanzaInstance.sendIQ(e)}async handleMessage(e){e.propose?await this.handlePropose(e):e.retract?this.handleRetract(e.retract.sessionId):e.accept?this.handledIncomingRtcSession(e.accept.sessionId,e):e.reject&&this.handledIncomingRtcSession(e.reject.sessionId,e)}async handleGenesysWebrtcStanza(e){const t=e.genesysWebrtc;return"offer"===t.method?this.handleGenesysOffer(e):"iceCandidate"===t.method?this.handleGenesysIceCandidate(e):"terminate"===t.method?this.handleGenesysTerminate(e):void 0}prepareSession(e){const t=this.pendingSessions[e.sid];if(t&&delete this.pendingSessions[t.sessionId],null==t?void 0:t.sdpOverXmpp)return void this.logger.debug("skipping creation of jingle webrtc session due to sdpOverXmpp on the pendingSession");const n="relay"===this.getIceTransportPolicy()&&u.isFirefox,i={options:e,logger:this.logger,id:e.sid,fromJid:e.peerID,peerID:e.peerID,optOutOfWebrtcStatsTelemetry:!!this.config.optOutOfWebrtcStatsTelemetry,conversationId:null==t?void 0:t.conversationId,fromUserId:null==t?void 0:t.fromJid,originalRoomJid:null==t?void 0:t.originalRoomJid,sessionType:null==t?void 0:t.sessionType,allowIPv6:this.config.allowIPv6,ignoreHostCandidatesFromRemote:n},r=new g.StanzaMediaSession(i);return this.proxyStatsForSession(r),r}proxyStatsForSession(e){e.on("stats",t=>{if(this.client.logger.stopReason)return;const n=JSON.parse(JSON.stringify(t)),i={conversationId:e.conversationId,sessionId:e.id,sessionType:e.sessionType},r=f.formatStatsEvent(n,i);this.addStatToQueue(r)})}addStatToQueue(e){if(this.config.optOutOfWebrtcStatsTelemetry)return;e.details._appId||(e.details._appId=this.logger.clientId,e.details._appName="streamingclient",e.details._appVersion=h.Client.version),e.details._originAppId=this.client.config.appId;const t=f.deepFlatten(e.details);Object.keys(t).forEach(e=>{const n=t[e];"boolean"==typeof n&&(t[e]=""+n)});const n={...e,details:t},i=p.calculatePayloadSize(n),r=this.statBuffer+i>this.currentMaxStatSize;this.statsArr.push(n),this.statBuffer+=i,r?this.flushStats():this.throttledSendStats()}getLogDetailsForPendingSessionId(e){const t={sessionId:e},n=this.pendingSessions[e];return n&&(t.sessionType=n.sessionType,t.conversationId=n.conversationId),t}flushStats(){this.throttledSendStats.flush()}async sendStats(){var e,t;const n=[];let i=0;for(const e of this.statsArr){const t=p.calculatePayloadSize(e);if(!(i+t<this.currentMaxStatSize))break;n.push(e),i+=t}if(this.statsArr.splice(0,n.length),this.statBuffer=this.statsArr.reduce((e,t)=>e+p.calculatePayloadSize(t),0),!n.length||this.client.isGuest)return;const r={appName:"streamingclient",appVersion:h.Client.version,originAppName:this.client.config.appName,originAppVersion:this.client.config.appVersion,actions:n};try{let e=this.client.config.authToken,t="diagnostics/newrelic/insights";this.client.backgroundAssistantMode&&(e=this.client.config.jwt,t+="/backgroundassistant"),await this.client.http.requestApi(t,{method:"post",responseType:"text",host:this.client.config.apiHost,authToken:e,logger:this.client.logger,data:r}),this.currentMaxStatSize=15e3}catch(i){if(!b.HttpClient.retryStatusCodes.has(null===(e=i.response)||void 0===e?void 0:e.status)&&navigator.onLine||(this.statsArr=[...n,...this.statsArr],this.statBuffer=this.statsArr.reduce((e,t)=>e+p.calculatePayloadSize(t),0)),413===(null===(t=i.response)||void 0===t?void 0:t.status)){const e=this.currentMaxStatSize;this.currentMaxStatSize-=this.statsSizeDecreaseAmount,this.logger.info("Failed to send stats due to 413, retrying with smaller set",{attemptedPayloadSize:e,newPayloadSize:this.currentMaxStatSize}),await this.sendStats()}else this.logger.error("Failed to send stats",{err:i,numberOfFailedStats:n.length},{skipServer:!navigator.onLine})}}addEventListeners(){this.client.on("connected",()=>(this.refreshIceServersTimer&&(clearInterval(this.refreshIceServersTimer),this.refreshIceServersTimer=null),this.refreshIceServersTimer=setInterval(this.refreshIceServers.bind(this),216e5),this.refreshIceServers().catch(e=>this.logger.error("Error fetching ice servers after streaming-client connected",{error:e,channelId:this.client.config.channelId})))),this.client.on("disconnected",()=>{clearInterval(this.refreshIceServersTimer),this.refreshIceServersTimer=null})}async handlePropose(e){if(e.from===this.jid)return;const t=e.propose.sessionId;let n=this.pendingSessions[t];const i=!!n,r=this.getSessionTypeByJid(e.from),s={sessionId:t,conversationId:e.propose.conversationId,sessionType:r,isDuplicatePropose:i};if(this.logger.info("propose received",s),!i){const{appId:i}=this.client.config,o={actionName:"WebrtcStats",details:{_eventTimestamp:(new Date).getTime(),_eventType:"firstPropose",conversationId:s.conversationId,sdpViaXmppRequested:!!e.propose.sdpOverXmpp,sessionId:t,sessionType:r}};this.addStatToQueue(o);const a=e.from,c=a;e.propose.originalRoomJid=e.propose.originalRoomJid||c,n={...e.propose,toJid:e.to,fromJid:a,sessionType:r,roomJid:c,id:t,sdpOverXmpp:e.propose.sdpOverXmpp},this.pendingSessions[t]=n}if(n.accepted)return this.logger.info("proceed already sent for this session, but sending another",s),void await this.acceptRtcSession(t);this.emit(y,Object.assign(n))}handleRetract(e){return this.logger.info("retract received",this.getLogDetailsForPendingSessionId(e)),delete this.pendingSessions[e],this.emit(_,e)}handledIncomingRtcSession(e,t){let n=t.accept?"accept":"reject";return this.logger.info(n+" received",this.getLogDetailsForPendingSessionId(e)),this.emit(S,e)}async initiateRtcSession(e){const t={to:e.jid,propose:{id:c.v4(),descriptions:[]}};if(e.stream)for(let n of Array.from(e.stream.getTracks()))t.propose.descriptions.push({media:n.kind});if(e.provideVideo){t.propose.descriptions.filter(e=>"video"===e.media).length>0||t.propose.descriptions.push({media:"video"})}if(e.provideAudio){t.propose.descriptions.filter(e=>"audio"===e.media).length>0||t.propose.descriptions.push({media:"audio"})}if(e.mediaPurpose&&t.propose.descriptions.push({media:e.mediaPurpose}),e.jid&&e.jid.match(/@conference/)){let n=t.propose.descriptions;0===n.length&&(n=[{media:"listener"}]);const i={type:"upgradeMedia",to:e.jid,id:c.v4(),from:this.jid,media:{conversationId:e.conversationId,sourceCommunicationId:e.sourceCommunicationId}};for(const e of n)i.media[e.media]=!0;await this.stanzaInstance.send("presence",i)}else await this.stanzaInstance.send("message",t),this.pendingSessions[t.propose.id]=t;return t.propose.id}async acceptRtcSession(e){const t=this.pendingSessions[e];if(!t)return void this.emit(I,"Cannot accept session because it is not pending or does not exist");const n={to:t.fromJid,proceed:{sessionId:e}};t.accepted=!0;const i=this.getLogDetailsForPendingSessionId(e);this.logger.info("sending jingle proceed",i),await this.stanzaInstance.send("message",n),this.logger.info("sent jingle proceed",i)}async rejectRtcSession(e,t=!1){const n=this.getLogDetailsForPendingSessionId(e),i=this.pendingSessions[e];if(i)if(delete this.pendingSessions[e],t)this.ignoredSessions.set(e,!0);else{const t={to:s.toBare(this.jid),reject:{sessionId:e}},r=this.stanzaInstance.send("message",t),o={to:i.fromJid,reject:{sessionId:e}},a=this.stanzaInstance.send("message",o);this.logger.info("sending jingle reject",n),await Promise.all([r,a]),this.logger.info("sent jingle reject",n)}else this.emit(I,"Cannot reject session because it is not pending or does not exist")}async rtcSessionAccepted(e){this.pendingSessions[e];const t=this.getLogDetailsForPendingSessionId(e),n={to:s.toBare(this.jid),accept:{sessionId:e}};this.logger.info("sending session-info:accept",t),await this.stanzaInstance.send("message",n),this.logger.info("sent session-info:accept",t)}async notifyScreenShareStart(e){return this.stanzaInstance.send("iq",{to:""+e.peerID,from:this.jid,type:"set",jingle:{action:a.JingleAction.SessionInfo,sid:e.id,screenstart:{}}})}async notifyScreenShareStop(e){return this.stanzaInstance.send("iq",{to:""+e.peerID,from:this.jid,type:"set",jingle:{action:a.JingleAction.SessionInfo,sid:e.id,screenstop:{}}})}async cancelRtcSession(e){const t=this.pendingSessions[e],n=this.getLogDetailsForPendingSessionId(e);if(!t)return void this.emit(I,"Cannot cancel session because it is not pending or does not exist");const i={to:t.toJid,retract:{sessionId:e}};delete this.pendingSessions[e],this.logger.info("sending jingle retract",n),await this.stanzaInstance.send("message",i),this.logger.info("sent jingle retract",n)}async refreshIceServers(){return this.refreshIceServersRetryPromise||(this.refreshIceServersRetryPromise=p.retryPromise(this._refreshIceServers.bind(this,this.stanzaInstance),e=>++this.discoRetries>2?(this.logger.warn("fetching ice servers failed. max retries reached.",{retryAttempt:this.discoRetries,MAX_DISCO_RETRIES:2,error:e,channelId:this.client.config.channelId}),!1):(this.logger.warn("fetching ice servers failed. retrying",{retryAttempt:this.discoRetries,error:e,channelId:this.client.config.channelId}),!0),0,this.client.logger)),this.refreshIceServersRetryPromise.promise.finally(()=>{this.discoRetries=0,this.refreshIceServersRetryPromise=void 0})}async _refreshIceServers(e){if(!e)throw new Error("No stanza instance to refresh ice servers");const t=e.config.server,n=e.getServices(t,"turn","1"),i=e.getServices(t,"stun","1"),r=new Promise((e,t)=>{setTimeout(()=>{t(new Error("Timeout waiting for refresh ice servers to finish"))},15e3),Promise.all([n,i]).then(([t,n])=>{e([t,n])}).catch(t)}),[s,o]=await r,a=[...s.services,...o.services].map(e=>{const t=e.port?":"+e.port:"",n={type:e.type,urls:`${e.type}:${e.host}${t}`};return["turn","turns"].includes(e.type)&&(e.transport&&"udp"!==e.transport&&(n.urls+="?transport="+e.transport),e.username&&(n.username=e.username),e.password&&(n.credential=e.password)),n});return this.setIceServers(a,e),o.services.length?this.setIceTransportPolicy("all",e):(this.logger.info('No stun servers received, setting iceTransportPolicy to "relay"'),this.setIceTransportPolicy("relay",e)),a}setIceServers(e,t){t.jingle.iceServers=e,this.iceServers=e}getIceTransportPolicy(){var e;return null===(e=this.stanzaInstance)||void 0===e?void 0:e.jingle.config.peerConnectionConfig.iceTransportPolicy}setIceTransportPolicy(e,t){t.jingle.config.peerConnectionConfig.iceTransportPolicy=e}getSessionTypeByJid(e){return p.isAcdJid(e)?m.SessionTypes.acdScreenShare:p.isScreenRecordingJid(e)?m.SessionTypes.screenRecording:p.isSoftphoneJid(e)?m.SessionTypes.softphone:p.isVideoJid(e)?m.SessionTypes.collaborateVideo:m.SessionTypes.unknown}getSessionManager(){var e;return null===(e=this.stanzaInstance)||void 0===e?void 0:e.jingle}getAllSessions(){var e;const t=null===(e=this.stanzaInstance)||void 0===e?void 0:e.jingle.sessions;return[...t&&Object.values(t)||[],...this.webrtcSessions]}proxyNRStat(e){this.addStatToQueue(e)}get expose(){return{on:this.on.bind(this),once:this.once.bind(this),off:this.off.bind(this),removeAllListeners:this.removeAllListeners.bind(this),removeListener:this.removeListener.bind(this),refreshIceServers:this.refreshIceServers.bind(this),acceptRtcSession:this.acceptRtcSession.bind(this),rejectRtcSession:this.rejectRtcSession.bind(this),cancelRtcSession:this.cancelRtcSession.bind(this),notifyScreenShareStart:this.notifyScreenShareStart.bind(this),notifyScreenShareStop:this.notifyScreenShareStop.bind(this),rtcSessionAccepted:this.rtcSessionAccepted.bind(this),initiateRtcSession:this.initiateRtcSession.bind(this),getSessionTypeByJid:this.getSessionTypeByJid.bind(this),getSessionManager:this.getSessionManager.bind(this),getAllSessions:this.getAllSessions.bind(this),proxyNRStat:this.proxyNRStat.bind(this)}}}t.WebrtcExtension=x},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.saslprep=t.resourceprep=t.nodeprep=t.NodePrepProhibited=t.nameprep=t.prepare=t.D2=t.D1=t.C9=t.C8=t.C7=t.C6=t.C5=t.C4=t.C3=t.C22=t.C21=t.C12=t.C11=t.B3=t.B2=t.B1=t.A1=t.Table=void 0;const i=n(0).__importDefault(n(5)),r=n(87);class s{constructor(e,t){this.singles=new Set,this.ranges=[],this.mappings=new Map;const n=r.TABLE_DATA[e];this.name=e,n?(n.s&&(this.singles=new Set(n.s.split("|").map(e=>parseInt(e,32)))),n.r&&(this.ranges=n.r.split("|").map(e=>{const[t,n]=e.split(":");return[parseInt(t,32),parseInt(n,32)]})),n.m&&(this.mappings=new Map(n.m.split("|").map(e=>{const[t,n]=e.split(":"),i=n.split(";").map(e=>parseInt(e,32));return[parseInt(t,32),i]})))):t&&(this.singles=new Set(t))}contains(e){if(this.singles.has(e))return!0;let t=0,n=this.ranges.length-1;for(;t<=n;){const i=Math.floor((t+n)/2),r=this.ranges[i];if(e<r[0])n=i-1;else{if(!(e>r[1]))return!0;t=i+1}}return!1}hasMapping(e){return this.mappings.has(e)||this.contains(e)}map(e){return this.contains(e)&&!this.mappings.has(e)?String.fromCodePoint(e).toLowerCase().codePointAt(0):this.mappings.get(e)||null}}function o(e,n,r=""){const s=i.default.ucs2.decode(r);let o=[];for(const t of s){if(!n&&e.unassigned.contains(t))throw new Error("Unassigned code point: x"+t.toString(16));let i=!1;for(const n of e.mappings){if(!n.hasMapping(t))continue;i=!0;const e=n.map(t);e&&(Array.isArray(e)?o=o.concat(e):o.push(e))}i||o.push(t)}let a=o;if(e.normalize){const e=i.default.ucs2.encode(o).normalize("NFKC");a=i.default.ucs2.decode(e)}let c=!1,l=!1;for(const i of a){for(const t of e.prohibited)if(t.contains(i))throw new Error("Prohibited code point: x"+i.toString(16));if(!n&&e.unassigned.contains(i))throw new Error("Prohibited code point: x"+i.toString(16));e.bidirectional&&(c=c||t.D1.contains(i),l=l||t.D2.contains(i))}if(e.bidirectional){if(c&&l)throw new Error("String contained both LCat and RandALCat code points");if(c&&(!t.D1.contains(a[0])||!t.D1.contains(a[a.length-1])))throw new Error("String containing RandALCat code points must start and end with RandALCat code points")}return i.default.ucs2.encode(a)}t.Table=s,t.A1=new s("A.1"),t.B1=new s("B.1"),t.B2=new s("B.2"),t.B3=new s("B.3"),t.C11=new s("C.1.1"),t.C12=new s("C.1.2"),t.C21=new s("C.2.1"),t.C22=new s("C.2.2"),t.C3=new s("C.3"),t.C4=new s("C.4"),t.C5=new s("C.5"),t.C6=new s("C.6"),t.C7=new s("C.7"),t.C8=new s("C.8"),t.C9=new s("C.9"),t.D1=new s("D.1"),t.D2=new s("D.2"),t.B1.map=()=>null,t.C11.contains=e=>32===e,t.C12.map=e=>t.C12.contains(e)?32:null,t.prepare=o;const a={bidirectional:!0,mappings:[t.B1,t.B2],normalize:!0,prohibited:[t.C12,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.nameprep=function(e,t=!0){return o(a,t,e)},t.NodePrepProhibited=new s("NodePrepProhibited",[34,38,39,47,58,60,62,64]);const c={bidirectional:!0,mappings:[t.B1,t.B2],normalize:!0,prohibited:[t.C11,t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9,t.NodePrepProhibited],unassigned:t.A1};t.nodeprep=function(e,t=!0){return o(c,t,e)};const l={bidirectional:!0,mappings:[t.B1],normalize:!0,prohibited:[t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.resourceprep=function(e,t=!0){return o(l,t,e)};const u={bidirectional:!0,mappings:[t.C12,t.B1],normalize:!0,prohibited:[t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.saslprep=function(e,t=!1){return o(u,t,e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TABLE_DATA=void 0,t.TABLE_DATA={"A.1":{r:"hk:if|le:lf|nf:nv|qg:qv|rg:rj|rm:rp|rr:rt|rv:s3|vn:vv|17m:17n|17q:17v|18g:19g|1an:1ao|1cb:1cg|1e5:1ef|1fb:1ff|1fl:1gb|1gd:1gq|1gs:1gu|1hr:1hv|1im:1iv|1ne:1nf|1pd:1pf|1qb:1rv|1ti:280|29q:29r|2ae:2af|2al:2an|2bh:2c0|2cd:2ce|2ch:2ci|2dj:2dl|2dq:2dr|2e5:2e6|2e9:2ea|2ee:2em|2eo:2er|2f4:2f5|2fr:2g1|2g3:2g4|2gb:2ge|2gh:2gi|2hq:2hr|2i3:2i6|2i9:2ia|2ie:2io|2iv:2j5|2jl:2k0|2lq:2lr|2me:2mf|2mh:2mv|2n1:2n5|2ng:2o0|2od:2oe|2oh:2oi|2pk:2pl|2pq:2pr|2q4:2q6|2q9:2qa|2qe:2ql|2qo:2qr|2r2:2r5|2rh:2s1|2sb:2sd|2sm:2so|2t0:2t2|2t5:2t7|2tb:2td|2tq:2tt|2u3:2u5|2ue:2um|2uo:2v6|2vj:300|31q:31t|32e:32k|32n:32v|332:335|33g:341|35q:35t|36e:36k|36n:36t|372:375|37g:381|39q:39t|3a4:3a5|3ae:3am|3ao:3av|3b2:3b5|3bg:3c1|3cn:3cp|3du:3dv|3e7:3e9|3eb:3ee|3f0:3fh|3fl:3g0|3hr:3hu|3is:3k0|3k5:3k6|3kb:3kc|3ke:3kj|3l8:3l9|3lu:3lv|3me:3mf|3mq:3mr|3mu:3nv|3rb:3rg|3sc:3sf|3ud:3ue|3ug:3vv|41j:41l|41q:41v|42q:44v|466:46f|47p:47q|47s:47v|4aq:4au|4d3:4d7|4fq:4fv|4ie:4if|4iu:4iv|4ke:4kf|4lm:4ln|4m6:4m7|4om:4on|4qr:4r0|4rt:4sv|4vl:500|5jn:5jv|5kt:5kv|5nh:5nv|5ol:5ov|5pn:5pv|5qk:5qv|5rk:5rv|5ut:5uv|5va:5vv|60q:60v|63o:63v|65a:7fv|7ks:7kv|7nq:7nv|7om:7on|7ou:7ov|7q6:7q7|7qe:7qf|7ru:7rv|7uk:7ul|7vg:7vh|82j:82m|82o:82u|834:839|83i:83j|84f:84v|85i:86f|87b:87v|89r:89s|8ac:8ai|8c4:8cf|8uf:8vv|917:91v|92b:92v|9gk:9gl|9ju:9jv|9ka:9o0|9oa:9ob|9qj:9ql|9qv:9r0|9sl:9sn|9tv:9uf|9vc:9vf|ao0:bjv|bnk:bnv|bum:bvf|bvs:bvv|c4n:c4o|c80:c84|c9d:c9g|cdo:cff|cgt:cgv|ci4:cig|cjs:cju|cmc:cmf|crn:crq|cuu:cuv|jdm:jfv|17t6:17vv|194d:194f|1967:1avv|1lt4:1lvv|1uhe:1uhf|1ujb:1unv|1uo7:1uoi|1uoo:1uos|1uti:1uui|1va0:1vaf|1vcg:1vch|1ve8:1vef|1vft:1vfv|1vgg:1vgv|1vh4:1vhf|1vi7:1vi8|1vjc:1vjf|1vnt:1vnu|1vtv:1vu1|1vu8:1vu9|1vug:1vuh|1vuo:1vup|1vut:1vuv|1vvf:1vvo|2000:20nv|20p4:20pf|20qb:20vv|2116:2117|212e:3jvv|3k7m:3k7v|3k97:3k99|3keu:3kvv|3l50:3l51|3l53:3l54|3l57:3l58|3l8b:3l8c|3la7:3la9|3ll4:3ll7|3lua:3lud|3m00:3vvt|59mn:5tvv|5ugu:5vvt|6000:7vvt|8000:9vvt|a000:bvvt|c000:dvvt|e000:fvvt|g000:hvvt|i000:jvvt|k000:lvvt|m000:nvvt|o000:pvvt|q000:rvvt|s002:s00v|s040:tvvt",s:"9p8|9qc|9qe|9qn|9tg|147|bkq|3l2l|3l4t|3l5d|3l5q|3l5s|3l61|3l64|3l86|3l8l|3l8t|3l9q|3l9v|3la5|3lah|16f|c20|ccf|cnv|cvv|1b0|1c8|1d2|1dq|1h0|1nv|1oe|284|2c4|2d9|2dh|2dt|2eu|2h9|2hh|2hk|2hn|2ht|2it|2k4|2kc|2ke|2ki|2l9|2lh|2lk|2m6|2ma|2o4|2p9|2ph|2qu|2s4|2sh|2sr|2st|2tm|2u9|304|30d|30h|319|31k|325|329|344|34d|34h|359|35k|365|369|36v|384|38d|38h|399|3a9|3c4|3di|3ds|3el|3en|3k3|3k9|3ko|3l0|3l4|3l6|3lc|3lq|3m5|3m7|3q8|3so|3tt|412|418|41b|4g7|4i7|4i9|4in|4ip|4k7|4k9|4lf|4lh|4lv|4m1|4mf|4mn|4nf|4of|4oh|4ov|4q7|h1|5od|5rd|5rh|60f|1upn|1upt|1upv|1uq2|1uq5|1vij|1vj7|1vjl|1vo0|1vv7|20ov|7qo|7qq|7qs|7qu|7tl|7u5|7us|7vl|7vv|sb|sd|s000|t2|97v|uf|9go|9o5"},"B.1":{r:"60b:60d|80b:80d|1vg0:1vgf",s:"5d|606|1vnv|830|qf"},"B.2":{m:"5l:ts|6v:3j;3j|9g:39;o7|a9:ls;3e|bv:3j|fg:3a;oc|q5:tp|rq:10;tp|sg:tp;o8;o1|tg:u5;o8;o1|u2:u3|ug:ti|uh:to|ui:u5|uj:ud|uk:ub|ul:u6|um:u0|vg:tq|vh:u1|vi:u3|vl:tl|1c7:1b5;1c2|7km:38;ph|7kn:3k;o8|7ko:3n;oa|7kp:3p;oa|7kq:31;lu|7kr:7j1|7qg:u5;oj|7qi:u5;oj;o0|7qk:u5;oj;o1|7qm:u5;oj;q2|7s0:7o0;tp|7s1:7o1;tp|7s2:7o2;tp|7s3:7o3;tp|7s4:7o4;tp|7s5:7o5;tp|7s6:7o6;tp|7s7:7o7;tp|7s8:7o0;tp|7s9:7o1;tp|7sa:7o2;tp|7sb:7o3;tp|7sc:7o4;tp|7sd:7o5;tp|7se:7o6;tp|7sf:7o7;tp|7sg:7p0;tp|7sh:7p1;tp|7si:7p2;tp|7sj:7p3;tp|7sk:7p4;tp|7sl:7p5;tp|7sm:7p6;tp|7sn:7p7;tp|7so:7p0;tp|7sp:7p1;tp|7sq:7p2;tp|7sr:7p3;tp|7ss:7p4;tp|7st:7p5;tp|7su:7p6;tp|7sv:7p7;tp|7t0:7r0;tp|7t1:7r1;tp|7t2:7r2;tp|7t3:7r3;tp|7t4:7r4;tp|7t5:7r5;tp|7t6:7r6;tp|7t7:7r7;tp|7t8:7r0;tp|7t9:7r1;tp|7ta:7r2;tp|7tb:7r3;tp|7tc:7r4;tp|7td:7r5;tp|7te:7r6;tp|7tf:7r7;tp|7ti:7rg;tp|7tj:th;tp|7tk:tc;tp|7tm:th;q2|7tn:th;q2;tp|7ts:th;tp|7tu:tp|7u2:7rk;tp|7u3:tn;tp|7u4:te;tp|7u6:tn;q2|7u7:tn;q2;tp|7uc:tn;tp|7ui:tp;o8;o0|7uj:tp;o8;o1|7um:tp;q2|7un:tp;o8;q2|7v2:u5;o8;o0|7v3:u5;o8;o1|7v4:u1;oj|7v6:u5;q2|7v7:u5;o8;q2|7vi:7rs;tp|7vj:u9;tp|7vk:ue;tp|7vm:u9;q2|7vn:u9;q2;tp|7vs:u9;tp|858:3i;3j|882:33|883:5g;33|887:ir|889:5g;36|88b:38|88c:38|88d:38|88g:39|88h:39|88i:3c|88l:3e|88m:3e;3f|88p:3g|88q:3h|88r:3i|88s:3i|88t:3i|890:3j;3d|891:3k;35;3c|892:3k;3d|894:3q|898:3q|89c:32|89d:33|89g:35|89h:36|89j:3d|89u:tj|89v:u0|8a5:34|crh:38;3g;31|crj:31;3l|crl:3f;3m|cs0:3g;31|cs1:3e;31|cs2:ts;31|cs3:3d;31|cs4:3b;31|cs5:3b;32|cs6:3d;32|cs7:37;32|csa:3g;36|csb:3e;36|csc:ts;36|csg:38;3q|csh:3b;38;3q|csi:3d;38;3q|csj:37;38;3q|csk:3k;38;3q|ct9:3g;31|cta:3b;3g;31|ctb:3d;3g;31|ctc:37;3g;31|ctk:3g;3m|ctl:3e;3m|ctm:ts;3m|ctn:3d;3m|cto:3b;3m|ctp:3d;3m|ctq:3g;3n|ctr:3e;3n|cts:ts;3n|ctt:3d;3n|ctu:3b;3n|ctv:3d;3n|cu0:3b;u9|cu1:3d;u9|cu3:32;3h|cu6:33;8gl;3b;37|cu7:33;3f;1e|cu8:34;32|cu9:37;3p|cub:38;3g|cud:3b;3b|cue:3b;3d|cun:3g;38|cup:3g;3g;3d|cuq:3g;3i|cus:3j;3m|cut:3n;32|1uo0:36;36|1uo1:36;39|1uo2:36;3c|1uo3:36;36;39|1uo4:36;36;3c|1uo5:3j;3k|1uo6:3j;3k|1uoj:1bk;1bm|1uok:1bk;1b5|1uol:1bk;1bb|1uom:1bu;1bm|1uon:1bk;1bd|3l00:31|3l01:32|3l02:33|3l03:34|3l04:35|3l05:36|3l06:37|3l07:38|3l08:39|3l09:3a|3l0a:3b|3l0b:3c|3l0c:3d|3l0d:3e|3l0e:3f|3l0f:3g|3l0g:3h|3l0h:3i|3l0i:3j|3l0j:3k|3l0k:3l|3l0l:3m|3l0m:3n|3l0n:3o|3l0o:3p|3l0p:3q|3l1k:31|3l1l:32|3l1m:33|3l1n:34|3l1o:35|3l1p:36|3l1q:37|3l1r:38|3l1s:39|3l1t:3a|3l1u:3b|3l1v:3c|3l20:3d|3l21:3e|3l22:3f|3l23:3g|3l24:3h|3l25:3i|3l26:3j|3l27:3k|3l28:3l|3l29:3m|3l2a:3n|3l2b:3o|3l2c:3p|3l2d:3q|3l38:31|3l39:32|3l3a:33|3l3b:34|3l3c:35|3l3d:36|3l3e:37|3l3f:38|3l3g:39|3l3h:3a|3l3i:3b|3l3j:3c|3l3k:3d|3l3l:3e|3l3m:3f|3l3n:3g|3l3o:3h|3l3p:3i|3l3q:3j|3l3r:3k|3l3s:3l|3l3t:3m|3l3u:3n|3l3v:3o|3l40:3p|3l41:3q|3l4s:31|3l4u:33|3l4v:34|3l52:37|3l55:3a|3l56:3b|3l59:3e|3l5a:3f|3l5b:3g|3l5c:3h|3l5e:3j|3l5f:3k|3l5g:3l|3l5h:3m|3l5i:3n|3l5j:3o|3l5k:3p|3l5l:3q|3l6g:31|3l6h:32|3l6i:33|3l6j:34|3l6k:35|3l6l:36|3l6m:37|3l6n:38|3l6o:39|3l6p:3a|3l6q:3b|3l6r:3c|3l6s:3d|3l6t:3e|3l6u:3f|3l6v:3g|3l70:3h|3l71:3i|3l72:3j|3l73:3k|3l74:3l|3l75:3m|3l76:3n|3l77:3o|3l78:3p|3l79:3q|3l84:31|3l85:32|3l87:34|3l88:35|3l89:36|3l8a:37|3l8d:3a|3l8e:3b|3l8f:3c|3l8g:3d|3l8h:3e|3l8i:3f|3l8j:3g|3l8k:3h|3l8m:3j|3l8n:3k|3l8o:3l|3l8p:3m|3l8q:3n|3l8r:3o|3l8s:3p|3l9o:31|3l9p:32|3l9r:34|3l9s:35|3l9t:36|3l9u:37|3la0:39|3la1:3a|3la2:3b|3la3:3c|3la4:3d|3la6:3f|3laa:3j|3lab:3k|3lac:3l|3lad:3m|3lae:3n|3laf:3o|3lag:3p|3lbc:31|3lbd:32|3lbe:33|3lbf:34|3lbg:35|3lbh:36|3lbi:37|3lbj:38|3lbk:39|3lbl:3a|3lbm:3b|3lbn:3c|3lbo:3d|3lbp:3e|3lbq:3f|3lbr:3g|3lbs:3h|3lbt:3i|3lbu:3j|3lbv:3k|3lc0:3l|3lc1:3m|3lc2:3n|3lc3:3o|3lc4:3p|3lc5:3q|3ld0:31|3ld1:32|3ld2:33|3ld3:34|3ld4:35|3ld5:36|3ld6:37|3ld7:38|3ld8:39|3ld9:3a|3lda:3b|3ldb:3c|3ldc:3d|3ldd:3e|3lde:3f|3ldf:3g|3ldg:3h|3ldh:3i|3ldi:3j|3ldj:3k|3ldk:3l|3ldl:3m|3ldm:3n|3ldn:3o|3ldo:3p|3ldp:3q|3lek:31|3lel:32|3lem:33|3len:34|3leo:35|3lep:36|3leq:37|3ler:38|3les:39|3let:3a|3leu:3b|3lev:3c|3lf0:3d|3lf1:3e|3lf2:3f|3lf3:3g|3lf4:3h|3lf5:3i|3lf6:3j|3lf7:3k|3lf8:3l|3lf9:3m|3lfa:3n|3lfb:3o|3lfc:3p|3lfd:3q|3lg8:31|3lg9:32|3lga:33|3lgb:34|3lgc:35|3lgd:36|3lge:37|3lgf:38|3lgg:39|3lgh:3a|3lgi:3b|3lgj:3c|3lgk:3d|3lgl:3e|3lgm:3f|3lgn:3g|3lgo:3h|3lgp:3i|3lgq:3j|3lgr:3k|3lgs:3l|3lgt:3m|3lgu:3n|3lgv:3o|3lh0:3p|3lh1:3q|3lhs:31|3lht:32|3lhu:33|3lhv:34|3li0:35|3li1:36|3li2:37|3li3:38|3li4:39|3li5:3a|3li6:3b|3li7:3c|3li8:3d|3li9:3e|3lia:3f|3lib:3g|3lic:3h|3lid:3i|3lie:3j|3lif:3k|3lig:3l|3lih:3m|3lii:3n|3lij:3o|3lik:3p|3lil:3q|3ljg:31|3ljh:32|3lji:33|3ljj:34|3ljk:35|3ljl:36|3ljm:37|3ljn:38|3ljo:39|3ljp:3a|3ljq:3b|3ljr:3c|3ljs:3d|3ljt:3e|3lju:3f|3ljv:3g|3lk0:3h|3lk1:3i|3lk2:3j|3lk3:3k|3lk4:3l|3lk5:3m|3lk6:3n|3lk7:3o|3lk8:3p|3lk9:3q|3ll8:th|3ll9:ti|3lla:tj|3llb:tk|3llc:tl|3lld:tm|3lle:tn|3llf:to|3llg:tp|3llh:tq|3lli:tr|3llj:ts|3llk:tt|3lll:tu|3llm:tv|3lln:u0|3llo:u1|3llp:to|3llq:u3|3llr:u4|3lls:u5|3llt:u6|3llu:u7|3llv:u8|3lm0:u9|3lmj:u3|3ln2:th|3ln3:ti|3ln4:tj|3ln5:tk|3ln6:tl|3ln7:tm|3ln8:tn|3ln9:to|3lna:tp|3lnb:tq|3lnc:tr|3lnd:ts|3lne:tt|3lnf:tu|3lng:tv|3lnh:u0|3lni:u1|3lnj:to|3lnk:u3|3lnl:u4|3lnm:u5|3lnn:u6|3lno:u7|3lnp:u8|3lnq:u9|3lod:u3|3los:th|3lot:ti|3lou:tj|3lov:tk|3lp0:tl|3lp1:tm|3lp2:tn|3lp3:to|3lp4:tp|3lp5:tq|3lp6:tr|3lp7:ts|3lp8:tt|3lp9:tu|3lpa:tv|3lpb:u0|3lpc:u1|3lpd:to|3lpe:u3|3lpf:u4|3lpg:u5|3lph:u6|3lpi:u7|3lpj:u8|3lpk:u9|3lq7:u3|3lqm:th|3lqn:ti|3lqo:tj|3lqp:tk|3lqq:tl|3lqr:tm|3lqs:tn|3lqt:to|3lqu:tp|3lqv:tq|3lr0:tr|3lr1:ts|3lr2:tt|3lr3:tu|3lr4:tv|3lr5:u0|3lr6:u1|3lr7:to|3lr8:u3|3lr9:u4|3lra:u5|3lrb:u6|3lrc:u7|3lrd:u8|3lre:u9|3ls1:u3|3lsg:th|3lsh:ti|3lsi:tj|3lsj:tk|3lsk:tl|3lsl:tm|3lsm:tn|3lsn:to|3lso:tp|3lsp:tq|3lsq:tr|3lsr:ts|3lss:tt|3lst:tu|3lsu:tv|3lsv:u0|3lt0:u1|3lt1:to|3lt2:u3|3lt3:u4|3lt4:u5|3lt5:u6|3lt6:u7|3lt7:u8|3lt8:u9|3ltr:u3",r:"23:2c|2i:2k|2m:2q|60:6m|6o:6u|bo:bp|c1:c2|c6:c7|c9:cb|ce:ch|cj:ck|cm:co|cs:ct|cv:d0|d6:d7|de:df|dh:dj|dn:do|e4:e5|e7:e8|ea:eb|fh:fi|fm:fo|s8:sa|se:sf|sh:t1|t3:tb|100:11f|19h:1am|7o8:7of|7oo:7ot|7p8:7pf|7po:7pv|7q8:7qd|7r8:7rf|7to:7tr|7u8:7ub|7uo:7ur|7v8:7vc|7vo:7vr|89a:89b|8b0:8bf|95m:96f|1vp1:1vpq|2100:2115",s:"v8|va|vc|ve|vk|130|132|134|136|138|13a|13c|13e|13g|13i|13k|13m|13o|13q|13s|13u|140|14a|14c|14e|14g|14i|14k|14m|14o|14q|14s|14u|150|152|154|156|158|15a|15c|15e|15g|15i|15k|15m|15o|15q|15s|15u|161|163|165|167|169|16b|16d|16g|16i|16k|16m|16o|16q|16s|16u|170|172|174|176|178|17a|17c|17e|17g|17i|17k|17o|180|182|184|186|188|18a|18c|18e|80|82|84|86|88|8a|8c|8e|8g|8i|8k|8m|8o|8q|8s|8u|90|92|94|96|98|9a|9c|9e|9i|9k|9m|9p|9r|9t|9v|a1|a3|a5|a7|aa|ac|ae|ag|ai|ak|am|ao|aq|as|au|b0|b2|b4|b6|b8|ba|bc|be|bg|bi|bk|bm|br|bt|c4|d2|d4|d9|dc|dl|ds|ed|ef|eh|ej|el|en|ep|er|eu|f0|f2|f4|f6|f8|fa|fc|fe|fk|fq|fs|fu|g0|g2|g4|g6|g8|ga|gc|ge|gg|gi|gk|gm|go|gq|gs|gu|h0|h2|h4|h6|h8|ha|hc|he|hg|hi|21|22|7g0|7g2|7g4|7g6|7g8|7ga|7gc|7ge|7gg|7gi|2d|7gk|7gm|7go|7gq|7gs|7gu|7h0|7h2|7h4|7h6|7h8|7ha|7hc|7he|7hg|7hi|7hk|7hm|7ho|7hq|7hs|7hu|7i0|7i2|7i4|7i6|7i8|7ia|7ic|7ie|7ig|7ii|7ik|7im|7io|7iq|7is|7iu|7j0|7j2|7j4|7j6|7j8|7ja|7jc|7je|7jg|7ji|7jk|7jm|2e|7jo|7jq|7js|7ju|7k0|7k2|7k4|7k6|7k8|7ka|7kc|7ke|7kg|7ki|7kk|7l0|7l2|7l4|7l6|7l8|7la|7lc|7le|7lg|7li|7lk|7lm|7lo|7lq|7ls|7lu|7m0|7m2|7m4|7m6|7m8|7ma|7mc|7me|7mg|7mi|7mk|7mm|7mo|7mq|2f|7ms|7mu|7n0|7n2|7n4|7n6|7n8|7na|7nc|7ne|7ng|7ni|7nk|7nm|7no|2g|7qp|7qr|7qt|7qv|2h|896|2l|s6|sc|uo|uq|us|uu|v0|v2|v4|v6"},"B.3":{m:"5l:ts|6v:3j;3j|9g:39;o7|a9:ls;3e|bv:3j|fg:3a;oc|q5:tp|sg:tp;o8;o1|tg:u5;o8;o1|u2:u3|ug:ti|uh:to|ul:u6|um:u0|vg:tq|vh:u1|vi:u3|vl:tl|1c7:1b5;1c2|7km:38;ph|7kn:3k;o8|7ko:3n;oa|7kp:3p;oa|7kq:31;lu|7kr:7j1|7qg:u5;oj|7qi:u5;oj;o0|7qk:u5;oj;o1|7qm:u5;oj;q2|7s0:7o0;tp|7s1:7o1;tp|7s2:7o2;tp|7s3:7o3;tp|7s4:7o4;tp|7s5:7o5;tp|7s6:7o6;tp|7s7:7o7;tp|7s8:7o0;tp|7s9:7o1;tp|7sa:7o2;tp|7sb:7o3;tp|7sc:7o4;tp|7sd:7o5;tp|7se:7o6;tp|7sf:7o7;tp|7sg:7p0;tp|7sh:7p1;tp|7si:7p2;tp|7sj:7p3;tp|7sk:7p4;tp|7sl:7p5;tp|7sm:7p6;tp|7sn:7p7;tp|7so:7p0;tp|7sp:7p1;tp|7sq:7p2;tp|7sr:7p3;tp|7ss:7p4;tp|7st:7p5;tp|7su:7p6;tp|7sv:7p7;tp|7t0:7r0;tp|7t1:7r1;tp|7t2:7r2;tp|7t3:7r3;tp|7t4:7r4;tp|7t5:7r5;tp|7t6:7r6;tp|7t7:7r7;tp|7t8:7r0;tp|7t9:7r1;tp|7ta:7r2;tp|7tb:7r3;tp|7tc:7r4;tp|7td:7r5;tp|7te:7r6;tp|7tf:7r7;tp|7ti:7rg;tp|7tj:th;tp|7tk:tc;tp|7tm:th;q2|7tn:th;q2;tp|7ts:th;tp|7tu:tp|7u2:7rk;tp|7u3:tn;tp|7u4:te;tp|7u6:tn;q2|7u7:tn;q2;tp|7uc:tn;tp|7ui:tp;o8;o0|7uj:tp;o8;o1|7um:tp;q2|7un:tp;o8;q2|7v2:u5;o8;o0|7v3:u5;o8;o1|7v4:u1;oj|7v6:u5;q2|7v7:u5;o8;q2|7vi:7rs;tp|7vj:u9;tp|7vk:ue;tp|7vm:u9;q2|7vn:u9;q2;tp|7vs:u9;tp|1uo0:36;36|1uo1:36;39|1uo2:36;3c|1uo3:36;36;39|1uo4:36;36;3c|1uo5:3j;3k|1uo6:3j;3k|1uoj:1bk;1bm|1uok:1bk;1b5|1uol:1bk;1bb|1uom:1bu;1bm|1uon:1bk;1bd",r:"23:2c|2i:2k|2m:2q|60:6m|6o:6u|bo:bp|c1:c2|c6:c7|c9:cb|ce:ch|cj:ck|cm:co|cs:ct|cv:d0|d6:d7|de:df|dh:dj|dn:do|e4:e5|e7:e8|ea:eb|fh:fi|fm:fo|s8:sa|se:sf|sh:t1|t3:tb|100:11f|19h:1am|7o8:7of|7oo:7ot|7p8:7pf|7po:7pv|7q8:7qd|7r8:7rf|7to:7tr|7u8:7ub|7uo:7ur|7v8:7vc|7vo:7vr|89a:89b|8b0:8bf|95m:96f|1vp1:1vpq|2100:2115",s:"v8|va|vc|ve|vk|130|132|134|136|138|13a|13c|13e|13g|13i|13k|13m|13o|13q|13s|13u|140|14a|14c|14e|14g|14i|14k|14m|14o|14q|14s|14u|150|152|154|156|158|15a|15c|15e|15g|15i|15k|15m|15o|15q|15s|15u|161|163|165|167|169|16b|16d|16g|16i|16k|16m|16o|16q|16s|16u|170|172|174|176|178|17a|17c|17e|17g|17i|17k|17o|180|182|184|186|188|18a|18c|18e|80|82|84|86|88|8a|8c|8e|8g|8i|8k|8m|8o|8q|8s|8u|90|92|94|96|98|9a|9c|9e|9i|9k|9m|9p|9r|9t|9v|a1|a3|a5|a7|aa|ac|ae|ag|ai|ak|am|ao|aq|as|au|b0|b2|b4|b6|b8|ba|bc|be|bg|bi|bk|bm|br|bt|c4|d2|d4|d9|dc|dl|ds|ed|ef|eh|ej|el|en|ep|er|eu|f0|f2|f4|f6|f8|fa|fc|fe|fk|fq|fs|fu|g0|g2|g4|g6|g8|ga|gc|ge|gg|gi|gk|gm|go|gq|gs|gu|h0|h2|h4|h6|h8|ha|hc|he|hg|hi|21|22|7g0|7g2|7g4|7g6|7g8|7ga|7gc|7ge|7gg|7gi|2d|7gk|7gm|7go|7gq|7gs|7gu|7h0|7h2|7h4|7h6|7h8|7ha|7hc|7he|7hg|7hi|7hk|7hm|7ho|7hq|7hs|7hu|7i0|7i2|7i4|7i6|7i8|7ia|7ic|7ie|7ig|7ii|7ik|7im|7io|7iq|7is|7iu|7j0|7j2|7j4|7j6|7j8|7ja|7jc|7je|7jg|7ji|7jk|7jm|2e|7jo|7jq|7js|7ju|7k0|7k2|7k4|7k6|7k8|7ka|7kc|7ke|7kg|7ki|7kk|7l0|7l2|7l4|7l6|7l8|7la|7lc|7le|7lg|7li|7lk|7lm|7lo|7lq|7ls|7lu|7m0|7m2|7m4|7m6|7m8|7ma|7mc|7me|7mg|7mi|7mk|7mm|7mo|7mq|2f|7ms|7mu|7n0|7n2|7n4|7n6|7n8|7na|7nc|7ne|7ng|7ni|7nk|7nm|7no|2g|7qp|7qr|7qt|7qv|2h|896|2l|s6|sc|uo|uq|us|uu|v0|v2|v4|v6"},"C.1.1":{s:"10"},"C.1.2":{r:"800:80b",s:"c00|50|5k0|81f|82v"},"C.2.1":{r:"0:v",s:"3v"},"C.2.2":{r:"40:4v|80c:80d|818:819|830:833|83a:83f|1vvp:1vvs|3kbj:3kbq",s:"1mt|1of|60e|1vnv"},"C.3":{r:"1o00:1u7v|u000:vvvt|10000:11vvt"},"C.4":{r:"1veg:1vff|1vvu:1vvv|3vvu:3vvv|5vvu:5vvv|7vvu:7vvv|9vvu:9vvv|bvvu:bvvv|dvvu:dvvv|fvvu:fvvv|hvvu:hvvv|jvvu:jvvv|lvvu:lvvv|nvvu:nvvv|pvvu:pvvv|rvvu:rvvv|tvvu:tvvv|vvvu:vvvv|11vvu:11vvv"},"C.5":{r:"1m00:1nvv"},"C.6":{r:"1vvp:1vvt"},"C.7":{r:"bvg:bvr"},"C.8":{r:"q0:q1|80e:80f|81a:81e|83a:83f"},"C.9":{r:"s010:s03v",s:"s001"},"D.1":{r:"1eg:1fa|1fg:1fk|1h1:1hq|1i0:1ia|1jd:1jf|1jh:1ml|1n5:1n6|1nq:1nu|1o0:1od|1oi:1pc|1s0:1t5|1uov:1up8|1upa:1upm|1upo:1ups|1uq0:1uq1|1uq3:1uq4|1uq6:1uth|1uuj:1v9t|1vag:1vcf|1vci:1ve7|1vfg:1vfs|1vjg:1vjk|1vjm:1vns",s:"1du|1e0|1e3|1gr|1gv|1mt|1og|1th|1uot|1upu|80f"},"D.2":{r:"21:2q|31:3q|60:6m|6o:7m|7o:h0|h2:hj|ig:ld|lg:lo|lr:m1|mg:mh|n0:n4|s8:sa|se:t1|t3:ue|ug:vl|100:142|14a:16e|16g:17l|17o:17p|180:18f|19h:1am|1ap:1av|1b1:1c7|285:29p|29t:2a0|2a9:2ac|2ao:2b1|2b4:2bg|2c2:2c3|2c5:2cc|2cf:2cg|2cj:2d8|2da:2dg|2dm:2dp|2du:2e0|2e7:2e8|2eb:2ec|2es:2et|2ev:2f1|2f6:2fh|2fk:2fq|2g5:2ga|2gf:2gg|2gj:2h8|2ha:2hg|2hi:2hj|2hl:2hm|2ho:2hp|2hu:2i0|2ip:2is|2j6:2jf|2ji:2jk|2k5:2kb|2kf:2kh|2kj:2l8|2la:2lg|2li:2lj|2ll:2lp|2lt:2m0|2mb:2mc|2n6:2nf|2o2:2o3|2o5:2oc|2of:2og|2oj:2p8|2pa:2pg|2pi:2pj|2pm:2pp|2pt:2pu|2q7:2q8|2qb:2qc|2qs:2qt|2qv:2r1|2r6:2rg|2s5:2sa|2se:2sg|2si:2sl|2sp:2sq|2su:2sv|2t3:2t4|2t8:2ta|2te:2tl|2tn:2tp|2tu:2tv|2u1:2u2|2u6:2u8|2ua:2uc|2v7:2vi|301:303|305:30c|30e:30g|30i:318|31a:31j|31l:31p|321:324|330:331|336:33f|342:343|345:34c|34e:34g|34i:358|35a:35j|35l:35p|360:364|367:368|36a:36b|36l:36m|370:371|376:37f|382:383|385:38c|38e:38g|38i:398|39a:39p|39u:3a0|3a6:3a8|3aa:3ac|3b0:3b1|3b6:3bf|3c2:3c3|3c5:3cm|3cq:3dh|3dj:3dr|3e0:3e6|3ef:3eh|3eo:3ev|3fi:3fk|3g1:3hg|3hi:3hj|3i0:3i6|3if:3ir|3k1:3k2|3k7:3k8|3kk:3kn|3kp:3kv|3l1:3l3|3la:3lb|3ld:3lg|3li:3lj|3m0:3m4|3mg:3mp|3ms:3mt|3o0:3on|3oq:3pk|3pu:3q7|3q9:3ra|3s8:3sb|3tu:3u5|3u7:3uc|400:411|413:417|419:41a|420:42n|450:465|46g:47o|480:4ap|4av:4d2|4d8:4fp|4g0:4g6|4g8:4i6|4ia:4id|4ig:4im|4iq:4it|4j0:4k6|4ka:4kd|4kg:4le|4li:4ll|4lo:4lu|4m2:4m5|4m8:4me|4mg:4mm|4mo:4ne|4ng:4oe|4oi:4ol|4oo:4ou|4p0:4q6|4q8:4qq|4r1:4rs|4t0:4vk|501:5jm|5k1:5kq|5l0:5ng|5o0:5oc|5oe:5oh|5p0:5ph|5pl:5pm|5q0:5qh|5r0:5rc|5re:5rg|5s0:5tm|5tu:5u5|5u7:5u8|5uk:5uq|5v0:5v9|60g:60p|610:63n|640:658|7g0:7kr|7l0:7np|7o0:7ol|7oo:7ot|7p0:7q5|7q8:7qd|7qg:7qn|7qv:7rt|7s0:7tk|7tm:7ts|7u2:7u4|7u6:7uc|7ug:7uj|7um:7ur|7v0:7vc|7vi:7vk|7vm:7vs|88a:88j|88p:88t|89a:89d|89f:89h|89j:89p|89t:89v|8a5:8a9|8b0:8c3|8pm:8rq|94s:979|c05:c07|c11:c19|c1h:c1l|c1o:c1s|c21:c4m|c4t:c4v|c51:c7q|c7s:c7v|c85:c9c|c9h:cce|ccg:cdn|cfg:cgs|ch0:ci3|cj0:cjr|cjv:clg|cm0:cmb|cmg:cnu|co0:crm|crr:cut|cv0:cvu|d00:jdl|jg0:17t5|1800:194c|1b00:1lt3|1m00:1uhd|1uhg:1uja|1uo0:1uo6|1uoj:1uon|1vp1:1vpq|1vq1:1vqq|1vr6:1vtu|1vu2:1vu7|1vua:1vuf|1vui:1vun|1vuq:1vus|20o0:20ou|20p0:20p3|20pg:20qa|2100:2115|2118:212d|3k00:3k7l|3k80:3k96|3k9a:3kb6|3kba:3kbi|3kc3:3kc4|3kcc:3kd9|3kde:3ket|3l00:3l2k|3l2m:3l4s|3l4u:3l4v|3l55:3l56|3l59:3l5c|3l5e:3l5p|3l5t:3l60|3l62:3l63|3l65:3l85|3l87:3l8a|3l8d:3l8k|3l8m:3l8s|3l8u:3l9p|3l9r:3l9u|3la0:3la4|3laa:3lag|3lai:3ll3|3ll8:3lu9|4000:59mm|5u00:5ugt|u000:vvvt|10000:11vvt",s:"3l52|3l5r|3la6|1c9|5a|5l|5q|283|2ag|2di|2en|2iu|2k3|2kd|2m9|2mg|2n0|2q0|2qn|2s3|2ss|2un|35u|36u|3an|3dt|3k4|3ka|3kd|3l5|3l7|3lt|3m6|3pm|3po|3rv|3s5|3uf|41c|41h|41o|47r|4i8|4io|4k8|4lg|4m0|4og|5us|ne|7qp|7qr|7qt|7tu|80e|83h|83v|882|887|88l|894|896|898|rq|s6|sc|8sl"}}},function(e,t,n){"use strict";const i=n(89),r=Symbol("max"),s=Symbol("length"),o=Symbol("lengthCalculator"),a=Symbol("allowStale"),c=Symbol("maxAge"),l=Symbol("dispose"),u=Symbol("noDisposeOnSet"),d=Symbol("lruList"),p=Symbol("cache"),h=Symbol("updateAgeOnGet"),f=()=>1;const m=(e,t,n)=>{const i=e[p].get(t);if(i){const t=i.value;if(g(e,t)){if(b(e,i),!e[a])return}else n&&(e[h]&&(i.value.now=Date.now()),e[d].unshiftNode(i));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[c]&&n>e[c]},v=e=>{if(e[s]>e[r])for(let t=e[d].tail;e[s]>e[r]&&null!==t;){const n=t.prev;b(e,t),t=n}},b=(e,t)=>{if(t){const n=t.value;e[l]&&e[l](n.key,n.value),e[s]-=n.length,e[p].delete(n.key),e[d].removeNode(t)}};class y{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const _=(e,t,n,i)=>{let r=n.value;g(e,r)&&(b(e,n),e[a]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[r]=e.max||1/0;const t=e.length||f;if(this[o]="function"!=typeof t?f:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[l]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[h]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[r]=e||1/0,v(this)}get max(){return this[r]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,v(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[o]&&(this[o]=e,this[s]=0,this[d].forEach(e=>{e.length=this[o](e.value,e.key),this[s]+=e.length})),v(this)}get lengthCalculator(){return this[o]}get length(){return this[s]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let n=this[d].tail;null!==n;){const i=n.prev;_(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[d].head;null!==n;){const i=n.next;_(this,e,n,t),n=i}}keys(){return this[d].toArray().map(e=>e.key)}values(){return this[d].toArray().map(e=>e.value)}reset(){this[l]&&this[d]&&this[d].length&&this[d].forEach(e=>this[l](e.key,e.value)),this[p]=new Map,this[d]=new i,this[s]=0}dump(){return this[d].map(e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[d]}set(e,t,n){if((n=n||this[c])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,a=this[o](t,e);if(this[p].has(e)){if(a>this[r])return b(this,this[p].get(e)),!1;const o=this[p].get(e).value;return this[l]&&(this[u]||this[l](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[s]+=a-o.length,o.length=a,this.get(e),v(this),!0}const h=new y(e,t,a,i,n);return h.length>this[r]?(this[l]&&this[l](e,t),!1):(this[s]+=h.length,this[d].unshift(h),this[p].set(e,this[d].head),v(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!g(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[d].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[p].forEach((e,t)=>m(this,t,!1))}}},function(e,t,n){"use strict";function i(e){var t=this;if(t instanceof i||(t=new i),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n<r;n++)t.push(arguments[n]);return t}function r(e,t,n){var i=t===e.head?new a(n,null,t,e):new a(n,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function s(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function o(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,n,i){if(!(this instanceof a))return new a(e,t,n,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}e.exports=i,i.Node=a,i.create=i,i.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},i.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},i.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},i.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},i.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},i.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},i.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},i.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,i=0;null!==n;i++)e.call(t,n.value,i,this),n=n.next},i.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,i=this.length-1;null!==n;i--)e.call(t,n.value,i,this),n=n.prev},i.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},i.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},i.prototype.map=function(e,t){t=t||this;for(var n=new i,r=this.head;null!==r;)n.push(e.call(t,r.value,this)),r=r.next;return n},i.prototype.mapReverse=function(e,t){t=t||this;for(var n=new i,r=this.tail;null!==r;)n.push(e.call(t,r.value,this)),r=r.prev;return n},i.prototype.reduce=function(e,t){var n,i=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=e(n,i.value,r),i=i.next;return n},i.prototype.reduceReverse=function(e,t){var n,i=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=e(n,i.value,r),i=i.prev;return n},i.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},i.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},i.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new i;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=0,s=this.head;null!==s&&r<e;r++)s=s.next;for(;null!==s&&r<t;r++,s=s.next)n.push(s.value);return n},i.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new i;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=this.length,s=this.tail;null!==s&&r>t;r--)s=s.prev;for(;null!==s&&r>e;r--,s=s.prev)n.push(s.value);return n},i.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,s=this.head;null!==s&&i<e;i++)s=s.next;var o=[];for(i=0;s&&i<t;i++)o.push(s.value),s=this.removeNode(s);null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(i=0;i<n.length;i++)s=r(this,s,n[i]);return o},i.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=e,this};try{n(90)(i)}catch(e){}},function(e,t,n){"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt,a="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,l=a||c||Function("return this")(),u=Object.prototype.toString,d=Math.max,p=Math.min,h=function(){return l.Date.now()};function f(e,t,n){var i,r,s,o,a,c,l=0,u=!1,f=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=i,s=r;return i=r=void 0,l=t,o=e.apply(s,n)}function y(e){return l=e,a=setTimeout(S,t),u?b(e):o}function _(e){var n=e-c;return void 0===c||n>=t||n<0||f&&e-l>=s}function S(){var e=h();if(_(e))return w(e);a=setTimeout(S,function(e){var n=t-(e-c);return f?p(n,s-(e-l)):n}(e))}function w(e){return a=void 0,v&&i?b(e):(i=r=void 0,o)}function T(){var e=h(),n=_(e);if(i=arguments,r=this,c=e,n){if(void 0===a)return y(c);if(f)return a=setTimeout(S,t),b(c)}return void 0===a&&(a=setTimeout(S,t)),o}return t=g(t)||0,m(n)&&(u=!!n.leading,s=(f="maxWait"in n)?d(g(n.maxWait)||0,t):s,v="trailing"in n?!!n.trailing:v),T.cancel=function(){void 0!==a&&clearTimeout(a),l=0,i=c=r=a=void 0},T.flush=function(){return void 0===a?o:w(h())},T}function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==u.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var a=r.test(e);return a||s.test(e)?o(e.slice(2),a?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return m(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),f(e,t,{leading:i,maxWait:t,trailing:r})}}).call(this,n(6))},function(e,t,n){e.exports=function(){"use strict";var e="undefined"==typeof window,t=!1,n=!1,i=!1,r=!1,s=!1,o=!1,a=!1,c=!1,l=!1,u=!1;return e||(t="undefined"!=typeof InstallTrigger,n=!!window.chrome,i=!(!window.chrome||!window.navigator||!window.navigator.plugins||!window.navigator.plugins.namedItem("Chrome PDF Plugin")&&!window.chrome.runtime),r=n&&!window.chrome.webstore&&!window.chrome.runtime,s=0<Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")||window.safari&&window.safari.pushNotification,o=!!window.opr&&!!window.opr.addons||!!window.opera,a=!!window.StyleMedia,c=n&&!!navigator.userAgent.match(/edg/i),l=(i||o)&&!!window.CSS,u=!(n||s||t||o||!document.documentMode)),{get isChrome(){return i},get isChromeOrChromium(){return n},get isChromium(){return r},get isFirefox(){return t},get isSafari(){return s},get isOpera(){return o},get isEdge(){return a},get isEdgeChromium(){return c},get isIE(){return u},get isBlink(){return l}}}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.definitions=void 0;const i=n(94),r=n(13),s={aliases:["message.propose"],element:"propose",fields:{conversationId:i.attribute("inin-cid"),persistentConversationId:i.attribute("inin-persistent-cid"),sdpOverXmpp:i.booleanAttribute("inin-sdp-over-xmpp"),originalRoomJid:i.attribute("inin-ofrom"),autoAnswer:i.booleanAttribute("inin-autoanswer"),fromUserId:i.attribute("inin-user-id"),sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},o={aliases:["message.proceed"],element:"proceed",fields:{sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},a={aliases:["message.accept"],element:"accept",fields:{sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},c={aliases:["message.reject"],element:"reject",fields:{sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},l={aliases:["message.retract"],element:"retract",fields:{sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},u={aliases:["iq.jingle.screenstart"],element:"screen-start",namespace:r.NS_JINGLE_RTP_INFO_1},d={aliases:["iq.jingle.screenstop"],element:"screen-stop",namespace:r.NS_JINGLE_RTP_INFO_1},p={path:"iq",namespace:r.NS_CLIENT,element:"iq",fields:{genesysWebrtc:i.childJSON("genesys","genesys-webrtc")}},h={path:"message",namespace:r.NS_CLIENT,element:"message",fields:{mediaMessage:i.childJSON("genesys","media-message")}},f={aliases:["presence.media"],element:"x",fields:{conversationId:i.attribute("conversationId"),sourceCommunicationId:i.attribute("sourceCommunicationId"),screenShare:i.childAttribute(null,"mediastream","screenShare"),video:i.childAttribute(null,"mediastream","video"),audio:i.childAttribute(null,"mediastream","audio"),listener:i.childAttribute(null,"mediastream","listener"),screenRecording:i.childAttribute(null,"mediastream","screenRecording")},namespace:"orgspan:mediastream"};t.definitions=[s,o,a,c,l,u,d,f,p,h]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.define=t.XMLElement=t.Translator=t.Registry=t.StreamParser=t.parse=t.Parser=void 0;const i=n(0),r=i.__importDefault(n(21));t.XMLElement=r.default;const s=i.__importDefault(n(95));t.Registry=s.default;const o=i.__importDefault(n(50));t.Translator=o.default,i.__exportStar(n(22),t),i.__exportStar(n(32),t),i.__exportStar(n(97),t);var a=n(33);Object.defineProperty(t,"Parser",{enumerable:!0,get:function(){return i.__importDefault(a).default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return a.parse}});var c=n(98);Object.defineProperty(t,"StreamParser",{enumerable:!0,get:function(){return i.__importDefault(c).default}}),t.define=function(e){return t=>{t.define(e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(22),s=i.__importDefault(n(96)),o=i.__importDefault(n(50));t.default=class{constructor(){this.translators=new Map,this.root=new o.default,this.setLanguageResolver(r.basicLanguageResolver)}setLanguageResolver(e){this.languageResolver=e}import(e,t={registry:this}){if(!this.hasTranslator(e.getNamespace(),e.getName()))return;t.acceptLanguages||(t.acceptLanguages=[]),t.acceptLanguages=t.acceptLanguages.map(e=>e.toLowerCase()),t.lang&&(t.lang=t.lang.toLowerCase()),t.resolveLanguage||(t.resolveLanguage=this.languageResolver),t.path=this.getImportKey(e),t.sanitizers||(t.sanitizers={xhtmlim:s.default});return this.getOrCreateTranslator(e.getNamespace(),e.getName()).import(e,{...t,registry:this})}export(e,t,n={registry:this}){n.acceptLanguages||(n.acceptLanguages=[]),n.acceptLanguages=n.acceptLanguages.map(e=>e.toLowerCase()),n.lang&&(n.lang=n.lang.toLowerCase()),n.sanitizers||(n.sanitizers={xhtmlim:s.default}),n.path=e;const i=e.split(".").filter(e=>""!==e);let r=this.root;for(const e of i){const t=r.getChild(e);if(!t)return;r=t}return r.export(t,{...n,registry:this})}getImportKey(e,t=""){const n=t?this.walkToTranslator(t.split(".")):this.root;if(n)return n.getImportKey(e)}define(e){if(Array.isArray(e)){for(const t of e)"object"==typeof t?this.define(t):t(this);return}if("object"!=typeof e)return void e(this);const t=e;t.aliases=t.aliases||[],t.path&&!t.aliases.includes(t.path)&&t.aliases.push(t.path);const n=t.aliases.map(e=>"string"==typeof e?{path:e}:e).sort((e,t)=>{const n=e.path.split(".").length;return t.path.split(".").length-n});let i;if(this.hasTranslator(t.namespace,t.element)&&(i=this.getOrCreateTranslator(t.namespace,t.element)),!i){let e;for(const t of n){const n=this.walkToTranslator(t.path.split("."));if(n&&!n.placeholder){i=n;break}n&&(e=n)}e&&!i&&(i=e,i.placeholder=!1)}i||(i=this.getOrCreateTranslator(t.namespace,t.element)),this.indexTranslator(t.namespace,t.element,i);const r=t.fields||{},s=new Map,o=new Map,a=new Map,c=new Map;t.typeField&&(i.typeField=t.typeField),t.defaultType&&(i.defaultType=t.defaultType),t.versionField&&(i.versionField=t.versionField),t.defaultVersion&&(i.defaultVersion=t.defaultVersion),t.languageField&&(i.languageField=t.languageField);for(const[e,t]of Object.entries(r))s.set(e,t.importer),a.set(e,t.importOrder||t.order||0),o.set(e,t.exporter),c.set(e,t.exportOrder||t.order||0);if(t.childrenExportOrder)for(const[e,n]of Object.entries(t.childrenExportOrder))c.set(e,n||0);const l=new Map;for(const[e,n]of Object.entries(t.optionalNamespaces||{}))l.set(e,n);i.updateDefinition({contexts:new Map,element:t.element,exporterOrdering:c,exporters:o,importerOrdering:a,importers:s,namespace:t.namespace,optionalNamespaces:l,type:t.type,version:t.version,typeOrder:t.typeOrder});for(const e of n)this.alias(t.namespace,t.element,e.path,e.multiple,e.selector,e.contextField,t.type,e.impliedType);for(const e of n){const t=this.walkToTranslator(e.path.split("."));t&&t!==i&&t.replaceWith(i)}}alias(e,t,n,i=!1,r,s,o,a=!1){const c=this.getOrCreateTranslator(e,t);c.placeholder=!1;const l=n.split(".").filter(e=>""!==e),u=l.pop(),d=this.walkToTranslator(l,!0),p=`{${e}}${t}`;o&&(s||a)&&c.addContext(n,r,s,p,o,a),d.addChild(u,c,i,r,p)}walkToTranslator(e,t=!1){let n=this.root;for(const i of e){let e=n.getChild(i);if(!e){if(!t)return;e=new o.default,e.placeholder=!0,n.addChild(i,e)}n=e}return n}hasTranslator(e,t){return this.translators.has(`{${e}}${t}`)}getOrCreateTranslator(e,t){let n=this.translators.get(`{${e}}${t}`);return n||(n=new o.default,this.indexTranslator(e,t,n)),n}indexTranslator(e,t,n){this.translators.set(`{${e}}${t}`,n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=new Set(["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul"]),r=new Set(["style"]),s=new Map([["a",new Set(["href","style"])],["body",new Set(["style","xml:lang"])],["blockquote",r],["br",r],["cite",r],["em",r],["img",new Set(["alt","height","src","style","width"])],["li",r],["ol",r],["p",r],["span",r],["strong",r],["ul",r]]),o=new Map([["font-style",/normal|italic|oblique|inherit/i],["font-weight",/normal|bold|bolder|lighter|inherit|\d\d\d/i],["text-decoration",/none|underline|overline|line-through|blink|inherit/i]]),a=e=>!!e.match(/^(https?|xmpp|cid|mailto|ftps?|im|ircs?|sips?|tel|geo|bitcoin|magnet):/i)&&e,c=e=>!!e.match(/^[0-9]*$/)&&e,l={alt:e=>e,height:c,href:a,src:a,style:e=>{const t=(";"+e).replace(/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,"").replace(/\/\*.*/,"").replace(/\\([a-fA-F0-9]{1,6})\s?/,(e,t)=>String.fromCharCode(parseInt(t,16))).match(/;\s*([a-z-]+)\s*:\s*([^;]*[^\s;])\s*/g),n=[];if(!t)return!1;for(const e of t){const t=e.match(/^;\s*([a-z-]+)\s*:\s*([^;]*[^\s])\s*$/);if(!t)continue;const i=o.get(t[1]);if(i){const e=t[2].match(i);e&&n.push(`${t[1]}:${e[0]}`)}}return!!n.length&&n.join("")},width:c};function u(e){if("string"==typeof e)return e;if(!i.has(e.name)){if("script"===e.name)return;return function(e){let t=[];for(const n of e.children)if("string"==typeof n)t.push(n);else{const e=u(n);e&&(Array.isArray(e)?t=t.concat(e):t.push(e))}return t}(e)}const t=e.children.map(u).filter(e=>void 0!==e),n={};for(const[t,i]of Object.entries(e.attributes)){const r=s.get(e.name);if(!r||!r.has(t))continue;if(!i)continue;const o=l[t](i);o&&(n[t]=o)}return{attributes:n,children:t,name:e.name}}t.default=function(e){if("string"==typeof e)return;let t=[];for(const n of e.children){if(!n)continue;if("string"==typeof n){t.push(n);continue}const e=u(n);Array.isArray(e)?t=t.concat(e):e&&t.push(e)}const n={};return"body"===e.name?(void 0!==e.attributes.xmlns&&(n.xmlns=e.attributes.xmlns),e.attributes.style&&(n.style=e.attributes.style),void 0!==e.attributes["xml:lang"]&&(n["xml:lang"]=e.attributes["xml:lang"]),{attributes:n,children:t,name:"body"}):void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pubsubItemContentAliases=t.extendStanzaError=t.extendStreamFeatures=t.extendIQ=t.extendPresence=t.extendMessage=t.addAlias=t.childJID=t.childJIDAttribute=t.JIDAttribute=void 0;const i=n(13),r=n(32);t.JIDAttribute=r.attribute,t.childJIDAttribute=r.childAttribute,t.childJID=r.childText,t.addAlias=function(e,t,n){return{aliases:Array.isArray(n)?n:[n],element:t,fields:{},namespace:e}},t.extendMessage=function(e){return{element:"message",fields:e,namespace:i.NS_CLIENT}},t.extendPresence=function(e){return{element:"presence",fields:e,namespace:i.NS_CLIENT}},t.extendIQ=function(e){return{element:"iq",fields:e,namespace:i.NS_CLIENT}},t.extendStreamFeatures=function(e){return{element:"features",fields:e,namespace:i.NS_STREAM}},t.extendStanzaError=function(e){return{element:"error",fields:e,namespace:i.NS_STANZAS,path:"stanzaError"}},t.pubsubItemContentAliases=function(){return[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(7),s=i.__importDefault(n(21)),o=i.__importDefault(n(31)),a=i.__importDefault(n(33));class c extends r.Transform{constructor(e){super({objectMode:!0}),this.closedStream=!1,this.wrappedStream=!1,this.registry=e.registry,this.acceptLanguages=e.acceptLanguages||[],e.wrappedStream&&(this.wrappedStream=!0,this.rootImportKey=e.rootKey),this.parser=new a.default({allowComments:e.allowComments}),this.parser.on("error",e=>{this.destroy(e)}),this.parser.on("startElement",(e,t)=>{if(this.destroyed)return;if(this.closedStream)return this.destroy(o.default.alreadyClosed());const n=new s.default(e,t),i=this.registry.getImportKey(n);if(this.wrappedStream&&!this.rootElement){if(this.rootImportKey&&i!==this.rootImportKey)return this.destroy(o.default.unknownRoot());const e=this.registry.import(n,{acceptLanguages:this.acceptLanguages,lang:this.lang});return e?(this.rootElement=n,void this.push({event:"stream-start",kind:i,stanza:e,xml:n})):this.destroy(o.default.notWellFormed())}this.currentElement?this.currentElement=this.currentElement.appendChild(n):this.currentElement=n}),this.parser.on("endElement",e=>{if(!this.destroyed){if(this.wrappedStream&&!this.currentElement)return this.rootElement&&e===this.rootElement.name?(this.closedStream=!0,this.push({event:"stream-end",kind:this.rootImportKey,stanza:{},xml:this.rootElement}),this.end()):(this.closedStream=!0,this.destroy(o.default.notWellFormed()));if(!this.currentElement||e!==this.currentElement.name)return this.closedStream=!0,this.destroy(o.default.notWellFormed());if(this.currentElement.parent)this.currentElement=this.currentElement.parent;else{this.wrappedStream&&(this.currentElement.parent=this.rootElement);const e=this.registry.getImportKey(this.currentElement),t=this.registry.import(this.currentElement,{acceptLanguages:this.acceptLanguages,lang:this.lang});t&&this.push({kind:e,stanza:t,xml:this.currentElement}),this.currentElement=void 0}}}),this.parser.on("text",e=>{this.currentElement&&this.currentElement.children.push(e)})}_transform(e,t,n){this.parser.write(e.toString()),n()}}t.default=c},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t,n){"use strict";var i=n(24).Buffer,r=n(102);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t,n,r,s=i.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=s,r=a,t.copy(n,r),a+=o.data.length,o=o.next;return s},e}(),r&&r.inspect&&r.inspect.custom&&(e.exports.prototype[r.inspect.custom]=function(){var e=r.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){(function(e){var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(r.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new s(r.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(104),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(6))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var i,r,s,o,a,c=1,l={},u=!1,d=e.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(e);p=p&&p.setTimeout?p:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick((function(){f(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){f(e.data)},i=function(e){s.port2.postMessage(e)}):d&&"onreadystatechange"in d.createElement("script")?(r=d.documentElement,i=function(e){var t=d.createElement("script");t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):i=function(e){setTimeout(f,0,e)}:(o="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&f(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),i=function(t){e.postMessage(o+t,"*")}),p.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var r={callback:e,args:t};return l[c]=r,i(c),c++},p.clearImmediate=h}function h(e){delete l[e]}function f(e){if(u)setTimeout(f,0,e);else{var t=l[e];if(t){u=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{h(e),u=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(6),n(11))},function(e,t,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&"true"===String(n).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var i=!1;return function(){if(!i){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this,n(6))},function(e,t,n){"use strict";e.exports=s;var i=n(56),r=Object.create(n(17));function s(e){if(!(this instanceof s))return new s(e);i.call(this,e)}r.inherits=n(18),r.inherits(s,i),s.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";function i(e,t=""){const n={};if(Array.isArray(e))for(let r=0;r<e.length;r++)Object.assign(n,i(e[r],`${t}_[${r}]`));else"object"!=typeof e?n[t]=e:Object.keys(e).filter(e=>"ip"!==e.toLowerCase()).forEach(r=>{const s=e[r],o=t?`${t}_${r}`:r;"object"==typeof s||Array.isArray(s)?Object.assign(n,i(s,o)):n[o]=s});return n}Object.defineProperty(t,"__esModule",{value:!0}),t.deepFlatten=t.formatStatsEvent=void 0,t.formatStatsEvent=function(e,t={}){const n={_eventType:e.name,_eventTimestamp:(new Date).getTime(),...t};return function(e){return"getStats"===e.name}(e)&&Object.assign(n,function(e){let t={};return Object.assign(t,i(e.tracks,"localTrack")),delete e.tracks,Object.assign(t,i(e.remoteTracks,"remoteTrack")),delete e.remoteTracks,t}(e)),Object.assign(n,i(e)),delete n.name,{actionName:"WebrtcStats",details:n}},t.deepFlatten=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=t.FileSession=t.MediaSession=t.ICESession=t.Session=t.exportToSDP=t.importFromSDP=void 0;const i=n(0),r=i.__importDefault(n(57));t.FileSession=r.default;const s=i.__importDefault(n(36));t.ICESession=s.default;const o=i.__importDefault(n(59));t.MediaSession=o.default;const a=i.__importDefault(n(38));t.Session=a.default;const c=i.__importDefault(n(109));t.SessionManager=c.default;var l=n(25);Object.defineProperty(t,"importFromSDP",{enumerable:!0,get:function(){return l.importFromSDP}}),Object.defineProperty(t,"exportToSDP",{enumerable:!0,get:function(){return l.exportToSDP}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(4),s=n(35),o=n(9),a=n(13),c=n(58),l=i.__importDefault(n(57)),u=i.__importDefault(n(59)),d=i.__importDefault(n(38));class p extends r.EventEmitter{constructor(e={}){super(),e=e||{},this.selfID=e.selfID,this.sessions={},this.peers={},this.iceServers=e.iceServers||[],this.prepareSession=e.prepareSession||(e=>{if(this.config.hasRTCPeerConnection)return e.applicationTypes.indexOf(a.NS_JINGLE_RTP_1)>=0?new u.default(e):e.applicationTypes.indexOf(a.NS_JINGLE_FILE_TRANSFER_5)>=0?new l.default(e):void 0}),this.performTieBreak=e.performTieBreak||((e,t)=>{const n=(t.jingle.contents||[]).map(e=>{if(e.application)return e.application.applicationType});return(e.pendingApplicationTypes||[]).filter(e=>n.includes(e)).length>0}),this.createPeerConnection=e.createPeerConnection||((e,t)=>{if(s.RTCPeerConnection)return new s.RTCPeerConnection(t)}),this.config={debug:!1,hasRTCPeerConnection:!!s.RTCPeerConnection,peerConnectionConfig:{bundlePolicy:e.bundlePolicy||"balanced",iceTransportPolicy:e.iceTransportPolicy||"all",rtcpMuxPolicy:e.rtcpMuxPolicy||"require",sdpSemantics:e.sdpSemantics},peerConnectionConstraints:{optional:[{DtlsSrtpKeyAgreement:!0},{RtpDataChannels:!1}]},...e}}addICEServer(e){if("string"==typeof e)return void this.iceServers.push({urls:e});if(!(t=e).type&&(t.urls||t.url))return void this.iceServers.push(e);var t;let n=e.host||"";n.indexOf(":")>=0&&(n=`[${n}]`);let i=`${e.type}:${n}`;e.port&&(i+=":"+e.port),e.transport&&(i+="?transport="+e.transport),"turn"===e.type||"turns"===e.type?this.iceServers.push({credential:e.password,urls:[i],username:e.username}):"stun"!==e.type&&"stuns"!==e.type||this.iceServers.push({urls:[i]})}resetICEServers(){this.iceServers=[]}addSession(e){e.parent=this;const t=e.sid,n=e.peerID;return this.sessions[t]=e,this.peers[n]||(this.peers[n]=[]),this.peers[n].push(e),this.emit("createdSession",e),e}forgetSession(e){const t=this.peers[e.peerID]||[];t.length&&t.splice(t.indexOf(e),1),delete this.sessions[e.sid]}createMediaSession(e,t,n){const i=new u.default({config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!0,maxRelayBandwidth:786432,parent:this,peerID:e,sid:t,stream:n});return this.addSession(i),i}createFileTransferSession(e,t){const n=new l.default({config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!0,maxRelayBandwidth:786432,parent:this,peerID:e,sid:t});return this.addSession(n),n}endPeerSessions(e,t,n=!1){const i=this.peers[e]||[];delete this.peers[e];for(const e of i)e.end(t||"gone",n)}endAllSessions(e,t=!1){for(const n of Object.keys(this.peers))this.endPeerSessions(n,e,t)}process(e){const t=e.jingle?e.jingle.sid:void 0;let n=t?this.sessions[t]:void 0;const i=e.id,r=e.from;if(!r)return;if("error"===e.type){if(this._log("error","Received error response",e),n&&e.error&&"unknown-session"===e.error.jingleError)return n.end("gone",!0);const t=e.error&&"tie-break"===e.error.jingleError;return n&&"pending"===n.state&&t?n.end("alternative-session",!0):void(n&&(n.pendingAction=void 0))}if("result"===e.type)return void(n&&(n.pendingAction=void 0));const s=e.jingle.action,a=e.jingle.contents||[],l=a.map(e=>e.application?e.application.applicationType:void 0),u=a.map(e=>e.transport?e.transport.transportType:void 0);if(s!==o.JingleAction.SessionInitiate){if(!n)return"session-terminate"===s?void this.emit("send",{id:i,to:r,type:"result"}):(this._log("error","Unknown session",t),this._sendError(r,i,{condition:"item-not-found",jingleError:"unknown-session"}));if(n.peerID!==r||"ended"===n.state)return this._log("error","Session has ended, or action has wrong sender"),this._sendError(r,i,{condition:"item-not-found",jingleError:"unknown-session"});if("session-accept"===s&&"pending"!==n.state)return this._log("error","Tried to accept session twice",t),this._sendError(r,i,{condition:"unexpected-request",jingleError:"out-of-order"});if("session-terminate"!==s&&s===n.pendingAction&&(this._log("error","Tie break during pending request"),n.isInitiator))return this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}else if(n){if(n.peerID!==r)return this._log("error","Duplicate sid from new sender"),this._sendError(r,i,{condition:"service-unavailable"});if("pending"!==n.state)return this._log("error","Someone is doing this wrong"),this._sendError(r,i,{condition:"unexpected-request",jingleError:"out-of-order"});if(this.selfID&&this.selfID>n.peerID&&this.performTieBreak(n,e))return this._log("error","Tie break new session because of duplicate sids"),this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}else if(this.peers[r]&&this.peers[r].length)for(let n=0,s=this.peers[r].length;n<s;n++){const s=this.peers[r][n];if(s&&"pending"===s.state&&t&&c.octetCompare(s.sid,t)>0&&this.performTieBreak(s,e))return this._log("info","Tie break session-initiate"),this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}if("session-initiate"===s){if(!a.length)return this._sendError(r,i,{condition:"bad-request"});n=this._createIncomingSession({applicationTypes:l,config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!1,parent:this,peerID:r,sid:t,transportTypes:u},e)}n.process(s,e.jingle,t=>{t?(this._log("error","Could not process request",e,t),this._sendError(r,i,t)):(this.emit("send",{id:i,to:r,type:"result"}),"session-initiate"===s&&this.emit("incoming",n))})}signal(e,t){const n=t.jingle&&t.jingle.action;e.isInitiator&&n===o.JingleAction.SessionInitiate&&this.emit("outgoing",e),this.emit("send",t)}_createIncomingSession(e,t){let n;return this.prepareSession&&(n=this.prepareSession(e,t)),n||(n=new d.default(e)),this.addSession(n),n}_sendError(e,t,n){n.type||(n.type="cancel"),this.emit("send",{error:n,id:t,to:e,type:"error"})}_log(e,t,...n){this.emit("log",e,t,...n),this.emit("log:"+e,t,...n)}}t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Ping=void 0;t.Ping=class{constructor(e,t,n={}){this.client=e,this.stanzaInstance=t,this.options=n,this.pingInterval=n.pingInterval||14e3,this.failedPingsBeforeDisconnect=n.failedPingsBeforeDisconnect||1,this.numberOfFailedPings=0,this.nextPingTimeoutId=void 0,this.start()}start(){this.nextPingTimeoutId||(this.nextPingTimeoutId=-1,this.queueNextPing())}stop(){clearTimeout(this.nextPingTimeoutId),this.nextPingTimeoutId=void 0,this.numberOfFailedPings=0}async performPing(){try{await this.stanzaInstance.ping(this.options.jid),this.numberOfFailedPings=0,this.queueNextPing()}catch(e){const t={channelId:this.client.config.channelId,jid:this.stanzaInstance.jid,stanzaInstanceId:this.stanzaInstance.id};this.client.logger.warn("Missed a ping.",Object.assign({error:e},t)),++this.numberOfFailedPings>this.failedPingsBeforeDisconnect?(this.client.logger.error("Missed too many pings, disconnecting",Object.assign({numberOfFailedPings:this.numberOfFailedPings},t)),this.stanzaInstance.sendStreamError({text:"too many missed pongs",condition:"connection-timeout"}),this.stop()):this.queueNextPing()}}queueNextPing(){this.nextPingTimeoutId&&(this.nextPingTimeoutId=setTimeout(this.performPing.bind(this),this.pingInterval))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionManager=void 0;const i=n(14),r=n(113),s=n(20),o=i.__importDefault(n(62)),a=n(8);t.ConnectionManager=class{constructor(e,t){this.logger=e,this.config=t}setConfig(e){this.config=e}async getNewStanzaConnection(){const e=this.getStanzaOptions(),t=r.createClient({});t.sasl.mechanisms.find(e=>"ANONYMOUS"===e.name).priority=0,t.sasl.mechanisms=t.sasl.mechanisms.sort((e,t)=>t.priority-e.priority),t.id=s.v4();const n=t.channelId=this.config.channelId;let i,o,c,l;const u=a.timeoutPromise((n,r)=>{i=this.checkForErrorStanza.bind(this,t),t.on("raw:incoming",i),o=this.handleSessionStarted.bind(this,t,n),t.on("session:started",o),c=this.handleSessionSasl.bind(this,t,r),t.on("sasl",c),l=this.handleSessionDisconnected.bind(this,t,r),t.on("disconnected",l),t.updateConfig(e),t.connect()},15e3,"connecting to streaming service",{channelId:n,stanzaInstanceId:t.id});return u.catch(()=>t.disconnect()),u.finally(()=>{t.off("raw:incoming",i),t.off("session:started",o),t.off("sasl",c),t.off("disconnected",l)})}handleSessionStarted(e,t){this.logger.info("new stanza instance connected",{stanzaInstanceId:e.id,channelId:e.channelId}),t(e)}handleSessionSasl(e,t,n){"failure"===n.type&&t(new o.default(n.condition,e.channelId,e.id))}handleSessionDisconnected(e,t){this.logger.error("stanza disconnected",{stanzaInstanceId:e.id,channelId:e.channelId}),t()}checkForErrorStanza(e,t){t.includes("error")&&this.logger.error("Received a stanza during setup that tripped the error filter",{rawStanza:t,stanzaInstanceId:e.id,channelId:e.channelId})}getStanzaOptions(){return this.config.jwt?this.getJwtOptions():this.getStandardOptions()}getJwtOptions(){const e=this.config,t=a.parseJwt(e.jwt);let n;try{n=t.data.jid.split("@")[1].replace("conference.","")}catch(e){throw new Error("failed to parse jid")}let i=e.host.replace(/\/$/,"");return{resource:e.jidResource,transports:{websocket:`${i}/stream/jwt/${e.jwt}`},server:n}}getStandardOptions(){const e=this.config;let t=e.host.replace(/\/$/,"");return{jid:e.jid,resource:e.jidResource,credentials:{username:e.jid,password:"authKey:"+e.authToken},transports:{websocket:`${t}/stream/channels/${e.channelId}`}}}}},function(e,t,n){"use strict";n.r(t),function(e,i){n.d(t,"Client",(function(){return Ba})),n.d(t,"Constants",(function(){return ps})),n.d(t,"DataForms",(function(){return Ds})),n.d(t,"JID",(function(){return Y})),n.d(t,"JXT",(function(){return vi})),n.d(t,"Jingle",(function(){return qs})),n.d(t,"Namespaces",(function(){return si})),n.d(t,"RSM",(function(){return Ga})),n.d(t,"RTT",(function(){return za})),n.d(t,"SASL",(function(){return vr})),n.d(t,"Stanzas",(function(){return qa})),n.d(t,"Utils",(function(){return Cr})),n.d(t,"VERSION",(function(){return Va})),n.d(t,"core",(function(){return Zs})),n.d(t,"createClient",(function(){return Ha})),n.d(t,"getHostMeta",(function(){return ms}));var r=n(0),s=n(16),o=n(4),a=n(5),c=n.n(a),l=n(7),u=n(3);const d=Math.pow(2,32),p=(e,t)=>(e%t+t)%t;class h extends o.EventEmitter{constructor(){super(),this.allowResume=!0,this.lastAck=0,this.handled=0,this.unacked=[],this.inboundStarted=!1,this.outboundStarted=!1,this.id=void 0,this.jid=void 0,this.allowResume=!0,this.started=!1,this.cacheHandler=()=>{},this._reset()}get started(){return this.outboundStarted&&this.inboundStarted}set started(e){e||(this.outboundStarted=!1,this.inboundStarted=!1)}get resumable(){return this.started&&this.allowResume}load(e){var t;this.id=e.id,this.allowResume=null===(t=e.allowResume)||void 0===t||t,this.handled=e.handled,this.lastAck=e.lastAck,this.unacked=e.unacked,this.emit("prebound",e.jid)}cache(e){this.cacheHandler=e}bind(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.jid=e,yield this._cache()}))}enable(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.emit("send",{allowResumption:this.allowResume,type:"enable"})}))}resume(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.emit("send",{handled:this.handled,previousSession:this.id,type:"resume"})}))}enabled(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.id=e.id,this.handled=0,this.inboundStarted=!0,yield this._cache()}))}resumed(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.id=e.previousSession,this.inboundStarted=!0,yield this.process(e,!0),yield this._cache()}))}failed(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){yield this.process(e);for(const[e,t]of this.unacked)this.emit("failed",{kind:e,stanza:t});this._reset(),yield this._cache()}))}ack(){this.emit("send",{handled:this.handled,type:"ack"})}request(){this.emit("send",{type:"request"})}process(e,t=!1){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(void 0===e.handled)return;const n=p(e.handled-this.lastAck,d);for(let e=0;e<n&&this.unacked.length>0;e++){const[e,t]=this.unacked.shift();this.emit("acked",{kind:e,stanza:t})}if(this.lastAck=e.handled,t){const e=this.unacked;if(this.unacked=[],e.length){this.emit("begin-resend");for(const[t,n]of e)this.emit("resend",{kind:t,stanza:n});this.emit("end-resend")}}yield this._cache()}))}track(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){return"sm"!==e||"enable"!==t.type&&"resume"!==t.type?!!this.outboundStarted&&(("message"===e||"presence"===e||"iq"===e)&&(this.unacked.push([e,t]),yield this._cache(),!0)):(this.handled=0,this.outboundStarted=!0,yield this._cache(),!1)}))}handle(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.inboundStarted&&(this.handled=p(this.handled+1,d),yield this._cache())}))}hibernate(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(!this.resumable)return this.shutdown();for(const[e,t]of this.unacked)this.emit("hibernated",{kind:e,stanza:t})}))}shutdown(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){return this.failed({type:"failed"})}))}_cache(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){try{yield this.cacheHandler({allowResume:this.allowResume,handled:this.handled,id:this.id,jid:this.jid,lastAck:this.lastAck,unacked:this.unacked})}catch(e){console.error("Failed to cache stream state",e)}}))}_reset(){this.id="",this.inboundStarted=!1,this.outboundStarted=!1,this.lastAck=0,this.handled=0,this.unacked=[]}}const f={"A.1":{r:"hk:if|le:lf|nf:nv|qg:qv|rg:rj|rm:rp|rr:rt|rv:s3|vn:vv|17m:17n|17q:17v|18g:19g|1an:1ao|1cb:1cg|1e5:1ef|1fb:1ff|1fl:1gb|1gd:1gq|1gs:1gu|1hr:1hv|1im:1iv|1ne:1nf|1pd:1pf|1qb:1rv|1ti:280|29q:29r|2ae:2af|2al:2an|2bh:2c0|2cd:2ce|2ch:2ci|2dj:2dl|2dq:2dr|2e5:2e6|2e9:2ea|2ee:2em|2eo:2er|2f4:2f5|2fr:2g1|2g3:2g4|2gb:2ge|2gh:2gi|2hq:2hr|2i3:2i6|2i9:2ia|2ie:2io|2iv:2j5|2jl:2k0|2lq:2lr|2me:2mf|2mh:2mv|2n1:2n5|2ng:2o0|2od:2oe|2oh:2oi|2pk:2pl|2pq:2pr|2q4:2q6|2q9:2qa|2qe:2ql|2qo:2qr|2r2:2r5|2rh:2s1|2sb:2sd|2sm:2so|2t0:2t2|2t5:2t7|2tb:2td|2tq:2tt|2u3:2u5|2ue:2um|2uo:2v6|2vj:300|31q:31t|32e:32k|32n:32v|332:335|33g:341|35q:35t|36e:36k|36n:36t|372:375|37g:381|39q:39t|3a4:3a5|3ae:3am|3ao:3av|3b2:3b5|3bg:3c1|3cn:3cp|3du:3dv|3e7:3e9|3eb:3ee|3f0:3fh|3fl:3g0|3hr:3hu|3is:3k0|3k5:3k6|3kb:3kc|3ke:3kj|3l8:3l9|3lu:3lv|3me:3mf|3mq:3mr|3mu:3nv|3rb:3rg|3sc:3sf|3ud:3ue|3ug:3vv|41j:41l|41q:41v|42q:44v|466:46f|47p:47q|47s:47v|4aq:4au|4d3:4d7|4fq:4fv|4ie:4if|4iu:4iv|4ke:4kf|4lm:4ln|4m6:4m7|4om:4on|4qr:4r0|4rt:4sv|4vl:500|5jn:5jv|5kt:5kv|5nh:5nv|5ol:5ov|5pn:5pv|5qk:5qv|5rk:5rv|5ut:5uv|5va:5vv|60q:60v|63o:63v|65a:7fv|7ks:7kv|7nq:7nv|7om:7on|7ou:7ov|7q6:7q7|7qe:7qf|7ru:7rv|7uk:7ul|7vg:7vh|82j:82m|82o:82u|834:839|83i:83j|84f:84v|85i:86f|87b:87v|89r:89s|8ac:8ai|8c4:8cf|8uf:8vv|917:91v|92b:92v|9gk:9gl|9ju:9jv|9ka:9o0|9oa:9ob|9qj:9ql|9qv:9r0|9sl:9sn|9tv:9uf|9vc:9vf|ao0:bjv|bnk:bnv|bum:bvf|bvs:bvv|c4n:c4o|c80:c84|c9d:c9g|cdo:cff|cgt:cgv|ci4:cig|cjs:cju|cmc:cmf|crn:crq|cuu:cuv|jdm:jfv|17t6:17vv|194d:194f|1967:1avv|1lt4:1lvv|1uhe:1uhf|1ujb:1unv|1uo7:1uoi|1uoo:1uos|1uti:1uui|1va0:1vaf|1vcg:1vch|1ve8:1vef|1vft:1vfv|1vgg:1vgv|1vh4:1vhf|1vi7:1vi8|1vjc:1vjf|1vnt:1vnu|1vtv:1vu1|1vu8:1vu9|1vug:1vuh|1vuo:1vup|1vut:1vuv|1vvf:1vvo|2000:20nv|20p4:20pf|20qb:20vv|2116:2117|212e:3jvv|3k7m:3k7v|3k97:3k99|3keu:3kvv|3l50:3l51|3l53:3l54|3l57:3l58|3l8b:3l8c|3la7:3la9|3ll4:3ll7|3lua:3lud|3m00:3vvt|59mn:5tvv|5ugu:5vvt|6000:7vvt|8000:9vvt|a000:bvvt|c000:dvvt|e000:fvvt|g000:hvvt|i000:jvvt|k000:lvvt|m000:nvvt|o000:pvvt|q000:rvvt|s002:s00v|s040:tvvt",s:"9p8|9qc|9qe|9qn|9tg|147|bkq|3l2l|3l4t|3l5d|3l5q|3l5s|3l61|3l64|3l86|3l8l|3l8t|3l9q|3l9v|3la5|3lah|16f|c20|ccf|cnv|cvv|1b0|1c8|1d2|1dq|1h0|1nv|1oe|284|2c4|2d9|2dh|2dt|2eu|2h9|2hh|2hk|2hn|2ht|2it|2k4|2kc|2ke|2ki|2l9|2lh|2lk|2m6|2ma|2o4|2p9|2ph|2qu|2s4|2sh|2sr|2st|2tm|2u9|304|30d|30h|319|31k|325|329|344|34d|34h|359|35k|365|369|36v|384|38d|38h|399|3a9|3c4|3di|3ds|3el|3en|3k3|3k9|3ko|3l0|3l4|3l6|3lc|3lq|3m5|3m7|3q8|3so|3tt|412|418|41b|4g7|4i7|4i9|4in|4ip|4k7|4k9|4lf|4lh|4lv|4m1|4mf|4mn|4nf|4of|4oh|4ov|4q7|h1|5od|5rd|5rh|60f|1upn|1upt|1upv|1uq2|1uq5|1vij|1vj7|1vjl|1vo0|1vv7|20ov|7qo|7qq|7qs|7qu|7tl|7u5|7us|7vl|7vv|sb|sd|s000|t2|97v|uf|9go|9o5"},"B.1":{r:"60b:60d|80b:80d|1vg0:1vgf",s:"5d|606|1vnv|830|qf"},"B.2":{m:"5l:ts|6v:3j;3j|9g:39;o7|a9:ls;3e|bv:3j|fg:3a;oc|q5:tp|rq:10;tp|sg:tp;o8;o1|tg:u5;o8;o1|u2:u3|ug:ti|uh:to|ui:u5|uj:ud|uk:ub|ul:u6|um:u0|vg:tq|vh:u1|vi:u3|vl:tl|1c7:1b5;1c2|7km:38;ph|7kn:3k;o8|7ko:3n;oa|7kp:3p;oa|7kq:31;lu|7kr:7j1|7qg:u5;oj|7qi:u5;oj;o0|7qk:u5;oj;o1|7qm:u5;oj;q2|7s0:7o0;tp|7s1:7o1;tp|7s2:7o2;tp|7s3:7o3;tp|7s4:7o4;tp|7s5:7o5;tp|7s6:7o6;tp|7s7:7o7;tp|7s8:7o0;tp|7s9:7o1;tp|7sa:7o2;tp|7sb:7o3;tp|7sc:7o4;tp|7sd:7o5;tp|7se:7o6;tp|7sf:7o7;tp|7sg:7p0;tp|7sh:7p1;tp|7si:7p2;tp|7sj:7p3;tp|7sk:7p4;tp|7sl:7p5;tp|7sm:7p6;tp|7sn:7p7;tp|7so:7p0;tp|7sp:7p1;tp|7sq:7p2;tp|7sr:7p3;tp|7ss:7p4;tp|7st:7p5;tp|7su:7p6;tp|7sv:7p7;tp|7t0:7r0;tp|7t1:7r1;tp|7t2:7r2;tp|7t3:7r3;tp|7t4:7r4;tp|7t5:7r5;tp|7t6:7r6;tp|7t7:7r7;tp|7t8:7r0;tp|7t9:7r1;tp|7ta:7r2;tp|7tb:7r3;tp|7tc:7r4;tp|7td:7r5;tp|7te:7r6;tp|7tf:7r7;tp|7ti:7rg;tp|7tj:th;tp|7tk:tc;tp|7tm:th;q2|7tn:th;q2;tp|7ts:th;tp|7tu:tp|7u2:7rk;tp|7u3:tn;tp|7u4:te;tp|7u6:tn;q2|7u7:tn;q2;tp|7uc:tn;tp|7ui:tp;o8;o0|7uj:tp;o8;o1|7um:tp;q2|7un:tp;o8;q2|7v2:u5;o8;o0|7v3:u5;o8;o1|7v4:u1;oj|7v6:u5;q2|7v7:u5;o8;q2|7vi:7rs;tp|7vj:u9;tp|7vk:ue;tp|7vm:u9;q2|7vn:u9;q2;tp|7vs:u9;tp|858:3i;3j|882:33|883:5g;33|887:ir|889:5g;36|88b:38|88c:38|88d:38|88g:39|88h:39|88i:3c|88l:3e|88m:3e;3f|88p:3g|88q:3h|88r:3i|88s:3i|88t:3i|890:3j;3d|891:3k;35;3c|892:3k;3d|894:3q|898:3q|89c:32|89d:33|89g:35|89h:36|89j:3d|89u:tj|89v:u0|8a5:34|crh:38;3g;31|crj:31;3l|crl:3f;3m|cs0:3g;31|cs1:3e;31|cs2:ts;31|cs3:3d;31|cs4:3b;31|cs5:3b;32|cs6:3d;32|cs7:37;32|csa:3g;36|csb:3e;36|csc:ts;36|csg:38;3q|csh:3b;38;3q|csi:3d;38;3q|csj:37;38;3q|csk:3k;38;3q|ct9:3g;31|cta:3b;3g;31|ctb:3d;3g;31|ctc:37;3g;31|ctk:3g;3m|ctl:3e;3m|ctm:ts;3m|ctn:3d;3m|cto:3b;3m|ctp:3d;3m|ctq:3g;3n|ctr:3e;3n|cts:ts;3n|ctt:3d;3n|ctu:3b;3n|ctv:3d;3n|cu0:3b;u9|cu1:3d;u9|cu3:32;3h|cu6:33;8gl;3b;37|cu7:33;3f;1e|cu8:34;32|cu9:37;3p|cub:38;3g|cud:3b;3b|cue:3b;3d|cun:3g;38|cup:3g;3g;3d|cuq:3g;3i|cus:3j;3m|cut:3n;32|1uo0:36;36|1uo1:36;39|1uo2:36;3c|1uo3:36;36;39|1uo4:36;36;3c|1uo5:3j;3k|1uo6:3j;3k|1uoj:1bk;1bm|1uok:1bk;1b5|1uol:1bk;1bb|1uom:1bu;1bm|1uon:1bk;1bd|3l00:31|3l01:32|3l02:33|3l03:34|3l04:35|3l05:36|3l06:37|3l07:38|3l08:39|3l09:3a|3l0a:3b|3l0b:3c|3l0c:3d|3l0d:3e|3l0e:3f|3l0f:3g|3l0g:3h|3l0h:3i|3l0i:3j|3l0j:3k|3l0k:3l|3l0l:3m|3l0m:3n|3l0n:3o|3l0o:3p|3l0p:3q|3l1k:31|3l1l:32|3l1m:33|3l1n:34|3l1o:35|3l1p:36|3l1q:37|3l1r:38|3l1s:39|3l1t:3a|3l1u:3b|3l1v:3c|3l20:3d|3l21:3e|3l22:3f|3l23:3g|3l24:3h|3l25:3i|3l26:3j|3l27:3k|3l28:3l|3l29:3m|3l2a:3n|3l2b:3o|3l2c:3p|3l2d:3q|3l38:31|3l39:32|3l3a:33|3l3b:34|3l3c:35|3l3d:36|3l3e:37|3l3f:38|3l3g:39|3l3h:3a|3l3i:3b|3l3j:3c|3l3k:3d|3l3l:3e|3l3m:3f|3l3n:3g|3l3o:3h|3l3p:3i|3l3q:3j|3l3r:3k|3l3s:3l|3l3t:3m|3l3u:3n|3l3v:3o|3l40:3p|3l41:3q|3l4s:31|3l4u:33|3l4v:34|3l52:37|3l55:3a|3l56:3b|3l59:3e|3l5a:3f|3l5b:3g|3l5c:3h|3l5e:3j|3l5f:3k|3l5g:3l|3l5h:3m|3l5i:3n|3l5j:3o|3l5k:3p|3l5l:3q|3l6g:31|3l6h:32|3l6i:33|3l6j:34|3l6k:35|3l6l:36|3l6m:37|3l6n:38|3l6o:39|3l6p:3a|3l6q:3b|3l6r:3c|3l6s:3d|3l6t:3e|3l6u:3f|3l6v:3g|3l70:3h|3l71:3i|3l72:3j|3l73:3k|3l74:3l|3l75:3m|3l76:3n|3l77:3o|3l78:3p|3l79:3q|3l84:31|3l85:32|3l87:34|3l88:35|3l89:36|3l8a:37|3l8d:3a|3l8e:3b|3l8f:3c|3l8g:3d|3l8h:3e|3l8i:3f|3l8j:3g|3l8k:3h|3l8m:3j|3l8n:3k|3l8o:3l|3l8p:3m|3l8q:3n|3l8r:3o|3l8s:3p|3l9o:31|3l9p:32|3l9r:34|3l9s:35|3l9t:36|3l9u:37|3la0:39|3la1:3a|3la2:3b|3la3:3c|3la4:3d|3la6:3f|3laa:3j|3lab:3k|3lac:3l|3lad:3m|3lae:3n|3laf:3o|3lag:3p|3lbc:31|3lbd:32|3lbe:33|3lbf:34|3lbg:35|3lbh:36|3lbi:37|3lbj:38|3lbk:39|3lbl:3a|3lbm:3b|3lbn:3c|3lbo:3d|3lbp:3e|3lbq:3f|3lbr:3g|3lbs:3h|3lbt:3i|3lbu:3j|3lbv:3k|3lc0:3l|3lc1:3m|3lc2:3n|3lc3:3o|3lc4:3p|3lc5:3q|3ld0:31|3ld1:32|3ld2:33|3ld3:34|3ld4:35|3ld5:36|3ld6:37|3ld7:38|3ld8:39|3ld9:3a|3lda:3b|3ldb:3c|3ldc:3d|3ldd:3e|3lde:3f|3ldf:3g|3ldg:3h|3ldh:3i|3ldi:3j|3ldj:3k|3ldk:3l|3ldl:3m|3ldm:3n|3ldn:3o|3ldo:3p|3ldp:3q|3lek:31|3lel:32|3lem:33|3len:34|3leo:35|3lep:36|3leq:37|3ler:38|3les:39|3let:3a|3leu:3b|3lev:3c|3lf0:3d|3lf1:3e|3lf2:3f|3lf3:3g|3lf4:3h|3lf5:3i|3lf6:3j|3lf7:3k|3lf8:3l|3lf9:3m|3lfa:3n|3lfb:3o|3lfc:3p|3lfd:3q|3lg8:31|3lg9:32|3lga:33|3lgb:34|3lgc:35|3lgd:36|3lge:37|3lgf:38|3lgg:39|3lgh:3a|3lgi:3b|3lgj:3c|3lgk:3d|3lgl:3e|3lgm:3f|3lgn:3g|3lgo:3h|3lgp:3i|3lgq:3j|3lgr:3k|3lgs:3l|3lgt:3m|3lgu:3n|3lgv:3o|3lh0:3p|3lh1:3q|3lhs:31|3lht:32|3lhu:33|3lhv:34|3li0:35|3li1:36|3li2:37|3li3:38|3li4:39|3li5:3a|3li6:3b|3li7:3c|3li8:3d|3li9:3e|3lia:3f|3lib:3g|3lic:3h|3lid:3i|3lie:3j|3lif:3k|3lig:3l|3lih:3m|3lii:3n|3lij:3o|3lik:3p|3lil:3q|3ljg:31|3ljh:32|3lji:33|3ljj:34|3ljk:35|3ljl:36|3ljm:37|3ljn:38|3ljo:39|3ljp:3a|3ljq:3b|3ljr:3c|3ljs:3d|3ljt:3e|3lju:3f|3ljv:3g|3lk0:3h|3lk1:3i|3lk2:3j|3lk3:3k|3lk4:3l|3lk5:3m|3lk6:3n|3lk7:3o|3lk8:3p|3lk9:3q|3ll8:th|3ll9:ti|3lla:tj|3llb:tk|3llc:tl|3lld:tm|3lle:tn|3llf:to|3llg:tp|3llh:tq|3lli:tr|3llj:ts|3llk:tt|3lll:tu|3llm:tv|3lln:u0|3llo:u1|3llp:to|3llq:u3|3llr:u4|3lls:u5|3llt:u6|3llu:u7|3llv:u8|3lm0:u9|3lmj:u3|3ln2:th|3ln3:ti|3ln4:tj|3ln5:tk|3ln6:tl|3ln7:tm|3ln8:tn|3ln9:to|3lna:tp|3lnb:tq|3lnc:tr|3lnd:ts|3lne:tt|3lnf:tu|3lng:tv|3lnh:u0|3lni:u1|3lnj:to|3lnk:u3|3lnl:u4|3lnm:u5|3lnn:u6|3lno:u7|3lnp:u8|3lnq:u9|3lod:u3|3los:th|3lot:ti|3lou:tj|3lov:tk|3lp0:tl|3lp1:tm|3lp2:tn|3lp3:to|3lp4:tp|3lp5:tq|3lp6:tr|3lp7:ts|3lp8:tt|3lp9:tu|3lpa:tv|3lpb:u0|3lpc:u1|3lpd:to|3lpe:u3|3lpf:u4|3lpg:u5|3lph:u6|3lpi:u7|3lpj:u8|3lpk:u9|3lq7:u3|3lqm:th|3lqn:ti|3lqo:tj|3lqp:tk|3lqq:tl|3lqr:tm|3lqs:tn|3lqt:to|3lqu:tp|3lqv:tq|3lr0:tr|3lr1:ts|3lr2:tt|3lr3:tu|3lr4:tv|3lr5:u0|3lr6:u1|3lr7:to|3lr8:u3|3lr9:u4|3lra:u5|3lrb:u6|3lrc:u7|3lrd:u8|3lre:u9|3ls1:u3|3lsg:th|3lsh:ti|3lsi:tj|3lsj:tk|3lsk:tl|3lsl:tm|3lsm:tn|3lsn:to|3lso:tp|3lsp:tq|3lsq:tr|3lsr:ts|3lss:tt|3lst:tu|3lsu:tv|3lsv:u0|3lt0:u1|3lt1:to|3lt2:u3|3lt3:u4|3lt4:u5|3lt5:u6|3lt6:u7|3lt7:u8|3lt8:u9|3ltr:u3",r:"23:2c|2i:2k|2m:2q|60:6m|6o:6u|bo:bp|c1:c2|c6:c7|c9:cb|ce:ch|cj:ck|cm:co|cs:ct|cv:d0|d6:d7|de:df|dh:dj|dn:do|e4:e5|e7:e8|ea:eb|fh:fi|fm:fo|s8:sa|se:sf|sh:t1|t3:tb|100:11f|19h:1am|7o8:7of|7oo:7ot|7p8:7pf|7po:7pv|7q8:7qd|7r8:7rf|7to:7tr|7u8:7ub|7uo:7ur|7v8:7vc|7vo:7vr|89a:89b|8b0:8bf|95m:96f|1vp1:1vpq|2100:2115",s:"v8|va|vc|ve|vk|130|132|134|136|138|13a|13c|13e|13g|13i|13k|13m|13o|13q|13s|13u|140|14a|14c|14e|14g|14i|14k|14m|14o|14q|14s|14u|150|152|154|156|158|15a|15c|15e|15g|15i|15k|15m|15o|15q|15s|15u|161|163|165|167|169|16b|16d|16g|16i|16k|16m|16o|16q|16s|16u|170|172|174|176|178|17a|17c|17e|17g|17i|17k|17o|180|182|184|186|188|18a|18c|18e|80|82|84|86|88|8a|8c|8e|8g|8i|8k|8m|8o|8q|8s|8u|90|92|94|96|98|9a|9c|9e|9i|9k|9m|9p|9r|9t|9v|a1|a3|a5|a7|aa|ac|ae|ag|ai|ak|am|ao|aq|as|au|b0|b2|b4|b6|b8|ba|bc|be|bg|bi|bk|bm|br|bt|c4|d2|d4|d9|dc|dl|ds|ed|ef|eh|ej|el|en|ep|er|eu|f0|f2|f4|f6|f8|fa|fc|fe|fk|fq|fs|fu|g0|g2|g4|g6|g8|ga|gc|ge|gg|gi|gk|gm|go|gq|gs|gu|h0|h2|h4|h6|h8|ha|hc|he|hg|hi|21|22|7g0|7g2|7g4|7g6|7g8|7ga|7gc|7ge|7gg|7gi|2d|7gk|7gm|7go|7gq|7gs|7gu|7h0|7h2|7h4|7h6|7h8|7ha|7hc|7he|7hg|7hi|7hk|7hm|7ho|7hq|7hs|7hu|7i0|7i2|7i4|7i6|7i8|7ia|7ic|7ie|7ig|7ii|7ik|7im|7io|7iq|7is|7iu|7j0|7j2|7j4|7j6|7j8|7ja|7jc|7je|7jg|7ji|7jk|7jm|2e|7jo|7jq|7js|7ju|7k0|7k2|7k4|7k6|7k8|7ka|7kc|7ke|7kg|7ki|7kk|7l0|7l2|7l4|7l6|7l8|7la|7lc|7le|7lg|7li|7lk|7lm|7lo|7lq|7ls|7lu|7m0|7m2|7m4|7m6|7m8|7ma|7mc|7me|7mg|7mi|7mk|7mm|7mo|7mq|2f|7ms|7mu|7n0|7n2|7n4|7n6|7n8|7na|7nc|7ne|7ng|7ni|7nk|7nm|7no|2g|7qp|7qr|7qt|7qv|2h|896|2l|s6|sc|uo|uq|us|uu|v0|v2|v4|v6"},"B.3":{m:"5l:ts|6v:3j;3j|9g:39;o7|a9:ls;3e|bv:3j|fg:3a;oc|q5:tp|sg:tp;o8;o1|tg:u5;o8;o1|u2:u3|ug:ti|uh:to|ul:u6|um:u0|vg:tq|vh:u1|vi:u3|vl:tl|1c7:1b5;1c2|7km:38;ph|7kn:3k;o8|7ko:3n;oa|7kp:3p;oa|7kq:31;lu|7kr:7j1|7qg:u5;oj|7qi:u5;oj;o0|7qk:u5;oj;o1|7qm:u5;oj;q2|7s0:7o0;tp|7s1:7o1;tp|7s2:7o2;tp|7s3:7o3;tp|7s4:7o4;tp|7s5:7o5;tp|7s6:7o6;tp|7s7:7o7;tp|7s8:7o0;tp|7s9:7o1;tp|7sa:7o2;tp|7sb:7o3;tp|7sc:7o4;tp|7sd:7o5;tp|7se:7o6;tp|7sf:7o7;tp|7sg:7p0;tp|7sh:7p1;tp|7si:7p2;tp|7sj:7p3;tp|7sk:7p4;tp|7sl:7p5;tp|7sm:7p6;tp|7sn:7p7;tp|7so:7p0;tp|7sp:7p1;tp|7sq:7p2;tp|7sr:7p3;tp|7ss:7p4;tp|7st:7p5;tp|7su:7p6;tp|7sv:7p7;tp|7t0:7r0;tp|7t1:7r1;tp|7t2:7r2;tp|7t3:7r3;tp|7t4:7r4;tp|7t5:7r5;tp|7t6:7r6;tp|7t7:7r7;tp|7t8:7r0;tp|7t9:7r1;tp|7ta:7r2;tp|7tb:7r3;tp|7tc:7r4;tp|7td:7r5;tp|7te:7r6;tp|7tf:7r7;tp|7ti:7rg;tp|7tj:th;tp|7tk:tc;tp|7tm:th;q2|7tn:th;q2;tp|7ts:th;tp|7tu:tp|7u2:7rk;tp|7u3:tn;tp|7u4:te;tp|7u6:tn;q2|7u7:tn;q2;tp|7uc:tn;tp|7ui:tp;o8;o0|7uj:tp;o8;o1|7um:tp;q2|7un:tp;o8;q2|7v2:u5;o8;o0|7v3:u5;o8;o1|7v4:u1;oj|7v6:u5;q2|7v7:u5;o8;q2|7vi:7rs;tp|7vj:u9;tp|7vk:ue;tp|7vm:u9;q2|7vn:u9;q2;tp|7vs:u9;tp|1uo0:36;36|1uo1:36;39|1uo2:36;3c|1uo3:36;36;39|1uo4:36;36;3c|1uo5:3j;3k|1uo6:3j;3k|1uoj:1bk;1bm|1uok:1bk;1b5|1uol:1bk;1bb|1uom:1bu;1bm|1uon:1bk;1bd",r:"23:2c|2i:2k|2m:2q|60:6m|6o:6u|bo:bp|c1:c2|c6:c7|c9:cb|ce:ch|cj:ck|cm:co|cs:ct|cv:d0|d6:d7|de:df|dh:dj|dn:do|e4:e5|e7:e8|ea:eb|fh:fi|fm:fo|s8:sa|se:sf|sh:t1|t3:tb|100:11f|19h:1am|7o8:7of|7oo:7ot|7p8:7pf|7po:7pv|7q8:7qd|7r8:7rf|7to:7tr|7u8:7ub|7uo:7ur|7v8:7vc|7vo:7vr|89a:89b|8b0:8bf|95m:96f|1vp1:1vpq|2100:2115",s:"v8|va|vc|ve|vk|130|132|134|136|138|13a|13c|13e|13g|13i|13k|13m|13o|13q|13s|13u|140|14a|14c|14e|14g|14i|14k|14m|14o|14q|14s|14u|150|152|154|156|158|15a|15c|15e|15g|15i|15k|15m|15o|15q|15s|15u|161|163|165|167|169|16b|16d|16g|16i|16k|16m|16o|16q|16s|16u|170|172|174|176|178|17a|17c|17e|17g|17i|17k|17o|180|182|184|186|188|18a|18c|18e|80|82|84|86|88|8a|8c|8e|8g|8i|8k|8m|8o|8q|8s|8u|90|92|94|96|98|9a|9c|9e|9i|9k|9m|9p|9r|9t|9v|a1|a3|a5|a7|aa|ac|ae|ag|ai|ak|am|ao|aq|as|au|b0|b2|b4|b6|b8|ba|bc|be|bg|bi|bk|bm|br|bt|c4|d2|d4|d9|dc|dl|ds|ed|ef|eh|ej|el|en|ep|er|eu|f0|f2|f4|f6|f8|fa|fc|fe|fk|fq|fs|fu|g0|g2|g4|g6|g8|ga|gc|ge|gg|gi|gk|gm|go|gq|gs|gu|h0|h2|h4|h6|h8|ha|hc|he|hg|hi|21|22|7g0|7g2|7g4|7g6|7g8|7ga|7gc|7ge|7gg|7gi|2d|7gk|7gm|7go|7gq|7gs|7gu|7h0|7h2|7h4|7h6|7h8|7ha|7hc|7he|7hg|7hi|7hk|7hm|7ho|7hq|7hs|7hu|7i0|7i2|7i4|7i6|7i8|7ia|7ic|7ie|7ig|7ii|7ik|7im|7io|7iq|7is|7iu|7j0|7j2|7j4|7j6|7j8|7ja|7jc|7je|7jg|7ji|7jk|7jm|2e|7jo|7jq|7js|7ju|7k0|7k2|7k4|7k6|7k8|7ka|7kc|7ke|7kg|7ki|7kk|7l0|7l2|7l4|7l6|7l8|7la|7lc|7le|7lg|7li|7lk|7lm|7lo|7lq|7ls|7lu|7m0|7m2|7m4|7m6|7m8|7ma|7mc|7me|7mg|7mi|7mk|7mm|7mo|7mq|2f|7ms|7mu|7n0|7n2|7n4|7n6|7n8|7na|7nc|7ne|7ng|7ni|7nk|7nm|7no|2g|7qp|7qr|7qt|7qv|2h|896|2l|s6|sc|uo|uq|us|uu|v0|v2|v4|v6"},"C.1.1":{s:"10"},"C.1.2":{r:"800:80b",s:"c00|50|5k0|81f|82v"},"C.2.1":{r:"0:v",s:"3v"},"C.2.2":{r:"40:4v|80c:80d|818:819|830:833|83a:83f|1vvp:1vvs|3kbj:3kbq",s:"1mt|1of|60e|1vnv"},"C.3":{r:"1o00:1u7v|u000:vvvt|10000:11vvt"},"C.4":{r:"1veg:1vff|1vvu:1vvv|3vvu:3vvv|5vvu:5vvv|7vvu:7vvv|9vvu:9vvv|bvvu:bvvv|dvvu:dvvv|fvvu:fvvv|hvvu:hvvv|jvvu:jvvv|lvvu:lvvv|nvvu:nvvv|pvvu:pvvv|rvvu:rvvv|tvvu:tvvv|vvvu:vvvv|11vvu:11vvv"},"C.5":{r:"1m00:1nvv"},"C.6":{r:"1vvp:1vvt"},"C.7":{r:"bvg:bvr"},"C.8":{r:"q0:q1|80e:80f|81a:81e|83a:83f"},"C.9":{r:"s010:s03v",s:"s001"},"D.1":{r:"1eg:1fa|1fg:1fk|1h1:1hq|1i0:1ia|1jd:1jf|1jh:1ml|1n5:1n6|1nq:1nu|1o0:1od|1oi:1pc|1s0:1t5|1uov:1up8|1upa:1upm|1upo:1ups|1uq0:1uq1|1uq3:1uq4|1uq6:1uth|1uuj:1v9t|1vag:1vcf|1vci:1ve7|1vfg:1vfs|1vjg:1vjk|1vjm:1vns",s:"1du|1e0|1e3|1gr|1gv|1mt|1og|1th|1uot|1upu|80f"},"D.2":{r:"21:2q|31:3q|60:6m|6o:7m|7o:h0|h2:hj|ig:ld|lg:lo|lr:m1|mg:mh|n0:n4|s8:sa|se:t1|t3:ue|ug:vl|100:142|14a:16e|16g:17l|17o:17p|180:18f|19h:1am|1ap:1av|1b1:1c7|285:29p|29t:2a0|2a9:2ac|2ao:2b1|2b4:2bg|2c2:2c3|2c5:2cc|2cf:2cg|2cj:2d8|2da:2dg|2dm:2dp|2du:2e0|2e7:2e8|2eb:2ec|2es:2et|2ev:2f1|2f6:2fh|2fk:2fq|2g5:2ga|2gf:2gg|2gj:2h8|2ha:2hg|2hi:2hj|2hl:2hm|2ho:2hp|2hu:2i0|2ip:2is|2j6:2jf|2ji:2jk|2k5:2kb|2kf:2kh|2kj:2l8|2la:2lg|2li:2lj|2ll:2lp|2lt:2m0|2mb:2mc|2n6:2nf|2o2:2o3|2o5:2oc|2of:2og|2oj:2p8|2pa:2pg|2pi:2pj|2pm:2pp|2pt:2pu|2q7:2q8|2qb:2qc|2qs:2qt|2qv:2r1|2r6:2rg|2s5:2sa|2se:2sg|2si:2sl|2sp:2sq|2su:2sv|2t3:2t4|2t8:2ta|2te:2tl|2tn:2tp|2tu:2tv|2u1:2u2|2u6:2u8|2ua:2uc|2v7:2vi|301:303|305:30c|30e:30g|30i:318|31a:31j|31l:31p|321:324|330:331|336:33f|342:343|345:34c|34e:34g|34i:358|35a:35j|35l:35p|360:364|367:368|36a:36b|36l:36m|370:371|376:37f|382:383|385:38c|38e:38g|38i:398|39a:39p|39u:3a0|3a6:3a8|3aa:3ac|3b0:3b1|3b6:3bf|3c2:3c3|3c5:3cm|3cq:3dh|3dj:3dr|3e0:3e6|3ef:3eh|3eo:3ev|3fi:3fk|3g1:3hg|3hi:3hj|3i0:3i6|3if:3ir|3k1:3k2|3k7:3k8|3kk:3kn|3kp:3kv|3l1:3l3|3la:3lb|3ld:3lg|3li:3lj|3m0:3m4|3mg:3mp|3ms:3mt|3o0:3on|3oq:3pk|3pu:3q7|3q9:3ra|3s8:3sb|3tu:3u5|3u7:3uc|400:411|413:417|419:41a|420:42n|450:465|46g:47o|480:4ap|4av:4d2|4d8:4fp|4g0:4g6|4g8:4i6|4ia:4id|4ig:4im|4iq:4it|4j0:4k6|4ka:4kd|4kg:4le|4li:4ll|4lo:4lu|4m2:4m5|4m8:4me|4mg:4mm|4mo:4ne|4ng:4oe|4oi:4ol|4oo:4ou|4p0:4q6|4q8:4qq|4r1:4rs|4t0:4vk|501:5jm|5k1:5kq|5l0:5ng|5o0:5oc|5oe:5oh|5p0:5ph|5pl:5pm|5q0:5qh|5r0:5rc|5re:5rg|5s0:5tm|5tu:5u5|5u7:5u8|5uk:5uq|5v0:5v9|60g:60p|610:63n|640:658|7g0:7kr|7l0:7np|7o0:7ol|7oo:7ot|7p0:7q5|7q8:7qd|7qg:7qn|7qv:7rt|7s0:7tk|7tm:7ts|7u2:7u4|7u6:7uc|7ug:7uj|7um:7ur|7v0:7vc|7vi:7vk|7vm:7vs|88a:88j|88p:88t|89a:89d|89f:89h|89j:89p|89t:89v|8a5:8a9|8b0:8c3|8pm:8rq|94s:979|c05:c07|c11:c19|c1h:c1l|c1o:c1s|c21:c4m|c4t:c4v|c51:c7q|c7s:c7v|c85:c9c|c9h:cce|ccg:cdn|cfg:cgs|ch0:ci3|cj0:cjr|cjv:clg|cm0:cmb|cmg:cnu|co0:crm|crr:cut|cv0:cvu|d00:jdl|jg0:17t5|1800:194c|1b00:1lt3|1m00:1uhd|1uhg:1uja|1uo0:1uo6|1uoj:1uon|1vp1:1vpq|1vq1:1vqq|1vr6:1vtu|1vu2:1vu7|1vua:1vuf|1vui:1vun|1vuq:1vus|20o0:20ou|20p0:20p3|20pg:20qa|2100:2115|2118:212d|3k00:3k7l|3k80:3k96|3k9a:3kb6|3kba:3kbi|3kc3:3kc4|3kcc:3kd9|3kde:3ket|3l00:3l2k|3l2m:3l4s|3l4u:3l4v|3l55:3l56|3l59:3l5c|3l5e:3l5p|3l5t:3l60|3l62:3l63|3l65:3l85|3l87:3l8a|3l8d:3l8k|3l8m:3l8s|3l8u:3l9p|3l9r:3l9u|3la0:3la4|3laa:3lag|3lai:3ll3|3ll8:3lu9|4000:59mm|5u00:5ugt|u000:vvvt|10000:11vvt",s:"3l52|3l5r|3la6|1c9|5a|5l|5q|283|2ag|2di|2en|2iu|2k3|2kd|2m9|2mg|2n0|2q0|2qn|2s3|2ss|2un|35u|36u|3an|3dt|3k4|3ka|3kd|3l5|3l7|3lt|3m6|3pm|3po|3rv|3s5|3uf|41c|41h|41o|47r|4i8|4io|4k8|4lg|4m0|4og|5us|ne|7qp|7qr|7qt|7tu|80e|83h|83v|882|887|88l|894|896|898|rq|s6|sc|8sl"}};class m{constructor(e,t){this.singles=new Set,this.ranges=[],this.mappings=new Map;const n=f[e];this.name=e,n?(n.s&&(this.singles=new Set(n.s.split("|").map(e=>parseInt(e,32)))),n.r&&(this.ranges=n.r.split("|").map(e=>{const[t,n]=e.split(":");return[parseInt(t,32),parseInt(n,32)]})),n.m&&(this.mappings=new Map(n.m.split("|").map(e=>{const[t,n]=e.split(":"),i=n.split(";").map(e=>parseInt(e,32));return[parseInt(t,32),i]})))):t&&(this.singles=new Set(t))}contains(e){if(this.singles.has(e))return!0;let t=0,n=this.ranges.length-1;for(;t<=n;){const i=Math.floor((t+n)/2),r=this.ranges[i];if(e<r[0])n=i-1;else{if(!(e>r[1]))return!0;t=i+1}}return!1}hasMapping(e){return this.mappings.has(e)||this.contains(e)}map(e){return this.contains(e)&&!this.mappings.has(e)?String.fromCodePoint(e).toLowerCase().codePointAt(0):this.mappings.get(e)||null}}const g=new m("A.1"),v=new m("B.1"),b=new m("B.2");new m("B.3");const y=new m("C.1.1"),_=new m("C.1.2"),S=new m("C.2.1"),w=new m("C.2.2"),T=new m("C.3"),I=new m("C.4"),x=new m("C.5"),j=new m("C.6"),k=new m("C.7"),E=new m("C.8"),C=new m("C.9"),N=new m("D.1"),O=new m("D.2");function R(e,t,n=""){const i=c.a.ucs2.decode(n);let r=[];for(const n of i){if(!t&&e.unassigned.contains(n))throw new Error("Unassigned code point: x"+n.toString(16));let i=!1;for(const t of e.mappings){if(!t.hasMapping(n))continue;i=!0;const e=t.map(n);e&&(Array.isArray(e)?r=r.concat(e):r.push(e))}i||r.push(n)}let s=r;if(e.normalize){const e=c.a.ucs2.encode(r).normalize("NFKC");s=c.a.ucs2.decode(e)}let o=!1,a=!1;for(const n of s){for(const t of e.prohibited)if(t.contains(n))throw new Error("Prohibited code point: x"+n.toString(16));if(!t&&e.unassigned.contains(n))throw new Error("Prohibited code point: x"+n.toString(16));e.bidirectional&&(o=o||N.contains(n),a=a||O.contains(n))}if(e.bidirectional){if(o&&a)throw new Error("String contained both LCat and RandALCat code points");if(o&&(!N.contains(s[0])||!N.contains(s[s.length-1])))throw new Error("String containing RandALCat code points must start and end with RandALCat code points")}return c.a.ucs2.encode(s)}v.map=()=>null,y.contains=e=>32===e,_.map=e=>_.contains(e)?32:null;const A={bidirectional:!0,mappings:[v,b],normalize:!0,prohibited:[_,w,T,I,x,j,k,E,C],unassigned:g};const P=new m("NodePrepProhibited",[34,38,39,47,58,60,62,64]),L={bidirectional:!0,mappings:[v,b],normalize:!0,prohibited:[y,_,S,w,T,I,x,j,k,E,C,P],unassigned:g};const q={bidirectional:!0,mappings:[v],normalize:!0,prohibited:[_,S,w,T,I,x,j,k,E,C],unassigned:g};const F={bidirectional:!0,mappings:[_,v],normalize:!0,prohibited:[_,S,w,T,I,x,j,k,E,C],unassigned:g};function M(e,t=!1){return R(F,t,e)}function D(e=""){return e.replace(/^\s+|\s+$/g,"").replace(/\\5c/g,"\\5c5c").replace(/\\20/g,"\\5c20").replace(/\\22/g,"\\5c22").replace(/\\26/g,"\\5c26").replace(/\\27/g,"\\5c27").replace(/\\2f/g,"\\5c2f").replace(/\\3a/g,"\\5c3a").replace(/\\3c/g,"\\5c3c").replace(/\\3e/g,"\\5c3e").replace(/\\40/g,"\\5c40").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")}function B(e){return e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")}function U(e){let t=e.local||"",n=e.domain,i=e.resource||"";return t&&(t=function(e,t=!0){return R(L,t,e)}(t)),i&&(i=function(e,t=!0){return R(q,t,e)}(i)),"."===n[n.length-1]&&(n=n.slice(0,n.length-1)),n=function(e,t=!0){return R(A,t,e)}(n.split(".").map(c.a.toUnicode).join(".")),{domain:n,local:t,resource:i}}function z(e,t={}){let n=e.local;t.escaped||(n=D(e.local));const i=t.prepared?e:U({local:n,domain:e.domain,resource:e.resource}),r=n?`${n}@${i.domain}`:i.domain;return i.resource?`${r}/${i.resource}`:r}function J(e,t){return t?`${K(e)}/${t}`:K(e)}function G(e=""){let t="",n="",i="";const r=e.indexOf("/");r>0&&(i=e.slice(r+1),e=e.slice(0,r));const s=e.indexOf("@");s>0&&(t=e.slice(0,s),e=e.slice(s+1)),n=e;const o=U({domain:n,local:t,resource:i});return{bare:z({local:o.local,domain:o.domain},{escaped:!0,prepared:!0}),domain:o.domain,full:z(o,{escaped:!0,prepared:!0}),local:B(o.local),resource:o.resource}}function V(e,t){const n=new Set;if(n.add(void 0),n.add(""),e){const t=G(e);n.add(t.full),n.add(t.bare),n.add(t.domain)}if(t){const e=G(t);n.add(e.domain),n.add(e.bare),n.add(e.full)}return n}function H(e,t){if(!e||!t)return!1;const n=G(e),i=G(t);return n.local===i.local&&n.domain===i.domain}function $(e){return!!G(e).resource}function W(e=""){return G(e).domain}function Q(e=""){return G(e).resource}function K(e=""){return G(e).bare}var X,Y=Object.freeze({__proto__:null,escapeLocal:D,unescapeLocal:B,prepare:U,create:z,createFull:J,parse:G,allowedResponders:V,equal:function(e,t){if(!e||!t)return!1;const n=G(e),i=G(t);return n.local===i.local&&n.domain===i.domain&&n.resource===i.resource},equalBare:H,isFull:$,isBare:function(e){return!$(e)},getLocal:function(e=""){return G(e).local},getDomain:W,getResource:Q,toBare:K,parseURI:function(e){const t=new URL(e);if("xmpp:"!==t.protocol)throw new Error("Invalid XMPP URI, wrong protocol: "+t.protocol);const n=t.hostname?t.username?z({domain:decodeURIComponent(t.hostname),local:decodeURIComponent(t.username)},{escaped:!0}):decodeURIComponent(t.hostname):void 0,i=G(decodeURIComponent(n?t.pathname.substr(1):t.pathname)).full,r=t.search&&t.search.indexOf(";")>=1,s=r?t.search.substr(t.search.indexOf(";")+1):"",o=t.search?decodeURIComponent(t.search.substr(1,r?t.search.indexOf(";")-1:void 0)):void 0,a={};for(const e of s.split(";")){const[t,n]=e.split("=").map(decodeURIComponent);if(a[t]){const e=a[t];Array.isArray(e)?e.push(n):a[t]=[e,n]}else a[t]=n}return{action:o,identity:n,jid:i,parameters:a}},toURI:function(e){const t=["xmpp:"],n=(e,n)=>{const i=G(e);i.local&&(t.push(encodeURIComponent(D(i.local))),t.push("@")),t.push(encodeURIComponent(i.domain)),n&&i.resource&&(t.push("/"),t.push(encodeURIComponent(i.resource)))};e.identity&&(t.push("//"),n(e.identity,!1),e.jid&&t.push("/")),e.jid&&n(e.jid,!0),e.action&&(t.push("?"),t.push(encodeURIComponent(e.action)));for(const[n,i]of Object.entries(e.parameters||{}))for(const e of Array.isArray(i)?i:[i])t.push(";"),t.push(encodeURIComponent(n)),void 0!==e&&(t.push("="),t.push(encodeURIComponent(e)));return t.join("")}});!function(e){e.NotWellFormed="not-well-formed",e.RestrictedXML="restricted-xml",e.AlreadyClosed="already-closed",e.UnknownRoot="unknown-stream-root"}(X||(X={}));class Z extends Error{constructor(e){super(e.text),this.isJXTError=!0,this.condition=e.condition,this.text=e.text}static notWellFormed(e){return new Z({condition:X.NotWellFormed,text:e})}static restrictedXML(e){return new Z({condition:X.RestrictedXML,text:e})}static alreadyClosed(e){return new Z({condition:X.AlreadyClosed,text:e})}static unknownRoot(e){return new Z({condition:X.UnknownRoot,text:e})}}const ee={'"':""","&":"&","'":"'","<":"<",">":">"},te={"&":"&","'":"'",">":">","<":"<",""":'"'},ne=/&([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);/g,ie=/&|<|>|"|'/g,re=/&|<|>/g;function se(e){return ee[e]}function oe(e){return e.replace(ie,se)}function ae(e){return e.replace(ne,e=>function(e){if(te[e])return te[e];const t=e.startsWith("&#x"),n=parseInt(e.substring(t?3:2,e.length-1),t?16:10);if(9===n||10===n||13===n||32<=n&&n<=55295||57344<=n&&n<=65533||65536<=n&&n<=1114111)return String.fromCodePoint(n);throw Z.restrictedXML("Prohibited entity: "+e)}(e))}function ce(e){return e.replace(re,se)}function le(e,t=[],n=""){const i=new Set(e.map(e=>e.toLowerCase()));for(let e of t.map(e=>e.toLowerCase()))if("*"!==e)for(;e.length>0;){if(i.has(e))return e;e=e.substring(0,e.lastIndexOf("-")).toLowerCase(),e.lastIndexOf("-")===e.length-2&&(e=e.substring(0,e.lastIndexOf("-")))}return n}class ue{constructor(e,t={},n=[]){this.name=e,this.attributes=t,this.children=[],this.optionalNamespaces={};for(const e of n)if("string"!=typeof e){const t=new ue(e.name,e.attributes,e.children);t.parent=this,this.children.push(t)}else this.children.push(e)}getName(){return this.name.indexOf(":")>=0?this.name.substr(this.name.indexOf(":")+1):this.name}getNamespace(){if(this.name.indexOf(":")>=0){const e=this.name.substr(0,this.name.indexOf(":"));return this.findNamespaceForPrefix(e)}return this.findNamespaceForPrefix()}getNamespaceContext(){let e={};this.parent&&(e=this.parent.getNamespaceContext());for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")){const i=t.substr(6);e[n]=i}return e}getDefaultNamespace(){return this.attributes.xmlns?this.attributes.xmlns:this.parent?this.parent.getDefaultNamespace():""}getNamespaceRoot(e){if(this.parent){const t=this.parent.getNamespaceRoot(e);if(t)return t}for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")&&n===e)return this;if(this.optionalNamespaces[e])return this}getAttribute(e,t){if(!t)return this.attributes[e];const n=this.getNamespaceContext();return n[t]?this.attributes[[n[t],e].join(":")]:void 0}getChild(e,t){return this.getChildren(e,t)[0]}getChildren(e,t){const n=[];for(const i of this.children)"string"==typeof i||i.getName()!==e||t&&i.getNamespace()!==t||n.push(i);return n}getText(){let e="";for(const t of this.children)"string"==typeof t&&(e+=t);return e}appendChild(e){return this.children.push(e),"string"!=typeof e&&(e.parent=this),e}setAttribute(e,t,n=!1){this.attributes[e]=t||void 0,""===t&&n&&(this.attributes[e]=t)}addOptionalNamespace(e,t){this.optionalNamespaces[t]=e}useNamespace(e,t){return this.optionalNamespaces[t]&&(e=this.optionalNamespaces[t]),this.setAttribute("xmlns:"+e,t),e}toJSON(){const e=this.children.map(e=>"string"==typeof e?e:e?e.toJSON():void 0).filter(e=>!!e),t={};for(const[e,n]of Object.entries(this.attributes))null!=n&&(t[e]=n);return{attributes:t,children:e,name:this.name}}toString(){let e=this.openTag(!0);if(this.children.length){for(const t of this.children)"string"==typeof t?e+=ce(t):t&&(e+=t.toString());e+=this.closeTag()}return e}openTag(e=!1){let t="";t+="<"+this.name;for(const[e,n]of Object.entries(this.attributes))void 0!==n&&(t+=` ${e}="${oe(n.toString())}"`);return e&&0===this.children.length?t+="/>":t+=">",t}closeTag(){return`</${this.name}>`}findNamespaceForPrefix(e){if(e){const t="xmlns:"+e;if(this.attributes[t])return this.attributes[t];if(this.parent)return this.parent.findNamespaceForPrefix(e)}else{if(this.attributes.xmlns)return this.attributes.xmlns;if(this.parent)return this.parent.findNamespaceForPrefix()}return""}}const de=new Set(["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul"]),pe=new Set(["style"]),he=new Map([["a",new Set(["href","style"])],["body",new Set(["style","xml:lang"])],["blockquote",pe],["br",pe],["cite",pe],["em",pe],["img",new Set(["alt","height","src","style","width"])],["li",pe],["ol",pe],["p",pe],["span",pe],["strong",pe],["ul",pe]]),fe=new Map([["font-style",/normal|italic|oblique|inherit/i],["font-weight",/normal|bold|bolder|lighter|inherit|\d\d\d/i],["text-decoration",/none|underline|overline|line-through|blink|inherit/i]]),me=e=>!!e.match(/^(https?|xmpp|cid|mailto|ftps?|im|ircs?|sips?|tel|geo|bitcoin|magnet):/i)&&e,ge=e=>!!e.match(/^[0-9]*$/)&&e,ve={alt:e=>e,height:ge,href:me,src:me,style:e=>{const t=(";"+e).replace(/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,"").replace(/\/\*.*/,"").replace(/\\([a-fA-F0-9]{1,6})\s?/,(e,t)=>String.fromCharCode(parseInt(t,16))).match(/;\s*([a-z-]+)\s*:\s*([^;]*[^\s;])\s*/g),n=[];if(!t)return!1;for(const e of t){const t=e.match(/^;\s*([a-z-]+)\s*:\s*([^;]*[^\s])\s*$/);if(!t)continue;const i=fe.get(t[1]);if(i){const e=t[2].match(i);e&&n.push(`${t[1]}:${e[0]}`)}}return!!n.length&&n.join("")},width:ge};function be(e){if("string"==typeof e)return e;if(!de.has(e.name)){if("script"===e.name)return;return function(e){let t=[];for(const n of e.children)if("string"==typeof n)t.push(n);else{const e=be(n);e&&(Array.isArray(e)?t=t.concat(e):t.push(e))}return t}(e)}const t=e.children.map(be).filter(e=>void 0!==e),n={};for(const[t,i]of Object.entries(e.attributes)){const r=he.get(e.name);if(!r||!r.has(t))continue;if(!i)continue;const s=ve[t](i);s&&(n[t]=s)}return{attributes:n,children:t,name:e.name}}function ye(e){if("string"==typeof e)return;let t=[];for(const n of e.children){if(!n)continue;if("string"==typeof n){t.push(n);continue}const e=be(n);Array.isArray(e)?t=t.concat(e):e&&t.push(e)}const n={};return"body"===e.name?(void 0!==e.attributes.xmlns&&(n.xmlns=e.attributes.xmlns),e.attributes.style&&(n.style=e.attributes.style),void 0!==e.attributes["xml:lang"]&&(n["xml:lang"]=e.attributes["xml:lang"]),{attributes:n,children:t,name:"body"}):void 0}function _e(e){return 97<=e&&e<=122||65<=e&&e<=90||58===e||95===e}function Se(e){return 192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=767||880<=e&&e<=893||895<=e&&e<=8191||8204<=e&&e<=8205||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||65008<=e&&e<=65533||65536<=e&&e<=983039}function we(e){return _e(e)||Se(e)}function Te(e){return _e(e)||45===e||46===e||48<=e&&e<=57||183===e||768<=e&&e<=879||8255<=e&&e<=8256||Se(e)}function Ie(e){return 32===e||10===e||13===e||9===e}class xe extends o.EventEmitter{constructor(e={}){super(),this.allowComments=!0,this.attributes={},this.state=34,this.tagName="",this.haveDeclaration=!1,this.recordBuffer=[],void 0!==e.allowComments&&(this.allowComments=e.allowComments)}write(e){for(const t of e){const e=t.codePointAt(0);switch(this.state){case 34:if(60===e){let e;try{e=ae(this.endRecord())}catch(e){return void this.emit("error",e)}e&&this.emit("text",e),this.transition(31);continue}this.record(t);continue;case 31:if(47===e){this.transition(7);continue}if(33===e){this.transition(24);continue}if(63===e){this.haveDeclaration&&this.restrictedXML(),this.transition(25);continue}if(we(e)){this.transition(30),this.startRecord(t);continue}return this.notWellFormed();case 30:if(Te(e)){this.record(t);continue}if(Ie(e)){this.startTag(),this.transition(32);continue}if(47===e){this.startTag(),this.transition(29);continue}if(62===e){this.startTag(),this.transition(34),this.emit("startElement",this.tagName,this.attributes);continue}return this.notWellFormed();case 29:if(62===e){this.emit("startElement",this.tagName,this.attributes),this.emit("endElement",this.tagName),this.transition(34);continue}return this.notWellFormed();case 33:if(Ie(e)){this.transition(32);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 32:if(Ie(e))continue;if(we(e)){this.startRecord(t),this.transition(0);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 7:if(we(e)){this.startRecord(t),this.transition(6);continue}return this.notWellFormed();case 6:if(Te(e)){this.record(t);continue}if(Ie(e)){this.transition(8);continue}if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 8:if(Ie(e))continue;if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 0:if(Te(e)){this.record(t);continue}if(61===e){this.addAttribute(),this.transition(4);continue}if(Ie(e)){this.addAttribute(),this.transition(3);continue}return this.notWellFormed();case 3:if(61===e){this.transition(4);continue}if(Ie(e))continue;return this.notWellFormed();case 4:if(34===e){this.startRecord(),this.transition(1);continue}if(39===e){this.startRecord(),this.transition(2);continue}if(Ie(e))continue;return this.notWellFormed();case 1:case 2:if(34===e&&1===this.state||39===e&&2===this.state){const e=this.endRecord();this.attributes[this.attributeName]=ae(e),this.transition(33);continue}if(60===e)return this.notWellFormed();this.record(t);continue;case 24:if(45===e){this.allowComments||this.restrictedXML(),this.transition(23);continue}if(91===e){this.transition(21);continue}return this.notWellFormed();case 23:if(45===e){this.transition(14);continue}return this.notWellFormed();case 14:45===e&&this.transition(12);continue;case 12:45===e?this.transition(11):this.transition(14);continue;case 11:62===e?this.transition(34):this.transition(14);continue;case 25:if(88===e||120===e){this.transition(28);continue}return this.notWellFormed();case 28:if(77===e||109===e){this.transition(27);continue}return this.notWellFormed();case 27:if(76===e||108===e){this.transition(26);continue}return this.notWellFormed();case 26:if(Ie(e)){this.haveDeclaration=!0,this.transition(15);continue}return this.notWellFormed();case 13:if(62===e){this.transition(34);continue}return this.notWellFormed();case 15:63===e&&this.transition(13);continue;case 21:this.wait(e,67,20);continue;case 20:this.wait(e,68,19);continue;case 19:this.wait(e,65,18);continue;case 18:this.wait(e,84,17);continue;case 17:this.wait(e,65,16);continue;case 16:this.wait(e,91,5);continue;case 5:if(93===e){this.transition(10);continue}this.record(t);continue;case 10:93===e?this.transition(9):(this.record(String.fromCodePoint(93)),this.record(t),this.transition(5));continue;case 9:if(62===e){const e=this.endRecord();e&&this.emit("text",e),this.transition(34)}else this.record(String.fromCodePoint(93)),this.record(String.fromCodePoint(93)),this.record(t),this.transition(5);continue}}}end(e){e&&this.write(e),this.write=()=>{}}record(e){this.recordBuffer.push(e)}startRecord(e){this.recordBuffer=[],e&&this.recordBuffer.push(e)}endRecord(){const e=this.recordBuffer;return this.recordBuffer=[],e.join("")}startTag(){this.tagName=this.endRecord(),this.attributes={}}addAttribute(){const e=this.endRecord();if(void 0!==this.attributes[e])return this.notWellFormed();this.attributeName=e,this.attributes[e]=""}wait(e,t,n){if(e!==t)return this.notWellFormed();this.transition(n)}transition(e){this.state=e,34===e&&this.startRecord()}notWellFormed(e){this.emit("error",Z.notWellFormed(e))}restrictedXML(e){this.emit("error",Z.restrictedXML(e))}}function je(e,t={}){const n=new xe(t);let i,r,s=null;if(n.on("text",e=>{r&&r.children.push(e)}),n.on("startElement",(e,t)=>{const n=new ue(e,t);i||(i=n),r=r?r.appendChild(n):n}),n.on("endElement",e=>{r?e===r.name?r.parent&&(r=r.parent):n.emit("error",Z.notWellFormed("b")):n.emit("error",Z.notWellFormed("a"))}),n.on("error",e=>{s=e}),n.write(e),n.end(),s)throw s;return i}function ke(e,t,n,i){if(i){e=e||i.getNamespace();const n=i.getNamespaceRoot(e);if(n){t=`${n.useNamespace("",e)}:${t}`}}const r=new ue(t);return t.indexOf(":")<0&&(!n||e!==n)&&r.setAttribute("xmlns",e),r}function Ee(e,t){return(e.getAttribute("xml:lang")||t||"").toLowerCase()}function Ce(e,t){const n=[];for(const i of e)n.push(Ee(i,t.lang));let i;return i=t.resolveLanguage?t.resolveLanguage(n,t.acceptLanguages||[],t.lang):t.lang,i||""}function Ne(e,t,n,i){const r=e.getChildren(n,t),s=Ee(e);return r.length?i?r.filter(e=>{if(Ee(e,s)===i)return!0}):r:[]}function Oe(e,t,n,i){t=t||e.getNamespace();const r=Ne(e,t,n,i);if(r.length)return r[0];const s=ke(t,n,e.getDefaultNamespace(),e),o=Ee(e,i);return i&&o!==i&&s.setAttribute("xml:lang",i),e.appendChild(s),s}function Re(e){return{importer(t){const n=t.getAttribute(e.name,e.namespace);return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);if(i||e.emitEmpty)if(e.namespace&&e.prefix){let n;const r=t.getNamespaceRoot(e.namespace);if(r)n=r.useNamespace(e.prefix,e.namespace);else{const i=t.getNamespaceContext();i[e.namespace]||(n=t.useNamespace(e.prefix,e.namespace),i[e.namespace]=n)}t.setAttribute(`${n}:${e.name}`,i,e.emitEmpty)}else t.setAttribute(e.name,i,e.emitEmpty)}}}function Ae(e,t){return(n,i,r={})=>(r=Object.assign({staticDefault:i},r),Re(Object.assign(Object.assign({name:n},e),t?t(r):r)))}function Pe(e,t){return(n,i,r,s,o={})=>(o=Object.assign({staticDefault:s},o),Re(Object.assign(Object.assign({name:r,namespace:i,prefix:n},e),t?t(o):o)))}function Le(e){const t=e.converter||Re(Object.assign(Object.assign({},e),{namespace:e.attributeNamespace}));return{importer(n,i){const r=n.getChild(e.element,e.namespace||n.getNamespace());return r?t.importer(r,i):e.dynamicDefault?e.dynamicDefault():e.staticDefault},exporter(n,i,r){if(void 0!==i&&i!==e.staticDefault){const s=Oe(n,e.namespace||n.getNamespace(),e.element);t.exporter(s,i,r)}}}}function qe(e,t){return(n,i,r,s,o={})=>(o=Object.assign({staticDefault:s},o),Le(Object.assign(Object.assign({element:i,name:r,namespace:n},e),t?t(o):o)))}function Fe(e){return{importer(t){const n=t.getText();return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(!n&&e.emitEmpty)return void t.children.push("");if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);i&&t.children.push(i)}}}function Me(e){const t=Fe(e);return{importer(n,i){const r=Ne(n,e.namespace||n.getNamespace(),e.element),s=Ce(r,i);if(!r.length)return e.dynamicDefault?e.dynamicDefault():e.staticDefault;if(e.matchLanguage)for(const e of r)if(Ee(e,i.lang)===s)return t.importer(e,i);return t.importer(r[0],i)},exporter(n,i,r){if(i||!e.emitEmpty){if(void 0!==i&&i!==e.staticDefault){const s=Oe(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0);t.exporter(s,i,r)}}else Oe(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0)}}}const De={parseValue:e=>e,writeValue:e=>e},Be={parseValue:e=>parseInt(e,10),writeValue:e=>e.toString()},Ue={parseValue:e=>parseFloat(e),writeValue:e=>e.toString()},ze={parseValue:e=>"true"===e||"1"===e||"false"!==e&&"0"!==e&&void 0,writeValue:e=>e?"1":"0"},Je={parseValue:e=>new Date(e),writeValue:e=>"string"==typeof e?e:e.toISOString()},Ge={parseValue:e=>JSON.parse(e),writeValue:e=>JSON.stringify(e)},Ve=(t="utf8")=>({parseValue:n=>("base64"===t&&"="===n&&(n=""),e.from(n.trim(),t)),writeValue:n=>{let i;return i="string"==typeof n?e.from(n).toString(t):n?n.toString(t):"","base64"===t&&(i=i||"="),i}}),He={parseValue:e=>{let t=-1;"-"===e.charAt(0)&&(t=1,e=e.slice(1));const n=e.split(":");return(60*parseInt(n[0],10)+parseInt(n[1],10))*t},writeValue:e=>{if("string"==typeof e)return e;{let t="-";e<0&&(e=-e,t="+");const n=e/60,i=e%60;return t+=(n<10?"0":"")+n+":"+(i<10?"0":"")+i,t}}},$e=Ae(De,e=>Object.assign({dynamicDefault:e.emitEmpty?t=>""===t?"":e.staticDefault:void 0},e)),We=Ae(ze),Qe=Ae(Be),Ke=Ae(Ue),Xe=Ae(Je),Ye=Pe(De),Ze=Pe(ze),et=Pe(Be),tt=Pe(Ue),nt=Pe(Je),it=qe(De),rt=qe(ze),st=qe(Be),ot=qe(Ue),at=qe(Je),ct=e=>Fe(Object.assign({staticDefault:e},De)),lt=()=>Fe(Object.assign({},Ge)),ut=(e="utf8")=>Fe(Object.assign({},Ve(e)));function dt(){return{importer:(e,t)=>Ee(e,t.lang),exporter(e,t,n){t&&t.toLowerCase()!==n.lang?e.setAttribute("xml:lang",t):e.setAttribute("xml:lang",void 0)}}}const pt=(e,t,n,i=!1)=>Me(Object.assign({element:t,emitEmpty:i,matchLanguage:!0,namespace:e,staticDefault:n},De)),ht=(e,t,n="utf8")=>Me(Object.assign({element:t,matchLanguage:!0,namespace:e},Ve(n))),ft=(e,t)=>Me(Object.assign({element:t,namespace:e},Je)),mt=(e,t,n)=>Me(Object.assign({element:t,namespace:e,staticDefault:n},Be)),gt=(e,t,n)=>Me(Object.assign({element:t,namespace:e,staticDefault:n},Ue)),vt=(e,t)=>Me(Object.assign({element:t,namespace:e},Ge));function bt(e,t){return Me(Object.assign({element:t,namespace:e,staticDefault:0},He))}function yt(e,t){return{importer(n){if(n.getChild(t,e||n.getNamespace()))return!0},exporter(n,i){i&&Oe(n,e||n.getNamespace(),t)}}}const _t=(e,t,n)=>{if(!n)return;let i=t;for(const t of e)i=Oe(i,t.namespace||i.getNamespace(),t.element);i.children.push(n.toString())};function St(e,t){return{importer(n){let i=n;for(const n of e)if(i=i.getChild(n.element,n.namespace||i.getNamespace()),!i)return t;return i.getText()||t},exporter(t,n){_t(e,t,n)}}}function wt(e,t){return{importer(n){let i=n;for(const t of e)if(i=i.getChild(t.element,t.namespace||i.getNamespace()),!i)return;const r=i.getText();return r?parseInt(r,10):t||void 0},exporter(t,n){_t(e,t,n)}}}function Tt(e){return{importer(t){let n=t;for(const t of e)if(n=n.getChild(t.element,t.namespace||n.getNamespace()),!n)return!1;return!0},exporter(t,n){if(!n)return;let i=t;for(const t of e)i=Oe(i,t.namespace||i.getNamespace(),t.element)}}}function It(e){const t=e.pop();return{importer(n,i){let r=n;for(const t of e)if(r=r.getChild(t.element,t.namespace||r.getNamespace()),!r)return[];const s=[],o=Ne(r,t.namespace||r.getNamespace(),t.element),a=Ce(o,i);for(const e of o)Ee(e,i.lang)===a&&s.push(e.getText());return s},exporter(n,i,r){if(!i.length)return;let s=n;for(const t of e)s=Oe(s,t.namespace||s.getNamespace(),t.element);const{namespace:o,element:a}=t;for(const e of i){const t=ke(o||s.getNamespace(),a,r.namespace,s);t.children.push(e),s.appendChild(t)}}}}function xt(e,t,n){const i=new Map,r=new Map;for(const e of t)"string"==typeof e?(i.set(e,e),r.set(e,e)):(i.set(e[1],e[0]),r.set(e[0],e[1]));return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&i.has(n.getName()))return i.get(n.getName());return n},exporter(t,n){r.has(n)&&Oe(t,e,r.get(n))}}}function jt(e,t,n,i){const r=new Set(t),s=new Set(n);return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&r.has(n.getName())){for(const i of n.children)if("string"!=typeof i&&i.getNamespace()===(e||t.getNamespace())&&s.has(i.getName()))return[n.getName(),i.getName()];return[n.getName()]}return i},exporter(t,n){const i=Oe(t,e,n[0]);n[1]&&Oe(i,e,n[1])}}}function kt(e,t){return{importer(n,i){const r=[],s=Ne(n,e||n.getNamespace(),t),o=Ce(s,i);for(const e of s)Ee(e,i.lang)===o&&r.push(e.getText());return r},exporter(n,i,r){for(const s of i){const i=ke(e||n.getNamespace(),t,r.namespace,n);i.children.push(s),n.appendChild(i)}}}}function Et(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(t)}return r},exporter(i,r,s){for(const o of r){const r=ke(e||i.getNamespace(),t,s.namespace,i);r.setAttribute(n,o),i.appendChild(r)}}}}function Ct(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(parseInt(t,10))}return r},exporter(i,r,s){for(const o of r){const r=ke(e||i.getNamespace(),t,s.namespace,i);r.setAttribute(n,o.toString()),i.appendChild(r)}}}}function Nt(e,t){return{importer(n,i){const r=[],s=Ne(n,e||n.getNamespace(),t),o=new Set;for(const e of s){const t=e.getText();if(t){const n=Ee(e,i.lang);if(o.has(n))continue;r.push({lang:n,value:t}),o.add(n)}}return o.size>0?r:void 0},exporter(n,i,r){for(const s of i){const i=s.value;if(i){const o=ke(e||n.getNamespace(),t,r.namespace,n);s.lang!==r.lang&&o.setAttribute("xml:lang",s.lang),o.children.push(i),n.appendChild(o)}}}}}function Ot(e,t){const n=new Map,i=new Map;for(const e of t)"string"==typeof e?(n.set(e,e),i.set(e,e)):(n.set(e[1],e[0]),i.set(e[0],e[1]));return{importer(t){const i=[];for(const r of t.children)"string"!=typeof r&&r.getNamespace()===(e||t.getNamespace())&&n.has(r.getName())&&i.push(n.get(r.getName()));return i},exporter(t,n){for(const r of n)Oe(t,e,i.get(r))}}}function Rt(e,t,n,i=!1){return{importer(r,s){const o=r.getChild(t,e||r.getNamespace());if(!o)return;const a=[];for(const e of o.children)if("string"!=typeof e&&s.registry.getImportKey(e)===n){const t=s.registry.import(e);t&&a.push(t)}return i?a:a[0]},exporter(i,r,s){let o=[];o=Array.isArray(r)?r:[r];const a=[];for(const t of o){const r=s.registry.export(n,t,Object.assign(Object.assign({},s),{namespace:e||i.getNamespace()||void 0}));r&&a.push(r)}if(a.length){const n=Oe(i,e||i.getNamespace(),t);for(const e of a)n.appendChild(e)}}}}function At(e){return{exporter:()=>{},importer:()=>e}}function Pt(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=Ne(i,e||i.getNamespace(),t),o=Ce(s,r);for(const e of s)if(Ee(e,r.lang)===o)return n?r.sanitizers[n](e.toJSON()):e.toJSON();return s[0]?n?r.sanitizers[n](s[0].toJSON()):s[0].toJSON():void 0},exporter(i,r,s){if("string"==typeof r){r=je(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(r&&n){if(!s.sanitizers||!s.sanitizers[n])return;r=s.sanitizers[n](r)}if(!r)return;const o=Oe(i,e||i.getNamespace(),t,s.lang);for(const e of r.children)"string"==typeof e?o.appendChild(e):e&&o.appendChild(new ue(e.name,e.attributes,e.children))}}}function Lt(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=[],o=new Set,a=Ne(i,e||i.getNamespace(),t);for(const e of a){let t=e.toJSON();if(n&&(t=r.sanitizers[n](t)),t){const n=Ee(e,r.lang);if(o.has(n))continue;s.push({lang:n,value:t}),o.add(n)}}return o.size>0?s:void 0},exporter(i,r,s){for(const o of r){let r=o.value;if("string"==typeof r){r=je(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(r&&n){if(!s.sanitizers||!s.sanitizers[n])continue;r=s.sanitizers[n](r)}if(r){const n=ke(e||i.getNamespace(),t,s.namespace,i);i.appendChild(n),o.lang!==s.lang&&n.setAttribute("xml:lang",o.lang);for(const e of r.children)"string"==typeof e?n.appendChild(e):n.appendChild(new ue(e.name,e.attributes,e.children))}}}}}function qt(e,t,n,i){return{importer(r,s){const o={},a=Ne(r,e,t),c=$e(n).importer,l=$e(i).importer;for(const e of a)o[c(e,s)]=l(e,s);return o},exporter(r,s,o){const a=$e(n).exporter,c=$e(i).exporter,l=e||r.getNamespace();for(const[e,n]of Object.entries(s)){const i=ke(l,t,o.namespace,r);a(i,e,o),s[e]&&c(i,n,o),r.appendChild(i)}}}}class Ft{constructor(){this.parents=new Set,this.placeholder=!1,this.typeField="",this.versionField="",this.defaultType="",this.defaultVersion="",this.languageField="lang",this.typeValues=new Map,this.typeOrders=new Map,this.importers=new Map,this.exporters=new Map,this.children=new Map,this.childrenIndex=new Map,this.implicitChildren=new Set,this.contexts=new Map}addChild(e,t,n=!1,i,r){const s={multiple:n||!1,name:e,selector:i,translator:t},o=this.children.get(e);if(!o){s.translator.parents.add(this),this.children.set(e,s);for(const[n]of t.importers)this.implicitChildren.has(n)||this.childrenIndex.set(n,e);return void(r&&this.implicitChildren.add(r))}const a=o.translator;o.multiple=n,i&&o.selector&&i!==o.selector&&(o.selector=void 0);for(const[n,i]of t.importers){const[r,s]=(a.typeValues.get(n)||"").split("__v__");a.updateDefinition({contexts:t.contexts,element:i.element,exporterOrdering:new Map,exporters:new Map,importerOrdering:i.fieldOrders,importers:i.fields,namespace:i.namespace,optionalNamespaces:new Map,type:r,version:s}),this.implicitChildren.has(n)||this.childrenIndex.set(n,e)}for(const[e,n]of t.exporters){const[i,r]=e.split("__v__");a.updateDefinition({contexts:t.contexts,element:n.element,exporterOrdering:n.fieldOrders,exporters:n.fields,importerOrdering:new Map,importers:new Map,namespace:n.namespace,optionalNamespaces:n.optionalNamespaces,type:i,version:r})}}addContext(e,t,n,i,r,s){t&&(e=`${e}[${t}]`);let o=this.contexts.get(e);o||(o={typeField:"",versionField:"",typeValues:new Map}),s&&(o.impliedType=r),o.typeField=n||"",o.typeValues.set(i,r),this.contexts.set(e,o)}getChild(e){const t=this.children.get(e);if(t)return t.translator}getImportKey(e){return this.childrenIndex.get(`{${e.getNamespace()}}${e.getName()}`)}updateDefinition(e){const t=`{${e.namespace}}${e.element}`,n=e.type||this.defaultType,i=e.version||this.defaultVersion,r=i?`${n}__v__${i}`:n,s=this.importers.get(t)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace};for(const[t,n]of e.importers)s.fields.set(t,n);for(const[t,n]of e.importerOrdering)s.fieldOrders.set(t,n);this.importers.set(t,s);const o=this.exporters.get(r)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace,optionalNamespaces:e.optionalNamespaces};for(const[t,n]of e.exporters)o.fields.set(t,n);for(const[t,n]of e.exporterOrdering)o.fieldOrders.set(t,n);for(const[t,n]of e.optionalNamespaces)o.optionalNamespaces.set(t,n);this.exporters.set(r,o);for(const[t,n]of e.contexts){const e=this.contexts.get(t)||{impliedType:void 0,typeField:n.typeField,versionField:n.versionField,typeValues:new Map};e.typeField||(e.typeField=n.typeField),e.versionField||(e.versionField=n.versionField),e.impliedType||(e.impliedType=n.impliedType);for(const[t,i]of n.typeValues)e.typeValues.set(t,i);this.contexts.set(t,e)}if(e.type)this.typeValues.set(t,r),e.typeOrder&&e.type&&this.typeOrders.set(e.type,e.typeOrder);else if(this.typeField&&!e.type){for(const[,t]of this.importers){for(const[n,i]of e.importers)t.fields.set(n,i);for(const[n,i]of e.importerOrdering)t.fieldOrders.set(n,i)}for(const[,t]of this.exporters){for(const[n,i]of e.exporters)t.fields.set(n,i);for(const[n,i]of e.exporterOrdering)t.fieldOrders.set(n,i)}}}replaceWith(e){for(const[t,n]of this.children)e.children.set(t,n);for(const[t,n]of this.childrenIndex)e.childrenIndex.set(t,n);for(const[t,n]of this.contexts)e.contexts.set(t,n);for(const t of this.implicitChildren)e.implicitChildren.add(t);for(const t of this.parents)for(const n of t.children.values())n.translator===this&&(n.translator=e);this.parents=new Set}import(e,t){const n=`{${e.getNamespace()}}${e.getName()}`,i={},r=this.importers.get(n);if(!r)return;const s=this.typeValues.get(n)||"",[o,a]=s.split("__v__"),c=t.path||"";let l;if(t.pathSelector&&(l=this.contexts.get(`${c}[${t.pathSelector}]`)),l||(l=this.contexts.get(c)),l){if(!l.impliedType){const e=l.typeValues.get(n)||"";e&&(i[l.typeField]=e)}}else this.typeField&&o&&o!==this.defaultType&&(i[this.typeField]=o);this.versionField&&a&&a!==this.defaultVersion&&(i[this.versionField]=a);const u=Object.assign(Object.assign({},t),{data:i,importer:r,lang:(e.getAttribute("xml:lang")||t.lang||"").toLowerCase(),pathSelector:o,translator:this}),d=[...r.fieldOrders.entries()].sort((e,t)=>e[1]>t[1]?-1:e[1]<t[1]?1:0),p=d.filter(e=>e[1]>=0),h=d.filter(e=>e[1]<0);for(const[n]of p){const s=r.fields.get(n);u.path=`${t.path}.${n}`;const o=s(e,u);null!=o&&(i[n]=o)}for(const n of e.children){if("string"==typeof n)continue;const e=`{${n.getNamespace()}}${n.getName()}`,r=this.childrenIndex.get(e);if(!r)continue;u.path=`${t.path}.${r}`;const{translator:s,multiple:a,selector:c}=this.children.get(r);if(!c||c===o){const e=s.import(n,u);void 0!==e&&(a?(i[r]||(i[r]=[]),i[r].push(e)):i[r]?i[r]=s.resolveCollision(i[r],e):i[r]=e)}}for(const[n]of h){const s=r.fields.get(n);u.path=`${t.path}.${n}`;const o=s(e,u);null!=o&&(i[n]=o)}return i}export(e,t){if(!e)return;let n=this.defaultType,i=this.defaultVersion;const r=t.path||"";let s;t.pathSelector&&(s=this.contexts.get(`${r}[${t.pathSelector}]`)),s||(s=this.contexts.get(r)),s?n=s.impliedType||e[s.typeField]||this.defaultType:this.typeField&&(n=e[this.typeField]||this.defaultType),this.versionField&&(i=e[this.versionField]||this.defaultVersion);const o=i?`${n}__v__${i}`:n,a=this.exporters.get(o);if(!a)return;const c=ke(a.namespace,a.element,t.namespace,t.element);t.element&&(c.parent=t.element);for(const[e,t]of a.optionalNamespaces)c.addOptionalNamespace(e,t);const l=Object.assign(Object.assign({},t),{data:e,element:c,exporter:a,lang:(e[this.languageField]||t.lang||"").toLowerCase(),namespace:c.getDefaultNamespace(),pathSelector:n,translator:this}),u=a.fields.get(this.languageField);u&&u(c,e[this.languageField],t);const d=Object.keys(e);d.sort((e,t)=>(a.fieldOrders.get(e)||1e5)-(a.fieldOrders.get(t)||1e5));for(const i of d){if(i===this.languageField)continue;const r=e[i],s=a.fields.get(i);if(s){s(c,r,l);continue}const o=this.children.get(i);if(!o)continue;l.path=`${t.path?t.path+".":""}${i}`;const{translator:u,multiple:d,selector:p}=o;if(!p||p===n){let e;e=d?null!=r?r:[]:[r];for(const t of e){const e=u.export(t,l);e&&c.appendChild(e)}}}return c}resolveCollision(e,t){return(this.typeOrders.get(e[this.typeField]||this.defaultType)||0)<=(this.typeOrders.get(t[this.typeField]||this.defaultType)||0)?e:t}}class Mt{constructor(){this.translators=new Map,this.root=new Ft,this.setLanguageResolver(le)}setLanguageResolver(e){this.languageResolver=e}import(e,t={registry:this}){if(!this.hasTranslator(e.getNamespace(),e.getName()))return;t.acceptLanguages||(t.acceptLanguages=[]),t.acceptLanguages=t.acceptLanguages.map(e=>e.toLowerCase()),t.lang&&(t.lang=t.lang.toLowerCase()),t.resolveLanguage||(t.resolveLanguage=this.languageResolver),t.path=this.getImportKey(e),t.sanitizers||(t.sanitizers={xhtmlim:ye});return this.getOrCreateTranslator(e.getNamespace(),e.getName()).import(e,Object.assign(Object.assign({},t),{registry:this}))}export(e,t,n={registry:this}){n.acceptLanguages||(n.acceptLanguages=[]),n.acceptLanguages=n.acceptLanguages.map(e=>e.toLowerCase()),n.lang&&(n.lang=n.lang.toLowerCase()),n.sanitizers||(n.sanitizers={xhtmlim:ye}),n.path=e;const i=e.split(".").filter(e=>""!==e);let r=this.root;for(const e of i){const t=r.getChild(e);if(!t)return;r=t}return r.export(t,Object.assign(Object.assign({},n),{registry:this}))}getImportKey(e,t=""){const n=t?this.walkToTranslator(t.split(".")):this.root;if(n)return n.getImportKey(e)}define(e){if(Array.isArray(e)){for(const t of e)"object"==typeof t?this.define(t):t(this);return}if("object"!=typeof e)return void e(this);const t=e;t.aliases=t.aliases||[],t.path&&!t.aliases.includes(t.path)&&t.aliases.push(t.path);const n=t.aliases.map(e=>"string"==typeof e?{path:e}:e).sort((e,t)=>{const n=e.path.split(".").length;return t.path.split(".").length-n});let i;if(this.hasTranslator(t.namespace,t.element)&&(i=this.getOrCreateTranslator(t.namespace,t.element)),!i){let e;for(const t of n){const n=this.walkToTranslator(t.path.split("."));if(n&&!n.placeholder){i=n;break}n&&(e=n)}e&&!i&&(i=e,i.placeholder=!1)}i||(i=this.getOrCreateTranslator(t.namespace,t.element)),this.indexTranslator(t.namespace,t.element,i);const r=t.fields||{},s=new Map,o=new Map,a=new Map,c=new Map;t.typeField&&(i.typeField=t.typeField),t.defaultType&&(i.defaultType=t.defaultType),t.versionField&&(i.versionField=t.versionField),t.defaultVersion&&(i.defaultVersion=t.defaultVersion),t.languageField&&(i.languageField=t.languageField);for(const[e,t]of Object.entries(r))s.set(e,t.importer),a.set(e,t.importOrder||t.order||0),o.set(e,t.exporter),c.set(e,t.exportOrder||t.order||0);if(t.childrenExportOrder)for(const[e,n]of Object.entries(t.childrenExportOrder))c.set(e,n||0);const l=new Map;for(const[e,n]of Object.entries(t.optionalNamespaces||{}))l.set(e,n);i.updateDefinition({contexts:new Map,element:t.element,exporterOrdering:c,exporters:o,importerOrdering:a,importers:s,namespace:t.namespace,optionalNamespaces:l,type:t.type,version:t.version,typeOrder:t.typeOrder});for(const e of n)this.alias(t.namespace,t.element,e.path,e.multiple,e.selector,e.contextField,t.type,e.impliedType);for(const e of n){const t=this.walkToTranslator(e.path.split("."));t&&t!==i&&t.replaceWith(i)}}alias(e,t,n,i=!1,r,s,o,a=!1){const c=this.getOrCreateTranslator(e,t);c.placeholder=!1;const l=n.split(".").filter(e=>""!==e),u=l.pop(),d=this.walkToTranslator(l,!0),p=`{${e}}${t}`;o&&(s||a)&&c.addContext(n,r,s,p,o,a),d.addChild(u,c,i,r,p)}walkToTranslator(e,t=!1){let n=this.root;for(const i of e){let e=n.getChild(i);if(!e){if(!t)return;e=new Ft,e.placeholder=!0,n.addChild(i,e)}n=e}return n}hasTranslator(e,t){return this.translators.has(`{${e}}${t}`)}getOrCreateTranslator(e,t){let n=this.translators.get(`{${e}}${t}`);return n||(n=new Ft,this.indexTranslator(e,t,n)),n}indexTranslator(e,t,n){this.translators.set(`{${e}}${t}`,n)}}const Dt="http://www.w3.org/2005/Atom",Bt="urn:ietf:params:xml:ns:xmpp-bind",Ut="jabber:client",zt="urn:ietf:params:xml:ns:xmpp-sasl",Jt="urn:ietf:params:xml:ns:xmpp-session",Gt="urn:ietf:params:xml:ns:xmpp-stanzas",Vt="http://etherx.jabber.org/streams",Ht="urn:ietf:params:xml:ns:xmpp-streams",$t="urn:ietf:params:xml:ns:xmpp-tls",Wt="urn:ietf:params:xml:ns:xmpp-framing",Qt="jabber:x:data",Kt="jabber:iq:privacy",Xt="http://jabber.org/protocol/disco#info",Yt="http://jabber.org/protocol/disco#items",Zt="http://jabber.org/protocol/address",en="http://jabber.org/protocol/muc",tn="http://jabber.org/protocol/muc#admin",nn="http://jabber.org/protocol/muc#owner",rn="http://jabber.org/protocol/muc#user",sn="http://jabber.org/protocol/ibb",on="http://jabber.org/protocol/commands",an="http://jabber.org/protocol/rsm",cn="http://jabber.org/protocol/pubsub",ln="http://jabber.org/protocol/pubsub#errors",un="http://jabber.org/protocol/pubsub#event",dn="http://jabber.org/protocol/pubsub#owner",pn="http://jabber.org/protocol/bytestreams",hn="jabber:x:oob",fn="http://www.w3.org/1999/xhtml",mn="http://jabber.org/protocol/xhtml-im",gn="http://jabber.org/protocol/geoloc",vn="urn:xmpp:avatar:data",bn="urn:xmpp:avatar:metadata",yn="http://jabber.org/protocol/chatstates",_n="http://jabber.org/protocol/mood",Sn="http://jabber.org/protocol/activity",wn="http://jabber.org/protocol/tune",Tn="http://jabber.org/protocol/xdata-validate",In="http://jabber.org/protocol/httpbind",xn="http://jabber.org/protocol/shim",jn="http://jabber.org/protocol/compress",kn="http://jabber.org/protocol/xdata-layout",En="http://jabber.org/protocol/rosterx",Cn=e=>e+"+notify",Nn="urn:xmpp:jingle:1",On="urn:xmpp:jingle:apps:rtp:1",Rn="urn:xmpp:jingle:apps:rtp:info:1",An="http://jabber.org/protocol/nick",Pn="urn:xmpp:jingle:transports:ice-udp:1",Ln="urn:xmpp:jingle:transports:raw-udp:1",qn="urn:xmpp:sm:3",Fn="urn:xmpp:delay",Mn="urn:xmpp:bob",Dn="urn:xmpp:jingle:apps:file-transfer:5",Bn="urn:xmpp:jingle:apps:xmlstream:0",Un="urn:xmpp:jingle:transports:s5b:1",zn="urn:xmpp:jingle:transports:ibb:1",Jn="urn:xmpp:carbons:2",Gn="urn:xmpp:jingle:apps:rtp:rtcp-fb:0",Vn="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",Hn="urn:xmpp:forward:0",$n="urn:xmpp:hashes:2",Wn=e=>"urn:xmpp:hash-function-text-names:"+e,Qn="urn:xmpp:rtt:0",Kn="urn:xmpp:hats:0",Xn="urn:xmpp:chat-markers:0",Yn="urn:xmpp:hints",Zn="urn:xmpp:json:0",ei="urn:xmpp:push:0",ti="urn:xmpp:http:upload:0",ni="urn:xmpp:jingle:transports:ice:0",ii="eu.siacs.conversations.axolotl",ri="http://docs.oasis-open.org/ns/xri/xrd-1.0";var si=Object.freeze({__proto__:null,NS_ATOM:Dt,NS_BIND:Bt,NS_CLIENT:Ut,NS_SASL:zt,NS_SERVER:"jabber:server",NS_SESSION:Jt,NS_STANZAS:Gt,NS_STREAM:Vt,NS_STREAMS:Ht,NS_STARTTLS:$t,NS_ROSTER:"jabber:iq:roster",NS_ROSTER_VERSIONING:"urn:xmpp:features:rosterver",NS_SUBSCRIPTION_PREAPPROVAL:"urn:xmpp:features:pre-approval",NS_FRAMING:Wt,NS_DATAFORM:Qt,NS_RPC:"jabber:iq:rpc",NS_LAST_ACTIVITY:"jabber:iq:last",NS_PRIVACY:Kt,NS_LEGACY_CHAT_EVENTS:"jabber:x:event",NS_DISCO_INFO:Xt,NS_DISCO_ITEMS:Yt,NS_ADDRESS:Zt,NS_MUC:en,NS_MUC_ADMIN:tn,NS_MUC_OWNER:nn,NS_MUC_USER:rn,NS_IBB:sn,NS_BOOKMARKS:"storage:bookmarks",NS_PRIVATE:"jabber:iq:private",NS_ADHOC_COMMANDS:on,NS_VCARD_TEMP:"vcard-temp",NS_SEARCH:"jabber:iq:search",NS_RSM:an,NS_PUBSUB:cn,NS_PUBSUB_ERRORS:ln,NS_PUBSUB_EVENT:un,NS_PUBSUB_OWNER:dn,NS_SOCKS5:pn,NS_OOB:hn,NS_OOB_TRANSFER:"jabber:iq:oob",NS_HTTP_AUTH:"http://jabber.org/protocol/http-auth",NS_XHTML:fn,NS_XHTML_IM:mn,NS_REGISTER:"jabber:iq:register",NS_INBAND_REGISTRATION:"http://jabber.org/features/iq-register",NS_AMP:"http://jabber.org/protocol/amp",NS_GEOLOC:gn,NS_ROSTER_DELIMITER:"roster:delimiter",NS_AVATAR_DATA:vn,NS_AVATAR_METADATA:bn,NS_CHAT_STATES:yn,NS_VERSION:"jabber:iq:version",NS_MOOD:_n,NS_ACTIVITY:Sn,NS_COMPONENT:"jabber:component:accept",NS_DISCO_LEGACY_CAPS:"http://jabber.org/protocol/caps",NS_TUNE:wn,NS_DATAFORM_VALIDATION:Tn,NS_BOSH:In,NS_SHIM:xn,NS_COMPRESSION_FEATURE:"http://jabber.org/features/compress",NS_COMPRESSION:jn,NS_DATAFORM_LAYOUT:kn,NS_ROSTER_EXCHANGE:En,NS_ROSTER_NOTES:"storage:rosternotes",NS_REACH_0:"urn:xmpp:reach:0",NS_VCARD_TEMP_UPDATE:"vcard-temp:x:update",NS_ALT_CONNECTIONS_WEBSOCKET:"urn:xmpp:alt-connections:websocket",NS_ALT_CONNECTIONS_XBOSH:"urn:xmpp:alt-connections:xbosh",NS_CAPTCHA:"urn:xmpp:captcha",NS_PEP_NOTIFY:Cn,NS_JINGLE_1:Nn,NS_JINGLE_ERRORS_1:"urn:xmpp:jingle:errors:1",NS_JINGLE_RTP_1:On,NS_JINGLE_RTP_ERRORS_1:"urn:xmpp:jingle:apps:rtp:errors:1",NS_JINGLE_RTP_INFO_1:Rn,NS_JINGLE_RTP_AUDIO:"urn:xmpp:jingle:apps:rtp:audio",NS_JINGLE_RTP_VIDEO:"urn:xmpp:jingle:apps:rtp:video",NS_LANG_TRANS:"urn:xmpp:langtrans",NS_LANG_TRANS_ITEMS:"urn:xmpp:langtrans:items",NS_NICK:An,NS_JINGLE_ICE_UDP_1:Pn,NS_JINGLE_RAW_UDP_1:Ln,NS_RECEIPTS:"urn:xmpp:receipts",NS_INVISIBLE_0:"urn:xmpp:invisible:0",NS_BLOCKING:"urn:xmpp:blocking",NS_BLOCKING_ERRORS:"urn:xmpp:blocking:errors",NS_SMACKS_3:qn,NS_PING:"urn:xmpp:ping",NS_TIME:"urn:xmpp:time",NS_DELAY:Fn,NS_BOSH_XMPP:"urn:xmpp:xbosh",NS_DISCO_EXTERNAL_1:"urn:xmpp:extdisco:1",NS_DISCO_EXTERNAL_2:"urn:xmpp:extdisco:2",NS_DATAFORM_MEDIA:"urn:xmpp:media-element",NS_ATTENTION_0:"urn:xmpp:attention:0",NS_BOB:Mn,NS_SOFTWARE_INFO:"urn:xmpp:dataforms:softwareinfo",NS_JINGLE_FILE_TRANSFER_3:"urn:xmpp:jingle:apps:file-transfer:3",NS_JINGLE_FILE_TRANSFER_4:"urn:xmpp:jingle:apps:file-transfer:4",NS_JINGLE_FILE_TRANSFER_5:Dn,NS_JINGLE_XML_0:Bn,NS_MUC_DIRECT_INVITE:"jabber:x:conference",NS_SEC_LABEL_0:"urn:xmpp:sec-label:0",NS_SEC_LABEL_CATALOG_2:"urn:xmpp:sec-label:catalog:2",NS_SEC_LABEL_ESS_0:"urn:xmpp:sec-label:ess:0",NS_JINGLE_SOCKS5_1:Un,NS_JINGLE_IBB_1:zn,NS_JINGLE_RTP_ZRTP_1:"urn:xmpp:jingle:apps:rtp:zrtp:1",NS_THUMBS_0:"urn:xmpp:thumbs:0",NS_THUMBS_1:"urn:xmpp:thumbs:1",NS_DECLOAKING_0:"urn:xmpp:decloaking:0",NS_CARBONS_2:Jn,NS_JINGLE_RTP_RTCP_FB_0:Gn,NS_JINGLE_RTP_HDREXT_0:Vn,NS_FORWARD_0:Hn,NS_HASHES_1:"urn:xmpp:hashes:1",NS_HASHES_2:$n,NS_HASH_NAME:Wn,NS_RTT_0:Qn,NS_MUC_UNIQUE:"http://jabber.org/protocol/muc#unique",NS_CORRECTION_0:"urn:xmpp:message-correct:0",NS_PSA:"urn:xmpp:psa",NS_MAM_TMP:"urn:xmpp:mam:tmp",NS_MAM_0:"urn:xmpp:mam:0",NS_MAM_1:"urn:xmpp:mam:1",NS_MAM_2:"urn:xmpp:mam:2",NS_HATS_0:Kn,NS_IDLE_1:"urn:xmpp:idle:1",NS_JINGLE_DTLS_0:"urn:xmpp:jingle:apps:dtls:0",NS_CHAT_MARKERS_0:Xn,NS_HINTS:Yn,NS_JSON_0:Zn,NS_JINGLE_GROUPING_0:"urn:xmpp:jingle:apps:grouping:0",NS_JINGLE_RTP_SSMA_0:"urn:xmpp:jingle:apps:rtp:ssma:0",NS_JINGLE_DTLS_SCTP_1:"urn:xmpp:jingle:transports:dtls-sctp:1",NS_CSI_0:"urn:xmpp:csi:0",NS_JINGLE_MSG_INITIATE_0:"urn:xmpp:jingle:jingle-message:0",NS_DELEGATION_1:"urn:xmpp:delegation:1",NS_PUSH_0:ei,NS_JINGLE_PUB_1:"urn:xmpp:jinglepub:1",NS_SID_0:"urn:xmpp:sid:0",NS_HTTP_UPLOAD_0:ti,NS_JINGLE_HTTP_0:"urn:xmpp:jingle:transports:http:0",NS_JINGLE_HTTP_UPLOAD_0:"urn:xmpp:jingle:transports:http:upload:0",NS_JINGLE_ICE_0:ni,NS_REFERENCE_0:"urn:xmpp:reference:0",NS_EME_0:"urn:xmpp:eme:0",NS_SPOILER_0:"urn:xmpp:spoiler:0",NS_OMEMO_AXOLOTL:ii,NS_OMEMO_AXOLOTL_DEVICELIST:"eu.siacs.conversations.axolotl.devicelist",NS_OMEMO_AXOLOTL_BUNDLES:"eu.siacs.conversations.axolotl.bundles",NS_OMEMO_AXOLOTL_BUNDLE:e=>"eu.siacs.conversations.axolotl.bundles:"+e,NS_JSON_MESSAGE_0:"urn:xmpp:json-msg:0",NS_XRD:ri,NS_JINGLE_RTP_MSID_0:"urn:xmpp:jingle:apps:rtp:msid:0"});const oi=$e,ai=it,ci=pt;function li(e,t,n){return{aliases:Array.isArray(n)?n:[n],element:t,fields:{},namespace:e}}function ui(e){return{element:"message",fields:e,namespace:Ut}}function di(e){return{element:"presence",fields:e,namespace:Ut}}function pi(e){return{element:"iq",fields:e,namespace:Ut}}function hi(e){return{element:"features",fields:e,namespace:Vt}}function fi(e){return{element:"error",fields:e,namespace:Gt,path:"stanzaError"}}function mi(){return[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}]}class gi extends l.Transform{constructor(e){super({objectMode:!0}),this.closedStream=!1,this.wrappedStream=!1,this.registry=e.registry,this.acceptLanguages=e.acceptLanguages||[],e.wrappedStream&&(this.wrappedStream=!0,this.rootImportKey=e.rootKey),this.parser=new xe({allowComments:e.allowComments}),this.parser.on("error",e=>{this.destroy(e)}),this.parser.on("startElement",(e,t)=>{if(this.destroyed)return;if(this.closedStream)return this.destroy(Z.alreadyClosed());const n=new ue(e,t),i=this.registry.getImportKey(n);if(this.wrappedStream&&!this.rootElement){if(this.rootImportKey&&i!==this.rootImportKey)return this.destroy(Z.unknownRoot());const e=this.registry.import(n,{acceptLanguages:this.acceptLanguages,lang:this.lang});return e?(this.rootElement=n,void this.push({event:"stream-start",kind:i,stanza:e,xml:n})):this.destroy(Z.notWellFormed())}this.currentElement?this.currentElement=this.currentElement.appendChild(n):this.currentElement=n}),this.parser.on("endElement",e=>{if(!this.destroyed){if(this.wrappedStream&&!this.currentElement)return this.rootElement&&e===this.rootElement.name?(this.closedStream=!0,this.push({event:"stream-end",kind:this.rootImportKey,stanza:{},xml:this.rootElement}),this.end()):(this.closedStream=!0,this.destroy(Z.notWellFormed()));if(!this.currentElement||e!==this.currentElement.name)return this.closedStream=!0,this.destroy(Z.notWellFormed());if(this.currentElement.parent)this.currentElement=this.currentElement.parent;else{this.wrappedStream&&(this.currentElement.parent=this.rootElement);const e=this.registry.getImportKey(this.currentElement),t=this.registry.import(this.currentElement,{acceptLanguages:this.acceptLanguages,lang:this.lang});t&&this.push({kind:e,stanza:t,xml:this.currentElement}),this.currentElement=void 0}}}),this.parser.on("text",e=>{this.currentElement&&this.currentElement.children.push(e)})}_transform(e,t,n){this.parser.write(e.toString()),n()}}var vi=Object.freeze({__proto__:null,Registry:Mt,Translator:Ft,XMLElement:ue,define:function(e){return t=>{t.define(e)}},Parser:xe,parse:je,StreamParser:gi,escapeXML:oe,unescapeXML:ae,escapeXMLText:ce,basicLanguageResolver:le,createElement:ke,getLang:Ee,getTargetLang:Ce,findAll:Ne,findOrCreate:Oe,attribute:$e,booleanAttribute:We,integerAttribute:Qe,floatAttribute:Ke,dateAttribute:Xe,namespacedAttribute:Ye,namespacedBooleanAttribute:Ze,namespacedIntegerAttribute:et,namespacedFloatAttribute:tt,namespacedDateAttribute:nt,childAttribute:it,childBooleanAttribute:rt,childIntegerAttribute:st,childFloatAttribute:ot,childDateAttribute:at,text:ct,textJSON:lt,textBuffer:ut,languageAttribute:dt,childLanguageAttribute:(e,t)=>Le(Object.assign({converter:dt(),element:t,name:"xml:lang",namespace:e},De)),childText:pt,childTextBuffer:ht,childDate:ft,childInteger:mt,childFloat:gt,childJSON:vt,childTimezoneOffset:bt,childBoolean:yt,deepChildText:St,deepChildInteger:wt,deepChildBoolean:Tt,deepMultipleChildText:It,childEnum:xt,childDoubleEnum:jt,multipleChildText:kt,multipleChildAttribute:Et,multipleChildIntegerAttribute:Ct,childAlternateLanguageText:Nt,multipleChildAlternateLanguageText:function(e,t){return{importer(n,i){const r=[],s=new Map;let o=!1;const a=Ne(n,e||n.getNamespace(),t);for(const e of a){const t=e.getText();if(t){const n=Ee(e,i.lang);let a=s.get(n);a||(a=[],s.set(n,a),r.push({lang:n,value:a})),a.push(t),o=!0}}return o?r:void 0},exporter(n,i,r){for(const s of i)for(const i of s.value){const o=ke(e||n.getNamespace(),t,r.namespace,n);s.lang!==r.lang&&o.setAttribute("xml:lang",s.lang),o.children.push(i),n.appendChild(o)}}}},multipleChildEnum:Ot,splicePath:Rt,staticValue:At,childRawElement:function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=i.getChild(t,e||i.getNamespace());return s?n?r.sanitizers[n](s.toJSON()):s.toJSON():void 0},exporter(i,r,s){if("string"==typeof r){r=je(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(n){if(!s.sanitizers||!s.sanitizers[n])return;r=s.sanitizers[n](r)}r&&i.appendChild(new ue(r.name,r.attributes,r.children))}}},childLanguageRawElement:Pt,childAlternateLanguageRawElement:Lt,parameterMap:qt,JIDAttribute:oi,childJIDAttribute:ai,childJID:ci,addAlias:li,extendMessage:ui,extendPresence:di,extendIQ:pi,extendStreamFeatures:hi,extendStanzaError:fi,pubsubItemContentAliases:mi});class bi extends l.Transform{constructor(t,n,i="be"){super(),this._block=e.alloc(t),this._finalSize=n,this._blockSize=t,this._bigEndian="be"===i,this._len=0}_transform(e,t,n){let i=null;try{this.update(e,t)}catch(e){i=e}n(i)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(t,n){"string"==typeof t&&(n=n||"utf8",t=e.from(t,n));const i=this._block,r=this._blockSize,s=t.length;let o=this._len;for(let e=0;e<s;){const n=o%r,a=Math.min(s-e,r-n);for(let r=0;r<a;r++)i[n+r]=t[e+r];o+=a,e+=a,o%r==0&&this._update(i)}return this._len+=s,this}digest(e){const t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));const n=8*this._len;if(n<=4294967295)this._bigEndian?(this._block.writeUInt32BE(0,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)):(this._block.writeUInt32LE(n,this._blockSize-8),this._block.writeUInt32LE(0,this._blockSize-4));else{const e=(4294967295&n)>>>0,t=(n-e)/4294967296;this._bigEndian?(this._block.writeUInt32BE(t,this._blockSize-8),this._block.writeUInt32BE(e,this._blockSize-4)):(this._block.writeUInt32LE(e,this._blockSize-8),this._block.writeUInt32LE(t,this._blockSize-4))}this._update(this._block);const i=this._hash();return e?i.toString(e):i}_update(e){throw new Error("_update must be implemented by subclass")}_hash(){throw new Error("_update must be implemented by subclass")}}function yi(e,t){return e<<t|e>>>32-t}function _i(e,t,n,i,r,s,o){return yi(e+(t&n|~t&i)+r+s|0,o)+t|0}function Si(e,t,n,i,r,s,o){return yi(e+(t&i|n&~i)+r+s|0,o)+t|0}function wi(e,t,n,i,r,s,o){return yi(e+(t^n^i)+r+s|0,o)+t|0}function Ti(e,t,n,i,r,s,o){return yi(e+(n^(t|~i))+r+s|0,o)+t|0}const Ii=[1518500249,1859775393,-1894007588,-899497514];function xi(e){return e<<5|e>>>27}function ji(e){return e<<30|e>>>2}function ki(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}class Ei extends bi{constructor(){super(64,56),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this._w=new Array(80)}_update(e){const t=this._w;let n,i=0|this._a,r=0|this._b,s=0|this._c,o=0|this._d,a=0|this._e;for(n=0;n<16;++n)t[n]=e.readInt32BE(4*n);for(;n<80;++n)t[n]=(c=t[n-3]^t[n-8]^t[n-14]^t[n-16])<<1|c>>>31;var c;for(let e=0;e<80;++e){const n=~~(e/20),c=xi(i)+ki(n,r,s,o)+a+t[e]+Ii[n]|0;a=o,o=s,s=ji(r),r=i,i=c}this._a=i+this._a|0,this._b=r+this._b|0,this._c=s+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0}_hash(){const t=e.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t}}const Ci=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Ni(e,t,n){return n^e&(t^n)}function Oi(e,t,n){return e&t|n&(e|t)}function Ri(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Ai(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Pi(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}class Li extends bi{constructor(){super(64,56),this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this._w=new Array(64)}_update(e){const t=this._w;let n,i=0|this._a,r=0|this._b,s=0|this._c,o=0|this._d,a=0|this._e,c=0|this._f,l=0|this._g,u=0|this._h;for(n=0;n<16;++n)t[n]=e.readInt32BE(4*n);for(;n<64;++n)t[n]=0|(((d=t[n-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10)+t[n-7]+Pi(t[n-15])+t[n-16];var d;for(let e=0;e<64;++e){const n=u+Ai(a)+Ni(a,c,l)+Ci[e]+t[e]|0,d=Ri(i)+Oi(i,r,s)|0;u=l,l=c,c=a,a=o+n|0,o=s,s=r,r=i,i=n+d|0}this._a=i+this._a|0,this._b=r+this._b|0,this._c=s+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=c+this._f|0,this._g=l+this._g|0,this._h=u+this._h|0}_hash(){const t=e.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t}}const qi=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Fi(e,t,n){return n^e&(t^n)}function Mi(e,t,n){return e&t|n&(e|t)}function Di(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Bi(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Ui(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function zi(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Ji(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gi(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Vi(e,t){return e>>>0<t>>>0?1:0}class Hi extends bi{constructor(){super(128,112),this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this._w=new Array(160)}_update(e){const t=this._w;let n,i,r=0|this._ah,s=0|this._bh,o=0|this._ch,a=0|this._dh,c=0|this._eh,l=0|this._fh,u=0|this._gh,d=0|this._hh,p=0|this._al,h=0|this._bl,f=0|this._cl,m=0|this._dl,g=0|this._el,v=0|this._fl,b=0|this._gl,y=0|this._hl,_=0;for(_=0;_<32;_+=2)t[_]=e.readInt32BE(4*_),t[_+1]=e.readInt32BE(4*_+4);for(;_<160;_+=2){let e=t[_-30],r=t[_-30+1];const s=Ui(e,r),o=zi(r,e);e=t[_-4],r=t[_-4+1];const a=Ji(e,r),c=Gi(r,e),l=t[_-14],u=t[_-14+1],d=t[_-32],p=t[_-32+1];i=o+u|0,n=s+l+Vi(i,o)|0,i=i+c|0,n=n+a+Vi(i,c)|0,i=i+p|0,n=n+d+Vi(i,p)|0,t[_]=n,t[_+1]=i}for(let e=0;e<160;e+=2){n=t[e],i=t[e+1];const _=Mi(r,s,o),S=Mi(p,h,f),w=Di(r,p),T=Di(p,r),I=Bi(c,g),x=Bi(g,c),j=qi[e],k=qi[e+1],E=Fi(c,l,u),C=Fi(g,v,b);let N=y+x|0,O=d+I+Vi(N,y)|0;N=N+C|0,O=O+E+Vi(N,C)|0,N=N+k|0,O=O+j+Vi(N,k)|0,N=N+i|0,O=O+n+Vi(N,i)|0;const R=T+S|0,A=w+_+Vi(R,T)|0;d=u,y=b,u=l,b=v,l=c,v=g,g=m+N|0,c=a+O+Vi(g,m)|0,a=o,m=f,o=s,f=h,s=r,h=p,p=N+R|0,r=O+A+Vi(p,N)|0}this._al=this._al+p|0,this._bl=this._bl+h|0,this._cl=this._cl+f|0,this._dl=this._dl+m|0,this._el=this._el+g|0,this._fl=this._fl+v|0,this._gl=this._gl+b|0,this._hl=this._hl+y|0,this._ah=this._ah+r+Vi(this._al,p)|0,this._bh=this._bh+s+Vi(this._bl,h)|0,this._ch=this._ch+o+Vi(this._cl,f)|0,this._dh=this._dh+a+Vi(this._dl,m)|0,this._eh=this._eh+c+Vi(this._el,g)|0,this._fh=this._fh+l+Vi(this._fl,v)|0,this._gh=this._gh+u+Vi(this._gl,b)|0,this._hh=this._hh+d+Vi(this._hl,y)|0}_hash(){const t=e.allocUnsafe(64);function n(e,n,i){t.writeInt32BE(e,i),t.writeInt32BE(n,i+4)}return n(this._ah,this._al,0),n(this._bh,this._bl,8),n(this._ch,this._cl,16),n(this._dh,this._dl,24),n(this._eh,this._el,32),n(this._fh,this._fl,40),n(this._gh,this._gl,48),n(this._hh,this._hl,56),t}}const $i=new Map([["md5",class extends bi{constructor(){super(64,56,"le"),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._m=new Array(16)}_update(e){const t=this._m;for(let n=0;n<16;++n)t[n]=e.readInt32LE(4*n);let n=this._a,i=this._b,r=this._c,s=this._d;n=_i(n,i,r,s,t[0],3614090360,7),s=_i(s,n,i,r,t[1],3905402710,12),r=_i(r,s,n,i,t[2],606105819,17),i=_i(i,r,s,n,t[3],3250441966,22),n=_i(n,i,r,s,t[4],4118548399,7),s=_i(s,n,i,r,t[5],1200080426,12),r=_i(r,s,n,i,t[6],2821735955,17),i=_i(i,r,s,n,t[7],4249261313,22),n=_i(n,i,r,s,t[8],1770035416,7),s=_i(s,n,i,r,t[9],2336552879,12),r=_i(r,s,n,i,t[10],4294925233,17),i=_i(i,r,s,n,t[11],2304563134,22),n=_i(n,i,r,s,t[12],1804603682,7),s=_i(s,n,i,r,t[13],4254626195,12),r=_i(r,s,n,i,t[14],2792965006,17),i=_i(i,r,s,n,t[15],1236535329,22),n=Si(n,i,r,s,t[1],4129170786,5),s=Si(s,n,i,r,t[6],3225465664,9),r=Si(r,s,n,i,t[11],643717713,14),i=Si(i,r,s,n,t[0],3921069994,20),n=Si(n,i,r,s,t[5],3593408605,5),s=Si(s,n,i,r,t[10],38016083,9),r=Si(r,s,n,i,t[15],3634488961,14),i=Si(i,r,s,n,t[4],3889429448,20),n=Si(n,i,r,s,t[9],568446438,5),s=Si(s,n,i,r,t[14],3275163606,9),r=Si(r,s,n,i,t[3],4107603335,14),i=Si(i,r,s,n,t[8],1163531501,20),n=Si(n,i,r,s,t[13],2850285829,5),s=Si(s,n,i,r,t[2],4243563512,9),r=Si(r,s,n,i,t[7],1735328473,14),i=Si(i,r,s,n,t[12],2368359562,20),n=wi(n,i,r,s,t[5],4294588738,4),s=wi(s,n,i,r,t[8],2272392833,11),r=wi(r,s,n,i,t[11],1839030562,16),i=wi(i,r,s,n,t[14],4259657740,23),n=wi(n,i,r,s,t[1],2763975236,4),s=wi(s,n,i,r,t[4],1272893353,11),r=wi(r,s,n,i,t[7],4139469664,16),i=wi(i,r,s,n,t[10],3200236656,23),n=wi(n,i,r,s,t[13],681279174,4),s=wi(s,n,i,r,t[0],3936430074,11),r=wi(r,s,n,i,t[3],3572445317,16),i=wi(i,r,s,n,t[6],76029189,23),n=wi(n,i,r,s,t[9],3654602809,4),s=wi(s,n,i,r,t[12],3873151461,11),r=wi(r,s,n,i,t[15],530742520,16),i=wi(i,r,s,n,t[2],3299628645,23),n=Ti(n,i,r,s,t[0],4096336452,6),s=Ti(s,n,i,r,t[7],1126891415,10),r=Ti(r,s,n,i,t[14],2878612391,15),i=Ti(i,r,s,n,t[5],4237533241,21),n=Ti(n,i,r,s,t[12],1700485571,6),s=Ti(s,n,i,r,t[3],2399980690,10),r=Ti(r,s,n,i,t[10],4293915773,15),i=Ti(i,r,s,n,t[1],2240044497,21),n=Ti(n,i,r,s,t[8],1873313359,6),s=Ti(s,n,i,r,t[15],4264355552,10),r=Ti(r,s,n,i,t[6],2734768916,15),i=Ti(i,r,s,n,t[13],1309151649,21),n=Ti(n,i,r,s,t[4],4149444226,6),s=Ti(s,n,i,r,t[11],3174756917,10),r=Ti(r,s,n,i,t[2],718787259,15),i=Ti(i,r,s,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+i|0,this._c=this._c+r|0,this._d=this._d+s|0}_hash(){const t=e.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t}}],["sha-1",Ei],["sha-256",Li],["sha-512",Hi],["sha1",Ei],["sha256",Li],["sha512",Hi]]);function Wi(e){e=e.toLowerCase();const t=$i.get(e);if(t)return new t;throw new Error("Unsupported hash algorithm: "+e)}const Qi=e.alloc(128);class Ki extends l.Transform{constructor(t,n){super(),"string"==typeof n&&(n=e.from(n));const i="sha512"===t?128:64;this._alg=t,n.length>i?n=Wi(t).update(n).digest():n.length<i&&(n=e.concat([n,Qi],i)),this._ipad=e.alloc(i),this._opad=e.alloc(i);for(let e=0;e<i;e++)this._ipad[e]=54^n[e],this._opad[e]=92^n[e];this._hash=Wi(t).update(this._ipad)}_transform(e,t,n){let i;try{this.update(e,t)}catch(e){i=e}finally{n(i)}}_flush(e){let t;try{this.push(this._final())}catch(e){t=e}e(t)}_final(){const e=this._hash.digest();return Wi(this._alg).update(this._opad).update(e).digest()}update(e,t){return this._hash.update(e,t),this}digest(t){const n=this._final()||e.alloc(0);return t?n.toString(t):n}}let Xi;function Yi(t){const n=new Uint8Array(t);return t>0&&(Xi.crypto||Xi.msCrypto).getRandomValues(n),e.from(n.buffer)}"undefined"!=typeof window?Xi=window:void 0!==i&&(Xi=i);const Zi=fetch,er=WebSocket,tr=Xi.RTCPeerConnection;class nr{constructor(e){this.authenticated=!1,this.mutuallyAuthenticated=!1,this.name=e}getCacheableCredentials(){return null}processChallenge(e){}processSuccess(e){this.authenticated=!0}finalize(){const e={authenticated:this.authenticated,mutuallyAuthenticated:this.mutuallyAuthenticated};return this.errorData&&(e.errorData=this.errorData),e}}class ir{constructor(){this.mechanisms=[]}register(e,t,n){this.mechanisms.push({constructor:t,name:e.toUpperCase(),priority:n}),this.mechanisms.sort((e,t)=>t.priority-e.priority)}disable(e){const t=e.toUpperCase();this.mechanisms=this.mechanisms.filter(e=>e.name!==t)}createMechanism(e){const t=e.map(e=>e.toUpperCase());for(const e of this.mechanisms)for(const n of t)if(n===e.name)return new e.constructor(e.name);return null}}function rr(e=32){return Yi(e).toString("hex")}function sr(t,n){const i=[];for(let e=0;e<t.length;e++)i.push(t[e]^n[e]);return e.from(i)}function or(e,t){return Wi(t).update(e).digest()}function ar(e,t,n){return function(e,t){return new Ki(e.toLowerCase(),t)}(n,e).update(t).digest()}function cr(t,n,i,r){let s=ar(t,e.concat([n,e.from("00000001","hex")]),r),o=s;for(let e=0;e<i-1;e++)s=ar(t,s,r),o=sr(o,s);return o}function lr(e){const t={},n=e.toString().split(/,(?=(?:[^"]|"[^"]*")*$)/);for(let e=0,i=n.length;e<i;e++){const i=/(\w+)=["]?([^"]+)["]?$/.exec(n[e]);i&&(t[i[1]]=i[2])}return t}function ur(e){const t=[];for(const n of e)","===n?t.push("=2C"):"="===n?t.push("=3D"):t.push(n);return t.join("")}class dr extends nr{getExpectedCredentials(){return{optional:["trace"],required:[]}}createResponse(t){return e.from(t.trace||"")}}class pr extends nr{getExpectedCredentials(){return{optional:["authzid"],required:[]}}createResponse(t){return e.from(t.authzid||"")}}class hr extends nr{getExpectedCredentials(){return{optional:["authzid"],required:["username","password"]}}createResponse(t){return e.from((t.authzid||"")+"\0"+t.username+"\0"+(t.password||t.token))}}class fr extends nr{constructor(e){super(e),this.failed=!1,this.name=e}getExpectedCredentials(){return{optional:["authzid"],required:["token"]}}createResponse(t){if(this.failed)return e.from("");const n=`n,${ur(M(t.authzid))},`,i=`auth=Bearer ${t.token}`;return e.from(n+""+i+"","utf8")}processChallenge(e){this.failed=!0,this.errorData=JSON.parse(e.toString("utf8"))}}class mr extends nr{constructor(e){super(e),this.providesMutualAuthentication=!1,this.state="INITIAL",this.name=e}processChallenge(e){this.state="CHALLENGE";const t=lr(e);this.authenticated=!!t.rspauth,this.realm=t.realm,this.nonce=t.nonce,this.charset=t.charset}getExpectedCredentials(){return{optional:["authzid","clientNonce","realm"],required:["host","password","serviceName","serviceType","username"]}}createResponse(t){if("INITIAL"===this.state||this.authenticated)return null;let n=t.serviceType+"/"+t.host;t.serviceName&&t.host!==t.serviceName&&(n+="/"+t.serviceName);const i=t.realm||this.realm||"",r=t.clientNonce||rr(16),s="00000001";let o="";o+='username="'+t.username+'"',i&&(o+=',realm="'+i+'"'),o+=',nonce="'+this.nonce+'"',o+=',cnonce="'+r+'"',o+=",nc="+s,o+=",qop=auth",o+=',digest-uri="'+n+'"';const a=Wi("md5").update(t.username).update(":").update(i).update(":").update(t.password).digest(),c=Wi("md5").update(a).update(":").update(this.nonce).update(":").update(r);t.authzid&&c.update(":").update(t.authzid);const l=c.digest("hex"),u=Wi("md5").update("AUTHENTICATE:").update(n).digest("hex");return o+=",response="+Wi("md5").update(l).update(":").update(this.nonce).update(":").update(s).update(":").update(r).update(":").update("auth").update(":").update(u).digest("hex"),"utf-8"===this.charset&&(o+=",charset=utf-8"),t.authzid&&(o+=',authzid="'+t.authzid+'"'),e.from(o)}}class gr{constructor(e){this.providesMutualAuthentication=!0,this.name=e,this.state="INITIAL",this.useChannelBinding=this.name.toLowerCase().endsWith("-plus"),this.algorithm=this.name.toLowerCase().split("scram-")[1].split("-plus")[0]}getExpectedCredentials(){const e=["username","password"];return this.useChannelBinding&&e.push("tlsUnique"),{optional:["authzid","clientNonce"],required:e}}getCacheableCredentials(){return this.cache}createResponse(e){return"INITIAL"===this.state?this.initialResponse(e):this.challengeResponse(e)}processChallenge(t){const n=lr(t);this.salt=e.from(n.s||"","base64"),this.iterationCount=parseInt(n.i,10),this.nonce=n.r,this.verifier=n.v,this.error=n.e,this.challenge=t}processSuccess(e){this.processChallenge(e)}finalize(){return this.verifier?this.serverSignature.toString("base64")!==this.verifier?{authenticated:!1,error:"Mutual authentication failed",mutuallyAuthenticated:!1}:{authenticated:!0,mutuallyAuthenticated:!0}:{authenticated:!1,error:this.error,mutuallyAuthenticated:!1}}initialResponse(t){const n=ur(M(t.authzid)),i=ur(M(t.username));this.clientNonce=t.clientNonce||rr();let r="n";t.tlsUnique&&(r=this.useChannelBinding?"p=tls-unique":"y"),this.gs2Header=e.from(n?`${r},a=${n},`:r+",,"),this.clientFirstMessageBare=e.from(`n=${i},r=${this.clientNonce}`);const s=e.concat([this.gs2Header,this.clientFirstMessageBare]);return this.state="CHALLENGE",s}challengeResponse(t){const n=e.from("Client Key"),i=e.from("Server Key"),r=e.concat([this.gs2Header,t.tlsUnique||e.from("")]).toString("base64"),s=e.from(`c=${r},r=${this.nonce}`);let o,a,c;const l=t.salt&&0===e.compare(t.salt,this.salt);l&&t.clientKey&&t.serverKey?(a=e.from(t.clientKey),c=e.from(t.serverKey)):l&&t.saltedPassword?(o=e.from(t.saltedPassword),a=ar(o,n,this.algorithm),c=ar(o,i,this.algorithm)):(o=cr(e.from(M(t.password)),this.salt,this.iterationCount,this.algorithm),a=ar(o,n,this.algorithm),c=ar(o,i,this.algorithm));const u=or(a,this.algorithm),d=e.from(","),p=e.concat([this.clientFirstMessageBare,d,this.challenge,d,s]),h=sr(a,ar(u,p,this.algorithm)).toString("base64");this.serverSignature=ar(c,p,this.algorithm);const f=e.concat([s,e.from(",p="+h)]);return this.state="FINAL",this.cache={clientKey:a,salt:this.salt,saltedPassword:o,serverKey:c},f}}var vr=Object.freeze({__proto__:null,SimpleMech:nr,Factory:ir,createClientNonce:rr,XOR:sr,H:or,HMAC:ar,Hi:cr,ANONYMOUS:dr,EXTERNAL:pr,PLAIN:hr,OAUTH:fr,DIGEST:mr,SCRAM:gr});function br(e){e.getAccountInfo=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({account:{},to:t,type:"get"})).account})),e.updateAccount=(t,n)=>e.sendIQ({account:n,to:t,type:"set"}),e.deleteAccount=t=>e.sendIQ({account:{remove:!0},to:t,type:"set"}),e.getPrivateData=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({privateStorage:{[t]:{}},type:"get"})).privateStorage[t]})),e.setPrivateData=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return e.sendIQ({privateStorage:{[t]:n},type:"set"})})),e.getVCard=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({to:t,type:"get",vcard:{format:"vcard-temp"}})).vcard})),e.publishVCard=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){yield e.sendIQ({type:"set",vcard:t})})),e.enableNotifications=(t,n,i=[])=>e.sendIQ({push:{action:"enable",form:{fields:[{name:"FORM_TYPE",type:"hidden",value:"http://jabber.org/protocol/pubsub#publish-options"},...i],type:"submit"},jid:t,node:n},type:"set"}),e.disableNotifications=(t,n)=>e.sendIQ({push:{action:"disable",jid:t,node:n},type:"set"})}function yr(e){e.disco.addFeature(Cn(bn)),e.on("pubsub:published",t=>{if(t.pubsub.items.node!==bn)return;const n=t.pubsub.items.published[0].content;e.emit("avatar",{avatars:n.versions||[],jid:t.from,source:"pubsub"})}),e.on("presence",t=>{t.vcardAvatar&&"string"==typeof t.vcardAvatar&&e.emit("avatar",{avatars:[{id:t.vcardAvatar}],jid:t.from,source:"vcard"})}),e.publishAvatar=(t,n)=>e.publish("",vn,{data:n,itemType:vn},t),e.useAvatars=(t,n=[])=>e.publish("",bn,{itemType:bn,pointers:n,versions:t},"current"),e.getAvatar=(t,n)=>e.getItem(t,vn,n)}function _r(e){e.registerFeature("bind",300,(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){try{const i=yield e.sendIQ({bind:{resource:e.config.resource},type:"set"});e.features.negotiated.bind=!0,e.emit("session:prebind",i.bind.jid);const r=!t.legacySession||t.legacySession&&t.legacySession.optional;return!e.sessionStarted&&r&&e.emit("session:started",e.jid),n()}catch(e){return console.error(e),n("disconnect","JID binding failed")}}))),e.registerFeature("legacySession",1e3,(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if(e.sessionStarted||t.legacySession&&t.legacySession.optional)return e.features.negotiated.session=!0,n();try{return yield e.sendIQ({legacySession:!0,type:"set"}),e.features.negotiated.session=!0,e.sessionStarted||(e.sessionStarted=!0,e.emit("session:started",e.jid)),n()}catch(e){return n("disconnect","Session requeset failed")}}))),e.on("session:started",()=>{e.sessionStarted=!0}),e.on("session:prebind",t=>{e.jid=t,e.emit("session:bound",e.jid)}),e.on("--reset-stream-features",()=>{e.sessionStarted=!1,e.features.negotiated.bind=!1,e.features.negotiated.session=!1})}function Sr(e){e.disco.addFeature(on),e.disco.addItem({name:"Ad-Hoc Commands",node:on}),e.getCommands=t=>e.getDiscoItems(t,on)}const wr=[];for(let e=0;e<256;++e)wr[e]=(e+256).toString(16).substr(1);function Tr(e,t,n=(()=>{})){return Object(r.__awaiter)(this,void 0,void 0,(function*(){let i;const r=yield Promise.race([e,new Promise((e,r)=>{i=setTimeout(()=>r(n()),t)})]);return clearTimeout(i),r}))}function Ir(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){return new Promise(t=>{setTimeout(()=>t(),e)})}))}function xr(t,n){const i="string"==typeof t?e.from(t,"utf8"):t,r="string"==typeof n?e.from(n,"utf8"):n;return i.compare(r)}function jr(){const e=Yi(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t=0;return[wr[e[t++]],wr[e[t++]],wr[e[t++]],wr[e[t++]],"-",wr[e[t++]],wr[e[t++]],"-",wr[e[t++]],wr[e[t++]],"-",wr[e[t++]],wr[e[t++]],"-",wr[e[t++]],wr[e[t++]],wr[e[t++]],wr[e[t++]],wr[e[t++]],wr[e[15]]].join("")}const kr=new Set(["date","expires","httpUploadRetry","idleSince","published","since","stamp","timestamp","updated","utc"]),Er=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)(?:Z|((\+|-)([\d|:]*)))?$/;var Cr=Object.freeze({__proto__:null,timeoutPromise:Tr,sleep:Ir,octetCompare:xr,uuid:jr,reviveData:function(t,n){return kr.has(t)&&n&&"string"==typeof n&&Er.test(n)?new Date(n):n&&"object"==typeof n&&"Buffer"===n.type&&Array.isArray(n.data)?e.from(n):n}});function Nr(e,t){e.features.negotiated.clientStateIndication&&e.send("csi",{type:t})}function Or(e){e.disco.addFeature("urn:xmpp:ping"),e.on("iq:get:ping",t=>{e.sendIQResult(t)}),e.on("--reset-stream-features",()=>{e._stopKeepAliveInterval(),e.features.negotiated.streamManagement=!1,e.features.negotiated.clientStateIndication=!1}),e.markActive=()=>Nr(e,"active"),e.markInactive=()=>Nr(e,"inactive"),e.ping=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){yield e.sendIQ({ping:!0,to:t,type:"get"})})),e.enableKeepAlive=(t={})=>{e._keepAliveOptions=t;const n=t.interval||300,i=t.timeout||e.config.timeout||15;clearInterval(e._keepAliveInterval),e._keepAliveInterval=setInterval((function(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(e.sessionStarted)try{yield Tr(function(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(e.sm.started)return new Promise(t=>{e.once("stream:management:ack",()=>t()),e.sm.request()});try{yield e.ping()}catch(e){if(e.error&&"timeout"!==e.error.condition)return;throw e}}))}(e),1e3*i)}catch(t){e.emit("stream:error",{condition:"connection-timeout",text:"Server did not respond in "+i+" seconds"}),e.transport&&(e.transport.hasStream=!1,e.transport.disconnect(!1))}}))}),1e3*n)},e._stopKeepAliveInterval=()=>{e._keepAliveInterval&&(clearInterval(e._keepAliveInterval),delete e._keepAliveInterval)},e.disableKeepAlive=()=>{delete e._keepAliveOptions,e._stopKeepAliveInterval()},e.on("stream:management:resumed",()=>{e._keepAliveOptions&&e.enableKeepAlive(e._keepAliveOptions)}),e.on("stream:start",()=>{e._keepAliveOptions&&e.enableKeepAlive(e._keepAliveOptions)});const t=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if(!e.config.useStreamManagement)return n();const t=i=>Object(r.__awaiter)(this,void 0,void 0,(function*(){switch(i.type){case"enabled":return yield e.sm.enabled(i),e.features.negotiated.streamManagement=!0,e.off("sm",t),n();case"resumed":return yield e.sm.resumed(i),e.features.negotiated.streamManagement=!0,e.features.negotiated.bind=!0,e.sessionStarted=!0,e.sessionStarting=!1,e.off("sm",t),e.emit("stream:management:resumed",i),n("break");case"failed":yield e.sm.failed(i),e.off("sm",t),e.emit("session:end"),n()}}));e.on("sm",t),e.sm.id?e.sm.id&&e.sm.allowResume?yield e.sm.resume():(e.off("sm",t),n()):e.features.negotiated.bind?yield e.sm.enable():(e.off("sm",t),n())}));e.registerFeature("streamManagement",200,t),e.registerFeature("streamManagement",500,t),e.registerFeature("clientStateIndication",400,(t,n)=>{e.features.negotiated.clientStateIndication=!0,n()})}function Rr(t){return e.from(t.replace(/</g,"<"),"utf-8")}function Ar(e=[]){const t=[];for(const n of e)"FORM_TYPE"!==n.name&&(n.rawValues?t.push({name:Rr(n.name),values:n.rawValues.map(e=>Rr(e)).sort(xr)}):Array.isArray(n.value)?t.push({name:Rr(n.name),values:n.value.map(e=>Rr(e)).sort(xr)}):!0===n.value||!1===n.value?t.push({name:Rr(n.name),values:[Rr(n.value?"1":"0")]}):t.push({name:Rr(n.name),values:[Rr(n.value||"")]}));t.sort((e,t)=>xr(e.name,t.name));const n=[];for(const e of t){n.push(e.name);for(const t of e.values)n.push(t)}return n}function Pr(t,n){const i=[],r=e.from("<","utf8"),s=e=>{i.push(e),i.push(r)},o=function(e=[]){const t=[],n=new Set;for(const{category:i,type:r,lang:s,name:o}of e){const e=`${i}/${r}/${s||""}/${o||""}`;if(n.has(e))return null;n.add(e),t.push(Rr(e))}return t.sort(xr),t}(t.identities),a=function(e=[]){const t=[],n=new Set;for(const i of e){if(n.has(i))return null;n.add(i),t.push(Rr(i))}return t.sort(xr),t}(t.features),c=function(e=[]){const t=[],n=new Set;for(const i of e){let e;for(const t of i.fields||[])if("FORM_TYPE"===t.name&&"hidden"===t.type){if(t.rawValues&&1===t.rawValues.length){e=Rr(t.rawValues[0]);break}if(t.value&&"string"==typeof t.value){e=Rr(t.value);break}}if(e){if(n.has(e.toString()))return null;n.add(e.toString()),t.push({type:e,form:i})}}t.sort((e,t)=>xr(e.type,t.type));const i=[];for(const e of t){i.push(e.type);const t=Ar(e.form.fields);for(const e of t)i.push(e)}return i}(t.extensions);if(!o||!a||!c)return null;for(const e of o)s(e);for(const e of a)s(e);for(const e of c)s(e);return Wi(n).update(e.concat(i)).digest("base64")}class Lr{constructor(){this.capsAlgorithms=["sha-1"],this.features=new Map,this.identities=new Map,this.extensions=new Map,this.items=new Map,this.caps=new Map,this.features.set("",new Set),this.identities.set("",[]),this.extensions.set("",[])}getNodeInfo(e){return{extensions:[...this.extensions.get(e)||[]],features:[...this.features.get(e)||[]],identities:[...this.identities.get(e)||[]]}}addFeature(e,t=""){this.features.has(t)||this.features.set(t,new Set),this.features.get(t).add(e)}addIdentity(e,t=""){this.identities.has(t)||this.identities.set(t,[]),this.identities.get(t).push(e)}addItem(e,t=""){this.items.has(t)||this.items.set(t,[]),this.items.get(t).push(e)}addExtension(e,t=""){this.extensions.has(t)||this.extensions.set(t,[]),this.extensions.get(t).push(e)}updateCaps(e,t=this.capsAlgorithms){const n={extensions:[...this.extensions.get("")],features:[...this.features.get("")],identities:[...this.identities.get("")],type:"info"};for(const i of t){const t=Pr(n,i);if(!t){this.caps.delete(i);continue}this.caps.set(i,{algorithm:i,node:e,value:t});const r=`${e}#${t}`;for(const e of n.features)this.addFeature(e,r);for(const e of n.identities)this.addIdentity(e,r);for(const e of n.extensions)this.addExtension(e,r);this.identities.set(r,n.identities),this.features.set(r,new Set(n.features)),this.extensions.set(r,n.extensions)}return[...this.caps.values()]}getCaps(){return[...this.caps.values()]}}function qr(e){e.disco=new Lr,e.disco.addFeature(Xt),e.disco.addFeature(Yt),e.disco.addIdentity({category:"client",type:"web"}),e.registerFeature("caps",100,(t,n)=>{const i=W(e.jid)||e.config.server;e.emit("disco:caps",{caps:t.legacyCapabilities||[],jid:i}),e.features.negotiated.caps=!0,n()}),e.getDiscoInfo=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const i=yield e.sendIQ({disco:{node:n,type:"info"},to:t,type:"get"});return Object.assign({extensions:[],features:[],identities:[]},i.disco)})),e.getDiscoItems=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const i=yield e.sendIQ({disco:{node:n,type:"items"},to:t,type:"get"});return Object.assign({items:[]},i.disco)})),e.updateCaps=()=>{const t=e.config.capsNode||"https://stanzajs.org";return e.disco.updateCaps(t)},e.getCurrentCaps=()=>{const t=e.disco.getCaps();if(!t)return;const n=`${t[0].node}#${t[0].value}`;return{info:e.disco.getNodeInfo(n),legacyCapabilities:t}},e.on("presence",t=>{t.legacyCapabilities&&e.emit("disco:caps",{caps:t.legacyCapabilities,jid:t.from})}),e.on("iq:get:disco",t=>{const{type:n,node:i}=t.disco;"info"===n&&e.sendIQResult(t,{disco:Object.assign(Object.assign({},e.disco.getNodeInfo(i||"")),{node:i,type:"info"})}),"items"===n&&e.sendIQResult(t,{disco:{items:e.disco.items.get(i||"")||[],type:"items"}})})}const Fr={Bosh:In,Client:Ut,Component:"jabber:component:accept",Server:"jabber:server"},Mr={AccountDisabled:"account-disabled",CredentialsExpired:"credentials-expired",EncryptionRequired:"encryption-required",IncorrectEncoding:"incorrect-encoding",InvalidAuthzid:"invalid-authzid",InvalidMechanism:"invalid-mechanism",MalformedRequest:"malformed-request",MechanismTooWeak:"mechanism-too-weak",NotAuthorized:"not-authorized",TemporaryAuthFailure:"temporary-auth-failure"},Dr={BadFormat:"bad-format",BadNamespacePrefix:"bad-namespace-prefix",Conflict:"conflict",ConnectionTimeout:"connection-timeout",HostGone:"host-gone",HostUnknown:"host-unknown",ImproperAddressing:"improper-addressing",InternalServerError:"internal-server-error",InvalidFrom:"invalid-from",InvalidId:"invalid-id",InvalidNamespace:"invalid-namespace",InvalidXML:"invalid-xml",NotAuthorized:"not-authorized",NotWellFormed:"not-well-formed",PolicyViolation:"policy-violation",RemoteConnectionFailed:"remote-connection-failed",Reset:"reset",ResourceConstraint:"resource-constraint",RestrictedXML:"restricted-xml",SeeOtherHost:"see-other-host",SystemShutdown:"system-shutdown",UndefinedCondition:"undefined-condition",UnsupportedEncoding:"unsupported-encoding",UnsupportedStanzaType:"unsupported-stanza-type",UnsupportedVersion:"unsupported-version"},Br={BadRequest:"bad-request",Conflict:"conflict",FeatureNotImplemented:"feature-not-implemented",Forbidden:"forbidden",Gone:"gone",InternalServerError:"internal-server-error",ItemNotFound:"item-not-found",JIDMalformed:"jid-malformed",NotAcceptable:"not-acceptable",NotAllowed:"not-allowed",NotAuthorized:"not-authorized",PolicyViolation:"policy-violation",RecipientUnavailable:"recipient-unavailable",Redirect:"redirect",RegistrationRequired:"registration-required",RemoteServerNotFound:"remote-server-not-found",RemoteServerTimeout:"remote-server-timeout",ResourceConstraint:"resource-constraint",ServiceUnavailable:"service-unavailable",SubscriptionRequired:"subscription-required",UndefinedCondition:"undefined-condition",UnexpectedRequest:"unexpected-request"},Ur={Available:void 0,Error:"error",Probe:"probe",Subscribe:"subscribe",Subscribed:"subscribed",Unavailable:"unavailable",Unsubscribe:"unsubscribe",Unsubscribed:"unsubscribed"},zr={Boolean:"boolean",Fixed:"fixed",Hidden:"hidden",JID:"jid-single",JIDMultiple:"jid-multi",List:"list-single",ListMultiple:"list-multi",Password:"text-private",Text:"text-single",TextMultiple:"text-multi",TextPrivate:"text-private"},Jr={AffiliationChanged:"101",AffiliationLost:"321",Banned:"301",Error:"333",Kicked:"307",LoggingDisabled:"171",LoggingEnabled:"170",MembershipLost:"322",NickChanged:"303",NickChangedByService:"210",NonAnonymous:"172",NonAnonymousRoom:"100",NonPrivacyConfigurationChange:"104",RoomCreated:"201",SelfPresence:"110",SemiAnonymous:"173",Shutdown:"332",UnavailableMembersListed:"102",UnavailableMembersNotListed:"103"},Gr={ClosedNode:"closed-node",ConfigurationRequired:"configuration-required",InvalidJID:"invalid-jid",InvalidOptions:"invalid-options",InvalidPayload:"invalid-payload",InvalidSubscriptionId:"invalid-subid",ItemForbidden:"item-forbidden",ItemRequired:"item-required",JIDRequired:"jid-required",MaxItemsExceeded:"max-items-exceeded",MaxNodesExceeded:"max-nodes-exceeded",NodeIdRequired:"nodeid-required",NotInRosterGroup:"not-in-roster-group",NotSubscribed:"not-subscribed",PayloadRequired:"payload-required",PayloadTooBig:"payload-too-big",PendingSubscription:"pending-subscription",PresenceSubscriptionRequired:"presence-subscription-required",SubscriptionIdRequired:"subid-required",TooManySubscriptions:"too-many-subscriptions",Unsupported:"unsupported",UnsupportedAccessModel:"unsupported-access-model"},Vr={Active:"active",Composing:"composing",Gone:"gone",Inactive:"inactive",Paused:"paused"},Hr={Initiator:"initiator",Responder:"responder"},$r={Inactive:"inactive",Receive:"recvonly",Send:"sendonly",SendReceive:"sendrecv"},Wr={Both:"both",Initiator:"initiator",None:"none",Responder:"responder"},Qr={ContentAccept:"content-accept",ContentAdd:"content-add",ContentModify:"content-modify",ContentReject:"content-reject",ContentRemove:"content-remove",DescriptionInfo:"description-info",SecurityInfo:"security-info",SessionAccept:"session-accept",SessionInfo:"session-info",SessionInitiate:"session-initiate",SessionTerminate:"session-terminate",TransportAccept:"transport-accept",TransportInfo:"transport-info",TransportReject:"transport-reject",TransportReplace:"transport-replace"},Kr={OutOfOrder:"out-of-order",TieBreak:"tie-break",UnknownContent:"unknown-content",UnknownSession:"unknown-session",UnsupportedInfo:"unsupported-info"},Xr={AlternativeSession:"alternative-session",Busy:"busy",Cancel:"cancel",ConnectivityError:"connectivity-error",Decline:"decline",Expired:"expired",FailedApplication:"failed-application",FailedTransport:"failed-transport",GeneralError:"general-error",Gone:"gone",IncompatibleParameters:"incompatible-parameters",MediaError:"media-error",SecurityError:"security-error",Success:"success",Timeout:"timeout",UnsupportedApplications:"unsupported-applications",UnsupportedTransports:"unsupported-transports"},Yr=["afraid","amazed","amorous","angry","annoyed","anxious","aroused","ashamed","bored","brave","calm","cautious","cold","confident","confused","contemplative","contented","cranky","crazy","creative","curious","dejected","depressed","disappointed","disgusted","dismayed","distracted","embarrassed","envious","excited","flirtatious","frustrated","grateful","grieving","grumpy","guilty","happy","hopeful","hot","humbled","humiliated","hungry","hurt","impressed","in_awe","in_love","indignant","interested","intoxicated","invincible","jealous","lonely","lost","lucky","mean","moody","nervous","neutral","offended","outraged","playful","proud","relaxed","relieved","remorseful","restless","sad","sarcastic","satisfied","serious","shocked","shy","sick","sleepy","spontaneous","stressed","strong","surprised","thankful","thirsty","tired","undefined","weak","worried"],Zr=["doing_chores","drinking","eating","exercising","grooming","having_appointment","inactive","relaxing","talking","traveling","undefined","working"],es=["at_the_spa","brushing_teeth","buying_groceries","cleaning","coding","commuting","cooking","cycling","cycling","dancing","day_off","doing_maintenance","doing_the_dishes","doing_the_laundry","driving","fishing","gaming","gardening","getting_a_haircut","going_out","hanging_out","having_a_beer","having_a_snack","having_breakfast","having_coffee","having_dinner","having_lunch","having_tea","hiding","hiking","in_a_car","in_a_meeting","in_real_life","jogging","on_a_bus","on_a_plane","on_a_train","on_a_trip","on_the_phone","on_vacation","on_video_phone","other","partying","playing_sports","praying","reading","rehearsing","running","running_an_errand","scheduled_holiday","shaving","shopping","skiing","sleeping","smoking","socializing","studying","sunbathing","swimming","taking_a_bath","taking_a_shower","thinking","walking","walking_the_dog","watching_a_movie","watching_tv","working_out","writing"],ts=(e,t)=>`{${e}}${t}`,ns=ts(Rn,"mute"),is=ts(Rn,"unmute"),rs=ts(Rn,"hold"),ss=ts(Rn,"unhold"),os=ts(Rn,"active"),as=ts(Rn,"ringing"),cs=ts(Dn,"checksum"),ls=ts(Dn,"received");function us(e,t=Wr.Both){const n=e===Hr.Initiator;switch(t){case Wr.Initiator:return n?$r.Send:$r.Receive;case Wr.Responder:return n?$r.Receive:$r.Send;case Wr.Both:return $r.SendReceive}return $r.Inactive}function ds(e,t=$r.SendReceive){const n=e===Hr.Initiator;switch(t){case $r.Send:return n?Wr.Initiator:Wr.Responder;case $r.Receive:return n?Wr.Responder:Wr.Initiator;case $r.SendReceive:return Wr.Both}return Wr.None}var ps=Object.freeze({__proto__:null,VERSION:"12.17.2",StreamType:Fr,SASLFailureCondition:Mr,StreamErrorCondition:Dr,StanzaErrorCondition:Br,MessageType:{Chat:"chat",Error:"error",GroupChat:"groupchat",Headline:"headline",Normal:"normal"},PresenceType:Ur,IQType:{Error:"error",Get:"get",Result:"result",Set:"set"},PresenceShow:{Away:"away",Chat:"chat",DoNotDisturb:"dnd",ExtendedAway:"xa"},RosterSubscription:{Both:"both",From:"from",None:"none",ReceivePresenceOnly:"to",Remove:"remove",SendAndReceivePresence:"both",SendPresenceOnly:"from",To:"to"},DataFormType:{Cancel:"cancel",Form:"form",Result:"result",Submit:"submit"},DataFormFieldType:zr,MUCAffiliation:{Admin:"admin",Banned:"outcast",Member:"member",None:"none",Outcast:"outcast",Owner:"owner"},MUCRole:{Moderator:"moderator",None:"none",Participant:"participant",Visitor:"visitor"},MUCStatusCode:Jr,PubsubErrorCondition:Gr,ChatState:Vr,JingleSessionRole:Hr,JingleApplicationDirection:$r,JingleContentSenders:Wr,JingleAction:Qr,JingleErrorCondition:Kr,JingleReasonCondition:Xr,USER_MOODS:Yr,USER_ACTIVITY_GENERAL:Zr,USER_ACTIVITY_SPECIFIC:es,JINGLE_INFO:ts,JINGLE_INFO_MUTE:ns,JINGLE_INFO_UNMUTE:is,JINGLE_INFO_HOLD:rs,JINGLE_INFO_UNHOLD:ss,JINGLE_INFO_ACTIVE:os,JINGLE_INFO_RINGING:as,JINGLE_INFO_CHECKSUM_5:cs,JINGLE_INFO_RECEIVED_5:ls,sendersToDirection:us,directionToSenders:ds});function hs(e){e.disco.addFeature("jid\\20escaping"),e.disco.addFeature(Fn),e.disco.addFeature("urn:xmpp:eme:0"),e.disco.addFeature(Hn),e.disco.addFeature($n),e.disco.addFeature("urn:xmpp:hashes:1"),e.disco.addFeature("urn:xmpp:idle:1"),e.disco.addFeature(Zn),e.disco.addFeature(hn),e.disco.addFeature("urn:xmpp:psa"),e.disco.addFeature("urn:xmpp:reference:0"),e.disco.addFeature(xn),e.disco.addFeature(Qt),e.disco.addFeature("urn:xmpp:media-element"),e.disco.addFeature(Tn),e.disco.addFeature(kn);const t=["sha-1","sha-256","sha-512","md5"];for(const n of t)e.disco.addFeature(Wn(n));e.disco.addFeature("urn:xmpp:time"),e.disco.addFeature("jabber:iq:version"),e.on("iq:get:softwareVersion",t=>e.sendIQResult(t,{softwareVersion:e.config.softwareVersion||{name:"stanzajs.org",version:"12.17.2"}})),e.on("iq:get:time",t=>{const n=new Date;e.sendIQResult(t,{time:{tzo:n.getTimezoneOffset(),utc:n}})}),e.getSoftwareVersion=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({softwareVersion:{},to:t,type:"get"})).softwareVersion})),e.getTime=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({time:{},to:t,type:"get"})).time})),e.getLastActivity=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({lastActivity:{},to:t,type:"get"})).lastActivity}))}function fs(e){e.features={handlers:Object.create(null),negotiated:Object.create(null),order:[]},e.registerFeature=function(t,n,i){this.features.order.push({name:t,priority:n}),this.features.order.sort((e,t)=>e.priority-t.priority),this.features.handlers[t]=i.bind(e)},e.on("features",t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const n=e.features.negotiated,i=e.features.handlers,r=[];for(const{name:s}of e.features.order)t[s]&&i[s]&&!n[s]&&r.push(s);function s(e){return new Promise(n=>{i[e](t,(e,t)=>{n(e?{command:e,message:t}:null)})})}for(const t of r){if(n[t])continue;let i="",r="";try{const e=yield s(t);e&&(i=e.command,r=e.message||"")}catch(e){i="disconnect",r=e.message,console.error(e)}if(i)return"restart"===i&&e.transport&&e.transport.restart(),void("disconnect"===i&&(e.emit("stream:error",{condition:"policy-violation",text:"Failed to negotiate stream features: "+r}),e.disconnect()))}})))}function ms(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){"string"==typeof t&&(t={host:t});const n=Object.assign({json:!0,ssl:!0,xrd:!0},t),i=n.ssl?"https://":"http://";return function(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){try{const t=yield Promise.all(e.map(e=>e.then(e=>Promise.reject(e),e=>Promise.resolve(e))));return Promise.reject(t)}catch(e){return Promise.resolve(e)}}))}([Zi(`${i}${n.host}/.well-known/host-meta.json`).then(e=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if(!e.ok)throw new Error("could-not-fetch-json");return e.json()}))),Zi(`${i}${n.host}/.well-known/host-meta`).then(t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if(!t.ok)throw new Error("could-not-fetch-xml");const n=je(yield t.text());if(n)return e.import(n)})))])}))}function gs(e,t){e.discoverBindings=e=>Object(r.__awaiter)(this,void 0,void 0,(function*(){try{const n=yield ms(t,e),i={bosh:[],websocket:[]},r=n.links||[];for(const e of r)e.href&&"urn:xmpp:alt-connections:websocket"===e.rel&&i.websocket.push(e.href),e.href&&"urn:xmpp:alt-connections:xbosh"===e.rel&&i.bosh.push(e.href);return i}catch(e){return{}}}))}function vs(e){const t=u.getMediaSections(e),n=u.getDescription(e),i={groups:[],media:[]};u.matchPrefix(n,"a=ice-lite").length>0&&(i.iceLite=!0);for(const e of u.matchPrefix(n,"a=group:")){const t=e.split(" "),n=t.shift().substr(8);i.groups.push({mids:t,semantics:n})}for(const e of t){const t=u.getKind(e),r=u.isRejected(e),s=u.parseMLine(e),o={direction:u.getDirection(e,n),kind:t,mid:u.getMid(e),protocol:s.protocol};if(r||(o.iceParameters=u.getIceParameters(e,n),o.dtlsParameters=u.getDtlsParameters(e,n),o.setup=u.matchPrefix(e,"a=setup:")[0].substr(8),i.iceLite&&(o.iceParameters.iceLite=!0)),"audio"===t||"video"===t){o.rtpParameters=u.parseRtpParameters(e),o.rtpEncodingParameters=u.parseRtpEncodingParameters(e),o.rtcpParameters=u.parseRtcpParameters(e);const t=u.parseMsid(e);o.streams=t?[t]:[]}else"application"===t&&(o.sctp=u.parseSctpDescription(e));o.candidates=u.matchPrefix(e,"a=candidate:").map(u.parseCandidate),i.media.push(o)}return i}function bs(e){const t=[];t.push(u.writeSessionBoilerplate(e.sessionId,e.sessionVersion),"a=msid-semantic:WMS *\r\n"),(e.iceLite||e.media.filter(e=>e.iceParameters&&e.iceParameters.iceLite).length>0)&&t.push("a=ice-lite\r\n");for(const n of e.groups||[])t.push(`a=group:${n.semantics} ${n.mids.join(" ")}\r\n`);for(const n of e.media||[]){const e=!(n.iceParameters&&n.dtlsParameters);if("application"===n.kind&&n.sctp)t.push(u.writeSctpDescription(n,n.sctp));else if(n.rtpParameters){let i=u.writeRtpDescription(n.kind,n.rtpParameters);e&&(i=i.replace(`m=${n.kind} 9 `,`m=${n.kind} 0 `)),t.push(i),t.push(`a=${n.direction||"sendrecv"}\r\n`);for(const e of n.streams||[])t.push(`a=msid:${e.stream} ${e.track}\r\n`);if(n.rtcpParameters&&(t.push(u.writeRtcpParameters(n.rtcpParameters)),n.rtcpParameters.cname&&n.rtpEncodingParameters&&n.rtpEncodingParameters[0].rtx)){const e=n.rtpEncodingParameters[0];t.push(`a=ssrc-group:FID ${e.ssrc} ${e.rtx.ssrc}\r\n`),t.push(`a=ssrc:${e.rtx.ssrc} cname:${n.rtcpParameters.cname}\r\n`)}}if(void 0!==n.mid&&t.push(`a=mid:${n.mid}\r\n`),n.iceParameters&&t.push(u.writeIceParameters({usernameFragment:n.iceParameters.usernameFragment,password:n.iceParameters.password})),n.dtlsParameters&&n.setup&&t.push(u.writeDtlsParameters(n.dtlsParameters,n.setup)),n.candidates&&n.candidates.length)for(const e of n.candidates)t.push(`a=${u.writeCandidate(e)}\r\n`)}return t.join("")}function ys(e,t){const n=e.rtpParameters,i=e.rtcpParameters||{},r=e.rtpEncodingParameters||[];let s=!1;r&&r.length&&(s=!!r[0].ssrc);const o={applicationType:On,codecs:[],headerExtensions:[],media:e.kind,rtcpMux:i.mux,rtcpReducedSize:i.reducedSize,sourceGroups:[],sources:[],ssrc:s?r[0].ssrc.toString():void 0,streams:[]};for(const e of n.headerExtensions||[]){const n={id:e.id,uri:e.uri};e.direction&&"sendrecv"!==e.direction&&(n.senders=ds(t,e.direction)),o.headerExtensions.push(n)}i.ssrc&&i.cname&&(o.sources=[{parameters:{cname:i.cname},ssrc:i.ssrc.toString()}]),s&&r[0]&&r[0].rtx&&(o.sourceGroups=[{semantics:"FID",sources:[r[0].ssrc.toString(),r[0].rtx.ssrc.toString()]}]);for(const t of e.streams||[])o.streams.push({id:t.stream,track:t.track});for(const e of n.codecs||[]){const t={channels:e.channels,clockRate:e.clockRate,id:e.payloadType.toString(),name:e.name,parameters:e.parameters,rtcpFeedback:e.rtcpFeedback};e.maxptime&&(t.maxptime=e.maxptime),e.parameters&&e.parameters.ptime&&(t.ptime=parseInt(e.parameters.ptime,10)),o.codecs.push(t)}return o}function _s(e){let t;return t="rtp"===e.component?1:"rtcp"===e.component?2:e.component,{component:t,foundation:e.foundation,generation:void 0,id:void 0,ip:e.ip,network:void 0,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function Ss(e){return{address:e.ip,component:1===e.component?"rtp":2===e.component?"rtcp":e.component,foundation:e.foundation,ip:e.ip,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function ws(e,t){const n=e.iceParameters,i=e.dtlsParameters,r={candidates:[],transportType:t};n&&(r.usernameFragment=n.usernameFragment,r.password=n.password,n.iceLite&&(r.iceLite=!0)),i&&(r.fingerprints=i.fingerprints.map(t=>({algorithm:t.algorithm,setup:e.setup,value:t.value}))),e.sctp&&(r.sctp=e.sctp);for(const t of e.candidates||[])r.candidates.push(_s(t));return r}function Ts(e,t,n){return{contents:e.media.map(e=>({application:"audio"===e.kind||"video"===e.kind?ys(e,t):{applicationType:"datachannel",protocol:e.protocol},creator:Hr.Initiator,name:e.mid,senders:ds(t,e.direction),transport:ws(e,n)})),groups:e.groups?e.groups.map(e=>({contents:e.mids,semantics:e.semantics})):[]}}function Is(e,t){const n=e.application||{},i=e.transport,r=n&&n.applicationType===On,s={direction:us(t,e.senders),kind:n.media||"application",mid:e.name,protocol:r?"UDP/TLS/RTP/SAVPF":"UDP/DTLS/SCTP"};if(r){if(s.rtcpParameters={compound:!n.rtcpReducedSize,mux:n.rtcpMux,reducedSize:n.rtcpReducedSize},n.sources&&n.sources.length){const e=n.sources[0];s.rtcpParameters.ssrc=parseInt(e.ssrc,10),e.parameters&&(s.rtcpParameters.cname=e.parameters.cname)}if(s.rtpParameters={codecs:[],fecMechanisms:[],headerExtensions:[],rtcp:[]},n.streams){s.streams=[];for(const e of n.streams)s.streams.push({stream:e.id,track:e.track})}if(n.ssrc&&(s.rtpEncodingParameters=[{ssrc:parseInt(n.ssrc,10)}],n.sourceGroups&&n.sourceGroups.length)){const e=n.sourceGroups[0];s.rtpEncodingParameters[0].rtx={ssrc:parseInt(e.sources[1],10)}}let e=!1,i=!1;for(const t of n.codecs||[]){const n=t.parameters||{},r=[];for(const e of t.rtcpFeedback||[])r.push({parameter:e.parameter,type:e.type});if("red"===t.name||"ulpfec"===t.name){e=e||"red"===t.name,i=i||"ulpfec"===t.name;const n=t.name.toUpperCase();s.rtpParameters.fecMechanisms.includes(n)||s.rtpParameters.fecMechanisms.push(n)}s.rtpParameters.codecs.push({channels:t.channels,clockRate:t.clockRate,name:t.name,numChannels:t.channels,parameters:n,payloadType:parseInt(t.id,10),rtcpFeedback:r})}for(const e of n.headerExtensions||[])s.rtpParameters.headerExtensions.push({direction:us(t,e.senders||"both"),id:e.id,uri:e.uri})}if(i){if(i.usernameFragment&&i.password&&(s.iceParameters={password:i.password,usernameFragment:i.usernameFragment},i.iceLite&&(s.iceParameters.iceLite=!0)),i.fingerprints&&i.fingerprints.length){s.dtlsParameters={fingerprints:[],role:"auto"};for(const e of i.fingerprints)s.dtlsParameters.fingerprints.push({algorithm:e.algorithm,value:e.value});i.sctp&&(s.sctp=i.sctp),s.setup=i.fingerprints[0].setup}s.candidates=(i.candidates||[]).map(Ss)}return s}function xs(e,t){const n={groups:[],media:[]};for(const t of e.groups||[])n.groups.push({mids:t.contents,semantics:t.semantics});for(const i of e.contents||[])n.media.push(Is(i,t));return n}const js={condition:Br.BadRequest},ks={condition:Br.FeatureNotImplemented,jingleError:Kr.UnsupportedInfo,type:"modify"};class Es{constructor(e){this.parent=e.parent,this.sid=e.sid||jr(),this.peerID=e.peerID,this.role=e.initiator?Hr.Initiator:Hr.Responder,this._sessionState="starting",this._connectionState="starting",this.pendingApplicationTypes=e.applicationTypes||[],this.pendingAction=void 0,this.processingQueue=Object(s.priorityQueue)((e,t)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if("ended"===this.state)return"local"===e.type&&e.reject&&e.reject(new Error("Session ended")),void(t&&t());if("local"===e.type){this._log("debug","Processing local action:",e.name);try{const t=yield e.handler();e.resolve(t)}catch(t){e.reject(t)}return void(t&&t())}const{action:n,changes:i,cb:r}=e;return this._log("debug","Processing remote action:",n),new Promise(e=>{const s=(n,i)=>{r(n,i),t&&t(),e()};switch(n){case Qr.ContentAccept:return this.onContentAccept(i,s);case Qr.ContentAdd:return this.onContentAdd(i,s);case Qr.ContentModify:return this.onContentModify(i,s);case Qr.ContentReject:return this.onContentReject(i,s);case Qr.ContentRemove:return this.onContentRemove(i,s);case Qr.DescriptionInfo:return this.onDescriptionInfo(i,s);case Qr.SecurityInfo:return this.onSecurityInfo(i,s);case Qr.SessionAccept:return this.onSessionAccept(i,s);case Qr.SessionInfo:return this.onSessionInfo(i,s);case Qr.SessionInitiate:return this.onSessionInitiate(i,s);case Qr.SessionTerminate:return this.onSessionTerminate(i,s);case Qr.TransportAccept:return this.onTransportAccept(i,s);case Qr.TransportInfo:return this.onTransportInfo(i,s);case Qr.TransportReject:return this.onTransportReject(i,s);case Qr.TransportReplace:return this.onTransportReplace(i,s);default:this._log("error","Invalid or unsupported action: "+n),s({condition:Br.BadRequest})}})})),1)}get isInitiator(){return this.role===Hr.Initiator}get peerRole(){return this.isInitiator?Hr.Responder:Hr.Initiator}get state(){return this._sessionState}set state(e){e!==this._sessionState&&(this._log("info","Changing session state to: "+e),this._sessionState=e,this.parent&&this.parent.emit("sessionState",this,e))}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this._log("info","Changing connection state to: "+e),this._connectionState=e,this.parent&&this.parent.emit("connectionState",this,e))}send(e,t){(t=t||{}).sid=this.sid,t.action=e;new Set([Qr.ContentAccept,Qr.ContentAdd,Qr.ContentModify,Qr.ContentReject,Qr.ContentRemove,Qr.SessionAccept,Qr.SessionInitiate,Qr.TransportAccept,Qr.TransportReject,Qr.TransportReplace]).has(e)?this.pendingAction=e:this.pendingAction=void 0,this.parent.signal(this,{id:jr(),jingle:t,to:this.peerID,type:"set"})}processLocal(e,t){return new Promise((n,i)=>{this.processingQueue.push({handler:t,name:e,reject:i,resolve:n,type:"local"},1)})}process(e,t,n){this.processingQueue.push({action:e,cb:n,changes:t,type:"remote"},2)}start(e,t){this._log("error","Can not start base sessions"),this.end("unsupported-applications",!0)}accept(e,t){this._log("error","Can not accept base sessions"),this.end("unsupported-applications")}cancel(){this.end("cancel")}decline(){this.end("decline")}end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}_log(e,t,...n){this.parent&&(t=this.sid+": "+t,this.parent.emit("log",e,t,...n),this.parent.emit("log:"+e,t,...n))}onSessionInitiate(e,t){t()}onSessionAccept(e,t){t()}onSessionTerminate(e,t){this.end(e.reason,!0),t()}onSessionInfo(e,t){e.info?t(ks):t()}onSecurityInfo(e,t){t(ks)}onDescriptionInfo(e,t){t(ks)}onTransportInfo(e,t){t(ks)}onContentAdd(e,t){t(),this.send(Qr.ContentReject,{reason:{condition:Xr.FailedApplication,text:"content-add is not supported"}})}onContentAccept(e,t){t(js)}onContentReject(e,t){t(js)}onContentModify(e,t){t(js)}onContentRemove(e,t){t(js)}onTransportReplace(e,t){t(),this.send(Qr.TransportReject,{reason:{condition:Xr.FailedTransport,text:"transport-replace is not supported"}})}onTransportAccept(e,t){t(js)}onTransportReject(e,t){t(js)}}class Cs extends Es{constructor(e){super(e),this.bitrateLimit=0,this.candidateBuffer=[],this.transportType=Pn,this.restartingIce=!1,this.usingRelay=!1,this.maxRelayBandwidth=e.maxRelayBandwidth,this.pc=this.parent.createPeerConnection(this,Object.assign(Object.assign({},e.config),{iceServers:e.iceServers})),this.pc.oniceconnectionstatechange=()=>{this.onIceStateChange()},this.pc.onicecandidate=e=>{e.candidate?this.onIceCandidate(e):this.onIceEndOfCandidates()},this.restrictRelayBandwidth()}end(e="success",t=!1){this.pc.close(),super.end(e,t)}restartIce(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(this.isInitiator){void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this.restartingIce=!0;try{yield this.processLocal("restart-ice",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const e=yield this.pc.createOffer({iceRestart:!0}),t=vs(e.sdp);this.send(Qr.TransportInfo,{contents:t.media.map(e=>({creator:Hr.Initiator,name:e.mid,transport:ws(e,this.transportType)})),sid:this.sid}),yield this.pc.setLocalDescription(e)})))}catch(e){this._log("error","Could not create WebRTC offer",e),this.end(Xr.FailedTransport,!0)}}}))}setMaximumBitrate(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.maximumBitrate&&(e=Math.min(e,this.maximumBitrate)),this.currentBitrate=e;const t=this.pc.getSenders().find(e=>!!e.track&&"video"===e.track.kind);if(t&&t.getParameters)try{yield this.processLocal("set-bitrate",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const n=t.getParameters();n.encodings&&n.encodings.length||(n.encodings=[{}]),0===e?delete n.encodings[0].maxBitrate:n.encodings[0].maxBitrate=e,yield t.setParameters(n)})))}catch(e){this._log("error","Set maximumBitrate failed",e)}}))}onTransportInfo(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(e.contents&&e.contents[0]&&e.contents[0].transport.gatheringComplete){const n={sdpMid:e.contents[0].name,candidate:""};try{"stable"===this.pc.signalingState?yield this.pc.addIceCandidate(n):this.candidateBuffer.push(n)}catch(e){this._log("debug","Could not add null end-of-candidate")}finally{t()}return}if(this.pc.remoteDescription){const n=this.pc.remoteDescription,i=vs(n.sdp),r=i.media.find(t=>t.mid===e.contents[0].name).iceParameters.usernameFragment,s=e.contents[0].transport.usernameFragment;if(s&&r!==s){for(const[t,n]of e.contents.entries()){const e=n.transport;i.media[t].iceParameters={password:e.password,usernameFragment:e.usernameFragment},i.media[t].candidates=[]}try{if(yield this.pc.setRemoteDescription({type:n.type,sdp:bs(i)}),yield this.processBufferedCandidates(),"offer"===n.type){const e=yield this.pc.createAnswer();yield this.pc.setLocalDescription(e);const t=vs(e.sdp);this.send(Qr.TransportInfo,{contents:t.media.map(e=>({creator:Hr.Initiator,name:e.mid,transport:ws(e,this.transportType)})),sid:this.sid})}else this.restartingIce=!1}catch(e){return this._log("error","Could not do remote ICE restart",e),t(e),void this.end(Xr.FailedTransport)}}}const n=(e.contents||[]).map(e=>{const t=e.name,n=(e.transport.candidates||[]).map(e=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const n=u.writeCandidate(Ss(e));if(this.pc.remoteDescription&&"stable"===this.pc.signalingState)try{yield this.pc.addIceCandidate({sdpMid:t,candidate:n})}catch(e){this._log("error","Could not add ICE candidate",e)}else this.candidateBuffer.push({sdpMid:t,candidate:n})})));return Promise.all(n)});try{yield Promise.all(n),t()}catch(e){this._log("error","Could not process transport-info: "+e),t(e)}}))}onSessionAccept(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.state="active";const n=bs(xs(e,this.peerRole));try{yield this.pc.setRemoteDescription({type:"answer",sdp:n}),yield this.processBufferedCandidates(),this.parent.emit("accepted",this,void 0),t()}catch(e){this._log("error","Could not process WebRTC answer: "+e),t({condition:"general-error"})}}))}onSessionTerminate(e,t){this._log("info","Terminating session"),this.pc.close(),super.end(e.reason,!0),t()}onIceCandidate(e){if(!e.candidate||!e.candidate.candidate)return;const t=u.parseCandidate(e.candidate.candidate),n={contents:[{creator:Hr.Initiator,name:e.candidate.sdpMid,transport:{candidates:[_s(t)],transportType:this.transportType,usernameFragment:t.usernameFragment}}]};this._log("info","Discovered new ICE candidate",n),this.send(Qr.TransportInfo,n)}onIceEndOfCandidates(){this._log("info","ICE end of candidates");const e=vs(this.pc.localDescription.sdp).media[0];this.send(Qr.TransportInfo,{contents:[{creator:Hr.Initiator,name:e.mid,transport:{gatheringComplete:!0,transportType:this.transportType,usernameFragment:e.iceParameters.usernameFragment}}]})}onIceStateChange(){switch(this.pc.iceConnectionState){case"checking":this.connectionState="connecting";break;case"completed":case"connected":this.connectionState="connected";break;case"disconnected":if("stable"===this.pc.signalingState?this.connectionState="interrupted":this.connectionState="disconnected",this.restartingIce)return void this.end(Xr.FailedTransport);this.maybeRestartIce();break;case"failed":if("failed"===this.connectionState||this.restartingIce)return void this.end(Xr.FailedTransport);this.connectionState="failed",this.restartIce();break;case"closed":this.connectionState="disconnected",this.restartingIce?this.end(Xr.FailedTransport):this.end()}}processBufferedCandidates(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){for(const e of this.candidateBuffer)try{yield this.pc.addIceCandidate(e)}catch(e){this._log("error","Could not add ICE candidate",e)}this.candidateBuffer=[]}))}restrictRelayBandwidth(){this.pc.addEventListener("iceconnectionstatechange",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if("completed"!==this.pc.iceConnectionState&&"connected"!==this.pc.iceConnectionState)return;const e=yield this.pc.getStats();let t;if(e.forEach(n=>{"transport"===n.type&&(t=e.get(n.selectedCandidatePairId))}),t||e.forEach(e=>{"candidate-pair"===e.type&&e.selected&&(t=e)}),!t)return;let n=!1,i="",r="";if(t.remoteCandidateId){const n=e.get(t.remoteCandidateId);n&&(r=n.candidateType)}if(t.localCandidateId){const n=e.get(t.localCandidateId);n&&(i=n.candidateType)}"relay"!==i&&"relay"!==r||(n=!0),this.usingRelay=n,this.parent.emit("iceConnectionType",this,{localCandidateType:i,relayed:n,remoteCandidateType:r}),n&&void 0!==this.maxRelayBandwidth&&(this.maximumBitrate=this.maxRelayBandwidth,this.currentBitrate?this.setMaximumBitrate(Math.min(this.currentBitrate,this.maximumBitrate)):this.setMaximumBitrate(this.maximumBitrate))})))}maybeRestartIce(){this.isInitiator&&(void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this._maybeRestartingIce=setTimeout(()=>{this._maybeRestartingIce=void 0,"disconnected"===this.pc.iceConnectionState&&this.restartIce()},2e3))}}class Ns extends o.EventEmitter{constructor(e={}){super(),this.config=Object.assign({chunkSize:16384,hash:"sha-1"},e),this.file=void 0,this.channel=void 0,this.hash=Wi(this.config.hash)}send(e,t){if(this.file&&this.channel)return;this.file=e,this.channel=t,this.channel.binaryType="arraybuffer";const n=new FileReader;let i=0,r=!1;const s=()=>{if(r||i>=e.size)return;r=!0;const t=e.slice(i,i+this.config.chunkSize);n.readAsArrayBuffer(t)};t.bufferedAmountLowThreshold=8*this.config.chunkSize,t.onbufferedamountlow=()=>{s()},n.addEventListener("load",t=>{const n=t.target.result;r=!1,i+=n.byteLength,this.channel.send(n),this.hash.update(new Uint8Array(n)),this.emit("progress",i,e.size,n),i<e.size?this.channel.bufferedAmount<=this.channel.bufferedAmountLowThreshold&&s():(this.emit("progress",e.size,e.size,null),this.emit("sentFile",{algorithm:this.config.hash,name:e.name,size:e.size,value:this.hash.digest()}))}),s()}}class Os extends o.EventEmitter{constructor(e={}){super(),this.config=Object.assign({hash:"sha-1"},e),this.receiveBuffer=[],this.received=0,this.channel=void 0,this.hash=Wi(this.config.hash)}receive(e,t){this.metadata=e,this.channel=t,this.channel.binaryType="arraybuffer",this.channel.onmessage=e=>{const t=e.data.byteLength;this.received+=t,this.receiveBuffer.push(e.data),e.data&&this.hash.update(new Uint8Array(e.data)),this.emit("progress",this.received,this.metadata.size,e.data),this.received===this.metadata.size?(this.metadata.actualhash=this.hash.digest("hex"),this.emit("receivedFile",new Blob(this.receiveBuffer),this.metadata),this.receiveBuffer=[]):this.received>this.metadata.size&&(console.error("received more than expected, discarding..."),this.receiveBuffer=[])}}}class Rs extends Cs{constructor(e){super(e),this.sender=void 0,this.receiver=void 0,this.file=void 0}start(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(t=t||(()=>{}),!e||"function"==typeof e)throw new Error("File object required");this.state="pending",this.role="initiator",this.file=e,this.sender=new Ns,this.sender.on("progress",(e,t)=>{this._log("info","Send progress "+e+"/"+t)}),this.sender.on("sentFile",e=>{this._log("info","Sent file",e.name),this.send(Qr.SessionInfo,{info:{creator:Hr.Initiator,file:{hashes:[{algorithm:e.algorithm,value:e.value}]},infoType:cs,name:this.contentName}}),this.parent.emit("sentFile",this,e)}),this.channel=this.pc.createDataChannel("filetransfer",{ordered:!0}),this.channel.onopen=()=>{this.sender.send(this.file,this.channel)};try{yield this.processLocal(Qr.SessionInitiate,()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.pc.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1}),n=Ts(vs(t.sdp),this.role,this.transportType);this.contentName=n.contents[0].name,n.sid=this.sid,n.action=Qr.SessionInitiate,n.contents[0].application={applicationType:Dn,file:{date:e.lastModified?new Date(e.lastModified):void 0,hashesUsed:[{algorithm:"sha-1"}],name:e.name,size:e.size}},this.send("session-initiate",n),yield this.pc.setLocalDescription(t)}))),t()}catch(e){return this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}))}accept(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this._log("info","Accepted incoming session"),this.role="responder",this.state="active",e=e||(()=>{});try{yield this.processLocal(Qr.SessionAccept,()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const e=yield this.pc.createAnswer(),t=Ts(vs(e.sdp),this.role,this.transportType);t.sid=this.sid,t.action="session-accept";for(const e of t.contents)e.creator="initiator";this.contentName=t.contents[0].name,this.send("session-accept",t),yield this.pc.setLocalDescription(e),yield this.processBufferedCandidates()}))),e()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}))}onSessionInitiate(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this._log("info","Initiating incoming session"),this.role="responder",this.state="pending",this.transportType=e.contents[0].transport.transportType;const n=bs(xs(e,this.peerRole)),i=e.contents[0].application,r=i.file.hashesUsed?i.file.hashesUsed:i.file.hashes||[];this.receiver=new Os({hash:r[0]&&r[0].algorithm}),this.receiver.on("progress",(e,t)=>{this._log("info","Receive progress "+e+"/"+t)}),this.receiver.on("receivedFile",e=>{this.receivedFile=e,this._maybeReceivedFile()}),this.receiver.metadata=i.file,this.pc.addEventListener("datachannel",e=>{this.channel=e.channel,this.receiver.receive(this.receiver.metadata,e.channel)});try{yield this.pc.setRemoteDescription({type:"offer",sdp:n}),yield this.processBufferedCandidates(),t()}catch(e){this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}))}onSessionInfo(e,t){const n=e.info;n&&n.file&&n.file.hashes&&(this.receiver.metadata.hashes=n.file.hashes,this.receiver.metadata.actualhash&&this._maybeReceivedFile(),t())}_maybeReceivedFile(){if(this.receiver.metadata.hashes&&this.receiver.metadata.hashes.length){for(const e of this.receiver.metadata.hashes||[])if(e.value&&e.value.toString("hex")===this.receiver.metadata.actualhash)return this._log("info","File hash matches"),this.parent.emit("receivedFile",this,this.receivedFile,this.receiver.metadata),void this.end("success");this._log("error","File hash does not match"),this.end("media-error")}}}function As(e){const t=e.application;if(t.streams&&t.streams.length&&t.sources&&t.sources.length){const e=t.streams[0];t.sources[0].parameters.msid=`${e.id} ${e.track}`,t.sourceGroups&&t.sourceGroups.length>0&&t.sources.push({parameters:{cname:t.sources[0].parameters.cname,msid:`${e.id} ${e.track}`},ssrc:t.sourceGroups[0].sources[1]})}}class Ps extends Cs{constructor(e){if(super(e),this.includesAudio=!1,this.includesVideo=!1,this._ringing=!1,this.pc.addEventListener("track",e=>{this.onAddTrack(e.track,e.streams[0])}),e.stream)for(const t of e.stream.getTracks())this.addTrack(t,e.stream)}get ringing(){return this._ringing}set ringing(e){e!==this._ringing&&(this._ringing=e)}get streams(){return"closed"!==this.pc.signalingState?this.pc.getRemoteStreams():[]}start(e,t){return Object(r.__awaiter)(this,arguments,void 0,(function*(){this.state="pending",1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this.role="initiator",this.offerOptions=e;try{yield this.processLocal(Qr.SessionInitiate,()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.pc.createOffer(e),n=Ts(vs(t.sdp),this.role,this.transportType);n.sid=this.sid,n.action=Qr.SessionInitiate;for(const e of n.contents||[])e.creator="initiator",As(e);yield this.pc.setLocalDescription(t),this.send("session-initiate",n)}))),t()}catch(e){this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}))}accept(e,t){return Object(r.__awaiter)(this,arguments,void 0,(function*(){1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this._log("info","Accepted incoming session"),this.state="active",this.role="responder";try{yield this.processLocal(Qr.SessionAccept,()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.pc.createAnswer(e),n=Ts(vs(t.sdp),this.role,this.transportType);n.sid=this.sid,n.action=Qr.SessionAccept;for(const e of n.contents||[])e.creator="initiator";yield this.pc.setLocalDescription(t),yield this.processBufferedCandidates(),this.send("session-accept",n)}))),t()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}))}end(e="success",t=!1){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.end(e,t)}ring(){return this.processLocal("ring",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){this._log("info","Ringing on incoming session"),this.ringing=!0,this.send(Qr.SessionInfo,{info:{infoType:as}})})))}mute(e,t){return this.processLocal("mute",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){this._log("info","Muting",t),this.send(Qr.SessionInfo,{info:{creator:e,infoType:ns,name:t}})})))}unmute(e,t){return this.processLocal("unmute",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){this._log("info","Unmuting",t),this.send(Qr.SessionInfo,{info:{creator:e,infoType:is,name:t}})})))}hold(){return this.processLocal("hold",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){this._log("info","Placing on hold"),this.send("session-info",{info:{infoType:rs}})})))}resume(){return this.processLocal("resume",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){this._log("info","Resuming from hold"),this.send("session-info",{info:{infoType:os}})})))}addTrack(e,t,n){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){this.pc.addTrack?this.pc.addTrack(e,t):this.pc.addStream(t),n&&n()})))}removeTrack(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){return this.processLocal("removetrack",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if(this.pc.removeTrack(e),t)return t()})))}))}onAddTrack(e,t){this._log("info","Track added"),this.parent.emit("peerTrackAdded",this,e,t)}onRemoveTrack(e){this._log("info","Track removed"),this.parent.emit("peerTrackRemoved",this,e)}onSessionInitiate(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this._log("info","Initiating incoming session"),this.state="pending",this.role="responder",this.transportType=e.contents[0].transport.transportType;const n=xs(e,this.peerRole);for(const e of n.media)"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),e.streams||(e.streams=[{stream:"legacy",track:e.kind}]);const i=bs(n);try{return yield this.pc.setRemoteDescription({type:"offer",sdp:i}),yield this.processBufferedCandidates(),t()}catch(e){return this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}))}onSessionTerminate(e,t){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.onSessionTerminate(e,t)}onSessionInfo(e,t){const n=e.info||{infoType:""};switch(n.infoType){case as:return this._log("info","Outgoing session is ringing"),this.ringing=!0,this.parent.emit("ringing",this),t();case rs:return this._log("info","On hold"),this.parent.emit("hold",this),t();case ss:case os:return this._log("info","Resuming from hold"),this.parent.emit("resumed",this),t();case ns:return this._log("info","Muting",n),this.parent.emit("mute",this,n),t();case is:return this._log("info","Unmuting",n),this.parent.emit("unmute",this,n),t()}return t()}}class Ls extends o.EventEmitter{constructor(e={}){super(),e=e||{},this.selfID=e.selfID,this.sessions={},this.peers={},this.iceServers=e.iceServers||[],this.prepareSession=e.prepareSession||(e=>{if(this.config.hasRTCPeerConnection)return e.applicationTypes.indexOf(On)>=0?new Ps(e):e.applicationTypes.indexOf(Dn)>=0?new Rs(e):void 0}),this.performTieBreak=e.performTieBreak||((e,t)=>{const n=(t.jingle.contents||[]).map(e=>{if(e.application)return e.application.applicationType});return(e.pendingApplicationTypes||[]).filter(e=>n.includes(e)).length>0}),this.createPeerConnection=e.createPeerConnection||((e,t)=>{if(tr)return new tr(t)}),this.config=Object.assign({debug:!1,hasRTCPeerConnection:!!tr,peerConnectionConfig:{bundlePolicy:e.bundlePolicy||"balanced",iceTransportPolicy:e.iceTransportPolicy||"all",rtcpMuxPolicy:e.rtcpMuxPolicy||"require",sdpSemantics:e.sdpSemantics},peerConnectionConstraints:{optional:[{DtlsSrtpKeyAgreement:!0},{RtpDataChannels:!1}]}},e)}addICEServer(e){if("string"==typeof e)return void this.iceServers.push({urls:e});if(!(t=e).type&&(t.urls||t.url))return void this.iceServers.push(e);var t;let n=e.host||"";n.indexOf(":")>=0&&(n=`[${n}]`);let i=`${e.type}:${n}`;e.port&&(i+=":"+e.port),e.transport&&(i+="?transport="+e.transport),"turn"===e.type||"turns"===e.type?this.iceServers.push({credential:e.password,urls:[i],username:e.username}):"stun"!==e.type&&"stuns"!==e.type||this.iceServers.push({urls:[i]})}resetICEServers(){this.iceServers=[]}addSession(e){e.parent=this;const t=e.sid,n=e.peerID;return this.sessions[t]=e,this.peers[n]||(this.peers[n]=[]),this.peers[n].push(e),this.emit("createdSession",e),e}forgetSession(e){const t=this.peers[e.peerID]||[];t.length&&t.splice(t.indexOf(e),1),delete this.sessions[e.sid]}createMediaSession(e,t,n){const i=new Ps({config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!0,maxRelayBandwidth:786432,parent:this,peerID:e,sid:t,stream:n});return this.addSession(i),i}createFileTransferSession(e,t){const n=new Rs({config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!0,maxRelayBandwidth:786432,parent:this,peerID:e,sid:t});return this.addSession(n),n}endPeerSessions(e,t,n=!1){const i=this.peers[e]||[];delete this.peers[e];for(const e of i)e.end(t||"gone",n)}endAllSessions(e,t=!1){for(const n of Object.keys(this.peers))this.endPeerSessions(n,e,t)}process(e){const t=e.jingle?e.jingle.sid:void 0;let n=t?this.sessions[t]:void 0;const i=e.id,r=e.from;if(!r)return;if("error"===e.type){if(this._log("error","Received error response",e),n&&e.error&&"unknown-session"===e.error.jingleError)return n.end("gone",!0);const t=e.error&&"tie-break"===e.error.jingleError;return n&&"pending"===n.state&&t?n.end("alternative-session",!0):void(n&&(n.pendingAction=void 0))}if("result"===e.type)return void(n&&(n.pendingAction=void 0));const s=e.jingle.action,o=e.jingle.contents||[],a=o.map(e=>e.application?e.application.applicationType:void 0),c=o.map(e=>e.transport?e.transport.transportType:void 0);if(s!==Qr.SessionInitiate){if(!n)return"session-terminate"===s?void this.emit("send",{id:i,to:r,type:"result"}):(this._log("error","Unknown session",t),this._sendError(r,i,{condition:"item-not-found",jingleError:"unknown-session"}));if(n.peerID!==r||"ended"===n.state)return this._log("error","Session has ended, or action has wrong sender"),this._sendError(r,i,{condition:"item-not-found",jingleError:"unknown-session"});if("session-accept"===s&&"pending"!==n.state)return this._log("error","Tried to accept session twice",t),this._sendError(r,i,{condition:"unexpected-request",jingleError:"out-of-order"});if("session-terminate"!==s&&s===n.pendingAction&&(this._log("error","Tie break during pending request"),n.isInitiator))return this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}else if(n){if(n.peerID!==r)return this._log("error","Duplicate sid from new sender"),this._sendError(r,i,{condition:"service-unavailable"});if("pending"!==n.state)return this._log("error","Someone is doing this wrong"),this._sendError(r,i,{condition:"unexpected-request",jingleError:"out-of-order"});if(this.selfID&&this.selfID>n.peerID&&this.performTieBreak(n,e))return this._log("error","Tie break new session because of duplicate sids"),this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}else if(this.peers[r]&&this.peers[r].length)for(let n=0,s=this.peers[r].length;n<s;n++){const s=this.peers[r][n];if(s&&"pending"===s.state&&t&&xr(s.sid,t)>0&&this.performTieBreak(s,e))return this._log("info","Tie break session-initiate"),this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}if("session-initiate"===s){if(!o.length)return this._sendError(r,i,{condition:"bad-request"});n=this._createIncomingSession({applicationTypes:a,config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!1,parent:this,peerID:r,sid:t,transportTypes:c},e)}n.process(s,e.jingle,t=>{t?(this._log("error","Could not process request",e,t),this._sendError(r,i,t)):(this.emit("send",{id:i,to:r,type:"result"}),"session-initiate"===s&&this.emit("incoming",n))})}signal(e,t){const n=t.jingle&&t.jingle.action;e.isInitiator&&n===Qr.SessionInitiate&&this.emit("outgoing",e),this.emit("send",t)}_createIncomingSession(e,t){let n;return this.prepareSession&&(n=this.prepareSession(e,t)),n||(n=new Es(e)),this.addSession(n),n}_sendError(e,t,n){n.type||(n.type="cancel"),this.emit("send",{error:n,id:t,to:e,type:"error"})}_log(e,t,...n){this.emit("log",e,t,...n),this.emit("log:"+e,t,...n)}}var qs=Object.freeze({__proto__:null,Session:Es,ICESession:Cs,MediaSession:Ps,FileSession:Rs,SessionManager:Ls,importFromSDP:vs,exportToSDP:bs});function Fs(e){const t=!!tr,n={advertiseAudio:t,advertiseFileTransfer:t,advertiseVideo:t,bundlePolicy:"balanced",hasRTCPeerConnection:t,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require",trickleIce:!0},i=e.config.jingle,s=Object.assign(Object.assign({},n),i),o=e.jingle=new Ls(s),a=[Nn];s.hasRTCPeerConnection&&(a.push(ni,Pn,"urn:xmpp:jingle:transports:dtls-sctp:1","urn:xmpp:jingle:apps:dtls:0","urn:ietf:rfc:5888"),!1===s.trickleIce&&a.push("urn:ietf:rfc:3264"),(s.advertiseAudio||s.advertiseVideo)&&a.push(On,Gn,Vn,"urn:ietf:rfc:5576"),s.advertiseAudio&&a.push("urn:xmpp:jingle:apps:rtp:audio"),s.advertiseVideo&&a.push("urn:xmpp:jingle:apps:rtp:video"),s.advertiseFileTransfer&&a.push("urn:xmpp:jingle:apps:file-transfer:4",Dn));for(const t of a)e.disco.addFeature(t);const c=["outgoing","incoming","accepted","terminated","ringing","mute","unmute","hold","resumed"];for(const t of c)o.on(t,(n,i)=>{e.emit("jingle:"+t,n,i)});o.on("createdSession",t=>{e.emit("jingle:created",t)}),o.on("send",t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){try{if("set"===t.type){const n=yield e.sendIQ(t);n.jingle||(n.jingle={}),n.jingle.sid=t.jingle.sid,o.process(n)}"result"===t.type&&e.sendIQResult({type:"set",id:t.id,from:t.to},t),"error"===t.type&&e.sendIQError({type:"set",id:t.id,from:t.to},t)}catch(e){e.jingle||(e.jingle=t.jingle),e.jingle.sid=t.jingle.sid,o.process(e)}}))),e.on("session:bound",e=>{o.selfID=e}),e.on("iq:set:jingle",e=>{o.process(e)}),e.on("unavailable",e=>{o.endPeerSessions(e.from,void 0,!0)}),e.getServices=(t,n,i)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const r=(yield e.sendIQ({externalServices:{type:n,version:i},to:t,type:"get"})).externalServices;return r.services=r.services||[],r})),e.getServiceCredentials=(t,n,i,s,o)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({externalServiceCredentials:{host:n,port:s,type:i,version:o},to:t,type:"get"})).externalServiceCredentials})),e.discoverICEServers=(t={})=>Object(r.__awaiter)(this,void 0,void 0,(function*(){try{const n=(yield e.getServices(e.config.server,void 0,t.version)).services||[],i=[];for(const t of n)e.jingle.addICEServer(t);return i}catch(e){return[]}}))}function Ms(e,t){const n=[],i=new Map;for(const e of t)e.name&&i.set(e.name,e);const r=new Set;for(const t of e)t.name&&i.has(t.name)?(n.push(Object.assign(Object.assign({},t),i.get(t.name))),r.add(t.name)):n.push(Object.assign({},t));for(const e of t)(!e.name||e.name&&!r.has(e.name))&&n.push(Object.assign({},e));return n}var Ds=Object.freeze({__proto__:null,mergeFields:Ms});function Bs(e){e.getHistorySearchForm=(t,n={})=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({archive:{type:"query",version:n.version},to:t,type:"get"})).archive.form})),e.searchHistory=(t,n={})=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const i=e.nextId();let r="";"string"==typeof t?r=t:(r=t.to||"",n=t),n.queryId=i;const s=n.form||{};s.type="submit";const o=s.fields||[],a=[{name:"FORM_TYPE",type:"hidden",value:"urn:xmpp:mam:2"}];n.with&&a.push({name:"with",type:"text-single",value:n.with}),n.start&&a.push({name:"start",type:"text-single",value:n.start.toISOString()}),n.end&&a.push({name:"end",type:"text-single",value:n.end.toISOString()}),s.fields=Ms(a,o),n.form=s;const c=V(e.jid,r),l=[],u=e=>{c.has(e.from)&&e.archive&&e.archive.queryId===i&&l.push(e.archive)};e.on("mam:item",u);try{const t=yield e.sendIQ({archive:n,id:i,to:r,type:"set"});return Object.assign(Object.assign({},t.archive),{results:l})}finally{e.off("mam:item",u)}})),e.getHistoryPreferences=()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({archive:{type:"preferences"},type:"get"})).archive})),e.setHistoryPreferences=t=>e.sendIQ({archive:Object.assign({type:"preferences"},t),type:"set"}),e.on("message",t=>{t.archive&&e.emit("mam:item",t)})}const Us=new Set(["chat","groupchat","headline","normal"]),zs=new Set(["chat","groupchat","normal"]),Js=new Map([["markable",0],["received",1],["displayed",2],["acknowledged",3]]),Gs=(e,t)=>{var n;return e.marker&&(Js.get(e.marker.type)<Js.get(t)||"markable"===(null===(n=e.marker)||void 0===n?void 0:n.type))};function Vs(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){yield e.sendIQ({carbons:{action:t},type:"set"})}))}function Hs(e){e.disco.addFeature("urn:xmpp:attention:0"),e.disco.addFeature(Xn),e.disco.addFeature(yn),e.disco.addFeature("urn:xmpp:message-correct:0"),e.disco.addFeature("urn:xmpp:receipts"),e.disco.addFeature(Qn),e.enableCarbons=()=>Vs(e,"enable"),e.disableCarbons=()=>Vs(e,"disable"),e.markReceived=t=>e.sendMarker(t,"received"),e.markDisplayed=t=>e.sendMarker(t,"displayed"),e.markAcknowledged=t=>e.sendMarker(t,"acknowledged"),e.getAttention=(t,n={})=>e.sendMessage(Object.assign(Object.assign({},n),{requestingAttention:!0,to:t,type:"headline"})),e.sendMarker=(t,n,i)=>{if(!Gs(t,n)&&!i)return;const r=!1!==e.config.groupchatMarkersUseStanzaID;let s=t.id;if("groupchat"===t.type&&t.stanzaIds&&r){const e=t.stanzaIds.find(e=>H(e.by,t.from));e&&(s=e.id)}e.sendMessage({marker:{id:s,type:n},to:"groupchat"===t.type?K(t.from):t.from,type:t.type})},e.on("message",t=>{if(t.carbon&&H(t.from,e.jid)){const n=t.carbon.forward.message;n.delay||(n.delay=t.carbon.forward.delay||{timestamp:new Date(Date.now())}),(e=>!!e.carbon&&"received"===e.carbon.type)(t)&&(e.emit("carbon:received",t),e.emit("message",n)),(e=>!!e.carbon&&"sent"===e.carbon.type)(t)&&(e.emit("carbon:sent",t),e.emit("message:sent",n,!0))}(e=>!!e.forms&&e.forms.length>0)(t)&&e.emit("dataform",t),t.requestingAttention&&e.emit("attention",t),(e=>!!e.rtt)(t)&&e.emit("rtt",t),(e=>!!e.replace)(t)&&e.emit("replace",t),(e=>!!e.chatState)(t)&&zs.has(t.type||"normal")&&e.emit("chat:state",t);const n=!1!==e.config.sendReceipts,i=!1!==e.config.sendMUCReceipts,r=!1!==e.config.chatMarkers,s=!1!==e.config.groupchatMarkersUseStanzaID,o=(e=>{var t;return!!e.receipt&&"request"===e.receipt.type&&Us.has(null!==(t=e.type)&&void 0!==t?t:"normal")})(t),a=Gs(t,"received"),c=o&&n&&("groupchat"!==t.type||i);if(c||r&&a){const n="groupchat"===t.type?K(t.from):t.from;let i=t.id;if("groupchat"===t.type&&t.stanzaIds&&s){const e=t.stanzaIds.find(e=>H(e.by,t.from));e&&(i=e.id)}e.sendMessage({receipt:c?{id:t.id,type:"received"}:void 0,marker:r&&a?{id:i,type:"received"}:void 0,to:n,type:t.type})}t.receipt&&"received"===t.receipt.type&&e.emit("receipt",t),t.marker&&"markable"!==t.marker.type&&e.emit("marker:"+t.marker.type,t)})}function $s(e){e.disco.addFeature(en),e.disco.addFeature("jabber:x:conference"),e.disco.addFeature(Kn),e.joinedRooms=new Map,e.joiningRooms=new Map,e.leavingRooms=new Map,e.on("session:started",(function(){const t=e.joiningRooms;e.joiningRooms=new Map;for(const[n,i]of t)e.joinRoom(n,i);const n=e.joinedRooms;e.joinedRooms=new Map;for(const[t,i]of n)e.joinRoom(t,i)})),e.on("message",t=>{if("groupchat"===t.type&&t.hasSubject)e.emit("muc:topic",{from:t.from,room:K(t.from),topic:t.subject||""});else if(t.muc)if("direct-invite"===t.muc.type||!t.muc.invite&&t.legacyMUC){const n="direct-invite"===t.muc.type?t.muc:t.legacyMUC;e.emit("muc:invite",{from:t.from,password:n.password,reason:n.reason,room:n.jid,thread:n.thread,type:"direct"})}else t.muc.invite?e.emit("muc:invite",{from:t.muc.invite[0].from,password:t.muc.password,reason:t.muc.invite[0].reason,room:t.from,thread:t.muc.invite[0].thread,type:"mediated"}):t.muc.decline?e.emit("muc:declined",{from:t.muc.decline.from,reason:t.muc.decline.reason,room:t.from}):e.emit("muc:other",t)}),e.on("presence",t=>{const n=K(t.from);if(e.joiningRooms.has(n)&&"error"===t.type)return e.joiningRooms.delete(n),e.emit("muc:failed",t),void e.emit("muc:error",t);if(!function(e){return!!e.muc}(t))return;const i=t.muc.statusCodes&&t.muc.statusCodes.indexOf(Jr.SelfPresence)>=0,r=t.muc.statusCodes&&t.muc.statusCodes.indexOf(Jr.NickChanged)>=0;if("error"===t.type)return void e.emit("muc:error",t);if("unavailable"===t.type)return e.emit("muc:unavailable",t),i&&(r?e.joinedRooms.set(n,t.muc.nick):(e.emit("muc:leave",t),e.joinedRooms.delete(n),e.leavingRooms.delete(n))),void(t.muc.destroy&&e.emit("muc:destroyed",{newRoom:t.muc.destroy.jid,password:t.muc.destroy.password,reason:t.muc.destroy.reason,room:n}));e.emit("muc:available",t);const s=e.joiningRooms.has(n)||!e.joinedRooms.has(n);i&&(e.joinedRooms.set(n,Q(t.from)),s&&(e.joiningRooms.delete(n),e.emit("muc:join",t)))}),e.joinRoom=(t,n,i={})=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if(t=K(t),e.joiningRooms.set(t,n||""),!n)try{n=yield e.getReservedNick(t),e.joiningRooms.set(t,n)}catch(e){throw new Error("Room nick required")}return new Promise((r,s)=>{function o(n){H(n.from,t)&&(e.off("muc:join",o),e.off("muc:failed",a),r(n))}function a(n){H(n.from,t)&&(e.off("muc:join",o),e.off("muc:failed",a),s(n))}e.on("muc:join",o),e.on("muc:failed",a),e.sendPresence(Object.assign(Object.assign({},i),{muc:Object.assign(Object.assign({},i.muc),{type:"join"}),to:J(t,n)}))})})),e.leaveRoom=(t,n,i={})=>(t=K(t),n=n||e.joinedRooms.get(t),e.leavingRooms.set(t,n),new Promise((r,s)=>{const o=i.id||jr(),a=V(t);function c(n){H(n.from,t)&&(e.off("muc:leave",c),e.off("presence:error",l),r(n))}function l(n){n.id===o&&a.has(n.from)&&(e.joinedRooms.has(t)||e.leavingRooms.delete(t),e.off("muc:leave",c),e.off("presence:error",l),s(n))}e.on("muc:leave",c),e.on("presence:error",l),e.sendPresence(Object.assign(Object.assign({},i),{id:o,to:J(t,n),type:"unavailable"}))})),e.ban=(t,n,i)=>e.setRoomAffiliation(t,n,"outcast",i),e.kick=(t,n,i)=>e.setRoomRole(t,n,"none",i),e.invite=(t,n=[])=>{Array.isArray(n)||(n=[n]),e.sendMessage({muc:{invite:n,type:"info"},to:t})},e.directInvite=(t,n,i={})=>{e.sendMessage({muc:Object.assign(Object.assign({},i),{jid:t,type:"direct-invite"}),to:n})},e.declineInvite=(t,n,i)=>{e.sendMessage({muc:{decline:{reason:i,to:n},type:"info"},to:t})},e.changeNick=(t,n)=>{const i=jr(),r=J(t,n),s=V(t);return new Promise((t,n)=>{function o(n){s.has(K(n.from))&&n.muc.statusCodes&&n.muc.statusCodes.includes(Jr.SelfPresence)&&(e.off("muc:available",o),e.off("presence:id:"+i,a),t(n))}function a(r){s.has(K(r.from))&&r.id===i&&(e.off("muc:available",o),e.off("presence:id:"+i,a),"error"===r.type?n(r):t(r))}e.on("muc:available",o),e.on("presence:id:"+i,a),e.sendPresence({id:i,to:r})})},e.setSubject=(t,n)=>{e.sendMessage({subject:n,to:t,type:"groupchat"})},e.getReservedNick=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){try{const n=(yield e.getDiscoInfo(t,"x-roomuser-item")).identities[0];if(n.name)return n.name;throw new Error("No nickname reserved")}catch(e){throw new Error("No nickname reserved")}})),e.requestRoomVoice=t=>{e.sendMessage({forms:[{fields:[{name:"FORM_TYPE",type:"hidden",value:"http://jabber.org/protocol/muc#request"},{name:"muc#role",type:"text-single",value:"participant"}],type:"submit"}],to:t})},e.setRoomAffiliation=(t,n,i,r)=>e.sendIQ({muc:{type:"user-list",users:[{affiliation:i,jid:n,reason:r}]},to:t,type:"set"}),e.setRoomRole=(t,n,i,r)=>e.sendIQ({muc:{type:"user-list",users:[{nick:n,reason:r,role:i}]},to:t,type:"set"}),e.getRoomMembers=(t,n={affiliation:"member"})=>e.sendIQ({muc:{type:"user-list",users:[n]},to:t,type:"get"}),e.getRoomConfig=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const n=yield e.sendIQ({muc:{type:"configure"},to:t,type:"get"});if(!n.muc.form)throw new Error("No configuration form returned");return n.muc.form})),e.configureRoom=(t,n={})=>e.sendIQ({muc:{form:Object.assign(Object.assign({},n),{type:"submit"}),type:"configure"},to:t,type:"set"}),e.destroyRoom=(t,n={})=>e.sendIQ({muc:{destroy:n,type:"configure"},to:t,type:"set"}),e.getUniqueRoomName=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.sendIQ({muc:{type:"unique"},to:e,type:"get"});if(!t.muc.name)throw new Error("No unique name returned");return t.muc.name}))},e.getBookmarks=()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const t=yield e.getPrivateData("bookmarks");return t&&t.rooms?t.rooms:[]})),e.setBookmarks=t=>e.setPrivateData("bookmarks",{rooms:t}),e.addBookmark=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const n=yield e.getBookmarks(),i=[];let r=!1;for(const e of n)H(e.jid,t.jid)?(i.push(Object.assign(Object.assign({},e),t)),r=!0):i.push(e);return r||i.push(t),e.setBookmarks(i)})),e.removeBookmark=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const n=(yield e.getBookmarks()).filter(e=>!H(e.jid,t));return e.setBookmarks(n)}))}function Ws(e){e.disco.addFeature(Sn),e.disco.addFeature(gn),e.disco.addFeature(_n),e.disco.addFeature(An),e.disco.addFeature(wn),e.disco.addFeature(Cn(Sn)),e.disco.addFeature(Cn(gn)),e.disco.addFeature(Cn(_n)),e.disco.addFeature(Cn(An)),e.disco.addFeature(Cn(wn)),e.publishActivity=t=>e.publish("",Sn,Object.assign({itemType:Sn},t)),e.publishGeoLoc=t=>e.publish("",gn,Object.assign({itemType:gn},t)),e.publishMood=t=>e.publish("",_n,Object.assign({itemType:_n},t)),e.publishNick=t=>e.publish("",An,{itemType:An,nick:t}),e.publishTune=t=>e.publish("",wn,Object.assign({itemType:wn},t)),e.on("pubsub:published",t=>{const n=t.pubsub.items.published[0].content;switch(t.pubsub.items.node){case Sn:return e.emit("activity",{activity:n,jid:t.from});case gn:return e.emit("geoloc",{geoloc:n,jid:t.from});case _n:return e.emit("mood",{jid:t.from,mood:n});case An:return e.emit("nick",{jid:t.from,nick:n.nick});case wn:return e.emit("tune",{jid:t.from,tune:t.pubsub.items.published[0].content})}})}function Qs(e){e.disco.addFeature(xn+"#SubID",xn),e.on("message",t=>{!function(e){return!!e.pubsub&&!(e.pubsub.context&&"user"!==e.pubsub.context||!e.pubsub.affiliations)}(t)?function(e){return!!e.pubsub}(t)&&(e.emit("pubsub:event",t),!function(e){return!!e.pubsub.items&&!!e.pubsub.items.published}(t)?!function(e){return!!e.pubsub.items&&!!e.pubsub.items.retracted}(t)?!function(e){return"purge"===e.pubsub.eventType}(t)?!function(e){return"delete"===e.pubsub.eventType}(t)?!function(e){return"subscription"===e.pubsub.eventType}(t)?function(e){return"configuration"===e.pubsub.eventType}(t)&&e.emit("pubsub:config",t):e.emit("pubsub:subscription",t):e.emit("pubsub:deleted",t):e.emit("pubsub:purged",t):e.emit("pubsub:retracted",t):e.emit("pubsub:published",t)):e.emit("pubsub:affiliations",t)}),e.subscribeToNode=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const i={};let r;"string"==typeof n?(i.node=n,i.jid=K(e.jid)):(i.node=n.node,i.jid=n.jid||(n.useBareJID?K(e.jid):e.jid),r=n.options);const s=yield e.sendIQ({pubsub:{context:"user",subscribe:i,subscriptionOptions:r?{form:r}:void 0},to:t,type:"set"}),o=s.pubsub.subscription||{};return s.pubsub.subscriptionOptions&&(o.options=s.pubsub.subscriptionOptions.form),o})),e.unsubscribeFromNode=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const i={};"string"==typeof n?(i.node=n,i.jid=K(e.jid)):(i.node=n.node,i.subid=n.subid,i.jid=n.jid||(n.useBareJID?K(e.jid):e.jid));const r=yield e.sendIQ({pubsub:{context:"user",unsubscribe:i},to:t,type:"set"});return r.pubsub&&r.pubsub.subscription?r.pubsub.subscription:Object.assign(Object.assign({},i),{state:"none"})})),e.publish=(t,n,i,r)=>e.sendIQ({pubsub:{context:"user",publish:{item:{content:i,id:r},node:n}},to:t,type:"set"}),e.getItem=(t,n,i)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({pubsub:{context:"user",fetch:{items:[{id:i}],node:n}},to:t,type:"get"})).pubsub.fetch.items[0]})),e.getItems=(t,n,i={})=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const r=yield e.sendIQ({pubsub:{context:"user",fetch:{max:i.max,node:n},paging:i},to:t,type:"get"}),s=r.pubsub.fetch;return s.paging=r.pubsub.paging,s})),e.retract=(t,n,i,r)=>e.sendIQ({pubsub:{context:"user",retract:{id:i,node:n,notify:r}},to:t,type:"set"}),e.purgeNode=(t,n)=>e.sendIQ({pubsub:{context:"owner",purge:n},to:t,type:"set"}),e.deleteNode=(t,n,i)=>e.sendIQ({pubsub:{context:"owner",destroy:{node:n,redirect:i}},to:t,type:"set"}),e.createNode=(t,n,i)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const r=yield e.sendIQ({pubsub:{configure:i?{form:i}:void 0,context:"user",create:{node:n}},to:t,type:"set"});return r.pubsub&&r.pubsub.create?r.pubsub.create:{node:n}})),e.getSubscriptions=(t,n={})=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({pubsub:{context:"user",subscriptions:n},to:t,type:"get"})).pubsub.subscriptions})),e.getAffiliations=(t,n)=>e.sendIQ({pubsub:{affiliations:{node:n}},to:t,type:"get"}),e.getNodeSubscribers=(t,n,i={})=>("string"==typeof n?i.node=n:i=Object.assign(Object.assign({},i),n),e.sendIQ({pubsub:{context:"owner",subscriptions:i},to:t,type:"get"})),e.updateNodeSubscriptions=(t,n,i)=>e.sendIQ({pubsub:{context:"owner",subscriptions:{items:i,node:n}},to:t,type:"set"}),e.getNodeAffiliations=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({pubsub:{affiliations:{node:n},context:"owner"},to:t,type:"get"})).pubsub.affiliations})),e.updateNodeAffiliations=(t,n,i)=>e.sendIQ({pubsub:{affiliations:{items:i,node:n},context:"owner"},to:t,type:"set"}),e.getNodeConfig=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({pubsub:{configure:{node:n},context:"owner"},to:t,type:"get"})).pubsub.configure.form||{}})),e.getDefaultNodeConfig=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({pubsub:{context:"owner",defaultConfiguration:{}},to:t,type:"get"})).pubsub.defaultConfiguration.form||{}})),e.configureNode=(t,n,i)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return e.sendIQ({pubsub:{configure:{form:i,node:n},context:"owner"},to:t,type:"set"})})),e.getDefaultSubscriptionOptions=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({pubsub:{defaultSubscriptionOptions:{}},to:t,type:"get"})).pubsub.defaultSubscriptionOptions.form||{}}))}function Ks(e){function t(t,n){return Object(r.__awaiter)(this,void 0,void 0,(function*(){yield e.sendIQ({blockList:{action:t,jids:[n]},type:"set"})}))}e.on("iq:set:roster",t=>{if(!V(e.jid).has(t.from))return e.sendIQError(t,{error:{condition:"service-unavailable",type:"cancel"}});e.emit("roster:update",t),e.sendIQResult(t)}),e.on("iq:set:blockList",t=>{if(!V(e.jid).has(t.from))return e.sendIQError(t,{error:{condition:"service-unavailable",type:"cancel"}});const n=t.blockList;e.emit(n.action,{jids:n.jids||[]}),e.sendIQResult(t)}),e.getRoster=()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const t=yield e.sendIQ({roster:{version:e.config.rosterVer},type:"get"});if(t.roster){const n=t.roster.version;return n&&(e.config.rosterVer=n,e.emit("roster:ver",n)),t.roster.items=t.roster.items||[],t.roster}return{items:[]}})),e.updateRosterItem=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){yield e.sendIQ({roster:{items:[t]},type:"set"})})),e.removeRosterItem=t=>e.updateRosterItem({jid:t,subscription:"remove"}),e.subscribe=t=>{e.sendPresence({type:"subscribe",to:t})},e.unsubscribe=t=>{e.sendPresence({type:"unsubscribe",to:t})},e.acceptSubscription=t=>{e.sendPresence({type:"subscribed",to:t})},e.denySubscription=t=>{e.sendPresence({type:"unsubscribed",to:t})},e.getBlocked=()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const t=yield e.sendIQ({blockList:{action:"list"},type:"get"});return Object.assign({jids:[]},t.blockList)})),e.block=e=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return t("block",e)})),e.unblock=e=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return t("unblock",e)})),e.goInvisible=(t=!1)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){yield e.sendIQ({type:"set",visiblity:{probe:t,type:"invisible"}})})),e.goVisible=()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){yield e.sendIQ({type:"set",visiblity:{type:"visible"}})}))}function Xs(e){e.registerFeature("sasl",100,(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const i=e.sasl.createMechanism(t.sasl.mechanisms),s=t=>Object(r.__awaiter)(this,void 0,void 0,(function*(){if(i)switch(t.type){case"success":return e.features.negotiated.sasl=!0,e.off("sasl",s),e.emit("auth:success",e.config.credentials),e.transport&&(e.transport.authenticated=!0),void n("restart");case"challenge":i.processChallenge(t.value);try{const t=yield e.getCredentials(),n=i.createResponse(t);n||""===n?e.send("sasl",{type:"response",value:n}):e.send("sasl",{type:"response"});const r=i.getCacheableCredentials();r&&(e.config.credentials||(e.config.credentials={}),e.config.credentials=Object.assign(Object.assign({},e.config.credentials),r),e.emit("credentials:update",e.config.credentials))}catch(t){console.error(t),e.send("sasl",{type:"abort"})}return;case"failure":case"abort":return e.off("sasl",s),e.emit("auth:failed"),void n("disconnect","authentication failed")}}));if(!i)return e.off("sasl",s),e.emit("auth:failed"),n("disconnect","authentication failed");e.on("sasl",s),e.once("--reset-stream-features",()=>{e.features.negotiated.sasl=!1,e.off("sasl",s)});try{const t=yield e.getCredentials();e.send("sasl",{mechanism:i.name,type:"auth",value:i.createResponse(t)})}catch(t){console.error(t),e.send("sasl",{type:"abort"})}})))}function Ys(e){function t(t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){const n=yield e.getDiscoInfo(t);if(!n.features||!n.features.includes(ti))return;let i;for(const e of n.extensions||[]){const n=e.fields||[];if(n.some(e=>"FORM_TYPE"===e.name&&e.value===ti)){const e=n.find(e=>"max-file-size"===e.name);return e&&(i=parseInt(e.value,10)),{jid:t,maxSize:i}}}}))}e.disco.addFeature(Mn),e.getBits=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({bits:{cid:n},to:t,type:"get"})).bits})),e.getUploadService=(n=W(e.jid))=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const i=yield t(n);if(i)return i;const r=yield e.getDiscoItems(n);for(const e of r.items||[]){if(!e.jid)continue;const n=yield t(e.jid);if(n)return n}throw new Error("No upload service discovered on: "+n)})),e.getUploadSlot=(t,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){return(yield e.sendIQ({httpUpload:Object.assign({type:"request"},n),to:t,type:"get"})).httpUpload}))}function Zs(e){e.use(fs),e.use(qr),e.use(_r),e.use(Or),e.use(gs),e.use(Xs)}function eo(e){e.use(br),e.use(Hs),e.use(yr),e.use(Sr),e.use(hs),e.use(Fs),e.use(Bs),e.use($s),e.use(Ws),e.use(Qs),e.use(Ks),e.use(Ys)}const to={aliases:["features.legacySession","iq.legacySession"],element:"session",fields:{optional:yt(null,"optional")},namespace:Jt},no=[{aliases:["atomentry",{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"entry",fields:{id:pt(null,"id"),published:ft(null,"published"),updated:ft(null,"updated")},namespace:Dt,type:Dt,typeField:"itemType"},{element:"summary",fields:{text:ct(),type:$e("type","text")},namespace:Dt,path:"atomentry.summary"},{element:"title",fields:{text:ct(),type:$e("type","text")},namespace:Dt,path:"atomentry.title"},{aliases:[{path:"atomentry.links",multiple:!0}],element:"link",fields:{href:$e("href"),mediaType:$e("type"),rel:$e("rel")},namespace:Dt},{aliases:[{path:"atomentry.authors",multiple:!0}],element:"author",fields:{name:pt(null,"name"),uri:pt(null,"uri"),email:pt(null,"email")},namespace:Dt},{aliases:[{path:"atomentry.contributors",multiple:!0}],element:"contributor",fields:{name:pt(null,"name"),uri:pt(null,"uri"),email:pt(null,"email")},namespace:Dt},{aliases:[{path:"atomentry.categories",multiple:!0}],element:"category",fields:{term:$e("term"),scheme:$e("scheme"),label:$e("label")},namespace:Dt},{element:"content",fields:{text:ct(),type:$e("type","text")},namespace:Dt,path:"atomentry.content"},{element:"rights",fields:{text:ct(),type:$e("type","text")},namespace:Dt,path:"atomentry.rights"}],io={defaultType:"stream",element:"stream",fields:{from:$e("from"),id:$e("id"),lang:dt(),to:$e("to"),version:$e("version")},namespace:Vt,path:"stream",type:"stream",typeField:"action"},ro={element:"features",namespace:Vt,path:"features"},so={element:"error",fields:{alternateLanguageText:Nt(Ht,"text"),condition:xt(Ht,Object.values(Dr),Dr.UndefinedCondition),seeOtherHost:pt(Ht,Dr.SeeOtherHost),text:pt(Ht,"text")},namespace:Vt,path:"streamError"},oo=Object.values(Fr).map(e=>({aliases:["stanzaError","message.error","presence.error","iq.error"],defaultType:Ut,element:"error",fields:{alternateLanguageText:Nt(Gt,"text"),by:oi("by"),condition:xt(Gt,Object.values(Br),Br.UndefinedCondition),gone:pt(Gt,Br.Gone),redirect:pt(Gt,Br.Redirect),text:pt(Gt,"text"),type:$e("type")},namespace:e,type:e,typeField:"streamType"})),ao=new Set(["from","id","lang","to","type","payloadType","error","streamType"]),co=Object.values(Fr).map(e=>({childrenExportOrder:{error:2e5},defaultType:Ut,element:"iq",fields:{from:oi("from"),id:$e("id"),lang:dt(),payloadType:{order:-1e4,importer(e,t){if("get"!==t.data.type&&"set"!==t.data.type)return;if(1!==e.children.filter(e=>"string"!=typeof e).length)return"invalid-payload-count";const n=Object.keys(t.data).filter(e=>!ao.has(e));return 1!==n.length?"unknown-payload":n[0]}},to:oi("to"),type:$e("type")},namespace:e,path:"iq",type:e,typeField:"streamType"})),lo=Object.values(Fr).map(e=>({childrenExportOrder:{error:2e5},defaultType:Ut,element:"message",fields:{from:oi("from"),id:$e("id"),lang:dt(),to:oi("to")},namespace:e,path:"message",type:e,typeField:"streamType"})),uo=Object.values(Fr).map(e=>({childrenExportOrder:{error:2e5},defaultType:Ut,element:"presence",fields:{from:oi("from"),id:$e("id"),lang:dt(),to:oi("to")},namespace:e,path:"presence",type:e,typeField:"streamType"})),po=[io,ro,so,...oo,...[{element:"mechanisms",fields:{mechanisms:kt(null,"mechanism")},namespace:zt,path:"features.sasl"},{element:"abort",namespace:zt,path:"sasl",type:"abort",typeField:"type"},{element:"auth",fields:{mechanism:$e("mechanism"),value:ut("base64")},namespace:zt,path:"sasl",type:"auth",typeField:"type"},{element:"challenge",fields:{value:ut("base64")},namespace:zt,path:"sasl",type:"challenge",typeField:"type"},{element:"response",fields:{value:ut("base64")},namespace:zt,path:"sasl",type:"response",typeField:"type"},{element:"success",fields:{value:ut("base64")},namespace:zt,path:"sasl",type:"success",typeField:"type"},{element:"failure",fields:{alternateLanguageText:Nt(zt,"text"),condition:xt(zt,Object.values(Mr)),text:pt(zt,"text")},namespace:zt,path:"sasl",type:"failure",typeField:"type"}],...[{aliases:["features.tls"],defaultType:"start",element:"starttls",fields:{required:yt(null,"required")},namespace:$t,path:"tls",type:"start",typeField:"type"},{element:"proceed",namespace:$t,path:"tls",type:"proceed",typeField:"type"},{element:"failure",namespace:$t,path:"tls",type:"failure",typeField:"type"}],...co,...lo,...uo,{aliases:["features.bind","iq.bind"],element:"bind",fields:{jid:pt(null,"jid"),resource:pt(null,"resource")},namespace:Bt}],ho=[hi({rosterPreApproval:yt("urn:xmpp:features:pre-approval","sub"),rosterVersioning:yt("urn:xmpp:features:rosterver","ver")}),ui({alternateLanguageBodies:Nt(null,"body"),alternateLanguageSubjects:Nt(null,"subject"),body:pt(null,"body"),hasSubject:yt(null,"subject"),parentThread:it(null,"thread","parent"),subject:pt(null,"subject"),thread:pt(null,"thread"),type:$e("type")}),di({alternateLanguageStatuses:Nt(null,"status"),priority:mt(null,"priority",0),show:pt(null,"show"),status:pt(null,"status"),type:$e("type")}),{element:"query",fields:{version:$e("ver",void 0,{emitEmpty:!0})},namespace:"jabber:iq:roster",path:"iq.roster"},{aliases:[{path:"iq.roster.items",multiple:!0}],element:"item",fields:{groups:kt(null,"group"),jid:oi("jid"),name:$e("name"),pending:$e("ask"),preApproved:We("approved"),subscription:$e("subscription")},namespace:"jabber:iq:roster"}],fo=[{element:"open",fields:{from:$e("from"),id:$e("id"),lang:dt(),to:$e("to"),version:$e("version")},namespace:Wt,path:"stream",type:"open"},{element:"close",fields:{seeOtherURI:$e("see-other-uri")},namespace:Wt,path:"stream",type:"close"}],mo=[{aliases:[{path:"message.forms",multiple:!0}],element:"x",fields:{instructions:Object.assign(Object.assign({},kt(null,"instructions")),{exportOrder:2}),reported:Object.assign(Object.assign({},Rt(null,"reported","dataformField",!0)),{exportOrder:3}),title:Object.assign(Object.assign({},pt(null,"title")),{exportOrder:1}),type:$e("type")},namespace:Qt,optionalNamespaces:{xdv:Tn},path:"dataform"},{aliases:[{path:"dataform.fields",multiple:!0},{path:"dataform.items.fields",multiple:!0}],element:"field",fields:{description:pt(null,"desc"),label:$e("label"),name:$e("var"),rawValues:Object.assign(Object.assign({},kt(null,"value")),{exporter:()=>null}),required:yt(null,"required"),type:$e("type"),value:{importer(e,t){const n=e.getAttribute("type"),i=kt(Qt,"value").importer(e,t),r=i[0];switch(n){case zr.TextMultiple:case zr.ListMultiple:case zr.JIDMultiple:return i;case zr.Hidden:case zr.Fixed:return 1===i.length?r:i;case zr.Boolean:if(r)return"1"===r||"true"===r;break;default:return r}},exporter(e,t,n){const i=kt(null,"value");let r=[];const s=n.data&&n.data.rawValues?n.data.rawValues[0]:void 0;if("boolean"==typeof t)r="true"===s||"false"===s?[s]:[t?"1":"0"];else if(Array.isArray(t))for(const e of t)r.push(e.toString());else r=[t.toString()];i.exporter(e,r,Object.assign({},n,{namespace:Qt}))}}},namespace:Qt,path:"dataformField"},{aliases:[{path:"dataform.fields.options",multiple:!0}],element:"option",fields:{label:$e("label"),value:pt(null,"value")},namespace:Qt},{aliases:[{path:"dataform.items",multiple:!0}],element:"item",namespace:Qt},{element:"validate",fields:{listMax:st(null,"list-range","max"),listMin:st(null,"list-range","min"),method:xt(null,["basic","open","range","regex"],"basic"),rangeMax:it(null,"range","max"),rangeMin:it(null,"range","min"),regex:pt(null,"regex"),type:$e("datatype","xs:string")},namespace:Tn,path:"dataform.fields.validation"}],go=[{aliases:["presence.legacyLastActivity","iq.lastActivity"],element:"query",fields:{seconds:Qe("seconds"),status:ct()},namespace:"jabber:iq:last"}],vo=[{element:"query",fields:{activeList:it(null,"active","name"),defaultList:it(null,"default","name")},namespace:Kt,path:"iq.privacy"},{aliases:[{path:"iq.privacy.lists",multiple:!0}],element:"list",fields:{name:$e("name")},namespace:Kt},{aliases:[{path:"iq.privacy.lists.items",multiple:!0}],element:"item",fields:{action:$e("action"),incomingPresence:yt(null,"presence-in"),iq:yt(null,"iq"),messages:yt(null,"message"),order:Qe("order"),outgoingPresence:yt(null,"presence-out"),type:$e("type"),value:$e("value")},namespace:Kt}],bo=[{aliases:["iq.disco","message.disco","features.disco"],childrenExportOrder:{identities:1,features:2,extensions:3},element:"query",fields:{features:Et(null,"feature","var"),node:$e("node")},namespace:Xt,path:"disco",type:"info",typeField:"type"},{aliases:[{path:"disco.identities",selector:"info",multiple:!0}],element:"identity",fields:{category:$e("category"),lang:dt(),name:$e("name"),type:$e("type")},namespace:Xt},{aliases:[{path:"disco.items",multiple:!0,selector:"items"}],element:"item",fields:{jid:oi("jid"),name:$e("name"),node:$e("node")},namespace:Yt},{aliases:[{path:"disco.items",multiple:!0,selector:"info"}],element:"item",fields:{category:oi("category"),lang:dt(),name:$e("name"),type:$e("type")},namespace:Xt},li(Qt,"x",[{path:"disco.extensions",multiple:!0,selector:"info"}]),li(an,"set",[{path:"disco.paging",selector:"items"}]),{aliases:["iq.disco","message.disco","features.disco"],element:"query",fields:{node:$e("node")},namespace:Yt,path:"disco",type:"items",typeField:"type"}],yo=[ui({addresses:Rt(Zt,"addresses","extendedAddress",!0)}),di({addresses:Rt(Zt,"addresses","extendedAddress",!0)}),{element:"address",fields:{alternateLanguageDescriptions:Nt(null,"desc"),delivered:We("delivered"),description:$e("desc"),jid:oi("jid"),node:$e("node"),type:$e("type"),uri:$e("uri")},namespace:Zt,path:"extendedAddress"}],_o=[li(Qt,"x",[{path:"iq.muc.form",selector:"configure"}]),{defaultType:"info",element:"x",fields:{password:pt(null,"password")},namespace:en,path:"presence.muc",type:"join",typeField:"type"},{aliases:[{path:"presence.muc.history",selector:"join"}],element:"history",fields:{maxCharacters:Qe("maxchars"),maxStanzas:Qe("maxstanzas"),seconds:Qe("seconds"),since:Xe("since")},namespace:en},{aliases:["presence.muc","message.muc"],defaultType:"info",element:"x",fields:{action:xt(null,["invite","decline","destroy"]),actor:Rt(null,"item","mucactor"),affiliation:it(null,"item","affiliation"),jid:ai(null,"item","jid"),nick:it(null,"item","nick"),password:pt(null,"password"),reason:St([{namespace:null,element:"item"},{namespace:null,element:"reason"}]),role:it(null,"item","role"),statusCodes:Et(null,"status","code")},namespace:rn,type:"info",typeField:"type",typeOrder:1},{element:"actor",fields:{jid:oi("jid"),nick:$e("nick")},namespace:rn,path:"mucactor"},{element:"destroy",fields:{jid:oi("jid"),password:pt(null,"password"),reason:pt(null,"reason")},namespace:rn,path:"presence.muc.destroy"},{aliases:[{path:"message.muc.invite",multiple:!0}],element:"invite",fields:{continue:yt(null,"continue"),from:oi("from"),reason:pt(null,"reason"),thread:it(null,"continue","thread"),to:oi("to")},namespace:rn},{element:"decline",fields:{from:oi("from"),reason:pt(null,"reason"),to:oi("to")},namespace:rn,path:"message.muc",type:"decline"},{element:"query",namespace:tn,path:"iq.muc",type:"user-list",typeField:"type"},{aliases:[{path:"iq.muc.users",multiple:!0,selector:"user-list"}],element:"item",fields:{affiliation:$e("affiliation"),jid:oi("jid"),nick:$e("nick"),reason:pt(null,"reason"),role:$e("role")},namespace:tn},{aliases:["iq.muc.users.actor"],element:"actor",fields:{jid:oi("jid"),nick:$e("nick")},namespace:tn},{element:"query",namespace:nn,path:"iq.muc",type:"configure",typeField:"type"},{aliases:[{path:"iq.muc.destroy",selector:"configure"}],element:"destroy",fields:{jid:oi("jid"),password:pt(null,"password"),reason:pt(null,"reason")},namespace:nn},{element:"x",fields:{action:At("invite"),continue:We("continue"),jid:oi("jid"),legacyReason:ct(),password:$e("password"),reason:$e("reason"),thread:$e("thread")},namespace:"jabber:x:conference",path:"message.muc",type:"direct-invite",typeOrder:2},{element:"unique",fields:{name:ct()},namespace:"http://jabber.org/protocol/muc#unique",path:"iq.muc",type:"unique"},ui({legacyMUC:{exporter(e,t,n){const i=n.registry?n.registry.export("message.muc",Object.assign(Object.assign({},t),{type:"direct-invite"})):void 0;i&&e.appendChild(i)},exportOrder:100001,importer(e,t){if(!Ne(e,rn,"x")[0])return;const n=Ne(e,"jabber:x:conference","x")[0];return n&&t.registry?t.registry.import(n,Object.assign(Object.assign({},t),{path:"message"})):void 0},importOrder:-1}})],So=[{aliases:["iq.ibb","message.ibb"],element:"open",fields:{ack:{importer:(e,t)=>"message"!==$e("stanza","iq").importer(e,t),exporter(e,t,n){$e("stanza").exporter(e,t?"iq":"message",n)}},blockSize:Qe("block-size"),sid:$e("sid")},namespace:sn,type:"open",typeField:"action"},{aliases:["iq.ibb","message.ibb"],element:"close",fields:{sid:$e("sid")},namespace:sn,type:"close",typeField:"action"},{aliases:["iq.ibb","message.ibb"],element:"data",fields:{data:ut("base64"),seq:Qe("seq"),sid:$e("sid")},namespace:sn,type:"data",typeField:"action"}],wo=[{aliases:[{path:"bookmarkStorage",impliedType:!0},{path:"iq.privateStorage.bookmarks",impliedType:!0},{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"storage",namespace:"storage:bookmarks",type:"storage:bookmarks",typeField:"itemType"},{aliases:[{path:"bookmarkStorage.rooms",multiple:!0}],element:"conference",fields:{autoJoin:We("autojoin"),jid:oi("jid"),name:$e("name"),nick:pt(null,"nick"),password:pt(null,"password")},namespace:"storage:bookmarks"}],To={element:"query",namespace:"jabber:iq:private",path:"iq.privateStorage"},Io=[li(Qt,"x",["iq.command.form"]),fi({commandError:xt(on,["bad-action","bad-locale","bad-payload","bad-sessionid","malformed-action","session-expired"])}),{element:"command",fields:{action:$e("action"),node:$e("node"),sid:$e("sessionid"),status:$e("status")},namespace:on,path:"iq.command"},{element:"actions",fields:{complete:yt(null,"complete"),execute:$e("execute"),next:yt(null,"next"),prev:yt(null,"prev")},namespace:on,path:"iq.command.availableActions"},{aliases:[{path:"iq.command.notes",multiple:!0}],element:"note",fields:{type:$e("type"),value:ct()},namespace:on}],xo="vcardTemp.records";function jo(e,t){return{aliases:[{multiple:!0,path:xo}],element:e,fields:{value:ct()},namespace:"vcard-temp",type:t,typeField:"type"}}const ko=[{aliases:[{path:"iq.vcard"}],defaultType:"vcard-temp",element:"vCard",fields:{fullName:pt(null,"FN")},namespace:"vcard-temp",path:"vcardTemp",type:"vcard-temp",typeField:"format"},{element:"N",fields:{additional:Object.assign(Object.assign({},pt(null,"MIDDLE")),{order:3}),family:Object.assign(Object.assign({},pt(null,"FAMILY")),{order:1}),given:Object.assign(Object.assign({},pt(null,"GIVEN")),{order:2}),prefix:Object.assign(Object.assign({},pt(null,"PREFIX")),{order:4}),suffix:Object.assign(Object.assign({},pt(null,"SUFFIX")),{order:5})},namespace:"vcard-temp",path:"vcardTemp.name"},jo("NICKNAME","nickname"),jo("BDAY","birthday"),jo("JABBERID","jid"),jo("TZ","timezone"),jo("TITLE","title"),jo("ROLE","role"),jo("URL","url"),jo("NOTE","note"),jo("SORT-STRING","sort"),jo("UID","uid"),jo("REV","revision"),jo("PRODID","productId"),jo("DESC","description"),{aliases:[{multiple:!0,path:xo}],element:"EMAIL",fields:{preferred:yt(null,"PREF"),types:Ot(null,[["home","HOME"],["work","WORK"],["internet","INTERNET"]]),value:pt(null,"USERID")},namespace:"vcard-temp",type:"email"},{aliases:[{path:xo,multiple:!0}],element:"ORG",fields:{units:Object.assign(Object.assign({},kt(null,"ORGUNIT")),{order:2}),value:Object.assign(Object.assign({},pt(null,"ORGNAME")),{order:1})},namespace:"vcard-temp",type:"organization",typeField:"type"},{aliases:[{multiple:!0,path:xo}],element:"ADR",fields:{city:pt(null,"LOCALITY"),code:pt(null,"PCODE"),country:pt(null,"CTRY"),pobox:pt(null,"POBOX"),preferred:yt(null,"PREF"),region:pt(null,"REGION"),street:pt(null,"STREET"),street2:pt(null,"EXTADD"),types:Ot(null,[["home","HOME"],["work","WORK"],["domestic","DOM"],["international","INTL"],["postal","POSTAL"],["parcel","PARCEL"]])},namespace:"vcard-temp",type:"address",typeField:"type"},{aliases:[{multiple:!0,path:xo}],element:"LABEL",fields:{lines:kt(null,"LINE"),preferred:yt(null,"PREF"),types:Ot(null,[["home","HOME"],["work","WORK"]])},namespace:"vcard-temp",type:"addressLabel",typeField:"type"},{aliases:[{multiple:!0,path:xo}],element:"TEL",fields:{preferred:yt(null,"PREF"),types:Ot(null,[["home","HOME"],["work","WORK"],["cell","CELL"],["fax","FAX"],["voice","VOICE"],["msg","MSG"]]),value:pt(null,"NUMBER","",!0)},namespace:"vcard-temp",type:"tel",typeField:"type"},{aliases:[{multiple:!0,path:xo}],element:"PHOTO",fields:{data:pt(null,"BINVAL"),mediaType:pt(null,"TYPE"),url:pt(null,"EXTVAL")},namespace:"vcard-temp",type:"photo",typeField:"type"},{aliases:[{multiple:!0,path:xo}],element:"LOGO",fields:{data:pt(null,"BINVAL"),mediaType:pt(null,"TYPE"),url:pt(null,"EXTVAL")},namespace:"vcard-temp",type:"logo",typeField:"type"},{aliases:[{multiple:!0,path:xo}],element:"CATEGORIES",fields:{value:kt(null,"KEYWORD")},namespace:"vcard-temp",type:"categories",typeField:"type"}],Eo=[li(Qt,"x",["iq.search.form"]),li(an,"set",["iq.search.paging"]),{element:"query",fields:{email:pt(null,"email"),familyName:pt(null,"last"),givenName:pt(null,"first"),instructions:pt(null,"instructions"),nick:pt(null,"nick")},namespace:"jabber:iq:search",path:"iq.search"},{aliases:[{path:"iq.search.items",multiple:!0}],element:"item",fields:{email:pt(null,"email"),familyName:pt(null,"last"),givenName:pt(null,"first"),jid:oi("jid"),nick:pt(null,"nick")},namespace:"jabber:iq:search"}],Co={aliases:["iq.pubsub.paging"],element:"set",fields:{after:pt(null,"after"),before:pt(null,"before"),count:mt(null,"count"),first:pt(null,"first"),firstIndex:st(null,"first","index"),index:mt(null,"index"),last:pt(null,"last"),max:mt(null,"max")},namespace:an,path:"paging"},No={configurable:yt(null,"subscribe-options"),configurationRequired:Tt([{namespace:null,element:"subscribe-options"},{namespace:null,element:"required"}]),jid:oi("jid"),node:$e("node"),state:$e("subscription"),subid:$e("subid")},Oo={node:$e("node")},Ro=[{aliases:["pubsub","iq.pubsub","message.pubsub"],childrenExportOrder:{configure:0,create:100,publish:100,subscribe:100,subscriptionOptions:0},defaultType:"user",element:"pubsub",fields:{publishOptions:Rt(null,"publish-options","dataform")},namespace:cn,type:"user",typeField:"context"},{aliases:["pubsub","iq.pubsub","message.pubsub"],defaultType:"user",element:"pubsub",fields:{purge:it(null,"purge","node")},namespace:dn,type:"owner",typeField:"context"},li(Qt,"x",["iq.pubsub.configure.form","iq.pubsub.defaultConfiguration.form","iq.pubsub.defaultSubscriptionOptions.form","iq.pubsub.subscriptionOptions.form","message.pubsub.configuration.form"]),li(an,"set",["iq.pubsub.fetch.paging"]),fi({pubsubError:xt(ln,Object.values(Gr)),pubsubUnsupportedFeature:it(ln,"unsupported","feature")}),{element:"subscribe",fields:{jid:oi("jid"),node:$e("node")},namespace:cn,path:"iq.pubsub.subscribe"},{element:"unsubscribe",fields:{jid:oi("jid"),node:$e("node"),subid:$e("subid")},namespace:cn,path:"iq.pubsub.unsubscribe"},{element:"options",fields:{jid:oi("jid"),node:$e("node"),subid:$e("subid")},namespace:cn,path:"iq.pubsub.subscriptionOptions"},{aliases:[{path:"iq.pubsub.subscriptions",selector:"user",impliedType:!0}],element:"subscriptions",fields:{jid:oi("jid"),node:$e("node")},namespace:cn,type:"user"},{aliases:[{path:"iq.pubsub.subscriptions",selector:"owner",impliedType:!0}],element:"subscriptions",fields:{jid:oi("jid"),node:$e("node")},namespace:dn,type:"owner"},{aliases:[{path:"iq.pubsub.subscription",selector:"owner"},{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"owner"}],element:"subscription",fields:No,namespace:cn},{aliases:[{path:"iq.pubsub.subscription",selector:"user"},{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"user"}],element:"subscription",fields:No,namespace:cn,type:"user"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"owner"}],element:"subscription",fields:No,namespace:dn,type:"owner"},{aliases:[{path:"iq.pubsub.affiliations",selector:"user",impliedType:!0},{path:"message.pubsub.affiliations",selector:"user",impliedType:!0}],element:"affiliations",fields:Oo,namespace:cn,type:"user"},{aliases:[{path:"iq.pubsub.affiliations",selector:"owner",impliedType:!0}],element:"affiliations",fields:Oo,namespace:dn,type:"owner"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.affiliations.items",selector:"user"},{impliedType:!0,multiple:!0,path:"message.pubsub.affiliations.items",selector:"user"}],element:"affiliation",fields:{affiliation:$e("affiliation"),jid:oi("jid"),node:$e("node")},namespace:cn,type:"user"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.affiliations.items",selector:"owner"}],element:"affiliation",fields:{affiliation:$e("affiliation"),jid:oi("jid"),node:$e("node")},namespace:dn,type:"owner"},{element:"create",fields:Oo,namespace:cn,path:"iq.pubsub.create"},{aliases:[{path:"iq.pubsub.destroy",selector:"owner"}],element:"delete",fields:{node:$e("node"),redirect:it(null,"redirect","uri")},namespace:dn},{aliases:[{path:"iq.pubsub.configure",selector:"owner",impliedType:!0}],element:"configure",fields:Oo,namespace:dn,type:"owner"},{aliases:[{path:"iq.pubsub.configure",selector:"user",impliedType:!0}],element:"configure",fields:Oo,namespace:cn,type:"user"},{element:"default",fields:{node:$e("node")},namespace:cn,path:"iq.pubsub.defaultSubscriptionOptions"},{element:"default",fields:{},namespace:dn,path:"iq.pubsub.defaultConfiguration"},{element:"publish",fields:Oo,namespace:cn,path:"iq.pubsub.publish"},{element:"retract",fields:{id:it(null,"item","id"),node:$e("node"),notify:We("notify")},namespace:cn,path:"iq.pubsub.retract"},{element:"items",fields:{max:Qe("max_items"),node:$e("node")},namespace:cn,path:"iq.pubsub.fetch"},{aliases:["pubsubitem","iq.pubsub.publish.item",{multiple:!0,path:"iq.pubsub.fetch.items"}],element:"item",fields:{id:$e("id"),publisher:oi("publisher")},namespace:cn},{element:"event",fields:{eventType:xt(null,["purge","delete","subscription","configuration","items"])},namespace:un,path:"message.pubsub",type:"event",typeField:"context"},{aliases:[{path:"message.pubsub.items.published",multiple:!0}],element:"item",fields:{id:$e("id"),publisher:oi("publisher")},namespace:un,path:"pubsubeventitem"},{element:"purge",fields:Oo,namespace:un,path:"message.pubsub.purge"},{element:"delete",fields:{node:$e("node"),redirect:it(null,"redirect","uri")},namespace:un,path:"message.pubsub.delete"},{aliases:[{path:"message.pubsub.subscription",selector:"event",impliedType:!0}],element:"subscription",fields:{expires:(Ao="expiry",{importer(e){const t=e.getAttribute(Ao);return"presence"===t?t:t?new Date(t):void 0},exporter(e,t){let n;n="string"==typeof t?t:t.toISOString(),e.setAttribute(Ao,n)}}),jid:oi("jid"),node:$e("node"),subid:$e("subid"),type:$e("subscription")},namespace:un,type:"event"},{element:"configuration",fields:Oo,namespace:un,path:"message.pubsub.configuration"},{element:"items",fields:{node:$e("node"),retracted:Et(null,"retract","id")},namespace:un,path:"message.pubsub.items"}];var Ao;const Po=[{element:"query",fields:{activate:pt(null,"activate"),address:$e("dstaddr"),candidateUsed:ai(null,"streamhost-used","jid"),mode:$e("mode","tcp"),sid:$e("sid"),udpSuccess:it(null,"udpsuccess","dstaddr")},namespace:pn,path:"iq.socks5"},{aliases:[{multiple:!0,path:"iq.socks5.candidates"}],element:"streamhost",fields:{host:$e("host"),jid:oi("jid"),port:Qe("port"),uri:$e("uri")},namespace:pn}],Lo=[{aliases:[{multiple:!0,path:"message.links"}],element:"x",fields:{description:pt(null,"desc"),url:pt(null,"url")},namespace:hn},{element:"query",fields:{description:pt(null,"desc"),url:pt(null,"url")},namespace:"jabber:iq:oob",path:"iq.transferLink"}],qo={element:"html",fields:{alternateLanguageBodies:Lt(fn,"body","xhtmlim"),body:Pt(fn,"body","xhtmlim")},namespace:mn,path:"message.html"},Fo=[hi({inbandRegistration:yt("http://jabber.org/features/iq-register","register")}),li(Qt,"x",["iq.account.form"]),li(hn,"x",["iq.account.registrationLink"]),{element:"query",fields:{address:pt(null,"address"),date:ft(null,"date"),email:pt(null,"email"),familyName:pt(null,"last"),fullName:pt(null,"name"),givenName:pt(null,"first"),instructions:pt(null,"instructions"),key:pt(null,"key"),locality:pt(null,"city"),misc:pt(null,"misc"),nick:pt(null,"nick"),password:pt(null,"password"),phone:pt(null,"phone"),postalCode:pt(null,"zip"),region:pt(null,"state"),registered:yt(null,"registered"),remove:yt(null,"remove"),text:pt(null,"text"),uri:pt(null,"uri"),username:pt(null,"username")},namespace:"jabber:iq:register",path:"iq.account"}],Mo={aliases:[{path:"message.geoloc",impliedType:!0},{path:"dataform.fields.geoloc",impliedType:!0},{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"geoloc",fields:{accuracy:gt(null,"accuracy"),altitude:gt(null,"alt"),altitudeAccuracy:gt(null,"altaccuracy"),area:pt(null,"area"),building:pt(null,"building"),country:pt(null,"country"),countryCode:pt(null,"countrycode"),datum:pt(null,"datum"),description:pt(null,"description"),error:gt(null,"error"),floor:pt(null,"floor"),heading:gt(null,"bearing"),lang:dt(),latitude:gt(null,"lat"),locality:pt(null,"locality"),longitude:gt(null,"lon"),postalCode:pt(null,"postalcode"),region:pt(null,"region"),room:pt(null,"room"),speed:gt(null,"speed"),street:pt(null,"street"),text:pt(null,"text"),timestamp:ft(null,"timestamp"),tzo:bt(null,"tzo"),uri:pt(null,"uri")},namespace:gn,type:gn},Do=[{aliases:[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"data",fields:{data:ut("base64")},namespace:vn,path:"avatar",type:vn,typeField:"itemType"},{aliases:[{path:"avatar",impliedType:!0},{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"metadata",namespace:bn,type:bn,typeField:"itemType",childrenExportOrder:{versions:1,pointers:2}},{aliases:[{multiple:!0,path:"avatar.versions",selector:bn}],element:"info",fields:{bytes:Qe("bytes"),height:Qe("height"),id:$e("id"),mediaType:$e("type"),uri:$e("url"),width:Qe("width")},namespace:bn},{aliases:[{multiple:!0,path:"avatar.pointers",selector:bn}],element:"pointer",fields:{bytes:Qe("bytes"),height:Qe("height"),id:$e("id"),mediaType:$e("type"),width:Qe("width")},namespace:bn}];var Bo=ui({chatState:xt(yn,Object.values(Vr))});const Uo={element:"query",fields:{name:pt(null,"name"),os:pt(null,"os"),version:pt(null,"version")},namespace:"jabber:iq:version",path:"iq.softwareVersion"},zo={aliases:[{path:"message.mood",impliedType:!0},{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"mood",fields:{alternateLanguageText:Nt(null,"text"),text:pt(null,"text"),value:xt(null,Yr)},namespace:_n,type:_n},Jo={aliases:[{path:"activity",impliedType:!0},{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"activity",fields:{activity:jt(null,Zr,es),alternateLanguageText:Nt(null,"text"),text:pt(null,"text")},namespace:Sn,type:Sn},Go={element:"handshake",fields:{value:ut("hex")},namespace:"jabber:component:accept",path:"handshake"},Vo={aliases:[{path:"presence.legacyCapabilities",multiple:!0},{path:"features.legacyCapabilities",multiple:!0}],element:"c",fields:{algorithm:$e("hash"),legacy:At(!0),node:$e("node"),value:$e("ver")},namespace:"http://jabber.org/protocol/caps"},Ho={aliases:[{impliedType:!0,path:"tune"},{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"tune",fields:{artist:pt(null,"artist"),length:mt(null,"length"),rating:mt(null,"rating"),source:pt(null,"source"),title:pt(null,"title"),track:pt(null,"track"),uri:pt(null,"uri")},namespace:wn,type:wn},$o=["dataformLayout",{multiple:!0,path:"dataformLayout.contents"},{multiple:!0,path:"dataform.layout.contents"}],Wo=[{aliases:[{multiple:!0,path:"dataform.layout"}],element:"page",fields:{label:$e("label")},namespace:kn},{aliases:$o,element:"section",fields:{label:$e("label")},namespace:kn,type:"section",typeField:"type"},{aliases:$o,element:"text",fields:{value:ct()},namespace:kn,type:"text",typeField:"type"},{aliases:$o,element:"fieldref",fields:{field:$e("var")},namespace:kn,type:"fieldref",typeField:"type"},{aliases:$o,element:"reportedref",namespace:kn,type:"reportedref",typeField:"type"}],Qo={element:"body",fields:{acceptMediaTypes:$e("accept"),ack:Qe("ack"),authId:$e("authid"),characterSets:$e("charsets"),condition:$e("condition"),from:oi("from"),key:$e("key"),lang:dt(),maxClientRequests:Qe("requests"),maxHoldOpen:Qe("hold"),maxInactivityTime:Qe("inactivity"),maxSessionPause:Qe("maxpause"),maxWaitTime:Qe("wait"),mediaType:$e("content"),minPollingInterval:Qe("polling"),newKey:$e("newkey"),pauseSession:Qe("pause"),report:Qe("report"),rid:Qe("rid"),route:$e("string"),seeOtherURI:pt(null,"uri"),sid:$e("sid"),stream:$e("stream"),time:Qe("time"),to:oi("to"),type:$e("type"),version:$e("ver"),xmppRestart:Ze("xmpp","urn:xmpp:xbosh","restart",void 0,{writeValue:e=>e?"true":"false"}),xmppRestartLogic:Ze("xmpp","urn:xmpp:xbosh","restartlogic",void 0,{writeValue:e=>e?"true":"false"}),xmppVersion:Ye("xmpp","urn:xmpp:xbosh","version")},namespace:In,path:"bosh"},Ko=[ui({headers:Rt(xn,"headers","header",!0)}),di({headers:Rt(xn,"headers","header",!0)}),{element:"header",fields:{name:$e("name"),value:ct()},namespace:xn,path:"header"}],Xo=[{element:"compression",fields:{methods:kt(null,"method")},namespace:"http://jabber.org/features/compress",path:"features.compression"},{element:"compress",fields:{method:pt(null,"method")},namespace:jn,path:"compression",type:"start",typeField:"type"},{aliases:["error.compressionError"],element:"failure",fields:{condition:xt(null,["unsupported-method","setup-failed","processing-failed"])},namespace:jn,path:"compression",type:"failure",typeField:"type"},{element:"compressed",namespace:jn,path:"compression",type:"success",typeField:"type"}],Yo=[ui({rosterExchange:Rt(En,"x","rosterExchange",!0)}),pi({rosterExchange:Rt(En,"x","rosterExchange",!0)}),{element:"item",fields:{action:$e("action"),groups:kt(null,"group"),jid:oi("jid"),name:$e("name")},namespace:En,path:"rosterExchange"}];var Zo=di({vcardAvatar:{importer(e){const t=Ne(e,"vcard-temp:x:update","x");if(!t.length)return;const n=Ne(t[0],"vcard-temp:x:update","photo");return!n.length||n[0].getText()},exporter(e,t){const n=Oe(e,"vcard-temp:x:update","x");if(""===t)Oe(n,"vcard-temp:x:update","photo");else{if(!0===t)return;if(t){Oe(n,"vcard-temp:x:update","photo").children.push(t)}}}}});const ea=[ui({captcha:Rt("urn:xmpp:captcha","captcha","dataform")}),pi({captcha:Rt("urn:xmpp:captcha","captcha","dataform")})],ta=[fi({jingleError:xt("urn:xmpp:jingle:errors:1",Object.values(Kr))}),{element:"jingle",fields:{action:$e("action"),initiator:oi("initiator"),responder:oi("responder"),sid:$e("sid")},namespace:Nn,path:"iq.jingle"},{aliases:[{multiple:!0,path:"iq.jingle.contents"}],element:"content",fields:{creator:$e("creator"),disposition:$e("disposition","session"),name:$e("name"),senders:$e("senders","both")},namespace:Nn},{element:"reason",fields:{alternativeSession:pt(null,"alternative-session"),condition:xt(null,Object.values(Xr)),text:pt(null,"text")},namespace:Nn,path:"iq.jingle.reason"}];function na(){return{importer(e,t){let n=Ne(e,Gn,"rtcp-fb");const i=$e("type").importer,r=$e("subtype").importer,s=$e("value").importer,o=[];for(const e of n){const n=i(e,t),s=r(e,t);o.push(s?{type:n,parameter:s}:{type:n})}n=Ne(e,Gn,"rtcp-fb-trr-int");for(const e of n){const n=s(e,t);o.push(n?{type:"trr-int",parameter:n}:{type:"trr-int"})}return o},exporter(e,t,n){const i=$e("type").exporter,r=$e("subtype").exporter,s=$e("value").exporter;for(const o of t){let t;"trr-int"===o.type?(t=ke(Gn,"rtcp-fb-trr-int",n.namespace,e),o.parameter&&s(t,o.parameter,n)):(t=ke(Gn,"rtcp-fb",n.namespace,e),i(t,o.type,n),o.parameter&&r(t,o.parameter,n)),e.appendChild(t)}}}}const ia="iq.jingle.info",ra=[{aliases:["iq.jingle.contents.application"],childrenExportOrder:{codecs:4,encryption:5,headerExtensions:6,sourceGroups:8,sources:7,streams:9},element:"description",fields:{media:$e("media"),rtcpFeedback:Object.assign(Object.assign({},na()),{exportOrder:3}),rtcpMux:Object.assign(Object.assign({},yt(null,"rtcp-mux")),{exportOrder:1}),rtcpReducedSize:Object.assign(Object.assign({},yt(null,"rtcp-reduced-size")),{exportOrder:2}),ssrc:$e("ssrc")},namespace:On,optionalNamespaces:{rtcpf:Gn,rtph:Vn},type:On},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.headerExtensions",selector:On}],element:"rtp-hdrext",fields:{id:Qe("id"),senders:$e("senders"),uri:$e("uri")},namespace:Vn},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.codecs",selector:On},"rtpcodec"],element:"payload-type",fields:{channels:Qe("channels"),clockRate:Qe("clockrate"),id:$e("id"),maxptime:Qe("maxptime"),name:$e("name"),parameters:qt(On,"parameter","name","value"),ptime:Qe("ptime"),rtcpFeedback:na()},namespace:On},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.sources",selector:On}],element:"source",fields:{parameters:qt("urn:xmpp:jingle:apps:rtp:ssma:0","parameter","name","value"),ssrc:$e("ssrc")},namespace:"urn:xmpp:jingle:apps:rtp:ssma:0"},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.sourceGroups",selector:On}],element:"ssrc-group",fields:{semantics:$e("semantics"),sources:Et(null,"source","ssrc")},namespace:"urn:xmpp:jingle:apps:rtp:ssma:0"},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.streams",selector:On}],element:"stream",fields:{id:$e("id"),track:$e("track")},namespace:"urn:xmpp:jingle:apps:rtp:msid:0"},{aliases:[{path:"iq.jingle.contents.application.encryption",selector:On}],element:"encryption",fields:{required:We("required")},namespace:On},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.encryption.sdes",selector:On}],element:"crypto",fields:{cryptoSuite:$e("crypto-suite"),keyParameters:$e("key-params"),sessionParameters:$e("session-params"),tag:Qe("tag")},namespace:On},{aliases:[{path:"iq.jingle.contents.application.encryption.zrtp",selector:On}],element:"zrtp-hash",fields:{value:ut("hex"),version:$e("version")},namespace:On},{element:"mute",fields:{creator:$e("creator"),name:$e("name")},namespace:Rn,path:ia,type:ns},{element:"unmute",fields:{creator:$e("creator"),name:$e("name")},namespace:Rn,path:ia,type:is},{element:"hold",namespace:Rn,path:ia,type:rs},{element:"unhold",namespace:Rn,path:ia,type:ss},{element:"active",namespace:Rn,path:ia,type:os},{element:"ringing",namespace:Rn,path:ia,type:as}],sa=[ui({nick:pt(An,"nick")}),di({nick:pt(An,"nick")}),{aliases:[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"nick",fields:{nick:ct()},namespace:An,type:An}],oa=e=>[{element:"transport",fields:{gatheringComplete:yt(null,"gathering-complete"),password:$e("pwd"),usernameFragment:$e("ufrag")},namespace:e,path:"iq.jingle.contents.transport",type:e,typeField:"transportType"},{aliases:[{impliedType:!0,path:"iq.jingle.contents.transport.remoteCandidate",selector:e}],element:"remote-candidate",fields:{component:Qe("component"),ip:$e("ip"),port:Qe("port")},namespace:e,type:e,typeField:"transportType"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:e}],element:"candidate",fields:{component:Qe("component"),foundation:$e("foundation"),generation:Qe("generation"),id:$e("id"),ip:$e("ip"),network:Qe("network"),port:Qe("port"),priority:Qe("priority"),protocol:$e("protocol"),relatedAddress:$e("rel-addr"),relatedPort:$e("rel-port"),tcpType:$e("tcptype"),type:$e("type")},namespace:e,type:e,typeField:"transportType"}],aa=[...oa(ni),...oa(Pn)],ca=[{element:"transport",fields:{gatheringComplete:yt(null,"gathering-complete"),password:$e("pwd"),usernameFragment:$e("ufrag")},namespace:Ln,path:"iq.jingle.contents.transport",type:Ln,typeField:"transportType"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:Ln}],element:"candidate",fields:{component:Qe("component"),foundation:$e("foundation"),generation:Qe("generation"),id:$e("id"),ip:$e("ip"),port:Qe("port"),type:$e("type")},namespace:Ln,type:Ln,typeField:"transportType"}],la=[{element:"request",namespace:"urn:xmpp:receipts",path:"message.receipt",type:"request",typeField:"type"},{element:"received",fields:{id:$e("id")},namespace:"urn:xmpp:receipts",path:"message.receipt",type:"received",typeField:"type"}],ua=[{element:"invisible",fields:{probe:We("probe")},namespace:"urn:xmpp:invisible:0",path:"iq.visibility",type:"invisible",typeField:"type"},{element:"visible",namespace:"urn:xmpp:invisible:0",path:"iq.visibility",type:"visible"}],da=[fi({blocked:yt("urn:xmpp:blocking:errors","blocked")}),{element:"blocklist",fields:{jids:Et(null,"item","jid")},namespace:"urn:xmpp:blocking",path:"iq.blockList",type:"list",typeField:"action"},{element:"block",fields:{jids:Et(null,"item","jid")},namespace:"urn:xmpp:blocking",path:"iq.blockList",type:"block",typeField:"action"},{element:"unblock",fields:{jids:Et(null,"item","jid")},namespace:"urn:xmpp:blocking",path:"iq.blockList",type:"unblock",typeField:"action"}],pa=[hi({streamManagement:yt(qn,"sm")}),{element:"a",fields:{handled:Qe("h")},namespace:qn,path:"sm",type:"ack",typeField:"type"},{element:"r",namespace:qn,path:"sm",type:"request",typeField:"type"},{element:"enable",fields:{allowResumption:We("resume")},namespace:qn,path:"sm",type:"enable",typeField:"type"},{element:"enabled",fields:{id:$e("id"),resume:We("resume")},namespace:qn,path:"sm",type:"enabled",typeField:"type"},{element:"resume",fields:{handled:Qe("h"),previousSession:$e("previd")},namespace:qn,path:"sm",type:"resume",typeField:"type"},{element:"resumed",fields:{handled:Qe("h"),previousSession:$e("previd")},namespace:qn,path:"sm",type:"resumed",typeField:"type"},{element:"failed",fields:{handled:Qe("h")},namespace:qn,path:"sm",type:"failed",typeField:"type"}];var ha=pi({ping:yt("urn:xmpp:ping","ping")});const fa={element:"time",fields:{tzo:bt(null,"tzo"),utc:ft(null,"utc")},namespace:"urn:xmpp:time",path:"iq.time"},ma={aliases:["message.delay","presence.delay"],element:"delay",fields:{from:oi("from"),reason:ct(),timestamp:Xe("stamp")},namespace:Fn},ga={2:"urn:xmpp:extdisco:2",1:"urn:xmpp:extdisco:1"},va=[];for(const[e,t]of Object.entries(ga))va.push({aliases:["iq.externalServiceCredentials"],defaultType:"2",element:"credentials",fields:{expires:at(null,"service","expires"),host:it(null,"service","host"),name:it(null,"service","name"),password:it(null,"service","password"),port:st(null,"service","port"),restricted:rt(null,"service","restricted"),transport:it(null,"service","transport"),type:it(null,"service","type"),username:it(null,"service","username")},namespace:t,type:e,typeField:"version"},{aliases:["iq.externalServices"],defaultType:"2",element:"services",fields:{type:$e("type")},namespace:t,type:e,typeField:"version"},{aliases:[{path:"iq.externalServices.services",multiple:!0}],defaultType:"2",element:"service",fields:{expires:Xe("expires"),host:$e("host"),name:$e("name"),password:$e("password"),port:Qe("port"),restricted:We("restricted"),transport:$e("transport"),type:$e("type"),username:$e("username")},namespace:t,type:e,typeField:"version"});const ba=[{element:"media",fields:{height:Qe("height"),width:Qe("width")},namespace:"urn:xmpp:media-element",path:"dataform.fields.media"},{aliases:[{multiple:!0,path:"dataform.fields.media.sources"}],element:"uri",fields:{mediaType:$e("type"),uri:ct()},namespace:"urn:xmpp:media-element"}];var ya=ui({requestingAttention:yt("urn:xmpp:attention:0","attention")});const _a={aliases:["iq.bits",{path:"message.bits",multiple:!0},{path:"presence.bits",multiple:!0},{path:"iq.jingle.bits",multiple:!0}],element:"data",fields:{cid:$e("cid"),data:ut("base64"),maxAge:Qe("max-age"),mediaType:$e("type")},namespace:Mn};let Sa=[li($n,"hash",[{path:"file.hashes",multiple:!0},{path:"file.range.hashes",multiple:!0}]),li("urn:xmpp:hashes:1","hash",[{path:"file.hashes",multiple:!0},{path:"file.range.hashes",multiple:!0}]),li($n,"hash-used",[{path:"file.hashesUsed",multiple:!0}]),li("urn:xmpp:thumbs:1","thumbnail",[{path:"file.thumbnails",multiple:!0}])];for(const e of["urn:xmpp:jingle:apps:file-transfer:4",Dn])Sa=Sa.concat([{aliases:["file",{impliedType:!0,path:"iq.jingle.contents.application.file",selector:e},{impliedType:!0,path:"iq.jingle.info.file",selector:`{${e}}checksum`}],defaultType:Dn,element:"file",fields:{date:ft(null,"date"),description:pt(null,"desc"),mediaType:pt(null,"media-type"),name:pt(null,"name"),size:mt(null,"size")},namespace:e,type:e,typeField:"version"},{aliases:[{impliedType:!0,path:"file.range",selector:e}],defaultType:Dn,element:"range",fields:{length:Qe("length"),offset:Qe("offset",0)},namespace:e,type:e,typeField:"version"},{element:"description",namespace:e,path:"iq.jingle.contents.application",type:e,typeField:"applicationType"},{element:"received",fields:{creator:$e("creator"),name:$e("name")},namespace:e,path:"iq.jingle.info",type:`{${e}}received`,typeField:"infoType"},{element:"checksum",fields:{creator:$e("creator"),name:$e("name")},namespace:e,path:"iq.jingle.info",type:`{${e}}checksum`,typeField:"infoType"}]);var wa=Sa;const Ta={element:"description",namespace:Bn,path:"iq.jingle.contents.application",type:Bn,typeField:"applicationType"},Ia=[{element:"transport",fields:{activated:it(null,"activated","cid"),address:$e("dstaddr"),candidateError:yt(null,"candidate-error"),candidateUsed:it(null,"candidate-used","cid"),mode:$e("mode","tcp"),proxyError:yt(null,"proxy-error"),sid:$e("sid")},namespace:Un,path:"iq.jingle.contents.transport",type:Un,typeField:"transportType"},{aliases:[{multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:Un}],element:"candidate",fields:{cid:$e("cid"),host:$e("host"),jid:oi("jid"),port:Qe("port"),priority:Qe("priority"),type:$e("type"),uri:$e("uri")},namespace:Un}],xa={element:"transport",fields:{ack:{importer:(e,t)=>"message"!==$e("stanza","iq").importer(e,t),exporter(e,t,n){!1===t&&$e("stanza").exporter(e,"message",n)}},blockSize:Qe("block-size"),sid:$e("sid")},namespace:zn,path:"iq.jingle.contents.transport",type:zn,typeField:"transportType"},ja=[li(Mn,"data",[{path:"iq.jingle.bits",multiple:!0}]),{element:"thumbnail",fields:{height:Qe("height"),mediaType:$e("media-type"),uri:$e("uri"),width:Qe("width")},namespace:"urn:xmpp:thumbs:1",path:"thumbnail"}],ka=[li(Hn,"forwarded",["message.carbon.forward"]),{element:"enable",namespace:Jn,path:"iq.carbons",type:"enable",typeField:"action"},{element:"disable",namespace:Jn,path:"iq.carbons",type:"disable",typeField:"action"},{element:"sent",namespace:Jn,path:"message.carbon",type:"sent",typeField:"type"},{element:"received",namespace:Jn,path:"message.carbon",type:"received",typeField:"type"}],Ea=[...Object.values(Fr).map(e=>li(e,"message",["forward.message"])),...Object.values(Fr).map(e=>li(e,"presence",["forward.presence"])),...Object.values(Fr).map(e=>li(e,"iq",["forward.iq"])),li(Fn,"delay",["forward.delay"]),{aliases:["message.forward"],element:"forwarded",namespace:Hn,path:"forward"}],Ca=[{defaultType:"2",element:"hash",fields:{algorithm:$e("algo"),value:ut("base64"),version:At("2")},namespace:$n,path:"hash",type:"2",typeField:"version"},{element:"hash-used",fields:{algorithm:$e("algo"),version:At("2")},namespace:$n,path:"hashUsed"},{element:"hash",fields:{algorithm:$e("algo"),value:ut("hex"),version:At("1")},namespace:"urn:xmpp:hashes:1",path:"hash",type:"1",typeField:"version"}],Na=[{element:"rtt",fields:{event:$e("event","edit"),id:$e("id"),seq:Qe("seq")},namespace:Qn,path:"message.rtt"},{aliases:[{path:"message.rtt.actions",multiple:!0}],element:"t",fields:{position:Qe("p"),text:ct()},namespace:Qn,type:"insert",typeField:"type"},{aliases:[{path:"message.rtt.actions",multiple:!0}],element:"e",fields:{length:Qe("n",1),position:Qe("p")},namespace:Qn,type:"erase",typeField:"type"},{aliases:[{multiple:!0,path:"message.rtt.actions"}],element:"w",fields:{duration:Qe("n",0)},namespace:Qn,type:"wait",typeField:"type"}];var Oa=ui({replace:it("urn:xmpp:message-correct:0","replace","id")});const Ra={2:"urn:xmpp:mam:2",1:"urn:xmpp:mam:1"},Aa=[li(Qt,"x",["iq.archive.form"]),li(Hn,"forwarded",["message.archive.item"]),li(an,"set",["iq.archive.paging"])];for(const[e,t]of Object.entries(Ra))Aa.push({defaultType:"query",defaultVersion:"2",element:"query",fields:{node:$e("node"),queryId:$e("queryid")},namespace:t,path:"iq.archive",type:"query",typeField:"type",version:e,versionField:"version"},{element:"fin",fields:{complete:We("complete"),stable:We("stable")},namespace:t,path:"iq.archive",type:"result",version:e},{element:"prefs",fields:{default:$e("default"),always:It([{namespace:null,element:"always"},{namespace:null,element:"jid"}]),never:It([{namespace:null,element:"never"},{namespace:null,element:"jid"}])},namespace:t,path:"iq.archive",type:"preferences",version:e},{element:"result",defaultType:"2",fields:{id:$e("id"),queryId:$e("queryid")},namespace:t,path:"message.archive",type:e,typeField:"version"});const Pa="message.marker";const La=[to,no,po,ho,fo,mo,go,vo,bo,yo,_o,So,wo,To,Io,ko,Eo,Co,Ro,Po,Lo,qo,Fo,Mo,Do,Bo,Uo,zo,Jo,Go,Vo,Ho,Qo,Ko,Xo,Wo,Yo,Zo,ea,ta,ra,sa,aa,ca,la,ua,da,pa,ha,fa,ma,va,ba,ya,_a,wa,Ta,Ia,xa,ja,ka,Ea,Ca,Na,Oa,Aa,[di({hats:Rt(Kn,"hats","hat",!0)}),{element:"hat",fields:{id:$e("name"),name:$e("displayName")},namespace:Kn,path:"hat"}],di({idleSince:ft("urn:xmpp:idle:1","since")}),{aliases:[{multiple:!0,path:"iq.jingle.contents.transport.fingerprints",selector:Pn},{multiple:!0,path:"iq.jingle.contents.transport.fingerprints",selector:ni},{multiple:!0,path:"iq.jingle.contents.application.encryption.dtls",selector:On}],element:"fingerprint",fields:{algorithm:$e("hash"),setup:$e("setup"),value:ct()},namespace:"urn:xmpp:jingle:apps:dtls:0"},[{element:"markable",namespace:Xn,path:Pa,type:"markable",typeField:"type"},{element:"received",fields:{id:$e("id")},namespace:Xn,path:Pa,type:"received"},{element:"displayed",fields:{id:$e("id")},namespace:Xn,path:Pa,type:"displayed"},{element:"acknowledged",fields:{id:$e("id")},namespace:Xn,path:Pa,type:"acknowledged"}],ui({processingHints:{importer(e){const t={};let n=!1;for(const i of e.children)if("string"!=typeof i&&i.getNamespace()===Yn)switch(i.getName()){case"no-copy":t.noCopy=!0,n=!0;break;case"no-permanent-store":t.noPermanentStore=!0,n=!0;break;case"no-store":t.noStore=!0,n=!0;break;case"store":t.store=!0,n=!0}return n?t:void 0},exporter(e,t,n){t.noCopy&&e.appendChild(ke(Yn,"no-copy",n.namespace,e)),t.noPermanentStore&&e.appendChild(ke(Yn,"no-permanent-store",n.namespace,e)),t.noStore&&e.appendChild(ke(Yn,"no-store",n.namespace,e)),t.store&&e.appendChild(ke(Yn,"store",n.namespace,e))}}}),[ui({json:vt(Zn,"json")}),{aliases:[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"json",fields:{json:lt()},namespace:Zn,type:Zn},{aliases:[{path:"message.jsonPayloads",multiple:!0}],element:"payload",fields:{type:$e("datatype"),data:vt(Zn,"json")},namespace:"urn:xmpp:json-msg:0"}],[{aliases:[{path:"iq.jingle.groups",multiple:!0}],element:"group",fields:{contents:Et(null,"content","name"),semantics:$e("semantics")},namespace:"urn:xmpp:jingle:apps:grouping:0"}],{aliases:[{path:"iq.jingle.contents.transport.sctp",selector:Pn},{path:"iq.jingle.contents.transport.sctp",selector:ni}],element:"sctpmap",fields:{port:Qe("number"),protocol:$e("protocol"),streams:$e("streams")},namespace:"urn:xmpp:jingle:transports:dtls-sctp:1"},[{element:"active",namespace:"urn:xmpp:csi:0",path:"csi",type:"active",typeField:"state"},{element:"inactive",namespace:"urn:xmpp:csi:0",path:"csi",type:"inactive",typeField:"state"}],[li(Qt,"x",["iq.push.form","pushNotification.form"]),{element:"enable",fields:{jid:oi("jid"),node:$e("node")},namespace:ei,path:"iq.push",type:"enable",typeField:"action"},{element:"disable",fields:{jid:oi("jid"),node:$e("node")},namespace:ei,path:"iq.push",type:"disable",typeField:"action"},{aliases:[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"notification",namespace:ei,path:"pushNotification",type:ei,typeField:"itemType"}],[ui({originId:it("urn:xmpp:sid:0","origin-id","id")}),{aliases:[{path:"message.stanzaIds",multiple:!0}],element:"stanza-id",fields:{by:oi("by"),id:$e("id")},namespace:"urn:xmpp:sid:0"}],[fi({httpUploadError:xt(ti,["file-too-large","retry"]),httpUploadMaxFileSize:wt([{namespace:ti,element:"file-too-large"},{namespace:ti,element:"max-file-size"}]),httpUploadRetry:at(ti,"retry","stamp")}),{element:"request",fields:{mediaType:$e("content-type"),name:$e("filename"),size:Qe("size")},namespace:ti,path:"iq.httpUpload",type:"request",typeField:"type"},{element:"slot",fields:{download:it(null,"get","url")},namespace:ti,path:"iq.httpUpload",type:"slot"},{aliases:[{path:"iq.httpUpload.upload",selector:"slot"}],element:"put",fields:{url:$e("url")},namespace:ti},{aliases:[{path:"iq.httpUpload.upload.headers",multiple:!0}],element:"header",fields:{name:$e("name"),value:ct()},namespace:ti}],{element:"encryption",fields:{id:$e("namespace"),name:$e("name")},namespace:"urn:xmpp:eme:0",path:"message.encryptionMethod"},[{aliases:["message.omemo"],element:"encrypted",fields:{payload:ht(null,"payload","base64")},namespace:ii,path:"omemo"},{element:"header",fields:{iv:ht(null,"iv","base64"),sid:Qe("sid")},namespace:ii,path:"omemo.header"},{aliases:[{path:"omemo.header.keys",multiple:!0}],element:"key",fields:{preKey:We("prekey"),rid:Qe("rid"),value:ut("base64")},namespace:ii},{aliases:[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"list",fields:{devices:Ct(null,"device","id")},namespace:ii,type:"eu.siacs.conversations.axolotl.devicelist",typeField:"itemType"},{element:"preKeyPublic",fields:{id:Qe("preKeyId"),value:ut("base64")},namespace:ii,path:"omemoPreKey"},{element:"signedPreKeyPublic",fields:{id:Qe("signedPreKeyId"),value:ut("base64")},namespace:ii,path:"omemoDevice.signedPreKeyPublic"},{aliases:[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}],element:"bundle",fields:{identityKey:ht(null,"identityKey","base64"),preKeys:Rt(null,"prekeys","omemoPreKey",!0),signedPreKeySignature:ht(null,"signedPreKeySignature","base64")},namespace:ii,path:"omemoDevice",type:"eu.siacs.conversations.axolotl.bundles",typeField:"itemType"}],[{element:"XRD",fields:{subject:pt(null,"Subject")},namespace:ri,path:"xrd"},{aliases:[{path:"xrd.links",multiple:!0}],element:"Link",fields:{href:$e("href"),rel:$e("rel"),type:$e("type")},namespace:ri}]];var qa=Object.freeze({__proto__:null,default:La});class Fa{constructor(e){this.active=!1,this.maxRetries=5,this.stream=e,this.maxTimeout=1100*this.stream.maxWaitTime}send(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.rid=e,this.active=!0;let n=0;for(;n<=this.maxRetries;){n+=1;try{const e=yield Tr(Zi(this.stream.url,{body:t,headers:{"Content-Type":this.stream.contentType},method:"POST"}),this.maxTimeout,()=>new Error("Request timed out"));if(!e.ok)throw new Error("HTTP Status Error: "+e.status);const n=yield e.text();return this.active=!1,n}catch(e){if(1===n)continue;if(n<this.maxRetries){const e=Math.min(this.maxTimeout,1e3*Math.pow(n,2));yield Ir(e+1e3*Math.random());continue}throw this.active=!1,e}}throw new Error("Request failed")}))}}class Ma extends l.Duplex{constructor(e,t,n){super({objectMode:!0}),this.rid=Math.floor(4294967295*Math.random()),this.sid="",this.maxHoldOpen=2,this.maxWaitTime=30,this.contentType="text/xml; charset=utf-8",this.channels=[new Fa(this),new Fa(this)],this.activeChannelID=0,this.queue=[],this.isEnded=!1,this.client=e,this.sm=t,this.stanzas=n,this.on("data",e=>{this.client.emit("stream:data",e.stanza,e.kind)}),this.on("end",()=>{this.isEnded=!0,clearTimeout(this.idleTimeout),this.client.transport===this&&this.client.emit("--transport-disconnected")})}_write(e,t,n){this.queue.push([e,n]),this.scheduleRequests()}_writev(e,t){this.queue.push([e.map(e=>e.chunk).join(""),t]),this.scheduleRequests()}_read(){}process(e){const t=new gi({acceptLanguages:this.config.acceptLanguages,allowComments:!1,lang:this.config.lang,registry:this.stanzas,rootKey:"bosh",wrappedStream:!0});t.on("error",e=>{const t={condition:Dr.InvalidXML};return this.client.emit("stream:error",t,e),this.send("error",t),this.disconnect()}),t.on("data",e=>{if("stream-start"===e.event)return this.stream=e.stanza,void("terminate"===e.stanza.type?(this.hasStream=!1,this.rid=void 0,this.sid=void 0,this.isEnded||(this.isEnded=!0,this.client.emit("bosh:terminate",e.stanza),this.client.emit("stream:end"),this.push(null))):this.hasStream||(this.hasStream=!0,this.stream=e.stanza,this.sid=e.stanza.sid||this.sid,this.maxWaitTime=e.stanza.maxWaitTime||this.maxWaitTime,this.client.emit("stream:start",e.stanza)));e.event||this.push({kind:e.kind,stanza:e.stanza})}),this.client.emit("raw","incoming",e),t.write(e),this.scheduleRequests()}connect(e){if(this.config=e,this.url=e.url,e.rid&&(this.rid=e.rid),e.sid&&(this.sid=e.sid),e.wait&&(this.maxWaitTime=e.wait),e.maxHoldOpen&&(this.maxHoldOpen=e.maxHoldOpen),this.sid)return this.hasStream=!0,this.stream={},this.client.emit("connected"),this.client.emit("session:prebind",this.config.jid),void this.client.emit("session:started");this._send({lang:e.lang,maxHoldOpen:this.maxHoldOpen,maxWaitTime:this.maxWaitTime,to:e.server,version:"1.6",xmppVersion:"1.0"})}restart(){this.hasStream=!1,this._send({to:this.config.server,xmppRestart:!0})}disconnect(e=!0){this.hasStream&&e?this._send({type:"terminate"}):(this.stream=void 0,this.sid=void 0,this.rid=void 0,this.client.emit("--transport-disconnected"))}send(e,t){var n;return Object(r.__awaiter)(this,void 0,void 0,(function*(){let i;if(t&&(i=null===(n=this.stanzas.export(e,t))||void 0===n?void 0:n.toString()),i)return new Promise((e,t)=>{this.write(i,"utf8",n=>n?t(n):e())})}))}get sendingChannel(){return this.channels[this.activeChannelID]}get pollingChannel(){return this.channels[0===this.activeChannelID?1:0]}toggleChannel(){this.activeChannelID=0===this.activeChannelID?1:0}_send(e,t=""){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(this.isEnded)return;const n=this.rid++,i=this.stanzas.export("bosh",Object.assign(Object.assign({},e),{rid:n,sid:this.sid}));let r;r=t?[i.openTag(),t,i.closeTag()].join(""):i.toString(),this.client.emit("raw","outgoing",r),this.sendingChannel.send(n,r).then(e=>{this.process(e)}).catch(e=>{this.end(e)}),this.toggleChannel()}))}_poll(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(this.isEnded)return;const e=this.rid++,t=this.stanzas.export("bosh",{rid:e,sid:this.sid}).toString();this.client.emit("raw","outgoing",t),this.pollingChannel.send(e,t).then(e=>{this.process(e)}).catch(e=>{this.end(e)})}))}scheduleRequests(){clearTimeout(this.idleTimeout),this.idleTimeout=setTimeout(()=>{this.fireRequests()},10)}fireRequests(){if(!this.isEnded)if(this.queue.length)if(this.sendingChannel.active)this.scheduleRequests();else{const[e,t]=this.queue.shift();this._send({},e),t()}else!this.authenticated||this.channels[0].active||this.channels[1].active||this._poll()}}class Da extends l.Duplex{constructor(e,t,n){super({objectMode:!0}),this.sm=t,this.stanzas=n,this.closing=!1,this.client=e,this.on("data",e=>{this.client.emit("stream:data",e.stanza,e.kind)}),this.on("error",()=>{this.end()}),this.on("end",()=>{this.client.transport===this&&this.client.emit("--transport-disconnected")})}_read(){}_write(t,n,i){if(!this.socket||1!==this.socket.readyState)return i(new Error("Socket closed"));const r=e.from(t,"utf8").toString();this.client.emit("raw","outgoing",r),this.socket.send(r),i()}connect(t){this.config=t,this.hasStream=!1,this.closing=!1,this.parser=new gi({acceptLanguages:this.config.acceptLanguages,allowComments:!1,lang:this.config.lang,registry:this.stanzas,wrappedStream:!1}),this.parser.on("data",e=>{const t=e.kind,n=e.stanza;if("stream"===t){if("open"===n.action)return this.hasStream=!0,this.stream=n,this.client.emit("stream:start",n);if("close"===n.action)return this.client.emit("stream:end"),this.disconnect()}this.push({kind:e.kind,stanza:e.stanza})}),this.parser.on("error",e=>{const t={condition:Dr.InvalidXML};return this.client.emit("stream:error",t,e),this.write(this.stanzas.export("error",t).toString()),this.disconnect()}),this.socket=new er(t.url,"xmpp"),this.socket.onopen=()=>{this.emit("connect"),this.sm.started=!1,this.client.emit("connected"),this.write(this.startHeader())},this.socket.onmessage=t=>{const n=e.from(t.data,"utf8").toString();this.client.emit("raw","incoming",n),this.parser&&this.parser.write(n)},this.socket.onclose=()=>{this.push(null)}}disconnect(e=!0){this.socket&&!this.closing&&this.hasStream&&e?(this.closing=!0,this.write(this.closeHeader())):(this.hasStream=!1,this.stream=void 0,this.socket&&(this.end(),this.socket.close(),this.client.transport===this&&this.client.emit("--transport-disconnected")),this.socket=void 0)}send(e,t){var n;return Object(r.__awaiter)(this,void 0,void 0,(function*(){let i;if(t&&(i=null===(n=this.stanzas.export(e,t))||void 0===n?void 0:n.toString()),i)return new Promise((e,t)=>{this.write(i,"utf8",n=>n?t(n):e())})}))}restart(){this.hasStream=!1,this.write(this.startHeader())}startHeader(){return this.stanzas.export("stream",{action:"open",lang:this.config.lang,to:this.config.server,version:"1.0"}).toString()}closeHeader(){return this.stanzas.export("stream",{action:"close"}).toString()}}class Ba extends o.EventEmitter{constructor(e={}){super(),this.reconnectAttempts=0,this.setMaxListeners(100),this.off=this.removeListener,this.updateConfig(e),this.jid="",this.sasl=new ir,this.sasl.register("EXTERNAL",pr,1e3),this.sasl.register("SCRAM-SHA-256-PLUS",gr,350),this.sasl.register("SCRAM-SHA-256",gr,300),this.sasl.register("SCRAM-SHA-1-PLUS",gr,250),this.sasl.register("SCRAM-SHA-1",gr,200),this.sasl.register("DIGEST-MD5",mr,100),this.sasl.register("OAUTHBEARER",fr,100),this.sasl.register("X-OAUTH2",hr,50),this.sasl.register("PLAIN",hr,1),this.sasl.register("ANONYMOUS",dr,0),this.stanzas=new Mt,this.stanzas.define(La),this.use(Zs),this.sm=new h,void 0!==this.config.allowResumption&&(this.sm.allowResume=this.config.allowResumption),this.sm.on("prebound",e=>{this.jid=e,this.emit("session:bound",e)}),this.on("session:bound",e=>this.sm.bind(e)),this.sm.on("send",e=>this.send("sm",e)),this.sm.on("acked",e=>this.emit("stanza:acked",e)),this.sm.on("failed",e=>this.emit("stanza:failed",e)),this.sm.on("hibernated",e=>this.emit("stanza:hibernated",e)),this.sm.on("begin-resend",()=>this.outgoingDataQueue.pause()),this.sm.on("resend",({kind:e,stanza:t})=>this.send(e,t,!0)),this.sm.on("end-resend",()=>this.outgoingDataQueue.resume());for(const e of["acked","hibernated","failed"])this.on("stanza:"+e,t=>{"message"===t.kind&&this.emit("message:"+e,t.stanza)});this.transports={bosh:Ma,websocket:Da},this.incomingDataQueue=Object(s.priorityQueue)((e,t)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const{kind:n,stanza:i}=e;this.emit(n,i),i.id&&this.emit(n+":id:"+i.id,i),"message"===n||"presence"===n||"iq"===n?(this.emit("stanza",i),yield this.sm.handle()):"sm"===n&&("ack"===i.type&&(yield this.sm.process(i),this.emit("stream:management:ack",i)),"request"===i.type&&this.sm.ack()),t&&t()})),1);const t=(e,t)=>{["message","presence","iq"].includes(e)&&(this.sm.started&&this.sm.resumable?this.sm.resumable&&!this.transport&&this.emit("stanza:hibernated",{kind:e,stanza:t}):this.emit("stanza:failed",{kind:e,stanza:t}))};this.outgoingDataQueue=Object(s.priorityQueue)((e,n)=>Object(r.__awaiter)(this,void 0,void 0,(function*(){var i;const{kind:r,stanza:s,replay:o}=e,a=o||(yield this.sm.track(r,s));if("message"===r&&(o?this.emit("message:retry",s):this.emit("message:sent",s,!1)),this.transport)try{yield this.transport.send(r,s),a&&(null===(i=this.transport)||void 0===i||i.send("sm",{type:"request"}))}catch(e){console.error(e),t(r,s)}else t(r,s);n&&n()})),1),this.on("stream:data",(e,t)=>{this.incomingDataQueue.push({kind:t,stanza:e},0)}),this.on("--transport-disconnected",()=>Object(r.__awaiter)(this,void 0,void 0,(function*(){const e=[];this.incomingDataQueue.idle()||e.push(this.incomingDataQueue.drain()),this.outgoingDataQueue.idle()||e.push(this.outgoingDataQueue.drain()),yield Promise.all(e),yield this.sm.hibernate(),this.transport&&delete this.transport,this.emit("--reset-stream-features"),!this.sessionTerminating&&this.config.autoReconnect&&(this.reconnectAttempts+=1,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.connect()},1e3*Math.min(Math.pow(2,this.reconnectAttempts)+Math.random(),this.config.maxReconnectBackoff||32))),this.emit("disconnected")}))),this.on("iq",e=>{const t=e.type,n=e.payloadType,i="iq:"+t+":"+n;if("get"===t||"set"===t){if("invalid-payload-count"===n)return this.sendIQError(e,{error:{condition:"bad-request",type:"modify"}});if("unknown-payload"===n||0===this.listenerCount(i))return this.sendIQError(e,{error:{condition:"service-unavailable",type:"cancel"}});this.emit(i,e)}}),this.on("message",e=>{const t=e.alternateLanguageBodies&&e.alternateLanguageBodies.length||e.links&&e.links.length,n=e.marker&&"markable"!==e.marker.type;t&&!n&&("chat"===e.type||"normal"===e.type?this.emit("chat",e):"groupchat"===e.type&&this.emit("groupchat",e)),"error"===e.type&&this.emit("message:error",e)}),this.on("presence",e=>{let t=e.type||"available";"error"===t&&(t="presence:error"),this.emit(t,e)}),this.on("session:started",()=>{this.sessionStarting=!1,this.reconnectAttempts=0,this.reconnectTimer&&clearTimeout(this.reconnectTimer)})}updateConfig(e={}){const t=this.config||{};this.config=Object.assign(Object.assign({allowResumption:!0,jid:"",transports:{bosh:!0,websocket:!0},useStreamManagement:!0},t),e),this.config.server||(this.config.server=W(this.config.jid)),this.config.password&&(this.config.credentials=this.config.credentials||{},this.config.credentials.password=this.config.password,delete this.config.password)}get stream(){return this.transport?this.transport.stream:void 0}emit(e,...t){const n=super.emit(e,...t);return"raw"===e?(super.emit("raw:"+t[0],t[1]),super.emit("raw:*","raw:"+t[0],t[1]),super.emit("*","raw:"+t[0],t[1])):super.emit("*",e,...t),n}use(e){"function"==typeof e&&e(this,this.stanzas,this.config)}nextId(){return jr()}getCredentials(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){return this._getConfiguredCredentials()}))}connect(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.sessionTerminating=!1,this.sessionStarting=!0,this.emit("--reset-stream-features"),this.transport&&this.transport.disconnect(!1);const e=["websocket","bosh"];let t;for(const n of e){let e=this.config.transports[n];if(e){if("string"==typeof e)e={url:e};else if(!0===e){if(!t)try{t=yield this.discoverBindings(this.config.server)}catch(e){console.error(e);continue}if(t[n]=(t[n]||[]).filter(e=>e.startsWith("wss:")||e.startsWith("https:")),!t[n]||!t[n].length)continue;e={url:t[n][0]}}return this.transport=new this.transports[n](this,this.sm,this.stanzas),void this.transport.connect(Object.assign({acceptLanguages:this.config.acceptLanguages||["en"],jid:this.config.jid,lang:this.config.lang||"en",server:this.config.server,url:e.url},e))}}console.error("No endpoints found for the requested transports."),this.emit("--transport-disconnected")}))}disconnect(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){this.sessionTerminating=!0,clearTimeout(this.reconnectTimer),this.outgoingDataQueue.pause(),this.sessionStarted&&!this.sm.started&&this.emit("session:end"),this.emit("--reset-stream-features"),this.sessionStarted=!1,this.transport?this.transport.disconnect():this.emit("--transport-disconnected"),this.outgoingDataQueue.resume(),this.outgoingDataQueue.idle()||(yield this.outgoingDataQueue.drain()),yield this.sm.shutdown()}))}send(e,t,n=!1){return Object(r.__awaiter)(this,void 0,void 0,(function*(){return new Promise((i,r)=>{this.outgoingDataQueue.push({kind:e,stanza:t,replay:n},n?0:1,e=>e?r(e):i())})}))}sendMessage(e){const t=e.id||this.nextId(),n=Object.assign({id:t,originId:t},e);return this.send("message",n),n.id}sendPresence(e={}){const t=Object.assign({id:this.nextId()},e);return this.send("presence",t),t.id}sendIQ(e){const t=Object.assign({id:this.nextId()},e),n=V(this.jid,e.to),i="iq:id:"+t.id,r=new Promise((e,t)=>{const r=s=>{n.has(s.from)&&("result"!==s.type&&"error"!==s.type||(this.off(i,r),"result"===s.type?e(s):t(s)))};this.on(i,r)});this.send("iq",t);const s=this.config.timeout||15;return Tr(r,1e3*s,()=>Object.assign(Object.assign({},t),{to:void 0,from:void 0,error:{condition:"timeout",text:`Request timed out after ${s} seconds.`},id:t.id,type:"error"}))}sendIQResult(e,t){this.send("iq",Object.assign(Object.assign({},t),{id:e.id,to:e.from,type:"result"}))}sendIQError(e,t){this.send("iq",Object.assign(Object.assign({},t),{id:e.id,to:e.from,type:"error"}))}sendStreamError(e){this.emit("stream:error",e),this.send("error",e),this.disconnect()}_getConfiguredCredentials(){const e=this.config.credentials||{},t=G(this.config.jid||""),n=e.username||t.local,i=e.host||t.domain;return Object.assign({host:i,password:this.config.password,realm:i,serviceName:i,serviceType:"xmpp",username:n},e)}}function Ua(e,t){const n=e.length,i=t.length,r=Math.min(n,i);let s=0;for(s=0;s<r&&e[s]===t[s];s++);let o=0;for(o=0;o<r-s&&e[n-o-1]===t[i-o-1];o++);const a=s+o,l=[];if(a<n&&l.push({length:n-a,position:n-o,type:"erase"}),a<i){const e=t.slice(s,s+i-a);l.push({position:s,text:c.a.ucs2.encode(e),type:"insert"})}return l}var za=Object.freeze({__proto__:null,diff:Ua,DisplayBuffer:class{constructor(e,t=!1){this.synced=!1,this.cursorPosition=0,this.ignoreWaits=!1,this.timeDeficit=0,this.sequenceNumber=0,this.onStateChange=e||function(){},this.ignoreWaits=t,this.buffer=[],this.resetActionQueue()}get text(){return c.a.ucs2.encode(this.buffer.slice())}commit(){this.resetActionQueue()}process(e){if("cancel"!==e.event&&"init"!==e.event){if("reset"===e.event||"new"===e.event?(this.resetActionQueue(),void 0!==e.seq&&(this.sequenceNumber=e.seq)):e.seq!==this.sequenceNumber&&(this.synced=!1),e.actions){const t=Date.now();let n=0;for(const i of e.actions)i.baseTime=t+n,"wait"===i.type&&(n+=i.duration),this.actionQueue.push(i,0)}this.sequenceNumber=this.sequenceNumber+1}else this.resetActionQueue()}insert(e="",t=this.buffer.length){e=e.normalize("NFC");const n=c.a.ucs2.decode(e);this.buffer.splice(t,0,...n),this.cursorPosition=t+n.length,this.emitState()}erase(e=1,t=this.buffer.length){t=Math.max(Math.min(t,this.buffer.length),0),e=Math.max(Math.min(e,this.text.length),0),this.buffer.splice(Math.max(t-e,0),e),this.cursorPosition=Math.max(t-e,0),this.emitState()}emitState(e={}){this.onStateChange(Object.assign({cursorPosition:this.cursorPosition,synced:this.synced,text:this.text},e))}resetActionQueue(){this.actionQueue&&this.actionQueue.kill(),this.sequenceNumber=0,this.synced=!0,this.buffer=[],this.timeDeficit=0,this.actionQueue=Object(s.priorityQueue)((e,t)=>{const n=Date.now();if("insert"===e.type)return this.insert(e.text,e.position),t();if("erase"===e.type)return this.erase(e.length,e.position),t();if("wait"!==e.type)return t();{if(this.ignoreWaits)return t();e.duration>700&&(e.duration=700);const i=e.duration-(n-e.baseTime)+this.timeDeficit;if(i<=0)return this.timeDeficit=i,t();this.timeDeficit=0,setTimeout(()=>t(),i)}},1),this.emitState()}},InputBuffer:class{constructor(e,t=!1){this.resetInterval=1e4,this.ignoreWaits=!1,this.isStarting=!1,this.isReset=!1,this.changedBetweenResets=!1,this.onStateChange=e||function(){},this.ignoreWaits=t,this.buffer=[],this.actionQueue=[],this.sequenceNumber=0}get text(){return c.a.ucs2.encode(this.buffer.slice())}update(e){let t=[];if(void 0!==e){e=e.normalize("NFC");const n=c.a.ucs2.decode(e);t=Ua(this.buffer,n.slice()),this.buffer=n,this.emitState()}const n=Date.now();if(this.changedBetweenResets&&n-this.lastResetTime>this.resetInterval)this.actionQueue=[],this.actionQueue.push({position:0,text:this.text,type:"insert"}),this.isReset=!0,this.lastActionTime=n,this.lastResetTime=n,this.changedBetweenResets=!1;else if(t.length){const e=n-(this.lastActionTime||n);e>0&&!this.ignoreWaits&&this.actionQueue.push({duration:e,type:"wait"});for(const e of t)this.actionQueue.push(e);this.lastActionTime=n,this.changedBetweenResets=!0}else this.lastActionTime=n}start(e=this.resetInterval){return this.commit(),this.isStarting=!0,this.resetInterval=e,this.sequenceNumber=Math.floor(1e4*Math.random()+1),{event:"init"}}stop(){return this.commit(),{event:"cancel"}}diff(){if(this.update(),!this.actionQueue.length)return null;const e={actions:this.actionQueue,seq:this.sequenceNumber++};return this.isStarting?(e.event="new",this.isStarting=!1,this.lastResetTime=Date.now()):this.isReset&&(e.event="reset",this.isReset=!1),this.actionQueue=[],e}commit(){this.sequenceNumber=0,this.lastActionTime=0,this.actionQueue=[],this.buffer=[]}emitState(){this.onStateChange({text:this.text})}}});class Ja{constructor(e){var t,n,i;this.resultComplete=!1,this.fetchedCount=0,this.yieldedCount=0,this.cursor={first:e.before,last:e.after},this.query=e.query,this.direction=null!==(t=e.direction)&&void 0!==t?t:"forward",this.reverse=null!==(n=e.reverse)&&void 0!==n?n:"backward"===this.direction,this.pageSize=null!==(i=e.pageSize)&&void 0!==i?i:20}[Symbol.asyncIterator](){return Object(r.__asyncGenerator)(this,arguments,(function*(){let e=[];do{e=yield Object(r.__await)(this.fetchPage());for(const t of e)this.yieldedCount+=1,yield yield Object(r.__await)(t)}while(e.length>0)}))}size(){return Object(r.__awaiter)(this,void 0,void 0,(function*(){if(void 0!==this.resultCount)return this.resultCount;const{paging:e}=yield this.query({max:0});return this.resultCount=e.count,e.count}))}queryCompleted(){return this.resultComplete}finished(){return this.resultComplete&&this.yieldedCount===this.fetchedCount}fetchPage(){var e;return Object(r.__awaiter)(this,void 0,void 0,(function*(){const{results:t,paging:n}=yield this.query({before:"backward"===this.direction?null!==(e=this.cursor.first)&&void 0!==e?e:"":void 0,after:"forward"===this.direction?this.cursor.last:void 0,max:this.pageSize});return this.cursor=n,this.resultCount=n.count,this.fetchedCount+=t.length,(this.pageSize&&t.length<this.pageSize||this.resultCount&&this.fetchedCount===this.resultCount)&&(this.resultComplete=!0),this.reverse&&t.reverse(),t}))}}var Ga=Object.freeze({__proto__:null,ResultSetPager:Ja,createPager:function(e){return new Ja(e)}});const Va="12.17.2";function Ha(e){const t=new Ba(e);return t.use(eo),t}}.call(this,n(12).Buffer,n(6))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{}t.default=i},function(e,t,n){"use strict";n.r(t),n.d(t,"Emitter",(function(){return s})),n.d(t,"MemoryLeakError",(function(){return i}));var i=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},r=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=r.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return this.events.get(e)||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...i)=>{this.removeListener(e,n),t.apply(this,i)};return n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(e=>{e.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const t=new i(this,e,this.listenerCount(e));console.warn(t)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const i=[t].concat(n);this.events.set(e,i)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},s=r;s.defaultMaxListeners=10},function(e,t,n){"use strict";n.r(t);var i=n(4),r=n(64),s=n(27),o=n.n(s);const a=function(e){const t=JSON.stringify(e),n=encodeURIComponent(t).match(/%[89ABab]/g);return t.length+(n?n.length:0)},c=function e(t){if(t){if(Array.isArray(t)){const n=[];for(let i=0;i<t.length;i++)n[i]=e(t[i]);return n}if("object"==typeof t){const n=Object.assign({},t);for(const i in t)try{n[i]=e(t[i])}catch(e){console.debug("WARN: Failed cloning key on object, ignoring",{key:i,object:t})}return n}}return t};var l=n(43),u=n(42),d=n(28);function p(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function h(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function f(e){h(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Object(d.a)(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function m(e,t){h(2,arguments);var n=f(e),i=p(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}function g(e,t){h(2,arguments);var n=f(e),i=p(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var r=n.getDate(),s=new Date(n.getTime());s.setMonth(n.getMonth()+i+1,0);var o=s.getDate();return r>=o?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}function v(e,t){h(2,arguments);var n=f(e),i=f(t);return n.getTime()>i.getTime()}var b=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};const y=[408,429,500,503,504],_=[401],S=new Map;class w{constructor(e,t=!1){this.url=e,this.debugMode=t,this.sendQueue=[]}postLogsToEndpoint(e){const t=(()=>{let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}})();return this.sendQueue.push({requestParams:e,deferred:t}),this.sendNextQueuedLogToServer(),this.debug("adding requestParams to sendQueue",{requestParams:e,updatedSendQueue:this.sendQueue.map(e=>e.requestParams),hasPendingRequest:!!this.pendingRequest}),t.promise}postLogsToEndpointInstantly(e,t){return b(this,void 0,void 0,(function*(){if(this.debug("sending request instantly",{requestParams:e,sendQueue:this.sendQueue.map(e=>e.requestParams)}),!navigator.onLine)return this.saveRequestForLater(e);try{yield this.sendPostRequest(e)}catch(n){throw(null==t?void 0:t.saveOnFailure)&&this.saveRequestForLater(e),n}}))}saveRequestForLater(e){const t=this.getSavedRequests()||[],n=Object.assign({},e);delete n.accessToken,t.push(n),window.localStorage.setItem("gc_logger_requests",JSON.stringify(t))}getSavedRequests(){const e=window.localStorage.getItem("gc_logger_requests");if(e)try{return JSON.parse(e)}catch(t){console.error("Failed to parse saved messages, ignoring",{savedMessagesStr:e})}}sendEntireQueue(){this.debug("sending all queued requests instantly to clear out sendQueue",{sendQueue:this.sendQueue.map(e=>e.requestParams)});const e=[];let t;for(;t=this.sendQueue.shift();)e.push(this.postLogsToEndpointInstantly(t.requestParams,{saveOnFailure:!0}));return e}resetSendQueue(){this.debug("reseting send queue without sending currently queued data",{queueLength:this.sendQueue.length}),this.sendQueue=[]}sendNextQueuedLogToServer(){return b(this,void 0,void 0,(function*(){if(this.pendingRequest||0===this.sendQueue.length)return void this.debug("sendNextQueuedLogToServer() but not sending request",{hasPendingRequest:!!this.pendingRequest,sendQueueLength:this.sendQueue.length});const e=this.sendQueue.shift();return e.deferred.promise.finally(()=>{this.debug("queue item completed. removing from queue and resetting send queue",{queueItemRequestParams:e.requestParams,updatedSendQueue:this.sendQueue.map(e=>e.requestParams)}),this.pendingRequest=void 0,this.sendNextQueuedLogToServer()}),this.pendingRequest=e,this.debug("sending logs to server",{queueItem:e.requestParams,sendQueue:this.sendQueue.map(e=>e.requestParams)}),Object(u.backOff)(()=>this.backoffFn(e.requestParams),{retry:e=>{var t,n,i,r,s;const o=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.status,a=null==e?void 0:e.code,c=(null===(i=null===(n=e.response)||void 0===n?void 0:n.headers)||void 0===i?void 0:i["retry-after"])||(null===(s=null===(r=e.response)||void 0===r?void 0:r.getResponseHeader)||void 0===s?void 0:s.call(r,"retry-after"));if(c){const e=function(e,t){if(h(2,arguments),!t||"object"!==Object(d.a)(t))return new Date(NaN);var n=t.years?p(t.years):0,i=t.months?p(t.months):0,r=t.weeks?p(t.weeks):0,s=t.days?p(t.days):0,o=t.hours?p(t.hours):0,a=t.minutes?p(t.minutes):0,c=t.seconds?p(t.seconds):0,l=f(e),u=i||n?g(l,i+12*n):l,v=s||r?m(u,s+7*r):u,b=a+60*o,y=c+60*b,_=1e3*y,S=new Date(v.getTime()+_);return S}(new Date,{seconds:parseInt(c,10)});this.retryAfter&&!v(e,this.retryAfter)||(this.retryAfter=e)}return navigator.onLine&&(o&&y.includes(o)||"ERR_NETWORK"===a)},numOfAttempts:10,startingDelay:0,delayFirstAttempt:!1,maxDelay:15e3}).then(t=>{this.debug("successfully sent logs to server",{requestParams:e.requestParams,response:t}),e.deferred.resolve(t)}).catch(this.handleBackoffError.bind(this,e))}))}handleBackoffError(e,t){var n;const i=null===(n=t.response)||void 0===n?void 0:n.status;i&&y.includes(i)||_.includes(i)||"ERR_NETWORK"===t.code?(this.debug("Failed to sends logs to the server, moving request to the end of the queue",{requestParams:e.requestParams,error:t}),this.saveRequestForLater(e.requestParams)):this.debug("ERROR sending logs to server",{requestParams:e.requestParams,error:t}),e.deferred.reject(Object.assign(Object.assign({},t),{id:"rejectionSpot1"}))}retryAfterTimerCheck(){return b(this,void 0,void 0,(function*(){if(this.retryAfter){if(!v(Date.now(),this.retryAfter)){const e=function(e,t){return h(2,arguments),f(e).getTime()-f(t).getTime()}(this.retryAfter,Date.now());return this.debug('Respecting "retry-after" response header, waiting to send request',{millisecondsToWait:e}),yield new Promise(t=>{setTimeout(()=>{t(null)},e)}),this.retryAfterTimerCheck()}this.retryAfter=void 0}}))}backoffFn(e){return b(this,void 0,void 0,(function*(){yield this.retryAfterTimerCheck();const t=e.accessToken,n=yield this.sendPostRequest(e),i=this.getSavedRequests();return i&&(window.localStorage.removeItem("gc_logger_requests"),i.map(e=>{const n=Object.assign({accessToken:t},e);this.postLogsToEndpoint(n)})),n}))}sendPostRequest(e){this.debug("issuing POST request",{requestParams:e});const t=Object.assign({},e);return delete t.accessToken,Object(l.a)({method:"post",url:this.url,responseType:"text",headers:{authorization:"Bearer "+e.accessToken,"content-type":"application/json; charset=UTF-8"},data:t})}debug(e,t){this.debugMode&&console.log("%c [DEBUG:log-uploader] "+e,"color: #32a0a8",c(t))}}var T=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};class I{constructor(e){if(this.isInitialized=!1,this.logBuffer=[],this.debounceTimer=null,this.logger=e,!e.config.url||!e.config.appVersion){const t="Missing `url` and/or `appVersion` config options to set up server logging. Not sending logs to server for this logger instance";throw this.logger.error(t,{providedConfig:e.config},{skipServer:!0}),new Error(t)}this.isInitialized=!0,this.debounceLogUploadTime=e.config.uploadDebounceTime||4e3,this.logUploader=((e,t=!1,n)=>{if(n)return new w(e,t);let i=S.get(e);return i||(i=new w(e,t),S.set(e,i)),i})(e.config.url,e.config.debugMode,e.config.useUniqueLogUploader),window.addEventListener("unload",this.sendAllLogsInstantly.bind(this)),this.logger.on("onStop",e=>{this.debug("`onStop` received. Clearing logBuffer and sendQueue",{logBuffer:this.logBuffer,sendQueue:this.logUploader.sendQueue}),this.logBuffer=[],this.logUploader.resetSendQueue()})}addLogToSend(e,t,n){if(!this.isInitialized)return;const i=this.convertToLogMessage(t,n);let r=this.convertToTrace(e,i),s=a(r);if(s>14500){const t=this.truncateLog(e,i);if(null===t)return void this.logger.error("truncated message is too large to send to server. not sending message",{originalTrace:r,originalTraceSize:a(r),truncatedTrace:t,truncatedTraceSize:a(t)},{skipServer:!0});s=a(t),r=t}const o=!this.logBuffer.length;let c;c=o?{size:0,traces:[]}:this.logBuffer[this.logBuffer.length-1];if(c.size+s>14500)return this.debug("`exceedsMaxLogSize` was `true`",{logBuffer:this.logBuffer,bufferItem:c,incomingTrace:r,incomingTraceSize:s,maxAllowedTraceSize:14500}),this.logBuffer.push({size:s,traces:[r]}),this.debug("calling sendLogsToServer(true)",{logBuffer:this.logBuffer}),void this.sendLogsToServer(!0);c.size+=s,c.traces.push(r),o&&(this.debug("`this.logBuffer` was empty. pushing new buffer item",{logBuffer:this.logBuffer,bufferItem:c}),this.logBuffer.push(c)),this.debug("calling sendLogsToServer()",{logBuffer:this.logBuffer}),this.sendLogsToServer()}sendAllLogsInstantly(){return this.logUploader.sendEntireQueue().concat(this.logBuffer.map(e=>this.logUploader.postLogsToEndpointInstantly(this.convertToRequestParams(e.traces.reverse()),{saveOnFailure:!0})))}sendLogsToServer(e=!1){var t;return T(this,void 0,void 0,(function*(){if(!this.logBuffer.length)return clearTimeout(this.debounceTimer),this.debounceTimer=null,void this.debug("buffer empty, not sending http request");if(!e)return void(this.debounceTimer?this.debug("sendLogsToServer() 'immediate' is false. 'debounceTimer' is already running"):(this.debug(`sendLogsToServer() 'immediate' is false. setting up 'debounceTimer' to ${this.debounceLogUploadTime}ms`),this.debounceTimer=setTimeout(()=>this.sendLogsToServer(!0),this.debounceLogUploadTime)));clearTimeout(this.debounceTimer),this.debounceTimer=null;const[n]=this.logBuffer.splice(0,1);try{this.debug("calling logUploader.postLogsToEndpoint() with",{bufferItem:n,newLogBuffer:this.logBuffer}),yield this.logUploader.postLogsToEndpoint(this.convertToRequestParams(n.traces.reverse()))}catch(e){this.logger.emit("onError",e),this.logger.error("Error sending logs to server",e,{skipServer:!0});const n=(null==e?void 0:e.status)?e.status:null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.status;[401,404,"401","404"].includes(n)&&(this.debug(`received a ${n} from logUploader. stopping logging to server`),this.logger.stopServerLogging())}finally{this.sendLogsToServer()}}))}truncateLog(e,t){let n,i;const r=a(this.convertToTrace(e,t)),s=c(t);return s.details="[[TRUNCATED]]",n=this.convertToTrace(e,s),i=a(n),i<=14500?(this.logger.warn("message too large to send to server. truncated log details",{originalLog:t,truncatedLog:s,originalTraceSize:r,truncatedTraceSize:i,maxAllowedTraceSize:14500},{skipServer:!0}),n):(s.message=s.message.substr(0,150)+"... [[TRUNCATED]]",n=this.convertToTrace(e,s),i=a(n),i<=14500?(this.logger.warn("message too large to send to server. truncated log details & log message",{originalLog:t,truncatedLog:s,originalTraceSize:r,truncatedTraceSize:i,maxAllowedTraceSize:14500},{skipServer:!0}),n):null)}convertToLogMessage(e,t){const n={clientTime:(new Date).toISOString(),clientId:this.logger.clientId,message:e,details:t},{originAppName:i,originAppVersion:r,originAppId:s}=this.logger.config;return i&&(n.originAppName=i,n.originAppVersion=r,n.originAppId=s),n}convertToTrace(e,t){return{topic:this.logger.config.appName,level:e.toUpperCase(),message:o()(t)}}convertToRequestParams(e){return{accessToken:this.logger.config.accessToken,app:{appId:this.logger.config.appName,appVersion:this.logger.config.appVersion},traces:e}}debug(e,t){this.logger.config.debugMode&&console.log(`%c [DEBUG:${this.logger.config.appName}] ${e}`,"color: #32a852",c(t))}}class x extends i.EventEmitter{constructor(e){super(),this.defaultFormatter=(e,t,n,i,r)=>{if(i.skipDefaultFormatter)return r();t instanceof Error&&(n=n||t,t=t.message);r(e,t=`${this.config.appName?`[${this.config.appName}] `:""}${t}`,n,i)},this.logMessage=(e,t,n,i)=>{if(!i.skipSecondaryLogger)try{const i=[t];void 0!==n&&i.push(this.config.stringify?o()(n):n),this.secondaryLogger[e].apply(this.secondaryLogger,i)}catch(e){console.error("Error logging using custom logger passed into `genesys-cloud-client-logger`",{error:e,secondaryLogger:this.secondaryLogger,message:t,details:n,messageOptions:i})}!i.skipServer&&!this.stopReason&&this.serverLogger&&this.logRank(e)>=this.logRank(this.config.logLevel)&&this.serverLogger.addLogToSend(e,t,n)},Object.defineProperty(this,"clientId",{value:Object(r.v4)(),writable:!1}),this.config=Object.assign({},e),this.secondaryLogger=this.config.logger||console,delete this.config.logger,-1===this.logRank(this.config.logLevel)&&(e.logLevel&&this.warn(`Invalid log level: "${e.logLevel}". Default "info" will be used instead.`,null,{skipServer:!0}),this.config.logLevel="info"),!e.appName&&e.logTopic&&(this.warn("`logTopic` has been renamed to `appName`. Please use `appName`",null,{skipServer:!0}),this.config.appName=e.logTopic),!1!==this.config.initializeServerLogging&&(this.serverLogger=new I(this)),this.config.startServerLoggingPaused&&this.stopServerLogging()}get VERSION(){return x.VERSION}setAccessToken(e){this.config.accessToken=e,401==this.stopReason&&this.startServerLogging()}log(e,t,n){this.formatMessage("log",e,t,n)}debug(e,t,n){this.formatMessage("debug",e,t,n)}info(e,t,n){this.formatMessage("info",e,t,n)}warn(e,t,n){this.formatMessage("warn",e,t,n)}error(e,t,n){this.formatMessage("error",e,t,n)}startServerLogging(){if(this.stopReason=void 0,!this.serverLogger)return this.warn("`startServerLogging` called but the logger instance is not configured to send logs to the server. Ignoring call to start sending logs to server.",void 0,{skipServer:!0});this.emit("onStart")}stopServerLogging(e="force"){"force"===this.stopReason&&"force"!==e||(this.stopReason=e,this.emit("onStop",e))}sendAllLogsInstantly(){var e;return(null===(e=this.serverLogger)||void 0===e?void 0:e.sendAllLogsInstantly())||[]}formatMessage(e,t,n,i){let r=[this.defaultFormatter.bind(this)];this.config.formatters&&(r=[...this.config.formatters,this.defaultFormatter.bind(this)]),this.callNextFormatter(r,e,t,n,i)}callNextFormatter(e,t,n,i,r={}){const[s,...o]=e;if(!s)return this.logMessage(t,n,i,r);s(t,n,i,r,(e,s,a,c)=>{void 0!==e?this.callNextFormatter(o,e,s,a,c):this.callNextFormatter(o,t,n,i,r)})}logRank(e){switch(e){case"log":return 0;case"debug":return 1;case"info":return 2;case"warn":return 3;case"error":return 4;default:return-1}}}x.VERSION="4.2.7",n.d(t,"Logger",(function(){return x}));t.default=x}]).default;
|
|
31
|
+
t.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,c=(1<<a)-1,u=c>>1,l=-7,d=n?r-1:0,p=n?-1:1,h=e[t+d];for(d+=p,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+d],d+=p,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+d],d+=p,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=u}return(h?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var o,a,c,u=8*s-r-1,l=(1<<u)-1,d=l>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=l?(a=0,o=l):o+d>=1?(a=(t*c-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+h]=255&a,h+=f,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;e[n+h]=255&o,h+=f,o/=256,u-=8);e[n+h-f]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(e){e||Object.defineProperty(window,"crypto",{value:window.crypto||window.msCrypto,writable:!1,configurable:!1})}).call(this,n(15))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Notifications=void 0;const i=n(189),r=n(11);function s(e,t){return[...e,...t].filter((e,t,n)=>n.indexOf(e)===t)}t.Notifications=class{constructor(e){this.subscriptions={},this.bulkSubscriptions={},this.topicPriorities={},this.client=e,e.on("pubsub:event",this.pubsubEvent.bind(this)),e.on("connected",this.subscriptionsKeepAlive.bind(this)),this.debouncedResubscribe=i(this.resubscribe.bind(this),100)}get pubsubHost(){try{return"notifications."+this.client.config.apiHost.replace(/http(s?):\/\//,"")}catch(e){return"notifications.mypurecloud.com"}}handleStanzaInstanceChange(e){const t=this.stanzaInstance&&this.stanzaInstance.id!==e.id&&this.stanzaInstance.channelId!==e.channelId;this.stanzaInstance=e,t&&(this.client.logger.info("resubscribing due to hard reconnect"),this.debouncedResubscribe())}topicHandlers(e){return this.subscriptions[e]||(this.subscriptions[e]=[]),this.subscriptions[e]}pubsubEvent({pubsub:e}){let t=e.items.node;t.includes("no_longer_subscribed")?t="no_longer_subscribed":t.includes("duplicate_id")&&(t="duplicate_id");const n=e.items.published[0].content.json,i=this.topicHandlers(t);this.client.emit("notify",{topic:t,data:n}),this.client.emit("notify:"+t,n),i.forEach(e=>{e(n)})}async xmppSubscribe(e){if(0!==this.topicHandlers(e).length||this.bulkSubscriptions[e])return Promise.resolve();const t=()=>this.stanzaInstance.subscribeToNode(this.pubsubHost,e);return this.client.connected?t():new Promise((e,n)=>{this.client.once("connected",()=>t().then(e,n))})}xmppUnsubscribe(e){if(0!==this.topicHandlers(e).length||this.bulkSubscriptions[e])return Promise.resolve();const t=()=>this.stanzaInstance.unsubscribeFromNode(this.pubsubHost,e);return this.client.connected?t():new Promise((e,n)=>{this.client.once("connected",()=>t().then(e,n))})}mapCombineTopics(e){const t={},n=[],i=[];e.forEach(e=>{e.includes("?")?n.push({id:e}):i.push(e)}),i.map(e=>{const t=e.split("."),n=t.splice(t.length-1);return{prefix:t.join("."),postfix:n}}).forEach(e=>{t[e.prefix]?t[e.prefix].push(e.postfix):t[e.prefix]=[e.postfix]});let r=[];const s=(e,t)=>{const n=`${e}${1===t.length?".":"?"}${t.join("&")}`;n.length<200?r.push({id:n}):1===t.length?this.client.logger.error("Refusing to attempt topic with length > 200",n):(s(e,t.slice(0,t.length/2)),s(e,t.slice(t.length/2)))};Object.keys(t).forEach(e=>{const n=t[e];s(e,n)});const o=r.concat(n);return this.truncateTopicList(this.prioritizeTopicList(o))}prioritizeTopicList(e){return e.sort((e,t)=>this.getTopicPriority(t.id)-this.getTopicPriority(e.id)),e}getTopicPriority(e,t=!0){const{prefix:n,postfixes:i}=this.getTopicParts(e),r=this.topicPriorities[n],s=r&&Object.keys(r).filter(e=>i.includes(e)).map(e=>r[e]),o=s&&s.length&&s.reduce((e,t)=>t>e?t:e);return t?o||0:o}truncateTopicList(e){const t=e.slice(0,1e3);if(e.length>1e3){let t=e.slice(1e3);if(t.length>20){const e=t.length-20;t=t.slice(20),t.push(`...and ${e} more`)}this.client.logger.warn("Too many topics to subscribe to; truncating extra topics",{droppedTopics:t})}return t}makeBulkSubscribeRequest(e,t){const n={method:t.replace?"put":"post",host:this.client.config.apiHost,authToken:this.client.config.authToken,data:JSON.stringify(this.mapCombineTopics(e)),logger:this.client.logger},i=this.stanzaInstance.channelId;return this.client.http.requestApi(`notifications/channels/${i}/subscriptions`,n)}createSubscription(e,t){r.splitIntoIndividualTopics(e).forEach(e=>{let n=this.topicHandlers(e);n.includes(t)||n.push(t)})}removeSubscription(e,t){r.splitIntoIndividualTopics(e).forEach(e=>{let n=this.topicHandlers(e),i=n.indexOf(t);i>-1&&n.splice(i,1),n.length||delete this.subscriptions[e]})}removeTopicPriority(e){if(this.getTopicPriority(e,!1)){const{prefix:t,postfixes:n}=this.getTopicParts(e);n.forEach(e=>{delete this.topicPriorities[t][e]}),Object.keys(this.topicPriorities[t]).length||delete this.topicPriorities[t]}}getActiveIndividualTopics(){const e=[];return Object.keys(this.subscriptions).forEach(t=>{if("streaming-subscriptions-expiring"===t)return;this.topicHandlers(t).length>0&&e.push(t)}),e}resubscribe(){const e=Object.keys(this.bulkSubscriptions);return e.length+this.getActiveIndividualTopics().length===0?Promise.resolve():this.bulkSubscribe(e,{replace:!0})}subscriptionsKeepAlive(){const e="streaming-subscriptions-expiring";0===this.topicHandlers(e).length&&this.createSubscription(e,()=>{this.client.logger.info(e+" - Triggering resubscribe.",{channelId:this.client.config.channelId}),this.debouncedResubscribe().catch(e=>{const t="Error resubscribing to topics";this.client.logger.error(t,e),this.client.emit("pubsub:error",{msg:t,err:e})})})}getTopicParts(e){const t=e.includes("?"),n=t?"?":".",i=e.split(n),r=t?i[1]:i.splice(i.length-1),s=t?i[0]:i.join(".");let o=[];return o=t?r.split("&"):r,{prefix:s,postfixes:o}}setTopicPriorities(e={}){Object.keys(e).forEach(t=>{const n=this.getTopicParts(t),i=this.topicPriorities[n.prefix],r=e[t];if(i)n.postfixes.forEach(e=>{const t=i[e];(t&&t<r||!t)&&(i[e]=r)});else{const e=n.postfixes.reduce((e,t)=>(e[t]=r,e),{});this.topicPriorities[n.prefix]=e}})}subscribe(e,t,n,i){let r;return i&&this.setTopicPriorities({[e]:i}),r=n?this.xmppSubscribe(e):this.debouncedResubscribe(),t?this.createSubscription(e,t):this.bulkSubscriptions[e]=!0,r}unsubscribe(e,t,n){return t?this.removeSubscription(e,t):(delete this.bulkSubscriptions[e],delete this.subscriptions[e]),this.removeTopicPriority(e),n?this.xmppUnsubscribe(e):this.debouncedResubscribe()}async bulkSubscribe(e,t={replace:!1,force:!1},n={}){this.setTopicPriorities(n);let i=s(e,[]);t.replace&&!t.force?i=s(i,this.getActiveIndividualTopics()):t.force&&(this.subscriptions={}),await this.makeBulkSubscribeRequest(i,t),t.replace&&(this.bulkSubscriptions={}),e.forEach(e=>{this.bulkSubscriptions[e]=!0})}get expose(){return{subscribe:this.subscribe.bind(this),unsubscribe:this.unsubscribe.bind(this),bulkSubscribe:this.bulkSubscribe.bind(this)}}}},function(e,t,n){"use strict";function i(e){return"function"==typeof e?e():e}function r(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e}e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=void 0,o=void 0,a=void 0,c=[];return function(){var l=i(t),d=(new Date).getTime(),p=!s||d-s>l;s=d;for(var h=arguments.length,f=Array(h),m=0;m<h;m++)f[m]=arguments[m];if(p&&n.leading)return n.accumulate?Promise.resolve(e.call(this,[f])).then((function(e){return e[0]})):Promise.resolve(e.call.apply(e,[this].concat(f)));if(o?clearTimeout(a):o=r(),c.push(f),a=setTimeout(u.bind(this),l),n.accumulate){var g=c.length-1;return o.promise.then((function(e){return e[g]}))}return o.promise};function u(){var t=o;clearTimeout(a),Promise.resolve(n.accumulate?e.call(this,c):e.apply(this,c[c.length-1])).then(t.resolve,t.reject),c=[],o=null}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebrtcExtension=void 0;const i=n(16),r=n(6),s=n(8),o=i.__importDefault(n(193)),a=n(5),c=n(18),u=i.__importDefault(n(196)),l=n(197),d=n(198),p=n(11),h=n(48),f=n(212),m=n(21),g=n(38),y=n(44),b=n(27),_="requestIncomingRtcSession",v="cancelIncomingRtcSession",S="handledIncomingRtcSession",w="incomingRtcSession",T="outgoingRtcSession",I="rtcSessionError";class N extends r.EventEmitter{constructor(e,t){super(),this.ignoredSessions=new o.default({max:10,maxAge:216e3}),this.pendingSessions={},this.statsArr=[],this.throttleSendStatsInterval=25e3,this.currentMaxStatSize=15e3,this.statsSizeDecreaseAmount=3e3,this.statBuffer=0,this.discoRetries=0,this.iceServers=[],this.webrtcSessions=[],this.client=e,this.config={allowIPv6:!0===t.allowIPv6,optOutOfWebrtcStatsTelemetry:t.optOutOfWebrtcStatsTelemetry},this.logger=e.logger,this.addEventListeners(),this.throttledSendStats=u.default(this.sendStats.bind(this),this.throttleSendStatsInterval,{leading:!1,trailing:!0}),this.client.on("jingle:outgoing",e=>this.emit(T,e)),this.client.on("jingle:incoming",e=>this.emit(w,e)),this.client.on("jingle:created",e=>{e instanceof g.StanzaMediaSession||e.end("cancel",!0)}),window.addEventListener("offline",()=>this.onOnlineStatusChange(!1)),window.addEventListener("online",()=>this.onOnlineStatusChange(!0))}get jid(){var e;return null===(e=this.stanzaInstance)||void 0===e?void 0:e.jid}onOnlineStatusChange(e){this.addStatToQueue({actionName:"WebrtcStats",details:{_eventType:"onlineStatus",_eventTimestamp:(new Date).getTime(),online:e}})}async handleStanzaInstanceChange(e){this.stanzaInstance=e,this.refreshIceServersTimer&&(clearInterval(this.refreshIceServersTimer),this.refreshIceServersTimer=null),e.on("iq:set:genesysWebrtc",this.handleGenesysWebrtcStanza.bind(this)),this.refreshIceServersTimer=setInterval(this.refreshIceServers.bind(this),216e5),this.client.emit("sessionManagerChange",e)}async configureNewStanzaInstance(e){Object.assign(e.jingle.config.peerConnectionConfig,{sdpSemantics:"unified-plan"}),await this.configureStanzaIceServers(e),e.stanzas.define(d.definitions),e.jingle.prepareSession=this.prepareSession.bind(this),e.jingle.on("log",(e,t,n)=>{this.logger[e](t,n)});const t=["iceConnectionType","peerTrackAdded","peerTrackRemoved","mute","unmute","sessionState","connectionState","terminated","stats","endOfCandidates"];for(const n of t)e.jingle.on(n,(e,...t)=>{e instanceof g.StanzaMediaSession&&e.emit(n,...t)})}configureStanzaIceServers(e){return e.jingle.config.iceServers=[],this.setIceServers([],e),this._refreshIceServers(e)}async handleGenesysOffer(e){const t=e.genesysWebrtc.params,n="relay"===this.getIceTransportPolicy()&&l.isFirefox,i={id:t.sessionId,logger:this.logger,peerID:e.from,fromJid:e.from,sessionType:this.getSessionTypeByJid(e.from),conversationId:t.conversationId,ignoreHostCandidatesFromRemote:n,optOutOfWebrtcStatsTelemetry:!!this.config.optOutOfWebrtcStatsTelemetry,allowIPv6:this.config.allowIPv6,iceServers:this.iceServers,reinvite:!!t.reinvite,iceTransportPolicy:this.getIceTransportPolicy()};let r;const s=this.pendingSessions[t.sessionId];r=s?{...i,fromUserId:s.fromUserId,originalRoomJid:s.originalRoomJid}:i;const o=new y.GenesysCloudMediaSession(this,r);return await o.setRemoteDescription(t.sdp),this.proxyStatsForSession(o),o.on("sendIq",e=>{var t;return null===(t=this.stanzaInstance)||void 0===t?void 0:t.sendIQ(e)}),o.on("terminated",()=>{this.webrtcSessions=this.webrtcSessions.filter(e=>e.id!==o.id)}),this.webrtcSessions.push(o),this.emit(w,o)}async handleGenesysIceCandidate(e){const t=e.genesysWebrtc.params,n=this.getSessionById(t.sessionId);await n.addRemoteIceCandidate(t.sdp)}async handleGenesysTerminate(e){const t=e.genesysWebrtc.params;this.getSessionById(t.sessionId).onSessionTerminate(t.reason)}getSessionById(e){const t=this.getAllSessions().find(t=>t.id===e);if(!t){const t=new Error("Failed to find session by id");throw this.logger.error(t,{sessionId:e}),t}return t}async sendIq(e){if(!this.stanzaInstance)throw new Error("Failed to send iq because there was no stanza instance");return this.stanzaInstance.sendIQ(e)}async handleMessage(e){e.propose?await this.handlePropose(e):e.retract?this.handleRetract(e.retract.sessionId):e.accept?this.handledIncomingRtcSession(e.accept.sessionId,e):e.reject&&this.handledIncomingRtcSession(e.reject.sessionId,e)}async handleGenesysWebrtcStanza(e){const t=e.genesysWebrtc;return"offer"===t.method?this.handleGenesysOffer(e):"iceCandidate"===t.method?this.handleGenesysIceCandidate(e):"terminate"===t.method?this.handleGenesysTerminate(e):void 0}prepareSession(e){const t=this.pendingSessions[e.sid];if(t&&delete this.pendingSessions[t.sessionId],null==t?void 0:t.sdpOverXmpp)return void this.logger.debug("skipping creation of jingle webrtc session due to sdpOverXmpp on the pendingSession");const n="relay"===this.getIceTransportPolicy()&&l.isFirefox,i={options:e,logger:this.logger,id:e.sid,fromJid:e.peerID,peerID:e.peerID,optOutOfWebrtcStatsTelemetry:!!this.config.optOutOfWebrtcStatsTelemetry,conversationId:null==t?void 0:t.conversationId,fromUserId:null==t?void 0:t.fromJid,originalRoomJid:null==t?void 0:t.originalRoomJid,sessionType:null==t?void 0:t.sessionType,allowIPv6:this.config.allowIPv6,ignoreHostCandidatesFromRemote:n},r=new g.StanzaMediaSession(i);return this.proxyStatsForSession(r),r}proxyStatsForSession(e){e.on("stats",t=>{if(this.client.logger.stopReason)return;const n=JSON.parse(JSON.stringify(t)),i={conversationId:e.conversationId,sessionId:e.id,sessionType:e.sessionType},r=f.formatStatsEvent(n,i);this.addStatToQueue(r)})}addStatToQueue(e){if(this.config.optOutOfWebrtcStatsTelemetry)return;e.details._appId||(e.details._appId=this.logger.clientId,e.details._appName="streamingclient",e.details._appVersion=h.Client.version),e.details._originAppId=this.client.config.appId;const t=f.deepFlatten(e.details);Object.keys(t).forEach(e=>{const n=t[e];"boolean"==typeof n&&(t[e]=""+n)});const n={...e,details:t},i=p.calculatePayloadSize(n),r=this.statBuffer+i>this.currentMaxStatSize;this.statsArr.push(n),this.statBuffer+=i,r?this.flushStats():this.throttledSendStats()}getLogDetailsForPendingSessionId(e){const t={sessionId:e},n=this.pendingSessions[e];return n&&(t.sessionType=n.sessionType,t.conversationId=n.conversationId),t}flushStats(){this.throttledSendStats.flush()}async sendStats(){var e,t;const n=[];let i=0;for(const e of this.statsArr){const t=p.calculatePayloadSize(e);if(!(i+t<this.currentMaxStatSize))break;n.push(e),i+=t}if(this.statsArr.splice(0,n.length),this.statBuffer=this.statsArr.reduce((e,t)=>e+p.calculatePayloadSize(t),0),!n.length||this.client.isGuest)return;const r={appName:"streamingclient",appVersion:h.Client.version,originAppName:this.client.config.appName,originAppVersion:this.client.config.appVersion,actions:n};try{let e=this.client.config.authToken,t="diagnostics/newrelic/insights";this.client.backgroundAssistantMode&&(e=this.client.config.jwt,t+="/backgroundassistant"),await this.client.http.requestApi(t,{method:"post",responseType:"text",host:this.client.config.apiHost,authToken:e,logger:this.client.logger,data:r}),this.currentMaxStatSize=15e3}catch(i){if(!b.HttpClient.retryStatusCodes.has(null===(e=i.response)||void 0===e?void 0:e.status)&&navigator.onLine||(this.statsArr=[...n,...this.statsArr],this.statBuffer=this.statsArr.reduce((e,t)=>e+p.calculatePayloadSize(t),0)),413===(null===(t=i.response)||void 0===t?void 0:t.status)){const e=this.currentMaxStatSize;this.currentMaxStatSize-=this.statsSizeDecreaseAmount,this.logger.info("Failed to send stats due to 413, retrying with smaller set",{attemptedPayloadSize:e,newPayloadSize:this.currentMaxStatSize}),await this.sendStats()}else this.logger.error("Failed to send stats",{err:i,numberOfFailedStats:n.length},{skipServer:!navigator.onLine})}}addEventListeners(){this.client.on("connected",()=>(this.refreshIceServersTimer&&(clearInterval(this.refreshIceServersTimer),this.refreshIceServersTimer=null),this.refreshIceServersTimer=setInterval(this.refreshIceServers.bind(this),216e5),this.refreshIceServers().catch(e=>this.logger.error("Error fetching ice servers after streaming-client connected",{error:e,channelId:this.client.config.channelId})))),this.client.on("disconnected",()=>{clearInterval(this.refreshIceServersTimer),this.refreshIceServersTimer=null})}async handlePropose(e){if(e.from===this.jid)return;const t=e.propose.sessionId;let n=this.pendingSessions[t];const i=!!n,r=this.getSessionTypeByJid(e.from),s={sessionId:t,conversationId:e.propose.conversationId,sessionType:r,isDuplicatePropose:i};if(this.logger.info("propose received",s),!i){const{appId:i}=this.client.config,o={actionName:"WebrtcStats",details:{_eventTimestamp:(new Date).getTime(),_eventType:"firstPropose",conversationId:s.conversationId,sdpViaXmppRequested:!!e.propose.sdpOverXmpp,sessionId:t,sessionType:r}};this.addStatToQueue(o);const a=e.from,c=a;e.propose.originalRoomJid=e.propose.originalRoomJid||c,n={...e.propose,toJid:e.to,fromJid:a,sessionType:r,roomJid:c,id:t,sdpOverXmpp:e.propose.sdpOverXmpp},this.pendingSessions[t]=n}if(n.accepted)return this.logger.info("proceed already sent for this session, but sending another",s),void await this.acceptRtcSession(t);this.emit(_,Object.assign(n))}handleRetract(e){return this.logger.info("retract received",this.getLogDetailsForPendingSessionId(e)),delete this.pendingSessions[e],this.emit(v,e)}handledIncomingRtcSession(e,t){let n=t.accept?"accept":"reject";return this.logger.info(n+" received",this.getLogDetailsForPendingSessionId(e)),this.emit(S,e)}async initiateRtcSession(e){const t={to:e.jid,propose:{id:c.v4(),descriptions:[]}};if(e.stream)for(let n of Array.from(e.stream.getTracks()))t.propose.descriptions.push({media:n.kind});if(e.provideVideo){t.propose.descriptions.filter(e=>"video"===e.media).length>0||t.propose.descriptions.push({media:"video"})}if(e.provideAudio){t.propose.descriptions.filter(e=>"audio"===e.media).length>0||t.propose.descriptions.push({media:"audio"})}if(e.mediaPurpose&&t.propose.descriptions.push({media:e.mediaPurpose}),e.jid&&e.jid.match(/@conference/)){let n=t.propose.descriptions;0===n.length&&(n=[{media:"listener"}]);const i={type:"upgradeMedia",to:e.jid,id:c.v4(),from:this.jid,media:{conversationId:e.conversationId,sourceCommunicationId:e.sourceCommunicationId}};for(const e of n)i.media[e.media]=!0;await this.stanzaInstance.send("presence",i)}else await this.stanzaInstance.send("message",t),this.pendingSessions[t.propose.id]=t;return t.propose.id}async acceptRtcSession(e){const t=this.pendingSessions[e];if(!t)return void this.emit(I,"Cannot accept session because it is not pending or does not exist");const n={to:t.fromJid,proceed:{sessionId:e}};t.accepted=!0;const i=this.getLogDetailsForPendingSessionId(e);this.logger.info("sending jingle proceed",i),await this.stanzaInstance.send("message",n),this.logger.info("sent jingle proceed",i)}async rejectRtcSession(e,t=!1){const n=this.getLogDetailsForPendingSessionId(e),i=this.pendingSessions[e];if(i)if(delete this.pendingSessions[e],t)this.ignoredSessions.set(e,!0);else{const t={to:s.toBare(this.jid),reject:{sessionId:e}},r=this.stanzaInstance.send("message",t),o={to:i.fromJid,reject:{sessionId:e}},a=this.stanzaInstance.send("message",o);this.logger.info("sending jingle reject",n),await Promise.all([r,a]),this.logger.info("sent jingle reject",n)}else this.emit(I,"Cannot reject session because it is not pending or does not exist")}async rtcSessionAccepted(e){this.pendingSessions[e];const t=this.getLogDetailsForPendingSessionId(e),n={to:s.toBare(this.jid),accept:{sessionId:e}};this.logger.info("sending session-info:accept",t),await this.stanzaInstance.send("message",n),this.logger.info("sent session-info:accept",t)}async notifyScreenShareStart(e){return this.stanzaInstance.send("iq",{to:""+e.peerID,from:this.jid,type:"set",jingle:{action:a.JingleAction.SessionInfo,sid:e.id,screenstart:{}}})}async notifyScreenShareStop(e){return this.stanzaInstance.send("iq",{to:""+e.peerID,from:this.jid,type:"set",jingle:{action:a.JingleAction.SessionInfo,sid:e.id,screenstop:{}}})}async cancelRtcSession(e){const t=this.pendingSessions[e],n=this.getLogDetailsForPendingSessionId(e);if(!t)return void this.emit(I,"Cannot cancel session because it is not pending or does not exist");const i={to:t.toJid,retract:{sessionId:e}};delete this.pendingSessions[e],this.logger.info("sending jingle retract",n),await this.stanzaInstance.send("message",i),this.logger.info("sent jingle retract",n)}async refreshIceServers(){return this.refreshIceServersRetryPromise||(this.refreshIceServersRetryPromise=p.retryPromise(this._refreshIceServers.bind(this,this.stanzaInstance),e=>++this.discoRetries>2?(this.logger.warn("fetching ice servers failed. max retries reached.",{retryAttempt:this.discoRetries,MAX_DISCO_RETRIES:2,error:e,channelId:this.client.config.channelId}),!1):(this.logger.warn("fetching ice servers failed. retrying",{retryAttempt:this.discoRetries,error:e,channelId:this.client.config.channelId}),!0),0,this.client.logger)),this.refreshIceServersRetryPromise.promise.finally(()=>{this.discoRetries=0,this.refreshIceServersRetryPromise=void 0})}async _refreshIceServers(e){if(!e)throw new Error("No stanza instance to refresh ice servers");const t=e.config.server,n=e.getServices(t,"turn","1"),i=e.getServices(t,"stun","1"),r=new Promise((e,t)=>{setTimeout(()=>{t(new Error("Timeout waiting for refresh ice servers to finish"))},15e3),Promise.all([n,i]).then(([t,n])=>{e([t,n])}).catch(t)}),[s,o]=await r,a=[...s.services,...o.services].map(e=>{const t=e.port?":"+e.port:"",n={type:e.type,urls:`${e.type}:${e.host}${t}`};return["turn","turns"].includes(e.type)&&(e.transport&&"udp"!==e.transport&&(n.urls+="?transport="+e.transport),e.username&&(n.username=e.username),e.password&&(n.credential=e.password)),n});return this.setIceServers(a,e),o.services.length?this.setIceTransportPolicy("all",e):(this.logger.info('No stun servers received, setting iceTransportPolicy to "relay"'),this.setIceTransportPolicy("relay",e)),a}setIceServers(e,t){t.jingle.iceServers=e,this.iceServers=e}getIceTransportPolicy(){var e;return null===(e=this.stanzaInstance)||void 0===e?void 0:e.jingle.config.peerConnectionConfig.iceTransportPolicy}setIceTransportPolicy(e,t){t.jingle.config.peerConnectionConfig.iceTransportPolicy=e}getSessionTypeByJid(e){return p.isAcdJid(e)?m.SessionTypes.acdScreenShare:p.isScreenRecordingJid(e)?m.SessionTypes.screenRecording:p.isSoftphoneJid(e)?m.SessionTypes.softphone:p.isVideoJid(e)?m.SessionTypes.collaborateVideo:m.SessionTypes.unknown}getSessionManager(){var e;return null===(e=this.stanzaInstance)||void 0===e?void 0:e.jingle}getAllSessions(){var e;const t=null===(e=this.stanzaInstance)||void 0===e?void 0:e.jingle.sessions;return[...t&&Object.values(t)||[],...this.webrtcSessions]}proxyNRStat(e){this.addStatToQueue(e)}get expose(){return{on:this.on.bind(this),once:this.once.bind(this),off:this.off.bind(this),removeAllListeners:this.removeAllListeners.bind(this),removeListener:this.removeListener.bind(this),refreshIceServers:this.refreshIceServers.bind(this),acceptRtcSession:this.acceptRtcSession.bind(this),rejectRtcSession:this.rejectRtcSession.bind(this),cancelRtcSession:this.cancelRtcSession.bind(this),notifyScreenShareStart:this.notifyScreenShareStart.bind(this),notifyScreenShareStop:this.notifyScreenShareStop.bind(this),rtcSessionAccepted:this.rtcSessionAccepted.bind(this),initiateRtcSession:this.initiateRtcSession.bind(this),getSessionTypeByJid:this.getSessionTypeByJid.bind(this),getSessionManager:this.getSessionManager.bind(this),getAllSessions:this.getAllSessions.bind(this),proxyNRStat:this.proxyNRStat.bind(this)}}}t.WebrtcExtension=N},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TABLE_DATA=void 0,t.TABLE_DATA={"A.1":{r:"hk:if|le:lf|nf:nv|qg:qv|rg:rj|rm:rp|rr:rt|rv:s3|vn:vv|17m:17n|17q:17v|18g:19g|1an:1ao|1cb:1cg|1e5:1ef|1fb:1ff|1fl:1gb|1gd:1gq|1gs:1gu|1hr:1hv|1im:1iv|1ne:1nf|1pd:1pf|1qb:1rv|1ti:280|29q:29r|2ae:2af|2al:2an|2bh:2c0|2cd:2ce|2ch:2ci|2dj:2dl|2dq:2dr|2e5:2e6|2e9:2ea|2ee:2em|2eo:2er|2f4:2f5|2fr:2g1|2g3:2g4|2gb:2ge|2gh:2gi|2hq:2hr|2i3:2i6|2i9:2ia|2ie:2io|2iv:2j5|2jl:2k0|2lq:2lr|2me:2mf|2mh:2mv|2n1:2n5|2ng:2o0|2od:2oe|2oh:2oi|2pk:2pl|2pq:2pr|2q4:2q6|2q9:2qa|2qe:2ql|2qo:2qr|2r2:2r5|2rh:2s1|2sb:2sd|2sm:2so|2t0:2t2|2t5:2t7|2tb:2td|2tq:2tt|2u3:2u5|2ue:2um|2uo:2v6|2vj:300|31q:31t|32e:32k|32n:32v|332:335|33g:341|35q:35t|36e:36k|36n:36t|372:375|37g:381|39q:39t|3a4:3a5|3ae:3am|3ao:3av|3b2:3b5|3bg:3c1|3cn:3cp|3du:3dv|3e7:3e9|3eb:3ee|3f0:3fh|3fl:3g0|3hr:3hu|3is:3k0|3k5:3k6|3kb:3kc|3ke:3kj|3l8:3l9|3lu:3lv|3me:3mf|3mq:3mr|3mu:3nv|3rb:3rg|3sc:3sf|3ud:3ue|3ug:3vv|41j:41l|41q:41v|42q:44v|466:46f|47p:47q|47s:47v|4aq:4au|4d3:4d7|4fq:4fv|4ie:4if|4iu:4iv|4ke:4kf|4lm:4ln|4m6:4m7|4om:4on|4qr:4r0|4rt:4sv|4vl:500|5jn:5jv|5kt:5kv|5nh:5nv|5ol:5ov|5pn:5pv|5qk:5qv|5rk:5rv|5ut:5uv|5va:5vv|60q:60v|63o:63v|65a:7fv|7ks:7kv|7nq:7nv|7om:7on|7ou:7ov|7q6:7q7|7qe:7qf|7ru:7rv|7uk:7ul|7vg:7vh|82j:82m|82o:82u|834:839|83i:83j|84f:84v|85i:86f|87b:87v|89r:89s|8ac:8ai|8c4:8cf|8uf:8vv|917:91v|92b:92v|9gk:9gl|9ju:9jv|9ka:9o0|9oa:9ob|9qj:9ql|9qv:9r0|9sl:9sn|9tv:9uf|9vc:9vf|ao0:bjv|bnk:bnv|bum:bvf|bvs:bvv|c4n:c4o|c80:c84|c9d:c9g|cdo:cff|cgt:cgv|ci4:cig|cjs:cju|cmc:cmf|crn:crq|cuu:cuv|jdm:jfv|17t6:17vv|194d:194f|1967:1avv|1lt4:1lvv|1uhe:1uhf|1ujb:1unv|1uo7:1uoi|1uoo:1uos|1uti:1uui|1va0:1vaf|1vcg:1vch|1ve8:1vef|1vft:1vfv|1vgg:1vgv|1vh4:1vhf|1vi7:1vi8|1vjc:1vjf|1vnt:1vnu|1vtv:1vu1|1vu8:1vu9|1vug:1vuh|1vuo:1vup|1vut:1vuv|1vvf:1vvo|2000:20nv|20p4:20pf|20qb:20vv|2116:2117|212e:3jvv|3k7m:3k7v|3k97:3k99|3keu:3kvv|3l50:3l51|3l53:3l54|3l57:3l58|3l8b:3l8c|3la7:3la9|3ll4:3ll7|3lua:3lud|3m00:3vvt|59mn:5tvv|5ugu:5vvt|6000:7vvt|8000:9vvt|a000:bvvt|c000:dvvt|e000:fvvt|g000:hvvt|i000:jvvt|k000:lvvt|m000:nvvt|o000:pvvt|q000:rvvt|s002:s00v|s040:tvvt",s:"9p8|9qc|9qe|9qn|9tg|147|bkq|3l2l|3l4t|3l5d|3l5q|3l5s|3l61|3l64|3l86|3l8l|3l8t|3l9q|3l9v|3la5|3lah|16f|c20|ccf|cnv|cvv|1b0|1c8|1d2|1dq|1h0|1nv|1oe|284|2c4|2d9|2dh|2dt|2eu|2h9|2hh|2hk|2hn|2ht|2it|2k4|2kc|2ke|2ki|2l9|2lh|2lk|2m6|2ma|2o4|2p9|2ph|2qu|2s4|2sh|2sr|2st|2tm|2u9|304|30d|30h|319|31k|325|329|344|34d|34h|359|35k|365|369|36v|384|38d|38h|399|3a9|3c4|3di|3ds|3el|3en|3k3|3k9|3ko|3l0|3l4|3l6|3lc|3lq|3m5|3m7|3q8|3so|3tt|412|418|41b|4g7|4i7|4i9|4in|4ip|4k7|4k9|4lf|4lh|4lv|4m1|4mf|4mn|4nf|4of|4oh|4ov|4q7|h1|5od|5rd|5rh|60f|1upn|1upt|1upv|1uq2|1uq5|1vij|1vj7|1vjl|1vo0|1vv7|20ov|7qo|7qq|7qs|7qu|7tl|7u5|7us|7vl|7vv|sb|sd|s000|t2|97v|uf|9go|9o5"},"B.1":{r:"60b:60d|80b:80d|1vg0:1vgf",s:"5d|606|1vnv|830|qf"},"B.2":{m:"5l:ts|6v:3j;3j|9g:39;o7|a9:ls;3e|bv:3j|fg:3a;oc|q5:tp|rq:10;tp|sg:tp;o8;o1|tg:u5;o8;o1|u2:u3|ug:ti|uh:to|ui:u5|uj:ud|uk:ub|ul:u6|um:u0|vg:tq|vh:u1|vi:u3|vl:tl|1c7:1b5;1c2|7km:38;ph|7kn:3k;o8|7ko:3n;oa|7kp:3p;oa|7kq:31;lu|7kr:7j1|7qg:u5;oj|7qi:u5;oj;o0|7qk:u5;oj;o1|7qm:u5;oj;q2|7s0:7o0;tp|7s1:7o1;tp|7s2:7o2;tp|7s3:7o3;tp|7s4:7o4;tp|7s5:7o5;tp|7s6:7o6;tp|7s7:7o7;tp|7s8:7o0;tp|7s9:7o1;tp|7sa:7o2;tp|7sb:7o3;tp|7sc:7o4;tp|7sd:7o5;tp|7se:7o6;tp|7sf:7o7;tp|7sg:7p0;tp|7sh:7p1;tp|7si:7p2;tp|7sj:7p3;tp|7sk:7p4;tp|7sl:7p5;tp|7sm:7p6;tp|7sn:7p7;tp|7so:7p0;tp|7sp:7p1;tp|7sq:7p2;tp|7sr:7p3;tp|7ss:7p4;tp|7st:7p5;tp|7su:7p6;tp|7sv:7p7;tp|7t0:7r0;tp|7t1:7r1;tp|7t2:7r2;tp|7t3:7r3;tp|7t4:7r4;tp|7t5:7r5;tp|7t6:7r6;tp|7t7:7r7;tp|7t8:7r0;tp|7t9:7r1;tp|7ta:7r2;tp|7tb:7r3;tp|7tc:7r4;tp|7td:7r5;tp|7te:7r6;tp|7tf:7r7;tp|7ti:7rg;tp|7tj:th;tp|7tk:tc;tp|7tm:th;q2|7tn:th;q2;tp|7ts:th;tp|7tu:tp|7u2:7rk;tp|7u3:tn;tp|7u4:te;tp|7u6:tn;q2|7u7:tn;q2;tp|7uc:tn;tp|7ui:tp;o8;o0|7uj:tp;o8;o1|7um:tp;q2|7un:tp;o8;q2|7v2:u5;o8;o0|7v3:u5;o8;o1|7v4:u1;oj|7v6:u5;q2|7v7:u5;o8;q2|7vi:7rs;tp|7vj:u9;tp|7vk:ue;tp|7vm:u9;q2|7vn:u9;q2;tp|7vs:u9;tp|858:3i;3j|882:33|883:5g;33|887:ir|889:5g;36|88b:38|88c:38|88d:38|88g:39|88h:39|88i:3c|88l:3e|88m:3e;3f|88p:3g|88q:3h|88r:3i|88s:3i|88t:3i|890:3j;3d|891:3k;35;3c|892:3k;3d|894:3q|898:3q|89c:32|89d:33|89g:35|89h:36|89j:3d|89u:tj|89v:u0|8a5:34|crh:38;3g;31|crj:31;3l|crl:3f;3m|cs0:3g;31|cs1:3e;31|cs2:ts;31|cs3:3d;31|cs4:3b;31|cs5:3b;32|cs6:3d;32|cs7:37;32|csa:3g;36|csb:3e;36|csc:ts;36|csg:38;3q|csh:3b;38;3q|csi:3d;38;3q|csj:37;38;3q|csk:3k;38;3q|ct9:3g;31|cta:3b;3g;31|ctb:3d;3g;31|ctc:37;3g;31|ctk:3g;3m|ctl:3e;3m|ctm:ts;3m|ctn:3d;3m|cto:3b;3m|ctp:3d;3m|ctq:3g;3n|ctr:3e;3n|cts:ts;3n|ctt:3d;3n|ctu:3b;3n|ctv:3d;3n|cu0:3b;u9|cu1:3d;u9|cu3:32;3h|cu6:33;8gl;3b;37|cu7:33;3f;1e|cu8:34;32|cu9:37;3p|cub:38;3g|cud:3b;3b|cue:3b;3d|cun:3g;38|cup:3g;3g;3d|cuq:3g;3i|cus:3j;3m|cut:3n;32|1uo0:36;36|1uo1:36;39|1uo2:36;3c|1uo3:36;36;39|1uo4:36;36;3c|1uo5:3j;3k|1uo6:3j;3k|1uoj:1bk;1bm|1uok:1bk;1b5|1uol:1bk;1bb|1uom:1bu;1bm|1uon:1bk;1bd|3l00:31|3l01:32|3l02:33|3l03:34|3l04:35|3l05:36|3l06:37|3l07:38|3l08:39|3l09:3a|3l0a:3b|3l0b:3c|3l0c:3d|3l0d:3e|3l0e:3f|3l0f:3g|3l0g:3h|3l0h:3i|3l0i:3j|3l0j:3k|3l0k:3l|3l0l:3m|3l0m:3n|3l0n:3o|3l0o:3p|3l0p:3q|3l1k:31|3l1l:32|3l1m:33|3l1n:34|3l1o:35|3l1p:36|3l1q:37|3l1r:38|3l1s:39|3l1t:3a|3l1u:3b|3l1v:3c|3l20:3d|3l21:3e|3l22:3f|3l23:3g|3l24:3h|3l25:3i|3l26:3j|3l27:3k|3l28:3l|3l29:3m|3l2a:3n|3l2b:3o|3l2c:3p|3l2d:3q|3l38:31|3l39:32|3l3a:33|3l3b:34|3l3c:35|3l3d:36|3l3e:37|3l3f:38|3l3g:39|3l3h:3a|3l3i:3b|3l3j:3c|3l3k:3d|3l3l:3e|3l3m:3f|3l3n:3g|3l3o:3h|3l3p:3i|3l3q:3j|3l3r:3k|3l3s:3l|3l3t:3m|3l3u:3n|3l3v:3o|3l40:3p|3l41:3q|3l4s:31|3l4u:33|3l4v:34|3l52:37|3l55:3a|3l56:3b|3l59:3e|3l5a:3f|3l5b:3g|3l5c:3h|3l5e:3j|3l5f:3k|3l5g:3l|3l5h:3m|3l5i:3n|3l5j:3o|3l5k:3p|3l5l:3q|3l6g:31|3l6h:32|3l6i:33|3l6j:34|3l6k:35|3l6l:36|3l6m:37|3l6n:38|3l6o:39|3l6p:3a|3l6q:3b|3l6r:3c|3l6s:3d|3l6t:3e|3l6u:3f|3l6v:3g|3l70:3h|3l71:3i|3l72:3j|3l73:3k|3l74:3l|3l75:3m|3l76:3n|3l77:3o|3l78:3p|3l79:3q|3l84:31|3l85:32|3l87:34|3l88:35|3l89:36|3l8a:37|3l8d:3a|3l8e:3b|3l8f:3c|3l8g:3d|3l8h:3e|3l8i:3f|3l8j:3g|3l8k:3h|3l8m:3j|3l8n:3k|3l8o:3l|3l8p:3m|3l8q:3n|3l8r:3o|3l8s:3p|3l9o:31|3l9p:32|3l9r:34|3l9s:35|3l9t:36|3l9u:37|3la0:39|3la1:3a|3la2:3b|3la3:3c|3la4:3d|3la6:3f|3laa:3j|3lab:3k|3lac:3l|3lad:3m|3lae:3n|3laf:3o|3lag:3p|3lbc:31|3lbd:32|3lbe:33|3lbf:34|3lbg:35|3lbh:36|3lbi:37|3lbj:38|3lbk:39|3lbl:3a|3lbm:3b|3lbn:3c|3lbo:3d|3lbp:3e|3lbq:3f|3lbr:3g|3lbs:3h|3lbt:3i|3lbu:3j|3lbv:3k|3lc0:3l|3lc1:3m|3lc2:3n|3lc3:3o|3lc4:3p|3lc5:3q|3ld0:31|3ld1:32|3ld2:33|3ld3:34|3ld4:35|3ld5:36|3ld6:37|3ld7:38|3ld8:39|3ld9:3a|3lda:3b|3ldb:3c|3ldc:3d|3ldd:3e|3lde:3f|3ldf:3g|3ldg:3h|3ldh:3i|3ldi:3j|3ldj:3k|3ldk:3l|3ldl:3m|3ldm:3n|3ldn:3o|3ldo:3p|3ldp:3q|3lek:31|3lel:32|3lem:33|3len:34|3leo:35|3lep:36|3leq:37|3ler:38|3les:39|3let:3a|3leu:3b|3lev:3c|3lf0:3d|3lf1:3e|3lf2:3f|3lf3:3g|3lf4:3h|3lf5:3i|3lf6:3j|3lf7:3k|3lf8:3l|3lf9:3m|3lfa:3n|3lfb:3o|3lfc:3p|3lfd:3q|3lg8:31|3lg9:32|3lga:33|3lgb:34|3lgc:35|3lgd:36|3lge:37|3lgf:38|3lgg:39|3lgh:3a|3lgi:3b|3lgj:3c|3lgk:3d|3lgl:3e|3lgm:3f|3lgn:3g|3lgo:3h|3lgp:3i|3lgq:3j|3lgr:3k|3lgs:3l|3lgt:3m|3lgu:3n|3lgv:3o|3lh0:3p|3lh1:3q|3lhs:31|3lht:32|3lhu:33|3lhv:34|3li0:35|3li1:36|3li2:37|3li3:38|3li4:39|3li5:3a|3li6:3b|3li7:3c|3li8:3d|3li9:3e|3lia:3f|3lib:3g|3lic:3h|3lid:3i|3lie:3j|3lif:3k|3lig:3l|3lih:3m|3lii:3n|3lij:3o|3lik:3p|3lil:3q|3ljg:31|3ljh:32|3lji:33|3ljj:34|3ljk:35|3ljl:36|3ljm:37|3ljn:38|3ljo:39|3ljp:3a|3ljq:3b|3ljr:3c|3ljs:3d|3ljt:3e|3lju:3f|3ljv:3g|3lk0:3h|3lk1:3i|3lk2:3j|3lk3:3k|3lk4:3l|3lk5:3m|3lk6:3n|3lk7:3o|3lk8:3p|3lk9:3q|3ll8:th|3ll9:ti|3lla:tj|3llb:tk|3llc:tl|3lld:tm|3lle:tn|3llf:to|3llg:tp|3llh:tq|3lli:tr|3llj:ts|3llk:tt|3lll:tu|3llm:tv|3lln:u0|3llo:u1|3llp:to|3llq:u3|3llr:u4|3lls:u5|3llt:u6|3llu:u7|3llv:u8|3lm0:u9|3lmj:u3|3ln2:th|3ln3:ti|3ln4:tj|3ln5:tk|3ln6:tl|3ln7:tm|3ln8:tn|3ln9:to|3lna:tp|3lnb:tq|3lnc:tr|3lnd:ts|3lne:tt|3lnf:tu|3lng:tv|3lnh:u0|3lni:u1|3lnj:to|3lnk:u3|3lnl:u4|3lnm:u5|3lnn:u6|3lno:u7|3lnp:u8|3lnq:u9|3lod:u3|3los:th|3lot:ti|3lou:tj|3lov:tk|3lp0:tl|3lp1:tm|3lp2:tn|3lp3:to|3lp4:tp|3lp5:tq|3lp6:tr|3lp7:ts|3lp8:tt|3lp9:tu|3lpa:tv|3lpb:u0|3lpc:u1|3lpd:to|3lpe:u3|3lpf:u4|3lpg:u5|3lph:u6|3lpi:u7|3lpj:u8|3lpk:u9|3lq7:u3|3lqm:th|3lqn:ti|3lqo:tj|3lqp:tk|3lqq:tl|3lqr:tm|3lqs:tn|3lqt:to|3lqu:tp|3lqv:tq|3lr0:tr|3lr1:ts|3lr2:tt|3lr3:tu|3lr4:tv|3lr5:u0|3lr6:u1|3lr7:to|3lr8:u3|3lr9:u4|3lra:u5|3lrb:u6|3lrc:u7|3lrd:u8|3lre:u9|3ls1:u3|3lsg:th|3lsh:ti|3lsi:tj|3lsj:tk|3lsk:tl|3lsl:tm|3lsm:tn|3lsn:to|3lso:tp|3lsp:tq|3lsq:tr|3lsr:ts|3lss:tt|3lst:tu|3lsu:tv|3lsv:u0|3lt0:u1|3lt1:to|3lt2:u3|3lt3:u4|3lt4:u5|3lt5:u6|3lt6:u7|3lt7:u8|3lt8:u9|3ltr:u3",r:"23:2c|2i:2k|2m:2q|60:6m|6o:6u|bo:bp|c1:c2|c6:c7|c9:cb|ce:ch|cj:ck|cm:co|cs:ct|cv:d0|d6:d7|de:df|dh:dj|dn:do|e4:e5|e7:e8|ea:eb|fh:fi|fm:fo|s8:sa|se:sf|sh:t1|t3:tb|100:11f|19h:1am|7o8:7of|7oo:7ot|7p8:7pf|7po:7pv|7q8:7qd|7r8:7rf|7to:7tr|7u8:7ub|7uo:7ur|7v8:7vc|7vo:7vr|89a:89b|8b0:8bf|95m:96f|1vp1:1vpq|2100:2115",s:"v8|va|vc|ve|vk|130|132|134|136|138|13a|13c|13e|13g|13i|13k|13m|13o|13q|13s|13u|140|14a|14c|14e|14g|14i|14k|14m|14o|14q|14s|14u|150|152|154|156|158|15a|15c|15e|15g|15i|15k|15m|15o|15q|15s|15u|161|163|165|167|169|16b|16d|16g|16i|16k|16m|16o|16q|16s|16u|170|172|174|176|178|17a|17c|17e|17g|17i|17k|17o|180|182|184|186|188|18a|18c|18e|80|82|84|86|88|8a|8c|8e|8g|8i|8k|8m|8o|8q|8s|8u|90|92|94|96|98|9a|9c|9e|9i|9k|9m|9p|9r|9t|9v|a1|a3|a5|a7|aa|ac|ae|ag|ai|ak|am|ao|aq|as|au|b0|b2|b4|b6|b8|ba|bc|be|bg|bi|bk|bm|br|bt|c4|d2|d4|d9|dc|dl|ds|ed|ef|eh|ej|el|en|ep|er|eu|f0|f2|f4|f6|f8|fa|fc|fe|fk|fq|fs|fu|g0|g2|g4|g6|g8|ga|gc|ge|gg|gi|gk|gm|go|gq|gs|gu|h0|h2|h4|h6|h8|ha|hc|he|hg|hi|21|22|7g0|7g2|7g4|7g6|7g8|7ga|7gc|7ge|7gg|7gi|2d|7gk|7gm|7go|7gq|7gs|7gu|7h0|7h2|7h4|7h6|7h8|7ha|7hc|7he|7hg|7hi|7hk|7hm|7ho|7hq|7hs|7hu|7i0|7i2|7i4|7i6|7i8|7ia|7ic|7ie|7ig|7ii|7ik|7im|7io|7iq|7is|7iu|7j0|7j2|7j4|7j6|7j8|7ja|7jc|7je|7jg|7ji|7jk|7jm|2e|7jo|7jq|7js|7ju|7k0|7k2|7k4|7k6|7k8|7ka|7kc|7ke|7kg|7ki|7kk|7l0|7l2|7l4|7l6|7l8|7la|7lc|7le|7lg|7li|7lk|7lm|7lo|7lq|7ls|7lu|7m0|7m2|7m4|7m6|7m8|7ma|7mc|7me|7mg|7mi|7mk|7mm|7mo|7mq|2f|7ms|7mu|7n0|7n2|7n4|7n6|7n8|7na|7nc|7ne|7ng|7ni|7nk|7nm|7no|2g|7qp|7qr|7qt|7qv|2h|896|2l|s6|sc|uo|uq|us|uu|v0|v2|v4|v6"},"B.3":{m:"5l:ts|6v:3j;3j|9g:39;o7|a9:ls;3e|bv:3j|fg:3a;oc|q5:tp|sg:tp;o8;o1|tg:u5;o8;o1|u2:u3|ug:ti|uh:to|ul:u6|um:u0|vg:tq|vh:u1|vi:u3|vl:tl|1c7:1b5;1c2|7km:38;ph|7kn:3k;o8|7ko:3n;oa|7kp:3p;oa|7kq:31;lu|7kr:7j1|7qg:u5;oj|7qi:u5;oj;o0|7qk:u5;oj;o1|7qm:u5;oj;q2|7s0:7o0;tp|7s1:7o1;tp|7s2:7o2;tp|7s3:7o3;tp|7s4:7o4;tp|7s5:7o5;tp|7s6:7o6;tp|7s7:7o7;tp|7s8:7o0;tp|7s9:7o1;tp|7sa:7o2;tp|7sb:7o3;tp|7sc:7o4;tp|7sd:7o5;tp|7se:7o6;tp|7sf:7o7;tp|7sg:7p0;tp|7sh:7p1;tp|7si:7p2;tp|7sj:7p3;tp|7sk:7p4;tp|7sl:7p5;tp|7sm:7p6;tp|7sn:7p7;tp|7so:7p0;tp|7sp:7p1;tp|7sq:7p2;tp|7sr:7p3;tp|7ss:7p4;tp|7st:7p5;tp|7su:7p6;tp|7sv:7p7;tp|7t0:7r0;tp|7t1:7r1;tp|7t2:7r2;tp|7t3:7r3;tp|7t4:7r4;tp|7t5:7r5;tp|7t6:7r6;tp|7t7:7r7;tp|7t8:7r0;tp|7t9:7r1;tp|7ta:7r2;tp|7tb:7r3;tp|7tc:7r4;tp|7td:7r5;tp|7te:7r6;tp|7tf:7r7;tp|7ti:7rg;tp|7tj:th;tp|7tk:tc;tp|7tm:th;q2|7tn:th;q2;tp|7ts:th;tp|7tu:tp|7u2:7rk;tp|7u3:tn;tp|7u4:te;tp|7u6:tn;q2|7u7:tn;q2;tp|7uc:tn;tp|7ui:tp;o8;o0|7uj:tp;o8;o1|7um:tp;q2|7un:tp;o8;q2|7v2:u5;o8;o0|7v3:u5;o8;o1|7v4:u1;oj|7v6:u5;q2|7v7:u5;o8;q2|7vi:7rs;tp|7vj:u9;tp|7vk:ue;tp|7vm:u9;q2|7vn:u9;q2;tp|7vs:u9;tp|1uo0:36;36|1uo1:36;39|1uo2:36;3c|1uo3:36;36;39|1uo4:36;36;3c|1uo5:3j;3k|1uo6:3j;3k|1uoj:1bk;1bm|1uok:1bk;1b5|1uol:1bk;1bb|1uom:1bu;1bm|1uon:1bk;1bd",r:"23:2c|2i:2k|2m:2q|60:6m|6o:6u|bo:bp|c1:c2|c6:c7|c9:cb|ce:ch|cj:ck|cm:co|cs:ct|cv:d0|d6:d7|de:df|dh:dj|dn:do|e4:e5|e7:e8|ea:eb|fh:fi|fm:fo|s8:sa|se:sf|sh:t1|t3:tb|100:11f|19h:1am|7o8:7of|7oo:7ot|7p8:7pf|7po:7pv|7q8:7qd|7r8:7rf|7to:7tr|7u8:7ub|7uo:7ur|7v8:7vc|7vo:7vr|89a:89b|8b0:8bf|95m:96f|1vp1:1vpq|2100:2115",s:"v8|va|vc|ve|vk|130|132|134|136|138|13a|13c|13e|13g|13i|13k|13m|13o|13q|13s|13u|140|14a|14c|14e|14g|14i|14k|14m|14o|14q|14s|14u|150|152|154|156|158|15a|15c|15e|15g|15i|15k|15m|15o|15q|15s|15u|161|163|165|167|169|16b|16d|16g|16i|16k|16m|16o|16q|16s|16u|170|172|174|176|178|17a|17c|17e|17g|17i|17k|17o|180|182|184|186|188|18a|18c|18e|80|82|84|86|88|8a|8c|8e|8g|8i|8k|8m|8o|8q|8s|8u|90|92|94|96|98|9a|9c|9e|9i|9k|9m|9p|9r|9t|9v|a1|a3|a5|a7|aa|ac|ae|ag|ai|ak|am|ao|aq|as|au|b0|b2|b4|b6|b8|ba|bc|be|bg|bi|bk|bm|br|bt|c4|d2|d4|d9|dc|dl|ds|ed|ef|eh|ej|el|en|ep|er|eu|f0|f2|f4|f6|f8|fa|fc|fe|fk|fq|fs|fu|g0|g2|g4|g6|g8|ga|gc|ge|gg|gi|gk|gm|go|gq|gs|gu|h0|h2|h4|h6|h8|ha|hc|he|hg|hi|21|22|7g0|7g2|7g4|7g6|7g8|7ga|7gc|7ge|7gg|7gi|2d|7gk|7gm|7go|7gq|7gs|7gu|7h0|7h2|7h4|7h6|7h8|7ha|7hc|7he|7hg|7hi|7hk|7hm|7ho|7hq|7hs|7hu|7i0|7i2|7i4|7i6|7i8|7ia|7ic|7ie|7ig|7ii|7ik|7im|7io|7iq|7is|7iu|7j0|7j2|7j4|7j6|7j8|7ja|7jc|7je|7jg|7ji|7jk|7jm|2e|7jo|7jq|7js|7ju|7k0|7k2|7k4|7k6|7k8|7ka|7kc|7ke|7kg|7ki|7kk|7l0|7l2|7l4|7l6|7l8|7la|7lc|7le|7lg|7li|7lk|7lm|7lo|7lq|7ls|7lu|7m0|7m2|7m4|7m6|7m8|7ma|7mc|7me|7mg|7mi|7mk|7mm|7mo|7mq|2f|7ms|7mu|7n0|7n2|7n4|7n6|7n8|7na|7nc|7ne|7ng|7ni|7nk|7nm|7no|2g|7qp|7qr|7qt|7qv|2h|896|2l|s6|sc|uo|uq|us|uu|v0|v2|v4|v6"},"C.1.1":{s:"10"},"C.1.2":{r:"800:80b",s:"c00|50|5k0|81f|82v"},"C.2.1":{r:"0:v",s:"3v"},"C.2.2":{r:"40:4v|80c:80d|818:819|830:833|83a:83f|1vvp:1vvs|3kbj:3kbq",s:"1mt|1of|60e|1vnv"},"C.3":{r:"1o00:1u7v|u000:vvvt|10000:11vvt"},"C.4":{r:"1veg:1vff|1vvu:1vvv|3vvu:3vvv|5vvu:5vvv|7vvu:7vvv|9vvu:9vvv|bvvu:bvvv|dvvu:dvvv|fvvu:fvvv|hvvu:hvvv|jvvu:jvvv|lvvu:lvvv|nvvu:nvvv|pvvu:pvvv|rvvu:rvvv|tvvu:tvvv|vvvu:vvvv|11vvu:11vvv"},"C.5":{r:"1m00:1nvv"},"C.6":{r:"1vvp:1vvt"},"C.7":{r:"bvg:bvr"},"C.8":{r:"q0:q1|80e:80f|81a:81e|83a:83f"},"C.9":{r:"s010:s03v",s:"s001"},"D.1":{r:"1eg:1fa|1fg:1fk|1h1:1hq|1i0:1ia|1jd:1jf|1jh:1ml|1n5:1n6|1nq:1nu|1o0:1od|1oi:1pc|1s0:1t5|1uov:1up8|1upa:1upm|1upo:1ups|1uq0:1uq1|1uq3:1uq4|1uq6:1uth|1uuj:1v9t|1vag:1vcf|1vci:1ve7|1vfg:1vfs|1vjg:1vjk|1vjm:1vns",s:"1du|1e0|1e3|1gr|1gv|1mt|1og|1th|1uot|1upu|80f"},"D.2":{r:"21:2q|31:3q|60:6m|6o:7m|7o:h0|h2:hj|ig:ld|lg:lo|lr:m1|mg:mh|n0:n4|s8:sa|se:t1|t3:ue|ug:vl|100:142|14a:16e|16g:17l|17o:17p|180:18f|19h:1am|1ap:1av|1b1:1c7|285:29p|29t:2a0|2a9:2ac|2ao:2b1|2b4:2bg|2c2:2c3|2c5:2cc|2cf:2cg|2cj:2d8|2da:2dg|2dm:2dp|2du:2e0|2e7:2e8|2eb:2ec|2es:2et|2ev:2f1|2f6:2fh|2fk:2fq|2g5:2ga|2gf:2gg|2gj:2h8|2ha:2hg|2hi:2hj|2hl:2hm|2ho:2hp|2hu:2i0|2ip:2is|2j6:2jf|2ji:2jk|2k5:2kb|2kf:2kh|2kj:2l8|2la:2lg|2li:2lj|2ll:2lp|2lt:2m0|2mb:2mc|2n6:2nf|2o2:2o3|2o5:2oc|2of:2og|2oj:2p8|2pa:2pg|2pi:2pj|2pm:2pp|2pt:2pu|2q7:2q8|2qb:2qc|2qs:2qt|2qv:2r1|2r6:2rg|2s5:2sa|2se:2sg|2si:2sl|2sp:2sq|2su:2sv|2t3:2t4|2t8:2ta|2te:2tl|2tn:2tp|2tu:2tv|2u1:2u2|2u6:2u8|2ua:2uc|2v7:2vi|301:303|305:30c|30e:30g|30i:318|31a:31j|31l:31p|321:324|330:331|336:33f|342:343|345:34c|34e:34g|34i:358|35a:35j|35l:35p|360:364|367:368|36a:36b|36l:36m|370:371|376:37f|382:383|385:38c|38e:38g|38i:398|39a:39p|39u:3a0|3a6:3a8|3aa:3ac|3b0:3b1|3b6:3bf|3c2:3c3|3c5:3cm|3cq:3dh|3dj:3dr|3e0:3e6|3ef:3eh|3eo:3ev|3fi:3fk|3g1:3hg|3hi:3hj|3i0:3i6|3if:3ir|3k1:3k2|3k7:3k8|3kk:3kn|3kp:3kv|3l1:3l3|3la:3lb|3ld:3lg|3li:3lj|3m0:3m4|3mg:3mp|3ms:3mt|3o0:3on|3oq:3pk|3pu:3q7|3q9:3ra|3s8:3sb|3tu:3u5|3u7:3uc|400:411|413:417|419:41a|420:42n|450:465|46g:47o|480:4ap|4av:4d2|4d8:4fp|4g0:4g6|4g8:4i6|4ia:4id|4ig:4im|4iq:4it|4j0:4k6|4ka:4kd|4kg:4le|4li:4ll|4lo:4lu|4m2:4m5|4m8:4me|4mg:4mm|4mo:4ne|4ng:4oe|4oi:4ol|4oo:4ou|4p0:4q6|4q8:4qq|4r1:4rs|4t0:4vk|501:5jm|5k1:5kq|5l0:5ng|5o0:5oc|5oe:5oh|5p0:5ph|5pl:5pm|5q0:5qh|5r0:5rc|5re:5rg|5s0:5tm|5tu:5u5|5u7:5u8|5uk:5uq|5v0:5v9|60g:60p|610:63n|640:658|7g0:7kr|7l0:7np|7o0:7ol|7oo:7ot|7p0:7q5|7q8:7qd|7qg:7qn|7qv:7rt|7s0:7tk|7tm:7ts|7u2:7u4|7u6:7uc|7ug:7uj|7um:7ur|7v0:7vc|7vi:7vk|7vm:7vs|88a:88j|88p:88t|89a:89d|89f:89h|89j:89p|89t:89v|8a5:8a9|8b0:8c3|8pm:8rq|94s:979|c05:c07|c11:c19|c1h:c1l|c1o:c1s|c21:c4m|c4t:c4v|c51:c7q|c7s:c7v|c85:c9c|c9h:cce|ccg:cdn|cfg:cgs|ch0:ci3|cj0:cjr|cjv:clg|cm0:cmb|cmg:cnu|co0:crm|crr:cut|cv0:cvu|d00:jdl|jg0:17t5|1800:194c|1b00:1lt3|1m00:1uhd|1uhg:1uja|1uo0:1uo6|1uoj:1uon|1vp1:1vpq|1vq1:1vqq|1vr6:1vtu|1vu2:1vu7|1vua:1vuf|1vui:1vun|1vuq:1vus|20o0:20ou|20p0:20p3|20pg:20qa|2100:2115|2118:212d|3k00:3k7l|3k80:3k96|3k9a:3kb6|3kba:3kbi|3kc3:3kc4|3kcc:3kd9|3kde:3ket|3l00:3l2k|3l2m:3l4s|3l4u:3l4v|3l55:3l56|3l59:3l5c|3l5e:3l5p|3l5t:3l60|3l62:3l63|3l65:3l85|3l87:3l8a|3l8d:3l8k|3l8m:3l8s|3l8u:3l9p|3l9r:3l9u|3la0:3la4|3laa:3lag|3lai:3ll3|3ll8:3lu9|4000:59mm|5u00:5ugt|u000:vvvt|10000:11vvt",s:"3l52|3l5r|3la6|1c9|5a|5l|5q|283|2ag|2di|2en|2iu|2k3|2kd|2m9|2mg|2n0|2q0|2qn|2s3|2ss|2un|35u|36u|3an|3dt|3k4|3ka|3kd|3l5|3l7|3lt|3m6|3pm|3po|3rv|3s5|3uf|41c|41h|41o|47r|4i8|4io|4k8|4lg|4m0|4og|5us|ne|7qp|7qr|7qt|7tu|80e|83h|83v|882|887|88l|894|896|898|rq|s6|sc|8sl"}}},function(e,t,n){"use strict";const i=n(194),r=Symbol("max"),s=Symbol("length"),o=Symbol("lengthCalculator"),a=Symbol("allowStale"),c=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),d=Symbol("lruList"),p=Symbol("cache"),h=Symbol("updateAgeOnGet"),f=()=>1;const m=(e,t,n)=>{const i=e[p].get(t);if(i){const t=i.value;if(g(e,t)){if(b(e,i),!e[a])return}else n&&(e[h]&&(i.value.now=Date.now()),e[d].unshiftNode(i));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[c]&&n>e[c]},y=e=>{if(e[s]>e[r])for(let t=e[d].tail;e[s]>e[r]&&null!==t;){const n=t.prev;b(e,t),t=n}},b=(e,t)=>{if(t){const n=t.value;e[u]&&e[u](n.key,n.value),e[s]-=n.length,e[p].delete(n.key),e[d].removeNode(t)}};class _{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const v=(e,t,n,i)=>{let r=n.value;g(e,r)&&(b(e,n),e[a]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[r]=e.max||1/0;const t=e.length||f;if(this[o]="function"!=typeof t?f:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[h]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[r]=e||1/0,y(this)}get max(){return this[r]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,y(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[o]&&(this[o]=e,this[s]=0,this[d].forEach(e=>{e.length=this[o](e.value,e.key),this[s]+=e.length})),y(this)}get lengthCalculator(){return this[o]}get length(){return this[s]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let n=this[d].tail;null!==n;){const i=n.prev;v(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[d].head;null!==n;){const i=n.next;v(this,e,n,t),n=i}}keys(){return this[d].toArray().map(e=>e.key)}values(){return this[d].toArray().map(e=>e.value)}reset(){this[u]&&this[d]&&this[d].length&&this[d].forEach(e=>this[u](e.key,e.value)),this[p]=new Map,this[d]=new i,this[s]=0}dump(){return this[d].map(e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[d]}set(e,t,n){if((n=n||this[c])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,a=this[o](t,e);if(this[p].has(e)){if(a>this[r])return b(this,this[p].get(e)),!1;const o=this[p].get(e).value;return this[u]&&(this[l]||this[u](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[s]+=a-o.length,o.length=a,this.get(e),y(this),!0}const h=new _(e,t,a,i,n);return h.length>this[r]?(this[u]&&this[u](e,t),!1):(this[s]+=h.length,this[d].unshift(h),this[p].set(e,this[d].head),y(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!g(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[d].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[p].forEach((e,t)=>m(this,t,!1))}}},function(e,t,n){"use strict";function i(e){var t=this;if(t instanceof i||(t=new i),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n<r;n++)t.push(arguments[n]);return t}function r(e,t,n){var i=t===e.head?new a(n,null,t,e):new a(n,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function s(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function o(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,n,i){if(!(this instanceof a))return new a(e,t,n,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}e.exports=i,i.Node=a,i.create=i,i.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},i.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},i.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},i.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},i.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},i.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},i.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},i.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,i=0;null!==n;i++)e.call(t,n.value,i,this),n=n.next},i.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,i=this.length-1;null!==n;i--)e.call(t,n.value,i,this),n=n.prev},i.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},i.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},i.prototype.map=function(e,t){t=t||this;for(var n=new i,r=this.head;null!==r;)n.push(e.call(t,r.value,this)),r=r.next;return n},i.prototype.mapReverse=function(e,t){t=t||this;for(var n=new i,r=this.tail;null!==r;)n.push(e.call(t,r.value,this)),r=r.prev;return n},i.prototype.reduce=function(e,t){var n,i=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=e(n,i.value,r),i=i.next;return n},i.prototype.reduceReverse=function(e,t){var n,i=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=e(n,i.value,r),i=i.prev;return n},i.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},i.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},i.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new i;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=0,s=this.head;null!==s&&r<e;r++)s=s.next;for(;null!==s&&r<t;r++,s=s.next)n.push(s.value);return n},i.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new i;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=this.length,s=this.tail;null!==s&&r>t;r--)s=s.prev;for(;null!==s&&r>e;r--,s=s.prev)n.push(s.value);return n},i.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,s=this.head;null!==s&&i<e;i++)s=s.next;var o=[];for(i=0;s&&i<t;i++)o.push(s.value),s=this.removeNode(s);null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(i=0;i<n.length;i++)s=r(this,s,n[i]);return o},i.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=e,this};try{n(195)(i)}catch(e){}},function(e,t,n){"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt,a="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,u=a||c||Function("return this")(),l=Object.prototype.toString,d=Math.max,p=Math.min,h=function(){return u.Date.now()};function f(e,t,n){var i,r,s,o,a,c,u=0,l=!1,f=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=i,s=r;return i=r=void 0,u=t,o=e.apply(s,n)}function _(e){return u=e,a=setTimeout(S,t),l?b(e):o}function v(e){var n=e-c;return void 0===c||n>=t||n<0||f&&e-u>=s}function S(){var e=h();if(v(e))return w(e);a=setTimeout(S,function(e){var n=t-(e-c);return f?p(n,s-(e-u)):n}(e))}function w(e){return a=void 0,y&&i?b(e):(i=r=void 0,o)}function T(){var e=h(),n=v(e);if(i=arguments,r=this,c=e,n){if(void 0===a)return _(c);if(f)return a=setTimeout(S,t),b(c)}return void 0===a&&(a=setTimeout(S,t)),o}return t=g(t)||0,m(n)&&(l=!!n.leading,s=(f="maxWait"in n)?d(g(n.maxWait)||0,t):s,y="trailing"in n?!!n.trailing:y),T.cancel=function(){void 0!==a&&clearTimeout(a),u=0,i=c=r=a=void 0},T.flush=function(){return void 0===a?o:w(h())},T}function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==l.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var a=r.test(e);return a||s.test(e)?o(e.slice(2),a?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return m(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),f(e,t,{leading:i,maxWait:t,trailing:r})}}).call(this,n(15))},function(e,t,n){e.exports=function(){"use strict";var e="undefined"==typeof window,t=!1,n=!1,i=!1,r=!1,s=!1,o=!1,a=!1,c=!1,u=!1,l=!1;return e||(t="undefined"!=typeof InstallTrigger,n=!!window.chrome,i=!(!window.chrome||!window.navigator||!window.navigator.plugins||!window.navigator.plugins.namedItem("Chrome PDF Plugin")&&!window.chrome.runtime),r=n&&!window.chrome.webstore&&!window.chrome.runtime,s=0<Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")||window.safari&&window.safari.pushNotification,o=!!window.opr&&!!window.opr.addons||!!window.opera,a=!!window.StyleMedia,c=n&&!!navigator.userAgent.match(/edg/i),u=(i||o)&&!!window.CSS,l=!(n||s||t||o||!document.documentMode)),{get isChrome(){return i},get isChromeOrChromium(){return n},get isChromium(){return r},get isFirefox(){return t},get isSafari(){return s},get isOpera(){return o},get isEdge(){return a},get isEdgeChromium(){return c},get isIE(){return l},get isBlink(){return u}}}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.definitions=void 0;const i=n(2),r=n(1),s={aliases:["message.propose"],element:"propose",fields:{conversationId:i.attribute("inin-cid"),persistentConversationId:i.attribute("inin-persistent-cid"),sdpOverXmpp:i.booleanAttribute("inin-sdp-over-xmpp"),originalRoomJid:i.attribute("inin-ofrom"),autoAnswer:i.booleanAttribute("inin-autoanswer"),fromUserId:i.attribute("inin-user-id"),sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},o={aliases:["message.proceed"],element:"proceed",fields:{sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},a={aliases:["message.accept"],element:"accept",fields:{sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},c={aliases:["message.reject"],element:"reject",fields:{sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},u={aliases:["message.retract"],element:"retract",fields:{sessionId:i.attribute("id")},namespace:"urn:xmpp:jingle-message:0"},l={aliases:["iq.jingle.screenstart"],element:"screen-start",namespace:r.NS_JINGLE_RTP_INFO_1},d={aliases:["iq.jingle.screenstop"],element:"screen-stop",namespace:r.NS_JINGLE_RTP_INFO_1},p={path:"iq",namespace:r.NS_CLIENT,element:"iq",fields:{genesysWebrtc:i.childJSON("genesys","genesys-webrtc")}},h={path:"message",namespace:r.NS_CLIENT,element:"message",fields:{mediaMessage:i.childJSON("genesys","media-message")}},f={aliases:["presence.media"],element:"x",fields:{conversationId:i.attribute("conversationId"),sourceCommunicationId:i.attribute("sourceCommunicationId"),screenShare:i.childAttribute(null,"mediastream","screenShare"),video:i.childAttribute(null,"mediastream","video"),audio:i.childAttribute(null,"mediastream","audio"),listener:i.childAttribute(null,"mediastream","listener"),screenRecording:i.childAttribute(null,"mediastream","screenRecording")},namespace:"orgspan:mediastream"};t.definitions=[s,o,a,c,u,l,d,f,p,h]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(24),s=(0,i.__importDefault)(n(200)),o=(0,i.__importDefault)(n(55));t.default=class{constructor(){this.translators=new Map,this.root=new o.default,this.setLanguageResolver(r.basicLanguageResolver)}setLanguageResolver(e){this.languageResolver=e}import(e,t={registry:this}){if(!this.hasTranslator(e.getNamespace(),e.getName()))return;t.acceptLanguages||(t.acceptLanguages=[]),t.acceptLanguages=t.acceptLanguages.map(e=>e.toLowerCase()),t.lang&&(t.lang=t.lang.toLowerCase()),t.resolveLanguage||(t.resolveLanguage=this.languageResolver),t.path=this.getImportKey(e),t.sanitizers||(t.sanitizers={xhtmlim:s.default});return this.getOrCreateTranslator(e.getNamespace(),e.getName()).import(e,{...t,registry:this})}export(e,t,n={registry:this}){n.acceptLanguages||(n.acceptLanguages=[]),n.acceptLanguages=n.acceptLanguages.map(e=>e.toLowerCase()),n.lang&&(n.lang=n.lang.toLowerCase()),n.sanitizers||(n.sanitizers={xhtmlim:s.default}),n.path=e;const i=e.split(".").filter(e=>""!==e);let r=this.root;for(const e of i){const t=r.getChild(e);if(!t)return;r=t}return r.export(t,{...n,registry:this})}getImportKey(e,t=""){const n=t?this.walkToTranslator(t.split(".")):this.root;if(n)return n.getImportKey(e)}define(e){if(Array.isArray(e)){for(const t of e)"object"==typeof t?this.define(t):t(this);return}if("object"!=typeof e)return void e(this);const t=e;t.aliases=t.aliases||[],t.path&&!t.aliases.includes(t.path)&&t.aliases.push(t.path);const n=t.aliases.map(e=>"string"==typeof e?{path:e}:e).sort((e,t)=>{const n=e.path.split(".").length;return t.path.split(".").length-n});let i;if(this.hasTranslator(t.namespace,t.element)&&(i=this.getOrCreateTranslator(t.namespace,t.element)),!i){let e;for(const t of n){const n=this.walkToTranslator(t.path.split("."));if(n&&!n.placeholder){i=n;break}n&&(e=n)}e&&!i&&(i=e,i.placeholder=!1)}i||(i=this.getOrCreateTranslator(t.namespace,t.element)),this.indexTranslator(t.namespace,t.element,i);const r=t.fields||{},s=new Map,o=new Map,a=new Map,c=new Map;t.typeField&&(i.typeField=t.typeField),t.defaultType&&(i.defaultType=t.defaultType),t.versionField&&(i.versionField=t.versionField),t.defaultVersion&&(i.defaultVersion=t.defaultVersion),t.languageField&&(i.languageField=t.languageField);for(const[e,t]of Object.entries(r))s.set(e,t.importer),a.set(e,t.importOrder||t.order||0),o.set(e,t.exporter),c.set(e,t.exportOrder||t.order||0);if(t.childrenExportOrder)for(const[e,n]of Object.entries(t.childrenExportOrder))c.set(e,n||0);const u=new Map;for(const[e,n]of Object.entries(t.optionalNamespaces||{}))u.set(e,n);i.updateDefinition({contexts:new Map,element:t.element,exporterOrdering:c,exporters:o,importerOrdering:a,importers:s,namespace:t.namespace,optionalNamespaces:u,type:t.type,version:t.version,typeOrder:t.typeOrder});for(const e of n)this.alias(t.namespace,t.element,e.path,e.multiple,e.selector,e.contextField,t.type,e.impliedType);for(const e of n){const t=this.walkToTranslator(e.path.split("."));t&&t!==i&&t.replaceWith(i)}}alias(e,t,n,i=!1,r,s,o,a=!1){const c=this.getOrCreateTranslator(e,t);c.placeholder=!1;const u=n.split(".").filter(e=>""!==e),l=u.pop(),d=this.walkToTranslator(u,!0),p=`{${e}}${t}`;o&&(s||a)&&c.addContext(n,r,s,p,o,a),d.addChild(l,c,i,r,p)}walkToTranslator(e,t=!1){let n=this.root;for(const i of e){let e=n.getChild(i);if(!e){if(!t)return;e=new o.default,e.placeholder=!0,n.addChild(i,e)}n=e}return n}hasTranslator(e,t){return this.translators.has(`{${e}}${t}`)}getOrCreateTranslator(e,t){let n=this.translators.get(`{${e}}${t}`);return n||(n=new o.default,this.indexTranslator(e,t,n)),n}indexTranslator(e,t,n){this.translators.set(`{${e}}${t}`,n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=new Set(["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul"]),r=new Set(["style"]),s=new Map([["a",new Set(["href","style"])],["body",new Set(["style","xml:lang"])],["blockquote",r],["br",r],["cite",r],["em",r],["img",new Set(["alt","height","src","style","width"])],["li",r],["ol",r],["p",r],["span",r],["strong",r],["ul",r]]),o=new Map([["font-style",/normal|italic|oblique|inherit/i],["font-weight",/normal|bold|bolder|lighter|inherit|\d\d\d/i],["text-decoration",/none|underline|overline|line-through|blink|inherit/i]]),a=e=>!!e.match(/^(https?|xmpp|cid|mailto|ftps?|im|ircs?|sips?|tel|geo|bitcoin|magnet):/i)&&e,c=e=>!!e.match(/^[0-9]*$/)&&e,u={alt:e=>e,height:c,href:a,src:a,style:e=>{const t=(";"+e).replace(/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,"").replace(/\/\*.*/,"").replace(/\\([a-fA-F0-9]{1,6})\s?/,(e,t)=>String.fromCharCode(parseInt(t,16))).match(/;\s*([a-z-]+)\s*:\s*([^;]*[^\s;])\s*/g),n=[];if(!t)return!1;for(const e of t){const t=e.match(/^;\s*([a-z-]+)\s*:\s*([^;]*[^\s])\s*$/);if(!t)continue;const i=o.get(t[1]);if(i){const e=t[2].match(i);e&&n.push(`${t[1]}:${e[0]}`)}}return!!n.length&&n.join("")},width:c};function l(e){if("string"==typeof e)return e;if(!i.has(e.name)){if("script"===e.name)return;return function(e){let t=[];for(const n of e.children)if("string"==typeof n)t.push(n);else{const e=l(n);e&&(Array.isArray(e)?t=t.concat(e):t.push(e))}return t}(e)}const t=e.children.map(l).filter(e=>void 0!==e),n={};for(const[t,i]of Object.entries(e.attributes)){const r=s.get(e.name);if(!r||!r.has(t))continue;if(!i)continue;const o=u[t](i);o&&(n[t]=o)}return{attributes:n,children:t,name:e.name}}t.default=function(e){if("string"==typeof e)return;let t=[];for(const n of e.children){if(!n)continue;if("string"==typeof n){t.push(n);continue}const e=l(n);Array.isArray(e)?t=t.concat(e):e&&t.push(e)}const n={};return"body"===e.name?(void 0!==e.attributes.xmlns&&(n.xmlns=e.attributes.xmlns),e.attributes.style&&(n.style=e.attributes.style),void 0!==e.attributes["xml:lang"]&&(n["xml:lang"]=e.attributes["xml:lang"]),{attributes:n,children:t,name:"body"}):void 0}},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,i=u(e),o=i[0],a=i[1],c=new s(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),l=0,d=a>0?o-4:o;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,s=[],o=0,a=n-r;o<a;o+=16383)s.push(l(e,o,o+16383>a?a:o+16383));1===r?(t=e[n-1],s.push(i[t>>2]+i[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],s.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return s.join("")};for(var i=[],r=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)i[a]=o[a],r[o.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var r,s,o=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(i[(s=r)>>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(e,t,n){"use strict";
|
|
32
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */t.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,c=(1<<a)-1,u=c>>1,l=-7,d=n?r-1:0,p=n?-1:1,h=e[t+d];for(d+=p,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+d],d+=p,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+d],d+=p,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=u}return(h?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var o,a,c,u=8*s-r-1,l=(1<<u)-1,d=l>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=l?(a=0,o=l):o+d>=1?(a=(t*c-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+h]=255&a,h+=f,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;e[n+h]=255&o,h+=f,o/=256,u-=8);e[n+h-f]|=128*m}},function(e,t,n){"use strict";var i=n(9).Buffer;t.BufferList=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}concat(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t,n,r,s=i.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=s,r=a,t.copy(n,r),a+=o.data.length,o=o.next;return s}}},function(e,t,n){"use strict";e.exports=r;var i=n(61);function r(e){if(!(this instanceof r))return new r(e);i.call(this,e)}Object.create(n(20)).inherits(r,i),r.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(9),s=(0,i.__importDefault)(n(19));function o(e,t){return e<<t|e>>>32-t}function a(e,t,n,i,r,s,a){return o(e+(t&n|~t&i)+r+s|0,a)+t|0}function c(e,t,n,i,r,s,a){return o(e+(t&i|n&~i)+r+s|0,a)+t|0}function u(e,t,n,i,r,s,a){return o(e+(t^n^i)+r+s|0,a)+t|0}function l(e,t,n,i,r,s,a){return o(e+(n^(t|~i))+r+s|0,a)+t|0}class d extends s.default{constructor(){super(64,56,"le"),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._m=new Array(16)}_update(e){const t=this._m;for(let n=0;n<16;++n)t[n]=e.readInt32LE(4*n);let n=this._a,i=this._b,r=this._c,s=this._d;n=a(n,i,r,s,t[0],3614090360,7),s=a(s,n,i,r,t[1],3905402710,12),r=a(r,s,n,i,t[2],606105819,17),i=a(i,r,s,n,t[3],3250441966,22),n=a(n,i,r,s,t[4],4118548399,7),s=a(s,n,i,r,t[5],1200080426,12),r=a(r,s,n,i,t[6],2821735955,17),i=a(i,r,s,n,t[7],4249261313,22),n=a(n,i,r,s,t[8],1770035416,7),s=a(s,n,i,r,t[9],2336552879,12),r=a(r,s,n,i,t[10],4294925233,17),i=a(i,r,s,n,t[11],2304563134,22),n=a(n,i,r,s,t[12],1804603682,7),s=a(s,n,i,r,t[13],4254626195,12),r=a(r,s,n,i,t[14],2792965006,17),i=a(i,r,s,n,t[15],1236535329,22),n=c(n,i,r,s,t[1],4129170786,5),s=c(s,n,i,r,t[6],3225465664,9),r=c(r,s,n,i,t[11],643717713,14),i=c(i,r,s,n,t[0],3921069994,20),n=c(n,i,r,s,t[5],3593408605,5),s=c(s,n,i,r,t[10],38016083,9),r=c(r,s,n,i,t[15],3634488961,14),i=c(i,r,s,n,t[4],3889429448,20),n=c(n,i,r,s,t[9],568446438,5),s=c(s,n,i,r,t[14],3275163606,9),r=c(r,s,n,i,t[3],4107603335,14),i=c(i,r,s,n,t[8],1163531501,20),n=c(n,i,r,s,t[13],2850285829,5),s=c(s,n,i,r,t[2],4243563512,9),r=c(r,s,n,i,t[7],1735328473,14),i=c(i,r,s,n,t[12],2368359562,20),n=u(n,i,r,s,t[5],4294588738,4),s=u(s,n,i,r,t[8],2272392833,11),r=u(r,s,n,i,t[11],1839030562,16),i=u(i,r,s,n,t[14],4259657740,23),n=u(n,i,r,s,t[1],2763975236,4),s=u(s,n,i,r,t[4],1272893353,11),r=u(r,s,n,i,t[7],4139469664,16),i=u(i,r,s,n,t[10],3200236656,23),n=u(n,i,r,s,t[13],681279174,4),s=u(s,n,i,r,t[0],3936430074,11),r=u(r,s,n,i,t[3],3572445317,16),i=u(i,r,s,n,t[6],76029189,23),n=u(n,i,r,s,t[9],3654602809,4),s=u(s,n,i,r,t[12],3873151461,11),r=u(r,s,n,i,t[15],530742520,16),i=u(i,r,s,n,t[2],3299628645,23),n=l(n,i,r,s,t[0],4096336452,6),s=l(s,n,i,r,t[7],1126891415,10),r=l(r,s,n,i,t[14],2878612391,15),i=l(i,r,s,n,t[5],4237533241,21),n=l(n,i,r,s,t[12],1700485571,6),s=l(s,n,i,r,t[3],2399980690,10),r=l(r,s,n,i,t[10],4293915773,15),i=l(i,r,s,n,t[1],2240044497,21),n=l(n,i,r,s,t[8],1873313359,6),s=l(s,n,i,r,t[15],4264355552,10),r=l(r,s,n,i,t[6],2734768916,15),i=l(i,r,s,n,t[13],1309151649,21),n=l(n,i,r,s,t[4],4149444226,6),s=l(s,n,i,r,t[11],3174756917,10),r=l(r,s,n,i,t[2],718787259,15),i=l(i,r,s,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+i|0,this._c=this._c+r|0,this._d=this._d+s|0}_hash(){const e=r.Buffer.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e}}t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(9),s=(0,i.__importDefault)(n(19)),o=[1518500249,1859775393,-1894007588,-899497514];function a(e){return e<<5|e>>>27}function c(e){return e<<30|e>>>2}function u(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}class l extends s.default{constructor(){super(64,56),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this._w=new Array(80)}_update(e){const t=this._w;let n,i=0|this._a,r=0|this._b,s=0|this._c,l=0|this._d,d=0|this._e;for(n=0;n<16;++n)t[n]=e.readInt32BE(4*n);for(;n<80;++n)t[n]=(p=t[n-3]^t[n-8]^t[n-14]^t[n-16])<<1|p>>>31;var p;for(let e=0;e<80;++e){const n=~~(e/20),p=a(i)+u(n,r,s,l)+d+t[e]+o[n]|0;d=l,l=s,s=c(r),r=i,i=p}this._a=i+this._a|0,this._b=r+this._b|0,this._c=s+this._c|0,this._d=l+this._d|0,this._e=d+this._e|0}_hash(){const e=r.Buffer.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e}}t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(9),s=(0,i.__importDefault)(n(19)),o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function a(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function u(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function l(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function d(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}class p extends s.default{constructor(){super(64,56),this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this._w=new Array(64)}_update(e){const t=this._w;let n,i=0|this._a,r=0|this._b,s=0|this._c,p=0|this._d,h=0|this._e,f=0|this._f,m=0|this._g,g=0|this._h;for(n=0;n<16;++n)t[n]=e.readInt32BE(4*n);for(;n<64;++n)t[n]=0|(((y=t[n-2])>>>17|y<<15)^(y>>>19|y<<13)^y>>>10)+t[n-7]+d(t[n-15])+t[n-16];var y;for(let e=0;e<64;++e){const n=g+l(h)+a(h,f,m)+o[e]+t[e]|0,d=u(i)+c(i,r,s)|0;g=m,m=f,f=h,h=p+n|0,p=s,s=r,r=i,i=n+d|0}this._a=i+this._a|0,this._b=r+this._b|0,this._c=s+this._c|0,this._d=p+this._d|0,this._e=h+this._e|0,this._f=f+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0}_hash(){const e=r.Buffer.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e}}t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(9),s=(0,i.__importDefault)(n(19)),o=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function a(e,t,n){return n^e&(t^n)}function c(e,t,n){return e&t|n&(e|t)}function u(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function l(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function h(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function f(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function m(e,t){return e>>>0<t>>>0?1:0}class g extends s.default{constructor(){super(128,112),this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this._w=new Array(160)}_update(e){const t=this._w;let n,i,r=0|this._ah,s=0|this._bh,g=0|this._ch,y=0|this._dh,b=0|this._eh,_=0|this._fh,v=0|this._gh,S=0|this._hh,w=0|this._al,T=0|this._bl,I=0|this._cl,N=0|this._dl,A=0|this._el,E=0|this._fl,x=0|this._gl,R=0|this._hl,C=0;for(C=0;C<32;C+=2)t[C]=e.readInt32BE(4*C),t[C+1]=e.readInt32BE(4*C+4);for(;C<160;C+=2){let e=t[C-30],r=t[C-30+1];const s=d(e,r),o=p(r,e);e=t[C-4],r=t[C-4+1];const a=h(e,r),c=f(r,e),u=t[C-14],l=t[C-14+1],g=t[C-32],y=t[C-32+1];i=o+l|0,n=s+u+m(i,o)|0,i=i+c|0,n=n+a+m(i,c)|0,i=i+y|0,n=n+g+m(i,y)|0,t[C]=n,t[C+1]=i}for(let e=0;e<160;e+=2){n=t[e],i=t[e+1];const d=c(r,s,g),p=c(w,T,I),h=u(r,w),f=u(w,r),C=l(b,A),O=l(A,b),k=o[e],P=o[e+1],j=a(b,_,v),L=a(A,E,x);let M=R+O|0,D=S+C+m(M,R)|0;M=M+L|0,D=D+j+m(M,L)|0,M=M+P|0,D=D+k+m(M,P)|0,M=M+i|0,D=D+n+m(M,i)|0;const B=f+p|0,F=h+d+m(B,f)|0;S=v,R=x,v=_,x=E,_=b,E=A,A=N+M|0,b=y+D+m(A,N)|0,y=g,N=I,g=s,I=T,s=r,T=w,w=M+B|0,r=D+F+m(w,M)|0}this._al=this._al+w|0,this._bl=this._bl+T|0,this._cl=this._cl+I|0,this._dl=this._dl+N|0,this._el=this._el+A|0,this._fl=this._fl+E|0,this._gl=this._gl+x|0,this._hl=this._hl+R|0,this._ah=this._ah+r+m(this._al,w)|0,this._bh=this._bh+s+m(this._bl,T)|0,this._ch=this._ch+g+m(this._cl,I)|0,this._dh=this._dh+y+m(this._dl,N)|0,this._eh=this._eh+b+m(this._el,A)|0,this._fh=this._fh+_+m(this._fl,E)|0,this._gh=this._gh+v+m(this._gl,x)|0,this._hh=this._hh+S+m(this._hl,R)|0}_hash(){const e=r.Buffer.allocUnsafe(64);function t(t,n,i){e.writeInt32BE(t,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e}}t.default=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(9),s=n(36),o=(0,i.__importDefault)(n(56)),a=r.Buffer.alloc(128);class c extends s.Transform{constructor(e,t){super(),"string"==typeof t&&(t=r.Buffer.from(t));const n="sha512"===e?128:64;this._alg=e,t.length>n?t=(0,o.default)(e).update(t).digest():t.length<n&&(t=r.Buffer.concat([t,a],n)),this._ipad=r.Buffer.alloc(n),this._opad=r.Buffer.alloc(n);for(let e=0;e<n;e++)this._ipad[e]=54^t[e],this._opad[e]=92^t[e];this._hash=(0,o.default)(e).update(this._ipad)}_transform(e,t,n){let i;try{this.update(e,t)}catch(e){i=e}finally{n(i)}}_flush(e){let t;try{this.push(this._final())}catch(e){t=e}e(t)}_final(){const e=this._hash.digest();return(0,o.default)(this._alg).update(this._opad).update(e).digest()}update(e,t){return this._hash.update(e,t),this}digest(e){const t=this._final()||r.Buffer.alloc(0);return e?t.toString(e):t}}t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pubsubItemContentAliases=t.extendStanzaError=t.extendStreamFeatures=t.extendIQ=t.extendPresence=t.extendMessage=t.addAlias=t.childJID=t.childJIDAttribute=t.JIDAttribute=void 0;const i=n(1),r=n(35);t.JIDAttribute=r.attribute,t.childJIDAttribute=r.childAttribute,t.childJID=r.childText,t.addAlias=function(e,t,n){return{aliases:Array.isArray(n)?n:[n],element:t,fields:{},namespace:e}},t.extendMessage=function(e){return{element:"message",fields:e,namespace:i.NS_CLIENT}},t.extendPresence=function(e){return{element:"presence",fields:e,namespace:i.NS_CLIENT}},t.extendIQ=function(e){return{element:"iq",fields:e,namespace:i.NS_CLIENT}},t.extendStreamFeatures=function(e){return{element:"features",fields:e,namespace:i.NS_STREAM}},t.extendStanzaError=function(e){return{element:"error",fields:e,namespace:i.NS_STANZAS,path:"stanzaError"}},t.pubsubItemContentAliases=function(){return[{path:"pubsubcontent",contextField:"itemType"},{path:"pubsubitem.content",contextField:"itemType"},{path:"pubsubeventitem.content",contextField:"itemType"},{path:"iq.pubsub.publish.items",contextField:"itemType"}]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(7),s=(0,i.__importDefault)(n(23)),o=(0,i.__importDefault)(n(34)),a=(0,i.__importDefault)(n(37));class c extends r.Transform{constructor(e){super({objectMode:!0}),this.closedStream=!1,this.wrappedStream=!1,this.registry=e.registry,this.acceptLanguages=e.acceptLanguages||[],e.wrappedStream&&(this.wrappedStream=!0,this.rootImportKey=e.rootKey),this.parser=new a.default({allowComments:e.allowComments}),this.parser.on("error",e=>{this.destroy(e)}),this.parser.on("startElement",(e,t)=>{if(this.destroyed)return;if(this.closedStream)return this.destroy(o.default.alreadyClosed());const n=new s.default(e,t),i=this.registry.getImportKey(n);if(this.wrappedStream&&!this.rootElement){if(this.rootImportKey&&i!==this.rootImportKey)return this.destroy(o.default.unknownRoot());const e=this.registry.import(n,{acceptLanguages:this.acceptLanguages,lang:this.lang});return e?(this.rootElement=n,void this.push({event:"stream-start",kind:i,stanza:e,xml:n})):this.destroy(o.default.notWellFormed())}this.currentElement?this.currentElement=this.currentElement.appendChild(n):this.currentElement=n}),this.parser.on("endElement",e=>{if(!this.destroyed){if(this.wrappedStream&&!this.currentElement)return this.rootElement&&e===this.rootElement.name?(this.closedStream=!0,this.push({event:"stream-end",kind:this.rootImportKey,stanza:{},xml:this.rootElement}),this.end()):(this.closedStream=!0,this.destroy(o.default.notWellFormed()));if(!this.currentElement||e!==this.currentElement.name)return this.closedStream=!0,this.destroy(o.default.notWellFormed());if(this.currentElement.parent)this.currentElement=this.currentElement.parent;else{this.wrappedStream&&(this.currentElement.parent=this.rootElement);const e=this.registry.getImportKey(this.currentElement),t=this.registry.import(this.currentElement,{acceptLanguages:this.acceptLanguages,lang:this.lang});t&&this.push({kind:e,stanza:t,xml:this.currentElement}),this.currentElement=void 0}}}),this.parser.on("text",e=>{this.currentElement&&this.currentElement.children.push(e)})}_transform(e,t,n){this.parser.write(e.toString()),n()}}t.default=c},function(e,t,n){"use strict";function i(e,t=""){const n={};if(Array.isArray(e))for(let r=0;r<e.length;r++)Object.assign(n,i(e[r],`${t}_[${r}]`));else"object"!=typeof e?n[t]=e:Object.keys(e).filter(e=>"ip"!==e.toLowerCase()).forEach(r=>{const s=e[r],o=t?`${t}_${r}`:r;"object"==typeof s||Array.isArray(s)?Object.assign(n,i(s,o)):n[o]=s});return n}Object.defineProperty(t,"__esModule",{value:!0}),t.deepFlatten=t.formatStatsEvent=void 0,t.formatStatsEvent=function(e,t={}){const n={_eventType:e.name,_eventTimestamp:(new Date).getTime(),...t};return function(e){return"getStats"===e.name}(e)&&Object.assign(n,function(e){let t={};return Object.assign(t,i(e.tracks,"localTrack")),delete e.tracks,Object.assign(t,i(e.remoteTracks,"remoteTrack")),delete e.remoteTracks,t}(e)),Object.assign(n,i(e)),delete n.name,{actionName:"WebrtcStats",details:n}},t.deepFlatten=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(6),s=n(5),o=n(1),a=n(7),c=n(10),u=(0,i.__importDefault)(n(62)),l=(0,i.__importDefault)(n(64)),d=(0,i.__importDefault)(n(42));class p extends r.EventEmitter{constructor(e={}){super(),e=e||{},this.selfID=e.selfID,this.sessions={},this.peers={},this.iceServers=e.iceServers||[],this.prepareSession=e.prepareSession||(e=>{if(this.config.hasRTCPeerConnection)return e.applicationTypes.indexOf(o.NS_JINGLE_RTP_1)>=0?new l.default(e):e.applicationTypes.indexOf(o.NS_JINGLE_FILE_TRANSFER_5)>=0?new u.default(e):void 0}),this.performTieBreak=e.performTieBreak||((e,t)=>{const n=(t.jingle.contents||[]).map(e=>{if(e.application)return e.application.applicationType});return(e.pendingApplicationTypes||[]).filter(e=>n.includes(e)).length>0}),this.createPeerConnection=e.createPeerConnection||((e,t)=>{if(a.RTCPeerConnection)return new a.RTCPeerConnection(t)}),this.config={debug:!1,hasRTCPeerConnection:!!a.RTCPeerConnection,peerConnectionConfig:{bundlePolicy:e.bundlePolicy||"balanced",iceTransportPolicy:e.iceTransportPolicy||"all",rtcpMuxPolicy:e.rtcpMuxPolicy||"require",sdpSemantics:e.sdpSemantics},peerConnectionConstraints:{optional:[{DtlsSrtpKeyAgreement:!0},{RtpDataChannels:!1}]},...e}}addICEServer(e){if("string"==typeof e)return void this.iceServers.push({urls:e});if(!(t=e).type&&(t.urls||t.url))return void this.iceServers.push(e);var t;let n=e.host||"";n.indexOf(":")>=0&&(n=`[${n}]`);let i=`${e.type}:${n}`;e.port&&(i+=":"+e.port),e.transport&&(i+="?transport="+e.transport),"turn"===e.type||"turns"===e.type?this.iceServers.push({credential:e.password,urls:[i],username:e.username}):"stun"!==e.type&&"stuns"!==e.type||this.iceServers.push({urls:[i]})}resetICEServers(){this.iceServers=[]}addSession(e){e.parent=this;const t=e.sid,n=e.peerID;return this.sessions[t]=e,this.peers[n]||(this.peers[n]=[]),this.peers[n].push(e),this.emit("createdSession",e),e}forgetSession(e){const t=this.peers[e.peerID]||[];t.length&&t.splice(t.indexOf(e),1),delete this.sessions[e.sid]}createMediaSession(e,t,n){const i=new l.default({config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!0,maxRelayBandwidth:786432,parent:this,peerID:e,sid:t,stream:n});return this.addSession(i),i}createFileTransferSession(e,t){const n=new u.default({config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!0,maxRelayBandwidth:786432,parent:this,peerID:e,sid:t});return this.addSession(n),n}endPeerSessions(e,t,n=!1){const i=this.peers[e]||[];delete this.peers[e];for(const e of i)e.end(t||"gone",n)}endAllSessions(e,t=!1){for(const n of Object.keys(this.peers))this.endPeerSessions(n,e,t)}process(e){const t=e.jingle?e.jingle.sid:void 0;let n=t?this.sessions[t]:void 0;const i=e.id,r=e.from;if(!r)return;if("error"===e.type){if(this._log("error","Received error response",e),n&&e.error&&"unknown-session"===e.error.jingleError)return n.end("gone",!0);const t=e.error&&"tie-break"===e.error.jingleError;return n&&"pending"===n.state&&t?n.end("alternative-session",!0):void(n&&(n.pendingAction=void 0))}if("result"===e.type)return void(n&&(n.pendingAction=void 0));const o=e.jingle.action,a=e.jingle.contents||[],u=a.map(e=>e.application?e.application.applicationType:void 0),l=a.map(e=>e.transport?e.transport.transportType:void 0);if(o!==s.JingleAction.SessionInitiate){if(!n)return"session-terminate"===o?void this.emit("send",{id:i,to:r,type:"result"}):(this._log("error","Unknown session",t),this._sendError(r,i,{condition:"item-not-found",jingleError:"unknown-session"}));if(n.peerID!==r||"ended"===n.state)return this._log("error","Session has ended, or action has wrong sender"),this._sendError(r,i,{condition:"item-not-found",jingleError:"unknown-session"});if("session-accept"===o&&"pending"!==n.state)return this._log("error","Tried to accept session twice",t),this._sendError(r,i,{condition:"unexpected-request",jingleError:"out-of-order"});if("session-terminate"!==o&&o===n.pendingAction&&(this._log("error","Tie break during pending request"),n.isInitiator))return this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}else if(n){if(n.peerID!==r)return this._log("error","Duplicate sid from new sender"),this._sendError(r,i,{condition:"service-unavailable"});if("pending"!==n.state)return this._log("error","Someone is doing this wrong"),this._sendError(r,i,{condition:"unexpected-request",jingleError:"out-of-order"});if(this.selfID&&this.selfID>n.peerID&&this.performTieBreak(n,e))return this._log("error","Tie break new session because of duplicate sids"),this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}else if(this.peers[r]&&this.peers[r].length)for(let n=0,s=this.peers[r].length;n<s;n++){const s=this.peers[r][n];if(s&&"pending"===s.state&&t&&(0,c.octetCompare)(s.sid,t)>0&&this.performTieBreak(s,e))return this._log("info","Tie break session-initiate"),this._sendError(r,i,{condition:"conflict",jingleError:"tie-break"})}if("session-initiate"===o){if(!a.length)return this._sendError(r,i,{condition:"bad-request"});n=this._createIncomingSession({applicationTypes:u,config:this.config.peerConnectionConfig,constraints:this.config.peerConnectionConstraints,iceServers:this.iceServers,initiator:!1,parent:this,peerID:r,sid:t,transportTypes:l},e)}n.process(o,e.jingle,t=>{t?(this._log("error","Could not process request",e,t),this._sendError(r,i,t)):(this.emit("send",{id:i,to:r,type:"result"}),"session-initiate"===o&&this.emit("incoming",n))})}signal(e,t){const n=t.jingle&&t.jingle.action;e.isInitiator&&n===s.JingleAction.SessionInitiate&&this.emit("outgoing",e),this.emit("send",t)}_createIncomingSession(e,t){let n;return this.prepareSession&&(n=this.prepareSession(e,t)),n||(n=new d.default(e)),this.addSession(n),n}_sendError(e,t,n){n.type||(n.type="cancel"),this.emit("send",{error:n,id:t,to:e,type:"error"})}_log(e,t,...n){this.emit("log",e,t,...n),this.emit("log:"+e,t,...n)}}t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Ping=void 0;t.Ping=class{constructor(e,t,n={}){this.client=e,this.stanzaInstance=t,this.options=n,this.pingInterval=n.pingInterval||14e3,this.failedPingsBeforeDisconnect=n.failedPingsBeforeDisconnect||1,this.numberOfFailedPings=0,this.nextPingTimeoutId=void 0,this.start()}start(){this.nextPingTimeoutId||(this.nextPingTimeoutId=-1,this.queueNextPing())}stop(){clearTimeout(this.nextPingTimeoutId),this.nextPingTimeoutId=void 0,this.numberOfFailedPings=0}async performPing(){try{await this.stanzaInstance.ping(this.options.jid),this.numberOfFailedPings=0,this.queueNextPing()}catch(e){const t={channelId:this.client.config.channelId,jid:this.stanzaInstance.jid,stanzaInstanceId:this.stanzaInstance.id};this.client.logger.warn("Missed a ping.",Object.assign({error:e},t)),++this.numberOfFailedPings>this.failedPingsBeforeDisconnect?(this.client.logger.error("Missed too many pings, disconnecting",Object.assign({numberOfFailedPings:this.numberOfFailedPings},t)),this.stanzaInstance.sendStreamError({text:"too many missed pongs",condition:"connection-timeout"}),this.stop()):this.queueNextPing()}}queueNextPing(){this.nextPingTimeoutId&&(this.nextPingTimeoutId=setTimeout(this.performPing.bind(this),this.pingInterval))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionManager=void 0;const i=n(16),r=n(217),s=n(18),o=i.__importDefault(n(169)),a=n(11);t.ConnectionManager=class{constructor(e,t){this.logger=e,this.config=t}setConfig(e){this.config=e}async getNewStanzaConnection(){const e=this.getStanzaOptions(),t=r.createClient({});t.sasl.mechanisms.find(e=>"ANONYMOUS"===e.name).priority=0,t.sasl.mechanisms=t.sasl.mechanisms.sort((e,t)=>t.priority-e.priority),t.id=s.v4();const n=t.channelId=this.config.channelId;let i,o,c,u;const l=a.timeoutPromise((n,r)=>{i=this.checkForErrorStanza.bind(this,t),t.on("raw:incoming",i),o=this.handleSessionStarted.bind(this,t,n),t.on("session:started",o),c=this.handleSessionSasl.bind(this,t,r),t.on("sasl",c),u=this.handleSessionDisconnected.bind(this,t,r),t.on("disconnected",u),t.updateConfig(e),t.connect()},15e3,"connecting to streaming service",{channelId:n,stanzaInstanceId:t.id});return l.catch(()=>t.disconnect()),l.finally(()=>{t.off("raw:incoming",i),t.off("session:started",o),t.off("sasl",c),t.off("disconnected",u)})}handleSessionStarted(e,t){this.logger.info("new stanza instance connected",{stanzaInstanceId:e.id,channelId:e.channelId}),t(e)}handleSessionSasl(e,t,n){"failure"===n.type&&t(new o.default(n.condition,e.channelId,e.id))}handleSessionDisconnected(e,t){this.logger.error("stanza disconnected",{stanzaInstanceId:e.id,channelId:e.channelId}),t()}checkForErrorStanza(e,t){t.includes("error")&&this.logger.error("Received a stanza during setup that tripped the error filter",{rawStanza:t,stanzaInstanceId:e.id,channelId:e.channelId})}getStanzaOptions(){return this.config.jwt?this.getJwtOptions():this.getStandardOptions()}getJwtOptions(){const e=this.config,t=a.parseJwt(e.jwt);let n;try{n=t.data.jid.split("@")[1].replace("conference.","")}catch(e){throw new Error("failed to parse jid")}let i=e.host.replace(/\/$/,"");return{resource:e.jidResource,transports:{websocket:`${i}/stream/jwt/${e.jwt}`},server:n}}getStandardOptions(){const e=this.config;let t=e.host.replace(/\/$/,"");return{jid:e.jid,resource:e.jidResource,credentials:{username:e.jid,password:"authKey:"+e.authToken},transports:{websocket:`${t}/stream/channels/${e.channelId}`}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createClient=t.VERSION=t.Platform=t.SASL=t.RTT=t.RSM=t.Utils=t.Jingle=t.Stanzas=t.Namespaces=t.JID=t.JXT=t.DataForms=t.Constants=t.Client=void 0;const i=n(3),r=(0,i.__importDefault)(n(218));t.Client=r.default;const s=(0,i.__importStar)(n(5));t.Constants=s;const o=(0,i.__importStar)(n(224));t.RTT=o;const a=(0,i.__importStar)(n(8));t.JID=a;const c=(0,i.__importStar)(n(39));t.Jingle=c;const u=(0,i.__importStar)(n(2));t.JXT=u;const l=(0,i.__importStar)(n(68));t.SASL=l;const d=(0,i.__importStar)(n(1));t.Namespaces=d;const p=(0,i.__importStar)(n(88));t.Stanzas=p;const h=(0,i.__importStar)(n(10));t.Utils=h;const f=(0,i.__importStar)(n(7));t.Platform=f,(0,i.__exportStar)(n(67),t);const m=(0,i.__importStar)(n(225));t.RSM=m;const g=(0,i.__importStar)(n(80));t.DataForms=g,t.VERSION=s.VERSION;const y=(0,i.__importDefault)(n(45));(0,i.__exportStar)(n(45),t),t.createClient=function(e){const t=new r.default(e);return t.use(y.default),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(43),s=n(6),o=(0,i.__importDefault)(n(67)),a=(0,i.__importStar)(n(8)),c=(0,i.__importStar)(n(2)),u=(0,i.__importStar)(n(68)),l=n(45),d=(0,i.__importDefault)(n(88)),p=(0,i.__importDefault)(n(221)),h=(0,i.__importDefault)(n(222)),f=n(10),m=(0,i.__importDefault)(n(223));class g extends s.EventEmitter{constructor(e={}){super(),this.reconnectAttempts=0,this.setMaxListeners(100),this.off=this.removeListener,this.updateConfig(e),this.jid="",this.sasl=new u.Factory,this.sasl.register("EXTERNAL",u.EXTERNAL,1e3),this.sasl.register("SCRAM-SHA-256-PLUS",u.SCRAM,350),this.sasl.register("SCRAM-SHA-256",u.SCRAM,300),this.sasl.register("SCRAM-SHA-1-PLUS",u.SCRAM,250),this.sasl.register("SCRAM-SHA-1",u.SCRAM,200),this.sasl.register("DIGEST-MD5",u.DIGEST,100),this.sasl.register("OAUTHBEARER",u.OAUTH,100),this.sasl.register("X-OAUTH2",u.PLAIN,50),this.sasl.register("PLAIN",u.PLAIN,1),this.sasl.register("ANONYMOUS",u.ANONYMOUS,0),this.stanzas=new c.Registry,this.stanzas.define(d.default),this.resolver=new m.default,this.use(l.core),this.sm=new o.default,void 0!==this.config.allowResumption&&(this.sm.allowResume=this.config.allowResumption),this.sm.on("prebound",e=>{this.jid=e,this.emit("session:bound",e)}),this.on("session:bound",e=>this.sm.bind(e)),this.sm.on("send",e=>this.send("sm",e)),this.sm.on("acked",e=>this.emit("stanza:acked",e)),this.sm.on("failed",e=>this.emit("stanza:failed",e)),this.sm.on("hibernated",e=>this.emit("stanza:hibernated",e)),this.sm.on("begin-resend",()=>this.outgoingDataQueue.pause()),this.sm.on("resend",({kind:e,stanza:t})=>this.send(e,t,!0)),this.sm.on("end-resend",()=>this.outgoingDataQueue.resume());for(const e of["acked","hibernated","failed"])this.on("stanza:"+e,t=>{"message"===t.kind&&this.emit("message:"+e,t.stanza)});this.transports={bosh:p.default,websocket:h.default},this.incomingDataQueue=(0,r.priorityQueue)(async(e,t)=>{const{kind:n,stanza:i}=e;this.emit(n,i),i.id&&this.emit(n+":id:"+i.id,i),"message"===n||"presence"===n||"iq"===n?(this.emit("stanza",i),await this.sm.handle()):"sm"===n&&("ack"===i.type&&(await this.sm.process(i),this.emit("stream:management:ack",i)),"request"===i.type&&this.sm.ack()),t&&t()},1);const t=(e,t)=>{["message","presence","iq"].includes(e)&&(this.sm.started&&this.sm.resumable?this.sm.resumable&&!this.transport&&this.emit("stanza:hibernated",{kind:e,stanza:t}):this.emit("stanza:failed",{kind:e,stanza:t}))};this.outgoingDataQueue=(0,r.priorityQueue)(async(e,n)=>{var i;const{kind:r,stanza:s,replay:o}=e,a=o||await this.sm.track(r,s);if("message"===r&&(o?this.emit("message:retry",s):this.emit("message:sent",s,!1)),this.transport)try{await this.transport.send(r,s),a&&(null===(i=this.transport)||void 0===i||i.send("sm",{type:"request"}))}catch(e){console.error(e),t(r,s)}else t(r,s);n&&n()},1),this.on("stream:data",(e,t)=>{this.incomingDataQueue.push({kind:t,stanza:e},0)}),this.on("--transport-disconnected",async()=>{const e=[];this.incomingDataQueue.idle()||e.push(this.incomingDataQueue.drain()),this.outgoingDataQueue.idle()||e.push(this.outgoingDataQueue.drain()),await Promise.all(e),await this.sm.hibernate(),this.transport&&delete this.transport,this.emit("--reset-stream-features"),!this.sessionTerminating&&this.config.autoReconnect&&(this.reconnectAttempts+=1,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.connect()},1e3*Math.min(Math.pow(2,this.reconnectAttempts)+Math.random(),this.config.maxReconnectBackoff||32))),this.emit("disconnected")}),this.on("iq",e=>{const t=e.type,n=e.payloadType,i="iq:"+t+":"+n;if("get"===t||"set"===t){if("invalid-payload-count"===n)return this.sendIQError(e,{error:{condition:"bad-request",type:"modify"}});if("unknown-payload"===n||0===this.listenerCount(i))return this.sendIQError(e,{error:{condition:"service-unavailable",type:"cancel"}});this.emit(i,e)}}),this.on("message",e=>{const t=e.alternateLanguageBodies&&e.alternateLanguageBodies.length||e.links&&e.links.length,n=e.marker&&"markable"!==e.marker.type;t&&!n&&("chat"===e.type||"normal"===e.type?this.emit("chat",e):"groupchat"===e.type&&this.emit("groupchat",e)),"error"===e.type&&this.emit("message:error",e)}),this.on("presence",e=>{let t=e.type||"available";"error"===t&&(t="presence:error"),this.emit(t,e)}),this.on("session:started",()=>{this.sessionStarting=!1,this.reconnectAttempts=0,this.reconnectTimer&&clearTimeout(this.reconnectTimer)})}updateConfig(e={}){var t;const n=this.config||{};this.config={allowResumption:!0,jid:"",transports:{bosh:!0,websocket:!0},useStreamManagement:!0,transportPreferenceOrder:["websocket","bosh"],...n,...e},this.config.server||(this.config.server=a.getDomain(this.config.jid)),this.config.password&&(this.config.credentials=this.config.credentials||{},this.config.credentials.password=this.config.password,delete this.config.password),this.config.transportPreferenceOrder||(this.config.transportPreferenceOrder=Object.keys(null!==(t=this.config.transports)&&void 0!==t?t:{}))}get stream(){return this.transport?this.transport.stream:void 0}emit(e,...t){const n=super.emit(e,...t);return"raw"===e?(super.emit("raw:"+t[0],t[1]),super.emit("raw:*","raw:"+t[0],t[1]),super.emit("*","raw:"+t[0],t[1])):super.emit("*",e,...t),n}use(e){"function"==typeof e&&e(this,this.stanzas,this.config)}nextId(){return(0,f.uuid)()}async getCredentials(){return this._getConfiguredCredentials()}async connect(){var e,t,n;this.sessionTerminating=!1,this.sessionStarting=!0,this.emit("--reset-stream-features"),this.transport&&this.transport.disconnect(!1);const i=null!==(e=this.config.transportPreferenceOrder)&&void 0!==e?e:[];let r;for(const e of i){const i=this.config.transports[e];if(!i||!this.transports[e])continue;let s={acceptLanguages:this.config.acceptLanguages||[null!==(t=this.config.lang)&&void 0!==t?t:"en"],jid:this.config.jid,lang:null!==(n=this.config.lang)&&void 0!==n?n:"en",server:this.config.server};const o=new this.transports[e](this,this.sm,this.stanzas);if("string"==typeof i)s.url=i;else if(1==i)if(o.discoverBindings){const e=await o.discoverBindings(this.config.server);if(!e)continue;s={...s,...e}}else{if(!r)try{r=await this.discoverBindings(this.config.server)}catch(e){console.error(e);continue}if(r[e]=(r[e]||[]).filter(e=>e.startsWith("wss:")||e.startsWith("https:")),!r[e]||!r[e].length)continue;s.url=r[e][0]}return this.transport=o,void this.transport.connect(s)}console.error("No endpoints found for the requested transports."),this.emit("--transport-disconnected")}async disconnect(){this.sessionTerminating=!0,clearTimeout(this.reconnectTimer),this.outgoingDataQueue.pause(),this.sessionStarted&&!this.sm.started&&this.emit("session:end"),this.emit("--reset-stream-features"),this.sessionStarted=!1,this.transport?this.transport.disconnect():this.emit("--transport-disconnected"),this.outgoingDataQueue.resume(),this.outgoingDataQueue.idle()||await this.outgoingDataQueue.drain(),await this.sm.shutdown()}async send(e,t,n=!1){return new Promise((i,r)=>{this.outgoingDataQueue.push({kind:e,stanza:t,replay:n},n?0:1,e=>e?r(e):i())})}sendMessage(e){const t=e.id||this.nextId(),n={id:t,originId:t,...e};return this.send("message",n),n.id}sendPresence(e={}){const t={id:this.nextId(),...e};return this.send("presence",t),t.id}sendIQ(e){const t={id:this.nextId(),...e},n=a.allowedResponders(this.jid,e.to),i="iq:id:"+t.id,r=new Promise((e,t)=>{const r=s=>{n.has(s.from)&&("result"!==s.type&&"error"!==s.type||(this.off(i,r),"result"===s.type?e(s):t(s)))};this.on(i,r)});this.send("iq",t);const s=this.config.timeout||15;return(0,f.timeoutPromise)(r,1e3*s,()=>({...t,to:void 0,from:void 0,error:{condition:"timeout",text:`Request timed out after ${s} seconds.`},id:t.id,type:"error"}))}sendIQResult(e,t){this.send("iq",{...t,id:e.id,to:e.from,type:"result"})}sendIQError(e,t){this.send("iq",{...t,id:e.id,to:e.from,type:"error"})}sendStreamError(e){this.emit("stream:error",e),this.send("error",e),this.disconnect()}_getConfiguredCredentials(){const e=this.config.credentials||{},t=a.parse(this.config.jid||""),n=e.username||t.local,i=e.host||t.domain;return{host:i,password:this.config.password,realm:i,serviceName:i,serviceType:"xmpp",username:n,...e}}}t.default=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(220));t.default=class{constructor(){this.capsAlgorithms=["sha-1"],this.features=new Map,this.identities=new Map,this.extensions=new Map,this.items=new Map,this.caps=new Map,this.features.set("",new Set),this.identities.set("",[]),this.extensions.set("",[])}getNodeInfo(e){return{extensions:[...this.extensions.get(e)||[]],features:[...this.features.get(e)||[]],identities:[...this.identities.get(e)||[]]}}addFeature(e,t=""){this.features.has(t)||this.features.set(t,new Set),this.features.get(t).add(e)}addIdentity(e,t=""){this.identities.has(t)||this.identities.set(t,[]),this.identities.get(t).push(e)}addItem(e,t=""){this.items.has(t)||this.items.set(t,[]),this.items.get(t).push(e)}addExtension(e,t=""){this.extensions.has(t)||this.extensions.set(t,[]),this.extensions.get(t).push(e)}updateCaps(e,t=this.capsAlgorithms){const n={extensions:[...this.extensions.get("")],features:[...this.features.get("")],identities:[...this.identities.get("")],type:"info"};for(const r of t){const t=i.generate(n,r);if(!t){this.caps.delete(r);continue}this.caps.set(r,{algorithm:r,node:e,value:t});const s=`${e}#${t}`;for(const e of n.features)this.addFeature(e,s);for(const e of n.identities)this.addIdentity(e,s);for(const e of n.extensions)this.addExtension(e,s);this.identities.set(s,n.identities),this.features.set(s,new Set(n.features)),this.extensions.set(s,n.extensions)}return[...this.caps.values()]}getCaps(){return[...this.caps.values()]}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.verify=t.generate=void 0;const i=n(7),r=n(10);function s(e){return i.Buffer.from(e.replace(/</g,"<"),"utf-8")}function o(e=[]){const t=[];for(const n of e)"FORM_TYPE"!==n.name&&(n.rawValues?t.push({name:s(n.name),values:n.rawValues.map(e=>s(e)).sort(r.octetCompare)}):Array.isArray(n.value)?t.push({name:s(n.name),values:n.value.map(e=>s(e)).sort(r.octetCompare)}):!0===n.value||!1===n.value?t.push({name:s(n.name),values:[s(n.value?"1":"0")]}):t.push({name:s(n.name),values:[s(n.value||"")]}));t.sort((e,t)=>(0,r.octetCompare)(e.name,t.name));const n=[];for(const e of t){n.push(e.name);for(const t of e.values)n.push(t)}return n}function a(e,t){const n=[],a=i.Buffer.from("<","utf8"),c=e=>{n.push(e),n.push(a)},u=function(e=[]){const t=[],n=new Set;for(const{category:i,type:r,lang:o,name:a}of e){const e=`${i}/${r}/${o||""}/${a||""}`;if(n.has(e))return null;n.add(e),t.push(s(e))}return t.sort(r.octetCompare),t}(e.identities),l=function(e=[]){const t=[],n=new Set;for(const i of e){if(n.has(i))return null;n.add(i),t.push(s(i))}return t.sort(r.octetCompare),t}(e.features),d=function(e=[]){const t=[],n=new Set;for(const i of e){let e;for(const t of i.fields||[])if("FORM_TYPE"===t.name&&"hidden"===t.type){if(t.rawValues&&1===t.rawValues.length){e=s(t.rawValues[0]);break}if(t.value&&"string"==typeof t.value){e=s(t.value);break}}if(e){if(n.has(e.toString()))return null;n.add(e.toString()),t.push({type:e,form:i})}}t.sort((e,t)=>(0,r.octetCompare)(e.type,t.type));const i=[];for(const e of t){i.push(e.type);const t=o(e.form.fields);for(const e of t)i.push(e)}return i}(e.extensions);if(!u||!l||!d)return null;for(const e of u)c(e);for(const e of l)c(e);for(const e of d)c(e);return(0,i.createHash)(t).update(i.Buffer.concat(n)).digest("base64")}t.generate=a,t.verify=function(e,t,n){const i=a(e,t);return!!i&&i===n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(7),s=n(2),o=n(10);class a{constructor(e){this.active=!1,this.maxRetries=5,this.stream=e,this.maxTimeout=1100*this.stream.maxWaitTime}async send(e,t){this.rid=e,this.active=!0;let n=0;for(;n<=this.maxRetries;){n+=1;try{const e=await(0,o.timeoutPromise)((0,r.fetch)(this.stream.url,{body:t,headers:{"Content-Type":this.stream.contentType},method:"POST"}),this.maxTimeout,()=>new Error("Request timed out"));if(!e.ok)throw new Error("HTTP Status Error: "+e.status);const n=await e.text();return this.active=!1,n}catch(e){if(1===n)continue;if(n<this.maxRetries){const e=Math.min(this.maxTimeout,1e3*Math.pow(n,2));await(0,o.sleep)(e+1e3*Math.random());continue}throw this.active=!1,e}}throw new Error("Request failed")}}class c extends r.Duplex{constructor(e,t,n){super({objectMode:!0}),this.rid=Math.floor(4294967295*Math.random()),this.sid="",this.maxHoldOpen=2,this.maxWaitTime=30,this.contentType="text/xml; charset=utf-8",this.channels=[new a(this),new a(this)],this.activeChannelID=0,this.queue=[],this.isEnded=!1,this.client=e,this.sm=t,this.stanzas=n,this.on("data",e=>{this.client.emit("stream:data",e.stanza,e.kind)}),this.on("end",()=>{this.isEnded=!0,clearTimeout(this.idleTimeout),this.client.transport===this&&this.client.emit("--transport-disconnected")})}_write(e,t,n){this.queue.push([e,n]),this.scheduleRequests()}_writev(e,t){this.queue.push([e.map(e=>e.chunk).join(""),t]),this.scheduleRequests()}_read(){}process(e){const t=new s.StreamParser({acceptLanguages:this.config.acceptLanguages,allowComments:!1,lang:this.config.lang,registry:this.stanzas,rootKey:"bosh",wrappedStream:!0});t.on("error",e=>{const t={condition:i.StreamErrorCondition.InvalidXML};return this.client.emit("stream:error",t,e),this.send("error",t),this.disconnect()}),t.on("data",e=>{if("stream-start"===e.event)return this.stream=e.stanza,void("terminate"===e.stanza.type?(this.hasStream=!1,this.rid=void 0,this.sid=void 0,this.isEnded||(this.isEnded=!0,this.client.emit("bosh:terminate",e.stanza),this.client.emit("stream:end"),this.push(null))):this.hasStream||(this.hasStream=!0,this.stream=e.stanza,this.sid=e.stanza.sid||this.sid,this.maxWaitTime=e.stanza.maxWaitTime||this.maxWaitTime,this.client.emit("stream:start",e.stanza)));e.event||this.push({kind:e.kind,stanza:e.stanza})}),this.client.emit("raw","incoming",e),t.write(e),this.scheduleRequests()}connect(e){if(this.config=e,this.url=e.url,e.rid&&(this.rid=e.rid),e.sid&&(this.sid=e.sid),e.wait&&(this.maxWaitTime=e.wait),e.maxHoldOpen&&(this.maxHoldOpen=e.maxHoldOpen),this.sid)return this.hasStream=!0,this.stream={},this.client.emit("connected"),this.client.emit("session:prebind",this.config.jid),void this.client.emit("session:started");this._send({lang:e.lang,maxHoldOpen:this.maxHoldOpen,maxWaitTime:this.maxWaitTime,to:e.server,version:"1.6",xmppVersion:"1.0"})}restart(){this.hasStream=!1,this._send({to:this.config.server,xmppRestart:!0})}disconnect(e=!0){this.hasStream&&e?this._send({type:"terminate"}):(this.stream=void 0,this.sid=void 0,this.rid=void 0,this.client.emit("--transport-disconnected"))}async send(e,t){var n;let i;if(t&&(i=null===(n=this.stanzas.export(e,t))||void 0===n?void 0:n.toString()),i)return new Promise((e,t)=>{this.write(i,"utf8",n=>n?t(n):e())})}get sendingChannel(){return this.channels[this.activeChannelID]}get pollingChannel(){return this.channels[0===this.activeChannelID?1:0]}toggleChannel(){this.activeChannelID=0===this.activeChannelID?1:0}async _send(e,t=""){if(this.isEnded)return;const n=this.rid++,i=this.stanzas.export("bosh",{...e,rid:n,sid:this.sid});let r;r=t?[i.openTag(),t,i.closeTag()].join(""):i.toString(),this.client.emit("raw","outgoing",r),this.sendingChannel.send(n,r).then(e=>{this.process(e)}).catch(e=>{this.end(e)}),this.toggleChannel()}async _poll(){if(this.isEnded)return;const e=this.rid++,t=this.stanzas.export("bosh",{rid:e,sid:this.sid}).toString();this.client.emit("raw","outgoing",t),this.pollingChannel.send(e,t).then(e=>{this.process(e)}).catch(e=>{this.end(e)})}scheduleRequests(){clearTimeout(this.idleTimeout),this.idleTimeout=setTimeout(()=>{this.fireRequests()},10)}fireRequests(){if(!this.isEnded)if(this.queue.length)if(this.sendingChannel.active)this.scheduleRequests();else{const[e,t]=this.queue.shift();this._send({},e),t()}else!this.authenticated||this.channels[0].active||this.channels[1].active||this._poll()}}t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(7);class o extends s.Duplex{constructor(e,t,n){super({objectMode:!0}),this.sm=t,this.stanzas=n,this.closing=!1,this.client=e,this.on("data",e=>{this.client.emit("stream:data",e.stanza,e.kind)}),this.on("error",()=>{this.end()}),this.on("end",()=>{this.client.transport===this&&this.client.emit("--transport-disconnected")})}_read(){}_write(e,t,n){if(!this.socket||1!==this.socket.readyState)return n(new Error("Socket closed"));const i=s.Buffer.from(e,"utf8").toString();this.client.emit("raw","outgoing",i),this.socket.send(i),n()}connect(e){this.config=e,this.hasStream=!1,this.closing=!1,this.parser=new r.StreamParser({acceptLanguages:this.config.acceptLanguages,allowComments:!1,lang:this.config.lang,registry:this.stanzas,wrappedStream:!1}),this.parser.on("data",e=>{const t=e.kind,n=e.stanza;if("stream"===t){if("open"===n.action)return this.hasStream=!0,this.stream=n,this.client.emit("stream:start",n);if("close"===n.action)return this.client.emit("stream:end"),this.disconnect()}this.push({kind:e.kind,stanza:e.stanza})}),this.parser.on("error",e=>{const t={condition:i.StreamErrorCondition.InvalidXML};return this.client.emit("stream:error",t,e),this.write(this.stanzas.export("error",t).toString()),this.disconnect()}),this.socket=new s.WebSocket(e.url,"xmpp"),this.socket.onopen=()=>{this.emit("connect"),this.sm.started=!1,this.client.emit("connected"),this.write(this.startHeader())},this.socket.onmessage=e=>{const t=s.Buffer.from(e.data,"utf8").toString();this.client.emit("raw","incoming",t),this.parser&&this.parser.write(t)},this.socket.onclose=()=>{this.push(null)},this.socket.onerror=e=>{console.error(e),this.push(null)}}disconnect(e=!0){this.socket&&!this.closing&&this.hasStream&&e?(this.closing=!0,this.write(this.closeHeader())):(this.hasStream=!1,this.stream=void 0,this.socket&&(this.end(),this.socket.close(),this.client.transport===this&&this.client.emit("--transport-disconnected")),this.socket=void 0)}async send(e,t){var n;let i;if(t&&(i=null===(n=this.stanzas.export(e,t))||void 0===n?void 0:n.toString()),i)return new Promise((e,t)=>{this.write(i,"utf8",n=>n?t(n):e())})}restart(){this.hasStream=!1,this.write(this.startHeader())}startHeader(){return this.stanzas.export("stream",{action:"open",lang:this.config.lang,to:this.config.server,version:"1.0"}).toString()}closeHeader(){return this.stanzas.export("stream",{action:"close"}).toString()}}t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(7),s=n(10),o=n(2),a=(0,i.__importDefault)(n(46));t.default=class{constructor(){this.hostMetaCache=new Map,this.hostMetaTTL=3e4,this.resolver=(0,r.createResolver)(),this.registry=new o.Registry,this.registry.define(a.default)}async getHostMeta(e){const t=this.hostMetaCache.get(e);if(t){if(t.created+this.hostMetaTTL<Date.now())return t.hostmeta;this.hostMetaCache.delete(e)}const n=(0,s.promiseAny)([(0,r.fetch)(`https://${e}/.well-known/host-meta.json`).then(async e=>{if(!e.ok)throw new Error("could-not-fetch-json");return e.json()}),(0,r.fetch)(`https://${e}/.well-known/host-meta`).then(async e=>{if(!e.ok)throw new Error("could-not-fetch-xml");const t=await e.text(),n=(0,o.parse)(t);if(n)return this.registry.import(n);throw new Error("could-not-import-xml")})]);return this.hostMetaCache.set(e,{created:Date.now(),hostmeta:n}),n.catch(()=>{this.hostMetaCache.delete(e)}),n}async resolveTXT(e){var t,n;return null!==(n=null===(t=this.resolver)||void 0===t?void 0:t.resolveTxt(e))&&void 0!==n?n:[]}async resolve(e,t,n={}){if(!this.resolver)return[];let i=[],r=!0;if(n.srvType){const t=await this.resolveWeightedSRV(e,n.srvType,n.srvTypeSecure);r=t.allowFallback,i=t.records.map(e=>({host:e.name,port:e.port,secure:e.secure}))}return r&&i.push({host:e,port:t}),i}async resolveWeightedSRV(e,t,n){const[i,r]=await Promise.all([this.resolveSRV(e,t),n?this.resolveSRV(e,n,!0):Promise.resolve({records:[],allowFallback:!1})]),o=[...i.records,...r.records],a=new Map;let c=0;for(const e of o){e.id=c++,e.runningSum=0,a.has(e.priority)||a.set(e.priority,[]);a.get(e.priority).push(e)}const u=e=>{const t=[];for(;t.length<e.length;){const n=(0,s.shuffle)(e.filter(e=>0===e.weight&&!e.used)),i=(0,s.shuffle)(e.filter(e=>0!==e.weight&&!e.used));let r=0;for(const e of i)r+=e.weight,e.runningSum=r,n.push(e);const o=Math.floor(Math.random()*(r+1));for(const e of n)if(e.runningSum>=o){e.used=!0,t.push(e);break}}return t};let l=[];for(const e of Array.from(a.keys()).sort((e,t)=>e<t?-1:e>t?1:0)){const t=a.get(e);l=l.concat(u(t))}return{records:l,allowFallback:i.allowFallback}}async resolveSRV(e,t,n){var i,r;try{const s=null!==(r=await(null===(i=this.resolver)||void 0===i?void 0:i.resolveSrv(`${t}.${e}`)))&&void 0!==r?r:[];return 1!==s.length||"."!==s[0].name&&""!==s[0].name?{records:s.map(e=>({secure:n,...e})).filter(e=>""!==e.name&&"."!==e.name),allowFallback:!1}:{records:[],allowFallback:!1}}catch(e){return{records:[],allowFallback:!0}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InputBuffer=t.DisplayBuffer=t.diff=void 0;const i=n(3),r=n(43),s=(0,i.__importDefault)(n(33));function o(e,t){const n=e.length,i=t.length,r=Math.min(n,i);let o=0;for(o=0;o<r&&e[o]===t[o];o++);let a=0;for(a=0;a<r-o&&e[n-a-1]===t[i-a-1];a++);const c=o+a,u=[];if(c<n&&u.push({length:n-c,position:n-a,type:"erase"}),c<i){const e=t.slice(o,o+i-c);u.push({position:o,text:s.default.ucs2.encode(e),type:"insert"})}return u}t.diff=o;t.DisplayBuffer=class{constructor(e,t=!1){this.synced=!1,this.cursorPosition=0,this.ignoreWaits=!1,this.timeDeficit=0,this.sequenceNumber=0,this.onStateChange=e||function(){},this.ignoreWaits=t,this.buffer=[],this.resetActionQueue()}get text(){return s.default.ucs2.encode(this.buffer.slice())}commit(){this.resetActionQueue()}process(e){if("cancel"!==e.event&&"init"!==e.event){if("reset"===e.event||"new"===e.event?(this.resetActionQueue(),void 0!==e.seq&&(this.sequenceNumber=e.seq)):e.seq!==this.sequenceNumber&&(this.synced=!1),e.actions){const t=Date.now();let n=0;for(const i of e.actions)i.baseTime=t+n,"wait"===i.type&&(n+=i.duration),this.actionQueue.push(i,0)}this.sequenceNumber=this.sequenceNumber+1}else this.resetActionQueue()}insert(e="",t=this.buffer.length){e=e.normalize("NFC");const n=s.default.ucs2.decode(e);this.buffer.splice(t,0,...n),this.cursorPosition=t+n.length,this.emitState()}erase(e=1,t=this.buffer.length){t=Math.max(Math.min(t,this.buffer.length),0),e=Math.max(Math.min(e,this.text.length),0),this.buffer.splice(Math.max(t-e,0),e),this.cursorPosition=Math.max(t-e,0),this.emitState()}emitState(e={}){this.onStateChange({cursorPosition:this.cursorPosition,synced:this.synced,text:this.text,...e})}resetActionQueue(){this.actionQueue&&this.actionQueue.kill(),this.sequenceNumber=0,this.synced=!0,this.buffer=[],this.timeDeficit=0,this.actionQueue=(0,r.priorityQueue)((e,t)=>{const n=Date.now();if("insert"===e.type)return this.insert(e.text,e.position),t();if("erase"===e.type)return this.erase(e.length,e.position),t();if("wait"!==e.type)return t();{if(this.ignoreWaits)return t();e.duration>700&&(e.duration=700);const i=e.duration-(n-e.baseTime)+this.timeDeficit;if(i<=0)return this.timeDeficit=i,t();this.timeDeficit=0,setTimeout(()=>t(),i)}},1),this.emitState()}};t.InputBuffer=class{constructor(e,t=!1){this.resetInterval=1e4,this.ignoreWaits=!1,this.isStarting=!1,this.isReset=!1,this.changedBetweenResets=!1,this.onStateChange=e||function(){},this.ignoreWaits=t,this.buffer=[],this.actionQueue=[],this.sequenceNumber=0}get text(){return s.default.ucs2.encode(this.buffer.slice())}update(e){let t=[];if(void 0!==e){e=e.normalize("NFC");const n=s.default.ucs2.decode(e);t=o(this.buffer,n.slice()),this.buffer=n,this.emitState()}const n=Date.now();if(this.changedBetweenResets&&n-this.lastResetTime>this.resetInterval)this.actionQueue=[],this.actionQueue.push({position:0,text:this.text,type:"insert"}),this.isReset=!0,this.lastActionTime=n,this.lastResetTime=n,this.changedBetweenResets=!1;else if(t.length){const e=n-(this.lastActionTime||n);e>0&&!this.ignoreWaits&&this.actionQueue.push({duration:e,type:"wait"});for(const e of t)this.actionQueue.push(e);this.lastActionTime=n,this.changedBetweenResets=!0}else this.lastActionTime=n}start(e=this.resetInterval){return this.commit(),this.isStarting=!0,this.resetInterval=e,this.sequenceNumber=Math.floor(1e4*Math.random()+1),{event:"init"}}stop(){return this.commit(),{event:"cancel"}}diff(){if(this.update(),!this.actionQueue.length)return null;const e={actions:this.actionQueue,seq:this.sequenceNumber++};return this.isStarting?(e.event="new",this.isStarting=!1,this.lastResetTime=Date.now()):this.isReset&&(e.event="reset",this.isReset=!1),this.actionQueue=[],e}commit(){this.sequenceNumber=0,this.lastActionTime=0,this.actionQueue=[],this.buffer=[]}emitState(){this.onStateChange({text:this.text})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPager=t.ResultSetPager=void 0;class i{constructor(e){var t,n,i;this.resultComplete=!1,this.fetchedCount=0,this.yieldedCount=0,this.cursor={first:e.before,last:e.after},this.query=e.query,this.direction=null!==(t=e.direction)&&void 0!==t?t:"forward",this.reverse=null!==(n=e.reverse)&&void 0!==n?n:"backward"===this.direction,this.pageSize=null!==(i=e.pageSize)&&void 0!==i?i:20}async*[Symbol.asyncIterator](){let e=[];do{e=await this.fetchPage();for(const t of e)this.yieldedCount+=1,yield t}while(e.length>0)}async size(){if(void 0!==this.resultCount)return this.resultCount;const{paging:e}=await this.query({max:0});return this.resultCount=e.count,e.count}queryCompleted(){return this.resultComplete}finished(){return this.resultComplete&&this.yieldedCount===this.fetchedCount}async fetchPage(){var e;const{results:t,paging:n}=await this.query({before:"backward"===this.direction?null!==(e=this.cursor.first)&&void 0!==e?e:"":void 0,after:"forward"===this.direction?this.cursor.last:void 0,max:this.pageSize});return this.cursor=n,this.resultCount=n.count,this.fetchedCount+=t.length,(this.pageSize&&t.length<this.pageSize||this.resultCount&&this.fetchedCount===this.resultCount)&&(this.resultComplete=!0),this.reverse&&t.reverse(),t}}t.ResultSetPager=i,t.createPager=function(e){return new i(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{}t.default=i},function(e,t,n){"use strict";n.r(t),n.d(t,"Emitter",(function(){return s})),n.d(t,"MemoryLeakError",(function(){return i}));var i=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},r=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=r.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return this.events.get(e)||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...i)=>{this.removeListener(e,n),t.apply(this,i)};return n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(e=>{e.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const t=new i(this,e,this.listenerCount(e));console.warn(t)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const i=[t].concat(n);this.events.set(e,i)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},s=r;s.defaultMaxListeners=10},function(e,t,n){"use strict";n.r(t);var i=n(6),r=n(171),s=n(28),o=n.n(s);const a=function(e){const t=JSON.stringify(e),n=encodeURIComponent(t).match(/%[89ABab]/g);return t.length+(n?n.length:0)},c=function e(t){if(t){if(Array.isArray(t)){const n=[];for(let i=0;i<t.length;i++)n[i]=e(t[i]);return n}if("object"==typeof t){const n=Object.assign({},t);for(const i in t)try{n[i]=e(t[i])}catch(e){console.debug("WARN: Failed cloning key on object, ignoring",{key:i,object:t})}return n}}return t};var u=n(50),l=n(49),d=n(29);function p(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function h(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function f(e){h(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Object(d.a)(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function m(e,t){h(2,arguments);var n=f(e),i=p(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}function g(e,t){h(2,arguments);var n=f(e),i=p(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var r=n.getDate(),s=new Date(n.getTime());s.setMonth(n.getMonth()+i+1,0);var o=s.getDate();return r>=o?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}function y(e,t){h(2,arguments);var n=f(e),i=f(t);return n.getTime()>i.getTime()}var b=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};const _=[408,429,500,503,504],v=[401],S=new Map;class w{constructor(e,t=!1){this.url=e,this.debugMode=t,this.sendQueue=[]}postLogsToEndpoint(e){const t=(()=>{let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}})();return this.sendQueue.push({requestParams:e,deferred:t}),this.sendNextQueuedLogToServer(),this.debug("adding requestParams to sendQueue",{requestParams:e,updatedSendQueue:this.sendQueue.map(e=>e.requestParams),hasPendingRequest:!!this.pendingRequest}),t.promise}postLogsToEndpointInstantly(e,t){return b(this,void 0,void 0,(function*(){if(this.debug("sending request instantly",{requestParams:e,sendQueue:this.sendQueue.map(e=>e.requestParams)}),!navigator.onLine)return this.saveRequestForLater(e);try{yield this.sendPostRequest(e)}catch(n){throw(null==t?void 0:t.saveOnFailure)&&this.saveRequestForLater(e),n}}))}saveRequestForLater(e){const t=this.getSavedRequests()||[],n=Object.assign({},e);delete n.accessToken,t.push(n),window.localStorage.setItem("gc_logger_requests",JSON.stringify(t))}getSavedRequests(){const e=window.localStorage.getItem("gc_logger_requests");if(e)try{return JSON.parse(e)}catch(t){console.error("Failed to parse saved messages, ignoring",{savedMessagesStr:e})}}sendEntireQueue(){this.debug("sending all queued requests instantly to clear out sendQueue",{sendQueue:this.sendQueue.map(e=>e.requestParams)});const e=[];let t;for(;t=this.sendQueue.shift();)e.push(this.postLogsToEndpointInstantly(t.requestParams,{saveOnFailure:!0}));return e}resetSendQueue(){this.debug("reseting send queue without sending currently queued data",{queueLength:this.sendQueue.length}),this.sendQueue=[]}sendNextQueuedLogToServer(){return b(this,void 0,void 0,(function*(){if(this.pendingRequest||0===this.sendQueue.length)return void this.debug("sendNextQueuedLogToServer() but not sending request",{hasPendingRequest:!!this.pendingRequest,sendQueueLength:this.sendQueue.length});const e=this.sendQueue.shift();return e.deferred.promise.finally(()=>{this.debug("queue item completed. removing from queue and resetting send queue",{queueItemRequestParams:e.requestParams,updatedSendQueue:this.sendQueue.map(e=>e.requestParams)}),this.pendingRequest=void 0,this.sendNextQueuedLogToServer()}),this.pendingRequest=e,this.debug("sending logs to server",{queueItem:e.requestParams,sendQueue:this.sendQueue.map(e=>e.requestParams)}),Object(l.backOff)(()=>this.backoffFn(e.requestParams),{retry:e=>{var t,n,i,r,s;const o=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.status,a=null==e?void 0:e.code,c=(null===(i=null===(n=e.response)||void 0===n?void 0:n.headers)||void 0===i?void 0:i["retry-after"])||(null===(s=null===(r=e.response)||void 0===r?void 0:r.getResponseHeader)||void 0===s?void 0:s.call(r,"retry-after"));if(c){const e=function(e,t){if(h(2,arguments),!t||"object"!==Object(d.a)(t))return new Date(NaN);var n=t.years?p(t.years):0,i=t.months?p(t.months):0,r=t.weeks?p(t.weeks):0,s=t.days?p(t.days):0,o=t.hours?p(t.hours):0,a=t.minutes?p(t.minutes):0,c=t.seconds?p(t.seconds):0,u=f(e),l=i||n?g(u,i+12*n):u,y=s||r?m(l,s+7*r):l,b=a+60*o,_=c+60*b,v=1e3*_,S=new Date(y.getTime()+v);return S}(new Date,{seconds:parseInt(c,10)});this.retryAfter&&!y(e,this.retryAfter)||(this.retryAfter=e)}return navigator.onLine&&(o&&_.includes(o)||"ERR_NETWORK"===a)},numOfAttempts:10,startingDelay:0,delayFirstAttempt:!1,maxDelay:15e3}).then(t=>{this.debug("successfully sent logs to server",{requestParams:e.requestParams,response:t}),e.deferred.resolve(t)}).catch(this.handleBackoffError.bind(this,e))}))}handleBackoffError(e,t){var n;const i=null===(n=t.response)||void 0===n?void 0:n.status;i&&_.includes(i)||v.includes(i)||"ERR_NETWORK"===t.code?(this.debug("Failed to sends logs to the server, moving request to the end of the queue",{requestParams:e.requestParams,error:t}),this.saveRequestForLater(e.requestParams)):this.debug("ERROR sending logs to server",{requestParams:e.requestParams,error:t}),e.deferred.reject(Object.assign(Object.assign({},t),{id:"rejectionSpot1"}))}retryAfterTimerCheck(){return b(this,void 0,void 0,(function*(){if(this.retryAfter){if(!y(Date.now(),this.retryAfter)){const e=function(e,t){return h(2,arguments),f(e).getTime()-f(t).getTime()}(this.retryAfter,Date.now());return this.debug('Respecting "retry-after" response header, waiting to send request',{millisecondsToWait:e}),yield new Promise(t=>{setTimeout(()=>{t(null)},e)}),this.retryAfterTimerCheck()}this.retryAfter=void 0}}))}backoffFn(e){return b(this,void 0,void 0,(function*(){yield this.retryAfterTimerCheck();const t=e.accessToken,n=yield this.sendPostRequest(e),i=this.getSavedRequests();return i&&(window.localStorage.removeItem("gc_logger_requests"),i.map(e=>{const n=Object.assign({accessToken:t},e);this.postLogsToEndpoint(n)})),n}))}sendPostRequest(e){this.debug("issuing POST request",{requestParams:e});const t=Object.assign({},e);return delete t.accessToken,Object(u.a)({method:"post",url:this.url,responseType:"text",headers:{authorization:"Bearer "+e.accessToken,"content-type":"application/json; charset=UTF-8"},data:t})}debug(e,t){this.debugMode&&console.log("%c [DEBUG:log-uploader] "+e,"color: #32a0a8",c(t))}}var T=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};class I{constructor(e){if(this.isInitialized=!1,this.logBuffer=[],this.debounceTimer=null,this.logger=e,!e.config.url||!e.config.appVersion){const t="Missing `url` and/or `appVersion` config options to set up server logging. Not sending logs to server for this logger instance";throw this.logger.error(t,{providedConfig:e.config},{skipServer:!0}),new Error(t)}this.isInitialized=!0,this.debounceLogUploadTime=e.config.uploadDebounceTime||4e3,this.logUploader=((e,t=!1,n)=>{if(n)return new w(e,t);let i=S.get(e);return i||(i=new w(e,t),S.set(e,i)),i})(e.config.url,e.config.debugMode,e.config.useUniqueLogUploader),window.addEventListener("unload",this.sendAllLogsInstantly.bind(this)),this.logger.on("onStop",e=>{this.debug("`onStop` received. Clearing logBuffer and sendQueue",{logBuffer:this.logBuffer,sendQueue:this.logUploader.sendQueue}),this.logBuffer=[],this.logUploader.resetSendQueue()})}addLogToSend(e,t,n){if(!this.isInitialized)return;const i=this.convertToLogMessage(t,n);let r=this.convertToTrace(e,i),s=a(r);if(s>14500){const t=this.truncateLog(e,i);if(null===t)return void this.logger.error("truncated message is too large to send to server. not sending message",{originalTrace:r,originalTraceSize:a(r),truncatedTrace:t,truncatedTraceSize:a(t)},{skipServer:!0});s=a(t),r=t}const o=!this.logBuffer.length;let c;c=o?{size:0,traces:[]}:this.logBuffer[this.logBuffer.length-1];if(c.size+s>14500)return this.debug("`exceedsMaxLogSize` was `true`",{logBuffer:this.logBuffer,bufferItem:c,incomingTrace:r,incomingTraceSize:s,maxAllowedTraceSize:14500}),this.logBuffer.push({size:s,traces:[r]}),this.debug("calling sendLogsToServer(true)",{logBuffer:this.logBuffer}),void this.sendLogsToServer(!0);c.size+=s,c.traces.push(r),o&&(this.debug("`this.logBuffer` was empty. pushing new buffer item",{logBuffer:this.logBuffer,bufferItem:c}),this.logBuffer.push(c)),this.debug("calling sendLogsToServer()",{logBuffer:this.logBuffer}),this.sendLogsToServer()}sendAllLogsInstantly(){return this.logUploader.sendEntireQueue().concat(this.logBuffer.map(e=>this.logUploader.postLogsToEndpointInstantly(this.convertToRequestParams(e.traces.reverse()),{saveOnFailure:!0})))}sendLogsToServer(e=!1){var t;return T(this,void 0,void 0,(function*(){if(!this.logBuffer.length)return clearTimeout(this.debounceTimer),this.debounceTimer=null,void this.debug("buffer empty, not sending http request");if(!e)return void(this.debounceTimer?this.debug("sendLogsToServer() 'immediate' is false. 'debounceTimer' is already running"):(this.debug(`sendLogsToServer() 'immediate' is false. setting up 'debounceTimer' to ${this.debounceLogUploadTime}ms`),this.debounceTimer=setTimeout(()=>this.sendLogsToServer(!0),this.debounceLogUploadTime)));clearTimeout(this.debounceTimer),this.debounceTimer=null;const[n]=this.logBuffer.splice(0,1);try{this.debug("calling logUploader.postLogsToEndpoint() with",{bufferItem:n,newLogBuffer:this.logBuffer}),yield this.logUploader.postLogsToEndpoint(this.convertToRequestParams(n.traces.reverse()))}catch(e){this.logger.emit("onError",e),this.logger.error("Error sending logs to server",e,{skipServer:!0});const n=(null==e?void 0:e.status)?parseInt(e.status,10):parseInt(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.status,10);[401,403,404].includes(n)&&(this.logger.warn(`received a ${n} from logUploader. stopping logging to server`),this.logger.stopServerLogging())}finally{this.sendLogsToServer()}}))}truncateLog(e,t){let n,i;const r=a(this.convertToTrace(e,t)),s=c(t);return s.details="[[TRUNCATED]]",n=this.convertToTrace(e,s),i=a(n),i<=14500?(this.logger.warn("message too large to send to server. truncated log details",{originalLog:t,truncatedLog:s,originalTraceSize:r,truncatedTraceSize:i,maxAllowedTraceSize:14500},{skipServer:!0}),n):(s.message=s.message.substr(0,150)+"... [[TRUNCATED]]",n=this.convertToTrace(e,s),i=a(n),i<=14500?(this.logger.warn("message too large to send to server. truncated log details & log message",{originalLog:t,truncatedLog:s,originalTraceSize:r,truncatedTraceSize:i,maxAllowedTraceSize:14500},{skipServer:!0}),n):null)}convertToLogMessage(e,t){const n={clientTime:(new Date).toISOString(),clientId:this.logger.clientId,message:e,details:t},{originAppName:i,originAppVersion:r,originAppId:s}=this.logger.config;return i&&(n.originAppName=i,n.originAppVersion=r,n.originAppId=s),n}convertToTrace(e,t){return{topic:this.logger.config.appName,level:e.toUpperCase(),message:o()(t)}}convertToRequestParams(e){return{accessToken:this.logger.config.accessToken,app:{appId:this.logger.config.appName,appVersion:this.logger.config.appVersion},traces:e}}debug(e,t){this.logger.config.debugMode&&console.log(`%c [DEBUG:${this.logger.config.appName}] ${e}`,"color: #32a852",c(t))}}class N extends i.EventEmitter{constructor(e){super(),this.defaultFormatter=(e,t,n,i,r)=>{if(i.skipDefaultFormatter)return r();t instanceof Error&&(n=n||t,t=t.message);r(e,t=`${this.config.appName?`[${this.config.appName}] `:""}${t}`,n,i)},this.logMessage=(e,t,n,i)=>{if(!i.skipSecondaryLogger)try{const i=[t];void 0!==n&&i.push(this.config.stringify?o()(n):n),this.secondaryLogger[e].apply(this.secondaryLogger,i)}catch(e){console.error("Error logging using custom logger passed into `genesys-cloud-client-logger`",{error:e,secondaryLogger:this.secondaryLogger,message:t,details:n,messageOptions:i})}!i.skipServer&&!this.stopReason&&this.serverLogger&&this.logRank(e)>=this.logRank(this.config.logLevel)&&this.serverLogger.addLogToSend(e,t,n)},Object.defineProperty(this,"clientId",{value:Object(r.a)(),writable:!1}),this.config=Object.assign({},e),this.secondaryLogger=this.config.logger||console,delete this.config.logger,-1===this.logRank(this.config.logLevel)&&(e.logLevel&&this.warn(`Invalid log level: "${e.logLevel}". Default "info" will be used instead.`,null,{skipServer:!0}),this.config.logLevel="info"),!e.appName&&e.logTopic&&(this.warn("`logTopic` has been renamed to `appName`. Please use `appName`",null,{skipServer:!0}),this.config.appName=e.logTopic),!1!==this.config.initializeServerLogging&&(this.serverLogger=new I(this)),this.config.startServerLoggingPaused&&this.stopServerLogging()}get VERSION(){return N.VERSION}setAccessToken(e){this.config.accessToken=e,401==this.stopReason&&this.startServerLogging()}log(e,t,n){this.formatMessage("log",e,t,n)}debug(e,t,n){this.formatMessage("debug",e,t,n)}info(e,t,n){this.formatMessage("info",e,t,n)}warn(e,t,n){this.formatMessage("warn",e,t,n)}error(e,t,n){this.formatMessage("error",e,t,n)}startServerLogging(){if(this.stopReason=void 0,!this.serverLogger)return this.warn("`startServerLogging` called but the logger instance is not configured to send logs to the server. Ignoring call to start sending logs to server.",void 0,{skipServer:!0});this.emit("onStart")}stopServerLogging(e="force"){"force"===this.stopReason&&"force"!==e||(this.stopReason=e,this.emit("onStop",e))}sendAllLogsInstantly(){var e;return(null===(e=this.serverLogger)||void 0===e?void 0:e.sendAllLogsInstantly())||[]}formatMessage(e,t,n,i){let r=[this.defaultFormatter.bind(this)];this.config.formatters&&(r=[...this.config.formatters,this.defaultFormatter.bind(this)]),this.callNextFormatter(r,e,t,n,i)}callNextFormatter(e,t,n,i,r={}){const[s,...o]=e;if(!s)return this.logMessage(t,n,i,r);s(t,n,i,r,(e,s,a,c)=>{void 0!==e?this.callNextFormatter(o,e,s,a,c):this.callNextFormatter(o,t,n,i,r)})}logRank(e){switch(e){case"log":return 0;case"debug":return 1;case"info":return 2;case"warn":return 3;case"error":return 4;default:return-1}}}N.VERSION="4.2.10",n.d(t,"Logger",(function(){return N}));t.default=N}]).default;
|