@reactoo/watchtogether-sdk-js 2.7.19 → 2.7.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @reactoo/watchtogether-sdk-js
|
|
3
|
-
* @version 2.7.
|
|
3
|
+
* @version 2.7.21
|
|
4
4
|
*/
|
|
5
|
-
!function webpackUniversalModuleDefinition(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("WatchTogetherSDK",[],r):"object"==typeof exports?exports.WatchTogetherSDK=r():t.WatchTogetherSDK=r()}("undefined"!=typeof self?self:this,(function(){return function(t){var r={};function __webpack_require__(i){if(r[i])return r[i].exports;var o=r[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,__webpack_require__),o.l=!0,o.exports}return __webpack_require__.m=t,__webpack_require__.c=r,__webpack_require__.d=function(t,r,i){__webpack_require__.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:i})},__webpack_require__.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.t=function(t,r){if(1&r&&(t=__webpack_require__(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(__webpack_require__.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)__webpack_require__.d(i,o,function(r){return t[r]}.bind(null,o));return i},__webpack_require__.n=function(t){var r=t&&t.__esModule?function getDefault(){return t.default}:function getModuleExports(){return t};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=830)}([function(t,r,i){t.exports=i(590)},function(t,r,i){"use strict";var o=i(11),a=i(99),c=i(122),u=i(12),l=i(77).f,d=i(224),p=i(15),h=i(63),m=i(47),g=i(21);i(126);var wrapConstructor=function(t){var Wrapper=function(r,i,o){if(this instanceof Wrapper){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,o)}return a(t,this,arguments)};return Wrapper.prototype=t.prototype,Wrapper};t.exports=function(t,r){var i,a,y,v,b,_,w,S,I,k=t.target,x=t.global,P=t.stat,C=t.proto,A=x?o:P?o[k]:o[k]&&o[k].prototype,O=x?p:p[k]||m(p,k,{})[k],R=O.prototype;for(v in r)a=!(i=d(x?v:k+(P?".":"#")+v,t.forced))&&A&&g(A,v),_=O[v],a&&(w=t.dontCallGetSet?(I=l(A,v))&&I.value:A[v]),b=a&&w?w:r[v],(i||C||typeof _!=typeof b)&&(S=t.bind&&a?h(b,o):t.wrap&&a?wrapConstructor(b):C&&u(b)?c(b):b,(t.sham||b&&b.sham||_&&_.sham)&&m(S,"sham",!0),m(O,v,S),C&&(g(p,y=k+"Prototype")||m(p,y,{}),m(p[y],v,b),t.real&&R&&(i||!R[v])&&m(R,v,b)))}},function(t,r,i){t.exports=i(220)},function(t,r,i){"use strict";t.exports=TypeError},function(t,r,i){var o=i(359),a=i(227),c=i(378),u=i(384),l=i(173),d=i(238),p=i(404),h=i(410),m=i(133),g=i(216);function ownKeys(t,r){var i=o(t);if(a){var d=a(t);r&&(d=c(d).call(d,(function(r){return u(t,r).enumerable}))),l(i).apply(i,d)}return i}t.exports=function _objectSpread2(t){for(var r=1;r<arguments.length;r++){var i,o,a=null!=arguments[r]?arguments[r]:{};r%2?d(i=ownKeys(Object(a),!0)).call(i,(function(r){g(t,r,a[r])})):p?h(t,p(a)):d(o=ownKeys(Object(a))).call(o,(function(r){m(t,r,u(a,r))}))}return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){t.exports=i(586)},function(t,r,i){"use strict";var o=i(484),a=i(485),c=i(177),u=i(486),l=i(41),d=i(3),p=i(487),h=Function,getEvalledConstructor=function(t){try{return h('"use strict"; return ('+t+").constructor;")()}catch(t){}},m=Object.getOwnPropertyDescriptor;if(m)try{m({},"")}catch(t){m=null}var throwTypeError=function(){throw new d},g=m?function(){try{return throwTypeError}catch(t){try{return m(arguments,"callee").get}catch(t){return throwTypeError}}}():throwTypeError,y=i(253)(),v=i(137)(),b=Object.getPrototypeOf||(v?function(t){return t.__proto__}:null),_={},w="undefined"!=typeof Uint8Array&&b?b(Uint8Array):void 0,S={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":y&&b?b([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":_,"%AsyncGenerator%":_,"%AsyncGeneratorFunction%":_,"%AsyncIteratorPrototype%":_,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?void 0:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?void 0:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":a,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":h,"%GeneratorFunction%":_,"%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%":y&&b?b(b([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&y&&b?b((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%":c,"%ReferenceError%":u,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&y&&b?b((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":y&&b?b(""[Symbol.iterator]()):void 0,"%Symbol%":y?Symbol:void 0,"%SyntaxError%":l,"%ThrowTypeError%":g,"%TypedArray%":w,"%TypeError%":d,"%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%":p,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet};if(b)try{null.error}catch(t){var I=b(b(t));S["%Error.prototype%"]=I}var k={__proto__:null,"%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"]},x=i(179),P=i(69),C=x.call(Function.call,Array.prototype.concat),A=x.call(Function.apply,Array.prototype.splice),O=x.call(Function.call,String.prototype.replace),R=x.call(Function.call,String.prototype.slice),M=x.call(Function.call,RegExp.prototype.exec),j=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,L=/\\(\\)?/g,D=function stringToPath(t){var r=R(t,0,1),i=R(t,-1);if("%"===r&&"%"!==i)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==r)throw new l("invalid intrinsic syntax, expected opening `%`");var o=[];return O(t,j,(function(t,r,i,a){o[o.length]=i?O(a,L,"$1"):r||t})),o},B=function getBaseIntrinsic(t,r){var i,o=t;if(P(k,o)&&(o="%"+(i=k[o])[0]+"%"),P(S,o)){var a=S[o];if(a===_&&(a=function doEval(t){var r;if("%AsyncFunction%"===t)r=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===t)r=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===t){var i=doEval("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=doEval("%AsyncGenerator%");o&&b&&(r=b(o.prototype))}return S[t]=r,r}(o)),void 0===a&&!r)throw new d("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:o,value:a}}throw new l("intrinsic "+t+" does not exist!")};t.exports=function GetIntrinsic(t,r){if("string"!=typeof t||0===t.length)throw new d("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof r)throw new d('"allowMissing" argument must be a boolean');if(null===M(/^%?[^%]*%?$/,t))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=D(t),o=i.length>0?i[0]:"",a=B("%"+o+"%",r),c=a.name,u=a.value,p=!1,h=a.alias;h&&(o=h[0],A(i,C([0,1],h)));for(var g=1,y=!0;g<i.length;g+=1){var v=i[g],b=R(v,0,1),_=R(v,-1);if(('"'===b||"'"===b||"`"===b||'"'===_||"'"===_||"`"===_)&&b!==_)throw new l("property names with quotes must have matching quotes");if("constructor"!==v&&y||(p=!0),P(S,c="%"+(o+="."+v)+"%"))u=S[c];else if(null!=u){if(!(v in u)){if(!r)throw new d("base intrinsic for "+t+" exists, but the property is not available.");return}if(m&&g+1>=i.length){var w=m(u,v);u=(y=!!w)&&"get"in w&&!("originalValue"in w.get)?w.get:u[v]}else y=P(u,v),u=u[v];y&&!p&&(S[c]=u)}}return u}},function(t,r,i){var o=i(106),a=i(459);function _typeof(r){return t.exports=_typeof="function"==typeof o&&"symbol"==typeof a?function(t){return typeof t}:function(t){return t&&"function"==typeof o&&t.constructor===o&&t!==o.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,_typeof(r)}t.exports=_typeof,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,r,i){"use strict";var o=i(121),a=Function.prototype,c=a.call,u=o&&a.bind.bind(c,c);t.exports=o?u:function(t){return function(){return c.apply(t,arguments)}}},function(t,r,i){"use strict";var o=i(11),a=i(81),c=i(21),u=i(127),l=i(79),d=i(222),p=o.Symbol,h=a("wks"),m=d?p.for||p:p&&p.withoutSetter||u;t.exports=function(t){return c(h,t)||(h[t]=l&&c(p,t)?p[t]:m("Symbol."+t)),h[t]}},function(t,r,i){"use strict";(function(r){var check=function(t){return t&&t.Math===Math&&t};t.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof r&&r)||check("object"==typeof this&&this)||function(){return this}()||Function("return this")()}).call(this,i(17))},function(t,r,i){"use strict";var o="object"==typeof document&&document.all;t.exports=void 0===o&&void 0!==o?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},function(t,r,i){"use strict";var o=i(8);t.exports=!o((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,r,i){"use strict";var o=i(15),a=i(21),c=i(131),u=i(32).f;t.exports=function(t){var r=o.Symbol||(o.Symbol={});a(r,t)||u(r,t,{value:c.f(t)})}},function(t,r,i){"use strict";t.exports={}},function(t,r,i){"use strict";(function(t){var o=i(356),a=i(357),c=i(358);function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,r){if(kMaxLength()<r)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=Buffer.prototype:(null===t&&(t=new Buffer(r)),t.length=r),t}function Buffer(t,r,i){if(!(Buffer.TYPED_ARRAY_SUPPORT||this instanceof Buffer))return new Buffer(t,r,i);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,t)}return from(this,t,r,i)}function from(t,r,i,o){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function fromArrayBuffer(t,r,i,o){if(r.byteLength,i<0||r.byteLength<i)throw new RangeError("'offset' is out of bounds");if(r.byteLength<i+(o||0))throw new RangeError("'length' is out of bounds");r=void 0===i&&void 0===o?new Uint8Array(r):void 0===o?new Uint8Array(r,i):new Uint8Array(r,i,o);Buffer.TYPED_ARRAY_SUPPORT?(t=r).__proto__=Buffer.prototype:t=fromArrayLike(t,r);return t}(t,r,i,o):"string"==typeof r?function fromString(t,r,i){"string"==typeof i&&""!==i||(i="utf8");if(!Buffer.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var o=0|byteLength(r,i),a=(t=createBuffer(t,o)).write(r,i);a!==o&&(t=t.slice(0,a));return t}(t,r,i):function fromObject(t,r){if(Buffer.isBuffer(r)){var i=0|checked(r.length);return 0===(t=createBuffer(t,i)).length||r.copy(t,0,0,i),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||function isnan(t){return t!=t}(r.length)?createBuffer(t,0):fromArrayLike(t,r);if("Buffer"===r.type&&c(r.data))return fromArrayLike(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function assertSize(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function allocUnsafe(t,r){if(assertSize(r),t=createBuffer(t,r<0?0:0|checked(r)),!Buffer.TYPED_ARRAY_SUPPORT)for(var i=0;i<r;++i)t[i]=0;return t}function fromArrayLike(t,r){var i=r.length<0?0:0|checked(r.length);t=createBuffer(t,i);for(var o=0;o<i;o+=1)t[o]=255&r[o];return t}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function byteLength(t,r){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return base64ToBytes(t).length;default:if(o)return utf8ToBytes(t).length;r=(""+r).toLowerCase(),o=!0}}function slowToString(t,r,i){var o=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,r,i);case"utf8":case"utf-8":return utf8Slice(this,r,i);case"ascii":return asciiSlice(this,r,i);case"latin1":case"binary":return latin1Slice(this,r,i);case"base64":return base64Slice(this,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,r,i);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}function swap(t,r,i){var o=t[r];t[r]=t[i],t[i]=o}function bidirectionalIndexOf(t,r,i,o,a){if(0===t.length)return-1;if("string"==typeof i?(o=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=a?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(a)return-1;i=t.length-1}else if(i<0){if(!a)return-1;i=0}if("string"==typeof r&&(r=Buffer.from(r,o)),Buffer.isBuffer(r))return 0===r.length?-1:arrayIndexOf(t,r,i,o,a);if("number"==typeof r)return r&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,r,i):Uint8Array.prototype.lastIndexOf.call(t,r,i):arrayIndexOf(t,[r],i,o,a);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,r,i,o,a){var c,u=1,l=t.length,d=r.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(t.length<2||r.length<2)return-1;u=2,l/=2,d/=2,i/=2}function read(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(a){var p=-1;for(c=i;c<l;c++)if(read(t,c)===read(r,-1===p?0:c-p)){if(-1===p&&(p=c),c-p+1===d)return p*u}else-1!==p&&(c-=c-p),p=-1}else for(i+d>l&&(i=l-d),c=i;c>=0;c--){for(var h=!0,m=0;m<d;m++)if(read(t,c+m)!==read(r,m)){h=!1;break}if(h)return c}return-1}function hexWrite(t,r,i,o){i=Number(i)||0;var a=t.length-i;o?(o=Number(o))>a&&(o=a):o=a;var c=r.length;if(c%2!=0)throw new TypeError("Invalid hex string");o>c/2&&(o=c/2);for(var u=0;u<o;++u){var l=parseInt(r.substr(2*u,2),16);if(isNaN(l))return u;t[i+u]=l}return u}function utf8Write(t,r,i,o){return blitBuffer(utf8ToBytes(r,t.length-i),t,i,o)}function asciiWrite(t,r,i,o){return blitBuffer(function asciiToBytes(t){for(var r=[],i=0;i<t.length;++i)r.push(255&t.charCodeAt(i));return r}(r),t,i,o)}function latin1Write(t,r,i,o){return asciiWrite(t,r,i,o)}function base64Write(t,r,i,o){return blitBuffer(base64ToBytes(r),t,i,o)}function ucs2Write(t,r,i,o){return blitBuffer(function utf16leToBytes(t,r){for(var i,o,a,c=[],u=0;u<t.length&&!((r-=2)<0);++u)i=t.charCodeAt(u),o=i>>8,a=i%256,c.push(a),c.push(o);return c}(r,t.length-i),t,i,o)}function base64Slice(t,r,i){return 0===r&&i===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(r,i))}function utf8Slice(t,r,i){i=Math.min(t.length,i);for(var o=[],a=r;a<i;){var c,u,l,d,p=t[a],h=null,m=p>239?4:p>223?3:p>191?2:1;if(a+m<=i)switch(m){case 1:p<128&&(h=p);break;case 2:128==(192&(c=t[a+1]))&&(d=(31&p)<<6|63&c)>127&&(h=d);break;case 3:c=t[a+1],u=t[a+2],128==(192&c)&&128==(192&u)&&(d=(15&p)<<12|(63&c)<<6|63&u)>2047&&(d<55296||d>57343)&&(h=d);break;case 4:c=t[a+1],u=t[a+2],l=t[a+3],128==(192&c)&&128==(192&u)&&128==(192&l)&&(d=(15&p)<<18|(63&c)<<12|(63&u)<<6|63&l)>65535&&d<1114112&&(h=d)}null===h?(h=65533,m=1):h>65535&&(h-=65536,o.push(h>>>10&1023|55296),h=56320|1023&h),o.push(h),a+=m}return function decodeCodePointsArray(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var i="",o=0;for(;o<r;)i+=String.fromCharCode.apply(String,t.slice(o,o+=4096));return i}(o)}r.Buffer=Buffer,r.SlowBuffer=function SlowBuffer(t){+t!=t&&(t=0);return Buffer.alloc(+t)},r.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function typedArraySupport(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,r,i){return from(null,t,r,i)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(t,r,i){return function alloc(t,r,i,o){return assertSize(r),r<=0?createBuffer(t,r):void 0!==i?"string"==typeof o?createBuffer(t,r).fill(i,o):createBuffer(t,r).fill(i):createBuffer(t,r)}(null,t,r,i)},Buffer.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer.isBuffer=function isBuffer(t){return!(null==t||!t._isBuffer)},Buffer.compare=function compare(t,r){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var i=t.length,o=r.length,a=0,c=Math.min(i,o);a<c;++a)if(t[a]!==r[a]){i=t[a],o=r[a];break}return i<o?-1:o<i?1:0},Buffer.isEncoding=function isEncoding(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function concat(t,r){if(!c(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Buffer.alloc(0);var i;if(void 0===r)for(r=0,i=0;i<t.length;++i)r+=t[i].length;var o=Buffer.allocUnsafe(r),a=0;for(i=0;i<t.length;++i){var u=t[i];if(!Buffer.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(o,a),a+=u.length}return o},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)swap(this,r,r+1);return this},Buffer.prototype.swap32=function swap32(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)swap(this,r,r+3),swap(this,r+1,r+2);return this},Buffer.prototype.swap64=function swap64(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)swap(this,r,r+7),swap(this,r+1,r+6),swap(this,r+2,r+5),swap(this,r+3,r+4);return this},Buffer.prototype.toString=function toString(){var t=0|this.length;return 0===t?"":0===arguments.length?utf8Slice(this,0,t):slowToString.apply(this,arguments)},Buffer.prototype.equals=function equals(t){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Buffer.compare(this,t)},Buffer.prototype.inspect=function inspect(){var t="",i=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),"<Buffer "+t+">"},Buffer.prototype.compare=function compare(t,r,i,o,a){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===i&&(i=t?t.length:0),void 0===o&&(o=0),void 0===a&&(a=this.length),r<0||i>t.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&r>=i)return 0;if(o>=a)return-1;if(r>=i)return 1;if(this===t)return 0;for(var c=(a>>>=0)-(o>>>=0),u=(i>>>=0)-(r>>>=0),l=Math.min(c,u),d=this.slice(o,a),p=t.slice(r,i),h=0;h<l;++h)if(d[h]!==p[h]){c=d[h],u=p[h];break}return c<u?-1:u<c?1:0},Buffer.prototype.includes=function includes(t,r,i){return-1!==this.indexOf(t,r,i)},Buffer.prototype.indexOf=function indexOf(t,r,i){return bidirectionalIndexOf(this,t,r,i,!0)},Buffer.prototype.lastIndexOf=function lastIndexOf(t,r,i){return bidirectionalIndexOf(this,t,r,i,!1)},Buffer.prototype.write=function write(t,r,i,o){if(void 0===r)o="utf8",i=this.length,r=0;else if(void 0===i&&"string"==typeof r)o=r,i=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(i)?(i|=0,void 0===o&&(o="utf8")):(o=i,i=void 0)}var a=this.length-r;if((void 0===i||i>a)&&(i=a),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var c=!1;;)switch(o){case"hex":return hexWrite(this,t,r,i);case"utf8":case"utf-8":return utf8Write(this,t,r,i);case"ascii":return asciiWrite(this,t,r,i);case"latin1":case"binary":return latin1Write(this,t,r,i);case"base64":return base64Write(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,r,i);default:if(c)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),c=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function asciiSlice(t,r,i){var o="";i=Math.min(t.length,i);for(var a=r;a<i;++a)o+=String.fromCharCode(127&t[a]);return o}function latin1Slice(t,r,i){var o="";i=Math.min(t.length,i);for(var a=r;a<i;++a)o+=String.fromCharCode(t[a]);return o}function hexSlice(t,r,i){var o=t.length;(!r||r<0)&&(r=0),(!i||i<0||i>o)&&(i=o);for(var a="",c=r;c<i;++c)a+=toHex(t[c]);return a}function utf16leSlice(t,r,i){for(var o=t.slice(r,i),a="",c=0;c<o.length;c+=2)a+=String.fromCharCode(o[c]+256*o[c+1]);return a}function checkOffset(t,r,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>i)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,r,i,o,a,c){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>a||r<c)throw new RangeError('"value" argument is out of bounds');if(i+o>t.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,r,i,o){r<0&&(r=65535+r+1);for(var a=0,c=Math.min(t.length-i,2);a<c;++a)t[i+a]=(r&255<<8*(o?a:1-a))>>>8*(o?a:1-a)}function objectWriteUInt32(t,r,i,o){r<0&&(r=4294967295+r+1);for(var a=0,c=Math.min(t.length-i,4);a<c;++a)t[i+a]=r>>>8*(o?a:3-a)&255}function checkIEEE754(t,r,i,o,a,c){if(i+o>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function writeFloat(t,r,i,o,c){return c||checkIEEE754(t,0,i,4),a.write(t,r,i,o,23,4),i+4}function writeDouble(t,r,i,o,c){return c||checkIEEE754(t,0,i,8),a.write(t,r,i,o,52,8),i+8}Buffer.prototype.slice=function slice(t,r){var i,o=this.length;if((t=~~t)<0?(t+=o)<0&&(t=0):t>o&&(t=o),(r=void 0===r?o:~~r)<0?(r+=o)<0&&(r=0):r>o&&(r=o),r<t&&(r=t),Buffer.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,r)).__proto__=Buffer.prototype;else{var a=r-t;i=new Buffer(a,void 0);for(var c=0;c<a;++c)i[c]=this[c+t]}return i},Buffer.prototype.readUIntLE=function readUIntLE(t,r,i){t|=0,r|=0,i||checkOffset(t,r,this.length);for(var o=this[t],a=1,c=0;++c<r&&(a*=256);)o+=this[t+c]*a;return o},Buffer.prototype.readUIntBE=function readUIntBE(t,r,i){t|=0,r|=0,i||checkOffset(t,r,this.length);for(var o=this[t+--r],a=1;r>0&&(a*=256);)o+=this[t+--r]*a;return o},Buffer.prototype.readUInt8=function readUInt8(t,r){return r||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function readUInt16LE(t,r){return r||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function readUInt16BE(t,r){return r||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function readUInt32LE(t,r){return r||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function readUInt32BE(t,r){return r||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function readIntLE(t,r,i){t|=0,r|=0,i||checkOffset(t,r,this.length);for(var o=this[t],a=1,c=0;++c<r&&(a*=256);)o+=this[t+c]*a;return o>=(a*=128)&&(o-=Math.pow(2,8*r)),o},Buffer.prototype.readIntBE=function readIntBE(t,r,i){t|=0,r|=0,i||checkOffset(t,r,this.length);for(var o=r,a=1,c=this[t+--o];o>0&&(a*=256);)c+=this[t+--o]*a;return c>=(a*=128)&&(c-=Math.pow(2,8*r)),c},Buffer.prototype.readInt8=function readInt8(t,r){return r||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function readInt16LE(t,r){r||checkOffset(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},Buffer.prototype.readInt16BE=function readInt16BE(t,r){r||checkOffset(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},Buffer.prototype.readInt32LE=function readInt32LE(t,r){return r||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(t,r){return r||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function readFloatLE(t,r){return r||checkOffset(t,4,this.length),a.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(t,r){return r||checkOffset(t,4,this.length),a.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(t,r){return r||checkOffset(t,8,this.length),a.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(t,r){return r||checkOffset(t,8,this.length),a.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function writeUIntLE(t,r,i,o){(t=+t,r|=0,i|=0,o)||checkInt(this,t,r,i,Math.pow(2,8*i)-1,0);var a=1,c=0;for(this[r]=255&t;++c<i&&(a*=256);)this[r+c]=t/a&255;return r+i},Buffer.prototype.writeUIntBE=function writeUIntBE(t,r,i,o){(t=+t,r|=0,i|=0,o)||checkInt(this,t,r,i,Math.pow(2,8*i)-1,0);var a=i-1,c=1;for(this[r+a]=255&t;--a>=0&&(c*=256);)this[r+a]=t/c&255;return r+i},Buffer.prototype.writeUInt8=function writeUInt8(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},Buffer.prototype.writeUInt16LE=function writeUInt16LE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):objectWriteUInt16(this,t,r,!0),r+2},Buffer.prototype.writeUInt16BE=function writeUInt16BE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):objectWriteUInt16(this,t,r,!1),r+2},Buffer.prototype.writeUInt32LE=function writeUInt32LE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):objectWriteUInt32(this,t,r,!0),r+4},Buffer.prototype.writeUInt32BE=function writeUInt32BE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):objectWriteUInt32(this,t,r,!1),r+4},Buffer.prototype.writeIntLE=function writeIntLE(t,r,i,o){if(t=+t,r|=0,!o){var a=Math.pow(2,8*i-1);checkInt(this,t,r,i,a-1,-a)}var c=0,u=1,l=0;for(this[r]=255&t;++c<i&&(u*=256);)t<0&&0===l&&0!==this[r+c-1]&&(l=1),this[r+c]=(t/u>>0)-l&255;return r+i},Buffer.prototype.writeIntBE=function writeIntBE(t,r,i,o){if(t=+t,r|=0,!o){var a=Math.pow(2,8*i-1);checkInt(this,t,r,i,a-1,-a)}var c=i-1,u=1,l=0;for(this[r+c]=255&t;--c>=0&&(u*=256);)t<0&&0===l&&0!==this[r+c+1]&&(l=1),this[r+c]=(t/u>>0)-l&255;return r+i},Buffer.prototype.writeInt8=function writeInt8(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},Buffer.prototype.writeInt16LE=function writeInt16LE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):objectWriteUInt16(this,t,r,!0),r+2},Buffer.prototype.writeInt16BE=function writeInt16BE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):objectWriteUInt16(this,t,r,!1),r+2},Buffer.prototype.writeInt32LE=function writeInt32LE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):objectWriteUInt32(this,t,r,!0),r+4},Buffer.prototype.writeInt32BE=function writeInt32BE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):objectWriteUInt32(this,t,r,!1),r+4},Buffer.prototype.writeFloatLE=function writeFloatLE(t,r,i){return writeFloat(this,t,r,!0,i)},Buffer.prototype.writeFloatBE=function writeFloatBE(t,r,i){return writeFloat(this,t,r,!1,i)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(t,r,i){return writeDouble(this,t,r,!0,i)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(t,r,i){return writeDouble(this,t,r,!1,i)},Buffer.prototype.copy=function copy(t,r,i,o){if(i||(i=0),o||0===o||(o=this.length),r>=t.length&&(r=t.length),r||(r=0),o>0&&o<i&&(o=i),o===i)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-r<o-i&&(o=t.length-r+i);var a,c=o-i;if(this===t&&i<r&&r<o)for(a=c-1;a>=0;--a)t[a+r]=this[a+i];else if(c<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(a=0;a<c;++a)t[a+r]=this[a+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+c),r);return c},Buffer.prototype.fill=function fill(t,r,i,o){if("string"==typeof t){if("string"==typeof r?(o=r,r=0,i=this.length):"string"==typeof i&&(o=i,i=this.length),1===t.length){var a=t.charCodeAt(0);a<256&&(t=a)}if(void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!Buffer.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;var c;if(r>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(c=r;c<i;++c)this[c]=t;else{var u=Buffer.isBuffer(t)?t:utf8ToBytes(new Buffer(t,o).toString()),l=u.length;for(c=0;c<i-r;++c)this[c+r]=u[c%l]}return this};var u=/[^+\/0-9A-Za-z-_]/g;function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,r){var i;r=r||1/0;for(var o=t.length,a=null,c=[],u=0;u<o;++u){if((i=t.charCodeAt(u))>55295&&i<57344){if(!a){if(i>56319){(r-=3)>-1&&c.push(239,191,189);continue}if(u+1===o){(r-=3)>-1&&c.push(239,191,189);continue}a=i;continue}if(i<56320){(r-=3)>-1&&c.push(239,191,189),a=i;continue}i=65536+(a-55296<<10|i-56320)}else a&&(r-=3)>-1&&c.push(239,191,189);if(a=null,i<128){if((r-=1)<0)break;c.push(i)}else if(i<2048){if((r-=2)<0)break;c.push(i>>6|192,63&i|128)}else if(i<65536){if((r-=3)<0)break;c.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;c.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return c}function base64ToBytes(t){return o.toByteArray(function base64clean(t){if((t=function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(u,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function blitBuffer(t,r,i,o){for(var a=0;a<o&&!(a+i>=r.length||a>=t.length);++a)r[a+i]=t[a];return a}}).call(this,i(17))},function(t,r){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,r,i){"use strict";var o=i(12);t.exports=function(t){return"object"==typeof t?null!==t:o(t)}},function(t,r){var i,o,a=t.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(t){if(i===setTimeout)return setTimeout(t,0);if((i===defaultSetTimout||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(r){try{return i.call(null,t,0)}catch(r){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(t){i=defaultSetTimout}try{o="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(t){o=defaultClearTimeout}}();var c,u=[],l=!1,d=-1;function cleanUpNextTick(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&drainQueue())}function drainQueue(){if(!l){var t=runTimeout(cleanUpNextTick);l=!0;for(var r=u.length;r;){for(c=u,u=[];++d<r;)c&&c[d].run();d=-1,r=u.length}c=null,l=!1,function runClearTimeout(t){if(o===clearTimeout)return clearTimeout(t);if((o===defaultClearTimeout||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{return o(t)}catch(r){try{return o.call(null,t)}catch(r){return o.call(this,t)}}}(t)}}function Item(t,r){this.fun=t,this.array=r}function noop(){}a.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)r[i-1]=arguments[i];u.push(new Item(t,r)),1!==u.length||l||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=noop,a.addListener=noop,a.once=noop,a.off=noop,a.removeListener=noop,a.removeAllListeners=noop,a.emit=noop,a.prependListener=noop,a.prependOnceListener=noop,a.listeners=function(t){return[]},a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(t,r,i){"use strict";var o=i(121),a=Function.prototype.call;t.exports=o?a.bind(a):function(){return a.apply(a,arguments)}},function(t,r,i){"use strict";var o=i(9),a=i(36),c=o({}.hasOwnProperty);t.exports=Object.hasOwn||function hasOwn(t,r){return c(a(t),r)}},function(t,r,i){t.exports=i(472)},function(t,r,i){"use strict";var o=i(9);t.exports=o({}.isPrototypeOf)},function(t,r,i){"use strict";var o=i(6),a=i(59),c=a(o("String.prototype.indexOf"));t.exports=function callBoundIntrinsic(t,r){var i=o(t,!!r);return"function"==typeof i&&c(t,".prototype.")>-1?a(i):i}},function(t,r,i){t.exports=i(258)},function(t,r,i){t.exports=i(236)},function(t,r,i){var o=i(512),a=i(513),c=i(184),u=i(514);t.exports=function _slicedToArray(t,r){return o(t)||a(t,r)||c(t,r)||u()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(15),a=i(11),c=i(12),aFunction=function(t){return c(t)?t:void 0};t.exports=function(t,r){return arguments.length<2?aFunction(o[t])||aFunction(a[t]):o[t]&&o[t][r]||a[t]&&a[t][r]}},function(t,r,i){"use strict";var o=i(11),a=i(15);t.exports=function(t,r){var i=a[t+"Prototype"],c=i&&i[r];if(c)return c;var u=o[t],l=u&&u.prototype;return l&&l[r]}},function(t,r){"function"==typeof Object.create?t.exports=function inherits(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function inherits(t,r){if(r){t.super_=r;var TempCtor=function(){};TempCtor.prototype=r.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}}},function(t,r,i){var o=i(545)();t.exports=o;try{regeneratorRuntime=o}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},function(t,r,i){"use strict";var o=i(13),a=i(223),c=i(225),u=i(33),l=i(162),d=TypeError,p=Object.defineProperty,h=Object.getOwnPropertyDescriptor;r.f=o?c?function defineProperty(t,r,i){if(u(t),r=l(r),u(i),"function"==typeof t&&"prototype"===r&&"value"in i&&"writable"in i&&!i.writable){var o=h(t,r);o&&o.writable&&(t[r]=i.value,i={configurable:"configurable"in i?i.configurable:o.configurable,enumerable:"enumerable"in i?i.enumerable:o.enumerable,writable:!1})}return p(t,r,i)}:p:function defineProperty(t,r,i){if(u(t),r=l(r),u(i),a)try{return p(t,r,i)}catch(t){}if("get"in i||"set"in i)throw new d("Accessors not supported");return"value"in i&&(t[r]=i.value),t}},function(t,r,i){"use strict";var o=i(18),a=String,c=TypeError;t.exports=function(t){if(o(t))return t;throw new c(a(t)+" is not an object")}},function(t,r,i){"use strict";var o=i(481);function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var a=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),d=["'"].concat(l),p=["%","/","?",";","#"].concat(d),h=["/","?","#"],m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=i(120);function urlParse(t,r,i){if(t&&"object"==typeof t&&t instanceof Url)return t;var o=new Url;return o.parse(t,r,i),o}Url.prototype.parse=function(t,r,i){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var c=t.indexOf("?"),l=-1!==c&&c<t.indexOf("#")?"?":"#",w=t.split(l);w[0]=w[0].replace(/\\/g,"/");var S=t=w.join(l);if(S=S.trim(),!i&&1===t.split("#").length){var I=u.exec(S);if(I)return this.path=S,this.href=S,this.pathname=I[1],I[2]?(this.search=I[2],this.query=r?_.parse(this.search.substr(1)):this.search.substr(1)):r&&(this.search="",this.query={}),this}var k=a.exec(S);if(k){var x=(k=k[0]).toLowerCase();this.protocol=x,S=S.substr(k.length)}if(i||k||S.match(/^\/\/[^@/]+@[^@/]+/)){var P="//"===S.substr(0,2);!P||k&&v[k]||(S=S.substr(2),this.slashes=!0)}if(!v[k]&&(P||k&&!b[k])){for(var C,A,O=-1,R=0;R<h.length;R++){-1!==(M=S.indexOf(h[R]))&&(-1===O||M<O)&&(O=M)}-1!==(A=-1===O?S.lastIndexOf("@"):S.lastIndexOf("@",O))&&(C=S.slice(0,A),S=S.slice(A+1),this.auth=decodeURIComponent(C)),O=-1;for(R=0;R<p.length;R++){var M;-1!==(M=S.indexOf(p[R]))&&(-1===O||M<O)&&(O=M)}-1===O&&(O=S.length),this.host=S.slice(0,O),S=S.slice(O),this.parseHost(),this.hostname=this.hostname||"";var j="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!j)for(var L=this.hostname.split(/\./),D=(R=0,L.length);R<D;R++){var B=L[R];if(B&&!B.match(m)){for(var N="",U=0,q=B.length;U<q;U++)B.charCodeAt(U)>127?N+="x":N+=B[U];if(!N.match(m)){var W=L.slice(0,R),z=L.slice(R+1),V=B.match(g);V&&(W.push(V[1]),z.unshift(V[2])),z.length&&(S="/"+z.join(".")+S),this.hostname=W.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=o.toASCII(this.hostname));var H=this.port?":"+this.port:"",$=this.hostname||"";this.host=$+H,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==S[0]&&(S="/"+S))}if(!y[x])for(R=0,D=d.length;R<D;R++){var K=d[R];if(-1!==S.indexOf(K)){var G=encodeURIComponent(K);G===K&&(G=escape(K)),S=S.split(K).join(G)}}var J=S.indexOf("#");-1!==J&&(this.hash=S.substr(J),S=S.slice(0,J));var Y=S.indexOf("?");if(-1!==Y?(this.search=S.substr(Y),this.query=S.substr(Y+1),r&&(this.query=_.parse(this.query)),S=S.slice(0,Y)):r&&(this.search="",this.query={}),S&&(this.pathname=S),b[x]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){H=this.pathname||"";var Q=this.search||"";this.path=H+Q}return this.href=this.format(),this},Url.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var r=this.protocol||"",i=this.pathname||"",o=this.hash||"",a=!1,c="";this.host?a=t+this.host:this.hostname&&(a=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(a+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(c=_.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var u=this.search||c&&"?"+c||"";return r&&":"!==r.substr(-1)&&(r+=":"),this.slashes||(!r||b[r])&&!1!==a?(a="//"+(a||""),i&&"/"!==i.charAt(0)&&(i="/"+i)):a||(a=""),o&&"#"!==o.charAt(0)&&(o="#"+o),u&&"?"!==u.charAt(0)&&(u="?"+u),r+a+(i=i.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(u=u.replace("#","%23"))+o},Url.prototype.resolve=function(t){return this.resolveObject(urlParse(t,!1,!0)).format()},Url.prototype.resolveObject=function(t){if("string"==typeof t){var r=new Url;r.parse(t,!1,!0),t=r}for(var i=new Url,o=Object.keys(this),a=0;a<o.length;a++){var c=o[a];i[c]=this[c]}if(i.hash=t.hash,""===t.href)return i.href=i.format(),i;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),l=0;l<u.length;l++){var d=u[l];"protocol"!==d&&(i[d]=t[d])}return b[i.protocol]&&i.hostname&&!i.pathname&&(i.pathname="/",i.path=i.pathname),i.href=i.format(),i}if(t.protocol&&t.protocol!==i.protocol){if(!b[t.protocol]){for(var p=Object.keys(t),h=0;h<p.length;h++){var m=p[h];i[m]=t[m]}return i.href=i.format(),i}if(i.protocol=t.protocol,t.host||v[t.protocol])i.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==g[0]&&g.unshift(""),g.length<2&&g.unshift(""),i.pathname=g.join("/")}if(i.search=t.search,i.query=t.query,i.host=t.host||"",i.auth=t.auth,i.hostname=t.hostname||t.host,i.port=t.port,i.pathname||i.search){var y=i.pathname||"",_=i.search||"";i.path=y+_}return i.slashes=i.slashes||t.slashes,i.href=i.format(),i}var w=i.pathname&&"/"===i.pathname.charAt(0),S=t.host||t.pathname&&"/"===t.pathname.charAt(0),I=S||w||i.host&&t.pathname,k=I,x=i.pathname&&i.pathname.split("/")||[],P=(g=t.pathname&&t.pathname.split("/")||[],i.protocol&&!b[i.protocol]);if(P&&(i.hostname="",i.port=null,i.host&&(""===x[0]?x[0]=i.host:x.unshift(i.host)),i.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===g[0]?g[0]=t.host:g.unshift(t.host)),t.host=null),I=I&&(""===g[0]||""===x[0])),S)i.host=t.host||""===t.host?t.host:i.host,i.hostname=t.hostname||""===t.hostname?t.hostname:i.hostname,i.search=t.search,i.query=t.query,x=g;else if(g.length)x||(x=[]),x.pop(),x=x.concat(g),i.search=t.search,i.query=t.query;else if(null!=t.search){if(P)i.host=x.shift(),i.hostname=i.host,(M=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=M.shift(),i.hostname=M.shift(),i.host=i.hostname);return i.search=t.search,i.query=t.query,null===i.pathname&&null===i.search||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!x.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var C=x.slice(-1)[0],A=(i.host||t.host||x.length>1)&&("."===C||".."===C)||""===C,O=0,R=x.length;R>=0;R--)"."===(C=x[R])?x.splice(R,1):".."===C?(x.splice(R,1),O++):O&&(x.splice(R,1),O--);if(!I&&!k)for(;O--;O)x.unshift("..");!I||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),A&&"/"!==x.join("/").substr(-1)&&x.push("");var M,j=""===x[0]||x[0]&&"/"===x[0].charAt(0);P&&(i.hostname=j?"":x.length?x.shift():"",i.host=i.hostname,(M=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=M.shift(),i.hostname=M.shift(),i.host=i.hostname));return(I=I||i.host&&x.length)&&!j&&x.unshift(""),x.length>0?i.pathname=x.join("/"):(i.pathname=null,i.path=null),null===i.pathname&&null===i.search||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=t.auth||i.auth,i.slashes=i.slashes||t.slashes,i.href=i.format(),i},Url.prototype.parseHost=function(){var t=this.host,r=c.exec(t);r&&(":"!==(r=r[0])&&(this.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(this.hostname=t)},r.parse=urlParse,r.resolve=function urlResolve(t,r){return urlParse(t,!1,!0).resolve(r)},r.resolveObject=function urlResolveObject(t,r){return t?urlParse(t,!1,!0).resolveObject(r):r},r.format=function urlFormat(t){return"string"==typeof t&&(t=urlParse(t)),t instanceof Url?t.format():Url.prototype.format.call(t)},r.Url=Url},function(t,r,i){"use strict";t.exports=!0},function(t,r,i){"use strict";var o=i(56),a=Object;t.exports=function(t){return a(o(t))}},function(t,r,i){"use strict";r.a=function(){let t=new Map;return{emit(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];let c=t.get(r);c&&c.length&&c.forEach(t=>{t.callback.call(t.vm,...o),t.once&&this.off(r,t.callback,t.vm)})},on(r,i,o){t.has(r)||t.set(r,[]),t.get(r).push({callback:i,vm:o||this})},off(r,i,o){let a=t.get(r);if(a&&a.length){let c=a.findIndex(t=>"function"==typeof t.callback&&t.callback===i&&t.vm===(o||this));c>-1&&(a.splice(c,1),t.set(r,a))}},once(r,i,o){t.has(r)||t.set(r,[]),t.get(r).push({callback:i,vm:o||this,once:!0})},clear(){t.clear()}}}},function(t,r,i){"use strict";var o=i(161),a=i(56);t.exports=function(t){return o(a(t))}},function(t,r,i){"use strict";var o=i(12),a=i(80),c=TypeError;t.exports=function(t){if(o(t))return t;throw new c(a(t)+" is not a function")}},function(t,r,i){"use strict";var o=i(64),a=String;t.exports=function(t){if("Symbol"===o(t))throw new TypeError("Cannot convert a Symbol value to a string");return a(t)}},function(t,r,i){"use strict";t.exports=SyntaxError},function(t,r,i){var o=i(597),a=i(598),c=i(184),u=i(599);t.exports=function _toConsumableArray(t){return o(t)||a(t)||c(t)||u()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(9),a=o({}.toString),c=o("".slice);t.exports=function(t){return c(a(t),8,-1)}},function(t,r,i){var o=i(282),a="object"==typeof self&&self&&self.Object===Object&&self,c=o||a||Function("return this")();t.exports=c},function(t,r,i){"use strict";var o,a="object"==typeof Reflect?Reflect:null,c=a&&"function"==typeof a.apply?a.apply:function ReflectApply(t,r,i){return Function.prototype.apply.call(t,r,i)};o=a&&"function"==typeof a.ownKeys?a.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function ReflectOwnKeys(t){return Object.getOwnPropertyNames(t)};var u=Number.isNaN||function NumberIsNaN(t){return t!=t};function EventEmitter(){EventEmitter.init.call(this)}t.exports=EventEmitter,t.exports.once=function once(t,r){return new Promise((function(i,o){function errorListener(i){t.removeListener(r,resolver),o(i)}function resolver(){"function"==typeof t.removeListener&&t.removeListener("error",errorListener),i([].slice.call(arguments))}eventTargetAgnosticAddListener(t,r,resolver,{once:!0}),"error"!==r&&function addErrorHandlerIfEventEmitter(t,r,i){"function"==typeof t.on&&eventTargetAgnosticAddListener(t,"error",r,i)}(t,errorListener,{once:!0})}))},EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var l=10;function checkListener(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function _getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function _addListener(t,r,i,o){var a,c,u;if(checkListener(i),void 0===(c=t._events)?(c=t._events=Object.create(null),t._eventsCount=0):(void 0!==c.newListener&&(t.emit("newListener",r,i.listener?i.listener:i),c=t._events),u=c[r]),void 0===u)u=c[r]=i,++t._eventsCount;else if("function"==typeof u?u=c[r]=o?[i,u]:[u,i]:o?u.unshift(i):u.push(i),(a=_getMaxListeners(t))>0&&u.length>a&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=r,l.count=u.length,function ProcessEmitWarning(t){console&&console.warn&&console.warn(t)}(l)}return t}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(t,r,i){var o={fired:!1,wrapFn:void 0,target:t,type:r,listener:i},a=onceWrapper.bind(o);return a.listener=i,o.wrapFn=a,a}function _listeners(t,r,i){var o=t._events;if(void 0===o)return[];var a=o[r];return void 0===a?[]:"function"==typeof a?i?[a.listener||a]:[a]:i?function unwrapListeners(t){for(var r=new Array(t.length),i=0;i<r.length;++i)r[i]=t[i].listener||t[i];return r}(a):arrayClone(a,a.length)}function listenerCount(t){var r=this._events;if(void 0!==r){var i=r[t];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function arrayClone(t,r){for(var i=new Array(r),o=0;o<r;++o)i[o]=t[o];return i}function eventTargetAgnosticAddListener(t,r,i,o){if("function"==typeof t.on)o.once?t.once(r,i):t.on(r,i);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(r,(function wrapListener(a){o.once&&t.removeEventListener(r,wrapListener),i(a)}))}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");l=t}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function setMaxListeners(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function emit(t){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var o="error"===t,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var u;if(r.length>0&&(u=r[0]),u instanceof Error)throw u;var l=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw l.context=u,l}var d=a[t];if(void 0===d)return!1;if("function"==typeof d)c(d,this,r);else{var p=d.length,h=arrayClone(d,p);for(i=0;i<p;++i)c(h[i],this,r)}return!0},EventEmitter.prototype.addListener=function addListener(t,r){return _addListener(this,t,r,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function prependListener(t,r){return _addListener(this,t,r,!0)},EventEmitter.prototype.once=function once(t,r){return checkListener(r),this.on(t,_onceWrap(this,t,r)),this},EventEmitter.prototype.prependOnceListener=function prependOnceListener(t,r){return checkListener(r),this.prependListener(t,_onceWrap(this,t,r)),this},EventEmitter.prototype.removeListener=function removeListener(t,r){var i,o,a,c,u;if(checkListener(r),void 0===(o=this._events))return this;if(void 0===(i=o[t]))return this;if(i===r||i.listener===r)0==--this._eventsCount?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,i.listener||r));else if("function"!=typeof i){for(a=-1,c=i.length-1;c>=0;c--)if(i[c]===r||i[c].listener===r){u=i[c].listener,a=c;break}if(a<0)return this;0===a?i.shift():function spliceOne(t,r){for(;r+1<t.length;r++)t[r]=t[r+1];t.pop()}(i,a),1===i.length&&(o[t]=i[0]),void 0!==o.removeListener&&this.emit("removeListener",t,u||r)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function removeAllListeners(t){var r,i,o;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[t]),this;if(0===arguments.length){var a,c=Object.keys(i);for(o=0;o<c.length;++o)"removeListener"!==(a=c[o])&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(r=i[t]))this.removeListener(t,r);else if(void 0!==r)for(o=r.length-1;o>=0;o--)this.removeListener(t,r[o]);return this},EventEmitter.prototype.listeners=function listeners(t){return _listeners(this,t,!0)},EventEmitter.prototype.rawListeners=function rawListeners(t){return _listeners(this,t,!1)},EventEmitter.listenerCount=function(t,r){return"function"==typeof t.listenerCount?t.listenerCount(r):listenerCount.call(t,r)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?o(this._events):[]}},function(t,r,i){var o=i(106),a=i(182),c=i(183),u=i(184);t.exports=function _createForOfIteratorHelper(t,r){var i=void 0!==o&&a(t)||t["@@iterator"];if(!i){if(c(t)||(i=u(t))||r&&t&&"number"==typeof t.length){i&&(t=i);var l=0,d=function F(){};return{s:d,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:d}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p,h=!0,m=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){m=!0,p=t},f:function f(){try{h||null==i.return||i.return()}finally{if(m)throw p}}}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(13),a=i(32),c=i(55);t.exports=o?function(t,r,i){return a.f(t,r,c(1,i))}:function(t,r,i){return t[r]=i,t}},function(t,r,i){"use strict";var o=i(47);t.exports=function(t,r,i,a){return a&&a.enumerable?t[r]=i:o(t,r,i),t}},function(t,r,i){"use strict";var o=i(169),a=i(32).f,c=i(47),u=i(21),l=i(372),d=i(10)("toStringTag");t.exports=function(t,r,i,p){var h=i?t:t&&t.prototype;h&&(u(h,d)||a(h,d,{configurable:!0,value:r}),p&&!o&&c(h,"toString",l))}},function(t,r,i){"use strict";var o=i(39),a=TypeError,PromiseCapability=function(t){var r,i;this.promise=new t((function(t,o){if(void 0!==r||void 0!==i)throw new a("Bad Promise constructor");r=t,i=o})),this.resolve=o(r),this.reject=o(i)};t.exports.f=function(t){return new PromiseCapability(t)}},function(t,r,i){"use strict";var o=i(90);t.exports=function(t){return("number"==typeof t||"bigint"==typeof t)&&!o(t)&&t!==1/0&&t!==-1/0}},function(t,r,i){t.exports=i(571)},function(t,r,i){t.exports=i(266)},function(t,r,i){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.File=r.Blob=r.FormData=void 0;const o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:window;r.FormData=o.FormData,r.Blob=o.Blob,r.File=o.File},function(t,r,i){"use strict";t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},function(t,r,i){"use strict";var o=i(78),a=TypeError;t.exports=function(t){if(o(t))throw new a("Can't call method on "+t);return t}},function(t,r,i){"use strict";var o=i(167);t.exports=function(t){return o(t.length)}},function(t,r,i){"use strict";var o,a,c,u=i(232),l=i(11),d=i(18),p=i(47),h=i(21),m=i(126),g=i(128),y=i(103),v=l.TypeError,b=l.WeakMap;if(u||m.state){var _=m.state||(m.state=new b);_.get=_.get,_.has=_.has,_.set=_.set,o=function(t,r){if(_.has(t))throw new v("Object already initialized");return r.facade=t,_.set(t,r),r},a=function(t){return _.get(t)||{}},c=function(t){return _.has(t)}}else{var w=g("state");y[w]=!0,o=function(t,r){if(h(t,w))throw new v("Object already initialized");return r.facade=t,p(t,w,r),r},a=function(t){return h(t,w)?t[w]:{}},c=function(t){return h(t,w)}}t.exports={set:o,get:a,has:c,enforce:function(t){return c(t)?a(t):o(t,{})},getterFor:function(t){return function(r){var i;if(!d(r)||(i=a(r)).type!==t)throw new v("Incompatible receiver, "+t+" required");return i}}}},function(t,r,i){"use strict";var o=i(179),a=i(6),c=i(489),u=i(3),l=a("%Function.prototype.apply%"),d=a("%Function.prototype.call%"),p=a("%Reflect.apply%",!0)||o.call(d,l),h=i(138),m=a("%Math.max%");t.exports=function callBind(t){if("function"!=typeof t)throw new u("a function is required");var r=p(o,d,arguments);return c(r,1+m(0,t.length-(arguments.length-1)),!0)};var g=function applyBind(){return p(o,l,arguments)};h?h(t.exports,"apply",{value:g}):t.exports.apply=g},function(t,r,i){"use strict";var o=i(6),a=i(3),c=o("%Number%"),u=i(723),l=i(308),d=i(724);t.exports=function ToNumber(t){var r=u(t)?t:l(t,c);if("symbol"==typeof r)throw new a("Cannot convert a Symbol value to a number");if("bigint"==typeof r)throw new a("Conversion from 'BigInt' to 'number' is not allowed.");return"string"==typeof r?d(r):c(r)}},function(t,r,i){var o=i(763);t.exports=function get(t,r,i){var a=null==t?void 0:o(t,r);return void 0===a?i:a}},function(t,r,i){"use strict";const o={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};o.localCName=o.generateIdentifier(),o.splitLines=function(t){return t.trim().split("\n").map(t=>t.trim())},o.splitSections=function(t){return t.split("\nm=").map((t,r)=>(r>0?"m="+t:t).trim()+"\r\n")},o.getDescription=function(t){const r=o.splitSections(t);return r&&r[0]},o.getMediaSections=function(t){const r=o.splitSections(t);return r.shift(),r},o.matchPrefix=function(t,r){return o.splitLines(t).filter(t=>0===t.indexOf(r))},o.parseCandidate=function(t){let r;r=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const i={foundation:r[0],component:{1:"rtp",2:"rtcp"}[r[1]]||r[1],protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]};for(let t=8;t<r.length;t+=2)switch(r[t]){case"raddr":i.relatedAddress=r[t+1];break;case"rport":i.relatedPort=parseInt(r[t+1],10);break;case"tcptype":i.tcpType=r[t+1];break;case"ufrag":i.ufrag=r[t+1],i.usernameFragment=r[t+1];break;default:void 0===i[r[t]]&&(i[r[t]]=r[t+1])}return i},o.writeCandidate=function(t){const r=[];r.push(t.foundation);const i=t.component;"rtp"===i?r.push(1):"rtcp"===i?r.push(2):r.push(i),r.push(t.protocol.toUpperCase()),r.push(t.priority),r.push(t.address||t.ip),r.push(t.port);const o=t.type;return r.push("typ"),r.push(o),"host"!==o&&t.relatedAddress&&t.relatedPort&&(r.push("raddr"),r.push(t.relatedAddress),r.push("rport"),r.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(r.push("tcptype"),r.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(r.push("ufrag"),r.push(t.usernameFragment||t.ufrag)),"candidate:"+r.join(" ")},o.parseIceOptions=function(t){return t.substring(14).split(" ")},o.parseRtpMap=function(t){let r=t.substring(9).split(" ");const i={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=parseInt(r[1],10),i.channels=3===r.length?parseInt(r[2],10):1,i.numChannels=i.channels,i},o.writeRtpMap=function(t){let r=t.payloadType;void 0!==t.preferredPayloadType&&(r=t.preferredPayloadType);const i=t.channels||t.numChannels||1;return"a=rtpmap:"+r+" "+t.name+"/"+t.clockRate+(1!==i?"/"+i:"")+"\r\n"},o.parseExtmap=function(t){const r=t.substring(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1],attributes:r.slice(2).join(" ")}},o.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+(t.attributes?" "+t.attributes:"")+"\r\n"},o.parseFmtp=function(t){const r={};let i;const o=t.substring(t.indexOf(" ")+1).split(";");for(let t=0;t<o.length;t++)i=o[t].trim().split("="),r[i[0].trim()]=i[1];return r},o.writeFmtp=function(t){let r="",i=t.payloadType;if(void 0!==t.preferredPayloadType&&(i=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const o=[];Object.keys(t.parameters).forEach(r=>{void 0!==t.parameters[r]?o.push(r+"="+t.parameters[r]):o.push(r)}),r+="a=fmtp:"+i+" "+o.join(";")+"\r\n"}return r},o.parseRtcpFb=function(t){const r=t.substring(t.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},o.writeRtcpFb=function(t){let r="",i=t.payloadType;return void 0!==t.preferredPayloadType&&(i=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(t=>{r+="a=rtcp-fb:"+i+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"}),r},o.parseSsrcMedia=function(t){const r=t.indexOf(" "),i={ssrc:parseInt(t.substring(7,r),10)},o=t.indexOf(":",r);return o>-1?(i.attribute=t.substring(r+1,o),i.value=t.substring(o+1)):i.attribute=t.substring(r+1),i},o.parseSsrcGroup=function(t){const r=t.substring(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(t=>parseInt(t,10))}},o.getMid=function(t){const r=o.matchPrefix(t,"a=mid:")[0];if(r)return r.substring(6)},o.parseFingerprint=function(t){const r=t.substring(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1].toUpperCase()}},o.getDtlsParameters=function(t,r){return{role:"auto",fingerprints:o.matchPrefix(t+r,"a=fingerprint:").map(o.parseFingerprint)}},o.writeDtlsParameters=function(t,r){let i="a=setup:"+r+"\r\n";return t.fingerprints.forEach(t=>{i+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"}),i},o.parseCryptoLine=function(t){const r=t.substring(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},o.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?o.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},o.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const r=t.substring(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}},o.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},o.getCryptoParameters=function(t,r){return o.matchPrefix(t+r,"a=crypto:").map(o.parseCryptoLine)},o.getIceParameters=function(t,r){const i=o.matchPrefix(t+r,"a=ice-ufrag:")[0],a=o.matchPrefix(t+r,"a=ice-pwd:")[0];return i&&a?{usernameFragment:i.substring(12),password:a.substring(10)}:null},o.writeIceParameters=function(t){let r="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(r+="a=ice-lite\r\n"),r},o.parseRtpParameters=function(t){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=o.splitLines(t)[0].split(" ");r.profile=i[2];for(let a=3;a<i.length;a++){const c=i[a],u=o.matchPrefix(t,"a=rtpmap:"+c+" ")[0];if(u){const i=o.parseRtpMap(u),a=o.matchPrefix(t,"a=fmtp:"+c+" ");switch(i.parameters=a.length?o.parseFmtp(a[0]):{},i.rtcpFeedback=o.matchPrefix(t,"a=rtcp-fb:"+c+" ").map(o.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}o.matchPrefix(t,"a=extmap:").forEach(t=>{r.headerExtensions.push(o.parseExtmap(t))});const a=o.matchPrefix(t,"a=rtcp-fb:* ").map(o.parseRtcpFb);return r.codecs.forEach(t=>{a.forEach(r=>{t.rtcpFeedback.find(t=>t.type===r.type&&t.parameter===r.parameter)||t.rtcpFeedback.push(r)})}),r},o.writeRtpDescription=function(t,r){let i="";i+="m="+t+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.payloadType).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach(t=>{i+=o.writeRtpMap(t),i+=o.writeFmtp(t),i+=o.writeRtcpFb(t)});let a=0;return r.codecs.forEach(t=>{t.maxptime>a&&(a=t.maxptime)}),a>0&&(i+="a=maxptime:"+a+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach(t=>{i+=o.writeExtmap(t)}),i},o.parseRtpEncodingParameters=function(t){const r=[],i=o.parseRtpParameters(t),a=-1!==i.fecMechanisms.indexOf("RED"),c=-1!==i.fecMechanisms.indexOf("ULPFEC"),u=o.matchPrefix(t,"a=ssrc:").map(t=>o.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute),l=u.length>0&&u[0].ssrc;let d;const p=o.matchPrefix(t,"a=ssrc-group:FID").map(t=>t.substring(17).split(" ").map(t=>parseInt(t,10)));p.length>0&&p[0].length>1&&p[0][0]===l&&(d=p[0][1]),i.codecs.forEach(t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let i={ssrc:l,codecPayloadType:parseInt(t.parameters.apt,10)};l&&d&&(i.rtx={ssrc:d}),r.push(i),a&&(i=JSON.parse(JSON.stringify(i)),i.fec={ssrc:l,mechanism:c?"red+ulpfec":"red"},r.push(i))}}),0===r.length&&l&&r.push({ssrc:l});let h=o.matchPrefix(t,"b=");return h.length&&(h=0===h[0].indexOf("b=TIAS:")?parseInt(h[0].substring(7),10):0===h[0].indexOf("b=AS:")?1e3*parseInt(h[0].substring(5),10)*.95-16e3:void 0,r.forEach(t=>{t.maxBitrate=h})),r},o.parseRtcpParameters=function(t){const r={},i=o.matchPrefix(t,"a=ssrc:").map(t=>o.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute)[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const a=o.matchPrefix(t,"a=rtcp-rsize");r.reducedSize=a.length>0,r.compound=0===a.length;const c=o.matchPrefix(t,"a=rtcp-mux");return r.mux=c.length>0,r},o.writeRtcpParameters=function(t){let r="";return t.reducedSize&&(r+="a=rtcp-rsize\r\n"),t.mux&&(r+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(r+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),r},o.parseMsid=function(t){let r;const i=o.matchPrefix(t,"a=msid:");if(1===i.length)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const a=o.matchPrefix(t,"a=ssrc:").map(t=>o.parseSsrcMedia(t)).filter(t=>"msid"===t.attribute);return a.length>0?(r=a[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},o.parseSctpDescription=function(t){const r=o.parseMLine(t),i=o.matchPrefix(t,"a=max-message-size:");let a;i.length>0&&(a=parseInt(i[0].substring(19),10)),isNaN(a)&&(a=65536);const c=o.matchPrefix(t,"a=sctp-port:");if(c.length>0)return{port:parseInt(c[0].substring(12),10),protocol:r.fmt,maxMessageSize:a};const u=o.matchPrefix(t,"a=sctpmap:");if(u.length>0){const t=u[0].substring(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:a}}},o.writeSctpDescription=function(t,r){let i=[];return i="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+r.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+r.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+r.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+r.port+" "+r.protocol+" 65535\r\n"],void 0!==r.maxMessageSize&&i.push("a=max-message-size:"+r.maxMessageSize+"\r\n"),i.join("")},o.generateSessionId=function(){return Math.random().toString().substr(2,22)},o.writeSessionBoilerplate=function(t,r,i){let a;const c=void 0!==r?r:2;a=t||o.generateSessionId();return"v=0\r\no="+(i||"thisisadapterortc")+" "+a+" "+c+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},o.getDirection=function(t,r){const i=o.splitLines(t);for(let t=0;t<i.length;t++)switch(i[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[t].substring(2)}return r?o.getDirection(r):"sendrecv"},o.getKind=function(t){return o.splitLines(t)[0].split(" ")[0].substring(2)},o.isRejected=function(t){return"0"===t.split(" ",2)[1]},o.parseMLine=function(t){const r=o.splitLines(t)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},o.parseOLine=function(t){const r=o.matchPrefix(t,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},o.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const r=o.splitLines(t);for(let t=0;t<r.length;t++)if(r[t].length<2||"="!==r[t].charAt(1))return!1;return!0},t.exports=o},function(t,r,i){"use strict";var o=i(122),a=i(39),c=i(121),u=o(o.bind);t.exports=function(t,r){return a(t),void 0===r?t:c?u(t,r):function(){return t.apply(r,arguments)}}},function(t,r,i){"use strict";var o=i(169),a=i(12),c=i(43),u=i(10)("toStringTag"),l=Object,d="Arguments"===c(function(){return arguments}());t.exports=o?c:function(t){var r,i,o;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,r){try{return t[r]}catch(t){}}(r=l(t),u))?i:d?c(r):"Object"===(o=c(r))&&a(r.callee)?"Arguments":o}},function(t,r,i){"use strict";var o=i(63),a=i(9),c=i(161),u=i(36),l=i(57),d=i(172),p=a([].push),createMethod=function(t){var r=1===t,i=2===t,a=3===t,h=4===t,m=6===t,g=7===t,y=5===t||m;return function(v,b,_,w){for(var S,I,k=u(v),x=c(k),P=l(x),C=o(b,_),A=0,O=w||d,R=r?O(v,P):i||g?O(v,0):void 0;P>A;A++)if((y||A in x)&&(I=C(S=x[A],A,k),t))if(r)R[A]=I;else if(I)switch(t){case 3:return!0;case 5:return S;case 6:return A;case 2:p(R,S)}else switch(t){case 4:return!1;case 7:p(R,S)}return m?-1:a||h?h:R}};t.exports={forEach:createMethod(0),map:createMethod(1),filter:createMethod(2),some:createMethod(3),every:createMethod(4),find:createMethod(5),findIndex:createMethod(6),filterReject:createMethod(7)}},function(t,r,i){"use strict";var o=i(43);t.exports=Array.isArray||function isArray(t){return"Array"===o(t)}},function(t,r,i){"use strict";i(68);var o=i(444),a=i(11),c=i(49),u=i(84);for(var l in o)c(a[l],l),u[l]=u.Array},function(t,r,i){"use strict";var o=i(38),a=i(175),c=i(84),u=i(58),l=i(32).f,d=i(245),p=i(176),h=i(35),m=i(13),g=u.set,y=u.getterFor("Array Iterator");t.exports=d(Array,"Array",(function(t,r){g(this,{type:"Array Iterator",target:o(t),index:0,kind:r})}),(function(){var t=y(this),r=t.target,i=t.index++;if(!r||i>=r.length)return t.target=void 0,p(void 0,!0);switch(t.kind){case"keys":return p(i,!1);case"values":return p(r[i],!1)}return p([i,r[i]],!1)}),"values");var v=c.Arguments=c.Array;if(a("keys"),a("values"),a("entries"),!h&&m&&"values"!==v.name)try{l(v,"name",{value:"values"})}catch(t){}},function(t,r,i){"use strict";var o=Function.prototype.call,a=Object.prototype.hasOwnProperty,c=i(179);t.exports=c.call(o,a)},function(t,r,i){"use strict";var o=i(63),a=i(20),c=i(33),u=i(80),l=i(262),d=i(57),p=i(23),h=i(185),m=i(109),g=i(261),y=TypeError,Result=function(t,r){this.stopped=t,this.result=r},v=Result.prototype;t.exports=function(t,r,i){var b,_,w,S,I,k,x,P=i&&i.that,C=!(!i||!i.AS_ENTRIES),A=!(!i||!i.IS_RECORD),O=!(!i||!i.IS_ITERATOR),R=!(!i||!i.INTERRUPTED),M=o(r,P),stop=function(t){return b&&g(b,"normal",t),new Result(!0,t)},callFn=function(t){return C?(c(t),R?M(t[0],t[1],stop):M(t[0],t[1])):R?M(t,stop):M(t)};if(A)b=t.iterator;else if(O)b=t;else{if(!(_=m(t)))throw new y(u(t)+" is not iterable");if(l(_)){for(w=0,S=d(t);S>w;w++)if((I=callFn(t[w]))&&p(v,I))return I;return new Result(!1)}b=h(t,_)}for(k=A?t.next:b.next;!(x=a(k,b)).done;){try{I=callFn(x.value)}catch(t){g(b,"throw",t)}if("object"==typeof I&&I&&p(v,I))return I}return new Result(!1)}},function(t,r,i){var o=i(621),a=i(626);t.exports=function getNative(t,r){var i=a(t,r);return o(i)?i:void 0}},function(t,r,i){"use strict";var o=i(698);t.exports=function Type(t){return"symbol"==typeof t?"Symbol":"bigint"==typeof t?"BigInt":o(t)}},function(t,r,i){"use strict";var o=i(202),a=i(3);t.exports=function truncate(t){if("number"!=typeof t&&"bigint"!=typeof t)throw new a("argument must be a Number or a BigInt");var r=t<0?-o(-t):o(t);return 0===r?0:r}},function(t,r,i){(r=t.exports=i(323)).Stream=r,r.Readable=r,r.Writable=i(327),r.Duplex=i(96),r.Transform=i(329),r.PassThrough=i(790),r.finished=i(211),r.pipeline=i(791)},function(t,r,i){(function(o){r.formatArgs=function formatArgs(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;r.splice(1,0,i,"color: inherit");let o=0,a=0;r[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(o++,"%c"===t&&(a=o))}),r.splice(a,0,i)},r.save=function save(t){try{t?r.storage.setItem("debug",t):r.storage.removeItem("debug")}catch(t){}},r.load=function load(){let t;try{t=r.storage.getItem("debug")}catch(t){}!t&&void 0!==o&&"env"in o&&(t=o.env.DEBUG);return t},r.useColors=function useColors(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function localstorage(){try{return localStorage}catch(t){}}(),r.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=i(797)(r);const{formatters:a}=t.exports;a.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,i(19))},function(t,r,i){t.exports=i(580)},function(t,r,i){"use strict";var o=i(13),a=i(20),c=i(123),u=i(55),l=i(38),d=i(162),p=i(21),h=i(223),m=Object.getOwnPropertyDescriptor;r.f=o?m:function getOwnPropertyDescriptor(t,r){if(t=l(t),r=d(r),h)try{return m(t,r)}catch(t){}if(p(t,r))return u(!a(c.f,t,r),t[r])}},function(t,r,i){"use strict";t.exports=function(t){return null==t}},function(t,r,i){"use strict";var o=i(124),a=i(8),c=i(11).String;t.exports=!!Object.getOwnPropertySymbols&&!a((function(){var t=Symbol("symbol detection");return!c(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&o&&o<41}))},function(t,r,i){"use strict";var o=String;t.exports=function(t){try{return o(t)}catch(t){return"Object"}}},function(t,r,i){"use strict";var o=i(126);t.exports=function(t,r){return o[t]||(o[t]=r||{})}},function(t,r,i){"use strict";var o,a=i(33),c=i(170),u=i(168),l=i(103),d=i(229),p=i(164),h=i(128),m=h("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"<\/script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var r=t.parentWindow.Object;return t=null,r},NullProtoObject=function(){try{o=new ActiveXObject("htmlfile")}catch(t){}var t,r;NullProtoObject="undefined"!=typeof document?document.domain&&o?NullProtoObjectViaActiveX(o):((r=p("iframe")).style.display="none",d.appendChild(r),r.src=String("javascript:"),(t=r.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F):NullProtoObjectViaActiveX(o);for(var i=u.length;i--;)delete NullProtoObject.prototype[u[i]];return NullProtoObject()};l[m]=!0,t.exports=Object.create||function create(t,r){var i;return null!==t?(EmptyConstructor.prototype=a(t),i=new EmptyConstructor,EmptyConstructor.prototype=null,i[m]=t):i=NullProtoObject(),void 0===r?i:c.f(i,r)}},function(t,r,i){"use strict";var o=i(9);t.exports=o([].slice)},function(t,r,i){"use strict";t.exports={}},function(t,r,i){"use strict";var o=i(6)("%Object.getOwnPropertyDescriptor%",!0);if(o)try{o([],"length")}catch(t){o=null}t.exports=o},function(t,r,i){"use strict";t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},function(t,r,i){"use strict";var o=i(11);t.exports=o.Promise},function(t,r){t.exports=function isObjectLike(t){return null!=t&&"object"==typeof t}},function(t,r){var i=Array.isArray;t.exports=i},function(t,r,i){"use strict";t.exports=Number.isNaN||function isNaN(t){return t!=t}},function(t,r,i){"use strict";(function(r){var o=i(3),a=i(301),c=i(114)(),u=i(24),l=i(92),d=i(115),p=u("SharedArrayBuffer.prototype.byteLength",!0);t.exports=function IsDetachedBuffer(t){var i=d(t);if(!l(t)&&!i)throw new o("Assertion failed: `arrayBuffer` must be an Object with an [[ArrayBufferData]] internal slot");if(0===(i?p:a)(t))try{new r[c[0]](t)}catch(t){return!!t&&"TypeError"===t.name}return!1}}).call(this,i(17))},function(t,r,i){"use strict";var o=i(59),a=i(24),c=i(6)("%ArrayBuffer%",!0),u=a("ArrayBuffer.prototype.byteLength",!0),l=a("Object.prototype.toString"),d=!!c&&!u&&new c(0).slice,p=!!d&&o(d);t.exports=u||p?function isArrayBuffer(t){if(!t||"object"!=typeof t)return!1;try{return u?u(t):p(t,0),!0}catch(t){return!1}}:c?function isArrayBuffer(t){return"[object ArrayBuffer]"===l(t)}:function isArrayBuffer(t){return!1}},function(t,r,i){"use strict";var o=i(113);t.exports=function isTypedArray(t){return!!o(t)}},function(t,r,i){"use strict";var o=i(722);t.exports=function modulo(t,r){return o(t,r)}},function(t,r,i){"use strict";var o={};function createErrorType(t,r,i){i||(i=Error);var a=function(t){function NodeError(i,o,a){return t.call(this,function getMessage(t,i,o){return"string"==typeof r?r:r(t,i,o)}(i,o,a))||this}return function _inheritsLoose(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r}(NodeError,t),NodeError}(i);a.prototype.name=i.name,a.prototype.code=t,o[t]=a}function oneOf(t,r){if(Array.isArray(t)){var i=t.length;return t=t.map((function(t){return String(t)})),i>2?"one of ".concat(r," ").concat(t.slice(0,i-1).join(", "),", or ")+t[i-1]:2===i?"one of ".concat(r," ").concat(t[0]," or ").concat(t[1]):"of ".concat(r," ").concat(t[0])}return"of ".concat(r," ").concat(String(t))}createErrorType("ERR_INVALID_OPT_VALUE",(function(t,r){return'The value "'+r+'" is invalid for option "'+t+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(t,r,i){var o,a;if("string"==typeof r&&function startsWith(t,r,i){return t.substr(!i||i<0?0:+i,r.length)===r}(r,"not ")?(o="must not be",r=r.replace(/^not /,"")):o="must be",function endsWith(t,r,i){return(void 0===i||i>t.length)&&(i=t.length),t.substring(i-r.length,i)===r}(t," argument"))a="The ".concat(t," ").concat(o," ").concat(oneOf(r,"type"));else{var c=function includes(t,r,i){return"number"!=typeof i&&(i=0),!(i+r.length>t.length)&&-1!==t.indexOf(r,i)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(c," ").concat(o," ").concat(oneOf(r,"type"))}return a+=". Received type ".concat(typeof i)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=o},function(t,r,i){"use strict";(function(r){var o=Object.keys||function(t){var r=[];for(var i in t)r.push(i);return r};t.exports=Duplex;var a=i(323),c=i(327);i(30)(Duplex,a);for(var u=o(c.prototype),l=0;l<u.length;l++){var d=u[l];Duplex.prototype[d]||(Duplex.prototype[d]=c.prototype[d])}function Duplex(t){if(!(this instanceof Duplex))return new Duplex(t);a.call(this,t),c.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",onend)))}function onend(){this._writableState.ended||r.nextTick(onEndNT,this)}function onEndNT(t){t.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Duplex.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Duplex.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function set(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,i(19))},function(t,r,i){"use strict";var o=i(117),a=Object.keys||function(t){var r=[];for(var i in t)r.push(i);return r};t.exports=Duplex;var c=Object.create(i(118));c.inherits=i(30);var u=i(340),l=i(343);c.inherits(Duplex,u);for(var d=a(l.prototype),p=0;p<d.length;p++){var h=d[p];Duplex.prototype[h]||(Duplex.prototype[h]=l.prototype[h])}function Duplex(t){if(!(this instanceof Duplex))return new Duplex(t);u.call(this,t),l.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||o.nextTick(onEndNT,this)}function onEndNT(t){t.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),Duplex.prototype._destroy=function(t,r){this.push(null),this.end(),o.nextTick(r,t)}},function(t,r,i){var o=i(265);function asyncGeneratorStep(t,r,i,a,c,u,l){try{var d=t[u](l),p=d.value}catch(t){return void i(t)}d.done?r(p):o.resolve(p).then(a,c)}t.exports=function _asyncToGenerator(t){return function(){var r=this,i=arguments;return new o((function(o,a){var c=t.apply(r,i);function _next(t){asyncGeneratorStep(c,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(c,o,a,_next,_throw,"throw",t)}_next(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(121),a=Function.prototype,c=a.apply,u=a.call;t.exports="object"==typeof Reflect&&Reflect.apply||(o?u.bind(c):function(){return u.apply(c,arguments)})},function(t,r,i){"use strict";var o=i(28),a=i(12),c=i(23),u=i(222),l=Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var r=o("Symbol");return a(r)&&c(r.prototype,l(t))}},function(t,r,i){"use strict";var o=i(226),a=i(168);t.exports=Object.keys||function keys(t){return o(t,a)}},function(t,r,i){"use strict";var o=i(366);t.exports=function(t){var r=+t;return r!=r||0===r?0:o(r)}},function(t,r,i){"use strict";t.exports={}},function(t,r,i){"use strict";var o=i(8),a=i(10),c=i(124),u=a("species");t.exports=function(t){return c>=51||!o((function(){var r=[];return(r.constructor={})[u]=function(){return{foo:1}},1!==r[t](Boolean).foo}))}},function(t,r,i){"use strict";var o=i(13),a=i(32),c=i(55);t.exports=function(t,r,i){o?a.f(t,r,c(0,i)):t[r]=i}},function(t,r,i){"use strict";t.exports=i(421)},function(t,r){},function(t,r,i){"use strict";var o=i(21),a=i(12),c=i(36),u=i(128),l=i(248),d=u("IE_PROTO"),p=Object,h=p.prototype;t.exports=l?p.getPrototypeOf:function(t){var r=c(t);if(o(r,d))return r[d];var i=r.constructor;return a(i)&&r instanceof i?i.prototype:r instanceof p?h:null}},function(t,r,i){"use strict";var o=i(64),a=i(163),c=i(78),u=i(84),l=i(10)("iterator");t.exports=function(t){if(!c(t))return a(t,l)||a(t,"@@iterator")||u[o(t)]}},function(t,r,i){"use strict";var o=i(11),a=i(87),c=i(12),u=i(224),l=i(233),d=i(10),p=i(533),h=i(274),m=i(35),g=i(124),y=a&&a.prototype,v=d("species"),b=!1,_=c(o.PromiseRejectionEvent),w=u("Promise",(function(){var t=l(a),r=t!==String(a);if(!r&&66===g)return!0;if(m&&(!y.catch||!y.finally))return!0;if(!g||g<51||!/native code/.test(t)){var i=new a((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};if((i.constructor={})[v]=FakePromise,!(b=i.then((function(){}))instanceof FakePromise))return!0}return!r&&(p||h)&&!_}));t.exports={CONSTRUCTOR:w,REJECTION_EVENT:_,SUBCLASSING:b}},function(t,r,i){var o=i(144),a=i(622),c=i(623),u=o?o.toStringTag:void 0;t.exports=function baseGetTag(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?a(t):c(t)}},function(t,r){t.exports=function isObject(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}},function(t,r,i){"use strict";(function(r){var o=i(197),a=i(114),c=i(59),u=i(24),l=i(85),d=u("Object.prototype.toString"),p=i(199)(),h="undefined"==typeof globalThis?r:globalThis,m=a(),g=u("String.prototype.slice"),y=Object.getPrototypeOf,v=u("Array.prototype.indexOf",!0)||function indexOf(t,r){for(var i=0;i<t.length;i+=1)if(t[i]===r)return i;return-1},b={__proto__:null};o(m,p&&l&&y?function(t){var r=new h[t];if(Symbol.toStringTag in r){var i=y(r),o=l(i,Symbol.toStringTag);if(!o){var a=y(i);o=l(a,Symbol.toStringTag)}b["$"+t]=c(o.get)}}:function(t){var r=new h[t],i=r.slice||r.set;i&&(b["$"+t]=c(i))});t.exports=function whichTypedArray(t){if(!t||"object"!=typeof t)return!1;if(!p){var r=g(d(t),8,-1);return v(m,r)>-1?r:"Object"===r&&function tryAllSlices(t){var r=!1;return o(b,(function(i,o){if(!r)try{i(t),r=g(o,1)}catch(t){}})),r}(t)}return l?function tryAllTypedArrays(t){var r=!1;return o(b,(function(i,o){if(!r)try{"$"+i(t)===o&&(r=g(o,1))}catch(t){}})),r}(t):null}}).call(this,i(17))},function(t,r,i){"use strict";(function(r){var o=i(298),a="undefined"==typeof globalThis?r:globalThis;t.exports=function availableTypedArrays(){for(var t=[],r=0;r<o.length;r++)"function"==typeof a[o[r]]&&(t[t.length]=o[r]);return t}}).call(this,i(17))},function(t,r,i){"use strict";var o=i(24)("SharedArrayBuffer.prototype.byteLength",!0);t.exports=o?function isSharedArrayBuffer(t){if(!t||"object"!=typeof t)return!1;try{return o(t),!0}catch(t){return!1}}:function isSharedArrayBuffer(t){return!1}},function(t,r,i){"use strict";var o=i(3),a=i(24)("TypedArray.prototype.buffer",!0),c=i(93);t.exports=a||function typedArrayBuffer(t){if(!c(t))throw new o("Not a Typed Array");return t.buffer}},function(t,r,i){"use strict";(function(r){void 0===r||!r.version||0===r.version.indexOf("v0.")||0===r.version.indexOf("v1.")&&0!==r.version.indexOf("v1.8.")?t.exports={nextTick:function nextTick(t,i,o,a){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var c,u,l=arguments.length;switch(l){case 0:case 1:return r.nextTick(t);case 2:return r.nextTick((function afterTickOne(){t.call(null,i)}));case 3:return r.nextTick((function afterTickTwo(){t.call(null,i,o)}));case 4:return r.nextTick((function afterTickThree(){t.call(null,i,o,a)}));default:for(c=new Array(l-1),u=0;u<c.length;)c[u++]=arguments[u];return r.nextTick((function afterTick(){t.apply(null,c)}))}}}:t.exports=r}).call(this,i(19))},function(t,r,i){function objectToString(t){return Object.prototype.toString.call(t)}r.isArray=function isArray(t){return Array.isArray?Array.isArray(t):"[object Array]"===objectToString(t)},r.isBoolean=function isBoolean(t){return"boolean"==typeof t},r.isNull=function isNull(t){return null===t},r.isNullOrUndefined=function isNullOrUndefined(t){return null==t},r.isNumber=function isNumber(t){return"number"==typeof t},r.isString=function isString(t){return"string"==typeof t},r.isSymbol=function isSymbol(t){return"symbol"==typeof t},r.isUndefined=function isUndefined(t){return void 0===t},r.isRegExp=function isRegExp(t){return"[object RegExp]"===objectToString(t)},r.isObject=function isObject(t){return"object"==typeof t&&null!==t},r.isDate=function isDate(t){return"[object Date]"===objectToString(t)},r.isError=function isError(t){return"[object Error]"===objectToString(t)||t instanceof Error},r.isFunction=function isFunction(t){return"function"==typeof t},r.isPrimitive=function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=i(16).Buffer.isBuffer},function(t,r,i){t.exports=i(476)},function(t,r,i){"use strict";var o=i(482),a=i(491),c=i(181);t.exports={formats:c,parse:a,stringify:o}},function(t,r,i){"use strict";var o=i(8);t.exports=!o((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},function(t,r,i){"use strict";var o=i(43),a=i(9);t.exports=function(t){if("Function"===o(t))return a(t)}},function(t,r,i){"use strict";var o={}.propertyIsEnumerable,a=Object.getOwnPropertyDescriptor,c=a&&!o.call({1:2},1);r.f=c?function propertyIsEnumerable(t){var r=a(this,t);return!!r&&r.enumerable}:o},function(t,r,i){"use strict";var o,a,c=i(11),u=i(125),l=c.process,d=c.Deno,p=l&&l.versions||d&&d.version,h=p&&p.v8;h&&(a=(o=h.split("."))[0]>0&&o[0]<4?1:+(o[0]+o[1])),!a&&u&&(!(o=u.match(/Edge\/(\d+)/))||o[1]>=74)&&(o=u.match(/Chrome\/(\d+)/))&&(a=+o[1]),t.exports=a},function(t,r,i){"use strict";t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},function(t,r,i){"use strict";var o=i(35),a=i(11),c=i(365),u=t.exports=a["__core-js_shared__"]||c("__core-js_shared__",{});(u.versions||(u.versions=[])).push({version:"3.37.1",mode:o?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"})},function(t,r,i){"use strict";var o=i(9),a=0,c=Math.random(),u=o(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+u(++a+c,36)}},function(t,r,i){"use strict";var o=i(81),a=i(127),c=o("keys");t.exports=function(t){return c[t]||(c[t]=a(t))}},function(t,r,i){"use strict";var o=i(226),a=i(168).concat("length","prototype");r.f=Object.getOwnPropertyNames||function getOwnPropertyNames(t){return o(t,a)}},function(t,r,i){"use strict";r.f=Object.getOwnPropertySymbols},function(t,r,i){"use strict";var o=i(10);r.f=o},function(t,r,i){"use strict";var o=i(9),a=i(8),c=i(12),u=i(64),l=i(28),d=i(233),noop=function(){},p=l("Reflect","construct"),h=/^\s*(?:class|function)\b/,m=o(h.exec),g=!h.test(noop),y=function isConstructor(t){if(!c(t))return!1;try{return p(noop,[],t),!0}catch(t){return!1}},v=function isConstructor(t){if(!c(t))return!1;switch(u(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return g||!!m(h,d(t))}catch(t){return!0}};v.sham=!0,t.exports=!p||a((function(){var t;return y(y.call)||!y(Object)||!y((function(){t=!0}))||t}))?v:y},function(t,r,i){"use strict";t.exports=i(416)},function(t,r,i){"use strict";var o=i(441),a=i(18),c=i(56),u=i(442);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,i={};try{(t=o(Object.prototype,"__proto__","set"))(i,[]),r=i instanceof Array}catch(t){}return function setPrototypeOf(i,o){return c(i),u(o),a(i)?(r?t(i,o):i.__proto__=o,i):i}}():void 0)},function(t,r,i){"use strict";var o=i(464).charAt,a=i(40),c=i(58),u=i(245),l=i(176),d=c.set,p=c.getterFor("String Iterator");u(String,"String",(function(t){d(this,{type:"String Iterator",string:a(t),index:0})}),(function next(){var t,r=p(this),i=r.string,a=r.index;return a>=i.length?l(void 0,!0):(t=o(i,a),r.index+=t.length,l(t,!1))}))},function(t,r){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],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}}),t.webpackPolyfill=1),t}},function(t,r,i){"use strict";var o={__proto__:null,foo:{}},a=Object;t.exports=function hasProto(){return{__proto__:o}.foo===o.foo&&!(o instanceof a)}},function(t,r,i){"use strict";var o=i(6)("%Object.defineProperty%",!0)||!1;if(o)try{o({},"a",{value:1})}catch(t){o=!1}t.exports=o},function(t,r,i){"use strict";var o=i(11),a=i(43);t.exports="process"===a(o.process)},function(t,r,i){"use strict";var o=i(23),a=TypeError;t.exports=function(t,r){if(o(r,t))return t;throw new a("Incorrect invocation")}},function(t,r,i){"use strict";var o=i(87),a=i(263),c=i(110).CONSTRUCTOR;t.exports=c||!a((function(t){o.all(t).then(void 0,(function(){}))}))},function(t,r,i){var o=i(611),a=i(612),c=i(613),u=i(614),l=i(615);function ListCache(t){var r=-1,i=null==t?0:t.length;for(this.clear();++r<i;){var o=t[r];this.set(o[0],o[1])}}ListCache.prototype.clear=o,ListCache.prototype.delete=a,ListCache.prototype.get=c,ListCache.prototype.has=u,ListCache.prototype.set=l,t.exports=ListCache},function(t,r,i){var o=i(280);t.exports=function assocIndexOf(t,r){for(var i=t.length;i--;)if(o(t[i][0],r))return i;return-1}},function(t,r,i){var o=i(44).Symbol;t.exports=o},function(t,r,i){var o=i(71)(Object,"create");t.exports=o},function(t,r,i){var o=i(635);t.exports=function getMapData(t,r){var i=t.__data__;return o(r)?i["string"==typeof r?"string":"hash"]:i.map}},function(t,r,i){var o=i(285),a=i(286);t.exports=function copyObject(t,r,i,c){var u=!i;i||(i={});for(var l=-1,d=r.length;++l<d;){var p=r[l],h=c?c(i[p],t[p],p,i,t):void 0;void 0===h&&(h=t[p]),u?a(i,p,h):o(i,p,h)}return i}},function(t,r,i){"use strict";var o=i(200),a="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),c=Object.prototype.toString,u=Array.prototype.concat,l=i(254),d=i(180)(),defineProperty=function(t,r,i,o){if(r in t)if(!0===o){if(t[r]===i)return}else if("function"!=typeof(a=o)||"[object Function]"!==c.call(a)||!o())return;var a;d?l(t,r,i,!0):l(t,r,i)},defineProperties=function(t,r){var i=arguments.length>2?arguments[2]:{},c=o(r);a&&(c=u.call(c,Object.getOwnPropertySymbols(r)));for(var l=0;l<c.length;l+=1)defineProperty(t,c[l],r[c[l]],i[c[l]])};defineProperties.supportsDescriptors=!!d,t.exports=defineProperties},function(t,r,i){"use strict";t.exports=function IsPropertyKey(t){return"string"==typeof t||"symbol"==typeof t}},function(t,r,i){"use strict";var o=i(6),a=o("%Math.abs%"),c=o("%Math.floor%"),u=i(90),l=i(51);t.exports=function isInteger(t){if("number"!=typeof t||u(t)||!l(t))return!1;var r=a(t);return c(r)===r}},function(t,r,i){"use strict";t.exports={__proto__:null,name:{__proto__:null,$Int8Array:"INT8",$Uint8Array:"UINT8",$Uint8ClampedArray:"UINT8C",$Int16Array:"INT16",$Uint16Array:"UINT16",$Int32Array:"INT32",$Uint32Array:"UINT32",$BigInt64Array:"BIGINT64",$BigUint64Array:"BIGUINT64",$Float32Array:"FLOAT32",$Float64Array:"FLOAT64"},size:{__proto__:null,$INT8:1,$UINT8:1,$UINT8C:1,$INT16:2,$UINT16:2,$INT32:4,$UINT32:4,$BIGINT64:8,$BIGUINT64:8,$FLOAT32:4,$FLOAT64:8}}},function(t,r,i){"use strict";var o=i(787).Buffer,a=o.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(t){var r;switch(this.encoding=function normalizeEncoding(t){var r=function _normalizeEncoding(t){if(!t)return"utf8";for(var r;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(r)return;t=(""+t).toLowerCase(),r=!0}}(t);if("string"!=typeof r&&(o.isEncoding===a||!a(t)))throw new Error("Unknown encoding: "+t);return r||t}(t),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,r=4;break;case"utf8":this.fillLast=utf8FillLast,r=4;break;case"base64":this.text=base64Text,this.end=base64End,r=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=o.allocUnsafe(r)}function utf8CheckByte(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function utf8FillLast(t){var r=this.lastTotal-this.lastNeed,i=function utf8CheckExtraBytes(t,r,i){if(128!=(192&r[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&r.length>1){if(128!=(192&r[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&r.length>2&&128!=(192&r[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,r,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,r,0,t.length),void(this.lastNeed-=t.length))}function utf16Text(t,r){if((t.length-r)%2==0){var i=t.toString("utf16le",r);if(i){var o=i.charCodeAt(i.length-1);if(o>=55296&&o<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",r,t.length-1)}function utf16End(t){var r=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,i)}return r}function base64Text(t,r){var i=(t.length-r)%3;return 0===i?t.toString("base64",r):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",r,t.length-i))}function base64End(t){var r=t&&t.length?this.write(t):"";return this.lastNeed?r+this.lastChar.toString("base64",0,3-this.lastNeed):r}function simpleWrite(t){return t.toString(this.encoding)}function simpleEnd(t){return t&&t.length?this.write(t):""}r.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(t){if(0===t.length)return"";var r,i;if(this.lastNeed){if(void 0===(r=this.fillLast(t)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?r?r+this.text(t,i):this.text(t,i):r||""},StringDecoder.prototype.end=function utf8End(t){var r=t&&t.length?this.write(t):"";return this.lastNeed?r+"�":r},StringDecoder.prototype.text=function utf8Text(t,r){var i=function utf8CheckIncomplete(t,r,i){var o=r.length-1;if(o<i)return 0;var a=utf8CheckByte(r[o]);if(a>=0)return a>0&&(t.lastNeed=a-1),a;if(--o<i||-2===a)return 0;if((a=utf8CheckByte(r[o]))>=0)return a>0&&(t.lastNeed=a-2),a;if(--o<i||-2===a)return 0;if((a=utf8CheckByte(r[o]))>=0)return a>0&&(2===a?a=0:t.lastNeed=a-3),a;return 0}(this,t,r);if(!this.lastNeed)return t.toString("utf8",r);this.lastTotal=i;var o=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,o),t.toString("utf8",r,o)},StringDecoder.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,r){t.exports=function(t){return null==t}},function(t,r,i){var o=i(16),a=o.Buffer;function copyProps(t,r){for(var i in t)r[i]=t[i]}function SafeBuffer(t,r,i){return a(t,r,i)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?t.exports=o:(copyProps(o,r),r.Buffer=SafeBuffer),copyProps(a,SafeBuffer),SafeBuffer.from=function(t,r,i){if("number"==typeof t)throw new TypeError("Argument must not be a number");return a(t,r,i)},SafeBuffer.alloc=function(t,r,i){if("number"!=typeof t)throw new TypeError("Argument must be a number");var o=a(t);return void 0!==r?"string"==typeof i?o.fill(r,i):o.fill(r):o.fill(0),o},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return a(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o.SlowBuffer(t)}},function(t,r,i){t.exports=i(260)},function(t,r,i){t.exports=i(593)},function(t,r){t.exports=function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){var o=i(133),a=i(241);function _defineProperties(t,r){for(var i=0;i<r.length;i++){var c=r[i];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),o(t,a(c.key),c)}}t.exports=function _createClass(t,r,i){return r&&_defineProperties(t.prototype,r),i&&_defineProperties(t,i),o(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){(function(r){!function(){"use strict";t.exports=function btoa(t){return(t instanceof r?t:r.from(t.toString(),"binary")).toString("base64")}}()}).call(this,i(16).Buffer)},function(t,r,i){"use strict";(function(t){i.d(r,"a",(function(){return serializeError}));Error;const o=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0}],a=Symbol(".toJSON was called"),destroyCircular=({from:r,seen:i,to_:c,forceEnumerable:u,maxDepth:l,depth:d})=>{const p=c||(Array.isArray(r)?[]:{});if(i.push(r),d>=l)return p;if("function"==typeof r.toJSON&&!0!==r[a])return(t=>{t[a]=!0;const r=t.toJSON();return delete t[a],r})(r);for(const[o,a]of Object.entries(r))"function"==typeof t&&t.isBuffer(a)?p[o]="[object Buffer]":"object"!=typeof a||"function"!=typeof a.pipe?"function"!=typeof a&&(a&&"object"==typeof a?i.includes(r[o])?p[o]="[Circular]":(d++,p[o]=destroyCircular({from:r[o],seen:[...i],forceEnumerable:u,maxDepth:l,depth:d})):p[o]=a):p[o]="[object Stream]";for(const{property:t,enumerable:i}of o)"string"==typeof r[t]&&Object.defineProperty(p,t,{value:r[t],enumerable:!!u||i,configurable:!0,writable:!0});return p};function serializeError(t,r={}){const{maxDepth:i=Number.POSITIVE_INFINITY}=r;return"object"==typeof t&&null!==t?destroyCircular({from:t,seen:[],forceEnumerable:!0,maxDepth:i,depth:0}):"function"==typeof t?`[Function: ${t.name||"anonymous"}]`:t}}).call(this,i(16).Buffer)},function(t,r,i){"use strict";var o=i(9),a=i(8),c=i(43),u=Object,l=o("".split);t.exports=a((function(){return!u("z").propertyIsEnumerable(0)}))?function(t){return"String"===c(t)?l(t,""):u(t)}:u},function(t,r,i){"use strict";var o=i(221),a=i(100);t.exports=function(t){var r=o(t,"string");return a(r)?r:r+""}},function(t,r,i){"use strict";var o=i(39),a=i(78);t.exports=function(t,r){var i=t[r];return a(i)?void 0:o(i)}},function(t,r,i){"use strict";var o=i(11),a=i(18),c=o.document,u=a(c)&&a(c.createElement);t.exports=function(t){return u?c.createElement(t):{}}},function(t,r,i){"use strict";var o=i(38),a=i(166),c=i(57),createMethod=function(t){return function(r,i,u){var l=o(r),d=c(l);if(0===d)return!t&&-1;var p,h=a(u,d);if(t&&i!=i){for(;d>h;)if((p=l[h++])!=p)return!0}else for(;d>h;h++)if((t||h in l)&&l[h]===i)return t||h||0;return!t&&-1}};t.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},function(t,r,i){"use strict";var o=i(102),a=Math.max,c=Math.min;t.exports=function(t,r){var i=o(t);return i<0?a(i+r,0):c(i,r)}},function(t,r,i){"use strict";var o=i(102),a=Math.min;t.exports=function(t){var r=o(t);return r>0?a(r,9007199254740991):0}},function(t,r,i){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,r,i){"use strict";var o={};o[i(10)("toStringTag")]="z",t.exports="[object z]"===String(o)},function(t,r,i){"use strict";var o=i(13),a=i(225),c=i(32),u=i(33),l=i(38),d=i(101);r.f=o&&!a?Object.defineProperties:function defineProperties(t,r){u(t);for(var i,o=l(r),a=d(r),p=a.length,h=0;p>h;)c.f(t,i=a[h++],o[i]);return t}},function(t,r,i){"use strict";var o=i(32);t.exports=function(t,r,i){return o.f(t,r,i)}},function(t,r,i){"use strict";var o=i(373);t.exports=function(t,r){return new(o(t))(0===r?0:r)}},function(t,r,i){"use strict";t.exports=i(390)},function(t,r,i){"use strict";var o=TypeError;t.exports=function(t){if(t>9007199254740991)throw o("Maximum allowed index exceeded");return t}},function(t,r,i){"use strict";t.exports=function(){}},function(t,r,i){"use strict";t.exports=function(t,r){return{value:t,done:r}}},function(t,r,i){"use strict";t.exports=RangeError},function(t,r,i){"use strict";t.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},r=Symbol("test"),i=Object(r);if("string"==typeof r)return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;for(r in t[r]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==r)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var a=Object.getOwnPropertyDescriptor(t,r);if(42!==a.value||!0!==a.enumerable)return!1}return!0}},function(t,r,i){"use strict";var o=i(488);t.exports=Function.prototype.bind||o},function(t,r,i){"use strict";var o=i(138),a=function hasPropertyDescriptors(){return!!o};a.hasArrayLengthDefineBug=function hasArrayLengthDefineBug(){if(!o)return null;try{return 1!==o([],"length",{value:1}).length}catch(t){return!0}},t.exports=a},function(t,r,i){"use strict";var o=String.prototype.replace,a=/%20/g,c="RFC1738",u="RFC3986";t.exports={default:u,formatters:{RFC1738:function(t){return o.call(t,a,"+")},RFC3986:function(t){return String(t)}},RFC1738:c,RFC3986:u}},function(t,r,i){"use strict";t.exports=i(492)},function(t,r,i){"use strict";t.exports=i(496)},function(t,r,i){var o=i(257),a=i(259),c=i(264);t.exports=function _unsupportedIterableToArray(t,r){var i;if(t){if("string"==typeof t)return c(t,r);var u=o(i=Object.prototype.toString.call(t)).call(i,8,-1);return"Object"===u&&t.constructor&&(u=t.constructor.name),"Map"===u||"Set"===u?a(t):"Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?c(t,r):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(20),a=i(39),c=i(33),u=i(80),l=i(109),d=TypeError;t.exports=function(t,r){var i=arguments.length<2?l(t):r;if(a(i))return c(o(i,t));throw new d(u(t)+" is not iterable")}},function(t,r,i){var o=i(71)(i(44),"Map");t.exports=o},function(t,r,i){var o=i(287),a=i(649),c=i(291);t.exports=function keys(t){return c(t)?o(t):a(t)}},function(t,r){t.exports=function baseUnary(t){return function(r){return t(r)}}},function(t,r,i){(function(t){var o=i(282),a=r&&!r.nodeType&&r,c=a&&"object"==typeof t&&t&&!t.nodeType&&t,u=c&&c.exports===a&&o.process,l=function(){try{var t=c&&c.require&&c.require("util").types;return t||u&&u.binding&&u.binding("util")}catch(t){}}();t.exports=l}).call(this,i(136)(t))},function(t,r){var i=Object.prototype;t.exports=function isPrototype(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||i)}},function(t,r,i){var o=i(287),a=i(652),c=i(291);t.exports=function keysIn(t){return c(t)?o(t,!0):a(t)}},function(t,r,i){var o=i(657),a=i(292),c=Object.prototype.propertyIsEnumerable,u=Object.getOwnPropertySymbols,l=u?function(t){return null==t?[]:(t=Object(t),o(u(t),(function(r){return c.call(t,r)})))}:a;t.exports=l},function(t,r,i){var o=i(661),a=i(186),c=i(662),u=i(663),l=i(664),d=i(111),p=i(283),h=p(o),m=p(a),g=p(c),y=p(u),v=p(l),b=d;(o&&"[object DataView]"!=b(new o(new ArrayBuffer(1)))||a&&"[object Map]"!=b(new a)||c&&"[object Promise]"!=b(c.resolve())||u&&"[object Set]"!=b(new u)||l&&"[object WeakMap]"!=b(new l))&&(b=function(t){var r=d(t),i="[object Object]"==r?t.constructor:void 0,o=i?p(i):"";if(o)switch(o){case h:return"[object DataView]";case m:return"[object Map]";case g:return"[object Promise]";case y:return"[object Set]";case v:return"[object WeakMap]"}return r}),t.exports=b},function(t,r,i){var o=i(667);t.exports=function cloneArrayBuffer(t){var r=new t.constructor(t.byteLength);return new o(r).set(new o(t)),r}},function(t,r,i){"use strict";var o=i(48);t.exports=function(t,r,i){for(var a in r)i&&i.unsafe&&t[a]?t[a]=r[a]:o(t,a,r[a],i);return t}},function(t,r,i){"use strict";var o=i(1),a=i(9),c=i(103),u=i(18),l=i(21),d=i(32).f,p=i(129),h=i(230),m=i(682),g=i(127),y=i(297),v=!1,b=g("meta"),_=0,setMetadata=function(t){d(t,b,{value:{objectID:"O"+_++,weakData:{}}})},w=t.exports={enable:function(){w.enable=function(){},v=!0;var t=p.f,r=a([].splice),i={};i[b]=1,t(i).length&&(p.f=function(i){for(var o=t(i),a=0,c=o.length;a<c;a++)if(o[a]===b){r(o,a,1);break}return o},o({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:h.f}))},fastKey:function(t,r){if(!u(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!l(t,b)){if(!m(t))return"F";if(!r)return"E";setMetadata(t)}return t[b].objectID},getWeakData:function(t,r){if(!l(t,b)){if(!m(t))return!0;if(!r)return!1;setMetadata(t)}return t[b].weakData},onFreeze:function(t){return y&&v&&m(t)&&!l(t,b)&&setMetadata(t),t}};c[b]=!0},function(t,r,i){"use strict";var o=i(198),a=Object.prototype.toString,c=Object.prototype.hasOwnProperty,u=function forEachArray(t,r,i){for(var o=0,a=t.length;o<a;o++)c.call(t,o)&&(null==i?r(t[o],o,t):r.call(i,t[o],o,t))},l=function forEachString(t,r,i){for(var o=0,a=t.length;o<a;o++)null==i?r(t.charAt(o),o,t):r.call(i,t.charAt(o),o,t)},d=function forEachObject(t,r,i){for(var o in t)c.call(t,o)&&(null==i?r(t[o],o,t):r.call(i,t[o],o,t))};t.exports=function forEach(t,r,i){if(!o(r))throw new TypeError("iterator must be a function");var c;arguments.length>=3&&(c=i),"[object Array]"===a.call(t)?u(t,r,c):"string"==typeof t?l(t,r,c):d(t,r,c)}},function(t,r,i){"use strict";var o,a,c=Function.prototype.toString,u="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof u&&"function"==typeof Object.defineProperty)try{o=Object.defineProperty({},"length",{get:function(){throw a}}),a={},u((function(){throw 42}),null,o)}catch(t){t!==a&&(u=null)}else u=null;var l=/^\s*class\b/,d=function isES6ClassFunction(t){try{var r=c.call(t);return l.test(r)}catch(t){return!1}},p=function tryFunctionToStr(t){try{return!d(t)&&(c.call(t),!0)}catch(t){return!1}},h=Object.prototype.toString,m="function"==typeof Symbol&&!!Symbol.toStringTag,g=!(0 in[,]),y=function isDocumentDotAll(){return!1};if("object"==typeof document){var v=document.all;h.call(v)===h.call(document.all)&&(y=function isDocumentDotAll(t){if((g||!t)&&(void 0===t||"object"==typeof t))try{var r=h.call(t);return("[object HTMLAllCollection]"===r||"[object HTML document.all class]"===r||"[object HTMLCollection]"===r||"[object Object]"===r)&&null==t("")}catch(t){}return!1})}t.exports=u?function isCallable(t){if(y(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{u(t,null,o)}catch(t){if(t!==a)return!1}return!d(t)&&p(t)}:function isCallable(t){if(y(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(m)return p(t);if(d(t))return!1;var r=h.call(t);return!("[object Function]"!==r&&"[object GeneratorFunction]"!==r&&!/^\[object HTML/.test(r))&&p(t)}},function(t,r,i){"use strict";var o=i(178);t.exports=function hasToStringTagShams(){return o()&&!!Symbol.toStringTag}},function(t,r,i){"use strict";var o=Array.prototype.slice,a=i(299),c=Object.keys,u=c?function keys(t){return c(t)}:i(696),l=Object.keys;u.shim=function shimObjectKeys(){Object.keys?function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2)||(Object.keys=function keys(t){return a(t)?l(o.call(t)):l(t)}):Object.keys=u;return Object.keys||u},t.exports=u},function(t,r,i){"use strict";t.exports=i(303)},function(t,r,i){"use strict";var o=Math.floor;t.exports=function floor(t){return"bigint"==typeof t?t:o(t)}},function(t,r,i){"use strict";var o=i(41),a=i(3),c=i(150),u=i(113),l=i(151);t.exports=function TypedArrayElementSize(t){var r=u(t);if(!1===r)throw new a("Assertion failed: `O` must be a TypedArray");var i=l.size["$"+l.name["$"+r]];if(!c(i)||i<0)throw new o("Assertion failed: Unknown TypedArray type `"+r+"`");return i}},function(t,r,i){"use strict";var o=i(3),a=i(69),c={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};t.exports=function isPropertyDescriptor(t){if(!t||"object"!=typeof t)return!1;for(var r in t)if(a(t,r)&&!c[r])return!1;var i=a(t,"[[Value]]")||a(t,"[[Writable]]"),u=a(t,"[[Get]]")||a(t,"[[Set]]");if(i&&u)throw new o("Property Descriptors may not be both accessor and data descriptors");return!0}},function(t,r,i){"use strict";var o=i(3),a=i(91),c=i(203),u=i(317),l=i(116),d=i(206),p=i(318);t.exports=function IsTypedArrayOutOfBounds(t){if(!u(t))throw new o("Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record");var r=t["[[Object]]"],i=t["[[CachedBufferByteLength]]"];if(a(l(r))&&"DETACHED"!==i)throw new o("Assertion failed: typed array is detached only if the byte length is ~DETACHED~");if("DETACHED"===i)return!0;var h,m=d(r),g=p(r);"AUTO"===g?h=i:h=m+g*c(r);return m>i||h>i}},function(t,r,i){"use strict";(function(r){var o=i(197),a=i(59),c=i(114)(),u={},l=i(137)(),d=i(85),p=Object.defineProperty;if(d){var getByteOffset=function(t){return t.byteOffset};o(c,(function(t){if("function"==typeof r[t]||"object"==typeof r[t]){var i=r[t].prototype,o=d(i,"byteOffset");if(!o&&l){var c=i.__proto__;o=d(c,"byteOffset")}if(o&&o.get)u[t]=a(o.get);else if(p){var h=new r[t](2);(o=d(h,"byteOffset"))&&o.configurable&&p(h,"length",{value:3}),2===h.length&&(u[t]=getByteOffset)}}}))}var h=i(93);t.exports=function typedArrayByteOffset(t){return!!h(t)&&function tryAllTypedArrays(t){var r;return o(u,(function(i){if("number"!=typeof r)try{var o=i(t);"number"==typeof o&&(r=o)}catch(t){}})),r}(t)}}).call(this,i(17))},function(t,r,i){var o=i(111),a=i(88);t.exports=function isSymbol(t){return"symbol"==typeof t||a(t)&&"[object Symbol]"==o(t)}},function(t,r,i){(function(r){var o=i(45),a=i(209).inherits,c=i(782),u=i(808),l=i(338),d=i(811),p=i(153),h=i(812),m=i(814),g=i(215);function makeTwoDigits(t){return t>9?t:"0"+t}function signUrl(t,r,i,o,a,c,d,h,m,g,y,v,b,_){var w=t+"\n"+o+"\n"+a+"\n"+("host:"+i.toLowerCase()+"\n")+"\nhost\n"+l(g,{asBytes:!0});!0===b&&console.log("canonical request: "+w+"\n");var S=l(w,{asBytes:!0});!0===b&&console.log("hashed canonical request: "+S+"\n");var I="AWS4-HMAC-SHA256\n"+v+"\n"+y+"/"+h+"/"+m+"/aws4_request\n"+S;!0===b&&console.log("string to sign: "+I+"\n");var k=function getSignatureKey(t,r,i,o){var a=u(r,"AWS4"+t,{asBytes:!0}),c=u(i,a,{asBytes:!0}),l=u(o,c,{asBytes:!0});return u("aws4_request",l,{asBytes:!0})}(d,y,h,m);!0===b&&console.log("signing key: "+k+"\n");var x=u(I,k,{asBytes:!0});!0===b&&console.log("signature: "+x+"\n");var P=a+"&X-Amz-Signature="+x;p(_)||(P+="&X-Amz-Security-Token="+encodeURIComponent(_));var C=r+i+o+"?"+P;return!0===b&&console.log("url: "+C+"\n"),C}function prepareWebSocketUrl(t,r,i,o){var a=function getDateTimeString(){var t=new Date;return t.getUTCFullYear()+""+makeTwoDigits(t.getUTCMonth()+1)+makeTwoDigits(t.getUTCDate())+"T"+makeTwoDigits(t.getUTCHours())+makeTwoDigits(t.getUTCMinutes())+makeTwoDigits(t.getUTCSeconds())+"Z"}(),c=function getDateString(t){return t.substring(0,t.indexOf("T"))}(a),u="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+r+"%2F"+c+"%2F"+t.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+a+"&X-Amz-SignedHeaders=host",l=t.host;return p(t.port)||443===t.port||(l=t.host+":"+t.port),signUrl("GET","wss://",l,"/mqtt",u,0,i,t.region,"iotdevicegateway","",c,a,t.debug,o)}function prepareWebSocketCustomAuthUrl(t){var r=t.host;return p(t.port)||443===t.port||(r=t.host+":"+t.port),"wss://"+r+"/mqtt"+(t.customAuthQueryString||"")}function getCredentials(t){var r={},i={};return function arrayEach(t,r){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&r.call(this,t[i],parseInt(i,10))}(t.split(/\r?\n/),(function(t){var o=(t=t.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);if(o)i=o[1];else if(i){var a=t.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);a&&(r[i]=r[i]||{},r[i][a[1]]=a[2])}})),r}function DeviceClient(t){if(!(this instanceof DeviceClient))return new DeviceClient(t);var o=this,a=[],u=!0,l=0,y="oldest";a.length=0;var v=[];v.length=0;var b=[],_=!0;b.length=0;var w=[];w.length=0;var S,I,k,x,P="inactive",C=null,A=250,O=1e3,R=2e4,M=128e3,j=null,L="?SDK=JavaScript&Version="+i(815).version;if(p(t)||0===Object.keys(t).length)throw new Error(d.INVALID_CONNECT_OPTIONS);if(p(t.keepalive)&&(t.keepalive=300),(p(t.enableMetrics)||!0===t.enableMetrics)&&(p(t.username)?t.username=L:t.username+=L),p(t.baseReconnectTimeMs)||(O=t.baseReconnectTimeMs),p(t.minimumConnectionTimeMs)||(R=t.minimumConnectionTimeMs),p(t.maximumReconnectTimeMs)||(M=t.maximumReconnectTimeMs),p(t.drainTimeMs)||(A=t.drainTimeMs),p(t.autoResubscribe)||(_=t.autoResubscribe),p(t.offlineQueueing)||(u=t.offlineQueueing),p(t.offlineQueueMaxSize)||(l=t.offlineQueueMaxSize),p(t.offlineQueueDropBehavior)||(y=t.offlineQueueDropBehavior),S=O,t.reconnectPeriod=S,t.fastDisconnectDetection=!0,t.resubscribe=!1,t.baseReconnectTimeMs<=0)throw new Error(d.INVALID_RECONNECT_TIMING);if(M<O)throw new Error(d.INVALID_RECONNECT_TIMING);if(R<O)throw new Error(d.INVALID_RECONNECT_TIMING);if("newest"!==y&&"oldest"!==y)throw new Error(d.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(l<0)throw new Error(d.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(p(t.protocol)&&(t.protocol="mqtts"),p(t.host))throw new Error(d.INVALID_CONNECT_OPTIONS);if(p(t.servername)&&(t.servername=t.host.split(":")[0]),"mqtts"===t.protocol)p(t.port)&&(t.port=8883),h(t);else if("wss"===t.protocol||"wss-custom-auth"===t.protocol){if("wss"===t.protocol){if(I=p(t.accessKeyId)?r.env.AWS_ACCESS_KEY_ID:t.accessKeyId,k=p(t.secretKey)?r.env.AWS_SECRET_ACCESS_KEY:t.secretKey,x=p(t.sessionToken)?r.env.AWS_SESSION_TOKEN:t.sessionToken,p(I)||p(k)){var D,B=t.profile||r.env.AWS_PROFILE||"default";try{D=p(t.filename)?function _loadDefaultFilename(){var t=r.env.HOME||r.env.USERPROFILE||(r.env.HOMEPATH?(r.env.HOMEDRIVE||"C:/")+r.env.HOMEPATH:null);return m.join(t,".aws","credentials")}():t.filename;var N=getCredentials(g.readFileSync(D,"utf-8"))[B];I=N.aws_access_key_id,k=N.aws_secret_access_key,x=N.aws_session_token}catch(t){console.log(t),console.log("Failed to read credentials for AWS_PROFILE "+B+" from "+D)}}if(p(I)||p(k))throw console.log("To connect via WebSocket/SigV4, AWS Access Key ID and AWS Secret Key must be passed either in options or as environment variables; see README.md"),new Error(d.INVALID_CONNECT_OPTIONS)}else if(p(t.customAuthHeaders)&&p(t.customAuthQueryString))throw console.log("To authenticate with a custom authorizer, you must provide the required HTTP headers or queryString; see README.md"),new Error(d.INVALID_CONNECT_OPTIONS);if(!p(t.host)&&p(t.region)){var U=/[a-zA-Z0-9]+\.iot\.([^\.]+)\.amazonaws\..+/.exec(t.host);if(null===U)throw console.log("Host endpoint is not valid"),new Error(d.INVALID_CONNECT_OPTIONS);t.region=U[1]}p(t.port)&&(t.port=443),p(t.websocketOptions)?t.websocketOptions={protocol:"mqttv3.1"}:t.websocketOptions.protocol="mqttv3.1","wss-custom-auth"===t.protocol&&(t.websocketOptions.headers=t.customAuthHeaders)}p(t)||!0!==t.debug||(console.log(t),console.log("attempting new mqtt connection..."));var q={};function _addToSubscriptionCache(t,r){0===b.filter((function(r){return r.topic===t})).length&&b.push({topic:t,options:r})}function _deleteFromSubscriptionCache(t,r){var i=b.filter((function(r){return r.topic!==t}));b=i}function _updateSubscriptionCache(t,r,i){var o=null;!1!==_&&("subscribe"===t?o=_addToSubscriptionCache:"unsubscribe"===t&&(o=_deleteFromSubscriptionCache),"[object Array]"===Object.prototype.toString.call(r)?r.forEach((function(t,r,a){o(t,i)})):o(r,i))}function _filling(){return"inactive"===P}q.mqtts=i(816),q.wss=i(817);var W=new c.MqttClient((function _wrapper(r){var i,o=t.protocol;return"wss"===o?(i=""===I||""===k?"wss://no-credentials-available":prepareWebSocketUrl(t,I,k,x),!0===t.debug&&console.log("using websockets, will connect to '"+i+"'..."),t.url=i):"wss-custom-auth"===o&&(t.url=prepareWebSocketCustomAuthUrl(t),!0===t.debug&&console.log("using websockets custom auth, will connect to '"+t.url+"'..."),o="wss"),q[o](r,t)}),t);function _markConnectionStable(){S=O,W.options.reconnectPeriod=S,j=null,P="stable"}function _drainOperationQueue(){var t=w.shift();if(p(t)){var r=v.shift();if(p(r)){var i=a.shift();p(i)||W.publish(i.topic,i.message,i.options,i.callback),0===a.length&&(clearInterval(C),C=null)}else _updateSubscriptionCache(r.type,r.topics,r.options),"subscribe"===r.type?p(r.callback)?W.subscribe(r.topics,r.options):W.subscribe(r.topics,r.options,r.callback):"unsubscribe"===r.type&&W.unsubscribe(r.topics,r.callback)}else p(t.callback)?W.subscribe(t.topic,t.options):W.subscribe(t.topic,t.options,t.callback)}W.on("connect",(function(t){null===j&&(j=setTimeout(_markConnectionStable,R)),P="established",null===C&&(w=b.slice(0),C=setInterval(_drainOperationQueue,A)),o.emit("connect",t)})),W.on("close",(function(r){p(r)||o.emit("error",r),p(t)||!0!==t.debug||console.log("connection lost - will attempt reconnection in "+W.options.reconnectPeriod/1e3+" seconds..."),clearTimeout(j),j=null,clearInterval(C),C=null,P="inactive",o.emit("close")})),W.on("reconnect",(function(){S*=2,S=Math.min(M,S),W.options.reconnectPeriod=S,o.emit("reconnect")})),W.on("end",(function(){o.emit("end")})),W.on("offline",(function(){o.emit("offline")})),W.on("error",(function(t){o.emit("error",t)})),W.on("packetsend",(function(t){o.emit("packetsend",t)})),W.on("packetreceive",(function(t){o.emit("packetreceive",t)})),W.on("message",(function(t,r,i){o.emit("message",t,r,i)})),this.publish=function(t,r,i,o){!0!==u||!_filling()&&null===C?!0!==u&&_filling()||W.publish(t,r,i,o):function _trimOfflinePublishQueueIfNecessary(){var t=!0;return l>0&&a.length>=l&&("oldest"===y?a.shift():t=!1),t}()&&a.push({topic:t,message:r,options:i,callback:o})},this.subscribe=function(t,r,i){_filling()&&!1!==_?v.length<50?v.push({type:"subscribe",topics:t,options:r,callback:i}):o.emit("error",new Error("Maximum queued offline subscription reached")):(_updateSubscriptionCache("subscribe",t,r),p(i)?W.subscribe(t,r):W.subscribe(t,r,i))},this.unsubscribe=function(r,i){_filling()&&!1!==_?v.length<50&&v.push({type:"unsubscribe",topics:r,options:t,callback:i}):(_updateSubscriptionCache("unsubscribe",r),W.unsubscribe(r,i))},this.end=function(t,r){W.end(t,r)},this.handleMessage=W.handleMessage.bind(W),W.handleMessage=function(t,r){o.handleMessage(t,r)},this.updateWebSocketCredentials=function(t,r,i,o){I=t,k=r,x=i},this.getWebsocketHeaders=function(){return t.websocketOptions.headers},this.updateCustomAuthHeaders=function(r){t.websocketOptions.headers=r},this.simulateNetworkFailure=function(){W.stream.emit("error",new Error("simulated connection error")),W.stream.end()}}a(DeviceClient,o.EventEmitter),t.exports=DeviceClient,t.exports.DeviceClient=DeviceClient,t.exports.prepareWebSocketUrl=prepareWebSocketUrl,t.exports.prepareWebSocketCustomAuthUrl=prepareWebSocketCustomAuthUrl}).call(this,i(19))},function(t,r,i){(function(t){var o=Object.getOwnPropertyDescriptors||function getOwnPropertyDescriptors(t){for(var r=Object.keys(t),i={},o=0;o<r.length;o++)i[r[o]]=Object.getOwnPropertyDescriptor(t,r[o]);return i},a=/%[sdj%]/g;r.format=function(t){if(!isString(t)){for(var r=[],i=0;i<arguments.length;i++)r.push(inspect(arguments[i]));return r.join(" ")}i=1;for(var o=arguments,c=o.length,u=String(t).replace(a,(function(t){if("%%"===t)return"%";if(i>=c)return t;switch(t){case"%s":return String(o[i++]);case"%d":return Number(o[i++]);case"%j":try{return JSON.stringify(o[i++])}catch(t){return"[Circular]"}default:return t}})),l=o[i];i<c;l=o[++i])isNull(l)||!isObject(l)?u+=" "+l:u+=" "+inspect(l);return u},r.deprecate=function(i,o){if(void 0!==t&&!0===t.noDeprecation)return i;if(void 0===t)return function(){return r.deprecate(i,o).apply(this,arguments)};var a=!1;return function deprecated(){if(!a){if(t.throwDeprecation)throw new Error(o);t.traceDeprecation?console.trace(o):console.error(o),a=!0}return i.apply(this,arguments)}};var c,u={};function inspect(t,i){var o={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),isBoolean(i)?o.showHidden=i:i&&r._extend(o,i),isUndefined(o.showHidden)&&(o.showHidden=!1),isUndefined(o.depth)&&(o.depth=2),isUndefined(o.colors)&&(o.colors=!1),isUndefined(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=stylizeWithColor),formatValue(o,t,o.depth)}function stylizeWithColor(t,r){var i=inspect.styles[r];return i?"["+inspect.colors[i][0]+"m"+t+"["+inspect.colors[i][1]+"m":t}function stylizeNoColor(t,r){return t}function formatValue(t,i,o){if(t.customInspect&&i&&isFunction(i.inspect)&&i.inspect!==r.inspect&&(!i.constructor||i.constructor.prototype!==i)){var a=i.inspect(o,t);return isString(a)||(a=formatValue(t,a,o)),a}var c=function formatPrimitive(t,r){if(isUndefined(r))return t.stylize("undefined","undefined");if(isString(r)){var i="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(i,"string")}if(isNumber(r))return t.stylize(""+r,"number");if(isBoolean(r))return t.stylize(""+r,"boolean");if(isNull(r))return t.stylize("null","null")}(t,i);if(c)return c;var u=Object.keys(i),l=function arrayToHash(t){var r={};return t.forEach((function(t,i){r[t]=!0})),r}(u);if(t.showHidden&&(u=Object.getOwnPropertyNames(i)),isError(i)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return formatError(i);if(0===u.length){if(isFunction(i)){var d=i.name?": "+i.name:"";return t.stylize("[Function"+d+"]","special")}if(isRegExp(i))return t.stylize(RegExp.prototype.toString.call(i),"regexp");if(isDate(i))return t.stylize(Date.prototype.toString.call(i),"date");if(isError(i))return formatError(i)}var p,h="",m=!1,g=["{","}"];(isArray(i)&&(m=!0,g=["[","]"]),isFunction(i))&&(h=" [Function"+(i.name?": "+i.name:"")+"]");return isRegExp(i)&&(h=" "+RegExp.prototype.toString.call(i)),isDate(i)&&(h=" "+Date.prototype.toUTCString.call(i)),isError(i)&&(h=" "+formatError(i)),0!==u.length||m&&0!=i.length?o<0?isRegExp(i)?t.stylize(RegExp.prototype.toString.call(i),"regexp"):t.stylize("[Object]","special"):(t.seen.push(i),p=m?function formatArray(t,r,i,o,a){for(var c=[],u=0,l=r.length;u<l;++u)hasOwnProperty(r,String(u))?c.push(formatProperty(t,r,i,o,String(u),!0)):c.push("");return a.forEach((function(a){a.match(/^\d+$/)||c.push(formatProperty(t,r,i,o,a,!0))})),c}(t,i,o,l,u):u.map((function(r){return formatProperty(t,i,o,l,r,m)})),t.seen.pop(),function reduceToSingleString(t,r,i){if(t.reduce((function(t,r){return r.indexOf("\n")>=0&&0,t+r.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return i[0]+(""===r?"":r+"\n ")+" "+t.join(",\n ")+" "+i[1];return i[0]+r+" "+t.join(", ")+" "+i[1]}(p,h,g)):g[0]+h+g[1]}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatProperty(t,r,i,o,a,c){var u,l,d;if((d=Object.getOwnPropertyDescriptor(r,a)||{value:r[a]}).get?l=d.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):d.set&&(l=t.stylize("[Setter]","special")),hasOwnProperty(o,a)||(u="["+a+"]"),l||(t.seen.indexOf(d.value)<0?(l=isNull(i)?formatValue(t,d.value,null):formatValue(t,d.value,i-1)).indexOf("\n")>-1&&(l=c?l.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+l.split("\n").map((function(t){return" "+t})).join("\n")):l=t.stylize("[Circular]","special")),isUndefined(u)){if(c&&a.match(/^\d+$/))return l;(u=JSON.stringify(""+a)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+l}function isArray(t){return Array.isArray(t)}function isBoolean(t){return"boolean"==typeof t}function isNull(t){return null===t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function isUndefined(t){return void 0===t}function isRegExp(t){return isObject(t)&&"[object RegExp]"===objectToString(t)}function isObject(t){return"object"==typeof t&&null!==t}function isDate(t){return isObject(t)&&"[object Date]"===objectToString(t)}function isError(t){return isObject(t)&&("[object Error]"===objectToString(t)||t instanceof Error)}function isFunction(t){return"function"==typeof t}function objectToString(t){return Object.prototype.toString.call(t)}function pad(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(i){if(isUndefined(c)&&(c=t.env.NODE_DEBUG||""),i=i.toUpperCase(),!u[i])if(new RegExp("\\b"+i+"\\b","i").test(c)){var o=t.pid;u[i]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",i,o,t)}}else u[i]=function(){};return u[i]},r.inspect=inspect,inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=isArray,r.isBoolean=isBoolean,r.isNull=isNull,r.isNullOrUndefined=function isNullOrUndefined(t){return null==t},r.isNumber=isNumber,r.isString=isString,r.isSymbol=function isSymbol(t){return"symbol"==typeof t},r.isUndefined=isUndefined,r.isRegExp=isRegExp,r.isObject=isObject,r.isDate=isDate,r.isError=isError,r.isFunction=isFunction,r.isPrimitive=function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=i(780);var l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var t=new Date,r=[pad(t.getHours()),pad(t.getMinutes()),pad(t.getSeconds())].join(":");return[t.getDate(),l[t.getMonth()],r].join(" ")}function hasOwnProperty(t,r){return Object.prototype.hasOwnProperty.call(t,r)}r.log=function(){console.log("%s - %s",timestamp(),r.format.apply(r,arguments))},r.inherits=i(781),r._extend=function(t,r){if(!r||!isObject(r))return t;for(var i=Object.keys(r),o=i.length;o--;)t[i[o]]=r[i[o]];return t};var d="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function callbackifyOnRejected(t,r){if(!t){var i=new Error("Promise was rejected with a falsy value");i.reason=t,t=i}return r(t)}r.promisify=function promisify(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(d&&t[d]){var r;if("function"!=typeof(r=t[d]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,d,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var r,i,o=new Promise((function(t,o){r=t,i=o})),a=[],c=0;c<arguments.length;c++)a.push(arguments[c]);a.push((function(t,o){t?i(t):r(o)}));try{t.apply(this,a)}catch(t){i(t)}return o}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),d&&Object.defineProperty(r,d,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,o(t))},r.promisify.custom=d,r.callbackify=function callbackify(r){if("function"!=typeof r)throw new TypeError('The "original" argument must be of type Function');function callbackified(){for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);var a=i.pop();if("function"!=typeof a)throw new TypeError("The last argument must be of type Function");var c=this,cb=function(){return a.apply(c,arguments)};r.apply(this,i).then((function(r){t.nextTick(cb,null,r)}),(function(r){t.nextTick(callbackifyOnRejected,r,cb)}))}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(r)),Object.defineProperties(callbackified,o(r)),callbackified}}).call(this,i(19))},function(t,r){t.exports=function extend(){for(var t={},r=0;r<arguments.length;r++){var o=arguments[r];for(var a in o)i.call(o,a)&&(t[a]=o[a])}return t};var i=Object.prototype.hasOwnProperty},function(t,r,i){"use strict";var o=i(95).codes.ERR_STREAM_PREMATURE_CLOSE;function noop(){}t.exports=function eos(t,r,i){if("function"==typeof r)return eos(t,null,r);r||(r={}),i=function once(t){var r=!1;return function(){if(!r){r=!0;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];t.apply(this,o)}}}(i||noop);var a=r.readable||!1!==r.readable&&t.readable,c=r.writable||!1!==r.writable&&t.writable,u=function onlegacyfinish(){t.writable||d()},l=t._writableState&&t._writableState.finished,d=function onfinish(){c=!1,l=!0,a||i.call(t)},p=t._readableState&&t._readableState.endEmitted,h=function onend(){a=!1,p=!0,c||i.call(t)},m=function onerror(r){i.call(t,r)},g=function onclose(){var r;return a&&!p?(t._readableState&&t._readableState.ended||(r=new o),i.call(t,r)):c&&!l?(t._writableState&&t._writableState.ended||(r=new o),i.call(t,r)):void 0},y=function onrequest(){t.req.on("finish",d)};return!function isRequest(t){return t.setHeader&&"function"==typeof t.abort}(t)?c&&!t._writableState&&(t.on("end",u),t.on("close",u)):(t.on("complete",d),t.on("abort",g),t.req?y():t.on("request",y)),t.on("end",h),t.on("finish",d),!1!==r.error&&t.on("error",m),t.on("close",g),function(){t.removeListener("complete",d),t.removeListener("abort",g),t.removeListener("request",y),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",h),t.removeListener("error",m),t.removeListener("close",g)}}},function(t,r,i){"use strict";var o=i(804),a=i(75)("mqttjs:tls");t.exports=function buildBuilder(t,r){var i;function handleTLSerrors(o){r.rejectUnauthorized&&t.emit("error",o),i.end()}return r.port=r.port||8883,r.host=r.hostname||r.host||"localhost",r.servername=r.host,r.rejectUnauthorized=!1!==r.rejectUnauthorized,delete r.path,a("port %d host %s rejectUnauthorized %b",r.port,r.host,r.rejectUnauthorized),(i=o.connect(r)).on("secureConnect",(function(){r.rejectUnauthorized&&!i.authorized?i.emit("error",new Error("TLS not authorized")):i.removeListener("error",handleTLSerrors)})),i.on("error",handleTLSerrors),i}},function(t,r,i){(function(r,o){var a=i(74),c=i(334),u=i(30),l=i(335),d=r.from&&r.from!==Uint8Array.from?r.from([0]):new r([0]),onuncork=function(t,r){t._corked?t.once("uncork",r):r()},destroyer=function(t,r){return function(i){i?function(t,r){t._autoDestroy&&t.destroy(r)}(t,"premature close"===i.message?null:i):r&&!t._ended&&t.end()}},noop=function(){},Duplexify=function(t,r,i){if(!(this instanceof Duplexify))return new Duplexify(t,r,i);a.Duplex.call(this,i),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!i||!1!==i.autoDestroy,this._forwardDestroy=!i||!1!==i.destroy,this._forwardEnd=!i||!1!==i.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),r&&this.setReadable(r)};u(Duplexify,a.Duplex),Duplexify.obj=function(t,r,i){return i||(i={}),i.objectMode=!0,i.highWaterMark=16,new Duplexify(t,r,i)},Duplexify.prototype.cork=function(){1==++this._corked&&this.emit("cork")},Duplexify.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},Duplexify.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var r=this,i=c(t,{writable:!0,readable:!1},destroyer(this,this._forwardEnd)),ondrain=function(){var t=r._ondrain;r._ondrain=null,t&&t()};this._unwrite&&o.nextTick(ondrain),this._writable=t,this._writable.on("drain",ondrain),this._unwrite=function(){r._writable.removeListener("drain",ondrain),i()},this.uncork()}else this.end()},Duplexify.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var r,i=this,o=c(t,{writable:!1,readable:!0},destroyer(this)),onreadable=function(){i._forward()},onend=function(){i.push(null)};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:(r=t,new a.Readable({objectMode:!0,highWaterMark:16}).wrap(r)),this._readable2.on("readable",onreadable),this._readable2.on("end",onend),this._unread=function(){i._readable2.removeListener("readable",onreadable),i._readable2.removeListener("end",onend),o()},this._forward()}},Duplexify.prototype._read=function(){this._drained=!0,this._forward()},Duplexify.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=l(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},Duplexify.prototype.destroy=function(t,r){if(r||(r=noop),this.destroyed)return r(null);this.destroyed=!0;var i=this;o.nextTick((function(){i._destroy(t),r(null)}))},Duplexify.prototype._destroy=function(t){if(t){var r=this._ondrain;this._ondrain=null,r?r(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},Duplexify.prototype._write=function(t,r,i){if(!this.destroyed)return this._corked?onuncork(this,this._write.bind(this,t,r,i)):t===d?this._finish(i):this._writable?void(!1===this._writable.write(t)?this._ondrain=i:this.destroyed||i()):i()},Duplexify.prototype._finish=function(t){var r=this;this.emit("preend"),onuncork(this,(function(){var i,o;i=r._forwardEnd&&r._writable,o=function(){!1===r._writableState.prefinished&&(r._writableState.prefinished=!0),r.emit("prefinish"),onuncork(r,t)},i?i._writableState&&i._writableState.finished?o():i._writableState?i.end(o):(i.end(),o()):o()}))},Duplexify.prototype.end=function(t,r,i){return"function"==typeof t?this.end(null,null,t):"function"==typeof r?this.end(t,null,r):(this._ended=!0,t&&this.write(t),this._writableState.ending||this._writableState.destroyed||this.write(d),a.Writable.prototype.end.call(this,i))},t.exports=Duplexify}).call(this,i(16).Buffer,i(19))},function(t,r,i){(function(r){var o;t.exports=(o=o||function(t,o){var a;if("undefined"!=typeof window&&window.crypto&&(a=window.crypto),"undefined"!=typeof self&&self.crypto&&(a=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(a=globalThis.crypto),!a&&"undefined"!=typeof window&&window.msCrypto&&(a=window.msCrypto),!a&&void 0!==r&&r.crypto&&(a=r.crypto),!a)try{a=i(809)}catch(t){}var cryptoSecureRandomInt=function(){if(a){if("function"==typeof a.getRandomValues)try{return a.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof a.randomBytes)try{return a.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function F(){}return function(t){var r;return F.prototype=t,r=new F,F.prototype=null,r}}(),u={},l=u.lib={},d=l.Base={extend:function(t){var r=c(this);return t&&r.mixIn(t),r.hasOwnProperty("init")&&this.init!==r.init||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},p=l.WordArray=d.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=null!=r?r:4*t.length},toString:function(t){return(t||m).stringify(this)},concat:function(t){var r=this.words,i=t.words,o=this.sigBytes,a=t.sigBytes;if(this.clamp(),o%4)for(var c=0;c<a;c++){var u=i[c>>>2]>>>24-c%4*8&255;r[o+c>>>2]|=u<<24-(o+c)%4*8}else for(var l=0;l<a;l+=4)r[o+l>>>2]=i[l>>>2];return this.sigBytes+=a,this},clamp:function(){var r=this.words,i=this.sigBytes;r[i>>>2]&=4294967295<<32-i%4*8,r.length=t.ceil(i/4)},clone:function(){var t=d.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var r=[],i=0;i<t;i+=4)r.push(cryptoSecureRandomInt());return new p.init(r,t)}}),h=u.enc={},m=h.Hex={stringify:function(t){for(var r=t.words,i=t.sigBytes,o=[],a=0;a<i;a++){var c=r[a>>>2]>>>24-a%4*8&255;o.push((c>>>4).toString(16)),o.push((15&c).toString(16))}return o.join("")},parse:function(t){for(var r=t.length,i=[],o=0;o<r;o+=2)i[o>>>3]|=parseInt(t.substr(o,2),16)<<24-o%8*4;return new p.init(i,r/2)}},g=h.Latin1={stringify:function(t){for(var r=t.words,i=t.sigBytes,o=[],a=0;a<i;a++){var c=r[a>>>2]>>>24-a%4*8&255;o.push(String.fromCharCode(c))}return o.join("")},parse:function(t){for(var r=t.length,i=[],o=0;o<r;o++)i[o>>>2]|=(255&t.charCodeAt(o))<<24-o%4*8;return new p.init(i,r)}},y=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(g.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return g.parse(unescape(encodeURIComponent(t)))}},v=l.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new p.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=y.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(r){var i,o=this._data,a=o.words,c=o.sigBytes,u=this.blockSize,l=c/(4*u),d=(l=r?t.ceil(l):t.max((0|l)-this._minBufferSize,0))*u,h=t.min(4*d,c);if(d){for(var m=0;m<d;m+=u)this._doProcessBlock(a,m);i=a.splice(0,d),o.sigBytes-=h}return new p.init(i,h)},clone:function(){var t=d.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),b=(l.Hasher=v.extend({cfg:d.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(r,i){return new t.init(i).finalize(r)}},_createHmacHelper:function(t){return function(r,i){return new b.HMAC.init(t,i).finalize(r)}}}),u.algo={});return u}(Math),o)}).call(this,i(17))},function(t,r){},function(t,r,i){var o=i(133),a=i(241);t.exports=function _defineProperty(t,r,i){return(r=a(r))in t?o(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){t.exports=i(577)},function(t,r,i){t.exports=i(686)},function(t,r,i){"use strict";var o={};i.r(o),i.d(o,"JsonPatchError",(function(){return wt})),i.d(o,"deepClone",(function(){return St})),i.d(o,"getValueByPointer",(function(){return getValueByPointer})),i.d(o,"applyOperation",(function(){return applyOperation})),i.d(o,"applyPatch",(function(){return applyPatch})),i.d(o,"applyReducer",(function(){return applyReducer})),i.d(o,"validator",(function(){return validator})),i.d(o,"validate",(function(){return validate})),i.d(o,"_areEquals",(function(){return _areEquals}));var a={};i.r(a),i.d(a,"unobserve",(function(){return unobserve})),i.d(a,"observe",(function(){return observe})),i.d(a,"generate",(function(){return generate})),i.d(a,"compare",(function(){return compare}));var c={};i.r(c),i.d(c,"path",(function(){return parameter_builders_path})),i.d(c,"query",(function(){return parameter_builders_query})),i.d(c,"header",(function(){return parameter_builders_header})),i.d(c,"cookie",(function(){return parameter_builders_cookie}));var u=i(4),l=i.n(u),d=i(22),p=i.n(d),h=i(119),m=i.n(h),g=i(34),y=i.n(g),v=i(46),b=i.n(v),_=i(7),w=i.n(_),S=i(27),I=i.n(S),k=i(98),x=i.n(k),P=i(31),C=i.n(P),A=i(52),O=i.n(A),R=i(217),M=i.n(R),j=i(155),L=i.n(j),D=i(76),B=i.n(D),N=i(5),U=i.n(N),q=i(2),W=i.n(q),z=i(0),V=i.n(z),H=i(156),$=i.n(H),K=i(26),G=i.n(K),J=(i(279),i(120)),Y=i.n(J);function isNothing(t){return null==t}var Q={isNothing:isNothing,isObject:function isObject(t){return"object"==typeof t&&null!==t},toArray:function toArray(t){return Array.isArray(t)?t:isNothing(t)?[]:[t]},repeat:function repeat(t,r){var i,o="";for(i=0;i<r;i+=1)o+=t;return o},isNegativeZero:function isNegativeZero(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t},extend:function extend(t,r){var i,o,a,c;if(r)for(i=0,o=(c=Object.keys(r)).length;i<o;i+=1)t[a=c[i]]=r[a];return t}};function formatError(t,r){var i="",o=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(i+='in "'+t.mark.name+'" '),i+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!r&&t.mark.snippet&&(i+="\n\n"+t.mark.snippet),o+" "+i):o}function YAMLException$1(t,r){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=r,this.message=formatError(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}YAMLException$1.prototype=Object.create(Error.prototype),YAMLException$1.prototype.constructor=YAMLException$1,YAMLException$1.prototype.toString=function toString(t){return this.name+": "+formatError(this,t)};var X=YAMLException$1;function getLine(t,r,i,o,a){var c="",u="",l=Math.floor(a/2)-1;return o-r>l&&(r=o-l+(c=" ... ").length),i-o>l&&(i=o+l-(u=" ...").length),{str:c+t.slice(r,i).replace(/\t/g,"→")+u,pos:o-r+c.length}}function padStart(t,r){return Q.repeat(" ",r-t.length)+t}var Z=function makeSnippet(t,r){if(r=Object.create(r||null),!t.buffer)return null;r.maxLength||(r.maxLength=79),"number"!=typeof r.indent&&(r.indent=1),"number"!=typeof r.linesBefore&&(r.linesBefore=3),"number"!=typeof r.linesAfter&&(r.linesAfter=2);for(var i,o=/\r?\n|\r|\0/g,a=[0],c=[],u=-1;i=o.exec(t.buffer);)c.push(i.index),a.push(i.index+i[0].length),t.position<=i.index&&u<0&&(u=a.length-2);u<0&&(u=a.length-1);var l,d,p="",h=Math.min(t.line+r.linesAfter,c.length).toString().length,m=r.maxLength-(r.indent+h+3);for(l=1;l<=r.linesBefore&&!(u-l<0);l++)d=getLine(t.buffer,a[u-l],c[u-l],t.position-(a[u]-a[u-l]),m),p=Q.repeat(" ",r.indent)+padStart((t.line-l+1).toString(),h)+" | "+d.str+"\n"+p;for(d=getLine(t.buffer,a[u],c[u],t.position,m),p+=Q.repeat(" ",r.indent)+padStart((t.line+1).toString(),h)+" | "+d.str+"\n",p+=Q.repeat("-",r.indent+h+3+d.pos)+"^\n",l=1;l<=r.linesAfter&&!(u+l>=c.length);l++)d=getLine(t.buffer,a[u+l],c[u+l],t.position-(a[u]-a[u+l]),m),p+=Q.repeat(" ",r.indent)+padStart((t.line+l+1).toString(),h)+" | "+d.str+"\n";return p.replace(/\n$/,"")},ee=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],te=["scalar","sequence","mapping"];var re=function Type$1(t,r){if(r=r||{},Object.keys(r).forEach((function(r){if(-1===ee.indexOf(r))throw new X('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')})),this.options=r,this.tag=t,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(t){return t},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=function compileStyleAliases(t){var r={};return null!==t&&Object.keys(t).forEach((function(i){t[i].forEach((function(t){r[String(t)]=i}))})),r}(r.styleAliases||null),-1===te.indexOf(this.kind))throw new X('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function compileList(t,r){var i=[];return t[r].forEach((function(t){var r=i.length;i.forEach((function(i,o){i.tag===t.tag&&i.kind===t.kind&&i.multi===t.multi&&(r=o)})),i[r]=t})),i}function Schema$1(t){return this.extend(t)}Schema$1.prototype.extend=function extend(t){var r=[],i=[];if(t instanceof re)i.push(t);else if(Array.isArray(t))i=i.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new X("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit))}r.forEach((function(t){if(!(t instanceof re))throw new X("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new X("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new X("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),i.forEach((function(t){if(!(t instanceof re))throw new X("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var o=Object.create(Schema$1.prototype);return o.implicit=(this.implicit||[]).concat(r),o.explicit=(this.explicit||[]).concat(i),o.compiledImplicit=compileList(o,"implicit"),o.compiledExplicit=compileList(o,"explicit"),o.compiledTypeMap=function compileMap(){var t,r,i={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function collectType(t){t.multi?(i.multi[t.kind].push(t),i.multi.fallback.push(t)):i[t.kind][t.tag]=i.fallback[t.tag]=t}for(t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(collectType);return i}(o.compiledImplicit,o.compiledExplicit),o};var ne=Schema$1,ie=new re("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}}),oe=new re("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}}),se=new re("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}}),ae=new ne({explicit:[ie,oe,se]});var ce=new re("tag:yaml.org,2002:null",{kind:"scalar",resolve:function resolveYamlNull(t){if(null===t)return!0;var r=t.length;return 1===r&&"~"===t||4===r&&("null"===t||"Null"===t||"NULL"===t)},construct:function constructYamlNull(){return null},predicate:function isNull(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var ue=new re("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function resolveYamlBoolean(t){if(null===t)return!1;var r=t.length;return 4===r&&("true"===t||"True"===t||"TRUE"===t)||5===r&&("false"===t||"False"===t||"FALSE"===t)},construct:function constructYamlBoolean(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function isBoolean(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function isOctCode(t){return 48<=t&&t<=55}function isDecCode(t){return 48<=t&&t<=57}var le=new re("tag:yaml.org,2002:int",{kind:"scalar",resolve:function resolveYamlInteger(t){if(null===t)return!1;var r,i,o=t.length,a=0,c=!1;if(!o)return!1;if("-"!==(r=t[a])&&"+"!==r||(r=t[++a]),"0"===r){if(a+1===o)return!0;if("b"===(r=t[++a])){for(a++;a<o;a++)if("_"!==(r=t[a])){if("0"!==r&&"1"!==r)return!1;c=!0}return c&&"_"!==r}if("x"===r){for(a++;a<o;a++)if("_"!==(r=t[a])){if(!(48<=(i=t.charCodeAt(a))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;c=!0}return c&&"_"!==r}if("o"===r){for(a++;a<o;a++)if("_"!==(r=t[a])){if(!isOctCode(t.charCodeAt(a)))return!1;c=!0}return c&&"_"!==r}}if("_"===r)return!1;for(;a<o;a++)if("_"!==(r=t[a])){if(!isDecCode(t.charCodeAt(a)))return!1;c=!0}return!(!c||"_"===r)},construct:function constructYamlInteger(t){var r,i=t,o=1;if(-1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),"-"!==(r=i[0])&&"+"!==r||("-"===r&&(o=-1),r=(i=i.slice(1))[0]),"0"===i)return 0;if("0"===r){if("b"===i[1])return o*parseInt(i.slice(2),2);if("x"===i[1])return o*parseInt(i.slice(2),16);if("o"===i[1])return o*parseInt(i.slice(2),8)}return o*parseInt(i,10)},predicate:function isInteger(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!Q.isNegativeZero(t)},represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),fe=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var de=/^[-+]?[0-9]+e/;var pe=new re("tag:yaml.org,2002:float",{kind:"scalar",resolve:function resolveYamlFloat(t){return null!==t&&!(!fe.test(t)||"_"===t[t.length-1])},construct:function constructYamlFloat(t){var r,i;return i="-"===(r=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(r[0])>=0&&(r=r.slice(1)),".inf"===r?1===i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===r?NaN:i*parseFloat(r,10)},predicate:function isFloat(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||Q.isNegativeZero(t))},represent:function representYamlFloat(t,r){var i;if(isNaN(t))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Q.isNegativeZero(t))return"-0.0";return i=t.toString(10),de.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"}),he=ae.extend({implicit:[ce,ue,le,pe]}),me=he,ge=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ye=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var ve=new re("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function resolveYamlTimestamp(t){return null!==t&&(null!==ge.exec(t)||null!==ye.exec(t))},construct:function constructYamlTimestamp(t){var r,i,o,a,c,u,l,d,p=0,h=null;if(null===(r=ge.exec(t))&&(r=ye.exec(t)),null===r)throw new Error("Date resolve error");if(i=+r[1],o=+r[2]-1,a=+r[3],!r[4])return new Date(Date.UTC(i,o,a));if(c=+r[4],u=+r[5],l=+r[6],r[7]){for(p=r[7].slice(0,3);p.length<3;)p+="0";p=+p}return r[9]&&(h=6e4*(60*+r[10]+ +(r[11]||0)),"-"===r[9]&&(h=-h)),d=new Date(Date.UTC(i,o,a,c,u,l,p)),h&&d.setTime(d.getTime()-h),d},instanceOf:Date,represent:function representYamlTimestamp(t){return t.toISOString()}});var be=new re("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function resolveYamlMerge(t){return"<<"===t||null===t}}),_e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var we=new re("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function resolveYamlBinary(t){if(null===t)return!1;var r,i,o=0,a=t.length,c=_e;for(i=0;i<a;i++)if(!((r=c.indexOf(t.charAt(i)))>64)){if(r<0)return!1;o+=6}return o%8==0},construct:function constructYamlBinary(t){var r,i,o=t.replace(/[\r\n=]/g,""),a=o.length,c=_e,u=0,l=[];for(r=0;r<a;r++)r%4==0&&r&&(l.push(u>>16&255),l.push(u>>8&255),l.push(255&u)),u=u<<6|c.indexOf(o.charAt(r));return 0===(i=a%4*6)?(l.push(u>>16&255),l.push(u>>8&255),l.push(255&u)):18===i?(l.push(u>>10&255),l.push(u>>2&255)):12===i&&l.push(u>>4&255),new Uint8Array(l)},predicate:function isBinary(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function representYamlBinary(t){var r,i,o="",a=0,c=t.length,u=_e;for(r=0;r<c;r++)r%3==0&&r&&(o+=u[a>>18&63],o+=u[a>>12&63],o+=u[a>>6&63],o+=u[63&a]),a=(a<<8)+t[r];return 0===(i=c%3)?(o+=u[a>>18&63],o+=u[a>>12&63],o+=u[a>>6&63],o+=u[63&a]):2===i?(o+=u[a>>10&63],o+=u[a>>4&63],o+=u[a<<2&63],o+=u[64]):1===i&&(o+=u[a>>2&63],o+=u[a<<4&63],o+=u[64],o+=u[64]),o}}),Se=Object.prototype.hasOwnProperty,Te=Object.prototype.toString;var Ie=new re("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function resolveYamlOmap(t){if(null===t)return!0;var r,i,o,a,c,u=[],l=t;for(r=0,i=l.length;r<i;r+=1){if(o=l[r],c=!1,"[object Object]"!==Te.call(o))return!1;for(a in o)if(Se.call(o,a)){if(c)return!1;c=!0}if(!c)return!1;if(-1!==u.indexOf(a))return!1;u.push(a)}return!0},construct:function constructYamlOmap(t){return null!==t?t:[]}}),ke=Object.prototype.toString;var Ee=new re("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function resolveYamlPairs(t){if(null===t)return!0;var r,i,o,a,c,u=t;for(c=new Array(u.length),r=0,i=u.length;r<i;r+=1){if(o=u[r],"[object Object]"!==ke.call(o))return!1;if(1!==(a=Object.keys(o)).length)return!1;c[r]=[a[0],o[a[0]]]}return!0},construct:function constructYamlPairs(t){if(null===t)return[];var r,i,o,a,c,u=t;for(c=new Array(u.length),r=0,i=u.length;r<i;r+=1)o=u[r],a=Object.keys(o),c[r]=[a[0],o[a[0]]];return c}}),xe=Object.prototype.hasOwnProperty;var Pe=new re("tag:yaml.org,2002:set",{kind:"mapping",resolve:function resolveYamlSet(t){if(null===t)return!0;var r,i=t;for(r in i)if(xe.call(i,r)&&null!==i[r])return!1;return!0},construct:function constructYamlSet(t){return null!==t?t:{}}}),Ce=me.extend({implicit:[ve,be],explicit:[we,Ie,Ee,Pe]}),Ae=Object.prototype.hasOwnProperty,Oe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Re=/[\x85\u2028\u2029]/,Me=/[,\[\]\{\}]/,je=/^(?:!|!!|![a-z\-]+!)$/i,Le=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _class(t){return Object.prototype.toString.call(t)}function is_EOL(t){return 10===t||13===t}function is_WHITE_SPACE(t){return 9===t||32===t}function is_WS_OR_EOL(t){return 9===t||32===t||10===t||13===t}function is_FLOW_INDICATOR(t){return 44===t||91===t||93===t||123===t||125===t}function fromHexCode(t){var r;return 48<=t&&t<=57?t-48:97<=(r=32|t)&&r<=102?r-97+10:-1}function simpleEscapeSequence(t){return 48===t?"\0":97===t?"":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"
":95===t?" ":76===t?"\u2028":80===t?"\u2029":""}function charFromCodepoint(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var De=new Array(256),Be=new Array(256),Ne=0;Ne<256;Ne++)De[Ne]=simpleEscapeSequence(Ne)?1:0,Be[Ne]=simpleEscapeSequence(Ne);function State$1(t,r){this.input=t,this.filename=r.filename||null,this.schema=r.schema||Ce,this.onWarning=r.onWarning||null,this.legacy=r.legacy||!1,this.json=r.json||!1,this.listener=r.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function generateError(t,r){var i={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return i.snippet=Z(i),new X(r,i)}function throwError(t,r){throw generateError(t,r)}function throwWarning(t,r){t.onWarning&&t.onWarning.call(null,generateError(t,r))}var Fe={YAML:function handleYamlDirective(t,r,i){var o,a,c;null!==t.version&&throwError(t,"duplication of %YAML directive"),1!==i.length&&throwError(t,"YAML directive accepts exactly one argument"),null===(o=/^([0-9]+)\.([0-9]+)$/.exec(i[0]))&&throwError(t,"ill-formed argument of the YAML directive"),a=parseInt(o[1],10),c=parseInt(o[2],10),1!==a&&throwError(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=c<2,1!==c&&2!==c&&throwWarning(t,"unsupported YAML version of the document")},TAG:function handleTagDirective(t,r,i){var o,a;2!==i.length&&throwError(t,"TAG directive accepts exactly two arguments"),o=i[0],a=i[1],je.test(o)||throwError(t,"ill-formed tag handle (first argument) of the TAG directive"),Ae.call(t.tagMap,o)&&throwError(t,'there is a previously declared suffix for "'+o+'" tag handle'),Le.test(a)||throwError(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch(r){throwError(t,"tag prefix is malformed: "+a)}t.tagMap[o]=a}};function captureSegment(t,r,i,o){var a,c,u,l;if(r<i){if(l=t.input.slice(r,i),o)for(a=0,c=l.length;a<c;a+=1)9===(u=l.charCodeAt(a))||32<=u&&u<=1114111||throwError(t,"expected valid JSON character");else Oe.test(l)&&throwError(t,"the stream contains non-printable characters");t.result+=l}}function mergeMappings(t,r,i,o){var a,c,u,l;for(Q.isObject(i)||throwError(t,"cannot merge mappings; the provided source object is unacceptable"),u=0,l=(a=Object.keys(i)).length;u<l;u+=1)c=a[u],Ae.call(r,c)||(r[c]=i[c],o[c]=!0)}function storeMappingPair(t,r,i,o,a,c,u,l,d){var p,h;if(Array.isArray(a))for(p=0,h=(a=Array.prototype.slice.call(a)).length;p<h;p+=1)Array.isArray(a[p])&&throwError(t,"nested arrays are not supported inside keys"),"object"==typeof a&&"[object Object]"===_class(a[p])&&(a[p]="[object Object]");if("object"==typeof a&&"[object Object]"===_class(a)&&(a="[object Object]"),a=String(a),null===r&&(r={}),"tag:yaml.org,2002:merge"===o)if(Array.isArray(c))for(p=0,h=c.length;p<h;p+=1)mergeMappings(t,r,c[p],i);else mergeMappings(t,r,c,i);else t.json||Ae.call(i,a)||!Ae.call(r,a)||(t.line=u||t.line,t.lineStart=l||t.lineStart,t.position=d||t.position,throwError(t,"duplicated mapping key")),"__proto__"===a?Object.defineProperty(r,a,{configurable:!0,enumerable:!0,writable:!0,value:c}):r[a]=c,delete i[a];return r}function readLineBreak(t){var r;10===(r=t.input.charCodeAt(t.position))?t.position++:13===r?(t.position++,10===t.input.charCodeAt(t.position)&&t.position++):throwError(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function skipSeparationSpace(t,r,i){for(var o=0,a=t.input.charCodeAt(t.position);0!==a;){for(;is_WHITE_SPACE(a);)9===a&&-1===t.firstTabInLine&&(t.firstTabInLine=t.position),a=t.input.charCodeAt(++t.position);if(r&&35===a)do{a=t.input.charCodeAt(++t.position)}while(10!==a&&13!==a&&0!==a);if(!is_EOL(a))break;for(readLineBreak(t),a=t.input.charCodeAt(t.position),o++,t.lineIndent=0;32===a;)t.lineIndent++,a=t.input.charCodeAt(++t.position)}return-1!==i&&0!==o&&t.lineIndent<i&&throwWarning(t,"deficient indentation"),o}function testDocumentSeparator(t){var r,i=t.position;return!(45!==(r=t.input.charCodeAt(i))&&46!==r||r!==t.input.charCodeAt(i+1)||r!==t.input.charCodeAt(i+2)||(i+=3,0!==(r=t.input.charCodeAt(i))&&!is_WS_OR_EOL(r)))}function writeFoldedLines(t,r){1===r?t.result+=" ":r>1&&(t.result+=Q.repeat("\n",r-1))}function readBlockSequence(t,r){var i,o,a=t.tag,c=t.anchor,u=[],l=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=u),o=t.input.charCodeAt(t.position);0!==o&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,throwError(t,"tab characters must not be used in indentation")),45===o)&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1));)if(l=!0,t.position++,skipSeparationSpace(t,!0,-1)&&t.lineIndent<=r)u.push(null),o=t.input.charCodeAt(t.position);else if(i=t.line,composeNode(t,r,3,!1,!0),u.push(t.result),skipSeparationSpace(t,!0,-1),o=t.input.charCodeAt(t.position),(t.line===i||t.lineIndent>r)&&0!==o)throwError(t,"bad indentation of a sequence entry");else if(t.lineIndent<r)break;return!!l&&(t.tag=a,t.anchor=c,t.kind="sequence",t.result=u,!0)}function readTagProperty(t){var r,i,o,a,c=!1,u=!1;if(33!==(a=t.input.charCodeAt(t.position)))return!1;if(null!==t.tag&&throwError(t,"duplication of a tag property"),60===(a=t.input.charCodeAt(++t.position))?(c=!0,a=t.input.charCodeAt(++t.position)):33===a?(u=!0,i="!!",a=t.input.charCodeAt(++t.position)):i="!",r=t.position,c){do{a=t.input.charCodeAt(++t.position)}while(0!==a&&62!==a);t.position<t.length?(o=t.input.slice(r,t.position),a=t.input.charCodeAt(++t.position)):throwError(t,"unexpected end of the stream within a verbatim tag")}else{for(;0!==a&&!is_WS_OR_EOL(a);)33===a&&(u?throwError(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(r-1,t.position+1),je.test(i)||throwError(t,"named tag handle cannot contain such characters"),u=!0,r=t.position+1)),a=t.input.charCodeAt(++t.position);o=t.input.slice(r,t.position),Me.test(o)&&throwError(t,"tag suffix cannot contain flow indicator characters")}o&&!Le.test(o)&&throwError(t,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch(r){throwError(t,"tag name is malformed: "+o)}return c?t.tag=o:Ae.call(t.tagMap,i)?t.tag=t.tagMap[i]+o:"!"===i?t.tag="!"+o:"!!"===i?t.tag="tag:yaml.org,2002:"+o:throwError(t,'undeclared tag handle "'+i+'"'),!0}function readAnchorProperty(t){var r,i;if(38!==(i=t.input.charCodeAt(t.position)))return!1;for(null!==t.anchor&&throwError(t,"duplication of an anchor property"),i=t.input.charCodeAt(++t.position),r=t.position;0!==i&&!is_WS_OR_EOL(i)&&!is_FLOW_INDICATOR(i);)i=t.input.charCodeAt(++t.position);return t.position===r&&throwError(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(r,t.position),!0}function composeNode(t,r,i,o,a){var c,u,l,d,p,h,m,g,y,v=1,b=!1,_=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,c=u=l=4===i||3===i,o&&skipSeparationSpace(t,!0,-1)&&(b=!0,t.lineIndent>r?v=1:t.lineIndent===r?v=0:t.lineIndent<r&&(v=-1)),1===v)for(;readTagProperty(t)||readAnchorProperty(t);)skipSeparationSpace(t,!0,-1)?(b=!0,l=c,t.lineIndent>r?v=1:t.lineIndent===r?v=0:t.lineIndent<r&&(v=-1)):l=!1;if(l&&(l=b||a),1!==v&&4!==i||(g=1===i||2===i?r:r+1,y=t.position-t.lineStart,1===v?l&&(readBlockSequence(t,y)||function readBlockMapping(t,r,i){var o,a,c,u,l,d,p,h=t.tag,m=t.anchor,g={},y=Object.create(null),v=null,b=null,_=null,w=!1,S=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=g),p=t.input.charCodeAt(t.position);0!==p;){if(w||-1===t.firstTabInLine||(t.position=t.firstTabInLine,throwError(t,"tab characters must not be used in indentation")),o=t.input.charCodeAt(t.position+1),c=t.line,63!==p&&58!==p||!is_WS_OR_EOL(o)){if(u=t.line,l=t.lineStart,d=t.position,!composeNode(t,i,2,!1,!0))break;if(t.line===c){for(p=t.input.charCodeAt(t.position);is_WHITE_SPACE(p);)p=t.input.charCodeAt(++t.position);if(58===p)is_WS_OR_EOL(p=t.input.charCodeAt(++t.position))||throwError(t,"a whitespace character is expected after the key-value separator within a block mapping"),w&&(storeMappingPair(t,g,y,v,b,null,u,l,d),v=b=_=null),S=!0,w=!1,a=!1,v=t.tag,b=t.result;else{if(!S)return t.tag=h,t.anchor=m,!0;throwError(t,"can not read an implicit mapping pair; a colon is missed")}}else{if(!S)return t.tag=h,t.anchor=m,!0;throwError(t,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===p?(w&&(storeMappingPair(t,g,y,v,b,null,u,l,d),v=b=_=null),S=!0,w=!0,a=!0):w?(w=!1,a=!0):throwError(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,p=o;if((t.line===c||t.lineIndent>r)&&(w&&(u=t.line,l=t.lineStart,d=t.position),composeNode(t,r,4,!0,a)&&(w?b=t.result:_=t.result),w||(storeMappingPair(t,g,y,v,b,_,u,l,d),v=b=_=null),skipSeparationSpace(t,!0,-1),p=t.input.charCodeAt(t.position)),(t.line===c||t.lineIndent>r)&&0!==p)throwError(t,"bad indentation of a mapping entry");else if(t.lineIndent<r)break}return w&&storeMappingPair(t,g,y,v,b,null,u,l,d),S&&(t.tag=h,t.anchor=m,t.kind="mapping",t.result=g),S}(t,y,g))||function readFlowCollection(t,r){var i,o,a,c,u,l,d,p,h,m,g,y,v=!0,b=t.tag,_=t.anchor,w=Object.create(null);if(91===(y=t.input.charCodeAt(t.position)))u=93,p=!1,c=[];else{if(123!==y)return!1;u=125,p=!0,c={}}for(null!==t.anchor&&(t.anchorMap[t.anchor]=c),y=t.input.charCodeAt(++t.position);0!==y;){if(skipSeparationSpace(t,!0,r),(y=t.input.charCodeAt(t.position))===u)return t.position++,t.tag=b,t.anchor=_,t.kind=p?"mapping":"sequence",t.result=c,!0;v?44===y&&throwError(t,"expected the node content, but found ','"):throwError(t,"missed comma between flow collection entries"),g=null,l=d=!1,63===y&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1))&&(l=d=!0,t.position++,skipSeparationSpace(t,!0,r)),i=t.line,o=t.lineStart,a=t.position,composeNode(t,r,1,!1,!0),m=t.tag,h=t.result,skipSeparationSpace(t,!0,r),y=t.input.charCodeAt(t.position),!d&&t.line!==i||58!==y||(l=!0,y=t.input.charCodeAt(++t.position),skipSeparationSpace(t,!0,r),composeNode(t,r,1,!1,!0),g=t.result),p?storeMappingPair(t,c,w,m,h,g,i,o,a):l?c.push(storeMappingPair(t,null,w,m,h,g,i,o,a)):c.push(h),skipSeparationSpace(t,!0,r),44===(y=t.input.charCodeAt(t.position))?(v=!0,y=t.input.charCodeAt(++t.position)):v=!1}throwError(t,"unexpected end of the stream within a flow collection")}(t,g)?_=!0:(u&&function readBlockScalar(t,r){var i,o,a,c,u,l=1,d=!1,p=!1,h=r,m=0,g=!1;if(124===(c=t.input.charCodeAt(t.position)))o=!1;else{if(62!==c)return!1;o=!0}for(t.kind="scalar",t.result="";0!==c;)if(43===(c=t.input.charCodeAt(++t.position))||45===c)1===l?l=43===c?3:2:throwError(t,"repeat of a chomping mode identifier");else{if(!((a=48<=(u=c)&&u<=57?u-48:-1)>=0))break;0===a?throwError(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):p?throwError(t,"repeat of an indentation width identifier"):(h=r+a-1,p=!0)}if(is_WHITE_SPACE(c)){do{c=t.input.charCodeAt(++t.position)}while(is_WHITE_SPACE(c));if(35===c)do{c=t.input.charCodeAt(++t.position)}while(!is_EOL(c)&&0!==c)}for(;0!==c;){for(readLineBreak(t),t.lineIndent=0,c=t.input.charCodeAt(t.position);(!p||t.lineIndent<h)&&32===c;)t.lineIndent++,c=t.input.charCodeAt(++t.position);if(!p&&t.lineIndent>h&&(h=t.lineIndent),is_EOL(c))m++;else{if(t.lineIndent<h){3===l?t.result+=Q.repeat("\n",d?1+m:m):1===l&&d&&(t.result+="\n");break}for(o?is_WHITE_SPACE(c)?(g=!0,t.result+=Q.repeat("\n",d?1+m:m)):g?(g=!1,t.result+=Q.repeat("\n",m+1)):0===m?d&&(t.result+=" "):t.result+=Q.repeat("\n",m):t.result+=Q.repeat("\n",d?1+m:m),d=!0,p=!0,m=0,i=t.position;!is_EOL(c)&&0!==c;)c=t.input.charCodeAt(++t.position);captureSegment(t,i,t.position,!1)}}return!0}(t,g)||function readSingleQuotedScalar(t,r){var i,o,a;if(39!==(i=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,o=a=t.position;0!==(i=t.input.charCodeAt(t.position));)if(39===i){if(captureSegment(t,o,t.position,!0),39!==(i=t.input.charCodeAt(++t.position)))return!0;o=t.position,t.position++,a=t.position}else is_EOL(i)?(captureSegment(t,o,a,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,r)),o=a=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a single quoted scalar"):(t.position++,a=t.position);throwError(t,"unexpected end of the stream within a single quoted scalar")}(t,g)||function readDoubleQuotedScalar(t,r){var i,o,a,c,u,l,d;if(34!==(l=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,i=o=t.position;0!==(l=t.input.charCodeAt(t.position));){if(34===l)return captureSegment(t,i,t.position,!0),t.position++,!0;if(92===l){if(captureSegment(t,i,t.position,!0),is_EOL(l=t.input.charCodeAt(++t.position)))skipSeparationSpace(t,!1,r);else if(l<256&&De[l])t.result+=Be[l],t.position++;else if((u=120===(d=l)?2:117===d?4:85===d?8:0)>0){for(a=u,c=0;a>0;a--)(u=fromHexCode(l=t.input.charCodeAt(++t.position)))>=0?c=(c<<4)+u:throwError(t,"expected hexadecimal character");t.result+=charFromCodepoint(c),t.position++}else throwError(t,"unknown escape sequence");i=o=t.position}else is_EOL(l)?(captureSegment(t,i,o,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,r)),i=o=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a double quoted scalar"):(t.position++,o=t.position)}throwError(t,"unexpected end of the stream within a double quoted scalar")}(t,g)?_=!0:!function readAlias(t){var r,i,o;if(42!==(o=t.input.charCodeAt(t.position)))return!1;for(o=t.input.charCodeAt(++t.position),r=t.position;0!==o&&!is_WS_OR_EOL(o)&&!is_FLOW_INDICATOR(o);)o=t.input.charCodeAt(++t.position);return t.position===r&&throwError(t,"name of an alias node must contain at least one character"),i=t.input.slice(r,t.position),Ae.call(t.anchorMap,i)||throwError(t,'unidentified alias "'+i+'"'),t.result=t.anchorMap[i],skipSeparationSpace(t,!0,-1),!0}(t)?function readPlainScalar(t,r,i){var o,a,c,u,l,d,p,h,m=t.kind,g=t.result;if(is_WS_OR_EOL(h=t.input.charCodeAt(t.position))||is_FLOW_INDICATOR(h)||35===h||38===h||42===h||33===h||124===h||62===h||39===h||34===h||37===h||64===h||96===h)return!1;if((63===h||45===h)&&(is_WS_OR_EOL(o=t.input.charCodeAt(t.position+1))||i&&is_FLOW_INDICATOR(o)))return!1;for(t.kind="scalar",t.result="",a=c=t.position,u=!1;0!==h;){if(58===h){if(is_WS_OR_EOL(o=t.input.charCodeAt(t.position+1))||i&&is_FLOW_INDICATOR(o))break}else if(35===h){if(is_WS_OR_EOL(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&testDocumentSeparator(t)||i&&is_FLOW_INDICATOR(h))break;if(is_EOL(h)){if(l=t.line,d=t.lineStart,p=t.lineIndent,skipSeparationSpace(t,!1,-1),t.lineIndent>=r){u=!0,h=t.input.charCodeAt(t.position);continue}t.position=c,t.line=l,t.lineStart=d,t.lineIndent=p;break}}u&&(captureSegment(t,a,c,!1),writeFoldedLines(t,t.line-l),a=c=t.position,u=!1),is_WHITE_SPACE(h)||(c=t.position+1),h=t.input.charCodeAt(++t.position)}return captureSegment(t,a,c,!1),!!t.result||(t.kind=m,t.result=g,!1)}(t,g,1===i)&&(_=!0,null===t.tag&&(t.tag="?")):(_=!0,null===t.tag&&null===t.anchor||throwError(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===v&&(_=l&&readBlockSequence(t,y))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&throwError(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,p=t.implicitTypes.length;d<p;d+=1)if((m=t.implicitTypes[d]).resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else if("!"!==t.tag){if(Ae.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,d=0,p=(h=t.typeMap.multi[t.kind||"fallback"]).length;d<p;d+=1)if(t.tag.slice(0,h[d].tag.length)===h[d].tag){m=h[d];break}m||throwError(t,"unknown tag !<"+t.tag+">"),null!==t.result&&m.kind!==t.kind&&throwError(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):throwError(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||_}function readDocument(t){var r,i,o,a,c=t.position,u=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(a=t.input.charCodeAt(t.position))&&(skipSeparationSpace(t,!0,-1),a=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==a));){for(u=!0,a=t.input.charCodeAt(++t.position),r=t.position;0!==a&&!is_WS_OR_EOL(a);)a=t.input.charCodeAt(++t.position);for(o=[],(i=t.input.slice(r,t.position)).length<1&&throwError(t,"directive name must not be less than one character in length");0!==a;){for(;is_WHITE_SPACE(a);)a=t.input.charCodeAt(++t.position);if(35===a){do{a=t.input.charCodeAt(++t.position)}while(0!==a&&!is_EOL(a));break}if(is_EOL(a))break;for(r=t.position;0!==a&&!is_WS_OR_EOL(a);)a=t.input.charCodeAt(++t.position);o.push(t.input.slice(r,t.position))}0!==a&&readLineBreak(t),Ae.call(Fe,i)?Fe[i](t,i,o):throwWarning(t,'unknown document directive "'+i+'"')}skipSeparationSpace(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,skipSeparationSpace(t,!0,-1)):u&&throwError(t,"directives end mark is expected"),composeNode(t,t.lineIndent-1,4,!1,!0),skipSeparationSpace(t,!0,-1),t.checkLineBreaks&&Re.test(t.input.slice(c,t.position))&&throwWarning(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&testDocumentSeparator(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,skipSeparationSpace(t,!0,-1)):t.position<t.length-1&&throwError(t,"end of the stream or a document separator is expected")}function loadDocuments(t,r){r=r||{},0!==(t=String(t)).length&&(10!==t.charCodeAt(t.length-1)&&13!==t.charCodeAt(t.length-1)&&(t+="\n"),65279===t.charCodeAt(0)&&(t=t.slice(1)));var i=new State$1(t,r),o=t.indexOf("\0");for(-1!==o&&(i.position=o,throwError(i,"null byte is not allowed in input")),i.input+="\0";32===i.input.charCodeAt(i.position);)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)readDocument(i);return i.documents}var Ue={loadAll:function loadAll$1(t,r,i){null!==r&&"object"==typeof r&&void 0===i&&(i=r,r=null);var o=loadDocuments(t,i);if("function"!=typeof r)return o;for(var a=0,c=o.length;a<c;a+=1)r(o[a])},load:function load$1(t,r){var i=loadDocuments(t,r);if(0!==i.length){if(1===i.length)return i[0];throw new X("expected a single document in the stream, but found more")}}},qe=Object.prototype.toString,We=Object.prototype.hasOwnProperty,ze={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},Ve=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],He=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function encodeHex(t){var r,i,o;if(r=t.toString(16).toUpperCase(),t<=255)i="x",o=2;else if(t<=65535)i="u",o=4;else{if(!(t<=4294967295))throw new X("code point within a string may not be greater than 0xFFFFFFFF");i="U",o=8}return"\\"+i+Q.repeat("0",o-r.length)+r}function State(t){this.schema=t.schema||Ce,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Q.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=function compileStyleMap(t,r){var i,o,a,c,u,l,d;if(null===r)return{};for(i={},a=0,c=(o=Object.keys(r)).length;a<c;a+=1)u=o[a],l=String(r[u]),"!!"===u.slice(0,2)&&(u="tag:yaml.org,2002:"+u.slice(2)),(d=t.compiledTypeMap.fallback[u])&&We.call(d.styleAliases,l)&&(l=d.styleAliases[l]),i[u]=l;return i}(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType='"'===t.quotingType?2:1,this.forceQuotes=t.forceQuotes||!1,this.replacer="function"==typeof t.replacer?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function indentString(t,r){for(var i,o=Q.repeat(" ",r),a=0,c=-1,u="",l=t.length;a<l;)-1===(c=t.indexOf("\n",a))?(i=t.slice(a),a=l):(i=t.slice(a,c+1),a=c+1),i.length&&"\n"!==i&&(u+=o),u+=i;return u}function generateNextLine(t,r){return"\n"+Q.repeat(" ",t.indent*r)}function isWhitespace(t){return 32===t||9===t}function isPrintable(t){return 32<=t&&t<=126||161<=t&&t<=55295&&8232!==t&&8233!==t||57344<=t&&t<=65533&&65279!==t||65536<=t&&t<=1114111}function isNsCharOrWhitespace(t){return isPrintable(t)&&65279!==t&&13!==t&&10!==t}function isPlainSafe(t,r,i){var o=isNsCharOrWhitespace(t),a=o&&!isWhitespace(t);return(i?o:o&&44!==t&&91!==t&&93!==t&&123!==t&&125!==t)&&35!==t&&!(58===r&&!a)||isNsCharOrWhitespace(r)&&!isWhitespace(r)&&35===t||58===r&&a}function codePointAt(t,r){var i,o=t.charCodeAt(r);return o>=55296&&o<=56319&&r+1<t.length&&(i=t.charCodeAt(r+1))>=56320&&i<=57343?1024*(o-55296)+i-56320+65536:o}function needIndentIndicator(t){return/^\n* /.test(t)}function chooseScalarStyle(t,r,i,o,a,c,u,l){var d,p=0,h=null,m=!1,g=!1,y=-1!==o,v=-1,b=function isPlainSafeFirst(t){return isPrintable(t)&&65279!==t&&!isWhitespace(t)&&45!==t&&63!==t&&58!==t&&44!==t&&91!==t&&93!==t&&123!==t&&125!==t&&35!==t&&38!==t&&42!==t&&33!==t&&124!==t&&61!==t&&62!==t&&39!==t&&34!==t&&37!==t&&64!==t&&96!==t}(codePointAt(t,0))&&function isPlainSafeLast(t){return!isWhitespace(t)&&58!==t}(codePointAt(t,t.length-1));if(r||u)for(d=0;d<t.length;p>=65536?d+=2:d++){if(!isPrintable(p=codePointAt(t,d)))return 5;b=b&&isPlainSafe(p,h,l),h=p}else{for(d=0;d<t.length;p>=65536?d+=2:d++){if(10===(p=codePointAt(t,d)))m=!0,y&&(g=g||d-v-1>o&&" "!==t[v+1],v=d);else if(!isPrintable(p))return 5;b=b&&isPlainSafe(p,h,l),h=p}g=g||y&&d-v-1>o&&" "!==t[v+1]}return m||g?i>9&&needIndentIndicator(t)?5:u?2===c?5:2:g?4:3:!b||u||a(t)?2===c?5:2:1}function writeScalar(t,r,i,o,a){t.dump=function(){if(0===r.length)return 2===t.quotingType?'""':"''";if(!t.noCompatMode&&(-1!==Ve.indexOf(r)||He.test(r)))return 2===t.quotingType?'"'+r+'"':"'"+r+"'";var c=t.indent*Math.max(1,i),u=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-c),l=o||t.flowLevel>-1&&i>=t.flowLevel;switch(chooseScalarStyle(r,l,t.indent,u,(function testAmbiguity(r){return function testImplicitResolving(t,r){var i,o;for(i=0,o=t.implicitTypes.length;i<o;i+=1)if(t.implicitTypes[i].resolve(r))return!0;return!1}(t,r)}),t.quotingType,t.forceQuotes&&!o,a)){case 1:return r;case 2:return"'"+r.replace(/'/g,"''")+"'";case 3:return"|"+blockHeader(r,t.indent)+dropEndingNewline(indentString(r,c));case 4:return">"+blockHeader(r,t.indent)+dropEndingNewline(indentString(function foldString(t,r){var i,o,a=/(\n+)([^\n]*)/g,c=(l=t.indexOf("\n"),l=-1!==l?l:t.length,a.lastIndex=l,foldLine(t.slice(0,l),r)),u="\n"===t[0]||" "===t[0];var l;for(;o=a.exec(t);){var d=o[1],p=o[2];i=" "===p[0],c+=d+(u||i||""===p?"":"\n")+foldLine(p,r),u=i}return c}(r,u),c));case 5:return'"'+function escapeString(t){for(var r,i="",o=0,a=0;a<t.length;o>=65536?a+=2:a++)o=codePointAt(t,a),!(r=ze[o])&&isPrintable(o)?(i+=t[a],o>=65536&&(i+=t[a+1])):i+=r||encodeHex(o);return i}(r)+'"';default:throw new X("impossible error: invalid scalar style")}}()}function blockHeader(t,r){var i=needIndentIndicator(t)?String(r):"",o="\n"===t[t.length-1];return i+(o&&("\n"===t[t.length-2]||"\n"===t)?"+":o?"":"-")+"\n"}function dropEndingNewline(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function foldLine(t,r){if(""===t||" "===t[0])return t;for(var i,o,a=/ [^ ]/g,c=0,u=0,l=0,d="";i=a.exec(t);)(l=i.index)-c>r&&(o=u>c?u:l,d+="\n"+t.slice(c,o),c=o+1),u=l;return d+="\n",t.length-c>r&&u>c?d+=t.slice(c,u)+"\n"+t.slice(u+1):d+=t.slice(c),d.slice(1)}function writeBlockSequence(t,r,i,o){var a,c,u,l="",d=t.tag;for(a=0,c=i.length;a<c;a+=1)u=i[a],t.replacer&&(u=t.replacer.call(i,String(a),u)),(writeNode(t,r+1,u,!0,!0,!1,!0)||void 0===u&&writeNode(t,r+1,null,!0,!0,!1,!0))&&(o&&""===l||(l+=generateNextLine(t,r)),t.dump&&10===t.dump.charCodeAt(0)?l+="-":l+="- ",l+=t.dump);t.tag=d,t.dump=l||"[]"}function detectType(t,r,i){var o,a,c,u,l,d;for(c=0,u=(a=i?t.explicitTypes:t.implicitTypes).length;c<u;c+=1)if(((l=a[c]).instanceOf||l.predicate)&&(!l.instanceOf||"object"==typeof r&&r instanceof l.instanceOf)&&(!l.predicate||l.predicate(r))){if(i?l.multi&&l.representName?t.tag=l.representName(r):t.tag=l.tag:t.tag="?",l.represent){if(d=t.styleMap[l.tag]||l.defaultStyle,"[object Function]"===qe.call(l.represent))o=l.represent(r,d);else{if(!We.call(l.represent,d))throw new X("!<"+l.tag+'> tag resolver accepts not "'+d+'" style');o=l.represent[d](r,d)}t.dump=o}return!0}return!1}function writeNode(t,r,i,o,a,c,u){t.tag=null,t.dump=i,detectType(t,i,!1)||detectType(t,i,!0);var l,d=qe.call(t.dump),p=o;o&&(o=t.flowLevel<0||t.flowLevel>r);var h,m,g="[object Object]"===d||"[object Array]"===d;if(g&&(m=-1!==(h=t.duplicates.indexOf(i))),(null!==t.tag&&"?"!==t.tag||m||2!==t.indent&&r>0)&&(a=!1),m&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(g&&m&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),"[object Object]"===d)o&&0!==Object.keys(t.dump).length?(!function writeBlockMapping(t,r,i,o){var a,c,u,l,d,p,h="",m=t.tag,g=Object.keys(i);if(!0===t.sortKeys)g.sort();else if("function"==typeof t.sortKeys)g.sort(t.sortKeys);else if(t.sortKeys)throw new X("sortKeys must be a boolean or a function");for(a=0,c=g.length;a<c;a+=1)p="",o&&""===h||(p+=generateNextLine(t,r)),l=i[u=g[a]],t.replacer&&(l=t.replacer.call(i,u,l)),writeNode(t,r+1,u,!0,!0,!0)&&((d=null!==t.tag&&"?"!==t.tag||t.dump&&t.dump.length>1024)&&(t.dump&&10===t.dump.charCodeAt(0)?p+="?":p+="? "),p+=t.dump,d&&(p+=generateNextLine(t,r)),writeNode(t,r+1,l,!0,d)&&(t.dump&&10===t.dump.charCodeAt(0)?p+=":":p+=": ",h+=p+=t.dump));t.tag=m,t.dump=h||"{}"}(t,r,t.dump,a),m&&(t.dump="&ref_"+h+t.dump)):(!function writeFlowMapping(t,r,i){var o,a,c,u,l,d="",p=t.tag,h=Object.keys(i);for(o=0,a=h.length;o<a;o+=1)l="",""!==d&&(l+=", "),t.condenseFlow&&(l+='"'),u=i[c=h[o]],t.replacer&&(u=t.replacer.call(i,c,u)),writeNode(t,r,c,!1,!1)&&(t.dump.length>1024&&(l+="? "),l+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),writeNode(t,r,u,!1,!1)&&(d+=l+=t.dump));t.tag=p,t.dump="{"+d+"}"}(t,r,t.dump),m&&(t.dump="&ref_"+h+" "+t.dump));else if("[object Array]"===d)o&&0!==t.dump.length?(t.noArrayIndent&&!u&&r>0?writeBlockSequence(t,r-1,t.dump,a):writeBlockSequence(t,r,t.dump,a),m&&(t.dump="&ref_"+h+t.dump)):(!function writeFlowSequence(t,r,i){var o,a,c,u="",l=t.tag;for(o=0,a=i.length;o<a;o+=1)c=i[o],t.replacer&&(c=t.replacer.call(i,String(o),c)),(writeNode(t,r,c,!1,!1)||void 0===c&&writeNode(t,r,null,!1,!1))&&(""!==u&&(u+=","+(t.condenseFlow?"":" ")),u+=t.dump);t.tag=l,t.dump="["+u+"]"}(t,r,t.dump),m&&(t.dump="&ref_"+h+" "+t.dump));else{if("[object String]"!==d){if("[object Undefined]"===d)return!1;if(t.skipInvalid)return!1;throw new X("unacceptable kind of an object to dump "+d)}"?"!==t.tag&&writeScalar(t,t.dump,r,c,p)}null!==t.tag&&"?"!==t.tag&&(l=encodeURI("!"===t.tag[0]?t.tag.slice(1):t.tag).replace(/!/g,"%21"),l="!"===t.tag[0]?"!"+l:"tag:yaml.org,2002:"===l.slice(0,18)?"!!"+l.slice(18):"!<"+l+">",t.dump=l+" "+t.dump)}return!0}function getDuplicateReferences(t,r){var i,o,a=[],c=[];for(function inspectNode(t,r,i){var o,a,c;if(null!==t&&"object"==typeof t)if(-1!==(a=r.indexOf(t)))-1===i.indexOf(a)&&i.push(a);else if(r.push(t),Array.isArray(t))for(a=0,c=t.length;a<c;a+=1)inspectNode(t[a],r,i);else for(o=Object.keys(t),a=0,c=o.length;a<c;a+=1)inspectNode(t[o[a]],r,i)}(t,a,c),i=0,o=c.length;i<o;i+=1)r.duplicates.push(a[c[i]]);r.usedDuplicates=new Array(o)}function renamed(t,r){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var $e={Type:re,Schema:ne,FAILSAFE_SCHEMA:ae,JSON_SCHEMA:he,CORE_SCHEMA:me,DEFAULT_SCHEMA:Ce,load:Ue.load,loadAll:Ue.loadAll,dump:{dump:function dump$1(t,r){var i=new State(r=r||{});i.noRefs||getDuplicateReferences(t,i);var o=t;return i.replacer&&(o=i.replacer.call({"":o},"",o)),writeNode(i,0,o,!0,!0)?i.dump+"\n":""}}.dump,YAMLException:X,types:{binary:we,float:pe,map:se,null:ce,pairs:Ee,set:Pe,timestamp:ve,bool:ue,int:le,merge:be,omap:Ie,seq:oe,str:ie},safeLoad:renamed("safeLoad","load"),safeLoadAll:renamed("safeLoadAll","loadAll"),safeDump:renamed("safeDump","dump")},Ke=i(54),Ge=i(42),Je=i.n(Ge),Ye=i(25),Qe=i.n(Ye),Xe=function isRfc3986Reserved(t){return":/?#[]@!$&'()*+,;=".indexOf(t)>-1},Ze=function isRrc3986Unreserved(t){return/^[a-z0-9\-._~]+$/i.test(t)};function encodeDisallowedCharacters(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.escape,a=arguments.length>2?arguments[2]:void 0;return"number"==typeof t&&(t=t.toString()),"string"==typeof t&&t.length&&o?a?JSON.parse(t):U()(r=Je()(t)).call(r,(function(t){var r,i;if(Ze(t))return t;if(Xe(t)&&"unsafe"===o)return t;var a=new TextEncoder;return U()(r=U()(i=L()(a.encode(t))).call(i,(function(t){var r;return Qe()(r="0".concat(t.toString(16).toUpperCase())).call(r,-2)}))).call(r,(function(t){return"%".concat(t)})).join("")})).join(""):t}function stylize(t){var r=t.value;return Array.isArray(r)?function encodeArray(t){var r=t.key,i=t.value,o=t.style,a=t.explode,c=t.escape,u=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})};if("simple"===o)return U()(i).call(i,(function(t){return u(t)})).join(",");if("label"===o)return".".concat(U()(i).call(i,(function(t){return u(t)})).join("."));if("matrix"===o)return U()(i).call(i,(function(t){return u(t)})).reduce((function(t,i){var o,c,u;return!t||a?V()(c=V()(u="".concat(t||"",";")).call(u,r,"=")).call(c,i):V()(o="".concat(t,",")).call(o,i)}),"");if("form"===o){var l=a?"&".concat(r,"="):",";return U()(i).call(i,(function(t){return u(t)})).join(l)}if("spaceDelimited"===o){var d=a?"".concat(r,"="):"";return U()(i).call(i,(function(t){return u(t)})).join(" ".concat(d))}if("pipeDelimited"===o){var p=a?"".concat(r,"="):"";return U()(i).call(i,(function(t){return u(t)})).join("|".concat(p))}return}(t):"object"===w()(r)?function encodeObject(t){var r=t.key,i=t.value,o=t.style,a=t.explode,c=t.escape,u=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})},l=W()(i);if("simple"===o)return l.reduce((function(t,r){var o,c,l,d=u(i[r]),p=a?"=":",",h=t?"".concat(t,","):"";return V()(o=V()(c=V()(l="".concat(h)).call(l,r)).call(c,p)).call(o,d)}),"");if("label"===o)return l.reduce((function(t,r){var o,c,l,d=u(i[r]),p=a?"=":".",h=t?"".concat(t,"."):".";return V()(o=V()(c=V()(l="".concat(h)).call(l,r)).call(c,p)).call(o,d)}),"");if("matrix"===o&&a)return l.reduce((function(t,r){var o,a,c=u(i[r]),l=t?"".concat(t,";"):";";return V()(o=V()(a="".concat(l)).call(a,r,"=")).call(o,c)}),"");if("matrix"===o)return l.reduce((function(t,o){var a,c,l=u(i[o]),d=t?"".concat(t,","):";".concat(r,"=");return V()(a=V()(c="".concat(d)).call(c,o,",")).call(a,l)}),"");if("form"===o)return l.reduce((function(t,r){var o,c,l,d,p=u(i[r]),h=t?V()(o="".concat(t)).call(o,a?"&":","):"",m=a?"=":",";return V()(c=V()(l=V()(d="".concat(h)).call(d,r)).call(l,m)).call(c,p)}),"");return}(t):function encodePrimitive(t){var r,i=t.key,o=t.value,a=t.style,c=t.escape,u=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})};if("simple"===a)return u(o);if("label"===a)return".".concat(u(o));if("matrix"===a)return V()(r=";".concat(i,"=")).call(r,u(o));if("form"===a)return u(o);if("deepObject"===a)return u(o);return}(t)}var et=function foldFormDataToRequest(t,r){r.body=t},tt={serializeRes:serializeRes,mergeInQueryOrForm:mergeInQueryOrForm};function http_http(t){return _http.apply(this,arguments)}function _http(){return(_http=x()(C.a.mark((function _callee(t){var r,i,o,a,c,u=arguments;return C.a.wrap((function _callee$(l){for(;;)switch(l.prev=l.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},"object"===w()(t)&&(t=(r=t).url),r.headers=r.headers||{},tt.mergeInQueryOrForm(r),r.headers&&W()(r.headers).forEach((function(t){var i=r.headers[t];"string"==typeof i&&(r.headers[t]=i.replace(/\n+/g," "))})),!r.requestInterceptor){l.next=12;break}return l.next=8,r.requestInterceptor(r);case 8:if(l.t0=l.sent,l.t0){l.next=11;break}l.t0=r;case 11:r=l.t0;case 12:return i=r.headers["content-type"]||r.headers["Content-Type"],/multipart\/form-data/i.test(i)&&r.body instanceof Ke.FormData&&(delete r.headers["content-type"],delete r.headers["Content-Type"]),l.prev=14,l.next=17,(r.userFetch||fetch)(r.url,r);case 17:return o=l.sent,l.next=20,tt.serializeRes(o,t,r);case 20:if(o=l.sent,!r.responseInterceptor){l.next=28;break}return l.next=24,r.responseInterceptor(o);case 24:if(l.t1=l.sent,l.t1){l.next=27;break}l.t1=o;case 27:o=l.t1;case 28:l.next=39;break;case 30:if(l.prev=30,l.t2=l.catch(14),o){l.next=34;break}throw l.t2;case 34:throw(a=new Error(o.statusText||"response status is ".concat(o.status))).status=o.status,a.statusCode=o.status,a.responseError=l.t2,a;case 39:if(o.ok){l.next=45;break}throw(c=new Error(o.statusText||"response status is ".concat(o.status))).status=o.status,c.statusCode=o.status,c.response=o,c;case 45:return l.abrupt("return",o);case 46:case"end":return l.stop()}}),_callee,null,[[14,30]])})))).apply(this,arguments)}var rt=function shouldDownloadAsText(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(t)};function parseBody(t,r){return r&&(0===r.indexOf("application/json")||r.indexOf("+json")>0)?JSON.parse(t):$e.load(t)}function serializeRes(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.loadSpec,a=void 0!==o&&o,c={ok:t.ok,url:t.url||r,status:t.status,statusText:t.statusText,headers:serializeHeaders(t.headers)},u=c.headers["content-type"],l=a||rt(u),d=l?t.text:t.blob||t.buffer;return d.call(t).then((function(t){if(c.text=t,c.data=t,l)try{var r=parseBody(t,u);c.body=r,c.obj=r}catch(t){c.parseError=t}return c}))}function serializeHeaderValue(t){return O()(t).call(t,", ")?t.split(", "):t}function serializeHeaders(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"function"!=typeof M()(t)?{}:L()(M()(t).call(t)).reduce((function(t,r){var i=I()(r,2),o=i[0],a=i[1];return t[o]=serializeHeaderValue(a),t}),{})}function isFile(t,r){return r||"undefined"==typeof navigator||(r=navigator),r&&"ReactNative"===r.product?!(!t||"object"!==w()(t)||"string"!=typeof t.uri):void 0!==Ke.File&&t instanceof Ke.File||(void 0!==Ke.Blob&&t instanceof Ke.Blob||(!!ArrayBuffer.isView(t)||null!==t&&"object"===w()(t)&&"function"==typeof t.pipe))}function isArrayOfFile(t,r){return Array.isArray(t)&&t.some((function(t){return isFile(t,r)}))}var nt={form:",",spaceDelimited:"%20",pipeDelimited:"|"},it={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function formatKeyValue(t,r){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=r.collectionFormat,a=r.allowEmptyValue,c=r.serializationOption,u=r.encoding,l="object"!==w()(r)||Array.isArray(r)?r:r.value,d=i?function(t){return t.toString()}:function(t){return encodeURIComponent(t)},p=d(t);if(void 0===l&&a)return[[p,""]];if(isFile(l)||isArrayOfFile(l))return[[p,l]];if(c)return formatKeyValueBySerializationOption(t,l,i,c);if(u){if([w()(u.style),w()(u.explode),w()(u.allowReserved)].some((function(t){return"undefined"!==t}))){var h=u.style,m=u.explode,g=u.allowReserved;return formatKeyValueBySerializationOption(t,l,i,{style:h,explode:m,allowReserved:g})}if(u.contentType){if("application/json"===u.contentType){var y="string"==typeof l?l:B()(l);return[[p,d(y)]]}return[[p,d(l.toString())]]}return"object"!==w()(l)?[[p,d(l)]]:Array.isArray(l)&&l.every((function(t){return"object"!==w()(t)}))?[[p,U()(l).call(l,d).join(",")]]:[[p,d(B()(l))]]}return"object"!==w()(l)?[[p,d(l)]]:Array.isArray(l)?"multi"===o?[[p,U()(l).call(l,d)]]:[[p,U()(l).call(l,d).join(it[o||"csv"])]]:[[p,""]]}function formatKeyValueBySerializationOption(t,r,i,o){var a,c,u,l=o.style||"form",d=void 0===o.explode?"form"===l:o.explode,p=!i&&(o&&o.allowReserved?"unsafe":"reserved"),h=function encodeFn(t){return encodeDisallowedCharacters(t,{escape:p})},m=i?function(t){return t}:function(t){return encodeDisallowedCharacters(t,{escape:p})};return"object"!==w()(r)?[[m(t),h(r)]]:Array.isArray(r)?d?[[m(t),U()(r).call(r,h)]]:[[m(t),U()(r).call(r,h).join(nt[l])]]:"deepObject"===l?U()(c=W()(r)).call(c,(function(i){var o;return[m(V()(o="".concat(t,"[")).call(o,i,"]")),h(r[i])]})):d?U()(u=W()(r)).call(u,(function(t){return[m(t),h(r[t])]})):[[m(t),U()(a=W()(r)).call(a,(function(t){var i;return[V()(i="".concat(m(t),",")).call(i,h(r[t]))]})).join(",")]]}function buildFormData(t){return $()(t).reduce((function(t,r){var i,o=I()(r,2),a=o[0],c=o[1],u=b()(formatKeyValue(a,c,!0));try{for(u.s();!(i=u.n()).done;){var l=I()(i.value,2),d=l[0],p=l[1];if(Array.isArray(p)){var h,m=b()(p);try{for(m.s();!(h=m.n()).done;){var g=h.value;if(ArrayBuffer.isView(g)){var y=new Ke.Blob([g]);t.append(d,y)}else t.append(d,g)}}catch(t){m.e(t)}finally{m.f()}}else if(ArrayBuffer.isView(p)){var v=new Ke.Blob([p]);t.append(d,v)}else t.append(d,p)}}catch(t){u.e(t)}finally{u.f()}return t}),new Ke.FormData)}function encodeFormOrQuery(t){var r=W()(t).reduce((function(r,i){var o,a=b()(formatKeyValue(i,t[i]));try{for(a.s();!(o=a.n()).done;){var c=I()(o.value,2),u=c[0],l=c[1];r[u]=l}}catch(t){a.e(t)}finally{a.f()}return r}),{});return Y.a.stringify(r,{encode:!1,indices:!1})||""}function mergeInQueryOrForm(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.url,i=void 0===r?"":r,o=t.query,a=t.form,c=function joinSearch(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var o=G()(r).call(r,(function(t){return t})).join("&");return o?"?".concat(o):""};if(a){var u=W()(a).some((function(t){var r=a[t].value;return isFile(r)||isArrayOfFile(r)})),l=t.headers["content-type"]||t.headers["Content-Type"];if(u||/multipart\/form-data/i.test(l)){var d=buildFormData(t.form);et(d,t)}else t.body=encodeFormOrQuery(a);delete t.form}if(o){var p=i.split("?"),h=I()(p,2),m=h[0],g=h[1],y="";if(g){var v=Y.a.parse(g),b=W()(o);b.forEach((function(t){return delete v[t]})),y=Y.a.stringify(v,{encode:!0})}var _=c(y,encodeFormOrQuery(o));t.url=m+_,delete t.query}return t}var ot,st=i(157),at=i.n(st),ct=i(158),ut=i.n(ct),lt=i(346),ft=i.n(lt),dt=i(53),pt=i.n(dt),ht=i(347),mt=i.n(ht),gt=i(216),yt=i.n(gt),vt=(ot=function(t,r){return(ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])})(t,r)},function(t,r){function __(){this.constructor=t}ot(t,r),t.prototype=null===r?Object.create(r):(__.prototype=r.prototype,new __)}),bt=Object.prototype.hasOwnProperty;function module_helpers_hasOwnProperty(t,r){return bt.call(t,r)}function _objectKeys(t){if(Array.isArray(t)){for(var r=new Array(t.length),i=0;i<r.length;i++)r[i]=""+i;return r}if(Object.keys)return Object.keys(t);var o=[];for(var a in t)module_helpers_hasOwnProperty(t,a)&&o.push(a);return o}function _deepClone(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function helpers_isInteger(t){for(var r,i=0,o=t.length;i<o;){if(!((r=t.charCodeAt(i))>=48&&r<=57))return!1;i++}return!0}function escapePathComponent(t){return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function unescapePathComponent(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function patchErrorMessageFormatter(t,r){var i=[t];for(var o in r){var a="object"==typeof r[o]?JSON.stringify(r[o],null,2):r[o];void 0!==a&&i.push(o+": "+a)}return i.join("\n")}var _t=function(t){function PatchError(r,i,o,a,c){var u=this.constructor,l=t.call(this,patchErrorMessageFormatter(r,{name:i,index:o,operation:a,tree:c}))||this;return l.name=i,l.index=o,l.operation=a,l.tree=c,Object.setPrototypeOf(l,u.prototype),l.message=patchErrorMessageFormatter(r,{name:i,index:o,operation:a,tree:c}),l}return vt(PatchError,t),PatchError}(Error),wt=_t,St=_deepClone,Tt={add:function(t,r,i){return t[r]=this.value,{newDocument:i}},remove:function(t,r,i){var o=t[r];return delete t[r],{newDocument:i,removed:o}},replace:function(t,r,i){var o=t[r];return t[r]=this.value,{newDocument:i,removed:o}},move:function(t,r,i){var o=getValueByPointer(i,this.path);o&&(o=_deepClone(o));var a=applyOperation(i,{op:"remove",path:this.from}).removed;return applyOperation(i,{op:"add",path:this.path,value:a}),{newDocument:i,removed:o}},copy:function(t,r,i){var o=getValueByPointer(i,this.from);return applyOperation(i,{op:"add",path:this.path,value:_deepClone(o)}),{newDocument:i}},test:function(t,r,i){return{newDocument:i,test:_areEquals(t[r],this.value)}},_get:function(t,r,i){return this.value=t[r],{newDocument:i}}},It={add:function(t,r,i){return helpers_isInteger(r)?t.splice(r,0,this.value):t[r]=this.value,{newDocument:i,index:r}},remove:function(t,r,i){return{newDocument:i,removed:t.splice(r,1)[0]}},replace:function(t,r,i){var o=t[r];return t[r]=this.value,{newDocument:i,removed:o}},move:Tt.move,copy:Tt.copy,test:Tt.test,_get:Tt._get};function getValueByPointer(t,r){if(""==r)return t;var i={op:"_get",path:r};return applyOperation(t,i),i.value}function applyOperation(t,r,i,o,a,c){if(void 0===i&&(i=!1),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===c&&(c=0),i&&("function"==typeof i?i(r,0,t,r.path):validator(r,0)),""===r.path){var u={newDocument:t};if("add"===r.op)return u.newDocument=r.value,u;if("replace"===r.op)return u.newDocument=r.value,u.removed=t,u;if("move"===r.op||"copy"===r.op)return u.newDocument=getValueByPointer(t,r.from),"move"===r.op&&(u.removed=t),u;if("test"===r.op){if(u.test=_areEquals(t,r.value),!1===u.test)throw new wt("Test operation failed","TEST_OPERATION_FAILED",c,r,t);return u.newDocument=t,u}if("remove"===r.op)return u.removed=t,u.newDocument=null,u;if("_get"===r.op)return r.value=t,u;if(i)throw new wt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",c,r,t);return u}o||(t=_deepClone(t));var l=(r.path||"").split("/"),d=t,p=1,h=l.length,m=void 0,g=void 0,y=void 0;for(y="function"==typeof i?i:validator;;){if((g=l[p])&&-1!=g.indexOf("~")&&(g=unescapePathComponent(g)),a&&("__proto__"==g||"prototype"==g&&p>0&&"constructor"==l[p-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(i&&void 0===m&&(void 0===d[g]?m=l.slice(0,p).join("/"):p==h-1&&(m=r.path),void 0!==m&&y(r,0,t,m)),p++,Array.isArray(d)){if("-"===g)g=d.length;else{if(i&&!helpers_isInteger(g))throw new wt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",c,r,t);helpers_isInteger(g)&&(g=~~g)}if(p>=h){if(i&&"add"===r.op&&g>d.length)throw new wt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",c,r,t);if(!1===(u=It[r.op].call(r,d,g,t)).test)throw new wt("Test operation failed","TEST_OPERATION_FAILED",c,r,t);return u}}else if(p>=h){if(!1===(u=Tt[r.op].call(r,d,g,t)).test)throw new wt("Test operation failed","TEST_OPERATION_FAILED",c,r,t);return u}if(d=d[g],i&&p<h&&(!d||"object"!=typeof d))throw new wt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",c,r,t)}}function applyPatch(t,r,i,o,a){if(void 0===o&&(o=!0),void 0===a&&(a=!0),i&&!Array.isArray(r))throw new wt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");o||(t=_deepClone(t));for(var c=new Array(r.length),u=0,l=r.length;u<l;u++)c[u]=applyOperation(t,r[u],i,!0,a,u),t=c[u].newDocument;return c.newDocument=t,c}function applyReducer(t,r,i){var o=applyOperation(t,r);if(!1===o.test)throw new wt("Test operation failed","TEST_OPERATION_FAILED",i,r,t);return o.newDocument}function validator(t,r,i,o){if("object"!=typeof t||null===t||Array.isArray(t))throw new wt("Operation is not an object","OPERATION_NOT_AN_OBJECT",r,t,i);if(!Tt[t.op])throw new wt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",r,t,i);if("string"!=typeof t.path)throw new wt("Operation `path` property is not a string","OPERATION_PATH_INVALID",r,t,i);if(0!==t.path.indexOf("/")&&t.path.length>0)throw new wt('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",r,t,i);if(("move"===t.op||"copy"===t.op)&&"string"!=typeof t.from)throw new wt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",r,t,i);if(("add"===t.op||"replace"===t.op||"test"===t.op)&&void 0===t.value)throw new wt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",r,t,i);if(("add"===t.op||"replace"===t.op||"test"===t.op)&&function hasUndefined(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(var r=0,i=t.length;r<i;r++)if(hasUndefined(t[r]))return!0}else if("object"==typeof t)for(var o=_objectKeys(t),a=o.length,c=0;c<a;c++)if(hasUndefined(t[o[c]]))return!0;return!1}(t.value))throw new wt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",r,t,i);if(i)if("add"==t.op){var a=t.path.split("/").length,c=o.split("/").length;if(a!==c+1&&a!==c)throw new wt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",r,t,i)}else if("replace"===t.op||"remove"===t.op||"_get"===t.op){if(t.path!==o)throw new wt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",r,t,i)}else if("move"===t.op||"copy"===t.op){var u=validate([{op:"_get",path:t.from,value:void 0}],i);if(u&&"OPERATION_PATH_UNRESOLVABLE"===u.name)throw new wt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",r,t,i)}}function validate(t,r,i){try{if(!Array.isArray(t))throw new wt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(r)applyPatch(_deepClone(r),_deepClone(t),i||!0);else{i=i||validator;for(var o=0;o<t.length;o++)i(t[o],o,r,void 0)}}catch(t){if(t instanceof wt)return t;throw t}}function _areEquals(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){var i,o,a,c=Array.isArray(t),u=Array.isArray(r);if(c&&u){if((o=t.length)!=r.length)return!1;for(i=o;0!=i--;)if(!_areEquals(t[i],r[i]))return!1;return!0}if(c!=u)return!1;var l=Object.keys(t);if((o=l.length)!==Object.keys(r).length)return!1;for(i=o;0!=i--;)if(!r.hasOwnProperty(l[i]))return!1;for(i=o;0!=i--;)if(!_areEquals(t[a=l[i]],r[a]))return!1;return!0}return t!=t&&r!=r}var kt=new WeakMap,Et=function Et(t){this.observers=new Map,this.obj=t},xt=function xt(t,r){this.callback=t,this.observer=r};function unobserve(t,r){r.unobserve()}function observe(t,r){var i,o=function getMirror(t){return kt.get(t)}(t);if(o){var a=function getObserverFromMirror(t,r){return t.observers.get(r)}(o,r);i=a&&a.observer}else o=new Et(t),kt.set(t,o);if(i)return i;if(i={},o.value=_deepClone(t),r){i.callback=r,i.next=null;var dirtyCheck=function(){generate(i)},fastCheck=function(){clearTimeout(i.next),i.next=setTimeout(dirtyCheck)};"undefined"!=typeof window&&(window.addEventListener("mouseup",fastCheck),window.addEventListener("keyup",fastCheck),window.addEventListener("mousedown",fastCheck),window.addEventListener("keydown",fastCheck),window.addEventListener("change",fastCheck))}return i.patches=[],i.object=t,i.unobserve=function(){generate(i),clearTimeout(i.next),function removeObserverFromMirror(t,r){t.observers.delete(r.callback)}(o,i),"undefined"!=typeof window&&(window.removeEventListener("mouseup",fastCheck),window.removeEventListener("keyup",fastCheck),window.removeEventListener("mousedown",fastCheck),window.removeEventListener("keydown",fastCheck),window.removeEventListener("change",fastCheck))},o.observers.set(r,new xt(r,i)),i}function generate(t,r){void 0===r&&(r=!1);var i=kt.get(t.object);_generate(i.value,t.object,t.patches,"",r),t.patches.length&&applyPatch(i.value,t.patches);var o=t.patches;return o.length>0&&(t.patches=[],t.callback&&t.callback(o)),o}function _generate(t,r,i,o,a){if(r!==t){"function"==typeof r.toJSON&&(r=r.toJSON());for(var c=_objectKeys(r),u=_objectKeys(t),l=!1,d=u.length-1;d>=0;d--){var p=t[m=u[d]];if(!module_helpers_hasOwnProperty(r,m)||void 0===r[m]&&void 0!==p&&!1===Array.isArray(r))Array.isArray(t)===Array.isArray(r)?(a&&i.push({op:"test",path:o+"/"+escapePathComponent(m),value:_deepClone(p)}),i.push({op:"remove",path:o+"/"+escapePathComponent(m)}),l=!0):(a&&i.push({op:"test",path:o,value:t}),i.push({op:"replace",path:o,value:r}),!0);else{var h=r[m];"object"==typeof p&&null!=p&&"object"==typeof h&&null!=h&&Array.isArray(p)===Array.isArray(h)?_generate(p,h,i,o+"/"+escapePathComponent(m),a):p!==h&&(!0,a&&i.push({op:"test",path:o+"/"+escapePathComponent(m),value:_deepClone(p)}),i.push({op:"replace",path:o+"/"+escapePathComponent(m),value:_deepClone(h)}))}}if(l||c.length!=u.length)for(d=0;d<c.length;d++){var m;module_helpers_hasOwnProperty(t,m=c[d])||void 0===r[m]||i.push({op:"add",path:o+"/"+escapePathComponent(m),value:_deepClone(r[m])})}}}function compare(t,r,i){void 0===i&&(i=!1);var o=[];return _generate(t,r,o,"",i),o}Object.assign({},o,a,{JsonPatchError:_t,deepClone:_deepClone,escapePathComponent:escapePathComponent,unescapePathComponent:unescapePathComponent});var Pt=i(348),Ct=i.n(Pt),At=i(349),Ot=i.n(At),Rt={add:function add(t,r){return{op:"add",path:t,value:r}},replace:replace,remove:function remove(t){return{op:"remove",path:t}},merge:function lib_merge(t,r){return{type:"mutation",op:"merge",path:t,value:r}},mergeDeep:function mergeDeep(t,r){return{type:"mutation",op:"mergeDeep",path:t,value:r}},context:function context(t,r){return{type:"context",path:t,value:r}},getIn:function getIn(t,r){return r.reduce((function(t,r){return void 0!==r&&t?t[r]:t}),t)},applyPatch:function lib_applyPatch(t,r,i){if(i=i||{},"merge"===(r=l()(l()({},r),{},{path:r.path&&normalizeJSONPath(r.path)})).op){var o=getInByJsonPath(t,r.path);p()(o,r.value),applyPatch(t,[replace(r.path,o)])}else if("mergeDeep"===r.op){var a=getInByJsonPath(t,r.path);for(var c in r.value){var u=r.value[c],d=Array.isArray(u);if(d){var h=a[c]||[];a[c]=V()(h).call(h,u)}else if(lib_isObject(u)&&!d){var m=l()({},a[c]);for(var g in u){if(Object.prototype.hasOwnProperty.call(m,g)){m=Ct()(Ot()(m),u);break}p()(m,yt()({},g,u[g]))}a[c]=m}else a[c]=u}}else if("add"===r.op&&""===r.path&&lib_isObject(r.value)){var y=W()(r.value).reduce((function(t,i){return t.push({op:"add",path:"/".concat(normalizeJSONPath(i)),value:r.value[i]}),t}),[]);applyPatch(t,y)}else if("replace"===r.op&&""===r.path){var v=r.value;i.allowMetaPatches&&r.meta&&isAdditiveMutation(r)&&(Array.isArray(r.value)||lib_isObject(r.value))&&(v=l()(l()({},v),r.meta)),t=v}else if(applyPatch(t,[r]),i.allowMetaPatches&&r.meta&&isAdditiveMutation(r)&&(Array.isArray(r.value)||lib_isObject(r.value))){var b=getInByJsonPath(t,r.path),_=l()(l()({},b),r.meta);applyPatch(t,[replace(r.path,_)])}return t},parentPathMatch:function parentPathMatch(t,r){if(!Array.isArray(r))return!1;for(var i=0,o=r.length;i<o;i+=1)if(r[i]!==t[i])return!1;return!0},flatten:flatten,fullyNormalizeArray:function fullyNormalizeArray(t){return cleanArray(flatten(normalizeArray(t)))},normalizeArray:normalizeArray,isPromise:function isPromise(t){return lib_isObject(t)&&isFunction(t.then)},forEachNew:function forEachNew(t,r){try{return forEachNewPatch(t,forEach,r)}catch(t){return t}},forEachNewPrimitive:function forEachNewPrimitive(t,r){try{return forEachNewPatch(t,forEachPrimitive,r)}catch(t){return t}},isJsonPatch:isJsonPatch,isContextPatch:function isContextPatch(t){return isPatch(t)&&"context"===t.type},isPatch:isPatch,isMutation:isMutation,isAdditiveMutation:isAdditiveMutation,isGenerator:function isGenerator(t){return"[object GeneratorFunction]"===Object.prototype.toString.call(t)},isFunction:isFunction,isObject:lib_isObject,isError:function isError(t){return t instanceof Error}};function normalizeJSONPath(t){return Array.isArray(t)?t.length<1?"":"/".concat(U()(t).call(t,(function(t){return(t+"").replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")):t}function replace(t,r,i){return{op:"replace",path:t,value:r,meta:i}}function forEachNewPatch(t,r,i){var o;return cleanArray(flatten(U()(o=G()(t).call(t,isAdditiveMutation)).call(o,(function(t){return r(t.value,i,t.path)}))||[]))}function forEachPrimitive(t,r,i){return i=i||[],Array.isArray(t)?U()(t).call(t,(function(t,o){return forEachPrimitive(t,r,V()(i).call(i,o))})):lib_isObject(t)?U()(o=W()(t)).call(o,(function(o){return forEachPrimitive(t[o],r,V()(i).call(i,o))})):r(t,i[i.length-1],i);var o}function forEach(t,r,i){var o=[];if((i=i||[]).length>0){var a=r(t,i[i.length-1],i);a&&(o=V()(o).call(o,a))}if(Array.isArray(t)){var c=U()(t).call(t,(function(t,o){return forEach(t,r,V()(i).call(i,o))}));c&&(o=V()(o).call(o,c))}else if(lib_isObject(t)){var u,l=U()(u=W()(t)).call(u,(function(o){return forEach(t[o],r,V()(i).call(i,o))}));l&&(o=V()(o).call(o,l))}return o=flatten(o)}function normalizeArray(t){return Array.isArray(t)?t:[t]}function flatten(t){var r;return V()(r=[]).apply(r,Je()(U()(t).call(t,(function(t){return Array.isArray(t)?flatten(t):t}))))}function cleanArray(t){return G()(t).call(t,(function(t){return void 0!==t}))}function lib_isObject(t){return t&&"object"===w()(t)}function isFunction(t){return t&&"function"==typeof t}function isJsonPatch(t){if(isPatch(t)){var r=t.op;return"add"===r||"remove"===r||"replace"===r}return!1}function isMutation(t){return isJsonPatch(t)||isPatch(t)&&"mutation"===t.type}function isAdditiveMutation(t){return isMutation(t)&&("add"===t.op||"replace"===t.op||"merge"===t.op||"mergeDeep"===t.op)}function isPatch(t){return t&&"object"===w()(t)}function getInByJsonPath(t,r){try{return getValueByPointer(t,r)}catch(t){return console.error(t),{}}}var Mt=i(350),jt=i.n(Mt),Lt=i(218),Dt=i.n(Lt);function createErrorType(t,r){function E(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack;for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];this.message=i[0],r&&r.apply(this,i)}return E.prototype=new Error,E.prototype.name=t,E.prototype.constructor=E,E}var Bt=i(351),Nt=i.n(Bt),Ft=["properties"],Ut=["properties"],qt=["definitions","parameters","responses","securityDefinitions","components/schemas","components/responses","components/parameters","components/securitySchemes"],Wt=["schema/example","items/example"];function isFreelyNamed(t){var r=t[t.length-1],i=t[t.length-2],o=t.join("/");return Ft.indexOf(r)>-1&&-1===Ut.indexOf(i)||qt.indexOf(o)>-1||Wt.some((function(t){return o.indexOf(t)>-1}))}function absolutifyPointer(t,r){var i,o=t.split("#"),a=I()(o,2),c=a[0],u=a[1],l=y.a.resolve(c||"",r||"");return u?V()(i="".concat(l,"#")).call(i,u):l}var zt=/^([a-z]+:\/\/|\/\/)/i,Vt=createErrorType("JSONRefError",(function cb(t,r,i){this.originalError=i,p()(this,r||{})})),Ht={},$t=new jt.a,Kt=[function(t){return"paths"===t[0]&&"responses"===t[3]&&"examples"===t[5]},function(t){return"paths"===t[0]&&"responses"===t[3]&&"content"===t[5]&&"example"===t[7]},function(t){return"paths"===t[0]&&"responses"===t[3]&&"content"===t[5]&&"examples"===t[7]&&"value"===t[9]},function(t){return"paths"===t[0]&&"requestBody"===t[3]&&"content"===t[4]&&"example"===t[6]},function(t){return"paths"===t[0]&&"requestBody"===t[3]&&"content"===t[4]&&"examples"===t[6]&&"value"===t[8]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"example"===t[4]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"example"===t[5]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"examples"===t[4]&&"value"===t[6]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"examples"===t[5]&&"value"===t[7]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"content"===t[4]&&"example"===t[6]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"content"===t[4]&&"examples"===t[6]&&"value"===t[8]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"content"===t[4]&&"example"===t[7]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"content"===t[5]&&"examples"===t[7]&&"value"===t[9]}],Gt={key:"$ref",plugin:function plugin(t,r,i,o){var a=o.getInstance(),c=Qe()(i).call(i,0,-1);if(!isFreelyNamed(c)&&!function shouldSkipResolution(t){return Kt.some((function(r){return r(t)}))}(c)){var u=o.getContext(i).baseDoc;if("string"!=typeof t)return new Vt("$ref: must be a string (JSON-Ref)",{$ref:t,baseDoc:u,fullPath:i});var l,d,p,h=split(t),m=h[0],g=h[1]||"";try{l=u||m?absoluteify(m,u):null}catch(r){return wrapError(r,{pointer:g,$ref:t,basePath:l,fullPath:i})}if(function pointerAlreadyInPath(t,r,i,o){var a,c,u=$t.get(o);u||(u={},$t.set(o,u));var l=function arrayToJsonPointer(t){if(0===t.length)return"";return"/".concat(U()(t).call(t,escapeJsonPointerToken).join("/"))}(i),d=V()(a="".concat(r||"<specmap-base>","#")).call(a,t),p=l.replace(/allOf\/\d+\/?/g,""),h=o.contextTree.get([]).baseDoc;if(r===h&&pointerIsAParent(p,t))return!0;var m="";if(i.some((function(t){var r;return m=V()(r="".concat(m,"/")).call(r,escapeJsonPointerToken(t)),u[m]&&u[m].some((function(t){return pointerIsAParent(t,d)||pointerIsAParent(d,t)}))})))return!0;return void(u[p]=V()(c=u[p]||[]).call(c,d))}(g,l,c,o)&&!a.useCircularStructures){var y=absolutifyPointer(t,l);return t===y?null:Rt.replace(i,y)}if(null==l?(p=jsonPointerToArray(g),void 0===(d=o.get(p))&&(d=new Vt("Could not resolve reference: ".concat(t),{pointer:g,$ref:t,baseDoc:u,fullPath:i}))):d=null!=(d=extractFromDoc(l,g)).__value?d.__value:d.catch((function(r){throw wrapError(r,{pointer:g,$ref:t,baseDoc:u,fullPath:i})})),d instanceof Error)return[Rt.remove(i),d];var v=absolutifyPointer(t,l),b=Rt.replace(c,d,{$$ref:v});if(l&&l!==u)return[b,Rt.context(c,{baseDoc:l})];try{if(!function patchValueAlreadyInPath(t,r){var i=[t];return r.path.reduce((function(t,r){return i.push(t[r]),t[r]}),t),function pointToAncestor(t){return Rt.isObject(t)&&(i.indexOf(t)>=0||W()(t).some((function(r){return pointToAncestor(t[r])})))}(r.value)}(o.state,b)||a.useCircularStructures)return b}catch(t){return null}}}},Jt=p()(Gt,{docCache:Ht,absoluteify:absoluteify,clearCache:function clearCache(t){void 0!==t?delete Ht[t]:W()(Ht).forEach((function(t){delete Ht[t]}))},JSONRefError:Vt,wrapError:wrapError,getDoc:getDoc,split:split,extractFromDoc:extractFromDoc,fetchJSON:function fetchJSON(t){return fetch(t,{headers:{Accept:"application/json, application/yaml"},loadSpec:!0}).then((function(t){return t.text()})).then((function(t){return $e.load(t)}))},extract:extract,jsonPointerToArray:jsonPointerToArray,unescapeJsonPointerToken:unescapeJsonPointerToken}),Yt=Jt;function absoluteify(t,r){if(!zt.test(t)){var i;if(!r)throw new Vt(V()(i="Tried to resolve a relative URL, without having a basePath. path: '".concat(t,"' basePath: '")).call(i,r,"'"));return y.a.resolve(r,t)}return t}function wrapError(t,r){var i,o;t&&t.response&&t.response.body?i=V()(o="".concat(t.response.body.code," ")).call(o,t.response.body.message):i=t.message;return new Vt("Could not resolve reference: ".concat(i),r,t)}function split(t){return(t+"").split("#")}function extractFromDoc(t,r){var i=Ht[t];if(i&&!Rt.isPromise(i))try{var o=extract(r,i);return p()(pt.a.resolve(o),{__value:o})}catch(t){return pt.a.reject(t)}return getDoc(t).then((function(t){return extract(r,t)}))}function getDoc(t){var r=Ht[t];return r?Rt.isPromise(r)?r:pt.a.resolve(r):(Ht[t]=Jt.fetchJSON(t).then((function(r){return Ht[t]=r,r})),Ht[t])}function extract(t,r){var i=jsonPointerToArray(t);if(i.length<1)return r;var o=Rt.getIn(r,i);if(void 0===o)throw new Vt("Could not resolve pointer: ".concat(t," does not exist in document"),{pointer:t});return o}function jsonPointerToArray(t){var r;if("string"!=typeof t)throw new TypeError("Expected a string, got a ".concat(w()(t)));return"/"===t[0]&&(t=t.substr(1)),""===t?[]:U()(r=t.split("/")).call(r,unescapeJsonPointerToken)}function unescapeJsonPointerToken(t){return"string"!=typeof t?t:new Dt.a("=".concat(t.replace(/~1/g,"/").replace(/~0/g,"~"))).get("")}function escapeJsonPointerToken(t){var r,i=new Dt.a([["",t.replace(/~/g,"~0").replace(/\//g,"~1")]]);return Qe()(r=i.toString()).call(r,1)}function pointerIsAParent(t,r){if(function pointerBoundaryChar(t){return!t||"/"===t||"#"===t}(r))return!0;var i=t.charAt(r.length),o=Qe()(r).call(r,-1);return 0===t.indexOf(r)&&(!i||"/"===i||"#"===i)&&"#"!==o}var Qt={key:"allOf",plugin:function plugin(t,r,i,o,a){if(!a.meta||!a.meta.$$ref){var c=Qe()(i).call(i,0,-1);if(!isFreelyNamed(c)){if(!Array.isArray(t)){var u=new TypeError("allOf must be an array");return u.fullPath=i,u}var d=!1,p=a.value;if(c.forEach((function(t){p&&(p=p[t])})),p=l()({},p),0!==W()(p).length){delete p.allOf;var h,m=[];if(m.push(o.replace(c,{})),t.forEach((function(t,r){if(!o.isObject(t)){if(d)return null;d=!0;var a=new TypeError("Elements in allOf must be objects");return a.fullPath=i,m.push(a)}m.push(o.mergeDeep(c,t));var u=function generateAbsoluteRefPatches(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.specmap,a=i.getBaseUrlForNodePath,c=void 0===a?function(t){var i;return o.getContext(V()(i=[]).call(i,Je()(r),Je()(t))).baseDoc}:a,u=i.targetKeys,l=void 0===u?["$ref","$$ref"]:u,d=[];return Nt()(t).forEach((function callback(){if(O()(l).call(l,this.key)&&"string"==typeof this.node){var t=this.path,i=V()(r).call(r,this.path),a=absolutifyPointer(this.node,c(t));d.push(o.replace(i,a))}})),d}(t,Qe()(i).call(i,0,-1),{getBaseUrlForNodePath:function getBaseUrlForNodePath(t){var a;return o.getContext(V()(a=[]).call(a,Je()(i),[r],Je()(t))).baseDoc},specmap:o});m.push.apply(m,Je()(u))})),m.push(o.mergeDeep(c,p)),!p.$$ref)m.push(o.remove(V()(h=[]).call(h,c,"$$ref")));return m}}}}},Xt={key:"parameters",plugin:function plugin(t,r,i,o){if(Array.isArray(t)&&t.length){var a=p()([],t),c=Qe()(i).call(i,0,-1),u=l()({},Rt.getIn(o.spec,c));return t.forEach((function(t,r){try{a[r].default=o.parameterMacro(u,t)}catch(t){var c=new Error(t);return c.fullPath=i,c}})),Rt.replace(i,a)}return Rt.replace(i,t)}},Zt={key:"properties",plugin:function plugin(t,r,i,o){var a=l()({},t);for(var c in t)try{a[c].default=o.modelPropertyMacro(a[c])}catch(t){var u=new Error(t);return u.fullPath=i,u}return Rt.replace(i,a)}},er=function(){function ContextTree(t){at()(this,ContextTree),this.root=createNode(t||{})}return ut()(ContextTree,[{key:"set",value:function set(t,r){var i=this.getParent(t,!0);if(i){var o=t[t.length-1],a=i.children;a[o]?updateNode(a[o],r,i):a[o]=createNode(r,i)}else updateNode(this.root,r,null)}},{key:"get",value:function get(t){if((t=t||[]).length<1)return this.root.value;for(var r,i,o=this.root,a=0;a<t.length&&(i=t[a],(r=o.children)[i]);a+=1)o=r[i];return o&&o.protoValue}},{key:"getParent",value:function getParent(t,r){return!t||t.length<1?null:t.length<2?this.root:Qe()(t).call(t,0,-1).reduce((function(t,i){if(!t)return t;var o=t.children;return!o[i]&&r&&(o[i]=createNode(null,t)),o[i]}),this.root)}}]),ContextTree}();function createNode(t,r){return updateNode({children:{}},t,r)}function updateNode(t,r,i){return t.value=r||{},t.protoValue=i?l()(l()({},i.protoValue),t.value):t.value,W()(t.children).forEach((function(r){var i=t.children[r];t.children[r]=updateNode(i,i.value,t)})),t}var tr=function noop(){},rr=function(){function SpecMap(t){var r,i,o=this;at()(this,SpecMap),p()(this,{spec:"",debugLevel:"info",plugins:[],pluginHistory:{},errors:[],mutations:[],promisedPatches:[],state:{},patches:[],context:{},contextTree:new er,showDebug:!1,allPatches:[],pluginProp:"specMap",libMethods:p()(Object.create(this),Rt,{getInstance:function getInstance(){return o}}),allowMetaPatches:!1},t),this.get=this._get.bind(this),this.getContext=this._getContext.bind(this),this.hasRun=this._hasRun.bind(this),this.wrappedPlugins=G()(r=U()(i=this.plugins).call(i,this.wrapPlugin.bind(this))).call(r,Rt.isFunction),this.patches.push(Rt.add([],this.spec)),this.patches.push(Rt.context([],this.context)),this.updatePatches(this.patches)}return ut()(SpecMap,[{key:"debug",value:function debug(t){if(this.debugLevel===t){for(var r,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];(r=console).log.apply(r,o)}}},{key:"verbose",value:function verbose(t){if("verbose"===this.debugLevel){for(var r,i,o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];(r=console).log.apply(r,V()(i=["[".concat(t,"] ")]).call(i,a))}}},{key:"wrapPlugin",value:function wrapPlugin(t,r){var i,o=this.pathDiscriminator,a=null;return t[this.pluginProp]?(a=t,i=t[this.pluginProp]):Rt.isFunction(t)?i=t:Rt.isObject(t)&&(i=function createKeyBasedPlugin(t){var r=function isSubPath(t,r){return!Array.isArray(t)||t.every((function(t,i){return t===r[i]}))};return C.a.mark((function generator(i,a){var c,u,l,d,p,h;return C.a.wrap((function generator$(m){for(;;)switch(m.prev=m.next){case 0:h=function _traverse(i,l,d){var p,m,g,y,v,b,_,w,S,I,k,x,P;return C.a.wrap((function traverse$(c){for(;;)switch(c.prev=c.next){case 0:if(Rt.isObject(i)){c.next=6;break}if(t.key!==l[l.length-1]){c.next=4;break}return c.next=4,t.plugin(i,t.key,l,a);case 4:c.next=30;break;case 6:p=l.length-1,m=l[p],g=l.indexOf("properties"),y="properties"===m&&p===g,v=a.allowMetaPatches&&u[i.$$ref],b=0,_=W()(i);case 12:if(!(b<_.length)){c.next=30;break}if(w=_[b],S=i[w],I=V()(l).call(l,w),k=Rt.isObject(S),x=i.$$ref,v){c.next=22;break}if(!k){c.next=22;break}return a.allowMetaPatches&&x&&(u[x]=!0),c.delegateYield(h(S,I,d),"t0",22);case 22:if(y||w!==t.key){c.next=27;break}if(P=r(o,l),o&&!P){c.next=27;break}return c.next=27,t.plugin(S,w,I,a,d);case 27:b++,c.next=12;break;case 30:case"end":return c.stop()}}),c)},c=C.a.mark(h),u={},l=b()(G()(i).call(i,Rt.isAdditiveMutation)),m.prev=4,l.s();case 6:if((d=l.n()).done){m.next=11;break}return p=d.value,m.delegateYield(h(p.value,p.path,p),"t0",9);case 9:m.next=6;break;case 11:m.next=16;break;case 13:m.prev=13,m.t1=m.catch(4),l.e(m.t1);case 16:return m.prev=16,l.f(),m.finish(16);case 19:case"end":return m.stop()}}),generator,null,[[4,13,16,19]])}))}(t)),p()(i.bind(a),{pluginName:t.name||r,isGenerator:Rt.isGenerator(i)})}},{key:"nextPlugin",value:function nextPlugin(){var t,r=this;return ft()(t=this.wrappedPlugins).call(t,(function(t){return r.getMutationsForPlugin(t).length>0}))}},{key:"nextPromisedPatch",value:function nextPromisedPatch(){var t;if(this.promisedPatches.length>0)return pt.a.race(U()(t=this.promisedPatches).call(t,(function(t){return t.value})))}},{key:"getPluginHistory",value:function getPluginHistory(t){var r=this.constructor.getPluginName(t);return this.pluginHistory[r]||[]}},{key:"getPluginRunCount",value:function getPluginRunCount(t){return this.getPluginHistory(t).length}},{key:"getPluginHistoryTip",value:function getPluginHistoryTip(t){var r=this.getPluginHistory(t);return r&&r[r.length-1]||{}}},{key:"getPluginMutationIndex",value:function getPluginMutationIndex(t){var r=this.getPluginHistoryTip(t).mutationIndex;return"number"!=typeof r?-1:r}},{key:"updatePluginHistory",value:function updatePluginHistory(t,r){var i=this.constructor.getPluginName(t);this.pluginHistory[i]=this.pluginHistory[i]||[],this.pluginHistory[i].push(r)}},{key:"updatePatches",value:function updatePatches(t){var r=this;Rt.normalizeArray(t).forEach((function(t){if(t instanceof Error)r.errors.push(t);else try{if(!Rt.isObject(t))return void r.debug("updatePatches","Got a non-object patch",t);if(r.showDebug&&r.allPatches.push(t),Rt.isPromise(t.value))return r.promisedPatches.push(t),void r.promisedPatchThen(t);if(Rt.isContextPatch(t))return void r.setContext(t.path,t.value);if(Rt.isMutation(t))return void r.updateMutations(t)}catch(t){console.error(t),r.errors.push(t)}}))}},{key:"updateMutations",value:function updateMutations(t){"object"===w()(t.value)&&!Array.isArray(t.value)&&this.allowMetaPatches&&(t.value=l()({},t.value));var r=Rt.applyPatch(this.state,t,{allowMetaPatches:this.allowMetaPatches});r&&(this.mutations.push(t),this.state=r)}},{key:"removePromisedPatch",value:function removePromisedPatch(t){var r,i=this.promisedPatches.indexOf(t);i<0?this.debug("Tried to remove a promisedPatch that isn't there!"):mt()(r=this.promisedPatches).call(r,i,1)}},{key:"promisedPatchThen",value:function promisedPatchThen(t){var r=this;return t.value=t.value.then((function(i){var o=l()(l()({},t),{},{value:i});r.removePromisedPatch(t),r.updatePatches(o)})).catch((function(i){r.removePromisedPatch(t),r.updatePatches(i)})),t.value}},{key:"getMutations",value:function getMutations(t,r){var i;return t=t||0,"number"!=typeof r&&(r=this.mutations.length),Qe()(i=this.mutations).call(i,t,r)}},{key:"getCurrentMutations",value:function getCurrentMutations(){return this.getMutationsForPlugin(this.getCurrentPlugin())}},{key:"getMutationsForPlugin",value:function getMutationsForPlugin(t){var r=this.getPluginMutationIndex(t);return this.getMutations(r+1)}},{key:"getCurrentPlugin",value:function getCurrentPlugin(){return this.currentPlugin}},{key:"getLib",value:function getLib(){return this.libMethods}},{key:"_get",value:function _get(t){return Rt.getIn(this.state,t)}},{key:"_getContext",value:function _getContext(t){return this.contextTree.get(t)}},{key:"setContext",value:function setContext(t,r){return this.contextTree.set(t,r)}},{key:"_hasRun",value:function _hasRun(t){return this.getPluginRunCount(this.getCurrentPlugin())>(t||0)}},{key:"dispatch",value:function dispatch(){var t,r=this,i=this,o=this.nextPlugin();if(!o){var a=this.nextPromisedPatch();if(a)return a.then((function(){return r.dispatch()})).catch((function(){return r.dispatch()}));var c={spec:this.state,errors:this.errors};return this.showDebug&&(c.patches=this.allPatches),pt.a.resolve(c)}if(i.pluginCount=i.pluginCount||{},i.pluginCount[o]=(i.pluginCount[o]||0)+1,i.pluginCount[o]>100)return pt.a.resolve({spec:i.state,errors:V()(t=i.errors).call(t,new Error("We've reached a hard limit of ".concat(100," plugin runs")))});if(o!==this.currentPlugin&&this.promisedPatches.length){var u,l=U()(u=this.promisedPatches).call(u,(function(t){return t.value}));return pt.a.all(U()(l).call(l,(function(t){return t.then(tr,tr)}))).then((function(){return r.dispatch()}))}return function executePlugin(){i.currentPlugin=o;var t=i.getCurrentMutations(),r=i.mutations.length-1;try{if(o.isGenerator){var a,c=b()(o(t,i.getLib()));try{for(c.s();!(a=c.n()).done;){updatePatches(a.value)}}catch(t){c.e(t)}finally{c.f()}}else{updatePatches(o(t,i.getLib()))}}catch(t){console.error(t),updatePatches([p()(Object.create(t),{plugin:o})])}finally{i.updatePluginHistory(o,{mutationIndex:r})}return i.dispatch()}();function updatePatches(t){t&&(t=Rt.fullyNormalizeArray(t),i.updatePatches(t,o))}}}],[{key:"getPluginName",value:function getPluginName(t){return t.pluginName}},{key:"getPatchesOfType",value:function getPatchesOfType(t,r){return G()(t).call(t,r)}}]),SpecMap}();var nr={refs:Yt,allOf:Qt,parameters:Xt,properties:Zt},ir=function toLower(t){return String.prototype.toLowerCase.call(t)},or=function escapeString(t){return t.replace(/[^\w]/gi,"_")};function isOAS3(t){var r=t.openapi;return!!r&&m()(r).call(r,"3")}function opId(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=o.v2OperationIdCompatibilityMode;if(!t||"object"!==w()(t))return null;var c=(t.operationId||"").replace(/\s/g,"");return c.length?or(t.operationId):idFromPathMethod(r,i,{v2OperationIdCompatibilityMode:a})}function idFromPathMethod(t,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.v2OperationIdCompatibilityMode;if(a){var c,u,l=V()(c="".concat(r.toLowerCase(),"_")).call(c,t).replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return(l=l||V()(u="".concat(t.substring(1),"_")).call(u,r)).replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return V()(i="".concat(ir(r))).call(i,or(t))}function legacyIdFromPathMethod(t,r){var i;return V()(i="".concat(ir(r),"-")).call(i,t)}function getOperationRaw(t,r){return t&&t.paths?function findOperation(t,r){return eachOperation(t,r,!0)||null}(t,(function(t){var i=t.pathName,o=t.method,a=t.operation;if(!a||"object"!==w()(a))return!1;var c=a.operationId;return[opId(a,i,o),legacyIdFromPathMethod(i,o),c].some((function(t){return t&&t===r}))})):null}function eachOperation(t,r,i){if(!t||"object"!==w()(t)||!t.paths||"object"!==w()(t.paths))return null;var o=t.paths;for(var a in o)for(var c in o[a])if("PARAMETERS"!==c.toUpperCase()){var u=o[a][c];if(u&&"object"===w()(u)){var l={spec:t,pathName:a,method:c.toUpperCase(),operation:u},d=r(l);if(i&&d)return l}}}function normalizeSwagger(t){var r=t.spec,i=r.paths,o={};if(!i||r.$$normalized)return t;for(var a in i){var c,u=i[a];if(null!=u&&O()(c=["object","function"]).call(c,w()(u))){var l=u.parameters,d=function _loop(t){var i,c=u[t];if(null==u||!O()(i=["object","function"]).call(i,w()(u)))return"continue";var d=opId(c,a,t);if(d){o[d]?o[d].push(c):o[d]=[c];var p=o[d];if(p.length>1)p.forEach((function(t,r){var i;t.__originalOperationId=t.__originalOperationId||t.operationId,t.operationId=V()(i="".concat(d)).call(i,r+1)}));else if(void 0!==c.operationId){var h=p[0];h.__originalOperationId=h.__originalOperationId||c.operationId,h.operationId=d}}if("parameters"!==t){var m=[],g={};for(var y in r)"produces"!==y&&"consumes"!==y&&"security"!==y||(g[y]=r[y],m.push(g));if(l&&(g.parameters=l,m.push(g)),m.length){var v,_=b()(m);try{for(_.s();!(v=_.n()).done;){var S=v.value;for(var I in S)if(c[I]){if("parameters"===I){var k,x=b()(S[I]);try{var P=function _loop2(){var t=k.value;c[I].some((function(r){return r.name&&r.name===t.name||r.$ref&&r.$ref===t.$ref||r.$$ref&&r.$$ref===t.$$ref||r===t}))||c[I].push(t)};for(x.s();!(k=x.n()).done;)P()}catch(t){x.e(t)}finally{x.f()}}}else c[I]=S[I]}}catch(t){_.e(t)}finally{_.f()}}}};for(var p in u)d(p)}}return r.$$normalized=!0,t}function makeFetchJSON(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.requestInterceptor,o=r.responseInterceptor,a=t.withCredentials?"include":"same-origin";return function(r){return t({url:r,loadSpec:!0,requestInterceptor:i,responseInterceptor:o,headers:{Accept:"application/json, application/yaml"},credentials:a}).then((function(t){return t.body}))}}function resolver_resolve(t){var r=t.fetch,i=t.spec,o=t.url,a=t.mode,c=t.allowMetaPatches,u=void 0===c||c,l=t.pathDiscriminator,d=t.modelPropertyMacro,p=t.parameterMacro,h=t.requestInterceptor,m=t.responseInterceptor,g=t.skipNormalization,y=t.useCircularStructures,v=t.http,b=t.baseDoc;return b=b||o,v=r||v||http_http,i?doResolve(i):makeFetchJSON(v,{requestInterceptor:h,responseInterceptor:m})(b).then(doResolve);function doResolve(t){b&&(nr.refs.docCache[b]=t),nr.refs.fetchJSON=makeFetchJSON(v,{requestInterceptor:h,responseInterceptor:m});var r=[nr.refs];return"function"==typeof p&&r.push(nr.parameters),"function"==typeof d&&r.push(nr.properties),"strict"!==a&&r.push(nr.allOf),function mapSpec(t){return new rr(t).dispatch()}({spec:t,context:{baseDoc:b},plugins:r,allowMetaPatches:u,pathDiscriminator:l,parameterMacro:p,modelPropertyMacro:d,useCircularStructures:y}).then(g?function(){var t=x()(C.a.mark((function _callee(t){return C.a.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",t);case 1:case"end":return r.stop()}}),_callee)})));return function(r){return t.apply(this,arguments)}}():normalizeSwagger)}}var sr=i(61),ar=i.n(sr);function _resolveSubtree(){return(_resolveSubtree=x()(C.a.mark((function _callee(t,r){var i,o,a,c,u,d,p,h,m,g,y,v,b=arguments;return C.a.wrap((function _callee$(_){for(;;)switch(_.prev=_.next){case 0:return i=b.length>2&&void 0!==b[2]?b[2]:{},o=i.returnEntireTree,a=i.baseDoc,c=i.requestInterceptor,u=i.responseInterceptor,d=i.parameterMacro,p=i.modelPropertyMacro,h=i.useCircularStructures,m={pathDiscriminator:r,baseDoc:a,requestInterceptor:c,responseInterceptor:u,parameterMacro:d,modelPropertyMacro:p,useCircularStructures:h},g=normalizeSwagger({spec:t}),y=g.spec,_.next=6,resolver_resolve(l()(l()({},m),{},{spec:y,allowMetaPatches:!0,skipNormalization:!0}));case 6:return v=_.sent,!o&&Array.isArray(r)&&r.length&&(v.spec=ar()(v.spec,r)||null),_.abrupt("return",v);case 9:case"end":return _.stop()}}),_callee)})))).apply(this,arguments)}var cr=function nullFn(){return null},ur={mapTagOperations:function mapTagOperations(t){var r=t.spec,i=t.cb,o=void 0===i?cr:i,a=t.defaultTag,c=void 0===a?"default":a,u=t.v2OperationIdCompatibilityMode,l={},d={};return eachOperation(r,(function(t){var i=t.pathName,a=t.method,p=t.operation;(p.tags?function normalizeArray(t){return Array.isArray(t)?t:[t]}(p.tags):[c]).forEach((function(t){if("string"==typeof t){d[t]=d[t]||{};var c,h=d[t],m=opId(p,i,a,{v2OperationIdCompatibilityMode:u}),g=o({spec:r,pathName:i,method:a,operation:p,operationId:m});if(l[m])l[m]+=1,h[V()(c="".concat(m)).call(c,l[m])]=g;else if(void 0!==h[m]){var y,v,b=l[m]||1;l[m]=b+1,h[V()(y="".concat(m)).call(y,l[m])]=g;var _=h[m];delete h[m],h[V()(v="".concat(m)).call(v,b)]=_}else h[m]=g}}))})),d},makeExecute:function makeExecute(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var i=r.pathName,o=r.method,a=r.operationId;return function(r){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=t.requestInterceptor,d=t.responseInterceptor,p=t.userFetch;return t.execute(l()({spec:t.spec,requestInterceptor:u,responseInterceptor:d,userFetch:p,pathName:i,method:o,parameters:r,operationId:a},c))}}}};var lr=i(352),fr=i.n(lr),dr=i(353),pr=i.n(dr);function is_plain_object_isObject(t){return"[object Object]"===Object.prototype.toString.call(t)}function isPlainObject(t){var r,i;return!1!==is_plain_object_isObject(t)&&(void 0===(r=t.constructor)||!1!==is_plain_object_isObject(i=r.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf"))}var hr={body:function bodyBuilder(t){var r=t.req,i=t.value;r.body=i},header:function headerBuilder(t){var r=t.req,i=t.parameter,o=t.value;r.headers=r.headers||{},void 0!==o&&(r.headers[i.name]=o)},query:function queryBuilder(t){var r=t.req,i=t.value,o=t.parameter;r.query=r.query||{},!1===i&&"boolean"===o.type&&(i="false");0===i&&["number","integer"].indexOf(o.type)>-1&&(i="0");if(i)r.query[o.name]={collectionFormat:o.collectionFormat,value:i};else if(o.allowEmptyValue&&void 0!==i){var a=o.name;r.query[a]=r.query[a]||{},r.query[a].allowEmptyValue=!0}},path:function pathBuilder(t){var r=t.req,i=t.value,o=t.parameter;r.url=r.url.split("{".concat(o.name,"}")).join(encodeURIComponent(i))},formData:function formDataBuilder(t){var r=t.req,i=t.value,o=t.parameter;(i||o.allowEmptyValue)&&(r.form=r.form||{},r.form[o.name]={value:i,allowEmptyValue:o.allowEmptyValue,collectionFormat:o.collectionFormat})}};function serialize(t,r){return O()(r).call(r,"application/json")?"string"==typeof t?t:B()(t):t.toString()}function parameter_builders_path(t){var r=t.req,i=t.value,o=t.parameter,a=o.name,c=o.style,u=o.explode,l=o.content;if(l){var d=W()(l)[0];r.url=r.url.split("{".concat(a,"}")).join(encodeDisallowedCharacters(serialize(i,d),{escape:!0}))}else{var p=stylize({key:o.name,value:i,style:c||"simple",explode:u||!1,escape:!0});r.url=r.url.split("{".concat(a,"}")).join(p)}}function parameter_builders_query(t){var r=t.req,i=t.value,o=t.parameter;if(r.query=r.query||{},o.content){var a=W()(o.content)[0];r.query[o.name]=serialize(i,a)}else if(!1===i&&(i="false"),0===i&&(i="0"),i){var c=o.style,u=o.explode,l=o.allowReserved;r.query[o.name]={value:i,serializationOption:{style:c,explode:u,allowReserved:l}}}else if(o.allowEmptyValue&&void 0!==i){var d=o.name;r.query[d]=r.query[d]||{},r.query[d].allowEmptyValue=!0}}var mr=["accept","authorization","content-type"];function parameter_builders_header(t){var r=t.req,i=t.parameter,o=t.value;if(r.headers=r.headers||{},!(mr.indexOf(i.name.toLowerCase())>-1))if(i.content){var a=W()(i.content)[0];r.headers[i.name]=serialize(o,a)}else void 0!==o&&(r.headers[i.name]=stylize({key:i.name,value:o,style:i.style||"simple",explode:void 0!==i.explode&&i.explode,escape:!1}))}function parameter_builders_cookie(t){var r=t.req,i=t.parameter,o=t.value;r.headers=r.headers||{};var a=w()(o);if(i.content){var c,u=W()(i.content)[0];r.headers.Cookie=V()(c="".concat(i.name,"=")).call(c,serialize(o,u))}else if("undefined"!==a){var l="object"===a&&!Array.isArray(o)&&i.explode?"":"".concat(i.name,"=");r.headers.Cookie=l+stylize({key:i.name,value:o,escape:!1,style:i.style||"form",explode:void 0!==i.explode&&i.explode})}}var gr=i(159),yr=i.n(gr);function buildRequest(t,r){var i=t.operation,o=t.requestBody,a=t.securities,c=t.spec,u=t.attachContentTypeForEmptyPayload,d=t.requestContentType;r=function applySecurities(t){var r=t.request,i=t.securities,o=void 0===i?{}:i,a=t.operation,c=void 0===a?{}:a,u=t.spec,d=l()({},r),p=o.authorized,h=void 0===p?{}:p,m=c.security||u.security||[],g=h&&!!W()(h).length,y=ar()(u,["components","securitySchemes"])||{};if(d.headers=d.headers||{},d.query=d.query||{},!W()(o).length||!g||!m||Array.isArray(c.security)&&!c.security.length)return r;return m.forEach((function(t){W()(t).forEach((function(t){var r=h[t],i=y[t];if(r){var o=r.value||r,a=i.type;if(r)if("apiKey"===a)"query"===i.in&&(d.query[i.name]=o),"header"===i.in&&(d.headers[i.name]=o),"cookie"===i.in&&(d.cookies[i.name]=o);else if("http"===a){if(/^basic$/i.test(i.scheme)){var c,u=o.username||"",l=o.password||"",p=yr()(V()(c="".concat(u,":")).call(c,l));d.headers.Authorization="Basic ".concat(p)}/^bearer$/i.test(i.scheme)&&(d.headers.Authorization="Bearer ".concat(o))}else if("oauth2"===a||"openIdConnect"===a){var m,g=r.token||{},v=g[i["x-tokenName"]||"access_token"],b=g.token_type;b&&"bearer"!==b.toLowerCase()||(b="Bearer"),d.headers.Authorization=V()(m="".concat(b," ")).call(m,v)}}}))})),d}({request:r,securities:a,operation:i,spec:c});var p=i.requestBody||{},h=W()(p.content||{}),m=d&&h.indexOf(d)>-1;if(o||u){if(d&&m)r.headers["Content-Type"]=d;else if(!d){var g=h[0];g&&(r.headers["Content-Type"]=g,d=g)}}else d&&m&&(r.headers["Content-Type"]=d);if(!t.responseContentType&&i.responses){var y,v=G()(y=$()(i.responses)).call(y,(function(t){var r=I()(t,2),i=r[0],o=r[1],a=parseInt(i,10);return a>=200&&a<300&&isPlainObject(o.content)})).reduce((function(t,r){var i=I()(r,2)[1];return V()(t).call(t,W()(i.content))}),[]);v.length>0&&(r.headers.accept=v.join(", "))}if(o)if(d){if(h.indexOf(d)>-1)if("application/x-www-form-urlencoded"===d||"multipart/form-data"===d)if("object"===w()(o)){var b=(p.content[d]||{}).encoding||{};r.form={},W()(o).forEach((function(t){r.form[t]={value:o[t],encoding:b[t]||{}}}))}else r.form=o;else r.body=o}else r.body=o;return r}function build_request_buildRequest(t,r){var i,o,a=t.spec,c=t.operation,u=t.securities,d=t.requestContentType,p=t.responseContentType,h=t.attachContentTypeForEmptyPayload;if((r=function build_request_applySecurities(t){var r=t.request,i=t.securities,o=void 0===i?{}:i,a=t.operation,c=void 0===a?{}:a,u=t.spec,d=l()({},r),p=o.authorized,h=void 0===p?{}:p,m=o.specSecurity,g=void 0===m?[]:m,y=c.security||g,v=h&&!!W()(h).length,b=u.securityDefinitions;if(d.headers=d.headers||{},d.query=d.query||{},!W()(o).length||!v||!y||Array.isArray(c.security)&&!c.security.length)return r;return y.forEach((function(t){W()(t).forEach((function(t){var r=h[t];if(r){var i=r.token,o=r.value||r,a=b[t],c=a.type,u=a["x-tokenName"]||"access_token",l=i&&i[u],p=i&&i.token_type;if(r)if("apiKey"===c){var m="query"===a.in?"query":"headers";d[m]=d[m]||{},d[m][a.name]=o}else if("basic"===c)if(o.header)d.headers.authorization=o.header;else{var g,y=o.username||"",v=o.password||"";o.base64=yr()(V()(g="".concat(y,":")).call(g,v)),d.headers.authorization="Basic ".concat(o.base64)}else if("oauth2"===c&&l){var _;p=p&&"bearer"!==p.toLowerCase()?p:"Bearer",d.headers.authorization=V()(_="".concat(p," ")).call(_,l)}}}))})),d}({request:r,securities:u,operation:c,spec:a})).body||r.form||h)if(d)r.headers["Content-Type"]=d;else if(Array.isArray(c.consumes)){var m=I()(c.consumes,1);r.headers["Content-Type"]=m[0]}else if(Array.isArray(a.consumes)){var g=I()(a.consumes,1);r.headers["Content-Type"]=g[0]}else c.parameters&&G()(i=c.parameters).call(i,(function(t){return"file"===t.type})).length?r.headers["Content-Type"]="multipart/form-data":c.parameters&&G()(o=c.parameters).call(o,(function(t){return"formData"===t.in})).length&&(r.headers["Content-Type"]="application/x-www-form-urlencoded");else if(d){var y,v,b=c.parameters&&G()(y=c.parameters).call(y,(function(t){return"body"===t.in})).length>0,_=c.parameters&&G()(v=c.parameters).call(v,(function(t){return"formData"===t.in})).length>0;(b||_)&&(r.headers["Content-Type"]=d)}return!p&&Array.isArray(c.produces)&&c.produces.length>0&&(r.headers.accept=c.produces.join(", ")),r}var vr=["http","fetch","spec","operationId","pathName","method","parameters","securities"],br=function arrayOrEmpty(t){return Array.isArray(t)?t:[]},_r=createErrorType("OperationNotFoundError",(function cb(t,r,i){this.originalError=i,p()(this,r||{})})),wr={buildRequest:execute_buildRequest};function execute_buildRequest(t){var r,i,o=t.spec,a=t.operationId,u=t.responseContentType,d=t.scheme,p=t.requestInterceptor,h=t.responseInterceptor,m=t.contextUrl,g=t.userFetch,y=t.server,v=t.serverVariables,b=t.http,_=t.signal,w=t.parameters,S=t.parameterBuilders,I=isOAS3(o);S||(S=I?c:hr);var k={url:"",credentials:b&&b.withCredentials?"include":"same-origin",headers:{},cookies:{}};_&&(k.signal=_),p&&(k.requestInterceptor=p),h&&(k.responseInterceptor=h),g&&(k.userFetch=g);var x=getOperationRaw(o,a);if(!x)throw new _r("Operation ".concat(a," not found"));var P=x.operation,C=void 0===P?{}:P,A=x.method,O=x.pathName;if(k.url+=execute_baseUrl({spec:o,scheme:d,contextUrl:m,server:y,serverVariables:v,pathName:O,method:A}),!a)return delete k.cookies,k;k.url+=O,k.method="".concat(A).toUpperCase(),w=w||{};var R=o.paths[O]||{};u&&(k.headers.accept=u);var M=function deduplicateParameters(t){var r={};t.forEach((function(t){r[t.in]||(r[t.in]={}),r[t.in][t.name]=t}));var i=[];return W()(r).forEach((function(t){W()(r[t]).forEach((function(o){i.push(r[t][o])}))})),i}(V()(r=V()(i=[]).call(i,br(C.parameters))).call(r,br(R.parameters)));M.forEach((function(t){var r,i,a=S[t.in];if("body"===t.in&&t.schema&&t.schema.properties&&(r=w),void 0===(r=t&&t.name&&w[t.name]))r=t&&t.name&&w[V()(i="".concat(t.in,".")).call(i,t.name)];else if(function findParametersWithName(t,r){return G()(r).call(r,(function(r){return r.name===t}))}(t.name,M).length>1){var c;console.warn(V()(c="Parameter '".concat(t.name,"' is ambiguous because the defined spec has more than one parameter with the name: '")).call(c,t.name,"' and the passed-in parameter values did not define an 'in' value."))}if(null!==r){if(void 0!==t.default&&void 0===r&&(r=t.default),void 0===r&&t.required&&!t.allowEmptyValue)throw new Error("Required parameter ".concat(t.name," is not provided"));if(I&&t.schema&&"object"===t.schema.type&&"string"==typeof r)try{r=JSON.parse(r)}catch(t){throw new Error("Could not parse object parameter value string as JSON")}a&&a({req:k,parameter:t,value:r,operation:C,spec:o})}}));var j=l()(l()({},t),{},{operation:C});if((k=I?buildRequest(j,k):build_request_buildRequest(j,k)).cookies&&W()(k.cookies).length){var L=W()(k.cookies).reduce((function(t,r){var i=k.cookies[r];return t+(t?"&":"")+pr.a.serialize(r,i)}),"");k.headers.Cookie=L}return k.cookies&&delete k.cookies,mergeInQueryOrForm(k),k}var Sr=function stripNonAlpha(t){return t?t.replace(/\W/g,""):null};function execute_baseUrl(t){return isOAS3(t.spec)?function oas3BaseUrl(t){var r=t.spec,i=t.pathName,o=t.method,a=t.server,c=t.contextUrl,u=t.serverVariables,l=void 0===u?{}:u,d=ar()(r,["paths",i,(o||"").toLowerCase(),"servers"])||ar()(r,["paths",i,"servers"])||ar()(r,["servers"]),p="",h=null;if(a&&d&&d.length){var m=U()(d).call(d,(function(t){return t.url}));m.indexOf(a)>-1&&(p=a,h=d[m.indexOf(a)])}if(!p&&d&&d.length){p=d[0].url;var g=I()(d,1);h=g[0]}if(p.indexOf("{")>-1){(function getVariableTemplateNames(t){var r,i=[],o=/{([^}]+)}/g;for(;r=o.exec(t);)i.push(r[1]);return i})(p).forEach((function(t){if(h.variables&&h.variables[t]){var r=h.variables[t],i=l[t]||r.default,o=new RegExp("{".concat(t,"}"),"g");p=p.replace(o,i)}}))}return function buildOas3UrlWithContext(){var t,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=i&&o?y.a.parse(y.a.resolve(o,i)):y.a.parse(i),c=y.a.parse(o),u=Sr(a.protocol)||Sr(c.protocol)||"",l=a.host||c.host,d=a.pathname||"";t=u&&l?V()(r="".concat(u,"://")).call(r,l+d):d;return"/"===t[t.length-1]?Qe()(t).call(t,0,-1):t}(p,c)}(t):function swagger2BaseUrl(t){var r,i,o=t.spec,a=t.scheme,c=t.contextUrl,u=void 0===c?"":c,l=y.a.parse(u),d=Array.isArray(o.schemes)?o.schemes[0]:null,p=a||d||Sr(l.protocol)||"http",h=o.host||l.host||"",m=o.basePath||"";r=p&&h?V()(i="".concat(p,"://")).call(i,h+m):m;return"/"===r[r.length-1]?Qe()(r).call(r,0,-1):r}(t)}function Swagger(t){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t?i.url=t:i=t,!(this instanceof Swagger))return new Swagger(i);p()(this,i);var o=this.resolve().then((function(){return r.disableInterfaces||p()(r,Swagger.makeApisTagOperation(r)),r}));return o.client=this,o}Swagger.http=http_http,Swagger.makeHttp=function makeHttp(t,r,i){return i=i||function(t){return t},r=r||function(t){return t},function(o){return"string"==typeof o&&(o={url:o}),tt.mergeInQueryOrForm(o),o=r(o),i(t(o))}}.bind(null,Swagger.http),Swagger.resolve=resolver_resolve,Swagger.resolveSubtree=function resolveSubtree(t,r){return _resolveSubtree.apply(this,arguments)},Swagger.execute=function execute_execute(t){var r=t.http,i=t.fetch,o=t.spec,a=t.operationId,c=t.pathName,u=t.method,d=t.parameters,p=t.securities,h=fr()(t,vr),m=r||i||http_http;c&&u&&!a&&(a=legacyIdFromPathMethod(c,u));var g=wr.buildRequest(l()({spec:o,operationId:a,parameters:d,securities:p,http:m},h));return g.body&&(isPlainObject(g.body)||Array.isArray(g.body))&&(g.body=B()(g.body)),m(g)},Swagger.serializeRes=serializeRes,Swagger.serializeHeaders=serializeHeaders,Swagger.clearCache=function resolver_clearCache(){nr.refs.clearCache()},Swagger.makeApisTagOperation=function makeApisTagOperation(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=ur.makeExecute(t);return{apis:ur.mapTagOperations({v2OperationIdCompatibilityMode:t.v2OperationIdCompatibilityMode,spec:t.spec,cb:r})}},Swagger.buildRequest=execute_buildRequest,Swagger.helpers={opId:opId},Swagger.getBaseUrl=execute_baseUrl,Swagger.prototype={http:http_http,execute:function execute(t){return this.applyDefaults(),Swagger.execute(l()({spec:this.spec,http:this.http,securities:{authorized:this.authorizations},contextUrl:"string"==typeof this.url?this.url:void 0,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null},t))},resolve:function resolve(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Swagger.resolve(l()({spec:this.spec,url:this.url,http:this.http||this.fetch,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null,skipNormalization:this.skipNormalization||!1},r)).then((function(r){return t.originalSpec=t.spec,t.spec=r.spec,t.errors=r.errors,t}))}},Swagger.prototype.applyDefaults=function applyDefaults(){var t=this.spec,r=this.url;if(r&&m()(r).call(r,"http")){var i=y.a.parse(r);t.host||(t.host=i.host),t.schemes||(t.schemes=[i.protocol.replace(":","")]),t.basePath||(t.basePath="/")}};Swagger.helpers,r.a=Swagger},function(t,r,i){"use strict";var o=i(362);t.exports=o},function(t,r,i){"use strict";var o=i(20),a=i(18),c=i(100),u=i(163),l=i(364),d=i(10),p=TypeError,h=d("toPrimitive");t.exports=function(t,r){if(!a(t)||c(t))return t;var i,d=u(t,h);if(d){if(void 0===r&&(r="default"),i=o(d,t,r),!a(i)||c(i))return i;throw new p("Can't convert object to primitive value")}return void 0===r&&(r="number"),l(t,r)}},function(t,r,i){"use strict";var o=i(79);t.exports=o&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,r,i){"use strict";var o=i(13),a=i(8),c=i(164);t.exports=!o&&!a((function(){return 7!==Object.defineProperty(c("div"),"a",{get:function(){return 7}}).a}))},function(t,r,i){"use strict";var o=i(8),a=i(12),c=/#|\.prototype\./,isForced=function(t,r){var i=l[u(t)];return i===p||i!==d&&(a(r)?o(r):!!r)},u=isForced.normalize=function(t){return String(t).replace(c,".").toLowerCase()},l=isForced.data={},d=isForced.NATIVE="N",p=isForced.POLYFILL="P";t.exports=isForced},function(t,r,i){"use strict";var o=i(13),a=i(8);t.exports=o&&a((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},function(t,r,i){"use strict";var o=i(9),a=i(21),c=i(38),u=i(165).indexOf,l=i(103),d=o([].push);t.exports=function(t,r){var i,o=c(t),p=0,h=[];for(i in o)!a(l,i)&&a(o,i)&&d(h,i);for(;r.length>p;)a(o,i=r[p++])&&(~u(h,i)||d(h,i));return h}},function(t,r,i){"use strict";t.exports=i(367)},function(t,r,i){"use strict";i(371),i(374),i(375),i(235),i(377)},function(t,r,i){"use strict";var o=i(28);t.exports=o("document","documentElement")},function(t,r,i){"use strict";var o=i(43),a=i(38),c=i(129).f,u=i(83),l="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function getOwnPropertyNames(t){return l&&"Window"===o(t)?function(t){try{return c(t)}catch(t){return u(l)}}(t):c(a(t))}},function(t,r,i){"use strict";var o=i(20),a=i(28),c=i(10),u=i(48);t.exports=function(){var t=a("Symbol"),r=t&&t.prototype,i=r&&r.valueOf,l=c("toPrimitive");r&&!r[l]&&u(r,l,(function(t){return o(i,this)}),{arity:1})}},function(t,r,i){"use strict";var o=i(11),a=i(12),c=o.WeakMap;t.exports=a(c)&&/native code/.test(String(c))},function(t,r,i){"use strict";var o=i(9),a=i(12),c=i(126),u=o(Function.toString);a(c.inspectSource)||(c.inspectSource=function(t){return u(t)}),t.exports=c.inspectSource},function(t,r,i){"use strict";var o=i(79);t.exports=o&&!!Symbol.for&&!!Symbol.keyFor},function(t,r,i){"use strict";var o=i(1),a=i(28),c=i(99),u=i(20),l=i(9),d=i(8),p=i(12),h=i(100),m=i(83),g=i(376),y=i(79),v=String,b=a("JSON","stringify"),_=l(/./.exec),w=l("".charAt),S=l("".charCodeAt),I=l("".replace),k=l(1..toString),x=/[\uD800-\uDFFF]/g,P=/^[\uD800-\uDBFF]$/,C=/^[\uDC00-\uDFFF]$/,A=!y||d((function(){var t=a("Symbol")("stringify detection");return"[null]"!==b([t])||"{}"!==b({a:t})||"{}"!==b(Object(t))})),O=d((function(){return'"\\udf06\\ud834"'!==b("\udf06\ud834")||'"\\udead"'!==b("\udead")})),stringifyWithSymbolsFix=function(t,r){var i=m(arguments),o=g(r);if(p(o)||void 0!==t&&!h(t))return i[1]=function(t,r){if(p(o)&&(r=u(o,this,v(t),r)),!h(r))return r},c(b,null,i)},fixIllFormed=function(t,r,i){var o=w(i,r-1),a=w(i,r+1);return _(P,t)&&!_(C,a)||_(C,t)&&!_(P,o)?"\\u"+k(S(t,0),16):t};b&&o({target:"JSON",stat:!0,arity:3,forced:A||O},{stringify:function stringify(t,r,i){var o=m(arguments),a=c(A?stringifyWithSymbolsFix:b,null,o);return O&&"string"==typeof a?I(a,x,fixIllFormed):a}})},function(t,r,i){"use strict";var o=i(381);t.exports=o},function(t,r,i){"use strict";var o=i(13),a=i(66),c=TypeError,u=Object.getOwnPropertyDescriptor,l=o&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=l?function(t,r){if(a(t)&&!u(t,"length").writable)throw new c("Cannot set read only .length");return t.length=r}:function(t,r){return t.length=r}},function(t,r,i){"use strict";t.exports=i(396)},function(t,r,i){"use strict";var o=i(8);t.exports=function(t,r){var i=[][t];return!!i&&o((function(){i.call(null,r||function(){return 1},1)}))}},function(t,r,i){"use strict";var o=i(28),a=i(9),c=i(129),u=i(130),l=i(33),d=a([].concat);t.exports=o("Reflect","ownKeys")||function ownKeys(t){var r=c.f(l(t)),i=u.f;return i?d(r,i(t)):r}},function(t,r,i){var o=i(7).default,a=i(465);t.exports=function toPropertyKey(t){var r=a(t,"string");return"symbol"==o(r)?r:r+""},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(1),a=i(8),c=i(66),u=i(18),l=i(36),d=i(57),p=i(174),h=i(105),m=i(172),g=i(104),y=i(10),v=i(124),b=y("isConcatSpreadable"),_=v>=51||!a((function(){var t=[];return t[b]=!1,t.concat()[0]!==t})),isConcatSpreadable=function(t){if(!u(t))return!1;var r=t[b];return void 0!==r?!!r:c(t)};o({target:"Array",proto:!0,arity:1,forced:!_||!g("concat")},{concat:function concat(t){var r,i,o,a,c,u=l(this),g=m(u,0),y=0;for(r=-1,o=arguments.length;r<o;r++)if(isConcatSpreadable(c=-1===r?u:arguments[r]))for(a=d(c),p(y+a),i=0;i<a;i++,y++)i in c&&h(g,y,c[i]);else p(y+1),h(g,y++,c);return g.length=y,g}})},function(t,r,i){"use strict";i(14)("iterator")},function(t,r,i){"use strict";var o=i(14),a=i(231);o("toPrimitive"),a()},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(35),u=i(440),l=i(12),d=i(246),p=i(108),h=i(134),m=i(49),g=i(47),y=i(48),v=i(10),b=i(84),_=i(247),w=u.PROPER,S=u.CONFIGURABLE,I=_.IteratorPrototype,k=_.BUGGY_SAFARI_ITERATORS,x=v("iterator"),returnThis=function(){return this};t.exports=function(t,r,i,u,v,_,P){d(i,r,u);var C,A,O,getIterationMethod=function(t){if(t===v&&D)return D;if(!k&&t&&t in j)return j[t];switch(t){case"keys":return function keys(){return new i(this,t)};case"values":return function values(){return new i(this,t)};case"entries":return function entries(){return new i(this,t)}}return function(){return new i(this)}},R=r+" Iterator",M=!1,j=t.prototype,L=j[x]||j["@@iterator"]||v&&j[v],D=!k&&L||getIterationMethod(v),B="Array"===r&&j.entries||L;if(B&&(C=p(B.call(new t)))!==Object.prototype&&C.next&&(c||p(C)===I||(h?h(C,I):l(C[x])||y(C,x,returnThis)),m(C,R,!0,!0),c&&(b[R]=returnThis)),w&&"values"===v&&L&&"values"!==L.name&&(!c&&S?g(j,"name","values"):(M=!0,D=function values(){return a(L,this)})),v)if(A={values:getIterationMethod("values"),keys:_?D:getIterationMethod("keys"),entries:getIterationMethod("entries")},P)for(O in A)(k||M||!(O in j))&&y(j,O,A[O]);else o({target:r,proto:!0,forced:k||M},A);return c&&!P||j[x]===D||y(j,x,D,{name:v}),b[r]=D,A}},function(t,r,i){"use strict";var o=i(247).IteratorPrototype,a=i(82),c=i(55),u=i(49),l=i(84),returnThis=function(){return this};t.exports=function(t,r,i,d){var p=r+" Iterator";return t.prototype=a(o,{next:c(+!d,i)}),u(t,p,!1,!0),l[p]=returnThis,t}},function(t,r,i){"use strict";var o,a,c,u=i(8),l=i(12),d=i(18),p=i(82),h=i(108),m=i(48),g=i(10),y=i(35),v=g("iterator"),b=!1;[].keys&&("next"in(c=[].keys())?(a=h(h(c)))!==Object.prototype&&(o=a):b=!0),!d(o)||u((function(){var t={};return o[v].call(t)!==t}))?o={}:y&&(o=p(o)),l(o[v])||m(o,v,(function(){return this})),t.exports={IteratorPrototype:o,BUGGY_SAFARI_ITERATORS:b}},function(t,r,i){"use strict";var o=i(8);t.exports=!o((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype}))},function(t,r,i){"use strict";var o=i(28),a=i(9),c=o("Symbol"),u=c.keyFor,l=a(c.prototype.valueOf);t.exports=c.isRegisteredSymbol||function isRegisteredSymbol(t){try{return void 0!==u(l(t))}catch(t){return!1}}},function(t,r,i){"use strict";for(var o=i(81),a=i(28),c=i(9),u=i(100),l=i(10),d=a("Symbol"),p=d.isWellKnownSymbol,h=a("Object","getOwnPropertyNames"),m=c(d.prototype.valueOf),g=o("wks"),y=0,v=h(d),b=v.length;y<b;y++)try{var _=v[y];u(d[_])&&l(_)}catch(t){}t.exports=function isWellKnownSymbol(t){if(p&&p(t))return!0;try{for(var r=m(t),i=0,o=h(g),a=o.length;i<a;i++)if(g[o[i]]==r)return!0}catch(t){}return!1}},function(t,r,i){"use strict";var o=i(480),a=TypeError;t.exports=function(t){if(o(t))throw new a("The method doesn't accept regular expressions");return t}},function(t,r,i){"use strict";var o=i(10)("match");t.exports=function(t){var r=/./;try{"/./"[t](r)}catch(i){try{return r[o]=!1,"/./"[t](r)}catch(t){}}return!1}},function(t,r,i){"use strict";var o="undefined"!=typeof Symbol&&Symbol,a=i(178);t.exports=function hasNativeSymbols(){return"function"==typeof o&&("function"==typeof Symbol&&("symbol"==typeof o("foo")&&("symbol"==typeof Symbol("bar")&&a())))}},function(t,r,i){"use strict";var o=i(138),a=i(41),c=i(3),u=i(85);t.exports=function defineDataProperty(t,r,i){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new c("`obj` must be an object or a function`");if("string"!=typeof r&&"symbol"!=typeof r)throw new c("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new c("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new c("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new c("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new c("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,d=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,h=arguments.length>6&&arguments[6],m=!!u&&u(t,r);if(o)o(t,r,{configurable:null===p&&m?m.configurable:!p,enumerable:null===l&&m?m.enumerable:!l,value:i,writable:null===d&&m?m.writable:!d});else{if(!h&&(l||d||p))throw new a("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[r]=i}}},function(t,r,i){(function(r){var o="function"==typeof Map&&Map.prototype,a=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,c=o&&a&&"function"==typeof a.get?a.get:null,u=o&&Map.prototype.forEach,l="function"==typeof Set&&Set.prototype,d=Object.getOwnPropertyDescriptor&&l?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,p=l&&d&&"function"==typeof d.get?d.get:null,h=l&&Set.prototype.forEach,m="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,g="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,y="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,v=Boolean.prototype.valueOf,b=Object.prototype.toString,_=Function.prototype.toString,w=String.prototype.match,S=String.prototype.slice,I=String.prototype.replace,k=String.prototype.toUpperCase,x=String.prototype.toLowerCase,P=RegExp.prototype.test,C=Array.prototype.concat,A=Array.prototype.join,O=Array.prototype.slice,R=Math.floor,M="function"==typeof BigInt?BigInt.prototype.valueOf:null,j=Object.getOwnPropertySymbols,L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,D="function"==typeof Symbol&&"object"==typeof Symbol.iterator,B="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===D||"symbol")?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,U=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function addNumericSeparator(t,r){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||P.call(/e/,r))return r;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var o=t<0?-R(-t):R(t);if(o!==t){var a=String(o),c=S.call(r,a.length+1);return I.call(a,i,"$&_")+"."+I.call(I.call(c,/([0-9]{3})/g,"$&_"),/_$/,"")}}return I.call(r,i,"$&_")}var q=i(490),W=q.custom,z=isSymbol(W)?W:null;function wrapQuotes(t,r,i){var o="double"===(i.quoteStyle||r)?'"':"'";return o+t+o}function quote(t){return I.call(String(t),/"/g,""")}function isArray(t){return!("[object Array]"!==toStr(t)||B&&"object"==typeof t&&B in t)}function isRegExp(t){return!("[object RegExp]"!==toStr(t)||B&&"object"==typeof t&&B in t)}function isSymbol(t){if(D)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!L)return!1;try{return L.call(t),!0}catch(t){}return!1}t.exports=function inspect_(t,i,o,a){var l=i||{};if(has(l,"quoteStyle")&&"single"!==l.quoteStyle&&"double"!==l.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(l,"maxStringLength")&&("number"==typeof l.maxStringLength?l.maxStringLength<0&&l.maxStringLength!==1/0:null!==l.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var d=!has(l,"customInspect")||l.customInspect;if("boolean"!=typeof d&&"symbol"!==d)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(l,"indent")&&null!==l.indent&&"\t"!==l.indent&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(l,"numericSeparator")&&"boolean"!=typeof l.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var b=l.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 inspectString(t,r){if(t.length>r.maxStringLength){var i=t.length-r.maxStringLength,o="... "+i+" more character"+(i>1?"s":"");return inspectString(S.call(t,0,r.maxStringLength),r)+o}return wrapQuotes(I.call(I.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",r)}(t,l);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var k=String(t);return b?addNumericSeparator(t,k):k}if("bigint"==typeof t){var P=String(t)+"n";return b?addNumericSeparator(t,P):P}var R=void 0===l.depth?5:l.depth;if(void 0===o&&(o=0),o>=R&&R>0&&"object"==typeof t)return isArray(t)?"[Array]":"[Object]";var j=function getIndent(t,r){var i;if("\t"===t.indent)i="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;i=A.call(Array(t.indent+1)," ")}return{base:i,prev:A.call(Array(r+1),i)}}(l,o);if(void 0===a)a=[];else if(indexOf(a,t)>=0)return"[Circular]";function inspect(t,r,i){if(r&&(a=O.call(a)).push(r),i){var c={depth:l.depth};return has(l,"quoteStyle")&&(c.quoteStyle=l.quoteStyle),inspect_(t,c,o+1,a)}return inspect_(t,l,o+1,a)}if("function"==typeof t&&!isRegExp(t)){var W=function nameOf(t){if(t.name)return t.name;var r=w.call(_.call(t),/^function\s*([\w$]+)/);if(r)return r[1];return null}(t),V=arrObjKeys(t,inspect);return"[Function"+(W?": "+W:" (anonymous)")+"]"+(V.length>0?" { "+A.call(V,", ")+" }":"")}if(isSymbol(t)){var H=D?I.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):L.call(t);return"object"!=typeof t||D?H:markBoxed(H)}if(function isElement(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(t)){for(var $="<"+x.call(String(t.nodeName)),K=t.attributes||[],G=0;G<K.length;G++)$+=" "+K[G].name+"="+wrapQuotes(quote(K[G].value),"double",l);return $+=">",t.childNodes&&t.childNodes.length&&($+="..."),$+="</"+x.call(String(t.nodeName))+">"}if(isArray(t)){if(0===t.length)return"[]";var J=arrObjKeys(t,inspect);return j&&!function singleLineValues(t){for(var r=0;r<t.length;r++)if(indexOf(t[r],"\n")>=0)return!1;return!0}(J)?"["+indentedJoin(J,j)+"]":"[ "+A.call(J,", ")+" ]"}if(function isError(t){return!("[object Error]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t)){var Y=arrObjKeys(t,inspect);return"cause"in Error.prototype||!("cause"in t)||N.call(t,"cause")?0===Y.length?"["+String(t)+"]":"{ ["+String(t)+"] "+A.call(Y,", ")+" }":"{ ["+String(t)+"] "+A.call(C.call("[cause]: "+inspect(t.cause),Y),", ")+" }"}if("object"==typeof t&&d){if(z&&"function"==typeof t[z]&&q)return q(t,{depth:R-o});if("symbol"!==d&&"function"==typeof t.inspect)return t.inspect()}if(function isMap(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{p.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(t)){var Q=[];return u&&u.call(t,(function(r,i){Q.push(inspect(i,t,!0)+" => "+inspect(r,t))})),collectionOf("Map",c.call(t),Q,j)}if(function isSet(t){if(!p||!t||"object"!=typeof t)return!1;try{p.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(t)){var X=[];return h&&h.call(t,(function(r){X.push(inspect(r,t))})),collectionOf("Set",p.call(t),X,j)}if(function isWeakMap(t){if(!m||!t||"object"!=typeof t)return!1;try{m.call(t,m);try{g.call(t,g)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(t))return weakCollectionOf("WeakMap");if(function isWeakSet(t){if(!g||!t||"object"!=typeof t)return!1;try{g.call(t,g);try{m.call(t,m)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(t))return weakCollectionOf("WeakSet");if(function isWeakRef(t){if(!y||!t||"object"!=typeof t)return!1;try{return y.call(t),!0}catch(t){}return!1}(t))return weakCollectionOf("WeakRef");if(function isNumber(t){return!("[object Number]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t))return markBoxed(inspect(Number(t)));if(function isBigInt(t){if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(t){}return!1}(t))return markBoxed(inspect(M.call(t)));if(function isBoolean(t){return!("[object Boolean]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t))return markBoxed(v.call(t));if(function isString(t){return!("[object String]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t))return markBoxed(inspect(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if(t===r)return"{ [object globalThis] }";if(!function isDate(t){return!("[object Date]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t)&&!isRegExp(t)){var Z=arrObjKeys(t,inspect),ee=U?U(t)===Object.prototype:t instanceof Object||t.constructor===Object,te=t instanceof Object?"":"null prototype",re=!ee&&B&&Object(t)===t&&B in t?S.call(toStr(t),8,-1):te?"Object":"",ne=(ee||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(re||te?"["+A.call(C.call([],re||[],te||[]),": ")+"] ":"");return 0===Z.length?ne+"{}":j?ne+"{"+indentedJoin(Z,j)+"}":ne+"{ "+A.call(Z,", ")+" }"}return String(t)};var V=Object.prototype.hasOwnProperty||function(t){return t in this};function has(t,r){return V.call(t,r)}function toStr(t){return b.call(t)}function indexOf(t,r){if(t.indexOf)return t.indexOf(r);for(var i=0,o=t.length;i<o;i++)if(t[i]===r)return i;return-1}function lowbyte(t){var r=t.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return i?"\\"+i:"\\x"+(r<16?"0":"")+k.call(r.toString(16))}function markBoxed(t){return"Object("+t+")"}function weakCollectionOf(t){return t+" { ? }"}function collectionOf(t,r,i,o){return t+" ("+r+") {"+(o?indentedJoin(i,o):A.call(i,", "))+"}"}function indentedJoin(t,r){if(0===t.length)return"";var i="\n"+r.prev+r.base;return i+A.call(t,","+i)+"\n"+r.prev}function arrObjKeys(t,r){var i=isArray(t),o=[];if(i){o.length=t.length;for(var a=0;a<t.length;a++)o[a]=has(t,a)?r(t[a],t):""}var c,u="function"==typeof j?j(t):[];if(D){c={};for(var l=0;l<u.length;l++)c["$"+u[l]]=u[l]}for(var d in t)has(t,d)&&(i&&String(Number(d))===d&&d<t.length||D&&c["$"+d]instanceof Symbol||(P.call(/[^\w$]/,d)?o.push(r(d,t)+": "+r(t[d],t)):o.push(d+": "+r(t[d],t))));if("function"==typeof j)for(var p=0;p<u.length;p++)N.call(t,u[p])&&o.push("["+r(u[p])+"]: "+r(t[u[p]],t));return o}}).call(this,i(17))},function(t,r,i){"use strict";var o=i(181),a=Object.prototype.hasOwnProperty,c=Array.isArray,u=function(){for(var t=[],r=0;r<256;++r)t.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return t}(),l=function arrayToObject(t,r){for(var i=r&&r.plainObjects?Object.create(null):{},o=0;o<t.length;++o)void 0!==t[o]&&(i[o]=t[o]);return i};t.exports={arrayToObject:l,assign:function assignSingleSource(t,r){return Object.keys(r).reduce((function(t,i){return t[i]=r[i],t}),t)},combine:function combine(t,r){return[].concat(t,r)},compact:function compact(t){for(var r=[{obj:{o:t},prop:"o"}],i=[],o=0;o<r.length;++o)for(var a=r[o],u=a.obj[a.prop],l=Object.keys(u),d=0;d<l.length;++d){var p=l[d],h=u[p];"object"==typeof h&&null!==h&&-1===i.indexOf(h)&&(r.push({obj:u,prop:p}),i.push(h))}return function compactQueue(t){for(;t.length>1;){var r=t.pop(),i=r.obj[r.prop];if(c(i)){for(var o=[],a=0;a<i.length;++a)void 0!==i[a]&&o.push(i[a]);r.obj[r.prop]=o}}}(r),t},decode:function(t,r,i){var o=t.replace(/\+/g," ");if("iso-8859-1"===i)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(t){return o}},encode:function encode(t,r,i,a,c){if(0===t.length)return t;var l=t;if("symbol"==typeof t?l=Symbol.prototype.toString.call(t):"string"!=typeof t&&(l=String(t)),"iso-8859-1"===i)return escape(l).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var d="",p=0;p<l.length;p+=1024){for(var h=l.length>=1024?l.slice(p,p+1024):l,m=[],g=0;g<h.length;++g){var y=h.charCodeAt(g);45===y||46===y||95===y||126===y||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||c===o.RFC1738&&(40===y||41===y)?m[m.length]=h.charAt(g):y<128?m[m.length]=u[y]:y<2048?m[m.length]=u[192|y>>6]+u[128|63&y]:y<55296||y>=57344?m[m.length]=u[224|y>>12]+u[128|y>>6&63]+u[128|63&y]:(g+=1,y=65536+((1023&y)<<10|1023&h.charCodeAt(g)),m[m.length]=u[240|y>>18]+u[128|y>>12&63]+u[128|y>>6&63]+u[128|63&y])}d+=m.join("")}return d},isBuffer:function isBuffer(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function isRegExp(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function maybeMap(t,r){if(c(t)){for(var i=[],o=0;o<t.length;o+=1)i.push(r(t[o]));return i}return r(t)},merge:function merge(t,r,i){if(!r)return t;if("object"!=typeof r){if(c(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(i&&(i.plainObjects||i.allowPrototypes)||!a.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var o=t;return c(t)&&!c(r)&&(o=l(t,i)),c(t)&&c(r)?(r.forEach((function(r,o){if(a.call(t,o)){var c=t[o];c&&"object"==typeof c&&r&&"object"==typeof r?t[o]=merge(c,r,i):t.push(r)}else t[o]=r})),t):Object.keys(r).reduce((function(t,o){var c=r[o];return a.call(t,o)?t[o]=merge(t[o],c,i):t[o]=c,t}),o)}}},function(t,r,i){"use strict";t.exports=i(501)},function(t,r,i){"use strict";var o=i(503);t.exports=o},function(t,r,i){"use strict";t.exports=i(506)},function(t,r,i){"use strict";var o=i(508);t.exports=o},function(t,r,i){"use strict";var o=i(20),a=i(33),c=i(163);t.exports=function(t,r,i){var u,l;a(t);try{if(!(u=c(t,"return"))){if("throw"===r)throw i;return i}u=o(u,t)}catch(t){l=!0,u=t}if("throw"===r)throw i;if(l)throw u;return a(u),i}},function(t,r,i){"use strict";var o=i(10),a=i(84),c=o("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(a.Array===t||u[c]===t)}},function(t,r,i){"use strict";var o=i(10)("iterator"),a=!1;try{var c=0,u={next:function(){return{done:!!c++}},return:function(){a=!0}};u[o]=function(){return this},Array.from(u,(function(){throw 2}))}catch(t){}t.exports=function(t,r){try{if(!r&&!a)return!1}catch(t){return!1}var i=!1;try{var c={};c[o]=function(){return{next:function(){return{done:i=!0}}}},t(c)}catch(t){}return i}},function(t,r){t.exports=function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,o=new Array(r);i<r;i++)o[i]=t[i];return o},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";t.exports=i(515)},function(t,r,i){"use strict";var o=i(517);i(67),t.exports=o},function(t,r,i){"use strict";i(518)},function(t,r,i){"use strict";var o=i(33),a=i(528),c=i(78),u=i(10)("species");t.exports=function(t,r){var i,l=o(t).constructor;return void 0===l||c(i=o(l)[u])?r:a(i)}},function(t,r,i){"use strict";var o,a,c,u,l=i(11),d=i(99),p=i(63),h=i(12),m=i(21),g=i(8),y=i(229),v=i(83),b=i(164),_=i(270),w=i(271),S=i(139),I=l.setImmediate,k=l.clearImmediate,x=l.process,P=l.Dispatch,C=l.Function,A=l.MessageChannel,O=l.String,R=0,M={};g((function(){o=l.location}));var run=function(t){if(m(M,t)){var r=M[t];delete M[t],r()}},runner=function(t){return function(){run(t)}},eventListener=function(t){run(t.data)},globalPostMessageDefer=function(t){l.postMessage(O(t),o.protocol+"//"+o.host)};I&&k||(I=function setImmediate(t){_(arguments.length,1);var r=h(t)?t:C(t),i=v(arguments,1);return M[++R]=function(){d(r,void 0,i)},a(R),R},k=function clearImmediate(t){delete M[t]},S?a=function(t){x.nextTick(runner(t))}:P&&P.now?a=function(t){P.now(runner(t))}:A&&!w?(u=(c=new A).port2,c.port1.onmessage=eventListener,a=p(u.postMessage,u)):l.addEventListener&&h(l.postMessage)&&!l.importScripts&&o&&"file:"!==o.protocol&&!g(globalPostMessageDefer)?(a=globalPostMessageDefer,l.addEventListener("message",eventListener,!1)):a="onreadystatechange"in b("script")?function(t){y.appendChild(b("script")).onreadystatechange=function(){y.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)}),t.exports={set:I,clear:k}},function(t,r,i){"use strict";var o=TypeError;t.exports=function(t,r){if(t<r)throw new o("Not enough arguments");return t}},function(t,r,i){"use strict";var o=i(125);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(o)},function(t,r,i){"use strict";var o=i(11),a=i(13),c=Object.getOwnPropertyDescriptor;t.exports=function(t){if(!a)return o[t];var r=c(o,t);return r&&r.value}},function(t,r,i){"use strict";var Queue=function(){this.head=null,this.tail=null};Queue.prototype={add:function(t){var r={item:t,next:null},i=this.tail;i?i.next=r:this.head=r,this.tail=r},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},t.exports=Queue},function(t,r,i){"use strict";t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},function(t,r,i){"use strict";var o=i(33),a=i(18),c=i(50);t.exports=function(t,r){if(o(t),a(r)&&r.constructor===t)return r;var i=c.f(t);return(0,i.resolve)(r),i.promise}},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(39),u=i(50),l=i(86),d=i(70);o({target:"Promise",stat:!0,forced:i(141)},{allSettled:function allSettled(t){var r=this,i=u.f(r),o=i.resolve,p=i.reject,h=l((function(){var i=c(r.resolve),u=[],l=0,p=1;d(t,(function(t){var c=l++,d=!1;p++,a(i,r,t).then((function(t){d||(d=!0,u[c]={status:"fulfilled",value:t},--p||o(u))}),(function(t){d||(d=!0,u[c]={status:"rejected",reason:t},--p||o(u))}))})),--p||o(u)}));return h.error&&p(h.value),i.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(39),u=i(28),l=i(50),d=i(86),p=i(70),h=i(141);o({target:"Promise",stat:!0,forced:h},{any:function any(t){var r=this,i=u("AggregateError"),o=l.f(r),h=o.resolve,m=o.reject,g=d((function(){var o=c(r.resolve),u=[],l=0,d=1,g=!1;p(t,(function(t){var c=l++,p=!1;d++,a(o,r,t).then((function(t){p||g||(g=!0,h(t))}),(function(t){p||g||(p=!0,u[c]=t,--d||m(new i(u,"No one promise resolved")))}))})),--d||m(new i(u,"No one promise resolved"))}));return g.error&&m(g.value),o.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(50);o({target:"Promise",stat:!0},{withResolvers:function withResolvers(){var t=a.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}})},function(t,r){!function(t){!function(r){var i="URLSearchParams"in t,o="Symbol"in t&&"iterator"in Symbol,a="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),c="FormData"in t,u="ArrayBuffer"in t;if(u)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(t){return t&&l.indexOf(Object.prototype.toString.call(t))>-1};function normalizeName(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function normalizeValue(t){return"string"!=typeof t&&(t=String(t)),t}function iteratorFor(t){var r={next:function(){var r=t.shift();return{done:void 0===r,value:r}}};return o&&(r[Symbol.iterator]=function(){return r}),r}function Headers(t){this.map={},t instanceof Headers?t.forEach((function(t,r){this.append(r,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(r){this.append(r,t[r])}),this)}function consumed(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function fileReaderReady(t){return new Promise((function(r,i){t.onload=function(){r(t.result)},t.onerror=function(){i(t.error)}}))}function readBlobAsArrayBuffer(t){var r=new FileReader,i=fileReaderReady(r);return r.readAsArrayBuffer(t),i}function bufferClone(t){if(t.slice)return t.slice(0);var r=new Uint8Array(t.byteLength);return r.set(new Uint8Array(t)),r.buffer}function Body(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:a&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:c&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&a&&function isDataView(t){return t&&DataView.prototype.isPrototypeOf(t)}(t)?(this._bodyArrayBuffer=bufferClone(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||d(t))?this._bodyArrayBuffer=bufferClone(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var t=consumed(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?consumed(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var t=consumed(this);if(t)return t;if(this._bodyBlob)return function readBlobAsText(t){var r=new FileReader,i=fileReaderReady(r);return r.readAsText(t),i}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function readArrayBufferAsText(t){for(var r=new Uint8Array(t),i=new Array(r.length),o=0;o<r.length;o++)i[o]=String.fromCharCode(r[o]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c&&(this.formData=function(){return this.text().then(decode)}),this.json=function(){return this.text().then(JSON.parse)},this}Headers.prototype.append=function(t,r){t=normalizeName(t),r=normalizeValue(r);var i=this.map[t];this.map[t]=i?i+", "+r:r},Headers.prototype.delete=function(t){delete this.map[normalizeName(t)]},Headers.prototype.get=function(t){return t=normalizeName(t),this.has(t)?this.map[t]:null},Headers.prototype.has=function(t){return this.map.hasOwnProperty(normalizeName(t))},Headers.prototype.set=function(t,r){this.map[normalizeName(t)]=normalizeValue(r)},Headers.prototype.forEach=function(t,r){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(r,this.map[i],i,this)},Headers.prototype.keys=function(){var t=[];return this.forEach((function(r,i){t.push(i)})),iteratorFor(t)},Headers.prototype.values=function(){var t=[];return this.forEach((function(r){t.push(r)})),iteratorFor(t)},Headers.prototype.entries=function(){var t=[];return this.forEach((function(r,i){t.push([i,r])})),iteratorFor(t)},o&&(Headers.prototype[Symbol.iterator]=Headers.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Request(t,r){var i=(r=r||{}).body;if(t instanceof Request){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,r.headers||(this.headers=new Headers(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=r.credentials||this.credentials||"same-origin",!r.headers&&this.headers||(this.headers=new Headers(r.headers)),this.method=function normalizeMethod(t){var r=t.toUpperCase();return p.indexOf(r)>-1?r:t}(r.method||this.method||"GET"),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function decode(t){var r=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),o=i.shift().replace(/\+/g," "),a=i.join("=").replace(/\+/g," ");r.append(decodeURIComponent(o),decodeURIComponent(a))}})),r}function Response(t,r){r||(r={}),this.type="default",this.status=void 0===r.status?200:r.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in r?r.statusText:"OK",this.headers=new Headers(r.headers),this.url=r.url||"",this._initBody(t)}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})},Body.call(Request.prototype),Body.call(Response.prototype),Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})},Response.error=function(){var t=new Response(null,{status:0,statusText:""});return t.type="error",t};var h=[301,302,303,307,308];Response.redirect=function(t,r){if(-1===h.indexOf(r))throw new RangeError("Invalid status code");return new Response(null,{status:r,headers:{location:t}})},r.DOMException=t.DOMException;try{new r.DOMException}catch(t){r.DOMException=function(t,r){this.message=t,this.name=r;var i=Error(t);this.stack=i.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function fetch(t,i){return new Promise((function(o,c){var u=new Request(t,i);if(u.signal&&u.signal.aborted)return c(new r.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function abortXhr(){l.abort()}l.onload=function(){var t,r,i={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",r=new Headers,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var i=t.split(":"),o=i.shift().trim();if(o){var a=i.join(":").trim();r.append(o,a)}})),r)};i.url="responseURL"in l?l.responseURL:i.headers.get("X-Request-URL");var a="response"in l?l.response:l.responseText;o(new Response(a,i))},l.onerror=function(){c(new TypeError("Network request failed"))},l.ontimeout=function(){c(new TypeError("Network request failed"))},l.onabort=function(){c(new r.DOMException("Aborted","AbortError"))},l.open(u.method,u.url,!0),"include"===u.credentials?l.withCredentials=!0:"omit"===u.credentials&&(l.withCredentials=!1),"responseType"in l&&a&&(l.responseType="blob"),u.headers.forEach((function(t,r){l.setRequestHeader(r,t)})),u.signal&&(u.signal.addEventListener("abort",abortXhr),l.onreadystatechange=function(){4===l.readyState&&u.signal.removeEventListener("abort",abortXhr)}),l.send(void 0===u._bodyInit?null:u._bodyInit)}))}fetch.polyfill=!0,t.fetch||(t.fetch=fetch,t.Headers=Headers,t.Request=Request,t.Response=Response),r.Headers=Headers,r.Request=Request,r.Response=Response,r.fetch=fetch,Object.defineProperty(r,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},function(t,r){t.exports=function eq(t,r){return t===r||t!=t&&r!=r}},function(t,r,i){var o=i(111),a=i(112);t.exports=function isFunction(t){if(!a(t))return!1;var r=o(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}},function(t,r,i){(function(r){var i="object"==typeof r&&r&&r.Object===Object&&r;t.exports=i}).call(this,i(17))},function(t,r){var i=Function.prototype.toString;t.exports=function toSource(t){if(null!=t){try{return i.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,r,i){var o=i(627),a=i(634),c=i(636),u=i(637),l=i(638);function MapCache(t){var r=-1,i=null==t?0:t.length;for(this.clear();++r<i;){var o=t[r];this.set(o[0],o[1])}}MapCache.prototype.clear=o,MapCache.prototype.delete=a,MapCache.prototype.get=c,MapCache.prototype.has=u,MapCache.prototype.set=l,t.exports=MapCache},function(t,r,i){var o=i(286),a=i(280),c=Object.prototype.hasOwnProperty;t.exports=function assignValue(t,r,i){var u=t[r];c.call(t,r)&&a(u,i)&&(void 0!==i||r in t)||o(t,r,i)}},function(t,r,i){var o=i(640);t.exports=function baseAssignValue(t,r,i){"__proto__"==r&&o?o(t,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[r]=i}},function(t,r,i){var o=i(642),a=i(643),c=i(89),u=i(288),l=i(646),d=i(647),p=Object.prototype.hasOwnProperty;t.exports=function arrayLikeKeys(t,r){var i=c(t),h=!i&&a(t),m=!i&&!h&&u(t),g=!i&&!h&&!m&&d(t),y=i||h||m||g,v=y?o(t.length,String):[],b=v.length;for(var _ in t)!r&&!p.call(t,_)||y&&("length"==_||m&&("offset"==_||"parent"==_)||g&&("buffer"==_||"byteLength"==_||"byteOffset"==_)||l(_,b))||v.push(_);return v}},function(t,r,i){(function(t){var o=i(44),a=i(645),c=r&&!r.nodeType&&r,u=c&&"object"==typeof t&&t&&!t.nodeType&&t,l=u&&u.exports===c?o.Buffer:void 0,d=(l?l.isBuffer:void 0)||a;t.exports=d}).call(this,i(136)(t))},function(t,r){t.exports=function isLength(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,r){t.exports=function overArg(t,r){return function(i){return t(r(i))}}},function(t,r,i){var o=i(281),a=i(289);t.exports=function isArrayLike(t){return null!=t&&a(t.length)&&!o(t)}},function(t,r){t.exports=function stubArray(){return[]}},function(t,r,i){var o=i(294),a=i(295),c=i(192),u=i(292),l=Object.getOwnPropertySymbols?function(t){for(var r=[];t;)o(r,c(t)),t=a(t);return r}:u;t.exports=l},function(t,r){t.exports=function arrayPush(t,r){for(var i=-1,o=r.length,a=t.length;++i<o;)t[a+i]=r[i];return t}},function(t,r,i){var o=i(290)(Object.getPrototypeOf,Object);t.exports=o},function(t,r,i){var o=i(294),a=i(89);t.exports=function baseGetAllKeys(t,r,i){var c=r(t);return a(t)?c:o(c,i(t))}},function(t,r,i){"use strict";var o=i(8);t.exports=!o((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(t,r,i){"use strict";t.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},function(t,r,i){"use strict";var o=Object.prototype.toString;t.exports=function isArguments(t){var r=o.call(t),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===o.call(t.callee)),i}},function(t,r,i){"use strict";var o=i(3),a=i(697),c=i(699),u=i(91),l=i(709),d=i(710),p=i(711),h=i(712),m=i(742),g=i(313),y=i(203),v=i(743),b=i(744),_=i(319),w=i(116),S=i(206);t.exports=function slice(t,r){var i=this;_(i,"SEQ-CST");var I,k=i.length,x=m(t);I=x===-1/0?0:x<0?l(k+x,0):d(x,k);var P,C=void 0===r?k:m(r);P=C===-1/0?0:C<0?l(k+C,0):d(C,k);var A=l(P-I,0),O=b(i,[A]);if(A>0){if(u(w(i)))throw new o("Cannot use a Typed Array with an underlying ArrayBuffer that is detached");if(v(i)===v(O))for(var R=w(i),M=w(O),j=y(i),L=I*j+S(i),D=S(O),B=D+A*j;D<B;){var N=c(R,L,"UINT8",!0,"UNORDERED");h(M,D,"UINT8",N,!0,"UNORDERED"),L+=1,D+=1}else for(var U=0;I<P;){var q=g(I),W=a(i,q);p(O,g(U),W,!0),I+=1,U+=1}}return O}},function(t,r,i){"use strict";var o=i(24)("ArrayBuffer.prototype.byteLength",!0),a=i(92);t.exports=function byteLength(t){return a(t)?o?o(t):t.byteLength:NaN}},function(t,r,i){"use strict";var o=i(3),a=i(69),c=i(149),u=i(72);t.exports=function HasOwnProperty(t,r){if("Object"!==u(t))throw new o("Assertion failed: `O` must be an Object");if(!c(r))throw new o("Assertion failed: `P` must be a Property Key");return a(t,r)}},function(t,r,i){"use strict";var o=i(6)("%Array%"),a=!o.isArray&&i(24)("Object.prototype.toString");t.exports=o.isArray||function IsArray(t){return"[object Array]"===a(t)}},function(t,r,i){"use strict";t.exports=function IsBigIntElementType(t){return"BIGUINT64"===t||"BIGINT64"===t}},function(t,r,i){"use strict";var o=i(6),a=o("%Uint8Array%",!0),c=o("%Uint32Array%",!0),u=i(116),l=c&&new c([305419896]),d=l&&new a(u(l));t.exports=d?120===d[0]?"little":18===d[0]?"big":52===d[0]?"mixed":"unknown":"indeterminate"},function(t,r,i){"use strict";var o=i(90);t.exports=function SameValue(t,r){return t===r?0!==t||1/t==1/r:o(t)&&o(r)}},function(t,r,i){"use strict";var o=i(6),a=o("%BigInt%",!0),c=o("%Number%"),u=i(3),l=i(41),d=i(715),p=i(308);t.exports=function ToBigInt(t){if(!a)throw new l("BigInts are not supported in this environment");var r=p(t,c);if(null==r)throw new u("Cannot convert null or undefined to a BigInt");if("boolean"==typeof r)return a(r?1:0);if("number"==typeof r)throw new u("Cannot convert a Number value to a BigInt");if("string"==typeof r){var i=d(r);if(void 0===i)throw new u("Failed to parse String to BigInt");return i}if("symbol"==typeof r)throw new u("Cannot convert a Symbol value to a BigInt");if("bigint"!=typeof r)throw new l("Assertion failed: unknown primitive type");return r}},function(t,r,i){"use strict";var o=i(716);t.exports=function ToPrimitive(t){return arguments.length>1?o(t,arguments[1]):o(t)}},function(t,r,i){"use strict";var o=i(6)("%BigInt%",!0),a=i(177),c=i(3),u=o&&o(0);t.exports=function BigIntRemainder(t,r){if("bigint"!=typeof t||"bigint"!=typeof r)throw new c("Assertion failed: `n` and `d` arguments must be BigInts");if(r===u)throw new a("Division by zero");return t===u?u:t%r}},function(t,r,i){"use strict";t.exports=function bigIntMod(t,r,i){var o=t(r,i);return o>=0?o:o+i}},function(t,r,i){"use strict";var o=i(3);t.exports=function RequireObjectCoercible(t){if(null==t)throw new o(arguments.length>0&&arguments[1]||"Cannot call method on "+t);return t}},function(t,r,i){"use strict";var o=i(311),a=i(313),c=i(24)("String.prototype.replace"),u=/^\s$/.test(""),l=u?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,d=u?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;t.exports=function trim(){var t=a(o(this));return c(c(t,l,""),d,"")}},function(t,r,i){"use strict";var o=i(6)("%String%"),a=i(3);t.exports=function ToString(t){if("symbol"==typeof t)throw new a("Cannot convert a Symbol value to a string");return o(t)}},function(t,r,i){"use strict";var o=i(312);t.exports=function getPolyfill(){return String.prototype.trim&&""==="".trim()&&""==="".trim()&&"_"==="_".trim()&&"_"==="_".trim()?String.prototype.trim:o}},function(t,r,i){"use strict";t.exports=function isNegativeZero(t){return 0===t&&1/t==-1/0}},function(t,r,i){"use strict";var o=i(746)("%Reflect.construct%",!0),a=i(747);try{a({},"",{"[[Get]]":function(){}})}catch(t){a=null}if(a&&o){var c={},u={};a(u,"length",{"[[Get]]":function(){throw c},"[[Enumerable]]":!0}),t.exports=function IsConstructor(t){try{o(t,u)}catch(t){return t===c}}}else t.exports=function IsConstructor(t){return"function"==typeof t&&!!t.prototype}},function(t,r,i){"use strict";var o=i(69),a=i(93),c=i(150);t.exports=function isTypedArrayWithBufferWitnessRecord(t){return!!t&&"object"==typeof t&&o(t,"[[Object]]")&&o(t,"[[CachedBufferByteLength]]")&&(c(t["[[CachedBufferByteLength]]"])&&t["[[CachedBufferByteLength]]"]>=0||"DETACHED"===t["[[CachedBufferByteLength]]"])&&a(t["[[Object]]"])}},function(t,r,i){"use strict";(function(r){var o=i(59),a=i(197),c=i(85),u=i(137)(),l=i(93),d=i(298),p={__proto__:null},h=Object.defineProperty;if(c){var getLength=function(t){return t.length};a(d,(function(t){var i=r[t];if("function"==typeof i||"object"==typeof i){var a=i.prototype,l=c(a,"length");if(!l&&u){var d=a.__proto__;l=c(d,"length")}if(l&&l.get)p["$"+t]=o(l.get);else if(h){var m=new r[t](2);(l=c(m,"length"))&&l.configurable&&h(m,"length",{value:3}),2===m.length&&(p["$"+t]=getLength)}}}))}t.exports=function typedArrayLength(t){return!!l(t)&&function tryAllTypedArrays(t){var r;return a(p,(function(i){if("number"!=typeof r)try{var o=i(t);"number"==typeof o&&(r=o)}catch(t){}})),r}(t)}}).call(this,i(17))},function(t,r,i){"use strict";var o=i(3),a=i(205),c=i(758),u=i(72),l=i(93);t.exports=function ValidateTypedArray(t,r){if("SEQ-CST"!==r&&"UNORDERED"!==r)throw new o("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");if("Object"!==u(t))throw new o("Assertion failed: `O` must be an Object");if(!l(t))throw new o("Assertion failed: `O` must be a Typed Array");var i=c(t,r);if(a(i))throw new o("`O` must be in-bounds and backed by a non-detached buffer");return i}},function(t,r,i){"use strict";var o=i(300);t.exports=function getPolyfill(){return"function"==typeof Uint8Array&&Uint8Array.prototype.slice||o}},function(t,r,i){"use strict";t.exports=i(773)},function(t,r,i){"use strict";var o=i(210),a=i(74).Readable,c={objectMode:!0},u={clean:!0};function Store(t){if(!(this instanceof Store))return new Store(t);this.options=t||{},this.options=o(u,t),this._inflights=new Map}Store.prototype.put=function(t,r){return this._inflights.set(t.messageId,t),r&&r(),this},Store.prototype.createStream=function(){var t=new a(c),r=!1,i=[],o=0;return this._inflights.forEach((function(t,r){i.push(t)})),t._read=function(){!r&&o<i.length?this.push(i[o++]):this.push(null)},t.destroy=function(){if(!r){var t=this;r=!0,setTimeout((function(){t.emit("close")}),0)}},t},Store.prototype.del=function(t,r){return(t=this._inflights.get(t.messageId))?(this._inflights.delete(t.messageId),r(null,t)):r&&r(new Error("missing packet")),this},Store.prototype.get=function(t,r){return(t=this._inflights.get(t.messageId))?r(null,t):r&&r(new Error("missing packet")),this},Store.prototype.close=function(t){this.options.clean&&(this._inflights=null),t&&t()},t.exports=Store},function(t,r,i){"use strict";(function(r,o){var a;t.exports=Readable,Readable.ReadableState=ReadableState;i(45).EventEmitter;var c=function EElistenerCount(t,r){return t.listeners(r).length},u=i(324),l=i(16).Buffer,d=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var p,h=i(784);p=h&&h.debuglog?h.debuglog("stream"):function debug(){};var m,g,y,v=i(785),b=i(325),_=i(326).getHighWaterMark,w=i(95).codes,S=w.ERR_INVALID_ARG_TYPE,I=w.ERR_STREAM_PUSH_AFTER_EOF,k=w.ERR_METHOD_NOT_IMPLEMENTED,x=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i(30)(Readable,u);var P=b.errorOrDestroy,C=["error","close","destroy","pause","resume"];function ReadableState(t,r,o){a=a||i(96),t=t||{},"boolean"!=typeof o&&(o=r instanceof a),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=_(this,t,"readableHighWaterMark",o),this.buffer=new v,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(m||(m=i(152).StringDecoder),this.decoder=new m(t.encoding),this.encoding=t.encoding)}function Readable(t){if(a=a||i(96),!(this instanceof Readable))return new Readable(t);var r=this instanceof a;this._readableState=new ReadableState(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function readableAddChunk(t,r,i,o,a){p("readableAddChunk",r);var c,u=t._readableState;if(null===r)u.reading=!1,function onEofChunk(t,r){if(p("onEofChunk"),r.ended)return;if(r.decoder){var i=r.decoder.end();i&&i.length&&(r.buffer.push(i),r.length+=r.objectMode?1:i.length)}r.ended=!0,r.sync?emitReadable(t):(r.needReadable=!1,r.emittedReadable||(r.emittedReadable=!0,emitReadable_(t)))}(t,u);else if(a||(c=function chunkInvalid(t,r){var i;(function _isUint8Array(t){return l.isBuffer(t)||t instanceof d})(r)||"string"==typeof r||void 0===r||t.objectMode||(i=new S("chunk",["string","Buffer","Uint8Array"],r));return i}(u,r)),c)P(t,c);else if(u.objectMode||r&&r.length>0)if("string"==typeof r||u.objectMode||Object.getPrototypeOf(r)===l.prototype||(r=function _uint8ArrayToBuffer(t){return l.from(t)}(r)),o)u.endEmitted?P(t,new x):addChunk(t,u,r,!0);else if(u.ended)P(t,new I);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!i?(r=u.decoder.write(r),u.objectMode||0!==r.length?addChunk(t,u,r,!1):maybeReadMore(t,u)):addChunk(t,u,r,!1)}else o||(u.reading=!1,maybeReadMore(t,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function addChunk(t,r,i,o){r.flowing&&0===r.length&&!r.sync?(r.awaitDrain=0,t.emit("data",i)):(r.length+=r.objectMode?1:i.length,o?r.buffer.unshift(i):r.buffer.push(i),r.needReadable&&emitReadable(t)),maybeReadMore(t,r)}Object.defineProperty(Readable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._readableState&&this._readableState.destroyed},set:function set(t){this._readableState&&(this._readableState.destroyed=t)}}),Readable.prototype.destroy=b.destroy,Readable.prototype._undestroy=b.undestroy,Readable.prototype._destroy=function(t,r){r(t)},Readable.prototype.push=function(t,r){var i,o=this._readableState;return o.objectMode?i=!0:"string"==typeof t&&((r=r||o.defaultEncoding)!==o.encoding&&(t=l.from(t,r),r=""),i=!0),readableAddChunk(this,t,r,!1,i)},Readable.prototype.unshift=function(t){return readableAddChunk(this,t,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(t){m||(m=i(152).StringDecoder);var r=new m(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var o=this._readableState.buffer.head,a="";null!==o;)a+=r.write(o.data),o=o.next;return this._readableState.buffer.clear(),""!==a&&this._readableState.buffer.push(a),this._readableState.length=a.length,this};function howMuchToRead(t,r){return t<=0||0===r.length&&r.ended?0:r.objectMode?1:t!=t?r.flowing&&r.length?r.buffer.head.data.length:r.length:(t>r.highWaterMark&&(r.highWaterMark=function computeNewHighWaterMark(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=r.length?t:r.ended?r.length:(r.needReadable=!0,0))}function emitReadable(t){var r=t._readableState;p("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(p("emitReadable",r.flowing),r.emittedReadable=!0,o.nextTick(emitReadable_,t))}function emitReadable_(t){var r=t._readableState;p("emitReadable_",r.destroyed,r.length,r.ended),r.destroyed||!r.length&&!r.ended||(t.emit("readable"),r.emittedReadable=!1),r.needReadable=!r.flowing&&!r.ended&&r.length<=r.highWaterMark,flow(t)}function maybeReadMore(t,r){r.readingMore||(r.readingMore=!0,o.nextTick(maybeReadMore_,t,r))}function maybeReadMore_(t,r){for(;!r.reading&&!r.ended&&(r.length<r.highWaterMark||r.flowing&&0===r.length);){var i=r.length;if(p("maybeReadMore read 0"),t.read(0),i===r.length)break}r.readingMore=!1}function updateReadableListening(t){var r=t._readableState;r.readableListening=t.listenerCount("readable")>0,r.resumeScheduled&&!r.paused?r.flowing=!0:t.listenerCount("data")>0&&t.resume()}function nReadingNextTick(t){p("readable nexttick read 0"),t.read(0)}function resume_(t,r){p("resume",r.reading),r.reading||t.read(0),r.resumeScheduled=!1,t.emit("resume"),flow(t),r.flowing&&!r.reading&&t.read(0)}function flow(t){var r=t._readableState;for(p("flow",r.flowing);r.flowing&&null!==t.read(););}function fromList(t,r){return 0===r.length?null:(r.objectMode?i=r.buffer.shift():!t||t>=r.length?(i=r.decoder?r.buffer.join(""):1===r.buffer.length?r.buffer.first():r.buffer.concat(r.length),r.buffer.clear()):i=r.buffer.consume(t,r.decoder),i);var i}function endReadable(t){var r=t._readableState;p("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,o.nextTick(endReadableNT,r,t))}function endReadableNT(t,r){if(p("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,r.readable=!1,r.emit("end"),t.autoDestroy)){var i=r._writableState;(!i||i.autoDestroy&&i.finished)&&r.destroy()}}function indexOf(t,r){for(var i=0,o=t.length;i<o;i++)if(t[i]===r)return i;return-1}Readable.prototype.read=function(t){p("read",t),t=parseInt(t,10);var r=this._readableState,i=t;if(0!==t&&(r.emittedReadable=!1),0===t&&r.needReadable&&((0!==r.highWaterMark?r.length>=r.highWaterMark:r.length>0)||r.ended))return p("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?endReadable(this):emitReadable(this),null;if(0===(t=howMuchToRead(t,r))&&r.ended)return 0===r.length&&endReadable(this),null;var o,a=r.needReadable;return p("need readable",a),(0===r.length||r.length-t<r.highWaterMark)&&p("length less than watermark",a=!0),r.ended||r.reading?p("reading or ended",a=!1):a&&(p("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(t=howMuchToRead(i,r))),null===(o=t>0?fromList(t,r):null)?(r.needReadable=r.length<=r.highWaterMark,t=0):(r.length-=t,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),i!==t&&r.ended&&endReadable(this)),null!==o&&this.emit("data",o),o},Readable.prototype._read=function(t){P(this,new k("_read()"))},Readable.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,p("pipe count=%d opts=%j",a.pipesCount,r);var u=(!r||!1!==r.end)&&t!==o.stdout&&t!==o.stderr?onend:unpipe;function onunpipe(r,o){p("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,function cleanup(){p("cleanup"),t.removeListener("close",onclose),t.removeListener("finish",onfinish),t.removeListener("drain",l),t.removeListener("error",onerror),t.removeListener("unpipe",onunpipe),i.removeListener("end",onend),i.removeListener("end",unpipe),i.removeListener("data",ondata),d=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||l()}())}function onend(){p("onend"),t.end()}a.endEmitted?o.nextTick(u):i.once("end",u),t.on("unpipe",onunpipe);var l=function pipeOnDrain(t){return function pipeOnDrainFunctionResult(){var r=t._readableState;p("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&c(t,"data")&&(r.flowing=!0,flow(t))}}(i);t.on("drain",l);var d=!1;function ondata(r){p("ondata");var o=t.write(r);p("dest.write",o),!1===o&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==indexOf(a.pipes,t))&&!d&&(p("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function onerror(r){p("onerror",r),unpipe(),t.removeListener("error",onerror),0===c(t,"error")&&P(t,r)}function onclose(){t.removeListener("finish",onfinish),unpipe()}function onfinish(){p("onfinish"),t.removeListener("close",onclose),unpipe()}function unpipe(){p("unpipe"),i.unpipe(t)}return i.on("data",ondata),function prependListener(t,r,i){if("function"==typeof t.prependListener)return t.prependListener(r,i);t._events&&t._events[r]?Array.isArray(t._events[r])?t._events[r].unshift(i):t._events[r]=[i,t._events[r]]:t.on(r,i)}(t,"error",onerror),t.once("close",onclose),t.once("finish",onfinish),t.emit("pipe",i),a.flowing||(p("pipe resume"),i.resume()),t},Readable.prototype.unpipe=function(t){var r=this._readableState,i={hasUnpiped:!1};if(0===r.pipesCount)return this;if(1===r.pipesCount)return t&&t!==r.pipes||(t||(t=r.pipes),r.pipes=null,r.pipesCount=0,r.flowing=!1,t&&t.emit("unpipe",this,i)),this;if(!t){var o=r.pipes,a=r.pipesCount;r.pipes=null,r.pipesCount=0,r.flowing=!1;for(var c=0;c<a;c++)o[c].emit("unpipe",this,{hasUnpiped:!1});return this}var u=indexOf(r.pipes,t);return-1===u||(r.pipes.splice(u,1),r.pipesCount-=1,1===r.pipesCount&&(r.pipes=r.pipes[0]),t.emit("unpipe",this,i)),this},Readable.prototype.on=function(t,r){var i=u.prototype.on.call(this,t,r),a=this._readableState;return"data"===t?(a.readableListening=this.listenerCount("readable")>0,!1!==a.flowing&&this.resume()):"readable"===t&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,p("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||o.nextTick(nReadingNextTick,this))),i},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(t,r){var i=u.prototype.removeListener.call(this,t,r);return"readable"===t&&o.nextTick(updateReadableListening,this),i},Readable.prototype.removeAllListeners=function(t){var r=u.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||o.nextTick(updateReadableListening,this),r},Readable.prototype.resume=function(){var t=this._readableState;return t.flowing||(p("resume"),t.flowing=!t.readableListening,function resume(t,r){r.resumeScheduled||(r.resumeScheduled=!0,o.nextTick(resume_,t,r))}(this,t)),t.paused=!1,this},Readable.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(t){var r=this,i=this._readableState,o=!1;for(var a in t.on("end",(function(){if(p("wrapped end"),i.decoder&&!i.ended){var t=i.decoder.end();t&&t.length&&r.push(t)}r.push(null)})),t.on("data",(function(a){(p("wrapped data"),i.decoder&&(a=i.decoder.write(a)),i.objectMode&&null==a)||(i.objectMode||a&&a.length)&&(r.push(a)||(o=!0,t.pause()))})),t)void 0===this[a]&&"function"==typeof t[a]&&(this[a]=function methodWrap(r){return function methodWrapReturnFunction(){return t[r].apply(t,arguments)}}(a));for(var c=0;c<C.length;c++)t.on(C[c],this.emit.bind(this,C[c]));return this._read=function(r){p("wrapped _read",r),o&&(o=!1,t.resume())},this},"function"==typeof Symbol&&(Readable.prototype[Symbol.asyncIterator]=function(){return void 0===g&&(g=i(788)),g(this)}),Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function get(){return this._readableState.highWaterMark}}),Object.defineProperty(Readable.prototype,"readableBuffer",{enumerable:!1,get:function get(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Readable.prototype,"readableFlowing",{enumerable:!1,get:function get(){return this._readableState.flowing},set:function set(t){this._readableState&&(this._readableState.flowing=t)}}),Readable._fromList=fromList,Object.defineProperty(Readable.prototype,"readableLength",{enumerable:!1,get:function get(){return this._readableState.length}}),"function"==typeof Symbol&&(Readable.from=function(t,r){return void 0===y&&(y=i(789)),y(Readable,t,r)})}).call(this,i(17),i(19))},function(t,r,i){t.exports=i(45).EventEmitter},function(t,r,i){"use strict";(function(r){function emitErrorAndCloseNT(t,r){emitErrorNT(t,r),emitCloseNT(t)}function emitCloseNT(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function emitErrorNT(t,r){t.emit("error",r)}t.exports={destroy:function destroy(t,i){var o=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(i?i(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(emitErrorNT,this,t)):r.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!i&&t?o._writableState?o._writableState.errorEmitted?r.nextTick(emitCloseNT,o):(o._writableState.errorEmitted=!0,r.nextTick(emitErrorAndCloseNT,o,t)):r.nextTick(emitErrorAndCloseNT,o,t):i?(r.nextTick(emitCloseNT,o),i(t)):r.nextTick(emitCloseNT,o)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(t,r){var i=t._readableState,o=t._writableState;i&&i.autoDestroy||o&&o.autoDestroy?t.destroy(r):t.emit("error",r)}}}).call(this,i(19))},function(t,r,i){"use strict";var o=i(95).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function getHighWaterMark(t,r,i,a){var c=function highWaterMarkFrom(t,r,i){return null!=t.highWaterMark?t.highWaterMark:r?t[i]:null}(r,a,i);if(null!=c){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new o(a?i:"highWaterMark",c);return Math.floor(c)}return t.objectMode?16:16384}}},function(t,r,i){"use strict";(function(r,o){function CorkedRequest(t){var r=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(t,r,i){var o=t.entry;t.entry=null;for(;o;){var a=o.callback;r.pendingcb--,a(i),o=o.next}r.corkedRequestsFree.next=t}(r,t)}}var a;t.exports=Writable,Writable.WritableState=WritableState;var c={deprecate:i(328)},u=i(324),l=i(16).Buffer,d=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var p,h=i(325),m=i(326).getHighWaterMark,g=i(95).codes,y=g.ERR_INVALID_ARG_TYPE,v=g.ERR_METHOD_NOT_IMPLEMENTED,b=g.ERR_MULTIPLE_CALLBACK,_=g.ERR_STREAM_CANNOT_PIPE,w=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,I=g.ERR_STREAM_WRITE_AFTER_END,k=g.ERR_UNKNOWN_ENCODING,x=h.errorOrDestroy;function nop(){}function WritableState(t,r,c){a=a||i(96),t=t||{},"boolean"!=typeof c&&(c=r instanceof a),this.objectMode=!!t.objectMode,c&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=m(this,t,"writableHighWaterMark",c),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===t.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function onwrite(t,r){var i=t._writableState,a=i.sync,c=i.writecb;if("function"!=typeof c)throw new b;if(function onwriteStateUpdate(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),r)!function onwriteError(t,r,i,a,c){--r.pendingcb,i?(o.nextTick(c,a),o.nextTick(finishMaybe,t,r),t._writableState.errorEmitted=!0,x(t,a)):(c(a),t._writableState.errorEmitted=!0,x(t,a),finishMaybe(t,r))}(t,i,a,r,c);else{var u=needFinish(i)||t.destroyed;u||i.corked||i.bufferProcessing||!i.bufferedRequest||clearBuffer(t,i),a?o.nextTick(afterWrite,t,i,u,c):afterWrite(t,i,u,c)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(t){var r=this instanceof(a=a||i(96));if(!r&&!p.call(Writable,this))return new Writable(t);this._writableState=new WritableState(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function doWrite(t,r,i,o,a,c,u){r.writelen=o,r.writecb=u,r.writing=!0,r.sync=!0,r.destroyed?r.onwrite(new w("write")):i?t._writev(a,r.onwrite):t._write(a,c,r.onwrite),r.sync=!1}function afterWrite(t,r,i,o){i||function onwriteDrain(t,r){0===r.length&&r.needDrain&&(r.needDrain=!1,t.emit("drain"))}(t,r),r.pendingcb--,o(),finishMaybe(t,r)}function clearBuffer(t,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(t._writev&&i&&i.next){var o=r.bufferedRequestCount,a=new Array(o),c=r.corkedRequestsFree;c.entry=i;for(var u=0,l=!0;i;)a[u]=i,i.isBuf||(l=!1),i=i.next,u+=1;a.allBuffers=l,doWrite(t,r,!0,r.length,a,"",c.finish),r.pendingcb++,r.lastBufferedRequest=null,c.next?(r.corkedRequestsFree=c.next,c.next=null):r.corkedRequestsFree=new CorkedRequest(r),r.bufferedRequestCount=0}else{for(;i;){var d=i.chunk,p=i.encoding,h=i.callback;if(doWrite(t,r,!1,r.objectMode?1:d.length,d,p,h),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function needFinish(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function callFinal(t,r){t._final((function(i){r.pendingcb--,i&&x(t,i),r.prefinished=!0,t.emit("prefinish"),finishMaybe(t,r)}))}function finishMaybe(t,r){var i=needFinish(r);if(i&&(function prefinish(t,r){r.prefinished||r.finalCalled||("function"!=typeof t._final||r.destroyed?(r.prefinished=!0,t.emit("prefinish")):(r.pendingcb++,r.finalCalled=!0,o.nextTick(callFinal,t,r)))}(t,r),0===r.pendingcb&&(r.finished=!0,t.emit("finish"),r.autoDestroy))){var a=t._readableState;(!a||a.autoDestroy&&a.endEmitted)&&t.destroy()}return i}i(30)(Writable,u),WritableState.prototype.getBuffer=function getBuffer(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:c.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(t){return!!p.call(this,t)||this===Writable&&(t&&t._writableState instanceof WritableState)}})):p=function realHasInstance(t){return t instanceof this},Writable.prototype.pipe=function(){x(this,new _)},Writable.prototype.write=function(t,r,i){var a=this._writableState,c=!1,u=!a.objectMode&&function _isUint8Array(t){return l.isBuffer(t)||t instanceof d}(t);return u&&!l.isBuffer(t)&&(t=function _uint8ArrayToBuffer(t){return l.from(t)}(t)),"function"==typeof r&&(i=r,r=null),u?r="buffer":r||(r=a.defaultEncoding),"function"!=typeof i&&(i=nop),a.ending?function writeAfterEnd(t,r){var i=new I;x(t,i),o.nextTick(r,i)}(this,i):(u||function validChunk(t,r,i,a){var c;return null===i?c=new S:"string"==typeof i||r.objectMode||(c=new y("chunk",["string","Buffer"],i)),!c||(x(t,c),o.nextTick(a,c),!1)}(this,a,t,i))&&(a.pendingcb++,c=function writeOrBuffer(t,r,i,o,a,c){if(!i){var u=function decodeChunk(t,r,i){t.objectMode||!1===t.decodeStrings||"string"!=typeof r||(r=l.from(r,i));return r}(r,o,a);o!==u&&(i=!0,a="buffer",o=u)}var d=r.objectMode?1:o.length;r.length+=d;var p=r.length<r.highWaterMark;p||(r.needDrain=!0);if(r.writing||r.corked){var h=r.lastBufferedRequest;r.lastBufferedRequest={chunk:o,encoding:a,isBuf:i,callback:c,next:null},h?h.next=r.lastBufferedRequest:r.bufferedRequest=r.lastBufferedRequest,r.bufferedRequestCount+=1}else doWrite(t,r,!1,d,o,a,c);return p}(this,a,u,t,r,i)),c},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||clearBuffer(this,t))},Writable.prototype.setDefaultEncoding=function setDefaultEncoding(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new k(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(t,r,i){i(new v("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(t,r,i){var a=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(t,r,i){r.ending=!0,finishMaybe(t,r),i&&(r.finished?o.nextTick(i):t.once("finish",i));r.ended=!0,t.writable=!1}(this,a,i),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(t){this._writableState&&(this._writableState.destroyed=t)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(t,r){r(t)}}).call(this,i(17),i(19))},function(t,r,i){(function(r){function config(t){try{if(!r.localStorage)return!1}catch(t){return!1}var i=r.localStorage[t];return null!=i&&"true"===String(i).toLowerCase()}t.exports=function deprecate(t,r){if(config("noDeprecation"))return t;var i=!1;return function deprecated(){if(!i){if(config("throwDeprecation"))throw new Error(r);config("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}}).call(this,i(17))},function(t,r,i){"use strict";t.exports=Transform;var o=i(95).codes,a=o.ERR_METHOD_NOT_IMPLEMENTED,c=o.ERR_MULTIPLE_CALLBACK,u=o.ERR_TRANSFORM_ALREADY_TRANSFORMING,l=o.ERR_TRANSFORM_WITH_LENGTH_0,d=i(96);function afterTransform(t,r){var i=this._transformState;i.transforming=!1;var o=i.writecb;if(null===o)return this.emit("error",new c);i.writechunk=null,i.writecb=null,null!=r&&this.push(r),o(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function Transform(t){if(!(this instanceof Transform))return new Transform(t);d.call(this,t),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",prefinish)}function prefinish(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?done(this,null,null):this._flush((function(r,i){done(t,r,i)}))}function done(t,r,i){if(r)return t.emit("error",r);if(null!=i&&t.push(i),t._writableState.length)throw new l;if(t._transformState.transforming)throw new u;return t.push(null)}i(30)(Transform,d),Transform.prototype.push=function(t,r){return this._transformState.needTransform=!1,d.prototype.push.call(this,t,r)},Transform.prototype._transform=function(t,r,i){i(new a("_transform()"))},Transform.prototype._write=function(t,r,i){var o=this._transformState;if(o.writecb=i,o.writechunk=t,o.writeencoding=r,!o.transforming){var a=this._readableState;(o.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},Transform.prototype._read=function(t){var r=this._transformState;null===r.writechunk||r.transforming?r.needTransform=!0:(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform))},Transform.prototype._destroy=function(t,r){d.prototype._destroy.call(this,t,(function(t){r(t)}))}},function(t,r,i){(function(r){const i=t.exports;i.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},i.codes={};for(const t in i.types){const r=i.types[t];i.codes[r]=t}i.CMD_SHIFT=4,i.CMD_MASK=240,i.DUP_MASK=8,i.QOS_MASK=3,i.QOS_SHIFT=1,i.RETAIN_MASK=1,i.VARBYTEINT_MASK=127,i.VARBYTEINT_FIN_MASK=128,i.VARBYTEINT_MAX=268435455,i.SESSIONPRESENT_MASK=1,i.SESSIONPRESENT_HEADER=r.from([i.SESSIONPRESENT_MASK]),i.CONNACK_HEADER=r.from([i.codes.connack<<i.CMD_SHIFT]),i.USERNAME_MASK=128,i.PASSWORD_MASK=64,i.WILL_RETAIN_MASK=32,i.WILL_QOS_MASK=24,i.WILL_QOS_SHIFT=3,i.WILL_FLAG_MASK=4,i.CLEAN_SESSION_MASK=2,i.CONNECT_HEADER=r.from([i.codes.connect<<i.CMD_SHIFT]),i.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},i.propertiesCodes={};for(const t in i.properties){const r=i.properties[t];i.propertiesCodes[r]=t}function genHeader(t){return[0,1,2].map(o=>[0,1].map(a=>[0,1].map(c=>{const u=r.alloc(1);return u.writeUInt8(i.codes[t]<<i.CMD_SHIFT|(a?i.DUP_MASK:0)|o<<i.QOS_SHIFT|c,0,!0),u})))}i.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},i.PUBLISH_HEADER=genHeader("publish"),i.SUBSCRIBE_HEADER=genHeader("subscribe"),i.SUBSCRIBE_OPTIONS_QOS_MASK=3,i.SUBSCRIBE_OPTIONS_NL_MASK=1,i.SUBSCRIBE_OPTIONS_NL_SHIFT=2,i.SUBSCRIBE_OPTIONS_RAP_MASK=1,i.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,i.SUBSCRIBE_OPTIONS_RH_MASK=3,i.SUBSCRIBE_OPTIONS_RH_SHIFT=4,i.SUBSCRIBE_OPTIONS_RH=[0,16,32],i.SUBSCRIBE_OPTIONS_NL=4,i.SUBSCRIBE_OPTIONS_RAP=8,i.SUBSCRIBE_OPTIONS_QOS=[0,1,2],i.UNSUBSCRIBE_HEADER=genHeader("unsubscribe"),i.ACKS={unsuback:genHeader("unsuback"),puback:genHeader("puback"),pubcomp:genHeader("pubcomp"),pubrel:genHeader("pubrel"),pubrec:genHeader("pubrec")},i.SUBACK_HEADER=r.from([i.codes.suback<<i.CMD_SHIFT]),i.VERSION3=r.from([3]),i.VERSION4=r.from([4]),i.VERSION5=r.from([5]),i.VERSION131=r.from([131]),i.VERSION132=r.from([132]),i.QOS=[0,1,2].map(t=>r.from([t])),i.EMPTY={pingreq:r.from([i.codes.pingreq<<4,0]),pingresp:r.from([i.codes.pingresp<<4,0]),disconnect:r.from([i.codes.disconnect<<4,0])}}).call(this,i(16).Buffer)},function(t,r,i){(function(r){const o=i(330),a=r.allocUnsafe(0),c=r.from([0]),u=i(800),l=i(117).nextTick,d=i(75)("mqtt-packet:writeToStream"),p=u.cache,h=u.generateNumber,m=u.generateCache,g=u.genBufVariableByteInt,y=u.generate4ByteBuffer;let v=writeNumberCached,b=!0;function generate(t,i,u){switch(d("generate called"),i.cork&&(i.cork(),l(uncork,i)),b&&(b=!1,m()),d("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return function connect(t,i,a){const c=t||{},u=c.protocolId||"MQTT";let l=c.protocolVersion||4;const d=c.will;let p=c.clean;const h=c.keepalive||0,m=c.clientId||"",g=c.username,y=c.password,b=c.properties;void 0===p&&(p=!0);let _=0;if(!u||"string"!=typeof u&&!r.isBuffer(u))return i.emit("error",new Error("Invalid protocolId")),!1;_+=u.length+2;if(3!==l&&4!==l&&5!==l)return i.emit("error",new Error("Invalid protocol version")),!1;_+=1;if(("string"==typeof m||r.isBuffer(m))&&(m||l>=4)&&(m||p))_+=r.byteLength(m)+2;else{if(l<4)return i.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*p==0)return i.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof h||h<0||h>65535||h%1!=0)return i.emit("error",new Error("Invalid keepalive")),!1;_+=2;if(_+=1,5===l){var w=getProperties(i,b);if(!w)return!1;_+=w.length}if(d){if("object"!=typeof d)return i.emit("error",new Error("Invalid will")),!1;if(!d.topic||"string"!=typeof d.topic)return i.emit("error",new Error("Invalid will topic")),!1;if(_+=r.byteLength(d.topic)+2,_+=2,d.payload){if(!(d.payload.length>=0))return i.emit("error",new Error("Invalid will payload")),!1;"string"==typeof d.payload?_+=r.byteLength(d.payload):_+=d.payload.length}var S={};if(5===l){if(!(S=getProperties(i,d.properties)))return!1;_+=S.length}}let I=!1;if(null!=g){if(!isStringOrBuffer(g))return i.emit("error",new Error("Invalid username")),!1;I=!0,_+=r.byteLength(g)+2}if(null!=y){if(!I)return i.emit("error",new Error("Username is required to use password")),!1;if(!isStringOrBuffer(y))return i.emit("error",new Error("Invalid password")),!1;_+=byteLength(y)+2}i.write(o.CONNECT_HEADER),writeVarByteInt(i,_),writeStringOrBuffer(i,u),c.bridgeMode&&(l+=128);i.write(131===l?o.VERSION131:132===l?o.VERSION132:4===l?o.VERSION4:5===l?o.VERSION5:o.VERSION3);let k=0;k|=null!=g?o.USERNAME_MASK:0,k|=null!=y?o.PASSWORD_MASK:0,k|=d&&d.retain?o.WILL_RETAIN_MASK:0,k|=d&&d.qos?d.qos<<o.WILL_QOS_SHIFT:0,k|=d?o.WILL_FLAG_MASK:0,k|=p?o.CLEAN_SESSION_MASK:0,i.write(r.from([k])),v(i,h),5===l&&w.write();writeStringOrBuffer(i,m),d&&(5===l&&S.write(),writeString(i,d.topic),writeStringOrBuffer(i,d.payload));null!=g&&writeStringOrBuffer(i,g);null!=y&&writeStringOrBuffer(i,y);return!0}(t,i);case"connack":return function connack(t,i,a){const u=a?a.protocolVersion:4,l=t||{},d=5===u?l.reasonCode:l.returnCode,p=l.properties;let h=2;if("number"!=typeof d)return i.emit("error",new Error("Invalid return code")),!1;let m=null;if(5===u){if(m=getProperties(i,p),!m)return!1;h+=m.length}i.write(o.CONNACK_HEADER),writeVarByteInt(i,h),i.write(l.sessionPresent?o.SESSIONPRESENT_HEADER:c),i.write(r.from([d])),null!=m&&m.write();return!0}(t,i,u);case"publish":return function publish(t,i,c){d("publish: packet: %o",t);const u=c?c.protocolVersion:4,l=t||{},p=l.qos||0,h=l.retain?o.RETAIN_MASK:0,m=l.topic,g=l.payload||a,y=l.messageId,b=l.properties;let _=0;if("string"==typeof m)_+=r.byteLength(m)+2;else{if(!r.isBuffer(m))return i.emit("error",new Error("Invalid topic")),!1;_+=m.length+2}r.isBuffer(g)?_+=g.length:_+=r.byteLength(g);if(p&&"number"!=typeof y)return i.emit("error",new Error("Invalid messageId")),!1;p&&(_+=2);let w=null;if(5===u){if(w=getProperties(i,b),!w)return!1;_+=w.length}i.write(o.PUBLISH_HEADER[p][l.dup?1:0][h?1:0]),writeVarByteInt(i,_),v(i,byteLength(m)),i.write(m),p>0&&v(i,y);null!=w&&w.write();return d("publish: payload: %o",g),i.write(g)}(t,i,u);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function confirmation(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.cmd||"puback",d=u.messageId,p=u.dup&&"pubrel"===l?o.DUP_MASK:0;let h=0;const m=u.reasonCode,g=u.properties;let y=5===c?3:2;"pubrel"===l&&(h=1);if("number"!=typeof d)return i.emit("error",new Error("Invalid messageId")),!1;let b=null;if(5===c&&"object"==typeof g){if(b=getPropertiesByMaximumPacketSize(i,g,a,y),!b)return!1;y+=b.length}i.write(o.ACKS[l][h][p][0]),writeVarByteInt(i,y),v(i,d),5===c&&i.write(r.from([m]));null!==b&&b.write();return!0}(t,i,u);case"subscribe":return function subscribe(t,i,a){d("subscribe: packet: ");const c=a?a.protocolVersion:4,u=t||{},l=u.dup?o.DUP_MASK:0,p=u.messageId,h=u.subscriptions,m=u.properties;let g=0;if("number"!=typeof p)return i.emit("error",new Error("Invalid messageId")),!1;g+=2;let y=null;if(5===c){if(y=getProperties(i,m),!y)return!1;g+=y.length}if("object"!=typeof h||!h.length)return i.emit("error",new Error("Invalid subscriptions")),!1;for(let t=0;t<h.length;t+=1){const o=h[t].topic,a=h[t].qos;if("string"!=typeof o)return i.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof a)return i.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===c){if("boolean"!=typeof(h[t].nl||!1))return i.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(h[t].rap||!1))return i.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const r=h[t].rh||0;if("number"!=typeof r||r>2)return i.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}g+=r.byteLength(o)+2+1}d("subscribe: writing to stream: %o",o.SUBSCRIBE_HEADER),i.write(o.SUBSCRIBE_HEADER[1][l?1:0][0]),writeVarByteInt(i,g),v(i,p),null!==y&&y.write();let b=!0;for(const t of h){const a=t.topic,u=t.qos,l=+t.nl,d=+t.rap,p=t.rh;let h;writeString(i,a),h=o.SUBSCRIBE_OPTIONS_QOS[u],5===c&&(h|=l?o.SUBSCRIBE_OPTIONS_NL:0,h|=d?o.SUBSCRIBE_OPTIONS_RAP:0,h|=p?o.SUBSCRIBE_OPTIONS_RH[p]:0),b=i.write(r.from([h]))}return b}(t,i,u);case"suback":return function suback(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.messageId,d=u.granted,p=u.properties;let h=0;if("number"!=typeof l)return i.emit("error",new Error("Invalid messageId")),!1;h+=2;if("object"!=typeof d||!d.length)return i.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<d.length;t+=1){if("number"!=typeof d[t])return i.emit("error",new Error("Invalid qos vector")),!1;h+=1}let m=null;if(5===c){if(m=getPropertiesByMaximumPacketSize(i,p,a,h),!m)return!1;h+=m.length}i.write(o.SUBACK_HEADER),writeVarByteInt(i,h),v(i,l),null!==m&&m.write();return i.write(r.from(d))}(t,i,u);case"unsubscribe":return function unsubscribe(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.messageId,d=u.dup?o.DUP_MASK:0,p=u.unsubscriptions,h=u.properties;let m=0;if("number"!=typeof l)return i.emit("error",new Error("Invalid messageId")),!1;m+=2;if("object"!=typeof p||!p.length)return i.emit("error",new Error("Invalid unsubscriptions")),!1;for(let t=0;t<p.length;t+=1){if("string"!=typeof p[t])return i.emit("error",new Error("Invalid unsubscriptions")),!1;m+=r.byteLength(p[t])+2}let g=null;if(5===c){if(g=getProperties(i,h),!g)return!1;m+=g.length}i.write(o.UNSUBSCRIBE_HEADER[1][d?1:0][0]),writeVarByteInt(i,m),v(i,l),null!==g&&g.write();let y=!0;for(let t=0;t<p.length;t++)y=writeString(i,p[t]);return y}(t,i,u);case"unsuback":return function unsuback(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.messageId,d=u.dup?o.DUP_MASK:0,p=u.granted,h=u.properties,m=u.cmd;let g=2;if("number"!=typeof l)return i.emit("error",new Error("Invalid messageId")),!1;if(5===c){if("object"!=typeof p||!p.length)return i.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<p.length;t+=1){if("number"!=typeof p[t])return i.emit("error",new Error("Invalid qos vector")),!1;g+=1}}let y=null;if(5===c){if(y=getPropertiesByMaximumPacketSize(i,h,a,g),!y)return!1;g+=y.length}i.write(o.ACKS[m][0][d][0]),writeVarByteInt(i,g),v(i,l),null!==y&&y.write();5===c&&i.write(r.from(p));return!0}(t,i,u);case"pingreq":case"pingresp":return function emptyPacket(t,r,i){return r.write(o.EMPTY[t.cmd])}(t,i);case"disconnect":return function disconnect(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.reasonCode,d=u.properties;let p=5===c?1:0,h=null;if(5===c){if(h=getPropertiesByMaximumPacketSize(i,d,a,p),!h)return!1;p+=h.length}i.write(r.from([o.codes.disconnect<<4])),writeVarByteInt(i,p),5===c&&i.write(r.from([l]));null!==h&&h.write();return!0}(t,i,u);case"auth":return function auth(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.reasonCode,d=u.properties;let p=5===c?1:0;5!==c&&i.emit("error",new Error("Invalid mqtt version for auth packet"));const h=getPropertiesByMaximumPacketSize(i,d,a,p);if(!h)return!1;p+=h.length,i.write(r.from([o.codes.auth<<4])),writeVarByteInt(i,p),i.write(r.from([l])),null!==h&&h.write();return!0}(t,i,u);default:return i.emit("error",new Error("Unknown command")),!1}}function uncork(t){t.uncork()}Object.defineProperty(generate,"cacheNumbers",{get:()=>v===writeNumberCached,set(t){t?(p&&0!==Object.keys(p).length||(b=!0),v=writeNumberCached):(b=!1,v=writeNumberGenerated)}});const _={};function writeVarByteInt(t,r){if(r>o.VARBYTEINT_MAX)return t.emit("error",new Error("Invalid variable byte integer: "+r)),!1;let i=_[r];return i||(i=g(r),r<16384&&(_[r]=i)),d("writeVarByteInt: writing to stream: %o",i),t.write(i)}function writeString(t,i){const o=r.byteLength(i);return v(t,o),d("writeString: %s",i),t.write(i,"utf8")}function writeStringPair(t,r,i){writeString(t,r),writeString(t,i)}function writeNumberCached(t,r){return d("writeNumberCached: number: %d",r),d("writeNumberCached: %o",p[r]),t.write(p[r])}function writeNumberGenerated(t,r){const i=h(r);return d("writeNumberGenerated: %o",i),t.write(i)}function writeStringOrBuffer(t,r){"string"==typeof r?writeString(t,r):r?(v(t,r.length),t.write(r)):v(t,0)}function getProperties(t,i){if("object"!=typeof i||null!=i.length)return{length:1,write(){writeProperties(t,{},0)}};let a=0;function getLengthProperty(i,a){let c=0;switch(o.propertiesTypes[i]){case"byte":if("boolean"!=typeof a)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=2;break;case"int8":if("number"!=typeof a||a<0||a>255)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=2;break;case"binary":if(a&&null===a)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=1+r.byteLength(a)+2;break;case"int16":if("number"!=typeof a||a<0||a>65535)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=3;break;case"int32":if("number"!=typeof a||a<0||a>4294967295)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=5;break;case"var":if("number"!=typeof a||a<0||a>268435455)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=1+r.byteLength(g(a));break;case"string":if("string"!=typeof a)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=3+r.byteLength(a.toString());break;case"pair":if("object"!=typeof a)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=Object.getOwnPropertyNames(a).reduce((t,i)=>{const o=a[i];return Array.isArray(o)?t+=o.reduce((t,o)=>t+=3+r.byteLength(i.toString())+2+r.byteLength(o.toString()),0):t+=3+r.byteLength(i.toString())+2+r.byteLength(a[i].toString()),t},0);break;default:return t.emit("error",new Error(`Invalid property ${i}: ${a}`)),!1}return c}if(i)for(const t in i){let r=0,o=0;const c=i[t];if(Array.isArray(c))for(let i=0;i<c.length;i++){if(o=getLengthProperty(t,c[i]),!o)return!1;r+=o}else{if(o=getLengthProperty(t,c),!o)return!1;r=o}if(!r)return!1;a+=r}return{length:r.byteLength(g(a))+a,write(){writeProperties(t,i,a)}}}function getPropertiesByMaximumPacketSize(t,r,i,o){const a=["reasonString","userProperties"],c=i&&i.properties&&i.properties.maximumPacketSize?i.properties.maximumPacketSize:0;let u=getProperties(t,r);if(c)for(;o+u.length>c;){const i=a.shift();if(!i||!r[i])return!1;delete r[i],u=getProperties(t,r)}return u}function writeProperty(t,i,a){switch(o.propertiesTypes[i]){case"byte":t.write(r.from([o.properties[i]])),t.write(r.from([+a]));break;case"int8":t.write(r.from([o.properties[i]])),t.write(r.from([a]));break;case"binary":t.write(r.from([o.properties[i]])),writeStringOrBuffer(t,a);break;case"int16":t.write(r.from([o.properties[i]])),v(t,a);break;case"int32":t.write(r.from([o.properties[i]])),function write4ByteNumber(t,r){const i=y(r);return d("write4ByteNumber: %o",i),t.write(i)}(t,a);break;case"var":t.write(r.from([o.properties[i]])),writeVarByteInt(t,a);break;case"string":t.write(r.from([o.properties[i]])),writeString(t,a);break;case"pair":Object.getOwnPropertyNames(a).forEach(c=>{const u=a[c];Array.isArray(u)?u.forEach(a=>{t.write(r.from([o.properties[i]])),writeStringPair(t,c.toString(),a.toString())}):(t.write(r.from([o.properties[i]])),writeStringPair(t,c.toString(),u.toString()))});break;default:return t.emit("error",new Error(`Invalid property ${i} value: ${a}`)),!1}}function writeProperties(t,r,i){writeVarByteInt(t,i);for(const i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&null!==r[i]){const o=r[i];if(Array.isArray(o))for(let r=0;r<o.length;r++)writeProperty(t,i,o[r]);else writeProperty(t,i,o)}}function byteLength(t){return t?t instanceof r?t.length:r.byteLength(t):0}function isStringOrBuffer(t){return"string"==typeof t||t instanceof r}t.exports=generate}).call(this,i(16).Buffer)},function(t,r,i){"use strict";var o=i(803),a=i(75)("mqttjs:tcp");t.exports=function streamBuilder(t,r){var i,c;return r.port=r.port||1883,r.hostname=r.hostname||r.host||"localhost",i=r.port,c=r.hostname,a("port %d and host %s",i,c),o.createConnection(i,c)}},function(t,r,i){"use strict";(function(r){var o,a,c,u=i(74).Transform,l=i(213);t.exports=function buildStream(t,i){if(i.hostname=i.hostname||i.host,!i.hostname)throw new Error("Could not determine host. Specify host manually.");var d="MQIsdp"===i.protocolId&&3===i.protocolVersion?"mqttv3.1":"mqtt";!function setDefaultOpts(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}(i);var p=function buildUrl(t,r){var i="wxs"===t.protocol?"wss":"ws",o=i+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(o=i+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(o=t.transformWsUrl(o,t,r)),o}(i,t);o=wx.connectSocket({url:p,protocols:[d]}),a=function buildProxy(){var t=new u;return t._write=function(t,r,i){o.send({data:t.buffer,success:function(){i()},fail:function(t){i(new Error(t))}})},t._flush=function socketEnd(t){o.close({success:function(){t()}})},t}(),(c=l.obj())._destroy=function(t,r){o.close({success:function(){r&&r(t)}})};var h=c.destroy;return c.destroy=function(){c.destroy=h;var t=this;setTimeout((function(){o.close({fail:function(){t._destroy(new Error)}})}),0)}.bind(c),function bindEventHandler(){o.onOpen((function(){c.setReadable(a),c.setWritable(a),c.emit("connect")})),o.onMessage((function(t){var i=t.data;i=i instanceof ArrayBuffer?r.from(i):r.from(i,"utf8"),a.push(i)})),o.onClose((function(){c.end(),c.destroy()})),o.onError((function(t){c.destroy(new Error(t.errMsg))}))}(),c}}).call(this,i(16).Buffer)},function(t,r,i){(function(r){var o=i(805),noop=function(){},eos=function(t,i,a){if("function"==typeof i)return eos(t,null,i);i||(i={}),a=o(a||noop);var c=t._writableState,u=t._readableState,l=i.readable||!1!==i.readable&&t.readable,d=i.writable||!1!==i.writable&&t.writable,p=!1,onlegacyfinish=function(){t.writable||onfinish()},onfinish=function(){d=!1,l||a.call(t)},onend=function(){l=!1,d||a.call(t)},onexit=function(r){a.call(t,r?new Error("exited with error code: "+r):null)},onerror=function(r){a.call(t,r)},onclose=function(){r.nextTick(onclosenexttick)},onclosenexttick=function(){if(!p)return(!l||u&&u.ended&&!u.destroyed)&&(!d||c&&c.ended&&!c.destroyed)?void 0:a.call(t,new Error("premature close"))},onrequest=function(){t.req.on("finish",onfinish)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(t)?d&&!c&&(t.on("end",onlegacyfinish),t.on("close",onlegacyfinish)):(t.on("complete",onfinish),t.on("abort",onclose),t.req?onrequest():t.on("request",onrequest)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on("exit",onexit),t.on("end",onend),t.on("finish",onfinish),!1!==i.error&&t.on("error",onerror),t.on("close",onclose),function(){p=!0,t.removeListener("complete",onfinish),t.removeListener("abort",onclose),t.removeListener("request",onrequest),t.req&&t.req.removeListener("finish",onfinish),t.removeListener("end",onlegacyfinish),t.removeListener("close",onlegacyfinish),t.removeListener("finish",onfinish),t.removeListener("exit",onexit),t.removeListener("end",onend),t.removeListener("error",onerror),t.removeListener("close",onclose)}};t.exports=eos}).call(this,i(19))},function(t,r){t.exports=function shift(t){var r=t._readableState;return r?r.objectMode||"number"==typeof t._duplexState?t.read():t.read(function getStateLength(t){if(t.buffer.length){var r=t.bufferIndex||0;if(t.buffer.head)return t.buffer.head.data.length;if(t.buffer.length-r>0&&t.buffer[r])return t.buffer[r].length}return t.length}(r)):null}},function(t,r,i){"use strict";(function(r){var o,a,c,u=i(74).Transform,l=i(213),d=!1;t.exports=function buildStream(t,i){if(i.hostname=i.hostname||i.host,!i.hostname)throw new Error("Could not determine host. Specify host manually.");var p="MQIsdp"===i.protocolId&&3===i.protocolVersion?"mqttv3.1":"mqtt";!function setDefaultOpts(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}(i);var h=function buildUrl(t,r){var i="alis"===t.protocol?"wss":"ws",o=i+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(o=i+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(o=t.transformWsUrl(o,t,r)),o}(i,t);return(o=i.my).connectSocket({url:h,protocols:p}),a=function buildProxy(){var t=new u;return t._write=function(t,r,i){o.sendSocketMessage({data:t.buffer,success:function(){i()},fail:function(){i(new Error)}})},t._flush=function socketEnd(t){o.closeSocket({success:function(){t()}})},t}(),c=l.obj(),function bindEventHandler(){d||(d=!0,o.onSocketOpen((function(){c.setReadable(a),c.setWritable(a),c.emit("connect")})),o.onSocketMessage((function(t){if("string"==typeof t.data){var i=r.from(t.data,"base64");a.push(i)}else{var o=new FileReader;o.addEventListener("load",(function(){var t=o.result;t=t instanceof ArrayBuffer?r.from(t):r.from(t,"utf8"),a.push(t)})),o.readAsArrayBuffer(t.data)}})),o.onSocketClose((function(){c.end(),c.destroy()})),o.onSocketError((function(t){c.destroy(t)})))}(),c}}).call(this,i(16).Buffer)},function(t,r,i){"use strict";(function(r,o){const a=i(807),c=i(75)("mqttjs:ws"),u=i(213),l=i(74).Transform;let d=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];const p=void 0!==r&&"browser"===r.title||"function"==typeof i;function buildUrl(t,r){let i=t.protocol+"://"+t.hostname+":"+t.port+t.path;return"function"==typeof t.transformWsUrl&&(i=t.transformWsUrl(i,t,r)),i}function setDefaultOpts(t){let r=t;return t.hostname||(r.hostname="localhost"),t.port||("wss"===t.protocol?r.port=443:r.port=80),t.path||(r.path="/"),t.wsOptions||(r.wsOptions={}),p||"wss"!==t.protocol||d.forEach((function(i){t.hasOwnProperty(i)&&!t.wsOptions.hasOwnProperty(i)&&(r.wsOptions[i]=t[i])})),r}t.exports=p?function browserStreamBuilder(t,r){let i;c("browserStreamBuilder");const a=function setDefaultBrowserOpts(t){let r=setDefaultOpts(t);if(r.hostname||(r.hostname=r.host),!r.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const t=new URL(document.URL);r.hostname=t.hostname,r.port||(r.port=t.port)}return void 0===r.objectMode&&(r.objectMode=!(!0===r.binary||void 0===r.binary)),r}(r).browserBufferSize||524288,d=r.browserBufferTimeout||1e3,p=!r.objectMode;let h=function createBrowserWebSocket(t,r){const i="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";let o=buildUrl(r,t),a=new WebSocket(o,[i]);return a.binaryType="arraybuffer",a}(t,r),m=function buildProxy(t,r,i){let o=new l({objectModeMode:t.objectMode});return o._write=r,o._flush=i,o}(r,(function socketWriteBrowser(t,r,i){h.bufferedAmount>a&&setTimeout(socketWriteBrowser,d,t,r,i);p&&"string"==typeof t&&(t=o.from(t,"utf8"));try{h.send(t)}catch(t){return i(t)}i()}),(function socketEndBrowser(t){h.close(),t()}));r.objectMode||(m._writev=writev),m.on("close",()=>{h.close()});const g=void 0!==h.addEventListener;function onopen(){i.setReadable(m),i.setWritable(m),i.emit("connect")}function onclose(){i.end(),i.destroy()}function onerror(t){i.destroy(t)}function onmessage(t){let r=t.data;r=r instanceof ArrayBuffer?o.from(r):o.from(r,"utf8"),m.push(r)}function writev(t,r){const i=new Array(t.length);for(let r=0;r<t.length;r++)"string"==typeof t[r].chunk?i[r]=o.from(t[r],"utf8"):i[r]=t[r].chunk;this._write(o.concat(i),"binary",r)}return h.readyState===h.OPEN?i=m:(i=i=u(void 0,void 0,r),r.objectMode||(i._writev=writev),g?h.addEventListener("open",onopen):h.onopen=onopen),i.socket=h,g?(h.addEventListener("close",onclose),h.addEventListener("error",onerror),h.addEventListener("message",onmessage)):(h.onclose=onclose,h.onerror=onerror,h.onmessage=onmessage),i}:function streamBuilder(t,r){c("streamBuilder");let i=setDefaultOpts(r);const o=buildUrl(i,t);let u=function createWebSocket(t,r,i){c("createWebSocket"),c("protocol: "+i.protocolId+" "+i.protocolVersion);const o="MQIsdp"===i.protocolId&&3===i.protocolVersion?"mqttv3.1":"mqtt";return c("creating new Websocket for url: "+r+" and protocol: "+o),new a(r,[o],i.wsOptions)}(0,o,i),l=a.createWebSocketStream(u,i.wsOptions);return l.url=o,u.on("close",()=>{l.destroy()}),l}}).call(this,i(19),i(16).Buffer)},function(t,r,i){var o;t.exports=(o=i(214),function(t){var r=o,i=r.lib,a=i.WordArray,c=i.Hasher,u=r.algo,l=[],d=[];!function(){function isPrime(r){for(var i=t.sqrt(r),o=2;o<=i;o++)if(!(r%o))return!1;return!0}function getFractionalBits(t){return 4294967296*(t-(0|t))|0}for(var r=2,i=0;i<64;)isPrime(r)&&(i<8&&(l[i]=getFractionalBits(t.pow(r,.5))),d[i]=getFractionalBits(t.pow(r,1/3)),i++),r++}();var p=[],h=u.SHA256=c.extend({_doReset:function(){this._hash=new a.init(l.slice(0))},_doProcessBlock:function(t,r){for(var i=this._hash.words,o=i[0],a=i[1],c=i[2],u=i[3],l=i[4],h=i[5],m=i[6],g=i[7],y=0;y<64;y++){if(y<16)p[y]=0|t[r+y];else{var v=p[y-15],b=(v<<25|v>>>7)^(v<<14|v>>>18)^v>>>3,_=p[y-2],w=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;p[y]=b+p[y-7]+w+p[y-16]}var S=o&a^o&c^a&c,I=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22),k=g+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&h^~l&m)+d[y]+p[y];g=m,m=h,h=l,l=u+k|0,u=c,c=a,a=o,o=k+(I+S)|0}i[0]=i[0]+o|0,i[1]=i[1]+a|0,i[2]=i[2]+c|0,i[3]=i[3]+u|0,i[4]=i[4]+l|0,i[5]=i[5]+h|0,i[6]=i[6]+m|0,i[7]=i[7]+g|0},_doFinalize:function(){var r=this._data,i=r.words,o=8*this._nDataBytes,a=8*r.sigBytes;return i[a>>>5]|=128<<24-a%32,i[14+(a+64>>>9<<4)]=t.floor(o/4294967296),i[15+(a+64>>>9<<4)]=o,r.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var t=c.clone.call(this);return t._hash=this._hash.clone(),t}});r.SHA256=c._createHelper(h),r.HmacSHA256=c._createHmacHelper(h)}(Math),o.SHA256)},function(t,r,i){(r=t.exports=i(340)).Stream=r,r.Readable=r,r.Writable=i(343),r.Duplex=i(97),r.Transform=i(344),r.PassThrough=i(825)},function(t,r,i){"use strict";(function(r,o){var a=i(117);t.exports=Readable;var c,u=i(819);Readable.ReadableState=ReadableState;i(45).EventEmitter;var EElistenerCount=function(t,r){return t.listeners(r).length},l=i(341),d=i(154).Buffer,p=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var h=Object.create(i(118));h.inherits=i(30);var m=i(820),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y,v=i(821),b=i(342);h.inherits(Readable,l);var _=["error","close","destroy","pause","resume"];function ReadableState(t,r){t=t||{};var o=r instanceof(c=c||i(97));this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var a=t.highWaterMark,u=t.readableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:o&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new v,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(y||(y=i(152).StringDecoder),this.decoder=new y(t.encoding),this.encoding=t.encoding)}function Readable(t){if(c=c||i(97),!(this instanceof Readable))return new Readable(t);this._readableState=new ReadableState(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),l.call(this)}function readableAddChunk(t,r,i,o,a){var c,u=t._readableState;null===r?(u.reading=!1,function onEofChunk(t,r){if(r.ended)return;if(r.decoder){var i=r.decoder.end();i&&i.length&&(r.buffer.push(i),r.length+=r.objectMode?1:i.length)}r.ended=!0,emitReadable(t)}(t,u)):(a||(c=function chunkInvalid(t,r){var i;(function _isUint8Array(t){return d.isBuffer(t)||t instanceof p})(r)||"string"==typeof r||void 0===r||t.objectMode||(i=new TypeError("Invalid non-string/buffer chunk"));return i}(u,r)),c?t.emit("error",c):u.objectMode||r&&r.length>0?("string"==typeof r||u.objectMode||Object.getPrototypeOf(r)===d.prototype||(r=function _uint8ArrayToBuffer(t){return d.from(t)}(r)),o?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):addChunk(t,u,r,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!i?(r=u.decoder.write(r),u.objectMode||0!==r.length?addChunk(t,u,r,!1):maybeReadMore(t,u)):addChunk(t,u,r,!1))):o||(u.reading=!1));return function needMoreData(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function addChunk(t,r,i,o){r.flowing&&0===r.length&&!r.sync?(t.emit("data",i),t.read(0)):(r.length+=r.objectMode?1:i.length,o?r.buffer.unshift(i):r.buffer.push(i),r.needReadable&&emitReadable(t)),maybeReadMore(t,r)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),Readable.prototype.destroy=b.destroy,Readable.prototype._undestroy=b.undestroy,Readable.prototype._destroy=function(t,r){this.push(null),r(t)},Readable.prototype.push=function(t,r){var i,o=this._readableState;return o.objectMode?i=!0:"string"==typeof t&&((r=r||o.defaultEncoding)!==o.encoding&&(t=d.from(t,r),r=""),i=!0),readableAddChunk(this,t,r,!1,i)},Readable.prototype.unshift=function(t){return readableAddChunk(this,t,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(t){return y||(y=i(152).StringDecoder),this._readableState.decoder=new y(t),this._readableState.encoding=t,this};function howMuchToRead(t,r){return t<=0||0===r.length&&r.ended?0:r.objectMode?1:t!=t?r.flowing&&r.length?r.buffer.head.data.length:r.length:(t>r.highWaterMark&&(r.highWaterMark=function computeNewHighWaterMark(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=r.length?t:r.ended?r.length:(r.needReadable=!0,0))}function emitReadable(t){var r=t._readableState;r.needReadable=!1,r.emittedReadable||(g("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?a.nextTick(emitReadable_,t):emitReadable_(t))}function emitReadable_(t){g("emit readable"),t.emit("readable"),flow(t)}function maybeReadMore(t,r){r.readingMore||(r.readingMore=!0,a.nextTick(maybeReadMore_,t,r))}function maybeReadMore_(t,r){for(var i=r.length;!r.reading&&!r.flowing&&!r.ended&&r.length<r.highWaterMark&&(g("maybeReadMore read 0"),t.read(0),i!==r.length);)i=r.length;r.readingMore=!1}function nReadingNextTick(t){g("readable nexttick read 0"),t.read(0)}function resume_(t,r){r.reading||(g("resume read 0"),t.read(0)),r.resumeScheduled=!1,r.awaitDrain=0,t.emit("resume"),flow(t),r.flowing&&!r.reading&&t.read(0)}function flow(t){var r=t._readableState;for(g("flow",r.flowing);r.flowing&&null!==t.read(););}function fromList(t,r){return 0===r.length?null:(r.objectMode?i=r.buffer.shift():!t||t>=r.length?(i=r.decoder?r.buffer.join(""):1===r.buffer.length?r.buffer.head.data:r.buffer.concat(r.length),r.buffer.clear()):i=function fromListPartial(t,r,i){var o;t<r.head.data.length?(o=r.head.data.slice(0,t),r.head.data=r.head.data.slice(t)):o=t===r.head.data.length?r.shift():i?function copyFromBufferString(t,r){var i=r.head,o=1,a=i.data;t-=a.length;for(;i=i.next;){var c=i.data,u=t>c.length?c.length:t;if(u===c.length?a+=c:a+=c.slice(0,t),0===(t-=u)){u===c.length?(++o,i.next?r.head=i.next:r.head=r.tail=null):(r.head=i,i.data=c.slice(u));break}++o}return r.length-=o,a}(t,r):function copyFromBuffer(t,r){var i=d.allocUnsafe(t),o=r.head,a=1;o.data.copy(i),t-=o.data.length;for(;o=o.next;){var c=o.data,u=t>c.length?c.length:t;if(c.copy(i,i.length-t,0,u),0===(t-=u)){u===c.length?(++a,o.next?r.head=o.next:r.head=r.tail=null):(r.head=o,o.data=c.slice(u));break}++a}return r.length-=a,i}(t,r);return o}(t,r.buffer,r.decoder),i);var i}function endReadable(t){var r=t._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,a.nextTick(endReadableNT,r,t))}function endReadableNT(t,r){t.endEmitted||0!==t.length||(t.endEmitted=!0,r.readable=!1,r.emit("end"))}function indexOf(t,r){for(var i=0,o=t.length;i<o;i++)if(t[i]===r)return i;return-1}Readable.prototype.read=function(t){g("read",t),t=parseInt(t,10);var r=this._readableState,i=t;if(0!==t&&(r.emittedReadable=!1),0===t&&r.needReadable&&(r.length>=r.highWaterMark||r.ended))return g("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?endReadable(this):emitReadable(this),null;if(0===(t=howMuchToRead(t,r))&&r.ended)return 0===r.length&&endReadable(this),null;var o,a=r.needReadable;return g("need readable",a),(0===r.length||r.length-t<r.highWaterMark)&&g("length less than watermark",a=!0),r.ended||r.reading?g("reading or ended",a=!1):a&&(g("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(t=howMuchToRead(i,r))),null===(o=t>0?fromList(t,r):null)?(r.needReadable=!0,t=0):r.length-=t,0===r.length&&(r.ended||(r.needReadable=!0),i!==t&&r.ended&&endReadable(this)),null!==o&&this.emit("data",o),o},Readable.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(t,r){var i=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=t;break;case 1:c.pipes=[c.pipes,t];break;default:c.pipes.push(t)}c.pipesCount+=1,g("pipe count=%d opts=%j",c.pipesCount,r);var l=(!r||!1!==r.end)&&t!==o.stdout&&t!==o.stderr?onend:unpipe;function onunpipe(r,o){g("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,function cleanup(){g("cleanup"),t.removeListener("close",onclose),t.removeListener("finish",onfinish),t.removeListener("drain",d),t.removeListener("error",onerror),t.removeListener("unpipe",onunpipe),i.removeListener("end",onend),i.removeListener("end",unpipe),i.removeListener("data",ondata),p=!0,!c.awaitDrain||t._writableState&&!t._writableState.needDrain||d()}())}function onend(){g("onend"),t.end()}c.endEmitted?a.nextTick(l):i.once("end",l),t.on("unpipe",onunpipe);var d=function pipeOnDrain(t){return function(){var r=t._readableState;g("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&EElistenerCount(t,"data")&&(r.flowing=!0,flow(t))}}(i);t.on("drain",d);var p=!1;var h=!1;function ondata(r){g("ondata"),h=!1,!1!==t.write(r)||h||((1===c.pipesCount&&c.pipes===t||c.pipesCount>1&&-1!==indexOf(c.pipes,t))&&!p&&(g("false write response, pause",c.awaitDrain),c.awaitDrain++,h=!0),i.pause())}function onerror(r){g("onerror",r),unpipe(),t.removeListener("error",onerror),0===EElistenerCount(t,"error")&&t.emit("error",r)}function onclose(){t.removeListener("finish",onfinish),unpipe()}function onfinish(){g("onfinish"),t.removeListener("close",onclose),unpipe()}function unpipe(){g("unpipe"),i.unpipe(t)}return i.on("data",ondata),function prependListener(t,r,i){if("function"==typeof t.prependListener)return t.prependListener(r,i);t._events&&t._events[r]?u(t._events[r])?t._events[r].unshift(i):t._events[r]=[i,t._events[r]]:t.on(r,i)}(t,"error",onerror),t.once("close",onclose),t.once("finish",onfinish),t.emit("pipe",i),c.flowing||(g("pipe resume"),i.resume()),t},Readable.prototype.unpipe=function(t){var r=this._readableState,i={hasUnpiped:!1};if(0===r.pipesCount)return this;if(1===r.pipesCount)return t&&t!==r.pipes||(t||(t=r.pipes),r.pipes=null,r.pipesCount=0,r.flowing=!1,t&&t.emit("unpipe",this,i)),this;if(!t){var o=r.pipes,a=r.pipesCount;r.pipes=null,r.pipesCount=0,r.flowing=!1;for(var c=0;c<a;c++)o[c].emit("unpipe",this,{hasUnpiped:!1});return this}var u=indexOf(r.pipes,t);return-1===u||(r.pipes.splice(u,1),r.pipesCount-=1,1===r.pipesCount&&(r.pipes=r.pipes[0]),t.emit("unpipe",this,i)),this},Readable.prototype.on=function(t,r){var i=l.prototype.on.call(this,t,r);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var o=this._readableState;o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.emittedReadable=!1,o.reading?o.length&&emitReadable(this):a.nextTick(nReadingNextTick,this))}return i},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.resume=function(){var t=this._readableState;return t.flowing||(g("resume"),t.flowing=!0,function resume(t,r){r.resumeScheduled||(r.resumeScheduled=!0,a.nextTick(resume_,t,r))}(this,t)),this},Readable.prototype.pause=function(){return g("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(g("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Readable.prototype.wrap=function(t){var r=this,i=this._readableState,o=!1;for(var a in t.on("end",(function(){if(g("wrapped end"),i.decoder&&!i.ended){var t=i.decoder.end();t&&t.length&&r.push(t)}r.push(null)})),t.on("data",(function(a){(g("wrapped data"),i.decoder&&(a=i.decoder.write(a)),i.objectMode&&null==a)||(i.objectMode||a&&a.length)&&(r.push(a)||(o=!0,t.pause()))})),t)void 0===this[a]&&"function"==typeof t[a]&&(this[a]=function(r){return function(){return t[r].apply(t,arguments)}}(a));for(var c=0;c<_.length;c++)t.on(_[c],this.emit.bind(this,_[c]));return this._read=function(r){g("wrapped _read",r),o&&(o=!1,t.resume())},this},Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Readable._fromList=fromList}).call(this,i(17),i(19))},function(t,r,i){t.exports=i(45).EventEmitter},function(t,r,i){"use strict";var o=i(117);function emitErrorNT(t,r){t.emit("error",r)}t.exports={destroy:function destroy(t,r){var i=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(r?r(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,o.nextTick(emitErrorNT,this,t)):o.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!r&&t?i._writableState?i._writableState.errorEmitted||(i._writableState.errorEmitted=!0,o.nextTick(emitErrorNT,i,t)):o.nextTick(emitErrorNT,i,t):r&&r(t)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,r,i){"use strict";(function(r,o,a){var c=i(117);function CorkedRequest(t){var r=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(t,r,i){var o=t.entry;t.entry=null;for(;o;){var a=o.callback;r.pendingcb--,a(i),o=o.next}r.corkedRequestsFree.next=t}(r,t)}}t.exports=Writable;var u,l=!r.browser&&["v0.10","v0.9."].indexOf(r.version.slice(0,5))>-1?o:c.nextTick;Writable.WritableState=WritableState;var d=Object.create(i(118));d.inherits=i(30);var p={deprecate:i(328)},h=i(341),m=i(154).Buffer,g=(void 0!==a?a:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var y,v=i(342);function nop(){}function WritableState(t,r){u=u||i(97),t=t||{};var o=r instanceof u;this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var a=t.highWaterMark,d=t.writableHighWaterMark,p=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:o&&(d||0===d)?d:p,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function onwrite(t,r){var i=t._writableState,o=i.sync,a=i.writecb;if(function onwriteStateUpdate(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),r)!function onwriteError(t,r,i,o,a){--r.pendingcb,i?(c.nextTick(a,o),c.nextTick(finishMaybe,t,r),t._writableState.errorEmitted=!0,t.emit("error",o)):(a(o),t._writableState.errorEmitted=!0,t.emit("error",o),finishMaybe(t,r))}(t,i,o,r,a);else{var u=needFinish(i);u||i.corked||i.bufferProcessing||!i.bufferedRequest||clearBuffer(t,i),o?l(afterWrite,t,i,u,a):afterWrite(t,i,u,a)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(t){if(u=u||i(97),!(y.call(Writable,this)||this instanceof u))return new Writable(t);this._writableState=new WritableState(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function doWrite(t,r,i,o,a,c,u){r.writelen=o,r.writecb=u,r.writing=!0,r.sync=!0,i?t._writev(a,r.onwrite):t._write(a,c,r.onwrite),r.sync=!1}function afterWrite(t,r,i,o){i||function onwriteDrain(t,r){0===r.length&&r.needDrain&&(r.needDrain=!1,t.emit("drain"))}(t,r),r.pendingcb--,o(),finishMaybe(t,r)}function clearBuffer(t,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(t._writev&&i&&i.next){var o=r.bufferedRequestCount,a=new Array(o),c=r.corkedRequestsFree;c.entry=i;for(var u=0,l=!0;i;)a[u]=i,i.isBuf||(l=!1),i=i.next,u+=1;a.allBuffers=l,doWrite(t,r,!0,r.length,a,"",c.finish),r.pendingcb++,r.lastBufferedRequest=null,c.next?(r.corkedRequestsFree=c.next,c.next=null):r.corkedRequestsFree=new CorkedRequest(r),r.bufferedRequestCount=0}else{for(;i;){var d=i.chunk,p=i.encoding,h=i.callback;if(doWrite(t,r,!1,r.objectMode?1:d.length,d,p,h),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function needFinish(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function callFinal(t,r){t._final((function(i){r.pendingcb--,i&&t.emit("error",i),r.prefinished=!0,t.emit("prefinish"),finishMaybe(t,r)}))}function finishMaybe(t,r){var i=needFinish(r);return i&&(!function prefinish(t,r){r.prefinished||r.finalCalled||("function"==typeof t._final?(r.pendingcb++,r.finalCalled=!0,c.nextTick(callFinal,t,r)):(r.prefinished=!0,t.emit("prefinish")))}(t,r),0===r.pendingcb&&(r.finished=!0,t.emit("finish"))),i}d.inherits(Writable,h),WritableState.prototype.getBuffer=function getBuffer(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:p.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(y=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(t){return!!y.call(this,t)||this===Writable&&(t&&t._writableState instanceof WritableState)}})):y=function(t){return t instanceof this},Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(t,r,i){var o=this._writableState,a=!1,u=!o.objectMode&&function _isUint8Array(t){return m.isBuffer(t)||t instanceof g}(t);return u&&!m.isBuffer(t)&&(t=function _uint8ArrayToBuffer(t){return m.from(t)}(t)),"function"==typeof r&&(i=r,r=null),u?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof i&&(i=nop),o.ended?function writeAfterEnd(t,r){var i=new Error("write after end");t.emit("error",i),c.nextTick(r,i)}(this,i):(u||function validChunk(t,r,i,o){var a=!0,u=!1;return null===i?u=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||r.objectMode||(u=new TypeError("Invalid non-string/buffer chunk")),u&&(t.emit("error",u),c.nextTick(o,u),a=!1),a}(this,o,t,i))&&(o.pendingcb++,a=function writeOrBuffer(t,r,i,o,a,c){if(!i){var u=function decodeChunk(t,r,i){t.objectMode||!1===t.decodeStrings||"string"!=typeof r||(r=m.from(r,i));return r}(r,o,a);o!==u&&(i=!0,a="buffer",o=u)}var l=r.objectMode?1:o.length;r.length+=l;var d=r.length<r.highWaterMark;d||(r.needDrain=!0);if(r.writing||r.corked){var p=r.lastBufferedRequest;r.lastBufferedRequest={chunk:o,encoding:a,isBuf:i,callback:c,next:null},p?p.next=r.lastBufferedRequest:r.bufferedRequest=r.lastBufferedRequest,r.bufferedRequestCount+=1}else doWrite(t,r,!1,l,o,a,c);return d}(this,o,u,t,r,i)),a},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||clearBuffer(this,t))},Writable.prototype.setDefaultEncoding=function setDefaultEncoding(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(t,r,i){i(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(t,r,i){var o=this._writableState;"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),o.corked&&(o.corked=1,this.uncork()),o.ending||function endWritable(t,r,i){r.ending=!0,finishMaybe(t,r),i&&(r.finished?c.nextTick(i):t.once("finish",i));r.ended=!0,t.writable=!1}(this,o,i)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),Writable.prototype.destroy=v.destroy,Writable.prototype._undestroy=v.undestroy,Writable.prototype._destroy=function(t,r){this.end(),r(t)}}).call(this,i(19),i(823).setImmediate,i(17))},function(t,r,i){"use strict";t.exports=Transform;var o=i(97),a=Object.create(i(118));function afterTransform(t,r){var i=this._transformState;i.transforming=!1;var o=i.writecb;if(!o)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,null!=r&&this.push(r),o(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function Transform(t){if(!(this instanceof Transform))return new Transform(t);o.call(this,t),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",prefinish)}function prefinish(){var t=this;"function"==typeof this._flush?this._flush((function(r,i){done(t,r,i)})):done(this,null,null)}function done(t,r,i){if(r)return t.emit("error",r);if(null!=i&&t.push(i),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}a.inherits=i(30),a.inherits(Transform,o),Transform.prototype.push=function(t,r){return this._transformState.needTransform=!1,o.prototype.push.call(this,t,r)},Transform.prototype._transform=function(t,r,i){throw new Error("_transform() is not implemented")},Transform.prototype._write=function(t,r,i){var o=this._transformState;if(o.writecb=i,o.writechunk=t,o.writeencoding=r,!o.transforming){var a=this._readableState;(o.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},Transform.prototype._read=function(t){var r=this._transformState;null!==r.writechunk&&r.writecb&&!r.transforming?(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform)):r.needTransform=!0},Transform.prototype._destroy=function(t,r){var i=this;o.prototype._destroy.call(this,t,(function(t){r(t),i.emit("close")}))}},function(t,r,i){"use strict";(function(t){var o=i(219),a=i(354),c=i(37);class Auth{constructor(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-GB",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.ID_TOKEN=(""!==i?i+"_":"")+"rwt_idToken",this.ACCESS_TOKEN=(""!==i?i+"_":"")+"rwt_accessToken",this.REFRESH_TOKEN=(""!==i?i+"_":"")+"rwt_refreshToken",Object.assign(this,Object(c.a)()),this.__log=Auth.noop,t&&this._enableDebug(),this.__language=r,this.__refreshTokenPromise=null,this.__isRefreshing=!1,this.__isLogged=null,this.__parsedJwt=null,this.__specUrl=o||a.a.apiUrl,this.__client=this.initialize(!0)}static noop(){}_enableDebug(){this.__log=console.log.bind(console)}_requestInterceptor(t){return t.headers||(t.headers={}),t.headers["Accept-Language"]=this.__language,t}_responseInterceptor(t,r){if(401===t.status&&this.__isLogged){let t=localStorage.getItem(this.REFRESH_TOKEN);return this.__refreshTokenPromise=this.__isRefreshing?this.__refreshTokenPromise:this.__client.then(t=>(this.__isRefreshing=!0,t.apis.auth.refreshToken({},{requestBody:{refreshToken:localStorage.getItem(this.REFRESH_TOKEN)}}))).then(r=>(this.__isRefreshing=!1,this.login(r.data.idToken,r.data.accessToken,t,!0))).catch(t=>(this.__isRefreshing=!1,this.logout(),Promise.reject(t))),this.__refreshTokenPromise.then(()=>o.a.http({...r,headers:{...r.headers,Authorization:"Bearer "+localStorage.getItem(this.ID_TOKEN)}})).then(t=>("object"==typeof t.obj&&null!==t.obj&&(t.data=t.obj),t))}return"object"==typeof t.obj&&null!==t.obj&&(t.data=t.obj),t}initialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=localStorage.getItem(this.ID_TOKEN),a={};i&&(a.bearer=""+i),this.__isLogged=!!i;let c=this;return new o.a(this.__specUrl,{authorizations:a,requestInterceptor:this._requestInterceptor.bind(this),responseInterceptor:function(t){return c._responseInterceptor(t,this)}}).then(o=>(this.__isLogged=!!i,this.__parsedJwt=this.parseJwt(i),this.emit(this.__isLogged?"login":"logout",{client:o,isInitialEvent:t,isReauth:r,isLoggedInAsDevice:this.isLoggedInAs(this.__parsedJwt,"device"),isLoggedInAsObserver:this.isLoggedInAs(this.__parsedJwt,"observer"),isLoggedInAsInstanceAdmin:this.isLoggedInAs(this.__parsedJwt,"instanceAdmin"),isDemoAccount:this.isLoggedInAs(this.__parsedJwt,"demo"),isLoggedInAsAdmin:this.isLoggedInAs(this.__parsedJwt,"admin"),domain:this.getDomain(this.__parsedJwt)}),o)).catch(i=>(this.__isLogged=!1,this.emit("logout",{client:null,isInitialEvent:t,isLoggedInAsDevice:!1,isLoggedInAsObserver:!1,isLoggedInAsInstanceAdmin:!1,isDemoAccount:!1,isLoggedInAsAdmin:!1,isReauth:r}),Promise.reject(i)))}login(t,r,i){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return localStorage.setItem(this.ID_TOKEN,t),localStorage.setItem(this.ACCESS_TOKEN,r),localStorage.setItem(this.REFRESH_TOKEN,i),this.__client=this.initialize(!1,o)}logout(){return localStorage.removeItem(this.ID_TOKEN),localStorage.removeItem(this.ACCESS_TOKEN),localStorage.removeItem(this.REFRESH_TOKEN),this.__client=this.initialize()}isLoggedIn(){return this.__isLogged}isLoggedInAs(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"device";return!!((t=t||this.__parsedJwt)&&t["cognito:groups"]&&t["cognito:groups"].includes(r))}setLanguage(t){return this.__language=t,this.__language}getDomain(t){return(t=t||this.__parsedJwt)["custom:domain"]}parseJwt(r){if(!r||"string"!=typeof r)return!1;let i=r.match(/^(([0-9a-zA-Z]*)\.){2}[\w-]*$/);if(!i||!i[2])return!1;try{return i=new t(i[2],"base64").toString("binary"),JSON.parse(i)}catch(t){return!1}}}r.a=Auth}).call(this,i(16).Buffer)},function(t,r,i){t.exports=i(600)},function(t,r,i){t.exports=i(604)},function(t,r,i){"use strict";(function(r){function isSpecificValue(t){return t instanceof r||t instanceof Date||t instanceof RegExp}function cloneSpecificValue(t){if(t instanceof r){var i=r.alloc?r.alloc(t.length):new r(t.length);return t.copy(i),i}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);throw new Error("Unexpected situation")}function deepCloneArray(t){var r=[];return t.forEach((function(t,o){"object"==typeof t&&null!==t?Array.isArray(t)?r[o]=deepCloneArray(t):isSpecificValue(t)?r[o]=cloneSpecificValue(t):r[o]=i({},t):r[o]=t})),r}function safeGetProperty(t,r){return"__proto__"===r?void 0:t[r]}var i=t.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var t,r,o=arguments[0],a=Array.prototype.slice.call(arguments,1);return a.forEach((function(a){"object"!=typeof a||null===a||Array.isArray(a)||Object.keys(a).forEach((function(c){return r=safeGetProperty(o,c),(t=safeGetProperty(a,c))===o?void 0:"object"!=typeof t||null===t?void(o[c]=t):Array.isArray(t)?void(o[c]=deepCloneArray(t)):isSpecificValue(t)?void(o[c]=cloneSpecificValue(t)):"object"!=typeof r||null===r||Array.isArray(r)?void(o[c]=i({},t)):void(o[c]=i(r,t))}))})),o}}).call(this,i(16).Buffer)},function(t,r,i){var o=i(609);t.exports=function cloneDeep(t){return o(t,5)}},function(t,r,i){t.exports=i(678)},function(t,r,i){"use strict";var o=i(113),a=i(695),c=i(85);function toS(t){return Object.prototype.toString.call(t)}var u=Array.isArray||function isArray(t){return"[object Array]"===Object.prototype.toString.call(t)};function forEach(t,r){if(t.forEach)return t.forEach(r);for(var i=0;i<t.length;i++)r(t[i],i,t)}var l=Object.keys||function keys(t){var r=[];for(var i in t)r.push(i);return r},d=Object.prototype.propertyIsEnumerable,p=Object.getOwnPropertySymbols;function ownEnumerableKeys(t){var r=l(t);if(p)for(var i=p(t),o=0;o<i.length;o++)d.call(t,i[o])&&r.push(i[o]);return r}var h=Object.prototype.hasOwnProperty||function(t,r){return r in t};function isWritable(t,r){return"function"!=typeof c||!c(t,r).writable}function copy(t,r){if("object"==typeof t&&null!==t){var i;if(u(t))i=[];else if(function isDate(t){return"[object Date]"===toS(t)}(t))i=new Date(t.getTime?t.getTime():t);else if(function isRegExp(t){return"[object RegExp]"===toS(t)}(t))i=new RegExp(t);else if(function isError(t){return"[object Error]"===toS(t)}(t))i={message:t.message};else if(function isBoolean(t){return"[object Boolean]"===toS(t)}(t)||function isNumber(t){return"[object Number]"===toS(t)}(t)||function isString(t){return"[object String]"===toS(t)}(t))i=Object(t);else{if(o(t))return a(t);if(Object.create&&Object.getPrototypeOf)i=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)i={};else{var c=t.constructor&&t.constructor.prototype||t.__proto__||{},d=function T(){};d.prototype=c,i=new d}}return forEach((r.includeSymbols?ownEnumerableKeys:l)(t),(function(r){i[r]=t[r]})),i}return t}var m={__proto__:null};function walk(t,r){var i=[],o=[],a=!0,c=arguments.length>2?arguments[2]:m,d=c.includeSymbols?ownEnumerableKeys:l,p=!!c.immutable;return function walker(t){var l=p?copy(t,c):t,m={},g=!0,y={node:l,node_:t,path:[].concat(i),parent:o[o.length-1],parents:o,key:i[i.length-1],isRoot:0===i.length,level:i.length,circular:null,update:function(t,r){y.isRoot||(y.parent.node[y.key]=t),y.node=t,r&&(g=!1)},delete:function(t){delete y.parent.node[y.key],t&&(g=!1)},remove:function(t){u(y.parent.node)?y.parent.node.splice(y.key,1):delete y.parent.node[y.key],t&&(g=!1)},keys:null,before:function(t){m.before=t},after:function(t){m.after=t},pre:function(t){m.pre=t},post:function(t){m.post=t},stop:function(){a=!1},block:function(){g=!1}};if(!a)return y;function updateState(){if("object"==typeof y.node&&null!==y.node){y.keys&&y.node_===y.node||(y.keys=d(y.node)),y.isLeaf=0===y.keys.length;for(var r=0;r<o.length;r++)if(o[r].node_===t){y.circular=o[r];break}}else y.isLeaf=!0,y.keys=null;y.notLeaf=!y.isLeaf,y.notRoot=!y.isRoot}updateState();var v=r.call(y,y.node);return void 0!==v&&y.update&&y.update(v),m.before&&m.before.call(y,y.node),g?("object"!=typeof y.node||null===y.node||y.circular||(o.push(y),updateState(),forEach(y.keys,(function(t,r){i.push(t),m.pre&&m.pre.call(y,y.node[t],t);var o=walker(y.node[t]);p&&h.call(y.node,t)&&!isWritable(y.node,t)&&(y.node[t]=o.node),o.isLast=r===y.keys.length-1,o.isFirst=0===r,m.post&&m.post.call(y,o),i.pop()})),o.pop()),m.after&&m.after.call(y,y.node),y):y}(t).node}function Traverse(t){this.options=arguments.length>1?arguments[1]:m,this.value=t}function traverse(t){var r=arguments.length>1?arguments[1]:m;return new Traverse(t,r)}Traverse.prototype.get=function(t){for(var r=this.value,i=0;r&&i<t.length;i++){var o=t[i];if(!h.call(r,o)||!this.options.includeSymbols&&"symbol"==typeof o)return;r=r[o]}return r},Traverse.prototype.has=function(t){for(var r=this.value,i=0;r&&i<t.length;i++){var o=t[i];if(!h.call(r,o)||!this.options.includeSymbols&&"symbol"==typeof o)return!1;r=r[o]}return!0},Traverse.prototype.set=function(t,r){for(var i=this.value,o=0;o<t.length-1;o++){var a=t[o];h.call(i,a)||(i[a]={}),i=i[a]}return i[t[o]]=r,r},Traverse.prototype.map=function(t){return walk(this.value,t,{__proto__:null,immutable:!0,includeSymbols:!!this.options.includeSymbols})},Traverse.prototype.forEach=function(t){return this.value=walk(this.value,t,this.options),this.value},Traverse.prototype.reduce=function(t,r){var i=1===arguments.length,o=i?this.value:r;return this.forEach((function(r){this.isRoot&&i||(o=t.call(this,o,r))})),o},Traverse.prototype.paths=function(){var t=[];return this.forEach((function(){t.push(this.path)})),t},Traverse.prototype.nodes=function(){var t=[];return this.forEach((function(){t.push(this.node)})),t},Traverse.prototype.clone=function(){var t=[],r=[],i=this.options;return o(this.value)?a(this.value):function clone(o){for(var a=0;a<t.length;a++)if(t[a]===o)return r[a];if("object"==typeof o&&null!==o){var c=copy(o,i);return t.push(o),r.push(c),forEach((i.includeSymbols?ownEnumerableKeys:l)(o),(function(t){c[t]=clone(o[t])})),t.pop(),r.pop(),c}return o}(this.value)},forEach(ownEnumerableKeys(Traverse.prototype),(function(t){traverse[t]=function(r){var i=[].slice.call(arguments,1),o=new Traverse(r);return o[t].apply(o,i)}})),t.exports=traverse},function(t,r,i){var o=i(227),a=i(321),c=i(779);t.exports=function _objectWithoutProperties(t,r){if(null==t)return{};var i,u,l=c(t,r);if(o){var d=o(t);for(u=0;u<d.length;u++)i=d[u],a(r).call(r,i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(l[i]=t[i])}return l},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";r.parse=function parse(t,r){if("string"!=typeof t)throw new TypeError("argument str must be a string");for(var i={},a=r||{},c=t.split(";"),u=a.decode||o,l=0;l<c.length;l++){var d=c[l],p=d.indexOf("=");if(!(p<0)){var h=d.substring(0,p).trim();if(null==i[h]){var m=d.substring(p+1,d.length).trim();'"'===m[0]&&(m=m.slice(1,-1)),i[h]=tryDecode(m,u)}}}return i},r.serialize=function serialize(t,r,i){var o=i||{},u=o.encode||a;if("function"!=typeof u)throw new TypeError("option encode is invalid");if(!c.test(t))throw new TypeError("argument name is invalid");var l=u(r);if(l&&!c.test(l))throw new TypeError("argument val is invalid");var d=t+"="+l;if(null!=o.maxAge){var p=o.maxAge-0;if(isNaN(p)||!isFinite(p))throw new TypeError("option maxAge is invalid");d+="; Max-Age="+Math.floor(p)}if(o.domain){if(!c.test(o.domain))throw new TypeError("option domain is invalid");d+="; Domain="+o.domain}if(o.path){if(!c.test(o.path))throw new TypeError("option path is invalid");d+="; Path="+o.path}if(o.expires){if("function"!=typeof o.expires.toUTCString)throw new TypeError("option expires is invalid");d+="; Expires="+o.expires.toUTCString()}o.httpOnly&&(d+="; HttpOnly");o.secure&&(d+="; Secure");if(o.sameSite){switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:d+="; SameSite=Strict";break;case"lax":d+="; SameSite=Lax";break;case"strict":d+="; SameSite=Strict";break;case"none":d+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return d};var o=decodeURIComponent,a=encodeURIComponent,c=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function tryDecode(t,r){try{return r(t)}catch(r){return t}}},function(t,r,i){"use strict";r.a={apiUrl:"https://api.reactoo.com/v3/swagger.json",devApiUrl:"https://api.reactoo.com/dev3/swagger.json"}},function(t,r,i){t.exports.device=i(208),t.exports.thingShadow=i(828),t.exports.jobs=i(829)},function(t,r,i){"use strict";r.byteLength=function byteLength(t){var r=getLens(t),i=r[0],o=r[1];return 3*(i+o)/4-o},r.toByteArray=function toByteArray(t){var r,i,o=getLens(t),u=o[0],l=o[1],d=new c(function _byteLength(t,r,i){return 3*(r+i)/4-i}(0,u,l)),p=0,h=l>0?u-4:u;for(i=0;i<h;i+=4)r=a[t.charCodeAt(i)]<<18|a[t.charCodeAt(i+1)]<<12|a[t.charCodeAt(i+2)]<<6|a[t.charCodeAt(i+3)],d[p++]=r>>16&255,d[p++]=r>>8&255,d[p++]=255&r;2===l&&(r=a[t.charCodeAt(i)]<<2|a[t.charCodeAt(i+1)]>>4,d[p++]=255&r);1===l&&(r=a[t.charCodeAt(i)]<<10|a[t.charCodeAt(i+1)]<<4|a[t.charCodeAt(i+2)]>>2,d[p++]=r>>8&255,d[p++]=255&r);return d},r.fromByteArray=function fromByteArray(t){for(var r,i=t.length,a=i%3,c=[],u=0,l=i-a;u<l;u+=16383)c.push(encodeChunk(t,u,u+16383>l?l:u+16383));1===a?(r=t[i-1],c.push(o[r>>2]+o[r<<4&63]+"==")):2===a&&(r=(t[i-2]<<8)+t[i-1],c.push(o[r>>10]+o[r>>4&63]+o[r<<2&63]+"="));return c.join("")};for(var o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,d=u.length;l<d;++l)o[l]=u[l],a[u.charCodeAt(l)]=l;function getLens(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=r),[i,i===r?0:4-i%4]}function encodeChunk(t,r,i){for(var a,c,u=[],l=r;l<i;l+=3)a=(t[l]<<16&16711680)+(t[l+1]<<8&65280)+(255&t[l+2]),u.push(o[(c=a)>>18&63]+o[c>>12&63]+o[c>>6&63]+o[63&c]);return u.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,i,o,a){var c,u,l=8*a-o-1,d=(1<<l)-1,p=d>>1,h=-7,m=i?a-1:0,g=i?-1:1,y=t[r+m];for(m+=g,c=y&(1<<-h)-1,y>>=-h,h+=l;h>0;c=256*c+t[r+m],m+=g,h-=8);for(u=c&(1<<-h)-1,c>>=-h,h+=o;h>0;u=256*u+t[r+m],m+=g,h-=8);if(0===c)c=1-p;else{if(c===d)return u?NaN:1/0*(y?-1:1);u+=Math.pow(2,o),c-=p}return(y?-1:1)*u*Math.pow(2,c-o)},r.write=function(t,r,i,o,a,c){var u,l,d,p=8*c-a-1,h=(1<<p)-1,m=h>>1,g=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,y=o?0:c-1,v=o?1:-1,b=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,u=h):(u=Math.floor(Math.log(r)/Math.LN2),r*(d=Math.pow(2,-u))<1&&(u--,d*=2),(r+=u+m>=1?g/d:g*Math.pow(2,1-m))*d>=2&&(u++,d/=2),u+m>=h?(l=0,u=h):u+m>=1?(l=(r*d-1)*Math.pow(2,a),u+=m):(l=r*Math.pow(2,m-1)*Math.pow(2,a),u=0));a>=8;t[i+y]=255&l,y+=v,l/=256,a-=8);for(u=u<<a|l,p+=a;p>0;t[i+y]=255&u,y+=v,u/=256,p-=8);t[i+y-v]|=128*b}},function(t,r){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,r,i){"use strict";t.exports=i(360)},function(t,r,i){"use strict";var o=i(361);t.exports=o},function(t,r,i){"use strict";var o=i(220);t.exports=o},function(t,r,i){"use strict";i(363);var o=i(15);t.exports=o.Object.keys},function(t,r,i){"use strict";var o=i(1),a=i(36),c=i(101);o({target:"Object",stat:!0,forced:i(8)((function(){c(1)}))},{keys:function keys(t){return c(a(t))}})},function(t,r,i){"use strict";var o=i(20),a=i(12),c=i(18),u=TypeError;t.exports=function(t,r){var i,l;if("string"===r&&a(i=t.toString)&&!c(l=o(i,t)))return l;if(a(i=t.valueOf)&&!c(l=o(i,t)))return l;if("string"!==r&&a(i=t.toString)&&!c(l=o(i,t)))return l;throw new u("Can't convert object to primitive value")}},function(t,r,i){"use strict";var o=i(11),a=Object.defineProperty;t.exports=function(t,r){try{a(o,t,{value:r,configurable:!0,writable:!0})}catch(i){o[t]=r}return r}},function(t,r,i){"use strict";var o=Math.ceil,a=Math.floor;t.exports=Math.trunc||function trunc(t){var r=+t;return(r>0?a:o)(r)}},function(t,r,i){"use strict";var o=i(368);t.exports=o},function(t,r,i){"use strict";var o=i(369);t.exports=o},function(t,r,i){"use strict";var o=i(370);t.exports=o},function(t,r,i){"use strict";i(228);var o=i(15);t.exports=o.Object.getOwnPropertySymbols},function(t,r,i){"use strict";var o=i(1),a=i(11),c=i(20),u=i(9),l=i(35),d=i(13),p=i(79),h=i(8),m=i(21),g=i(23),y=i(33),v=i(38),b=i(162),_=i(40),w=i(55),S=i(82),I=i(101),k=i(129),x=i(230),P=i(130),C=i(77),A=i(32),O=i(170),R=i(123),M=i(48),j=i(171),L=i(81),D=i(128),B=i(103),N=i(127),U=i(10),q=i(131),W=i(14),z=i(231),V=i(49),H=i(58),$=i(65).forEach,K=D("hidden"),G=H.set,J=H.getterFor("Symbol"),Y=Object.prototype,Q=a.Symbol,X=Q&&Q.prototype,Z=a.RangeError,ee=a.TypeError,te=a.QObject,re=C.f,ne=A.f,ie=x.f,oe=R.f,se=u([].push),ae=L("symbols"),ce=L("op-symbols"),ue=L("wks"),le=!te||!te.prototype||!te.prototype.findChild,fallbackDefineProperty=function(t,r,i){var o=re(Y,r);o&&delete Y[r],ne(t,r,i),o&&t!==Y&&ne(Y,r,o)},fe=d&&h((function(){return 7!==S(ne({},"a",{get:function(){return ne(this,"a",{value:7}).a}})).a}))?fallbackDefineProperty:ne,wrap=function(t,r){var i=ae[t]=S(X);return G(i,{type:"Symbol",tag:t,description:r}),d||(i.description=r),i},de=function defineProperty(t,r,i){t===Y&&de(ce,r,i),y(t);var o=b(r);return y(i),m(ae,o)?(i.enumerable?(m(t,K)&&t[K][o]&&(t[K][o]=!1),i=S(i,{enumerable:w(0,!1)})):(m(t,K)||ne(t,K,w(1,S(null))),t[K][o]=!0),fe(t,o,i)):ne(t,o,i)},pe=function defineProperties(t,r){y(t);var i=v(r),o=I(i).concat($getOwnPropertySymbols(i));return $(o,(function(r){d&&!c(he,i,r)||de(t,r,i[r])})),t},he=function propertyIsEnumerable(t){var r=b(t),i=c(oe,this,r);return!(this===Y&&m(ae,r)&&!m(ce,r))&&(!(i||!m(this,r)||!m(ae,r)||m(this,K)&&this[K][r])||i)},me=function getOwnPropertyDescriptor(t,r){var i=v(t),o=b(r);if(i!==Y||!m(ae,o)||m(ce,o)){var a=re(i,o);return!a||!m(ae,o)||m(i,K)&&i[K][o]||(a.enumerable=!0),a}},ge=function getOwnPropertyNames(t){var r=ie(v(t)),i=[];return $(r,(function(t){m(ae,t)||m(B,t)||se(i,t)})),i},$getOwnPropertySymbols=function(t){var r=t===Y,i=ie(r?ce:v(t)),o=[];return $(i,(function(t){!m(ae,t)||r&&!m(Y,t)||se(o,ae[t])})),o};p||(M(X=(Q=function Symbol(){if(g(X,this))throw new ee("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?_(arguments[0]):void 0,r=N(t),setter=function(t){var i=void 0===this?a:this;i===Y&&c(setter,ce,t),m(i,K)&&m(i[K],r)&&(i[K][r]=!1);var o=w(1,t);try{fe(i,r,o)}catch(t){if(!(t instanceof Z))throw t;fallbackDefineProperty(i,r,o)}};return d&&le&&fe(Y,r,{configurable:!0,set:setter}),wrap(r,t)}).prototype,"toString",(function toString(){return J(this).tag})),M(Q,"withoutSetter",(function(t){return wrap(N(t),t)})),R.f=he,A.f=de,O.f=pe,C.f=me,k.f=x.f=ge,P.f=$getOwnPropertySymbols,q.f=function(t){return wrap(U(t),t)},d&&(j(X,"description",{configurable:!0,get:function description(){return J(this).description}}),l||M(Y,"propertyIsEnumerable",he,{unsafe:!0}))),o({global:!0,constructor:!0,wrap:!0,forced:!p,sham:!p},{Symbol:Q}),$(I(ue),(function(t){W(t)})),o({target:"Symbol",stat:!0,forced:!p},{useSetter:function(){le=!0},useSimple:function(){le=!1}}),o({target:"Object",stat:!0,forced:!p,sham:!d},{create:function create(t,r){return void 0===r?S(t):pe(S(t),r)},defineProperty:de,defineProperties:pe,getOwnPropertyDescriptor:me}),o({target:"Object",stat:!0,forced:!p},{getOwnPropertyNames:ge}),z(),V(Q,"Symbol"),B[K]=!0},function(t,r,i){"use strict";var o=i(169),a=i(64);t.exports=o?{}.toString:function toString(){return"[object "+a(this)+"]"}},function(t,r,i){"use strict";var o=i(66),a=i(132),c=i(18),u=i(10)("species"),l=Array;t.exports=function(t){var r;return o(t)&&(r=t.constructor,(a(r)&&(r===l||o(r.prototype))||c(r)&&null===(r=r[u]))&&(r=void 0)),void 0===r?l:r}},function(t,r,i){"use strict";var o=i(1),a=i(28),c=i(21),u=i(40),l=i(81),d=i(234),p=l("string-to-symbol-registry"),h=l("symbol-to-string-registry");o({target:"Symbol",stat:!0,forced:!d},{for:function(t){var r=u(t);if(c(p,r))return p[r];var i=a("Symbol")(r);return p[r]=i,h[i]=r,i}})},function(t,r,i){"use strict";var o=i(1),a=i(21),c=i(100),u=i(80),l=i(81),d=i(234),p=l("symbol-to-string-registry");o({target:"Symbol",stat:!0,forced:!d},{keyFor:function keyFor(t){if(!c(t))throw new TypeError(u(t)+" is not a symbol");if(a(p,t))return p[t]}})},function(t,r,i){"use strict";var o=i(9),a=i(66),c=i(12),u=i(43),l=i(40),d=o([].push);t.exports=function(t){if(c(t))return t;if(a(t)){for(var r=t.length,i=[],o=0;o<r;o++){var p=t[o];"string"==typeof p?d(i,p):"number"!=typeof p&&"Number"!==u(p)&&"String"!==u(p)||d(i,l(p))}var h=i.length,m=!0;return function(t,r){if(m)return m=!1,r;if(a(this))return r;for(var o=0;o<h;o++)if(i[o]===t)return r}}}},function(t,r,i){"use strict";var o=i(1),a=i(79),c=i(8),u=i(130),l=i(36);o({target:"Object",stat:!0,forced:!a||c((function(){u.f(1)}))},{getOwnPropertySymbols:function getOwnPropertySymbols(t){var r=u.f;return r?r(l(t)):[]}})},function(t,r,i){"use strict";t.exports=i(379)},function(t,r,i){"use strict";var o=i(380);t.exports=o},function(t,r,i){"use strict";var o=i(236);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(382),c=Array.prototype;t.exports=function(t){var r=t.filter;return t===c||o(c,t)&&r===c.filter?a:r}},function(t,r,i){"use strict";i(383);var o=i(29);t.exports=o("Array","filter")},function(t,r,i){"use strict";var o=i(1),a=i(65).filter;o({target:"Array",proto:!0,forced:!i(104)("filter")},{filter:function filter(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,r,i){"use strict";t.exports=i(385)},function(t,r,i){"use strict";var o=i(386);t.exports=o},function(t,r,i){"use strict";var o=i(387);t.exports=o},function(t,r,i){"use strict";var o=i(388);t.exports=o},function(t,r,i){"use strict";i(389);var o=i(15).Object,a=t.exports=function getOwnPropertyDescriptor(t,r){return o.getOwnPropertyDescriptor(t,r)};o.getOwnPropertyDescriptor.sham&&(a.sham=!0)},function(t,r,i){"use strict";var o=i(1),a=i(8),c=i(38),u=i(77).f,l=i(13);o({target:"Object",stat:!0,forced:!l||a((function(){u(1)})),sham:!l},{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(t,r){return u(c(t),r)}})},function(t,r,i){"use strict";var o=i(391);t.exports=o},function(t,r,i){"use strict";var o=i(392);t.exports=o},function(t,r,i){"use strict";var o=i(393);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(394),c=Array.prototype;t.exports=function(t){var r=t.push;return t===c||o(c,t)&&r===c.push?a:r}},function(t,r,i){"use strict";i(395);var o=i(29);t.exports=o("Array","push")},function(t,r,i){"use strict";var o=i(1),a=i(36),c=i(57),u=i(237),l=i(174);o({target:"Array",proto:!0,arity:1,forced:i(8)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function push(t){var r=a(this),i=c(r),o=arguments.length;l(i+o);for(var d=0;d<o;d++)r[i]=arguments[d],i++;return u(r,i),i}})},function(t,r,i){"use strict";var o=i(397);t.exports=o},function(t,r,i){"use strict";var o=i(398);t.exports=o},function(t,r,i){"use strict";var o=i(64),a=i(21),c=i(23),u=i(399);i(403);var l=Array.prototype,d={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var r=t.forEach;return t===l||c(l,t)&&r===l.forEach||a(d,o(t))?u:r}},function(t,r,i){"use strict";var o=i(400);t.exports=o},function(t,r,i){"use strict";i(401);var o=i(29);t.exports=o("Array","forEach")},function(t,r,i){"use strict";var o=i(1),a=i(402);o({target:"Array",proto:!0,forced:[].forEach!==a},{forEach:a})},function(t,r,i){"use strict";var o=i(65).forEach,a=i(239)("forEach");t.exports=a?[].forEach:function forEach(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,r){},function(t,r,i){"use strict";t.exports=i(405)},function(t,r,i){"use strict";var o=i(406);t.exports=o},function(t,r,i){"use strict";var o=i(407);t.exports=o},function(t,r,i){"use strict";var o=i(408);t.exports=o},function(t,r,i){"use strict";i(409);var o=i(15);t.exports=o.Object.getOwnPropertyDescriptors},function(t,r,i){"use strict";var o=i(1),a=i(13),c=i(240),u=i(38),l=i(77),d=i(105);o({target:"Object",stat:!0,sham:!a},{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(t){for(var r,i,o=u(t),a=l.f,p=c(o),h={},m=0;p.length>m;)void 0!==(i=a(o,r=p[m++]))&&d(h,r,i);return h}})},function(t,r,i){"use strict";t.exports=i(411)},function(t,r,i){"use strict";var o=i(412);t.exports=o},function(t,r,i){"use strict";var o=i(413);t.exports=o},function(t,r,i){"use strict";var o=i(414);t.exports=o},function(t,r,i){"use strict";i(415);var o=i(15).Object,a=t.exports=function defineProperties(t,r){return o.defineProperties(t,r)};o.defineProperties.sham&&(a.sham=!0)},function(t,r,i){"use strict";var o=i(1),a=i(13),c=i(170).f;o({target:"Object",stat:!0,forced:Object.defineProperties!==c,sham:!a},{defineProperties:c})},function(t,r,i){"use strict";var o=i(417);t.exports=o},function(t,r,i){"use strict";var o=i(418);t.exports=o},function(t,r,i){"use strict";var o=i(419);t.exports=o},function(t,r,i){"use strict";i(420);var o=i(15).Object,a=t.exports=function defineProperty(t,r,i){return o.defineProperty(t,r,i)};o.defineProperty.sham&&(a.sham=!0)},function(t,r,i){"use strict";var o=i(1),a=i(13),c=i(32).f;o({target:"Object",stat:!0,forced:Object.defineProperty!==c,sham:!a},{defineProperty:c})},function(t,r,i){"use strict";var o=i(422);i(449),i(450),i(451),i(452),i(453),i(454),i(455),i(456),i(457),i(458),t.exports=o},function(t,r,i){"use strict";var o=i(423);i(445),i(446),i(447),i(448),t.exports=o},function(t,r,i){"use strict";var o=i(424);i(67),t.exports=o},function(t,r,i){"use strict";i(242),i(107),i(228),i(425),i(426),i(427),i(428),i(243),i(429),i(430),i(431),i(432),i(433),i(434),i(244),i(435),i(436),i(437),i(438),i(439);var o=i(15);t.exports=o.Symbol},function(t,r,i){"use strict";i(14)("asyncIterator")},function(t,r){},function(t,r,i){"use strict";i(14)("hasInstance")},function(t,r,i){"use strict";i(14)("isConcatSpreadable")},function(t,r,i){"use strict";i(14)("match")},function(t,r,i){"use strict";i(14)("matchAll")},function(t,r,i){"use strict";i(14)("replace")},function(t,r,i){"use strict";i(14)("search")},function(t,r,i){"use strict";i(14)("species")},function(t,r,i){"use strict";i(14)("split")},function(t,r,i){"use strict";var o=i(28),a=i(14),c=i(49);a("toStringTag"),c(o("Symbol"),"Symbol")},function(t,r,i){"use strict";i(14)("unscopables")},function(t,r,i){"use strict";var o=i(11);i(49)(o.JSON,"JSON",!0)},function(t,r){},function(t,r){},function(t,r,i){"use strict";var o=i(13),a=i(21),c=Function.prototype,u=o&&Object.getOwnPropertyDescriptor,l=a(c,"name"),d=l&&"something"===function something(){}.name,p=l&&(!o||o&&u(c,"name").configurable);t.exports={EXISTS:l,PROPER:d,CONFIGURABLE:p}},function(t,r,i){"use strict";var o=i(9),a=i(39);t.exports=function(t,r,i){try{return o(a(Object.getOwnPropertyDescriptor(t,r)[i]))}catch(t){}}},function(t,r,i){"use strict";var o=i(443),a=String,c=TypeError;t.exports=function(t){if(o(t))return t;throw new c("Can't set "+a(t)+" as a prototype")}},function(t,r,i){"use strict";var o=i(18);t.exports=function(t){return o(t)||null===t}},function(t,r,i){"use strict";t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,r,i){"use strict";var o=i(10),a=i(32).f,c=o("metadata"),u=Function.prototype;void 0===u[c]&&a(u,c,{value:null})},function(t,r,i){"use strict";i(14)("asyncDispose")},function(t,r,i){"use strict";i(14)("dispose")},function(t,r,i){"use strict";i(14)("metadata")},function(t,r,i){"use strict";i(1)({target:"Symbol",stat:!0},{isRegisteredSymbol:i(249)})},function(t,r,i){"use strict";i(1)({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:i(250)})},function(t,r,i){"use strict";i(14)("customMatcher")},function(t,r,i){"use strict";i(14)("observable")},function(t,r,i){"use strict";i(1)({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:i(249)})},function(t,r,i){"use strict";i(1)({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:i(250)})},function(t,r,i){"use strict";i(14)("matcher")},function(t,r,i){"use strict";i(14)("metadataKey")},function(t,r,i){"use strict";i(14)("patternMatch")},function(t,r,i){"use strict";i(14)("replaceAll")},function(t,r,i){"use strict";t.exports=i(460)},function(t,r,i){"use strict";var o=i(461);t.exports=o},function(t,r,i){"use strict";var o=i(462);t.exports=o},function(t,r,i){"use strict";var o=i(463);i(67),t.exports=o},function(t,r,i){"use strict";i(68),i(107),i(135),i(243);var o=i(131);t.exports=o.f("iterator")},function(t,r,i){"use strict";var o=i(9),a=i(102),c=i(40),u=i(56),l=o("".charAt),d=o("".charCodeAt),p=o("".slice),createMethod=function(t){return function(r,i){var o,h,m=c(u(r)),g=a(i),y=m.length;return g<0||g>=y?t?"":void 0:(o=d(m,g))<55296||o>56319||g+1===y||(h=d(m,g+1))<56320||h>57343?t?l(m,g):o:t?p(m,g,g+2):h-56320+(o-55296<<10)+65536}};t.exports={codeAt:createMethod(!1),charAt:createMethod(!0)}},function(t,r,i){var o=i(466),a=i(7).default;t.exports=function toPrimitive(t,r){if("object"!=a(t)||!t)return t;var i=t[o];if(void 0!==i){var c=i.call(t,r||"default");if("object"!=a(c))return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";t.exports=i(467)},function(t,r,i){"use strict";var o=i(468);t.exports=o},function(t,r,i){"use strict";var o=i(469);t.exports=o},function(t,r,i){"use strict";var o=i(470);t.exports=o},function(t,r,i){"use strict";i(471),i(244);var o=i(131);t.exports=o.f("toPrimitive")},function(t,r){},function(t,r,i){"use strict";var o=i(473);t.exports=o},function(t,r,i){"use strict";i(474);var o=i(15);t.exports=o.Object.assign},function(t,r,i){"use strict";var o=i(1),a=i(475);o({target:"Object",stat:!0,arity:2,forced:Object.assign!==a},{assign:a})},function(t,r,i){"use strict";var o=i(13),a=i(9),c=i(20),u=i(8),l=i(101),d=i(130),p=i(123),h=i(36),m=i(161),g=Object.assign,y=Object.defineProperty,v=a([].concat);t.exports=!g||u((function(){if(o&&1!==g({b:1},g(y({},"a",{enumerable:!0,get:function(){y(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},r={},i=Symbol("assign detection");return t[i]=7,"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),7!==g({},t)[i]||"abcdefghijklmnopqrst"!==l(g({},r)).join("")}))?function assign(t,r){for(var i=h(t),a=arguments.length,u=1,g=d.f,y=p.f;a>u;)for(var b,_=m(arguments[u++]),w=g?v(l(_),g(_)):l(_),S=w.length,I=0;S>I;)b=w[I++],o&&!c(y,_,b)||(i[b]=_[b]);return i}:g},function(t,r,i){"use strict";var o=i(477);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(478),c=String.prototype;t.exports=function(t){var r=t.startsWith;return"string"==typeof t||t===c||o(c,t)&&r===c.startsWith?a:r}},function(t,r,i){"use strict";i(479);var o=i(29);t.exports=o("String","startsWith")},function(t,r,i){"use strict";var o,a=i(1),c=i(122),u=i(77).f,l=i(167),d=i(40),p=i(251),h=i(56),m=i(252),g=i(35),y=c("".slice),v=Math.min,b=m("startsWith");a({target:"String",proto:!0,forced:!!(g||b||(o=u(String.prototype,"startsWith"),!o||o.writable))&&!b},{startsWith:function startsWith(t){var r=d(h(this));p(t);var i=l(v(arguments.length>1?arguments[1]:void 0,r.length)),o=d(t);return y(r,i,i+o.length)===o}})},function(t,r,i){"use strict";var o=i(18),a=i(43),c=i(10)("match");t.exports=function(t){var r;return o(t)&&(void 0!==(r=t[c])?!!r:"RegExp"===a(t))}},function(t,r,i){(function(t,o){var a;!function(c){r&&r.nodeType,t&&t.nodeType;var u="object"==typeof o&&o;u.global!==u&&u.window!==u&&u.self;var l,d=2147483647,p=/^xn--/,h=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=Math.floor,v=String.fromCharCode;function error(t){throw new RangeError(g[t])}function map(t,r){for(var i=t.length,o=[];i--;)o[i]=r(t[i]);return o}function mapDomain(t,r){var i=t.split("@"),o="";return i.length>1&&(o=i[0]+"@",t=i[1]),o+map((t=t.replace(m,".")).split("."),r).join(".")}function ucs2decode(t){for(var r,i,o=[],a=0,c=t.length;a<c;)(r=t.charCodeAt(a++))>=55296&&r<=56319&&a<c?56320==(64512&(i=t.charCodeAt(a++)))?o.push(((1023&r)<<10)+(1023&i)+65536):(o.push(r),a--):o.push(r);return o}function ucs2encode(t){return map(t,(function(t){var r="";return t>65535&&(r+=v((t-=65536)>>>10&1023|55296),t=56320|1023&t),r+=v(t)})).join("")}function digitToBasic(t,r){return t+22+75*(t<26)-((0!=r)<<5)}function adapt(t,r,i){var o=0;for(t=i?y(t/700):t>>1,t+=y(t/r);t>455;o+=36)t=y(t/35);return y(o+36*t/(t+38))}function decode(t){var r,i,o,a,c,u,l,p,h,m,g,v=[],b=t.length,_=0,w=128,S=72;for((i=t.lastIndexOf("-"))<0&&(i=0),o=0;o<i;++o)t.charCodeAt(o)>=128&&error("not-basic"),v.push(t.charCodeAt(o));for(a=i>0?i+1:0;a<b;){for(c=_,u=1,l=36;a>=b&&error("invalid-input"),((p=(g=t.charCodeAt(a++))-48<10?g-22:g-65<26?g-65:g-97<26?g-97:36)>=36||p>y((d-_)/u))&&error("overflow"),_+=p*u,!(p<(h=l<=S?1:l>=S+26?26:l-S));l+=36)u>y(d/(m=36-h))&&error("overflow"),u*=m;S=adapt(_-c,r=v.length+1,0==c),y(_/r)>d-w&&error("overflow"),w+=y(_/r),_%=r,v.splice(_++,0,w)}return ucs2encode(v)}function encode(t){var r,i,o,a,c,u,l,p,h,m,g,b,_,w,S,I=[];for(b=(t=ucs2decode(t)).length,r=128,i=0,c=72,u=0;u<b;++u)(g=t[u])<128&&I.push(v(g));for(o=a=I.length,a&&I.push("-");o<b;){for(l=d,u=0;u<b;++u)(g=t[u])>=r&&g<l&&(l=g);for(l-r>y((d-i)/(_=o+1))&&error("overflow"),i+=(l-r)*_,r=l,u=0;u<b;++u)if((g=t[u])<r&&++i>d&&error("overflow"),g==r){for(p=i,h=36;!(p<(m=h<=c?1:h>=c+26?26:h-c));h+=36)S=p-m,w=36-m,I.push(v(digitToBasic(m+S%w,0))),p=y(S/w);I.push(v(digitToBasic(p,0))),c=adapt(i,_,o==a),i=0,++o}++i,++r}return I.join("")}l={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:function toASCII(t){return mapDomain(t,(function(t){return h.test(t)?"xn--"+encode(t):t}))},toUnicode:function toUnicode(t){return mapDomain(t,(function(t){return p.test(t)?decode(t.slice(4).toLowerCase()):t}))}},void 0===(a=function(){return l}.call(r,i,r,t))||(t.exports=a)}()}).call(this,i(136)(t),i(17))},function(t,r,i){"use strict";var o=i(483),a=i(256),c=i(181),u=Object.prototype.hasOwnProperty,l={brackets:function brackets(t){return t+"[]"},comma:"comma",indices:function indices(t,r){return t+"["+r+"]"},repeat:function repeat(t){return t}},d=Array.isArray,p=Array.prototype.push,pushToArray=function(t,r){p.apply(t,d(r)?r:[r])},h=Date.prototype.toISOString,m=c.default,g={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:a.encode,encodeValuesOnly:!1,format:m,formatter:c.formatters[m],indices:!1,serializeDate:function serializeDate(t){return h.call(t)},skipNulls:!1,strictNullHandling:!1},y={},v=function stringify(t,r,i,c,u,l,p,h,m,v,b,_,w,S,I,k,x,P){for(var C=t,A=P,O=0,R=!1;void 0!==(A=A.get(y))&&!R;){var M=A.get(t);if(O+=1,void 0!==M){if(M===O)throw new RangeError("Cyclic object value");R=!0}void 0===A.get(y)&&(O=0)}if("function"==typeof v?C=v(r,C):C instanceof Date?C=w(C):"comma"===i&&d(C)&&(C=a.maybeMap(C,(function(t){return t instanceof Date?w(t):t}))),null===C){if(l)return m&&!k?m(r,g.encoder,x,"key",S):r;C=""}if(function isNonNullishPrimitive(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||"symbol"==typeof t||"bigint"==typeof t}(C)||a.isBuffer(C))return m?[I(k?r:m(r,g.encoder,x,"key",S))+"="+I(m(C,g.encoder,x,"value",S))]:[I(r)+"="+I(String(C))];var j,L=[];if(void 0===C)return L;if("comma"===i&&d(C))k&&m&&(C=a.maybeMap(C,m)),j=[{value:C.length>0?C.join(",")||null:void 0}];else if(d(v))j=v;else{var D=Object.keys(C);j=b?D.sort(b):D}var B=h?r.replace(/\./g,"%2E"):r,N=c&&d(C)&&1===C.length?B+"[]":B;if(u&&d(C)&&0===C.length)return N+"[]";for(var U=0;U<j.length;++U){var q=j[U],W="object"==typeof q&&void 0!==q.value?q.value:C[q];if(!p||null!==W){var z=_&&h?q.replace(/\./g,"%2E"):q,V=d(C)?"function"==typeof i?i(N,z):N:N+(_?"."+z:"["+z+"]");P.set(t,O);var H=o();H.set(y,P),pushToArray(L,stringify(W,V,i,c,u,l,p,h,"comma"===i&&k&&d(C)?null:m,v,b,_,w,S,I,k,x,H))}}return L};t.exports=function(t,r){var i,a=t,p=function normalizeStringifyOptions(t){if(!t)return g;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||g.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=c.default;if(void 0!==t.format){if(!u.call(c.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var o,a=c.formatters[i],p=g.filter;if(("function"==typeof t.filter||d(t.filter))&&(p=t.filter),o=t.arrayFormat in l?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":g.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=void 0===t.allowDots?!0===t.encodeDotInKeys||g.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:g.addQueryPrefix,allowDots:h,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:g.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:g.charsetSentinel,commaRoundTrip:t.commaRoundTrip,delimiter:void 0===t.delimiter?g.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:g.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:g.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:g.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:g.encodeValuesOnly,filter:p,format:i,formatter:a,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:g.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:g.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:g.strictNullHandling}}(r);"function"==typeof p.filter?a=(0,p.filter)("",a):d(p.filter)&&(i=p.filter);var h=[];if("object"!=typeof a||null===a)return"";var m=l[p.arrayFormat],y="comma"===m&&p.commaRoundTrip;i||(i=Object.keys(a)),p.sort&&i.sort(p.sort);for(var b=o(),_=0;_<i.length;++_){var w=i[_];p.skipNulls&&null===a[w]||pushToArray(h,v(a[w],w,m,y,p.allowEmptyArrays,p.strictNullHandling,p.skipNulls,p.encodeDotInKeys,p.encode?p.encoder:null,p.filter,p.sort,p.allowDots,p.serializeDate,p.format,p.formatter,p.encodeValuesOnly,p.charset,b))}var S=h.join(p.delimiter),I=!0===p.addQueryPrefix?"?":"";return p.charsetSentinel&&("iso-8859-1"===p.charset?I+="utf8=%26%2310003%3B&":I+="utf8=%E2%9C%93&"),S.length>0?I+S:""}},function(t,r,i){"use strict";var o=i(6),a=i(24),c=i(255),u=i(3),l=o("%WeakMap%",!0),d=o("%Map%",!0),p=a("WeakMap.prototype.get",!0),h=a("WeakMap.prototype.set",!0),m=a("WeakMap.prototype.has",!0),g=a("Map.prototype.get",!0),y=a("Map.prototype.set",!0),v=a("Map.prototype.has",!0),listGetNode=function(t,r){for(var i,o=t;null!==(i=o.next);o=i)if(i.key===r)return o.next=i.next,i.next=t.next,t.next=i,i};t.exports=function getSideChannel(){var t,r,i,o={assert:function(t){if(!o.has(t))throw new u("Side channel does not contain "+c(t))},get:function(o){if(l&&o&&("object"==typeof o||"function"==typeof o)){if(t)return p(t,o)}else if(d){if(r)return g(r,o)}else if(i)return function(t,r){var i=listGetNode(t,r);return i&&i.value}(i,o)},has:function(o){if(l&&o&&("object"==typeof o||"function"==typeof o)){if(t)return m(t,o)}else if(d){if(r)return v(r,o)}else if(i)return function(t,r){return!!listGetNode(t,r)}(i,o);return!1},set:function(o,a){l&&o&&("object"==typeof o||"function"==typeof o)?(t||(t=new l),h(t,o,a)):d?(r||(r=new d),y(r,o,a)):(i||(i={key:{},next:null}),function(t,r,i){var o=listGetNode(t,r);o?o.value=i:t.next={key:r,next:t.next,value:i}}(i,o,a))}};return o}},function(t,r,i){"use strict";t.exports=Error},function(t,r,i){"use strict";t.exports=EvalError},function(t,r,i){"use strict";t.exports=ReferenceError},function(t,r,i){"use strict";t.exports=URIError},function(t,r,i){"use strict";var o="Function.prototype.bind called on incompatible ",a=Object.prototype.toString,c=Math.max,u=function concatty(t,r){for(var i=[],o=0;o<t.length;o+=1)i[o]=t[o];for(var a=0;a<r.length;a+=1)i[a+t.length]=r[a];return i},l=function slicy(t,r){for(var i=[],o=r||0,a=0;o<t.length;o+=1,a+=1)i[a]=t[o];return i},joiny=function(t,r){for(var i="",o=0;o<t.length;o+=1)i+=t[o],o+1<t.length&&(i+=r);return i};t.exports=function bind(t){var r=this;if("function"!=typeof r||"[object Function]"!==a.apply(r))throw new TypeError(o+r);for(var i,d=l(arguments,1),binder=function(){if(this instanceof i){var o=r.apply(this,u(d,arguments));return Object(o)===o?o:this}return r.apply(t,u(d,arguments))},p=c(0,r.length-d.length),h=[],m=0;m<p;m++)h[m]="$"+m;if(i=Function("binder","return function ("+joiny(h,",")+"){ return binder.apply(this,arguments); }")(binder),r.prototype){var g=function Empty(){};g.prototype=r.prototype,i.prototype=new g,g.prototype=null}return i}},function(t,r,i){"use strict";var o=i(6),a=i(254),c=i(180)(),u=i(85),l=i(3),d=o("%Math.floor%");t.exports=function setFunctionLength(t,r){if("function"!=typeof t)throw new l("`fn` is not a function");if("number"!=typeof r||r<0||r>4294967295||d(r)!==r)throw new l("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],o=!0,p=!0;if("length"in t&&u){var h=u(t,"length");h&&!h.configurable&&(o=!1),h&&!h.writable&&(p=!1)}return(o||p||!i)&&(c?a(t,"length",r,!0,!0):a(t,"length",r)),t}},function(t,r){},function(t,r,i){"use strict";var o=i(256),a=Object.prototype.hasOwnProperty,c=Array.isArray,u={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:o.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(t){return t.replace(/&#(\d+);/g,(function(t,r){return String.fromCharCode(parseInt(r,10))}))},parseArrayValue=function(t,r){return t&&"string"==typeof t&&r.comma&&t.indexOf(",")>-1?t.split(","):t},l=function parseQueryStringKeys(t,r,i,o){if(t){var c=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,u=/(\[[^[\]]*])/g,l=i.depth>0&&/(\[[^[\]]*])/.exec(c),d=l?c.slice(0,l.index):c,p=[];if(d){if(!i.plainObjects&&a.call(Object.prototype,d)&&!i.allowPrototypes)return;p.push(d)}for(var h=0;i.depth>0&&null!==(l=u.exec(c))&&h<i.depth;){if(h+=1,!i.plainObjects&&a.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;p.push(l[1])}return l&&p.push("["+c.slice(l.index)+"]"),function(t,r,i,o){for(var a=o?r:parseArrayValue(r,i),c=t.length-1;c>=0;--c){var u,l=t[c];if("[]"===l&&i.parseArrays)u=i.allowEmptyArrays&&""===a?[]:[].concat(a);else{u=i.plainObjects?Object.create(null):{};var d="["===l.charAt(0)&&"]"===l.charAt(l.length-1)?l.slice(1,-1):l,p=i.decodeDotInKeys?d.replace(/%2E/g,"."):d,h=parseInt(p,10);i.parseArrays||""!==p?!isNaN(h)&&l!==p&&String(h)===p&&h>=0&&i.parseArrays&&h<=i.arrayLimit?(u=[])[h]=a:"__proto__"!==p&&(u[p]=a):u={0:a}}a=u}return a}(p,r,i,o)}};t.exports=function(t,r){var i=function normalizeParseOptions(t){if(!t)return u;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=void 0===t.charset?u.charset:t.charset,i=void 0===t.duplicates?u.duplicates:t.duplicates;if("combine"!==i&&"first"!==i&&"last"!==i)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||u.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:u.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:u.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:u.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:u.arrayLimit,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:u.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:u.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:u.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:u.decoder,delimiter:"string"==typeof t.delimiter||o.isRegExp(t.delimiter)?t.delimiter:u.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:u.depth,duplicates:i,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:u.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:u.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:u.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:u.strictNullHandling}}(r);if(""===t||null==t)return i.plainObjects?Object.create(null):{};for(var d="string"==typeof t?function parseQueryStringValues(t,r){var i,l={__proto__:null},d=r.ignoreQueryPrefix?t.replace(/^\?/,""):t,p=r.parameterLimit===1/0?void 0:r.parameterLimit,h=d.split(r.delimiter,p),m=-1,g=r.charset;if(r.charsetSentinel)for(i=0;i<h.length;++i)0===h[i].indexOf("utf8=")&&("utf8=%E2%9C%93"===h[i]?g="utf-8":"utf8=%26%2310003%3B"===h[i]&&(g="iso-8859-1"),m=i,i=h.length);for(i=0;i<h.length;++i)if(i!==m){var y,v,b=h[i],_=b.indexOf("]="),w=-1===_?b.indexOf("="):_+1;-1===w?(y=r.decoder(b,u.decoder,g,"key"),v=r.strictNullHandling?null:""):(y=r.decoder(b.slice(0,w),u.decoder,g,"key"),v=o.maybeMap(parseArrayValue(b.slice(w+1),r),(function(t){return r.decoder(t,u.decoder,g,"value")}))),v&&r.interpretNumericEntities&&"iso-8859-1"===g&&(v=interpretNumericEntities(v)),b.indexOf("[]=")>-1&&(v=c(v)?[v]:v);var S=a.call(l,y);S&&"combine"===r.duplicates?l[y]=o.combine(l[y],v):S&&"last"!==r.duplicates||(l[y]=v)}return l}(t,i):t,p=i.plainObjects?Object.create(null):{},h=Object.keys(d),m=0;m<h.length;++m){var g=h[m],y=l(g,d[g],i,"string"==typeof t);p=o.merge(p,y,i)}return!0===i.allowSparse?p:o.compact(p)}},function(t,r,i){"use strict";var o=i(493);t.exports=o},function(t,r,i){"use strict";var o=i(494);t.exports=o},function(t,r,i){"use strict";var o=i(495);i(67),t.exports=o},function(t,r,i){"use strict";i(68),i(135);var o=i(109);t.exports=o},function(t,r,i){"use strict";var o=i(497);t.exports=o},function(t,r,i){"use strict";var o=i(498);t.exports=o},function(t,r,i){"use strict";var o=i(499);t.exports=o},function(t,r,i){"use strict";i(500);var o=i(15);t.exports=o.Array.isArray},function(t,r,i){"use strict";i(1)({target:"Array",stat:!0},{isArray:i(66)})},function(t,r,i){"use strict";var o=i(502);t.exports=o},function(t,r,i){"use strict";var o=i(258);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(504),c=Array.prototype;t.exports=function(t){var r=t.slice;return t===c||o(c,t)&&r===c.slice?a:r}},function(t,r,i){"use strict";i(505);var o=i(29);t.exports=o("Array","slice")},function(t,r,i){"use strict";var o=i(1),a=i(66),c=i(132),u=i(18),l=i(166),d=i(57),p=i(38),h=i(105),m=i(10),g=i(104),y=i(83),v=g("slice"),b=m("species"),_=Array,w=Math.max;o({target:"Array",proto:!0,forced:!v},{slice:function slice(t,r){var i,o,m,g=p(this),v=d(g),S=l(t,v),I=l(void 0===r?v:r,v);if(a(g)&&(i=g.constructor,(c(i)&&(i===_||a(i.prototype))||u(i)&&null===(i=i[b]))&&(i=void 0),i===_||void 0===i))return y(g,S,I);for(o=new(void 0===i?_:i)(w(I-S,0)),m=0;S<I;S++,m++)S in g&&h(o,m,g[S]);return o.length=m,o}})},function(t,r,i){"use strict";var o=i(507);t.exports=o},function(t,r,i){"use strict";var o=i(260);t.exports=o},function(t,r,i){"use strict";i(135),i(509);var o=i(15);t.exports=o.Array.from},function(t,r,i){"use strict";var o=i(1),a=i(510);o({target:"Array",stat:!0,forced:!i(263)((function(t){Array.from(t)}))},{from:a})},function(t,r,i){"use strict";var o=i(63),a=i(20),c=i(36),u=i(511),l=i(262),d=i(132),p=i(57),h=i(105),m=i(185),g=i(109),y=Array;t.exports=function from(t){var r=c(t),i=d(this),v=arguments.length,b=v>1?arguments[1]:void 0,_=void 0!==b;_&&(b=o(b,v>2?arguments[2]:void 0));var w,S,I,k,x,P,C=g(r),A=0;if(!C||this===y&&l(C))for(w=p(r),S=i?new this(w):y(w);w>A;A++)P=_?b(r[A],A):r[A],h(S,A,P);else for(S=i?new this:[],x=(k=m(r,C)).next;!(I=a(x,k)).done;A++)P=_?u(k,b,[I.value,A],!0):I.value,h(S,A,P);return S.length=A,S}},function(t,r,i){"use strict";var o=i(33),a=i(261);t.exports=function(t,r,i,c){try{return c?r(o(i)[0],i[1]):r(i)}catch(r){a(t,"throw",r)}}},function(t,r,i){var o=i(183);t.exports=function _arrayWithHoles(t){if(o(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){var o=i(106),a=i(182),c=i(173);t.exports=function _iterableToArrayLimit(t,r){var i=null==t?null:void 0!==o&&a(t)||t["@@iterator"];if(null!=i){var u,l,d,p,h=[],m=!0,g=!1;try{if(d=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;m=!1}else for(;!(m=(u=d.call(i)).done)&&(c(h).call(h,u.value),h.length!==r);m=!0);}catch(t){g=!0,l=t}finally{try{if(!m&&null!=i.return&&(p=i.return(),Object(p)!==p))return}finally{if(g)throw l}}return h}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r){t.exports=function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(516);i(541),i(542),i(543),i(544),t.exports=o},function(t,r,i){"use strict";var o=i(266);i(540),t.exports=o},function(t,r,i){"use strict";i(267),i(68),i(107),i(525),i(276),i(277),i(278),i(539),i(135);var o=i(15);t.exports=o.Promise},function(t,r,i){"use strict";var o=i(1),a=i(23),c=i(108),u=i(134),l=i(519),d=i(82),p=i(47),h=i(55),m=i(520),g=i(521),y=i(70),v=i(524),b=i(10)("toStringTag"),_=Error,w=[].push,S=function AggregateError(t,r){var i,o=a(I,this);u?i=u(new _,o?c(this):I):(i=o?this:d(I),p(i,b,"Error")),void 0!==r&&p(i,"message",v(r)),g(i,S,i.stack,1),arguments.length>2&&m(i,arguments[2]);var l=[];return y(t,w,{that:l}),p(i,"errors",l),i};u?u(S,_):l(S,_,{name:!0});var I=S.prototype=d(_.prototype,{constructor:h(1,S),message:h(1,""),name:h(1,"AggregateError")});o({global:!0,constructor:!0,arity:2},{AggregateError:S})},function(t,r,i){"use strict";var o=i(21),a=i(240),c=i(77),u=i(32);t.exports=function(t,r,i){for(var l=a(r),d=u.f,p=c.f,h=0;h<l.length;h++){var m=l[h];o(t,m)||i&&o(i,m)||d(t,m,p(r,m))}}},function(t,r,i){"use strict";var o=i(18),a=i(47);t.exports=function(t,r){o(r)&&"cause"in r&&a(t,"cause",r.cause)}},function(t,r,i){"use strict";var o=i(47),a=i(522),c=i(523),u=Error.captureStackTrace;t.exports=function(t,r,i,l){c&&(u?u(t,r):o(t,"stack",a(i,l)))}},function(t,r,i){"use strict";var o=i(9),a=Error,c=o("".replace),u=String(new a("zxcasd").stack),l=/\n\s*at [^:]*:[^\n]*/,d=l.test(u);t.exports=function(t,r){if(d&&"string"==typeof t&&!a.prepareStackTrace)for(;r--;)t=c(t,l,"");return t}},function(t,r,i){"use strict";var o=i(8),a=i(55);t.exports=!o((function(){var t=new Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",a(1,7)),7!==t.stack)}))},function(t,r,i){"use strict";var o=i(40);t.exports=function(t,r){return void 0===t?arguments.length<2?"":r:o(t)}},function(t,r,i){"use strict";i(526),i(534),i(535),i(536),i(537),i(538)},function(t,r,i){"use strict";var o,a,c,u=i(1),l=i(35),d=i(139),p=i(11),h=i(20),m=i(48),g=i(134),y=i(49),v=i(527),b=i(39),_=i(12),w=i(18),S=i(140),I=i(268),k=i(269).set,x=i(529),P=i(532),C=i(86),A=i(273),O=i(58),R=i(87),M=i(110),j=i(50),L=M.CONSTRUCTOR,D=M.REJECTION_EVENT,B=M.SUBCLASSING,N=O.getterFor("Promise"),U=O.set,q=R&&R.prototype,W=R,z=q,V=p.TypeError,H=p.document,$=p.process,K=j.f,G=K,J=!!(H&&H.createEvent&&p.dispatchEvent),isThenable=function(t){var r;return!(!w(t)||!_(r=t.then))&&r},callReaction=function(t,r){var i,o,a,c=r.value,u=1===r.state,l=u?t.ok:t.fail,d=t.resolve,p=t.reject,m=t.domain;try{l?(u||(2===r.rejection&&onHandleUnhandled(r),r.rejection=1),!0===l?i=c:(m&&m.enter(),i=l(c),m&&(m.exit(),a=!0)),i===t.promise?p(new V("Promise-chain cycle")):(o=isThenable(i))?h(o,i,d,p):d(i)):p(c)}catch(t){m&&!a&&m.exit(),p(t)}},notify=function(t,r){t.notified||(t.notified=!0,x((function(){for(var i,o=t.reactions;i=o.get();)callReaction(i,t);t.notified=!1,r&&!t.rejection&&onUnhandled(t)})))},dispatchEvent=function(t,r,i){var o,a;J?((o=H.createEvent("Event")).promise=r,o.reason=i,o.initEvent(t,!1,!0),p.dispatchEvent(o)):o={promise:r,reason:i},!D&&(a=p["on"+t])?a(o):"unhandledrejection"===t&&P("Unhandled promise rejection",i)},onUnhandled=function(t){h(k,p,(function(){var r,i=t.facade,o=t.value;if(isUnhandled(t)&&(r=C((function(){d?$.emit("unhandledRejection",o,i):dispatchEvent("unhandledrejection",i,o)})),t.rejection=d||isUnhandled(t)?2:1,r.error))throw r.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){h(k,p,(function(){var r=t.facade;d?$.emit("rejectionHandled",r):dispatchEvent("rejectionhandled",r,t.value)}))},bind=function(t,r,i){return function(o){t(r,o,i)}},internalReject=function(t,r,i){t.done||(t.done=!0,i&&(t=i),t.value=r,t.state=2,notify(t,!0))},internalResolve=function(t,r,i){if(!t.done){t.done=!0,i&&(t=i);try{if(t.facade===r)throw new V("Promise can't be resolved itself");var o=isThenable(r);o?x((function(){var i={done:!1};try{h(o,r,bind(internalResolve,i,t),bind(internalReject,i,t))}catch(r){internalReject(i,r,t)}})):(t.value=r,t.state=1,notify(t,!1))}catch(r){internalReject({done:!1},r,t)}}};if(L&&(z=(W=function Promise(t){S(this,z),b(t),h(o,this);var r=N(this);try{t(bind(internalResolve,r),bind(internalReject,r))}catch(t){internalReject(r,t)}}).prototype,(o=function Promise(t){U(this,{type:"Promise",done:!1,notified:!1,parent:!1,reactions:new A,rejection:!1,state:0,value:void 0})}).prototype=m(z,"then",(function then(t,r){var i=N(this),o=K(I(this,W));return i.parent=!0,o.ok=!_(t)||t,o.fail=_(r)&&r,o.domain=d?$.domain:void 0,0===i.state?i.reactions.add(o):x((function(){callReaction(o,i)})),o.promise})),a=function(){var t=new o,r=N(t);this.promise=t,this.resolve=bind(internalResolve,r),this.reject=bind(internalReject,r)},j.f=K=function(t){return t===W||void 0===t?new a(t):G(t)},!l&&_(R)&&q!==Object.prototype)){c=q.then,B||m(q,"then",(function then(t,r){var i=this;return new W((function(t,r){h(c,i,t,r)})).then(t,r)}),{unsafe:!0});try{delete q.constructor}catch(t){}g&&g(q,z)}u({global:!0,constructor:!0,wrap:!0,forced:L},{Promise:W}),y(W,"Promise",!1,!0),v("Promise")},function(t,r,i){"use strict";var o=i(28),a=i(171),c=i(10),u=i(13),l=c("species");t.exports=function(t){var r=o(t);u&&r&&!r[l]&&a(r,l,{configurable:!0,get:function(){return this}})}},function(t,r,i){"use strict";var o=i(132),a=i(80),c=TypeError;t.exports=function(t){if(o(t))return t;throw new c(a(t)+" is not a constructor")}},function(t,r,i){"use strict";var o,a,c,u,l,d=i(11),p=i(272),h=i(63),m=i(269).set,g=i(273),y=i(271),v=i(530),b=i(531),_=i(139),w=d.MutationObserver||d.WebKitMutationObserver,S=d.document,I=d.process,k=d.Promise,x=p("queueMicrotask");if(!x){var P=new g,flush=function(){var t,r;for(_&&(t=I.domain)&&t.exit();r=P.get();)try{r()}catch(t){throw P.head&&o(),t}t&&t.enter()};y||_||b||!w||!S?!v&&k&&k.resolve?((u=k.resolve(void 0)).constructor=k,l=h(u.then,u),o=function(){l(flush)}):_?o=function(){I.nextTick(flush)}:(m=h(m,d),o=function(){m(flush)}):(a=!0,c=S.createTextNode(""),new w(flush).observe(c,{characterData:!0}),o=function(){c.data=a=!a}),x=function(t){P.head||o(),P.add(t)}}t.exports=x},function(t,r,i){"use strict";var o=i(125);t.exports=/ipad|iphone|ipod/i.test(o)&&"undefined"!=typeof Pebble},function(t,r,i){"use strict";var o=i(125);t.exports=/web0s(?!.*chrome)/i.test(o)},function(t,r,i){"use strict";t.exports=function(t,r){try{1===arguments.length?console.error(t):console.error(t,r)}catch(t){}}},function(t,r,i){"use strict";var o=i(274),a=i(139);t.exports=!o&&!a&&"object"==typeof window&&"object"==typeof document},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(39),u=i(50),l=i(86),d=i(70);o({target:"Promise",stat:!0,forced:i(141)},{all:function all(t){var r=this,i=u.f(r),o=i.resolve,p=i.reject,h=l((function(){var i=c(r.resolve),u=[],l=0,h=1;d(t,(function(t){var c=l++,d=!1;h++,a(i,r,t).then((function(t){d||(d=!0,u[c]=t,--h||o(u))}),p)})),--h||o(u)}));return h.error&&p(h.value),i.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(35),c=i(110).CONSTRUCTOR,u=i(87),l=i(28),d=i(12),p=i(48),h=u&&u.prototype;if(o({target:"Promise",proto:!0,forced:c,real:!0},{catch:function(t){return this.then(void 0,t)}}),!a&&d(u)){var m=l("Promise").prototype.catch;h.catch!==m&&p(h,"catch",m,{unsafe:!0})}},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(39),u=i(50),l=i(86),d=i(70);o({target:"Promise",stat:!0,forced:i(141)},{race:function race(t){var r=this,i=u.f(r),o=i.reject,p=l((function(){var u=c(r.resolve);d(t,(function(t){a(u,r,t).then(i.resolve,o)}))}));return p.error&&o(p.value),i.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(50);o({target:"Promise",stat:!0,forced:i(110).CONSTRUCTOR},{reject:function reject(t){var r=a.f(this);return(0,r.reject)(t),r.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(28),c=i(35),u=i(87),l=i(110).CONSTRUCTOR,d=i(275),p=a("Promise"),h=c&&!l;o({target:"Promise",stat:!0,forced:c||l},{resolve:function resolve(t){return d(h&&this===p?u:this,t)}})},function(t,r,i){"use strict";var o=i(1),a=i(35),c=i(87),u=i(8),l=i(28),d=i(12),p=i(268),h=i(275),m=i(48),g=c&&c.prototype;if(o({target:"Promise",proto:!0,real:!0,forced:!!c&&u((function(){g.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var r=p(this,l("Promise")),i=d(t);return this.then(i?function(i){return h(r,t()).then((function(){return i}))}:t,i?function(i){return h(r,t()).then((function(){throw i}))}:t)}}),!a&&d(c)){var y=l("Promise").prototype.finally;g.finally!==y&&m(g,"finally",y,{unsafe:!0})}},function(t,r,i){"use strict";i(278)},function(t,r,i){"use strict";i(267)},function(t,r,i){"use strict";i(276)},function(t,r,i){"use strict";var o=i(1),a=i(99),c=i(83),u=i(50),l=i(39),d=i(86);o({target:"Promise",stat:!0,forced:!0},{try:function(t){var r=c(arguments,1),i=u.f(this),o=d((function(){return a(l(t),void 0,r)}));return(o.error?i.reject:i.resolve)(o.value),i.promise}})},function(t,r,i){"use strict";i(277)},function(t,r,i){var o=i(7).default,a=i(133),c=i(106),u=i(546),l=i(552),d=i(238),p=i(173),h=i(558),m=i(265),g=i(564),y=i(257);function _regeneratorRuntime(){"use strict";t.exports=_regeneratorRuntime=function _regeneratorRuntime(){return i},t.exports.__esModule=!0,t.exports.default=t.exports;var r,i={},v=Object.prototype,b=v.hasOwnProperty,_=a||function(t,r,i){t[r]=i.value},w="function"==typeof c?c:{},S=w.iterator||"@@iterator",I=w.asyncIterator||"@@asyncIterator",k=w.toStringTag||"@@toStringTag";function define(t,r,i){return a(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(r){define=function define(t,r,i){return t[r]=i}}function wrap(t,r,i,o){var a=r&&r.prototype instanceof Generator?r:Generator,c=u(a.prototype),l=new Context(o||[]);return _(c,"_invoke",{value:makeInvokeMethod(t,i,l)}),c}function tryCatch(t,r,i){try{return{type:"normal",arg:t.call(r,i)}}catch(t){return{type:"throw",arg:t}}}i.wrap=wrap;var x="suspendedStart",P="executing",C="completed",A={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var O={};define(O,S,(function(){return this}));var R=l&&l(l(values([])));R&&R!==v&&b.call(R,S)&&(O=R);var M=GeneratorFunctionPrototype.prototype=Generator.prototype=u(O);function defineIteratorMethods(t){var r;d(r=["next","throw","return"]).call(r,(function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,a,c,u){var l=tryCatch(t[i],t,a);if("throw"!==l.type){var d=l.arg,p=d.value;return p&&"object"==o(p)&&b.call(p,"__await")?r.resolve(p.__await).then((function(t){invoke("next",t,c,u)}),(function(t){invoke("throw",t,c,u)})):r.resolve(p).then((function(t){d.value=t,c(d)}),(function(t){return invoke("throw",t,c,u)}))}u(l.arg)}var i;_(this,"_invoke",{value:function value(t,o){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,o,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(t,i,o){var a=x;return function(c,u){if(a===P)throw Error("Generator is already running");if(a===C){if("throw"===c)throw u;return{value:r,done:!0}}for(o.method=c,o.arg=u;;){var l=o.delegate;if(l){var d=maybeInvokeDelegate(l,o);if(d){if(d===A)continue;return d}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(a===x)throw a=C,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);a=P;var p=tryCatch(t,i,o);if("normal"===p.type){if(a=o.done?C:"suspendedYield",p.arg===A)continue;return{value:p.arg,done:o.done}}"throw"===p.type&&(a=C,o.method="throw",o.arg=p.arg)}}}function maybeInvokeDelegate(t,i){var o=i.method,a=t.iterator[o];if(a===r)return i.delegate=null,"throw"===o&&t.iterator.return&&(i.method="return",i.arg=r,maybeInvokeDelegate(t,i),"throw"===i.method)||"return"!==o&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+o+"' method")),A;var c=tryCatch(a,t.iterator,i.arg);if("throw"===c.type)return i.method="throw",i.arg=c.arg,i.delegate=null,A;var u=c.arg;return u?u.done?(i[t.resultName]=u.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=r),i.delegate=null,A):u:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,A)}function pushTryEntry(t){var r,i={tryLoc:t[0]};1 in t&&(i.catchLoc=t[1]),2 in t&&(i.finallyLoc=t[2],i.afterLoc=t[3]),p(r=this.tryEntries).call(r,i)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],d(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t||""===t){var i=t[S];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,c=function next(){for(;++a<t.length;)if(b.call(t,a))return next.value=t[a],next.done=!1,next;return next.value=r,next.done=!0,next};return c.next=c}}throw new TypeError(o(t)+" is not iterable")}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_(M,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),_(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,k,"GeneratorFunction"),i.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},i.mark=function(t){return h?h(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,k,"GeneratorFunction")),t.prototype=u(M),t},i.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,I,(function(){return this})),i.AsyncIterator=AsyncIterator,i.async=function(t,r,o,a,c){void 0===c&&(c=m);var u=new AsyncIterator(wrap(t,r,o,a),c);return i.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},defineIteratorMethods(M),define(M,k,"Generator"),define(M,S,(function(){return this})),define(M,"toString",(function(){return"[object Generator]"})),i.keys=function(t){var r=Object(t),i=[];for(var o in r)p(i).call(i,o);return g(i).call(i),function next(){for(;i.length;){var t=i.pop();if(t in r)return next.value=t,next.done=!1,next}return next.done=!0,next}},i.values=values,Context.prototype={constructor:Context,reset:function reset(t){var i;if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,d(i=this.tryEntries).call(i,resetTryEntry),!t)for(var o in this)"t"===o.charAt(0)&&b.call(this,o)&&!isNaN(+y(o).call(o,1))&&(this[o]=r)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var i=this;function handle(o,a){return c.type="throw",c.arg=t,i.next=o,a&&(i.method="next",i.arg=r),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return handle("end");if(a.tryLoc<=this.prev){var u=b.call(a,"catchLoc"),l=b.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return handle(a.catchLoc,!0);if(this.prev<a.finallyLoc)return handle(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return handle(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return handle(a.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&b.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var c=a?a.completion:{};return c.type=t,c.arg=r,a?(this.method="next",this.next=a.finallyLoc,A):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),A},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),resetTryEntry(i),A}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc===t){var o=i.completion;if("throw"===o.type){var a=o.arg;resetTryEntry(i)}return a}}throw Error("illegal catch attempt")},delegateYield:function delegateYield(t,i,o){return this.delegate={iterator:values(t),resultName:i,nextLoc:o},"next"===this.method&&(this.arg=r),A}},i}t.exports=_regeneratorRuntime,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";t.exports=i(547)},function(t,r,i){"use strict";var o=i(548);t.exports=o},function(t,r,i){"use strict";var o=i(549);t.exports=o},function(t,r,i){"use strict";var o=i(550);t.exports=o},function(t,r,i){"use strict";i(551);var o=i(15).Object;t.exports=function create(t,r){return o.create(t,r)}},function(t,r,i){"use strict";i(1)({target:"Object",stat:!0,sham:!i(13)},{create:i(82)})},function(t,r,i){"use strict";t.exports=i(553)},function(t,r,i){"use strict";var o=i(554);t.exports=o},function(t,r,i){"use strict";var o=i(555);t.exports=o},function(t,r,i){"use strict";var o=i(556);t.exports=o},function(t,r,i){"use strict";i(557);var o=i(15);t.exports=o.Object.getPrototypeOf},function(t,r,i){"use strict";var o=i(1),a=i(8),c=i(36),u=i(108),l=i(248);o({target:"Object",stat:!0,forced:a((function(){u(1)})),sham:!l},{getPrototypeOf:function getPrototypeOf(t){return u(c(t))}})},function(t,r,i){"use strict";t.exports=i(559)},function(t,r,i){"use strict";var o=i(560);t.exports=o},function(t,r,i){"use strict";var o=i(561);t.exports=o},function(t,r,i){"use strict";var o=i(562);t.exports=o},function(t,r,i){"use strict";i(563);var o=i(15);t.exports=o.Object.setPrototypeOf},function(t,r,i){"use strict";i(1)({target:"Object",stat:!0},{setPrototypeOf:i(134)})},function(t,r,i){"use strict";t.exports=i(565)},function(t,r,i){"use strict";var o=i(566);t.exports=o},function(t,r,i){"use strict";var o=i(567);t.exports=o},function(t,r,i){"use strict";var o=i(568);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(569),c=Array.prototype;t.exports=function(t){var r=t.reverse;return t===c||o(c,t)&&r===c.reverse?a:r}},function(t,r,i){"use strict";i(570);var o=i(29);t.exports=o("Array","reverse")},function(t,r,i){"use strict";var o=i(1),a=i(9),c=i(66),u=a([].reverse),l=[1,2];o({target:"Array",proto:!0,forced:String(l)===String(l.reverse())},{reverse:function reverse(){return c(this)&&(this.length=this.length),u(this)}})},function(t,r,i){"use strict";var o=i(572);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(573),c=i(575),u=Array.prototype,l=String.prototype;t.exports=function(t){var r=t.includes;return t===u||o(u,t)&&r===u.includes?a:"string"==typeof t||t===l||o(l,t)&&r===l.includes?c:r}},function(t,r,i){"use strict";i(574);var o=i(29);t.exports=o("Array","includes")},function(t,r,i){"use strict";var o=i(1),a=i(165).includes,c=i(8),u=i(175);o({target:"Array",proto:!0,forced:c((function(){return!Array(1).includes()}))},{includes:function includes(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}}),u("includes")},function(t,r,i){"use strict";i(576);var o=i(29);t.exports=o("String","includes")},function(t,r,i){"use strict";var o=i(1),a=i(9),c=i(251),u=i(56),l=i(40),d=i(252),p=a("".indexOf);o({target:"String",proto:!0,forced:!d("includes")},{includes:function includes(t){return!!~p(l(u(this)),l(c(t)),arguments.length>1?arguments[1]:void 0)}})},function(t,r,i){"use strict";i(67);var o=i(64),a=i(21),c=i(23),u=i(578),l=Array.prototype,d={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var r=t.entries;return t===l||c(l,t)&&r===l.entries||a(d,o(t))?u:r}},function(t,r,i){"use strict";var o=i(579);t.exports=o},function(t,r,i){"use strict";i(68),i(107);var o=i(29);t.exports=o("Array","entries")},function(t,r,i){"use strict";var o=i(581);t.exports=o},function(t,r,i){"use strict";i(582),i(235);var o=i(15),a=i(99);o.JSON||(o.JSON={stringify:JSON.stringify}),t.exports=function stringify(t,r,i){return a(o.JSON.stringify,null,arguments)}},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(36),u=i(221),l=i(583),d=i(43);o({target:"Date",proto:!0,forced:i(8)((function(){return null!==new Date(NaN).toJSON()||1!==a(Date.prototype.toJSON,{toISOString:function(){return 1}})}))},{toJSON:function toJSON(t){var r=c(this),i=u(r,"number");return"number"!=typeof i||isFinite(i)?"toISOString"in r||"Date"!==d(r)?r.toISOString():a(l,r):null}})},function(t,r,i){"use strict";var o=i(9),a=i(8),c=i(584).start,u=RangeError,l=isFinite,d=Math.abs,p=Date.prototype,h=p.toISOString,m=o(p.getTime),g=o(p.getUTCDate),y=o(p.getUTCFullYear),v=o(p.getUTCHours),b=o(p.getUTCMilliseconds),_=o(p.getUTCMinutes),w=o(p.getUTCMonth),S=o(p.getUTCSeconds);t.exports=a((function(){return"0385-07-25T07:06:39.999Z"!==h.call(new Date(-50000000000001))}))||!a((function(){h.call(new Date(NaN))}))?function toISOString(){if(!l(m(this)))throw new u("Invalid time value");var t=y(this),r=b(this),i=t<0?"-":t>9999?"+":"";return i+c(d(t),i?6:4,0)+"-"+c(w(this)+1,2,0)+"-"+c(g(this),2,0)+"T"+c(v(this),2,0)+":"+c(_(this),2,0)+":"+c(S(this),2,0)+"."+c(r,3,0)+"Z"}:h},function(t,r,i){"use strict";var o=i(9),a=i(167),c=i(40),u=i(585),l=i(56),d=o(u),p=o("".slice),h=Math.ceil,createMethod=function(t){return function(r,i,o){var u,m,g=c(l(r)),y=a(i),v=g.length,b=void 0===o?" ":c(o);return y<=v||""===b?g:((m=d(b,h((u=y-v)/b.length))).length>u&&(m=p(m,0,u)),t?g+m:m+g)}};t.exports={start:createMethod(!1),end:createMethod(!0)}},function(t,r,i){"use strict";var o=i(102),a=i(40),c=i(56),u=RangeError;t.exports=function repeat(t){var r=a(c(this)),i="",l=o(t);if(l<0||l===1/0)throw new u("Wrong number of repetitions");for(;l>0;(l>>>=1)&&(r+=r))1&l&&(i+=r);return i}},function(t,r,i){"use strict";var o=i(587);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(588),c=Array.prototype;t.exports=function(t){var r=t.map;return t===c||o(c,t)&&r===c.map?a:r}},function(t,r,i){"use strict";i(589);var o=i(29);t.exports=o("Array","map")},function(t,r,i){"use strict";var o=i(1),a=i(65).map;o({target:"Array",proto:!0,forced:!i(104)("map")},{map:function map(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,r,i){"use strict";var o=i(591);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(592),c=Array.prototype;t.exports=function(t){var r=t.concat;return t===c||o(c,t)&&r===c.concat?a:r}},function(t,r,i){"use strict";i(242);var o=i(29);t.exports=o("Array","concat")},function(t,r,i){"use strict";var o=i(594);t.exports=o},function(t,r,i){"use strict";i(595);var o=i(15);t.exports=o.Object.entries},function(t,r,i){"use strict";var o=i(1),a=i(596).entries;o({target:"Object",stat:!0},{entries:function entries(t){return a(t)}})},function(t,r,i){"use strict";var o=i(13),a=i(8),c=i(9),u=i(108),l=i(101),d=i(38),p=c(i(123).f),h=c([].push),m=o&&a((function(){var t=Object.create(null);return t[2]=2,!p(t,2)})),createMethod=function(t){return function(r){for(var i,a=d(r),c=l(a),g=m&&null===u(a),y=c.length,v=0,b=[];y>v;)i=c[v++],o&&!(g?i in a:p(a,i))||h(b,t?[i,a[i]]:a[i]);return b}};t.exports={entries:createMethod(!0),values:createMethod(!1)}},function(t,r,i){var o=i(183),a=i(264);t.exports=function _arrayWithoutHoles(t){if(o(t))return a(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){var o=i(106),a=i(182),c=i(259);t.exports=function _iterableToArray(t){if(void 0!==o&&null!=a(t)||null!=t["@@iterator"])return c(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r){t.exports=function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(601);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(602),c=Array.prototype;t.exports=function(t){var r=t.find;return t===c||o(c,t)&&r===c.find?a:r}},function(t,r,i){"use strict";i(603);var o=i(29);t.exports=o("Array","find")},function(t,r,i){"use strict";var o=i(1),a=i(65).find,c=i(175),u=!0;"find"in[]&&Array(1).find((function(){u=!1})),o({target:"Array",proto:!0,forced:u},{find:function find(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}}),c("find")},function(t,r,i){"use strict";var o=i(605);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(606),c=Array.prototype;t.exports=function(t){var r=t.splice;return t===c||o(c,t)&&r===c.splice?a:r}},function(t,r,i){"use strict";i(607);var o=i(29);t.exports=o("Array","splice")},function(t,r,i){"use strict";var o=i(1),a=i(36),c=i(166),u=i(102),l=i(57),d=i(237),p=i(174),h=i(172),m=i(105),g=i(608),y=i(104)("splice"),v=Math.max,b=Math.min;o({target:"Array",proto:!0,forced:!y},{splice:function splice(t,r){var i,o,y,_,w,S,I=a(this),k=l(I),x=c(t,k),P=arguments.length;for(0===P?i=o=0:1===P?(i=0,o=k-x):(i=P-2,o=b(v(u(r),0),k-x)),p(k+i-o),y=h(I,o),_=0;_<o;_++)(w=x+_)in I&&m(y,_,I[w]);if(y.length=o,i<o){for(_=x;_<k-o;_++)S=_+i,(w=_+o)in I?I[S]=I[w]:g(I,S);for(_=k;_>k-o+i;_--)g(I,_-1)}else if(i>o)for(_=k-o;_>x;_--)S=_+i-1,(w=_+o-1)in I?I[S]=I[w]:g(I,S);for(_=0;_<i;_++)I[_+x]=arguments[_+2];return d(I,k-o+i),y}})},function(t,r,i){"use strict";var o=i(80),a=TypeError;t.exports=function(t,r){if(!delete t[r])throw new a("Cannot delete property "+o(r)+" of "+o(t))}},function(t,r,i){var o=i(610),a=i(639),c=i(285),u=i(641),l=i(651),d=i(654),p=i(655),h=i(656),m=i(658),g=i(659),y=i(660),v=i(193),b=i(665),_=i(666),w=i(672),S=i(89),I=i(288),k=i(674),x=i(112),P=i(676),C=i(187),A=i(191),O={};O["[object Arguments]"]=O["[object Array]"]=O["[object ArrayBuffer]"]=O["[object DataView]"]=O["[object Boolean]"]=O["[object Date]"]=O["[object Float32Array]"]=O["[object Float64Array]"]=O["[object Int8Array]"]=O["[object Int16Array]"]=O["[object Int32Array]"]=O["[object Map]"]=O["[object Number]"]=O["[object Object]"]=O["[object RegExp]"]=O["[object Set]"]=O["[object String]"]=O["[object Symbol]"]=O["[object Uint8Array]"]=O["[object Uint8ClampedArray]"]=O["[object Uint16Array]"]=O["[object Uint32Array]"]=!0,O["[object Error]"]=O["[object Function]"]=O["[object WeakMap]"]=!1,t.exports=function baseClone(t,r,i,R,M,j){var L,D=1&r,B=2&r,N=4&r;if(i&&(L=M?i(t,R,M,j):i(t)),void 0!==L)return L;if(!x(t))return t;var U=S(t);if(U){if(L=b(t),!D)return p(t,L)}else{var q=v(t),W="[object Function]"==q||"[object GeneratorFunction]"==q;if(I(t))return d(t,D);if("[object Object]"==q||"[object Arguments]"==q||W&&!M){if(L=B||W?{}:w(t),!D)return B?m(t,l(L,t)):h(t,u(L,t))}else{if(!O[q])return M?t:{};L=_(t,q,D)}}j||(j=new o);var z=j.get(t);if(z)return z;j.set(t,L),P(t)?t.forEach((function(o){L.add(baseClone(o,r,i,o,t,j))})):k(t)&&t.forEach((function(o,a){L.set(a,baseClone(o,r,i,a,t,j))}));var V=U?void 0:(N?B?y:g:B?A:C)(t);return a(V||t,(function(o,a){V&&(o=t[a=o]),c(L,a,baseClone(o,r,i,a,t,j))})),L}},function(t,r,i){var o=i(142),a=i(616),c=i(617),u=i(618),l=i(619),d=i(620);function Stack(t){var r=this.__data__=new o(t);this.size=r.size}Stack.prototype.clear=a,Stack.prototype.delete=c,Stack.prototype.get=u,Stack.prototype.has=l,Stack.prototype.set=d,t.exports=Stack},function(t,r){t.exports=function listCacheClear(){this.__data__=[],this.size=0}},function(t,r,i){var o=i(143),a=Array.prototype.splice;t.exports=function listCacheDelete(t){var r=this.__data__,i=o(r,t);return!(i<0)&&(i==r.length-1?r.pop():a.call(r,i,1),--this.size,!0)}},function(t,r,i){var o=i(143);t.exports=function listCacheGet(t){var r=this.__data__,i=o(r,t);return i<0?void 0:r[i][1]}},function(t,r,i){var o=i(143);t.exports=function listCacheHas(t){return o(this.__data__,t)>-1}},function(t,r,i){var o=i(143);t.exports=function listCacheSet(t,r){var i=this.__data__,a=o(i,t);return a<0?(++this.size,i.push([t,r])):i[a][1]=r,this}},function(t,r,i){var o=i(142);t.exports=function stackClear(){this.__data__=new o,this.size=0}},function(t,r){t.exports=function stackDelete(t){var r=this.__data__,i=r.delete(t);return this.size=r.size,i}},function(t,r){t.exports=function stackGet(t){return this.__data__.get(t)}},function(t,r){t.exports=function stackHas(t){return this.__data__.has(t)}},function(t,r,i){var o=i(142),a=i(186),c=i(284);t.exports=function stackSet(t,r){var i=this.__data__;if(i instanceof o){var u=i.__data__;if(!a||u.length<199)return u.push([t,r]),this.size=++i.size,this;i=this.__data__=new c(u)}return i.set(t,r),this.size=i.size,this}},function(t,r,i){var o=i(281),a=i(624),c=i(112),u=i(283),l=/^\[object .+?Constructor\]$/,d=Function.prototype,p=Object.prototype,h=d.toString,m=p.hasOwnProperty,g=RegExp("^"+h.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function baseIsNative(t){return!(!c(t)||a(t))&&(o(t)?g:l).test(u(t))}},function(t,r,i){var o=i(144),a=Object.prototype,c=a.hasOwnProperty,u=a.toString,l=o?o.toStringTag:void 0;t.exports=function getRawTag(t){var r=c.call(t,l),i=t[l];try{t[l]=void 0;var o=!0}catch(t){}var a=u.call(t);return o&&(r?t[l]=i:delete t[l]),a}},function(t,r){var i=Object.prototype.toString;t.exports=function objectToString(t){return i.call(t)}},function(t,r,i){var o,a=i(625),c=(o=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"";t.exports=function isMasked(t){return!!c&&c in t}},function(t,r,i){var o=i(44)["__core-js_shared__"];t.exports=o},function(t,r){t.exports=function getValue(t,r){return null==t?void 0:t[r]}},function(t,r,i){var o=i(628),a=i(142),c=i(186);t.exports=function mapCacheClear(){this.size=0,this.__data__={hash:new o,map:new(c||a),string:new o}}},function(t,r,i){var o=i(629),a=i(630),c=i(631),u=i(632),l=i(633);function Hash(t){var r=-1,i=null==t?0:t.length;for(this.clear();++r<i;){var o=t[r];this.set(o[0],o[1])}}Hash.prototype.clear=o,Hash.prototype.delete=a,Hash.prototype.get=c,Hash.prototype.has=u,Hash.prototype.set=l,t.exports=Hash},function(t,r,i){var o=i(145);t.exports=function hashClear(){this.__data__=o?o(null):{},this.size=0}},function(t,r){t.exports=function hashDelete(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}},function(t,r,i){var o=i(145),a=Object.prototype.hasOwnProperty;t.exports=function hashGet(t){var r=this.__data__;if(o){var i=r[t];return"__lodash_hash_undefined__"===i?void 0:i}return a.call(r,t)?r[t]:void 0}},function(t,r,i){var o=i(145),a=Object.prototype.hasOwnProperty;t.exports=function hashHas(t){var r=this.__data__;return o?void 0!==r[t]:a.call(r,t)}},function(t,r,i){var o=i(145);t.exports=function hashSet(t,r){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=o&&void 0===r?"__lodash_hash_undefined__":r,this}},function(t,r,i){var o=i(146);t.exports=function mapCacheDelete(t){var r=o(this,t).delete(t);return this.size-=r?1:0,r}},function(t,r){t.exports=function isKeyable(t){var r=typeof t;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t}},function(t,r,i){var o=i(146);t.exports=function mapCacheGet(t){return o(this,t).get(t)}},function(t,r,i){var o=i(146);t.exports=function mapCacheHas(t){return o(this,t).has(t)}},function(t,r,i){var o=i(146);t.exports=function mapCacheSet(t,r){var i=o(this,t),a=i.size;return i.set(t,r),this.size+=i.size==a?0:1,this}},function(t,r){t.exports=function arrayEach(t,r){for(var i=-1,o=null==t?0:t.length;++i<o&&!1!==r(t[i],i,t););return t}},function(t,r,i){var o=i(71),a=function(){try{var t=o(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=a},function(t,r,i){var o=i(147),a=i(187);t.exports=function baseAssign(t,r){return t&&o(r,a(r),t)}},function(t,r){t.exports=function baseTimes(t,r){for(var i=-1,o=Array(t);++i<t;)o[i]=r(i);return o}},function(t,r,i){var o=i(644),a=i(88),c=Object.prototype,u=c.hasOwnProperty,l=c.propertyIsEnumerable,d=o(function(){return arguments}())?o:function(t){return a(t)&&u.call(t,"callee")&&!l.call(t,"callee")};t.exports=d},function(t,r,i){var o=i(111),a=i(88);t.exports=function baseIsArguments(t){return a(t)&&"[object Arguments]"==o(t)}},function(t,r){t.exports=function stubFalse(){return!1}},function(t,r){var i=/^(?:0|[1-9]\d*)$/;t.exports=function isIndex(t,r){var o=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==o||"symbol"!=o&&i.test(t))&&t>-1&&t%1==0&&t<r}},function(t,r,i){var o=i(648),a=i(188),c=i(189),u=c&&c.isTypedArray,l=u?a(u):o;t.exports=l},function(t,r,i){var o=i(111),a=i(289),c=i(88),u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u["[object Arguments]"]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u["[object Map]"]=u["[object Number]"]=u["[object Object]"]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1,t.exports=function baseIsTypedArray(t){return c(t)&&a(t.length)&&!!u[o(t)]}},function(t,r,i){var o=i(190),a=i(650),c=Object.prototype.hasOwnProperty;t.exports=function baseKeys(t){if(!o(t))return a(t);var r=[];for(var i in Object(t))c.call(t,i)&&"constructor"!=i&&r.push(i);return r}},function(t,r,i){var o=i(290)(Object.keys,Object);t.exports=o},function(t,r,i){var o=i(147),a=i(191);t.exports=function baseAssignIn(t,r){return t&&o(r,a(r),t)}},function(t,r,i){var o=i(112),a=i(190),c=i(653),u=Object.prototype.hasOwnProperty;t.exports=function baseKeysIn(t){if(!o(t))return c(t);var r=a(t),i=[];for(var l in t)("constructor"!=l||!r&&u.call(t,l))&&i.push(l);return i}},function(t,r){t.exports=function nativeKeysIn(t){var r=[];if(null!=t)for(var i in Object(t))r.push(i);return r}},function(t,r,i){(function(t){var o=i(44),a=r&&!r.nodeType&&r,c=a&&"object"==typeof t&&t&&!t.nodeType&&t,u=c&&c.exports===a?o.Buffer:void 0,l=u?u.allocUnsafe:void 0;t.exports=function cloneBuffer(t,r){if(r)return t.slice();var i=t.length,o=l?l(i):new t.constructor(i);return t.copy(o),o}}).call(this,i(136)(t))},function(t,r){t.exports=function copyArray(t,r){var i=-1,o=t.length;for(r||(r=Array(o));++i<o;)r[i]=t[i];return r}},function(t,r,i){var o=i(147),a=i(192);t.exports=function copySymbols(t,r){return o(t,a(t),r)}},function(t,r){t.exports=function arrayFilter(t,r){for(var i=-1,o=null==t?0:t.length,a=0,c=[];++i<o;){var u=t[i];r(u,i,t)&&(c[a++]=u)}return c}},function(t,r,i){var o=i(147),a=i(293);t.exports=function copySymbolsIn(t,r){return o(t,a(t),r)}},function(t,r,i){var o=i(296),a=i(192),c=i(187);t.exports=function getAllKeys(t){return o(t,c,a)}},function(t,r,i){var o=i(296),a=i(293),c=i(191);t.exports=function getAllKeysIn(t){return o(t,c,a)}},function(t,r,i){var o=i(71)(i(44),"DataView");t.exports=o},function(t,r,i){var o=i(71)(i(44),"Promise");t.exports=o},function(t,r,i){var o=i(71)(i(44),"Set");t.exports=o},function(t,r,i){var o=i(71)(i(44),"WeakMap");t.exports=o},function(t,r){var i=Object.prototype.hasOwnProperty;t.exports=function initCloneArray(t){var r=t.length,o=new t.constructor(r);return r&&"string"==typeof t[0]&&i.call(t,"index")&&(o.index=t.index,o.input=t.input),o}},function(t,r,i){var o=i(194),a=i(668),c=i(669),u=i(670),l=i(671);t.exports=function initCloneByTag(t,r,i){var d=t.constructor;switch(r){case"[object ArrayBuffer]":return o(t);case"[object Boolean]":case"[object Date]":return new d(+t);case"[object DataView]":return a(t,i);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 l(t,i);case"[object Map]":return new d;case"[object Number]":case"[object String]":return new d(t);case"[object RegExp]":return c(t);case"[object Set]":return new d;case"[object Symbol]":return u(t)}}},function(t,r,i){var o=i(44).Uint8Array;t.exports=o},function(t,r,i){var o=i(194);t.exports=function cloneDataView(t,r){var i=r?o(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}},function(t,r){var i=/\w*$/;t.exports=function cloneRegExp(t){var r=new t.constructor(t.source,i.exec(t));return r.lastIndex=t.lastIndex,r}},function(t,r,i){var o=i(144),a=o?o.prototype:void 0,c=a?a.valueOf:void 0;t.exports=function cloneSymbol(t){return c?Object(c.call(t)):{}}},function(t,r,i){var o=i(194);t.exports=function cloneTypedArray(t,r){var i=r?o(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}},function(t,r,i){var o=i(673),a=i(295),c=i(190);t.exports=function initCloneObject(t){return"function"!=typeof t.constructor||c(t)?{}:o(a(t))}},function(t,r,i){var o=i(112),a=Object.create,c=function(){function object(){}return function(t){if(!o(t))return{};if(a)return a(t);object.prototype=t;var r=new object;return object.prototype=void 0,r}}();t.exports=c},function(t,r,i){var o=i(675),a=i(188),c=i(189),u=c&&c.isMap,l=u?a(u):o;t.exports=l},function(t,r,i){var o=i(193),a=i(88);t.exports=function baseIsMap(t){return a(t)&&"[object Map]"==o(t)}},function(t,r,i){var o=i(677),a=i(188),c=i(189),u=c&&c.isSet,l=u?a(u):o;t.exports=l},function(t,r,i){var o=i(193),a=i(88);t.exports=function baseIsSet(t){return a(t)&&"[object Set]"==o(t)}},function(t,r,i){"use strict";var o=i(679);i(67),t.exports=o},function(t,r,i){"use strict";i(68),i(107),i(680);var o=i(15);t.exports=o.WeakMap},function(t,r,i){"use strict";i(681)},function(t,r,i){"use strict";var o,a=i(297),c=i(11),u=i(9),l=i(195),d=i(196),p=i(684),h=i(685),m=i(18),g=i(58).enforce,y=i(8),v=i(232),b=Object,_=Array.isArray,w=b.isExtensible,S=b.isFrozen,I=b.isSealed,k=b.freeze,x=b.seal,P=!c.ActiveXObject&&"ActiveXObject"in c,wrapper=function(t){return function WeakMap(){return t(this,arguments.length?arguments[0]:void 0)}},C=p("WeakMap",wrapper,h),A=C.prototype,O=u(A.set);if(v)if(P){o=h.getConstructor(wrapper,"WeakMap",!0),d.enable();var R=u(A.delete),M=u(A.has),j=u(A.get);l(A,{delete:function(t){if(m(t)&&!w(t)){var r=g(this);return r.frozen||(r.frozen=new o),R(this,t)||r.frozen.delete(t)}return R(this,t)},has:function has(t){if(m(t)&&!w(t)){var r=g(this);return r.frozen||(r.frozen=new o),M(this,t)||r.frozen.has(t)}return M(this,t)},get:function get(t){if(m(t)&&!w(t)){var r=g(this);return r.frozen||(r.frozen=new o),M(this,t)?j(this,t):r.frozen.get(t)}return j(this,t)},set:function set(t,r){if(m(t)&&!w(t)){var i=g(this);i.frozen||(i.frozen=new o),M(this,t)?O(this,t,r):i.frozen.set(t,r)}else O(this,t,r);return this}})}else a&&y((function(){var t=k([]);return O(new C,t,1),!S(t)}))&&l(A,{set:function set(t,r){var i;return _(t)&&(S(t)?i=k:I(t)&&(i=x)),O(this,t,r),i&&i(t),this}})},function(t,r,i){"use strict";var o=i(8),a=i(18),c=i(43),u=i(683),l=Object.isExtensible,d=o((function(){l(1)}));t.exports=d||u?function isExtensible(t){return!!a(t)&&((!u||"ArrayBuffer"!==c(t))&&(!l||l(t)))}:l},function(t,r,i){"use strict";var o=i(8);t.exports=o((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}}))},function(t,r,i){"use strict";var o=i(1),a=i(11),c=i(196),u=i(8),l=i(47),d=i(70),p=i(140),h=i(12),m=i(18),g=i(78),y=i(49),v=i(32).f,b=i(65).forEach,_=i(13),w=i(58),S=w.set,I=w.getterFor;t.exports=function(t,r,i){var w,k=-1!==t.indexOf("Map"),x=-1!==t.indexOf("Weak"),P=k?"set":"add",C=a[t],A=C&&C.prototype,O={};if(_&&h(C)&&(x||A.forEach&&!u((function(){(new C).entries().next()})))){var R=(w=r((function(r,i){S(p(r,R),{type:t,collection:new C}),g(i)||d(i,r[P],{that:r,AS_ENTRIES:k})}))).prototype,M=I(t);b(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var r="add"===t||"set"===t;!(t in A)||x&&"clear"===t||l(R,t,(function(i,o){var a=M(this).collection;if(!r&&x&&!m(i))return"get"===t&&void 0;var c=a[t](0===i?0:i,o);return r?this:c}))})),x||v(R,"size",{configurable:!0,get:function(){return M(this).collection.size}})}else w=i.getConstructor(r,t,k,P),c.enable();return y(w,t,!1,!0),O[t]=w,o({global:!0,forced:!0},O),x||i.setStrong(w,t,k),w}},function(t,r,i){"use strict";var o=i(9),a=i(195),c=i(196).getWeakData,u=i(140),l=i(33),d=i(78),p=i(18),h=i(70),m=i(65),g=i(21),y=i(58),v=y.set,b=y.getterFor,_=m.find,w=m.findIndex,S=o([].splice),I=0,uncaughtFrozenStore=function(t){return t.frozen||(t.frozen=new UncaughtFrozenStore)},UncaughtFrozenStore=function(){this.entries=[]},findUncaughtFrozen=function(t,r){return _(t.entries,(function(t){return t[0]===r}))};UncaughtFrozenStore.prototype={get:function(t){var r=findUncaughtFrozen(this,t);if(r)return r[1]},has:function(t){return!!findUncaughtFrozen(this,t)},set:function(t,r){var i=findUncaughtFrozen(this,t);i?i[1]=r:this.entries.push([t,r])},delete:function(t){var r=w(this.entries,(function(r){return r[0]===t}));return~r&&S(this.entries,r,1),!!~r}},t.exports={getConstructor:function(t,r,i,o){var m=t((function(t,a){u(t,y),v(t,{type:r,id:I++,frozen:void 0}),d(a)||h(a,t[o],{that:t,AS_ENTRIES:i})})),y=m.prototype,_=b(r),define=function(t,r,i){var o=_(t),a=c(l(r),!0);return!0===a?uncaughtFrozenStore(o).set(r,i):a[o.id]=i,t};return a(y,{delete:function(t){var r=_(this);if(!p(t))return!1;var i=c(t);return!0===i?uncaughtFrozenStore(r).delete(t):i&&g(i,r.id)&&delete i[r.id]},has:function has(t){var r=_(this);if(!p(t))return!1;var i=c(t);return!0===i?uncaughtFrozenStore(r).has(t):i&&g(i,r.id)}}),a(y,i?{get:function get(t){var r=_(this);if(p(t)){var i=c(t);return!0===i?uncaughtFrozenStore(r).get(t):i?i[r.id]:void 0}},set:function set(t,r){return define(this,t,r)}}:{add:function add(t){return define(this,t,!0)}}),m}}},function(t,r,i){"use strict";var o=i(687);i(67),t.exports=o},function(t,r,i){"use strict";i(688),i(692),i(693),i(694);var o=i(15);t.exports=o.URLSearchParams},function(t,r,i){"use strict";i(689)},function(t,r,i){"use strict";i(68);var o=i(1),a=i(11),c=i(272),u=i(20),l=i(9),d=i(13),p=i(690),h=i(48),m=i(171),g=i(195),y=i(49),v=i(246),b=i(58),_=i(140),w=i(12),S=i(21),I=i(63),k=i(64),x=i(33),P=i(18),C=i(40),A=i(82),O=i(55),R=i(185),M=i(109),j=i(176),L=i(270),D=i(10),B=i(691),N=D("iterator"),U=b.set,q=b.getterFor("URLSearchParams"),W=b.getterFor("URLSearchParamsIterator"),z=c("fetch"),V=c("Request"),H=c("Headers"),$=V&&V.prototype,K=H&&H.prototype,G=a.RegExp,J=a.TypeError,Y=a.decodeURIComponent,Q=a.encodeURIComponent,X=l("".charAt),Z=l([].join),ee=l([].push),te=l("".replace),re=l([].shift),ne=l([].splice),ie=l("".split),oe=l("".slice),se=/\+/g,ae=Array(4),percentSequence=function(t){return ae[t-1]||(ae[t-1]=G("((?:%[\\da-f]{2}){"+t+"})","gi"))},percentDecode=function(t){try{return Y(t)}catch(r){return t}},deserialize=function(t){var r=te(t,se," "),i=4;try{return Y(r)}catch(t){for(;i;)r=te(r,percentSequence(i--),percentDecode);return r}},ce=/[!'()~]|%20/g,ue={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(t){return ue[t]},serialize=function(t){return te(Q(t),ce,replacer)},le=v((function Iterator(t,r){U(this,{type:"URLSearchParamsIterator",target:q(t).entries,index:0,kind:r})}),"URLSearchParams",(function next(){var t=W(this),r=t.target,i=t.index++;if(!r||i>=r.length)return t.target=void 0,j(void 0,!0);var o=r[i];switch(t.kind){case"keys":return j(o.key,!1);case"values":return j(o.value,!1)}return j([o.key,o.value],!1)}),!0),URLSearchParamsState=function(t){this.entries=[],this.url=null,void 0!==t&&(P(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===X(t,0)?oe(t,1):t:C(t)))};URLSearchParamsState.prototype={type:"URLSearchParams",bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var r,i,o,a,c,l,d,p=this.entries,h=M(t);if(h)for(i=(r=R(t,h)).next;!(o=u(i,r)).done;){if(c=(a=R(x(o.value))).next,(l=u(c,a)).done||(d=u(c,a)).done||!u(c,a).done)throw new J("Expected sequence with length 2");ee(p,{key:C(l.value),value:C(d.value)})}else for(var m in t)S(t,m)&&ee(p,{key:m,value:C(t[m])})},parseQuery:function(t){if(t)for(var r,i,o=this.entries,a=ie(t,"&"),c=0;c<a.length;)(r=a[c++]).length&&(i=ie(r,"="),ee(o,{key:deserialize(re(i)),value:deserialize(Z(i,"="))}))},serialize:function(){for(var t,r=this.entries,i=[],o=0;o<r.length;)t=r[o++],ee(i,serialize(t.key)+"="+serialize(t.value));return Z(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var fe=function URLSearchParams(){_(this,de);var t=arguments.length>0?arguments[0]:void 0,r=U(this,new URLSearchParamsState(t));d||(this.size=r.entries.length)},de=fe.prototype;if(g(de,{append:function append(t,r){var i=q(this);L(arguments.length,2),ee(i.entries,{key:C(t),value:C(r)}),d||this.length++,i.updateURL()},delete:function(t){for(var r=q(this),i=L(arguments.length,1),o=r.entries,a=C(t),c=i<2?void 0:arguments[1],u=void 0===c?c:C(c),l=0;l<o.length;){var p=o[l];if(p.key!==a||void 0!==u&&p.value!==u)l++;else if(ne(o,l,1),void 0!==u)break}d||(this.size=o.length),r.updateURL()},get:function get(t){var r=q(this).entries;L(arguments.length,1);for(var i=C(t),o=0;o<r.length;o++)if(r[o].key===i)return r[o].value;return null},getAll:function getAll(t){var r=q(this).entries;L(arguments.length,1);for(var i=C(t),o=[],a=0;a<r.length;a++)r[a].key===i&&ee(o,r[a].value);return o},has:function has(t){for(var r=q(this).entries,i=L(arguments.length,1),o=C(t),a=i<2?void 0:arguments[1],c=void 0===a?a:C(a),u=0;u<r.length;){var l=r[u++];if(l.key===o&&(void 0===c||l.value===c))return!0}return!1},set:function set(t,r){var i=q(this);L(arguments.length,1);for(var o,a=i.entries,c=!1,u=C(t),l=C(r),p=0;p<a.length;p++)(o=a[p]).key===u&&(c?ne(a,p--,1):(c=!0,o.value=l));c||ee(a,{key:u,value:l}),d||(this.size=a.length),i.updateURL()},sort:function sort(){var t=q(this);B(t.entries,(function(t,r){return t.key>r.key?1:-1})),t.updateURL()},forEach:function forEach(t){for(var r,i=q(this).entries,o=I(t,arguments.length>1?arguments[1]:void 0),a=0;a<i.length;)o((r=i[a++]).value,r.key,this)},keys:function keys(){return new le(this,"keys")},values:function values(){return new le(this,"values")},entries:function entries(){return new le(this,"entries")}},{enumerable:!0}),h(de,N,de.entries,{name:"entries"}),h(de,"toString",(function toString(){return q(this).serialize()}),{enumerable:!0}),d&&m(de,"size",{get:function size(){return q(this).entries.length},configurable:!0,enumerable:!0}),y(fe,"URLSearchParams"),o({global:!0,constructor:!0,forced:!p},{URLSearchParams:fe}),!p&&w(H)){var pe=l(K.has),he=l(K.set),wrapRequestOptions=function(t){if(P(t)){var r,i=t.body;if("URLSearchParams"===k(i))return r=t.headers?new H(t.headers):new H,pe(r,"content-type")||he(r,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),A(t,{body:O(0,C(i)),headers:O(0,r)})}return t};if(w(z)&&o({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function fetch(t){return z(t,arguments.length>1?wrapRequestOptions(arguments[1]):{})}}),w(V)){var me=function Request(t){return _(this,$),new V(t,arguments.length>1?wrapRequestOptions(arguments[1]):{})};$.constructor=me,me.prototype=$,o({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:me})}}t.exports={URLSearchParams:fe,getState:q}},function(t,r,i){"use strict";var o=i(8),a=i(10),c=i(13),u=i(35),l=a("iterator");t.exports=!o((function(){var t=new URL("b?a=1&b=2&c=3","http://a"),r=t.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),o="";return t.pathname="c%20d",r.forEach((function(t,i){r.delete("b"),o+=i+t})),i.delete("a",2),i.delete("b",void 0),u&&(!t.toJSON||!i.has("a",1)||i.has("a",2)||!i.has("a",void 0)||i.has("b"))||!r.size&&(u||!c)||!r.sort||"http://a/c%20d?a=1&c=3"!==t.href||"3"!==r.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!r[l]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==o||"x"!==new URL("http://x",void 0).host}))},function(t,r,i){"use strict";var o=i(83),a=Math.floor,sort=function(t,r){var i=t.length;if(i<8)for(var c,u,l=1;l<i;){for(u=l,c=t[l];u&&r(t[u-1],c)>0;)t[u]=t[--u];u!==l++&&(t[u]=c)}else for(var d=a(i/2),p=sort(o(t,0,d),r),h=sort(o(t,d),r),m=p.length,g=h.length,y=0,v=0;y<m||v<g;)t[y+v]=y<m&&v<g?r(p[y],h[v])<=0?p[y++]:h[v++]:y<m?p[y++]:h[v++];return t};t.exports=sort},function(t,r){},function(t,r){},function(t,r){},function(t,r,i){"use strict";var o=i(148),a=i(59),c=i(300),u=i(320),l=i(761),d=a(u());o(d,{getPolyfill:u,implementation:c,shim:l}),t.exports=d},function(t,r,i){"use strict";var o;if(!Object.keys){var a=Object.prototype.hasOwnProperty,c=Object.prototype.toString,u=i(299),l=Object.prototype.propertyIsEnumerable,d=!l.call({toString:null},"toString"),p=l.call((function(){}),"prototype"),h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],equalsConstructorPrototype=function(t){var r=t.constructor;return r&&r.prototype===t},m={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},g=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!m["$"+t]&&a.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{equalsConstructorPrototype(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();o=function keys(t){var r=null!==t&&"object"==typeof t,i="[object Function]"===c.call(t),o=u(t),l=r&&"[object String]"===c.call(t),m=[];if(!r&&!i&&!o)throw new TypeError("Object.keys called on a non-object");var y=p&&i;if(l&&t.length>0&&!a.call(t,0))for(var v=0;v<t.length;++v)m.push(String(v));if(o&&t.length>0)for(var b=0;b<t.length;++b)m.push(String(b));else for(var _ in t)y&&"prototype"===_||!a.call(t,_)||m.push(String(_));if(d)for(var w=function(t){if("undefined"==typeof window||!g)return equalsConstructorPrototype(t);try{return equalsConstructorPrototype(t)}catch(t){return!1}}(t),S=0;S<h.length;++S)w&&"constructor"===h[S]||!a.call(t,h[S])||m.push(h[S]);return m}}t.exports=o},function(t,r,i){"use strict";var o=i(3),a=i(255),c=i(149),u=i(72);t.exports=function Get(t,r){if("Object"!==u(t))throw new o("Assertion failed: Type(O) is not Object");if(!c(r))throw new o("Assertion failed: IsPropertyKey(P) is not true, got "+a(r));return t[r]}},function(t,r,i){"use strict";t.exports=function Type(t){return null===t?"Null":void 0===t?"Undefined":"function"==typeof t||"object"==typeof t?"Object":"number"==typeof t?"Number":"boolean"==typeof t?"Boolean":"string"==typeof t?"String":void 0}},function(t,r,i){"use strict";var o=i(6),a=i(41),c=i(3),u=o("%Uint8Array%",!0),l=i(24)("Array.prototype.slice"),d=i(150),p=i(91),h=i(700),m=i(92),g=i(115),y=i(707),v=i(151),b=i(305);t.exports=function GetValueFromBuffer(t,r,i,o,_){var w=g(t);if(!m(t)&&!w)throw new c("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if(!d(r))throw new c("Assertion failed: `byteIndex` must be an integer");if("string"!=typeof i||"number"!=typeof v.size["$"+i])throw new c("Assertion failed: `type` must be a Typed Array element type");if("boolean"!=typeof o)throw new c("Assertion failed: `isTypedArray` must be a boolean");if("SEQ-CST"!==_&&"UNORDERED"!==_)throw new c("Assertion failed: `order` must be either `SEQ-CST` or `UNORDERED`");if(arguments.length>5&&"boolean"!=typeof arguments[5])throw new c("Assertion failed: `isLittleEndian` must be a boolean, if present");if(p(t))throw new c("Assertion failed: `arrayBuffer` is detached");if(r<0)throw new c("Assertion failed: `byteIndex` must be non-negative");var S,I=v.size["$"+i];if(!I)throw new c('Assertion failed: `type` must be one of "INT8", "UINT8", "UINT8C", "INT16", "UINT16", "INT32", "UINT32", "BIGINT64", "BIGUINT64", "FLOAT32", or "FLOAT64"');if(w)throw new a("SharedArrayBuffer is not supported by this implementation");S=l(new u(t,r),0,I);var k=arguments.length>5?arguments[5]:"little"===b,x=k?l(y([0,0,0,0,0,0,0,0],S),-I):l(y(S,[0,0,0,0,0,0,0,0]),0,I);return h(i,x,k)}},function(t,r,i){"use strict";var o=i(6),a=i(24),c=i(177),u=i(41),l=i(3),d=o("%BigInt%",!0),p=i(302),h=i(201),m=i(304),g=i(701),y=i(702),v=i(703),b=i(704),_=i(705),w=i(706),S=a("Array.prototype.reverse"),I=a("Array.prototype.slice"),k=i(200),x={__proto__:null,INT8:1,UINT8:1,UINT8C:1,INT16:2,UINT16:2,INT32:4,UINT32:4,BIGINT64:8,BIGUINT64:8,FLOAT32:4,FLOAT64:8};t.exports=function RawBytesToNumeric(t,r,i){if(!p(x,t))throw new l("Assertion failed: `type` must be a TypedArray element type: "+k(x));if(!h(r)||!_(r,w))throw new l("Assertion failed: `rawBytes` must be an Array of bytes");if("boolean"!=typeof i)throw new l("Assertion failed: `isLittleEndian` must be a Boolean");var o=x[t];if(r.length!==o)throw new c("Assertion failed: `rawBytes` must have a length of "+o+" for type "+t);var a=m(t);if(a&&!d)throw new u("this environment does not support BigInts");return r=I(r,0,o),i||S(r),"FLOAT32"===t?y(r):"FLOAT64"===t?v(r):b(r,o,g(t),a)}},function(t,r,i){"use strict";t.exports=function IsUnsignedElementType(t){return"UINT8"===t||"UINT8C"===t||"UINT16"===t||"UINT32"===t||"BIGUINT64"===t}},function(t,r,i){"use strict";var o=i(6)("%Math.pow%");t.exports=function bytesAsFloat32(t){var r=128&t[3]?-1:1,i=(127&t[3])<<1|t[2]>>7,a=(127&t[2])<<16|t[1]<<8|t[0];return 0===i&&0===a?1===r?0:-0:255===i&&0===a?1===r?1/0:-1/0:255===i&&0!==a?NaN:-127===(i-=127)?r*a*o(2,-149):r*(1+a*o(2,-23))*o(2,i)}},function(t,r,i){"use strict";var o=i(6)("%Math.pow%");t.exports=function bytesAsFloat64(t){var r=128&t[7]?-1:1,i=(127&t[7])<<4|(240&t[6])>>4,a=281474976710656*(15&t[6])+1099511627776*t[5]+4294967296*t[4]+16777216*t[3]+65536*t[2]+256*t[1]+t[0];return 0===i&&0===a?0*r:2047===i&&0!==a?NaN:2047===i&&0===a?r*(1/0):-1023===(i-=1023)?r*a*5e-324:r*(1+a/4503599627370496)*o(2,i)}},function(t,r,i){"use strict";var o=i(6),a=o("%Math.pow%"),c=o("%Number%"),u=o("%BigInt%",!0);t.exports=function bytesAsInteger(t,r,i,o){for(var l=o?u:c,d=l(0),p=0;p<t.length;p++)d+=l(t[p]*a(2,8*p));if(!i){var h=8*r;128&t[r-1]&&(d-=l(a(2,h)))}return d}},function(t,r,i){"use strict";t.exports=function every(t,r){for(var i=0;i<t.length;i+=1)if(!r(t[i],i,t))return!1;return!0}},function(t,r,i){"use strict";t.exports=function isByteValue(t){return"number"==typeof t&&t>=0&&t<=255&&(0|t)===t}},function(t,r,i){"use strict";var o=i(6)("%Array.prototype.concat%"),a=i(59),c=i(24)("Array.prototype.slice"),u=i(178)()&&Symbol.isConcatSpreadable,l=[],d=u?a.apply(o,l):null,p=u?i(708):null;t.exports=u?function safeArrayConcat(t){for(var r=0;r<arguments.length;r+=1){var i=arguments[r];if(i&&"object"==typeof i&&"boolean"==typeof i[u]){l[u]||(l[u]=!0);var o=p(i)?c(i):[i];o[u]=!0,arguments[r]=o}}return d(arguments)}:a(o,l)},function(t,r){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,r,i){"use strict";var o=i(6);t.exports=o("%Math.max%")},function(t,r,i){"use strict";var o=i(6);t.exports=o("%Math.min%")},function(t,r,i){"use strict";var o=i(3),a=i(149),c=i(306),u=i(72),l=function(){try{return delete[].length,!0}catch(t){return!1}}();t.exports=function Set(t,r,i,d){if("Object"!==u(t))throw new o("Assertion failed: `O` must be an Object");if(!a(r))throw new o("Assertion failed: `P` must be a Property Key");if("boolean"!=typeof d)throw new o("Assertion failed: `Throw` must be a Boolean");if(d){if(t[r]=i,l&&!c(t[r],i))throw new o("Attempted to assign to readonly property.");return!0}try{return t[r]=i,!l||c(t[r],i)}catch(t){return!1}}},function(t,r,i){"use strict";var o=i(6),a=i(41),c=i(3),u=o("%Uint8Array%",!0),l=i(150),d=i(304),p=i(91),h=i(713),m=i(92),g=i(115),y=i(69),v=i(151),b=i(305),_=i(741);t.exports=function SetValueInBuffer(t,r,i,o,w,S){var I=g(t);if(!m(t)&&!I)throw new c("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if(!l(r)||r<0)throw new c("Assertion failed: `byteIndex` must be a non-negative integer");if("string"!=typeof i||!y(v.size,"$"+i))throw new c("Assertion failed: `type` must be a Typed Array Element Type");if("number"!=typeof o&&"bigint"!=typeof o)throw new c("Assertion failed: `value` must be a Number or a BigInt");if("boolean"!=typeof w)throw new c("Assertion failed: `isTypedArray` must be a boolean");if("SEQ-CST"!==S&&"UNORDERED"!==S&&"INIT"!==S)throw new c('Assertion failed: `order` must be `"SEQ-CST"`, `"UNORDERED"`, or `"INIT"`');if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new c("Assertion failed: `isLittleEndian` must be a boolean, if present");if(p(t))throw new c("Assertion failed: ArrayBuffer is detached");if(d(i)?"bigint"!=typeof o:"number"!=typeof o)throw new c("Assertion failed: `value` must be a BigInt if type is ~BIGINT64~ or ~BIGUINT64~, otherwise a Number");var k=v.size["$"+i],x=arguments.length>6?arguments[6]:"little"===b,P=h(i,o,x);if(I)throw new a("SharedArrayBuffer is not supported by this implementation");var C=new u(t,r,k);_(P,(function(t,r){C[r]=t}))}},function(t,r,i){"use strict";var o=i(3),a=i(302),c=i(714),u=i(720),l=i(721),d=i(729),p=i(730),h=i(731),m=i(732),g=i(733),y=i(734),v=i(736),b=i(737),_=i(740),w=i(200),S={__proto__:null,INT8:1,UINT8:1,UINT8C:1,INT16:2,UINT16:2,INT32:4,UINT32:4,BIGINT64:8,BIGUINT64:8,FLOAT32:4,FLOAT64:8},I={__proto__:null,INT8:p,UINT8:g,UINT8C:y,INT16:l,UINT16:h,INT32:d,UINT32:m,BIGINT64:c,BIGUINT64:u};t.exports=function NumericToRawBytes(t,r,i){if("string"!=typeof t||!a(S,t))throw new o("Assertion failed: `type` must be a TypedArray element type: "+w(S));if("number"!=typeof r&&"bigint"!=typeof r)throw new o("Assertion failed: `value` must be a Number or a BigInt");if("boolean"!=typeof i)throw new o("Assertion failed: `isLittleEndian` must be a Boolean");if("FLOAT32"===t)return v(r,i);if("FLOAT64"===t)return b(r,i);var c=S[t],u=(0,I[t])(r);return _(u,c,i)}},function(t,r,i){"use strict";var o=i(6),a=o("%BigInt%",!0),c=o("%Math.pow%"),u=i(307),l=i(309),d=i(310),p=a&&BigInt(c(2,32))*BigInt(c(2,31)),h=a&&BigInt(c(2,32))*BigInt(c(2,32));t.exports=function ToBigInt64(t){var r=u(t),i=d(l,r,h);return i>=p?i-h:i}},function(t,r,i){"use strict";var o=i(6)("%BigInt%",!0),a=i(3),c=i(41);t.exports=function StringToBigInt(t){if("string"!=typeof t)throw new a("`argument` must be a string");if(!o)throw new c("BigInts are not supported in this environment");try{return o(t)}catch(t){return}}},function(t,r,i){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,a=i(717),c=i(198),u=i(718),l=i(719),d=function OrdinaryToPrimitive(t,r){if(null==t)throw new TypeError("Cannot call method on "+t);if("string"!=typeof r||"number"!==r&&"string"!==r)throw new TypeError('hint must be "string" or "number"');var i,o,u,l="string"===r?["toString","valueOf"]:["valueOf","toString"];for(u=0;u<l.length;++u)if(i=t[l[u]],c(i)&&(o=i.call(t),a(o)))return o;throw new TypeError("No default value")},p=function GetMethod(t,r){var i=t[r];if(null!=i){if(!c(i))throw new TypeError(i+" returned for property "+r+" of object "+t+" is not a function");return i}};t.exports=function ToPrimitive(t){if(a(t))return t;var r,i="default";if(arguments.length>1&&(arguments[1]===String?i="string":arguments[1]===Number&&(i="number")),o&&(Symbol.toPrimitive?r=p(t,Symbol.toPrimitive):l(t)&&(r=Symbol.prototype.valueOf)),void 0!==r){var c=r.call(t,i);if(a(c))return c;throw new TypeError("unable to convert exotic object to primitive")}return"default"===i&&(u(t)||l(t))&&(i="string"),d(t,"default"===i?"number":i)}},function(t,r,i){"use strict";t.exports=function isPrimitive(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},function(t,r,i){"use strict";var o=Date.prototype.getDay,a=Object.prototype.toString,c=i(199)();t.exports=function isDateObject(t){return"object"==typeof t&&null!==t&&(c?function tryDateGetDayCall(t){try{return o.call(t),!0}catch(t){return!1}}(t):"[object Date]"===a.call(t))}},function(t,r,i){"use strict";var o=Object.prototype.toString;if(i(253)()){var a=Symbol.prototype.toString,c=/^Symbol\(.*\)$/;t.exports=function isSymbol(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==o.call(t))return!1;try{return function isRealSymbolObject(t){return"symbol"==typeof t.valueOf()&&c.test(a.call(t))}(t)}catch(t){return!1}}}else t.exports=function isSymbol(t){return!1}},function(t,r,i){"use strict";var o=i(6),a=o("%BigInt%",!0),c=o("%Math.pow%"),u=i(307),l=i(309),d=i(310),p=a&&BigInt(c(2,32))*BigInt(c(2,32));t.exports=function ToBigUint64(t){var r=u(t);return d(l,r,p)}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToInt16(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,65536);return l>=32768?l-65536:l}},function(t,r,i){"use strict";var o=Math.floor;t.exports=function mod(t,r){var i=t%r;return o(i>=0?i:i+r)}},function(t,r,i){"use strict";t.exports=function isPrimitive(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},function(t,r,i){"use strict";var o=i(6),a=o("%Number%"),c=o("%RegExp%"),u=i(3),l=o("%parseInt%"),d=i(24),p=i(725),h=d("String.prototype.slice"),m=p(/^0b[01]+$/i),g=p(/^0o[0-7]+$/i),y=p(/^[-+]0x[0-9a-f]+$/i),v=p(new c("["+["
","",""].join("")+"]","g")),b=i(727);t.exports=function StringToNumber(t){if("string"!=typeof t)throw new u("Assertion failed: `argument` is not a String");if(m(t))return a(l(h(t,2),2));if(g(t))return a(l(h(t,2),8));if(v(t)||y(t))return NaN;var r=b(t);return r!==t?StringToNumber(r):a(t)}},function(t,r,i){"use strict";var o=i(24),a=i(726),c=o("RegExp.prototype.exec"),u=i(3);t.exports=function regexTester(t){if(!a(t))throw new u("`regex` must be a RegExp");return function test(r){return null!==c(t,r)}}},function(t,r,i){"use strict";var o,a,c,u,l=i(24),d=i(199)();if(d){o=l("Object.prototype.hasOwnProperty"),a=l("RegExp.prototype.exec"),c={};var throwRegexMarker=function(){throw c};u={toString:throwRegexMarker,valueOf:throwRegexMarker},"symbol"==typeof Symbol.toPrimitive&&(u[Symbol.toPrimitive]=throwRegexMarker)}var p=l("Object.prototype.toString"),h=Object.getOwnPropertyDescriptor;t.exports=d?function isRegex(t){if(!t||"object"!=typeof t)return!1;var r=h(t,"lastIndex");if(!(r&&o(r,"value")))return!1;try{a(t,u)}catch(t){return t===c}}:function isRegex(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===p(t)}},function(t,r,i){"use strict";var o=i(59),a=i(148),c=i(311),u=i(312),l=i(314),d=i(728),p=o(l()),h=function trim(t){return c(t),p(t)};a(h,{getPolyfill:l,implementation:u,shim:d}),t.exports=h},function(t,r,i){"use strict";var o=i(148),a=i(314);t.exports=function shimStringTrim(){var t=a();return o(String.prototype,{trim:t},{trim:function testTrim(){return String.prototype.trim!==t}}),t}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToInt32(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,4294967296),d=l>=2147483648?l-4294967296:l;return 0===d?0:d}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToInt8(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,256);return l>=128?l-256:l}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToUint16(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,65536);return 0===l?0:l}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToUint32(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,4294967296);return 0===l?0:l}},function(t,r,i){"use strict";var o=i(51),a=i(94),c=i(60),u=i(73);t.exports=function ToUint8(t){var r=c(t);if(!o(r)||0===r)return 0;var i=u(r);return a(i,256)}},function(t,r,i){"use strict";var o=i(735),a=i(60),c=i(202),u=i(90);t.exports=function ToUint8Clamp(t){var r=a(t);if(u(r))return 0;var i=o(r,0,255),l=c(i);return i<l+.5?l:i>l+.5?l+1:l%2==0?l:l+1}},function(t,r,i){"use strict";var o=i(6),a=i(3),c=o("%Math.max%"),u=o("%Math.min%");t.exports=function clamp(t,r,i){if("number"!=typeof t||"number"!=typeof r||"number"!=typeof i||!(r<=i))throw new a("Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`");return u(c(r,t),i)}},function(t,r,i){"use strict";var o=i(6),a=o("%Math.abs%"),c=o("%Math.floor%"),u=o("%Math.pow%"),l=i(51),d=i(90),p=i(315);t.exports=function valueToFloat32Bytes(t,r){if(d(t))return r?[0,0,192,127]:[127,192,0,0];var i;if(0===t)return i=p(t)?128:0,r?[0,0,0,i]:[i,0,0,0];if(a(t)>34028234663852886e22||!l(t))return i=t<0?255:127,r?[0,0,128,i]:[i,128,0,0];var o=t<0?1:0;t=a(t);for(var h=0;t>=2;)h+=1,t/=2;for(;t<1;)h-=1,t*=2;var m=t-1;m*=u(2,23)+.5,h+=127;var g=o<<31|(h<<=23)|(m=c(m)),y=255&g,v=255&(g>>=8),b=255&(g>>=8),_=255&(g>>=8);return r?[y,v,b,_]:[_,b,v,y]}},function(t,r,i){"use strict";var o=i(6),a=o("%parseInt%"),c=o("%Math.abs%"),u=o("%Math.floor%"),l=i(24),d=l("String.prototype.indexOf"),p=l("String.prototype.slice"),h=i(738),m=i(739),g=i(315),y="000000000000000000000000000000000000000000000000000";t.exports=function valueToFloat64Bytes(t,r){var i,o,l=t<0||g(t)?"1":"0";if(isNaN(t))i="11111111111",o="1"+y;else if(isFinite(t))if(0===t)i="00000000000",o="0"+y;else{t=c(t);var v,b=u(t),_=m(b),w=h(t-b);if(_)i=_.length-1;else{var S=d(w,"1");S>-1&&(v=S+1),i=-v}o=_+w,i<0?(i<=-1023&&(v=1022),o=p(o,v)):o=p(o,1),i=p("00000000000"+m(i+1023),-11),o=p(o+y+"0",0,52)}else i="11111111111",o="0"+y;for(var I=l+i+o,k=[],x=0;x<8;x++){k[r?8-x-1:x]=a(p(I,8*x,8*(x+1)),2)}return k}},function(t,r,i){"use strict";t.exports=function fractionToBitString(t){var r="";if(0===t)return r;for(var i,o=1075,a=0;a<1075;a+=1)if((i=2*t)>=1?(t=i-1,r+="1",1075===o&&(o=a)):(t=i,r+="0"),1===i||a-o>54)return r;return r}},function(t,r,i){"use strict";var o=i(6)("%Math.floor%");t.exports=function intToBinaryString(t){for(var r,i="";t>0;)i=(r=t/2)===(t=o(r))?"0"+i:"1"+i;return i}},function(t,r,i){"use strict";var o=i(6),a=o("%Number%"),c=o("%BigInt%",!0);t.exports=function integerToNBytes(t,r,i){var o="bigint"==typeof t?c:a;t<0&&(t>>>=0);for(var u=[],l=0;l<r;l++)u[i?l:r-1-l]=a(t&o(255)),t>>=o(8);return u}},function(t,r,i){"use strict";t.exports=function forEach(t,r){for(var i=0;i<t.length;i+=1)r(t[i],i,t)}},function(t,r,i){"use strict";var o=i(60),a=i(73),c=i(90),u=i(51);t.exports=function ToIntegerOrInfinity(t){var r=o(t);return c(r)||0===r?0:u(r)?a(r):r}},function(t,r,i){"use strict";var o=i(41),a=i(3),c=i(113),u=i(151);t.exports=function TypedArrayElementType(t){var r=c(t);if(!1===r)throw new a("Assertion failed: `O` must be a TypedArray");var i=u.name["$"+r];if("string"!=typeof i)throw new o("Assertion failed: Unknown TypedArray type `"+r+"`");return i}},function(t,r,i){"use strict";var o=i(41),a=i(3),c=i(113),u=i(114)(),l=i(201),d=i(745),p=i(755),h=i(760);t.exports=function TypedArraySpeciesCreate(t,r){if(0===u.length)throw new o("Assertion failed: Typed Arrays are not supported in this environment");var i=c(t);if(!i)throw new a("Assertion failed: exemplar must be a TypedArray");if(!l(r))throw new a("Assertion failed: `argumentList` must be a List");var m=h(i);if("function"!=typeof m)throw new o("Assertion failed: `constructor` of `exemplar` ("+i+") must exist. Please report this!");var g=d(t,m);return p(g,r)}},function(t,r,i){"use strict";var o=i(6)("%Symbol.species%",!0),a=i(3),c=i(316),u=i(72);t.exports=function SpeciesConstructor(t,r){if("Object"!==u(t))throw new a("Assertion failed: Type(O) is not Object");var i=t.constructor;if(void 0===i)return r;if("Object"!==u(i))throw new a("O.constructor is not an Object");var l=o?i[o]:void 0;if(null==l)return r;if(c(l))return l;throw new a("no constructor found")}},function(t,r,i){"use strict";t.exports=i(6)},function(t,r,i){"use strict";var o=i(3),a=i(204),c=i(748),u=i(749),l=i(751),d=i(149),p=i(306),h=i(752),m=i(72);t.exports=function DefinePropertyOrThrow(t,r,i){if("Object"!==m(t))throw new o("Assertion failed: Type(O) is not Object");if(!d(r))throw new o("Assertion failed: IsPropertyKey(P) is not true");var g=a(i)?i:h(i);if(!a(g))throw new o("Assertion failed: Desc is not a valid Property Descriptor");return c(l,p,u,t,r,g)}},function(t,r,i){"use strict";var o=i(180),a=i(138),c=o.hasArrayLengthDefineBug(),u=c&&i(303),l=i(24)("Object.prototype.propertyIsEnumerable");t.exports=function DefineOwnProperty(t,r,i,o,d,p){if(!a){if(!t(p))return!1;if(!p["[[Configurable]]"]||!p["[[Writable]]"])return!1;if(d in o&&l(o,d)!==!!p["[[Enumerable]]"])return!1;var h=p["[[Value]]"];return o[d]=h,r(o[d],h)}return c&&"length"===d&&"[[Value]]"in p&&u(o)&&o.length!==p["[[Value]]"]?(o.length=p["[[Value]]"],o.length===p["[[Value]]"]):(a(o,d,i(p)),!0)}},function(t,r,i){"use strict";var o=i(3),a=i(204),c=i(750);t.exports=function FromPropertyDescriptor(t){if(void 0!==t&&!a(t))throw new o("Assertion failed: `Desc` must be a Property Descriptor");return c(t)}},function(t,r,i){"use strict";t.exports=function fromPropertyDescriptor(t){if(void 0===t)return t;var r={};return"[[Value]]"in t&&(r.value=t["[[Value]]"]),"[[Writable]]"in t&&(r.writable=!!t["[[Writable]]"]),"[[Get]]"in t&&(r.get=t["[[Get]]"]),"[[Set]]"in t&&(r.set=t["[[Set]]"]),"[[Enumerable]]"in t&&(r.enumerable=!!t["[[Enumerable]]"]),"[[Configurable]]"in t&&(r.configurable=!!t["[[Configurable]]"]),r}},function(t,r,i){"use strict";var o=i(3),a=i(69),c=i(204);t.exports=function IsDataDescriptor(t){if(void 0===t)return!1;if(!c(t))throw new o("Assertion failed: `Desc` must be a Property Descriptor");return!(!a(t,"[[Value]]")&&!a(t,"[[Writable]]"))}},function(t,r,i){"use strict";var o=i(69),a=i(3),c=i(72),u=i(753),l=i(754);t.exports=function ToPropertyDescriptor(t){if("Object"!==c(t))throw new a("ToPropertyDescriptor requires an object");var r={};if(o(t,"enumerable")&&(r["[[Enumerable]]"]=u(t.enumerable)),o(t,"configurable")&&(r["[[Configurable]]"]=u(t.configurable)),o(t,"value")&&(r["[[Value]]"]=t.value),o(t,"writable")&&(r["[[Writable]]"]=u(t.writable)),o(t,"get")){var i=t.get;if(void 0!==i&&!l(i))throw new a("getter must be a function");r["[[Get]]"]=i}if(o(t,"set")){var d=t.set;if(void 0!==d&&!l(d))throw new a("setter must be a function");r["[[Set]]"]=d}if((o(r,"[[Get]]")||o(r,"[[Set]]"))&&(o(r,"[[Value]]")||o(r,"[[Writable]]")))throw new a("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return r}},function(t,r,i){"use strict";t.exports=function ToBoolean(t){return!!t}},function(t,r,i){"use strict";t.exports=i(198)},function(t,r,i){"use strict";var o=i(41),a=i(3),c=i(201),u=i(316),l=i(205),d=i(756),p=i(319),h=i(114)();t.exports=function TypedArrayCreateFromConstructor(t,r){if(!u(t))throw new a("Assertion failed: `constructor` must be a constructor");if(!c(r))throw new a("Assertion failed: `argumentList` must be a List");if(0===h.length)throw new o("Assertion failed: Typed Arrays are not supported in this environment");var i;i=0===r.length?new t:1===r.length?new t(r[0]):2===r.length?new t(r[0],r[1]):new t(r[0],r[1],r[2]);var m=p(i,"SEQ-CST");if(1===r.length&&"number"==typeof r[0]){if(l(m))throw new a("new Typed Array is out of bounds");if(d(m)<r[0])throw new a("`argumentList[0]` must be <= `newTypedArray.length`")}return i}},function(t,r,i){"use strict";var o=i(3),a=i(202),c=i(757),u=i(205),l=i(203),d=i(317),p=i(116),h=i(206),m=i(318);t.exports=function TypedArrayLength(t){if(!d(t))throw new o("Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record");if(u(t))throw new o("Assertion failed: `taRecord` is out of bounds");var r=t["[[Object]]"],i=m(r);if("AUTO"!==i)return i;if(c(p(r)))throw new o("Assertion failed: array buffer is not fixed length");var g=h(r),y=l(r),v=t["[[CachedBufferByteLength]]"];if("DETACHED"===v)throw new o("Assertion failed: typed array is detached");return a((v-g)/y)}},function(t,r,i){"use strict";var o=i(3),a=i(24),c=a("%ArrayBuffer.prototype.resizable%",!0),u=a("%SharedArrayBuffer.prototype.growable%",!0),l=i(92),d=i(115);t.exports=function IsFixedLengthArrayBuffer(t){var r=l(t),i=d(t);if(!r&&!i)throw new o("Assertion failed: `arrayBuffer` must be an ArrayBuffer or SharedArrayBuffer");return r&&c?!c(t):!i||!u||!u(t)}},function(t,r,i){"use strict";var o=i(3),a=i(759),c=i(91),u=i(93),l=i(116);t.exports=function MakeTypedArrayWithBufferWitnessRecord(t,r){if(!u(t))throw new o("Assertion failed: `obj` must be a Typed Array");if("SEQ-CST"!==r&&"UNORDERED"!==r)throw new o("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");var i=l(t);return{"[[Object]]":t,"[[CachedBufferByteLength]]":c(i)?"DETACHED":a(i,r)}}},function(t,r,i){"use strict";var o=i(3),a=i(91),c=i(92),u=i(115),l=i(301);t.exports=function ArrayBufferByteLength(t,r){var i=u(t);if(!c(t)&&!i)throw new o("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if("SEQ-CST"!==r&&"UNORDERED"!==r)throw new o("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");if(a(t))throw new o("Assertion failed: `arrayBuffer` must not be detached");return l(t)}},function(t,r,i){"use strict";var o=i(6),a={__proto__:null,$Int8Array:o("%Int8Array%",!0),$Uint8Array:o("%Uint8Array%",!0),$Uint8ClampedArray:o("%Uint8ClampedArray%",!0),$Int16Array:o("%Int16Array%",!0),$Uint16Array:o("%Uint16Array%",!0),$Int32Array:o("%Int32Array%",!0),$Uint32Array:o("%Uint32Array%",!0),$BigInt64Array:o("%BigInt64Array%",!0),$BigUint64Array:o("%BigUint64Array%",!0),$Float32Array:o("%Float32Array%",!0),$Float64Array:o("%Float64Array%",!0)};t.exports=function getConstructor(t){return a["$"+t]}},function(t,r,i){"use strict";var o=i(148),a=i(762),c=i(320);t.exports=function shimTypedArraySlice(){if("function"==typeof Uint8Array){var t=c(),r=a(Uint8Array.prototype);o(r,{slice:t},{slice:function(){return r.slice!==t}})}return t}},function(t,r,i){"use strict";var o=i(6)("%Object.getPrototypeOf%",!0),a=i(137)();t.exports=o||(a?function(t){return t.__proto__}:null)},function(t,r,i){var o=i(764),a=i(772);t.exports=function baseGet(t,r){for(var i=0,c=(r=o(r,t)).length;null!=t&&i<c;)t=t[a(r[i++])];return i&&i==c?t:void 0}},function(t,r,i){var o=i(89),a=i(765),c=i(766),u=i(769);t.exports=function castPath(t,r){return o(t)?t:a(t,r)?[t]:c(u(t))}},function(t,r,i){var o=i(89),a=i(207),c=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;t.exports=function isKey(t,r){if(o(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!a(t))||(u.test(t)||!c.test(t)||null!=r&&t in Object(r))}},function(t,r,i){var o=i(767),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c=/\\(\\)?/g,u=o((function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(a,(function(t,i,o,a){r.push(o?a.replace(c,"$1"):i||t)})),r}));t.exports=u},function(t,r,i){var o=i(768);t.exports=function memoizeCapped(t){var r=o(t,(function(t){return 500===i.size&&i.clear(),t})),i=r.cache;return r}},function(t,r,i){var o=i(284);function memoize(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var memoized=function(){var i=arguments,o=r?r.apply(this,i):i[0],a=memoized.cache;if(a.has(o))return a.get(o);var c=t.apply(this,i);return memoized.cache=a.set(o,c)||a,c};return memoized.cache=new(memoize.Cache||o),memoized}memoize.Cache=o,t.exports=memoize},function(t,r,i){var o=i(770);t.exports=function toString(t){return null==t?"":o(t)}},function(t,r,i){var o=i(144),a=i(771),c=i(89),u=i(207),l=o?o.prototype:void 0,d=l?l.toString:void 0;t.exports=function baseToString(t){if("string"==typeof t)return t;if(c(t))return a(t,baseToString)+"";if(u(t))return d?d.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},function(t,r){t.exports=function arrayMap(t,r){for(var i=-1,o=null==t?0:t.length,a=Array(o);++i<o;)a[i]=r(t[i],i,t);return a}},function(t,r,i){var o=i(207);t.exports=function toKey(t){if("string"==typeof t||o(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},function(t,r,i){"use strict";var o=i(774);t.exports=o},function(t,r,i){"use strict";var o=i(775);t.exports=o},function(t,r,i){"use strict";var o=i(776);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(777),c=Array.prototype;t.exports=function(t){var r=t.indexOf;return t===c||o(c,t)&&r===c.indexOf?a:r}},function(t,r,i){"use strict";i(778);var o=i(29);t.exports=o("Array","indexOf")},function(t,r,i){"use strict";var o=i(1),a=i(122),c=i(165).indexOf,u=i(239),l=a([].indexOf),d=!!l&&1/l([1],1,-0)<0;o({target:"Array",proto:!0,forced:d||!u("indexOf")},{indexOf:function indexOf(t){var r=arguments.length>1?arguments[1]:void 0;return d?l(this,t,r)||0:c(this,t,r)}})},function(t,r,i){var o=i(321);t.exports=function _objectWithoutPropertiesLoose(t,r){if(null==t)return{};var i={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(o(r).call(r,a)>=0)continue;i[a]=t[a]}return i},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r){t.exports=function isBuffer(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,r){"function"==typeof Object.create?t.exports=function inherits(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function inherits(t,r){t.super_=r;var TempCtor=function(){};TempCtor.prototype=r.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}},function(t,r,i){"use strict";(function(r){var o=i(783),a=i(322),c=i(34),u=i(210),l=i(75)("mqttjs"),d={};function connect(t,r){if(l("connecting to an MQTT broker..."),"object"!=typeof t||r||(r=t,t=null),r=r||{},t){var i=c.parse(t,!0);if(null!=i.port&&(i.port=Number(i.port)),null===(r=u(i,r)).protocol)throw new Error("Missing protocol");r.protocol=r.protocol.replace(/:$/,"")}if(function parseAuthOptions(t){var r;t.auth&&((r=t.auth.match(/^(.+):(.+)$/))?(t.username=r[1],t.password=r[2]):t.username=t.auth)}(r),r.query&&"string"==typeof r.query.clientId&&(r.clientId=r.query.clientId),r.cert&&r.key){if(!r.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(r.protocol))switch(r.protocol){case"mqtt":r.protocol="mqtts";break;case"ws":r.protocol="wss";break;case"wx":r.protocol="wxs";break;case"ali":r.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+r.protocol+'"!')}}if(!d[r.protocol]){var a=-1!==["mqtts","wss"].indexOf(r.protocol);r.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(t,r){return(!a||r%2!=0)&&"function"==typeof d[t]}))[0]}if(!1===r.clean&&!r.clientId)throw new Error("Missing clientId for unclean clients");r.protocol&&(r.defaultProtocol=r.protocol);var p=new o((function wrapper(t){return r.servers&&(t._reconnectCount&&t._reconnectCount!==r.servers.length||(t._reconnectCount=0),r.host=r.servers[t._reconnectCount].host,r.port=r.servers[t._reconnectCount].port,r.protocol=r.servers[t._reconnectCount].protocol?r.servers[t._reconnectCount].protocol:r.defaultProtocol,r.hostname=r.host,t._reconnectCount++),l("calling streambuilder for",r.protocol),d[r.protocol](t,r)}),r);return p.on("error",(function(){})),p}void 0!==r&&"browser"!==r.title||"function"!=typeof i?(d.mqtt=i(332),d.tcp=i(332),d.ssl=i(212),d.tls=i(212),d.mqtts=i(212)):(d.wx=i(333),d.wxs=i(333),d.ali=i(336),d.alis=i(336)),d.ws=i(337),d.wss=i(337),t.exports=connect,t.exports.connect=connect,t.exports.MqttClient=o,t.exports.Store=a}).call(this,i(19))},function(t,r,i){"use strict";(function(r,o){var a=i(45).EventEmitter,c=i(322),u=i(792),l=i(74).Writable,d=i(30),p=i(801),h=i(802),m=i(210),g=i(75)("mqttjs:client"),y=r?r.nextTick:function(t){setTimeout(t,0)},v=o.setImmediate||function(t){y(t)},b={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},_=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],w={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function sendPacket(t,r,i){g("sendPacket :: packet: %O",r),g("sendPacket :: emitting `packetsend`"),t.emit("packetsend",r),g("sendPacket :: writing to stream");var o=u.writeToStream(r,t.stream,t.options);g("sendPacket :: writeToStream result %s",o),!o&&i?(g("sendPacket :: handle events on `drain` once through callback."),t.stream.once("drain",i)):i&&(g("sendPacket :: invoking cb"),i())}function flush(t){t&&(g("flush: queue exists? %b",!!t),Object.keys(t).forEach((function(r){"function"==typeof t[r].cb&&(t[r].cb(new Error("Connection closed")),delete t[r])})))}function storeAndSend(t,r,i,o){g("storeAndSend :: store packet with cmd %s to outgoingStore",r.cmd),t.outgoingStore.put(r,(function storedPacket(a){if(a)return i&&i(a);o(),sendPacket(t,r,i)}))}function nop(t){g("nop ::",t)}function MqttClient(t,r){var i,o=this;if(!(this instanceof MqttClient))return new MqttClient(t,r);for(i in this.options=r||{},b)void 0===this.options[i]?this.options[i]=b[i]:this.options[i]=r[i];g("MqttClient :: options.protocol",r.protocol),g("MqttClient :: options.protocolVersion",r.protocolVersion),g("MqttClient :: options.username",r.username),g("MqttClient :: options.keepalive",r.keepalive),g("MqttClient :: options.reconnectPeriod",r.reconnectPeriod),g("MqttClient :: options.rejectUnauthorized",r.rejectUnauthorized),this.options.clientId="string"==typeof r.clientId?r.clientId:function defaultId(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}(),g("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===r.protocolVersion&&r.customHandleAcks?r.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=t,this.outgoingStore=r.outgoingStore||new c,this.incomingStore=r.incomingStore||new c,this.queueQoSZero=void 0===r.queueQoSZero||r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this._firstConnection=!0,this.on("connect",(function(){var t=this.queue;g("connect :: sending queued packets"),function deliver(){var r,i=t.shift();g("deliver :: entry %o",i),i&&(r=i.packet,g("deliver :: call _sendPacket for %o",r),o._sendPacket(r,(function(t){i.cb&&i.cb(t),deliver()})))}()})),this.on("close",(function(){g("close :: connected set to `false`"),this.connected=!1,g("close :: clearing connackTimer"),clearTimeout(this.connackTimer),g("close :: clearing ping timer"),null!==o.pingTimer&&(o.pingTimer.clear(),o.pingTimer=null),g("close :: calling _setupReconnect"),this._setupReconnect()})),a.call(this),g("MqttClient :: setting up stream"),this._setupStream()}d(MqttClient,a),MqttClient.prototype._setupStream=function(){var t,r=this,i=new l,o=u.parser(this.options),a=null,c=[];function nextTickWork(){if(c.length)y(work);else{var t=a;a=null,t()}}function work(){g("work :: getting next packet in queue");var t=c.shift();if(t)g("work :: packet pulled from queue"),r._handlePacket(t,nextTickWork);else{g("work :: no packets in queue");var i=a;a=null,g("work :: done flag is %s",!!i),i&&i()}}if(g("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),g("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),o.on("packet",(function(t){g("parser :: on packet push to packets array."),c.push(t)})),i._write=function(t,r,i){a=i,g("writable stream :: parsing buffer"),o.parse(t),work()},g("_setupStream :: pipe stream to writable stream"),this.stream.pipe(i),this.stream.on("error",(function streamErrorHandler(t){g("streamErrorHandler :: error",t.message),_.includes(t.code)?(g("streamErrorHandler :: emitting error"),r.emit("error",t)):nop(t)})),this.stream.on("close",(function(){g("(%s)stream :: on close",r.options.clientId),function flushVolatile(t){t&&(g("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(t).forEach((function(r){t[r].volatile&&"function"==typeof t[r].cb&&(t[r].cb(new Error("Connection closed")),delete t[r])})))}(r.outgoing),g("stream: emit close to MqttClient"),r.emit("close")})),g("_setupStream: sending packet `connect`"),(t=Object.create(this.options)).cmd="connect",sendPacket(this,t),o.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return r.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket)sendPacket(this,m({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){g("!!connectTimeout hit!! Calling _cleanUp with force `true`"),r._cleanUp(!0)}),this.options.connectTimeout)},MqttClient.prototype._handlePacket=function(t,r){var i=this.options;if(5===i.protocolVersion&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize<t.length)return this.emit("error",new Error("exceeding packets size "+t.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(g("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",t),t.cmd){case"publish":this._handlePublish(t,r);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(t),r();break;case"pubrel":this._handlePubrel(t,r);break;case"connack":this._handleConnack(t),r();break;case"pingresp":this._handlePingresp(t),r();break;case"disconnect":this._handleDisconnect(t),r()}},MqttClient.prototype._checkDisconnecting=function(t){return this.disconnecting&&(t?t(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},MqttClient.prototype.publish=function(t,r,i,o){var a;g("publish :: message `%s` to topic `%s`",r,t);var c=this.options;"function"==typeof i&&(o=i,i=null);if(i=m({qos:0,retain:!1,dup:!1},i),this._checkDisconnecting(o))return this;switch(a={cmd:"publish",topic:t,payload:r,qos:i.qos,retain:i.retain,messageId:this._nextId(),dup:i.dup},5===c.protocolVersion&&(a.properties=i.properties,(!c.properties&&a.properties&&a.properties.topicAlias||i.properties&&c.properties&&(i.properties.topicAlias&&c.properties.topicAliasMaximum&&i.properties.topicAlias>c.properties.topicAliasMaximum||!c.properties.topicAliasMaximum&&i.properties.topicAlias))&&delete a.properties.topicAlias),g("publish :: qos",i.qos),i.qos){case 1:case 2:this.outgoing[a.messageId]={volatile:!1,cb:o||nop},this._storeProcessing?(g("_storeProcessing enabled"),this._packetIdsDuringStoreProcessing[a.messageId]=!1,this._storePacket(a,void 0,i.cbStorePut)):(g("MqttClient:publish: packet cmd: %s",a.cmd),this._sendPacket(a,void 0,i.cbStorePut));break;default:this._storeProcessing?(g("_storeProcessing enabled"),this._storePacket(a,o,i.cbStorePut)):(g("MqttClient:publish: packet cmd: %s",a.cmd),this._sendPacket(a,o,i.cbStorePut))}return this},MqttClient.prototype.subscribe=function(){for(var t,r=new Array(arguments.length),i=0;i<arguments.length;i++)r[i]=arguments[i];var o,a=[],c=r.shift(),u=c.resubscribe,l=r.pop()||nop,d=r.pop(),p=this,y=this.options.protocolVersion;if(delete c.resubscribe,"string"==typeof c&&(c=[c]),"function"!=typeof l&&(d=l,l=nop),null!==(o=h.validateTopics(c)))return v(l,new Error("Invalid topic "+o)),this;if(this._checkDisconnecting(l))return g("subscribe: discconecting true"),this;var b={qos:0};if(5===y&&(b.nl=!1,b.rap=!1,b.rh=0),d=m(b,d),Array.isArray(c)?c.forEach((function(t){if(g("subscribe: array topic %s",t),!p._resubscribeTopics.hasOwnProperty(t)||p._resubscribeTopics[t].qos<d.qos||u){var r={topic:t,qos:d.qos};5===y&&(r.nl=d.nl,r.rap=d.rap,r.rh=d.rh,r.properties=d.properties),g("subscribe: pushing topic `%s` and qos `%s` to subs list",r.topic,r.qos),a.push(r)}})):Object.keys(c).forEach((function(t){if(g("subscribe: object topic %s",t),!p._resubscribeTopics.hasOwnProperty(t)||p._resubscribeTopics[t].qos<c[t].qos||u){var r={topic:t,qos:c[t].qos};5===y&&(r.nl=c[t].nl,r.rap=c[t].rap,r.rh=c[t].rh,r.properties=d.properties),g("subscribe: pushing `%s` to subs list",r),a.push(r)}})),t={cmd:"subscribe",subscriptions:a,qos:1,retain:!1,dup:!1,messageId:this._nextId()},d.properties&&(t.properties=d.properties),a.length){if(this.options.resubscribe){g("subscribe :: resubscribe true");var _=[];a.forEach((function(t){if(p.options.reconnectPeriod>0){var r={qos:t.qos};5===y&&(r.nl=t.nl||!1,r.rap=t.rap||!1,r.rh=t.rh||0,r.properties=t.properties),p._resubscribeTopics[t.topic]=r,_.push(t.topic)}})),p.messageIdToTopic[t.messageId]=_}return this.outgoing[t.messageId]={volatile:!0,cb:function(t,r){if(!t)for(var i=r.granted,o=0;o<i.length;o+=1)a[o].qos=i[o];l(t,a)}},g("subscribe :: call _sendPacket"),this._sendPacket(t),this}l(null,[])},MqttClient.prototype.unsubscribe=function(){for(var t={cmd:"unsubscribe",qos:1,messageId:this._nextId()},r=this,i=new Array(arguments.length),o=0;o<arguments.length;o++)i[o]=arguments[o];var a=i.shift(),c=i.pop()||nop,u=i.pop();return"string"==typeof a&&(a=[a]),"function"!=typeof c&&(u=c,c=nop),this._checkDisconnecting(c)||("string"==typeof a?t.unsubscriptions=[a]:Array.isArray(a)&&(t.unsubscriptions=a),this.options.resubscribe&&t.unsubscriptions.forEach((function(t){delete r._resubscribeTopics[t]})),"object"==typeof u&&u.properties&&(t.properties=u.properties),this.outgoing[t.messageId]={volatile:!0,cb:c},g("unsubscribe: call _sendPacket"),this._sendPacket(t)),this},MqttClient.prototype.end=function(t,r,i){var o=this;function closeStores(){g("end :: closeStores: closing incoming and outgoing stores"),o.disconnected=!0,o.incomingStore.close((function(t){o.outgoingStore.close((function(r){if(g("end :: closeStores: emitting end"),o.emit("end"),i){let o=t||r;g("end :: closeStores: invoking callback with args"),i(o)}}))})),o._deferredReconnect&&o._deferredReconnect()}function finish(){g("end :: (%s) :: finish :: calling _cleanUp with force %s",o.options.clientId,t),o._cleanUp(t,()=>{g("end :: finish :: calling process.nextTick on closeStores"),y(closeStores.bind(o))},r)}return g("end :: (%s)",this.options.clientId),null!=t&&"boolean"==typeof t||(i=r||nop,r=t,t=!1,"object"!=typeof r&&(i=r,r=null,"function"!=typeof i&&(i=nop))),"object"!=typeof r&&(i=r,r=null),g("end :: cb? %s",!!i),i=i||nop,this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!t&&Object.keys(this.outgoing).length>0?(g("end :: (%s) :: calling finish in 10ms once outgoing is empty",o.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,finish,10))):(g("end :: (%s) :: immediately calling finish",o.options.clientId),finish()),this)},MqttClient.prototype.removeOutgoingMessage=function(t){var r=this.outgoing[t]?this.outgoing[t].cb:null;return delete this.outgoing[t],this.outgoingStore.del({messageId:t},(function(){r(new Error("Message removed"))})),this},MqttClient.prototype.reconnect=function(t){g("client reconnect");var r=this,f=function(){t?(r.options.incomingStore=t.incomingStore,r.options.outgoingStore=t.outgoingStore):(r.options.incomingStore=null,r.options.outgoingStore=null),r.incomingStore=r.options.incomingStore||new c,r.outgoingStore=r.options.outgoingStore||new c,r.disconnecting=!1,r.disconnected=!1,r._deferredReconnect=null,r._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=f:f(),this},MqttClient.prototype._reconnect=function(){g("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),g("client already connected. disconnecting first.")):(g("_reconnect: calling _setupStream"),this._setupStream())},MqttClient.prototype._setupReconnect=function(){var t=this;!t.disconnecting&&!t.reconnectTimer&&t.options.reconnectPeriod>0?(this.reconnecting||(g("_setupReconnect :: emit `offline` state"),this.emit("offline"),g("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),g("_setupReconnect :: setting reconnectTimer for %d ms",t.options.reconnectPeriod),t.reconnectTimer=setInterval((function(){g("reconnectTimer :: reconnect triggered!"),t._reconnect()}),t.options.reconnectPeriod)):g("_setupReconnect :: doing nothing...")},MqttClient.prototype._clearReconnect=function(){g("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},MqttClient.prototype._cleanUp=function(t,r){var i=arguments[2];if(r&&(g("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",r)),g("_cleanUp :: forced? %s",t),t)0===this.options.reconnectPeriod&&this.options.clean&&flush(this.outgoing),g("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{var o=m({cmd:"disconnect"},i);g("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(o,v.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(g("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(g("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),r&&!this.connected&&(g("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",r),r())},MqttClient.prototype._sendPacket=function(t,r,i){if(g("_sendPacket :: (%s) :: start",this.options.clientId),i=i||nop,!this.connected)return g("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(t,r,i);switch(this._shiftPingInterval(),t.cmd){case"publish":break;case"pubrel":return void storeAndSend(this,t,r,i);default:return void sendPacket(this,t,r)}switch(t.qos){case 2:case 1:storeAndSend(this,t,r,i);break;case 0:default:sendPacket(this,t,r)}g("_sendPacket :: (%s) :: end",this.options.clientId)},MqttClient.prototype._storePacket=function(t,r,i){g("_storePacket :: packet: %o",t),g("_storePacket :: cb? %s",!!r),i=i||nop,0===(t.qos||0)&&this.queueQoSZero||"publish"!==t.cmd?this.queue.push({packet:t,cb:r}):t.qos>0?(r=this.outgoing[t.messageId]?this.outgoing[t.messageId].cb:null,this.outgoingStore.put(t,(function(t){if(t)return r&&r(t);i()}))):r&&r(new Error("No connection to broker"))},MqttClient.prototype._setupPingTimer=function(){g("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);var t=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=p((function(){t._checkPing()}),1e3*this.options.keepalive))},MqttClient.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},MqttClient.prototype._checkPing=function(){g("_checkPing :: checking ping..."),this.pingResp?(g("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(g("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},MqttClient.prototype._handlePingresp=function(){this.pingResp=!0},MqttClient.prototype._handleConnack=function(t){g("_handleConnack");var r=this.options,i=5===r.protocolVersion?t.reasonCode:t.returnCode;if(clearTimeout(this.connackTimer),t.properties&&(t.properties.topicAliasMaximum&&(r.properties||(r.properties={}),r.properties.topicAliasMaximum=t.properties.topicAliasMaximum),t.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=t.properties.serverKeepAlive,this._shiftPingInterval()),t.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=t.properties.maximumPacketSize)),0===i)this.reconnecting=!1,this._onConnect(t);else if(i>0){var o=new Error("Connection refused: "+w[i]);o.code=i,this.emit("error",o)}},MqttClient.prototype._handlePublish=function(t,r){g("_handlePublish: packet %o",t),r=void 0!==r?r:nop;var i=t.topic.toString(),o=t.payload,a=t.qos,c=t.messageId,u=this,l=this.options,d=[0,16,128,131,135,144,145,151,153];switch(g("_handlePublish: qos %d",a),a){case 2:l.customHandleAcks(i,o,t,(function(i,o){return i instanceof Error||(o=i,i=null),i?u.emit("error",i):-1===d.indexOf(o)?u.emit("error",new Error("Wrong reason code for pubrec")):void(o?u._sendPacket({cmd:"pubrec",messageId:c,reasonCode:o},r):u.incomingStore.put(t,(function(){u._sendPacket({cmd:"pubrec",messageId:c},r)})))}));break;case 1:l.customHandleAcks(i,o,t,(function(a,l){return a instanceof Error||(l=a,a=null),a?u.emit("error",a):-1===d.indexOf(l)?u.emit("error",new Error("Wrong reason code for puback")):(l||u.emit("message",i,o,t),void u.handleMessage(t,(function(t){if(t)return r&&r(t);u._sendPacket({cmd:"puback",messageId:c,reasonCode:l},r)})))}));break;case 0:this.emit("message",i,o,t),this.handleMessage(t,r);break;default:g("_handlePublish: unknown QoS. Doing nothing.")}},MqttClient.prototype.handleMessage=function(t,r){r()},MqttClient.prototype._handleAck=function(t){var r,i=t.messageId,o=t.cmd,a=null,c=this.outgoing[i]?this.outgoing[i].cb:null,u=this;if(c){switch(g("_handleAck :: packet type",o),o){case"pubcomp":case"puback":var l=t.reasonCode;l&&l>0&&16!==l&&((r=new Error("Publish error: "+w[l])).code=l,c(r,t)),delete this.outgoing[i],this.outgoingStore.del(t,c);break;case"pubrec":a={cmd:"pubrel",qos:2,messageId:i};var d=t.reasonCode;d&&d>0&&16!==d?((r=new Error("Publish error: "+w[d])).code=d,c(r,t)):this._sendPacket(a);break;case"suback":delete this.outgoing[i];for(var p=0;p<t.granted.length;p++)if(0!=(128&t.granted[p])){var h=this.messageIdToTopic[i];h&&h.forEach((function(t){delete u._resubscribeTopics[t]}))}c(null,t);break;case"unsuback":delete this.outgoing[i],c(null);break;default:u.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else g("_handleAck :: Server sent an ack in error. Ignoring.")},MqttClient.prototype._handlePubrel=function(t,r){g("handling pubrel packet"),r=void 0!==r?r:nop;var i=t.messageId,o=this,a={cmd:"pubcomp",messageId:i};o.incomingStore.get(t,(function(t,i){t?o._sendPacket(a,r):(o.emit("message",i.topic,i.payload,i),o.handleMessage(i,(function(t){if(t)return r(t);o.incomingStore.del(i,nop),o._sendPacket(a,r)})))}))},MqttClient.prototype._handleDisconnect=function(t){this.emit("disconnect",t)},MqttClient.prototype._nextId=function(){var t=this.nextId++;return 65536===this.nextId&&(this.nextId=1),t},MqttClient.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},MqttClient.prototype._resubscribe=function(t){g("_resubscribe");var r=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!t.sessionPresent)&&r.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){g("_resubscribe: protocolVersion 5");for(var i=0;i<r.length;i++){var o={};o[r[i]]=this._resubscribeTopics[r[i]],o.resubscribe=!0,this.subscribe(o,{properties:o[r[i]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},MqttClient.prototype._onConnect=function(t){if(this.disconnected)this.emit("connect",t);else{var r=this;this._setupPingTimer(),this._resubscribe(t),this.connected=!0,function startStreamProcess(){var i=r.outgoingStore.createStream();function clearStoreProcessing(){r._storeProcessing=!1,r._packetIdsDuringStoreProcessing={}}function remove(){i.destroy(),i=null,clearStoreProcessing()}r.once("close",remove),i.on("error",(function(t){clearStoreProcessing(),r.removeListener("close",remove),r.emit("error",t)})),i.on("end",(function(){var i=!0;for(var o in r._packetIdsDuringStoreProcessing)if(!r._packetIdsDuringStoreProcessing[o]){i=!1;break}i?(clearStoreProcessing(),r.removeListener("close",remove),r.emit("connect",t)):startStreamProcess()})),function storeDeliver(){if(i){r._storeProcessing=!0;var t,o=i.read(1);o?r._packetIdsDuringStoreProcessing[o.messageId]?storeDeliver():r.disconnecting||r.reconnectTimer?i.destroy&&i.destroy():(t=r.outgoing[o.messageId]?r.outgoing[o.messageId].cb:null,r.outgoing[o.messageId]={volatile:!1,cb:function(r,i){t&&t(r,i),storeDeliver()}},r._packetIdsDuringStoreProcessing[o.messageId]=!0,r._sendPacket(o)):i.once("readable",storeDeliver)}}()}()}},t.exports=MqttClient}).call(this,i(19),i(17))},function(t,r){},function(t,r,i){"use strict";function ownKeys(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),i.push.apply(i,o)}return i}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(i),!0).forEach((function(r){_defineProperty(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))}))}return t}function _defineProperty(t,r,i){return(r=_toPropertyKey(r))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}function _defineProperties(t,r){for(var i=0;i<r.length;i++){var o=r[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey(o.key),o)}}function _toPropertyKey(t){var r=function _toPrimitive(t,r){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,r||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}var o=i(16).Buffer,a=i(786).inspect,c=a&&a.custom||"inspect";t.exports=function(){function BufferList(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return function _createClass(t,r,i){return r&&_defineProperties(t.prototype,r),i&&_defineProperties(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(BufferList,[{key:"push",value:function push(t){var r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}},{key:"unshift",value:function unshift(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length}},{key:"shift",value:function shift(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function clear(){this.head=this.tail=null,this.length=0}},{key:"join",value:function join(t){if(0===this.length)return"";for(var r=this.head,i=""+r.data;r=r.next;)i+=t+r.data;return i}},{key:"concat",value:function concat(t){if(0===this.length)return o.alloc(0);for(var r,i,a,c=o.allocUnsafe(t>>>0),u=this.head,l=0;u;)r=u.data,i=c,a=l,o.prototype.copy.call(r,i,a),l+=u.data.length,u=u.next;return c}},{key:"consume",value:function consume(t,r){var i;return t<this.head.data.length?(i=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):i=t===this.head.data.length?this.shift():r?this._getString(t):this._getBuffer(t),i}},{key:"first",value:function first(){return this.head.data}},{key:"_getString",value:function _getString(t){var r=this.head,i=1,o=r.data;for(t-=o.length;r=r.next;){var a=r.data,c=t>a.length?a.length:t;if(c===a.length?o+=a:o+=a.slice(0,t),0===(t-=c)){c===a.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(c));break}++i}return this.length-=i,o}},{key:"_getBuffer",value:function _getBuffer(t){var r=o.allocUnsafe(t),i=this.head,a=1;for(i.data.copy(r),t-=i.data.length;i=i.next;){var c=i.data,u=t>c.length?c.length:t;if(c.copy(r,r.length-t,0,u),0===(t-=u)){u===c.length?(++a,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=c.slice(u));break}++a}return this.length-=a,r}},{key:c,value:function value(t,r){return a(this,_objectSpread(_objectSpread({},r),{},{depth:0,customInspect:!1}))}}]),BufferList}()},function(t,r){},function(t,r,i){var o=i(16),a=o.Buffer;function copyProps(t,r){for(var i in t)r[i]=t[i]}function SafeBuffer(t,r,i){return a(t,r,i)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?t.exports=o:(copyProps(o,r),r.Buffer=SafeBuffer),copyProps(a,SafeBuffer),SafeBuffer.from=function(t,r,i){if("number"==typeof t)throw new TypeError("Argument must not be a number");return a(t,r,i)},SafeBuffer.alloc=function(t,r,i){if("number"!=typeof t)throw new TypeError("Argument must be a number");var o=a(t);return void 0!==r?"string"==typeof i?o.fill(r,i):o.fill(r):o.fill(0),o},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return a(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o.SlowBuffer(t)}},function(t,r,i){"use strict";(function(r){var o;function _defineProperty(t,r,i){return(r=function _toPropertyKey(t){var r=function _toPrimitive(t,r){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,r||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}(r))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}var a=i(211),c=Symbol("lastResolve"),u=Symbol("lastReject"),l=Symbol("error"),d=Symbol("ended"),p=Symbol("lastPromise"),h=Symbol("handlePromise"),m=Symbol("stream");function createIterResult(t,r){return{value:t,done:r}}function readAndResolve(t){var r=t[c];if(null!==r){var i=t[m].read();null!==i&&(t[p]=null,t[c]=null,t[u]=null,r(createIterResult(i,!1)))}}function onReadable(t){r.nextTick(readAndResolve,t)}var g=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((_defineProperty(o={get stream(){return this[m]},next:function next(){var t=this,i=this[l];if(null!==i)return Promise.reject(i);if(this[d])return Promise.resolve(createIterResult(void 0,!0));if(this[m].destroyed)return new Promise((function(i,o){r.nextTick((function(){t[l]?o(t[l]):i(createIterResult(void 0,!0))}))}));var o,a=this[p];if(a)o=new Promise(function wrapForNext(t,r){return function(i,o){t.then((function(){r[d]?i(createIterResult(void 0,!0)):r[h](i,o)}),o)}}(a,this));else{var c=this[m].read();if(null!==c)return Promise.resolve(createIterResult(c,!1));o=new Promise(this[h])}return this[p]=o,o}},Symbol.asyncIterator,(function(){return this})),_defineProperty(o,"return",(function _return(){var t=this;return new Promise((function(r,i){t[m].destroy(null,(function(t){t?i(t):r(createIterResult(void 0,!0))}))}))})),o),g);t.exports=function createReadableStreamAsyncIterator(t){var r,i=Object.create(y,(_defineProperty(r={},m,{value:t,writable:!0}),_defineProperty(r,c,{value:null,writable:!0}),_defineProperty(r,u,{value:null,writable:!0}),_defineProperty(r,l,{value:null,writable:!0}),_defineProperty(r,d,{value:t._readableState.endEmitted,writable:!0}),_defineProperty(r,h,{value:function value(t,r){var o=i[m].read();o?(i[p]=null,i[c]=null,i[u]=null,t(createIterResult(o,!1))):(i[c]=t,i[u]=r)},writable:!0}),r));return i[p]=null,a(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var r=i[u];return null!==r&&(i[p]=null,i[c]=null,i[u]=null,r(t)),void(i[l]=t)}var o=i[c];null!==o&&(i[p]=null,i[c]=null,i[u]=null,o(createIterResult(void 0,!0))),i[d]=!0})),t.on("readable",onReadable.bind(null,i)),i}}).call(this,i(19))},function(t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,r,i){"use strict";t.exports=PassThrough;var o=i(329);function PassThrough(t){if(!(this instanceof PassThrough))return new PassThrough(t);o.call(this,t)}i(30)(PassThrough,o),PassThrough.prototype._transform=function(t,r,i){i(null,t)}},function(t,r,i){"use strict";var o;var a=i(95).codes,c=a.ERR_MISSING_ARGS,u=a.ERR_STREAM_DESTROYED;function noop(t){if(t)throw t}function destroyer(t,r,a,c){c=function once(t){var r=!1;return function(){r||(r=!0,t.apply(void 0,arguments))}}(c);var l=!1;t.on("close",(function(){l=!0})),void 0===o&&(o=i(211)),o(t,{readable:r,writable:a},(function(t){if(t)return c(t);l=!0,c()}));var d=!1;return function(r){if(!l&&!d)return d=!0,function isRequest(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void c(r||new u("pipe"))}}function call(t){t()}function pipe(t,r){return t.pipe(r)}function popCallback(t){return t.length?"function"!=typeof t[t.length-1]?noop:t.pop():noop}t.exports=function pipeline(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var o,a=popCallback(r);if(Array.isArray(r[0])&&(r=r[0]),r.length<2)throw new c("streams");var u=r.map((function(t,i){var c=i<r.length-1;return destroyer(t,c,i>0,(function(t){o||(o=t),t&&u.forEach(call),c||(u.forEach(call),a(o))}))}));return r.reduce(pipe)}},function(t,r,i){r.parser=i(793).parser,r.generate=i(799),r.writeToStream=i(331)},function(t,r,i){const o=i(794),a=i(45),c=i(796),u=i(330),l=i(75)("mqtt-packet:parser");class Parser extends a{constructor(){super(),this.parser=this.constructor.parser}static parser(t){return this instanceof Parser?(this.settings=t||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new Parser).parser(t)}_resetState(){l("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new c,this.error=null,this._list=o(),this._stateCounter=0}parse(t){for(this.error&&this._resetState(),this._list.append(t),l("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,l("parse: state complete. _stateCounter is now: %d",this._stateCounter),l("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return l("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const t=this._list.readUInt8(0);return this.packet.cmd=u.types[t>>u.CMD_SHIFT],this.packet.retain=0!=(t&u.RETAIN_MASK),this.packet.qos=t>>u.QOS_SHIFT&u.QOS_MASK,this.packet.dup=0!=(t&u.DUP_MASK),l("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const t=this._parseVarByteNum(!0);return t&&(this.packet.length=t.value,this._list.consume(t.bytes)),l("_parseLength %d",t.value),!!t}_parsePayload(){l("_parsePayload: payload %O",this._list);let t=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}t=!0}return l("_parsePayload complete result: %s",t),t}_parseConnect(){let t,r,i,o;l("_parseConnect");const a={},c=this.packet,d=this._parseString();if(null===d)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==d&&"MQIsdp"!==d)return this._emitError(new Error("Invalid protocolId"));if(c.protocolId=d,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(c.protocolVersion=this._list.readUInt8(this._pos),c.protocolVersion>=128&&(c.bridgeMode=!0,c.protocolVersion=c.protocolVersion-128),3!==c.protocolVersion&&4!==c.protocolVersion&&5!==c.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(a.username=this._list.readUInt8(this._pos)&u.USERNAME_MASK,a.password=this._list.readUInt8(this._pos)&u.PASSWORD_MASK,a.will=this._list.readUInt8(this._pos)&u.WILL_FLAG_MASK,a.will&&(c.will={},c.will.retain=0!=(this._list.readUInt8(this._pos)&u.WILL_RETAIN_MASK),c.will.qos=(this._list.readUInt8(this._pos)&u.WILL_QOS_MASK)>>u.WILL_QOS_SHIFT),c.clean=0!=(this._list.readUInt8(this._pos)&u.CLEAN_SESSION_MASK),this._pos++,c.keepalive=this._parseNum(),-1===c.keepalive)return this._emitError(new Error("Packet too short"));if(5===c.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(c.properties=t)}const p=this._parseString();if(null===p)return this._emitError(new Error("Packet too short"));if(c.clientId=p,l("_parseConnect: packet.clientId: %s",c.clientId),a.will){if(5===c.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(c.will.properties=t)}if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse will topic"));if(c.will.topic=t,l("_parseConnect: packet.will.topic: %s",c.will.topic),r=this._parseBuffer(),null===r)return this._emitError(new Error("Cannot parse will payload"));c.will.payload=r,l("_parseConnect: packet.will.paylaod: %s",c.will.payload)}if(a.username){if(o=this._parseString(),null===o)return this._emitError(new Error("Cannot parse username"));c.username=o,l("_parseConnect: packet.username: %s",c.username)}if(a.password){if(i=this._parseBuffer(),null===i)return this._emitError(new Error("Cannot parse password"));c.password=i}return this.settings=c,l("_parseConnect: complete"),c}_parseConnack(){l("_parseConnack");const t=this.packet;if(this._list.length<1)return null;if(t.sessionPresent=!!(this._list.readUInt8(this._pos++)&u.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?t.reasonCode=this._list.readUInt8(this._pos++):t.reasonCode=0;else{if(this._list.length<2)return null;t.returnCode=this._list.readUInt8(this._pos++)}if(-1===t.returnCode||-1===t.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}l("_parseConnack: complete")}_parsePublish(){l("_parsePublish");const t=this.packet;if(t.topic=this._parseString(),null===t.topic)return this._emitError(new Error("Cannot parse topic"));if(!(t.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}t.payload=this._list.slice(this._pos,t.length),l("_parsePublish: payload from buffer list: %o",t.payload)}}_parseSubscribe(){l("_parseSubscribe");const t=this.packet;let r,i,o,a,c,d,p;if(1!==t.qos)return this._emitError(new Error("Wrong subscribe header"));if(t.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}for(;this._pos<t.length;){if(r=this._parseString(),null===r)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=t.length)return this._emitError(new Error("Malformed Subscribe Payload"));i=this._parseByte(),o=i&u.SUBSCRIBE_OPTIONS_QOS_MASK,d=0!=(i>>u.SUBSCRIBE_OPTIONS_NL_SHIFT&u.SUBSCRIBE_OPTIONS_NL_MASK),c=0!=(i>>u.SUBSCRIBE_OPTIONS_RAP_SHIFT&u.SUBSCRIBE_OPTIONS_RAP_MASK),a=i>>u.SUBSCRIBE_OPTIONS_RH_SHIFT&u.SUBSCRIBE_OPTIONS_RH_MASK,p={topic:r,qos:o},5===this.settings.protocolVersion?(p.nl=d,p.rap=c,p.rh=a):this.settings.bridgeMode&&(p.rh=0,p.rap=!0,p.nl=!0),l("_parseSubscribe: push subscription `%s` to subscription",p),t.subscriptions.push(p)}}}_parseSuback(){l("_parseSuback");const t=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){l("_parseUnsubscribe");const t=this.packet;if(t.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}for(;this._pos<t.length;){const r=this._parseString();if(null===r)return this._emitError(new Error("Cannot parse topic"));l("_parseUnsubscribe: push topic `%s` to unsubscriptions",r),t.unsubscriptions.push(r)}}}_parseUnsuback(){l("_parseUnsuback");const t=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const r=this._parseProperties();for(Object.getOwnPropertyNames(r).length&&(t.properties=r),t.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){l("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const t=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(t.length>2?(t.reasonCode=this._parseByte(),l("_parseConfirmation: packet.reasonCode `%d`",t.reasonCode)):t.reasonCode=0,t.length>3)){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}return!0}_parseDisconnect(){const t=this.packet;if(l("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?t.reasonCode=this._parseByte():t.reasonCode=0;const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}return l("_parseDisconnect result: true"),!0}_parseAuth(){l("_parseAuth");const t=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));t.reasonCode=this._parseByte();const r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(t.properties=r),l("_parseAuth: result: true"),!0}_parseMessageId(){const t=this.packet;return t.messageId=this._parseNum(),null===t.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(l("_parseMessageId: packet.messageId %d",t.messageId),!0)}_parseString(t){const r=this._parseNum(),i=r+this._pos;if(-1===r||i>this._list.length||i>this.packet.length)return null;const o=this._list.toString("utf8",this._pos,i);return this._pos+=r,l("_parseString: result: %s",o),o}_parseStringPair(){return l("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;const i=this._list.slice(this._pos,r);return this._pos+=t,l("_parseBuffer: result: %o",i),i}_parseNum(){if(this._list.length-this._pos<2)return-1;const t=this._list.readUInt16BE(this._pos);return this._pos+=2,l("_parseNum: result: %s",t),t}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const t=this._list.readUInt32BE(this._pos);return this._pos+=4,l("_parse4ByteNum: result: %s",t),t}_parseVarByteNum(t){l("_parseVarByteNum");let r,i=0,o=1,a=0,c=!1;const d=this._pos?this._pos:0;for(;i<4&&d+i<this._list.length;){if(r=this._list.readUInt8(d+i++),a+=o*(r&u.VARBYTEINT_MASK),o*=128,0==(r&u.VARBYTEINT_FIN_MASK)){c=!0;break}if(this._list.length<=i)break}return!c&&4===i&&this._list.length>=i&&this._emitError(new Error("Invalid variable byte integer")),d&&(this._pos+=i),c=!!c&&(t?{bytes:i,value:a}:a),l("_parseVarByteNum: result: %o",c),c}_parseByte(){let t;return this._pos<this._list.length&&(t=this._list.readUInt8(this._pos),this._pos++),l("_parseByte: result: %o",t),t}_parseByType(t){switch(l("_parseByType: type: %s",t),t){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){l("_parseProperties");const t=this._parseVarByteNum(),r=this._pos+t,i={};for(;this._pos<r;){const t=this._parseByte();if(!t)return this._emitError(new Error("Cannot parse property code type")),!1;const r=u.propertiesCodes[t];if(!r)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==r)i[r]?(Array.isArray(i[r])||(i[r]=[i[r]]),i[r].push(this._parseByType(u.propertiesTypes[r]))):i[r]=this._parseByType(u.propertiesTypes[r]);else{i[r]||(i[r]=Object.create(null));const t=this._parseByType(u.propertiesTypes[r]);if(i[r][t.name])if(Array.isArray(i[r][t.name]))i[r][t.name].push(t.value);else{const o=i[r][t.name];i[r][t.name]=[o],i[r][t.name].push(t.value)}else i[r][t.name]=t.value}}return i}_newPacket(){return l("_newPacket"),this.packet&&(this._list.consume(this.packet.length),l("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),l("_newPacket: new packet"),this.packet=new c,this._pos=0,!0}_emitError(t){l("_emitError"),this.error=t,this.emit("error",t)}}t.exports=Parser},function(t,r,i){"use strict";const o=i(74).Duplex,a=i(30),c=i(795);function BufferListStream(t){if(!(this instanceof BufferListStream))return new BufferListStream(t);if("function"==typeof t){this._callback=t;const r=function piper(t){this._callback&&(this._callback(t),this._callback=null)}.bind(this);this.on("pipe",(function onPipe(t){t.on("error",r)})),this.on("unpipe",(function onUnpipe(t){t.removeListener("error",r)})),t=null}c._init.call(this,t),o.call(this)}a(BufferListStream,o),Object.assign(BufferListStream.prototype,c.prototype),BufferListStream.prototype._new=function _new(t){return new BufferListStream(t)},BufferListStream.prototype._write=function _write(t,r,i){this._appendBuffer(t),"function"==typeof i&&i()},BufferListStream.prototype._read=function _read(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},BufferListStream.prototype.end=function end(t){o.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},BufferListStream.prototype._destroy=function _destroy(t,r){this._bufs.length=0,this.length=0,r(t)},BufferListStream.prototype._isBufferList=function _isBufferList(t){return t instanceof BufferListStream||t instanceof c||BufferListStream.isBufferList(t)},BufferListStream.isBufferList=c.isBufferList,t.exports=BufferListStream,t.exports.BufferListStream=BufferListStream,t.exports.BufferList=c},function(t,r,i){"use strict";const{Buffer:o}=i(16),a=Symbol.for("BufferList");function BufferList(t){if(!(this instanceof BufferList))return new BufferList(t);BufferList._init.call(this,t)}BufferList._init=function _init(t){Object.defineProperty(this,a,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},BufferList.prototype._new=function _new(t){return new BufferList(t)},BufferList.prototype._offset=function _offset(t){if(0===t)return[0,0];let r=0;for(let i=0;i<this._bufs.length;i++){const o=r+this._bufs[i].length;if(t<o||i===this._bufs.length-1)return[i,t-r];r=o}},BufferList.prototype._reverseOffset=function(t){const r=t[0];let i=t[1];for(let t=0;t<r;t++)i+=this._bufs[t].length;return i},BufferList.prototype.get=function get(t){if(t>this.length||t<0)return;const r=this._offset(t);return this._bufs[r[0]][r[1]]},BufferList.prototype.slice=function slice(t,r){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof r&&r<0&&(r+=this.length),this.copy(null,0,t,r)},BufferList.prototype.copy=function copy(t,r,i,a){if(("number"!=typeof i||i<0)&&(i=0),("number"!=typeof a||a>this.length)&&(a=this.length),i>=this.length)return t||o.alloc(0);if(a<=0)return t||o.alloc(0);const copy=!!t,c=this._offset(i),u=a-i;let l=u,d=copy&&r||0,p=c[1];if(0===i&&a===this.length){if(!copy)return 1===this._bufs.length?this._bufs[0]:o.concat(this._bufs,this.length);for(let r=0;r<this._bufs.length;r++)this._bufs[r].copy(t,d),d+=this._bufs[r].length;return t}if(l<=this._bufs[c[0]].length-p)return copy?this._bufs[c[0]].copy(t,r,p,p+l):this._bufs[c[0]].slice(p,p+l);copy||(t=o.allocUnsafe(u));for(let r=c[0];r<this._bufs.length;r++){const i=this._bufs[r].length-p;if(!(l>i)){this._bufs[r].copy(t,d,p,p+l),d+=i;break}this._bufs[r].copy(t,d,p),d+=i,l-=i,p&&(p=0)}return t.length>d?t.slice(0,d):t},BufferList.prototype.shallowSlice=function shallowSlice(t,r){if(t=t||0,r="number"!=typeof r?this.length:r,t<0&&(t+=this.length),r<0&&(r+=this.length),t===r)return this._new();const i=this._offset(t),o=this._offset(r),a=this._bufs.slice(i[0],o[0]+1);return 0===o[1]?a.pop():a[a.length-1]=a[a.length-1].slice(0,o[1]),0!==i[1]&&(a[0]=a[0].slice(i[1])),this._new(a)},BufferList.prototype.toString=function toString(t,r,i){return this.slice(r,i).toString(t)},BufferList.prototype.consume=function consume(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},BufferList.prototype.duplicate=function duplicate(){const t=this._new();for(let r=0;r<this._bufs.length;r++)t.append(this._bufs[r]);return t},BufferList.prototype.append=function append(t){if(null==t)return this;if(t.buffer)this._appendBuffer(o.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let r=0;r<t.length;r++)this.append(t[r]);else if(this._isBufferList(t))for(let r=0;r<t._bufs.length;r++)this.append(t._bufs[r]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(o.from(t));return this},BufferList.prototype._appendBuffer=function appendBuffer(t){this._bufs.push(t),this.length+=t.length},BufferList.prototype.indexOf=function(t,r,i){if(void 0===i&&"string"==typeof r&&(i=r,r=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=o.from([t]):"string"==typeof t?t=o.from(t,i):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=o.from(t.buffer,t.byteOffset,t.byteLength):o.isBuffer(t)||(t=o.from(t)),r=Number(r||0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),0===t.length)return r>this.length?this.length:r;const a=this._offset(r);let c=a[0],u=a[1];for(;c<this._bufs.length;c++){const r=this._bufs[c];for(;u<r.length;){if(r.length-u>=t.length){const i=r.indexOf(t,u);if(-1!==i)return this._reverseOffset([c,i]);u=r.length-t.length+1}else{const r=this._reverseOffset([c,u]);if(this._match(r,t))return r;u++}}u=0}return-1},BufferList.prototype._match=function(t,r){if(this.length-t<r.length)return!1;for(let i=0;i<r.length;i++)if(this.get(t+i)!==r[i])return!1;return!0},function(){const t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const r in t)!function(r){BufferList.prototype[r]=null===t[r]?function(t,i){return this.slice(t,t+i)[r](0,i)}:function(i=0){return this.slice(i,i+t[r])[r](0)}}(r)}(),BufferList.prototype._isBufferList=function _isBufferList(t){return t instanceof BufferList||BufferList.isBufferList(t)},BufferList.isBufferList=function isBufferList(t){return null!=t&&t[a]},t.exports=BufferList},function(t,r){t.exports=class Packet{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},function(t,r,i){t.exports=function setup(t){function createDebug(t){let r,i,o,a=null;function debug(...t){if(!debug.enabled)return;const i=debug,o=Number(new Date),a=o-(r||o);i.diff=a,i.prev=r,i.curr=o,r=o,t[0]=createDebug.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let c=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return"%";c++;const a=createDebug.formatters[o];if("function"==typeof a){const o=t[c];r=a.call(i,o),t.splice(c,1),c--}return r}),createDebug.formatArgs.call(i,t);(i.log||createDebug.log).apply(i,t)}return debug.namespace=t,debug.useColors=createDebug.useColors(),debug.color=createDebug.selectColor(t),debug.extend=extend,debug.destroy=createDebug.destroy,Object.defineProperty(debug,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==createDebug.namespaces&&(i=createDebug.namespaces,o=createDebug.enabled(t)),o),set:t=>{a=t}}),"function"==typeof createDebug.init&&createDebug.init(debug),debug}function extend(t,r){const i=createDebug(this.namespace+(void 0===r?":":r)+t);return i.log=this.log,i}function toNamespace(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return createDebug.debug=createDebug,createDebug.default=createDebug,createDebug.coerce=function coerce(t){if(t instanceof Error)return t.stack||t.message;return t},createDebug.disable=function disable(){const t=[...createDebug.names.map(toNamespace),...createDebug.skips.map(toNamespace).map(t=>"-"+t)].join(",");return createDebug.enable(""),t},createDebug.enable=function enable(t){let r;createDebug.save(t),createDebug.namespaces=t,createDebug.names=[],createDebug.skips=[];const i=("string"==typeof t?t:"").split(/[\s,]+/),o=i.length;for(r=0;r<o;r++)i[r]&&("-"===(t=i[r].replace(/\*/g,".*?"))[0]?createDebug.skips.push(new RegExp("^"+t.slice(1)+"$")):createDebug.names.push(new RegExp("^"+t+"$")))},createDebug.enabled=function enabled(t){if("*"===t[t.length-1])return!0;let r,i;for(r=0,i=createDebug.skips.length;r<i;r++)if(createDebug.skips[r].test(t))return!1;for(r=0,i=createDebug.names.length;r<i;r++)if(createDebug.names[r].test(t))return!0;return!1},createDebug.humanize=i(798),createDebug.destroy=function destroy(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(r=>{createDebug[r]=t[r]}),createDebug.names=[],createDebug.skips=[],createDebug.formatters={},createDebug.selectColor=function selectColor(t){let r=0;for(let i=0;i<t.length;i++)r=(r<<5)-r+t.charCodeAt(i),r|=0;return createDebug.colors[Math.abs(r)%createDebug.colors.length]},createDebug.enable(createDebug.load()),createDebug}},function(t,r){var i=1e3,o=6e4,a=60*o,c=24*a;function plural(t,r,i,o){var a=r>=1.5*i;return Math.round(t/i)+" "+o+(a?"s":"")}t.exports=function(t,r){r=r||{};var u=typeof t;if("string"===u&&t.length>0)return function parse(t){if((t=String(t)).length>100)return;var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!r)return;var u=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*u;case"weeks":case"week":case"w":return 6048e5*u;case"days":case"day":case"d":return u*c;case"hours":case"hour":case"hrs":case"hr":case"h":return u*a;case"minutes":case"minute":case"mins":case"min":case"m":return u*o;case"seconds":case"second":case"secs":case"sec":case"s":return u*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(t);if("number"===u&&isFinite(t))return r.long?function fmtLong(t){var r=Math.abs(t);if(r>=c)return plural(t,r,c,"day");if(r>=a)return plural(t,r,a,"hour");if(r>=o)return plural(t,r,o,"minute");if(r>=i)return plural(t,r,i,"second");return t+" ms"}(t):function fmtShort(t){var r=Math.abs(t);if(r>=c)return Math.round(t/c)+"d";if(r>=a)return Math.round(t/a)+"h";if(r>=o)return Math.round(t/o)+"m";if(r>=i)return Math.round(t/i)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,r,i){(function(r){const o=i(331),a=i(45);class Accumulator extends a{constructor(){super(),this._array=new Array(20),this._i=0}write(t){return this._array[this._i++]=t,!0}concat(){let t=0;const i=new Array(this._array.length),o=this._array;let a,c=0;for(a=0;a<o.length&&void 0!==o[a];a++)"string"!=typeof o[a]?i[a]=o[a].length:i[a]=r.byteLength(o[a]),t+=i[a];const u=r.allocUnsafe(t);for(a=0;a<o.length&&void 0!==o[a];a++)"string"!=typeof o[a]?(o[a].copy(u,c),c+=i[a]):(u.write(o[a],c),c+=i[a]);return u}}t.exports=function generate(t,r){const i=new Accumulator;return o(t,i,r),i.concat()}}).call(this,i(16).Buffer)},function(t,r,i){(function(r){const i={},o=r.isBuffer(r.from([1,2]).subarray(0,1));function generateBuffer(t){const i=r.allocUnsafe(2);return i.writeUInt8(t>>8,0),i.writeUInt8(255&t,1),i}t.exports={cache:i,generateCache:function generateCache(){for(let t=0;t<65536;t++)i[t]=generateBuffer(t)},generateNumber:generateBuffer,genBufVariableByteInt:function genBufVariableByteInt(t){let i=0,a=0;const c=r.allocUnsafe(4);do{i=t%128|0,(t=t/128|0)>0&&(i|=128),c.writeUInt8(i,a++)}while(t>0&&a<4);return t>0&&(a=0),o?c.subarray(0,a):c.slice(0,a)},generate4ByteBuffer:function generate4ByteBuffer(t){const i=r.allocUnsafe(4);return i.writeUInt32BE(t,0),i}}}).call(this,i(16).Buffer)},function(t,r,i){"use strict";function ReInterval(t,r,i){var o=this;this._callback=t,this._args=i,this._interval=setInterval(t,r,this._args),this.reschedule=function(t){t||(t=o._interval),o._interval&&clearInterval(o._interval),o._interval=setInterval(o._callback,t,o._args)},this.clear=function(){o._interval&&(clearInterval(o._interval),o._interval=void 0)},this.destroy=function(){o._interval&&clearInterval(o._interval),o._callback=void 0,o._interval=void 0,o._args=void 0}}t.exports=function reInterval(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var t;if(arguments.length>0){t=new Array(arguments.length-2);for(var r=0;r<t.length;r++)t[r]=arguments[r+2]}return new ReInterval(arguments[0],arguments[1],t)}},function(t,r,i){"use strict";function validateTopic(t){for(var r=t.split("/"),i=0;i<r.length;i++)if("+"!==r[i]){if("#"===r[i])return i===r.length-1;if(-1!==r[i].indexOf("+")||-1!==r[i].indexOf("#"))return!1}return!0}t.exports={validateTopics:function validateTopics(t){if(0===t.length)return"empty_topic_list";for(var r=0;r<t.length;r++)if(!validateTopic(t[r]))return t[r];return null}}},function(t,r){},function(t,r){},function(t,r,i){var o=i(806);function once(t){var f=function(){return f.called?f.value:(f.called=!0,f.value=t.apply(this,arguments))};return f.called=!1,f}function onceStrict(t){var f=function(){if(f.called)throw new Error(f.onceError);return f.called=!0,f.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return f.onceError=r+" shouldn't be called more than once",f.called=!1,f}t.exports=o(once),t.exports.strict=o(onceStrict),once.proto=once((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})}))},function(t,r){t.exports=function wrappy(t,r){if(t&&r)return wrappy(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(r){wrapper[r]=t[r]})),wrapper;function wrapper(){for(var r=new Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];var o=t.apply(this,r),a=r[r.length-1];return"function"==typeof o&&o!==a&&Object.keys(a).forEach((function(t){o[t]=a[t]})),o}}},function(t,r,i){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(t,r,i){var o;t.exports=(o=i(214),i(338),i(810),o.HmacSHA256)},function(t,r){},function(t,r,i){var o,a,c,u;t.exports=(o=i(214),c=(a=o).lib.Base,u=a.enc.Utf8,void(a.algo.HMAC=c.extend({init:function(t,r){t=this._hasher=new t.init,"string"==typeof r&&(r=u.parse(r));var i=t.blockSize,o=4*i;r.sigBytes>o&&(r=t.finalize(r)),r.clamp();for(var a=this._oKey=r.clone(),c=this._iKey=r.clone(),l=a.words,d=c.words,p=0;p<i;p++)l[p]^=1549556828,d[p]^=909522486;a.sigBytes=c.sigBytes=o,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var r=this._hasher,i=r.finalize(t);return r.reset(),r.finalize(this._oKey.clone().concat(i))}})))},function(t,r){t.exports={INVALID_CONNECT_OPTIONS:"Invalid connect options supplied.",INVALID_CLIENT_ID_OPTION:'Invalid "clientId" (mqtt client id) option supplied.',INVALID_RECONNECT_TIMING:"Invalid reconnect timing options supplied.",INVALID_OFFLINE_QUEUEING_PARAMETERS:"Invalid offline queueing options supplied."}},function(t,r,i){(function(r){var o=i(215),a=i(153),c=i(813);t.exports=function(t){if(a(t.keyPath)&&a(t.privateKey))throw new Error(c.NO_KEY_OPTION);if(a(t.certPath)&&a(t.clientCert))throw new Error(c.NO_CERT_OPTION);if(a(t.caPath)&&a(t.caCert))throw new Error(c.NO_CA_OPTION);if(!a(t.caCert))if(r.isBuffer(t.caCert))t.ca=t.caCert;else{if(!o.existsSync(t.caCert))throw new Error(c.INVALID_CA_CERT_OPTION);t.ca=o.readFileSync(t.caCert)}if(!a(t.privateKey))if(r.isBuffer(t.privateKey))t.key=t.privateKey;else{if(!o.existsSync(t.privateKey))throw new Error(c.INVALID_PRIVATE_KEY_OPTION);t.key=o.readFileSync(t.privateKey)}if(!a(t.clientCert))if(r.isBuffer(t.clientCert))t.cert=t.clientCert;else{if(!o.existsSync(t.clientCert))throw new Error(c.INVALID_CLIENT_CERT_OPTION);t.cert=o.readFileSync(t.clientCert)}if(o.existsSync(t.keyPath))t.key=o.readFileSync(t.keyPath);else if(!a(t.keyPath))throw new Error(c.INVALID_KEY_PATH_OPTION);if(o.existsSync(t.certPath))t.cert=o.readFileSync(t.certPath);else if(!a(t.certPath))throw new Error(c.INVALID_CERT_PATH_OPTION);if(o.existsSync(t.caPath))t.ca=o.readFileSync(t.caPath);else if(!a(t.caPath))throw new Error(c.INVALID_CA_PATH_OPTION);t.requestCert=!0,t.rejectUnauthorized=!0}}).call(this,i(16).Buffer)},function(t,r){t.exports={NO_KEY_OPTION:'No "keyPath" or "privateKey" option supplied.',NO_CERT_OPTION:'No "certPath" or "clientCert" option supplied.',NO_CA_OPTION:'No "caPath" or "caCert" option supplied.',INVALID_KEY_PATH_OPTION:'Invalid "keyPath" option supplied.',INVALID_CERT_PATH_OPTION:'Invalid "certPath" option supplied.',INVALID_CA_PATH_OPTION:'Invalid "caPath" option supplied.',INVALID_CLIENT_CERT_OPTION:'Invalid "clientCert" option supplied.',INVALID_PRIVATE_KEY_OPTION:'Invalid "privateKey" option supplied.',INVALID_CA_CERT_OPTION:'Invalid "caCert" option supplied.'}},function(t,r,i){(function(t){function normalizeArray(t,r){for(var i=0,o=t.length-1;o>=0;o--){var a=t[o];"."===a?t.splice(o,1):".."===a?(t.splice(o,1),i++):i&&(t.splice(o,1),i--)}if(r)for(;i--;i)t.unshift("..");return t}function filter(t,r){if(t.filter)return t.filter(r);for(var i=[],o=0;o<t.length;o++)r(t[o],o,t)&&i.push(t[o]);return i}r.resolve=function(){for(var r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return(i?"/":"")+(r=normalizeArray(filter(r.split("/"),(function(t){return!!t})),!i).join("/"))||"."},r.normalize=function(t){var o=r.isAbsolute(t),a="/"===i(t,-1);return(t=normalizeArray(filter(t.split("/"),(function(t){return!!t})),!o).join("/"))||o||(t="."),t&&a&&(t+="/"),(o?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(filter(t,(function(t,r){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},r.relative=function(t,i){function trim(t){for(var r=0;r<t.length&&""===t[r];r++);for(var i=t.length-1;i>=0&&""===t[i];i--);return r>i?[]:t.slice(r,i-r+1)}t=r.resolve(t).substr(1),i=r.resolve(i).substr(1);for(var o=trim(t.split("/")),a=trim(i.split("/")),c=Math.min(o.length,a.length),u=c,l=0;l<c;l++)if(o[l]!==a[l]){u=l;break}var d=[];for(l=u;l<o.length;l++)d.push("..");return(d=d.concat(a.slice(u))).join("/")},r.sep="/",r.delimiter=":",r.dirname=function(t){if("string"!=typeof t&&(t+=""),0===t.length)return".";for(var r=t.charCodeAt(0),i=47===r,o=-1,a=!0,c=t.length-1;c>=1;--c)if(47===(r=t.charCodeAt(c))){if(!a){o=c;break}}else a=!1;return-1===o?i?"/":".":i&&1===o?"/":t.slice(0,o)},r.basename=function(t,r){var i=function basename(t){"string"!=typeof t&&(t+="");var r,i=0,o=-1,a=!0;for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!a){i=r+1;break}}else-1===o&&(a=!1,o=r+1);return-1===o?"":t.slice(i,o)}(t);return r&&i.substr(-1*r.length)===r&&(i=i.substr(0,i.length-r.length)),i},r.extname=function(t){"string"!=typeof t&&(t+="");for(var r=-1,i=0,o=-1,a=!0,c=0,u=t.length-1;u>=0;--u){var l=t.charCodeAt(u);if(47!==l)-1===o&&(a=!1,o=u+1),46===l?-1===r?r=u:1!==c&&(c=1):-1!==r&&(c=-1);else if(!a){i=u+1;break}}return-1===r||-1===o||0===c||1===c&&r===o-1&&r===i+1?"":t.slice(r,o)};var i="b"==="ab".substr(-1)?function(t,r,i){return t.substr(r,i)}:function(t,r,i){return r<0&&(r=t.length+r),t.substr(r,i)}}).call(this,i(19))},function(t){t.exports=JSON.parse('{"name":"aws-iot-device-sdk","description":"AWS IoT Node.js SDK for Embedded Devices","version":"2.2.15","author":{"name":"Amazon Web Services","email":"","url":"http://aws.amazon.com"},"homepage":"https://github.com/aws/aws-iot-device-sdk-js","main":"index.js","engines":{"node":">=8.17.0"},"repository":{"type":"git","url":"git://github.com/aws/aws-iot-device-sdk-js"},"bugs":{"url":"http://github.com/aws/aws-iot-device-sdk-js/issues"},"license":"Apache-2.0","keywords":["api","amazon","aws","iot","mqtt"],"dependencies":{"crypto-js":"4.2.0","minimist":"1.2.6","mqtt":"4.2.8","@httptoolkit/websocket-stream":"^6.0.1"},"devDependencies":{"gulp":"^3.9.0","gulp-beautify":"^2.0.0","gulp-concat":"^2.6.0","gulp-coverage":"^0.3.38","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1","jshint":"^2.9.1","jshint-stylish":"^2.2.1","rewire":"^2.5.1","sinon":"^1.17.3"},"scripts":{"test":"node ./node_modules/gulp/bin/gulp.js test --verbose","browserize":"./scripts/browserize.sh","beautify":"node ./node_modules/gulp/bin/gulp.js beautify"}}')},function(t,r,i){var o=i(215);t.exports=function buildBuilder(t,r){var i;function handleTLSerrors(r){t.emit("error",r),i.end()}return(i=o.connect(r)).on("secureConnect",(function(){i.authorized?i.removeListener("error",handleTLSerrors):i.emit("error",new Error("TLS not authorized"))})),i.on("error",handleTLSerrors),i}},function(t,r,i){var o=i(818);t.exports=function buildBuilder(t,r){return o(r.url,["mqttv3.1"],r.websocketOptions)}},function(t,r,i){"use strict";(function(r,o){var a=i(339).Transform,c=i(826),u=i(827),l=i(154).Buffer;t.exports=function WebSocketStream(t,i,d){var p,h,m="browser"===r.title,g=!!o.WebSocket,y=m?function socketWriteBrowser(t,r,i){if(h.bufferedAmount>b)return void setTimeout(socketWriteBrowser,_,t,r,i);S&&"string"==typeof t&&(t=l.from(t,"utf8"));try{h.send(t)}catch(t){return i(t)}i()}:function socketWriteNode(t,r,i){if(h.readyState!==h.OPEN)return void i();S&&"string"==typeof t&&(t=l.from(t,"utf8"));h.send(t,i)};i&&!Array.isArray(i)&&"object"==typeof i&&(d=i,i=void 0,("string"==typeof d.protocol||Array.isArray(d.protocol))&&(i=d.protocol));d||(d={});void 0===d.objectMode&&(d.objectMode=!(!0===d.binary||void 0===d.binary));var v=function buildProxy(t,r,i){var o=new a({objectMode:t.objectMode});return o._write=r,o._flush=i,o}(d,y,(function socketEnd(t){h.close(),t()}));d.objectMode||(v._writev=writev);var b=d.browserBufferSize||524288,_=d.browserBufferTimeout||1e3;"object"==typeof t?h=t:(h=g&&m?new u(t,i):new u(t,i,d)).binaryType="arraybuffer";var w=void 0===h.addEventListener;h.readyState===h.OPEN?p=v:(p=c(void 0,void 0,d),d.objectMode||(p._writev=writev),w?h.addEventListener("open",onopen):h.onopen=onopen);p.socket=h,w?(h.addEventListener("close",onclose),h.addEventListener("error",onerror),h.addEventListener("message",onmessage)):(h.onclose=onclose,h.onerror=onerror,h.onmessage=onmessage);v.on("close",(function destroy(){h.close()}));var S=!d.objectMode;function onopen(){p.setReadable(v),p.setWritable(v),p.emit("connect")}function onclose(t){p.emit("ws-close",t),p.end(),p.destroy()}function onerror(t){p.destroy(t)}function onmessage(t){var r=t.data;r=r instanceof ArrayBuffer?l.from(r):l.from(r,"utf8"),v.push(r)}function writev(t,r){for(var i=new Array(t.length),o=0;o<t.length;o++)"string"==typeof t[o].chunk?i[o]=l.from(t[o],"utf8"):i[o]=t[o].chunk;this._write(l.concat(i),"binary",r)}return p}}).call(this,i(19),i(17))},function(t,r){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,r){},function(t,r,i){"use strict";var o=i(154).Buffer,a=i(822);t.exports=function(){function BufferList(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return BufferList.prototype.push=function push(t){var r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length},BufferList.prototype.unshift=function unshift(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length},BufferList.prototype.shift=function shift(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},BufferList.prototype.clear=function clear(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function join(t){if(0===this.length)return"";for(var r=this.head,i=""+r.data;r=r.next;)i+=t+r.data;return i},BufferList.prototype.concat=function concat(t){if(0===this.length)return o.alloc(0);for(var r,i,a,c=o.allocUnsafe(t>>>0),u=this.head,l=0;u;)r=u.data,i=c,a=l,r.copy(i,a),l+=u.data.length,u=u.next;return c},BufferList}(),a&&a.inspect&&a.inspect.custom&&(t.exports.prototype[a.inspect.custom]=function(){var t=a.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,r){},function(t,r,i){(function(t){var o=void 0!==t&&t||"undefined"!=typeof self&&self||window,a=Function.prototype.apply;function Timeout(t,r){this._id=t,this._clearFn=r}r.setTimeout=function(){return new Timeout(a.call(setTimeout,o,arguments),clearTimeout)},r.setInterval=function(){return new Timeout(a.call(setInterval,o,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t&&t.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(o,this._id)},r.enroll=function(t,r){clearTimeout(t._idleTimeoutId),t._idleTimeout=r},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var r=t._idleTimeout;r>=0&&(t._idleTimeoutId=setTimeout((function onTimeout(){t._onTimeout&&t._onTimeout()}),r))},i(824),r.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,r.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(17))},function(t,r,i){(function(t,r){!function(t,i){"use strict";if(!t.setImmediate){var o,a=1,c={},u=!1,l=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?function installNextTickImplementation(){o=function(t){r.nextTick((function(){runIfPresent(t)}))}}():!function canUsePostMessage(){if(t.postMessage&&!t.importScripts){var r=!0,i=t.onmessage;return t.onmessage=function(){r=!1},t.postMessage("","*"),t.onmessage=i,r}}()?t.MessageChannel?function installMessageChannelImplementation(){var t=new MessageChannel;t.port1.onmessage=function(t){runIfPresent(t.data)},o=function(r){t.port2.postMessage(r)}}():l&&"onreadystatechange"in l.createElement("script")?function installReadyStateChangeImplementation(){var t=l.documentElement;o=function(r){var i=l.createElement("script");i.onreadystatechange=function(){runIfPresent(r),i.onreadystatechange=null,t.removeChild(i),i=null},t.appendChild(i)}}():function installSetTimeoutImplementation(){o=function(t){setTimeout(runIfPresent,0,t)}}():function installPostMessageImplementation(){var r="setImmediate$"+Math.random()+"$",onGlobalMessage=function(i){i.source===t&&"string"==typeof i.data&&0===i.data.indexOf(r)&&runIfPresent(+i.data.slice(r.length))};t.addEventListener?t.addEventListener("message",onGlobalMessage,!1):t.attachEvent("onmessage",onGlobalMessage),o=function(i){t.postMessage(r+i,"*")}}(),d.setImmediate=function setImmediate(t){"function"!=typeof t&&(t=new Function(""+t));for(var r=new Array(arguments.length-1),i=0;i<r.length;i++)r[i]=arguments[i+1];var u={callback:t,args:r};return c[a]=u,o(a),a++},d.clearImmediate=clearImmediate}function clearImmediate(t){delete c[t]}function runIfPresent(t){if(u)setTimeout(runIfPresent,0,t);else{var r=c[t];if(r){u=!0;try{!function run(t){var r=t.callback,i=t.args;switch(i.length){case 0:r();break;case 1:r(i[0]);break;case 2:r(i[0],i[1]);break;case 3:r(i[0],i[1],i[2]);break;default:r.apply(void 0,i)}}(r)}finally{clearImmediate(t),u=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,i(17),i(19))},function(t,r,i){"use strict";t.exports=PassThrough;var o=i(344),a=Object.create(i(118));function PassThrough(t){if(!(this instanceof PassThrough))return new PassThrough(t);o.call(this,t)}a.inherits=i(30),a.inherits(PassThrough,o),PassThrough.prototype._transform=function(t,r,i){i(null,t)}},function(t,r,i){(function(r,o){var a=i(339),c=i(334),u=i(30),l=i(335),d=r.from&&r.from!==Uint8Array.from?r.from([0]):new r([0]),onuncork=function(t,r){t._corked?t.once("uncork",r):r()},destroyer=function(t,r){return function(i){i?function(t,r){t._autoDestroy&&t.destroy(r)}(t,"premature close"===i.message?null:i):r&&!t._ended&&t.end()}},Duplexify=function(t,r,i){if(!(this instanceof Duplexify))return new Duplexify(t,r,i);a.Duplex.call(this,i),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!i||!1!==i.autoDestroy,this._forwardDestroy=!i||!1!==i.destroy,this._forwardEnd=!i||!1!==i.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),r&&this.setReadable(r)};u(Duplexify,a.Duplex),Duplexify.obj=function(t,r,i){return i||(i={}),i.objectMode=!0,i.highWaterMark=16,new Duplexify(t,r,i)},Duplexify.prototype.cork=function(){1==++this._corked&&this.emit("cork")},Duplexify.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},Duplexify.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var r=this,i=c(t,{writable:!0,readable:!1},destroyer(this,this._forwardEnd)),ondrain=function(){var t=r._ondrain;r._ondrain=null,t&&t()};this._unwrite&&o.nextTick(ondrain),this._writable=t,this._writable.on("drain",ondrain),this._unwrite=function(){r._writable.removeListener("drain",ondrain),i()},this.uncork()}else this.end()},Duplexify.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var r,i=this,o=c(t,{writable:!1,readable:!0},destroyer(this)),onreadable=function(){i._forward()},onend=function(){i.push(null)};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:(r=t,new a.Readable({objectMode:!0,highWaterMark:16}).wrap(r)),this._readable2.on("readable",onreadable),this._readable2.on("end",onend),this._unread=function(){i._readable2.removeListener("readable",onreadable),i._readable2.removeListener("end",onend),o()},this._forward()}},Duplexify.prototype._read=function(){this._drained=!0,this._forward()},Duplexify.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=l(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},Duplexify.prototype.destroy=function(t){if(!this.destroyed){this.destroyed=!0;var r=this;o.nextTick((function(){r._destroy(t)}))}},Duplexify.prototype._destroy=function(t){if(t){var r=this._ondrain;this._ondrain=null,r?r(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},Duplexify.prototype._write=function(t,r,i){return this.destroyed?i():this._corked?onuncork(this,this._write.bind(this,t,r,i)):t===d?this._finish(i):this._writable?void(!1===this._writable.write(t)?this._ondrain=i:i()):i()},Duplexify.prototype._finish=function(t){var r=this;this.emit("preend"),onuncork(this,(function(){var i,o;i=r._forwardEnd&&r._writable,o=function(){!1===r._writableState.prefinished&&(r._writableState.prefinished=!0),r.emit("prefinish"),onuncork(r,t)},i?i._writableState&&i._writableState.finished?o():i._writableState?i.end(o):(i.end(),o()):o()}))},Duplexify.prototype.end=function(t,r,i){return"function"==typeof t?this.end(null,null,t):"function"==typeof r?this.end(t,null,r):(this._ended=!0,t&&this.write(t),this._writableState.ending||this.write(d),a.Writable.prototype.end.call(this,i))},t.exports=Duplexify}).call(this,i(16).Buffer,i(19))},function(t,r,i){(function(r){var i=null;"undefined"!=typeof WebSocket?i=WebSocket:"undefined"!=typeof MozWebSocket?i=MozWebSocket:void 0!==r?i=r.WebSocket||r.MozWebSocket:"undefined"!=typeof window?i=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(i=self.WebSocket||self.MozWebSocket),t.exports=i}).call(this,i(17))},function(t,r,i){var o=i(45),a=i(209).inherits,c=i(208),u=i(153);function buildThingShadowTopic(t,r,i){return u(i)?"$aws/things/"+t+"/shadow/"+r:"$aws/things/"+t+"/shadow/"+r+"/"+i}function ThingShadowsClient(t,r){if(!(this instanceof ThingShadowsClient))return new ThingShadowsClient(t,r);var i=this,a=[{}],l=0,d=1e4,p=!0,h=c.DeviceClient(t);u(r)||u(r.operationTimeout)||(d=r.operationTimeout),this._handleSubscriptions=function(t,r,i,o){for(var c=[],l=0,d=r.length;l<d;l++)for(var p=0,m=r[l].operations.length;p<m;p++)for(var g=0,y=r[l].statii.length;g<y;g++)c.push(buildThingShadowTopic(t,r[l].operations[p],r[l].statii[g]));!0===a[t].debug&&console.log(i+" on "+c);var v=[];v.push(c),"subscribe"===i?(v.push({qos:a[t].qos}),v.push((function(t,r){if(!u(o)){if(t)return void o(t);for(var i=[],a=0,c=r.length;a<c;a++)128===r[a].qos&&i.push(r[a]);if(i.length>0)return void o("Not all subscriptions were granted",i);o()}}))):u(o)||v.push(o),h[i].apply(h,v)},this._handleMessages=function(r,i,o,c){var l={};try{l=JSON.parse(c.toString())}catch(r){return void(!0===t.debug&&console.error("failed parsing JSON '"+c.toString()+"', "+r))}var d=l.clientToken,p=l.version;if(delete l.clientToken,!u(p)&&"rejected"!==o)if(u(a[r].version)||p>=a[r].version)a[r].version=p;else if("delete"!==i&&!0===a[r].discardStale)return void(!0===t.debug&&console.warn("out-of-date version '"+p+"' on '"+r+"' (local version '"+a[r].version+"')"));"delta"!==o?u(a[r].clientToken)||a[r].clientToken!==d?"accepted"===o&&"get"!==i&&this.emit("foreignStateChange",r,i,l):(clearTimeout(a[r].timeout),delete a[r].timeout,delete a[r].clientToken,a[r].pending=!1,!1===a[r].persistentSubscribe&&this._handleSubscriptions(r,[{operations:[i],statii:["accepted","rejected"]}],"unsubscribe"),this.emit("status",r,o,d,l)):this.emit("delta",r,l)},h.on("connect",(function(){i.emit("connect")})),h.on("close",(function(){i.emit("close")})),h.on("reconnect",(function(){i.emit("reconnect")})),h.on("offline",(function(){i.emit("offline")})),h.on("error",(function(t){i.emit("error",t)})),h.on("packetsend",(function(t){i.emit("packetsend",t)})),h.on("packetreceive",(function(t){i.emit("packetreceive",t)})),h.on("message",(function(t,r){if(!0===p){var o=t.split("/");!function isThingShadowTopic(t,r){var i=!1;return"$aws"===t[0]&&("things"!==t[1]||"shadow"!==t[3]||"update"!==t[4]&&"get"!==t[4]&&"delete"!==t[4]||("subscribe"===r?"accepted"!==t[5]&&"rejected"!==t[5]&&"delta"!==t[5]||6!==t.length||(i=!0):5===t.length&&(i=!0))),i}(o,"subscribe")?i.emit("message",t,r):a.hasOwnProperty(o[2])&&i._handleMessages(o[2],o[4],o[5],r)}})),this._thingOperation=function(r,o,c){var p=null;if(a.hasOwnProperty(r))if(!1===a[r].pending){var m;if(a[r].pending=!0,u(c.clientToken)){var g=t.clientId.length;m=g>48?t.clientId.substr(g-48)+"-"+l++:t.clientId+"-"+l++}else m=c.clientToken;a[r].clientToken=m;var y=buildThingShadowTopic(r,o);a[r].timeout=setTimeout((function(t,r){!1===a[t].persistentSubscribe&&i._handleSubscriptions(t,[{operations:[o],statii:["accepted","rejected"]}],"unsubscribe"),a[t].pending=!1,delete a[t].timeout,delete a[t].clientToken,i.emit("timeout",t,r)}),d,r,m),!1===a[r].persistentSubscribe?this._handleSubscriptions(r,[{operations:[o],statii:["accepted","rejected"]}],"subscribe",(function(t,i){u(t)&&u(i)?u(c)||(!u(a[r].version)&&a[r].enableVersioning&&(c.version=a[r].version),c.clientToken=m,h.publish(y,JSON.stringify(c),{qos:a[r].qos}),u(a[r])||!0!==a[r].debug||console.log("publishing '"+JSON.stringify(c)+" on '"+y+"'")):console.warn("failed subscription to accepted/rejected topics")})):(!u(a[r].version)&&a[r].enableVersioning&&(c.version=a[r].version),c.clientToken=m,h.publish(y,JSON.stringify(c),{qos:a[r].qos}),!0===a[r].debug&&console.log("publishing '"+JSON.stringify(c)+" on '"+y+"'")),p=m}else!0===t.debug&&console.error(o+" still in progress on thing: ",r);else!0===t.debug&&console.error("attempting to "+o+" unknown thing: ",r);return p},this.register=function(r,i,o){if(a.hasOwnProperty(r))!0===t.debug&&console.error("thing already registered: ",r);else{var c=!1,l=[];a[r]={persistentSubscribe:!0,debug:!1,discardStale:!0,enableVersioning:!0,qos:0,pending:!0},"function"==typeof i&&(o=i,i=null),u(i)||(u(i.ignoreDeltas)||(c=i.ignoreDeltas),u(i.persistentSubscribe)||(a[r].persistentSubscribe=i.persistentSubscribe),u(i.debug)||(a[r].debug=i.debug),u(i.discardStale)||(a[r].discardStale=i.discardStale),u(i.enableVersioning)||(a[r].enableVersioning=i.enableVersioning),u(i.qos)||(a[r].qos=i.qos)),!1===c&&l.push({operations:["update"],statii:["delta"]}),!0===a[r].persistentSubscribe&&l.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),l.length>0?this._handleSubscriptions(r,l,"subscribe",(function(t,i){u(t)&&u(i)&&(a[r].pending=!1),u(o)||o(t,i)})):(a[r].pending=!1,u(o)||o())}},this.unregister=function(r){if(a.hasOwnProperty(r)){var i=[];i.push({operations:["update"],statii:["delta"]}),!0===a[r].persistentSubscribe&&i.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),this._handleSubscriptions(r,i,"unsubscribe"),u(a[r].timeout)||clearTimeout(a[r].timeout),delete a[r]}else!0===t.debug&&console.error("attempting to unregister unknown thing: ",r)},this.update=function(t,r){var o=null;return u(r.version)?o=i._thingOperation(t,"update",r):console.error("message can't contain 'version' property"),o},this.get=function(t,r){var o={};return u(r)||(o.clientToken=r),i._thingOperation(t,"get",o)},this.delete=function(t,r){var o={};return u(r)||(o.clientToken=r),i._thingOperation(t,"delete",o)},this.publish=function(t,r,i,o){h.publish(t,r,i,o)},this.subscribe=function(t,r,i){var o=[];"string"==typeof t?o.push(t):"object"==typeof t&&t.length&&(o=t),h.subscribe(o,r,i)},this.unsubscribe=function(t,r){var i=[];"string"==typeof t?i.push(t):"object"==typeof t&&t.length&&(i=t),h.unsubscribe(i,r)},this.end=function(t,r){h.end(t,r)},this.updateWebSocketCredentials=function(t,r,i,o){h.updateWebSocketCredentials(t,r,i,o)},this.updateCustomAuthHeaders=function(t){h.updateCustomAuthHeaders(t)},this.setConnectionStatus=function(t){p=t},o.EventEmitter.call(this)}a(ThingShadowsClient,o.EventEmitter),t.exports=ThingShadowsClient},function(t,r,i){var o=i(45),a=i(209).inherits,c=i(208),u=i(153);function buildJobTopic(t,r,i){var o="$aws/things/"+t+"/jobs/";return u(i)?i=r:o+=r.toString()+"/",o+=i}function jobsClient(t){if(!(this instanceof jobsClient))return new jobsClient(t);var r=this,i=[],o=c.DeviceClient(t);this._updateJobStatus=function(r,i,a,c,l){"function"==typeof c&&(l=c,c=void 0),u(t)||!0!==t.debug||console.log("updateJobStatus:",{thingName:r,jobId:i.id,status:a,statusDetails:c}),o.publish(buildJobTopic(r,i.id,"update"),JSON.stringify({status:a,statusDetails:c}),null,(function(t){u(t)&&(i.status={status:a,statusDetails:c}),u(l)||l(t)}))},this._buildJobObject=function(t,i){if(u(i)||u(i.jobId))return null;var o={};return o.id=i.jobId,o.document=i.jobDocument,o.operation=o.document.operation,o.status={status:i.status,statusDetails:i.statusDetails},o.inProgress=function(i,a){r._updateJobStatus(t,o,"IN_PROGRESS",i,a)},o.failed=function(i,a){r._updateJobStatus(t,o,"FAILED",i,a)},o.succeeded=function(i,a){r._updateJobStatus(t,o,"SUCCEEDED",i,a)},o},this._handleMessages=function(o,a){var c=o.split("/");if(function isJobTopic(t){return"$aws"===t[0]&&"things"===t[1]&&"jobs"===t[3]}(c)){var l=c[2],d=i.find((function(t){return t.thingName===l}));if(!u(d)){var p={};try{p=JSON.parse(a.toString())}catch(r){return void(!0===t.debug&&console.error("failed parsing JSON '"+a.toString()+"', "+r))}if(!(u(p.execution)||u(p.execution.jobId)||u(p.execution.jobDocument))){var h=p.execution.jobDocument.operation,m=d.operations.find((function(t){return u(h)?u(t.operationName):h===t.operationName}));u(m)&&(m=d.operations.find((function(t){return u(t.operationName)})),u(m))||m.callback(null,r._buildJobObject(l,p.execution))}}}else r.emit("message",o,a)},this.subscribeToJobs=function(r,a,c){u(c)&&(c=a,a=null),u(t)||!0!==t.debug||console.log("subscribeToJobs:",{thingName:r,operationName:a});var l=i.find((function(t){return t.thingName===r}));u(l)&&(l={thingName:r,operations:[]},i.push(l),o.subscribe([buildJobTopic(r,"$next/get/accepted"),buildJobTopic(r,"notify-next")],(function(t,r){u(t)||c(t)})));var d=l.operations.find((function(t){return u(a)?u(t.operationName):a===t.operationName}));u(d)?(d={operationName:a,callback:c},l.operations.push(d)):d.callback=c},this.unsubscribeFromJobs=function(r,a,c){u(c)&&(c=a,a=null),u(t)||!0!==t.debug||console.log("unsubscribeFromJobs:",{thingName:r,operationName:a});var l=i.findIndex((function(t){return t.thingName===r})),d=new Error("subscription not found for given thing");if(l<0)c(d);else{var p=i[l].operations.findIndex((function(t){return u(a)?u(t.operationName):a===t.operationName}));if(p<0)c(d);else{if(i[l].operations.splice(p,1),0===i[l].operations.length)return i.splice(l,1),void o.unsubscribe([buildJobTopic(r,"$next/get/accepted"),buildJobTopic(r,"notify-next")],c);c()}}},this.startJobNotifications=function(r,i){u(t)||!0!==t.debug||console.log("startJobNotifications:",{thingName:r}),o.publish(buildJobTopic(r,"$next","get"),"{}",i)},o.on("connect",(function(){r.emit("connect")})),o.on("close",(function(){r.emit("close")})),o.on("reconnect",(function(){r.emit("reconnect")})),o.on("offline",(function(){r.emit("offline")})),o.on("error",(function(t){r.emit("error",t)})),o.on("message",r._handleMessages),this.publish=o.publish,this.subscribe=o.subscribe,this.unsubscribe=o.unsubscribe,this.end=o.end,this.handleMessage=o.handleMessage,this.updateWebSocketCredentials=o.updateWebSocketCredentials,this.simulateNetworkFailure=o.simulateNetworkFailure}a(jobsClient,o.EventEmitter),t.exports=jobsClient},function(t,r,i){"use strict";i.r(r);var o={};i.r(o),i.d(o,"shimGetUserMedia",(function(){return shimGetUserMedia})),i.d(o,"shimMediaStream",(function(){return shimMediaStream})),i.d(o,"shimOnTrack",(function(){return shimOnTrack})),i.d(o,"shimGetSendersWithDtmf",(function(){return shimGetSendersWithDtmf})),i.d(o,"shimSenderReceiverGetStats",(function(){return shimSenderReceiverGetStats})),i.d(o,"shimAddTrackRemoveTrackWithNative",(function(){return shimAddTrackRemoveTrackWithNative})),i.d(o,"shimAddTrackRemoveTrack",(function(){return shimAddTrackRemoveTrack})),i.d(o,"shimPeerConnection",(function(){return shimPeerConnection})),i.d(o,"fixNegotiationNeeded",(function(){return fixNegotiationNeeded}));var a={};i.r(a),i.d(a,"shimGetUserMedia",(function(){return getusermedia_shimGetUserMedia})),i.d(a,"shimGetDisplayMedia",(function(){return shimGetDisplayMedia})),i.d(a,"shimOnTrack",(function(){return firefox_shim_shimOnTrack})),i.d(a,"shimPeerConnection",(function(){return firefox_shim_shimPeerConnection})),i.d(a,"shimSenderGetStats",(function(){return shimSenderGetStats})),i.d(a,"shimReceiverGetStats",(function(){return shimReceiverGetStats})),i.d(a,"shimRemoveStream",(function(){return shimRemoveStream})),i.d(a,"shimRTCDataChannel",(function(){return shimRTCDataChannel})),i.d(a,"shimAddTransceiver",(function(){return shimAddTransceiver})),i.d(a,"shimGetParameters",(function(){return shimGetParameters})),i.d(a,"shimCreateOffer",(function(){return shimCreateOffer})),i.d(a,"shimCreateAnswer",(function(){return shimCreateAnswer}));var c={};i.r(c),i.d(c,"shimLocalStreamsAPI",(function(){return shimLocalStreamsAPI})),i.d(c,"shimRemoteStreamsAPI",(function(){return shimRemoteStreamsAPI})),i.d(c,"shimCallbacksAPI",(function(){return shimCallbacksAPI})),i.d(c,"shimGetUserMedia",(function(){return safari_shim_shimGetUserMedia})),i.d(c,"shimConstraints",(function(){return shimConstraints})),i.d(c,"shimRTCIceServerUrls",(function(){return shimRTCIceServerUrls})),i.d(c,"shimTrackEventTransceiver",(function(){return shimTrackEventTransceiver})),i.d(c,"shimCreateOfferLegacy",(function(){return shimCreateOfferLegacy})),i.d(c,"shimAudioContext",(function(){return shimAudioContext}));var u={};i.r(u),i.d(u,"shimRTCIceCandidate",(function(){return shimRTCIceCandidate})),i.d(u,"shimRTCIceCandidateRelayProtocol",(function(){return shimRTCIceCandidateRelayProtocol})),i.d(u,"shimMaxMessageSize",(function(){return shimMaxMessageSize})),i.d(u,"shimSendThrowTypeError",(function(){return shimSendThrowTypeError})),i.d(u,"shimConnectionState",(function(){return shimConnectionState})),i.d(u,"removeExtmapAllowMixed",(function(){return removeExtmapAllowMixed})),i.d(u,"shimAddIceCandidateNullOrEmpty",(function(){return shimAddIceCandidateNullOrEmpty})),i.d(u,"shimParameterlessSetLocalDescription",(function(){return shimParameterlessSetLocalDescription}));let l=!0,d=!0;function extractVersion(t,r,i){const o=t.match(r);return o&&o.length>=i&&parseInt(o[i],10)}function wrapPeerConnectionEvent(t,r,i){if(!t.RTCPeerConnection)return;const o=t.RTCPeerConnection.prototype,a=o.addEventListener;o.addEventListener=function(t,o){if(t!==r)return a.apply(this,arguments);const wrappedCallback=t=>{const r=i(t);r&&(o.handleEvent?o.handleEvent(r):o(r))};return this._eventMap=this._eventMap||{},this._eventMap[r]||(this._eventMap[r]=new Map),this._eventMap[r].set(o,wrappedCallback),a.apply(this,[t,wrappedCallback])};const c=o.removeEventListener;o.removeEventListener=function(t,i){if(t!==r||!this._eventMap||!this._eventMap[r])return c.apply(this,arguments);if(!this._eventMap[r].has(i))return c.apply(this,arguments);const o=this._eventMap[r].get(i);return this._eventMap[r].delete(i),0===this._eventMap[r].size&&delete this._eventMap[r],0===Object.keys(this._eventMap).length&&delete this._eventMap,c.apply(this,[t,o])},Object.defineProperty(o,"on"+r,{get(){return this["_on"+r]},set(t){this["_on"+r]&&(this.removeEventListener(r,this["_on"+r]),delete this["_on"+r]),t&&this.addEventListener(r,this["_on"+r]=t)},enumerable:!0,configurable:!0})}function disableLog(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(l=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function disableWarnings(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(d=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function log(){if("object"==typeof window){if(l)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function deprecated(t,r){d&&console.warn(t+" is deprecated, please use "+r+" instead.")}function isObject(t){return"[object Object]"===Object.prototype.toString.call(t)}function compactObject(t){return isObject(t)?Object.keys(t).reduce((function(r,i){const o=isObject(t[i]),a=o?compactObject(t[i]):t[i],c=o&&!Object.keys(a).length;return void 0===a||c?r:Object.assign(r,{[i]:a})}),{}):t}function filterStats(t,r,i){const o=i?"outbound-rtp":"inbound-rtp",a=new Map;if(null===r)return a;const c=[];return t.forEach(t=>{"track"===t.type&&t.trackIdentifier===r.id&&c.push(t)}),c.forEach(r=>{t.forEach(i=>{i.type===o&&i.trackId===r.id&&function walkStats(t,r,i){r&&!i.has(r.id)&&(i.set(r.id,r),Object.keys(r).forEach(o=>{o.endsWith("Id")?walkStats(t,t.get(r[o]),i):o.endsWith("Ids")&&r[o].forEach(r=>{walkStats(t,t.get(r),i)})}))}(t,i,a)})}),a}const p=log;function shimGetUserMedia(t,r){const i=t&&t.navigator;if(!i.mediaDevices)return;const constraintsToChrome_=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const r={};return Object.keys(t).forEach(i=>{if("require"===i||"advanced"===i||"mediaSource"===i)return;const o="object"==typeof t[i]?t[i]:{ideal:t[i]};void 0!==o.exact&&"number"==typeof o.exact&&(o.min=o.max=o.exact);const oldname_=function(t,r){return t?t+r.charAt(0).toUpperCase()+r.slice(1):"deviceId"===r?"sourceId":r};if(void 0!==o.ideal){r.optional=r.optional||[];let t={};"number"==typeof o.ideal?(t[oldname_("min",i)]=o.ideal,r.optional.push(t),t={},t[oldname_("max",i)]=o.ideal,r.optional.push(t)):(t[oldname_("",i)]=o.ideal,r.optional.push(t))}void 0!==o.exact&&"number"!=typeof o.exact?(r.mandatory=r.mandatory||{},r.mandatory[oldname_("",i)]=o.exact):["min","max"].forEach(t=>{void 0!==o[t]&&(r.mandatory=r.mandatory||{},r.mandatory[oldname_(t,i)]=o[t])})}),t.advanced&&(r.optional=(r.optional||[]).concat(t.advanced)),r},shimConstraints_=function(t,o){if(r.version>=61)return o(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const remap=function(t,r,i){r in t&&!(i in t)&&(t[i]=t[r],delete t[r])};remap((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),remap(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=constraintsToChrome_(t.audio)}if(t&&"object"==typeof t.video){let a=t.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});const c=r.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!i.mediaDevices.getSupportedConstraints||!i.mediaDevices.getSupportedConstraints().facingMode||c)){let r;if(delete t.video.facingMode,"environment"===a.exact||"environment"===a.ideal?r=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(r=["front"]),r)return i.mediaDevices.enumerateDevices().then(i=>{let c=(i=i.filter(t=>"videoinput"===t.kind)).find(t=>r.some(r=>t.label.toLowerCase().includes(r)));return!c&&i.length&&r.includes("back")&&(c=i[i.length-1]),c&&(t.video.deviceId=a.exact?{exact:c.deviceId}:{ideal:c.deviceId}),t.video=constraintsToChrome_(t.video),p("chrome: "+JSON.stringify(t)),o(t)})}t.video=constraintsToChrome_(t.video)}return p("chrome: "+JSON.stringify(t)),o(t)},shimError_=function(t){return r.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(i.getUserMedia=function(t,r,o){shimConstraints_(t,t=>{i.webkitGetUserMedia(t,r,t=>{o&&o(shimError_(t))})})}.bind(i),i.mediaDevices.getUserMedia){const t=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(r){return shimConstraints_(r,r=>t(r).then(t=>{if(r.audio&&!t.getAudioTracks().length||r.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(t=>{t.stop()}),new DOMException("","NotFoundError");return t},t=>Promise.reject(shimError_(t))))}}}function shimMediaStream(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function shimOnTrack(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){return this._ontrackpoly||(this._ontrackpoly=r=>{r.stream.addEventListener("addtrack",i=>{let o;o=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===i.track.id):{track:i.track};const a=new Event("track");a.track=i.track,a.receiver=o,a.transceiver={receiver:o},a.streams=[r.stream],this.dispatchEvent(a)}),r.stream.getTracks().forEach(i=>{let o;o=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===i.id):{track:i};const a=new Event("track");a.track=i,a.receiver=o,a.transceiver={receiver:o},a.streams=[r.stream],this.dispatchEvent(a)})},this.addEventListener("addstream",this._ontrackpoly)),r.apply(this,arguments)}}else wrapPeerConnectionEvent(t,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function shimGetSendersWithDtmf(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const shimSenderWithDtmf=function(t,r){return{track:r,get dtmf(){return void 0===this._dtmf&&("audio"===r.kind?this._dtmf=t.createDTMFSender(r):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function getSenders(){return this._senders=this._senders||[],this._senders.slice()};const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function addTrack(t,i){let o=r.apply(this,arguments);return o||(o=shimSenderWithDtmf(this,t),this._senders.push(o)),o};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){i.apply(this,arguments);const r=this._senders.indexOf(t);-1!==r&&this._senders.splice(r,1)}}const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach(t=>{this._senders.push(shimSenderWithDtmf(this,t))})};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._senders=this._senders||[],i.apply(this,[t]),t.getTracks().forEach(t=>{const r=this._senders.find(r=>r.track===t);r&&this._senders.splice(this._senders.indexOf(r),1)})}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t},Object.defineProperty(t.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 shimSenderReceiverGetStats(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t});const i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function addTrack(){const t=i.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function getStats(){const t=this;return this._pc.getStats().then(r=>filterStats(r,t.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function getReceivers(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t}),wrapPeerConnectionEvent(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function getStats(){const t=this;return this._pc.getStats().then(r=>filterStats(r,t.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function getStats(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let r,i,o;return this.getSenders().forEach(i=>{i.track===t&&(r?o=!0:r=i)}),this.getReceivers().forEach(r=>(r.track===t&&(i?o=!0:i=r),r.track===t)),o||r&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return r.apply(this,arguments)}}function shimAddTrackRemoveTrackWithNative(t){t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(t=>this._shimmedLocalStreams[t][0])};const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function addTrack(t,i){if(!i)return r.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const o=r.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(o)&&this._shimmedLocalStreams[i.id].push(o):this._shimmedLocalStreams[i.id]=[i,o],o};const i=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach(t=>{if(this.getSenders().find(r=>r.track===t))throw new DOMException("Track already exists.","InvalidAccessError")});const r=this.getSenders();i.apply(this,arguments);const o=this.getSenders().filter(t=>-1===r.indexOf(t));this._shimmedLocalStreams[t.id]=[t].concat(o)};const o=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function removeStream(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],o.apply(this,arguments)};const a=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach(r=>{const i=this._shimmedLocalStreams[r].indexOf(t);-1!==i&&this._shimmedLocalStreams[r].splice(i,1),1===this._shimmedLocalStreams[r].length&&delete this._shimmedLocalStreams[r]}),a.apply(this,arguments)}}function shimAddTrackRemoveTrack(t,r){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&r.version>=65)return shimAddTrackRemoveTrackWithNative(t);const i=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){const t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map(t=>this._reverseStreams[t.id])};const o=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(r){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.getTracks().forEach(t=>{if(this.getSenders().find(r=>r.track===t))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[r.id]){const i=new t.MediaStream(r.getTracks());this._streams[r.id]=i,this._reverseStreams[i.id]=r,r=i}o.apply(this,[r])};const a=t.RTCPeerConnection.prototype.removeStream;function replaceInternalStreamId(t,r){let i=r.sdp;return Object.keys(t._reverseStreams||[]).forEach(r=>{const o=t._reverseStreams[r],a=t._streams[o.id];i=i.replace(new RegExp(a.id,"g"),o.id)}),new RTCSessionDescription({type:r.type,sdp:i})}function replaceExternalStreamId(t,r){let i=r.sdp;return Object.keys(t._reverseStreams||[]).forEach(r=>{const o=t._reverseStreams[r],a=t._streams[o.id];i=i.replace(new RegExp(o.id,"g"),a.id)}),new RTCSessionDescription({type:r.type,sdp:i})}t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},a.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function addTrack(r,i){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const o=[].slice.call(arguments,1);if(1!==o.length||!o[0].getTracks().find(t=>t===r))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const a=this.getSenders().find(t=>t.track===r);if(a)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const c=this._streams[i.id];if(c)c.addTrack(r),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const o=new t.MediaStream([r]);this._streams[i.id]=o,this._reverseStreams[o.id]=i,this.addStream(o)}return this.getSenders().find(t=>t.track===r)},["createOffer","createAnswer"].forEach((function(r){const i=t.RTCPeerConnection.prototype[r],o={[r](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?i.apply(this,[r=>{const i=replaceInternalStreamId(this,r);t[0].apply(null,[i])},r=>{t[1]&&t[1].apply(null,r)},arguments[2]]):i.apply(this,arguments).then(t=>replaceInternalStreamId(this,t))}};t.RTCPeerConnection.prototype[r]=o[r]}));const c=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function setLocalDescription(){return arguments.length&&arguments[0].type?(arguments[0]=replaceExternalStreamId(this,arguments[0]),c.apply(this,arguments)):c.apply(this,arguments)};const u=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=u.get.apply(this);return""===t.type?t:replaceInternalStreamId(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let r;this._streams=this._streams||{},Object.keys(this._streams).forEach(i=>{this._streams[i].getTracks().find(r=>t.track===r)&&(r=this._streams[i])}),r&&(1===r.getTracks().length?this.removeStream(this._reverseStreams[r.id]):r.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function shimPeerConnection(t,r){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(r){const i=t.RTCPeerConnection.prototype[r],o={[r](){return arguments[0]=new("addIceCandidate"===r?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=o[r]}))}function fixNegotiationNeeded(t,r){wrapPeerConnectionEvent(t,"negotiationneeded",t=>{const i=t.target;if(!(r.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return t})}function getusermedia_shimGetUserMedia(t,r){const i=t&&t.navigator,o=t&&t.MediaStreamTrack;if(i.getUserMedia=function(t,r,o){deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(t).then(r,o)},!(r.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){const remap=function(t,r,i){r in t&&!(i in t)&&(t[i]=t[r],delete t[r])},t=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),remap(r.audio,"autoGainControl","mozAutoGainControl"),remap(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},o&&o.prototype.getSettings){const t=o.prototype.getSettings;o.prototype.getSettings=function(){const r=t.apply(this,arguments);return remap(r,"mozAutoGainControl","autoGainControl"),remap(r,"mozNoiseSuppression","noiseSuppression"),r}}if(o&&o.prototype.applyConstraints){const t=o.prototype.applyConstraints;o.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),remap(r,"autoGainControl","mozAutoGainControl"),remap(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function shimGetDisplayMedia(t,r){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function getDisplayMedia(i){if(!i||!i.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===i.video?i.video={mediaSource:r}:i.video.mediaSource=r,t.navigator.mediaDevices.getUserMedia(i)})}function firefox_shim_shimOnTrack(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function firefox_shim_shimPeerConnection(t,r){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(r){const i=t.RTCPeerConnection.prototype[r],o={[r](){return arguments[0]=new("addIceCandidate"===r?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=o[r]}));const i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},o=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function getStats(){const[t,a,c]=arguments;return o.apply(this,[t||null]).then(t=>{if(r.version<53&&!a)try{t.forEach(t=>{t.type=i[t.type]||t.type})}catch(r){if("TypeError"!==r.name)throw r;t.forEach((r,o)=>{t.set(o,Object.assign({},r,{type:i[r.type]||r.type}))})}return t}).then(a,c)}}function shimSenderGetStats(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t});const i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function addTrack(){const t=i.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function getStats(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function shimReceiverGetStats(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function getReceivers(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t}),wrapPeerConnectionEvent(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function getStats(){return this._pc.getStats(this.track)}}function shimRemoveStream(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function removeStream(t){deprecated("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&t.getTracks().includes(r.track)&&this.removeTrack(r)})})}function shimRTCDataChannel(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function shimAddTransceiver(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype.addTransceiver;r&&(t.RTCPeerConnection.prototype.addTransceiver=function addTransceiver(){this.setParametersPromises=[];let t=arguments[1]&&arguments[1].sendEncodings;void 0===t&&(t=[]),t=[...t];const i=t.length>0;i&&t.forEach(t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const o=r.apply(this,arguments);if(i){const{sender:r}=o,i=r.getParameters();(!("encodings"in i)||1===i.encodings.length&&0===Object.keys(i.encodings[0]).length)&&(i.encodings=t,r.sendEncodings=t,this.setParametersPromises.push(r.setParameters(i).then(()=>{delete r.sendEncodings}).catch(()=>{delete r.sendEncodings})))}return o})}function shimGetParameters(t){if("object"!=typeof t||!t.RTCRtpSender)return;const r=t.RTCRtpSender.prototype.getParameters;r&&(t.RTCRtpSender.prototype.getParameters=function getParameters(){const t=r.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function shimCreateOffer(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function createOffer(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>r.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):r.apply(this,arguments)}}function shimCreateAnswer(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function createAnswer(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>r.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):r.apply(this,arguments)}}function shimLocalStreamsAPI(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach(i=>r.call(this,i,t)),t.getVideoTracks().forEach(i=>r.call(this,i,t))},t.RTCPeerConnection.prototype.addTrack=function addTrack(t,...i){return i&&i.forEach(t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]}),r.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._localStreams||(this._localStreams=[]);const r=this._localStreams.indexOf(t);if(-1===r)return;this._localStreams.splice(r,1);const i=t.getTracks();this.getSenders().forEach(t=>{i.includes(t.track)&&this.removeTrack(t)})})}}function shimRemoteStreamsAPI(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function getRemoteStreams(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach(t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,this.dispatchEvent(r)})})}});const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(r=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(r)>=0)return;t._remoteStreams.push(r);const i=new Event("addstream");i.stream=r,t.dispatchEvent(i)})}),r.apply(t,arguments)}}}function shimCallbacksAPI(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.createOffer,o=r.createAnswer,a=r.setLocalDescription,c=r.setRemoteDescription,u=r.addIceCandidate;r.createOffer=function createOffer(t,r){const o=arguments.length>=2?arguments[2]:arguments[0],a=i.apply(this,[o]);return r?(a.then(t,r),Promise.resolve()):a},r.createAnswer=function createAnswer(t,r){const i=arguments.length>=2?arguments[2]:arguments[0],a=o.apply(this,[i]);return r?(a.then(t,r),Promise.resolve()):a};let withCallback=function(t,r,i){const o=a.apply(this,[t]);return i?(o.then(r,i),Promise.resolve()):o};r.setLocalDescription=withCallback,withCallback=function(t,r,i){const o=c.apply(this,[t]);return i?(o.then(r,i),Promise.resolve()):o},r.setRemoteDescription=withCallback,withCallback=function(t,r,i){const o=u.apply(this,[t]);return i?(o.then(r,i),Promise.resolve()):o},r.addIceCandidate=withCallback}function safari_shim_shimGetUserMedia(t){const r=t&&t.navigator;if(r.mediaDevices&&r.mediaDevices.getUserMedia){const t=r.mediaDevices,i=t.getUserMedia.bind(t);r.mediaDevices.getUserMedia=t=>i(shimConstraints(t))}!r.getUserMedia&&r.mediaDevices&&r.mediaDevices.getUserMedia&&(r.getUserMedia=function getUserMedia(t,i,o){r.mediaDevices.getUserMedia(t).then(i,o)}.bind(r))}function shimConstraints(t){return t&&void 0!==t.video?Object.assign({},t,{video:compactObject(t.video)}):t}function shimRTCIceServerUrls(t){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection;t.RTCPeerConnection=function RTCPeerConnection(t,i){if(t&&t.iceServers){const r=[];for(let i=0;i<t.iceServers.length;i++){let o=t.iceServers[i];void 0===o.urls&&o.url?(deprecated("RTCIceServer.url","RTCIceServer.urls"),o=JSON.parse(JSON.stringify(o)),o.urls=o.url,delete o.url,r.push(o)):r.push(t.iceServers[i])}t.iceServers=r}return new r(t,i)},t.RTCPeerConnection.prototype=r.prototype,"generateCertificate"in r&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>r.generateCertificate})}function shimTrackEventTransceiver(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function shimCreateOfferLegacy(t){const r=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function createOffer(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const r=this.getTransceivers().find(t=>"audio"===t.receiver.track.kind);!1===t.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==t.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const i=this.getTransceivers().find(t=>"video"===t.receiver.track.kind);!1===t.offerToReceiveVideo&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==t.offerToReceiveVideo||i||this.addTransceiver("video",{direction:"recvonly"})}return r.apply(this,arguments)}}function shimAudioContext(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var h=i(62),m=i.n(h);function shimRTCIceCandidate(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const r=t.RTCIceCandidate;t.RTCIceCandidate=function RTCIceCandidate(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substring(2)),t.candidate&&t.candidate.length){const i=new r(t),o=m.a.parseCandidate(t.candidate);for(const t in o)t in i||Object.defineProperty(i,t,{value:o[t]});return i.toJSON=function toJSON(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new r(t)},t.RTCIceCandidate.prototype=r.prototype,wrapPeerConnectionEvent(t,"icecandidate",r=>(r.candidate&&Object.defineProperty(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}function shimRTCIceCandidateRelayProtocol(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||wrapPeerConnectionEvent(t,"icecandidate",t=>{if(t.candidate){const r=m.a.parseCandidate(t.candidate.candidate);"relay"===r.type&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[r.priority>>24])}return t})}function shimMaxMessageSize(t,r){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const sctpInDescription=function(t){if(!t||!t.sdp)return!1;const r=m.a.splitSections(t.sdp);return r.shift(),r.some(t=>{const r=m.a.parseMLine(t);return r&&"application"===r.kind&&-1!==r.protocol.indexOf("SCTP")})},getRemoteFirefoxVersion=function(t){const r=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===r||r.length<2)return-1;const i=parseInt(r[1],10);return i!=i?-1:i},getCanSendMaxMessageSize=function(t){let i=65536;return"firefox"===r.browser&&(i=r.version<57?-1===t?16384:2147483637:r.version<60?57===r.version?65535:65536:2147483637),i},getMaxMessageSize=function(t,i){let o=65536;"firefox"===r.browser&&57===r.version&&(o=65535);const a=m.a.matchPrefix(t.sdp,"a=max-message-size:");return a.length>0?o=parseInt(a[0].substring(19),10):"firefox"===r.browser&&-1!==i&&(o=2147483637),o},i=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){if(this._sctp=null,"chrome"===r.browser&&r.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(sctpInDescription(arguments[0])){const t=getRemoteFirefoxVersion(arguments[0]),r=getCanSendMaxMessageSize(t),i=getMaxMessageSize(arguments[0],t);let o;o=0===r&&0===i?Number.POSITIVE_INFINITY:0===r||0===i?Math.max(r,i):Math.min(r,i);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>o}),this._sctp=a}return i.apply(this,arguments)}}function shimSendThrowTypeError(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function wrapDcSend(t,r){const i=t.send;t.send=function send(){const o=arguments[0],a=o.length||o.size||o.byteLength;if("open"===t.readyState&&r.sctp&&a>r.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+r.sctp.maxMessageSize+" bytes)");return i.apply(t,arguments)}}const r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function createDataChannel(){const t=r.apply(this,arguments);return wrapDcSend(t,this),t},wrapPeerConnectionEvent(t,"datachannel",t=>(wrapDcSend(t.channel,t.target),t))}function shimConnectionState(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const r=t.RTCPeerConnection.prototype;Object.defineProperty(r,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(r,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const i=r[t];r[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const r=t.target;if(r._lastConnectionState!==r.connectionState){r._lastConnectionState=r.connectionState;const i=new Event("connectionstatechange",t);r.dispatchEvent(i)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}})}function removeExtmapAllowMixed(t,r){if(!t.RTCPeerConnection)return;if("chrome"===r.browser&&r.version>=71)return;if("safari"===r.browser&&r.version>=605)return;const i=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(r){if(r&&r.sdp&&-1!==r.sdp.indexOf("\na=extmap-allow-mixed")){const i=r.sdp.split("\n").filter(t=>"a=extmap-allow-mixed"!==t.trim()).join("\n");t.RTCSessionDescription&&r instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:r.type,sdp:i}):r.sdp=i}return i.apply(this,arguments)}}function shimAddIceCandidateNullOrEmpty(t,r){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const i=t.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function addIceCandidate(){return arguments[0]?("chrome"===r.browser&&r.version<78||"firefox"===r.browser&&r.version<68||"safari"===r.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function shimParameterlessSetLocalDescription(t,r){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const i=t.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function setLocalDescription(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return i.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return i.apply(this,[t]);const r="offer"===t.type?this.createOffer:this.createAnswer;return r.apply(this).then(t=>i.apply(this,[t]))})}var g=function adapterFactory({window:t}={},r={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const i=log,l=function detectBrowser(t){const r={browser:null,version:null};if(void 0===t||!t.navigator||!t.navigator.userAgent)return r.browser="Not a browser.",r;const{navigator:i}=t;if(i.userAgentData&&i.userAgentData.brands){const t=i.userAgentData.brands.find(t=>"Chromium"===t.brand);if(t)return{browser:"chrome",version:parseInt(t.version,10)}}if(i.mozGetUserMedia)r.browser="firefox",r.version=extractVersion(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection)r.browser="chrome",r.version=extractVersion(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return r.browser="Not a supported browser.",r;r.browser="safari",r.version=extractVersion(i.userAgent,/AppleWebKit\/(\d+)\./,1),r.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return r}(t),d={browserDetails:l,commonShim:u,extractVersion:extractVersion,disableLog:disableLog,disableWarnings:disableWarnings,sdp:h};switch(l.browser){case"chrome":if(!o||!shimPeerConnection||!r.shimChrome)return i("Chrome shim is not included in this adapter release."),d;if(null===l.version)return i("Chrome shim can not determine version, not shimming."),d;i("adapter.js shimming chrome."),d.browserShim=o,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),shimGetUserMedia(t,l),shimMediaStream(t),shimPeerConnection(t,l),shimOnTrack(t),shimAddTrackRemoveTrack(t,l),shimGetSendersWithDtmf(t),shimSenderReceiverGetStats(t),fixNegotiationNeeded(t,l),shimRTCIceCandidate(t),shimRTCIceCandidateRelayProtocol(t),shimConnectionState(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t),removeExtmapAllowMixed(t,l);break;case"firefox":if(!a||!firefox_shim_shimPeerConnection||!r.shimFirefox)return i("Firefox shim is not included in this adapter release."),d;i("adapter.js shimming firefox."),d.browserShim=a,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),getusermedia_shimGetUserMedia(t,l),firefox_shim_shimPeerConnection(t,l),firefox_shim_shimOnTrack(t),shimRemoveStream(t),shimSenderGetStats(t),shimReceiverGetStats(t),shimRTCDataChannel(t),shimAddTransceiver(t),shimGetParameters(t),shimCreateOffer(t),shimCreateAnswer(t),shimRTCIceCandidate(t),shimConnectionState(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t);break;case"safari":if(!c||!r.shimSafari)return i("Safari shim is not included in this adapter release."),d;i("adapter.js shimming safari."),d.browserShim=c,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),shimRTCIceServerUrls(t),shimCreateOfferLegacy(t),shimCallbacksAPI(t),shimLocalStreamsAPI(t),shimRemoteStreamsAPI(t),shimTrackEventTransceiver(t),safari_shim_shimGetUserMedia(t),shimAudioContext(t),shimRTCIceCandidate(t),shimRTCIceCandidateRelayProtocol(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t),removeExtmapAllowMixed(t,l);break;default:i("Unsupported browser!")}return d}({window:"undefined"==typeof window?void 0:window}),y=i(37);const getFingerPrint=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Promise.resolve(generateFingerprint(getRandomNumberGenerator(getId()+t+r)))},generateFingerprint=function(t){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var i=16*t()%16|0;return("x"===r?i:3&i|8).toString(16)}))},getId=function(){let t=localStorage.getItem("reactoo-id");return t||(t=Math.round(Math.random()*Math.pow(10,16))+"",localStorage.setItem("reactoo-id",t)),t},getRandomNumberGenerator=function(t){let r,i;for(r=0,i=1779033703^(t=(t||Math.floor(1e16*Math.random()))+"").length;r<t.length;r++)i=Math.imul(i^t.charCodeAt(r),3432918353),i=i<<13|i>>>19;return i=Math.imul(i^i>>>16,2246822507),i=Math.imul(i^i>>>13,3266489909),t=(i^i>>>16)>>>0,function(){let r=t+=1831565813;return r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r),((r^r>>>14)>>>0)/4294967296}};let wait=function(t){return new Promise(r=>setTimeout(r,t))},getBrowserFingerprint=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return getFingerPrint(t,r)},generateUUID=function(){var t=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==r?i:3&i|8).toString(16)}))};const decodeJanusDisplay=t=>{let r={userId:null,role:"participant",start:Date.now(),displayName:"?"};if(t&&"string"==typeof t){if(t.indexOf(",")>=0){let i=t.split(new RegExp('\\,(?=(?:(?:[^"]*"){2})*[^"]*$)',"mi")).map(t=>t&&t.startsWith('"')||t.endsWith('"')?t.substring(1,t.length-1):/^\d+$/.test(t)?parseInt(t):t);Object.keys(r).forEach((t,o)=>i[o]?r[t]=i[o]:null)}else r.userId=t;return r}return t&&"object"==typeof t?Object.assign({},r,t):null},setExactTimeout=function(t,r,i){const o=(new Date).getTime(),a=setInterval((function(){(new Date).getTime()-o>r&&(t(),clearInterval(a))}),i);return a},chunkArray=(t,r)=>{var i;if(null===(i=t=[...t])||void 0===i||!i.length)return[[]];let o=[];for(;t.length;)o.push(t.splice(0,r));return o};function _defineProperty(t,r,i){return(r=function _toPropertyKey(t){var r=function _toPrimitive(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,r||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(r))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}class wt_room_Room{constructor(t){this.debug=t,this.sessions=[],this.safariVp8=!1,this.browser=g.browserDetails.browser,this.browserDetails=g.browserDetails,this.webrtcSupported=wt_room_Room.isWebrtcSupported(),this.safariVp8TestPromise=wt_room_Room.testSafariVp8(),this.safariVp8=null,this.safariVp8TestPromise.then(t=>{this.safariVp8=t}),this.whenInitialized=this.initialize()}initialize(){return this.safariVp8TestPromise.then(()=>this)}createSession(){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new wt_room_RoomSession(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"reactooroom",{debug:this.debug,...t})}static testSafariVp8(){return new Promise(t=>{if("safari"===g.browserDetails.browser&&g.browserDetails.version>=605)if(RTCRtpSender&&RTCRtpSender.getCapabilities&&RTCRtpSender.getCapabilities("video")&&RTCRtpSender.getCapabilities("video").codecs&&RTCRtpSender.getCapabilities("video").codecs.length){var r=!1;for(var i in RTCRtpSender.getCapabilities("video").codecs){var o=RTCRtpSender.getCapabilities("video").codecs[i];if(o&&o.mimeType&&"video/vp8"===o.mimeType.toLowerCase()){r=!0;break}}t(r)}else{var a=new RTCPeerConnection({},{});a.createOffer({offerToReceiveVideo:!0}).then((function(r){let i=-1!==r.sdp.indexOf("VP8");a.close(),a=null,t(i)}))}else t(!1)})}static isWebrtcSupported(){return void 0!==window.RTCPeerConnection&&null!==window.RTCPeerConnection&&void 0!==navigator.mediaDevices&&null!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia&&null!==navigator.mediaDevices.getUserMedia}}class wt_room_RoomSession{static noop(){}static randomString(t){for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i="",o=0;o<t;o++){var a=Math.floor(Math.random()*r.length);i+=r.substring(a,a+1)}return i}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"reactooroom",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_defineProperty(this,"_intercomSubscribe",t=>{var r;if("data"===t.type)return!0;return((null===(r=JSON.parse(t.description||"[]"))||void 0===r?void 0:r.intercomGroups)||[]).some(t=>this._listenIntercomChannels.indexOf(t)>-1)}),Object.assign(this,Object(y.a)()),this.options={...i},this.defaultDataChannelLabel="JanusDataChannel",this.server=null,this.iceServers=null,this.token=null,this.roomId=null,this.streamId=null,this.pin=null,this.userId=null,this.sessiontype=r,this.initialBitrate=0,this.enableDtx=!1,this.simulcast=!1,this.defaultSimulcastSettings={default:{mode:"controlled",defaultSubstream:0,bitrates:[{rid:"l",active:!0,maxBitrate:18e4,maxFramerate:20,scaleResolutionDownBy:3.3333333333333335,priority:"low"},{rid:"m",active:!0,maxBitrate:5e5,maxFramerate:25,scaleResolutionDownBy:1.3333333333333335,priority:"low"},{rid:"h",active:!0,maxBitrate:2e6,maxFramerate:30,priority:"low"}]}},this.recordingFilename=null,this.pluginName=wt_room_RoomSession.sessionTypes[r],this.id=null,this.privateId=null,this.constructId=t||wt_room_RoomSession.randomString(16),this.sessionId=null,this.handleId=null,this.ws=null,this.isRestarting=!1,this.isConnecting=!1,this.isDisconnecting=!1,this.isConnected=!1,this.isPublished=!1,this.isReclaiming=!1,this.isStreaming=!1,this.isMuted=[],this.isVideoEnabled=!1,this.isAudioEnabed=!1,this._statsMaxLength=31,this._upStatsLength=30,this._downStatsLength=5,this._statsTimeoutStopped=!0,this._statsTimeoutId=null,this._statsInterval=1e3,this._aqInterval=2500,this._aqIntervalCounter=0,this._aqIntervalDivisor=4,this._aqTimeoutId=null,this._sendMessageTimeout=5e3,this._retries=0,this._maxRetries=5,this._keepAliveId=null,this._participants=[],this._restrictSubscribeToUserIds=[],this._talkIntercomChannels=["participants"],this._listenIntercomChannels=["participants"],this._roomType="watchparty",this._isDataChannelOpen=!1,this._abortController=null,this._remoteUsersCache=[],this.userRoleSubscriptionRules={...wt_room_RoomSession.userRoleSubscriptionRules,...this.options.userRoleSubscriptionRules||{}},this._log=wt_room_RoomSession.noop,this.options.debug&&this._enableDebug()}_pushToRemoteUsersCache(t,r,i){const o=this._remoteUsersCache.findIndex(r=>r.userId===t);o>-1?this._remoteUsersCache.splice(o,1,{userId:t,streams:r,id:i}):this._remoteUsersCache.push({userId:t,streams:r,id:i})}_removeFromRemoteUsersCache(t){const r=this._remoteUsersCache.findIndex(r=>r.id===t);r>-1&&this._remoteUsersCache.splice(r,1)}_participantShouldSubscribe(t){const r=decodeJanusDisplay(this.display),i=decodeJanusDisplay(t);let o=(null==r?void 0:r.role)||"participant",a=(null==i?void 0:i.role)||"participant";return this.userRoleSubscriptionRules[o][this._roomType||"watchparty"].indexOf(a)>-1&&(0===this._restrictSubscribeToUserIds.length||this._restrictSubscribeToUserIds.indexOf(null==i?void 0:i.userId)>-1)}_getAddParticipantEventName(t){var r;let i=this._getHandle(t);if(!i)return void this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"getParticipantEventName"]});switch(null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.role){case"participant":return"addRemoteParticipant";case"talkback":case"monitor":return"addRemoteTalkback";case"observer":case"observerSolo1":case"observerSolo2":case"observerSolo3":return"addRemoteObserver";case"host":return"addRemoteInstructor";case"companionTV":return"addRemoteCompanionTV";case"companionPhone":return"addRemoteCompanionPhone";default:return"addRemoteParticipant"}}_getRemoveParticipantEventName(t){var r;let i=this._getHandle(t);if(!i)return void this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"getParticipantEventName"]});switch(null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.role){case"participant":return"removeRemoteParticipant";case"talkback":case"monitor":return"removeRemoteTalkback";case"observer":case"observerSolo1":case"observerSolo2":case"observerSolo3":return"removeRemoteObserver";case"host":return"removeRemoteInstructor";case"companionTV":return"removeRemoteCompanionTV";case"companionPhone":return"removeRemoteCompanionPhone";default:return"removeRemoteParticipant"}}sendMessage(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{body:"Example Body"},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return this._send({janus:"message",handle_id:t,...r},i,o,a).then(t=>{if(t&&"success"===t.janus){let r=(t.plugindata||{}).data;return Promise.resolve(r)}return Promise.resolve()}).catch(t=>t&&t.error?Promise.reject({type:"warning",id:1,message:"sendMessage failed",data:t.error}):Promise.reject({type:"warning",id:1,message:"sendMessage failed",data:t}))}_send(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=wt_room_RoomSession.randomString(12),c={...t,transaction:a,token:this.token,...this.sessionId&&{session_id:this.sessionId}||{}};this._log(c);return(()=>new Promise((t,o)=>{let u=null,abortResponse=()=>{this._abortController.signal.removeEventListener("abort",abortResponse),clearTimeout(u),this.ws.removeEventListener("message",parseResponse),o({type:"warning",id:17,message:"connection cancelled"})},parseResponse=r=>{let l=JSON.parse(r.data);var d;l.transaction!==a||i&&"ack"===l.janus||(clearTimeout(u),this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),"error"===l.janus?(403==(null==l||null===(d=l.error)||void 0===d?void 0:d.code)&&this.disconnect(!0),o({type:"error",id:2,message:"send failed",data:l,requestData:c})):t(l))};r?(this.ws&&1===this.ws.readyState&&this.ws.send(JSON.stringify(c)),t()):this.ws&&1===this.ws.readyState?(this.ws.addEventListener("message",parseResponse),u=setTimeout(()=>{this.ws.removeEventListener("message",parseResponse),this._abortController.signal.removeEventListener("abort",abortResponse),o({type:"warning",id:3,message:"send timeout",data:c})},this._sendMessageTimeout),this._abortController.signal.addEventListener("abort",abortResponse),this.ws.send(JSON.stringify(c))):o({type:"warning",id:29,message:"No connection to WebSockets",data:c})}))().catch(a=>17===a.id?Promise.reject(a):29===a.id&&o>0?wait(this._sendMessageTimeout).then(()=>this._send(t,r,i,o-1)):o>0?this._send(t,r,i,o-1):Promise.reject(a))}_connectionClosed(){!this.isConnected||this.isConnecting||this.isDisconnecting||(this._retries<this._maxRetries?setTimeout(()=>{this._retries++,this._reconnect().catch(t=>{this.emit("error",t)})},3e3*this._retries):("reactooroom"===this.sessiontype?this.disconnect(!0):"streaming"===this.sessiontype&&this.stopStream(),this.emit("error",{type:"error",id:4,message:"Lost connection to WebSockets",data:null})))}_wipeListeners(){this.ws&&(this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn))}_startKeepAlive(){this._send({janus:"keepalive"}).then(t=>{"ack"!==t.janus&&this.emit("error",{type:"warning",id:5,message:"keepalive response suspicious",data:t.janus})}).catch(t=>{this.emit("error",{type:"warning",id:6,message:"keepalive dead",data:t}),this._connectionClosed()}),this._keepAliveId=setTimeout(()=>{this._startKeepAlive()},1e4)}_stopKeepAlive(){clearTimeout(this._keepAliveId)}_handleWsEvents(t){let r=JSON.parse(t.data);var i=r.sender,o=r.janus;let a=this._getHandle(i);if(a){if("trickle"===o){let t=r.candidate,i=a.webrtcStuff;i.pc&&i.remoteSdp?t&&!0!==t.completed?i.pc.addIceCandidate(t):i.pc.addIceCandidate(null):(i.candidates||(i.candidates=[]),i.candidates.push(t))}else"webrtcup"===o||("hangup"===o?(this._log("hangup on",a.handleId,a.handleId===this.handleId,r),this._removeParticipant(a.handleId,null,!1)):"detached"===o?(this._log("detached on",a.handleId,a.handleId===this.handleId,r),this._removeParticipant(a.handleId,null,!0)):"media"===o?this._log("Media event:",a.handleId,r.type,r.receiving,r.mid):"slowlink"===o?this._log("Slowlink",a.handleId,r.uplink,r.lost,r.mid):"event"===o||("timeout"===o?(this._log("WebSockets Gateway timeout",r),this.ws.close(3504,"Gateway timeout")):"success"===o||"error"===o||this._log(`Unknown event: ${o} on session: ${this.sessionId}`)));if(i===this.handleId){if("event"===o){var c=(r.plugindata||{}).data||{},u=r.jsep;let t=c.result||null,o=c.videoroom||null,p=c.publishers||{},h=c.leaving,m=c.kicked,g=c.substream,y=c.temporal,v=c.unpublished,b=c.error;if("joined"===o){var l,d;this.id=c.id,this.privateId=c.private_id,this.isConnected=!0,this._log("We have successfully joined Room"),this.emit("joined",!0,this.constructId),this.emit("addLocalParticipant",{tid:generateUUID(),id:a.handleId,constructId:this.constructId,userId:null===(l=decodeJanusDisplay(a.userId))||void 0===l?void 0:l.userId,role:null===(d=decodeJanusDisplay(this.display))||void 0===d?void 0:d.role,track:null,stream:null,streamMap:{},source:null,adding:!1,removing:!1,hasAudioTrack:!1,hasVideoTrack:!1});for(let t in p){let r=p[t].display,i=p[t].streams||[],o=p[t].id;for(let t in i)i[t].id=o,i[t].display=r;this._log("Remote userId: ",r),this._pushToRemoteUsersCache(r,i,o),this._participantShouldSubscribe(r)&&(this._log("Creating user: ",r),this._createParticipant(r,o).then(t=>{this._updateParticipantsTrackData(t.handleId,i);const r=i.filter(t=>!t.disabled&&this._intercomSubscribe(t)).map(t=>({feed:t.id,mid:t.mid}));return t.webrtcStuff.subscribeMap=structuredClone(r),this.sendMessage(t.handleId,{body:{request:"join",room:this.roomId,ptype:"subscriber",private_id:this.privateId,streams:r,...this.webrtcVersion>1e3?{id:this.userId}:{},pin:this.pin}})}).catch(t=>{this.emit("error",t)}))}}else if("event"===o){null!=g&&this._log("Substream event:",g,i),null!=y&&this._log("Temporal event:",y),void 0!==c.streams&&null!==c.streams&&this._log("Got my own streams back",c.streams);for(let t in p){let r=p[t].display,i=p[t].streams||[],o=p[t].id;for(let t in i)i[t].id=o,i[t].display=r;if(this._log("Remote userId: ",r),this._pushToRemoteUsersCache(r,i,o),this._participantShouldSubscribe(r)){let t=this._getHandle(null,o);if(t){this._updateParticipantsTrackData(t.handleId,i);let o=i.filter(r=>!r.disabled&&this._intercomSubscribe(r)&&!this._isAlreadySubscribed(t.handleId,r.id,r.mid)).map(t=>({feed:t.id,mid:t.mid})),a=i.filter(t=>t.disabled||!this._intercomSubscribe(t)).map(t=>({feed:t.id,mid:t.mid}));this._updateSubscribeMap(t.handleId,o,a),this._log("Already subscribed to user: ",r,"Update streams",o,a),(o.length||a.length)&&this.sendMessage(t.handleId,{body:{request:"update",...o.length?{subscribe:o}:{},...a.length?{unsubscribe:a}:{}}})}else this._log("Creating user: ",r,i),this._createParticipant(r,o).then(t=>{this._updateParticipantsTrackData(t.handleId,i);const r=i.filter(t=>!t.disabled&&this._intercomSubscribe(t)).map(t=>({feed:t.id,mid:t.mid}));return t.webrtcStuff.subscribeMap=structuredClone(r),this.sendMessage(t.handleId,{body:{request:"join",room:this.roomId,ptype:"subscriber",private_id:this.privateId,streams:r,...this.webrtcVersion>1e3?{id:this.userId}:{},pin:this.pin}})}).catch(t=>{this.emit("error",t)})}}"ok"===h?(this._log("leaving",this.handleId,"this is us"),this._removeParticipant(this.handleId),"kicked"===c.reason&&(this.emit("kicked"),this.disconnect().catch(()=>{}))):h&&(this._log("leaving",h),this._removeFromRemoteUsersCache(h),this._removeParticipant(null,h,!0)),"ok"===v?(this._log("unpublished",this.handleId,"this is us"),this._removeParticipant(this.handleId,null,!1)):v&&(this._log("unpublished",v),this._removeFromRemoteUsersCache(v),this._removeParticipant(null,v,!0)),"ok"===m||m&&(this._log("kicked",m),this._removeFromRemoteUsersCache(m),this._removeParticipant(null,m,!0)),b&&this.emit("error",{type:"error",id:7,message:"local participant error",data:[i,c]})}else t&&t.status&&(this.emit("streamingStatus",t.status),"stopped"===t.status&&this.stopStream(),"started"===t.status&&(this.emit("streaming",!0),this.isStreaming=!0));null!=u&&("reactooroom"===this.sessiontype?this._webrtcPeer(this.handleId,u).catch(t=>{this.emit("error",t)}):"streaming"===this.sessiontype&&this._publishRemote(this.handleId,u).catch(t=>{this.emit("error",t)}))}else if("webrtcup"===o){if(this.simulcast)return;this._log("Configuring bitrate: "+this.initialBitrate),this.initialBitrate>0&&this.sendMessage(this.handleId,{body:{request:"configure",bitrate:this.initialBitrate}}).catch(()=>null)}}else{let t=(r.plugindata||{}).data||{},c=r.jsep,u=t.videoroom,l=t.error,d=t.substream,v=t.mid,b=t.temporal;var p,h,m,g,y;if(null!=d&&(this._log("Substream: ",i,v,d),this._setSelectedSubstream(i,v,d),this._resetStats(i,v),this.requestKeyFrame(i,v)),null!=b&&this._log("Temporal: ",b),"webrtcup"===o&&this.requestKeyFrame(a.handleId),"updated"===u&&(this._log("Remote has updated tracks",t),t.streams&&this._updateTransceiverMap(a.handleId,t.streams)),"attached"===u)this._log("Remote have successfully joined Room",t),t.streams&&this._updateTransceiverMap(a.handleId,t.streams||[]),this.emit(this._getAddParticipantEventName(a.handleId),{tid:generateUUID(),id:a.handleId,userId:null===(p=decodeJanusDisplay(a.userId))||void 0===p?void 0:p.userId,role:null===(h=decodeJanusDisplay(a.userId))||void 0===h?void 0:h.role,fullUserId:a.userId,stream:null,streamMap:structuredClone(null===(m=a.webrtcStuff)||void 0===m?void 0:m.streamMap),tracksMap:structuredClone(null===(g=a.webrtcStuff)||void 0===g?void 0:g.tracksMap),transceiverMap:structuredClone(null===(y=a.webrtcStuff)||void 0===y?void 0:y.transceiverMap),source:null,track:null,adding:!1,removing:!1,constructId:this.constructId,hasAudioTrack:!1,hasVideoTrack:!1});l&&this.emit("error",{type:"warning",id:8,message:"remote participant error",data:[i,t]}),c&&this._publishRemote(a.handleId,c).catch(t=>{this.emit("error",t)})}}}_handleDataEvents(t,r,i){let o=this._getHandle(t);if("state"===r){if(this._log(" - Data channel status - ","UID: "+t,"STATUS: "+JSON.stringify(i),"ME: "+(t===this.handleId)),o){o.webrtcStuff.dataChannelOpen=this.defaultDataChannelLabel===(null==i?void 0:i.label)&&"open"===(null==i?void 0:i.state)}t===this.handleId&&this.defaultDataChannelLabel===(null==i?void 0:i.label)&&(this._isDataChannelOpen="open"===(null==i?void 0:i.state),this.emit("dataChannel","open"===(null==i?void 0:i.state)))}if("error"===r){if(this.emit("error",{type:"warning",id:9,message:"data event warning",data:[t,i]}),o){let t=o.webrtcStuff;this.defaultDataChannelLabel===i.label&&(t.dataChannelOpen=!1)}t===this.handleId&&this.defaultDataChannelLabel===i.label&&(this._isDataChannelOpen=!1,this.emit("dataChannel",!1))}if(t===this.handleId&&"message"===r){let r=null;try{r=JSON.parse(i)}catch(r){return void this.emit("error",{type:"warning",id:10,message:"data message parse error",data:[t,r]})}this.emit("data",r)}}_removeParticipant(t,r){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=this._getHandle(t,r);return o?(t=o.handleId,this._send({janus:"hangup",handle_id:t},!0).then(()=>i?this._send({janus:"detach",handle_id:t},!0):Promise.resolve()).finally(()=>{try{var r,a;if(o.webrtcStuff.stream)if(this.isRestarting)null===(r=o.webrtcStuff.stream)||void 0===r||r.getTracks().forEach(t=>t.onended=null);else null===(a=o.webrtcStuff.stream)||void 0===a||a.getTracks().forEach(t=>t.stop())}catch(t){}o.webrtcStuff.stream&&(o.webrtcStuff.stream.onremovetrack=null,o.webrtcStuff.stream=null),o.webrtcStuff.dataChannel&&Object.keys(o.webrtcStuff.dataChannel).forEach(t=>{o.webrtcStuff.dataChannel[t].onmessage=null,o.webrtcStuff.dataChannel[t].onopen=null,o.webrtcStuff.dataChannel[t].onclose=null,o.webrtcStuff.dataChannel[t].onerror=null}),o.webrtcStuff.pc&&(o.webrtcStuff.pc.onicecandidate=null,o.webrtcStuff.pc.ontrack=null,o.webrtcStuff.pc.ondatachannel=null,o.webrtcStuff.pc.onconnectionstatechange=null,o.webrtcStuff.pc.oniceconnectionstatechange=null);try{o.webrtcStuff.pc.close()}catch(t){}var c,u,l,d;(o.webrtcStuff={stream:null,streamMap:{},tracksMap:[],transceiverMap:[],subscribeMap:[],mySdp:null,mediaConstraints:null,pc:null,dataChannelOpen:!1,dataChannel:null,dtmfSender:null,trickle:!0,iceDone:!1,isIceRestarting:!1,stats:{},selectedSubstream:{},initialSimulcastSubstreamBeenSet:{},overriddenSimulcastMode:{}},t===this.handleId)?(this._isDataChannelOpen=!1,this.isPublished=!1,this.emit("published",{status:!1,hasStream:!1}),this.emit("removeLocalParticipant",{id:t,userId:null===(c=decodeJanusDisplay(o.userId))||void 0===c?void 0:c.userId,role:null===(u=decodeJanusDisplay(o.userId))||void 0===u?void 0:u.role,fullUserId:o.userId})):this.emit(this._getRemoveParticipantEventName(t),{id:t,userId:null===(l=decodeJanusDisplay(o.userId))||void 0===l?void 0:l.userId,role:null===(d=decodeJanusDisplay(o.userId))||void 0===d?void 0:d.role,fullUserId:o.userId});if(i){let r=this._participants.findIndex(r=>r.handleId===t);this._participants.splice(r,1)}return!0})):Promise.resolve()}_createParticipant(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._send({janus:"attach",plugin:this.pluginName}).then(i=>{let o={handleId:i.data.id,rfid:r,userId:t,webrtcStuff:{stream:null,streamMap:{},tracksMap:[],transceiverMap:[],subscribeMap:[],mySdp:null,mediaConstraints:null,pc:null,dataChannelOpen:!1,dataChannel:null,dtmfSender:null,trickle:!0,iceDone:!1,isIceRestarting:!1,stats:{},selectedSubstream:{},initialSimulcastSubstreamBeenSet:{},overriddenSimulcastMode:{}}};return this._participants.push(o),o})}_updateSubscribeMap(t,r,i){let o=this._getHandle(t);if(!o)return void this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"updateSubscribeMap"]});let a=o.webrtcStuff.subscribeMap;r.forEach(t=>{a.find(r=>r.feed===t.feed&&r.mid===t.mid)||a.push(t)}),i.forEach(t=>{let r=a.findIndex(r=>r.feed===t.feed&&r.mid===t.mid);r>-1&&a.splice(r,1)})}_isAlreadySubscribed(t,r,i){let o=this._getHandle(t);return o?o.webrtcStuff.subscribeMap.findIndex(t=>t.mid===i&&t.feed===r)>-1:(this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"isAlreadySubscribed"]}),!1)}_updateTransceiverMap(t,r){this._log("Updating current transceiver map",t,r);let i=this._getHandle(t);i?i.webrtcStuff.transceiverMap=structuredClone(r):this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"updateTransceiverMap"]})}_updateParticipantsTrackData(t,r){this._log("Updating participants track data",t,r);let i=this._getHandle(t);i?i.webrtcStuff.tracksMap=structuredClone(r.map(t=>{let r=null,i=null;try{const o=JSON.parse(t.description);r=null==o?void 0:o.source,i=null==o?void 0:o.simulcastBitrates}catch(t){}return{active:!t.disabled,description:t.description,source:r,simulcastBitrates:i,display:t.display,id:t.id,mid:t.mid,mindex:t.mindex,codec:t.codec,type:t.type}})):this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"updateParticipantsTrackData"]})}_updateRemoteParticipantStreamMap(t){this._log("Updating participants stream map",t);let r=this._getHandle(t);if(!r)return void this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"updateRemoteParticipantStreamMap"]});let i=r.webrtcStuff;i.streamMap={},i.transceiverMap.forEach(t=>{var r,o,a,c;if("data"===t.type)return;if(!1===t.active)return;const u=null===(r=JSON.parse(t.feed_description))||void 0===r?void 0:r.source;i.streamMap[u]||(i.streamMap[u]=[]);let l=null===(o=i.pc.getTransceivers().find(r=>r.mid===t.mid))||void 0===o||null===(a=o.receiver)||void 0===a||null===(c=a.track)||void 0===c?void 0:c.id;l&&i.streamMap[u].push(l)})}_joinRoom(t,r,i,o){return this.sendMessage(this.handleId,{body:{request:"join",room:t,pin:r,ptype:"publisher",display:o,...this.webrtcVersion>1e3?{id:i}:{}}},!1,!0)}_watchStream(t){return this.sendMessage(this.handleId,{body:{request:"watch",id:String(t)}},!1,!0)}_leaveRoom(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isConnected?this.sendMessage(this.handleId,{body:{request:"leave"}},t).finally(()=>{this.isConnected=!1,this.emit("joined",!1)}):Promise.resolve()}_reconnect(){return this.isReclaiming?Promise.resolve():(this.ws&&(this._wipeListeners(),1===this.ws.readyState&&this.ws.close()),this._stopKeepAlive(),this.isReclaiming=!0,this.emit("joining",!0),new Promise((t,r)=>{let abortReconnect=()=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isReclaiming=!1,this.emit("joining",!1),r({type:"warning",id:17,message:"Connection cancelled",data:e})};this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this),this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this._send({janus:"claim"}).then(r=>{this.sessionId=r.session_id?r.session_id:r.data.id,this._startKeepAlive(),this.isReclaiming=!1,this.emit("joining",!1),this._retries=0,t(r)}).catch(t=>{this.isReclaiming=!1,this.emit("joining",!1),r({type:"error",id:11,message:"reconnection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this.isReclaiming=!1,this.emit("joining",!1),r({type:"warning",id:12,message:"ws reconnection error",data:t})},this._abortController.signal.addEventListener("abort",abortReconnect)}))}connect(t,r,i,o,a,c,u){let l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,p=arguments.length>9?arguments[9]:void 0,h=arguments.length>10&&void 0!==arguments[10]&&arguments[10],m=arguments.length>11&&void 0!==arguments[11]?arguments[11]:this.defaultSimulcastSettings,g=arguments.length>12&&void 0!==arguments[12]&&arguments[12];return this.isConnecting?Promise.reject({type:"warning",id:16,message:"connection already in progress"}):(this.ws&&this._wipeListeners(),this._stopKeepAlive(),this._abortController=new AbortController,this.sessionId=null,this.server=i,this.iceServers=o,this.token=a,this.roomId=t,this.pin=r,this.display=c,this.userId=u,this.webrtcVersion=l,this.initialBitrate=d,this.recordingFilename=p,this.isConnecting=!0,this.enableDtx=g,this.simulcast=h,this.simulcastSettings=structuredClone(m),this.simulcastSettings&&"object"==typeof this.simulcastSettings&&Object.keys(this.simulcastSettings).length&&Object.keys(this.simulcastSettings).forEach(t=>{this.simulcastSettings[t].bitrates=this.simulcastSettings[t].bitrates.sort((t,r)=>t.maxBitrate===r.maxBitrate?t.maxFramerate-r.maxFramerate:t.maxBitrate-r.maxBitrate)}),this.emit("joining",!0),new Promise((i,o)=>{this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this);let abortConnect=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isConnecting=!1,this.emit("joining",!1),o({type:"warning",id:17,message:"Connection cancelled"})};this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this._retries=0,this._send({janus:"create"}).then(t=>(this.sessionId=t.session_id?t.session_id:t.data.id,this._startKeepAlive(),1)).then(()=>this._createParticipant(u)).then(t=>(this.handleId=t.handleId,1)).then(()=>this._joinRoom(t,r,u,c)).then(()=>{this._enableStatsWatch(),this._enableSubstreamAutoSelect(),this.isConnecting=!1,this.emit("joining",!1),i(this)}).catch(t=>{this.isConnecting=!1,this.emit("joining",!1),o({type:"warning"===(null==t?void 0:t.type)?"warning":"error",id:13,message:"connection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.isConnecting=!1,this.emit("joining",!1),o({type:"error",id:14,message:"ws connection error",data:t})},this._abortController.signal.addEventListener("abort",abortConnect)}))}disconnect(){var t,r;if(this.isDisconnecting)return Promise.resolve();null===(t=this._abortController)||void 0===t||null===(r=t.abort)||void 0===r||r.call(t),this.isDisconnecting=!0,this._stopKeepAlive(),this._disableStatsWatch(),this._disableSubstreamAutoSelect();let i=this.isConnected;return Promise.all(this._participants.map(t=>this._removeParticipant(t.handleId))).finally(()=>(this._wipeListeners(),this.ws&&1===this.ws.readyState&&(this._send({janus:"destroy"},!0),this.ws.close()),this.sessionId=null,this.isPublished=!1,this.isConnected=!1,this.isDisconnecting=!1,this.emit("publishing",!1),this.emit("published",{status:!1,hasStream:!1}),this.emit("joining",!1),this.emit("joined",!1),this.emit("disconnect",i),Promise.resolve("Disconnected")))}startStream(t,r,i,o,a){return this.isConnecting?Promise.reject({type:"warning",id:16,message:"connection error",data:"Connection is in progress"}):(this.ws&&this._wipeListeners(),this._stopKeepAlive(),this._abortController=new AbortController,this.server=r,this.iceServers=i,this.token=o,this.streamId=t,this.userId=a,this.sessionId=null,this.isConnecting=!0,this.emit("streamStarting",!0),new Promise((r,i)=>{this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this);let abortConnect=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isConnecting=!1,this.emit("streamStarting",!1),i({type:"warning",id:17,message:"Connection cancelled"})};this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this._retries=0,this._send({janus:"create"}).then(t=>(this.sessionId=t.session_id?t.session_id:t.data.id,this._startKeepAlive(),1)).then(()=>this._createParticipant(a)).then(t=>(this.handleId=t.handleId,1)).then(()=>this._watchStream(t)).then(()=>{this.isConnecting=!1,this.emit("streamStarting",!1),r(this)}).catch(t=>{this.isConnecting=!1,this.emit("streamStarting",!1),i({type:"error",id:13,message:"connection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.isConnecting=!1,this.emit("streamStarting",!1),i({type:"error",id:14,message:"ws connection error",data:t})},this._abortController.signal.addEventListener("abort",abortConnect)}))}stopStream(){var t,r;if(this.isDisconnecting)return Promise.resolve();null===(t=this._abortController)||void 0===t||null===(r=t.abort)||void 0===r||r.call(t),this._stopKeepAlive();let i=this.isStreaming;return this.isDisconnecting=!0,this._removeParticipant(this.handleId).finally(()=>(this.sendMessage(this.handleId,{body:{request:"stop"}},!0),this._wipeListeners(),this._send({janus:"destroy"},!0),this.ws&&1===this.ws.readyState&&this.ws.close(),this.sessionId=null,this.isDisconnecting=!1,this.isStreaming=!1,this.emit("streamStarting",!1),this.emit("streaming",!1),this.emit("disconnect",i),Promise.resolve("Disconnected")))}destroy(){return"reactooroom"===this.sessiontype?this.disconnect().then(()=>(this.clear(),!0)):"streaming"===this.sessiontype?this.stopStream().then(()=>(this.clear(),!0)):void 0}_enableDebug(){this._log=console.log.bind(console)}_getHandle(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return this._participants.find(a=>{var c;return a.handleId===t||r&&a.rfid===r||i&&(null===(c=decodeJanusDisplay(a.userId))||void 0===c?void 0:c.userId)===i||o&&a.userId===o})}_findSimulcastConfig(t,r){return Object.keys(r).reduce((i,o)=>{var a;return r[t]?r[t]:t.indexOf(null===(a=o.match(/\*(.*?)\*/))||void 0===a?void 0:a[1])>-1?r[o]:i},r.default)}_disableStatsWatch(){this._statsTimeoutId&&(clearInterval(this._statsTimeout),this._statsTimeoutStopped=!0,this._statsTimeoutId=null)}_enableStatsWatch(){this._statsTimeoutId&&(clearTimeout(this._statsTimeoutId),this._statsTimeoutId=null),this._statsTimeoutStopped=!1;const loop=()=>{let t=performance.now(),r=null;this._getStats("video").then(t=>{r=performance.now(),this._parseVideoStats(t)}).finally(()=>{this._statsTimeoutStopped||(this._statsTimeoutId=setTimeout(loop,this._statsInterval-Math.min(r-t,this._statsInterval)))})};loop()}_enableSubstreamAutoSelect(){if(!this.simulcast)return;this._aqTimeoutId&&(clearTimeout(this._aqTimeoutId),this._aqTimeoutId=null,this._aqIntervalCounter=0);const checkStats=()=>{this._participants.forEach(t=>{if(t.handleId!==this.handleId){var r,i,o;const a=null===(r=t.webrtcStuff)||void 0===r||null===(i=r.pc)||void 0===i?void 0:i.getTransceivers();((null==a||null===(o=a.filter(t=>"video"===t.receiver.track.kind))||void 0===o?void 0:o.map(t=>t.mid))||[]).forEach(r=>{var i,o,a,c;const{source:u,simulcastBitrates:l}=t.webrtcStuff.tracksMap.find(t=>t.mid===r)||{};if(!l)return;const d=this._findSimulcastConfig(u,this.simulcastSettings),p=!!t.webrtcStuff.initialSimulcastSubstreamBeenSet[r],h=(null===(i=t.webrtcStuff)||void 0===i||null===(o=i.overriddenSimulcastMode[r])||void 0===o?void 0:o.defaultSubstream)||(null==d?void 0:d.defaultSubstream),m=(null===(a=t.webrtcStuff)||void 0===a||null===(c=a.overriddenSimulcastMode[r])||void 0===c?void 0:c.mode)||(null==d?void 0:d.mode);if("browserControlled"===m);else if("manual"===m&&this._aqIntervalCounter%this._aqIntervalDivisor==0||!p){t.webrtcStuff.initialSimulcastSubstreamBeenSet[r]=!0;const i=t.webrtcStuff.selectedSubstream[r];null!=h&&h!==i&&(this._log("Attempting to force substream quality",h),this.selectSubStream(t.handleId,h,void 0,r,!1).catch(t=>this._log(`Changing substream for mid: ${r} failed. Reason: ${t}`)))}else if("controlled"===m){var g,y,v,b,_,w;const i=t.webrtcStuff.selectedSubstream[r],o=null==l?void 0:l[l.length-1-i];let a=0;if((null===(g=t.webrtcStuff)||void 0===g||null===(y=g.stats)||void 0===y||null===(v=y[r])||void 0===v?void 0:v.length)>this._upStatsLength){const i=this._calculateMedianStats(t.webrtcStuff.stats[r].slice(-1*this._upStatsLength));(null==i?void 0:i.framesPerSecond)>=Math.floor(.7*((null==o?void 0:o.maxFramerate)||30))&&(null==i?void 0:i.freezeDurationSinceLast)<this._upStatsLength*this._statsInterval*.33/1e3&&(a=1)}if((null===(b=t.webrtcStuff)||void 0===b||null===(_=b.stats)||void 0===_||null===(w=_[r])||void 0===w?void 0:w.length)>this._downStatsLength){const i=this._calculateMedianStats(t.webrtcStuff.stats[r].slice(-1*this._downStatsLength));((null==i?void 0:i.framesPerSecond)<Math.floor(.7*((null==o?void 0:o.maxFramerate)||30))||(null==i?void 0:i.freezeDurationSinceLast)>this._downStatsLength*this._statsInterval*.33/1e3)&&(a=-1)}-1===a?i<l.length-1&&(this._log("Attempting to down the quality for mid: ",r," quality:",i+1),this._resetStats(t.handleId,r),this.selectSubStream(t.handleId,i+1,void 0,r,!1).catch(t=>this._log(`Changing substream for mid: ${r} failed. Reason: ${t}`))):1===a?i>0&&(this._log("Attempting to up the quality for mid: ",r," quality:",i-1),this._resetStats(t.handleId,r),this.selectSubStream(t.handleId,i-1,void 0,r,!1).catch(t=>this._log(`Changing substream for mid: ${r} failed. Reason: ${t}`))):this._log("No quality change for mid: ",r)}})}}),this._aqIntervalCounter++,this._aqTimeoutId=setTimeout(checkStats,this._aqInterval)};checkStats()}_disableSubstreamAutoSelect(){this._aqTimeoutId&&(clearTimeout(this._aqTimeoutId),this._aqTimeoutId=null,this._aqIntervalCounter=0)}_calculateMedianStats(t){let r={framesPerSecond:null,jitter:null,roundTripTime:null,freezeDurationSinceLast:null,freezeCountSinceLast:null};return Object.keys(r).forEach(i=>{if("freezeDurationSinceLast"===i||"freezeCountSinceLast"===i)r[i]=t.reduce((t,r)=>t+r[i],0);else{let o=t.map(t=>t[i]);r[i]=function(t){if(0===t.length)return 0;t.sort((function(t,r){return t-r}));var r=Math.floor(t.length/2);return t.length%2?t[r]:(t[r-1]+t[r])/2}(o)}}),r.statsLength=t.length,r}_parseVideoStats(t){t.forEach(t=>{t.forEach(t=>{var r;if(null!==t&&(null==t||null===(r=t.handle)||void 0===r?void 0:r.handleId)!==this.handleId){let r=this._getHandle(t.handle.handleId);if(r){var i;r.webrtcStuff.stats[t.mid]||(r.webrtcStuff.stats[t.mid]=[]);const o={framesPerSecond:null,framesDropped:null,totalFreezesDuration:null,freezeDurationSinceLast:null,freezeCount:null,jitter:null,packetsLost:null,nackCount:null,roundTripTime:null,width:null,height:null,networkType:null,powerEfficientDecoder:null};t.stats.forEach(i=>{var a,c;const u=this._findSimulcastConfig(t.source,this.simulcastSettings),l=(null===(a=r.webrtcStuff)||void 0===a||null===(c=a.overriddenSimulcastMode[t.mid])||void 0===c?void 0:c.mode)||(null==u?void 0:u.mode);var d,p,h,m,g,y,v,b,_,w;"inbound-rtp"===i.type&&"video"===i.kind&&(o.framesPerSecond=i.framesPerSecond||0,o.framesDropped=i.framesDropped||0,o.totalFreezesDuration=i.totalFreezesDuration||0,o.freezeDurationSinceLast=(i.totalFreezesDuration||0)-((null===(d=r.webrtcStuff.stats)||void 0===d||null===(p=d[t.mid])||void 0===p||null===(h=p[(null===(m=r.webrtcStuff.stats)||void 0===m||null===(g=m[t.mid])||void 0===g?void 0:g.length)-1])||void 0===h?void 0:h.totalFreezesDuration)||0),o.freezeCount=i.freezeCount||0,o.freezeCountSinceLast=(i.freezeCount||0)-((null===(y=r.webrtcStuff.stats)||void 0===y||null===(v=y[t.mid])||void 0===v||null===(b=v[(null===(_=r.webrtcStuff.stats)||void 0===_||null===(w=_[t.mid])||void 0===w?void 0:w.length)-1])||void 0===b?void 0:b.freezeCount)||0),o.jitter=i.jitter,o.packetsLost=i.packetsLost,o.nackCount=i.nackCount,o.width=i.frameWidth,o.height=i.frameHeight,o.powerEfficientDecoder=i.powerEfficientDecoder);"candidate-pair"===i.type&&(o.roundTripTime=i.currentRoundTripTime),"local-candidate"===i.type&&(o.networkType=i.networkType),o.selectedSubstream=r.webrtcStuff.selectedSubstream[t.mid],o.simulcastMode=l}),r.webrtcStuff.stats[t.mid].push(o),r.webrtcStuff.stats[t.mid].length>this._statsMaxLength&&r.webrtcStuff.stats[t.mid].shift(),this.emit("rtcStats",{handleId:t.handle.handleId,stats:o,userId:null===(i=decodeJanusDisplay(t.handle.userId))||void 0===i?void 0:i.userId,source:t.source,mid:t.mid})}}})})}_getStats(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Promise.all(this._participants.map(r=>{let i=[];var o,a,c,u;if("video"===t)i=(null==r||null===(o=r.webrtcStuff)||void 0===o||null===(a=o.stream)||void 0===a?void 0:a.getVideoTracks())||[];else if("audio"===t){var l,d;i=(null==r||null===(l=r.webrtcStuff)||void 0===l||null===(d=l.stream)||void 0===d?void 0:d.getAudioTracks())||[]}if(null!==t){var p,h;const t=null==r||null===(p=r.webrtcStuff)||void 0===p||null===(h=p.pc)||void 0===h?void 0:h.getTransceivers();return Promise.all(i.map(i=>{var o;const a=Object.keys(r.webrtcStuff.streamMap).find(t=>r.webrtcStuff.streamMap[t].find(t=>t===i.id)),c=null===(o=t.find(t=>{var r,o,a,c;return(null===(r=t.receiver)||void 0===r||null===(o=r.track)||void 0===o?void 0:o.id)===i.id||(null===(a=t.sender)||void 0===a||null===(c=a.track)||void 0===c?void 0:c.id)===i.id}))||void 0===o?void 0:o.mid;return r.webrtcStuff.pc.getStats(i).then(t=>({stats:t,source:a,mid:c,handle:r})).catch(t=>Promise.reject({stats:null,error:t,handle:r,source:a,mid:c}))}))}return null==r||null===(c=r.webrtcStuff)||void 0===c||null===(u=c.pc)||void 0===u?void 0:u.getStats(null).then(t=>({handle:r,stats:t})).catch(t=>Promise.reject({handle:r,error:t}))}))}_resetStats(t,r){let i=this._getHandle(t);if(i){let t=i.webrtcStuff;r?t.stats[r]&&(t.stats[r]=[t.stats[r][t.stats[r].length-1]]):Object.keys(t.stats).forEach(r=>{t.stats[r]=[t.stats[r][t.stats[r].length-1]]})}}_sendTrickleCandidate(t,r){return this._send({janus:"trickle",candidate:r,handle_id:t},!1,!1,5)}_webrtc(t){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this._getHandle(t);if(!i)return void this.emit("error",{type:"error",id:15,message:"id non-existent",data:[t,"create rtc connection"]});let o=i.webrtcStuff;if(!o.pc){let a={iceServers:this.iceServers,iceTransportPolicy:"all",bundlePolicy:void 0,sdpSemantics:"unified-plan"},c={};"edge"===g.browserDetails.browser&&(a.bundlePolicy="max-bundle"),this._log("new RTCPeerConnection",a,c),o.pc=new RTCPeerConnection(a,c),o.pc.onnegotiationneeded=()=>{this._log("onnegotiationneeded")},o.pc.onconnectionstatechange=()=>{var r,a;("failed"===o.pc.connectionState&&(this._log("connectionState failed"),this._iceRestart(t)),this.emit("connectionState",[t,t===this.handleId,o.pc.connectionState]),t!==this.handleId&&"connected"===o.pc.connectionState)&&this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),id:i.handleId,userId:null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.userId,role:null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),track:null,source:null,constructId:this.constructId,adding:!1,removing:!1,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)})},o.pc.oniceconnectionstatechange=()=>{var r,a;("failed"===o.pc.iceConnectionState&&(this._log("iceConnectionState failed"),this._iceRestart(t)),this.emit("iceState",[t,t===this.handleId,o.pc.iceConnectionState]),t===this.handleId||"completed"!==o.pc.iceConnectionState&&"connected"!==o.pc.iceConnectionState)||this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),id:i.handleId,userId:null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.userId,role:null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),track:null,source:null,constructId:this.constructId,adding:!1,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)})},o.pc.onicecandidate=r=>{if(null==r.candidate||"edge"===g.browserDetails.browser&&r.candidate.candidate.indexOf("endOfCandidates")>0)o.iceDone=!0,this._sendTrickleCandidate(t,{completed:!0}).catch(t=>{this.emit("error",t)});else{var i={candidate:r.candidate.candidate,sdpMid:r.candidate.sdpMid,sdpMLineIndex:r.candidate.sdpMLineIndex};this._sendTrickleCandidate(t,i).catch(t=>{this.emit("error",t)})}},r&&(o.pc.ontrack=t=>{var r,a;if(t.streams&&(o.stream||(o.stream=new MediaStream),null!==(r=t.streams)&&void 0!==r&&null!==(a=r[0])&&void 0!==a&&a.onremovetrack||(t.streams[0].onremovetrack=t=>{var r,a,c,u,l;if(this._log("Remote track removed",t),null===(r=o.stream)||void 0===r||r.removeTrack(t.track),!this._getHandle(i.handleId))return;this._updateRemoteParticipantStreamMap(i.handleId);let d=null===(a=o.pc)||void 0===a||null===(c=a.getTransceivers())||void 0===c?void 0:c.find(r=>r.receiver.track===t.track),p=(null==d?void 0:d.mid)||t.track.id,h=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.track.id));this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),id:i.handleId,mid:p,constructId:this.constructId,userId:null===(u=decodeJanusDisplay(i.userId))||void 0===u?void 0:u.userId,role:null===(l=decodeJanusDisplay(i.userId))||void 0===l?void 0:l.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),source:h,track:t.track,adding:!1,removing:!0,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)})}),t.track)){var c,u,l;null===(c=o.stream)||void 0===c||c.addTrack(t.track),this._updateRemoteParticipantStreamMap(i.handleId);let r=t.transceiver?t.transceiver.mid:t.track.id,a=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.track.id));if("video"===t.track.kind&&this.requestKeyFrame(i.handleId,r),this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),mid:r,id:i.handleId,userId:null===(u=decodeJanusDisplay(i.userId))||void 0===u?void 0:u.userId,role:null===(l=decodeJanusDisplay(i.userId))||void 0===l?void 0:l.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),source:a,track:t.track,constructId:this.constructId,adding:!0,removing:!1,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)}),t.track.onended)return;t.track.onended=t=>{var r,a,c,u,l;if(this._log("Remote track ended"),null===(r=o.stream)||void 0===r||r.removeTrack(t.target),!this._getHandle(i.handleId))return;this._updateRemoteParticipantStreamMap(i.handleId);let d=null===(a=o.pc)||void 0===a||null===(c=a.getTransceivers())||void 0===c?void 0:c.find(r=>r.receiver.track===t.target),p=(null==d?void 0:d.mid)||t.target.id,h=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.target.id));this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),id:i.handleId,mid:p,constructId:this.constructId,userId:null===(u=decodeJanusDisplay(i.userId))||void 0===u?void 0:u.userId,role:null===(l=decodeJanusDisplay(i.userId))||void 0===l?void 0:l.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),source:h,track:t.target,adding:!1,removing:!0,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)})};let d={},p=300,h=5e3;t.track.onmute=t=>{var r,a;this._log("Remote track muted");let c=o.pc.getTransceivers().find(r=>r.receiver.track===t.target).mid||t.target.id,u=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.target.id));if(this.emit("remoteTrackMuted",{id:i.handleId,mid:c,constructId:this.constructId,userId:null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.userId,role:null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),source:u,kind:t.target.kind,track:t.target,muted:!0}),!this.simulcast)return;const l=u.indexOf("screen")>-1?h:p;d[c]||(d[c]=setTimeout(()=>{var r,o;d[c]=null;const a=this._findSimulcastConfig(u,this.simulcastSettings),l=(null===(r=i.webrtcStuff)||void 0===r||null===(o=r.overriddenSimulcastMode[c])||void 0===o?void 0:o.mode)||(null==a?void 0:a.mode),{simulcastBitrates:p}=i.webrtcStuff.tracksMap.find(t=>t.mid===c)||{};if(!p)return;const h=i.webrtcStuff.selectedSubstream[c];"browserControlled"!==l&&"video"===t.target.kind&&h<p.length-1&&(this._log("Attempting to down the quality due to track muted"),this.selectSubStream(i.handleId,h+1,void 0,c,!1).catch(t=>this._log(`Changing substream for mid: ${c} failed. Reason: ${t}`)))},l))},t.track.onunmute=t=>{var r,a;this._log("Remote track unmuted");let c=o.pc.getTransceivers().find(r=>r.receiver.track===t.target).mid||t.target.id,u=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.target.id));d[c]&&(clearTimeout(d[c]),d[c]=null),this.emit("remoteTrackMuted",{id:i.handleId,mid:c,constructId:this.constructId,userId:null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.userId,role:null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),source:u,kind:t.target.kind,track:t.target,muted:!1})}}})}if(!o.dataChannel||!o.dataChannelOpen){o.dataChannel={};var onDataChannelMessage=r=>{this._handleDataEvents(t,"message",r.data)},onDataChannelStateChange=r=>{let i=r.target.label,a=(r.target.protocol,o.dataChannel[i]?o.dataChannel[i].readyState:"null");this._handleDataEvents(t,"state",{state:a,label:i})},onDataChannelError=r=>{var i;this._handleDataEvents(t,"error",{label:null==r||null===(i=r.channel)||void 0===i?void 0:i.label,error:r})};const createDataChannel=(t,r,i)=>{let a={ordered:!0};i?o.dataChannel[t]=i:(r&&(a={...a,protocol:r}),o.dataChannel[t]=o.pc.createDataChannel(t,a)),o.dataChannel[t].onmessage=onDataChannelMessage,o.dataChannel[t].onopen=onDataChannelStateChange,o.dataChannel[t].onclose=onDataChannelStateChange,o.dataChannel[t].onerror=onDataChannelError};createDataChannel(this.defaultDataChannelLabel,null,null),o.pc.ondatachannel=function(t){createDataChannel(t.channel.label,t.channel.protocol,t.channel)}}}_webrtcPeer(t,r){let i=this._getHandle(t);if(!i)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[t,"rtc peer"]});var o=i.webrtcStuff;return null!=r?null===o.pc?(this._log("No PeerConnection: if this is an answer, use createAnswer and not _webrtcPeer"),Promise.resolve(null)):o.pc.setRemoteDescription(r).then(()=>{if(o.remoteSdp=r.sdp,o.candidates&&o.candidates.length>0){for(var t=0;t<o.candidates.length;t++){var i=o.candidates[t];i&&!0!==i.completed?o.pc.addIceCandidate(i):o.pc.addIceCandidate(null)}o.candidates=[]}return!0}).catch(r=>Promise.reject({type:"warning",id:32,message:"rtc peer",data:[t,r]})):Promise.reject({type:"warning",id:22,message:"rtc peer",data:[t,"invalid jsep"]})}_iceRestart(t){let r=this._getHandle(t);if(r){var i=r.webrtcStuff;if(!i.isIceRestarting){if(i.isIceRestarting=!0,this.handleId!==t)return this._log("Performing remote ICE restart",t),this.sendMessage(t,{body:{request:"configure",restart:!0}},!1,!1,5).then(()=>{}).then(()=>{i.isIceRestarting=!1,this._log("ICE restart success")}).catch(()=>{i.isIceRestarting=!1});{this._log("Performing local ICE restart");let r=!!(i.stream&&i.stream.getAudioTracks().length>0),o=!!(i.stream&&i.stream.getVideoTracks().length>0);this._createAO("offer",t,!0).then(i=>i?this.sendMessage(t,{body:{request:"configure",keyframe:!0,audio:r,video:o,data:!0,...this.recordingFilename?{filename:this.recordingFilename}:{}},jsep:i},!1,!1,5):null).then(t=>{i.isIceRestarting=!1,this._log("ICE restart success")}).catch(t=>{i.isIceRestarting=!1,this.emit("error",{type:"warning",id:28,message:"iceRestart failed",data:t})})}}}}_setupTransceivers(t,r){let[i,o,a,c,u=null,l=null]=r,d=this._getHandle(t);if(!d)return null;let p=d.webrtcStuff;const setTransceiver=function(t,r,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"audio";r||i?r&&i?t&&(t.setDirection?t.setDirection("sendrecv"):t.direction="sendrecv"):r&&!i?t&&(t.setDirection?t.setDirection("sendonly"):t.direction="sendonly"):!r&&i&&(t?t.setDirection?t.setDirection("recvonly"):t.direction="recvonly":p.pc.addTransceiver(o,{direction:"recvonly"})):t&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive")};if(u||l)u&&setTransceiver(u,i,o,"audio"),l&&setTransceiver(l,a,c,"video");else{let t=p.pc.getTransceivers();if(t&&t.length>0)for(let r in t){let u=t[r];(u.sender&&u.sender.track&&"audio"===u.sender.track.kind||u.receiver&&u.receiver.track&&"audio"===u.receiver.track.kind)&&setTransceiver(u,i,o,"audio"),(u.sender&&u.sender.track&&"video"===u.sender.track.kind||u.receiver&&u.receiver.track&&"video"===u.receiver.track.kind)&&setTransceiver(u,a,c,"video")}}}_createAO(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"offer",r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this._getHandle(r);if(!o)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[r,"createAO",t]});let a=null;a="offer"===t?"createOffer":"createAnswer";let c=o.webrtcStuff,u={};return i&&(u.iceRestart=!0),c.pc[a](u).then(i=>{r===this.handleId&&"offer"===t&&this.enableDtx&&(i.sdp=i.sdp.replace("useinbandfec=1","useinbandfec=1;usedtx=1")),c.mySdp=i.sdp;let o=c.pc.setLocalDescription(i).catch(t=>Promise.reject({type:"warning",id:24,message:"setLocalDescription",data:[r,t]}));if(c.mediaConstraints=u,!c.iceDone&&!c.trickle)return Promise.resolve(null);var a={type:i.type,sdp:i.sdp};return i.e2ee&&(a.e2ee=!0),"hml"!==i.rid_order&&"lmh"!==i.rid_order||(a.rid_order=i.rid_order),i.force_relay&&(a.force_relay=!0),o.then(()=>a)},t=>Promise.reject({type:"warning",id:25,message:a,data:[r,t]}))}_publishRemote(t,r){let i=this._getHandle(t);if(!i)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[t,"publish remote participant"]});this._webrtc(t,!0);let o=i.webrtcStuff;return r?o.pc.setRemoteDescription(r).then(()=>{if(o.remoteSdp=r.sdp,o.candidates&&o.candidates.length>0){for(var i=0;i<o.candidates.length;i++){var a=o.candidates[i];a&&!0!==a.completed?o.pc.addIceCandidate(a):o.pc.addIceCandidate(null)}o.candidates=[]}return this._setupTransceivers(t,[!1,!0,!1,!0]),this._createAO("answer",t,!1).then(r=>r?this.sendMessage(t,{body:{request:"start",...this.roomId&&{room:this.roomId},...this.pin&&{pin:this.pin}},jsep:r}):(this.emit("error",{type:"warning",id:19,message:"publish remote participant",data:[t,"no jsep"]}),Promise.resolve()))},r=>Promise.reject({type:"warning",id:23,message:"setRemoteDescription",data:[t,r]})):Promise.resolve()}_republishOnTrackEnded(t){let r=this._getHandle(this.handleId);if(!r)return;let i=r.webrtcStuff;if(!i.stream)return;let o=i.streamMap[t]||[],a=[];for(let t=0;t<o.length;t++){let r=i.stream.getTracks().find(r=>r.id===o[t]);r&&a.push(r)}if(a.length){let r=new MediaStream;return a.forEach(t=>r.addTrack(t)),this.publishLocal(r,t)}return this.publishLocal(null,t)}publishLocal(){var t,r,i,o,a,c,u,l;let d=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"camera0";if(this.isDisconnecting||!this.isConnected)return Promise.reject({type:"warning",id:18,message:"Either not connected or disconnecting"});if((null==d||null===(t=d.getVideoTracks())||void 0===t?void 0:t.length)>1)return Promise.reject({type:"warning",id:30,message:"multiple video tracks not supported",data:null});if((null==d||null===(r=d.getAudioTracks())||void 0===r?void 0:r.length)>1)return Promise.reject({type:"warning",id:30,message:"multiple audio tracks not supported",data:null});let h=this._getHandle(this.handleId);if(!h)return Promise.reject({type:"error",id:31,message:"no local id, connect before publishing",data:null});this.emit("publishing",!0),this._webrtc(this.handleId);let m=h.webrtcStuff;m.stream||(m.stream=new MediaStream);let y=!this.isPublished,v=m.pc.getTransceivers(),b=[...m.streamMap[p]||[]];var _;null!=d&&d.getTracks().length?m.streamMap[p]=(null==d||null===(_=d.getTracks())||void 0===_?void 0:_.map(t=>t.id))||[]:delete m.streamMap[p];let w=null==m||null===(i=m.stream)||void 0===i||null===(o=i.getAudioTracks())||void 0===o?void 0:o.find(t=>b.includes(t.id));if(w){try{w.stop()}catch(t){this._log(t)}m.stream.removeTrack(w)}let S=null==m||null===(a=m.stream)||void 0===a||null===(c=a.getVideoTracks())||void 0===c?void 0:c.find(t=>b.includes(t.id));if(S){try{S.stop()}catch(t){this._log(t)}m.stream.removeTrack(S)}const I=this._findSimulcastConfig(p,this.simulcastSettings);let k=Promise.resolve(),x=Promise.resolve(),P=null,C=null,A=null==d||null===(u=d.getAudioTracks())||void 0===u?void 0:u.length,O=null==d||null===(l=d.getVideoTracks())||void 0===l?void 0:l.length;for(const t of v){var R,M,j,L,D,B,N,U,q,W,z,V,H,$;["sendonly","sendrecv"].includes(t.currentDirection)&&"audio"===(null===(R=t.sender)||void 0===R||null===(M=R.track)||void 0===M?void 0:M.kind)&&b.includes(null===(j=t.sender)||void 0===j||null===(L=j.track)||void 0===L?void 0:L.id)?P=t:["sendonly","sendrecv"].includes(t.currentDirection)&&"video"===(null===(D=t.sender)||void 0===D||null===(B=D.track)||void 0===B?void 0:B.kind)&&b.includes(null===(N=t.sender)||void 0===N||null===(U=N.track)||void 0===U?void 0:U.id)?C=t:"inactive"===t.currentDirection&&null!==(q=t.sender)&&void 0!==q&&null!==(W=q.getParameters())&&void 0!==W&&null!==(z=W.codecs)&&void 0!==z&&z.find(t=>t.mimeType.indexOf("audio")>-1)&&A&&!P?(P=t,y=!0):"inactive"===t.currentDirection&&null!==(V=t.sender)&&void 0!==V&&null!==(H=V.getParameters())&&void 0!==H&&null!==($=H.codecs)&&void 0!==$&&$.find(t=>t.mimeType.indexOf("video")>-1)&&O&&!C&&(C=t,y=!0)}if(A?(m.stream.addTrack(d.getAudioTracks()[0]),P&&P.sender?k=P.sender.replaceTrack(d.getAudioTracks()[0]):(m.pc.addTrack(d.getAudioTracks()[0],m.stream),y=!0)):P&&P.sender&&(k=P.sender.replaceTrack(null),y=!0),O)if(m.stream.addTrack(d.getVideoTracks()[0]),C&&C.sender)x=C.sender.replaceTrack(d.getVideoTracks()[0]);else{if(this.simulcast)if("firefox"!==g.browserDetails.browser)m.pc.addTransceiver(d.getVideoTracks()[0],{direction:"sendonly",streams:[m.stream],sendEncodings:structuredClone(null==I?void 0:I.bitrates)});else{let t=m.pc.addTransceiver(d.getVideoTracks()[0],{direction:"sendonly",streams:[m.stream]}),r=t?t.sender:null;if(r){let t=r.getParameters()||{};t.encodings=d.getVideoTracks()[0].sendEncodings||structuredClone(null==I?void 0:I.bitrates),r.setParameters(t)}}else m.pc.addTrack(d.getVideoTracks()[0],m.stream);y=!0}else C&&C.sender&&(x=C.sender.replaceTrack(null),y=!0);this.isAudioEnabed=!!(m.stream&&m.stream.getAudioTracks().length>0),this.isVideoEnabled=!!(m.stream&&m.stream.getVideoTracks().length>0),v=m.pc.getTransceivers(),b=[...m.streamMap[p]||[]],P||(P=v.find(t=>t.sender.track&&"audio"===t.sender.track.kind&&b.includes(t.sender.track.id))),C||(C=v.find(t=>t.sender.track&&"video"===t.sender.track.kind&&b.includes(t.sender.track.id)));let K=!!(d&&d.getAudioTracks().length>0),G=!!(d&&d.getVideoTracks().length>0);this._setupTransceivers(this.handleId,[K,!1,G,!1,P,C]);const emitEvents=()=>{var t,r;this.isPublished=!0,m.stream.onremovetrack||(m.stream.onremovetrack=t=>{});let i=null,o=m.stream.getTracks();this.emit("addLocalParticipant",{tid:generateUUID(),id:h.handleId,userId:null===(t=decodeJanusDisplay(h.userId))||void 0===t?void 0:t.userId,role:null===(r=decodeJanusDisplay(this.display))||void 0===r?void 0:r.role,stream:o.length?m.stream:null,track:null,streamMap:structuredClone(m.streamMap),source:p,adding:!1,removing:!1,constructId:this.constructId,hasAudioTrack:K,hasVideoTrack:G}),o.length&&o.forEach(t=>{var r,o;t.onended||(this.emit("addLocalParticipant",{tid:generateUUID(),id:h.handleId,userId:null===(r=decodeJanusDisplay(h.userId))||void 0===r?void 0:r.userId,role:null===(o=decodeJanusDisplay(this.display))||void 0===o?void 0:o.role,track:t,stream:m.stream,streamMap:structuredClone(m.streamMap),source:p,adding:!0,removing:!1,constructId:this.constructId,hasAudioTrack:K,hasVideoTrack:G}),t.onended=r=>{m.stream.removeTrack(t),clearTimeout(i),i=setTimeout(()=>{this._republishOnTrackEnded(p)},100)})}),this.isMuted=[];for(const t of Object.keys(m.streamMap)){var a,c,u,l,d,g;const r=null===(a=m.stream)||void 0===a||null===(c=a.getAudioTracks())||void 0===c?void 0:c.find(r=>m.streamMap[t].includes(r.id)),i=null===(u=m.stream)||void 0===u||null===(l=u.getVideoTracks())||void 0===l?void 0:l.find(r=>m.streamMap[t].includes(r.id));this.isMuted.push({type:"audio",value:!r||!r.enabled,source:t,mid:null===(d=v.find(t=>{var i,o,a,c;return"audio"===(null===(i=t.sender)||void 0===i||null===(o=i.track)||void 0===o?void 0:o.kind)&&(null===(a=t.sender)||void 0===a||null===(c=a.track)||void 0===c?void 0:c.id)===(null==r?void 0:r.id)}))||void 0===d?void 0:d.mid}),this.isMuted.push({type:"video",value:!i||!i.enabled,source:t,mid:null===(g=v.find(t=>{var r,o,a,c;return"video"===(null===(r=t.sender)||void 0===r||null===(o=r.track)||void 0===o?void 0:o.kind)&&(null===(a=t.sender)||void 0===a||null===(c=a.track)||void 0===c?void 0:c.id)===(null==i?void 0:i.id)}))||void 0===g?void 0:g.mid}),this.emit("localHasVideo",!!i,t),this.emit("localHasAudio",!!r,t)}for(const t of this.isMuted)this.emit("localMuted",{...t});return this.emit("published",{status:!0,hasStream:o.length>0}),this.emit("publishing",!1),this};return y?(this._log("Starting negotiation"),Promise.all([k,x]).then(()=>this._createAO("offer",this.handleId,!1)).then(t=>{if(!t)return null;t.sdp&&-1===t.sdp.indexOf("\r\na=ice-ufrag")&&(t.sdp=t.sdp.replace("\na=ice-ufrag","\r\na=ice-ufrag"));let r=[];return Object.keys(m.streamMap).forEach(t=>{const i=this._findSimulcastConfig(t,this.simulcastSettings);m.streamMap[t].forEach(o=>{let a=v.find(t=>t.sender.track&&t.sender.track.id===o);a&&r.push({mid:a.mid,description:JSON.stringify({source:t,simulcastBitrates:null==i?void 0:i.bitrates,intercomGroups:this._talkIntercomChannels})})})}),this.sendMessage(this.handleId,{body:{request:"configure",audio:this.isAudioEnabed,video:this.isVideoEnabled,data:!0,...this.recordingFilename?{filename:this.recordingFilename}:{},descriptions:r},jsep:t})}).then(t=>!0===this._isDataChannelOpen?Promise.resolve(t):new Promise((t,r)=>{let i=null,_resolve=r=>{r&&(clearTimeout(i),this._abortController.signal.removeEventListener("abort",_rejectAbort),this.off("dataChannel",_resolve,this),t(this))},_rejectAbort=()=>{this._abortController.signal.removeEventListener("abort",_rejectAbort),clearTimeout(i),this.off("dataChannel",_resolve,this),r({type:"warning",id:17,message:"Connection cancelled"})};i=setTimeout(()=>{this.off("dataChannel",_resolve,this),this._abortController.signal.removeEventListener("abort",_rejectAbort),r({type:"error",id:27,message:"Data channel did not open",data:null})},1e4),this._abortController.signal.addEventListener("abort",_rejectAbort),this.on("dataChannel",_resolve,this)})).then(()=>emitEvents()).catch(t=>(this.emit("publishing",!1),Promise.reject(t)))):Promise.all([k,x]).then(()=>emitEvents())}unpublishLocal(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isPublished?this.sendMessage(this.handleId,{body:{request:"unpublish"}},t).finally(t=>(this.isPublished=!1,this.emit("published",{status:!1,hasStream:!1}),t)):Promise.resolve()}getUserTalkIntercomChannels(t){let r=[],i=this._getHandle(null,null,t);if(i){r=i.webrtcStuff.tracksMap.reduce((t,r)=>{if(r.description)try{let i=JSON.parse(r.description);i.intercomGroups&&i.intercomGroups.forEach(r=>{t.includes(r)||t.push(r)})}catch(t){}return t},[])}return r}toggleAudio(){var t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"camera0",o=arguments.length>2?arguments[2]:void 0,a=this._getHandle(this.handleId);if(!a)return void this.emit("error",{type:"warning",id:21,message:"no local id, connect first",data:null});let c=a.webrtcStuff,u=null===(t=c.pc)||void 0===t?void 0:t.getTransceivers(),l=null;l=i?null==u?void 0:u.find(t=>t.sender&&t.sender.track&&"audio"===t.receiver.track.kind&&(c.streamMap[i]||[]).includes(t.sender.track.id)):null==u?void 0:u.find(t=>t.sender&&t.sender.track&&"audio"===t.receiver.track.kind&&(!o||t.mid===o)),l&&(l.sender.track.enabled=null!==r?!!r:!l.sender.track.enabled),this.isMuted=[];for(const t of Object.keys(c.streamMap)){var d,p,h,m,g,y,v,b;const r=null===(d=c.stream)||void 0===d||null===(p=d.getAudioTracks())||void 0===p?void 0:p.find(r=>c.streamMap[t].includes(r.id)),i=null==u?void 0:u.find(t=>t.sender.track&&"audio"===t.sender.track.kind&&t.sender.track.id===(null==r?void 0:r.id)),o=null===(h=c.stream)||void 0===h||null===(m=h.getVideoTracks())||void 0===m?void 0:m.find(r=>c.streamMap[t].includes(r.id)),a=null==u?void 0:u.find(t=>t.sender.track&&"video"===t.sender.track.kind&&t.sender.track.id===(null==o?void 0:o.id));this.isMuted.push({type:"audio",value:!r||!i||!(null!=i&&null!==(g=i.sender)&&void 0!==g&&null!==(y=g.track)&&void 0!==y&&y.enabled),source:t,mid:null==i?void 0:i.mid}),this.isMuted.push({type:"video",value:!o||!a||!(null!=a&&null!==(v=a.sender)&&void 0!==v&&null!==(b=v.track)&&void 0!==b&&b.enabled),source:t,mid:null==a?void 0:a.mid})}for(let t of this.isMuted)this.emit("localMuted",{...t})}toggleVideo(){var t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"camera0",o=arguments.length>2?arguments[2]:void 0,a=this._getHandle(this.handleId);if(!a)return void this.emit("error",{type:"warning",id:21,message:"no local id, connect first",data:null});let c=a.webrtcStuff,u=null===(t=c.pc)||void 0===t?void 0:t.getTransceivers(),l=null;l=i?null==u?void 0:u.find(t=>t.sender&&t.sender.track&&"video"===t.receiver.track.kind&&(c.streamMap[i]||[]).includes(t.sender.track.id)):null==u?void 0:u.find(t=>t.sender&&t.sender.track&&"video"===t.receiver.track.kind&&(!o||t.mid===o)),l&&(l.sender.track.enabled=null!==r?!!r:!l.sender.track.enabled),this.isMuted=[];for(const t of Object.keys(c.streamMap)){var d,p,h,m,g,y,v,b;const r=null===(d=c.stream)||void 0===d||null===(p=d.getAudioTracks())||void 0===p?void 0:p.find(r=>c.streamMap[t].includes(r.id)),i=null==u?void 0:u.find(t=>t.sender.track&&"audio"===t.sender.track.kind&&t.sender.track.id===(null==r?void 0:r.id)),o=null===(h=c.stream)||void 0===h||null===(m=h.getVideoTracks())||void 0===m?void 0:m.find(r=>c.streamMap[t].includes(r.id)),a=null==u?void 0:u.find(t=>t.sender.track&&"video"===t.sender.track.kind&&t.sender.track.id===(null==o?void 0:o.id));this.isMuted.push({type:"audio",value:!r||!i||!(null!=i&&null!==(g=i.sender)&&void 0!==g&&null!==(y=g.track)&&void 0!==y&&y.enabled),source:t,mid:null==i?void 0:i.mid}),this.isMuted.push({type:"video",value:!o||!a||!(null!=a&&null!==(v=a.sender)&&void 0!==v&&null!==(b=v.track)&&void 0!==b&&b.enabled),source:t,mid:null==a?void 0:a.mid})}for(let t of this.isMuted)this.emit("localMuted",{...t})}requestKeyFrame(t,r){this.sendMessage(t,{body:{request:"configure",keyframe:!0,...void 0!==r?{streams:[{mid:r,keyframe:!0}]}:{}}}).catch(()=>null)}_setSelectedSubstream(t,r,i){let o=this._getHandle(t);if(o){let t=o.webrtcStuff;r?t.selectedSubstream[r]=i:Object.keys(t.selectedSubstream).forEach(r=>{t.selectedSubstream[r]=i})}}overrideSimulcastSettings(t,r,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{mode:a,defaultSubstream:c}=o;let u=this._getHandle(t);if(!u)return Promise.resolve();let l=u.webrtcStuff;if(void 0!==i||void 0!==r){if(void 0===r){let t=l.pc.getTransceivers();for(let o of l.streamMap[i]){let i=t.find(t=>t.receiver.track&&"video"===t.receiver.track.kind&&t.receiver.track.id===o);if(i){r=i.mid;break}}}return void 0!==r&&(l.overriddenSimulcastMode[r]||(l.overriddenSimulcastMode[r]={}),l.overriddenSimulcastMode[r].defaultSubstream=c,l.overriddenSimulcastMode[r].mode=a,!0)}}selectSubStream(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._log("Select substream called for handle:",t,"Source or mid:",i||o,"Substream:",r);let c=this._getHandle(t);if(!c)return Promise.resolve();let u=c.webrtcStuff;return new Promise((c,l)=>{let d,abortResponse=()=>{clearTimeout(d),this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),l("aborted")},parseResponse=r=>{let i=JSON.parse(r.data);var a=i.sender;if(a===t){let t=(i.plugindata||{}).data||{},r=t.substream;null==r||void 0!==o&&t.mid!==o||(clearTimeout(d),this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),c({substream:r,sender:a}))}};if(void 0!==i||void 0!==o){if(void 0===o){let t=u.pc.getTransceivers();for(let r of u.streamMap[i]){let i=t.find(t=>t.receiver.track&&"video"===t.receiver.track.kind&&t.receiver.track.id===r);if(i){o=i.mid;break}}}if(void 0!==o){if(u.overriddenSimulcastMode[o]||(u.overriddenSimulcastMode[o]={}),null===r)return a&&(u.overriddenSimulcastMode[o].defaultSubstream=null,u.overriddenSimulcastMode[o].mode=null),void c({substream:r,sender:t});a&&(u.overriddenSimulcastMode[o].defaultSubstream=r,u.overriddenSimulcastMode[o].mode="manual"),this.ws.addEventListener("message",parseResponse),this._abortController.signal.addEventListener("abort",abortResponse),d=setTimeout(()=>{this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),l("timeout")},1e4),this.sendMessage(t,{body:{request:"configure",streams:[{mid:o,substream:parseInt(r)}]}})}else l("no mid found")}else l("no source or mid")})}setTalkIntercomChannels(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["participants"];"object"==typeof t&&"length"in t||(this._log("setTalkIntercomChannels: groups must be an array"),t=[t]),this._talkIntercomChannels=structuredClone(t);let r=this._getHandle(this.handleId);if(!r)return Promise.resolve();let i=r.webrtcStuff,o=i.pc.getTransceivers(),a=[];return Object.keys(i.streamMap).forEach(r=>{const c=this._findSimulcastConfig(r,this.simulcastSettings);i.streamMap[r].forEach(i=>{let u=o.find(t=>t.sender.track&&t.sender.track.id===i);u&&a.push({mid:u.mid,description:JSON.stringify({simulcastBitrates:null==c?void 0:c.bitrates,intercomGroups:t,source:r})})})}),this.sendMessage(this.handleId,{body:{request:"configure",descriptions:a}})}setListenIntercomChannels(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["participants"];if("object"==typeof t&&"length"in t||(this._log("setListenIntercomChannels: groups must be an array"),t=[t]),this._listenIntercomChannels=structuredClone(t),!this._getHandle(this.handleId))return Promise.resolve();let r=[];return this._participants.forEach(t=>{if(t.handleId===this.handleId)return;let i=this._getHandle(t.handleId);if(i){const o=i.webrtcStuff.tracksMap.filter(t=>t.active),a=[],c=[];o.forEach(r=>{if("data"===r.type)return;const i=JSON.parse(r.description),o=(null==i?void 0:i.intercomGroups)||[];this._listenIntercomChannels.some(t=>o.includes(t))?this._isAlreadySubscribed(t.handleId,r.id,r.mid)||a.push({feed:r.id,mid:r.mid}):c.push({feed:r.id,mid:r.mid})}),this._updateSubscribeMap(t.handleId,a,c),(a.length||c.length)&&r.push(this.sendMessage(i.handleId,{body:{request:"update",...a.length?{subscribe:a}:{},...c.length?{unsubscribe:c}:{}}}))}}),Promise.all(r)}setRoomType(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"watchparty";return this._roomType=t,this._roomType}setRestrictSubscribeToUserIds(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(this._restrictSubscribeToUserIds=structuredClone(t),!this.isConnected)return Promise.resolve(this._restrictSubscribeToUserIds);this.sendMessage(this.handleId,{body:{request:"listparticipants",room:this.roomId}}).then(t=>{let r=t.participants,i=this._remoteUsersCache,o=this._getHandle(this.handleId);r=r.filter(t=>t.id!==o.userId),i=i.filter(t=>r.find(r=>r.id===t.id)),i.forEach(t=>{const r=this._getHandle(null,null,null,t.userId);var i;this._participantShouldSubscribe(t.userId)?r&&null!==(i=r.webrtcStuff)&&void 0!==i&&i.pc?this._log("Already subscribed to ",t.userId):(this._log("Subscribing to ",t.userId),this._createParticipant(t.userId,t.id).then(r=>{this._updateParticipantsTrackData(r.handleId,t.streams);const i=t.streams.filter(t=>!t.disabled&&this._intercomSubscribe(t)).map(t=>({feed:t.id,mid:t.mid}));return r.webrtcStuff.subscribeMap=structuredClone(i),this.sendMessage(r.handleId,{body:{request:"join",room:this.roomId,ptype:"subscriber",private_id:this.privateId,streams:i,...this.webrtcVersion>1e3?{id:this.userId}:{},pin:this.pin}})}).catch(t=>{this.emit("error",t)})):r&&(this._log("Unsubscribing from ",t.userId),this._removeParticipant(r.handleId))})})}}_defineProperty(wt_room_RoomSession,"sessionTypes",{reactooroom:"janus.plugin.reactooroom",streaming:"janus.plugin.streaming"}),_defineProperty(wt_room_RoomSession,"userRoleSubscriptionRules",{participant:{watchparty:["participant","talkback"],studio:["participant","talkback","host","observer"],commentary:["participant","talkback","host"],intercom:["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"],videowall:["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"],"videowall-queue":["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"],"videowall-queue-video":["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"]},monitor:{watchparty:["participant","host"],studio:["participant","host","observer"],commentary:["participant","host"],intercom:["host","participant"],videowall:["host","participant"],"videowall-queue":["host","participant"],"videowall-queue-video":["host","participant"]},talkback:{watchparty:["participant","host","talkback"],studio:["participant","host","observer","talkback"],commentary:["host","participant","talkback"],intercom:["host","participant","talkback"],videowall:["host","participant","talkback"],"videowall-queue":["host","participant","talkback"],"videowall-queue-video":["host","participant","talkback"]},observer:{watchparty:["participant"],studio:["participant"],commentary:["participant"],intercom:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo1:{watchparty:["participant"],studio:["participant"],commentary:["participant"],intercom:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo2:{watchparty:["participant"],studio:["participant"],commentary:["participant"],intercom:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo3:{watchparty:["participant"],studio:["participant"],commentary:["participant"],intercom:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},host:{watchparty:[],studio:[],commentary:[],intercom:[],videowall:[],"videowall-queue":[],"videowall-queue-video":[]},companionTV:{},companionPhone:{}});var v=wt_room_Room,b=i(345),_=i(355);class wt_iot_Iot{constructor(t){Object.assign(this,Object(y.a)()),this.device=null,this.decoder=new TextDecoder("utf-8"),this.connectionActive=!1,this.log=wt_iot_Iot.noop,this.debugFlag=t,this.credentialsExpirationCheckIntervalId=null,this.currentCredentialsExpirationStamp=null,t&&this.enableDebug()}static noop(){}enableDebug(){this.log=console.log.bind(console)}startCredentialsExpirationCheck(t){this.stopCredentialsExpirationCheck(),this.currentCredentialsExpirationStamp=new Date(t).getTime(),this.credentialsExpirationCheckIntervalId=setInterval(()=>{const t=(new Date).getTime();this.currentCredentialsExpirationStamp-t<=3e5&&this.emit("updateCredentials")},5e3)}stopCredentialsExpirationCheck(){clearInterval(this.credentialsExpirationCheckIntervalId),this.credentialsExpirationCheckIntervalId=null}updateWebSocketCredentials(t,r,i,o){this.log("iot updateWebSocketCredentials"),this.device&&(this.device.updateWebSocketCredentials(t,r,i),this.startCredentialsExpirationCheck(o))}connect(t,r,i,o,a,c,u){let l=arguments.length>7&&void 0!==arguments[7]&&arguments[7];return this.log("iot connect"),this.disconnect(l).then(()=>new Promise((l,d)=>{this.device=Object(_.device)({protocol:"wss",clientId:r,region:i,host:t,accessKeyId:o,secretKey:a,sessionToken:c,keepalive:30,maximumReconnectTimeMs:8e3,enableMetrics:!1,debug:this.debugFlag,autoResubscribe:!0}),this.startCredentialsExpirationCheck(u);let __s=()=>{var t,r;null===(t=this.device)||void 0===t||t.off("connect",__s),null===(r=this.device)||void 0===r||r.off("error",__e),l(this.device)},__e=t=>{var r,i;null===(r=this.device)||void 0===r||r.off("connect",__s),null===(i=this.device)||void 0===i||i.off("error",__e),d(t)};this.device.once("connect",__s),this.device.once("error",__e),this.device.on("message",this.__messageCb.bind(this)),this.device.on("connect",this.__connectCb.bind(this)),this.device.on("reconnect",this.__reconnectCb.bind(this)),this.device.on("error",this.__failureCb.bind(this)),this.device.on("close",this.__closeCb.bind(this)),this.device.on("offline",this.__offlineCb.bind(this))}))}disconnect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.stopCredentialsExpirationCheck(),new Promise((r,i)=>{if(!this.device)return void r();let o=null,__c=()=>{clearTimeout(o),this.device=null,r()};o=setTimeout(__c,4e3),this.device.off("message",this.__messageCb.bind(this)),this.device.off("connect",this.__connectCb.bind(this)),this.device.off("reconnect",this.__reconnectCb.bind(this)),this.device.off("error",this.__failureCb.bind(this)),this.device.off("close",this.__closeCb.bind(this)),this.device.off("offline",this.__offlineCb.bind(this)),this.device.end(t,__c)})}isConnected(){return this.connectionActive}subscribe(t){return this.log("iot subscribe",t),this.device&&this.device.subscribe(t)}unsubscribe(t){return this.log("iot unsubscribe",t),this.device&&this.device.unsubscribe(t)}send(t,r){this.log("iot send",t,r);let i="object"==typeof r?JSON.stringify(r):r;return this.device&&this.device.publish(t,i)}__reconnectCb(){this.log("iot reconnect"),this.emit("reconnect")}__connectCb(){this.log("iot connect"),this.connectionActive=!0,this.emit("connect")}__failureCb(t){this.log("iot failure"),this.emit("error",t)}__closeCb(t){this.log("iot close"),this.connectionActive=!1,this.emit("close")}__offlineCb(t){this.log("iot offline"),this.emit("offline")}__messageCb(t,r,i){const o=t.split("/");let a=JSON.parse(this.decoder.decode(r));if(a.display){const t=decodeJanusDisplay(a.display);t.userId&&(a={...a,userId:t.userId,role:t.role,start:t.start})}if("user"===o[0]){const t=o[1].replace("_",":");this.emit("message",{userId:t,...a,event:a.event?"user:"+a.event:"user"})}else if("wt"===o[0]){const t=a.event,r=o[2];if("room"===o[1])"message"===t||"template_updated"===t||"record_start"===t||"record_stop"===t||"record_configured"===t||"record_livestream_available"===t||"record_livestream_kick"===t||"user_update_displayname"===t||"user_update_avatar"===t||"user_update_bio"===t||"user_update_customattributes"===t||"user_update_privateattributes"===t||"channel_changed"===t||"instance_homepage_changed"===t||"instance_settings_changed"===t||"externalmix_changed"===t||"video_uploaded"===t||"change_user_devices"===t||"queue"===t||"title_changed"===t||"videowall_changed"===t||"left"===t||"kicked"===t||"banned"===t||"unbanned"===t||"approved"===t||"muted"===t||"unmuted"===t||"messageRemoved"===t||"messageReported"===t||"chatClear"===t||"handRaised"===t||"handLowered"===t||"handsCleared"===t||"volume_set"===t?this.emit("message",{event:t,...a,roomId:r}):"joined"!==t&&"leaving"!==t||this.emit("message",{event:t,...a,isObserver:!!a.isObserver,roomId:r});else if("instanceroom"===o[1])"add_room"!==t&&"remove_room"!==t&&"set_room"!==t&&"instance_homepage_changed"!==t&&"instance_settings_changed"!==t||this.emit("message",{event:t,...a});else if("externalmix"===o[1]){const t=a.event;this.emit("message",{event:t,...a})}else"asset"===o[1]&&this.emit("message",{event:"asset",assetId:o[2],...a})}else if("wtr"===o[0]||"gwtr"===o[0]){const t=o[1],r=o[2];"control"===o[3]?this.emit("message",{event:"recorder_control",...a,recorderId:t,sessionId:r}):"monitor"===o[3]&&this.emit("message",{event:"recorder_monitor",...a,recorderId:t,sessionId:r})}}}var w=wt_iot_Iot;var models_auth=function(){var t=this;return{login:(t,r)=>this.__privates.auth.__client.then(i=>i.apis.auth.signIn({},{requestBody:{username:t,password:r}})).then(t=>(this.userId=t.data.userId,this.username=t.data.username,this.__privates.auth.login(t.data.idToken,t.data.accessToken,t.data.refreshToken))),providerLogin:(t,r,i,o)=>(r||"function"!=typeof this.__privates.providerAuth||({token:r,displayname:i}=this.__privates.providerAuth()),this.__privates.auth.__client.then(a=>a.apis.auth.providerSignIn({},{requestBody:{domain:t,token:r,...i&&{displayname:i},...o&&{deviceId:o}}})).then(t=>(this.userId=t.data.userId,this.username=t.data.username,this.__privates.auth.login(t.data.idToken,t.data.accessToken,t.data.refreshToken)))),getProviderAuth:()=>this.__privates.providerAuth,deviceLogin:function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ThisIsSaltyAF";return getBrowserFingerprint(t.__instanceType,r,i).then(r=>Promise.all([r,t.__privates.auth.__client])).then(t=>{let[r,i]=t;return i.apis.auth.deviceSignIn({},{requestBody:{deviceId:r,domain:location.hostname}})}).then(r=>(t.userId=r.data.userId,t.username=r.data.username,t.__privates.auth.login(r.data.idToken,r.data.accessToken,r.data.refreshToken)))},logout:()=>this.__privates.auth.logout(),isLoggedIn:()=>this.__privates.auth.isLoggedIn(),setLanguage:t=>this.__privates.auth.setLanguage(t),getLanguage:()=>this.__privates.auth.__language,signUp:(t,r,i,o)=>this.__privates.auth.__client.then(a=>a.apis.auth.signUp({},{requestBody:{username:t,password:r,email:i,phone:o}})),confirmSignUp:function(r,i,o){let a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return t.__privates.auth.__client.then(t=>t.apis.auth.confirmSignUp({},{requestBody:{confirmationCode:r,username:i,displayname:o,isPublic:a}})).then(r=>(t.userId=r.data.userId,t.username=r.data.username,t.__privates.auth.login(r.data.idToken,r.data.accessToken,r.data.refreshToken)))},resendConfirmationCode:t=>this.__privates.auth.__client.then(r=>r.apis.auth.resendConfirmationCode({},{requestBody:{username:t}})),forgotPassword:t=>this.__privates.auth.__client.then(r=>r.apis.auth.forgotPassword({},{requestBody:{username:t}})),confirmForgotPassword:(t,r,i)=>this.__privates.auth.__client.then(o=>o.apis.auth.confirmForgotPassword({},{requestBody:{password:i,confirmationCode:r,username:t}})),socialAuth:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.auth.socialAuth(r))},$on:(t,r,i)=>this.__privates.auth.on(t,r,i||this),$off:(t,r,i)=>this.__privates.auth.off(t,r,i||this),$clear:()=>this.__privates.auth.clear()}};var sync_hls=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=null;const l=6e4,d=1e4,p=.5,h=3;let m=0,g=null,y=null,v=!1,b=!1,_=2,w=!1,S=!0,I=!1,k=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(g)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),v=!1;const loop=()=>{b=!0,o.emit("playerSyncing",!0),sync().finally(()=>{b=!1,o.emit("playerSyncing",!1),isConnected()&&!v?g=setTimeout(loop,y):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(g),g=null,m=0,v=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(m++,m>h?(y=l,m=0):y=d):(y=l,m=0),t._log("--- Next sync will occur in "+y/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(k)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping);return o&&Math.abs(o)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekBy(o).then(()=>{const o=Date.now()-i,{position:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos+o,r.ping),u=Math.abs(a);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+o/1e3),t._log("Sync precision should be "+u);return setNextWaitTime(u>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{k&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{k&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"bufferStalledError"===r.details&&handleStalledWaiting()},hlsFragChanged=(t,r)=>{u=r.frag.sn},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{var t;let r=a.streamController.fragmentTracker.fragments;if(!r)return 0;let i=r[Object.keys(r).find(t=>t.indexOf(u)>-1)];return i?Math.max(1e3*(a.streamController.lastCurrentTime-((null===(t=i.body)||void 0===t?void 0:t.startPTS)||0)),0):0},calculateSyncDifferenceTime=(r,i,o)=>{var c;let l=a.streamController.fragmentTracker.fragments,d=Object.keys(l).map(t=>parseInt(t.slice(t.lastIndexOf("_")+1))).sort((function(t,r){return t-r})),p=l[Object.keys(l).find(t=>t.indexOf(u)>-1)];if(!p)return t._log("Current fragment not found, what now?",u),{position:null,isBufferSufficient:!1};let h=Math.max(1e3*(a.streamController.lastCurrentTime-((null===(c=p.body)||void 0===c?void 0:c.startPTS)||0)),0),m=1e3*p.body.duration;t._log("Our current fragment is: "+u),t._log("Our current fragment position is: "+h),t._log("Our current fragment length is: "+m);let g=r,y=Math.max(o/2+i,0),v=!1,b=d.indexOf(r)>-1?d.slice(d.indexOf(r)):[];for(let r=0,i=b.length;r<i;r++){let i=b[r],o=1e3*l[Object.keys(l).find(t=>t.indexOf(i)>-1)].body.duration;if(t._log("Correction diff: "+(y-o)),g=i,!(y-o>0)){t._log("Enough at fragment "+i),v=!0;break}t._log("Not enough at fragment "+i),y-=o}if(!v)return t._log(`We don't have required fragment ${g} yet`),{position:null,isBufferSufficient:!1};if(g<u){t._log("We are ahead of master..."),t._log("Real master fragment: "+g),t._log("Our fragment: "+u);let r=h-y,i=d.slice(d.indexOf(g));for(let t=0,o=i.length;t<o;t++){let o=i[t],a=1e3*l[Object.keys(l).find(t=>t.indexOf(o)>-1)].body.duration;if(o>=u)break;r+=a}return t._log("Sync difference is: "+r),{position:r/1e3*-1,isBufferSufficient:!0}}{t._log("We're behind or spot on master..."),t._log("Real master fragment: "+g),t._log("Our fragment: "+u);let r=y-h,i=d.slice(d.indexOf(u));for(let t=0,o=i.length;t<o;t++){let o=i[t],a=1e3*l[Object.keys(l).find(t=>t.indexOf(o)>-1)].body.duration;if(o>=g)break;r+=a}return t._log("We can proceed with seek time: "+r),{position:r/1e3,isBufferSufficient:!0}}},seekBy=r=>new Promise((i,o)=>{if(0!==r)if(r>0&&r<4){t._log("Fast forward to seek...");let a=!1,__=()=>{a&&c.pause(),c.playbackRate=1,I=!1,o("Stalled")},u=r;c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{a&&c.pause(),c.playbackRate=1,I=!1,c.removeEventListener("stalled",__,{once:!0}),i()},1e3*u/(_-1),20),I=!0,c.paused?(a=!0,c.play().then(()=>{c.playbackRate=_})):c.playbackRate=_}else{t._log("Jump to seek...");let o=Date.now();I=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),I=!1,i()},{once:!0}),c.currentTime+=r}else i()}),handlePlaying=()=>{I||(t._log("Handle playing"),startSyncLoop()),I=!1,S=c.paused,w=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),w=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),I||(stopSyncLoop(),clientPaused().catch(()=>{}),S=c.paused)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=u,o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Fragment: "+i),t._log("Fragment position: "+o),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String(i),fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=u,o=parseInt(getCurrentSegmentPosition());return new Promise((a,c)=>{let u=(new Date).getTime(),l=null,d=setTimeout(()=>{t.off("data",fn,this),c("Timeout")},3e3),p={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String(i),fragment_pos:Number(o)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),l||(l=(new Date).getTime()-u)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),l||(l=(new Date).getTime()-u),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+l),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(d),a({isMaster:!!r.sync_master_self,ping:l,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(d),c("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:p}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(d),c(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{hlsInstance:r,libraryInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r||i,c=a.media,a?(k=o,w=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),k&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&a.once("hlsFragChanged",()=>{restartSyncLoop()}),a.on("hlsError",buffering),a.on("hlsFragChanged",hlsFragChanged),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)):t._log("No hls.js player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&(a.off("hlsError",buffering),a.off("hlsFragChanged",hlsFragChanged)),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_hls_vod=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=null,l=!1;const d=6e4,p=1e4,h=.5,m=3;let g=0,y=null,v=null,b=!1,_=!1,w=null,S=300,I=!1,k=!1,x=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(y)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{_=!0,o.emit("playerSyncing",!0),sync().finally(()=>{_=!1,o.emit("playerSyncing",!1),isConnected()&&!b?y=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(y),y=null,g=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>m?(v=d,g=0):v=p):(v=d,g=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster||b)return setNextWaitTime(!1),Promise.resolve();if(x)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),c=getCurrentSegmentPosition()/1e3;return r.masterFragmentSn?playMedia():pauseMedia(),o&&Math.abs(o-c)<=h?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,c=Math.abs(o+(I?r:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!a),t._log("Seek duration is "+r),t._log("Sync precision should be "+c);return setNextWaitTime(c>h),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{x&&propagateMasterFunc(),c&&setTimeout(()=>{c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},1e3)},handleAddRemoteParticipant=()=>{x&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{x&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"bufferStalledError"===r.details&&handleStalledWaiting()},executePlayerIotEvents=r=>{let i=u||t.roomId;"playerReplay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||seekTo(0).then(()=>playMedia()),"playerPlay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||playMedia(),"playerPause"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(r=>{"sendMessage"===r.operation&&executePlayerIotEvents({...r,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)o.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(x&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;return{position:(r+i/2)/1e3,isBufferSufficient:!0}},seekMedia=r=>{if((r={userId:r.from,...r.text&&JSON.parse(r.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:i}=calculateSyncDifferenceTime(r.fragment,r.fragment_pos,0);return t?seekTo(t).then(()=>{x&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();k=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wait(100))).catch(()=>!0).finally(()=>(c.muted=t,k=!1,!0))},playMedia=()=>{c&&c.paused&&(k=!0,c.play().finally(()=>{k=!1}))},pauseMedia=()=>{c&&!c.paused&&(k=!0,c.addEventListener("pause",()=>{k=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(r=>{c.currentTime!==t?(k=!0,c.addEventListener("seeked",()=>{k=!1,r()},{once:!0}),c.currentTime=t):r()}),handlePlaying=()=>{k||i.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handlePause=()=>{k||i.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handleStalledWaiting=()=>{k||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(w),k||(w=setTimeout(()=>{let r=parseInt(getCurrentSegmentPosition());i.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(r)},void 0,null).catch(()=>{}),x||l||pauseMedia()},S))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=r=>{if(!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{hlsInstance:i,libraryInstance:d,propagateMaster:p=!1,isStudio:h=!1,roomId:m,syncDisabled:g}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i||d,c=a.media,u=m,l=g,a?(o.emit("playerSyncing",!1),x=p,I=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),r.iot.$on("message",parseIotEvents),x&&propagateMasterFunc().catch(()=>{}),a&&c&&(p||h?Promise.resolve():prePlay()).then(()=>{a.on("hlsError",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):t._log("No hls.js player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),r.iot.$off("message",parseIotEvents),a&&a.off("hlsError",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),a=null,c=null}}};var sync_native_hls_vod=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=!1;const l=6e4,d=1e4,p=.5,h=3;let m=0,g=null,y=null,v=!1,b=!1,_=null,w=300,S=!1,I=!1,k=!1;const startSyncLoop=()=>{if(u)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(g)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),v=!1;const loop=()=>{b=!0,o.emit("playerSyncing",!0),sync().finally(()=>{b=!1,o.emit("playerSyncing",!1),isConnected()&&!v?g=setTimeout(loop,y):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(g),g=null,m=0,v=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(m++,m>h?(y=l,m=0):y=d):(y=l,m=0),t._log("--- Next sync will occur in "+y/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster||v)return setNextWaitTime(!1),Promise.resolve();if(k)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),c=getCurrentSegmentPosition()/1e3;return r.masterFragmentSn?playMedia():pauseMedia(),o&&Math.abs(o-c)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,c=Math.abs(o+(S?r:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!a),t._log("Seek duration is "+r),t._log("Sync precision should be "+c);return setNextWaitTime(c>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{k&&propagateMasterFunc(),a&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{k&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{k&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,executePlayerIotEvents=r=>{let i=c||t.roomId;"playerReplay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||seekTo(0).then(()=>playMedia()),"playerPlay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||playMedia(),"playerPause"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(r=>{"sendMessage"===r.operation&&executePlayerIotEvents({...r,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)o.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(k&&null!==t.from)return;if(u)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=a&&a.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;return{position:(r+i/2)/1e3,isBufferSufficient:!0}},seekMedia=r=>{if((r={userId:r.from,...r.text&&JSON.parse(r.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:i}=calculateSyncDifferenceTime(r.fragment,r.fragment_pos,0);return t?seekTo(t).then(()=>{k&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(a.currentTime>0||!1===a.paused)return Promise.resolve();I=!0;let t=a.muted;return a.muted=!0,a.play().then(()=>(a.pause(),a.currentTime=0,wait(100))).catch(()=>!0).finally(()=>(a.muted=t,I=!1,!0))},playMedia=()=>{a&&a.paused&&(I=!0,a.play().finally(()=>{I=!1}))},pauseMedia=()=>{a&&!a.paused&&(I=!0,a.addEventListener("pause",()=>{I=!1},{once:!0}),a.pause())},seekTo=t=>new Promise(r=>{a.currentTime!==t?(I=!0,a.addEventListener("seeked",()=>{I=!1,r()},{once:!0}),a.currentTime=t):r()}),handlePlaying=()=>{I||i.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),S=!a.paused},handlePause=()=>{I||i.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),S=!a.paused},handleStalledWaiting=()=>{I||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(_),I||(_=setTimeout(()=>{let r=parseInt(getCurrentSegmentPosition());i.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(r)},void 0,null).catch(()=>{}),k||u||pauseMedia()},w))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=r=>{if(!a)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:S?"1":"0",fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:S?"1":"0",fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{videoElement:i,propagateMaster:l=!1,isStudio:d=!1,roomId:p,syncDisabled:h}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i,c=p,u=h,a?(o.emit("playerSyncing",!1),k=l,S=!1===a.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),r.iot.$on("message",parseIotEvents),k&&propagateMasterFunc().catch(()=>{}),a&&(l||d?Promise.resolve():prePlay()).then(()=>{a.addEventListener("stalled",handleStalledWaiting),a.addEventListener("playing",handlePlaying),a.addEventListener("pause",handlePause),a.addEventListener("seeking",handleSeeking),a.addEventListener("seeked",handleSeeked),a.addEventListener("ended",handleEnded),startSyncLoop()})):t._log("No video element present!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),r.iot.$off("message",parseIotEvents),a&&(a.removeEventListener("stalled",handleStalledWaiting),a.removeEventListener("playing",handlePlaying),a.removeEventListener("pause",handlePause),a.removeEventListener("seeking",handleSeeking),a.removeEventListener("seeked",handleSeeked),a.removeEventListener("ended",handleEnded)),a=null}}};var sync_native_hls=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null;const c=6e4,u=1e4,l=.5,d=3;let p=0,h=null,m=null,g=!1,y=!1,v=2,b=!1,_=!0,w=!1,S=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(h)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),g=!1;const loop=()=>{y=!0,o.emit("playerSyncing",!0),sync().finally(()=>{y=!1,o.emit("playerSyncing",!1),isConnected()&&!g?h=setTimeout(loop,m):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(h),h=null,p=0,g=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(p++,p>d?(m=c,p=0):m=u):(m=c,p=0),t._log("--- Next sync will occur in "+m/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return a.paused&&a.play(),setNextWaitTime(!1),Promise.resolve();if(S)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=l?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+r),t._log("Sync precision should be "+o);return setNextWaitTime(o>l),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{S&&propagateMasterFunc(),a&&!1===a.paused&&a.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{S&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=a&&a.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let c=a.buffered,u={};for(let t=0;t<c.length;t++){let r=c.start(t),i=c.end(t);(!u.start||r<u.start)&&(u.start=r),(!u.end||i>u.end)&&(u.end=i)}let l=(i+o/2)/1e3;return l>u.start&&l<u.end?{position:l,isBufferSufficient:!0}:l<u.start?(t._log(`Syncing to ${u.start} instead of ${l} due to lack of buffered data`),{position:u.start+.5,realPosition:l,isBufferSufficient:!1}):l>u.end?(t._log(`Syncing to ${u.end} instead of ${l} due to lack of buffered data`),{position:u.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=r=>new Promise((i,o)=>{if(a.currentTime!==r){let c=r-a.currentTime;if(a.currentTime<r&&c<4){t._log("Fast forward to seek...");let r=!1,__=()=>{r&&a.pause(),a.playbackRate=1,w=!1,o("Stalled")};a.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{r&&a.pause(),a.playbackRate=1,w=!1,a.removeEventListener("stalled",__,{once:!0}),i()},1e3*c/(v-1),20),w=!0,a.paused?(r=!0,a.play().then(()=>{a.playbackRate=v})):a.playbackRate=v}else{t._log("Jump to seek...");let o=Date.now();w=!0,a.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),w=!1,i()},{once:!0}),a.currentTime=r}}else i()}),handlePlaying=()=>{w||(t._log("Handle playing"),startSyncLoop()),w=!1,_=a.paused,b=!a.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),b=!a.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),w||(stopSyncLoop(),clientPaused().catch(()=>{}),_=a.paused)};let I=null;const stalledGenerator=()=>{clearTimeout(I),I=setTimeout(()=>{!1===a.paused&&handleStalledWaiting()},1e3)},roomSyncSend=r=>{if(!a)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{videoElement:r,syncOnLevelSwitch:i=!1,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r,S=o,b=!1===a.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),S&&propagateMasterFunc().catch(()=>{}),a&&!1===a.paused&&a.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),a.addEventListener("timeupdate",stalledGenerator),a.addEventListener("playing",handlePlaying),a.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&(a.removeEventListener("timeupdate",stalledGenerator),a.removeEventListener("playing",handlePlaying),a.removeEventListener("pause",handlePause))}}};var sync_shaka_dash=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null;const u=6e4,l=1e4,d=.5,p=3;let h=0,m=null,g=null,y=!1,v=!1,b=2,_=!1,w=!0,S=!1,I=!1;const buffering=t=>{t.buffering&&handleStalledWaiting()},startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),y=!1;const loop=()=>{v=!0,o.emit("playerSyncing",!0),sync().finally(()=>{v=!1,o.emit("playerSyncing",!1),isConnected()&&!y?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,h=0,y=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(h++,h>p?(g=u,h=0):g=l):(g=u,h=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+r),t._log("Sync precision should be "+o);return setNextWaitTime(o>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let a=c.buffered,u={};for(let t=0;t<a.length;t++){let r=a.start(t),i=a.end(t);(!u.start||r<u.start)&&(u.start=r),(!u.end||i>u.end)&&(u.end=i)}let l=(i+o/2)/1e3;return l>u.start&&l<u.end?{position:l,isBufferSufficient:!0}:l<u.start?(t._log(`Syncing to ${u.start} instead of ${l} due to lack of buffered data`),{position:u.start+.5,realPosition:l,isBufferSufficient:!1}):l>u.end?(t._log(`Syncing to ${u.end} instead of ${l} due to lack of buffered data`),{position:u.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=r=>new Promise((i,o)=>{if(c.currentTime!==r){let a=r-c.currentTime;if(c.currentTime<r&&a<4){t._log("Fast forward to seek...");let r=!1,__=()=>{r&&c.pause(),c.playbackRate=1,S=!1,o("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{r&&c.pause(),c.playbackRate=1,S=!1,c.removeEventListener("stalled",__,{once:!0}),i()},1e3*a/(b-1),20),S=!0,c.paused?(r=!0,c.play().then(()=>{c.playbackRate=b})):c.playbackRate=b}else{t._log("Jump to seek...");let o=Date.now();S=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),S=!1,i()},{once:!0}),c.currentTime=r}}else i()}),handlePlaying=()=>{S||(t._log("Handle playing"),startSyncLoop()),S=!1,w=c.paused,_=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),S||(stopSyncLoop(),clientPaused().catch(()=>{}),w=c.paused)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{libraryInstance:r,shakaInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r||i,c=a.getMediaElement(),I=o,_=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),I&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),a.addEventListener("buffering",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&a.removeEventListener("buffering",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_shaka_dash_vod=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=null,l=!1;const d=6e4,p=1e4,h=.5,m=3;let g=0,y=null,v=null,b=!1,_=!1,w=null,S=300,I=!1,k=!1,x=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(y)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{_=!0,o.emit("playerSyncing",!0),sync().finally(()=>{_=!1,o.emit("playerSyncing",!1),isConnected()&&!b?y=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(y),y=null,g=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>m?(v=d,g=0):v=p):(v=d,g=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster||b)return setNextWaitTime(!1),Promise.resolve();if(x)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),c=getCurrentSegmentPosition()/1e3;return r.masterFragmentSn?playMedia():pauseMedia(),o&&Math.abs(o-c)<=h?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,c=Math.abs(o+(I?r:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!a),t._log("Seek duration is "+r),t._log("Sync precision should be "+c);return setNextWaitTime(c>h),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{x&&propagateMasterFunc(),c&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{x&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{x&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{t.buffering&&handleStalledWaiting()},executePlayerIotEvents=r=>{let i=u||t.roomId;"playerReplay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||seekTo(0).then(()=>playMedia()),"playerPlay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||playMedia(),"playerPause"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(r=>{"sendMessage"===r.operation&&executePlayerIotEvents({...r,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)o.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(x&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;return{position:(r+i/2)/1e3,isBufferSufficient:!0}},seekMedia=r=>{if((r={userId:r.from,...r.text&&JSON.parse(r.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:i}=calculateSyncDifferenceTime(r.fragment,r.fragment_pos,0);return t?seekTo(t).then(()=>{x&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();k=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wait(100))).catch(()=>!0).finally(()=>(c.muted=t,k=!1,!0))},playMedia=()=>{c&&c.paused&&(k=!0,c.play().finally(()=>{k=!1}))},pauseMedia=()=>{c&&!c.paused&&(k=!0,c.addEventListener("pause",()=>{k=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(r=>{c.currentTime!==t?(k=!0,c.addEventListener("seeked",()=>{k=!1,r()},{once:!0}),c.currentTime=t):r()}),handlePlaying=()=>{k||i.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handlePause=()=>{k||i.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handleStalledWaiting=()=>{k||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(w),k||(w=setTimeout(()=>{let r=parseInt(getCurrentSegmentPosition());i.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(r)},void 0,null).catch(()=>{}),x||l||pauseMedia()},S))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{shakaInstance:i,libraryInstance:d,propagateMaster:p=!1,isStudio:h=!1,roomId:m,syncDisabled:g}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i||d,c=a.getMediaElement(),u=m,l=g,a?(o.emit("playerSyncing",!1),x=p,I=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),r.iot.$on("message",parseIotEvents),x&&propagateMasterFunc().catch(()=>{}),a&&c&&(p||h?Promise.resolve():prePlay()).then(()=>{a.addEventListener("buffering",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):console.log("No shaka player instance")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),r.iot.$off("message",parseIotEvents),a&&a.removeEventListener("buffering",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),a=null,c=null}}};var sync_dash=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null;const u=6e4,l=1e4,d=.5,p=3;let h=0,m=null,g=null,y=!1,v=!1,b=2,_=!1,w=!0,S=!1,I=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),y=!1;const loop=()=>{v=!0,o.emit("playerSyncing",!0),sync().finally(()=>{v=!1,o.emit("playerSyncing",!1),isConnected()&&!y?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,h=0,y=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(h++,h>p?(g=u,h=0):g=l):(g=u,h=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+r),t._log("Sync precision should be "+o);return setNextWaitTime(o>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{"video"!==t.mediaType&&"audio"!==t.mediaType||"bufferStalled"===t.state&&handleStalledWaiting()},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let a=c.buffered,u={};for(let t=0;t<a.length;t++){let r=a.start(t),i=a.end(t);(!u.start||r<u.start)&&(u.start=r),(!u.end||i>u.end)&&(u.end=i)}let l=(i+o/2)/1e3;return l>u.start&&l<u.end?{position:l,realPosition:l,isBufferSufficient:!0}:l<u.start?(t._log(`Syncing to ${u.start} instead of ${l} due to lack of buffered data`),{position:u.start+.5,realPosition:l,isBufferSufficient:!1}):l>u.end?(t._log(`Syncing to ${u.end} instead of ${l} due to lack of buffered data`),{position:u.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=r=>new Promise((i,o)=>{if(c.currentTime!==r){let a=r-c.currentTime;if(c.currentTime<r&&a<4){t._log("Fast forward to seek...");let r=!1,__=()=>{r&&c.pause(),c.playbackRate=1,S=!1,o("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{r&&c.pause(),c.playbackRate=1,S=!1,c.removeEventListener("stalled",__,{once:!0}),i()},1e3*a/(b-1),20),S=!0,c.paused?(r=!0,c.play().then(()=>{c.playbackRate=b})):c.playbackRate=b}else{t._log("Jump to seek...");let o=Date.now();S=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),S=!1,i()},{once:!0}),c.currentTime=r}}else i()}),handlePlaying=()=>{S||(t._log("Handle playing"),startSyncLoop()),S=!1,w=c.paused,_=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),S||(stopSyncLoop(),clientPaused().catch(()=>{}),w=c.paused)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dashInstance:r,libraryInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r||i,c=a.getVideoElement(),a?(I=o,_=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),I&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),a.on("bufferStateChanged",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)):t._log("No dash player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&a.off("bufferStateChanged",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_dash_vod=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=null,l=!1;const d=6e4,p=1e4,h=.5,m=3;let g=0,y=null,v=null,b=!1,_=!1,w=null,S=300,I=!1,k=!1,x=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(y)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{_=!0,o.emit("playerSyncing",!0),sync().finally(()=>{_=!1,o.emit("playerSyncing",!1),isConnected()&&!b?y=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(y),y=null,g=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>m?(v=d,g=0):v=p):(v=d,g=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster||b)return setNextWaitTime(!1),Promise.resolve();if(x)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),c=getCurrentSegmentPosition()/1e3;return r.masterFragmentSn?playMedia():pauseMedia(),o&&Math.abs(o-c)<=h?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,c=Math.abs(o+(I?r:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!a),t._log("Seek duration is "+r),t._log("Sync precision should be "+c);return setNextWaitTime(c>h),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{x&&propagateMasterFunc(),c&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{x&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{x&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{"video"!==t.mediaType&&"audio"!==t.mediaType||"bufferStalled"===t.state&&handleStalledWaiting()},executePlayerIotEvents=r=>{let i=u||t.roomId;"playerReplay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||seekTo(0).then(()=>playMedia()),"playerPlay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||playMedia(),"playerPause"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(r=>{"sendMessage"===r.operation&&executePlayerIotEvents({...r,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)o.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(x&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;return{position:(r+i/2)/1e3,isBufferSufficient:!0}},seekMedia=r=>{if((r={userId:r.from,...r.text&&JSON.parse(r.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:i}=calculateSyncDifferenceTime(r.fragment,r.fragment_pos,0);return t?seekTo(t).then(()=>{x&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();k=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wait(100))).catch(()=>!0).finally(()=>(c.muted=t,k=!1,!0))},playMedia=()=>{c&&c.paused&&(k=!0,c.play().finally(()=>{k=!1}))},pauseMedia=()=>{c&&!c.paused&&(k=!0,c.addEventListener("pause",()=>{k=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(r=>{c.currentTime!==t?(k=!0,c.addEventListener("seeked",()=>{k=!1,r()},{once:!0}),c.currentTime=t):r()}),handlePlaying=()=>{k||i.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handlePause=()=>{k||i.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handleStalledWaiting=()=>{k||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(w),k||(w=setTimeout(()=>{let r=parseInt(getCurrentSegmentPosition());i.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(r)},void 0,null).catch(()=>{}),x||l||pauseMedia()},S))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dashInstance:i,libraryInstance:d,propagateMaster:p=!1,isStudio:h=!1,roomId:m,syncDisabled:g}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i||d,c=a.getVideoElement(),u=m,l=g,a?(o.emit("playerSyncing",!1),x=p,I=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),r.iot.$on("message",parseIotEvents),x&&propagateMasterFunc().catch(()=>{}),a&&c&&(p||h?Promise.resolve():prePlay()).then(()=>{a.on("bufferStateChanged",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):console.log("No player instance")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),r.iot.$off("message",parseIotEvents),a&&a.off("bufferStateChanged",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),a=null,c=null}}};var sync_doris=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null;const u=6e4,l=1e4,d=.5,p=3;let h=0,m=null,g=null,y=!1,v=!1,b=2,_=!1,w=!0,S=!1,I=!1,k=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),y=!1;const loop=()=>{v=!0,o.emit("playerSyncing",!0),sync().finally(()=>{v=!1,o.emit("playerSyncing",!1),isConnected()&&!y?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,h=0,y=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(h++,h>p?(g=u,h=0):g=l):(g=u,h=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,act:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping);return o&&Math.abs(o)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekDoris(o,a).then(()=>{const o=Date.now()-i,{position:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos+o,r.ping),u=Math.abs(a);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+o),t._log("Sync precision should be "+u);return setNextWaitTime(u>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{var t;return null===(t=a.getCurrentDate())||void 0===t?0:t.getTime()},calculateSyncDifferenceTime=function(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;var o;let c=null===(o=a.getCurrentDate())||void 0===o?null:o.getTime();return c&&r?{position:(r+i/2-c)/1e3,act:r+i/2,isBufferSufficient:!0}:{position:null,isBufferSufficient:!1}},seekDoris=(r,i)=>new Promise((o,u)=>{if(0!==r)if(k)S=!0,c.addEventListener("playing",()=>{S=!1,o()},{once:!0}),a.seekTo(new Date(i));else if(r>0&&r<4){t._log("Fast forward to seek...");let i=!1,__=()=>{i&&c.pause(),c.playbackRate=1,S=!1,u("Stalled")},a=r;c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{i&&c.pause(),c.playbackRate=1,S=!1,c.removeEventListener("stalled",__,{once:!0}),o()},1e3*a/(b-1),20),S=!0,c.paused?(i=!0,c.play().then(()=>{c.playbackRate=b})):c.playbackRate=b}else{t._log("Jump to seek...");let i=Date.now();S=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-i)/1e3} seconds to seek `),S=!1,o()},{once:!0}),c.currentTime+=r}else o()}),handlePlaying=()=>{S||(t._log("Handle playing"),startSyncLoop()),S=!1,w=c.paused,_=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),S||(stopSyncLoop(),clientPaused().catch(()=>{}),w=c.paused)};let x=null;const stalledGenerator=()=>{clearTimeout(x),x=setTimeout(()=>{!1===c.paused&&handleStalledWaiting()},1e3)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dorisInstance:r,libraryInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r||i,c=a.sourceHandler.getElement(),I=o,_=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),I&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),c.addEventListener("timeupdate",stalledGenerator),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),c&&(c.removeEventListener("timeupdate",stalledGenerator),c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_disabled=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const handleAddLocalParticipant=()=>{removeMaster()},handleAddRemoteParticipant=()=>{removeMaster()},handleRemoveRemoteParticipant=()=>{removeMaster()},removeMaster=()=>t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}});return{__events:[],initialize:function(){let{}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant)},destroy:()=>{t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant)}}};var sync_dazn_dash=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null;const u=6e4,l=1e4,d=.5,p=3;let h=0,m=null,g=null,y=!1,v=!1,b=2,_=!1,w=!0,S=!1,I=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),y=!1;const loop=()=>{v=!0,o.emit("playerSyncing",!0),sync().finally(()=>{v=!1,o.emit("playerSyncing",!1),isConnected()&&!y?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,h=0,y=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(h++,h>p?(g=u,h=0):g=l):(g=u,h=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+r),t._log("Sync precision should be "+o);return setNextWaitTime(o>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let a=c.buffered,u={};for(let t=0;t<a.length;t++){let r=a.start(t),i=a.end(t);(!u.start||r<u.start)&&(u.start=r),(!u.end||i>u.end)&&(u.end=i)}let l=(i+o/2)/1e3;return l>u.start&&l<u.end?{position:l,realPostion:l,isBufferSufficient:!0}:l<u.start?(t._log(`Syncing to ${u.start} instead of ${l} due to lack of buffered data`),{position:u.start+.5,realPostion:l,isBufferSufficient:!1}):l>u.end?(t._log(`Syncing to ${u.end} instead of ${l} due to lack of buffered data`),{position:u.end-.5,realPostion:l,isBufferSufficient:!1}):{position:null,realPostion:l,isBufferSufficient:!1}},seekTo=r=>new Promise((i,o)=>{if(c.currentTime!==r){let a=r-c.currentTime;if(c.currentTime<r&&a<4){t._log("Fast forward to seek...");let r=!1,__=()=>{r&&c.pause(),c.playbackRate=1,S=!1,o("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{r&&c.pause(),c.playbackRate=1,S=!1,c.removeEventListener("stalled",__,{once:!0}),i()},1e3*a/(b-1),20),S=!0,c.paused?(r=!0,c.play().then(()=>{c.playbackRate=b})):c.playbackRate=b}else{t._log("Jump to seek...");let o=Date.now();S=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),S=!1,i()},{once:!0}),c.currentTime=r}}else i()}),handlePlaying=()=>{S||(t._log("Handle playing"),startSyncLoop()),S=!1,w=c.paused,_=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),S||(stopSyncLoop(),clientPaused().catch(()=>{}),w=c.paused)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{libraryInstance:r,propagateMaster:i=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r,c=a.videoElement,I=i,_=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),I&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),a.addEventListener("buffer",handleStalledWaiting),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&a.removeEventListener("buffer",handleStalledWaiting),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_dazn=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=Object(y.a)(),c=null,u={isLive:!0,ignoreBufferedTimeRanges:!0,useSeekBy:!1,syncBySegments:!1,disableFastSeek:!1};const l=6e4,d=1e4,p=.5,h=3,m=5e3;let g=0,v=null,b=null,_=!1,w=!1,S=2,I=!1,k=!0,x=!1,P=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(v)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),_=!1;const loop=()=>{w=!0,o.emit("playerSyncing",!0),sync().finally(()=>{w=!1,o.emit("playerSyncing",!1),isConnected()&&!_?v=setTimeout(loop,b):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(v),v=null,g=0,_=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>h?(b=l,g=0):b=d):(b=l,g=0),t._log("--- Next sync will occur in "+b/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.isPaused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(P)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log(a,r,getCurrentSegmentPosition()),t._log("Insufficient buffer: ",!c),t._log(`Seek duration is ${r} seconds`),t._log("Sync precision should be "+o);return setNextWaitTime(o>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{P&&propagateMasterFunc(),!1===c.isPaused&&a.once("timeupdate",restartSyncLoop)},handleAddRemoteParticipant=()=>{P&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let a=c.buffered,l=(i+o/2)/1e3;if(a&&!u.ignoreBufferedTimeRanges){let r={};for(let t=0;t<a.length;t++){let i=a.start(t),o=a.end(t);(!r.start||i<r.start)&&(r.start=i),(!r.end||o>r.end)&&(r.end=o)}return l>r.start&&l<r.end?{position:l,realPosition:l,isBufferSufficient:!0}:l<r.start?(t._log(`Syncing to ${r.start} instead of ${l} due to lack of buffered data`),{position:r.start+.5,realPosition:l,isBufferSufficient:!1}):l>r.end?(t._log(`Syncing to ${r.end} instead of ${l} due to lack of buffered data`),{position:r.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,isBufferSufficient:!1}}return{position:l,realPosition:l,isBufferSufficient:!0}},seekTo=r=>new Promise((i,o)=>{if(c.currentTime!==r){let l=r-c.currentTime;if(c.currentTime<r&&l<4){t._log("Fast forward to seek...");let r=!1,_handleFailed=()=>{r&&c.pause(),c.setPlaybackRate(1),x=!1,o("Stalled")},_fastForward=()=>{x=!0,setExactTimeout(()=>{a.off("stalled",_handleFailed),r&&!u.isLive&&c.pause(),c.setPlaybackRate(1),x=!1,i()},1e3*l/(S-1),20),c.setPlaybackRate(S)};a.once("stalled",_handleFailed),c.isPaused?(r=!0,c.play().then(()=>{_fastForward()}).catch(_handleFailed)):_fastForward()}else{t._log("Jump to seek...");let o=Date.now(),u=null,_resolve=()=>{clearTimeout(u),u=null,x=!1,t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),i()};x=!0,a.once("playing",_resolve),u=setTimeout(_resolve,m),c.seek(r)}}else i()}),handlePlaying=()=>{x||(t._log("Handle playing"),startSyncLoop()),x=!1,k=c.isPaused,I=!c.isPaused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),I=!c.isPaused},handleBuffering=()=>{t._log("handleBuffering"),x||(stopSyncLoop(),clientPaused().catch(()=>{}),k=c.isPaused)},roomSyncSend=r=>{if(!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],getHandlers:()=>({handlePause:r=>{t._log("handlePause"),a.emit("pause",r)},handlePlaying:r=>{t._log("handlePlaying"),a.emit("playing",r)},handleBuffering:r=>{t._log("handleBuffering"),a.emit("buffering",r)},handleStalled:r=>{t._log("handleBuffering"),t._log("handleStalled"),a.emit("buffering",r),a.emit("stalled",r)},handleTimeupdate:r=>{t._log("handleTimeupdate"),a.emit("timeupdate",r)}}),initialize:function(){let{playerInterface:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c=r,u={...u,...c.options||{}},t._log("Interface options passed: ",c.options||{}),t._log("All interface options: ",u),P=!1,I=!1===c.isPaused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),P&&propagateMasterFunc().catch(()=>{}),!1===c.isPaused&&a.once("timeupdate",restartSyncLoop),a.on("buffering",handleBuffering),a.on("playing",handlePlaying),a.on("pause",handlePause)},destroy:()=>{var r,i;(stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),"function"==typeof(null===(r=c)||void 0===r?void 0:r.destroy))&&(null===(i=c)||void 0===i||i.destroy());c=null,a.clear()}}};var sync_module=function(){let{room:t,emitter:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object(y.a)(),o=null,a=!1,c={type:"none",ignoreBufferedTimeRanges:!0,disableFastSeek:!1};const u=6e4,l=1e4,d=.5,p=3,h=5e3,m=4;let g=0,v=null,b=null,_=!1,w=!1,S=2,I=2,k=!1,x=!0,P=!1;const startSyncLoop=()=>{if(isConnected()||"push"===c.type)if(v)t._log("--- Sync loop already running ---");else if(t._log("--- Sync enabled ---"),_=!1,"push"!==c.type){const loop=()=>{w=!0,r.emit("playerSyncing",!0),sync().finally(()=>{w=!1,r.emit("playerSyncing",!1),isConnected()&&!_?v=setTimeout(loop,b):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()}else{const loop2=()=>{seekForward().then(()=>{setNextWaitTime(!1)}).catch(t=>{setNextWaitTime(!0),console.log("Sync failed",t)}),v=setTimeout(loop2,b)};loop2()}else t._log("--- Sync loop will not start due to user not connected yet ---")},stopSyncLoop=r=>{t._log("--- Sync disabled ---"),clearTimeout(v),v=null,r||(g=0),_=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>p?(b=u,g=0):b=l):(b=u,g=0),t._log("--- Next sync will occur in "+b/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return o.isPaused&&o.play(),setNextWaitTime(!1),Promise.resolve();if(a)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:a,realPosition:c,isBufferSufficient:u}=o.getTimeDifference?o.getTimeDifference(r.masterFragmentSn,r.masterFragmentPos,r.ping):getTimeDifference(r.masterFragmentSn,r.masterFragmentPos,r.ping);return a&&Math.abs(a)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null===a||isNaN(a)?(t._log("Position in not a number: ",a),setNextWaitTime(!0),Promise.reject()):seekBy(a).then(()=>{const a=Date.now()-i,{position:c,realPosition:u,isBufferSufficient:l}=o.getTimeDifference?o.getTimeDifference(r.masterFragmentSn,r.masterFragmentPos+a,r.ping):getTimeDifference(r.masterFragmentSn,r.masterFragmentPos+a,r.ping),p=Math.abs(u);t._log("Insufficient buffer: ",!l),t._log(`Seek duration is ${a/1e3} seconds`),t._log("Sync precision should be "+p);return setNextWaitTime(p>d),Promise.resolve()}).catch(r=>(t._log("Seek failed: ",r),setNextWaitTime(!0),Promise.reject(r)))}}).catch(r=>(t._log("getSyncData() failed: ",r),setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{a&&propagateMasterFunc(),!1===o.isPaused&&i.once("timeupdate",restartSyncLoop)},handleAddRemoteParticipant=()=>{a&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentPlayerPosition=()=>{let t=o.currentTime;return isNaN(t)?0:1e3*t},getTimeDifference=(r,i,a)=>{let u=o.buffered,l=(i+a/2)/1e3,d=getCurrentPlayerPosition()/1e3;if(u&&!c.ignoreBufferedTimeRanges){let r={};for(let t=0;t<u.length;t++){let i=u.start(t),o=u.end(t);(!r.start||i<r.start)&&(r.start=i),(!r.end||o>r.end)&&(r.end=o)}return l>r.start&&l<r.end?{position:l-d,realPosition:l-d,isBufferSufficient:!0}:l<r.start?(t._log(`Syncing to ${r.start} instead of ${l} due to lack of buffered data`),{position:r.start+.5-d,realPosition:l-d,isBufferSufficient:!1}):l>r.end?(t._log(`Syncing to ${r.end} instead of ${l} due to lack of buffered data`),{position:r.end-.5-d,realPosition:l-d,isBufferSufficient:!1}):{position:null,isBufferSufficient:!1}}return{position:l-d,realPosition:l-d,isBufferSufficient:!0}},seekForward=()=>new Promise((t,r)=>{let a=o.buffered.end(0)-o.currentTime,c=a-S,__=()=>{o.setPlaybackRate(1),P=!1,w=!1,r("Stalled")};console.log("Users stream is behind behind live by:",a),c>0?(i.once("stalled",__),setExactTimeout(()=>{o.setPlaybackRate(1),P=!1,w=!1,i.off("stalled",__),t()},1e3*c/(I-1),20),P=!0,w=!0,o.setPlaybackRate(I)):t()}),seekBy=r=>new Promise((a,u)=>{if(o.currentTime!==r)if(r>0&&r<m&&!c.disableFastSeek){t._log("Fast forward to seek...");let c=!1,_handleFailed=()=>{c&&o.pause(),o.setPlaybackRate(1),P=!1,u("Stalled")},_fastForward=()=>{P=!0,setExactTimeout(()=>{i.off("stalled",_handleFailed),c&&o.isVod&&o.pause(),o.setPlaybackRate(1),P=!1,a()},1e3*r/(I-1),20),o.setPlaybackRate(I)};i.once("stalled",_handleFailed),o.isPaused?(c=!0,o.play().then(()=>{_fastForward()}).catch(_handleFailed)):_fastForward()}else{t._log("Jump to seek...");let c=Date.now(),u=null,_resolve=()=>{clearTimeout(u),u=null,P=!1,t._log(`It took the player ${(Date.now()-c)/1e3} seconds to seek `),a()};P=!0,i.once("playing",_resolve),u=setTimeout(_resolve,h),o.seek(o.currentTime+r)}else a()}),handlePlaying=()=>{P||(t._log("Handle playing"),startSyncLoop()),P=!1,x=o.isPaused,k=!o.isPaused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),k=!o.isPaused},handleBuffering=()=>{t._log("handleBuffering"),P||(stopSyncLoop(!0),clientPaused().catch(()=>{}),x=o.isPaused)},roomSyncSend=r=>{var i;if(!o)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();var a=(null===(i=o)||void 0===i?void 0:i.currentFragment)||{fragment:String("0"),fragment_pos:Number(parseInt(getCurrentPlayerPosition()))};return t._log("Sending my position to "+r),t._log(`Current time: ${a.fragment} # ${a.fragment_pos}`),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),slave_id:t.webrtcVersion>1e3?String(r):Number(r),...a}})},getSyncData=()=>{var r;t._log("Sending roomSync request");let i=t.roomId;var a=(null===(r=o)||void 0===r?void 0:r.currentFragment)||{fragment:String("0"),fragment_pos:Number(parseInt(getCurrentPlayerPosition()))};return new Promise((r,o)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),o("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),...a},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!i.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+i.sync_master_fragment),t._log("Master fragment position: "+i.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),r({isMaster:!!i.sync_master_self,ping:u,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),o("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),o(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{playerInterface:r,propagateMaster:u=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o=r,c={...c,...o.syncSettings||{}},a=u,t._log("Interface options passed: ",o.syncSettings||{}),t._log("All interface options: ",c),"none"!==c.type?o.isVod?t._log("VOD sync is not implemented in this sync module yet"):(r.addHandlers({handlePause:r=>{t._log("handlePause"),i.emit("pause",r)},handlePlaying:r=>{t._log("handlePlaying"),i.emit("playing",r)},handleBuffering:r=>{t._log("handleBuffering"),i.emit("buffering",r),i.emit("stalled",r)},handleTimeupdate:r=>{t._log("handleTimeupdate"),i.emit("timeupdate",r)}}),k=!1===o.isPaused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),a&&propagateMasterFunc().catch(()=>{}),!1===o.isPaused&&i.once("timeupdate",restartSyncLoop),i.on("buffering",handleBuffering),i.on("playing",handlePlaying),i.on("pause",handlePause)):t._log("Sync module has been disabled via type:none")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),o=null,i.clear()}}};var room_session=function(t,r,i){let{roomId:o,pinHash:a,role:c,options:u={}}=t,l=o,{simulcast:d=null,simulcastSettings:p=null,enableDtx:h=null,subscriptionRules:m=null}=u,g=["changePlayerSource","chatMessage","userUpdate","reconnecting","connecting","remoteMuted","scaling"];const addEvents=t=>{g=[...g,...t]},v=Object(y.a)();let b,_=null,w=null;return r.on("addLocalParticipant",()=>{clearTimeout(_),_=setTimeout(()=>{b.__requestMuteStatus()},2e3)}),r.on("localMuted",t=>{let{type:r,value:i,source:o,mid:a}=t;b.sendSystemMessage("remote_muted",{type:r,value:i,source:o,mid:a})}),r.on("data",t=>{b.__parseDataEvents(t)}),b={syncModule:null,playerInterface:null,get userId(){return r.userId},get roomId(){return o},get sessionId(){return r.sessionId},get constructId(){return r.constructId},changeUserRole:function(t){c=t},kill:function(){return clearTimeout(_),this.detachPlayer(),r.destroy().finally(()=>(this.$clear(),!0))},destroy:function(){return i.room.destroySession(r.constructId)},connect:function(){var t;let{reactooRoomId:u=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return v.emit("connecting",!0),clearTimeout(_),w=new AbortController,i.room.__joinRoom({roomId:u||l,pinHash:a,role:c},null===(t=w)||void 0===t?void 0:t.signal).then(t=>{var i,a,c,u;return(null==t||null===(i=t.data)||void 0===i?void 0:i.reactooRoomId)!==o&&(o=t.data.reactooRoomId,v.emit("changeRoomId",o)),r.setRoomType(t.data.roomType),r.connect(t.data.roomId,t.data.pin,t.data.href,t.data.iceServers,t.data.accessToken,t.data.display,t.data.userId,t.data.webrtcVersion,t.data.bitrate?parseInt(t.data.bitrate):0,t.data.recordingFilename,null!==d?d:!(null==t||null===(a=t.data)||void 0===a||!a.simulcast),null!==p?p:null==t||null===(c=t.data)||void 0===c?void 0:c.simulcast,null!==h?h:null==t||null===(u=t.data)||void 0===u?void 0:u.enableDtx)}).finally(()=>{v.emit("connecting",!1)})},disconnect:function(t){var i,o;return clearTimeout(_),null===(i=w)||void 0===i||null===(o=i.abort)||void 0===o||o.call(i),r.disconnect(t)},restart:function(){var t;let{isObserver:i=!1,reactooRoomId:o=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};v.emit("reconnecting",!0),r.isRestarting=!0;let a=r.isPublished,c=r._getHandle(r.handleId),u=null;return null!=c&&null!==(t=c.webrtcStuff)&&void 0!==t&&t.stream&&a&&(u=c.webrtcStuff.stream),this.disconnect().then(()=>wait(1e3)).then(()=>this.connect({reactooRoomId:o})).then(()=>i?this.publishLocal(null):u?this.publishLocal(u):Promise.resolve()).then(()=>(r.isRestarting=!1,v.emit("reconnecting",!1),1)).catch(t=>(r.isRestarting=!1,v.emit("reconnecting",!1),v.emit("error",{type:"error",id:26,message:"reconnecting failed",data:t}),Promise.reject(0)))},getStats:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return r._getStats(t)},getRoomParticipants:function(){return r._participants},__parseDataEvents:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("message"===t.videoroom)if("pending_shutdown"===t.action||"shutting_down"===t.action)v.emit("scaling"),this.restart();else if("force_restart"===t.action)this.restart();else if("user_update_displayname"===t.action||"user_update_avatar"===t.action||"user_update_customattributes"===t.action||"user_update_privateattributes"===t.action)v.emit("userUpdate",t.text);else if("bitrate_changed"===t.action)this.setBitrateCap(t.text);else if("chat_message"===t.user_action)v.emit("chatMessage",t);else if("remote_muted"===t.user_action){var i,o;var a,c;if((null===(i=decodeJanusDisplay(t.from))||void 0===i?void 0:i.userId)!==(null===(o=decodeJanusDisplay(r.userId))||void 0===o?void 0:o.userId))v.emit("remoteMuted",{role:null===(a=decodeJanusDisplay(t.from))||void 0===a?void 0:a.role,userId:null===(c=decodeJanusDisplay(t.from))||void 0===c?void 0:c.userId,...t.text&&JSON.parse(t.text)})}else if("remote_muted_request"===t.user_action){var u,l;(null===(u=decodeJanusDisplay(t.from))||void 0===u?void 0:u.userId)!==(null===(l=decodeJanusDisplay(r.userId))||void 0===l?void 0:l.userId)&&this.__sendMuteStatus()}},renderPlayer:function(t,o,a){try{return this.syncModule=sync_dazn({room:r,wt:i,roomSession:this,emitter:v}),this.playerInterface=i.__privates.playerFactory(t,o,this.syncModule.getHandlers(),{roomId:a}),this.syncModule.initialize({playerInterface:this.playerInterface}),!0}catch(t){return!1}},attachPlayer:function(t,o){this.detachPlayer(),"universal"===t?(this.syncModule=sync_module({room:r,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"hlsjs"===t?(this.syncModule=sync_hls({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"hlsjs-vod"===t?(this.syncModule=sync_hls_vod({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"hlsnative-vod"===t?(this.syncModule=sync_native_hls_vod({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"hlsnative"===t?(this.syncModule=sync_native_hls({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"shaka-dash-vod"===t?(this.syncModule=sync_shaka_dash_vod({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"shaka-dash"===t?(this.syncModule=sync_shaka_dash({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"dashjs"===t?(this.syncModule=sync_dash({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"dashjs-vod"===t?(this.syncModule=sync_dash_vod({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"doris"===t?(this.syncModule=sync_doris({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"dazn-dash"===t?(this.syncModule=sync_dazn_dash({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"disabled"===t?(this.syncModule=sync_disabled({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):r._log("Synchronisation type not recognised")},detachPlayer:function(){var t;this.syncModule&&(this.playerInterface=null,this.syncModule.destroy(),this.syncModule.__events&&(t=this.syncModule.__events,g=g.filter(r=>-1===t.indexOf(r))),this.syncModule=null)},publishLocal:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1?arguments[1]:void 0;return r.publishLocal(t,i)},unpublishLocal:()=>r.unpublishLocal(),toggleAudio:(t,i)=>r.toggleAudio(t,i),toggleVideo:(t,i)=>r.toggleVideo(t,i),setRestrictSubscribeToUserIds:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return r.setRestrictSubscribeToUserIds(t)},setTalkIntercomChannels:t=>r.setTalkIntercomChannels(t),getTalkIntercomChannels:()=>r._talkIntercomChannels,getUserTalkIntercomChannels:t=>r.getUserTalkIntercomChannels(t),setListenIntercomChannels:t=>r.setListenIntercomChannels(t),getListenIntercomChannels:()=>r._listenIntercomChannels,requestKeyFrame:(t,i)=>r.requestKeyFrame(t,i),selectSubStream:(t,i,o,a)=>r.selectSubStream(t,i,o,a,!0),setBitrateCap:t=>{if("host"!==c)return r.sendMessage(r.handleId,{body:{request:"configure",bitrate:parseInt(t)}}).catch(()=>null)},overrideSimulcastSettings:(t,i,o,a)=>r.overrideSimulcastSettings(t,i,o,a),sendSystemMessage:function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;return r.sendMessage(r.handleId,{body:{action:t,request:"message",room:r.roomId,timestamp:(new Date).getTime(),text:JSON.stringify(i),...o&&Array.isArray(o)?{tos:o}:{to:o},...a&&{set_master:a}}})},sendChatMessage:(t,i)=>r.sendMessage(r.handleId,{body:{action:"chat_message",request:"message",room:r.roomId,timestamp:(new Date).getTime(),text:t,...i&&Array.isArray(i)?{tos:i}:{to:i}}}),__requestMuteStatus:function(){this.sendSystemMessage("remote_muted_request")},__sendMuteStatus:function(){for(const t of r.isMuted)this.sendSystemMessage("remote_muted",{...t})},$on:(t,i,o)=>{v.on(t,i,o||this),r.on(t,i,o||this)},$off:(t,i,o)=>{v.on(t,i,o||this),r.on(t,i,o||this)},$clear:function(){r.clear(),v.clear()}}};var streaming_session=function(){let{roomId:t,pinHash:r,streamId:i,href:o,iceServers:a,accessToken:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return{get userId(){return u.userId},get roomId(){return t},get sessionId(){return u.sessionId},get constructId(){return u.constructId},kill:function(){return u.destroy().finally(()=>(this.$clear(),!0))},destroy:function(){return l.room.destroySession(u.constructId)},connect:function(){return t?Promise.all([l.room.getRoomById(t,r),l.user.getUserSelf()]).then(t=>{let[r,i]=t;return u.startStream(r.data.wtChannel.streamId,r.data.wtChannel.href,r.data.wtChannel.iceServers,r.data.wtChannel.accessToken,i.data._id)}):o?l.user.getUserSelf().then(t=>u.startStream(i,o,a,c,t.data._id)):Promise.reject("Bad Input")},disconnect:function(){return u.stopStream()},$on:(t,r,i)=>u.on(t,r,i||this),$off:(t,r,i)=>u.off(t,r,i||this),$clear:function(){u.clear()}}};var models_room=function(){var t=this;let r=[];return(()=>{window.addEventListener("pagehide",t=>{t.persisted||this.room.destroySessions()}),window.addEventListener("beforeunload",()=>{this.room.destroySessions()})})(),{integration:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.integration({type:t.__instanceType},{requestBody:{...r},requestInterceptor:t=>(t.headers||(t.headers={}),t.headers.Authorization="Bearer "+localStorage.getItem("rwt_idToken"),t)}))},getAnalytics:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.getAnalytics({instanceType:t.__instanceType,...r}))},sendChatMessage:t=>{let{roomId:r,message:i,options:o,senderUserId:a}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.sendRoomMessage({},{requestBody:{roomId:r,message:i,options:o,senderUserId:a}}))},createRoom:function(){let{sourceRoomId:r,title:i,description:o,isPublic:a,isRouter:c,isStudioLayout:u,wtChannelId:l,isHd:d,disableSync:p,reduceRoomControls:h,hasStudioChat:m,maxParticipants:g,customAttributes:y,chatRoomId:v,linkedRoomId:b,type:_,dotAttribute:w}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},S=w?Array.isArray(w)?w.reduce((t,r)=>(t[r.name]=r.value)&&t||t,{}):{[w.name]:w.value}:{};return t.__privates.auth.__client.then(w=>w.apis.wt.createRoom({sourceRoomId:r},{requestBody:{title:i,description:o,isRouter:c,isPublic:a,isStudioLayout:u,wtChannelId:l,isHd:d,disableSync:p,reduceRoomControls:h,chatRoomId:v,linkedRoomId:b,hasStudioChat:m,maxParticipants:g,type:_,customAttributes:y,...S,instanceType:t.__instanceType}}))},updateRoom:function(){let{roomId:r,title:i,description:o,isPublic:a,isRouter:c,recordings:u,slug:l,password:d,maxParticipants:p,setInstanceType:h=!1,wtChannelId:m,isHd:g,isStudioLayout:y,hasStudioChat:v,reduceRoomControls:b,chatRoomId:_,linkedRoomId:w,type:S,disableSync:I,defaultRegion:k,customAttributes:x,dotAttribute:P}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},C=P?Array.isArray(P)?P.reduce((t,r)=>(t[r.name]=r.value)&&t||t,{}):{[P.name]:P.value}:{};return t.__privates.auth.__client.then(P=>P.apis.wt.updateRoom({id:r},{requestBody:{title:i,description:o,slug:l,password:d,isPublic:a,isRouter:c,isHd:g,isStudioLayout:y,hasStudioChat:v,maxParticipants:p,reduceRoomControls:b,chatRoomId:_,linkedRoomId:w,type:S,disableSync:I,defaultRegion:k,customAttributes:x,wtChannelId:m,...C,...h&&{instanceType:!0===h?t.__instanceType:h},...u&&{recordings:u}}}))},deleteRoom:t=>this.__privates.auth.__client.then(r=>r.apis.wt.deleteRoom({id:t})),leaveRoom:t=>this.__privates.auth.__client.then(r=>r.apis.wt.leave({roomId:t})),updateLayout:t=>{let{roomId:r,operation:i,name:o,attributeName:a,value:c,target:u}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.updateLayout({},{requestBody:{roomId:r,operation:i,name:o,attributeName:a,value:c,target:u}}))},getInviteUrl:(t,r,i)=>this.__privates.auth.__client.then(o=>o.apis.wt.invite({},{requestBody:{roomId:t,domain:r||location.host,url:i||location.href}})),getRoomChatList:function(){let{roomId:r,type:i="normal",size:o=50,startKey:a=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c={roomId:r,type:i,size:o,...a&&{startKey:a}};return t.__privates.auth.__client.then(t=>t.apis.wt.getRoomChatList(c))},getRoomsList:function(){let{type:r="participant",activeOnly:i=null,instanceType:o=t.__instanceType,size:a=20,startKey:c=null,includeWtEventModels:u=!1,demo:l=!1,viewType:d="list",wtChannelId:p}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h={type:r,instanceType:o,size:a,includeWtEventModels:u,demo:l,viewType:d,...p&&{wtChannelId:p},...i&&{activeOnly:i},...c&&{startKey:c}};return t.__privates.auth.__client.then(t=>t.apis.wt.getRoomList(h))},setUser:t=>{let{messageId:r,userId:i,roomId:o,flag:a,timestamp:c,option:u}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.setUser({messageId:r,userId:i,roomId:o,flag:a,timestamp:c,option:u}))},getRoomById:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=arguments.length>4?arguments[4]:void 0;return t.__privates.auth.__client.then(t=>t.apis.wt.getRoom({id:r,pinHash:i,public:o,demo:a},{...c?{requestInterceptor:t=>(t.signal=c,t)}:{}}))},getRoomBySlug:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return t.__privates.auth.__client.then(t=>t.apis.wt.getRoom({slug:r,password:i,public:o,demo:a}))},roomRecorder:function(){let{roomId:r,operation:i="get",config:o,outputs:a,destinationIds:c,destinations:u,screenWidth:l,screenHeight:d,payload:p}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.recordRoom({},{requestBody:{roomId:r,operation:i,config:o,outputs:a,destinationIds:c,destinations:u,screenWidth:l,screenHeight:d,payload:p}}))},__joinRoom:function(){let{roomId:r,pinHash:i,instanceType:o=t.__instanceType,role:a="participant",customBearer:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=arguments.length>1?arguments[1]:void 0;return t.__privates.auth.__client.then(c=>c.apis.wt.join({roomId:r,pinHash:i,instanceType:o,role:a,platform:"firefox"===t.browser?"web-firefox":"web"},{...u?{requestInterceptor:t=>(t.signal=u,t)}:{}}))},isSafariSupported:()=>this.__privates.room.safariVp8,isWebrtcSupported:()=>this.__privates.room.isWebrtcSupported,createStreamingSession:function(){let{constructId:i,roomId:o,pinHash:a,streamId:c,href:u,iceServers:l,accessToken:d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.room.whenInitialized.then(r=>streaming_session.call(t,{roomId:o,pinHash:a,streamId:c,href:u,iceServers:l,accessToken:d},r.createSession(i,"streaming"),t)).then(i=>r.findIndex(t=>t.constructId===i.constructId)>-1?t.room.destroySession(i.constructId).then(()=>(r.push(i),i)):(r.push(i),i))},createSession:t=>{let{constructId:i,roomId:o,pinHash:a,role:c,options:u}=t;return this.__privates.room.whenInitialized.then(t=>room_session.call(this,{roomId:o,pinHash:a,role:c,options:u},t.createSession(i,"reactooroom",u),this)).then(t=>r.findIndex(r=>r.constructId===t.constructId)>-1?this.room.destroySession(t.constructId).then(()=>(r.push(t),t)):(r.push(t),t))},getSessions:()=>r,getSessionByConstructId:t=>r.find(r=>r.constructId===t)||null,getSessionBySessionId:t=>r.find(r=>r.sessionId===t)||null,getSessionByRoomId:t=>r.find(r=>r.roomId===t)||null,getSessionByUserId:t=>r.find(r=>{var i;return(null===(i=decodeJanusDisplay(r.userId))||void 0===i?void 0:i.userId)===t})||null,getSessionByStreamId:t=>r.find(r=>r.streamId===t)||null,destroySession:t=>{let i=r.findIndex(r=>r.constructId===t);return i>-1?r[i].kill().finally(()=>(r.splice(i,1),!0)):Promise.resolve()},destroySessionBySessionId:t=>{let i=r.findIndex(r=>r.sessionId===t);return i>-1?r[i].kill().finally(()=>(r.splice(i,1),!0)):Promise.resolve()},destroySessions:()=>{r.forEach(t=>t.destroy().catch(t=>this.log(t))),r.length=0},queue:function(){let{roomId:r,operation:i,userId:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.queue({},{requestBody:{roomId:r,operation:i,userId:o}}))},getDefaultRegions:()=>this.__privates.auth.__client.then(t=>{var r,i,o,a,c,u;return[...(null===(r=t.spec)||void 0===r||null===(i=r.components)||void 0===i||null===(o=i.schemas)||void 0===o||null===(a=o.WtRoom)||void 0===a||null===(c=a.properties)||void 0===c||null===(u=c.defaultRegion)||void 0===u?void 0:u.enum)||[""]]})}},S=i(160);var models_user=function(){var t=this;return{updateUserSelf:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.user.updateMyself({...r.lastRoomId&&{lastRoomId:r.lastRoomId}},{requestBody:{...r}}))},updateUser:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.user.updateUser({id:r.id,lastRoomId:r.lastRoomId},{requestBody:{displayname:r.displayname,bio:r.bio}}))},uploadAvatar:(t,r)=>{let i=generateUUID();return this.__privates.auth.__client.then(t=>Promise.all([t,t.apis.user.initiateMyAvatarUpload({id:i})])).then(r=>{let[i,o]=r;return Promise.all([i,i.http({url:o.data.signedUrl,method:o.data.httpMethod,headers:{"Content-Type":t.type},body:t})])}).then(t=>{let[o,a]=t;return o.apis.user.publishMyAvatar({id:i,lastRoomId:r})})},unsetAvatar:t=>this.__privates.auth.__client.then(r=>r.apis.user.publishMyAvatar({lastRoomId:t})),uploadReaction:t=>{let r=generateUUID();return this.__privates.auth.__client.then(i=>Promise.all([i,i.apis.reaction.initiateReactionUpload({id:r,segmentCount:t.length||0})])).then(r=>{let[i,o]=r;return Promise.all([i,...o.data.signedUrlSegments.map((r,a)=>i.http({url:r,method:o.data.httpMethod,headers:{"Content-Type":t[a].type},body:t[a]}))])}).then(t=>{let[i]=t;return i.apis.reaction.processReaction({id:r,type:"concat"})}).then(t=>t.data.key)},uploadVideo:function(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0,c=generateUUID();return t.__privates.auth.__client.then(t=>Promise.all([t,t.apis.video.initiateVideoUpload({id:c,segmentCount:i.length||0})])).then(t=>{let[r,o]=t;return Promise.all([r,o.data.signedUrlSegments.reduce((t,a,c)=>t.then(()=>r.http({url:a,method:o.data.httpMethod,headers:{"Content-Type":i[c].type},body:i[c]})),Promise.resolve())])}).then(t=>{let[i]=t;return i.apis.video.publishVideo({_id:c,roomId:r,customPrice:a},{requestBody:{_id:c,roomId:r,privateAttributes:o,customPrice:a}})})},publishVideo:function(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;return t.__privates.auth.__client.then(t=>t.apis.video.publishVideo({_id:i,roomId:r,customPrice:a},{requestBody:{_id:i,roomId:r,privateAttributes:o}}))},getReactionById:t=>this.__privates.auth.__client.then(r=>r.apis.reaction.getReactionById({id:t})),getReactions:function(){let{userId:r,roomId:i,type:o,size:a,startKey:c,includeUserModels:u=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l={...i&&{roomId:i},...r&&{userId:r},...a&&{size:a},...c&&{startKey:c},includeUserModels:u,type:o};return t.__privates.auth.__client.then(t=>t.apis.reaction.getReactions(l))},getVideoById:t=>this.__privates.auth.__client.then(r=>r.apis.video.getVideoById({id:t})),getVideos:function(){let{roomId:r,userId:i,type:o,size:a,startKey:c,ids:u,includeUserModels:l=!1,includeRoomQueueStatus:d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return chunkArray(u,50).reduce((u,p)=>u.then(u=>{let h={...r&&{roomId:r},...i&&{userId:i},...a&&{size:a},...(null==p?void 0:p.length)&&{ids:p.join(",")},...c&&{startKey:c},...d&&{includeRoomQueueStatus:d},includeUserModels:l,type:o};return t.__privates.auth.__client.then(t=>t.apis.video.getVideos(h)).then(t=>"ids"===o?{data:{items:[...u.data.items,...t.data.items],size:u.data.size+t.data.size,startKey:null}}:t)}),Promise.resolve({data:{items:[],size:0,startKey:null}}))},deleteVideo:t=>this.__privates.auth.__client.then(r=>r.apis.video.deleteVideo({id:t})),getUserSelf:()=>this.__privates.auth.__client.then(t=>t.apis.user.getUserMyself()),getUserById:t=>this.__privates.auth.__client.then(r=>r.apis.user.getUserById({id:t})),getUsersByIds:function(){let{ids:r=[],size:i=null,startKey:o=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return chunkArray(r,50).reduce((r,a)=>r.then(r=>{let c={type:"ids",...i&&{size:i},...(null==a?void 0:a.length)&&{ids:a.join(",")},...o&&{startKey:o}};return t.__privates.auth.__client.then(t=>t.apis.user.getUsers(c)).then(t=>({data:{items:[...r.data.items,...t.data.items],size:r.data.size+t.data.size,startKey:null}}))}),Promise.resolve({data:{items:[],size:0,startKey:null}}))},getUsers:function(){let{type:r,userId:i,roomId:o,size:a=20,startKey:c=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u={type:r,size:a,...o&&{roomId:o},...i&&{userId:i},...c&&{startKey:c}};return t.__privates.auth.__client.then(t=>t.apis.user.getUsers(u))},track:function(){let{eventType:r="ERROR",message:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.track({},{requestBody:{eventType:r,appType:"web",deviceType:"desktop"+(navigator.maxTouchPoints?"/touch":""),os:navigator.platform,browser:navigator.userAgent,domain:location.host,url:location.href,message:Object(S.a)(i)}}))},getTranslation:function(){let{namespace:r="wt"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getTranslation({namespace:r}))},getConfig:function(){let{instanceType:r=t.__instanceType,domain:i=location.hostname}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getConfig({instanceType:r,domain:i}))},getIntegrationPublic:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.apis.system.integrationPublic({type:r},{requestBody:{...i}}))},updateConfig:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.wt.updateConfig({id:r.instanceType||t.__instanceType},{requestBody:{...r}}))},admin:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.wt.admin({},{requestBody:{instanceType:t.__instanceType,...r}}))},analytics:function(){let{action:r,startKey:i=null,limit:o=20}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a={action:r,limit:o,...i&&{startKey:i}};return t.__privates.auth.__client.then(r=>r.apis.wt.analytics({},{requestBody:{instanceType:t.__instanceType,...a}}))}}};var models_asset=function(){var t=this;return{getAssetList:t=>{let{type:r="instanceType",instanceType:i,assetType:o,size:a=20,startKey:c=null,roomId:u,ids:l}=t;return chunkArray(l,50).reduce((t,d)=>t.then(t=>{let p={type:r,...i&&{instanceType:!0===i?this.__instanceType:i},...o&&{assetType:o},...a&&!l&&{size:a},...(null==d?void 0:d.length)&&{ids:d.join(",")},...u&&{roomId:u},...c&&{startKey:c}};return this.__privates.auth.__client.then(t=>t.apis.asset.getAssetList(p)).then(i=>"ids"===r?{data:{items:[...t.data.items,...i.data.items],size:t.data.size+i.data.size,startKey:null}}:i)}),Promise.resolve({data:{items:[],size:0,startKey:null}}))},getAssetById:t=>this.__privates.auth.__client.then(r=>r.apis.asset.getAssetById({id:t})),updateAsset:function(){let{id:r,assetType:i,title:o,roomIds:a,customAttributes:c,encodeTransparency:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.asset.updateAsset({id:r},{requestBody:{assetType:i,title:o,roomIds:a,customAttributes:c,encodeTransparency:u}}))},deleteAsset:t=>this.__privates.auth.__client.then(r=>r.apis.asset.deleteAsset({id:t})),initiateAssetUpload:function(){return t.__privates.auth.__client.then(t=>t.apis.asset.initiateAssetUpload())},uploadAsset:function(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return t.__privates.auth.__client.then(t=>Promise.all([t,a?Promise.resolve(a):t.apis.asset.initiateAssetUpload({id:o||generateUUID()})])).then(t=>{let[i,o]=t;return Promise.all([i,i.http({url:o.data.signedUrl,method:o.data.httpMethod,headers:{"Content-Type":r.type},body:r}),o.data.id])}).then(t=>{let[o,a,c]=t;return Promise.all([o.apis.asset.publishAsset({id:c},{requestBody:{title:r.name,...i?{roomIds:i}:{}}}),c])})},downloadAsset:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.http({url:r,method:"GET",...i}))}}};var models_system=function(){var t=this;return{integration:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.integration({type:t.__instanceType},{requestBody:{...r},requestInterceptor:t=>(t.headers||(t.headers={}),t.headers.Authorization="Bearer "+localStorage.getItem("rwt_idToken"),t)}))},getAnalytics:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.getAnalytics({instanceType:t.__instanceType,...r}))},getTranslation:function(){let{namespace:r="wt"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getTranslation({namespace:r}))},getConfig:function(){let{instanceType:r=t.__instanceType,domain:i=location.hostname}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getConfig({instanceType:r,domain:i}))},updateConfig:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.updateConfig({id:r.instanceType||t.__instanceType},{requestBody:{...r}}))},getIntegrationPublic:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.apis.system.integrationPublic({type:r},{requestBody:{...i}}))},admin:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.wt.admin({},{requestBody:{instanceType:t.__instanceType,...r}}))},analytics:function(){let{action:r,startKey:i=null,limit:o=20}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a={action:r,limit:o,...i&&{startKey:i}};return t.__privates.auth.__client.then(r=>r.apis.wt.analytics({},{requestBody:{instanceType:t.__instanceType,...a}}))},track:function(){let{eventType:r="ERROR",message:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.track({},{requestBody:{eventType:r,appType:"web",deviceType:"desktop"+(navigator.maxTouchPoints?"/touch":""),os:navigator.platform,browser:navigator.userAgent,domain:location.host,url:location.href,message:Object(S.a)(i)}}))},getSchemas:()=>this.__privates.auth.__client.then(t=>{var r,i;return null===(r=t.spec)||void 0===r||null===(i=r.components)||void 0===i?void 0:i.schemas}),getClient:()=>this.__privates.auth.__client.then(t=>t)}};const getUserMediaConstraints=t=>{let{hasVideo:r,hasAudio:i=!0,aDeviceId:o,vDeviceId:a,autoGainControl:c=!1,echoCancellation:u=!0,noiseSuppression:l=!0,channelCount:d=1,width:p=1920,height:h=1080}=t,m={audio:{...o&&{deviceId:{exact:o}},autoGainControl:c,echoCancellation:u,noiseSuppression:l,channelCount:d}},g={video:{...a&&{deviceId:{exact:a}},facingMode:{ideal:"user"},frameRate:{ideal:30,max:30},width:{ideal:p},height:{ideal:h}}};return{...i?m:{audio:!1},...r?g:{video:!1}}};var I={applyConstraints(t){let{autoGainControl:r=!1,echoCancellation:i=!0,noiseSuppression:o=!0,channelCount:a=1,stream:c=null,width:u,height:l}=t;if(c){let t=getUserMediaConstraints({hasVideo:!0,hasAudio:!0,autoGainControl:r,echoCancellation:i,noiseSuppression:o,channelCount:a,width:u,height:l}),d=[];const p=c.getVideoTracks()[0];p&&d.push(p.applyConstraints(t.video));const h=c.getAudioTracks()[0];return h&&d.push(h.applyConstraints(t.audio)),Promise.all(d).then(()=>c)}return Promise.resolve(null)},getUserStream(){let{hasVideo:t,hasAudio:r=!0,aDeviceId:i,vDeviceId:o,autoGainControl:a=!1,echoCancellation:c=!0,noiseSuppression:u=!0,channelCount:l=1,muteAudio:d=!1,muteVideo:p=!1,width:h=1920,height:m=1080}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},g=getUserMediaConstraints({hasVideo:t,hasAudio:r,aDeviceId:i,vDeviceId:o,autoGainControl:a,echoCancellation:c,noiseSuppression:u,channelCount:l,width:h,height:m});return navigator.mediaDevices.getUserMedia(g).then(t=>(t.getAudioTracks().forEach(t=>t.enabled=!d),t.getVideoTracks().forEach(t=>t.enabled=!p),t))},getHostStream(){let{hasAudio:t,hasVideo:r,aDeviceId:i,vDeviceId:o,autoGainControl:a=!1,echoCancellation:c=!1,noiseSuppression:u=!1,channelCount:l=1,width:d=1920,height:p=1080}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h={audio:{...i&&{deviceId:{exact:i}},autoGainControl:a,echoCancellation:c,noiseSuppression:u,channelCount:l}},m={video:{...o&&{deviceId:{exact:o}},frameRate:{ideal:30,max:30},width:d,height:p}},g={...t?h:{audio:!1},...r?m:{video:!1}};return navigator.mediaDevices.getUserMedia(g)},getDisplayMedia:()=>navigator.mediaDevices.getDisplayMedia({video:{cursor:"always",displaySurface:"monitor",logicalSurface:!1},surfaceSwitching:"include",selfBrowserSurface:"exclude",systemAudio:"exclude"})};var models_iot=function(){var t=this;let r=[],i=null;return{__promise:null,__reconnect:t=>{this.__privates.iot.log("MQTT Error:",t,"Is event error: "+(t instanceof Event)),t instanceof Event&&"error"===t.type&&(this.__privates.iot.log("SDK MQTT Reconnection attempt"),clearTimeout(i),i=setTimeout(()=>{this.iot.iotLogin(!0,!0).catch(t=>this.__privates.iot.log("MQTT Connection Error:",t))},1e3))},__updateCredentials:()=>{this.iot.getCredentials().then(t=>this.__privates.iot.updateWebSocketCredentials(t.data.credentials.accessKeyId,t.data.credentials.secretAccessKey,t.data.credentials.sessionToken,t.data.credentials.expiration))},getCredentials:()=>this.__privates.auth.__client.then(t=>t.apis.auth.iotSignIn({},{requestBody:{suggestedTopics:!0,domain:location.hostname}})),iotLogin:function(){let i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.iot.$off("error",t.iot.__reconnect,t),t.iot.__promise=new Promise((r,i)=>{t.iot.getCredentials().then(r=>Promise.all([r.data.suggestedTopics,t.__privates.iot.connect(r.data.endpoint,r.data.clientId,r.data.region,r.data.credentials.accessKeyId,r.data.credentials.secretAccessKey,r.data.credentials.sessionToken,r.data.credentials.expiration,o)])).then(r).catch(i)});let a=[...r];return r.length=0,t.iot.__promise.then(r=>{let[o,c]=r;if(!i)return Promise.resolve(c);let u=[...o,...a];return u=u.filter((t,r)=>u.indexOf(t)===r),Promise.all(u.map(r=>t.iot.subscribe(r))).then(()=>c)}).then(r=>(t.iot.$on("error",t.iot.__reconnect,t),t.iot.$on("updateCredentials",t.iot.__updateCredentials,t),r)),t.iot.__promise},iotLogout:function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.iot.$off("error",t.iot.__reconnect,t),t.iot.$off("updateCredentials",t.iot.__updateCredentials,t),i||(r.length=0),t.__privates.iot.disconnect().then(()=>(t.iot.__promise=null,!0))},isConnected:()=>this.__privates.iot.isConnected(),subscribe:t=>{if(-1===r.indexOf(t))return r.push(t),this.iot.__promise?this.iot.__promise.then(()=>this.__privates.iot.subscribe(t)):Promise.resolve("not_connected")},unsubscribe:t=>{let i=r.indexOf(t);return i>-1&&r.splice(i,1),this.iot.__promise?this.iot.__promise.then(()=>this.__privates.iot.unsubscribe(t)):Promise.resolve("not_connected")},send:(t,r)=>this.iot.__promise.then(()=>this.__privates.iot.send(t,r)),$once:(t,r,i)=>this.__privates.iot.once(t,r,i||this),$on:(t,r,i)=>this.__privates.iot.on(t,r,i||this),$off:(t,r,i)=>this.__privates.iot.off(t,r,i||this),$clear:()=>this.__privates.iot.clear()}};function WatchTogether(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;this.username=null,this.userId=null,this.__instanceType=r,this.__debug=i,this.__privates={playerFactory:o,providerAuth:a,room:t.room,auth:t.auth,iot:t.iot},this.setInstanceType=t=>this.__instanceType=t,this.isReady=t.room.whenInitialized,this.browser=t.room.browser,this.browserDetails=t.room.browserDetails,this.auth={...models_auth.call(this)},this.user={...models_user.call(this)},this.room={...models_room.call(this)},this.asset={...models_asset.call(this)},this.system={...models_system.call(this)},this.iot={...models_iot.call(this)},this.utils=I}r.default=function(){let{debug:t=!0,language:r="en-GB",storagePrefix:i="reactoo_",apiUrl:o=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=new v(t),c=new b.a(t,r,i,o),u=new w(t);return function(){let{instanceType:r="reactooDemo",playerFactory:i=null,providerAuth:o=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new WatchTogether({room:a,auth:c,iot:u},r,t,i,o)}}}]).default}));
|
|
5
|
+
!function webpackUniversalModuleDefinition(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("WatchTogetherSDK",[],r):"object"==typeof exports?exports.WatchTogetherSDK=r():t.WatchTogetherSDK=r()}("undefined"!=typeof self?self:this,(function(){return function(t){var r={};function __webpack_require__(i){if(r[i])return r[i].exports;var o=r[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,__webpack_require__),o.l=!0,o.exports}return __webpack_require__.m=t,__webpack_require__.c=r,__webpack_require__.d=function(t,r,i){__webpack_require__.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:i})},__webpack_require__.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.t=function(t,r){if(1&r&&(t=__webpack_require__(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(__webpack_require__.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)__webpack_require__.d(i,o,function(r){return t[r]}.bind(null,o));return i},__webpack_require__.n=function(t){var r=t&&t.__esModule?function getDefault(){return t.default}:function getModuleExports(){return t};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=830)}([function(t,r,i){t.exports=i(590)},function(t,r,i){"use strict";var o=i(11),a=i(99),c=i(122),u=i(12),l=i(77).f,d=i(224),p=i(15),h=i(63),m=i(47),g=i(21);i(126);var wrapConstructor=function(t){var Wrapper=function(r,i,o){if(this instanceof Wrapper){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,o)}return a(t,this,arguments)};return Wrapper.prototype=t.prototype,Wrapper};t.exports=function(t,r){var i,a,y,v,b,_,w,S,I,k=t.target,x=t.global,P=t.stat,C=t.proto,A=x?o:P?o[k]:o[k]&&o[k].prototype,O=x?p:p[k]||m(p,k,{})[k],R=O.prototype;for(v in r)a=!(i=d(x?v:k+(P?".":"#")+v,t.forced))&&A&&g(A,v),_=O[v],a&&(w=t.dontCallGetSet?(I=l(A,v))&&I.value:A[v]),b=a&&w?w:r[v],(i||C||typeof _!=typeof b)&&(S=t.bind&&a?h(b,o):t.wrap&&a?wrapConstructor(b):C&&u(b)?c(b):b,(t.sham||b&&b.sham||_&&_.sham)&&m(S,"sham",!0),m(O,v,S),C&&(g(p,y=k+"Prototype")||m(p,y,{}),m(p[y],v,b),t.real&&R&&(i||!R[v])&&m(R,v,b)))}},function(t,r,i){t.exports=i(220)},function(t,r,i){"use strict";t.exports=TypeError},function(t,r,i){var o=i(359),a=i(227),c=i(378),u=i(384),l=i(173),d=i(238),p=i(404),h=i(410),m=i(133),g=i(216);function ownKeys(t,r){var i=o(t);if(a){var d=a(t);r&&(d=c(d).call(d,(function(r){return u(t,r).enumerable}))),l(i).apply(i,d)}return i}t.exports=function _objectSpread2(t){for(var r=1;r<arguments.length;r++){var i,o,a=null!=arguments[r]?arguments[r]:{};r%2?d(i=ownKeys(Object(a),!0)).call(i,(function(r){g(t,r,a[r])})):p?h(t,p(a)):d(o=ownKeys(Object(a))).call(o,(function(r){m(t,r,u(a,r))}))}return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){t.exports=i(586)},function(t,r,i){"use strict";var o=i(484),a=i(485),c=i(177),u=i(486),l=i(41),d=i(3),p=i(487),h=Function,getEvalledConstructor=function(t){try{return h('"use strict"; return ('+t+").constructor;")()}catch(t){}},m=Object.getOwnPropertyDescriptor;if(m)try{m({},"")}catch(t){m=null}var throwTypeError=function(){throw new d},g=m?function(){try{return throwTypeError}catch(t){try{return m(arguments,"callee").get}catch(t){return throwTypeError}}}():throwTypeError,y=i(253)(),v=i(137)(),b=Object.getPrototypeOf||(v?function(t){return t.__proto__}:null),_={},w="undefined"!=typeof Uint8Array&&b?b(Uint8Array):void 0,S={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":y&&b?b([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":_,"%AsyncGenerator%":_,"%AsyncGeneratorFunction%":_,"%AsyncIteratorPrototype%":_,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?void 0:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?void 0:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":a,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":h,"%GeneratorFunction%":_,"%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%":y&&b?b(b([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&y&&b?b((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%":c,"%ReferenceError%":u,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&y&&b?b((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":y&&b?b(""[Symbol.iterator]()):void 0,"%Symbol%":y?Symbol:void 0,"%SyntaxError%":l,"%ThrowTypeError%":g,"%TypedArray%":w,"%TypeError%":d,"%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%":p,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet};if(b)try{null.error}catch(t){var I=b(b(t));S["%Error.prototype%"]=I}var k={__proto__:null,"%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"]},x=i(179),P=i(69),C=x.call(Function.call,Array.prototype.concat),A=x.call(Function.apply,Array.prototype.splice),O=x.call(Function.call,String.prototype.replace),R=x.call(Function.call,String.prototype.slice),M=x.call(Function.call,RegExp.prototype.exec),j=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,L=/\\(\\)?/g,D=function stringToPath(t){var r=R(t,0,1),i=R(t,-1);if("%"===r&&"%"!==i)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==r)throw new l("invalid intrinsic syntax, expected opening `%`");var o=[];return O(t,j,(function(t,r,i,a){o[o.length]=i?O(a,L,"$1"):r||t})),o},B=function getBaseIntrinsic(t,r){var i,o=t;if(P(k,o)&&(o="%"+(i=k[o])[0]+"%"),P(S,o)){var a=S[o];if(a===_&&(a=function doEval(t){var r;if("%AsyncFunction%"===t)r=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===t)r=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===t){var i=doEval("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=doEval("%AsyncGenerator%");o&&b&&(r=b(o.prototype))}return S[t]=r,r}(o)),void 0===a&&!r)throw new d("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:o,value:a}}throw new l("intrinsic "+t+" does not exist!")};t.exports=function GetIntrinsic(t,r){if("string"!=typeof t||0===t.length)throw new d("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof r)throw new d('"allowMissing" argument must be a boolean');if(null===M(/^%?[^%]*%?$/,t))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=D(t),o=i.length>0?i[0]:"",a=B("%"+o+"%",r),c=a.name,u=a.value,p=!1,h=a.alias;h&&(o=h[0],A(i,C([0,1],h)));for(var g=1,y=!0;g<i.length;g+=1){var v=i[g],b=R(v,0,1),_=R(v,-1);if(('"'===b||"'"===b||"`"===b||'"'===_||"'"===_||"`"===_)&&b!==_)throw new l("property names with quotes must have matching quotes");if("constructor"!==v&&y||(p=!0),P(S,c="%"+(o+="."+v)+"%"))u=S[c];else if(null!=u){if(!(v in u)){if(!r)throw new d("base intrinsic for "+t+" exists, but the property is not available.");return}if(m&&g+1>=i.length){var w=m(u,v);u=(y=!!w)&&"get"in w&&!("originalValue"in w.get)?w.get:u[v]}else y=P(u,v),u=u[v];y&&!p&&(S[c]=u)}}return u}},function(t,r,i){var o=i(106),a=i(459);function _typeof(r){return t.exports=_typeof="function"==typeof o&&"symbol"==typeof a?function(t){return typeof t}:function(t){return t&&"function"==typeof o&&t.constructor===o&&t!==o.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,_typeof(r)}t.exports=_typeof,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,r,i){"use strict";var o=i(121),a=Function.prototype,c=a.call,u=o&&a.bind.bind(c,c);t.exports=o?u:function(t){return function(){return c.apply(t,arguments)}}},function(t,r,i){"use strict";var o=i(11),a=i(81),c=i(21),u=i(127),l=i(79),d=i(222),p=o.Symbol,h=a("wks"),m=d?p.for||p:p&&p.withoutSetter||u;t.exports=function(t){return c(h,t)||(h[t]=l&&c(p,t)?p[t]:m("Symbol."+t)),h[t]}},function(t,r,i){"use strict";(function(r){var check=function(t){return t&&t.Math===Math&&t};t.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof r&&r)||check("object"==typeof this&&this)||function(){return this}()||Function("return this")()}).call(this,i(17))},function(t,r,i){"use strict";var o="object"==typeof document&&document.all;t.exports=void 0===o&&void 0!==o?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},function(t,r,i){"use strict";var o=i(8);t.exports=!o((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,r,i){"use strict";var o=i(15),a=i(21),c=i(131),u=i(32).f;t.exports=function(t){var r=o.Symbol||(o.Symbol={});a(r,t)||u(r,t,{value:c.f(t)})}},function(t,r,i){"use strict";t.exports={}},function(t,r,i){"use strict";(function(t){var o=i(356),a=i(357),c=i(358);function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,r){if(kMaxLength()<r)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=Buffer.prototype:(null===t&&(t=new Buffer(r)),t.length=r),t}function Buffer(t,r,i){if(!(Buffer.TYPED_ARRAY_SUPPORT||this instanceof Buffer))return new Buffer(t,r,i);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,t)}return from(this,t,r,i)}function from(t,r,i,o){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function fromArrayBuffer(t,r,i,o){if(r.byteLength,i<0||r.byteLength<i)throw new RangeError("'offset' is out of bounds");if(r.byteLength<i+(o||0))throw new RangeError("'length' is out of bounds");r=void 0===i&&void 0===o?new Uint8Array(r):void 0===o?new Uint8Array(r,i):new Uint8Array(r,i,o);Buffer.TYPED_ARRAY_SUPPORT?(t=r).__proto__=Buffer.prototype:t=fromArrayLike(t,r);return t}(t,r,i,o):"string"==typeof r?function fromString(t,r,i){"string"==typeof i&&""!==i||(i="utf8");if(!Buffer.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var o=0|byteLength(r,i),a=(t=createBuffer(t,o)).write(r,i);a!==o&&(t=t.slice(0,a));return t}(t,r,i):function fromObject(t,r){if(Buffer.isBuffer(r)){var i=0|checked(r.length);return 0===(t=createBuffer(t,i)).length||r.copy(t,0,0,i),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||function isnan(t){return t!=t}(r.length)?createBuffer(t,0):fromArrayLike(t,r);if("Buffer"===r.type&&c(r.data))return fromArrayLike(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function assertSize(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function allocUnsafe(t,r){if(assertSize(r),t=createBuffer(t,r<0?0:0|checked(r)),!Buffer.TYPED_ARRAY_SUPPORT)for(var i=0;i<r;++i)t[i]=0;return t}function fromArrayLike(t,r){var i=r.length<0?0:0|checked(r.length);t=createBuffer(t,i);for(var o=0;o<i;o+=1)t[o]=255&r[o];return t}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function byteLength(t,r){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return base64ToBytes(t).length;default:if(o)return utf8ToBytes(t).length;r=(""+r).toLowerCase(),o=!0}}function slowToString(t,r,i){var o=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,r,i);case"utf8":case"utf-8":return utf8Slice(this,r,i);case"ascii":return asciiSlice(this,r,i);case"latin1":case"binary":return latin1Slice(this,r,i);case"base64":return base64Slice(this,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,r,i);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}function swap(t,r,i){var o=t[r];t[r]=t[i],t[i]=o}function bidirectionalIndexOf(t,r,i,o,a){if(0===t.length)return-1;if("string"==typeof i?(o=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=a?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(a)return-1;i=t.length-1}else if(i<0){if(!a)return-1;i=0}if("string"==typeof r&&(r=Buffer.from(r,o)),Buffer.isBuffer(r))return 0===r.length?-1:arrayIndexOf(t,r,i,o,a);if("number"==typeof r)return r&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,r,i):Uint8Array.prototype.lastIndexOf.call(t,r,i):arrayIndexOf(t,[r],i,o,a);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,r,i,o,a){var c,u=1,l=t.length,d=r.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(t.length<2||r.length<2)return-1;u=2,l/=2,d/=2,i/=2}function read(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(a){var p=-1;for(c=i;c<l;c++)if(read(t,c)===read(r,-1===p?0:c-p)){if(-1===p&&(p=c),c-p+1===d)return p*u}else-1!==p&&(c-=c-p),p=-1}else for(i+d>l&&(i=l-d),c=i;c>=0;c--){for(var h=!0,m=0;m<d;m++)if(read(t,c+m)!==read(r,m)){h=!1;break}if(h)return c}return-1}function hexWrite(t,r,i,o){i=Number(i)||0;var a=t.length-i;o?(o=Number(o))>a&&(o=a):o=a;var c=r.length;if(c%2!=0)throw new TypeError("Invalid hex string");o>c/2&&(o=c/2);for(var u=0;u<o;++u){var l=parseInt(r.substr(2*u,2),16);if(isNaN(l))return u;t[i+u]=l}return u}function utf8Write(t,r,i,o){return blitBuffer(utf8ToBytes(r,t.length-i),t,i,o)}function asciiWrite(t,r,i,o){return blitBuffer(function asciiToBytes(t){for(var r=[],i=0;i<t.length;++i)r.push(255&t.charCodeAt(i));return r}(r),t,i,o)}function latin1Write(t,r,i,o){return asciiWrite(t,r,i,o)}function base64Write(t,r,i,o){return blitBuffer(base64ToBytes(r),t,i,o)}function ucs2Write(t,r,i,o){return blitBuffer(function utf16leToBytes(t,r){for(var i,o,a,c=[],u=0;u<t.length&&!((r-=2)<0);++u)i=t.charCodeAt(u),o=i>>8,a=i%256,c.push(a),c.push(o);return c}(r,t.length-i),t,i,o)}function base64Slice(t,r,i){return 0===r&&i===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(r,i))}function utf8Slice(t,r,i){i=Math.min(t.length,i);for(var o=[],a=r;a<i;){var c,u,l,d,p=t[a],h=null,m=p>239?4:p>223?3:p>191?2:1;if(a+m<=i)switch(m){case 1:p<128&&(h=p);break;case 2:128==(192&(c=t[a+1]))&&(d=(31&p)<<6|63&c)>127&&(h=d);break;case 3:c=t[a+1],u=t[a+2],128==(192&c)&&128==(192&u)&&(d=(15&p)<<12|(63&c)<<6|63&u)>2047&&(d<55296||d>57343)&&(h=d);break;case 4:c=t[a+1],u=t[a+2],l=t[a+3],128==(192&c)&&128==(192&u)&&128==(192&l)&&(d=(15&p)<<18|(63&c)<<12|(63&u)<<6|63&l)>65535&&d<1114112&&(h=d)}null===h?(h=65533,m=1):h>65535&&(h-=65536,o.push(h>>>10&1023|55296),h=56320|1023&h),o.push(h),a+=m}return function decodeCodePointsArray(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var i="",o=0;for(;o<r;)i+=String.fromCharCode.apply(String,t.slice(o,o+=4096));return i}(o)}r.Buffer=Buffer,r.SlowBuffer=function SlowBuffer(t){+t!=t&&(t=0);return Buffer.alloc(+t)},r.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function typedArraySupport(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,r,i){return from(null,t,r,i)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(t,r,i){return function alloc(t,r,i,o){return assertSize(r),r<=0?createBuffer(t,r):void 0!==i?"string"==typeof o?createBuffer(t,r).fill(i,o):createBuffer(t,r).fill(i):createBuffer(t,r)}(null,t,r,i)},Buffer.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer.isBuffer=function isBuffer(t){return!(null==t||!t._isBuffer)},Buffer.compare=function compare(t,r){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var i=t.length,o=r.length,a=0,c=Math.min(i,o);a<c;++a)if(t[a]!==r[a]){i=t[a],o=r[a];break}return i<o?-1:o<i?1:0},Buffer.isEncoding=function isEncoding(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function concat(t,r){if(!c(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Buffer.alloc(0);var i;if(void 0===r)for(r=0,i=0;i<t.length;++i)r+=t[i].length;var o=Buffer.allocUnsafe(r),a=0;for(i=0;i<t.length;++i){var u=t[i];if(!Buffer.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(o,a),a+=u.length}return o},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)swap(this,r,r+1);return this},Buffer.prototype.swap32=function swap32(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)swap(this,r,r+3),swap(this,r+1,r+2);return this},Buffer.prototype.swap64=function swap64(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)swap(this,r,r+7),swap(this,r+1,r+6),swap(this,r+2,r+5),swap(this,r+3,r+4);return this},Buffer.prototype.toString=function toString(){var t=0|this.length;return 0===t?"":0===arguments.length?utf8Slice(this,0,t):slowToString.apply(this,arguments)},Buffer.prototype.equals=function equals(t){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Buffer.compare(this,t)},Buffer.prototype.inspect=function inspect(){var t="",i=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),"<Buffer "+t+">"},Buffer.prototype.compare=function compare(t,r,i,o,a){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===i&&(i=t?t.length:0),void 0===o&&(o=0),void 0===a&&(a=this.length),r<0||i>t.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&r>=i)return 0;if(o>=a)return-1;if(r>=i)return 1;if(this===t)return 0;for(var c=(a>>>=0)-(o>>>=0),u=(i>>>=0)-(r>>>=0),l=Math.min(c,u),d=this.slice(o,a),p=t.slice(r,i),h=0;h<l;++h)if(d[h]!==p[h]){c=d[h],u=p[h];break}return c<u?-1:u<c?1:0},Buffer.prototype.includes=function includes(t,r,i){return-1!==this.indexOf(t,r,i)},Buffer.prototype.indexOf=function indexOf(t,r,i){return bidirectionalIndexOf(this,t,r,i,!0)},Buffer.prototype.lastIndexOf=function lastIndexOf(t,r,i){return bidirectionalIndexOf(this,t,r,i,!1)},Buffer.prototype.write=function write(t,r,i,o){if(void 0===r)o="utf8",i=this.length,r=0;else if(void 0===i&&"string"==typeof r)o=r,i=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(i)?(i|=0,void 0===o&&(o="utf8")):(o=i,i=void 0)}var a=this.length-r;if((void 0===i||i>a)&&(i=a),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var c=!1;;)switch(o){case"hex":return hexWrite(this,t,r,i);case"utf8":case"utf-8":return utf8Write(this,t,r,i);case"ascii":return asciiWrite(this,t,r,i);case"latin1":case"binary":return latin1Write(this,t,r,i);case"base64":return base64Write(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,r,i);default:if(c)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),c=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function asciiSlice(t,r,i){var o="";i=Math.min(t.length,i);for(var a=r;a<i;++a)o+=String.fromCharCode(127&t[a]);return o}function latin1Slice(t,r,i){var o="";i=Math.min(t.length,i);for(var a=r;a<i;++a)o+=String.fromCharCode(t[a]);return o}function hexSlice(t,r,i){var o=t.length;(!r||r<0)&&(r=0),(!i||i<0||i>o)&&(i=o);for(var a="",c=r;c<i;++c)a+=toHex(t[c]);return a}function utf16leSlice(t,r,i){for(var o=t.slice(r,i),a="",c=0;c<o.length;c+=2)a+=String.fromCharCode(o[c]+256*o[c+1]);return a}function checkOffset(t,r,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>i)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,r,i,o,a,c){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>a||r<c)throw new RangeError('"value" argument is out of bounds');if(i+o>t.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,r,i,o){r<0&&(r=65535+r+1);for(var a=0,c=Math.min(t.length-i,2);a<c;++a)t[i+a]=(r&255<<8*(o?a:1-a))>>>8*(o?a:1-a)}function objectWriteUInt32(t,r,i,o){r<0&&(r=4294967295+r+1);for(var a=0,c=Math.min(t.length-i,4);a<c;++a)t[i+a]=r>>>8*(o?a:3-a)&255}function checkIEEE754(t,r,i,o,a,c){if(i+o>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function writeFloat(t,r,i,o,c){return c||checkIEEE754(t,0,i,4),a.write(t,r,i,o,23,4),i+4}function writeDouble(t,r,i,o,c){return c||checkIEEE754(t,0,i,8),a.write(t,r,i,o,52,8),i+8}Buffer.prototype.slice=function slice(t,r){var i,o=this.length;if((t=~~t)<0?(t+=o)<0&&(t=0):t>o&&(t=o),(r=void 0===r?o:~~r)<0?(r+=o)<0&&(r=0):r>o&&(r=o),r<t&&(r=t),Buffer.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,r)).__proto__=Buffer.prototype;else{var a=r-t;i=new Buffer(a,void 0);for(var c=0;c<a;++c)i[c]=this[c+t]}return i},Buffer.prototype.readUIntLE=function readUIntLE(t,r,i){t|=0,r|=0,i||checkOffset(t,r,this.length);for(var o=this[t],a=1,c=0;++c<r&&(a*=256);)o+=this[t+c]*a;return o},Buffer.prototype.readUIntBE=function readUIntBE(t,r,i){t|=0,r|=0,i||checkOffset(t,r,this.length);for(var o=this[t+--r],a=1;r>0&&(a*=256);)o+=this[t+--r]*a;return o},Buffer.prototype.readUInt8=function readUInt8(t,r){return r||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function readUInt16LE(t,r){return r||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function readUInt16BE(t,r){return r||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function readUInt32LE(t,r){return r||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function readUInt32BE(t,r){return r||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function readIntLE(t,r,i){t|=0,r|=0,i||checkOffset(t,r,this.length);for(var o=this[t],a=1,c=0;++c<r&&(a*=256);)o+=this[t+c]*a;return o>=(a*=128)&&(o-=Math.pow(2,8*r)),o},Buffer.prototype.readIntBE=function readIntBE(t,r,i){t|=0,r|=0,i||checkOffset(t,r,this.length);for(var o=r,a=1,c=this[t+--o];o>0&&(a*=256);)c+=this[t+--o]*a;return c>=(a*=128)&&(c-=Math.pow(2,8*r)),c},Buffer.prototype.readInt8=function readInt8(t,r){return r||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function readInt16LE(t,r){r||checkOffset(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},Buffer.prototype.readInt16BE=function readInt16BE(t,r){r||checkOffset(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},Buffer.prototype.readInt32LE=function readInt32LE(t,r){return r||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(t,r){return r||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function readFloatLE(t,r){return r||checkOffset(t,4,this.length),a.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(t,r){return r||checkOffset(t,4,this.length),a.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(t,r){return r||checkOffset(t,8,this.length),a.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(t,r){return r||checkOffset(t,8,this.length),a.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function writeUIntLE(t,r,i,o){(t=+t,r|=0,i|=0,o)||checkInt(this,t,r,i,Math.pow(2,8*i)-1,0);var a=1,c=0;for(this[r]=255&t;++c<i&&(a*=256);)this[r+c]=t/a&255;return r+i},Buffer.prototype.writeUIntBE=function writeUIntBE(t,r,i,o){(t=+t,r|=0,i|=0,o)||checkInt(this,t,r,i,Math.pow(2,8*i)-1,0);var a=i-1,c=1;for(this[r+a]=255&t;--a>=0&&(c*=256);)this[r+a]=t/c&255;return r+i},Buffer.prototype.writeUInt8=function writeUInt8(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},Buffer.prototype.writeUInt16LE=function writeUInt16LE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):objectWriteUInt16(this,t,r,!0),r+2},Buffer.prototype.writeUInt16BE=function writeUInt16BE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):objectWriteUInt16(this,t,r,!1),r+2},Buffer.prototype.writeUInt32LE=function writeUInt32LE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):objectWriteUInt32(this,t,r,!0),r+4},Buffer.prototype.writeUInt32BE=function writeUInt32BE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):objectWriteUInt32(this,t,r,!1),r+4},Buffer.prototype.writeIntLE=function writeIntLE(t,r,i,o){if(t=+t,r|=0,!o){var a=Math.pow(2,8*i-1);checkInt(this,t,r,i,a-1,-a)}var c=0,u=1,l=0;for(this[r]=255&t;++c<i&&(u*=256);)t<0&&0===l&&0!==this[r+c-1]&&(l=1),this[r+c]=(t/u>>0)-l&255;return r+i},Buffer.prototype.writeIntBE=function writeIntBE(t,r,i,o){if(t=+t,r|=0,!o){var a=Math.pow(2,8*i-1);checkInt(this,t,r,i,a-1,-a)}var c=i-1,u=1,l=0;for(this[r+c]=255&t;--c>=0&&(u*=256);)t<0&&0===l&&0!==this[r+c+1]&&(l=1),this[r+c]=(t/u>>0)-l&255;return r+i},Buffer.prototype.writeInt8=function writeInt8(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},Buffer.prototype.writeInt16LE=function writeInt16LE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):objectWriteUInt16(this,t,r,!0),r+2},Buffer.prototype.writeInt16BE=function writeInt16BE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):objectWriteUInt16(this,t,r,!1),r+2},Buffer.prototype.writeInt32LE=function writeInt32LE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):objectWriteUInt32(this,t,r,!0),r+4},Buffer.prototype.writeInt32BE=function writeInt32BE(t,r,i){return t=+t,r|=0,i||checkInt(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):objectWriteUInt32(this,t,r,!1),r+4},Buffer.prototype.writeFloatLE=function writeFloatLE(t,r,i){return writeFloat(this,t,r,!0,i)},Buffer.prototype.writeFloatBE=function writeFloatBE(t,r,i){return writeFloat(this,t,r,!1,i)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(t,r,i){return writeDouble(this,t,r,!0,i)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(t,r,i){return writeDouble(this,t,r,!1,i)},Buffer.prototype.copy=function copy(t,r,i,o){if(i||(i=0),o||0===o||(o=this.length),r>=t.length&&(r=t.length),r||(r=0),o>0&&o<i&&(o=i),o===i)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-r<o-i&&(o=t.length-r+i);var a,c=o-i;if(this===t&&i<r&&r<o)for(a=c-1;a>=0;--a)t[a+r]=this[a+i];else if(c<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(a=0;a<c;++a)t[a+r]=this[a+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+c),r);return c},Buffer.prototype.fill=function fill(t,r,i,o){if("string"==typeof t){if("string"==typeof r?(o=r,r=0,i=this.length):"string"==typeof i&&(o=i,i=this.length),1===t.length){var a=t.charCodeAt(0);a<256&&(t=a)}if(void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!Buffer.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;var c;if(r>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(c=r;c<i;++c)this[c]=t;else{var u=Buffer.isBuffer(t)?t:utf8ToBytes(new Buffer(t,o).toString()),l=u.length;for(c=0;c<i-r;++c)this[c+r]=u[c%l]}return this};var u=/[^+\/0-9A-Za-z-_]/g;function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,r){var i;r=r||1/0;for(var o=t.length,a=null,c=[],u=0;u<o;++u){if((i=t.charCodeAt(u))>55295&&i<57344){if(!a){if(i>56319){(r-=3)>-1&&c.push(239,191,189);continue}if(u+1===o){(r-=3)>-1&&c.push(239,191,189);continue}a=i;continue}if(i<56320){(r-=3)>-1&&c.push(239,191,189),a=i;continue}i=65536+(a-55296<<10|i-56320)}else a&&(r-=3)>-1&&c.push(239,191,189);if(a=null,i<128){if((r-=1)<0)break;c.push(i)}else if(i<2048){if((r-=2)<0)break;c.push(i>>6|192,63&i|128)}else if(i<65536){if((r-=3)<0)break;c.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;c.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return c}function base64ToBytes(t){return o.toByteArray(function base64clean(t){if((t=function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(u,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function blitBuffer(t,r,i,o){for(var a=0;a<o&&!(a+i>=r.length||a>=t.length);++a)r[a+i]=t[a];return a}}).call(this,i(17))},function(t,r){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,r,i){"use strict";var o=i(12);t.exports=function(t){return"object"==typeof t?null!==t:o(t)}},function(t,r){var i,o,a=t.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(t){if(i===setTimeout)return setTimeout(t,0);if((i===defaultSetTimout||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(r){try{return i.call(null,t,0)}catch(r){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(t){i=defaultSetTimout}try{o="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(t){o=defaultClearTimeout}}();var c,u=[],l=!1,d=-1;function cleanUpNextTick(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&drainQueue())}function drainQueue(){if(!l){var t=runTimeout(cleanUpNextTick);l=!0;for(var r=u.length;r;){for(c=u,u=[];++d<r;)c&&c[d].run();d=-1,r=u.length}c=null,l=!1,function runClearTimeout(t){if(o===clearTimeout)return clearTimeout(t);if((o===defaultClearTimeout||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{return o(t)}catch(r){try{return o.call(null,t)}catch(r){return o.call(this,t)}}}(t)}}function Item(t,r){this.fun=t,this.array=r}function noop(){}a.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)r[i-1]=arguments[i];u.push(new Item(t,r)),1!==u.length||l||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=noop,a.addListener=noop,a.once=noop,a.off=noop,a.removeListener=noop,a.removeAllListeners=noop,a.emit=noop,a.prependListener=noop,a.prependOnceListener=noop,a.listeners=function(t){return[]},a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(t,r,i){"use strict";var o=i(121),a=Function.prototype.call;t.exports=o?a.bind(a):function(){return a.apply(a,arguments)}},function(t,r,i){"use strict";var o=i(9),a=i(36),c=o({}.hasOwnProperty);t.exports=Object.hasOwn||function hasOwn(t,r){return c(a(t),r)}},function(t,r,i){t.exports=i(472)},function(t,r,i){"use strict";var o=i(9);t.exports=o({}.isPrototypeOf)},function(t,r,i){"use strict";var o=i(6),a=i(59),c=a(o("String.prototype.indexOf"));t.exports=function callBoundIntrinsic(t,r){var i=o(t,!!r);return"function"==typeof i&&c(t,".prototype.")>-1?a(i):i}},function(t,r,i){t.exports=i(258)},function(t,r,i){t.exports=i(236)},function(t,r,i){var o=i(512),a=i(513),c=i(184),u=i(514);t.exports=function _slicedToArray(t,r){return o(t)||a(t,r)||c(t,r)||u()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(15),a=i(11),c=i(12),aFunction=function(t){return c(t)?t:void 0};t.exports=function(t,r){return arguments.length<2?aFunction(o[t])||aFunction(a[t]):o[t]&&o[t][r]||a[t]&&a[t][r]}},function(t,r,i){"use strict";var o=i(11),a=i(15);t.exports=function(t,r){var i=a[t+"Prototype"],c=i&&i[r];if(c)return c;var u=o[t],l=u&&u.prototype;return l&&l[r]}},function(t,r){"function"==typeof Object.create?t.exports=function inherits(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function inherits(t,r){if(r){t.super_=r;var TempCtor=function(){};TempCtor.prototype=r.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}}},function(t,r,i){var o=i(545)();t.exports=o;try{regeneratorRuntime=o}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},function(t,r,i){"use strict";var o=i(13),a=i(223),c=i(225),u=i(33),l=i(162),d=TypeError,p=Object.defineProperty,h=Object.getOwnPropertyDescriptor;r.f=o?c?function defineProperty(t,r,i){if(u(t),r=l(r),u(i),"function"==typeof t&&"prototype"===r&&"value"in i&&"writable"in i&&!i.writable){var o=h(t,r);o&&o.writable&&(t[r]=i.value,i={configurable:"configurable"in i?i.configurable:o.configurable,enumerable:"enumerable"in i?i.enumerable:o.enumerable,writable:!1})}return p(t,r,i)}:p:function defineProperty(t,r,i){if(u(t),r=l(r),u(i),a)try{return p(t,r,i)}catch(t){}if("get"in i||"set"in i)throw new d("Accessors not supported");return"value"in i&&(t[r]=i.value),t}},function(t,r,i){"use strict";var o=i(18),a=String,c=TypeError;t.exports=function(t){if(o(t))return t;throw new c(a(t)+" is not an object")}},function(t,r,i){"use strict";var o=i(481);function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var a=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),d=["'"].concat(l),p=["%","/","?",";","#"].concat(d),h=["/","?","#"],m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=i(120);function urlParse(t,r,i){if(t&&"object"==typeof t&&t instanceof Url)return t;var o=new Url;return o.parse(t,r,i),o}Url.prototype.parse=function(t,r,i){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var c=t.indexOf("?"),l=-1!==c&&c<t.indexOf("#")?"?":"#",w=t.split(l);w[0]=w[0].replace(/\\/g,"/");var S=t=w.join(l);if(S=S.trim(),!i&&1===t.split("#").length){var I=u.exec(S);if(I)return this.path=S,this.href=S,this.pathname=I[1],I[2]?(this.search=I[2],this.query=r?_.parse(this.search.substr(1)):this.search.substr(1)):r&&(this.search="",this.query={}),this}var k=a.exec(S);if(k){var x=(k=k[0]).toLowerCase();this.protocol=x,S=S.substr(k.length)}if(i||k||S.match(/^\/\/[^@/]+@[^@/]+/)){var P="//"===S.substr(0,2);!P||k&&v[k]||(S=S.substr(2),this.slashes=!0)}if(!v[k]&&(P||k&&!b[k])){for(var C,A,O=-1,R=0;R<h.length;R++){-1!==(M=S.indexOf(h[R]))&&(-1===O||M<O)&&(O=M)}-1!==(A=-1===O?S.lastIndexOf("@"):S.lastIndexOf("@",O))&&(C=S.slice(0,A),S=S.slice(A+1),this.auth=decodeURIComponent(C)),O=-1;for(R=0;R<p.length;R++){var M;-1!==(M=S.indexOf(p[R]))&&(-1===O||M<O)&&(O=M)}-1===O&&(O=S.length),this.host=S.slice(0,O),S=S.slice(O),this.parseHost(),this.hostname=this.hostname||"";var j="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!j)for(var L=this.hostname.split(/\./),D=(R=0,L.length);R<D;R++){var B=L[R];if(B&&!B.match(m)){for(var N="",U=0,q=B.length;U<q;U++)B.charCodeAt(U)>127?N+="x":N+=B[U];if(!N.match(m)){var W=L.slice(0,R),z=L.slice(R+1),V=B.match(g);V&&(W.push(V[1]),z.unshift(V[2])),z.length&&(S="/"+z.join(".")+S),this.hostname=W.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=o.toASCII(this.hostname));var H=this.port?":"+this.port:"",$=this.hostname||"";this.host=$+H,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==S[0]&&(S="/"+S))}if(!y[x])for(R=0,D=d.length;R<D;R++){var K=d[R];if(-1!==S.indexOf(K)){var G=encodeURIComponent(K);G===K&&(G=escape(K)),S=S.split(K).join(G)}}var J=S.indexOf("#");-1!==J&&(this.hash=S.substr(J),S=S.slice(0,J));var Y=S.indexOf("?");if(-1!==Y?(this.search=S.substr(Y),this.query=S.substr(Y+1),r&&(this.query=_.parse(this.query)),S=S.slice(0,Y)):r&&(this.search="",this.query={}),S&&(this.pathname=S),b[x]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){H=this.pathname||"";var Q=this.search||"";this.path=H+Q}return this.href=this.format(),this},Url.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var r=this.protocol||"",i=this.pathname||"",o=this.hash||"",a=!1,c="";this.host?a=t+this.host:this.hostname&&(a=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(a+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(c=_.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var u=this.search||c&&"?"+c||"";return r&&":"!==r.substr(-1)&&(r+=":"),this.slashes||(!r||b[r])&&!1!==a?(a="//"+(a||""),i&&"/"!==i.charAt(0)&&(i="/"+i)):a||(a=""),o&&"#"!==o.charAt(0)&&(o="#"+o),u&&"?"!==u.charAt(0)&&(u="?"+u),r+a+(i=i.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(u=u.replace("#","%23"))+o},Url.prototype.resolve=function(t){return this.resolveObject(urlParse(t,!1,!0)).format()},Url.prototype.resolveObject=function(t){if("string"==typeof t){var r=new Url;r.parse(t,!1,!0),t=r}for(var i=new Url,o=Object.keys(this),a=0;a<o.length;a++){var c=o[a];i[c]=this[c]}if(i.hash=t.hash,""===t.href)return i.href=i.format(),i;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),l=0;l<u.length;l++){var d=u[l];"protocol"!==d&&(i[d]=t[d])}return b[i.protocol]&&i.hostname&&!i.pathname&&(i.pathname="/",i.path=i.pathname),i.href=i.format(),i}if(t.protocol&&t.protocol!==i.protocol){if(!b[t.protocol]){for(var p=Object.keys(t),h=0;h<p.length;h++){var m=p[h];i[m]=t[m]}return i.href=i.format(),i}if(i.protocol=t.protocol,t.host||v[t.protocol])i.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==g[0]&&g.unshift(""),g.length<2&&g.unshift(""),i.pathname=g.join("/")}if(i.search=t.search,i.query=t.query,i.host=t.host||"",i.auth=t.auth,i.hostname=t.hostname||t.host,i.port=t.port,i.pathname||i.search){var y=i.pathname||"",_=i.search||"";i.path=y+_}return i.slashes=i.slashes||t.slashes,i.href=i.format(),i}var w=i.pathname&&"/"===i.pathname.charAt(0),S=t.host||t.pathname&&"/"===t.pathname.charAt(0),I=S||w||i.host&&t.pathname,k=I,x=i.pathname&&i.pathname.split("/")||[],P=(g=t.pathname&&t.pathname.split("/")||[],i.protocol&&!b[i.protocol]);if(P&&(i.hostname="",i.port=null,i.host&&(""===x[0]?x[0]=i.host:x.unshift(i.host)),i.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===g[0]?g[0]=t.host:g.unshift(t.host)),t.host=null),I=I&&(""===g[0]||""===x[0])),S)i.host=t.host||""===t.host?t.host:i.host,i.hostname=t.hostname||""===t.hostname?t.hostname:i.hostname,i.search=t.search,i.query=t.query,x=g;else if(g.length)x||(x=[]),x.pop(),x=x.concat(g),i.search=t.search,i.query=t.query;else if(null!=t.search){if(P)i.host=x.shift(),i.hostname=i.host,(M=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=M.shift(),i.hostname=M.shift(),i.host=i.hostname);return i.search=t.search,i.query=t.query,null===i.pathname&&null===i.search||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!x.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var C=x.slice(-1)[0],A=(i.host||t.host||x.length>1)&&("."===C||".."===C)||""===C,O=0,R=x.length;R>=0;R--)"."===(C=x[R])?x.splice(R,1):".."===C?(x.splice(R,1),O++):O&&(x.splice(R,1),O--);if(!I&&!k)for(;O--;O)x.unshift("..");!I||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),A&&"/"!==x.join("/").substr(-1)&&x.push("");var M,j=""===x[0]||x[0]&&"/"===x[0].charAt(0);P&&(i.hostname=j?"":x.length?x.shift():"",i.host=i.hostname,(M=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=M.shift(),i.hostname=M.shift(),i.host=i.hostname));return(I=I||i.host&&x.length)&&!j&&x.unshift(""),x.length>0?i.pathname=x.join("/"):(i.pathname=null,i.path=null),null===i.pathname&&null===i.search||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=t.auth||i.auth,i.slashes=i.slashes||t.slashes,i.href=i.format(),i},Url.prototype.parseHost=function(){var t=this.host,r=c.exec(t);r&&(":"!==(r=r[0])&&(this.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(this.hostname=t)},r.parse=urlParse,r.resolve=function urlResolve(t,r){return urlParse(t,!1,!0).resolve(r)},r.resolveObject=function urlResolveObject(t,r){return t?urlParse(t,!1,!0).resolveObject(r):r},r.format=function urlFormat(t){return"string"==typeof t&&(t=urlParse(t)),t instanceof Url?t.format():Url.prototype.format.call(t)},r.Url=Url},function(t,r,i){"use strict";t.exports=!0},function(t,r,i){"use strict";var o=i(56),a=Object;t.exports=function(t){return a(o(t))}},function(t,r,i){"use strict";r.a=function(){let t=new Map;return{emit(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];let c=t.get(r);c&&c.length&&c.forEach(t=>{t.callback.call(t.vm,...o),t.once&&this.off(r,t.callback,t.vm)})},on(r,i,o){t.has(r)||t.set(r,[]),t.get(r).push({callback:i,vm:o||this})},off(r,i,o){let a=t.get(r);if(a&&a.length){let c=a.findIndex(t=>"function"==typeof t.callback&&t.callback===i&&t.vm===(o||this));c>-1&&(a.splice(c,1),t.set(r,a))}},once(r,i,o){t.has(r)||t.set(r,[]),t.get(r).push({callback:i,vm:o||this,once:!0})},clear(){t.clear()}}}},function(t,r,i){"use strict";var o=i(161),a=i(56);t.exports=function(t){return o(a(t))}},function(t,r,i){"use strict";var o=i(12),a=i(80),c=TypeError;t.exports=function(t){if(o(t))return t;throw new c(a(t)+" is not a function")}},function(t,r,i){"use strict";var o=i(64),a=String;t.exports=function(t){if("Symbol"===o(t))throw new TypeError("Cannot convert a Symbol value to a string");return a(t)}},function(t,r,i){"use strict";t.exports=SyntaxError},function(t,r,i){var o=i(597),a=i(598),c=i(184),u=i(599);t.exports=function _toConsumableArray(t){return o(t)||a(t)||c(t)||u()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(9),a=o({}.toString),c=o("".slice);t.exports=function(t){return c(a(t),8,-1)}},function(t,r,i){var o=i(282),a="object"==typeof self&&self&&self.Object===Object&&self,c=o||a||Function("return this")();t.exports=c},function(t,r,i){"use strict";var o,a="object"==typeof Reflect?Reflect:null,c=a&&"function"==typeof a.apply?a.apply:function ReflectApply(t,r,i){return Function.prototype.apply.call(t,r,i)};o=a&&"function"==typeof a.ownKeys?a.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function ReflectOwnKeys(t){return Object.getOwnPropertyNames(t)};var u=Number.isNaN||function NumberIsNaN(t){return t!=t};function EventEmitter(){EventEmitter.init.call(this)}t.exports=EventEmitter,t.exports.once=function once(t,r){return new Promise((function(i,o){function errorListener(i){t.removeListener(r,resolver),o(i)}function resolver(){"function"==typeof t.removeListener&&t.removeListener("error",errorListener),i([].slice.call(arguments))}eventTargetAgnosticAddListener(t,r,resolver,{once:!0}),"error"!==r&&function addErrorHandlerIfEventEmitter(t,r,i){"function"==typeof t.on&&eventTargetAgnosticAddListener(t,"error",r,i)}(t,errorListener,{once:!0})}))},EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var l=10;function checkListener(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function _getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function _addListener(t,r,i,o){var a,c,u;if(checkListener(i),void 0===(c=t._events)?(c=t._events=Object.create(null),t._eventsCount=0):(void 0!==c.newListener&&(t.emit("newListener",r,i.listener?i.listener:i),c=t._events),u=c[r]),void 0===u)u=c[r]=i,++t._eventsCount;else if("function"==typeof u?u=c[r]=o?[i,u]:[u,i]:o?u.unshift(i):u.push(i),(a=_getMaxListeners(t))>0&&u.length>a&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=r,l.count=u.length,function ProcessEmitWarning(t){console&&console.warn&&console.warn(t)}(l)}return t}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(t,r,i){var o={fired:!1,wrapFn:void 0,target:t,type:r,listener:i},a=onceWrapper.bind(o);return a.listener=i,o.wrapFn=a,a}function _listeners(t,r,i){var o=t._events;if(void 0===o)return[];var a=o[r];return void 0===a?[]:"function"==typeof a?i?[a.listener||a]:[a]:i?function unwrapListeners(t){for(var r=new Array(t.length),i=0;i<r.length;++i)r[i]=t[i].listener||t[i];return r}(a):arrayClone(a,a.length)}function listenerCount(t){var r=this._events;if(void 0!==r){var i=r[t];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function arrayClone(t,r){for(var i=new Array(r),o=0;o<r;++o)i[o]=t[o];return i}function eventTargetAgnosticAddListener(t,r,i,o){if("function"==typeof t.on)o.once?t.once(r,i):t.on(r,i);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(r,(function wrapListener(a){o.once&&t.removeEventListener(r,wrapListener),i(a)}))}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");l=t}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function setMaxListeners(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function emit(t){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var o="error"===t,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var u;if(r.length>0&&(u=r[0]),u instanceof Error)throw u;var l=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw l.context=u,l}var d=a[t];if(void 0===d)return!1;if("function"==typeof d)c(d,this,r);else{var p=d.length,h=arrayClone(d,p);for(i=0;i<p;++i)c(h[i],this,r)}return!0},EventEmitter.prototype.addListener=function addListener(t,r){return _addListener(this,t,r,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function prependListener(t,r){return _addListener(this,t,r,!0)},EventEmitter.prototype.once=function once(t,r){return checkListener(r),this.on(t,_onceWrap(this,t,r)),this},EventEmitter.prototype.prependOnceListener=function prependOnceListener(t,r){return checkListener(r),this.prependListener(t,_onceWrap(this,t,r)),this},EventEmitter.prototype.removeListener=function removeListener(t,r){var i,o,a,c,u;if(checkListener(r),void 0===(o=this._events))return this;if(void 0===(i=o[t]))return this;if(i===r||i.listener===r)0==--this._eventsCount?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,i.listener||r));else if("function"!=typeof i){for(a=-1,c=i.length-1;c>=0;c--)if(i[c]===r||i[c].listener===r){u=i[c].listener,a=c;break}if(a<0)return this;0===a?i.shift():function spliceOne(t,r){for(;r+1<t.length;r++)t[r]=t[r+1];t.pop()}(i,a),1===i.length&&(o[t]=i[0]),void 0!==o.removeListener&&this.emit("removeListener",t,u||r)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function removeAllListeners(t){var r,i,o;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[t]),this;if(0===arguments.length){var a,c=Object.keys(i);for(o=0;o<c.length;++o)"removeListener"!==(a=c[o])&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(r=i[t]))this.removeListener(t,r);else if(void 0!==r)for(o=r.length-1;o>=0;o--)this.removeListener(t,r[o]);return this},EventEmitter.prototype.listeners=function listeners(t){return _listeners(this,t,!0)},EventEmitter.prototype.rawListeners=function rawListeners(t){return _listeners(this,t,!1)},EventEmitter.listenerCount=function(t,r){return"function"==typeof t.listenerCount?t.listenerCount(r):listenerCount.call(t,r)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?o(this._events):[]}},function(t,r,i){var o=i(106),a=i(182),c=i(183),u=i(184);t.exports=function _createForOfIteratorHelper(t,r){var i=void 0!==o&&a(t)||t["@@iterator"];if(!i){if(c(t)||(i=u(t))||r&&t&&"number"==typeof t.length){i&&(t=i);var l=0,d=function F(){};return{s:d,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:d}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p,h=!0,m=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){m=!0,p=t},f:function f(){try{h||null==i.return||i.return()}finally{if(m)throw p}}}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(13),a=i(32),c=i(55);t.exports=o?function(t,r,i){return a.f(t,r,c(1,i))}:function(t,r,i){return t[r]=i,t}},function(t,r,i){"use strict";var o=i(47);t.exports=function(t,r,i,a){return a&&a.enumerable?t[r]=i:o(t,r,i),t}},function(t,r,i){"use strict";var o=i(169),a=i(32).f,c=i(47),u=i(21),l=i(372),d=i(10)("toStringTag");t.exports=function(t,r,i,p){var h=i?t:t&&t.prototype;h&&(u(h,d)||a(h,d,{configurable:!0,value:r}),p&&!o&&c(h,"toString",l))}},function(t,r,i){"use strict";var o=i(39),a=TypeError,PromiseCapability=function(t){var r,i;this.promise=new t((function(t,o){if(void 0!==r||void 0!==i)throw new a("Bad Promise constructor");r=t,i=o})),this.resolve=o(r),this.reject=o(i)};t.exports.f=function(t){return new PromiseCapability(t)}},function(t,r,i){"use strict";var o=i(90);t.exports=function(t){return("number"==typeof t||"bigint"==typeof t)&&!o(t)&&t!==1/0&&t!==-1/0}},function(t,r,i){t.exports=i(571)},function(t,r,i){t.exports=i(266)},function(t,r,i){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.File=r.Blob=r.FormData=void 0;const o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:window;r.FormData=o.FormData,r.Blob=o.Blob,r.File=o.File},function(t,r,i){"use strict";t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},function(t,r,i){"use strict";var o=i(78),a=TypeError;t.exports=function(t){if(o(t))throw new a("Can't call method on "+t);return t}},function(t,r,i){"use strict";var o=i(167);t.exports=function(t){return o(t.length)}},function(t,r,i){"use strict";var o,a,c,u=i(232),l=i(11),d=i(18),p=i(47),h=i(21),m=i(126),g=i(128),y=i(103),v=l.TypeError,b=l.WeakMap;if(u||m.state){var _=m.state||(m.state=new b);_.get=_.get,_.has=_.has,_.set=_.set,o=function(t,r){if(_.has(t))throw new v("Object already initialized");return r.facade=t,_.set(t,r),r},a=function(t){return _.get(t)||{}},c=function(t){return _.has(t)}}else{var w=g("state");y[w]=!0,o=function(t,r){if(h(t,w))throw new v("Object already initialized");return r.facade=t,p(t,w,r),r},a=function(t){return h(t,w)?t[w]:{}},c=function(t){return h(t,w)}}t.exports={set:o,get:a,has:c,enforce:function(t){return c(t)?a(t):o(t,{})},getterFor:function(t){return function(r){var i;if(!d(r)||(i=a(r)).type!==t)throw new v("Incompatible receiver, "+t+" required");return i}}}},function(t,r,i){"use strict";var o=i(179),a=i(6),c=i(489),u=i(3),l=a("%Function.prototype.apply%"),d=a("%Function.prototype.call%"),p=a("%Reflect.apply%",!0)||o.call(d,l),h=i(138),m=a("%Math.max%");t.exports=function callBind(t){if("function"!=typeof t)throw new u("a function is required");var r=p(o,d,arguments);return c(r,1+m(0,t.length-(arguments.length-1)),!0)};var g=function applyBind(){return p(o,l,arguments)};h?h(t.exports,"apply",{value:g}):t.exports.apply=g},function(t,r,i){"use strict";var o=i(6),a=i(3),c=o("%Number%"),u=i(723),l=i(308),d=i(724);t.exports=function ToNumber(t){var r=u(t)?t:l(t,c);if("symbol"==typeof r)throw new a("Cannot convert a Symbol value to a number");if("bigint"==typeof r)throw new a("Conversion from 'BigInt' to 'number' is not allowed.");return"string"==typeof r?d(r):c(r)}},function(t,r,i){var o=i(763);t.exports=function get(t,r,i){var a=null==t?void 0:o(t,r);return void 0===a?i:a}},function(t,r,i){"use strict";const o={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};o.localCName=o.generateIdentifier(),o.splitLines=function(t){return t.trim().split("\n").map(t=>t.trim())},o.splitSections=function(t){return t.split("\nm=").map((t,r)=>(r>0?"m="+t:t).trim()+"\r\n")},o.getDescription=function(t){const r=o.splitSections(t);return r&&r[0]},o.getMediaSections=function(t){const r=o.splitSections(t);return r.shift(),r},o.matchPrefix=function(t,r){return o.splitLines(t).filter(t=>0===t.indexOf(r))},o.parseCandidate=function(t){let r;r=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const i={foundation:r[0],component:{1:"rtp",2:"rtcp"}[r[1]]||r[1],protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]};for(let t=8;t<r.length;t+=2)switch(r[t]){case"raddr":i.relatedAddress=r[t+1];break;case"rport":i.relatedPort=parseInt(r[t+1],10);break;case"tcptype":i.tcpType=r[t+1];break;case"ufrag":i.ufrag=r[t+1],i.usernameFragment=r[t+1];break;default:void 0===i[r[t]]&&(i[r[t]]=r[t+1])}return i},o.writeCandidate=function(t){const r=[];r.push(t.foundation);const i=t.component;"rtp"===i?r.push(1):"rtcp"===i?r.push(2):r.push(i),r.push(t.protocol.toUpperCase()),r.push(t.priority),r.push(t.address||t.ip),r.push(t.port);const o=t.type;return r.push("typ"),r.push(o),"host"!==o&&t.relatedAddress&&t.relatedPort&&(r.push("raddr"),r.push(t.relatedAddress),r.push("rport"),r.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(r.push("tcptype"),r.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(r.push("ufrag"),r.push(t.usernameFragment||t.ufrag)),"candidate:"+r.join(" ")},o.parseIceOptions=function(t){return t.substring(14).split(" ")},o.parseRtpMap=function(t){let r=t.substring(9).split(" ");const i={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=parseInt(r[1],10),i.channels=3===r.length?parseInt(r[2],10):1,i.numChannels=i.channels,i},o.writeRtpMap=function(t){let r=t.payloadType;void 0!==t.preferredPayloadType&&(r=t.preferredPayloadType);const i=t.channels||t.numChannels||1;return"a=rtpmap:"+r+" "+t.name+"/"+t.clockRate+(1!==i?"/"+i:"")+"\r\n"},o.parseExtmap=function(t){const r=t.substring(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1],attributes:r.slice(2).join(" ")}},o.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+(t.attributes?" "+t.attributes:"")+"\r\n"},o.parseFmtp=function(t){const r={};let i;const o=t.substring(t.indexOf(" ")+1).split(";");for(let t=0;t<o.length;t++)i=o[t].trim().split("="),r[i[0].trim()]=i[1];return r},o.writeFmtp=function(t){let r="",i=t.payloadType;if(void 0!==t.preferredPayloadType&&(i=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const o=[];Object.keys(t.parameters).forEach(r=>{void 0!==t.parameters[r]?o.push(r+"="+t.parameters[r]):o.push(r)}),r+="a=fmtp:"+i+" "+o.join(";")+"\r\n"}return r},o.parseRtcpFb=function(t){const r=t.substring(t.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},o.writeRtcpFb=function(t){let r="",i=t.payloadType;return void 0!==t.preferredPayloadType&&(i=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(t=>{r+="a=rtcp-fb:"+i+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"}),r},o.parseSsrcMedia=function(t){const r=t.indexOf(" "),i={ssrc:parseInt(t.substring(7,r),10)},o=t.indexOf(":",r);return o>-1?(i.attribute=t.substring(r+1,o),i.value=t.substring(o+1)):i.attribute=t.substring(r+1),i},o.parseSsrcGroup=function(t){const r=t.substring(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(t=>parseInt(t,10))}},o.getMid=function(t){const r=o.matchPrefix(t,"a=mid:")[0];if(r)return r.substring(6)},o.parseFingerprint=function(t){const r=t.substring(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1].toUpperCase()}},o.getDtlsParameters=function(t,r){return{role:"auto",fingerprints:o.matchPrefix(t+r,"a=fingerprint:").map(o.parseFingerprint)}},o.writeDtlsParameters=function(t,r){let i="a=setup:"+r+"\r\n";return t.fingerprints.forEach(t=>{i+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"}),i},o.parseCryptoLine=function(t){const r=t.substring(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},o.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?o.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},o.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const r=t.substring(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}},o.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},o.getCryptoParameters=function(t,r){return o.matchPrefix(t+r,"a=crypto:").map(o.parseCryptoLine)},o.getIceParameters=function(t,r){const i=o.matchPrefix(t+r,"a=ice-ufrag:")[0],a=o.matchPrefix(t+r,"a=ice-pwd:")[0];return i&&a?{usernameFragment:i.substring(12),password:a.substring(10)}:null},o.writeIceParameters=function(t){let r="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(r+="a=ice-lite\r\n"),r},o.parseRtpParameters=function(t){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=o.splitLines(t)[0].split(" ");r.profile=i[2];for(let a=3;a<i.length;a++){const c=i[a],u=o.matchPrefix(t,"a=rtpmap:"+c+" ")[0];if(u){const i=o.parseRtpMap(u),a=o.matchPrefix(t,"a=fmtp:"+c+" ");switch(i.parameters=a.length?o.parseFmtp(a[0]):{},i.rtcpFeedback=o.matchPrefix(t,"a=rtcp-fb:"+c+" ").map(o.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}o.matchPrefix(t,"a=extmap:").forEach(t=>{r.headerExtensions.push(o.parseExtmap(t))});const a=o.matchPrefix(t,"a=rtcp-fb:* ").map(o.parseRtcpFb);return r.codecs.forEach(t=>{a.forEach(r=>{t.rtcpFeedback.find(t=>t.type===r.type&&t.parameter===r.parameter)||t.rtcpFeedback.push(r)})}),r},o.writeRtpDescription=function(t,r){let i="";i+="m="+t+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.payloadType).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach(t=>{i+=o.writeRtpMap(t),i+=o.writeFmtp(t),i+=o.writeRtcpFb(t)});let a=0;return r.codecs.forEach(t=>{t.maxptime>a&&(a=t.maxptime)}),a>0&&(i+="a=maxptime:"+a+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach(t=>{i+=o.writeExtmap(t)}),i},o.parseRtpEncodingParameters=function(t){const r=[],i=o.parseRtpParameters(t),a=-1!==i.fecMechanisms.indexOf("RED"),c=-1!==i.fecMechanisms.indexOf("ULPFEC"),u=o.matchPrefix(t,"a=ssrc:").map(t=>o.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute),l=u.length>0&&u[0].ssrc;let d;const p=o.matchPrefix(t,"a=ssrc-group:FID").map(t=>t.substring(17).split(" ").map(t=>parseInt(t,10)));p.length>0&&p[0].length>1&&p[0][0]===l&&(d=p[0][1]),i.codecs.forEach(t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let i={ssrc:l,codecPayloadType:parseInt(t.parameters.apt,10)};l&&d&&(i.rtx={ssrc:d}),r.push(i),a&&(i=JSON.parse(JSON.stringify(i)),i.fec={ssrc:l,mechanism:c?"red+ulpfec":"red"},r.push(i))}}),0===r.length&&l&&r.push({ssrc:l});let h=o.matchPrefix(t,"b=");return h.length&&(h=0===h[0].indexOf("b=TIAS:")?parseInt(h[0].substring(7),10):0===h[0].indexOf("b=AS:")?1e3*parseInt(h[0].substring(5),10)*.95-16e3:void 0,r.forEach(t=>{t.maxBitrate=h})),r},o.parseRtcpParameters=function(t){const r={},i=o.matchPrefix(t,"a=ssrc:").map(t=>o.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute)[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const a=o.matchPrefix(t,"a=rtcp-rsize");r.reducedSize=a.length>0,r.compound=0===a.length;const c=o.matchPrefix(t,"a=rtcp-mux");return r.mux=c.length>0,r},o.writeRtcpParameters=function(t){let r="";return t.reducedSize&&(r+="a=rtcp-rsize\r\n"),t.mux&&(r+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(r+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),r},o.parseMsid=function(t){let r;const i=o.matchPrefix(t,"a=msid:");if(1===i.length)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const a=o.matchPrefix(t,"a=ssrc:").map(t=>o.parseSsrcMedia(t)).filter(t=>"msid"===t.attribute);return a.length>0?(r=a[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},o.parseSctpDescription=function(t){const r=o.parseMLine(t),i=o.matchPrefix(t,"a=max-message-size:");let a;i.length>0&&(a=parseInt(i[0].substring(19),10)),isNaN(a)&&(a=65536);const c=o.matchPrefix(t,"a=sctp-port:");if(c.length>0)return{port:parseInt(c[0].substring(12),10),protocol:r.fmt,maxMessageSize:a};const u=o.matchPrefix(t,"a=sctpmap:");if(u.length>0){const t=u[0].substring(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:a}}},o.writeSctpDescription=function(t,r){let i=[];return i="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+r.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+r.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+r.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+r.port+" "+r.protocol+" 65535\r\n"],void 0!==r.maxMessageSize&&i.push("a=max-message-size:"+r.maxMessageSize+"\r\n"),i.join("")},o.generateSessionId=function(){return Math.random().toString().substr(2,22)},o.writeSessionBoilerplate=function(t,r,i){let a;const c=void 0!==r?r:2;a=t||o.generateSessionId();return"v=0\r\no="+(i||"thisisadapterortc")+" "+a+" "+c+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},o.getDirection=function(t,r){const i=o.splitLines(t);for(let t=0;t<i.length;t++)switch(i[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[t].substring(2)}return r?o.getDirection(r):"sendrecv"},o.getKind=function(t){return o.splitLines(t)[0].split(" ")[0].substring(2)},o.isRejected=function(t){return"0"===t.split(" ",2)[1]},o.parseMLine=function(t){const r=o.splitLines(t)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},o.parseOLine=function(t){const r=o.matchPrefix(t,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},o.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const r=o.splitLines(t);for(let t=0;t<r.length;t++)if(r[t].length<2||"="!==r[t].charAt(1))return!1;return!0},t.exports=o},function(t,r,i){"use strict";var o=i(122),a=i(39),c=i(121),u=o(o.bind);t.exports=function(t,r){return a(t),void 0===r?t:c?u(t,r):function(){return t.apply(r,arguments)}}},function(t,r,i){"use strict";var o=i(169),a=i(12),c=i(43),u=i(10)("toStringTag"),l=Object,d="Arguments"===c(function(){return arguments}());t.exports=o?c:function(t){var r,i,o;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,r){try{return t[r]}catch(t){}}(r=l(t),u))?i:d?c(r):"Object"===(o=c(r))&&a(r.callee)?"Arguments":o}},function(t,r,i){"use strict";var o=i(63),a=i(9),c=i(161),u=i(36),l=i(57),d=i(172),p=a([].push),createMethod=function(t){var r=1===t,i=2===t,a=3===t,h=4===t,m=6===t,g=7===t,y=5===t||m;return function(v,b,_,w){for(var S,I,k=u(v),x=c(k),P=l(x),C=o(b,_),A=0,O=w||d,R=r?O(v,P):i||g?O(v,0):void 0;P>A;A++)if((y||A in x)&&(I=C(S=x[A],A,k),t))if(r)R[A]=I;else if(I)switch(t){case 3:return!0;case 5:return S;case 6:return A;case 2:p(R,S)}else switch(t){case 4:return!1;case 7:p(R,S)}return m?-1:a||h?h:R}};t.exports={forEach:createMethod(0),map:createMethod(1),filter:createMethod(2),some:createMethod(3),every:createMethod(4),find:createMethod(5),findIndex:createMethod(6),filterReject:createMethod(7)}},function(t,r,i){"use strict";var o=i(43);t.exports=Array.isArray||function isArray(t){return"Array"===o(t)}},function(t,r,i){"use strict";i(68);var o=i(444),a=i(11),c=i(49),u=i(84);for(var l in o)c(a[l],l),u[l]=u.Array},function(t,r,i){"use strict";var o=i(38),a=i(175),c=i(84),u=i(58),l=i(32).f,d=i(245),p=i(176),h=i(35),m=i(13),g=u.set,y=u.getterFor("Array Iterator");t.exports=d(Array,"Array",(function(t,r){g(this,{type:"Array Iterator",target:o(t),index:0,kind:r})}),(function(){var t=y(this),r=t.target,i=t.index++;if(!r||i>=r.length)return t.target=void 0,p(void 0,!0);switch(t.kind){case"keys":return p(i,!1);case"values":return p(r[i],!1)}return p([i,r[i]],!1)}),"values");var v=c.Arguments=c.Array;if(a("keys"),a("values"),a("entries"),!h&&m&&"values"!==v.name)try{l(v,"name",{value:"values"})}catch(t){}},function(t,r,i){"use strict";var o=Function.prototype.call,a=Object.prototype.hasOwnProperty,c=i(179);t.exports=c.call(o,a)},function(t,r,i){"use strict";var o=i(63),a=i(20),c=i(33),u=i(80),l=i(262),d=i(57),p=i(23),h=i(185),m=i(109),g=i(261),y=TypeError,Result=function(t,r){this.stopped=t,this.result=r},v=Result.prototype;t.exports=function(t,r,i){var b,_,w,S,I,k,x,P=i&&i.that,C=!(!i||!i.AS_ENTRIES),A=!(!i||!i.IS_RECORD),O=!(!i||!i.IS_ITERATOR),R=!(!i||!i.INTERRUPTED),M=o(r,P),stop=function(t){return b&&g(b,"normal",t),new Result(!0,t)},callFn=function(t){return C?(c(t),R?M(t[0],t[1],stop):M(t[0],t[1])):R?M(t,stop):M(t)};if(A)b=t.iterator;else if(O)b=t;else{if(!(_=m(t)))throw new y(u(t)+" is not iterable");if(l(_)){for(w=0,S=d(t);S>w;w++)if((I=callFn(t[w]))&&p(v,I))return I;return new Result(!1)}b=h(t,_)}for(k=A?t.next:b.next;!(x=a(k,b)).done;){try{I=callFn(x.value)}catch(t){g(b,"throw",t)}if("object"==typeof I&&I&&p(v,I))return I}return new Result(!1)}},function(t,r,i){var o=i(621),a=i(626);t.exports=function getNative(t,r){var i=a(t,r);return o(i)?i:void 0}},function(t,r,i){"use strict";var o=i(698);t.exports=function Type(t){return"symbol"==typeof t?"Symbol":"bigint"==typeof t?"BigInt":o(t)}},function(t,r,i){"use strict";var o=i(202),a=i(3);t.exports=function truncate(t){if("number"!=typeof t&&"bigint"!=typeof t)throw new a("argument must be a Number or a BigInt");var r=t<0?-o(-t):o(t);return 0===r?0:r}},function(t,r,i){(r=t.exports=i(323)).Stream=r,r.Readable=r,r.Writable=i(327),r.Duplex=i(96),r.Transform=i(329),r.PassThrough=i(790),r.finished=i(211),r.pipeline=i(791)},function(t,r,i){(function(o){r.formatArgs=function formatArgs(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;r.splice(1,0,i,"color: inherit");let o=0,a=0;r[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(o++,"%c"===t&&(a=o))}),r.splice(a,0,i)},r.save=function save(t){try{t?r.storage.setItem("debug",t):r.storage.removeItem("debug")}catch(t){}},r.load=function load(){let t;try{t=r.storage.getItem("debug")}catch(t){}!t&&void 0!==o&&"env"in o&&(t=o.env.DEBUG);return t},r.useColors=function useColors(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function localstorage(){try{return localStorage}catch(t){}}(),r.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=i(797)(r);const{formatters:a}=t.exports;a.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,i(19))},function(t,r,i){t.exports=i(580)},function(t,r,i){"use strict";var o=i(13),a=i(20),c=i(123),u=i(55),l=i(38),d=i(162),p=i(21),h=i(223),m=Object.getOwnPropertyDescriptor;r.f=o?m:function getOwnPropertyDescriptor(t,r){if(t=l(t),r=d(r),h)try{return m(t,r)}catch(t){}if(p(t,r))return u(!a(c.f,t,r),t[r])}},function(t,r,i){"use strict";t.exports=function(t){return null==t}},function(t,r,i){"use strict";var o=i(124),a=i(8),c=i(11).String;t.exports=!!Object.getOwnPropertySymbols&&!a((function(){var t=Symbol("symbol detection");return!c(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&o&&o<41}))},function(t,r,i){"use strict";var o=String;t.exports=function(t){try{return o(t)}catch(t){return"Object"}}},function(t,r,i){"use strict";var o=i(126);t.exports=function(t,r){return o[t]||(o[t]=r||{})}},function(t,r,i){"use strict";var o,a=i(33),c=i(170),u=i(168),l=i(103),d=i(229),p=i(164),h=i(128),m=h("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"<\/script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var r=t.parentWindow.Object;return t=null,r},NullProtoObject=function(){try{o=new ActiveXObject("htmlfile")}catch(t){}var t,r;NullProtoObject="undefined"!=typeof document?document.domain&&o?NullProtoObjectViaActiveX(o):((r=p("iframe")).style.display="none",d.appendChild(r),r.src=String("javascript:"),(t=r.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F):NullProtoObjectViaActiveX(o);for(var i=u.length;i--;)delete NullProtoObject.prototype[u[i]];return NullProtoObject()};l[m]=!0,t.exports=Object.create||function create(t,r){var i;return null!==t?(EmptyConstructor.prototype=a(t),i=new EmptyConstructor,EmptyConstructor.prototype=null,i[m]=t):i=NullProtoObject(),void 0===r?i:c.f(i,r)}},function(t,r,i){"use strict";var o=i(9);t.exports=o([].slice)},function(t,r,i){"use strict";t.exports={}},function(t,r,i){"use strict";var o=i(6)("%Object.getOwnPropertyDescriptor%",!0);if(o)try{o([],"length")}catch(t){o=null}t.exports=o},function(t,r,i){"use strict";t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},function(t,r,i){"use strict";var o=i(11);t.exports=o.Promise},function(t,r){t.exports=function isObjectLike(t){return null!=t&&"object"==typeof t}},function(t,r){var i=Array.isArray;t.exports=i},function(t,r,i){"use strict";t.exports=Number.isNaN||function isNaN(t){return t!=t}},function(t,r,i){"use strict";(function(r){var o=i(3),a=i(301),c=i(114)(),u=i(24),l=i(92),d=i(115),p=u("SharedArrayBuffer.prototype.byteLength",!0);t.exports=function IsDetachedBuffer(t){var i=d(t);if(!l(t)&&!i)throw new o("Assertion failed: `arrayBuffer` must be an Object with an [[ArrayBufferData]] internal slot");if(0===(i?p:a)(t))try{new r[c[0]](t)}catch(t){return!!t&&"TypeError"===t.name}return!1}}).call(this,i(17))},function(t,r,i){"use strict";var o=i(59),a=i(24),c=i(6)("%ArrayBuffer%",!0),u=a("ArrayBuffer.prototype.byteLength",!0),l=a("Object.prototype.toString"),d=!!c&&!u&&new c(0).slice,p=!!d&&o(d);t.exports=u||p?function isArrayBuffer(t){if(!t||"object"!=typeof t)return!1;try{return u?u(t):p(t,0),!0}catch(t){return!1}}:c?function isArrayBuffer(t){return"[object ArrayBuffer]"===l(t)}:function isArrayBuffer(t){return!1}},function(t,r,i){"use strict";var o=i(113);t.exports=function isTypedArray(t){return!!o(t)}},function(t,r,i){"use strict";var o=i(722);t.exports=function modulo(t,r){return o(t,r)}},function(t,r,i){"use strict";var o={};function createErrorType(t,r,i){i||(i=Error);var a=function(t){function NodeError(i,o,a){return t.call(this,function getMessage(t,i,o){return"string"==typeof r?r:r(t,i,o)}(i,o,a))||this}return function _inheritsLoose(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r}(NodeError,t),NodeError}(i);a.prototype.name=i.name,a.prototype.code=t,o[t]=a}function oneOf(t,r){if(Array.isArray(t)){var i=t.length;return t=t.map((function(t){return String(t)})),i>2?"one of ".concat(r," ").concat(t.slice(0,i-1).join(", "),", or ")+t[i-1]:2===i?"one of ".concat(r," ").concat(t[0]," or ").concat(t[1]):"of ".concat(r," ").concat(t[0])}return"of ".concat(r," ").concat(String(t))}createErrorType("ERR_INVALID_OPT_VALUE",(function(t,r){return'The value "'+r+'" is invalid for option "'+t+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(t,r,i){var o,a;if("string"==typeof r&&function startsWith(t,r,i){return t.substr(!i||i<0?0:+i,r.length)===r}(r,"not ")?(o="must not be",r=r.replace(/^not /,"")):o="must be",function endsWith(t,r,i){return(void 0===i||i>t.length)&&(i=t.length),t.substring(i-r.length,i)===r}(t," argument"))a="The ".concat(t," ").concat(o," ").concat(oneOf(r,"type"));else{var c=function includes(t,r,i){return"number"!=typeof i&&(i=0),!(i+r.length>t.length)&&-1!==t.indexOf(r,i)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(c," ").concat(o," ").concat(oneOf(r,"type"))}return a+=". Received type ".concat(typeof i)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=o},function(t,r,i){"use strict";(function(r){var o=Object.keys||function(t){var r=[];for(var i in t)r.push(i);return r};t.exports=Duplex;var a=i(323),c=i(327);i(30)(Duplex,a);for(var u=o(c.prototype),l=0;l<u.length;l++){var d=u[l];Duplex.prototype[d]||(Duplex.prototype[d]=c.prototype[d])}function Duplex(t){if(!(this instanceof Duplex))return new Duplex(t);a.call(this,t),c.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",onend)))}function onend(){this._writableState.ended||r.nextTick(onEndNT,this)}function onEndNT(t){t.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Duplex.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Duplex.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function set(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,i(19))},function(t,r,i){"use strict";var o=i(117),a=Object.keys||function(t){var r=[];for(var i in t)r.push(i);return r};t.exports=Duplex;var c=Object.create(i(118));c.inherits=i(30);var u=i(340),l=i(343);c.inherits(Duplex,u);for(var d=a(l.prototype),p=0;p<d.length;p++){var h=d[p];Duplex.prototype[h]||(Duplex.prototype[h]=l.prototype[h])}function Duplex(t){if(!(this instanceof Duplex))return new Duplex(t);u.call(this,t),l.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||o.nextTick(onEndNT,this)}function onEndNT(t){t.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),Duplex.prototype._destroy=function(t,r){this.push(null),this.end(),o.nextTick(r,t)}},function(t,r,i){var o=i(265);function asyncGeneratorStep(t,r,i,a,c,u,l){try{var d=t[u](l),p=d.value}catch(t){return void i(t)}d.done?r(p):o.resolve(p).then(a,c)}t.exports=function _asyncToGenerator(t){return function(){var r=this,i=arguments;return new o((function(o,a){var c=t.apply(r,i);function _next(t){asyncGeneratorStep(c,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(c,o,a,_next,_throw,"throw",t)}_next(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(121),a=Function.prototype,c=a.apply,u=a.call;t.exports="object"==typeof Reflect&&Reflect.apply||(o?u.bind(c):function(){return u.apply(c,arguments)})},function(t,r,i){"use strict";var o=i(28),a=i(12),c=i(23),u=i(222),l=Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var r=o("Symbol");return a(r)&&c(r.prototype,l(t))}},function(t,r,i){"use strict";var o=i(226),a=i(168);t.exports=Object.keys||function keys(t){return o(t,a)}},function(t,r,i){"use strict";var o=i(366);t.exports=function(t){var r=+t;return r!=r||0===r?0:o(r)}},function(t,r,i){"use strict";t.exports={}},function(t,r,i){"use strict";var o=i(8),a=i(10),c=i(124),u=a("species");t.exports=function(t){return c>=51||!o((function(){var r=[];return(r.constructor={})[u]=function(){return{foo:1}},1!==r[t](Boolean).foo}))}},function(t,r,i){"use strict";var o=i(13),a=i(32),c=i(55);t.exports=function(t,r,i){o?a.f(t,r,c(0,i)):t[r]=i}},function(t,r,i){"use strict";t.exports=i(421)},function(t,r){},function(t,r,i){"use strict";var o=i(21),a=i(12),c=i(36),u=i(128),l=i(248),d=u("IE_PROTO"),p=Object,h=p.prototype;t.exports=l?p.getPrototypeOf:function(t){var r=c(t);if(o(r,d))return r[d];var i=r.constructor;return a(i)&&r instanceof i?i.prototype:r instanceof p?h:null}},function(t,r,i){"use strict";var o=i(64),a=i(163),c=i(78),u=i(84),l=i(10)("iterator");t.exports=function(t){if(!c(t))return a(t,l)||a(t,"@@iterator")||u[o(t)]}},function(t,r,i){"use strict";var o=i(11),a=i(87),c=i(12),u=i(224),l=i(233),d=i(10),p=i(533),h=i(274),m=i(35),g=i(124),y=a&&a.prototype,v=d("species"),b=!1,_=c(o.PromiseRejectionEvent),w=u("Promise",(function(){var t=l(a),r=t!==String(a);if(!r&&66===g)return!0;if(m&&(!y.catch||!y.finally))return!0;if(!g||g<51||!/native code/.test(t)){var i=new a((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};if((i.constructor={})[v]=FakePromise,!(b=i.then((function(){}))instanceof FakePromise))return!0}return!r&&(p||h)&&!_}));t.exports={CONSTRUCTOR:w,REJECTION_EVENT:_,SUBCLASSING:b}},function(t,r,i){var o=i(144),a=i(622),c=i(623),u=o?o.toStringTag:void 0;t.exports=function baseGetTag(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?a(t):c(t)}},function(t,r){t.exports=function isObject(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}},function(t,r,i){"use strict";(function(r){var o=i(197),a=i(114),c=i(59),u=i(24),l=i(85),d=u("Object.prototype.toString"),p=i(199)(),h="undefined"==typeof globalThis?r:globalThis,m=a(),g=u("String.prototype.slice"),y=Object.getPrototypeOf,v=u("Array.prototype.indexOf",!0)||function indexOf(t,r){for(var i=0;i<t.length;i+=1)if(t[i]===r)return i;return-1},b={__proto__:null};o(m,p&&l&&y?function(t){var r=new h[t];if(Symbol.toStringTag in r){var i=y(r),o=l(i,Symbol.toStringTag);if(!o){var a=y(i);o=l(a,Symbol.toStringTag)}b["$"+t]=c(o.get)}}:function(t){var r=new h[t],i=r.slice||r.set;i&&(b["$"+t]=c(i))});t.exports=function whichTypedArray(t){if(!t||"object"!=typeof t)return!1;if(!p){var r=g(d(t),8,-1);return v(m,r)>-1?r:"Object"===r&&function tryAllSlices(t){var r=!1;return o(b,(function(i,o){if(!r)try{i(t),r=g(o,1)}catch(t){}})),r}(t)}return l?function tryAllTypedArrays(t){var r=!1;return o(b,(function(i,o){if(!r)try{"$"+i(t)===o&&(r=g(o,1))}catch(t){}})),r}(t):null}}).call(this,i(17))},function(t,r,i){"use strict";(function(r){var o=i(298),a="undefined"==typeof globalThis?r:globalThis;t.exports=function availableTypedArrays(){for(var t=[],r=0;r<o.length;r++)"function"==typeof a[o[r]]&&(t[t.length]=o[r]);return t}}).call(this,i(17))},function(t,r,i){"use strict";var o=i(24)("SharedArrayBuffer.prototype.byteLength",!0);t.exports=o?function isSharedArrayBuffer(t){if(!t||"object"!=typeof t)return!1;try{return o(t),!0}catch(t){return!1}}:function isSharedArrayBuffer(t){return!1}},function(t,r,i){"use strict";var o=i(3),a=i(24)("TypedArray.prototype.buffer",!0),c=i(93);t.exports=a||function typedArrayBuffer(t){if(!c(t))throw new o("Not a Typed Array");return t.buffer}},function(t,r,i){"use strict";(function(r){void 0===r||!r.version||0===r.version.indexOf("v0.")||0===r.version.indexOf("v1.")&&0!==r.version.indexOf("v1.8.")?t.exports={nextTick:function nextTick(t,i,o,a){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var c,u,l=arguments.length;switch(l){case 0:case 1:return r.nextTick(t);case 2:return r.nextTick((function afterTickOne(){t.call(null,i)}));case 3:return r.nextTick((function afterTickTwo(){t.call(null,i,o)}));case 4:return r.nextTick((function afterTickThree(){t.call(null,i,o,a)}));default:for(c=new Array(l-1),u=0;u<c.length;)c[u++]=arguments[u];return r.nextTick((function afterTick(){t.apply(null,c)}))}}}:t.exports=r}).call(this,i(19))},function(t,r,i){function objectToString(t){return Object.prototype.toString.call(t)}r.isArray=function isArray(t){return Array.isArray?Array.isArray(t):"[object Array]"===objectToString(t)},r.isBoolean=function isBoolean(t){return"boolean"==typeof t},r.isNull=function isNull(t){return null===t},r.isNullOrUndefined=function isNullOrUndefined(t){return null==t},r.isNumber=function isNumber(t){return"number"==typeof t},r.isString=function isString(t){return"string"==typeof t},r.isSymbol=function isSymbol(t){return"symbol"==typeof t},r.isUndefined=function isUndefined(t){return void 0===t},r.isRegExp=function isRegExp(t){return"[object RegExp]"===objectToString(t)},r.isObject=function isObject(t){return"object"==typeof t&&null!==t},r.isDate=function isDate(t){return"[object Date]"===objectToString(t)},r.isError=function isError(t){return"[object Error]"===objectToString(t)||t instanceof Error},r.isFunction=function isFunction(t){return"function"==typeof t},r.isPrimitive=function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=i(16).Buffer.isBuffer},function(t,r,i){t.exports=i(476)},function(t,r,i){"use strict";var o=i(482),a=i(491),c=i(181);t.exports={formats:c,parse:a,stringify:o}},function(t,r,i){"use strict";var o=i(8);t.exports=!o((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},function(t,r,i){"use strict";var o=i(43),a=i(9);t.exports=function(t){if("Function"===o(t))return a(t)}},function(t,r,i){"use strict";var o={}.propertyIsEnumerable,a=Object.getOwnPropertyDescriptor,c=a&&!o.call({1:2},1);r.f=c?function propertyIsEnumerable(t){var r=a(this,t);return!!r&&r.enumerable}:o},function(t,r,i){"use strict";var o,a,c=i(11),u=i(125),l=c.process,d=c.Deno,p=l&&l.versions||d&&d.version,h=p&&p.v8;h&&(a=(o=h.split("."))[0]>0&&o[0]<4?1:+(o[0]+o[1])),!a&&u&&(!(o=u.match(/Edge\/(\d+)/))||o[1]>=74)&&(o=u.match(/Chrome\/(\d+)/))&&(a=+o[1]),t.exports=a},function(t,r,i){"use strict";t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},function(t,r,i){"use strict";var o=i(35),a=i(11),c=i(365),u=t.exports=a["__core-js_shared__"]||c("__core-js_shared__",{});(u.versions||(u.versions=[])).push({version:"3.37.1",mode:o?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"})},function(t,r,i){"use strict";var o=i(9),a=0,c=Math.random(),u=o(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+u(++a+c,36)}},function(t,r,i){"use strict";var o=i(81),a=i(127),c=o("keys");t.exports=function(t){return c[t]||(c[t]=a(t))}},function(t,r,i){"use strict";var o=i(226),a=i(168).concat("length","prototype");r.f=Object.getOwnPropertyNames||function getOwnPropertyNames(t){return o(t,a)}},function(t,r,i){"use strict";r.f=Object.getOwnPropertySymbols},function(t,r,i){"use strict";var o=i(10);r.f=o},function(t,r,i){"use strict";var o=i(9),a=i(8),c=i(12),u=i(64),l=i(28),d=i(233),noop=function(){},p=l("Reflect","construct"),h=/^\s*(?:class|function)\b/,m=o(h.exec),g=!h.test(noop),y=function isConstructor(t){if(!c(t))return!1;try{return p(noop,[],t),!0}catch(t){return!1}},v=function isConstructor(t){if(!c(t))return!1;switch(u(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return g||!!m(h,d(t))}catch(t){return!0}};v.sham=!0,t.exports=!p||a((function(){var t;return y(y.call)||!y(Object)||!y((function(){t=!0}))||t}))?v:y},function(t,r,i){"use strict";t.exports=i(416)},function(t,r,i){"use strict";var o=i(441),a=i(18),c=i(56),u=i(442);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,i={};try{(t=o(Object.prototype,"__proto__","set"))(i,[]),r=i instanceof Array}catch(t){}return function setPrototypeOf(i,o){return c(i),u(o),a(i)?(r?t(i,o):i.__proto__=o,i):i}}():void 0)},function(t,r,i){"use strict";var o=i(464).charAt,a=i(40),c=i(58),u=i(245),l=i(176),d=c.set,p=c.getterFor("String Iterator");u(String,"String",(function(t){d(this,{type:"String Iterator",string:a(t),index:0})}),(function next(){var t,r=p(this),i=r.string,a=r.index;return a>=i.length?l(void 0,!0):(t=o(i,a),r.index+=t.length,l(t,!1))}))},function(t,r){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],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}}),t.webpackPolyfill=1),t}},function(t,r,i){"use strict";var o={__proto__:null,foo:{}},a=Object;t.exports=function hasProto(){return{__proto__:o}.foo===o.foo&&!(o instanceof a)}},function(t,r,i){"use strict";var o=i(6)("%Object.defineProperty%",!0)||!1;if(o)try{o({},"a",{value:1})}catch(t){o=!1}t.exports=o},function(t,r,i){"use strict";var o=i(11),a=i(43);t.exports="process"===a(o.process)},function(t,r,i){"use strict";var o=i(23),a=TypeError;t.exports=function(t,r){if(o(r,t))return t;throw new a("Incorrect invocation")}},function(t,r,i){"use strict";var o=i(87),a=i(263),c=i(110).CONSTRUCTOR;t.exports=c||!a((function(t){o.all(t).then(void 0,(function(){}))}))},function(t,r,i){var o=i(611),a=i(612),c=i(613),u=i(614),l=i(615);function ListCache(t){var r=-1,i=null==t?0:t.length;for(this.clear();++r<i;){var o=t[r];this.set(o[0],o[1])}}ListCache.prototype.clear=o,ListCache.prototype.delete=a,ListCache.prototype.get=c,ListCache.prototype.has=u,ListCache.prototype.set=l,t.exports=ListCache},function(t,r,i){var o=i(280);t.exports=function assocIndexOf(t,r){for(var i=t.length;i--;)if(o(t[i][0],r))return i;return-1}},function(t,r,i){var o=i(44).Symbol;t.exports=o},function(t,r,i){var o=i(71)(Object,"create");t.exports=o},function(t,r,i){var o=i(635);t.exports=function getMapData(t,r){var i=t.__data__;return o(r)?i["string"==typeof r?"string":"hash"]:i.map}},function(t,r,i){var o=i(285),a=i(286);t.exports=function copyObject(t,r,i,c){var u=!i;i||(i={});for(var l=-1,d=r.length;++l<d;){var p=r[l],h=c?c(i[p],t[p],p,i,t):void 0;void 0===h&&(h=t[p]),u?a(i,p,h):o(i,p,h)}return i}},function(t,r,i){"use strict";var o=i(200),a="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),c=Object.prototype.toString,u=Array.prototype.concat,l=i(254),d=i(180)(),defineProperty=function(t,r,i,o){if(r in t)if(!0===o){if(t[r]===i)return}else if("function"!=typeof(a=o)||"[object Function]"!==c.call(a)||!o())return;var a;d?l(t,r,i,!0):l(t,r,i)},defineProperties=function(t,r){var i=arguments.length>2?arguments[2]:{},c=o(r);a&&(c=u.call(c,Object.getOwnPropertySymbols(r)));for(var l=0;l<c.length;l+=1)defineProperty(t,c[l],r[c[l]],i[c[l]])};defineProperties.supportsDescriptors=!!d,t.exports=defineProperties},function(t,r,i){"use strict";t.exports=function IsPropertyKey(t){return"string"==typeof t||"symbol"==typeof t}},function(t,r,i){"use strict";var o=i(6),a=o("%Math.abs%"),c=o("%Math.floor%"),u=i(90),l=i(51);t.exports=function isInteger(t){if("number"!=typeof t||u(t)||!l(t))return!1;var r=a(t);return c(r)===r}},function(t,r,i){"use strict";t.exports={__proto__:null,name:{__proto__:null,$Int8Array:"INT8",$Uint8Array:"UINT8",$Uint8ClampedArray:"UINT8C",$Int16Array:"INT16",$Uint16Array:"UINT16",$Int32Array:"INT32",$Uint32Array:"UINT32",$BigInt64Array:"BIGINT64",$BigUint64Array:"BIGUINT64",$Float32Array:"FLOAT32",$Float64Array:"FLOAT64"},size:{__proto__:null,$INT8:1,$UINT8:1,$UINT8C:1,$INT16:2,$UINT16:2,$INT32:4,$UINT32:4,$BIGINT64:8,$BIGUINT64:8,$FLOAT32:4,$FLOAT64:8}}},function(t,r,i){"use strict";var o=i(787).Buffer,a=o.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(t){var r;switch(this.encoding=function normalizeEncoding(t){var r=function _normalizeEncoding(t){if(!t)return"utf8";for(var r;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(r)return;t=(""+t).toLowerCase(),r=!0}}(t);if("string"!=typeof r&&(o.isEncoding===a||!a(t)))throw new Error("Unknown encoding: "+t);return r||t}(t),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,r=4;break;case"utf8":this.fillLast=utf8FillLast,r=4;break;case"base64":this.text=base64Text,this.end=base64End,r=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=o.allocUnsafe(r)}function utf8CheckByte(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function utf8FillLast(t){var r=this.lastTotal-this.lastNeed,i=function utf8CheckExtraBytes(t,r,i){if(128!=(192&r[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&r.length>1){if(128!=(192&r[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&r.length>2&&128!=(192&r[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,r,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,r,0,t.length),void(this.lastNeed-=t.length))}function utf16Text(t,r){if((t.length-r)%2==0){var i=t.toString("utf16le",r);if(i){var o=i.charCodeAt(i.length-1);if(o>=55296&&o<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",r,t.length-1)}function utf16End(t){var r=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,i)}return r}function base64Text(t,r){var i=(t.length-r)%3;return 0===i?t.toString("base64",r):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",r,t.length-i))}function base64End(t){var r=t&&t.length?this.write(t):"";return this.lastNeed?r+this.lastChar.toString("base64",0,3-this.lastNeed):r}function simpleWrite(t){return t.toString(this.encoding)}function simpleEnd(t){return t&&t.length?this.write(t):""}r.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(t){if(0===t.length)return"";var r,i;if(this.lastNeed){if(void 0===(r=this.fillLast(t)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?r?r+this.text(t,i):this.text(t,i):r||""},StringDecoder.prototype.end=function utf8End(t){var r=t&&t.length?this.write(t):"";return this.lastNeed?r+"�":r},StringDecoder.prototype.text=function utf8Text(t,r){var i=function utf8CheckIncomplete(t,r,i){var o=r.length-1;if(o<i)return 0;var a=utf8CheckByte(r[o]);if(a>=0)return a>0&&(t.lastNeed=a-1),a;if(--o<i||-2===a)return 0;if((a=utf8CheckByte(r[o]))>=0)return a>0&&(t.lastNeed=a-2),a;if(--o<i||-2===a)return 0;if((a=utf8CheckByte(r[o]))>=0)return a>0&&(2===a?a=0:t.lastNeed=a-3),a;return 0}(this,t,r);if(!this.lastNeed)return t.toString("utf8",r);this.lastTotal=i;var o=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,o),t.toString("utf8",r,o)},StringDecoder.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,r){t.exports=function(t){return null==t}},function(t,r,i){var o=i(16),a=o.Buffer;function copyProps(t,r){for(var i in t)r[i]=t[i]}function SafeBuffer(t,r,i){return a(t,r,i)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?t.exports=o:(copyProps(o,r),r.Buffer=SafeBuffer),copyProps(a,SafeBuffer),SafeBuffer.from=function(t,r,i){if("number"==typeof t)throw new TypeError("Argument must not be a number");return a(t,r,i)},SafeBuffer.alloc=function(t,r,i){if("number"!=typeof t)throw new TypeError("Argument must be a number");var o=a(t);return void 0!==r?"string"==typeof i?o.fill(r,i):o.fill(r):o.fill(0),o},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return a(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o.SlowBuffer(t)}},function(t,r,i){t.exports=i(260)},function(t,r,i){t.exports=i(593)},function(t,r){t.exports=function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){var o=i(133),a=i(241);function _defineProperties(t,r){for(var i=0;i<r.length;i++){var c=r[i];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),o(t,a(c.key),c)}}t.exports=function _createClass(t,r,i){return r&&_defineProperties(t.prototype,r),i&&_defineProperties(t,i),o(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){(function(r){!function(){"use strict";t.exports=function btoa(t){return(t instanceof r?t:r.from(t.toString(),"binary")).toString("base64")}}()}).call(this,i(16).Buffer)},function(t,r,i){"use strict";(function(t){i.d(r,"a",(function(){return serializeError}));Error;const o=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0}],a=Symbol(".toJSON was called"),destroyCircular=({from:r,seen:i,to_:c,forceEnumerable:u,maxDepth:l,depth:d})=>{const p=c||(Array.isArray(r)?[]:{});if(i.push(r),d>=l)return p;if("function"==typeof r.toJSON&&!0!==r[a])return(t=>{t[a]=!0;const r=t.toJSON();return delete t[a],r})(r);for(const[o,a]of Object.entries(r))"function"==typeof t&&t.isBuffer(a)?p[o]="[object Buffer]":"object"!=typeof a||"function"!=typeof a.pipe?"function"!=typeof a&&(a&&"object"==typeof a?i.includes(r[o])?p[o]="[Circular]":(d++,p[o]=destroyCircular({from:r[o],seen:[...i],forceEnumerable:u,maxDepth:l,depth:d})):p[o]=a):p[o]="[object Stream]";for(const{property:t,enumerable:i}of o)"string"==typeof r[t]&&Object.defineProperty(p,t,{value:r[t],enumerable:!!u||i,configurable:!0,writable:!0});return p};function serializeError(t,r={}){const{maxDepth:i=Number.POSITIVE_INFINITY}=r;return"object"==typeof t&&null!==t?destroyCircular({from:t,seen:[],forceEnumerable:!0,maxDepth:i,depth:0}):"function"==typeof t?`[Function: ${t.name||"anonymous"}]`:t}}).call(this,i(16).Buffer)},function(t,r,i){"use strict";var o=i(9),a=i(8),c=i(43),u=Object,l=o("".split);t.exports=a((function(){return!u("z").propertyIsEnumerable(0)}))?function(t){return"String"===c(t)?l(t,""):u(t)}:u},function(t,r,i){"use strict";var o=i(221),a=i(100);t.exports=function(t){var r=o(t,"string");return a(r)?r:r+""}},function(t,r,i){"use strict";var o=i(39),a=i(78);t.exports=function(t,r){var i=t[r];return a(i)?void 0:o(i)}},function(t,r,i){"use strict";var o=i(11),a=i(18),c=o.document,u=a(c)&&a(c.createElement);t.exports=function(t){return u?c.createElement(t):{}}},function(t,r,i){"use strict";var o=i(38),a=i(166),c=i(57),createMethod=function(t){return function(r,i,u){var l=o(r),d=c(l);if(0===d)return!t&&-1;var p,h=a(u,d);if(t&&i!=i){for(;d>h;)if((p=l[h++])!=p)return!0}else for(;d>h;h++)if((t||h in l)&&l[h]===i)return t||h||0;return!t&&-1}};t.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},function(t,r,i){"use strict";var o=i(102),a=Math.max,c=Math.min;t.exports=function(t,r){var i=o(t);return i<0?a(i+r,0):c(i,r)}},function(t,r,i){"use strict";var o=i(102),a=Math.min;t.exports=function(t){var r=o(t);return r>0?a(r,9007199254740991):0}},function(t,r,i){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,r,i){"use strict";var o={};o[i(10)("toStringTag")]="z",t.exports="[object z]"===String(o)},function(t,r,i){"use strict";var o=i(13),a=i(225),c=i(32),u=i(33),l=i(38),d=i(101);r.f=o&&!a?Object.defineProperties:function defineProperties(t,r){u(t);for(var i,o=l(r),a=d(r),p=a.length,h=0;p>h;)c.f(t,i=a[h++],o[i]);return t}},function(t,r,i){"use strict";var o=i(32);t.exports=function(t,r,i){return o.f(t,r,i)}},function(t,r,i){"use strict";var o=i(373);t.exports=function(t,r){return new(o(t))(0===r?0:r)}},function(t,r,i){"use strict";t.exports=i(390)},function(t,r,i){"use strict";var o=TypeError;t.exports=function(t){if(t>9007199254740991)throw o("Maximum allowed index exceeded");return t}},function(t,r,i){"use strict";t.exports=function(){}},function(t,r,i){"use strict";t.exports=function(t,r){return{value:t,done:r}}},function(t,r,i){"use strict";t.exports=RangeError},function(t,r,i){"use strict";t.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},r=Symbol("test"),i=Object(r);if("string"==typeof r)return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;for(r in t[r]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==r)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var a=Object.getOwnPropertyDescriptor(t,r);if(42!==a.value||!0!==a.enumerable)return!1}return!0}},function(t,r,i){"use strict";var o=i(488);t.exports=Function.prototype.bind||o},function(t,r,i){"use strict";var o=i(138),a=function hasPropertyDescriptors(){return!!o};a.hasArrayLengthDefineBug=function hasArrayLengthDefineBug(){if(!o)return null;try{return 1!==o([],"length",{value:1}).length}catch(t){return!0}},t.exports=a},function(t,r,i){"use strict";var o=String.prototype.replace,a=/%20/g,c="RFC1738",u="RFC3986";t.exports={default:u,formatters:{RFC1738:function(t){return o.call(t,a,"+")},RFC3986:function(t){return String(t)}},RFC1738:c,RFC3986:u}},function(t,r,i){"use strict";t.exports=i(492)},function(t,r,i){"use strict";t.exports=i(496)},function(t,r,i){var o=i(257),a=i(259),c=i(264);t.exports=function _unsupportedIterableToArray(t,r){var i;if(t){if("string"==typeof t)return c(t,r);var u=o(i=Object.prototype.toString.call(t)).call(i,8,-1);return"Object"===u&&t.constructor&&(u=t.constructor.name),"Map"===u||"Set"===u?a(t):"Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?c(t,r):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(20),a=i(39),c=i(33),u=i(80),l=i(109),d=TypeError;t.exports=function(t,r){var i=arguments.length<2?l(t):r;if(a(i))return c(o(i,t));throw new d(u(t)+" is not iterable")}},function(t,r,i){var o=i(71)(i(44),"Map");t.exports=o},function(t,r,i){var o=i(287),a=i(649),c=i(291);t.exports=function keys(t){return c(t)?o(t):a(t)}},function(t,r){t.exports=function baseUnary(t){return function(r){return t(r)}}},function(t,r,i){(function(t){var o=i(282),a=r&&!r.nodeType&&r,c=a&&"object"==typeof t&&t&&!t.nodeType&&t,u=c&&c.exports===a&&o.process,l=function(){try{var t=c&&c.require&&c.require("util").types;return t||u&&u.binding&&u.binding("util")}catch(t){}}();t.exports=l}).call(this,i(136)(t))},function(t,r){var i=Object.prototype;t.exports=function isPrototype(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||i)}},function(t,r,i){var o=i(287),a=i(652),c=i(291);t.exports=function keysIn(t){return c(t)?o(t,!0):a(t)}},function(t,r,i){var o=i(657),a=i(292),c=Object.prototype.propertyIsEnumerable,u=Object.getOwnPropertySymbols,l=u?function(t){return null==t?[]:(t=Object(t),o(u(t),(function(r){return c.call(t,r)})))}:a;t.exports=l},function(t,r,i){var o=i(661),a=i(186),c=i(662),u=i(663),l=i(664),d=i(111),p=i(283),h=p(o),m=p(a),g=p(c),y=p(u),v=p(l),b=d;(o&&"[object DataView]"!=b(new o(new ArrayBuffer(1)))||a&&"[object Map]"!=b(new a)||c&&"[object Promise]"!=b(c.resolve())||u&&"[object Set]"!=b(new u)||l&&"[object WeakMap]"!=b(new l))&&(b=function(t){var r=d(t),i="[object Object]"==r?t.constructor:void 0,o=i?p(i):"";if(o)switch(o){case h:return"[object DataView]";case m:return"[object Map]";case g:return"[object Promise]";case y:return"[object Set]";case v:return"[object WeakMap]"}return r}),t.exports=b},function(t,r,i){var o=i(667);t.exports=function cloneArrayBuffer(t){var r=new t.constructor(t.byteLength);return new o(r).set(new o(t)),r}},function(t,r,i){"use strict";var o=i(48);t.exports=function(t,r,i){for(var a in r)i&&i.unsafe&&t[a]?t[a]=r[a]:o(t,a,r[a],i);return t}},function(t,r,i){"use strict";var o=i(1),a=i(9),c=i(103),u=i(18),l=i(21),d=i(32).f,p=i(129),h=i(230),m=i(682),g=i(127),y=i(297),v=!1,b=g("meta"),_=0,setMetadata=function(t){d(t,b,{value:{objectID:"O"+_++,weakData:{}}})},w=t.exports={enable:function(){w.enable=function(){},v=!0;var t=p.f,r=a([].splice),i={};i[b]=1,t(i).length&&(p.f=function(i){for(var o=t(i),a=0,c=o.length;a<c;a++)if(o[a]===b){r(o,a,1);break}return o},o({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:h.f}))},fastKey:function(t,r){if(!u(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!l(t,b)){if(!m(t))return"F";if(!r)return"E";setMetadata(t)}return t[b].objectID},getWeakData:function(t,r){if(!l(t,b)){if(!m(t))return!0;if(!r)return!1;setMetadata(t)}return t[b].weakData},onFreeze:function(t){return y&&v&&m(t)&&!l(t,b)&&setMetadata(t),t}};c[b]=!0},function(t,r,i){"use strict";var o=i(198),a=Object.prototype.toString,c=Object.prototype.hasOwnProperty,u=function forEachArray(t,r,i){for(var o=0,a=t.length;o<a;o++)c.call(t,o)&&(null==i?r(t[o],o,t):r.call(i,t[o],o,t))},l=function forEachString(t,r,i){for(var o=0,a=t.length;o<a;o++)null==i?r(t.charAt(o),o,t):r.call(i,t.charAt(o),o,t)},d=function forEachObject(t,r,i){for(var o in t)c.call(t,o)&&(null==i?r(t[o],o,t):r.call(i,t[o],o,t))};t.exports=function forEach(t,r,i){if(!o(r))throw new TypeError("iterator must be a function");var c;arguments.length>=3&&(c=i),"[object Array]"===a.call(t)?u(t,r,c):"string"==typeof t?l(t,r,c):d(t,r,c)}},function(t,r,i){"use strict";var o,a,c=Function.prototype.toString,u="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof u&&"function"==typeof Object.defineProperty)try{o=Object.defineProperty({},"length",{get:function(){throw a}}),a={},u((function(){throw 42}),null,o)}catch(t){t!==a&&(u=null)}else u=null;var l=/^\s*class\b/,d=function isES6ClassFunction(t){try{var r=c.call(t);return l.test(r)}catch(t){return!1}},p=function tryFunctionToStr(t){try{return!d(t)&&(c.call(t),!0)}catch(t){return!1}},h=Object.prototype.toString,m="function"==typeof Symbol&&!!Symbol.toStringTag,g=!(0 in[,]),y=function isDocumentDotAll(){return!1};if("object"==typeof document){var v=document.all;h.call(v)===h.call(document.all)&&(y=function isDocumentDotAll(t){if((g||!t)&&(void 0===t||"object"==typeof t))try{var r=h.call(t);return("[object HTMLAllCollection]"===r||"[object HTML document.all class]"===r||"[object HTMLCollection]"===r||"[object Object]"===r)&&null==t("")}catch(t){}return!1})}t.exports=u?function isCallable(t){if(y(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{u(t,null,o)}catch(t){if(t!==a)return!1}return!d(t)&&p(t)}:function isCallable(t){if(y(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(m)return p(t);if(d(t))return!1;var r=h.call(t);return!("[object Function]"!==r&&"[object GeneratorFunction]"!==r&&!/^\[object HTML/.test(r))&&p(t)}},function(t,r,i){"use strict";var o=i(178);t.exports=function hasToStringTagShams(){return o()&&!!Symbol.toStringTag}},function(t,r,i){"use strict";var o=Array.prototype.slice,a=i(299),c=Object.keys,u=c?function keys(t){return c(t)}:i(696),l=Object.keys;u.shim=function shimObjectKeys(){Object.keys?function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2)||(Object.keys=function keys(t){return a(t)?l(o.call(t)):l(t)}):Object.keys=u;return Object.keys||u},t.exports=u},function(t,r,i){"use strict";t.exports=i(303)},function(t,r,i){"use strict";var o=Math.floor;t.exports=function floor(t){return"bigint"==typeof t?t:o(t)}},function(t,r,i){"use strict";var o=i(41),a=i(3),c=i(150),u=i(113),l=i(151);t.exports=function TypedArrayElementSize(t){var r=u(t);if(!1===r)throw new a("Assertion failed: `O` must be a TypedArray");var i=l.size["$"+l.name["$"+r]];if(!c(i)||i<0)throw new o("Assertion failed: Unknown TypedArray type `"+r+"`");return i}},function(t,r,i){"use strict";var o=i(3),a=i(69),c={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};t.exports=function isPropertyDescriptor(t){if(!t||"object"!=typeof t)return!1;for(var r in t)if(a(t,r)&&!c[r])return!1;var i=a(t,"[[Value]]")||a(t,"[[Writable]]"),u=a(t,"[[Get]]")||a(t,"[[Set]]");if(i&&u)throw new o("Property Descriptors may not be both accessor and data descriptors");return!0}},function(t,r,i){"use strict";var o=i(3),a=i(91),c=i(203),u=i(317),l=i(116),d=i(206),p=i(318);t.exports=function IsTypedArrayOutOfBounds(t){if(!u(t))throw new o("Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record");var r=t["[[Object]]"],i=t["[[CachedBufferByteLength]]"];if(a(l(r))&&"DETACHED"!==i)throw new o("Assertion failed: typed array is detached only if the byte length is ~DETACHED~");if("DETACHED"===i)return!0;var h,m=d(r),g=p(r);"AUTO"===g?h=i:h=m+g*c(r);return m>i||h>i}},function(t,r,i){"use strict";(function(r){var o=i(197),a=i(59),c=i(114)(),u={},l=i(137)(),d=i(85),p=Object.defineProperty;if(d){var getByteOffset=function(t){return t.byteOffset};o(c,(function(t){if("function"==typeof r[t]||"object"==typeof r[t]){var i=r[t].prototype,o=d(i,"byteOffset");if(!o&&l){var c=i.__proto__;o=d(c,"byteOffset")}if(o&&o.get)u[t]=a(o.get);else if(p){var h=new r[t](2);(o=d(h,"byteOffset"))&&o.configurable&&p(h,"length",{value:3}),2===h.length&&(u[t]=getByteOffset)}}}))}var h=i(93);t.exports=function typedArrayByteOffset(t){return!!h(t)&&function tryAllTypedArrays(t){var r;return o(u,(function(i){if("number"!=typeof r)try{var o=i(t);"number"==typeof o&&(r=o)}catch(t){}})),r}(t)}}).call(this,i(17))},function(t,r,i){var o=i(111),a=i(88);t.exports=function isSymbol(t){return"symbol"==typeof t||a(t)&&"[object Symbol]"==o(t)}},function(t,r,i){(function(r){var o=i(45),a=i(209).inherits,c=i(782),u=i(808),l=i(338),d=i(811),p=i(153),h=i(812),m=i(814),g=i(215);function makeTwoDigits(t){return t>9?t:"0"+t}function signUrl(t,r,i,o,a,c,d,h,m,g,y,v,b,_){var w=t+"\n"+o+"\n"+a+"\n"+("host:"+i.toLowerCase()+"\n")+"\nhost\n"+l(g,{asBytes:!0});!0===b&&console.log("canonical request: "+w+"\n");var S=l(w,{asBytes:!0});!0===b&&console.log("hashed canonical request: "+S+"\n");var I="AWS4-HMAC-SHA256\n"+v+"\n"+y+"/"+h+"/"+m+"/aws4_request\n"+S;!0===b&&console.log("string to sign: "+I+"\n");var k=function getSignatureKey(t,r,i,o){var a=u(r,"AWS4"+t,{asBytes:!0}),c=u(i,a,{asBytes:!0}),l=u(o,c,{asBytes:!0});return u("aws4_request",l,{asBytes:!0})}(d,y,h,m);!0===b&&console.log("signing key: "+k+"\n");var x=u(I,k,{asBytes:!0});!0===b&&console.log("signature: "+x+"\n");var P=a+"&X-Amz-Signature="+x;p(_)||(P+="&X-Amz-Security-Token="+encodeURIComponent(_));var C=r+i+o+"?"+P;return!0===b&&console.log("url: "+C+"\n"),C}function prepareWebSocketUrl(t,r,i,o){var a=function getDateTimeString(){var t=new Date;return t.getUTCFullYear()+""+makeTwoDigits(t.getUTCMonth()+1)+makeTwoDigits(t.getUTCDate())+"T"+makeTwoDigits(t.getUTCHours())+makeTwoDigits(t.getUTCMinutes())+makeTwoDigits(t.getUTCSeconds())+"Z"}(),c=function getDateString(t){return t.substring(0,t.indexOf("T"))}(a),u="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+r+"%2F"+c+"%2F"+t.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+a+"&X-Amz-SignedHeaders=host",l=t.host;return p(t.port)||443===t.port||(l=t.host+":"+t.port),signUrl("GET","wss://",l,"/mqtt",u,0,i,t.region,"iotdevicegateway","",c,a,t.debug,o)}function prepareWebSocketCustomAuthUrl(t){var r=t.host;return p(t.port)||443===t.port||(r=t.host+":"+t.port),"wss://"+r+"/mqtt"+(t.customAuthQueryString||"")}function getCredentials(t){var r={},i={};return function arrayEach(t,r){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&r.call(this,t[i],parseInt(i,10))}(t.split(/\r?\n/),(function(t){var o=(t=t.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);if(o)i=o[1];else if(i){var a=t.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);a&&(r[i]=r[i]||{},r[i][a[1]]=a[2])}})),r}function DeviceClient(t){if(!(this instanceof DeviceClient))return new DeviceClient(t);var o=this,a=[],u=!0,l=0,y="oldest";a.length=0;var v=[];v.length=0;var b=[],_=!0;b.length=0;var w=[];w.length=0;var S,I,k,x,P="inactive",C=null,A=250,O=1e3,R=2e4,M=128e3,j=null,L="?SDK=JavaScript&Version="+i(815).version;if(p(t)||0===Object.keys(t).length)throw new Error(d.INVALID_CONNECT_OPTIONS);if(p(t.keepalive)&&(t.keepalive=300),(p(t.enableMetrics)||!0===t.enableMetrics)&&(p(t.username)?t.username=L:t.username+=L),p(t.baseReconnectTimeMs)||(O=t.baseReconnectTimeMs),p(t.minimumConnectionTimeMs)||(R=t.minimumConnectionTimeMs),p(t.maximumReconnectTimeMs)||(M=t.maximumReconnectTimeMs),p(t.drainTimeMs)||(A=t.drainTimeMs),p(t.autoResubscribe)||(_=t.autoResubscribe),p(t.offlineQueueing)||(u=t.offlineQueueing),p(t.offlineQueueMaxSize)||(l=t.offlineQueueMaxSize),p(t.offlineQueueDropBehavior)||(y=t.offlineQueueDropBehavior),S=O,t.reconnectPeriod=S,t.fastDisconnectDetection=!0,t.resubscribe=!1,t.baseReconnectTimeMs<=0)throw new Error(d.INVALID_RECONNECT_TIMING);if(M<O)throw new Error(d.INVALID_RECONNECT_TIMING);if(R<O)throw new Error(d.INVALID_RECONNECT_TIMING);if("newest"!==y&&"oldest"!==y)throw new Error(d.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(l<0)throw new Error(d.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(p(t.protocol)&&(t.protocol="mqtts"),p(t.host))throw new Error(d.INVALID_CONNECT_OPTIONS);if(p(t.servername)&&(t.servername=t.host.split(":")[0]),"mqtts"===t.protocol)p(t.port)&&(t.port=8883),h(t);else if("wss"===t.protocol||"wss-custom-auth"===t.protocol){if("wss"===t.protocol){if(I=p(t.accessKeyId)?r.env.AWS_ACCESS_KEY_ID:t.accessKeyId,k=p(t.secretKey)?r.env.AWS_SECRET_ACCESS_KEY:t.secretKey,x=p(t.sessionToken)?r.env.AWS_SESSION_TOKEN:t.sessionToken,p(I)||p(k)){var D,B=t.profile||r.env.AWS_PROFILE||"default";try{D=p(t.filename)?function _loadDefaultFilename(){var t=r.env.HOME||r.env.USERPROFILE||(r.env.HOMEPATH?(r.env.HOMEDRIVE||"C:/")+r.env.HOMEPATH:null);return m.join(t,".aws","credentials")}():t.filename;var N=getCredentials(g.readFileSync(D,"utf-8"))[B];I=N.aws_access_key_id,k=N.aws_secret_access_key,x=N.aws_session_token}catch(t){console.log(t),console.log("Failed to read credentials for AWS_PROFILE "+B+" from "+D)}}if(p(I)||p(k))throw console.log("To connect via WebSocket/SigV4, AWS Access Key ID and AWS Secret Key must be passed either in options or as environment variables; see README.md"),new Error(d.INVALID_CONNECT_OPTIONS)}else if(p(t.customAuthHeaders)&&p(t.customAuthQueryString))throw console.log("To authenticate with a custom authorizer, you must provide the required HTTP headers or queryString; see README.md"),new Error(d.INVALID_CONNECT_OPTIONS);if(!p(t.host)&&p(t.region)){var U=/[a-zA-Z0-9]+\.iot\.([^\.]+)\.amazonaws\..+/.exec(t.host);if(null===U)throw console.log("Host endpoint is not valid"),new Error(d.INVALID_CONNECT_OPTIONS);t.region=U[1]}p(t.port)&&(t.port=443),p(t.websocketOptions)?t.websocketOptions={protocol:"mqttv3.1"}:t.websocketOptions.protocol="mqttv3.1","wss-custom-auth"===t.protocol&&(t.websocketOptions.headers=t.customAuthHeaders)}p(t)||!0!==t.debug||(console.log(t),console.log("attempting new mqtt connection..."));var q={};function _addToSubscriptionCache(t,r){0===b.filter((function(r){return r.topic===t})).length&&b.push({topic:t,options:r})}function _deleteFromSubscriptionCache(t,r){var i=b.filter((function(r){return r.topic!==t}));b=i}function _updateSubscriptionCache(t,r,i){var o=null;!1!==_&&("subscribe"===t?o=_addToSubscriptionCache:"unsubscribe"===t&&(o=_deleteFromSubscriptionCache),"[object Array]"===Object.prototype.toString.call(r)?r.forEach((function(t,r,a){o(t,i)})):o(r,i))}function _filling(){return"inactive"===P}q.mqtts=i(816),q.wss=i(817);var W=new c.MqttClient((function _wrapper(r){var i,o=t.protocol;return"wss"===o?(i=""===I||""===k?"wss://no-credentials-available":prepareWebSocketUrl(t,I,k,x),!0===t.debug&&console.log("using websockets, will connect to '"+i+"'..."),t.url=i):"wss-custom-auth"===o&&(t.url=prepareWebSocketCustomAuthUrl(t),!0===t.debug&&console.log("using websockets custom auth, will connect to '"+t.url+"'..."),o="wss"),q[o](r,t)}),t);function _markConnectionStable(){S=O,W.options.reconnectPeriod=S,j=null,P="stable"}function _drainOperationQueue(){var t=w.shift();if(p(t)){var r=v.shift();if(p(r)){var i=a.shift();p(i)||W.publish(i.topic,i.message,i.options,i.callback),0===a.length&&(clearInterval(C),C=null)}else _updateSubscriptionCache(r.type,r.topics,r.options),"subscribe"===r.type?p(r.callback)?W.subscribe(r.topics,r.options):W.subscribe(r.topics,r.options,r.callback):"unsubscribe"===r.type&&W.unsubscribe(r.topics,r.callback)}else p(t.callback)?W.subscribe(t.topic,t.options):W.subscribe(t.topic,t.options,t.callback)}W.on("connect",(function(t){null===j&&(j=setTimeout(_markConnectionStable,R)),P="established",null===C&&(w=b.slice(0),C=setInterval(_drainOperationQueue,A)),o.emit("connect",t)})),W.on("close",(function(r){p(r)||o.emit("error",r),p(t)||!0!==t.debug||console.log("connection lost - will attempt reconnection in "+W.options.reconnectPeriod/1e3+" seconds..."),clearTimeout(j),j=null,clearInterval(C),C=null,P="inactive",o.emit("close")})),W.on("reconnect",(function(){S*=2,S=Math.min(M,S),W.options.reconnectPeriod=S,o.emit("reconnect")})),W.on("end",(function(){o.emit("end")})),W.on("offline",(function(){o.emit("offline")})),W.on("error",(function(t){o.emit("error",t)})),W.on("packetsend",(function(t){o.emit("packetsend",t)})),W.on("packetreceive",(function(t){o.emit("packetreceive",t)})),W.on("message",(function(t,r,i){o.emit("message",t,r,i)})),this.publish=function(t,r,i,o){!0!==u||!_filling()&&null===C?!0!==u&&_filling()||W.publish(t,r,i,o):function _trimOfflinePublishQueueIfNecessary(){var t=!0;return l>0&&a.length>=l&&("oldest"===y?a.shift():t=!1),t}()&&a.push({topic:t,message:r,options:i,callback:o})},this.subscribe=function(t,r,i){_filling()&&!1!==_?v.length<50?v.push({type:"subscribe",topics:t,options:r,callback:i}):o.emit("error",new Error("Maximum queued offline subscription reached")):(_updateSubscriptionCache("subscribe",t,r),p(i)?W.subscribe(t,r):W.subscribe(t,r,i))},this.unsubscribe=function(r,i){_filling()&&!1!==_?v.length<50&&v.push({type:"unsubscribe",topics:r,options:t,callback:i}):(_updateSubscriptionCache("unsubscribe",r),W.unsubscribe(r,i))},this.end=function(t,r){W.end(t,r)},this.handleMessage=W.handleMessage.bind(W),W.handleMessage=function(t,r){o.handleMessage(t,r)},this.updateWebSocketCredentials=function(t,r,i,o){I=t,k=r,x=i},this.getWebsocketHeaders=function(){return t.websocketOptions.headers},this.updateCustomAuthHeaders=function(r){t.websocketOptions.headers=r},this.simulateNetworkFailure=function(){W.stream.emit("error",new Error("simulated connection error")),W.stream.end()}}a(DeviceClient,o.EventEmitter),t.exports=DeviceClient,t.exports.DeviceClient=DeviceClient,t.exports.prepareWebSocketUrl=prepareWebSocketUrl,t.exports.prepareWebSocketCustomAuthUrl=prepareWebSocketCustomAuthUrl}).call(this,i(19))},function(t,r,i){(function(t){var o=Object.getOwnPropertyDescriptors||function getOwnPropertyDescriptors(t){for(var r=Object.keys(t),i={},o=0;o<r.length;o++)i[r[o]]=Object.getOwnPropertyDescriptor(t,r[o]);return i},a=/%[sdj%]/g;r.format=function(t){if(!isString(t)){for(var r=[],i=0;i<arguments.length;i++)r.push(inspect(arguments[i]));return r.join(" ")}i=1;for(var o=arguments,c=o.length,u=String(t).replace(a,(function(t){if("%%"===t)return"%";if(i>=c)return t;switch(t){case"%s":return String(o[i++]);case"%d":return Number(o[i++]);case"%j":try{return JSON.stringify(o[i++])}catch(t){return"[Circular]"}default:return t}})),l=o[i];i<c;l=o[++i])isNull(l)||!isObject(l)?u+=" "+l:u+=" "+inspect(l);return u},r.deprecate=function(i,o){if(void 0!==t&&!0===t.noDeprecation)return i;if(void 0===t)return function(){return r.deprecate(i,o).apply(this,arguments)};var a=!1;return function deprecated(){if(!a){if(t.throwDeprecation)throw new Error(o);t.traceDeprecation?console.trace(o):console.error(o),a=!0}return i.apply(this,arguments)}};var c,u={};function inspect(t,i){var o={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),isBoolean(i)?o.showHidden=i:i&&r._extend(o,i),isUndefined(o.showHidden)&&(o.showHidden=!1),isUndefined(o.depth)&&(o.depth=2),isUndefined(o.colors)&&(o.colors=!1),isUndefined(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=stylizeWithColor),formatValue(o,t,o.depth)}function stylizeWithColor(t,r){var i=inspect.styles[r];return i?"["+inspect.colors[i][0]+"m"+t+"["+inspect.colors[i][1]+"m":t}function stylizeNoColor(t,r){return t}function formatValue(t,i,o){if(t.customInspect&&i&&isFunction(i.inspect)&&i.inspect!==r.inspect&&(!i.constructor||i.constructor.prototype!==i)){var a=i.inspect(o,t);return isString(a)||(a=formatValue(t,a,o)),a}var c=function formatPrimitive(t,r){if(isUndefined(r))return t.stylize("undefined","undefined");if(isString(r)){var i="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(i,"string")}if(isNumber(r))return t.stylize(""+r,"number");if(isBoolean(r))return t.stylize(""+r,"boolean");if(isNull(r))return t.stylize("null","null")}(t,i);if(c)return c;var u=Object.keys(i),l=function arrayToHash(t){var r={};return t.forEach((function(t,i){r[t]=!0})),r}(u);if(t.showHidden&&(u=Object.getOwnPropertyNames(i)),isError(i)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return formatError(i);if(0===u.length){if(isFunction(i)){var d=i.name?": "+i.name:"";return t.stylize("[Function"+d+"]","special")}if(isRegExp(i))return t.stylize(RegExp.prototype.toString.call(i),"regexp");if(isDate(i))return t.stylize(Date.prototype.toString.call(i),"date");if(isError(i))return formatError(i)}var p,h="",m=!1,g=["{","}"];(isArray(i)&&(m=!0,g=["[","]"]),isFunction(i))&&(h=" [Function"+(i.name?": "+i.name:"")+"]");return isRegExp(i)&&(h=" "+RegExp.prototype.toString.call(i)),isDate(i)&&(h=" "+Date.prototype.toUTCString.call(i)),isError(i)&&(h=" "+formatError(i)),0!==u.length||m&&0!=i.length?o<0?isRegExp(i)?t.stylize(RegExp.prototype.toString.call(i),"regexp"):t.stylize("[Object]","special"):(t.seen.push(i),p=m?function formatArray(t,r,i,o,a){for(var c=[],u=0,l=r.length;u<l;++u)hasOwnProperty(r,String(u))?c.push(formatProperty(t,r,i,o,String(u),!0)):c.push("");return a.forEach((function(a){a.match(/^\d+$/)||c.push(formatProperty(t,r,i,o,a,!0))})),c}(t,i,o,l,u):u.map((function(r){return formatProperty(t,i,o,l,r,m)})),t.seen.pop(),function reduceToSingleString(t,r,i){if(t.reduce((function(t,r){return r.indexOf("\n")>=0&&0,t+r.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return i[0]+(""===r?"":r+"\n ")+" "+t.join(",\n ")+" "+i[1];return i[0]+r+" "+t.join(", ")+" "+i[1]}(p,h,g)):g[0]+h+g[1]}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatProperty(t,r,i,o,a,c){var u,l,d;if((d=Object.getOwnPropertyDescriptor(r,a)||{value:r[a]}).get?l=d.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):d.set&&(l=t.stylize("[Setter]","special")),hasOwnProperty(o,a)||(u="["+a+"]"),l||(t.seen.indexOf(d.value)<0?(l=isNull(i)?formatValue(t,d.value,null):formatValue(t,d.value,i-1)).indexOf("\n")>-1&&(l=c?l.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+l.split("\n").map((function(t){return" "+t})).join("\n")):l=t.stylize("[Circular]","special")),isUndefined(u)){if(c&&a.match(/^\d+$/))return l;(u=JSON.stringify(""+a)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+l}function isArray(t){return Array.isArray(t)}function isBoolean(t){return"boolean"==typeof t}function isNull(t){return null===t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function isUndefined(t){return void 0===t}function isRegExp(t){return isObject(t)&&"[object RegExp]"===objectToString(t)}function isObject(t){return"object"==typeof t&&null!==t}function isDate(t){return isObject(t)&&"[object Date]"===objectToString(t)}function isError(t){return isObject(t)&&("[object Error]"===objectToString(t)||t instanceof Error)}function isFunction(t){return"function"==typeof t}function objectToString(t){return Object.prototype.toString.call(t)}function pad(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(i){if(isUndefined(c)&&(c=t.env.NODE_DEBUG||""),i=i.toUpperCase(),!u[i])if(new RegExp("\\b"+i+"\\b","i").test(c)){var o=t.pid;u[i]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",i,o,t)}}else u[i]=function(){};return u[i]},r.inspect=inspect,inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=isArray,r.isBoolean=isBoolean,r.isNull=isNull,r.isNullOrUndefined=function isNullOrUndefined(t){return null==t},r.isNumber=isNumber,r.isString=isString,r.isSymbol=function isSymbol(t){return"symbol"==typeof t},r.isUndefined=isUndefined,r.isRegExp=isRegExp,r.isObject=isObject,r.isDate=isDate,r.isError=isError,r.isFunction=isFunction,r.isPrimitive=function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=i(780);var l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var t=new Date,r=[pad(t.getHours()),pad(t.getMinutes()),pad(t.getSeconds())].join(":");return[t.getDate(),l[t.getMonth()],r].join(" ")}function hasOwnProperty(t,r){return Object.prototype.hasOwnProperty.call(t,r)}r.log=function(){console.log("%s - %s",timestamp(),r.format.apply(r,arguments))},r.inherits=i(781),r._extend=function(t,r){if(!r||!isObject(r))return t;for(var i=Object.keys(r),o=i.length;o--;)t[i[o]]=r[i[o]];return t};var d="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function callbackifyOnRejected(t,r){if(!t){var i=new Error("Promise was rejected with a falsy value");i.reason=t,t=i}return r(t)}r.promisify=function promisify(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(d&&t[d]){var r;if("function"!=typeof(r=t[d]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,d,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var r,i,o=new Promise((function(t,o){r=t,i=o})),a=[],c=0;c<arguments.length;c++)a.push(arguments[c]);a.push((function(t,o){t?i(t):r(o)}));try{t.apply(this,a)}catch(t){i(t)}return o}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),d&&Object.defineProperty(r,d,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,o(t))},r.promisify.custom=d,r.callbackify=function callbackify(r){if("function"!=typeof r)throw new TypeError('The "original" argument must be of type Function');function callbackified(){for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);var a=i.pop();if("function"!=typeof a)throw new TypeError("The last argument must be of type Function");var c=this,cb=function(){return a.apply(c,arguments)};r.apply(this,i).then((function(r){t.nextTick(cb,null,r)}),(function(r){t.nextTick(callbackifyOnRejected,r,cb)}))}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(r)),Object.defineProperties(callbackified,o(r)),callbackified}}).call(this,i(19))},function(t,r){t.exports=function extend(){for(var t={},r=0;r<arguments.length;r++){var o=arguments[r];for(var a in o)i.call(o,a)&&(t[a]=o[a])}return t};var i=Object.prototype.hasOwnProperty},function(t,r,i){"use strict";var o=i(95).codes.ERR_STREAM_PREMATURE_CLOSE;function noop(){}t.exports=function eos(t,r,i){if("function"==typeof r)return eos(t,null,r);r||(r={}),i=function once(t){var r=!1;return function(){if(!r){r=!0;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];t.apply(this,o)}}}(i||noop);var a=r.readable||!1!==r.readable&&t.readable,c=r.writable||!1!==r.writable&&t.writable,u=function onlegacyfinish(){t.writable||d()},l=t._writableState&&t._writableState.finished,d=function onfinish(){c=!1,l=!0,a||i.call(t)},p=t._readableState&&t._readableState.endEmitted,h=function onend(){a=!1,p=!0,c||i.call(t)},m=function onerror(r){i.call(t,r)},g=function onclose(){var r;return a&&!p?(t._readableState&&t._readableState.ended||(r=new o),i.call(t,r)):c&&!l?(t._writableState&&t._writableState.ended||(r=new o),i.call(t,r)):void 0},y=function onrequest(){t.req.on("finish",d)};return!function isRequest(t){return t.setHeader&&"function"==typeof t.abort}(t)?c&&!t._writableState&&(t.on("end",u),t.on("close",u)):(t.on("complete",d),t.on("abort",g),t.req?y():t.on("request",y)),t.on("end",h),t.on("finish",d),!1!==r.error&&t.on("error",m),t.on("close",g),function(){t.removeListener("complete",d),t.removeListener("abort",g),t.removeListener("request",y),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",h),t.removeListener("error",m),t.removeListener("close",g)}}},function(t,r,i){"use strict";var o=i(804),a=i(75)("mqttjs:tls");t.exports=function buildBuilder(t,r){var i;function handleTLSerrors(o){r.rejectUnauthorized&&t.emit("error",o),i.end()}return r.port=r.port||8883,r.host=r.hostname||r.host||"localhost",r.servername=r.host,r.rejectUnauthorized=!1!==r.rejectUnauthorized,delete r.path,a("port %d host %s rejectUnauthorized %b",r.port,r.host,r.rejectUnauthorized),(i=o.connect(r)).on("secureConnect",(function(){r.rejectUnauthorized&&!i.authorized?i.emit("error",new Error("TLS not authorized")):i.removeListener("error",handleTLSerrors)})),i.on("error",handleTLSerrors),i}},function(t,r,i){(function(r,o){var a=i(74),c=i(334),u=i(30),l=i(335),d=r.from&&r.from!==Uint8Array.from?r.from([0]):new r([0]),onuncork=function(t,r){t._corked?t.once("uncork",r):r()},destroyer=function(t,r){return function(i){i?function(t,r){t._autoDestroy&&t.destroy(r)}(t,"premature close"===i.message?null:i):r&&!t._ended&&t.end()}},noop=function(){},Duplexify=function(t,r,i){if(!(this instanceof Duplexify))return new Duplexify(t,r,i);a.Duplex.call(this,i),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!i||!1!==i.autoDestroy,this._forwardDestroy=!i||!1!==i.destroy,this._forwardEnd=!i||!1!==i.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),r&&this.setReadable(r)};u(Duplexify,a.Duplex),Duplexify.obj=function(t,r,i){return i||(i={}),i.objectMode=!0,i.highWaterMark=16,new Duplexify(t,r,i)},Duplexify.prototype.cork=function(){1==++this._corked&&this.emit("cork")},Duplexify.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},Duplexify.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var r=this,i=c(t,{writable:!0,readable:!1},destroyer(this,this._forwardEnd)),ondrain=function(){var t=r._ondrain;r._ondrain=null,t&&t()};this._unwrite&&o.nextTick(ondrain),this._writable=t,this._writable.on("drain",ondrain),this._unwrite=function(){r._writable.removeListener("drain",ondrain),i()},this.uncork()}else this.end()},Duplexify.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var r,i=this,o=c(t,{writable:!1,readable:!0},destroyer(this)),onreadable=function(){i._forward()},onend=function(){i.push(null)};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:(r=t,new a.Readable({objectMode:!0,highWaterMark:16}).wrap(r)),this._readable2.on("readable",onreadable),this._readable2.on("end",onend),this._unread=function(){i._readable2.removeListener("readable",onreadable),i._readable2.removeListener("end",onend),o()},this._forward()}},Duplexify.prototype._read=function(){this._drained=!0,this._forward()},Duplexify.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=l(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},Duplexify.prototype.destroy=function(t,r){if(r||(r=noop),this.destroyed)return r(null);this.destroyed=!0;var i=this;o.nextTick((function(){i._destroy(t),r(null)}))},Duplexify.prototype._destroy=function(t){if(t){var r=this._ondrain;this._ondrain=null,r?r(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},Duplexify.prototype._write=function(t,r,i){if(!this.destroyed)return this._corked?onuncork(this,this._write.bind(this,t,r,i)):t===d?this._finish(i):this._writable?void(!1===this._writable.write(t)?this._ondrain=i:this.destroyed||i()):i()},Duplexify.prototype._finish=function(t){var r=this;this.emit("preend"),onuncork(this,(function(){var i,o;i=r._forwardEnd&&r._writable,o=function(){!1===r._writableState.prefinished&&(r._writableState.prefinished=!0),r.emit("prefinish"),onuncork(r,t)},i?i._writableState&&i._writableState.finished?o():i._writableState?i.end(o):(i.end(),o()):o()}))},Duplexify.prototype.end=function(t,r,i){return"function"==typeof t?this.end(null,null,t):"function"==typeof r?this.end(t,null,r):(this._ended=!0,t&&this.write(t),this._writableState.ending||this._writableState.destroyed||this.write(d),a.Writable.prototype.end.call(this,i))},t.exports=Duplexify}).call(this,i(16).Buffer,i(19))},function(t,r,i){(function(r){var o;t.exports=(o=o||function(t,o){var a;if("undefined"!=typeof window&&window.crypto&&(a=window.crypto),"undefined"!=typeof self&&self.crypto&&(a=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(a=globalThis.crypto),!a&&"undefined"!=typeof window&&window.msCrypto&&(a=window.msCrypto),!a&&void 0!==r&&r.crypto&&(a=r.crypto),!a)try{a=i(809)}catch(t){}var cryptoSecureRandomInt=function(){if(a){if("function"==typeof a.getRandomValues)try{return a.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof a.randomBytes)try{return a.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function F(){}return function(t){var r;return F.prototype=t,r=new F,F.prototype=null,r}}(),u={},l=u.lib={},d=l.Base={extend:function(t){var r=c(this);return t&&r.mixIn(t),r.hasOwnProperty("init")&&this.init!==r.init||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},p=l.WordArray=d.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=null!=r?r:4*t.length},toString:function(t){return(t||m).stringify(this)},concat:function(t){var r=this.words,i=t.words,o=this.sigBytes,a=t.sigBytes;if(this.clamp(),o%4)for(var c=0;c<a;c++){var u=i[c>>>2]>>>24-c%4*8&255;r[o+c>>>2]|=u<<24-(o+c)%4*8}else for(var l=0;l<a;l+=4)r[o+l>>>2]=i[l>>>2];return this.sigBytes+=a,this},clamp:function(){var r=this.words,i=this.sigBytes;r[i>>>2]&=4294967295<<32-i%4*8,r.length=t.ceil(i/4)},clone:function(){var t=d.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var r=[],i=0;i<t;i+=4)r.push(cryptoSecureRandomInt());return new p.init(r,t)}}),h=u.enc={},m=h.Hex={stringify:function(t){for(var r=t.words,i=t.sigBytes,o=[],a=0;a<i;a++){var c=r[a>>>2]>>>24-a%4*8&255;o.push((c>>>4).toString(16)),o.push((15&c).toString(16))}return o.join("")},parse:function(t){for(var r=t.length,i=[],o=0;o<r;o+=2)i[o>>>3]|=parseInt(t.substr(o,2),16)<<24-o%8*4;return new p.init(i,r/2)}},g=h.Latin1={stringify:function(t){for(var r=t.words,i=t.sigBytes,o=[],a=0;a<i;a++){var c=r[a>>>2]>>>24-a%4*8&255;o.push(String.fromCharCode(c))}return o.join("")},parse:function(t){for(var r=t.length,i=[],o=0;o<r;o++)i[o>>>2]|=(255&t.charCodeAt(o))<<24-o%4*8;return new p.init(i,r)}},y=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(g.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return g.parse(unescape(encodeURIComponent(t)))}},v=l.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new p.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=y.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(r){var i,o=this._data,a=o.words,c=o.sigBytes,u=this.blockSize,l=c/(4*u),d=(l=r?t.ceil(l):t.max((0|l)-this._minBufferSize,0))*u,h=t.min(4*d,c);if(d){for(var m=0;m<d;m+=u)this._doProcessBlock(a,m);i=a.splice(0,d),o.sigBytes-=h}return new p.init(i,h)},clone:function(){var t=d.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),b=(l.Hasher=v.extend({cfg:d.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(r,i){return new t.init(i).finalize(r)}},_createHmacHelper:function(t){return function(r,i){return new b.HMAC.init(t,i).finalize(r)}}}),u.algo={});return u}(Math),o)}).call(this,i(17))},function(t,r){},function(t,r,i){var o=i(133),a=i(241);t.exports=function _defineProperty(t,r,i){return(r=a(r))in t?o(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){t.exports=i(577)},function(t,r,i){t.exports=i(686)},function(t,r,i){"use strict";var o={};i.r(o),i.d(o,"JsonPatchError",(function(){return wt})),i.d(o,"deepClone",(function(){return St})),i.d(o,"getValueByPointer",(function(){return getValueByPointer})),i.d(o,"applyOperation",(function(){return applyOperation})),i.d(o,"applyPatch",(function(){return applyPatch})),i.d(o,"applyReducer",(function(){return applyReducer})),i.d(o,"validator",(function(){return validator})),i.d(o,"validate",(function(){return validate})),i.d(o,"_areEquals",(function(){return _areEquals}));var a={};i.r(a),i.d(a,"unobserve",(function(){return unobserve})),i.d(a,"observe",(function(){return observe})),i.d(a,"generate",(function(){return generate})),i.d(a,"compare",(function(){return compare}));var c={};i.r(c),i.d(c,"path",(function(){return parameter_builders_path})),i.d(c,"query",(function(){return parameter_builders_query})),i.d(c,"header",(function(){return parameter_builders_header})),i.d(c,"cookie",(function(){return parameter_builders_cookie}));var u=i(4),l=i.n(u),d=i(22),p=i.n(d),h=i(119),m=i.n(h),g=i(34),y=i.n(g),v=i(46),b=i.n(v),_=i(7),w=i.n(_),S=i(27),I=i.n(S),k=i(98),x=i.n(k),P=i(31),C=i.n(P),A=i(52),O=i.n(A),R=i(217),M=i.n(R),j=i(155),L=i.n(j),D=i(76),B=i.n(D),N=i(5),U=i.n(N),q=i(2),W=i.n(q),z=i(0),V=i.n(z),H=i(156),$=i.n(H),K=i(26),G=i.n(K),J=(i(279),i(120)),Y=i.n(J);function isNothing(t){return null==t}var Q={isNothing:isNothing,isObject:function isObject(t){return"object"==typeof t&&null!==t},toArray:function toArray(t){return Array.isArray(t)?t:isNothing(t)?[]:[t]},repeat:function repeat(t,r){var i,o="";for(i=0;i<r;i+=1)o+=t;return o},isNegativeZero:function isNegativeZero(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t},extend:function extend(t,r){var i,o,a,c;if(r)for(i=0,o=(c=Object.keys(r)).length;i<o;i+=1)t[a=c[i]]=r[a];return t}};function formatError(t,r){var i="",o=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(i+='in "'+t.mark.name+'" '),i+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!r&&t.mark.snippet&&(i+="\n\n"+t.mark.snippet),o+" "+i):o}function YAMLException$1(t,r){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=r,this.message=formatError(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}YAMLException$1.prototype=Object.create(Error.prototype),YAMLException$1.prototype.constructor=YAMLException$1,YAMLException$1.prototype.toString=function toString(t){return this.name+": "+formatError(this,t)};var X=YAMLException$1;function getLine(t,r,i,o,a){var c="",u="",l=Math.floor(a/2)-1;return o-r>l&&(r=o-l+(c=" ... ").length),i-o>l&&(i=o+l-(u=" ...").length),{str:c+t.slice(r,i).replace(/\t/g,"→")+u,pos:o-r+c.length}}function padStart(t,r){return Q.repeat(" ",r-t.length)+t}var Z=function makeSnippet(t,r){if(r=Object.create(r||null),!t.buffer)return null;r.maxLength||(r.maxLength=79),"number"!=typeof r.indent&&(r.indent=1),"number"!=typeof r.linesBefore&&(r.linesBefore=3),"number"!=typeof r.linesAfter&&(r.linesAfter=2);for(var i,o=/\r?\n|\r|\0/g,a=[0],c=[],u=-1;i=o.exec(t.buffer);)c.push(i.index),a.push(i.index+i[0].length),t.position<=i.index&&u<0&&(u=a.length-2);u<0&&(u=a.length-1);var l,d,p="",h=Math.min(t.line+r.linesAfter,c.length).toString().length,m=r.maxLength-(r.indent+h+3);for(l=1;l<=r.linesBefore&&!(u-l<0);l++)d=getLine(t.buffer,a[u-l],c[u-l],t.position-(a[u]-a[u-l]),m),p=Q.repeat(" ",r.indent)+padStart((t.line-l+1).toString(),h)+" | "+d.str+"\n"+p;for(d=getLine(t.buffer,a[u],c[u],t.position,m),p+=Q.repeat(" ",r.indent)+padStart((t.line+1).toString(),h)+" | "+d.str+"\n",p+=Q.repeat("-",r.indent+h+3+d.pos)+"^\n",l=1;l<=r.linesAfter&&!(u+l>=c.length);l++)d=getLine(t.buffer,a[u+l],c[u+l],t.position-(a[u]-a[u+l]),m),p+=Q.repeat(" ",r.indent)+padStart((t.line+l+1).toString(),h)+" | "+d.str+"\n";return p.replace(/\n$/,"")},ee=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],te=["scalar","sequence","mapping"];var re=function Type$1(t,r){if(r=r||{},Object.keys(r).forEach((function(r){if(-1===ee.indexOf(r))throw new X('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')})),this.options=r,this.tag=t,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(t){return t},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=function compileStyleAliases(t){var r={};return null!==t&&Object.keys(t).forEach((function(i){t[i].forEach((function(t){r[String(t)]=i}))})),r}(r.styleAliases||null),-1===te.indexOf(this.kind))throw new X('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function compileList(t,r){var i=[];return t[r].forEach((function(t){var r=i.length;i.forEach((function(i,o){i.tag===t.tag&&i.kind===t.kind&&i.multi===t.multi&&(r=o)})),i[r]=t})),i}function Schema$1(t){return this.extend(t)}Schema$1.prototype.extend=function extend(t){var r=[],i=[];if(t instanceof re)i.push(t);else if(Array.isArray(t))i=i.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new X("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit))}r.forEach((function(t){if(!(t instanceof re))throw new X("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new X("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new X("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),i.forEach((function(t){if(!(t instanceof re))throw new X("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var o=Object.create(Schema$1.prototype);return o.implicit=(this.implicit||[]).concat(r),o.explicit=(this.explicit||[]).concat(i),o.compiledImplicit=compileList(o,"implicit"),o.compiledExplicit=compileList(o,"explicit"),o.compiledTypeMap=function compileMap(){var t,r,i={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function collectType(t){t.multi?(i.multi[t.kind].push(t),i.multi.fallback.push(t)):i[t.kind][t.tag]=i.fallback[t.tag]=t}for(t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(collectType);return i}(o.compiledImplicit,o.compiledExplicit),o};var ne=Schema$1,ie=new re("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}}),oe=new re("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}}),se=new re("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}}),ae=new ne({explicit:[ie,oe,se]});var ce=new re("tag:yaml.org,2002:null",{kind:"scalar",resolve:function resolveYamlNull(t){if(null===t)return!0;var r=t.length;return 1===r&&"~"===t||4===r&&("null"===t||"Null"===t||"NULL"===t)},construct:function constructYamlNull(){return null},predicate:function isNull(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var ue=new re("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function resolveYamlBoolean(t){if(null===t)return!1;var r=t.length;return 4===r&&("true"===t||"True"===t||"TRUE"===t)||5===r&&("false"===t||"False"===t||"FALSE"===t)},construct:function constructYamlBoolean(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function isBoolean(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function isOctCode(t){return 48<=t&&t<=55}function isDecCode(t){return 48<=t&&t<=57}var le=new re("tag:yaml.org,2002:int",{kind:"scalar",resolve:function resolveYamlInteger(t){if(null===t)return!1;var r,i,o=t.length,a=0,c=!1;if(!o)return!1;if("-"!==(r=t[a])&&"+"!==r||(r=t[++a]),"0"===r){if(a+1===o)return!0;if("b"===(r=t[++a])){for(a++;a<o;a++)if("_"!==(r=t[a])){if("0"!==r&&"1"!==r)return!1;c=!0}return c&&"_"!==r}if("x"===r){for(a++;a<o;a++)if("_"!==(r=t[a])){if(!(48<=(i=t.charCodeAt(a))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;c=!0}return c&&"_"!==r}if("o"===r){for(a++;a<o;a++)if("_"!==(r=t[a])){if(!isOctCode(t.charCodeAt(a)))return!1;c=!0}return c&&"_"!==r}}if("_"===r)return!1;for(;a<o;a++)if("_"!==(r=t[a])){if(!isDecCode(t.charCodeAt(a)))return!1;c=!0}return!(!c||"_"===r)},construct:function constructYamlInteger(t){var r,i=t,o=1;if(-1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),"-"!==(r=i[0])&&"+"!==r||("-"===r&&(o=-1),r=(i=i.slice(1))[0]),"0"===i)return 0;if("0"===r){if("b"===i[1])return o*parseInt(i.slice(2),2);if("x"===i[1])return o*parseInt(i.slice(2),16);if("o"===i[1])return o*parseInt(i.slice(2),8)}return o*parseInt(i,10)},predicate:function isInteger(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!Q.isNegativeZero(t)},represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),fe=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var de=/^[-+]?[0-9]+e/;var pe=new re("tag:yaml.org,2002:float",{kind:"scalar",resolve:function resolveYamlFloat(t){return null!==t&&!(!fe.test(t)||"_"===t[t.length-1])},construct:function constructYamlFloat(t){var r,i;return i="-"===(r=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(r[0])>=0&&(r=r.slice(1)),".inf"===r?1===i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===r?NaN:i*parseFloat(r,10)},predicate:function isFloat(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||Q.isNegativeZero(t))},represent:function representYamlFloat(t,r){var i;if(isNaN(t))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Q.isNegativeZero(t))return"-0.0";return i=t.toString(10),de.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"}),he=ae.extend({implicit:[ce,ue,le,pe]}),me=he,ge=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ye=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var ve=new re("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function resolveYamlTimestamp(t){return null!==t&&(null!==ge.exec(t)||null!==ye.exec(t))},construct:function constructYamlTimestamp(t){var r,i,o,a,c,u,l,d,p=0,h=null;if(null===(r=ge.exec(t))&&(r=ye.exec(t)),null===r)throw new Error("Date resolve error");if(i=+r[1],o=+r[2]-1,a=+r[3],!r[4])return new Date(Date.UTC(i,o,a));if(c=+r[4],u=+r[5],l=+r[6],r[7]){for(p=r[7].slice(0,3);p.length<3;)p+="0";p=+p}return r[9]&&(h=6e4*(60*+r[10]+ +(r[11]||0)),"-"===r[9]&&(h=-h)),d=new Date(Date.UTC(i,o,a,c,u,l,p)),h&&d.setTime(d.getTime()-h),d},instanceOf:Date,represent:function representYamlTimestamp(t){return t.toISOString()}});var be=new re("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function resolveYamlMerge(t){return"<<"===t||null===t}}),_e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var we=new re("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function resolveYamlBinary(t){if(null===t)return!1;var r,i,o=0,a=t.length,c=_e;for(i=0;i<a;i++)if(!((r=c.indexOf(t.charAt(i)))>64)){if(r<0)return!1;o+=6}return o%8==0},construct:function constructYamlBinary(t){var r,i,o=t.replace(/[\r\n=]/g,""),a=o.length,c=_e,u=0,l=[];for(r=0;r<a;r++)r%4==0&&r&&(l.push(u>>16&255),l.push(u>>8&255),l.push(255&u)),u=u<<6|c.indexOf(o.charAt(r));return 0===(i=a%4*6)?(l.push(u>>16&255),l.push(u>>8&255),l.push(255&u)):18===i?(l.push(u>>10&255),l.push(u>>2&255)):12===i&&l.push(u>>4&255),new Uint8Array(l)},predicate:function isBinary(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function representYamlBinary(t){var r,i,o="",a=0,c=t.length,u=_e;for(r=0;r<c;r++)r%3==0&&r&&(o+=u[a>>18&63],o+=u[a>>12&63],o+=u[a>>6&63],o+=u[63&a]),a=(a<<8)+t[r];return 0===(i=c%3)?(o+=u[a>>18&63],o+=u[a>>12&63],o+=u[a>>6&63],o+=u[63&a]):2===i?(o+=u[a>>10&63],o+=u[a>>4&63],o+=u[a<<2&63],o+=u[64]):1===i&&(o+=u[a>>2&63],o+=u[a<<4&63],o+=u[64],o+=u[64]),o}}),Se=Object.prototype.hasOwnProperty,Te=Object.prototype.toString;var Ie=new re("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function resolveYamlOmap(t){if(null===t)return!0;var r,i,o,a,c,u=[],l=t;for(r=0,i=l.length;r<i;r+=1){if(o=l[r],c=!1,"[object Object]"!==Te.call(o))return!1;for(a in o)if(Se.call(o,a)){if(c)return!1;c=!0}if(!c)return!1;if(-1!==u.indexOf(a))return!1;u.push(a)}return!0},construct:function constructYamlOmap(t){return null!==t?t:[]}}),ke=Object.prototype.toString;var Ee=new re("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function resolveYamlPairs(t){if(null===t)return!0;var r,i,o,a,c,u=t;for(c=new Array(u.length),r=0,i=u.length;r<i;r+=1){if(o=u[r],"[object Object]"!==ke.call(o))return!1;if(1!==(a=Object.keys(o)).length)return!1;c[r]=[a[0],o[a[0]]]}return!0},construct:function constructYamlPairs(t){if(null===t)return[];var r,i,o,a,c,u=t;for(c=new Array(u.length),r=0,i=u.length;r<i;r+=1)o=u[r],a=Object.keys(o),c[r]=[a[0],o[a[0]]];return c}}),xe=Object.prototype.hasOwnProperty;var Pe=new re("tag:yaml.org,2002:set",{kind:"mapping",resolve:function resolveYamlSet(t){if(null===t)return!0;var r,i=t;for(r in i)if(xe.call(i,r)&&null!==i[r])return!1;return!0},construct:function constructYamlSet(t){return null!==t?t:{}}}),Ce=me.extend({implicit:[ve,be],explicit:[we,Ie,Ee,Pe]}),Ae=Object.prototype.hasOwnProperty,Oe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Re=/[\x85\u2028\u2029]/,Me=/[,\[\]\{\}]/,je=/^(?:!|!!|![a-z\-]+!)$/i,Le=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _class(t){return Object.prototype.toString.call(t)}function is_EOL(t){return 10===t||13===t}function is_WHITE_SPACE(t){return 9===t||32===t}function is_WS_OR_EOL(t){return 9===t||32===t||10===t||13===t}function is_FLOW_INDICATOR(t){return 44===t||91===t||93===t||123===t||125===t}function fromHexCode(t){var r;return 48<=t&&t<=57?t-48:97<=(r=32|t)&&r<=102?r-97+10:-1}function simpleEscapeSequence(t){return 48===t?"\0":97===t?"":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"
":95===t?" ":76===t?"\u2028":80===t?"\u2029":""}function charFromCodepoint(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var De=new Array(256),Be=new Array(256),Ne=0;Ne<256;Ne++)De[Ne]=simpleEscapeSequence(Ne)?1:0,Be[Ne]=simpleEscapeSequence(Ne);function State$1(t,r){this.input=t,this.filename=r.filename||null,this.schema=r.schema||Ce,this.onWarning=r.onWarning||null,this.legacy=r.legacy||!1,this.json=r.json||!1,this.listener=r.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function generateError(t,r){var i={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return i.snippet=Z(i),new X(r,i)}function throwError(t,r){throw generateError(t,r)}function throwWarning(t,r){t.onWarning&&t.onWarning.call(null,generateError(t,r))}var Fe={YAML:function handleYamlDirective(t,r,i){var o,a,c;null!==t.version&&throwError(t,"duplication of %YAML directive"),1!==i.length&&throwError(t,"YAML directive accepts exactly one argument"),null===(o=/^([0-9]+)\.([0-9]+)$/.exec(i[0]))&&throwError(t,"ill-formed argument of the YAML directive"),a=parseInt(o[1],10),c=parseInt(o[2],10),1!==a&&throwError(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=c<2,1!==c&&2!==c&&throwWarning(t,"unsupported YAML version of the document")},TAG:function handleTagDirective(t,r,i){var o,a;2!==i.length&&throwError(t,"TAG directive accepts exactly two arguments"),o=i[0],a=i[1],je.test(o)||throwError(t,"ill-formed tag handle (first argument) of the TAG directive"),Ae.call(t.tagMap,o)&&throwError(t,'there is a previously declared suffix for "'+o+'" tag handle'),Le.test(a)||throwError(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch(r){throwError(t,"tag prefix is malformed: "+a)}t.tagMap[o]=a}};function captureSegment(t,r,i,o){var a,c,u,l;if(r<i){if(l=t.input.slice(r,i),o)for(a=0,c=l.length;a<c;a+=1)9===(u=l.charCodeAt(a))||32<=u&&u<=1114111||throwError(t,"expected valid JSON character");else Oe.test(l)&&throwError(t,"the stream contains non-printable characters");t.result+=l}}function mergeMappings(t,r,i,o){var a,c,u,l;for(Q.isObject(i)||throwError(t,"cannot merge mappings; the provided source object is unacceptable"),u=0,l=(a=Object.keys(i)).length;u<l;u+=1)c=a[u],Ae.call(r,c)||(r[c]=i[c],o[c]=!0)}function storeMappingPair(t,r,i,o,a,c,u,l,d){var p,h;if(Array.isArray(a))for(p=0,h=(a=Array.prototype.slice.call(a)).length;p<h;p+=1)Array.isArray(a[p])&&throwError(t,"nested arrays are not supported inside keys"),"object"==typeof a&&"[object Object]"===_class(a[p])&&(a[p]="[object Object]");if("object"==typeof a&&"[object Object]"===_class(a)&&(a="[object Object]"),a=String(a),null===r&&(r={}),"tag:yaml.org,2002:merge"===o)if(Array.isArray(c))for(p=0,h=c.length;p<h;p+=1)mergeMappings(t,r,c[p],i);else mergeMappings(t,r,c,i);else t.json||Ae.call(i,a)||!Ae.call(r,a)||(t.line=u||t.line,t.lineStart=l||t.lineStart,t.position=d||t.position,throwError(t,"duplicated mapping key")),"__proto__"===a?Object.defineProperty(r,a,{configurable:!0,enumerable:!0,writable:!0,value:c}):r[a]=c,delete i[a];return r}function readLineBreak(t){var r;10===(r=t.input.charCodeAt(t.position))?t.position++:13===r?(t.position++,10===t.input.charCodeAt(t.position)&&t.position++):throwError(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function skipSeparationSpace(t,r,i){for(var o=0,a=t.input.charCodeAt(t.position);0!==a;){for(;is_WHITE_SPACE(a);)9===a&&-1===t.firstTabInLine&&(t.firstTabInLine=t.position),a=t.input.charCodeAt(++t.position);if(r&&35===a)do{a=t.input.charCodeAt(++t.position)}while(10!==a&&13!==a&&0!==a);if(!is_EOL(a))break;for(readLineBreak(t),a=t.input.charCodeAt(t.position),o++,t.lineIndent=0;32===a;)t.lineIndent++,a=t.input.charCodeAt(++t.position)}return-1!==i&&0!==o&&t.lineIndent<i&&throwWarning(t,"deficient indentation"),o}function testDocumentSeparator(t){var r,i=t.position;return!(45!==(r=t.input.charCodeAt(i))&&46!==r||r!==t.input.charCodeAt(i+1)||r!==t.input.charCodeAt(i+2)||(i+=3,0!==(r=t.input.charCodeAt(i))&&!is_WS_OR_EOL(r)))}function writeFoldedLines(t,r){1===r?t.result+=" ":r>1&&(t.result+=Q.repeat("\n",r-1))}function readBlockSequence(t,r){var i,o,a=t.tag,c=t.anchor,u=[],l=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=u),o=t.input.charCodeAt(t.position);0!==o&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,throwError(t,"tab characters must not be used in indentation")),45===o)&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1));)if(l=!0,t.position++,skipSeparationSpace(t,!0,-1)&&t.lineIndent<=r)u.push(null),o=t.input.charCodeAt(t.position);else if(i=t.line,composeNode(t,r,3,!1,!0),u.push(t.result),skipSeparationSpace(t,!0,-1),o=t.input.charCodeAt(t.position),(t.line===i||t.lineIndent>r)&&0!==o)throwError(t,"bad indentation of a sequence entry");else if(t.lineIndent<r)break;return!!l&&(t.tag=a,t.anchor=c,t.kind="sequence",t.result=u,!0)}function readTagProperty(t){var r,i,o,a,c=!1,u=!1;if(33!==(a=t.input.charCodeAt(t.position)))return!1;if(null!==t.tag&&throwError(t,"duplication of a tag property"),60===(a=t.input.charCodeAt(++t.position))?(c=!0,a=t.input.charCodeAt(++t.position)):33===a?(u=!0,i="!!",a=t.input.charCodeAt(++t.position)):i="!",r=t.position,c){do{a=t.input.charCodeAt(++t.position)}while(0!==a&&62!==a);t.position<t.length?(o=t.input.slice(r,t.position),a=t.input.charCodeAt(++t.position)):throwError(t,"unexpected end of the stream within a verbatim tag")}else{for(;0!==a&&!is_WS_OR_EOL(a);)33===a&&(u?throwError(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(r-1,t.position+1),je.test(i)||throwError(t,"named tag handle cannot contain such characters"),u=!0,r=t.position+1)),a=t.input.charCodeAt(++t.position);o=t.input.slice(r,t.position),Me.test(o)&&throwError(t,"tag suffix cannot contain flow indicator characters")}o&&!Le.test(o)&&throwError(t,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch(r){throwError(t,"tag name is malformed: "+o)}return c?t.tag=o:Ae.call(t.tagMap,i)?t.tag=t.tagMap[i]+o:"!"===i?t.tag="!"+o:"!!"===i?t.tag="tag:yaml.org,2002:"+o:throwError(t,'undeclared tag handle "'+i+'"'),!0}function readAnchorProperty(t){var r,i;if(38!==(i=t.input.charCodeAt(t.position)))return!1;for(null!==t.anchor&&throwError(t,"duplication of an anchor property"),i=t.input.charCodeAt(++t.position),r=t.position;0!==i&&!is_WS_OR_EOL(i)&&!is_FLOW_INDICATOR(i);)i=t.input.charCodeAt(++t.position);return t.position===r&&throwError(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(r,t.position),!0}function composeNode(t,r,i,o,a){var c,u,l,d,p,h,m,g,y,v=1,b=!1,_=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,c=u=l=4===i||3===i,o&&skipSeparationSpace(t,!0,-1)&&(b=!0,t.lineIndent>r?v=1:t.lineIndent===r?v=0:t.lineIndent<r&&(v=-1)),1===v)for(;readTagProperty(t)||readAnchorProperty(t);)skipSeparationSpace(t,!0,-1)?(b=!0,l=c,t.lineIndent>r?v=1:t.lineIndent===r?v=0:t.lineIndent<r&&(v=-1)):l=!1;if(l&&(l=b||a),1!==v&&4!==i||(g=1===i||2===i?r:r+1,y=t.position-t.lineStart,1===v?l&&(readBlockSequence(t,y)||function readBlockMapping(t,r,i){var o,a,c,u,l,d,p,h=t.tag,m=t.anchor,g={},y=Object.create(null),v=null,b=null,_=null,w=!1,S=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=g),p=t.input.charCodeAt(t.position);0!==p;){if(w||-1===t.firstTabInLine||(t.position=t.firstTabInLine,throwError(t,"tab characters must not be used in indentation")),o=t.input.charCodeAt(t.position+1),c=t.line,63!==p&&58!==p||!is_WS_OR_EOL(o)){if(u=t.line,l=t.lineStart,d=t.position,!composeNode(t,i,2,!1,!0))break;if(t.line===c){for(p=t.input.charCodeAt(t.position);is_WHITE_SPACE(p);)p=t.input.charCodeAt(++t.position);if(58===p)is_WS_OR_EOL(p=t.input.charCodeAt(++t.position))||throwError(t,"a whitespace character is expected after the key-value separator within a block mapping"),w&&(storeMappingPair(t,g,y,v,b,null,u,l,d),v=b=_=null),S=!0,w=!1,a=!1,v=t.tag,b=t.result;else{if(!S)return t.tag=h,t.anchor=m,!0;throwError(t,"can not read an implicit mapping pair; a colon is missed")}}else{if(!S)return t.tag=h,t.anchor=m,!0;throwError(t,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===p?(w&&(storeMappingPair(t,g,y,v,b,null,u,l,d),v=b=_=null),S=!0,w=!0,a=!0):w?(w=!1,a=!0):throwError(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,p=o;if((t.line===c||t.lineIndent>r)&&(w&&(u=t.line,l=t.lineStart,d=t.position),composeNode(t,r,4,!0,a)&&(w?b=t.result:_=t.result),w||(storeMappingPair(t,g,y,v,b,_,u,l,d),v=b=_=null),skipSeparationSpace(t,!0,-1),p=t.input.charCodeAt(t.position)),(t.line===c||t.lineIndent>r)&&0!==p)throwError(t,"bad indentation of a mapping entry");else if(t.lineIndent<r)break}return w&&storeMappingPair(t,g,y,v,b,null,u,l,d),S&&(t.tag=h,t.anchor=m,t.kind="mapping",t.result=g),S}(t,y,g))||function readFlowCollection(t,r){var i,o,a,c,u,l,d,p,h,m,g,y,v=!0,b=t.tag,_=t.anchor,w=Object.create(null);if(91===(y=t.input.charCodeAt(t.position)))u=93,p=!1,c=[];else{if(123!==y)return!1;u=125,p=!0,c={}}for(null!==t.anchor&&(t.anchorMap[t.anchor]=c),y=t.input.charCodeAt(++t.position);0!==y;){if(skipSeparationSpace(t,!0,r),(y=t.input.charCodeAt(t.position))===u)return t.position++,t.tag=b,t.anchor=_,t.kind=p?"mapping":"sequence",t.result=c,!0;v?44===y&&throwError(t,"expected the node content, but found ','"):throwError(t,"missed comma between flow collection entries"),g=null,l=d=!1,63===y&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1))&&(l=d=!0,t.position++,skipSeparationSpace(t,!0,r)),i=t.line,o=t.lineStart,a=t.position,composeNode(t,r,1,!1,!0),m=t.tag,h=t.result,skipSeparationSpace(t,!0,r),y=t.input.charCodeAt(t.position),!d&&t.line!==i||58!==y||(l=!0,y=t.input.charCodeAt(++t.position),skipSeparationSpace(t,!0,r),composeNode(t,r,1,!1,!0),g=t.result),p?storeMappingPair(t,c,w,m,h,g,i,o,a):l?c.push(storeMappingPair(t,null,w,m,h,g,i,o,a)):c.push(h),skipSeparationSpace(t,!0,r),44===(y=t.input.charCodeAt(t.position))?(v=!0,y=t.input.charCodeAt(++t.position)):v=!1}throwError(t,"unexpected end of the stream within a flow collection")}(t,g)?_=!0:(u&&function readBlockScalar(t,r){var i,o,a,c,u,l=1,d=!1,p=!1,h=r,m=0,g=!1;if(124===(c=t.input.charCodeAt(t.position)))o=!1;else{if(62!==c)return!1;o=!0}for(t.kind="scalar",t.result="";0!==c;)if(43===(c=t.input.charCodeAt(++t.position))||45===c)1===l?l=43===c?3:2:throwError(t,"repeat of a chomping mode identifier");else{if(!((a=48<=(u=c)&&u<=57?u-48:-1)>=0))break;0===a?throwError(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):p?throwError(t,"repeat of an indentation width identifier"):(h=r+a-1,p=!0)}if(is_WHITE_SPACE(c)){do{c=t.input.charCodeAt(++t.position)}while(is_WHITE_SPACE(c));if(35===c)do{c=t.input.charCodeAt(++t.position)}while(!is_EOL(c)&&0!==c)}for(;0!==c;){for(readLineBreak(t),t.lineIndent=0,c=t.input.charCodeAt(t.position);(!p||t.lineIndent<h)&&32===c;)t.lineIndent++,c=t.input.charCodeAt(++t.position);if(!p&&t.lineIndent>h&&(h=t.lineIndent),is_EOL(c))m++;else{if(t.lineIndent<h){3===l?t.result+=Q.repeat("\n",d?1+m:m):1===l&&d&&(t.result+="\n");break}for(o?is_WHITE_SPACE(c)?(g=!0,t.result+=Q.repeat("\n",d?1+m:m)):g?(g=!1,t.result+=Q.repeat("\n",m+1)):0===m?d&&(t.result+=" "):t.result+=Q.repeat("\n",m):t.result+=Q.repeat("\n",d?1+m:m),d=!0,p=!0,m=0,i=t.position;!is_EOL(c)&&0!==c;)c=t.input.charCodeAt(++t.position);captureSegment(t,i,t.position,!1)}}return!0}(t,g)||function readSingleQuotedScalar(t,r){var i,o,a;if(39!==(i=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,o=a=t.position;0!==(i=t.input.charCodeAt(t.position));)if(39===i){if(captureSegment(t,o,t.position,!0),39!==(i=t.input.charCodeAt(++t.position)))return!0;o=t.position,t.position++,a=t.position}else is_EOL(i)?(captureSegment(t,o,a,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,r)),o=a=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a single quoted scalar"):(t.position++,a=t.position);throwError(t,"unexpected end of the stream within a single quoted scalar")}(t,g)||function readDoubleQuotedScalar(t,r){var i,o,a,c,u,l,d;if(34!==(l=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,i=o=t.position;0!==(l=t.input.charCodeAt(t.position));){if(34===l)return captureSegment(t,i,t.position,!0),t.position++,!0;if(92===l){if(captureSegment(t,i,t.position,!0),is_EOL(l=t.input.charCodeAt(++t.position)))skipSeparationSpace(t,!1,r);else if(l<256&&De[l])t.result+=Be[l],t.position++;else if((u=120===(d=l)?2:117===d?4:85===d?8:0)>0){for(a=u,c=0;a>0;a--)(u=fromHexCode(l=t.input.charCodeAt(++t.position)))>=0?c=(c<<4)+u:throwError(t,"expected hexadecimal character");t.result+=charFromCodepoint(c),t.position++}else throwError(t,"unknown escape sequence");i=o=t.position}else is_EOL(l)?(captureSegment(t,i,o,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,r)),i=o=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a double quoted scalar"):(t.position++,o=t.position)}throwError(t,"unexpected end of the stream within a double quoted scalar")}(t,g)?_=!0:!function readAlias(t){var r,i,o;if(42!==(o=t.input.charCodeAt(t.position)))return!1;for(o=t.input.charCodeAt(++t.position),r=t.position;0!==o&&!is_WS_OR_EOL(o)&&!is_FLOW_INDICATOR(o);)o=t.input.charCodeAt(++t.position);return t.position===r&&throwError(t,"name of an alias node must contain at least one character"),i=t.input.slice(r,t.position),Ae.call(t.anchorMap,i)||throwError(t,'unidentified alias "'+i+'"'),t.result=t.anchorMap[i],skipSeparationSpace(t,!0,-1),!0}(t)?function readPlainScalar(t,r,i){var o,a,c,u,l,d,p,h,m=t.kind,g=t.result;if(is_WS_OR_EOL(h=t.input.charCodeAt(t.position))||is_FLOW_INDICATOR(h)||35===h||38===h||42===h||33===h||124===h||62===h||39===h||34===h||37===h||64===h||96===h)return!1;if((63===h||45===h)&&(is_WS_OR_EOL(o=t.input.charCodeAt(t.position+1))||i&&is_FLOW_INDICATOR(o)))return!1;for(t.kind="scalar",t.result="",a=c=t.position,u=!1;0!==h;){if(58===h){if(is_WS_OR_EOL(o=t.input.charCodeAt(t.position+1))||i&&is_FLOW_INDICATOR(o))break}else if(35===h){if(is_WS_OR_EOL(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&testDocumentSeparator(t)||i&&is_FLOW_INDICATOR(h))break;if(is_EOL(h)){if(l=t.line,d=t.lineStart,p=t.lineIndent,skipSeparationSpace(t,!1,-1),t.lineIndent>=r){u=!0,h=t.input.charCodeAt(t.position);continue}t.position=c,t.line=l,t.lineStart=d,t.lineIndent=p;break}}u&&(captureSegment(t,a,c,!1),writeFoldedLines(t,t.line-l),a=c=t.position,u=!1),is_WHITE_SPACE(h)||(c=t.position+1),h=t.input.charCodeAt(++t.position)}return captureSegment(t,a,c,!1),!!t.result||(t.kind=m,t.result=g,!1)}(t,g,1===i)&&(_=!0,null===t.tag&&(t.tag="?")):(_=!0,null===t.tag&&null===t.anchor||throwError(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===v&&(_=l&&readBlockSequence(t,y))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&throwError(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,p=t.implicitTypes.length;d<p;d+=1)if((m=t.implicitTypes[d]).resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else if("!"!==t.tag){if(Ae.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,d=0,p=(h=t.typeMap.multi[t.kind||"fallback"]).length;d<p;d+=1)if(t.tag.slice(0,h[d].tag.length)===h[d].tag){m=h[d];break}m||throwError(t,"unknown tag !<"+t.tag+">"),null!==t.result&&m.kind!==t.kind&&throwError(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):throwError(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||_}function readDocument(t){var r,i,o,a,c=t.position,u=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(a=t.input.charCodeAt(t.position))&&(skipSeparationSpace(t,!0,-1),a=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==a));){for(u=!0,a=t.input.charCodeAt(++t.position),r=t.position;0!==a&&!is_WS_OR_EOL(a);)a=t.input.charCodeAt(++t.position);for(o=[],(i=t.input.slice(r,t.position)).length<1&&throwError(t,"directive name must not be less than one character in length");0!==a;){for(;is_WHITE_SPACE(a);)a=t.input.charCodeAt(++t.position);if(35===a){do{a=t.input.charCodeAt(++t.position)}while(0!==a&&!is_EOL(a));break}if(is_EOL(a))break;for(r=t.position;0!==a&&!is_WS_OR_EOL(a);)a=t.input.charCodeAt(++t.position);o.push(t.input.slice(r,t.position))}0!==a&&readLineBreak(t),Ae.call(Fe,i)?Fe[i](t,i,o):throwWarning(t,'unknown document directive "'+i+'"')}skipSeparationSpace(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,skipSeparationSpace(t,!0,-1)):u&&throwError(t,"directives end mark is expected"),composeNode(t,t.lineIndent-1,4,!1,!0),skipSeparationSpace(t,!0,-1),t.checkLineBreaks&&Re.test(t.input.slice(c,t.position))&&throwWarning(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&testDocumentSeparator(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,skipSeparationSpace(t,!0,-1)):t.position<t.length-1&&throwError(t,"end of the stream or a document separator is expected")}function loadDocuments(t,r){r=r||{},0!==(t=String(t)).length&&(10!==t.charCodeAt(t.length-1)&&13!==t.charCodeAt(t.length-1)&&(t+="\n"),65279===t.charCodeAt(0)&&(t=t.slice(1)));var i=new State$1(t,r),o=t.indexOf("\0");for(-1!==o&&(i.position=o,throwError(i,"null byte is not allowed in input")),i.input+="\0";32===i.input.charCodeAt(i.position);)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)readDocument(i);return i.documents}var Ue={loadAll:function loadAll$1(t,r,i){null!==r&&"object"==typeof r&&void 0===i&&(i=r,r=null);var o=loadDocuments(t,i);if("function"!=typeof r)return o;for(var a=0,c=o.length;a<c;a+=1)r(o[a])},load:function load$1(t,r){var i=loadDocuments(t,r);if(0!==i.length){if(1===i.length)return i[0];throw new X("expected a single document in the stream, but found more")}}},qe=Object.prototype.toString,We=Object.prototype.hasOwnProperty,ze={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},Ve=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],He=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function encodeHex(t){var r,i,o;if(r=t.toString(16).toUpperCase(),t<=255)i="x",o=2;else if(t<=65535)i="u",o=4;else{if(!(t<=4294967295))throw new X("code point within a string may not be greater than 0xFFFFFFFF");i="U",o=8}return"\\"+i+Q.repeat("0",o-r.length)+r}function State(t){this.schema=t.schema||Ce,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Q.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=function compileStyleMap(t,r){var i,o,a,c,u,l,d;if(null===r)return{};for(i={},a=0,c=(o=Object.keys(r)).length;a<c;a+=1)u=o[a],l=String(r[u]),"!!"===u.slice(0,2)&&(u="tag:yaml.org,2002:"+u.slice(2)),(d=t.compiledTypeMap.fallback[u])&&We.call(d.styleAliases,l)&&(l=d.styleAliases[l]),i[u]=l;return i}(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType='"'===t.quotingType?2:1,this.forceQuotes=t.forceQuotes||!1,this.replacer="function"==typeof t.replacer?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function indentString(t,r){for(var i,o=Q.repeat(" ",r),a=0,c=-1,u="",l=t.length;a<l;)-1===(c=t.indexOf("\n",a))?(i=t.slice(a),a=l):(i=t.slice(a,c+1),a=c+1),i.length&&"\n"!==i&&(u+=o),u+=i;return u}function generateNextLine(t,r){return"\n"+Q.repeat(" ",t.indent*r)}function isWhitespace(t){return 32===t||9===t}function isPrintable(t){return 32<=t&&t<=126||161<=t&&t<=55295&&8232!==t&&8233!==t||57344<=t&&t<=65533&&65279!==t||65536<=t&&t<=1114111}function isNsCharOrWhitespace(t){return isPrintable(t)&&65279!==t&&13!==t&&10!==t}function isPlainSafe(t,r,i){var o=isNsCharOrWhitespace(t),a=o&&!isWhitespace(t);return(i?o:o&&44!==t&&91!==t&&93!==t&&123!==t&&125!==t)&&35!==t&&!(58===r&&!a)||isNsCharOrWhitespace(r)&&!isWhitespace(r)&&35===t||58===r&&a}function codePointAt(t,r){var i,o=t.charCodeAt(r);return o>=55296&&o<=56319&&r+1<t.length&&(i=t.charCodeAt(r+1))>=56320&&i<=57343?1024*(o-55296)+i-56320+65536:o}function needIndentIndicator(t){return/^\n* /.test(t)}function chooseScalarStyle(t,r,i,o,a,c,u,l){var d,p=0,h=null,m=!1,g=!1,y=-1!==o,v=-1,b=function isPlainSafeFirst(t){return isPrintable(t)&&65279!==t&&!isWhitespace(t)&&45!==t&&63!==t&&58!==t&&44!==t&&91!==t&&93!==t&&123!==t&&125!==t&&35!==t&&38!==t&&42!==t&&33!==t&&124!==t&&61!==t&&62!==t&&39!==t&&34!==t&&37!==t&&64!==t&&96!==t}(codePointAt(t,0))&&function isPlainSafeLast(t){return!isWhitespace(t)&&58!==t}(codePointAt(t,t.length-1));if(r||u)for(d=0;d<t.length;p>=65536?d+=2:d++){if(!isPrintable(p=codePointAt(t,d)))return 5;b=b&&isPlainSafe(p,h,l),h=p}else{for(d=0;d<t.length;p>=65536?d+=2:d++){if(10===(p=codePointAt(t,d)))m=!0,y&&(g=g||d-v-1>o&&" "!==t[v+1],v=d);else if(!isPrintable(p))return 5;b=b&&isPlainSafe(p,h,l),h=p}g=g||y&&d-v-1>o&&" "!==t[v+1]}return m||g?i>9&&needIndentIndicator(t)?5:u?2===c?5:2:g?4:3:!b||u||a(t)?2===c?5:2:1}function writeScalar(t,r,i,o,a){t.dump=function(){if(0===r.length)return 2===t.quotingType?'""':"''";if(!t.noCompatMode&&(-1!==Ve.indexOf(r)||He.test(r)))return 2===t.quotingType?'"'+r+'"':"'"+r+"'";var c=t.indent*Math.max(1,i),u=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-c),l=o||t.flowLevel>-1&&i>=t.flowLevel;switch(chooseScalarStyle(r,l,t.indent,u,(function testAmbiguity(r){return function testImplicitResolving(t,r){var i,o;for(i=0,o=t.implicitTypes.length;i<o;i+=1)if(t.implicitTypes[i].resolve(r))return!0;return!1}(t,r)}),t.quotingType,t.forceQuotes&&!o,a)){case 1:return r;case 2:return"'"+r.replace(/'/g,"''")+"'";case 3:return"|"+blockHeader(r,t.indent)+dropEndingNewline(indentString(r,c));case 4:return">"+blockHeader(r,t.indent)+dropEndingNewline(indentString(function foldString(t,r){var i,o,a=/(\n+)([^\n]*)/g,c=(l=t.indexOf("\n"),l=-1!==l?l:t.length,a.lastIndex=l,foldLine(t.slice(0,l),r)),u="\n"===t[0]||" "===t[0];var l;for(;o=a.exec(t);){var d=o[1],p=o[2];i=" "===p[0],c+=d+(u||i||""===p?"":"\n")+foldLine(p,r),u=i}return c}(r,u),c));case 5:return'"'+function escapeString(t){for(var r,i="",o=0,a=0;a<t.length;o>=65536?a+=2:a++)o=codePointAt(t,a),!(r=ze[o])&&isPrintable(o)?(i+=t[a],o>=65536&&(i+=t[a+1])):i+=r||encodeHex(o);return i}(r)+'"';default:throw new X("impossible error: invalid scalar style")}}()}function blockHeader(t,r){var i=needIndentIndicator(t)?String(r):"",o="\n"===t[t.length-1];return i+(o&&("\n"===t[t.length-2]||"\n"===t)?"+":o?"":"-")+"\n"}function dropEndingNewline(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function foldLine(t,r){if(""===t||" "===t[0])return t;for(var i,o,a=/ [^ ]/g,c=0,u=0,l=0,d="";i=a.exec(t);)(l=i.index)-c>r&&(o=u>c?u:l,d+="\n"+t.slice(c,o),c=o+1),u=l;return d+="\n",t.length-c>r&&u>c?d+=t.slice(c,u)+"\n"+t.slice(u+1):d+=t.slice(c),d.slice(1)}function writeBlockSequence(t,r,i,o){var a,c,u,l="",d=t.tag;for(a=0,c=i.length;a<c;a+=1)u=i[a],t.replacer&&(u=t.replacer.call(i,String(a),u)),(writeNode(t,r+1,u,!0,!0,!1,!0)||void 0===u&&writeNode(t,r+1,null,!0,!0,!1,!0))&&(o&&""===l||(l+=generateNextLine(t,r)),t.dump&&10===t.dump.charCodeAt(0)?l+="-":l+="- ",l+=t.dump);t.tag=d,t.dump=l||"[]"}function detectType(t,r,i){var o,a,c,u,l,d;for(c=0,u=(a=i?t.explicitTypes:t.implicitTypes).length;c<u;c+=1)if(((l=a[c]).instanceOf||l.predicate)&&(!l.instanceOf||"object"==typeof r&&r instanceof l.instanceOf)&&(!l.predicate||l.predicate(r))){if(i?l.multi&&l.representName?t.tag=l.representName(r):t.tag=l.tag:t.tag="?",l.represent){if(d=t.styleMap[l.tag]||l.defaultStyle,"[object Function]"===qe.call(l.represent))o=l.represent(r,d);else{if(!We.call(l.represent,d))throw new X("!<"+l.tag+'> tag resolver accepts not "'+d+'" style');o=l.represent[d](r,d)}t.dump=o}return!0}return!1}function writeNode(t,r,i,o,a,c,u){t.tag=null,t.dump=i,detectType(t,i,!1)||detectType(t,i,!0);var l,d=qe.call(t.dump),p=o;o&&(o=t.flowLevel<0||t.flowLevel>r);var h,m,g="[object Object]"===d||"[object Array]"===d;if(g&&(m=-1!==(h=t.duplicates.indexOf(i))),(null!==t.tag&&"?"!==t.tag||m||2!==t.indent&&r>0)&&(a=!1),m&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(g&&m&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),"[object Object]"===d)o&&0!==Object.keys(t.dump).length?(!function writeBlockMapping(t,r,i,o){var a,c,u,l,d,p,h="",m=t.tag,g=Object.keys(i);if(!0===t.sortKeys)g.sort();else if("function"==typeof t.sortKeys)g.sort(t.sortKeys);else if(t.sortKeys)throw new X("sortKeys must be a boolean or a function");for(a=0,c=g.length;a<c;a+=1)p="",o&&""===h||(p+=generateNextLine(t,r)),l=i[u=g[a]],t.replacer&&(l=t.replacer.call(i,u,l)),writeNode(t,r+1,u,!0,!0,!0)&&((d=null!==t.tag&&"?"!==t.tag||t.dump&&t.dump.length>1024)&&(t.dump&&10===t.dump.charCodeAt(0)?p+="?":p+="? "),p+=t.dump,d&&(p+=generateNextLine(t,r)),writeNode(t,r+1,l,!0,d)&&(t.dump&&10===t.dump.charCodeAt(0)?p+=":":p+=": ",h+=p+=t.dump));t.tag=m,t.dump=h||"{}"}(t,r,t.dump,a),m&&(t.dump="&ref_"+h+t.dump)):(!function writeFlowMapping(t,r,i){var o,a,c,u,l,d="",p=t.tag,h=Object.keys(i);for(o=0,a=h.length;o<a;o+=1)l="",""!==d&&(l+=", "),t.condenseFlow&&(l+='"'),u=i[c=h[o]],t.replacer&&(u=t.replacer.call(i,c,u)),writeNode(t,r,c,!1,!1)&&(t.dump.length>1024&&(l+="? "),l+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),writeNode(t,r,u,!1,!1)&&(d+=l+=t.dump));t.tag=p,t.dump="{"+d+"}"}(t,r,t.dump),m&&(t.dump="&ref_"+h+" "+t.dump));else if("[object Array]"===d)o&&0!==t.dump.length?(t.noArrayIndent&&!u&&r>0?writeBlockSequence(t,r-1,t.dump,a):writeBlockSequence(t,r,t.dump,a),m&&(t.dump="&ref_"+h+t.dump)):(!function writeFlowSequence(t,r,i){var o,a,c,u="",l=t.tag;for(o=0,a=i.length;o<a;o+=1)c=i[o],t.replacer&&(c=t.replacer.call(i,String(o),c)),(writeNode(t,r,c,!1,!1)||void 0===c&&writeNode(t,r,null,!1,!1))&&(""!==u&&(u+=","+(t.condenseFlow?"":" ")),u+=t.dump);t.tag=l,t.dump="["+u+"]"}(t,r,t.dump),m&&(t.dump="&ref_"+h+" "+t.dump));else{if("[object String]"!==d){if("[object Undefined]"===d)return!1;if(t.skipInvalid)return!1;throw new X("unacceptable kind of an object to dump "+d)}"?"!==t.tag&&writeScalar(t,t.dump,r,c,p)}null!==t.tag&&"?"!==t.tag&&(l=encodeURI("!"===t.tag[0]?t.tag.slice(1):t.tag).replace(/!/g,"%21"),l="!"===t.tag[0]?"!"+l:"tag:yaml.org,2002:"===l.slice(0,18)?"!!"+l.slice(18):"!<"+l+">",t.dump=l+" "+t.dump)}return!0}function getDuplicateReferences(t,r){var i,o,a=[],c=[];for(function inspectNode(t,r,i){var o,a,c;if(null!==t&&"object"==typeof t)if(-1!==(a=r.indexOf(t)))-1===i.indexOf(a)&&i.push(a);else if(r.push(t),Array.isArray(t))for(a=0,c=t.length;a<c;a+=1)inspectNode(t[a],r,i);else for(o=Object.keys(t),a=0,c=o.length;a<c;a+=1)inspectNode(t[o[a]],r,i)}(t,a,c),i=0,o=c.length;i<o;i+=1)r.duplicates.push(a[c[i]]);r.usedDuplicates=new Array(o)}function renamed(t,r){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var $e={Type:re,Schema:ne,FAILSAFE_SCHEMA:ae,JSON_SCHEMA:he,CORE_SCHEMA:me,DEFAULT_SCHEMA:Ce,load:Ue.load,loadAll:Ue.loadAll,dump:{dump:function dump$1(t,r){var i=new State(r=r||{});i.noRefs||getDuplicateReferences(t,i);var o=t;return i.replacer&&(o=i.replacer.call({"":o},"",o)),writeNode(i,0,o,!0,!0)?i.dump+"\n":""}}.dump,YAMLException:X,types:{binary:we,float:pe,map:se,null:ce,pairs:Ee,set:Pe,timestamp:ve,bool:ue,int:le,merge:be,omap:Ie,seq:oe,str:ie},safeLoad:renamed("safeLoad","load"),safeLoadAll:renamed("safeLoadAll","loadAll"),safeDump:renamed("safeDump","dump")},Ke=i(54),Ge=i(42),Je=i.n(Ge),Ye=i(25),Qe=i.n(Ye),Xe=function isRfc3986Reserved(t){return":/?#[]@!$&'()*+,;=".indexOf(t)>-1},Ze=function isRrc3986Unreserved(t){return/^[a-z0-9\-._~]+$/i.test(t)};function encodeDisallowedCharacters(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.escape,a=arguments.length>2?arguments[2]:void 0;return"number"==typeof t&&(t=t.toString()),"string"==typeof t&&t.length&&o?a?JSON.parse(t):U()(r=Je()(t)).call(r,(function(t){var r,i;if(Ze(t))return t;if(Xe(t)&&"unsafe"===o)return t;var a=new TextEncoder;return U()(r=U()(i=L()(a.encode(t))).call(i,(function(t){var r;return Qe()(r="0".concat(t.toString(16).toUpperCase())).call(r,-2)}))).call(r,(function(t){return"%".concat(t)})).join("")})).join(""):t}function stylize(t){var r=t.value;return Array.isArray(r)?function encodeArray(t){var r=t.key,i=t.value,o=t.style,a=t.explode,c=t.escape,u=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})};if("simple"===o)return U()(i).call(i,(function(t){return u(t)})).join(",");if("label"===o)return".".concat(U()(i).call(i,(function(t){return u(t)})).join("."));if("matrix"===o)return U()(i).call(i,(function(t){return u(t)})).reduce((function(t,i){var o,c,u;return!t||a?V()(c=V()(u="".concat(t||"",";")).call(u,r,"=")).call(c,i):V()(o="".concat(t,",")).call(o,i)}),"");if("form"===o){var l=a?"&".concat(r,"="):",";return U()(i).call(i,(function(t){return u(t)})).join(l)}if("spaceDelimited"===o){var d=a?"".concat(r,"="):"";return U()(i).call(i,(function(t){return u(t)})).join(" ".concat(d))}if("pipeDelimited"===o){var p=a?"".concat(r,"="):"";return U()(i).call(i,(function(t){return u(t)})).join("|".concat(p))}return}(t):"object"===w()(r)?function encodeObject(t){var r=t.key,i=t.value,o=t.style,a=t.explode,c=t.escape,u=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})},l=W()(i);if("simple"===o)return l.reduce((function(t,r){var o,c,l,d=u(i[r]),p=a?"=":",",h=t?"".concat(t,","):"";return V()(o=V()(c=V()(l="".concat(h)).call(l,r)).call(c,p)).call(o,d)}),"");if("label"===o)return l.reduce((function(t,r){var o,c,l,d=u(i[r]),p=a?"=":".",h=t?"".concat(t,"."):".";return V()(o=V()(c=V()(l="".concat(h)).call(l,r)).call(c,p)).call(o,d)}),"");if("matrix"===o&&a)return l.reduce((function(t,r){var o,a,c=u(i[r]),l=t?"".concat(t,";"):";";return V()(o=V()(a="".concat(l)).call(a,r,"=")).call(o,c)}),"");if("matrix"===o)return l.reduce((function(t,o){var a,c,l=u(i[o]),d=t?"".concat(t,","):";".concat(r,"=");return V()(a=V()(c="".concat(d)).call(c,o,",")).call(a,l)}),"");if("form"===o)return l.reduce((function(t,r){var o,c,l,d,p=u(i[r]),h=t?V()(o="".concat(t)).call(o,a?"&":","):"",m=a?"=":",";return V()(c=V()(l=V()(d="".concat(h)).call(d,r)).call(l,m)).call(c,p)}),"");return}(t):function encodePrimitive(t){var r,i=t.key,o=t.value,a=t.style,c=t.escape,u=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})};if("simple"===a)return u(o);if("label"===a)return".".concat(u(o));if("matrix"===a)return V()(r=";".concat(i,"=")).call(r,u(o));if("form"===a)return u(o);if("deepObject"===a)return u(o);return}(t)}var et=function foldFormDataToRequest(t,r){r.body=t},tt={serializeRes:serializeRes,mergeInQueryOrForm:mergeInQueryOrForm};function http_http(t){return _http.apply(this,arguments)}function _http(){return(_http=x()(C.a.mark((function _callee(t){var r,i,o,a,c,u=arguments;return C.a.wrap((function _callee$(l){for(;;)switch(l.prev=l.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},"object"===w()(t)&&(t=(r=t).url),r.headers=r.headers||{},tt.mergeInQueryOrForm(r),r.headers&&W()(r.headers).forEach((function(t){var i=r.headers[t];"string"==typeof i&&(r.headers[t]=i.replace(/\n+/g," "))})),!r.requestInterceptor){l.next=12;break}return l.next=8,r.requestInterceptor(r);case 8:if(l.t0=l.sent,l.t0){l.next=11;break}l.t0=r;case 11:r=l.t0;case 12:return i=r.headers["content-type"]||r.headers["Content-Type"],/multipart\/form-data/i.test(i)&&r.body instanceof Ke.FormData&&(delete r.headers["content-type"],delete r.headers["Content-Type"]),l.prev=14,l.next=17,(r.userFetch||fetch)(r.url,r);case 17:return o=l.sent,l.next=20,tt.serializeRes(o,t,r);case 20:if(o=l.sent,!r.responseInterceptor){l.next=28;break}return l.next=24,r.responseInterceptor(o);case 24:if(l.t1=l.sent,l.t1){l.next=27;break}l.t1=o;case 27:o=l.t1;case 28:l.next=39;break;case 30:if(l.prev=30,l.t2=l.catch(14),o){l.next=34;break}throw l.t2;case 34:throw(a=new Error(o.statusText||"response status is ".concat(o.status))).status=o.status,a.statusCode=o.status,a.responseError=l.t2,a;case 39:if(o.ok){l.next=45;break}throw(c=new Error(o.statusText||"response status is ".concat(o.status))).status=o.status,c.statusCode=o.status,c.response=o,c;case 45:return l.abrupt("return",o);case 46:case"end":return l.stop()}}),_callee,null,[[14,30]])})))).apply(this,arguments)}var rt=function shouldDownloadAsText(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(t)};function parseBody(t,r){return r&&(0===r.indexOf("application/json")||r.indexOf("+json")>0)?JSON.parse(t):$e.load(t)}function serializeRes(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.loadSpec,a=void 0!==o&&o,c={ok:t.ok,url:t.url||r,status:t.status,statusText:t.statusText,headers:serializeHeaders(t.headers)},u=c.headers["content-type"],l=a||rt(u),d=l?t.text:t.blob||t.buffer;return d.call(t).then((function(t){if(c.text=t,c.data=t,l)try{var r=parseBody(t,u);c.body=r,c.obj=r}catch(t){c.parseError=t}return c}))}function serializeHeaderValue(t){return O()(t).call(t,", ")?t.split(", "):t}function serializeHeaders(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"function"!=typeof M()(t)?{}:L()(M()(t).call(t)).reduce((function(t,r){var i=I()(r,2),o=i[0],a=i[1];return t[o]=serializeHeaderValue(a),t}),{})}function isFile(t,r){return r||"undefined"==typeof navigator||(r=navigator),r&&"ReactNative"===r.product?!(!t||"object"!==w()(t)||"string"!=typeof t.uri):void 0!==Ke.File&&t instanceof Ke.File||(void 0!==Ke.Blob&&t instanceof Ke.Blob||(!!ArrayBuffer.isView(t)||null!==t&&"object"===w()(t)&&"function"==typeof t.pipe))}function isArrayOfFile(t,r){return Array.isArray(t)&&t.some((function(t){return isFile(t,r)}))}var nt={form:",",spaceDelimited:"%20",pipeDelimited:"|"},it={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function formatKeyValue(t,r){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=r.collectionFormat,a=r.allowEmptyValue,c=r.serializationOption,u=r.encoding,l="object"!==w()(r)||Array.isArray(r)?r:r.value,d=i?function(t){return t.toString()}:function(t){return encodeURIComponent(t)},p=d(t);if(void 0===l&&a)return[[p,""]];if(isFile(l)||isArrayOfFile(l))return[[p,l]];if(c)return formatKeyValueBySerializationOption(t,l,i,c);if(u){if([w()(u.style),w()(u.explode),w()(u.allowReserved)].some((function(t){return"undefined"!==t}))){var h=u.style,m=u.explode,g=u.allowReserved;return formatKeyValueBySerializationOption(t,l,i,{style:h,explode:m,allowReserved:g})}if(u.contentType){if("application/json"===u.contentType){var y="string"==typeof l?l:B()(l);return[[p,d(y)]]}return[[p,d(l.toString())]]}return"object"!==w()(l)?[[p,d(l)]]:Array.isArray(l)&&l.every((function(t){return"object"!==w()(t)}))?[[p,U()(l).call(l,d).join(",")]]:[[p,d(B()(l))]]}return"object"!==w()(l)?[[p,d(l)]]:Array.isArray(l)?"multi"===o?[[p,U()(l).call(l,d)]]:[[p,U()(l).call(l,d).join(it[o||"csv"])]]:[[p,""]]}function formatKeyValueBySerializationOption(t,r,i,o){var a,c,u,l=o.style||"form",d=void 0===o.explode?"form"===l:o.explode,p=!i&&(o&&o.allowReserved?"unsafe":"reserved"),h=function encodeFn(t){return encodeDisallowedCharacters(t,{escape:p})},m=i?function(t){return t}:function(t){return encodeDisallowedCharacters(t,{escape:p})};return"object"!==w()(r)?[[m(t),h(r)]]:Array.isArray(r)?d?[[m(t),U()(r).call(r,h)]]:[[m(t),U()(r).call(r,h).join(nt[l])]]:"deepObject"===l?U()(c=W()(r)).call(c,(function(i){var o;return[m(V()(o="".concat(t,"[")).call(o,i,"]")),h(r[i])]})):d?U()(u=W()(r)).call(u,(function(t){return[m(t),h(r[t])]})):[[m(t),U()(a=W()(r)).call(a,(function(t){var i;return[V()(i="".concat(m(t),",")).call(i,h(r[t]))]})).join(",")]]}function buildFormData(t){return $()(t).reduce((function(t,r){var i,o=I()(r,2),a=o[0],c=o[1],u=b()(formatKeyValue(a,c,!0));try{for(u.s();!(i=u.n()).done;){var l=I()(i.value,2),d=l[0],p=l[1];if(Array.isArray(p)){var h,m=b()(p);try{for(m.s();!(h=m.n()).done;){var g=h.value;if(ArrayBuffer.isView(g)){var y=new Ke.Blob([g]);t.append(d,y)}else t.append(d,g)}}catch(t){m.e(t)}finally{m.f()}}else if(ArrayBuffer.isView(p)){var v=new Ke.Blob([p]);t.append(d,v)}else t.append(d,p)}}catch(t){u.e(t)}finally{u.f()}return t}),new Ke.FormData)}function encodeFormOrQuery(t){var r=W()(t).reduce((function(r,i){var o,a=b()(formatKeyValue(i,t[i]));try{for(a.s();!(o=a.n()).done;){var c=I()(o.value,2),u=c[0],l=c[1];r[u]=l}}catch(t){a.e(t)}finally{a.f()}return r}),{});return Y.a.stringify(r,{encode:!1,indices:!1})||""}function mergeInQueryOrForm(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.url,i=void 0===r?"":r,o=t.query,a=t.form,c=function joinSearch(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var o=G()(r).call(r,(function(t){return t})).join("&");return o?"?".concat(o):""};if(a){var u=W()(a).some((function(t){var r=a[t].value;return isFile(r)||isArrayOfFile(r)})),l=t.headers["content-type"]||t.headers["Content-Type"];if(u||/multipart\/form-data/i.test(l)){var d=buildFormData(t.form);et(d,t)}else t.body=encodeFormOrQuery(a);delete t.form}if(o){var p=i.split("?"),h=I()(p,2),m=h[0],g=h[1],y="";if(g){var v=Y.a.parse(g),b=W()(o);b.forEach((function(t){return delete v[t]})),y=Y.a.stringify(v,{encode:!0})}var _=c(y,encodeFormOrQuery(o));t.url=m+_,delete t.query}return t}var ot,st=i(157),at=i.n(st),ct=i(158),ut=i.n(ct),lt=i(346),ft=i.n(lt),dt=i(53),pt=i.n(dt),ht=i(347),mt=i.n(ht),gt=i(216),yt=i.n(gt),vt=(ot=function(t,r){return(ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])})(t,r)},function(t,r){function __(){this.constructor=t}ot(t,r),t.prototype=null===r?Object.create(r):(__.prototype=r.prototype,new __)}),bt=Object.prototype.hasOwnProperty;function module_helpers_hasOwnProperty(t,r){return bt.call(t,r)}function _objectKeys(t){if(Array.isArray(t)){for(var r=new Array(t.length),i=0;i<r.length;i++)r[i]=""+i;return r}if(Object.keys)return Object.keys(t);var o=[];for(var a in t)module_helpers_hasOwnProperty(t,a)&&o.push(a);return o}function _deepClone(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function helpers_isInteger(t){for(var r,i=0,o=t.length;i<o;){if(!((r=t.charCodeAt(i))>=48&&r<=57))return!1;i++}return!0}function escapePathComponent(t){return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function unescapePathComponent(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function patchErrorMessageFormatter(t,r){var i=[t];for(var o in r){var a="object"==typeof r[o]?JSON.stringify(r[o],null,2):r[o];void 0!==a&&i.push(o+": "+a)}return i.join("\n")}var _t=function(t){function PatchError(r,i,o,a,c){var u=this.constructor,l=t.call(this,patchErrorMessageFormatter(r,{name:i,index:o,operation:a,tree:c}))||this;return l.name=i,l.index=o,l.operation=a,l.tree=c,Object.setPrototypeOf(l,u.prototype),l.message=patchErrorMessageFormatter(r,{name:i,index:o,operation:a,tree:c}),l}return vt(PatchError,t),PatchError}(Error),wt=_t,St=_deepClone,Tt={add:function(t,r,i){return t[r]=this.value,{newDocument:i}},remove:function(t,r,i){var o=t[r];return delete t[r],{newDocument:i,removed:o}},replace:function(t,r,i){var o=t[r];return t[r]=this.value,{newDocument:i,removed:o}},move:function(t,r,i){var o=getValueByPointer(i,this.path);o&&(o=_deepClone(o));var a=applyOperation(i,{op:"remove",path:this.from}).removed;return applyOperation(i,{op:"add",path:this.path,value:a}),{newDocument:i,removed:o}},copy:function(t,r,i){var o=getValueByPointer(i,this.from);return applyOperation(i,{op:"add",path:this.path,value:_deepClone(o)}),{newDocument:i}},test:function(t,r,i){return{newDocument:i,test:_areEquals(t[r],this.value)}},_get:function(t,r,i){return this.value=t[r],{newDocument:i}}},It={add:function(t,r,i){return helpers_isInteger(r)?t.splice(r,0,this.value):t[r]=this.value,{newDocument:i,index:r}},remove:function(t,r,i){return{newDocument:i,removed:t.splice(r,1)[0]}},replace:function(t,r,i){var o=t[r];return t[r]=this.value,{newDocument:i,removed:o}},move:Tt.move,copy:Tt.copy,test:Tt.test,_get:Tt._get};function getValueByPointer(t,r){if(""==r)return t;var i={op:"_get",path:r};return applyOperation(t,i),i.value}function applyOperation(t,r,i,o,a,c){if(void 0===i&&(i=!1),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===c&&(c=0),i&&("function"==typeof i?i(r,0,t,r.path):validator(r,0)),""===r.path){var u={newDocument:t};if("add"===r.op)return u.newDocument=r.value,u;if("replace"===r.op)return u.newDocument=r.value,u.removed=t,u;if("move"===r.op||"copy"===r.op)return u.newDocument=getValueByPointer(t,r.from),"move"===r.op&&(u.removed=t),u;if("test"===r.op){if(u.test=_areEquals(t,r.value),!1===u.test)throw new wt("Test operation failed","TEST_OPERATION_FAILED",c,r,t);return u.newDocument=t,u}if("remove"===r.op)return u.removed=t,u.newDocument=null,u;if("_get"===r.op)return r.value=t,u;if(i)throw new wt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",c,r,t);return u}o||(t=_deepClone(t));var l=(r.path||"").split("/"),d=t,p=1,h=l.length,m=void 0,g=void 0,y=void 0;for(y="function"==typeof i?i:validator;;){if((g=l[p])&&-1!=g.indexOf("~")&&(g=unescapePathComponent(g)),a&&("__proto__"==g||"prototype"==g&&p>0&&"constructor"==l[p-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(i&&void 0===m&&(void 0===d[g]?m=l.slice(0,p).join("/"):p==h-1&&(m=r.path),void 0!==m&&y(r,0,t,m)),p++,Array.isArray(d)){if("-"===g)g=d.length;else{if(i&&!helpers_isInteger(g))throw new wt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",c,r,t);helpers_isInteger(g)&&(g=~~g)}if(p>=h){if(i&&"add"===r.op&&g>d.length)throw new wt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",c,r,t);if(!1===(u=It[r.op].call(r,d,g,t)).test)throw new wt("Test operation failed","TEST_OPERATION_FAILED",c,r,t);return u}}else if(p>=h){if(!1===(u=Tt[r.op].call(r,d,g,t)).test)throw new wt("Test operation failed","TEST_OPERATION_FAILED",c,r,t);return u}if(d=d[g],i&&p<h&&(!d||"object"!=typeof d))throw new wt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",c,r,t)}}function applyPatch(t,r,i,o,a){if(void 0===o&&(o=!0),void 0===a&&(a=!0),i&&!Array.isArray(r))throw new wt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");o||(t=_deepClone(t));for(var c=new Array(r.length),u=0,l=r.length;u<l;u++)c[u]=applyOperation(t,r[u],i,!0,a,u),t=c[u].newDocument;return c.newDocument=t,c}function applyReducer(t,r,i){var o=applyOperation(t,r);if(!1===o.test)throw new wt("Test operation failed","TEST_OPERATION_FAILED",i,r,t);return o.newDocument}function validator(t,r,i,o){if("object"!=typeof t||null===t||Array.isArray(t))throw new wt("Operation is not an object","OPERATION_NOT_AN_OBJECT",r,t,i);if(!Tt[t.op])throw new wt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",r,t,i);if("string"!=typeof t.path)throw new wt("Operation `path` property is not a string","OPERATION_PATH_INVALID",r,t,i);if(0!==t.path.indexOf("/")&&t.path.length>0)throw new wt('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",r,t,i);if(("move"===t.op||"copy"===t.op)&&"string"!=typeof t.from)throw new wt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",r,t,i);if(("add"===t.op||"replace"===t.op||"test"===t.op)&&void 0===t.value)throw new wt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",r,t,i);if(("add"===t.op||"replace"===t.op||"test"===t.op)&&function hasUndefined(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(var r=0,i=t.length;r<i;r++)if(hasUndefined(t[r]))return!0}else if("object"==typeof t)for(var o=_objectKeys(t),a=o.length,c=0;c<a;c++)if(hasUndefined(t[o[c]]))return!0;return!1}(t.value))throw new wt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",r,t,i);if(i)if("add"==t.op){var a=t.path.split("/").length,c=o.split("/").length;if(a!==c+1&&a!==c)throw new wt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",r,t,i)}else if("replace"===t.op||"remove"===t.op||"_get"===t.op){if(t.path!==o)throw new wt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",r,t,i)}else if("move"===t.op||"copy"===t.op){var u=validate([{op:"_get",path:t.from,value:void 0}],i);if(u&&"OPERATION_PATH_UNRESOLVABLE"===u.name)throw new wt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",r,t,i)}}function validate(t,r,i){try{if(!Array.isArray(t))throw new wt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(r)applyPatch(_deepClone(r),_deepClone(t),i||!0);else{i=i||validator;for(var o=0;o<t.length;o++)i(t[o],o,r,void 0)}}catch(t){if(t instanceof wt)return t;throw t}}function _areEquals(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){var i,o,a,c=Array.isArray(t),u=Array.isArray(r);if(c&&u){if((o=t.length)!=r.length)return!1;for(i=o;0!=i--;)if(!_areEquals(t[i],r[i]))return!1;return!0}if(c!=u)return!1;var l=Object.keys(t);if((o=l.length)!==Object.keys(r).length)return!1;for(i=o;0!=i--;)if(!r.hasOwnProperty(l[i]))return!1;for(i=o;0!=i--;)if(!_areEquals(t[a=l[i]],r[a]))return!1;return!0}return t!=t&&r!=r}var kt=new WeakMap,Et=function Et(t){this.observers=new Map,this.obj=t},xt=function xt(t,r){this.callback=t,this.observer=r};function unobserve(t,r){r.unobserve()}function observe(t,r){var i,o=function getMirror(t){return kt.get(t)}(t);if(o){var a=function getObserverFromMirror(t,r){return t.observers.get(r)}(o,r);i=a&&a.observer}else o=new Et(t),kt.set(t,o);if(i)return i;if(i={},o.value=_deepClone(t),r){i.callback=r,i.next=null;var dirtyCheck=function(){generate(i)},fastCheck=function(){clearTimeout(i.next),i.next=setTimeout(dirtyCheck)};"undefined"!=typeof window&&(window.addEventListener("mouseup",fastCheck),window.addEventListener("keyup",fastCheck),window.addEventListener("mousedown",fastCheck),window.addEventListener("keydown",fastCheck),window.addEventListener("change",fastCheck))}return i.patches=[],i.object=t,i.unobserve=function(){generate(i),clearTimeout(i.next),function removeObserverFromMirror(t,r){t.observers.delete(r.callback)}(o,i),"undefined"!=typeof window&&(window.removeEventListener("mouseup",fastCheck),window.removeEventListener("keyup",fastCheck),window.removeEventListener("mousedown",fastCheck),window.removeEventListener("keydown",fastCheck),window.removeEventListener("change",fastCheck))},o.observers.set(r,new xt(r,i)),i}function generate(t,r){void 0===r&&(r=!1);var i=kt.get(t.object);_generate(i.value,t.object,t.patches,"",r),t.patches.length&&applyPatch(i.value,t.patches);var o=t.patches;return o.length>0&&(t.patches=[],t.callback&&t.callback(o)),o}function _generate(t,r,i,o,a){if(r!==t){"function"==typeof r.toJSON&&(r=r.toJSON());for(var c=_objectKeys(r),u=_objectKeys(t),l=!1,d=u.length-1;d>=0;d--){var p=t[m=u[d]];if(!module_helpers_hasOwnProperty(r,m)||void 0===r[m]&&void 0!==p&&!1===Array.isArray(r))Array.isArray(t)===Array.isArray(r)?(a&&i.push({op:"test",path:o+"/"+escapePathComponent(m),value:_deepClone(p)}),i.push({op:"remove",path:o+"/"+escapePathComponent(m)}),l=!0):(a&&i.push({op:"test",path:o,value:t}),i.push({op:"replace",path:o,value:r}),!0);else{var h=r[m];"object"==typeof p&&null!=p&&"object"==typeof h&&null!=h&&Array.isArray(p)===Array.isArray(h)?_generate(p,h,i,o+"/"+escapePathComponent(m),a):p!==h&&(!0,a&&i.push({op:"test",path:o+"/"+escapePathComponent(m),value:_deepClone(p)}),i.push({op:"replace",path:o+"/"+escapePathComponent(m),value:_deepClone(h)}))}}if(l||c.length!=u.length)for(d=0;d<c.length;d++){var m;module_helpers_hasOwnProperty(t,m=c[d])||void 0===r[m]||i.push({op:"add",path:o+"/"+escapePathComponent(m),value:_deepClone(r[m])})}}}function compare(t,r,i){void 0===i&&(i=!1);var o=[];return _generate(t,r,o,"",i),o}Object.assign({},o,a,{JsonPatchError:_t,deepClone:_deepClone,escapePathComponent:escapePathComponent,unescapePathComponent:unescapePathComponent});var Pt=i(348),Ct=i.n(Pt),At=i(349),Ot=i.n(At),Rt={add:function add(t,r){return{op:"add",path:t,value:r}},replace:replace,remove:function remove(t){return{op:"remove",path:t}},merge:function lib_merge(t,r){return{type:"mutation",op:"merge",path:t,value:r}},mergeDeep:function mergeDeep(t,r){return{type:"mutation",op:"mergeDeep",path:t,value:r}},context:function context(t,r){return{type:"context",path:t,value:r}},getIn:function getIn(t,r){return r.reduce((function(t,r){return void 0!==r&&t?t[r]:t}),t)},applyPatch:function lib_applyPatch(t,r,i){if(i=i||{},"merge"===(r=l()(l()({},r),{},{path:r.path&&normalizeJSONPath(r.path)})).op){var o=getInByJsonPath(t,r.path);p()(o,r.value),applyPatch(t,[replace(r.path,o)])}else if("mergeDeep"===r.op){var a=getInByJsonPath(t,r.path);for(var c in r.value){var u=r.value[c],d=Array.isArray(u);if(d){var h=a[c]||[];a[c]=V()(h).call(h,u)}else if(lib_isObject(u)&&!d){var m=l()({},a[c]);for(var g in u){if(Object.prototype.hasOwnProperty.call(m,g)){m=Ct()(Ot()(m),u);break}p()(m,yt()({},g,u[g]))}a[c]=m}else a[c]=u}}else if("add"===r.op&&""===r.path&&lib_isObject(r.value)){var y=W()(r.value).reduce((function(t,i){return t.push({op:"add",path:"/".concat(normalizeJSONPath(i)),value:r.value[i]}),t}),[]);applyPatch(t,y)}else if("replace"===r.op&&""===r.path){var v=r.value;i.allowMetaPatches&&r.meta&&isAdditiveMutation(r)&&(Array.isArray(r.value)||lib_isObject(r.value))&&(v=l()(l()({},v),r.meta)),t=v}else if(applyPatch(t,[r]),i.allowMetaPatches&&r.meta&&isAdditiveMutation(r)&&(Array.isArray(r.value)||lib_isObject(r.value))){var b=getInByJsonPath(t,r.path),_=l()(l()({},b),r.meta);applyPatch(t,[replace(r.path,_)])}return t},parentPathMatch:function parentPathMatch(t,r){if(!Array.isArray(r))return!1;for(var i=0,o=r.length;i<o;i+=1)if(r[i]!==t[i])return!1;return!0},flatten:flatten,fullyNormalizeArray:function fullyNormalizeArray(t){return cleanArray(flatten(normalizeArray(t)))},normalizeArray:normalizeArray,isPromise:function isPromise(t){return lib_isObject(t)&&isFunction(t.then)},forEachNew:function forEachNew(t,r){try{return forEachNewPatch(t,forEach,r)}catch(t){return t}},forEachNewPrimitive:function forEachNewPrimitive(t,r){try{return forEachNewPatch(t,forEachPrimitive,r)}catch(t){return t}},isJsonPatch:isJsonPatch,isContextPatch:function isContextPatch(t){return isPatch(t)&&"context"===t.type},isPatch:isPatch,isMutation:isMutation,isAdditiveMutation:isAdditiveMutation,isGenerator:function isGenerator(t){return"[object GeneratorFunction]"===Object.prototype.toString.call(t)},isFunction:isFunction,isObject:lib_isObject,isError:function isError(t){return t instanceof Error}};function normalizeJSONPath(t){return Array.isArray(t)?t.length<1?"":"/".concat(U()(t).call(t,(function(t){return(t+"").replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")):t}function replace(t,r,i){return{op:"replace",path:t,value:r,meta:i}}function forEachNewPatch(t,r,i){var o;return cleanArray(flatten(U()(o=G()(t).call(t,isAdditiveMutation)).call(o,(function(t){return r(t.value,i,t.path)}))||[]))}function forEachPrimitive(t,r,i){return i=i||[],Array.isArray(t)?U()(t).call(t,(function(t,o){return forEachPrimitive(t,r,V()(i).call(i,o))})):lib_isObject(t)?U()(o=W()(t)).call(o,(function(o){return forEachPrimitive(t[o],r,V()(i).call(i,o))})):r(t,i[i.length-1],i);var o}function forEach(t,r,i){var o=[];if((i=i||[]).length>0){var a=r(t,i[i.length-1],i);a&&(o=V()(o).call(o,a))}if(Array.isArray(t)){var c=U()(t).call(t,(function(t,o){return forEach(t,r,V()(i).call(i,o))}));c&&(o=V()(o).call(o,c))}else if(lib_isObject(t)){var u,l=U()(u=W()(t)).call(u,(function(o){return forEach(t[o],r,V()(i).call(i,o))}));l&&(o=V()(o).call(o,l))}return o=flatten(o)}function normalizeArray(t){return Array.isArray(t)?t:[t]}function flatten(t){var r;return V()(r=[]).apply(r,Je()(U()(t).call(t,(function(t){return Array.isArray(t)?flatten(t):t}))))}function cleanArray(t){return G()(t).call(t,(function(t){return void 0!==t}))}function lib_isObject(t){return t&&"object"===w()(t)}function isFunction(t){return t&&"function"==typeof t}function isJsonPatch(t){if(isPatch(t)){var r=t.op;return"add"===r||"remove"===r||"replace"===r}return!1}function isMutation(t){return isJsonPatch(t)||isPatch(t)&&"mutation"===t.type}function isAdditiveMutation(t){return isMutation(t)&&("add"===t.op||"replace"===t.op||"merge"===t.op||"mergeDeep"===t.op)}function isPatch(t){return t&&"object"===w()(t)}function getInByJsonPath(t,r){try{return getValueByPointer(t,r)}catch(t){return console.error(t),{}}}var Mt=i(350),jt=i.n(Mt),Lt=i(218),Dt=i.n(Lt);function createErrorType(t,r){function E(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack;for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];this.message=i[0],r&&r.apply(this,i)}return E.prototype=new Error,E.prototype.name=t,E.prototype.constructor=E,E}var Bt=i(351),Nt=i.n(Bt),Ft=["properties"],Ut=["properties"],qt=["definitions","parameters","responses","securityDefinitions","components/schemas","components/responses","components/parameters","components/securitySchemes"],Wt=["schema/example","items/example"];function isFreelyNamed(t){var r=t[t.length-1],i=t[t.length-2],o=t.join("/");return Ft.indexOf(r)>-1&&-1===Ut.indexOf(i)||qt.indexOf(o)>-1||Wt.some((function(t){return o.indexOf(t)>-1}))}function absolutifyPointer(t,r){var i,o=t.split("#"),a=I()(o,2),c=a[0],u=a[1],l=y.a.resolve(c||"",r||"");return u?V()(i="".concat(l,"#")).call(i,u):l}var zt=/^([a-z]+:\/\/|\/\/)/i,Vt=createErrorType("JSONRefError",(function cb(t,r,i){this.originalError=i,p()(this,r||{})})),Ht={},$t=new jt.a,Kt=[function(t){return"paths"===t[0]&&"responses"===t[3]&&"examples"===t[5]},function(t){return"paths"===t[0]&&"responses"===t[3]&&"content"===t[5]&&"example"===t[7]},function(t){return"paths"===t[0]&&"responses"===t[3]&&"content"===t[5]&&"examples"===t[7]&&"value"===t[9]},function(t){return"paths"===t[0]&&"requestBody"===t[3]&&"content"===t[4]&&"example"===t[6]},function(t){return"paths"===t[0]&&"requestBody"===t[3]&&"content"===t[4]&&"examples"===t[6]&&"value"===t[8]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"example"===t[4]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"example"===t[5]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"examples"===t[4]&&"value"===t[6]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"examples"===t[5]&&"value"===t[7]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"content"===t[4]&&"example"===t[6]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"content"===t[4]&&"examples"===t[6]&&"value"===t[8]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"content"===t[4]&&"example"===t[7]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"content"===t[5]&&"examples"===t[7]&&"value"===t[9]}],Gt={key:"$ref",plugin:function plugin(t,r,i,o){var a=o.getInstance(),c=Qe()(i).call(i,0,-1);if(!isFreelyNamed(c)&&!function shouldSkipResolution(t){return Kt.some((function(r){return r(t)}))}(c)){var u=o.getContext(i).baseDoc;if("string"!=typeof t)return new Vt("$ref: must be a string (JSON-Ref)",{$ref:t,baseDoc:u,fullPath:i});var l,d,p,h=split(t),m=h[0],g=h[1]||"";try{l=u||m?absoluteify(m,u):null}catch(r){return wrapError(r,{pointer:g,$ref:t,basePath:l,fullPath:i})}if(function pointerAlreadyInPath(t,r,i,o){var a,c,u=$t.get(o);u||(u={},$t.set(o,u));var l=function arrayToJsonPointer(t){if(0===t.length)return"";return"/".concat(U()(t).call(t,escapeJsonPointerToken).join("/"))}(i),d=V()(a="".concat(r||"<specmap-base>","#")).call(a,t),p=l.replace(/allOf\/\d+\/?/g,""),h=o.contextTree.get([]).baseDoc;if(r===h&&pointerIsAParent(p,t))return!0;var m="";if(i.some((function(t){var r;return m=V()(r="".concat(m,"/")).call(r,escapeJsonPointerToken(t)),u[m]&&u[m].some((function(t){return pointerIsAParent(t,d)||pointerIsAParent(d,t)}))})))return!0;return void(u[p]=V()(c=u[p]||[]).call(c,d))}(g,l,c,o)&&!a.useCircularStructures){var y=absolutifyPointer(t,l);return t===y?null:Rt.replace(i,y)}if(null==l?(p=jsonPointerToArray(g),void 0===(d=o.get(p))&&(d=new Vt("Could not resolve reference: ".concat(t),{pointer:g,$ref:t,baseDoc:u,fullPath:i}))):d=null!=(d=extractFromDoc(l,g)).__value?d.__value:d.catch((function(r){throw wrapError(r,{pointer:g,$ref:t,baseDoc:u,fullPath:i})})),d instanceof Error)return[Rt.remove(i),d];var v=absolutifyPointer(t,l),b=Rt.replace(c,d,{$$ref:v});if(l&&l!==u)return[b,Rt.context(c,{baseDoc:l})];try{if(!function patchValueAlreadyInPath(t,r){var i=[t];return r.path.reduce((function(t,r){return i.push(t[r]),t[r]}),t),function pointToAncestor(t){return Rt.isObject(t)&&(i.indexOf(t)>=0||W()(t).some((function(r){return pointToAncestor(t[r])})))}(r.value)}(o.state,b)||a.useCircularStructures)return b}catch(t){return null}}}},Jt=p()(Gt,{docCache:Ht,absoluteify:absoluteify,clearCache:function clearCache(t){void 0!==t?delete Ht[t]:W()(Ht).forEach((function(t){delete Ht[t]}))},JSONRefError:Vt,wrapError:wrapError,getDoc:getDoc,split:split,extractFromDoc:extractFromDoc,fetchJSON:function fetchJSON(t){return fetch(t,{headers:{Accept:"application/json, application/yaml"},loadSpec:!0}).then((function(t){return t.text()})).then((function(t){return $e.load(t)}))},extract:extract,jsonPointerToArray:jsonPointerToArray,unescapeJsonPointerToken:unescapeJsonPointerToken}),Yt=Jt;function absoluteify(t,r){if(!zt.test(t)){var i;if(!r)throw new Vt(V()(i="Tried to resolve a relative URL, without having a basePath. path: '".concat(t,"' basePath: '")).call(i,r,"'"));return y.a.resolve(r,t)}return t}function wrapError(t,r){var i,o;t&&t.response&&t.response.body?i=V()(o="".concat(t.response.body.code," ")).call(o,t.response.body.message):i=t.message;return new Vt("Could not resolve reference: ".concat(i),r,t)}function split(t){return(t+"").split("#")}function extractFromDoc(t,r){var i=Ht[t];if(i&&!Rt.isPromise(i))try{var o=extract(r,i);return p()(pt.a.resolve(o),{__value:o})}catch(t){return pt.a.reject(t)}return getDoc(t).then((function(t){return extract(r,t)}))}function getDoc(t){var r=Ht[t];return r?Rt.isPromise(r)?r:pt.a.resolve(r):(Ht[t]=Jt.fetchJSON(t).then((function(r){return Ht[t]=r,r})),Ht[t])}function extract(t,r){var i=jsonPointerToArray(t);if(i.length<1)return r;var o=Rt.getIn(r,i);if(void 0===o)throw new Vt("Could not resolve pointer: ".concat(t," does not exist in document"),{pointer:t});return o}function jsonPointerToArray(t){var r;if("string"!=typeof t)throw new TypeError("Expected a string, got a ".concat(w()(t)));return"/"===t[0]&&(t=t.substr(1)),""===t?[]:U()(r=t.split("/")).call(r,unescapeJsonPointerToken)}function unescapeJsonPointerToken(t){return"string"!=typeof t?t:new Dt.a("=".concat(t.replace(/~1/g,"/").replace(/~0/g,"~"))).get("")}function escapeJsonPointerToken(t){var r,i=new Dt.a([["",t.replace(/~/g,"~0").replace(/\//g,"~1")]]);return Qe()(r=i.toString()).call(r,1)}function pointerIsAParent(t,r){if(function pointerBoundaryChar(t){return!t||"/"===t||"#"===t}(r))return!0;var i=t.charAt(r.length),o=Qe()(r).call(r,-1);return 0===t.indexOf(r)&&(!i||"/"===i||"#"===i)&&"#"!==o}var Qt={key:"allOf",plugin:function plugin(t,r,i,o,a){if(!a.meta||!a.meta.$$ref){var c=Qe()(i).call(i,0,-1);if(!isFreelyNamed(c)){if(!Array.isArray(t)){var u=new TypeError("allOf must be an array");return u.fullPath=i,u}var d=!1,p=a.value;if(c.forEach((function(t){p&&(p=p[t])})),p=l()({},p),0!==W()(p).length){delete p.allOf;var h,m=[];if(m.push(o.replace(c,{})),t.forEach((function(t,r){if(!o.isObject(t)){if(d)return null;d=!0;var a=new TypeError("Elements in allOf must be objects");return a.fullPath=i,m.push(a)}m.push(o.mergeDeep(c,t));var u=function generateAbsoluteRefPatches(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.specmap,a=i.getBaseUrlForNodePath,c=void 0===a?function(t){var i;return o.getContext(V()(i=[]).call(i,Je()(r),Je()(t))).baseDoc}:a,u=i.targetKeys,l=void 0===u?["$ref","$$ref"]:u,d=[];return Nt()(t).forEach((function callback(){if(O()(l).call(l,this.key)&&"string"==typeof this.node){var t=this.path,i=V()(r).call(r,this.path),a=absolutifyPointer(this.node,c(t));d.push(o.replace(i,a))}})),d}(t,Qe()(i).call(i,0,-1),{getBaseUrlForNodePath:function getBaseUrlForNodePath(t){var a;return o.getContext(V()(a=[]).call(a,Je()(i),[r],Je()(t))).baseDoc},specmap:o});m.push.apply(m,Je()(u))})),m.push(o.mergeDeep(c,p)),!p.$$ref)m.push(o.remove(V()(h=[]).call(h,c,"$$ref")));return m}}}}},Xt={key:"parameters",plugin:function plugin(t,r,i,o){if(Array.isArray(t)&&t.length){var a=p()([],t),c=Qe()(i).call(i,0,-1),u=l()({},Rt.getIn(o.spec,c));return t.forEach((function(t,r){try{a[r].default=o.parameterMacro(u,t)}catch(t){var c=new Error(t);return c.fullPath=i,c}})),Rt.replace(i,a)}return Rt.replace(i,t)}},Zt={key:"properties",plugin:function plugin(t,r,i,o){var a=l()({},t);for(var c in t)try{a[c].default=o.modelPropertyMacro(a[c])}catch(t){var u=new Error(t);return u.fullPath=i,u}return Rt.replace(i,a)}},er=function(){function ContextTree(t){at()(this,ContextTree),this.root=createNode(t||{})}return ut()(ContextTree,[{key:"set",value:function set(t,r){var i=this.getParent(t,!0);if(i){var o=t[t.length-1],a=i.children;a[o]?updateNode(a[o],r,i):a[o]=createNode(r,i)}else updateNode(this.root,r,null)}},{key:"get",value:function get(t){if((t=t||[]).length<1)return this.root.value;for(var r,i,o=this.root,a=0;a<t.length&&(i=t[a],(r=o.children)[i]);a+=1)o=r[i];return o&&o.protoValue}},{key:"getParent",value:function getParent(t,r){return!t||t.length<1?null:t.length<2?this.root:Qe()(t).call(t,0,-1).reduce((function(t,i){if(!t)return t;var o=t.children;return!o[i]&&r&&(o[i]=createNode(null,t)),o[i]}),this.root)}}]),ContextTree}();function createNode(t,r){return updateNode({children:{}},t,r)}function updateNode(t,r,i){return t.value=r||{},t.protoValue=i?l()(l()({},i.protoValue),t.value):t.value,W()(t.children).forEach((function(r){var i=t.children[r];t.children[r]=updateNode(i,i.value,t)})),t}var tr=function noop(){},rr=function(){function SpecMap(t){var r,i,o=this;at()(this,SpecMap),p()(this,{spec:"",debugLevel:"info",plugins:[],pluginHistory:{},errors:[],mutations:[],promisedPatches:[],state:{},patches:[],context:{},contextTree:new er,showDebug:!1,allPatches:[],pluginProp:"specMap",libMethods:p()(Object.create(this),Rt,{getInstance:function getInstance(){return o}}),allowMetaPatches:!1},t),this.get=this._get.bind(this),this.getContext=this._getContext.bind(this),this.hasRun=this._hasRun.bind(this),this.wrappedPlugins=G()(r=U()(i=this.plugins).call(i,this.wrapPlugin.bind(this))).call(r,Rt.isFunction),this.patches.push(Rt.add([],this.spec)),this.patches.push(Rt.context([],this.context)),this.updatePatches(this.patches)}return ut()(SpecMap,[{key:"debug",value:function debug(t){if(this.debugLevel===t){for(var r,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];(r=console).log.apply(r,o)}}},{key:"verbose",value:function verbose(t){if("verbose"===this.debugLevel){for(var r,i,o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];(r=console).log.apply(r,V()(i=["[".concat(t,"] ")]).call(i,a))}}},{key:"wrapPlugin",value:function wrapPlugin(t,r){var i,o=this.pathDiscriminator,a=null;return t[this.pluginProp]?(a=t,i=t[this.pluginProp]):Rt.isFunction(t)?i=t:Rt.isObject(t)&&(i=function createKeyBasedPlugin(t){var r=function isSubPath(t,r){return!Array.isArray(t)||t.every((function(t,i){return t===r[i]}))};return C.a.mark((function generator(i,a){var c,u,l,d,p,h;return C.a.wrap((function generator$(m){for(;;)switch(m.prev=m.next){case 0:h=function _traverse(i,l,d){var p,m,g,y,v,b,_,w,S,I,k,x,P;return C.a.wrap((function traverse$(c){for(;;)switch(c.prev=c.next){case 0:if(Rt.isObject(i)){c.next=6;break}if(t.key!==l[l.length-1]){c.next=4;break}return c.next=4,t.plugin(i,t.key,l,a);case 4:c.next=30;break;case 6:p=l.length-1,m=l[p],g=l.indexOf("properties"),y="properties"===m&&p===g,v=a.allowMetaPatches&&u[i.$$ref],b=0,_=W()(i);case 12:if(!(b<_.length)){c.next=30;break}if(w=_[b],S=i[w],I=V()(l).call(l,w),k=Rt.isObject(S),x=i.$$ref,v){c.next=22;break}if(!k){c.next=22;break}return a.allowMetaPatches&&x&&(u[x]=!0),c.delegateYield(h(S,I,d),"t0",22);case 22:if(y||w!==t.key){c.next=27;break}if(P=r(o,l),o&&!P){c.next=27;break}return c.next=27,t.plugin(S,w,I,a,d);case 27:b++,c.next=12;break;case 30:case"end":return c.stop()}}),c)},c=C.a.mark(h),u={},l=b()(G()(i).call(i,Rt.isAdditiveMutation)),m.prev=4,l.s();case 6:if((d=l.n()).done){m.next=11;break}return p=d.value,m.delegateYield(h(p.value,p.path,p),"t0",9);case 9:m.next=6;break;case 11:m.next=16;break;case 13:m.prev=13,m.t1=m.catch(4),l.e(m.t1);case 16:return m.prev=16,l.f(),m.finish(16);case 19:case"end":return m.stop()}}),generator,null,[[4,13,16,19]])}))}(t)),p()(i.bind(a),{pluginName:t.name||r,isGenerator:Rt.isGenerator(i)})}},{key:"nextPlugin",value:function nextPlugin(){var t,r=this;return ft()(t=this.wrappedPlugins).call(t,(function(t){return r.getMutationsForPlugin(t).length>0}))}},{key:"nextPromisedPatch",value:function nextPromisedPatch(){var t;if(this.promisedPatches.length>0)return pt.a.race(U()(t=this.promisedPatches).call(t,(function(t){return t.value})))}},{key:"getPluginHistory",value:function getPluginHistory(t){var r=this.constructor.getPluginName(t);return this.pluginHistory[r]||[]}},{key:"getPluginRunCount",value:function getPluginRunCount(t){return this.getPluginHistory(t).length}},{key:"getPluginHistoryTip",value:function getPluginHistoryTip(t){var r=this.getPluginHistory(t);return r&&r[r.length-1]||{}}},{key:"getPluginMutationIndex",value:function getPluginMutationIndex(t){var r=this.getPluginHistoryTip(t).mutationIndex;return"number"!=typeof r?-1:r}},{key:"updatePluginHistory",value:function updatePluginHistory(t,r){var i=this.constructor.getPluginName(t);this.pluginHistory[i]=this.pluginHistory[i]||[],this.pluginHistory[i].push(r)}},{key:"updatePatches",value:function updatePatches(t){var r=this;Rt.normalizeArray(t).forEach((function(t){if(t instanceof Error)r.errors.push(t);else try{if(!Rt.isObject(t))return void r.debug("updatePatches","Got a non-object patch",t);if(r.showDebug&&r.allPatches.push(t),Rt.isPromise(t.value))return r.promisedPatches.push(t),void r.promisedPatchThen(t);if(Rt.isContextPatch(t))return void r.setContext(t.path,t.value);if(Rt.isMutation(t))return void r.updateMutations(t)}catch(t){console.error(t),r.errors.push(t)}}))}},{key:"updateMutations",value:function updateMutations(t){"object"===w()(t.value)&&!Array.isArray(t.value)&&this.allowMetaPatches&&(t.value=l()({},t.value));var r=Rt.applyPatch(this.state,t,{allowMetaPatches:this.allowMetaPatches});r&&(this.mutations.push(t),this.state=r)}},{key:"removePromisedPatch",value:function removePromisedPatch(t){var r,i=this.promisedPatches.indexOf(t);i<0?this.debug("Tried to remove a promisedPatch that isn't there!"):mt()(r=this.promisedPatches).call(r,i,1)}},{key:"promisedPatchThen",value:function promisedPatchThen(t){var r=this;return t.value=t.value.then((function(i){var o=l()(l()({},t),{},{value:i});r.removePromisedPatch(t),r.updatePatches(o)})).catch((function(i){r.removePromisedPatch(t),r.updatePatches(i)})),t.value}},{key:"getMutations",value:function getMutations(t,r){var i;return t=t||0,"number"!=typeof r&&(r=this.mutations.length),Qe()(i=this.mutations).call(i,t,r)}},{key:"getCurrentMutations",value:function getCurrentMutations(){return this.getMutationsForPlugin(this.getCurrentPlugin())}},{key:"getMutationsForPlugin",value:function getMutationsForPlugin(t){var r=this.getPluginMutationIndex(t);return this.getMutations(r+1)}},{key:"getCurrentPlugin",value:function getCurrentPlugin(){return this.currentPlugin}},{key:"getLib",value:function getLib(){return this.libMethods}},{key:"_get",value:function _get(t){return Rt.getIn(this.state,t)}},{key:"_getContext",value:function _getContext(t){return this.contextTree.get(t)}},{key:"setContext",value:function setContext(t,r){return this.contextTree.set(t,r)}},{key:"_hasRun",value:function _hasRun(t){return this.getPluginRunCount(this.getCurrentPlugin())>(t||0)}},{key:"dispatch",value:function dispatch(){var t,r=this,i=this,o=this.nextPlugin();if(!o){var a=this.nextPromisedPatch();if(a)return a.then((function(){return r.dispatch()})).catch((function(){return r.dispatch()}));var c={spec:this.state,errors:this.errors};return this.showDebug&&(c.patches=this.allPatches),pt.a.resolve(c)}if(i.pluginCount=i.pluginCount||{},i.pluginCount[o]=(i.pluginCount[o]||0)+1,i.pluginCount[o]>100)return pt.a.resolve({spec:i.state,errors:V()(t=i.errors).call(t,new Error("We've reached a hard limit of ".concat(100," plugin runs")))});if(o!==this.currentPlugin&&this.promisedPatches.length){var u,l=U()(u=this.promisedPatches).call(u,(function(t){return t.value}));return pt.a.all(U()(l).call(l,(function(t){return t.then(tr,tr)}))).then((function(){return r.dispatch()}))}return function executePlugin(){i.currentPlugin=o;var t=i.getCurrentMutations(),r=i.mutations.length-1;try{if(o.isGenerator){var a,c=b()(o(t,i.getLib()));try{for(c.s();!(a=c.n()).done;){updatePatches(a.value)}}catch(t){c.e(t)}finally{c.f()}}else{updatePatches(o(t,i.getLib()))}}catch(t){console.error(t),updatePatches([p()(Object.create(t),{plugin:o})])}finally{i.updatePluginHistory(o,{mutationIndex:r})}return i.dispatch()}();function updatePatches(t){t&&(t=Rt.fullyNormalizeArray(t),i.updatePatches(t,o))}}}],[{key:"getPluginName",value:function getPluginName(t){return t.pluginName}},{key:"getPatchesOfType",value:function getPatchesOfType(t,r){return G()(t).call(t,r)}}]),SpecMap}();var nr={refs:Yt,allOf:Qt,parameters:Xt,properties:Zt},ir=function toLower(t){return String.prototype.toLowerCase.call(t)},or=function escapeString(t){return t.replace(/[^\w]/gi,"_")};function isOAS3(t){var r=t.openapi;return!!r&&m()(r).call(r,"3")}function opId(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=o.v2OperationIdCompatibilityMode;if(!t||"object"!==w()(t))return null;var c=(t.operationId||"").replace(/\s/g,"");return c.length?or(t.operationId):idFromPathMethod(r,i,{v2OperationIdCompatibilityMode:a})}function idFromPathMethod(t,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.v2OperationIdCompatibilityMode;if(a){var c,u,l=V()(c="".concat(r.toLowerCase(),"_")).call(c,t).replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return(l=l||V()(u="".concat(t.substring(1),"_")).call(u,r)).replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return V()(i="".concat(ir(r))).call(i,or(t))}function legacyIdFromPathMethod(t,r){var i;return V()(i="".concat(ir(r),"-")).call(i,t)}function getOperationRaw(t,r){return t&&t.paths?function findOperation(t,r){return eachOperation(t,r,!0)||null}(t,(function(t){var i=t.pathName,o=t.method,a=t.operation;if(!a||"object"!==w()(a))return!1;var c=a.operationId;return[opId(a,i,o),legacyIdFromPathMethod(i,o),c].some((function(t){return t&&t===r}))})):null}function eachOperation(t,r,i){if(!t||"object"!==w()(t)||!t.paths||"object"!==w()(t.paths))return null;var o=t.paths;for(var a in o)for(var c in o[a])if("PARAMETERS"!==c.toUpperCase()){var u=o[a][c];if(u&&"object"===w()(u)){var l={spec:t,pathName:a,method:c.toUpperCase(),operation:u},d=r(l);if(i&&d)return l}}}function normalizeSwagger(t){var r=t.spec,i=r.paths,o={};if(!i||r.$$normalized)return t;for(var a in i){var c,u=i[a];if(null!=u&&O()(c=["object","function"]).call(c,w()(u))){var l=u.parameters,d=function _loop(t){var i,c=u[t];if(null==u||!O()(i=["object","function"]).call(i,w()(u)))return"continue";var d=opId(c,a,t);if(d){o[d]?o[d].push(c):o[d]=[c];var p=o[d];if(p.length>1)p.forEach((function(t,r){var i;t.__originalOperationId=t.__originalOperationId||t.operationId,t.operationId=V()(i="".concat(d)).call(i,r+1)}));else if(void 0!==c.operationId){var h=p[0];h.__originalOperationId=h.__originalOperationId||c.operationId,h.operationId=d}}if("parameters"!==t){var m=[],g={};for(var y in r)"produces"!==y&&"consumes"!==y&&"security"!==y||(g[y]=r[y],m.push(g));if(l&&(g.parameters=l,m.push(g)),m.length){var v,_=b()(m);try{for(_.s();!(v=_.n()).done;){var S=v.value;for(var I in S)if(c[I]){if("parameters"===I){var k,x=b()(S[I]);try{var P=function _loop2(){var t=k.value;c[I].some((function(r){return r.name&&r.name===t.name||r.$ref&&r.$ref===t.$ref||r.$$ref&&r.$$ref===t.$$ref||r===t}))||c[I].push(t)};for(x.s();!(k=x.n()).done;)P()}catch(t){x.e(t)}finally{x.f()}}}else c[I]=S[I]}}catch(t){_.e(t)}finally{_.f()}}}};for(var p in u)d(p)}}return r.$$normalized=!0,t}function makeFetchJSON(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.requestInterceptor,o=r.responseInterceptor,a=t.withCredentials?"include":"same-origin";return function(r){return t({url:r,loadSpec:!0,requestInterceptor:i,responseInterceptor:o,headers:{Accept:"application/json, application/yaml"},credentials:a}).then((function(t){return t.body}))}}function resolver_resolve(t){var r=t.fetch,i=t.spec,o=t.url,a=t.mode,c=t.allowMetaPatches,u=void 0===c||c,l=t.pathDiscriminator,d=t.modelPropertyMacro,p=t.parameterMacro,h=t.requestInterceptor,m=t.responseInterceptor,g=t.skipNormalization,y=t.useCircularStructures,v=t.http,b=t.baseDoc;return b=b||o,v=r||v||http_http,i?doResolve(i):makeFetchJSON(v,{requestInterceptor:h,responseInterceptor:m})(b).then(doResolve);function doResolve(t){b&&(nr.refs.docCache[b]=t),nr.refs.fetchJSON=makeFetchJSON(v,{requestInterceptor:h,responseInterceptor:m});var r=[nr.refs];return"function"==typeof p&&r.push(nr.parameters),"function"==typeof d&&r.push(nr.properties),"strict"!==a&&r.push(nr.allOf),function mapSpec(t){return new rr(t).dispatch()}({spec:t,context:{baseDoc:b},plugins:r,allowMetaPatches:u,pathDiscriminator:l,parameterMacro:p,modelPropertyMacro:d,useCircularStructures:y}).then(g?function(){var t=x()(C.a.mark((function _callee(t){return C.a.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",t);case 1:case"end":return r.stop()}}),_callee)})));return function(r){return t.apply(this,arguments)}}():normalizeSwagger)}}var sr=i(61),ar=i.n(sr);function _resolveSubtree(){return(_resolveSubtree=x()(C.a.mark((function _callee(t,r){var i,o,a,c,u,d,p,h,m,g,y,v,b=arguments;return C.a.wrap((function _callee$(_){for(;;)switch(_.prev=_.next){case 0:return i=b.length>2&&void 0!==b[2]?b[2]:{},o=i.returnEntireTree,a=i.baseDoc,c=i.requestInterceptor,u=i.responseInterceptor,d=i.parameterMacro,p=i.modelPropertyMacro,h=i.useCircularStructures,m={pathDiscriminator:r,baseDoc:a,requestInterceptor:c,responseInterceptor:u,parameterMacro:d,modelPropertyMacro:p,useCircularStructures:h},g=normalizeSwagger({spec:t}),y=g.spec,_.next=6,resolver_resolve(l()(l()({},m),{},{spec:y,allowMetaPatches:!0,skipNormalization:!0}));case 6:return v=_.sent,!o&&Array.isArray(r)&&r.length&&(v.spec=ar()(v.spec,r)||null),_.abrupt("return",v);case 9:case"end":return _.stop()}}),_callee)})))).apply(this,arguments)}var cr=function nullFn(){return null},ur={mapTagOperations:function mapTagOperations(t){var r=t.spec,i=t.cb,o=void 0===i?cr:i,a=t.defaultTag,c=void 0===a?"default":a,u=t.v2OperationIdCompatibilityMode,l={},d={};return eachOperation(r,(function(t){var i=t.pathName,a=t.method,p=t.operation;(p.tags?function normalizeArray(t){return Array.isArray(t)?t:[t]}(p.tags):[c]).forEach((function(t){if("string"==typeof t){d[t]=d[t]||{};var c,h=d[t],m=opId(p,i,a,{v2OperationIdCompatibilityMode:u}),g=o({spec:r,pathName:i,method:a,operation:p,operationId:m});if(l[m])l[m]+=1,h[V()(c="".concat(m)).call(c,l[m])]=g;else if(void 0!==h[m]){var y,v,b=l[m]||1;l[m]=b+1,h[V()(y="".concat(m)).call(y,l[m])]=g;var _=h[m];delete h[m],h[V()(v="".concat(m)).call(v,b)]=_}else h[m]=g}}))})),d},makeExecute:function makeExecute(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var i=r.pathName,o=r.method,a=r.operationId;return function(r){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=t.requestInterceptor,d=t.responseInterceptor,p=t.userFetch;return t.execute(l()({spec:t.spec,requestInterceptor:u,responseInterceptor:d,userFetch:p,pathName:i,method:o,parameters:r,operationId:a},c))}}}};var lr=i(352),fr=i.n(lr),dr=i(353),pr=i.n(dr);function is_plain_object_isObject(t){return"[object Object]"===Object.prototype.toString.call(t)}function isPlainObject(t){var r,i;return!1!==is_plain_object_isObject(t)&&(void 0===(r=t.constructor)||!1!==is_plain_object_isObject(i=r.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf"))}var hr={body:function bodyBuilder(t){var r=t.req,i=t.value;r.body=i},header:function headerBuilder(t){var r=t.req,i=t.parameter,o=t.value;r.headers=r.headers||{},void 0!==o&&(r.headers[i.name]=o)},query:function queryBuilder(t){var r=t.req,i=t.value,o=t.parameter;r.query=r.query||{},!1===i&&"boolean"===o.type&&(i="false");0===i&&["number","integer"].indexOf(o.type)>-1&&(i="0");if(i)r.query[o.name]={collectionFormat:o.collectionFormat,value:i};else if(o.allowEmptyValue&&void 0!==i){var a=o.name;r.query[a]=r.query[a]||{},r.query[a].allowEmptyValue=!0}},path:function pathBuilder(t){var r=t.req,i=t.value,o=t.parameter;r.url=r.url.split("{".concat(o.name,"}")).join(encodeURIComponent(i))},formData:function formDataBuilder(t){var r=t.req,i=t.value,o=t.parameter;(i||o.allowEmptyValue)&&(r.form=r.form||{},r.form[o.name]={value:i,allowEmptyValue:o.allowEmptyValue,collectionFormat:o.collectionFormat})}};function serialize(t,r){return O()(r).call(r,"application/json")?"string"==typeof t?t:B()(t):t.toString()}function parameter_builders_path(t){var r=t.req,i=t.value,o=t.parameter,a=o.name,c=o.style,u=o.explode,l=o.content;if(l){var d=W()(l)[0];r.url=r.url.split("{".concat(a,"}")).join(encodeDisallowedCharacters(serialize(i,d),{escape:!0}))}else{var p=stylize({key:o.name,value:i,style:c||"simple",explode:u||!1,escape:!0});r.url=r.url.split("{".concat(a,"}")).join(p)}}function parameter_builders_query(t){var r=t.req,i=t.value,o=t.parameter;if(r.query=r.query||{},o.content){var a=W()(o.content)[0];r.query[o.name]=serialize(i,a)}else if(!1===i&&(i="false"),0===i&&(i="0"),i){var c=o.style,u=o.explode,l=o.allowReserved;r.query[o.name]={value:i,serializationOption:{style:c,explode:u,allowReserved:l}}}else if(o.allowEmptyValue&&void 0!==i){var d=o.name;r.query[d]=r.query[d]||{},r.query[d].allowEmptyValue=!0}}var mr=["accept","authorization","content-type"];function parameter_builders_header(t){var r=t.req,i=t.parameter,o=t.value;if(r.headers=r.headers||{},!(mr.indexOf(i.name.toLowerCase())>-1))if(i.content){var a=W()(i.content)[0];r.headers[i.name]=serialize(o,a)}else void 0!==o&&(r.headers[i.name]=stylize({key:i.name,value:o,style:i.style||"simple",explode:void 0!==i.explode&&i.explode,escape:!1}))}function parameter_builders_cookie(t){var r=t.req,i=t.parameter,o=t.value;r.headers=r.headers||{};var a=w()(o);if(i.content){var c,u=W()(i.content)[0];r.headers.Cookie=V()(c="".concat(i.name,"=")).call(c,serialize(o,u))}else if("undefined"!==a){var l="object"===a&&!Array.isArray(o)&&i.explode?"":"".concat(i.name,"=");r.headers.Cookie=l+stylize({key:i.name,value:o,escape:!1,style:i.style||"form",explode:void 0!==i.explode&&i.explode})}}var gr=i(159),yr=i.n(gr);function buildRequest(t,r){var i=t.operation,o=t.requestBody,a=t.securities,c=t.spec,u=t.attachContentTypeForEmptyPayload,d=t.requestContentType;r=function applySecurities(t){var r=t.request,i=t.securities,o=void 0===i?{}:i,a=t.operation,c=void 0===a?{}:a,u=t.spec,d=l()({},r),p=o.authorized,h=void 0===p?{}:p,m=c.security||u.security||[],g=h&&!!W()(h).length,y=ar()(u,["components","securitySchemes"])||{};if(d.headers=d.headers||{},d.query=d.query||{},!W()(o).length||!g||!m||Array.isArray(c.security)&&!c.security.length)return r;return m.forEach((function(t){W()(t).forEach((function(t){var r=h[t],i=y[t];if(r){var o=r.value||r,a=i.type;if(r)if("apiKey"===a)"query"===i.in&&(d.query[i.name]=o),"header"===i.in&&(d.headers[i.name]=o),"cookie"===i.in&&(d.cookies[i.name]=o);else if("http"===a){if(/^basic$/i.test(i.scheme)){var c,u=o.username||"",l=o.password||"",p=yr()(V()(c="".concat(u,":")).call(c,l));d.headers.Authorization="Basic ".concat(p)}/^bearer$/i.test(i.scheme)&&(d.headers.Authorization="Bearer ".concat(o))}else if("oauth2"===a||"openIdConnect"===a){var m,g=r.token||{},v=g[i["x-tokenName"]||"access_token"],b=g.token_type;b&&"bearer"!==b.toLowerCase()||(b="Bearer"),d.headers.Authorization=V()(m="".concat(b," ")).call(m,v)}}}))})),d}({request:r,securities:a,operation:i,spec:c});var p=i.requestBody||{},h=W()(p.content||{}),m=d&&h.indexOf(d)>-1;if(o||u){if(d&&m)r.headers["Content-Type"]=d;else if(!d){var g=h[0];g&&(r.headers["Content-Type"]=g,d=g)}}else d&&m&&(r.headers["Content-Type"]=d);if(!t.responseContentType&&i.responses){var y,v=G()(y=$()(i.responses)).call(y,(function(t){var r=I()(t,2),i=r[0],o=r[1],a=parseInt(i,10);return a>=200&&a<300&&isPlainObject(o.content)})).reduce((function(t,r){var i=I()(r,2)[1];return V()(t).call(t,W()(i.content))}),[]);v.length>0&&(r.headers.accept=v.join(", "))}if(o)if(d){if(h.indexOf(d)>-1)if("application/x-www-form-urlencoded"===d||"multipart/form-data"===d)if("object"===w()(o)){var b=(p.content[d]||{}).encoding||{};r.form={},W()(o).forEach((function(t){r.form[t]={value:o[t],encoding:b[t]||{}}}))}else r.form=o;else r.body=o}else r.body=o;return r}function build_request_buildRequest(t,r){var i,o,a=t.spec,c=t.operation,u=t.securities,d=t.requestContentType,p=t.responseContentType,h=t.attachContentTypeForEmptyPayload;if((r=function build_request_applySecurities(t){var r=t.request,i=t.securities,o=void 0===i?{}:i,a=t.operation,c=void 0===a?{}:a,u=t.spec,d=l()({},r),p=o.authorized,h=void 0===p?{}:p,m=o.specSecurity,g=void 0===m?[]:m,y=c.security||g,v=h&&!!W()(h).length,b=u.securityDefinitions;if(d.headers=d.headers||{},d.query=d.query||{},!W()(o).length||!v||!y||Array.isArray(c.security)&&!c.security.length)return r;return y.forEach((function(t){W()(t).forEach((function(t){var r=h[t];if(r){var i=r.token,o=r.value||r,a=b[t],c=a.type,u=a["x-tokenName"]||"access_token",l=i&&i[u],p=i&&i.token_type;if(r)if("apiKey"===c){var m="query"===a.in?"query":"headers";d[m]=d[m]||{},d[m][a.name]=o}else if("basic"===c)if(o.header)d.headers.authorization=o.header;else{var g,y=o.username||"",v=o.password||"";o.base64=yr()(V()(g="".concat(y,":")).call(g,v)),d.headers.authorization="Basic ".concat(o.base64)}else if("oauth2"===c&&l){var _;p=p&&"bearer"!==p.toLowerCase()?p:"Bearer",d.headers.authorization=V()(_="".concat(p," ")).call(_,l)}}}))})),d}({request:r,securities:u,operation:c,spec:a})).body||r.form||h)if(d)r.headers["Content-Type"]=d;else if(Array.isArray(c.consumes)){var m=I()(c.consumes,1);r.headers["Content-Type"]=m[0]}else if(Array.isArray(a.consumes)){var g=I()(a.consumes,1);r.headers["Content-Type"]=g[0]}else c.parameters&&G()(i=c.parameters).call(i,(function(t){return"file"===t.type})).length?r.headers["Content-Type"]="multipart/form-data":c.parameters&&G()(o=c.parameters).call(o,(function(t){return"formData"===t.in})).length&&(r.headers["Content-Type"]="application/x-www-form-urlencoded");else if(d){var y,v,b=c.parameters&&G()(y=c.parameters).call(y,(function(t){return"body"===t.in})).length>0,_=c.parameters&&G()(v=c.parameters).call(v,(function(t){return"formData"===t.in})).length>0;(b||_)&&(r.headers["Content-Type"]=d)}return!p&&Array.isArray(c.produces)&&c.produces.length>0&&(r.headers.accept=c.produces.join(", ")),r}var vr=["http","fetch","spec","operationId","pathName","method","parameters","securities"],br=function arrayOrEmpty(t){return Array.isArray(t)?t:[]},_r=createErrorType("OperationNotFoundError",(function cb(t,r,i){this.originalError=i,p()(this,r||{})})),wr={buildRequest:execute_buildRequest};function execute_buildRequest(t){var r,i,o=t.spec,a=t.operationId,u=t.responseContentType,d=t.scheme,p=t.requestInterceptor,h=t.responseInterceptor,m=t.contextUrl,g=t.userFetch,y=t.server,v=t.serverVariables,b=t.http,_=t.signal,w=t.parameters,S=t.parameterBuilders,I=isOAS3(o);S||(S=I?c:hr);var k={url:"",credentials:b&&b.withCredentials?"include":"same-origin",headers:{},cookies:{}};_&&(k.signal=_),p&&(k.requestInterceptor=p),h&&(k.responseInterceptor=h),g&&(k.userFetch=g);var x=getOperationRaw(o,a);if(!x)throw new _r("Operation ".concat(a," not found"));var P=x.operation,C=void 0===P?{}:P,A=x.method,O=x.pathName;if(k.url+=execute_baseUrl({spec:o,scheme:d,contextUrl:m,server:y,serverVariables:v,pathName:O,method:A}),!a)return delete k.cookies,k;k.url+=O,k.method="".concat(A).toUpperCase(),w=w||{};var R=o.paths[O]||{};u&&(k.headers.accept=u);var M=function deduplicateParameters(t){var r={};t.forEach((function(t){r[t.in]||(r[t.in]={}),r[t.in][t.name]=t}));var i=[];return W()(r).forEach((function(t){W()(r[t]).forEach((function(o){i.push(r[t][o])}))})),i}(V()(r=V()(i=[]).call(i,br(C.parameters))).call(r,br(R.parameters)));M.forEach((function(t){var r,i,a=S[t.in];if("body"===t.in&&t.schema&&t.schema.properties&&(r=w),void 0===(r=t&&t.name&&w[t.name]))r=t&&t.name&&w[V()(i="".concat(t.in,".")).call(i,t.name)];else if(function findParametersWithName(t,r){return G()(r).call(r,(function(r){return r.name===t}))}(t.name,M).length>1){var c;console.warn(V()(c="Parameter '".concat(t.name,"' is ambiguous because the defined spec has more than one parameter with the name: '")).call(c,t.name,"' and the passed-in parameter values did not define an 'in' value."))}if(null!==r){if(void 0!==t.default&&void 0===r&&(r=t.default),void 0===r&&t.required&&!t.allowEmptyValue)throw new Error("Required parameter ".concat(t.name," is not provided"));if(I&&t.schema&&"object"===t.schema.type&&"string"==typeof r)try{r=JSON.parse(r)}catch(t){throw new Error("Could not parse object parameter value string as JSON")}a&&a({req:k,parameter:t,value:r,operation:C,spec:o})}}));var j=l()(l()({},t),{},{operation:C});if((k=I?buildRequest(j,k):build_request_buildRequest(j,k)).cookies&&W()(k.cookies).length){var L=W()(k.cookies).reduce((function(t,r){var i=k.cookies[r];return t+(t?"&":"")+pr.a.serialize(r,i)}),"");k.headers.Cookie=L}return k.cookies&&delete k.cookies,mergeInQueryOrForm(k),k}var Sr=function stripNonAlpha(t){return t?t.replace(/\W/g,""):null};function execute_baseUrl(t){return isOAS3(t.spec)?function oas3BaseUrl(t){var r=t.spec,i=t.pathName,o=t.method,a=t.server,c=t.contextUrl,u=t.serverVariables,l=void 0===u?{}:u,d=ar()(r,["paths",i,(o||"").toLowerCase(),"servers"])||ar()(r,["paths",i,"servers"])||ar()(r,["servers"]),p="",h=null;if(a&&d&&d.length){var m=U()(d).call(d,(function(t){return t.url}));m.indexOf(a)>-1&&(p=a,h=d[m.indexOf(a)])}if(!p&&d&&d.length){p=d[0].url;var g=I()(d,1);h=g[0]}if(p.indexOf("{")>-1){(function getVariableTemplateNames(t){var r,i=[],o=/{([^}]+)}/g;for(;r=o.exec(t);)i.push(r[1]);return i})(p).forEach((function(t){if(h.variables&&h.variables[t]){var r=h.variables[t],i=l[t]||r.default,o=new RegExp("{".concat(t,"}"),"g");p=p.replace(o,i)}}))}return function buildOas3UrlWithContext(){var t,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=i&&o?y.a.parse(y.a.resolve(o,i)):y.a.parse(i),c=y.a.parse(o),u=Sr(a.protocol)||Sr(c.protocol)||"",l=a.host||c.host,d=a.pathname||"";t=u&&l?V()(r="".concat(u,"://")).call(r,l+d):d;return"/"===t[t.length-1]?Qe()(t).call(t,0,-1):t}(p,c)}(t):function swagger2BaseUrl(t){var r,i,o=t.spec,a=t.scheme,c=t.contextUrl,u=void 0===c?"":c,l=y.a.parse(u),d=Array.isArray(o.schemes)?o.schemes[0]:null,p=a||d||Sr(l.protocol)||"http",h=o.host||l.host||"",m=o.basePath||"";r=p&&h?V()(i="".concat(p,"://")).call(i,h+m):m;return"/"===r[r.length-1]?Qe()(r).call(r,0,-1):r}(t)}function Swagger(t){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t?i.url=t:i=t,!(this instanceof Swagger))return new Swagger(i);p()(this,i);var o=this.resolve().then((function(){return r.disableInterfaces||p()(r,Swagger.makeApisTagOperation(r)),r}));return o.client=this,o}Swagger.http=http_http,Swagger.makeHttp=function makeHttp(t,r,i){return i=i||function(t){return t},r=r||function(t){return t},function(o){return"string"==typeof o&&(o={url:o}),tt.mergeInQueryOrForm(o),o=r(o),i(t(o))}}.bind(null,Swagger.http),Swagger.resolve=resolver_resolve,Swagger.resolveSubtree=function resolveSubtree(t,r){return _resolveSubtree.apply(this,arguments)},Swagger.execute=function execute_execute(t){var r=t.http,i=t.fetch,o=t.spec,a=t.operationId,c=t.pathName,u=t.method,d=t.parameters,p=t.securities,h=fr()(t,vr),m=r||i||http_http;c&&u&&!a&&(a=legacyIdFromPathMethod(c,u));var g=wr.buildRequest(l()({spec:o,operationId:a,parameters:d,securities:p,http:m},h));return g.body&&(isPlainObject(g.body)||Array.isArray(g.body))&&(g.body=B()(g.body)),m(g)},Swagger.serializeRes=serializeRes,Swagger.serializeHeaders=serializeHeaders,Swagger.clearCache=function resolver_clearCache(){nr.refs.clearCache()},Swagger.makeApisTagOperation=function makeApisTagOperation(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=ur.makeExecute(t);return{apis:ur.mapTagOperations({v2OperationIdCompatibilityMode:t.v2OperationIdCompatibilityMode,spec:t.spec,cb:r})}},Swagger.buildRequest=execute_buildRequest,Swagger.helpers={opId:opId},Swagger.getBaseUrl=execute_baseUrl,Swagger.prototype={http:http_http,execute:function execute(t){return this.applyDefaults(),Swagger.execute(l()({spec:this.spec,http:this.http,securities:{authorized:this.authorizations},contextUrl:"string"==typeof this.url?this.url:void 0,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null},t))},resolve:function resolve(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Swagger.resolve(l()({spec:this.spec,url:this.url,http:this.http||this.fetch,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null,skipNormalization:this.skipNormalization||!1},r)).then((function(r){return t.originalSpec=t.spec,t.spec=r.spec,t.errors=r.errors,t}))}},Swagger.prototype.applyDefaults=function applyDefaults(){var t=this.spec,r=this.url;if(r&&m()(r).call(r,"http")){var i=y.a.parse(r);t.host||(t.host=i.host),t.schemes||(t.schemes=[i.protocol.replace(":","")]),t.basePath||(t.basePath="/")}};Swagger.helpers,r.a=Swagger},function(t,r,i){"use strict";var o=i(362);t.exports=o},function(t,r,i){"use strict";var o=i(20),a=i(18),c=i(100),u=i(163),l=i(364),d=i(10),p=TypeError,h=d("toPrimitive");t.exports=function(t,r){if(!a(t)||c(t))return t;var i,d=u(t,h);if(d){if(void 0===r&&(r="default"),i=o(d,t,r),!a(i)||c(i))return i;throw new p("Can't convert object to primitive value")}return void 0===r&&(r="number"),l(t,r)}},function(t,r,i){"use strict";var o=i(79);t.exports=o&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,r,i){"use strict";var o=i(13),a=i(8),c=i(164);t.exports=!o&&!a((function(){return 7!==Object.defineProperty(c("div"),"a",{get:function(){return 7}}).a}))},function(t,r,i){"use strict";var o=i(8),a=i(12),c=/#|\.prototype\./,isForced=function(t,r){var i=l[u(t)];return i===p||i!==d&&(a(r)?o(r):!!r)},u=isForced.normalize=function(t){return String(t).replace(c,".").toLowerCase()},l=isForced.data={},d=isForced.NATIVE="N",p=isForced.POLYFILL="P";t.exports=isForced},function(t,r,i){"use strict";var o=i(13),a=i(8);t.exports=o&&a((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},function(t,r,i){"use strict";var o=i(9),a=i(21),c=i(38),u=i(165).indexOf,l=i(103),d=o([].push);t.exports=function(t,r){var i,o=c(t),p=0,h=[];for(i in o)!a(l,i)&&a(o,i)&&d(h,i);for(;r.length>p;)a(o,i=r[p++])&&(~u(h,i)||d(h,i));return h}},function(t,r,i){"use strict";t.exports=i(367)},function(t,r,i){"use strict";i(371),i(374),i(375),i(235),i(377)},function(t,r,i){"use strict";var o=i(28);t.exports=o("document","documentElement")},function(t,r,i){"use strict";var o=i(43),a=i(38),c=i(129).f,u=i(83),l="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function getOwnPropertyNames(t){return l&&"Window"===o(t)?function(t){try{return c(t)}catch(t){return u(l)}}(t):c(a(t))}},function(t,r,i){"use strict";var o=i(20),a=i(28),c=i(10),u=i(48);t.exports=function(){var t=a("Symbol"),r=t&&t.prototype,i=r&&r.valueOf,l=c("toPrimitive");r&&!r[l]&&u(r,l,(function(t){return o(i,this)}),{arity:1})}},function(t,r,i){"use strict";var o=i(11),a=i(12),c=o.WeakMap;t.exports=a(c)&&/native code/.test(String(c))},function(t,r,i){"use strict";var o=i(9),a=i(12),c=i(126),u=o(Function.toString);a(c.inspectSource)||(c.inspectSource=function(t){return u(t)}),t.exports=c.inspectSource},function(t,r,i){"use strict";var o=i(79);t.exports=o&&!!Symbol.for&&!!Symbol.keyFor},function(t,r,i){"use strict";var o=i(1),a=i(28),c=i(99),u=i(20),l=i(9),d=i(8),p=i(12),h=i(100),m=i(83),g=i(376),y=i(79),v=String,b=a("JSON","stringify"),_=l(/./.exec),w=l("".charAt),S=l("".charCodeAt),I=l("".replace),k=l(1..toString),x=/[\uD800-\uDFFF]/g,P=/^[\uD800-\uDBFF]$/,C=/^[\uDC00-\uDFFF]$/,A=!y||d((function(){var t=a("Symbol")("stringify detection");return"[null]"!==b([t])||"{}"!==b({a:t})||"{}"!==b(Object(t))})),O=d((function(){return'"\\udf06\\ud834"'!==b("\udf06\ud834")||'"\\udead"'!==b("\udead")})),stringifyWithSymbolsFix=function(t,r){var i=m(arguments),o=g(r);if(p(o)||void 0!==t&&!h(t))return i[1]=function(t,r){if(p(o)&&(r=u(o,this,v(t),r)),!h(r))return r},c(b,null,i)},fixIllFormed=function(t,r,i){var o=w(i,r-1),a=w(i,r+1);return _(P,t)&&!_(C,a)||_(C,t)&&!_(P,o)?"\\u"+k(S(t,0),16):t};b&&o({target:"JSON",stat:!0,arity:3,forced:A||O},{stringify:function stringify(t,r,i){var o=m(arguments),a=c(A?stringifyWithSymbolsFix:b,null,o);return O&&"string"==typeof a?I(a,x,fixIllFormed):a}})},function(t,r,i){"use strict";var o=i(381);t.exports=o},function(t,r,i){"use strict";var o=i(13),a=i(66),c=TypeError,u=Object.getOwnPropertyDescriptor,l=o&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=l?function(t,r){if(a(t)&&!u(t,"length").writable)throw new c("Cannot set read only .length");return t.length=r}:function(t,r){return t.length=r}},function(t,r,i){"use strict";t.exports=i(396)},function(t,r,i){"use strict";var o=i(8);t.exports=function(t,r){var i=[][t];return!!i&&o((function(){i.call(null,r||function(){return 1},1)}))}},function(t,r,i){"use strict";var o=i(28),a=i(9),c=i(129),u=i(130),l=i(33),d=a([].concat);t.exports=o("Reflect","ownKeys")||function ownKeys(t){var r=c.f(l(t)),i=u.f;return i?d(r,i(t)):r}},function(t,r,i){var o=i(7).default,a=i(465);t.exports=function toPropertyKey(t){var r=a(t,"string");return"symbol"==o(r)?r:r+""},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(1),a=i(8),c=i(66),u=i(18),l=i(36),d=i(57),p=i(174),h=i(105),m=i(172),g=i(104),y=i(10),v=i(124),b=y("isConcatSpreadable"),_=v>=51||!a((function(){var t=[];return t[b]=!1,t.concat()[0]!==t})),isConcatSpreadable=function(t){if(!u(t))return!1;var r=t[b];return void 0!==r?!!r:c(t)};o({target:"Array",proto:!0,arity:1,forced:!_||!g("concat")},{concat:function concat(t){var r,i,o,a,c,u=l(this),g=m(u,0),y=0;for(r=-1,o=arguments.length;r<o;r++)if(isConcatSpreadable(c=-1===r?u:arguments[r]))for(a=d(c),p(y+a),i=0;i<a;i++,y++)i in c&&h(g,y,c[i]);else p(y+1),h(g,y++,c);return g.length=y,g}})},function(t,r,i){"use strict";i(14)("iterator")},function(t,r,i){"use strict";var o=i(14),a=i(231);o("toPrimitive"),a()},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(35),u=i(440),l=i(12),d=i(246),p=i(108),h=i(134),m=i(49),g=i(47),y=i(48),v=i(10),b=i(84),_=i(247),w=u.PROPER,S=u.CONFIGURABLE,I=_.IteratorPrototype,k=_.BUGGY_SAFARI_ITERATORS,x=v("iterator"),returnThis=function(){return this};t.exports=function(t,r,i,u,v,_,P){d(i,r,u);var C,A,O,getIterationMethod=function(t){if(t===v&&D)return D;if(!k&&t&&t in j)return j[t];switch(t){case"keys":return function keys(){return new i(this,t)};case"values":return function values(){return new i(this,t)};case"entries":return function entries(){return new i(this,t)}}return function(){return new i(this)}},R=r+" Iterator",M=!1,j=t.prototype,L=j[x]||j["@@iterator"]||v&&j[v],D=!k&&L||getIterationMethod(v),B="Array"===r&&j.entries||L;if(B&&(C=p(B.call(new t)))!==Object.prototype&&C.next&&(c||p(C)===I||(h?h(C,I):l(C[x])||y(C,x,returnThis)),m(C,R,!0,!0),c&&(b[R]=returnThis)),w&&"values"===v&&L&&"values"!==L.name&&(!c&&S?g(j,"name","values"):(M=!0,D=function values(){return a(L,this)})),v)if(A={values:getIterationMethod("values"),keys:_?D:getIterationMethod("keys"),entries:getIterationMethod("entries")},P)for(O in A)(k||M||!(O in j))&&y(j,O,A[O]);else o({target:r,proto:!0,forced:k||M},A);return c&&!P||j[x]===D||y(j,x,D,{name:v}),b[r]=D,A}},function(t,r,i){"use strict";var o=i(247).IteratorPrototype,a=i(82),c=i(55),u=i(49),l=i(84),returnThis=function(){return this};t.exports=function(t,r,i,d){var p=r+" Iterator";return t.prototype=a(o,{next:c(+!d,i)}),u(t,p,!1,!0),l[p]=returnThis,t}},function(t,r,i){"use strict";var o,a,c,u=i(8),l=i(12),d=i(18),p=i(82),h=i(108),m=i(48),g=i(10),y=i(35),v=g("iterator"),b=!1;[].keys&&("next"in(c=[].keys())?(a=h(h(c)))!==Object.prototype&&(o=a):b=!0),!d(o)||u((function(){var t={};return o[v].call(t)!==t}))?o={}:y&&(o=p(o)),l(o[v])||m(o,v,(function(){return this})),t.exports={IteratorPrototype:o,BUGGY_SAFARI_ITERATORS:b}},function(t,r,i){"use strict";var o=i(8);t.exports=!o((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype}))},function(t,r,i){"use strict";var o=i(28),a=i(9),c=o("Symbol"),u=c.keyFor,l=a(c.prototype.valueOf);t.exports=c.isRegisteredSymbol||function isRegisteredSymbol(t){try{return void 0!==u(l(t))}catch(t){return!1}}},function(t,r,i){"use strict";for(var o=i(81),a=i(28),c=i(9),u=i(100),l=i(10),d=a("Symbol"),p=d.isWellKnownSymbol,h=a("Object","getOwnPropertyNames"),m=c(d.prototype.valueOf),g=o("wks"),y=0,v=h(d),b=v.length;y<b;y++)try{var _=v[y];u(d[_])&&l(_)}catch(t){}t.exports=function isWellKnownSymbol(t){if(p&&p(t))return!0;try{for(var r=m(t),i=0,o=h(g),a=o.length;i<a;i++)if(g[o[i]]==r)return!0}catch(t){}return!1}},function(t,r,i){"use strict";var o=i(480),a=TypeError;t.exports=function(t){if(o(t))throw new a("The method doesn't accept regular expressions");return t}},function(t,r,i){"use strict";var o=i(10)("match");t.exports=function(t){var r=/./;try{"/./"[t](r)}catch(i){try{return r[o]=!1,"/./"[t](r)}catch(t){}}return!1}},function(t,r,i){"use strict";var o="undefined"!=typeof Symbol&&Symbol,a=i(178);t.exports=function hasNativeSymbols(){return"function"==typeof o&&("function"==typeof Symbol&&("symbol"==typeof o("foo")&&("symbol"==typeof Symbol("bar")&&a())))}},function(t,r,i){"use strict";var o=i(138),a=i(41),c=i(3),u=i(85);t.exports=function defineDataProperty(t,r,i){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new c("`obj` must be an object or a function`");if("string"!=typeof r&&"symbol"!=typeof r)throw new c("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new c("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new c("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new c("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new c("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,d=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,h=arguments.length>6&&arguments[6],m=!!u&&u(t,r);if(o)o(t,r,{configurable:null===p&&m?m.configurable:!p,enumerable:null===l&&m?m.enumerable:!l,value:i,writable:null===d&&m?m.writable:!d});else{if(!h&&(l||d||p))throw new a("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[r]=i}}},function(t,r,i){(function(r){var o="function"==typeof Map&&Map.prototype,a=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,c=o&&a&&"function"==typeof a.get?a.get:null,u=o&&Map.prototype.forEach,l="function"==typeof Set&&Set.prototype,d=Object.getOwnPropertyDescriptor&&l?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,p=l&&d&&"function"==typeof d.get?d.get:null,h=l&&Set.prototype.forEach,m="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,g="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,y="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,v=Boolean.prototype.valueOf,b=Object.prototype.toString,_=Function.prototype.toString,w=String.prototype.match,S=String.prototype.slice,I=String.prototype.replace,k=String.prototype.toUpperCase,x=String.prototype.toLowerCase,P=RegExp.prototype.test,C=Array.prototype.concat,A=Array.prototype.join,O=Array.prototype.slice,R=Math.floor,M="function"==typeof BigInt?BigInt.prototype.valueOf:null,j=Object.getOwnPropertySymbols,L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,D="function"==typeof Symbol&&"object"==typeof Symbol.iterator,B="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===D||"symbol")?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,U=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function addNumericSeparator(t,r){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||P.call(/e/,r))return r;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var o=t<0?-R(-t):R(t);if(o!==t){var a=String(o),c=S.call(r,a.length+1);return I.call(a,i,"$&_")+"."+I.call(I.call(c,/([0-9]{3})/g,"$&_"),/_$/,"")}}return I.call(r,i,"$&_")}var q=i(490),W=q.custom,z=isSymbol(W)?W:null;function wrapQuotes(t,r,i){var o="double"===(i.quoteStyle||r)?'"':"'";return o+t+o}function quote(t){return I.call(String(t),/"/g,""")}function isArray(t){return!("[object Array]"!==toStr(t)||B&&"object"==typeof t&&B in t)}function isRegExp(t){return!("[object RegExp]"!==toStr(t)||B&&"object"==typeof t&&B in t)}function isSymbol(t){if(D)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!L)return!1;try{return L.call(t),!0}catch(t){}return!1}t.exports=function inspect_(t,i,o,a){var l=i||{};if(has(l,"quoteStyle")&&"single"!==l.quoteStyle&&"double"!==l.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(l,"maxStringLength")&&("number"==typeof l.maxStringLength?l.maxStringLength<0&&l.maxStringLength!==1/0:null!==l.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var d=!has(l,"customInspect")||l.customInspect;if("boolean"!=typeof d&&"symbol"!==d)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(l,"indent")&&null!==l.indent&&"\t"!==l.indent&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(l,"numericSeparator")&&"boolean"!=typeof l.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var b=l.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 inspectString(t,r){if(t.length>r.maxStringLength){var i=t.length-r.maxStringLength,o="... "+i+" more character"+(i>1?"s":"");return inspectString(S.call(t,0,r.maxStringLength),r)+o}return wrapQuotes(I.call(I.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",r)}(t,l);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var k=String(t);return b?addNumericSeparator(t,k):k}if("bigint"==typeof t){var P=String(t)+"n";return b?addNumericSeparator(t,P):P}var R=void 0===l.depth?5:l.depth;if(void 0===o&&(o=0),o>=R&&R>0&&"object"==typeof t)return isArray(t)?"[Array]":"[Object]";var j=function getIndent(t,r){var i;if("\t"===t.indent)i="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;i=A.call(Array(t.indent+1)," ")}return{base:i,prev:A.call(Array(r+1),i)}}(l,o);if(void 0===a)a=[];else if(indexOf(a,t)>=0)return"[Circular]";function inspect(t,r,i){if(r&&(a=O.call(a)).push(r),i){var c={depth:l.depth};return has(l,"quoteStyle")&&(c.quoteStyle=l.quoteStyle),inspect_(t,c,o+1,a)}return inspect_(t,l,o+1,a)}if("function"==typeof t&&!isRegExp(t)){var W=function nameOf(t){if(t.name)return t.name;var r=w.call(_.call(t),/^function\s*([\w$]+)/);if(r)return r[1];return null}(t),V=arrObjKeys(t,inspect);return"[Function"+(W?": "+W:" (anonymous)")+"]"+(V.length>0?" { "+A.call(V,", ")+" }":"")}if(isSymbol(t)){var H=D?I.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):L.call(t);return"object"!=typeof t||D?H:markBoxed(H)}if(function isElement(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(t)){for(var $="<"+x.call(String(t.nodeName)),K=t.attributes||[],G=0;G<K.length;G++)$+=" "+K[G].name+"="+wrapQuotes(quote(K[G].value),"double",l);return $+=">",t.childNodes&&t.childNodes.length&&($+="..."),$+="</"+x.call(String(t.nodeName))+">"}if(isArray(t)){if(0===t.length)return"[]";var J=arrObjKeys(t,inspect);return j&&!function singleLineValues(t){for(var r=0;r<t.length;r++)if(indexOf(t[r],"\n")>=0)return!1;return!0}(J)?"["+indentedJoin(J,j)+"]":"[ "+A.call(J,", ")+" ]"}if(function isError(t){return!("[object Error]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t)){var Y=arrObjKeys(t,inspect);return"cause"in Error.prototype||!("cause"in t)||N.call(t,"cause")?0===Y.length?"["+String(t)+"]":"{ ["+String(t)+"] "+A.call(Y,", ")+" }":"{ ["+String(t)+"] "+A.call(C.call("[cause]: "+inspect(t.cause),Y),", ")+" }"}if("object"==typeof t&&d){if(z&&"function"==typeof t[z]&&q)return q(t,{depth:R-o});if("symbol"!==d&&"function"==typeof t.inspect)return t.inspect()}if(function isMap(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{p.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(t)){var Q=[];return u&&u.call(t,(function(r,i){Q.push(inspect(i,t,!0)+" => "+inspect(r,t))})),collectionOf("Map",c.call(t),Q,j)}if(function isSet(t){if(!p||!t||"object"!=typeof t)return!1;try{p.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(t)){var X=[];return h&&h.call(t,(function(r){X.push(inspect(r,t))})),collectionOf("Set",p.call(t),X,j)}if(function isWeakMap(t){if(!m||!t||"object"!=typeof t)return!1;try{m.call(t,m);try{g.call(t,g)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(t))return weakCollectionOf("WeakMap");if(function isWeakSet(t){if(!g||!t||"object"!=typeof t)return!1;try{g.call(t,g);try{m.call(t,m)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(t))return weakCollectionOf("WeakSet");if(function isWeakRef(t){if(!y||!t||"object"!=typeof t)return!1;try{return y.call(t),!0}catch(t){}return!1}(t))return weakCollectionOf("WeakRef");if(function isNumber(t){return!("[object Number]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t))return markBoxed(inspect(Number(t)));if(function isBigInt(t){if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(t){}return!1}(t))return markBoxed(inspect(M.call(t)));if(function isBoolean(t){return!("[object Boolean]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t))return markBoxed(v.call(t));if(function isString(t){return!("[object String]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t))return markBoxed(inspect(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if(t===r)return"{ [object globalThis] }";if(!function isDate(t){return!("[object Date]"!==toStr(t)||B&&"object"==typeof t&&B in t)}(t)&&!isRegExp(t)){var Z=arrObjKeys(t,inspect),ee=U?U(t)===Object.prototype:t instanceof Object||t.constructor===Object,te=t instanceof Object?"":"null prototype",re=!ee&&B&&Object(t)===t&&B in t?S.call(toStr(t),8,-1):te?"Object":"",ne=(ee||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(re||te?"["+A.call(C.call([],re||[],te||[]),": ")+"] ":"");return 0===Z.length?ne+"{}":j?ne+"{"+indentedJoin(Z,j)+"}":ne+"{ "+A.call(Z,", ")+" }"}return String(t)};var V=Object.prototype.hasOwnProperty||function(t){return t in this};function has(t,r){return V.call(t,r)}function toStr(t){return b.call(t)}function indexOf(t,r){if(t.indexOf)return t.indexOf(r);for(var i=0,o=t.length;i<o;i++)if(t[i]===r)return i;return-1}function lowbyte(t){var r=t.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return i?"\\"+i:"\\x"+(r<16?"0":"")+k.call(r.toString(16))}function markBoxed(t){return"Object("+t+")"}function weakCollectionOf(t){return t+" { ? }"}function collectionOf(t,r,i,o){return t+" ("+r+") {"+(o?indentedJoin(i,o):A.call(i,", "))+"}"}function indentedJoin(t,r){if(0===t.length)return"";var i="\n"+r.prev+r.base;return i+A.call(t,","+i)+"\n"+r.prev}function arrObjKeys(t,r){var i=isArray(t),o=[];if(i){o.length=t.length;for(var a=0;a<t.length;a++)o[a]=has(t,a)?r(t[a],t):""}var c,u="function"==typeof j?j(t):[];if(D){c={};for(var l=0;l<u.length;l++)c["$"+u[l]]=u[l]}for(var d in t)has(t,d)&&(i&&String(Number(d))===d&&d<t.length||D&&c["$"+d]instanceof Symbol||(P.call(/[^\w$]/,d)?o.push(r(d,t)+": "+r(t[d],t)):o.push(d+": "+r(t[d],t))));if("function"==typeof j)for(var p=0;p<u.length;p++)N.call(t,u[p])&&o.push("["+r(u[p])+"]: "+r(t[u[p]],t));return o}}).call(this,i(17))},function(t,r,i){"use strict";var o=i(181),a=Object.prototype.hasOwnProperty,c=Array.isArray,u=function(){for(var t=[],r=0;r<256;++r)t.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return t}(),l=function arrayToObject(t,r){for(var i=r&&r.plainObjects?Object.create(null):{},o=0;o<t.length;++o)void 0!==t[o]&&(i[o]=t[o]);return i};t.exports={arrayToObject:l,assign:function assignSingleSource(t,r){return Object.keys(r).reduce((function(t,i){return t[i]=r[i],t}),t)},combine:function combine(t,r){return[].concat(t,r)},compact:function compact(t){for(var r=[{obj:{o:t},prop:"o"}],i=[],o=0;o<r.length;++o)for(var a=r[o],u=a.obj[a.prop],l=Object.keys(u),d=0;d<l.length;++d){var p=l[d],h=u[p];"object"==typeof h&&null!==h&&-1===i.indexOf(h)&&(r.push({obj:u,prop:p}),i.push(h))}return function compactQueue(t){for(;t.length>1;){var r=t.pop(),i=r.obj[r.prop];if(c(i)){for(var o=[],a=0;a<i.length;++a)void 0!==i[a]&&o.push(i[a]);r.obj[r.prop]=o}}}(r),t},decode:function(t,r,i){var o=t.replace(/\+/g," ");if("iso-8859-1"===i)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(t){return o}},encode:function encode(t,r,i,a,c){if(0===t.length)return t;var l=t;if("symbol"==typeof t?l=Symbol.prototype.toString.call(t):"string"!=typeof t&&(l=String(t)),"iso-8859-1"===i)return escape(l).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var d="",p=0;p<l.length;p+=1024){for(var h=l.length>=1024?l.slice(p,p+1024):l,m=[],g=0;g<h.length;++g){var y=h.charCodeAt(g);45===y||46===y||95===y||126===y||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||c===o.RFC1738&&(40===y||41===y)?m[m.length]=h.charAt(g):y<128?m[m.length]=u[y]:y<2048?m[m.length]=u[192|y>>6]+u[128|63&y]:y<55296||y>=57344?m[m.length]=u[224|y>>12]+u[128|y>>6&63]+u[128|63&y]:(g+=1,y=65536+((1023&y)<<10|1023&h.charCodeAt(g)),m[m.length]=u[240|y>>18]+u[128|y>>12&63]+u[128|y>>6&63]+u[128|63&y])}d+=m.join("")}return d},isBuffer:function isBuffer(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function isRegExp(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function maybeMap(t,r){if(c(t)){for(var i=[],o=0;o<t.length;o+=1)i.push(r(t[o]));return i}return r(t)},merge:function merge(t,r,i){if(!r)return t;if("object"!=typeof r){if(c(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(i&&(i.plainObjects||i.allowPrototypes)||!a.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var o=t;return c(t)&&!c(r)&&(o=l(t,i)),c(t)&&c(r)?(r.forEach((function(r,o){if(a.call(t,o)){var c=t[o];c&&"object"==typeof c&&r&&"object"==typeof r?t[o]=merge(c,r,i):t.push(r)}else t[o]=r})),t):Object.keys(r).reduce((function(t,o){var c=r[o];return a.call(t,o)?t[o]=merge(t[o],c,i):t[o]=c,t}),o)}}},function(t,r,i){"use strict";t.exports=i(501)},function(t,r,i){"use strict";var o=i(503);t.exports=o},function(t,r,i){"use strict";t.exports=i(506)},function(t,r,i){"use strict";var o=i(508);t.exports=o},function(t,r,i){"use strict";var o=i(20),a=i(33),c=i(163);t.exports=function(t,r,i){var u,l;a(t);try{if(!(u=c(t,"return"))){if("throw"===r)throw i;return i}u=o(u,t)}catch(t){l=!0,u=t}if("throw"===r)throw i;if(l)throw u;return a(u),i}},function(t,r,i){"use strict";var o=i(10),a=i(84),c=o("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(a.Array===t||u[c]===t)}},function(t,r,i){"use strict";var o=i(10)("iterator"),a=!1;try{var c=0,u={next:function(){return{done:!!c++}},return:function(){a=!0}};u[o]=function(){return this},Array.from(u,(function(){throw 2}))}catch(t){}t.exports=function(t,r){try{if(!r&&!a)return!1}catch(t){return!1}var i=!1;try{var c={};c[o]=function(){return{next:function(){return{done:i=!0}}}},t(c)}catch(t){}return i}},function(t,r){t.exports=function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,o=new Array(r);i<r;i++)o[i]=t[i];return o},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";t.exports=i(515)},function(t,r,i){"use strict";var o=i(517);i(67),t.exports=o},function(t,r,i){"use strict";i(518)},function(t,r,i){"use strict";var o=i(33),a=i(528),c=i(78),u=i(10)("species");t.exports=function(t,r){var i,l=o(t).constructor;return void 0===l||c(i=o(l)[u])?r:a(i)}},function(t,r,i){"use strict";var o,a,c,u,l=i(11),d=i(99),p=i(63),h=i(12),m=i(21),g=i(8),y=i(229),v=i(83),b=i(164),_=i(270),w=i(271),S=i(139),I=l.setImmediate,k=l.clearImmediate,x=l.process,P=l.Dispatch,C=l.Function,A=l.MessageChannel,O=l.String,R=0,M={};g((function(){o=l.location}));var run=function(t){if(m(M,t)){var r=M[t];delete M[t],r()}},runner=function(t){return function(){run(t)}},eventListener=function(t){run(t.data)},globalPostMessageDefer=function(t){l.postMessage(O(t),o.protocol+"//"+o.host)};I&&k||(I=function setImmediate(t){_(arguments.length,1);var r=h(t)?t:C(t),i=v(arguments,1);return M[++R]=function(){d(r,void 0,i)},a(R),R},k=function clearImmediate(t){delete M[t]},S?a=function(t){x.nextTick(runner(t))}:P&&P.now?a=function(t){P.now(runner(t))}:A&&!w?(u=(c=new A).port2,c.port1.onmessage=eventListener,a=p(u.postMessage,u)):l.addEventListener&&h(l.postMessage)&&!l.importScripts&&o&&"file:"!==o.protocol&&!g(globalPostMessageDefer)?(a=globalPostMessageDefer,l.addEventListener("message",eventListener,!1)):a="onreadystatechange"in b("script")?function(t){y.appendChild(b("script")).onreadystatechange=function(){y.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)}),t.exports={set:I,clear:k}},function(t,r,i){"use strict";var o=TypeError;t.exports=function(t,r){if(t<r)throw new o("Not enough arguments");return t}},function(t,r,i){"use strict";var o=i(125);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(o)},function(t,r,i){"use strict";var o=i(11),a=i(13),c=Object.getOwnPropertyDescriptor;t.exports=function(t){if(!a)return o[t];var r=c(o,t);return r&&r.value}},function(t,r,i){"use strict";var Queue=function(){this.head=null,this.tail=null};Queue.prototype={add:function(t){var r={item:t,next:null},i=this.tail;i?i.next=r:this.head=r,this.tail=r},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},t.exports=Queue},function(t,r,i){"use strict";t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},function(t,r,i){"use strict";var o=i(33),a=i(18),c=i(50);t.exports=function(t,r){if(o(t),a(r)&&r.constructor===t)return r;var i=c.f(t);return(0,i.resolve)(r),i.promise}},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(39),u=i(50),l=i(86),d=i(70);o({target:"Promise",stat:!0,forced:i(141)},{allSettled:function allSettled(t){var r=this,i=u.f(r),o=i.resolve,p=i.reject,h=l((function(){var i=c(r.resolve),u=[],l=0,p=1;d(t,(function(t){var c=l++,d=!1;p++,a(i,r,t).then((function(t){d||(d=!0,u[c]={status:"fulfilled",value:t},--p||o(u))}),(function(t){d||(d=!0,u[c]={status:"rejected",reason:t},--p||o(u))}))})),--p||o(u)}));return h.error&&p(h.value),i.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(39),u=i(28),l=i(50),d=i(86),p=i(70),h=i(141);o({target:"Promise",stat:!0,forced:h},{any:function any(t){var r=this,i=u("AggregateError"),o=l.f(r),h=o.resolve,m=o.reject,g=d((function(){var o=c(r.resolve),u=[],l=0,d=1,g=!1;p(t,(function(t){var c=l++,p=!1;d++,a(o,r,t).then((function(t){p||g||(g=!0,h(t))}),(function(t){p||g||(p=!0,u[c]=t,--d||m(new i(u,"No one promise resolved")))}))})),--d||m(new i(u,"No one promise resolved"))}));return g.error&&m(g.value),o.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(50);o({target:"Promise",stat:!0},{withResolvers:function withResolvers(){var t=a.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}})},function(t,r){!function(t){!function(r){var i="URLSearchParams"in t,o="Symbol"in t&&"iterator"in Symbol,a="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),c="FormData"in t,u="ArrayBuffer"in t;if(u)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(t){return t&&l.indexOf(Object.prototype.toString.call(t))>-1};function normalizeName(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function normalizeValue(t){return"string"!=typeof t&&(t=String(t)),t}function iteratorFor(t){var r={next:function(){var r=t.shift();return{done:void 0===r,value:r}}};return o&&(r[Symbol.iterator]=function(){return r}),r}function Headers(t){this.map={},t instanceof Headers?t.forEach((function(t,r){this.append(r,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(r){this.append(r,t[r])}),this)}function consumed(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function fileReaderReady(t){return new Promise((function(r,i){t.onload=function(){r(t.result)},t.onerror=function(){i(t.error)}}))}function readBlobAsArrayBuffer(t){var r=new FileReader,i=fileReaderReady(r);return r.readAsArrayBuffer(t),i}function bufferClone(t){if(t.slice)return t.slice(0);var r=new Uint8Array(t.byteLength);return r.set(new Uint8Array(t)),r.buffer}function Body(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:a&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:c&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&a&&function isDataView(t){return t&&DataView.prototype.isPrototypeOf(t)}(t)?(this._bodyArrayBuffer=bufferClone(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||d(t))?this._bodyArrayBuffer=bufferClone(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var t=consumed(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?consumed(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var t=consumed(this);if(t)return t;if(this._bodyBlob)return function readBlobAsText(t){var r=new FileReader,i=fileReaderReady(r);return r.readAsText(t),i}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function readArrayBufferAsText(t){for(var r=new Uint8Array(t),i=new Array(r.length),o=0;o<r.length;o++)i[o]=String.fromCharCode(r[o]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c&&(this.formData=function(){return this.text().then(decode)}),this.json=function(){return this.text().then(JSON.parse)},this}Headers.prototype.append=function(t,r){t=normalizeName(t),r=normalizeValue(r);var i=this.map[t];this.map[t]=i?i+", "+r:r},Headers.prototype.delete=function(t){delete this.map[normalizeName(t)]},Headers.prototype.get=function(t){return t=normalizeName(t),this.has(t)?this.map[t]:null},Headers.prototype.has=function(t){return this.map.hasOwnProperty(normalizeName(t))},Headers.prototype.set=function(t,r){this.map[normalizeName(t)]=normalizeValue(r)},Headers.prototype.forEach=function(t,r){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(r,this.map[i],i,this)},Headers.prototype.keys=function(){var t=[];return this.forEach((function(r,i){t.push(i)})),iteratorFor(t)},Headers.prototype.values=function(){var t=[];return this.forEach((function(r){t.push(r)})),iteratorFor(t)},Headers.prototype.entries=function(){var t=[];return this.forEach((function(r,i){t.push([i,r])})),iteratorFor(t)},o&&(Headers.prototype[Symbol.iterator]=Headers.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Request(t,r){var i=(r=r||{}).body;if(t instanceof Request){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,r.headers||(this.headers=new Headers(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=r.credentials||this.credentials||"same-origin",!r.headers&&this.headers||(this.headers=new Headers(r.headers)),this.method=function normalizeMethod(t){var r=t.toUpperCase();return p.indexOf(r)>-1?r:t}(r.method||this.method||"GET"),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function decode(t){var r=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),o=i.shift().replace(/\+/g," "),a=i.join("=").replace(/\+/g," ");r.append(decodeURIComponent(o),decodeURIComponent(a))}})),r}function Response(t,r){r||(r={}),this.type="default",this.status=void 0===r.status?200:r.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in r?r.statusText:"OK",this.headers=new Headers(r.headers),this.url=r.url||"",this._initBody(t)}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})},Body.call(Request.prototype),Body.call(Response.prototype),Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})},Response.error=function(){var t=new Response(null,{status:0,statusText:""});return t.type="error",t};var h=[301,302,303,307,308];Response.redirect=function(t,r){if(-1===h.indexOf(r))throw new RangeError("Invalid status code");return new Response(null,{status:r,headers:{location:t}})},r.DOMException=t.DOMException;try{new r.DOMException}catch(t){r.DOMException=function(t,r){this.message=t,this.name=r;var i=Error(t);this.stack=i.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function fetch(t,i){return new Promise((function(o,c){var u=new Request(t,i);if(u.signal&&u.signal.aborted)return c(new r.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function abortXhr(){l.abort()}l.onload=function(){var t,r,i={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",r=new Headers,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var i=t.split(":"),o=i.shift().trim();if(o){var a=i.join(":").trim();r.append(o,a)}})),r)};i.url="responseURL"in l?l.responseURL:i.headers.get("X-Request-URL");var a="response"in l?l.response:l.responseText;o(new Response(a,i))},l.onerror=function(){c(new TypeError("Network request failed"))},l.ontimeout=function(){c(new TypeError("Network request failed"))},l.onabort=function(){c(new r.DOMException("Aborted","AbortError"))},l.open(u.method,u.url,!0),"include"===u.credentials?l.withCredentials=!0:"omit"===u.credentials&&(l.withCredentials=!1),"responseType"in l&&a&&(l.responseType="blob"),u.headers.forEach((function(t,r){l.setRequestHeader(r,t)})),u.signal&&(u.signal.addEventListener("abort",abortXhr),l.onreadystatechange=function(){4===l.readyState&&u.signal.removeEventListener("abort",abortXhr)}),l.send(void 0===u._bodyInit?null:u._bodyInit)}))}fetch.polyfill=!0,t.fetch||(t.fetch=fetch,t.Headers=Headers,t.Request=Request,t.Response=Response),r.Headers=Headers,r.Request=Request,r.Response=Response,r.fetch=fetch,Object.defineProperty(r,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},function(t,r){t.exports=function eq(t,r){return t===r||t!=t&&r!=r}},function(t,r,i){var o=i(111),a=i(112);t.exports=function isFunction(t){if(!a(t))return!1;var r=o(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}},function(t,r,i){(function(r){var i="object"==typeof r&&r&&r.Object===Object&&r;t.exports=i}).call(this,i(17))},function(t,r){var i=Function.prototype.toString;t.exports=function toSource(t){if(null!=t){try{return i.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,r,i){var o=i(627),a=i(634),c=i(636),u=i(637),l=i(638);function MapCache(t){var r=-1,i=null==t?0:t.length;for(this.clear();++r<i;){var o=t[r];this.set(o[0],o[1])}}MapCache.prototype.clear=o,MapCache.prototype.delete=a,MapCache.prototype.get=c,MapCache.prototype.has=u,MapCache.prototype.set=l,t.exports=MapCache},function(t,r,i){var o=i(286),a=i(280),c=Object.prototype.hasOwnProperty;t.exports=function assignValue(t,r,i){var u=t[r];c.call(t,r)&&a(u,i)&&(void 0!==i||r in t)||o(t,r,i)}},function(t,r,i){var o=i(640);t.exports=function baseAssignValue(t,r,i){"__proto__"==r&&o?o(t,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[r]=i}},function(t,r,i){var o=i(642),a=i(643),c=i(89),u=i(288),l=i(646),d=i(647),p=Object.prototype.hasOwnProperty;t.exports=function arrayLikeKeys(t,r){var i=c(t),h=!i&&a(t),m=!i&&!h&&u(t),g=!i&&!h&&!m&&d(t),y=i||h||m||g,v=y?o(t.length,String):[],b=v.length;for(var _ in t)!r&&!p.call(t,_)||y&&("length"==_||m&&("offset"==_||"parent"==_)||g&&("buffer"==_||"byteLength"==_||"byteOffset"==_)||l(_,b))||v.push(_);return v}},function(t,r,i){(function(t){var o=i(44),a=i(645),c=r&&!r.nodeType&&r,u=c&&"object"==typeof t&&t&&!t.nodeType&&t,l=u&&u.exports===c?o.Buffer:void 0,d=(l?l.isBuffer:void 0)||a;t.exports=d}).call(this,i(136)(t))},function(t,r){t.exports=function isLength(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,r){t.exports=function overArg(t,r){return function(i){return t(r(i))}}},function(t,r,i){var o=i(281),a=i(289);t.exports=function isArrayLike(t){return null!=t&&a(t.length)&&!o(t)}},function(t,r){t.exports=function stubArray(){return[]}},function(t,r,i){var o=i(294),a=i(295),c=i(192),u=i(292),l=Object.getOwnPropertySymbols?function(t){for(var r=[];t;)o(r,c(t)),t=a(t);return r}:u;t.exports=l},function(t,r){t.exports=function arrayPush(t,r){for(var i=-1,o=r.length,a=t.length;++i<o;)t[a+i]=r[i];return t}},function(t,r,i){var o=i(290)(Object.getPrototypeOf,Object);t.exports=o},function(t,r,i){var o=i(294),a=i(89);t.exports=function baseGetAllKeys(t,r,i){var c=r(t);return a(t)?c:o(c,i(t))}},function(t,r,i){"use strict";var o=i(8);t.exports=!o((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(t,r,i){"use strict";t.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},function(t,r,i){"use strict";var o=Object.prototype.toString;t.exports=function isArguments(t){var r=o.call(t),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===o.call(t.callee)),i}},function(t,r,i){"use strict";var o=i(3),a=i(697),c=i(699),u=i(91),l=i(709),d=i(710),p=i(711),h=i(712),m=i(742),g=i(313),y=i(203),v=i(743),b=i(744),_=i(319),w=i(116),S=i(206);t.exports=function slice(t,r){var i=this;_(i,"SEQ-CST");var I,k=i.length,x=m(t);I=x===-1/0?0:x<0?l(k+x,0):d(x,k);var P,C=void 0===r?k:m(r);P=C===-1/0?0:C<0?l(k+C,0):d(C,k);var A=l(P-I,0),O=b(i,[A]);if(A>0){if(u(w(i)))throw new o("Cannot use a Typed Array with an underlying ArrayBuffer that is detached");if(v(i)===v(O))for(var R=w(i),M=w(O),j=y(i),L=I*j+S(i),D=S(O),B=D+A*j;D<B;){var N=c(R,L,"UINT8",!0,"UNORDERED");h(M,D,"UINT8",N,!0,"UNORDERED"),L+=1,D+=1}else for(var U=0;I<P;){var q=g(I),W=a(i,q);p(O,g(U),W,!0),I+=1,U+=1}}return O}},function(t,r,i){"use strict";var o=i(24)("ArrayBuffer.prototype.byteLength",!0),a=i(92);t.exports=function byteLength(t){return a(t)?o?o(t):t.byteLength:NaN}},function(t,r,i){"use strict";var o=i(3),a=i(69),c=i(149),u=i(72);t.exports=function HasOwnProperty(t,r){if("Object"!==u(t))throw new o("Assertion failed: `O` must be an Object");if(!c(r))throw new o("Assertion failed: `P` must be a Property Key");return a(t,r)}},function(t,r,i){"use strict";var o=i(6)("%Array%"),a=!o.isArray&&i(24)("Object.prototype.toString");t.exports=o.isArray||function IsArray(t){return"[object Array]"===a(t)}},function(t,r,i){"use strict";t.exports=function IsBigIntElementType(t){return"BIGUINT64"===t||"BIGINT64"===t}},function(t,r,i){"use strict";var o=i(6),a=o("%Uint8Array%",!0),c=o("%Uint32Array%",!0),u=i(116),l=c&&new c([305419896]),d=l&&new a(u(l));t.exports=d?120===d[0]?"little":18===d[0]?"big":52===d[0]?"mixed":"unknown":"indeterminate"},function(t,r,i){"use strict";var o=i(90);t.exports=function SameValue(t,r){return t===r?0!==t||1/t==1/r:o(t)&&o(r)}},function(t,r,i){"use strict";var o=i(6),a=o("%BigInt%",!0),c=o("%Number%"),u=i(3),l=i(41),d=i(715),p=i(308);t.exports=function ToBigInt(t){if(!a)throw new l("BigInts are not supported in this environment");var r=p(t,c);if(null==r)throw new u("Cannot convert null or undefined to a BigInt");if("boolean"==typeof r)return a(r?1:0);if("number"==typeof r)throw new u("Cannot convert a Number value to a BigInt");if("string"==typeof r){var i=d(r);if(void 0===i)throw new u("Failed to parse String to BigInt");return i}if("symbol"==typeof r)throw new u("Cannot convert a Symbol value to a BigInt");if("bigint"!=typeof r)throw new l("Assertion failed: unknown primitive type");return r}},function(t,r,i){"use strict";var o=i(716);t.exports=function ToPrimitive(t){return arguments.length>1?o(t,arguments[1]):o(t)}},function(t,r,i){"use strict";var o=i(6)("%BigInt%",!0),a=i(177),c=i(3),u=o&&o(0);t.exports=function BigIntRemainder(t,r){if("bigint"!=typeof t||"bigint"!=typeof r)throw new c("Assertion failed: `n` and `d` arguments must be BigInts");if(r===u)throw new a("Division by zero");return t===u?u:t%r}},function(t,r,i){"use strict";t.exports=function bigIntMod(t,r,i){var o=t(r,i);return o>=0?o:o+i}},function(t,r,i){"use strict";var o=i(3);t.exports=function RequireObjectCoercible(t){if(null==t)throw new o(arguments.length>0&&arguments[1]||"Cannot call method on "+t);return t}},function(t,r,i){"use strict";var o=i(311),a=i(313),c=i(24)("String.prototype.replace"),u=/^\s$/.test(""),l=u?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,d=u?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;t.exports=function trim(){var t=a(o(this));return c(c(t,l,""),d,"")}},function(t,r,i){"use strict";var o=i(6)("%String%"),a=i(3);t.exports=function ToString(t){if("symbol"==typeof t)throw new a("Cannot convert a Symbol value to a string");return o(t)}},function(t,r,i){"use strict";var o=i(312);t.exports=function getPolyfill(){return String.prototype.trim&&""==="".trim()&&""==="".trim()&&"_"==="_".trim()&&"_"==="_".trim()?String.prototype.trim:o}},function(t,r,i){"use strict";t.exports=function isNegativeZero(t){return 0===t&&1/t==-1/0}},function(t,r,i){"use strict";var o=i(746)("%Reflect.construct%",!0),a=i(747);try{a({},"",{"[[Get]]":function(){}})}catch(t){a=null}if(a&&o){var c={},u={};a(u,"length",{"[[Get]]":function(){throw c},"[[Enumerable]]":!0}),t.exports=function IsConstructor(t){try{o(t,u)}catch(t){return t===c}}}else t.exports=function IsConstructor(t){return"function"==typeof t&&!!t.prototype}},function(t,r,i){"use strict";var o=i(69),a=i(93),c=i(150);t.exports=function isTypedArrayWithBufferWitnessRecord(t){return!!t&&"object"==typeof t&&o(t,"[[Object]]")&&o(t,"[[CachedBufferByteLength]]")&&(c(t["[[CachedBufferByteLength]]"])&&t["[[CachedBufferByteLength]]"]>=0||"DETACHED"===t["[[CachedBufferByteLength]]"])&&a(t["[[Object]]"])}},function(t,r,i){"use strict";(function(r){var o=i(59),a=i(197),c=i(85),u=i(137)(),l=i(93),d=i(298),p={__proto__:null},h=Object.defineProperty;if(c){var getLength=function(t){return t.length};a(d,(function(t){var i=r[t];if("function"==typeof i||"object"==typeof i){var a=i.prototype,l=c(a,"length");if(!l&&u){var d=a.__proto__;l=c(d,"length")}if(l&&l.get)p["$"+t]=o(l.get);else if(h){var m=new r[t](2);(l=c(m,"length"))&&l.configurable&&h(m,"length",{value:3}),2===m.length&&(p["$"+t]=getLength)}}}))}t.exports=function typedArrayLength(t){return!!l(t)&&function tryAllTypedArrays(t){var r;return a(p,(function(i){if("number"!=typeof r)try{var o=i(t);"number"==typeof o&&(r=o)}catch(t){}})),r}(t)}}).call(this,i(17))},function(t,r,i){"use strict";var o=i(3),a=i(205),c=i(758),u=i(72),l=i(93);t.exports=function ValidateTypedArray(t,r){if("SEQ-CST"!==r&&"UNORDERED"!==r)throw new o("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");if("Object"!==u(t))throw new o("Assertion failed: `O` must be an Object");if(!l(t))throw new o("Assertion failed: `O` must be a Typed Array");var i=c(t,r);if(a(i))throw new o("`O` must be in-bounds and backed by a non-detached buffer");return i}},function(t,r,i){"use strict";var o=i(300);t.exports=function getPolyfill(){return"function"==typeof Uint8Array&&Uint8Array.prototype.slice||o}},function(t,r,i){"use strict";t.exports=i(773)},function(t,r,i){"use strict";var o=i(210),a=i(74).Readable,c={objectMode:!0},u={clean:!0};function Store(t){if(!(this instanceof Store))return new Store(t);this.options=t||{},this.options=o(u,t),this._inflights=new Map}Store.prototype.put=function(t,r){return this._inflights.set(t.messageId,t),r&&r(),this},Store.prototype.createStream=function(){var t=new a(c),r=!1,i=[],o=0;return this._inflights.forEach((function(t,r){i.push(t)})),t._read=function(){!r&&o<i.length?this.push(i[o++]):this.push(null)},t.destroy=function(){if(!r){var t=this;r=!0,setTimeout((function(){t.emit("close")}),0)}},t},Store.prototype.del=function(t,r){return(t=this._inflights.get(t.messageId))?(this._inflights.delete(t.messageId),r(null,t)):r&&r(new Error("missing packet")),this},Store.prototype.get=function(t,r){return(t=this._inflights.get(t.messageId))?r(null,t):r&&r(new Error("missing packet")),this},Store.prototype.close=function(t){this.options.clean&&(this._inflights=null),t&&t()},t.exports=Store},function(t,r,i){"use strict";(function(r,o){var a;t.exports=Readable,Readable.ReadableState=ReadableState;i(45).EventEmitter;var c=function EElistenerCount(t,r){return t.listeners(r).length},u=i(324),l=i(16).Buffer,d=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var p,h=i(784);p=h&&h.debuglog?h.debuglog("stream"):function debug(){};var m,g,y,v=i(785),b=i(325),_=i(326).getHighWaterMark,w=i(95).codes,S=w.ERR_INVALID_ARG_TYPE,I=w.ERR_STREAM_PUSH_AFTER_EOF,k=w.ERR_METHOD_NOT_IMPLEMENTED,x=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i(30)(Readable,u);var P=b.errorOrDestroy,C=["error","close","destroy","pause","resume"];function ReadableState(t,r,o){a=a||i(96),t=t||{},"boolean"!=typeof o&&(o=r instanceof a),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=_(this,t,"readableHighWaterMark",o),this.buffer=new v,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(m||(m=i(152).StringDecoder),this.decoder=new m(t.encoding),this.encoding=t.encoding)}function Readable(t){if(a=a||i(96),!(this instanceof Readable))return new Readable(t);var r=this instanceof a;this._readableState=new ReadableState(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function readableAddChunk(t,r,i,o,a){p("readableAddChunk",r);var c,u=t._readableState;if(null===r)u.reading=!1,function onEofChunk(t,r){if(p("onEofChunk"),r.ended)return;if(r.decoder){var i=r.decoder.end();i&&i.length&&(r.buffer.push(i),r.length+=r.objectMode?1:i.length)}r.ended=!0,r.sync?emitReadable(t):(r.needReadable=!1,r.emittedReadable||(r.emittedReadable=!0,emitReadable_(t)))}(t,u);else if(a||(c=function chunkInvalid(t,r){var i;(function _isUint8Array(t){return l.isBuffer(t)||t instanceof d})(r)||"string"==typeof r||void 0===r||t.objectMode||(i=new S("chunk",["string","Buffer","Uint8Array"],r));return i}(u,r)),c)P(t,c);else if(u.objectMode||r&&r.length>0)if("string"==typeof r||u.objectMode||Object.getPrototypeOf(r)===l.prototype||(r=function _uint8ArrayToBuffer(t){return l.from(t)}(r)),o)u.endEmitted?P(t,new x):addChunk(t,u,r,!0);else if(u.ended)P(t,new I);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!i?(r=u.decoder.write(r),u.objectMode||0!==r.length?addChunk(t,u,r,!1):maybeReadMore(t,u)):addChunk(t,u,r,!1)}else o||(u.reading=!1,maybeReadMore(t,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function addChunk(t,r,i,o){r.flowing&&0===r.length&&!r.sync?(r.awaitDrain=0,t.emit("data",i)):(r.length+=r.objectMode?1:i.length,o?r.buffer.unshift(i):r.buffer.push(i),r.needReadable&&emitReadable(t)),maybeReadMore(t,r)}Object.defineProperty(Readable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._readableState&&this._readableState.destroyed},set:function set(t){this._readableState&&(this._readableState.destroyed=t)}}),Readable.prototype.destroy=b.destroy,Readable.prototype._undestroy=b.undestroy,Readable.prototype._destroy=function(t,r){r(t)},Readable.prototype.push=function(t,r){var i,o=this._readableState;return o.objectMode?i=!0:"string"==typeof t&&((r=r||o.defaultEncoding)!==o.encoding&&(t=l.from(t,r),r=""),i=!0),readableAddChunk(this,t,r,!1,i)},Readable.prototype.unshift=function(t){return readableAddChunk(this,t,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(t){m||(m=i(152).StringDecoder);var r=new m(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var o=this._readableState.buffer.head,a="";null!==o;)a+=r.write(o.data),o=o.next;return this._readableState.buffer.clear(),""!==a&&this._readableState.buffer.push(a),this._readableState.length=a.length,this};function howMuchToRead(t,r){return t<=0||0===r.length&&r.ended?0:r.objectMode?1:t!=t?r.flowing&&r.length?r.buffer.head.data.length:r.length:(t>r.highWaterMark&&(r.highWaterMark=function computeNewHighWaterMark(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=r.length?t:r.ended?r.length:(r.needReadable=!0,0))}function emitReadable(t){var r=t._readableState;p("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(p("emitReadable",r.flowing),r.emittedReadable=!0,o.nextTick(emitReadable_,t))}function emitReadable_(t){var r=t._readableState;p("emitReadable_",r.destroyed,r.length,r.ended),r.destroyed||!r.length&&!r.ended||(t.emit("readable"),r.emittedReadable=!1),r.needReadable=!r.flowing&&!r.ended&&r.length<=r.highWaterMark,flow(t)}function maybeReadMore(t,r){r.readingMore||(r.readingMore=!0,o.nextTick(maybeReadMore_,t,r))}function maybeReadMore_(t,r){for(;!r.reading&&!r.ended&&(r.length<r.highWaterMark||r.flowing&&0===r.length);){var i=r.length;if(p("maybeReadMore read 0"),t.read(0),i===r.length)break}r.readingMore=!1}function updateReadableListening(t){var r=t._readableState;r.readableListening=t.listenerCount("readable")>0,r.resumeScheduled&&!r.paused?r.flowing=!0:t.listenerCount("data")>0&&t.resume()}function nReadingNextTick(t){p("readable nexttick read 0"),t.read(0)}function resume_(t,r){p("resume",r.reading),r.reading||t.read(0),r.resumeScheduled=!1,t.emit("resume"),flow(t),r.flowing&&!r.reading&&t.read(0)}function flow(t){var r=t._readableState;for(p("flow",r.flowing);r.flowing&&null!==t.read(););}function fromList(t,r){return 0===r.length?null:(r.objectMode?i=r.buffer.shift():!t||t>=r.length?(i=r.decoder?r.buffer.join(""):1===r.buffer.length?r.buffer.first():r.buffer.concat(r.length),r.buffer.clear()):i=r.buffer.consume(t,r.decoder),i);var i}function endReadable(t){var r=t._readableState;p("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,o.nextTick(endReadableNT,r,t))}function endReadableNT(t,r){if(p("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,r.readable=!1,r.emit("end"),t.autoDestroy)){var i=r._writableState;(!i||i.autoDestroy&&i.finished)&&r.destroy()}}function indexOf(t,r){for(var i=0,o=t.length;i<o;i++)if(t[i]===r)return i;return-1}Readable.prototype.read=function(t){p("read",t),t=parseInt(t,10);var r=this._readableState,i=t;if(0!==t&&(r.emittedReadable=!1),0===t&&r.needReadable&&((0!==r.highWaterMark?r.length>=r.highWaterMark:r.length>0)||r.ended))return p("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?endReadable(this):emitReadable(this),null;if(0===(t=howMuchToRead(t,r))&&r.ended)return 0===r.length&&endReadable(this),null;var o,a=r.needReadable;return p("need readable",a),(0===r.length||r.length-t<r.highWaterMark)&&p("length less than watermark",a=!0),r.ended||r.reading?p("reading or ended",a=!1):a&&(p("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(t=howMuchToRead(i,r))),null===(o=t>0?fromList(t,r):null)?(r.needReadable=r.length<=r.highWaterMark,t=0):(r.length-=t,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),i!==t&&r.ended&&endReadable(this)),null!==o&&this.emit("data",o),o},Readable.prototype._read=function(t){P(this,new k("_read()"))},Readable.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,p("pipe count=%d opts=%j",a.pipesCount,r);var u=(!r||!1!==r.end)&&t!==o.stdout&&t!==o.stderr?onend:unpipe;function onunpipe(r,o){p("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,function cleanup(){p("cleanup"),t.removeListener("close",onclose),t.removeListener("finish",onfinish),t.removeListener("drain",l),t.removeListener("error",onerror),t.removeListener("unpipe",onunpipe),i.removeListener("end",onend),i.removeListener("end",unpipe),i.removeListener("data",ondata),d=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||l()}())}function onend(){p("onend"),t.end()}a.endEmitted?o.nextTick(u):i.once("end",u),t.on("unpipe",onunpipe);var l=function pipeOnDrain(t){return function pipeOnDrainFunctionResult(){var r=t._readableState;p("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&c(t,"data")&&(r.flowing=!0,flow(t))}}(i);t.on("drain",l);var d=!1;function ondata(r){p("ondata");var o=t.write(r);p("dest.write",o),!1===o&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==indexOf(a.pipes,t))&&!d&&(p("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function onerror(r){p("onerror",r),unpipe(),t.removeListener("error",onerror),0===c(t,"error")&&P(t,r)}function onclose(){t.removeListener("finish",onfinish),unpipe()}function onfinish(){p("onfinish"),t.removeListener("close",onclose),unpipe()}function unpipe(){p("unpipe"),i.unpipe(t)}return i.on("data",ondata),function prependListener(t,r,i){if("function"==typeof t.prependListener)return t.prependListener(r,i);t._events&&t._events[r]?Array.isArray(t._events[r])?t._events[r].unshift(i):t._events[r]=[i,t._events[r]]:t.on(r,i)}(t,"error",onerror),t.once("close",onclose),t.once("finish",onfinish),t.emit("pipe",i),a.flowing||(p("pipe resume"),i.resume()),t},Readable.prototype.unpipe=function(t){var r=this._readableState,i={hasUnpiped:!1};if(0===r.pipesCount)return this;if(1===r.pipesCount)return t&&t!==r.pipes||(t||(t=r.pipes),r.pipes=null,r.pipesCount=0,r.flowing=!1,t&&t.emit("unpipe",this,i)),this;if(!t){var o=r.pipes,a=r.pipesCount;r.pipes=null,r.pipesCount=0,r.flowing=!1;for(var c=0;c<a;c++)o[c].emit("unpipe",this,{hasUnpiped:!1});return this}var u=indexOf(r.pipes,t);return-1===u||(r.pipes.splice(u,1),r.pipesCount-=1,1===r.pipesCount&&(r.pipes=r.pipes[0]),t.emit("unpipe",this,i)),this},Readable.prototype.on=function(t,r){var i=u.prototype.on.call(this,t,r),a=this._readableState;return"data"===t?(a.readableListening=this.listenerCount("readable")>0,!1!==a.flowing&&this.resume()):"readable"===t&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,p("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||o.nextTick(nReadingNextTick,this))),i},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(t,r){var i=u.prototype.removeListener.call(this,t,r);return"readable"===t&&o.nextTick(updateReadableListening,this),i},Readable.prototype.removeAllListeners=function(t){var r=u.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||o.nextTick(updateReadableListening,this),r},Readable.prototype.resume=function(){var t=this._readableState;return t.flowing||(p("resume"),t.flowing=!t.readableListening,function resume(t,r){r.resumeScheduled||(r.resumeScheduled=!0,o.nextTick(resume_,t,r))}(this,t)),t.paused=!1,this},Readable.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(t){var r=this,i=this._readableState,o=!1;for(var a in t.on("end",(function(){if(p("wrapped end"),i.decoder&&!i.ended){var t=i.decoder.end();t&&t.length&&r.push(t)}r.push(null)})),t.on("data",(function(a){(p("wrapped data"),i.decoder&&(a=i.decoder.write(a)),i.objectMode&&null==a)||(i.objectMode||a&&a.length)&&(r.push(a)||(o=!0,t.pause()))})),t)void 0===this[a]&&"function"==typeof t[a]&&(this[a]=function methodWrap(r){return function methodWrapReturnFunction(){return t[r].apply(t,arguments)}}(a));for(var c=0;c<C.length;c++)t.on(C[c],this.emit.bind(this,C[c]));return this._read=function(r){p("wrapped _read",r),o&&(o=!1,t.resume())},this},"function"==typeof Symbol&&(Readable.prototype[Symbol.asyncIterator]=function(){return void 0===g&&(g=i(788)),g(this)}),Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function get(){return this._readableState.highWaterMark}}),Object.defineProperty(Readable.prototype,"readableBuffer",{enumerable:!1,get:function get(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Readable.prototype,"readableFlowing",{enumerable:!1,get:function get(){return this._readableState.flowing},set:function set(t){this._readableState&&(this._readableState.flowing=t)}}),Readable._fromList=fromList,Object.defineProperty(Readable.prototype,"readableLength",{enumerable:!1,get:function get(){return this._readableState.length}}),"function"==typeof Symbol&&(Readable.from=function(t,r){return void 0===y&&(y=i(789)),y(Readable,t,r)})}).call(this,i(17),i(19))},function(t,r,i){t.exports=i(45).EventEmitter},function(t,r,i){"use strict";(function(r){function emitErrorAndCloseNT(t,r){emitErrorNT(t,r),emitCloseNT(t)}function emitCloseNT(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function emitErrorNT(t,r){t.emit("error",r)}t.exports={destroy:function destroy(t,i){var o=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(i?i(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(emitErrorNT,this,t)):r.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!i&&t?o._writableState?o._writableState.errorEmitted?r.nextTick(emitCloseNT,o):(o._writableState.errorEmitted=!0,r.nextTick(emitErrorAndCloseNT,o,t)):r.nextTick(emitErrorAndCloseNT,o,t):i?(r.nextTick(emitCloseNT,o),i(t)):r.nextTick(emitCloseNT,o)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(t,r){var i=t._readableState,o=t._writableState;i&&i.autoDestroy||o&&o.autoDestroy?t.destroy(r):t.emit("error",r)}}}).call(this,i(19))},function(t,r,i){"use strict";var o=i(95).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function getHighWaterMark(t,r,i,a){var c=function highWaterMarkFrom(t,r,i){return null!=t.highWaterMark?t.highWaterMark:r?t[i]:null}(r,a,i);if(null!=c){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new o(a?i:"highWaterMark",c);return Math.floor(c)}return t.objectMode?16:16384}}},function(t,r,i){"use strict";(function(r,o){function CorkedRequest(t){var r=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(t,r,i){var o=t.entry;t.entry=null;for(;o;){var a=o.callback;r.pendingcb--,a(i),o=o.next}r.corkedRequestsFree.next=t}(r,t)}}var a;t.exports=Writable,Writable.WritableState=WritableState;var c={deprecate:i(328)},u=i(324),l=i(16).Buffer,d=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var p,h=i(325),m=i(326).getHighWaterMark,g=i(95).codes,y=g.ERR_INVALID_ARG_TYPE,v=g.ERR_METHOD_NOT_IMPLEMENTED,b=g.ERR_MULTIPLE_CALLBACK,_=g.ERR_STREAM_CANNOT_PIPE,w=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,I=g.ERR_STREAM_WRITE_AFTER_END,k=g.ERR_UNKNOWN_ENCODING,x=h.errorOrDestroy;function nop(){}function WritableState(t,r,c){a=a||i(96),t=t||{},"boolean"!=typeof c&&(c=r instanceof a),this.objectMode=!!t.objectMode,c&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=m(this,t,"writableHighWaterMark",c),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===t.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function onwrite(t,r){var i=t._writableState,a=i.sync,c=i.writecb;if("function"!=typeof c)throw new b;if(function onwriteStateUpdate(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),r)!function onwriteError(t,r,i,a,c){--r.pendingcb,i?(o.nextTick(c,a),o.nextTick(finishMaybe,t,r),t._writableState.errorEmitted=!0,x(t,a)):(c(a),t._writableState.errorEmitted=!0,x(t,a),finishMaybe(t,r))}(t,i,a,r,c);else{var u=needFinish(i)||t.destroyed;u||i.corked||i.bufferProcessing||!i.bufferedRequest||clearBuffer(t,i),a?o.nextTick(afterWrite,t,i,u,c):afterWrite(t,i,u,c)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(t){var r=this instanceof(a=a||i(96));if(!r&&!p.call(Writable,this))return new Writable(t);this._writableState=new WritableState(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function doWrite(t,r,i,o,a,c,u){r.writelen=o,r.writecb=u,r.writing=!0,r.sync=!0,r.destroyed?r.onwrite(new w("write")):i?t._writev(a,r.onwrite):t._write(a,c,r.onwrite),r.sync=!1}function afterWrite(t,r,i,o){i||function onwriteDrain(t,r){0===r.length&&r.needDrain&&(r.needDrain=!1,t.emit("drain"))}(t,r),r.pendingcb--,o(),finishMaybe(t,r)}function clearBuffer(t,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(t._writev&&i&&i.next){var o=r.bufferedRequestCount,a=new Array(o),c=r.corkedRequestsFree;c.entry=i;for(var u=0,l=!0;i;)a[u]=i,i.isBuf||(l=!1),i=i.next,u+=1;a.allBuffers=l,doWrite(t,r,!0,r.length,a,"",c.finish),r.pendingcb++,r.lastBufferedRequest=null,c.next?(r.corkedRequestsFree=c.next,c.next=null):r.corkedRequestsFree=new CorkedRequest(r),r.bufferedRequestCount=0}else{for(;i;){var d=i.chunk,p=i.encoding,h=i.callback;if(doWrite(t,r,!1,r.objectMode?1:d.length,d,p,h),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function needFinish(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function callFinal(t,r){t._final((function(i){r.pendingcb--,i&&x(t,i),r.prefinished=!0,t.emit("prefinish"),finishMaybe(t,r)}))}function finishMaybe(t,r){var i=needFinish(r);if(i&&(function prefinish(t,r){r.prefinished||r.finalCalled||("function"!=typeof t._final||r.destroyed?(r.prefinished=!0,t.emit("prefinish")):(r.pendingcb++,r.finalCalled=!0,o.nextTick(callFinal,t,r)))}(t,r),0===r.pendingcb&&(r.finished=!0,t.emit("finish"),r.autoDestroy))){var a=t._readableState;(!a||a.autoDestroy&&a.endEmitted)&&t.destroy()}return i}i(30)(Writable,u),WritableState.prototype.getBuffer=function getBuffer(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:c.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(t){return!!p.call(this,t)||this===Writable&&(t&&t._writableState instanceof WritableState)}})):p=function realHasInstance(t){return t instanceof this},Writable.prototype.pipe=function(){x(this,new _)},Writable.prototype.write=function(t,r,i){var a=this._writableState,c=!1,u=!a.objectMode&&function _isUint8Array(t){return l.isBuffer(t)||t instanceof d}(t);return u&&!l.isBuffer(t)&&(t=function _uint8ArrayToBuffer(t){return l.from(t)}(t)),"function"==typeof r&&(i=r,r=null),u?r="buffer":r||(r=a.defaultEncoding),"function"!=typeof i&&(i=nop),a.ending?function writeAfterEnd(t,r){var i=new I;x(t,i),o.nextTick(r,i)}(this,i):(u||function validChunk(t,r,i,a){var c;return null===i?c=new S:"string"==typeof i||r.objectMode||(c=new y("chunk",["string","Buffer"],i)),!c||(x(t,c),o.nextTick(a,c),!1)}(this,a,t,i))&&(a.pendingcb++,c=function writeOrBuffer(t,r,i,o,a,c){if(!i){var u=function decodeChunk(t,r,i){t.objectMode||!1===t.decodeStrings||"string"!=typeof r||(r=l.from(r,i));return r}(r,o,a);o!==u&&(i=!0,a="buffer",o=u)}var d=r.objectMode?1:o.length;r.length+=d;var p=r.length<r.highWaterMark;p||(r.needDrain=!0);if(r.writing||r.corked){var h=r.lastBufferedRequest;r.lastBufferedRequest={chunk:o,encoding:a,isBuf:i,callback:c,next:null},h?h.next=r.lastBufferedRequest:r.bufferedRequest=r.lastBufferedRequest,r.bufferedRequestCount+=1}else doWrite(t,r,!1,d,o,a,c);return p}(this,a,u,t,r,i)),c},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||clearBuffer(this,t))},Writable.prototype.setDefaultEncoding=function setDefaultEncoding(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new k(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(t,r,i){i(new v("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(t,r,i){var a=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(t,r,i){r.ending=!0,finishMaybe(t,r),i&&(r.finished?o.nextTick(i):t.once("finish",i));r.ended=!0,t.writable=!1}(this,a,i),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(t){this._writableState&&(this._writableState.destroyed=t)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(t,r){r(t)}}).call(this,i(17),i(19))},function(t,r,i){(function(r){function config(t){try{if(!r.localStorage)return!1}catch(t){return!1}var i=r.localStorage[t];return null!=i&&"true"===String(i).toLowerCase()}t.exports=function deprecate(t,r){if(config("noDeprecation"))return t;var i=!1;return function deprecated(){if(!i){if(config("throwDeprecation"))throw new Error(r);config("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}}).call(this,i(17))},function(t,r,i){"use strict";t.exports=Transform;var o=i(95).codes,a=o.ERR_METHOD_NOT_IMPLEMENTED,c=o.ERR_MULTIPLE_CALLBACK,u=o.ERR_TRANSFORM_ALREADY_TRANSFORMING,l=o.ERR_TRANSFORM_WITH_LENGTH_0,d=i(96);function afterTransform(t,r){var i=this._transformState;i.transforming=!1;var o=i.writecb;if(null===o)return this.emit("error",new c);i.writechunk=null,i.writecb=null,null!=r&&this.push(r),o(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function Transform(t){if(!(this instanceof Transform))return new Transform(t);d.call(this,t),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",prefinish)}function prefinish(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?done(this,null,null):this._flush((function(r,i){done(t,r,i)}))}function done(t,r,i){if(r)return t.emit("error",r);if(null!=i&&t.push(i),t._writableState.length)throw new l;if(t._transformState.transforming)throw new u;return t.push(null)}i(30)(Transform,d),Transform.prototype.push=function(t,r){return this._transformState.needTransform=!1,d.prototype.push.call(this,t,r)},Transform.prototype._transform=function(t,r,i){i(new a("_transform()"))},Transform.prototype._write=function(t,r,i){var o=this._transformState;if(o.writecb=i,o.writechunk=t,o.writeencoding=r,!o.transforming){var a=this._readableState;(o.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},Transform.prototype._read=function(t){var r=this._transformState;null===r.writechunk||r.transforming?r.needTransform=!0:(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform))},Transform.prototype._destroy=function(t,r){d.prototype._destroy.call(this,t,(function(t){r(t)}))}},function(t,r,i){(function(r){const i=t.exports;i.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},i.codes={};for(const t in i.types){const r=i.types[t];i.codes[r]=t}i.CMD_SHIFT=4,i.CMD_MASK=240,i.DUP_MASK=8,i.QOS_MASK=3,i.QOS_SHIFT=1,i.RETAIN_MASK=1,i.VARBYTEINT_MASK=127,i.VARBYTEINT_FIN_MASK=128,i.VARBYTEINT_MAX=268435455,i.SESSIONPRESENT_MASK=1,i.SESSIONPRESENT_HEADER=r.from([i.SESSIONPRESENT_MASK]),i.CONNACK_HEADER=r.from([i.codes.connack<<i.CMD_SHIFT]),i.USERNAME_MASK=128,i.PASSWORD_MASK=64,i.WILL_RETAIN_MASK=32,i.WILL_QOS_MASK=24,i.WILL_QOS_SHIFT=3,i.WILL_FLAG_MASK=4,i.CLEAN_SESSION_MASK=2,i.CONNECT_HEADER=r.from([i.codes.connect<<i.CMD_SHIFT]),i.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},i.propertiesCodes={};for(const t in i.properties){const r=i.properties[t];i.propertiesCodes[r]=t}function genHeader(t){return[0,1,2].map(o=>[0,1].map(a=>[0,1].map(c=>{const u=r.alloc(1);return u.writeUInt8(i.codes[t]<<i.CMD_SHIFT|(a?i.DUP_MASK:0)|o<<i.QOS_SHIFT|c,0,!0),u})))}i.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},i.PUBLISH_HEADER=genHeader("publish"),i.SUBSCRIBE_HEADER=genHeader("subscribe"),i.SUBSCRIBE_OPTIONS_QOS_MASK=3,i.SUBSCRIBE_OPTIONS_NL_MASK=1,i.SUBSCRIBE_OPTIONS_NL_SHIFT=2,i.SUBSCRIBE_OPTIONS_RAP_MASK=1,i.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,i.SUBSCRIBE_OPTIONS_RH_MASK=3,i.SUBSCRIBE_OPTIONS_RH_SHIFT=4,i.SUBSCRIBE_OPTIONS_RH=[0,16,32],i.SUBSCRIBE_OPTIONS_NL=4,i.SUBSCRIBE_OPTIONS_RAP=8,i.SUBSCRIBE_OPTIONS_QOS=[0,1,2],i.UNSUBSCRIBE_HEADER=genHeader("unsubscribe"),i.ACKS={unsuback:genHeader("unsuback"),puback:genHeader("puback"),pubcomp:genHeader("pubcomp"),pubrel:genHeader("pubrel"),pubrec:genHeader("pubrec")},i.SUBACK_HEADER=r.from([i.codes.suback<<i.CMD_SHIFT]),i.VERSION3=r.from([3]),i.VERSION4=r.from([4]),i.VERSION5=r.from([5]),i.VERSION131=r.from([131]),i.VERSION132=r.from([132]),i.QOS=[0,1,2].map(t=>r.from([t])),i.EMPTY={pingreq:r.from([i.codes.pingreq<<4,0]),pingresp:r.from([i.codes.pingresp<<4,0]),disconnect:r.from([i.codes.disconnect<<4,0])}}).call(this,i(16).Buffer)},function(t,r,i){(function(r){const o=i(330),a=r.allocUnsafe(0),c=r.from([0]),u=i(800),l=i(117).nextTick,d=i(75)("mqtt-packet:writeToStream"),p=u.cache,h=u.generateNumber,m=u.generateCache,g=u.genBufVariableByteInt,y=u.generate4ByteBuffer;let v=writeNumberCached,b=!0;function generate(t,i,u){switch(d("generate called"),i.cork&&(i.cork(),l(uncork,i)),b&&(b=!1,m()),d("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return function connect(t,i,a){const c=t||{},u=c.protocolId||"MQTT";let l=c.protocolVersion||4;const d=c.will;let p=c.clean;const h=c.keepalive||0,m=c.clientId||"",g=c.username,y=c.password,b=c.properties;void 0===p&&(p=!0);let _=0;if(!u||"string"!=typeof u&&!r.isBuffer(u))return i.emit("error",new Error("Invalid protocolId")),!1;_+=u.length+2;if(3!==l&&4!==l&&5!==l)return i.emit("error",new Error("Invalid protocol version")),!1;_+=1;if(("string"==typeof m||r.isBuffer(m))&&(m||l>=4)&&(m||p))_+=r.byteLength(m)+2;else{if(l<4)return i.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*p==0)return i.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof h||h<0||h>65535||h%1!=0)return i.emit("error",new Error("Invalid keepalive")),!1;_+=2;if(_+=1,5===l){var w=getProperties(i,b);if(!w)return!1;_+=w.length}if(d){if("object"!=typeof d)return i.emit("error",new Error("Invalid will")),!1;if(!d.topic||"string"!=typeof d.topic)return i.emit("error",new Error("Invalid will topic")),!1;if(_+=r.byteLength(d.topic)+2,_+=2,d.payload){if(!(d.payload.length>=0))return i.emit("error",new Error("Invalid will payload")),!1;"string"==typeof d.payload?_+=r.byteLength(d.payload):_+=d.payload.length}var S={};if(5===l){if(!(S=getProperties(i,d.properties)))return!1;_+=S.length}}let I=!1;if(null!=g){if(!isStringOrBuffer(g))return i.emit("error",new Error("Invalid username")),!1;I=!0,_+=r.byteLength(g)+2}if(null!=y){if(!I)return i.emit("error",new Error("Username is required to use password")),!1;if(!isStringOrBuffer(y))return i.emit("error",new Error("Invalid password")),!1;_+=byteLength(y)+2}i.write(o.CONNECT_HEADER),writeVarByteInt(i,_),writeStringOrBuffer(i,u),c.bridgeMode&&(l+=128);i.write(131===l?o.VERSION131:132===l?o.VERSION132:4===l?o.VERSION4:5===l?o.VERSION5:o.VERSION3);let k=0;k|=null!=g?o.USERNAME_MASK:0,k|=null!=y?o.PASSWORD_MASK:0,k|=d&&d.retain?o.WILL_RETAIN_MASK:0,k|=d&&d.qos?d.qos<<o.WILL_QOS_SHIFT:0,k|=d?o.WILL_FLAG_MASK:0,k|=p?o.CLEAN_SESSION_MASK:0,i.write(r.from([k])),v(i,h),5===l&&w.write();writeStringOrBuffer(i,m),d&&(5===l&&S.write(),writeString(i,d.topic),writeStringOrBuffer(i,d.payload));null!=g&&writeStringOrBuffer(i,g);null!=y&&writeStringOrBuffer(i,y);return!0}(t,i);case"connack":return function connack(t,i,a){const u=a?a.protocolVersion:4,l=t||{},d=5===u?l.reasonCode:l.returnCode,p=l.properties;let h=2;if("number"!=typeof d)return i.emit("error",new Error("Invalid return code")),!1;let m=null;if(5===u){if(m=getProperties(i,p),!m)return!1;h+=m.length}i.write(o.CONNACK_HEADER),writeVarByteInt(i,h),i.write(l.sessionPresent?o.SESSIONPRESENT_HEADER:c),i.write(r.from([d])),null!=m&&m.write();return!0}(t,i,u);case"publish":return function publish(t,i,c){d("publish: packet: %o",t);const u=c?c.protocolVersion:4,l=t||{},p=l.qos||0,h=l.retain?o.RETAIN_MASK:0,m=l.topic,g=l.payload||a,y=l.messageId,b=l.properties;let _=0;if("string"==typeof m)_+=r.byteLength(m)+2;else{if(!r.isBuffer(m))return i.emit("error",new Error("Invalid topic")),!1;_+=m.length+2}r.isBuffer(g)?_+=g.length:_+=r.byteLength(g);if(p&&"number"!=typeof y)return i.emit("error",new Error("Invalid messageId")),!1;p&&(_+=2);let w=null;if(5===u){if(w=getProperties(i,b),!w)return!1;_+=w.length}i.write(o.PUBLISH_HEADER[p][l.dup?1:0][h?1:0]),writeVarByteInt(i,_),v(i,byteLength(m)),i.write(m),p>0&&v(i,y);null!=w&&w.write();return d("publish: payload: %o",g),i.write(g)}(t,i,u);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function confirmation(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.cmd||"puback",d=u.messageId,p=u.dup&&"pubrel"===l?o.DUP_MASK:0;let h=0;const m=u.reasonCode,g=u.properties;let y=5===c?3:2;"pubrel"===l&&(h=1);if("number"!=typeof d)return i.emit("error",new Error("Invalid messageId")),!1;let b=null;if(5===c&&"object"==typeof g){if(b=getPropertiesByMaximumPacketSize(i,g,a,y),!b)return!1;y+=b.length}i.write(o.ACKS[l][h][p][0]),writeVarByteInt(i,y),v(i,d),5===c&&i.write(r.from([m]));null!==b&&b.write();return!0}(t,i,u);case"subscribe":return function subscribe(t,i,a){d("subscribe: packet: ");const c=a?a.protocolVersion:4,u=t||{},l=u.dup?o.DUP_MASK:0,p=u.messageId,h=u.subscriptions,m=u.properties;let g=0;if("number"!=typeof p)return i.emit("error",new Error("Invalid messageId")),!1;g+=2;let y=null;if(5===c){if(y=getProperties(i,m),!y)return!1;g+=y.length}if("object"!=typeof h||!h.length)return i.emit("error",new Error("Invalid subscriptions")),!1;for(let t=0;t<h.length;t+=1){const o=h[t].topic,a=h[t].qos;if("string"!=typeof o)return i.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof a)return i.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===c){if("boolean"!=typeof(h[t].nl||!1))return i.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(h[t].rap||!1))return i.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const r=h[t].rh||0;if("number"!=typeof r||r>2)return i.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}g+=r.byteLength(o)+2+1}d("subscribe: writing to stream: %o",o.SUBSCRIBE_HEADER),i.write(o.SUBSCRIBE_HEADER[1][l?1:0][0]),writeVarByteInt(i,g),v(i,p),null!==y&&y.write();let b=!0;for(const t of h){const a=t.topic,u=t.qos,l=+t.nl,d=+t.rap,p=t.rh;let h;writeString(i,a),h=o.SUBSCRIBE_OPTIONS_QOS[u],5===c&&(h|=l?o.SUBSCRIBE_OPTIONS_NL:0,h|=d?o.SUBSCRIBE_OPTIONS_RAP:0,h|=p?o.SUBSCRIBE_OPTIONS_RH[p]:0),b=i.write(r.from([h]))}return b}(t,i,u);case"suback":return function suback(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.messageId,d=u.granted,p=u.properties;let h=0;if("number"!=typeof l)return i.emit("error",new Error("Invalid messageId")),!1;h+=2;if("object"!=typeof d||!d.length)return i.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<d.length;t+=1){if("number"!=typeof d[t])return i.emit("error",new Error("Invalid qos vector")),!1;h+=1}let m=null;if(5===c){if(m=getPropertiesByMaximumPacketSize(i,p,a,h),!m)return!1;h+=m.length}i.write(o.SUBACK_HEADER),writeVarByteInt(i,h),v(i,l),null!==m&&m.write();return i.write(r.from(d))}(t,i,u);case"unsubscribe":return function unsubscribe(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.messageId,d=u.dup?o.DUP_MASK:0,p=u.unsubscriptions,h=u.properties;let m=0;if("number"!=typeof l)return i.emit("error",new Error("Invalid messageId")),!1;m+=2;if("object"!=typeof p||!p.length)return i.emit("error",new Error("Invalid unsubscriptions")),!1;for(let t=0;t<p.length;t+=1){if("string"!=typeof p[t])return i.emit("error",new Error("Invalid unsubscriptions")),!1;m+=r.byteLength(p[t])+2}let g=null;if(5===c){if(g=getProperties(i,h),!g)return!1;m+=g.length}i.write(o.UNSUBSCRIBE_HEADER[1][d?1:0][0]),writeVarByteInt(i,m),v(i,l),null!==g&&g.write();let y=!0;for(let t=0;t<p.length;t++)y=writeString(i,p[t]);return y}(t,i,u);case"unsuback":return function unsuback(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.messageId,d=u.dup?o.DUP_MASK:0,p=u.granted,h=u.properties,m=u.cmd;let g=2;if("number"!=typeof l)return i.emit("error",new Error("Invalid messageId")),!1;if(5===c){if("object"!=typeof p||!p.length)return i.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<p.length;t+=1){if("number"!=typeof p[t])return i.emit("error",new Error("Invalid qos vector")),!1;g+=1}}let y=null;if(5===c){if(y=getPropertiesByMaximumPacketSize(i,h,a,g),!y)return!1;g+=y.length}i.write(o.ACKS[m][0][d][0]),writeVarByteInt(i,g),v(i,l),null!==y&&y.write();5===c&&i.write(r.from(p));return!0}(t,i,u);case"pingreq":case"pingresp":return function emptyPacket(t,r,i){return r.write(o.EMPTY[t.cmd])}(t,i);case"disconnect":return function disconnect(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.reasonCode,d=u.properties;let p=5===c?1:0,h=null;if(5===c){if(h=getPropertiesByMaximumPacketSize(i,d,a,p),!h)return!1;p+=h.length}i.write(r.from([o.codes.disconnect<<4])),writeVarByteInt(i,p),5===c&&i.write(r.from([l]));null!==h&&h.write();return!0}(t,i,u);case"auth":return function auth(t,i,a){const c=a?a.protocolVersion:4,u=t||{},l=u.reasonCode,d=u.properties;let p=5===c?1:0;5!==c&&i.emit("error",new Error("Invalid mqtt version for auth packet"));const h=getPropertiesByMaximumPacketSize(i,d,a,p);if(!h)return!1;p+=h.length,i.write(r.from([o.codes.auth<<4])),writeVarByteInt(i,p),i.write(r.from([l])),null!==h&&h.write();return!0}(t,i,u);default:return i.emit("error",new Error("Unknown command")),!1}}function uncork(t){t.uncork()}Object.defineProperty(generate,"cacheNumbers",{get:()=>v===writeNumberCached,set(t){t?(p&&0!==Object.keys(p).length||(b=!0),v=writeNumberCached):(b=!1,v=writeNumberGenerated)}});const _={};function writeVarByteInt(t,r){if(r>o.VARBYTEINT_MAX)return t.emit("error",new Error("Invalid variable byte integer: "+r)),!1;let i=_[r];return i||(i=g(r),r<16384&&(_[r]=i)),d("writeVarByteInt: writing to stream: %o",i),t.write(i)}function writeString(t,i){const o=r.byteLength(i);return v(t,o),d("writeString: %s",i),t.write(i,"utf8")}function writeStringPair(t,r,i){writeString(t,r),writeString(t,i)}function writeNumberCached(t,r){return d("writeNumberCached: number: %d",r),d("writeNumberCached: %o",p[r]),t.write(p[r])}function writeNumberGenerated(t,r){const i=h(r);return d("writeNumberGenerated: %o",i),t.write(i)}function writeStringOrBuffer(t,r){"string"==typeof r?writeString(t,r):r?(v(t,r.length),t.write(r)):v(t,0)}function getProperties(t,i){if("object"!=typeof i||null!=i.length)return{length:1,write(){writeProperties(t,{},0)}};let a=0;function getLengthProperty(i,a){let c=0;switch(o.propertiesTypes[i]){case"byte":if("boolean"!=typeof a)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=2;break;case"int8":if("number"!=typeof a||a<0||a>255)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=2;break;case"binary":if(a&&null===a)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=1+r.byteLength(a)+2;break;case"int16":if("number"!=typeof a||a<0||a>65535)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=3;break;case"int32":if("number"!=typeof a||a<0||a>4294967295)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=5;break;case"var":if("number"!=typeof a||a<0||a>268435455)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=1+r.byteLength(g(a));break;case"string":if("string"!=typeof a)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=3+r.byteLength(a.toString());break;case"pair":if("object"!=typeof a)return t.emit("error",new Error(`Invalid ${i}: ${a}`)),!1;c+=Object.getOwnPropertyNames(a).reduce((t,i)=>{const o=a[i];return Array.isArray(o)?t+=o.reduce((t,o)=>t+=3+r.byteLength(i.toString())+2+r.byteLength(o.toString()),0):t+=3+r.byteLength(i.toString())+2+r.byteLength(a[i].toString()),t},0);break;default:return t.emit("error",new Error(`Invalid property ${i}: ${a}`)),!1}return c}if(i)for(const t in i){let r=0,o=0;const c=i[t];if(Array.isArray(c))for(let i=0;i<c.length;i++){if(o=getLengthProperty(t,c[i]),!o)return!1;r+=o}else{if(o=getLengthProperty(t,c),!o)return!1;r=o}if(!r)return!1;a+=r}return{length:r.byteLength(g(a))+a,write(){writeProperties(t,i,a)}}}function getPropertiesByMaximumPacketSize(t,r,i,o){const a=["reasonString","userProperties"],c=i&&i.properties&&i.properties.maximumPacketSize?i.properties.maximumPacketSize:0;let u=getProperties(t,r);if(c)for(;o+u.length>c;){const i=a.shift();if(!i||!r[i])return!1;delete r[i],u=getProperties(t,r)}return u}function writeProperty(t,i,a){switch(o.propertiesTypes[i]){case"byte":t.write(r.from([o.properties[i]])),t.write(r.from([+a]));break;case"int8":t.write(r.from([o.properties[i]])),t.write(r.from([a]));break;case"binary":t.write(r.from([o.properties[i]])),writeStringOrBuffer(t,a);break;case"int16":t.write(r.from([o.properties[i]])),v(t,a);break;case"int32":t.write(r.from([o.properties[i]])),function write4ByteNumber(t,r){const i=y(r);return d("write4ByteNumber: %o",i),t.write(i)}(t,a);break;case"var":t.write(r.from([o.properties[i]])),writeVarByteInt(t,a);break;case"string":t.write(r.from([o.properties[i]])),writeString(t,a);break;case"pair":Object.getOwnPropertyNames(a).forEach(c=>{const u=a[c];Array.isArray(u)?u.forEach(a=>{t.write(r.from([o.properties[i]])),writeStringPair(t,c.toString(),a.toString())}):(t.write(r.from([o.properties[i]])),writeStringPair(t,c.toString(),u.toString()))});break;default:return t.emit("error",new Error(`Invalid property ${i} value: ${a}`)),!1}}function writeProperties(t,r,i){writeVarByteInt(t,i);for(const i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&null!==r[i]){const o=r[i];if(Array.isArray(o))for(let r=0;r<o.length;r++)writeProperty(t,i,o[r]);else writeProperty(t,i,o)}}function byteLength(t){return t?t instanceof r?t.length:r.byteLength(t):0}function isStringOrBuffer(t){return"string"==typeof t||t instanceof r}t.exports=generate}).call(this,i(16).Buffer)},function(t,r,i){"use strict";var o=i(803),a=i(75)("mqttjs:tcp");t.exports=function streamBuilder(t,r){var i,c;return r.port=r.port||1883,r.hostname=r.hostname||r.host||"localhost",i=r.port,c=r.hostname,a("port %d and host %s",i,c),o.createConnection(i,c)}},function(t,r,i){"use strict";(function(r){var o,a,c,u=i(74).Transform,l=i(213);t.exports=function buildStream(t,i){if(i.hostname=i.hostname||i.host,!i.hostname)throw new Error("Could not determine host. Specify host manually.");var d="MQIsdp"===i.protocolId&&3===i.protocolVersion?"mqttv3.1":"mqtt";!function setDefaultOpts(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}(i);var p=function buildUrl(t,r){var i="wxs"===t.protocol?"wss":"ws",o=i+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(o=i+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(o=t.transformWsUrl(o,t,r)),o}(i,t);o=wx.connectSocket({url:p,protocols:[d]}),a=function buildProxy(){var t=new u;return t._write=function(t,r,i){o.send({data:t.buffer,success:function(){i()},fail:function(t){i(new Error(t))}})},t._flush=function socketEnd(t){o.close({success:function(){t()}})},t}(),(c=l.obj())._destroy=function(t,r){o.close({success:function(){r&&r(t)}})};var h=c.destroy;return c.destroy=function(){c.destroy=h;var t=this;setTimeout((function(){o.close({fail:function(){t._destroy(new Error)}})}),0)}.bind(c),function bindEventHandler(){o.onOpen((function(){c.setReadable(a),c.setWritable(a),c.emit("connect")})),o.onMessage((function(t){var i=t.data;i=i instanceof ArrayBuffer?r.from(i):r.from(i,"utf8"),a.push(i)})),o.onClose((function(){c.end(),c.destroy()})),o.onError((function(t){c.destroy(new Error(t.errMsg))}))}(),c}}).call(this,i(16).Buffer)},function(t,r,i){(function(r){var o=i(805),noop=function(){},eos=function(t,i,a){if("function"==typeof i)return eos(t,null,i);i||(i={}),a=o(a||noop);var c=t._writableState,u=t._readableState,l=i.readable||!1!==i.readable&&t.readable,d=i.writable||!1!==i.writable&&t.writable,p=!1,onlegacyfinish=function(){t.writable||onfinish()},onfinish=function(){d=!1,l||a.call(t)},onend=function(){l=!1,d||a.call(t)},onexit=function(r){a.call(t,r?new Error("exited with error code: "+r):null)},onerror=function(r){a.call(t,r)},onclose=function(){r.nextTick(onclosenexttick)},onclosenexttick=function(){if(!p)return(!l||u&&u.ended&&!u.destroyed)&&(!d||c&&c.ended&&!c.destroyed)?void 0:a.call(t,new Error("premature close"))},onrequest=function(){t.req.on("finish",onfinish)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(t)?d&&!c&&(t.on("end",onlegacyfinish),t.on("close",onlegacyfinish)):(t.on("complete",onfinish),t.on("abort",onclose),t.req?onrequest():t.on("request",onrequest)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on("exit",onexit),t.on("end",onend),t.on("finish",onfinish),!1!==i.error&&t.on("error",onerror),t.on("close",onclose),function(){p=!0,t.removeListener("complete",onfinish),t.removeListener("abort",onclose),t.removeListener("request",onrequest),t.req&&t.req.removeListener("finish",onfinish),t.removeListener("end",onlegacyfinish),t.removeListener("close",onlegacyfinish),t.removeListener("finish",onfinish),t.removeListener("exit",onexit),t.removeListener("end",onend),t.removeListener("error",onerror),t.removeListener("close",onclose)}};t.exports=eos}).call(this,i(19))},function(t,r){t.exports=function shift(t){var r=t._readableState;return r?r.objectMode||"number"==typeof t._duplexState?t.read():t.read(function getStateLength(t){if(t.buffer.length){var r=t.bufferIndex||0;if(t.buffer.head)return t.buffer.head.data.length;if(t.buffer.length-r>0&&t.buffer[r])return t.buffer[r].length}return t.length}(r)):null}},function(t,r,i){"use strict";(function(r){var o,a,c,u=i(74).Transform,l=i(213),d=!1;t.exports=function buildStream(t,i){if(i.hostname=i.hostname||i.host,!i.hostname)throw new Error("Could not determine host. Specify host manually.");var p="MQIsdp"===i.protocolId&&3===i.protocolVersion?"mqttv3.1":"mqtt";!function setDefaultOpts(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}(i);var h=function buildUrl(t,r){var i="alis"===t.protocol?"wss":"ws",o=i+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(o=i+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(o=t.transformWsUrl(o,t,r)),o}(i,t);return(o=i.my).connectSocket({url:h,protocols:p}),a=function buildProxy(){var t=new u;return t._write=function(t,r,i){o.sendSocketMessage({data:t.buffer,success:function(){i()},fail:function(){i(new Error)}})},t._flush=function socketEnd(t){o.closeSocket({success:function(){t()}})},t}(),c=l.obj(),function bindEventHandler(){d||(d=!0,o.onSocketOpen((function(){c.setReadable(a),c.setWritable(a),c.emit("connect")})),o.onSocketMessage((function(t){if("string"==typeof t.data){var i=r.from(t.data,"base64");a.push(i)}else{var o=new FileReader;o.addEventListener("load",(function(){var t=o.result;t=t instanceof ArrayBuffer?r.from(t):r.from(t,"utf8"),a.push(t)})),o.readAsArrayBuffer(t.data)}})),o.onSocketClose((function(){c.end(),c.destroy()})),o.onSocketError((function(t){c.destroy(t)})))}(),c}}).call(this,i(16).Buffer)},function(t,r,i){"use strict";(function(r,o){const a=i(807),c=i(75)("mqttjs:ws"),u=i(213),l=i(74).Transform;let d=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];const p=void 0!==r&&"browser"===r.title||"function"==typeof i;function buildUrl(t,r){let i=t.protocol+"://"+t.hostname+":"+t.port+t.path;return"function"==typeof t.transformWsUrl&&(i=t.transformWsUrl(i,t,r)),i}function setDefaultOpts(t){let r=t;return t.hostname||(r.hostname="localhost"),t.port||("wss"===t.protocol?r.port=443:r.port=80),t.path||(r.path="/"),t.wsOptions||(r.wsOptions={}),p||"wss"!==t.protocol||d.forEach((function(i){t.hasOwnProperty(i)&&!t.wsOptions.hasOwnProperty(i)&&(r.wsOptions[i]=t[i])})),r}t.exports=p?function browserStreamBuilder(t,r){let i;c("browserStreamBuilder");const a=function setDefaultBrowserOpts(t){let r=setDefaultOpts(t);if(r.hostname||(r.hostname=r.host),!r.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const t=new URL(document.URL);r.hostname=t.hostname,r.port||(r.port=t.port)}return void 0===r.objectMode&&(r.objectMode=!(!0===r.binary||void 0===r.binary)),r}(r).browserBufferSize||524288,d=r.browserBufferTimeout||1e3,p=!r.objectMode;let h=function createBrowserWebSocket(t,r){const i="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";let o=buildUrl(r,t),a=new WebSocket(o,[i]);return a.binaryType="arraybuffer",a}(t,r),m=function buildProxy(t,r,i){let o=new l({objectModeMode:t.objectMode});return o._write=r,o._flush=i,o}(r,(function socketWriteBrowser(t,r,i){h.bufferedAmount>a&&setTimeout(socketWriteBrowser,d,t,r,i);p&&"string"==typeof t&&(t=o.from(t,"utf8"));try{h.send(t)}catch(t){return i(t)}i()}),(function socketEndBrowser(t){h.close(),t()}));r.objectMode||(m._writev=writev),m.on("close",()=>{h.close()});const g=void 0!==h.addEventListener;function onopen(){i.setReadable(m),i.setWritable(m),i.emit("connect")}function onclose(){i.end(),i.destroy()}function onerror(t){i.destroy(t)}function onmessage(t){let r=t.data;r=r instanceof ArrayBuffer?o.from(r):o.from(r,"utf8"),m.push(r)}function writev(t,r){const i=new Array(t.length);for(let r=0;r<t.length;r++)"string"==typeof t[r].chunk?i[r]=o.from(t[r],"utf8"):i[r]=t[r].chunk;this._write(o.concat(i),"binary",r)}return h.readyState===h.OPEN?i=m:(i=i=u(void 0,void 0,r),r.objectMode||(i._writev=writev),g?h.addEventListener("open",onopen):h.onopen=onopen),i.socket=h,g?(h.addEventListener("close",onclose),h.addEventListener("error",onerror),h.addEventListener("message",onmessage)):(h.onclose=onclose,h.onerror=onerror,h.onmessage=onmessage),i}:function streamBuilder(t,r){c("streamBuilder");let i=setDefaultOpts(r);const o=buildUrl(i,t);let u=function createWebSocket(t,r,i){c("createWebSocket"),c("protocol: "+i.protocolId+" "+i.protocolVersion);const o="MQIsdp"===i.protocolId&&3===i.protocolVersion?"mqttv3.1":"mqtt";return c("creating new Websocket for url: "+r+" and protocol: "+o),new a(r,[o],i.wsOptions)}(0,o,i),l=a.createWebSocketStream(u,i.wsOptions);return l.url=o,u.on("close",()=>{l.destroy()}),l}}).call(this,i(19),i(16).Buffer)},function(t,r,i){var o;t.exports=(o=i(214),function(t){var r=o,i=r.lib,a=i.WordArray,c=i.Hasher,u=r.algo,l=[],d=[];!function(){function isPrime(r){for(var i=t.sqrt(r),o=2;o<=i;o++)if(!(r%o))return!1;return!0}function getFractionalBits(t){return 4294967296*(t-(0|t))|0}for(var r=2,i=0;i<64;)isPrime(r)&&(i<8&&(l[i]=getFractionalBits(t.pow(r,.5))),d[i]=getFractionalBits(t.pow(r,1/3)),i++),r++}();var p=[],h=u.SHA256=c.extend({_doReset:function(){this._hash=new a.init(l.slice(0))},_doProcessBlock:function(t,r){for(var i=this._hash.words,o=i[0],a=i[1],c=i[2],u=i[3],l=i[4],h=i[5],m=i[6],g=i[7],y=0;y<64;y++){if(y<16)p[y]=0|t[r+y];else{var v=p[y-15],b=(v<<25|v>>>7)^(v<<14|v>>>18)^v>>>3,_=p[y-2],w=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;p[y]=b+p[y-7]+w+p[y-16]}var S=o&a^o&c^a&c,I=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22),k=g+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&h^~l&m)+d[y]+p[y];g=m,m=h,h=l,l=u+k|0,u=c,c=a,a=o,o=k+(I+S)|0}i[0]=i[0]+o|0,i[1]=i[1]+a|0,i[2]=i[2]+c|0,i[3]=i[3]+u|0,i[4]=i[4]+l|0,i[5]=i[5]+h|0,i[6]=i[6]+m|0,i[7]=i[7]+g|0},_doFinalize:function(){var r=this._data,i=r.words,o=8*this._nDataBytes,a=8*r.sigBytes;return i[a>>>5]|=128<<24-a%32,i[14+(a+64>>>9<<4)]=t.floor(o/4294967296),i[15+(a+64>>>9<<4)]=o,r.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var t=c.clone.call(this);return t._hash=this._hash.clone(),t}});r.SHA256=c._createHelper(h),r.HmacSHA256=c._createHmacHelper(h)}(Math),o.SHA256)},function(t,r,i){(r=t.exports=i(340)).Stream=r,r.Readable=r,r.Writable=i(343),r.Duplex=i(97),r.Transform=i(344),r.PassThrough=i(825)},function(t,r,i){"use strict";(function(r,o){var a=i(117);t.exports=Readable;var c,u=i(819);Readable.ReadableState=ReadableState;i(45).EventEmitter;var EElistenerCount=function(t,r){return t.listeners(r).length},l=i(341),d=i(154).Buffer,p=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var h=Object.create(i(118));h.inherits=i(30);var m=i(820),g=void 0;g=m&&m.debuglog?m.debuglog("stream"):function(){};var y,v=i(821),b=i(342);h.inherits(Readable,l);var _=["error","close","destroy","pause","resume"];function ReadableState(t,r){t=t||{};var o=r instanceof(c=c||i(97));this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var a=t.highWaterMark,u=t.readableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:o&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new v,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(y||(y=i(152).StringDecoder),this.decoder=new y(t.encoding),this.encoding=t.encoding)}function Readable(t){if(c=c||i(97),!(this instanceof Readable))return new Readable(t);this._readableState=new ReadableState(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),l.call(this)}function readableAddChunk(t,r,i,o,a){var c,u=t._readableState;null===r?(u.reading=!1,function onEofChunk(t,r){if(r.ended)return;if(r.decoder){var i=r.decoder.end();i&&i.length&&(r.buffer.push(i),r.length+=r.objectMode?1:i.length)}r.ended=!0,emitReadable(t)}(t,u)):(a||(c=function chunkInvalid(t,r){var i;(function _isUint8Array(t){return d.isBuffer(t)||t instanceof p})(r)||"string"==typeof r||void 0===r||t.objectMode||(i=new TypeError("Invalid non-string/buffer chunk"));return i}(u,r)),c?t.emit("error",c):u.objectMode||r&&r.length>0?("string"==typeof r||u.objectMode||Object.getPrototypeOf(r)===d.prototype||(r=function _uint8ArrayToBuffer(t){return d.from(t)}(r)),o?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):addChunk(t,u,r,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!i?(r=u.decoder.write(r),u.objectMode||0!==r.length?addChunk(t,u,r,!1):maybeReadMore(t,u)):addChunk(t,u,r,!1))):o||(u.reading=!1));return function needMoreData(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function addChunk(t,r,i,o){r.flowing&&0===r.length&&!r.sync?(t.emit("data",i),t.read(0)):(r.length+=r.objectMode?1:i.length,o?r.buffer.unshift(i):r.buffer.push(i),r.needReadable&&emitReadable(t)),maybeReadMore(t,r)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),Readable.prototype.destroy=b.destroy,Readable.prototype._undestroy=b.undestroy,Readable.prototype._destroy=function(t,r){this.push(null),r(t)},Readable.prototype.push=function(t,r){var i,o=this._readableState;return o.objectMode?i=!0:"string"==typeof t&&((r=r||o.defaultEncoding)!==o.encoding&&(t=d.from(t,r),r=""),i=!0),readableAddChunk(this,t,r,!1,i)},Readable.prototype.unshift=function(t){return readableAddChunk(this,t,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(t){return y||(y=i(152).StringDecoder),this._readableState.decoder=new y(t),this._readableState.encoding=t,this};function howMuchToRead(t,r){return t<=0||0===r.length&&r.ended?0:r.objectMode?1:t!=t?r.flowing&&r.length?r.buffer.head.data.length:r.length:(t>r.highWaterMark&&(r.highWaterMark=function computeNewHighWaterMark(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=r.length?t:r.ended?r.length:(r.needReadable=!0,0))}function emitReadable(t){var r=t._readableState;r.needReadable=!1,r.emittedReadable||(g("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?a.nextTick(emitReadable_,t):emitReadable_(t))}function emitReadable_(t){g("emit readable"),t.emit("readable"),flow(t)}function maybeReadMore(t,r){r.readingMore||(r.readingMore=!0,a.nextTick(maybeReadMore_,t,r))}function maybeReadMore_(t,r){for(var i=r.length;!r.reading&&!r.flowing&&!r.ended&&r.length<r.highWaterMark&&(g("maybeReadMore read 0"),t.read(0),i!==r.length);)i=r.length;r.readingMore=!1}function nReadingNextTick(t){g("readable nexttick read 0"),t.read(0)}function resume_(t,r){r.reading||(g("resume read 0"),t.read(0)),r.resumeScheduled=!1,r.awaitDrain=0,t.emit("resume"),flow(t),r.flowing&&!r.reading&&t.read(0)}function flow(t){var r=t._readableState;for(g("flow",r.flowing);r.flowing&&null!==t.read(););}function fromList(t,r){return 0===r.length?null:(r.objectMode?i=r.buffer.shift():!t||t>=r.length?(i=r.decoder?r.buffer.join(""):1===r.buffer.length?r.buffer.head.data:r.buffer.concat(r.length),r.buffer.clear()):i=function fromListPartial(t,r,i){var o;t<r.head.data.length?(o=r.head.data.slice(0,t),r.head.data=r.head.data.slice(t)):o=t===r.head.data.length?r.shift():i?function copyFromBufferString(t,r){var i=r.head,o=1,a=i.data;t-=a.length;for(;i=i.next;){var c=i.data,u=t>c.length?c.length:t;if(u===c.length?a+=c:a+=c.slice(0,t),0===(t-=u)){u===c.length?(++o,i.next?r.head=i.next:r.head=r.tail=null):(r.head=i,i.data=c.slice(u));break}++o}return r.length-=o,a}(t,r):function copyFromBuffer(t,r){var i=d.allocUnsafe(t),o=r.head,a=1;o.data.copy(i),t-=o.data.length;for(;o=o.next;){var c=o.data,u=t>c.length?c.length:t;if(c.copy(i,i.length-t,0,u),0===(t-=u)){u===c.length?(++a,o.next?r.head=o.next:r.head=r.tail=null):(r.head=o,o.data=c.slice(u));break}++a}return r.length-=a,i}(t,r);return o}(t,r.buffer,r.decoder),i);var i}function endReadable(t){var r=t._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,a.nextTick(endReadableNT,r,t))}function endReadableNT(t,r){t.endEmitted||0!==t.length||(t.endEmitted=!0,r.readable=!1,r.emit("end"))}function indexOf(t,r){for(var i=0,o=t.length;i<o;i++)if(t[i]===r)return i;return-1}Readable.prototype.read=function(t){g("read",t),t=parseInt(t,10);var r=this._readableState,i=t;if(0!==t&&(r.emittedReadable=!1),0===t&&r.needReadable&&(r.length>=r.highWaterMark||r.ended))return g("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?endReadable(this):emitReadable(this),null;if(0===(t=howMuchToRead(t,r))&&r.ended)return 0===r.length&&endReadable(this),null;var o,a=r.needReadable;return g("need readable",a),(0===r.length||r.length-t<r.highWaterMark)&&g("length less than watermark",a=!0),r.ended||r.reading?g("reading or ended",a=!1):a&&(g("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(t=howMuchToRead(i,r))),null===(o=t>0?fromList(t,r):null)?(r.needReadable=!0,t=0):r.length-=t,0===r.length&&(r.ended||(r.needReadable=!0),i!==t&&r.ended&&endReadable(this)),null!==o&&this.emit("data",o),o},Readable.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(t,r){var i=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=t;break;case 1:c.pipes=[c.pipes,t];break;default:c.pipes.push(t)}c.pipesCount+=1,g("pipe count=%d opts=%j",c.pipesCount,r);var l=(!r||!1!==r.end)&&t!==o.stdout&&t!==o.stderr?onend:unpipe;function onunpipe(r,o){g("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,function cleanup(){g("cleanup"),t.removeListener("close",onclose),t.removeListener("finish",onfinish),t.removeListener("drain",d),t.removeListener("error",onerror),t.removeListener("unpipe",onunpipe),i.removeListener("end",onend),i.removeListener("end",unpipe),i.removeListener("data",ondata),p=!0,!c.awaitDrain||t._writableState&&!t._writableState.needDrain||d()}())}function onend(){g("onend"),t.end()}c.endEmitted?a.nextTick(l):i.once("end",l),t.on("unpipe",onunpipe);var d=function pipeOnDrain(t){return function(){var r=t._readableState;g("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&EElistenerCount(t,"data")&&(r.flowing=!0,flow(t))}}(i);t.on("drain",d);var p=!1;var h=!1;function ondata(r){g("ondata"),h=!1,!1!==t.write(r)||h||((1===c.pipesCount&&c.pipes===t||c.pipesCount>1&&-1!==indexOf(c.pipes,t))&&!p&&(g("false write response, pause",c.awaitDrain),c.awaitDrain++,h=!0),i.pause())}function onerror(r){g("onerror",r),unpipe(),t.removeListener("error",onerror),0===EElistenerCount(t,"error")&&t.emit("error",r)}function onclose(){t.removeListener("finish",onfinish),unpipe()}function onfinish(){g("onfinish"),t.removeListener("close",onclose),unpipe()}function unpipe(){g("unpipe"),i.unpipe(t)}return i.on("data",ondata),function prependListener(t,r,i){if("function"==typeof t.prependListener)return t.prependListener(r,i);t._events&&t._events[r]?u(t._events[r])?t._events[r].unshift(i):t._events[r]=[i,t._events[r]]:t.on(r,i)}(t,"error",onerror),t.once("close",onclose),t.once("finish",onfinish),t.emit("pipe",i),c.flowing||(g("pipe resume"),i.resume()),t},Readable.prototype.unpipe=function(t){var r=this._readableState,i={hasUnpiped:!1};if(0===r.pipesCount)return this;if(1===r.pipesCount)return t&&t!==r.pipes||(t||(t=r.pipes),r.pipes=null,r.pipesCount=0,r.flowing=!1,t&&t.emit("unpipe",this,i)),this;if(!t){var o=r.pipes,a=r.pipesCount;r.pipes=null,r.pipesCount=0,r.flowing=!1;for(var c=0;c<a;c++)o[c].emit("unpipe",this,{hasUnpiped:!1});return this}var u=indexOf(r.pipes,t);return-1===u||(r.pipes.splice(u,1),r.pipesCount-=1,1===r.pipesCount&&(r.pipes=r.pipes[0]),t.emit("unpipe",this,i)),this},Readable.prototype.on=function(t,r){var i=l.prototype.on.call(this,t,r);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var o=this._readableState;o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.emittedReadable=!1,o.reading?o.length&&emitReadable(this):a.nextTick(nReadingNextTick,this))}return i},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.resume=function(){var t=this._readableState;return t.flowing||(g("resume"),t.flowing=!0,function resume(t,r){r.resumeScheduled||(r.resumeScheduled=!0,a.nextTick(resume_,t,r))}(this,t)),this},Readable.prototype.pause=function(){return g("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(g("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Readable.prototype.wrap=function(t){var r=this,i=this._readableState,o=!1;for(var a in t.on("end",(function(){if(g("wrapped end"),i.decoder&&!i.ended){var t=i.decoder.end();t&&t.length&&r.push(t)}r.push(null)})),t.on("data",(function(a){(g("wrapped data"),i.decoder&&(a=i.decoder.write(a)),i.objectMode&&null==a)||(i.objectMode||a&&a.length)&&(r.push(a)||(o=!0,t.pause()))})),t)void 0===this[a]&&"function"==typeof t[a]&&(this[a]=function(r){return function(){return t[r].apply(t,arguments)}}(a));for(var c=0;c<_.length;c++)t.on(_[c],this.emit.bind(this,_[c]));return this._read=function(r){g("wrapped _read",r),o&&(o=!1,t.resume())},this},Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Readable._fromList=fromList}).call(this,i(17),i(19))},function(t,r,i){t.exports=i(45).EventEmitter},function(t,r,i){"use strict";var o=i(117);function emitErrorNT(t,r){t.emit("error",r)}t.exports={destroy:function destroy(t,r){var i=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(r?r(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,o.nextTick(emitErrorNT,this,t)):o.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!r&&t?i._writableState?i._writableState.errorEmitted||(i._writableState.errorEmitted=!0,o.nextTick(emitErrorNT,i,t)):o.nextTick(emitErrorNT,i,t):r&&r(t)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,r,i){"use strict";(function(r,o,a){var c=i(117);function CorkedRequest(t){var r=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(t,r,i){var o=t.entry;t.entry=null;for(;o;){var a=o.callback;r.pendingcb--,a(i),o=o.next}r.corkedRequestsFree.next=t}(r,t)}}t.exports=Writable;var u,l=!r.browser&&["v0.10","v0.9."].indexOf(r.version.slice(0,5))>-1?o:c.nextTick;Writable.WritableState=WritableState;var d=Object.create(i(118));d.inherits=i(30);var p={deprecate:i(328)},h=i(341),m=i(154).Buffer,g=(void 0!==a?a:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var y,v=i(342);function nop(){}function WritableState(t,r){u=u||i(97),t=t||{};var o=r instanceof u;this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var a=t.highWaterMark,d=t.writableHighWaterMark,p=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:o&&(d||0===d)?d:p,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function onwrite(t,r){var i=t._writableState,o=i.sync,a=i.writecb;if(function onwriteStateUpdate(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),r)!function onwriteError(t,r,i,o,a){--r.pendingcb,i?(c.nextTick(a,o),c.nextTick(finishMaybe,t,r),t._writableState.errorEmitted=!0,t.emit("error",o)):(a(o),t._writableState.errorEmitted=!0,t.emit("error",o),finishMaybe(t,r))}(t,i,o,r,a);else{var u=needFinish(i);u||i.corked||i.bufferProcessing||!i.bufferedRequest||clearBuffer(t,i),o?l(afterWrite,t,i,u,a):afterWrite(t,i,u,a)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(t){if(u=u||i(97),!(y.call(Writable,this)||this instanceof u))return new Writable(t);this._writableState=new WritableState(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function doWrite(t,r,i,o,a,c,u){r.writelen=o,r.writecb=u,r.writing=!0,r.sync=!0,i?t._writev(a,r.onwrite):t._write(a,c,r.onwrite),r.sync=!1}function afterWrite(t,r,i,o){i||function onwriteDrain(t,r){0===r.length&&r.needDrain&&(r.needDrain=!1,t.emit("drain"))}(t,r),r.pendingcb--,o(),finishMaybe(t,r)}function clearBuffer(t,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(t._writev&&i&&i.next){var o=r.bufferedRequestCount,a=new Array(o),c=r.corkedRequestsFree;c.entry=i;for(var u=0,l=!0;i;)a[u]=i,i.isBuf||(l=!1),i=i.next,u+=1;a.allBuffers=l,doWrite(t,r,!0,r.length,a,"",c.finish),r.pendingcb++,r.lastBufferedRequest=null,c.next?(r.corkedRequestsFree=c.next,c.next=null):r.corkedRequestsFree=new CorkedRequest(r),r.bufferedRequestCount=0}else{for(;i;){var d=i.chunk,p=i.encoding,h=i.callback;if(doWrite(t,r,!1,r.objectMode?1:d.length,d,p,h),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function needFinish(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function callFinal(t,r){t._final((function(i){r.pendingcb--,i&&t.emit("error",i),r.prefinished=!0,t.emit("prefinish"),finishMaybe(t,r)}))}function finishMaybe(t,r){var i=needFinish(r);return i&&(!function prefinish(t,r){r.prefinished||r.finalCalled||("function"==typeof t._final?(r.pendingcb++,r.finalCalled=!0,c.nextTick(callFinal,t,r)):(r.prefinished=!0,t.emit("prefinish")))}(t,r),0===r.pendingcb&&(r.finished=!0,t.emit("finish"))),i}d.inherits(Writable,h),WritableState.prototype.getBuffer=function getBuffer(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:p.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(y=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(t){return!!y.call(this,t)||this===Writable&&(t&&t._writableState instanceof WritableState)}})):y=function(t){return t instanceof this},Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(t,r,i){var o=this._writableState,a=!1,u=!o.objectMode&&function _isUint8Array(t){return m.isBuffer(t)||t instanceof g}(t);return u&&!m.isBuffer(t)&&(t=function _uint8ArrayToBuffer(t){return m.from(t)}(t)),"function"==typeof r&&(i=r,r=null),u?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof i&&(i=nop),o.ended?function writeAfterEnd(t,r){var i=new Error("write after end");t.emit("error",i),c.nextTick(r,i)}(this,i):(u||function validChunk(t,r,i,o){var a=!0,u=!1;return null===i?u=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||r.objectMode||(u=new TypeError("Invalid non-string/buffer chunk")),u&&(t.emit("error",u),c.nextTick(o,u),a=!1),a}(this,o,t,i))&&(o.pendingcb++,a=function writeOrBuffer(t,r,i,o,a,c){if(!i){var u=function decodeChunk(t,r,i){t.objectMode||!1===t.decodeStrings||"string"!=typeof r||(r=m.from(r,i));return r}(r,o,a);o!==u&&(i=!0,a="buffer",o=u)}var l=r.objectMode?1:o.length;r.length+=l;var d=r.length<r.highWaterMark;d||(r.needDrain=!0);if(r.writing||r.corked){var p=r.lastBufferedRequest;r.lastBufferedRequest={chunk:o,encoding:a,isBuf:i,callback:c,next:null},p?p.next=r.lastBufferedRequest:r.bufferedRequest=r.lastBufferedRequest,r.bufferedRequestCount+=1}else doWrite(t,r,!1,l,o,a,c);return d}(this,o,u,t,r,i)),a},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||clearBuffer(this,t))},Writable.prototype.setDefaultEncoding=function setDefaultEncoding(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(t,r,i){i(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(t,r,i){var o=this._writableState;"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),o.corked&&(o.corked=1,this.uncork()),o.ending||function endWritable(t,r,i){r.ending=!0,finishMaybe(t,r),i&&(r.finished?c.nextTick(i):t.once("finish",i));r.ended=!0,t.writable=!1}(this,o,i)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),Writable.prototype.destroy=v.destroy,Writable.prototype._undestroy=v.undestroy,Writable.prototype._destroy=function(t,r){this.end(),r(t)}}).call(this,i(19),i(823).setImmediate,i(17))},function(t,r,i){"use strict";t.exports=Transform;var o=i(97),a=Object.create(i(118));function afterTransform(t,r){var i=this._transformState;i.transforming=!1;var o=i.writecb;if(!o)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,null!=r&&this.push(r),o(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function Transform(t){if(!(this instanceof Transform))return new Transform(t);o.call(this,t),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",prefinish)}function prefinish(){var t=this;"function"==typeof this._flush?this._flush((function(r,i){done(t,r,i)})):done(this,null,null)}function done(t,r,i){if(r)return t.emit("error",r);if(null!=i&&t.push(i),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}a.inherits=i(30),a.inherits(Transform,o),Transform.prototype.push=function(t,r){return this._transformState.needTransform=!1,o.prototype.push.call(this,t,r)},Transform.prototype._transform=function(t,r,i){throw new Error("_transform() is not implemented")},Transform.prototype._write=function(t,r,i){var o=this._transformState;if(o.writecb=i,o.writechunk=t,o.writeencoding=r,!o.transforming){var a=this._readableState;(o.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},Transform.prototype._read=function(t){var r=this._transformState;null!==r.writechunk&&r.writecb&&!r.transforming?(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform)):r.needTransform=!0},Transform.prototype._destroy=function(t,r){var i=this;o.prototype._destroy.call(this,t,(function(t){r(t),i.emit("close")}))}},function(t,r,i){"use strict";(function(t){var o=i(219),a=i(354),c=i(37);class Auth{constructor(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-GB",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.ID_TOKEN=(""!==i?i+"_":"")+"rwt_idToken",this.ACCESS_TOKEN=(""!==i?i+"_":"")+"rwt_accessToken",this.REFRESH_TOKEN=(""!==i?i+"_":"")+"rwt_refreshToken",Object.assign(this,Object(c.a)()),this.__log=Auth.noop,t&&this._enableDebug(),this.__language=r,this.__refreshTokenPromise=null,this.__isRefreshing=!1,this.__isLogged=null,this.__parsedJwt=null,this.__specUrl=o||a.a.apiUrl,this.__client=this.initialize(!0)}static noop(){}_enableDebug(){this.__log=console.log.bind(console)}_requestInterceptor(t){return t.headers||(t.headers={}),t.headers["Accept-Language"]=this.__language,t}_responseInterceptor(t,r){if(401===t.status&&this.__isLogged){let t=localStorage.getItem(this.REFRESH_TOKEN);return this.__refreshTokenPromise=this.__isRefreshing?this.__refreshTokenPromise:this.__client.then(t=>(this.__isRefreshing=!0,t.apis.auth.refreshToken({},{requestBody:{refreshToken:localStorage.getItem(this.REFRESH_TOKEN)}}))).then(r=>(this.__isRefreshing=!1,this.login(r.data.idToken,r.data.accessToken,t,!0))).catch(t=>(this.__isRefreshing=!1,this.logout(),Promise.reject(t))),this.__refreshTokenPromise.then(()=>o.a.http({...r,headers:{...r.headers,Authorization:"Bearer "+localStorage.getItem(this.ID_TOKEN)}})).then(t=>("object"==typeof t.obj&&null!==t.obj&&(t.data=t.obj),t))}return"object"==typeof t.obj&&null!==t.obj&&(t.data=t.obj),t}initialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=localStorage.getItem(this.ID_TOKEN),a={};i&&(a.bearer=""+i),this.__isLogged=!!i;let c=this;return new o.a(this.__specUrl,{authorizations:a,requestInterceptor:this._requestInterceptor.bind(this),responseInterceptor:function(t){return c._responseInterceptor(t,this)}}).then(o=>(this.__isLogged=!!i,this.__parsedJwt=this.parseJwt(i),this.emit(this.__isLogged?"login":"logout",{client:o,isInitialEvent:t,isReauth:r,isLoggedInAsDevice:this.isLoggedInAs(this.__parsedJwt,"device"),isLoggedInAsObserver:this.isLoggedInAs(this.__parsedJwt,"observer"),isLoggedInAsInstanceAdmin:this.isLoggedInAs(this.__parsedJwt,"instanceAdmin"),isDemoAccount:this.isLoggedInAs(this.__parsedJwt,"demo"),isLoggedInAsAdmin:this.isLoggedInAs(this.__parsedJwt,"admin"),domain:this.getDomain(this.__parsedJwt)}),o)).catch(i=>(this.__isLogged=!1,this.emit("logout",{client:null,isInitialEvent:t,isLoggedInAsDevice:!1,isLoggedInAsObserver:!1,isLoggedInAsInstanceAdmin:!1,isDemoAccount:!1,isLoggedInAsAdmin:!1,isReauth:r}),Promise.reject(i)))}login(t,r,i){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return localStorage.setItem(this.ID_TOKEN,t),localStorage.setItem(this.ACCESS_TOKEN,r),localStorage.setItem(this.REFRESH_TOKEN,i),this.__client=this.initialize(!1,o)}logout(){return localStorage.removeItem(this.ID_TOKEN),localStorage.removeItem(this.ACCESS_TOKEN),localStorage.removeItem(this.REFRESH_TOKEN),this.__client=this.initialize()}isLoggedIn(){return this.__isLogged}isLoggedInAs(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"device";return!!((t=t||this.__parsedJwt)&&t["cognito:groups"]&&t["cognito:groups"].includes(r))}setLanguage(t){return this.__language=t,this.__language}getDomain(t){return(t=t||this.__parsedJwt)["custom:domain"]}parseJwt(r){if(!r||"string"!=typeof r)return!1;let i=r.match(/^(([0-9a-zA-Z]*)\.){2}[\w-]*$/);if(!i||!i[2])return!1;try{return i=new t(i[2],"base64").toString("binary"),JSON.parse(i)}catch(t){return!1}}}r.a=Auth}).call(this,i(16).Buffer)},function(t,r,i){t.exports=i(600)},function(t,r,i){t.exports=i(604)},function(t,r,i){"use strict";(function(r){function isSpecificValue(t){return t instanceof r||t instanceof Date||t instanceof RegExp}function cloneSpecificValue(t){if(t instanceof r){var i=r.alloc?r.alloc(t.length):new r(t.length);return t.copy(i),i}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);throw new Error("Unexpected situation")}function deepCloneArray(t){var r=[];return t.forEach((function(t,o){"object"==typeof t&&null!==t?Array.isArray(t)?r[o]=deepCloneArray(t):isSpecificValue(t)?r[o]=cloneSpecificValue(t):r[o]=i({},t):r[o]=t})),r}function safeGetProperty(t,r){return"__proto__"===r?void 0:t[r]}var i=t.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var t,r,o=arguments[0],a=Array.prototype.slice.call(arguments,1);return a.forEach((function(a){"object"!=typeof a||null===a||Array.isArray(a)||Object.keys(a).forEach((function(c){return r=safeGetProperty(o,c),(t=safeGetProperty(a,c))===o?void 0:"object"!=typeof t||null===t?void(o[c]=t):Array.isArray(t)?void(o[c]=deepCloneArray(t)):isSpecificValue(t)?void(o[c]=cloneSpecificValue(t)):"object"!=typeof r||null===r||Array.isArray(r)?void(o[c]=i({},t)):void(o[c]=i(r,t))}))})),o}}).call(this,i(16).Buffer)},function(t,r,i){var o=i(609);t.exports=function cloneDeep(t){return o(t,5)}},function(t,r,i){t.exports=i(678)},function(t,r,i){"use strict";var o=i(113),a=i(695),c=i(85);function toS(t){return Object.prototype.toString.call(t)}var u=Array.isArray||function isArray(t){return"[object Array]"===Object.prototype.toString.call(t)};function forEach(t,r){if(t.forEach)return t.forEach(r);for(var i=0;i<t.length;i++)r(t[i],i,t)}var l=Object.keys||function keys(t){var r=[];for(var i in t)r.push(i);return r},d=Object.prototype.propertyIsEnumerable,p=Object.getOwnPropertySymbols;function ownEnumerableKeys(t){var r=l(t);if(p)for(var i=p(t),o=0;o<i.length;o++)d.call(t,i[o])&&r.push(i[o]);return r}var h=Object.prototype.hasOwnProperty||function(t,r){return r in t};function isWritable(t,r){return"function"!=typeof c||!c(t,r).writable}function copy(t,r){if("object"==typeof t&&null!==t){var i;if(u(t))i=[];else if(function isDate(t){return"[object Date]"===toS(t)}(t))i=new Date(t.getTime?t.getTime():t);else if(function isRegExp(t){return"[object RegExp]"===toS(t)}(t))i=new RegExp(t);else if(function isError(t){return"[object Error]"===toS(t)}(t))i={message:t.message};else if(function isBoolean(t){return"[object Boolean]"===toS(t)}(t)||function isNumber(t){return"[object Number]"===toS(t)}(t)||function isString(t){return"[object String]"===toS(t)}(t))i=Object(t);else{if(o(t))return a(t);if(Object.create&&Object.getPrototypeOf)i=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)i={};else{var c=t.constructor&&t.constructor.prototype||t.__proto__||{},d=function T(){};d.prototype=c,i=new d}}return forEach((r.includeSymbols?ownEnumerableKeys:l)(t),(function(r){i[r]=t[r]})),i}return t}var m={__proto__:null};function walk(t,r){var i=[],o=[],a=!0,c=arguments.length>2?arguments[2]:m,d=c.includeSymbols?ownEnumerableKeys:l,p=!!c.immutable;return function walker(t){var l=p?copy(t,c):t,m={},g=!0,y={node:l,node_:t,path:[].concat(i),parent:o[o.length-1],parents:o,key:i[i.length-1],isRoot:0===i.length,level:i.length,circular:null,update:function(t,r){y.isRoot||(y.parent.node[y.key]=t),y.node=t,r&&(g=!1)},delete:function(t){delete y.parent.node[y.key],t&&(g=!1)},remove:function(t){u(y.parent.node)?y.parent.node.splice(y.key,1):delete y.parent.node[y.key],t&&(g=!1)},keys:null,before:function(t){m.before=t},after:function(t){m.after=t},pre:function(t){m.pre=t},post:function(t){m.post=t},stop:function(){a=!1},block:function(){g=!1}};if(!a)return y;function updateState(){if("object"==typeof y.node&&null!==y.node){y.keys&&y.node_===y.node||(y.keys=d(y.node)),y.isLeaf=0===y.keys.length;for(var r=0;r<o.length;r++)if(o[r].node_===t){y.circular=o[r];break}}else y.isLeaf=!0,y.keys=null;y.notLeaf=!y.isLeaf,y.notRoot=!y.isRoot}updateState();var v=r.call(y,y.node);return void 0!==v&&y.update&&y.update(v),m.before&&m.before.call(y,y.node),g?("object"!=typeof y.node||null===y.node||y.circular||(o.push(y),updateState(),forEach(y.keys,(function(t,r){i.push(t),m.pre&&m.pre.call(y,y.node[t],t);var o=walker(y.node[t]);p&&h.call(y.node,t)&&!isWritable(y.node,t)&&(y.node[t]=o.node),o.isLast=r===y.keys.length-1,o.isFirst=0===r,m.post&&m.post.call(y,o),i.pop()})),o.pop()),m.after&&m.after.call(y,y.node),y):y}(t).node}function Traverse(t){this.options=arguments.length>1?arguments[1]:m,this.value=t}function traverse(t){var r=arguments.length>1?arguments[1]:m;return new Traverse(t,r)}Traverse.prototype.get=function(t){for(var r=this.value,i=0;r&&i<t.length;i++){var o=t[i];if(!h.call(r,o)||!this.options.includeSymbols&&"symbol"==typeof o)return;r=r[o]}return r},Traverse.prototype.has=function(t){for(var r=this.value,i=0;r&&i<t.length;i++){var o=t[i];if(!h.call(r,o)||!this.options.includeSymbols&&"symbol"==typeof o)return!1;r=r[o]}return!0},Traverse.prototype.set=function(t,r){for(var i=this.value,o=0;o<t.length-1;o++){var a=t[o];h.call(i,a)||(i[a]={}),i=i[a]}return i[t[o]]=r,r},Traverse.prototype.map=function(t){return walk(this.value,t,{__proto__:null,immutable:!0,includeSymbols:!!this.options.includeSymbols})},Traverse.prototype.forEach=function(t){return this.value=walk(this.value,t,this.options),this.value},Traverse.prototype.reduce=function(t,r){var i=1===arguments.length,o=i?this.value:r;return this.forEach((function(r){this.isRoot&&i||(o=t.call(this,o,r))})),o},Traverse.prototype.paths=function(){var t=[];return this.forEach((function(){t.push(this.path)})),t},Traverse.prototype.nodes=function(){var t=[];return this.forEach((function(){t.push(this.node)})),t},Traverse.prototype.clone=function(){var t=[],r=[],i=this.options;return o(this.value)?a(this.value):function clone(o){for(var a=0;a<t.length;a++)if(t[a]===o)return r[a];if("object"==typeof o&&null!==o){var c=copy(o,i);return t.push(o),r.push(c),forEach((i.includeSymbols?ownEnumerableKeys:l)(o),(function(t){c[t]=clone(o[t])})),t.pop(),r.pop(),c}return o}(this.value)},forEach(ownEnumerableKeys(Traverse.prototype),(function(t){traverse[t]=function(r){var i=[].slice.call(arguments,1),o=new Traverse(r);return o[t].apply(o,i)}})),t.exports=traverse},function(t,r,i){var o=i(227),a=i(321),c=i(779);t.exports=function _objectWithoutProperties(t,r){if(null==t)return{};var i,u,l=c(t,r);if(o){var d=o(t);for(u=0;u<d.length;u++)i=d[u],a(r).call(r,i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(l[i]=t[i])}return l},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";r.parse=function parse(t,r){if("string"!=typeof t)throw new TypeError("argument str must be a string");for(var i={},a=r||{},c=t.split(";"),u=a.decode||o,l=0;l<c.length;l++){var d=c[l],p=d.indexOf("=");if(!(p<0)){var h=d.substring(0,p).trim();if(null==i[h]){var m=d.substring(p+1,d.length).trim();'"'===m[0]&&(m=m.slice(1,-1)),i[h]=tryDecode(m,u)}}}return i},r.serialize=function serialize(t,r,i){var o=i||{},u=o.encode||a;if("function"!=typeof u)throw new TypeError("option encode is invalid");if(!c.test(t))throw new TypeError("argument name is invalid");var l=u(r);if(l&&!c.test(l))throw new TypeError("argument val is invalid");var d=t+"="+l;if(null!=o.maxAge){var p=o.maxAge-0;if(isNaN(p)||!isFinite(p))throw new TypeError("option maxAge is invalid");d+="; Max-Age="+Math.floor(p)}if(o.domain){if(!c.test(o.domain))throw new TypeError("option domain is invalid");d+="; Domain="+o.domain}if(o.path){if(!c.test(o.path))throw new TypeError("option path is invalid");d+="; Path="+o.path}if(o.expires){if("function"!=typeof o.expires.toUTCString)throw new TypeError("option expires is invalid");d+="; Expires="+o.expires.toUTCString()}o.httpOnly&&(d+="; HttpOnly");o.secure&&(d+="; Secure");if(o.sameSite){switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:d+="; SameSite=Strict";break;case"lax":d+="; SameSite=Lax";break;case"strict":d+="; SameSite=Strict";break;case"none":d+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return d};var o=decodeURIComponent,a=encodeURIComponent,c=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function tryDecode(t,r){try{return r(t)}catch(r){return t}}},function(t,r,i){"use strict";r.a={apiUrl:"https://api.reactoo.com/v3/swagger.json",devApiUrl:"https://api.reactoo.com/dev3/swagger.json"}},function(t,r,i){t.exports.device=i(208),t.exports.thingShadow=i(828),t.exports.jobs=i(829)},function(t,r,i){"use strict";r.byteLength=function byteLength(t){var r=getLens(t),i=r[0],o=r[1];return 3*(i+o)/4-o},r.toByteArray=function toByteArray(t){var r,i,o=getLens(t),u=o[0],l=o[1],d=new c(function _byteLength(t,r,i){return 3*(r+i)/4-i}(0,u,l)),p=0,h=l>0?u-4:u;for(i=0;i<h;i+=4)r=a[t.charCodeAt(i)]<<18|a[t.charCodeAt(i+1)]<<12|a[t.charCodeAt(i+2)]<<6|a[t.charCodeAt(i+3)],d[p++]=r>>16&255,d[p++]=r>>8&255,d[p++]=255&r;2===l&&(r=a[t.charCodeAt(i)]<<2|a[t.charCodeAt(i+1)]>>4,d[p++]=255&r);1===l&&(r=a[t.charCodeAt(i)]<<10|a[t.charCodeAt(i+1)]<<4|a[t.charCodeAt(i+2)]>>2,d[p++]=r>>8&255,d[p++]=255&r);return d},r.fromByteArray=function fromByteArray(t){for(var r,i=t.length,a=i%3,c=[],u=0,l=i-a;u<l;u+=16383)c.push(encodeChunk(t,u,u+16383>l?l:u+16383));1===a?(r=t[i-1],c.push(o[r>>2]+o[r<<4&63]+"==")):2===a&&(r=(t[i-2]<<8)+t[i-1],c.push(o[r>>10]+o[r>>4&63]+o[r<<2&63]+"="));return c.join("")};for(var o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,d=u.length;l<d;++l)o[l]=u[l],a[u.charCodeAt(l)]=l;function getLens(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=r),[i,i===r?0:4-i%4]}function encodeChunk(t,r,i){for(var a,c,u=[],l=r;l<i;l+=3)a=(t[l]<<16&16711680)+(t[l+1]<<8&65280)+(255&t[l+2]),u.push(o[(c=a)>>18&63]+o[c>>12&63]+o[c>>6&63]+o[63&c]);return u.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,i,o,a){var c,u,l=8*a-o-1,d=(1<<l)-1,p=d>>1,h=-7,m=i?a-1:0,g=i?-1:1,y=t[r+m];for(m+=g,c=y&(1<<-h)-1,y>>=-h,h+=l;h>0;c=256*c+t[r+m],m+=g,h-=8);for(u=c&(1<<-h)-1,c>>=-h,h+=o;h>0;u=256*u+t[r+m],m+=g,h-=8);if(0===c)c=1-p;else{if(c===d)return u?NaN:1/0*(y?-1:1);u+=Math.pow(2,o),c-=p}return(y?-1:1)*u*Math.pow(2,c-o)},r.write=function(t,r,i,o,a,c){var u,l,d,p=8*c-a-1,h=(1<<p)-1,m=h>>1,g=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,y=o?0:c-1,v=o?1:-1,b=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,u=h):(u=Math.floor(Math.log(r)/Math.LN2),r*(d=Math.pow(2,-u))<1&&(u--,d*=2),(r+=u+m>=1?g/d:g*Math.pow(2,1-m))*d>=2&&(u++,d/=2),u+m>=h?(l=0,u=h):u+m>=1?(l=(r*d-1)*Math.pow(2,a),u+=m):(l=r*Math.pow(2,m-1)*Math.pow(2,a),u=0));a>=8;t[i+y]=255&l,y+=v,l/=256,a-=8);for(u=u<<a|l,p+=a;p>0;t[i+y]=255&u,y+=v,u/=256,p-=8);t[i+y-v]|=128*b}},function(t,r){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,r,i){"use strict";t.exports=i(360)},function(t,r,i){"use strict";var o=i(361);t.exports=o},function(t,r,i){"use strict";var o=i(220);t.exports=o},function(t,r,i){"use strict";i(363);var o=i(15);t.exports=o.Object.keys},function(t,r,i){"use strict";var o=i(1),a=i(36),c=i(101);o({target:"Object",stat:!0,forced:i(8)((function(){c(1)}))},{keys:function keys(t){return c(a(t))}})},function(t,r,i){"use strict";var o=i(20),a=i(12),c=i(18),u=TypeError;t.exports=function(t,r){var i,l;if("string"===r&&a(i=t.toString)&&!c(l=o(i,t)))return l;if(a(i=t.valueOf)&&!c(l=o(i,t)))return l;if("string"!==r&&a(i=t.toString)&&!c(l=o(i,t)))return l;throw new u("Can't convert object to primitive value")}},function(t,r,i){"use strict";var o=i(11),a=Object.defineProperty;t.exports=function(t,r){try{a(o,t,{value:r,configurable:!0,writable:!0})}catch(i){o[t]=r}return r}},function(t,r,i){"use strict";var o=Math.ceil,a=Math.floor;t.exports=Math.trunc||function trunc(t){var r=+t;return(r>0?a:o)(r)}},function(t,r,i){"use strict";var o=i(368);t.exports=o},function(t,r,i){"use strict";var o=i(369);t.exports=o},function(t,r,i){"use strict";var o=i(370);t.exports=o},function(t,r,i){"use strict";i(228);var o=i(15);t.exports=o.Object.getOwnPropertySymbols},function(t,r,i){"use strict";var o=i(1),a=i(11),c=i(20),u=i(9),l=i(35),d=i(13),p=i(79),h=i(8),m=i(21),g=i(23),y=i(33),v=i(38),b=i(162),_=i(40),w=i(55),S=i(82),I=i(101),k=i(129),x=i(230),P=i(130),C=i(77),A=i(32),O=i(170),R=i(123),M=i(48),j=i(171),L=i(81),D=i(128),B=i(103),N=i(127),U=i(10),q=i(131),W=i(14),z=i(231),V=i(49),H=i(58),$=i(65).forEach,K=D("hidden"),G=H.set,J=H.getterFor("Symbol"),Y=Object.prototype,Q=a.Symbol,X=Q&&Q.prototype,Z=a.RangeError,ee=a.TypeError,te=a.QObject,re=C.f,ne=A.f,ie=x.f,oe=R.f,se=u([].push),ae=L("symbols"),ce=L("op-symbols"),ue=L("wks"),le=!te||!te.prototype||!te.prototype.findChild,fallbackDefineProperty=function(t,r,i){var o=re(Y,r);o&&delete Y[r],ne(t,r,i),o&&t!==Y&&ne(Y,r,o)},fe=d&&h((function(){return 7!==S(ne({},"a",{get:function(){return ne(this,"a",{value:7}).a}})).a}))?fallbackDefineProperty:ne,wrap=function(t,r){var i=ae[t]=S(X);return G(i,{type:"Symbol",tag:t,description:r}),d||(i.description=r),i},de=function defineProperty(t,r,i){t===Y&&de(ce,r,i),y(t);var o=b(r);return y(i),m(ae,o)?(i.enumerable?(m(t,K)&&t[K][o]&&(t[K][o]=!1),i=S(i,{enumerable:w(0,!1)})):(m(t,K)||ne(t,K,w(1,S(null))),t[K][o]=!0),fe(t,o,i)):ne(t,o,i)},pe=function defineProperties(t,r){y(t);var i=v(r),o=I(i).concat($getOwnPropertySymbols(i));return $(o,(function(r){d&&!c(he,i,r)||de(t,r,i[r])})),t},he=function propertyIsEnumerable(t){var r=b(t),i=c(oe,this,r);return!(this===Y&&m(ae,r)&&!m(ce,r))&&(!(i||!m(this,r)||!m(ae,r)||m(this,K)&&this[K][r])||i)},me=function getOwnPropertyDescriptor(t,r){var i=v(t),o=b(r);if(i!==Y||!m(ae,o)||m(ce,o)){var a=re(i,o);return!a||!m(ae,o)||m(i,K)&&i[K][o]||(a.enumerable=!0),a}},ge=function getOwnPropertyNames(t){var r=ie(v(t)),i=[];return $(r,(function(t){m(ae,t)||m(B,t)||se(i,t)})),i},$getOwnPropertySymbols=function(t){var r=t===Y,i=ie(r?ce:v(t)),o=[];return $(i,(function(t){!m(ae,t)||r&&!m(Y,t)||se(o,ae[t])})),o};p||(M(X=(Q=function Symbol(){if(g(X,this))throw new ee("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?_(arguments[0]):void 0,r=N(t),setter=function(t){var i=void 0===this?a:this;i===Y&&c(setter,ce,t),m(i,K)&&m(i[K],r)&&(i[K][r]=!1);var o=w(1,t);try{fe(i,r,o)}catch(t){if(!(t instanceof Z))throw t;fallbackDefineProperty(i,r,o)}};return d&&le&&fe(Y,r,{configurable:!0,set:setter}),wrap(r,t)}).prototype,"toString",(function toString(){return J(this).tag})),M(Q,"withoutSetter",(function(t){return wrap(N(t),t)})),R.f=he,A.f=de,O.f=pe,C.f=me,k.f=x.f=ge,P.f=$getOwnPropertySymbols,q.f=function(t){return wrap(U(t),t)},d&&(j(X,"description",{configurable:!0,get:function description(){return J(this).description}}),l||M(Y,"propertyIsEnumerable",he,{unsafe:!0}))),o({global:!0,constructor:!0,wrap:!0,forced:!p,sham:!p},{Symbol:Q}),$(I(ue),(function(t){W(t)})),o({target:"Symbol",stat:!0,forced:!p},{useSetter:function(){le=!0},useSimple:function(){le=!1}}),o({target:"Object",stat:!0,forced:!p,sham:!d},{create:function create(t,r){return void 0===r?S(t):pe(S(t),r)},defineProperty:de,defineProperties:pe,getOwnPropertyDescriptor:me}),o({target:"Object",stat:!0,forced:!p},{getOwnPropertyNames:ge}),z(),V(Q,"Symbol"),B[K]=!0},function(t,r,i){"use strict";var o=i(169),a=i(64);t.exports=o?{}.toString:function toString(){return"[object "+a(this)+"]"}},function(t,r,i){"use strict";var o=i(66),a=i(132),c=i(18),u=i(10)("species"),l=Array;t.exports=function(t){var r;return o(t)&&(r=t.constructor,(a(r)&&(r===l||o(r.prototype))||c(r)&&null===(r=r[u]))&&(r=void 0)),void 0===r?l:r}},function(t,r,i){"use strict";var o=i(1),a=i(28),c=i(21),u=i(40),l=i(81),d=i(234),p=l("string-to-symbol-registry"),h=l("symbol-to-string-registry");o({target:"Symbol",stat:!0,forced:!d},{for:function(t){var r=u(t);if(c(p,r))return p[r];var i=a("Symbol")(r);return p[r]=i,h[i]=r,i}})},function(t,r,i){"use strict";var o=i(1),a=i(21),c=i(100),u=i(80),l=i(81),d=i(234),p=l("symbol-to-string-registry");o({target:"Symbol",stat:!0,forced:!d},{keyFor:function keyFor(t){if(!c(t))throw new TypeError(u(t)+" is not a symbol");if(a(p,t))return p[t]}})},function(t,r,i){"use strict";var o=i(9),a=i(66),c=i(12),u=i(43),l=i(40),d=o([].push);t.exports=function(t){if(c(t))return t;if(a(t)){for(var r=t.length,i=[],o=0;o<r;o++){var p=t[o];"string"==typeof p?d(i,p):"number"!=typeof p&&"Number"!==u(p)&&"String"!==u(p)||d(i,l(p))}var h=i.length,m=!0;return function(t,r){if(m)return m=!1,r;if(a(this))return r;for(var o=0;o<h;o++)if(i[o]===t)return r}}}},function(t,r,i){"use strict";var o=i(1),a=i(79),c=i(8),u=i(130),l=i(36);o({target:"Object",stat:!0,forced:!a||c((function(){u.f(1)}))},{getOwnPropertySymbols:function getOwnPropertySymbols(t){var r=u.f;return r?r(l(t)):[]}})},function(t,r,i){"use strict";t.exports=i(379)},function(t,r,i){"use strict";var o=i(380);t.exports=o},function(t,r,i){"use strict";var o=i(236);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(382),c=Array.prototype;t.exports=function(t){var r=t.filter;return t===c||o(c,t)&&r===c.filter?a:r}},function(t,r,i){"use strict";i(383);var o=i(29);t.exports=o("Array","filter")},function(t,r,i){"use strict";var o=i(1),a=i(65).filter;o({target:"Array",proto:!0,forced:!i(104)("filter")},{filter:function filter(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,r,i){"use strict";t.exports=i(385)},function(t,r,i){"use strict";var o=i(386);t.exports=o},function(t,r,i){"use strict";var o=i(387);t.exports=o},function(t,r,i){"use strict";var o=i(388);t.exports=o},function(t,r,i){"use strict";i(389);var o=i(15).Object,a=t.exports=function getOwnPropertyDescriptor(t,r){return o.getOwnPropertyDescriptor(t,r)};o.getOwnPropertyDescriptor.sham&&(a.sham=!0)},function(t,r,i){"use strict";var o=i(1),a=i(8),c=i(38),u=i(77).f,l=i(13);o({target:"Object",stat:!0,forced:!l||a((function(){u(1)})),sham:!l},{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(t,r){return u(c(t),r)}})},function(t,r,i){"use strict";var o=i(391);t.exports=o},function(t,r,i){"use strict";var o=i(392);t.exports=o},function(t,r,i){"use strict";var o=i(393);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(394),c=Array.prototype;t.exports=function(t){var r=t.push;return t===c||o(c,t)&&r===c.push?a:r}},function(t,r,i){"use strict";i(395);var o=i(29);t.exports=o("Array","push")},function(t,r,i){"use strict";var o=i(1),a=i(36),c=i(57),u=i(237),l=i(174);o({target:"Array",proto:!0,arity:1,forced:i(8)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function push(t){var r=a(this),i=c(r),o=arguments.length;l(i+o);for(var d=0;d<o;d++)r[i]=arguments[d],i++;return u(r,i),i}})},function(t,r,i){"use strict";var o=i(397);t.exports=o},function(t,r,i){"use strict";var o=i(398);t.exports=o},function(t,r,i){"use strict";var o=i(64),a=i(21),c=i(23),u=i(399);i(403);var l=Array.prototype,d={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var r=t.forEach;return t===l||c(l,t)&&r===l.forEach||a(d,o(t))?u:r}},function(t,r,i){"use strict";var o=i(400);t.exports=o},function(t,r,i){"use strict";i(401);var o=i(29);t.exports=o("Array","forEach")},function(t,r,i){"use strict";var o=i(1),a=i(402);o({target:"Array",proto:!0,forced:[].forEach!==a},{forEach:a})},function(t,r,i){"use strict";var o=i(65).forEach,a=i(239)("forEach");t.exports=a?[].forEach:function forEach(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,r){},function(t,r,i){"use strict";t.exports=i(405)},function(t,r,i){"use strict";var o=i(406);t.exports=o},function(t,r,i){"use strict";var o=i(407);t.exports=o},function(t,r,i){"use strict";var o=i(408);t.exports=o},function(t,r,i){"use strict";i(409);var o=i(15);t.exports=o.Object.getOwnPropertyDescriptors},function(t,r,i){"use strict";var o=i(1),a=i(13),c=i(240),u=i(38),l=i(77),d=i(105);o({target:"Object",stat:!0,sham:!a},{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(t){for(var r,i,o=u(t),a=l.f,p=c(o),h={},m=0;p.length>m;)void 0!==(i=a(o,r=p[m++]))&&d(h,r,i);return h}})},function(t,r,i){"use strict";t.exports=i(411)},function(t,r,i){"use strict";var o=i(412);t.exports=o},function(t,r,i){"use strict";var o=i(413);t.exports=o},function(t,r,i){"use strict";var o=i(414);t.exports=o},function(t,r,i){"use strict";i(415);var o=i(15).Object,a=t.exports=function defineProperties(t,r){return o.defineProperties(t,r)};o.defineProperties.sham&&(a.sham=!0)},function(t,r,i){"use strict";var o=i(1),a=i(13),c=i(170).f;o({target:"Object",stat:!0,forced:Object.defineProperties!==c,sham:!a},{defineProperties:c})},function(t,r,i){"use strict";var o=i(417);t.exports=o},function(t,r,i){"use strict";var o=i(418);t.exports=o},function(t,r,i){"use strict";var o=i(419);t.exports=o},function(t,r,i){"use strict";i(420);var o=i(15).Object,a=t.exports=function defineProperty(t,r,i){return o.defineProperty(t,r,i)};o.defineProperty.sham&&(a.sham=!0)},function(t,r,i){"use strict";var o=i(1),a=i(13),c=i(32).f;o({target:"Object",stat:!0,forced:Object.defineProperty!==c,sham:!a},{defineProperty:c})},function(t,r,i){"use strict";var o=i(422);i(449),i(450),i(451),i(452),i(453),i(454),i(455),i(456),i(457),i(458),t.exports=o},function(t,r,i){"use strict";var o=i(423);i(445),i(446),i(447),i(448),t.exports=o},function(t,r,i){"use strict";var o=i(424);i(67),t.exports=o},function(t,r,i){"use strict";i(242),i(107),i(228),i(425),i(426),i(427),i(428),i(243),i(429),i(430),i(431),i(432),i(433),i(434),i(244),i(435),i(436),i(437),i(438),i(439);var o=i(15);t.exports=o.Symbol},function(t,r,i){"use strict";i(14)("asyncIterator")},function(t,r){},function(t,r,i){"use strict";i(14)("hasInstance")},function(t,r,i){"use strict";i(14)("isConcatSpreadable")},function(t,r,i){"use strict";i(14)("match")},function(t,r,i){"use strict";i(14)("matchAll")},function(t,r,i){"use strict";i(14)("replace")},function(t,r,i){"use strict";i(14)("search")},function(t,r,i){"use strict";i(14)("species")},function(t,r,i){"use strict";i(14)("split")},function(t,r,i){"use strict";var o=i(28),a=i(14),c=i(49);a("toStringTag"),c(o("Symbol"),"Symbol")},function(t,r,i){"use strict";i(14)("unscopables")},function(t,r,i){"use strict";var o=i(11);i(49)(o.JSON,"JSON",!0)},function(t,r){},function(t,r){},function(t,r,i){"use strict";var o=i(13),a=i(21),c=Function.prototype,u=o&&Object.getOwnPropertyDescriptor,l=a(c,"name"),d=l&&"something"===function something(){}.name,p=l&&(!o||o&&u(c,"name").configurable);t.exports={EXISTS:l,PROPER:d,CONFIGURABLE:p}},function(t,r,i){"use strict";var o=i(9),a=i(39);t.exports=function(t,r,i){try{return o(a(Object.getOwnPropertyDescriptor(t,r)[i]))}catch(t){}}},function(t,r,i){"use strict";var o=i(443),a=String,c=TypeError;t.exports=function(t){if(o(t))return t;throw new c("Can't set "+a(t)+" as a prototype")}},function(t,r,i){"use strict";var o=i(18);t.exports=function(t){return o(t)||null===t}},function(t,r,i){"use strict";t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,r,i){"use strict";var o=i(10),a=i(32).f,c=o("metadata"),u=Function.prototype;void 0===u[c]&&a(u,c,{value:null})},function(t,r,i){"use strict";i(14)("asyncDispose")},function(t,r,i){"use strict";i(14)("dispose")},function(t,r,i){"use strict";i(14)("metadata")},function(t,r,i){"use strict";i(1)({target:"Symbol",stat:!0},{isRegisteredSymbol:i(249)})},function(t,r,i){"use strict";i(1)({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:i(250)})},function(t,r,i){"use strict";i(14)("customMatcher")},function(t,r,i){"use strict";i(14)("observable")},function(t,r,i){"use strict";i(1)({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:i(249)})},function(t,r,i){"use strict";i(1)({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:i(250)})},function(t,r,i){"use strict";i(14)("matcher")},function(t,r,i){"use strict";i(14)("metadataKey")},function(t,r,i){"use strict";i(14)("patternMatch")},function(t,r,i){"use strict";i(14)("replaceAll")},function(t,r,i){"use strict";t.exports=i(460)},function(t,r,i){"use strict";var o=i(461);t.exports=o},function(t,r,i){"use strict";var o=i(462);t.exports=o},function(t,r,i){"use strict";var o=i(463);i(67),t.exports=o},function(t,r,i){"use strict";i(68),i(107),i(135),i(243);var o=i(131);t.exports=o.f("iterator")},function(t,r,i){"use strict";var o=i(9),a=i(102),c=i(40),u=i(56),l=o("".charAt),d=o("".charCodeAt),p=o("".slice),createMethod=function(t){return function(r,i){var o,h,m=c(u(r)),g=a(i),y=m.length;return g<0||g>=y?t?"":void 0:(o=d(m,g))<55296||o>56319||g+1===y||(h=d(m,g+1))<56320||h>57343?t?l(m,g):o:t?p(m,g,g+2):h-56320+(o-55296<<10)+65536}};t.exports={codeAt:createMethod(!1),charAt:createMethod(!0)}},function(t,r,i){var o=i(466),a=i(7).default;t.exports=function toPrimitive(t,r){if("object"!=a(t)||!t)return t;var i=t[o];if(void 0!==i){var c=i.call(t,r||"default");if("object"!=a(c))return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";t.exports=i(467)},function(t,r,i){"use strict";var o=i(468);t.exports=o},function(t,r,i){"use strict";var o=i(469);t.exports=o},function(t,r,i){"use strict";var o=i(470);t.exports=o},function(t,r,i){"use strict";i(471),i(244);var o=i(131);t.exports=o.f("toPrimitive")},function(t,r){},function(t,r,i){"use strict";var o=i(473);t.exports=o},function(t,r,i){"use strict";i(474);var o=i(15);t.exports=o.Object.assign},function(t,r,i){"use strict";var o=i(1),a=i(475);o({target:"Object",stat:!0,arity:2,forced:Object.assign!==a},{assign:a})},function(t,r,i){"use strict";var o=i(13),a=i(9),c=i(20),u=i(8),l=i(101),d=i(130),p=i(123),h=i(36),m=i(161),g=Object.assign,y=Object.defineProperty,v=a([].concat);t.exports=!g||u((function(){if(o&&1!==g({b:1},g(y({},"a",{enumerable:!0,get:function(){y(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},r={},i=Symbol("assign detection");return t[i]=7,"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),7!==g({},t)[i]||"abcdefghijklmnopqrst"!==l(g({},r)).join("")}))?function assign(t,r){for(var i=h(t),a=arguments.length,u=1,g=d.f,y=p.f;a>u;)for(var b,_=m(arguments[u++]),w=g?v(l(_),g(_)):l(_),S=w.length,I=0;S>I;)b=w[I++],o&&!c(y,_,b)||(i[b]=_[b]);return i}:g},function(t,r,i){"use strict";var o=i(477);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(478),c=String.prototype;t.exports=function(t){var r=t.startsWith;return"string"==typeof t||t===c||o(c,t)&&r===c.startsWith?a:r}},function(t,r,i){"use strict";i(479);var o=i(29);t.exports=o("String","startsWith")},function(t,r,i){"use strict";var o,a=i(1),c=i(122),u=i(77).f,l=i(167),d=i(40),p=i(251),h=i(56),m=i(252),g=i(35),y=c("".slice),v=Math.min,b=m("startsWith");a({target:"String",proto:!0,forced:!!(g||b||(o=u(String.prototype,"startsWith"),!o||o.writable))&&!b},{startsWith:function startsWith(t){var r=d(h(this));p(t);var i=l(v(arguments.length>1?arguments[1]:void 0,r.length)),o=d(t);return y(r,i,i+o.length)===o}})},function(t,r,i){"use strict";var o=i(18),a=i(43),c=i(10)("match");t.exports=function(t){var r;return o(t)&&(void 0!==(r=t[c])?!!r:"RegExp"===a(t))}},function(t,r,i){(function(t,o){var a;!function(c){r&&r.nodeType,t&&t.nodeType;var u="object"==typeof o&&o;u.global!==u&&u.window!==u&&u.self;var l,d=2147483647,p=/^xn--/,h=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=Math.floor,v=String.fromCharCode;function error(t){throw new RangeError(g[t])}function map(t,r){for(var i=t.length,o=[];i--;)o[i]=r(t[i]);return o}function mapDomain(t,r){var i=t.split("@"),o="";return i.length>1&&(o=i[0]+"@",t=i[1]),o+map((t=t.replace(m,".")).split("."),r).join(".")}function ucs2decode(t){for(var r,i,o=[],a=0,c=t.length;a<c;)(r=t.charCodeAt(a++))>=55296&&r<=56319&&a<c?56320==(64512&(i=t.charCodeAt(a++)))?o.push(((1023&r)<<10)+(1023&i)+65536):(o.push(r),a--):o.push(r);return o}function ucs2encode(t){return map(t,(function(t){var r="";return t>65535&&(r+=v((t-=65536)>>>10&1023|55296),t=56320|1023&t),r+=v(t)})).join("")}function digitToBasic(t,r){return t+22+75*(t<26)-((0!=r)<<5)}function adapt(t,r,i){var o=0;for(t=i?y(t/700):t>>1,t+=y(t/r);t>455;o+=36)t=y(t/35);return y(o+36*t/(t+38))}function decode(t){var r,i,o,a,c,u,l,p,h,m,g,v=[],b=t.length,_=0,w=128,S=72;for((i=t.lastIndexOf("-"))<0&&(i=0),o=0;o<i;++o)t.charCodeAt(o)>=128&&error("not-basic"),v.push(t.charCodeAt(o));for(a=i>0?i+1:0;a<b;){for(c=_,u=1,l=36;a>=b&&error("invalid-input"),((p=(g=t.charCodeAt(a++))-48<10?g-22:g-65<26?g-65:g-97<26?g-97:36)>=36||p>y((d-_)/u))&&error("overflow"),_+=p*u,!(p<(h=l<=S?1:l>=S+26?26:l-S));l+=36)u>y(d/(m=36-h))&&error("overflow"),u*=m;S=adapt(_-c,r=v.length+1,0==c),y(_/r)>d-w&&error("overflow"),w+=y(_/r),_%=r,v.splice(_++,0,w)}return ucs2encode(v)}function encode(t){var r,i,o,a,c,u,l,p,h,m,g,b,_,w,S,I=[];for(b=(t=ucs2decode(t)).length,r=128,i=0,c=72,u=0;u<b;++u)(g=t[u])<128&&I.push(v(g));for(o=a=I.length,a&&I.push("-");o<b;){for(l=d,u=0;u<b;++u)(g=t[u])>=r&&g<l&&(l=g);for(l-r>y((d-i)/(_=o+1))&&error("overflow"),i+=(l-r)*_,r=l,u=0;u<b;++u)if((g=t[u])<r&&++i>d&&error("overflow"),g==r){for(p=i,h=36;!(p<(m=h<=c?1:h>=c+26?26:h-c));h+=36)S=p-m,w=36-m,I.push(v(digitToBasic(m+S%w,0))),p=y(S/w);I.push(v(digitToBasic(p,0))),c=adapt(i,_,o==a),i=0,++o}++i,++r}return I.join("")}l={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:function toASCII(t){return mapDomain(t,(function(t){return h.test(t)?"xn--"+encode(t):t}))},toUnicode:function toUnicode(t){return mapDomain(t,(function(t){return p.test(t)?decode(t.slice(4).toLowerCase()):t}))}},void 0===(a=function(){return l}.call(r,i,r,t))||(t.exports=a)}()}).call(this,i(136)(t),i(17))},function(t,r,i){"use strict";var o=i(483),a=i(256),c=i(181),u=Object.prototype.hasOwnProperty,l={brackets:function brackets(t){return t+"[]"},comma:"comma",indices:function indices(t,r){return t+"["+r+"]"},repeat:function repeat(t){return t}},d=Array.isArray,p=Array.prototype.push,pushToArray=function(t,r){p.apply(t,d(r)?r:[r])},h=Date.prototype.toISOString,m=c.default,g={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:a.encode,encodeValuesOnly:!1,format:m,formatter:c.formatters[m],indices:!1,serializeDate:function serializeDate(t){return h.call(t)},skipNulls:!1,strictNullHandling:!1},y={},v=function stringify(t,r,i,c,u,l,p,h,m,v,b,_,w,S,I,k,x,P){for(var C=t,A=P,O=0,R=!1;void 0!==(A=A.get(y))&&!R;){var M=A.get(t);if(O+=1,void 0!==M){if(M===O)throw new RangeError("Cyclic object value");R=!0}void 0===A.get(y)&&(O=0)}if("function"==typeof v?C=v(r,C):C instanceof Date?C=w(C):"comma"===i&&d(C)&&(C=a.maybeMap(C,(function(t){return t instanceof Date?w(t):t}))),null===C){if(l)return m&&!k?m(r,g.encoder,x,"key",S):r;C=""}if(function isNonNullishPrimitive(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||"symbol"==typeof t||"bigint"==typeof t}(C)||a.isBuffer(C))return m?[I(k?r:m(r,g.encoder,x,"key",S))+"="+I(m(C,g.encoder,x,"value",S))]:[I(r)+"="+I(String(C))];var j,L=[];if(void 0===C)return L;if("comma"===i&&d(C))k&&m&&(C=a.maybeMap(C,m)),j=[{value:C.length>0?C.join(",")||null:void 0}];else if(d(v))j=v;else{var D=Object.keys(C);j=b?D.sort(b):D}var B=h?r.replace(/\./g,"%2E"):r,N=c&&d(C)&&1===C.length?B+"[]":B;if(u&&d(C)&&0===C.length)return N+"[]";for(var U=0;U<j.length;++U){var q=j[U],W="object"==typeof q&&void 0!==q.value?q.value:C[q];if(!p||null!==W){var z=_&&h?q.replace(/\./g,"%2E"):q,V=d(C)?"function"==typeof i?i(N,z):N:N+(_?"."+z:"["+z+"]");P.set(t,O);var H=o();H.set(y,P),pushToArray(L,stringify(W,V,i,c,u,l,p,h,"comma"===i&&k&&d(C)?null:m,v,b,_,w,S,I,k,x,H))}}return L};t.exports=function(t,r){var i,a=t,p=function normalizeStringifyOptions(t){if(!t)return g;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||g.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=c.default;if(void 0!==t.format){if(!u.call(c.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var o,a=c.formatters[i],p=g.filter;if(("function"==typeof t.filter||d(t.filter))&&(p=t.filter),o=t.arrayFormat in l?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":g.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=void 0===t.allowDots?!0===t.encodeDotInKeys||g.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:g.addQueryPrefix,allowDots:h,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:g.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:g.charsetSentinel,commaRoundTrip:t.commaRoundTrip,delimiter:void 0===t.delimiter?g.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:g.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:g.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:g.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:g.encodeValuesOnly,filter:p,format:i,formatter:a,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:g.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:g.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:g.strictNullHandling}}(r);"function"==typeof p.filter?a=(0,p.filter)("",a):d(p.filter)&&(i=p.filter);var h=[];if("object"!=typeof a||null===a)return"";var m=l[p.arrayFormat],y="comma"===m&&p.commaRoundTrip;i||(i=Object.keys(a)),p.sort&&i.sort(p.sort);for(var b=o(),_=0;_<i.length;++_){var w=i[_];p.skipNulls&&null===a[w]||pushToArray(h,v(a[w],w,m,y,p.allowEmptyArrays,p.strictNullHandling,p.skipNulls,p.encodeDotInKeys,p.encode?p.encoder:null,p.filter,p.sort,p.allowDots,p.serializeDate,p.format,p.formatter,p.encodeValuesOnly,p.charset,b))}var S=h.join(p.delimiter),I=!0===p.addQueryPrefix?"?":"";return p.charsetSentinel&&("iso-8859-1"===p.charset?I+="utf8=%26%2310003%3B&":I+="utf8=%E2%9C%93&"),S.length>0?I+S:""}},function(t,r,i){"use strict";var o=i(6),a=i(24),c=i(255),u=i(3),l=o("%WeakMap%",!0),d=o("%Map%",!0),p=a("WeakMap.prototype.get",!0),h=a("WeakMap.prototype.set",!0),m=a("WeakMap.prototype.has",!0),g=a("Map.prototype.get",!0),y=a("Map.prototype.set",!0),v=a("Map.prototype.has",!0),listGetNode=function(t,r){for(var i,o=t;null!==(i=o.next);o=i)if(i.key===r)return o.next=i.next,i.next=t.next,t.next=i,i};t.exports=function getSideChannel(){var t,r,i,o={assert:function(t){if(!o.has(t))throw new u("Side channel does not contain "+c(t))},get:function(o){if(l&&o&&("object"==typeof o||"function"==typeof o)){if(t)return p(t,o)}else if(d){if(r)return g(r,o)}else if(i)return function(t,r){var i=listGetNode(t,r);return i&&i.value}(i,o)},has:function(o){if(l&&o&&("object"==typeof o||"function"==typeof o)){if(t)return m(t,o)}else if(d){if(r)return v(r,o)}else if(i)return function(t,r){return!!listGetNode(t,r)}(i,o);return!1},set:function(o,a){l&&o&&("object"==typeof o||"function"==typeof o)?(t||(t=new l),h(t,o,a)):d?(r||(r=new d),y(r,o,a)):(i||(i={key:{},next:null}),function(t,r,i){var o=listGetNode(t,r);o?o.value=i:t.next={key:r,next:t.next,value:i}}(i,o,a))}};return o}},function(t,r,i){"use strict";t.exports=Error},function(t,r,i){"use strict";t.exports=EvalError},function(t,r,i){"use strict";t.exports=ReferenceError},function(t,r,i){"use strict";t.exports=URIError},function(t,r,i){"use strict";var o="Function.prototype.bind called on incompatible ",a=Object.prototype.toString,c=Math.max,u=function concatty(t,r){for(var i=[],o=0;o<t.length;o+=1)i[o]=t[o];for(var a=0;a<r.length;a+=1)i[a+t.length]=r[a];return i},l=function slicy(t,r){for(var i=[],o=r||0,a=0;o<t.length;o+=1,a+=1)i[a]=t[o];return i},joiny=function(t,r){for(var i="",o=0;o<t.length;o+=1)i+=t[o],o+1<t.length&&(i+=r);return i};t.exports=function bind(t){var r=this;if("function"!=typeof r||"[object Function]"!==a.apply(r))throw new TypeError(o+r);for(var i,d=l(arguments,1),binder=function(){if(this instanceof i){var o=r.apply(this,u(d,arguments));return Object(o)===o?o:this}return r.apply(t,u(d,arguments))},p=c(0,r.length-d.length),h=[],m=0;m<p;m++)h[m]="$"+m;if(i=Function("binder","return function ("+joiny(h,",")+"){ return binder.apply(this,arguments); }")(binder),r.prototype){var g=function Empty(){};g.prototype=r.prototype,i.prototype=new g,g.prototype=null}return i}},function(t,r,i){"use strict";var o=i(6),a=i(254),c=i(180)(),u=i(85),l=i(3),d=o("%Math.floor%");t.exports=function setFunctionLength(t,r){if("function"!=typeof t)throw new l("`fn` is not a function");if("number"!=typeof r||r<0||r>4294967295||d(r)!==r)throw new l("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],o=!0,p=!0;if("length"in t&&u){var h=u(t,"length");h&&!h.configurable&&(o=!1),h&&!h.writable&&(p=!1)}return(o||p||!i)&&(c?a(t,"length",r,!0,!0):a(t,"length",r)),t}},function(t,r){},function(t,r,i){"use strict";var o=i(256),a=Object.prototype.hasOwnProperty,c=Array.isArray,u={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:o.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(t){return t.replace(/&#(\d+);/g,(function(t,r){return String.fromCharCode(parseInt(r,10))}))},parseArrayValue=function(t,r){return t&&"string"==typeof t&&r.comma&&t.indexOf(",")>-1?t.split(","):t},l=function parseQueryStringKeys(t,r,i,o){if(t){var c=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,u=/(\[[^[\]]*])/g,l=i.depth>0&&/(\[[^[\]]*])/.exec(c),d=l?c.slice(0,l.index):c,p=[];if(d){if(!i.plainObjects&&a.call(Object.prototype,d)&&!i.allowPrototypes)return;p.push(d)}for(var h=0;i.depth>0&&null!==(l=u.exec(c))&&h<i.depth;){if(h+=1,!i.plainObjects&&a.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;p.push(l[1])}return l&&p.push("["+c.slice(l.index)+"]"),function(t,r,i,o){for(var a=o?r:parseArrayValue(r,i),c=t.length-1;c>=0;--c){var u,l=t[c];if("[]"===l&&i.parseArrays)u=i.allowEmptyArrays&&""===a?[]:[].concat(a);else{u=i.plainObjects?Object.create(null):{};var d="["===l.charAt(0)&&"]"===l.charAt(l.length-1)?l.slice(1,-1):l,p=i.decodeDotInKeys?d.replace(/%2E/g,"."):d,h=parseInt(p,10);i.parseArrays||""!==p?!isNaN(h)&&l!==p&&String(h)===p&&h>=0&&i.parseArrays&&h<=i.arrayLimit?(u=[])[h]=a:"__proto__"!==p&&(u[p]=a):u={0:a}}a=u}return a}(p,r,i,o)}};t.exports=function(t,r){var i=function normalizeParseOptions(t){if(!t)return u;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=void 0===t.charset?u.charset:t.charset,i=void 0===t.duplicates?u.duplicates:t.duplicates;if("combine"!==i&&"first"!==i&&"last"!==i)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||u.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:u.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:u.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:u.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:u.arrayLimit,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:u.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:u.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:u.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:u.decoder,delimiter:"string"==typeof t.delimiter||o.isRegExp(t.delimiter)?t.delimiter:u.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:u.depth,duplicates:i,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:u.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:u.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:u.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:u.strictNullHandling}}(r);if(""===t||null==t)return i.plainObjects?Object.create(null):{};for(var d="string"==typeof t?function parseQueryStringValues(t,r){var i,l={__proto__:null},d=r.ignoreQueryPrefix?t.replace(/^\?/,""):t,p=r.parameterLimit===1/0?void 0:r.parameterLimit,h=d.split(r.delimiter,p),m=-1,g=r.charset;if(r.charsetSentinel)for(i=0;i<h.length;++i)0===h[i].indexOf("utf8=")&&("utf8=%E2%9C%93"===h[i]?g="utf-8":"utf8=%26%2310003%3B"===h[i]&&(g="iso-8859-1"),m=i,i=h.length);for(i=0;i<h.length;++i)if(i!==m){var y,v,b=h[i],_=b.indexOf("]="),w=-1===_?b.indexOf("="):_+1;-1===w?(y=r.decoder(b,u.decoder,g,"key"),v=r.strictNullHandling?null:""):(y=r.decoder(b.slice(0,w),u.decoder,g,"key"),v=o.maybeMap(parseArrayValue(b.slice(w+1),r),(function(t){return r.decoder(t,u.decoder,g,"value")}))),v&&r.interpretNumericEntities&&"iso-8859-1"===g&&(v=interpretNumericEntities(v)),b.indexOf("[]=")>-1&&(v=c(v)?[v]:v);var S=a.call(l,y);S&&"combine"===r.duplicates?l[y]=o.combine(l[y],v):S&&"last"!==r.duplicates||(l[y]=v)}return l}(t,i):t,p=i.plainObjects?Object.create(null):{},h=Object.keys(d),m=0;m<h.length;++m){var g=h[m],y=l(g,d[g],i,"string"==typeof t);p=o.merge(p,y,i)}return!0===i.allowSparse?p:o.compact(p)}},function(t,r,i){"use strict";var o=i(493);t.exports=o},function(t,r,i){"use strict";var o=i(494);t.exports=o},function(t,r,i){"use strict";var o=i(495);i(67),t.exports=o},function(t,r,i){"use strict";i(68),i(135);var o=i(109);t.exports=o},function(t,r,i){"use strict";var o=i(497);t.exports=o},function(t,r,i){"use strict";var o=i(498);t.exports=o},function(t,r,i){"use strict";var o=i(499);t.exports=o},function(t,r,i){"use strict";i(500);var o=i(15);t.exports=o.Array.isArray},function(t,r,i){"use strict";i(1)({target:"Array",stat:!0},{isArray:i(66)})},function(t,r,i){"use strict";var o=i(502);t.exports=o},function(t,r,i){"use strict";var o=i(258);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(504),c=Array.prototype;t.exports=function(t){var r=t.slice;return t===c||o(c,t)&&r===c.slice?a:r}},function(t,r,i){"use strict";i(505);var o=i(29);t.exports=o("Array","slice")},function(t,r,i){"use strict";var o=i(1),a=i(66),c=i(132),u=i(18),l=i(166),d=i(57),p=i(38),h=i(105),m=i(10),g=i(104),y=i(83),v=g("slice"),b=m("species"),_=Array,w=Math.max;o({target:"Array",proto:!0,forced:!v},{slice:function slice(t,r){var i,o,m,g=p(this),v=d(g),S=l(t,v),I=l(void 0===r?v:r,v);if(a(g)&&(i=g.constructor,(c(i)&&(i===_||a(i.prototype))||u(i)&&null===(i=i[b]))&&(i=void 0),i===_||void 0===i))return y(g,S,I);for(o=new(void 0===i?_:i)(w(I-S,0)),m=0;S<I;S++,m++)S in g&&h(o,m,g[S]);return o.length=m,o}})},function(t,r,i){"use strict";var o=i(507);t.exports=o},function(t,r,i){"use strict";var o=i(260);t.exports=o},function(t,r,i){"use strict";i(135),i(509);var o=i(15);t.exports=o.Array.from},function(t,r,i){"use strict";var o=i(1),a=i(510);o({target:"Array",stat:!0,forced:!i(263)((function(t){Array.from(t)}))},{from:a})},function(t,r,i){"use strict";var o=i(63),a=i(20),c=i(36),u=i(511),l=i(262),d=i(132),p=i(57),h=i(105),m=i(185),g=i(109),y=Array;t.exports=function from(t){var r=c(t),i=d(this),v=arguments.length,b=v>1?arguments[1]:void 0,_=void 0!==b;_&&(b=o(b,v>2?arguments[2]:void 0));var w,S,I,k,x,P,C=g(r),A=0;if(!C||this===y&&l(C))for(w=p(r),S=i?new this(w):y(w);w>A;A++)P=_?b(r[A],A):r[A],h(S,A,P);else for(S=i?new this:[],x=(k=m(r,C)).next;!(I=a(x,k)).done;A++)P=_?u(k,b,[I.value,A],!0):I.value,h(S,A,P);return S.length=A,S}},function(t,r,i){"use strict";var o=i(33),a=i(261);t.exports=function(t,r,i,c){try{return c?r(o(i)[0],i[1]):r(i)}catch(r){a(t,"throw",r)}}},function(t,r,i){var o=i(183);t.exports=function _arrayWithHoles(t){if(o(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){var o=i(106),a=i(182),c=i(173);t.exports=function _iterableToArrayLimit(t,r){var i=null==t?null:void 0!==o&&a(t)||t["@@iterator"];if(null!=i){var u,l,d,p,h=[],m=!0,g=!1;try{if(d=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;m=!1}else for(;!(m=(u=d.call(i)).done)&&(c(h).call(h,u.value),h.length!==r);m=!0);}catch(t){g=!0,l=t}finally{try{if(!m&&null!=i.return&&(p=i.return(),Object(p)!==p))return}finally{if(g)throw l}}return h}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r){t.exports=function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(516);i(541),i(542),i(543),i(544),t.exports=o},function(t,r,i){"use strict";var o=i(266);i(540),t.exports=o},function(t,r,i){"use strict";i(267),i(68),i(107),i(525),i(276),i(277),i(278),i(539),i(135);var o=i(15);t.exports=o.Promise},function(t,r,i){"use strict";var o=i(1),a=i(23),c=i(108),u=i(134),l=i(519),d=i(82),p=i(47),h=i(55),m=i(520),g=i(521),y=i(70),v=i(524),b=i(10)("toStringTag"),_=Error,w=[].push,S=function AggregateError(t,r){var i,o=a(I,this);u?i=u(new _,o?c(this):I):(i=o?this:d(I),p(i,b,"Error")),void 0!==r&&p(i,"message",v(r)),g(i,S,i.stack,1),arguments.length>2&&m(i,arguments[2]);var l=[];return y(t,w,{that:l}),p(i,"errors",l),i};u?u(S,_):l(S,_,{name:!0});var I=S.prototype=d(_.prototype,{constructor:h(1,S),message:h(1,""),name:h(1,"AggregateError")});o({global:!0,constructor:!0,arity:2},{AggregateError:S})},function(t,r,i){"use strict";var o=i(21),a=i(240),c=i(77),u=i(32);t.exports=function(t,r,i){for(var l=a(r),d=u.f,p=c.f,h=0;h<l.length;h++){var m=l[h];o(t,m)||i&&o(i,m)||d(t,m,p(r,m))}}},function(t,r,i){"use strict";var o=i(18),a=i(47);t.exports=function(t,r){o(r)&&"cause"in r&&a(t,"cause",r.cause)}},function(t,r,i){"use strict";var o=i(47),a=i(522),c=i(523),u=Error.captureStackTrace;t.exports=function(t,r,i,l){c&&(u?u(t,r):o(t,"stack",a(i,l)))}},function(t,r,i){"use strict";var o=i(9),a=Error,c=o("".replace),u=String(new a("zxcasd").stack),l=/\n\s*at [^:]*:[^\n]*/,d=l.test(u);t.exports=function(t,r){if(d&&"string"==typeof t&&!a.prepareStackTrace)for(;r--;)t=c(t,l,"");return t}},function(t,r,i){"use strict";var o=i(8),a=i(55);t.exports=!o((function(){var t=new Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",a(1,7)),7!==t.stack)}))},function(t,r,i){"use strict";var o=i(40);t.exports=function(t,r){return void 0===t?arguments.length<2?"":r:o(t)}},function(t,r,i){"use strict";i(526),i(534),i(535),i(536),i(537),i(538)},function(t,r,i){"use strict";var o,a,c,u=i(1),l=i(35),d=i(139),p=i(11),h=i(20),m=i(48),g=i(134),y=i(49),v=i(527),b=i(39),_=i(12),w=i(18),S=i(140),I=i(268),k=i(269).set,x=i(529),P=i(532),C=i(86),A=i(273),O=i(58),R=i(87),M=i(110),j=i(50),L=M.CONSTRUCTOR,D=M.REJECTION_EVENT,B=M.SUBCLASSING,N=O.getterFor("Promise"),U=O.set,q=R&&R.prototype,W=R,z=q,V=p.TypeError,H=p.document,$=p.process,K=j.f,G=K,J=!!(H&&H.createEvent&&p.dispatchEvent),isThenable=function(t){var r;return!(!w(t)||!_(r=t.then))&&r},callReaction=function(t,r){var i,o,a,c=r.value,u=1===r.state,l=u?t.ok:t.fail,d=t.resolve,p=t.reject,m=t.domain;try{l?(u||(2===r.rejection&&onHandleUnhandled(r),r.rejection=1),!0===l?i=c:(m&&m.enter(),i=l(c),m&&(m.exit(),a=!0)),i===t.promise?p(new V("Promise-chain cycle")):(o=isThenable(i))?h(o,i,d,p):d(i)):p(c)}catch(t){m&&!a&&m.exit(),p(t)}},notify=function(t,r){t.notified||(t.notified=!0,x((function(){for(var i,o=t.reactions;i=o.get();)callReaction(i,t);t.notified=!1,r&&!t.rejection&&onUnhandled(t)})))},dispatchEvent=function(t,r,i){var o,a;J?((o=H.createEvent("Event")).promise=r,o.reason=i,o.initEvent(t,!1,!0),p.dispatchEvent(o)):o={promise:r,reason:i},!D&&(a=p["on"+t])?a(o):"unhandledrejection"===t&&P("Unhandled promise rejection",i)},onUnhandled=function(t){h(k,p,(function(){var r,i=t.facade,o=t.value;if(isUnhandled(t)&&(r=C((function(){d?$.emit("unhandledRejection",o,i):dispatchEvent("unhandledrejection",i,o)})),t.rejection=d||isUnhandled(t)?2:1,r.error))throw r.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){h(k,p,(function(){var r=t.facade;d?$.emit("rejectionHandled",r):dispatchEvent("rejectionhandled",r,t.value)}))},bind=function(t,r,i){return function(o){t(r,o,i)}},internalReject=function(t,r,i){t.done||(t.done=!0,i&&(t=i),t.value=r,t.state=2,notify(t,!0))},internalResolve=function(t,r,i){if(!t.done){t.done=!0,i&&(t=i);try{if(t.facade===r)throw new V("Promise can't be resolved itself");var o=isThenable(r);o?x((function(){var i={done:!1};try{h(o,r,bind(internalResolve,i,t),bind(internalReject,i,t))}catch(r){internalReject(i,r,t)}})):(t.value=r,t.state=1,notify(t,!1))}catch(r){internalReject({done:!1},r,t)}}};if(L&&(z=(W=function Promise(t){S(this,z),b(t),h(o,this);var r=N(this);try{t(bind(internalResolve,r),bind(internalReject,r))}catch(t){internalReject(r,t)}}).prototype,(o=function Promise(t){U(this,{type:"Promise",done:!1,notified:!1,parent:!1,reactions:new A,rejection:!1,state:0,value:void 0})}).prototype=m(z,"then",(function then(t,r){var i=N(this),o=K(I(this,W));return i.parent=!0,o.ok=!_(t)||t,o.fail=_(r)&&r,o.domain=d?$.domain:void 0,0===i.state?i.reactions.add(o):x((function(){callReaction(o,i)})),o.promise})),a=function(){var t=new o,r=N(t);this.promise=t,this.resolve=bind(internalResolve,r),this.reject=bind(internalReject,r)},j.f=K=function(t){return t===W||void 0===t?new a(t):G(t)},!l&&_(R)&&q!==Object.prototype)){c=q.then,B||m(q,"then",(function then(t,r){var i=this;return new W((function(t,r){h(c,i,t,r)})).then(t,r)}),{unsafe:!0});try{delete q.constructor}catch(t){}g&&g(q,z)}u({global:!0,constructor:!0,wrap:!0,forced:L},{Promise:W}),y(W,"Promise",!1,!0),v("Promise")},function(t,r,i){"use strict";var o=i(28),a=i(171),c=i(10),u=i(13),l=c("species");t.exports=function(t){var r=o(t);u&&r&&!r[l]&&a(r,l,{configurable:!0,get:function(){return this}})}},function(t,r,i){"use strict";var o=i(132),a=i(80),c=TypeError;t.exports=function(t){if(o(t))return t;throw new c(a(t)+" is not a constructor")}},function(t,r,i){"use strict";var o,a,c,u,l,d=i(11),p=i(272),h=i(63),m=i(269).set,g=i(273),y=i(271),v=i(530),b=i(531),_=i(139),w=d.MutationObserver||d.WebKitMutationObserver,S=d.document,I=d.process,k=d.Promise,x=p("queueMicrotask");if(!x){var P=new g,flush=function(){var t,r;for(_&&(t=I.domain)&&t.exit();r=P.get();)try{r()}catch(t){throw P.head&&o(),t}t&&t.enter()};y||_||b||!w||!S?!v&&k&&k.resolve?((u=k.resolve(void 0)).constructor=k,l=h(u.then,u),o=function(){l(flush)}):_?o=function(){I.nextTick(flush)}:(m=h(m,d),o=function(){m(flush)}):(a=!0,c=S.createTextNode(""),new w(flush).observe(c,{characterData:!0}),o=function(){c.data=a=!a}),x=function(t){P.head||o(),P.add(t)}}t.exports=x},function(t,r,i){"use strict";var o=i(125);t.exports=/ipad|iphone|ipod/i.test(o)&&"undefined"!=typeof Pebble},function(t,r,i){"use strict";var o=i(125);t.exports=/web0s(?!.*chrome)/i.test(o)},function(t,r,i){"use strict";t.exports=function(t,r){try{1===arguments.length?console.error(t):console.error(t,r)}catch(t){}}},function(t,r,i){"use strict";var o=i(274),a=i(139);t.exports=!o&&!a&&"object"==typeof window&&"object"==typeof document},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(39),u=i(50),l=i(86),d=i(70);o({target:"Promise",stat:!0,forced:i(141)},{all:function all(t){var r=this,i=u.f(r),o=i.resolve,p=i.reject,h=l((function(){var i=c(r.resolve),u=[],l=0,h=1;d(t,(function(t){var c=l++,d=!1;h++,a(i,r,t).then((function(t){d||(d=!0,u[c]=t,--h||o(u))}),p)})),--h||o(u)}));return h.error&&p(h.value),i.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(35),c=i(110).CONSTRUCTOR,u=i(87),l=i(28),d=i(12),p=i(48),h=u&&u.prototype;if(o({target:"Promise",proto:!0,forced:c,real:!0},{catch:function(t){return this.then(void 0,t)}}),!a&&d(u)){var m=l("Promise").prototype.catch;h.catch!==m&&p(h,"catch",m,{unsafe:!0})}},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(39),u=i(50),l=i(86),d=i(70);o({target:"Promise",stat:!0,forced:i(141)},{race:function race(t){var r=this,i=u.f(r),o=i.reject,p=l((function(){var u=c(r.resolve);d(t,(function(t){a(u,r,t).then(i.resolve,o)}))}));return p.error&&o(p.value),i.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(50);o({target:"Promise",stat:!0,forced:i(110).CONSTRUCTOR},{reject:function reject(t){var r=a.f(this);return(0,r.reject)(t),r.promise}})},function(t,r,i){"use strict";var o=i(1),a=i(28),c=i(35),u=i(87),l=i(110).CONSTRUCTOR,d=i(275),p=a("Promise"),h=c&&!l;o({target:"Promise",stat:!0,forced:c||l},{resolve:function resolve(t){return d(h&&this===p?u:this,t)}})},function(t,r,i){"use strict";var o=i(1),a=i(35),c=i(87),u=i(8),l=i(28),d=i(12),p=i(268),h=i(275),m=i(48),g=c&&c.prototype;if(o({target:"Promise",proto:!0,real:!0,forced:!!c&&u((function(){g.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var r=p(this,l("Promise")),i=d(t);return this.then(i?function(i){return h(r,t()).then((function(){return i}))}:t,i?function(i){return h(r,t()).then((function(){throw i}))}:t)}}),!a&&d(c)){var y=l("Promise").prototype.finally;g.finally!==y&&m(g,"finally",y,{unsafe:!0})}},function(t,r,i){"use strict";i(278)},function(t,r,i){"use strict";i(267)},function(t,r,i){"use strict";i(276)},function(t,r,i){"use strict";var o=i(1),a=i(99),c=i(83),u=i(50),l=i(39),d=i(86);o({target:"Promise",stat:!0,forced:!0},{try:function(t){var r=c(arguments,1),i=u.f(this),o=d((function(){return a(l(t),void 0,r)}));return(o.error?i.reject:i.resolve)(o.value),i.promise}})},function(t,r,i){"use strict";i(277)},function(t,r,i){var o=i(7).default,a=i(133),c=i(106),u=i(546),l=i(552),d=i(238),p=i(173),h=i(558),m=i(265),g=i(564),y=i(257);function _regeneratorRuntime(){"use strict";t.exports=_regeneratorRuntime=function _regeneratorRuntime(){return i},t.exports.__esModule=!0,t.exports.default=t.exports;var r,i={},v=Object.prototype,b=v.hasOwnProperty,_=a||function(t,r,i){t[r]=i.value},w="function"==typeof c?c:{},S=w.iterator||"@@iterator",I=w.asyncIterator||"@@asyncIterator",k=w.toStringTag||"@@toStringTag";function define(t,r,i){return a(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{define({},"")}catch(r){define=function define(t,r,i){return t[r]=i}}function wrap(t,r,i,o){var a=r&&r.prototype instanceof Generator?r:Generator,c=u(a.prototype),l=new Context(o||[]);return _(c,"_invoke",{value:makeInvokeMethod(t,i,l)}),c}function tryCatch(t,r,i){try{return{type:"normal",arg:t.call(r,i)}}catch(t){return{type:"throw",arg:t}}}i.wrap=wrap;var x="suspendedStart",P="executing",C="completed",A={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var O={};define(O,S,(function(){return this}));var R=l&&l(l(values([])));R&&R!==v&&b.call(R,S)&&(O=R);var M=GeneratorFunctionPrototype.prototype=Generator.prototype=u(O);function defineIteratorMethods(t){var r;d(r=["next","throw","return"]).call(r,(function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}function AsyncIterator(t,r){function invoke(i,a,c,u){var l=tryCatch(t[i],t,a);if("throw"!==l.type){var d=l.arg,p=d.value;return p&&"object"==o(p)&&b.call(p,"__await")?r.resolve(p.__await).then((function(t){invoke("next",t,c,u)}),(function(t){invoke("throw",t,c,u)})):r.resolve(p).then((function(t){d.value=t,c(d)}),(function(t){return invoke("throw",t,c,u)}))}u(l.arg)}var i;_(this,"_invoke",{value:function value(t,o){function callInvokeWithMethodAndArg(){return new r((function(r,i){invoke(t,o,r,i)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(t,i,o){var a=x;return function(c,u){if(a===P)throw Error("Generator is already running");if(a===C){if("throw"===c)throw u;return{value:r,done:!0}}for(o.method=c,o.arg=u;;){var l=o.delegate;if(l){var d=maybeInvokeDelegate(l,o);if(d){if(d===A)continue;return d}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(a===x)throw a=C,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);a=P;var p=tryCatch(t,i,o);if("normal"===p.type){if(a=o.done?C:"suspendedYield",p.arg===A)continue;return{value:p.arg,done:o.done}}"throw"===p.type&&(a=C,o.method="throw",o.arg=p.arg)}}}function maybeInvokeDelegate(t,i){var o=i.method,a=t.iterator[o];if(a===r)return i.delegate=null,"throw"===o&&t.iterator.return&&(i.method="return",i.arg=r,maybeInvokeDelegate(t,i),"throw"===i.method)||"return"!==o&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+o+"' method")),A;var c=tryCatch(a,t.iterator,i.arg);if("throw"===c.type)return i.method="throw",i.arg=c.arg,i.delegate=null,A;var u=c.arg;return u?u.done?(i[t.resultName]=u.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=r),i.delegate=null,A):u:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,A)}function pushTryEntry(t){var r,i={tryLoc:t[0]};1 in t&&(i.catchLoc=t[1]),2 in t&&(i.finallyLoc=t[2],i.afterLoc=t[3]),p(r=this.tryEntries).call(r,i)}function resetTryEntry(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}],d(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t||""===t){var i=t[S];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,c=function next(){for(;++a<t.length;)if(b.call(t,a))return next.value=t[a],next.done=!1,next;return next.value=r,next.done=!0,next};return c.next=c}}throw new TypeError(o(t)+" is not iterable")}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_(M,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),_(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,k,"GeneratorFunction"),i.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))},i.mark=function(t){return h?h(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,k,"GeneratorFunction")),t.prototype=u(M),t},i.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,I,(function(){return this})),i.AsyncIterator=AsyncIterator,i.async=function(t,r,o,a,c){void 0===c&&(c=m);var u=new AsyncIterator(wrap(t,r,o,a),c);return i.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},defineIteratorMethods(M),define(M,k,"Generator"),define(M,S,(function(){return this})),define(M,"toString",(function(){return"[object Generator]"})),i.keys=function(t){var r=Object(t),i=[];for(var o in r)p(i).call(i,o);return g(i).call(i),function next(){for(;i.length;){var t=i.pop();if(t in r)return next.value=t,next.done=!1,next}return next.done=!0,next}},i.values=values,Context.prototype={constructor:Context,reset:function reset(t){var i;if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,d(i=this.tryEntries).call(i,resetTryEntry),!t)for(var o in this)"t"===o.charAt(0)&&b.call(this,o)&&!isNaN(+y(o).call(o,1))&&(this[o]=r)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var i=this;function handle(o,a){return c.type="throw",c.arg=t,i.next=o,a&&(i.method="next",i.arg=r),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return handle("end");if(a.tryLoc<=this.prev){var u=b.call(a,"catchLoc"),l=b.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return handle(a.catchLoc,!0);if(this.prev<a.finallyLoc)return handle(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return handle(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return handle(a.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&b.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var c=a?a.completion:{};return c.type=t,c.arg=r,a?(this.method="next",this.next=a.finallyLoc,A):this.complete(c)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),A},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),resetTryEntry(i),A}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc===t){var o=i.completion;if("throw"===o.type){var a=o.arg;resetTryEntry(i)}return a}}throw Error("illegal catch attempt")},delegateYield:function delegateYield(t,i,o){return this.delegate={iterator:values(t),resultName:i,nextLoc:o},"next"===this.method&&(this.arg=r),A}},i}t.exports=_regeneratorRuntime,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";t.exports=i(547)},function(t,r,i){"use strict";var o=i(548);t.exports=o},function(t,r,i){"use strict";var o=i(549);t.exports=o},function(t,r,i){"use strict";var o=i(550);t.exports=o},function(t,r,i){"use strict";i(551);var o=i(15).Object;t.exports=function create(t,r){return o.create(t,r)}},function(t,r,i){"use strict";i(1)({target:"Object",stat:!0,sham:!i(13)},{create:i(82)})},function(t,r,i){"use strict";t.exports=i(553)},function(t,r,i){"use strict";var o=i(554);t.exports=o},function(t,r,i){"use strict";var o=i(555);t.exports=o},function(t,r,i){"use strict";var o=i(556);t.exports=o},function(t,r,i){"use strict";i(557);var o=i(15);t.exports=o.Object.getPrototypeOf},function(t,r,i){"use strict";var o=i(1),a=i(8),c=i(36),u=i(108),l=i(248);o({target:"Object",stat:!0,forced:a((function(){u(1)})),sham:!l},{getPrototypeOf:function getPrototypeOf(t){return u(c(t))}})},function(t,r,i){"use strict";t.exports=i(559)},function(t,r,i){"use strict";var o=i(560);t.exports=o},function(t,r,i){"use strict";var o=i(561);t.exports=o},function(t,r,i){"use strict";var o=i(562);t.exports=o},function(t,r,i){"use strict";i(563);var o=i(15);t.exports=o.Object.setPrototypeOf},function(t,r,i){"use strict";i(1)({target:"Object",stat:!0},{setPrototypeOf:i(134)})},function(t,r,i){"use strict";t.exports=i(565)},function(t,r,i){"use strict";var o=i(566);t.exports=o},function(t,r,i){"use strict";var o=i(567);t.exports=o},function(t,r,i){"use strict";var o=i(568);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(569),c=Array.prototype;t.exports=function(t){var r=t.reverse;return t===c||o(c,t)&&r===c.reverse?a:r}},function(t,r,i){"use strict";i(570);var o=i(29);t.exports=o("Array","reverse")},function(t,r,i){"use strict";var o=i(1),a=i(9),c=i(66),u=a([].reverse),l=[1,2];o({target:"Array",proto:!0,forced:String(l)===String(l.reverse())},{reverse:function reverse(){return c(this)&&(this.length=this.length),u(this)}})},function(t,r,i){"use strict";var o=i(572);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(573),c=i(575),u=Array.prototype,l=String.prototype;t.exports=function(t){var r=t.includes;return t===u||o(u,t)&&r===u.includes?a:"string"==typeof t||t===l||o(l,t)&&r===l.includes?c:r}},function(t,r,i){"use strict";i(574);var o=i(29);t.exports=o("Array","includes")},function(t,r,i){"use strict";var o=i(1),a=i(165).includes,c=i(8),u=i(175);o({target:"Array",proto:!0,forced:c((function(){return!Array(1).includes()}))},{includes:function includes(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}}),u("includes")},function(t,r,i){"use strict";i(576);var o=i(29);t.exports=o("String","includes")},function(t,r,i){"use strict";var o=i(1),a=i(9),c=i(251),u=i(56),l=i(40),d=i(252),p=a("".indexOf);o({target:"String",proto:!0,forced:!d("includes")},{includes:function includes(t){return!!~p(l(u(this)),l(c(t)),arguments.length>1?arguments[1]:void 0)}})},function(t,r,i){"use strict";i(67);var o=i(64),a=i(21),c=i(23),u=i(578),l=Array.prototype,d={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var r=t.entries;return t===l||c(l,t)&&r===l.entries||a(d,o(t))?u:r}},function(t,r,i){"use strict";var o=i(579);t.exports=o},function(t,r,i){"use strict";i(68),i(107);var o=i(29);t.exports=o("Array","entries")},function(t,r,i){"use strict";var o=i(581);t.exports=o},function(t,r,i){"use strict";i(582),i(235);var o=i(15),a=i(99);o.JSON||(o.JSON={stringify:JSON.stringify}),t.exports=function stringify(t,r,i){return a(o.JSON.stringify,null,arguments)}},function(t,r,i){"use strict";var o=i(1),a=i(20),c=i(36),u=i(221),l=i(583),d=i(43);o({target:"Date",proto:!0,forced:i(8)((function(){return null!==new Date(NaN).toJSON()||1!==a(Date.prototype.toJSON,{toISOString:function(){return 1}})}))},{toJSON:function toJSON(t){var r=c(this),i=u(r,"number");return"number"!=typeof i||isFinite(i)?"toISOString"in r||"Date"!==d(r)?r.toISOString():a(l,r):null}})},function(t,r,i){"use strict";var o=i(9),a=i(8),c=i(584).start,u=RangeError,l=isFinite,d=Math.abs,p=Date.prototype,h=p.toISOString,m=o(p.getTime),g=o(p.getUTCDate),y=o(p.getUTCFullYear),v=o(p.getUTCHours),b=o(p.getUTCMilliseconds),_=o(p.getUTCMinutes),w=o(p.getUTCMonth),S=o(p.getUTCSeconds);t.exports=a((function(){return"0385-07-25T07:06:39.999Z"!==h.call(new Date(-50000000000001))}))||!a((function(){h.call(new Date(NaN))}))?function toISOString(){if(!l(m(this)))throw new u("Invalid time value");var t=y(this),r=b(this),i=t<0?"-":t>9999?"+":"";return i+c(d(t),i?6:4,0)+"-"+c(w(this)+1,2,0)+"-"+c(g(this),2,0)+"T"+c(v(this),2,0)+":"+c(_(this),2,0)+":"+c(S(this),2,0)+"."+c(r,3,0)+"Z"}:h},function(t,r,i){"use strict";var o=i(9),a=i(167),c=i(40),u=i(585),l=i(56),d=o(u),p=o("".slice),h=Math.ceil,createMethod=function(t){return function(r,i,o){var u,m,g=c(l(r)),y=a(i),v=g.length,b=void 0===o?" ":c(o);return y<=v||""===b?g:((m=d(b,h((u=y-v)/b.length))).length>u&&(m=p(m,0,u)),t?g+m:m+g)}};t.exports={start:createMethod(!1),end:createMethod(!0)}},function(t,r,i){"use strict";var o=i(102),a=i(40),c=i(56),u=RangeError;t.exports=function repeat(t){var r=a(c(this)),i="",l=o(t);if(l<0||l===1/0)throw new u("Wrong number of repetitions");for(;l>0;(l>>>=1)&&(r+=r))1&l&&(i+=r);return i}},function(t,r,i){"use strict";var o=i(587);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(588),c=Array.prototype;t.exports=function(t){var r=t.map;return t===c||o(c,t)&&r===c.map?a:r}},function(t,r,i){"use strict";i(589);var o=i(29);t.exports=o("Array","map")},function(t,r,i){"use strict";var o=i(1),a=i(65).map;o({target:"Array",proto:!0,forced:!i(104)("map")},{map:function map(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,r,i){"use strict";var o=i(591);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(592),c=Array.prototype;t.exports=function(t){var r=t.concat;return t===c||o(c,t)&&r===c.concat?a:r}},function(t,r,i){"use strict";i(242);var o=i(29);t.exports=o("Array","concat")},function(t,r,i){"use strict";var o=i(594);t.exports=o},function(t,r,i){"use strict";i(595);var o=i(15);t.exports=o.Object.entries},function(t,r,i){"use strict";var o=i(1),a=i(596).entries;o({target:"Object",stat:!0},{entries:function entries(t){return a(t)}})},function(t,r,i){"use strict";var o=i(13),a=i(8),c=i(9),u=i(108),l=i(101),d=i(38),p=c(i(123).f),h=c([].push),m=o&&a((function(){var t=Object.create(null);return t[2]=2,!p(t,2)})),createMethod=function(t){return function(r){for(var i,a=d(r),c=l(a),g=m&&null===u(a),y=c.length,v=0,b=[];y>v;)i=c[v++],o&&!(g?i in a:p(a,i))||h(b,t?[i,a[i]]:a[i]);return b}};t.exports={entries:createMethod(!0),values:createMethod(!1)}},function(t,r,i){var o=i(183),a=i(264);t.exports=function _arrayWithoutHoles(t){if(o(t))return a(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){var o=i(106),a=i(182),c=i(259);t.exports=function _iterableToArray(t){if(void 0!==o&&null!=a(t)||null!=t["@@iterator"])return c(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r){t.exports=function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r,i){"use strict";var o=i(601);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(602),c=Array.prototype;t.exports=function(t){var r=t.find;return t===c||o(c,t)&&r===c.find?a:r}},function(t,r,i){"use strict";i(603);var o=i(29);t.exports=o("Array","find")},function(t,r,i){"use strict";var o=i(1),a=i(65).find,c=i(175),u=!0;"find"in[]&&Array(1).find((function(){u=!1})),o({target:"Array",proto:!0,forced:u},{find:function find(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}}),c("find")},function(t,r,i){"use strict";var o=i(605);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(606),c=Array.prototype;t.exports=function(t){var r=t.splice;return t===c||o(c,t)&&r===c.splice?a:r}},function(t,r,i){"use strict";i(607);var o=i(29);t.exports=o("Array","splice")},function(t,r,i){"use strict";var o=i(1),a=i(36),c=i(166),u=i(102),l=i(57),d=i(237),p=i(174),h=i(172),m=i(105),g=i(608),y=i(104)("splice"),v=Math.max,b=Math.min;o({target:"Array",proto:!0,forced:!y},{splice:function splice(t,r){var i,o,y,_,w,S,I=a(this),k=l(I),x=c(t,k),P=arguments.length;for(0===P?i=o=0:1===P?(i=0,o=k-x):(i=P-2,o=b(v(u(r),0),k-x)),p(k+i-o),y=h(I,o),_=0;_<o;_++)(w=x+_)in I&&m(y,_,I[w]);if(y.length=o,i<o){for(_=x;_<k-o;_++)S=_+i,(w=_+o)in I?I[S]=I[w]:g(I,S);for(_=k;_>k-o+i;_--)g(I,_-1)}else if(i>o)for(_=k-o;_>x;_--)S=_+i-1,(w=_+o-1)in I?I[S]=I[w]:g(I,S);for(_=0;_<i;_++)I[_+x]=arguments[_+2];return d(I,k-o+i),y}})},function(t,r,i){"use strict";var o=i(80),a=TypeError;t.exports=function(t,r){if(!delete t[r])throw new a("Cannot delete property "+o(r)+" of "+o(t))}},function(t,r,i){var o=i(610),a=i(639),c=i(285),u=i(641),l=i(651),d=i(654),p=i(655),h=i(656),m=i(658),g=i(659),y=i(660),v=i(193),b=i(665),_=i(666),w=i(672),S=i(89),I=i(288),k=i(674),x=i(112),P=i(676),C=i(187),A=i(191),O={};O["[object Arguments]"]=O["[object Array]"]=O["[object ArrayBuffer]"]=O["[object DataView]"]=O["[object Boolean]"]=O["[object Date]"]=O["[object Float32Array]"]=O["[object Float64Array]"]=O["[object Int8Array]"]=O["[object Int16Array]"]=O["[object Int32Array]"]=O["[object Map]"]=O["[object Number]"]=O["[object Object]"]=O["[object RegExp]"]=O["[object Set]"]=O["[object String]"]=O["[object Symbol]"]=O["[object Uint8Array]"]=O["[object Uint8ClampedArray]"]=O["[object Uint16Array]"]=O["[object Uint32Array]"]=!0,O["[object Error]"]=O["[object Function]"]=O["[object WeakMap]"]=!1,t.exports=function baseClone(t,r,i,R,M,j){var L,D=1&r,B=2&r,N=4&r;if(i&&(L=M?i(t,R,M,j):i(t)),void 0!==L)return L;if(!x(t))return t;var U=S(t);if(U){if(L=b(t),!D)return p(t,L)}else{var q=v(t),W="[object Function]"==q||"[object GeneratorFunction]"==q;if(I(t))return d(t,D);if("[object Object]"==q||"[object Arguments]"==q||W&&!M){if(L=B||W?{}:w(t),!D)return B?m(t,l(L,t)):h(t,u(L,t))}else{if(!O[q])return M?t:{};L=_(t,q,D)}}j||(j=new o);var z=j.get(t);if(z)return z;j.set(t,L),P(t)?t.forEach((function(o){L.add(baseClone(o,r,i,o,t,j))})):k(t)&&t.forEach((function(o,a){L.set(a,baseClone(o,r,i,a,t,j))}));var V=U?void 0:(N?B?y:g:B?A:C)(t);return a(V||t,(function(o,a){V&&(o=t[a=o]),c(L,a,baseClone(o,r,i,a,t,j))})),L}},function(t,r,i){var o=i(142),a=i(616),c=i(617),u=i(618),l=i(619),d=i(620);function Stack(t){var r=this.__data__=new o(t);this.size=r.size}Stack.prototype.clear=a,Stack.prototype.delete=c,Stack.prototype.get=u,Stack.prototype.has=l,Stack.prototype.set=d,t.exports=Stack},function(t,r){t.exports=function listCacheClear(){this.__data__=[],this.size=0}},function(t,r,i){var o=i(143),a=Array.prototype.splice;t.exports=function listCacheDelete(t){var r=this.__data__,i=o(r,t);return!(i<0)&&(i==r.length-1?r.pop():a.call(r,i,1),--this.size,!0)}},function(t,r,i){var o=i(143);t.exports=function listCacheGet(t){var r=this.__data__,i=o(r,t);return i<0?void 0:r[i][1]}},function(t,r,i){var o=i(143);t.exports=function listCacheHas(t){return o(this.__data__,t)>-1}},function(t,r,i){var o=i(143);t.exports=function listCacheSet(t,r){var i=this.__data__,a=o(i,t);return a<0?(++this.size,i.push([t,r])):i[a][1]=r,this}},function(t,r,i){var o=i(142);t.exports=function stackClear(){this.__data__=new o,this.size=0}},function(t,r){t.exports=function stackDelete(t){var r=this.__data__,i=r.delete(t);return this.size=r.size,i}},function(t,r){t.exports=function stackGet(t){return this.__data__.get(t)}},function(t,r){t.exports=function stackHas(t){return this.__data__.has(t)}},function(t,r,i){var o=i(142),a=i(186),c=i(284);t.exports=function stackSet(t,r){var i=this.__data__;if(i instanceof o){var u=i.__data__;if(!a||u.length<199)return u.push([t,r]),this.size=++i.size,this;i=this.__data__=new c(u)}return i.set(t,r),this.size=i.size,this}},function(t,r,i){var o=i(281),a=i(624),c=i(112),u=i(283),l=/^\[object .+?Constructor\]$/,d=Function.prototype,p=Object.prototype,h=d.toString,m=p.hasOwnProperty,g=RegExp("^"+h.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function baseIsNative(t){return!(!c(t)||a(t))&&(o(t)?g:l).test(u(t))}},function(t,r,i){var o=i(144),a=Object.prototype,c=a.hasOwnProperty,u=a.toString,l=o?o.toStringTag:void 0;t.exports=function getRawTag(t){var r=c.call(t,l),i=t[l];try{t[l]=void 0;var o=!0}catch(t){}var a=u.call(t);return o&&(r?t[l]=i:delete t[l]),a}},function(t,r){var i=Object.prototype.toString;t.exports=function objectToString(t){return i.call(t)}},function(t,r,i){var o,a=i(625),c=(o=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"";t.exports=function isMasked(t){return!!c&&c in t}},function(t,r,i){var o=i(44)["__core-js_shared__"];t.exports=o},function(t,r){t.exports=function getValue(t,r){return null==t?void 0:t[r]}},function(t,r,i){var o=i(628),a=i(142),c=i(186);t.exports=function mapCacheClear(){this.size=0,this.__data__={hash:new o,map:new(c||a),string:new o}}},function(t,r,i){var o=i(629),a=i(630),c=i(631),u=i(632),l=i(633);function Hash(t){var r=-1,i=null==t?0:t.length;for(this.clear();++r<i;){var o=t[r];this.set(o[0],o[1])}}Hash.prototype.clear=o,Hash.prototype.delete=a,Hash.prototype.get=c,Hash.prototype.has=u,Hash.prototype.set=l,t.exports=Hash},function(t,r,i){var o=i(145);t.exports=function hashClear(){this.__data__=o?o(null):{},this.size=0}},function(t,r){t.exports=function hashDelete(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}},function(t,r,i){var o=i(145),a=Object.prototype.hasOwnProperty;t.exports=function hashGet(t){var r=this.__data__;if(o){var i=r[t];return"__lodash_hash_undefined__"===i?void 0:i}return a.call(r,t)?r[t]:void 0}},function(t,r,i){var o=i(145),a=Object.prototype.hasOwnProperty;t.exports=function hashHas(t){var r=this.__data__;return o?void 0!==r[t]:a.call(r,t)}},function(t,r,i){var o=i(145);t.exports=function hashSet(t,r){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=o&&void 0===r?"__lodash_hash_undefined__":r,this}},function(t,r,i){var o=i(146);t.exports=function mapCacheDelete(t){var r=o(this,t).delete(t);return this.size-=r?1:0,r}},function(t,r){t.exports=function isKeyable(t){var r=typeof t;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t}},function(t,r,i){var o=i(146);t.exports=function mapCacheGet(t){return o(this,t).get(t)}},function(t,r,i){var o=i(146);t.exports=function mapCacheHas(t){return o(this,t).has(t)}},function(t,r,i){var o=i(146);t.exports=function mapCacheSet(t,r){var i=o(this,t),a=i.size;return i.set(t,r),this.size+=i.size==a?0:1,this}},function(t,r){t.exports=function arrayEach(t,r){for(var i=-1,o=null==t?0:t.length;++i<o&&!1!==r(t[i],i,t););return t}},function(t,r,i){var o=i(71),a=function(){try{var t=o(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=a},function(t,r,i){var o=i(147),a=i(187);t.exports=function baseAssign(t,r){return t&&o(r,a(r),t)}},function(t,r){t.exports=function baseTimes(t,r){for(var i=-1,o=Array(t);++i<t;)o[i]=r(i);return o}},function(t,r,i){var o=i(644),a=i(88),c=Object.prototype,u=c.hasOwnProperty,l=c.propertyIsEnumerable,d=o(function(){return arguments}())?o:function(t){return a(t)&&u.call(t,"callee")&&!l.call(t,"callee")};t.exports=d},function(t,r,i){var o=i(111),a=i(88);t.exports=function baseIsArguments(t){return a(t)&&"[object Arguments]"==o(t)}},function(t,r){t.exports=function stubFalse(){return!1}},function(t,r){var i=/^(?:0|[1-9]\d*)$/;t.exports=function isIndex(t,r){var o=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==o||"symbol"!=o&&i.test(t))&&t>-1&&t%1==0&&t<r}},function(t,r,i){var o=i(648),a=i(188),c=i(189),u=c&&c.isTypedArray,l=u?a(u):o;t.exports=l},function(t,r,i){var o=i(111),a=i(289),c=i(88),u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u["[object Arguments]"]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u["[object Map]"]=u["[object Number]"]=u["[object Object]"]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1,t.exports=function baseIsTypedArray(t){return c(t)&&a(t.length)&&!!u[o(t)]}},function(t,r,i){var o=i(190),a=i(650),c=Object.prototype.hasOwnProperty;t.exports=function baseKeys(t){if(!o(t))return a(t);var r=[];for(var i in Object(t))c.call(t,i)&&"constructor"!=i&&r.push(i);return r}},function(t,r,i){var o=i(290)(Object.keys,Object);t.exports=o},function(t,r,i){var o=i(147),a=i(191);t.exports=function baseAssignIn(t,r){return t&&o(r,a(r),t)}},function(t,r,i){var o=i(112),a=i(190),c=i(653),u=Object.prototype.hasOwnProperty;t.exports=function baseKeysIn(t){if(!o(t))return c(t);var r=a(t),i=[];for(var l in t)("constructor"!=l||!r&&u.call(t,l))&&i.push(l);return i}},function(t,r){t.exports=function nativeKeysIn(t){var r=[];if(null!=t)for(var i in Object(t))r.push(i);return r}},function(t,r,i){(function(t){var o=i(44),a=r&&!r.nodeType&&r,c=a&&"object"==typeof t&&t&&!t.nodeType&&t,u=c&&c.exports===a?o.Buffer:void 0,l=u?u.allocUnsafe:void 0;t.exports=function cloneBuffer(t,r){if(r)return t.slice();var i=t.length,o=l?l(i):new t.constructor(i);return t.copy(o),o}}).call(this,i(136)(t))},function(t,r){t.exports=function copyArray(t,r){var i=-1,o=t.length;for(r||(r=Array(o));++i<o;)r[i]=t[i];return r}},function(t,r,i){var o=i(147),a=i(192);t.exports=function copySymbols(t,r){return o(t,a(t),r)}},function(t,r){t.exports=function arrayFilter(t,r){for(var i=-1,o=null==t?0:t.length,a=0,c=[];++i<o;){var u=t[i];r(u,i,t)&&(c[a++]=u)}return c}},function(t,r,i){var o=i(147),a=i(293);t.exports=function copySymbolsIn(t,r){return o(t,a(t),r)}},function(t,r,i){var o=i(296),a=i(192),c=i(187);t.exports=function getAllKeys(t){return o(t,c,a)}},function(t,r,i){var o=i(296),a=i(293),c=i(191);t.exports=function getAllKeysIn(t){return o(t,c,a)}},function(t,r,i){var o=i(71)(i(44),"DataView");t.exports=o},function(t,r,i){var o=i(71)(i(44),"Promise");t.exports=o},function(t,r,i){var o=i(71)(i(44),"Set");t.exports=o},function(t,r,i){var o=i(71)(i(44),"WeakMap");t.exports=o},function(t,r){var i=Object.prototype.hasOwnProperty;t.exports=function initCloneArray(t){var r=t.length,o=new t.constructor(r);return r&&"string"==typeof t[0]&&i.call(t,"index")&&(o.index=t.index,o.input=t.input),o}},function(t,r,i){var o=i(194),a=i(668),c=i(669),u=i(670),l=i(671);t.exports=function initCloneByTag(t,r,i){var d=t.constructor;switch(r){case"[object ArrayBuffer]":return o(t);case"[object Boolean]":case"[object Date]":return new d(+t);case"[object DataView]":return a(t,i);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 l(t,i);case"[object Map]":return new d;case"[object Number]":case"[object String]":return new d(t);case"[object RegExp]":return c(t);case"[object Set]":return new d;case"[object Symbol]":return u(t)}}},function(t,r,i){var o=i(44).Uint8Array;t.exports=o},function(t,r,i){var o=i(194);t.exports=function cloneDataView(t,r){var i=r?o(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}},function(t,r){var i=/\w*$/;t.exports=function cloneRegExp(t){var r=new t.constructor(t.source,i.exec(t));return r.lastIndex=t.lastIndex,r}},function(t,r,i){var o=i(144),a=o?o.prototype:void 0,c=a?a.valueOf:void 0;t.exports=function cloneSymbol(t){return c?Object(c.call(t)):{}}},function(t,r,i){var o=i(194);t.exports=function cloneTypedArray(t,r){var i=r?o(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}},function(t,r,i){var o=i(673),a=i(295),c=i(190);t.exports=function initCloneObject(t){return"function"!=typeof t.constructor||c(t)?{}:o(a(t))}},function(t,r,i){var o=i(112),a=Object.create,c=function(){function object(){}return function(t){if(!o(t))return{};if(a)return a(t);object.prototype=t;var r=new object;return object.prototype=void 0,r}}();t.exports=c},function(t,r,i){var o=i(675),a=i(188),c=i(189),u=c&&c.isMap,l=u?a(u):o;t.exports=l},function(t,r,i){var o=i(193),a=i(88);t.exports=function baseIsMap(t){return a(t)&&"[object Map]"==o(t)}},function(t,r,i){var o=i(677),a=i(188),c=i(189),u=c&&c.isSet,l=u?a(u):o;t.exports=l},function(t,r,i){var o=i(193),a=i(88);t.exports=function baseIsSet(t){return a(t)&&"[object Set]"==o(t)}},function(t,r,i){"use strict";var o=i(679);i(67),t.exports=o},function(t,r,i){"use strict";i(68),i(107),i(680);var o=i(15);t.exports=o.WeakMap},function(t,r,i){"use strict";i(681)},function(t,r,i){"use strict";var o,a=i(297),c=i(11),u=i(9),l=i(195),d=i(196),p=i(684),h=i(685),m=i(18),g=i(58).enforce,y=i(8),v=i(232),b=Object,_=Array.isArray,w=b.isExtensible,S=b.isFrozen,I=b.isSealed,k=b.freeze,x=b.seal,P=!c.ActiveXObject&&"ActiveXObject"in c,wrapper=function(t){return function WeakMap(){return t(this,arguments.length?arguments[0]:void 0)}},C=p("WeakMap",wrapper,h),A=C.prototype,O=u(A.set);if(v)if(P){o=h.getConstructor(wrapper,"WeakMap",!0),d.enable();var R=u(A.delete),M=u(A.has),j=u(A.get);l(A,{delete:function(t){if(m(t)&&!w(t)){var r=g(this);return r.frozen||(r.frozen=new o),R(this,t)||r.frozen.delete(t)}return R(this,t)},has:function has(t){if(m(t)&&!w(t)){var r=g(this);return r.frozen||(r.frozen=new o),M(this,t)||r.frozen.has(t)}return M(this,t)},get:function get(t){if(m(t)&&!w(t)){var r=g(this);return r.frozen||(r.frozen=new o),M(this,t)?j(this,t):r.frozen.get(t)}return j(this,t)},set:function set(t,r){if(m(t)&&!w(t)){var i=g(this);i.frozen||(i.frozen=new o),M(this,t)?O(this,t,r):i.frozen.set(t,r)}else O(this,t,r);return this}})}else a&&y((function(){var t=k([]);return O(new C,t,1),!S(t)}))&&l(A,{set:function set(t,r){var i;return _(t)&&(S(t)?i=k:I(t)&&(i=x)),O(this,t,r),i&&i(t),this}})},function(t,r,i){"use strict";var o=i(8),a=i(18),c=i(43),u=i(683),l=Object.isExtensible,d=o((function(){l(1)}));t.exports=d||u?function isExtensible(t){return!!a(t)&&((!u||"ArrayBuffer"!==c(t))&&(!l||l(t)))}:l},function(t,r,i){"use strict";var o=i(8);t.exports=o((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}}))},function(t,r,i){"use strict";var o=i(1),a=i(11),c=i(196),u=i(8),l=i(47),d=i(70),p=i(140),h=i(12),m=i(18),g=i(78),y=i(49),v=i(32).f,b=i(65).forEach,_=i(13),w=i(58),S=w.set,I=w.getterFor;t.exports=function(t,r,i){var w,k=-1!==t.indexOf("Map"),x=-1!==t.indexOf("Weak"),P=k?"set":"add",C=a[t],A=C&&C.prototype,O={};if(_&&h(C)&&(x||A.forEach&&!u((function(){(new C).entries().next()})))){var R=(w=r((function(r,i){S(p(r,R),{type:t,collection:new C}),g(i)||d(i,r[P],{that:r,AS_ENTRIES:k})}))).prototype,M=I(t);b(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var r="add"===t||"set"===t;!(t in A)||x&&"clear"===t||l(R,t,(function(i,o){var a=M(this).collection;if(!r&&x&&!m(i))return"get"===t&&void 0;var c=a[t](0===i?0:i,o);return r?this:c}))})),x||v(R,"size",{configurable:!0,get:function(){return M(this).collection.size}})}else w=i.getConstructor(r,t,k,P),c.enable();return y(w,t,!1,!0),O[t]=w,o({global:!0,forced:!0},O),x||i.setStrong(w,t,k),w}},function(t,r,i){"use strict";var o=i(9),a=i(195),c=i(196).getWeakData,u=i(140),l=i(33),d=i(78),p=i(18),h=i(70),m=i(65),g=i(21),y=i(58),v=y.set,b=y.getterFor,_=m.find,w=m.findIndex,S=o([].splice),I=0,uncaughtFrozenStore=function(t){return t.frozen||(t.frozen=new UncaughtFrozenStore)},UncaughtFrozenStore=function(){this.entries=[]},findUncaughtFrozen=function(t,r){return _(t.entries,(function(t){return t[0]===r}))};UncaughtFrozenStore.prototype={get:function(t){var r=findUncaughtFrozen(this,t);if(r)return r[1]},has:function(t){return!!findUncaughtFrozen(this,t)},set:function(t,r){var i=findUncaughtFrozen(this,t);i?i[1]=r:this.entries.push([t,r])},delete:function(t){var r=w(this.entries,(function(r){return r[0]===t}));return~r&&S(this.entries,r,1),!!~r}},t.exports={getConstructor:function(t,r,i,o){var m=t((function(t,a){u(t,y),v(t,{type:r,id:I++,frozen:void 0}),d(a)||h(a,t[o],{that:t,AS_ENTRIES:i})})),y=m.prototype,_=b(r),define=function(t,r,i){var o=_(t),a=c(l(r),!0);return!0===a?uncaughtFrozenStore(o).set(r,i):a[o.id]=i,t};return a(y,{delete:function(t){var r=_(this);if(!p(t))return!1;var i=c(t);return!0===i?uncaughtFrozenStore(r).delete(t):i&&g(i,r.id)&&delete i[r.id]},has:function has(t){var r=_(this);if(!p(t))return!1;var i=c(t);return!0===i?uncaughtFrozenStore(r).has(t):i&&g(i,r.id)}}),a(y,i?{get:function get(t){var r=_(this);if(p(t)){var i=c(t);return!0===i?uncaughtFrozenStore(r).get(t):i?i[r.id]:void 0}},set:function set(t,r){return define(this,t,r)}}:{add:function add(t){return define(this,t,!0)}}),m}}},function(t,r,i){"use strict";var o=i(687);i(67),t.exports=o},function(t,r,i){"use strict";i(688),i(692),i(693),i(694);var o=i(15);t.exports=o.URLSearchParams},function(t,r,i){"use strict";i(689)},function(t,r,i){"use strict";i(68);var o=i(1),a=i(11),c=i(272),u=i(20),l=i(9),d=i(13),p=i(690),h=i(48),m=i(171),g=i(195),y=i(49),v=i(246),b=i(58),_=i(140),w=i(12),S=i(21),I=i(63),k=i(64),x=i(33),P=i(18),C=i(40),A=i(82),O=i(55),R=i(185),M=i(109),j=i(176),L=i(270),D=i(10),B=i(691),N=D("iterator"),U=b.set,q=b.getterFor("URLSearchParams"),W=b.getterFor("URLSearchParamsIterator"),z=c("fetch"),V=c("Request"),H=c("Headers"),$=V&&V.prototype,K=H&&H.prototype,G=a.RegExp,J=a.TypeError,Y=a.decodeURIComponent,Q=a.encodeURIComponent,X=l("".charAt),Z=l([].join),ee=l([].push),te=l("".replace),re=l([].shift),ne=l([].splice),ie=l("".split),oe=l("".slice),se=/\+/g,ae=Array(4),percentSequence=function(t){return ae[t-1]||(ae[t-1]=G("((?:%[\\da-f]{2}){"+t+"})","gi"))},percentDecode=function(t){try{return Y(t)}catch(r){return t}},deserialize=function(t){var r=te(t,se," "),i=4;try{return Y(r)}catch(t){for(;i;)r=te(r,percentSequence(i--),percentDecode);return r}},ce=/[!'()~]|%20/g,ue={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(t){return ue[t]},serialize=function(t){return te(Q(t),ce,replacer)},le=v((function Iterator(t,r){U(this,{type:"URLSearchParamsIterator",target:q(t).entries,index:0,kind:r})}),"URLSearchParams",(function next(){var t=W(this),r=t.target,i=t.index++;if(!r||i>=r.length)return t.target=void 0,j(void 0,!0);var o=r[i];switch(t.kind){case"keys":return j(o.key,!1);case"values":return j(o.value,!1)}return j([o.key,o.value],!1)}),!0),URLSearchParamsState=function(t){this.entries=[],this.url=null,void 0!==t&&(P(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===X(t,0)?oe(t,1):t:C(t)))};URLSearchParamsState.prototype={type:"URLSearchParams",bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var r,i,o,a,c,l,d,p=this.entries,h=M(t);if(h)for(i=(r=R(t,h)).next;!(o=u(i,r)).done;){if(c=(a=R(x(o.value))).next,(l=u(c,a)).done||(d=u(c,a)).done||!u(c,a).done)throw new J("Expected sequence with length 2");ee(p,{key:C(l.value),value:C(d.value)})}else for(var m in t)S(t,m)&&ee(p,{key:m,value:C(t[m])})},parseQuery:function(t){if(t)for(var r,i,o=this.entries,a=ie(t,"&"),c=0;c<a.length;)(r=a[c++]).length&&(i=ie(r,"="),ee(o,{key:deserialize(re(i)),value:deserialize(Z(i,"="))}))},serialize:function(){for(var t,r=this.entries,i=[],o=0;o<r.length;)t=r[o++],ee(i,serialize(t.key)+"="+serialize(t.value));return Z(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var fe=function URLSearchParams(){_(this,de);var t=arguments.length>0?arguments[0]:void 0,r=U(this,new URLSearchParamsState(t));d||(this.size=r.entries.length)},de=fe.prototype;if(g(de,{append:function append(t,r){var i=q(this);L(arguments.length,2),ee(i.entries,{key:C(t),value:C(r)}),d||this.length++,i.updateURL()},delete:function(t){for(var r=q(this),i=L(arguments.length,1),o=r.entries,a=C(t),c=i<2?void 0:arguments[1],u=void 0===c?c:C(c),l=0;l<o.length;){var p=o[l];if(p.key!==a||void 0!==u&&p.value!==u)l++;else if(ne(o,l,1),void 0!==u)break}d||(this.size=o.length),r.updateURL()},get:function get(t){var r=q(this).entries;L(arguments.length,1);for(var i=C(t),o=0;o<r.length;o++)if(r[o].key===i)return r[o].value;return null},getAll:function getAll(t){var r=q(this).entries;L(arguments.length,1);for(var i=C(t),o=[],a=0;a<r.length;a++)r[a].key===i&&ee(o,r[a].value);return o},has:function has(t){for(var r=q(this).entries,i=L(arguments.length,1),o=C(t),a=i<2?void 0:arguments[1],c=void 0===a?a:C(a),u=0;u<r.length;){var l=r[u++];if(l.key===o&&(void 0===c||l.value===c))return!0}return!1},set:function set(t,r){var i=q(this);L(arguments.length,1);for(var o,a=i.entries,c=!1,u=C(t),l=C(r),p=0;p<a.length;p++)(o=a[p]).key===u&&(c?ne(a,p--,1):(c=!0,o.value=l));c||ee(a,{key:u,value:l}),d||(this.size=a.length),i.updateURL()},sort:function sort(){var t=q(this);B(t.entries,(function(t,r){return t.key>r.key?1:-1})),t.updateURL()},forEach:function forEach(t){for(var r,i=q(this).entries,o=I(t,arguments.length>1?arguments[1]:void 0),a=0;a<i.length;)o((r=i[a++]).value,r.key,this)},keys:function keys(){return new le(this,"keys")},values:function values(){return new le(this,"values")},entries:function entries(){return new le(this,"entries")}},{enumerable:!0}),h(de,N,de.entries,{name:"entries"}),h(de,"toString",(function toString(){return q(this).serialize()}),{enumerable:!0}),d&&m(de,"size",{get:function size(){return q(this).entries.length},configurable:!0,enumerable:!0}),y(fe,"URLSearchParams"),o({global:!0,constructor:!0,forced:!p},{URLSearchParams:fe}),!p&&w(H)){var pe=l(K.has),he=l(K.set),wrapRequestOptions=function(t){if(P(t)){var r,i=t.body;if("URLSearchParams"===k(i))return r=t.headers?new H(t.headers):new H,pe(r,"content-type")||he(r,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),A(t,{body:O(0,C(i)),headers:O(0,r)})}return t};if(w(z)&&o({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function fetch(t){return z(t,arguments.length>1?wrapRequestOptions(arguments[1]):{})}}),w(V)){var me=function Request(t){return _(this,$),new V(t,arguments.length>1?wrapRequestOptions(arguments[1]):{})};$.constructor=me,me.prototype=$,o({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:me})}}t.exports={URLSearchParams:fe,getState:q}},function(t,r,i){"use strict";var o=i(8),a=i(10),c=i(13),u=i(35),l=a("iterator");t.exports=!o((function(){var t=new URL("b?a=1&b=2&c=3","http://a"),r=t.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),o="";return t.pathname="c%20d",r.forEach((function(t,i){r.delete("b"),o+=i+t})),i.delete("a",2),i.delete("b",void 0),u&&(!t.toJSON||!i.has("a",1)||i.has("a",2)||!i.has("a",void 0)||i.has("b"))||!r.size&&(u||!c)||!r.sort||"http://a/c%20d?a=1&c=3"!==t.href||"3"!==r.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!r[l]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==o||"x"!==new URL("http://x",void 0).host}))},function(t,r,i){"use strict";var o=i(83),a=Math.floor,sort=function(t,r){var i=t.length;if(i<8)for(var c,u,l=1;l<i;){for(u=l,c=t[l];u&&r(t[u-1],c)>0;)t[u]=t[--u];u!==l++&&(t[u]=c)}else for(var d=a(i/2),p=sort(o(t,0,d),r),h=sort(o(t,d),r),m=p.length,g=h.length,y=0,v=0;y<m||v<g;)t[y+v]=y<m&&v<g?r(p[y],h[v])<=0?p[y++]:h[v++]:y<m?p[y++]:h[v++];return t};t.exports=sort},function(t,r){},function(t,r){},function(t,r){},function(t,r,i){"use strict";var o=i(148),a=i(59),c=i(300),u=i(320),l=i(761),d=a(u());o(d,{getPolyfill:u,implementation:c,shim:l}),t.exports=d},function(t,r,i){"use strict";var o;if(!Object.keys){var a=Object.prototype.hasOwnProperty,c=Object.prototype.toString,u=i(299),l=Object.prototype.propertyIsEnumerable,d=!l.call({toString:null},"toString"),p=l.call((function(){}),"prototype"),h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],equalsConstructorPrototype=function(t){var r=t.constructor;return r&&r.prototype===t},m={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},g=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!m["$"+t]&&a.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{equalsConstructorPrototype(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();o=function keys(t){var r=null!==t&&"object"==typeof t,i="[object Function]"===c.call(t),o=u(t),l=r&&"[object String]"===c.call(t),m=[];if(!r&&!i&&!o)throw new TypeError("Object.keys called on a non-object");var y=p&&i;if(l&&t.length>0&&!a.call(t,0))for(var v=0;v<t.length;++v)m.push(String(v));if(o&&t.length>0)for(var b=0;b<t.length;++b)m.push(String(b));else for(var _ in t)y&&"prototype"===_||!a.call(t,_)||m.push(String(_));if(d)for(var w=function(t){if("undefined"==typeof window||!g)return equalsConstructorPrototype(t);try{return equalsConstructorPrototype(t)}catch(t){return!1}}(t),S=0;S<h.length;++S)w&&"constructor"===h[S]||!a.call(t,h[S])||m.push(h[S]);return m}}t.exports=o},function(t,r,i){"use strict";var o=i(3),a=i(255),c=i(149),u=i(72);t.exports=function Get(t,r){if("Object"!==u(t))throw new o("Assertion failed: Type(O) is not Object");if(!c(r))throw new o("Assertion failed: IsPropertyKey(P) is not true, got "+a(r));return t[r]}},function(t,r,i){"use strict";t.exports=function Type(t){return null===t?"Null":void 0===t?"Undefined":"function"==typeof t||"object"==typeof t?"Object":"number"==typeof t?"Number":"boolean"==typeof t?"Boolean":"string"==typeof t?"String":void 0}},function(t,r,i){"use strict";var o=i(6),a=i(41),c=i(3),u=o("%Uint8Array%",!0),l=i(24)("Array.prototype.slice"),d=i(150),p=i(91),h=i(700),m=i(92),g=i(115),y=i(707),v=i(151),b=i(305);t.exports=function GetValueFromBuffer(t,r,i,o,_){var w=g(t);if(!m(t)&&!w)throw new c("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if(!d(r))throw new c("Assertion failed: `byteIndex` must be an integer");if("string"!=typeof i||"number"!=typeof v.size["$"+i])throw new c("Assertion failed: `type` must be a Typed Array element type");if("boolean"!=typeof o)throw new c("Assertion failed: `isTypedArray` must be a boolean");if("SEQ-CST"!==_&&"UNORDERED"!==_)throw new c("Assertion failed: `order` must be either `SEQ-CST` or `UNORDERED`");if(arguments.length>5&&"boolean"!=typeof arguments[5])throw new c("Assertion failed: `isLittleEndian` must be a boolean, if present");if(p(t))throw new c("Assertion failed: `arrayBuffer` is detached");if(r<0)throw new c("Assertion failed: `byteIndex` must be non-negative");var S,I=v.size["$"+i];if(!I)throw new c('Assertion failed: `type` must be one of "INT8", "UINT8", "UINT8C", "INT16", "UINT16", "INT32", "UINT32", "BIGINT64", "BIGUINT64", "FLOAT32", or "FLOAT64"');if(w)throw new a("SharedArrayBuffer is not supported by this implementation");S=l(new u(t,r),0,I);var k=arguments.length>5?arguments[5]:"little"===b,x=k?l(y([0,0,0,0,0,0,0,0],S),-I):l(y(S,[0,0,0,0,0,0,0,0]),0,I);return h(i,x,k)}},function(t,r,i){"use strict";var o=i(6),a=i(24),c=i(177),u=i(41),l=i(3),d=o("%BigInt%",!0),p=i(302),h=i(201),m=i(304),g=i(701),y=i(702),v=i(703),b=i(704),_=i(705),w=i(706),S=a("Array.prototype.reverse"),I=a("Array.prototype.slice"),k=i(200),x={__proto__:null,INT8:1,UINT8:1,UINT8C:1,INT16:2,UINT16:2,INT32:4,UINT32:4,BIGINT64:8,BIGUINT64:8,FLOAT32:4,FLOAT64:8};t.exports=function RawBytesToNumeric(t,r,i){if(!p(x,t))throw new l("Assertion failed: `type` must be a TypedArray element type: "+k(x));if(!h(r)||!_(r,w))throw new l("Assertion failed: `rawBytes` must be an Array of bytes");if("boolean"!=typeof i)throw new l("Assertion failed: `isLittleEndian` must be a Boolean");var o=x[t];if(r.length!==o)throw new c("Assertion failed: `rawBytes` must have a length of "+o+" for type "+t);var a=m(t);if(a&&!d)throw new u("this environment does not support BigInts");return r=I(r,0,o),i||S(r),"FLOAT32"===t?y(r):"FLOAT64"===t?v(r):b(r,o,g(t),a)}},function(t,r,i){"use strict";t.exports=function IsUnsignedElementType(t){return"UINT8"===t||"UINT8C"===t||"UINT16"===t||"UINT32"===t||"BIGUINT64"===t}},function(t,r,i){"use strict";var o=i(6)("%Math.pow%");t.exports=function bytesAsFloat32(t){var r=128&t[3]?-1:1,i=(127&t[3])<<1|t[2]>>7,a=(127&t[2])<<16|t[1]<<8|t[0];return 0===i&&0===a?1===r?0:-0:255===i&&0===a?1===r?1/0:-1/0:255===i&&0!==a?NaN:-127===(i-=127)?r*a*o(2,-149):r*(1+a*o(2,-23))*o(2,i)}},function(t,r,i){"use strict";var o=i(6)("%Math.pow%");t.exports=function bytesAsFloat64(t){var r=128&t[7]?-1:1,i=(127&t[7])<<4|(240&t[6])>>4,a=281474976710656*(15&t[6])+1099511627776*t[5]+4294967296*t[4]+16777216*t[3]+65536*t[2]+256*t[1]+t[0];return 0===i&&0===a?0*r:2047===i&&0!==a?NaN:2047===i&&0===a?r*(1/0):-1023===(i-=1023)?r*a*5e-324:r*(1+a/4503599627370496)*o(2,i)}},function(t,r,i){"use strict";var o=i(6),a=o("%Math.pow%"),c=o("%Number%"),u=o("%BigInt%",!0);t.exports=function bytesAsInteger(t,r,i,o){for(var l=o?u:c,d=l(0),p=0;p<t.length;p++)d+=l(t[p]*a(2,8*p));if(!i){var h=8*r;128&t[r-1]&&(d-=l(a(2,h)))}return d}},function(t,r,i){"use strict";t.exports=function every(t,r){for(var i=0;i<t.length;i+=1)if(!r(t[i],i,t))return!1;return!0}},function(t,r,i){"use strict";t.exports=function isByteValue(t){return"number"==typeof t&&t>=0&&t<=255&&(0|t)===t}},function(t,r,i){"use strict";var o=i(6)("%Array.prototype.concat%"),a=i(59),c=i(24)("Array.prototype.slice"),u=i(178)()&&Symbol.isConcatSpreadable,l=[],d=u?a.apply(o,l):null,p=u?i(708):null;t.exports=u?function safeArrayConcat(t){for(var r=0;r<arguments.length;r+=1){var i=arguments[r];if(i&&"object"==typeof i&&"boolean"==typeof i[u]){l[u]||(l[u]=!0);var o=p(i)?c(i):[i];o[u]=!0,arguments[r]=o}}return d(arguments)}:a(o,l)},function(t,r){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,r,i){"use strict";var o=i(6);t.exports=o("%Math.max%")},function(t,r,i){"use strict";var o=i(6);t.exports=o("%Math.min%")},function(t,r,i){"use strict";var o=i(3),a=i(149),c=i(306),u=i(72),l=function(){try{return delete[].length,!0}catch(t){return!1}}();t.exports=function Set(t,r,i,d){if("Object"!==u(t))throw new o("Assertion failed: `O` must be an Object");if(!a(r))throw new o("Assertion failed: `P` must be a Property Key");if("boolean"!=typeof d)throw new o("Assertion failed: `Throw` must be a Boolean");if(d){if(t[r]=i,l&&!c(t[r],i))throw new o("Attempted to assign to readonly property.");return!0}try{return t[r]=i,!l||c(t[r],i)}catch(t){return!1}}},function(t,r,i){"use strict";var o=i(6),a=i(41),c=i(3),u=o("%Uint8Array%",!0),l=i(150),d=i(304),p=i(91),h=i(713),m=i(92),g=i(115),y=i(69),v=i(151),b=i(305),_=i(741);t.exports=function SetValueInBuffer(t,r,i,o,w,S){var I=g(t);if(!m(t)&&!I)throw new c("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if(!l(r)||r<0)throw new c("Assertion failed: `byteIndex` must be a non-negative integer");if("string"!=typeof i||!y(v.size,"$"+i))throw new c("Assertion failed: `type` must be a Typed Array Element Type");if("number"!=typeof o&&"bigint"!=typeof o)throw new c("Assertion failed: `value` must be a Number or a BigInt");if("boolean"!=typeof w)throw new c("Assertion failed: `isTypedArray` must be a boolean");if("SEQ-CST"!==S&&"UNORDERED"!==S&&"INIT"!==S)throw new c('Assertion failed: `order` must be `"SEQ-CST"`, `"UNORDERED"`, or `"INIT"`');if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new c("Assertion failed: `isLittleEndian` must be a boolean, if present");if(p(t))throw new c("Assertion failed: ArrayBuffer is detached");if(d(i)?"bigint"!=typeof o:"number"!=typeof o)throw new c("Assertion failed: `value` must be a BigInt if type is ~BIGINT64~ or ~BIGUINT64~, otherwise a Number");var k=v.size["$"+i],x=arguments.length>6?arguments[6]:"little"===b,P=h(i,o,x);if(I)throw new a("SharedArrayBuffer is not supported by this implementation");var C=new u(t,r,k);_(P,(function(t,r){C[r]=t}))}},function(t,r,i){"use strict";var o=i(3),a=i(302),c=i(714),u=i(720),l=i(721),d=i(729),p=i(730),h=i(731),m=i(732),g=i(733),y=i(734),v=i(736),b=i(737),_=i(740),w=i(200),S={__proto__:null,INT8:1,UINT8:1,UINT8C:1,INT16:2,UINT16:2,INT32:4,UINT32:4,BIGINT64:8,BIGUINT64:8,FLOAT32:4,FLOAT64:8},I={__proto__:null,INT8:p,UINT8:g,UINT8C:y,INT16:l,UINT16:h,INT32:d,UINT32:m,BIGINT64:c,BIGUINT64:u};t.exports=function NumericToRawBytes(t,r,i){if("string"!=typeof t||!a(S,t))throw new o("Assertion failed: `type` must be a TypedArray element type: "+w(S));if("number"!=typeof r&&"bigint"!=typeof r)throw new o("Assertion failed: `value` must be a Number or a BigInt");if("boolean"!=typeof i)throw new o("Assertion failed: `isLittleEndian` must be a Boolean");if("FLOAT32"===t)return v(r,i);if("FLOAT64"===t)return b(r,i);var c=S[t],u=(0,I[t])(r);return _(u,c,i)}},function(t,r,i){"use strict";var o=i(6),a=o("%BigInt%",!0),c=o("%Math.pow%"),u=i(307),l=i(309),d=i(310),p=a&&BigInt(c(2,32))*BigInt(c(2,31)),h=a&&BigInt(c(2,32))*BigInt(c(2,32));t.exports=function ToBigInt64(t){var r=u(t),i=d(l,r,h);return i>=p?i-h:i}},function(t,r,i){"use strict";var o=i(6)("%BigInt%",!0),a=i(3),c=i(41);t.exports=function StringToBigInt(t){if("string"!=typeof t)throw new a("`argument` must be a string");if(!o)throw new c("BigInts are not supported in this environment");try{return o(t)}catch(t){return}}},function(t,r,i){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,a=i(717),c=i(198),u=i(718),l=i(719),d=function OrdinaryToPrimitive(t,r){if(null==t)throw new TypeError("Cannot call method on "+t);if("string"!=typeof r||"number"!==r&&"string"!==r)throw new TypeError('hint must be "string" or "number"');var i,o,u,l="string"===r?["toString","valueOf"]:["valueOf","toString"];for(u=0;u<l.length;++u)if(i=t[l[u]],c(i)&&(o=i.call(t),a(o)))return o;throw new TypeError("No default value")},p=function GetMethod(t,r){var i=t[r];if(null!=i){if(!c(i))throw new TypeError(i+" returned for property "+r+" of object "+t+" is not a function");return i}};t.exports=function ToPrimitive(t){if(a(t))return t;var r,i="default";if(arguments.length>1&&(arguments[1]===String?i="string":arguments[1]===Number&&(i="number")),o&&(Symbol.toPrimitive?r=p(t,Symbol.toPrimitive):l(t)&&(r=Symbol.prototype.valueOf)),void 0!==r){var c=r.call(t,i);if(a(c))return c;throw new TypeError("unable to convert exotic object to primitive")}return"default"===i&&(u(t)||l(t))&&(i="string"),d(t,"default"===i?"number":i)}},function(t,r,i){"use strict";t.exports=function isPrimitive(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},function(t,r,i){"use strict";var o=Date.prototype.getDay,a=Object.prototype.toString,c=i(199)();t.exports=function isDateObject(t){return"object"==typeof t&&null!==t&&(c?function tryDateGetDayCall(t){try{return o.call(t),!0}catch(t){return!1}}(t):"[object Date]"===a.call(t))}},function(t,r,i){"use strict";var o=Object.prototype.toString;if(i(253)()){var a=Symbol.prototype.toString,c=/^Symbol\(.*\)$/;t.exports=function isSymbol(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==o.call(t))return!1;try{return function isRealSymbolObject(t){return"symbol"==typeof t.valueOf()&&c.test(a.call(t))}(t)}catch(t){return!1}}}else t.exports=function isSymbol(t){return!1}},function(t,r,i){"use strict";var o=i(6),a=o("%BigInt%",!0),c=o("%Math.pow%"),u=i(307),l=i(309),d=i(310),p=a&&BigInt(c(2,32))*BigInt(c(2,32));t.exports=function ToBigUint64(t){var r=u(t);return d(l,r,p)}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToInt16(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,65536);return l>=32768?l-65536:l}},function(t,r,i){"use strict";var o=Math.floor;t.exports=function mod(t,r){var i=t%r;return o(i>=0?i:i+r)}},function(t,r,i){"use strict";t.exports=function isPrimitive(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},function(t,r,i){"use strict";var o=i(6),a=o("%Number%"),c=o("%RegExp%"),u=i(3),l=o("%parseInt%"),d=i(24),p=i(725),h=d("String.prototype.slice"),m=p(/^0b[01]+$/i),g=p(/^0o[0-7]+$/i),y=p(/^[-+]0x[0-9a-f]+$/i),v=p(new c("["+["
","",""].join("")+"]","g")),b=i(727);t.exports=function StringToNumber(t){if("string"!=typeof t)throw new u("Assertion failed: `argument` is not a String");if(m(t))return a(l(h(t,2),2));if(g(t))return a(l(h(t,2),8));if(v(t)||y(t))return NaN;var r=b(t);return r!==t?StringToNumber(r):a(t)}},function(t,r,i){"use strict";var o=i(24),a=i(726),c=o("RegExp.prototype.exec"),u=i(3);t.exports=function regexTester(t){if(!a(t))throw new u("`regex` must be a RegExp");return function test(r){return null!==c(t,r)}}},function(t,r,i){"use strict";var o,a,c,u,l=i(24),d=i(199)();if(d){o=l("Object.prototype.hasOwnProperty"),a=l("RegExp.prototype.exec"),c={};var throwRegexMarker=function(){throw c};u={toString:throwRegexMarker,valueOf:throwRegexMarker},"symbol"==typeof Symbol.toPrimitive&&(u[Symbol.toPrimitive]=throwRegexMarker)}var p=l("Object.prototype.toString"),h=Object.getOwnPropertyDescriptor;t.exports=d?function isRegex(t){if(!t||"object"!=typeof t)return!1;var r=h(t,"lastIndex");if(!(r&&o(r,"value")))return!1;try{a(t,u)}catch(t){return t===c}}:function isRegex(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===p(t)}},function(t,r,i){"use strict";var o=i(59),a=i(148),c=i(311),u=i(312),l=i(314),d=i(728),p=o(l()),h=function trim(t){return c(t),p(t)};a(h,{getPolyfill:l,implementation:u,shim:d}),t.exports=h},function(t,r,i){"use strict";var o=i(148),a=i(314);t.exports=function shimStringTrim(){var t=a();return o(String.prototype,{trim:t},{trim:function testTrim(){return String.prototype.trim!==t}}),t}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToInt32(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,4294967296),d=l>=2147483648?l-4294967296:l;return 0===d?0:d}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToInt8(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,256);return l>=128?l-256:l}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToUint16(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,65536);return 0===l?0:l}},function(t,r,i){"use strict";var o=i(94),a=i(60),c=i(73),u=i(51);t.exports=function ToUint32(t){var r=a(t);if(!u(r)||0===r)return 0;var i=c(r),l=o(i,4294967296);return 0===l?0:l}},function(t,r,i){"use strict";var o=i(51),a=i(94),c=i(60),u=i(73);t.exports=function ToUint8(t){var r=c(t);if(!o(r)||0===r)return 0;var i=u(r);return a(i,256)}},function(t,r,i){"use strict";var o=i(735),a=i(60),c=i(202),u=i(90);t.exports=function ToUint8Clamp(t){var r=a(t);if(u(r))return 0;var i=o(r,0,255),l=c(i);return i<l+.5?l:i>l+.5?l+1:l%2==0?l:l+1}},function(t,r,i){"use strict";var o=i(6),a=i(3),c=o("%Math.max%"),u=o("%Math.min%");t.exports=function clamp(t,r,i){if("number"!=typeof t||"number"!=typeof r||"number"!=typeof i||!(r<=i))throw new a("Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`");return u(c(r,t),i)}},function(t,r,i){"use strict";var o=i(6),a=o("%Math.abs%"),c=o("%Math.floor%"),u=o("%Math.pow%"),l=i(51),d=i(90),p=i(315);t.exports=function valueToFloat32Bytes(t,r){if(d(t))return r?[0,0,192,127]:[127,192,0,0];var i;if(0===t)return i=p(t)?128:0,r?[0,0,0,i]:[i,0,0,0];if(a(t)>34028234663852886e22||!l(t))return i=t<0?255:127,r?[0,0,128,i]:[i,128,0,0];var o=t<0?1:0;t=a(t);for(var h=0;t>=2;)h+=1,t/=2;for(;t<1;)h-=1,t*=2;var m=t-1;m*=u(2,23)+.5,h+=127;var g=o<<31|(h<<=23)|(m=c(m)),y=255&g,v=255&(g>>=8),b=255&(g>>=8),_=255&(g>>=8);return r?[y,v,b,_]:[_,b,v,y]}},function(t,r,i){"use strict";var o=i(6),a=o("%parseInt%"),c=o("%Math.abs%"),u=o("%Math.floor%"),l=i(24),d=l("String.prototype.indexOf"),p=l("String.prototype.slice"),h=i(738),m=i(739),g=i(315),y="000000000000000000000000000000000000000000000000000";t.exports=function valueToFloat64Bytes(t,r){var i,o,l=t<0||g(t)?"1":"0";if(isNaN(t))i="11111111111",o="1"+y;else if(isFinite(t))if(0===t)i="00000000000",o="0"+y;else{t=c(t);var v,b=u(t),_=m(b),w=h(t-b);if(_)i=_.length-1;else{var S=d(w,"1");S>-1&&(v=S+1),i=-v}o=_+w,i<0?(i<=-1023&&(v=1022),o=p(o,v)):o=p(o,1),i=p("00000000000"+m(i+1023),-11),o=p(o+y+"0",0,52)}else i="11111111111",o="0"+y;for(var I=l+i+o,k=[],x=0;x<8;x++){k[r?8-x-1:x]=a(p(I,8*x,8*(x+1)),2)}return k}},function(t,r,i){"use strict";t.exports=function fractionToBitString(t){var r="";if(0===t)return r;for(var i,o=1075,a=0;a<1075;a+=1)if((i=2*t)>=1?(t=i-1,r+="1",1075===o&&(o=a)):(t=i,r+="0"),1===i||a-o>54)return r;return r}},function(t,r,i){"use strict";var o=i(6)("%Math.floor%");t.exports=function intToBinaryString(t){for(var r,i="";t>0;)i=(r=t/2)===(t=o(r))?"0"+i:"1"+i;return i}},function(t,r,i){"use strict";var o=i(6),a=o("%Number%"),c=o("%BigInt%",!0);t.exports=function integerToNBytes(t,r,i){var o="bigint"==typeof t?c:a;t<0&&(t>>>=0);for(var u=[],l=0;l<r;l++)u[i?l:r-1-l]=a(t&o(255)),t>>=o(8);return u}},function(t,r,i){"use strict";t.exports=function forEach(t,r){for(var i=0;i<t.length;i+=1)r(t[i],i,t)}},function(t,r,i){"use strict";var o=i(60),a=i(73),c=i(90),u=i(51);t.exports=function ToIntegerOrInfinity(t){var r=o(t);return c(r)||0===r?0:u(r)?a(r):r}},function(t,r,i){"use strict";var o=i(41),a=i(3),c=i(113),u=i(151);t.exports=function TypedArrayElementType(t){var r=c(t);if(!1===r)throw new a("Assertion failed: `O` must be a TypedArray");var i=u.name["$"+r];if("string"!=typeof i)throw new o("Assertion failed: Unknown TypedArray type `"+r+"`");return i}},function(t,r,i){"use strict";var o=i(41),a=i(3),c=i(113),u=i(114)(),l=i(201),d=i(745),p=i(755),h=i(760);t.exports=function TypedArraySpeciesCreate(t,r){if(0===u.length)throw new o("Assertion failed: Typed Arrays are not supported in this environment");var i=c(t);if(!i)throw new a("Assertion failed: exemplar must be a TypedArray");if(!l(r))throw new a("Assertion failed: `argumentList` must be a List");var m=h(i);if("function"!=typeof m)throw new o("Assertion failed: `constructor` of `exemplar` ("+i+") must exist. Please report this!");var g=d(t,m);return p(g,r)}},function(t,r,i){"use strict";var o=i(6)("%Symbol.species%",!0),a=i(3),c=i(316),u=i(72);t.exports=function SpeciesConstructor(t,r){if("Object"!==u(t))throw new a("Assertion failed: Type(O) is not Object");var i=t.constructor;if(void 0===i)return r;if("Object"!==u(i))throw new a("O.constructor is not an Object");var l=o?i[o]:void 0;if(null==l)return r;if(c(l))return l;throw new a("no constructor found")}},function(t,r,i){"use strict";t.exports=i(6)},function(t,r,i){"use strict";var o=i(3),a=i(204),c=i(748),u=i(749),l=i(751),d=i(149),p=i(306),h=i(752),m=i(72);t.exports=function DefinePropertyOrThrow(t,r,i){if("Object"!==m(t))throw new o("Assertion failed: Type(O) is not Object");if(!d(r))throw new o("Assertion failed: IsPropertyKey(P) is not true");var g=a(i)?i:h(i);if(!a(g))throw new o("Assertion failed: Desc is not a valid Property Descriptor");return c(l,p,u,t,r,g)}},function(t,r,i){"use strict";var o=i(180),a=i(138),c=o.hasArrayLengthDefineBug(),u=c&&i(303),l=i(24)("Object.prototype.propertyIsEnumerable");t.exports=function DefineOwnProperty(t,r,i,o,d,p){if(!a){if(!t(p))return!1;if(!p["[[Configurable]]"]||!p["[[Writable]]"])return!1;if(d in o&&l(o,d)!==!!p["[[Enumerable]]"])return!1;var h=p["[[Value]]"];return o[d]=h,r(o[d],h)}return c&&"length"===d&&"[[Value]]"in p&&u(o)&&o.length!==p["[[Value]]"]?(o.length=p["[[Value]]"],o.length===p["[[Value]]"]):(a(o,d,i(p)),!0)}},function(t,r,i){"use strict";var o=i(3),a=i(204),c=i(750);t.exports=function FromPropertyDescriptor(t){if(void 0!==t&&!a(t))throw new o("Assertion failed: `Desc` must be a Property Descriptor");return c(t)}},function(t,r,i){"use strict";t.exports=function fromPropertyDescriptor(t){if(void 0===t)return t;var r={};return"[[Value]]"in t&&(r.value=t["[[Value]]"]),"[[Writable]]"in t&&(r.writable=!!t["[[Writable]]"]),"[[Get]]"in t&&(r.get=t["[[Get]]"]),"[[Set]]"in t&&(r.set=t["[[Set]]"]),"[[Enumerable]]"in t&&(r.enumerable=!!t["[[Enumerable]]"]),"[[Configurable]]"in t&&(r.configurable=!!t["[[Configurable]]"]),r}},function(t,r,i){"use strict";var o=i(3),a=i(69),c=i(204);t.exports=function IsDataDescriptor(t){if(void 0===t)return!1;if(!c(t))throw new o("Assertion failed: `Desc` must be a Property Descriptor");return!(!a(t,"[[Value]]")&&!a(t,"[[Writable]]"))}},function(t,r,i){"use strict";var o=i(69),a=i(3),c=i(72),u=i(753),l=i(754);t.exports=function ToPropertyDescriptor(t){if("Object"!==c(t))throw new a("ToPropertyDescriptor requires an object");var r={};if(o(t,"enumerable")&&(r["[[Enumerable]]"]=u(t.enumerable)),o(t,"configurable")&&(r["[[Configurable]]"]=u(t.configurable)),o(t,"value")&&(r["[[Value]]"]=t.value),o(t,"writable")&&(r["[[Writable]]"]=u(t.writable)),o(t,"get")){var i=t.get;if(void 0!==i&&!l(i))throw new a("getter must be a function");r["[[Get]]"]=i}if(o(t,"set")){var d=t.set;if(void 0!==d&&!l(d))throw new a("setter must be a function");r["[[Set]]"]=d}if((o(r,"[[Get]]")||o(r,"[[Set]]"))&&(o(r,"[[Value]]")||o(r,"[[Writable]]")))throw new a("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return r}},function(t,r,i){"use strict";t.exports=function ToBoolean(t){return!!t}},function(t,r,i){"use strict";t.exports=i(198)},function(t,r,i){"use strict";var o=i(41),a=i(3),c=i(201),u=i(316),l=i(205),d=i(756),p=i(319),h=i(114)();t.exports=function TypedArrayCreateFromConstructor(t,r){if(!u(t))throw new a("Assertion failed: `constructor` must be a constructor");if(!c(r))throw new a("Assertion failed: `argumentList` must be a List");if(0===h.length)throw new o("Assertion failed: Typed Arrays are not supported in this environment");var i;i=0===r.length?new t:1===r.length?new t(r[0]):2===r.length?new t(r[0],r[1]):new t(r[0],r[1],r[2]);var m=p(i,"SEQ-CST");if(1===r.length&&"number"==typeof r[0]){if(l(m))throw new a("new Typed Array is out of bounds");if(d(m)<r[0])throw new a("`argumentList[0]` must be <= `newTypedArray.length`")}return i}},function(t,r,i){"use strict";var o=i(3),a=i(202),c=i(757),u=i(205),l=i(203),d=i(317),p=i(116),h=i(206),m=i(318);t.exports=function TypedArrayLength(t){if(!d(t))throw new o("Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record");if(u(t))throw new o("Assertion failed: `taRecord` is out of bounds");var r=t["[[Object]]"],i=m(r);if("AUTO"!==i)return i;if(c(p(r)))throw new o("Assertion failed: array buffer is not fixed length");var g=h(r),y=l(r),v=t["[[CachedBufferByteLength]]"];if("DETACHED"===v)throw new o("Assertion failed: typed array is detached");return a((v-g)/y)}},function(t,r,i){"use strict";var o=i(3),a=i(24),c=a("%ArrayBuffer.prototype.resizable%",!0),u=a("%SharedArrayBuffer.prototype.growable%",!0),l=i(92),d=i(115);t.exports=function IsFixedLengthArrayBuffer(t){var r=l(t),i=d(t);if(!r&&!i)throw new o("Assertion failed: `arrayBuffer` must be an ArrayBuffer or SharedArrayBuffer");return r&&c?!c(t):!i||!u||!u(t)}},function(t,r,i){"use strict";var o=i(3),a=i(759),c=i(91),u=i(93),l=i(116);t.exports=function MakeTypedArrayWithBufferWitnessRecord(t,r){if(!u(t))throw new o("Assertion failed: `obj` must be a Typed Array");if("SEQ-CST"!==r&&"UNORDERED"!==r)throw new o("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");var i=l(t);return{"[[Object]]":t,"[[CachedBufferByteLength]]":c(i)?"DETACHED":a(i,r)}}},function(t,r,i){"use strict";var o=i(3),a=i(91),c=i(92),u=i(115),l=i(301);t.exports=function ArrayBufferByteLength(t,r){var i=u(t);if(!c(t)&&!i)throw new o("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if("SEQ-CST"!==r&&"UNORDERED"!==r)throw new o("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");if(a(t))throw new o("Assertion failed: `arrayBuffer` must not be detached");return l(t)}},function(t,r,i){"use strict";var o=i(6),a={__proto__:null,$Int8Array:o("%Int8Array%",!0),$Uint8Array:o("%Uint8Array%",!0),$Uint8ClampedArray:o("%Uint8ClampedArray%",!0),$Int16Array:o("%Int16Array%",!0),$Uint16Array:o("%Uint16Array%",!0),$Int32Array:o("%Int32Array%",!0),$Uint32Array:o("%Uint32Array%",!0),$BigInt64Array:o("%BigInt64Array%",!0),$BigUint64Array:o("%BigUint64Array%",!0),$Float32Array:o("%Float32Array%",!0),$Float64Array:o("%Float64Array%",!0)};t.exports=function getConstructor(t){return a["$"+t]}},function(t,r,i){"use strict";var o=i(148),a=i(762),c=i(320);t.exports=function shimTypedArraySlice(){if("function"==typeof Uint8Array){var t=c(),r=a(Uint8Array.prototype);o(r,{slice:t},{slice:function(){return r.slice!==t}})}return t}},function(t,r,i){"use strict";var o=i(6)("%Object.getPrototypeOf%",!0),a=i(137)();t.exports=o||(a?function(t){return t.__proto__}:null)},function(t,r,i){var o=i(764),a=i(772);t.exports=function baseGet(t,r){for(var i=0,c=(r=o(r,t)).length;null!=t&&i<c;)t=t[a(r[i++])];return i&&i==c?t:void 0}},function(t,r,i){var o=i(89),a=i(765),c=i(766),u=i(769);t.exports=function castPath(t,r){return o(t)?t:a(t,r)?[t]:c(u(t))}},function(t,r,i){var o=i(89),a=i(207),c=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;t.exports=function isKey(t,r){if(o(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!a(t))||(u.test(t)||!c.test(t)||null!=r&&t in Object(r))}},function(t,r,i){var o=i(767),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c=/\\(\\)?/g,u=o((function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(a,(function(t,i,o,a){r.push(o?a.replace(c,"$1"):i||t)})),r}));t.exports=u},function(t,r,i){var o=i(768);t.exports=function memoizeCapped(t){var r=o(t,(function(t){return 500===i.size&&i.clear(),t})),i=r.cache;return r}},function(t,r,i){var o=i(284);function memoize(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var memoized=function(){var i=arguments,o=r?r.apply(this,i):i[0],a=memoized.cache;if(a.has(o))return a.get(o);var c=t.apply(this,i);return memoized.cache=a.set(o,c)||a,c};return memoized.cache=new(memoize.Cache||o),memoized}memoize.Cache=o,t.exports=memoize},function(t,r,i){var o=i(770);t.exports=function toString(t){return null==t?"":o(t)}},function(t,r,i){var o=i(144),a=i(771),c=i(89),u=i(207),l=o?o.prototype:void 0,d=l?l.toString:void 0;t.exports=function baseToString(t){if("string"==typeof t)return t;if(c(t))return a(t,baseToString)+"";if(u(t))return d?d.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},function(t,r){t.exports=function arrayMap(t,r){for(var i=-1,o=null==t?0:t.length,a=Array(o);++i<o;)a[i]=r(t[i],i,t);return a}},function(t,r,i){var o=i(207);t.exports=function toKey(t){if("string"==typeof t||o(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},function(t,r,i){"use strict";var o=i(774);t.exports=o},function(t,r,i){"use strict";var o=i(775);t.exports=o},function(t,r,i){"use strict";var o=i(776);t.exports=o},function(t,r,i){"use strict";var o=i(23),a=i(777),c=Array.prototype;t.exports=function(t){var r=t.indexOf;return t===c||o(c,t)&&r===c.indexOf?a:r}},function(t,r,i){"use strict";i(778);var o=i(29);t.exports=o("Array","indexOf")},function(t,r,i){"use strict";var o=i(1),a=i(122),c=i(165).indexOf,u=i(239),l=a([].indexOf),d=!!l&&1/l([1],1,-0)<0;o({target:"Array",proto:!0,forced:d||!u("indexOf")},{indexOf:function indexOf(t){var r=arguments.length>1?arguments[1]:void 0;return d?l(this,t,r)||0:c(this,t,r)}})},function(t,r,i){var o=i(321);t.exports=function _objectWithoutPropertiesLoose(t,r){if(null==t)return{};var i={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(o(r).call(r,a)>=0)continue;i[a]=t[a]}return i},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,r){t.exports=function isBuffer(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,r){"function"==typeof Object.create?t.exports=function inherits(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function inherits(t,r){t.super_=r;var TempCtor=function(){};TempCtor.prototype=r.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}},function(t,r,i){"use strict";(function(r){var o=i(783),a=i(322),c=i(34),u=i(210),l=i(75)("mqttjs"),d={};function connect(t,r){if(l("connecting to an MQTT broker..."),"object"!=typeof t||r||(r=t,t=null),r=r||{},t){var i=c.parse(t,!0);if(null!=i.port&&(i.port=Number(i.port)),null===(r=u(i,r)).protocol)throw new Error("Missing protocol");r.protocol=r.protocol.replace(/:$/,"")}if(function parseAuthOptions(t){var r;t.auth&&((r=t.auth.match(/^(.+):(.+)$/))?(t.username=r[1],t.password=r[2]):t.username=t.auth)}(r),r.query&&"string"==typeof r.query.clientId&&(r.clientId=r.query.clientId),r.cert&&r.key){if(!r.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(r.protocol))switch(r.protocol){case"mqtt":r.protocol="mqtts";break;case"ws":r.protocol="wss";break;case"wx":r.protocol="wxs";break;case"ali":r.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+r.protocol+'"!')}}if(!d[r.protocol]){var a=-1!==["mqtts","wss"].indexOf(r.protocol);r.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(t,r){return(!a||r%2!=0)&&"function"==typeof d[t]}))[0]}if(!1===r.clean&&!r.clientId)throw new Error("Missing clientId for unclean clients");r.protocol&&(r.defaultProtocol=r.protocol);var p=new o((function wrapper(t){return r.servers&&(t._reconnectCount&&t._reconnectCount!==r.servers.length||(t._reconnectCount=0),r.host=r.servers[t._reconnectCount].host,r.port=r.servers[t._reconnectCount].port,r.protocol=r.servers[t._reconnectCount].protocol?r.servers[t._reconnectCount].protocol:r.defaultProtocol,r.hostname=r.host,t._reconnectCount++),l("calling streambuilder for",r.protocol),d[r.protocol](t,r)}),r);return p.on("error",(function(){})),p}void 0!==r&&"browser"!==r.title||"function"!=typeof i?(d.mqtt=i(332),d.tcp=i(332),d.ssl=i(212),d.tls=i(212),d.mqtts=i(212)):(d.wx=i(333),d.wxs=i(333),d.ali=i(336),d.alis=i(336)),d.ws=i(337),d.wss=i(337),t.exports=connect,t.exports.connect=connect,t.exports.MqttClient=o,t.exports.Store=a}).call(this,i(19))},function(t,r,i){"use strict";(function(r,o){var a=i(45).EventEmitter,c=i(322),u=i(792),l=i(74).Writable,d=i(30),p=i(801),h=i(802),m=i(210),g=i(75)("mqttjs:client"),y=r?r.nextTick:function(t){setTimeout(t,0)},v=o.setImmediate||function(t){y(t)},b={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},_=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],w={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function sendPacket(t,r,i){g("sendPacket :: packet: %O",r),g("sendPacket :: emitting `packetsend`"),t.emit("packetsend",r),g("sendPacket :: writing to stream");var o=u.writeToStream(r,t.stream,t.options);g("sendPacket :: writeToStream result %s",o),!o&&i?(g("sendPacket :: handle events on `drain` once through callback."),t.stream.once("drain",i)):i&&(g("sendPacket :: invoking cb"),i())}function flush(t){t&&(g("flush: queue exists? %b",!!t),Object.keys(t).forEach((function(r){"function"==typeof t[r].cb&&(t[r].cb(new Error("Connection closed")),delete t[r])})))}function storeAndSend(t,r,i,o){g("storeAndSend :: store packet with cmd %s to outgoingStore",r.cmd),t.outgoingStore.put(r,(function storedPacket(a){if(a)return i&&i(a);o(),sendPacket(t,r,i)}))}function nop(t){g("nop ::",t)}function MqttClient(t,r){var i,o=this;if(!(this instanceof MqttClient))return new MqttClient(t,r);for(i in this.options=r||{},b)void 0===this.options[i]?this.options[i]=b[i]:this.options[i]=r[i];g("MqttClient :: options.protocol",r.protocol),g("MqttClient :: options.protocolVersion",r.protocolVersion),g("MqttClient :: options.username",r.username),g("MqttClient :: options.keepalive",r.keepalive),g("MqttClient :: options.reconnectPeriod",r.reconnectPeriod),g("MqttClient :: options.rejectUnauthorized",r.rejectUnauthorized),this.options.clientId="string"==typeof r.clientId?r.clientId:function defaultId(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}(),g("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===r.protocolVersion&&r.customHandleAcks?r.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=t,this.outgoingStore=r.outgoingStore||new c,this.incomingStore=r.incomingStore||new c,this.queueQoSZero=void 0===r.queueQoSZero||r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this._firstConnection=!0,this.on("connect",(function(){var t=this.queue;g("connect :: sending queued packets"),function deliver(){var r,i=t.shift();g("deliver :: entry %o",i),i&&(r=i.packet,g("deliver :: call _sendPacket for %o",r),o._sendPacket(r,(function(t){i.cb&&i.cb(t),deliver()})))}()})),this.on("close",(function(){g("close :: connected set to `false`"),this.connected=!1,g("close :: clearing connackTimer"),clearTimeout(this.connackTimer),g("close :: clearing ping timer"),null!==o.pingTimer&&(o.pingTimer.clear(),o.pingTimer=null),g("close :: calling _setupReconnect"),this._setupReconnect()})),a.call(this),g("MqttClient :: setting up stream"),this._setupStream()}d(MqttClient,a),MqttClient.prototype._setupStream=function(){var t,r=this,i=new l,o=u.parser(this.options),a=null,c=[];function nextTickWork(){if(c.length)y(work);else{var t=a;a=null,t()}}function work(){g("work :: getting next packet in queue");var t=c.shift();if(t)g("work :: packet pulled from queue"),r._handlePacket(t,nextTickWork);else{g("work :: no packets in queue");var i=a;a=null,g("work :: done flag is %s",!!i),i&&i()}}if(g("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),g("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),o.on("packet",(function(t){g("parser :: on packet push to packets array."),c.push(t)})),i._write=function(t,r,i){a=i,g("writable stream :: parsing buffer"),o.parse(t),work()},g("_setupStream :: pipe stream to writable stream"),this.stream.pipe(i),this.stream.on("error",(function streamErrorHandler(t){g("streamErrorHandler :: error",t.message),_.includes(t.code)?(g("streamErrorHandler :: emitting error"),r.emit("error",t)):nop(t)})),this.stream.on("close",(function(){g("(%s)stream :: on close",r.options.clientId),function flushVolatile(t){t&&(g("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(t).forEach((function(r){t[r].volatile&&"function"==typeof t[r].cb&&(t[r].cb(new Error("Connection closed")),delete t[r])})))}(r.outgoing),g("stream: emit close to MqttClient"),r.emit("close")})),g("_setupStream: sending packet `connect`"),(t=Object.create(this.options)).cmd="connect",sendPacket(this,t),o.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return r.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket)sendPacket(this,m({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){g("!!connectTimeout hit!! Calling _cleanUp with force `true`"),r._cleanUp(!0)}),this.options.connectTimeout)},MqttClient.prototype._handlePacket=function(t,r){var i=this.options;if(5===i.protocolVersion&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize<t.length)return this.emit("error",new Error("exceeding packets size "+t.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(g("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",t),t.cmd){case"publish":this._handlePublish(t,r);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(t),r();break;case"pubrel":this._handlePubrel(t,r);break;case"connack":this._handleConnack(t),r();break;case"pingresp":this._handlePingresp(t),r();break;case"disconnect":this._handleDisconnect(t),r()}},MqttClient.prototype._checkDisconnecting=function(t){return this.disconnecting&&(t?t(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},MqttClient.prototype.publish=function(t,r,i,o){var a;g("publish :: message `%s` to topic `%s`",r,t);var c=this.options;"function"==typeof i&&(o=i,i=null);if(i=m({qos:0,retain:!1,dup:!1},i),this._checkDisconnecting(o))return this;switch(a={cmd:"publish",topic:t,payload:r,qos:i.qos,retain:i.retain,messageId:this._nextId(),dup:i.dup},5===c.protocolVersion&&(a.properties=i.properties,(!c.properties&&a.properties&&a.properties.topicAlias||i.properties&&c.properties&&(i.properties.topicAlias&&c.properties.topicAliasMaximum&&i.properties.topicAlias>c.properties.topicAliasMaximum||!c.properties.topicAliasMaximum&&i.properties.topicAlias))&&delete a.properties.topicAlias),g("publish :: qos",i.qos),i.qos){case 1:case 2:this.outgoing[a.messageId]={volatile:!1,cb:o||nop},this._storeProcessing?(g("_storeProcessing enabled"),this._packetIdsDuringStoreProcessing[a.messageId]=!1,this._storePacket(a,void 0,i.cbStorePut)):(g("MqttClient:publish: packet cmd: %s",a.cmd),this._sendPacket(a,void 0,i.cbStorePut));break;default:this._storeProcessing?(g("_storeProcessing enabled"),this._storePacket(a,o,i.cbStorePut)):(g("MqttClient:publish: packet cmd: %s",a.cmd),this._sendPacket(a,o,i.cbStorePut))}return this},MqttClient.prototype.subscribe=function(){for(var t,r=new Array(arguments.length),i=0;i<arguments.length;i++)r[i]=arguments[i];var o,a=[],c=r.shift(),u=c.resubscribe,l=r.pop()||nop,d=r.pop(),p=this,y=this.options.protocolVersion;if(delete c.resubscribe,"string"==typeof c&&(c=[c]),"function"!=typeof l&&(d=l,l=nop),null!==(o=h.validateTopics(c)))return v(l,new Error("Invalid topic "+o)),this;if(this._checkDisconnecting(l))return g("subscribe: discconecting true"),this;var b={qos:0};if(5===y&&(b.nl=!1,b.rap=!1,b.rh=0),d=m(b,d),Array.isArray(c)?c.forEach((function(t){if(g("subscribe: array topic %s",t),!p._resubscribeTopics.hasOwnProperty(t)||p._resubscribeTopics[t].qos<d.qos||u){var r={topic:t,qos:d.qos};5===y&&(r.nl=d.nl,r.rap=d.rap,r.rh=d.rh,r.properties=d.properties),g("subscribe: pushing topic `%s` and qos `%s` to subs list",r.topic,r.qos),a.push(r)}})):Object.keys(c).forEach((function(t){if(g("subscribe: object topic %s",t),!p._resubscribeTopics.hasOwnProperty(t)||p._resubscribeTopics[t].qos<c[t].qos||u){var r={topic:t,qos:c[t].qos};5===y&&(r.nl=c[t].nl,r.rap=c[t].rap,r.rh=c[t].rh,r.properties=d.properties),g("subscribe: pushing `%s` to subs list",r),a.push(r)}})),t={cmd:"subscribe",subscriptions:a,qos:1,retain:!1,dup:!1,messageId:this._nextId()},d.properties&&(t.properties=d.properties),a.length){if(this.options.resubscribe){g("subscribe :: resubscribe true");var _=[];a.forEach((function(t){if(p.options.reconnectPeriod>0){var r={qos:t.qos};5===y&&(r.nl=t.nl||!1,r.rap=t.rap||!1,r.rh=t.rh||0,r.properties=t.properties),p._resubscribeTopics[t.topic]=r,_.push(t.topic)}})),p.messageIdToTopic[t.messageId]=_}return this.outgoing[t.messageId]={volatile:!0,cb:function(t,r){if(!t)for(var i=r.granted,o=0;o<i.length;o+=1)a[o].qos=i[o];l(t,a)}},g("subscribe :: call _sendPacket"),this._sendPacket(t),this}l(null,[])},MqttClient.prototype.unsubscribe=function(){for(var t={cmd:"unsubscribe",qos:1,messageId:this._nextId()},r=this,i=new Array(arguments.length),o=0;o<arguments.length;o++)i[o]=arguments[o];var a=i.shift(),c=i.pop()||nop,u=i.pop();return"string"==typeof a&&(a=[a]),"function"!=typeof c&&(u=c,c=nop),this._checkDisconnecting(c)||("string"==typeof a?t.unsubscriptions=[a]:Array.isArray(a)&&(t.unsubscriptions=a),this.options.resubscribe&&t.unsubscriptions.forEach((function(t){delete r._resubscribeTopics[t]})),"object"==typeof u&&u.properties&&(t.properties=u.properties),this.outgoing[t.messageId]={volatile:!0,cb:c},g("unsubscribe: call _sendPacket"),this._sendPacket(t)),this},MqttClient.prototype.end=function(t,r,i){var o=this;function closeStores(){g("end :: closeStores: closing incoming and outgoing stores"),o.disconnected=!0,o.incomingStore.close((function(t){o.outgoingStore.close((function(r){if(g("end :: closeStores: emitting end"),o.emit("end"),i){let o=t||r;g("end :: closeStores: invoking callback with args"),i(o)}}))})),o._deferredReconnect&&o._deferredReconnect()}function finish(){g("end :: (%s) :: finish :: calling _cleanUp with force %s",o.options.clientId,t),o._cleanUp(t,()=>{g("end :: finish :: calling process.nextTick on closeStores"),y(closeStores.bind(o))},r)}return g("end :: (%s)",this.options.clientId),null!=t&&"boolean"==typeof t||(i=r||nop,r=t,t=!1,"object"!=typeof r&&(i=r,r=null,"function"!=typeof i&&(i=nop))),"object"!=typeof r&&(i=r,r=null),g("end :: cb? %s",!!i),i=i||nop,this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!t&&Object.keys(this.outgoing).length>0?(g("end :: (%s) :: calling finish in 10ms once outgoing is empty",o.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,finish,10))):(g("end :: (%s) :: immediately calling finish",o.options.clientId),finish()),this)},MqttClient.prototype.removeOutgoingMessage=function(t){var r=this.outgoing[t]?this.outgoing[t].cb:null;return delete this.outgoing[t],this.outgoingStore.del({messageId:t},(function(){r(new Error("Message removed"))})),this},MqttClient.prototype.reconnect=function(t){g("client reconnect");var r=this,f=function(){t?(r.options.incomingStore=t.incomingStore,r.options.outgoingStore=t.outgoingStore):(r.options.incomingStore=null,r.options.outgoingStore=null),r.incomingStore=r.options.incomingStore||new c,r.outgoingStore=r.options.outgoingStore||new c,r.disconnecting=!1,r.disconnected=!1,r._deferredReconnect=null,r._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=f:f(),this},MqttClient.prototype._reconnect=function(){g("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),g("client already connected. disconnecting first.")):(g("_reconnect: calling _setupStream"),this._setupStream())},MqttClient.prototype._setupReconnect=function(){var t=this;!t.disconnecting&&!t.reconnectTimer&&t.options.reconnectPeriod>0?(this.reconnecting||(g("_setupReconnect :: emit `offline` state"),this.emit("offline"),g("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),g("_setupReconnect :: setting reconnectTimer for %d ms",t.options.reconnectPeriod),t.reconnectTimer=setInterval((function(){g("reconnectTimer :: reconnect triggered!"),t._reconnect()}),t.options.reconnectPeriod)):g("_setupReconnect :: doing nothing...")},MqttClient.prototype._clearReconnect=function(){g("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},MqttClient.prototype._cleanUp=function(t,r){var i=arguments[2];if(r&&(g("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",r)),g("_cleanUp :: forced? %s",t),t)0===this.options.reconnectPeriod&&this.options.clean&&flush(this.outgoing),g("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{var o=m({cmd:"disconnect"},i);g("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(o,v.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(g("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(g("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),r&&!this.connected&&(g("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",r),r())},MqttClient.prototype._sendPacket=function(t,r,i){if(g("_sendPacket :: (%s) :: start",this.options.clientId),i=i||nop,!this.connected)return g("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(t,r,i);switch(this._shiftPingInterval(),t.cmd){case"publish":break;case"pubrel":return void storeAndSend(this,t,r,i);default:return void sendPacket(this,t,r)}switch(t.qos){case 2:case 1:storeAndSend(this,t,r,i);break;case 0:default:sendPacket(this,t,r)}g("_sendPacket :: (%s) :: end",this.options.clientId)},MqttClient.prototype._storePacket=function(t,r,i){g("_storePacket :: packet: %o",t),g("_storePacket :: cb? %s",!!r),i=i||nop,0===(t.qos||0)&&this.queueQoSZero||"publish"!==t.cmd?this.queue.push({packet:t,cb:r}):t.qos>0?(r=this.outgoing[t.messageId]?this.outgoing[t.messageId].cb:null,this.outgoingStore.put(t,(function(t){if(t)return r&&r(t);i()}))):r&&r(new Error("No connection to broker"))},MqttClient.prototype._setupPingTimer=function(){g("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);var t=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=p((function(){t._checkPing()}),1e3*this.options.keepalive))},MqttClient.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},MqttClient.prototype._checkPing=function(){g("_checkPing :: checking ping..."),this.pingResp?(g("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(g("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},MqttClient.prototype._handlePingresp=function(){this.pingResp=!0},MqttClient.prototype._handleConnack=function(t){g("_handleConnack");var r=this.options,i=5===r.protocolVersion?t.reasonCode:t.returnCode;if(clearTimeout(this.connackTimer),t.properties&&(t.properties.topicAliasMaximum&&(r.properties||(r.properties={}),r.properties.topicAliasMaximum=t.properties.topicAliasMaximum),t.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=t.properties.serverKeepAlive,this._shiftPingInterval()),t.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=t.properties.maximumPacketSize)),0===i)this.reconnecting=!1,this._onConnect(t);else if(i>0){var o=new Error("Connection refused: "+w[i]);o.code=i,this.emit("error",o)}},MqttClient.prototype._handlePublish=function(t,r){g("_handlePublish: packet %o",t),r=void 0!==r?r:nop;var i=t.topic.toString(),o=t.payload,a=t.qos,c=t.messageId,u=this,l=this.options,d=[0,16,128,131,135,144,145,151,153];switch(g("_handlePublish: qos %d",a),a){case 2:l.customHandleAcks(i,o,t,(function(i,o){return i instanceof Error||(o=i,i=null),i?u.emit("error",i):-1===d.indexOf(o)?u.emit("error",new Error("Wrong reason code for pubrec")):void(o?u._sendPacket({cmd:"pubrec",messageId:c,reasonCode:o},r):u.incomingStore.put(t,(function(){u._sendPacket({cmd:"pubrec",messageId:c},r)})))}));break;case 1:l.customHandleAcks(i,o,t,(function(a,l){return a instanceof Error||(l=a,a=null),a?u.emit("error",a):-1===d.indexOf(l)?u.emit("error",new Error("Wrong reason code for puback")):(l||u.emit("message",i,o,t),void u.handleMessage(t,(function(t){if(t)return r&&r(t);u._sendPacket({cmd:"puback",messageId:c,reasonCode:l},r)})))}));break;case 0:this.emit("message",i,o,t),this.handleMessage(t,r);break;default:g("_handlePublish: unknown QoS. Doing nothing.")}},MqttClient.prototype.handleMessage=function(t,r){r()},MqttClient.prototype._handleAck=function(t){var r,i=t.messageId,o=t.cmd,a=null,c=this.outgoing[i]?this.outgoing[i].cb:null,u=this;if(c){switch(g("_handleAck :: packet type",o),o){case"pubcomp":case"puback":var l=t.reasonCode;l&&l>0&&16!==l&&((r=new Error("Publish error: "+w[l])).code=l,c(r,t)),delete this.outgoing[i],this.outgoingStore.del(t,c);break;case"pubrec":a={cmd:"pubrel",qos:2,messageId:i};var d=t.reasonCode;d&&d>0&&16!==d?((r=new Error("Publish error: "+w[d])).code=d,c(r,t)):this._sendPacket(a);break;case"suback":delete this.outgoing[i];for(var p=0;p<t.granted.length;p++)if(0!=(128&t.granted[p])){var h=this.messageIdToTopic[i];h&&h.forEach((function(t){delete u._resubscribeTopics[t]}))}c(null,t);break;case"unsuback":delete this.outgoing[i],c(null);break;default:u.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else g("_handleAck :: Server sent an ack in error. Ignoring.")},MqttClient.prototype._handlePubrel=function(t,r){g("handling pubrel packet"),r=void 0!==r?r:nop;var i=t.messageId,o=this,a={cmd:"pubcomp",messageId:i};o.incomingStore.get(t,(function(t,i){t?o._sendPacket(a,r):(o.emit("message",i.topic,i.payload,i),o.handleMessage(i,(function(t){if(t)return r(t);o.incomingStore.del(i,nop),o._sendPacket(a,r)})))}))},MqttClient.prototype._handleDisconnect=function(t){this.emit("disconnect",t)},MqttClient.prototype._nextId=function(){var t=this.nextId++;return 65536===this.nextId&&(this.nextId=1),t},MqttClient.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},MqttClient.prototype._resubscribe=function(t){g("_resubscribe");var r=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!t.sessionPresent)&&r.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){g("_resubscribe: protocolVersion 5");for(var i=0;i<r.length;i++){var o={};o[r[i]]=this._resubscribeTopics[r[i]],o.resubscribe=!0,this.subscribe(o,{properties:o[r[i]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},MqttClient.prototype._onConnect=function(t){if(this.disconnected)this.emit("connect",t);else{var r=this;this._setupPingTimer(),this._resubscribe(t),this.connected=!0,function startStreamProcess(){var i=r.outgoingStore.createStream();function clearStoreProcessing(){r._storeProcessing=!1,r._packetIdsDuringStoreProcessing={}}function remove(){i.destroy(),i=null,clearStoreProcessing()}r.once("close",remove),i.on("error",(function(t){clearStoreProcessing(),r.removeListener("close",remove),r.emit("error",t)})),i.on("end",(function(){var i=!0;for(var o in r._packetIdsDuringStoreProcessing)if(!r._packetIdsDuringStoreProcessing[o]){i=!1;break}i?(clearStoreProcessing(),r.removeListener("close",remove),r.emit("connect",t)):startStreamProcess()})),function storeDeliver(){if(i){r._storeProcessing=!0;var t,o=i.read(1);o?r._packetIdsDuringStoreProcessing[o.messageId]?storeDeliver():r.disconnecting||r.reconnectTimer?i.destroy&&i.destroy():(t=r.outgoing[o.messageId]?r.outgoing[o.messageId].cb:null,r.outgoing[o.messageId]={volatile:!1,cb:function(r,i){t&&t(r,i),storeDeliver()}},r._packetIdsDuringStoreProcessing[o.messageId]=!0,r._sendPacket(o)):i.once("readable",storeDeliver)}}()}()}},t.exports=MqttClient}).call(this,i(19),i(17))},function(t,r){},function(t,r,i){"use strict";function ownKeys(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),i.push.apply(i,o)}return i}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(i),!0).forEach((function(r){_defineProperty(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))}))}return t}function _defineProperty(t,r,i){return(r=_toPropertyKey(r))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}function _defineProperties(t,r){for(var i=0;i<r.length;i++){var o=r[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,_toPropertyKey(o.key),o)}}function _toPropertyKey(t){var r=function _toPrimitive(t,r){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,r||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}var o=i(16).Buffer,a=i(786).inspect,c=a&&a.custom||"inspect";t.exports=function(){function BufferList(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return function _createClass(t,r,i){return r&&_defineProperties(t.prototype,r),i&&_defineProperties(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}(BufferList,[{key:"push",value:function push(t){var r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}},{key:"unshift",value:function unshift(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length}},{key:"shift",value:function shift(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function clear(){this.head=this.tail=null,this.length=0}},{key:"join",value:function join(t){if(0===this.length)return"";for(var r=this.head,i=""+r.data;r=r.next;)i+=t+r.data;return i}},{key:"concat",value:function concat(t){if(0===this.length)return o.alloc(0);for(var r,i,a,c=o.allocUnsafe(t>>>0),u=this.head,l=0;u;)r=u.data,i=c,a=l,o.prototype.copy.call(r,i,a),l+=u.data.length,u=u.next;return c}},{key:"consume",value:function consume(t,r){var i;return t<this.head.data.length?(i=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):i=t===this.head.data.length?this.shift():r?this._getString(t):this._getBuffer(t),i}},{key:"first",value:function first(){return this.head.data}},{key:"_getString",value:function _getString(t){var r=this.head,i=1,o=r.data;for(t-=o.length;r=r.next;){var a=r.data,c=t>a.length?a.length:t;if(c===a.length?o+=a:o+=a.slice(0,t),0===(t-=c)){c===a.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(c));break}++i}return this.length-=i,o}},{key:"_getBuffer",value:function _getBuffer(t){var r=o.allocUnsafe(t),i=this.head,a=1;for(i.data.copy(r),t-=i.data.length;i=i.next;){var c=i.data,u=t>c.length?c.length:t;if(c.copy(r,r.length-t,0,u),0===(t-=u)){u===c.length?(++a,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=c.slice(u));break}++a}return this.length-=a,r}},{key:c,value:function value(t,r){return a(this,_objectSpread(_objectSpread({},r),{},{depth:0,customInspect:!1}))}}]),BufferList}()},function(t,r){},function(t,r,i){var o=i(16),a=o.Buffer;function copyProps(t,r){for(var i in t)r[i]=t[i]}function SafeBuffer(t,r,i){return a(t,r,i)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?t.exports=o:(copyProps(o,r),r.Buffer=SafeBuffer),copyProps(a,SafeBuffer),SafeBuffer.from=function(t,r,i){if("number"==typeof t)throw new TypeError("Argument must not be a number");return a(t,r,i)},SafeBuffer.alloc=function(t,r,i){if("number"!=typeof t)throw new TypeError("Argument must be a number");var o=a(t);return void 0!==r?"string"==typeof i?o.fill(r,i):o.fill(r):o.fill(0),o},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return a(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o.SlowBuffer(t)}},function(t,r,i){"use strict";(function(r){var o;function _defineProperty(t,r,i){return(r=function _toPropertyKey(t){var r=function _toPrimitive(t,r){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,r||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}(r))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}var a=i(211),c=Symbol("lastResolve"),u=Symbol("lastReject"),l=Symbol("error"),d=Symbol("ended"),p=Symbol("lastPromise"),h=Symbol("handlePromise"),m=Symbol("stream");function createIterResult(t,r){return{value:t,done:r}}function readAndResolve(t){var r=t[c];if(null!==r){var i=t[m].read();null!==i&&(t[p]=null,t[c]=null,t[u]=null,r(createIterResult(i,!1)))}}function onReadable(t){r.nextTick(readAndResolve,t)}var g=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((_defineProperty(o={get stream(){return this[m]},next:function next(){var t=this,i=this[l];if(null!==i)return Promise.reject(i);if(this[d])return Promise.resolve(createIterResult(void 0,!0));if(this[m].destroyed)return new Promise((function(i,o){r.nextTick((function(){t[l]?o(t[l]):i(createIterResult(void 0,!0))}))}));var o,a=this[p];if(a)o=new Promise(function wrapForNext(t,r){return function(i,o){t.then((function(){r[d]?i(createIterResult(void 0,!0)):r[h](i,o)}),o)}}(a,this));else{var c=this[m].read();if(null!==c)return Promise.resolve(createIterResult(c,!1));o=new Promise(this[h])}return this[p]=o,o}},Symbol.asyncIterator,(function(){return this})),_defineProperty(o,"return",(function _return(){var t=this;return new Promise((function(r,i){t[m].destroy(null,(function(t){t?i(t):r(createIterResult(void 0,!0))}))}))})),o),g);t.exports=function createReadableStreamAsyncIterator(t){var r,i=Object.create(y,(_defineProperty(r={},m,{value:t,writable:!0}),_defineProperty(r,c,{value:null,writable:!0}),_defineProperty(r,u,{value:null,writable:!0}),_defineProperty(r,l,{value:null,writable:!0}),_defineProperty(r,d,{value:t._readableState.endEmitted,writable:!0}),_defineProperty(r,h,{value:function value(t,r){var o=i[m].read();o?(i[p]=null,i[c]=null,i[u]=null,t(createIterResult(o,!1))):(i[c]=t,i[u]=r)},writable:!0}),r));return i[p]=null,a(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var r=i[u];return null!==r&&(i[p]=null,i[c]=null,i[u]=null,r(t)),void(i[l]=t)}var o=i[c];null!==o&&(i[p]=null,i[c]=null,i[u]=null,o(createIterResult(void 0,!0))),i[d]=!0})),t.on("readable",onReadable.bind(null,i)),i}}).call(this,i(19))},function(t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,r,i){"use strict";t.exports=PassThrough;var o=i(329);function PassThrough(t){if(!(this instanceof PassThrough))return new PassThrough(t);o.call(this,t)}i(30)(PassThrough,o),PassThrough.prototype._transform=function(t,r,i){i(null,t)}},function(t,r,i){"use strict";var o;var a=i(95).codes,c=a.ERR_MISSING_ARGS,u=a.ERR_STREAM_DESTROYED;function noop(t){if(t)throw t}function destroyer(t,r,a,c){c=function once(t){var r=!1;return function(){r||(r=!0,t.apply(void 0,arguments))}}(c);var l=!1;t.on("close",(function(){l=!0})),void 0===o&&(o=i(211)),o(t,{readable:r,writable:a},(function(t){if(t)return c(t);l=!0,c()}));var d=!1;return function(r){if(!l&&!d)return d=!0,function isRequest(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void c(r||new u("pipe"))}}function call(t){t()}function pipe(t,r){return t.pipe(r)}function popCallback(t){return t.length?"function"!=typeof t[t.length-1]?noop:t.pop():noop}t.exports=function pipeline(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var o,a=popCallback(r);if(Array.isArray(r[0])&&(r=r[0]),r.length<2)throw new c("streams");var u=r.map((function(t,i){var c=i<r.length-1;return destroyer(t,c,i>0,(function(t){o||(o=t),t&&u.forEach(call),c||(u.forEach(call),a(o))}))}));return r.reduce(pipe)}},function(t,r,i){r.parser=i(793).parser,r.generate=i(799),r.writeToStream=i(331)},function(t,r,i){const o=i(794),a=i(45),c=i(796),u=i(330),l=i(75)("mqtt-packet:parser");class Parser extends a{constructor(){super(),this.parser=this.constructor.parser}static parser(t){return this instanceof Parser?(this.settings=t||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new Parser).parser(t)}_resetState(){l("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new c,this.error=null,this._list=o(),this._stateCounter=0}parse(t){for(this.error&&this._resetState(),this._list.append(t),l("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,l("parse: state complete. _stateCounter is now: %d",this._stateCounter),l("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return l("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const t=this._list.readUInt8(0);return this.packet.cmd=u.types[t>>u.CMD_SHIFT],this.packet.retain=0!=(t&u.RETAIN_MASK),this.packet.qos=t>>u.QOS_SHIFT&u.QOS_MASK,this.packet.dup=0!=(t&u.DUP_MASK),l("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const t=this._parseVarByteNum(!0);return t&&(this.packet.length=t.value,this._list.consume(t.bytes)),l("_parseLength %d",t.value),!!t}_parsePayload(){l("_parsePayload: payload %O",this._list);let t=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}t=!0}return l("_parsePayload complete result: %s",t),t}_parseConnect(){let t,r,i,o;l("_parseConnect");const a={},c=this.packet,d=this._parseString();if(null===d)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==d&&"MQIsdp"!==d)return this._emitError(new Error("Invalid protocolId"));if(c.protocolId=d,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(c.protocolVersion=this._list.readUInt8(this._pos),c.protocolVersion>=128&&(c.bridgeMode=!0,c.protocolVersion=c.protocolVersion-128),3!==c.protocolVersion&&4!==c.protocolVersion&&5!==c.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(a.username=this._list.readUInt8(this._pos)&u.USERNAME_MASK,a.password=this._list.readUInt8(this._pos)&u.PASSWORD_MASK,a.will=this._list.readUInt8(this._pos)&u.WILL_FLAG_MASK,a.will&&(c.will={},c.will.retain=0!=(this._list.readUInt8(this._pos)&u.WILL_RETAIN_MASK),c.will.qos=(this._list.readUInt8(this._pos)&u.WILL_QOS_MASK)>>u.WILL_QOS_SHIFT),c.clean=0!=(this._list.readUInt8(this._pos)&u.CLEAN_SESSION_MASK),this._pos++,c.keepalive=this._parseNum(),-1===c.keepalive)return this._emitError(new Error("Packet too short"));if(5===c.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(c.properties=t)}const p=this._parseString();if(null===p)return this._emitError(new Error("Packet too short"));if(c.clientId=p,l("_parseConnect: packet.clientId: %s",c.clientId),a.will){if(5===c.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(c.will.properties=t)}if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse will topic"));if(c.will.topic=t,l("_parseConnect: packet.will.topic: %s",c.will.topic),r=this._parseBuffer(),null===r)return this._emitError(new Error("Cannot parse will payload"));c.will.payload=r,l("_parseConnect: packet.will.paylaod: %s",c.will.payload)}if(a.username){if(o=this._parseString(),null===o)return this._emitError(new Error("Cannot parse username"));c.username=o,l("_parseConnect: packet.username: %s",c.username)}if(a.password){if(i=this._parseBuffer(),null===i)return this._emitError(new Error("Cannot parse password"));c.password=i}return this.settings=c,l("_parseConnect: complete"),c}_parseConnack(){l("_parseConnack");const t=this.packet;if(this._list.length<1)return null;if(t.sessionPresent=!!(this._list.readUInt8(this._pos++)&u.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?t.reasonCode=this._list.readUInt8(this._pos++):t.reasonCode=0;else{if(this._list.length<2)return null;t.returnCode=this._list.readUInt8(this._pos++)}if(-1===t.returnCode||-1===t.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}l("_parseConnack: complete")}_parsePublish(){l("_parsePublish");const t=this.packet;if(t.topic=this._parseString(),null===t.topic)return this._emitError(new Error("Cannot parse topic"));if(!(t.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}t.payload=this._list.slice(this._pos,t.length),l("_parsePublish: payload from buffer list: %o",t.payload)}}_parseSubscribe(){l("_parseSubscribe");const t=this.packet;let r,i,o,a,c,d,p;if(1!==t.qos)return this._emitError(new Error("Wrong subscribe header"));if(t.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}for(;this._pos<t.length;){if(r=this._parseString(),null===r)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=t.length)return this._emitError(new Error("Malformed Subscribe Payload"));i=this._parseByte(),o=i&u.SUBSCRIBE_OPTIONS_QOS_MASK,d=0!=(i>>u.SUBSCRIBE_OPTIONS_NL_SHIFT&u.SUBSCRIBE_OPTIONS_NL_MASK),c=0!=(i>>u.SUBSCRIBE_OPTIONS_RAP_SHIFT&u.SUBSCRIBE_OPTIONS_RAP_MASK),a=i>>u.SUBSCRIBE_OPTIONS_RH_SHIFT&u.SUBSCRIBE_OPTIONS_RH_MASK,p={topic:r,qos:o},5===this.settings.protocolVersion?(p.nl=d,p.rap=c,p.rh=a):this.settings.bridgeMode&&(p.rh=0,p.rap=!0,p.nl=!0),l("_parseSubscribe: push subscription `%s` to subscription",p),t.subscriptions.push(p)}}}_parseSuback(){l("_parseSuback");const t=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){l("_parseUnsubscribe");const t=this.packet;if(t.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}for(;this._pos<t.length;){const r=this._parseString();if(null===r)return this._emitError(new Error("Cannot parse topic"));l("_parseUnsubscribe: push topic `%s` to unsubscriptions",r),t.unsubscriptions.push(r)}}}_parseUnsuback(){l("_parseUnsuback");const t=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const r=this._parseProperties();for(Object.getOwnPropertyNames(r).length&&(t.properties=r),t.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){l("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const t=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(t.length>2?(t.reasonCode=this._parseByte(),l("_parseConfirmation: packet.reasonCode `%d`",t.reasonCode)):t.reasonCode=0,t.length>3)){const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}return!0}_parseDisconnect(){const t=this.packet;if(l("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?t.reasonCode=this._parseByte():t.reasonCode=0;const r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(t.properties=r)}return l("_parseDisconnect result: true"),!0}_parseAuth(){l("_parseAuth");const t=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));t.reasonCode=this._parseByte();const r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(t.properties=r),l("_parseAuth: result: true"),!0}_parseMessageId(){const t=this.packet;return t.messageId=this._parseNum(),null===t.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(l("_parseMessageId: packet.messageId %d",t.messageId),!0)}_parseString(t){const r=this._parseNum(),i=r+this._pos;if(-1===r||i>this._list.length||i>this.packet.length)return null;const o=this._list.toString("utf8",this._pos,i);return this._pos+=r,l("_parseString: result: %s",o),o}_parseStringPair(){return l("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;const i=this._list.slice(this._pos,r);return this._pos+=t,l("_parseBuffer: result: %o",i),i}_parseNum(){if(this._list.length-this._pos<2)return-1;const t=this._list.readUInt16BE(this._pos);return this._pos+=2,l("_parseNum: result: %s",t),t}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const t=this._list.readUInt32BE(this._pos);return this._pos+=4,l("_parse4ByteNum: result: %s",t),t}_parseVarByteNum(t){l("_parseVarByteNum");let r,i=0,o=1,a=0,c=!1;const d=this._pos?this._pos:0;for(;i<4&&d+i<this._list.length;){if(r=this._list.readUInt8(d+i++),a+=o*(r&u.VARBYTEINT_MASK),o*=128,0==(r&u.VARBYTEINT_FIN_MASK)){c=!0;break}if(this._list.length<=i)break}return!c&&4===i&&this._list.length>=i&&this._emitError(new Error("Invalid variable byte integer")),d&&(this._pos+=i),c=!!c&&(t?{bytes:i,value:a}:a),l("_parseVarByteNum: result: %o",c),c}_parseByte(){let t;return this._pos<this._list.length&&(t=this._list.readUInt8(this._pos),this._pos++),l("_parseByte: result: %o",t),t}_parseByType(t){switch(l("_parseByType: type: %s",t),t){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){l("_parseProperties");const t=this._parseVarByteNum(),r=this._pos+t,i={};for(;this._pos<r;){const t=this._parseByte();if(!t)return this._emitError(new Error("Cannot parse property code type")),!1;const r=u.propertiesCodes[t];if(!r)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==r)i[r]?(Array.isArray(i[r])||(i[r]=[i[r]]),i[r].push(this._parseByType(u.propertiesTypes[r]))):i[r]=this._parseByType(u.propertiesTypes[r]);else{i[r]||(i[r]=Object.create(null));const t=this._parseByType(u.propertiesTypes[r]);if(i[r][t.name])if(Array.isArray(i[r][t.name]))i[r][t.name].push(t.value);else{const o=i[r][t.name];i[r][t.name]=[o],i[r][t.name].push(t.value)}else i[r][t.name]=t.value}}return i}_newPacket(){return l("_newPacket"),this.packet&&(this._list.consume(this.packet.length),l("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),l("_newPacket: new packet"),this.packet=new c,this._pos=0,!0}_emitError(t){l("_emitError"),this.error=t,this.emit("error",t)}}t.exports=Parser},function(t,r,i){"use strict";const o=i(74).Duplex,a=i(30),c=i(795);function BufferListStream(t){if(!(this instanceof BufferListStream))return new BufferListStream(t);if("function"==typeof t){this._callback=t;const r=function piper(t){this._callback&&(this._callback(t),this._callback=null)}.bind(this);this.on("pipe",(function onPipe(t){t.on("error",r)})),this.on("unpipe",(function onUnpipe(t){t.removeListener("error",r)})),t=null}c._init.call(this,t),o.call(this)}a(BufferListStream,o),Object.assign(BufferListStream.prototype,c.prototype),BufferListStream.prototype._new=function _new(t){return new BufferListStream(t)},BufferListStream.prototype._write=function _write(t,r,i){this._appendBuffer(t),"function"==typeof i&&i()},BufferListStream.prototype._read=function _read(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},BufferListStream.prototype.end=function end(t){o.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},BufferListStream.prototype._destroy=function _destroy(t,r){this._bufs.length=0,this.length=0,r(t)},BufferListStream.prototype._isBufferList=function _isBufferList(t){return t instanceof BufferListStream||t instanceof c||BufferListStream.isBufferList(t)},BufferListStream.isBufferList=c.isBufferList,t.exports=BufferListStream,t.exports.BufferListStream=BufferListStream,t.exports.BufferList=c},function(t,r,i){"use strict";const{Buffer:o}=i(16),a=Symbol.for("BufferList");function BufferList(t){if(!(this instanceof BufferList))return new BufferList(t);BufferList._init.call(this,t)}BufferList._init=function _init(t){Object.defineProperty(this,a,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},BufferList.prototype._new=function _new(t){return new BufferList(t)},BufferList.prototype._offset=function _offset(t){if(0===t)return[0,0];let r=0;for(let i=0;i<this._bufs.length;i++){const o=r+this._bufs[i].length;if(t<o||i===this._bufs.length-1)return[i,t-r];r=o}},BufferList.prototype._reverseOffset=function(t){const r=t[0];let i=t[1];for(let t=0;t<r;t++)i+=this._bufs[t].length;return i},BufferList.prototype.get=function get(t){if(t>this.length||t<0)return;const r=this._offset(t);return this._bufs[r[0]][r[1]]},BufferList.prototype.slice=function slice(t,r){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof r&&r<0&&(r+=this.length),this.copy(null,0,t,r)},BufferList.prototype.copy=function copy(t,r,i,a){if(("number"!=typeof i||i<0)&&(i=0),("number"!=typeof a||a>this.length)&&(a=this.length),i>=this.length)return t||o.alloc(0);if(a<=0)return t||o.alloc(0);const copy=!!t,c=this._offset(i),u=a-i;let l=u,d=copy&&r||0,p=c[1];if(0===i&&a===this.length){if(!copy)return 1===this._bufs.length?this._bufs[0]:o.concat(this._bufs,this.length);for(let r=0;r<this._bufs.length;r++)this._bufs[r].copy(t,d),d+=this._bufs[r].length;return t}if(l<=this._bufs[c[0]].length-p)return copy?this._bufs[c[0]].copy(t,r,p,p+l):this._bufs[c[0]].slice(p,p+l);copy||(t=o.allocUnsafe(u));for(let r=c[0];r<this._bufs.length;r++){const i=this._bufs[r].length-p;if(!(l>i)){this._bufs[r].copy(t,d,p,p+l),d+=i;break}this._bufs[r].copy(t,d,p),d+=i,l-=i,p&&(p=0)}return t.length>d?t.slice(0,d):t},BufferList.prototype.shallowSlice=function shallowSlice(t,r){if(t=t||0,r="number"!=typeof r?this.length:r,t<0&&(t+=this.length),r<0&&(r+=this.length),t===r)return this._new();const i=this._offset(t),o=this._offset(r),a=this._bufs.slice(i[0],o[0]+1);return 0===o[1]?a.pop():a[a.length-1]=a[a.length-1].slice(0,o[1]),0!==i[1]&&(a[0]=a[0].slice(i[1])),this._new(a)},BufferList.prototype.toString=function toString(t,r,i){return this.slice(r,i).toString(t)},BufferList.prototype.consume=function consume(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},BufferList.prototype.duplicate=function duplicate(){const t=this._new();for(let r=0;r<this._bufs.length;r++)t.append(this._bufs[r]);return t},BufferList.prototype.append=function append(t){if(null==t)return this;if(t.buffer)this._appendBuffer(o.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let r=0;r<t.length;r++)this.append(t[r]);else if(this._isBufferList(t))for(let r=0;r<t._bufs.length;r++)this.append(t._bufs[r]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(o.from(t));return this},BufferList.prototype._appendBuffer=function appendBuffer(t){this._bufs.push(t),this.length+=t.length},BufferList.prototype.indexOf=function(t,r,i){if(void 0===i&&"string"==typeof r&&(i=r,r=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=o.from([t]):"string"==typeof t?t=o.from(t,i):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=o.from(t.buffer,t.byteOffset,t.byteLength):o.isBuffer(t)||(t=o.from(t)),r=Number(r||0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),0===t.length)return r>this.length?this.length:r;const a=this._offset(r);let c=a[0],u=a[1];for(;c<this._bufs.length;c++){const r=this._bufs[c];for(;u<r.length;){if(r.length-u>=t.length){const i=r.indexOf(t,u);if(-1!==i)return this._reverseOffset([c,i]);u=r.length-t.length+1}else{const r=this._reverseOffset([c,u]);if(this._match(r,t))return r;u++}}u=0}return-1},BufferList.prototype._match=function(t,r){if(this.length-t<r.length)return!1;for(let i=0;i<r.length;i++)if(this.get(t+i)!==r[i])return!1;return!0},function(){const t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const r in t)!function(r){BufferList.prototype[r]=null===t[r]?function(t,i){return this.slice(t,t+i)[r](0,i)}:function(i=0){return this.slice(i,i+t[r])[r](0)}}(r)}(),BufferList.prototype._isBufferList=function _isBufferList(t){return t instanceof BufferList||BufferList.isBufferList(t)},BufferList.isBufferList=function isBufferList(t){return null!=t&&t[a]},t.exports=BufferList},function(t,r){t.exports=class Packet{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},function(t,r,i){t.exports=function setup(t){function createDebug(t){let r,i,o,a=null;function debug(...t){if(!debug.enabled)return;const i=debug,o=Number(new Date),a=o-(r||o);i.diff=a,i.prev=r,i.curr=o,r=o,t[0]=createDebug.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let c=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return"%";c++;const a=createDebug.formatters[o];if("function"==typeof a){const o=t[c];r=a.call(i,o),t.splice(c,1),c--}return r}),createDebug.formatArgs.call(i,t);(i.log||createDebug.log).apply(i,t)}return debug.namespace=t,debug.useColors=createDebug.useColors(),debug.color=createDebug.selectColor(t),debug.extend=extend,debug.destroy=createDebug.destroy,Object.defineProperty(debug,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==createDebug.namespaces&&(i=createDebug.namespaces,o=createDebug.enabled(t)),o),set:t=>{a=t}}),"function"==typeof createDebug.init&&createDebug.init(debug),debug}function extend(t,r){const i=createDebug(this.namespace+(void 0===r?":":r)+t);return i.log=this.log,i}function toNamespace(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return createDebug.debug=createDebug,createDebug.default=createDebug,createDebug.coerce=function coerce(t){if(t instanceof Error)return t.stack||t.message;return t},createDebug.disable=function disable(){const t=[...createDebug.names.map(toNamespace),...createDebug.skips.map(toNamespace).map(t=>"-"+t)].join(",");return createDebug.enable(""),t},createDebug.enable=function enable(t){let r;createDebug.save(t),createDebug.namespaces=t,createDebug.names=[],createDebug.skips=[];const i=("string"==typeof t?t:"").split(/[\s,]+/),o=i.length;for(r=0;r<o;r++)i[r]&&("-"===(t=i[r].replace(/\*/g,".*?"))[0]?createDebug.skips.push(new RegExp("^"+t.slice(1)+"$")):createDebug.names.push(new RegExp("^"+t+"$")))},createDebug.enabled=function enabled(t){if("*"===t[t.length-1])return!0;let r,i;for(r=0,i=createDebug.skips.length;r<i;r++)if(createDebug.skips[r].test(t))return!1;for(r=0,i=createDebug.names.length;r<i;r++)if(createDebug.names[r].test(t))return!0;return!1},createDebug.humanize=i(798),createDebug.destroy=function destroy(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(r=>{createDebug[r]=t[r]}),createDebug.names=[],createDebug.skips=[],createDebug.formatters={},createDebug.selectColor=function selectColor(t){let r=0;for(let i=0;i<t.length;i++)r=(r<<5)-r+t.charCodeAt(i),r|=0;return createDebug.colors[Math.abs(r)%createDebug.colors.length]},createDebug.enable(createDebug.load()),createDebug}},function(t,r){var i=1e3,o=6e4,a=60*o,c=24*a;function plural(t,r,i,o){var a=r>=1.5*i;return Math.round(t/i)+" "+o+(a?"s":"")}t.exports=function(t,r){r=r||{};var u=typeof t;if("string"===u&&t.length>0)return function parse(t){if((t=String(t)).length>100)return;var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!r)return;var u=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*u;case"weeks":case"week":case"w":return 6048e5*u;case"days":case"day":case"d":return u*c;case"hours":case"hour":case"hrs":case"hr":case"h":return u*a;case"minutes":case"minute":case"mins":case"min":case"m":return u*o;case"seconds":case"second":case"secs":case"sec":case"s":return u*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(t);if("number"===u&&isFinite(t))return r.long?function fmtLong(t){var r=Math.abs(t);if(r>=c)return plural(t,r,c,"day");if(r>=a)return plural(t,r,a,"hour");if(r>=o)return plural(t,r,o,"minute");if(r>=i)return plural(t,r,i,"second");return t+" ms"}(t):function fmtShort(t){var r=Math.abs(t);if(r>=c)return Math.round(t/c)+"d";if(r>=a)return Math.round(t/a)+"h";if(r>=o)return Math.round(t/o)+"m";if(r>=i)return Math.round(t/i)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,r,i){(function(r){const o=i(331),a=i(45);class Accumulator extends a{constructor(){super(),this._array=new Array(20),this._i=0}write(t){return this._array[this._i++]=t,!0}concat(){let t=0;const i=new Array(this._array.length),o=this._array;let a,c=0;for(a=0;a<o.length&&void 0!==o[a];a++)"string"!=typeof o[a]?i[a]=o[a].length:i[a]=r.byteLength(o[a]),t+=i[a];const u=r.allocUnsafe(t);for(a=0;a<o.length&&void 0!==o[a];a++)"string"!=typeof o[a]?(o[a].copy(u,c),c+=i[a]):(u.write(o[a],c),c+=i[a]);return u}}t.exports=function generate(t,r){const i=new Accumulator;return o(t,i,r),i.concat()}}).call(this,i(16).Buffer)},function(t,r,i){(function(r){const i={},o=r.isBuffer(r.from([1,2]).subarray(0,1));function generateBuffer(t){const i=r.allocUnsafe(2);return i.writeUInt8(t>>8,0),i.writeUInt8(255&t,1),i}t.exports={cache:i,generateCache:function generateCache(){for(let t=0;t<65536;t++)i[t]=generateBuffer(t)},generateNumber:generateBuffer,genBufVariableByteInt:function genBufVariableByteInt(t){let i=0,a=0;const c=r.allocUnsafe(4);do{i=t%128|0,(t=t/128|0)>0&&(i|=128),c.writeUInt8(i,a++)}while(t>0&&a<4);return t>0&&(a=0),o?c.subarray(0,a):c.slice(0,a)},generate4ByteBuffer:function generate4ByteBuffer(t){const i=r.allocUnsafe(4);return i.writeUInt32BE(t,0),i}}}).call(this,i(16).Buffer)},function(t,r,i){"use strict";function ReInterval(t,r,i){var o=this;this._callback=t,this._args=i,this._interval=setInterval(t,r,this._args),this.reschedule=function(t){t||(t=o._interval),o._interval&&clearInterval(o._interval),o._interval=setInterval(o._callback,t,o._args)},this.clear=function(){o._interval&&(clearInterval(o._interval),o._interval=void 0)},this.destroy=function(){o._interval&&clearInterval(o._interval),o._callback=void 0,o._interval=void 0,o._args=void 0}}t.exports=function reInterval(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var t;if(arguments.length>0){t=new Array(arguments.length-2);for(var r=0;r<t.length;r++)t[r]=arguments[r+2]}return new ReInterval(arguments[0],arguments[1],t)}},function(t,r,i){"use strict";function validateTopic(t){for(var r=t.split("/"),i=0;i<r.length;i++)if("+"!==r[i]){if("#"===r[i])return i===r.length-1;if(-1!==r[i].indexOf("+")||-1!==r[i].indexOf("#"))return!1}return!0}t.exports={validateTopics:function validateTopics(t){if(0===t.length)return"empty_topic_list";for(var r=0;r<t.length;r++)if(!validateTopic(t[r]))return t[r];return null}}},function(t,r){},function(t,r){},function(t,r,i){var o=i(806);function once(t){var f=function(){return f.called?f.value:(f.called=!0,f.value=t.apply(this,arguments))};return f.called=!1,f}function onceStrict(t){var f=function(){if(f.called)throw new Error(f.onceError);return f.called=!0,f.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return f.onceError=r+" shouldn't be called more than once",f.called=!1,f}t.exports=o(once),t.exports.strict=o(onceStrict),once.proto=once((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})}))},function(t,r){t.exports=function wrappy(t,r){if(t&&r)return wrappy(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(r){wrapper[r]=t[r]})),wrapper;function wrapper(){for(var r=new Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];var o=t.apply(this,r),a=r[r.length-1];return"function"==typeof o&&o!==a&&Object.keys(a).forEach((function(t){o[t]=a[t]})),o}}},function(t,r,i){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(t,r,i){var o;t.exports=(o=i(214),i(338),i(810),o.HmacSHA256)},function(t,r){},function(t,r,i){var o,a,c,u;t.exports=(o=i(214),c=(a=o).lib.Base,u=a.enc.Utf8,void(a.algo.HMAC=c.extend({init:function(t,r){t=this._hasher=new t.init,"string"==typeof r&&(r=u.parse(r));var i=t.blockSize,o=4*i;r.sigBytes>o&&(r=t.finalize(r)),r.clamp();for(var a=this._oKey=r.clone(),c=this._iKey=r.clone(),l=a.words,d=c.words,p=0;p<i;p++)l[p]^=1549556828,d[p]^=909522486;a.sigBytes=c.sigBytes=o,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var r=this._hasher,i=r.finalize(t);return r.reset(),r.finalize(this._oKey.clone().concat(i))}})))},function(t,r){t.exports={INVALID_CONNECT_OPTIONS:"Invalid connect options supplied.",INVALID_CLIENT_ID_OPTION:'Invalid "clientId" (mqtt client id) option supplied.',INVALID_RECONNECT_TIMING:"Invalid reconnect timing options supplied.",INVALID_OFFLINE_QUEUEING_PARAMETERS:"Invalid offline queueing options supplied."}},function(t,r,i){(function(r){var o=i(215),a=i(153),c=i(813);t.exports=function(t){if(a(t.keyPath)&&a(t.privateKey))throw new Error(c.NO_KEY_OPTION);if(a(t.certPath)&&a(t.clientCert))throw new Error(c.NO_CERT_OPTION);if(a(t.caPath)&&a(t.caCert))throw new Error(c.NO_CA_OPTION);if(!a(t.caCert))if(r.isBuffer(t.caCert))t.ca=t.caCert;else{if(!o.existsSync(t.caCert))throw new Error(c.INVALID_CA_CERT_OPTION);t.ca=o.readFileSync(t.caCert)}if(!a(t.privateKey))if(r.isBuffer(t.privateKey))t.key=t.privateKey;else{if(!o.existsSync(t.privateKey))throw new Error(c.INVALID_PRIVATE_KEY_OPTION);t.key=o.readFileSync(t.privateKey)}if(!a(t.clientCert))if(r.isBuffer(t.clientCert))t.cert=t.clientCert;else{if(!o.existsSync(t.clientCert))throw new Error(c.INVALID_CLIENT_CERT_OPTION);t.cert=o.readFileSync(t.clientCert)}if(o.existsSync(t.keyPath))t.key=o.readFileSync(t.keyPath);else if(!a(t.keyPath))throw new Error(c.INVALID_KEY_PATH_OPTION);if(o.existsSync(t.certPath))t.cert=o.readFileSync(t.certPath);else if(!a(t.certPath))throw new Error(c.INVALID_CERT_PATH_OPTION);if(o.existsSync(t.caPath))t.ca=o.readFileSync(t.caPath);else if(!a(t.caPath))throw new Error(c.INVALID_CA_PATH_OPTION);t.requestCert=!0,t.rejectUnauthorized=!0}}).call(this,i(16).Buffer)},function(t,r){t.exports={NO_KEY_OPTION:'No "keyPath" or "privateKey" option supplied.',NO_CERT_OPTION:'No "certPath" or "clientCert" option supplied.',NO_CA_OPTION:'No "caPath" or "caCert" option supplied.',INVALID_KEY_PATH_OPTION:'Invalid "keyPath" option supplied.',INVALID_CERT_PATH_OPTION:'Invalid "certPath" option supplied.',INVALID_CA_PATH_OPTION:'Invalid "caPath" option supplied.',INVALID_CLIENT_CERT_OPTION:'Invalid "clientCert" option supplied.',INVALID_PRIVATE_KEY_OPTION:'Invalid "privateKey" option supplied.',INVALID_CA_CERT_OPTION:'Invalid "caCert" option supplied.'}},function(t,r,i){(function(t){function normalizeArray(t,r){for(var i=0,o=t.length-1;o>=0;o--){var a=t[o];"."===a?t.splice(o,1):".."===a?(t.splice(o,1),i++):i&&(t.splice(o,1),i--)}if(r)for(;i--;i)t.unshift("..");return t}function filter(t,r){if(t.filter)return t.filter(r);for(var i=[],o=0;o<t.length;o++)r(t[o],o,t)&&i.push(t[o]);return i}r.resolve=function(){for(var r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return(i?"/":"")+(r=normalizeArray(filter(r.split("/"),(function(t){return!!t})),!i).join("/"))||"."},r.normalize=function(t){var o=r.isAbsolute(t),a="/"===i(t,-1);return(t=normalizeArray(filter(t.split("/"),(function(t){return!!t})),!o).join("/"))||o||(t="."),t&&a&&(t+="/"),(o?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(filter(t,(function(t,r){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},r.relative=function(t,i){function trim(t){for(var r=0;r<t.length&&""===t[r];r++);for(var i=t.length-1;i>=0&&""===t[i];i--);return r>i?[]:t.slice(r,i-r+1)}t=r.resolve(t).substr(1),i=r.resolve(i).substr(1);for(var o=trim(t.split("/")),a=trim(i.split("/")),c=Math.min(o.length,a.length),u=c,l=0;l<c;l++)if(o[l]!==a[l]){u=l;break}var d=[];for(l=u;l<o.length;l++)d.push("..");return(d=d.concat(a.slice(u))).join("/")},r.sep="/",r.delimiter=":",r.dirname=function(t){if("string"!=typeof t&&(t+=""),0===t.length)return".";for(var r=t.charCodeAt(0),i=47===r,o=-1,a=!0,c=t.length-1;c>=1;--c)if(47===(r=t.charCodeAt(c))){if(!a){o=c;break}}else a=!1;return-1===o?i?"/":".":i&&1===o?"/":t.slice(0,o)},r.basename=function(t,r){var i=function basename(t){"string"!=typeof t&&(t+="");var r,i=0,o=-1,a=!0;for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!a){i=r+1;break}}else-1===o&&(a=!1,o=r+1);return-1===o?"":t.slice(i,o)}(t);return r&&i.substr(-1*r.length)===r&&(i=i.substr(0,i.length-r.length)),i},r.extname=function(t){"string"!=typeof t&&(t+="");for(var r=-1,i=0,o=-1,a=!0,c=0,u=t.length-1;u>=0;--u){var l=t.charCodeAt(u);if(47!==l)-1===o&&(a=!1,o=u+1),46===l?-1===r?r=u:1!==c&&(c=1):-1!==r&&(c=-1);else if(!a){i=u+1;break}}return-1===r||-1===o||0===c||1===c&&r===o-1&&r===i+1?"":t.slice(r,o)};var i="b"==="ab".substr(-1)?function(t,r,i){return t.substr(r,i)}:function(t,r,i){return r<0&&(r=t.length+r),t.substr(r,i)}}).call(this,i(19))},function(t){t.exports=JSON.parse('{"name":"aws-iot-device-sdk","description":"AWS IoT Node.js SDK for Embedded Devices","version":"2.2.15","author":{"name":"Amazon Web Services","email":"","url":"http://aws.amazon.com"},"homepage":"https://github.com/aws/aws-iot-device-sdk-js","main":"index.js","engines":{"node":">=8.17.0"},"repository":{"type":"git","url":"git://github.com/aws/aws-iot-device-sdk-js"},"bugs":{"url":"http://github.com/aws/aws-iot-device-sdk-js/issues"},"license":"Apache-2.0","keywords":["api","amazon","aws","iot","mqtt"],"dependencies":{"crypto-js":"4.2.0","minimist":"1.2.6","mqtt":"4.2.8","@httptoolkit/websocket-stream":"^6.0.1"},"devDependencies":{"gulp":"^3.9.0","gulp-beautify":"^2.0.0","gulp-concat":"^2.6.0","gulp-coverage":"^0.3.38","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1","jshint":"^2.9.1","jshint-stylish":"^2.2.1","rewire":"^2.5.1","sinon":"^1.17.3"},"scripts":{"test":"node ./node_modules/gulp/bin/gulp.js test --verbose","browserize":"./scripts/browserize.sh","beautify":"node ./node_modules/gulp/bin/gulp.js beautify"}}')},function(t,r,i){var o=i(215);t.exports=function buildBuilder(t,r){var i;function handleTLSerrors(r){t.emit("error",r),i.end()}return(i=o.connect(r)).on("secureConnect",(function(){i.authorized?i.removeListener("error",handleTLSerrors):i.emit("error",new Error("TLS not authorized"))})),i.on("error",handleTLSerrors),i}},function(t,r,i){var o=i(818);t.exports=function buildBuilder(t,r){return o(r.url,["mqttv3.1"],r.websocketOptions)}},function(t,r,i){"use strict";(function(r,o){var a=i(339).Transform,c=i(826),u=i(827),l=i(154).Buffer;t.exports=function WebSocketStream(t,i,d){var p,h,m="browser"===r.title,g=!!o.WebSocket,y=m?function socketWriteBrowser(t,r,i){if(h.bufferedAmount>b)return void setTimeout(socketWriteBrowser,_,t,r,i);S&&"string"==typeof t&&(t=l.from(t,"utf8"));try{h.send(t)}catch(t){return i(t)}i()}:function socketWriteNode(t,r,i){if(h.readyState!==h.OPEN)return void i();S&&"string"==typeof t&&(t=l.from(t,"utf8"));h.send(t,i)};i&&!Array.isArray(i)&&"object"==typeof i&&(d=i,i=void 0,("string"==typeof d.protocol||Array.isArray(d.protocol))&&(i=d.protocol));d||(d={});void 0===d.objectMode&&(d.objectMode=!(!0===d.binary||void 0===d.binary));var v=function buildProxy(t,r,i){var o=new a({objectMode:t.objectMode});return o._write=r,o._flush=i,o}(d,y,(function socketEnd(t){h.close(),t()}));d.objectMode||(v._writev=writev);var b=d.browserBufferSize||524288,_=d.browserBufferTimeout||1e3;"object"==typeof t?h=t:(h=g&&m?new u(t,i):new u(t,i,d)).binaryType="arraybuffer";var w=void 0===h.addEventListener;h.readyState===h.OPEN?p=v:(p=c(void 0,void 0,d),d.objectMode||(p._writev=writev),w?h.addEventListener("open",onopen):h.onopen=onopen);p.socket=h,w?(h.addEventListener("close",onclose),h.addEventListener("error",onerror),h.addEventListener("message",onmessage)):(h.onclose=onclose,h.onerror=onerror,h.onmessage=onmessage);v.on("close",(function destroy(){h.close()}));var S=!d.objectMode;function onopen(){p.setReadable(v),p.setWritable(v),p.emit("connect")}function onclose(t){p.emit("ws-close",t),p.end(),p.destroy()}function onerror(t){p.destroy(t)}function onmessage(t){var r=t.data;r=r instanceof ArrayBuffer?l.from(r):l.from(r,"utf8"),v.push(r)}function writev(t,r){for(var i=new Array(t.length),o=0;o<t.length;o++)"string"==typeof t[o].chunk?i[o]=l.from(t[o],"utf8"):i[o]=t[o].chunk;this._write(l.concat(i),"binary",r)}return p}}).call(this,i(19),i(17))},function(t,r){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,r){},function(t,r,i){"use strict";var o=i(154).Buffer,a=i(822);t.exports=function(){function BufferList(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return BufferList.prototype.push=function push(t){var r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length},BufferList.prototype.unshift=function unshift(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length},BufferList.prototype.shift=function shift(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},BufferList.prototype.clear=function clear(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function join(t){if(0===this.length)return"";for(var r=this.head,i=""+r.data;r=r.next;)i+=t+r.data;return i},BufferList.prototype.concat=function concat(t){if(0===this.length)return o.alloc(0);for(var r,i,a,c=o.allocUnsafe(t>>>0),u=this.head,l=0;u;)r=u.data,i=c,a=l,r.copy(i,a),l+=u.data.length,u=u.next;return c},BufferList}(),a&&a.inspect&&a.inspect.custom&&(t.exports.prototype[a.inspect.custom]=function(){var t=a.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,r){},function(t,r,i){(function(t){var o=void 0!==t&&t||"undefined"!=typeof self&&self||window,a=Function.prototype.apply;function Timeout(t,r){this._id=t,this._clearFn=r}r.setTimeout=function(){return new Timeout(a.call(setTimeout,o,arguments),clearTimeout)},r.setInterval=function(){return new Timeout(a.call(setInterval,o,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t&&t.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(o,this._id)},r.enroll=function(t,r){clearTimeout(t._idleTimeoutId),t._idleTimeout=r},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var r=t._idleTimeout;r>=0&&(t._idleTimeoutId=setTimeout((function onTimeout(){t._onTimeout&&t._onTimeout()}),r))},i(824),r.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,r.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(17))},function(t,r,i){(function(t,r){!function(t,i){"use strict";if(!t.setImmediate){var o,a=1,c={},u=!1,l=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?function installNextTickImplementation(){o=function(t){r.nextTick((function(){runIfPresent(t)}))}}():!function canUsePostMessage(){if(t.postMessage&&!t.importScripts){var r=!0,i=t.onmessage;return t.onmessage=function(){r=!1},t.postMessage("","*"),t.onmessage=i,r}}()?t.MessageChannel?function installMessageChannelImplementation(){var t=new MessageChannel;t.port1.onmessage=function(t){runIfPresent(t.data)},o=function(r){t.port2.postMessage(r)}}():l&&"onreadystatechange"in l.createElement("script")?function installReadyStateChangeImplementation(){var t=l.documentElement;o=function(r){var i=l.createElement("script");i.onreadystatechange=function(){runIfPresent(r),i.onreadystatechange=null,t.removeChild(i),i=null},t.appendChild(i)}}():function installSetTimeoutImplementation(){o=function(t){setTimeout(runIfPresent,0,t)}}():function installPostMessageImplementation(){var r="setImmediate$"+Math.random()+"$",onGlobalMessage=function(i){i.source===t&&"string"==typeof i.data&&0===i.data.indexOf(r)&&runIfPresent(+i.data.slice(r.length))};t.addEventListener?t.addEventListener("message",onGlobalMessage,!1):t.attachEvent("onmessage",onGlobalMessage),o=function(i){t.postMessage(r+i,"*")}}(),d.setImmediate=function setImmediate(t){"function"!=typeof t&&(t=new Function(""+t));for(var r=new Array(arguments.length-1),i=0;i<r.length;i++)r[i]=arguments[i+1];var u={callback:t,args:r};return c[a]=u,o(a),a++},d.clearImmediate=clearImmediate}function clearImmediate(t){delete c[t]}function runIfPresent(t){if(u)setTimeout(runIfPresent,0,t);else{var r=c[t];if(r){u=!0;try{!function run(t){var r=t.callback,i=t.args;switch(i.length){case 0:r();break;case 1:r(i[0]);break;case 2:r(i[0],i[1]);break;case 3:r(i[0],i[1],i[2]);break;default:r.apply(void 0,i)}}(r)}finally{clearImmediate(t),u=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,i(17),i(19))},function(t,r,i){"use strict";t.exports=PassThrough;var o=i(344),a=Object.create(i(118));function PassThrough(t){if(!(this instanceof PassThrough))return new PassThrough(t);o.call(this,t)}a.inherits=i(30),a.inherits(PassThrough,o),PassThrough.prototype._transform=function(t,r,i){i(null,t)}},function(t,r,i){(function(r,o){var a=i(339),c=i(334),u=i(30),l=i(335),d=r.from&&r.from!==Uint8Array.from?r.from([0]):new r([0]),onuncork=function(t,r){t._corked?t.once("uncork",r):r()},destroyer=function(t,r){return function(i){i?function(t,r){t._autoDestroy&&t.destroy(r)}(t,"premature close"===i.message?null:i):r&&!t._ended&&t.end()}},Duplexify=function(t,r,i){if(!(this instanceof Duplexify))return new Duplexify(t,r,i);a.Duplex.call(this,i),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!i||!1!==i.autoDestroy,this._forwardDestroy=!i||!1!==i.destroy,this._forwardEnd=!i||!1!==i.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),r&&this.setReadable(r)};u(Duplexify,a.Duplex),Duplexify.obj=function(t,r,i){return i||(i={}),i.objectMode=!0,i.highWaterMark=16,new Duplexify(t,r,i)},Duplexify.prototype.cork=function(){1==++this._corked&&this.emit("cork")},Duplexify.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},Duplexify.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var r=this,i=c(t,{writable:!0,readable:!1},destroyer(this,this._forwardEnd)),ondrain=function(){var t=r._ondrain;r._ondrain=null,t&&t()};this._unwrite&&o.nextTick(ondrain),this._writable=t,this._writable.on("drain",ondrain),this._unwrite=function(){r._writable.removeListener("drain",ondrain),i()},this.uncork()}else this.end()},Duplexify.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var r,i=this,o=c(t,{writable:!1,readable:!0},destroyer(this)),onreadable=function(){i._forward()},onend=function(){i.push(null)};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:(r=t,new a.Readable({objectMode:!0,highWaterMark:16}).wrap(r)),this._readable2.on("readable",onreadable),this._readable2.on("end",onend),this._unread=function(){i._readable2.removeListener("readable",onreadable),i._readable2.removeListener("end",onend),o()},this._forward()}},Duplexify.prototype._read=function(){this._drained=!0,this._forward()},Duplexify.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=l(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},Duplexify.prototype.destroy=function(t){if(!this.destroyed){this.destroyed=!0;var r=this;o.nextTick((function(){r._destroy(t)}))}},Duplexify.prototype._destroy=function(t){if(t){var r=this._ondrain;this._ondrain=null,r?r(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},Duplexify.prototype._write=function(t,r,i){return this.destroyed?i():this._corked?onuncork(this,this._write.bind(this,t,r,i)):t===d?this._finish(i):this._writable?void(!1===this._writable.write(t)?this._ondrain=i:i()):i()},Duplexify.prototype._finish=function(t){var r=this;this.emit("preend"),onuncork(this,(function(){var i,o;i=r._forwardEnd&&r._writable,o=function(){!1===r._writableState.prefinished&&(r._writableState.prefinished=!0),r.emit("prefinish"),onuncork(r,t)},i?i._writableState&&i._writableState.finished?o():i._writableState?i.end(o):(i.end(),o()):o()}))},Duplexify.prototype.end=function(t,r,i){return"function"==typeof t?this.end(null,null,t):"function"==typeof r?this.end(t,null,r):(this._ended=!0,t&&this.write(t),this._writableState.ending||this.write(d),a.Writable.prototype.end.call(this,i))},t.exports=Duplexify}).call(this,i(16).Buffer,i(19))},function(t,r,i){(function(r){var i=null;"undefined"!=typeof WebSocket?i=WebSocket:"undefined"!=typeof MozWebSocket?i=MozWebSocket:void 0!==r?i=r.WebSocket||r.MozWebSocket:"undefined"!=typeof window?i=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(i=self.WebSocket||self.MozWebSocket),t.exports=i}).call(this,i(17))},function(t,r,i){var o=i(45),a=i(209).inherits,c=i(208),u=i(153);function buildThingShadowTopic(t,r,i){return u(i)?"$aws/things/"+t+"/shadow/"+r:"$aws/things/"+t+"/shadow/"+r+"/"+i}function ThingShadowsClient(t,r){if(!(this instanceof ThingShadowsClient))return new ThingShadowsClient(t,r);var i=this,a=[{}],l=0,d=1e4,p=!0,h=c.DeviceClient(t);u(r)||u(r.operationTimeout)||(d=r.operationTimeout),this._handleSubscriptions=function(t,r,i,o){for(var c=[],l=0,d=r.length;l<d;l++)for(var p=0,m=r[l].operations.length;p<m;p++)for(var g=0,y=r[l].statii.length;g<y;g++)c.push(buildThingShadowTopic(t,r[l].operations[p],r[l].statii[g]));!0===a[t].debug&&console.log(i+" on "+c);var v=[];v.push(c),"subscribe"===i?(v.push({qos:a[t].qos}),v.push((function(t,r){if(!u(o)){if(t)return void o(t);for(var i=[],a=0,c=r.length;a<c;a++)128===r[a].qos&&i.push(r[a]);if(i.length>0)return void o("Not all subscriptions were granted",i);o()}}))):u(o)||v.push(o),h[i].apply(h,v)},this._handleMessages=function(r,i,o,c){var l={};try{l=JSON.parse(c.toString())}catch(r){return void(!0===t.debug&&console.error("failed parsing JSON '"+c.toString()+"', "+r))}var d=l.clientToken,p=l.version;if(delete l.clientToken,!u(p)&&"rejected"!==o)if(u(a[r].version)||p>=a[r].version)a[r].version=p;else if("delete"!==i&&!0===a[r].discardStale)return void(!0===t.debug&&console.warn("out-of-date version '"+p+"' on '"+r+"' (local version '"+a[r].version+"')"));"delta"!==o?u(a[r].clientToken)||a[r].clientToken!==d?"accepted"===o&&"get"!==i&&this.emit("foreignStateChange",r,i,l):(clearTimeout(a[r].timeout),delete a[r].timeout,delete a[r].clientToken,a[r].pending=!1,!1===a[r].persistentSubscribe&&this._handleSubscriptions(r,[{operations:[i],statii:["accepted","rejected"]}],"unsubscribe"),this.emit("status",r,o,d,l)):this.emit("delta",r,l)},h.on("connect",(function(){i.emit("connect")})),h.on("close",(function(){i.emit("close")})),h.on("reconnect",(function(){i.emit("reconnect")})),h.on("offline",(function(){i.emit("offline")})),h.on("error",(function(t){i.emit("error",t)})),h.on("packetsend",(function(t){i.emit("packetsend",t)})),h.on("packetreceive",(function(t){i.emit("packetreceive",t)})),h.on("message",(function(t,r){if(!0===p){var o=t.split("/");!function isThingShadowTopic(t,r){var i=!1;return"$aws"===t[0]&&("things"!==t[1]||"shadow"!==t[3]||"update"!==t[4]&&"get"!==t[4]&&"delete"!==t[4]||("subscribe"===r?"accepted"!==t[5]&&"rejected"!==t[5]&&"delta"!==t[5]||6!==t.length||(i=!0):5===t.length&&(i=!0))),i}(o,"subscribe")?i.emit("message",t,r):a.hasOwnProperty(o[2])&&i._handleMessages(o[2],o[4],o[5],r)}})),this._thingOperation=function(r,o,c){var p=null;if(a.hasOwnProperty(r))if(!1===a[r].pending){var m;if(a[r].pending=!0,u(c.clientToken)){var g=t.clientId.length;m=g>48?t.clientId.substr(g-48)+"-"+l++:t.clientId+"-"+l++}else m=c.clientToken;a[r].clientToken=m;var y=buildThingShadowTopic(r,o);a[r].timeout=setTimeout((function(t,r){!1===a[t].persistentSubscribe&&i._handleSubscriptions(t,[{operations:[o],statii:["accepted","rejected"]}],"unsubscribe"),a[t].pending=!1,delete a[t].timeout,delete a[t].clientToken,i.emit("timeout",t,r)}),d,r,m),!1===a[r].persistentSubscribe?this._handleSubscriptions(r,[{operations:[o],statii:["accepted","rejected"]}],"subscribe",(function(t,i){u(t)&&u(i)?u(c)||(!u(a[r].version)&&a[r].enableVersioning&&(c.version=a[r].version),c.clientToken=m,h.publish(y,JSON.stringify(c),{qos:a[r].qos}),u(a[r])||!0!==a[r].debug||console.log("publishing '"+JSON.stringify(c)+" on '"+y+"'")):console.warn("failed subscription to accepted/rejected topics")})):(!u(a[r].version)&&a[r].enableVersioning&&(c.version=a[r].version),c.clientToken=m,h.publish(y,JSON.stringify(c),{qos:a[r].qos}),!0===a[r].debug&&console.log("publishing '"+JSON.stringify(c)+" on '"+y+"'")),p=m}else!0===t.debug&&console.error(o+" still in progress on thing: ",r);else!0===t.debug&&console.error("attempting to "+o+" unknown thing: ",r);return p},this.register=function(r,i,o){if(a.hasOwnProperty(r))!0===t.debug&&console.error("thing already registered: ",r);else{var c=!1,l=[];a[r]={persistentSubscribe:!0,debug:!1,discardStale:!0,enableVersioning:!0,qos:0,pending:!0},"function"==typeof i&&(o=i,i=null),u(i)||(u(i.ignoreDeltas)||(c=i.ignoreDeltas),u(i.persistentSubscribe)||(a[r].persistentSubscribe=i.persistentSubscribe),u(i.debug)||(a[r].debug=i.debug),u(i.discardStale)||(a[r].discardStale=i.discardStale),u(i.enableVersioning)||(a[r].enableVersioning=i.enableVersioning),u(i.qos)||(a[r].qos=i.qos)),!1===c&&l.push({operations:["update"],statii:["delta"]}),!0===a[r].persistentSubscribe&&l.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),l.length>0?this._handleSubscriptions(r,l,"subscribe",(function(t,i){u(t)&&u(i)&&(a[r].pending=!1),u(o)||o(t,i)})):(a[r].pending=!1,u(o)||o())}},this.unregister=function(r){if(a.hasOwnProperty(r)){var i=[];i.push({operations:["update"],statii:["delta"]}),!0===a[r].persistentSubscribe&&i.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),this._handleSubscriptions(r,i,"unsubscribe"),u(a[r].timeout)||clearTimeout(a[r].timeout),delete a[r]}else!0===t.debug&&console.error("attempting to unregister unknown thing: ",r)},this.update=function(t,r){var o=null;return u(r.version)?o=i._thingOperation(t,"update",r):console.error("message can't contain 'version' property"),o},this.get=function(t,r){var o={};return u(r)||(o.clientToken=r),i._thingOperation(t,"get",o)},this.delete=function(t,r){var o={};return u(r)||(o.clientToken=r),i._thingOperation(t,"delete",o)},this.publish=function(t,r,i,o){h.publish(t,r,i,o)},this.subscribe=function(t,r,i){var o=[];"string"==typeof t?o.push(t):"object"==typeof t&&t.length&&(o=t),h.subscribe(o,r,i)},this.unsubscribe=function(t,r){var i=[];"string"==typeof t?i.push(t):"object"==typeof t&&t.length&&(i=t),h.unsubscribe(i,r)},this.end=function(t,r){h.end(t,r)},this.updateWebSocketCredentials=function(t,r,i,o){h.updateWebSocketCredentials(t,r,i,o)},this.updateCustomAuthHeaders=function(t){h.updateCustomAuthHeaders(t)},this.setConnectionStatus=function(t){p=t},o.EventEmitter.call(this)}a(ThingShadowsClient,o.EventEmitter),t.exports=ThingShadowsClient},function(t,r,i){var o=i(45),a=i(209).inherits,c=i(208),u=i(153);function buildJobTopic(t,r,i){var o="$aws/things/"+t+"/jobs/";return u(i)?i=r:o+=r.toString()+"/",o+=i}function jobsClient(t){if(!(this instanceof jobsClient))return new jobsClient(t);var r=this,i=[],o=c.DeviceClient(t);this._updateJobStatus=function(r,i,a,c,l){"function"==typeof c&&(l=c,c=void 0),u(t)||!0!==t.debug||console.log("updateJobStatus:",{thingName:r,jobId:i.id,status:a,statusDetails:c}),o.publish(buildJobTopic(r,i.id,"update"),JSON.stringify({status:a,statusDetails:c}),null,(function(t){u(t)&&(i.status={status:a,statusDetails:c}),u(l)||l(t)}))},this._buildJobObject=function(t,i){if(u(i)||u(i.jobId))return null;var o={};return o.id=i.jobId,o.document=i.jobDocument,o.operation=o.document.operation,o.status={status:i.status,statusDetails:i.statusDetails},o.inProgress=function(i,a){r._updateJobStatus(t,o,"IN_PROGRESS",i,a)},o.failed=function(i,a){r._updateJobStatus(t,o,"FAILED",i,a)},o.succeeded=function(i,a){r._updateJobStatus(t,o,"SUCCEEDED",i,a)},o},this._handleMessages=function(o,a){var c=o.split("/");if(function isJobTopic(t){return"$aws"===t[0]&&"things"===t[1]&&"jobs"===t[3]}(c)){var l=c[2],d=i.find((function(t){return t.thingName===l}));if(!u(d)){var p={};try{p=JSON.parse(a.toString())}catch(r){return void(!0===t.debug&&console.error("failed parsing JSON '"+a.toString()+"', "+r))}if(!(u(p.execution)||u(p.execution.jobId)||u(p.execution.jobDocument))){var h=p.execution.jobDocument.operation,m=d.operations.find((function(t){return u(h)?u(t.operationName):h===t.operationName}));u(m)&&(m=d.operations.find((function(t){return u(t.operationName)})),u(m))||m.callback(null,r._buildJobObject(l,p.execution))}}}else r.emit("message",o,a)},this.subscribeToJobs=function(r,a,c){u(c)&&(c=a,a=null),u(t)||!0!==t.debug||console.log("subscribeToJobs:",{thingName:r,operationName:a});var l=i.find((function(t){return t.thingName===r}));u(l)&&(l={thingName:r,operations:[]},i.push(l),o.subscribe([buildJobTopic(r,"$next/get/accepted"),buildJobTopic(r,"notify-next")],(function(t,r){u(t)||c(t)})));var d=l.operations.find((function(t){return u(a)?u(t.operationName):a===t.operationName}));u(d)?(d={operationName:a,callback:c},l.operations.push(d)):d.callback=c},this.unsubscribeFromJobs=function(r,a,c){u(c)&&(c=a,a=null),u(t)||!0!==t.debug||console.log("unsubscribeFromJobs:",{thingName:r,operationName:a});var l=i.findIndex((function(t){return t.thingName===r})),d=new Error("subscription not found for given thing");if(l<0)c(d);else{var p=i[l].operations.findIndex((function(t){return u(a)?u(t.operationName):a===t.operationName}));if(p<0)c(d);else{if(i[l].operations.splice(p,1),0===i[l].operations.length)return i.splice(l,1),void o.unsubscribe([buildJobTopic(r,"$next/get/accepted"),buildJobTopic(r,"notify-next")],c);c()}}},this.startJobNotifications=function(r,i){u(t)||!0!==t.debug||console.log("startJobNotifications:",{thingName:r}),o.publish(buildJobTopic(r,"$next","get"),"{}",i)},o.on("connect",(function(){r.emit("connect")})),o.on("close",(function(){r.emit("close")})),o.on("reconnect",(function(){r.emit("reconnect")})),o.on("offline",(function(){r.emit("offline")})),o.on("error",(function(t){r.emit("error",t)})),o.on("message",r._handleMessages),this.publish=o.publish,this.subscribe=o.subscribe,this.unsubscribe=o.unsubscribe,this.end=o.end,this.handleMessage=o.handleMessage,this.updateWebSocketCredentials=o.updateWebSocketCredentials,this.simulateNetworkFailure=o.simulateNetworkFailure}a(jobsClient,o.EventEmitter),t.exports=jobsClient},function(t,r,i){"use strict";i.r(r);var o={};i.r(o),i.d(o,"shimGetUserMedia",(function(){return shimGetUserMedia})),i.d(o,"shimMediaStream",(function(){return shimMediaStream})),i.d(o,"shimOnTrack",(function(){return shimOnTrack})),i.d(o,"shimGetSendersWithDtmf",(function(){return shimGetSendersWithDtmf})),i.d(o,"shimSenderReceiverGetStats",(function(){return shimSenderReceiverGetStats})),i.d(o,"shimAddTrackRemoveTrackWithNative",(function(){return shimAddTrackRemoveTrackWithNative})),i.d(o,"shimAddTrackRemoveTrack",(function(){return shimAddTrackRemoveTrack})),i.d(o,"shimPeerConnection",(function(){return shimPeerConnection})),i.d(o,"fixNegotiationNeeded",(function(){return fixNegotiationNeeded}));var a={};i.r(a),i.d(a,"shimGetUserMedia",(function(){return getusermedia_shimGetUserMedia})),i.d(a,"shimGetDisplayMedia",(function(){return shimGetDisplayMedia})),i.d(a,"shimOnTrack",(function(){return firefox_shim_shimOnTrack})),i.d(a,"shimPeerConnection",(function(){return firefox_shim_shimPeerConnection})),i.d(a,"shimSenderGetStats",(function(){return shimSenderGetStats})),i.d(a,"shimReceiverGetStats",(function(){return shimReceiverGetStats})),i.d(a,"shimRemoveStream",(function(){return shimRemoveStream})),i.d(a,"shimRTCDataChannel",(function(){return shimRTCDataChannel})),i.d(a,"shimAddTransceiver",(function(){return shimAddTransceiver})),i.d(a,"shimGetParameters",(function(){return shimGetParameters})),i.d(a,"shimCreateOffer",(function(){return shimCreateOffer})),i.d(a,"shimCreateAnswer",(function(){return shimCreateAnswer}));var c={};i.r(c),i.d(c,"shimLocalStreamsAPI",(function(){return shimLocalStreamsAPI})),i.d(c,"shimRemoteStreamsAPI",(function(){return shimRemoteStreamsAPI})),i.d(c,"shimCallbacksAPI",(function(){return shimCallbacksAPI})),i.d(c,"shimGetUserMedia",(function(){return safari_shim_shimGetUserMedia})),i.d(c,"shimConstraints",(function(){return shimConstraints})),i.d(c,"shimRTCIceServerUrls",(function(){return shimRTCIceServerUrls})),i.d(c,"shimTrackEventTransceiver",(function(){return shimTrackEventTransceiver})),i.d(c,"shimCreateOfferLegacy",(function(){return shimCreateOfferLegacy})),i.d(c,"shimAudioContext",(function(){return shimAudioContext}));var u={};i.r(u),i.d(u,"shimRTCIceCandidate",(function(){return shimRTCIceCandidate})),i.d(u,"shimRTCIceCandidateRelayProtocol",(function(){return shimRTCIceCandidateRelayProtocol})),i.d(u,"shimMaxMessageSize",(function(){return shimMaxMessageSize})),i.d(u,"shimSendThrowTypeError",(function(){return shimSendThrowTypeError})),i.d(u,"shimConnectionState",(function(){return shimConnectionState})),i.d(u,"removeExtmapAllowMixed",(function(){return removeExtmapAllowMixed})),i.d(u,"shimAddIceCandidateNullOrEmpty",(function(){return shimAddIceCandidateNullOrEmpty})),i.d(u,"shimParameterlessSetLocalDescription",(function(){return shimParameterlessSetLocalDescription}));let l=!0,d=!0;function extractVersion(t,r,i){const o=t.match(r);return o&&o.length>=i&&parseInt(o[i],10)}function wrapPeerConnectionEvent(t,r,i){if(!t.RTCPeerConnection)return;const o=t.RTCPeerConnection.prototype,a=o.addEventListener;o.addEventListener=function(t,o){if(t!==r)return a.apply(this,arguments);const wrappedCallback=t=>{const r=i(t);r&&(o.handleEvent?o.handleEvent(r):o(r))};return this._eventMap=this._eventMap||{},this._eventMap[r]||(this._eventMap[r]=new Map),this._eventMap[r].set(o,wrappedCallback),a.apply(this,[t,wrappedCallback])};const c=o.removeEventListener;o.removeEventListener=function(t,i){if(t!==r||!this._eventMap||!this._eventMap[r])return c.apply(this,arguments);if(!this._eventMap[r].has(i))return c.apply(this,arguments);const o=this._eventMap[r].get(i);return this._eventMap[r].delete(i),0===this._eventMap[r].size&&delete this._eventMap[r],0===Object.keys(this._eventMap).length&&delete this._eventMap,c.apply(this,[t,o])},Object.defineProperty(o,"on"+r,{get(){return this["_on"+r]},set(t){this["_on"+r]&&(this.removeEventListener(r,this["_on"+r]),delete this["_on"+r]),t&&this.addEventListener(r,this["_on"+r]=t)},enumerable:!0,configurable:!0})}function disableLog(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(l=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function disableWarnings(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(d=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function log(){if("object"==typeof window){if(l)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function deprecated(t,r){d&&console.warn(t+" is deprecated, please use "+r+" instead.")}function isObject(t){return"[object Object]"===Object.prototype.toString.call(t)}function compactObject(t){return isObject(t)?Object.keys(t).reduce((function(r,i){const o=isObject(t[i]),a=o?compactObject(t[i]):t[i],c=o&&!Object.keys(a).length;return void 0===a||c?r:Object.assign(r,{[i]:a})}),{}):t}function filterStats(t,r,i){const o=i?"outbound-rtp":"inbound-rtp",a=new Map;if(null===r)return a;const c=[];return t.forEach(t=>{"track"===t.type&&t.trackIdentifier===r.id&&c.push(t)}),c.forEach(r=>{t.forEach(i=>{i.type===o&&i.trackId===r.id&&function walkStats(t,r,i){r&&!i.has(r.id)&&(i.set(r.id,r),Object.keys(r).forEach(o=>{o.endsWith("Id")?walkStats(t,t.get(r[o]),i):o.endsWith("Ids")&&r[o].forEach(r=>{walkStats(t,t.get(r),i)})}))}(t,i,a)})}),a}const p=log;function shimGetUserMedia(t,r){const i=t&&t.navigator;if(!i.mediaDevices)return;const constraintsToChrome_=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const r={};return Object.keys(t).forEach(i=>{if("require"===i||"advanced"===i||"mediaSource"===i)return;const o="object"==typeof t[i]?t[i]:{ideal:t[i]};void 0!==o.exact&&"number"==typeof o.exact&&(o.min=o.max=o.exact);const oldname_=function(t,r){return t?t+r.charAt(0).toUpperCase()+r.slice(1):"deviceId"===r?"sourceId":r};if(void 0!==o.ideal){r.optional=r.optional||[];let t={};"number"==typeof o.ideal?(t[oldname_("min",i)]=o.ideal,r.optional.push(t),t={},t[oldname_("max",i)]=o.ideal,r.optional.push(t)):(t[oldname_("",i)]=o.ideal,r.optional.push(t))}void 0!==o.exact&&"number"!=typeof o.exact?(r.mandatory=r.mandatory||{},r.mandatory[oldname_("",i)]=o.exact):["min","max"].forEach(t=>{void 0!==o[t]&&(r.mandatory=r.mandatory||{},r.mandatory[oldname_(t,i)]=o[t])})}),t.advanced&&(r.optional=(r.optional||[]).concat(t.advanced)),r},shimConstraints_=function(t,o){if(r.version>=61)return o(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const remap=function(t,r,i){r in t&&!(i in t)&&(t[i]=t[r],delete t[r])};remap((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),remap(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=constraintsToChrome_(t.audio)}if(t&&"object"==typeof t.video){let a=t.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});const c=r.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!i.mediaDevices.getSupportedConstraints||!i.mediaDevices.getSupportedConstraints().facingMode||c)){let r;if(delete t.video.facingMode,"environment"===a.exact||"environment"===a.ideal?r=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(r=["front"]),r)return i.mediaDevices.enumerateDevices().then(i=>{let c=(i=i.filter(t=>"videoinput"===t.kind)).find(t=>r.some(r=>t.label.toLowerCase().includes(r)));return!c&&i.length&&r.includes("back")&&(c=i[i.length-1]),c&&(t.video.deviceId=a.exact?{exact:c.deviceId}:{ideal:c.deviceId}),t.video=constraintsToChrome_(t.video),p("chrome: "+JSON.stringify(t)),o(t)})}t.video=constraintsToChrome_(t.video)}return p("chrome: "+JSON.stringify(t)),o(t)},shimError_=function(t){return r.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(i.getUserMedia=function(t,r,o){shimConstraints_(t,t=>{i.webkitGetUserMedia(t,r,t=>{o&&o(shimError_(t))})})}.bind(i),i.mediaDevices.getUserMedia){const t=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(r){return shimConstraints_(r,r=>t(r).then(t=>{if(r.audio&&!t.getAudioTracks().length||r.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(t=>{t.stop()}),new DOMException("","NotFoundError");return t},t=>Promise.reject(shimError_(t))))}}}function shimMediaStream(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function shimOnTrack(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){return this._ontrackpoly||(this._ontrackpoly=r=>{r.stream.addEventListener("addtrack",i=>{let o;o=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===i.track.id):{track:i.track};const a=new Event("track");a.track=i.track,a.receiver=o,a.transceiver={receiver:o},a.streams=[r.stream],this.dispatchEvent(a)}),r.stream.getTracks().forEach(i=>{let o;o=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===i.id):{track:i};const a=new Event("track");a.track=i,a.receiver=o,a.transceiver={receiver:o},a.streams=[r.stream],this.dispatchEvent(a)})},this.addEventListener("addstream",this._ontrackpoly)),r.apply(this,arguments)}}else wrapPeerConnectionEvent(t,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function shimGetSendersWithDtmf(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const shimSenderWithDtmf=function(t,r){return{track:r,get dtmf(){return void 0===this._dtmf&&("audio"===r.kind?this._dtmf=t.createDTMFSender(r):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function getSenders(){return this._senders=this._senders||[],this._senders.slice()};const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function addTrack(t,i){let o=r.apply(this,arguments);return o||(o=shimSenderWithDtmf(this,t),this._senders.push(o)),o};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){i.apply(this,arguments);const r=this._senders.indexOf(t);-1!==r&&this._senders.splice(r,1)}}const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach(t=>{this._senders.push(shimSenderWithDtmf(this,t))})};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._senders=this._senders||[],i.apply(this,[t]),t.getTracks().forEach(t=>{const r=this._senders.find(r=>r.track===t);r&&this._senders.splice(this._senders.indexOf(r),1)})}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t},Object.defineProperty(t.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 shimSenderReceiverGetStats(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t});const i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function addTrack(){const t=i.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function getStats(){const t=this;return this._pc.getStats().then(r=>filterStats(r,t.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function getReceivers(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t}),wrapPeerConnectionEvent(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function getStats(){const t=this;return this._pc.getStats().then(r=>filterStats(r,t.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function getStats(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let r,i,o;return this.getSenders().forEach(i=>{i.track===t&&(r?o=!0:r=i)}),this.getReceivers().forEach(r=>(r.track===t&&(i?o=!0:i=r),r.track===t)),o||r&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return r.apply(this,arguments)}}function shimAddTrackRemoveTrackWithNative(t){t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(t=>this._shimmedLocalStreams[t][0])};const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function addTrack(t,i){if(!i)return r.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const o=r.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(o)&&this._shimmedLocalStreams[i.id].push(o):this._shimmedLocalStreams[i.id]=[i,o],o};const i=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach(t=>{if(this.getSenders().find(r=>r.track===t))throw new DOMException("Track already exists.","InvalidAccessError")});const r=this.getSenders();i.apply(this,arguments);const o=this.getSenders().filter(t=>-1===r.indexOf(t));this._shimmedLocalStreams[t.id]=[t].concat(o)};const o=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function removeStream(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],o.apply(this,arguments)};const a=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach(r=>{const i=this._shimmedLocalStreams[r].indexOf(t);-1!==i&&this._shimmedLocalStreams[r].splice(i,1),1===this._shimmedLocalStreams[r].length&&delete this._shimmedLocalStreams[r]}),a.apply(this,arguments)}}function shimAddTrackRemoveTrack(t,r){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&r.version>=65)return shimAddTrackRemoveTrackWithNative(t);const i=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){const t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map(t=>this._reverseStreams[t.id])};const o=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(r){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.getTracks().forEach(t=>{if(this.getSenders().find(r=>r.track===t))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[r.id]){const i=new t.MediaStream(r.getTracks());this._streams[r.id]=i,this._reverseStreams[i.id]=r,r=i}o.apply(this,[r])};const a=t.RTCPeerConnection.prototype.removeStream;function replaceInternalStreamId(t,r){let i=r.sdp;return Object.keys(t._reverseStreams||[]).forEach(r=>{const o=t._reverseStreams[r],a=t._streams[o.id];i=i.replace(new RegExp(a.id,"g"),o.id)}),new RTCSessionDescription({type:r.type,sdp:i})}function replaceExternalStreamId(t,r){let i=r.sdp;return Object.keys(t._reverseStreams||[]).forEach(r=>{const o=t._reverseStreams[r],a=t._streams[o.id];i=i.replace(new RegExp(o.id,"g"),a.id)}),new RTCSessionDescription({type:r.type,sdp:i})}t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},a.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function addTrack(r,i){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const o=[].slice.call(arguments,1);if(1!==o.length||!o[0].getTracks().find(t=>t===r))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const a=this.getSenders().find(t=>t.track===r);if(a)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const c=this._streams[i.id];if(c)c.addTrack(r),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const o=new t.MediaStream([r]);this._streams[i.id]=o,this._reverseStreams[o.id]=i,this.addStream(o)}return this.getSenders().find(t=>t.track===r)},["createOffer","createAnswer"].forEach((function(r){const i=t.RTCPeerConnection.prototype[r],o={[r](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?i.apply(this,[r=>{const i=replaceInternalStreamId(this,r);t[0].apply(null,[i])},r=>{t[1]&&t[1].apply(null,r)},arguments[2]]):i.apply(this,arguments).then(t=>replaceInternalStreamId(this,t))}};t.RTCPeerConnection.prototype[r]=o[r]}));const c=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function setLocalDescription(){return arguments.length&&arguments[0].type?(arguments[0]=replaceExternalStreamId(this,arguments[0]),c.apply(this,arguments)):c.apply(this,arguments)};const u=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=u.get.apply(this);return""===t.type?t:replaceInternalStreamId(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let r;this._streams=this._streams||{},Object.keys(this._streams).forEach(i=>{this._streams[i].getTracks().find(r=>t.track===r)&&(r=this._streams[i])}),r&&(1===r.getTracks().length?this.removeStream(this._reverseStreams[r.id]):r.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function shimPeerConnection(t,r){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(r){const i=t.RTCPeerConnection.prototype[r],o={[r](){return arguments[0]=new("addIceCandidate"===r?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=o[r]}))}function fixNegotiationNeeded(t,r){wrapPeerConnectionEvent(t,"negotiationneeded",t=>{const i=t.target;if(!(r.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return t})}function getusermedia_shimGetUserMedia(t,r){const i=t&&t.navigator,o=t&&t.MediaStreamTrack;if(i.getUserMedia=function(t,r,o){deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(t).then(r,o)},!(r.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){const remap=function(t,r,i){r in t&&!(i in t)&&(t[i]=t[r],delete t[r])},t=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),remap(r.audio,"autoGainControl","mozAutoGainControl"),remap(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},o&&o.prototype.getSettings){const t=o.prototype.getSettings;o.prototype.getSettings=function(){const r=t.apply(this,arguments);return remap(r,"mozAutoGainControl","autoGainControl"),remap(r,"mozNoiseSuppression","noiseSuppression"),r}}if(o&&o.prototype.applyConstraints){const t=o.prototype.applyConstraints;o.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),remap(r,"autoGainControl","mozAutoGainControl"),remap(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function shimGetDisplayMedia(t,r){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function getDisplayMedia(i){if(!i||!i.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===i.video?i.video={mediaSource:r}:i.video.mediaSource=r,t.navigator.mediaDevices.getUserMedia(i)})}function firefox_shim_shimOnTrack(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function firefox_shim_shimPeerConnection(t,r){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(r){const i=t.RTCPeerConnection.prototype[r],o={[r](){return arguments[0]=new("addIceCandidate"===r?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=o[r]}));const i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},o=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function getStats(){const[t,a,c]=arguments;return o.apply(this,[t||null]).then(t=>{if(r.version<53&&!a)try{t.forEach(t=>{t.type=i[t.type]||t.type})}catch(r){if("TypeError"!==r.name)throw r;t.forEach((r,o)=>{t.set(o,Object.assign({},r,{type:i[r.type]||r.type}))})}return t}).then(a,c)}}function shimSenderGetStats(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t});const i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function addTrack(){const t=i.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function getStats(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function shimReceiverGetStats(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function getReceivers(){const t=r.apply(this,[]);return t.forEach(t=>t._pc=this),t}),wrapPeerConnectionEvent(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function getStats(){return this._pc.getStats(this.track)}}function shimRemoveStream(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function removeStream(t){deprecated("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&t.getTracks().includes(r.track)&&this.removeTrack(r)})})}function shimRTCDataChannel(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function shimAddTransceiver(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype.addTransceiver;r&&(t.RTCPeerConnection.prototype.addTransceiver=function addTransceiver(){this.setParametersPromises=[];let t=arguments[1]&&arguments[1].sendEncodings;void 0===t&&(t=[]),t=[...t];const i=t.length>0;i&&t.forEach(t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const o=r.apply(this,arguments);if(i){const{sender:r}=o,i=r.getParameters();(!("encodings"in i)||1===i.encodings.length&&0===Object.keys(i.encodings[0]).length)&&(i.encodings=t,r.sendEncodings=t,this.setParametersPromises.push(r.setParameters(i).then(()=>{delete r.sendEncodings}).catch(()=>{delete r.sendEncodings})))}return o})}function shimGetParameters(t){if("object"!=typeof t||!t.RTCRtpSender)return;const r=t.RTCRtpSender.prototype.getParameters;r&&(t.RTCRtpSender.prototype.getParameters=function getParameters(){const t=r.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function shimCreateOffer(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function createOffer(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>r.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):r.apply(this,arguments)}}function shimCreateAnswer(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function createAnswer(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>r.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):r.apply(this,arguments)}}function shimLocalStreamsAPI(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach(i=>r.call(this,i,t)),t.getVideoTracks().forEach(i=>r.call(this,i,t))},t.RTCPeerConnection.prototype.addTrack=function addTrack(t,...i){return i&&i.forEach(t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]}),r.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._localStreams||(this._localStreams=[]);const r=this._localStreams.indexOf(t);if(-1===r)return;this._localStreams.splice(r,1);const i=t.getTracks();this.getSenders().forEach(t=>{i.includes(t.track)&&this.removeTrack(t)})})}}function shimRemoteStreamsAPI(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function getRemoteStreams(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach(t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,this.dispatchEvent(r)})})}});const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(r=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(r)>=0)return;t._remoteStreams.push(r);const i=new Event("addstream");i.stream=r,t.dispatchEvent(i)})}),r.apply(t,arguments)}}}function shimCallbacksAPI(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.createOffer,o=r.createAnswer,a=r.setLocalDescription,c=r.setRemoteDescription,u=r.addIceCandidate;r.createOffer=function createOffer(t,r){const o=arguments.length>=2?arguments[2]:arguments[0],a=i.apply(this,[o]);return r?(a.then(t,r),Promise.resolve()):a},r.createAnswer=function createAnswer(t,r){const i=arguments.length>=2?arguments[2]:arguments[0],a=o.apply(this,[i]);return r?(a.then(t,r),Promise.resolve()):a};let withCallback=function(t,r,i){const o=a.apply(this,[t]);return i?(o.then(r,i),Promise.resolve()):o};r.setLocalDescription=withCallback,withCallback=function(t,r,i){const o=c.apply(this,[t]);return i?(o.then(r,i),Promise.resolve()):o},r.setRemoteDescription=withCallback,withCallback=function(t,r,i){const o=u.apply(this,[t]);return i?(o.then(r,i),Promise.resolve()):o},r.addIceCandidate=withCallback}function safari_shim_shimGetUserMedia(t){const r=t&&t.navigator;if(r.mediaDevices&&r.mediaDevices.getUserMedia){const t=r.mediaDevices,i=t.getUserMedia.bind(t);r.mediaDevices.getUserMedia=t=>i(shimConstraints(t))}!r.getUserMedia&&r.mediaDevices&&r.mediaDevices.getUserMedia&&(r.getUserMedia=function getUserMedia(t,i,o){r.mediaDevices.getUserMedia(t).then(i,o)}.bind(r))}function shimConstraints(t){return t&&void 0!==t.video?Object.assign({},t,{video:compactObject(t.video)}):t}function shimRTCIceServerUrls(t){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection;t.RTCPeerConnection=function RTCPeerConnection(t,i){if(t&&t.iceServers){const r=[];for(let i=0;i<t.iceServers.length;i++){let o=t.iceServers[i];void 0===o.urls&&o.url?(deprecated("RTCIceServer.url","RTCIceServer.urls"),o=JSON.parse(JSON.stringify(o)),o.urls=o.url,delete o.url,r.push(o)):r.push(t.iceServers[i])}t.iceServers=r}return new r(t,i)},t.RTCPeerConnection.prototype=r.prototype,"generateCertificate"in r&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>r.generateCertificate})}function shimTrackEventTransceiver(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function shimCreateOfferLegacy(t){const r=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function createOffer(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const r=this.getTransceivers().find(t=>"audio"===t.receiver.track.kind);!1===t.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==t.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const i=this.getTransceivers().find(t=>"video"===t.receiver.track.kind);!1===t.offerToReceiveVideo&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==t.offerToReceiveVideo||i||this.addTransceiver("video",{direction:"recvonly"})}return r.apply(this,arguments)}}function shimAudioContext(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var h=i(62),m=i.n(h);function shimRTCIceCandidate(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const r=t.RTCIceCandidate;t.RTCIceCandidate=function RTCIceCandidate(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substring(2)),t.candidate&&t.candidate.length){const i=new r(t),o=m.a.parseCandidate(t.candidate);for(const t in o)t in i||Object.defineProperty(i,t,{value:o[t]});return i.toJSON=function toJSON(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new r(t)},t.RTCIceCandidate.prototype=r.prototype,wrapPeerConnectionEvent(t,"icecandidate",r=>(r.candidate&&Object.defineProperty(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}function shimRTCIceCandidateRelayProtocol(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||wrapPeerConnectionEvent(t,"icecandidate",t=>{if(t.candidate){const r=m.a.parseCandidate(t.candidate.candidate);"relay"===r.type&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[r.priority>>24])}return t})}function shimMaxMessageSize(t,r){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const sctpInDescription=function(t){if(!t||!t.sdp)return!1;const r=m.a.splitSections(t.sdp);return r.shift(),r.some(t=>{const r=m.a.parseMLine(t);return r&&"application"===r.kind&&-1!==r.protocol.indexOf("SCTP")})},getRemoteFirefoxVersion=function(t){const r=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===r||r.length<2)return-1;const i=parseInt(r[1],10);return i!=i?-1:i},getCanSendMaxMessageSize=function(t){let i=65536;return"firefox"===r.browser&&(i=r.version<57?-1===t?16384:2147483637:r.version<60?57===r.version?65535:65536:2147483637),i},getMaxMessageSize=function(t,i){let o=65536;"firefox"===r.browser&&57===r.version&&(o=65535);const a=m.a.matchPrefix(t.sdp,"a=max-message-size:");return a.length>0?o=parseInt(a[0].substring(19),10):"firefox"===r.browser&&-1!==i&&(o=2147483637),o},i=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){if(this._sctp=null,"chrome"===r.browser&&r.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(sctpInDescription(arguments[0])){const t=getRemoteFirefoxVersion(arguments[0]),r=getCanSendMaxMessageSize(t),i=getMaxMessageSize(arguments[0],t);let o;o=0===r&&0===i?Number.POSITIVE_INFINITY:0===r||0===i?Math.max(r,i):Math.min(r,i);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>o}),this._sctp=a}return i.apply(this,arguments)}}function shimSendThrowTypeError(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function wrapDcSend(t,r){const i=t.send;t.send=function send(){const o=arguments[0],a=o.length||o.size||o.byteLength;if("open"===t.readyState&&r.sctp&&a>r.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+r.sctp.maxMessageSize+" bytes)");return i.apply(t,arguments)}}const r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function createDataChannel(){const t=r.apply(this,arguments);return wrapDcSend(t,this),t},wrapPeerConnectionEvent(t,"datachannel",t=>(wrapDcSend(t.channel,t.target),t))}function shimConnectionState(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const r=t.RTCPeerConnection.prototype;Object.defineProperty(r,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(r,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const i=r[t];r[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const r=t.target;if(r._lastConnectionState!==r.connectionState){r._lastConnectionState=r.connectionState;const i=new Event("connectionstatechange",t);r.dispatchEvent(i)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}})}function removeExtmapAllowMixed(t,r){if(!t.RTCPeerConnection)return;if("chrome"===r.browser&&r.version>=71)return;if("safari"===r.browser&&r.version>=605)return;const i=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(r){if(r&&r.sdp&&-1!==r.sdp.indexOf("\na=extmap-allow-mixed")){const i=r.sdp.split("\n").filter(t=>"a=extmap-allow-mixed"!==t.trim()).join("\n");t.RTCSessionDescription&&r instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:r.type,sdp:i}):r.sdp=i}return i.apply(this,arguments)}}function shimAddIceCandidateNullOrEmpty(t,r){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const i=t.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function addIceCandidate(){return arguments[0]?("chrome"===r.browser&&r.version<78||"firefox"===r.browser&&r.version<68||"safari"===r.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function shimParameterlessSetLocalDescription(t,r){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const i=t.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function setLocalDescription(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return i.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return i.apply(this,[t]);const r="offer"===t.type?this.createOffer:this.createAnswer;return r.apply(this).then(t=>i.apply(this,[t]))})}var g=function adapterFactory({window:t}={},r={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const i=log,l=function detectBrowser(t){const r={browser:null,version:null};if(void 0===t||!t.navigator||!t.navigator.userAgent)return r.browser="Not a browser.",r;const{navigator:i}=t;if(i.userAgentData&&i.userAgentData.brands){const t=i.userAgentData.brands.find(t=>"Chromium"===t.brand);if(t)return{browser:"chrome",version:parseInt(t.version,10)}}if(i.mozGetUserMedia)r.browser="firefox",r.version=extractVersion(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection)r.browser="chrome",r.version=extractVersion(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return r.browser="Not a supported browser.",r;r.browser="safari",r.version=extractVersion(i.userAgent,/AppleWebKit\/(\d+)\./,1),r.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return r}(t),d={browserDetails:l,commonShim:u,extractVersion:extractVersion,disableLog:disableLog,disableWarnings:disableWarnings,sdp:h};switch(l.browser){case"chrome":if(!o||!shimPeerConnection||!r.shimChrome)return i("Chrome shim is not included in this adapter release."),d;if(null===l.version)return i("Chrome shim can not determine version, not shimming."),d;i("adapter.js shimming chrome."),d.browserShim=o,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),shimGetUserMedia(t,l),shimMediaStream(t),shimPeerConnection(t,l),shimOnTrack(t),shimAddTrackRemoveTrack(t,l),shimGetSendersWithDtmf(t),shimSenderReceiverGetStats(t),fixNegotiationNeeded(t,l),shimRTCIceCandidate(t),shimRTCIceCandidateRelayProtocol(t),shimConnectionState(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t),removeExtmapAllowMixed(t,l);break;case"firefox":if(!a||!firefox_shim_shimPeerConnection||!r.shimFirefox)return i("Firefox shim is not included in this adapter release."),d;i("adapter.js shimming firefox."),d.browserShim=a,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),getusermedia_shimGetUserMedia(t,l),firefox_shim_shimPeerConnection(t,l),firefox_shim_shimOnTrack(t),shimRemoveStream(t),shimSenderGetStats(t),shimReceiverGetStats(t),shimRTCDataChannel(t),shimAddTransceiver(t),shimGetParameters(t),shimCreateOffer(t),shimCreateAnswer(t),shimRTCIceCandidate(t),shimConnectionState(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t);break;case"safari":if(!c||!r.shimSafari)return i("Safari shim is not included in this adapter release."),d;i("adapter.js shimming safari."),d.browserShim=c,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),shimRTCIceServerUrls(t),shimCreateOfferLegacy(t),shimCallbacksAPI(t),shimLocalStreamsAPI(t),shimRemoteStreamsAPI(t),shimTrackEventTransceiver(t),safari_shim_shimGetUserMedia(t),shimAudioContext(t),shimRTCIceCandidate(t),shimRTCIceCandidateRelayProtocol(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t),removeExtmapAllowMixed(t,l);break;default:i("Unsupported browser!")}return d}({window:"undefined"==typeof window?void 0:window}),y=i(37);const getFingerPrint=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Promise.resolve(generateFingerprint(getRandomNumberGenerator(getId()+t+r)))},generateFingerprint=function(t){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var i=16*t()%16|0;return("x"===r?i:3&i|8).toString(16)}))},getId=function(){let t=localStorage.getItem("reactoo-id");return t||(t=Math.round(Math.random()*Math.pow(10,16))+"",localStorage.setItem("reactoo-id",t)),t},getRandomNumberGenerator=function(t){let r,i;for(r=0,i=1779033703^(t=(t||Math.floor(1e16*Math.random()))+"").length;r<t.length;r++)i=Math.imul(i^t.charCodeAt(r),3432918353),i=i<<13|i>>>19;return i=Math.imul(i^i>>>16,2246822507),i=Math.imul(i^i>>>13,3266489909),t=(i^i>>>16)>>>0,function(){let r=t+=1831565813;return r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r),((r^r>>>14)>>>0)/4294967296}};let wait=function(t){return new Promise(r=>setTimeout(r,t))},getBrowserFingerprint=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return getFingerPrint(t,r)},generateUUID=function(){var t=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==r?i:3&i|8).toString(16)}))};const decodeJanusDisplay=t=>{let r={userId:null,role:"participant",start:Date.now(),displayName:"?"};if(t&&"string"==typeof t){if(t.indexOf(",")>=0){let i=t.split(new RegExp('\\,(?=(?:(?:[^"]*"){2})*[^"]*$)',"mi")).map(t=>t&&t.startsWith('"')||t.endsWith('"')?t.substring(1,t.length-1):/^\d+$/.test(t)?parseInt(t):t);Object.keys(r).forEach((t,o)=>i[o]?r[t]=i[o]:null)}else r.userId=t;return r}return t&&"object"==typeof t?Object.assign({},r,t):null},setExactTimeout=function(t,r,i){const o=(new Date).getTime(),a=setInterval((function(){(new Date).getTime()-o>r&&(t(),clearInterval(a))}),i);return a},chunkArray=function(){var t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0;if(r=[...r],null===(t=r)||void 0===t||!t.length)return[[]];let o=[];for(;r.length;)o.push(r.splice(0,i));return o};function _defineProperty(t,r,i){return(r=function _toPropertyKey(t){var r=function _toPrimitive(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,r||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(r))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}class wt_room_Room{constructor(t){this.debug=t,this.sessions=[],this.safariVp8=!1,this.browser=g.browserDetails.browser,this.browserDetails=g.browserDetails,this.webrtcSupported=wt_room_Room.isWebrtcSupported(),this.safariVp8TestPromise=wt_room_Room.testSafariVp8(),this.safariVp8=null,this.safariVp8TestPromise.then(t=>{this.safariVp8=t}),this.whenInitialized=this.initialize()}initialize(){return this.safariVp8TestPromise.then(()=>this)}createSession(){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new wt_room_RoomSession(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"reactooroom",{debug:this.debug,...t})}static testSafariVp8(){return new Promise(t=>{if("safari"===g.browserDetails.browser&&g.browserDetails.version>=605)if(RTCRtpSender&&RTCRtpSender.getCapabilities&&RTCRtpSender.getCapabilities("video")&&RTCRtpSender.getCapabilities("video").codecs&&RTCRtpSender.getCapabilities("video").codecs.length){var r=!1;for(var i in RTCRtpSender.getCapabilities("video").codecs){var o=RTCRtpSender.getCapabilities("video").codecs[i];if(o&&o.mimeType&&"video/vp8"===o.mimeType.toLowerCase()){r=!0;break}}t(r)}else{var a=new RTCPeerConnection({},{});a.createOffer({offerToReceiveVideo:!0}).then((function(r){let i=-1!==r.sdp.indexOf("VP8");a.close(),a=null,t(i)}))}else t(!1)})}static isWebrtcSupported(){return void 0!==window.RTCPeerConnection&&null!==window.RTCPeerConnection&&void 0!==navigator.mediaDevices&&null!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia&&null!==navigator.mediaDevices.getUserMedia}}class wt_room_RoomSession{static noop(){}static randomString(t){for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i="",o=0;o<t;o++){var a=Math.floor(Math.random()*r.length);i+=r.substring(a,a+1)}return i}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"reactooroom",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_defineProperty(this,"_intercomSubscribe",t=>{var r;if("data"===t.type)return!0;return((null===(r=JSON.parse(t.description||"[]"))||void 0===r?void 0:r.intercomGroups)||[]).some(t=>this._listenIntercomChannels.indexOf(t)>-1)}),Object.assign(this,Object(y.a)()),this.options={...i},this.defaultDataChannelLabel="JanusDataChannel",this.server=null,this.iceServers=null,this.token=null,this.roomId=null,this.streamId=null,this.pin=null,this.userId=null,this.sessiontype=r,this.initialBitrate=0,this.enableDtx=!1,this.simulcast=!1,this.defaultSimulcastSettings={default:{mode:"controlled",defaultSubstream:0,bitrates:[{rid:"l",active:!0,maxBitrate:18e4,maxFramerate:20,scaleResolutionDownBy:3.3333333333333335,priority:"low"},{rid:"m",active:!0,maxBitrate:5e5,maxFramerate:25,scaleResolutionDownBy:1.3333333333333335,priority:"low"},{rid:"h",active:!0,maxBitrate:2e6,maxFramerate:30,priority:"low"}]}},this.recordingFilename=null,this.pluginName=wt_room_RoomSession.sessionTypes[r],this.id=null,this.privateId=null,this.constructId=t||wt_room_RoomSession.randomString(16),this.sessionId=null,this.handleId=null,this.ws=null,this.isRestarting=!1,this.isConnecting=!1,this.isDisconnecting=!1,this.isConnected=!1,this.isPublished=!1,this.isReclaiming=!1,this.isStreaming=!1,this.isMuted=[],this.isVideoEnabled=!1,this.isAudioEnabed=!1,this._statsMaxLength=31,this._upStatsLength=30,this._downStatsLength=5,this._statsTimeoutStopped=!0,this._statsTimeoutId=null,this._statsInterval=1e3,this._aqInterval=2500,this._aqIntervalCounter=0,this._aqIntervalDivisor=4,this._aqTimeoutId=null,this._sendMessageTimeout=5e3,this._retries=0,this._maxRetries=5,this._keepAliveId=null,this._participants=[],this._restrictSubscribeToUserIds=[],this._talkIntercomChannels=["participants"],this._listenIntercomChannels=["participants"],this._roomType="watchparty",this._isDataChannelOpen=!1,this._abortController=null,this._remoteUsersCache=[],this.userRoleSubscriptionRules={...wt_room_RoomSession.userRoleSubscriptionRules,...this.options.userRoleSubscriptionRules||{}},this._log=wt_room_RoomSession.noop,this.options.debug&&this._enableDebug()}_pushToRemoteUsersCache(t,r,i){const o=this._remoteUsersCache.findIndex(r=>r.userId===t);o>-1?this._remoteUsersCache.splice(o,1,{userId:t,streams:r,id:i}):this._remoteUsersCache.push({userId:t,streams:r,id:i})}_removeFromRemoteUsersCache(t){const r=this._remoteUsersCache.findIndex(r=>r.id===t);r>-1&&this._remoteUsersCache.splice(r,1)}_participantShouldSubscribe(t){const r=decodeJanusDisplay(this.display),i=decodeJanusDisplay(t);let o=(null==r?void 0:r.role)||"participant",a=(null==i?void 0:i.role)||"participant";return this.userRoleSubscriptionRules[o][this._roomType||"watchparty"].indexOf(a)>-1&&(0===this._restrictSubscribeToUserIds.length||this._restrictSubscribeToUserIds.indexOf(null==i?void 0:i.userId)>-1)}_getAddParticipantEventName(t){var r;let i=this._getHandle(t);if(!i)return void this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"getParticipantEventName"]});switch(null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.role){case"participant":return"addRemoteParticipant";case"talkback":case"monitor":return"addRemoteTalkback";case"observer":case"observerSolo1":case"observerSolo2":case"observerSolo3":return"addRemoteObserver";case"host":return"addRemoteInstructor";case"companionTV":return"addRemoteCompanionTV";case"companionPhone":return"addRemoteCompanionPhone";default:return"addRemoteParticipant"}}_getRemoveParticipantEventName(t){var r;let i=this._getHandle(t);if(!i)return void this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"getParticipantEventName"]});switch(null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.role){case"participant":return"removeRemoteParticipant";case"talkback":case"monitor":return"removeRemoteTalkback";case"observer":case"observerSolo1":case"observerSolo2":case"observerSolo3":return"removeRemoteObserver";case"host":return"removeRemoteInstructor";case"companionTV":return"removeRemoteCompanionTV";case"companionPhone":return"removeRemoteCompanionPhone";default:return"removeRemoteParticipant"}}sendMessage(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{body:"Example Body"},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return this._send({janus:"message",handle_id:t,...r},i,o,a).then(t=>{if(t&&"success"===t.janus){let r=(t.plugindata||{}).data;return Promise.resolve(r)}return Promise.resolve()}).catch(t=>t&&t.error?Promise.reject({type:"warning",id:1,message:"sendMessage failed",data:t.error}):Promise.reject({type:"warning",id:1,message:"sendMessage failed",data:t}))}_send(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=wt_room_RoomSession.randomString(12),c={...t,transaction:a,token:this.token,...this.sessionId&&{session_id:this.sessionId}||{}};this._log(c);return(()=>new Promise((t,o)=>{let u=null,abortResponse=()=>{this._abortController.signal.removeEventListener("abort",abortResponse),clearTimeout(u),this.ws.removeEventListener("message",parseResponse),o({type:"warning",id:17,message:"connection cancelled"})},parseResponse=r=>{let l=JSON.parse(r.data);var d;l.transaction!==a||i&&"ack"===l.janus||(clearTimeout(u),this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),"error"===l.janus?(403==(null==l||null===(d=l.error)||void 0===d?void 0:d.code)&&this.disconnect(!0),o({type:"error",id:2,message:"send failed",data:l,requestData:c})):t(l))};r?(this.ws&&1===this.ws.readyState&&this.ws.send(JSON.stringify(c)),t()):this.ws&&1===this.ws.readyState?(this.ws.addEventListener("message",parseResponse),u=setTimeout(()=>{this.ws.removeEventListener("message",parseResponse),this._abortController.signal.removeEventListener("abort",abortResponse),o({type:"warning",id:3,message:"send timeout",data:c})},this._sendMessageTimeout),this._abortController.signal.addEventListener("abort",abortResponse),this.ws.send(JSON.stringify(c))):o({type:"warning",id:29,message:"No connection to WebSockets",data:c})}))().catch(a=>17===a.id?Promise.reject(a):29===a.id&&o>0?wait(this._sendMessageTimeout).then(()=>this._send(t,r,i,o-1)):o>0?this._send(t,r,i,o-1):Promise.reject(a))}_connectionClosed(){!this.isConnected||this.isConnecting||this.isDisconnecting||(this._retries<this._maxRetries?setTimeout(()=>{this._retries++,this._reconnect().catch(t=>{this.emit("error",t)})},3e3*this._retries):("reactooroom"===this.sessiontype?this.disconnect(!0):"streaming"===this.sessiontype&&this.stopStream(),this.emit("error",{type:"error",id:4,message:"Lost connection to WebSockets",data:null})))}_wipeListeners(){this.ws&&(this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn))}_startKeepAlive(){this._send({janus:"keepalive"}).then(t=>{"ack"!==t.janus&&this.emit("error",{type:"warning",id:5,message:"keepalive response suspicious",data:t.janus})}).catch(t=>{this.emit("error",{type:"warning",id:6,message:"keepalive dead",data:t}),this._connectionClosed()}),this._keepAliveId=setTimeout(()=>{this._startKeepAlive()},1e4)}_stopKeepAlive(){clearTimeout(this._keepAliveId)}_handleWsEvents(t){let r=JSON.parse(t.data);var i=r.sender,o=r.janus;let a=this._getHandle(i);if(a){if("trickle"===o){let t=r.candidate,i=a.webrtcStuff;i.pc&&i.remoteSdp?t&&!0!==t.completed?i.pc.addIceCandidate(t):i.pc.addIceCandidate(null):(i.candidates||(i.candidates=[]),i.candidates.push(t))}else"webrtcup"===o||("hangup"===o?(this._log("hangup on",a.handleId,a.handleId===this.handleId,r),this._removeParticipant(a.handleId,null,!1)):"detached"===o?(this._log("detached on",a.handleId,a.handleId===this.handleId,r),this._removeParticipant(a.handleId,null,!0)):"media"===o?this._log("Media event:",a.handleId,r.type,r.receiving,r.mid):"slowlink"===o?this._log("Slowlink",a.handleId,r.uplink,r.lost,r.mid):"event"===o||("timeout"===o?(this._log("WebSockets Gateway timeout",r),this.ws.close(3504,"Gateway timeout")):"success"===o||"error"===o||this._log(`Unknown event: ${o} on session: ${this.sessionId}`)));if(i===this.handleId){if("event"===o){var c=(r.plugindata||{}).data||{},u=r.jsep;let t=c.result||null,o=c.videoroom||null,p=c.publishers||{},h=c.leaving,m=c.kicked,g=c.substream,y=c.temporal,v=c.unpublished,b=c.error;if("joined"===o){var l,d;this.id=c.id,this.privateId=c.private_id,this.isConnected=!0,this._log("We have successfully joined Room"),this.emit("joined",!0,this.constructId),this.emit("addLocalParticipant",{tid:generateUUID(),id:a.handleId,constructId:this.constructId,userId:null===(l=decodeJanusDisplay(a.userId))||void 0===l?void 0:l.userId,role:null===(d=decodeJanusDisplay(this.display))||void 0===d?void 0:d.role,track:null,stream:null,streamMap:{},source:null,adding:!1,removing:!1,hasAudioTrack:!1,hasVideoTrack:!1});for(let t in p){let r=p[t].display,i=p[t].streams||[],o=p[t].id;for(let t in i)i[t].id=o,i[t].display=r;this._log("Remote userId: ",r),this._pushToRemoteUsersCache(r,i,o),this._participantShouldSubscribe(r)&&(this._log("Creating user: ",r),this._createParticipant(r,o).then(t=>{this._updateParticipantsTrackData(t.handleId,i);const r=i.filter(t=>!t.disabled&&this._intercomSubscribe(t)).map(t=>({feed:t.id,mid:t.mid}));return t.webrtcStuff.subscribeMap=structuredClone(r),this.sendMessage(t.handleId,{body:{request:"join",room:this.roomId,ptype:"subscriber",private_id:this.privateId,streams:r,...this.webrtcVersion>1e3?{id:this.userId}:{},pin:this.pin}})}).catch(t=>{this.emit("error",t)}))}}else if("event"===o){null!=g&&this._log("Substream event:",g,i),null!=y&&this._log("Temporal event:",y),void 0!==c.streams&&null!==c.streams&&this._log("Got my own streams back",c.streams);for(let t in p){let r=p[t].display,i=p[t].streams||[],o=p[t].id;for(let t in i)i[t].id=o,i[t].display=r;if(this._log("Remote userId: ",r),this._pushToRemoteUsersCache(r,i,o),this._participantShouldSubscribe(r)){let t=this._getHandle(null,o);if(t){this._updateParticipantsTrackData(t.handleId,i);let o=i.filter(r=>!r.disabled&&this._intercomSubscribe(r)&&!this._isAlreadySubscribed(t.handleId,r.id,r.mid)).map(t=>({feed:t.id,mid:t.mid})),a=i.filter(t=>t.disabled||!this._intercomSubscribe(t)).map(t=>({feed:t.id,mid:t.mid}));this._updateSubscribeMap(t.handleId,o,a),this._log("Already subscribed to user: ",r,"Update streams",o,a),(o.length||a.length)&&this.sendMessage(t.handleId,{body:{request:"update",...o.length?{subscribe:o}:{},...a.length?{unsubscribe:a}:{}}})}else this._log("Creating user: ",r,i),this._createParticipant(r,o).then(t=>{this._updateParticipantsTrackData(t.handleId,i);const r=i.filter(t=>!t.disabled&&this._intercomSubscribe(t)).map(t=>({feed:t.id,mid:t.mid}));return t.webrtcStuff.subscribeMap=structuredClone(r),this.sendMessage(t.handleId,{body:{request:"join",room:this.roomId,ptype:"subscriber",private_id:this.privateId,streams:r,...this.webrtcVersion>1e3?{id:this.userId}:{},pin:this.pin}})}).catch(t=>{this.emit("error",t)})}}"ok"===h?(this._log("leaving",this.handleId,"this is us"),this._removeParticipant(this.handleId),"kicked"===c.reason&&(this.emit("kicked"),this.disconnect().catch(()=>{}))):h&&(this._log("leaving",h),this._removeFromRemoteUsersCache(h),this._removeParticipant(null,h,!0)),"ok"===v?(this._log("unpublished",this.handleId,"this is us"),this._removeParticipant(this.handleId,null,!1)):v&&(this._log("unpublished",v),this._removeFromRemoteUsersCache(v),this._removeParticipant(null,v,!0)),"ok"===m||m&&(this._log("kicked",m),this._removeFromRemoteUsersCache(m),this._removeParticipant(null,m,!0)),b&&this.emit("error",{type:"error",id:7,message:"local participant error",data:[i,c]})}else t&&t.status&&(this.emit("streamingStatus",t.status),"stopped"===t.status&&this.stopStream(),"started"===t.status&&(this.emit("streaming",!0),this.isStreaming=!0));null!=u&&("reactooroom"===this.sessiontype?this._webrtcPeer(this.handleId,u).catch(t=>{this.emit("error",t)}):"streaming"===this.sessiontype&&this._publishRemote(this.handleId,u).catch(t=>{this.emit("error",t)}))}else if("webrtcup"===o){if(this.simulcast)return;this._log("Configuring bitrate: "+this.initialBitrate),this.initialBitrate>0&&this.sendMessage(this.handleId,{body:{request:"configure",bitrate:this.initialBitrate}}).catch(()=>null)}}else{let t=(r.plugindata||{}).data||{},c=r.jsep,u=t.videoroom,l=t.error,d=t.substream,v=t.mid,b=t.temporal;var p,h,m,g,y;if(null!=d&&(this._log("Substream: ",i,v,d),this._setSelectedSubstream(i,v,d),this._resetStats(i,v),this.requestKeyFrame(i,v)),null!=b&&this._log("Temporal: ",b),"webrtcup"===o&&this.requestKeyFrame(a.handleId),"updated"===u&&(this._log("Remote has updated tracks",t),t.streams&&this._updateTransceiverMap(a.handleId,t.streams)),"attached"===u)this._log("Remote have successfully joined Room",t),t.streams&&this._updateTransceiverMap(a.handleId,t.streams||[]),this.emit(this._getAddParticipantEventName(a.handleId),{tid:generateUUID(),id:a.handleId,userId:null===(p=decodeJanusDisplay(a.userId))||void 0===p?void 0:p.userId,role:null===(h=decodeJanusDisplay(a.userId))||void 0===h?void 0:h.role,fullUserId:a.userId,stream:null,streamMap:structuredClone(null===(m=a.webrtcStuff)||void 0===m?void 0:m.streamMap),tracksMap:structuredClone(null===(g=a.webrtcStuff)||void 0===g?void 0:g.tracksMap),transceiverMap:structuredClone(null===(y=a.webrtcStuff)||void 0===y?void 0:y.transceiverMap),source:null,track:null,adding:!1,removing:!1,constructId:this.constructId,hasAudioTrack:!1,hasVideoTrack:!1});l&&this.emit("error",{type:"warning",id:8,message:"remote participant error",data:[i,t]}),c&&this._publishRemote(a.handleId,c).catch(t=>{this.emit("error",t)})}}}_handleDataEvents(t,r,i){let o=this._getHandle(t);if("state"===r){if(this._log(" - Data channel status - ","UID: "+t,"STATUS: "+JSON.stringify(i),"ME: "+(t===this.handleId)),o){o.webrtcStuff.dataChannelOpen=this.defaultDataChannelLabel===(null==i?void 0:i.label)&&"open"===(null==i?void 0:i.state)}t===this.handleId&&this.defaultDataChannelLabel===(null==i?void 0:i.label)&&(this._isDataChannelOpen="open"===(null==i?void 0:i.state),this.emit("dataChannel","open"===(null==i?void 0:i.state)))}if("error"===r){if(this.emit("error",{type:"warning",id:9,message:"data event warning",data:[t,i]}),o){let t=o.webrtcStuff;this.defaultDataChannelLabel===i.label&&(t.dataChannelOpen=!1)}t===this.handleId&&this.defaultDataChannelLabel===i.label&&(this._isDataChannelOpen=!1,this.emit("dataChannel",!1))}if(t===this.handleId&&"message"===r){let r=null;try{r=JSON.parse(i)}catch(r){return void this.emit("error",{type:"warning",id:10,message:"data message parse error",data:[t,r]})}this.emit("data",r)}}_removeParticipant(t,r){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=this._getHandle(t,r);return o?(t=o.handleId,this._send({janus:"hangup",handle_id:t},!0).then(()=>i?this._send({janus:"detach",handle_id:t},!0):Promise.resolve()).finally(()=>{try{var r,a;if(o.webrtcStuff.stream)if(this.isRestarting)null===(r=o.webrtcStuff.stream)||void 0===r||r.getTracks().forEach(t=>t.onended=null);else null===(a=o.webrtcStuff.stream)||void 0===a||a.getTracks().forEach(t=>t.stop())}catch(t){}o.webrtcStuff.stream&&(o.webrtcStuff.stream.onremovetrack=null,o.webrtcStuff.stream=null),o.webrtcStuff.dataChannel&&Object.keys(o.webrtcStuff.dataChannel).forEach(t=>{o.webrtcStuff.dataChannel[t].onmessage=null,o.webrtcStuff.dataChannel[t].onopen=null,o.webrtcStuff.dataChannel[t].onclose=null,o.webrtcStuff.dataChannel[t].onerror=null}),o.webrtcStuff.pc&&(o.webrtcStuff.pc.onicecandidate=null,o.webrtcStuff.pc.ontrack=null,o.webrtcStuff.pc.ondatachannel=null,o.webrtcStuff.pc.onconnectionstatechange=null,o.webrtcStuff.pc.oniceconnectionstatechange=null);try{o.webrtcStuff.pc.close()}catch(t){}var c,u,l,d;(o.webrtcStuff={stream:null,streamMap:{},tracksMap:[],transceiverMap:[],subscribeMap:[],mySdp:null,mediaConstraints:null,pc:null,dataChannelOpen:!1,dataChannel:null,dtmfSender:null,trickle:!0,iceDone:!1,isIceRestarting:!1,stats:{},selectedSubstream:{},initialSimulcastSubstreamBeenSet:{},overriddenSimulcastMode:{}},t===this.handleId)?(this._isDataChannelOpen=!1,this.isPublished=!1,this.emit("published",{status:!1,hasStream:!1}),this.emit("removeLocalParticipant",{id:t,userId:null===(c=decodeJanusDisplay(o.userId))||void 0===c?void 0:c.userId,role:null===(u=decodeJanusDisplay(o.userId))||void 0===u?void 0:u.role,fullUserId:o.userId})):this.emit(this._getRemoveParticipantEventName(t),{id:t,userId:null===(l=decodeJanusDisplay(o.userId))||void 0===l?void 0:l.userId,role:null===(d=decodeJanusDisplay(o.userId))||void 0===d?void 0:d.role,fullUserId:o.userId});if(i){let r=this._participants.findIndex(r=>r.handleId===t);this._participants.splice(r,1)}return!0})):Promise.resolve()}_createParticipant(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._send({janus:"attach",plugin:this.pluginName}).then(i=>{let o={handleId:i.data.id,rfid:r,userId:t,webrtcStuff:{stream:null,streamMap:{},tracksMap:[],transceiverMap:[],subscribeMap:[],mySdp:null,mediaConstraints:null,pc:null,dataChannelOpen:!1,dataChannel:null,dtmfSender:null,trickle:!0,iceDone:!1,isIceRestarting:!1,stats:{},selectedSubstream:{},initialSimulcastSubstreamBeenSet:{},overriddenSimulcastMode:{}}};return this._participants.push(o),o})}_updateSubscribeMap(t,r,i){let o=this._getHandle(t);if(!o)return void this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"updateSubscribeMap"]});let a=o.webrtcStuff.subscribeMap;r.forEach(t=>{a.find(r=>r.feed===t.feed&&r.mid===t.mid)||a.push(t)}),i.forEach(t=>{let r=a.findIndex(r=>r.feed===t.feed&&r.mid===t.mid);r>-1&&a.splice(r,1)})}_isAlreadySubscribed(t,r,i){let o=this._getHandle(t);return o?o.webrtcStuff.subscribeMap.findIndex(t=>t.mid===i&&t.feed===r)>-1:(this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"isAlreadySubscribed"]}),!1)}_updateTransceiverMap(t,r){this._log("Updating current transceiver map",t,r);let i=this._getHandle(t);i?i.webrtcStuff.transceiverMap=structuredClone(r):this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"updateTransceiverMap"]})}_updateParticipantsTrackData(t,r){this._log("Updating participants track data",t,r);let i=this._getHandle(t);i?i.webrtcStuff.tracksMap=structuredClone(r.map(t=>{let r=null,i=null;try{const o=JSON.parse(t.description);r=null==o?void 0:o.source,i=null==o?void 0:o.simulcastBitrates}catch(t){}return{active:!t.disabled,description:t.description,source:r,simulcastBitrates:i,display:t.display,id:t.id,mid:t.mid,mindex:t.mindex,codec:t.codec,type:t.type}})):this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"updateParticipantsTrackData"]})}_updateRemoteParticipantStreamMap(t){this._log("Updating participants stream map",t);let r=this._getHandle(t);if(!r)return void this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"updateRemoteParticipantStreamMap"]});let i=r.webrtcStuff;i.streamMap={},i.transceiverMap.forEach(t=>{var r,o,a,c;if("data"===t.type)return;if(!1===t.active)return;const u=null===(r=JSON.parse(t.feed_description))||void 0===r?void 0:r.source;i.streamMap[u]||(i.streamMap[u]=[]);let l=null===(o=i.pc.getTransceivers().find(r=>r.mid===t.mid))||void 0===o||null===(a=o.receiver)||void 0===a||null===(c=a.track)||void 0===c?void 0:c.id;l&&i.streamMap[u].push(l)})}_joinRoom(t,r,i,o){return this.sendMessage(this.handleId,{body:{request:"join",room:t,pin:r,ptype:"publisher",display:o,...this.webrtcVersion>1e3?{id:i}:{}}},!1,!0)}_watchStream(t){return this.sendMessage(this.handleId,{body:{request:"watch",id:String(t)}},!1,!0)}_leaveRoom(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isConnected?this.sendMessage(this.handleId,{body:{request:"leave"}},t).finally(()=>{this.isConnected=!1,this.emit("joined",!1)}):Promise.resolve()}_reconnect(){return this.isReclaiming?Promise.resolve():(this.ws&&(this._wipeListeners(),1===this.ws.readyState&&this.ws.close()),this._stopKeepAlive(),this.isReclaiming=!0,this.emit("joining",!0),new Promise((t,r)=>{let abortReconnect=()=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isReclaiming=!1,this.emit("joining",!1),r({type:"warning",id:17,message:"Connection cancelled",data:e})};this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this),this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this._send({janus:"claim"}).then(r=>{this.sessionId=r.session_id?r.session_id:r.data.id,this._startKeepAlive(),this.isReclaiming=!1,this.emit("joining",!1),this._retries=0,t(r)}).catch(t=>{this.isReclaiming=!1,this.emit("joining",!1),r({type:"error",id:11,message:"reconnection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this.isReclaiming=!1,this.emit("joining",!1),r({type:"warning",id:12,message:"ws reconnection error",data:t})},this._abortController.signal.addEventListener("abort",abortReconnect)}))}connect(t,r,i,o,a,c,u){let l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,p=arguments.length>9?arguments[9]:void 0,h=arguments.length>10&&void 0!==arguments[10]&&arguments[10],m=arguments.length>11&&void 0!==arguments[11]?arguments[11]:this.defaultSimulcastSettings,g=arguments.length>12&&void 0!==arguments[12]&&arguments[12];return this.isConnecting?Promise.reject({type:"warning",id:16,message:"connection already in progress"}):(this.ws&&this._wipeListeners(),this._stopKeepAlive(),this._abortController=new AbortController,this.sessionId=null,this.server=i,this.iceServers=o,this.token=a,this.roomId=t,this.pin=r,this.display=c,this.userId=u,this.webrtcVersion=l,this.initialBitrate=d,this.recordingFilename=p,this.isConnecting=!0,this.enableDtx=g,this.simulcast=h,this.simulcastSettings=structuredClone(m),this.simulcastSettings&&"object"==typeof this.simulcastSettings&&Object.keys(this.simulcastSettings).length&&Object.keys(this.simulcastSettings).forEach(t=>{this.simulcastSettings[t].bitrates=this.simulcastSettings[t].bitrates.sort((t,r)=>t.maxBitrate===r.maxBitrate?t.maxFramerate-r.maxFramerate:t.maxBitrate-r.maxBitrate)}),this.emit("joining",!0),new Promise((i,o)=>{this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this);let abortConnect=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isConnecting=!1,this.emit("joining",!1),o({type:"warning",id:17,message:"Connection cancelled"})};this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this._retries=0,this._send({janus:"create"}).then(t=>(this.sessionId=t.session_id?t.session_id:t.data.id,this._startKeepAlive(),1)).then(()=>this._createParticipant(u)).then(t=>(this.handleId=t.handleId,1)).then(()=>this._joinRoom(t,r,u,c)).then(()=>{this._enableStatsWatch(),this._enableSubstreamAutoSelect(),this.isConnecting=!1,this.emit("joining",!1),i(this)}).catch(t=>{this.isConnecting=!1,this.emit("joining",!1),o({type:"warning"===(null==t?void 0:t.type)?"warning":"error",id:13,message:"connection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.isConnecting=!1,this.emit("joining",!1),o({type:"error",id:14,message:"ws connection error",data:t})},this._abortController.signal.addEventListener("abort",abortConnect)}))}disconnect(){var t,r;if(this.isDisconnecting)return Promise.resolve();null===(t=this._abortController)||void 0===t||null===(r=t.abort)||void 0===r||r.call(t),this.isDisconnecting=!0,this._stopKeepAlive(),this._disableStatsWatch(),this._disableSubstreamAutoSelect();let i=this.isConnected;return Promise.all(this._participants.map(t=>this._removeParticipant(t.handleId))).finally(()=>(this._wipeListeners(),this.ws&&1===this.ws.readyState&&(this._send({janus:"destroy"},!0),this.ws.close()),this.sessionId=null,this.isPublished=!1,this.isConnected=!1,this.isDisconnecting=!1,this.emit("publishing",!1),this.emit("published",{status:!1,hasStream:!1}),this.emit("joining",!1),this.emit("joined",!1),this.emit("disconnect",i),Promise.resolve("Disconnected")))}startStream(t,r,i,o,a){return this.isConnecting?Promise.reject({type:"warning",id:16,message:"connection error",data:"Connection is in progress"}):(this.ws&&this._wipeListeners(),this._stopKeepAlive(),this._abortController=new AbortController,this.server=r,this.iceServers=i,this.token=o,this.streamId=t,this.userId=a,this.sessionId=null,this.isConnecting=!0,this.emit("streamStarting",!0),new Promise((r,i)=>{this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this);let abortConnect=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isConnecting=!1,this.emit("streamStarting",!1),i({type:"warning",id:17,message:"Connection cancelled"})};this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this._retries=0,this._send({janus:"create"}).then(t=>(this.sessionId=t.session_id?t.session_id:t.data.id,this._startKeepAlive(),1)).then(()=>this._createParticipant(a)).then(t=>(this.handleId=t.handleId,1)).then(()=>this._watchStream(t)).then(()=>{this.isConnecting=!1,this.emit("streamStarting",!1),r(this)}).catch(t=>{this.isConnecting=!1,this.emit("streamStarting",!1),i({type:"error",id:13,message:"connection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.isConnecting=!1,this.emit("streamStarting",!1),i({type:"error",id:14,message:"ws connection error",data:t})},this._abortController.signal.addEventListener("abort",abortConnect)}))}stopStream(){var t,r;if(this.isDisconnecting)return Promise.resolve();null===(t=this._abortController)||void 0===t||null===(r=t.abort)||void 0===r||r.call(t),this._stopKeepAlive();let i=this.isStreaming;return this.isDisconnecting=!0,this._removeParticipant(this.handleId).finally(()=>(this.sendMessage(this.handleId,{body:{request:"stop"}},!0),this._wipeListeners(),this._send({janus:"destroy"},!0),this.ws&&1===this.ws.readyState&&this.ws.close(),this.sessionId=null,this.isDisconnecting=!1,this.isStreaming=!1,this.emit("streamStarting",!1),this.emit("streaming",!1),this.emit("disconnect",i),Promise.resolve("Disconnected")))}destroy(){return"reactooroom"===this.sessiontype?this.disconnect().then(()=>(this.clear(),!0)):"streaming"===this.sessiontype?this.stopStream().then(()=>(this.clear(),!0)):void 0}_enableDebug(){this._log=console.log.bind(console)}_getHandle(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return this._participants.find(a=>{var c;return a.handleId===t||r&&a.rfid===r||i&&(null===(c=decodeJanusDisplay(a.userId))||void 0===c?void 0:c.userId)===i||o&&a.userId===o})}_findSimulcastConfig(t,r){return Object.keys(r).reduce((i,o)=>{var a;return r[t]?r[t]:t.indexOf(null===(a=o.match(/\*(.*?)\*/))||void 0===a?void 0:a[1])>-1?r[o]:i},r.default)}_disableStatsWatch(){this._statsTimeoutId&&(clearInterval(this._statsTimeout),this._statsTimeoutStopped=!0,this._statsTimeoutId=null)}_enableStatsWatch(){this._statsTimeoutId&&(clearTimeout(this._statsTimeoutId),this._statsTimeoutId=null),this._statsTimeoutStopped=!1;const loop=()=>{let t=performance.now(),r=null;this._getStats("video").then(t=>{r=performance.now(),this._parseVideoStats(t)}).finally(()=>{this._statsTimeoutStopped||(this._statsTimeoutId=setTimeout(loop,this._statsInterval-Math.min(r-t,this._statsInterval)))})};loop()}_enableSubstreamAutoSelect(){if(!this.simulcast)return;this._aqTimeoutId&&(clearTimeout(this._aqTimeoutId),this._aqTimeoutId=null,this._aqIntervalCounter=0);const checkStats=()=>{this._participants.forEach(t=>{if(t.handleId!==this.handleId){var r,i,o;const a=null===(r=t.webrtcStuff)||void 0===r||null===(i=r.pc)||void 0===i?void 0:i.getTransceivers();((null==a||null===(o=a.filter(t=>"video"===t.receiver.track.kind))||void 0===o?void 0:o.map(t=>t.mid))||[]).forEach(r=>{var i,o,a,c;const{source:u,simulcastBitrates:l}=t.webrtcStuff.tracksMap.find(t=>t.mid===r)||{};if(!l)return;const d=this._findSimulcastConfig(u,this.simulcastSettings),p=!!t.webrtcStuff.initialSimulcastSubstreamBeenSet[r],h=(null===(i=t.webrtcStuff)||void 0===i||null===(o=i.overriddenSimulcastMode[r])||void 0===o?void 0:o.defaultSubstream)||(null==d?void 0:d.defaultSubstream),m=(null===(a=t.webrtcStuff)||void 0===a||null===(c=a.overriddenSimulcastMode[r])||void 0===c?void 0:c.mode)||(null==d?void 0:d.mode);if("browserControlled"===m);else if("manual"===m&&this._aqIntervalCounter%this._aqIntervalDivisor==0||!p){t.webrtcStuff.initialSimulcastSubstreamBeenSet[r]=!0;const i=t.webrtcStuff.selectedSubstream[r];null!=h&&h!==i&&(this._log("Attempting to force substream quality",h),this.selectSubStream(t.handleId,h,void 0,r,!1).catch(t=>this._log(`Changing substream for mid: ${r} failed. Reason: ${t}`)))}else if("controlled"===m){var g,y,v,b,_,w;const i=t.webrtcStuff.selectedSubstream[r],o=null==l?void 0:l[l.length-1-i];let a=0;if((null===(g=t.webrtcStuff)||void 0===g||null===(y=g.stats)||void 0===y||null===(v=y[r])||void 0===v?void 0:v.length)>this._upStatsLength){const i=this._calculateMedianStats(t.webrtcStuff.stats[r].slice(-1*this._upStatsLength));(null==i?void 0:i.framesPerSecond)>=Math.floor(.7*((null==o?void 0:o.maxFramerate)||30))&&(null==i?void 0:i.freezeDurationSinceLast)<this._upStatsLength*this._statsInterval*.33/1e3&&(a=1)}if((null===(b=t.webrtcStuff)||void 0===b||null===(_=b.stats)||void 0===_||null===(w=_[r])||void 0===w?void 0:w.length)>this._downStatsLength){const i=this._calculateMedianStats(t.webrtcStuff.stats[r].slice(-1*this._downStatsLength));((null==i?void 0:i.framesPerSecond)<Math.floor(.7*((null==o?void 0:o.maxFramerate)||30))||(null==i?void 0:i.freezeDurationSinceLast)>this._downStatsLength*this._statsInterval*.33/1e3)&&(a=-1)}-1===a?i<l.length-1&&(this._log("Attempting to down the quality for mid: ",r," quality:",i+1),this._resetStats(t.handleId,r),this.selectSubStream(t.handleId,i+1,void 0,r,!1).catch(t=>this._log(`Changing substream for mid: ${r} failed. Reason: ${t}`))):1===a?i>0&&(this._log("Attempting to up the quality for mid: ",r," quality:",i-1),this._resetStats(t.handleId,r),this.selectSubStream(t.handleId,i-1,void 0,r,!1).catch(t=>this._log(`Changing substream for mid: ${r} failed. Reason: ${t}`))):this._log("No quality change for mid: ",r)}})}}),this._aqIntervalCounter++,this._aqTimeoutId=setTimeout(checkStats,this._aqInterval)};checkStats()}_disableSubstreamAutoSelect(){this._aqTimeoutId&&(clearTimeout(this._aqTimeoutId),this._aqTimeoutId=null,this._aqIntervalCounter=0)}_calculateMedianStats(t){let r={framesPerSecond:null,jitter:null,roundTripTime:null,freezeDurationSinceLast:null,freezeCountSinceLast:null};return Object.keys(r).forEach(i=>{if("freezeDurationSinceLast"===i||"freezeCountSinceLast"===i)r[i]=t.reduce((t,r)=>t+r[i],0);else{let o=t.map(t=>t[i]);r[i]=function(t){if(0===t.length)return 0;t.sort((function(t,r){return t-r}));var r=Math.floor(t.length/2);return t.length%2?t[r]:(t[r-1]+t[r])/2}(o)}}),r.statsLength=t.length,r}_parseVideoStats(t){t.forEach(t=>{t.forEach(t=>{var r;if(null!==t&&(null==t||null===(r=t.handle)||void 0===r?void 0:r.handleId)!==this.handleId){let r=this._getHandle(t.handle.handleId);if(r){var i;r.webrtcStuff.stats[t.mid]||(r.webrtcStuff.stats[t.mid]=[]);const o={framesPerSecond:null,framesDropped:null,totalFreezesDuration:null,freezeDurationSinceLast:null,freezeCount:null,jitter:null,packetsLost:null,nackCount:null,roundTripTime:null,width:null,height:null,networkType:null,powerEfficientDecoder:null};t.stats.forEach(i=>{var a,c;const u=this._findSimulcastConfig(t.source,this.simulcastSettings),l=(null===(a=r.webrtcStuff)||void 0===a||null===(c=a.overriddenSimulcastMode[t.mid])||void 0===c?void 0:c.mode)||(null==u?void 0:u.mode);var d,p,h,m,g,y,v,b,_,w;"inbound-rtp"===i.type&&"video"===i.kind&&(o.framesPerSecond=i.framesPerSecond||0,o.framesDropped=i.framesDropped||0,o.totalFreezesDuration=i.totalFreezesDuration||0,o.freezeDurationSinceLast=(i.totalFreezesDuration||0)-((null===(d=r.webrtcStuff.stats)||void 0===d||null===(p=d[t.mid])||void 0===p||null===(h=p[(null===(m=r.webrtcStuff.stats)||void 0===m||null===(g=m[t.mid])||void 0===g?void 0:g.length)-1])||void 0===h?void 0:h.totalFreezesDuration)||0),o.freezeCount=i.freezeCount||0,o.freezeCountSinceLast=(i.freezeCount||0)-((null===(y=r.webrtcStuff.stats)||void 0===y||null===(v=y[t.mid])||void 0===v||null===(b=v[(null===(_=r.webrtcStuff.stats)||void 0===_||null===(w=_[t.mid])||void 0===w?void 0:w.length)-1])||void 0===b?void 0:b.freezeCount)||0),o.jitter=i.jitter,o.packetsLost=i.packetsLost,o.nackCount=i.nackCount,o.width=i.frameWidth,o.height=i.frameHeight,o.powerEfficientDecoder=i.powerEfficientDecoder);"candidate-pair"===i.type&&(o.roundTripTime=i.currentRoundTripTime),"local-candidate"===i.type&&(o.networkType=i.networkType),o.selectedSubstream=r.webrtcStuff.selectedSubstream[t.mid],o.simulcastMode=l}),r.webrtcStuff.stats[t.mid].push(o),r.webrtcStuff.stats[t.mid].length>this._statsMaxLength&&r.webrtcStuff.stats[t.mid].shift(),this.emit("rtcStats",{handleId:t.handle.handleId,stats:o,userId:null===(i=decodeJanusDisplay(t.handle.userId))||void 0===i?void 0:i.userId,source:t.source,mid:t.mid})}}})})}_getStats(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Promise.all(this._participants.map(r=>{let i=[];var o,a,c,u;if("video"===t)i=(null==r||null===(o=r.webrtcStuff)||void 0===o||null===(a=o.stream)||void 0===a?void 0:a.getVideoTracks())||[];else if("audio"===t){var l,d;i=(null==r||null===(l=r.webrtcStuff)||void 0===l||null===(d=l.stream)||void 0===d?void 0:d.getAudioTracks())||[]}if(null!==t){var p,h;const t=null==r||null===(p=r.webrtcStuff)||void 0===p||null===(h=p.pc)||void 0===h?void 0:h.getTransceivers();return Promise.all(i.map(i=>{var o;const a=Object.keys(r.webrtcStuff.streamMap).find(t=>r.webrtcStuff.streamMap[t].find(t=>t===i.id)),c=null===(o=t.find(t=>{var r,o,a,c;return(null===(r=t.receiver)||void 0===r||null===(o=r.track)||void 0===o?void 0:o.id)===i.id||(null===(a=t.sender)||void 0===a||null===(c=a.track)||void 0===c?void 0:c.id)===i.id}))||void 0===o?void 0:o.mid;return r.webrtcStuff.pc.getStats(i).then(t=>({stats:t,source:a,mid:c,handle:r})).catch(t=>Promise.reject({stats:null,error:t,handle:r,source:a,mid:c}))}))}return null==r||null===(c=r.webrtcStuff)||void 0===c||null===(u=c.pc)||void 0===u?void 0:u.getStats(null).then(t=>({handle:r,stats:t})).catch(t=>Promise.reject({handle:r,error:t}))}))}_resetStats(t,r){let i=this._getHandle(t);if(i){let t=i.webrtcStuff;r?t.stats[r]&&(t.stats[r]=[t.stats[r][t.stats[r].length-1]]):Object.keys(t.stats).forEach(r=>{t.stats[r]=[t.stats[r][t.stats[r].length-1]]})}}_sendTrickleCandidate(t,r){return this._send({janus:"trickle",candidate:r,handle_id:t},!1,!1,5)}_webrtc(t){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this._getHandle(t);if(!i)return void this.emit("error",{type:"error",id:15,message:"id non-existent",data:[t,"create rtc connection"]});let o=i.webrtcStuff;if(!o.pc){let a={iceServers:this.iceServers,iceTransportPolicy:"all",bundlePolicy:void 0,sdpSemantics:"unified-plan"},c={};"edge"===g.browserDetails.browser&&(a.bundlePolicy="max-bundle"),this._log("new RTCPeerConnection",a,c),o.pc=new RTCPeerConnection(a,c),o.pc.onnegotiationneeded=()=>{this._log("onnegotiationneeded")},o.pc.onconnectionstatechange=()=>{var r,a;("failed"===o.pc.connectionState&&(this._log("connectionState failed"),this._iceRestart(t)),this.emit("connectionState",[t,t===this.handleId,o.pc.connectionState]),t!==this.handleId&&"connected"===o.pc.connectionState)&&this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),id:i.handleId,userId:null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.userId,role:null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),track:null,source:null,constructId:this.constructId,adding:!1,removing:!1,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)})},o.pc.oniceconnectionstatechange=()=>{var r,a;("failed"===o.pc.iceConnectionState&&(this._log("iceConnectionState failed"),this._iceRestart(t)),this.emit("iceState",[t,t===this.handleId,o.pc.iceConnectionState]),t===this.handleId||"completed"!==o.pc.iceConnectionState&&"connected"!==o.pc.iceConnectionState)||this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),id:i.handleId,userId:null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.userId,role:null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),track:null,source:null,constructId:this.constructId,adding:!1,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)})},o.pc.onicecandidate=r=>{if(null==r.candidate||"edge"===g.browserDetails.browser&&r.candidate.candidate.indexOf("endOfCandidates")>0)o.iceDone=!0,this._sendTrickleCandidate(t,{completed:!0}).catch(t=>{this.emit("error",t)});else{var i={candidate:r.candidate.candidate,sdpMid:r.candidate.sdpMid,sdpMLineIndex:r.candidate.sdpMLineIndex};this._sendTrickleCandidate(t,i).catch(t=>{this.emit("error",t)})}},r&&(o.pc.ontrack=t=>{var r,a;if(t.streams&&(o.stream||(o.stream=new MediaStream),null!==(r=t.streams)&&void 0!==r&&null!==(a=r[0])&&void 0!==a&&a.onremovetrack||(t.streams[0].onremovetrack=t=>{var r,a,c,u,l;if(this._log("Remote track removed",t),null===(r=o.stream)||void 0===r||r.removeTrack(t.track),!this._getHandle(i.handleId))return;this._updateRemoteParticipantStreamMap(i.handleId);let d=null===(a=o.pc)||void 0===a||null===(c=a.getTransceivers())||void 0===c?void 0:c.find(r=>r.receiver.track===t.track),p=(null==d?void 0:d.mid)||t.track.id,h=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.track.id));this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),id:i.handleId,mid:p,constructId:this.constructId,userId:null===(u=decodeJanusDisplay(i.userId))||void 0===u?void 0:u.userId,role:null===(l=decodeJanusDisplay(i.userId))||void 0===l?void 0:l.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),source:h,track:t.track,adding:!1,removing:!0,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)})}),t.track)){var c,u,l;null===(c=o.stream)||void 0===c||c.addTrack(t.track),this._updateRemoteParticipantStreamMap(i.handleId);let r=t.transceiver?t.transceiver.mid:t.track.id,a=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.track.id));if("video"===t.track.kind&&this.requestKeyFrame(i.handleId,r),this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),mid:r,id:i.handleId,userId:null===(u=decodeJanusDisplay(i.userId))||void 0===u?void 0:u.userId,role:null===(l=decodeJanusDisplay(i.userId))||void 0===l?void 0:l.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),source:a,track:t.track,constructId:this.constructId,adding:!0,removing:!1,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)}),t.track.onended)return;t.track.onended=t=>{var r,a,c,u,l;if(this._log("Remote track ended"),null===(r=o.stream)||void 0===r||r.removeTrack(t.target),!this._getHandle(i.handleId))return;this._updateRemoteParticipantStreamMap(i.handleId);let d=null===(a=o.pc)||void 0===a||null===(c=a.getTransceivers())||void 0===c?void 0:c.find(r=>r.receiver.track===t.target),p=(null==d?void 0:d.mid)||t.target.id,h=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.target.id));this.emit(this._getAddParticipantEventName(i.handleId),{tid:generateUUID(),id:i.handleId,mid:p,constructId:this.constructId,userId:null===(u=decodeJanusDisplay(i.userId))||void 0===u?void 0:u.userId,role:null===(l=decodeJanusDisplay(i.userId))||void 0===l?void 0:l.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),tracksMap:structuredClone(o.tracksMap),transceiverMap:structuredClone(o.transceiverMap),source:h,track:t.target,adding:!1,removing:!0,hasAudioTrack:!(!o.stream||!o.stream.getAudioTracks().length),hasVideoTrack:!(!o.stream||!o.stream.getVideoTracks().length)})};let d={},p=300,h=5e3;t.track.onmute=t=>{var r,a;this._log("Remote track muted");let c=o.pc.getTransceivers().find(r=>r.receiver.track===t.target).mid||t.target.id,u=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.target.id));if(this.emit("remoteTrackMuted",{id:i.handleId,mid:c,constructId:this.constructId,userId:null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.userId,role:null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),source:u,kind:t.target.kind,track:t.target,muted:!0}),!this.simulcast)return;const l=u.indexOf("screen")>-1?h:p;d[c]||(d[c]=setTimeout(()=>{var r,o;d[c]=null;const a=this._findSimulcastConfig(u,this.simulcastSettings),l=(null===(r=i.webrtcStuff)||void 0===r||null===(o=r.overriddenSimulcastMode[c])||void 0===o?void 0:o.mode)||(null==a?void 0:a.mode),{simulcastBitrates:p}=i.webrtcStuff.tracksMap.find(t=>t.mid===c)||{};if(!p)return;const h=i.webrtcStuff.selectedSubstream[c];"browserControlled"!==l&&"video"===t.target.kind&&h<p.length-1&&(this._log("Attempting to down the quality due to track muted"),this.selectSubStream(i.handleId,h+1,void 0,c,!1).catch(t=>this._log(`Changing substream for mid: ${c} failed. Reason: ${t}`)))},l))},t.track.onunmute=t=>{var r,a;this._log("Remote track unmuted");let c=o.pc.getTransceivers().find(r=>r.receiver.track===t.target).mid||t.target.id,u=Object.keys(o.streamMap).find(r=>o.streamMap[r].includes(t.target.id));d[c]&&(clearTimeout(d[c]),d[c]=null),this.emit("remoteTrackMuted",{id:i.handleId,mid:c,constructId:this.constructId,userId:null===(r=decodeJanusDisplay(i.userId))||void 0===r?void 0:r.userId,role:null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.role,fullUserId:i.userId,stream:o.stream,streamMap:structuredClone(o.streamMap),source:u,kind:t.target.kind,track:t.target,muted:!1})}}})}if(!o.dataChannel||!o.dataChannelOpen){o.dataChannel={};var onDataChannelMessage=r=>{this._handleDataEvents(t,"message",r.data)},onDataChannelStateChange=r=>{let i=r.target.label,a=(r.target.protocol,o.dataChannel[i]?o.dataChannel[i].readyState:"null");this._handleDataEvents(t,"state",{state:a,label:i})},onDataChannelError=r=>{var i;this._handleDataEvents(t,"error",{label:null==r||null===(i=r.channel)||void 0===i?void 0:i.label,error:r})};const createDataChannel=(t,r,i)=>{let a={ordered:!0};i?o.dataChannel[t]=i:(r&&(a={...a,protocol:r}),o.dataChannel[t]=o.pc.createDataChannel(t,a)),o.dataChannel[t].onmessage=onDataChannelMessage,o.dataChannel[t].onopen=onDataChannelStateChange,o.dataChannel[t].onclose=onDataChannelStateChange,o.dataChannel[t].onerror=onDataChannelError};createDataChannel(this.defaultDataChannelLabel,null,null),o.pc.ondatachannel=function(t){createDataChannel(t.channel.label,t.channel.protocol,t.channel)}}}_webrtcPeer(t,r){let i=this._getHandle(t);if(!i)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[t,"rtc peer"]});var o=i.webrtcStuff;return null!=r?null===o.pc?(this._log("No PeerConnection: if this is an answer, use createAnswer and not _webrtcPeer"),Promise.resolve(null)):o.pc.setRemoteDescription(r).then(()=>{if(o.remoteSdp=r.sdp,o.candidates&&o.candidates.length>0){for(var t=0;t<o.candidates.length;t++){var i=o.candidates[t];i&&!0!==i.completed?o.pc.addIceCandidate(i):o.pc.addIceCandidate(null)}o.candidates=[]}return!0}).catch(r=>Promise.reject({type:"warning",id:32,message:"rtc peer",data:[t,r]})):Promise.reject({type:"warning",id:22,message:"rtc peer",data:[t,"invalid jsep"]})}_iceRestart(t){let r=this._getHandle(t);if(r){var i=r.webrtcStuff;if(!i.isIceRestarting){if(i.isIceRestarting=!0,this.handleId!==t)return this._log("Performing remote ICE restart",t),this.sendMessage(t,{body:{request:"configure",restart:!0}},!1,!1,5).then(()=>{}).then(()=>{i.isIceRestarting=!1,this._log("ICE restart success")}).catch(()=>{i.isIceRestarting=!1});{this._log("Performing local ICE restart");let r=!!(i.stream&&i.stream.getAudioTracks().length>0),o=!!(i.stream&&i.stream.getVideoTracks().length>0);this._createAO("offer",t,!0).then(i=>i?this.sendMessage(t,{body:{request:"configure",keyframe:!0,audio:r,video:o,data:!0,...this.recordingFilename?{filename:this.recordingFilename}:{}},jsep:i},!1,!1,5):null).then(t=>{i.isIceRestarting=!1,this._log("ICE restart success")}).catch(t=>{i.isIceRestarting=!1,this.emit("error",{type:"warning",id:28,message:"iceRestart failed",data:t})})}}}}_setupTransceivers(t,r){let[i,o,a,c,u=null,l=null]=r,d=this._getHandle(t);if(!d)return null;let p=d.webrtcStuff;const setTransceiver=function(t,r,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"audio";r||i?r&&i?t&&(t.setDirection?t.setDirection("sendrecv"):t.direction="sendrecv"):r&&!i?t&&(t.setDirection?t.setDirection("sendonly"):t.direction="sendonly"):!r&&i&&(t?t.setDirection?t.setDirection("recvonly"):t.direction="recvonly":p.pc.addTransceiver(o,{direction:"recvonly"})):t&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive")};if(u||l)u&&setTransceiver(u,i,o,"audio"),l&&setTransceiver(l,a,c,"video");else{let t=p.pc.getTransceivers();if(t&&t.length>0)for(let r in t){let u=t[r];(u.sender&&u.sender.track&&"audio"===u.sender.track.kind||u.receiver&&u.receiver.track&&"audio"===u.receiver.track.kind)&&setTransceiver(u,i,o,"audio"),(u.sender&&u.sender.track&&"video"===u.sender.track.kind||u.receiver&&u.receiver.track&&"video"===u.receiver.track.kind)&&setTransceiver(u,a,c,"video")}}}_createAO(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"offer",r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this._getHandle(r);if(!o)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[r,"createAO",t]});let a=null;a="offer"===t?"createOffer":"createAnswer";let c=o.webrtcStuff,u={};return i&&(u.iceRestart=!0),c.pc[a](u).then(i=>{r===this.handleId&&"offer"===t&&this.enableDtx&&(i.sdp=i.sdp.replace("useinbandfec=1","useinbandfec=1;usedtx=1")),c.mySdp=i.sdp;let o=c.pc.setLocalDescription(i).catch(t=>Promise.reject({type:"warning",id:24,message:"setLocalDescription",data:[r,t]}));if(c.mediaConstraints=u,!c.iceDone&&!c.trickle)return Promise.resolve(null);var a={type:i.type,sdp:i.sdp};return i.e2ee&&(a.e2ee=!0),"hml"!==i.rid_order&&"lmh"!==i.rid_order||(a.rid_order=i.rid_order),i.force_relay&&(a.force_relay=!0),o.then(()=>a)},t=>Promise.reject({type:"warning",id:25,message:a,data:[r,t]}))}_publishRemote(t,r){let i=this._getHandle(t);if(!i)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[t,"publish remote participant"]});this._webrtc(t,!0);let o=i.webrtcStuff;return r?o.pc.setRemoteDescription(r).then(()=>{if(o.remoteSdp=r.sdp,o.candidates&&o.candidates.length>0){for(var i=0;i<o.candidates.length;i++){var a=o.candidates[i];a&&!0!==a.completed?o.pc.addIceCandidate(a):o.pc.addIceCandidate(null)}o.candidates=[]}return this._setupTransceivers(t,[!1,!0,!1,!0]),this._createAO("answer",t,!1).then(r=>r?this.sendMessage(t,{body:{request:"start",...this.roomId&&{room:this.roomId},...this.pin&&{pin:this.pin}},jsep:r}):(this.emit("error",{type:"warning",id:19,message:"publish remote participant",data:[t,"no jsep"]}),Promise.resolve()))},r=>Promise.reject({type:"warning",id:23,message:"setRemoteDescription",data:[t,r]})):Promise.resolve()}_republishOnTrackEnded(t){let r=this._getHandle(this.handleId);if(!r)return;let i=r.webrtcStuff;if(!i.stream)return;let o=i.streamMap[t]||[],a=[];for(let t=0;t<o.length;t++){let r=i.stream.getTracks().find(r=>r.id===o[t]);r&&a.push(r)}if(a.length){let r=new MediaStream;return a.forEach(t=>r.addTrack(t)),this.publishLocal(r,t)}return this.publishLocal(null,t)}publishLocal(){var t,r,i,o,a,c,u,l;let d=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"camera0";if(this.isDisconnecting||!this.isConnected)return Promise.reject({type:"warning",id:18,message:"Either not connected or disconnecting"});if((null==d||null===(t=d.getVideoTracks())||void 0===t?void 0:t.length)>1)return Promise.reject({type:"warning",id:30,message:"multiple video tracks not supported",data:null});if((null==d||null===(r=d.getAudioTracks())||void 0===r?void 0:r.length)>1)return Promise.reject({type:"warning",id:30,message:"multiple audio tracks not supported",data:null});let h=this._getHandle(this.handleId);if(!h)return Promise.reject({type:"error",id:31,message:"no local id, connect before publishing",data:null});this.emit("publishing",!0),this._webrtc(this.handleId);let m=h.webrtcStuff;m.stream||(m.stream=new MediaStream);let y=!this.isPublished,v=m.pc.getTransceivers(),b=[...m.streamMap[p]||[]];var _;null!=d&&d.getTracks().length?m.streamMap[p]=(null==d||null===(_=d.getTracks())||void 0===_?void 0:_.map(t=>t.id))||[]:delete m.streamMap[p];let w=null==m||null===(i=m.stream)||void 0===i||null===(o=i.getAudioTracks())||void 0===o?void 0:o.find(t=>b.includes(t.id));if(w){try{w.stop()}catch(t){this._log(t)}m.stream.removeTrack(w)}let S=null==m||null===(a=m.stream)||void 0===a||null===(c=a.getVideoTracks())||void 0===c?void 0:c.find(t=>b.includes(t.id));if(S){try{S.stop()}catch(t){this._log(t)}m.stream.removeTrack(S)}const I=this._findSimulcastConfig(p,this.simulcastSettings);let k=Promise.resolve(),x=Promise.resolve(),P=null,C=null,A=null==d||null===(u=d.getAudioTracks())||void 0===u?void 0:u.length,O=null==d||null===(l=d.getVideoTracks())||void 0===l?void 0:l.length;for(const t of v){var R,M,j,L,D,B,N,U,q,W,z,V,H,$;["sendonly","sendrecv"].includes(t.currentDirection)&&"audio"===(null===(R=t.sender)||void 0===R||null===(M=R.track)||void 0===M?void 0:M.kind)&&b.includes(null===(j=t.sender)||void 0===j||null===(L=j.track)||void 0===L?void 0:L.id)?P=t:["sendonly","sendrecv"].includes(t.currentDirection)&&"video"===(null===(D=t.sender)||void 0===D||null===(B=D.track)||void 0===B?void 0:B.kind)&&b.includes(null===(N=t.sender)||void 0===N||null===(U=N.track)||void 0===U?void 0:U.id)?C=t:"inactive"===t.currentDirection&&null!==(q=t.sender)&&void 0!==q&&null!==(W=q.getParameters())&&void 0!==W&&null!==(z=W.codecs)&&void 0!==z&&z.find(t=>t.mimeType.indexOf("audio")>-1)&&A&&!P?(P=t,y=!0):"inactive"===t.currentDirection&&null!==(V=t.sender)&&void 0!==V&&null!==(H=V.getParameters())&&void 0!==H&&null!==($=H.codecs)&&void 0!==$&&$.find(t=>t.mimeType.indexOf("video")>-1)&&O&&!C&&(C=t,y=!0)}if(A?(m.stream.addTrack(d.getAudioTracks()[0]),P&&P.sender?k=P.sender.replaceTrack(d.getAudioTracks()[0]):(m.pc.addTrack(d.getAudioTracks()[0],m.stream),y=!0)):P&&P.sender&&(k=P.sender.replaceTrack(null),y=!0),O)if(m.stream.addTrack(d.getVideoTracks()[0]),C&&C.sender)x=C.sender.replaceTrack(d.getVideoTracks()[0]);else{if(this.simulcast)if("firefox"!==g.browserDetails.browser)m.pc.addTransceiver(d.getVideoTracks()[0],{direction:"sendonly",streams:[m.stream],sendEncodings:structuredClone(null==I?void 0:I.bitrates)});else{let t=m.pc.addTransceiver(d.getVideoTracks()[0],{direction:"sendonly",streams:[m.stream]}),r=t?t.sender:null;if(r){let t=r.getParameters()||{};t.encodings=d.getVideoTracks()[0].sendEncodings||structuredClone(null==I?void 0:I.bitrates),r.setParameters(t)}}else m.pc.addTrack(d.getVideoTracks()[0],m.stream);y=!0}else C&&C.sender&&(x=C.sender.replaceTrack(null),y=!0);this.isAudioEnabed=!!(m.stream&&m.stream.getAudioTracks().length>0),this.isVideoEnabled=!!(m.stream&&m.stream.getVideoTracks().length>0),v=m.pc.getTransceivers(),b=[...m.streamMap[p]||[]],P||(P=v.find(t=>t.sender.track&&"audio"===t.sender.track.kind&&b.includes(t.sender.track.id))),C||(C=v.find(t=>t.sender.track&&"video"===t.sender.track.kind&&b.includes(t.sender.track.id)));let K=!!(d&&d.getAudioTracks().length>0),G=!!(d&&d.getVideoTracks().length>0);this._setupTransceivers(this.handleId,[K,!1,G,!1,P,C]);const emitEvents=()=>{var t,r;this.isPublished=!0,m.stream.onremovetrack||(m.stream.onremovetrack=t=>{});let i=null,o=m.stream.getTracks();this.emit("addLocalParticipant",{tid:generateUUID(),id:h.handleId,userId:null===(t=decodeJanusDisplay(h.userId))||void 0===t?void 0:t.userId,role:null===(r=decodeJanusDisplay(this.display))||void 0===r?void 0:r.role,stream:o.length?m.stream:null,track:null,streamMap:structuredClone(m.streamMap),source:p,adding:!1,removing:!1,constructId:this.constructId,hasAudioTrack:K,hasVideoTrack:G}),o.length&&o.forEach(t=>{var r,o;t.onended||(this.emit("addLocalParticipant",{tid:generateUUID(),id:h.handleId,userId:null===(r=decodeJanusDisplay(h.userId))||void 0===r?void 0:r.userId,role:null===(o=decodeJanusDisplay(this.display))||void 0===o?void 0:o.role,track:t,stream:m.stream,streamMap:structuredClone(m.streamMap),source:p,adding:!0,removing:!1,constructId:this.constructId,hasAudioTrack:K,hasVideoTrack:G}),t.onended=r=>{m.stream.removeTrack(t),clearTimeout(i),i=setTimeout(()=>{this._republishOnTrackEnded(p)},100)})}),this.isMuted=[];for(const t of Object.keys(m.streamMap)){var a,c,u,l,d,g;const r=null===(a=m.stream)||void 0===a||null===(c=a.getAudioTracks())||void 0===c?void 0:c.find(r=>m.streamMap[t].includes(r.id)),i=null===(u=m.stream)||void 0===u||null===(l=u.getVideoTracks())||void 0===l?void 0:l.find(r=>m.streamMap[t].includes(r.id));this.isMuted.push({type:"audio",value:!r||!r.enabled,source:t,mid:null===(d=v.find(t=>{var i,o,a,c;return"audio"===(null===(i=t.sender)||void 0===i||null===(o=i.track)||void 0===o?void 0:o.kind)&&(null===(a=t.sender)||void 0===a||null===(c=a.track)||void 0===c?void 0:c.id)===(null==r?void 0:r.id)}))||void 0===d?void 0:d.mid}),this.isMuted.push({type:"video",value:!i||!i.enabled,source:t,mid:null===(g=v.find(t=>{var r,o,a,c;return"video"===(null===(r=t.sender)||void 0===r||null===(o=r.track)||void 0===o?void 0:o.kind)&&(null===(a=t.sender)||void 0===a||null===(c=a.track)||void 0===c?void 0:c.id)===(null==i?void 0:i.id)}))||void 0===g?void 0:g.mid}),this.emit("localHasVideo",!!i,t),this.emit("localHasAudio",!!r,t)}for(const t of this.isMuted)this.emit("localMuted",{...t});return this.emit("published",{status:!0,hasStream:o.length>0}),this.emit("publishing",!1),this};return y?(this._log("Starting negotiation"),Promise.all([k,x]).then(()=>this._createAO("offer",this.handleId,!1)).then(t=>{if(!t)return null;t.sdp&&-1===t.sdp.indexOf("\r\na=ice-ufrag")&&(t.sdp=t.sdp.replace("\na=ice-ufrag","\r\na=ice-ufrag"));let r=[];return Object.keys(m.streamMap).forEach(t=>{const i=this._findSimulcastConfig(t,this.simulcastSettings);m.streamMap[t].forEach(o=>{let a=v.find(t=>t.sender.track&&t.sender.track.id===o);a&&r.push({mid:a.mid,description:JSON.stringify({source:t,simulcastBitrates:null==i?void 0:i.bitrates,intercomGroups:this._talkIntercomChannels})})})}),this.sendMessage(this.handleId,{body:{request:"configure",audio:this.isAudioEnabed,video:this.isVideoEnabled,data:!0,...this.recordingFilename?{filename:this.recordingFilename}:{},descriptions:r},jsep:t})}).then(t=>!0===this._isDataChannelOpen?Promise.resolve(t):new Promise((t,r)=>{let i=null,_resolve=r=>{r&&(clearTimeout(i),this._abortController.signal.removeEventListener("abort",_rejectAbort),this.off("dataChannel",_resolve,this),t(this))},_rejectAbort=()=>{this._abortController.signal.removeEventListener("abort",_rejectAbort),clearTimeout(i),this.off("dataChannel",_resolve,this),r({type:"warning",id:17,message:"Connection cancelled"})};i=setTimeout(()=>{this.off("dataChannel",_resolve,this),this._abortController.signal.removeEventListener("abort",_rejectAbort),r({type:"error",id:27,message:"Data channel did not open",data:null})},1e4),this._abortController.signal.addEventListener("abort",_rejectAbort),this.on("dataChannel",_resolve,this)})).then(()=>emitEvents()).catch(t=>(this.emit("publishing",!1),Promise.reject(t)))):Promise.all([k,x]).then(()=>emitEvents())}unpublishLocal(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isPublished?this.sendMessage(this.handleId,{body:{request:"unpublish"}},t).finally(t=>(this.isPublished=!1,this.emit("published",{status:!1,hasStream:!1}),t)):Promise.resolve()}getUserTalkIntercomChannels(t){let r=[],i=this._getHandle(null,null,t);if(i){r=i.webrtcStuff.tracksMap.reduce((t,r)=>{if(r.description)try{let i=JSON.parse(r.description);i.intercomGroups&&i.intercomGroups.forEach(r=>{t.includes(r)||t.push(r)})}catch(t){}return t},[])}return r}toggleAudio(){var t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"camera0",o=arguments.length>2?arguments[2]:void 0,a=this._getHandle(this.handleId);if(!a)return void this.emit("error",{type:"warning",id:21,message:"no local id, connect first",data:null});let c=a.webrtcStuff,u=null===(t=c.pc)||void 0===t?void 0:t.getTransceivers(),l=null;l=i?null==u?void 0:u.find(t=>t.sender&&t.sender.track&&"audio"===t.receiver.track.kind&&(c.streamMap[i]||[]).includes(t.sender.track.id)):null==u?void 0:u.find(t=>t.sender&&t.sender.track&&"audio"===t.receiver.track.kind&&(!o||t.mid===o)),l&&(l.sender.track.enabled=null!==r?!!r:!l.sender.track.enabled),this.isMuted=[];for(const t of Object.keys(c.streamMap)){var d,p,h,m,g,y,v,b;const r=null===(d=c.stream)||void 0===d||null===(p=d.getAudioTracks())||void 0===p?void 0:p.find(r=>c.streamMap[t].includes(r.id)),i=null==u?void 0:u.find(t=>t.sender.track&&"audio"===t.sender.track.kind&&t.sender.track.id===(null==r?void 0:r.id)),o=null===(h=c.stream)||void 0===h||null===(m=h.getVideoTracks())||void 0===m?void 0:m.find(r=>c.streamMap[t].includes(r.id)),a=null==u?void 0:u.find(t=>t.sender.track&&"video"===t.sender.track.kind&&t.sender.track.id===(null==o?void 0:o.id));this.isMuted.push({type:"audio",value:!r||!i||!(null!=i&&null!==(g=i.sender)&&void 0!==g&&null!==(y=g.track)&&void 0!==y&&y.enabled),source:t,mid:null==i?void 0:i.mid}),this.isMuted.push({type:"video",value:!o||!a||!(null!=a&&null!==(v=a.sender)&&void 0!==v&&null!==(b=v.track)&&void 0!==b&&b.enabled),source:t,mid:null==a?void 0:a.mid})}for(let t of this.isMuted)this.emit("localMuted",{...t})}toggleVideo(){var t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"camera0",o=arguments.length>2?arguments[2]:void 0,a=this._getHandle(this.handleId);if(!a)return void this.emit("error",{type:"warning",id:21,message:"no local id, connect first",data:null});let c=a.webrtcStuff,u=null===(t=c.pc)||void 0===t?void 0:t.getTransceivers(),l=null;l=i?null==u?void 0:u.find(t=>t.sender&&t.sender.track&&"video"===t.receiver.track.kind&&(c.streamMap[i]||[]).includes(t.sender.track.id)):null==u?void 0:u.find(t=>t.sender&&t.sender.track&&"video"===t.receiver.track.kind&&(!o||t.mid===o)),l&&(l.sender.track.enabled=null!==r?!!r:!l.sender.track.enabled),this.isMuted=[];for(const t of Object.keys(c.streamMap)){var d,p,h,m,g,y,v,b;const r=null===(d=c.stream)||void 0===d||null===(p=d.getAudioTracks())||void 0===p?void 0:p.find(r=>c.streamMap[t].includes(r.id)),i=null==u?void 0:u.find(t=>t.sender.track&&"audio"===t.sender.track.kind&&t.sender.track.id===(null==r?void 0:r.id)),o=null===(h=c.stream)||void 0===h||null===(m=h.getVideoTracks())||void 0===m?void 0:m.find(r=>c.streamMap[t].includes(r.id)),a=null==u?void 0:u.find(t=>t.sender.track&&"video"===t.sender.track.kind&&t.sender.track.id===(null==o?void 0:o.id));this.isMuted.push({type:"audio",value:!r||!i||!(null!=i&&null!==(g=i.sender)&&void 0!==g&&null!==(y=g.track)&&void 0!==y&&y.enabled),source:t,mid:null==i?void 0:i.mid}),this.isMuted.push({type:"video",value:!o||!a||!(null!=a&&null!==(v=a.sender)&&void 0!==v&&null!==(b=v.track)&&void 0!==b&&b.enabled),source:t,mid:null==a?void 0:a.mid})}for(let t of this.isMuted)this.emit("localMuted",{...t})}requestKeyFrame(t,r){this.sendMessage(t,{body:{request:"configure",keyframe:!0,...void 0!==r?{streams:[{mid:r,keyframe:!0}]}:{}}}).catch(()=>null)}_setSelectedSubstream(t,r,i){let o=this._getHandle(t);if(o){let t=o.webrtcStuff;r?t.selectedSubstream[r]=i:Object.keys(t.selectedSubstream).forEach(r=>{t.selectedSubstream[r]=i})}}overrideSimulcastSettings(t,r,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{mode:a,defaultSubstream:c}=o;let u=this._getHandle(t);if(!u)return Promise.resolve();let l=u.webrtcStuff;if(void 0!==i||void 0!==r){if(void 0===r){let t=l.pc.getTransceivers();for(let o of l.streamMap[i]){let i=t.find(t=>t.receiver.track&&"video"===t.receiver.track.kind&&t.receiver.track.id===o);if(i){r=i.mid;break}}}return void 0!==r&&(l.overriddenSimulcastMode[r]||(l.overriddenSimulcastMode[r]={}),l.overriddenSimulcastMode[r].defaultSubstream=c,l.overriddenSimulcastMode[r].mode=a,!0)}}selectSubStream(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._log("Select substream called for handle:",t,"Source or mid:",i||o,"Substream:",r);let c=this._getHandle(t);if(!c)return Promise.resolve();let u=c.webrtcStuff;return new Promise((c,l)=>{let d,abortResponse=()=>{clearTimeout(d),this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),l("aborted")},parseResponse=r=>{let i=JSON.parse(r.data);var a=i.sender;if(a===t){let t=(i.plugindata||{}).data||{},r=t.substream;null==r||void 0!==o&&t.mid!==o||(clearTimeout(d),this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),c({substream:r,sender:a}))}};if(void 0!==i||void 0!==o){if(void 0===o){let t=u.pc.getTransceivers();for(let r of u.streamMap[i]){let i=t.find(t=>t.receiver.track&&"video"===t.receiver.track.kind&&t.receiver.track.id===r);if(i){o=i.mid;break}}}if(void 0!==o){if(u.overriddenSimulcastMode[o]||(u.overriddenSimulcastMode[o]={}),null===r)return a&&(u.overriddenSimulcastMode[o].defaultSubstream=null,u.overriddenSimulcastMode[o].mode=null),void c({substream:r,sender:t});a&&(u.overriddenSimulcastMode[o].defaultSubstream=r,u.overriddenSimulcastMode[o].mode="manual"),this.ws.addEventListener("message",parseResponse),this._abortController.signal.addEventListener("abort",abortResponse),d=setTimeout(()=>{this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),l("timeout")},1e4),this.sendMessage(t,{body:{request:"configure",streams:[{mid:o,substream:parseInt(r)}]}})}else l("no mid found")}else l("no source or mid")})}setTalkIntercomChannels(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["participants"];"object"==typeof t&&"length"in t||(this._log("setTalkIntercomChannels: groups must be an array"),t=[t]),this._talkIntercomChannels=structuredClone(t);let r=this._getHandle(this.handleId);if(!r)return Promise.resolve();let i=r.webrtcStuff,o=i.pc.getTransceivers(),a=[];return Object.keys(i.streamMap).forEach(r=>{const c=this._findSimulcastConfig(r,this.simulcastSettings);i.streamMap[r].forEach(i=>{let u=o.find(t=>t.sender.track&&t.sender.track.id===i);u&&a.push({mid:u.mid,description:JSON.stringify({simulcastBitrates:null==c?void 0:c.bitrates,intercomGroups:t,source:r})})})}),this.sendMessage(this.handleId,{body:{request:"configure",descriptions:a}})}setListenIntercomChannels(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["participants"];if("object"==typeof t&&"length"in t||(this._log("setListenIntercomChannels: groups must be an array"),t=[t]),this._listenIntercomChannels=structuredClone(t),!this._getHandle(this.handleId))return Promise.resolve();let r=[];return this._participants.forEach(t=>{if(t.handleId===this.handleId)return;let i=this._getHandle(t.handleId);if(i){const o=i.webrtcStuff.tracksMap.filter(t=>t.active),a=[],c=[];o.forEach(r=>{if("data"===r.type)return;const i=JSON.parse(r.description),o=(null==i?void 0:i.intercomGroups)||[];this._listenIntercomChannels.some(t=>o.includes(t))?this._isAlreadySubscribed(t.handleId,r.id,r.mid)||a.push({feed:r.id,mid:r.mid}):c.push({feed:r.id,mid:r.mid})}),this._updateSubscribeMap(t.handleId,a,c),(a.length||c.length)&&r.push(this.sendMessage(i.handleId,{body:{request:"update",...a.length?{subscribe:a}:{},...c.length?{unsubscribe:c}:{}}}))}}),Promise.all(r)}setRoomType(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"watchparty";return this._roomType=t,this._roomType}setRestrictSubscribeToUserIds(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(this._restrictSubscribeToUserIds=structuredClone(t),!this.isConnected)return Promise.resolve(this._restrictSubscribeToUserIds);this.sendMessage(this.handleId,{body:{request:"listparticipants",room:this.roomId}}).then(t=>{let r=t.participants,i=this._remoteUsersCache,o=this._getHandle(this.handleId);r=r.filter(t=>t.id!==o.userId),i=i.filter(t=>r.find(r=>r.id===t.id)),i.forEach(t=>{const r=this._getHandle(null,null,null,t.userId);var i;this._participantShouldSubscribe(t.userId)?r&&null!==(i=r.webrtcStuff)&&void 0!==i&&i.pc?this._log("Already subscribed to ",t.userId):(this._log("Subscribing to ",t.userId),this._createParticipant(t.userId,t.id).then(r=>{this._updateParticipantsTrackData(r.handleId,t.streams);const i=t.streams.filter(t=>!t.disabled&&this._intercomSubscribe(t)).map(t=>({feed:t.id,mid:t.mid}));return r.webrtcStuff.subscribeMap=structuredClone(i),this.sendMessage(r.handleId,{body:{request:"join",room:this.roomId,ptype:"subscriber",private_id:this.privateId,streams:i,...this.webrtcVersion>1e3?{id:this.userId}:{},pin:this.pin}})}).catch(t=>{this.emit("error",t)})):r&&(this._log("Unsubscribing from ",t.userId),this._removeParticipant(r.handleId))})})}}_defineProperty(wt_room_RoomSession,"sessionTypes",{reactooroom:"janus.plugin.reactooroom",streaming:"janus.plugin.streaming"}),_defineProperty(wt_room_RoomSession,"userRoleSubscriptionRules",{participant:{watchparty:["participant","talkback"],studio:["participant","talkback","host","observer"],commentary:["participant","talkback","host"],intercom:["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"],videowall:["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"],"videowall-queue":["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"],"videowall-queue-video":["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"]},monitor:{watchparty:["participant","host"],studio:["participant","host","observer"],commentary:["participant","host"],intercom:["host","participant"],videowall:["host","participant"],"videowall-queue":["host","participant"],"videowall-queue-video":["host","participant"]},talkback:{watchparty:["participant","host","talkback"],studio:["participant","host","observer","talkback"],commentary:["host","participant","talkback"],intercom:["host","participant","talkback"],videowall:["host","participant","talkback"],"videowall-queue":["host","participant","talkback"],"videowall-queue-video":["host","participant","talkback"]},observer:{watchparty:["participant"],studio:["participant"],commentary:["participant"],intercom:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo1:{watchparty:["participant"],studio:["participant"],commentary:["participant"],intercom:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo2:{watchparty:["participant"],studio:["participant"],commentary:["participant"],intercom:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo3:{watchparty:["participant"],studio:["participant"],commentary:["participant"],intercom:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},host:{watchparty:[],studio:[],commentary:[],intercom:[],videowall:[],"videowall-queue":[],"videowall-queue-video":[]},companionTV:{},companionPhone:{}});var v=wt_room_Room,b=i(345),_=i(355);class wt_iot_Iot{constructor(t){Object.assign(this,Object(y.a)()),this.device=null,this.decoder=new TextDecoder("utf-8"),this.connectionActive=!1,this.log=wt_iot_Iot.noop,this.debugFlag=t,this.credentialsExpirationCheckIntervalId=null,this.currentCredentialsExpirationStamp=null,t&&this.enableDebug()}static noop(){}enableDebug(){this.log=console.log.bind(console)}startCredentialsExpirationCheck(t){this.stopCredentialsExpirationCheck(),this.currentCredentialsExpirationStamp=new Date(t).getTime(),this.credentialsExpirationCheckIntervalId=setInterval(()=>{const t=(new Date).getTime();this.currentCredentialsExpirationStamp-t<=3e5&&this.emit("updateCredentials")},5e3)}stopCredentialsExpirationCheck(){clearInterval(this.credentialsExpirationCheckIntervalId),this.credentialsExpirationCheckIntervalId=null}updateWebSocketCredentials(t,r,i,o){this.log("iot updateWebSocketCredentials"),this.device&&(this.device.updateWebSocketCredentials(t,r,i),this.startCredentialsExpirationCheck(o))}connect(t,r,i,o,a,c,u){let l=arguments.length>7&&void 0!==arguments[7]&&arguments[7];return this.log("iot connect"),this.disconnect(l).then(()=>new Promise((l,d)=>{this.device=Object(_.device)({protocol:"wss",clientId:r,region:i,host:t,accessKeyId:o,secretKey:a,sessionToken:c,keepalive:30,maximumReconnectTimeMs:8e3,enableMetrics:!1,debug:this.debugFlag,autoResubscribe:!0}),this.startCredentialsExpirationCheck(u);let __s=()=>{var t,r;null===(t=this.device)||void 0===t||t.off("connect",__s),null===(r=this.device)||void 0===r||r.off("error",__e),l(this.device)},__e=t=>{var r,i;null===(r=this.device)||void 0===r||r.off("connect",__s),null===(i=this.device)||void 0===i||i.off("error",__e),d(t)};this.device.once("connect",__s),this.device.once("error",__e),this.device.on("message",this.__messageCb.bind(this)),this.device.on("connect",this.__connectCb.bind(this)),this.device.on("reconnect",this.__reconnectCb.bind(this)),this.device.on("error",this.__failureCb.bind(this)),this.device.on("close",this.__closeCb.bind(this)),this.device.on("offline",this.__offlineCb.bind(this))}))}disconnect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.stopCredentialsExpirationCheck(),new Promise((r,i)=>{if(!this.device)return void r();let o=null,__c=()=>{clearTimeout(o),this.device=null,r()};o=setTimeout(__c,4e3),this.device.off("message",this.__messageCb.bind(this)),this.device.off("connect",this.__connectCb.bind(this)),this.device.off("reconnect",this.__reconnectCb.bind(this)),this.device.off("error",this.__failureCb.bind(this)),this.device.off("close",this.__closeCb.bind(this)),this.device.off("offline",this.__offlineCb.bind(this)),this.device.end(t,__c)})}isConnected(){return this.connectionActive}subscribe(t){return this.log("iot subscribe",t),this.device&&this.device.subscribe(t)}unsubscribe(t){return this.log("iot unsubscribe",t),this.device&&this.device.unsubscribe(t)}send(t,r){this.log("iot send",t,r);let i="object"==typeof r?JSON.stringify(r):r;return this.device&&this.device.publish(t,i)}__reconnectCb(){this.log("iot reconnect"),this.emit("reconnect")}__connectCb(){this.log("iot connect"),this.connectionActive=!0,this.emit("connect")}__failureCb(t){this.log("iot failure"),this.emit("error",t)}__closeCb(t){this.log("iot close"),this.connectionActive=!1,this.emit("close")}__offlineCb(t){this.log("iot offline"),this.emit("offline")}__messageCb(t,r,i){const o=t.split("/");let a=JSON.parse(this.decoder.decode(r));if(a.display){const t=decodeJanusDisplay(a.display);t.userId&&(a={...a,userId:t.userId,role:t.role,start:t.start})}if("user"===o[0]){const t=o[1].replace("_",":");this.emit("message",{userId:t,...a,event:a.event?"user:"+a.event:"user"})}else if("wt"===o[0]){const t=a.event,r=o[2];if("room"===o[1])"message"===t||"template_updated"===t||"record_start"===t||"record_stop"===t||"record_configured"===t||"record_livestream_available"===t||"record_livestream_kick"===t||"user_update_displayname"===t||"user_update_avatar"===t||"user_update_bio"===t||"user_update_customattributes"===t||"user_update_privateattributes"===t||"channel_changed"===t||"instance_homepage_changed"===t||"instance_settings_changed"===t||"externalmix_changed"===t||"video_uploaded"===t||"change_user_devices"===t||"queue"===t||"title_changed"===t||"videowall_changed"===t||"left"===t||"kicked"===t||"banned"===t||"unbanned"===t||"approved"===t||"muted"===t||"unmuted"===t||"messageRemoved"===t||"messageReported"===t||"chatClear"===t||"handRaised"===t||"handLowered"===t||"handsCleared"===t||"volume_set"===t?this.emit("message",{event:t,...a,roomId:r}):"joined"!==t&&"leaving"!==t||this.emit("message",{event:t,...a,isObserver:!!a.isObserver,roomId:r});else if("instanceroom"===o[1])"add_room"!==t&&"remove_room"!==t&&"set_room"!==t&&"instance_homepage_changed"!==t&&"instance_settings_changed"!==t||this.emit("message",{event:t,...a});else if("externalmix"===o[1]){const t=a.event;this.emit("message",{event:t,...a})}else"asset"===o[1]&&this.emit("message",{event:"asset",assetId:o[2],...a})}else if("wtr"===o[0]||"gwtr"===o[0]){const t=o[1],r=o[2];"control"===o[3]?this.emit("message",{event:"recorder_control",...a,recorderId:t,sessionId:r}):"monitor"===o[3]&&this.emit("message",{event:"recorder_monitor",...a,recorderId:t,sessionId:r})}}}var w=wt_iot_Iot;var models_auth=function(){var t=this;return{login:(t,r)=>this.__privates.auth.__client.then(i=>i.apis.auth.signIn({},{requestBody:{username:t,password:r}})).then(t=>(this.userId=t.data.userId,this.username=t.data.username,this.__privates.auth.login(t.data.idToken,t.data.accessToken,t.data.refreshToken))),providerLogin:(t,r,i,o)=>(r||"function"!=typeof this.__privates.providerAuth||({token:r,displayname:i}=this.__privates.providerAuth()),this.__privates.auth.__client.then(a=>a.apis.auth.providerSignIn({},{requestBody:{domain:t,token:r,...i&&{displayname:i},...o&&{deviceId:o}}})).then(t=>(this.userId=t.data.userId,this.username=t.data.username,this.__privates.auth.login(t.data.idToken,t.data.accessToken,t.data.refreshToken)))),getProviderAuth:()=>this.__privates.providerAuth,deviceLogin:function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ThisIsSaltyAF";return getBrowserFingerprint(t.__instanceType,r,i).then(r=>Promise.all([r,t.__privates.auth.__client])).then(t=>{let[r,i]=t;return i.apis.auth.deviceSignIn({},{requestBody:{deviceId:r,domain:location.hostname}})}).then(r=>(t.userId=r.data.userId,t.username=r.data.username,t.__privates.auth.login(r.data.idToken,r.data.accessToken,r.data.refreshToken)))},logout:()=>this.__privates.auth.logout(),isLoggedIn:()=>this.__privates.auth.isLoggedIn(),setLanguage:t=>this.__privates.auth.setLanguage(t),getLanguage:()=>this.__privates.auth.__language,signUp:(t,r,i,o)=>this.__privates.auth.__client.then(a=>a.apis.auth.signUp({},{requestBody:{username:t,password:r,email:i,phone:o}})),confirmSignUp:function(r,i,o){let a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return t.__privates.auth.__client.then(t=>t.apis.auth.confirmSignUp({},{requestBody:{confirmationCode:r,username:i,displayname:o,isPublic:a}})).then(r=>(t.userId=r.data.userId,t.username=r.data.username,t.__privates.auth.login(r.data.idToken,r.data.accessToken,r.data.refreshToken)))},resendConfirmationCode:t=>this.__privates.auth.__client.then(r=>r.apis.auth.resendConfirmationCode({},{requestBody:{username:t}})),forgotPassword:t=>this.__privates.auth.__client.then(r=>r.apis.auth.forgotPassword({},{requestBody:{username:t}})),confirmForgotPassword:(t,r,i)=>this.__privates.auth.__client.then(o=>o.apis.auth.confirmForgotPassword({},{requestBody:{password:i,confirmationCode:r,username:t}})),socialAuth:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.auth.socialAuth(r))},$on:(t,r,i)=>this.__privates.auth.on(t,r,i||this),$off:(t,r,i)=>this.__privates.auth.off(t,r,i||this),$clear:()=>this.__privates.auth.clear()}};var sync_hls=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=null;const l=6e4,d=1e4,p=.5,h=3;let m=0,g=null,y=null,v=!1,b=!1,_=2,w=!1,S=!0,I=!1,k=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(g)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),v=!1;const loop=()=>{b=!0,o.emit("playerSyncing",!0),sync().finally(()=>{b=!1,o.emit("playerSyncing",!1),isConnected()&&!v?g=setTimeout(loop,y):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(g),g=null,m=0,v=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(m++,m>h?(y=l,m=0):y=d):(y=l,m=0),t._log("--- Next sync will occur in "+y/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(k)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping);return o&&Math.abs(o)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekBy(o).then(()=>{const o=Date.now()-i,{position:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos+o,r.ping),u=Math.abs(a);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+o/1e3),t._log("Sync precision should be "+u);return setNextWaitTime(u>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{k&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{k&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"bufferStalledError"===r.details&&handleStalledWaiting()},hlsFragChanged=(t,r)=>{u=r.frag.sn},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{var t;let r=a.streamController.fragmentTracker.fragments;if(!r)return 0;let i=r[Object.keys(r).find(t=>t.indexOf(u)>-1)];return i?Math.max(1e3*(a.streamController.lastCurrentTime-((null===(t=i.body)||void 0===t?void 0:t.startPTS)||0)),0):0},calculateSyncDifferenceTime=(r,i,o)=>{var c;let l=a.streamController.fragmentTracker.fragments,d=Object.keys(l).map(t=>parseInt(t.slice(t.lastIndexOf("_")+1))).sort((function(t,r){return t-r})),p=l[Object.keys(l).find(t=>t.indexOf(u)>-1)];if(!p)return t._log("Current fragment not found, what now?",u),{position:null,isBufferSufficient:!1};let h=Math.max(1e3*(a.streamController.lastCurrentTime-((null===(c=p.body)||void 0===c?void 0:c.startPTS)||0)),0),m=1e3*p.body.duration;t._log("Our current fragment is: "+u),t._log("Our current fragment position is: "+h),t._log("Our current fragment length is: "+m);let g=r,y=Math.max(o/2+i,0),v=!1,b=d.indexOf(r)>-1?d.slice(d.indexOf(r)):[];for(let r=0,i=b.length;r<i;r++){let i=b[r],o=1e3*l[Object.keys(l).find(t=>t.indexOf(i)>-1)].body.duration;if(t._log("Correction diff: "+(y-o)),g=i,!(y-o>0)){t._log("Enough at fragment "+i),v=!0;break}t._log("Not enough at fragment "+i),y-=o}if(!v)return t._log(`We don't have required fragment ${g} yet`),{position:null,isBufferSufficient:!1};if(g<u){t._log("We are ahead of master..."),t._log("Real master fragment: "+g),t._log("Our fragment: "+u);let r=h-y,i=d.slice(d.indexOf(g));for(let t=0,o=i.length;t<o;t++){let o=i[t],a=1e3*l[Object.keys(l).find(t=>t.indexOf(o)>-1)].body.duration;if(o>=u)break;r+=a}return t._log("Sync difference is: "+r),{position:r/1e3*-1,isBufferSufficient:!0}}{t._log("We're behind or spot on master..."),t._log("Real master fragment: "+g),t._log("Our fragment: "+u);let r=y-h,i=d.slice(d.indexOf(u));for(let t=0,o=i.length;t<o;t++){let o=i[t],a=1e3*l[Object.keys(l).find(t=>t.indexOf(o)>-1)].body.duration;if(o>=g)break;r+=a}return t._log("We can proceed with seek time: "+r),{position:r/1e3,isBufferSufficient:!0}}},seekBy=r=>new Promise((i,o)=>{if(0!==r)if(r>0&&r<4){t._log("Fast forward to seek...");let a=!1,__=()=>{a&&c.pause(),c.playbackRate=1,I=!1,o("Stalled")},u=r;c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{a&&c.pause(),c.playbackRate=1,I=!1,c.removeEventListener("stalled",__,{once:!0}),i()},1e3*u/(_-1),20),I=!0,c.paused?(a=!0,c.play().then(()=>{c.playbackRate=_})):c.playbackRate=_}else{t._log("Jump to seek...");let o=Date.now();I=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),I=!1,i()},{once:!0}),c.currentTime+=r}else i()}),handlePlaying=()=>{I||(t._log("Handle playing"),startSyncLoop()),I=!1,S=c.paused,w=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),w=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),I||(stopSyncLoop(),clientPaused().catch(()=>{}),S=c.paused)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=u,o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Fragment: "+i),t._log("Fragment position: "+o),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String(i),fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=u,o=parseInt(getCurrentSegmentPosition());return new Promise((a,c)=>{let u=(new Date).getTime(),l=null,d=setTimeout(()=>{t.off("data",fn,this),c("Timeout")},3e3),p={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String(i),fragment_pos:Number(o)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),l||(l=(new Date).getTime()-u)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),l||(l=(new Date).getTime()-u),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+l),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(d),a({isMaster:!!r.sync_master_self,ping:l,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(d),c("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:p}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(d),c(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{hlsInstance:r,libraryInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r||i,c=a.media,a?(k=o,w=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),k&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&a.once("hlsFragChanged",()=>{restartSyncLoop()}),a.on("hlsError",buffering),a.on("hlsFragChanged",hlsFragChanged),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)):t._log("No hls.js player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&(a.off("hlsError",buffering),a.off("hlsFragChanged",hlsFragChanged)),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_hls_vod=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=null,l=!1;const d=6e4,p=1e4,h=.5,m=3;let g=0,y=null,v=null,b=!1,_=!1,w=null,S=300,I=!1,k=!1,x=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(y)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{_=!0,o.emit("playerSyncing",!0),sync().finally(()=>{_=!1,o.emit("playerSyncing",!1),isConnected()&&!b?y=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(y),y=null,g=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>m?(v=d,g=0):v=p):(v=d,g=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster||b)return setNextWaitTime(!1),Promise.resolve();if(x)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),c=getCurrentSegmentPosition()/1e3;return r.masterFragmentSn?playMedia():pauseMedia(),o&&Math.abs(o-c)<=h?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,c=Math.abs(o+(I?r:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!a),t._log("Seek duration is "+r),t._log("Sync precision should be "+c);return setNextWaitTime(c>h),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{x&&propagateMasterFunc(),c&&setTimeout(()=>{c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},1e3)},handleAddRemoteParticipant=()=>{x&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{x&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"bufferStalledError"===r.details&&handleStalledWaiting()},executePlayerIotEvents=r=>{let i=u||t.roomId;"playerReplay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||seekTo(0).then(()=>playMedia()),"playerPlay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||playMedia(),"playerPause"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(r=>{"sendMessage"===r.operation&&executePlayerIotEvents({...r,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)o.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(x&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;return{position:(r+i/2)/1e3,isBufferSufficient:!0}},seekMedia=r=>{if((r={userId:r.from,...r.text&&JSON.parse(r.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:i}=calculateSyncDifferenceTime(r.fragment,r.fragment_pos,0);return t?seekTo(t).then(()=>{x&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();k=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wait(100))).catch(()=>!0).finally(()=>(c.muted=t,k=!1,!0))},playMedia=()=>{c&&c.paused&&(k=!0,c.play().finally(()=>{k=!1}))},pauseMedia=()=>{c&&!c.paused&&(k=!0,c.addEventListener("pause",()=>{k=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(r=>{c.currentTime!==t?(k=!0,c.addEventListener("seeked",()=>{k=!1,r()},{once:!0}),c.currentTime=t):r()}),handlePlaying=()=>{k||i.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handlePause=()=>{k||i.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handleStalledWaiting=()=>{k||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(w),k||(w=setTimeout(()=>{let r=parseInt(getCurrentSegmentPosition());i.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(r)},void 0,null).catch(()=>{}),x||l||pauseMedia()},S))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=r=>{if(!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{hlsInstance:i,libraryInstance:d,propagateMaster:p=!1,isStudio:h=!1,roomId:m,syncDisabled:g}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i||d,c=a.media,u=m,l=g,a?(o.emit("playerSyncing",!1),x=p,I=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),r.iot.$on("message",parseIotEvents),x&&propagateMasterFunc().catch(()=>{}),a&&c&&(p||h?Promise.resolve():prePlay()).then(()=>{a.on("hlsError",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):t._log("No hls.js player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),r.iot.$off("message",parseIotEvents),a&&a.off("hlsError",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),a=null,c=null}}};var sync_native_hls_vod=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=!1;const l=6e4,d=1e4,p=.5,h=3;let m=0,g=null,y=null,v=!1,b=!1,_=null,w=300,S=!1,I=!1,k=!1;const startSyncLoop=()=>{if(u)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(g)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),v=!1;const loop=()=>{b=!0,o.emit("playerSyncing",!0),sync().finally(()=>{b=!1,o.emit("playerSyncing",!1),isConnected()&&!v?g=setTimeout(loop,y):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(g),g=null,m=0,v=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(m++,m>h?(y=l,m=0):y=d):(y=l,m=0),t._log("--- Next sync will occur in "+y/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster||v)return setNextWaitTime(!1),Promise.resolve();if(k)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),c=getCurrentSegmentPosition()/1e3;return r.masterFragmentSn?playMedia():pauseMedia(),o&&Math.abs(o-c)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,c=Math.abs(o+(S?r:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!a),t._log("Seek duration is "+r),t._log("Sync precision should be "+c);return setNextWaitTime(c>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{k&&propagateMasterFunc(),a&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{k&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{k&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,executePlayerIotEvents=r=>{let i=c||t.roomId;"playerReplay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||seekTo(0).then(()=>playMedia()),"playerPlay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||playMedia(),"playerPause"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(r=>{"sendMessage"===r.operation&&executePlayerIotEvents({...r,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)o.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(k&&null!==t.from)return;if(u)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=a&&a.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;return{position:(r+i/2)/1e3,isBufferSufficient:!0}},seekMedia=r=>{if((r={userId:r.from,...r.text&&JSON.parse(r.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:i}=calculateSyncDifferenceTime(r.fragment,r.fragment_pos,0);return t?seekTo(t).then(()=>{k&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(a.currentTime>0||!1===a.paused)return Promise.resolve();I=!0;let t=a.muted;return a.muted=!0,a.play().then(()=>(a.pause(),a.currentTime=0,wait(100))).catch(()=>!0).finally(()=>(a.muted=t,I=!1,!0))},playMedia=()=>{a&&a.paused&&(I=!0,a.play().finally(()=>{I=!1}))},pauseMedia=()=>{a&&!a.paused&&(I=!0,a.addEventListener("pause",()=>{I=!1},{once:!0}),a.pause())},seekTo=t=>new Promise(r=>{a.currentTime!==t?(I=!0,a.addEventListener("seeked",()=>{I=!1,r()},{once:!0}),a.currentTime=t):r()}),handlePlaying=()=>{I||i.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),S=!a.paused},handlePause=()=>{I||i.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),S=!a.paused},handleStalledWaiting=()=>{I||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(_),I||(_=setTimeout(()=>{let r=parseInt(getCurrentSegmentPosition());i.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(r)},void 0,null).catch(()=>{}),k||u||pauseMedia()},w))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=r=>{if(!a)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:S?"1":"0",fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:S?"1":"0",fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{videoElement:i,propagateMaster:l=!1,isStudio:d=!1,roomId:p,syncDisabled:h}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i,c=p,u=h,a?(o.emit("playerSyncing",!1),k=l,S=!1===a.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),r.iot.$on("message",parseIotEvents),k&&propagateMasterFunc().catch(()=>{}),a&&(l||d?Promise.resolve():prePlay()).then(()=>{a.addEventListener("stalled",handleStalledWaiting),a.addEventListener("playing",handlePlaying),a.addEventListener("pause",handlePause),a.addEventListener("seeking",handleSeeking),a.addEventListener("seeked",handleSeeked),a.addEventListener("ended",handleEnded),startSyncLoop()})):t._log("No video element present!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),r.iot.$off("message",parseIotEvents),a&&(a.removeEventListener("stalled",handleStalledWaiting),a.removeEventListener("playing",handlePlaying),a.removeEventListener("pause",handlePause),a.removeEventListener("seeking",handleSeeking),a.removeEventListener("seeked",handleSeeked),a.removeEventListener("ended",handleEnded)),a=null}}};var sync_native_hls=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null;const c=6e4,u=1e4,l=.5,d=3;let p=0,h=null,m=null,g=!1,y=!1,v=2,b=!1,_=!0,w=!1,S=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(h)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),g=!1;const loop=()=>{y=!0,o.emit("playerSyncing",!0),sync().finally(()=>{y=!1,o.emit("playerSyncing",!1),isConnected()&&!g?h=setTimeout(loop,m):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(h),h=null,p=0,g=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(p++,p>d?(m=c,p=0):m=u):(m=c,p=0),t._log("--- Next sync will occur in "+m/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return a.paused&&a.play(),setNextWaitTime(!1),Promise.resolve();if(S)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=l?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+r),t._log("Sync precision should be "+o);return setNextWaitTime(o>l),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{S&&propagateMasterFunc(),a&&!1===a.paused&&a.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{S&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=a&&a.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let c=a.buffered,u={};for(let t=0;t<c.length;t++){let r=c.start(t),i=c.end(t);(!u.start||r<u.start)&&(u.start=r),(!u.end||i>u.end)&&(u.end=i)}let l=(i+o/2)/1e3;return l>u.start&&l<u.end?{position:l,isBufferSufficient:!0}:l<u.start?(t._log(`Syncing to ${u.start} instead of ${l} due to lack of buffered data`),{position:u.start+.5,realPosition:l,isBufferSufficient:!1}):l>u.end?(t._log(`Syncing to ${u.end} instead of ${l} due to lack of buffered data`),{position:u.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=r=>new Promise((i,o)=>{if(a.currentTime!==r){let c=r-a.currentTime;if(a.currentTime<r&&c<4){t._log("Fast forward to seek...");let r=!1,__=()=>{r&&a.pause(),a.playbackRate=1,w=!1,o("Stalled")};a.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{r&&a.pause(),a.playbackRate=1,w=!1,a.removeEventListener("stalled",__,{once:!0}),i()},1e3*c/(v-1),20),w=!0,a.paused?(r=!0,a.play().then(()=>{a.playbackRate=v})):a.playbackRate=v}else{t._log("Jump to seek...");let o=Date.now();w=!0,a.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),w=!1,i()},{once:!0}),a.currentTime=r}}else i()}),handlePlaying=()=>{w||(t._log("Handle playing"),startSyncLoop()),w=!1,_=a.paused,b=!a.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),b=!a.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),w||(stopSyncLoop(),clientPaused().catch(()=>{}),_=a.paused)};let I=null;const stalledGenerator=()=>{clearTimeout(I),I=setTimeout(()=>{!1===a.paused&&handleStalledWaiting()},1e3)},roomSyncSend=r=>{if(!a)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{videoElement:r,syncOnLevelSwitch:i=!1,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r,S=o,b=!1===a.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),S&&propagateMasterFunc().catch(()=>{}),a&&!1===a.paused&&a.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),a.addEventListener("timeupdate",stalledGenerator),a.addEventListener("playing",handlePlaying),a.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&(a.removeEventListener("timeupdate",stalledGenerator),a.removeEventListener("playing",handlePlaying),a.removeEventListener("pause",handlePause))}}};var sync_shaka_dash=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null;const u=6e4,l=1e4,d=.5,p=3;let h=0,m=null,g=null,y=!1,v=!1,b=2,_=!1,w=!0,S=!1,I=!1;const buffering=t=>{t.buffering&&handleStalledWaiting()},startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),y=!1;const loop=()=>{v=!0,o.emit("playerSyncing",!0),sync().finally(()=>{v=!1,o.emit("playerSyncing",!1),isConnected()&&!y?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,h=0,y=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(h++,h>p?(g=u,h=0):g=l):(g=u,h=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+r),t._log("Sync precision should be "+o);return setNextWaitTime(o>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let a=c.buffered,u={};for(let t=0;t<a.length;t++){let r=a.start(t),i=a.end(t);(!u.start||r<u.start)&&(u.start=r),(!u.end||i>u.end)&&(u.end=i)}let l=(i+o/2)/1e3;return l>u.start&&l<u.end?{position:l,isBufferSufficient:!0}:l<u.start?(t._log(`Syncing to ${u.start} instead of ${l} due to lack of buffered data`),{position:u.start+.5,realPosition:l,isBufferSufficient:!1}):l>u.end?(t._log(`Syncing to ${u.end} instead of ${l} due to lack of buffered data`),{position:u.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=r=>new Promise((i,o)=>{if(c.currentTime!==r){let a=r-c.currentTime;if(c.currentTime<r&&a<4){t._log("Fast forward to seek...");let r=!1,__=()=>{r&&c.pause(),c.playbackRate=1,S=!1,o("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{r&&c.pause(),c.playbackRate=1,S=!1,c.removeEventListener("stalled",__,{once:!0}),i()},1e3*a/(b-1),20),S=!0,c.paused?(r=!0,c.play().then(()=>{c.playbackRate=b})):c.playbackRate=b}else{t._log("Jump to seek...");let o=Date.now();S=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),S=!1,i()},{once:!0}),c.currentTime=r}}else i()}),handlePlaying=()=>{S||(t._log("Handle playing"),startSyncLoop()),S=!1,w=c.paused,_=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),S||(stopSyncLoop(),clientPaused().catch(()=>{}),w=c.paused)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{libraryInstance:r,shakaInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r||i,c=a.getMediaElement(),I=o,_=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),I&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),a.addEventListener("buffering",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&a.removeEventListener("buffering",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_shaka_dash_vod=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=null,l=!1;const d=6e4,p=1e4,h=.5,m=3;let g=0,y=null,v=null,b=!1,_=!1,w=null,S=300,I=!1,k=!1,x=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(y)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{_=!0,o.emit("playerSyncing",!0),sync().finally(()=>{_=!1,o.emit("playerSyncing",!1),isConnected()&&!b?y=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(y),y=null,g=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>m?(v=d,g=0):v=p):(v=d,g=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster||b)return setNextWaitTime(!1),Promise.resolve();if(x)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),c=getCurrentSegmentPosition()/1e3;return r.masterFragmentSn?playMedia():pauseMedia(),o&&Math.abs(o-c)<=h?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,c=Math.abs(o+(I?r:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!a),t._log("Seek duration is "+r),t._log("Sync precision should be "+c);return setNextWaitTime(c>h),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{x&&propagateMasterFunc(),c&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{x&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{x&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{t.buffering&&handleStalledWaiting()},executePlayerIotEvents=r=>{let i=u||t.roomId;"playerReplay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||seekTo(0).then(()=>playMedia()),"playerPlay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||playMedia(),"playerPause"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(r=>{"sendMessage"===r.operation&&executePlayerIotEvents({...r,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)o.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(x&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;return{position:(r+i/2)/1e3,isBufferSufficient:!0}},seekMedia=r=>{if((r={userId:r.from,...r.text&&JSON.parse(r.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:i}=calculateSyncDifferenceTime(r.fragment,r.fragment_pos,0);return t?seekTo(t).then(()=>{x&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();k=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wait(100))).catch(()=>!0).finally(()=>(c.muted=t,k=!1,!0))},playMedia=()=>{c&&c.paused&&(k=!0,c.play().finally(()=>{k=!1}))},pauseMedia=()=>{c&&!c.paused&&(k=!0,c.addEventListener("pause",()=>{k=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(r=>{c.currentTime!==t?(k=!0,c.addEventListener("seeked",()=>{k=!1,r()},{once:!0}),c.currentTime=t):r()}),handlePlaying=()=>{k||i.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handlePause=()=>{k||i.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handleStalledWaiting=()=>{k||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(w),k||(w=setTimeout(()=>{let r=parseInt(getCurrentSegmentPosition());i.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(r)},void 0,null).catch(()=>{}),x||l||pauseMedia()},S))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{shakaInstance:i,libraryInstance:d,propagateMaster:p=!1,isStudio:h=!1,roomId:m,syncDisabled:g}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i||d,c=a.getMediaElement(),u=m,l=g,a?(o.emit("playerSyncing",!1),x=p,I=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),r.iot.$on("message",parseIotEvents),x&&propagateMasterFunc().catch(()=>{}),a&&c&&(p||h?Promise.resolve():prePlay()).then(()=>{a.addEventListener("buffering",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):console.log("No shaka player instance")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),r.iot.$off("message",parseIotEvents),a&&a.removeEventListener("buffering",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),a=null,c=null}}};var sync_dash=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null;const u=6e4,l=1e4,d=.5,p=3;let h=0,m=null,g=null,y=!1,v=!1,b=2,_=!1,w=!0,S=!1,I=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),y=!1;const loop=()=>{v=!0,o.emit("playerSyncing",!0),sync().finally(()=>{v=!1,o.emit("playerSyncing",!1),isConnected()&&!y?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,h=0,y=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(h++,h>p?(g=u,h=0):g=l):(g=u,h=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+r),t._log("Sync precision should be "+o);return setNextWaitTime(o>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{"video"!==t.mediaType&&"audio"!==t.mediaType||"bufferStalled"===t.state&&handleStalledWaiting()},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let a=c.buffered,u={};for(let t=0;t<a.length;t++){let r=a.start(t),i=a.end(t);(!u.start||r<u.start)&&(u.start=r),(!u.end||i>u.end)&&(u.end=i)}let l=(i+o/2)/1e3;return l>u.start&&l<u.end?{position:l,realPosition:l,isBufferSufficient:!0}:l<u.start?(t._log(`Syncing to ${u.start} instead of ${l} due to lack of buffered data`),{position:u.start+.5,realPosition:l,isBufferSufficient:!1}):l>u.end?(t._log(`Syncing to ${u.end} instead of ${l} due to lack of buffered data`),{position:u.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=r=>new Promise((i,o)=>{if(c.currentTime!==r){let a=r-c.currentTime;if(c.currentTime<r&&a<4){t._log("Fast forward to seek...");let r=!1,__=()=>{r&&c.pause(),c.playbackRate=1,S=!1,o("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{r&&c.pause(),c.playbackRate=1,S=!1,c.removeEventListener("stalled",__,{once:!0}),i()},1e3*a/(b-1),20),S=!0,c.paused?(r=!0,c.play().then(()=>{c.playbackRate=b})):c.playbackRate=b}else{t._log("Jump to seek...");let o=Date.now();S=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),S=!1,i()},{once:!0}),c.currentTime=r}}else i()}),handlePlaying=()=>{S||(t._log("Handle playing"),startSyncLoop()),S=!1,w=c.paused,_=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),S||(stopSyncLoop(),clientPaused().catch(()=>{}),w=c.paused)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dashInstance:r,libraryInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r||i,c=a.getVideoElement(),a?(I=o,_=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),I&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),a.on("bufferStateChanged",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)):t._log("No dash player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&a.off("bufferStateChanged",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_dash_vod=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null,u=null,l=!1;const d=6e4,p=1e4,h=.5,m=3;let g=0,y=null,v=null,b=!1,_=!1,w=null,S=300,I=!1,k=!1,x=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(y)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{_=!0,o.emit("playerSyncing",!0),sync().finally(()=>{_=!1,o.emit("playerSyncing",!1),isConnected()&&!b?y=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(y),y=null,g=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>m?(v=d,g=0):v=p):(v=d,g=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster||b)return setNextWaitTime(!1),Promise.resolve();if(x)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,isBufferSufficient:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),c=getCurrentSegmentPosition()/1e3;return r.masterFragmentSn?playMedia():pauseMedia(),o&&Math.abs(o-c)<=h?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,c=Math.abs(o+(I?r:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!a),t._log("Seek duration is "+r),t._log("Sync precision should be "+c);return setNextWaitTime(c>h),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{x&&propagateMasterFunc(),c&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{x&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{x&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{"video"!==t.mediaType&&"audio"!==t.mediaType||"bufferStalled"===t.state&&handleStalledWaiting()},executePlayerIotEvents=r=>{let i=u||t.roomId;"playerReplay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||seekTo(0).then(()=>playMedia()),"playerPlay"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||playMedia(),"playerPause"!==r.attributeName||i&&(null==r?void 0:r.roomId)!==i||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(r=>{"sendMessage"===r.operation&&executePlayerIotEvents({...r,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)o.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(x&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;return{position:(r+i/2)/1e3,isBufferSufficient:!0}},seekMedia=r=>{if((r={userId:r.from,...r.text&&JSON.parse(r.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:i}=calculateSyncDifferenceTime(r.fragment,r.fragment_pos,0);return t?seekTo(t).then(()=>{x&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();k=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wait(100))).catch(()=>!0).finally(()=>(c.muted=t,k=!1,!0))},playMedia=()=>{c&&c.paused&&(k=!0,c.play().finally(()=>{k=!1}))},pauseMedia=()=>{c&&!c.paused&&(k=!0,c.addEventListener("pause",()=>{k=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(r=>{c.currentTime!==t?(k=!0,c.addEventListener("seeked",()=>{k=!1,r()},{once:!0}),c.currentTime=t):r()}),handlePlaying=()=>{k||i.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handlePause=()=>{k||i.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),I=!c.paused},handleStalledWaiting=()=>{k||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(w),k||(w=setTimeout(()=>{let r=parseInt(getCurrentSegmentPosition());i.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(r)},void 0,null).catch(()=>{}),x||l||pauseMedia()},S))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:I?"1":"0",fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dashInstance:i,libraryInstance:d,propagateMaster:p=!1,isStudio:h=!1,roomId:m,syncDisabled:g}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i||d,c=a.getVideoElement(),u=m,l=g,a?(o.emit("playerSyncing",!1),x=p,I=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),r.iot.$on("message",parseIotEvents),x&&propagateMasterFunc().catch(()=>{}),a&&c&&(p||h?Promise.resolve():prePlay()).then(()=>{a.on("bufferStateChanged",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):console.log("No player instance")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),r.iot.$off("message",parseIotEvents),a&&a.off("bufferStateChanged",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),a=null,c=null}}};var sync_doris=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null;const u=6e4,l=1e4,d=.5,p=3;let h=0,m=null,g=null,y=!1,v=!1,b=2,_=!1,w=!0,S=!1,I=!1,k=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),y=!1;const loop=()=>{v=!0,o.emit("playerSyncing",!0),sync().finally(()=>{v=!1,o.emit("playerSyncing",!1),isConnected()&&!y?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,h=0,y=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(h++,h>p?(g=u,h=0):g=l):(g=u,h=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,act:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping);return o&&Math.abs(o)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekDoris(o,a).then(()=>{const o=Date.now()-i,{position:a}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos+o,r.ping),u=Math.abs(a);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+o),t._log("Sync precision should be "+u);return setNextWaitTime(u>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{var t;return null===(t=a.getCurrentDate())||void 0===t?0:t.getTime()},calculateSyncDifferenceTime=function(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;var o;let c=null===(o=a.getCurrentDate())||void 0===o?null:o.getTime();return c&&r?{position:(r+i/2-c)/1e3,act:r+i/2,isBufferSufficient:!0}:{position:null,isBufferSufficient:!1}},seekDoris=(r,i)=>new Promise((o,u)=>{if(0!==r)if(k)S=!0,c.addEventListener("playing",()=>{S=!1,o()},{once:!0}),a.seekTo(new Date(i));else if(r>0&&r<4){t._log("Fast forward to seek...");let i=!1,__=()=>{i&&c.pause(),c.playbackRate=1,S=!1,u("Stalled")},a=r;c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{i&&c.pause(),c.playbackRate=1,S=!1,c.removeEventListener("stalled",__,{once:!0}),o()},1e3*a/(b-1),20),S=!0,c.paused?(i=!0,c.play().then(()=>{c.playbackRate=b})):c.playbackRate=b}else{t._log("Jump to seek...");let i=Date.now();S=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-i)/1e3} seconds to seek `),S=!1,o()},{once:!0}),c.currentTime+=r}else o()}),handlePlaying=()=>{S||(t._log("Handle playing"),startSyncLoop()),S=!1,w=c.paused,_=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),S||(stopSyncLoop(),clientPaused().catch(()=>{}),w=c.paused)};let x=null;const stalledGenerator=()=>{clearTimeout(x),x=setTimeout(()=>{!1===c.paused&&handleStalledWaiting()},1e3)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dorisInstance:r,libraryInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r||i,c=a.sourceHandler.getElement(),I=o,_=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),I&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),c.addEventListener("timeupdate",stalledGenerator),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),c&&(c.removeEventListener("timeupdate",stalledGenerator),c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_disabled=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const handleAddLocalParticipant=()=>{removeMaster()},handleAddRemoteParticipant=()=>{removeMaster()},handleRemoveRemoteParticipant=()=>{removeMaster()},removeMaster=()=>t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}});return{__events:[],initialize:function(){let{}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant)},destroy:()=>{t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant)}}};var sync_dazn_dash=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=null,c=null;const u=6e4,l=1e4,d=.5,p=3;let h=0,m=null,g=null,y=!1,v=!1,b=2,_=!1,w=!0,S=!1,I=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),y=!1;const loop=()=>{v=!0,o.emit("playerSyncing",!0),sync().finally(()=>{v=!1,o.emit("playerSyncing",!1),isConnected()&&!y?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,h=0,y=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(h++,h>p?(g=u,h=0):g=l):(g=u,h=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is "+r),t._log("Sync precision should be "+o);return setNextWaitTime(o>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let a=c.buffered,u={};for(let t=0;t<a.length;t++){let r=a.start(t),i=a.end(t);(!u.start||r<u.start)&&(u.start=r),(!u.end||i>u.end)&&(u.end=i)}let l=(i+o/2)/1e3;return l>u.start&&l<u.end?{position:l,realPostion:l,isBufferSufficient:!0}:l<u.start?(t._log(`Syncing to ${u.start} instead of ${l} due to lack of buffered data`),{position:u.start+.5,realPostion:l,isBufferSufficient:!1}):l>u.end?(t._log(`Syncing to ${u.end} instead of ${l} due to lack of buffered data`),{position:u.end-.5,realPostion:l,isBufferSufficient:!1}):{position:null,realPostion:l,isBufferSufficient:!1}},seekTo=r=>new Promise((i,o)=>{if(c.currentTime!==r){let a=r-c.currentTime;if(c.currentTime<r&&a<4){t._log("Fast forward to seek...");let r=!1,__=()=>{r&&c.pause(),c.playbackRate=1,S=!1,o("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{r&&c.pause(),c.playbackRate=1,S=!1,c.removeEventListener("stalled",__,{once:!0}),i()},1e3*a/(b-1),20),S=!0,c.paused?(r=!0,c.play().then(()=>{c.playbackRate=b})):c.playbackRate=b}else{t._log("Jump to seek...");let o=Date.now();S=!0,c.addEventListener("playing",()=>{t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),S=!1,i()},{once:!0}),c.currentTime=r}}else i()}),handlePlaying=()=>{S||(t._log("Handle playing"),startSyncLoop()),S=!1,w=c.paused,_=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),S||(stopSyncLoop(),clientPaused().catch(()=>{}),w=c.paused)},roomSyncSend=r=>{if(!a||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{libraryInstance:r,propagateMaster:i=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=r,c=a.videoElement,I=i,_=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),I&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),a.addEventListener("buffer",handleStalledWaiting),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a&&a.removeEventListener("buffer",handleStalledWaiting),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),a=null}}};var sync_dazn=function(){let{room:t,wt:r,roomSession:i,emitter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=Object(y.a)(),c=null,u={isLive:!0,ignoreBufferedTimeRanges:!0,useSeekBy:!1,syncBySegments:!1,disableFastSeek:!1};const l=6e4,d=1e4,p=.5,h=3,m=5e3;let g=0,v=null,b=null,_=!1,w=!1,S=2,I=!1,k=!0,x=!1,P=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(v)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),_=!1;const loop=()=>{w=!0,o.emit("playerSyncing",!0),sync().finally(()=>{w=!1,o.emit("playerSyncing",!1),isConnected()&&!_?v=setTimeout(loop,b):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(v),v=null,g=0,_=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>h?(b=l,g=0):b=d):(b=l,g=0),t._log("--- Next sync will occur in "+b/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return c.isPaused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(P)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:o,realPosition:a,isBufferSufficient:c}=calculateSyncDifferenceTime(r.masterFragmentSn,r.masterFragmentPos,r.ping),u=getCurrentSegmentPosition()/1e3;return o&&Math.abs(o-u)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==o?seekTo(o).then(()=>{const r=(Date.now()-i)/1e3,o=Math.abs(a+r-getCurrentSegmentPosition()/1e3);t._log(a,r,getCurrentSegmentPosition()),t._log("Insufficient buffer: ",!c),t._log(`Seek duration is ${r} seconds`),t._log("Sync precision should be "+o);return setNextWaitTime(o>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{P&&propagateMasterFunc(),!1===c.isPaused&&a.once("timeupdate",restartSyncLoop)},handleAddRemoteParticipant=()=>{P&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?o.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(r,i,o)=>{let a=c.buffered,l=(i+o/2)/1e3;if(a&&!u.ignoreBufferedTimeRanges){let r={};for(let t=0;t<a.length;t++){let i=a.start(t),o=a.end(t);(!r.start||i<r.start)&&(r.start=i),(!r.end||o>r.end)&&(r.end=o)}return l>r.start&&l<r.end?{position:l,realPosition:l,isBufferSufficient:!0}:l<r.start?(t._log(`Syncing to ${r.start} instead of ${l} due to lack of buffered data`),{position:r.start+.5,realPosition:l,isBufferSufficient:!1}):l>r.end?(t._log(`Syncing to ${r.end} instead of ${l} due to lack of buffered data`),{position:r.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,isBufferSufficient:!1}}return{position:l,realPosition:l,isBufferSufficient:!0}},seekTo=r=>new Promise((i,o)=>{if(c.currentTime!==r){let l=r-c.currentTime;if(c.currentTime<r&&l<4){t._log("Fast forward to seek...");let r=!1,_handleFailed=()=>{r&&c.pause(),c.setPlaybackRate(1),x=!1,o("Stalled")},_fastForward=()=>{x=!0,setExactTimeout(()=>{a.off("stalled",_handleFailed),r&&!u.isLive&&c.pause(),c.setPlaybackRate(1),x=!1,i()},1e3*l/(S-1),20),c.setPlaybackRate(S)};a.once("stalled",_handleFailed),c.isPaused?(r=!0,c.play().then(()=>{_fastForward()}).catch(_handleFailed)):_fastForward()}else{t._log("Jump to seek...");let o=Date.now(),u=null,_resolve=()=>{clearTimeout(u),u=null,x=!1,t._log(`It took the player ${(Date.now()-o)/1e3} seconds to seek `),i()};x=!0,a.once("playing",_resolve),u=setTimeout(_resolve,m),c.seek(r)}}else i()}),handlePlaying=()=>{x||(t._log("Handle playing"),startSyncLoop()),x=!1,k=c.isPaused,I=!c.isPaused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),I=!c.isPaused},handleBuffering=()=>{t._log("handleBuffering"),x||(stopSyncLoop(),clientPaused().catch(()=>{}),k=c.isPaused)},roomSyncSend=r=>{if(!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let i=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to "+r),t._log("Current time: "+i),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i),slave_id:t.webrtcVersion>1e3?String(r):Number(r)}})},getSyncData=()=>{t._log("Sending roomSync request");let r=t.roomId,i=parseInt(getCurrentSegmentPosition());return new Promise((o,a)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:r,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(i)},fn=r=>{r.videoroom&&["sync","sync_response"].includes(r.videoroom)&&(r.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):r.sync_master_fragment||r.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!r.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+r.sync_master_fragment),t._log("Master fragment position: "+r.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),o({isMaster:!!r.sync_master_self,ping:u,masterFragmentPos:parseInt(r.sync_master_fragment_pos),masterFragmentSn:parseInt(r.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),a(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],getHandlers:()=>({handlePause:r=>{t._log("handlePause"),a.emit("pause",r)},handlePlaying:r=>{t._log("handlePlaying"),a.emit("playing",r)},handleBuffering:r=>{t._log("handleBuffering"),a.emit("buffering",r)},handleStalled:r=>{t._log("handleBuffering"),t._log("handleStalled"),a.emit("buffering",r),a.emit("stalled",r)},handleTimeupdate:r=>{t._log("handleTimeupdate"),a.emit("timeupdate",r)}}),initialize:function(){let{playerInterface:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c=r,u={...u,...c.options||{}},t._log("Interface options passed: ",c.options||{}),t._log("All interface options: ",u),P=!1,I=!1===c.isPaused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),P&&propagateMasterFunc().catch(()=>{}),!1===c.isPaused&&a.once("timeupdate",restartSyncLoop),a.on("buffering",handleBuffering),a.on("playing",handlePlaying),a.on("pause",handlePause)},destroy:()=>{var r,i;(stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),"function"==typeof(null===(r=c)||void 0===r?void 0:r.destroy))&&(null===(i=c)||void 0===i||i.destroy());c=null,a.clear()}}};var sync_module=function(){let{room:t,emitter:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object(y.a)(),o=null,a=!1,c={type:"none",ignoreBufferedTimeRanges:!0,disableFastSeek:!1};const u=6e4,l=1e4,d=.5,p=3,h=5e3,m=4;let g=0,v=null,b=null,_=!1,w=!1,S=2,I=2,k=!1,x=!0,P=!1;const startSyncLoop=()=>{if(isConnected()||"push"===c.type)if(v)t._log("--- Sync loop already running ---");else if(t._log("--- Sync enabled ---"),_=!1,"push"!==c.type){const loop=()=>{w=!0,r.emit("playerSyncing",!0),sync().finally(()=>{w=!1,r.emit("playerSyncing",!1),isConnected()&&!_?v=setTimeout(loop,b):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()}else{const loop2=()=>{seekForward().then(()=>{setNextWaitTime(!1)}).catch(t=>{setNextWaitTime(!0),console.log("Sync failed",t)}),v=setTimeout(loop2,b)};loop2()}else t._log("--- Sync loop will not start due to user not connected yet ---")},stopSyncLoop=r=>{t._log("--- Sync disabled ---"),clearTimeout(v),v=null,r||(g=0),_=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r?(g++,g>p?(b=u,g=0):b=l):(b=u,g=0),t._log("--- Next sync will occur in "+b/1e3+" seconds ---")},sync=()=>getSyncData().then(r=>{if(r.isMaster)return o.isPaused&&o.play(),setNextWaitTime(!1),Promise.resolve();if(a)return setNextWaitTime(!1),propagateMasterFunc();{const i=Date.now(),{position:a,realPosition:c,isBufferSufficient:u}=o.getTimeDifference?o.getTimeDifference(r.masterFragmentSn,r.masterFragmentPos,r.ping):getTimeDifference(r.masterFragmentSn,r.masterFragmentPos,r.ping);return a&&Math.abs(a)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null===a||isNaN(a)?(t._log("Position in not a number: ",a),setNextWaitTime(!0),Promise.reject()):seekBy(a).then(()=>{const a=Date.now()-i,{position:c,realPosition:u,isBufferSufficient:l}=o.getTimeDifference?o.getTimeDifference(r.masterFragmentSn,r.masterFragmentPos+a,r.ping):getTimeDifference(r.masterFragmentSn,r.masterFragmentPos+a,r.ping),p=Math.abs(u);t._log("Insufficient buffer: ",!l),t._log(`Seek duration is ${a/1e3} seconds`),t._log("Sync precision should be "+p);return setNextWaitTime(p>d),Promise.resolve()}).catch(r=>(t._log("Seek failed: ",r),setNextWaitTime(!0),Promise.reject(r)))}}).catch(r=>(t._log("getSyncData() failed: ",r),setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{a&&propagateMasterFunc(),!1===o.isPaused&&i.once("timeupdate",restartSyncLoop)},handleAddRemoteParticipant=()=>{a&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentPlayerPosition=()=>{let t=o.currentTime;return isNaN(t)?0:1e3*t},getTimeDifference=(r,i,a)=>{let u=o.buffered,l=(i+a/2)/1e3,d=getCurrentPlayerPosition()/1e3;if(u&&!c.ignoreBufferedTimeRanges){let r={};for(let t=0;t<u.length;t++){let i=u.start(t),o=u.end(t);(!r.start||i<r.start)&&(r.start=i),(!r.end||o>r.end)&&(r.end=o)}return l>r.start&&l<r.end?{position:l-d,realPosition:l-d,isBufferSufficient:!0}:l<r.start?(t._log(`Syncing to ${r.start} instead of ${l} due to lack of buffered data`),{position:r.start+.5-d,realPosition:l-d,isBufferSufficient:!1}):l>r.end?(t._log(`Syncing to ${r.end} instead of ${l} due to lack of buffered data`),{position:r.end-.5-d,realPosition:l-d,isBufferSufficient:!1}):{position:null,isBufferSufficient:!1}}return{position:l-d,realPosition:l-d,isBufferSufficient:!0}},seekForward=()=>new Promise((t,r)=>{let a=o.buffered.end(0)-o.currentTime,c=a-S,__=()=>{o.setPlaybackRate(1),P=!1,w=!1,r("Stalled")};console.log("Users stream is behind behind live by:",a),c>0?(i.once("stalled",__),setExactTimeout(()=>{o.setPlaybackRate(1),P=!1,w=!1,i.off("stalled",__),t()},1e3*c/(I-1),20),P=!0,w=!0,o.setPlaybackRate(I)):t()}),seekBy=r=>new Promise((a,u)=>{if(o.currentTime!==r)if(r>0&&r<m&&!c.disableFastSeek){t._log("Fast forward to seek...");let c=!1,_handleFailed=()=>{c&&o.pause(),o.setPlaybackRate(1),P=!1,u("Stalled")},_fastForward=()=>{P=!0,setExactTimeout(()=>{i.off("stalled",_handleFailed),c&&o.isVod&&o.pause(),o.setPlaybackRate(1),P=!1,a()},1e3*r/(I-1),20),o.setPlaybackRate(I)};i.once("stalled",_handleFailed),o.isPaused?(c=!0,o.play().then(()=>{_fastForward()}).catch(_handleFailed)):_fastForward()}else{t._log("Jump to seek...");let c=Date.now(),u=null,_resolve=()=>{clearTimeout(u),u=null,P=!1,t._log(`It took the player ${(Date.now()-c)/1e3} seconds to seek `),a()};P=!0,i.once("playing",_resolve),u=setTimeout(_resolve,h),o.seek(o.currentTime+r)}else a()}),handlePlaying=()=>{P||(t._log("Handle playing"),startSyncLoop()),P=!1,x=o.isPaused,k=!o.isPaused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),k=!o.isPaused},handleBuffering=()=>{t._log("handleBuffering"),P||(stopSyncLoop(!0),clientPaused().catch(()=>{}),x=o.isPaused)},roomSyncSend=r=>{var i;if(!o)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();var a=(null===(i=o)||void 0===i?void 0:i.currentFragment)||{fragment:String("0"),fragment_pos:Number(parseInt(getCurrentPlayerPosition()))};return t._log("Sending my position to "+r),t._log(`Current time: ${a.fragment} # ${a.fragment_pos}`),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),slave_id:t.webrtcVersion>1e3?String(r):Number(r),...a}})},getSyncData=()=>{var r;t._log("Sending roomSync request");let i=t.roomId;var a=(null===(r=o)||void 0===r?void 0:r.currentFragment)||{fragment:String("0"),fragment_pos:Number(parseInt(getCurrentPlayerPosition()))};return new Promise((r,o)=>{let c=(new Date).getTime(),u=null,l=setTimeout(()=>{t.off("data",fn,this),o("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),...a},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),u||(u=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),u||(u=(new Date).getTime()-c),t._log("I'm master: "+!!i.sync_master_self),t._log("Ping: "+u),t._log("Master fragment: "+i.sync_master_fragment),t._log("Master fragment position: "+i.sync_master_fragment_pos),t.off("data",fn,this),clearTimeout(l),r({isMaster:!!i.sync_master_self,ping:u,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),o("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(r=>{t.off("data",fn,this),clearTimeout(l),o(r)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{playerInterface:r,propagateMaster:u=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o=r,c={...c,...o.syncSettings||{}},a=u,t._log("Interface options passed: ",o.syncSettings||{}),t._log("All interface options: ",c),"none"!==c.type?o.isVod?t._log("VOD sync is not implemented in this sync module yet"):(r.addHandlers({handlePause:r=>{t._log("handlePause"),i.emit("pause",r)},handlePlaying:r=>{t._log("handlePlaying"),i.emit("playing",r)},handleBuffering:r=>{t._log("handleBuffering"),i.emit("buffering",r),i.emit("stalled",r)},handleTimeupdate:r=>{t._log("handleTimeupdate"),i.emit("timeupdate",r)}}),k=!1===o.isPaused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),a&&propagateMasterFunc().catch(()=>{}),!1===o.isPaused&&i.once("timeupdate",restartSyncLoop),i.on("buffering",handleBuffering),i.on("playing",handlePlaying),i.on("pause",handlePause)):t._log("Sync module has been disabled via type:none")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),o=null,i.clear()}}};var room_session=function(t,r,i){let{roomId:o,pinHash:a,role:c,options:u={}}=t,l=o,{simulcast:d=null,simulcastSettings:p=null,enableDtx:h=null,subscriptionRules:m=null}=u,g=["changePlayerSource","chatMessage","userUpdate","reconnecting","connecting","remoteMuted","scaling"];const addEvents=t=>{g=[...g,...t]},v=Object(y.a)();let b,_=null,w=null;return r.on("addLocalParticipant",()=>{clearTimeout(_),_=setTimeout(()=>{b.__requestMuteStatus()},2e3)}),r.on("localMuted",t=>{let{type:r,value:i,source:o,mid:a}=t;b.sendSystemMessage("remote_muted",{type:r,value:i,source:o,mid:a})}),r.on("data",t=>{b.__parseDataEvents(t)}),b={syncModule:null,playerInterface:null,get userId(){return r.userId},get roomId(){return o},get sessionId(){return r.sessionId},get constructId(){return r.constructId},changeUserRole:function(t){c=t},kill:function(){return clearTimeout(_),this.detachPlayer(),r.destroy().finally(()=>(this.$clear(),!0))},destroy:function(){return i.room.destroySession(r.constructId)},connect:function(){var t;let{reactooRoomId:u=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return v.emit("connecting",!0),clearTimeout(_),w=new AbortController,i.room.__joinRoom({roomId:u||l,pinHash:a,role:c},null===(t=w)||void 0===t?void 0:t.signal).then(t=>{var i,a,c,u;return(null==t||null===(i=t.data)||void 0===i?void 0:i.reactooRoomId)!==o&&(o=t.data.reactooRoomId,v.emit("changeRoomId",o)),r.setRoomType(t.data.roomType),r.connect(t.data.roomId,t.data.pin,t.data.href,t.data.iceServers,t.data.accessToken,t.data.display,t.data.userId,t.data.webrtcVersion,t.data.bitrate?parseInt(t.data.bitrate):0,t.data.recordingFilename,null!==d?d:!(null==t||null===(a=t.data)||void 0===a||!a.simulcast),null!==p?p:null==t||null===(c=t.data)||void 0===c?void 0:c.simulcast,null!==h?h:null==t||null===(u=t.data)||void 0===u?void 0:u.enableDtx)}).finally(()=>{v.emit("connecting",!1)})},disconnect:function(t){var i,o;return clearTimeout(_),null===(i=w)||void 0===i||null===(o=i.abort)||void 0===o||o.call(i),r.disconnect(t)},restart:function(){var t;let{isObserver:i=!1,reactooRoomId:o=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};v.emit("reconnecting",!0),r.isRestarting=!0;let a=r.isPublished,c=r._getHandle(r.handleId),u=null;return null!=c&&null!==(t=c.webrtcStuff)&&void 0!==t&&t.stream&&a&&(u=c.webrtcStuff.stream),this.disconnect().then(()=>wait(1e3)).then(()=>this.connect({reactooRoomId:o})).then(()=>i?this.publishLocal(null):u?this.publishLocal(u):Promise.resolve()).then(()=>(r.isRestarting=!1,v.emit("reconnecting",!1),1)).catch(t=>(r.isRestarting=!1,v.emit("reconnecting",!1),v.emit("error",{type:"error",id:26,message:"reconnecting failed",data:t}),Promise.reject(0)))},getStats:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return r._getStats(t)},getRoomParticipants:function(){return r._participants},__parseDataEvents:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("message"===t.videoroom)if("pending_shutdown"===t.action||"shutting_down"===t.action)v.emit("scaling"),this.restart();else if("force_restart"===t.action)this.restart();else if("user_update_displayname"===t.action||"user_update_avatar"===t.action||"user_update_customattributes"===t.action||"user_update_privateattributes"===t.action)v.emit("userUpdate",t.text);else if("bitrate_changed"===t.action)this.setBitrateCap(t.text);else if("chat_message"===t.user_action)v.emit("chatMessage",t);else if("remote_muted"===t.user_action){var i,o;var a,c;if((null===(i=decodeJanusDisplay(t.from))||void 0===i?void 0:i.userId)!==(null===(o=decodeJanusDisplay(r.userId))||void 0===o?void 0:o.userId))v.emit("remoteMuted",{role:null===(a=decodeJanusDisplay(t.from))||void 0===a?void 0:a.role,userId:null===(c=decodeJanusDisplay(t.from))||void 0===c?void 0:c.userId,...t.text&&JSON.parse(t.text)})}else if("remote_muted_request"===t.user_action){var u,l;(null===(u=decodeJanusDisplay(t.from))||void 0===u?void 0:u.userId)!==(null===(l=decodeJanusDisplay(r.userId))||void 0===l?void 0:l.userId)&&this.__sendMuteStatus()}},renderPlayer:function(t,o,a){try{return this.syncModule=sync_dazn({room:r,wt:i,roomSession:this,emitter:v}),this.playerInterface=i.__privates.playerFactory(t,o,this.syncModule.getHandlers(),{roomId:a}),this.syncModule.initialize({playerInterface:this.playerInterface}),!0}catch(t){return!1}},attachPlayer:function(t,o){this.detachPlayer(),"universal"===t?(this.syncModule=sync_module({room:r,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"hlsjs"===t?(this.syncModule=sync_hls({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"hlsjs-vod"===t?(this.syncModule=sync_hls_vod({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"hlsnative-vod"===t?(this.syncModule=sync_native_hls_vod({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"hlsnative"===t?(this.syncModule=sync_native_hls({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"shaka-dash-vod"===t?(this.syncModule=sync_shaka_dash_vod({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"shaka-dash"===t?(this.syncModule=sync_shaka_dash({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"dashjs"===t?(this.syncModule=sync_dash({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"dashjs-vod"===t?(this.syncModule=sync_dash_vod({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"doris"===t?(this.syncModule=sync_doris({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"dazn-dash"===t?(this.syncModule=sync_dazn_dash({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):"disabled"===t?(this.syncModule=sync_disabled({room:r,wt:i,roomSession:this,emitter:v}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(o)):r._log("Synchronisation type not recognised")},detachPlayer:function(){var t;this.syncModule&&(this.playerInterface=null,this.syncModule.destroy(),this.syncModule.__events&&(t=this.syncModule.__events,g=g.filter(r=>-1===t.indexOf(r))),this.syncModule=null)},publishLocal:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1?arguments[1]:void 0;return r.publishLocal(t,i)},unpublishLocal:()=>r.unpublishLocal(),toggleAudio:(t,i)=>r.toggleAudio(t,i),toggleVideo:(t,i)=>r.toggleVideo(t,i),setRestrictSubscribeToUserIds:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return r.setRestrictSubscribeToUserIds(t)},setTalkIntercomChannels:t=>r.setTalkIntercomChannels(t),getTalkIntercomChannels:()=>r._talkIntercomChannels,getUserTalkIntercomChannels:t=>r.getUserTalkIntercomChannels(t),setListenIntercomChannels:t=>r.setListenIntercomChannels(t),getListenIntercomChannels:()=>r._listenIntercomChannels,requestKeyFrame:(t,i)=>r.requestKeyFrame(t,i),selectSubStream:(t,i,o,a)=>r.selectSubStream(t,i,o,a,!0),setBitrateCap:t=>{if("host"!==c)return r.sendMessage(r.handleId,{body:{request:"configure",bitrate:parseInt(t)}}).catch(()=>null)},overrideSimulcastSettings:(t,i,o,a)=>r.overrideSimulcastSettings(t,i,o,a),sendSystemMessage:function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;return r.sendMessage(r.handleId,{body:{action:t,request:"message",room:r.roomId,timestamp:(new Date).getTime(),text:JSON.stringify(i),...o&&Array.isArray(o)?{tos:o}:{to:o},...a&&{set_master:a}}})},sendChatMessage:(t,i)=>r.sendMessage(r.handleId,{body:{action:"chat_message",request:"message",room:r.roomId,timestamp:(new Date).getTime(),text:t,...i&&Array.isArray(i)?{tos:i}:{to:i}}}),__requestMuteStatus:function(){this.sendSystemMessage("remote_muted_request")},__sendMuteStatus:function(){for(const t of r.isMuted)this.sendSystemMessage("remote_muted",{...t})},$on:(t,i,o)=>{v.on(t,i,o||this),r.on(t,i,o||this)},$off:(t,i,o)=>{v.on(t,i,o||this),r.on(t,i,o||this)},$clear:function(){r.clear(),v.clear()}}};var streaming_session=function(){let{roomId:t,pinHash:r,streamId:i,href:o,iceServers:a,accessToken:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return{get userId(){return u.userId},get roomId(){return t},get sessionId(){return u.sessionId},get constructId(){return u.constructId},kill:function(){return u.destroy().finally(()=>(this.$clear(),!0))},destroy:function(){return l.room.destroySession(u.constructId)},connect:function(){return t?Promise.all([l.room.getRoomById(t,r),l.user.getUserSelf()]).then(t=>{let[r,i]=t;return u.startStream(r.data.wtChannel.streamId,r.data.wtChannel.href,r.data.wtChannel.iceServers,r.data.wtChannel.accessToken,i.data._id)}):o?l.user.getUserSelf().then(t=>u.startStream(i,o,a,c,t.data._id)):Promise.reject("Bad Input")},disconnect:function(){return u.stopStream()},$on:(t,r,i)=>u.on(t,r,i||this),$off:(t,r,i)=>u.off(t,r,i||this),$clear:function(){u.clear()}}};var models_room=function(){var t=this;let r=[];return(()=>{window.addEventListener("pagehide",t=>{t.persisted||this.room.destroySessions()}),window.addEventListener("beforeunload",()=>{this.room.destroySessions()})})(),{integration:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.integration({type:t.__instanceType},{requestBody:{...r},requestInterceptor:t=>(t.headers||(t.headers={}),t.headers.Authorization="Bearer "+localStorage.getItem("rwt_idToken"),t)}))},getAnalytics:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.getAnalytics({instanceType:t.__instanceType,...r}))},sendChatMessage:t=>{let{roomId:r,message:i,options:o,senderUserId:a}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.sendRoomMessage({},{requestBody:{roomId:r,message:i,options:o,senderUserId:a}}))},createRoom:function(){let{sourceRoomId:r,title:i,description:o,isPublic:a,isRouter:c,isStudioLayout:u,wtChannelId:l,isHd:d,disableSync:p,reduceRoomControls:h,hasStudioChat:m,maxParticipants:g,customAttributes:y,chatRoomId:v,linkedRoomId:b,type:_,dotAttribute:w}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},S=w?Array.isArray(w)?w.reduce((t,r)=>(t[r.name]=r.value)&&t||t,{}):{[w.name]:w.value}:{};return t.__privates.auth.__client.then(w=>w.apis.wt.createRoom({sourceRoomId:r},{requestBody:{title:i,description:o,isRouter:c,isPublic:a,isStudioLayout:u,wtChannelId:l,isHd:d,disableSync:p,reduceRoomControls:h,chatRoomId:v,linkedRoomId:b,hasStudioChat:m,maxParticipants:g,type:_,customAttributes:y,...S,instanceType:t.__instanceType}}))},updateRoom:function(){let{roomId:r,title:i,description:o,isPublic:a,isRouter:c,recordings:u,slug:l,password:d,maxParticipants:p,setInstanceType:h=!1,wtChannelId:m,isHd:g,isStudioLayout:y,hasStudioChat:v,reduceRoomControls:b,chatRoomId:_,linkedRoomId:w,type:S,disableSync:I,defaultRegion:k,customAttributes:x,dotAttribute:P}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},C=P?Array.isArray(P)?P.reduce((t,r)=>(t[r.name]=r.value)&&t||t,{}):{[P.name]:P.value}:{};return t.__privates.auth.__client.then(P=>P.apis.wt.updateRoom({id:r},{requestBody:{title:i,description:o,slug:l,password:d,isPublic:a,isRouter:c,isHd:g,isStudioLayout:y,hasStudioChat:v,maxParticipants:p,reduceRoomControls:b,chatRoomId:_,linkedRoomId:w,type:S,disableSync:I,defaultRegion:k,customAttributes:x,wtChannelId:m,...C,...h&&{instanceType:!0===h?t.__instanceType:h},...u&&{recordings:u}}}))},deleteRoom:t=>this.__privates.auth.__client.then(r=>r.apis.wt.deleteRoom({id:t})),leaveRoom:t=>this.__privates.auth.__client.then(r=>r.apis.wt.leave({roomId:t})),updateLayout:t=>{let{roomId:r,operation:i,name:o,attributeName:a,value:c,target:u}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.updateLayout({},{requestBody:{roomId:r,operation:i,name:o,attributeName:a,value:c,target:u}}))},getInviteUrl:(t,r,i)=>this.__privates.auth.__client.then(o=>o.apis.wt.invite({},{requestBody:{roomId:t,domain:r||location.host,url:i||location.href}})),getRoomChatList:function(){let{roomId:r,type:i="normal",size:o=50,startKey:a=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c={roomId:r,type:i,size:o,...a&&{startKey:a}};return t.__privates.auth.__client.then(t=>t.apis.wt.getRoomChatList(c))},getRoomsList:function(){let{type:r="participant",activeOnly:i=null,instanceType:o=t.__instanceType,size:a=20,startKey:c=null,includeWtEventModels:u=!1,demo:l=!1,viewType:d="list",wtChannelId:p}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h={type:r,instanceType:o,size:a,includeWtEventModels:u,demo:l,viewType:d,...p&&{wtChannelId:p},...i&&{activeOnly:i},...c&&{startKey:c}};return t.__privates.auth.__client.then(t=>t.apis.wt.getRoomList(h))},setUser:t=>{let{messageId:r,userId:i,roomId:o,flag:a,timestamp:c,option:u}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.setUser({messageId:r,userId:i,roomId:o,flag:a,timestamp:c,option:u}))},getRoomById:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=arguments.length>4?arguments[4]:void 0;return t.__privates.auth.__client.then(t=>t.apis.wt.getRoom({id:r,pinHash:i,public:o,demo:a},{...c?{requestInterceptor:t=>(t.signal=c,t)}:{}}))},getRoomBySlug:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return t.__privates.auth.__client.then(t=>t.apis.wt.getRoom({slug:r,password:i,public:o,demo:a}))},roomRecorder:function(){let{roomId:r,operation:i="get",config:o,outputs:a,destinationIds:c,destinations:u,screenWidth:l,screenHeight:d,payload:p}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.recordRoom({},{requestBody:{roomId:r,operation:i,config:o,outputs:a,destinationIds:c,destinations:u,screenWidth:l,screenHeight:d,payload:p}}))},__joinRoom:function(){let{roomId:r,pinHash:i,instanceType:o=t.__instanceType,role:a="participant",customBearer:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=arguments.length>1?arguments[1]:void 0;return t.__privates.auth.__client.then(c=>c.apis.wt.join({roomId:r,pinHash:i,instanceType:o,role:a,platform:"firefox"===t.browser?"web-firefox":"web"},{...u?{requestInterceptor:t=>(t.signal=u,t)}:{}}))},isSafariSupported:()=>this.__privates.room.safariVp8,isWebrtcSupported:()=>this.__privates.room.isWebrtcSupported,createStreamingSession:function(){let{constructId:i,roomId:o,pinHash:a,streamId:c,href:u,iceServers:l,accessToken:d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.room.whenInitialized.then(r=>streaming_session.call(t,{roomId:o,pinHash:a,streamId:c,href:u,iceServers:l,accessToken:d},r.createSession(i,"streaming"),t)).then(i=>r.findIndex(t=>t.constructId===i.constructId)>-1?t.room.destroySession(i.constructId).then(()=>(r.push(i),i)):(r.push(i),i))},createSession:t=>{let{constructId:i,roomId:o,pinHash:a,role:c,options:u}=t;return this.__privates.room.whenInitialized.then(t=>room_session.call(this,{roomId:o,pinHash:a,role:c,options:u},t.createSession(i,"reactooroom",u),this)).then(t=>r.findIndex(r=>r.constructId===t.constructId)>-1?this.room.destroySession(t.constructId).then(()=>(r.push(t),t)):(r.push(t),t))},getSessions:()=>r,getSessionByConstructId:t=>r.find(r=>r.constructId===t)||null,getSessionBySessionId:t=>r.find(r=>r.sessionId===t)||null,getSessionByRoomId:t=>r.find(r=>r.roomId===t)||null,getSessionByUserId:t=>r.find(r=>{var i;return(null===(i=decodeJanusDisplay(r.userId))||void 0===i?void 0:i.userId)===t})||null,getSessionByStreamId:t=>r.find(r=>r.streamId===t)||null,destroySession:t=>{let i=r.findIndex(r=>r.constructId===t);return i>-1?r[i].kill().finally(()=>(r.splice(i,1),!0)):Promise.resolve()},destroySessionBySessionId:t=>{let i=r.findIndex(r=>r.sessionId===t);return i>-1?r[i].kill().finally(()=>(r.splice(i,1),!0)):Promise.resolve()},destroySessions:()=>{r.forEach(t=>t.destroy().catch(t=>this.log(t))),r.length=0},queue:function(){let{roomId:r,operation:i,userId:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.queue({},{requestBody:{roomId:r,operation:i,userId:o}}))},getDefaultRegions:()=>this.__privates.auth.__client.then(t=>{var r,i,o,a,c,u;return[...(null===(r=t.spec)||void 0===r||null===(i=r.components)||void 0===i||null===(o=i.schemas)||void 0===o||null===(a=o.WtRoom)||void 0===a||null===(c=a.properties)||void 0===c||null===(u=c.defaultRegion)||void 0===u?void 0:u.enum)||[""]]})}},S=i(160);var models_user=function(){var t=this;return{updateUserSelf:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.user.updateMyself({...r.lastRoomId&&{lastRoomId:r.lastRoomId}},{requestBody:{...r}}))},updateUser:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.user.updateUser({id:r.id,lastRoomId:r.lastRoomId},{requestBody:{displayname:r.displayname,bio:r.bio}}))},uploadAvatar:(t,r)=>{let i=generateUUID();return this.__privates.auth.__client.then(t=>Promise.all([t,t.apis.user.initiateMyAvatarUpload({id:i})])).then(r=>{let[i,o]=r;return Promise.all([i,i.http({url:o.data.signedUrl,method:o.data.httpMethod,headers:{"Content-Type":t.type},body:t})])}).then(t=>{let[o,a]=t;return o.apis.user.publishMyAvatar({id:i,lastRoomId:r})})},unsetAvatar:t=>this.__privates.auth.__client.then(r=>r.apis.user.publishMyAvatar({lastRoomId:t})),uploadReaction:t=>{let r=generateUUID();return this.__privates.auth.__client.then(i=>Promise.all([i,i.apis.reaction.initiateReactionUpload({id:r,segmentCount:t.length||0})])).then(r=>{let[i,o]=r;return Promise.all([i,...o.data.signedUrlSegments.map((r,a)=>i.http({url:r,method:o.data.httpMethod,headers:{"Content-Type":t[a].type},body:t[a]}))])}).then(t=>{let[i]=t;return i.apis.reaction.processReaction({id:r,type:"concat"})}).then(t=>t.data.key)},uploadVideo:function(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0,c=generateUUID();return t.__privates.auth.__client.then(t=>Promise.all([t,t.apis.video.initiateVideoUpload({id:c,segmentCount:i.length||0})])).then(t=>{let[r,o]=t;return Promise.all([r,o.data.signedUrlSegments.reduce((t,a,c)=>t.then(()=>r.http({url:a,method:o.data.httpMethod,headers:{"Content-Type":i[c].type},body:i[c]})),Promise.resolve())])}).then(t=>{let[i]=t;return i.apis.video.publishVideo({_id:c,roomId:r,customPrice:a},{requestBody:{_id:c,roomId:r,privateAttributes:o,customPrice:a}})})},publishVideo:function(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;return t.__privates.auth.__client.then(t=>t.apis.video.publishVideo({_id:i,roomId:r,customPrice:a},{requestBody:{_id:i,roomId:r,privateAttributes:o}}))},getReactionById:t=>this.__privates.auth.__client.then(r=>r.apis.reaction.getReactionById({id:t})),getReactions:function(){let{userId:r,roomId:i,type:o,size:a,startKey:c,includeUserModels:u=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l={...i&&{roomId:i},...r&&{userId:r},...a&&{size:a},...c&&{startKey:c},includeUserModels:u,type:o};return t.__privates.auth.__client.then(t=>t.apis.reaction.getReactions(l))},getVideoById:t=>this.__privates.auth.__client.then(r=>r.apis.video.getVideoById({id:t})),getVideos:function(){let{roomId:r,userId:i,type:o,size:a,startKey:c,ids:u,includeUserModels:l=!1,includeRoomQueueStatus:d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return chunkArray(u,50).reduce((u,p)=>u.then(u=>{let h={...r&&{roomId:r},...i&&{userId:i},...a&&{size:a},...(null==p?void 0:p.length)&&{ids:p.join(",")},...c&&{startKey:c},...d&&{includeRoomQueueStatus:d},includeUserModels:l,type:o};return t.__privates.auth.__client.then(t=>t.apis.video.getVideos(h)).then(t=>"ids"===o?{data:{items:[...u.data.items,...t.data.items],size:u.data.size+t.data.size,startKey:null}}:t)}),Promise.resolve({data:{items:[],size:0,startKey:null}}))},deleteVideo:t=>this.__privates.auth.__client.then(r=>r.apis.video.deleteVideo({id:t})),getUserSelf:()=>this.__privates.auth.__client.then(t=>t.apis.user.getUserMyself()),getUserById:t=>this.__privates.auth.__client.then(r=>r.apis.user.getUserById({id:t})),getUsersByIds:function(){let{ids:r=[],size:i=null,startKey:o=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return chunkArray(r,50).reduce((r,a)=>r.then(r=>{let c={type:"ids",...i&&{size:i},...(null==a?void 0:a.length)&&{ids:a.join(",")},...o&&{startKey:o}};return t.__privates.auth.__client.then(t=>t.apis.user.getUsers(c)).then(t=>({data:{items:[...r.data.items,...t.data.items],size:r.data.size+t.data.size,startKey:null}}))}),Promise.resolve({data:{items:[],size:0,startKey:null}}))},getUsers:function(){let{type:r,userId:i,roomId:o,size:a=20,startKey:c=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u={type:r,size:a,...o&&{roomId:o},...i&&{userId:i},...c&&{startKey:c}};return t.__privates.auth.__client.then(t=>t.apis.user.getUsers(u))},track:function(){let{eventType:r="ERROR",message:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.track({},{requestBody:{eventType:r,appType:"web",deviceType:"desktop"+(navigator.maxTouchPoints?"/touch":""),os:navigator.platform,browser:navigator.userAgent,domain:location.host,url:location.href,message:Object(S.a)(i)}}))},getTranslation:function(){let{namespace:r="wt"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getTranslation({namespace:r}))},getConfig:function(){let{instanceType:r=t.__instanceType,domain:i=location.hostname}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getConfig({instanceType:r,domain:i}))},getIntegrationPublic:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.apis.system.integrationPublic({type:r},{requestBody:{...i}}))},updateConfig:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.wt.updateConfig({id:r.instanceType||t.__instanceType},{requestBody:{...r}}))},admin:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.wt.admin({},{requestBody:{instanceType:t.__instanceType,...r}}))},analytics:function(){let{action:r,startKey:i=null,limit:o=20}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a={action:r,limit:o,...i&&{startKey:i}};return t.__privates.auth.__client.then(r=>r.apis.wt.analytics({},{requestBody:{instanceType:t.__instanceType,...a}}))}}};var models_asset=function(){var t=this;return{getAssetList:t=>{let{type:r="instanceType",instanceType:i,assetType:o,size:a=20,startKey:c=null,roomId:u,ids:l}=t;return chunkArray(l,50).reduce((t,d)=>t.then(t=>{let p={type:r,...i&&{instanceType:!0===i?this.__instanceType:i},...o&&{assetType:o},...a&&!l&&{size:a},...(null==d?void 0:d.length)&&{ids:d.join(",")},...u&&{roomId:u},...c&&{startKey:c}};return this.__privates.auth.__client.then(t=>t.apis.asset.getAssetList(p)).then(i=>"ids"===r?{data:{items:[...t.data.items,...i.data.items],size:t.data.size+i.data.size,startKey:null}}:i)}),Promise.resolve({data:{items:[],size:0,startKey:null}}))},getAssetById:t=>this.__privates.auth.__client.then(r=>r.apis.asset.getAssetById({id:t})),updateAsset:function(){let{id:r,assetType:i,title:o,roomIds:a,customAttributes:c,encodeTransparency:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.asset.updateAsset({id:r},{requestBody:{assetType:i,title:o,roomIds:a,customAttributes:c,encodeTransparency:u}}))},deleteAsset:t=>this.__privates.auth.__client.then(r=>r.apis.asset.deleteAsset({id:t})),initiateAssetUpload:function(){return t.__privates.auth.__client.then(t=>t.apis.asset.initiateAssetUpload())},uploadAsset:function(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return t.__privates.auth.__client.then(t=>Promise.all([t,a?Promise.resolve(a):t.apis.asset.initiateAssetUpload({id:o||generateUUID()})])).then(t=>{let[i,o]=t;return Promise.all([i,i.http({url:o.data.signedUrl,method:o.data.httpMethod,headers:{"Content-Type":r.type},body:r}),o.data.id])}).then(t=>{let[o,a,c]=t;return Promise.all([o.apis.asset.publishAsset({id:c},{requestBody:{title:r.name,...i?{roomIds:i}:{}}}),c])})},downloadAsset:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.http({url:r,method:"GET",...i}))}}};var models_system=function(){var t=this;return{integration:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.integration({type:t.__instanceType},{requestBody:{...r},requestInterceptor:t=>(t.headers||(t.headers={}),t.headers.Authorization="Bearer "+localStorage.getItem("rwt_idToken"),t)}))},getAnalytics:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.getAnalytics({instanceType:t.__instanceType,...r}))},getTranslation:function(){let{namespace:r="wt"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getTranslation({namespace:r}))},getConfig:function(){let{instanceType:r=t.__instanceType,domain:i=location.hostname}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getConfig({instanceType:r,domain:i}))},updateConfig:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.system.updateConfig({id:r.instanceType||t.__instanceType},{requestBody:{...r}}))},getIntegrationPublic:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.apis.system.integrationPublic({type:r},{requestBody:{...i}}))},admin:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(i=>i.apis.wt.admin({},{requestBody:{instanceType:t.__instanceType,...r}}))},analytics:function(){let{action:r,startKey:i=null,limit:o=20}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a={action:r,limit:o,...i&&{startKey:i}};return t.__privates.auth.__client.then(r=>r.apis.wt.analytics({},{requestBody:{instanceType:t.__instanceType,...a}}))},track:function(){let{eventType:r="ERROR",message:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.track({},{requestBody:{eventType:r,appType:"web",deviceType:"desktop"+(navigator.maxTouchPoints?"/touch":""),os:navigator.platform,browser:navigator.userAgent,domain:location.host,url:location.href,message:Object(S.a)(i)}}))},getSchemas:()=>this.__privates.auth.__client.then(t=>{var r,i;return null===(r=t.spec)||void 0===r||null===(i=r.components)||void 0===i?void 0:i.schemas}),getClient:()=>this.__privates.auth.__client.then(t=>t)}};const getUserMediaConstraints=t=>{let{hasVideo:r,hasAudio:i=!0,aDeviceId:o,vDeviceId:a,autoGainControl:c=!1,echoCancellation:u=!0,noiseSuppression:l=!0,channelCount:d=1,width:p=1920,height:h=1080}=t,m={audio:{...o&&{deviceId:{exact:o}},autoGainControl:c,echoCancellation:u,noiseSuppression:l,channelCount:d}},g={video:{...a&&{deviceId:{exact:a}},facingMode:{ideal:"user"},frameRate:{ideal:30,max:30},width:{ideal:p},height:{ideal:h}}};return{...i?m:{audio:!1},...r?g:{video:!1}}};var I={applyConstraints(t){let{autoGainControl:r=!1,echoCancellation:i=!0,noiseSuppression:o=!0,channelCount:a=1,stream:c=null,width:u,height:l}=t;if(c){let t=getUserMediaConstraints({hasVideo:!0,hasAudio:!0,autoGainControl:r,echoCancellation:i,noiseSuppression:o,channelCount:a,width:u,height:l}),d=[];const p=c.getVideoTracks()[0];p&&d.push(p.applyConstraints(t.video));const h=c.getAudioTracks()[0];return h&&d.push(h.applyConstraints(t.audio)),Promise.all(d).then(()=>c)}return Promise.resolve(null)},getUserStream(){let{hasVideo:t,hasAudio:r=!0,aDeviceId:i,vDeviceId:o,autoGainControl:a=!1,echoCancellation:c=!0,noiseSuppression:u=!0,channelCount:l=1,muteAudio:d=!1,muteVideo:p=!1,width:h=1920,height:m=1080}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},g=getUserMediaConstraints({hasVideo:t,hasAudio:r,aDeviceId:i,vDeviceId:o,autoGainControl:a,echoCancellation:c,noiseSuppression:u,channelCount:l,width:h,height:m});return navigator.mediaDevices.getUserMedia(g).then(t=>(t.getAudioTracks().forEach(t=>t.enabled=!d),t.getVideoTracks().forEach(t=>t.enabled=!p),t))},getHostStream(){let{hasAudio:t,hasVideo:r,aDeviceId:i,vDeviceId:o,autoGainControl:a=!1,echoCancellation:c=!1,noiseSuppression:u=!1,channelCount:l=1,width:d=1920,height:p=1080}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h={audio:{...i&&{deviceId:{exact:i}},autoGainControl:a,echoCancellation:c,noiseSuppression:u,channelCount:l}},m={video:{...o&&{deviceId:{exact:o}},frameRate:{ideal:30,max:30},width:d,height:p}},g={...t?h:{audio:!1},...r?m:{video:!1}};return navigator.mediaDevices.getUserMedia(g)},getDisplayMedia:()=>navigator.mediaDevices.getDisplayMedia({video:{cursor:"always",displaySurface:"monitor",logicalSurface:!1},surfaceSwitching:"include",selfBrowserSurface:"exclude",systemAudio:"exclude"})};var models_iot=function(){var t=this;let r=[],i=null;return{__promise:null,__reconnect:t=>{this.__privates.iot.log("MQTT Error:",t,"Is event error: "+(t instanceof Event)),t instanceof Event&&"error"===t.type&&(this.__privates.iot.log("SDK MQTT Reconnection attempt"),clearTimeout(i),i=setTimeout(()=>{this.iot.iotLogin(!0,!0).catch(t=>this.__privates.iot.log("MQTT Connection Error:",t))},1e3))},__updateCredentials:()=>{this.iot.getCredentials().then(t=>this.__privates.iot.updateWebSocketCredentials(t.data.credentials.accessKeyId,t.data.credentials.secretAccessKey,t.data.credentials.sessionToken,t.data.credentials.expiration))},getCredentials:()=>this.__privates.auth.__client.then(t=>t.apis.auth.iotSignIn({},{requestBody:{suggestedTopics:!0,domain:location.hostname}})),iotLogin:function(){let i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.iot.$off("error",t.iot.__reconnect,t),t.iot.__promise=new Promise((r,i)=>{t.iot.getCredentials().then(r=>Promise.all([r.data.suggestedTopics,t.__privates.iot.connect(r.data.endpoint,r.data.clientId,r.data.region,r.data.credentials.accessKeyId,r.data.credentials.secretAccessKey,r.data.credentials.sessionToken,r.data.credentials.expiration,o)])).then(r).catch(i)});let a=[...r];return r.length=0,t.iot.__promise.then(r=>{let[o,c]=r;if(!i)return Promise.resolve(c);let u=[...o,...a];return u=u.filter((t,r)=>u.indexOf(t)===r),Promise.all(u.map(r=>t.iot.subscribe(r))).then(()=>c)}).then(r=>(t.iot.$on("error",t.iot.__reconnect,t),t.iot.$on("updateCredentials",t.iot.__updateCredentials,t),r)),t.iot.__promise},iotLogout:function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.iot.$off("error",t.iot.__reconnect,t),t.iot.$off("updateCredentials",t.iot.__updateCredentials,t),i||(r.length=0),t.__privates.iot.disconnect().then(()=>(t.iot.__promise=null,!0))},isConnected:()=>this.__privates.iot.isConnected(),subscribe:t=>{if(-1===r.indexOf(t))return r.push(t),this.iot.__promise?this.iot.__promise.then(()=>this.__privates.iot.subscribe(t)):Promise.resolve("not_connected")},unsubscribe:t=>{let i=r.indexOf(t);return i>-1&&r.splice(i,1),this.iot.__promise?this.iot.__promise.then(()=>this.__privates.iot.unsubscribe(t)):Promise.resolve("not_connected")},send:(t,r)=>this.iot.__promise.then(()=>this.__privates.iot.send(t,r)),$once:(t,r,i)=>this.__privates.iot.once(t,r,i||this),$on:(t,r,i)=>this.__privates.iot.on(t,r,i||this),$off:(t,r,i)=>this.__privates.iot.off(t,r,i||this),$clear:()=>this.__privates.iot.clear()}};function WatchTogether(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;this.username=null,this.userId=null,this.__instanceType=r,this.__debug=i,this.__privates={playerFactory:o,providerAuth:a,room:t.room,auth:t.auth,iot:t.iot},this.setInstanceType=t=>this.__instanceType=t,this.isReady=t.room.whenInitialized,this.browser=t.room.browser,this.browserDetails=t.room.browserDetails,this.auth={...models_auth.call(this)},this.user={...models_user.call(this)},this.room={...models_room.call(this)},this.asset={...models_asset.call(this)},this.system={...models_system.call(this)},this.iot={...models_iot.call(this)},this.utils=I}r.default=function(){let{debug:t=!0,language:r="en-GB",storagePrefix:i="reactoo_",apiUrl:o=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=new v(t),c=new b.a(t,r,i,o),u=new w(t);return function(){let{instanceType:r="reactooDemo",playerFactory:i=null,providerAuth:o=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new WatchTogether({room:a,auth:c,iot:u},r,t,i,o)}}}]).default}));
|