1 |
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SIP=t():e.SIP=t()}(this,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=165)}([function(e,t,r){var i;e.exports=(i=i||function(e,t){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&"undefined"!=typeof global&&global.crypto&&(i=global.crypto),!i)try{i=r(130)}catch(e){}var n=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},a=o.lib={},c=a.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},d=a.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s<n;s++){var o=r[s>>>2]>>>24-s%4*8&255;t[i+s>>>2]|=o<<24-(i+s)%4*8}else for(var a=0;a<n;a+=4)t[i+a>>>2]=r[a>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new d.init(t,e)}}),l=o.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new d.init(r,t/2)}},h=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new d.init(r,t)}},p=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},g=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,o=this.blockSize,a=s/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,l=e.min(4*c,s);if(c){for(var u=0;u<c;u+=o)this._doProcessBlock(n,u);r=n.splice(0,c),i.sigBytes-=l}return new d.init(r,l)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(a.Hasher=g.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),o.algo={});return o}(Math),i)},function(e,t,r){"use strict";var i=r(16),n="object"==typeof self&&self&&self.Object===Object&&self,s=i.a||n||Function("return this")();t.a=s},function(e,t,r){"use strict";var i,n=r(30),s=Object.prototype.toString,o=(i=Object.create(null),function(e){var t=s.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return o(t)===e}}function c(e){return Array.isArray(e)}function d(e){return void 0===e}var l=a("ArrayBuffer");function u(e){return null!==e&&"object"==typeof e}function h(e){if("object"!==o(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var p=a("Date"),g=a("File"),f=a("Blob"),m=a("FileList");function v(e){return"[object Function]"===s.call(e)}var y=a("URLSearchParams");function b(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),c(e))for(var r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}var w,S=(w="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return w&&e instanceof w});e.exports={isArray:c,isArrayBuffer:l,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return e&&("function"==typeof FormData&&e instanceof FormData||"[object FormData]"===s.call(e)||v(e.toString)&&"[object FormData]"===e.toString())},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&l(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isPlainObject:h,isUndefined:d,isDate:p,isFile:g,isBlob:f,isFunction:v,isStream:function(e){return u(e)&&v(e.pipe)},isURLSearchParams:y,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:b,merge:function e(){var t={};function r(r,i){h(t[i])&&h(r)?t[i]=e(t[i],r):h(r)?t[i]=e({},r):c(r)?t[i]=r.slice():t[i]=r}for(var i=0,n=arguments.length;i<n;i++)b(arguments[i],r);return t},extend:function(e,t,r){return b(t,(function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,i){e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r){var i,n,s,o={};t=t||{};do{for(n=(i=Object.getOwnPropertyNames(e)).length;n-- >0;)o[s=i[n]]||(t[s]=e[s],o[s]=!0);e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var i=e.indexOf(t,r);return-1!==i&&i===r},toArray:function(e){if(!e)return null;var t=e.length;if(d(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:S,isFileList:m}},function(e,t,r){var i,n,s,o,a,c,d,l,u,h,p,g,f,m,v,y,b,w,S;e.exports=(i=r(0),r(8),void(i.lib.Cipher||(n=i,s=n.lib,o=s.Base,a=s.WordArray,c=s.BufferedBlockAlgorithm,d=n.enc,d.Utf8,l=d.Base64,u=n.algo.EvpKDF,h=s.Cipher=c.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){c.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?S:b}return function(t){return{encrypt:function(r,i,n){return e(i).encrypt(t,r,i,n)},decrypt:function(r,i,n){return e(i).decrypt(t,r,i,n)}}}}()}),s.StreamCipher=h.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),p=n.mode={},g=s.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),f=p.CBC=function(){var e=g.extend();function t(e,t,r){var i,n=this._iv;n?(i=n,this._iv=void 0):i=this._prevBlock;for(var s=0;s<r;s++)e[t+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(e,r){var i=this._cipher,n=i.blockSize;t.call(this,e,r,n),i.encryptBlock(e,r),this._prevBlock=e.slice(r,r+n)}}),e.Decryptor=e.extend({processBlock:function(e,r){var i=this._cipher,n=i.blockSize,s=e.slice(r,r+n);i.decryptBlock(e,r),t.call(this,e,r,n),this._prevBlock=s}}),e}(),m=(n.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,i=r-e.sigBytes%r,n=i<<24|i<<16|i<<8|i,s=[],o=0;o<i;o+=4)s.push(n);var c=a.create(s,i);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},s.BlockCipher=h.extend({cfg:h.cfg.extend({mode:f,padding:m}),reset:function(){var e;h.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),v=s.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?a.create([1398893684,1701076831]).concat(r).concat(t):t).toString(l)},parse:function(e){var t,r=l.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=a.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},b=s.SerializableCipher=o.extend({cfg:o.extend({format:y}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),o=n.cfg;return v.create({ciphertext:s,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),w=(n.kdf={}).OpenSSL={execute:function(e,t,r,i){i||(i=a.random(8));var n=u.create({keySize:t+r}).compute(e,i),s=a.create(n.words.slice(t),4*r);return n.sigBytes=4*t,v.create({key:n,iv:s,salt:i})}},S=s.PasswordBasedCipher=b.extend({cfg:b.cfg.extend({kdf:w}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize);i.iv=n.iv;var s=b.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt);return i.iv=n.iv,b.decrypt.call(this,e,t,n.key,i)}}))))},function(e,t,r){var i,n,s;e.exports=(s=r(0),n=(i=s).lib.WordArray,i.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s<r;s+=3)for(var o=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a<r;a++)n.push(i.charAt(o>>>6*(3-a)&63));var c=i.charAt(64);if(c)for(;n.length%4;)n.push(c);return n.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var s=0;s<r.length;s++)i[r.charCodeAt(s)]=s}var o=r.charAt(64);if(o){var a=e.indexOf(o);-1!==a&&(t=a)}return function(e,t,r){for(var i=[],s=0,o=0;o<t;o++)if(o%4){var a=r[e.charCodeAt(o-1)]<<o%4*2,c=r[e.charCodeAt(o)]>>>6-o%4*2,d=a|c;i[s>>>2]|=d<<24-s%4*8,s++}return n.create(i,s)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},s.enc.Base64)},function(e,t,r){"use strict";(function(e){var i=r(1),n=r(44),s="object"==typeof exports&&exports&&!exports.nodeType&&exports,o=s&&"object"==typeof e&&e&&!e.nodeType&&e,a=o&&o.exports===s?i.a.Buffer:void 0,c=(a?a.isBuffer:void 0)||n.a;t.a=c}).call(this,r(23)(e))},function(e,t,r){"use strict";(function(e){var i=r(16),n="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=n&&"object"==typeof e&&e&&!e.nodeType&&e,o=s&&s.exports===n&&i.a.process,a=function(){try{var e=s&&s.require&&s.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();t.a=a}).call(this,r(23)(e))},function(e,t,r){var i;e.exports=(i=r(0),function(e){var t=i,r=t.lib,n=r.WordArray,s=r.Hasher,o=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=o.MD5=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,o=e[t+0],c=e[t+1],p=e[t+2],g=e[t+3],f=e[t+4],m=e[t+5],v=e[t+6],y=e[t+7],b=e[t+8],w=e[t+9],S=e[t+10],T=e[t+11],_=e[t+12],E=e[t+13],C=e[t+14],R=e[t+15],A=s[0],I=s[1],k=s[2],P=s[3];A=d(A,I,k,P,o,7,a[0]),P=d(P,A,I,k,c,12,a[1]),k=d(k,P,A,I,p,17,a[2]),I=d(I,k,P,A,g,22,a[3]),A=d(A,I,k,P,f,7,a[4]),P=d(P,A,I,k,m,12,a[5]),k=d(k,P,A,I,v,17,a[6]),I=d(I,k,P,A,y,22,a[7]),A=d(A,I,k,P,b,7,a[8]),P=d(P,A,I,k,w,12,a[9]),k=d(k,P,A,I,S,17,a[10]),I=d(I,k,P,A,T,22,a[11]),A=d(A,I,k,P,_,7,a[12]),P=d(P,A,I,k,E,12,a[13]),k=d(k,P,A,I,C,17,a[14]),A=l(A,I=d(I,k,P,A,R,22,a[15]),k,P,c,5,a[16]),P=l(P,A,I,k,v,9,a[17]),k=l(k,P,A,I,T,14,a[18]),I=l(I,k,P,A,o,20,a[19]),A=l(A,I,k,P,m,5,a[20]),P=l(P,A,I,k,S,9,a[21]),k=l(k,P,A,I,R,14,a[22]),I=l(I,k,P,A,f,20,a[23]),A=l(A,I,k,P,w,5,a[24]),P=l(P,A,I,k,C,9,a[25]),k=l(k,P,A,I,g,14,a[26]),I=l(I,k,P,A,b,20,a[27]),A=l(A,I,k,P,E,5,a[28]),P=l(P,A,I,k,p,9,a[29]),k=l(k,P,A,I,y,14,a[30]),A=u(A,I=l(I,k,P,A,_,20,a[31]),k,P,m,4,a[32]),P=u(P,A,I,k,b,11,a[33]),k=u(k,P,A,I,T,16,a[34]),I=u(I,k,P,A,C,23,a[35]),A=u(A,I,k,P,c,4,a[36]),P=u(P,A,I,k,f,11,a[37]),k=u(k,P,A,I,y,16,a[38]),I=u(I,k,P,A,S,23,a[39]),A=u(A,I,k,P,E,4,a[40]),P=u(P,A,I,k,o,11,a[41]),k=u(k,P,A,I,g,16,a[42]),I=u(I,k,P,A,v,23,a[43]),A=u(A,I,k,P,w,4,a[44]),P=u(P,A,I,k,_,11,a[45]),k=u(k,P,A,I,R,16,a[46]),A=h(A,I=u(I,k,P,A,p,23,a[47]),k,P,o,6,a[48]),P=h(P,A,I,k,y,10,a[49]),k=h(k,P,A,I,C,15,a[50]),I=h(I,k,P,A,m,21,a[51]),A=h(A,I,k,P,_,6,a[52]),P=h(P,A,I,k,g,10,a[53]),k=h(k,P,A,I,S,15,a[54]),I=h(I,k,P,A,c,21,a[55]),A=h(A,I,k,P,b,6,a[56]),P=h(P,A,I,k,R,10,a[57]),k=h(k,P,A,I,v,15,a[58]),I=h(I,k,P,A,E,21,a[59]),A=h(A,I,k,P,f,6,a[60]),P=h(P,A,I,k,T,10,a[61]),k=h(k,P,A,I,p,15,a[62]),I=h(I,k,P,A,w,21,a[63]),s[0]=s[0]+A|0,s[1]=s[1]+I|0,s[2]=s[2]+k|0,s[3]=s[3]+P|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),o=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,c=a.words,d=0;d<4;d++){var l=c[d];c[d]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,r,i,n,s,o){var a=e+(t&r|~t&i)+n+o;return(a<<s|a>>>32-s)+t}function l(e,t,r,i,n,s,o){var a=e+(t&i|r&~i)+n+o;return(a<<s|a>>>32-s)+t}function u(e,t,r,i,n,s,o){var a=e+(t^r^i)+n+o;return(a<<s|a>>>32-s)+t}function h(e,t,r,i,n,s,o){var a=e+(r^(t|~i))+n+o;return(a<<s|a>>>32-s)+t}t.MD5=s._createHelper(c),t.HmacMD5=s._createHmacHelper(c)}(Math),i.MD5)},function(e,t,r){var i,n,s,o,a,c,d,l;e.exports=(l=r(0),r(21),r(22),n=(i=l).lib,s=n.Base,o=n.WordArray,a=i.algo,c=a.MD5,d=a.EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,i=this.cfg,n=i.hasher.create(),s=o.create(),a=s.words,c=i.keySize,d=i.iterations;a.length<c;){r&&n.update(r),r=n.update(e).finalize(t),n.reset();for(var l=1;l<d;l++)r=n.finalize(r),n.reset();s.concat(r)}return s.sigBytes=4*c,s}}),i.EvpKDF=function(e,t,r){return d.create(r).compute(e,t)},l.EvpKDF)},function(e,t,r){"use strict";var i=r(2);function n(e,t,r,i,n){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}i.inherits(n,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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var s=n.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"].forEach((function(e){o[e]={value:e}})),Object.defineProperties(n,o),Object.defineProperty(s,"isAxiosError",{value:!0}),n.from=function(e,t,r,o,a,c){var d=Object.create(s);return i.toFlatObject(e,d,(function(e){return e!==Error.prototype})),n.call(d,e.message,t,r,o,a),d.name=e.name,c&&Object.assign(d,c),d},e.exports=n},function(e,t,r){"use strict";var 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((function(e){return e.trim()}))},i.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},i.getDescription=function(e){var t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){var t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},i.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:r[t[i]]=t[i+1]}return r},i.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&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){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},i.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},i.parseExtmap=function(e){var 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){for(var t,r={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].trim().split("="))[0].trim()]=t[1];return r},i.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},i.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r},i.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},i.getMid=function(e){var t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},i.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},i.parseCryptoLine=function(e){var 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;var 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){var r=i.matchPrefix(e+t,"a=ice-ufrag:")[0],n=i.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},i.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},i.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=i.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var s=r[n],o=i.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(o){var a=i.parseRtpMap(o),c=i.matchPrefix(e,"a=fmtp:"+s+" ");switch(a.parameters=c.length?i.parseFmtp(c[0]):{},a.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(i.parseRtcpFb),t.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(a.name.toUpperCase())}}}return i.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(i.parseExtmap(e))})),t},i.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ",r+=t.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){r+=i.writeRtpMap(e),r+=i.writeFmtp(e),r+=i.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),r+="a=rtcp-mux\r\n",t.headerExtensions&&t.headerExtensions.forEach((function(e){r+=i.writeExtmap(e)})),r},i.parseRtpEncodingParameters=function(e){var t,r=[],n=i.parseRtpParameters(e),s=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=a.length>0&&a[0].ssrc,d=i.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));d.length>0&&d[0].length>1&&d[0][0]===c&&(t=d[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var i={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&t&&(i.rtx={ssrc:t}),r.push(i),s&&((i=JSON.parse(JSON.stringify(i))).fec={ssrc:c,mechanism:o?"red+ulpfec":"red"},r.push(i))}})),0===r.length&&c&&r.push({ssrc:c});var l=i.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=l}))),r},i.parseRtcpParameters=function(e){var t={},r=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var s=i.matchPrefix(e,"a=rtcp-mux");return t.mux=s.length>0,t},i.parseMsid=function(e){var t,r=i.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var n=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},i.parseSctpDescription=function(e){var t,r=i.parseMLine(e),n=i.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var s=i.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};if(i.matchPrefix(e,"a=sctpmap:").length>0){var o=i.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(o[0],10),protocol:o[1],maxMessageSize:t}}},i.writeSctpDescription=function(e,t){var r=[];return r="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&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||i.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.writeMediaSection=function(e,t,r,n){var s=i.writeRtpDescription(e.kind,t);if(s+=i.writeIceParameters(e.iceGatherer.getLocalParameters()),s+=i.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),s+="a=mid:"+e.mid+"\r\n",e.direction?s+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?s+="a=sendrecv\r\n":e.rtpSender?s+="a=sendonly\r\n":e.rtpReceiver?s+="a=recvonly\r\n":s+="a=inactive\r\n",e.rtpSender){var o="msid:"+n.id+" "+e.rtpSender.track.id+"\r\n";s+="a="+o,s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+o,e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+o,s+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+i.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+"\r\n"),s},i.getDirection=function(e,t){for(var r=i.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].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){var 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){var 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;for(var t=i.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},e.exports=i},function(e,t,r){var i;e.exports=(i=r(0),i.enc.Utf8)},,function(e,t,r){"use strict";var i=r(9);function n(e){i.call(this,null==e?"canceled":e,i.ERR_CANCELED),this.name="CanceledError"}r(2).inherits(n,i,{__CANCEL__:!0}),e.exports=n},function(e,t,r){var i,n,s,o,a,c;e.exports=(c=r(0),n=(i=c).lib,s=n.Base,o=n.WordArray,(a=i.x64={}).Word=s.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],i=0;i<t;i++){var n=e[i];r.push(n.high),r.push(n.low)}return o.create(r,this.sigBytes)},clone:function(){for(var e=s.clone.call(this),t=e.words=this.words.slice(0),r=t.length,i=0;i<r;i++)t[i]=t[i].clone();return e}}),c)},function(e,t,r){var i;e.exports=(i=r(0),r(4),r(7),r(8),r(3),function(){var e=i,t=e.lib.BlockCipher,r=e.algo,n=[],s=[],o=[],a=[],c=[],d=[],l=[],u=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var g=i^i<<1^i<<2^i<<3^i<<4;g=g>>>8^255&g^99,n[r]=g,s[g]=r;var f=e[r],m=e[f],v=e[m],y=257*e[g]^16843008*g;o[r]=y<<24|y>>>8,a[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,d[r]=y,y=16843009*v^65537*m^257*f^16843008*r,l[g]=y<<24|y>>>8,u[g]=y<<16|y>>>16,h[g]=y<<8|y>>>24,p[g]=y,r?(r=f^e[e[e[v^f]]],i^=e[e[i]]):r=i=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],f=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],o=0;o<i;o++)o<r?s[o]=t[o]:(d=s[o-1],o%r?r>6&&o%r==4&&(d=n[d>>>24]<<24|n[d>>>16&255]<<16|n[d>>>8&255]<<8|n[255&d]):(d=n[(d=d<<8|d>>>24)>>>24]<<24|n[d>>>16&255]<<16|n[d>>>8&255]<<8|n[255&d],d^=g[o/r|0]<<24),s[o]=s[o-r]^d);for(var a=this._invKeySchedule=[],c=0;c<i;c++){if(o=i-c,c%4)var d=s[o];else d=s[o-4];a[c]=c<4||o<=4?d:l[n[d>>>24]]^u[n[d>>>16&255]]^h[n[d>>>8&255]]^p[n[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,c,d,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,u,h,p,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,o,a){for(var c=this._nRounds,d=e[t]^r[0],l=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],p=4,g=1;g<c;g++){var f=i[d>>>24]^n[l>>>16&255]^s[u>>>8&255]^o[255&h]^r[p++],m=i[l>>>24]^n[u>>>16&255]^s[h>>>8&255]^o[255&d]^r[p++],v=i[u>>>24]^n[h>>>16&255]^s[d>>>8&255]^o[255&l]^r[p++],y=i[h>>>24]^n[d>>>16&255]^s[l>>>8&255]^o[255&u]^r[p++];d=f,l=m,u=v,h=y}f=(a[d>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&h])^r[p++],m=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[h>>>8&255]<<8|a[255&d])^r[p++],v=(a[u>>>24]<<24|a[h>>>16&255]<<16|a[d>>>8&255]<<8|a[255&l])^r[p++],y=(a[h>>>24]<<24|a[d>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^r[p++],e[t]=f,e[t+1]=m,e[t+2]=v,e[t+3]=y},keySize:8});e.AES=t._createHelper(f)}(),i.AES)},function(e,t,r){"use strict";var i="object"==typeof global&&global&&global.Object===Object&&global;t.a=i},function(e,t,r){"use strict";(function(e){var i=r(1),n="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=n&&"object"==typeof e&&e&&!e.nodeType&&e,o=s&&s.exports===n?i.a.Buffer:void 0,a=o?o.allocUnsafe:void 0;t.a=function(e,t){if(t)return e.slice();var r=e.length,i=a?a(r):new e.constructor(r);return e.copy(i),i}}).call(this,r(23)(e))},function(e,t,r){var i,n,s;!function(r,o){"use strict";n=[],void 0===(s="function"==typeof(i=function(e){return function(t){(t=t||{}).arrayAccessForm=t.arrayAccessForm||"none",t.emptyNodeForm=t.emptyNodeForm||"text",t.jsAttributeFilter=t.jsAttributeFilter,t.jsAttributeConverter=t.jsAttributeConverter,t.attributeConverters=t.attributeConverters||[],t.datetimeAccessFormPaths=t.datetimeAccessFormPaths||[],t.arrayAccessFormPaths=t.arrayAccessFormPaths||[],t.xmldomOptions=t.xmldomOptions||{},void 0===t.enableToStringFunc&&(t.enableToStringFunc=!0),void 0===t.skipEmptyTextNodesForObj&&(t.skipEmptyTextNodesForObj=!0),void 0===t.stripWhitespaces&&(t.stripWhitespaces=!0),void 0===t.useDoubleQuotes&&(t.useDoubleQuotes=!0),void 0===t.ignoreRoot&&(t.ignoreRoot=!1),void 0===t.escapeMode&&(t.escapeMode=!0),void 0===t.attributePrefix&&(t.attributePrefix="_"),void 0===t.selfClosingElements&&(t.selfClosingElements=!0),void 0===t.keepCData&&(t.keepCData=!1),void 0===t.keepText&&(t.keepText=!1),void 0===t.jsDateUTC&&(t.jsDateUTC=!1),function(){function e(e){var t=String(e);return 1===t.length&&(t="0"+t),t}"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|^\n+|(\s|\n)+$/g,"")}),"function"!=typeof Date.prototype.toISOString&&(Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"})}();var r=1,i=3,n=4,s=8,o=9;function a(e){var t=e.localName;return null==t&&(t=e.baseName),null!=t&&""!==t||(t=e.nodeName),t}function c(e){return"string"==typeof e?e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):e}function d(e,r,i){switch(t.arrayAccessForm){case"property":e[r]instanceof Array?e[r+"_asArray"]=e[r]:e[r+"_asArray"]=[e[r]]}if(!(e[r]instanceof Array)&&t.arrayAccessFormPaths.length>0){for(var n=!1,s=0;s<t.arrayAccessFormPaths.length;s++){var o=t.arrayAccessFormPaths[s];if("string"==typeof o){if(o===i){n=!0;break}}else if(o instanceof RegExp){if(o.test(i)){n=!0;break}}else if("function"==typeof o&&o(r,i)){n=!0;break}}n&&(e[r]=[e[r]])}}function l(e){var t=e.split(/[-T:+Z]/g),r=new Date(t[0],t[1]-1,t[2]),i=t[5].split(".");if(r.setHours(t[3],t[4],i[0]),i.length>1&&r.setMilliseconds(i[1]),t[6]&&t[7]){var n=60*t[6]+Number(t[7]);n=0+("-"===(/\d\d-\d\d:\d\d$/.test(e)?"-":"+")?-1*n:n),r.setMinutes(r.getMinutes()-n-r.getTimezoneOffset())}else-1!==e.indexOf("Z",e.length-1)&&(r=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())));return r}function u(e,r){for(var i={__cnt:0},n=e.childNodes,o=0;o<n.length;o++){var c=n.item(o),u=a(c);c.nodeType!==s&&(i.__cnt++,null==i[u]?(i[u]=h(c,r+"."+u),d(i,u,r+"."+u)):(i[u]instanceof Array||(i[u]=[i[u]],d(i,u,r+"."+u)),i[u][i[u].length]=h(c,r+"."+u)))}for(var p=0;p<e.attributes.length;p++){var g=e.attributes.item(p);i.__cnt++;for(var f=g.value,m=0;m<t.attributeConverters.length;m++){var v=t.attributeConverters[m];v.test.call(null,g.name,g.value)&&(f=v.convert.call(null,g.name,g.value))}i[t.attributePrefix+g.name]=f}var y=e.prefix;return y&&(i.__cnt++,i.__prefix=y),i["#text"]&&(i.__text=i["#text"],i.__text instanceof Array&&(i.__text=i.__text.join("\n")),t.escapeMode&&(i.__text=i.__text.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")),t.stripWhitespaces&&(i.__text=i.__text.trim()),delete i["#text"],"property"===t.arrayAccessForm&&delete i["#text_asArray"],i.__text=function(e,r,i){if(t.datetimeAccessFormPaths.length>0)for(var n=i.split(".#")[0],s=0;s<t.datetimeAccessFormPaths.length;s++){var o=t.datetimeAccessFormPaths[s];if("string"==typeof o){if(o===n)return l(e)}else if(o instanceof RegExp){if(o.test(n))return l(e)}else if("function"==typeof o&&o(n))return l(e)}return e}(i.__text,0,r+".#text")),i.hasOwnProperty("#cdata-section")&&(i.__cdata=i["#cdata-section"],delete i["#cdata-section"],"property"===t.arrayAccessForm&&delete i["#cdata-section_asArray"]),1===i.__cnt&&i.__text&&!t.keepText?i=i.__text:0===i.__cnt&&"text"===t.emptyNodeForm?i="":i.__cnt>1&&void 0!==i.__text&&t.skipEmptyTextNodesForObj&&(t.stripWhitespaces&&""===i.__text||""===i.__text.trim())&&delete i.__text,delete i.__cnt,t.keepCData||i.hasOwnProperty("__text")||!i.hasOwnProperty("__cdata")||1!==Object.keys(i).length?(t.enableToStringFunc&&(i.__text||i.__cdata)&&(i.toString=function(){return(this.__text?this.__text:"")+(this.__cdata?this.__cdata:"")}),i):i.__cdata?i.__cdata:""}function h(e,s){return e.nodeType===o?function(e){for(var i={},n=e.childNodes,s=0;s<n.length;s++){var o=n.item(s);if(o.nodeType===r){var c=a(o);t.ignoreRoot?i=h(o,c):i[c]=h(o,c)}}return i}(e):e.nodeType===r?u(e,s):e.nodeType===i||e.nodeType===n?e.nodeValue:null}function p(e,r,i,n){var s="<"+(e&&e.__prefix?e.__prefix+":":"")+r;if(i)for(var o=0;o<i.length;o++){var a=i[o],d=e[a];t.escapeMode&&(d=c(d)),s+=" "+a.substr(t.attributePrefix.length)+"=",t.useDoubleQuotes?s+='"'+d+'"':s+="'"+d+"'"}return s+=n?" />":">"}function g(e,t){return"</"+(e&&e.__prefix?e.__prefix+":":"")+t+">"}function f(e,r){return"property"===t.arrayAccessForm&&(i=r.toString(),n="_asArray",-1!==i.indexOf(n,i.length-n.length))||0===r.toString().indexOf(t.attributePrefix)||0===r.toString().indexOf("__")||e[r]instanceof Function;var i,n}function m(e){var t=0;if(e instanceof Object)for(var r in e)f(e,r)||t++;return t}function v(e){var r=[];if(e instanceof Object)for(var i in e)-1===i.toString().indexOf("__")&&0===i.toString().indexOf(t.attributePrefix)&&r.push(i);return r}function y(e){var r="";return e instanceof Object?r+=function(e){var r="";return e.__cdata&&(r+="<![CDATA["+e.__cdata+"]]>"),(e.__text||"number"==typeof e.__text||"boolean"==typeof e.__text)&&(t.escapeMode?r+=c(e.__text):r+=e.__text),r}(e):null!==e&&(t.escapeMode?r+=c(e):r+=e),r}function b(e,r,i){var n="";if(t.jsAttributeFilter&&t.jsAttributeFilter.call(null,r,e))return n;if(t.jsAttributeConverter&&(e=t.jsAttributeConverter.call(null,r,e)),null!=e&&""!==e||!t.selfClosingElements)if("object"==typeof e)if("[object Array]"===Object.prototype.toString.call(e))n+=function(e,t,r){var i="";if(0===e.length)i+=p(e,t,r,!0);else for(var n=0;n<e.length;n++)i+=b(e[n],t,v(e[n]));return i}(e,r,i);else if(e instanceof Date)n+=p(e,r,i,!1),n+=t.jsDateUTC?e.toUTCString():e.toISOString(),n+=g(e,r);else{m(e)>0||"number"==typeof e.__text||"boolean"==typeof e.__text||e.__text||e.__cdata?(n+=p(e,r,i,!1),n+=w(e),n+=g(e,r)):t.selfClosingElements?n+=p(e,r,i,!0):(n+=p(e,r,i,!1),n+=g(e,r))}else n+=p(e,r,i,!1),n+=y(e),n+=g(e,r);else n+=p(e,r,i,!0);return n}function w(e){var t="";if(m(e)>0)for(var r in e)if(!f(e,r)){var i=e[r];t+=b(i,r,v(i))}return t+=y(e)}function S(r){if(void 0===r)return null;if("string"!=typeof r)return null;var i=null,n=null;if(e)n=(i=new e(t.xmldomOptions)).parseFromString(r,"text/xml");else if(window&&window.DOMParser){i=new window.DOMParser;var s=null;if(!(window.ActiveXObject||"ActiveXObject"in window)&&document.all&&!document.addEventListener)try{s=i.parseFromString("INVALID","text/xml").childNodes[0].namespaceURI}catch(e){s=null}try{n=i.parseFromString(r,"text/xml"),null!==s&&n.getElementsByTagNameNS(s,"parsererror").length>0&&(n=null)}catch(e){n=null}}else 0===r.indexOf("<?")&&(r=r.substr(r.indexOf("?>")+2)),(n=new ActiveXObject("Microsoft.XMLDOM")).async="false",n.loadXML(r);return n}this.asArray=function(e){return null==e?[]:e instanceof Array?e:[e]},this.toXmlDateTime=function(e){return e instanceof Date?e.toISOString():"number"==typeof e?new Date(e).toISOString():null},this.asDateTime=function(e){return"string"==typeof e?l(e):e},this.xml2dom=function(e){return S(e)},this.dom2js=function(e){return h(e,null)},this.js2dom=function(e){return S(this.js2xml(e))},this.xml2js=function(e){var t=S(e);return null!=t?this.dom2js(t):null},this.js2xml=function(e){return w(e)},this.getVersion=function(){return"3.4.4"}}})?i.apply(t,n):i)||(e.exports=s)}()},,function(e,t,r){"use strict";var i=r(2),n=r(117),s=r(9),o=r(32),a=r(33),c={"Content-Type":"application/x-www-form-urlencoded"};function d(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,u={transitional:o,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(l=r(34)),l),transformRequest:[function(e,t){if(n(t,"Accept"),n(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e))return e;if(i.isArrayBufferView(e))return e.buffer;if(i.isURLSearchParams(e))return d(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var r,s=i.isObject(e),o=t&&t["Content-Type"];if((r=i.isFileList(e))||s&&"multipart/form-data"===o){var c=this.env&&this.env.FormData;return a(r?{"files[]":e}:e,c&&new c)}return s||"application/json"===o?(d(t,"application/json"),function(e,t,r){if(i.isString(e))try{return(t||JSON.parse)(e),i.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||u.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,o=!r&&"json"===this.responseType;if(o||n&&i.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw s.from(e,s.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:r(125)},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),i.forEach(["post","put","patch"],(function(e){u.headers[e]=i.merge(c)})),e.exports=u},function(e,t,r){var i,n,s,o,a,c,d,l;e.exports=(l=r(0),n=(i=l).lib,s=n.WordArray,o=n.Hasher,a=i.algo,c=[],d=a.SHA1=o.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],d=0;d<80;d++){if(d<16)c[d]=0|e[t+d];else{var l=c[d-3]^c[d-8]^c[d-14]^c[d-16];c[d]=l<<1|l>>>31}var u=(i<<5|i>>>27)+a+c[d];u+=d<20?1518500249+(n&s|~n&o):d<40?1859775393+(n^s^o):d<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,a=o,o=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=o._createHelper(d),i.HmacSHA1=o._createHmacHelper(d),l.SHA1)},function(e,t,r){var i,n,s,o;e.exports=(i=r(0),s=(n=i).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var n=this._oKey=t.clone(),s=this._iKey=t.clone(),a=n.words,c=s.words,d=0;d<r;d++)a[d]^=1549556828,c[d]^=909522486;n.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,r){"use strict";var i=SyntaxError,n=Function,s=TypeError,o=function(e){try{return n('"use strict"; return ('+e+").constructor;")()}catch(e){}},a=Object.getOwnPropertyDescriptor;if(a)try{a({},"")}catch(e){a=null}var c=function(){throw new s},d=a?function(){try{return c}catch(e){try{return a(arguments,"callee").get}catch(e){return c}}}():c,l=r(156)(),u=Object.getPrototypeOf||function(e){return e.__proto__},h={},p="undefined"==typeof Uint8Array?void 0:u(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":l?u([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":h,"%AsyncGenerator%":h,"%AsyncGeneratorFunction%":h,"%AsyncIteratorPrototype%":h,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":n,"%GeneratorFunction%":h,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?u(u([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&l?u((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&l?u((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?u(""[Symbol.iterator]()):void 0,"%Symbol%":l?Symbol:void 0,"%SyntaxError%":i,"%ThrowTypeError%":d,"%TypedArray%":p,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet},f={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(25),v=r(159),y=m.call(Function.call,Array.prototype.concat),b=m.call(Function.apply,Array.prototype.splice),w=m.call(Function.call,String.prototype.replace),S=m.call(Function.call,String.prototype.slice),T=m.call(Function.call,RegExp.prototype.exec),_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E=/\\(\\)?/g,C=function(e){var t=S(e,0,1),r=S(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return w(e,_,(function(e,t,r,i){n[n.length]=r?w(i,E,"$1"):t||e})),n},R=function(e,t){var r,n=e;if(v(f,n)&&(n="%"+(r=f[n])[0]+"%"),v(g,n)){var a=g[n];if(a===h&&(a=function e(t){var r;if("%AsyncFunction%"===t)r=o("async function () {}");else if("%GeneratorFunction%"===t)r=o("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=o("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&(r=u(n.prototype))}return g[t]=r,r}(n)),void 0===a&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:a}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');if(null===T(/^%?[^%]*%?$/,e))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=C(e),n=r.length>0?r[0]:"",o=R("%"+n+"%",t),c=o.name,d=o.value,l=!1,u=o.alias;u&&(n=u[0],b(r,y([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var f=r[h],m=S(f,0,1),w=S(f,-1);if(('"'===m||"'"===m||"`"===m||'"'===w||"'"===w||"`"===w)&&m!==w)throw new i("property names with quotes must have matching quotes");if("constructor"!==f&&p||(l=!0),v(g,c="%"+(n+="."+f)+"%"))d=g[c];else if(null!=d){if(!(f in d)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(a&&h+1>=r.length){var _=a(d,f);d=(p=!!_)&&"get"in _&&!("originalValue"in _.get)?_.get:d[f]}else p=v(d,f),d=d[f];p&&!l&&(g[c]=d)}}return d}},function(e,t,r){"use strict";var i=r(158);e.exports=Function.prototype.bind||i},function(e,t,r){"use strict";var i=String.prototype.replace,n=/%20/g,s="RFC1738",o="RFC3986";e.exports={default:o,formatters:{RFC1738:function(e){return i.call(e,n,"+")},RFC3986:function(e){return String(e)}},RFC1738:s,RFC3986:o}},function(e,t,r){e.exports=r(112)},function(e,t,r){var i;e.exports=(i=r(0),r(14),r(131),r(132),r(4),r(133),r(7),r(21),r(39),r(134),r(40),r(135),r(136),r(137),r(22),r(138),r(8),r(3),r(139),r(140),r(141),r(142),r(143),r(144),r(145),r(146),r(147),r(148),r(149),r(15),r(150),r(151),r(152),r(153),i)},,function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];return e.apply(t,r)}}},function(e,t,r){"use strict";var i=r(2);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(i.isURLSearchParams(t))s=t.toString();else{var o=[];i.forEach(t,(function(e,t){null!=e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,(function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),o.push(n(t)+"="+n(e))})))})),s=o.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},function(e,t,r){"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},function(e,t,r){"use strict";var i=r(2);e.exports=function(e,t){t=t||new FormData;var r=[];function n(e){return null===e?"":i.isDate(e)?e.toISOString():i.isArrayBuffer(e)||i.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}return function e(s,o){if(i.isPlainObject(s)||i.isArray(s)){if(-1!==r.indexOf(s))throw Error("Circular reference detected in "+o);r.push(s),i.forEach(s,(function(r,s){if(!i.isUndefined(r)){var a,c=o?o+"."+s:s;if(r&&!o&&"object"==typeof r)if(i.endsWith(s,"{}"))r=JSON.stringify(r);else if(i.endsWith(s,"[]")&&(a=i.toArray(r)))return void a.forEach((function(e){!i.isUndefined(e)&&t.append(c,n(e))}));e(r,c)}})),r.pop()}else t.append(o,n(s))}(e),t}},function(e,t,r){"use strict";var i=r(2),n=r(118),s=r(119),o=r(31),a=r(35),c=r(122),d=r(123),l=r(32),u=r(9),h=r(13),p=r(124);e.exports=function(e){return new Promise((function(t,r){var g,f=e.data,m=e.headers,v=e.responseType;function y(){e.cancelToken&&e.cancelToken.unsubscribe(g),e.signal&&e.signal.removeEventListener("abort",g)}i.isFormData(f)&&i.isStandardBrowserEnv()&&delete m["Content-Type"];var b=new XMLHttpRequest;if(e.auth){var w=e.auth.username||"",S=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";m.Authorization="Basic "+btoa(w+":"+S)}var T=a(e.baseURL,e.url);function _(){if(b){var i="getAllResponseHeaders"in b?c(b.getAllResponseHeaders()):null,s={data:v&&"text"!==v&&"json"!==v?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:i,config:e,request:b};n((function(e){t(e),y()}),(function(e){r(e),y()}),s),b=null}}if(b.open(e.method.toUpperCase(),o(T,e.params,e.paramsSerializer),!0),b.timeout=e.timeout,"onloadend"in b?b.onloadend=_:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(_)},b.onabort=function(){b&&(r(new u("Request aborted",u.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new u("Network Error",u.ERR_NETWORK,e,b,b)),b=null},b.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",i=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new u(t,i.clarifyTimeoutError?u.ETIMEDOUT:u.ECONNABORTED,e,b)),b=null},i.isStandardBrowserEnv()){var E=(e.withCredentials||d(T))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;E&&(m[e.xsrfHeaderName]=E)}"setRequestHeader"in b&&i.forEach(m,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete m[t]:b.setRequestHeader(t,e)})),i.isUndefined(e.withCredentials)||(b.withCredentials=!!e.withCredentials),v&&"json"!==v&&(b.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&b.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(g=function(e){b&&(r(!e||e&&e.type?new h:e),b.abort(),b=null)},e.cancelToken&&e.cancelToken.subscribe(g),e.signal&&(e.signal.aborted?g():e.signal.addEventListener("abort",g))),f||(f=null);var C=p(T);C&&-1===["http","https","file"].indexOf(C)?r(new u("Unsupported protocol "+C+":",u.ERR_BAD_REQUEST,e)):b.send(f)}))}},function(e,t,r){"use strict";var i=r(120),n=r(121);e.exports=function(e,t){return e&&!i(t)?n(e,t):t}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";var i=r(2);e.exports=function(e,t){t=t||{};var r={};function n(e,t){return i.isPlainObject(e)&&i.isPlainObject(t)?i.merge(e,t):i.isPlainObject(t)?i.merge({},t):i.isArray(t)?t.slice():t}function s(r){return i.isUndefined(t[r])?i.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function o(e){if(!i.isUndefined(t[e]))return n(void 0,t[e])}function a(r){return i.isUndefined(t[r])?i.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function c(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var d={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials: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};return i.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=d[e]||s,n=t(e);i.isUndefined(n)&&t!==c||(r[e]=n)})),r}},function(e,t){e.exports={version:"0.27.2"}},function(e,t,r){var i;e.exports=(i=r(0),function(e){var t=i,r=t.lib,n=r.WordArray,s=r.Hasher,o=t.algo,a=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(a[n]=r(e.pow(i,.5))),c[n]=r(e.pow(i,1/3)),n++),i++}();var d=[],l=o.SHA256=s.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],l=r[5],u=r[6],h=r[7],p=0;p<64;p++){if(p<16)d[p]=0|e[t+p];else{var g=d[p-15],f=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,m=d[p-2],v=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;d[p]=f+d[p-7]+v+d[p-16]}var y=i&n^i&s^n&s,b=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),w=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&u)+c[p]+d[p];h=u,u=l,l=a,a=o+w|0,o=s,s=n,n=i,i=w+(b+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(l),t.HmacSHA256=s._createHmacHelper(l)}(Math),i.SHA256)},function(e,t,r){var i;e.exports=(i=r(0),r(14),function(){var e=i,t=e.lib.Hasher,r=e.x64,n=r.Word,s=r.WordArray,o=e.algo;function a(){return n.create.apply(n,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],d=[];!function(){for(var e=0;e<80;e++)d[e]=a()}();var l=o.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],l=r[5],u=r[6],h=r[7],p=i.high,g=i.low,f=n.high,m=n.low,v=s.high,y=s.low,b=o.high,w=o.low,S=a.high,T=a.low,_=l.high,E=l.low,C=u.high,R=u.low,A=h.high,I=h.low,k=p,P=g,x=f,D=m,O=v,M=y,N=b,$=w,j=S,L=T,H=_,q=E,U=C,F=R,B=A,G=I,V=0;V<80;V++){var z,W,K=d[V];if(V<16)W=K.high=0|e[t+2*V],z=K.low=0|e[t+2*V+1];else{var J=d[V-15],Y=J.high,X=J.low,Z=(Y>>>1|X<<31)^(Y>>>8|X<<24)^Y>>>7,Q=(X>>>1|Y<<31)^(X>>>8|Y<<24)^(X>>>7|Y<<25),ee=d[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=d[V-7],oe=se.high,ae=se.low,ce=d[V-16],de=ce.high,le=ce.low;W=(W=(W=Z+oe+((z=Q+ae)>>>0<Q>>>0?1:0))+ie+((z+=ne)>>>0<ne>>>0?1:0))+de+((z+=le)>>>0<le>>>0?1:0),K.high=W,K.low=z}var ue,he=j&H^~j&U,pe=L&q^~L&F,ge=k&x^k&O^x&O,fe=P&D^P&M^D&M,me=(k>>>28|P<<4)^(k<<30|P>>>2)^(k<<25|P>>>7),ve=(P>>>28|k<<4)^(P<<30|k>>>2)^(P<<25|k>>>7),ye=(j>>>14|L<<18)^(j>>>18|L<<14)^(j<<23|L>>>9),be=(L>>>14|j<<18)^(L>>>18|j<<14)^(L<<23|j>>>9),we=c[V],Se=we.high,Te=we.low,_e=B+ye+((ue=G+be)>>>0<G>>>0?1:0),Ee=ve+fe;B=U,G=F,U=H,F=q,H=j,q=L,j=N+(_e=(_e=(_e=_e+he+((ue+=pe)>>>0<pe>>>0?1:0))+Se+((ue+=Te)>>>0<Te>>>0?1:0))+W+((ue+=z)>>>0<z>>>0?1:0))+((L=$+ue|0)>>>0<$>>>0?1:0)|0,N=O,$=M,O=x,M=D,x=k,D=P,k=_e+(me+ge+(Ee>>>0<ve>>>0?1:0))+((P=ue+Ee|0)>>>0<ue>>>0?1:0)|0}g=i.low=g+P,i.high=p+k+(g>>>0<P>>>0?1:0),m=n.low=m+D,n.high=f+x+(m>>>0<D>>>0?1:0),y=s.low=y+M,s.high=v+O+(y>>>0<M>>>0?1:0),w=o.low=w+$,o.high=b+N+(w>>>0<$>>>0?1:0),T=a.low=T+L,a.high=S+j+(T>>>0<L>>>0?1:0),E=l.low=E+q,l.high=_+H+(E>>>0<q>>>0?1:0),R=u.low=R+F,u.high=C+U+(R>>>0<F>>>0?1:0),I=h.low=I+G,h.high=A+B+(I>>>0<G>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),i.SHA512)},function(e,t,r){"use strict";var i=r(26),n=Object.prototype.hasOwnProperty,s=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},i=0;i<e.length;++i)void 0!==e[i]&&(r[i]=e[i]);return r};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],i=0;i<t.length;++i)for(var n=t[i],o=n.obj[n.prop],a=Object.keys(o),c=0;c<a.length;++c){var d=a[c],l=o[d];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(t.push({obj:o,prop:d}),r.push(l))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(s(r)){for(var i=[],n=0;n<r.length;++n)void 0!==r[n]&&i.push(r[n]);t.obj[t.prop]=i}}}(t),e},decode:function(e,t,r){var i=e.replace(/\+/g," ");if("iso-8859-1"===r)return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch(e){return i}},encode:function(e,t,r,n,s){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===r)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",d=0;d<a.length;++d){var l=a.charCodeAt(d);45===l||46===l||95===l||126===l||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===i.RFC1738&&(40===l||41===l)?c+=a.charAt(d):l<128?c+=o[l]:l<2048?c+=o[192|l>>6]+o[128|63&l]:l<55296||l>=57344?c+=o[224|l>>12]+o[128|l>>6&63]+o[128|63&l]:(d+=1,l=65536+((1023&l)<<10|1023&a.charCodeAt(d)),c+=o[240|l>>18]+o[128|l>>12&63]+o[128|l>>6&63]+o[128|63&l])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(s(e)){for(var r=[],i=0;i<e.length;i+=1)r.push(t(e[i]));return r}return t(e)},merge:function e(t,r,i){if(!r)return t;if("object"!=typeof r){if(s(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(i&&(i.plainObjects||i.allowPrototypes)||!n.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var o=t;return s(t)&&!s(r)&&(o=a(t,i)),s(t)&&s(r)?(r.forEach((function(r,s){if(n.call(t,s)){var o=t[s];o&&"object"==typeof o&&r&&"object"==typeof r?t[s]=e(o,r,i):t.push(r)}else t[s]=r})),t):Object.keys(r).reduce((function(t,s){var o=r[s];return n.call(t,s)?t[s]=e(t[s],o,i):t[s]=o,t}),o)}}},function(e,t,r){"use strict";var i=r(10);function n(e,t,r,n,s){var o=i.writeRtpDescription(e.kind,t);if(o+=i.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=i.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":s||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var c="msid:"+(n?n.id:"-")+" "+a+"\r\n";o+="a="+c,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+c,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+c,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+i.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+"\r\n"),o}function s(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},i=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},n=function(e,t,r,n){var s=i(e.parameters.apt,r),o=i(t.parameters.apt,n);return s&&o&&s.name.toLowerCase()===o.name.toLowerCase()};return e.codecs.forEach((function(i){for(var s=0;s<t.codecs.length;s++){var o=t.codecs[s];if(i.name.toLowerCase()===o.name.toLowerCase()&&i.clockRate===o.clockRate){if("rtx"===i.name.toLowerCase()&&i.parameters&&o.parameters.apt&&!n(i,o,e.codecs,t.codecs))continue;(o=JSON.parse(JSON.stringify(o))).numChannels=Math.min(i.numChannels,o.numChannels),r.codecs.push(o),o.rtcpFeedback=o.rtcpFeedback.filter((function(e){for(var t=0;t<i.rtcpFeedback.length;t++)if(i.rtcpFeedback[t].type===e.type&&i.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var i=0;i<t.headerExtensions.length;i++){var n=t.headerExtensions[i];if(e.uri===n.uri){r.headerExtensions.push(n);break}}})),r}function o(e,t,r){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)}function a(e,t){var r=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return r||e.addRemoteCandidate(t),!r}function c(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}e.exports=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function d(t,r,i,n){var s=new Event("track");s.track=r,s.receiver=i,s.transceiver={receiver:i},s.streams=n,e.setTimeout((function(){t._dispatchEvent("track",s)}))}var l=function(r){var n=this,s=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){n[e]=s[e].bind(s)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw c("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var i=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n="string"==typeof i;return n&&(i=[i]),i=i.filter((function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!r?(r=!0,!0):0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp")})),delete e.url,e.urls=n?i[0]:i,!!i.length}}))}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var o=r.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=i.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(l.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(l.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),l.prototype.onicecandidate=null,l.prototype.onaddstream=null,l.prototype.ontrack=null,l.prototype.onremovestream=null,l.prototype.onsignalingstatechange=null,l.prototype.oniceconnectionstatechange=null,l.prototype.onconnectionstatechange=null,l.prototype.onicegatheringstatechange=null,l.prototype.onnegotiationneeded=null,l.prototype.ondatachannel=null,l.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},l.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},l.prototype.getConfiguration=function(){return this._config},l.prototype.getLocalStreams=function(){return this.localStreams},l.prototype.getRemoteStreams=function(){return this.remoteStreams},l.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,i={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)i.iceTransport=this.transceivers[0].iceTransport,i.dtlsTransport=this.transceivers[0].dtlsTransport;else{var n=this._createIceAndDtlsTransports();i.iceTransport=n.iceTransport,i.dtlsTransport=n.dtlsTransport}return t||this.transceivers.push(i),i},l.prototype.addTrack=function(t,r){if(this._isClosed)throw c("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var i;if(this.transceivers.find((function(e){return e.track===t})))throw c("InvalidAccessError","Track already exists.");for(var n=0;n<this.transceivers.length;n++)this.transceivers[n].track||this.transceivers[n].kind!==t.kind||(i=this.transceivers[n]);return i||(i=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),i.track=t,i.stream=r,i.rtpSender=new e.RTCRtpSender(t,i.dtlsTransport),i.rtpSender},l.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var i=e.clone();e.getTracks().forEach((function(e,t){var r=i.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),i.getTracks().forEach((function(e){r.addTrack(e,i)}))}},l.prototype.removeTrack=function(t){if(this._isClosed)throw c("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find((function(e){return e.rtpSender===t}));if(!r)throw c("InvalidAccessError","Sender was not created by this connection.");var i=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(i)&&this.localStreams.indexOf(i)>-1&&this.localStreams.splice(this.localStreams.indexOf(i),1),this._maybeFireNegotiationNeeded()},l.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var r=t.getSenders().find((function(t){return t.track===e}));r&&t.removeTrack(r)}))},l.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},l.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},l.prototype._createIceGatherer=function(t,r){var i=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var n=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(n,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;n.state=r?"completed":"gathering",null!==i.transceivers[t].bufferedCandidateEvents&&i.transceivers[t].bufferedCandidateEvents.push(e)},n.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),n},l.prototype._gather=function(t,r){var n=this,s=this.transceivers[r].iceGatherer;if(!s.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,s.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),s.onlocalcandidate=function(e){if(!(n.usingBundle&&r>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var a=e.candidate,c=!a||0===Object.keys(a).length;if(c)"new"!==s.state&&"gathering"!==s.state||(s.state="completed");else{"new"===s.state&&(s.state="gathering"),a.component=1,a.ufrag=s.getLocalParameters().usernameFragment;var d=i.writeCandidate(a);o.candidate=Object.assign(o.candidate,i.parseCandidate(d)),o.candidate.candidate=d,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var l=i.getMediaSections(n._localDescription.sdp);l[o.candidate.sdpMLineIndex]+=c?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",n._localDescription.sdp=i.getDescription(n._localDescription.sdp)+l.join("");var u=n.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==n.iceGatheringState&&(n.iceGatheringState="gathering",n._emitGatheringStateChange()),c||n._dispatchEvent("icecandidate",o),u&&(n._dispatchEvent("icecandidate",new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){s.onlocalcandidate(e)}))}),0)}},l.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var i=new e.RTCDtlsTransport(r);return i.ondtlsstatechange=function(){t._updateConnectionState()},i.onerror=function(){Object.defineProperty(i,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:i}},l.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var i=this.transceivers[e].dtlsTransport;i&&(delete i.ondtlsstatechange,delete i.onerror,delete this.transceivers[e].dtlsTransport)},l.prototype._transceive=function(e,r,n){var o=s(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(o.encodings=e.sendEncodingParameters,o.rtcp={cname:i.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(o.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(o)),n&&e.rtpReceiver&&o.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?o.encodings=e.recvEncodingParameters:o.encodings=[{}],o.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(o.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(o.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(o))},l.prototype.setLocalDescription=function(e){var t,r,n=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(c("TypeError",'Unsupported type "'+e.type+'"'));if(!o("setLocalDescription",e.type,n.signalingState)||n._isClosed)return Promise.reject(c("InvalidStateError","Can not set local "+e.type+" in state "+n.signalingState));if("offer"===e.type)t=i.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=i.parseRtpParameters(e);n.transceivers[t].localCapabilities=r})),n.transceivers.forEach((function(e,t){n._gather(e.mid,t)}));else if("answer"===e.type){t=i.splitSections(n._remoteDescription.sdp),r=t.shift();var a=i.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=n.transceivers[t],c=o.iceGatherer,d=o.iceTransport,l=o.dtlsTransport,u=o.localCapabilities,h=o.remoteCapabilities;if(!(i.isRejected(e)&&0===i.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var p=i.getIceParameters(e,r),g=i.getDtlsParameters(e,r);a&&(g.role="server"),n.usingBundle&&0!==t||(n._gather(o.mid,t),"new"===d.state&&d.start(c,p,a?"controlling":"controlled"),"new"===l.state&&l.start(g));var f=s(u,h);n._transceive(o,f.codecs.length>0,!1)}}))}return n._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?n._updateSignalingState("have-local-offer"):n._updateSignalingState("stable"),Promise.resolve()},l.prototype.setRemoteDescription=function(n){var l=this;if(-1===["offer","answer"].indexOf(n.type))return Promise.reject(c("TypeError",'Unsupported type "'+n.type+'"'));if(!o("setRemoteDescription",n.type,l.signalingState)||l._isClosed)return Promise.reject(c("InvalidStateError","Can not set remote "+n.type+" in state "+l.signalingState));var u={};l.remoteStreams.forEach((function(e){u[e.id]=e}));var h=[],p=i.splitSections(n.sdp),g=p.shift(),f=i.matchPrefix(g,"a=ice-lite").length>0,m=i.matchPrefix(g,"a=group:BUNDLE ").length>0;l.usingBundle=m;var v=i.matchPrefix(g,"a=ice-options:")[0];return l.canTrickleIceCandidates=!!v&&v.substr(14).split(" ").indexOf("trickle")>=0,p.forEach((function(o,c){var d=i.splitLines(o),p=i.getKind(o),v=i.isRejected(o)&&0===i.matchPrefix(o,"a=bundle-only").length,y=d[0].substr(2).split(" ")[2],b=i.getDirection(o,g),w=i.parseMsid(o),S=i.getMid(o)||i.generateIdentifier();if(v||"application"===p&&("DTLS/SCTP"===y||"UDP/DTLS/SCTP"===y))l.transceivers[c]={mid:S,kind:p,protocol:y,rejected:!0};else{var T,_,E,C,R,A,I,k,P;!v&&l.transceivers[c]&&l.transceivers[c].rejected&&(l.transceivers[c]=l._createTransceiver(p,!0));var x,D,O=i.parseRtpParameters(o);v||(x=i.getIceParameters(o,g),(D=i.getDtlsParameters(o,g)).role="client"),I=i.parseRtpEncodingParameters(o);var M=i.parseRtcpParameters(o),N=i.matchPrefix(o,"a=end-of-candidates",g).length>0,$=i.matchPrefix(o,"a=candidate:").map((function(e){return i.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===n.type||"answer"===n.type)&&!v&&m&&c>0&&l.transceivers[c]&&(l._disposeIceAndDtlsTransports(c),l.transceivers[c].iceGatherer=l.transceivers[0].iceGatherer,l.transceivers[c].iceTransport=l.transceivers[0].iceTransport,l.transceivers[c].dtlsTransport=l.transceivers[0].dtlsTransport,l.transceivers[c].rtpSender&&l.transceivers[c].rtpSender.setTransport(l.transceivers[0].dtlsTransport),l.transceivers[c].rtpReceiver&&l.transceivers[c].rtpReceiver.setTransport(l.transceivers[0].dtlsTransport)),"offer"!==n.type||v){if("answer"===n.type&&!v){_=(T=l.transceivers[c]).iceGatherer,E=T.iceTransport,C=T.dtlsTransport,R=T.rtpReceiver,A=T.sendEncodingParameters,k=T.localCapabilities,l.transceivers[c].recvEncodingParameters=I,l.transceivers[c].remoteCapabilities=O,l.transceivers[c].rtcpParameters=M,$.length&&"new"===E.state&&(!f&&!N||m&&0!==c?$.forEach((function(e){a(T.iceTransport,e)})):E.setRemoteCandidates($)),m&&0!==c||("new"===E.state&&E.start(_,x,"controlling"),"new"===C.state&&C.start(D)),!s(T.localCapabilities,T.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&T.sendEncodingParameters[0].rtx&&delete T.sendEncodingParameters[0].rtx,l._transceive(T,"sendrecv"===b||"recvonly"===b,"sendrecv"===b||"sendonly"===b),!R||"sendrecv"!==b&&"sendonly"!==b?delete T.rtpReceiver:(P=R.track,w?(u[w.stream]||(u[w.stream]=new e.MediaStream),r(P,u[w.stream]),h.push([P,R,u[w.stream]])):(u.default||(u.default=new e.MediaStream),r(P,u.default),h.push([P,R,u.default])))}}else{(T=l.transceivers[c]||l._createTransceiver(p)).mid=S,T.iceGatherer||(T.iceGatherer=l._createIceGatherer(c,m)),$.length&&"new"===T.iceTransport.state&&(!N||m&&0!==c?$.forEach((function(e){a(T.iceTransport,e)})):T.iceTransport.setRemoteCandidates($)),k=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(k.codecs=k.codecs.filter((function(e){return"rtx"!==e.name}))),A=T.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var j,L=!1;if("sendrecv"===b||"sendonly"===b){if(L=!T.rtpReceiver,R=T.rtpReceiver||new e.RTCRtpReceiver(T.dtlsTransport,p),L)P=R.track,w&&"-"===w.stream||(w?(u[w.stream]||(u[w.stream]=new e.MediaStream,Object.defineProperty(u[w.stream],"id",{get:function(){return w.stream}})),Object.defineProperty(P,"id",{get:function(){return w.track}}),j=u[w.stream]):(u.default||(u.default=new e.MediaStream),j=u.default)),j&&(r(P,j),T.associatedRemoteMediaStreams.push(j)),h.push([P,R,j])}else T.rtpReceiver&&T.rtpReceiver.track&&(T.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===T.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),T.associatedRemoteMediaStreams=[]);T.localCapabilities=k,T.remoteCapabilities=O,T.rtpReceiver=R,T.rtcpParameters=M,T.sendEncodingParameters=A,T.recvEncodingParameters=I,l._transceive(l.transceivers[c],!1,L)}}})),void 0===l._dtlsRole&&(l._dtlsRole="offer"===n.type?"active":"passive"),l._remoteDescription={type:n.type,sdp:n.sdp},"offer"===n.type?l._updateSignalingState("have-remote-offer"):l._updateSignalingState("stable"),Object.keys(u).forEach((function(t){var r=u[t];if(r.getTracks().length){if(-1===l.remoteStreams.indexOf(r)){l.remoteStreams.push(r);var i=new Event("addstream");i.stream=r,e.setTimeout((function(){l._dispatchEvent("addstream",i)}))}h.forEach((function(e){var t=e[0],i=e[1];r.id===e[2].id&&d(l,t,i,[r])}))}})),h.forEach((function(e){e[2]||d(l,e[0],e[1],[])})),e.setTimeout((function(){l&&l.transceivers&&l.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},l.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},l.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},l.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},l.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},l.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},l.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(c("InvalidStateError","Can not call createOffer after close"));var s=r.transceivers.filter((function(e){return"audio"===e.kind})).length,o=r.transceivers.filter((function(e){return"video"===e.kind})).length,a=arguments[0];if(a){if(a.mandatory||a.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==a.offerToReceiveAudio&&(s=!0===a.offerToReceiveAudio?1:!1===a.offerToReceiveAudio?0:a.offerToReceiveAudio),void 0!==a.offerToReceiveVideo&&(o=!0===a.offerToReceiveVideo?1:!1===a.offerToReceiveVideo?0:a.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--s<0&&(e.wantReceive=!1):"video"===e.kind&&--o<0&&(e.wantReceive=!1)}));s>0||o>0;)s>0&&(r._createTransceiver("audio"),s--),o>0&&(r._createTransceiver("video"),o--);var d=i.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(n,s){var o=n.track,a=n.kind,c=n.mid||i.generateIdentifier();n.mid=c,n.iceGatherer||(n.iceGatherer=r._createIceGatherer(s,r.usingBundle));var d=e.RTCRtpSender.getCapabilities(a);t<15019&&(d.codecs=d.codecs.filter((function(e){return"rtx"!==e.name}))),d.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),n.remoteCapabilities&&n.remoteCapabilities.codecs&&n.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),d.headerExtensions.forEach((function(e){(n.remoteCapabilities&&n.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var l=n.sendEncodingParameters||[{ssrc:1001*(2*s+1)}];o&&t>=15019&&"video"===a&&!l[0].rtx&&(l[0].rtx={ssrc:l[0].ssrc+1}),n.wantReceive&&(n.rtpReceiver=new e.RTCRtpReceiver(n.dtlsTransport,a)),n.localCapabilities=d,n.sendEncodingParameters=l})),"max-compat"!==r._config.bundlePolicy&&(d+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),d+="a=ice-options:trickle\r\n",r.transceivers.forEach((function(e,t){d+=n(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),d+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,d+="a="+i.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(d+="a=end-of-candidates\r\n"))}));var l=new e.RTCSessionDescription({type:"offer",sdp:d});return Promise.resolve(l)},l.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(c("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(c("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var o=i.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(o+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),o+="a=ice-options:trickle\r\n";var a=i.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,i){if(!(i+1>a)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?o+="m=application 0 DTLS/SCTP 5000\r\n":o+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?o+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(o+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(o+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var c;if(e.stream)"audio"===e.kind?c=e.stream.getAudioTracks()[0]:"video"===e.kind&&(c=e.stream.getVideoTracks()[0]),c&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var d=s(e.localCapabilities,e.remoteCapabilities);!d.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,o+=n(e,d,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(o+="a=rtcp-rsize\r\n")}}));var d=new e.RTCSessionDescription({type:"answer",sdp:o});return Promise.resolve(d)},l.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(n,s){if(!r._remoteDescription)return s(c("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var d=0;d<r.transceivers.length;d++)if(r.transceivers[d].mid===e.sdpMid){o=d;break}var l=r.transceivers[o];if(!l)return s(c("OperationError","Can not add ICE candidate"));if(l.rejected)return n();var u=Object.keys(e.candidate).length>0?i.parseCandidate(e.candidate):{};if("tcp"===u.protocol&&(0===u.port||9===u.port))return n();if(u.component&&1!==u.component)return n();if((0===o||o>0&&l.iceTransport!==r.transceivers[0].iceTransport)&&!a(l.iceTransport,u))return s(c("OperationError","Can not add ICE candidate"));var h=e.candidate.trim();0===h.indexOf("a=")&&(h=h.substr(2)),(t=i.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(u.type?h:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=i.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var p=0;p<r.transceivers.length&&(r.transceivers[p].rejected||(r.transceivers[p].iceTransport.addRemoteCandidate({}),(t=i.getMediaSections(r._remoteDescription.sdp))[p]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=i.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));p++);n()}))},l.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)})),!r)throw c("InvalidAccessError","Invalid selector.");return r.getStats()}var i=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&i.push(e[t].getStats())}))})),Promise.all(i).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var i=r.prototype.getStats;r.prototype.getStats=function(){return i.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var i;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(i=e[r]).type]||i.type,t.set(r,e[r])})),t}))}}}));var u=["createOffer","createAnswer"];return u.forEach((function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(u=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=l.prototype[e];l.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),l}},function(e,t,r){var i;i=function(){return function(e){var t,r=e.localStorage||(t={},{setItem:function(e,r){t[e]=r},getItem:function(e){return t[e]},removeItem:function(e){delete t[e]}}),i=1,n=2,s=3,o=4,a=5,c=6,d=7,l=8,u=9,h=10,p=11,g=12,f=13,m=14,v=function(e,t){for(var r in e)if(e.hasOwnProperty(r)){if(!t.hasOwnProperty(r)){var i="Unknown property, "+r+". Valid properties are:";for(var n in t)t.hasOwnProperty(n)&&(i=i+" "+n);throw new Error(i)}if(typeof e[r]!==t[r])throw new Error(S(b.INVALID_TYPE,[typeof e[r],r]))}},y=function(e,t){return function(){return e.apply(t,arguments)}},b={OK:{code:0,text:"AMQJSC0000I OK."},CONNECT_TIMEOUT:{code:1,text:"AMQJSC0001E Connect timed out."},SUBSCRIBE_TIMEOUT:{code:2,text:"AMQJS0002E Subscribe timed out."},UNSUBSCRIBE_TIMEOUT:{code:3,text:"AMQJS0003E Unsubscribe timed out."},PING_TIMEOUT:{code:4,text:"AMQJS0004E Ping timed out."},INTERNAL_ERROR:{code:5,text:"AMQJS0005E Internal error. Error Message: {0}, Stack trace: {1}"},CONNACK_RETURNCODE:{code:6,text:"AMQJS0006E Bad Connack return code:{0} {1}."},SOCKET_ERROR:{code:7,text:"AMQJS0007E Socket error:{0}."},SOCKET_CLOSE:{code:8,text:"AMQJS0008I Socket closed."},MALFORMED_UTF:{code:9,text:"AMQJS0009E Malformed UTF data:{0} {1} {2}."},UNSUPPORTED:{code:10,text:"AMQJS0010E {0} is not supported by this browser."},INVALID_STATE:{code:11,text:"AMQJS0011E Invalid state {0}."},INVALID_TYPE:{code:12,text:"AMQJS0012E Invalid type {0} for {1}."},INVALID_ARGUMENT:{code:13,text:"AMQJS0013E Invalid argument {0} for {1}."},UNSUPPORTED_OPERATION:{code:14,text:"AMQJS0014E Unsupported operation."},INVALID_STORED_DATA:{code:15,text:"AMQJS0015E Invalid data in local storage key={0} value={1}."},INVALID_MQTT_MESSAGE_TYPE:{code:16,text:"AMQJS0016E Invalid MQTT message type {0}."},MALFORMED_UNICODE:{code:17,text:"AMQJS0017E Malformed Unicode string:{0} {1}."},BUFFER_FULL:{code:18,text:"AMQJS0018E Message buffer is full, maximum buffer size: {0}."}},w={0:"Connection Accepted",1:"Connection Refused: unacceptable protocol version",2:"Connection Refused: identifier rejected",3:"Connection Refused: server unavailable",4:"Connection Refused: bad user name or password",5:"Connection Refused: not authorized"},S=function(e,t){var r=e.text;if(t)for(var i,n,s=0;s<t.length;s++)if(i="{"+s+"}",(n=r.indexOf(i))>0){var o=r.substring(0,n),a=r.substring(n+i.length);r=o+t[s]+a}return r},T=[0,6,77,81,73,115,100,112,3],_=[0,4,77,81,84,84,4],E=function(e,t){for(var r in this.type=e,t)t.hasOwnProperty(r)&&(this[r]=t[r])};function C(e,t){var r,i=t,l=e[t],h=l>>4,g=l&=15;t+=1;var f=0,m=1;do{if(t==e.length)return[null,i];f+=(127&(r=e[t++]))*m,m*=128}while(0!=(128&r));var v=t+f;if(v>e.length)return[null,i];var y=new E(h);switch(h){case n:1&e[t++]&&(y.sessionPresent=!0),y.returnCode=e[t++];break;case s:var b=g>>1&3,w=I(e,t),S=x(e,t+=2,w);t+=w,b>0&&(y.messageIdentifier=I(e,t),t+=2);var T=new N(e.subarray(t,v));1==(1&g)&&(T.retained=!0),8==(8&g)&&(T.duplicate=!0),T.qos=b,T.destinationName=S,y.payloadMessage=T;break;case o:case a:case c:case d:case p:y.messageIdentifier=I(e,t);break;case u:y.messageIdentifier=I(e,t),t+=2,y.returnCode=e.subarray(t,v)}return[y,v]}function R(e,t,r){return t[r++]=e>>8,t[r++]=e%256,r}function A(e,t,r,i){return P(e,r,i=R(t,r,i)),i+t}function I(e,t){return 256*e[t]+e[t+1]}function k(e){for(var t=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i>2047?(55296<=i&&i<=56319&&(r++,t++),t+=3):i>127?t+=2:t++}return t}function P(e,t,r){for(var i=r,n=0;n<e.length;n++){var s=e.charCodeAt(n);if(55296<=s&&s<=56319){var o=e.charCodeAt(++n);if(isNaN(o))throw new Error(S(b.MALFORMED_UNICODE,[s,o]));s=o-56320+(s-55296<<10)+65536}s<=127?t[i++]=s:s<=2047?(t[i++]=s>>6&31|192,t[i++]=63&s|128):s<=65535?(t[i++]=s>>12&15|224,t[i++]=s>>6&63|128,t[i++]=63&s|128):(t[i++]=s>>18&7|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=63&s|128)}return t}function x(e,t,r){for(var i,n="",s=t;s<t+r;){var o=e[s++];if(o<128)i=o;else{var a=e[s++]-128;if(a<0)throw new Error(S(b.MALFORMED_UTF,[o.toString(16),a.toString(16),""]));if(o<224)i=64*(o-192)+a;else{var c=e[s++]-128;if(c<0)throw new Error(S(b.MALFORMED_UTF,[o.toString(16),a.toString(16),c.toString(16)]));if(o<240)i=4096*(o-224)+64*a+c;else{var d=e[s++]-128;if(d<0)throw new Error(S(b.MALFORMED_UTF,[o.toString(16),a.toString(16),c.toString(16),d.toString(16)]));if(!(o<248))throw new Error(S(b.MALFORMED_UTF,[o.toString(16),a.toString(16),c.toString(16),d.toString(16)]));i=262144*(o-240)+4096*a+64*c+d}}}i>65535&&(i-=65536,n+=String.fromCharCode(55296+(i>>10)),i=56320+(1023&i)),n+=String.fromCharCode(i)}return n}E.prototype.encode=function(){var e,t=(15&this.type)<<4,r=0,n=[],o=0;switch(void 0!==this.messageIdentifier&&(r+=2),this.type){case i:switch(this.mqttVersion){case 3:r+=T.length+3;break;case 4:r+=_.length+3}r+=k(this.clientId)+2,void 0!==this.willMessage&&(r+=k(this.willMessage.destinationName)+2,(e=this.willMessage.payloadBytes)instanceof Uint8Array||(e=new Uint8Array(d)),r+=e.byteLength+2),void 0!==this.userName&&(r+=k(this.userName)+2),void 0!==this.password&&(r+=k(this.password)+2);break;case l:t|=2;for(var a=0;a<this.topics.length;a++)n[a]=k(this.topics[a]),r+=n[a]+2;r+=this.requestedQos.length;break;case h:for(t|=2,a=0;a<this.topics.length;a++)n[a]=k(this.topics[a]),r+=n[a]+2;break;case c:t|=2;break;case s:this.payloadMessage.duplicate&&(t|=8),t=t|=this.payloadMessage.qos<<1,this.payloadMessage.retained&&(t|=1),r+=(o=k(this.payloadMessage.destinationName))+2;var d=this.payloadMessage.payloadBytes;r+=d.byteLength,d instanceof ArrayBuffer?d=new Uint8Array(d):d instanceof Uint8Array||(d=new Uint8Array(d.buffer))}var u=function(e){var t=new Array(1),r=0;do{var i=e%128;(e>>=7)>0&&(i|=128),t[r++]=i}while(e>0&&r<4);return t}(r),p=u.length+1,g=new ArrayBuffer(r+p),f=new Uint8Array(g);if(f[0]=t,f.set(u,1),this.type==s)p=A(this.payloadMessage.destinationName,o,f,p);else if(this.type==i){switch(this.mqttVersion){case 3:f.set(T,p),p+=T.length;break;case 4:f.set(_,p),p+=_.length}var m=0;this.cleanSession&&(m=2),void 0!==this.willMessage&&(m|=4,m|=this.willMessage.qos<<3,this.willMessage.retained&&(m|=32)),void 0!==this.userName&&(m|=128),void 0!==this.password&&(m|=64),f[p++]=m,p=R(this.keepAliveInterval,f,p)}switch(void 0!==this.messageIdentifier&&(p=R(this.messageIdentifier,f,p)),this.type){case i:p=A(this.clientId,k(this.clientId),f,p),void 0!==this.willMessage&&(p=A(this.willMessage.destinationName,k(this.willMessage.destinationName),f,p),p=R(e.byteLength,f,p),f.set(e,p),p+=e.byteLength),void 0!==this.userName&&(p=A(this.userName,k(this.userName),f,p)),void 0!==this.password&&(p=A(this.password,k(this.password),f,p));break;case s:f.set(d,p);break;case l:for(a=0;a<this.topics.length;a++)p=A(this.topics[a],n[a],f,p),f[p++]=this.requestedQos[a];break;case h:for(a=0;a<this.topics.length;a++)p=A(this.topics[a],n[a],f,p)}return g};var D=function(e,t){this._client=e,this._keepAliveInterval=1e3*t,this.isReset=!1;var r=new E(g).encode(),i=function(e){return function(){return n.apply(e)}},n=function(){this.isReset?(this.isReset=!1,this._client._trace("Pinger.doPing","send PINGREQ"),this._client.socket.send(r),this.timeout=setTimeout(i(this),this._keepAliveInterval)):(this._client._trace("Pinger.doPing","Timed out"),this._client._disconnected(b.PING_TIMEOUT.code,S(b.PING_TIMEOUT)))};this.reset=function(){this.isReset=!0,clearTimeout(this.timeout),this._keepAliveInterval>0&&(this.timeout=setTimeout(i(this),this._keepAliveInterval))},this.cancel=function(){clearTimeout(this.timeout)}},O=function(e,t,r,i){t||(t=30),this.timeout=setTimeout(function(e,t,r){return function(){return e.apply(t,r)}}(r,e,i),1e3*t),this.cancel=function(){clearTimeout(this.timeout)}},M=function(t,i,n,s,o){if(!("WebSocket"in e)||null===e.WebSocket)throw new Error(S(b.UNSUPPORTED,["WebSocket"]));if(!("ArrayBuffer"in e)||null===e.ArrayBuffer)throw new Error(S(b.UNSUPPORTED,["ArrayBuffer"]));for(var a in this._trace("Paho.Client",t,i,n,s,o),this.host=i,this.port=n,this.path=s,this.uri=t,this.clientId=o,this._wsuri=null,this._localKey=i+":"+n+("/mqtt"!=s?":"+s:"")+":"+o+":",this._msg_queue=[],this._buffered_msg_queue=[],this._sentMessages={},this._receivedMessages={},this._notify_msg_sent={},this._message_identifier=1,this._sequence=0,r)0!==a.indexOf("Sent:"+this._localKey)&&0!==a.indexOf("Received:"+this._localKey)||this.restore(a)};M.prototype.host=null,M.prototype.port=null,M.prototype.path=null,M.prototype.uri=null,M.prototype.clientId=null,M.prototype.socket=null,M.prototype.connected=!1,M.prototype.maxMessageIdentifier=65536,M.prototype.connectOptions=null,M.prototype.hostIndex=null,M.prototype.onConnected=null,M.prototype.onConnectionLost=null,M.prototype.onMessageDelivered=null,M.prototype.onMessageArrived=null,M.prototype.traceFunction=null,M.prototype._msg_queue=null,M.prototype._buffered_msg_queue=null,M.prototype._connectTimeout=null,M.prototype.sendPinger=null,M.prototype.receivePinger=null,M.prototype._reconnectInterval=1,M.prototype._reconnecting=!1,M.prototype._reconnectTimeout=null,M.prototype.disconnectedPublishing=!1,M.prototype.disconnectedBufferSize=5e3,M.prototype.receiveBuffer=null,M.prototype._traceBuffer=null,M.prototype._MAX_TRACE_ENTRIES=100,M.prototype.connect=function(e){var t=this._traceMask(e,"password");if(this._trace("Client.connect",t,this.socket,this.connected),this.connected)throw new Error(S(b.INVALID_STATE,["already connected"]));if(this.socket)throw new Error(S(b.INVALID_STATE,["already connected"]));this._reconnecting&&(this._reconnectTimeout.cancel(),this._reconnectTimeout=null,this._reconnecting=!1),this.connectOptions=e,this._reconnectInterval=1,this._reconnecting=!1,e.uris?(this.hostIndex=0,this._doConnect(e.uris[0])):this._doConnect(this.uri)},M.prototype.subscribe=function(e,t){if(this._trace("Client.subscribe",e,t),!this.connected)throw new Error(S(b.INVALID_STATE,["not connected"]));var r=new E(l);r.topics=e.constructor===Array?e:[e],void 0===t.qos&&(t.qos=0),r.requestedQos=[];for(var i=0;i<r.topics.length;i++)r.requestedQos[i]=t.qos;t.onSuccess&&(r.onSuccess=function(e){t.onSuccess({invocationContext:t.invocationContext,grantedQos:e})}),t.onFailure&&(r.onFailure=function(e){t.onFailure({invocationContext:t.invocationContext,errorCode:e,errorMessage:S(e)})}),t.timeout&&(r.timeOut=new O(this,t.timeout,t.onFailure,[{invocationContext:t.invocationContext,errorCode:b.SUBSCRIBE_TIMEOUT.code,errorMessage:S(b.SUBSCRIBE_TIMEOUT)}])),this._requires_ack(r),this._schedule_message(r)},M.prototype.unsubscribe=function(e,t){if(this._trace("Client.unsubscribe",e,t),!this.connected)throw new Error(S(b.INVALID_STATE,["not connected"]));var r=new E(h);r.topics=e.constructor===Array?e:[e],t.onSuccess&&(r.callback=function(){t.onSuccess({invocationContext:t.invocationContext})}),t.timeout&&(r.timeOut=new O(this,t.timeout,t.onFailure,[{invocationContext:t.invocationContext,errorCode:b.UNSUBSCRIBE_TIMEOUT.code,errorMessage:S(b.UNSUBSCRIBE_TIMEOUT)}])),this._requires_ack(r),this._schedule_message(r)},M.prototype.send=function(e){this._trace("Client.send",e);var t=new E(s);if(t.payloadMessage=e,this.connected)e.qos>0?this._requires_ack(t):this.onMessageDelivered&&(this._notify_msg_sent[t]=this.onMessageDelivered(t.payloadMessage)),this._schedule_message(t);else{if(!this._reconnecting||!this.disconnectedPublishing)throw new Error(S(b.INVALID_STATE,["not connected"]));if(Object.keys(this._sentMessages).length+this._buffered_msg_queue.length>this.disconnectedBufferSize)throw new Error(S(b.BUFFER_FULL,[this.disconnectedBufferSize]));e.qos>0?this._requires_ack(t):(t.sequence=++this._sequence,this._buffered_msg_queue.unshift(t))}},M.prototype.disconnect=function(){if(this._trace("Client.disconnect"),this._reconnecting&&(this._reconnectTimeout.cancel(),this._reconnectTimeout=null,this._reconnecting=!1),!this.socket)throw new Error(S(b.INVALID_STATE,["not connecting or connected"]));var e=new E(m);this._notify_msg_sent[e]=y(this._disconnected,this),this._schedule_message(e)},M.prototype.getTraceLog=function(){if(null!==this._traceBuffer){for(var e in this._trace("Client.getTraceLog",new Date),this._trace("Client.getTraceLog in flight messages",this._sentMessages.length),this._sentMessages)this._trace("_sentMessages ",e,this._sentMessages[e]);for(var e in this._receivedMessages)this._trace("_receivedMessages ",e,this._receivedMessages[e]);return this._traceBuffer}},M.prototype.startTrace=function(){null===this._traceBuffer&&(this._traceBuffer=[]),this._trace("Client.startTrace",new Date,"@VERSION@-@BUILDLEVEL@")},M.prototype.stopTrace=function(){delete this._traceBuffer},M.prototype._doConnect=function(e){if(this.connectOptions.useSSL){var t=e.split(":");t[0]="wss",e=t.join(":")}this._wsuri=e,this.connected=!1,this.connectOptions.mqttVersion<4?this.socket=new WebSocket(e,["mqttv3.1"]):this.socket=new WebSocket(e,["mqtt"]),this.socket.binaryType="arraybuffer",this.socket.onopen=y(this._on_socket_open,this),this.socket.onmessage=y(this._on_socket_message,this),this.socket.onerror=y(this._on_socket_error,this),this.socket.onclose=y(this._on_socket_close,this),this.sendPinger=new D(this,this.connectOptions.keepAliveInterval),this.receivePinger=new D(this,this.connectOptions.keepAliveInterval),this._connectTimeout&&(this._connectTimeout.cancel(),this._connectTimeout=null),this._connectTimeout=new O(this,this.connectOptions.timeout,this._disconnected,[b.CONNECT_TIMEOUT.code,S(b.CONNECT_TIMEOUT)])},M.prototype._schedule_message=function(e){this._msg_queue.unshift(e),this.connected&&this._process_queue()},M.prototype.store=function(e,t){var i={type:t.type,messageIdentifier:t.messageIdentifier,version:1};switch(t.type){case s:t.pubRecReceived&&(i.pubRecReceived=!0),i.payloadMessage={};for(var n="",o=t.payloadMessage.payloadBytes,a=0;a<o.length;a++)o[a]<=15?n=n+"0"+o[a].toString(16):n+=o[a].toString(16);i.payloadMessage.payloadHex=n,i.payloadMessage.qos=t.payloadMessage.qos,i.payloadMessage.destinationName=t.payloadMessage.destinationName,t.payloadMessage.duplicate&&(i.payloadMessage.duplicate=!0),t.payloadMessage.retained&&(i.payloadMessage.retained=!0),0===e.indexOf("Sent:")&&(void 0===t.sequence&&(t.sequence=++this._sequence),i.sequence=t.sequence);break;default:throw Error(S(b.INVALID_STORED_DATA,[e+this._localKey+t.messageIdentifier,i]))}r.setItem(e+this._localKey+t.messageIdentifier,JSON.stringify(i))},M.prototype.restore=function(e){var t=r.getItem(e),i=JSON.parse(t),n=new E(i.type,i);switch(i.type){case s:for(var o=i.payloadMessage.payloadHex,a=new ArrayBuffer(o.length/2),c=new Uint8Array(a),d=0;o.length>=2;){var l=parseInt(o.substring(0,2),16);o=o.substring(2,o.length),c[d++]=l}var u=new N(c);u.qos=i.payloadMessage.qos,u.destinationName=i.payloadMessage.destinationName,i.payloadMessage.duplicate&&(u.duplicate=!0),i.payloadMessage.retained&&(u.retained=!0),n.payloadMessage=u;break;default:throw Error(S(b.INVALID_STORED_DATA,[e,t]))}0===e.indexOf("Sent:"+this._localKey)?(n.payloadMessage.duplicate=!0,this._sentMessages[n.messageIdentifier]=n):0===e.indexOf("Received:"+this._localKey)&&(this._receivedMessages[n.messageIdentifier]=n)},M.prototype._process_queue=function(){for(var e=null;e=this._msg_queue.pop();)this._socket_send(e),this._notify_msg_sent[e]&&(this._notify_msg_sent[e](),delete this._notify_msg_sent[e])},M.prototype._requires_ack=function(e){var t=Object.keys(this._sentMessages).length;if(t>this.maxMessageIdentifier)throw Error("Too many messages:"+t);for(;void 0!==this._sentMessages[this._message_identifier];)this._message_identifier++;e.messageIdentifier=this._message_identifier,this._sentMessages[e.messageIdentifier]=e,e.type===s&&this.store("Sent:",e),this._message_identifier===this.maxMessageIdentifier&&(this._message_identifier=1)},M.prototype._on_socket_open=function(){var e=new E(i,this.connectOptions);e.clientId=this.clientId,this._socket_send(e)},M.prototype._on_socket_message=function(e){this._trace("Client._on_socket_message",e.data);for(var t=this._deframeMessages(e.data),r=0;r<t.length;r+=1)this._handleMessage(t[r])},M.prototype._deframeMessages=function(e){var t=new Uint8Array(e),r=[];if(this.receiveBuffer){var i=new Uint8Array(this.receiveBuffer.length+t.length);i.set(this.receiveBuffer),i.set(t,this.receiveBuffer.length),t=i,delete this.receiveBuffer}try{for(var n=0;n<t.length;){var s=C(t,n),o=s[0];if(n=s[1],null===o)break;r.push(o)}n<t.length&&(this.receiveBuffer=t.subarray(n))}catch(e){var a="undefined"==e.hasOwnProperty("stack")?e.stack.toString():"No Error Stack Available";return void this._disconnected(b.INTERNAL_ERROR.code,S(b.INTERNAL_ERROR,[e.message,a]))}return r},M.prototype._handleMessage=function(e){this._trace("Client._handleMessage",e);try{switch(e.type){case n:if(this._connectTimeout.cancel(),this._reconnectTimeout&&this._reconnectTimeout.cancel(),this.connectOptions.cleanSession){for(var t in this._sentMessages){var i=this._sentMessages[t];r.removeItem("Sent:"+this._localKey+i.messageIdentifier)}for(var t in this._sentMessages={},this._receivedMessages){var l=this._receivedMessages[t];r.removeItem("Received:"+this._localKey+l.messageIdentifier)}this._receivedMessages={}}if(0!==e.returnCode){this._disconnected(b.CONNACK_RETURNCODE.code,S(b.CONNACK_RETURNCODE,[e.returnCode,w[e.returnCode]]));break}this.connected=!0,this.connectOptions.uris&&(this.hostIndex=this.connectOptions.uris.length);var h=[];for(var g in this._sentMessages)this._sentMessages.hasOwnProperty(g)&&h.push(this._sentMessages[g]);if(this._buffered_msg_queue.length>0)for(var v=null;v=this._buffered_msg_queue.pop();)h.push(v),this.onMessageDelivered&&(this._notify_msg_sent[v]=this.onMessageDelivered(v.payloadMessage));h=h.sort((function(e,t){return e.sequence-t.sequence}));for(var y=0,T=h.length;y<T;y++)if((i=h[y]).type==s&&i.pubRecReceived){var _=new E(c,{messageIdentifier:i.messageIdentifier});this._schedule_message(_)}else this._schedule_message(i);this.connectOptions.onSuccess&&this.connectOptions.onSuccess({invocationContext:this.connectOptions.invocationContext});var C=!1;this._reconnecting&&(C=!0,this._reconnectInterval=1,this._reconnecting=!1),this._connected(C,this._wsuri),this._process_queue();break;case s:this._receivePublish(e);break;case o:(i=this._sentMessages[e.messageIdentifier])&&(delete this._sentMessages[e.messageIdentifier],r.removeItem("Sent:"+this._localKey+e.messageIdentifier),this.onMessageDelivered&&this.onMessageDelivered(i.payloadMessage));break;case a:(i=this._sentMessages[e.messageIdentifier])&&(i.pubRecReceived=!0,_=new E(c,{messageIdentifier:e.messageIdentifier}),this.store("Sent:",i),this._schedule_message(_));break;case c:l=this._receivedMessages[e.messageIdentifier],r.removeItem("Received:"+this._localKey+e.messageIdentifier),l&&(this._receiveMessage(l),delete this._receivedMessages[e.messageIdentifier]);var R=new E(d,{messageIdentifier:e.messageIdentifier});this._schedule_message(R);break;case d:i=this._sentMessages[e.messageIdentifier],delete this._sentMessages[e.messageIdentifier],r.removeItem("Sent:"+this._localKey+e.messageIdentifier),this.onMessageDelivered&&this.onMessageDelivered(i.payloadMessage);break;case u:(i=this._sentMessages[e.messageIdentifier])&&(i.timeOut&&i.timeOut.cancel(),128===e.returnCode[0]?i.onFailure&&i.onFailure(e.returnCode):i.onSuccess&&i.onSuccess(e.returnCode),delete this._sentMessages[e.messageIdentifier]);break;case p:(i=this._sentMessages[e.messageIdentifier])&&(i.timeOut&&i.timeOut.cancel(),i.callback&&i.callback(),delete this._sentMessages[e.messageIdentifier]);break;case f:this.sendPinger.reset();break;case m:this._disconnected(b.INVALID_MQTT_MESSAGE_TYPE.code,S(b.INVALID_MQTT_MESSAGE_TYPE,[e.type]));break;default:this._disconnected(b.INVALID_MQTT_MESSAGE_TYPE.code,S(b.INVALID_MQTT_MESSAGE_TYPE,[e.type]))}}catch(e){var A="undefined"==e.hasOwnProperty("stack")?e.stack.toString():"No Error Stack Available";return void this._disconnected(b.INTERNAL_ERROR.code,S(b.INTERNAL_ERROR,[e.message,A]))}},M.prototype._on_socket_error=function(e){this._reconnecting||this._disconnected(b.SOCKET_ERROR.code,S(b.SOCKET_ERROR,[e.data]))},M.prototype._on_socket_close=function(){this._reconnecting||this._disconnected(b.SOCKET_CLOSE.code,S(b.SOCKET_CLOSE))},M.prototype._socket_send=function(e){if(1==e.type){var t=this._traceMask(e,"password");this._trace("Client._socket_send",t)}else this._trace("Client._socket_send",e);this.socket.send(e.encode()),this.sendPinger.reset()},M.prototype._receivePublish=function(e){switch(e.payloadMessage.qos){case"undefined":case 0:this._receiveMessage(e);break;case 1:var t=new E(o,{messageIdentifier:e.messageIdentifier});this._schedule_message(t),this._receiveMessage(e);break;case 2:this._receivedMessages[e.messageIdentifier]=e,this.store("Received:",e);var r=new E(a,{messageIdentifier:e.messageIdentifier});this._schedule_message(r);break;default:throw Error("Invaild qos="+e.payloadMessage.qos)}},M.prototype._receiveMessage=function(e){this.onMessageArrived&&this.onMessageArrived(e.payloadMessage)},M.prototype._connected=function(e,t){this.onConnected&&this.onConnected(e,t)},M.prototype._reconnect=function(){this._trace("Client._reconnect"),this.connected||(this._reconnecting=!0,this.sendPinger.cancel(),this.receivePinger.cancel(),this._reconnectInterval<128&&(this._reconnectInterval=2*this._reconnectInterval),this.connectOptions.uris?(this.hostIndex=0,this._doConnect(this.connectOptions.uris[0])):this._doConnect(this.uri))},M.prototype._disconnected=function(e,t){if(this._trace("Client._disconnected",e,t),void 0!==e&&this._reconnecting)this._reconnectTimeout=new O(this,this._reconnectInterval,this._reconnect);else if(this.sendPinger.cancel(),this.receivePinger.cancel(),this._connectTimeout&&(this._connectTimeout.cancel(),this._connectTimeout=null),this._msg_queue=[],this._buffered_msg_queue=[],this._notify_msg_sent={},this.socket&&(this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,1===this.socket.readyState&&this.socket.close(),delete this.socket),this.connectOptions.uris&&this.hostIndex<this.connectOptions.uris.length-1)this.hostIndex++,this._doConnect(this.connectOptions.uris[this.hostIndex]);else if(void 0===e&&(e=b.OK.code,t=S(b.OK)),this.connected){if(this.connected=!1,this.onConnectionLost&&this.onConnectionLost({errorCode:e,errorMessage:t,reconnect:this.connectOptions.reconnect,uri:this._wsuri}),e!==b.OK.code&&this.connectOptions.reconnect)return this._reconnectInterval=1,void this._reconnect()}else 4===this.connectOptions.mqttVersion&&!1===this.connectOptions.mqttVersionExplicit?(this._trace("Failed to connect V4, dropping back to V3"),this.connectOptions.mqttVersion=3,this.connectOptions.uris?(this.hostIndex=0,this._doConnect(this.connectOptions.uris[0])):this._doConnect(this.uri)):this.connectOptions.onFailure&&this.connectOptions.onFailure({invocationContext:this.connectOptions.invocationContext,errorCode:e,errorMessage:t})},M.prototype._trace=function(){if(this.traceFunction){var e=Array.prototype.slice.call(arguments);for(var t in e)void 0!==e[t]&&e.splice(t,1,JSON.stringify(e[t]));var r=e.join("");this.traceFunction({severity:"Debug",message:r})}if(null!==this._traceBuffer){t=0;for(var i=arguments.length;t<i;t++)this._traceBuffer.length==this._MAX_TRACE_ENTRIES&&this._traceBuffer.shift(),0===t||void 0===arguments[t]?this._traceBuffer.push(arguments[t]):this._traceBuffer.push(" "+JSON.stringify(arguments[t]))}},M.prototype._traceMask=function(e,t){var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=i==t?"******":e[i]);return r};var N=function(e){var t,r;if(!("string"==typeof e||e instanceof ArrayBuffer||ArrayBuffer.isView(e)&&!(e instanceof DataView)))throw S(b.INVALID_ARGUMENT,[e,"newPayload"]);t=e;var i=0,n=!1,s=!1;Object.defineProperties(this,{payloadString:{enumerable:!0,get:function(){return"string"==typeof t?t:x(t,0,t.length)}},payloadBytes:{enumerable:!0,get:function(){if("string"==typeof t){var e=new ArrayBuffer(k(t)),r=new Uint8Array(e);return P(t,r,0),r}return t}},destinationName:{enumerable:!0,get:function(){return r},set:function(e){if("string"!=typeof e)throw new Error(S(b.INVALID_ARGUMENT,[e,"newDestinationName"]));r=e}},qos:{enumerable:!0,get:function(){return i},set:function(e){if(0!==e&&1!==e&&2!==e)throw new Error("Invalid argument:"+e);i=e}},retained:{enumerable:!0,get:function(){return n},set:function(e){if("boolean"!=typeof e)throw new Error(S(b.INVALID_ARGUMENT,[e,"newRetained"]));n=e}},topic:{enumerable:!0,get:function(){return r},set:function(e){r=e}},duplicate:{enumerable:!0,get:function(){return s},set:function(e){s=e}}})};return{Client:function(e,t,r,i){var n;if("string"!=typeof e)throw new Error(S(b.INVALID_TYPE,[typeof e,"host"]));if(2==arguments.length){i=t;var s=(n=e).match(/^(wss?):\/\/((\[(.+)\])|([^\/]+?))(:(\d+))?(\/.*)$/);if(!s)throw new Error(S(b.INVALID_ARGUMENT,[e,"host"]));e=s[4]||s[2],t=parseInt(s[7]),r=s[8]}else{if(3==arguments.length&&(i=r,r="/mqtt"),"number"!=typeof t||t<0)throw new Error(S(b.INVALID_TYPE,[typeof t,"port"]));if("string"!=typeof r)throw new Error(S(b.INVALID_TYPE,[typeof r,"path"]));var o=-1!==e.indexOf(":")&&"["!==e.slice(0,1)&&"]"!==e.slice(-1);n="ws://"+(o?"["+e+"]":e)+":"+t+r}for(var a=0,c=0;c<i.length;c++){var d=i.charCodeAt(c);55296<=d&&d<=56319&&c++,a++}if("string"!=typeof i||a>65535)throw new Error(S(b.INVALID_ARGUMENT,[i,"clientId"]));var l=new M(n,e,t,r,i);Object.defineProperties(this,{host:{get:function(){return e},set:function(){throw new Error(S(b.UNSUPPORTED_OPERATION))}},port:{get:function(){return t},set:function(){throw new Error(S(b.UNSUPPORTED_OPERATION))}},path:{get:function(){return r},set:function(){throw new Error(S(b.UNSUPPORTED_OPERATION))}},uri:{get:function(){return n},set:function(){throw new Error(S(b.UNSUPPORTED_OPERATION))}},clientId:{get:function(){return l.clientId},set:function(){throw new Error(S(b.UNSUPPORTED_OPERATION))}},onConnected:{get:function(){return l.onConnected},set:function(e){if("function"!=typeof e)throw new Error(S(b.INVALID_TYPE,[typeof e,"onConnected"]));l.onConnected=e}},disconnectedPublishing:{get:function(){return l.disconnectedPublishing},set:function(e){l.disconnectedPublishing=e}},disconnectedBufferSize:{get:function(){return l.disconnectedBufferSize},set:function(e){l.disconnectedBufferSize=e}},onConnectionLost:{get:function(){return l.onConnectionLost},set:function(e){if("function"!=typeof e)throw new Error(S(b.INVALID_TYPE,[typeof e,"onConnectionLost"]));l.onConnectionLost=e}},onMessageDelivered:{get:function(){return l.onMessageDelivered},set:function(e){if("function"!=typeof e)throw new Error(S(b.INVALID_TYPE,[typeof e,"onMessageDelivered"]));l.onMessageDelivered=e}},onMessageArrived:{get:function(){return l.onMessageArrived},set:function(e){if("function"!=typeof e)throw new Error(S(b.INVALID_TYPE,[typeof e,"onMessageArrived"]));l.onMessageArrived=e}},trace:{get:function(){return l.traceFunction},set:function(e){if("function"!=typeof e)throw new Error(S(b.INVALID_TYPE,[typeof e,"onTrace"]));l.traceFunction=e}}}),this.connect=function(e){if(v(e=e||{},{timeout:"number",userName:"string",password:"string",willMessage:"object",keepAliveInterval:"number",cleanSession:"boolean",useSSL:"boolean",invocationContext:"object",onSuccess:"function",onFailure:"function",hosts:"object",ports:"object",reconnect:"boolean",mqttVersion:"number",mqttVersionExplicit:"boolean",uris:"object"}),void 0===e.keepAliveInterval&&(e.keepAliveInterval=60),e.mqttVersion>4||e.mqttVersion<3)throw new Error(S(b.INVALID_ARGUMENT,[e.mqttVersion,"connectOptions.mqttVersion"]));if(void 0===e.mqttVersion?(e.mqttVersionExplicit=!1,e.mqttVersion=4):e.mqttVersionExplicit=!0,void 0!==e.password&&void 0===e.userName)throw new Error(S(b.INVALID_ARGUMENT,[e.password,"connectOptions.password"]));if(e.willMessage){if(!(e.willMessage instanceof N))throw new Error(S(b.INVALID_TYPE,[e.willMessage,"connectOptions.willMessage"]));if(e.willMessage.stringPayload=null,void 0===e.willMessage.destinationName)throw new Error(S(b.INVALID_TYPE,[typeof e.willMessage.destinationName,"connectOptions.willMessage.destinationName"]))}if(void 0===e.cleanSession&&(e.cleanSession=!0),e.hosts){if(!(e.hosts instanceof Array))throw new Error(S(b.INVALID_ARGUMENT,[e.hosts,"connectOptions.hosts"]));if(e.hosts.length<1)throw new Error(S(b.INVALID_ARGUMENT,[e.hosts,"connectOptions.hosts"]));for(var t=!1,i=0;i<e.hosts.length;i++){if("string"!=typeof e.hosts[i])throw new Error(S(b.INVALID_TYPE,[typeof e.hosts[i],"connectOptions.hosts["+i+"]"]));if(/^(wss?):\/\/((\[(.+)\])|([^\/]+?))(:(\d+))?(\/.*)$/.test(e.hosts[i])){if(0===i)t=!0;else if(!t)throw new Error(S(b.INVALID_ARGUMENT,[e.hosts[i],"connectOptions.hosts["+i+"]"]))}else if(t)throw new Error(S(b.INVALID_ARGUMENT,[e.hosts[i],"connectOptions.hosts["+i+"]"]))}if(t)e.uris=e.hosts;else{if(!e.ports)throw new Error(S(b.INVALID_ARGUMENT,[e.ports,"connectOptions.ports"]));if(!(e.ports instanceof Array))throw new Error(S(b.INVALID_ARGUMENT,[e.ports,"connectOptions.ports"]));if(e.hosts.length!==e.ports.length)throw new Error(S(b.INVALID_ARGUMENT,[e.ports,"connectOptions.ports"]));for(e.uris=[],i=0;i<e.hosts.length;i++){if("number"!=typeof e.ports[i]||e.ports[i]<0)throw new Error(S(b.INVALID_TYPE,[typeof e.ports[i],"connectOptions.ports["+i+"]"]));var s=e.hosts[i],o=e.ports[i],a=-1!==s.indexOf(":");n="ws://"+(a?"["+s+"]":s)+":"+o+r,e.uris.push(n)}}}l.connect(e)},this.subscribe=function(e,t){if("string"!=typeof e&&e.constructor!==Array)throw new Error("Invalid argument:"+e);if(v(t=t||{},{qos:"number",invocationContext:"object",onSuccess:"function",onFailure:"function",timeout:"number"}),t.timeout&&!t.onFailure)throw new Error("subscribeOptions.timeout specified with no onFailure callback.");if(void 0!==t.qos&&0!==t.qos&&1!==t.qos&&2!==t.qos)throw new Error(S(b.INVALID_ARGUMENT,[t.qos,"subscribeOptions.qos"]));l.subscribe(e,t)},this.unsubscribe=function(e,t){if("string"!=typeof e&&e.constructor!==Array)throw new Error("Invalid argument:"+e);if(v(t=t||{},{invocationContext:"object",onSuccess:"function",onFailure:"function",timeout:"number"}),t.timeout&&!t.onFailure)throw new Error("unsubscribeOptions.timeout specified with no onFailure callback.");l.unsubscribe(e,t)},this.send=function(e,t,r,i){var n;if(0===arguments.length)throw new Error("Invalid argument.length");if(1==arguments.length){if(!(e instanceof N)&&"string"!=typeof e)throw new Error("Invalid argument:"+typeof e);if(void 0===(n=e).destinationName)throw new Error(S(b.INVALID_ARGUMENT,[n.destinationName,"Message.destinationName"]));l.send(n)}else(n=new N(t)).destinationName=e,arguments.length>=3&&(n.qos=r),arguments.length>=4&&(n.retained=i),l.send(n)},this.publish=function(e,t,r,i){var n;if(0===arguments.length)throw new Error("Invalid argument.length");if(1==arguments.length){if(!(e instanceof N)&&"string"!=typeof e)throw new Error("Invalid argument:"+typeof e);if(void 0===(n=e).destinationName)throw new Error(S(b.INVALID_ARGUMENT,[n.destinationName,"Message.destinationName"]));l.send(n)}else(n=new N(t)).destinationName=e,arguments.length>=3&&(n.qos=r),arguments.length>=4&&(n.retained=i),l.send(n)},this.disconnect=function(){l.disconnect()},this.getTraceLog=function(){return l.getTraceLog()},this.startTrace=function(){l.startTrace()},this.stopTrace=function(){l.stopTrace()},this.isConnected=function(){return l.connected}},Message:N}}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},e.exports=i()},function(e,t,r){"use strict";t.a=function(){return!1}},function(e,t,r){"use strict";var i=r(154),n=r(164),s=r(26);e.exports={formats:s,parse:n,stringify:i}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";var i=r(2),n=r(30),s=r(113),o=r(37);var a=function e(t){var r=new s(t),a=n(s.prototype.request,r);return i.extend(a,s.prototype,r),i.extend(a,r),a.create=function(r){return e(o(t,r))},a}(r(20));a.Axios=s,a.CanceledError=r(13),a.CancelToken=r(127),a.isCancel=r(36),a.VERSION=r(38).version,a.toFormData=r(33),a.AxiosError=r(9),a.Cancel=a.CanceledError,a.all=function(e){return Promise.all(e)},a.spread=r(128),a.isAxiosError=r(129),e.exports=a,e.exports.default=a},function(e,t,r){"use strict";var i=r(2),n=r(31),s=r(114),o=r(115),a=r(37),c=r(35),d=r(126),l=d.validators;function u(e){this.defaults=e,this.interceptors={request:new s,response:new s}}u.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&d.assertOptions(r,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1);var i=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));var s,c=[];if(this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)})),!n){var u=[o,void 0];for(Array.prototype.unshift.apply(u,i),u=u.concat(c),s=Promise.resolve(t);u.length;)s=s.then(u.shift(),u.shift());return s}for(var h=t;i.length;){var p=i.shift(),g=i.shift();try{h=p(h)}catch(e){g(e);break}}try{s=o(h)}catch(e){return Promise.reject(e)}for(;c.length;)s=s.then(c.shift(),c.shift());return s},u.prototype.getUri=function(e){e=a(this.defaults,e);var t=c(e.baseURL,e.url);return n(t,e.params,e.paramsSerializer)},i.forEach(["delete","get","head","options"],(function(e){u.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),i.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(a(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}u.prototype[e]=t(),u.prototype[e+"Form"]=t(!0)})),e.exports=u},function(e,t,r){"use strict";var i=r(2);function n(){this.handlers=[]}n.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){i.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},function(e,t,r){"use strict";var i=r(2),n=r(116),s=r(36),o=r(20),a=r(13);function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=n.call(e,e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),i.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return c(e),t.data=n.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(c(e),t&&t.response&&(t.response.data=n.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var i=r(2),n=r(20);e.exports=function(e,t,r){var s=this||n;return i.forEach(r,(function(r){e=r.call(s,e,t)})),e}},function(e,t,r){"use strict";var i=r(2);e.exports=function(e,t){i.forEach(e,(function(r,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[i])}))}},function(e,t,r){"use strict";var i=r(9);e.exports=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new i("Request failed with status code "+r.status,[i.ERR_BAD_REQUEST,i.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}},function(e,t,r){"use strict";var i=r(2);e.exports=i.isStandardBrowserEnv()?{write:function(e,t,r,n,s,o){var a=[];a.push(e+"="+encodeURIComponent(t)),i.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),i.isString(n)&&a.push("path="+n),i.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var i=r(2),n=["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"];e.exports=function(e){var t,r,s,o={};return e?(i.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=i.trim(e.substr(0,s)).toLowerCase(),r=i.trim(e.substr(s+1)),t){if(o[t]&&n.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([r]):o[t]?o[t]+", "+r:r}})),o):o}},function(e,t,r){"use strict";var i=r(2);e.exports=i.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var i=e;return t&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=i.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},function(e,t){e.exports=null},function(e,t,r){"use strict";var i=r(38).version,n=r(9),s={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){s[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var o={};s.transitional=function(e,t,r){function s(e,t){return"[Axios v"+i+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,a){if(!1===e)throw new n(s(i," has been removed"+(t?" in "+t:"")),n.ERR_DEPRECATED);return t&&!o[i]&&(o[i]=!0,console.warn(s(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new n("options must be an object",n.ERR_BAD_OPTION_VALUE);for(var i=Object.keys(e),s=i.length;s-- >0;){var o=i[s],a=t[o];if(a){var c=e[o],d=void 0===c||a(c,o,e);if(!0!==d)throw new n("option "+o+" must be "+d,n.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new n("Unknown option "+o,n.ERR_BAD_OPTION)}},validators:s}},function(e,t,r){"use strict";var i=r(13);function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,i=r._listeners.length;for(t=0;t<i;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,i=new Promise((function(e){r.subscribe(e),t=e})).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e){r.reason||(r.reason=new i(e),t(r.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},n.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},n.source=function(){var e;return{token:new n((function(t){e=t})),cancel:e}},e.exports=n},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";var i=r(2);e.exports=function(e){return i.isObject(e)&&!0===e.isAxiosError}},function(e,t){},function(e,t,r){var i;e.exports=(i=r(0),function(){if("function"==typeof ArrayBuffer){var e=i.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,i=[],n=0;n<r;n++)i[n>>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)}).prototype=e}}(),i.lib.WordArray)},function(e,t,r){var i;e.exports=(i=r(0),function(){var e=i,t=e.lib.WordArray,r=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n+=2){var s=t[n>>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n<r;n++)i[n>>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},r.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s<r;s+=2){var o=n(t[s>>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s<r;s++)i[s>>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),i.enc.Utf16)},function(e,t,r){var i,n,s;e.exports=(s=r(0),n=(i=s).lib.WordArray,i.enc.Base64url={stringify:function(e,t=!0){var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],o=0;o<i;o+=3)for(var a=(r[o>>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,c=0;c<4&&o+.75*c<i;c++)s.push(n.charAt(a>>>6*(3-c)&63));var d=n.charAt(64);if(d)for(;s.length%4;)s.push(d);return s.join("")},parse:function(e,t=!0){var r=e.length,i=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o<i.length;o++)s[i.charCodeAt(o)]=o}var a=i.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(r=c)}return function(e,t,r){for(var i=[],s=0,o=0;o<t;o++)if(o%4){var a=r[e.charCodeAt(o-1)]<<o%4*2,c=r[e.charCodeAt(o)]>>>6-o%4*2,d=a|c;i[s>>>2]|=d<<24-s%4*8,s++}return n.create(i,s)}(e,r,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},s.enc.Base64url)},function(e,t,r){var i,n,s,o,a,c;e.exports=(c=r(0),r(39),n=(i=c).lib.WordArray,s=i.algo,o=s.SHA256,a=s.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=o._createHelper(a),i.HmacSHA224=o._createHmacHelper(a),c.SHA224)},function(e,t,r){var i,n,s,o,a,c,d,l;e.exports=(l=r(0),r(14),r(40),n=(i=l).x64,s=n.Word,o=n.WordArray,a=i.algo,c=a.SHA512,d=a.SHA384=c.extend({_doReset:function(){this._hash=new o.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var e=c._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=c._createHelper(d),i.HmacSHA384=c._createHmacHelper(d),l.SHA384)},function(e,t,r){var i;e.exports=(i=r(0),r(14),function(e){var t=i,r=t.lib,n=r.WordArray,s=r.Hasher,o=t.x64.Word,a=t.algo,c=[],d=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)d[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var a=0,u=0,h=0;h<7;h++){if(1&n){var p=(1<<h)-1;p<32?u^=1<<p:a^=1<<p-32}128&n?n=n<<1^113:n<<=1}l[s]=o.create(a,u)}}();var u=[];!function(){for(var e=0;e<25;e++)u[e]=o.create()}();var h=a.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,i=this.blockSize/2,n=0;n<i;n++){var s=e[t+2*n],o=e[t+2*n+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(I=r[n]).high^=o,I.low^=s}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var p=0,g=0,f=0;f<5;f++)p^=(I=r[h+5*f]).high,g^=I.low;var m=u[h];m.high=p,m.low=g}for(h=0;h<5;h++){var v=u[(h+4)%5],y=u[(h+1)%5],b=y.high,w=y.low;for(p=v.high^(b<<1|w>>>31),g=v.low^(w<<1|b>>>31),f=0;f<5;f++)(I=r[h+5*f]).high^=p,I.low^=g}for(var S=1;S<25;S++){var T=(I=r[S]).high,_=I.low,E=c[S];E<32?(p=T<<E|_>>>32-E,g=_<<E|T>>>32-E):(p=_<<E-32|T>>>64-E,g=T<<E-32|_>>>64-E);var C=u[d[S]];C.high=p,C.low=g}var R=u[0],A=r[0];for(R.high=A.high,R.low=A.low,h=0;h<5;h++)for(f=0;f<5;f++){var I=r[S=h+5*f],k=u[S],P=u[(h+1)%5+5*f],x=u[(h+2)%5+5*f];I.high=k.high^~P.high&x.high,I.low=k.low^~P.low&x.low}I=r[0];var D=l[a];I.high^=D.high,I.low^=D.low}},_doFinalize:function(){var t=this._data,r=t.words,i=(this._nDataBytes,8*t.sigBytes),s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,c=a/8,d=[],l=0;l<c;l++){var u=o[l],h=u.high,p=u.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d.push(p),d.push(h)}return new n.init(d,a)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),i.SHA3)},function(e,t,r){var i;e.exports=(i=r(0),function(e){var t=i,r=t.lib,n=r.WordArray,s=r.Hasher,o=t.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),c=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),p=o.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,o,p,w,S,T,_,E,C,R,A,I=this._hash.words,k=u.words,P=h.words,x=a.words,D=c.words,O=d.words,M=l.words;for(T=s=I[0],_=o=I[1],E=p=I[2],C=w=I[3],R=S=I[4],r=0;r<80;r+=1)A=s+e[t+x[r]]|0,A+=r<16?g(o,p,w)+k[0]:r<32?f(o,p,w)+k[1]:r<48?m(o,p,w)+k[2]:r<64?v(o,p,w)+k[3]:y(o,p,w)+k[4],A=(A=b(A|=0,O[r]))+S|0,s=S,S=w,w=b(p,10),p=o,o=A,A=T+e[t+D[r]]|0,A+=r<16?y(_,E,C)+P[0]:r<32?v(_,E,C)+P[1]:r<48?m(_,E,C)+P[2]:r<64?f(_,E,C)+P[3]:g(_,E,C)+P[4],A=(A=b(A|=0,M[r]))+R|0,T=R,R=C,C=b(E,10),E=_,_=A;A=I[1]+p+C|0,I[1]=I[2]+w+R|0,I[2]=I[3]+S+T|0,I[3]=I[4]+s+_|0,I[4]=I[0]+o+E|0,I[0]=A},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,o=0;o<5;o++){var a=s[o];s[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function g(e,t,r){return e^t^r}function f(e,t,r){return e&t|~e&r}function m(e,t,r){return(e|~t)^r}function v(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function b(e,t){return e<<t|e>>>32-t}t.RIPEMD160=s._createHelper(p),t.HmacRIPEMD160=s._createHmacHelper(p)}(Math),i.RIPEMD160)},function(e,t,r){var i,n,s,o,a,c,d,l,u;e.exports=(u=r(0),r(21),r(22),n=(i=u).lib,s=n.Base,o=n.WordArray,a=i.algo,c=a.SHA1,d=a.HMAC,l=a.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,i=d.create(r.hasher,e),n=o.create(),s=o.create([1]),a=n.words,c=s.words,l=r.keySize,u=r.iterations;a.length<l;){var h=i.update(t).finalize(s);i.reset();for(var p=h.words,g=p.length,f=h,m=1;m<u;m++){f=i.finalize(f),i.reset();for(var v=f.words,y=0;y<g;y++)p[y]^=v[y]}n.concat(h),c[0]++}return n.sigBytes=4*l,n}}),i.PBKDF2=function(e,t,r){return l.create(r).compute(e,t)},u.PBKDF2)},function(e,t,r){var i;e.exports=(i=r(0),r(3),i.mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var o=0;o<r;o++)e[t+o]^=n[o]}return e.Encryptor=e.extend({processBlock:function(e,r){var i=this._cipher,n=i.blockSize;t.call(this,e,r,n,i),this._prevBlock=e.slice(r,r+n)}}),e.Decryptor=e.extend({processBlock:function(e,r){var i=this._cipher,n=i.blockSize,s=e.slice(r,r+n);t.call(this,e,r,n,i),this._prevBlock=s}}),e}(),i.mode.CFB)},function(e,t,r){var i,n,s;e.exports=(s=r(0),r(3),s.mode.CTR=(i=s.lib.BlockCipherMode.extend(),n=i.Encryptor=i.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._counter;n&&(s=this._counter=n.slice(0),this._iv=void 0);var o=s.slice(0);r.encryptBlock(o,0),s[i-1]=s[i-1]+1|0;for(var a=0;a<i;a++)e[t+a]^=o[a]}}),i.Decryptor=n,i),s.mode.CTR)},function(e,t,r){var i;e.exports=(i=r(0),r(3),i.mode.CTRGladman=function(){var e=i.lib.BlockCipherMode.extend();function t(e){if(255==(e>>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}var r=e.Encryptor=e.extend({processBlock:function(e,r){var i=this._cipher,n=i.blockSize,s=this._iv,o=this._counter;s&&(o=this._counter=s.slice(0),this._iv=void 0),function(e){0===(e[0]=t(e[0]))&&(e[1]=t(e[1]))}(o);var a=o.slice(0);i.encryptBlock(a,0);for(var c=0;c<n;c++)e[r+c]^=a[c]}});return e.Decryptor=r,e}(),i.mode.CTRGladman)},function(e,t,r){var i,n,s;e.exports=(s=r(0),r(3),s.mode.OFB=(i=s.lib.BlockCipherMode.extend(),n=i.Encryptor=i.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._keystream;n&&(s=this._keystream=n.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var o=0;o<i;o++)e[t+o]^=s[o]}}),i.Decryptor=n,i),s.mode.OFB)},function(e,t,r){var i,n;e.exports=(n=r(0),r(3),n.mode.ECB=((i=n.lib.BlockCipherMode.extend()).Encryptor=i.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),i.Decryptor=i.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),i),n.mode.ECB)},function(e,t,r){var i;e.exports=(i=r(0),r(3),i.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,i=4*t,n=i-r%i,s=r+n-1;e.clamp(),e.words[s>>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)},function(e,t,r){var i;e.exports=(i=r(0),r(3),i.pad.Iso10126={pad:function(e,t){var r=4*t,n=r-e.sigBytes%r;e.concat(i.lib.WordArray.random(n-1)).concat(i.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)},function(e,t,r){var i;e.exports=(i=r(0),r(3),i.pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)},function(e,t,r){var i;e.exports=(i=r(0),r(3),i.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},i.pad.ZeroPadding)},function(e,t,r){var i;e.exports=(i=r(0),r(3),i.pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)},function(e,t,r){var i,n,s,o;e.exports=(o=r(0),r(3),n=(i=o).lib.CipherParams,s=i.enc.Hex,i.format.Hex={stringify:function(e){return e.ciphertext.toString(s)},parse:function(e){var t=s.parse(e);return n.create({ciphertext:t})}},o.format.Hex)},function(e,t,r){var i;e.exports=(i=r(0),r(4),r(7),r(8),r(3),function(){var e=i,t=e.lib,r=t.WordArray,n=t.BlockCipher,s=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=o[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var d=n[s]=[],l=c[s];for(r=0;r<24;r++)d[r/6|0]|=t[(a[r]-1+l)%28]<<31-r%6,d[4+(r/6|0)]|=t[28+(a[r+24]-1+l)%28]<<31-r%6;for(d[0]=d[0]<<1|d[0]>>>31,r=1;r<7;r++)d[r]=d[r]>>>4*(r-1)+3;d[7]=d[7]<<5|d[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,o=this._rBlock,a=0,c=0;c<8;c++)a|=d[c][((o^n[c])&l[c])>>>0];this._lBlock=o,this._rBlock=s^a}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function p(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=n._createHelper(u);var g=s.TripleDES=n.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(r.create(t)),this._des2=u.createEncryptor(r.create(i)),this._des3=u.createEncryptor(r.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(g)}(),i.TripleDES)},function(e,t,r){var i;e.exports=(i=r(0),r(4),r(7),r(8),r(3),function(){var e=i,t=e.lib.StreamCipher,r=e.algo,n=r.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var o=n%r,a=t[o>>>2]>>>24-o%4*8&255;s=(s+i[n]+a)%256;var c=i[n];i[n]=i[s],i[s]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var o=r.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(o)}(),i.RC4)},function(e,t,r){var i;e.exports=(i=r(0),r(4),r(7),r(8),r(3),function(){var e=i,t=e.lib.StreamCipher,r=e.algo,n=[],s=[],o=[],a=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,o=s[0],a=s[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=d>>>16|4294901760&l,h=l<<16|65535&d;for(n[0]^=d,n[1]^=u,n[2]^=l,n[3]^=h,n[4]^=d,n[5]^=u,n[6]^=l,n[7]^=h,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,c=((n*n>>>17)+n*a>>>15)+a*a,d=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=c^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(a)}(),i.Rabbit)},function(e,t,r){var i;e.exports=(i=r(0),r(4),r(7),r(8),r(3),function(){var e=i,t=e.lib.StreamCipher,r=e.algo,n=[],s=[],o=[],a=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,o=s[0],a=s[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=d>>>16|4294901760&l,h=l<<16|65535&d;for(i[0]^=d,i[1]^=u,i[2]^=l,i[3]^=h,i[4]^=d,i[5]^=u,i[6]^=l,i[7]^=h,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,c=((n*n>>>17)+n*a>>>15)+a*a,d=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=c^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(a)}(),i.RabbitLegacy)},function(e,t,r){"use strict";var i=r(155),n=r(41),s=r(26),o=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,d=Array.prototype.push,l=function(e,t){d.apply(e,c(t)?t:[t])},u=Date.prototype.toISOString,h=s.default,p={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,format:h,formatter:s.formatters[h],indices:!1,serializeDate:function(e){return u.call(e)},skipNulls:!1,strictNullHandling:!1},g={},f=function e(t,r,s,o,a,d,u,h,f,m,v,y,b,w,S,T){for(var _,E=t,C=T,R=0,A=!1;void 0!==(C=C.get(g))&&!A;){var I=C.get(t);if(R+=1,void 0!==I){if(I===R)throw new RangeError("Cyclic object value");A=!0}void 0===C.get(g)&&(R=0)}if("function"==typeof h?E=h(r,E):E instanceof Date?E=v(E):"comma"===s&&c(E)&&(E=n.maybeMap(E,(function(e){return e instanceof Date?v(e):e}))),null===E){if(a)return u&&!w?u(r,p.encoder,S,"key",y):r;E=""}if("string"==typeof(_=E)||"number"==typeof _||"boolean"==typeof _||"symbol"==typeof _||"bigint"==typeof _||n.isBuffer(E))return u?[b(w?r:u(r,p.encoder,S,"key",y))+"="+b(u(E,p.encoder,S,"value",y))]:[b(r)+"="+b(String(E))];var k,P=[];if(void 0===E)return P;if("comma"===s&&c(E))w&&u&&(E=n.maybeMap(E,u)),k=[{value:E.length>0?E.join(",")||null:void 0}];else if(c(h))k=h;else{var x=Object.keys(E);k=f?x.sort(f):x}for(var D=o&&c(E)&&1===E.length?r+"[]":r,O=0;O<k.length;++O){var M=k[O],N="object"==typeof M&&void 0!==M.value?M.value:E[M];if(!d||null!==N){var $=c(E)?"function"==typeof s?s(D,M):D:D+(m?"."+M:"["+M+"]");T.set(t,R);var j=i();j.set(g,T),l(P,e(N,$,s,o,a,d,"comma"===s&&w&&c(E)?null:u,h,f,m,v,y,b,w,S,j))}}return P};e.exports=function(e,t){var r,n=e,d=function(e){if(!e)return p;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||p.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=s.default;if(void 0!==e.format){if(!o.call(s.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var i=s.formatters[r],n=p.filter;return("function"==typeof e.filter||c(e.filter))&&(n=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:p.addQueryPrefix,allowDots:void 0===e.allowDots?p.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:p.charsetSentinel,delimiter:void 0===e.delimiter?p.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:p.encode,encoder:"function"==typeof e.encoder?e.encoder:p.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:p.encodeValuesOnly,filter:n,format:r,formatter:i,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:p.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:p.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:p.strictNullHandling}}(t);"function"==typeof d.filter?n=(0,d.filter)("",n):c(d.filter)&&(r=d.filter);var u,h=[];if("object"!=typeof n||null===n)return"";u=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var g=a[u];if(t&&"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var m="comma"===g&&t&&t.commaRoundTrip;r||(r=Object.keys(n)),d.sort&&r.sort(d.sort);for(var v=i(),y=0;y<r.length;++y){var b=r[y];d.skipNulls&&null===n[b]||l(h,f(n[b],b,g,m,d.strictNullHandling,d.skipNulls,d.encode?d.encoder:null,d.filter,d.sort,d.allowDots,d.serializeDate,d.format,d.formatter,d.encodeValuesOnly,d.charset,v))}var w=h.join(d.delimiter),S=!0===d.addQueryPrefix?"?":"";return d.charsetSentinel&&("iso-8859-1"===d.charset?S+="utf8=%26%2310003%3B&":S+="utf8=%E2%9C%93&"),w.length>0?S+w:""}},function(e,t,r){"use strict";var i=r(24),n=r(160),s=r(162),o=i("%TypeError%"),a=i("%WeakMap%",!0),c=i("%Map%",!0),d=n("WeakMap.prototype.get",!0),l=n("WeakMap.prototype.set",!0),u=n("WeakMap.prototype.has",!0),h=n("Map.prototype.get",!0),p=n("Map.prototype.set",!0),g=n("Map.prototype.has",!0),f=function(e,t){for(var r,i=e;null!==(r=i.next);i=r)if(r.key===t)return i.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,i={assert:function(e){if(!i.has(e))throw new o("Side channel does not contain "+s(e))},get:function(i){if(a&&i&&("object"==typeof i||"function"==typeof i)){if(e)return d(e,i)}else if(c){if(t)return h(t,i)}else if(r)return function(e,t){var r=f(e,t);return r&&r.value}(r,i)},has:function(i){if(a&&i&&("object"==typeof i||"function"==typeof i)){if(e)return u(e,i)}else if(c){if(t)return g(t,i)}else if(r)return function(e,t){return!!f(e,t)}(r,i);return!1},set:function(i,n){a&&i&&("object"==typeof i||"function"==typeof i)?(e||(e=new a),l(e,i,n)):c?(t||(t=new c),p(t,i,n)):(r||(r={key:{},next:null}),function(e,t,r){var i=f(e,t);i?i.value=r:e.next={key:t,next:e.next,value:r}}(r,i,n))}};return i}},function(e,t,r){"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(157);e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},function(e,t,r){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},function(e,t,r){"use strict";var i="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,s=Object.prototype.toString;e.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==s.call(t))throw new TypeError(i+t);for(var r,o=n.call(arguments,1),a=function(){if(this instanceof r){var i=t.apply(this,o.concat(n.call(arguments)));return Object(i)===i?i:this}return t.apply(e,o.concat(n.call(arguments)))},c=Math.max(0,t.length-o.length),d=[],l=0;l<c;l++)d.push("$"+l);if(r=Function("binder","return function ("+d.join(",")+"){ return binder.apply(this,arguments); }")(a),t.prototype){var u=function(){};u.prototype=t.prototype,r.prototype=new u,u.prototype=null}return r}},function(e,t,r){"use strict";var i=r(25);e.exports=i.call(Function.call,Object.prototype.hasOwnProperty)},function(e,t,r){"use strict";var i=r(24),n=r(161),s=n(i("String.prototype.indexOf"));e.exports=function(e,t){var r=i(e,!!t);return"function"==typeof r&&s(e,".prototype.")>-1?n(r):r}},function(e,t,r){"use strict";var i=r(25),n=r(24),s=n("%Function.prototype.apply%"),o=n("%Function.prototype.call%"),a=n("%Reflect.apply%",!0)||i.call(o,s),c=n("%Object.getOwnPropertyDescriptor%",!0),d=n("%Object.defineProperty%",!0),l=n("%Math.max%");if(d)try{d({},"a",{value:1})}catch(e){d=null}e.exports=function(e){var t=a(i,o,arguments);if(c&&d){var r=c(t,"length");r.configurable&&d(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var u=function(){return a(i,s,arguments)};d?d(e.exports,"apply",{value:u}):e.exports.apply=u},function(e,t,r){var i="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,s=i&&n&&"function"==typeof n.get?n.get:null,o=i&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,d=a&&c&&"function"==typeof c.get?c.get:null,l=a&&Set.prototype.forEach,u="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,h="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,f=Object.prototype.toString,m=Function.prototype.toString,v=String.prototype.match,y=String.prototype.slice,b=String.prototype.replace,w=String.prototype.toUpperCase,S=String.prototype.toLowerCase,T=RegExp.prototype.test,_=Array.prototype.concat,E=Array.prototype.join,C=Array.prototype.slice,R=Math.floor,A="function"==typeof BigInt?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,P="function"==typeof Symbol&&"object"==typeof Symbol.iterator,x="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||"symbol")?Symbol.toStringTag:null,D=Object.prototype.propertyIsEnumerable,O=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function M(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||T.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var i=e<0?-R(-e):R(e);if(i!==e){var n=String(i),s=y.call(t,n.length+1);return b.call(n,r,"$&_")+"."+b.call(b.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return b.call(t,r,"$&_")}var N=r(163),$=N.custom,j=F($)?$:null;function L(e,t,r){var i="double"===(r.quoteStyle||t)?'"':"'";return i+e+i}function H(e){return b.call(String(e),/"/g,""")}function q(e){return!("[object Array]"!==V(e)||x&&"object"==typeof e&&x in e)}function U(e){return!("[object RegExp]"!==V(e)||x&&"object"==typeof e&&x in e)}function F(e){if(P)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!k)return!1;try{return k.call(e),!0}catch(e){}return!1}e.exports=function e(t,r,i,n){var a=r||{};if(G(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(G(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!G(a,"customInspect")||a.customInspect;if("boolean"!=typeof c&&"symbol"!==c)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(G(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(G(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var f=a.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return function e(t,r){if(t.length>r.maxStringLength){var i=t.length-r.maxStringLength,n="... "+i+" more character"+(i>1?"s":"");return e(y.call(t,0,r.maxStringLength),r)+n}return L(b.call(b.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,W),"single",r)}(t,a);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var w=String(t);return f?M(t,w):w}if("bigint"==typeof t){var T=String(t)+"n";return f?M(t,T):T}var R=void 0===a.depth?5:a.depth;if(void 0===i&&(i=0),i>=R&&R>0&&"object"==typeof t)return q(t)?"[Array]":"[Object]";var I=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=E.call(Array(e.indent+1)," ")}return{base:r,prev:E.call(Array(t+1),r)}}(a,i);if(void 0===n)n=[];else if(z(n,t)>=0)return"[Circular]";function $(t,r,s){if(r&&(n=C.call(n)).push(r),s){var o={depth:a.depth};return G(a,"quoteStyle")&&(o.quoteStyle=a.quoteStyle),e(t,o,i+1,n)}return e(t,a,i+1,n)}if("function"==typeof t&&!U(t)){var B=function(e){if(e.name)return e.name;var t=v.call(m.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),Q=Z(t,$);return"[Function"+(B?": "+B:" (anonymous)")+"]"+(Q.length>0?" { "+E.call(Q,", ")+" }":"")}if(F(t)){var ee=P?b.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):k.call(t);return"object"!=typeof t||P?ee:K(ee)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var te="<"+S.call(String(t.nodeName)),re=t.attributes||[],ie=0;ie<re.length;ie++)te+=" "+re[ie].name+"="+L(H(re[ie].value),"double",a);return te+=">",t.childNodes&&t.childNodes.length&&(te+="..."),te+="</"+S.call(String(t.nodeName))+">"}if(q(t)){if(0===t.length)return"[]";var ne=Z(t,$);return I&&!function(e){for(var t=0;t<e.length;t++)if(z(e[t],"\n")>=0)return!1;return!0}(ne)?"["+X(ne,I)+"]":"[ "+E.call(ne,", ")+" ]"}if(function(e){return!("[object Error]"!==V(e)||x&&"object"==typeof e&&x in e)}(t)){var se=Z(t,$);return"cause"in Error.prototype||!("cause"in t)||D.call(t,"cause")?0===se.length?"["+String(t)+"]":"{ ["+String(t)+"] "+E.call(se,", ")+" }":"{ ["+String(t)+"] "+E.call(_.call("[cause]: "+$(t.cause),se),", ")+" }"}if("object"==typeof t&&c){if(j&&"function"==typeof t[j]&&N)return N(t,{depth:R-i});if("symbol"!==c&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!s||!e||"object"!=typeof e)return!1;try{s.call(e);try{d.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var oe=[];return o.call(t,(function(e,r){oe.push($(r,t,!0)+" => "+$(e,t))})),Y("Map",s.call(t),oe,I)}if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e);try{s.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ae=[];return l.call(t,(function(e){ae.push($(e,t))})),Y("Set",d.call(t),ae,I)}if(function(e){if(!u||!e||"object"!=typeof e)return!1;try{u.call(e,u);try{h.call(e,h)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return J("WeakMap");if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{h.call(e,h);try{u.call(e,u)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return J("WeakSet");if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{return p.call(e),!0}catch(e){}return!1}(t))return J("WeakRef");if(function(e){return!("[object Number]"!==V(e)||x&&"object"==typeof e&&x in e)}(t))return K($(Number(t)));if(function(e){if(!e||"object"!=typeof e||!A)return!1;try{return A.call(e),!0}catch(e){}return!1}(t))return K($(A.call(t)));if(function(e){return!("[object Boolean]"!==V(e)||x&&"object"==typeof e&&x in e)}(t))return K(g.call(t));if(function(e){return!("[object String]"!==V(e)||x&&"object"==typeof e&&x in e)}(t))return K($(String(t)));if(!function(e){return!("[object Date]"!==V(e)||x&&"object"==typeof e&&x in e)}(t)&&!U(t)){var ce=Z(t,$),de=O?O(t)===Object.prototype:t instanceof Object||t.constructor===Object,le=t instanceof Object?"":"null prototype",ue=!de&&x&&Object(t)===t&&x in t?y.call(V(t),8,-1):le?"Object":"",he=(de||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(ue||le?"["+E.call(_.call([],ue||[],le||[]),": ")+"] ":"");return 0===ce.length?he+"{}":I?he+"{"+X(ce,I)+"}":he+"{ "+E.call(ce,", ")+" }"}return String(t)};var B=Object.prototype.hasOwnProperty||function(e){return e in this};function G(e,t){return B.call(e,t)}function V(e){return f.call(e)}function z(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}function W(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+w.call(t.toString(16))}function K(e){return"Object("+e+")"}function J(e){return e+" { ? }"}function Y(e,t,r,i){return e+" ("+t+") {"+(i?X(r,i):E.call(r,", "))+"}"}function X(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+E.call(e,","+r)+"\n"+t.prev}function Z(e,t){var r=q(e),i=[];if(r){i.length=e.length;for(var n=0;n<e.length;n++)i[n]=G(e,n)?t(e[n],e):""}var s,o="function"==typeof I?I(e):[];if(P){s={};for(var a=0;a<o.length;a++)s["$"+o[a]]=o[a]}for(var c in e)G(e,c)&&(r&&String(Number(c))===c&&c<e.length||P&&s["$"+c]instanceof Symbol||(T.call(/[^\w$]/,c)?i.push(t(c,e)+": "+t(e[c],e)):i.push(c+": "+t(e[c],e))));if("function"==typeof I)for(var d=0;d<o.length;d++)D.call(e,o[d])&&i.push("["+t(o[d])+"]: "+t(e[o[d]],e));return i}},function(e,t){},function(e,t,r){"use strict";var i=r(41),n=Object.prototype.hasOwnProperty,s=Array.isArray,o={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:i.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},d=function(e,t,r,i){if(e){var s=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(s),d=a?s.slice(0,a.index):s,l=[];if(d){if(!r.plainObjects&&n.call(Object.prototype,d)&&!r.allowPrototypes)return;l.push(d)}for(var u=0;r.depth>0&&null!==(a=o.exec(s))&&u<r.depth;){if(u+=1,!r.plainObjects&&n.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;l.push(a[1])}return a&&l.push("["+s.slice(a.index)+"]"),function(e,t,r,i){for(var n=i?t:c(t,r),s=e.length-1;s>=0;--s){var o,a=e[s];if("[]"===a&&r.parseArrays)o=[].concat(n);else{o=r.plainObjects?Object.create(null):{};var d="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,l=parseInt(d,10);r.parseArrays||""!==d?!isNaN(l)&&a!==d&&String(l)===d&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[])[l]=n:"__proto__"!==d&&(o[d]=n):o={0:n}}n=o}return n}(l,t,r,i)}};e.exports=function(e,t){var r=function(e){if(!e)return o;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?o.charset:e.charset;return{allowDots:void 0===e.allowDots?o.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:o.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:o.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:o.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:o.comma,decoder:"function"==typeof e.decoder?e.decoder:o.decoder,delimiter:"string"==typeof e.delimiter||i.isRegExp(e.delimiter)?e.delimiter:o.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:o.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:o.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:o.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:o.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function(e,t){var r,d={__proto__:null},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,u=t.parameterLimit===1/0?void 0:t.parameterLimit,h=l.split(t.delimiter,u),p=-1,g=t.charset;if(t.charsetSentinel)for(r=0;r<h.length;++r)0===h[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===h[r]?g="utf-8":"utf8=%26%2310003%3B"===h[r]&&(g="iso-8859-1"),p=r,r=h.length);for(r=0;r<h.length;++r)if(r!==p){var f,m,v=h[r],y=v.indexOf("]="),b=-1===y?v.indexOf("="):y+1;-1===b?(f=t.decoder(v,o.decoder,g,"key"),m=t.strictNullHandling?null:""):(f=t.decoder(v.slice(0,b),o.decoder,g,"key"),m=i.maybeMap(c(v.slice(b+1),t),(function(e){return t.decoder(e,o.decoder,g,"value")}))),m&&t.interpretNumericEntities&&"iso-8859-1"===g&&(m=a(m)),v.indexOf("[]=")>-1&&(m=s(m)?[m]:m),n.call(d,f)?d[f]=i.combine(d[f],m):d[f]=m}return d}(e,r):e,u=r.plainObjects?Object.create(null):{},h=Object.keys(l),p=0;p<h.length;++p){var g=h[p],f=d(g,l[g],r,"string"==typeof e);u=i.merge(u,f,r)}return!0===r.allowSparse?u:i.compact(u)}},function(e,t,r){"use strict";r.r(t),r.d(t,"name",(function(){return Ll})),r.d(t,"version",(function(){return jl})),r.d(t,"ContentTypeUnsupportedError",(function(){return h})),r.d(t,"RequestPendingError",(function(){return p})),r.d(t,"SessionDescriptionHandlerError",(function(){return g})),r.d(t,"SessionTerminatedError",(function(){return f})),r.d(t,"StateTransitionError",(function(){return m})),r.d(t,"Bye",(function(){return v})),r.d(t,"EmitterImpl",(function(){return y})),r.d(t,"Info",(function(){return b})),r.d(t,"Invitation",(function(){return te})),r.d(t,"Inviter",(function(){return re})),r.d(t,"Message",(function(){return K})),r.d(t,"Messager",(function(){return ie})),r.d(t,"Notification",(function(){return J})),r.d(t,"PublisherState",(function(){return ne})),r.d(t,"Publisher",(function(){return he})),r.d(t,"Referral",(function(){return Y})),r.d(t,"RegistererState",(function(){return se})),r.d(t,"Registerer",(function(){return pe})),r.d(t,"SessionState",(function(){return X})),r.d(t,"Session",(function(){return Q})),r.d(t,"Subscriber",(function(){return fe})),r.d(t,"SubscriptionState",(function(){return ae})),r.d(t,"Subscription",(function(){return ge})),r.d(t,"TransportState",(function(){return ce})),r.d(t,"SIPExtension",(function(){return Z})),r.d(t,"UserAgentRegisteredOptionTags",(function(){return ee})),r.d(t,"UserAgentState",(function(){return de})),r.d(t,"UserAgent",(function(){return ht})),r.d(t,"Grammar",(function(){return C})),r.d(t,"NameAddrHeader",(function(){return S})),r.d(t,"Parameters",(function(){return w})),r.d(t,"URI",(function(){return T})),r.d(t,"Core",(function(){return i})),r.d(t,"Web",(function(){return l}));var i={};r.r(i),r.d(i,"Dialog",(function(){return ke})),r.d(i,"SessionDialog",(function(){return Ke})),r.d(i,"SubscriptionDialog",(function(){return Qe})),r.d(i,"Exception",(function(){return u})),r.d(i,"TransactionStateError",(function(){return B})),r.d(i,"TransportError",(function(){return _e})),r.d(i,"Levels",(function(){return le})),r.d(i,"LoggerFactory",(function(){return ye})),r.d(i,"Logger",(function(){return ve})),r.d(i,"Grammar",(function(){return C})),r.d(i,"NameAddrHeader",(function(){return S})),r.d(i,"Parameters",(function(){return w})),r.d(i,"URI",(function(){return T})),r.d(i,"C",(function(){return z})),r.d(i,"fromBodyLegacy",(function(){return L})),r.d(i,"isBody",(function(){return H})),r.d(i,"getBody",(function(){return q})),r.d(i,"DigestAuthentication",(function(){return Se})),r.d(i,"IncomingMessage",(function(){return O})),r.d(i,"IncomingRequestMessage",(function(){return M})),r.d(i,"IncomingResponseMessage",(function(){return N})),r.d(i,"OutgoingRequestMessage",(function(){return $})),r.d(i,"constructOutgoingResponse",(function(){return Te})),r.d(i,"Parser",(function(){return ot})),r.d(i,"SessionState",(function(){return U})),r.d(i,"SignalingState",(function(){return F})),r.d(i,"SubscriptionState",(function(){return oe})),r.d(i,"ClientTransaction",(function(){return Ce})),r.d(i,"InviteClientTransaction",(function(){return Pe})),r.d(i,"InviteServerTransaction",(function(){return Ie})),r.d(i,"NonInviteClientTransaction",(function(){return Re})),r.d(i,"NonInviteServerTransaction",(function(){return Oe})),r.d(i,"ServerTransaction",(function(){return Ae})),r.d(i,"TransactionState",(function(){return ue})),r.d(i,"Transaction",(function(){return Ee})),r.d(i,"UserAgentCore",(function(){return st})),r.d(i,"ByeUserAgentClient",(function(){return De})),r.d(i,"ByeUserAgentServer",(function(){return Ne})),r.d(i,"CancelUserAgentClient",(function(){return pt})),r.d(i,"InfoUserAgentClient",(function(){return $e})),r.d(i,"InfoUserAgentServer",(function(){return je})),r.d(i,"InviteUserAgentClient",(function(){return Je})),r.d(i,"InviteUserAgentServer",(function(){return tt})),r.d(i,"MessageUserAgentClient",(function(){return Le})),r.d(i,"MessageUserAgentServer",(function(){return He})),r.d(i,"NotifyUserAgentClient",(function(){return qe})),r.d(i,"NotifyUserAgentServer",(function(){return Ue})),r.d(i,"PublishUserAgentClient",(function(){return Ye})),r.d(i,"PrackUserAgentClient",(function(){return Fe})),r.d(i,"PrackUserAgentServer",(function(){return Be})),r.d(i,"ReInviteUserAgentClient",(function(){return Ge})),r.d(i,"ReInviteUserAgentServer",(function(){return Ve})),r.d(i,"ReSubscribeUserAgentClient",(function(){return Ze})),r.d(i,"ReSubscribeUserAgentServer",(function(){return gt})),r.d(i,"ReferUserAgentClient",(function(){return ze})),r.d(i,"ReferUserAgentServer",(function(){return We})),r.d(i,"RegisterUserAgentClient",(function(){return Xe})),r.d(i,"RegisterUserAgentServer",(function(){return rt})),r.d(i,"SubscribeUserAgentClient",(function(){return et})),r.d(i,"SubscribeUserAgentServer",(function(){return it})),r.d(i,"UserAgentClient",(function(){return xe})),r.d(i,"UserAgentServer",(function(){return Me})),r.d(i,"Timers",(function(){return V}));var n={};r.r(n),r.d(n,"shimGetUserMedia",(function(){return Bt})),r.d(n,"shimGetDisplayMedia",(function(){return Gt})),r.d(n,"shimMediaStream",(function(){return Vt})),r.d(n,"shimOnTrack",(function(){return zt})),r.d(n,"shimGetSendersWithDtmf",(function(){return Wt})),r.d(n,"shimGetStats",(function(){return Kt})),r.d(n,"shimSenderReceiverGetStats",(function(){return Jt})),r.d(n,"shimAddTrackRemoveTrackWithNative",(function(){return Yt})),r.d(n,"shimAddTrackRemoveTrack",(function(){return Xt})),r.d(n,"shimPeerConnection",(function(){return Zt})),r.d(n,"fixNegotiationNeeded",(function(){return Qt}));var s={};r.r(s),r.d(s,"shimGetUserMedia",(function(){return rr})),r.d(s,"shimGetDisplayMedia",(function(){return ir})),r.d(s,"shimPeerConnection",(function(){return nr})),r.d(s,"shimReplaceTrack",(function(){return sr}));var o={};r.r(o),r.d(o,"shimGetUserMedia",(function(){return or})),r.d(o,"shimGetDisplayMedia",(function(){return ar})),r.d(o,"shimOnTrack",(function(){return cr})),r.d(o,"shimPeerConnection",(function(){return dr})),r.d(o,"shimSenderGetStats",(function(){return lr})),r.d(o,"shimReceiverGetStats",(function(){return ur})),r.d(o,"shimRemoveStream",(function(){return hr})),r.d(o,"shimRTCDataChannel",(function(){return pr})),r.d(o,"shimAddTransceiver",(function(){return gr})),r.d(o,"shimGetParameters",(function(){return fr})),r.d(o,"shimCreateOffer",(function(){return mr})),r.d(o,"shimCreateAnswer",(function(){return vr}));var a={};r.r(a),r.d(a,"shimLocalStreamsAPI",(function(){return yr})),r.d(a,"shimRemoteStreamsAPI",(function(){return br})),r.d(a,"shimCallbacksAPI",(function(){return wr})),r.d(a,"shimGetUserMedia",(function(){return Sr})),r.d(a,"shimConstraints",(function(){return Tr})),r.d(a,"shimRTCIceServerUrls",(function(){return _r})),r.d(a,"shimTrackEventTransceiver",(function(){return Er})),r.d(a,"shimCreateOfferLegacy",(function(){return Cr})),r.d(a,"shimAudioContext",(function(){return Rr}));var c={};r.r(c),r.d(c,"shimRTCIceCandidate",(function(){return kr})),r.d(c,"shimMaxMessageSize",(function(){return Pr})),r.d(c,"shimSendThrowTypeError",(function(){return xr})),r.d(c,"shimConnectionState",(function(){return Dr})),r.d(c,"removeExtmapAllowMixed",(function(){return Or})),r.d(c,"shimAddIceCandidateNullOrEmpty",(function(){return Mr}));var d={};r.r(d),r.d(d,"AudioTrackConstraints",(function(){return Nr})),r.d(d,"VideoTrackConstraints",(function(){return $r})),r.d(d,"StreamConstraints",(function(){return jr})),r.d(d,"MediaStreamFactory",(function(){return Hr})),r.d(d,"AudioSourceInfo",(function(){return At})),r.d(d,"VideoSourceInfo",(function(){return It})),r.d(d,"TrackKind",(function(){return kt})),r.d(d,"Resolution",(function(){return Pt}));var l={};r.r(l),r.d(l,"stripTcpCandidates",(function(){return mt})),r.d(l,"stripTelephoneEvent",(function(){return vt})),r.d(l,"cleanJitsiSdpImageattr",(function(){return yt})),r.d(l,"stripG722",(function(){return bt})),r.d(l,"stripRtpPayload",(function(){return wt})),r.d(l,"stripVideo",(function(){return St})),r.d(l,"addMidLines",(function(){return Tt})),r.d(l,"holdModifier",(function(){return _t})),r.d(l,"defaultMediaStreamFactory",(function(){return at})),r.d(l,"defaultPeerConnectionConfiguration",(function(){return ct})),r.d(l,"defaultSessionDescriptionHandlerFactory",(function(){return lt})),r.d(l,"SessionDescriptionHandler",(function(){return dt})),r.d(l,"SimpleUser",(function(){return Et})),r.d(l,"UnionRtc",(function(){return Jr})),r.d(l,"Transport",(function(){return ut})),r.d(l,"RtcClient",(function(){return $l}));class u extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class h extends u{constructor(e){super(e||"Unsupported content type.")}}class p extends u{constructor(e){super(e||"Request pending.")}}class g extends u{constructor(e){super(e||"Unspecified session description handler error.")}}class f extends u{constructor(){super("The session has terminated.")}}class m extends u{constructor(e){super(e||"An error occurred during state transition.")}}class v{constructor(e){this.incomingByeRequest=e}get request(){return this.incomingByeRequest.message}accept(e){return this.incomingByeRequest.accept(e),Promise.resolve()}reject(e){return this.incomingByeRequest.reject(e),Promise.resolve()}}class y{constructor(){this.listeners=new Array}addListener(e,t){const r=t=>{this.removeListener(r),e(t)};!0===(null==t?void 0:t.once)?this.listeners.push(r):this.listeners.push(e)}emit(e){this.listeners.slice().forEach(t=>t(e))}removeAllListeners(){this.listeners=[]}removeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}on(e){return this.addListener(e)}off(e){return this.removeListener(e)}once(e){return this.addListener(e,{once:!0})}}class b{constructor(e){this.incomingInfoRequest=e}get request(){return this.incomingInfoRequest.message}accept(e){return this.incomingInfoRequest.accept(e),Promise.resolve()}reject(e){return this.incomingInfoRequest.reject(e),Promise.resolve()}}class w{constructor(e){this.parameters={};for(const t in e)e.hasOwnProperty(t)&&this.setParam(t,e[t])}setParam(e,t){e&&(this.parameters[e.toLowerCase()]=null==t?null:t.toString())}getParam(e){if(e)return this.parameters[e.toLowerCase()]}hasParam(e){return!!e&&!!this.parameters.hasOwnProperty(e.toLowerCase())}deleteParam(e){if(e=e.toLowerCase(),this.parameters.hasOwnProperty(e)){const t=this.parameters[e];return delete this.parameters[e],t}}clearParams(){this.parameters={}}}class S extends w{constructor(e,t,r){super(r),this.uri=e,this._displayName=t}get friendlyName(){return this.displayName||this.uri.aor}get displayName(){return this._displayName}set displayName(e){this._displayName=e}clone(){return new S(this.uri.clone(),this._displayName,JSON.parse(JSON.stringify(this.parameters)))}toString(){let e=this.displayName||"0"===this.displayName?'"'+this.displayName+'" ':"";e+="<"+this.uri.toString()+">";for(const t in this.parameters)this.parameters.hasOwnProperty(t)&&(e+=";"+t,null!==this.parameters[t]&&(e+="="+this.parameters[t]));return e}}class T extends w{constructor(e,t,r,i,n,s){if(super(n),this.headers={},!r)throw new TypeError('missing or invalid "host" parameter');e=e||"sip";for(const e in s)s.hasOwnProperty(e)&&this.setHeader(e,s[e]);this.raw={scheme:e,user:t,host:r,port:i},this.normal={scheme:e.toLowerCase(),user:t,host:r.toLowerCase(),port:i}}get scheme(){return this.normal.scheme}set scheme(e){this.raw.scheme=e,this.normal.scheme=e.toLowerCase()}get user(){return this.normal.user}set user(e){this.normal.user=this.raw.user=e}get host(){return this.normal.host}set host(e){this.raw.host=e,this.normal.host=e.toLowerCase()}get aor(){return this.normal.user+"@"+this.normal.host}get port(){return this.normal.port}set port(e){this.normal.port=this.raw.port=e}setHeader(e,t){this.headers[this.headerize(e)]=t instanceof Array?t:[t]}getHeader(e){if(e)return this.headers[this.headerize(e)]}hasHeader(e){return!!e&&!!this.headers.hasOwnProperty(this.headerize(e))}deleteHeader(e){if(e=this.headerize(e),this.headers.hasOwnProperty(e)){const t=this.headers[e];return delete this.headers[e],t}}clearHeaders(){this.headers={}}clone(){return new T(this._raw.scheme,this._raw.user||"",this._raw.host,this._raw.port,JSON.parse(JSON.stringify(this.parameters)),JSON.parse(JSON.stringify(this.headers)))}toRaw(){return this._toString(this._raw)}toString(){return this._toString(this._normal)}get _normal(){return this.normal}get _raw(){return this.raw}_toString(e){let t=e.scheme+":";e.scheme.toLowerCase().match("^sips?$")||(t+="//"),e.user&&(t+=this.escapeUser(e.user)+"@"),t+=e.host,(e.port||0===e.port)&&(t+=":"+e.port);for(const e in this.parameters)this.parameters.hasOwnProperty(e)&&(t+=";"+e,null!==this.parameters[e]&&(t+="="+this.parameters[e]));const r=[];for(const e in this.headers)if(this.headers.hasOwnProperty(e))for(const t in this.headers[e])this.headers[e].hasOwnProperty(t)&&r.push(e+"="+this.headers[e][t]);return r.length>0&&(t+="?"+r.join("&")),t}escapeUser(e){let t;try{t=decodeURIComponent(e)}catch(e){throw e}return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")}headerize(e){const t={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),i=r.length;let n="";for(let e=0;e<i;e++)0!==e&&(n+="-"),n+=r[e].charAt(0).toUpperCase()+r[e].substring(1);return t[n]&&(n=t[n]),n}}class _ extends Error{constructor(e,t,r,i){super(),this.message=e,this.expected=t,this.found=r,this.location=i,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,_)}static buildMessage(e,t){function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function i(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+r(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+r(e))}function n(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+r(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+r(e))}function s(e){switch(e.type){case"literal":return'"'+i(e.text)+'"';case"class":const t=e.parts.map(e=>Array.isArray(e)?n(e[0])+"-"+n(e[1]):n(e));return"["+(e.inverted?"^":"")+t+"]";case"any":return"any character";case"end":return"end of input";case"other":return e.description}}return"Expected "+function(e){const t=e.map(s);let r,i;if(t.sort(),t.length>0){for(r=1,i=1;r<t.length;r++)t[r-1]!==t[r]&&(t[i]=t[r],i++);t.length=i}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+(((o=t)?'"'+i(o)+'"':"end of input")+" found.");var o}}const E=function(e,t){t=void 0!==t?t:{};const r={},i={Contact:119,Name_Addr_Header:156,Record_Route:176,Request_Response:81,SIP_URI:45,Subscription_State:186,Supported:191,Require:182,Via:194,absoluteURI:84,Call_ID:118,Content_Disposition:130,Content_Length:135,Content_Type:136,CSeq:146,displayName:122,Event:149,From:151,host:52,Max_Forwards:154,Min_SE:213,Proxy_Authenticate:157,quoted_string:40,Refer_To:178,Replaces:179,Session_Expires:210,stun_URI:217,To:192,turn_URI:223,uuid:226,WWW_Authenticate:209,challenge:158,sipfrag:230,Referred_By:231};let n=119;const s=["\r\n",m("\r\n",!1),/^[0-9]/,v([["0","9"]],!1,!1),/^[a-zA-Z]/,v([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,v([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,v([["\0","\xff"]],!1,!1),/^["]/,v(['"'],!1,!1)," ",m(" ",!1),"\t",m("\t",!1),/^[a-zA-Z0-9]/,v([["a","z"],["A","Z"],["0","9"]],!1,!1),";",m(";",!1),"/",m("/",!1),"?",m("?",!1),":",m(":",!1),"@",m("@",!1),"&",m("&",!1),"=",m("=",!1),"+",m("+",!1),"$",m("$",!1),",",m(",",!1),"-",m("-",!1),"_",m("_",!1),".",m(".",!1),"!",m("!",!1),"~",m("~",!1),"*",m("*",!1),"'",m("'",!1),"(",m("(",!1),")",m(")",!1),"%",m("%",!1),function(){return" "},function(){return":"},/^[!-~]/,v([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,v([["\x80","\uffff"]],!1,!1),/^[\x80-\xBF]/,v([["\x80","\xbf"]],!1,!1),/^[a-f]/,v([["a","f"]],!1,!1),"`",m("`",!1),"<",m("<",!1),">",m(">",!1),"\\",m("\\",!1),"[",m("[",!1),"]",m("]",!1),"{",m("{",!1),"}",m("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,v([["!","'"]],!1,!1),/^[*-[]/,v([["*","["]],!1,!1),/^[\]-~]/,v([["]","~"]],!1,!1),function(e){return e},/^[#-[]/,v([["#","["]],!1,!1),/^[\0-\t]/,v([["\0","\t"]],!1,!1),/^[\x0B-\f]/,v([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,v([["\x0e","\x7f"]],!1,!1),function(){(t=t||{data:{}}).data.uri=new T(t.data.scheme,t.data.user,t.data.host,t.data.port),delete t.data.scheme,delete t.data.user,delete t.data.host,delete t.data.host_type,delete t.data.port},function(){(t=t||{data:{}}).data.uri=new T(t.data.scheme,t.data.user,t.data.host,t.data.port,t.data.uri_params,t.data.uri_headers),delete t.data.scheme,delete t.data.user,delete t.data.host,delete t.data.host_type,delete t.data.port,delete t.data.uri_params,"SIP_URI"===t.startRule&&(t.data=t.data.uri)},"sips",m("sips",!0),"sip",m("sip",!0),function(e){(t=t||{data:{}}).data.scheme=e},function(){(t=t||{data:{}}).data.user=decodeURIComponent(g().slice(0,-1))},function(){(t=t||{data:{}}).data.password=g()},function(){return(t=t||{data:{}}).data.host=g(),t.data.host},function(){return(t=t||{data:{}}).data.host_type="domain",g()},/^[a-zA-Z0-9_\-]/,v([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,v([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return(t=t||{data:{}}).data.host_type="IPv6",g()},"::",m("::",!1),function(){return(t=t||{data:{}}).data.host_type="IPv6",g()},function(){return(t=t||{data:{}}).data.host_type="IPv4",g()},"25",m("25",!1),/^[0-5]/,v([["0","5"]],!1,!1),"2",m("2",!1),/^[0-4]/,v([["0","4"]],!1,!1),"1",m("1",!1),/^[1-9]/,v([["1","9"]],!1,!1),function(e){return t=t||{data:{}},e=parseInt(e.join("")),t.data.port=e,e},"transport=",m("transport=",!0),"udp",m("udp",!0),"tcp",m("tcp",!0),"sctp",m("sctp",!0),"tls",m("tls",!0),function(e){(t=t||{data:{}}).data.uri_params||(t.data.uri_params={}),t.data.uri_params.transport=e.toLowerCase()},"user=",m("user=",!0),"phone",m("phone",!0),"ip",m("ip",!0),function(e){(t=t||{data:{}}).data.uri_params||(t.data.uri_params={}),t.data.uri_params.user=e.toLowerCase()},"method=",m("method=",!0),function(e){(t=t||{data:{}}).data.uri_params||(t.data.uri_params={}),t.data.uri_params.method=e},"ttl=",m("ttl=",!0),function(e){(t=t||{data:{}}).data.params||(t.data.params={}),t.data.params.ttl=e},"maddr=",m("maddr=",!0),function(e){(t=t||{data:{}}).data.uri_params||(t.data.uri_params={}),t.data.uri_params.maddr=e},"lr",m("lr",!0),function(){(t=t||{data:{}}).data.uri_params||(t.data.uri_params={}),t.data.uri_params.lr=void 0},function(e,r){(t=t||{data:{}}).data.uri_params||(t.data.uri_params={}),r=null===r?void 0:r[1],t.data.uri_params[e.toLowerCase()]=r},function(e,r){e=e.join("").toLowerCase(),r=r.join(""),(t=t||{data:{}}).data.uri_headers||(t.data.uri_headers={}),t.data.uri_headers[e]?t.data.uri_headers[e].push(r):t.data.uri_headers[e]=[r]},function(){"Refer_To"===(t=t||{data:{}}).startRule&&(t.data.uri=new T(t.data.scheme,t.data.user,t.data.host,t.data.port,t.data.uri_params,t.data.uri_headers),delete t.data.scheme,delete t.data.user,delete t.data.host,delete t.data.host_type,delete t.data.port,delete t.data.uri_params)},"//",m("//",!1),function(){(t=t||{data:{}}).data.scheme=g()},m("SIP",!0),function(){(t=t||{data:{}}).data.sip_version=g()},"INVITE",m("INVITE",!1),"ACK",m("ACK",!1),"VXACH",m("VXACH",!1),"OPTIONS",m("OPTIONS",!1),"BYE",m("BYE",!1),"CANCEL",m("CANCEL",!1),"REGISTER",m("REGISTER",!1),"SUBSCRIBE",m("SUBSCRIBE",!1),"NOTIFY",m("NOTIFY",!1),"REFER",m("REFER",!1),"PUBLISH",m("PUBLISH",!1),function(){return(t=t||{data:{}}).data.method=g(),t.data.method},function(e){(t=t||{data:{}}).data.status_code=parseInt(e.join(""))},function(){(t=t||{data:{}}).data.reason_phrase=g()},function(){(t=t||{data:{}}).data=g()},function(){var e,r;for(r=(t=t||{data:{}}).data.multi_header.length,e=0;e<r;e++)if(null===t.data.multi_header[e].parsed){t.data=null;break}null!==t.data?t.data=t.data.multi_header:t.data=-1},function(){var e;(t=t||{data:{}}).data.multi_header||(t.data.multi_header=[]);try{e=new S(t.data.uri,t.data.displayName,t.data.params),delete t.data.uri,delete t.data.displayName,delete t.data.params}catch(t){e=null}t.data.multi_header.push({position:a,offset:f().start.offset,parsed:e})},function(e){'"'===(e=g().trim())[0]&&(e=e.substring(1,e.length-1)),(t=t||{data:{}}).data.displayName=e},"q",m("q",!0),function(e){(t=t||{data:{}}).data.params||(t.data.params={}),t.data.params.q=e},"expires",m("expires",!0),function(e){(t=t||{data:{}}).data.params||(t.data.params={}),t.data.params.expires=e},function(e){return parseInt(e.join(""))},"0",m("0",!1),function(){return parseFloat(g())},function(e,r){(t=t||{data:{}}).data.params||(t.data.params={}),r=null===r?void 0:r[1],t.data.params[e.toLowerCase()]=r},"render",m("render",!0),"session",m("session",!0),"icon",m("icon",!0),"alert",m("alert",!0),function(){"Content_Disposition"===(t=t||{data:{}}).startRule&&(t.data.type=g().toLowerCase())},"handling",m("handling",!0),"optional",m("optional",!0),"required",m("required",!0),function(e){(t=t||{data:{}}).data=parseInt(e.join(""))},function(){(t=t||{data:{}}).data=g()},"text",m("text",!0),"image",m("image",!0),"audio",m("audio",!0),"video",m("video",!0),"application",m("application",!0),"message",m("message",!0),"multipart",m("multipart",!0),"x-",m("x-",!0),function(e){(t=t||{data:{}}).data.value=parseInt(e.join(""))},function(e){(t=t||{data:{}}).data=e},function(e){(t=t||{data:{}}).data.event=e.toLowerCase()},function(){var e=(t=t||{data:{}}).data.tag;t.data=new S(t.data.uri,t.data.displayName,t.data.params),e&&t.data.setParam("tag",e)},"tag",m("tag",!0),function(e){(t=t||{data:{}}).data.tag=e},function(e){(t=t||{data:{}}).data=parseInt(e.join(""))},function(e){(t=t||{data:{}}).data=e},function(){(t=t||{data:{}}).data=new S(t.data.uri,t.data.displayName,t.data.params)},"digest",m("Digest",!0),"realm",m("realm",!0),function(e){(t=t||{data:{}}).data.realm=e},"domain",m("domain",!0),"nonce",m("nonce",!0),function(e){(t=t||{data:{}}).data.nonce=e},"opaque",m("opaque",!0),function(e){(t=t||{data:{}}).data.opaque=e},"stale",m("stale",!0),"true",m("true",!0),function(){(t=t||{data:{}}).data.stale=!0},"false",m("false",!0),function(){(t=t||{data:{}}).data.stale=!1},"algorithm",m("algorithm",!0),"md5",m("MD5",!0),"md5-sess",m("MD5-sess",!0),function(e){(t=t||{data:{}}).data.algorithm=e.toUpperCase()},"qop",m("qop",!0),"auth-int",m("auth-int",!0),"auth",m("auth",!0),function(e){(t=t||{data:{}}).data.qop||(t.data.qop=[]),t.data.qop.push(e.toLowerCase())},function(e){(t=t||{data:{}}).data.value=parseInt(e.join(""))},function(){var e,r;for(r=(t=t||{data:{}}).data.multi_header.length,e=0;e<r;e++)if(null===t.data.multi_header[e].parsed){t.data=null;break}null!==t.data?t.data=t.data.multi_header:t.data=-1},function(){var e;(t=t||{data:{}}).data.multi_header||(t.data.multi_header=[]);try{e=new S(t.data.uri,t.data.displayName,t.data.params),delete t.data.uri,delete t.data.displayName,delete t.data.params}catch(t){e=null}t.data.multi_header.push({position:a,offset:f().start.offset,parsed:e})},function(){(t=t||{data:{}}).data=new S(t.data.uri,t.data.displayName,t.data.params)},function(){(t=t||{data:{}}).data.replaces_from_tag&&t.data.replaces_to_tag||(t.data=-1)},function(){(t=t||{data:{}}).data={call_id:t.data}},"from-tag",m("from-tag",!0),function(e){(t=t||{data:{}}).data.replaces_from_tag=e},"to-tag",m("to-tag",!0),function(e){(t=t||{data:{}}).data.replaces_to_tag=e},"early-only",m("early-only",!0),function(){(t=t||{data:{}}).data.early_only=!0},function(e,t){return t},function(e,t){return function(e,t){return[e].concat(t)}(e,t)},function(e){"Require"===(t=t||{data:{}}).startRule&&(t.data=e||[])},function(e){(t=t||{data:{}}).data.value=parseInt(e.join(""))},"active",m("active",!0),"pending",m("pending",!0),"terminated",m("terminated",!0),function(){(t=t||{data:{}}).data.state=g()},"reason",m("reason",!0),function(e){t=t||{data:{}},void 0!==e&&(t.data.reason=e)},function(e){t=t||{data:{}},void 0!==e&&(t.data.expires=e)},"retry_after",m("retry_after",!0),function(e){t=t||{data:{}},void 0!==e&&(t.data.retry_after=e)},"deactivated",m("deactivated",!0),"probation",m("probation",!0),"rejected",m("rejected",!0),"timeout",m("timeout",!0),"giveup",m("giveup",!0),"noresource",m("noresource",!0),"invariant",m("invariant",!0),function(e){"Supported"===(t=t||{data:{}}).startRule&&(t.data=e||[])},function(){var e=(t=t||{data:{}}).data.tag;t.data=new S(t.data.uri,t.data.displayName,t.data.params),e&&t.data.setParam("tag",e)},"ttl",m("ttl",!0),function(e){(t=t||{data:{}}).data.ttl=e},"maddr",m("maddr",!0),function(e){(t=t||{data:{}}).data.maddr=e},"received",m("received",!0),function(e){(t=t||{data:{}}).data.received=e},"branch",m("branch",!0),function(e){(t=t||{data:{}}).data.branch=e},"rport",m("rport",!0),function(e){t=t||{data:{}},void 0!==e&&(t.data.rport=e.join(""))},function(e){(t=t||{data:{}}).data.protocol=e},m("UDP",!0),m("TCP",!0),m("TLS",!0),m("SCTP",!0),function(e){(t=t||{data:{}}).data.transport=e},function(){(t=t||{data:{}}).data.host=g()},function(e){(t=t||{data:{}}).data.port=parseInt(e.join(""))},function(e){return parseInt(e.join(""))},function(e){"Session_Expires"===(t=t||{data:{}}).startRule&&(t.data.deltaSeconds=e)},"refresher",m("refresher",!1),"uas",m("uas",!1),"uac",m("uac",!1),function(e){"Session_Expires"===(t=t||{data:{}}).startRule&&(t.data.refresher=e)},function(e){"Min_SE"===(t=t||{data:{}}).startRule&&(t.data=e)},"stuns",m("stuns",!0),"stun",m("stun",!0),function(e){(t=t||{data:{}}).data.scheme=e},function(e){(t=t||{data:{}}).data.host=e},"?transport=",m("?transport=",!1),"turns",m("turns",!0),"turn",m("turn",!0),function(e){(t=t||{data:{}}).data.transport=e},function(){(t=t||{data:{}}).data=g()},"Referred-By",m("Referred-By",!1),"b",m("b",!1),"cid",m("cid",!1)],o=[C('2 ""6 7!'),C('4"""5!7#'),C('4$""5!7%'),C('4&""5!7\''),C(";'.# &;("),C('4(""5!7)'),C('4*""5!7+'),C('2,""6,7-'),C('2.""6.7/'),C('40""5!71'),C('22""6273.\x89 &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),C(";).# &;,"),C('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),C('%%2X""6X7Y/5#;#/,$;#/#$+#)(#\'#("\'#&\'#/"!&,)'),C('%%$;$0#*;$&/,#; /#$+")("\'#&\'#." &"/=#$;$/�#*;$&&&#/\'$8":Z" )("\'#&\'#'),C(';.." &"'),C("%$;'.# &;(0)*;'.# &;(&/?#28\"\"6879/0$;//'$8#:[# )(#'#(\"'#&'#"),C('%%$;2/�#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("\'#&\'#0=*%$;.0#*;.&/,#;2/#$+")("\'#&\'#&/#$+")("\'#&\'#/"!&,)'),C('4\\""5!7].# &;3'),C('4^""5!7_'),C('4`""5!7a'),C(';!.) &4b""5!7c'),C('%$;).\x95 &2F""6F7G.\x89 &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/\x9e#0\x9b*;).\x95 &2F""6F7G.\x89 &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),C('%$;).\x89 &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/\x92#0\x8f*;).\x89 &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),C('2T""6T7U.\xe3 &2V""6V7W.\xd7 &2f""6f7g.\xcb &2h""6h7i.\xbf &2:""6:7;.\xb3 &2D""6D7E.\xa7 &22""6273.\x9b &28""6879.\x8f &2j""6j7k.\x83 &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;\'.# &;('),C('%$;).\u012b &2F""6F7G.\u011f &2J""6J7K.\u0113 &2L""6L7M.\u0107 &2X""6X7Y.\xfb &2P""6P7Q.\xef &2H""6H7I.\xe3 &2@""6@7A.\xd7 &2d""6d7e.\xcb &2R""6R7S.\xbf &2N""6N7O.\xb3 &2T""6T7U.\xa7 &2V""6V7W.\x9b &2f""6f7g.\x8f &2h""6h7i.\x83 &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/\u0134#0\u0131*;).\u012b &2F""6F7G.\u011f &2J""6J7K.\u0113 &2L""6L7M.\u0107 &2X""6X7Y.\xfb &2P""6P7Q.\xef &2H""6H7I.\xe3 &2@""6@7A.\xd7 &2d""6d7e.\xcb &2R""6R7S.\xbf &2N""6N7O.\xb3 &2T""6T7U.\xa7 &2V""6V7W.\x9b &2f""6f7g.\x8f &2h""6h7i.\x83 &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),C("%;//?#2P\"\"6P7Q/0$;//'$8#:t# )(#'#(\"'#&'#"),C("%;//?#24\"\"6475/0$;//'$8#:u# )(#'#(\"'#&'#"),C("%;//?#2>\"\"6>7?/0$;//'$8#:v# )(#'#(\"'#&'#"),C("%;//?#2T\"\"6T7U/0$;//'$8#:w# )(#'#(\"'#&'#"),C("%;//?#2V\"\"6V7W/0$;//'$8#:x# )(#'#(\"'#&'#"),C('%2h""6h7i/0#;//\'$8":y" )("\'#&\'#'),C('%;//6#2f""6f7g/\'$8":z" )("\'#&\'#'),C("%;//?#2D\"\"6D7E/0$;//'$8#:{# )(#'#(\"'#&'#"),C("%;//?#22\"\"6273/0$;//'$8#:|# )(#'#(\"'#&'#"),C("%;//?#28\"\"6879/0$;//'$8#:}# )(#'#(\"'#&'#"),C("%;//0#;&/'$8\":~\" )(\"'#&'#"),C("%;&/0#;//'$8\":~\" )(\"'#&'#"),C("%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#(\"'#&'#"),C('4\x7f""5!7\x80.A &4\x81""5!7\x82.5 &4\x83""5!7\x84.) &;3.# &;.'),C("%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#(\"'#&'#/\"!&,)"),C("%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/\"!&,)/1$;&/($8$:\x85$!!)($'#(#'#(\"'#&'#"),C(';..G &2L""6L7M.; &4\x86""5!7\x87./ &4\x83""5!7\x84.# &;3'),C('%2j""6j7k/J#4\x88""5!7\x89.5 &4\x8a""5!7\x8b.) &4\x8c""5!7\x8d/#$+")("\'#&\'#'),C("%;N/M#28\"\"6879/>$;O.\" &\"/0$;S/'$8$:\x8e$ )($'#(#'#(\"'#&'#"),C("%;N/d#28\"\"6879/U$;O.\" &\"/G$;S/>$;_/5$;l.\" &\"/'$8&:\x8f& )(&'#(%'#($'#(#'#(\"'#&'#"),C('%3\x90""5$7\x91.) &3\x92""5#7\x93/\' 8!:\x94!! )'),C('%;P/]#%28""6879/,#;R/#$+")("\'#&\'#." &"/6$2:""6:7;/\'$8#:\x95# )(#\'#("\'#&\'#'),C("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),C('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),C('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:\x96! )'),C('%;T/J#%28""6879/,#;^/#$+")("\'#&\'#." &"/#$+")("\'#&\'#'),C("%;U.) &;\\.# &;X/& 8!:\x97! )"),C('%$%;V/2#2J""6J7K/#$+")("\'#&\'#0<*%;V/2#2J""6J7K/#$+")("\'#&\'#&/D#;W/;$2J""6J7K." &"/\'$8#:\x98# )(#\'#("\'#&\'#'),C('$4\x99""5!7\x9a/,#0)*4\x99""5!7\x9a&&&#'),C('%4$""5!7%/?#$4\x9b""5!7\x9c0)*4\x9b""5!7\x9c&/#$+")("\'#&\'#'),C('%2l""6l7m/?#;Y/6$2n""6n7o/\'$8#:\x9d# )(#\'#("\'#&\'#'),C('%%;Z/\xb3#28""6879/\xa4$;Z/\x9b$28""6879/\x8c$;Z/\x83$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-\'#(,\'#(+\'#(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u0790 &%2\x9e""6\x9e7\x9f/\xa4#;Z/\x9b$28""6879/\x8c$;Z/\x83$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,\'#(+\'#(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u06f9 &%2\x9e""6\x9e7\x9f/\x8c#;Z/\x83$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u067a &%2\x9e""6\x9e7\x9f/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u0613 &%2\x9e""6\x9e7\x9f/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u05c4 &%2\x9e""6\x9e7\x9f/D#;Z/;$28""6879/,$;[/#$+$)($\'#(#\'#("\'#&\'#.\u058d &%2\x9e""6\x9e7\x9f/,#;[/#$+")("\'#&\'#.\u056e &%2\x9e""6\x9e7\x9f/,#;Z/#$+")("\'#&\'#.\u054f &%;Z/\x9b#2\x9e""6\x9e7\x9f/\x8c$;Z/\x83$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+\'#(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u04c7 &%;Z/\xaa#%28""6879/,#;Z/#$+")("\'#&\'#." &"/\x83$2\x9e""6\x9e7\x9f/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u0430 &%;Z/\xb9#%28""6879/,#;Z/#$+")("\'#&\'#." &"/\x92$%28""6879/,#;Z/#$+")("\'#&\'#." &"/k$2\x9e""6\x9e7\x9f/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u038a &%;Z/\xc8#%28""6879/,#;Z/#$+")("\'#&\'#." &"/\xa1$%28""6879/,#;Z/#$+")("\'#&\'#." &"/z$%28""6879/,#;Z/#$+")("\'#&\'#." &"/S$2\x9e""6\x9e7\x9f/D$;Z/;$28""6879/,$;[/#$+()((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u02d5 &%;Z/\xd7#%28""6879/,#;Z/#$+")("\'#&\'#." &"/\xb0$%28""6879/,#;Z/#$+")("\'#&\'#." &"/\x89$%28""6879/,#;Z/#$+")("\'#&\'#." &"/b$%28""6879/,#;Z/#$+")("\'#&\'#." &"/;$2\x9e""6\x9e7\x9f/,$;[/#$+\')(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u0211 &%;Z/\xfe#%28""6879/,#;Z/#$+")("\'#&\'#." &"/\xd7$%28""6879/,#;Z/#$+")("\'#&\'#." &"/\xb0$%28""6879/,#;Z/#$+")("\'#&\'#." &"/\x89$%28""6879/,#;Z/#$+")("\'#&\'#." &"/b$%28""6879/,#;Z/#$+")("\'#&\'#." &"/;$2\x9e""6\x9e7\x9f/,$;Z/#$+()((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.\u0126 &%;Z/\u011c#%28""6879/,#;Z/#$+")("\'#&\'#." &"/\xf5$%28""6879/,#;Z/#$+")("\'#&\'#." &"/\xce$%28""6879/,#;Z/#$+")("\'#&\'#." &"/\xa7$%28""6879/,#;Z/#$+")("\'#&\'#." &"/\x80$%28""6879/,#;Z/#$+")("\'#&\'#." &"/Y$%28""6879/,#;Z/#$+")("\'#&\'#." &"/2$2\x9e""6\x9e7\x9f/#$+()((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#/& 8!:\xa0! )'),C('%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($\'#(#\'#("\'#&\'#'),C("%;Z/;#28\"\"6879/,$;Z/#$+#)(#'#(\"'#&'#.# &;\\"),C("%;]/o#2J\"\"6J7K/`$;]/W$2J\"\"6J7K/H$;]/?$2J\"\"6J7K/0$;]/'$8':\xa1' )(''#(&'#(%'#($'#(#'#(\"'#&'#"),C('%2\xa2""6\xa27\xa3/2#4\xa4""5!7\xa5/#$+")("\'#&\'#.\x98 &%2\xa6""6\xa67\xa7/;#4\xa8""5!7\xa9/,$;!/#$+#)(#\'#("\'#&\'#.j &%2\xaa""6\xaa7\xab/5#;!/,$;!/#$+#)(#\'#("\'#&\'#.B &%4\xac""5!7\xad/,#;!/#$+")("\'#&\'#.# &;!'),C('%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%\'#($\'#(#\'#("\'#&\'#/\' 8!:\xae!! )'),C('$%22""6273/,#;`/#$+")("\'#&\'#0<*%22""6273/,#;`/#$+")("\'#&\'#&'),C(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),C('%3\xaf""5*7\xb0/a#3\xb1""5#7\xb2.G &3\xb3""5#7\xb4.; &3\xb5""5$7\xb6./ &3\xb7""5#7\xb8.# &;6/($8":\xb9"! )("\'#&\'#'),C('%3\xba""5%7\xbb/I#3\xbc""5%7\xbd./ &3\xbe""5"7\xbf.# &;6/($8":\xc0"! )("\'#&\'#'),C('%3\xc1""5\'7\xc2/1#;\x90/($8":\xc3"! )("\'#&\'#'),C('%3\xc4""5$7\xc5/1#;\xf0/($8":\xc6"! )("\'#&\'#'),C('%3\xc7""5&7\xc8/1#;T/($8":\xc9"! )("\'#&\'#'),C('%3\xca""5"7\xcb/N#%2>""6>7?/,#;6/#$+")("\'#&\'#." &"/\'$8":\xcc" )("\'#&\'#'),C('%;h/P#%2>""6>7?/,#;i/#$+")("\'#&\'#." &"/)$8":\xcd""! )("\'#&\'#'),C('%$;j/�#*;j&&&#/"!&,)'),C('%$;j/�#*;j&&&#/"!&,)'),C(";k.) &;+.# &;-"),C('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),C('%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("\'#&\'#0<*%2<""6<7=/,#;m/#$+")("\'#&\'#&/#$+#)(#\'#("\'#&\'#'),C('%;n/A#2>""6>7?/2$;o/)$8#:\xce#"" )(#\'#("\'#&\'#'),C("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),C("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),C('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),C(";\x91.# &;r"),C("%;\x90/G#;'/>$;s/5$;'/,$;\x84/#$+%)(%'#($'#(#'#(\"'#&'#"),C(";M.# &;t"),C("%;\x7f/E#28\"\"6879/6$;u.# &;x/'$8#:\xcf# )(#'#(\"'#&'#"),C('%;v.# &;w/J#%26""6677/,#;\x83/#$+")("\'#&\'#." &"/#$+")("\'#&\'#'),C('%2\xd0""6\xd07\xd1/:#;\x80/1$;w." &"/#$+#)(#\'#("\'#&\'#'),C('%24""6475/,#;{/#$+")("\'#&\'#'),C("%;z/3#$;y0#*;y&/#$+\")(\"'#&'#"),C(";*.) &;+.# &;-"),C(';+.\x8f &;-.\x89 &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),C('%;|/e#$%24""6475/,#;|/#$+")("\'#&\'#0<*%24""6475/,#;|/#$+")("\'#&\'#&/#$+")("\'#&\'#'),C('%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("\'#&\'#0<*%22""6273/,#;}/#$+")("\'#&\'#&/#$+")("\'#&\'#'),C("$;~0#*;~&"),C(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),C('%%;"/\x87#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("\'#&\'#/& 8!:\xd2! )'),C(";\x81.# &;\x82"),C('%%;O/2#2:""6:7;/#$+")("\'#&\'#." &"/,#;S/#$+")("\'#&\'#." &"'),C('$;+.\x83 &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/\x8c#0\x89*;+.\x83 &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),C("$;y0#*;y&"),C('%3\x92""5#7\xd3/q#24""6475/b$$;!/�#*;!&&&#/L$2J""6J7K/=$$;!/�#*;!&&&#/\'$8%:\xd4% )(%\'#($\'#(#\'#("\'#&\'#'),C('2\xd5""6\xd57\xd6'),C('2\xd7""6\xd77\xd8'),C('2\xd9""6\xd97\xda'),C('2\xdb""6\xdb7\xdc'),C('2\xdd""6\xdd7\xde'),C('2\xdf""6\xdf7\xe0'),C('2\xe1""6\xe17\xe2'),C('2\xe3""6\xe37\xe4'),C('2\xe5""6\xe57\xe6'),C('2\xe7""6\xe77\xe8'),C('2\xe9""6\xe97\xea'),C("%;\x85.Y &;\x86.S &;\x88.M &;\x89.G &;\x8a.A &;\x8b.; &;\x8c.5 &;\x8f./ &;\x8d.) &;\x8e.# &;6/& 8!:\xeb! )"),C("%;\x84/G#;'/>$;\x92/5$;'/,$;\x94/#$+%)(%'#($'#(#'#(\"'#&'#"),C("%;\x93/' 8!:\xec!! )"),C("%;!/5#;!/,$;!/#$+#)(#'#(\"'#&'#"),C("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:\xed! )"),C("%;\xb6/Y#$%;A/,#;\xb6/#$+\")(\"'#&'#06*%;A/,#;\xb6/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),C('%;9/N#%2:""6:7;/,#;9/#$+")("\'#&\'#." &"/\'$8":\xee" )("\'#&\'#'),C("%;:.c &%;\x98/Y#$%;A/,#;\x98/#$+\")(\"'#&'#06*%;A/,#;\x98/#$+\")(\"'#&'#&/#$+\")(\"'#&'#/& 8!:\xef! )"),C("%;L.# &;\x99/]#$%;B/,#;\x9b/#$+\")(\"'#&'#06*%;B/,#;\x9b/#$+\")(\"'#&'#&/'$8\":\xf0\" )(\"'#&'#"),C("%;\x9a.\" &\"/>#;@/5$;M/,$;?/#$+$)($'#(#'#(\"'#&'#"),C("%%;6/Y#$%;./,#;6/#$+\")(\"'#&'#06*%;./,#;6/#$+\")(\"'#&'#&/#$+\")(\"'#&'#.# &;H/' 8!:\xf1!! )"),C(";\x9c.) &;\x9d.# &;\xa0"),C("%3\xf2\"\"5!7\xf3/:#;</1$;\x9f/($8#:\xf4#! )(#'#(\"'#&'#"),C("%3\xf5\"\"5'7\xf6/:#;</1$;\x9e/($8#:\xf7#! )(#'#(\"'#&'#"),C("%$;!/�#*;!&&&#/' 8!:\xf8!! )"),C('%2\xf9""6\xf97\xfa/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($\'#(#\'#("\'#&\'#." &"/\'$8":\xfb" )("\'#&\'#'),C('%;6/J#%;</,#;\xa1/#$+")("\'#&\'#." &"/)$8":\xfc""! )("\'#&\'#'),C(";6.) &;T.# &;H"),C("%;\xa3/Y#$%;B/,#;\xa4/#$+\")(\"'#&'#06*%;B/,#;\xa4/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),C('%3\xfd""5&7\xfe.G &3\xff""5\'7\u0100.; &3\u0101""5$7\u0102./ &3\u0103""5%7\u0104.# &;6/& 8!:\u0105! )'),C(";\xa5.# &;\xa0"),C('%3\u0106""5(7\u0107/M#;</D$3\u0108""5(7\u0109./ &3\u010a""5(7\u010b.# &;6/#$+#)(#\'#("\'#&\'#'),C("%;6/Y#$%;A/,#;6/#$+\")(\"'#&'#06*%;A/,#;6/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),C("%$;!/�#*;!&&&#/' 8!:\u010c!! )"),C("%;\xa9/& 8!:\u010d! )"),C("%;\xaa/k#;;/b$;\xaf/Y$$%;B/,#;\xb0/#$+\")(\"'#&'#06*%;B/,#;\xb0/#$+\")(\"'#&'#&/#$+$)($'#(#'#(\"'#&'#"),C(";\xab.# &;\xac"),C('3\u010e""5$7\u010f.S &3\u0110""5%7\u0111.G &3\u0112""5%7\u0113.; &3\u0114""5%7\u0115./ &3\u0116""5+7\u0117.# &;\xad'),C('3\u0118""5\'7\u0119./ &3\u011a""5)7\u011b.# &;\xad'),C(";6.# &;\xae"),C('%3\u011c""5"7\u011d/,#;6/#$+")("\'#&\'#'),C(";\xad.# &;6"),C("%;6/5#;</,$;\xb1/#$+#)(#'#(\"'#&'#"),C(";6.# &;H"),C("%;\xb3/5#;./,$;\x90/#$+#)(#'#(\"'#&'#"),C("%$;!/�#*;!&&&#/' 8!:\u011e!! )"),C("%;\x9e/' 8!:\u011f!! )"),C('%;\xb6/^#$%;B/,#;\xa0/#$+")("\'#&\'#06*%;B/,#;\xa0/#$+")("\'#&\'#&/($8":\u0120"!!)("\'#&\'#'),C('%%;7/e#$%2J""6J7K/,#;7/#$+")("\'#&\'#0<*%2J""6J7K/,#;7/#$+")("\'#&\'#&/#$+")("\'#&\'#/"!&,)'),C("%;L.# &;\x99/]#$%;B/,#;\xb8/#$+\")(\"'#&'#06*%;B/,#;\xb8/#$+\")(\"'#&'#&/'$8\":\u0121\" )(\"'#&'#"),C(";\xb9.# &;\xa0"),C("%3\u0122\"\"5#7\u0123/:#;</1$;6/($8#:\u0124#! )(#'#(\"'#&'#"),C("%$;!/�#*;!&&&#/' 8!:\u0125!! )"),C("%;\x9e/' 8!:\u0126!! )"),C("%$;\x9a0#*;\x9a&/x#;@/o$;M/f$;?/]$$%;B/,#;\xa0/#$+\")(\"'#&'#06*%;B/,#;\xa0/#$+\")(\"'#&'#&/'$8%:\u0127% )(%'#($'#(#'#(\"'#&'#"),C(";\xbe"),C("%3\u0128\"\"5&7\u0129/k#;./b$;\xc1/Y$$%;A/,#;\xc1/#$+\")(\"'#&'#06*%;A/,#;\xc1/#$+\")(\"'#&'#&/#$+$)($'#(#'#(\"'#&'#.# &;\xbf"),C("%;6/k#;./b$;\xc0/Y$$%;A/,#;\xc0/#$+\")(\"'#&'#06*%;A/,#;\xc0/#$+\")(\"'#&'#&/#$+$)($'#(#'#(\"'#&'#"),C("%;6/;#;</2$;6.# &;H/#$+#)(#'#(\"'#&'#"),C(";\xc2.G &;\xc4.A &;\xc6.; &;\xc8.5 &;\xc9./ &;\xca.) &;\xcb.# &;\xc0"),C("%3\u012a\"\"5%7\u012b/5#;</,$;\xc3/#$+#)(#'#(\"'#&'#"),C("%;I/' 8!:\u012c!! )"),C("%3\u012d\"\"5&7\u012e/\x97#;</\x8e$;D/\x85$;\xc5/|$$%$;'/�#*;'&&&#/,#;\xc5/#$+\")(\"'#&'#0C*%$;'/�#*;'&&&#/,#;\xc5/#$+\")(\"'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#(\"'#&'#"),C(";t.# &;w"),C("%3\u012f\"\"5%7\u0130/5#;</,$;\xc7/#$+#)(#'#(\"'#&'#"),C("%;I/' 8!:\u0131!! )"),C("%3\u0132\"\"5&7\u0133/:#;</1$;I/($8#:\u0134#! )(#'#(\"'#&'#"),C('%3\u0135""5%7\u0136/]#;</T$%3\u0137""5$7\u0138/& 8!:\u0139! ).4 &%3\u013a""5%7\u013b/& 8!:\u013c! )/#$+#)(#\'#("\'#&\'#'),C('%3\u013d""5)7\u013e/R#;</I$3\u013f""5#7\u0140./ &3\u0141""5(7\u0142.# &;6/($8#:\u0143#! )(#\'#("\'#&\'#'),C('%3\u0144""5#7\u0145/\x93#;</\x8a$;D/\x81$%;\xcc/e#$%2D""6D7E/,#;\xcc/#$+")("\'#&\'#0<*%2D""6D7E/,#;\xcc/#$+")("\'#&\'#&/#$+")("\'#&\'#/,$;E/#$+%)(%\'#($\'#(#\'#("\'#&\'#'),C('%3\u0146""5(7\u0147./ &3\u0148""5$7\u0149.# &;6/\' 8!:\u014a!! )'),C("%;6/Y#$%;A/,#;6/#$+\")(\"'#&'#06*%;A/,#;6/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),C("%;\xcf/G#;./>$;\xcf/5$;./,$;\x90/#$+%)(%'#($'#(#'#(\"'#&'#"),C("%$;!/�#*;!&&&#/' 8!:\u014b!! )"),C("%;\xd1/]#$%;A/,#;\xd1/#$+\")(\"'#&'#06*%;A/,#;\xd1/#$+\")(\"'#&'#&/'$8\":\u014c\" )(\"'#&'#"),C("%;\x99/]#$%;B/,#;\xa0/#$+\")(\"'#&'#06*%;B/,#;\xa0/#$+\")(\"'#&'#&/'$8\":\u014d\" )(\"'#&'#"),C('%;L.O &;\x99.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#\'#("\'#&\'#/]#$%;B/,#;\xa0/#$+")("\'#&\'#06*%;B/,#;\xa0/#$+")("\'#&\'#&/\'$8":\u014e" )("\'#&\'#'),C("%;\xd4/]#$%;B/,#;\xd5/#$+\")(\"'#&'#06*%;B/,#;\xd5/#$+\")(\"'#&'#&/'$8\":\u014f\" )(\"'#&'#"),C("%;\x96/& 8!:\u0150! )"),C('%3\u0151""5(7\u0152/:#;</1$;6/($8#:\u0153#! )(#\'#("\'#&\'#.g &%3\u0154""5&7\u0155/:#;</1$;6/($8#:\u0156#! )(#\'#("\'#&\'#.: &%3\u0157""5*7\u0158/& 8!:\u0159! ).# &;\xa0'),C('%%;6/k#$%;A/2#;6/)$8":\u015a""$ )("\'#&\'#0<*%;A/2#;6/)$8":\u015a""$ )("\'#&\'#&/)$8":\u015b""! )("\'#&\'#." &"/\' 8!:\u015c!! )'),C("%;\xd8/Y#$%;A/,#;\xd8/#$+\")(\"'#&'#06*%;A/,#;\xd8/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),C("%;\x99/Y#$%;B/,#;\xa0/#$+\")(\"'#&'#06*%;B/,#;\xa0/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),C("%$;!/�#*;!&&&#/' 8!:\u015d!! )"),C("%;\xdb/Y#$%;B/,#;\xdc/#$+\")(\"'#&'#06*%;B/,#;\xdc/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),C('%3\u015e""5&7\u015f.; &3\u0160""5\'7\u0161./ &3\u0162""5*7\u0163.# &;6/& 8!:\u0164! )'),C("%3\u0165\"\"5&7\u0166/:#;</1$;\xdd/($8#:\u0167#! )(#'#(\"'#&'#.} &%3\xf5\"\"5'7\xf6/:#;</1$;\x9e/($8#:\u0168#! )(#'#(\"'#&'#.P &%3\u0169\"\"5+7\u016a/:#;</1$;\x9e/($8#:\u016b#! )(#'#(\"'#&'#.# &;\xa0"),C('3\u016c""5+7\u016d.k &3\u016e""5)7\u016f._ &3\u0170""5(7\u0171.S &3\u0172""5\'7\u0173.G &3\u0174""5&7\u0175.; &3\u0176""5*7\u0177./ &3\u0178""5)7\u0179.# &;6'),C(';1." &"'),C('%%;6/k#$%;A/2#;6/)$8":\u015a""$ )("\'#&\'#0<*%;A/2#;6/)$8":\u015a""$ )("\'#&\'#&/)$8":\u015b""! )("\'#&\'#." &"/\' 8!:\u017a!! )'),C("%;L.# &;\x99/]#$%;B/,#;\xe1/#$+\")(\"'#&'#06*%;B/,#;\xe1/#$+\")(\"'#&'#&/'$8\":\u017b\" )(\"'#&'#"),C(";\xb9.# &;\xa0"),C("%;\xe3/Y#$%;A/,#;\xe3/#$+\")(\"'#&'#06*%;A/,#;\xe3/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),C("%;\xea/k#;./b$;\xed/Y$$%;B/,#;\xe4/#$+\")(\"'#&'#06*%;B/,#;\xe4/#$+\")(\"'#&'#&/#$+$)($'#(#'#(\"'#&'#"),C(";\xe5.; &;\xe6.5 &;\xe7./ &;\xe8.) &;\xe9.# &;\xa0"),C("%3\u017c\"\"5#7\u017d/:#;</1$;\xf0/($8#:\u017e#! )(#'#(\"'#&'#"),C("%3\u017f\"\"5%7\u0180/:#;</1$;T/($8#:\u0181#! )(#'#(\"'#&'#"),C("%3\u0182\"\"5(7\u0183/F#;</=$;\\.) &;Y.# &;X/($8#:\u0184#! )(#'#(\"'#&'#"),C("%3\u0185\"\"5&7\u0186/:#;</1$;6/($8#:\u0187#! )(#'#(\"'#&'#"),C("%3\u0188\"\"5%7\u0189/A#;</8$$;!0#*;!&/($8#:\u018a#! )(#'#(\"'#&'#"),C("%;\xeb/G#;;/>$;6/5$;;/,$;\xec/#$+%)(%'#($'#(#'#(\"'#&'#"),C('%3\x92""5#7\xd3.# &;6/\' 8!:\u018b!! )'),C('%3\xb1""5#7\u018c.G &3\xb3""5#7\u018d.; &3\xb7""5#7\u018e./ &3\xb5""5$7\u018f.# &;6/\' 8!:\u0190!! )'),C('%;\xee/D#%;C/,#;\xef/#$+")("\'#&\'#." &"/#$+")("\'#&\'#'),C("%;U.) &;\\.# &;X/& 8!:\u0191! )"),C('%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%\'#($\'#(#\'#("\'#&\'#/\' 8!:\u0192!! )'),C('%%;!/?#;!." &"/1$;!." &"/#$+#)(#\'#("\'#&\'#/\' 8!:\u0193!! )'),C(";\xbe"),C('%;\x9e/^#$%;B/,#;\xf3/#$+")("\'#&\'#06*%;B/,#;\xf3/#$+")("\'#&\'#&/($8":\u0194"!!)("\'#&\'#'),C(";\xf4.# &;\xa0"),C('%2\u0195""6\u01957\u0196/L#;</C$2\u0197""6\u01977\u0198.) &2\u0199""6\u01997\u019a/($8#:\u019b#! )(#\'#("\'#&\'#'),C('%;\x9e/^#$%;B/,#;\xa0/#$+")("\'#&\'#06*%;B/,#;\xa0/#$+")("\'#&\'#&/($8":\u019c"!!)("\'#&\'#'),C("%;6/5#;0/,$;\xf7/#$+#)(#'#(\"'#&'#"),C("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),C("$;%0#*;%&"),C("%;\xfa/;#28\"\"6879/,$;\xfb/#$+#)(#'#(\"'#&'#"),C('%3\u019d""5%7\u019e.) &3\u019f""5$7\u01a0/\' 8!:\u01a1!! )'),C('%;\xfc/J#%28""6879/,#;^/#$+")("\'#&\'#." &"/#$+")("\'#&\'#'),C("%;\\.) &;X.# &;\x82/' 8!:\u01a2!! )"),C(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),C('2L""6L7M.\x95 &2B""6B7C.\x89 &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),C('%;\u0100/b#28""6879/S$;\xfb/J$%2\u01a3""6\u01a37\u01a4/,#;\xec/#$+")("\'#&\'#." &"/#$+$)($\'#(#\'#("\'#&\'#'),C('%3\u01a5""5%7\u01a6.) &3\u01a7""5$7\u01a8/\' 8!:\u01a1!! )'),C('%3\xb1""5#7\xb2.6 &3\xb3""5#7\xb4.* &$;+0#*;+&/\' 8!:\u01a9!! )'),C("%;\u0104/\x87#2F\"\"6F7G/x$;\u0103/o$2F\"\"6F7G/`$;\u0103/W$2F\"\"6F7G/H$;\u0103/?$2F\"\"6F7G/0$;\u0105/'$8):\u01aa) )()'#(('#(''#(&'#(%'#($'#(#'#(\"'#&'#"),C("%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#(\"'#&'#"),C("%;\u0103/,#;\u0103/#$+\")(\"'#&'#"),C("%;\u0103/5#;\u0103/,$;\u0103/#$+#)(#'#(\"'#&'#"),C("%;q/T#$;m0#*;m&/D$%; /,#;\xf8/#$+\")(\"'#&'#.\" &\"/#$+#)(#'#(\"'#&'#"),C('%2\u01ab""6\u01ab7\u01ac.) &2\u01ad""6\u01ad7\u01ae/w#;0/n$;\u0108/e$$%;B/2#;\u0109.# &;\xa0/#$+")("\'#&\'#0<*%;B/2#;\u0109.# &;\xa0/#$+")("\'#&\'#&/#$+$)($\'#(#\'#("\'#&\'#'),C(";\x99.# &;L"),C("%2\u01af\"\"6\u01af7\u01b0/5#;</,$;\u010a/#$+#)(#'#(\"'#&'#"),C("%;D/S#;,/J$2:\"\"6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#(\"'#&'#")];let a=0,c=0;const d=[{line:1,column:1}];let l,u=0,h=[],p=0;if(void 0!==t.startRule){if(!(t.startRule in i))throw new Error("Can't start parsing from rule \""+t.startRule+'".');n=i[t.startRule]}function g(){return e.substring(c,a)}function f(){return b(c,a)}function m(e,t){return{type:"literal",text:e,ignoreCase:t}}function v(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function y(t){let r,i=d[t];if(i)return i;for(r=t-1;!d[r];)r--;for(i=d[r],i={line:i.line,column:i.column};r<t;)10===e.charCodeAt(r)?(i.line++,i.column=1):i.column++,r++;return d[t]=i,i}function b(e,t){const r=y(e),i=y(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:i.line,column:i.column}}}function w(e){a<u||(a>u&&(u=a,h=[]),h.push(e))}function E(e,t,r){return new _(_.buildMessage(e,t),e,t,r)}function C(e){return e.split("").map(e=>e.charCodeAt(0)-32)}if(t.data={},l=function t(i){const n=o[i];let d=0;const l=[];let u=n.length;const h=[],g=[];let f;for(;;){for(;d<u;)switch(n[d]){case 0:g.push(s[n[d+1]]),d+=2;break;case 1:g.push(void 0),d++;break;case 2:g.push(null),d++;break;case 3:g.push(r),d++;break;case 4:g.push([]),d++;break;case 5:g.push(a),d++;break;case 6:g.pop(),d++;break;case 7:a=g.pop(),d++;break;case 8:g.length-=n[d+1],d+=2;break;case 9:g.splice(-2,1),d++;break;case 10:g[g.length-2].push(g.pop()),d++;break;case 11:g.push(g.splice(g.length-n[d+1],n[d+1])),d+=2;break;case 12:g.push(e.substring(g.pop(),a)),d++;break;case 13:h.push(u),l.push(d+3+n[d+1]+n[d+2]),g[g.length-1]?(u=d+3+n[d+1],d+=3):(u=d+3+n[d+1]+n[d+2],d+=3+n[d+1]);break;case 14:h.push(u),l.push(d+3+n[d+1]+n[d+2]),g[g.length-1]===r?(u=d+3+n[d+1],d+=3):(u=d+3+n[d+1]+n[d+2],d+=3+n[d+1]);break;case 15:h.push(u),l.push(d+3+n[d+1]+n[d+2]),g[g.length-1]!==r?(u=d+3+n[d+1],d+=3):(u=d+3+n[d+1]+n[d+2],d+=3+n[d+1]);break;case 16:g[g.length-1]!==r?(h.push(u),l.push(d),u=d+2+n[d+1],d+=2):d+=2+n[d+1];break;case 17:h.push(u),l.push(d+3+n[d+1]+n[d+2]),e.length>a?(u=d+3+n[d+1],d+=3):(u=d+3+n[d+1]+n[d+2],d+=3+n[d+1]);break;case 18:h.push(u),l.push(d+4+n[d+2]+n[d+3]),e.substr(a,s[n[d+1]].length)===s[n[d+1]]?(u=d+4+n[d+2],d+=4):(u=d+4+n[d+2]+n[d+3],d+=4+n[d+2]);break;case 19:h.push(u),l.push(d+4+n[d+2]+n[d+3]),e.substr(a,s[n[d+1]].length).toLowerCase()===s[n[d+1]]?(u=d+4+n[d+2],d+=4):(u=d+4+n[d+2]+n[d+3],d+=4+n[d+2]);break;case 20:h.push(u),l.push(d+4+n[d+2]+n[d+3]),s[n[d+1]].test(e.charAt(a))?(u=d+4+n[d+2],d+=4):(u=d+4+n[d+2]+n[d+3],d+=4+n[d+2]);break;case 21:g.push(e.substr(a,n[d+1])),a+=n[d+1],d+=2;break;case 22:g.push(s[n[d+1]]),a+=s[n[d+1]].length,d+=2;break;case 23:g.push(r),0===p&&w(s[n[d+1]]),d+=2;break;case 24:c=g[g.length-1-n[d+1]],d+=2;break;case 25:c=a,d++;break;case 26:f=n.slice(d+4,d+4+n[d+3]).map((function(e){return g[g.length-1-e]})),g.splice(g.length-n[d+2],n[d+2],s[n[d+1]].apply(null,f)),d+=4+n[d+3];break;case 27:g.push(t(n[d+1])),d+=2;break;case 28:p++,d++;break;case 29:p--,d++;break;default:throw new Error("Invalid opcode: "+n[d]+".")}if(!(h.length>0))break;u=h.pop(),d=l.pop()}return g[0]}(n),l!==r&&a===e.length)return l;throw l!==r&&a<e.length&&w({type:"end"}),E(h,u<e.length?e.charAt(u):null,u<e.length?b(u,u+1):b(u,u))};var C,R;(R=C||(C={})).parse=function(e,t){const r={startRule:t};try{E(e,r)}catch(e){r.data=-1}return r.data},R.nameAddrHeaderParse=function(e){const t=R.parse(e,"Name_Addr_Header");return-1!==t?t:void 0},R.URIParse=function(e){const t=R.parse(e,"SIP_URI");return-1!==t?t:void 0};const A={100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"};function I(e,t=32){let r="";for(let i=0;i<e;i++){r+=Math.floor(Math.random()*t).toString(t)}return r}function k(e){return A[e]||""}function P(){return I(10)}function x(e){const t={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),i=r.length;let n="";for(let e=0;e<i;e++)0!==e&&(n+="-"),n+=r[e].charAt(0).toUpperCase()+r[e].substring(1);return t[n]&&(n=t[n]),n}function D(e){return encodeURIComponent(e).replace(/%[A-F\d]{2}/g,"U").length}class O{constructor(){this.headers={}}addHeader(e,t){const r={raw:t};e=x(e),this.headers[e]?this.headers[e].push(r):this.headers[e]=[r]}getHeader(e){const t=this.headers[x(e)];if(t)return t[0]?t[0].raw:void 0}getHeaders(e){const t=this.headers[x(e)],r=[];if(!t)return[];for(const e of t)r.push(e.raw);return r}hasHeader(e){return!!this.headers[x(e)]}parseHeader(e,t=0){if(e=x(e),!this.headers[e])return;if(t>=this.headers[e].length)return;const r=this.headers[e][t],i=r.raw;if(r.parsed)return r.parsed;const n=C.parse(i,e.replace(/-/g,"_"));return-1===n?void this.headers[e].splice(t,1):(r.parsed=n,n)}s(e,t=0){return this.parseHeader(e,t)}setHeader(e,t){this.headers[x(e)]=[{raw:t}]}toString(){return this.data}}class M extends O{constructor(){super()}}class N extends O{constructor(){super()}}class ${constructor(e,t,r,i,n,s,o){this.headers={},this.extraHeaders=[],this.options=$.getDefaultOptions(),n&&(this.options=Object.assign(Object.assign({},this.options),n),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),s&&s.length&&(this.extraHeaders=s.slice()),o&&(this.body={body:o.content,contentType:o.contentType}),this.method=e,this.ruri=t.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:P(),this.from=$.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.clone(),this.toTag=this.options.toTag,this.to=$.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+I(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}static getDefaultOptions(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}}static makeNameAddrHeader(e,t,r){const i={};return r&&(i.tag=r),new S(e,t,i)}getHeader(e){const t=this.headers[x(e)];if(t){if(t[0])return t[0]}else{const t=new RegExp("^\\s*"+e+"\\s*:","i");for(const e of this.extraHeaders)if(t.test(e))return e.substring(e.indexOf(":")+1).trim()}}getHeaders(e){const t=[],r=this.headers[x(e)];if(r)for(const e of r)t.push(e);else{const r=new RegExp("^\\s*"+e+"\\s*:","i");for(const e of this.extraHeaders)r.test(e)&&t.push(e.substring(e.indexOf(":")+1).trim())}return t}hasHeader(e){if(this.headers[x(e)])return!0;{const t=new RegExp("^\\s*"+e+"\\s*:","i");for(const e of this.extraHeaders)if(t.test(e))return!0}return!1}setHeader(e,t){this.headers[x(e)]=t instanceof Array?t:[t]}setViaHeader(e,t){this.options.hackViaTcp&&(t="TCP");let r="SIP/2.0/"+t;r+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(r+=";rport"),this.setHeader("via",r),this.branch=e}toString(){let e="";e+=this.method+" "+this.ruri.toRaw()+" SIP/2.0\r\n";for(const t in this.headers)if(this.headers[t])for(const r of this.headers[t])e+=t+": "+r+"\r\n";for(const t of this.extraHeaders)e+=t.trim()+"\r\n";return e+="Supported: "+this.options.optionTags.join(", ")+"\r\n",e+="User-Agent: "+this.options.userAgentString+"\r\n",this.body?"string"==typeof this.body?(e+="Content-Length: "+D(this.body)+"\r\n\r\n",e+=this.body):this.body.body&&this.body.contentType?(e+="Content-Type: "+this.body.contentType+"\r\n",e+="Content-Length: "+D(this.body.body)+"\r\n\r\n",e+=this.body.body):e+="Content-Length: 0\r\n\r\n":e+="Content-Length: 0\r\n\r\n",e}}function j(e){return"application/sdp"===e?"session":"render"}function L(e){const t="string"==typeof e?e:e.body,r="string"==typeof e?"application/sdp":e.contentType;return{contentDisposition:j(r),contentType:r,content:t}}function H(e){return!(!e||"string"!=typeof e.content||"string"!=typeof e.contentType||void 0!==e.contentDisposition)||"string"==typeof e.contentDisposition}function q(e){let t,r,i;if(e instanceof M&&e.body){const n=e.parseHeader("Content-Disposition");t=n?n.type:void 0,r=e.parseHeader("Content-Type"),i=e.body}if(e instanceof N&&e.body){const n=e.parseHeader("Content-Disposition");t=n?n.type:void 0,r=e.parseHeader("Content-Type"),i=e.body}if(e instanceof $&&e.body)if(t=e.getHeader("Content-Disposition"),r=e.getHeader("Content-Type"),"string"==typeof e.body){if(!r)throw new Error("Header content type header does not equal body content type.");i=e.body}else{if(r&&r!==e.body.contentType)throw new Error("Header content type header does not equal body content type.");r=e.body.contentType,i=e.body.body}if(H(e)&&(t=e.contentDisposition,r=e.contentType,i=e.content),i){if(r&&!t&&(t=j(r)),!t)throw new Error("Content disposition undefined.");if(!r)throw new Error("Content type undefined.");return{contentDisposition:t,contentType:r,content:i}}}var U,F;!function(e){e.Initial="Initial",e.Early="Early",e.AckWait="AckWait",e.Confirmed="Confirmed",e.Terminated="Terminated"}(U||(U={})),function(e){e.Initial="Initial",e.HaveLocalOffer="HaveLocalOffer",e.HaveRemoteOffer="HaveRemoteOffer",e.Stable="Stable",e.Closed="Closed"}(F||(F={}));class B extends u{constructor(e){super(e||"Transaction state error.")}}const G=500,V={T1:G,T2:4e3,T4:5e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,TIMER_N:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4};var z;!function(e){e.ACK="ACK",e.BYE="BYE",e.CANCEL="CANCEL",e.INFO="INFO",e.INVITE="INVITE",e.MESSAGE="MESSAGE",e.NOTIFY="NOTIFY",e.OPTIONS="OPTIONS",e.REGISTER="REGISTER",e.UPDATE="UPDATE",e.SUBSCRIBE="SUBSCRIBE",e.PUBLISH="PUBLISH",e.REFER="REFER",e.PRACK="PRACK"}(z||(z={}));const W=[z.ACK,z.BYE,z.CANCEL,z.INFO,z.INVITE,z.MESSAGE,z.NOTIFY,z.OPTIONS,z.PRACK,z.REFER,z.REGISTER,z.SUBSCRIBE];class K{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}}class J{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}}class Y{constructor(e,t){this.incomingReferRequest=e,this.session=t}get referTo(){const e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof S))throw new Error("Failed to parse Refer-To header.");return e}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){return this.referTo.uri.getHeader("replaces")}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;const t=this.referTo.uri.clone();t.clearHeaders();const r=((e=e||{}).extraHeaders||[]).slice(),i=this.replaces;i&&r.push("Replaces: "+decodeURIComponent(i));const n=this.referredBy;return n&&r.push("Referred-By: "+n),e.extraHeaders=r,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}}var X,Z;!function(e){e.Initial="Initial",e.Establishing="Establishing",e.Established="Established",e.Terminating="Terminating",e.Terminated="Terminated"}(X||(X={}));class Q{constructor(e,t={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=X.Initial,this._isRemoteAudioMuted=!1,this._isLocalAudioMuted=!1,this.delegate=t.delegate,this._stateEventEmitter=new y,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case X.Initial:case X.Establishing:break;case X.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case X.Terminating:case X.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}setisVideoCall(e){this._isVideoCall=e}getisVideoCall(){return this._isVideoCall}getisIncomingCall(){return this._isIncomingCall}setisIncomingCall(e){this._isIncomingCall=e}getRemoteNumber(){return this._remoteNumber}setRemoteNumber(e){this._remoteNumber=e}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let t="Session.bye() may only be called if established session.";switch(this.state){case X.Initial:"function"==typeof this.cancel?(t+=" However Inviter.invite() has not yet been called.",t+=" Perhaps you should have called Inviter.cancel()?"):"function"==typeof this.reject&&(t+=" However Invitation.accept() has not yet been called.",t+=" Perhaps you should have called Invitation.reject()?");break;case X.Establishing:"function"==typeof this.cancel?(t+=" However a dialog does not yet exist.",t+=" Perhaps you should have called Inviter.cancel()?"):"function"==typeof this.reject&&(t+=" However Invitation.accept() has not yet been called (or not yet resolved).",t+=" Perhaps you should have called Invitation.reject()?");break;case X.Established:{const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._bye(t,r)}case X.Terminating:t+=" However this session is already terminating.","function"==typeof this.cancel?t+=" Perhaps you have already called Inviter.cancel()?":"function"==typeof this.reject&&(t+=" Perhaps you have already called Session.bye()?");break;case X.Terminated:t+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(t),Promise.reject(new Error("Invalid session state "+this.state))}info(e={}){if(this.state!==X.Established){const e="Session.info() may only be called if established session.";return this.logger.error(e),Promise.reject(new Error("Invalid session state "+this.state))}const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._info(t,r)}invite(e={}){if(this.logger.log("Session.invite"),this.state!==X.Established)return Promise.reject(new Error("Invalid session state "+this.state));if(this.pendingReinvite)return Promise.reject(new p("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);const t={onAccept:t=>{const r=q(t.message);if(!r)return this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(t,400,"Missing session description"),this.stateTransition(X.Terminated),void(this.pendingReinvite=!1);if(e.withoutSdp){const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(r,i).then(e=>{t.ack({body:e})}).catch(e=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(e.message),this.state===X.Terminated?t.ack():(this.ackAndBye(t,488,"Bad Media Description"),this.stateTransition(X.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})}else{const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(r,i).then(()=>{t.ack()}).catch(e=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(e.message),this.state!==X.Terminated?(this.ackAndBye(t,488,"Bad Media Description"),this.stateTransition(X.Terminated)):t.ack()}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})}},onProgress:e=>{},onRedirect:e=>{},onReject:t=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t):this.rollbackOffer().catch(e=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(e.message),this.state!==X.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const e=[];e.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:e}),this.stateTransition(X.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)})},onTrying:e=>{}},r=e.requestOptions||{};if(r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Allow: "+W.toString()),r.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(t,r))}const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(i).then(e=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return r.body=e,this.dialog.invite(t,r)}).catch(e=>{throw this.logger.error(e.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,e})}message(e={}){if(this.state!==X.Established){const e="Session.message() may only be called if established session.";return this.logger.error(e),Promise.reject(new Error("Invalid session state "+this.state))}const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._message(t,r)}refer(e,t={}){if(this.state!==X.Established){const e="Session.refer() may only be called if established session.";return this.logger.error(e),Promise.reject(new Error("Invalid session state "+this.state))}const r=t.requestDelegate,i=this.copyRequestOptions(t.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(t.onNotify,r,i)}_bye(e,t){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const r=this.dialog;switch(r.sessionState){case U.Initial:case U.Early:throw new Error("Invalid dialog state "+r.sessionState);case U.AckWait:return this.stateTransition(X.Terminating),new Promise(i=>{r.delegate={onAck:()=>{const n=r.bye(e,t);return this.stateTransition(X.Terminated),i(n),Promise.resolve()},onAckTimeout:()=>{const n=r.bye(e,t);this.stateTransition(X.Terminated),i(n)}}});case U.Confirmed:{const i=r.bye(e,t);return this.stateTransition(X.Terminated),Promise.resolve(i)}case U.Terminated:throw new Error("Invalid dialog state "+r.sessionState);default:throw new Error("Unrecognized state.")}}_info(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(new Error("Session dialog undefined."))}_message(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(new Error("Session dialog undefined."))}_refer(e,t,r){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,r))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(e,t,r){e.ack();const i=[];t&&i.push("Reason: "+this.getReasonHeaderValue(t,r)),e.session.bye(void 0,{extraHeaders:i})}onAckRequest(e){if(this.logger.log("Session.onAckRequest"),this.state!==X.Established&&this.state!==X.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const t=this.dialog;if(!t)throw new Error("Dialog undefined.");const r={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};switch(this.pendingReinviteAck=!1,t.signalingState){case F.Initial:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const e=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(X.Terminated),Promise.resolve()}case F.Stable:{const i=q(e.message);return i?"render"===i.contentDisposition?(this._renderbody=i.content,this._rendertype=i.contentType,Promise.resolve()):"session"!==i.contentDisposition?Promise.resolve():this.setAnswer(i,r).catch(e=>{this.logger.error(e.message);const r=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];t.bye(void 0,{extraHeaders:r}),this.stateTransition(X.Terminated)}):Promise.resolve()}case F.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const e=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(X.Terminated),Promise.resolve()}case F.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const e=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(X.Terminated),Promise.resolve()}case F.Closed:default:throw new Error(`Invalid signaling state ${t.signalingState}.`)}}onByeRequest(e){if(this.logger.log("Session.onByeRequest"),this.state===X.Established){if(this.delegate&&this.delegate.onBye){const t=new v(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(X.Terminated)}else this.logger.error(`BYE received while in state ${this.state}, dropping request`)}onInfoRequest(e){if(this.logger.log("Session.onInfoRequest"),this.state!==X.Established&&this.logger.error(`INFO received while in state ${this.state}, dropping request`),this.delegate&&this.delegate.onInfo){const t=new b(e);this.delegate.onInfo(t)}else e.accept()}onInviteRequest(e){if(this.logger.log("Session.onInviteRequest"),this.state!==X.Established)return void this.logger.error(`INVITE received while in state ${this.state}, dropping request`);this.pendingReinviteAck=!0;const t=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){const t=e.message.getHeader("P-Asserted-Identity");if(!t)throw new Error("Header undefined.");this._assertedIdentity=C.nameAddrHeaderParse(t)}const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(r).then(r=>{const i=e.accept({statusCode:200,extraHeaders:t,body:r});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,i.message,200)}).catch(r=>{if(this.logger.error(r.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState!==F.Stable)this.rollbackOffer().then(()=>{const t=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,t.message,488)}).catch(r=>{this.logger.error(r.message),this.logger.error("Failed to rollback offer on re-INVITE request");const i=e.reject({statusCode:488});if(this.state!==X.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");[].push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:t}),this.stateTransition(X.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,i.message,488)});else{const t=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,t.message,488)}})}onMessageRequest(e){if(this.logger.log("Session.onMessageRequest"),this.state===X.Established)if(this.delegate&&this.delegate.onMessage){const t=new K(e);this.delegate.onMessage(t)}else e.accept();else this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`)}onNotifyRequest(e){if(this.logger.log("Session.onNotifyRequest"),this.state===X.Established)if(this.onNotify){const t=new J(e);this.onNotify(t)}else if(this.delegate&&this.delegate.onNotify){const t=new J(e);this.delegate.onNotify(t)}else e.accept();else this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`)}onPrackRequest(e){if(this.logger.log("Session.onPrackRequest"),this.state===X.Established)throw new Error("Unimplemented.");this.logger.error(`PRACK received while in state ${this.state}, dropping request`)}onReferRequest(e){if(this.logger.log("Session.onReferRequest"),this.state!==X.Established)return void this.logger.error(`REFER received while in state ${this.state}, dropping request`);if(!e.message.hasHeader("refer-to"))return this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),void e.reject();const t=new Y(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),t.accept().then(()=>t.makeInviter(this._referralInviterOptions).invite()).catch(e=>{this.logger.error(e.message)}))}generateResponseOfferAnswer(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);const r=q(e.message);return r&&"session"===r.contentDisposition?this.setOfferAndGetAnswer(r,t):this.getOffer(t)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case F.Initial:return this.getOffer(e);case F.HaveLocalOffer:return Promise.resolve(void 0);case F.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case F.Stable:return this.state!==X.Established?Promise.resolve(void 0):this.getOffer(e);case F.Closed:default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){const t=this.setupSessionDescriptionHandler(),r=e.sessionDescriptionHandlerOptions,i=e.sessionDescriptionHandlerModifiers;try{return t.getDescription(r,i).then(e=>L(e)).catch(e=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const t=e instanceof Error?e:new Error("Session.getOffer unknown error.");throw this.logger.error(t.message),t})}catch(e){this.logger.error("Session.getOffer: SDH getDescription threw...");const t=e instanceof Error?e:new Error(e);return this.logger.error(t.message),Promise.reject(t)}}rollbackOffer(){const e=this.setupSessionDescriptionHandler();if(void 0===e.rollbackDescription)return Promise.resolve();try{return e.rollbackDescription().catch(e=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const t=e instanceof Error?e:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(t.message),t})}catch(e){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const t=e instanceof Error?e:new Error(e);return this.logger.error(t.message),Promise.reject(t)}}setAnswer(e,t){const r=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new h)}catch(e){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const t=e instanceof Error?e:new Error(e);return this.logger.error(t.message),Promise.reject(t)}try{return r.setDescription(e.content,i,n).catch(e=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const t=e instanceof Error?e:new Error("Session.setAnswer unknown error.");throw this.logger.error(t.message),t})}catch(e){this.logger.error("Session.setAnswer: SDH setDescription threw...");const t=e instanceof Error?e:new Error(e);return this.logger.error(t.message),Promise.reject(t)}}setOfferAndGetAnswer(e,t){const r=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new h)}catch(e){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const t=e instanceof Error?e:new Error(e);return this.logger.error(t.message),Promise.reject(t)}try{return r.setDescription(e.content,i,n).then(()=>r.getDescription(i,n)).then(e=>L(e)).catch(e=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const t=e instanceof Error?e:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(t.message),t})}catch(e){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const t=e instanceof Error?e:new Error(e);return this.logger.error(t.message),Promise.reject(t)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){var e;return this._sessionDescriptionHandler||(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),(null===(e=this.delegate)||void 0===e?void 0:e.onSessionDescriptionHandler)&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1)),this._sessionDescriptionHandler}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case X.Initial:e!==X.Establishing&&e!==X.Established&&e!==X.Terminating&&e!==X.Terminated&&t();break;case X.Establishing:e!==X.Established&&e!==X.Terminating&&e!==X.Terminated&&t();break;case X.Established:e!==X.Terminating&&e!==X.Terminated&&t();break;case X.Terminating:e!==X.Terminated&&t();break;case X.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===X.Terminated&&this.dispose()}copyRequestOptions(e={}){return{extraHeaders:e.extraHeaders?e.extraHeaders.slice():void 0,body:e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0}}getReasonHeaderValue(e,t){const r=e;let i=k(e);return!i&&t&&(i=t),"SIP;cause="+r+';text="'+i+'"'}referExtraHeaders(e){const t=[];return t.push("Referred-By: <"+this.userAgent.configuration.uri+">"),t.push("Contact: "+this._contact),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),t.push("Refer-To: "+e),t}referToString(e){let t;if(e instanceof T)t=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");const r=e.remoteIdentity.friendlyName,i=e.dialog.remoteTarget.toString(),n=e.dialog.callId,s=e.dialog.remoteTag,o=e.dialog.localTag;t=`"${r}" <${i}?Replaces=${encodeURIComponent(`${n};to-tag=${s};from-tag=${o}`)}>`}return t}}!function(e){e.Required="Required",e.Supported="Supported",e.Unsupported="Unsupported"}(Z||(Z={}));const ee={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};class te extends Q{constructor(e,t){super(e),this.incomingInviteRequest=t,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(1e4*Math.random()),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.isVideoCall=!1,this.invitation="",this.members="",this.logger=e.getLogger("UnionRtc.Invitation");const r=this.incomingInviteRequest.message,i=r.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(this.rel100="required");const n=r.getHeader("supported");n&&n.toLowerCase().includes("100rel")&&(this.rel100="supported");const s=r.getHeader("Alert-Info");s?(s.toLowerCase().includes("auto-answer=yes")?this.callType=1:s.toLowerCase().includes("soscall=yes")?this.callType=2:this.callType=0,(s.toLowerCase().includes("audioconference")||s.toLowerCase().includes("audiobroadcast"))&&(this.invitation=s.split("#")[2].split("=")[1].replace(">",""))):this.callType=0;const o=r.getHeader("Call-Info");if(o&&o.toLowerCase().includes("members")&&(this.members=o.split("=")[1].replace(">","")),-1!=r.body.search("video")&&(this.isVideoCall=!0),r.toTag=t.toTag,"string"!=typeof r.toTag)throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{t.reject({statusCode:480}),this.stateTransition(X.Terminated)},this.userAgent.configuration.noAnswerTimeout?1e3*this.userAgent.configuration.noAnswerTimeout:6e4),r.hasHeader("expires")){const e=1e3*Number(r.getHeader("expires")||0);this.expiresTimer=setTimeout(()=>{this.state===X.Initial&&(t.reject({statusCode:487}),this.stateTransition(X.Terminated))},e)}const a=this.request.getHeader("P-Asserted-Identity");a&&(this._assertedIdentity=C.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();const c=r.parseHeader("Content-Disposition");c&&"render"===c.type&&(this._renderbody=r.body,this._rendertype=r.getHeader("Content-Type")),this._id=r.callId+r.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case X.Initial:case X.Establishing:return this.reject().then(()=>super.dispose());case X.Established:case X.Terminating:case X.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return"required"!==this.rel100}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log("Invitation.accept"),this.state!==X.Initial){const e=new Error("Invalid session state "+this.state);return this.logger.error(e.message),Promise.reject(e)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(X.Establishing),this.sendAccept().then(({message:e,session:t})=>{t.delegate={onAck:e=>this.onAckRequest(e),onAckTimeout:()=>this.onAckTimeout(),onBye:e=>this.onByeRequest(e),onInfo:e=>this.onInfoRequest(e),onInvite:e=>this.onInviteRequest(e),onMessage:e=>this.onMessageRequest(e),onNotify:e=>this.onNotifyRequest(e),onPrack:e=>this.onPrackRequest(e),onRefer:e=>this.onReferRequest(e)},this._dialog=t,this.stateTransition(X.Established),this._replacee&&this._replacee._bye()}).catch(e=>this.handleResponseError(e))}progress(e={}){if(this.logger.log("Invitation.progress"),this.state!==X.Initial){const e=new Error("Invalid session state "+this.state);return this.logger.error(e.message),Promise.reject(e)}const t=e.statusCode||180;if(t<100||t>199)throw new TypeError("Invalid statusCode: "+t);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):100===e.statusCode?this.sendProgressTrying().then(()=>{}).catch(e=>this.handleResponseError(e)):"required"===this.rel100||"supported"===this.rel100&&e.rel100||"supported"===this.rel100&&this.userAgent.configuration.sipExtension100rel===Z.Required?this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(e=>this.handleResponseError(e)):this.sendProgress(e).then(()=>{}).catch(e=>this.handleResponseError(e))}reject(e={}){if(this.logger.log("Invitation.reject"),this.state!==X.Initial&&this.state!==X.Establishing){const e=new Error("Invalid session state "+this.state);return this.logger.error(e.message),Promise.reject(e)}const t=e.statusCode||480,r=e.reasonPhrase?e.reasonPhrase:k(t),i=e.extraHeaders||[];if(t<300||t>699)throw new TypeError("Invalid statusCode: "+t);const n=e.body?L(e.body):void 0;return t<400?this.incomingInviteRequest.redirect([],{statusCode:t,reasonPhrase:r,extraHeaders:i,body:n}):this.incomingInviteRequest.reject({statusCode:t,reasonPhrase:r,extraHeaders:i,body:n}),this.stateTransition(X.Terminated),Promise.resolve()}_onCancel(e){this.logger.log("Invitation._onCancel"),this.state===X.Initial||this.state===X.Establishing?(this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(X.Terminated)):this.logger.error(`CANCEL received while in state ${this.state}, dropping request`)}handlePrackOfferAnswer(e){if(!this.dialog)throw new Error("Dialog undefined.");const t=q(e.message);if(!t||"session"!==t.contentDisposition)return Promise.resolve(void 0);const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case F.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case F.Stable:return this.setAnswer(t,r).then(()=>{});case F.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case F.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,r);case F.Closed:default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof h?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),t=415):e instanceof g?this.logger.error("A session description handler occurred while sending response"):e instanceof f?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof B&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===X.Initial||this.state===X.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(X.Terminated)}catch(e){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),e}if(!this.isCanceled)throw e;this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.")}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(X.Terminated)}sendAccept(){const e={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,e)).then(e=>this.incomingInviteRequest.accept({statusCode:200,body:e})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,e).then(e=>this.incomingInviteRequest.accept({statusCode:200,body:e})))}sendProgress(e={}){const t=e.statusCode||180,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice(),n=e.body?L(e.body):void 0;if(183===t&&!n)return this.sendProgressWithSDP(e);try{const e=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:r,extraHeaders:i,body:n});return this._dialog=e.session,Promise.resolve(e)}catch(e){return Promise.reject(e)}}sendProgressWithSDP(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(e=>this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:e})).then(e=>(this._dialog=e.session,e))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(1e4*Math.random())),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();let s;return n.push("Require: 100rel"),n.push("RSeq: "+this.rseq++),new Promise((e,o)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(e=>(s=e,this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:s}))).then(t=>{let a,c;this._dialog=t.session,t.session.delegate={onPrack:r=>{a=r,clearTimeout(d),clearTimeout(h),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(a).then(r=>{try{c=a.accept({statusCode:200,body:r}),this.prackArrived(),e({prackRequest:a,prackResponse:c,progressResponse:t})}catch(e){o(e)}}).catch(e=>o(e)))}};const d=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(h),this.reject({statusCode:504}).then(()=>o(new f)).catch(e=>o(e)))},64*V.T1),l=()=>{try{this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:s})}catch(e){return this.waitingForPrack=!1,void o(e)}h=setTimeout(l,u*=2)};let u=V.T1,h=setTimeout(l,u)}).catch(e=>{this.waitingForPrack=!1,o(e)})})}sendProgressTrying(){try{const e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((e,t)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=t}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new f),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}}class re extends Q{constructor(e,t,r={}){super(e,r),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger("UnionRtc.Inviter"),this.earlyMedia=void 0!==r.earlyMedia?r.earlyMedia:this.earlyMedia,this.fromTag=P(),this.inviteWithoutSdp=void 0!==r.inviteWithoutSdp?r.inviteWithoutSdp:this.inviteWithoutSdp;const i=Object.assign({},r);i.params=Object.assign({},r.params);const n=r.anonymous||!1,s=e.contact.toString({anonymous:n,outbound:n?!e.contact.tempGruu:!e.contact.pubGruu});n&&e.configuration.uri&&(i.params.fromDisplayName="Anonymous",i.params.fromUri="sip:anonymous@anonymous.invalid");let o=e.userAgentCore.configuration.aor;if(i.params.fromUri&&(o="string"==typeof i.params.fromUri?C.URIParse(i.params.fromUri):i.params.fromUri),!o)throw new TypeError("Invalid from URI: "+i.params.fromUri);let a=t;if(i.params.toUri&&(a="string"==typeof i.params.toUri?C.URIParse(i.params.toUri):i.params.toUri),!a)throw new TypeError("Invalid to URI: "+i.params.toUri);const c=Object.assign({},i.params);c.fromTag=this.fromTag;const d=(i.extraHeaders||[]).slice();n&&e.configuration.uri&&(d.push("P-Preferred-Identity: "+e.configuration.uri.toString()),d.push("Privacy: id")),d.push("Contact: "+s),d.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","INFO"].toString()),e.configuration.sipExtension100rel===Z.Required&&d.push("Require: 100rel"),e.configuration.sipExtensionReplaces===Z.Required&&d.push("Require: replaces"),r.pttTempInfo&&d.push("Call-Info: members="+r.pttTempInfo),r.isAudioMonitor&&d.push("Call-Info: cmd=videomonitor_autoans"),r.isVideoMonitor&&d.push("Call-Info: cmd=videomonitor_autoans"),r.conferenceMembers&&d.push("Call-Info: members="+r.conferenceMembers),r.audiobroadcastMembers&&d.push("Call-Info: members="+r.audiobroadcastMembers),i.extraHeaders=d;this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(z.INVITE,t,o,a,c,d,void 0),this._contact=s,this._referralInviterOptions=i,this._renderbody=r.renderbody,this._rendertype=r.rendertype,r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiersReInvite),r.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case X.Initial:case X.Establishing:return this.cancel().then(()=>super.dispose());case X.Established:case X.Terminating:case X.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log("Inviter.cancel"),this.state!==X.Initial&&this.state!==X.Establishing){const e=new Error("Invalid session state "+this.state);return this.logger.error(e.message),Promise.reject(e)}if(this.isCanceled=!0,this.stateTransition(X.Terminating),this.outgoingInviteRequest){let t;e.statusCode&&e.reasonPhrase&&(t=function(e,t){if(e&&e<200||e>699)throw new TypeError("Invalid statusCode: "+e);if(e){return"SIP;cause="+e+';text="'+(k(e)||t)+'"'}}(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(t,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(X.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log("Inviter.invite"),this.state!==X.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(X.Establishing),Promise.resolve(this.sendInvite(e));const t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(t).then(t=>(this.outgoingRequestMessage.body={body:t.content,contentType:t.contentType},this.stateTransition(X.Establishing),this.sendInvite(e))).catch(e=>{throw this.logger.log(e.message),this.stateTransition(X.Terminated),e})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:t=>this.dialog?(this.logger.log("Additional confirmed dialog, sending ACK and BYE"),void this.ackAndBye(t)):this.isCanceled?(this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(t),void this.stateTransition(X.Terminated)):(this.notifyReferer(t),void this.onAccept(t).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})),onProgress:t=>{this.isCanceled||(this.notifyReferer(t),this.onProgress(t).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)}))},onRedirect:t=>{this.notifyReferer(t),this.onRedirect(t),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t)},onReject:t=>{this.notifyReferer(t),this.onReject(t),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)},onTrying:t=>{this.notifyReferer(t),this.onTrying(t),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Q))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");const t=`SIP/2.0 ${e.message.statusCode} ${e.message.reasonPhrase}`.trim();this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:t}}).delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log("Inviter.onAccept"),this.state!==X.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error("Invalid session state "+this.state));const t=e.message,r=e.session;switch(t.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=C.nameAddrHeaderParse(t.getHeader("P-Asserted-Identity"))),r.delegate={onAck:e=>this.onAckRequest(e),onBye:e=>this.onByeRequest(e),onInfo:e=>this.onInfoRequest(e),onInvite:e=>this.onInviteRequest(e),onMessage:e=>this.onMessageRequest(e),onNotify:e=>this.onNotifyRequest(e),onPrack:e=>this.onPrackRequest(e),onRefer:e=>this.onReferRequest(e)},this._dialog=r,r.signalingState){case F.Initial:case F.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(X.Terminated),Promise.reject(new Error("Bad Media Description"));case F.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,t).then(t=>{e.ack({body:t}),this.stateTransition(X.Established)}).catch(t=>{throw this.ackAndBye(e,488,"Invalid session description"),this.stateTransition(X.Terminated),t})}case F.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const t=this.earlyMediaSessionDescriptionHandlers.get(r.id);if(!t)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(t),this.earlyMediaSessionDescriptionHandlers.delete(r.id),e.ack(),this.stateTransition(X.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==r){if(this.earlyMedia){const e="You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.";this.logger.error(e)}const t=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(t.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(X.Terminated),Promise.reject(t)}return e.ack(),this.stateTransition(X.Established),Promise.resolve()}const t=r.answer;if(!t)throw new Error("Answer is undefined.");const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(t,i).then(()=>{let t;this._renderbody&&this._rendertype&&(t={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),e.ack(t),this.stateTransition(X.Established)}).catch(t=>{throw this.logger.error(t.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(X.Terminated),t})}case F.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(e){var t;if(this.logger.log("Inviter.onProgress"),this.state!==X.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error("Invalid session state "+this.state));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const r=e.message,i=e.session;r.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=C.nameAddrHeaderParse(r.getHeader("P-Asserted-Identity")));const n=r.getHeader("require"),s=r.getHeader("rseq"),o=!!(n&&n.includes("100rel")&&s?Number(s):void 0),a=[];switch(o&&a.push("RAck: "+r.getHeader("rseq")+" "+r.getHeader("cseq")),i.signalingState){case F.Initial:return o&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:a})),Promise.resolve();case F.HaveLocalOffer:return o&&e.prack({extraHeaders:a}),Promise.resolve();case F.HaveRemoteOffer:if(!o)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const n=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return(null===(t=this.delegate)||void 0===t?void 0:t.onSessionDescriptionHandler)&&this.delegate.onSessionDescriptionHandler(n,!0),this.earlyMediaSessionDescriptionHandlers.set(i.id,n),n.setDescription(r.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>n.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(t=>{const r={contentDisposition:"session",contentType:t.contentType,content:t.body};e.prack({extraHeaders:a,body:r})}).catch(e=>{throw this.stateTransition(X.Terminated),e})}case F.Stable:if(o&&e.prack({extraHeaders:a}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=i;const e=i.answer;if(!e)throw new Error("Answer is undefined.");const t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(e,t).catch(e=>{throw this.stateTransition(X.Terminated),e})}return Promise.resolve();case F.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(e){this.logger.log("Inviter.onRedirect"),this.state===X.Establishing||this.state===X.Terminating?this.stateTransition(X.Terminated):this.logger.error(`Redirect received while in state ${this.state}, dropping response`)}onReject(e){this.logger.log("Inviter.onReject"),this.state===X.Establishing||this.state===X.Terminating?this.stateTransition(X.Terminated):this.logger.error(`Reject received while in state ${this.state}, dropping response`)}onTrying(e){this.logger.log("Inviter.onTrying"),this.state===X.Establishing||this.logger.error(`Trying received while in state ${this.state}, dropping response`)}}class ie{constructor(e,t,r,i="text/plain",n={}){this.logger=e.getLogger("UnionRtc.Messager"),n.params=n.params||{};let s=e.userAgentCore.configuration.aor;if(n.params.fromUri&&(s="string"==typeof n.params.fromUri?C.URIParse(n.params.fromUri):n.params.fromUri),!s)throw new TypeError("Invalid from URI: "+n.params.fromUri);let o=t;if(n.params.toUri&&(o="string"==typeof n.params.toUri?C.URIParse(n.params.toUri):n.params.toUri),!o)throw new TypeError("Invalid to URI: "+n.params.toUri);const a=n.params?Object.assign({},n.params):{},c=(n.extraHeaders||[]).slice(),d={contentDisposition:"render",contentType:i,content:r};this.request=e.userAgentCore.makeOutgoingRequestMessage(z.MESSAGE,t,s,o,a,c,d),this.userAgent=e}message(e={}){return this.userAgent.userAgentCore.request(this.request,e.requestDelegate),Promise.resolve()}}var ne,se,oe,ae,ce,de,le,ue;!function(e){e.Initial="Initial",e.Published="Published",e.Unpublished="Unpublished",e.Terminated="Terminated"}(ne||(ne={}));class he{constructor(e,t,r,i={}){this.disposed=!1,this._state=ne.Initial,this._stateEventEmitter=new y,this.userAgent=e,i.extraHeaders=(i.extraHeaders||[]).slice(),i.contentType=i.contentType||"text/plain","number"!=typeof i.expires||i.expires%1!=0?i.expires=3600:i.expires=Number(i.expires),"boolean"!=typeof i.unpublishOnClose&&(i.unpublishOnClose=!0),this.target=t,this.event=r,this.options=i,this.pubRequestExpires=i.expires,this.logger=e.getLogger("sip.Publisher");const n=i.params||{},s=n.fromUri?n.fromUri:e.userAgentCore.configuration.aor,o=n.toUri?n.toUri:t;let a;if(i.body&&i.contentType){a={contentDisposition:"render",contentType:i.contentType,content:i.body}}const c=(i.extraHeaders||[]).slice();this.request=e.userAgentCore.makeOutgoingRequestMessage(z.PUBLISH,t,s,o,n,c,a),this.id=this.target.toString()+":"+this.event,this.userAgent._publishers[this.id]=this}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Publisher ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._publishers[this.id],this.options.unpublishOnClose&&this.state===ne.Published?this.unpublish():(this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.pubRequestBody=void 0,this.pubRequestExpires=0,this.pubRequestEtag=void 0,Promise.resolve()))}get state(){return this._state}get stateChange(){return this._stateEventEmitter}publish(e,t={}){if(this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.options.body=e,this.pubRequestBody=this.options.body,0===this.pubRequestExpires){if(void 0===this.options.expires)throw new Error("Expires undefined.");this.pubRequestExpires=this.options.expires,this.pubRequestEtag=void 0}return this.sendPublishRequest(),Promise.resolve()}unpublish(e={}){return this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.pubRequestBody=void 0,this.pubRequestExpires=0,void 0!==this.pubRequestEtag&&this.sendPublishRequest(),Promise.resolve()}receiveResponse(e){const t=e.statusCode||0;switch(!0){case/^1[0-9]{2}$/.test(t.toString()):break;case/^2[0-9]{2}$/.test(t.toString()):if(e.hasHeader("SIP-ETag")?this.pubRequestEtag=e.getHeader("SIP-ETag"):this.logger.warn("SIP-ETag header missing in a 200-class response to PUBLISH"),e.hasHeader("Expires")){const t=Number(e.getHeader("Expires"));"number"==typeof t&&t>=0&&t<=this.pubRequestExpires?this.pubRequestExpires=t:this.logger.warn("Bad Expires header in a 200-class response to PUBLISH")}else this.logger.warn("Expires header missing in a 200-class response to PUBLISH");0!==this.pubRequestExpires?(this.publishRefreshTimer=setTimeout(()=>this.refreshRequest(),900*this.pubRequestExpires),this.stateTransition(ne.Published)):this.stateTransition(ne.Unpublished);break;case/^412$/.test(t.toString()):if(void 0!==this.pubRequestEtag&&0!==this.pubRequestExpires){if(this.logger.warn("412 response to PUBLISH, recovering"),this.pubRequestEtag=void 0,void 0===this.options.body)throw new Error("Body undefined.");this.publish(this.options.body)}else this.logger.warn("412 response to PUBLISH, recovery failed"),this.pubRequestExpires=0,this.stateTransition(ne.Unpublished),this.stateTransition(ne.Terminated);break;case/^423$/.test(t.toString()):if(0!==this.pubRequestExpires&&e.hasHeader("Min-Expires")){const t=Number(e.getHeader("Min-Expires"));if("number"==typeof t||t>this.pubRequestExpires){if(this.logger.warn("423 code in response to PUBLISH, adjusting the Expires value and trying to recover"),this.pubRequestExpires=t,void 0===this.options.body)throw new Error("Body undefined.");this.publish(this.options.body)}else this.logger.warn("Bad 423 response Min-Expires header received for PUBLISH"),this.pubRequestExpires=0,this.stateTransition(ne.Unpublished),this.stateTransition(ne.Terminated)}else this.logger.warn("423 response to PUBLISH, recovery failed"),this.pubRequestExpires=0,this.stateTransition(ne.Unpublished),this.stateTransition(ne.Terminated);break;default:this.pubRequestExpires=0,this.stateTransition(ne.Unpublished),this.stateTransition(ne.Terminated)}0===this.pubRequestExpires&&(this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.pubRequestBody=void 0,this.pubRequestEtag=void 0)}send(){return this.userAgent.userAgentCore.publish(this.request,{onAccept:e=>this.receiveResponse(e.message),onProgress:e=>this.receiveResponse(e.message),onRedirect:e=>this.receiveResponse(e.message),onReject:e=>this.receiveResponse(e.message),onTrying:e=>this.receiveResponse(e.message)})}refreshRequest(){if(this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.pubRequestBody=void 0,void 0===this.pubRequestEtag)throw new Error("Etag undefined");if(0===this.pubRequestExpires)throw new Error("Expires zero");this.sendPublishRequest()}sendPublishRequest(){const e=Object.assign({},this.options);e.extraHeaders=(this.options.extraHeaders||[]).slice(),e.extraHeaders.push("Event: "+this.event),e.extraHeaders.push("Expires: "+this.pubRequestExpires),void 0!==this.pubRequestEtag&&e.extraHeaders.push("SIP-If-Match: "+this.pubRequestEtag);const t=this.target,r=this.options.params||{};let i,n;if(void 0!==this.pubRequestBody){if(void 0===this.options.contentType)throw new Error("Content type undefined.");i={body:this.pubRequestBody,contentType:this.options.contentType}}return i&&(n=L(i)),this.request=this.userAgent.userAgentCore.makeOutgoingRequestMessage(z.PUBLISH,t,r.fromUri?r.fromUri:this.userAgent.userAgentCore.configuration.aor,r.toUri?r.toUri:this.target,r,e.extraHeaders,n),this.send()}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case ne.Initial:e!==ne.Published&&e!==ne.Unpublished&&e!==ne.Terminated&&t();break;case ne.Published:e!==ne.Unpublished&&e!==ne.Terminated&&t();break;case ne.Unpublished:e!==ne.Published&&e!==ne.Terminated&&t();break;case ne.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log("Publication transitioned to state "+this._state),this._stateEventEmitter.emit(this._state),e===ne.Terminated&&this.dispose()}}!function(e){e.Initial="Initial",e.Registered="Registered",e.Unregistered="Unregistered",e.Terminated="Terminated"}(se||(se={}));class pe{constructor(e,t={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=se.Initial,this._waiting=!1,this._stateEventEmitter=new y,this._waitingEventEmitter=new y,this.userAgent=e;const r=e.configuration.uri.clone();if(r.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},pe.defaultOptions()),{registrar:r}),pe.stripUndefinedProperties(t)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=pe.newUUID():!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&-1===C.parse(this.options.instanceId,"uuid"))throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const i=this.options.registrar,n=this.options.params&&this.options.params.fromUri||e.userAgentCore.configuration.aor,s=this.options.params&&this.options.params.toUri||e.configuration.uri,o=this.options.params||{},a=(t.extraHeaders||[]).slice();if(this.request=e.userAgentCore.makeOutgoingRequestMessage(z.REGISTER,i,n,s,o,a,void 0),this.expires=this.options.expires||pe.defaultExpires,this.expires<0)throw new Error("Invalid expires.");this.logger=e.getLogger("UnionRtc.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(e=>{const t=this.options[e];switch(e){case"registrar":this.logger.log("\xb7 "+e+": "+t);break;default:this.logger.log("\xb7 "+e+": "+JSON.stringify(t))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:pe.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new T("sip","anonymous","anonymous.invalid")}}static newUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.floor(16*Math.random());return("x"===e?t:t%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,r)=>(void 0!==e[r]&&(t[r]=e[r]),t),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{const t=()=>{if(!this.waiting&&this._state===se.Registered)return this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),void this.unregister();this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{t()},{once:!0}):t()}))}register(e={}){if(this.state===se.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const e=new p("REGISTER request already in progress, waiting for final response");return Promise.reject(e)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));const t=(this.options.extraHeaders||[]).slice();t.push("Contact: "+this.generateContactHeader(this.expires)),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=t,this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:t=>{let r;t.message.hasHeader("expires")&&(r=Number(t.message.getHeader("expires"))),this._contacts=t.message.getHeaders("contact");let i,n=this._contacts.length;if(!n)return this.logger.error("No Contact header in response to REGISTER, dropping response."),void this.unregistered();for(;n--;){if(i=t.message.parseHeader("contact",n),!i)throw new Error("Contact undefined");if(i.uri.user===this.userAgent.contact.uri.user){r=Number(i.getParam("expires"));break}i=void 0}if(void 0===i)return this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),void this.waitingToggle(!1);if(void 0===r)return this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),void this.waitingToggle(!1);if(i.hasParam("temp-gruu")){const e=i.getParam("temp-gruu");e&&(this.userAgent.contact.tempGruu=C.URIParse(e.replace(/"/g,"")))}if(i.hasParam("pub-gruu")){const e=i.getParam("pub-gruu");e&&(this.userAgent.contact.pubGruu=C.URIParse(e.replace(/"/g,"")))}this.registered(r),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t),this.waitingToggle(!1)},onProgress:t=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)},onRedirect:t=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t),this.waitingToggle(!1)},onReject:t=>{if(423===t.message.statusCode)return t.message.hasHeader("min-expires")?(this.expires=Number(t.message.getHeader("min-expires")),this.waitingToggle(!1),void this.register()):(this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),void this.waitingToggle(!1));this.logger.warn("Failed to register, status code "+t.message.statusCode);let r=NaN;if(500===t.message.statusCode||503===t.message.statusCode){const e=t.message.getHeader("retry-after");e&&(r=Number.parseInt(e,void 0))}this._retryAfter=isNaN(r)?void 0:r,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:t=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}});return Promise.resolve(r)}unregister(e={}){if(this.state===se.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==se.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const e=new p("REGISTER request already in progress, waiting for final response");return Promise.reject(e)}this._state===se.Registered||e.all||this.logger.warn("Not currently registered, but sending an unregister anyway.");const t=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=t,e.all?(t.push("Contact: *"),t.push("Expires: 0")):t.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),void 0!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:t=>{this._contacts=t.message.getHeaders("contact"),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t),this.waitingToggle(!1)},onProgress:t=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)},onRedirect:t=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t),this.waitingToggle(!1)},onReject:t=>{this.logger.error("Unregister rejected with status code "+t.message.statusCode),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t),this.waitingToggle(!1)},onTrying:t=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}});return Promise.resolve(r)}clearTimers(){void 0!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),void 0!==this.registrationExpiredTimer&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let t=this.userAgent.contact.toString();return this.options.regId&&this.options.instanceId&&(t+=";reg-id="+this.options.regId,t+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(e=>{t+=";"+e}),t+=";expires="+e,t}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},1e3*e-3e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},1e3*e),this._state!==se.Registered&&this.stateTransition(se.Registered)}unregistered(){this.clearTimers(),this._state!==se.Unregistered&&this.stateTransition(se.Unregistered)}terminated(){this.clearTimers(),this._state!==se.Terminated&&this.stateTransition(se.Terminated)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case se.Initial:e!==se.Registered&&e!==se.Unregistered&&e!==se.Terminated&&t();break;case se.Registered:e!==se.Unregistered&&e!==se.Terminated&&t();break;case se.Unregistered:e!==se.Registered&&e!==se.Terminated&&t();break;case se.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log("Registration transitioned to state "+this._state),this._stateEventEmitter.emit(this._state),e===se.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw new Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let e="An attempt was made to send a REGISTER request while a prior one was still in progress.";e+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",e+=" from the registrar for the previous one or the previous REGISTER request has timed out.",e+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",e+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn("An attempt was made to send a REGISTER request while a prior one was still in progress. RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response from the registrar for the previous one or the previous REGISTER request has timed out. Note that if the transport disconnects, you still must wait for the prior request to time out before sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.")}stateError(){let e=`An attempt was made to send a REGISTER request when the Registerer ${this.state===se.Terminated?"is in 'Terminated' state":"has been disposed"}.`;e+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",e+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(e)}}pe.defaultExpires=600,function(e){e.Initial="Initial",e.NotifyWait="NotifyWait",e.Pending="Pending",e.Active="Active",e.Terminated="Terminated"}(oe||(oe={})),function(e){e.Initial="Initial",e.NotifyWait="NotifyWait",e.Subscribed="Subscribed",e.Terminated="Terminated"}(ae||(ae={}));class ge{constructor(e,t={}){this._disposed=!1,this._state=ae.Initial,this._logger=e.getLogger("sip.Subscription"),this._stateEventEmitter=new y,this._userAgent=e,this.delegate=t.delegate}dispose(){return this._disposed||(this._disposed=!0,this._stateEventEmitter.removeAllListeners()),Promise.resolve()}get dialog(){return this._dialog}get disposed(){return this._disposed}get state(){return this._state}get stateChange(){return this._stateEventEmitter}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case ae.Initial:e!==ae.NotifyWait&&e!==ae.Terminated&&t();break;case ae.NotifyWait:e!==ae.Subscribed&&e!==ae.Terminated&&t();break;case ae.Subscribed:e!==ae.Terminated&&t();break;case ae.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state!==e&&(this._state=e,this._logger.log(`Subscription ${this._dialog?this._dialog.id:void 0} transitioned to ${this._state}`),this._stateEventEmitter.emit(this._state),e===ae.Terminated&&this.dispose())}}class fe extends ge{constructor(e,t,r,i={}){super(e,i),this.body=void 0,this.logger=e.getLogger("sip.Subscriber"),i.body&&(this.body={body:i.body,contentType:i.contentType?i.contentType:"application/sdp"}),this.targetURI=t,this.event=r,void 0===i.expires?this.expires=3600:"number"!=typeof i.expires?(this.logger.warn('Option "expires" must be a number. Using default of 3600.'),this.expires=3600):this.expires=i.expires,this.extraHeaders=(i.extraHeaders||[]).slice(),this.subscriberRequest=this.initSubscriberRequest(),this.outgoingRequestMessage=this.subscriberRequest.message,this.id=this.outgoingRequestMessage.callId+this.outgoingRequestMessage.from.parameters.tag+this.event,this._userAgent._subscriptions[this.id]=this}dispose(){return this.disposed?Promise.resolve():(this.logger.log(`Subscription ${this.id} in state ${this.state} is being disposed`),delete this._userAgent._subscriptions[this.id],this.retryAfterTimer&&(clearTimeout(this.retryAfterTimer),this.retryAfterTimer=void 0),this.subscriberRequest.dispose(),super.dispose().then(()=>{if(this.state===ae.Subscribed){if(!this._dialog)throw new Error("Dialog undefined.");if(this._dialog.subscriptionState===oe.Pending||this._dialog.subscriptionState===oe.Active){const e=this._dialog;return new Promise((t,r)=>{e.delegate={onTerminated:()=>t()},e.unsubscribe()})}}}))}subscribe(e={}){switch(this.subscriberRequest.state){case oe.Initial:this.state===ae.Initial&&this.stateTransition(ae.NotifyWait),this.subscriberRequest.subscribe().then(e=>{e.success?(e.success.subscription&&(this._dialog=e.success.subscription,this._dialog.delegate={onNotify:e=>this.onNotify(e),onRefresh:e=>this.onRefresh(e),onTerminated:()=>{this.state!==ae.Terminated&&this.stateTransition(ae.Terminated)}}),this.onNotify(e.success.request)):e.failure&&this.unsubscribe()});break;case oe.NotifyWait:case oe.Pending:break;case oe.Active:if(this._dialog){this._dialog.refresh().delegate={onAccept:e=>this.onAccepted(e),onRedirect:e=>this.unsubscribe(),onReject:e=>this.unsubscribe()}}break;case oe.Terminated:}return Promise.resolve()}unsubscribe(e={}){if(this.disposed)return Promise.resolve();switch(this.subscriberRequest.state){case oe.Initial:case oe.NotifyWait:break;case oe.Pending:case oe.Active:this._dialog&&this._dialog.unsubscribe();break;case oe.Terminated:break;default:throw new Error("Unknown state.")}return this.stateTransition(ae.Terminated),Promise.resolve()}_refresh(){return this.subscriberRequest.state===oe.Active?this.subscribe():Promise.resolve()}onAccepted(e){}onNotify(e){if(this.disposed)return void e.accept();if(this.state!==ae.Subscribed&&this.stateTransition(ae.Subscribed),this.delegate&&this.delegate.onNotify){const t=new J(e);this.delegate.onNotify(t)}else e.accept();const t=e.message.parseHeader("Subscription-State");if(t&&t.state)switch(t.state){case"terminated":if(t.reason)switch(this.logger.log("Terminated subscription with reason "+t.reason),t.reason){case"deactivated":case"timeout":return this.initSubscriberRequest(),void this.subscribe();case"probation":case"giveup":return this.initSubscriberRequest(),void(t.params&&t.params["retry-after"]?this.retryAfterTimer=setTimeout(()=>{this.subscribe()},t.params["retry-after"]):this.subscribe())}this.unsubscribe()}}onRefresh(e){e.delegate={onAccept:e=>this.onAccepted(e)}}initSubscriberRequest(){const e={extraHeaders:this.extraHeaders,body:this.body?L(this.body):void 0};return this.subscriberRequest=new me(this._userAgent.userAgentCore,this.targetURI,this.event,this.expires,e),this.subscriberRequest.delegate={onAccept:e=>this.onAccepted(e)},this.subscriberRequest}}class me{constructor(e,t,r,i,n,s){this.core=e,this.target=t,this.event=r,this.expires=i,this.subscribed=!1,this.logger=e.loggerFactory.getLogger("sip.Subscriber"),this.delegate=s;const o="Allow: "+W.toString(),a=(n&&n.extraHeaders||[]).slice();a.push(o),a.push("Event: "+this.event),a.push("Expires: "+this.expires),a.push("Contact: "+this.core.configuration.contact.toString());const c=n&&n.body;this.message=e.makeOutgoingRequestMessage(z.SUBSCRIBE,this.target,this.core.configuration.aor,this.target,{},a,c)}dispose(){this.request&&(this.request.waitNotifyStop(),this.request.dispose(),this.request=void 0)}get state(){return this.subscription?this.subscription.subscriptionState:this.subscribed?oe.NotifyWait:oe.Initial}subscribe(){return this.subscribed?Promise.reject(new Error("Not in initial state. Did you call subscribe more than once?")):(this.subscribed=!0,new Promise(e=>{if(!this.message)throw new Error("Message undefined.");this.request=this.core.subscribe(this.message,{onAccept:e=>{this.delegate&&this.delegate.onAccept&&this.delegate.onAccept(e)},onNotify:t=>{this.subscription=t.subscription,this.subscription&&(this.subscription.autoRefresh=!0),e({success:t})},onNotifyTimeout:()=>{e({failure:{}})},onRedirect:t=>{e({failure:{response:t}})},onReject:t=>{e({failure:{response:t}})}})}))}}!function(e){e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Disconnected="Disconnected"}(ce||(ce={})),function(e){e.Started="Started",e.Stopped="Stopped"}(de||(de={})),function(e){e[e.error=0]="error",e[e.warn=1]="warn",e[e.log=2]="log",e[e.debug=3]="debug"}(le||(le={}));class ve{constructor(e,t,r){this.logger=e,this.category=t,this.label=r}error(e){this.genericLog(le.error,e)}warn(e){this.genericLog(le.warn,e)}log(e){this.genericLog(le.log,e)}debug(e){this.genericLog(le.debug,e)}genericLog(e,t){this.logger.genericLog(e,this.category,this.label,t)}}class ye{constructor(){this.builtinEnabled=!0,this._level=le.log,this.loggers={},this.logger=this.getLogger("UnionRtc:loggerfactory")}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:le.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?"function"==typeof e?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0}getLogger(e,t){if(t&&3===this.level)return new ve(this,e,t);if(this.loggers[e])return this.loggers[e];{const t=new ve(this,e);return this.loggers[e]=t,t}}genericLog(e,t,r,i){this.builtinEnabled&&this.print(e,t,r,i),this.connector&&this.connector(le[e],t,r,i)}print(e,t,r,i){if("string"==typeof i){const e=[new Date,t];r&&e.push(r),i=e.concat(i).join(" | ")}switch(e){case le.error:console.error(i);break;case le.warn:console.warn(i);break;case le.log:console.log(i);break;case le.debug:console.debug(i)}}}class be{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){const t=be.hexChars,r=be.hexOut;let i,n,s,o;for(o=0;o<4;o+=1)for(n=8*o,i=e[o],s=0;s<8;s+=2)r[n+1+s]=t.charAt(15&i),i>>>=4,r[n+0+s]=t.charAt(15&i),i>>>=4;return r.join("")}static _md5cycle(e,t){let r=e[0],i=e[1],n=e[2],s=e[3];r+=(i&n|~i&s)+t[0]-680876936|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&n)+t[1]-389564586|0,s=(s<<12|s>>>20)+r|0,n+=(s&r|~s&i)+t[2]+606105819|0,n=(n<<17|n>>>15)+s|0,i+=(n&s|~n&r)+t[3]-1044525330|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&s)+t[4]-176418897|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&n)+t[5]+1200080426|0,s=(s<<12|s>>>20)+r|0,n+=(s&r|~s&i)+t[6]-1473231341|0,n=(n<<17|n>>>15)+s|0,i+=(n&s|~n&r)+t[7]-45705983|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&s)+t[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&n)+t[9]-1958414417|0,s=(s<<12|s>>>20)+r|0,n+=(s&r|~s&i)+t[10]-42063|0,n=(n<<17|n>>>15)+s|0,i+=(n&s|~n&r)+t[11]-1990404162|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&s)+t[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&n)+t[13]-40341101|0,s=(s<<12|s>>>20)+r|0,n+=(s&r|~s&i)+t[14]-1502002290|0,n=(n<<17|n>>>15)+s|0,i+=(n&s|~n&r)+t[15]+1236535329|0,i=(i<<22|i>>>10)+n|0,r+=(i&s|n&~s)+t[1]-165796510|0,r=(r<<5|r>>>27)+i|0,s+=(r&n|i&~n)+t[6]-1069501632|0,s=(s<<9|s>>>23)+r|0,n+=(s&i|r&~i)+t[11]+643717713|0,n=(n<<14|n>>>18)+s|0,i+=(n&r|s&~r)+t[0]-373897302|0,i=(i<<20|i>>>12)+n|0,r+=(i&s|n&~s)+t[5]-701558691|0,r=(r<<5|r>>>27)+i|0,s+=(r&n|i&~n)+t[10]+38016083|0,s=(s<<9|s>>>23)+r|0,n+=(s&i|r&~i)+t[15]-660478335|0,n=(n<<14|n>>>18)+s|0,i+=(n&r|s&~r)+t[4]-405537848|0,i=(i<<20|i>>>12)+n|0,r+=(i&s|n&~s)+t[9]+568446438|0,r=(r<<5|r>>>27)+i|0,s+=(r&n|i&~n)+t[14]-1019803690|0,s=(s<<9|s>>>23)+r|0,n+=(s&i|r&~i)+t[3]-187363961|0,n=(n<<14|n>>>18)+s|0,i+=(n&r|s&~r)+t[8]+1163531501|0,i=(i<<20|i>>>12)+n|0,r+=(i&s|n&~s)+t[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,s+=(r&n|i&~n)+t[2]-51403784|0,s=(s<<9|s>>>23)+r|0,n+=(s&i|r&~i)+t[7]+1735328473|0,n=(n<<14|n>>>18)+s|0,i+=(n&r|s&~r)+t[12]-1926607734|0,i=(i<<20|i>>>12)+n|0,r+=(i^n^s)+t[5]-378558|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^n)+t[8]-2022574463|0,s=(s<<11|s>>>21)+r|0,n+=(s^r^i)+t[11]+1839030562|0,n=(n<<16|n>>>16)+s|0,i+=(n^s^r)+t[14]-35309556|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^s)+t[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^n)+t[4]+1272893353|0,s=(s<<11|s>>>21)+r|0,n+=(s^r^i)+t[7]-155497632|0,n=(n<<16|n>>>16)+s|0,i+=(n^s^r)+t[10]-1094730640|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^s)+t[13]+681279174|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^n)+t[0]-358537222|0,s=(s<<11|s>>>21)+r|0,n+=(s^r^i)+t[3]-722521979|0,n=(n<<16|n>>>16)+s|0,i+=(n^s^r)+t[6]+76029189|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^s)+t[9]-640364487|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^n)+t[12]-421815835|0,s=(s<<11|s>>>21)+r|0,n+=(s^r^i)+t[15]+530742520|0,n=(n<<16|n>>>16)+s|0,i+=(n^s^r)+t[2]-995338651|0,i=(i<<23|i>>>9)+n|0,r+=(n^(i|~s))+t[0]-198630844|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~n))+t[7]+1126891415|0,s=(s<<10|s>>>22)+r|0,n+=(r^(s|~i))+t[14]-1416354905|0,n=(n<<15|n>>>17)+s|0,i+=(s^(n|~r))+t[5]-57434055|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~s))+t[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~n))+t[3]-1894986606|0,s=(s<<10|s>>>22)+r|0,n+=(r^(s|~i))+t[10]-1051523|0,n=(n<<15|n>>>17)+s|0,i+=(s^(n|~r))+t[1]-2054922799|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~s))+t[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~n))+t[15]-30611744|0,s=(s<<10|s>>>22)+r|0,n+=(r^(s|~i))+t[6]-1560198380|0,n=(n<<15|n>>>17)+s|0,i+=(s^(n|~r))+t[13]+1309151649|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~s))+t[4]-145523070|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~n))+t[11]-1120210379|0,s=(s<<10|s>>>22)+r|0,n+=(r^(s|~i))+t[2]+718787259|0,n=(n<<15|n>>>17)+s|0,i+=(s^(n|~r))+t[9]-343485551|0,i=(i<<21|i>>>11)+n|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=n+e[2]|0,e[3]=s+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(be.stateIdentity),this}appendStr(e){const t=this._buffer8,r=this._buffer32;let i,n,s=this._bufferLength;for(n=0;n<e.length;n+=1){if(i=e.charCodeAt(n),i<128)t[s++]=i;else if(i<2048)t[s++]=192+(i>>>6),t[s++]=63&i|128;else if(i<55296||i>56319)t[s++]=224+(i>>>12),t[s++]=i>>>6&63|128,t[s++]=63&i|128;else{if(i=1024*(i-55296)+(e.charCodeAt(++n)-56320)+65536,i>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[s++]=240+(i>>>18),t[s++]=i>>>12&63|128,t[s++]=i>>>6&63|128,t[s++]=63&i|128}s>=64&&(this._dataLength+=64,be._md5cycle(this._state,r),s-=64,r[0]=r[16])}return this._bufferLength=s,this}appendAsciiStr(e){const t=this._buffer8,r=this._buffer32;let i,n=this._bufferLength,s=0;for(;;){for(i=Math.min(e.length-s,64-n);i--;)t[n++]=e.charCodeAt(s++);if(n<64)break;this._dataLength+=64,be._md5cycle(this._state,r),n=0}return this._bufferLength=n,this}appendByteArray(e){const t=this._buffer8,r=this._buffer32;let i,n=this._bufferLength,s=0;for(;;){for(i=Math.min(e.length-s,64-n);i--;)t[n++]=e[s++];if(n<64)break;this._dataLength+=64,be._md5cycle(this._state,r),n=0}return this._bufferLength=n,this}getState(){const e=this._state;return{buffer:String.fromCharCode.apply(null,this._buffer8),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){const t=e.buffer,r=e.state,i=this._state;let n;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],n=0;n<t.length;n+=1)this._buffer8[n]=t.charCodeAt(n)}end(e=!1){const t=this._bufferLength,r=this._buffer8,i=this._buffer32,n=1+(t>>2);let s;if(this._dataLength+=t,r[t]=128,r[t+1]=r[t+2]=r[t+3]=0,i.set(be.buffer32Identity.subarray(n),n),t>55&&(be._md5cycle(this._state,i),i.set(be.buffer32Identity)),s=8*this._dataLength,s<=4294967295)i[14]=s;else{const e=s.toString(16).match(/(.*?)(.{0,8})$/);if(null===e)return;const t=parseInt(e[2],16),r=parseInt(e[1],16)||0;i[14]=t,i[15]=r}return be._md5cycle(this._state,i),e?this._state:be._hex(this._state)}}function we(e){return be.hashStr(e)}be.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),be.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),be.hexChars="0123456789abcdef",be.hexOut=[],be.onePassHasher=new be,"5d41402abc4b2a76b9719d911017c592"!==be.hashStr("hello")&&console.error("Md5 self test failed.");class Se{constructor(e,t,r,i){this.logger=e.getLogger("UnionRtc.digestauthentication"),this.username=r,this.password=i,this.ha1=t,this.nc=0,this.ncHex="00000000"}authenticate(e,t,r){if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if("MD5"!==this.algorithm)return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else{if(!(t.qop.indexOf("auth-int")>-1))return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;this.qop="auth-int"}else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=I(12),this.nc+=1,this.updateNcHex(),4294967296===this.nc&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(r),!0}toString(){const e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}updateNcHex(){const e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e}calculateResponse(e){let t,r;t=this.ha1,""!==t&&void 0!==t||(t=we(this.username+":"+this.realm+":"+this.password)),"auth"===this.qop?(r=we(this.method+":"+this.uri),this.response=we(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+r)):"auth-int"===this.qop?(r=we(this.method+":"+this.uri+":"+we(e||"")),this.response=we(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+r)):void 0===this.qop&&(r=we(this.method+":"+this.uri),this.response=we(t+":"+this.nonce+":"+r))}}function Te(e,t){if(t.statusCode<100||t.statusCode>699)throw new TypeError("Invalid statusCode: "+t.statusCode);const r=t.reasonPhrase?t.reasonPhrase:k(t.statusCode);let i="SIP/2.0 "+t.statusCode+" "+r+"\r\n";t.statusCode>=100&&t.statusCode,t.statusCode;const n="From: "+e.getHeader("From")+"\r\n",s="Call-ID: "+e.callId+"\r\n",o="CSeq: "+e.cseq+" "+e.method+"\r\n",a=e.getHeaders("via").reduce((e,t)=>e+"Via: "+t+"\r\n","");let c="To: "+e.getHeader("to");if(t.statusCode>100&&!e.parseHeader("to").hasParam("tag")){let e=t.toTag;e||(e=P()),c+=";tag="+e}c+="\r\n";let d="";t.supported&&(d="Supported: "+t.supported.join(", ")+"\r\n");let l="";t.userAgent&&(l="User-Agent: "+t.userAgent+"\r\n");let u="";return t.extraHeaders&&(u=t.extraHeaders.reduce((e,t)=>e+t.trim()+"\r\n","")),i+=a,i+=n,i+=c,i+=o,i+=s,i+=d,i+=l,i+=u,t.body?(i+="Content-Type: "+t.body.contentType+"\r\n",i+="Content-Length: "+D(t.body.content)+"\r\n\r\n",i+=t.body.content):i+="Content-Length: 0\r\n\r\n",{message:i}}class _e extends u{constructor(e){super(e||"Unspecified transport error.")}}class Ee{constructor(e,t,r,i,n){this._transport=e,this._user=t,this._id=r,this._state=i,this.listeners=new Array,this.logger=t.loggerFactory.getLogger(n,r),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,t){const r=()=>{this.removeStateChangeListener(r),e()};!0===(null==t?void 0:t.once)?this.listeners.push(r):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}logTransportError(e,t){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(t)}send(e){return this.transport.send(e).catch(e=>{if(e instanceof _e)throw this.onTransportError(e),e;let t;throw t=e&&"string"==typeof e.message?new _e(e.message):new _e,this.onTransportError(t),t})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}}class Ce extends Ee{constructor(e,t,r,i,n){super(t,r,Ce.makeId(e),i,n),this._request=e,this.user=r,e.setViaHeader(this.id,t.protocol)}static makeId(e){if("CANCEL"===e.method){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}return"z9hG4bK"+Math.floor(1e7*Math.random())}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}}!function(e){e.Accepted="Accepted",e.Calling="Calling",e.Completed="Completed",e.Confirmed="Confirmed",e.Proceeding="Proceeding",e.Terminated="Terminated",e.Trying="Trying"}(ue||(ue={}));class Re extends Ce{constructor(e,t,r){super(e,t,r,ue.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),V.TIMER_F),this.send(e.toString()).catch(e=>{this.logTransportError(e,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error("Invalid status code "+t);switch(this.state){case ue.Trying:if(t>=100&&t<=199)return this.stateTransition(ue.Proceeding),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(t>=200&&t<=699)return this.stateTransition(ue.Completed),408===t?void this.onRequestTimeout():void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case ue.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699)return this.stateTransition(ue.Completed),408===t?void this.onRequestTimeout():void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case ue.Completed:case ue.Terminated:return;default:throw new Error("Invalid state "+this.state)}const r=`Non-INVITE client transaction received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(ue.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case ue.Trying:r();break;case ue.Proceeding:this.state!==ue.Trying&&r();break;case ue.Completed:this.state!==ue.Trying&&this.state!==ue.Proceeding&&r();break;case ue.Terminated:this.state!==ue.Trying&&this.state!==ue.Proceeding&&this.state!==ue.Completed&&(t||r());break;default:r()}e===ue.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),V.TIMER_K)),e===ue.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),this.state!==ue.Trying&&this.state!==ue.Proceeding||(this.onRequestTimeout(),this.stateTransition(ue.Terminated))}timerK(){this.state===ue.Completed&&this.stateTransition(ue.Terminated)}}class Ae extends Ee{constructor(e,t,r,i,n){super(t,r,e.viaBranch,i,n),this._request=e,this.user=r}get request(){return this._request}}class Ie extends Ae{constructor(e,t,r){super(e,t,r,ue.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(e){switch(this.state){case ue.Proceeding:if(e.method===z.INVITE)return void(this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")}));break;case ue.Accepted:if(e.method===z.INVITE)return;break;case ue.Completed:if(e.method===z.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");return void this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of final response.")})}if(e.method===z.ACK)return void this.stateTransition(ue.Confirmed);break;case ue.Confirmed:case ue.Terminated:if(e.method===z.INVITE||e.method===z.ACK)return;break;default:throw new Error("Invalid state "+this.state)}const t=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(t)}receiveResponse(e,t){if(e<100||e>699)throw new Error("Invalid status code "+e);switch(this.state){case ue.Proceeding:if(e>=100&&e<=199)return this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),void this.send(t).catch(e=>{this.logTransportError(e,"Failed to send 1xx response.")});if(e>=200&&e<=299)return this.lastFinalResponse=t,this.stateTransition(ue.Accepted),void this.send(t).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")});if(e>=300&&e<=699)return this.lastFinalResponse=t,this.stateTransition(ue.Completed),void this.send(t).catch(e=>{this.logTransportError(e,"Failed to send non-2xx final response.")});break;case ue.Accepted:if(e>=200&&e<=299)return void this.send(t).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")});break;case ue.Completed:case ue.Confirmed:case ue.Terminated:break;default:throw new Error("Invalid state "+this.state)}const r=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}retransmitAcceptedResponse(){this.state===ue.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return"INVITE server transaction"}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case ue.Proceeding:t();break;case ue.Accepted:case ue.Completed:this.state!==ue.Proceeding&&t();break;case ue.Confirmed:this.state!==ue.Completed&&t();break;case ue.Terminated:this.state!==ue.Accepted&&this.state!==ue.Completed&&this.state!==ue.Confirmed&&t();break;default:t()}this.stopProgressExtensionTimer(),e===ue.Accepted&&(this.L=setTimeout(()=>this.timerL(),V.TIMER_L)),e===ue.Completed&&(this.H=setTimeout(()=>this.timerH(),V.TIMER_H)),e===ue.Confirmed&&(this.I=setTimeout(()=>this.timerI(),V.TIMER_I)),e===ue.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){void 0===this.progressExtensionTimer&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")})},V.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){void 0!==this.progressExtensionTimer&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===ue.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(ue.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(ue.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===ue.Accepted&&this.stateTransition(ue.Terminated)}}class ke{constructor(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,t){const r=t.getHeaders("record-route").reverse(),i=t.parseHeader("contact");if(!i)throw new Error("Contact undefined.");if(!(i instanceof S))throw new Error("Contact not instance of NameAddrHeader.");const n=i.uri,s=e.cseq,o=e.callId,a=e.fromTag,c=t.toTag;if(!o)throw new Error("Call id undefined.");if(!a)throw new Error("From tag undefined.");if(!c)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const d=e.from.uri,l=e.to.uri;if(!t.statusCode)throw new Error("Incoming response status code undefined.");return{id:o+a+c,early:t.statusCode<200,callId:o,localTag:a,remoteTag:c,localSequenceNumber:s,remoteSequenceNumber:void 0,localURI:d,remoteURI:l,remoteTarget:n,routeSet:r,secure:!1}}static initialDialogStateForUserAgentServer(e,t,r=!1){const i=e.getHeaders("record-route"),n=e.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof S))throw new Error("Contact not instance of NameAddrHeader.");const s=n.uri,o=e.cseq,a=e.callId,c=t,d=e.fromTag,l=e.from.uri;return{id:a+c+d,early:r,callId:a,localTag:c,remoteTag:d,localSequenceNumber:void 0,remoteSequenceNumber:o,localURI:e.to.uri,remoteURI:l,remoteTarget:s,routeSet:i,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==z.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()}createOutgoingRequestMessage(e,t){const r=this.remoteURI,i=this.remoteTag,n=this.localURI,s=this.localTag,o=this.callId;let a;a=t&&t.cseq?t.cseq:this.dialogState.localSequenceNumber?this.dialogState.localSequenceNumber+=1:this.dialogState.localSequenceNumber=1;const c=this.remoteTarget,d=this.routeSet,l=t&&t.extraHeaders,u=t&&t.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,n,r,{callId:o,cseq:a,fromTag:s,toTag:i,routeSet:d},l,u)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===z.ACK||(!(this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber)||(this.core.replyStateless(e,{statusCode:500}),!1))}}class Pe extends Ce{constructor(e,t,r){super(e,t,r,ue.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),V.TIMER_B),this.send(e.toString()).catch(e=>{this.logTransportError(e,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(e){const t=e.toTag;if(!t)throw new Error("To tag undefined.");const r="z9hG4bK"+Math.floor(1e7*Math.random());e.setViaHeader(r,this.transport.protocol),this.ackRetransmissionCache.set(t,e),this.send(e.toString()).catch(e=>{this.logTransportError(e,"Failed to send ACK to 2xx response.")})}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error("Invalid status code "+t);switch(this.state){case ue.Calling:if(t>=100&&t<=199)return this.stateTransition(ue.Proceeding),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(t>=200&&t<=299)return this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(ue.Accepted),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(t>=300&&t<=699)return this.stateTransition(ue.Completed),this.ack(e),void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case ue.Proceeding:if(t>=100&&t<=199)return void(this.user.receiveResponse&&this.user.receiveResponse(e));if(t>=200&&t<=299)return this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(ue.Accepted),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(t>=300&&t<=699)return this.stateTransition(ue.Completed),this.ack(e),void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case ue.Accepted:if(t>=200&&t<=299){if(!this.ackRetransmissionCache.has(e.toTag))return this.ackRetransmissionCache.set(e.toTag,void 0),void(this.user.receiveResponse&&this.user.receiveResponse(e));const t=this.ackRetransmissionCache.get(e.toTag);return t?void this.send(t.toString()).catch(e=>{this.logTransportError(e,"Failed to send retransmission of ACK to 2xx response.")}):void 0}break;case ue.Completed:if(t>=300&&t<=699)return void this.ack(e);break;case ue.Terminated:break;default:throw new Error("Invalid state "+this.state)}const r=`Received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(ue.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(e){const t=this.request.ruri,r=this.request.callId,i=this.request.cseq,n=this.request.getHeader("from"),s=e.getHeader("to"),o=this.request.getHeader("via"),a=this.request.getHeader("route");if(!n)throw new Error("From undefined.");if(!s)throw new Error("To undefined.");if(!o)throw new Error("Via undefined.");let c=`ACK ${t} SIP/2.0\r\n`;a&&(c+=`Route: ${a}\r\n`),c+=`Via: ${o}\r\n`,c+=`To: ${s}\r\n`,c+=`From: ${n}\r\n`,c+=`Call-ID: ${r}\r\n`,c+=`CSeq: ${i} ACK\r\n`,c+="Max-Forwards: 70\r\n",c+="Content-Length: 0\r\n\r\n",this.send(c).catch(e=>{this.logTransportError(e,"Failed to send ACK to non-2xx response.")})}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case ue.Calling:r();break;case ue.Proceeding:this.state!==ue.Calling&&r();break;case ue.Accepted:case ue.Completed:this.state!==ue.Calling&&this.state!==ue.Proceeding&&r();break;case ue.Terminated:this.state!==ue.Calling&&this.state!==ue.Accepted&&this.state!==ue.Completed&&(t||r());break;default:r()}this.B&&(clearTimeout(this.B),this.B=void 0),ue.Proceeding,e===ue.Completed&&(this.D=setTimeout(()=>this.timerD(),V.TIMER_D)),e===ue.Accepted&&(this.M=setTimeout(()=>this.timerM(),V.TIMER_M)),e===ue.Terminated&&this.dispose(),this.setState(e)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===ue.Calling&&(this.onRequestTimeout(),this.stateTransition(ue.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===ue.Completed&&this.stateTransition(ue.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===ue.Accepted&&this.stateTransition(ue.Terminated)}}class xe{constructor(e,t,r,i){this.transactionConstructor=e,this.core=t,this.message=r,this.delegate=i,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("UnionRtc.user-agent-client"),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}cancel(e,t={}){if(!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");const r=this.core.makeOutgoingRequestMessage(z.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},t.extraHeaders);return r.branch=this.message.branch,this.message.headers.Route&&(r.headers.Route=this.message.headers.Route),e&&r.setHeader("Reason",e),this.transaction.state===ue.Proceeding?new xe(Re,this.core,r):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===ue.Proceeding&&new xe(Re,this.core,r)},{once:!0}),r}authenticationGuard(e,t){const r=e.statusCode;if(!r)throw new Error("Response status code undefined.");if(401!==r&&407!==r)return!0;let i,n;if(401===r?(i=e.parseHeader("www-authenticate"),n="authorization"):(i=e.parseHeader("proxy-authenticate"),n="proxy-authorization"),!i)return this.logger.warn(r+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||!0!==i.stale))return this.logger.warn(r+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,i))return!0;this.challenged=!0,i.stale&&(this.stale=!0);let s=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),s=this.message.cseq=t.localSequenceNumber),this.message.setHeader("cseq",s+" "+this.message.method),this.message.setHeader(n,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");const e=new N;e.statusCode=408,e.reasonPhrase="Request Timeout",this.receiveResponse(e)}onTransportError(e){this.logger.error(e.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");const t=new N;t.statusCode=503,t.reasonPhrase="Service Unavailable",this.receiveResponse(t)}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e});break;case/^2[0-9]{2}$/.test(t):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e});break;case/^3[0-9]{2}$/.test(t):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error("Invalid status code "+t)}}init(){const e={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:e=>{e===ue.Terminated&&(this.core.userAgentClients.delete(r),t===this._transaction&&this.dispose())},onTransportError:e=>this.onTransportError(e),receiveResponse:e=>this.receiveResponse(e)},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const r=t.id+t.request.method;this.core.userAgentClients.set(r,this)}}class De extends xe{constructor(e,t,r){const i=e.createOutgoingRequestMessage(z.BYE,r);super(Re,e.userAgentCore,i,t),e.dispose()}}class Oe extends Ae{constructor(e,t,r){super(e,t,r,ue.Trying,"sip.transaction.nist")}dispose(){this.J&&(clearTimeout(this.J),this.J=void 0),super.dispose()}get kind(){return"nist"}receiveRequest(e){switch(this.state){case ue.Trying:break;case ue.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")});break;case ue.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of final response.")});break;case ue.Terminated:break;default:throw new Error("Invalid state "+this.state)}}receiveResponse(e,t){if(e<100||e>699)throw new Error("Invalid status code "+e);if(e>100&&e<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case ue.Trying:if(this.lastResponse=t,e>=100&&e<200)return this.stateTransition(ue.Proceeding),void this.send(t).catch(e=>{this.logTransportError(e,"Failed to send provisional response.")});if(e>=200&&e<=699)return this.stateTransition(ue.Completed),void this.send(t).catch(e=>{this.logTransportError(e,"Failed to send final response.")});break;case ue.Proceeding:if(this.lastResponse=t,e>=200&&e<=699)return this.stateTransition(ue.Completed),void this.send(t).catch(e=>{this.logTransportError(e,"Failed to send final response.")});break;case ue.Completed:return;case ue.Terminated:break;default:throw new Error("Invalid state "+this.state)}const r=`Non-INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(ue.Terminated,!0)}typeToString(){return"non-INVITE server transaction"}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case ue.Trying:r();break;case ue.Proceeding:this.state!==ue.Trying&&r();break;case ue.Completed:this.state!==ue.Trying&&this.state!==ue.Proceeding&&r();break;case ue.Terminated:this.state!==ue.Proceeding&&this.state!==ue.Completed&&(t||r());break;default:r()}e===ue.Completed&&(this.J=setTimeout(()=>this.timerJ(),V.TIMER_J)),e===ue.Terminated&&this.dispose(),this.setState(e)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===ue.Completed&&this.stateTransition(ue.Terminated)}}class Me{constructor(e,t,r,i){this.transactionConstructor=e,this.core=t,this.message=r,this.delegate=i,this.logger=this.loggerFactory.getLogger("UnionRtc.user-agent-server"),this.toTag=r.toTag?r.toTag:P(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}accept(e={statusCode:200}){if(!this.acceptable)throw new B(`${this.message.method} not acceptable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<200||t>299)throw new TypeError("Invalid statusCode: "+t);return this.reply(e)}progress(e={statusCode:180}){if(!this.progressable)throw new B(`${this.message.method} not progressable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<101||t>199)throw new TypeError("Invalid statusCode: "+t);return this.reply(e)}redirect(e,t={statusCode:302}){if(!this.redirectable)throw new B(`${this.message.method} not redirectable in state ${this.transaction.state}.`);const r=t.statusCode;if(r<300||r>399)throw new TypeError("Invalid statusCode: "+r);const i=new Array;e.forEach(e=>i.push("Contact: "+e.toString())),t.extraHeaders=(t.extraHeaders||[]).concat(i);return this.reply(t)}reject(e={statusCode:480}){if(!this.rejectable)throw new B(`${this.message.method} not rejectable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<400||t>699)throw new TypeError("Invalid statusCode: "+t);return this.reply(e)}trying(e){if(!this.tryingable)throw new B(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)}get acceptable(){if(this.transaction instanceof Ie)return this.transaction.state===ue.Proceeding||this.transaction.state===ue.Accepted;if(this.transaction instanceof Oe)return this.transaction.state===ue.Trying||this.transaction.state===ue.Proceeding;throw new Error("Unknown transaction type.")}get progressable(){if(this.transaction instanceof Ie)return this.transaction.state===ue.Proceeding;if(this.transaction instanceof Oe)return!1;throw new Error("Unknown transaction type.")}get redirectable(){if(this.transaction instanceof Ie)return this.transaction.state===ue.Proceeding;if(this.transaction instanceof Oe)return this.transaction.state===ue.Trying||this.transaction.state===ue.Proceeding;throw new Error("Unknown transaction type.")}get rejectable(){if(this.transaction instanceof Ie)return this.transaction.state===ue.Proceeding;if(this.transaction instanceof Oe)return this.transaction.state===ue.Trying||this.transaction.state===ue.Proceeding;throw new Error("Unknown transaction type.")}get tryingable(){if(this.transaction instanceof Ie)return this.transaction.state===ue.Proceeding;if(this.transaction instanceof Oe)return this.transaction.state===ue.Trying;throw new Error("Unknown transaction type.")}reply(e){e.toTag||100===e.statusCode||(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;const t=Te(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t}init(){const e={loggerFactory:this.loggerFactory,onStateChange:e=>{e===ue.Terminated&&(this.core.userAgentServers.delete(r),this.dispose())},onTransportError:e=>{this.logger.error(e.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(e):this.logger.error("User agent server response transport error.")}},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const r=t.id;this.core.userAgentServers.set(t.id,this)}}class Ne extends Me{constructor(e,t,r){super(Oe,e.userAgentCore,t,r)}}class $e extends xe{constructor(e,t,r){const i=e.createOutgoingRequestMessage(z.INFO,r);super(Re,e.userAgentCore,i,t)}}class je extends Me{constructor(e,t,r){super(Oe,e.userAgentCore,t,r)}}class Le extends xe{constructor(e,t,r){super(Re,e,t,r)}}class He extends Me{constructor(e,t,r){super(Oe,e,t,r)}}class qe extends xe{constructor(e,t,r){const i=e.createOutgoingRequestMessage(z.NOTIFY,r);super(Re,e.userAgentCore,i,t)}}class Ue extends Me{constructor(e,t,r){const i=void 0!==e.userAgentCore?e.userAgentCore:e;super(Oe,i,t,r)}}class Fe extends xe{constructor(e,t,r){const i=e.createOutgoingRequestMessage(z.PRACK,r);super(Re,e.userAgentCore,i,t),e.signalingStateTransition(i)}}class Be extends Me{constructor(e,t,r){super(Oe,e.userAgentCore,t,r),e.signalingStateTransition(t),this.dialog=e}accept(e={statusCode:200}){return e.body&&this.dialog.signalingStateTransition(e.body),super.accept(e)}}class Ge extends xe{constructor(e,t,r){const i=e.createOutgoingRequestMessage(z.INVITE,r);super(Pe,e.userAgentCore,i,t),this.delegate=t,e.signalingStateTransition(i),e.reinviteUserAgentClient=this,this.dialog=e}receiveResponse(e){if(!this.authenticationGuard(e,this.dialog))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:this.dialog,prack:e=>{throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(t):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:e=>this.dialog.ack(e)});break;case/^3[0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error("Invalid status code "+t)}}}class Ve extends Me{constructor(e,t,r){super(Ie,e.userAgentCore,t,r),e.reinviteUserAgentServer=this,this.dialog=e}accept(e={statusCode:200}){e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(this.dialog.routeSet.map(e=>"Record-Route: "+e));const t=super.accept(e),r=this.dialog,i=Object.assign(Object.assign({},t),{session:r});return e.body&&this.dialog.signalingStateTransition(e.body),this.dialog.reConfirm(),i}progress(e={statusCode:180}){const t=super.progress(e),r=this.dialog,i=Object.assign(Object.assign({},t),{session:r});return e.body&&this.dialog.signalingStateTransition(e.body),i}redirect(e,t={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")}reject(e={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(e)}}class ze extends xe{constructor(e,t,r){const i=e.createOutgoingRequestMessage(z.REFER,r);super(Re,e.userAgentCore,i,t)}}class We extends Me{constructor(e,t,r){const i=void 0!==e.userAgentCore?e.userAgentCore:e;super(Oe,i,t,r)}}class Ke extends ke{constructor(e,t,r,i){super(t,r),this.initialTransaction=e,this._signalingState=F.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=i,e instanceof Ie&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(e.request),this.logger=t.loggerFactory.getLogger("UnionRtc.invite-dialog"),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=F.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?U.Early:this.ackWait?U.AckWait:this._signalingState===F.Closed?U.Terminated:U.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(e={}){let t;if(this.logger.log(`INVITE dialog ${this.id} sending ACK request`),this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof Pe))throw new Error("Transaction not instance of InviteClientTransaction.");t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof Pe))throw new Error("Initial transaction not instance of InviteClientTransaction.");t=this.initialTransaction}const r=this.createOutgoingRequestMessage(z.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(r),this.signalingStateTransition(r),{message:r}}bye(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof Ie){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==ue.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new De(this,e,t)}info(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw new Error("Dialog not confirmed.");return new $e(this,e,t)}invite(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new Ge(this,e,t)}message(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw new Error("Dialog not confirmed.");const r=this.createOutgoingRequestMessage(z.MESSAGE,t);return new Le(this.core,r,e)}notify(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw new Error("Dialog not confirmed.");return new qe(this,e,t)}prack(e,t){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new Fe(this,e,t)}refer(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw new Error("Dialog not confirmed.");return new ze(this,e,t)}receiveRequest(e){if(this.logger.log(`INVITE dialog ${this.id} received ${e.method} request`),e.method!==z.ACK)if(this.sequenceGuard(e)){if(super.receiveRequest(e),e.method===z.INVITE){const t=()=>{const e=this.ackWait?"waiting for initial ACK":"processing initial ACK";this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${e}`);let t="RFC 5407 suggests the following to avoid this race condition... ";t+=" Note: Implementation issues are outside the scope of this document,",t+=" but the following tip is provided for avoiding race conditions of",t+=" this type. The caller can delay sending re-INVITE F6 for some period",t+=" of time (2 seconds, perhaps), after which the caller can reasonably",t+=" assume that its ACK has been received. Implementors can decouple the",t+=" actions of the user (e.g., pressing the hold button) from the actions",t+=" of the protocol (the sending of re-INVITE F6), so that the UA can",t+=" behave like this. In this case, it is the implementor's choice as to",t+=" how long to wait. In most cases, such an implementation may be",t+=" useful to prevent the type of race condition shown in this section.",t+=" This document expresses no preference about whether or not they",t+=" should wait for an ACK to be delivered. After considering the impact",t+=" on user experience, implementors should decide whether or not to wait",t+=" for a while, because the user experience depends on the",t+=" implementation and has no direct bearing on protocol behavior.",this.logger.warn("RFC 5407 suggests the following to avoid this race condition... Note: Implementation issues are outside the scope of this document, but the following tip is provided for avoiding race conditions of this type. The caller can delay sending re-INVITE F6 for some period of time (2 seconds, perhaps), after which the caller can reasonably assume that its ACK has been received. Implementors can decouple the actions of the user (e.g., pressing the hold button) from the actions of the protocol (the sending of re-INVITE F6), so that the UA can behave like this. In this case, it is the implementor's choice as to how long to wait. In most cases, such an implementation may be useful to prevent the type of race condition shown in this section. This document expresses no preference about whether or not they should wait for an ACK to be delivered. After considering the impact on user experience, implementors should decide whether or not to wait for a while, because the user experience depends on the implementation and has no direct bearing on protocol behavior.")},r=["Retry-After: "+(Math.floor(10*Math.random())+1)];if(this.ackProcessing)return this.core.replyStateless(e,{statusCode:500,extraHeaders:r}),void t();if(this.ackWait&&this.signalingState!==F.Stable)return this.core.replyStateless(e,{statusCode:500,extraHeaders:r}),void t();if(this.reinviteUserAgentServer)return void this.core.replyStateless(e,{statusCode:500,extraHeaders:r});if(this.reinviteUserAgentClient)return void this.core.replyStateless(e,{statusCode:491})}if(e.method===z.INVITE){const t=e.parseHeader("contact");if(!t)throw new Error("Contact undefined.");if(!(t instanceof S))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=t.uri}switch(e.method){case z.BYE:{const t=new Ne(this,e);this.delegate&&this.delegate.onBye?this.delegate.onBye(t):t.accept(),this.dispose()}break;case z.INFO:{const t=new je(this,e);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(t):t.reject({statusCode:469,extraHeaders:["Recv-Info :"]})}break;case z.INVITE:{const t=new Ve(this,e);this.signalingStateTransition(e),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(t):t.reject({statusCode:488})}break;case z.MESSAGE:{const t=new He(this.core,e);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case z.NOTIFY:{const t=new Ue(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(t):t.accept()}break;case z.PRACK:{const t=new Be(this,e);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(t):t.accept()}break;case z.REFER:{const t=new We(this,e);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):t.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501})}}else this.logger.log(`INVITE dialog ${this.id} rejected out of order ${e.method} request.`);else{if(this.ackWait){if(this.initialTransaction instanceof Pe)return void this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);if(this.initialTransaction.request.cseq!==e.cseq)return void this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);this.ackWait=!1}else{if(!this.reinviteUserAgentServer)return void this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);if(this.reinviteUserAgentServer.transaction.request.cseq!==e.cseq)return void this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(e),this.delegate&&this.delegate.onAck){const t=this.delegate.onAck({message:e});t instanceof Promise&&(this.ackProcessing=!0,t.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}}}reliableSequenceGuard(e){const t=e.statusCode;if(!t)throw new Error("Status code undefined");if(t>100&&t<200){const t=e.getHeader("require"),r=e.getHeader("rseq"),i=t&&t.includes("100rel")&&r?Number(r):void 0;if(i){if(this.rseq&&this.rseq+1!==i)return!1;this.rseq=this.rseq?this.rseq+1:i}}return!0}signalingStateRollback(){this._signalingState!==F.HaveLocalOffer&&this.signalingState!==F.HaveRemoteOffer||this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=F.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(e){const t=q(e);if(t&&"session"===t.contentDisposition){if(this._signalingState===F.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof M)switch(this._signalingState){case F.Initial:case F.Stable:this._signalingState=F.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case F.HaveLocalOffer:this._signalingState=F.Stable,this._answer=t;break;case F.HaveRemoteOffer:case F.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof N)switch(this._signalingState){case F.Initial:case F.Stable:this._signalingState=F.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case F.HaveLocalOffer:this._signalingState=F.Stable,this._answer=t;break;case F.HaveRemoteOffer:case F.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof $)switch(this._signalingState){case F.Initial:case F.Stable:this._signalingState=F.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case F.HaveLocalOffer:break;case F.HaveRemoteOffer:this._signalingState=F.Stable,this._answer=t;break;case F.Closed:break;default:throw new Error("Unexpected signaling state.")}if(H(e))switch(this._signalingState){case F.Initial:case F.Stable:this._signalingState=F.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case F.HaveLocalOffer:break;case F.HaveRemoteOffer:this._signalingState=F.Stable,this._answer=t;break;case F.Closed:break;default:throw new Error("Unexpected signaling state.")}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof Ie){const e=this.initialTransaction;let t=V.T1;const r=()=>{this.ackWait?(this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(2*t,V.T2),this.invite2xxTimer=setTimeout(r,t)):this.invite2xxTimer=void 0};this.invite2xxTimer=setTimeout(r,t);const i=()=>{e.state===ue.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};e.addStateChangeListener(i)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof Ie){const e=this.reinviteUserAgentServer.transaction;let t=V.T1;const r=()=>{this.reinviteUserAgentServer?(this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(2*t,V.T2),this.invite2xxTimer=setTimeout(r,t)):this.invite2xxTimer=void 0};this.invite2xxTimer=setTimeout(r,t);const i=()=>{e.state===ue.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.reinviteUserAgentServer)};e.addStateChangeListener(i)}}}class Je extends xe{constructor(e,t,r){super(Pe,e,t,r),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=r}dispose(){this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(e){if(this.transaction.state===ue.Calling)return super.onTransportError(e);this.logger.error(e.message),this.logger.error("User agent client request transport error while sending ACK.")}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):return void(this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e}));case/^1[0-9]{2}$/.test(t):{if(!e.toTag)return void this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");if(!e.parseHeader("contact"))return void this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");const t=ke.initialDialogStateForUserAgentClient(this.message,e);let r=this.earlyDialogs.get(t.id);if(!r){const e=this.transaction;if(!(e instanceof Pe))throw new Error("Transaction not instance of InviteClientTransaction.");r=new Ke(e,this.core,t),this.earlyDialogs.set(r.id,r)}if(!r.reliableSequenceGuard(e))return void this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");r.signalingState!==F.Initial&&r.signalingState!==F.HaveLocalOffer||r.signalingStateTransition(e);const i=r;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:i,prack:e=>i.prack(void 0,e)})}return;case/^2[0-9]{2}$/.test(t):{if(!e.toTag)return void this.logger.error("2xx INVITE response received without a to tag, dropping.");if(!e.parseHeader("contact"))return void this.logger.error("2xx INVITE response received without a Contact header field, dropping.");const t=ke.initialDialogStateForUserAgentClient(this.message,e);let r=this.confirmedDialogs.get(t.id);if(r){const e=this.confirmedDialogAcks.get(t.id);if(e){const t=this.transaction;if(!(t instanceof Pe))throw new Error("Client transaction not instance of InviteClientTransaction.");t.ackResponse(e.message)}return}if(r=this.earlyDialogs.get(t.id),r)r.confirm(),r.recomputeRouteSet(e),this.earlyDialogs.delete(r.id),this.confirmedDialogs.set(r.id,r);else{const e=this.transaction;if(!(e instanceof Pe))throw new Error("Transaction not instance of InviteClientTransaction.");r=new Ke(e,this.core,t),this.confirmedDialogs.set(r.id,r)}r.signalingState!==F.Initial&&r.signalingState!==F.HaveLocalOffer||r.signalingStateTransition(e);const i=r;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:i,ack:e=>{const t=i.ack(e);return this.confirmedDialogAcks.set(i.id,t),t}});else{const e=i.ack();this.confirmedDialogAcks.set(i.id,e)}}return;case/^3[0-9]{2}$/.test(t):return this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),void(this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e}));case/^[4-6][0-9]{2}$/.test(t):return this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),void(this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e}));default:throw new Error("Invalid status code "+t)}throw new Error(`Executing what should be an unreachable code path receiving ${t} response.`)}}class Ye extends xe{constructor(e,t,r){super(Re,e,t,r)}}class Xe extends xe{constructor(e,t,r){super(Re,e,t,r)}}class Ze extends xe{constructor(e,t,r){const i=e.createOutgoingRequestMessage(z.SUBSCRIBE,r);super(Re,e.userAgentCore,i,t),this.dialog=e}waitNotifyStop(){}receiveResponse(e){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(t){const e=Number(t);this.dialog.subscriptionExpires>e&&(this.dialog.subscriptionExpires=e)}else this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE")}if(e.statusCode&&e.statusCode>=400&&e.statusCode<700){[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(e.statusCode)&&this.dialog.terminate()}super.receiveResponse(e)}}class Qe extends ke{constructor(e,t,r,i,n,s){super(i,n),this.delegate=s,this._autoRefresh=!1,this._subscriptionEvent=e,this._subscriptionExpires=t,this._subscriptionExpiresInitial=t,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=r,this.logger=i.loggerFactory.getLogger("sip.subscribe-dialog"),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(e,t){const r=t.getHeaders("record-route"),i=t.parseHeader("contact");if(!i)throw new Error("Contact undefined.");if(!(i instanceof S))throw new Error("Contact not instance of NameAddrHeader.");const n=i.uri,s=e.cseq,o=e.callId,a=e.fromTag,c=t.fromTag;if(!o)throw new Error("Call id undefined.");if(!a)throw new Error("From tag undefined.");if(!c)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");return{id:o+a+c,early:!1,callId:o,localTag:a,remoteTag:c,localSequenceNumber:s,remoteSequenceNumber:void 0,localURI:e.from.uri,remoteURI:e.to.uri,remoteTarget:n,routeSet:r,secure:!1}}dispose(){super.dispose(),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(e){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){const e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)}set subscriptionExpires(e){if(e<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){const t=this.subscriptionRefresh;(void 0===t||t>=e)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(void 0===this._subscriptionRefresh||void 0===this._subscriptionRefreshLastSet)return;const e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(e){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${e.method} request`),this.sequenceGuard(e))switch(super.receiveRequest(e),e.method){case z.NOTIFY:this.onNotify(e);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501})}else this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${e.method} request.`)}refresh(){const e="Allow: "+W.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}subscribe(e,t={}){if(this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active)throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);const r=new Ze(this,e,t);return this.N&&(clearTimeout(this.N),this.N=void 0),this.N=setTimeout(()=>this.timerN(),V.TIMER_N),r}terminate(){this.stateTransition(oe.Terminated),this.onTerminated()}unsubscribe(){const e="Allow: "+W.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: 0"),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}onNotify(e){const t=e.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent)return void this.core.replyStateless(e,{statusCode:489});this.N&&(clearTimeout(this.N),this.N=void 0);const r=e.parseHeader("Subscription-State");if(!r||!r.state)return void this.core.replyStateless(e,{statusCode:489});const i=r.state,n=r.expires?Math.max(r.expires,0):void 0;switch(i){case"pending":this.stateTransition(oe.Pending,n);break;case"active":this.stateTransition(oe.Active,n);break;case"terminated":this.stateTransition(oe.Terminated,n);break;default:this.logger.warn("Unrecognized subscription state.")}const s=new Ue(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(s):s.accept()}onRefresh(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){const e=900*this.subscriptionExpires;this._subscriptionRefresh=Math.floor(e/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},e)}}stateTransition(e,t){const r=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${e}`)};switch(e){case oe.Initial:case oe.NotifyWait:return void r();case oe.Pending:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending)return void r();break;case oe.Active:case oe.Terminated:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active)return void r();break;default:return void r()}e===oe.Pending&&t&&(this.subscriptionExpires=t),e===oe.Active&&t&&(this.subscriptionExpires=t),e===oe.Terminated&&this.dispose(),this._subscriptionState=e}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==oe.Terminated&&(this.stateTransition(oe.Terminated),this.onTerminated())}}class et extends xe{constructor(e,t,r){const i=t.getHeader("Event");if(!i)throw new Error("Event undefined");const n=t.getHeader("Expires");if(!n)throw new Error("Expires undefined");super(Re,e,t,r),this.delegate=r,this.subscriberId=t.callId+t.fromTag+i,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(n),this.subscriptionEvent=i,this.subscriptionState=oe.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(e){const t=e.message.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent)return this.logger.warn("Failed to parse event."),void e.reject({statusCode:489});const r=e.message.parseHeader("Subscription-State");if(!r||!r.state)return this.logger.warn("Failed to parse subscription state."),void e.reject({statusCode:489});const i=r.state;switch(i){case"pending":case"active":case"terminated":break;default:return this.logger.warn("Invalid subscription state "+i),void e.reject({statusCode:489})}if("terminated"!==i){if(!e.message.parseHeader("contact"))return this.logger.warn("Failed to parse contact."),void e.reject({statusCode:489})}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=r.expires?Math.min(this.subscriptionExpires,Math.max(r.expires,0)):this.subscriptionExpires,i){case"pending":this.subscriptionState=oe.Pending;break;case"active":this.subscriptionState=oe.Active;break;case"terminated":this.subscriptionState=oe.Terminated;break;default:throw new Error(`Unrecognized state ${i}.`)}if(this.subscriptionState!==oe.Terminated){const t=Qe.initialDialogStateForSubscription(this.message,e.message);this.dialog=new Qe(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,t)}if(this.delegate&&this.delegate.onNotify){const t=e,r=this.dialog;this.delegate.onNotify({request:t,subscription:r})}else e.accept()}waitNotifyStart(){this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout(()=>this.timerN(),V.TIMER_N))}waitNotifyStop(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)}receiveResponse(e){if(this.authenticationGuard(e)){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(t){const e=Number(t);e>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),e<this.subscriptionExpires&&(this.subscriptionExpires=e)}else this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}e.statusCode&&e.statusCode>=300&&e.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(e)}}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()}}class tt extends Me{constructor(e,t,r){super(Ie,e,t,r),this.core=e}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(e={statusCode:200}){if(!this.acceptable)throw new B(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{const e=this.transaction;if(!(e instanceof Ie))throw new Error("Transaction not instance of InviteClientTransaction.");const t=ke.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new Ke(e,this.core,t)}const t=this.message.getHeaders("record-route").map(e=>"Record-Route: "+e),r="Contact: "+this.core.configuration.contact.toString(),i="Allow: "+W.toString();if(!e.body)if(this.confirmedDialog.signalingState===F.Stable)e.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===F.Initial||this.confirmedDialog.signalingState===F.HaveRemoteOffer)throw new Error("Response must have a body.");e.statusCode=e.statusCode||200,e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(i),e.extraHeaders.push(r);const n=super.accept(e),s=this.confirmedDialog,o=Object.assign(Object.assign({},n),{session:s});return e.body&&this.confirmedDialog.signalingState!==F.Stable&&this.confirmedDialog.signalingStateTransition(e.body),o}progress(e={statusCode:180}){if(!this.progressable)throw new B(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){const e=this.transaction;if(!(e instanceof Ie))throw new Error("Transaction not instance of InviteClientTransaction.");const t=ke.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new Ke(e,this.core,t)}const t=this.message.getHeaders("record-route").map(e=>"Record-Route: "+e),r="Contact: "+this.core.configuration.contact;e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(r);const i=super.progress(e),n=this.earlyDialog,s=Object.assign(Object.assign({},i),{session:n});return e.body&&this.earlyDialog.signalingState!==F.Stable&&this.earlyDialog.signalingStateTransition(e.body),s}redirect(e,t={statusCode:302}){return super.redirect(e,t)}reject(e={statusCode:486}){return super.reject(e)}}class rt extends Me{constructor(e,t,r){super(Oe,e,t,r),this.core=e}}class it extends Me{constructor(e,t,r){super(Oe,e,t,r),this.core=e}}const nt=["application/sdp","application/dtmf-relay"];class st{constructor(e,t={}){this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=e,this.delegate=t,this.dialogs=new Map,this.subscribers=new Map,this.logger=e.loggerFactory.getLogger("UnionRtc.user-agent-core")}dispose(){this.reset()}reset(){this.dialogs.forEach(e=>e.dispose()),this.dialogs.clear(),this.subscribers.forEach(e=>e.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(e=>e.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(e=>e.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){const e=this.configuration.transportAccessor();if(!e)throw new Error("Transport undefined.");return e}invite(e,t){return new Je(this,e,t)}message(e,t){return new Le(this,e,t)}publish(e,t){return new Ye(this,e,t)}register(e,t){return new Xe(this,e,t)}subscribe(e,t){return new et(this,e,t)}request(e,t){return new xe(Re,this,e,t)}makeOutgoingRequestMessage(e,t,r,i,n,s,o){const a=this.configuration.sipjsId,c=this.configuration.displayName,d=this.configuration.viaForceRport,l=this.configuration.hackViaTcp,u=this.configuration.supportedOptionTags.slice();e===z.REGISTER&&u.push("path","gruu"),e===z.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&u.push("gruu");const h={callIdPrefix:a,forceRport:d,fromDisplayName:c,hackViaTcp:l,optionTags:u,routeSet:this.configuration.routeSet,userAgentString:this.configuration.userAgentHeaderFieldValue,viaHost:this.configuration.viaHost},p=Object.assign(Object.assign({},h),n);return new $(e,t,r,i,p,s,o)}receiveIncomingRequestFromTransport(e){this.receiveRequestFromTransport(e)}receiveIncomingResponseFromTransport(e){this.receiveResponseFromTransport(e)}replyStateless(e,t){const r=this.configuration.userAgentHeaderFieldValue,i=this.configuration.supportedOptionTagsResponse;t=Object.assign(Object.assign({},t),{userAgent:r,supported:i});const n=Te(e,t);return this.transport.send(n.message).catch(t=>{t instanceof Error&&this.logger.error(t.message),this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`)}),n}receiveRequestFromTransport(e){const t=e.viaBranch,r=this.userAgentServers.get(t);e.method===z.ACK&&r&&r.transaction.state===ue.Accepted&&r instanceof tt?this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`):e.method!==z.CANCEL?r?r.transaction.receiveRequest(e):this.receiveRequest(e):r?(this.replyStateless(e,{statusCode:200}),r.transaction instanceof Ie&&r.transaction.state===ue.Proceeding&&r instanceof tt&&r.receiveCancel(e)):this.replyStateless(e,{statusCode:481})}receiveRequest(e){if(!W.includes(e.method)){const t="Allow: "+W.toString();return void this.replyStateless(e,{statusCode:405,extraHeaders:[t]})}if(!e.ruri)throw new Error("Request-URI undefined.");if("sip"!==e.ruri.scheme)return void this.replyStateless(e,{statusCode:416});const t=e.ruri,r=e=>!!e&&e.user===t.user;if(!r(this.configuration.aor)&&!(r(this.configuration.contact.uri)||r(this.configuration.contact.pubGruu)||r(this.configuration.contact.tempGruu)))return this.logger.warn("Request-URI does not point to us."),void(e.method!==z.ACK&&this.replyStateless(e,{statusCode:404}));if(e.method!==z.INVITE||e.hasHeader("Contact")){if(!e.toTag){const t=e.viaBranch;if(!this.userAgentServers.has(t)){if(Array.from(this.userAgentServers.values()).some(t=>t.transaction.request.fromTag===e.fromTag&&t.transaction.request.callId===e.callId&&t.transaction.request.cseq===e.cseq))return void this.replyStateless(e,{statusCode:482})}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}else this.replyStateless(e,{statusCode:400,reasonPhrase:"Missing Contact Header"})}receiveInsideDialogRequest(e){if(e.method===z.NOTIFY){const t=e.parseHeader("Event");if(!t||!t.event)return void this.replyStateless(e,{statusCode:489});const r=e.callId+e.toTag+t.event,i=this.subscribers.get(r);if(i){const t=new Ue(this,e);return void i.onNotify(t)}}const t=e.callId+e.toTag+e.fromTag,r=this.dialogs.get(t);if(r){if(e.method===z.OPTIONS){const t="Allow: "+W.toString(),r="Accept: "+nt.toString();return void this.replyStateless(e,{statusCode:200,extraHeaders:[t,r]})}r.receiveRequest(e)}else e.method!==z.ACK&&this.replyStateless(e,{statusCode:481})}receiveOutsideDialogRequest(e){switch(e.method){case z.ACK:break;case z.BYE:this.replyStateless(e,{statusCode:481});break;case z.CANCEL:throw new Error(`Unexpected out of dialog request method ${e.method}.`);case z.INFO:this.replyStateless(e,{statusCode:405});break;case z.INVITE:{const t=new tt(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject()}break;case z.MESSAGE:{const t=new He(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case z.NOTIFY:{const t=new Ue(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405})}break;case z.OPTIONS:{const t="Allow: "+W.toString(),r="Accept: "+nt.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,r]})}break;case z.REFER:{const t=new We(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405})}break;case z.REGISTER:{const t=new rt(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405})}break;case z.SUBSCRIBE:{const t=new it(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480})}break;default:throw new Error(`Unexpected out of dialog request method ${e.method}.`)}}receiveResponseFromTransport(e){if(e.getHeaders("via").length>1)return void this.logger.warn("More than one Via header field present in the response, dropping");const t=e.viaBranch+e.method,r=this.userAgentClients.get(t);r?r.transaction.receiveResponse(e):this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`)}}var ot;function at(){return e=>e.audio||e.video?void 0===navigator.mediaDevices?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,e):Promise.resolve(new MediaStream)}function ct(){return{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceTransportPolicy:"all",peerIdentity:void 0,rtcpMuxPolicy:"require"}}!function(e){function t(e,t){let r=t,i=0,n=0;if(e.substring(r,r+2).match(/(^\r\n)/))return-2;for(;0===i;){if(n=e.indexOf("\r\n",r),-1===n)return n;!e.substring(n+2,n+4).match(/(^\r\n)/)&&e.charAt(n+2).match(/(^\s+)/)?r=n+2:i=n}return i}function r(e,t,r,i){const n=t.indexOf(":",r),s=t.substring(r,n).trim(),o=t.substring(n+1,i).trim();let a;switch(s.toLowerCase()){case"via":case"v":e.addHeader("via",o),1===e.getHeaders("via").length?(a=e.parseHeader("Via"),a&&(e.via=a,e.viaBranch=a.branch)):a=0;break;case"from":case"f":e.setHeader("from",o),a=e.parseHeader("from"),a&&(e.from=a,e.fromTag=a.getParam("tag"));break;case"to":case"t":e.setHeader("to",o),a=e.parseHeader("to"),a&&(e.to=a,e.toTag=a.getParam("tag"));break;case"record-route":if(a=C.parse(o,"Record_Route"),-1===a){a=void 0;break}if(!(a instanceof Array)){a=void 0;break}a.forEach(t=>{e.addHeader("record-route",o.substring(t.position,t.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=t.parsed});break;case"call-id":case"i":e.setHeader("call-id",o),a=e.parseHeader("call-id"),a&&(e.callId=o);break;case"contact":case"m":if(a=C.parse(o,"Contact"),-1===a){a=void 0;break}if(!(a instanceof Array)){a=void 0;break}a.forEach(t=>{e.addHeader("contact",o.substring(t.position,t.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=t.parsed});break;case"content-length":case"l":e.setHeader("content-length",o),a=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",o),a=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",o),a=e.parseHeader("cseq"),a&&(e.cseq=a.value),e instanceof N&&(e.method=a.method);break;case"max-forwards":e.setHeader("max-forwards",o),a=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",o),a=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",o),a=e.parseHeader("proxy-authenticate");break;case"refer-to":case"r":e.setHeader("refer-to",o),a=e.parseHeader("refer-to"),a&&(e.referTo=a);break;default:e.addHeader(s.toLowerCase(),o),a=0}return void 0!==a||{error:"error parsing header '"+s+"'"}}e.getHeader=t,e.parseHeader=r,e.parseMessage=function(e,i){let n=0,s=e.indexOf("\r\n");if(-1===s)return void i.warn("no CRLF found, not a SIP message, discarded");const o=e.substring(0,s),a=C.parse(o,"Request_Response");let c,d;if(-1!==a){for(a.status_code?(c=new N,c.statusCode=a.status_code,c.reasonPhrase=a.reason_phrase):(c=new M,c.method=a.method,c.ruri=a.uri),c.data=e,n=s+2;;){if(s=t(e,n),-2===s){d=n+2;break}if(-1===s)return void i.error("malformed message");if(!0!==r(c,e,n,s))return void i.error(a.error);n=s+2}return c.hasHeader("content-length")?c.body=e.substr(d,Number(c.getHeader("content-length"))):c.body=e.substring(d),c}i.warn('error parsing first line of SIP message: "'+o+'"')}}(ot||(ot={}));class dt{constructor(e,t,r){e.log("SessionDescriptionHandler.constructor"),this.logger=e,this.mediaStreamFactory=t,this.sessionDescriptionHandlerConfiguration=r,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(null==r?void 0:r.peerConnectionConfiguration);let i=RTCRtpSender.getCapabilities("video");if(i){i.codecs}window.RTCRtpTransceiver&&window.RTCRtpTransceiver.prototype;this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(e){this._peerConnectionDelegate=e}static dispatchAddTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:t}))}static dispatchRemoveTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:t}))}close(){this.logger.log("SessionDescriptionHandler.close"),void 0!==this._peerConnection&&(this._peerConnection.getReceivers().forEach(e=>{e.track&&e.track.stop()}),this._peerConnection.getSenders().forEach(e=>{e.track&&e.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}getDescription(e,t){var r,i;if(this.logger.debug("SessionDescriptionHandler.getDescription"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=null==e?void 0:e.onDataChannel;const n=null===(r=null==e?void 0:e.offerOptions)||void 0===r?void 0:r.iceRestart,s=void 0===(null==e?void 0:e.iceGatheringTimeout)?null===(i=this.sessionDescriptionHandlerConfiguration)||void 0===i?void 0:i.iceGatheringTimeout:null==e?void 0:e.iceGatheringTimeout;return this.getLocalMediaStream(e).then(()=>this.createDataChannel(e)).then(()=>this.createLocalOfferOrAnswer(e)).then(e=>this.applyModifiers(e,t)).then(e=>this.setLocalSessionDescription(e)).then(()=>this.waitForIceGatheringComplete(n,s)).then(()=>this.getLocalSessionDescription()).then(e=>({body:e.sdp,contentType:"application/sdp"})).catch(e=>{throw this.logger.error("SessionDescriptionHandler.getDescription failed - "+e),e})}hasDescription(e){return this.logger.debug("SessionDescriptionHandler.hasDescription"),"application/sdp"===e}sendDtmf(e,t){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),void 0===this._peerConnection)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;const r=this._peerConnection.getSenders();if(0===r.length)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;const i=r[0].dtmf;if(!i)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;const n=null==t?void 0:t.duration,s=null==t?void 0:t.interToneGap;try{i.insertDTMF(e,n,s)}catch(e){return this.logger.error(e),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+e.toString()),!0}setDescription(e,t,r){if(this.logger.log("SessionDescriptionHandler.setDescription"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=null==t?void 0:t.onDataChannel;const i="have-local-offer"===this._peerConnection.signalingState?"answer":"offer";return this.getLocalMediaStream(t).then(()=>this.applyModifiers({sdp:e,type:i},r)).then(e=>this.setRemoteSessionDescription(e)).catch(e=>{throw this.logger.error("SessionDescriptionHandler.setDescription failed - "+e),e})}applyModifiers(e,t){return this.logger.debug("SessionDescriptionHandler.applyModifiers"),t&&0!==t.length?t.reduce((e,t)=>e.then(t),Promise.resolve(e)).then(e=>{if(this.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!e.sdp||!e.type)throw new Error("Invalid SDP.");return{sdp:e.sdp,type:e.type}}):Promise.resolve(e)}createDataChannel(e){if(void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));if(!0!==(null==e?void 0:e.dataChannel))return Promise.resolve();if(this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((null==e?void 0:e.dataChannelLabel)||"",null==e?void 0:e.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(e){return Promise.reject(e)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(e){if(void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.log("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(null==e?void 0:e.offerOptions);case"have-remote-offer":return this.logger.log("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(null==e?void 0:e.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}getLocalMediaStream(e){if(this.logger.log("SessionDescriptionHandler.getLocalMediaStream"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));let t=Object.assign({},null==e?void 0:e.constraints);if(this.localMediaStreamConstraints){if(t.audio=t.audio||this.localMediaStreamConstraints.audio,t.video=t.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(t.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(t.video))return Promise.resolve()}else void 0===t.audio&&void 0===t.video&&(t={audio:!0});return this.localMediaStreamConstraints=t,this.mediaStreamFactory(t,this).then(e=>this.setLocalMediaStream(e))}setLocalMediaStream(e){if(this.logger.log("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");const t=this._peerConnection,r=this._localMediaStream,i=[],n=e=>{const n=e.kind;if("audio"!==n&&"video"!==n)throw new Error(`Unknown new track kind ${n}.`);const s=t.getSenders().find(e=>e.track&&e.track.kind===n);s?i.push(new Promise(e=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${n} track`),e()}).then(()=>s.replaceTrack(e).then(()=>{const t=r.getTracks().find(e=>e.kind===n);t&&(t.stop(),r.removeTrack(t),dt.dispatchRemoveTrackEvent(r,t)),r.addTrack(e),dt.dispatchAddTrackEvent(r,e)}).catch(e=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${n} track`),e}))):i.push(new Promise(e=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${n} track`),e()}).then(()=>{try{t.addTrack(e,r)}catch(e){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${n} track`),e}r.addTrack(e),dt.dispatchAddTrackEvent(r,e)}))},s=e.getAudioTracks();s.length&&n(s[0]);const o=e.getVideoTracks();return o.length&&n(o[0]),i.reduce((e,t)=>e.then(()=>t),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));const e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(new Error("Failed to get local session description"))}setLocalSessionDescription(e){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),void 0===this._peerConnection?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(e)}setRemoteSessionDescription(e){if(this.logger.log("SessionDescriptionHandler.setRemoteSessionDescription"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));const t=e.sdp;let r;switch(this._peerConnection.signalingState){case"stable":r="offer";break;case"have-local-offer":r="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return t?this._peerConnection.setRemoteDescription({sdp:t,type:r}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))}setRemoteTrack(e){this.logger.log("SessionDescriptionHandler.setRemoteTrack");const t=this._remoteMediaStream;t.getTrackById(e.id)?this.logger.log(`SessionDescriptionHandler.setRemoteTrack - have remote ${e.kind} track`):("audio"===e.kind||"video"===e.kind)&&(this.logger.log(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.addTrack(e),dt.dispatchAddTrackEvent(t,e))}iceGatheringComplete(){this.logger.log("SessionDescriptionHandler.iceGatheringComplete"),void 0!==this.iceGatheringCompleteTimeoutId&&(this.logger.log("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),void 0!==this.iceGatheringCompletePromise&&(this.logger.log("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}waitForIceGatheringComplete(e=!1,t=0){return this.logger.log("SessionDescriptionHandler.waitForIceGatheringToComplete"),void 0===this._peerConnection?Promise.reject("Peer connection closed."):e||"complete"!==this._peerConnection.iceGatheringState?(void 0!==this.iceGatheringCompletePromise&&(this.logger.log("SessionDescriptionHandler.waitForIceGatheringToComplete - rejecting prior waiting promise"),this.iceGatheringCompleteReject&&this.iceGatheringCompleteReject(new Error("Promise superseded.")),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0),this.iceGatheringCompletePromise=new Promise((e,r)=>{this.iceGatheringCompleteResolve=e,this.iceGatheringCompleteReject=r,t>0&&(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout in "+t),this.iceGatheringCompleteTimeoutId=setTimeout(()=>{this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout"),this.iceGatheringComplete()},t))}),this.iceGatheringCompletePromise):(this.logger.log("SessionDescriptionHandler.waitForIceGatheringToComplete - already complete"),Promise.resolve())}initPeerConnectionEventHandlers(){if(this.logger.log("SessionDescriptionHandler.initPeerConnectionEventHandlers"),!this._peerConnection)throw new Error("Peer connection undefined.");const e=this._peerConnection;e.onconnectionstatechange=t=>{var r;const i=e.connectionState;this.logger.log("SessionDescriptionHandler.onconnectionstatechange "+i),(null===(r=this._peerConnectionDelegate)||void 0===r?void 0:r.onconnectionstatechange)&&this._peerConnectionDelegate.onconnectionstatechange(t)},e.ondatachannel=e=>{var t;this.logger.log("SessionDescriptionHandler.ondatachannel"),this._dataChannel=e.channel,this.onDataChannel&&this.onDataChannel(this._dataChannel),(null===(t=this._peerConnectionDelegate)||void 0===t?void 0:t.ondatachannel)&&this._peerConnectionDelegate.ondatachannel(e)},e.onicecandidate=e=>{var t;this.logger.log("SessionDescriptionHandler.onicecandidate"),(null===(t=this._peerConnectionDelegate)||void 0===t?void 0:t.onicecandidate)&&this._peerConnectionDelegate.onicecandidate(e)},e.onicecandidateerror=e=>{var t;this.logger.log("SessionDescriptionHandler.onicecandidateerror"),(null===(t=this._peerConnectionDelegate)||void 0===t?void 0:t.onicecandidateerror)&&this._peerConnectionDelegate.onicecandidateerror(e)},e.oniceconnectionstatechange=t=>{var r;const i=e.iceConnectionState;this.logger.log("SessionDescriptionHandler.oniceconnectionstatechange "+i),(null===(r=this._peerConnectionDelegate)||void 0===r?void 0:r.oniceconnectionstatechange)&&this._peerConnectionDelegate.oniceconnectionstatechange(t)},e.onicegatheringstatechange=t=>{var r;const i=e.iceGatheringState;this.logger.log("SessionDescriptionHandler.onicegatheringstatechange "+i),"complete"===i&&this.iceGatheringComplete(),(null===(r=this._peerConnectionDelegate)||void 0===r?void 0:r.onicegatheringstatechange)&&this._peerConnectionDelegate.onicegatheringstatechange(t)},e.onnegotiationneeded=e=>{var t;this.logger.log("SessionDescriptionHandler.onnegotiationneeded"),(null===(t=this._peerConnectionDelegate)||void 0===t?void 0:t.onnegotiationneeded)&&this._peerConnectionDelegate.onnegotiationneeded(e)},e.onsignalingstatechange=t=>{var r;const i=e.signalingState;this.logger.log("SessionDescriptionHandler.onsignalingstatechange "+i),(null===(r=this._peerConnectionDelegate)||void 0===r?void 0:r.onsignalingstatechange)&&this._peerConnectionDelegate.onsignalingstatechange(t)},e.onstatsended=e=>{var t;this.logger.log("SessionDescriptionHandler.onstatsended"),(null===(t=this._peerConnectionDelegate)||void 0===t?void 0:t.onstatsended)&&this._peerConnectionDelegate.onstatsended(e)},e.ontrack=e=>{var t;const r=e.track.kind,i=e.track.enabled?"enabled":"disabled";this.logger.log(`SessionDescriptionHandler.ontrack ${r} ${i}`),this.setRemoteTrack(e.track),(null===(t=this._peerConnectionDelegate)||void 0===t?void 0:t.ontrack)&&this._peerConnectionDelegate.ontrack(e)}}}function lt(e){return(t,r)=>{void 0===e&&(e=at());const i={iceGatheringTimeout:void 0!==(null==r?void 0:r.iceGatheringTimeout)?null==r?void 0:r.iceGatheringTimeout:5e3,peerConnectionConfiguration:Object.assign(Object.assign({},{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceTransportPolicy:"all",peerIdentity:void 0,rtcpMuxPolicy:"require"}),null==r?void 0:r.peerConnectionConfiguration)},n=t.userAgent.getLogger("sip.SessionDescriptionHandler");return new dt(n,e,i)}}class ut{constructor(e,t){if(this._state=ce.Disconnected,this.transitioningState=!1,this._stateEventEmitter=new y,this.logger=e,t){const e=t,r=null==e?void 0:e.wsServers,i=null==e?void 0:e.maxReconnectionAttempts;if(void 0!==r){const e='The transport option "wsServers" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(e)}if(void 0!==i){const e='The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(e)}r&&!t.server&&("string"==typeof r&&(t.server=r),r instanceof Array&&(t.server=r[0]))}this.configuration=Object.assign(Object.assign({},ut.defaultOptions),t);const r=this.configuration.server,i=C.parse(r,"absoluteURI");if(-1===i)throw this.logger.error(`Invalid WebSocket Server URL "${r}"`),new Error("Invalid WebSocket Server URL");if(!["wss","ws","udp"].includes(i.scheme))throw this.logger.error(`Invalid scheme in WebSocket Server URL "${r}"`),new Error("Invalid scheme in WebSocket Server URL");this._protocol=i.scheme.toUpperCase()}dispose(){return this.disconnect()}get protocol(){return this._protocol}get server(){return this.configuration.server}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get ws(){return this._ws}connect(){return this._connect()}disconnect(){return this._disconnect()}isConnected(){return this.state===ce.Connected}send(e){return this._send(e)}_connect(){switch(this.logger.log("Connecting "+this.server),this.state){case ce.Connecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(ce.Connecting));if(!this.connectPromise)throw new Error("Connect promise must be defined.");return this.connectPromise;case ce.Connected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(ce.Connecting));if(this.connectPromise)throw new Error("Connect promise must not be defined.");return Promise.resolve();case ce.Disconnecting:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(ce.Connecting)}catch(e){if(e instanceof m)return Promise.reject(e);throw e}break;case ce.Disconnected:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(ce.Connecting)}catch(e){if(e instanceof m)return Promise.reject(e);throw e}break;default:throw new Error("Unknown state")}let e;try{e=new WebSocket(this.server,"sip"),e.binaryType="arraybuffer",e.addEventListener("close",t=>this.onWebSocketClose(t,e)),e.addEventListener("error",t=>this.onWebSocketError(t,e)),e.addEventListener("open",t=>this.onWebSocketOpen(t,e)),e.addEventListener("message",t=>this.onWebSocketMessage(t,e)),this._ws=e}catch(e){return this._ws=void 0,this.logger.error("WebSocket construction failed."),this.logger.error(e),new Promise((t,r)=>{this.connectResolve=t,this.connectReject=r,this.transitionState(ce.Disconnected,e)})}return this.connectPromise=new Promise((t,r)=>{this.connectResolve=t,this.connectReject=r,this.connectTimeout=setTimeout(()=>{this.logger.warn("Connect timed out. Exceeded time set in configuration.connectionTimeout: "+this.configuration.connectionTimeout+"s."),e.close(1e3)},1e3*this.configuration.connectionTimeout)}),this.connectPromise}_disconnect(){switch(this.logger.log("Disconnecting "+this.server),this.state){case ce.Connecting:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(ce.Disconnecting)}catch(e){if(e instanceof m)return Promise.reject(e);throw e}break;case ce.Connected:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(ce.Disconnecting)}catch(e){if(e instanceof m)return Promise.reject(e);throw e}break;case ce.Disconnecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(ce.Disconnecting));if(!this.disconnectPromise)throw new Error("Disconnect promise must be defined.");return this.disconnectPromise;case ce.Disconnected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(ce.Disconnecting));if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");return Promise.resolve();default:throw new Error("Unknown state")}if(!this._ws)throw new Error("WebSocket must be defined.");const e=this._ws;return this.disconnectPromise=new Promise((t,r)=>{this.disconnectResolve=t,this.disconnectReject=r;try{e.close(1e3)}catch(e){throw this.logger.error("WebSocket close failed."),this.logger.error(e),e}}),this.disconnectPromise}_send(e){if(!0===this.configuration.traceSip&&this.logger.log("Sending WebSocket message:\n\n"+e+"\n"),this._state!==ce.Connected)return Promise.reject(new Error("Not connected."));if(!this._ws)throw new Error("WebSocket undefined.");try{this._ws.send(e)}catch(e){return e instanceof Error?Promise.reject(e):Promise.reject(new Error("WebSocket send failed."))}return Promise.resolve()}onWebSocketClose(e,t){if(t!==this._ws)return;const r=`WebSocket closed ${this.server} (code: ${e.code})`,i=this.disconnectPromise?void 0:new Error(r);i&&this.logger.warn("WebSocket closed unexpectedly"),this.logger.log(r),this._ws=void 0,this.transitionState(ce.Disconnected,i)}onWebSocketError(e,t){t===this._ws&&this.logger.error("WebSocket error occurred.")}onWebSocketMessage(e,t){if(t!==this._ws)return;const r=e.data;let i;if(/^(\r\n)+$/.test(r))return this.clearKeepAliveTimeout(),void(!0===this.configuration.traceSip&&this.logger.log("Received WebSocket message with CRLF Keep Alive response"));if(r){if("string"!=typeof r){try{i=(new TextDecoder).decode(new Uint8Array(r))}catch(e){return this.logger.error(e),void this.logger.error("Received WebSocket binary message failed to be converted into string, message discarded")}!0===this.configuration.traceSip&&this.logger.log("Received WebSocket binary message:\n\n"+i+"\n")}else i=r,!0===this.configuration.traceSip&&this.logger.log("Received WebSocket text message:\n\n"+i+"\n");if(this.state===ce.Connected){if(this.onMessage)try{this.onMessage(i)}catch(e){throw this.logger.error(e),this.logger.error("Exception thrown by onMessage callback"),e}}else this.logger.warn("Received message while not connected, discarding...")}else this.logger.warn("Received empty message, discarding...")}onWebSocketOpen(e,t){t===this._ws&&this._state===ce.Connecting&&(this.logger.log("WebSocket opened "+this.server),this.transitionState(ce.Connected))}transitionLoopDetectedError(e){let t="A state transition loop has been detected.";return t+=` An attempt to transition from ${this._state} to ${e} before the prior transition completed.`,t+=" Perhaps you are synchronously calling connect() or disconnect() from a callback or state change handler?",this.logger.error(t),new m("Loop detected.")}transitionState(e,t){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};if(this.transitioningState)throw this.transitionLoopDetectedError(e);switch(this.transitioningState=!0,this._state){case ce.Connecting:e!==ce.Connected&&e!==ce.Disconnecting&&e!==ce.Disconnected&&r();break;case ce.Connected:e!==ce.Disconnecting&&e!==ce.Disconnected&&r();break;case ce.Disconnecting:e!==ce.Connecting&&e!==ce.Disconnected&&r();break;case ce.Disconnected:e!==ce.Connecting&&r();break;default:throw new Error("Unknown state.")}const i=this._state;this._state=e;const n=this.connectResolve,s=this.connectReject;i===ce.Connecting&&(this.connectPromise=void 0,this.connectResolve=void 0,this.connectReject=void 0);const o=this.disconnectResolve,a=this.disconnectReject;if(i===ce.Disconnecting&&(this.disconnectPromise=void 0,this.disconnectResolve=void 0,this.disconnectReject=void 0),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=void 0),this.logger.log(`Transitioned from ${i} to ${this._state}`),this._stateEventEmitter.emit(this._state),e===ce.Connected&&(this.startSendingKeepAlives(),this.onConnect))try{this.onConnect()}catch(e){throw this.logger.error(e),this.logger.error("Exception thrown by onConnect callback"),e}if(i===ce.Connected&&(this.stopSendingKeepAlives(),this.onDisconnect))try{t?this.onDisconnect(t):this.onDisconnect()}catch(e){throw this.logger.error(e),this.logger.error("Exception thrown by onDisconnect callback"),e}if(i===ce.Connecting){if(!n)throw new Error("Connect resolve undefined.");if(!s)throw new Error("Connect reject undefined.");e===ce.Connected?n():s(t||new Error("Connect aborted."))}if(i===ce.Disconnecting){if(!o)throw new Error("Disconnect resolve undefined.");if(!a)throw new Error("Disconnect reject undefined.");e===ce.Disconnected?o():a(t||new Error("Disconnect aborted."))}this.transitioningState=!1}clearKeepAliveTimeout(){this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveDebounceTimeout=void 0}sendKeepAlive(){return this.keepAliveDebounceTimeout?Promise.resolve():(this.keepAliveDebounceTimeout=setTimeout(()=>{this.clearKeepAliveTimeout()},1e3*this.configuration.keepAliveDebounce),this.send("\r\n\r\n"))}startSendingKeepAlives(){this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},(e=>{const t=.8*e;return 1e3*(Math.random()*(e-t)+t)})(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}}ut.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};class ht{constructor(e={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=de.Stopped,this.unloadListener=()=>{this.stop()},this._stateEventEmitter=new y,this.delegate=e.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ht.defaultOptions()),{sipjsId:I(5)}),{uri:new T("sip","anonymous."+I(6),"anonymous.invalid")}),{viaHost:I(12)+".invalid"}),ht.stripUndefinedProperties(e)),this.options.hackIpInContact)if("boolean"==typeof this.options.hackIpInContact&&this.options.hackIpInContact){const e=1,t=254,r=Math.floor(Math.random()*(t-e+1)+e);this.options.viaHost="192.0.2."+r}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new ye,this.logger=this.loggerFactory.getLogger("UnionRtc"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=le.error;break;case"warn":this.loggerFactory.level=le.warn;break;case"log":this.loggerFactory.level=le.log;break;case"debug":this.loggerFactory.level=le.debug}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(e=>{const t=this.options[e];switch(e){case"uri":case"sessionDescriptionHandlerFactory":this.logger.log("\xb7 "+e+": "+t);break;case"authorizationPassword":this.logger.log("\xb7 "+e+": NOT SHOWN");break;case"transportConstructor":this.logger.log("\xb7 "+e+": "+t.name);break;default:this.logger.log("\xb7 "+e+": "+JSON.stringify(t))}})),this.options.transportOptions){const t=this.options.transportOptions,r=t.maxReconnectionAttempts,i=t.reconnectionTimeout;if(void 0!==r){const e='The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(e)}if(void 0!==i){const e='The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(e)}void 0===e.reconnectionDelay&&void 0!==i&&(this.options.reconnectionDelay=i),void 0===e.reconnectionAttempts&&void 0!==r&&(this.options.reconnectionAttempts=r)}if(void 0!==e.reconnectionDelay){const e='The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(e)}if(void 0!==e.reconnectionAttempts){const e='The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(e)}this._transport=new this.options.transportConstructor(this.getLogger("UnionRtc.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._userAgentCore=this.initCore(),this.options.autoStart&&this.start()}static makeURI(e){return C.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",autoStart:!1,autoStop:!0,delegate:{},contactName:"",displayName:"",forceRport:!1,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,hackWssInTransport:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:"debug",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sessionDescriptionHandlerFactory:lt(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:Z.Unsupported,sipExtensionReplaces:Z.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:ut,transportOptions:{},uri:new T("sip","hrtc","hrtc.hrtc"),userAgentString:"hrtc/0.17.1",viaHost:""}}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,r)=>(void 0!==e[r]&&(t[r]=e[r]),t),{})}get configuration(){return this.options}get contact(){return this._contact}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,t){return this.loggerFactory.getLogger(e,t)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===de.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then(()=>this.transport.connect())}start(){if(this.state===de.Started)return this.logger.warn("User agent already started"),Promise.resolve();if(this.logger.log("Starting "+this.configuration.uri),this.transitionState(de.Started),this.options.autoStop){const e=!("undefined"==typeof chrome||!chrome.app||!chrome.app.runtime);"undefined"==typeof window||"function"!=typeof window.addEventListener||e||window.addEventListener("unload",this.unloadListener)}return this.transport.connect()}async stop(){if(this.state===de.Stopped)return this.logger.warn("User agent already stopped"),Promise.resolve();if(this.logger.log("Stopping "+this.configuration.uri),this.transitionState(de.Stopped),this.options.autoStop){const e=!("undefined"==typeof chrome||!chrome.app||!chrome.app.runtime);"undefined"!=typeof window&&window.removeEventListener&&!e&&window.removeEventListener("unload",this.unloadListener)}const e=Object.assign({},this._publishers),t=Object.assign({},this._registerers),r=Object.assign({},this._sessions),i=Object.assign({},this._subscriptions),n=this.transport,s=this.userAgentCore;this.logger.log("Dispose of registerers");for(const e in t)t[e]&&await t[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._registerers[e],t});this.logger.log("Dispose of sessions");for(const e in r)r[e]&&await r[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._sessions[e],t});this.logger.log("Dispose of subscriptions");for(const e in i)i[e]&&await i[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._subscriptions[e],t});this.logger.log("Dispose of publishers");for(const t in e)e[t]&&await e[t].dispose().catch(e=>{throw this.logger.error(e.message),delete this._publishers[t],e});this.logger.log("Dispose of transport"),await n.dispose().catch(e=>{throw this.logger.error(e.message),e}),this.logger.log("Dispose of core"),s.dispose()}_makeInviter(e,t){return new re(this,e,t)}attemptReconnection(e=1){const t=this.options.reconnectionAttempts,r=this.options.reconnectionDelay;e>t?this.logger.log("Maximum reconnection attempts reached"):(this.logger.log(`Reconnection attempt ${e} of ${t} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${t} - succeeded`)}).catch(r=>{this.logger.error(r.message),this.logger.log(`Reconnection attempt ${e} of ${t} - failed`),this.attemptReconnection(++e)})},1===e?0:1e3*r))}initContact(){const e=""!=this.options.contactName?this.options.contactName:I(8),t=this.options.hackWssInTransport?"wss":"ws";return{pubGruu:void 0,tempGruu:void 0,uri:new T("sip",e,this.options.viaHost,void 0,{transport:t}),toString:(e={})=>{const r=e.anonymous||!1,i=e.outbound||!1;let n="<";return n+=r?this.contact.tempGruu||"sip:anonymous@anonymous.invalid;transport="+t:this.contact.pubGruu||this.contact.uri,i&&(n+=";ob"),n+=">",n}}}initCore(){let e=[];e.push("outbound"),this.options.sipExtension100rel===Z.Supported&&e.push("100rel"),this.options.sipExtensionReplaces===Z.Supported&&e.push("replaces"),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(e=>ee[e])),e=Array.from(new Set(e));const t=e.slice();(this.contact.pubGruu||this.contact.tempGruu)&&t.push("gruu");const r={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:t,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{const e=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,t=this.options.authorizationPassword?this.options.authorizationPassword:void 0,r=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new Se(this.getLoggerFactory(),r,e,t)},transportAccessor:()=>this.transport};return new st(r,{onInvite:e=>{var t;const r=new te(this,e);if(e.delegate={onCancel:e=>{r._onCancel(e)},onTransportError:e=>{this.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},e.trying(),this.options.sipExtensionReplaces!==Z.Unsupported){const t=e.message.parseHeader("replaces");if(t){const e=t.call_id;if("string"!=typeof e)throw new Error("Type of call id is not string");const i=t.replaces_to_tag;if("string"!=typeof i)throw new Error("Type of to tag is not string");const n=t.replaces_from_tag;if("string"!=typeof n)throw new Error("type of from tag is not string");const s=e+i+n,o=this.userAgentCore.dialogs.get(s);if(!o)return void r.reject({statusCode:481});if(!o.early&&!0===t.early_only)return void r.reject({statusCode:486});const a=this._sessions[e+n]||this._sessions[e+i]||void 0;if(!a)throw new Error("Session does not exist.");r._replacee=a}}if(null===(t=this.delegate)||void 0===t?void 0:t.onInvite)return r.autoSendAnInitialProvisionalResponse?void r.progress().then(()=>{var e;if(void 0===(null===(e=this.delegate)||void 0===e?void 0:e.onInvite))throw new Error("onInvite undefined.");this.delegate.onInvite(r)}):void this.delegate.onInvite(r);r.reject({statusCode:486})},onMessage:e=>{if(this.delegate&&this.delegate.onMessage){const t=new K(e);this.delegate.onMessage(t)}else e.accept()},onNotify:e=>{if(this.delegate&&this.delegate.onNotify){const t=new J(e);this.delegate.onNotify(t)}else this.options.allowLegacyNotifications?e.accept():e.reject({statusCode:481})},onRefer:e=>{this.logger.warn("Received an out of dialog REFER request"),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(e):e.reject({statusCode:405})},onRegister:e=>{this.logger.warn("Received an out of dialog REGISTER request"),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(e):e.reject({statusCode:405})},onSubscribe:e=>{this.logger.warn("Received an out of dialog SUBSCRIBE request"),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(e):e.reject({statusCode:405})}})}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==de.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==de.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){const t=ot.parseMessage(e,this.getLogger("UnionRtc.Parser"));if(!t)return void this.logger.warn("Failed to parse incoming message. Dropping.");if(this.state===de.Stopped&&t instanceof M)return void this.logger.warn(`Received ${t.method} request while stopped. Dropping.`);const r=()=>{const e=["from","to","call_id","cseq","via"];for(const r of e)if(!t.hasHeader(r))return this.logger.warn(`Missing mandatory header field : ${r}.`),!1;return!0};if(t instanceof M){if(!r())return void this.logger.warn("Request missing mandatory header field. Dropping.");if(!t.toTag&&t.callId.substr(0,5)===this.options.sipjsId)return void this.userAgentCore.replyStateless(t,{statusCode:482});const e=D(t.body),i=t.getHeader("content-length");if(i&&e<Number(i))return void this.userAgentCore.replyStateless(t,{statusCode:400})}if(t instanceof N){if(!r())return void this.logger.warn("Response missing mandatory header field. Dropping.");if(t.getHeaders("via").length>1)return void this.logger.warn("More than one Via header field present in the response. Dropping.");if(t.via.host!==this.options.viaHost||void 0!==t.via.port)return void this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");const e=D(t.body),i=t.getHeader("content-length");if(i&&e<Number(i))return void this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.")}if(t instanceof M)this.userAgentCore.receiveIncomingRequestFromTransport(t);else{if(!(t instanceof N))throw new Error("Invalid message type.");this.userAgentCore.receiveIncomingResponseFromTransport(t)}}transitionState(e,t){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case de.Started:e!==de.Stopped&&r();break;case de.Stopped:e!==de.Started&&r();break;default:throw new Error("Unknown state.")}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}}class pt extends xe{constructor(e,t,r){super(Re,e,t,r)}}class gt extends Me{constructor(e,t,r){super(Oe,e.userAgentCore,t,r)}}const ft=(e,t)=>{const r=[],i=e.split(/\r\n/);let n;for(let e=0;e<i.length;){const s=i[e];if(/^m=(?:audio|video)/.test(s))n={index:e,stripped:[]},r.push(n);else if(n){const r=/^a=rtpmap:(\d+) ([^/]+)\//.exec(s);if(r&&t===r[2]){i.splice(e,1),n.stripped.push(r[1]);continue}}e++}for(const e of r){const t=i[e.index].split(" ");for(let r=3;r<t.length;)-1===e.stripped.indexOf(t[r])?r++:t.splice(r,1);i[e.index]=t.join(" ")}return i.join("\r\n")};function mt(e){return e.sdp=(e.sdp||"").replace(/^a=candidate:\d+ \d+ tcp .*?\r\n/gim,""),Promise.resolve(e)}function vt(e){return e.sdp=ft(e.sdp||"","telephone-event"),Promise.resolve(e)}function yt(e){return e.sdp=(e.sdp||"").replace(/^(a=imageattr:.*?)(x|y)=\[0-/gm,"$1$2=[1:"),Promise.resolve(e)}function bt(e){return e.sdp=ft(e.sdp||"","G722"),Promise.resolve(e)}function wt(e){return t=>(t.sdp=ft(t.sdp||"",e),Promise.resolve(t))}function St(e){return e.sdp=((e,t)=>{const r=new RegExp("m="+t+".*$","gm"),i=new RegExp("^a=group:.*$","gm");if(r.test(e)){let r;const n=(e=e.split(/^m=/gm).filter(e=>{if(e.substr(0,t.length)===t){if(r=e.match(/^a=mid:.*$/gm),r){const e=r[0].match(/:.+$/g);e&&(r=e[0].substr(1))}return!1}return!0}).join("m=")).match(i);if(n&&1===n.length){let t=n[0];const s=new RegExp(" *"+r+"[^ ]*","g");t=t.replace(s,""),e=e.split(i).join(t)}}return e})(e.sdp||"","video"),Promise.resolve(e)}function Tt(e){let t=e.sdp||"";if(-1===t.search(/^a=mid.*$/gm)){const r=t.match(/^m=.*$/gm),i=t.split(/^m=.*$/gm);r&&r.forEach((e,t)=>{r[t]=e+"\na=mid:"+t}),i.forEach((e,t)=>{r&&r[t]&&(i[t]=e+r[t])}),t=i.join(""),e.sdp=t}return Promise.resolve(e)}function _t(e){if(!e.sdp||!e.type)throw new Error("Invalid SDP");let t=e.sdp;const r=e.type;return t&&(/a=(sendrecv|sendonly|recvonly|inactive)/.test(t)?(t=t.replace(/a=sendrecv\r\n/g,"a=sendonly\r\n"),t=t.replace(/a=recvonly\r\n/g,"a=inactive\r\n")):t=t.replace(/(m=[^\r]*\r\n)/g,"$1a=sendonly\r\n")),Promise.resolve({sdp:t,type:r})}class Et{constructor(e,t={}){this.attemptingReconnection=!1,this.connectRequested=!1,this.held=!1,this.registerer=void 0,this.registerRequested=!1,this.session=void 0,this.delegate=t.delegate,this.options=Object.assign({},t);const r=Object.assign({},t.userAgentOptions);if(r.transportConstructor||(r.transportConstructor=ut),r.transportOptions||(r.transportOptions={server:e}),!r.uri&&t.aor){const e=ht.makeURI(t.aor);if(!e)throw new Error("Failed to create valid URI from "+t.aor);r.uri=e}this.userAgent=new ht(r),this.userAgent.delegate={onConnect:()=>{this.logger.log(`[${this.id}] Connected`),this.delegate&&this.delegate.onServerConnect&&this.delegate.onServerConnect(),this.registerer&&this.registerRequested&&(this.logger.log(`[${this.id}] Registering...`),this.registerer.register().catch(e=>{this.logger.error(`[${this.id}] Error occurred registering after connection with server was obtained.`),this.logger.error(e.toString())}))},onDisconnect:e=>{this.logger.log(`[${this.id}] Disconnected`),this.delegate&&this.delegate.onServerDisconnect&&this.delegate.onServerDisconnect(e),this.session&&(this.logger.log(`[${this.id}] Hanging up...`),this.hangup().catch(e=>{this.logger.error(`[${this.id}] Error occurred hanging up call after connection with server was lost.`),this.logger.error(e.toString())})),this.registerer&&(this.logger.log(`[${this.id}] Unregistering...`),this.registerer.unregister().catch(e=>{this.logger.error(`[${this.id}] Error occurred unregistering after connection with server was lost.`),this.logger.error(e.toString())})),e&&this.attemptReconnection()},onInvite:e=>{if(this.logger.log(`[${this.id}] Received INVITE`),this.session)return this.logger.warn(`[${this.id}] Session already in progress, rejecting INVITE...`),void e.reject().then(()=>{this.logger.log(`[${this.id}] Rejected INVITE`)}).catch(e=>{this.logger.error(`[${this.id}] Failed to reject INVITE`),this.logger.error(e.toString())});const t={sessionDescriptionHandlerOptions:{constraints:this.constraints}};this.initSession(e,t),this.delegate&&this.delegate.onCallReceived?this.delegate.onCallReceived():(this.logger.warn(`[${this.id}] No handler available, rejecting INVITE...`),e.reject().then(()=>{this.logger.log(`[${this.id}] Rejected INVITE`)}).catch(e=>{this.logger.error(`[${this.id}] Failed to reject INVITE`),this.logger.error(e.toString())}))},onMessage:e=>{e.accept().then(()=>{this.delegate&&this.delegate.onMessageReceived&&this.delegate.onMessageReceived(e.request.body,e.request.getHeader("Content-type"))})}},this.logger=this.userAgent.getLogger("UnionRtc.SimpleUser"),window.addEventListener("online",()=>{this.logger.log(`[${this.id}] Online`),this.attemptReconnection()})}get id(){return this.options.userAgentOptions&&this.options.userAgentOptions.displayName||"Anonymous"}get localMediaStream(){var e;const t=null===(e=this.session)||void 0===e?void 0:e.sessionDescriptionHandler;if(t){if(!(t instanceof dt))throw new Error("Session description handler not instance of web SessionDescriptionHandler");return t.localMediaStream}}get remoteMediaStream(){var e;const t=null===(e=this.session)||void 0===e?void 0:e.sessionDescriptionHandler;if(t){if(!(t instanceof dt))throw new Error("Session description handler not instance of web SessionDescriptionHandler");return t.remoteMediaStream}}get localAudioTrack(){var e;return null===(e=this.localMediaStream)||void 0===e?void 0:e.getTracks().find(e=>"audio"===e.kind)}get localVideoTrack(){var e;return null===(e=this.localMediaStream)||void 0===e?void 0:e.getTracks().find(e=>"video"===e.kind)}get remoteAudioTrack(){var e;return null===(e=this.remoteMediaStream)||void 0===e?void 0:e.getTracks().find(e=>"audio"===e.kind)}get remoteVideoTrack(){var e;return null===(e=this.remoteMediaStream)||void 0===e?void 0:e.getTracks().find(e=>"video"===e.kind)}connect(){return this.logger.log(`[${this.id}] Connecting UserAgent...`),this.connectRequested=!0,this.userAgent.state!==de.Started?this.userAgent.start():this.userAgent.reconnect()}disconnect(){return this.logger.log(`[${this.id}] Disconnecting UserAgent...`),this.connectRequested=!1,this.userAgent.stop()}isConnected(){return this.userAgent.isConnected()}register(e,t){return this.logger.log(`[${this.id}] Registering UserAgent...`),this.registerRequested=!0,this.registerer||(this.registerer=new pe(this.userAgent,e),this.registerer.stateChange.addListener(e=>{switch(e){case se.Initial:break;case se.Registered:this.delegate&&this.delegate.onRegistered&&this.delegate.onRegistered();break;case se.Unregistered:this.delegate&&this.delegate.onUnregistered&&this.delegate.onUnregistered();break;case se.Terminated:this.registerer=void 0;break;default:throw new Error("Unknown registerer state.")}})),this.registerer.register(t).then(()=>{})}unregister(e){return this.logger.log(`[${this.id}] Unregistering UserAgent...`),this.registerRequested=!1,this.registerer?this.registerer.unregister(e).then(()=>{}):Promise.resolve()}call(e,t,r){if(this.logger.log(`[${this.id}] Beginning Session...`),this.session)return Promise.reject(new Error("Session already exists."));const i=ht.makeURI(e);if(!i)return Promise.reject(new Error(`Failed to create a valid URI from "${e}"`));t||(t={}),t.sessionDescriptionHandlerOptions||(t.sessionDescriptionHandlerOptions={}),t.sessionDescriptionHandlerOptions.constraints||(t.sessionDescriptionHandlerOptions.constraints=this.constraints);const n=new re(this.userAgent,i,t);return this.sendInvite(n,t,r).then(()=>{})}hangup(){return this.logger.log(`[${this.id}] Hangup...`),this.terminate()}answer(e){return this.logger.log(`[${this.id}] Accepting Invitation...`),this.session?this.session instanceof te?(e||(e={}),e.sessionDescriptionHandlerOptions||(e.sessionDescriptionHandlerOptions={}),e.sessionDescriptionHandlerOptions.constraints||(e.sessionDescriptionHandlerOptions.constraints=this.constraints),this.session.accept(e)):Promise.reject(new Error("Session not instance of Invitation.")):Promise.reject(new Error("Session does not exist."))}decline(){return this.logger.log(`[${this.id}] rejecting Invitation...`),this.session?this.session instanceof te?this.session.reject():Promise.reject(new Error("Session not instance of Invitation.")):Promise.reject(new Error("Session does not exist."))}hold(){return this.logger.log(`[${this.id}] holding session...`),this.setHold(!0)}unhold(){return this.logger.log(`[${this.id}] unholding session...`),this.setHold(!1)}isHeld(){return this.held}mute(){this.logger.log(`[${this.id}] disabling media tracks...`),this.setMute(!0)}unmute(){this.logger.log(`[${this.id}] enabling media tracks...`),this.setMute(!1)}isMuted(){const e=this.localAudioTrack||this.localVideoTrack;return!!e&&!e.enabled}sendDTMF(e){if(this.logger.log(`[${this.id}] sending DTMF...`),!/^[0-9A-D#*,]$/.exec(e))return Promise.reject(new Error("Invalid DTMF tone."));if(!this.session)return Promise.reject(new Error("Session does not exist."));this.logger.log(`[${this.id}] Sending DTMF tone: ${e}`);const t={body:{contentDisposition:"render",contentType:"application/dtmf-relay",content:"Signal="+e+"\r\nDuration=2000"}};return this.session.info({requestOptions:t}).then(()=>{})}message(e,t){this.logger.log(`[${this.id}] sending message...`);const r=ht.makeURI(e);return r?new ie(this.userAgent,r,t).message():Promise.reject(new Error(`Failed to create a valid URI from "${e}"`))}get constraints(){var e;let t={audio:!0,video:!1};return(null===(e=this.options.media)||void 0===e?void 0:e.constraints)&&(t=Object.assign({},this.options.media.constraints)),t}attemptReconnection(e=1){const t=this.options.reconnectionAttempts||3,r=this.options.reconnectionDelay||4;this.connectRequested?(this.attemptingReconnection&&this.logger.log(`[${this.id}] Reconnection attempt already in progress`),e>t?this.logger.log(`[${this.id}] Reconnection maximum attempts reached`):(1===e?this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - trying`):this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - trying in ${r} seconds`),this.attemptingReconnection=!0,setTimeout(()=>{if(!this.connectRequested)return this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - aborted`),void(this.attemptingReconnection=!1);this.userAgent.reconnect().then(()=>{this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - succeeded`),this.attemptingReconnection=!1}).catch(r=>{this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - failed`),this.logger.error(r.message),this.attemptingReconnection=!1,this.attemptReconnection(++e)})},1===e?0:1e3*r))):this.logger.log(`[${this.id}] Reconnection not currently desired`)}cleanupMedia(){this.options.media&&(this.options.media.local&&this.options.media.local.video&&(this.options.media.local.video.srcObject=null,this.options.media.local.video.pause()),this.options.media.remote&&(this.options.media.remote.audio&&(this.options.media.remote.audio.srcObject=null,this.options.media.remote.audio.pause()),this.options.media.remote.video&&(this.options.media.remote.video.srcObject=null,this.options.media.remote.video.pause())))}enableSenderTracks(e){if(!this.session)throw new Error("Session does not exist.");const t=this.session.sessionDescriptionHandler;if(!(t instanceof dt))throw new Error("Session's session description handler not instance of SessionDescriptionHandler.");const r=t.peerConnection;if(!r)throw new Error("Peer connection closed.");r.getSenders().forEach(t=>{t.track&&(t.track.enabled=e)})}initSession(e,t){this.session=e,this.delegate&&this.delegate.onCallCreated&&this.delegate.onCallCreated(),this.session.stateChange.addListener(t=>{if(this.session===e)switch(this.logger.log(`[${this.id}] session state changed to ${t}`),t){case X.Initial:case X.Establishing:break;case X.Established:this.setupLocalMedia(),this.setupRemoteMedia(),this.delegate&&this.delegate.onCallAnswered&&this.delegate.onCallAnswered();break;case X.Terminating:case X.Terminated:this.session=void 0,this.cleanupMedia(),this.delegate&&this.delegate.onCallHangup&&this.delegate.onCallHangup();break;default:throw new Error("Unknown session state.")}}),this.session.delegate={onInfo:e=>{var t;null==(null===(t=this.delegate)||void 0===t?void 0:t.onCallInfoReceived)&&e.reject();const r=e.request.getHeader("content-type"),i=e.request.body;e.accept().then(()=>{if(this.delegate&&this.delegate.onCallInfoReceived){if(!r||!i)throw new Error("contentType or body undefined.");this.delegate.onCallInfoReceived(r,i)}}).catch(e=>{this.logger.error(e.message)})},onRefer:e=>{e.accept().then(()=>this.sendInvite(e.makeInviter(t),t)).catch(e=>{this.logger.error(e.message)})}}}sendInvite(e,t,r){return this.initSession(e,t),e.invite(r).then(()=>{this.logger.log(`[${this.id}] sent INVITE`)})}setHold(e){if(!this.session)return Promise.reject(new Error("Session does not exist."));const t=this.session;if(this.held===e)return Promise.resolve();if(!(this.session.sessionDescriptionHandler instanceof dt))throw new Error("Session's session description handler not instance of SessionDescriptionHandler.");const r={requestDelegate:{onAccept:()=>{this.held=e,this.delegate&&this.delegate.onCallHold&&this.delegate.onCallHold(this.held)},onReject:()=>{this.logger.warn(`[${this.id}] re-invite request was rejected`),this.delegate&&this.delegate.onCallHold&&this.delegate.onCallHold(this.held)}}};return t.sessionDescriptionHandlerModifiersReInvite=e?[_t]:[],this.session.invite(r).then(()=>{t.sessionDescriptionHandlerModifiersReInvite=[],this.enableSenderTracks(!e)}).catch(e=>{throw e instanceof p&&this.logger.error(`[${this.id}] A hold request is already in progress.`),e})}setMute(e){this.session?this.session.state===X.Established?this.enableSenderTracks(!e):this.logger.warn(`[${this.id}] An established session is required to enable/disable media tracks`):this.logger.warn(`[${this.id}] A session is required to enabled/disable media tracks`)}setupLocalMedia(){var e,t;if(!this.session)throw new Error("Session does not exist.");const r=null===(t=null===(e=this.options.media)||void 0===e?void 0:e.local)||void 0===t?void 0:t.video;if(r){const e=this.localMediaStream;if(!e)throw new Error("Local media stream undefiend.");r.srcObject=e,r.volume=0,r.play().catch(e=>{this.logger.error(`[${this.id}] Failed to play local media`),this.logger.error(e.message)})}}setupRemoteMedia(){var e,t,r,i;if(!this.session)throw new Error("Session does not exist.");const n=(null===(t=null===(e=this.options.media)||void 0===e?void 0:e.remote)||void 0===t?void 0:t.video)||(null===(i=null===(r=this.options.media)||void 0===r?void 0:r.remote)||void 0===i?void 0:i.audio);if(n){const e=this.remoteMediaStream;if(!e)throw new Error("Remote media stream undefiend.");n.autoplay=!0,n.srcObject=e,n.play().catch(e=>{this.logger.error(`[${this.id}] Failed to play remote media`),this.logger.error(e.message)}),e.onaddtrack=()=>{this.logger.log(`[${this.id}] Remote media onaddtrack`),n.load(),n.play().catch(e=>{this.logger.error(`[${this.id}] Failed to play remote media`),this.logger.error(e.message)})}}}terminate(){if(this.logger.log(`[${this.id}] Terminating...`),!this.session)return Promise.reject(new Error("Session does not exist."));switch(this.session.state){case X.Initial:if(this.session instanceof re)return this.session.cancel().then(()=>{this.logger.log(`[${this.id}] Inviter never sent INVITE (canceled)`)});if(this.session instanceof te)return this.session.reject().then(()=>{this.logger.log(`[${this.id}] Invitation rejected (sent 480)`)});throw new Error("Unknown session type.");case X.Establishing:if(this.session instanceof re)return this.session.cancel().then(()=>{this.logger.log(`[${this.id}] Inviter canceled (sent CANCEL)`)});if(this.session instanceof te)return this.session.reject().then(()=>{this.logger.log(`[${this.id}] Invitation rejected (sent 480)`)});throw new Error("Unknown session type.");case X.Established:return this.session.bye().then(()=>{this.logger.log(`[${this.id}] Session ended (sent BYE)`)});case X.Terminating:case X.Terminated:break;default:throw new Error("Unknown state")}return this.logger.log(`[${this.id}] Terminating in state ${this.session.state}, no action taken`),Promise.resolve()}}var Ct={WEBRTC_NOT_SUPPORT:"WEBRTC_NOT_SUPPORT",WEBRTC_ICE_CANDIDATE_ERROR:"WEBRTC_ICE_CANDIDATE_ERROR",WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED:"WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED",WEBRTC_ON_REMOTE_STREAMS:"WEBRTC_ON_REMOTE_STREAMS",WEBRTC_ON_LOCAL_STREAM:"WEBRTC_ON_LOCAL_STREAM",WEBRTC_ON_CONNECTION_STATE_CHANGE:"WEBRTC_ON_CONNECTION_STATE_CHANGE",WEBRTC_ON_DATA_CHANNEL_OPEN:"WEBRTC_ON_DATA_CHANNEL_OPEN",WEBRTC_ON_DATA_CHANNEL_CLOSE:"WEBRTC_ON_DATA_CHANNEL_CLOSE",WEBRTC_ON_DATA_CHANNEL_ERR:"WEBRTC_ON_DATA_CHANNEL_ERR",WEBRTC_ON_DATA_CHANNEL_MSG:"WEBRTC_ON_DATA_CHANNEL_MSG",CAPTURE_STREAM_FAILED:"CAPTURE_STREAM_FAILED"};function Rt(){return null!==window.navigator.userAgent.match("Firefox")}const At={MIC:"mic",SCREENCAST:"screen-cast",FILE:"file",MIXED:"mixed"},It={CAMERA:"camera",SCREENCAST:"screen-cast",FILE:"file",MIXED:"mixed"},kt={AUDIO:"audio",VIDEO:"video",AUDIO_AND_VIDEO:"av"};class Pt{constructor(e,t){this.width=e,this.height=t}}let xt=!0,Dt=!0;function Ot(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function Mt(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const s=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,s),n.apply(this,[e,s])};const s=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return s.apply(this,arguments);if(!this._eventMap[t].has(r))return s.apply(this,arguments);const i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,s.apply(this,[e,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function Nt(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(xt=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function $t(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Dt=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function jt(){if("object"==typeof window){if(xt)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Lt(e,t){Dt&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Ht(e){return"[object Object]"===Object.prototype.toString.call(e)}function qt(e){return Ht(e)?Object.keys(e).reduce((function(t,r){const i=Ht(e[r]),n=i?qt(e[r]):e[r],s=i&&!Object.keys(n).length;return void 0===n||s?t:Object.assign(t,{[r]:n})}),{}):e}function Ut(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const s=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&s.push(e)}),s.forEach(t=>{e.forEach(r=>{r.type===i&&r.trackId===t.id&&function e(t,r,i){r&&!i.has(r.id)&&(i.set(r.id,r),Object.keys(r).forEach(n=>{n.endsWith("Id")?e(t,t.get(r[n]),i):n.endsWith("Ids")&&r[n].forEach(r=>{e(t,t.get(r),i)})}))}(e,r,n)})}),n}const Ft=jt;function Bt(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach(e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let s=e.video.facingMode;s=s&&("object"==typeof s?s:{ideal:s});const o=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||o)){let t;if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?t=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then(r=>{let o=(r=r.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&r.length&&t.includes("back")&&(o=r[r.length-1]),o&&(e.video.deviceId=s.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=i(e.video),Ft("chrome: "+JSON.stringify(e)),n(e)})}e.video=i(e.video)}return Ft("chrome: "+JSON.stringify(e)),n(e)},s=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){n(e,e=>{r.webkitGetUserMedia(e,t,e=>{i&&i(s(e))})})}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(s(e))))}}}function Gt(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then(t=>{const i=r.video&&r.video.width,n=r.video&&r.video.height,s=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:s||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function Vt(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function zt(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.track.id):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}),t.stream.getTracks().forEach(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.id):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Mt(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function Wt(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Kt(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const n=function(e){const t={};return e.result().forEach(e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{r[t]=e.stat(t)}),t[r.id]=r}),t},s=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const i=function(e){r(s(n(e)))};return t.apply(this,[i,e])}return new Promise((e,r)=>{t.apply(this,[function(t){e(s(n(t)))},r])}).then(r,i)}}function Jt(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Ut(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Mt(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Ut(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,i;return this.getSenders().forEach(r=>{r.track===e&&(t?i=!0:t=r)}),this.getReceivers().forEach(t=>(t.track===e&&(r?i=!0:r=t),t.track===e)),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Yt(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();r.apply(this,arguments);const i=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),n.apply(this,arguments)}}function Xt(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Yt(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function s(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:r})}function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)}),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const n=this.getSenders().find(e=>e.track===t);if(n)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const s=this._streams[r.id];if(s)s.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=s(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then(e=>s(this,e))}};e.RTCPeerConnection.prototype[t]=i[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=o(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(r=>{this._streams[r].getTracks().find(t=>e.track===t)&&(t=this._streams[r])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Zt(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}))}function Qt(e,t){Mt(e,"negotiationneeded",e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e})}var er=r(42),tr=r.n(er);function rr(e){const t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch(e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function ir(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function nr(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const r=new Event("enabled");r.enabled=e,this.dispatchEvent(r)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const r=tr()(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){let r=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){let t=e.urls||e.url;e.url&&!e.urls&&Lt("RTCIceServer.url","RTCIceServer.urls");const i="string"==typeof t;return i&&(t=[t]),t=t.filter(e=>{if(0===e.indexOf("stun:"))return!1;const t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!r?(r=!0,!0):t&&!r}),delete e.url,e.urls=i?t[0]:t,!!t.length}})}(e.iceServers,t.version),jt("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function sr(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}function or(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){Lt("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function ar(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}function cr(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function dr(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,s]=arguments;return i.apply(this,[e||null]).then(e=>{if(t.version<53&&!n)try{e.forEach(e=>{e.type=r[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))})}return e}).then(n,s)}}function lr(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ur(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Mt(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function hr(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){Lt("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function pr(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function gr(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const i=t.apply(this,arguments);if(r){const{sender:t}=i,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return i})}function fr(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function mr(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function vr(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function yr(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(r=>t.call(this,r,e)),e.getVideoTracks().forEach(r=>t.call(this,r,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach(e=>{r.includes(e.track)&&this.removeTrack(e)})})}}function br(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)})}),t.apply(e,arguments)}}}function wr(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,s=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};let a=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=a,a=function(e,t,r){const i=s.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=a,a=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=a}function Sr(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(Tr(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function Tr(e){return e&&void 0!==e.video?Object.assign({},e,{video:qt(e.video)}):e}function _r(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let i=e.iceServers[r];!i.hasOwnProperty("urls")&&i.hasOwnProperty("url")?(Lt("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Er(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Cr(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function Rr(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Ar=r(10),Ir=r.n(Ar);function kr(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),i=Ir.a.parseCandidate(e.candidate),n=Object.assign(r,i);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Mt(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Pr(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(e){if(!e||!e.sdp)return!1;const t=Ir.a.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=Ir.a.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})},i=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r},n=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},s=function(e,r){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=Ir.a.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i},o=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=i(arguments[0]),t=n(e),r=s(arguments[0],e);let o;o=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>o}),this._sctp=a}return o.apply(this,arguments)}}function xr(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},Mt(e,"datachannel",e=>(t(e.channel,e.target),e))}function Dr(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function Or(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Mr(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=jt,i=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=Ot(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=Ot(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=Ot(r.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=Ot(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),d={browserDetails:i,commonShim:c,extractVersion:Ot,disableLog:Nt,disableWarnings:$t};switch(i.browser){case"chrome":if(!n||!Zt||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),d;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),d;r("adapter.js shimming chrome."),d.browserShim=n,Mr(e,i),Bt(e,i),Vt(e),Zt(e,i),zt(e),Xt(e,i),Wt(e),Kt(e),Jt(e),Qt(e,i),kr(e),Dr(e),Pr(e,i),xr(e),Or(e,i);break;case"firefox":if(!o||!dr||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),d;r("adapter.js shimming firefox."),d.browserShim=o,Mr(e,i),or(e,i),dr(e,i),cr(e),hr(e),lr(e),ur(e),pr(e),gr(e),fr(e),mr(e),vr(e),kr(e),Dr(e),Pr(e,i),xr(e);break;case"edge":if(!s||!nr||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),d;r("adapter.js shimming edge."),d.browserShim=s,rr(e),ir(e),nr(e,i),sr(e),Pr(e,i),xr(e);break;case"safari":if(!a||!t.shimSafari)return r("Safari shim is not included in this adapter release."),d;r("adapter.js shimming safari."),d.browserShim=a,Mr(e,i),_r(e),Cr(e),wr(e),yr(e),br(e),Er(e),Sr(e),Rr(e),kr(e),Pr(e,i),xr(e),Or(e,i);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});class Nr{constructor(e){if(!Object.values(At).some(t=>t===e))throw new TypeError("Invalid source.");this.source=e,this.deviceId=void 0}}class $r{constructor(e){if(!Object.values(It).some(t=>t===e))throw new TypeError("Invalid source.");this.source=e,this.deviceId=void 0,this.resolution=void 0,this.frameRate=void 0}}class jr{constructor(e=!1,t=!1){this.audio=e,this.video=t}}function Lr(e){return"object"==typeof e.video&&e.video.source===It.SCREENCAST}class Hr{static createMediaStream(e){if("object"!=typeof e||!e.audio&&!e.video)return Promise.reject(new TypeError("Invalid constrains"));if(!Lr(e)&&"object"==typeof e.audio&&e.audio.source===At.SCREENCAST)return Promise.reject(new TypeError("Cannot share screen without video."));if(Lr(e)&&null===window.navigator.userAgent.match("Chrome")&&!Rt())return Promise.reject(new TypeError("Screen sharing only supports Chrome and Firefox."));if(Lr(e)&&"object"==typeof e.audio&&e.audio.source!==At.SCREENCAST)return Promise.reject(new TypeError("Cannot capture video from screen cast while capture audio from other source."));if(!e.audio&&!e.video)return Promise.reject(new TypeError("At least one of audio and video must be requested."));const t=Object.create({});return"object"==typeof e.audio&&e.audio.source===At.MIC?(t.audio=Object.create({}),null!==window.navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?t.audio.deviceId=e.audio.deviceId:t.audio.deviceId={exact:e.audio.deviceId}):e.audio.source===At.SCREENCAST?t.audio=!0:t.audio=e.audio,"object"==typeof e.video?(t.video=Object.create({}),"number"==typeof e.video.frameRate&&(t.video.frameRate=e.video.frameRate),e.video.resolution&&e.video.resolution.width&&e.video.resolution.height&&(e.video.source===It.SCREENCAST?(t.video.width=e.video.resolution.width,t.video.height=e.video.resolution.height):(t.video.width=Object.create({}),t.video.width.exact=e.video.resolution.width,t.video.height=Object.create({}),t.video.height.exact=e.video.resolution.height)),"string"==typeof e.video.deviceId&&(t.video.deviceId={exact:e.video.deviceId}),Rt()&&e.video.source===It.SCREENCAST&&(t.video.mediaSource="screen")):t.video=e.video,Lr(e)?navigator.mediaDevices.getDisplayMedia(t):navigator.mediaDevices.getUserMedia(t)}}let qr,Ur;function Fr(e,...t){qr&&qr(e,...t)}function Br(e,...t){Ur&&Ur(e,...t)}var Gr=r(27),Vr=r.n(Gr);console.log("build date:","__BUILD_DATE__"),console.log("version:","__VERSION__");const zr=Ct,Wr=class extends class{constructor(e){this.listener={},this.type=""|e}on(e,t){return this.listener[e]||(this.listener[e]=[]),this.listener[e].push(t),!0}off(e,t){if(this.listener[e]){var r=this.listener[e].indexOf(t);return r>-1&&this.listener[e].splice(r,1),!0}return!1}offAll(){this.listener={}}dispatch(e,t){return!!this.listener[e]&&(this.listener[e].map(e=>{e.apply(null,[t])}),!0)}}{constructor(e){super("RTCPusherPlayer"),this.TAG="[RTCPusherPlayer]";this.options=Object.assign({},{element:"",debug:!1,zlmsdpUrl:"",simulcast:!1,useCamera:!0,audioEnable:!0,videoEnable:!0,recvOnly:!1,resolution:{w:0,h:0},usedatachannel:!1},e),this.options.debug&&(qr=console.log,Ur=console.error),this.e={onicecandidate:this._onIceCandidate.bind(this),ontrack:this._onTrack.bind(this),onicecandidateerror:this._onIceCandidateError.bind(this),onconnectionstatechange:this._onconnectionstatechange.bind(this),ondatachannelopen:this._onDataChannelOpen.bind(this),ondatachannelmsg:this._onDataChannelMsg.bind(this),ondatachannelerr:this._onDataChannelErr.bind(this),ondatachannelclose:this._onDataChannelClose.bind(this)},this._remoteStream=null,this._localStream=null,this._tracks=[],this.pc=new RTCPeerConnection(null),this.pc.onicecandidate=this.e.onicecandidate,this.pc.onicecandidateerror=this.e.onicecandidateerror,this.pc.ontrack=this.e.ontrack,this.pc.onconnectionstatechange=this.e.onconnectionstatechange,this.datachannel=null,this.options.usedatachannel&&(this.datachannel=this.pc.createDataChannel("chat"),this.datachannel.onclose=this.e.ondatachannelclose,this.datachannel.onerror=this.e.ondatachannelerr,this.datachannel.onmessage=this.e.ondatachannelmsg,this.datachannel.onopen=this.e.ondatachannelopen),this.options.recvOnly||!this.options.audioEnable&&!this.options.videoEnable?this.receive():this.start()}receive(){let e=null,t=null;const r={direction:"recvonly",sendEncodings:[]},i={direction:"recvonly",sendEncodings:[]};this.options.videoEnable&&(t=this.pc.addTransceiver("video",i)),this.options.audioEnable&&(e=this.pc.addTransceiver("audio",r)),this.pc.createOffer().then(e=>{Fr(this.TAG,"offer:",e.sdp),this.pc.setLocalDescription(e).then(()=>{Vr()({method:"post",url:this.options.zlmsdpUrl,responseType:"json",data:e.sdp,headers:{"Content-Type":"text/plain;charset=utf-8"}}).then(e=>{let t=e.data;if(0!=t.code)return void this.dispatch(Ct.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,t);let r={};r.sdp=t.sdp,r.type="answer",Fr(this.TAG,"answer:",t.sdp),this.pc.setRemoteDescription(r).then(()=>{Fr(this.TAG,"set remote sucess")}).catch(e=>{Br(this.TAG,e)})})})}).catch(e=>{Br(this.TAG,e)})}start(){let e=!1,t=!1;this.options.useCamera?(this.options.videoEnable&&(e=new $r(It.CAMERA)),this.options.audioEnable&&(t=new Nr(At.MIC))):this.options.videoEnable?(e=new $r(It.SCREENCAST),this.options.audioEnable&&(t=new Nr(At.SCREENCAST))):this.options.audioEnable?t=new Nr(At.MIC):Br(this.TAG,"error paramter"),0!=this.options.resolution.w&&0!=this.options.resolution.h&&"object"==typeof e&&(e.resolution=new Pt(this.options.resolution.w,this.options.resolution.h)),Hr.createMediaStream(new jr(t,e)).then(e=>{this._localStream=e,this.dispatch(Ct.WEBRTC_ON_LOCAL_STREAM,e);const t={direction:"sendrecv",sendEncodings:[]},r={direction:"sendrecv",sendEncodings:[]};this.options.simulcast&&e.getVideoTracks().length>0&&(r.sendEncodings=[{rid:"h",active:!0,maxBitrate:1e6},{rid:"m",active:!0,maxBitrate:5e5,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:2e5,scaleResolutionDownBy:4}]);let i=null,n=null;this.options.audioEnable&&(e.getAudioTracks().length>0?i=this.pc.addTransceiver(e.getAudioTracks()[0],t):(t.direction="recvonly",i=this.pc.addTransceiver("audio",t))),this.options.videoEnable&&(e.getVideoTracks().length>0?n=this.pc.addTransceiver(e.getVideoTracks()[0],r):(r.direction="recvonly",n=this.pc.addTransceiver("video",r))),this.pc.createOffer().then(e=>{Fr(this.TAG,"offer:",e.sdp),this.pc.setLocalDescription(e).then(()=>{Vr()({method:"post",url:this.options.zlmsdpUrl,responseType:"json",data:e.sdp,headers:{"Content-Type":"text/plain;charset=utf-8"}}).then(e=>{let t=e.data;if(0!=t.code)return void this.dispatch(Ct.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,t);let r={};r.sdp=t.sdp,r.type="answer",Fr(this.TAG,"answer:",t.sdp),this.pc.setRemoteDescription(r).then(()=>{Fr(this.TAG,"set remote sucess")}).catch(e=>{Br(this.TAG,e)})})})}).catch(e=>{Br(this.TAG,e)})}).catch(e=>{this.dispatch(Ct.CAPTURE_STREAM_FAILED)})}_onIceCandidate(e){e.candidate&&Fr(this.TAG,"Remote ICE candidate: \n "+e.candidate.candidate)}_onTrack(e){this._tracks.push(e.track),this.options.element&&e.streams&&e.streams.length>0?(this.options.element.srcObject=e.streams[0],this._remoteStream=e.streams[0],this.dispatch(Ct.WEBRTC_ON_REMOTE_STREAMS,e)):this.pc.getReceivers().length==this._tracks.length?(Fr(this.TAG,"play remote stream "),this._remoteStream=new MediaStream(this._tracks),this.options.element.srcObject=this._remoteStream):Br(this.TAG,"wait stream track finish")}_onIceCandidateError(e){this.dispatch(Ct.WEBRTC_ICE_CANDIDATE_ERROR,e)}_onconnectionstatechange(e){this.dispatch(Ct.WEBRTC_ON_CONNECTION_STATE_CHANGE,this.pc.connectionState)}_onDataChannelOpen(e){Fr(this.TAG,"ondatachannel open:",e),this.dispatch(Ct.WEBRTC_ON_DATA_CHANNEL_OPEN,e)}_onDataChannelMsg(e){Fr(this.TAG,"ondatachannel msg:",e),this.dispatch(Ct.WEBRTC_ON_DATA_CHANNEL_MSG,e)}_onDataChannelErr(e){Fr(this.TAG,"ondatachannel err:",e),this.dispatch(Ct.WEBRTC_ON_DATA_CHANNEL_ERR,e)}_onDataChannelClose(e){Fr(this.TAG,"ondatachannel close:",e),this.dispatch(Ct.WEBRTC_ON_DATA_CHANNEL_CLOSE,e)}sendMsg(e){null!=this.datachannel?this.datachannel.send(e):Br(this.TAG,"data channel is null")}closeDataChannel(){this.datachannel&&(this.datachannel.close(),this.datachannel=null)}close(){this.closeDataChannel(),this.pc&&(this.pc.close(),this.pc=null),this.options&&(this.options=null),this._localStream&&this._localStream.getTracks().forEach((e,t)=>{e.stop()}),this._remoteStream&&this._remoteStream.getTracks().forEach((e,t)=>{e.stop()}),this._tracks.forEach((e,t)=>{e.stop()}),this._tracks=[]}get remoteStream(){return this._remoteStream}get localStream(){return this._localStream}},Kr=function(e,t){return new Promise((function(r,i){let n=new $r(It.CAMERA);n.resolution=new Pt(e,t),Hr.createMediaStream(new jr(!1,n)).then(e=>{e.getTracks().forEach(e=>e.stop()),r()}).catch(e=>{i(e)})}))};class Jr{constructor(e,t,r={}){this.attemptingReconnection=!1,this.connectRequested=!1,this.held=!1,this.registerer=void 0,this.registerRequested=!1,this.session=void 0,this.sessionList=new Map,this.videoMonitorRtcList=new Map,this.pushPlayerList=new Map,this.delegate=r.delegate,this.http_prefix=t,this.options=Object.assign({},r);const i=Object.assign({},r.userAgentOptions);if(i.transportConstructor||(i.transportConstructor=ut),i.transportOptions||(i.transportOptions={server:e}),!i.uri&&r.aor){const e=ht.makeURI(r.aor);if(!e)throw new Error("Failed to create valid URI from "+r.aor);i.uri=e}this.userAgent=new ht(i),this.logindata="",this.userAgent.delegate={onConnect:()=>{this.logger.log(`[${this.id}] Connected`),this.delegate&&this.delegate.onServerConnect&&this.delegate.onServerConnect()},onDisconnect:e=>{this.logger.log(`[${this.id}] Disconnected`),this.delegate&&this.delegate.onServerDisconnect&&this.delegate.onServerDisconnect(e);try{this.logger.log(`[${this.id}] Hanging up...`),this.sessionList.forEach(e=>{e._remoteNumber&&this.hangup(e._id,e._remoteNumber).catch(e=>{this.logger.error(`[${this.id}] Error occurred hanging up call after connection with server was lost.`),this.logger.error(e.toString())})})}catch(e){console.log("onDisconnect",e)}this.clearAllSession(),e&&this.attemptReconnection()},onInvite:e=>{this.logger.log(`[${this.id}] Received INVITE from`+e.remoteIdentity.friendlyName),this.sessionList.forEach(t=>{if(t._id==e.remoteIdentity.friendlyName)return this.logger.warn(`[${this.id}] Session already in progress, rejecting INVITE...`),void e.reject().then(()=>{this.logger.log(`[${this.id}] Rejected INVITE`)}).catch(e=>{this.logger.error(`[${this.id}] Failed to reject INVITE`),this.logger.error(e.toString())})});const t={sessionDescriptionHandlerOptions:{constraints:this.constraints}};e.setRemoteNumber(e.remoteIdentity.friendlyName),this.sessionList.delete(e._id),this.sessionList.set(e._id,e),console.log("this.sessionList",this.sessionList),this.initSession(e,t),this.delegate&&this.delegate.onCallReceived?(this.logger.log(`[${e.remoteIdentity.friendlyName}] incoming INVITE...`),this.delegate.onCallReceived(e._id,e.remoteIdentity.friendlyName,e.isVideoCall,e.callType,e.invitation,e.members),console.log("this.sessionList1111",this.sessionList)):(this.logger.warn(`[${this.id}] No handler available, rejecting INVITE...`),e.reject().then(()=>{this.logger.log(`[${this.id}] Rejected INVITE`)}).catch(e=>{this.logger.error(`[${this.id}] Failed to reject INVITE`),this.logger.error(e.toString())}))},onMessage:e=>{e.accept().then(()=>{this.delegate&&this.delegate.onMessageReceived&&(this.logger.log("message from :"+e.request.from.friendlyName.split("@")[0]),this.delegate.onMessageReceived(e.request.body,e.request.getHeader("Content-type"),e.request.from.friendlyName.split("@")[0]))})}},this.logger=this.userAgent.getLogger("UnionRtc.UnionRtc"),window.addEventListener("online",()=>{this.logger.log(`[${this.id}] Online`),this.attemptReconnection()})}get id(){return this.options.userAgentOptions&&this.options.userAgentOptions.displayName||"Anonymous"}getLocalMediaStream(e){const t=null==e?void 0:e.sessionDescriptionHandler;if(t){if(!(t instanceof dt))throw new Error("Session description handler not instance of web SessionDescriptionHandler");return t.localMediaStream}}getRemoteMediaStream(e){const t=null==e?void 0:e.sessionDescriptionHandler;if(t){if(!(t instanceof dt))throw new Error("Session description handler not instance of web SessionDescriptionHandler");return t.remoteMediaStream}}getPeerConn(e){const t=null==e?void 0:e.sessionDescriptionHandler;if(t){if(!(t instanceof dt))throw new Error("Session description handler not instance of web SessionDescriptionHandler");return t.peerConnection}}getLocalAudioTrack(e){var t;return null===(t=this.getLocalMediaStream(e))||void 0===t?void 0:t.getTracks().find(e=>"audio"===e.kind)}muteRemoteAudio(e,t){var r,i;if(!this.sessionExist(e))return void this.logger.warn(`[${this.id}] A session is required to enabled/disable media tracks`);let n=this.getSessionByCallee(e);if(null==n)return void this.logger.warn(`[${this.id}] A session is required to enabled/disable media tracks`);if(n.state!==X.Established)return void this.logger.warn(`[${this.id}] An established session is required to enable/disable media tracks`);let s=null===(r=this.getRemoteMediaStream(n))||void 0===r?void 0:r.getAudioTracks();0!==(null===(i=this.getRemoteMediaStream(n))||void 0===i?void 0:i.getAudioTracks().length)?(s&&(s[0].enabled=!t),n._isRemoteAudioMuted=t):console.log("No remote audio available.")}muteLocalAudio(e,t){var r,i;let n=null===(r=this.getLocalMediaStream(e))||void 0===r?void 0:r.getAudioTracks();0!==(null===(i=this.getLocalMediaStream(e))||void 0===i?void 0:i.getAudioTracks().length)?(n&&(n[0].enabled=t),e._isLocalAudioMuted=t):console.log("No local audio available.")}getLocalVideoTrack(e){var t;return null===(t=this.getLocalMediaStream(e))||void 0===t?void 0:t.getTracks().find(e=>"video"===e.kind)}getRemoteAudioTrack(e){var t;return null===(t=this.getRemoteMediaStream(e))||void 0===t?void 0:t.getTracks().find(e=>"audio"===e.kind)}getRemoteVideoTrack(e){var t;return null===(t=this.getRemoteMediaStream(e))||void 0===t?void 0:t.getTracks().find(e=>"video"===e.kind)}connect(){return this.logger.log(`[${this.id}] Connecting UserAgent...`),this.connectRequested=!0,this.userAgent.state!==de.Started?this.userAgent.start():this.userAgent.reconnect()}disconnect(){return this.logger.log(`[${this.id}] Disconnecting UserAgent...`),this.connectRequested=!1,this.userAgent.stop()}isConnected(){return this.userAgent.isConnected()}register(e,t){return this.logger.log(`[${this.id}] Registering UserAgent...`),this.registerRequested=!0,this.registerer||(this.registerer=new pe(this.userAgent,e),this.registerer.stateChange.addListener(e=>{switch(e){case se.Initial:break;case se.Registered:this.delegate&&this.delegate.onRegistered&&this.delegate.onRegistered();break;case se.Unregistered:this.delegate&&this.delegate.onUnregistered&&this.delegate.onUnregistered();break;case se.Terminated:this.registerer=void 0;break;default:throw new Error("Unknown registerer state.")}})),this.registerer.register(t).then(()=>{})}unregister(e){return this.logger.log(`[${this.id}] Unregistering UserAgent...`),this.registerRequested=!1,this.registerer?this.registerer.unregister(e).then(()=>{}):Promise.resolve()}sessionExist(e){this.sessionList.forEach(e=>{});let t=!1;return this.sessionList.forEach(r=>{var i,n;this.logger.log("sessionExist _remoteNumber "+r._remoteNumber+" callee "+e),(null===(i=r._remoteNumber)||void 0===i?void 0:i.length)===e.length&&(null===(n=r._remoteNumber)||void 0===n?void 0:n.match(e))&&(this.logger.log("find"),t=!0)}),t}getSessionByCallee(e){this.sessionList.forEach(e=>{this.logger.log("getSessionByCallee session id "+e._id+" callee id "+e._remoteNumber)});let t=void 0;return this.sessionList.forEach(r=>{r._remoteNumber===e&&(t=r)}),t}getSessionByCallId(e){this.sessionList.forEach(t=>{if(t._id===e)return t})}call(e,t,r,i,n,s,o){if(this.logger.log(`[${this.id}] Beginning Session...`),this.sessionExist(t))return"";const a=ht.makeURI(e);if(!a)return"";if(r||(r={}),r.sessionDescriptionHandlerOptions||(r.sessionDescriptionHandlerOptions={}),r.sessionDescriptionHandlerOptions.constraints||(r.sessionDescriptionHandlerOptions.constraints=this.constraints),s){const e={media:{local:{video:o},remote:{audio:s,video:s}}};this.options=e}else{const e={media:{remote:{audio:n}}};this.options=e}let c=new re(this.userAgent,a,r);return c.options=this.options,c.setisVideoCall(!!s),c.setRemoteNumber(t),this.sessionList.delete(c._id),this.sessionList.set(c._id,c),this.sendInvite(c,r,i)}hangup(e,t){return this.logger.log(`[${this.id}] Hangup...call id [${e}] callee id [${t}]`),this.terminate(e,t)}sendPttHttpRequest(e,t,r,i,n){var s=new XMLHttpRequest;s.onreadystatechange=function(){s.readyState==XMLHttpRequest.DONE&&(200==s.status?n&&n.onPttControlEvent&&n.onPttControlEvent(t,r,i,s.responseText):400==s.status?console.log("There was an error 400"):console.log("something else other than 200 was returned"))},s.open("GET",e,!0),s.send()}pttcontrol(e,t,r,i,n,s){let o;if(null==this.getSessionByCallee(t))return void this.logger.log("Session does not exist.");o=1==r?"request_talk":"release_talk";let a=this.http_prefix+"://"+n+"/api/client/ptt/audioptt_control.php?roomid="+t+"&number="+i+"&cmd="+o+"&level="+s;this.sendPttHttpRequest(a,e,t,r,this.delegate)}sendVideoMonitorRequest(e,t,r,i,n){var s=new XMLHttpRequest;s.onreadystatechange=function(){s.readyState==XMLHttpRequest.DONE&&(200==s.status?n&&n.onVideoMonitorEvent&&n.onVideoMonitorEvent(t,r,s.responseText):400==s.status?console.log("There was an error 400"):console.log("something else other than 200 was returned"))},s.open("PUT",e,!0),s.setRequestHeader("content-type","application/json"),s.send(i)}sendVideoMonitorRequestPromise(e,t,r,i,n){return new Promise((t,r)=>{var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(200==n.status?t(JSON.parse(n.responseText)):400==n.status?console.log("There was an error 400"):console.log("something else other than 200 was returned"))},n.open("PUT",e,!0),n.setRequestHeader("content-type","application/json"),n.send(i)})}sendMakePtzRequest(e,t,r,i,n){var s=new XMLHttpRequest;s.onreadystatechange=function(){s.readyState==XMLHttpRequest.DONE&&(200==s.status?n&&n.onMakePtzEvent&&n.onMakePtzEvent(t,r,s.responseText):400==s.status?console.log("There was an error 400"):console.log("something else other than 200 was returned"))},s.open("PUT",e,!0),s.setRequestHeader("content-type","application/json"),s.send(i)}sendMakeGbDevicePttRequest(e,t,r,i,n){var s=new XMLHttpRequest;s.onreadystatechange=function(){s.readyState==XMLHttpRequest.DONE&&(200==s.status?n&&n.onMakeGbDevicePttEvent&&n.onMakeGbDevicePttEvent(t,r,s.responseText):400==s.status?console.log("There was an error 400"):console.log("something else other than 200 was returned"))},s.open("PUT",e,!0),s.setRequestHeader("content-type","application/json"),s.send(i)}makeVideoMonitor(e,t,r,i){let n=this.http_prefix+"://"+i+"/api/v1/live/push/start";var s={caller:e,callee:t,token:be.hashStr(e+r)};this.sendVideoMonitorRequest(n,e,t,JSON.stringify(s),this.delegate)}stopVideoMonitor(e,t,r,i){let n=this.http_prefix+"://"+i+"/api/v1/live/push/stop";var s={caller:e,callee:t,token:be.hashStr(e+r)};this.sendVideoMonitorRequest(n,e,t,JSON.stringify(s),void 0)}makeVideoMonitorWebrtcUrl(e,t,r,i){return new Promise((n,s)=>{let o={id:"",state:"200",msg:"\u64ad\u653e\u6210\u529f",data:{}};const a=new Wr({element:r,debug:!1,zlmsdpUrl:t,simulcast:!1,useCamera:!1,audioEnable:!0,videoEnable:!0,recvOnly:!0,resolution:i,usedatachannel:!1});a.on(zr.WEBRTC_ICE_CANDIDATE_ERROR,(function(e){console.log("ICE \u534f\u5546\u51fa\u9519"),o.state="402",o.msg="ICE \u534f\u5546\u51fa\u9519",s(o)})),a.on(zr.WEBRTC_ON_REMOTE_STREAMS,t=>{o.id=e+P();const i={callee:e,player:a,remoteVideo:r};this.videoMonitorRtcList.set(o.id,i),console.log("\u64ad\u653e\u6210\u529f",t.streams),n(o)}),a.on(zr.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(function(e){console.log("offer anwser \u4ea4\u6362\u5931\u8d25",e),stop(),o.state="403",o.msg="offer anwser \u4ea4\u6362\u5931\u8d25",s(o)}))})}stopVideoMonitorWebrtc(e){let t=this.videoMonitorRtcList.get(e);if(!t)return;let r=t.player;if(console.log("stopVideoMonitorWebrtc",t),r){r.close(),r=null;let i=t.remoteVideo;i&&(i.srcObject=null,i.load()),this.videoMonitorRtcList.delete(e)}}makePushStreamWebrtc(e,t,r,i,n=!0,s=!0){return new Promise(async(o,a)=>{let c={id:"",state:"200",msg:"\u63a8\u6d41\u6210\u529f"};const d=new Wr({debug:!1,zlmsdpUrl:t,simulcast:!1,useCamera:!0,audioEnable:n,videoEnable:s,recvOnly:!1,resolution:r,usedatachannel:!1});d.on(zr.WEBRTC_ON_LOCAL_STREAM,(function(e){console.log("\u83b7\u53d6\u5230\u4e86\u672c\u5730\u6d41"),i&&(i.srcObject=e,i.muted=!0)}));try{await Kr(r.w,r.h)}catch(e){d.close(),c.state="403",c.msg="\u4e0d\u652f\u6301\u6b64\u5206\u8fa8\u7387",a(c)}d.on(zr.WEBRTC_ICE_CANDIDATE_ERROR,(function(e){console.log("ICE \u534f\u5546\u51fa\u9519"),c.state="402",c.msg="ICE \u534f\u5546\u51fa\u9519",a(c)})),d.on(zr.WERTC_API_SUCCESS_RESULT,(function(e){console.log("webrtc \u63a5\u53e3\u8fd4\u56de\u503c==",e),c.id=e.id})),d.on(zr.WEBRTC_ON_CONNECTION_STATE_CHANGE,t=>{if(console.log("RTC \u72b6\u6001\u53d8\u5316",t),"connected"===t){const t={pushNumber:e,player:d};i&&(t.localVideo=i),this.pushPlayerList.set(c.id,t),o(c)}}),d.on(zr.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(function(e){console.log("offer anwser \u4ea4\u6362\u5931\u8d25",e),stop(),c.state="403",c.msg="offer anwser \u4ea4\u6362\u5931\u8d25",a(c)})),d.on(zr.CAPTURE_STREAM_FAILED,(function(e){c.state="403",c.msg="\u83b7\u53d6\u672c\u5730\u6d41\u5931\u8d25",a(c),console.log("\u83b7\u53d6\u672c\u5730\u6d41\u5931\u8d25")}))})}stopPushStreamWebrtc(e){let t=this.pushPlayerList.get(e);if(!t)return;let r=t.player;if(console.log("stopPushStreamWebrtc",t),r){r.close(),r=null;let i=t.localVideo;i&&(i.srcObject=null,i.load()),this.pushPlayerList.delete(e)}}makePtz(e,t,r,i,n){let s=this.http_prefix+"://"+i+"/api/v1/live/ptz";var o={caller:e,callee:t,token:be.hashStr(e+r),ptzcode:n};this.sendMakePtzRequest(s,e,t,JSON.stringify(o),this.delegate)}makeGbDevicePtt(e,t,r,i){let n=this.http_prefix+"://"+i+"/api/v1/live/devicectl";var s={caller:e,callee:t,token:be.hashStr(e+r),cmd:"audioBroadcast"};this.sendMakeGbDevicePttRequest(n,e,t,JSON.stringify(s),this.delegate)}sendloadUsersRequest(e,t,r,i){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(200==n.status?i&&i.onUserListEvent&&i.onUserListEvent(t,n.responseText):400==n.status?console.log("There was an error 400"):console.log("something else other than 200 was returned"))},n.open("POST",e,!0),n.setRequestHeader("content-type","application/json"),n.send(r)}loadUsers(e,t,r){let i=this.http_prefix+"://"+r+"/api/client/departments.php?usernumber="+e;var n={usernumber:e,token:be.hashStr(e+t),limit:"2000"};this.sendloadUsersRequest(i,e,JSON.stringify(n),this.delegate)}sendloadLiveCallsRequest(e,t,r){var i=new XMLHttpRequest;i.onreadystatechange=function(){i.readyState==XMLHttpRequest.DONE&&(200==i.status?r&&r.onLiveCallsEvent&&r.onLiveCallsEvent(t,i.responseText):400==i.status?console.log("There was an error 400"):console.log("something else other than 200 was returned"))},i.open("POST",e,!0),i.send()}loadLiveCalls(e,t,r){let i=e+123,n=be.hashStr(e+i+t),s=this.http_prefix+"://"+r+"/api/client/get_active_calls.php?usernumber="+e+"×tamp="+i+"&sign="+n;this.sendloadLiveCallsRequest(s,e,this.delegate)}sendloadOnlineUserRequest(e,t,r){var i=new XMLHttpRequest;i.onreadystatechange=function(){i.readyState==XMLHttpRequest.DONE&&(200==i.status?r&&r.onUserStatusEvent&&r.onUserStatusEvent(t,i.responseText):400==i.status?console.log("There was an error 400"):console.log("something else other than 200 was returned"))},i.open("POST",e,!0),i.send()}loadUserStatus(e,t,r){let i=e+1235,n=be.hashStr(e+i+t),s=this.http_prefix+"://"+r+"/api/client/get_online_user.php?usernumber="+e+"×tamp="+i+"&sign="+n;this.sendloadOnlineUserRequest(s,e,this.delegate)}makeForceinsert(e,t,r){let i=this.http_prefix+"://"+r+"/api/client/forceinsert.php?extension="+e+"&calleeuuid="+t;return this.request({url:i,responseType:"text"})}makeTeardown(e,t,r){let i=this.http_prefix+"://"+r+"/api/client/teardown.php?extension="+e+"&calleeuuid="+t;return this.request({url:i,responseType:"text"})}request(e){return new Promise((t,r)=>{const{url:i,method:n="GET",headers:s={},data:o=null,responseType:a="json",timeout:c=1e4}=e,d=new XMLHttpRequest;d.open(n.toUpperCase(),i),d.responseType=a,d.timeout=c,Object.keys(s).forEach(e=>{d.setRequestHeader(e,s[e])}),d.onload=function(){this.status>=200&&this.status<300||304===this.status?t(d.response):r(new Error("Request failed with status "+this.status))},d.onerror=function(){r(new Error("Network Error"))},d.ontimeout=function(){r(new Error("Request Timed Out"))},d.send(o)})}answer(e,t,r,i,n,s){this.logger.log(`[${this.id}] Accepting Invitation...${t}`),console.log(this.sessionList);let o=this.getSessionByCallee(t);if(null==o)return this.logger.log("Session does not exist."),Promise.reject(new Error("Session does not exist."));if(!(o instanceof te))return Promise.reject(new Error("Session not instance of Invitation."));if(i){const e={media:{local:{video:n},remote:{audio:i,video:i}}};this.options=e}else{const e={media:{remote:{audio:r}}};this.options=e}o.options=this.options;let a={audio:!0,video:!1};return i&&(a={audio:!0,video:!0}),s||(s={}),s.sessionDescriptionHandlerOptions||(s.sessionDescriptionHandlerOptions={}),s.sessionDescriptionHandlerOptions.constraints||(this.logger.log(`[${this.id}] Accepting Invitation. set constraints ..`),s.sessionDescriptionHandlerOptions.constraints=a),o.accept(s)}decline(e,t){if(this.logger.log(`[${this.id}] rejecting Invitation...`),!this.sessionExist(t))return this.logger.log("Session does not exist"),Promise.reject(new Error("Session does not exist."));let r=this.getSessionByCallee(t);return r instanceof te?r.reject():(this.logger.log("Session not instance of Invitation"),Promise.reject(new Error("Session not instance of Invitation.")))}hold(e){return this.logger.log(`[${this.id}] holding session...`),this.setHold(!0,e)}unhold(e){return this.logger.log(`[${this.id}] unholding session...`),this.setHold(!1,e)}isHeld(){return this.held}mute(e){this.logger.log(`[${this.id}] disabling media tracks...`),this.setMute(!0,e)}unmute(e){this.logger.log(`[${this.id}] enabling media tracks...`),this.setMute(!1,e)}stopLocalStream(e){this.logger.log(`[${this.id}] disabling media tracks...`),this.setstopLocalStream(!0,e)}isMuted(e){const t=this.getLocalAudioTrack(e)||this.getLocalVideoTrack(e);return!!t&&!t.enabled}sendDTMF(e,t){if(this.logger.log(`[${this.id}] sending DTMF...`),!/^[0-9A-D#*,]$/.exec(e))return Promise.reject(new Error("Invalid DTMF tone."));if(!this.sessionExist(t))return Promise.reject(new Error("session does not exist"));this.logger.log(`[${this.id}] Sending DTMF tone: ${e}`);const r={body:{contentDisposition:"render",contentType:"application/dtmf-relay",content:"Signal="+e+"\r\nDuration=2000"}};let i=this.getSessionByCallee(t);return null!=i?i.info({requestOptions:r}).then(()=>{}):Promise.reject(new Error("session does not exist"))}message(e,t){this.logger.log(`[${this.id}] sending message...`);const r=ht.makeURI(e);return r?new ie(this.userAgent,r,t).message():Promise.reject(new Error(`Failed to create a valid URI from "${e}"`))}sendBrMessage(e,t,r){this.logger.log(`[${this.id}] sending message...`);const i=ht.makeURI(e);if(!i)return;const n={};if(t){const e=(n.extraHeaders||[]).slice();e.push("Call-Info: receiver_list="+t),n.extraHeaders=e}return new ie(this.userAgent,i,r,"text/broadcast",n).message()}sendMessage(e,t,r){this.logger.log(`[${this.id}] sendMessage message...`);const i=ht.makeURI(e);if(i)return new ie(this.userAgent,i,t,r).message()}get constraints(){var e;let t={audio:!0,video:!1};return(null===(e=this.options.media)||void 0===e?void 0:e.constraints)&&(t=Object.assign({},this.options.media.constraints)),t}attemptReconnection(e=1){const t=this.options.reconnectionAttempts||3,r=this.options.reconnectionDelay||4;this.connectRequested?(this.attemptingReconnection&&this.logger.log(`[${this.id}] Reconnection attempt already in progress`),e>t?this.logger.log(`[${this.id}] Reconnection maximum attempts reached`):(1===e?this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - trying`):this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - trying in ${r} seconds`),this.attemptingReconnection=!0,setTimeout(()=>{if(!this.connectRequested)return this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - aborted`),void(this.attemptingReconnection=!1);this.userAgent.reconnect().then(()=>{this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - succeeded`),this.attemptingReconnection=!1}).catch(r=>{this.logger.log(`[${this.id}] Reconnection attempt ${e} of ${t} - failed`),this.logger.error(r.message),this.attemptingReconnection=!1,this.attemptReconnection(++e)})},1===e?0:1e3*r))):this.logger.log(`[${this.id}] Reconnection not currently desired`)}cleanupMedia(e){e.options&&e.options.media&&(e.options.media.local&&e.options.media.local.video&&(e.options.media.local.video.srcObject=null,e.options.media.local.video.pause()),e.options.media.remote&&(e.options.media.remote.audio&&(e.options.media.remote.audio.srcObject=null,e.options.media.remote.audio.pause()),e.options.media.remote.video&&(e.options.media.remote.video.srcObject=null,e.options.media.remote.video.pause())))}enableSenderTracks(e,t){if(!t)throw new Error("Session does not exist.");const r=t.sessionDescriptionHandler;if(!(r instanceof dt))throw new Error("Session's session description handler not instance of SessionDescriptionHandler.");const i=r.peerConnection;if(!i)throw new Error("Peer connection closed.");i.getSenders().forEach(t=>{t.track&&"audio"==t.track.kind&&(t.track.enabled=e)})}enableSenderStopTracks(e,t){if(!t)throw new Error("Session does not exist.");const r=t.sessionDescriptionHandler;if(!(r instanceof dt))throw new Error("Session's session description handler not instance of SessionDescriptionHandler.");const i=r.peerConnection;if(!i)throw new Error("Peer connection closed.");i.getSenders().forEach(t=>{t.track&&(t.track.enabled=e,t.track.stop())})}deleteSession(e){this.logger.log("delete session with "+e+" befor session list size "+this.sessionList.size),this.sessionList.delete(e),this.logger.log("delete session with "+e+"after session list size "+this.sessionList.size)}clearAllSession(){this.logger.log("sessionList clearAllSession"+this.sessionList.size),this.sessionList.clear()}initSession(e,t){this.session=e,this.delegate&&this.delegate.onCallCreated&&this.delegate.onCallCreated(),e.stateChange.addListener(t=>{switch(this.logger.log(`[${this.id}] session state changed to ${t}`),t){case X.Initial:case X.Establishing:break;case X.Established:this.setupLocalMedia(e),this.logger.log(`[${this.id}] set up audio video`),this.setupRemoteMedia(e),this.delegate&&this.delegate.onCallAnswered&&this.delegate.onCallAnswered(e._id,e.remoteIdentity.friendlyName.split("@")[0]);break;case X.Terminating:case X.Terminated:this.session=void 0,this.cleanupMedia(e),this.delegate&&this.delegate.onCallHangup&&this.delegate.onCallHangup(e._id,e.remoteIdentity.friendlyName.split("@")[0]),this.deleteSession(e._id);break;default:throw new Error("Unknown session state.")}}),e.delegate={onInfo:t=>{var r;null==(null===(r=this.delegate)||void 0===r?void 0:r.onCallInfoReceived)&&t.reject();const i=t.request.getHeader("content-type"),n=t.request.body;t.accept().then(()=>{if(this.delegate&&this.delegate.onCallInfoReceived){if(!i||!n)throw new Error("contentType or body undefined.");this.delegate.onCallInfoReceived(i,n,e._id,e._remoteNumber)}}).catch(e=>{this.logger.error(e.message)})},onRefer:e=>{e.accept().then(()=>this.sendInvite(e.makeInviter(t),t)).catch(e=>{this.logger.error(e.message)})}}}sendInvite(e,t,r){return this.initSession(e,t),e.invite(r),e._id}setHold(e,t){if(this.sessionExist(t))return Promise.reject(new Error("Session does not exist."));let r=this.getSessionByCallee(t);if(null==r)return Promise.reject(new Error("Session does not exist."));const i=r;if(this.held===e)return Promise.resolve();if(!(r.sessionDescriptionHandler instanceof dt))throw new Error("Session's session description handler not instance of SessionDescriptionHandler.");const n={requestDelegate:{onAccept:()=>{this.held=e,this.delegate&&this.delegate.onCallHold&&this.delegate.onCallHold(this.held)},onReject:()=>{this.logger.warn(`[${this.id}] re-invite request was rejected`),this.delegate&&this.delegate.onCallHold&&this.delegate.onCallHold(this.held)}}};return i.sessionDescriptionHandlerModifiersReInvite=e?[_t]:[],r.invite(n).then(()=>{i.sessionDescriptionHandlerModifiersReInvite=[],this.enableSenderTracks(!e,i)}).catch(e=>{throw e instanceof p&&this.logger.error(`[${this.id}] A hold request is already in progress.`),e})}setMute(e,t){if(!this.sessionExist(t))return void this.logger.warn(`[${this.id}] A session is required to enabled/disable media tracks`);let r=this.getSessionByCallee(t);null!=r?r.state===X.Established?this.enableSenderTracks(!e,r):this.logger.warn(`[${this.id}] An established session is required to enable/disable media tracks`):this.logger.warn(`[${this.id}] A session is required to enabled/disable media tracks`)}setstopLocalStream(e,t){if(!this.sessionExist(t))return void this.logger.warn(`[${this.id}] A session is required to enabled/disable media tracks`);let r=this.getSessionByCallee(t);null!=r?r.state===X.Established?this.enableSenderStopTracks(!e,r):this.logger.warn(`[${this.id}] An established session is required to enable/disable media tracks`):this.logger.warn(`[${this.id}] A session is required to enabled/disable media tracks`)}setupLocalMedia(e){var t,r;if(e.options){this.logger.log("setupLocalMedia");const i=null===(r=null===(t=e.options.media)||void 0===t?void 0:t.local)||void 0===r?void 0:r.video;if(i){const t=this.getLocalMediaStream(e);if(!t)throw new Error("Local media stream undefiend.");i.srcObject=t,i.volume=0,i.play().catch(e=>{this.logger.error(`[${this.id}] Failed to play local media`),this.logger.error(e.message)})}}}setupRemoteMedia(e){var t,r,i,n;if(!this.session)throw new Error("Session does not exist.");const s=(null===(r=null===(t=this.options.media)||void 0===t?void 0:t.remote)||void 0===r?void 0:r.video)||(null===(n=null===(i=this.options.media)||void 0===i?void 0:i.remote)||void 0===n?void 0:n.audio);if(s){const t=this.getRemoteMediaStream(e);if(!t)throw new Error("Remote media stream undefiend.");s.autoplay=!0,s.srcObject=t,s.play().catch(e=>{this.logger.error(`[${this.id}] Failed to play remote media`),this.logger.error(e.message)}),t.onaddtrack=()=>{this.logger.log(`[${this.id}] Remote media onaddtrack`),s.load(),s.play().catch(e=>{this.logger.error(`[${this.id}] Failed to play remote media`),this.logger.error(e.message)})}}else this.logger.error("no media element find")}terminate(e,t){if(this.logger.log(`[${this.id}] Terminating...`),0==this.sessionExist(t))return this.logger.log(`[${this.id}] sessionExist `),Promise.reject(new Error("Session does not exist."));let r=this.getSessionByCallee(t);if(null==r)return this.logger.warn(`[${this.id}] A session is required to enabled/disable media tracks`),Promise.reject(new Error("Session does not exist."));switch(r.state){case X.Initial:if(r instanceof re)return r.cancel().then(()=>{this.logger.log(`[${this.id}] Inviter never sent INVITE (canceled)`)});if(r instanceof te)return r.reject().then(()=>{this.logger.log(`[${this.id}] Invitation rejected (sent 480)`)});throw new Error("Unknown session type.");case X.Establishing:if(r instanceof re)return r.cancel().then(()=>{this.logger.log(`[${this.id}] Inviter canceled (sent CANCEL)`)});if(r instanceof te)return r.reject().then(()=>{this.logger.log(`[${this.id}] Invitation rejected (sent 480)`)});throw new Error("Unknown session type.");case X.Established:return r.bye().then(()=>{this.logger.log(`[${this.id}] Session ended (sent BYE)`)});case X.Terminating:case X.Terminated:break;default:throw new Error("Unknown state")}return this.logger.log(`[${this.id}] Terminating in state ${r.state}, no action taken`),Promise.resolve()}}var Yr;!function(e){e.V1="v1",e.V2="v2"}(Yr||(Yr={}));let Xr={apiUrl:"",lang:"zh_CN"};function Zr(){return Xr}var Qr=function(){this.__data__=[],this.size=0};var ei=function(e,t){return e===t||e!=e&&t!=t};var ti=function(e,t){for(var r=e.length;r--;)if(ei(e[r][0],t))return r;return-1},ri=Array.prototype.splice;var ii=function(e){var t=this.__data__,r=ti(t,e);return!(r<0)&&(r==t.length-1?t.pop():ri.call(t,r,1),--this.size,!0)};var ni=function(e){var t=this.__data__,r=ti(t,e);return r<0?void 0:t[r][1]};var si=function(e){return ti(this.__data__,e)>-1};var oi=function(e,t){var r=this.__data__,i=ti(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this};function ai(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}ai.prototype.clear=Qr,ai.prototype.delete=ii,ai.prototype.get=ni,ai.prototype.has=si,ai.prototype.set=oi;var ci=ai;var di=function(){this.__data__=new ci,this.size=0};var li=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var ui=function(e){return this.__data__.get(e)};var hi=function(e){return this.__data__.has(e)},pi=r(1),gi=pi.a.Symbol,fi=Object.prototype,mi=fi.hasOwnProperty,vi=fi.toString,yi=gi?gi.toStringTag:void 0;var bi=function(e){var t=mi.call(e,yi),r=e[yi];try{e[yi]=void 0;var i=!0}catch(e){}var n=vi.call(e);return i&&(t?e[yi]=r:delete e[yi]),n},wi=Object.prototype.toString;var Si=function(e){return wi.call(e)},Ti=gi?gi.toStringTag:void 0;var _i=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ti&&Ti in Object(e)?bi(e):Si(e)};var Ei=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var Ci,Ri=function(e){if(!Ei(e))return!1;var t=_i(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Ai=pi.a["__core-js_shared__"],Ii=(Ci=/[^.]+$/.exec(Ai&&Ai.keys&&Ai.keys.IE_PROTO||""))?"Symbol(src)_1."+Ci:"";var ki=function(e){return!!Ii&&Ii in e},Pi=Function.prototype.toString;var xi=function(e){if(null!=e){try{return Pi.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Di=/^\[object .+?Constructor\]$/,Oi=Function.prototype,Mi=Object.prototype,Ni=Oi.toString,$i=Mi.hasOwnProperty,ji=RegExp("^"+Ni.call($i).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Li=function(e){return!(!Ei(e)||ki(e))&&(Ri(e)?ji:Di).test(xi(e))};var Hi=function(e,t){return null==e?void 0:e[t]};var qi=function(e,t){var r=Hi(e,t);return Li(r)?r:void 0},Ui=qi(pi.a,"Map"),Fi=qi(Object,"create");var Bi=function(){this.__data__=Fi?Fi(null):{},this.size=0};var Gi=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Vi=Object.prototype.hasOwnProperty;var zi=function(e){var t=this.__data__;if(Fi){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Vi.call(t,e)?t[e]:void 0},Wi=Object.prototype.hasOwnProperty;var Ki=function(e){var t=this.__data__;return Fi?void 0!==t[e]:Wi.call(t,e)};var Ji=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Fi&&void 0===t?"__lodash_hash_undefined__":t,this};function Yi(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Yi.prototype.clear=Bi,Yi.prototype.delete=Gi,Yi.prototype.get=zi,Yi.prototype.has=Ki,Yi.prototype.set=Ji;var Xi=Yi;var Zi=function(){this.size=0,this.__data__={hash:new Xi,map:new(Ui||ci),string:new Xi}};var Qi=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var en=function(e,t){var r=e.__data__;return Qi(t)?r["string"==typeof t?"string":"hash"]:r.map};var tn=function(e){var t=en(this,e).delete(e);return this.size-=t?1:0,t};var rn=function(e){return en(this,e).get(e)};var nn=function(e){return en(this,e).has(e)};var sn=function(e,t){var r=en(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this};function on(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}on.prototype.clear=Zi,on.prototype.delete=tn,on.prototype.get=rn,on.prototype.has=nn,on.prototype.set=sn;var an=on;var cn=function(e,t){var r=this.__data__;if(r instanceof ci){var i=r.__data__;if(!Ui||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new an(i)}return r.set(e,t),this.size=r.size,this};function dn(e){var t=this.__data__=new ci(e);this.size=t.size}dn.prototype.clear=di,dn.prototype.delete=li,dn.prototype.get=ui,dn.prototype.has=hi,dn.prototype.set=cn;var ln=dn;var un=function(e,t){for(var r=-1,i=null==e?0:e.length;++r<i&&!1!==t(e[r],r,e););return e},hn=function(){try{var e=qi(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var pn=function(e,t,r){"__proto__"==t&&hn?hn(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},gn=Object.prototype.hasOwnProperty;var fn=function(e,t,r){var i=e[t];gn.call(e,t)&&ei(i,r)&&(void 0!==r||t in e)||pn(e,t,r)};var mn=function(e,t,r,i){var n=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=i?i(r[a],e[a],a,r,e):void 0;void 0===c&&(c=e[a]),n?pn(r,a,c):fn(r,a,c)}return r};var vn=function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i};var yn=function(e){return null!=e&&"object"==typeof e};var bn=function(e){return yn(e)&&"[object Arguments]"==_i(e)},wn=Object.prototype,Sn=wn.hasOwnProperty,Tn=wn.propertyIsEnumerable,_n=bn(function(){return arguments}())?bn:function(e){return yn(e)&&Sn.call(e,"callee")&&!Tn.call(e,"callee")},En=Array.isArray,Cn=r(5),Rn=/^(?:0|[1-9]\d*)$/;var An=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Rn.test(e))&&e>-1&&e%1==0&&e<t};var In=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},kn={};kn["[object Float32Array]"]=kn["[object Float64Array]"]=kn["[object Int8Array]"]=kn["[object Int16Array]"]=kn["[object Int32Array]"]=kn["[object Uint8Array]"]=kn["[object Uint8ClampedArray]"]=kn["[object Uint16Array]"]=kn["[object Uint32Array]"]=!0,kn["[object Arguments]"]=kn["[object Array]"]=kn["[object ArrayBuffer]"]=kn["[object Boolean]"]=kn["[object DataView]"]=kn["[object Date]"]=kn["[object Error]"]=kn["[object Function]"]=kn["[object Map]"]=kn["[object Number]"]=kn["[object Object]"]=kn["[object RegExp]"]=kn["[object Set]"]=kn["[object String]"]=kn["[object WeakMap]"]=!1;var Pn=function(e){return yn(e)&&In(e.length)&&!!kn[_i(e)]};var xn=function(e){return function(t){return e(t)}},Dn=r(6),On=Dn.a&&Dn.a.isTypedArray,Mn=On?xn(On):Pn,Nn=Object.prototype.hasOwnProperty;var $n=function(e,t){var r=En(e),i=!r&&_n(e),n=!r&&!i&&Object(Cn.a)(e),s=!r&&!i&&!n&&Mn(e),o=r||i||n||s,a=o?vn(e.length,String):[],c=a.length;for(var d in e)!t&&!Nn.call(e,d)||o&&("length"==d||n&&("offset"==d||"parent"==d)||s&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||An(d,c))||a.push(d);return a},jn=Object.prototype;var Ln=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||jn)};var Hn=function(e,t){return function(r){return e(t(r))}},qn=Hn(Object.keys,Object),Un=Object.prototype.hasOwnProperty;var Fn=function(e){if(!Ln(e))return qn(e);var t=[];for(var r in Object(e))Un.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Bn=function(e){return null!=e&&In(e.length)&&!Ri(e)};var Gn=function(e){return Bn(e)?$n(e):Fn(e)};var Vn=function(e,t){return e&&mn(t,Gn(t),e)};var zn=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},Wn=Object.prototype.hasOwnProperty;var Kn=function(e){if(!Ei(e))return zn(e);var t=Ln(e),r=[];for(var i in e)("constructor"!=i||!t&&Wn.call(e,i))&&r.push(i);return r};var Jn=function(e){return Bn(e)?$n(e,!0):Kn(e)};var Yn=function(e,t){return e&&mn(t,Jn(t),e)},Xn=r(17);var Zn=function(e,t){var r=-1,i=e.length;for(t||(t=Array(i));++r<i;)t[r]=e[r];return t};var Qn=function(e,t){for(var r=-1,i=null==e?0:e.length,n=0,s=[];++r<i;){var o=e[r];t(o,r,e)&&(s[n++]=o)}return s};var es=function(){return[]},ts=Object.prototype.propertyIsEnumerable,rs=Object.getOwnPropertySymbols,is=rs?function(e){return null==e?[]:(e=Object(e),Qn(rs(e),(function(t){return ts.call(e,t)})))}:es;var ns=function(e,t){return mn(e,is(e),t)};var ss=function(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e},os=Hn(Object.getPrototypeOf,Object),as=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ss(t,is(e)),e=os(e);return t}:es;var cs=function(e,t){return mn(e,as(e),t)};var ds=function(e,t,r){var i=t(e);return En(e)?i:ss(i,r(e))};var ls=function(e){return ds(e,Gn,is)};var us=function(e){return ds(e,Jn,as)},hs=qi(pi.a,"DataView"),ps=qi(pi.a,"Promise"),gs=qi(pi.a,"Set"),fs=qi(pi.a,"WeakMap"),ms=xi(hs),vs=xi(Ui),ys=xi(ps),bs=xi(gs),ws=xi(fs),Ss=_i;(hs&&"[object DataView]"!=Ss(new hs(new ArrayBuffer(1)))||Ui&&"[object Map]"!=Ss(new Ui)||ps&&"[object Promise]"!=Ss(ps.resolve())||gs&&"[object Set]"!=Ss(new gs)||fs&&"[object WeakMap]"!=Ss(new fs))&&(Ss=function(e){var t=_i(e),r="[object Object]"==t?e.constructor:void 0,i=r?xi(r):"";if(i)switch(i){case ms:return"[object DataView]";case vs:return"[object Map]";case ys:return"[object Promise]";case bs:return"[object Set]";case ws:return"[object WeakMap]"}return t});var Ts=Ss,_s=Object.prototype.hasOwnProperty;var Es=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&_s.call(e,"index")&&(r.index=e.index,r.input=e.input),r},Cs=pi.a.Uint8Array;var Rs=function(e){var t=new e.constructor(e.byteLength);return new Cs(t).set(new Cs(e)),t};var As=function(e,t){var r=t?Rs(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},Is=/\w*$/;var ks=function(e){var t=new e.constructor(e.source,Is.exec(e));return t.lastIndex=e.lastIndex,t},Ps=gi?gi.prototype:void 0,xs=Ps?Ps.valueOf:void 0;var Ds=function(e){return xs?Object(xs.call(e)):{}};var Os=function(e,t){var r=t?Rs(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var Ms=function(e,t,r){var i=e.constructor;switch(t){case"[object ArrayBuffer]":return Rs(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return As(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Os(e,r);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return ks(e);case"[object Set]":return new i;case"[object Symbol]":return Ds(e)}},Ns=Object.create,$s=function(){function e(){}return function(t){if(!Ei(t))return{};if(Ns)return Ns(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();var js=function(e){return"function"!=typeof e.constructor||Ln(e)?{}:$s(os(e))};var Ls=function(e){return yn(e)&&"[object Map]"==Ts(e)},Hs=Dn.a&&Dn.a.isMap,qs=Hs?xn(Hs):Ls;var Us=function(e){return yn(e)&&"[object Set]"==Ts(e)},Fs=Dn.a&&Dn.a.isSet,Bs=Fs?xn(Fs):Us,Gs={};Gs["[object Arguments]"]=Gs["[object Array]"]=Gs["[object ArrayBuffer]"]=Gs["[object DataView]"]=Gs["[object Boolean]"]=Gs["[object Date]"]=Gs["[object Float32Array]"]=Gs["[object Float64Array]"]=Gs["[object Int8Array]"]=Gs["[object Int16Array]"]=Gs["[object Int32Array]"]=Gs["[object Map]"]=Gs["[object Number]"]=Gs["[object Object]"]=Gs["[object RegExp]"]=Gs["[object Set]"]=Gs["[object String]"]=Gs["[object Symbol]"]=Gs["[object Uint8Array]"]=Gs["[object Uint8ClampedArray]"]=Gs["[object Uint16Array]"]=Gs["[object Uint32Array]"]=!0,Gs["[object Error]"]=Gs["[object Function]"]=Gs["[object WeakMap]"]=!1;var Vs=function e(t,r,i,n,s,o){var a,c=1&r,d=2&r,l=4&r;if(i&&(a=s?i(t,n,s,o):i(t)),void 0!==a)return a;if(!Ei(t))return t;var u=En(t);if(u){if(a=Es(t),!c)return Zn(t,a)}else{var h=Ts(t),p="[object Function]"==h||"[object GeneratorFunction]"==h;if(Object(Cn.a)(t))return Object(Xn.a)(t,c);if("[object Object]"==h||"[object Arguments]"==h||p&&!s){if(a=d||p?{}:js(t),!c)return d?cs(t,Yn(a,t)):ns(t,Vn(a,t))}else{if(!Gs[h])return s?t:{};a=Ms(t,h,c)}}o||(o=new ln);var g=o.get(t);if(g)return g;o.set(t,a),Bs(t)?t.forEach((function(n){a.add(e(n,r,i,n,t,o))})):qs(t)&&t.forEach((function(n,s){a.set(s,e(n,r,i,s,t,o))}));var f=u?void 0:(l?d?us:ls:d?Jn:Gn)(t);return un(f||t,(function(n,s){f&&(n=t[s=n]),fn(a,s,e(n,r,i,s,t,o))})),a};var zs=function(e){return Vs(e,4)};function Ws(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ks}=Object.prototype,{getPrototypeOf:Js}=Object,Ys=(Xs=Object.create(null),e=>{const t=Ks.call(e);return Xs[t]||(Xs[t]=t.slice(8,-1).toLowerCase())});var Xs;const Zs=e=>(e=e.toLowerCase(),t=>Ys(t)===e),Qs=e=>t=>typeof t===e,{isArray:eo}=Array,to=Qs("undefined");const ro=Zs("ArrayBuffer");const io=Qs("string"),no=Qs("function"),so=Qs("number"),oo=e=>null!==e&&"object"==typeof e,ao=e=>{if("object"!==Ys(e))return!1;const t=Js(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},co=Zs("Date"),lo=Zs("File"),uo=Zs("Blob"),ho=Zs("FileList"),po=Zs("URLSearchParams");function go(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),eo(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{const n=r?Object.getOwnPropertyNames(e):Object.keys(e),s=n.length;let o;for(i=0;i<s;i++)o=n[i],t.call(null,e[o],o,e)}}function fo(e,t){t=t.toLowerCase();const r=Object.keys(e);let i,n=r.length;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const mo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,vo=e=>!to(e)&&e!==mo;const yo=(bo="undefined"!=typeof Uint8Array&&Js(Uint8Array),e=>bo&&e instanceof bo);var bo;const wo=Zs("HTMLFormElement"),So=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),To=Zs("RegExp"),_o=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};go(r,(r,n)=>{let s;!1!==(s=t(r,n,e))&&(i[n]=s||r)}),Object.defineProperties(e,i)},Eo="abcdefghijklmnopqrstuvwxyz",Co={DIGIT:"0123456789",ALPHA:Eo,ALPHA_DIGIT:Eo+Eo.toUpperCase()+"0123456789"};const Ro=Zs("AsyncFunction");var Ao={isArray:eo,isArrayBuffer:ro,isBuffer:function(e){return null!==e&&!to(e)&&null!==e.constructor&&!to(e.constructor)&&no(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||no(e.append)&&("formdata"===(t=Ys(e))||"object"===t&&no(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ro(e.buffer),t},isString:io,isNumber:so,isBoolean:e=>!0===e||!1===e,isObject:oo,isPlainObject:ao,isUndefined:to,isDate:co,isFile:lo,isBlob:uo,isRegExp:To,isFunction:no,isStream:e=>oo(e)&&no(e.pipe),isURLSearchParams:po,isTypedArray:yo,isFileList:ho,forEach:go,merge:function e(){const{caseless:t}=vo(this)&&this||{},r={},i=(i,n)=>{const s=t&&fo(r,n)||n;ao(r[s])&&ao(i)?r[s]=e(r[s],i):ao(i)?r[s]=e({},i):eo(i)?r[s]=i.slice():r[s]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&go(arguments[e],i);return r},extend:(e,t,r,{allOwnKeys:i}={})=>(go(t,(t,i)=>{r&&no(t)?e[i]=Ws(t,r):e[i]=t},{allOwnKeys:i}),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,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let n,s,o;const a={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),s=n.length;s-- >0;)o=n[s],i&&!i(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&Js(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Ys,kindOfTest:Zs,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const i=e.indexOf(t,r);return-1!==i&&i===r},toArray:e=>{if(!e)return null;if(eo(e))return e;let t=e.length;if(!so(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=r.next())&&!i.done;){const r=i.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const i=[];for(;null!==(r=e.exec(t));)i.push(r);return i},isHTMLForm:wo,hasOwnProperty:So,hasOwnProp:So,reduceDescriptors:_o,freezeMethods:e=>{_o(e,(t,r)=>{if(no(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];no(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},i=e=>{e.forEach(e=>{r[e]=!0})};return eo(e)?i(e):i(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:fo,global:mo,isContextDefined:vo,ALPHABET:Co,generateString:(e=16,t=Co.ALPHA_DIGIT)=>{let r="";const{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r},isSpecCompliantForm:function(e){return!!(e&&no(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(oo(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const n=eo(e)?[]:{};return go(e,(e,t)=>{const s=r(e,i+1);!to(s)&&(n[t]=s)}),t[i]=void 0,n}}return e};return r(e,0)},isAsyncFn:Ro,isThenable:e=>e&&(oo(e)||no(e))&&no(e.then)&&no(e.catch)};function Io(e,t,r,i,n){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),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}Ao.inherits(Io,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:Ao.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ko=Io.prototype,Po={};["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=>{Po[e]={value:e}}),Object.defineProperties(Io,Po),Object.defineProperty(ko,"isAxiosError",{value:!0}),Io.from=(e,t,r,i,n,s)=>{const o=Object.create(ko);return Ao.toFlatObject(e,o,(function(e){return e!==Error.prototype}),e=>"isAxiosError"!==e),Io.call(o,e.message,t,r,i,n),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};var xo=Io;function Do(e){return Ao.isPlainObject(e)||Ao.isArray(e)}function Oo(e){return Ao.endsWith(e,"[]")?e.slice(0,-2):e}function Mo(e,t,r){return e?e.concat(t).map((function(e,t){return e=Oo(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const No=Ao.toFlatObject(Ao,{},null,(function(e){return/^is[A-Z]/.test(e)}));var $o=function(e,t,r){if(!Ao.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(r=Ao.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Ao.isUndefined(t[e])}))).metaTokens,n=r.visitor||d,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Ao.isSpecCompliantForm(t);if(!Ao.isFunction(n))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Ao.isDate(e))return e.toISOString();if(!a&&Ao.isBlob(e))throw new xo("Blob is not supported. Use a Buffer instead.");return Ao.isArrayBuffer(e)||Ao.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,r,n){let a=e;if(e&&!n&&"object"==typeof e)if(Ao.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=JSON.stringify(e);else if(Ao.isArray(e)&&function(e){return Ao.isArray(e)&&!e.some(Do)}(e)||(Ao.isFileList(e)||Ao.endsWith(r,"[]"))&&(a=Ao.toArray(e)))return r=Oo(r),a.forEach((function(e,i){!Ao.isUndefined(e)&&null!==e&&t.append(!0===o?Mo([r],i,s):null===o?r:r+"[]",c(e))})),!1;return!!Do(e)||(t.append(Mo(n,r,s),c(e)),!1)}const l=[],u=Object.assign(No,{defaultVisitor:d,convertValue:c,isVisitable:Do});if(!Ao.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!Ao.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+i.join("."));l.push(r),Ao.forEach(r,(function(r,s){!0===(!(Ao.isUndefined(r)||null===r)&&n.call(t,r,Ao.isString(s)?s.trim():s,i,u))&&e(r,i?i.concat(s):[s])})),l.pop()}}(e),t};function jo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Lo(e,t){this._pairs=[],e&&$o(e,this,t)}const Ho=Lo.prototype;Ho.append=function(e,t){this._pairs.push([e,t])},Ho.toString=function(e){const t=e?function(t){return e.call(this,t,jo)}:jo;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var qo=Lo;function Uo(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Fo(e,t,r){if(!t)return e;const i=r&&r.encode||Uo,n=r&&r.serialize;let s;if(s=n?n(t,r):Ao.isURLSearchParams(t)?t.toString():new qo(t,r).toString(i),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}var Bo=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ao.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Go={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Vo={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:qo,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};var zo=function(e){function t(e,r,i,n){let s=e[n++];const o=Number.isFinite(+s),a=n>=e.length;if(s=!s&&Ao.isArray(i)?i.length:s,a)return Ao.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!o;i[s]&&Ao.isObject(i[s])||(i[s]=[]);return t(e,r,i[s],n)&&Ao.isArray(i[s])&&(i[s]=function(e){const t={},r=Object.keys(e);let i;const n=r.length;let s;for(i=0;i<n;i++)s=r[i],t[s]=e[s];return t}(i[s])),!o}if(Ao.isFormData(e)&&Ao.isFunction(e.entries)){const r={};return Ao.forEachEntry(e,(e,i)=>{t(function(e){return Ao.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),i,r,0)}),r}return null};const Wo={transitional:Go,adapter:Vo.isNode?"http":"xhr",transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=Ao.isObject(e);n&&Ao.isHTMLForm(e)&&(e=new FormData(e));if(Ao.isFormData(e))return i&&i?JSON.stringify(zo(e)):e;if(Ao.isArrayBuffer(e)||Ao.isBuffer(e)||Ao.isStream(e)||Ao.isFile(e)||Ao.isBlob(e))return e;if(Ao.isArrayBufferView(e))return e.buffer;if(Ao.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return $o(e,new Vo.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,i){return Vo.isNode&&Ao.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=Ao.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return $o(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),function(e,t,r){if(Ao.isString(e))try{return(t||JSON.parse)(e),Ao.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Wo.transitional,r=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&Ao.isString(e)&&(r&&!this.responseType||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw xo.from(e,xo.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:Vo.classes.FormData,Blob:Vo.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ao.forEach(["delete","get","head","post","put","patch"],e=>{Wo.headers[e]={}});var Ko=Wo;const Jo=Ao.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 Yo=Symbol("internals");function Xo(e){return e&&String(e).trim().toLowerCase()}function Zo(e){return!1===e||null==e?e:Ao.isArray(e)?e.map(Zo):String(e)}function Qo(e,t,r,i,n){return Ao.isFunction(i)?i.call(this,t,r):(n&&(t=r),Ao.isString(t)?Ao.isString(i)?-1!==t.indexOf(i):Ao.isRegExp(i)?i.test(t):void 0:void 0)}class ea{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function n(e,t,r){const n=Xo(t);if(!n)throw new Error("header name must be a non-empty string");const s=Ao.findKey(i,n);(!s||void 0===i[s]||!0===r||void 0===r&&!1!==i[s])&&(i[s||t]=Zo(e))}const s=(e,t)=>Ao.forEach(e,(e,r)=>n(e,r,t));return Ao.isPlainObject(e)||e instanceof this.constructor?s(e,t):Ao.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?s((e=>{const t={};let r,i,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),r=e.substring(0,n).trim().toLowerCase(),i=e.substring(n+1).trim(),!r||t[r]&&Jo[r]||("set-cookie"===r?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)})),t})(e),t):null!=e&&n(t,e,r),this}get(e,t){if(e=Xo(e)){const r=Ao.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}(e);if(Ao.isFunction(t))return t.call(this,e,r);if(Ao.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Xo(e)){const r=Ao.findKey(this,e);return!(!r||void 0===this[r]||t&&!Qo(0,this[r],r,t))}return!1}delete(e,t){const r=this;let i=!1;function n(e){if(e=Xo(e)){const n=Ao.findKey(r,e);!n||t&&!Qo(0,r[n],n,t)||(delete r[n],i=!0)}}return Ao.isArray(e)?e.forEach(n):n(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const n=t[r];e&&!Qo(0,this[n],n,e,!0)||(delete this[n],i=!0)}return i}normalize(e){const t=this,r={};return Ao.forEach(this,(i,n)=>{const s=Ao.findKey(r,n);if(s)return t[s]=Zo(i),void delete t[n];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(n):String(n).trim();o!==n&&delete t[n],t[o]=Zo(i),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ao.forEach(this,(r,i)=>{null!=r&&!1!==r&&(t[i]=e&&Ao.isArray(r)?r.join(", "):r)}),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 r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[Yo]=this[Yo]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=Xo(e);t[i]||(!function(e,t){const r=Ao.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(e,r,n){return this[i].call(this,t,e,r,n)},configurable:!0})})}(r,e),t[i]=!0)}return Ao.isArray(e)?e.forEach(i):i(e),this}}ea.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ao.reduceDescriptors(ea.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Ao.freezeMethods(ea);var ta=ea;function ra(e,t){const r=this||Ko,i=t||r,n=ta.from(i.headers);let s=i.data;return Ao.forEach(e,(function(e){s=e.call(r,s,n.normalize(),t?t.status:void 0)})),n.normalize(),s}function ia(e){return!(!e||!e.__CANCEL__)}function na(e,t,r){xo.call(this,null==e?"canceled":e,xo.ERR_CANCELED,t,r),this.name="CanceledError"}Ao.inherits(na,xo,{__CANCEL__:!0});var sa=na;var oa=Vo.isStandardBrowserEnv?{write:function(e,t,r,i,n,s){const o=[];o.push(e+"="+encodeURIComponent(t)),Ao.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Ao.isString(i)&&o.push("path="+i),Ao.isString(n)&&o.push("domain="+n),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function aa(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 ca=Vo.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function i(r){let i=r;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 r=i(window.location.href),function(e){const t=Ao.isString(e)?i(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};var da=function(e,t){e=e||10;const r=new Array(e),i=new Array(e);let n,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),d=i[o];n||(n=c),r[s]=a,i[s]=c;let l=o,u=0;for(;l!==s;)u+=r[l++],l%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-n<t)return;const h=d&&c-d;return h?Math.round(1e3*u/h):void 0}};function la(e,t){let r=0;const i=da(50,250);return n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,a=s-r,c=i(a);r=s;const d={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:n};d[t?"download":"upload"]=!0,e(d)}}const ua={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let i=e.data;const n=ta.from(e.headers).normalize(),s=e.responseType;let o;function a(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}Ao.isFormData(i)&&(Vo.isStandardBrowserEnv||Vo.isStandardBrowserWebWorkerEnv?n.setContentType(!1):n.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.set("Authorization","Basic "+btoa(t+":"+r))}const d=aa(e.baseURL,e.url);function l(){if(!c)return;const i=ta.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new xo("Request failed with status code "+r.status,[xo.ERR_BAD_REQUEST,xo.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),a()}),(function(e){r(e),a()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:i,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Fo(d,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=l:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(l)},c.onabort=function(){c&&(r(new xo("Request aborted",xo.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new xo("Network Error",xo.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||Go;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new xo(t,i.clarifyTimeoutError?xo.ETIMEDOUT:xo.ECONNABORTED,e,c)),c=null},Vo.isStandardBrowserEnv){const t=(e.withCredentials||ca(d))&&e.xsrfCookieName&&oa.read(e.xsrfCookieName);t&&n.set(e.xsrfHeaderName,t)}void 0===i&&n.setContentType(null),"setRequestHeader"in c&&Ao.forEach(n.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),Ao.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&"json"!==s&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",la(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",la(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new sa(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const u=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(d);u&&-1===Vo.protocols.indexOf(u)?r(new xo("Unsupported protocol "+u+":",xo.ERR_BAD_REQUEST,e)):c.send(i||null)}))}};Ao.forEach(ua,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});var ha=e=>{e=Ao.isArray(e)?e:[e];const{length:t}=e;let r,i;for(let n=0;n<t&&(r=e[n],!(i=Ao.isString(r)?ua[r.toLowerCase()]:r));n++);if(!i){if(!1===i)throw new xo(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Ao.hasOwnProp(ua,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!Ao.isFunction(i))throw new TypeError("adapter is not a function");return i};function pa(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new sa(null,e)}function ga(e){pa(e),e.headers=ta.from(e.headers),e.data=ra.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ha(e.adapter||Ko.adapter)(e).then((function(t){return pa(e),t.data=ra.call(e,e.transformResponse,t),t.headers=ta.from(t.headers),t}),(function(t){return ia(t)||(pa(e),t&&t.response&&(t.response.data=ra.call(e,e.transformResponse,t.response),t.response.headers=ta.from(t.response.headers))),Promise.reject(t)}))}const fa=e=>e instanceof ta?e.toJSON():e;function ma(e,t){t=t||{};const r={};function i(e,t,r){return Ao.isPlainObject(e)&&Ao.isPlainObject(t)?Ao.merge.call({caseless:r},e,t):Ao.isPlainObject(t)?Ao.merge({},t):Ao.isArray(t)?t.slice():t}function n(e,t,r){return Ao.isUndefined(t)?Ao.isUndefined(e)?void 0:i(void 0,e,r):i(e,t,r)}function s(e,t){if(!Ao.isUndefined(t))return i(void 0,t)}function o(e,t){return Ao.isUndefined(t)?Ao.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function a(r,n,s){return s in t?i(r,n):s in e?i(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t)=>n(fa(e),fa(t),!0)};return Ao.forEach(Object.keys(Object.assign({},e,t)),(function(i){const s=c[i]||n,o=s(e[i],t[i],i);Ao.isUndefined(o)&&s!==a||(r[i]=o)})),r}const va={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{va[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ya={};va.transitional=function(e,t,r){function i(e,t){return"[Axios v1.5.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,s)=>{if(!1===e)throw new xo(i(n," has been removed"+(t?" in "+t:"")),xo.ERR_DEPRECATED);return t&&!ya[n]&&(ya[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,s)}};var ba={assertOptions:function(e,t,r){if("object"!=typeof e)throw new xo("options must be an object",xo.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let n=i.length;for(;n-- >0;){const s=i[n],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new xo("option "+s+" must be "+r,xo.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new xo("Unknown option "+s,xo.ERR_BAD_OPTION)}},validators:va};const wa=ba.validators;class Sa{constructor(e){this.defaults=e,this.interceptors={request:new Bo,response:new Bo}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ma(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:n}=t;void 0!==r&&ba.assertOptions(r,{silentJSONParsing:wa.transitional(wa.boolean),forcedJSONParsing:wa.transitional(wa.boolean),clarifyTimeoutError:wa.transitional(wa.boolean)},!1),null!=i&&(Ao.isFunction(i)?t.paramsSerializer={serialize:i}:ba.assertOptions(i,{encode:wa.function,serialize:wa.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&Ao.merge(n.common,n[t.method]);n&&Ao.forEach(["delete","get","head","post","put","patch","common"],e=>{delete n[e]}),t.headers=ta.concat(s,n);const o=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const c=[];let d;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,u=0;if(!a){const e=[ga.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,c),l=e.length,d=Promise.resolve(t);u<l;)d=d.then(e[u++],e[u++]);return d}l=o.length;let h=t;for(u=0;u<l;){const e=o[u++],t=o[u++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=ga.call(this,h)}catch(e){return Promise.reject(e)}for(u=0,l=c.length;u<l;)d=d.then(c[u++],c[u++]);return d}getUri(e){return Fo(aa((e=ma(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Ao.forEach(["delete","get","head","options"],(function(e){Sa.prototype[e]=function(t,r){return this.request(ma(r||{},{method:e,url:t,data:(r||{}).data}))}})),Ao.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(ma(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Sa.prototype[e]=t(),Sa.prototype[e+"Form"]=t(!0)}));var Ta=Sa;class _a{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 r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const i=new Promise(e=>{r.subscribe(e),t=e}).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e,i,n){r.reason||(r.reason=new sa(e,i,n),t(r.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 _a((function(t){e=t})),cancel:e}}}var Ea=_a;const Ca={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(Ca).forEach(([e,t])=>{Ca[t]=e});var Ra=Ca;const Aa=function e(t){const r=new Ta(t),i=Ws(Ta.prototype.request,r);return Ao.extend(i,Ta.prototype,r,{allOwnKeys:!0}),Ao.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return e(ma(t,r))},i}(Ko);Aa.Axios=Ta,Aa.CanceledError=sa,Aa.CancelToken=Ea,Aa.isCancel=ia,Aa.VERSION="1.5.0",Aa.toFormData=$o,Aa.AxiosError=xo,Aa.Cancel=Aa.CanceledError,Aa.all=function(e){return Promise.all(e)},Aa.spread=function(e){return function(t){return e.apply(null,t)}},Aa.isAxiosError=function(e){return Ao.isObject(e)&&!0===e.isAxiosError},Aa.mergeConfig=ma,Aa.AxiosHeaders=ta,Aa.formToJSON=e=>zo(Ao.isHTMLForm(e)?new FormData(e):e),Aa.getAdapter=ha,Aa.HttpStatusCode=Ra,Aa.default=Aa;var Ia=Aa,ka=r(45);const Pa=new Map,xa=e=>[e.method,e.url].join("&");class Da{addPending(e){this.removePending(e);const t=xa(e),r=new AbortController;e.signal=e.signal||r.signal,Pa.has(t)||Pa.set(t,r)}removeAllPending(){Pa.forEach(e=>{e&&e.abort()}),this.reset()}removePending(e){try{const t=xa(e);if(!t)throw new Error("Invalid URL for the request.");if(Pa.has(t)){const e=Pa.get(t);e&&e.abort(),Pa.delete(t)}}catch(e){console.error("Error while removing pending request:",e)}}reset(){Pa.clear()}}const Oa=Object.prototype.toString;function Ma(e,t){return Oa.call(e)===`[object ${t}]`}function Na(e){return!function(e){return void 0!==e}(e)}function $a(e){return null!==e&&Ma(e,"Object")}function ja(e){return Ua(e)||Ha(e)?0===e.length:e instanceof Map||e instanceof Set?0===e.size:!!$a(e)&&0===Object.keys(e).length}function La(e){return null===e}function Ha(e){return Ma(e,"String")}function qa(e){return"function"==typeof e}function Ua(e){return e&&Array.isArray(e)}var Fa,Ba,Ga,Va=function(e){return Vs(e,5)};!function(e){e.SUCCESS="1",e.ERROR="-1",e.TIMEOUT="1004",e.TYPE="success"}(Fa||(Fa={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(Ba||(Ba={})),function(e){e.JSON="application/json;charset=UTF-8",e.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",e.FORM_DATA="multipart/form-data;charset=UTF-8"}(Ga||(Ga={}));var za=function(e,t,r){(void 0!==r&&!ei(e[t],r)||void 0===r&&!(t in e))&&pn(e,t,r)};var Wa=function(e){return function(t,r,i){for(var n=-1,s=Object(t),o=i(t),a=o.length;a--;){var c=o[e?a:++n];if(!1===r(s[c],c,s))break}return t}}();var Ka=function(e){return yn(e)&&Bn(e)},Ja=Function.prototype,Ya=Object.prototype,Xa=Ja.toString,Za=Ya.hasOwnProperty,Qa=Xa.call(Object);var ec=function(e){if(!yn(e)||"[object Object]"!=_i(e))return!1;var t=os(e);if(null===t)return!0;var r=Za.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Xa.call(r)==Qa};var tc=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var rc=function(e){return mn(e,Jn(e))};var ic=function(e,t,r,i,n,s,o){var a=tc(e,r),c=tc(t,r),d=o.get(c);if(d)za(e,r,d);else{var l=s?s(a,c,r+"",e,t,o):void 0,u=void 0===l;if(u){var h=En(c),p=!h&&Object(Cn.a)(c),g=!h&&!p&&Mn(c);l=c,h||p||g?En(a)?l=a:Ka(a)?l=Zn(a):p?(u=!1,l=Object(Xn.a)(c,!0)):g?(u=!1,l=Os(c,!0)):l=[]:ec(c)||_n(c)?(l=a,_n(a)?l=rc(a):Ei(a)&&!Ri(a)||(l=js(c))):u=!1}u&&(o.set(c,l),n(l,c,i,s,o),o.delete(c)),za(e,r,l)}};var nc=function e(t,r,i,n,s){t!==r&&Wa(r,(function(o,a){if(s||(s=new ln),Ei(o))ic(t,r,a,i,e,n,s);else{var c=n?n(tc(t,a),o,a+"",t,r,s):void 0;void 0===c&&(c=o),za(t,a,c)}}),Jn)};var sc=function(e){return e};var oc=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},ac=Math.max;var cc=function(e,t,r){return t=ac(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,s=ac(i.length-t,0),o=Array(s);++n<s;)o[n]=i[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=i[n];return a[t]=r(o),oc(e,this,a)}};var dc=function(e){return function(){return e}},lc=hn?function(e,t){return hn(e,"toString",{configurable:!0,enumerable:!1,value:dc(t),writable:!0})}:sc,uc=Date.now;var hc=function(e){var t=0,r=0;return function(){var i=uc(),n=16-(i-r);if(r=i,n>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(lc);var pc=function(e,t){return hc(cc(e,t,sc),e+"")};var gc=function(e,t,r){if(!Ei(r))return!1;var i=typeof t;return!!("number"==i?Bn(r)&&An(t,r.length):"string"==i&&t in r)&&ei(r[t],e)};var fc=function(e){return pc((function(t,r){var i=-1,n=r.length,s=n>1?r[n-1]:void 0,o=n>2?r[2]:void 0;for(s=e.length>3&&"function"==typeof s?(n--,s):void 0,o&&gc(r[0],r[1],o)&&(s=n<3?void 0:s,n=1),t=Object(t);++i<n;){var a=r[i];a&&e(t,a,i,s)}return t}))}((function(e,t,r,i){nc(e,t,r,i)})),mc=gi?gi.isConcatSpreadable:void 0;var vc=function(e){return En(e)||_n(e)||!!(mc&&e&&e[mc])};var yc=function e(t,r,i,n,s){var o=-1,a=t.length;for(i||(i=vc),s||(s=[]);++o<a;){var c=t[o];r>0&&i(c)?r>1?e(c,r-1,i,n,s):ss(s,c):n||(s[s.length]=c)}return s};var bc=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var wc=function(e){return this.__data__.has(e)};function Sc(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new an;++t<r;)this.add(e[t])}Sc.prototype.add=Sc.prototype.push=bc,Sc.prototype.has=wc;var Tc=Sc;var _c=function(e,t,r,i){for(var n=e.length,s=r+(i?1:-1);i?s--:++s<n;)if(t(e[s],s,e))return s;return-1};var Ec=function(e){return e!=e};var Cc=function(e,t,r){for(var i=r-1,n=e.length;++i<n;)if(e[i]===t)return i;return-1};var Rc=function(e,t,r){return t==t?Cc(e,t,r):_c(e,Ec,r)};var Ac=function(e,t){return!!(null==e?0:e.length)&&Rc(e,t,0)>-1};var Ic=function(e,t,r){for(var i=-1,n=null==e?0:e.length;++i<n;)if(r(t,e[i]))return!0;return!1};var kc=function(e,t){return e.has(t)};var Pc=function(){};var xc=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},Dc=gs&&1/xc(new gs([,-0]))[1]==1/0?function(e){return new gs(e)}:Pc;var Oc=function(e,t,r){var i=-1,n=Ac,s=e.length,o=!0,a=[],c=a;if(r)o=!1,n=Ic;else if(s>=200){var d=t?null:Dc(e);if(d)return xc(d);o=!1,n=kc,c=new Tc}else c=t?[]:a;e:for(;++i<s;){var l=e[i],u=t?t(l):l;if(l=r||0!==l?l:0,o&&u==u){for(var h=c.length;h--;)if(c[h]===u)continue e;t&&c.push(u),a.push(l)}else n(c,u,r)||(c!==a&&c.push(u),a.push(l))}return a};var Mc=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0},Nc=pc((function(e){var t=Mc(e);return t="function"==typeof t?t:void 0,Oc(yc(e,1,Ka,!0),void 0,t)}));var $c=function(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1};var jc=function(e,t,r,i,n,s){var o=1&r,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var d=s.get(e),l=s.get(t);if(d&&l)return d==t&&l==e;var u=-1,h=!0,p=2&r?new Tc:void 0;for(s.set(e,t),s.set(t,e);++u<a;){var g=e[u],f=t[u];if(i)var m=o?i(f,g,u,t,e,s):i(g,f,u,e,t,s);if(void 0!==m){if(m)continue;h=!1;break}if(p){if(!$c(t,(function(e,t){if(!kc(p,t)&&(g===e||n(g,e,r,i,s)))return p.push(t)}))){h=!1;break}}else if(g!==f&&!n(g,f,r,i,s)){h=!1;break}}return s.delete(e),s.delete(t),h};var Lc=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,i){r[++t]=[i,e]})),r},Hc=gi?gi.prototype:void 0,qc=Hc?Hc.valueOf:void 0;var Uc=function(e,t,r,i,n,s,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new Cs(e),new Cs(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ei(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Lc;case"[object Set]":var c=1&i;if(a||(a=xc),e.size!=t.size&&!c)return!1;var d=o.get(e);if(d)return d==t;i|=2,o.set(e,t);var l=jc(a(e),a(t),i,n,s,o);return o.delete(e),l;case"[object Symbol]":if(qc)return qc.call(e)==qc.call(t)}return!1},Fc=Object.prototype.hasOwnProperty;var Bc=function(e,t,r,i,n,s){var o=1&r,a=ls(e),c=a.length;if(c!=ls(t).length&&!o)return!1;for(var d=c;d--;){var l=a[d];if(!(o?l in t:Fc.call(t,l)))return!1}var u=s.get(e),h=s.get(t);if(u&&h)return u==t&&h==e;var p=!0;s.set(e,t),s.set(t,e);for(var g=o;++d<c;){var f=e[l=a[d]],m=t[l];if(i)var v=o?i(m,f,l,t,e,s):i(f,m,l,e,t,s);if(!(void 0===v?f===m||n(f,m,r,i,s):v)){p=!1;break}g||(g="constructor"==l)}if(p&&!g){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(p=!1)}return s.delete(e),s.delete(t),p},Gc=Object.prototype.hasOwnProperty;var Vc=function(e,t,r,i,n,s){var o=En(e),a=En(t),c=o?"[object Array]":Ts(e),d=a?"[object Array]":Ts(t),l="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),u="[object Object]"==(d="[object Arguments]"==d?"[object Object]":d),h=c==d;if(h&&Object(Cn.a)(e)){if(!Object(Cn.a)(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new ln),o||Mn(e)?jc(e,t,r,i,n,s):Uc(e,t,c,r,i,n,s);if(!(1&r)){var p=l&&Gc.call(e,"__wrapped__"),g=u&&Gc.call(t,"__wrapped__");if(p||g){var f=p?e.value():e,m=g?t.value():t;return s||(s=new ln),n(f,m,r,i,s)}}return!!h&&(s||(s=new ln),Bc(e,t,r,i,n,s))};var zc=function e(t,r,i,n,s){return t===r||(null==t||null==r||!yn(t)&&!yn(r)?t!=t&&r!=r:Vc(t,r,i,n,e,s))};var Wc=function(e,t){return zc(e,t)};var Kc=function(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n},Jc=Math.min;var Yc=function(e,t,r){for(var i=r?Ic:Ac,n=e[0].length,s=e.length,o=s,a=Array(s),c=1/0,d=[];o--;){var l=e[o];o&&t&&(l=Kc(l,xn(t))),c=Jc(l.length,c),a[o]=!r&&(t||n>=120&&l.length>=120)?new Tc(o&&l):void 0}l=e[0];var u=-1,h=a[0];e:for(;++u<n&&d.length<c;){var p=l[u],g=t?t(p):p;if(p=r||0!==p?p:0,!(h?kc(h,g):i(d,g,r))){for(o=s;--o;){var f=a[o];if(!(f?kc(f,g):i(e[o],g,r)))continue e}h&&h.push(g),d.push(p)}}return d};var Xc=function(e){return Ka(e)?e:[]},Zc=pc((function(e){var t=Mc(e),r=Kc(e,Xc);return(t="function"==typeof t?t:void 0)&&r.pop(),r.length&&r[0]===e[0]?Yc(r,void 0,t):[]}));function Qc(e,t,r,i){const n=new Blob(void 0!==i?[i,e]:[e],{type:r||"application/octet-stream"}),s=window.URL.createObjectURL(n),o=document.createElement("a");o.style.display="none",o.href=s,o.setAttribute("download",t),void 0===o.download&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(s)}function ed({url:e,target:t="_blank",fileName:r}){const i=window.navigator.userAgent.toLowerCase().indexOf("chrome")>-1,n=window.navigator.userAgent.toLowerCase().indexOf("safari")>-1;if(/(iP)/g.test(window.navigator.userAgent))return console.error("Your browser does not support download!"),!1;if(i||n){const i=document.createElement("a");if(i.href=e,i.target=t,void 0!==i.download&&(i.download=r||e.substring(e.lastIndexOf("/")+1,e.length)),document.createEvent){const e=document.createEvent("MouseEvents");return e.initEvent("click",!0,!0),i.dispatchEvent(e),!0}}return-1===e.indexOf("?")&&(e+="?download"),function(e,t){const{target:r="__blank",noopener:i=!0,noreferrer:n=!0}=t||{},s=[];i&&s.push("noopener=yes"),n&&s.push("noreferrer=yes"),window.open(e,r,s.join(","))}(e,{target:t}),!0}class td{constructor(e){this.options=e,this.axiosInstance=Ia.create(e),this.setupInterceptors()}createAxios(e){this.axiosInstance=Ia.create(e)}getTransform(){const{transform:e}=this.options;return e}getAxios(){return this.axiosInstance}configAxios(e){this.axiosInstance&&this.createAxios(e)}setHeader(e){this.axiosInstance&&Object.assign(this.axiosInstance.defaults.headers,e)}setupInterceptors(){const{axiosInstance:e,options:{transform:t}}=this;if(!t)return;const{requestInterceptors:r,requestInterceptorsCatch:i,responseInterceptors:n,responseInterceptorsCatch:s}=t,o=new Da;this.axiosInstance.interceptors.request.use(e=>{var t;const{requestOptions:i}=this.options;return!(null===(t=null==i?void 0:i.ignoreCancelToken)||void 0===t||t)&&o.addPending(e),r&&qa(r)&&(e=r(e,this.options)),e},void 0),i&&qa(i)&&this.axiosInstance.interceptors.request.use(void 0,i),this.axiosInstance.interceptors.response.use(e=>(e&&o.removePending(e.config),n&&qa(n)&&(e=n(e)),e),void 0),s&&qa(s)&&this.axiosInstance.interceptors.response.use(void 0,t=>s(e,t))}uploadFile(e,t){const r=new window.FormData,i=t.name||"file";return t.filename?r.append(i,t.file,t.filename):r.append(i,t.file),t.data&&Object.keys(t.data).forEach(e=>{const i=t.data[e];Array.isArray(i)?i.forEach(t=>{r.append(e+"[]",t)}):r.append(e,t.data[e])}),this.axiosInstance.request(Object.assign(Object.assign({},e),{method:"POST",data:r,headers:{"Content-type":Ga.FORM_DATA,ignoreCancelToken:!0}}))}supportFormData(e){var t;const r=e.headers||this.options.headers;return((null==r?void 0:r["Content-Type"])||(null==r?void 0:r["content-type"]))===Ga.FORM_URLENCODED&&Reflect.has(e,"data")&&(null===(t=e.method)||void 0===t?void 0:t.toUpperCase())!==Ba.GET?Object.assign(Object.assign({},e),{data:ka.stringify(e.data,{arrayFormat:"brackets"})}):e}get(e,t){return this.request(Object.assign(Object.assign({},e),{method:"GET"}),t)}post(e,t){return this.request(Object.assign(Object.assign({},e),{method:"POST"}),t)}put(e,t){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}),t)}delete(e,t){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}),t)}download(e,t,r){let i=Va(Object.assign(Object.assign({},e),{method:"POST",responseType:"blob"}));const n=this.getTransform(),{requestOptions:s}=this.options,o=Object.assign({},s,r),{beforeRequestHook:a,requestCatchHook:c}=n||{};return a&&qa(a)&&(i=a(i,o)),i.requestOptions=o,i=this.supportFormData(i),new Promise((e,r)=>{this.axiosInstance.request(i).then(r=>{e(r),null!=typeof r&&Qc(null==r?void 0:r.data,t||"export")}).catch(e=>{c&&qa(c)?r(c(e,o)):(Ia.isAxiosError(e),r(e))})})}export(e,t,r){let i=Va(Object.assign(Object.assign({},e),{method:"POST",responseType:"blob"}));const n=this.getTransform(),{requestOptions:s}=this.options,o=Object.assign({},s,r),{beforeRequestHook:a,requestCatchHook:c}=n||{};return a&&qa(a)&&(i=a(i,o)),i.requestOptions=o,i=this.supportFormData(i),new Promise((e,r)=>{this.axiosInstance.request(i).then(r=>{e(r),null!=typeof r&&Qc(null==r?void 0:r.data,t)}).catch(e=>{c&&qa(c)?r(c(e,o)):(Ia.isAxiosError(e),r(e))})})}request(e,t){let r=Va(e);e.cancelToken&&(r.cancelToken=e.cancelToken);const i=this.getTransform(),{requestOptions:n}=this.options,s=Object.assign({},n,t),{beforeRequestHook:o,requestCatchHook:a,transformResponseHook:c}=i||{};return o&&qa(o)&&(r=o(r,s)),r.requestOptions=s,r=this.supportFormData(r),new Promise((e,t)=>{this.axiosInstance.request(r).then(r=>{if(c&&qa(c))try{const t=c(r,s);e(t)}catch(e){t(e||new Error("request error!"))}else e(r)}).catch(e=>{a&&qa(a)?t(a(e,s)):(Ia.isAxiosError(e),t(e))})})}}let rd;function id(){return rd}function nd(e){rd=e}function sd(e,t=!1){if(!e)return t?"":{};const r=(new Date).getTime();return t?"?_t="+r:{_t:r}}function od(e){var t,r;if("[object Object]"===Object.prototype.toString.call(e))for(const i in e){const n=null!==(r=null===(t=e[i])||void 0===t?void 0:t.format)&&void 0!==r?r:null;if(n&&"function"==typeof n&&(e[i]=e[i].format("YYYY-MM-DD HH:mm:ss")),Ha(i)){const t=e[i];if(t)try{e[i]=Ha(t)?t.trim():t}catch(e){throw new Error(e)}}$a(e[i])&&od(e[i])}}class ad{retry(e,t){var r,i;const{config:n}=t.response,{waitTime:s,count:o}=null!==(i=null===(r=null==n?void 0:n.requestOptions)||void 0===r?void 0:r.retryRequest)&&void 0!==i?i:{};return n.__retryCount=n.__retryCount||0,n.__retryCount>=o?Promise.reject(t):(n.__retryCount+=1,delete n.headers,this.delay(s).then(()=>e(n)))}delay(e){return new Promise(t=>window.setTimeout(t,e))}}const cd={secKey:"12356789",key:"abcdefghijklmno1",iv:"1122334455667788"};var dd=r(15),ld=r(11),ud=r(28),hd=r(7);r(4);class pd{constructor(e={}){const{key:t,iv:r}=e;this.key=ld.parse(t),this.iv=ld.parse(r)}getOptions(){return{mode:ud.mode.CBC,padding:ud.pad.Pkcs7,iv:this.iv}}encryptByAES(e){if(!this.key||!this.iv)throw new Error("Key and IV must be provided.");return Object(dd.encrypt)(e,this.key,this.getOptions()).toString()}decryptByAES(e){if(!this.key||!this.iv)throw new Error("Key and IV must be provided.");return Object(dd.decrypt)(e,this.key,this.getOptions()).toString(ld)}}const gd=[];for(let e=0;e<=15;e++)gd[e]=e.toString(16);const{key:fd,iv:md,secKey:vd}=cd,yd=new pd({key:fd,iv:md}),bd={transformResponseHook:(e,t)=>{const{isTransformResponse:r,isReturnNativeResponse:i}=t;if(i)return e;if(!r)return e.data;const{data:n}=e;if(!n)throw new Error("apiRequestFailed");const{code:s,data:o,message:a}=n;if(n&&Reflect.has(n,"code")&&s.toString()===Fa.SUCCESS){let r=a;return(La(r)||Na(r)||ja(r))&&(r="operationSuccess"),"modal"===t.successMessageMode||t.successMessageMode,e.headers.mode&&"encrypt"===e.headers.mode&&null!==o?JSON.parse(yd.decryptByAES(o)):o}let c="";switch(s){case Fa.TIMEOUT:c="timeout";break;default:a&&(c=a)}throw"modal"===t.errorMessageMode||t.errorMessageMode,new Error(c||"apiRequestFailed")},beforeRequestHook:(e,t)=>{var r;const{apiUrl:i,joinPrefix:n,joinParamsToUrl:s,formatDate:o,joinTime:a=!0,urlPrefix:c}=t;n&&(e.url=`${c}${e.url}`),ja(i)?e.url=`${Zr().apiUrl}${e.url}`:e.url=`${window.location.origin}${e.url}`;const d=e.params||{},l=e.data||!1;return o&&l&&!Ha(l)&&od(l),(null===(r=e.method)||void 0===r?void 0:r.toUpperCase())===Ba.GET?Ha(d)?(e.url=e.url+d+""+sd(a,!0),e.params=void 0):e.params=Object.assign(d||{},sd(a,!1)):Ha(d)?(e.url=e.url+d,e.params=void 0):(o&&od(d),Reflect.has(e,"data")&&e.data&&(Object.keys(e.data).length>0||e.data instanceof FormData)?(e.data=l,e.params=d):(e.data=d,e.params=void 0),s&&(e.url=function(e,t){let r="";for(const e in t)r+=e+"="+encodeURIComponent(t[e])+"&";return r=r.replace(/&$/,""),/\?$/.test(e)?e+r:e.replace(/\/?$/,"?")+r}(e.url,Object.assign({},e.params,e.data)))),e},requestInterceptors:(e,t)=>{var r,i,n,s;const o=id();if(o&&!1!==(null===(i=null===(r=e)||void 0===r?void 0:r.requestOptions)||void 0===i?void 0:i.withToken)&&(e.headers.Authorization=t.authenticationScheme?`${t.authenticationScheme} ${o}`:o),"string"!=typeof e.data){function a(e,t){t in e&&delete e[t]}a(e.data,"usernumberInterior"),a(e.data,"passwordInterior")}let c="string"==typeof e.data?e.data:JSON.stringify(e.data);(null===(s=null===(n=e)||void 0===n?void 0:n.requestOptions)||void 0===s?void 0:s.encryption)&&(e.headers["encrypt-method"]="2");const d=(new Date).valueOf().toString();return e.headers.Timestamp=d,e.headers.Sign=hd(d+vd+c).toString(),e.headers.traceId=function(){var e,t,r="";for(e=0;e<32;e++)t=16*Math.random()|0,8!=e&&12!=e&&16!=e&&20!=e||(r+="-"),r+=(12==e?4:16==e?3&t|8:t).toString(16);return r}(),e.headers.lang=function(){let e;switch(Zr().lang){case"en":e="en_US";break;case"ja":e="ja_JP";break;case"ko":e="ko_KR";break;case"zh_CN":e="zh_CN";break;default:e=Zr().lang}return e}(),e},responseInterceptors:e=>e,responseInterceptorsCatch:(e,t)=>{var r,i,n,s,o,a,c,d;const{response:l,code:u,message:h,config:p}=t||{},g=(null===(r=null==p?void 0:p.requestOptions)||void 0===r?void 0:r.errorMessageMode)||"none",f=null!==(s=null===(n=null===(i=null==l?void 0:l.data)||void 0===i?void 0:i.error)||void 0===n?void 0:n.message)&&void 0!==s?s:"",m=null!==(a=null===(o=null==t?void 0:t.toString)||void 0===o?void 0:o.call(t))&&void 0!==a?a:"";let v="";if(Ia.isCancel(t))return Promise.reject(t);try{if("ECONNABORTED"===u&&-1!==h.indexOf("timeout")&&(v="ECONNABORTED"),(null==m?void 0:m.includes("Network Error"))&&(v="Network Error"),v)return Promise.reject(t)}catch(t){throw new Error(t)}!function(e,t,r="message"){let i="";switch(e){case 400:i=""+t;break;case 401:throw new Error("http result code 401");case 403:throw new Error("http result code 403");case 404:throw new Error("http result code 404");case 405:throw new Error("http result code 405");case 408:throw new Error("http result code 408");case 500:throw new Error("http result code 500");case 501:throw new Error("http result code 501");case 502:throw new Error("http result code 502");case 503:throw new Error("http result code 503");case 504:throw new Error("http result code 504");case 505:throw new Error("http result code 505")}}(null===(c=null==t?void 0:t.response)||void 0===c?void 0:c.status,f,g);const y=new ad,{isOpenRetry:b}=p.requestOptions.retryRequest;return(null===(d=p.method)||void 0===d?void 0:d.toUpperCase())===Ba.GET&&b&&y.retry(e,t),Promise.reject(t)}};const wd=new td(function e(t,r,i="replace"){return r?t?fc({},t,r,(t,r)=>{if(Ua(r)&&Ua(t))switch(i){case"union":return Nc(t,r,Wc);case"intersection":return Zc(t,r,Wc);case"concat":return t.concat(r);case"replace":return r;default:throw new Error("Unknown merge array strategy: "+i)}if($a(r)&&$a(t))return e(t,r,i)}):r:t}({authenticationScheme:"",timeout:1e4,headers:{"Content-Type":Ga.JSON},transform:zs(bd),requestOptions:{joinPrefix:!0,isReturnNativeResponse:!1,isTransformResponse:!0,joinParamsToUrl:!1,formatDate:!0,errorMessageMode:"message",apiUrl:Zr().apiUrl,urlPrefix:"",joinTime:!0,ignoreCancelToken:!0,withToken:!0,retryRequest:{isOpenRetry:!0,count:5,waitTime:100},encryption:!1}},Sd||{}));var Sd,Td,_d,Ed,Cd,Rd,Ad,Id,kd,Pd;function xd(e){return wd.post({url:Ed.Save,data:e},{isTransformResponse:!1})}function Dd(e){return wd.get({url:Id.AudiopttControl,params:e},{isTransformResponse:!1})}function Od(e){return wd.post({url:kd.Edit,data:e},{isTransformResponse:!1})}!function(e){e.Login="/api/v1/user/user/login",e.OnlineUsers="/api/client/get_online_user.php",e.ActiveCallUsers="/api/client/get_active_calls.php"}(Td||(Td={})),function(e){e.LoadDepartment="/api/client/departments.php"}(_d||(_d={})),function(e){e.LoadGroup="/api/client/getsolid_group.php",e.Save="/api/client/ptt/set_custom_group.php"}(Ed||(Ed={})),function(e){e.StartLive="/api/v1/live/push/start",e.StopLive="/api/v1/live/push/stop",e.CtlLive="/api/v1/live/devicectl"}(Cd||(Cd={})),function(e){e.ForeceInsert="/api/client/forceinsert.php",e.ForeceTeardown="/api/client/teardown.php",e.AudioMonitor="/api/client/monitor.php",e.VideoMonitor="/api/client/vmonitor.php",e.VideoDispatch="/api/client/video_dispatch.php",e.HangupChannel="/api/client/hangup.php"}(Rd||(Rd={})),function(e){e.Ptz="/api/v1/live/ptz"}(Ad||(Ad={})),function(e){e.AudiopttControl="/api/client/ptt/audioptt_control.php",e.Invite="/api/client/ptt/invite_one_ptter.php"}(Id||(Id={})),function(e){e.PageList="/api/client/searchmedia.php",e.Edit="/api/client/editemedia.php"}(kd||(kd={})),function(e){e.GisByUserNumbers="/api/client/getgis.php",e.BaiduReverseGeocoding="/api/client/baiduapi/reverse_geocoding/v3",e.GPSTrack="/api/client/getgistrack.php"}(Pd||(Pd={}));var Md,Nd,$d,jd,Ld,Hd,qd,Ud,Fd,Bd,Gd,Vd,zd,Wd,Kd=r(18);function Jd(e){return wd.get({url:Md.GetGisFence,params:e},{isTransformResponse:!1})}function Yd(e){return wd.post({url:Md.SetGisFence,data:e},{isTransformResponse:!1})}function Xd(e){return wd.get({url:Nd.Start,params:e},{isTransformResponse:!1})}function Zd(e){return wd.get({url:Nd.Conference,params:e},{isTransformResponse:!1})}function Qd(e){return wd.get({url:$d.Ctl,params:e},{isTransformResponse:!1})}function el(e){return wd.get({url:Ld.Ctl,params:e},{isTransformResponse:!1})}function tl(e){const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`);return t.join("&")}function rl(e){return wd.post({url:Ud.Delete,data:e},{isTransformResponse:!1})}function il(e){return wd.get({url:Vd.Ctl,params:e},{isTransformResponse:!1})}!function(e){e.GetGisFence="/api/client/get_gis_fence.php",e.SetGisFence="/api/client/set_gis_fence.php",e.GetGisFenceWarningList="/api/client/get_gis_fence_warning.php"}(Md||(Md={})),function(e){e.FileList="/api/client/broadcast_filelist.php",e.InviteMember="/api/client/audiobroadcast/invite_one_member.php",e.Start="/api/client/audiobroadcast/start_conf.php",e.Conference="/api/client/audiobroadcast/conference_interactive.php"}(Nd||(Nd={})),function(e){e.Start="/api/client/conference/start_conf.php",e.Ctl="/api/client/conference/conference_interactive.php",e.InviteMember="/api/client/conference/invite_one_member.php"}($d||($d={})),function(e){e.History="/api/client/get_msg.php",e.Delete="/api/client/del_msg.php"}(jd||(jd={})),function(e){e.Ctl="/api/client/videoconf_ctl.php",e.InviteMember="/api/client/invite2videoconf.php",e.SetLayout="/api/client/changelayout.php",e.End="/api/client/end_videoconf.php"}(Ld||(Ld={})),function(e){e.PageList="/api/client/get_cdr.php"}(Hd||(Hd={})),function(e){e.PageList="/api/v1/user/manager/userslist"}(qd||(qd={})),function(e){e.Create="/api/app/create_task.php",e.Update="/api/app/update_task.php",e.Delete="/api/app/del_task.php",e.PageList="/api/app/query_task.php",e.Query="/api/app/get_task.php",e.CreateComment="/api/app/comment_task.php",e.UpdateComment="/api/app/comment_task_edit.php",e.DeleteComment="/api/app/comment_task_del.php"}(Ud||(Ud={})),function(e){e.PageList="/api/get_sos/items.php"}(Fd||(Fd={})),function(e){e.PageList="/api/login_history/items.php",e.StaticPageList="/api/login_history/statistical.php"}(Bd||(Bd={})),function(e){e.PageList="/api/get_call_record/items.php"}(Gd||(Gd={})),function(e){e.Start="/api/client/vbroadcast/startvbroadcast.php",e.Ctl="/api/client/vbroadcast/broadcast_control.php",e.InviteMember="/api/client/vbroadcast/invite_one_member.php"}(Vd||(Vd={}));class nl{async loginApi(e){const t=be.hashStr(e.usernumber+e.password),r={usernumber:e.usernumber,token:t},i=await function(e){return wd.put({url:Td.Login,data:e},{isTransformResponse:!1})}(r);if(console.log("login result",i),"0"!=i.state)throw Error(i.msg);const n=i.data;return{usrUuid:n.usr_uuid,accessToken:"",usrNumber:n.usr_number,usrName:n.usr_name,usrType:n.usr_type,usrStructureId:n.mainhead,enterpriseUuid:n.enterprise_uuid,enterpriseCode:n.enterprise_code,enterpriseName:n.enterprise_name,function:n.function,license:n.license,config:"",status:parseInt(n.status),recordScope:"",appname:"",exten1:n.exten1,exten2:n.exten2,exten3:n.exten3,starttime:n.starttime,endtime:"",webversion:"",pttRecord:0,sos:0,extension:"",password:"",gisJd:n.gis_jd,gisWd:n.gis_wd,usrSubHead:"",usrMainHead:n.mainhead,expires:""}}async loadDepartmentApi(e){const t=be.hashStr(e.usernumberInterior+e.passwordInterior),r={usernumber:e.usernumberInterior,token:t,limit:2e3},i=await function(e){const t=_d.LoadDepartment+"?usernumber="+e.usernumber;return wd.post({url:t,data:e},{isTransformResponse:!1})}(r);return console.log("loadDepartmentApi result",i),{departments:(n=i,n.data.departments.map(e=>({depUuid:e[0],depName:e[1],parentDepLevel:"",depLevel:e[2],depType:e[3],depVisible:e[4]}))),users:function(e){return e.data.users.map(e=>({usrUuid:e[0],usrNumber:e[1],usrName:e[2],usrType:e[3],usrPower:e[4],usrDepUuid:e[5],usrField:e[6],usrMobileHome:e[7],usrHomePhone:e[8],usrPosition:e[12],usrIsvip:e[13],ipaddr:e[14],supportPtz:e[15],iconUrl:e[16],iconUrlOnline:e[17],iconUrlOffline:e[18],iconName:e[19],iconCate:e[20],exten1:e[21],exten2:e[22],userid:e[23]}))}(i)};var n}async loadGroupApi(e){const t=be.hashStr(e.usernumberInterior+e.passwordInterior),r={usernumber:e.usernumberInterior,token:t},i=await function(e){const t=Ed.LoadGroup+"?number="+e.usernumber;return wd.post({url:t,data:e},{isTransformResponse:!1})}(r);return i.value.map(e=>{const t={groupUuid:e.group_uuid,roomId:e.group_hostextension,groupName:e.group_name,callGroupType:e.call_grouptype,maxtime:e.maxtime,level:e.level,members:[],levelOn:e.is_level_on,isDefault:e.is_default,createby:e.createby};return e.users.map(e=>{t.members.push({usrNumber:e.extension,level:e.level,usrUuid:e.uid,usrName:e.usr_name,usrType:e.usr_type})}),t})}async loadUserStatusApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,sign:r,timestamp:t},n=await function(e){const t=`${Td.OnlineUsers}?usernumber=${e.usernumber}×tamp=${e.timestamp}&sign=${e.sign}`;return wd.post({url:t,data:e},{isTransformResponse:!1})}(i),s=[];return n.users.map(e=>{s.push({userNumber:e})}),console.log("loadUserStatusAp===",s),s}async startLiveApi(e){const t=be.hashStr(e.usernumberInterior+e.passwordInterior),r={caller:e.usernumberInterior,callee:e.callee,token:t},i=await function(e){return wd.put({url:Cd.StartLive,data:e,timeout:3e4},{isTransformResponse:!1})}(r),{data:n}=i;return{uuid:n.uuid,supportPtz:n.support_ptz,rtmp:n.rtmp,flv:n.flv,hls:n.hls,ws:n.ws,webrtc:n.webrtc,whep:n.whep}}async stopLiveApi(e){const t=be.hashStr(e.usernumberInterior+e.passwordInterior),r={caller:e.usernumberInterior,callee:e.callee,token:t};return await(i=r,wd.put({url:Cd.StopLive,data:i},{isTransformResponse:!1}));var i}async loadLiveCallsApi(e){var t;const r=await function(e){const t=`${Td.ActiveCallUsers}?usernumber=${e.usernumber}×tamp=${e.timestamp}&sign=${e.sign}`;return wd.post({url:t,data:e},{isTransformResponse:!1})}(e),i=[];return null===(t=r.calls)||void 0===t||t.map(e=>{i.push({uuid:e.uuid,number:e.number,cidNum:e.cid_num,dest:e.dest,direction:e.direction,callState:e.callstate,type:parseInt(e.type),conference:parseInt(e.conference)})}),i}async foreceInsertApi(e){const t={extension:e.extension,calleeuuid:e.calleeUuid};return await function(e){return wd.get({url:Rd.ForeceInsert,params:e},{isTransformResponse:!1})}(t)}async foreceTeardownApi(e){const t={extension:e.extension,calleeuuid:e.calleeUuid};return await function(e){return wd.get({url:Rd.ForeceTeardown,params:e},{isTransformResponse:!1})}(t)}async audioMonitorApi(e){const t={extension:e.extension,calleeuuid:e.calleeUuid};return await function(e){return wd.get({url:Rd.AudioMonitor,params:e},{isTransformResponse:!1})}(t)}async videoMonitorApi(e){const t={extension:e.extensions.join(),calleeuuid:e.calleeUuid,dispatcher:e.dispatcher};return await function(e){return wd.get({url:Rd.VideoMonitor,params:e},{isTransformResponse:!1})}(t)}async videoDispatchApi(e){const t={caller:e.caller,callee:e.callee};return await function(e){return wd.get({url:Rd.VideoDispatch,params:e},{isTransformResponse:!1})}(t)}async hangupChannelApi(e){const t={uuid:e.uuid};return await(r=t,wd.post({url:Rd.HangupChannel,data:r},{isTransformResponse:!1}));var r}async deviceControlPtzApi(e){const t=be.hashStr(e.usernumberInterior+e.passwordInterior),r={caller:e.usernumberInterior,callee:e.callee,token:t,ptzcode:e.ptzCode};return await(i=r,wd.put({url:Ad.Ptz,data:i},{isTransformResponse:!1}));var i}async ctlLiveApi(e){const t=be.hashStr(e.usernumberInterior+e.passwordInterior),r={caller:e.usernumberInterior,callee:e.callee,token:t,cmd:e.cmd};return await(i=r,wd.put({url:Cd.CtlLive,data:i},{isTransformResponse:!1}));var i}async pttCtlTalkApi(e){let t;t=1==e.type?"request_talk":"release_talk";const r={roomid:e.roomid,number:e.usernumberInterior,cmd:t,level:e.level};return await Dd(r)}async pttInvitedApi(e){const t={caller:e.caller,callee:e.members.join(),pttnumber:e.pttnumber};return await function(e){return wd.get({url:Id.Invite,params:e},{isTransformResponse:!1})}(t)}async pttKickApi(e){const t={roomid:e.roomid,number:e.number,cmd:"kick_member"};return await Dd(t)}async getClapTransPageListApi(e){const t={usernumber:e.usernumberInterior,limit:e.pageSize,page:e.pageNum};e.type&&(t.type=e.type),e.state&&(t.state=e.state),e.startTime&&(t.begin=e.startTime),e.endTime&&(t.end=e.endTime),e.isMaker&&(t.ismaker=e.isMaker),e.keyword&&(t.key=e.keyword),e.usernumberInterior&&(t.number=e.usernumberInterior);const r=await(i=t,wd.post({url:kd.PageList,data:i},{isTransformResponse:!1}));var i;if("0"!=r.code)throw Error(r.msg);const{page:n,value:s}=r,o={total:parseInt(n.total_count),records:[]};function a(e){let t=e;return t>=1048576?(t/1048576).toFixed(2)+" GB":t>=1024?(t/1024).toFixed(2)+" MB":t.toFixed(2)+" KB"}return s.map(e=>{o.records.push({uuid:e.mediaid,number:e.number,usrName:"",type:parseInt(e.type),title:e.title,desc:e.desc,gisjd:e.gisgd,giswd:e.giswd,gisfx:e.gisfx,gissd:e.gisgd,addtime:e.createtime,mediatime:e.uploadtime,state:e.state,fileId:e.filename,fileSize:a(Number(e.size)),length:0,extend:"",fileGroupTag:""})}),o}async setClapTransReadStatusApi(e){const t={number:e.usernumberInterior,cmd:2,state:e.state,mediaid:e.uuid},r=await Od(t);if("0"!=r.code)throw Error(r.msg)}async setClapTransMarkerApi(e){const t={number:e.usernumberInterior,cmd:3,state:e.isMaker,mediaid:e.uuid},r=await Od(t);if("0"!=r.code)throw Error(r.msg)}async deleteClapTransApi(e){const t={number:e.usernumberInterior,cmd:1,mediaid:e.uuid},r=await Od(t);if("0"!=r.code)throw Error(r.msg)}async exportClapTransUrlApi(e){let t={usernumber:e.usernumberInterior};e.usernumberInterior&&(t.number=e.usernumberInterior),e.type&&(t.type=e.type),e.state&&(t.state=e.state),e.startTime&&(t.begin=e.startTime),e.endTime&&(t.end=e.endTime),e.isMaker&&(t.ismaker=e.isMaker),e.keyword&&(t.key=e.keyword),t.export=!0;const r=Zr().apiUrl+"/api/client/searchmedia.php?"+tl(t);console.log(r),ed({url:r,target:"_self"})}async getGisByUserNumbers(e){const t=await function(e){return wd.get({url:Pd.GisByUserNumbers,params:e},{isTransformResponse:!1})}(e),r=[];return t.map(e=>{r.push({extension:e.exten,gisJd:e.gis_jd,gisWd:e.gis_wd,gisGd:e.gis_gd,gisSd:e.gis_sd,gisTime:e.date})}),r}async getBaiduMapReverseGeocoding(e){return await function(e){return wd.get({url:Pd.BaiduReverseGeocoding,params:e},{isTransformResponse:!1})}(e)}async getGPSTrackByNumber(e){const t={number:e.usernumberInterior,acc:e.usrNumber,startTime:e.startTime,endTime:e.endTime},r=await function(e){return wd.get({url:Pd.GPSTrack,params:e},{isTransformResponse:!1})}(t);let i=[];const{track:n}=r;return n.map(e=>{i.push({extension:e.exten,gisJd:e.gis_jd,gisWd:e.gis_wd,gisGd:e.gis_gd,gisSd:e.gis_sd,createStamp:e.date})}),i}async createGroupApi(e){const t={action:"add",number:e.usernumberInterior,groupname:e.groupName,typename:e.type,maxtime:e.maxtime,is_level_on:e.levelOn,level:e.level,is_default:e.isDefault,value:e.members.join()};return await xd(t)}async updateGroupApi(e){const t={action:"edit",number:e.usernumberInterior,groupname:e.groupName,typename:e.type,roomid:e.roomid,maxtime:e.maxtime,is_level_on:e.levelOn,level:e.level,is_default:e.isDefault,value:e.members.join()};return await xd(t)}async deleteGroupApi(e){const t={action:"del_group",number:e.usernumberInterior,roomid:e.roomid};return await xd(t)}async uploadApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.password);let i=new FormData;e.append("usernumber",e.usernumberInterior),e.append("timestamp",t),e.append("sign",r),e.append("type",e.type),e.append("file",e.file,e.filename);const n=(await function(e,t){return wd.uploadFile({url:Zr().apiUrl+"/api/client/upload_msg_file.php",onUploadProgress:t},e)}(i)).data;return{fileId:n.mediaid,notTokenUrl:n.url,url:n.url}}async getFileListByGroupTagApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}downloadFileUrl(e){return`${Zr().apiUrl}/api/client/down_file.php?uuid=${e.fileId}`}async getMsgPageListApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,sign:r,timestamp:t,status:2,sendrecv:"1",msgtype:e.isGroup?"group":"plain",distinct:1,page:e.pageNum,limit:e.pageSize,recvnumber:e.conversation,start_stamp:e.startTime,end_stamp:e.endTime},n=await function(e){return wd.get({url:jd.History,params:e},{isTransformResponse:!1})}(i),{msgs:s,page:o}=n,a={total:o.total,records:[]};return s.map(t=>{a.records.push({id:t.msg_id,msgType:t.type,msgBody:t.msg,sender:t.from,reciver:t.to,groupId:t.room_id,isGroup:e.isGroup,status:t.status})}),a}async deleteMsgApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={msg_id:e.messageUid,usernumber:e.usernumberInterior,sign:r,timestamp:t};await function(e){return wd.get({url:jd.Delete,params:e},{isTransformResponse:!1})}(i)}async getGisFenceListApi(e){const t={action:"get",usernumber:e.usernumberInterior,fenceId:e.fenceId},r=await Jd(t),{value:i}=r,n=[];return i.map(e=>{n.push({id:e.id,usrNumber:e.usr_number,name:e.name,startHour:e.start_hour,startMinute:e.start_minute,endHour:e.end_hour,endMinute:e.end_minute,descr:e.descr,points:JSON.parse(e.points),createStamp:e.create_stamp,timeType:0,startTime:"",endTime:"",command:""})}),n}async createGisFenceApi(e){const t={action:"add",usernumber:e.usrNumber,name:e.name,startHour:e.startHour,startMinute:e.startMinute,endHour:e.endHour,endMinute:e.endMinute,points:JSON.stringify(e.points)};return await Yd(t)}async updateGisFenceApi(e){const t={action:"update",usernumber:e.usrNumber,fenceId:e.id,name:e.name,startHour:e.startHour,startMinute:e.startMinute,endHour:e.endHour,endMinute:e.endMinute,points:JSON.stringify(e.points)};return await Yd(t)}async deleteGisFenceApi(e){const t={action:"delete",usernumber:e.usrNumber,fenceId:e.id};return await Yd(t)}async getGisFenceMemberListApi(e){const t={action:"get_member",usernumber:e.usernumberInterior,fenceId:e.fenceId},r=await Jd(t),i=[],{value:n}=r;return n.map(e=>{i.push({id:e.id,usrNumber:e.usr_number,fenceId:parseInt(e.fence_id),extension:e.extension,type:e.type,createStamp:e.createStamp})}),i}async addGisFenceMemberApi(e){const t={action:"add_member",usernumber:e.usernumberInterior,fenceId:e.fenceId,number:e.numbers.join("#"),type:e.type};return await Yd(t)}async deleteGisFenceMemberApi(e){const t={action:"delete_member",usernumber:e.usernumberInterior,fenceId:e.fenceId,number:e.numbers.join("#")};return await Yd(t)}async getGisFenceWarningListApi(e){const t={usernumber:e.usernumberInterior,fenceId:e.fenceId,startTime:e.startTime,endTime:e.endTime,limit:e.pageSize,offset:(e.pageNum-1)*e.pageSize};return await function(e){return wd.get({url:Md.GetGisFenceWarningList,params:e},{isTransformResponse:!1})}(t)}async getGisFenceHistoryInoutPageListApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}async startBroadcastAudioApi(e){const t={emcee:e.usernumberInterior,join:e.members.join("#")},r=await Xd(t);if("0"!=r.st)throw Error("startBroadcastAudio fail:"+r.msg);return r.roomid}async startAndPlayBroadcastAudioApi(e){const t={emcee:e.usernumberInterior,join:e.members.join("#"),playfile:e.playFiles.join(),count:e.playCount},r=await Xd(t);if("0"!=r.st)throw Error("startBroadcastAudio fail:"+r.msg);return r.roomid}async startPlayBroadcastAudioFileApi(e){const t={cmd:"new_play",roomid:e.roomId,playfile:e.playFiles.join(),count:e.playCount},r=await Zd(t);if("0"!=r.st)throw Error("startBroadcastAudio fail:"+r.msg);return r.roomid}async createBroadcastAudioFileApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}async getBroadcastAudioFileListApi(e){const t={usr_number:e.usernumberInterior},r=await function(e){return wd.get({url:Nd.FileList,params:e},{isTransformResponse:!1})}(t),i=[];return r.map(e=>{i.push({broadcastFileUnique:e.id,broadcastName:e.name,filesize:e.filesize})}),i}async inviteMemberBroadcastAudioApi(e){const t={callee:e.members.join(),roomid:e.roomId};return await function(e){return wd.get({url:Nd.InviteMember,params:e},{isTransformResponse:!1})}(t)}async playBroadcastAudioFileApi(e){const t={roomid:e.roomId,cmd:"pause_play"};return await Zd(t)}async muteAllBroadcastAudioApi(e){const t={roomid:e.roomId,data:"all",cmd:e.mute?"mute":"unmute"};return await Zd(t)}async muteMemberBroadcastAudioApi(e){const t={roomid:e.roomId,data:e.member,cmd:e.mute?"mute":"unmute"};return await Zd(t)}async kickMemberBroadcastAudioApi(e){const t={roomid:e.roomId,data:e.member,cmd:"kick"};return await Zd(t)}async endBroadcastAudioApi(e){const t={roomid:e.roomId,data:"all",cmd:"kick"};return await Zd(t)}async setVolumeBroadcastAudioApi(e){const t={roomid:e.roomId,data:e.value,cmd:"volume_change"};return await Zd(t)}async getBroadcastAudioMemberStatusListApi(e){const t={roomid:e.roomId,cmd:"xml_list"},r=await Zd(t);if(-1!=r.indexOf("not found"))throw Error("not found");const i=(new Kd).xml2js(r),n=[].concat(i.conferences.conference.members.member),s=[];return n.map(e=>{s.push({id:e.id,hasVfloor:e.has_vfloor,callerIdNumber:e.caller_id_number,canSpeak:!e.flags.can_speak})}),s}async getAudioConferenceMemberStatusListApi(e){const t={roomid:e.roomId,cmd:"xml_list"},r=await Qd(t);if(-1!=r.indexOf("not found"))throw Error("not found");const i=(new Kd).xml2js(r),n=[].concat(i.conferences.conference.members.member),s=[];return n.map(e=>{s.push({id:e.id,hasVfloor:e.has_vfloor,callerIdNumber:e.caller_id_number,canSpeak:!e.flags.can_speak})}),s}async startAudioConferenceApi(e){const t={emcee:e.usernumberInterior,join:e.members.join(",")},r=await function(e){return wd.get({url:$d.Start,params:e},{isTransformResponse:!1})}(t);if("0"!=r.st)throw Error("startBroadcastAudio fail:"+r.msg);return r.roomid}async inviteMemberAudioConferenceApi(e){const t={callee:e.members,roomid:e.roomId};return await function(e){return wd.get({url:$d.InviteMember,params:e},{isTransformResponse:!1})}(t)}async kickMemberAudioConferenceApi(e){const t={roomid:e.roomId,data:e.member,cmd:"kick"};return await Qd(t)}async endAudioConferenceApi(e){const t={roomid:e.roomId,data:"all",cmd:"kick"};return await Qd(t)}async muteAllAudioConferenceApi(e){const t={roomid:e.roomId,data:"all",cmd:e.mute?"mute":"unmute"};return await Qd(t)}async muteMemberAudioConferenceApi(e){const t={roomid:e.roomId,data:e.member,cmd:e.mute?"mute":"unmute"};return await Qd(t)}async getVideoConferenceMemberStatusListApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,member:"",cmd:"confdetail",roomid:e.roomId},n=(await el(i)).data,s=[];return n.map(e=>{s.push({num:e.num,audioMute:e.audio_mute})}),s}async inviteMemberVideoConferenceApi(e){const t={roomid:e.roomId,callee:e.members.join()},r=await function(e){return wd.get({url:Ld.InviteMember,params:e},{isTransformResponse:!1})}(t),{st:i}=r;if("0"!=i)throw Error(r.msg)}async muteMemberVideoConferenceApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,member:e.member,cmd:e.mute?"mute":"unmute",roomid:e.roomId};return await el(i)}async muteAllVideoConferenceApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,member:"all",cmd:e.mute?"mute":"unmute",roomid:e.roomId};return await el(i)}async kickMemberVideoConferenceApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,member:e.member,cmd:"kick",roomid:e.roomId};return await el(i)}async setLayoutVideoConferenceApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,roomid:e.roomId,mode:e.layoutId};return await function(e){return wd.get({url:Ld.SetLayout,params:e},{isTransformResponse:!1})}(i)}async setPositionVideoConferenceApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,cmd:"changelocation",roomid:e.roomId,member:e.member,id:e.positionIdx};return await el(i)}async endVideoConferenceApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,roomid:e.roomId};return await function(e){return wd.get({url:Ld.End,params:e},{isTransformResponse:!1})}(i)}async getVideoConferenceListApi(){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}async createVideoConferenceApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}async getVideoBroadcastMemberStatusListApi(e){const t={roomid:e.roomId,cmd:"xml_list"},r=await il(t);if(-1!=r.indexOf("not found"))throw Error("not found");const i=(new Kd).xml2js(r),n=[].concat(i.conferences.conference.members.member),s=[];return n.map(e=>{s.push({id:e.id,hasVfloor:e.has_vfloor,callerIdNumber:e.caller_id_number,canSpeak:!e.flags.can_speak})}),s}async startVideoBroadcastApi(e){const t={emcee:e.usernumberInterior,join:e.members.join()},r=await function(e){return wd.get({url:Vd.Start,params:e},{isTransformResponse:!1})}(t),{st:i,roomid:n}=r;if("0"!=i)throw Error(r.msg);return n}async inviteMemberVideoBroadcastApi(e){const t={callee:e.members,roomid:e.roomId},r=await function(e){return wd.get({url:Vd.InviteMember,params:e},{isTransformResponse:!1})}(t),{header:i}=r;if("1"!=i.code)throw Error(i.msg)}async muteMemberVideoBroadcastApi(e){const t={roomid:e.roomId,cmd:e.mute?"mute":"unmute",data:e.member},r=await il(t),{header:i}=r;if("1"!=i.code)throw Error(i.msg)}async muteAllVideoBroadcastApi(e){const t={roomid:e.roomId,cmd:e.mute?"mute":"unmute",data:"all"},r=await il(t),{header:i}=r;if("1"!=i.code)throw Error(i.msg)}async kickMemberVideoBroadcastApi(e){const t={roomid:e.roomId,cmd:"kick",data:e.member},r=await il(t),{header:i}=r;if("1"!=i.code)throw Error(i.msg)}async changeFloorVideoBroadcastApi(e){const t={roomid:e.roomId,cmd:"change_floor",data:e.member},r=await il(t),{header:i}=r;if("1"!=i.code)throw Error(i.msg)}async endVideoBroadcastApi(e){const t={roomid:e.roomId,cmd:"all"},r=await il(t),{header:i}=r;if("1"!=i.code)throw Error(i.msg)}async getCdrPageListApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,limit:e.pageSize,page:e.pageNum,offset:(e.pageNum-1)*e.pageSize};e.callerIdNumber&&(i.caller_id_number=e.callerIdNumber),e.destinationNumber&&(i.destination_number=e.destinationNumber),e.callType&&(i.call_type=e.callType),e.startTime&&(i.start_stamp=e.startTime),e.endTime&&(i.end_stamp=e.endTime);const n=await function(e){return wd.post({url:Hd.PageList,data:e},{isTransformResponse:!1})}(i);if(1!=n.header.code)throw Error(n.header.msg);const{cdrs:s}=n,o={total:parseInt(n.total_count),records:[]};return s.map(e=>{o.records.push({callerNumber:e.caller_id_number,callerName:"",calleeNumber:e.destination_number,calleeName:e.destination_name,startTime:e.start_stamp,endTime:e.end_stamp,timePeriod:e.duration,callType:parseInt(e.call_type),callState:e.call_state,audioFile:[],videoFile:[e.video_download_a],fileSizeFormatter:e.accountcode})}),o}viewCdrFileUrl(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}downloadCdrFileUrl(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}async getMemberPageListApi(e){be.hashStr(e.usernumberInterior+e.passwordInterior),e.usernumberInterior,e.pageSize,e.pageNum;const t=await(r=e,wd.put({url:qd.PageList,data:r},{isTransformResponse:!1}));var r;if(0!=t.state)throw Error(t.msg);const i={total:parseInt(t.page.total),records:[]};return t.data.map(e=>{i.records.push({usrName:e.usr_name,usrNumber:e.usr_number})}),i}async createTaskApi(e){var t;const r=(new Date).valueOf(),i=be.hashStr(e.usernumberInterior+r+e.passwordInterior),n={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:i,title:e.title,content:e.content,priority:e.priority,startdate:e.startDate,enddate:e.endDate,addr:e.addr,GPS:e.longitude+","+e.latitude,longitude:e.longitude,latitude:e.latitude,fileurl:null===(t=e.fileDetailList)||void 0===t?void 0:t.map(e=>e.url).join(),type:e.type};n.relevanter=e.relevanter.length>0?e.relevanter.join(","):"",n.executor=e.executor.length>0?e.executor.join(","):"",n.fileurl=e.fileIds.length>0?e.fileIds.join(","):"";const s=await(o=n,wd.post({url:Ud.Create,data:o},{isTransformResponse:!1}));var o;if(1!=s.header.code)throw Error(s.header.msg)}async updateTaskApi(e){var t;const r=(new Date).valueOf(),i=be.hashStr(e.usernumberInterior+r+e.passwordInterior),n={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:i,title:e.title,content:e.content,priority:e.priority,startdate:e.startDate,enddate:e.endDate,addr:e.addr,GPS:e.longitude+","+e.latitude,longitude:e.longitude,latitude:e.latitude,type:e.type,fileurl:null===(t=e.fileDetailList)||void 0===t?void 0:t.map(e=>e.url).join(),task_uuid:e.taskUuid};n.relevanter=e.relevanter.length>0?e.relevanter.join(","):"",n.executor=e.executor.length>0?e.executor.join(","):"",n.fileurl=e.fileIds.length>0?e.fileIds.join(","):"";const s=await(o=n,wd.post({url:Ud.Update,data:o},{isTransformResponse:!1}));var o;if(1!=s.header.code)throw Error(s.header.msg)}async deleteTaskApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,task_uuid:e.taskUuid},n=await rl(i);if(1!=n.data.header.code)throw Error(n.header.msg)}async getTaskPageListApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,limit:e.pageSize,page:e.pageNum,offset:(e.pageNum-1)*e.pageSize};e.title&&(i.title=e.title),e.executor&&(i.num=e.executor),e.status&&(i.state=e.status),e.startTime&&(i.start_stamp=e.startTime),e.endTime&&(i.end_stamp=e.endTime);const n=await function(e){return wd.post({url:Ud.PageList,data:e},{isTransformResponse:!1})}(i);if(1!=n.header.code)throw Error(n.header.msg);const{data:s}=n,o={total:parseInt(n.total),records:[]};return s.map(e=>{o.records.push({taskUuid:e.task_uuid,title:e.title,content:e.content,priority:e.priority,addtime:e.create_stamp,startDate:e.start_stamp,endDate:e.end_stamp,addr:e.addr,type:e.type,longitude:e.longitude,latitude:e.latitude,executor:e.executor,executorUsers:[],relevanter:e.relevanter,relevanterUsers:[],scope:e.scope,intervalTime:e.interval_time,beizhu:e.beizhu,status:e.status,fileList:[]})}),o}async getTaskApi(e){var t,r,i;const n=(new Date).valueOf(),s=be.hashStr(e.usernumberInterior+n+e.passwordInterior),o={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:s,task_uuid:e.taskUuid},a=await rl(o);if(1!=a.header.code)throw Error(a.header.msg);const c=a.data;return{taskUuid:c.task_uuid,title:c.title,content:c.content,priority:c.priority,addtime:c.create_stamp,startDate:c.start_stamp,endDate:c.end_stamp,addr:c.addr,type:c.type,longitude:c.longitude,latitude:c.latitude,executor:c.executor,executorUsers:c.executor?c.executor.split(",").map(e=>({usrNumber:e,usrName:""})):[],relevanter:c.relevanter,relevanterUsers:c.relevanter?c.relevanter.split(",").map(e=>({usrNumber:e,usrName:""})):[],scope:c.scope,intervalTime:c.interval_time,beizhu:c.beizhu,status:c.status,fileList:null===(t=c.newfiles)||void 0===t?void 0:t.map(e=>e.file.split("/").pop()),fileDetailList:null===(r=c.newfiles)||void 0===r?void 0:r.map(e=>({fileId:e.file.split("/").pop(),url:e.file})),details:null===(i=c.comment)||void 0===i?void 0:i.map(e=>({detailUuid:e.detail_uuid,content:e.content,fileList:e.newfiles,type:e.file,taskStatus:e.task_status,desc:e.task_status,fileDetailList:e.newfiles.map(e=>({fileId:e.file.split("/").pop(),url:e.file}))}))}}async createTaskCommentApi(e){var t;const r=(new Date).valueOf(),i=be.hashStr(e.usernumberInterior+r+e.passwordInterior),n={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:i,content:e.content,fileurl:null===(t=e.fileDetailList)||void 0===t?void 0:t.map(e=>e.url).join(),type:e.type,task_uuid:e.taskUuid,task_status:e.taskStatus},s=await(o=n,wd.post({url:Ud.CreateComment,data:o},{isTransformResponse:!1}));var o;if(1!=s.header.code)throw Error(s.header.msg)}async updateTaskCommentApi(e){var t;const r=(new Date).valueOf(),i=be.hashStr(e.usernumberInterior+r+e.passwordInterior),n={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:i,content:e.content,fileurl:null===(t=e.fileDetailList)||void 0===t?void 0:t.map(e=>e.url).join(),type:e.type,task_uuid:e.taskUuid,task_status:e.taskStatus,detail_uuid:e.detailUuid},s=await(o=n,wd.post({url:Ud.UpdateComment,data:o},{isTransformResponse:!1}));var o;if(1!=s.header.code)throw Error(s.header.msg)}async deleteTaskCommentApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,detail_uuid:e.detailUuid},n=await(s=i,wd.post({url:Ud.DeleteComment,data:s},{isTransformResponse:!1}));var s;if(1!=n.header.code)throw Error(n.header.msg)}async getSosPageListApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,limit:e.pageSize,page:e.pageNum,offset:(e.pageNum-1)*e.pageSize};e.from&&(i.from=e.from),e.sostype&&(i.sostype=e.sostype),e.startTime&&(i.start_stamp=e.startTime),e.endTime&&(i.end_stamp=e.endTime);const n=await function(e){return wd.post({url:Fd.PageList,data:e},{isTransformResponse:!1})}(i);if(1!=n.header.code)throw Error(n.header.msg);const{data:s}=n,o={total:parseInt(s.page.total),records:[]};return s.item.map(e=>{o.records.push({from:e.from,fromUsrName:e.from_name,sostype:e.sostype,sostime:e.sostime,addr:e.addr,toUers:e.to.map(e=>({usrNumber:e.to_number,usrName:e.to_name}))})}),o}async exportSosListApi(e){const t={limit:1e4};e.from&&(t.from=e.from),e.sostype&&(t.sostype=e.sostype),e.startTime&&(t.start_stamp=e.startTime),e.endTime&&(t.end_stamp=e.endTime);const r=Zr().apiUrl+"/api/get_sos/go_export.php?"+tl(t);console.log(r),ed({url:r,target:"_self"})}async getLoginhistoryPageListApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,limit:e.pageSize,page:e.pageNum,offset:(e.pageNum-1)*e.pageSize};e.usrNumber&&(i.num=e.usrNumber),e.state&&(i.state=e.state),e.startTime&&(i.start_stamp=e.startTime),e.endTime&&(i.end_stamp=e.endTime);const n=await function(e){return wd.post({url:Bd.PageList,data:e},{isTransformResponse:!1})}(i);if(1!=n.header.code)throw Error(n.header.msg);const{data:s}=n,o={total:parseInt(s.page.total),records:[]};return s.item.map(e=>{o.records.push({usrNumber:e.num,usrName:e.usr_name,state:e.state,stateVal:"",enterpriseName:e.enterprise_name,departmentName:e.dep_name,totalTime:e.total_time,operTime:e.log_time})}),o}async exportLoginhistoryListApi(e){const t={limit:1e4};e.usrNumber&&(t.num=e.usrNumber),e.state&&(t.state=e.state),e.startTime&&(t.start_stamp=e.startTime),e.endTime&&(t.end_stamp=e.endTime);const r=Zr().apiUrl+"/api/login_history/go_export.php?"+tl(t);console.log(r),ed({url:r,target:"_self"})}async getLoginhistoryStaticPageListApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,limit:e.pageSize,page:e.pageNum,offset:(e.pageNum-1)*e.pageSize};e.usrNumber&&(i.num=e.usrNumber),e.timeType&&(i.timeType=e.timeType),e.timeType&&(i.start_stamp=e.startTime),e.endTime&&(i.end_stamp=e.endTime);const n=await function(e){return wd.post({url:Bd.StaticPageList,data:e},{isTransformResponse:!1})}(i);if(1!=n.header.code)throw Error(n.header.msg);const{data:s}=n,o={total:parseInt(s.page.total),records:[]};return s.item.map(e=>{o.records.push({usrNumber:e.num,usrName:e.usr_name,enterpriseName:e.enterprise_name,departmentName:e.dep_name,totalTime:e.total_time})}),o}async exportLoginhistoryStaticListApi(e){const t={};e.usrNumber&&(t.num=e.usrNumber),e.timeType&&(t.timeType=e.timeType),e.timeType&&(t.start_stamp=e.startTime),e.endTime&&(t.end_stamp=e.endTime);const r=Zr().apiUrl+"/api/login_history/statistical_export.php?"+tl(t);console.log(r),ed({url:r,target:"_self"})}async getPttPageListApi(e){const t=(new Date).valueOf(),r=be.hashStr(e.usernumberInterior+t+e.passwordInterior),i={usernumber:e.usernumberInterior,timestamp:(new Date).valueOf(),sign:r,limit:e.pageSize,page:e.pageNum,offset:(e.pageNum-1)*e.pageSize};e.msgFrom&&(i.msg_from=e.msgFrom),e.groupNo&&(i.msg_to=e.groupNo),e.msgType&&(i.msg_type=e.msgType),e.startTime&&(i.start_stamp=e.startTime),e.endTime&&(i.end_stamp=e.endTime);const n=await function(e){return wd.post({url:Gd.PageList,data:e},{isTransformResponse:!1})}(i);if(1!=n.header.code)throw Error(n.header.msg);const{data:s}=n,o={total:parseInt(s.page.total),records:[]};return s.item.map(e=>{o.records.push({usrNumber:e.msg_from,usrName:e.from_name+`(${e.msg_from})`,groupNo:e.msg_to,groupName:e.group_name+`(${e.msg_to})`,msgType:e.msg_type,msgTime:e.msg_time,mediaLen:e.media_len,fileId:e.media_url.file.split("/").pop(),fileUrl:e.media_url})}),o}async exportPttListApi(e){const t={limit:1e4};e.msgFrom&&(t.msg_from=e.msgFrom),e.groupNo&&(t.msg_to=e.groupNo),e.msgType&&(t.msg_type=e.msgType),e.startTime&&(t.start_stamp=e.startTime),e.endTime&&(t.end_stamp=e.endTime);const r=Zr().apiUrl+"/api/get_call_record/go_export.php?"+tl(t);console.log(r),ed({url:r,target:"_self"})}getMqttGasPageListApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}getMqttInfoApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}updateNvrChannelApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}deleteWebrtcApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}closeStreamsApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}getGbRecordListApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}playbackGbStartApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}playbackStopApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}createTTSApi(e){throw Error("v1 \u7248\u672c\u4e0d\u652f\u6301\u6b64\u65b9\u6cd5")}}!function(e){e.Login="/api/app/auth/login",e.OnlineUsers="/api/app/user/online",e.ActiveCallUsers="/api/app/callchannel/realtime/active"}(zd||(zd={})),function(e){e.LoadDepartment="/api/app/department/load"}(Wd||(Wd={}));const{key:sl,iv:ol}=cd,al=new pd({key:sl,iv:ol});var cl,dl,ll,ul,hl,pl,gl;function fl(){return`${(e=new Date).getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}`;var e}!function(e){e.LoadGroup="/api/app/group/queryGroup",e.Create="/api/app/group/create",e.Update="/api/app/group/save",e.Delete="/api/app/group/delete"}(cl||(cl={})),function(e){e.StartLive="/api/app/live/start",e.StopLive="/api/app/live/stop",e.CtlLive="/api/app/live/ctl",e.UpdateNvrChannel="/api/app/live/nvrChannel/update",e.DeleteWebrtc="/api/app/live/delete/webrtc",e.CloseStreams="/api/app/live/close/streams"}(dl||(dl={})),function(e){e.ForeceInsert="/api/app/call/disapatch/foreceInsert",e.ForeceTeardown="/api/app/call/disapatch/foreceTeardown",e.AudioMonitor="/api/app/call/disapatch/audioMonitor",e.VideoMonitor="/api/app/call/disapatch/videoMonitor",e.VideoDispatch="/api/app/call/disapatch/videoDispatch",e.HangupChannel="/api/app/channel/hangup"}(ll||(ll={})),function(e){e.Ptz="/api/app/live/ptz"}(ul||(ul={})),function(e){e.CtlTalkRequire="/api/app/ptt/ctl/talk/require",e.CtlTalkRelease="/api/app/ptt/ctl/talk/release",e.Invite="/api/app/ptt/invite",e.Kick="/api/app/ptt/ctl/kick"}(hl||(hl={})),function(e){e.PageList="/api/app/clap/trans/search",e.SetReadStatus="/api/app/clap/trans/set/read/status",e.SetMarker="/api/app/clap/trans/set/marker",e.Delete="/api/app/clap/trans/delete/file",e.Export="/api/app/clap/trans/export"}(pl||(pl={})),function(e){e.GisByUserNumbers="/api/app/gis/get/by/user/number",e.BaiduReverseGeocoding="/api/app/baidumap/reverse_geocoding",e.GPSTrack="/api/app/gis/get/history/list"}(gl||(gl={}));var ml,vl,yl,bl,wl,Sl,Tl,_l,El,Cl,Rl,Al,Il,kl,Pl,xl;function Dl(e){return wd.post({url:yl.MemberStatus,data:e})}!function(e){e.List="/api/app/gis/fence/list",e.Create="/api/app/gis/fence/add",e.Update="/api/app/gis/fence/save",e.Delete="/api/app/gis/fence/delete",e.MemberList="/api/app/gis/fence/get/member/list",e.MeberAdd="/api/app/gis/fence/member/add",e.MeberDelete="/api/app/gis/fence/member/delete",e.WarningPageList="/api/app/gis/fence/warning/search",e.HistoryInoutPageList="/api/app/gis/fence/history/inout"}(ml||(ml={})),function(e){e.Start="/api/app/broadcast/audio/start",e.FileList="/api/app/broadcast/audio/files/list",e.InviteMember="/api/app/broadcast/audio/member/invite",e.PlayFile="/api/app/broadcast/audio/files/play",e.MuteAll="/api/app/broadcast/audio/mute/all",e.MuteMember="/api/app/broadcast/audio/mute/member",e.KickMember="/api/app/broadcast/audio/member/kick",e.End="/api/app/broadcast/audio/end",e.PlayPause="/api/app/broadcast/audio/play/pause",e.SetVolume="/api/app/broadcast/audio/volume/set",e.StartAndPlay="/api/app/broadcast/audio/startAndPlay",e.CreateFile="/api/app/broadcast/audio/create"}(vl||(vl={})),function(e){e.MemberStatus="/api/app/conference/room/audio/member/status",e.Start="/api/app/conference/audio/start",e.InviteMember="/api/app/conference/audio/member/invite",e.KickMember="/api/app/conference/audio/member/kick",e.End="/api/app/conference/audio/end",e.MuteAll="/api/app/conference/audio/mute/all",e.MuteMember="/api/app/conference/audio/mute/member"}(yl||(yl={})),function(e){e.History="/api/app/im/message/history",e.Delete="/api/app/im/message/delete"}(bl||(bl={})),function(e){e.MemberStatus="/api/app/conference/room/video/member/status",e.InviteMember="/api/app/conference/video/member/invite",e.KickMember="/api/app/conference/video/member/kick",e.MuteAll="/api/app/conference/video/mute/all",e.MuteMember="/api/app/conference/video/mute",e.SetLayout="/api/app/conference/video/layout/set",e.SetPosition="/api/app/conference/video/position/set",e.End="/api/app/conference/video/end",e.List="/api/app/conference/video/list",e.Create="/api/app/conference/video/create"}(wl||(wl={})),function(e){e.PageList="/api/app/cdr/search"}(Sl||(Sl={})),function(e){e.PageList="/api/app/user/list"}(Tl||(Tl={})),function(e){e.Create="/api/app/task/create",e.Update="/api/app/task/update",e.Delete="/api/app/task/delete",e.PageList="/api/app/task/search",e.Query="/api/app/task/query",e.CreateComment="/api/app/task/comment/create",e.UpdateComment="/api/app/task/comment/update",e.DeleteComment="/api/app/task/comment/delete"}(_l||(_l={})),function(e){e.PageList="/api/app/sos/search",e.Export="/api/app/sos/export"}(El||(El={})),function(e){e.PageList="/api/app/loginhistory/search",e.ExportList="/api/app/loginhistory/export",e.StaticPageList="/api/app/loginhistory/static/search",e.ExportStaticPageList="/api/app/loginhistory/static/export"}(Cl||(Cl={})),function(e){e.PageList="/api/app/ptt/record/search",e.Export="/api/app/ptt/record/export"}(Rl||(Rl={})),function(e){e.PageList="/api/app/mqtt/gas/search"}(Al||(Al={})),function(e){e.Query="/api/app/mqtt/query"}(Il||(Il={})),function(e){e.MemberStatus="/api/app/conference/room/audio/member/status",e.Start="/api/app/broadcast/video/start",e.InviteMember="/api/app/broadcast/video/member/invite",e.KickMember="/api/app/broadcast/video/member/kick",e.MuteAll="/api/app/broadcast/video/mute/all",e.MuteMember="/api/app/broadcast/video/mute/member",e.End="/api/app/broadcast/video/end",e.ChangeFloor="/api/app/broadcast/video/changeFloor"}(kl||(kl={})),function(e){e.GetRecordList="/api/app/gb/device/recordList",e.PlaybackStart="/api/app/gb/device/playbackStart",e.PlaybackStop="/api/app/gb/device/playbackStop"}(Pl||(Pl={})),function(e){e.Create="/api/app/tts/create"}(xl||(xl={}));class Ol{async loginApi(e){var t;return e.password=(t=e.password,al.encryptByAES(t)),await function(e){return wd.post({url:zd.Login,data:e},{encryption:!0})}(e)}async loadDepartmentApi(e){return await wd.post({url:Wd.LoadDepartment})}async loadGroupApi(e){return await wd.post({url:cl.LoadGroup})}async loadUserStatusApi(e){return await wd.post({url:zd.OnlineUsers})}async startLiveApi(e){return await(t=e,wd.post({url:dl.StartLive,data:t,timeout:3e4}));var t}async stopLiveApi(e){return await(t=e,wd.post({url:dl.StopLive,data:t}));var t}async loadLiveCallsApi(e){return await wd.post({url:zd.ActiveCallUsers})}async foreceInsertApi(e){return await(t=e,wd.post({url:ll.ForeceInsert,data:t}));var t}async foreceTeardownApi(e){return await(t=e,wd.post({url:ll.ForeceTeardown,data:t}));var t}async audioMonitorApi(e){return await(t=e,wd.post({url:ll.AudioMonitor,data:t}));var t}async videoMonitorApi(e){return await(t=e,wd.post({url:ll.VideoMonitor,data:t}));var t}async videoDispatchApi(e){return await(t=e,wd.post({url:ll.VideoDispatch,data:t}));var t}async hangupChannelApi(e){return await(t=e,wd.post({url:ll.HangupChannel,data:t}));var t}async deviceControlPtzApi(e){return await(t=e,wd.post({url:ul.Ptz,data:t}));var t}async ctlLiveApi(e){return await(t=e,wd.post({url:dl.CtlLive,data:t}));var t}async pttCtlTalkApi(e){return 1==e.type?await(t=e,wd.post({url:hl.CtlTalkRequire,data:t})):await function(e){return wd.post({url:hl.CtlTalkRelease,data:e})}(e);var t}async pttInvitedApi(e){return await(t=e,wd.post({url:hl.Invite,data:t}));var t}async pttKickApi(e){return await(t=e,wd.post({url:hl.Kick,data:t}));var t}async getClapTransPageListApi(e){const t=await(r=e,wd.post({url:pl.PageList,data:r}));var r;const i=Zr().apiUrl,n=new URL(i);return t.records.map(e=>{e.liveStreamPlaySupport&&("https:"===n.protocol?e.liveUrl=`${n.protocol}//${n.hostname}:${e.liveStreamHttpsPort}/${e.filePath}`:e.liveUrl=`${n.protocol}//${n.hostname}:${e.liveStreamHttpPort}/${e.filePath}`)}),t}async setClapTransReadStatusApi(e){return await(t=e,wd.post({url:pl.SetReadStatus,data:t}));var t}async setClapTransMarkerApi(e){return await(t=e,wd.post({url:pl.SetMarker,data:t}));var t}async deleteClapTransApi(e){return await(t=e,wd.post({url:pl.Delete,data:t}));var t}async exportClapTransUrlApi(e){return await(t=e,wd.download({url:pl.Export,data:t},fl()+".xlsx"));var t}async getGisByUserNumbers(e){return await(t=e,wd.post({url:gl.GisByUserNumbers,data:t}));var t}async getBaiduMapReverseGeocoding(e){return await function(e){return wd.post({url:gl.BaiduReverseGeocoding,params:e},{isTransformResponse:!1})}(e)}async getGPSTrackByNumber(e){return await(t=e,wd.post({url:gl.GPSTrack,data:t}));var t}async getGisFenceListApi(e){return await wd.post({url:ml.List})}async createGroupApi(e){return await(t=e,wd.post({url:cl.Create,data:t}));var t}async updateGroupApi(e){return await(t=e,wd.post({url:cl.Update,data:t}));var t}async deleteGroupApi(e){return await(t=e,wd.post({url:cl.Delete,data:t}));var t}async uploadApi(e){const t=(await function(e,t){return wd.uploadFile({url:Zr().apiUrl+"/file/upload",onUploadProgress:t},e)}(e)).data;if("1"!=t.code)throw Error("Upload file error, error message :"+t.message);const r=Zr().apiUrl;return{fileId:t.data.fileId,notTokenUrl:`${r}/file/download/${t.data.fileId}`,url:`${r}/file/download/${t.data.fileId}?authorization=${id()}`}}async getFileListByGroupTagApi(e){const t=await function(e){return wd.post({url:"/file/listFileByGroupTag/"+e})}(e),r=Zr().apiUrl,i=new URL(r);return t.map(e=>{e.liveStreamPlaySupport&&("https:"===i.protocol?e.liveUrl=`${i.protocol}//${i.hostname}:${e.liveStreamHttpsPort}/${e.filePath}`:e.liveUrl=`${i.protocol}//${i.hostname}:${e.liveStreamHttpPort}/${e.filePath}`)}),t}downloadFileUrl(e){return`${Zr().apiUrl}/file/download/${e.fileId}?authorization=${id()}`}async getMsgPageListApi(e){return await(t=e,wd.post({url:bl.History,data:t}));var t}async deleteMsgApi(e){return await(t=e,wd.post({url:bl.Delete,data:t}));var t}async createGisFenceApi(e){return await(t=e,wd.post({url:ml.Create,data:t}));var t}async updateGisFenceApi(e){return await(t=e,wd.post({url:ml.Update,data:t}));var t}async deleteGisFenceApi(e){return await(t=e,wd.post({url:ml.Delete,data:t}));var t}async getGisFenceMemberListApi(e){return await(t=e,wd.post({url:ml.MemberList,data:t}));var t}async addGisFenceMemberApi(e){return await(t=e,wd.post({url:ml.MeberAdd,data:t}));var t}async deleteGisFenceMemberApi(e){return await(t=e,wd.post({url:ml.MeberDelete,data:t}));var t}async getGisFenceWarningListApi(e){return await(t=e,wd.post({url:ml.WarningPageList,data:t}));var t}async getGisFenceHistoryInoutPageListApi(e){return await(t=e,wd.post({url:ml.HistoryInoutPageList,data:t}));var t}async startBroadcastAudioApi(e){return await(t=e,wd.post({url:vl.Start,data:t}));var t}async startAndPlayBroadcastAudioApi(e){return await(t=e,wd.post({url:vl.StartAndPlay,data:t}));var t}async startPlayBroadcastAudioFileApi(e){return await(t=e,wd.post({url:vl.PlayFile,data:t}));var t}async createBroadcastAudioFileApi(e){return await(t=e,wd.post({url:vl.CreateFile,data:t}));var t}async getBroadcastAudioFileListApi(e){return await wd.post({url:vl.FileList})}async inviteMemberBroadcastAudioApi(e){return await(t=e,wd.post({url:vl.InviteMember,data:t}));var t}async playBroadcastAudioFileApi(e){return await(t=e,wd.post({url:vl.PlayPause,data:t}));var t}async muteAllBroadcastAudioApi(e){return await(t=e,wd.post({url:vl.MuteAll,data:t}));var t}async muteMemberBroadcastAudioApi(e){return await(t=e,wd.post({url:vl.MuteMember,data:t}));var t}async kickMemberBroadcastAudioApi(e){return await(t=e,wd.post({url:vl.KickMember,data:t}));var t}async endBroadcastAudioApi(e){return await(t=e,wd.post({url:vl.End,data:t}));var t}async setVolumeBroadcastAudioApi(e){return await(t=e,wd.post({url:vl.SetVolume,data:t}));var t}async getBroadcastAudioMemberStatusListApi(e){return await Dl(e)}async getAudioConferenceMemberStatusListApi(e){return await Dl(e)}async startAudioConferenceApi(e){return await(t=e,wd.post({url:yl.Start,data:t}));var t}async inviteMemberAudioConferenceApi(e){return await(t=e,wd.post({url:yl.InviteMember,data:t}));var t}async kickMemberAudioConferenceApi(e){return await(t=e,wd.post({url:yl.KickMember,data:t}));var t}async endAudioConferenceApi(e){return await(t=e,wd.post({url:yl.End,data:t}));var t}async muteAllAudioConferenceApi(e){return await(t=e,wd.post({url:yl.MuteAll,data:t}));var t}async muteMemberAudioConferenceApi(e){return await(t=e,wd.post({url:yl.MuteMember,data:t}));var t}async getVideoConferenceMemberStatusListApi(e){return await(t=e,wd.post({url:wl.MemberStatus,data:t}));var t}async inviteMemberVideoConferenceApi(e){return await(t=e,wd.post({url:wl.InviteMember,data:t}));var t}async muteMemberVideoConferenceApi(e){return await(t=e,wd.post({url:wl.MuteMember,data:t}));var t}async muteAllVideoConferenceApi(e){return await(t=e,wd.post({url:wl.MuteAll,data:t}));var t}async kickMemberVideoConferenceApi(e){return await(t=e,wd.post({url:wl.KickMember,data:t}));var t}async setLayoutVideoConferenceApi(e){return await(t=e,wd.post({url:wl.SetLayout,data:t}));var t}async setPositionVideoConferenceApi(e){return await(t=e,wd.post({url:wl.SetPosition,data:t}));var t}async endVideoConferenceApi(e){return await(t=e,wd.post({url:wl.End,data:t}));var t}async getVideoConferenceListApi(){return await wd.post({url:wl.List})}async createVideoConferenceApi(e){return await function(e){return wd.post({url:wl.Create,data:e})}(e)}async getVideoBroadcastMemberStatusListApi(e){return await(t=e,wd.post({url:kl.MemberStatus,data:t}));var t}async startVideoBroadcastApi(e){return await(t=e,wd.post({url:kl.Start,data:t}));var t}async inviteMemberVideoBroadcastApi(e){return await(t=e,wd.post({url:kl.InviteMember,data:t}));var t}async muteMemberVideoBroadcastApi(e){return await(t=e,wd.post({url:kl.MuteMember,data:t}));var t}async muteAllVideoBroadcastApi(e){return await(t=e,wd.post({url:kl.MuteAll,data:t}));var t}async kickMemberVideoBroadcastApi(e){return await(t=e,wd.post({url:kl.KickMember,data:t}));var t}async changeFloorVideoBroadcastApi(e){return await(t=e,wd.post({url:kl.ChangeFloor,data:t}));var t}async endVideoBroadcastApi(e){return await(t=e,wd.post({url:kl.End,data:t}));var t}async getCdrPageListApi(e){return await(t=e,wd.post({url:Sl.PageList,data:t}));var t}viewCdrFileUrl(e){const t=Zr().apiUrl,r=new URL(t);return e.liveStreamPlaySupport?"https:"===r.protocol?`${r.protocol}//${r.hostname}:${e.liveStreamHttpsPort}/${e.filePath}`:`${r.protocol}//${r.hostname}:${e.liveStreamHttpPort}/${e.filePath}`:`${t}/api/app/cdr/view/${e.filePath}?authorization=${id()}`}downloadCdrFileUrl(e){return`${Zr().apiUrl}/api/app/cdr/download/${e}?authorization=${id()}`}async getMemberPageListApi(e){return await(t=e,wd.post({url:Tl.PageList,data:t}));var t}async createTaskApi(e){return await(t=e,wd.post({url:_l.Create,data:t}));var t}async updateTaskApi(e){return await(t=e,wd.post({url:_l.Update,data:t}));var t}async deleteTaskApi(e){return await(t=e,wd.post({url:_l.Delete,data:t}));var t}async getTaskPageListApi(e){return await(t=e,wd.post({url:_l.PageList,data:t}));var t}async getTaskApi(e){var t,r;const i=await(n=e,wd.post({url:_l.Query,data:n}));var n;const s=Zr().apiUrl;return i.fileDetailList=[],null===(t=i.fileList)||void 0===t||t.map(e=>{var t;null===(t=i.fileDetailList)||void 0===t||t.push({fileId:e,url:`${s}/file/download/${e}?authorization=${id()}`})}),null===(r=i.details)||void 0===r||r.map(e=>{var t;e.fileDetailList=[],null===(t=e.fileList)||void 0===t||t.map(t=>{var r;null===(r=e.fileDetailList)||void 0===r||r.push({fileId:t,url:`${s}/file/download/${t}?authorization=${id()}`})})}),i}async createTaskCommentApi(e){return await(t=e,wd.post({url:_l.CreateComment,data:t}));var t}async updateTaskCommentApi(e){return await(t=e,wd.post({url:_l.UpdateComment,data:t}));var t}async deleteTaskCommentApi(e){return await(t=e,wd.post({url:_l.DeleteComment,data:t}));var t}async getSosPageListApi(e){return await(t=e,wd.post({url:El.PageList,data:t}));var t}async exportSosListApi(e){return await(t=e,wd.download({url:El.Export,data:t},fl()+".xlsx"));var t}async getLoginhistoryPageListApi(e){return await(t=e,wd.post({url:Cl.PageList,data:t}));var t}async exportLoginhistoryListApi(e){return await(t=e,wd.download({url:Cl.ExportList,data:t},fl()+".xlsx"));var t}async getLoginhistoryStaticPageListApi(e){return await(t=e,wd.post({url:Cl.StaticPageList,data:t}));var t}async exportLoginhistoryStaticListApi(e){return await(t=e,wd.download({url:Cl.ExportStaticPageList,data:t},fl()+".xlsx"));var t}async getPttPageListApi(e){const t=await(r=e,wd.post({url:Rl.PageList,data:r}));var r;const i=Zr().apiUrl;return t.records.map(e=>{e.fileUrl=`${i}/file/download/${e.fileId}?authorization=${id()}`}),t}async exportPttListApi(e){return await(t=e,wd.download({url:Rl.Export,data:t},fl()+".xlsx"));var t}async getMqttGasPageListApi(e){return await(t=e,wd.post({url:Al.PageList,data:t}));var t}async getMqttInfoApi(e){return await(t=e,wd.post({url:Il.Query,data:t}));var t}async updateNvrChannelApi(e){return await(t=e,wd.post({url:dl.UpdateNvrChannel,data:t}));var t}async deleteWebrtcApi(e){return await(t=e,wd.post({url:dl.DeleteWebrtc,data:t}));var t}async closeStreamsApi(e){return await(t=e,wd.post({url:dl.CloseStreams,data:t}));var t}async getGbRecordListApi(e){return await(t=e,wd.post({url:Pl.GetRecordList,data:t,timeout:6e4}));var t}async playbackGbStartApi(e){return await(t=e,wd.post({url:Pl.PlaybackStart,data:t}));var t}async playbackStopApi(e){return await(t=e,wd.post({url:Pl.PlaybackStop,data:t}));var t}async createTTSApi(e){return await(t=e,wd.post({url:xl.Create,data:t,timeout:12e4}));var t}}var Ml=r(43);class Nl{constructor(e,t,r,i,n,s,o=""){this.brokerHost=e,this.brokerPort=t,this.endpoint=o,this.subscribeTopics=[],this.subscribeCallbacks=new Map,this.currentReconnectCount=0,this.isSecure=r,this.clientId=i,this.isResetConnect=!1,this.userName=n,this.password=s}subscribe(e,t=0){this.subscribeTopics.push({topic:e,qos:t}),this.mqclient&&this.mqclient.isConnected()&&this.mqclient.subscribe(e,{qos:t})}unsubscribe(e){const t=this.subscribeTopics.findIndex(t=>t.topic===e);t>=0&&(this.subscribeTopics.splice(t,1),this.mqclient&&this.mqclient.isConnected()&&this.mqclient.unsubscribe(e))}setMessageCallback(e,t){this.subscribeCallbacks.set(e,t)}isConnected(){return this.mqclient&&this.mqclient.isConnected()}connect(){var e,t,r;this.currentReconnectCount=0;(()=>{this.mqclient=new Ml.Client(this.brokerHost,this.brokerPort,this.clientId),this.mqclient.onConnectionLost=e=>{console.log(e);const t="{time:"+(new Date).toLocaleDateString()+", onConnectionLost()}";if(console.log(t),0!==e.errorCode)if(console.log("\u8fde\u63a5\u5173\u95ed\u6216\u79bb\u7ebf: "+e),8===e.errorCode){const e=this.clientId,t=(new Date).getTime();this.clientId+="_"+t,console.log(`\u5176\u4ed6\u5ba2\u6237\u7aef\u6b63\u5728\u8fde\u63a5\uff0c\u5176\u4ed6\u5ba2\u6237\u7aef\u4f7f\u7528\u76f8\u540c\u7684clientId ${e}\u8fde\u63a5\uff0c\u5207\u6362clientId\u4e3a${this.clientId}`),this.reconnect()}else this.reconnect()},this.mqclient.onMessageArrived=e=>{console.log("Mqtt massage = ",e),this.subscribeCallbacks.forEach((t,r)=>{-1!==e.destinationName.indexOf(r)&&t(e.destinationName,e.payloadString)})},this.mqclient.connect({userName:this.userName,password:this.password,timeout:10,keepAliveInterval:20,useSSL:this.isSecure,cleanSession:!1,onSuccess:()=>{var e,t;console.log(`\u6210\u529f\u8fde\u63a5\u5230\u670d\u52a1\u5668[${this.brokerHost}:${this.brokerPort}]`);for(let t=0;t<this.subscribeTopics.length;t++){const r=this.subscribeTopics[t];null===(e=this.mqclient)||void 0===e||e.subscribe(r.topic,{qos:r.qos})}this.isResetConnect&&(null===(t=this.onReconnectSuccess)||void 0===t||t.call(this)),this.currentReconnectCount=0},onFailure:e=>{console.log("\u8fde\u63a5\u9519\u8bef: "+e),this.reconnect()}})})(),this.reconnectInterval=null!==(e=this.reconnectInterval)&&void 0!==e?e:5e3,this.maxReconnectCount=null!==(t=this.maxReconnectCount)&&void 0!==t?t:5,this.onReconnect=null!==(r=this.onReconnect)&&void 0!==r?r:()=>{}}reconnect(){this.mqclient&&this.mqclient.isConnected()||(console.log("\u6b63\u5728\u8fdb\u884c\u91cd\u8fdeMqtt\u670d\u52a1\u5668..."),this.reconnectTask&&clearTimeout(this.reconnectTask),this.reconnectTask=setTimeout(()=>{var e;this.currentReconnectCount++,this.isResetConnect=!0,null===(e=this.onReconnect)||void 0===e||e.call(this),this.connect()},this.reconnectInterval))}disconnect(){this.mqclient&&(this.isConnected()&&this.mqclient.disconnect(),this.mqclient=void 0,console.log("\u5df2\u65ad\u5f00\u8fde\u63a5"))}}class $l{constructor(e,t=9443,r,i,n,s=!0,o=443,a=Yr.V1,c="zh_CN",d=9083){this.delegate=n,this.serverAddr=e,this.port=t.toString(),this.acc=r,this.pwd=i,this.http_port=o.toString(),this.version=a,this.lang=c,this.mqttPort=d;const l="sip:"+this.acc+"@"+this.serverAddr;this.unionRtcOptions={aor:l,reconnectionAttempts:100,reconnectionDelay:5,userAgentOptions:{authorizationPassword:this.pwd,authorizationUsername:this.acc,displayName:this.acc,contactName:this.acc,logBuiltinEnabled:!0,logLevel:"debug",userAgentString:"unionbroad dispatcher web"}};const u=s?"wss":"ws";this.http_prefix=s?"https":"http";const h=u+"://"+e+":"+t;this.unionRtc=new Jr(h,this.http_prefix,this.unionRtcOptions),console.log(` data port [${this.http_port}] ,login port [${this.port}]`);const p="web_dispatch_"+this.acc;this.mqttClient=new Nl(e,this.mqttPort,s,p,this.acc,this.pwd),this.unionRtcDelegate={onCallCreated:()=>{console.log(` rtcclient [${this.acc}] Call created`)},onCallHangup:(e,t)=>{console.log(` rtcclient [${this.acc}] Call onCallHangup`),this.delegate&&this.delegate.onCallHangup&&this.delegate.onCallHangup(e,t)},onCallReceived:(e,t,r,i,n,s)=>{console.log(`rtcclient [${t}] incalling call is video ${r} type ${i} initiator ${n} members${s}`),this.delegate&&this.delegate.onCallReceived&&this.delegate.onCallReceived(e,t,r,i,n,s)},onCallAnswered:(e,t)=>{console.log(`rtcclient [${this.acc}] Call onCallAnswered call id ${e}, callee ${t}`),this.delegate&&this.delegate.onCallAnswered&&this.delegate.onCallAnswered(e,t)},onCallHold:e=>{},onRegistered:()=>{console.log(`rtcclient [${this.acc}] registered,result data [${this.unionRtc.logindata}]`),this.delegate&&this.delegate.onLoginSuccess&&this.delegate.onLoginSuccess(this.unionRtc.logindata)},onUnregistered:()=>{console.log("rtcclient unregistered"),this.unionRtc.disconnect(),this.delegate&&this.delegate.onLogout&&this.delegate.onLogout(),this.mqttClient.disconnect()},onMessageReceived:(e,t,r)=>{if(console.log("rtcclient receive message "+e),console.log("message type "+t+" from "+r),"text/poc-gis"==t)this.delegate&&this.delegate.onGPSEvent&&this.delegate.onGPSEvent(r,e);else if("text/plain"==t)this.delegate&&this.delegate.onMessageEvent&&this.delegate.onMessageEvent(r,1,e);else if("text/group"==t)this.delegate&&this.delegate.onMessageEvent&&this.delegate.onMessageEvent(r,2,e);else if("text/broadcast"==t){5==this.getMsgType(e)?this.delegate&&this.delegate.onSOSEvent&&this.delegate.onSOSEvent(r,e):this.delegate&&this.delegate.onMessageEvent&&this.delegate.onMessageEvent(r,3,e)}else"text/poc"==t?this.delegate&&this.delegate.onMessageEvent&&this.delegate.onMessageEvent(r,4,e):"text/poc-callgroup"==t?this.delegate&&this.delegate.onNotifyEvent&&this.delegate.onNotifyEvent(r,1,e):"text/poc-user"==t?this.delegate&&this.delegate.onNotifyEvent&&this.delegate.onNotifyEvent(r,2,e):"text/poc-manager"==t?(this.unionRtc.unregister(),this.mqttClient.disconnect(),this.delegate&&this.delegate.onKickOut&&this.delegate.onKickOut(r,e)):"text/poc-report"==t&&this.delegate&&this.delegate.onReportEvent&&this.delegate.onReportEvent(r,e)},onServerConnect:()=>{console.log("rtcclient connected with server"),this.unionRtc.register(void 0,{requestDelegate:{onReject:e=>{let t=`Registration of "${this.acc}" rejected.\n`;t+=`Reason: ${e.message.reasonPhrase}\n`,this.delegate&&this.delegate.onLoginFailed&&this.delegate.onLoginFailed(t)}}})},onPttControlEvent:(e,t,r,i)=>{this.delegate&&this.delegate.onPttControlEvent&&this.delegate.onPttControlEvent(e,t,r,i)},onVideoMonitorEvent:(e,t,r)=>{this.delegate&&this.delegate.onVideoMonitorEvent&&this.delegate.onVideoMonitorEvent(e,t,r)},onMakePtzEvent:(e,t,r)=>{this.delegate&&this.delegate.onMakePtzEvent&&this.delegate.onMakePtzEvent(e,t,r)},onMakeGbDevicePttEvent:(e,t,r)=>{this.delegate&&this.delegate.onMakeGbDevicePttEvent&&this.delegate.onMakeGbDevicePttEvent(e,t,r)},onUserListEvent:(e,t)=>{this.delegate&&this.delegate.onUserListEvent&&this.delegate.onUserListEvent(e,t)},onLiveCallsEvent:(e,t)=>{this.delegate&&this.delegate.onLiveCallsEvent&&this.delegate.onLiveCallsEvent(e,t)},onUserStatusEvent:(e,t)=>{this.delegate&&this.delegate.onUserStatusEvent&&this.delegate.onUserStatusEvent(e,t)},onCallInfoReceived:(e,t,r,i)=>{if("application/poc_state"==e){let e,n=0,s="",o=-1,a=t.split("\r\n");for(let t=0;t<a.length;t++){let r=a[t].split("=");if(2==r.length)if(r[0]&&"state"==r[0]){let e=r[1];"idle"==e?o=0:"add"==e?o=3:"del"==e?o=4:"talking"==e?o=1:"release"==e&&(o=2)}else r[0]&&"count"==r[0]?n=Number(r[1]):r[0]&&"number"==r[0]?e=r[1]:r[0]&&"members"==r[0]&&(s=r[1])}this.delegate&&this.delegate.onPttEvent&&this.delegate.onPttEvent(r,i,o,e,s,n)}}},this.unionRtc.delegate=this.unionRtcDelegate;const g=this.serverAddr+":"+this.http_port;let f=this.http_prefix+"://"+g;var m;m={apiUrl:f,lang:this.lang},Xr=m;const v=this.version===Yr.V1;this.httpApi=v?new nl:new Ol,this.logger=this.unionRtc.logger}getMsgType(e){var t=JSON.parse(e);for(var r in t)if("type"==r)return t[r]}makeLoadGroup(e,t,r,i,n){var s=new XMLHttpRequest;s.onreadystatechange=function(){s.readyState==XMLHttpRequest.DONE&&200==s.status&&n&&n.onGroupEvent&&n.onGroupEvent(s.responseText)},s.open("POST",e,!0),s.send()}async loadGroup(){const e=await this.httpApi.loadGroupApi({usernumberInterior:this.acc,passwordInterior:this.pwd});return this.delegate&&this.delegate.onGroupEvent&&this.delegate.onGroupEvent(JSON.stringify(e)),e}async makeHttpLogin(e,t,r=""){var i,n;try{const n=await this.httpApi.loginApi({usernumber:e,password:t,type:"dispatch",deviceId:r,autoKickOutSend:!0});return n?(console.log("Login successful"),console.log("Login result:",n),nd(n.accessToken),this.unionRtc.logindata=JSON.stringify(n),this.unionRtc.connect(),this.mqttClient.onReconnectSuccess=()=>{this.loadUserStatus(),this.loadLiveCalls()},this.mqttClient.connect(),this.subscribeToStatusTopic(n.enterpriseCode)):(console.log("Login failed: Result is empty"),null===(i=this.delegate)||void 0===i||i.onLoginFailed("Login failed: Result is empty")),n}catch(e){throw console.error("Login error:",e.message),null===(n=this.delegate)||void 0===n||n.onLoginFailed(e.message),Error(e)}}async makeHttpLoginNotKickOut(e,t,r=""){if(this.version===Yr.V1)return;const i=await this.httpApi.loginApi({usernumber:e,password:t,type:"dispatch",deviceId:r,autoKickOutSend:!1});i&&(console.log("Login successful"),console.log("Login result:",i),nd(i.accessToken))}async loginOnlySetToken(){return this.logger.log(`[${this.acc}] start login ... ${this.http_port}`),await this.makeHttpLoginNotKickOut(this.acc,this.pwd)}async login(){return this.logger.log(`[${this.acc}] start login ... ${this.http_port}`),await this.makeHttpLogin(this.acc,this.pwd)}unregister(){return this.logger.log("rtcclient unregister"),this.unionRtc.unregister()}logout(){return this.logger.log("rtcclient unregister"),this.mqttClient.disconnect(),this.unionRtc.unregister()}call(e,t,r,i,n){const s="sip:"+e+"@"+this.serverAddr;let o;o=t?{sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!0}}}:{sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}}};return this.unionRtc.call(s,e,o,{},r,i,n)}sendBroadCastMessage(e,t,r){const i="sip:"+e+"@"+this.serverAddr;this.unionRtc.sendBrMessage(i,t,r)}sendGroupMessage(e,t){const r="sip:"+e+"@"+this.serverAddr;this.unionRtc.sendMessage(r,t,"text/group")}sendP2pMessage(e,t){const r="sip:"+e+"@"+this.serverAddr;this.unionRtc.sendMessage(r,t,"text/plain")}sendGbMessage(e,t){const r="sip:"+e+"@"+this.serverAddr;this.unionRtc.sendMessage(r,t,"Application/MANSCDP+xml")}makeGroupPtt(e,t){const r="sip:"+e+"@"+this.serverAddr;let i;i={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}}};return this.unionRtc.call(r,e,i,{},t)}makeAudioMonitor(e,t){const r="sip:"+e+"@"+this.serverAddr;let i;i={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}},isAudioMonitor:!0};return this.unionRtc.call(r,e,i,{},t)}async makeVideoMonitorRtc(e,t,r={w:1920,h:1080}){console.log("makeVideoMonitorRtc",this.acc+", "+e);const i=await this.httpApi.startLiveApi({usernumberInterior:this.acc,callee:e,passwordInterior:this.pwd});return await this.unionRtc.makeVideoMonitorWebrtcUrl(e,i.webrtc,t,r)}async makeVideoMonitorRtcUrl(e,t,r,i={w:1920,h:1080}){return await this.unionRtc.makeVideoMonitorWebrtcUrl(e,t,r,i)}stopVideoMonitorRtc(e){this.unionRtc.stopVideoMonitorWebrtc(e)}async makePushStreamRtc(e,t={w:800,h:600},r=!0,i=!0){const n="https"===this.http_prefix?"10443":"10000",s=this.http_prefix+"://"+this.serverAddr+":"+n+`/index/api/webrtc?app=live&stream=${this.acc}&type=push`;return await this.unionRtc.makePushStreamWebrtc(this.acc,s,t,e,r,i)}async stopPushStreamRtc(e){this.acc,this.pwd;this.unionRtc.stopPushStreamWebrtc(e)}getRandomInt(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e))+e}makeAudioConference(e,t,r){const i="sip:"+e+"@"+this.serverAddr;let n;n={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}},isconference:!0,conferenceMembers:t};return this.unionRtc.call(i,e,n,{},r)}makeAudioBroadcast(e,t,r){const i="sip:"+e+"@"+this.serverAddr;let n;n={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}},isaudiobroadcast:!0,audiobroadcastMembers:t};return this.unionRtc.call(i,e,n,{},r)}makeTempPtt(e,t,r){const i="sip:"+e+"@"+this.serverAddr;let n;n={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}},pttTempInfo:t};return this.unionRtc.call(i,e,n,{},r)}async startVideoMonitor(e,t){const r=await this.httpApi.startLiveApi({usernumberInterior:e,callee:t,passwordInterior:this.pwd});return this.delegate&&this.delegate.onVideoMonitorEvent&&this.delegate.onVideoMonitorEvent(e,t,JSON.stringify(r)),r}async stopVideoMonitor(e,t,r){const i=await this.httpApi.stopLiveApi({usernumberInterior:e,callee:t,passwordInterior:this.pwd,uuid:r});this.delegate&&this.delegate.onVideoMonitorEvent&&this.delegate.onVideoMonitorEvent(e,t,JSON.stringify(i))}async makePtz(e,t,r){return await this.httpApi.deviceControlPtzApi({usernumberInterior:e,callee:t,passwordInterior:this.pwd,ptzCode:r.toString()})}async makeGbDevicePtt(e,t){return await this.httpApi.ctlLiveApi({usernumberInterior:e,callee:t,passwordInterior:this.pwd,cmd:"audioBroadcast",cmdExtra:""})}hangup(e,t){return this.unionRtc.hangup(e,t)}async pttcontrol(e,t,r,i=1){null!=this.unionRtc.getSessionByCallee(t)?(await this.httpApi.pttCtlTalkApi({roomid:t,usernumberInterior:this.acc,passwordInterior:this.pwd,type:r,level:i,videoPtt:!1}),this.delegate&&this.delegate.onPttControlEvent&&this.delegate.onPttControlEvent(e,t,r,"1")):this.logger.log("Session does not exist.")}answer(e,t,r,i,n){return this.unionRtc.answer(e,t,r,i,n)}decline(e,t){return this.unionRtc.decline(e,t)}muteMic(e){return this.unionRtc.mute(e)}unMuteMic(e){return this.unionRtc.unmute(e)}stopLocalStream(e){return this.unionRtc.stopLocalStream(e)}muteRemoteAudio(e){return this.unionRtc.muteRemoteAudio(e,!0)}unMuteRemoteAudio(e){return this.unionRtc.muteRemoteAudio(e,!1)}async loadUsers(){const e=await this.httpApi.loadDepartmentApi({usernumberInterior:this.acc,passwordInterior:this.pwd});return this.delegate&&this.delegate.onUserListEvent&&this.delegate.onUserListEvent(this.acc,JSON.stringify(e)),e}async loadLiveCalls(){const e=await this.httpApi.loadLiveCallsApi({usernumberInterior:this.acc,passwordInterior:this.pwd});return this.delegate&&this.delegate.onLiveCallsEvent&&this.delegate.onLiveCallsEvent(this.acc,JSON.stringify(e)),e}async loadUserStatus(){const e=await this.httpApi.loadUserStatusApi({usernumberInterior:this.acc,passwordInterior:this.pwd});return this.delegate&&this.delegate.onUserStatusEvent&&this.delegate.onUserStatusEvent(this.acc,JSON.stringify(e)),e}async makeForceinsert(e,t){return await this.httpApi.foreceInsertApi({extension:e,calleeUuid:t})}async makeTeardown(e,t){return await this.httpApi.foreceTeardownApi({extension:e,calleeUuid:t})}async makeAudioMonitorChannel(e,t){return await this.httpApi.audioMonitorApi({extension:e,calleeUuid:t})}async makeVideoMonitorChannel(e,t,r){return await this.httpApi.videoMonitorApi({extensions:e,calleeUuid:t,dispatcher:r})}async makeVideoDispatch(e,t){return await this.httpApi.videoDispatchApi({callee:e,caller:t})}async makeHangupChannel(e){const t={uuid:e};return await this.httpApi.hangupChannelApi(t)}async loadClapTransPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getClapTransPageListApi(e)}async makeSetClapTransReadStatus(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.setClapTransReadStatusApi(e)}async makeSetClapTransMarker(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.setClapTransMarkerApi(e)}async makeDeleteClapTrans(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.deleteClapTransApi(e)}async makeExportClapTransList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.exportClapTransUrlApi(e)}async loadGisByUserNumbers(e){return await this.httpApi.getGisByUserNumbers(e)}async loadBaiduMapReverseGeocoding(e){return await this.httpApi.getBaiduMapReverseGeocoding(e)}async loadGPSTrackByNumber(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getGPSTrackByNumber(e)}async makePttInvite(e){return await this.httpApi.pttInvitedApi(e)}async makePttKick(e){return await this.httpApi.pttKickApi(e)}async makeCrateGroup(e){return await this.httpApi.createGroupApi(e)}async makeUpdateGroup(e){return await this.httpApi.updateGroupApi(e)}async makeDeleteGroup(e){return await this.httpApi.deleteGroupApi(e)}async makeUploadFile(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.uploadApi(e)}async loadFileListByGroupTag(e){return await this.httpApi.getFileListByGroupTagApi(e)}makeDownloadFileUrl(e){return this.httpApi.downloadFileUrl(e)}async loadMsgPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getMsgPageListApi(e)}async makeDeleteMsg(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.deleteMsgApi(e)}async loadCreateGisFenceList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getGisFenceListApi(e)}async makeCreateGisFence(e){var t;return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,e.usrNumber=null!==(t=e.usrNumber)&&void 0!==t?t:this.acc,await this.httpApi.createGisFenceApi(e)}async makeUpdateGisFence(e){var t;return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,e.usrNumber=null!==(t=e.usrNumber)&&void 0!==t?t:this.acc,await this.httpApi.updateGisFenceApi(e)}async makeDeleteGisFence(e){var t;return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,e.usrNumber=null!==(t=e.usrNumber)&&void 0!==t?t:this.acc,await this.httpApi.deleteGisFenceApi(e)}async loadGisFenceMemberList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getGisFenceMemberListApi(e)}async makeAddGisFenceMember(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.addGisFenceMemberApi(e)}async makeDeleteGisFenceMember(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.deleteGisFenceMemberApi(e)}async loadGisFenceWarningList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getGisFenceWarningListApi(e)}async loadGisFenceHistoryInoutPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getGisFenceHistoryInoutPageListApi(e)}async makeStartBroadcastAudio(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.startBroadcastAudioApi(e)}async makeStartAndPlayBroadcastAudio(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.startAndPlayBroadcastAudioApi(e)}async makeStartPlayBroadcastAudioFile(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.startPlayBroadcastAudioFileApi(e)}async makecreateBroadcastAudioFile(e){return await this.httpApi.createBroadcastAudioFileApi(e)}async loadBroadcastAudioFileList(){let e={usernumberInterior:this.acc,passwordInterior:this.pwd};return await this.httpApi.getBroadcastAudioFileListApi(e)}async makeInviteBroadcastAudioMember(e){return await this.httpApi.inviteMemberBroadcastAudioApi(e)}async makePlayBroadcastAudioFile(e){return await this.httpApi.playBroadcastAudioFileApi(e)}async makeMuteAllBroadcastAudio(e){return await this.httpApi.muteAllBroadcastAudioApi(e)}async makeMuteMemberBroadcastAudio(e){return await this.httpApi.muteMemberBroadcastAudioApi(e)}async makeKickMemberBroadcastAudio(e){return await this.httpApi.kickMemberBroadcastAudioApi(e)}async makeSetVolumeBroadcastAudio(e){return await this.httpApi.setVolumeBroadcastAudioApi(e)}async makeEndBroadcastAudio(e){return await this.httpApi.endBroadcastAudioApi(e)}async loadBroadcastAudioMemberStatusList(e){return await this.httpApi.getBroadcastAudioMemberStatusListApi(e)}async loadAudioConferenceMemberStatusList(e){return await this.httpApi.getAudioConferenceMemberStatusListApi(e)}async makeStartAudioConference(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.startAudioConferenceApi(e)}async makeInviteMemberAudioConference(e){return await this.httpApi.inviteMemberAudioConferenceApi(e)}async makeKickMemberAudioConference(e){return await this.httpApi.kickMemberAudioConferenceApi(e)}async makeEndAudioConference(e){return await this.httpApi.endAudioConferenceApi(e)}async makeMuteAllAudioConference(e){return await this.httpApi.muteAllAudioConferenceApi(e)}async makeMuteMemberAudioConference(e){return await this.httpApi.muteMemberAudioConferenceApi(e)}async loadVideoConferenceMemberStatusList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getVideoConferenceMemberStatusListApi(e)}async makeInviteMemberVideoConference(e){return await this.httpApi.inviteMemberVideoConferenceApi(e)}async makeMuteMemberVideoConference(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.muteMemberVideoConferenceApi(e)}async makeMuteAllVideoConferenceApi(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.muteAllVideoConferenceApi(e)}async makeKickMemberVideoConference(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.kickMemberVideoConferenceApi(e)}async makeSetLayoutVideoConference(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.setLayoutVideoConferenceApi(e)}async makeSetPositionVideoConference(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.setPositionVideoConferenceApi(e)}async makeEndVideoConference(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.endVideoConferenceApi(e)}async loadActiveVideoConferenceList(){return await this.httpApi.getVideoConferenceListApi()}async makeCreateVideoConference(e){return await this.httpApi.createVideoConferenceApi(e)}async loadVideoBroadcastMemberStatusList(e){return await this.httpApi.getVideoBroadcastMemberStatusListApi(e)}async makeStartVideoBroadcast(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.startVideoBroadcastApi(e)}async makeInviteMemberVideoBroadcast(e){return await this.httpApi.inviteMemberVideoBroadcastApi(e)}async makemuteMemberVideoBroadcast(e){return await this.httpApi.muteMemberVideoBroadcastApi(e)}async makeMuteAllVideoBroadcast(e){return await this.httpApi.muteAllVideoBroadcastApi(e)}async makeKickMemberVideoBroadcast(e){return await this.httpApi.kickMemberVideoBroadcastApi(e)}async makeChangeFloorVideoBroadcast(e){return await this.httpApi.changeFloorVideoBroadcastApi(e)}async makeEndVideoBroadcast(e){return await this.httpApi.endVideoBroadcastApi(e)}async loadCdrPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getCdrPageListApi(e)}makeViewCdrFileUrl(e){return this.httpApi.viewCdrFileUrl(e)}makeDownloadCdrFileUrl(e){return this.httpApi.downloadCdrFileUrl(e)}async loadMemberPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getMemberPageListApi(e)}async makeCreateTask(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.createTaskApi(e)}async makeUpdateTask(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.updateTaskApi(e)}async makeDeleteTask(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.deleteTaskApi(e)}async loadTaskPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getTaskPageListApi(e)}async loadTask(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getTaskApi(e)}async makeCreateTaskComment(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.createTaskCommentApi(e)}async makeUpdateTaskComment(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.updateTaskCommentApi(e)}async makeDeleteTaskComment(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.deleteTaskCommentApi(e)}async loadSosPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getSosPageListApi(e)}async makeExportSosList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.exportSosListApi(e)}async loadLoginhistoryPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getLoginhistoryPageListApi(e)}async makeExportLoginhistoryList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.exportLoginhistoryListApi(e)}async loadLoginhistoryStaticPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getLoginhistoryStaticPageListApi(e)}async makeExportLoginhistoryStaticList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.exportLoginhistoryStaticListApi(e)}async loadPttPageList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.getPttPageListApi(e)}async makeExportPttList(e){return e.usernumberInterior=this.acc,e.passwordInterior=this.pwd,await this.httpApi.exportPttListApi(e)}async loadMqttGasPageList(e){return await this.httpApi.getMqttGasPageListApi(e)}async loadMqttInfo(e){return await this.httpApi.getMqttInfoApi(e)}async makeUpdateNvrChannelApi(e){return await this.httpApi.updateNvrChannelApi(e)}makeMqttSubscribe(e,t){this.mqttClient.subscribe(e),this.mqttClient.setMessageCallback(e,t)}makeMqttUnsubscribe(e){this.mqttClient.unsubscribe(e)}subscribeToStatusTopic(e){const t="/as/mqtt/status/"+e;this.mqttClient.subscribe(t);this.mqttClient.setMessageCallback(t,(e,t)=>{var r;if(null===(r=this.delegate)||void 0===r?void 0:r.onMemberStatusNotifier){const e=JSON.parse(t);this.delegate.onMemberStatusNotifier(e.iotId,e.status,e.time,e.type,e.callerNumber,e.calledNumber,e.channelUuid,0,e.channelDirection)}})}async loadGbRecordList(e){return await this.httpApi.getGbRecordListApi(e)}async StartPlaybackGb(e){return await this.httpApi.playbackGbStartApi(e)}async StopPlayback(e){return await this.httpApi.playbackStopApi(e)}async makeCreateTTS(e){return await this.httpApi.createTTSApi(e)}async makeCloseStreams(e){return await this.httpApi.closeStreamsApi(e)}}const jl="0.17.1",Ll="sip.js"}])}));
|